nothumanallowed 16.0.0 → 16.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/constants.mjs +1 -1
- package/src/ui-dist/assets/index-BjqGA-KY.css +1 -0
- package/src/ui-dist/assets/index-CQY4us37.js +863 -0
- package/src/ui-dist/index.html +2 -2
- package/src/ui-dist/assets/index-6sPt_3Be.js +0 -863
- package/src/ui-dist/assets/index-C9ZZfWVS.css +0 -1
|
@@ -1,863 +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,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},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=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},ee=Object.prototype.hasOwnProperty;function T(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function te(e,t){return T(e.type,t,e.props)}function ne(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function E(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var D=/\/+/g;function O(e,t){return typeof e==`object`&&e&&e.key!=null?E(``+e.key):t.toString(36)}function re(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 k(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,k(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+O(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(D,`$&/`)+`/`),k(o,r,i,``,function(e){return e})):o!=null&&(ne(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(D,`$&/`)+`/`)+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+O(a,u),c+=k(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+O(a,u++),c+=k(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return k(re(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 ie(e,t,n){if(e==null)return e;var r=[],i=0;return k(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function A(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 j=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)},ae={map:ie,forEach:function(e,t,n){ie(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ie(e,function(){t++}),t},toArray:function(e){return ie(e,function(e){return e})||[]},only:function(e){if(!ne(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ae,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)!ee.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 T(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)ee.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 T(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=ne,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:A}},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,j)}catch(e){j(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.6`})),u=o(((e,t)=>{t.exports=l()})),d=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,ne());else{var t=n(l);t!==null&&O(x,t.startTime-e)}}var S=!1,C=-1,w=5,ee=-1;function T(){return g?!0:!(e.unstable_now()-ee<w)}function te(){if(g=!1,S){var t=e.unstable_now();ee=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&O(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ne():S=!1}}}var ne;if(typeof y==`function`)ne=function(){y(te)};else if(typeof MessageChannel<`u`){var E=new MessageChannel,D=E.port2;E.port1.onmessage=te,ne=function(){D.postMessage(null)}}else ne=function(){_(te,0)};function O(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):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,O(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ne()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();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.6`})),m=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=p()})),h=o((e=>{var t=f(),n=u(),r=m();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 d(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 p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=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`),ee=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),te=Symbol.for(`react.memo`),ne=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function re(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var k=Symbol.for(`react.client.reference`);function ie(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===k?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 ee:return`Suspense`;case T:return`SuspenseList`;case E: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 te:return t=e.displayName||null,t===null?ie(e.type)||`Memo`:t;case ne:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var A=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},se=[],ce=-1;function le(e){return{current:e}}function ue(e){0>ce||(e.current=se[ce],se[ce]=null,ce--)}function M(e,t){ce++,se[ce]=e.current,e.current=t}var N=le(null),de=le(null),fe=le(null),pe=le(null);function me(e,t){switch(M(fe,t),M(de,e),M(N,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ue(N),M(N,e)}function he(){ue(N),ue(de),ue(fe)}function ge(e){e.memoizedState!==null&&M(pe,e);var t=N.current,n=Kd(t,e.type);t!==n&&(M(de,e),M(N,n))}function _e(e){de.current===e&&(ue(N),ue(de)),pe.current===e&&(ue(pe),tp._currentValue=oe)}var ve,ye;function be(e){if(ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ve=t&&t[1]||``,ye=-1<e.stack.indexOf(`
|
|
2
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
-
`+ve+e+ye}var xe=!1;function P(e,t){if(!e||xe)return``;xe=!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{xe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?be(n):``}function Se(e,t){switch(e.tag){case 26:case 27:case 5:return be(e.type);case 16:return be(`Lazy`);case 13:return e.child!==t&&t!==null?be(`Suspense Fallback`):be(`Suspense`);case 19:return be(`SuspenseList`);case 0:case 15:return P(e.type,!1);case 11:return P(e.type.render,!1);case 1:return P(e.type,!0);case 31:return be(`Activity`);default:return``}}function Ce(e){try{var t=``,n=null;do t+=Se(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
-
Error generating stack: `+e.message+`
|
|
8
|
-
`+e.stack}}var we=Object.prototype.hasOwnProperty,Te=t.unstable_scheduleCallback,F=t.unstable_cancelCallback,Ee=t.unstable_shouldYield,De=t.unstable_requestPaint,Oe=t.unstable_now,I=t.unstable_getCurrentPriorityLevel,L=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,Ae=t.unstable_NormalPriority,je=t.unstable_LowPriority,Me=t.unstable_IdlePriority,Ne=t.log,Pe=t.unstable_setDisableYieldValue,Fe=null,Ie=null;function Le(e){if(typeof Ne==`function`&&Pe(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(Fe,e)}catch{}}var Re=Math.clz32?Math.clz32:Be,R=Math.log,ze=Math.LN2;function Be(e){return e>>>=0,e===0?32:31-(R(e)/ze|0)|0}var Ve=256,He=262144,Ue=4194304;function We(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 Ge(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=We(n))):i=We(o):i=We(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=We(n))):i=We(o)):i=We(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 Ke(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function qe(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 Je(){var e=Ue;return Ue<<=1,!(Ue&62914560)&&(Ue=4194304),e}function Ye(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ze(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-Re(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&&Qe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Qe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Re(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function $e(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Re(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function et(e,t){var n=t&-t;return n=n&42?1:tt(n),(n&(e.suspendedLanes|t))===0?n:0}function tt(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 nt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function rt(){var e=ae.p;return e===0?(e=window.event,e===void 0?32:gp(e.type)):e}function it(e,t){var n=ae.p;try{return ae.p=e,t()}finally{ae.p=n}}var at=Math.random().toString(36).slice(2),ot=`__reactFiber$`+at,st=`__reactProps$`+at,ct=`__reactContainer$`+at,lt=`__reactEvents$`+at,ut=`__reactListeners$`+at,dt=`__reactHandles$`+at,ft=`__reactResources$`+at,pt=`__reactMarker$`+at;function mt(e){delete e[ot],delete e[st],delete e[lt],delete e[ut],delete e[dt]}function ht(e){var t=e[ot];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ct]||n[ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hf(e);e!==null;){if(n=e[ot])return n;e=hf(e)}return t}e=n,n=e.parentNode}return null}function gt(e){if(e=e[ot]||e[ct]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function _t(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function vt(e){var t=e[ft];return t||=e[ft]={hoistableStyles:new Map,hoistableScripts:new Map},t}function z(e){e[pt]=!0}var yt=new Set,bt={};function xt(e,t){St(e,t),St(e+`Capture`,t)}function St(e,t){for(bt[e]=t,e=0;e<t.length;e++)yt.add(t[e])}var Ct=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]*$`),wt={},Tt={};function B(e){return we.call(Tt,e)?!0:we.call(wt,e)?!1:Ct.test(e)?Tt[e]=!0:(wt[e]=!0,!1)}function Et(e,t,n){if(B(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 Dt(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 Ot(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 kt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function At(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function jt(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 V(e){if(!e._valueTracker){var t=At(e)?`checked`:`value`;e._valueTracker=jt(e,t,``+e[t])}}function Mt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=At(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Nt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Pt=/[\n"\\]/g;function Ft(e){return e.replace(Pt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function It(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+kt(t)):e.value!==``+kt(t)&&(e.value=``+kt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Rt(e,o,kt(n)):Rt(e,o,kt(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=``+kt(s):e.removeAttribute(`name`)}function Lt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){V(e);return}n=n==null?``:``+kt(n),t=t==null?n:``+kt(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),V(e)}function Rt(e,t,n){t===`number`&&Nt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function zt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+kt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Bt(e,t,n){if(t!=null&&(t=``+kt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+kt(n)}function Vt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(A(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=kt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),V(e)}function Ht(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var H=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 Ut(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||H.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Wt(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&&Ut(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Ut(e,o,t[o])}function Gt(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 Kt=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 Jt(e){return qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Yt(){}var U=null;function Xt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zt=null,Qt=null;function $t(e){var t=gt(e);if(t&&(e=t.stateNode)){var n=e[st]||null;a:switch(e=t.stateNode,t.type){case`input`:if(It(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Ft(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[st]||null;if(!a)throw Error(i(90));It(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Mt(r)}break a;case`textarea`:Bt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&zt(e,!!n.multiple,t,!1)}}}var en=!1;function W(e,t,n){if(en)return e(t,n);en=!0;try{return e(t)}finally{if(en=!1,(Zt!==null||Qt!==null)&&(xu(),Zt&&(t=Zt,e=Qt,Qt=Zt=null,$t(t),e)))for(t=0;t<e.length;t++)$t(e[t])}}function tn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[st]||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 nn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),rn=!1;if(nn)try{var an={};Object.defineProperty(an,`passive`,{get:function(){rn=!0}}),window.addEventListener(`test`,an,an),window.removeEventListener(`test`,an,an)}catch{rn=!1}var G=null,on=null,sn=null;function cn(){if(sn)return sn;var e,t=on,n=t.length,r,i=`value`in G?G.value:G.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 sn=i.slice(e,1<r?1-r:void 0)}function ln(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function un(){return!0}function dn(){return!1}function fn(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)?un:dn,this.isPropagationStopped=dn,this}return h(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=un)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=un)},persist:function(){},isPersistent:un}),t}var pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mn=fn(pn),hn=h({},pn,{view:0,detail:0}),gn=fn(hn),_n,vn,yn,bn=h({},hn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jn,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!==yn&&(yn&&e.type===`mousemove`?(_n=e.screenX-yn.screenX,vn=e.screenY-yn.screenY):vn=_n=0,yn=e),_n)},movementY:function(e){return`movementY`in e?e.movementY:vn}}),xn=fn(bn),Sn=fn(h({},bn,{dataTransfer:0})),Cn=fn(h({},hn,{relatedTarget:0})),wn=fn(h({},pn,{animationName:0,elapsedTime:0,pseudoElement:0})),Tn=fn(h({},pn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),En=fn(h({},pn,{data:0})),Dn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},On={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`},kn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function An(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kn[e])?!!t[e]:!1}function jn(){return An}var Mn=fn(h({},hn,{key:function(e){if(e.key){var t=Dn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=ln(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?On[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jn,charCode:function(e){return e.type===`keypress`?ln(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?ln(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Nn=fn(h({},bn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=fn(h({},hn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn})),Fn=fn(h({},pn,{propertyName:0,elapsedTime:0,pseudoElement:0})),In=fn(h({},bn,{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})),Ln=fn(h({},pn,{newState:0,oldState:0})),Rn=[9,13,27,32],zn=nn&&`CompositionEvent`in window,Bn=null;nn&&`documentMode`in document&&(Bn=document.documentMode);var Vn=nn&&`TextEvent`in window&&!Bn,Hn=nn&&(!zn||Bn&&8<Bn&&11>=Bn),Un=` `,Wn=!1;function Gn(e,t){switch(e){case`keyup`:return Rn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Kn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var qn=!1;function Jn(e,t){switch(e){case`compositionend`:return Kn(t);case`keypress`:return t.which===32?(Wn=!0,Un):null;case`textInput`:return e=t.data,e===Un&&Wn?null:e;default:return null}}function Yn(e,t){if(qn)return e===`compositionend`||!zn&&Gn(e,t)?(e=cn(),sn=on=G=null,qn=!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 Hn&&t.locale!==`ko`?null:t.data;default:return null}}var Xn={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 Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Xn[e.type]:t===`textarea`}function Qn(e,t,n,r){Zt?Qt?Qt.push(r):Qt=[r]:Zt=r,t=kd(t,`onChange`),0<t.length&&(n=new mn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var $n=null,er=null;function tr(e){xd(e,0)}function nr(e){if(Mt(_t(e)))return e}function rr(e,t){if(e===`change`)return t}var ir=!1;if(nn){var ar;if(nn){var or=`oninput`in document;if(!or){var sr=document.createElement(`div`);sr.setAttribute(`oninput`,`return;`),or=typeof sr.oninput==`function`}ar=or}else ar=!1;ir=ar&&(!document.documentMode||9<document.documentMode)}function cr(){$n&&($n.detachEvent(`onpropertychange`,K),er=$n=null)}function K(e){if(e.propertyName===`value`&&nr(er)){var t=[];Qn(t,er,e,Xt(e)),W(tr,t)}}function lr(e,t,n){e===`focusin`?(cr(),$n=t,er=n,$n.attachEvent(`onpropertychange`,K)):e===`focusout`&&cr()}function ur(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return nr(er)}function q(e,t){if(e===`click`)return nr(t)}function dr(e,t){if(e===`input`||e===`change`)return nr(t)}function fr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var pr=typeof Object.is==`function`?Object.is:fr;function mr(e,t){if(pr(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(!we.call(t,i)||!pr(e[i],t[i]))return!1}return!0}function hr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function gr(e,t){var n=hr(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=hr(n)}}function _r(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_r(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function vr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Nt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nt(e.document)}return t}function yr(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 br=nn&&`documentMode`in document&&11>=document.documentMode,xr=null,Sr=null,Cr=null,wr=!1;function Tr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wr||xr==null||xr!==Nt(r)||(r=xr,`selectionStart`in r&&yr(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}),Cr&&mr(Cr,r)||(Cr=r,r=kd(Sr,`onSelect`),0<r.length&&(t=new mn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=xr)))}function Er(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Dr={animationend:Er(`Animation`,`AnimationEnd`),animationiteration:Er(`Animation`,`AnimationIteration`),animationstart:Er(`Animation`,`AnimationStart`),transitionrun:Er(`Transition`,`TransitionRun`),transitionstart:Er(`Transition`,`TransitionStart`),transitioncancel:Er(`Transition`,`TransitionCancel`),transitionend:Er(`Transition`,`TransitionEnd`)},Or={},kr={};nn&&(kr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Dr.animationend.animation,delete Dr.animationiteration.animation,delete Dr.animationstart.animation),`TransitionEvent`in window||delete Dr.transitionend.transition);function Ar(e){if(Or[e])return Or[e];if(!Dr[e])return e;var t=Dr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in kr)return Or[e]=t[n];return e}var jr=Ar(`animationend`),Mr=Ar(`animationiteration`),Nr=Ar(`animationstart`),Pr=Ar(`transitionrun`),Fr=Ar(`transitionstart`),Ir=Ar(`transitioncancel`),Lr=Ar(`transitionend`),Rr=new Map,zr=`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(` `);zr.push(`scrollEnd`);function Br(e,t){Rr.set(e,t),xt(t,[e])}var Vr=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)},Hr=[],Ur=0,Wr=0;function Gr(){for(var e=Ur,t=Wr=Ur=0;t<e;){var n=Hr[t];Hr[t++]=null;var r=Hr[t];Hr[t++]=null;var i=Hr[t];Hr[t++]=null;var a=Hr[t];if(Hr[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&&Yr(n,i,a)}}function Kr(e,t,n,r){Hr[Ur++]=e,Hr[Ur++]=t,Hr[Ur++]=n,Hr[Ur++]=r,Wr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function qr(e,t,n,r){return Kr(e,t,n,r),Xr(e)}function Jr(e,t){return Kr(e,null,null,t),Xr(e)}function Yr(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-Re(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Xr(e){if(50<fu)throw fu=0,pu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Zr={};function Qr(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 $r(e,t,n,r){return new Qr(e,t,n,r)}function ei(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ti(e,t){var n=e.alternate;return n===null?(n=$r(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 ni(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 ri(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ei(e)&&(s=1);else if(typeof e==`string`)s=Kf(e,n,N.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case E:return e=$r(31,n,t,a),e.elementType=E,e.lanes=o,e;case y:return ii(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=$r(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case ee:return e=$r(13,n,t,a),e.elementType=ee,e.lanes=o,e;case T:return e=$r(19,n,t,a),e.elementType=T,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 te:s=14;break a;case ne:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=$r(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ii(e,t,n,r){return e=$r(7,e,r,t),e.lanes=n,e}function ai(e,t,n){return e=$r(6,e,null,t),e.lanes=n,e}function oi(e){var t=$r(18,null,null,0);return t.stateNode=e,t}function si(e,t,n){return t=$r(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ci=new WeakMap;function li(e,t){if(typeof e==`object`&&e){var n=ci.get(e);return n===void 0?(t={value:e,source:t,stack:Ce(t)},ci.set(e,t),t):n}return{value:e,source:t,stack:Ce(t)}}var ui=[],di=0,fi=null,pi=0,mi=[],hi=0,gi=null,_i=1,vi=``;function yi(e,t){ui[di++]=pi,ui[di++]=fi,fi=e,pi=t}function bi(e,t,n){mi[hi++]=_i,mi[hi++]=vi,mi[hi++]=gi,gi=e;var r=_i;e=vi;var i=32-Re(r)-1;r&=~(1<<i),n+=1;var a=32-Re(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,_i=1<<32-Re(t)+i|n<<i|r,vi=a+e}else _i=1<<a|n<<i|r,vi=e}function xi(e){e.return!==null&&(yi(e,1),bi(e,1,0))}function Si(e){for(;e===fi;)fi=ui[--di],ui[di]=null,pi=ui[--di],ui[di]=null;for(;e===gi;)gi=mi[--hi],mi[hi]=null,vi=mi[--hi],mi[hi]=null,_i=mi[--hi],mi[hi]=null}function Ci(e,t){mi[hi++]=_i,mi[hi++]=vi,mi[hi++]=gi,_i=t.id,vi=t.overflow,gi=e}var wi=null,Ti=null,Ei=!1,Di=null,Oi=!1,ki=Error(i(519));function Ai(e){throw Ii(li(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ki}function ji(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ot]=e,t[st]=r,n){case`dialog`:Sd(`cancel`,t),Sd(`close`,t);break;case`iframe`:case`object`:case`embed`:Sd(`load`,t);break;case`video`:case`audio`:for(n=0;n<yd.length;n++)Sd(yd[n],t);break;case`source`:Sd(`error`,t);break;case`img`:case`image`:case`link`:Sd(`error`,t),Sd(`load`,t);break;case`details`:Sd(`toggle`,t);break;case`input`:Sd(`invalid`,t),Lt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Sd(`invalid`,t);break;case`textarea`:Sd(`invalid`,t),Vt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Fd(t.textContent,n)?(r.popover!=null&&(Sd(`beforetoggle`,t),Sd(`toggle`,t)),r.onScroll!=null&&Sd(`scroll`,t),r.onScrollEnd!=null&&Sd(`scrollend`,t),r.onClick!=null&&(t.onclick=Yt),t=!0):t=!1,t||Ai(e,!0)}function Mi(e){for(wi=e.return;wi;)switch(wi.tag){case 5:case 31:case 13:Oi=!1;return;case 27:case 3:Oi=!0;return;default:wi=wi.return}}function Ni(e){if(e!==wi)return!1;if(!Ei)return Mi(e),Ei=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||qd(e.type,e.memoizedProps)),n=!n),n&&Ti&&Ai(e),Mi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ti=mf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ti=mf(e)}else t===27?(t=Ti,tf(e.type)?(e=pf,pf=null,Ti=e):Ti=t):Ti=wi?ff(e.stateNode.nextSibling):null;return!0}function Pi(){Ti=wi=null,Ei=!1}function Fi(){var e=Di;return e!==null&&(Ql===null?Ql=e:Ql.push.apply(Ql,e),Di=null),e}function Ii(e){Di===null?Di=[e]:Di.push(e)}var Li=le(null),Ri=null,zi=null;function Bi(e,t,n){M(Li,t._currentValue),t._currentValue=n}function Vi(e){e._currentValue=Li.current,ue(Li)}function Hi(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 Ui(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),Hi(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),Hi(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 Wi(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;pr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===pe.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[tp]:e.push(tp))}a=a.return}e!==null&&Ui(t,e,n,r),t.flags|=262144}function Gi(e){for(e=e.firstContext;e!==null;){if(!pr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ki(e){Ri=e,zi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qi(e){return Ji(Ri,e)}function J(e,t){return Ri===null&&Ki(e),Ji(e,t)}function Ji(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},zi===null){if(e===null)throw Error(i(308));zi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else zi=zi.next=t;return n}var Yi=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()})}},Xi=t.unstable_scheduleCallback,Zi=t.unstable_NormalPriority,Qi={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $i(){return{controller:new Yi,data:new Map,refCount:0}}function ea(e){e.refCount--,e.refCount===0&&Xi(Zi,function(){e.controller.abort()})}var ta=null,na=0,ra=0,ia=null;function aa(e,t){if(ta===null){var n=ta=[];na=0,ra=pd(),ia={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return na++,t.then(oa,oa),t}function oa(){if(--na===0&&ta!==null){ia!==null&&(ia.status=`fulfilled`);var e=ta;ta=null,ra=0,ia=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function sa(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 ca=j.S;j.S=function(e,t){tu=Oe(),typeof t==`object`&&t&&typeof t.then==`function`&&aa(e,t),ca!==null&&ca(e,t)};var la=le(null);function ua(){var e=la.current;return e===null?Il.pooledCache:e}function da(e,t){t===null?M(la,la.current):M(la,t.pool)}function fa(){var e=ua();return e===null?null:{parent:Qi._currentValue,pool:e}}var pa=Error(i(460)),ma=Error(i(474)),ha=Error(i(542)),ga={then:function(){}};function _a(e){return e=e.status,e===`fulfilled`||e===`rejected`}function va(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Yt,Yt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Sa(e),e;default:if(typeof t.status==`string`)t.then(Yt,Yt);else{if(e=Il,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,Sa(e),e}throw ba=t,pa}}function ya(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ba=e,pa):e}}var ba=null;function xa(){if(ba===null)throw Error(i(459));var e=ba;return ba=null,e}function Sa(e){if(e===pa||e===ha)throw Error(i(483))}var Ca=null,wa=0;function Ta(e){var t=wa;return wa+=1,Ca===null&&(Ca=[]),va(Ca,e,t)}function Ea(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Da(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 Oa(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=ti(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=ai(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===ne&&ya(i)===t.type)?(t=a(t,n.props),Ea(t,n),t.return=e,t):(t=ri(n.type,n.key,n.props,null,e.mode,r),Ea(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=si(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=ii(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=ai(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ri(t.type,t.key,t.props,null,e.mode,n),Ea(n,t),n.return=e,n;case v:return t=si(t,e.mode,n),t.return=e,t;case ne:return t=ya(t),f(e,t,n)}if(A(t)||re(t))return t=ii(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ta(t),n);if(t.$$typeof===C)return f(e,J(e,t),n);Da(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 ne:return n=ya(n),p(e,t,n,r)}if(A(n)||re(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ta(n),r);if(n.$$typeof===C)return p(e,t,J(e,n),r);Da(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 ne:return r=ya(r),m(e,t,n,r,i)}if(A(r)||re(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ta(r),i);if(r.$$typeof===C)return m(e,t,n,J(t,r),i);Da(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),Ei&&yi(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 Ei&&yi(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)}),Ei&&yi(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),Ei&&yi(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 Ei&&yi(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)}),Ei&&yi(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===ne&&ya(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ea(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=ii(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ri(o.type,o.key,o.props,null,e.mode,c),Ea(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=si(o,e.mode,c),c.return=e,e=c}return s(e);case ne:return o=ya(o),b(e,r,o,c)}if(A(o))return h(e,r,o,c);if(re(o)){if(l=re(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,Ta(o),c);if(o.$$typeof===C)return b(e,r,J(e,o),c);Da(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=ai(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{wa=0;var i=b(e,t,n,r);return Ca=null,i}catch(t){if(t===pa||t===ha)throw t;var a=$r(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ka=Oa(!0),Aa=Oa(!1),ja=!1;function Ma(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Na(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 Pa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Fa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Fl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Xr(e),Yr(e,null,n),t}return Kr(e,r,t,n),Xr(e)}function Ia(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,$e(e,n)}}function La(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 Ra=!1;function za(){if(Ra){var e=ia;if(e!==null)throw e}}function Ba(e,t,n,r){Ra=!1;var i=e.updateQueue;ja=!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?(Rl&f)===f:(r&f)===f){f!==0&&f===ra&&(Ra=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:ja=!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),Kl|=o,e.lanes=o,e.memoizedState=d}}function Va(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ha(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Va(n[e],t)}var Ua=le(null),Wa=le(0);function Ga(e,t){e=Wl,M(Wa,e),M(Ua,t),Wl=e|t.baseLanes}function Ka(){M(Wa,Wl),M(Ua,Ua.current)}function qa(){Wl=Wa.current,ue(Ua),ue(Wa)}var Ja=le(null),Ya=null;function Xa(e){var t=e.alternate;M(to,to.current&1),M(Ja,e),Ya===null&&(t===null||Ua.current!==null||t.memoizedState!==null)&&(Ya=e)}function Za(e){M(to,to.current),M(Ja,e),Ya===null&&(Ya=e)}function Qa(e){e.tag===22?(M(to,to.current),M(Ja,e),Ya===null&&(Ya=e)):$a(e)}function $a(){M(to,to.current),M(Ja,Ja.current)}function eo(e){ue(Ja),Ya===e&&(Ya=null),ue(to)}var to=le(0);function no(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||uf(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 ro=0,io=null,ao=null,oo=null,so=!1,co=!1,lo=!1,uo=0,fo=0,po=null,mo=0;function ho(){throw Error(i(321))}function go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!pr(e[n],t[n]))return!1;return!0}function _o(e,t,n,r,i,a){return ro=a,io=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?Ps:Fs,lo=!1,a=n(r,i),lo=!1,co&&(a=yo(t,n,r,i)),vo(e),a}function vo(e){j.H=Ns;var t=ao!==null&&ao.next!==null;if(ro=0,oo=ao=io=null,so=!1,fo=0,po=null,t)throw Error(i(300));e===null||Qs||(e=e.dependencies,e!==null&&Gi(e)&&(Qs=!0))}function yo(e,t,n,r){io=e;var a=0;do{if(co&&(po=null),fo=0,co=!1,25<=a)throw Error(i(301));if(a+=1,oo=ao=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}j.H=Is,o=t(n,r)}while(co);return o}function bo(){var e=j.H,t=e.useState()[0];return t=typeof t.then==`function`?Do(t):t,e=e.useState()[0],(ao===null?null:ao.memoizedState)!==e&&(io.flags|=1024),t}function xo(){var e=uo!==0;return uo=0,e}function So(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Co(e){if(so){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}so=!1}ro=0,oo=ao=io=null,co=!1,fo=uo=0,po=null}function wo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return oo===null?io.memoizedState=oo=e:oo=oo.next=e,oo}function To(){if(ao===null){var e=io.alternate;e=e===null?null:e.memoizedState}else e=ao.next;var t=oo===null?io.memoizedState:oo.next;if(t!==null)oo=t,ao=e;else{if(e===null)throw io.alternate===null?Error(i(467)):Error(i(310));ao=e,e={memoizedState:ao.memoizedState,baseState:ao.baseState,baseQueue:ao.baseQueue,queue:ao.queue,next:null},oo===null?io.memoizedState=oo=e:oo=oo.next=e}return oo}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Do(e){var t=fo;return fo+=1,po===null&&(po=[]),e=va(po,e,t),t=io,(oo===null?t.memoizedState:oo.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?Ps:Fs),e}function Oo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Do(e);if(e.$$typeof===C)return qi(e)}throw Error(i(438,String(e)))}function ko(e){var t=null,n=io.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=io.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=Eo(),io.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]=D;return t.index++,n}function Ao(e,t){return typeof t==`function`?t(e):t}function jo(e){return Mo(To(),ao,e)}function Mo(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?(ro&f)===f:(Rl&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===ra&&(d=!0);else if((ro&p)===p){u=u.next,p===ra&&(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,io.lanes|=p,Kl|=p;f=u.action,lo&&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,io.lanes|=f,Kl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!pr(o,e.memoizedState)&&(Qs=!0,d&&(n=ia,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 No(e){var t=To(),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);pr(o,t.memoizedState)||(Qs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Po(e,t,n){var r=io,a=To(),o=Ei;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!pr((ao||a).memoizedState,n);if(s&&(a.memoizedState=n,Qs=!0),a=a.queue,as(Lo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||oo!==null&&oo.memoizedState.tag&1){if(r.flags|=2048,es(9,{destroy:void 0},Io.bind(null,r,a,n,t),null),Il===null)throw Error(i(349));o||ro&127||Fo(r,t,n)}return n}function Fo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=io.updateQueue,t===null?(t=Eo(),io.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Io(e,t,n,r){t.value=n,t.getSnapshot=r,Ro(t)&&zo(e)}function Lo(e,t,n){return n(function(){Ro(t)&&zo(e)})}function Ro(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!pr(e,n)}catch{return!0}}function zo(e){var t=Jr(e,2);t!==null&&gu(t,e,2)}function Bo(e){var t=wo();if(typeof e==`function`){var n=e;if(e=n(),lo){Le(!0);try{n()}finally{Le(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:e},t}function Vo(e,t,n,r){return e.baseState=n,Mo(e,ao,typeof r==`function`?r:Ao)}function Ho(e,t,n,r,a){if(As(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)}};j.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Uo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Uo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=j.T,o={};j.T=o;try{var s=n(i,r),c=j.S;c!==null&&c(o,s),Wo(e,t,s)}catch(n){Ko(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),j.T=a}}else try{a=n(i,r),Wo(e,t,a)}catch(n){Ko(e,t,n)}}function Wo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Go(e,t,n)},function(n){return Ko(e,t,n)}):Go(e,t,n)}function Go(e,t,n){t.status=`fulfilled`,t.value=n,qo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Uo(e,n)))}function Ko(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,qo(t),t=t.next;while(t!==r)}e.action=null}function qo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Jo(e,t){return t}function Yo(e,t){if(Ei){var n=Il.formState;if(n!==null){a:{var r=io;if(Ei){if(Ti){b:{for(var i=Ti,a=Oi;i.nodeType!==8;){if(!a){i=null;break b}if(i=ff(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ti=ff(i.nextSibling),r=i.data===`F!`;break a}}Ai(r)}r=!1}r&&(t=n[0])}}return n=wo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jo,lastRenderedState:t},n.queue=r,n=Ds.bind(null,io,r),r.dispatch=n,r=Bo(!1),a=ks.bind(null,io,!1,r.queue),r=wo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ho.bind(null,io,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Xo(e){return Zo(To(),ao,e)}function Zo(e,t,n){if(t=Mo(e,t,Jo)[0],e=jo(Ao)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Do(t)}catch(e){throw e===pa?ha:e}else r=t;t=To();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(io.flags|=2048,es(9,{destroy:void 0},Qo.bind(null,i,n),null)),[r,a,e]}function Qo(e,t){e.action=t}function $o(e){var t=To(),n=ao;if(n!==null)return Zo(t,n,e);To(),t=t.memoizedState,n=To();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function es(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=io.updateQueue,t===null&&(t=Eo(),io.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 ts(){return To().memoizedState}function ns(e,t,n,r){var i=wo();io.flags|=e,i.memoizedState=es(1|t,{destroy:void 0},n,r===void 0?null:r)}function rs(e,t,n,r){var i=To();r=r===void 0?null:r;var a=i.memoizedState.inst;ao!==null&&r!==null&&go(r,ao.memoizedState.deps)?i.memoizedState=es(t,a,n,r):(io.flags|=e,i.memoizedState=es(1|t,a,n,r))}function is(e,t){ns(8390656,8,e,t)}function as(e,t){rs(2048,8,e,t)}function os(e){io.flags|=4;var t=io.updateQueue;if(t===null)t=Eo(),io.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ss(e){var t=To().memoizedState;return os({ref:t,nextImpl:e}),function(){if(Fl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function cs(e,t){return rs(4,2,e,t)}function ls(e,t){return rs(4,4,e,t)}function us(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 ds(e,t,n){n=n==null?null:n.concat([e]),rs(4,4,us.bind(null,t,e),n)}function fs(){}function ps(e,t){var n=To();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&go(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ms(e,t){var n=To();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&go(t,r[1]))return r[0];if(r=e(),lo){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r}function hs(e,t,n){return n===void 0||ro&1073741824&&!(Rl&261930)?e.memoizedState=t:(e.memoizedState=n,e=hu(),io.lanes|=e,Kl|=e,n)}function gs(e,t,n,r){return pr(n,t)?n:Ua.current===null?!(ro&42)||ro&1073741824&&!(Rl&261930)?(Qs=!0,e.memoizedState=n):(e=hu(),io.lanes|=e,Kl|=e,t):(e=hs(e,n,r),pr(e,t)||(Qs=!0),e)}function _s(e,t,n,r,i){var a=ae.p;ae.p=a!==0&&8>a?a:8;var o=j.T,s={};j.T=s,ks(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Os(e,t,sa(c,r),mu(e)):Os(e,t,r,mu(e))}catch(n){Os(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{ae.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function vs(){}function ys(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=bs(e).queue;_s(e,a,t,oe,n===null?vs:function(){return xs(e),n(r)})}function bs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:oe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xs(e){var t=bs(e);t.next===null&&(t=e.alternate.memoizedState),Os(e,t.next.queue,{},mu())}function Ss(){return qi(tp)}function Cs(){return To().memoizedState}function ws(){return To().memoizedState}function Ts(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=Pa(n);var r=Fa(t,e,n);r!==null&&(gu(r,t,n),Ia(r,t,n)),t={cache:$i()},e.payload=t;return}t=t.return}}function Es(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},As(e)?js(t,n):(n=qr(e,t,n,r),n!==null&&(gu(n,e,r),Ms(n,t,r)))}function Ds(e,t,n){Os(e,t,n,mu())}function Os(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(As(e))js(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,pr(s,o))return Kr(e,t,i,0),Il===null&&Gr(),!1}catch{}if(n=qr(e,t,i,r),n!==null)return gu(n,e,r),Ms(n,t,r),!0}return!1}function ks(e,t,n,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},As(e)){if(t)throw Error(i(479))}else t=qr(e,n,r,2),t!==null&&gu(t,e,2)}function As(e){var t=e.alternate;return e===io||t!==null&&t===io}function js(e,t){co=so=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ms(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}var Ns={readContext:qi,use:Oo,useCallback:ho,useContext:ho,useEffect:ho,useImperativeHandle:ho,useLayoutEffect:ho,useInsertionEffect:ho,useMemo:ho,useReducer:ho,useRef:ho,useState:ho,useDebugValue:ho,useDeferredValue:ho,useTransition:ho,useSyncExternalStore:ho,useId:ho,useHostTransitionStatus:ho,useFormState:ho,useActionState:ho,useOptimistic:ho,useMemoCache:ho,useCacheRefresh:ho};Ns.useEffectEvent=ho;var Ps={readContext:qi,use:Oo,useCallback:function(e,t){return wo().memoizedState=[e,t===void 0?null:t],e},useContext:qi,useEffect:is,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ns(4194308,4,us.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){ns(4,2,e,t)},useMemo:function(e,t){var n=wo();t=t===void 0?null:t;var r=e();if(lo){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=wo();if(n!==void 0){var i=n(t);if(lo){Le(!0);try{n(t)}finally{Le(!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=Es.bind(null,io,e),[r.memoizedState,e]},useRef:function(e){var t=wo();return e={current:e},t.memoizedState=e},useState:function(e){e=Bo(e);var t=e.queue,n=Ds.bind(null,io,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:fs,useDeferredValue:function(e,t){return hs(wo(),e,t)},useTransition:function(){var e=Bo(!1);return e=_s.bind(null,io,e.queue,!0,!1),wo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=io,a=wo();if(Ei){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Il===null)throw Error(i(349));Rl&127||Fo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Lo.bind(null,r,o,e),[e]),r.flags|=2048,es(9,{destroy:void 0},Io.bind(null,r,o,n,t),null),n},useId:function(){var e=wo(),t=Il.identifierPrefix;if(Ei){var n=vi,r=_i;n=(r&~(1<<32-Re(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=uo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=mo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ss,useFormState:Yo,useActionState:Yo,useOptimistic:function(e){var t=wo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ks.bind(null,io,!0,n),n.dispatch=t,[e,t]},useMemoCache:ko,useCacheRefresh:function(){return wo().memoizedState=Ts.bind(null,io)},useEffectEvent:function(e){var t=wo(),n={impl:e};return t.memoizedState=n,function(){if(Fl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Fs={readContext:qi,use:Oo,useCallback:ps,useContext:qi,useEffect:as,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:jo,useRef:ts,useState:function(){return jo(Ao)},useDebugValue:fs,useDeferredValue:function(e,t){return gs(To(),ao.memoizedState,e,t)},useTransition:function(){var e=jo(Ao)[0],t=To().memoizedState;return[typeof e==`boolean`?e:Do(e),t]},useSyncExternalStore:Po,useId:Cs,useHostTransitionStatus:Ss,useFormState:Xo,useActionState:Xo,useOptimistic:function(e,t){return Vo(To(),ao,e,t)},useMemoCache:ko,useCacheRefresh:ws};Fs.useEffectEvent=ss;var Is={readContext:qi,use:Oo,useCallback:ps,useContext:qi,useEffect:as,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:No,useRef:ts,useState:function(){return No(Ao)},useDebugValue:fs,useDeferredValue:function(e,t){var n=To();return ao===null?hs(n,e,t):gs(n,ao.memoizedState,e,t)},useTransition:function(){var e=No(Ao)[0],t=To().memoizedState;return[typeof e==`boolean`?e:Do(e),t]},useSyncExternalStore:Po,useId:Cs,useHostTransitionStatus:Ss,useFormState:$o,useActionState:$o,useOptimistic:function(e,t){var n=To();return ao===null?(n.baseState=e,[e,n.queue.dispatch]):Vo(n,ao,e,t)},useMemoCache:ko,useCacheRefresh:ws};Is.useEffectEvent=ss;function Ls(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Rs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Pa(r);i.payload=t,n!=null&&(i.callback=n),t=Fa(e,i,r),t!==null&&(gu(t,e,r),Ia(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mu(),i=Pa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Fa(e,i,r),t!==null&&(gu(t,e,r),Ia(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mu(),r=Pa(n);r.tag=2,t!=null&&(r.callback=t),t=Fa(e,r,n),t!==null&&(gu(t,e,n),Ia(t,e,n))}};function zs(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?!mr(n,r)||!mr(i,a):!0}function Bs(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&&Rs.enqueueReplaceState(t,t.state,null)}function Vs(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=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Hs(e){Vr(e)}function Us(e){console.error(e)}function Ws(e){Vr(e)}function Gs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ks(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 qs(e,t,n){return n=Pa(n),n.tag=3,n.payload={element:null},n.callback=function(){Gs(e,t)},n}function Js(e){return e=Pa(e),e.tag=3,e}function Ys(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(){Ks(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ks(t,n,r),typeof i!=`function`&&(iu===null?iu=new Set([this]):iu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Xs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Wi(t,n,a,!0),n=Ja.current,n!==null){switch(n.tag){case 31:case 13:return Ya===null?Ou():n.alternate===null&&Gl===0&&(Gl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ga?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,a)),!1;case 22:return n.flags|=65536,r===ga?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)),qu(e,r,a)),!1}throw Error(i(435,n.tag))}return qu(e,r,a),Ou(),!1}if(Ei)return t=Ja.current,t===null?(r!==ki&&(t=Error(i(423),{cause:r}),Ii(li(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=li(r,n),a=qs(e.stateNode,r,a),La(e,a),Gl!==4&&(Gl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ki&&(e=Error(i(422),{cause:r}),Ii(li(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=li(o,n),Zl===null?Zl=[o]:Zl.push(o),Gl!==4&&(Gl=2),t===null)return!0;r=li(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=qs(n.stateNode,r,e),La(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`&&(iu===null||!iu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Js(a),Ys(a,e,n,r),La(n,a),!1}n=n.return}while(n!==null);return!1}var Zs=Error(i(461)),Qs=!1;function $s(e,t,n,r){t.child=e===null?Aa(t,null,n,r):ka(t,e.child,n,r)}function ec(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 Ki(t),r=_o(e,t,n,o,a,i),s=xo(),e!==null&&!Qs?(So(e,t,i),wc(e,t,i)):(Ei&&s&&xi(t),t.flags|=1,$s(e,t,r,i),t.child)}function tc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ei(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,nc(e,t,a,r,i)):(e=ri(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Tc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?mr:n,n(o,r)&&e.ref===t.ref)return wc(e,t,i)}return t.flags|=1,e=ti(a,r),e.ref=t.ref,e.return=t,t.child=e}function nc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(mr(a,r)&&e.ref===t.ref)if(Qs=!1,t.pendingProps=r=a,Tc(e,i))e.flags&131072&&(Qs=!0);else return t.lanes=e.lanes,wc(e,t,i)}return uc(e,t,n,r,i)}function rc(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 ac(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&da(t,a===null?null:a.cachePool),a===null?Ka():Ga(t,a),Qa(t);else return r=t.lanes=536870912,ac(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&da(t,null),Ka(),$a(t)):(da(t,a.cachePool),Ga(t,a),$a(t),t.memoizedState=null);return $s(e,t,i,n),t.child}function ic(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ac(e,t,n,r,i){var a=ua();return a=a===null?null:{parent:Qi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&da(t,null),Ka(),Qa(t),e!==null&&Wi(e,t,r,!0),t.childLanes=i,null}function oc(e,t){return t=yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function sc(e,t,n){return ka(t,e.child,null,n),e=oc(t,t.pendingProps),e.flags|=2,eo(t),t.memoizedState=null,e}function cc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Ei){if(r.mode===`hidden`)return e=oc(t,r),t.lanes=536870912,ic(null,e);if(Za(t),(e=Ti)?(e=cf(e,Oi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:gi===null?null:{id:_i,overflow:vi},retryLane:536870912,hydrationErrors:null},n=oi(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw Ai(t);return t.lanes=536870912,null}return oc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Za(t),a)if(t.flags&256)t.flags&=-257,t=sc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(Qs||Wi(e,t,n,!1),a=(n&e.childLanes)!==0,Qs||a){if(r=Il,r!==null&&(s=et(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Jr(e,s),gu(r,e,s),Zs;Ou(),t=sc(e,t,n)}else e=o.treeContext,Ti=ff(s.nextSibling),wi=t,Ei=!0,Di=null,Oi=!1,e!==null&&Ci(t,e),t=oc(t,r),t.flags|=4096;return t}return e=ti(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lc(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 uc(e,t,n,r,i){return Ki(t),n=_o(e,t,n,r,void 0,i),r=xo(),e!==null&&!Qs?(So(e,t,i),wc(e,t,i)):(Ei&&r&&xi(t),t.flags|=1,$s(e,t,n,i),t.child)}function dc(e,t,n,r,i,a){return Ki(t),t.updateQueue=null,n=yo(t,r,n,i),vo(e),r=xo(),e!==null&&!Qs?(So(e,t,a),wc(e,t,a)):(Ei&&r&&xi(t),t.flags|=1,$s(e,t,n,a),t.child)}function fc(e,t,n,r,i){if(Ki(t),t.stateNode===null){var a=Zr,o=n.contextType;typeof o==`object`&&o&&(a=qi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Rs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ma(t),o=n.contextType,a.context=typeof o==`object`&&o?qi(o):Zr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ls(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&&Rs.enqueueReplaceState(a,a.state,null),Ba(t,r,a,i),za(),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=Vs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Zr,typeof u==`object`&&u&&(o=qi(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)&&Bs(t,a,r,o),ja=!1;var f=t.memoizedState;a.state=f,Ba(t,r,a,i),za(),l=t.memoizedState,s||f!==l||ja?(typeof d==`function`&&(Ls(t,n,d,r),l=t.memoizedState),(c=ja||zs(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,Na(e,t),o=t.memoizedProps,u=Vs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Zr,typeof l==`object`&&l&&(c=qi(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)&&Bs(t,a,r,c),ja=!1,f=t.memoizedState,a.state=f,Ba(t,r,a,i),za();var p=t.memoizedState;o!==d||f!==p||ja||e!==null&&e.dependencies!==null&&Gi(e.dependencies)?(typeof s==`function`&&(Ls(t,n,s,r),p=t.memoizedState),(u=ja||zs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Gi(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,lc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ka(t,e.child,null,i),t.child=ka(t,null,n,i)):$s(e,t,n,i),t.memoizedState=a.state,e=t.child):e=wc(e,t,i),e}function pc(e,t,n,r){return Pi(),t.flags|=256,$s(e,t,n,r),t.child}var mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:fa()}}function gc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Yl),e}function _c(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(to.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Ei){if(a?Xa(t):$a(t),(e=Ti)?(e=cf(e,Oi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:gi===null?null:{id:_i,overflow:vi},retryLane:536870912,hydrationErrors:null},n=oi(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw Ai(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?($a(t),a=t.mode,c=yc({mode:`hidden`,children:c},a),r=ii(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(null,r)):(Xa(t),vc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Xa(t),t.flags&=-257,t=bc(e,t,n)):t.memoizedState===null?($a(t),c=r.fallback,a=t.mode,r=yc({mode:`visible`,children:r.children},a),c=ii(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ka(t,e.child,null,n),r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,t=ic(null,r)):($a(t),t.child=e.child,t.flags|=128,t=null);else if(Xa(t),uf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ii({value:r,source:null,stack:null}),t=bc(e,t,n)}else if(Qs||Wi(e,t,n,!1),s=(n&e.childLanes)!==0,Qs||s){if(s=Il,s!==null&&(r=et(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Jr(e,r),gu(s,e,r),Zs;lf(c)||Ou(),t=bc(e,t,n)}else lf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ti=ff(c.nextSibling),wi=t,Ei=!0,Di=null,Oi=!1,e!==null&&Ci(t,e),t=vc(t,r.children),t.flags|=4096);return t}return a?($a(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ti(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ii(c,a,n,null),c.flags|=2):c=ti(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ic(null,r),r=t.child,c=e.child.memoizedState,c===null?c=hc(n):(a=c.cachePool,a===null?a=fa():(l=Qi._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(e.child,r)):(Xa(t),n=e.child,e=n.sibling,n=ti(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 vc(e,t){return t=yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function yc(e,t){return e=$r(22,e,null,t),e.lanes=0,e}function bc(e,t,n){return ka(t,e.child,null,n),e=vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Hi(e.return,t,n)}function Sc(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 Cc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=to.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,M(to,o),$s(e,t,r,n),r=Ei?pi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xc(e,n,t);else if(e.tag===19)xc(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&&no(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sc(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&&no(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sc(t,!0,n,null,a,r);break;case`together`:Sc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function wc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Wi(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=ti(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ti(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Gi(e))):!0}function Ec(e,t,n){switch(t.tag){case 3:me(t,t.stateNode.containerInfo),Bi(t,Qi,e.memoizedState.cache),Pi();break;case 27:case 5:ge(t);break;case 4:me(t,t.stateNode.containerInfo);break;case 10:Bi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Za(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Xa(t),e=wc(e,t,n),e===null?null:e.sibling):_c(e,t,n):(Xa(t),t.flags|=128,null);Xa(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Wi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Cc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),M(to,to.current),r)break;return null;case 22:return t.lanes=0,rc(e,t,n,t.pendingProps);case 24:Bi(t,Qi,e.memoizedState.cache)}return wc(e,t,n)}function Dc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Qs=!0;else{if(!Tc(e,n)&&!(t.flags&128))return Qs=!1,Ec(e,t,n);Qs=!!(e.flags&131072)}else Qs=!1,Ei&&t.flags&1048576&&bi(t,pi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ya(t.elementType),t.type=e,typeof e==`function`)ei(e)?(r=Vs(e,r),t.tag=1,t=fc(null,t,e,r,n)):(t.tag=0,t=uc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=ec(null,t,e,r,n);break a}else if(a===te){t.tag=14,t=tc(null,t,e,r,n);break a}}throw t=ie(e)||e,Error(i(306,t,``))}}return t;case 0:return uc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Vs(r,t.pendingProps),fc(e,t,r,a,n);case 3:a:{if(me(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Na(e,t),Ba(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Bi(t,Qi,r),r!==o.cache&&Ui(t,[Qi],n,!0),za(),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=pc(e,t,r,n);break a}else if(r!==a){a=li(Error(i(424)),t),Ii(a),t=pc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ti=ff(e.firstChild),wi=t,Ei=!0,Di=null,Oi=!0,n=Aa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Pi(),r===a){t=wc(e,t,n);break a}$s(e,t,r,n)}t=t.child}return t;case 26:return lc(e,t),e===null?(n=Nf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ei||(n=t.type,e=t.pendingProps,r=Wd(fe.current).createElement(n),r[ot]=t,r[st]=e,Rd(r,n,e),z(r),t.stateNode=r):t.memoizedState=Nf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ge(t),e===null&&Ei&&(r=t.stateNode=gf(t.type,t.pendingProps,fe.current),wi=t,Oi=!0,a=Ti,tf(t.type)?(pf=a,Ti=ff(r.firstChild)):Ti=a),$s(e,t,t.pendingProps.children,n),lc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ei&&((a=r=Ti)&&(r=of(r,t.type,t.pendingProps,Oi),r===null?a=!1:(t.stateNode=r,wi=t,Ti=ff(r.firstChild),Oi=!1,a=!0)),a||Ai(t)),ge(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,qd(a,o)?r=null:s!==null&&qd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=_o(e,t,bo,null,null,n),tp._currentValue=a),lc(e,t),$s(e,t,r,n),t.child;case 6:return e===null&&Ei&&((e=n=Ti)&&(n=sf(n,t.pendingProps,Oi),n===null?e=!1:(t.stateNode=n,wi=t,Ti=null,e=!0)),e||Ai(t)),null;case 13:return _c(e,t,n);case 4:return me(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ka(t,null,r,n):$s(e,t,r,n),t.child;case 11:return ec(e,t,t.type,t.pendingProps,n);case 7:return $s(e,t,t.pendingProps,n),t.child;case 8:return $s(e,t,t.pendingProps.children,n),t.child;case 12:return $s(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Bi(t,t.type,r.value),$s(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Ki(t),a=qi(a),r=r(a),t.flags|=1,$s(e,t,r,n),t.child;case 14:return tc(e,t,t.type,t.pendingProps,n);case 15:return nc(e,t,t.type,t.pendingProps,n);case 19:return Cc(e,t,n);case 31:return cc(e,t,n);case 22:return rc(e,t,n,t.pendingProps);case 24:return Ki(t),r=qi(Qi),e===null?(a=ua(),a===null&&(a=Il,o=$i(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ma(t),Bi(t,Qi,a)):((e.lanes&n)!==0&&(Na(e,t),Ba(t,null,null,n),za()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Bi(t,Qi,r),r!==a.cache&&Ui(t,[Qi],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Bi(t,Qi,r))),$s(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Oc(e){e.flags|=4}function kc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Tu())e.flags|=8192;else throw ba=ga,ma}else e.flags&=-16777217}function Ac(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!qf(t))if(Tu())e.flags|=8192;else throw ba=ga,ma}function jc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Je(),e.lanes|=t,Xl|=t)}function Mc(e,t){if(!Ei)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 Nc(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 Pc(e,t,n){var r=t.pendingProps;switch(Si(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nc(t),null;case 1:return Nc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Vi(Qi),he(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ni(t)?Oc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Fi())),Nc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Oc(t),o===null?(Nc(t),kc(t,a,null,r,n)):(Nc(t),Ac(t,o))):o?o===e.memoizedState?(Nc(t),t.flags&=-16777217):(Oc(t),Nc(t),Ac(t,o)):(e=e.memoizedProps,e!==r&&Oc(t),Nc(t),kc(t,a,e,r,n)),null;case 27:if(_e(t),n=fe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}e=N.current,Ni(t)?ji(t,e):(e=gf(a,r,n),t.stateNode=e,Oc(t))}return Nc(t),null;case 5:if(_e(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}if(o=N.current,Ni(t))ji(t,o);else{var s=Wd(fe.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[ot]=t,o[st]=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(Rd(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&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=fe.current,Ni(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=wi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Fd(e.nodeValue,n)),e||Ai(t,!0)}else e=Wd(e).createTextNode(r),e[ot]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ni(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[ot]=t}else Pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=Fi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(eo(t),t):(eo(t),null);if(t.flags&128)throw Error(i(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ni(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[ot]=t}else Pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),a=!1}else a=Fi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(eo(t),t):(eo(t),null)}return eo(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),jc(t,t.updateQueue),Nc(t),null);case 4:return he(),e===null&&Td(t.stateNode.containerInfo),Nc(t),null;case 10:return Vi(t.type),Nc(t),null;case 19:if(ue(to),r=t.memoizedState,r===null)return Nc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Mc(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=no(e),o!==null){for(t.flags|=128,Mc(r,!1),e=o.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ni(n,e),n=n.sibling;return M(to,to.current&1|2),Ei&&yi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Oe()>nu&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304)}else{if(!a)if(e=no(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ei)return Nc(t),null}else 2*Oe()-r.renderingStartTime>nu&&n!==536870912&&(t.flags|=128,a=!0,Mc(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?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Oe(),e.sibling=null,n=to.current,M(to,a?n&1|2:n&1),Ei&&yi(t,r.treeForkCount),e);case 22:case 23:return eo(t),qa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(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&&ue(la),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Vi(Qi),Nc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Fc(e,t){switch(Si(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi(Qi),he(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return _e(t),null;case 31:if(t.memoizedState!==null){if(eo(t),t.alternate===null)throw Error(i(340));Pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(eo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ue(to),null;case 4:return he(),null;case 10:return Vi(t.type),null;case 22:case 23:return eo(t),qa(),e!==null&&ue(la),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vi(Qi),null;case 25:return null;default:return null}}function Ic(e,t){switch(Si(t),t.tag){case 3:Vi(Qi),he();break;case 26:case 27:case 5:_e(t);break;case 4:he();break;case 31:t.memoizedState!==null&&eo(t);break;case 13:eo(t);break;case 19:ue(to);break;case 10:Vi(t.type);break;case 22:case 23:eo(t),qa(),e!==null&&ue(la);break;case 24:Vi(Qi)}}function Lc(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){Ku(t,t.return,e)}}function Rc(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){Ku(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ku(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ha(t,n)}catch(t){Ku(e,e.return,t)}}}function Bc(e,t,n){n.props=Vs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ku(e,t,n)}}function Vc(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){Ku(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ku(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){Ku(e,t,n)}else n.current=null}function Uc(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){Ku(e,e.return,t)}}function Wc(e,t,n){try{var r=e.stateNode;zd(r,e.type,n,t),r[st]=t}catch(t){Ku(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(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&&tf(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 qc(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=Yt));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(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&&tf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Rd(t,r,n),t[ot]=e,t[st]=n}catch(t){Ku(e,e.return,t)}}var Xc=!1,Zc=!1,Qc=!1,$c=typeof WeakSet==`function`?WeakSet:Set,el=null;function tl(e,t){if(e=e.containerInfo,Hd=lp,e=vr(e),yr(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(Ud={focusedElem:e,selectionRange:n},lp=!1,el=t;el!==null;)if(t=el,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,el=e;else for(;el!==null;){switch(t=el,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=Vs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ku(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)af(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:af(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,el=e;break}el=t.return}}function nl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:_l(e,n),r&4&&Lc(5,n);break;case 1:if(_l(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ku(n,n.return,e)}else{var i=Vs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ku(n,n.return,e)}}r&64&&zc(n),r&512&&Vc(n,n.return);break;case 3:if(_l(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{Ha(e,t)}catch(e){Ku(n,n.return,e)}}break;case 27:t===null&&r&4&&Yc(n);case 26:case 5:_l(e,n),t===null&&r&4&&Uc(n),r&512&&Vc(n,n.return);break;case 12:_l(e,n);break;case 31:_l(e,n),r&4&&cl(e,n);break;case 13:_l(e,n),r&4&&ll(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),df(e,n))));break;case 22:if(r=n.memoizedState!==null||Xc,!r){t=t!==null&&t.memoizedState!==null||Zc,i=Xc;var a=Zc;Xc=r,(Zc=t)&&!a?yl(e,n,(n.subtreeFlags&8772)!=0):_l(e,n),Xc=i,Zc=a}break;case 30:break;default:_l(e,n)}}function rl(e){var t=e.alternate;t!==null&&(e.alternate=null,rl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&mt(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 il=null,al=!1;function ol(e,t,n){for(n=n.child;n!==null;)sl(e,t,n),n=n.sibling}function sl(e,t,n){if(Ie&&typeof Ie.onCommitFiberUnmount==`function`)try{Ie.onCommitFiberUnmount(Fe,n)}catch{}switch(n.tag){case 26:Zc||Hc(n,t),ol(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zc||Hc(n,t);var r=il,i=al;tf(n.type)&&(il=n.stateNode,al=!1),ol(e,t,n),_f(n.stateNode),il=r,al=i;break;case 5:Zc||Hc(n,t);case 6:if(r=il,i=al,il=null,ol(e,t,n),il=r,al=i,il!==null)if(al)try{(il.nodeType===9?il.body:il.nodeName===`HTML`?il.ownerDocument.body:il).removeChild(n.stateNode)}catch(e){Ku(n,t,e)}else try{il.removeChild(n.stateNode)}catch(e){Ku(n,t,e)}break;case 18:il!==null&&(al?(e=il,nf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Fp(e)):nf(il,n.stateNode));break;case 4:r=il,i=al,il=n.stateNode.containerInfo,al=!0,ol(e,t,n),il=r,al=i;break;case 0:case 11:case 14:case 15:Rc(2,n,t),Zc||Rc(4,n,t),ol(e,t,n);break;case 1:Zc||(Hc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Bc(n,t,r)),ol(e,t,n);break;case 21:ol(e,t,n);break;case 22:Zc=(r=Zc)||n.memoizedState!==null,ol(e,t,n),Zc=r;break;default:ol(e,t,n)}}function cl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Fp(e)}catch(e){Ku(t,t.return,e)}}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fp(e)}catch(e){Ku(t,t.return,e)}}function ul(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $c),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $c),t;default:throw Error(i(435,e.tag))}}function dl(e,t){var n=ul(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function fl(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(tf(c.type)){il=c.stateNode,al=!1;break a}break;case 5:il=c.stateNode,al=!1;break a;case 3:case 4:il=c.stateNode.containerInfo,al=!0;break a}c=c.return}if(il===null)throw Error(i(160));sl(o,s,a),il=null,al=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ml(t,e),t=t.sibling}var pl=null;function ml(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fl(t,e),hl(e),r&4&&(Rc(3,e,e.return),Lc(3,e),Rc(5,e,e.return));break;case 1:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&64&&Xc&&(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=pl;if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(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[pt]||o[ot]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Rd(o,r,n),o[ot]=e,z(o),r=o;break a;case`link`:var s=Wf(`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),Rd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Wf(`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),Rd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ot]=e,z(o),r=o}e.stateNode=r}else Gf(a,e.type,e.stateNode);else e.stateNode=Bf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Gf(a,e.type,e.stateNode):Bf(a,r,e.memoizedProps))}break;case 27:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),n!==null&&r&4&&Wc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),e.flags&32){a=e.stateNode;try{Ht(a,``)}catch(t){Ku(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Wc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Qc=!0);break;case 6:if(fl(t,e),hl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ku(e,e.return,t)}}break;case 3:if(X=null,a=pl,pl=bf(t.containerInfo),fl(t,e),pl=a,hl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fp(t.containerInfo)}catch(t){Ku(e,e.return,t)}Qc&&(Qc=!1,gl(e));break;case 4:r=pl,pl=bf(e.stateNode.containerInfo),fl(t,e),hl(e),pl=r;break;case 12:fl(t,e),hl(e);break;case 31:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 13:fl(t,e),hl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(eu=Oe()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Xc,d=Zc;if(Xc=u||a,Zc=d||l,fl(t,e),Zc=d,Xc=u,hl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Xc||Zc||vl(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){Ku(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ku(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?rf(m,!0):rf(l.stateNode,!1)}catch(e){Ku(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,dl(e,n))));break;case 19:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 30:break;case 21:break;default:fl(t,e),hl(e)}}function hl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Gc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Jc(e,Kc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ht(o,``),n.flags&=-33),Jc(e,Kc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;qc(e,Kc(e),s);break;default:throw Error(i(161))}}catch(t){Ku(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function _l(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)nl(e,t.alternate,t),t=t.sibling}function vl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rc(4,t,t.return),vl(t);break;case 1:Hc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Bc(t,t.return,n),vl(t);break;case 27:_f(t.stateNode);case 26:case 5:Hc(t,t.return),vl(t);break;case 22:t.memoizedState===null&&vl(t);break;case 30:vl(t);break;default:vl(t)}e=e.sibling}}function yl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:yl(i,a,n),Lc(4,a);break;case 1:if(yl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ku(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++)Va(c[i],s)}catch(e){Ku(r,r.return,e)}}n&&o&64&&zc(a),Vc(a,a.return);break;case 27:Yc(a);case 26:case 5:yl(i,a,n),n&&r===null&&o&4&&Uc(a),Vc(a,a.return);break;case 12:yl(i,a,n);break;case 31:yl(i,a,n),n&&o&4&&cl(i,a);break;case 13:yl(i,a,n),n&&o&4&&ll(i,a);break;case 22:a.memoizedState===null&&yl(i,a,n),Vc(a,a.return);break;case 30:break;default:yl(i,a,n)}t=t.sibling}}function bl(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&&ea(n))}function xl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ea(e))}function Sl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cl(e,t,n,r),t=t.sibling}function Cl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Sl(e,t,n,r),i&2048&&Lc(9,t);break;case 1:Sl(e,t,n,r);break;case 3:Sl(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&&ea(e)));break;case 12:if(i&2048){Sl(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){Ku(t,t.return,e)}}else Sl(e,t,n,r);break;case 31:Sl(e,t,n,r);break;case 13:Sl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Sl(e,t,n,r):(a._visibility|=2,wl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Sl(e,t,n,r):Tl(e,t),i&2048&&bl(o,t);break;case 24:Sl(e,t,n,r),i&2048&&xl(t.alternate,t);break;default:Sl(e,t,n,r)}}function wl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:wl(a,o,s,c,i),Lc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,wl(a,o,s,c,i)):u._visibility&2?wl(a,o,s,c,i):Tl(a,o),i&&l&2048&&bl(o.alternate,o);break;case 24:wl(a,o,s,c,i),i&&l&2048&&xl(o.alternate,o);break;default:wl(a,o,s,c,i)}t=t.sibling}}function Tl(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:Tl(n,r),i&2048&&bl(r.alternate,r);break;case 24:Tl(n,r),i&2048&&xl(r.alternate,r);break;default:Tl(n,r)}t=t.sibling}}var El=8192;function Dl(e,t,n){if(e.subtreeFlags&El)for(e=e.child;e!==null;)Ol(e,t,n),e=e.sibling}function Ol(e,t,n){switch(e.tag){case 26:Dl(e,t,n),e.flags&El&&e.memoizedState!==null&&Jf(n,pl,e.memoizedState,e.memoizedProps);break;case 5:Dl(e,t,n);break;case 3:case 4:var r=pl;pl=bf(e.stateNode.containerInfo),Dl(e,t,n),pl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=El,El=16777216,Dl(e,t,n),El=r):Dl(e,t,n));break;default:Dl(e,t,n)}}function kl(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 Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Y(r,e)}kl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jl(e),e=e.sibling}function jl(e){switch(e.tag){case 0:case 11:case 15:Al(e),e.flags&2048&&Rc(9,e,e.return);break;case 3:Al(e);break;case 12:Al(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ml(e)):Al(e);break;default:Al(e)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Y(r,e)}kl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rc(8,t,t.return),Ml(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ml(t));break;default:Ml(t)}e=e.sibling}}function Y(e,t){for(;el!==null;){var n=el;switch(n.tag){case 0:case 11:case 15:Rc(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:ea(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,el=r;else a:for(n=e;el!==null;){r=el;var i=r.sibling,a=r.return;if(rl(r),r===n){el=null;break a}if(i!==null){i.return=a,el=i;break a}el=a}}}var Nl={getCacheForType:function(e){var t=qi(Qi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return qi(Qi).controller.signal}},Pl=typeof WeakMap==`function`?WeakMap:Map,Fl=0,Il=null,Ll=null,Rl=0,zl=0,Bl=null,Vl=!1,Hl=!1,Ul=!1,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=null,Ql=null,$l=!1,eu=0,tu=0,nu=1/0,ru=null,iu=null,au=0,ou=null,su=null,cu=0,lu=0,uu=null,du=null,fu=0,pu=null;function mu(){return Fl&2&&Rl!==0?Rl&-Rl:j.T===null?rt():pd()}function hu(){if(Yl===0)if(!(Rl&536870912)||Ei){var e=He;He<<=1,!(He&3932160)&&(He=262144),Yl=e}else Yl=536870912;return e=Ja.current,e!==null&&(e.flags|=32),Yl}function gu(e,t,n){(e===Il&&(zl===2||zl===9)||e.cancelPendingCommit!==null)&&(Cu(e,0),bu(e,Rl,Yl,!1)),Xe(e,n),(!(Fl&2)||e!==Il)&&(e===Il&&(!(Fl&2)&&(ql|=n),Gl===4&&bu(e,Rl,Yl,!1)),ad(e))}function _u(e,t,n){if(Fl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ke(e,t),a=r?ju(e,t):ku(e,t,!0),o=r;do{if(a===0){Hl&&!r&&bu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!yu(n)){a=ku(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=Zl;var l=c.current.memoizedState.isDehydrated;if(l&&(Cu(c,s).flags|=256),s=ku(c,s,!1),s!==2){if(Ul&&!l){c.errorRecoveryDisabledLanes|=o,ql|=o,a=4;break a}o=Ql,Ql=a,o!==null&&(Ql===null?Ql=o:Ql.push.apply(Ql,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Cu(e,0),bu(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:bu(r,t,Yl,!Vl);break a;case 2:Ql=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=eu+300-Oe(),10<a)){if(bu(r,t,Yl,!Vl),Ge(r,0,!0)!==0)break a;cu=t,r.timeoutHandle=Xd(vu.bind(null,r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,`Throttled`,-0,0),a);break a}vu(r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,null,-0,0)}}break}while(1);ad(e)}function vu(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:Yt},Ol(t,a,d);var m=(a&62914560)===a?eu-Oe():(a&4194048)===a?tu-Oe():0;if(m=Xf(d,m),m!==null){cu=a,e.cancelPendingCommit=m(Ru.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),bu(e,a,o,!l);return}}Ru(e,t,a,n,r,i,o,s,c)}function yu(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(!pr(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 bu(e,t,n,r){t&=~Jl,t&=~ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Re(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Qe(e,n,t)}function xu(){return Fl&6?!0:(od(0,!1),!1)}function Su(){if(Ll!==null){if(zl===0)var e=Ll.return;else e=Ll,zi=Ri=null,Co(e),Ca=null,wa=0,e=Ll;for(;e!==null;)Ic(e.alternate,e),e=e.return;Ll=null}}function Cu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),cu=0,Su(),Il=e,Ll=n=ti(e.current,null),Rl=t,zl=0,Bl=null,Vl=!1,Hl=Ke(e,t),Ul=!1,Xl=Yl=Jl=ql=Kl=Gl=0,Ql=Zl=null,$l=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Re(r),a=1<<i;t|=e[i],r&=~a}return Wl=t,Gr(),n}function wu(e,t){io=null,j.H=Ns,t===pa||t===ha?(t=xa(),zl=3):t===ma?(t=xa(),zl=4):zl=t===Zs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Bl=t,Ll===null&&(Gl=1,Gs(e,li(t,e.current)))}function Tu(){var e=Ja.current;return e===null?!0:(Rl&4194048)===Rl?Ya===null:(Rl&62914560)===Rl||Rl&536870912?e===Ya:!1}function Eu(){var e=j.H;return j.H=Ns,e===null?Ns:e}function Du(){var e=j.A;return j.A=Nl,e}function Ou(){Gl=4,Vl||(Rl&4194048)!==Rl&&Ja.current!==null||(Hl=!0),!(Kl&134217727)&&!(ql&134217727)||Il===null||bu(Il,Rl,Yl,!1)}function ku(e,t,n){var r=Fl;Fl|=2;var i=Eu(),a=Du();(Il!==e||Rl!==t)&&(ru=null,Cu(e,t)),t=!1;var o=Gl;a:do try{if(zl!==0&&Ll!==null){var s=Ll,c=Bl;switch(zl){case 8:Su(),o=6;break a;case 3:case 2:case 9:case 6:Ja.current===null&&(t=!0);var l=zl;if(zl=0,Bl=null,Fu(e,s,c,l),n&&Hl){o=0;break a}break;default:l=zl,zl=0,Bl=null,Fu(e,s,c,l)}}Au(),o=Gl;break}catch(t){wu(e,t)}while(1);return t&&e.shellSuspendCounter++,zi=Ri=null,Fl=r,j.H=i,j.A=a,Ll===null&&(Il=null,Rl=0,Gr()),o}function Au(){for(;Ll!==null;)Nu(Ll)}function ju(e,t){var n=Fl;Fl|=2;var r=Eu(),a=Du();Il!==e||Rl!==t?(ru=null,nu=Oe()+500,Cu(e,t)):Hl=Ke(e,t);a:do try{if(zl!==0&&Ll!==null){t=Ll;var o=Bl;b:switch(zl){case 1:zl=0,Bl=null,Fu(e,t,o,1);break;case 2:case 9:if(_a(o)){zl=0,Bl=null,Pu(t);break}t=function(){zl!==2&&zl!==9||Il!==e||(zl=7),ad(e)},o.then(t,t);break a;case 3:zl=7;break a;case 4:zl=5;break a;case 7:_a(o)?(zl=0,Bl=null,Pu(t)):(zl=0,Bl=null,Fu(e,t,o,7));break;case 5:var s=null;switch(Ll.tag){case 26:s=Ll.memoizedState;case 5:case 27:var c=Ll;if(s?qf(s):c.stateNode.complete){zl=0,Bl=null;var l=c.sibling;if(l!==null)Ll=l;else{var u=c.return;u===null?Ll=null:(Ll=u,Iu(u))}break b}}zl=0,Bl=null,Fu(e,t,o,5);break;case 6:zl=0,Bl=null,Fu(e,t,o,6);break;case 8:Su(),Gl=6;break a;default:throw Error(i(462))}}Mu();break}catch(t){wu(e,t)}while(1);return zi=Ri=null,j.H=r,j.A=a,Fl=n,Ll===null?(Il=null,Rl=0,Gr(),Gl):0}function Mu(){for(;Ll!==null&&!Ee();)Nu(Ll)}function Nu(e){var t=Dc(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Pu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=dc(n,t,t.pendingProps,t.type,void 0,Rl);break;case 11:t=dc(n,t,t.pendingProps,t.type.render,t.ref,Rl);break;case 5:Co(t);default:Ic(n,t),t=Ll=ni(t,Wl),t=Dc(n,t,Wl)}e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Fu(e,t,n,r){zi=Ri=null,Co(t),Ca=null,wa=0;var i=t.return;try{if(Xs(e,i,t,n,Rl)){Gl=1,Gs(e,li(n,e.current)),Ll=null;return}}catch(t){if(i!==null)throw Ll=i,t;Gl=1,Gs(e,li(n,e.current)),Ll=null;return}t.flags&32768?(Ei||r===1?e=!0:Hl||Rl&536870912?e=!1:(Vl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ja.current,r!==null&&r.tag===13&&(r.flags|=16384))),Lu(t,e)):Iu(t)}function Iu(e){var t=e;do{if(t.flags&32768){Lu(t,Vl);return}e=t.return;var n=Pc(t.alternate,t,Wl);if(n!==null){Ll=n;return}if(t=t.sibling,t!==null){Ll=t;return}Ll=t=e}while(t!==null);Gl===0&&(Gl=5)}function Lu(e,t){do{var n=Fc(e.alternate,e);if(n!==null){n.flags&=32767,Ll=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ll=e;return}Ll=e=n}while(e!==null);Gl=6,Ll=null}function Ru(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Uu();while(au!==0);if(Fl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Wr,Ze(e,n,o,s,c,l),e===Il&&(Ll=Il=null,Rl=0),su=t,ou=e,cu=n,lu=o,uu=a,du=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(Ae,function(){return Wu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=j.T,j.T=null,a=ae.p,ae.p=2,s=Fl,Fl|=4;try{tl(e,t,n)}finally{Fl=s,ae.p=a,j.T=r}}au=1,zu(),Bu(),Vu()}}function zu(){if(au===1){au=0;var e=ou,t=su,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=j.T,j.T=null;var r=ae.p;ae.p=2;var i=Fl;Fl|=4;try{ml(t,e);var a=Ud,o=vr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&_r(s.ownerDocument.documentElement,s)){if(c!==null&&yr(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 _=gr(s,h),v=gr(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}}lp=!!Hd,Ud=Hd=null}finally{Fl=i,ae.p=r,j.T=n}}e.current=t,au=2}}function Bu(){if(au===2){au=0;var e=ou,t=su,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=j.T,j.T=null;var r=ae.p;ae.p=2;var i=Fl;Fl|=4;try{nl(e,t.alternate,t)}finally{Fl=i,ae.p=r,j.T=n}}au=3}}function Vu(){if(au===4||au===3){au=0,De();var e=ou,t=su,n=cu,r=du;t.subtreeFlags&10256||t.flags&10256?au=5:(au=0,su=ou=null,Hu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(iu=null),nt(n),t=t.stateNode,Ie&&typeof Ie.onCommitFiberRoot==`function`)try{Ie.onCommitFiberRoot(Fe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=j.T,i=ae.p,ae.p=2,j.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{j.T=t,ae.p=i}}cu&3&&Uu(),ad(e),i=e.pendingLanes,n&261930&&i&42?e===pu?fu++:(fu=0,pu=e):fu=0,od(0,!1)}}function Hu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ea(t)))}function Uu(){return zu(),Bu(),Vu(),Wu()}function Wu(){if(au!==5)return!1;var e=ou,t=lu;lu=0;var n=nt(cu),r=j.T,a=ae.p;try{ae.p=32>n?32:n,j.T=null,n=uu,uu=null;var o=ou,s=cu;if(au=0,su=ou=null,cu=0,Fl&6)throw Error(i(331));var c=Fl;if(Fl|=4,jl(o.current),Cl(o,o.current,s,n),Fl=c,od(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(Fe,o)}catch{}return!0}finally{ae.p=a,j.T=r,Hu(e,t)}}function Gu(e,t,n){t=li(n,t),t=qs(e.stateNode,t,2),e=Fa(e,t,2),e!==null&&(Xe(e,2),ad(e))}function Ku(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(iu===null||!iu.has(r))){e=li(n,e),n=Js(2),r=Fa(t,n,2),r!==null&&(Ys(n,r,t,e),Xe(r,2),ad(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Pl;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)||(Ul=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Rl&n)===n&&(Gl===4||Gl===3&&(Rl&62914560)===Rl&&300>Oe()-eu?!(Fl&2)&&Cu(e,0):Jl|=n,Xl===Rl&&(Xl=0)),ad(e)}function Yu(e,t){t===0&&(t=Je()),e=Jr(e,t),e!==null&&(Xe(e,t),ad(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(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),Yu(e,n)}function Qu(e,t){return Te(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,id=0;function ad(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,fd())}function od(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;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-Re(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,dd(r,a))}else a=Rl,a=Ge(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ke(r,a)||(n=!0,dd(r,a));r=r.next}while(n);rd=!1}}function sd(){cd()}function cd(){nd=td=!1;var e=0;id!==0&&Yd()&&(e=id);for(var t=Oe(),n=null,r=$u;r!==null;){var i=r.next,a=ld(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}au!==0&&au!==5||od(e,!1),id!==0&&(id=0)}function ld(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Re(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=qe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Il,n=Rl,n=Ge(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(zl===2||zl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&F(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ke(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&F(r),nt(n)){case 2:case 8:n=ke;break;case 32:n=Ae;break;case 268435456:n=Me;break;default:n=Ae}return r=ud.bind(null,e),n=Te(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&F(r),e.callbackPriority=2,e.callbackNode=null,2}function ud(e,t){if(au!==0&&au!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uu()&&e.callbackNode!==n)return null;var r=Rl;return r=Ge(e,e===Il?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(_u(e,r,t),ld(e,Oe()),e.callbackNode!=null&&e.callbackNode===n?ud.bind(null,e):null)}function dd(e,t){if(Uu())return null;_u(e,t,!0)}function fd(){$d(function(){Fl&6?Te(L,sd):cd()})}function pd(){if(id===0){var e=ra;e===0&&(e=Ve,Ve<<=1,!(Ve&261888)&&(Ve=256)),id=e}return id}function md(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Jt(``+e)}function hd(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 gd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=md((i[st]||null).action),o=r.submitter;o&&(t=(t=o[st]||null)?md(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new mn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(id!==0){var e=o?hd(i,o):new FormData(i);ys(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?hd(i,o):new FormData(i),ys(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var _d=0;_d<zr.length;_d++){var vd=zr[_d];Br(vd.toLowerCase(),`on`+(vd[0].toUpperCase()+vd.slice(1)))}Br(jr,`onAnimationEnd`),Br(Mr,`onAnimationIteration`),Br(Nr,`onAnimationStart`),Br(`dblclick`,`onDoubleClick`),Br(`focusin`,`onFocus`),Br(`focusout`,`onBlur`),Br(Pr,`onTransitionRun`),Br(Fr,`onTransitionStart`),Br(Ir,`onTransitionCancel`),Br(Lr,`onTransitionEnd`),St(`onMouseEnter`,[`mouseout`,`mouseover`]),St(`onMouseLeave`,[`mouseout`,`mouseover`]),St(`onPointerEnter`,[`pointerout`,`pointerover`]),St(`onPointerLeave`,[`pointerout`,`pointerover`]),xt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),xt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),xt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),xt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var yd=`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(` `),bd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(yd));function xd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Vr(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){Vr(e)}i.currentTarget=null,a=c}}}}function Sd(e,t){var n=t[lt];n===void 0&&(n=t[lt]=new Set);var r=e+`__bubble`;n.has(r)||(Ed(t,e,2,!1),n.add(r))}function Cd(e,t,n){var r=0;t&&(r|=4),Ed(n,e,r,t)}var wd=`_reactListening`+Math.random().toString(36).slice(2);function Td(e){if(!e[wd]){e[wd]=!0,yt.forEach(function(t){t!==`selectionchange`&&(bd.has(t)||Cd(t,!1,e),Cd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wd]||(t[wd]=!0,Cd(`selectionchange`,!1,t))}}function Ed(e,t,n,r){switch(gp(t)){case 2:var i=up;break;case 8:i=dp;break;default:i=fp}n=i.bind(null,t,n,e),i=void 0,!rn||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 Dd(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=ht(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}W(function(){var r=a,i=Xt(n),s=[];a:{var c=Rr.get(e);if(c!==void 0){var l=mn,u=e;switch(e){case`keypress`:if(ln(n)===0)break a;case`keydown`:case`keyup`:l=Mn;break;case`focusin`:u=`focus`,l=Cn;break;case`focusout`:u=`blur`,l=Cn;break;case`beforeblur`:case`afterblur`:l=Cn;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=xn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Sn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Pn;break;case jr:case Mr:case Nr:l=wn;break;case Lr:l=Fn;break;case`scroll`:case`scrollend`:l=gn;break;case`wheel`:l=In;break;case`copy`:case`cut`:case`paste`:l=Tn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Nn;break;case`toggle`:case`beforetoggle`:l=Ln}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=tn(m,p),g!=null&&d.push(Od(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!==U&&(u=n.relatedTarget||n.fromElement)&&(ht(u)||u[ct]))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?ht(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=xn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Nn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:_t(l),h=u==null?c:_t(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ht(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=Ad,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&&jd(s,c,l,d,!1),u!==null&&f!==null&&jd(s,f,u,d,!0)}}a:{if(c=r?_t(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=rr;else if(Zn(c))if(ir)v=dr;else{v=ur;var y=lr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Gt(r.elementType)&&(v=rr):v=q;if(v&&=v(e,r)){Qn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Rt(c,`number`,c.value)}switch(y=r?_t(r):window,e){case`focusin`:(Zn(y)||y.contentEditable===`true`)&&(xr=y,Sr=r,Cr=null);break;case`focusout`:Cr=Sr=xr=null;break;case`mousedown`:wr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:wr=!1,Tr(s,n,i);break;case`selectionchange`:if(br)break;case`keydown`:case`keyup`:Tr(s,n,i)}var b;if(zn)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 qn?Gn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Hn&&n.locale!==`ko`&&(qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&qn&&(b=cn()):(G=i,on=`value`in G?G.value:G.textContent,qn=!0)),y=kd(r,x),0<y.length&&(x=new En(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Kn(n),b!==null&&(x.data=b)))),(b=Vn?Jn(e,n):Yn(e,n))&&(x=kd(r,`onBeforeInput`),0<x.length&&(y=new En(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),gd(s,e,r,n,i)}xd(s,t)})}function Od(e,t,n){return{instance:e,listener:t,currentTarget:n}}function kd(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=tn(e,n),i!=null&&r.unshift(Od(e,i,a)),i=tn(e,t),i!=null&&r.push(Od(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ad(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function jd(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=tn(n,a),l!=null&&o.unshift(Od(n,l,c))):i||(l=tn(n,a),l!=null&&o.push(Od(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Md=/\r\n?/g,Nd=/\u0000|\uFFFD/g;function Pd(e){return(typeof e==`string`?e:``+e).replace(Md,`
|
|
9
|
-
`).replace(Nd,``)}function Fd(e,t){return t=Pd(t),Pd(e)===t}function Id(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ht(e,``+r);break;case`className`:Dt(e,`class`,r);break;case`tabIndex`:Dt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Dt(e,n,r);break;case`style`:Wt(e,r,o);break;case`data`:if(t!==`object`){Dt(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=Jt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Id(e,t,`name`,a.name,a,null),Id(e,t,`formEncType`,a.formEncType,a,null),Id(e,t,`formMethod`,a.formMethod,a,null),Id(e,t,`formTarget`,a.formTarget,a,null)):(Id(e,t,`encType`,a.encType,a,null),Id(e,t,`method`,a.method,a,null),Id(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Jt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`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=Jt(``+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`:Sd(`beforetoggle`,e),Sd(`toggle`,e),Et(e,`popover`,r);break;case`xlinkActuate`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ot(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ot(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Et(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=Kt.get(n)||n,Et(e,n,r))}}function Ld(e,t,n,r,a,o){switch(n){case`style`:Wt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ht(e,``+r);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!bt.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[st]||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,``):Et(e,n,r)}}}function Rd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Sd(`error`,e),Sd(`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:Id(e,t,o,s,n,null)}}a&&Id(e,t,`srcSet`,n.srcSet,n,null),r&&Id(e,t,`src`,n.src,n,null);return;case`input`:Sd(`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:Id(e,t,r,d,n,null)}}Lt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Sd(`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:Id(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&zt(e,!!r,n,!0):zt(e,!!r,t,!1);return;case`textarea`:for(s in Sd(`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:Id(e,t,s,c,n,null)}Vt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Id(e,t,l,r,n,null)}return;case`dialog`:Sd(`beforetoggle`,e),Sd(`toggle`,e),Sd(`cancel`,e),Sd(`close`,e);break;case`iframe`:case`object`:Sd(`load`,e);break;case`video`:case`audio`:for(r=0;r<yd.length;r++)Sd(yd[r],e);break;case`image`:Sd(`error`,e),Sd(`load`,e);break;case`details`:Sd(`toggle`,e);break;case`embed`:case`source`:case`link`:Sd(`error`,e),Sd(`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:Id(e,t,u,r,n,null)}return;default:if(Gt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ld(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Id(e,t,c,r,n,null))}function zd(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)||Id(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&&Id(e,t,p,m,r,f)}}It(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Id(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&&Id(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?zt(e,!!n,n?[]:``,!1):zt(e,!!n,t,!0)):zt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Id(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&&Id(e,t,s,a,r,o)}Bt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Id(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:Id(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)&&Id(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:Id(e,t,u,p,r,m)}return;default:if(Gt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ld(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||Ld(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Id(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||Id(e,t,f,p,r,m)}function Bd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Vd(){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&&Bd(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&&Bd(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 Hd=null,Ud=null;function Wd(e){return e.nodeType===9?e:e.ownerDocument}function Gd(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 Kd(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 qd(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 Jd=null;function Yd(){var e=window.event;return e&&e.type===`popstate`?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Xd=typeof setTimeout==`function`?setTimeout:void 0,Zd=typeof clearTimeout==`function`?clearTimeout:void 0,Qd=typeof Promise==`function`?Promise:void 0,$d=typeof queueMicrotask==`function`?queueMicrotask:Qd===void 0?Xd:function(e){return Qd.resolve(null).then(e).catch(ef)};function ef(e){setTimeout(function(){throw e})}function tf(e){return e===`head`}function nf(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),Fp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_f(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_f(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[pt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_f(e.ownerDocument.body);n=i}while(n);Fp(t)}function rf(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 af(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`:af(n),mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function of(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[pt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=ff(e.nextSibling),e===null)break}return null}function sf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=ff(e.nextSibling),e===null))return null;return e}function cf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=ff(e.nextSibling),e===null))return null;return e}function lf(e){return e.data===`$?`||e.data===`$~`}function uf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function df(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 ff(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 pf=null;function mf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return ff(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hf(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 gf(e,t,n){switch(t=Wd(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 _f(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mt(e)}var vf=new Map,yf=new Set;function bf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xf=ae.d;ae.d={f:Sf,r:Cf,D:Ef,C:Df,L:Of,m:kf,X:jf,S:Af,M:Mf};function Sf(){var e=xf.f(),t=xu();return e||t}function Cf(e){var t=gt(e);t!==null&&t.tag===5&&t.type===`form`?xs(t):xf.r(e)}var wf=typeof document>`u`?null:document;function Tf(e,t,n){var r=wf;if(r&&typeof t==`string`&&t){var i=Ft(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Rd(t,`link`,e),z(t),r.head.appendChild(t)))}}function Ef(e){xf.D(e),Tf(`dns-prefetch`,e,null)}function Df(e,t){xf.C(e,t),Tf(`preconnect`,e,t)}function Of(e,t,n){xf.L(e,t,n);var r=wf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ft(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ft(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ft(n.imageSizes)+`"]`)):i+=`[href="`+Ft(e)+`"]`;var a=i;switch(t){case`style`:a=Pf(e);break;case`script`:a=Rf(e)}vf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Ff(a))||t===`script`&&r.querySelector(zf(a))||(t=r.createElement(`link`),Rd(t,`link`,e),z(t),r.head.appendChild(t)))}}function kf(e,t){xf.m(e,t);var n=wf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ft(r)+`"][href="`+Ft(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rf(e)}if(!vf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zf(a)))return}r=n.createElement(`link`),Rd(r,`link`,e),z(r),n.head.appendChild(r)}}}function Af(e,t,n){xf.S(e,t,n);var r=wf;if(r&&e){var i=vt(r).hoistableStyles,a=Pf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Ff(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);z(c),Rd(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,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jf(e,t){xf.X(e,t);var n=wf;if(n&&e){var r=vt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=h({src:e,async:!0},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),z(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t){xf.M(e,t);var n=wf;if(n&&e){var r=vt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),z(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t,n,r){var a=(a=fe.current)?bf(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=Pf(n.href),n=vt(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=Pf(n.href);var o=vt(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(Ff(e)))&&!o._p&&(s.instance=o,s.state.loading=5),vf.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},vf.set(e,n),o||Lf(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=Rf(n),n=vt(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 Pf(e){return`href="`+Ft(e)+`"`}function Ff(e){return`link[rel="stylesheet"][`+e+`]`}function If(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Lf(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}),Rd(t,`link`,n),z(t),e.head.appendChild(t))}function Rf(e){return`[src="`+Ft(e)+`"]`}function zf(e){return`script[async]`+e}function Bf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ft(n.href)+`"]`);if(r)return t.instance=r,z(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),z(r),Rd(r,`style`,a),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pf(n.href);var o=e.querySelector(Ff(a));if(o)return t.state.loading|=4,t.instance=o,z(o),o;r=If(n),(a=vf.get(a))&&Hf(r,a),o=(e.ownerDocument||e).createElement(`link`),z(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Rd(o,`link`,r),t.state.loading|=4,Vf(o,n.precedence,e),t.instance=o;case`script`:return o=Rf(n.src),(a=e.querySelector(zf(o)))?(t.instance=a,z(a),a):(r=n,(a=vf.get(o))&&(r=h({},n),Uf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),z(a),Rd(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,Vf(r,n.precedence,e));return t.instance}function Vf(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 Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var X=null;function Wf(e,t,n){if(X===null){var r=new Map,i=X=new Map;i.set(n,r)}else i=X,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[pt]||a[ot]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Gf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Kf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Jf(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=Pf(r.href),a=t.querySelector(Ff(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Zf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,z(a);return}a=t.ownerDocument||t,r=If(r),(i=vf.get(i))&&Hf(r,i),a=a.createElement(`link`),z(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Rd(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=Zf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Yf=0;function Xf(e,t){return e.stylesheets&&e.count===0&&$f(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Yf===0&&(Yf=62500*Vd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Yf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Zf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$f(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Qf=null;function $f(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Qf=new Map,t.forEach(ep,e),Qf=null,Zf.call(e))}function ep(e,t){if(!(t.state.loading&4)){var n=Qf.get(e);if(n)var r=n.get(null);else{n=new Map,Qf.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=Zf.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 tp={$$typeof:C,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function np(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=Ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ye(0),this.hiddenUpdates=Ye(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 rp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new np(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=$r(3,null,null,t),e.current=a,a.stateNode=e,t=$i(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ma(a),e}function Z(e){return e?(e=Zr,e):Zr}function ip(e,t,n,r,i,a){i=Z(i),r.context===null?r.context=i:r.pendingContext=i,r=Pa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Fa(e,r,t),n!==null&&(gu(n,e,t),Ia(n,e,t))}function ap(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function op(e,t){ap(e,t),(e=e.alternate)&&ap(e,t)}function sp(e){if(e.tag===13||e.tag===31){var t=Jr(e,67108864);t!==null&&gu(t,e,67108864),op(e,67108864)}}function cp(e){if(e.tag===13||e.tag===31){var t=mu();t=tt(t);var n=Jr(e,t);n!==null&&gu(n,e,t),op(e,t)}}var lp=!0;function up(e,t,n,r){var i=j.T;j.T=null;var a=ae.p;try{ae.p=2,fp(e,t,n,r)}finally{ae.p=a,j.T=i}}function dp(e,t,n,r){var i=j.T;j.T=null;var a=ae.p;try{ae.p=8,fp(e,t,n,r)}finally{ae.p=a,j.T=i}}function fp(e,t,n,r){if(lp){var i=pp(r);if(i===null)Dd(e,t,r,mp,n),Tp(e,r);else if(Dp(i,e,t,n,r))r.stopPropagation();else if(Tp(e,r),t&4&&-1<wp.indexOf(e)){for(;i!==null;){var a=gt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=We(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Re(o);s.entanglements[1]|=c,o&=~c}ad(a),!(Fl&6)&&(nu=Oe()+500,od(0,!1))}}break;case 31:case 13:s=Jr(a,2),s!==null&&gu(s,a,2),xu(),op(a,2)}if(a=pp(r),a===null&&Dd(e,t,r,mp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Dd(e,t,r,null,n)}}function pp(e){return e=Xt(e),hp(e)}var mp=null;function hp(e){if(mp=null,e=ht(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 mp=e,null}function gp(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(I()){case L:return 2;case ke:return 8;case Ae:case je:return 32;case Me:return 268435456;default:return 32}default:return 32}}var _p=!1,vp=null,yp=null,bp=null,xp=new Map,Sp=new Map,Cp=[],wp=`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 Tp(e,t){switch(e){case`focusin`:case`focusout`:vp=null;break;case`dragenter`:case`dragleave`:yp=null;break;case`mouseover`:case`mouseout`:bp=null;break;case`pointerover`:case`pointerout`:xp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Sp.delete(t.pointerId)}}function Ep(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=gt(t),t!==null&&sp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Dp(e,t,n,r,i){switch(t){case`focusin`:return vp=Ep(vp,e,t,n,r,i),!0;case`dragenter`:return yp=Ep(yp,e,t,n,r,i),!0;case`mouseover`:return bp=Ep(bp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return xp.set(a,Ep(xp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Sp.set(a,Ep(Sp.get(a)||null,e,t,n,r,i)),!0}return!1}function Op(e){var t=ht(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,it(e.priority,function(){cp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,it(e.priority,function(){cp(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 kp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);U=r,n.target.dispatchEvent(r),U=null}else return t=gt(n),t!==null&&sp(t),e.blockedOn=n,!1;t.shift()}return!0}function Ap(e,t,n){kp(e)&&n.delete(t)}function jp(){_p=!1,vp!==null&&kp(vp)&&(vp=null),yp!==null&&kp(yp)&&(yp=null),bp!==null&&kp(bp)&&(bp=null),xp.forEach(Ap),Sp.forEach(Ap)}function Mp(e,n){e.blockedOn===n&&(e.blockedOn=null,_p||(_p=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,jp)))}var Np=null;function Pp(e){Np!==e&&(Np=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Np===e&&(Np=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(hp(r||n)===null)continue;break}var a=gt(n);a!==null&&(e.splice(t,3),t-=3,ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Fp(e){function t(t){return Mp(t,e)}vp!==null&&Mp(vp,e),yp!==null&&Mp(yp,e),bp!==null&&Mp(bp,e),xp.forEach(t),Sp.forEach(t);for(var n=0;n<Cp.length;n++){var r=Cp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Cp.length&&(n=Cp[0],n.blockedOn===null);)Op(n),n.blockedOn===null&&Cp.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[st]||null;if(typeof a==`function`)o||Pp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[st]||null)s=o.formAction;else if(hp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Pp(n)}}}function Ip(){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 Lp(e){this._internalRoot=e}Rp.prototype.render=Lp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ip(n,mu(),e,t,null,null)},Rp.prototype.unmount=Lp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ip(e.current,2,null,e,null,null),xu(),t[ct]=null}};function Rp(e){this._internalRoot=e}Rp.prototype.unstable_scheduleHydration=function(e){if(e){var t=rt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Cp.length&&t!==0&&t<Cp[n].priority;n++);Cp.splice(n,0,e),n===0&&Op(e)}};var zp=n.version;if(zp!==`19.2.6`)throw Error(i(527,zp,`19.2.6`));ae.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=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Bp={bundleType:0,version:`19.2.6`,rendererPackageName:`react-dom`,currentDispatcherRef:j,reconcilerVersion:`19.2.6`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Vp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vp.isDisabled&&Vp.supportsFiber)try{Fe=Vp.inject(Bp),Ie=Vp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Hs,s=Us,c=Ws;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=rp(e,1,!1,null,null,n,r,null,o,s,c,Ip),e[ct]=t.current,Td(e),new Lp(t)}})),g=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=h()})),_=c(u(),1),v=g(),y=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},b=(e=>e?y(e):y),x=e=>e;function S(e,t=x){let n=_.useSyncExternalStore(e.subscribe,_.useCallback(()=>t(e.getState()),[e,t]),_.useCallback(()=>t(e.getInitialState()),[e,t]));return _.useDebugValue(n),n}var C=e=>{let t=b(e),n=e=>S(t,e);return Object.assign(n,t),n},w=(e=>e?C(e):C);function ee(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var T=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return T(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return T(t)(e)}}}},te=w()(((e,t)=>(n,r,i)=>{let a={storage:ee(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(e,t)=>(f(e,t),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return T(u.getItem.bind(u))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state];return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p})(e=>({activeView:`chat`,setView:t=>e({activeView:t}),apiBase:``,setApiBase:t=>e({apiBase:t}),config:{},setConfig:t=>e({config:t}),sidebarOpen:!1,setSidebarOpen:t=>e({sidebarOpen:t}),toggleSidebar:()=>e(e=>({sidebarOpen:!e.sidebarOpen}))}),{name:`nha-ui-app`,partialize:e=>({activeView:e.activeView}),merge:(e,t)=>{let n=e;return{...t,activeView:n.activeView??t.activeView}}}));function ne(){return te.getState().apiBase}async function E(e){try{let t=await fetch(ne()+e);return t.ok?t.json():null}catch{return null}}async function D(e,t,n=`POST`){let r=await fetch(ne()+e,{method:n,headers:{"Content-Type":`application/json`},body:t==null?void 0:JSON.stringify(t)}),i=await r.text();if(!r.ok)throw Error(i||String(r.status));try{return JSON.parse(i)}catch{return null}}async function O(e,t,n,r){let i=await fetch(ne()+e,{method:`POST`,headers:{"Content-Type":`application/json`,"x-nha-client":`web-ui`},body:JSON.stringify(t),signal:r});if(!i.ok||!i.body)throw Error(`Stream failed: `+i.status);let a=i.body.getReader(),o=new TextDecoder,s=``,c=``;for(;;){let{done:e,value:t}=await a.read();if(e)break;s+=o.decode(t,{stream:!0});let r=s.split(`
|
|
10
|
-
`);s=r.pop()??``;for(let e of r)if(e.startsWith(`event: `))c=e.slice(7).trim();else if(e.startsWith(`data: `)){let t=e.slice(6).trim();if(t===`[DONE]`)return;try{let e=JSON.parse(t);n({type:c,data:e})}catch{}}}}async function re(e,t,n,r){await O(e,t,e=>{e.type===`token`&&typeof e.data.content==`string`&&n(e.data.content)},r)}var k={sidebar:`_sidebar_20udr_1`,logo:`_logo_20udr_15`,logoRow:`_logoRow_20udr_24`,logoNHA:`_logoNHA_20udr_30`,logo3rdArm:`_logo3rdArm_20udr_38`,logoDot:`_logoDot_20udr_46`,dotPulse:`_dotPulse_20udr_1`,logoMeta:`_logoMeta_20udr_62`,logoVersion:`_logoVersion_20udr_69`,versionBtn:`_versionBtn_20udr_79`,versionBtnUpdate:`_versionBtnUpdate_20udr_99`,updatePulse:`_updatePulse_20udr_1`,versionBtnError:`_versionBtnError_20udr_110`,versionBtnSuccess:`_versionBtnSuccess_20udr_115`,updateHint:`_updateHint_20udr_120`,updateBtnInline:`_updateBtnInline_20udr_132`,logoView:`_logoView_20udr_149`,logoClock:`_logoClock_20udr_160`,logoSep:`_logoSep_20udr_169`,logoWeather:`_logoWeather_20udr_173`,nav:`_nav_20udr_178`,group:`_group_20udr_187`,groupLabel:`_groupLabel_20udr_192`,item:`_item_20udr_201`,active:`_active_20udr_220`,itemIcon:`_itemIcon_20udr_226`,itemLabel:`_itemLabel_20udr_233`,activeBar:`_activeBar_20udr_241`,badge:`_badge_20udr_253`,footer:`_footer_20udr_271`,footerDocs:`_footerDocs_20udr_280`,footerLink:`_footerLink_20udr_286`,footerBottom:`_footerBottom_20udr_296`,footerVersion:`_footerVersion_20udr_303`,updateBtn:`_updateBtn_20udr_132`,overlay:`_overlay_20udr_334`,open:`_open_20udr_350`},ie=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})),A=o(((e,t)=>{t.exports=ie()}))(),j=[{view:`dashboard`,icon:`⚡`,label:`Dashboard`,group:`panoramica`},{view:`chat`,icon:`💬`,label:`Chat`,group:`panoramica`},{view:`plan`,icon:`🗓️`,label:`Daily Plan`,group:`panoramica`},{view:`tasks`,icon:`✅`,label:`Tasks`,group:`panoramica`},{view:`email`,icon:`📧`,label:`Email`,group:`google`},{view:`calendar`,icon:`📅`,label:`Calendar`,group:`google`},{view:`drive`,icon:`💾`,label:`Drive`,group:`google`},{view:`contacts`,icon:`👤`,label:`Contacts`,group:`google`},{view:`notes`,icon:`📝`,label:`Notes`,group:`google`},{view:`onedrive`,icon:`☁️`,label:`OneDrive`,group:`microsoft`},{view:`mstodo`,icon:`📋`,label:`MS Todo`,group:`microsoft`},{view:`github`,icon:`🐙`,label:`GitHub`,group:`integrazioni`},{view:`notion`,icon:`📓`,label:`Notion`,group:`integrazioni`},{view:`slack`,icon:`💼`,label:`Slack`,group:`integrazioni`},{view:`maps`,icon:`🗺️`,label:`Maps`,group:`integrazioni`},{view:`reminders`,icon:`🔔`,label:`Reminders`,group:`integrazioni`},{view:`birthdays`,icon:`🎂`,label:`Birthdays`,group:`integrazioni`},{view:`cron`,icon:`⏰`,label:`Cron`,group:`integrazioni`},{view:`screen`,icon:`🖥️`,label:`Screen`,group:`integrazioni`},{view:`agents`,icon:`🤖`,label:`Agents`,group:`ai`},{view:`studio`,icon:`🎭`,label:`Studio`,group:`ai`},{view:`webcraft`,icon:`🔨`,label:`WebCraft`,group:`ai`},{view:`collab`,icon:`🏛️`,label:`Alexandria`,group:`ai`},{view:`connectors`,icon:`🔗`,label:`AWF - AutoWorkFlow`,group:`ai`},{view:`settings`,icon:`⚙️`,label:`Settings`,group:`config`}],ae=[{id:`panoramica`,label:`Panoramica`},{id:`google`,label:`Google`},{id:`microsoft`,label:`Microsoft`},{id:`integrazioni`,label:`Integrazioni`},{id:`ai`,label:`AI`},{id:`config`,label:`Config`}];function oe(){let{activeView:e,setView:t,sidebarOpen:n,setSidebarOpen:r}=te(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=()=>{l(new Date().toLocaleTimeString(`it-IT`,{hour:`2-digit`,minute:`2-digit`}))};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]),(0,_.useEffect)(()=>{let e=localStorage.getItem(`nha_weather_location`),t=e=>{E(`/api/weather?location=${encodeURIComponent(e)}`).then(e=>{e?.tempC&&a(e)}).catch(()=>{})};e?t(e):navigator.geolocation?.getCurrentPosition(e=>t(`${e.coords.latitude},${e.coords.longitude}`),()=>{})},[]),(0,_.useEffect)(()=>{E(`/api/version/check`).then(e=>{if(!e)return;let t=localStorage.getItem(`nha_updated_to`);t&&e.latest===t?s({...e,updateAvailable:!1,hasUpdate:!1,current:e.latest}):s(e)}).catch(()=>{})},[]),(0,_.useEffect)(()=>{let e=()=>E(`/api/unread-counts`).then(e=>{e&&d(e)}).catch(()=>{});e();let t=setInterval(e,12e4);return()=>clearInterval(t)},[]);let f=j.find(t=>t.view===e)?.label??e;return(0,A.jsxs)(A.Fragment,{children:[n&&(0,A.jsx)(`div`,{className:k.overlay,onClick:()=>r(!1)}),(0,A.jsxs)(`aside`,{className:`${k.sidebar} ${n?k.open:``}`,children:[(0,A.jsxs)(`div`,{className:k.logo,children:[(0,A.jsxs)(`div`,{className:k.logoRow,children:[(0,A.jsx)(`span`,{className:k.logoNHA,children:`NHA`}),(0,A.jsx)(`span`,{className:k.logo3rdArm,children:`3rdArm`}),(0,A.jsx)(`span`,{className:k.logoDot})]}),(0,A.jsx)(`div`,{className:k.logoVersion,children:(0,A.jsx)(`span`,{className:k.versionBtn,title:o?.updateAvailable?`v${o.latest} available — run: npm install -g nothumanallowed@latest`:``,children:o?`v${o.current}`:`...`})}),(0,A.jsx)(`div`,{className:k.logoView,children:f}),(0,A.jsxs)(`div`,{className:k.logoClock,children:[c,i&&(0,A.jsxs)(`span`,{className:k.logoWeather,children:[` `,`· `,i.icon,` `,Math.round(i.tempC),`°C `,i.city.split(`,`)[0]]})]})]}),(0,A.jsx)(`nav`,{className:k.nav,children:ae.map(n=>{let i=j.filter(e=>e.group===n.id);return(0,A.jsxs)(`div`,{className:k.group,children:[(0,A.jsx)(`div`,{className:k.groupLabel,children:n.label}),i.map(n=>{let i=n.view===`email`&&u&&u.emailUnread>0?u.emailUnread:n.view===`calendar`&&u&&u.todayEvents>0?u.todayEvents:null;return(0,A.jsxs)(`button`,{className:`${k.item} ${e===n.view?k.active:``}`,onClick:()=>{t(n.view),r(!1)},children:[(0,A.jsx)(`span`,{className:k.itemIcon,children:n.icon}),(0,A.jsx)(`span`,{className:k.itemLabel,children:n.label}),i!==null&&(0,A.jsx)(`span`,{className:k.badge,children:i>99?`99+`:i}),e===n.view&&(0,A.jsx)(`span`,{className:k.activeBar})]},n.view)})]},n.id)})}),(0,A.jsx)(`div`,{className:k.footer,children:(0,A.jsxs)(`div`,{className:k.footerDocs,children:[(0,A.jsx)(`a`,{href:`https://nothumanallowed.com/docs`,target:`_blank`,rel:`noopener`,className:k.footerLink,children:`Docs`}),(0,A.jsx)(`a`,{href:`https://nothumanallowed.com/docs/cli`,target:`_blank`,rel:`noopener`,className:k.footerLink,children:`CLI`}),(0,A.jsx)(`a`,{href:`https://nothumanallowed.com/docs/agents`,target:`_blank`,rel:`noopener`,className:k.footerLink,children:`Agents`}),(0,A.jsx)(`a`,{href:`https://nothumanallowed.com/docs/studio`,target:`_blank`,rel:`noopener`,className:k.footerLink,children:`Studio`})]})})]})]})}function se(e){let[t,n]=(0,_.useState)(`connecting`),r=(0,_.useRef)(2e3),i=(0,_.useRef)(0),a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(e);return s.current=e,(0,_.useEffect)(()=>{let e=!1;function t(){if(!e)try{let c=window.location.protocol===`https:`?`wss:`:`ws:`,l=new WebSocket(`${c}//${window.location.host}/ws`);o.current=l,l.onopen=()=>{if(e){l.close();return}i.current=0,r.current=2e3,n(`connected`)},l.onmessage=e=>{try{let t=JSON.parse(e.data);s.current?.(t)}catch{}},l.onclose=()=>{if(e)return;n(`disconnected`),o.current=null,i.current++;let s=Math.min(r.current*1.5**Math.min(i.current-1,6),3e4);r.current=s,a.current=setTimeout(()=>{a.current=null,t()},s)},l.onerror=()=>{try{l.close()}catch{}}}catch{n(`disconnected`)}}return t(),()=>{e=!0,a.current&&=(clearTimeout(a.current),null);try{o.current?.close()}catch{}}},[]),t}var ce={"common.save":`Save`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Cancel`,"common.delete":`Delete`,"common.edit":`Edit`,"common.add":`Add`,"common.loading":`Loading…`,"common.comingSoon":`Coming soon`,"common.error":`Error`,"common.retry":`Retry`,"common.send":`Send`,"common.close":`Close`,"common.confirm":`Confirm`,"common.back":`Back`,"common.search":`Search…`,"common.refresh":`Refresh`,"common.copy":`Copy`,"common.copied":`Copied!`,"common.open":`Open`,"common.download":`Download`,"common.upload":`Upload`,"common.sync":`Sync`,"common.syncing":`Syncing…`,"common.connected":`Connected`,"common.disconnected":`Disconnected`,"common.connect":`Connect`,"common.disconnect":`Disconnect`,"common.enable":`Enable`,"common.disable":`Disable`,"common.yes":`Yes`,"common.no":`No`,"common.none":`None`,"common.all":`All`,"common.new":`New`,"common.create":`Create`,"common.update":`Update`,"common.remove":`Remove`,"common.clear":`Clear`,"common.select":`Select`,"common.optional":`optional`,"common.required":`required`,"common.noData":`No data`,"common.empty":`Empty`,"common.today":`Today`,"common.yesterday":`Yesterday`,"common.tomorrow":`Tomorrow`,"common.status":`Status`,"common.name":`Name`,"common.email":`Email`,"common.phone":`Phone`,"common.date":`Date`,"common.time":`Time`,"common.title":`Title`,"common.description":`Description`,"common.notes":`Notes`,"common.tags":`Tags`,"common.type":`Type`,"common.size":`Size`,"common.unknown":`Unknown`,"common.actions":`Actions`,"common.preview":`Preview`,"common.settings":`Settings`,"common.version":`Version`,"sidebar.panoramica":`Overview`,"sidebar.google":`Google`,"sidebar.microsoft":`Microsoft`,"sidebar.integrazioni":`Integrations`,"sidebar.ai":`AI`,"sidebar.config":`Config`,"nav.dashboard":`Dashboard`,"nav.chat":`Chat`,"nav.plan":`Daily Plan`,"nav.tasks":`Tasks`,"nav.email":`Email`,"nav.calendar":`Calendar`,"nav.drive":`Drive`,"nav.contacts":`Contacts`,"nav.notes":`Notes`,"nav.onedrive":`OneDrive`,"nav.mstodo":`MS Todo`,"nav.github":`GitHub`,"nav.notion":`Notion`,"nav.slack":`Slack`,"nav.maps":`Maps`,"nav.reminders":`Reminders`,"nav.birthdays":`Birthdays`,"nav.cron":`Cron`,"nav.screen":`Screen`,"nav.agents":`Agents`,"nav.studio":`Studio`,"nav.webcraft":`WebCraft`,"nav.collab":`Alexandria`,"nav.connectors":`AWF - AutoWorkFlow`,"nav.settings":`Settings`,"chat.placeholder":`Message NHA…`,"chat.thinking":`Thinking…`,"chat.newChat":`New Chat`,"chat.conversations":`Conversations`,"chat.noConversations":`No conversations yet`,"chat.deleteConversation":`Delete conversation?`,"chat.copyMessage":`Copy`,"chat.regenerate":`Regenerate`,"chat.stopGeneration":`Stop`,"chat.model":`Model`,"chat.tokens":`tokens`,"chat.attachFile":`Attach file`,"chat.voice":`Voice input`,"chat.canvas":`Canvas`,"chat.browser":`Browser`,"chat.toolsUsed":`Tools used`,"chat.errorSending":`Error sending message`,"dashboard.title":`Dashboard`,"dashboard.goodMorning":`Good morning`,"dashboard.goodAfternoon":`Good afternoon`,"dashboard.goodEvening":`Good evening`,"dashboard.todayPlan":`Today's plan`,"dashboard.upcomingEvents":`Upcoming events`,"dashboard.unreadEmails":`Unread emails`,"dashboard.pendingTasks":`Pending tasks`,"dashboard.weather":`Weather`,"dashboard.noEvents":`No events today`,"dashboard.noEmails":`No unread emails`,"dashboard.noTasks":`No pending tasks`,"dashboard.systemStatus":`System Status`,"dashboard.provider":`Provider`,"dashboard.version":`Version`,"dashboard.uptime":`Uptime`,"email.inbox":`Inbox`,"email.sent":`Sent`,"email.drafts":`Drafts`,"email.compose":`Compose`,"email.reply":`Reply`,"email.replyAll":`Reply All`,"email.forward":`Forward`,"email.delete":`Delete`,"email.archive":`Archive`,"email.markRead":`Mark as read`,"email.markUnread":`Mark as unread`,"email.noEmails":`No emails`,"email.from":`From`,"email.to":`To`,"email.cc":`CC`,"email.bcc":`BCC`,"email.subject":`Subject`,"email.body":`Message`,"email.attachments":`Attachments`,"email.sending":`Sending…`,"email.sent_ok":`Email sent`,"email.search":`Search emails…`,"email.unread":`Unread`,"email.starred":`Starred`,"email.loadMore":`Load more`,"email.accounts":`Accounts`,"email.noAccounts":`No email accounts configured`,"email.addAccount":`Add Account`,"email.syncNow":`Sync now`,"email.lastSync":`Last sync`,"calendar.title":`Calendar`,"calendar.newEvent":`New Event`,"calendar.today":`Today`,"calendar.month":`Month`,"calendar.week":`Week`,"calendar.day":`Day`,"calendar.agenda":`Agenda`,"calendar.noEvents":`No events`,"calendar.allDay":`All day`,"calendar.starts":`Starts`,"calendar.ends":`Ends`,"calendar.location":`Location`,"calendar.attendees":`Attendees`,"calendar.reminder":`Reminder`,"calendar.recurring":`Recurring`,"calendar.saveEvent":`Save Event`,"calendar.deleteEvent":`Delete event?`,"calendar.editEvent":`Edit Event`,"tasks.title":`Tasks`,"tasks.newTask":`New Task`,"tasks.completed":`Completed`,"tasks.pending":`Pending`,"tasks.overdue":`Overdue`,"tasks.dueDate":`Due date`,"tasks.priority":`Priority`,"tasks.priority.high":`High`,"tasks.priority.medium":`Medium`,"tasks.priority.low":`Low`,"tasks.noTasks":`No tasks`,"tasks.markDone":`Mark as done`,"tasks.markUndone":`Mark as undone`,"tasks.deleteTask":`Delete task?`,"tasks.list":`List`,"tasks.assignee":`Assignee`,"contacts.title":`Contacts`,"contacts.newContact":`New Contact`,"contacts.noContacts":`No contacts`,"contacts.search":`Search contacts…`,"contacts.firstName":`First Name`,"contacts.lastName":`Last Name`,"contacts.company":`Company`,"contacts.role":`Role`,"contacts.address":`Address`,"contacts.birthday":`Birthday`,"contacts.deleteContact":`Delete contact?`,"notes.title":`Notes`,"notes.newNote":`New Note`,"notes.noNotes":`No notes`,"notes.search":`Search notes…`,"notes.lastModified":`Last modified`,"notes.deleteNote":`Delete note?`,"notes.untitled":`Untitled`,"plan.title":`Daily Plan`,"plan.generate":`Generate Plan`,"plan.generating":`Generating…`,"plan.noplan":`No plan for today yet`,"plan.refresh":`Refresh`,"plan.morning":`Morning`,"plan.afternoon":`Afternoon`,"plan.evening":`Evening`,"plan.planTime":`Plan generation time`,"plan.summaryTime":`Summary time`,"drive.title":`Drive`,"drive.myDrive":`My Drive`,"drive.shared":`Shared with me`,"drive.recent":`Recent`,"drive.noFiles":`No files`,"drive.upload":`Upload`,"drive.newFolder":`New Folder`,"drive.download":`Download`,"drive.delete":`Delete`,"drive.rename":`Rename`,"drive.share":`Share`,"drive.search":`Search files…`,"drive.size":`Size`,"drive.modified":`Modified`,"drive.owner":`Owner`,"drive.quota":`Storage`,"onedrive.title":`OneDrive`,"onedrive.noFiles":`No files`,"onedrive.connect":`Connect Microsoft account`,"onedrive.search":`Search OneDrive…`,"mstodo.title":`MS To Do`,"mstodo.noLists":`No lists`,"mstodo.noTasks":`No tasks`,"mstodo.newTask":`New task`,"mstodo.connect":`Connect Microsoft account`,"mstodo.addPlaceholder":`Add a new task…`,"mstodo.add":`+ Add`,"mstodo.noActive":`No active tasks`,"mstodo.due":`Due`,"mstodo.authRequired":`Microsoft To Do requires Microsoft authentication. Run nha microsoft auth in the terminal.`,"github.title":`GitHub`,"github.repos":`Repositories`,"github.issues":`Issues`,"github.prs":`Pull Requests`,"github.noRepos":`No repositories`,"github.noIssues":`No issues`,"github.noPrs":`No pull requests`,"github.search":`Search repos…`,"github.open":`Open`,"github.closed":`Closed`,"github.merged":`Merged`,"github.stars":`Stars`,"github.forks":`Forks`,"github.connect":`Connect GitHub`,"notion.title":`Notion`,"notion.pages":`Pages`,"notion.databases":`Databases`,"notion.noPages":`No pages`,"notion.search":`Search Notion…`,"notion.connect":`Connect Notion`,"slack.title":`Slack`,"slack.channels":`Channels`,"slack.dms":`Direct Messages`,"slack.noMessages":`No messages`,"slack.send":`Send`,"slack.connect":`Connect Slack`,"maps.title":`Maps`,"maps.search":`Search location…`,"maps.directions":`Directions`,"maps.from":`From`,"maps.to":`To`,"maps.route":`Get Route`,"maps.distance":`Distance`,"maps.duration":`Duration`,"maps.noResults":`No results`,"reminders.title":`Reminders`,"reminders.new":`New Reminder`,"reminders.noReminders":`No reminders`,"reminders.dueDate":`Due`,"reminders.repeat":`Repeat`,"reminders.delete":`Delete reminder?`,"reminders.done":`Done`,"birthdays.title":`Birthdays`,"birthdays.upcoming":`Upcoming`,"birthdays.noBirthdays":`No birthdays`,"birthdays.age":`Age`,"birthdays.daysLeft":`days left`,"birthdays.today":`Today!`,"birthdays.new":`Add Birthday`,"cron.title":`Scheduled Tasks`,"cron.newJob":`New Job`,"cron.noJobs":`No scheduled jobs`,"cron.schedule":`Schedule`,"cron.command":`Command`,"cron.lastRun":`Last run`,"cron.nextRun":`Next run`,"cron.status":`Status`,"cron.active":`Active`,"cron.paused":`Paused`,"cron.delete":`Delete job?`,"cron.run":`Run now`,"cron.pause":`Pause`,"cron.resume":`Resume`,"screen.title":`Screen Capture`,"screen.capture":`Capture Screen`,"screen.captureRegion":`Capture Region`,"screen.history":`History`,"screen.noCaptures":`No captures`,"screen.view":`View`,"screen.delete":`Delete`,"screen.describe":`Describe with AI`,"agents.title":`Agents`,"agents.newAgent":`New Agent`,"agents.noAgents":`No agents`,"agents.run":`Run`,"agents.running":`Running…`,"agents.stop":`Stop`,"agents.edit":`Edit`,"agents.delete":`Delete agent?`,"agents.prompt":`System Prompt`,"agents.name":`Agent Name`,"agents.model":`Model`,"agents.schedule":`Schedule`,"agents.lastRun":`Last run`,"agents.output":`Output`,"agents.tools":`Tools`,"agents.openPanel":`Open panel`,"agents.addAgent":`Add agent`,"agents.noDescription":`No description`,"agents.orchestrator":`Orchestrator`,"agents.orchestratorPlaceholder":`Send to all agents…`,"agents.orchestratorSend":`Send to all`,"agents.orchestratorSynthesis":`Conductor Synthesis`,"agents.attachFile":`Attach file`,"agents.voice":`Voice`,"agents.typeMessage":`Type a message…`,"agents.working":`working`,"agents.waitingResponse":`Waiting for response…`,"studio.title":`Studio`,"studio.newSession":`New Session`,"studio.task":`Task`,"studio.taskPlaceholder":`Describe what you want the agents to deliberate on…`,"studio.agents":`Agents`,"studio.run":`Run Deliberation`,"studio.running":`Deliberating…`,"studio.stop":`Stop`,"studio.result":`Result`,"studio.round":`Round`,"studio.convergence":`Convergence`,"studio.consensus":`Consensus`,"studio.noSessions":`No sessions`,"studio.plan":`Plan`,"studio.planning":`Planning…`,"studio.log":`Log`,"studio.export":`Export`,"studio.panel":`Panel`,"studio.canvas":`Canvas`,"studio.browser":`Browser`,"studio.parliament":`Council`,"studio.parliamentPrompt":`Activate Council analysis?`,"studio.parliamentSub":`The multi-agent Council will analyze the result using Legion X deliberation.`,"studio.parliamentActivate":`Activate`,"studio.parliamentSkip":`Skip`,"studio.parliamentRunning":`Council deliberating…`,"connectors.title":`AWF - AutoWorkFlow`,"connectors.google":`Google`,"connectors.microsoft":`Microsoft`,"connectors.telegram":`Telegram`,"connectors.discord":`Discord`,"connectors.github":`GitHub`,"connectors.notion":`Notion`,"connectors.slack":`Slack`,"connectors.connect":`Connect`,"connectors.connected":`Connected`,"connectors.disconnect":`Disconnect`,"connectors.configure":`Configure`,"connectors.nodePalette":`Node Palette`,"connectors.triggers":`Triggers`,"connectors.actions":`Actions`,"connectors.ai":`AI`,"connectors.newWorkflow":`New Workflow`,"connectors.noWorkflows":`No workflows yet`,"connectors.noWorkflowsSub":`Drag nodes from the palette to build your first automation`,"connectors.workflowName":`Workflow name`,"connectors.run":`Run`,"connectors.running":`Running…`,"connectors.delete":`Delete`,"connectors.save":`Save`,"connectors.config":`Configuration`,"connectors.nodeConfig":`Node Config`,"connectors.close":`Close`,"connectors.log":`Execution Log`,"connectors.deleteEdge":`Delete edge`,"webcraft.title":`WebCraft`,"webcraft.newProject":`New Project`,"webcraft.projectName":`Project name`,"webcraft.description":`Describe the app you want to build…`,"webcraft.build":`Build`,"webcraft.building":`Building…`,"webcraft.preview":`Preview`,"webcraft.code":`Code`,"webcraft.files":`Files`,"webcraft.console":`Console`,"webcraft.deploy":`Deploy`,"webcraft.stop":`Stop server`,"webcraft.start":`Start server`,"webcraft.noProjects":`No projects`,"webcraft.fix":`Fix error`,"webcraft.doctrine":`Development Guide`,"webcraft.doctrine.title":`The WebCraft Method`,"webcraft.doctrine.subtitle":`How to build enterprise-grade websites with AI`,"webcraft.doctrine.phase1.title":`🏗 Phase 1 — The Foundation`,"webcraft.doctrine.phase1.desc":`WebCraft just generated a working base for your project: a server with middleware, a landing page, CSS, and JavaScript. This is NOT the final product — it is the foundation. The site already works: click Sandbox to see it live. Every file is complete and functional. Your job now is to shape it into exactly what you want, one feature at a time.`,"webcraft.doctrine.phase2.title":`🧱 Phase 2 — Build Feature by Feature`,"webcraft.doctrine.phase2.desc":`This is the core of the method. Instead of generating everything at once (which leads to truncated files and inconsistencies), you tell the AI agent what to add, one piece at a time. The agent reads your existing code, understands the architecture, makes surgical changes, and verifies them. Try these commands:
|
|
11
|
-
|
|
12
|
-
• "Add user authentication with register, login, and JWT tokens"
|
|
13
|
-
• "Create a dashboard page that shows user statistics"
|
|
14
|
-
• "Add a REST API for managing blog posts with CRUD operations"
|
|
15
|
-
• "Create a contact form that sends emails"
|
|
16
|
-
|
|
17
|
-
Be specific. The more detail you give, the better the result. "Add a pricing section with 3 tiers: Free, Pro $9/mo, Enterprise $29/mo" works much better than "add pricing".`,"webcraft.doctrine.phase3.title":`🎨 Phase 3 — Design & UX Polish`,"webcraft.doctrine.phase3.desc":`Once the features work, refine the look and feel. The agent can modify CSS, add animations, improve layouts:
|
|
18
|
-
|
|
19
|
-
• "Make the hero section more modern with a gradient background and floating elements"
|
|
20
|
-
• "Add dark mode toggle that persists in localStorage"
|
|
21
|
-
• "Add scroll animations with Intersection Observer"
|
|
22
|
-
• "Make the navigation sticky with blur backdrop"
|
|
23
|
-
• "Add loading skeletons for async content"
|
|
24
|
-
|
|
25
|
-
The agent sees your CSS and HTML — it makes targeted changes without breaking existing styles.`,"webcraft.doctrine.phase4.title":`🔒 Phase 4 — Security & Production`,"webcraft.doctrine.phase4.desc":`Before deploying, harden your site:
|
|
26
|
-
|
|
27
|
-
• "Add a GDPR cookie consent banner with Accept/Reject"
|
|
28
|
-
• "Add rate limiting to all API routes"
|
|
29
|
-
• "Add input validation and sanitization on all forms"
|
|
30
|
-
• "Add CSRF protection"
|
|
31
|
-
• "Add security headers: HSTS, CSP, X-Frame-Options"
|
|
32
|
-
|
|
33
|
-
The agent knows enterprise security patterns. It adds helmet configuration, express-rate-limit, input validators, and proper error handling.`,"webcraft.doctrine.phase5.title":`🚀 Phase 5 — Test & Deploy`,"webcraft.doctrine.phase5.desc":`Use the integrated tools to verify everything works:
|
|
34
|
-
|
|
35
|
-
• Click ▶ Sandbox to run your site live in the preview
|
|
36
|
-
• Use the Terminal (⌨) to run npm test, check logs, debug
|
|
37
|
-
• The agent can run shell commands: "Run npm install and start the server"
|
|
38
|
-
• Download the ZIP — your project is self-contained with all dependencies
|
|
39
|
-
• Deploy to any Node.js host: Vercel, Railway, DigitalOcean, your own server`,"webcraft.doctrine.tools.title":`🛠 Your AI Agent's Tools`,"webcraft.doctrine.tools.desc":`The agent has 12 professional tools at its disposal:
|
|
40
|
-
|
|
41
|
-
• read / edit / write — Read, modify, and create files
|
|
42
|
-
• rename / delete — Manage project structure
|
|
43
|
-
• search — Find code patterns across all files
|
|
44
|
-
• check / lint — Verify syntax and find errors
|
|
45
|
-
• run — Execute shell commands (npm install, npm test, etc.)
|
|
46
|
-
• sandbox — Restart the live preview to test changes
|
|
47
|
-
• diff — Compare changes with previous versions
|
|
48
|
-
|
|
49
|
-
The agent works in a loop: read → plan → modify → verify → fix if needed. Like a real developer.`,"webcraft.doctrine.golden.title":`⚡ Golden Rules`,"webcraft.doctrine.golden.desc":`1. ONE FEATURE AT A TIME — Don't ask for 10 things at once. Build incrementally.
|
|
50
|
-
2. BE SPECIFIC — "Add a contact form with name, email, message, and validation" > "add a form"
|
|
51
|
-
3. VERIFY IN SANDBOX — After each change, check the Sandbox preview
|
|
52
|
-
4. USE THE TERMINAL — Run npm install, npm test, check server logs
|
|
53
|
-
5. THE AGENT READS YOUR CODE — It understands your architecture. Trust it to make consistent changes.
|
|
54
|
-
6. ITERATE — If something isn't right, tell the agent: "The button color should be blue, not green"`,"webcraft.doctrine.close":`Got it — let's build!`,"webcraft.fixing":`Fixing…`,"webcraft.error":`Error detected`,"webcraft.running":`Running`,"webcraft.stopped":`Stopped`,"webcraft.port":`Port`,"collab.title":`Alexandria`,"collab.channels":`Channels`,"collab.newChannel":`New Channel`,"collab.noChannels":`No channels`,"collab.messages":`Messages`,"collab.noMessages":`No messages`,"collab.send":`Send`,"collab.placeholder":`Message to the channel…`,"collab.channelId":`Channel ID`,"collab.create":`Create Channel`,"collab.join":`Join Channel`,"collab.leave":`Leave`,"collab.copy":`Copy ID`,"collab.identity":`Your Identity`,"settings.title":`Settings`,"settings.profile":`User Profile`,"settings.profileSub":`Agents use this when you say "my home", "my city", etc.`,"settings.name":`Name`,"settings.namePh":`e.g. John Smith`,"settings.emailPh":`e.g. john@example.com`,"settings.phonePh":`e.g. +1 555 123 4567`,"settings.homeAddress":`Home Address`,"settings.homeAddressPh":`e.g. 123 Main St`,"settings.workAddress":`Work Address`,"settings.workAddressPh":`e.g. 456 Office Blvd`,"settings.city":`City`,"settings.cityPh":`e.g. New York`,"settings.country":`Country`,"settings.countryPh":`e.g. USA`,"settings.company":`Company`,"settings.companyPh":`e.g. Acme Inc`,"settings.role":`Role`,"settings.rolePh":`e.g. Software Engineer`,"settings.notes":`Notes`,"settings.notesPh":`Anything else agents should know about you`,"settings.saveProfile":`Save Profile`,"settings.nhaFreeTitle":`NHA Free (Liara)`,"settings.nhaFreeSub":`Powered by Qwen3 32B. Free, no API key needed. Slower (5–15s).`,"settings.useLiara":`Use NHA Free`,"settings.liaraActivated":`✓ Liara activated`,"settings.llmProvider":`LLM Provider`,"settings.llmProviderSub":`Or use your own API key for faster responses.`,"settings.provider":`Provider`,"settings.apiKey":`API Key`,"settings.apiKeyPh":`Paste your API key here`,"settings.apiKeyFreeNote":`Not needed for NHA Free`,"settings.apiKeySet":`✓ API key configured — enter a new one to change it`,"settings.model":`Model`,"settings.modelPh":`Leave empty for default`,"settings.thinking":`Extended Thinking`,"settings.thinkingOff":`Off — faster responses`,"settings.thinkingOn":`On — extended reasoning (NHA Free only)`,"settings.saveProvider":`Save Provider`,"settings.language":`Language`,"settings.languageLabel":`Language used by all agents and Studio`,"settings.telegram":`Telegram & Discord Bot`,"settings.telegramSub":`Auto-reply to Telegram and Discord messages.`,"settings.telegramToken":`Telegram Bot Token`,"settings.telegramPh":`Get from @BotFather`,"settings.telegramSet":`••••••• (set — enter new to change)`,"settings.discordToken":`Discord Bot Token`,"settings.discordPh":`From Discord Developer Portal`,"settings.discordSet":`••••••• (set — enter new to change)`,"settings.saveBots":`Save Bots`,"settings.dailyOps":`Daily Operations`,"settings.planTime":`Daily Plan Time`,"settings.summaryTime":`Summary Time`,"settings.meetingAlert":`Meeting Alert (minutes)`,"settings.saveSchedule":`Save Schedule`,"settings.googleAccount":`Google Account`,"settings.googleSub":`Connect Gmail, Calendar, Drive, Contacts and Tasks.`,"settings.connectGoogle":`Connect Google`,"settings.reconnectGoogle":`Reconnect Google`,"settings.disconnectGoogle":`Disconnect Google`,"settings.imapAccounts":`Email Accounts (IMAP/SMTP)`,"settings.imapSub":`IMAP is read-only — no emails are ever deleted or moved on the server.`,"settings.addAccount":`+ Add Account`,"settings.noImapAccounts":`No IMAP accounts configured yet.`,"settings.editImapAccount":`Edit IMAP Account`,"settings.addImapAccount":`Add IMAP Account`,"settings.displayName":`Display Name`,"settings.displayNamePh":`e.g. Work Email`,"settings.fromName":`From Name`,"settings.fromNamePh":`e.g. John Smith`,"settings.imapServer":`IMAP Server`,"settings.imapPort":`IMAP Port`,"settings.smtpServer":`SMTP Server`,"settings.smtpPort":`SMTP Port`,"settings.username":`Username`,"settings.password":`Password`,"settings.passwordKeep":`(leave empty to keep existing)`,"settings.passwordPh":`App password or IMAP password`,"settings.show":`Show`,"settings.hide":`Hide`,"settings.sync":`Sync`,"settings.imapDelete":`Delete account "{name}"? All synced emails will be removed locally.`,"settings.disconnectGoogleConfirm":`Disconnect Google account?`,"settings.googleOpened":`Sign-in page opened. Complete the login then reload NHA.`,"settings.googleOpening":`Opening Google sign-in…`},le={en:ce,it:{"common.save":`Salva`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Annulla`,"common.delete":`Elimina`,"common.edit":`Modifica`,"common.add":`Aggiungi`,"common.loading":`Caricamento…`,"common.comingSoon":`Prossimamente`,"common.error":`Errore`,"common.retry":`Riprova`,"common.send":`Invia`,"common.close":`Chiudi`,"common.confirm":`Conferma`,"common.back":`Indietro`,"common.search":`Cerca…`,"common.refresh":`Aggiorna`,"common.copy":`Copia`,"common.copied":`Copiato!`,"common.open":`Apri`,"common.download":`Scarica`,"common.upload":`Carica`,"common.sync":`Sincronizza`,"common.syncing":`Sincronizzazione…`,"common.connected":`Connesso`,"common.disconnected":`Disconnesso`,"common.connect":`Connetti`,"common.disconnect":`Disconnetti`,"common.enable":`Abilita`,"common.disable":`Disabilita`,"common.yes":`Sì`,"common.no":`No`,"common.none":`Nessuno`,"common.all":`Tutti`,"common.new":`Nuovo`,"common.create":`Crea`,"common.update":`Aggiorna`,"common.remove":`Rimuovi`,"common.clear":`Cancella`,"common.select":`Seleziona`,"common.optional":`opzionale`,"common.required":`obbligatorio`,"common.noData":`Nessun dato`,"common.empty":`Vuoto`,"common.today":`Oggi`,"common.yesterday":`Ieri`,"common.tomorrow":`Domani`,"common.status":`Stato`,"common.name":`Nome`,"common.email":`Email`,"common.phone":`Telefono`,"common.date":`Data`,"common.time":`Orario`,"common.title":`Titolo`,"common.description":`Descrizione`,"common.notes":`Note`,"common.tags":`Tag`,"common.type":`Tipo`,"common.size":`Dimensione`,"common.unknown":`Sconosciuto`,"common.actions":`Azioni`,"common.preview":`Anteprima`,"common.settings":`Impostazioni`,"common.version":`Versione`,"sidebar.panoramica":`Panoramica`,"sidebar.google":`Google`,"sidebar.microsoft":`Microsoft`,"sidebar.integrazioni":`Integrazioni`,"sidebar.ai":`AI`,"sidebar.config":`Config`,"nav.dashboard":`Dashboard`,"nav.chat":`Chat`,"nav.plan":`Piano Giornaliero`,"nav.tasks":`Task`,"nav.email":`Email`,"nav.calendar":`Calendario`,"nav.drive":`Drive`,"nav.contacts":`Contatti`,"nav.notes":`Note`,"nav.onedrive":`OneDrive`,"nav.mstodo":`MS Todo`,"nav.github":`GitHub`,"nav.notion":`Notion`,"nav.slack":`Slack`,"nav.maps":`Mappe`,"nav.reminders":`Promemoria`,"nav.birthdays":`Compleanni`,"nav.cron":`Cron`,"nav.screen":`Schermo`,"nav.agents":`Agenti`,"nav.studio":`Studio`,"nav.webcraft":`WebCraft`,"nav.collab":`Alexandria`,"nav.connectors":`AWF - AutoWorkFlow`,"nav.settings":`Impostazioni`,"chat.placeholder":`Scrivi a NHA…`,"chat.thinking":`Sto pensando…`,"chat.newChat":`Nuova Chat`,"chat.conversations":`Conversazioni`,"chat.noConversations":`Nessuna conversazione`,"chat.deleteConversation":`Elimina la conversazione?`,"chat.copyMessage":`Copia`,"chat.regenerate":`Rigenera`,"chat.stopGeneration":`Ferma`,"chat.model":`Modello`,"chat.tokens":`token`,"chat.attachFile":`Allega file`,"chat.voice":`Input vocale`,"chat.canvas":`Canvas`,"chat.browser":`Browser`,"chat.toolsUsed":`Strumenti usati`,"chat.errorSending":`Errore nell'invio del messaggio`,"dashboard.title":`Dashboard`,"dashboard.goodMorning":`Buongiorno`,"dashboard.goodAfternoon":`Buon pomeriggio`,"dashboard.goodEvening":`Buonasera`,"dashboard.todayPlan":`Piano di oggi`,"dashboard.upcomingEvents":`Prossimi eventi`,"dashboard.unreadEmails":`Email non lette`,"dashboard.pendingTasks":`Task in sospeso`,"dashboard.weather":`Meteo`,"dashboard.noEvents":`Nessun evento oggi`,"dashboard.noEmails":`Nessuna email non letta`,"dashboard.noTasks":`Nessun task in sospeso`,"dashboard.systemStatus":`Stato del sistema`,"dashboard.provider":`Provider`,"dashboard.version":`Versione`,"dashboard.uptime":`Uptime`,"email.inbox":`In arrivo`,"email.sent":`Inviati`,"email.drafts":`Bozze`,"email.compose":`Scrivi`,"email.reply":`Rispondi`,"email.replyAll":`Rispondi a tutti`,"email.forward":`Inoltra`,"email.delete":`Elimina`,"email.archive":`Archivia`,"email.markRead":`Segna come letto`,"email.markUnread":`Segna come non letto`,"email.noEmails":`Nessuna email`,"email.from":`Da`,"email.to":`A`,"email.cc":`CC`,"email.bcc":`CCN`,"email.subject":`Oggetto`,"email.body":`Messaggio`,"email.attachments":`Allegati`,"email.sending":`Invio in corso…`,"email.sent_ok":`Email inviata`,"email.search":`Cerca email…`,"email.unread":`Non lette`,"email.starred":`Preferite`,"email.loadMore":`Carica altro`,"email.accounts":`Account`,"email.noAccounts":`Nessun account email configurato`,"email.addAccount":`Aggiungi account`,"email.syncNow":`Sincronizza ora`,"email.lastSync":`Ultima sincronizzazione`,"calendar.title":`Calendario`,"calendar.newEvent":`Nuovo Evento`,"calendar.today":`Oggi`,"calendar.month":`Mese`,"calendar.week":`Settimana`,"calendar.day":`Giorno`,"calendar.agenda":`Agenda`,"calendar.noEvents":`Nessun evento`,"calendar.allDay":`Tutto il giorno`,"calendar.starts":`Inizio`,"calendar.ends":`Fine`,"calendar.location":`Luogo`,"calendar.attendees":`Partecipanti`,"calendar.reminder":`Promemoria`,"calendar.recurring":`Ricorrente`,"calendar.saveEvent":`Salva Evento`,"calendar.deleteEvent":`Eliminare l'evento?`,"calendar.editEvent":`Modifica Evento`,"tasks.title":`Task`,"tasks.newTask":`Nuovo Task`,"tasks.completed":`Completati`,"tasks.pending":`In sospeso`,"tasks.overdue":`In ritardo`,"tasks.dueDate":`Scadenza`,"tasks.priority":`Priorità`,"tasks.priority.high":`Alta`,"tasks.priority.medium":`Media`,"tasks.priority.low":`Bassa`,"tasks.noTasks":`Nessun task`,"tasks.markDone":`Segna come fatto`,"tasks.markUndone":`Segna come non fatto`,"tasks.deleteTask":`Eliminare il task?`,"tasks.list":`Lista`,"tasks.assignee":`Assegnato a`,"contacts.title":`Contatti`,"contacts.newContact":`Nuovo Contatto`,"contacts.noContacts":`Nessun contatto`,"contacts.search":`Cerca contatti…`,"contacts.firstName":`Nome`,"contacts.lastName":`Cognome`,"contacts.company":`Azienda`,"contacts.role":`Ruolo`,"contacts.address":`Indirizzo`,"contacts.birthday":`Compleanno`,"contacts.deleteContact":`Eliminare il contatto?`,"notes.title":`Note`,"notes.newNote":`Nuova Nota`,"notes.noNotes":`Nessuna nota`,"notes.search":`Cerca note…`,"notes.lastModified":`Ultima modifica`,"notes.deleteNote":`Eliminare la nota?`,"notes.untitled":`Senza titolo`,"plan.title":`Piano Giornaliero`,"plan.generate":`Genera Piano`,"plan.generating":`Generazione…`,"plan.noplan":`Nessun piano per oggi`,"plan.refresh":`Aggiorna`,"plan.morning":`Mattina`,"plan.afternoon":`Pomeriggio`,"plan.evening":`Sera`,"plan.planTime":`Orario generazione piano`,"plan.summaryTime":`Orario riepilogo`,"drive.title":`Drive`,"drive.myDrive":`Il mio Drive`,"drive.shared":`Condivisi con me`,"drive.recent":`Recenti`,"drive.noFiles":`Nessun file`,"drive.upload":`Carica`,"drive.newFolder":`Nuova Cartella`,"drive.download":`Scarica`,"drive.delete":`Elimina`,"drive.rename":`Rinomina`,"drive.share":`Condividi`,"drive.search":`Cerca file…`,"drive.size":`Dimensione`,"drive.modified":`Modificato`,"drive.owner":`Proprietario`,"drive.quota":`Spazio`,"onedrive.title":`OneDrive`,"onedrive.noFiles":`Nessun file`,"onedrive.connect":`Connetti account Microsoft`,"onedrive.search":`Cerca su OneDrive…`,"mstodo.title":`MS To Do`,"mstodo.noLists":`Nessuna lista`,"mstodo.noTasks":`Nessun task`,"mstodo.newTask":`Nuovo task`,"mstodo.connect":`Connetti account Microsoft`,"mstodo.addPlaceholder":`Aggiungi un nuovo task…`,"mstodo.add":`+ Aggiungi`,"mstodo.noActive":`Nessun task attivo`,"mstodo.due":`Scadenza`,"mstodo.authRequired":`MS To Do richiede autenticazione Microsoft. Esegui nha microsoft auth nel terminale.`,"github.title":`GitHub`,"github.repos":`Repository`,"github.issues":`Issue`,"github.prs":`Pull Request`,"github.noRepos":`Nessun repository`,"github.noIssues":`Nessuna issue`,"github.noPrs":`Nessuna pull request`,"github.search":`Cerca repository…`,"github.open":`Aperta`,"github.closed":`Chiusa`,"github.merged":`Unita`,"github.stars":`Stelle`,"github.forks":`Fork`,"github.connect":`Connetti GitHub`,"notion.title":`Notion`,"notion.pages":`Pagine`,"notion.databases":`Database`,"notion.noPages":`Nessuna pagina`,"notion.search":`Cerca su Notion…`,"notion.connect":`Connetti Notion`,"slack.title":`Slack`,"slack.channels":`Canali`,"slack.dms":`Messaggi diretti`,"slack.noMessages":`Nessun messaggio`,"slack.send":`Invia`,"slack.connect":`Connetti Slack`,"maps.title":`Mappe`,"maps.search":`Cerca luogo…`,"maps.directions":`Indicazioni`,"maps.from":`Da`,"maps.to":`A`,"maps.route":`Calcola percorso`,"maps.distance":`Distanza`,"maps.duration":`Durata`,"maps.noResults":`Nessun risultato`,"reminders.title":`Promemoria`,"reminders.new":`Nuovo Promemoria`,"reminders.noReminders":`Nessun promemoria`,"reminders.dueDate":`Scadenza`,"reminders.repeat":`Ripeti`,"reminders.delete":`Eliminare il promemoria?`,"reminders.done":`Fatto`,"birthdays.title":`Compleanni`,"birthdays.upcoming":`In arrivo`,"birthdays.noBirthdays":`Nessun compleanno`,"birthdays.age":`Età`,"birthdays.daysLeft":`giorni rimanenti`,"birthdays.today":`Oggi!`,"birthdays.new":`Aggiungi Compleanno`,"cron.title":`Task Pianificati`,"cron.newJob":`Nuovo Job`,"cron.noJobs":`Nessun job pianificato`,"cron.schedule":`Pianificazione`,"cron.command":`Comando`,"cron.lastRun":`Ultima esecuzione`,"cron.nextRun":`Prossima esecuzione`,"cron.status":`Stato`,"cron.active":`Attivo`,"cron.paused":`In pausa`,"cron.delete":`Eliminare il job?`,"cron.run":`Esegui ora`,"cron.pause":`Pausa`,"cron.resume":`Riprendi`,"screen.title":`Cattura Schermo`,"screen.capture":`Cattura schermo`,"screen.captureRegion":`Cattura area`,"screen.history":`Cronologia`,"screen.noCaptures":`Nessuna cattura`,"screen.view":`Visualizza`,"screen.delete":`Elimina`,"screen.describe":`Descrivi con AI`,"agents.title":`Agenti`,"agents.newAgent":`Nuovo Agente`,"agents.noAgents":`Nessun agente`,"agents.run":`Esegui`,"agents.running":`In esecuzione…`,"agents.stop":`Ferma`,"agents.edit":`Modifica`,"agents.delete":`Eliminare l'agente?`,"agents.prompt":`System Prompt`,"agents.name":`Nome Agente`,"agents.model":`Modello`,"agents.schedule":`Pianificazione`,"agents.lastRun":`Ultima esecuzione`,"agents.output":`Output`,"agents.tools":`Strumenti`,"agents.openPanel":`Apri pannello`,"agents.addAgent":`Aggiungi agente`,"agents.noDescription":`Nessuna descrizione`,"agents.orchestrator":`Orchestratore`,"agents.orchestratorPlaceholder":`Invia a tutti gli agenti…`,"agents.orchestratorSend":`Invia a tutti`,"agents.orchestratorSynthesis":`Sintesi Conductor`,"agents.attachFile":`Allega file`,"agents.voice":`Voce`,"agents.typeMessage":`Scrivi un messaggio…`,"agents.working":`in lavoro`,"agents.waitingResponse":`In attesa di risposta…`,"studio.title":`Studio`,"studio.newSession":`Nuova Sessione`,"studio.task":`Task`,"studio.taskPlaceholder":`Descrivi cosa vuoi che gli agenti deliberino…`,"studio.agents":`Agenti`,"studio.run":`Avvia Deliberazione`,"studio.running":`Deliberando…`,"studio.stop":`Ferma`,"studio.result":`Risultato`,"studio.round":`Round`,"studio.convergence":`Convergenza`,"studio.consensus":`Consenso`,"studio.noSessions":`Nessuna sessione`,"studio.plan":`Piano`,"studio.planning":`Pianificazione…`,"studio.log":`Log`,"studio.export":`Esporta`,"studio.panel":`Pannello`,"studio.canvas":`Canvas`,"studio.browser":`Browser`,"studio.parliament":`Consiglio`,"studio.parliamentPrompt":`Attivare l'analisi del Consiglio?`,"studio.parliamentSub":`Il Consiglio multi-agente analizzerà il risultato usando la deliberazione Legion X.`,"studio.parliamentActivate":`Attiva`,"studio.parliamentSkip":`Salta`,"studio.parliamentRunning":`Consiglio in deliberazione…`,"connectors.title":`Connettori`,"connectors.google":`Google`,"connectors.microsoft":`Microsoft`,"connectors.telegram":`Telegram`,"connectors.discord":`Discord`,"connectors.github":`GitHub`,"connectors.notion":`Notion`,"connectors.slack":`Slack`,"connectors.connect":`Connetti`,"connectors.connected":`Connesso`,"connectors.disconnect":`Disconnetti`,"connectors.configure":`Configura`,"connectors.nodePalette":`Palette Nodi`,"connectors.triggers":`Trigger`,"connectors.actions":`Azioni`,"connectors.ai":`AI`,"connectors.newWorkflow":`Nuovo Workflow`,"connectors.noWorkflows":`Nessun workflow`,"connectors.noWorkflowsSub":`Trascina nodi dalla palette per costruire la tua prima automazione`,"connectors.workflowName":`Nome workflow`,"connectors.run":`Esegui`,"connectors.running":`In esecuzione…`,"connectors.delete":`Elimina`,"connectors.save":`Salva`,"connectors.config":`Configurazione`,"connectors.nodeConfig":`Config Nodo`,"connectors.close":`Chiudi`,"connectors.log":`Log Esecuzione`,"connectors.deleteEdge":`Elimina connessione`,"webcraft.title":`WebCraft`,"webcraft.newProject":`Nuovo Progetto`,"webcraft.projectName":`Nome progetto`,"webcraft.description":`Descrivi l'app che vuoi costruire…`,"webcraft.build":`Costruisci`,"webcraft.building":`Costruendo…`,"webcraft.preview":`Anteprima`,"webcraft.code":`Codice`,"webcraft.files":`File`,"webcraft.console":`Console`,"webcraft.deploy":`Pubblica`,"webcraft.stop":`Ferma server`,"webcraft.start":`Avvia server`,"webcraft.noProjects":`Nessun progetto`,"webcraft.fix":`Correggi errore`,"webcraft.fixing":`Correzione…`,"webcraft.error":`Errore rilevato`,"webcraft.running":`In esecuzione`,"webcraft.stopped":`Fermo`,"webcraft.port":`Porta`,"collab.title":`Alexandria`,"collab.channels":`Canali`,"collab.newChannel":`Nuovo Canale`,"collab.noChannels":`Nessun canale`,"collab.messages":`Messaggi`,"collab.noMessages":`Nessun messaggio`,"collab.send":`Invia`,"collab.placeholder":`Messaggio al canale…`,"collab.channelId":`ID Canale`,"collab.create":`Crea Canale`,"collab.join":`Unisciti`,"collab.leave":`Lascia`,"collab.copy":`Copia ID`,"collab.identity":`La tua identità`,"settings.title":`Impostazioni`,"settings.profile":`Profilo Utente`,"settings.profileSub":`Gli agenti usano questo quando dici "casa mia", "la mia città", ecc.`,"settings.name":`Nome`,"settings.namePh":`es. Mario Rossi`,"settings.emailPh":`es. mario@esempio.com`,"settings.phonePh":`es. +39 333 123 4567`,"settings.homeAddress":`Indirizzo di casa`,"settings.homeAddressPh":`es. Via Roma 1, Milano`,"settings.workAddress":`Indirizzo di lavoro`,"settings.workAddressPh":`es. Via Ufficio 456`,"settings.city":`Città`,"settings.cityPh":`es. Milano`,"settings.country":`Paese`,"settings.countryPh":`es. Italia`,"settings.company":`Azienda`,"settings.companyPh":`es. Acme Srl`,"settings.role":`Ruolo`,"settings.rolePh":`es. Ingegnere Software`,"settings.notes":`Note`,"settings.notesPh":`Qualsiasi altra cosa gli agenti dovrebbero sapere di te`,"settings.saveProfile":`Salva Profilo`,"settings.nhaFreeTitle":`NHA Free (Liara)`,"settings.nhaFreeSub":`Powered by Qwen3 32B. Gratis, nessuna API key necessaria. Più lento (5–15s).`,"settings.useLiara":`Usa NHA Free`,"settings.liaraActivated":`✓ Liara attivata`,"settings.llmProvider":`Provider LLM`,"settings.llmProviderSub":`Oppure usa la tua API key per risposte più veloci.`,"settings.provider":`Provider`,"settings.apiKey":`API Key`,"settings.apiKeyPh":`Incolla qui la tua API key`,"settings.apiKeyFreeNote":`Non necessaria per NHA Free`,"settings.apiKeySet":`✓ API key configurata — inserisci una nuova per cambiarla`,"settings.model":`Modello`,"settings.modelPh":`Lascia vuoto per il default`,"settings.thinking":`Ragionamento Esteso`,"settings.thinkingOff":`Off — risposte più veloci`,"settings.thinkingOn":`On — ragionamento esteso (solo NHA Free)`,"settings.saveProvider":`Salva Provider`,"settings.language":`Lingua`,"settings.languageLabel":`Lingua usata da tutti gli agenti e Studio`,"settings.telegram":`Bot Telegram e Discord`,"settings.telegramSub":`Risposta automatica ai messaggi Telegram e Discord.`,"settings.telegramToken":`Token Bot Telegram`,"settings.telegramPh":`Ottienilo da @BotFather`,"settings.telegramSet":`••••••• (impostato — inserisci nuovo per cambiare)`,"settings.discordToken":`Token Bot Discord`,"settings.discordPh":`Dal Discord Developer Portal`,"settings.discordSet":`••••••• (impostato — inserisci nuovo per cambiare)`,"settings.saveBots":`Salva Bot`,"settings.dailyOps":`Operazioni Giornaliere`,"settings.planTime":`Orario Piano Giornaliero`,"settings.summaryTime":`Orario Riepilogo`,"settings.meetingAlert":`Avviso Riunione (minuti)`,"settings.saveSchedule":`Salva Orari`,"settings.googleAccount":`Account Google`,"settings.googleSub":`Connetti Gmail, Calendar, Drive, Contatti e Task.`,"settings.connectGoogle":`Connetti Google`,"settings.reconnectGoogle":`Riconnetti Google`,"settings.disconnectGoogle":`Disconnetti Google`,"settings.imapAccounts":`Account Email (IMAP/SMTP)`,"settings.imapSub":`IMAP è in sola lettura — le email non vengono mai cancellate dal server.`,"settings.addAccount":`+ Aggiungi Account`,"settings.noImapAccounts":`Nessun account IMAP configurato.`,"settings.editImapAccount":`Modifica Account IMAP`,"settings.addImapAccount":`Aggiungi Account IMAP`,"settings.displayName":`Nome visualizzato`,"settings.displayNamePh":`es. Email Lavoro`,"settings.fromName":`Nome mittente`,"settings.fromNamePh":`es. Mario Rossi`,"settings.imapServer":`Server IMAP`,"settings.imapPort":`Porta IMAP`,"settings.smtpServer":`Server SMTP`,"settings.smtpPort":`Porta SMTP`,"settings.username":`Username`,"settings.password":`Password`,"settings.passwordKeep":`(lascia vuoto per mantenere quella esistente)`,"settings.passwordPh":`Password app o password IMAP`,"settings.show":`Mostra`,"settings.hide":`Nascondi`,"settings.sync":`Sincronizza`,"settings.imapDelete":`Eliminare l'account "{name}"? Tutte le email locali verranno rimosse.`,"settings.disconnectGoogleConfirm":`Disconnettere l'account Google?`,"settings.googleOpened":`Pagina di accesso aperta. Completa il login e ricarica NHA.`,"settings.googleOpening":`Apertura Google sign-in…`},es:{"common.save":`Guardar`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Cancelar`,"common.delete":`Eliminar`,"common.edit":`Editar`,"common.add":`Agregar`,"common.loading":`Cargando…`,"common.comingSoon":`Próximamente`,"common.error":`Error`,"common.retry":`Reintentar`,"common.send":`Enviar`,"common.close":`Cerrar`,"common.confirm":`Confirmar`,"common.back":`Atrás`,"common.search":`Buscar…`,"common.refresh":`Actualizar`,"common.copy":`Copiar`,"common.copied":`¡Copiado!`,"common.open":`Abrir`,"common.download":`Descargar`,"common.upload":`Subir`,"common.sync":`Sincronizar`,"common.syncing":`Sincronizando…`,"common.connected":`Conectado`,"common.disconnected":`Desconectado`,"common.connect":`Conectar`,"common.disconnect":`Desconectar`,"common.enable":`Habilitar`,"common.disable":`Deshabilitar`,"common.yes":`Sí`,"common.no":`No`,"common.none":`Ninguno`,"common.all":`Todos`,"common.new":`Nuevo`,"common.create":`Crear`,"common.update":`Actualizar`,"common.remove":`Quitar`,"common.clear":`Limpiar`,"common.select":`Seleccionar`,"common.optional":`opcional`,"common.required":`requerido`,"common.noData":`Sin datos`,"common.empty":`Vacío`,"common.today":`Hoy`,"common.yesterday":`Ayer`,"common.tomorrow":`Mañana`,"common.status":`Estado`,"common.name":`Nombre`,"common.email":`Correo`,"common.phone":`Teléfono`,"common.date":`Fecha`,"common.time":`Hora`,"common.title":`Título`,"common.description":`Descripción`,"common.notes":`Notas`,"common.tags":`Etiquetas`,"common.type":`Tipo`,"common.size":`Tamaño`,"common.unknown":`Desconocido`,"common.actions":`Acciones`,"common.preview":`Vista previa`,"common.settings":`Configuración`,"common.version":`Versión`,"sidebar.panoramica":`Resumen`,"sidebar.google":`Google`,"sidebar.microsoft":`Microsoft`,"sidebar.integrazioni":`Integraciones`,"sidebar.ai":`IA`,"sidebar.config":`Config`,"nav.dashboard":`Panel`,"nav.chat":`Chat`,"nav.plan":`Plan diario`,"nav.tasks":`Tareas`,"nav.email":`Correo`,"nav.calendar":`Calendario`,"nav.drive":`Drive`,"nav.contacts":`Contactos`,"nav.notes":`Notas`,"nav.onedrive":`OneDrive`,"nav.mstodo":`MS Todo`,"nav.github":`GitHub`,"nav.notion":`Notion`,"nav.slack":`Slack`,"nav.maps":`Mapas`,"nav.reminders":`Recordatorios`,"nav.birthdays":`Cumpleaños`,"nav.cron":`Cron`,"nav.screen":`Pantalla`,"nav.agents":`Agentes`,"nav.studio":`Studio`,"nav.webcraft":`WebCraft`,"nav.collab":`Alexandria`,"nav.connectors":`AWF - AutoWorkFlow`,"nav.settings":`Configuración`,"chat.placeholder":`Escribe a NHA…`,"chat.thinking":`Pensando…`,"chat.newChat":`Nueva conversación`,"chat.conversations":`Conversaciones`,"chat.noConversations":`Sin conversaciones`,"chat.attachFile":`Adjuntar archivo`,"chat.voice":`Entrada de voz`,"chat.toolsUsed":`Herramientas usadas`,"chat.errorSending":`Error al enviar el mensaje`,"dashboard.title":`Panel`,"dashboard.goodMorning":`Buenos días`,"dashboard.goodAfternoon":`Buenas tardes`,"dashboard.goodEvening":`Buenas noches`,"dashboard.todayPlan":`Plan de hoy`,"dashboard.upcomingEvents":`Próximos eventos`,"dashboard.unreadEmails":`Correos no leídos`,"dashboard.pendingTasks":`Tareas pendientes`,"dashboard.noEvents":`Sin eventos hoy`,"dashboard.noEmails":`Sin correos no leídos`,"dashboard.noTasks":`Sin tareas pendientes`,"email.inbox":`Bandeja de entrada`,"email.sent":`Enviados`,"email.drafts":`Borradores`,"email.compose":`Redactar`,"email.reply":`Responder`,"email.forward":`Reenviar`,"email.noEmails":`Sin correos`,"email.from":`De`,"email.to":`Para`,"email.subject":`Asunto`,"email.search":`Buscar correos…`,"calendar.title":`Calendario`,"calendar.newEvent":`Nuevo evento`,"calendar.today":`Hoy`,"calendar.noEvents":`Sin eventos`,"tasks.title":`Tareas`,"tasks.newTask":`Nueva tarea`,"tasks.completed":`Completadas`,"tasks.pending":`Pendientes`,"tasks.overdue":`Vencidas`,"tasks.noTasks":`Sin tareas`,"tasks.priority.high":`Alta`,"tasks.priority.medium":`Media`,"tasks.priority.low":`Baja`,"contacts.title":`Contactos`,"contacts.newContact":`Nuevo contacto`,"contacts.noContacts":`Sin contactos`,"contacts.search":`Buscar contactos…`,"notes.title":`Notas`,"notes.newNote":`Nueva nota`,"notes.noNotes":`Sin notas`,"drive.title":`Drive`,"drive.noFiles":`Sin archivos`,"drive.search":`Buscar archivos…`,"mstodo.title":`MS To Do`,"mstodo.noTasks":`Sin tareas`,"mstodo.newTask":`Nueva tarea`,"mstodo.addPlaceholder":`Agregar una nueva tarea…`,"mstodo.add":`+ Agregar`,"mstodo.noActive":`Sin tareas activas`,"mstodo.due":`Vence`,"github.title":`GitHub`,"github.repos":`Repositorios`,"github.issues":`Issues`,"github.prs":`Pull Requests`,"slack.title":`Slack`,"slack.channels":`Canales`,"agents.title":`Agentes`,"agents.noAgents":`Sin agentes`,"agents.orchestrator":`Orquestador`,"agents.orchestratorPlaceholder":`Enviar a todos los agentes…`,"agents.orchestratorSend":`Enviar a todos`,"agents.orchestratorSynthesis":`Síntesis Conductor`,"agents.typeMessage":`Escribe un mensaje…`,"agents.working":`trabajando`,"studio.title":`Studio`,"studio.task":`Tarea`,"studio.run":`Iniciar deliberación`,"studio.running":`Deliberando…`,"studio.result":`Resultado`,"studio.log":`Registro`,"studio.export":`Exportar`,"studio.parliamentPrompt":`¿Activar análisis del Parlamento?`,"studio.parliamentActivate":`Activar`,"studio.parliamentSkip":`Omitir`,"connectors.title":`Conectores`,"connectors.nodePalette":`Paleta de nodos`,"connectors.triggers":`Disparadores`,"connectors.actions":`Acciones`,"connectors.ai":`IA`,"connectors.newWorkflow":`Nuevo flujo`,"connectors.noWorkflows":`Sin flujos de trabajo`,"connectors.run":`Ejecutar`,"connectors.save":`Guardar`,"connectors.log":`Registro de ejecución`,"settings.title":`Configuración`,"settings.profile":`Perfil de usuario`,"settings.saveProfile":`Guardar perfil`,"settings.useLiara":`Usar NHA Free`,"settings.liaraActivated":`✓ Liara activada`,"settings.apiKeySet":`✓ API key configurada — introduce una nueva para cambiarla`,"settings.llmProvider":`Proveedor LLM`,"settings.language":`Idioma`,"settings.languageLabel":`Idioma usado por todos los agentes y Studio`,"settings.saveProvider":`Guardar proveedor`,"settings.googleAccount":`Cuenta de Google`,"settings.connectGoogle":`Conectar Google`,"settings.disconnectGoogle":`Desconectar Google`},fr:{"common.save":`Enregistrer`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Annuler`,"common.delete":`Supprimer`,"common.edit":`Modifier`,"common.add":`Ajouter`,"common.loading":`Chargement…`,"common.comingSoon":`Bientôt disponible`,"common.error":`Erreur`,"common.retry":`Réessayer`,"common.send":`Envoyer`,"common.close":`Fermer`,"common.confirm":`Confirmer`,"common.back":`Retour`,"common.search":`Rechercher…`,"common.refresh":`Actualiser`,"common.copy":`Copier`,"common.copied":`Copié !`,"common.open":`Ouvrir`,"common.download":`Télécharger`,"common.upload":`Téléverser`,"common.sync":`Synchroniser`,"common.syncing":`Synchronisation…`,"common.connected":`Connecté`,"common.disconnected":`Déconnecté`,"common.connect":`Connecter`,"common.disconnect":`Déconnecter`,"common.enable":`Activer`,"common.disable":`Désactiver`,"common.yes":`Oui`,"common.no":`Non`,"common.none":`Aucun`,"common.all":`Tout`,"common.new":`Nouveau`,"common.create":`Créer`,"common.update":`Mettre à jour`,"common.remove":`Supprimer`,"common.clear":`Effacer`,"common.select":`Sélectionner`,"common.optional":`optionnel`,"common.required":`requis`,"common.noData":`Aucune donnée`,"common.empty":`Vide`,"common.today":`Aujourd'hui`,"common.yesterday":`Hier`,"common.tomorrow":`Demain`,"common.status":`Statut`,"common.name":`Nom`,"common.email":`E-mail`,"common.phone":`Téléphone`,"common.date":`Date`,"common.time":`Heure`,"common.title":`Titre`,"common.description":`Description`,"common.notes":`Notes`,"common.tags":`Étiquettes`,"common.type":`Type`,"common.size":`Taille`,"common.unknown":`Inconnu`,"common.actions":`Actions`,"common.preview":`Aperçu`,"common.settings":`Paramètres`,"common.version":`Version`,"sidebar.panoramica":`Vue d'ensemble`,"sidebar.google":`Google`,"sidebar.microsoft":`Microsoft`,"sidebar.integrazioni":`Intégrations`,"sidebar.ai":`IA`,"sidebar.config":`Config`,"nav.dashboard":`Tableau de bord`,"nav.chat":`Chat`,"nav.plan":`Plan quotidien`,"nav.tasks":`Tâches`,"nav.email":`E-mail`,"nav.calendar":`Calendrier`,"nav.drive":`Drive`,"nav.contacts":`Contacts`,"nav.notes":`Notes`,"nav.onedrive":`OneDrive`,"nav.mstodo":`MS Todo`,"nav.github":`GitHub`,"nav.notion":`Notion`,"nav.slack":`Slack`,"nav.maps":`Cartes`,"nav.reminders":`Rappels`,"nav.birthdays":`Anniversaires`,"nav.cron":`Cron`,"nav.screen":`Écran`,"nav.agents":`Agents`,"nav.studio":`Studio`,"nav.webcraft":`WebCraft`,"nav.collab":`Alexandria`,"nav.connectors":`AWF - AutoWorkFlow`,"nav.settings":`Paramètres`,"chat.placeholder":`Écrivez à NHA…`,"chat.thinking":`Réflexion…`,"chat.newChat":`Nouvelle conversation`,"chat.conversations":`Conversations`,"chat.noConversations":`Aucune conversation`,"chat.attachFile":`Joindre un fichier`,"chat.voice":`Saisie vocale`,"chat.toolsUsed":`Outils utilisés`,"chat.errorSending":`Erreur lors de l'envoi du message`,"dashboard.title":`Tableau de bord`,"dashboard.goodMorning":`Bonjour`,"dashboard.goodAfternoon":`Bon après-midi`,"dashboard.goodEvening":`Bonsoir`,"dashboard.todayPlan":`Plan d'aujourd'hui`,"dashboard.upcomingEvents":`Événements à venir`,"dashboard.unreadEmails":`E-mails non lus`,"dashboard.pendingTasks":`Tâches en attente`,"dashboard.noEvents":`Aucun événement aujourd'hui`,"dashboard.noEmails":`Aucun e-mail non lu`,"dashboard.noTasks":`Aucune tâche en attente`,"email.inbox":`Boîte de réception`,"email.sent":`Envoyés`,"email.drafts":`Brouillons`,"email.compose":`Rédiger`,"email.reply":`Répondre`,"email.forward":`Transférer`,"email.noEmails":`Aucun e-mail`,"email.from":`De`,"email.to":`À`,"email.subject":`Objet`,"email.search":`Rechercher des e-mails…`,"calendar.title":`Calendrier`,"calendar.newEvent":`Nouvel événement`,"calendar.today":`Aujourd'hui`,"calendar.noEvents":`Aucun événement`,"tasks.title":`Tâches`,"tasks.newTask":`Nouvelle tâche`,"tasks.completed":`Terminées`,"tasks.pending":`En attente`,"tasks.overdue":`En retard`,"tasks.noTasks":`Aucune tâche`,"tasks.priority.high":`Haute`,"tasks.priority.medium":`Moyenne`,"tasks.priority.low":`Faible`,"contacts.title":`Contacts`,"contacts.newContact":`Nouveau contact`,"contacts.noContacts":`Aucun contact`,"contacts.search":`Rechercher des contacts…`,"notes.title":`Notes`,"notes.newNote":`Nouvelle note`,"notes.noNotes":`Aucune note`,"drive.title":`Drive`,"drive.noFiles":`Aucun fichier`,"drive.search":`Rechercher des fichiers…`,"mstodo.title":`MS To Do`,"mstodo.noTasks":`Aucune tâche`,"mstodo.newTask":`Nouvelle tâche`,"mstodo.addPlaceholder":`Ajouter une nouvelle tâche…`,"mstodo.add":`+ Ajouter`,"mstodo.noActive":`Aucune tâche active`,"mstodo.due":`Échéance`,"github.title":`GitHub`,"github.repos":`Référentiels`,"github.issues":`Issues`,"github.prs":`Pull Requests`,"slack.title":`Slack`,"slack.channels":`Canaux`,"agents.title":`Agents`,"agents.noAgents":`Aucun agent`,"agents.orchestrator":`Orchestrateur`,"agents.orchestratorPlaceholder":`Envoyer à tous les agents…`,"agents.orchestratorSend":`Envoyer à tous`,"agents.orchestratorSynthesis":`Synthèse Conductor`,"agents.typeMessage":`Saisir un message…`,"agents.working":`en cours`,"studio.title":`Studio`,"studio.task":`Tâche`,"studio.run":`Démarrer la délibération`,"studio.running":`Délibération…`,"studio.result":`Résultat`,"studio.log":`Journal`,"studio.export":`Exporter`,"studio.parliamentPrompt":`Activer l'analyse du Parlement ?`,"studio.parliamentActivate":`Activer`,"studio.parliamentSkip":`Ignorer`,"connectors.title":`Connecteurs`,"connectors.nodePalette":`Palette de nœuds`,"connectors.triggers":`Déclencheurs`,"connectors.actions":`Actions`,"connectors.ai":`IA`,"connectors.newWorkflow":`Nouveau flux`,"connectors.noWorkflows":`Aucun flux de travail`,"connectors.run":`Exécuter`,"connectors.save":`Enregistrer`,"connectors.log":`Journal d'exécution`,"settings.title":`Paramètres`,"settings.profile":`Profil utilisateur`,"settings.saveProfile":`Enregistrer le profil`,"settings.useLiara":`Utiliser NHA Free`,"settings.liaraActivated":`✓ Liara activée`,"settings.apiKeySet":`✓ Clé API configurée — saisissez-en une nouvelle pour la modifier`,"settings.llmProvider":`Fournisseur LLM`,"settings.language":`Langue`,"settings.languageLabel":`Langue utilisée par tous les agents et Studio`,"settings.saveProvider":`Enregistrer le fournisseur`,"settings.googleAccount":`Compte Google`,"settings.connectGoogle":`Connecter Google`,"settings.disconnectGoogle":`Déconnecter Google`},de:{"common.save":`Speichern`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Abbrechen`,"common.delete":`Löschen`,"common.edit":`Bearbeiten`,"common.add":`Hinzufügen`,"common.loading":`Laden…`,"common.comingSoon":`Demnächst`,"common.error":`Fehler`,"common.retry":`Erneut versuchen`,"common.send":`Senden`,"common.close":`Schließen`,"common.confirm":`Bestätigen`,"common.back":`Zurück`,"common.search":`Suchen…`,"common.refresh":`Aktualisieren`,"common.copy":`Kopieren`,"common.copied":`Kopiert!`,"common.open":`Öffnen`,"common.download":`Herunterladen`,"common.upload":`Hochladen`,"common.sync":`Synchronisieren`,"common.syncing":`Synchronisierung…`,"common.connected":`Verbunden`,"common.disconnected":`Getrennt`,"common.connect":`Verbinden`,"common.disconnect":`Trennen`,"common.enable":`Aktivieren`,"common.disable":`Deaktivieren`,"common.yes":`Ja`,"common.no":`Nein`,"common.none":`Keiner`,"common.all":`Alle`,"common.new":`Neu`,"common.create":`Erstellen`,"common.update":`Aktualisieren`,"common.remove":`Entfernen`,"common.clear":`Löschen`,"common.select":`Auswählen`,"common.optional":`optional`,"common.required":`erforderlich`,"common.noData":`Keine Daten`,"common.empty":`Leer`,"common.today":`Heute`,"common.yesterday":`Gestern`,"common.tomorrow":`Morgen`,"common.status":`Status`,"common.name":`Name`,"common.email":`E-Mail`,"common.phone":`Telefon`,"common.date":`Datum`,"common.time":`Uhrzeit`,"common.title":`Titel`,"common.description":`Beschreibung`,"common.notes":`Notizen`,"common.tags":`Tags`,"common.type":`Typ`,"common.size":`Größe`,"common.unknown":`Unbekannt`,"common.actions":`Aktionen`,"common.preview":`Vorschau`,"common.settings":`Einstellungen`,"common.version":`Version`,"sidebar.panoramica":`Übersicht`,"sidebar.google":`Google`,"sidebar.microsoft":`Microsoft`,"sidebar.integrazioni":`Integrationen`,"sidebar.ai":`KI`,"sidebar.config":`Konfiguration`,"nav.dashboard":`Dashboard`,"nav.chat":`Chat`,"nav.plan":`Tagesplan`,"nav.tasks":`Aufgaben`,"nav.email":`E-Mail`,"nav.calendar":`Kalender`,"nav.drive":`Drive`,"nav.contacts":`Kontakte`,"nav.notes":`Notizen`,"nav.onedrive":`OneDrive`,"nav.mstodo":`MS Todo`,"nav.github":`GitHub`,"nav.notion":`Notion`,"nav.slack":`Slack`,"nav.maps":`Karten`,"nav.reminders":`Erinnerungen`,"nav.birthdays":`Geburtstage`,"nav.cron":`Cron`,"nav.screen":`Bildschirm`,"nav.agents":`Agenten`,"nav.studio":`Studio`,"nav.webcraft":`WebCraft`,"nav.collab":`Alexandria`,"nav.connectors":`AWF - AutoWorkFlow`,"nav.settings":`Einstellungen`,"chat.placeholder":`Nachricht an NHA…`,"chat.thinking":`Denke nach…`,"chat.newChat":`Neues Gespräch`,"chat.conversations":`Gespräche`,"chat.noConversations":`Keine Gespräche`,"chat.attachFile":`Datei anhängen`,"chat.voice":`Spracheingabe`,"chat.toolsUsed":`Verwendete Werkzeuge`,"chat.errorSending":`Fehler beim Senden der Nachricht`,"dashboard.title":`Dashboard`,"dashboard.goodMorning":`Guten Morgen`,"dashboard.goodAfternoon":`Guten Nachmittag`,"dashboard.goodEvening":`Guten Abend`,"dashboard.todayPlan":`Heutiger Plan`,"dashboard.upcomingEvents":`Bevorstehende Ereignisse`,"dashboard.unreadEmails":`Ungelesene E-Mails`,"dashboard.pendingTasks":`Ausstehende Aufgaben`,"dashboard.noEvents":`Keine Ereignisse heute`,"dashboard.noEmails":`Keine ungelesenen E-Mails`,"dashboard.noTasks":`Keine ausstehenden Aufgaben`,"email.inbox":`Posteingang`,"email.sent":`Gesendet`,"email.drafts":`Entwürfe`,"email.compose":`Verfassen`,"email.reply":`Antworten`,"email.forward":`Weiterleiten`,"email.noEmails":`Keine E-Mails`,"email.from":`Von`,"email.to":`An`,"email.subject":`Betreff`,"email.search":`E-Mails suchen…`,"calendar.title":`Kalender`,"calendar.newEvent":`Neues Ereignis`,"calendar.today":`Heute`,"calendar.noEvents":`Keine Ereignisse`,"tasks.title":`Aufgaben`,"tasks.newTask":`Neue Aufgabe`,"tasks.completed":`Erledigt`,"tasks.pending":`Ausstehend`,"tasks.overdue":`Überfällig`,"tasks.noTasks":`Keine Aufgaben`,"tasks.priority.high":`Hoch`,"tasks.priority.medium":`Mittel`,"tasks.priority.low":`Niedrig`,"contacts.title":`Kontakte`,"contacts.newContact":`Neuer Kontakt`,"contacts.noContacts":`Keine Kontakte`,"contacts.search":`Kontakte suchen…`,"notes.title":`Notizen`,"notes.newNote":`Neue Notiz`,"notes.noNotes":`Keine Notizen`,"drive.title":`Drive`,"drive.noFiles":`Keine Dateien`,"drive.search":`Dateien suchen…`,"mstodo.title":`MS To Do`,"mstodo.noTasks":`Keine Aufgaben`,"mstodo.newTask":`Neue Aufgabe`,"mstodo.addPlaceholder":`Neue Aufgabe hinzufügen…`,"mstodo.add":`+ Hinzufügen`,"mstodo.noActive":`Keine aktiven Aufgaben`,"mstodo.due":`Fällig`,"github.title":`GitHub`,"github.repos":`Repositories`,"github.issues":`Issues`,"github.prs":`Pull Requests`,"slack.title":`Slack`,"slack.channels":`Kanäle`,"agents.title":`Agenten`,"agents.noAgents":`Keine Agenten`,"agents.orchestrator":`Orchestrator`,"agents.orchestratorPlaceholder":`An alle Agenten senden…`,"agents.orchestratorSend":`An alle senden`,"agents.orchestratorSynthesis":`Conductor-Synthese`,"agents.typeMessage":`Nachricht eingeben…`,"agents.working":`arbeitet`,"studio.title":`Studio`,"studio.task":`Aufgabe`,"studio.run":`Deliberation starten`,"studio.running":`Deliberation…`,"studio.result":`Ergebnis`,"studio.log":`Protokoll`,"studio.export":`Exportieren`,"studio.parliamentPrompt":`Parlament-Analyse aktivieren?`,"studio.parliamentActivate":`Aktivieren`,"studio.parliamentSkip":`Überspringen`,"connectors.title":`Konnektoren`,"connectors.nodePalette":`Knotenpalette`,"connectors.triggers":`Auslöser`,"connectors.actions":`Aktionen`,"connectors.ai":`KI`,"connectors.newWorkflow":`Neuer Workflow`,"connectors.noWorkflows":`Keine Workflows`,"connectors.run":`Ausführen`,"connectors.save":`Speichern`,"connectors.log":`Ausführungsprotokoll`,"settings.title":`Einstellungen`,"settings.profile":`Benutzerprofil`,"settings.saveProfile":`Profil speichern`,"settings.useLiara":`NHA Free verwenden`,"settings.liaraActivated":`✓ Liara aktiviert`,"settings.apiKeySet":`✓ API-Schlüssel konfiguriert — neuen eingeben zum Ändern`,"settings.llmProvider":`LLM-Anbieter`,"settings.language":`Sprache`,"settings.languageLabel":`Sprache für alle Agenten und Studio`,"settings.saveProvider":`Anbieter speichern`,"settings.googleAccount":`Google-Konto`,"settings.connectGoogle":`Google verbinden`,"settings.disconnectGoogle":`Google trennen`},pt:{"common.save":`Guardar`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Cancelar`,"common.delete":`Eliminar`,"common.edit":`Editar`,"common.add":`Adicionar`,"common.loading":`A carregar…`,"common.comingSoon":`Em breve`,"common.error":`Erro`,"common.retry":`Tentar novamente`,"common.send":`Enviar`,"common.close":`Fechar`,"common.confirm":`Confirmar`,"common.back":`Voltar`,"common.search":`Pesquisar…`,"common.refresh":`Atualizar`,"common.copy":`Copiar`,"common.copied":`Copiado!`,"common.open":`Abrir`,"common.download":`Transferir`,"common.upload":`Carregar`,"common.sync":`Sincronizar`,"common.syncing":`A sincronizar…`,"common.connected":`Ligado`,"common.disconnected":`Desligado`,"common.connect":`Ligar`,"common.disconnect":`Desligar`,"common.yes":`Sim`,"common.no":`Não`,"common.new":`Novo`,"common.noData":`Sem dados`,"common.today":`Hoje`,"common.yesterday":`Ontem`,"common.tomorrow":`Amanhã`,"common.name":`Nome`,"common.email":`E-mail`,"sidebar.panoramica":`Visão geral`,"sidebar.integrazioni":`Integrações`,"sidebar.ai":`IA`,"nav.dashboard":`Painel`,"nav.chat":`Chat`,"nav.plan":`Plano diário`,"nav.tasks":`Tarefas`,"nav.email":`E-mail`,"nav.calendar":`Calendário`,"nav.contacts":`Contactos`,"nav.notes":`Notas`,"nav.agents":`Agentes`,"nav.settings":`Definições`,"chat.placeholder":`Escrever para NHA…`,"chat.thinking":`A pensar…`,"chat.newChat":`Nova conversa`,"email.inbox":`Caixa de entrada`,"email.compose":`Redigir`,"email.noEmails":`Sem e-mails`,"calendar.title":`Calendário`,"calendar.newEvent":`Novo evento`,"calendar.noEvents":`Sem eventos`,"tasks.title":`Tarefas`,"tasks.newTask":`Nova tarefa`,"tasks.noTasks":`Sem tarefas`,"contacts.title":`Contactos`,"contacts.noContacts":`Sem contactos`,"mstodo.addPlaceholder":`Adicionar uma nova tarefa…`,"mstodo.add":`+ Adicionar`,"mstodo.noActive":`Sem tarefas ativas`,"agents.title":`Agentes`,"agents.noAgents":`Sem agentes`,"agents.orchestrator":`Orquestrador`,"agents.orchestratorSend":`Enviar a todos`,"studio.title":`Studio`,"studio.run":`Iniciar deliberação`,"studio.running":`A deliberar…`,"connectors.title":`Conectores`,"connectors.nodePalette":`Paleta de nós`,"connectors.triggers":`Gatilhos`,"connectors.newWorkflow":`Novo fluxo`,"settings.title":`Definições`,"settings.profile":`Perfil do utilizador`,"settings.language":`Idioma`,"settings.useLiara":`Usar NHA Free`,"settings.liaraActivated":`✓ Liara ativada`,"settings.apiKeySet":`✓ Chave API configurada — insira uma nova para alterar`,"settings.saveProfile":`Guardar perfil`,"settings.googleAccount":`Conta Google`,"settings.connectGoogle":`Ligar Google`},nl:{"common.save":`Opslaan`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Annuleren`,"common.delete":`Verwijderen`,"common.edit":`Bewerken`,"common.add":`Toevoegen`,"common.loading":`Laden…`,"common.comingSoon":`Binnenkort`,"common.error":`Fout`,"common.retry":`Opnieuw proberen`,"common.send":`Verzenden`,"common.close":`Sluiten`,"common.confirm":`Bevestigen`,"common.back":`Terug`,"common.search":`Zoeken…`,"common.refresh":`Vernieuwen`,"common.copy":`Kopiëren`,"common.copied":`Gekopieerd!`,"common.open":`Openen`,"common.download":`Downloaden`,"common.connect":`Verbinden`,"common.disconnect":`Verbreken`,"common.yes":`Ja`,"common.no":`Nee`,"common.new":`Nieuw`,"common.noData":`Geen gegevens`,"common.today":`Vandaag`,"common.yesterday":`Gisteren`,"common.tomorrow":`Morgen`,"common.name":`Naam`,"common.email":`E-mail`,"sidebar.panoramica":`Overzicht`,"sidebar.integrazioni":`Integraties`,"sidebar.ai":`AI`,"nav.dashboard":`Dashboard`,"nav.chat":`Chat`,"nav.plan":`Dagplan`,"nav.tasks":`Taken`,"nav.email":`E-mail`,"nav.calendar":`Agenda`,"nav.contacts":`Contacten`,"nav.agents":`Agenten`,"nav.settings":`Instellingen`,"chat.placeholder":`Bericht aan NHA…`,"chat.thinking":`Aan het denken…`,"chat.newChat":`Nieuwe chat`,"email.inbox":`Postvak IN`,"email.compose":`Opstellen`,"email.noEmails":`Geen e-mails`,"calendar.title":`Agenda`,"calendar.newEvent":`Nieuw evenement`,"calendar.noEvents":`Geen evenementen`,"tasks.title":`Taken`,"tasks.newTask":`Nieuwe taak`,"tasks.noTasks":`Geen taken`,"contacts.title":`Contacten`,"contacts.noContacts":`Geen contacten`,"agents.title":`Agenten`,"agents.noAgents":`Geen agenten`,"agents.orchestrator":`Orchestrator`,"agents.orchestratorSend":`Stuur naar iedereen`,"studio.title":`Studio`,"studio.run":`Beraadslaging starten`,"studio.running":`Beraadslaging…`,"connectors.title":`Connectoren`,"connectors.nodePalette":`Knooppuntenpalet`,"connectors.triggers":`Triggers`,"connectors.newWorkflow":`Nieuwe workflow`,"settings.title":`Instellingen`,"settings.language":`Taal`,"settings.useLiara":`NHA Free gebruiken`,"settings.liaraActivated":`✓ Liara geactiveerd`,"settings.apiKeySet":`✓ API-sleutel geconfigureerd — voer een nieuwe in om te wijzigen`,"settings.saveProfile":`Profiel opslaan`,"settings.googleAccount":`Google-account`,"settings.connectGoogle":`Google verbinden`},pl:{"common.save":`Zapisz`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Anuluj`,"common.delete":`Usuń`,"common.edit":`Edytuj`,"common.add":`Dodaj`,"common.loading":`Ładowanie…`,"common.error":`Błąd`,"common.retry":`Spróbuj ponownie`,"common.send":`Wyślij`,"common.close":`Zamknij`,"common.confirm":`Potwierdź`,"common.back":`Wstecz`,"common.search":`Szukaj…`,"common.refresh":`Odśwież`,"common.copy":`Kopiuj`,"common.copied":`Skopiowano!`,"common.connect":`Połącz`,"common.disconnect":`Rozłącz`,"common.yes":`Tak`,"common.no":`Nie`,"common.new":`Nowy`,"common.noData":`Brak danych`,"common.today":`Dziś`,"common.name":`Nazwa`,"sidebar.panoramica":`Przegląd`,"sidebar.integrazioni":`Integracje`,"sidebar.ai":`AI`,"nav.dashboard":`Panel`,"nav.chat":`Czat`,"nav.tasks":`Zadania`,"nav.email":`E-mail`,"nav.calendar":`Kalendarz`,"nav.contacts":`Kontakty`,"nav.agents":`Agenci`,"nav.settings":`Ustawienia`,"chat.placeholder":`Wiadomość do NHA…`,"chat.thinking":`Myślę…`,"chat.newChat":`Nowa rozmowa`,"email.inbox":`Skrzynka odbiorcza`,"email.compose":`Napisz`,"email.noEmails":`Brak wiadomości`,"calendar.title":`Kalendarz`,"calendar.newEvent":`Nowe zdarzenie`,"calendar.noEvents":`Brak zdarzeń`,"tasks.title":`Zadania`,"tasks.newTask":`Nowe zadanie`,"tasks.noTasks":`Brak zadań`,"contacts.title":`Kontakty`,"contacts.noContacts":`Brak kontaktów`,"agents.title":`Agenci`,"agents.noAgents":`Brak agentów`,"agents.orchestrator":`Orkiestrator`,"agents.orchestratorSend":`Wyślij do wszystkich`,"studio.title":`Studio`,"studio.run":`Rozpocznij deliberację`,"studio.running":`Deliberacja…`,"connectors.title":`Konektory`,"connectors.triggers":`Wyzwalacze`,"connectors.newWorkflow":`Nowy przepływ`,"settings.title":`Ustawienia`,"settings.language":`Język`,"settings.useLiara":`Użyj NHA Free`,"settings.liaraActivated":`✓ Liara aktywowana`,"settings.apiKeySet":`✓ Klucz API skonfigurowany — wpisz nowy, aby zmienić`,"settings.saveProfile":`Zapisz profil`,"settings.googleAccount":`Konto Google`,"settings.connectGoogle":`Połącz Google`},ru:{"common.save":`Сохранить`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Отмена`,"common.delete":`Удалить`,"common.edit":`Редактировать`,"common.add":`Добавить`,"common.loading":`Загрузка…`,"common.error":`Ошибка`,"common.retry":`Повторить`,"common.send":`Отправить`,"common.close":`Закрыть`,"common.confirm":`Подтвердить`,"common.back":`Назад`,"common.search":`Поиск…`,"common.refresh":`Обновить`,"common.copy":`Копировать`,"common.copied":`Скопировано!`,"common.connect":`Подключить`,"common.disconnect":`Отключить`,"common.yes":`Да`,"common.no":`Нет`,"common.new":`Новый`,"common.noData":`Нет данных`,"common.today":`Сегодня`,"common.name":`Имя`,"sidebar.panoramica":`Обзор`,"sidebar.integrazioni":`Интеграции`,"sidebar.ai":`ИИ`,"nav.dashboard":`Панель`,"nav.chat":`Чат`,"nav.tasks":`Задачи`,"nav.email":`Почта`,"nav.calendar":`Календарь`,"nav.contacts":`Контакты`,"nav.agents":`Агенты`,"nav.settings":`Настройки`,"chat.placeholder":`Сообщение NHA…`,"chat.thinking":`Думаю…`,"chat.newChat":`Новый чат`,"email.inbox":`Входящие`,"email.compose":`Написать`,"email.noEmails":`Нет писем`,"calendar.title":`Календарь`,"calendar.newEvent":`Новое событие`,"calendar.noEvents":`Нет событий`,"tasks.title":`Задачи`,"tasks.newTask":`Новая задача`,"tasks.noTasks":`Нет задач`,"contacts.title":`Контакты`,"contacts.noContacts":`Нет контактов`,"agents.title":`Агенты`,"agents.noAgents":`Нет агентов`,"agents.orchestrator":`Оркестратор`,"agents.orchestratorSend":`Отправить всем`,"studio.title":`Studio`,"studio.run":`Начать обсуждение`,"studio.running":`Обсуждение…`,"connectors.title":`Коннекторы`,"connectors.triggers":`Триггеры`,"connectors.newWorkflow":`Новый сценарий`,"settings.title":`Настройки`,"settings.language":`Язык`,"settings.useLiara":`Использовать NHA Free`,"settings.liaraActivated":`✓ Liara активирована`,"settings.apiKeySet":`✓ API-ключ настроен — введите новый для изменения`,"settings.saveProfile":`Сохранить профиль`,"settings.googleAccount":`Аккаунт Google`,"settings.connectGoogle":`Подключить Google`},zh:{"common.save":`保存`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`取消`,"common.delete":`删除`,"common.edit":`编辑`,"common.add":`添加`,"common.loading":`加载中…`,"common.error":`错误`,"common.retry":`重试`,"common.send":`发送`,"common.close":`关闭`,"common.confirm":`确认`,"common.back":`返回`,"common.search":`搜索…`,"common.refresh":`刷新`,"common.copy":`复制`,"common.copied":`已复制!`,"common.connect":`连接`,"common.disconnect":`断开`,"common.yes":`是`,"common.no":`否`,"common.new":`新建`,"common.noData":`无数据`,"common.today":`今天`,"common.name":`名称`,"sidebar.panoramica":`概览`,"sidebar.integrazioni":`集成`,"sidebar.ai":`AI`,"nav.dashboard":`仪表板`,"nav.chat":`聊天`,"nav.tasks":`任务`,"nav.email":`邮件`,"nav.calendar":`日历`,"nav.contacts":`联系人`,"nav.agents":`智能体`,"nav.settings":`设置`,"chat.placeholder":`发送消息给 NHA…`,"chat.thinking":`思考中…`,"chat.newChat":`新对话`,"email.inbox":`收件箱`,"email.compose":`撰写`,"email.noEmails":`无邮件`,"calendar.title":`日历`,"calendar.newEvent":`新建事件`,"calendar.noEvents":`无事件`,"tasks.title":`任务`,"tasks.newTask":`新建任务`,"tasks.noTasks":`无任务`,"contacts.title":`联系人`,"contacts.noContacts":`无联系人`,"agents.title":`智能体`,"agents.noAgents":`无智能体`,"agents.orchestrator":`协调器`,"agents.orchestratorSend":`发送给所有`,"studio.title":`Studio`,"studio.run":`开始协商`,"studio.running":`协商中…`,"connectors.title":`连接器`,"connectors.triggers":`触发器`,"connectors.newWorkflow":`新工作流`,"settings.title":`设置`,"settings.language":`语言`,"settings.useLiara":`使用 NHA Free`,"settings.liaraActivated":`✓ Liara 已激活`,"settings.apiKeySet":`✓ API 密钥已配置 — 输入新密钥以更改`,"settings.saveProfile":`保存配置`,"settings.googleAccount":`Google 账户`,"settings.connectGoogle":`连接 Google`},ja:{"common.save":`保存`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`キャンセル`,"common.delete":`削除`,"common.edit":`編集`,"common.add":`追加`,"common.loading":`読み込み中…`,"common.error":`エラー`,"common.retry":`再試行`,"common.send":`送信`,"common.close":`閉じる`,"common.confirm":`確認`,"common.back":`戻る`,"common.search":`検索…`,"common.refresh":`更新`,"common.copy":`コピー`,"common.copied":`コピーしました!`,"common.connect":`接続`,"common.disconnect":`切断`,"common.yes":`はい`,"common.no":`いいえ`,"common.new":`新規`,"common.noData":`データなし`,"common.today":`今日`,"common.name":`名前`,"sidebar.panoramica":`概要`,"sidebar.integrazioni":`統合`,"sidebar.ai":`AI`,"nav.dashboard":`ダッシュボード`,"nav.chat":`チャット`,"nav.tasks":`タスク`,"nav.email":`メール`,"nav.calendar":`カレンダー`,"nav.contacts":`連絡先`,"nav.agents":`エージェント`,"nav.settings":`設定`,"chat.placeholder":`NHA へメッセージ…`,"chat.thinking":`考え中…`,"chat.newChat":`新しい会話`,"email.inbox":`受信トレイ`,"email.compose":`作成`,"email.noEmails":`メールなし`,"calendar.title":`カレンダー`,"calendar.newEvent":`新しいイベント`,"calendar.noEvents":`イベントなし`,"tasks.title":`タスク`,"tasks.newTask":`新しいタスク`,"tasks.noTasks":`タスクなし`,"contacts.title":`連絡先`,"contacts.noContacts":`連絡先なし`,"agents.title":`エージェント`,"agents.noAgents":`エージェントなし`,"agents.orchestrator":`オーケストレーター`,"agents.orchestratorSend":`全員に送信`,"studio.title":`Studio`,"studio.run":`討議を開始`,"studio.running":`討議中…`,"connectors.title":`コネクター`,"connectors.triggers":`トリガー`,"connectors.newWorkflow":`新しいワークフロー`,"settings.title":`設定`,"settings.language":`言語`,"settings.useLiara":`NHA Free を使用`,"settings.liaraActivated":`✓ Liara が有効になりました`,"settings.apiKeySet":`✓ API キーが設定済み — 変更するには新しいキーを入力してください`,"settings.saveProfile":`プロフィールを保存`,"settings.googleAccount":`Google アカウント`,"settings.connectGoogle":`Google を接続`},ko:{"common.save":`저장`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`취소`,"common.delete":`삭제`,"common.edit":`편집`,"common.add":`추가`,"common.loading":`로딩 중…`,"common.error":`오류`,"common.retry":`다시 시도`,"common.send":`전송`,"common.close":`닫기`,"common.confirm":`확인`,"common.back":`뒤로`,"common.search":`검색…`,"common.refresh":`새로고침`,"common.copy":`복사`,"common.copied":`복사됨!`,"common.connect":`연결`,"common.disconnect":`연결 해제`,"common.yes":`예`,"common.no":`아니요`,"common.new":`새로 만들기`,"common.noData":`데이터 없음`,"common.today":`오늘`,"common.name":`이름`,"sidebar.panoramica":`개요`,"sidebar.integrazioni":`통합`,"sidebar.ai":`AI`,"nav.dashboard":`대시보드`,"nav.chat":`채팅`,"nav.tasks":`작업`,"nav.email":`이메일`,"nav.calendar":`캘린더`,"nav.contacts":`연락처`,"nav.agents":`에이전트`,"nav.settings":`설정`,"chat.placeholder":`NHA에게 메시지…`,"chat.thinking":`생각 중…`,"chat.newChat":`새 대화`,"email.inbox":`받은편지함`,"email.compose":`작성`,"email.noEmails":`이메일 없음`,"calendar.title":`캘린더`,"calendar.newEvent":`새 이벤트`,"calendar.noEvents":`이벤트 없음`,"tasks.title":`작업`,"tasks.newTask":`새 작업`,"tasks.noTasks":`작업 없음`,"contacts.title":`연락처`,"contacts.noContacts":`연락처 없음`,"agents.title":`에이전트`,"agents.noAgents":`에이전트 없음`,"agents.orchestrator":`오케스트레이터`,"agents.orchestratorSend":`전체에게 전송`,"studio.title":`Studio`,"studio.run":`토론 시작`,"studio.running":`토론 중…`,"connectors.title":`커넥터`,"connectors.triggers":`트리거`,"connectors.newWorkflow":`새 워크플로`,"settings.title":`설정`,"settings.language":`언어`,"settings.useLiara":`NHA Free 사용`,"settings.liaraActivated":`✓ Liara 활성화됨`,"settings.apiKeySet":`✓ API 키 설정됨 — 변경하려면 새 키를 입력하세요`,"settings.saveProfile":`프로필 저장`,"settings.googleAccount":`Google 계정`,"settings.connectGoogle":`Google 연결`},ar:{"common.save":`حفظ`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`إلغاء`,"common.delete":`حذف`,"common.edit":`تعديل`,"common.add":`إضافة`,"common.loading":`جارٍ التحميل…`,"common.error":`خطأ`,"common.retry":`إعادة المحاولة`,"common.send":`إرسال`,"common.close":`إغلاق`,"common.confirm":`تأكيد`,"common.back":`رجوع`,"common.search":`بحث…`,"common.refresh":`تحديث`,"common.copy":`نسخ`,"common.copied":`تم النسخ!`,"common.connect":`اتصال`,"common.disconnect":`قطع الاتصال`,"common.yes":`نعم`,"common.no":`لا`,"common.new":`جديد`,"common.noData":`لا بيانات`,"common.today":`اليوم`,"common.name":`الاسم`,"sidebar.panoramica":`نظرة عامة`,"sidebar.integrazioni":`التكاملات`,"sidebar.ai":`الذكاء الاصطناعي`,"nav.dashboard":`لوحة التحكم`,"nav.chat":`المحادثة`,"nav.tasks":`المهام`,"nav.email":`البريد`,"nav.calendar":`التقويم`,"nav.contacts":`جهات الاتصال`,"nav.agents":`الوكلاء`,"nav.settings":`الإعدادات`,"chat.placeholder":`اكتب لـ NHA…`,"chat.thinking":`أفكر…`,"chat.newChat":`محادثة جديدة`,"email.inbox":`البريد الوارد`,"email.compose":`إنشاء`,"email.noEmails":`لا رسائل`,"calendar.title":`التقويم`,"calendar.newEvent":`حدث جديد`,"calendar.noEvents":`لا أحداث`,"tasks.title":`المهام`,"tasks.newTask":`مهمة جديدة`,"tasks.noTasks":`لا مهام`,"contacts.title":`جهات الاتصال`,"contacts.noContacts":`لا جهات اتصال`,"agents.title":`الوكلاء`,"agents.noAgents":`لا وكلاء`,"agents.orchestrator":`المنسق`,"agents.orchestratorSend":`إرسال للجميع`,"studio.title":`Studio`,"studio.run":`بدء المداولة`,"studio.running":`مداولة…`,"connectors.title":`الموصلات`,"connectors.triggers":`المشغلات`,"connectors.newWorkflow":`سير عمل جديد`,"settings.title":`الإعدادات`,"settings.language":`اللغة`,"settings.useLiara":`استخدام NHA Free`,"settings.liaraActivated":`✓ تم تفعيل Liara`,"settings.apiKeySet":`✓ مفتاح API مُعدَّل — أدخل مفتاحاً جديداً للتغيير`,"settings.saveProfile":`حفظ الملف الشخصي`,"settings.googleAccount":`حساب Google`,"settings.connectGoogle":`ربط Google`},hi:{"common.save":`सहेजें`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`रद्द करें`,"common.delete":`हटाएं`,"common.edit":`संपादित करें`,"common.add":`जोड़ें`,"common.loading":`लोड हो रहा है…`,"common.error":`त्रुटि`,"common.retry":`पुनः प्रयास करें`,"common.send":`भेजें`,"common.close":`बंद करें`,"common.confirm":`पुष्टि करें`,"common.back":`वापस`,"common.search":`खोजें…`,"common.refresh":`रीफ्रेश`,"common.copy":`कॉपी करें`,"common.copied":`कॉपी हो गया!`,"common.connect":`कनेक्ट करें`,"common.disconnect":`डिस्कनेक्ट करें`,"common.yes":`हाँ`,"common.no":`नहीं`,"common.new":`नया`,"common.noData":`कोई डेटा नहीं`,"common.today":`आज`,"common.name":`नाम`,"sidebar.panoramica":`अवलोकन`,"sidebar.integrazioni":`एकीकरण`,"sidebar.ai":`AI`,"nav.dashboard":`डैशबोर्ड`,"nav.chat":`चैट`,"nav.tasks":`कार्य`,"nav.email":`ईमेल`,"nav.calendar":`कैलेंडर`,"nav.contacts":`संपर्क`,"nav.agents":`एजेंट`,"nav.settings":`सेटिंग्स`,"chat.placeholder":`NHA को संदेश…`,"chat.thinking":`सोच रहा हूँ…`,"chat.newChat":`नई बातचीत`,"email.inbox":`इनबॉक्स`,"email.compose":`लिखें`,"email.noEmails":`कोई ईमेल नहीं`,"calendar.title":`कैलेंडर`,"calendar.newEvent":`नई घटना`,"calendar.noEvents":`कोई घटना नहीं`,"tasks.title":`कार्य`,"tasks.newTask":`नया कार्य`,"tasks.noTasks":`कोई कार्य नहीं`,"contacts.title":`संपर्क`,"contacts.noContacts":`कोई संपर्क नहीं`,"agents.title":`एजेंट`,"agents.noAgents":`कोई एजेंट नहीं`,"agents.orchestrator":`ऑर्केस्ट्रेटर`,"agents.orchestratorSend":`सभी को भेजें`,"studio.title":`Studio`,"studio.run":`विचार-विमर्श शुरू करें`,"studio.running":`विचार-विमर्श…`,"connectors.title":`कनेक्टर`,"connectors.triggers":`ट्रिगर`,"connectors.newWorkflow":`नया वर्कफ्लो`,"settings.title":`सेटिंग्स`,"settings.language":`भाषा`,"settings.useLiara":`NHA Free उपयोग करें`,"settings.liaraActivated":`✓ Liara सक्रिय`,"settings.apiKeySet":`✓ API key कॉन्फ़िगर — बदलने के लिए नई key डालें`,"settings.saveProfile":`प्रोफ़ाइल सहेजें`,"settings.googleAccount":`Google खाता`,"settings.connectGoogle":`Google कनेक्ट करें`},tr:{"common.save":`Kaydet`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`İptal`,"common.delete":`Sil`,"common.edit":`Düzenle`,"common.add":`Ekle`,"common.loading":`Yükleniyor…`,"common.error":`Hata`,"common.retry":`Tekrar dene`,"common.send":`Gönder`,"common.close":`Kapat`,"common.confirm":`Onayla`,"common.back":`Geri`,"common.search":`Ara…`,"common.refresh":`Yenile`,"common.copy":`Kopyala`,"common.copied":`Kopyalandı!`,"common.connect":`Bağlan`,"common.disconnect":`Bağlantıyı kes`,"common.yes":`Evet`,"common.no":`Hayır`,"common.new":`Yeni`,"common.noData":`Veri yok`,"common.today":`Bugün`,"common.name":`Ad`,"sidebar.panoramica":`Genel bakış`,"sidebar.integrazioni":`Entegrasyonlar`,"sidebar.ai":`YZ`,"nav.dashboard":`Gösterge paneli`,"nav.chat":`Sohbet`,"nav.tasks":`Görevler`,"nav.email":`E-posta`,"nav.calendar":`Takvim`,"nav.contacts":`Kişiler`,"nav.agents":`Ajanlar`,"nav.settings":`Ayarlar`,"chat.placeholder":`NHA'ya mesaj…`,"chat.thinking":`Düşünüyor…`,"chat.newChat":`Yeni sohbet`,"email.inbox":`Gelen kutusu`,"email.compose":`Oluştur`,"email.noEmails":`E-posta yok`,"calendar.title":`Takvim`,"calendar.newEvent":`Yeni etkinlik`,"calendar.noEvents":`Etkinlik yok`,"tasks.title":`Görevler`,"tasks.newTask":`Yeni görev`,"tasks.noTasks":`Görev yok`,"contacts.title":`Kişiler`,"contacts.noContacts":`Kişi yok`,"agents.title":`Ajanlar`,"agents.noAgents":`Ajan yok`,"agents.orchestrator":`Orkestratör`,"agents.orchestratorSend":`Hepsine gönder`,"studio.title":`Studio`,"studio.run":`Müzakereyi başlat`,"studio.running":`Müzakere ediliyor…`,"connectors.title":`Bağlayıcılar`,"connectors.triggers":`Tetikleyiciler`,"connectors.newWorkflow":`Yeni iş akışı`,"settings.title":`Ayarlar`,"settings.language":`Dil`,"settings.useLiara":`NHA Free kullan`,"settings.liaraActivated":`✓ Liara etkinleştirildi`,"settings.apiKeySet":`✓ API anahtarı yapılandırıldı — değiştirmek için yeni girin`,"settings.saveProfile":`Profili kaydet`,"settings.googleAccount":`Google hesabı`,"settings.connectGoogle":`Google'a bağlan`},sv:{"common.save":`Spara`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Avbryt`,"common.delete":`Ta bort`,"common.edit":`Redigera`,"common.add":`Lägg till`,"common.loading":`Laddar…`,"common.error":`Fel`,"common.retry":`Försök igen`,"common.send":`Skicka`,"common.close":`Stäng`,"common.confirm":`Bekräfta`,"common.back":`Tillbaka`,"common.search":`Sök…`,"common.refresh":`Uppdatera`,"common.copy":`Kopiera`,"common.copied":`Kopierat!`,"common.connect":`Anslut`,"common.disconnect":`Koppla från`,"common.yes":`Ja`,"common.no":`Nej`,"common.new":`Ny`,"common.noData":`Inga data`,"common.today":`Idag`,"common.name":`Namn`,"sidebar.panoramica":`Översikt`,"sidebar.integrazioni":`Integrationer`,"sidebar.ai":`AI`,"nav.dashboard":`Instrumentpanel`,"nav.chat":`Chatt`,"nav.tasks":`Uppgifter`,"nav.email":`E-post`,"nav.calendar":`Kalender`,"nav.contacts":`Kontakter`,"nav.agents":`Agenter`,"nav.settings":`Inställningar`,"chat.placeholder":`Meddelande till NHA…`,"chat.thinking":`Tänker…`,"chat.newChat":`Ny konversation`,"email.inbox":`Inkorgen`,"email.compose":`Skriv`,"email.noEmails":`Inga e-postmeddelanden`,"calendar.title":`Kalender`,"calendar.newEvent":`Ny händelse`,"calendar.noEvents":`Inga händelser`,"tasks.title":`Uppgifter`,"tasks.newTask":`Ny uppgift`,"tasks.noTasks":`Inga uppgifter`,"contacts.title":`Kontakter`,"contacts.noContacts":`Inga kontakter`,"agents.title":`Agenter`,"agents.noAgents":`Inga agenter`,"agents.orchestrator":`Orkestrator`,"agents.orchestratorSend":`Skicka till alla`,"studio.title":`Studio`,"studio.run":`Starta deliberation`,"studio.running":`Delibererar…`,"connectors.title":`Kopplingar`,"connectors.triggers":`Utlösare`,"connectors.newWorkflow":`Nytt arbetsflöde`,"settings.title":`Inställningar`,"settings.language":`Språk`,"settings.useLiara":`Använd NHA Free`,"settings.liaraActivated":`✓ Liara aktiverad`,"settings.apiKeySet":`✓ API-nyckel konfigurerad — ange en ny för att ändra`,"settings.saveProfile":`Spara profil`,"settings.googleAccount":`Google-konto`,"settings.connectGoogle":`Anslut Google`},da:{"common.save":`Gem`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Annuller`,"common.delete":`Slet`,"common.edit":`Rediger`,"common.add":`Tilføj`,"common.loading":`Indlæser…`,"common.error":`Fejl`,"common.retry":`Prøv igen`,"common.send":`Send`,"common.close":`Luk`,"common.confirm":`Bekræft`,"common.back":`Tilbage`,"common.search":`Søg…`,"common.refresh":`Opdater`,"common.copy":`Kopiér`,"common.copied":`Kopieret!`,"common.connect":`Tilslut`,"common.disconnect":`Afbryd`,"common.yes":`Ja`,"common.no":`Nej`,"common.new":`Ny`,"common.noData":`Ingen data`,"common.today":`I dag`,"common.name":`Navn`,"sidebar.panoramica":`Oversigt`,"sidebar.integrazioni":`Integrationer`,"sidebar.ai":`AI`,"nav.dashboard":`Dashboard`,"nav.chat":`Chat`,"nav.tasks":`Opgaver`,"nav.email":`E-mail`,"nav.calendar":`Kalender`,"nav.contacts":`Kontakter`,"nav.agents":`Agenter`,"nav.settings":`Indstillinger`,"chat.placeholder":`Besked til NHA…`,"chat.thinking":`Tænker…`,"chat.newChat":`Ny samtale`,"email.inbox":`Indbakke`,"email.compose":`Skriv`,"email.noEmails":`Ingen e-mails`,"calendar.title":`Kalender`,"calendar.newEvent":`Nyt arrangement`,"calendar.noEvents":`Ingen arrangementer`,"tasks.title":`Opgaver`,"tasks.newTask":`Ny opgave`,"tasks.noTasks":`Ingen opgaver`,"contacts.title":`Kontakter`,"contacts.noContacts":`Ingen kontakter`,"agents.title":`Agenter`,"agents.noAgents":`Ingen agenter`,"agents.orchestrator":`Orkestrering`,"agents.orchestratorSend":`Send til alle`,"studio.title":`Studio`,"studio.run":`Start deliberation`,"studio.running":`Delibererer…`,"connectors.title":`Forbindelser`,"connectors.triggers":`Udløsere`,"connectors.newWorkflow":`Nyt workflow`,"settings.title":`Indstillinger`,"settings.language":`Sprog`,"settings.useLiara":`Brug NHA Free`,"settings.liaraActivated":`✓ Liara aktiveret`,"settings.apiKeySet":`✓ API-nøgle konfigureret — indtast en ny for at ændre`,"settings.saveProfile":`Gem profil`,"settings.googleAccount":`Google-konto`,"settings.connectGoogle":`Tilslut Google`},fi:{"common.save":`Tallenna`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Peruuta`,"common.delete":`Poista`,"common.edit":`Muokkaa`,"common.add":`Lisää`,"common.loading":`Ladataan…`,"common.error":`Virhe`,"common.retry":`Yritä uudelleen`,"common.send":`Lähetä`,"common.close":`Sulje`,"common.confirm":`Vahvista`,"common.back":`Takaisin`,"common.search":`Hae…`,"common.refresh":`Päivitä`,"common.copy":`Kopioi`,"common.copied":`Kopioitu!`,"common.connect":`Yhdistä`,"common.disconnect":`Katkaise yhteys`,"common.yes":`Kyllä`,"common.no":`Ei`,"common.new":`Uusi`,"common.noData":`Ei tietoja`,"common.today":`Tänään`,"common.name":`Nimi`,"sidebar.panoramica":`Yleiskatsaus`,"sidebar.integrazioni":`Integraatiot`,"sidebar.ai":`AI`,"nav.dashboard":`Kojelauta`,"nav.chat":`Chat`,"nav.tasks":`Tehtävät`,"nav.email":`Sähköposti`,"nav.calendar":`Kalenteri`,"nav.contacts":`Yhteystiedot`,"nav.agents":`Agentit`,"nav.settings":`Asetukset`,"chat.placeholder":`Viesti NHA:lle…`,"chat.thinking":`Mietitään…`,"chat.newChat":`Uusi keskustelu`,"email.inbox":`Saapuneet`,"email.compose":`Kirjoita`,"email.noEmails":`Ei sähköposteja`,"calendar.title":`Kalenteri`,"calendar.newEvent":`Uusi tapahtuma`,"calendar.noEvents":`Ei tapahtumia`,"tasks.title":`Tehtävät`,"tasks.newTask":`Uusi tehtävä`,"tasks.noTasks":`Ei tehtäviä`,"contacts.title":`Yhteystiedot`,"contacts.noContacts":`Ei yhteystietoja`,"agents.title":`Agentit`,"agents.noAgents":`Ei agentteja`,"agents.orchestrator":`Orkestraattori`,"agents.orchestratorSend":`Lähetä kaikille`,"studio.title":`Studio`,"studio.run":`Aloita deliberaatio`,"studio.running":`Deliberaatio…`,"connectors.title":`Yhdistimet`,"connectors.triggers":`Laukaisijat`,"connectors.newWorkflow":`Uusi työnkulku`,"settings.title":`Asetukset`,"settings.language":`Kieli`,"settings.useLiara":`Käytä NHA Freeä`,"settings.liaraActivated":`✓ Liara aktivoitu`,"settings.apiKeySet":`✓ API-avain määritetty — syötä uusi vaihtaaksesi`,"settings.saveProfile":`Tallenna profiili`,"settings.googleAccount":`Google-tili`,"settings.connectGoogle":`Yhdistä Google`},cs:{"common.save":`Uložit`,"common.saving":`…`,"common.saved":`✓`,"common.cancel":`Zrušit`,"common.delete":`Smazat`,"common.edit":`Upravit`,"common.add":`Přidat`,"common.loading":`Načítání…`,"common.error":`Chyba`,"common.retry":`Zkusit znovu`,"common.send":`Odeslat`,"common.close":`Zavřít`,"common.confirm":`Potvrdit`,"common.back":`Zpět`,"common.search":`Hledat…`,"common.refresh":`Obnovit`,"common.copy":`Kopírovat`,"common.copied":`Zkopírováno!`,"common.connect":`Připojit`,"common.disconnect":`Odpojit`,"common.yes":`Ano`,"common.no":`Ne`,"common.new":`Nový`,"common.noData":`Žádná data`,"common.today":`Dnes`,"common.name":`Název`,"sidebar.panoramica":`Přehled`,"sidebar.integrazioni":`Integrace`,"sidebar.ai":`AI`,"nav.dashboard":`Přehled`,"nav.chat":`Chat`,"nav.tasks":`Úkoly`,"nav.email":`E-mail`,"nav.calendar":`Kalendář`,"nav.contacts":`Kontakty`,"nav.agents":`Agenti`,"nav.settings":`Nastavení`,"chat.placeholder":`Zpráva pro NHA…`,"chat.thinking":`Přemýšlím…`,"chat.newChat":`Nová konverzace`,"email.inbox":`Doručená pošta`,"email.compose":`Napsat`,"email.noEmails":`Žádné e-maily`,"calendar.title":`Kalendář`,"calendar.newEvent":`Nová událost`,"calendar.noEvents":`Žádné události`,"tasks.title":`Úkoly`,"tasks.newTask":`Nový úkol`,"tasks.noTasks":`Žádné úkoly`,"contacts.title":`Kontakty`,"contacts.noContacts":`Žádné kontakty`,"agents.title":`Agenti`,"agents.noAgents":`Žádní agenti`,"agents.orchestrator":`Orchestrátor`,"agents.orchestratorSend":`Odeslat všem`,"studio.title":`Studio`,"studio.run":`Zahájit deliberaci`,"studio.running":`Deliberace…`,"connectors.title":`Konektory`,"connectors.triggers":`Spouštěče`,"connectors.newWorkflow":`Nový workflow`,"settings.title":`Nastavení`,"settings.language":`Jazyk`,"settings.useLiara":`Použít NHA Free`,"settings.liaraActivated":`✓ Liara aktivována`,"settings.apiKeySet":`✓ API klíč nastaven — zadejte nový pro změnu`,"settings.saveProfile":`Uložit profil`,"settings.googleAccount":`Účet Google`,"settings.connectGoogle":`Připojit Google`}};function ue(e,t,n){let r=(le[e]??ce)[t]??ce[t]??t;if(n)for(let[e,t]of Object.entries(n))r=r.replace(RegExp(`\\{${e}\\}`,`g`),String(t));return r}function M(){let e=te(e=>e.config?.lang??`en`);return(0,_.useMemo)(()=>(t,n)=>ue(e,t,n),[e])}var N={root:`_root_hhcfn_1`,main:`_main_hhcfn_7`,topbar:`_topbar_hhcfn_15`,burger:`_burger_hhcfn_26`,viewTitle:`_viewTitle_hhcfn_45`,content:`_content_hhcfn_53`,wsIndicator:`_wsIndicator_hhcfn_62`,wsDot:`_wsDot_hhcfn_70`,wsDotOnline:`_wsDotOnline_hhcfn_78`,wsOnlinePulse:`_wsOnlinePulse_hhcfn_1`,wsDotConnecting:`_wsDotConnecting_hhcfn_84`,wsConnectingBlink:`_wsConnectingBlink_hhcfn_1`,wsDotOffline:`_wsDotOffline_hhcfn_89`,wsDotRestart:`_wsDotRestart_hhcfn_94`,restartPulse:`_restartPulse_hhcfn_1`,restartBanner:`_restartBanner_hhcfn_99`,wsLabel:`_wsLabel_hhcfn_126`},de={dashboard:`dashboard.title`,chat:`chat.placeholder`,studio:`studio.title`,webcraft:`webcraft.title`,collab:`collab.title`,agents:`agents.title`,connectors:`connectors.title`,calendar:`calendar.title`,tasks:`tasks.title`,contacts:`contacts.title`,notes:`notes.title`,reminders:`reminders.title`,birthdays:`birthdays.title`,plan:`plan.title`,drive:`drive.title`,onedrive:`onedrive.title`,mstodo:`mstodo.title`,github:`github.title`,slack:`slack.title`,notion:`notion.title`,maps:`maps.title`,cron:`cron.title`,screen:`screen.title`,settings:`settings.title`},fe={dashboard:`Dashboard`,chat:`Chat`,studio:`Studio`,webcraft:`WebCraft`,collab:`Alexandria`,agents:`Agents`,connectors:`AWF - AutoWorkFlow`,email:`Email`,calendar:`Calendar`,tasks:`Tasks`,contacts:`Contacts`,notes:`Notes`,reminders:`Reminders`,birthdays:`Birthdays`,plan:`Daily Plan`,drive:`Drive`,onedrive:`OneDrive`,mstodo:`MS Todo`,github:`GitHub`,slack:`Slack`,notion:`Notion`,maps:`Maps`,cron:`Cron`,screen:`Screen`,settings:`Settings`};function pe({children:e}){let{activeView:t,toggleSidebar:n,setConfig:r}=te(),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(``),c=()=>{E(`/api/version/check`).then(e=>{e&&e.needsRestart&&(a(!0),e.installed&&s(e.installed))}).catch(()=>{})},l=se(e=>{e.type===`version`&&c()}),u=M();(0,_.useEffect)(()=>{localStorage.removeItem(`nha_updated_to`),c();let e=setInterval(c,6e4);return()=>clearInterval(e)},[]),(0,_.useEffect)(()=>{E(`/api/config`).then(e=>{e&&r(e)}).catch(()=>{})},[r]);let d=de[t],f=d?u(d):fe[t]??t;return(0,A.jsxs)(`div`,{className:N.root,children:[(0,A.jsx)(oe,{}),(0,A.jsxs)(`div`,{className:N.main,children:[(0,A.jsxs)(`header`,{className:N.topbar,children:[(0,A.jsxs)(`button`,{className:N.burger,onClick:n,"aria-label":`Menu`,children:[(0,A.jsx)(`span`,{}),(0,A.jsx)(`span`,{}),(0,A.jsx)(`span`,{})]}),(0,A.jsx)(`span`,{className:N.viewTitle,children:f}),(0,A.jsx)(`span`,{style:{flex:1}}),i?(0,A.jsxs)(`div`,{className:N.restartBanner,title:`Nuova versione v${o} installata sul disco — riavvia "nha ui" da terminale per attivarla`,style:{background:`#fee2e2`,color:`#991b1b`,border:`1px solid #fca5a5`,borderRadius:6,padding:`4px 10px`,fontSize:12,fontWeight:600,cursor:`help`},children:[(0,A.jsx)(`span`,{className:`${N.wsDot} ${N.wsDotRestart}`}),(0,A.jsxs)(`span`,{className:N.wsLabel,children:[`⚠ Riavvia nha ui — v`,o,` pronta`]})]}):(0,A.jsxs)(`div`,{className:N.wsIndicator,title:u(l===`connected`?`common.connected`:l===`connecting`?`common.loading`:`common.disconnected`),children:[(0,A.jsx)(`span`,{className:`${N.wsDot} ${l===`connected`?N.wsDotOnline:l===`connecting`?N.wsDotConnecting:N.wsDotOffline}`}),(0,A.jsx)(`span`,{className:N.wsLabel,children:u(l===`connected`?`common.connected`:l===`connecting`?`common.loading`:`common.disconnected`)})]})]}),(0,A.jsx)(`main`,{className:N.content,id:`main-content`,children:e})]})]})}function me(e){return e.replace(/<tool_call>[\s\S]*?<\/tool_call>/g,``).replace(/<tool_response>[\s\S]*?<\/tool_response>/g,``).replace(/<\/?tool_call>/g,``).replace(/<\/?tool_response>/g,``).replace(/^\[(?:Searching|Fetching|Raccolta dati web)[^\]]*\]\n?/gm,``)}function he(e){return e.replace(/^(#{1,6})\n[ \t]*(\S[^\n]*)$/gm,`$1 $2`).replace(/\n{3,}/g,`
|
|
55
|
-
|
|
56
|
-
`).trim()}function ge(e){let t=e.split(`
|
|
57
|
-
`),n=[],r=e=>e.trimStart().startsWith(`|`),i=e=>{let t=e.trim();return/^[|\-: ]+$/.test(t)&&t.includes(`-`)&&t.includes(`|`)},a=e=>{let t=e.trim();return t===``||/^#{1,6} /.test(t)||t.startsWith("```")||/^>\s/.test(t)},o=0;for(;o<t.length;){let e=t[o];if(!r(e)){n.push(e),o++;continue}let s=[e];for(o++;o<t.length;){let e=t[o];if(r(e)||i(e))s.push(e),o++;else if(!a(e))s[s.length-1]+=` `+e.trim(),o++;else break}for(let e of s)n.push(e)}return n.join(`
|
|
58
|
-
`)}function _e(e){let t=me(e);return t=he(t),t=ge(t),t}function ve(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function ye(e){let t=ve(e);return t=t.replace(/\*\*\*([^*\n]+)\*\*\*/g,`<strong><em>$1</em></strong>`),t=t.replace(/\*\*([^*\n]+)\*\*/g,`<strong>$1</strong>`),t=t.replace(/\*([^*\n]+)\*/g,`<em>$1</em>`),t=t.replace(/~~([^~\n]+)~~/g,`<del>$1</del>`),t=t.replace(/`([^`]+)`/g,`<code>$1</code>`),t=t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,`<img src="$2" alt="$1" style="max-width:100%;border-radius:6px;margin:4px 0">`),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,`<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>`),t}function be(e){let t=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim()),n=e=>{let t=e.trim();return/^[|\-: ]+$/.test(t)&&t.includes(`-`)&&t.includes(`|`)},r=e.findIndex(n),i=[],a=[];r===1?(i=t(e[0]),a=e.slice(2).filter(e=>!n(e)).map(t)):r>1?(i=t(e[r-1]),a=[...e.slice(0,r-1),...e.slice(r+1)].filter(e=>!n(e)).map(t)):a=e.filter(e=>!n(e)).map(t);let o=`<table>`;if(i.length>0&&(o+=`<thead><tr>`,o+=i.map(e=>`<th>${ye(e)}</th>`).join(``),o+=`</tr></thead>`),a.length>0){o+=`<tbody>`;for(let e of a)o+=`<tr>`,o+=e.map(e=>`<td>${ye(e)}</td>`).join(``),o+=`</tr>`;o+=`</tbody>`}return o+=`</table>`,o}function xe(e){if(!e)return``;let t=_e(e).split(`
|
|
59
|
-
`),n=``,r=!1,i=!1,a=!1,o=``,s=``,c=0,l=()=>{r&&=(n+=`</ul>`,!1),i&&=(n+=`</ol>`,!1)};for(;c<t.length;){let e=t[c],u=e.trim();if(u.startsWith("```")){a?(n+=ve(o)+`</code></pre>`,a=!1,o=``):(l(),a=!0,o=``,s=u.slice(3).trim(),n+=`<pre><code${s?` class="language-${ve(s)}"`:``}>`),c++;continue}if(a){o+=e+`
|
|
60
|
-
`,c++;continue}{let e=u.match(/^(#{1,6}) (.+)/);if(e){l();let t=e[1].length;n+=`<h${t}>${ye(e[2])}</h${t}>`,c++;continue}}if(/^-{3,}$/.test(u)||/^\*{3,}$/.test(u)||/^_{3,}$/.test(u)){l(),n+=`<hr>`,c++;continue}if(u.startsWith(`|`)){l();let e=[];for(;c<t.length;){let n=t[c],r=n.trim();if(r.startsWith(`|`)||/^[|\-: ]+$/.test(r)&&r.includes(`-`)&&r.includes(`|`))e.push(n),c++;else break}e.length>0&&(n+=be(e));continue}if(u.startsWith(`> `)){l(),n+=`<blockquote><p>${ye(u.slice(2))}</p></blockquote>`,c++;continue}if(/^[-*+] /.test(u)){i&&=(n+=`</ol>`,!1),r||=(n+=`<ul>`,!0),n+=`<li>${ye(u.slice(2))}</li>`,c++;continue}{let e=u.match(/^(\d+)[.)]\s(.+)/);if(e){r&&=(n+=`</ul>`,!1),i||=(n+=`<ol>`,!0),n+=`<li>${ye(e[2])}</li>`,c++;continue}}if(l(),u===``){n+=`<div style="height:6px"></div>`,c++;continue}n+=`<p>${ye(u)}</p>`,c++}return l(),a&&(n+=ve(o)+`</code></pre>`),n}var P={root:`_root_15oob_1`,convSidebar:`_convSidebar_15oob_8`,convSidebarHeader:`_convSidebarHeader_15oob_18`,newConvBtn:`_newConvBtn_15oob_23`,convList:`_convList_15oob_36`,convItem:`_convItem_15oob_41`,convItemActive:`_convItemActive_15oob_48`,convTitle:`_convTitle_15oob_53`,convMeta:`_convMeta_15oob_61`,convDelete:`_convDelete_15oob_69`,chatMain:`_chatMain_15oob_76`,chatToolbar:`_chatToolbar_15oob_85`,convTitleBar:`_convTitleBar_15oob_94`,toolbarBtn:`_toolbarBtn_15oob_103`,toolbarBtnDim:`_toolbarBtnDim_15oob_116`,toolbarBtnCanvas:`_toolbarBtnCanvas_15oob_128`,messages:`_messages_15oob_137`,empty:`_empty_15oob_146`,emptyIcon:`_emptyIcon_15oob_158`,emptyTitle:`_emptyTitle_15oob_159`,emptySub:`_emptySub_15oob_160`,emptyHint:`_emptyHint_15oob_161`,suggGroups:`_suggGroups_15oob_163`,suggGroup:`_suggGroup_15oob_163`,suggGroupTitle:`_suggGroupTitle_15oob_165`,suggBtns:`_suggBtns_15oob_166`,suggBtn:`_suggBtn_15oob_166`,message:`_message_15oob_137`,user:`_user_15oob_178`,assistant:`_assistant_15oob_179`,msgLabel:`_msgLabel_15oob_181`,bubble:`_bubble_15oob_188`,sentinelBubble:`_sentinelBubble_15oob_211`,cursor:`_cursor_15oob_216`,blink:`_blink_15oob_1`,msgActions:`_msgActions_15oob_231`,msgActionBtn:`_msgActionBtn_15oob_240`,editBox:`_editBox_15oob_252`,editInput:`_editInput_15oob_259`,editActions:`_editActions_15oob_272`,editSaveBtn:`_editSaveBtn_15oob_273`,editCancelBtn:`_editCancelBtn_15oob_277`,toolActivity:`_toolActivity_15oob_284`,toolActivityItem:`_toolActivityItem_15oob_290`,active:`_active_15oob_303`,toolPulse:`_toolPulse_15oob_1`,done:`_done_15oob_308`,error:`_error_15oob_309`,thinkingIndicator:`_thinkingIndicator_15oob_317`,thinkingDots:`_thinkingDots_15oob_331`,thinkingDot:`_thinkingDot_15oob_331`,thinkBounce:`_thinkBounce_15oob_1`,attachBar:`_attachBar_15oob_349`,attachClear:`_attachClear_15oob_360`,inputBar:`_inputBar_15oob_371`,inputTools:`_inputTools_15oob_381`,iconBtn:`_iconBtn_15oob_387`,iconBtnActive:`_iconBtnActive_15oob_398`,thinkBtn:`_thinkBtn_15oob_400`,thinkBtnOn:`_thinkBtnOn_15oob_412`,inputRow:`_inputRow_15oob_417`,input:`_input_15oob_371`,btn:`_btn_15oob_436`,send:`_send_15oob_447`,stop:`_stop_15oob_454`,canvasPanel:`_canvasPanel_15oob_461`,canvasPanelHeader:`_canvasPanelHeader_15oob_476`,canvasPanelActions:`_canvasPanelActions_15oob_488`,canvasPanelBtn:`_canvasPanelBtn_15oob_494`,canvasPanelClose:`_canvasPanelClose_15oob_505`,canvasFrame:`_canvasFrame_15oob_516`,mobileMenuBtn:`_mobileMenuBtn_15oob_527`,mobileBackdrop:`_mobileBackdrop_15oob_528`,convSidebarOpen:`_convSidebarOpen_15oob_549`,msgUser:`_msgUser_15oob_591`,msgAssistant:`_msgAssistant_15oob_591`,composeBar:`_composeBar_15oob_597`},Se={body:`_body_ctbrf_4`,mdCursorBlink:`_mdCursorBlink_ctbrf_1`,compact:`_compact_ctbrf_197`};function Ce(e){let t=e.replace(/```(?:json|tool|data|xml|csv)[^\n]*\n[\s\S]*?```/g,``).replace(/```[^\n]*\n\s*[{\[]([\s\S]*?)```/g,``).replace(/^```\s*$/gm,``),n=``,r=0,i=!1;for(let e=0;e<t.length;e++){let a=t[e];a===`{`&&(r++,r===1&&/"action"\s*:/.test(t.slice(e,e+80))&&(i=!0)),i||(n+=a),a===`}`&&(r=Math.max(0,r-1),i&&r===0&&(i=!1))}return n.replace(/\n{3,}/g,`
|
|
61
|
-
|
|
62
|
-
`).trim()}var we={browser_open:`Opening page`,browser_screenshot:`Taking screenshot`,browser_click:`Clicking element`,browser_type:`Typing text`,browser_extract:`Extracting content`,browser_js:`Running JavaScript`,browser_wait:`Waiting for element`,browser_scroll:`Scrolling page`,browser_key:`Pressing key`,browser_close:`Closing browser`,web_search:`Searching the web`,fetch_url:`Fetching URL`,gmail_list:`Searching emails`,gmail_read:`Reading email`,gmail_send:`Sending email`,calendar_today:`Loading calendar`,calendar_create:`Creating event`};function Te(){let e=M(),[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(()=>localStorage.getItem(`nha_conv_sidebar`)!==`hidden`),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(!1),p=(0,_.useRef)(null),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(null),y=(0,_.useRef)(null),b=(0,_.useRef)(null),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(!1),ee=(0,_.useRef)(null),[T,ne]=(0,_.useState)(null),[re,k]=(0,_.useState)(!1),[ie,j]=(0,_.useState)(null),[ae,oe]=(0,_.useState)(``),[se,ce]=(0,_.useState)([]),[le,ue]=(0,_.useState)(!1),[N,de]=(0,_.useState)(!1),fe=(0,_.useRef)(null),pe=(0,_.useRef)(null),me=(0,_.useRef)(null);(0,_.useEffect)(()=>{fe.current?.scrollIntoView({behavior:`smooth`})},[a]),(0,_.useEffect)(()=>{E(`/api/config`).then(e=>{e&&(e.thinking===!0||e.thinking===`on`||e.thinking===`true`)&&S(!0)}),he().then(e=>{e&&e.length>0?ge(e[0].id):_e()});try{let e=sessionStorage.getItem(`nha_chat_prefill`)??sessionStorage.getItem(`nha_studio_import`);e&&(u(e),sessionStorage.removeItem(`nha_chat_prefill`),sessionStorage.removeItem(`nha_studio_import`),setTimeout(()=>pe.current?.focus(),100))}catch{}},[]);let he=(0,_.useCallback)(async()=>{let e=(await E(`/api/conversations`))?.conversations??[];return n(e),e},[]),ge=(0,_.useCallback)(async e=>{let t=await E(`/api/conversations/${e}`);t?.conversation&&(i(t.conversation.id),o(t.conversation.messages??[]))},[]),_e=(0,_.useCallback)(async()=>{let e=await D(`/api/conversations`,{});e?.conversation&&(i(e.conversation.id),o([]),he())},[he]),ve=(0,_.useCallback)(async e=>{let t=te.getState().apiBase;await fetch(`${t}/api/conversations/${e}`,{method:`DELETE`}),he().then(t=>{e===r&&(t.length>0?ge(t[0].id):_e())})},[r,he,ge,_e]),ye=()=>{r&&window.open(`/api/conversations/${r}/export?format=md`,`_blank`)},be=()=>{let e=!x;S(e),D(`/api/config`,{key:`thinking`,value:e?`on`:`off`}).catch(()=>{})},Te=()=>{c(e=>{let t=!e;return localStorage.setItem(`nha_conv_sidebar`,t?`visible`:`hidden`),t})},F=e=>{let t=e.target.files?.[0];if(!t)return;let n=t.name.toLowerCase().endsWith(`.pdf`)||t.type===`application/pdf`,r=new FileReader;n?(r.onload=e=>{let n=(e.target?.result).split(`,`)[1];h({name:t.name,size:t.size,base64:n,mimeType:`application/pdf`,isPDF:!0}),v(null)},r.readAsDataURL(t)):(r.onload=e=>{h({name:t.name,size:t.size,content:e.target?.result}),v(null)},r.readAsText(t))},Ee=e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=e=>{let n=(e.target?.result).split(`,`)[1];v({name:t.name,size:t.size,base64:n,mimeType:t.type||`image/jpeg`}),h(null)},n.readAsDataURL(t)},De=()=>{h(null),v(null),y.current&&(y.current.value=``),b.current&&(b.current.value=``)},Oe=m?`[file] ${m.name} (${Math.round(m.size/1024)}KB)`:g?`[img] ${g.name} (${Math.round(g.size/1024)}KB)`:null,I=()=>{let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(!e){alert(`Speech recognition not supported in this browser.`);return}if(C&&ee.current){ee.current.stop(),w(!1);return}let t=new e;ee.current=t,t.lang=`it-IT`,t.continuous=!1,t.interimResults=!1,t.onresult=e=>{let t=e.results[0][0].transcript;u(e=>e?e+` `+t:t)},t.onend=()=>w(!1),t.onerror=()=>w(!1),t.start(),w(!0)},L=(0,_.useCallback)(async()=>{let t=l.trim(),n=!!(m||g);if(!t&&!n||d)return;let i={role:`user`,content:m?(t?t+` `:``)+`[File: ${m.name}]`:g?(t?t+` `:``)+`[Image: ${g.name}]`:t};if(o(e=>[...e,i]),u(``),n){let n={message:t||`Analyze this attachment`,history:a.map(e=>({role:e.role,content:e.content}))};m?.isPDF&&m.base64?(n.pdfBase64=m.base64,n.pdfName=m.name):m?.content&&(n.fileContent=m.content,n.fileName=m.name),g?.base64&&(n.imageBase64=g.base64,n.imageMimeType=g.mimeType),De(),o(t=>[...t,{role:`assistant`,content:e(`chat.thinking`),streaming:!0}]),f(!0);try{let e=await D(`/api/chat`,n);o(t=>{let n=[...t],r=n[n.length-1];return r?.role===`assistant`&&(n[n.length-1]={...r,content:e?.response??(e?.error?`Error: `+e.error:`Error`),streaming:!1}),n}),he()}catch(e){o(t=>{let n=[...t],r=n[n.length-1];return r?.role===`assistant`&&(n[n.length-1]={...r,content:`Error: `+e.message,streaming:!1}),n})}finally{f(!1)}return}De(),f(!0),ce([]),ue(!1),de(!0);let s=new AbortController;p.current=s,o(e=>[...e,{role:`assistant`,content:``,streaming:!0}]);let c=a.map(e=>({role:e.role,content:e.content})),h;if(c.length>10){let e=c.slice(0,c.length-10);h=[{role:`user`,content:e.reduce((t,n,r)=>n.role===`user`?t+`\nUser: ${n.content.slice(0,120)}`:r>0&&e[r-1]?.role===`user`?t+` → ${n.content.slice(0,150)}`:t,`[Earlier conversation summary]:`)},{role:`assistant`,content:`Understood, I have context from our earlier conversation.`},...c.slice(-10)]}else h=c;try{let e=``,n=``,i=!1,a=[];await O(`/api/chat/stream`,{message:t,history:h,conversationId:r},t=>{if(t.type===`processing`&&de(!0),t.type===`token`&&typeof t.data.content==`string`){de(!1),e+=t.data.content;let r=Ce(e.replace(/<think>[\s\S]*?<\/think>/g,``)),a=e.includes(`<think>`)&&!e.includes(`</think>`);if(ue(a),a)return;let s=i&&n?`${n}\n\n${r}`:r;o(e=>{let t=[...e],n=t[t.length-1];return n?.role===`assistant`&&(t[t.length-1]={...n,content:s}),t})}if(t.type===`tool`){let n=t.data.action,r=t.data.status,i=we[n]??n,a=r===`executing`?`active`:r===`error`?`error`:`done`;ce(e=>{let t=e.findIndex(e=>e.action===n&&e.status===`active`);if(t>=0){let r=[...e];return r[t]={action:n,label:i,status:a},r}return[...e,{action:n,label:i,status:a}]}),r===`executing`&&(e=Ce(e))}if(t.type===`tool_synthesis`&&(n=Ce(e.replace(/<think>[\s\S]*?<\/think>/g,``)).trim(),e=``,i=!0,ue(!1),de(!0)),t.type===`screenshot`&&typeof t.data.url==`string`&&a.push(t.data.url),t.type===`canvas`&&typeof t.data.markers==`string`){let e=t.data.markers.match(/\[CANVAS_RENDER\]([\s\S]*?)\[\/CANVAS_RENDER\]/);if(e)try{ne(JSON.parse(e[1]).html),k(!0)}catch{}}if(t.type===`done`){ue(!1),de(!1),ce(e=>e.map(e=>e.status===`active`?{...e,status:`done`}:e));let n=t.data.content,r=!!t.data.__sentinel_blocked,i=(n??e).replace(/<think>[\s\S]*?<\/think>/g,``),s=i.match(/\[CANVAS_RENDER\]([\s\S]*?)\[\/CANVAS_RENDER\]/);if(s)try{ne(JSON.parse(s[1]).html),k(!0)}catch{ne(s[1]),k(!0)}if(!s){let e=i.match(/```html\n([\s\S]*?)```/);e&&e[1].includes(`<`)&&(ne(e[1]),k(!0))}let c=a.length>0?`
|
|
63
|
-
|
|
64
|
-
`+a.map(e=>``).join(`
|
|
65
|
-
`):``,l=Ce(i.replace(/\[CANVAS_RENDER\][\s\S]*?\[\/CANVAS_RENDER\]/g,``).replace(/```html[\s\S]*?```/g,`[Canvas HTML — click Panel to view]`))+c;o(r?e=>{let t=[...e],n=t.findIndex((e,n)=>n===t.length-1&&e.role===`assistant`);return n>=0&&(t[n]={role:`assistant`,content:l||`Message blocked by SENTINEL.`,sentinelBlocked:!0,streaming:!1}),t}:e=>{let t=[...e],n=t[t.length-1];return n?.role===`assistant`&&(t[t.length-1]={...n,content:l,streaming:!1}),t}),he()}t.type===`error`&&o(e=>{let n=[...e],r=n[n.length-1];return r?.role===`assistant`&&(n[n.length-1]={...r,content:`Error: `+(t.data.message??`Unknown`),streaming:!1}),n})},s.signal)}catch(e){e.name!==`AbortError`&&o(e=>{let t=[...e],n=t[t.length-1];return n?.role===`assistant`&&(t[t.length-1]={...n,content:n.content||`Error connecting to server.`,streaming:!1}),t})}finally{ue(!1),de(!1),o(e=>{let t=[...e],n=t[t.length-1];return n?.role===`assistant`&&n.streaming&&(t[t.length-1]={...n,streaming:!1}),t}),f(!1),p.current=null,setTimeout(()=>ce([]),2e3)}},[l,a,d,m,g,r,he]),ke=()=>{p.current?.abort(),f(!1)},Ae=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),L())},je=e=>{navigator.clipboard.writeText(e.replace(/\[CANVAS_RENDER\][\s\S]*?\[\/CANVAS_RENDER\]/g,``).trim()).catch(()=>{})},Me=(0,_.useCallback)(async t=>{if(d)return;let n=t-1;if(n<0||a[n]?.role!==`user`)return;let i=a[n],s=a.slice(0,n).map(e=>({role:e.role,content:e.content}));o(e=>{let n=[...e];return n[t]={role:`assistant`,content:``,streaming:!0},n.slice(0,t+1)}),f(!0);let c=new AbortController;p.current=c;let l=``,u=``,m=!1;try{await O(`/api/chat/stream`,{message:i.content,history:s,conversationId:r,isRetry:!0},t=>{if(t.type===`token`&&typeof t.data.content==`string`){l+=t.data.content;let n=Ce(l.replace(/<think>[\s\S]*?<\/think>/g,``)),r=l.includes(`<think>`)&&!l.includes(`</think>`)?`💭 `+e(`chat.thinking`):m&&u?`${u}\n\n${n}`:n;o(e=>{let t=[...e],n=t[t.length-1];return n?.role===`assistant`&&(t[t.length-1]={...n,content:r}),t})}if(t.type===`tool_synthesis`&&(u=Ce(l.replace(/<think>[\s\S]*?<\/think>/g,``)).trim(),l=``,m=!0),t.type===`done`){let e=Ce((t.data.content??l).replace(/<think>[\s\S]*?<\/think>/g,``));o(t=>{let n=[...t],r=n[n.length-1];return r?.role===`assistant`&&(n[n.length-1]={...r,content:e,streaming:!1}),n}),he()}},c.signal)}catch{}finally{f(!1),p.current=null}},[d,a,r,he,e]),Ne=e=>{d||(j(e),oe(a[e].content))},Pe=(0,_.useCallback)(async()=>{if(ie===null)return;let t=ae.trim();if(!t)return;let n=a.slice(0,ie).map(e=>({role:e.role,content:e.content}));o(e=>{let n=e.slice(0,ie);return n.push({role:`user`,content:t}),n.push({role:`assistant`,content:``,streaming:!0}),n}),j(null),oe(``),f(!0);let i=new AbortController;p.current=i;let s=``,c=``,l=!1;try{await O(`/api/chat/stream`,{message:t,history:n,conversationId:r,isEdit:!0,editFromIdx:ie},t=>{if(t.type===`token`&&typeof t.data.content==`string`){s+=t.data.content;let n=Ce(s.replace(/<think>[\s\S]*?<\/think>/g,``)),r=s.includes(`<think>`)&&!s.includes(`</think>`)?`💭 `+e(`chat.thinking`):l&&c?`${c}\n\n${n}`:n;o(e=>{let t=[...e],n=t[t.length-1];return n?.role===`assistant`&&(t[t.length-1]={...n,content:r}),t})}if(t.type===`tool_synthesis`&&(c=Ce(s.replace(/<think>[\s\S]*?<\/think>/g,``)).trim(),s=``,l=!0),t.type===`done`){let e=Ce((t.data.content??s).replace(/<think>[\s\S]*?<\/think>/g,``));o(t=>{let n=[...t],r=n[n.length-1];return r?.role===`assistant`&&(n[n.length-1]={...r,content:e,streaming:!1}),n}),he()}},i.signal)}catch{}finally{f(!1),p.current=null}},[ie,ae,a,r,he,e]);return(0,A.jsxs)(`div`,{className:P.root,children:[s&&(0,A.jsx)(`div`,{className:P.mobileBackdrop,onClick:()=>c(!1)}),s&&(0,A.jsxs)(`div`,{className:`${P.convSidebar} ${P.convSidebarOpen}`,children:[(0,A.jsx)(`div`,{className:P.convSidebarHeader,children:(0,A.jsxs)(`button`,{className:P.newConvBtn,onClick:_e,children:[`+ `,e(`chat.newChat`)]})}),(0,A.jsx)(`div`,{className:P.convList,children:t.map(t=>{let n=Math.floor(t.messageCount/2),i=t.id===r;return(0,A.jsxs)(`div`,{className:`${P.convItem} ${i?P.convItemActive:``}`,onClick:()=>ge(t.id),children:[(0,A.jsx)(`div`,{className:P.convTitle,children:t.title||e(`chat.newChat`)}),(0,A.jsxs)(`div`,{className:P.convMeta,children:[(0,A.jsxs)(`span`,{children:[n,` turns`]}),!i&&(0,A.jsx)(`span`,{className:P.convDelete,onClick:e=>{e.stopPropagation(),ve(t.id)},children:`del`})]})]},t.id)})})]}),(0,A.jsxs)(`div`,{className:P.chatMain,children:[(0,A.jsxs)(`div`,{className:P.chatToolbar,children:[(0,A.jsx)(`button`,{className:P.toolbarBtn,onClick:Te,title:`Toggle conversations`,children:`💬 Chats`}),(0,A.jsx)(`span`,{className:P.convTitleBar,children:t.find(e=>e.id===r)?.title||e(`chat.newChat`)}),(0,A.jsx)(`button`,{className:P.toolbarBtn,onClick:_e,children:`+ New`}),(0,A.jsx)(`button`,{className:P.toolbarBtnDim,onClick:ye,title:`Export Markdown`,children:`Export`}),T&&(0,A.jsx)(`button`,{className:`${P.toolbarBtn} ${P.toolbarBtnCanvas}`,onClick:()=>k(e=>!e),title:`Toggle canvas panel`,children:re?`▣ Panel ✕`:`▣ Panel`})]}),(0,A.jsxs)(`div`,{className:P.messages,ref:me,children:[a.length===0&&(0,A.jsxs)(`div`,{className:P.empty,children:[(0,A.jsx)(`div`,{className:P.emptyIcon,children:`💬`}),(0,A.jsx)(`div`,{className:P.emptyTitle,children:`NHA Chat`}),(0,A.jsx)(`div`,{className:P.emptySub,children:`Personal Operations Assistant · 80 Tools · 38 Agents · Free AI`}),(0,A.jsxs)(`div`,{className:P.suggGroups,children:[(0,A.jsxs)(`div`,{className:P.suggGroup,children:[(0,A.jsx)(`div`,{className:P.suggGroupTitle,children:`⚡ Quick Actions`}),(0,A.jsx)(`div`,{className:P.suggBtns,children:[`Show my unread emails and summarize the most important ones`,`What's on my calendar today? Any meetings I need to prepare for?`,`List my pending tasks sorted by priority`,`Check my GitHub notifications and summarize open issues`].map(e=>(0,A.jsx)(`button`,{className:P.suggBtn,onClick:()=>u(e),children:e},e))})]}),(0,A.jsxs)(`div`,{className:P.suggGroup,children:[(0,A.jsx)(`div`,{className:P.suggGroupTitle,children:`🌐 Web & Research`}),(0,A.jsx)(`div`,{className:P.suggBtns,children:[`Search the web for the latest AI news and summarize the top 5 stories`,`Open google.com and take a screenshot of the homepage`,`Search for the best restaurants near me and create a summary`,`Research the latest developments in quantum computing and write a report`].map(e=>(0,A.jsx)(`button`,{className:P.suggBtn,onClick:()=>u(e),children:e},e))})]}),(0,A.jsxs)(`div`,{className:P.suggGroup,children:[(0,A.jsx)(`div`,{className:P.suggGroupTitle,children:`🛠️ Productivity`}),(0,A.jsx)(`div`,{className:P.suggBtns,children:[`Draft a professional reply to my last email`,`Create a new calendar event for tomorrow at 10am with reminder`,`Summarize my notes and create a to-do list from action items`,`Find contacts named Mario and show their details`].map(e=>(0,A.jsx)(`button`,{className:P.suggBtn,onClick:()=>u(e),children:e},e))})]}),(0,A.jsxs)(`div`,{className:P.suggGroup,children:[(0,A.jsx)(`div`,{className:P.suggGroupTitle,children:`📈 Finance`}),(0,A.jsx)(`div`,{className:P.suggBtns,children:[`What is the current price of Bitcoin and its 24h performance?`,`Analyze the current macro environment and suggest 3 trading opportunities`,`What is the current market regime? Risk-on or risk-off?`,`Give me a technical analysis of AAPL with key support/resistance levels`].map(e=>(0,A.jsx)(`button`,{className:P.suggBtn,onClick:()=>u(e),children:e},e))})]})]})]}),a.map((e,t)=>(0,A.jsxs)(`div`,{className:`${P.message} ${P[e.role]}`,children:[(0,A.jsx)(`div`,{className:P.msgLabel,children:e.role===`user`?`You`:`NHA`}),e.role===`assistant`&&e.streaming&&(0,A.jsxs)(`div`,{className:P.toolActivity,children:[(N||e.content===``&&!le&&se.length===0)&&(0,A.jsxs)(`div`,{className:P.thinkingIndicator,children:[(0,A.jsxs)(`div`,{className:P.thinkingDots,children:[(0,A.jsx)(`div`,{className:P.thinkingDot}),(0,A.jsx)(`div`,{className:P.thinkingDot}),(0,A.jsx)(`div`,{className:P.thinkingDot})]}),le?`Deep thinking...`:`Generating...`]}),le&&!N&&(0,A.jsxs)(`div`,{className:P.thinkingIndicator,children:[(0,A.jsxs)(`div`,{className:P.thinkingDots,children:[(0,A.jsx)(`div`,{className:P.thinkingDot}),(0,A.jsx)(`div`,{className:P.thinkingDot}),(0,A.jsx)(`div`,{className:P.thinkingDot})]}),`Deep thinking...`]}),se.map((e,t)=>(0,A.jsxs)(`div`,{className:`${P.toolActivityItem} ${P[e.status]}`,children:[e.status===`active`?`⏳`:e.status===`error`?`❌`:`✅`,` `,e.label,e.status===`active`&&`...`]},t))]}),e.role===`user`&&ie===t?(0,A.jsxs)(`div`,{className:P.editBox,children:[(0,A.jsx)(`textarea`,{className:P.editInput,value:ae,onChange:e=>oe(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Pe()),e.key===`Escape`&&j(null)},autoFocus:!0,rows:3}),(0,A.jsxs)(`div`,{className:P.editActions,children:[(0,A.jsx)(`button`,{className:P.editSaveBtn,onClick:Pe,children:`Send ↵`}),(0,A.jsx)(`button`,{className:P.editCancelBtn,onClick:()=>j(null),children:`Cancel`})]})]}):e.role===`assistant`?e.content!==``&&(0,A.jsx)(`div`,{className:`${P.bubble} ${Se.body} ${e.sentinelBlocked?P.sentinelBubble:``}`,dangerouslySetInnerHTML:{__html:xe(e.content)}}):(0,A.jsx)(`div`,{className:P.bubble,children:e.content}),e.streaming&&(0,A.jsx)(`span`,{className:P.cursor}),!e.streaming&&ie!==t&&(0,A.jsxs)(`div`,{className:P.msgActions,children:[(0,A.jsx)(`button`,{className:P.msgActionBtn,onClick:()=>je(e.content),children:`Copy`}),e.role===`user`&&!d&&(0,A.jsx)(`button`,{className:P.msgActionBtn,onClick:()=>Ne(t),children:`Edit`}),e.role===`assistant`&&!d&&(0,A.jsx)(`button`,{className:P.msgActionBtn,onClick:()=>Me(t),children:`Retry`})]})]},t)),(0,A.jsx)(`div`,{ref:fe})]}),Oe&&(0,A.jsxs)(`div`,{className:P.attachBar,children:[(0,A.jsx)(`span`,{children:Oe}),(0,A.jsx)(`button`,{className:P.attachClear,onClick:De,children:`×`})]}),(0,A.jsxs)(`div`,{className:P.inputBar,children:[(0,A.jsxs)(`div`,{className:P.inputTools,children:[(0,A.jsx)(`button`,{className:`${P.iconBtn} ${C?P.iconBtnActive:``}`,onClick:I,title:`Voice input`,children:`🎤`}),(0,A.jsx)(`button`,{className:P.iconBtn,onClick:()=>y.current?.click(),title:`Attach file`,children:`📎`}),(0,A.jsx)(`button`,{className:P.iconBtn,onClick:()=>b.current?.click(),title:`Attach image`,children:`🖼`}),(0,A.jsx)(`input`,{ref:y,type:`file`,style:{display:`none`},onChange:F}),(0,A.jsx)(`input`,{ref:b,type:`file`,accept:`image/*`,style:{display:`none`},onChange:Ee}),(0,A.jsx)(`span`,{style:{flex:1}}),(0,A.jsxs)(`button`,{className:`${P.thinkBtn} ${x?P.thinkBtnOn:``}`,onClick:be,title:`Extended Thinking`,children:[`Think: `,x?`on`:`off`]}),T&&(0,A.jsx)(`button`,{className:P.toolbarBtn,onClick:()=>k(e=>!e),title:`Canvas panel`,children:`▣ Panel`})]}),(0,A.jsxs)(`div`,{className:P.inputRow,children:[(0,A.jsx)(`textarea`,{ref:pe,className:P.input,value:l,onChange:e=>u(e.target.value),onKeyDown:Ae,placeholder:e(`chat.placeholder`),rows:1,disabled:d}),d?(0,A.jsxs)(`button`,{className:`${P.btn} ${P.stop}`,onClick:ke,children:[`■ `,e(`chat.stopGeneration`)]}):(0,A.jsx)(`button`,{className:`${P.btn} ${P.send}`,onClick:L,disabled:!l.trim()&&!m&&!g,children:`Send ↵`})]})]})]}),re&&T&&(0,A.jsxs)(`div`,{className:P.canvasPanel,children:[(0,A.jsxs)(`div`,{className:P.canvasPanelHeader,children:[(0,A.jsx)(`span`,{children:`Canvas`}),(0,A.jsxs)(`div`,{className:P.canvasPanelActions,children:[(0,A.jsx)(`button`,{className:P.canvasPanelBtn,onClick:()=>{let e=new Blob([T],{type:`text/html`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`NHA-Canvas.html`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),5e3)},children:`↓ Download`}),(0,A.jsx)(`button`,{className:P.canvasPanelBtn,onClick:()=>navigator.clipboard.writeText(T).catch(()=>{}),children:`Copy HTML`}),(0,A.jsx)(`button`,{className:P.canvasPanelClose,onClick:()=>k(!1),children:`×`})]})]}),(0,A.jsx)(`iframe`,{className:P.canvasFrame,sandbox:`allow-scripts`,srcDoc:T,title:`Canvas`})]})]})}var F={root:`_root_9i4o7_1`,header:`_header_9i4o7_8`,headerLeft:`_headerLeft_9i4o7_19`,title:`_title_9i4o7_21`,subtitle:`_subtitle_9i4o7_28`,headerActions:`_headerActions_9i4o7_34`,tokenBar:`_tokenBar_9i4o7_41`,tokIn:`_tokIn_9i4o7_49`,tokOut:`_tokOut_9i4o7_50`,tokTotal:`_tokTotal_9i4o7_51`,tokDim:`_tokDim_9i4o7_52`,sessionsBtn:`_sessionsBtn_9i4o7_54`,pdfBtn:`_pdfBtn_9i4o7_66`,clearBtn:`_clearBtn_9i4o7_76`,sessionsDrawer:`_sessionsDrawer_9i4o7_89`,noSessions:`_noSessions_9i4o7_104`,sessionItem:`_sessionItem_9i4o7_111`,sessionInfo:`_sessionInfo_9i4o7_121`,sessionTask:`_sessionTask_9i4o7_127`,sessionMeta:`_sessionMeta_9i4o7_137`,sessionBtns:`_sessionBtns_9i4o7_143`,importBtn:`_importBtn_9i4o7_149`,delSessionBtn:`_delSessionBtn_9i4o7_159`,sessionsFooter:`_sessionsFooter_9i4o7_169`,clearAllSessionsBtn:`_clearAllSessionsBtn_9i4o7_176`,inputArea:`_inputArea_9i4o7_189`,inputRow:`_inputRow_9i4o7_198`,taskInput:`_taskInput_9i4o7_204`,inputControls:`_inputControls_9i4o7_219`,runBtn:`_runBtn_9i4o7_225`,stopBtn:`_stopBtn_9i4o7_238`,attachBtn:`_attachBtn_9i4o7_249`,attachBadge:`_attachBadge_9i4o7_262`,clearAttach:`_clearAttach_9i4o7_275`,examples:`_examples_9i4o7_284`,exampleBtn:`_exampleBtn_9i4o7_290`,body:`_body_9i4o7_308`,agentChip:`_agentChip_9i4o7_321`,chip_running:`_chip_running_9i4o7_332`,charCardPulse:`_charCardPulse_9i4o7_1`,chip_done:`_chip_done_9i4o7_338`,chip_error:`_chip_error_9i4o7_339`,chip_waiting:`_chip_waiting_9i4o7_340`,chipIcon:`_chipIcon_9i4o7_341`,chipLabel:`_chipLabel_9i4o7_342`,chipDots:`_chipDots_9i4o7_343`,chipCheck:`_chipCheck_9i4o7_344`,chipErr:`_chipErr_9i4o7_345`,officeSceneWrap:`_officeSceneWrap_9i4o7_348`,pipeline:`_pipeline_9i4o7_358`,pipelineWrap:`_pipelineWrap_9i4o7_373`,pipelineRunning:`_pipelineRunning_9i4o7_383`,scanSweep:`_scanSweep_9i4o7_1`,pipelineTitle:`_pipelineTitle_9i4o7_409`,pipelineNodes:`_pipelineNodes_9i4o7_417`,pipelineStep:`_pipelineStep_9i4o7_424`,arrow:`_arrow_9i4o7_430`,arrowActive:`_arrowActive_9i4o7_439`,arrowPulse:`_arrowPulse_9i4o7_1`,agentChar:`_agentChar_9i4o7_451`,charWaiting:`_charWaiting_9i4o7_466`,charActive:`_charActive_9i4o7_471`,charDone:`_charDone_9i4o7_479`,charError:`_charError_9i4o7_484`,orbitRing1:`_orbitRing1_9i4o7_495`,orbitRing2:`_orbitRing2_9i4o7_496`,orbitSpin1:`_orbitSpin1_9i4o7_1`,orbitSpin2:`_orbitSpin2_9i4o7_1`,charAvatar:`_charAvatar_9i4o7_542`,charIcon:`_charIcon_9i4o7_557`,iconBob:`_iconBob_9i4o7_1`,charCheck:`_charCheck_9i4o7_574`,badgePop:`_badgePop_9i4o7_1`,charErr:`_charErr_9i4o7_484`,charPulse:`_charPulse_9i4o7_618`,charPulse2:`_charPulse2_9i4o7_619`,expandRing:`_expandRing_9i4o7_1`,charLabel:`_charLabel_9i4o7_638`,charStatus:`_charStatus_9i4o7_650`,charStatusDots:`_charStatusDots_9i4o7_663`,dot1:`_dot1_9i4o7_664`,dot2:`_dot2_9i4o7_664`,dot3:`_dot3_9i4o7_664`,dotFade:`_dotFade_9i4o7_1`,twoCol:`_twoCol_9i4o7_678`,panelTitle:`_panelTitle_9i4o7_685`,logPanel:`_logPanel_9i4o7_695`,logBody:`_logBody_9i4o7_707`,logEntry:`_logEntry_9i4o7_715`,logTime:`_logTime_9i4o7_725`,logIcon:`_logIcon_9i4o7_726`,logAgent:`_logAgent_9i4o7_727`,logText:`_logText_9i4o7_728`,log_system:`_log_system_9i4o7_730`,log_error:`_log_error_9i4o7_731`,liveOutputPanel:`_liveOutputPanel_9i4o7_734`,liveBlock:`_liveBlock_9i4o7_741`,blockSlideIn:`_blockSlideIn_9i4o7_1`,liveBlockActive:`_liveBlockActive_9i4o7_755`,liveBlockScan:`_liveBlockScan_9i4o7_1`,liveBlockHeader:`_liveBlockHeader_9i4o7_780`,liveBlockIcon:`_liveBlockIcon_9i4o7_789`,liveBlockLabel:`_liveBlockLabel_9i4o7_791`,outputStatus:`_outputStatus_9i4o7_799`,status_done:`_status_done_9i4o7_810`,status_running:`_status_running_9i4o7_811`,status_error:`_status_error_9i4o7_812`,status_waiting:`_status_waiting_9i4o7_813`,liveBlockBody:`_liveBlockBody_9i4o7_816`,liveBlockWorking:`_liveBlockWorking_9i4o7_954`,workingDot:`_workingDot_9i4o7_961`,workingBounce:`_workingBounce_9i4o7_1`,workingLabel:`_workingLabel_9i4o7_978`,workingFade:`_workingFade_9i4o7_1`,studioBlinkCursor:`_studioBlinkCursor_9i4o7_1`,resultAccordion:`_resultAccordion_9i4o7_1007`,resultAccordionSummary:`_resultAccordionSummary_9i4o7_1014`,resultAccordionBody:`_resultAccordionBody_9i4o7_1031`,financeSection:`_financeSection_9i4o7_1065`,financeSectionTitle:`_financeSectionTitle_9i4o7_1073`,financePresets:`_financePresets_9i4o7_1082`,financeBtn:`_financeBtn_9i4o7_1088`,canvasToggleBtn:`_canvasToggleBtn_9i4o7_1106`,canvasPanel:`_canvasPanel_9i4o7_1122`,canvasPanelHeader:`_canvasPanelHeader_9i4o7_1137`,canvasPanelActions:`_canvasPanelActions_9i4o7_1149`,canvasPanelBtn:`_canvasPanelBtn_9i4o7_1155`,canvasPanelClose:`_canvasPanelClose_9i4o7_1167`,canvasFrame:`_canvasFrame_9i4o7_1178`,pipelineLiveTag:`_pipelineLiveTag_9i4o7_1186`,liveTagBlink:`_liveTagBlink_9i4o7_1`,reasonRow:`_reasonRow_9i4o7_1200`,reasonChip:`_reasonChip_9i4o7_1209`,reasonIcon:`_reasonIcon_9i4o7_1222`,reasonText:`_reasonText_9i4o7_1223`,liveBlockReason:`_liveBlockReason_9i4o7_1226`,councilWrapper:`_councilWrapper_9i4o7_1236`,councilPanel:`_councilPanel_9i4o7_1241`,councilHeader:`_councilHeader_9i4o7_1249`,councilHeaderLeft:`_councilHeaderLeft_9i4o7_1260`,councilHeaderRight:`_councilHeaderRight_9i4o7_1266`,councilIcon:`_councilIcon_9i4o7_1272`,councilTitle:`_councilTitle_9i4o7_1274`,councilConvergedBadge:`_councilConvergedBadge_9i4o7_1283`,councilDivergedBadge:`_councilDivergedBadge_9i4o7_1295`,councilPhaseTag:`_councilPhaseTag_9i4o7_1307`,councilPhaseActive:`_councilPhaseActive_9i4o7_1313`,phaseGlow:`_phaseGlow_9i4o7_1`,councilPhaseDone:`_councilPhaseDone_9i4o7_1322`,councilMetrics:`_councilMetrics_9i4o7_1325`,convRow:`_convRow_9i4o7_1333`,convLabel:`_convLabel_9i4o7_1339`,convTrack:`_convTrack_9i4o7_1347`,convFill:`_convFill_9i4o7_1355`,convPct:`_convPct_9i4o7_1361`,councilNodes:`_councilNodes_9i4o7_1371`,councilSectionTitle:`_councilSectionTitle_9i4o7_1376`,councilNode:`_councilNode_9i4o7_1371`,councilNodeHeader:`_councilNodeHeader_9i4o7_1393`,councilNodeIcon:`_councilNodeIcon_9i4o7_1406`,councilNodeLabel:`_councilNodeLabel_9i4o7_1407`,councilNodeToggle:`_councilNodeToggle_9i4o7_1408`,councilNodeBody:`_councilNodeBody_9i4o7_1410`,councilSynthesis:`_councilSynthesis_9i4o7_1420`,councilSynthesisHeader:`_councilSynthesisHeader_9i4o7_1424`,heraldIcon:`_heraldIcon_9i4o7_1433`,heraldLabel:`_heraldLabel_9i4o7_1435`,heraldStreaming:`_heraldStreaming_9i4o7_1443`,councilSynthesisBody:`_councilSynthesisBody_9i4o7_1445`,councilSkipped:`_councilSkipped_9i4o7_1475`,councilSkipIcon:`_councilSkipIcon_9i4o7_1486`,charSpriteRunning:`_charSpriteRunning_9i4o7_1499`,spriteWalk:`_spriteWalk_9i4o7_1`,charSpriteDone:`_charSpriteDone_9i4o7_1508`,charScanline:`_charScanline_9i4o7_1512`,scanlineScroll:`_scanlineScroll_9i4o7_1`,auraAnim:`_auraAnim_9i4o7_1532`,auraGlow:`_auraGlow_9i4o7_1`,parliamentPrompt:`_parliamentPrompt_9i4o7_1539`,parliamentPromptIcon:`_parliamentPromptIcon_9i4o7_1549`,parliamentPromptContent:`_parliamentPromptContent_9i4o7_1550`,parliamentPromptTitle:`_parliamentPromptTitle_9i4o7_1551`,parliamentPromptDesc:`_parliamentPromptDesc_9i4o7_1552`,parliamentPromptMeta:`_parliamentPromptMeta_9i4o7_1553`,parliamentPromptBtns:`_parliamentPromptBtns_9i4o7_1554`,parliamentActivateBtn:`_parliamentActivateBtn_9i4o7_1555`,parliamentSkipBtn:`_parliamentSkipBtn_9i4o7_1562`,panelTabs:`_panelTabs_9i4o7_1570`,panelTabBtn:`_panelTabBtn_9i4o7_1571`,panelTabActive:`_panelTabActive_9i4o7_1578`,panelEmpty:`_panelEmpty_9i4o7_1580`,browserPanel:`_browserPanel_9i4o7_1589`,browserBar:`_browserBar_9i4o7_1590`,browserInput:`_browserInput_9i4o7_1591`,browserGo:`_browserGo_9i4o7_1598`,liveBlockClickable:`_liveBlockClickable_9i4o7_1605`,liveBlockBodyClamped:`_liveBlockBodyClamped_9i4o7_1614`,expandHint:`_expandHint_9i4o7_1621`,blockModalOverlay:`_blockModalOverlay_9i4o7_1630`,blockModal:`_blockModal_9i4o7_1630`,blockModalHeader:`_blockModalHeader_9i4o7_1655`,blockModalTitle:`_blockModalTitle_9i4o7_1665`,blockModalClose:`_blockModalClose_9i4o7_1673`,blockModalBody:`_blockModalBody_9i4o7_1685`,panel:`_panel_9i4o7_685`,streamPanel:`_streamPanel_9i4o7_1714`,canvasArea:`_canvasArea_9i4o7_1716`,resetBtn:`_resetBtn_9i4o7_1741`,accordionSection:`_accordionSection_9i4o7_1748`},Ee=[{label:`📈 Full Trading Strategy`,task:`You are a team of senior quantitative analysts and macro traders. Build a complete, actionable trading strategy with the following structure:
|
|
66
|
-
|
|
67
|
-
1. MACRO REGIME ANALYSIS
|
|
68
|
-
- Current macro cycle phase (expansion/peak/contraction/trough) with supporting indicators (yield curve, PMI, CPI trajectory, Fed/ECB policy stance)
|
|
69
|
-
- Dominant regime factors: risk-on vs risk-off, dollar strength, credit spreads, volatility regime (VIX term structure)
|
|
70
|
-
- Identify the 3 most important macro catalysts in the next 30-90 days
|
|
71
|
-
|
|
72
|
-
2. CROSS-ASSET OPPORTUNITY SCAN
|
|
73
|
-
- Equities: sector rotation signals, momentum vs value regime, earnings revision trends, relative strength leaders
|
|
74
|
-
- Fixed Income: duration trade setups, credit spread plays, EM vs DM bonds
|
|
75
|
-
- Commodities: energy (oil/gas), metals (gold/copper/silver), agricultural - trend and mean-reversion setups
|
|
76
|
-
- Crypto: BTC/ETH cycle positioning, on-chain signals interpretation, altcoin relative strength
|
|
77
|
-
- FX: major pair setups (EUR/USD, USD/JPY, GBP/USD), carry trade opportunities
|
|
78
|
-
|
|
79
|
-
3. TOP 5 TRADE IDEAS (for each trade):
|
|
80
|
-
- Asset/Instrument + exact entry zone (support/resistance level or breakout trigger)
|
|
81
|
-
- Stop loss level with rationale (ATR-based or structure-based)
|
|
82
|
-
- Target 1 (conservative) and Target 2 (extended) with R:R ratio
|
|
83
|
-
- Position sizing formula: % of portfolio based on volatility-adjusted Kelly criterion
|
|
84
|
-
- Time horizon and invalidation conditions
|
|
85
|
-
- Correlation with existing positions (portfolio construction note)
|
|
86
|
-
|
|
87
|
-
4. PORTFOLIO CONSTRUCTION
|
|
88
|
-
- Suggested allocation across asset classes given current regime
|
|
89
|
-
- Maximum correlated exposure limits
|
|
90
|
-
- Hedging overlay: tail risk protection via options or inverse ETFs
|
|
91
|
-
- Rebalancing triggers
|
|
92
|
-
|
|
93
|
-
5. RISK SCORECARD
|
|
94
|
-
- Scenario analysis: Bull / Base / Bear outcomes for each trade
|
|
95
|
-
- Aggregate portfolio VaR (95% confidence, 10-day horizon)
|
|
96
|
-
- Maximum drawdown estimate
|
|
97
|
-
- Liquidity risk assessment
|
|
98
|
-
|
|
99
|
-
Provide specific, actionable levels. Use technical analysis (EMA, RSI, MACD, Fibonacci, volume profile), fundamental valuation, and macro positioning data. Be precise and quantitative.`,agents:[{icon:`📰`,agent:`herald`,label:`Herald`,status:`waiting`,output:``},{icon:`💹`,agent:`mercury`,label:`Mercury`,status:`waiting`,output:``},{icon:`📊`,agent:`oracle`,label:`Oracle`,status:`waiting`,output:``},{icon:`⚠️`,agent:`cassandra`,label:`Cassandra`,status:`waiting`,output:``},{icon:`🔥`,agent:`prometheus`,label:`Prometheus`,status:`waiting`,output:``}]},{label:`🏦 Deep Fundamental Analysis`,task:`You are a sell-side equity research team. Produce a comprehensive fundamental analysis report with the following sections:
|
|
100
|
-
|
|
101
|
-
1. BUSINESS MODEL DEEP-DIVE
|
|
102
|
-
- Revenue streams breakdown, unit economics, gross margin drivers
|
|
103
|
-
- Competitive moat: network effects, switching costs, cost advantages, intangibles
|
|
104
|
-
- TAM/SAM/SOM analysis with growth assumptions
|
|
105
|
-
- Management quality: capital allocation track record, insider ownership, compensation structure
|
|
106
|
-
|
|
107
|
-
2. FINANCIAL STATEMENT ANALYSIS
|
|
108
|
-
- 5-year trend analysis: revenue CAGR, margin expansion/compression, FCF conversion
|
|
109
|
-
- Balance sheet quality: debt/EBITDA, interest coverage, current ratio, working capital cycle
|
|
110
|
-
- Cash flow quality: accruals ratio, capex vs D&A, owner earnings calculation
|
|
111
|
-
- Return metrics: ROIC, ROE decomposition (DuPont), ROCE vs WACC spread
|
|
112
|
-
|
|
113
|
-
3. VALUATION (multi-method)
|
|
114
|
-
- DCF: base case, bull case, bear case with explicit assumptions (WACC, terminal growth, margins)
|
|
115
|
-
- Relative valuation: P/E, EV/EBITDA, P/FCF, P/S vs sector and historical mean
|
|
116
|
-
- Sum-of-parts if applicable
|
|
117
|
-
- Reverse DCF: what growth rate is currently priced in?
|
|
118
|
-
|
|
119
|
-
4. CATALYSTS & TIMELINE
|
|
120
|
-
- Near-term (0-3 months): earnings, product launches, regulatory decisions
|
|
121
|
-
- Medium-term (3-12 months): market share gains, margin inflection, M&A
|
|
122
|
-
- Long-term (1-3 years): secular growth drivers, TAM expansion
|
|
123
|
-
|
|
124
|
-
5. RISK MATRIX
|
|
125
|
-
- Bear case risks: competitive threats, regulatory, execution, balance sheet
|
|
126
|
-
- Probability-weighted downside scenario
|
|
127
|
-
- Key metrics to monitor (early warning indicators)
|
|
128
|
-
|
|
129
|
-
6. INVESTMENT RECOMMENDATION
|
|
130
|
-
- Buy / Hold / Sell with conviction level (1-5)
|
|
131
|
-
- Price target (12-month) with methodology
|
|
132
|
-
- Risk/reward asymmetry assessment`,agents:[{icon:`🔍`,agent:`ResearchAgent`,label:`Research`,status:`waiting`,output:``},{icon:`💹`,agent:`mercury`,label:`Mercury`,status:`waiting`,output:``},{icon:`📊`,agent:`oracle`,label:`Oracle`,status:`waiting`,output:``},{icon:`✓`,agent:`veritas`,label:`Veritas`,status:`waiting`,output:``},{icon:`⚠️`,agent:`cassandra`,label:`Cassandra`,status:`waiting`,output:``}]},{label:`📉 Portfolio Risk & Hedging`,task:`You are a risk management team at a hedge fund. Perform a comprehensive portfolio risk assessment:
|
|
133
|
-
|
|
134
|
-
1. RISK FACTOR DECOMPOSITION
|
|
135
|
-
- Identify primary risk factors: market beta, sector exposure, factor tilts (value/growth/momentum/quality/size)
|
|
136
|
-
- Correlation matrix analysis: identify hidden correlations and concentration risks
|
|
137
|
-
- Factor VaR contribution per position
|
|
138
|
-
- Liquidity-adjusted risk (bid-ask spread x position size x days to liquidate)
|
|
139
|
-
|
|
140
|
-
2. TAIL RISK SCENARIOS (Monte Carlo + Historical)
|
|
141
|
-
- 2008 GFC analog: expected drawdown and recovery time
|
|
142
|
-
- 2020 COVID crash analog
|
|
143
|
-
- 2022 rate shock analog (40-year high inflation + aggressive tightening)
|
|
144
|
-
- Custom black swan: China/Taiwan conflict, sovereign debt crisis, dollar collapse
|
|
145
|
-
- Expected Shortfall (CVaR) at 95% and 99% confidence over 1-day, 10-day, 1-month horizons
|
|
146
|
-
|
|
147
|
-
3. DRAWDOWN ANALYTICS
|
|
148
|
-
- Maximum drawdown (MDD) estimate
|
|
149
|
-
- Drawdown duration analysis
|
|
150
|
-
- Calmar ratio, Sterling ratio, Ulcer index
|
|
151
|
-
- Underwater equity curve projection
|
|
152
|
-
|
|
153
|
-
4. HEDGING STRATEGIES (ranked by cost-effectiveness)
|
|
154
|
-
- Equity puts: which strikes/expiries, delta/vega exposure, cost as % of portfolio
|
|
155
|
-
- VIX calls / VXXB as convexity hedge
|
|
156
|
-
- Inverse ETFs (SQQQ, SDS) for systematic hedging
|
|
157
|
-
- Gold / BTC as uncorrelated store of value
|
|
158
|
-
- Short duration bonds / T-bills as safe haven
|
|
159
|
-
- FX hedging for currency-exposed positions
|
|
160
|
-
- Dynamic hedging rules: when to increase/decrease hedge ratio
|
|
161
|
-
|
|
162
|
-
5. STRESS TEST REPORT
|
|
163
|
-
- Portfolio PnL under each scenario
|
|
164
|
-
- Hedge effectiveness analysis
|
|
165
|
-
- Optimal hedge ratio calculation (minimum variance hedge)
|
|
166
|
-
|
|
167
|
-
6. RECOMMENDATIONS
|
|
168
|
-
- Current portfolio risk score (1-10)
|
|
169
|
-
- Suggested position sizing adjustments
|
|
170
|
-
- Hedge implementation priority list with specific instruments and sizing`,agents:[{icon:`⚠️`,agent:`cassandra`,label:`Cassandra`,status:`waiting`,output:``},{icon:`📊`,agent:`oracle`,label:`Oracle`,status:`waiting`,output:``},{icon:`💹`,agent:`mercury`,label:`Mercury`,status:`waiting`,output:``},{icon:`🔥`,agent:`prometheus`,label:`Prometheus`,status:`waiting`,output:``}]},{label:`🔎 Sector Deep Dive`,task:`You are a specialized sector research team. Conduct an exhaustive sector analysis:
|
|
171
|
-
|
|
172
|
-
1. SECTOR MACRO POSITIONING
|
|
173
|
-
- Where are we in the sector cycle? (early/mid/late cycle characteristics)
|
|
174
|
-
- Relative performance vs S&P 500 (52-week, YTD, 3-year): momentum score
|
|
175
|
-
- Institutional positioning: 13F filings trends, fund flows, short interest
|
|
176
|
-
- Earnings revision momentum: breadth of upgrades vs downgrades
|
|
177
|
-
|
|
178
|
-
2. STRUCTURAL TRENDS & DISRUPTION
|
|
179
|
-
- Secular tailwinds (5-10 year): technology disruption, demographic shifts, regulatory changes
|
|
180
|
-
- Secular headwinds and risk of disruption
|
|
181
|
-
- Innovation S-curve positioning: is the sector in early adoption, mass market, or saturation?
|
|
182
|
-
|
|
183
|
-
3. COMPETITIVE LANDSCAPE
|
|
184
|
-
- Top 10 companies by market cap with key metrics (P/E, EV/EBITDA, revenue growth, margins, ROIC)
|
|
185
|
-
- Market share dynamics: gainers vs losers
|
|
186
|
-
- M&A activity: consolidation trends, premium paid in recent deals
|
|
187
|
-
- Barrier to entry assessment
|
|
188
|
-
|
|
189
|
-
4. VALUATION COMPARISON
|
|
190
|
-
- Sector P/E, P/S, EV/EBITDA vs 5-year and 10-year historical average
|
|
191
|
-
- Sector vs market relative valuation (premium/discount)
|
|
192
|
-
- Sub-sector valuation dispersion (identify cheap vs expensive pockets)
|
|
193
|
-
|
|
194
|
-
5. TECHNICAL SECTOR SETUP
|
|
195
|
-
- Sector ETF technical analysis (weekly chart): trend, key levels, RSI, MACD
|
|
196
|
-
- Breadth indicators: % of stocks above 200-day MA, new highs vs new lows
|
|
197
|
-
- Seasonal patterns
|
|
198
|
-
|
|
199
|
-
6. INVESTMENT CONCLUSION
|
|
200
|
-
- Overweight / Underweight / Neutral recommendation
|
|
201
|
-
- Top 3 stock picks within the sector with brief thesis
|
|
202
|
-
- Key risks to the thesis
|
|
203
|
-
- Monitoring checklist (metrics and triggers to reassess)`,agents:[{icon:`📰`,agent:`herald`,label:`Herald`,status:`waiting`,output:``},{icon:`🔍`,agent:`ResearchAgent`,label:`Research`,status:`waiting`,output:``},{icon:`💹`,agent:`mercury`,label:`Mercury`,status:`waiting`,output:``},{icon:`🧠`,agent:`athena`,label:`Athena`,status:`waiting`,output:``},{icon:`✓`,agent:`veritas`,label:`Veritas`,status:`waiting`,output:``}]},{label:`₿ Crypto Market Analysis`,task:`You are a crypto-native research team combining on-chain analytics, macro, and technical analysis:
|
|
204
|
-
|
|
205
|
-
1. BITCOIN CYCLE POSITIONING
|
|
206
|
-
- Current halving cycle phase (days since last halving, historical cycle comparison)
|
|
207
|
-
- Key on-chain metrics: NUPL (Net Unrealized Profit/Loss), MVRV Z-Score, Stock-to-Flow deviation, Puell Multiple
|
|
208
|
-
- Realized price vs market price spread
|
|
209
|
-
- Long-term holder vs short-term holder supply dynamics
|
|
210
|
-
- Miner health: hash rate trend, miner revenue, potential capitulation signals
|
|
211
|
-
|
|
212
|
-
2. MACRO-CRYPTO CORRELATION
|
|
213
|
-
- BTC beta vs NASDAQ, gold, DXY (90-day rolling correlation)
|
|
214
|
-
- Liquidity cycle analysis: global M2, Fed balance sheet, crypto market cap
|
|
215
|
-
- Institutional adoption metrics: ETF flows, CME futures OI, Grayscale premium/discount
|
|
216
|
-
- Stablecoin supply as dry powder indicator
|
|
217
|
-
|
|
218
|
-
3. ALTCOIN RELATIVE STRENGTH
|
|
219
|
-
- BTC dominance trend: rotation signals into altcoins
|
|
220
|
-
- ETH/BTC ratio: layer-1 sentiment
|
|
221
|
-
- DeFi TVL trends, DEX volume, lending protocol health
|
|
222
|
-
- Top performing sectors: AI tokens, RWA, gaming, L2s — momentum ranking
|
|
223
|
-
|
|
224
|
-
4. TECHNICAL STRUCTURE
|
|
225
|
-
- BTC weekly chart: key support/resistance, Fibonacci levels, Elliott Wave count
|
|
226
|
-
- Market structure: higher highs/lows or lower highs/lows
|
|
227
|
-
- Funding rates: long/short squeeze risk
|
|
228
|
-
- Open interest: leverage buildup and liquidation heatmap analysis
|
|
229
|
-
- Fear & Greed Index trend
|
|
230
|
-
|
|
231
|
-
5. TRADE SETUPS
|
|
232
|
-
- BTC: spot accumulation zone, swing trade levels, invalidation
|
|
233
|
-
- ETH: setup and ETH/BTC pair trade
|
|
234
|
-
- Top 3 altcoin opportunities with asymmetric risk/reward
|
|
235
|
-
- Avoid list: overvalued, low liquidity, high risk coins
|
|
236
|
-
|
|
237
|
-
6. PORTFOLIO ALLOCATION
|
|
238
|
-
- Suggested BTC/ETH/Alts ratio for current cycle phase
|
|
239
|
-
- Position sizing given crypto's volatility profile
|
|
240
|
-
- DCA vs lump sum decision framework
|
|
241
|
-
- Exit strategy: profit-taking levels at different cycle stages`,agents:[{icon:`📰`,agent:`herald`,label:`Herald`,status:`waiting`,output:``},{icon:`💹`,agent:`mercury`,label:`Mercury`,status:`waiting`,output:``},{icon:`📊`,agent:`oracle`,label:`Oracle`,status:`waiting`,output:``},{icon:`⚠️`,agent:`cassandra`,label:`Cassandra`,status:`waiting`,output:``},{icon:`🔥`,agent:`prometheus`,label:`Prometheus`,status:`waiting`,output:``}]},{label:`📊 Quant Factor Analysis`,task:`You are a quantitative research team specializing in factor investing and systematic strategies:
|
|
242
|
-
|
|
243
|
-
1. CURRENT FACTOR PERFORMANCE ATTRIBUTION
|
|
244
|
-
- Which factors are winning right now? Rank: Value, Momentum, Quality, Low Volatility, Size, Growth
|
|
245
|
-
- Factor cycle analysis: which part of the factor cycle are we in?
|
|
246
|
-
- Cross-factor correlations and factor crowding risk
|
|
247
|
-
- Smart beta ETF flows as factor sentiment indicator
|
|
248
|
-
|
|
249
|
-
2. MOMENTUM STRATEGY ANALYSIS
|
|
250
|
-
- Cross-sectional momentum: 12-1 month returns, risk-adjusted momentum score
|
|
251
|
-
- Time-series momentum (trend following): 200-day MA crossovers across assets
|
|
252
|
-
- Momentum crash risk: conditions that precede reversals (high dispersion + high volatility = danger)
|
|
253
|
-
- Optimal momentum lookback period for current regime
|
|
254
|
-
|
|
255
|
-
3. VALUE FACTOR
|
|
256
|
-
- Current value spread: cheap vs expensive quintile valuation gap (historical percentile)
|
|
257
|
-
- Value in different asset classes: equities, credit, currencies
|
|
258
|
-
- Value + Momentum combination: avoiding value traps
|
|
259
|
-
|
|
260
|
-
4. VOLATILITY & OPTIONS STRATEGIES
|
|
261
|
-
- Implied vs realized volatility spread: premium capture opportunities
|
|
262
|
-
- Volatility surface analysis: term structure contango/backwardation
|
|
263
|
-
- Optimal options strategies for current vol regime: covered calls, cash-secured puts, spreads, straddles
|
|
264
|
-
- VIX seasonality and mean-reversion signals
|
|
265
|
-
|
|
266
|
-
5. SYSTEMATIC STRATEGY BLUEPRINTS
|
|
267
|
-
- Trend-following CTA strategy: universe, entry/exit signals, position sizing (ATR-based), portfolio construction
|
|
268
|
-
- Statistical arbitrage setup: pairs trading opportunities with cointegration test results
|
|
269
|
-
- Carry trade: yield differential ranking across G10 currencies and EM
|
|
270
|
-
- Risk parity allocation: equal risk contribution across asset classes
|
|
271
|
-
|
|
272
|
-
6. BACKTESTING ASSUMPTIONS & EDGE
|
|
273
|
-
- Expected Sharpe ratio for each strategy (realistic, after costs)
|
|
274
|
-
- Maximum drawdown and recovery expectations
|
|
275
|
-
- Strategy capacity (AUM limits before alpha decay)
|
|
276
|
-
- Implementation costs: slippage, market impact, transaction costs
|
|
277
|
-
- Key risks: overfitting, regime change, crowding`,agents:[{icon:`📊`,agent:`oracle`,label:`Oracle`,status:`waiting`,output:``},{icon:`💹`,agent:`mercury`,label:`Mercury`,status:`waiting`,output:``},{icon:`📈`,agent:`edi`,label:`Edi`,status:`waiting`,output:``},{icon:`⚠️`,agent:`cassandra`,label:`Cassandra`,status:`waiting`,output:``},{icon:`🔥`,agent:`prometheus`,label:`Prometheus`,status:`waiting`,output:``}]},{label:`💼 Portfolio Health Check`,task:`You are a multi-asset risk manager and portfolio strategist. Produce a comprehensive weekly health check of the user's portfolio (the actual positions persisted in ~/.nha/portfolio.json). Use the dedicated tools:
|
|
278
|
-
- portfolio_summary: current positions, live P/L, cost basis, totals
|
|
279
|
-
- portfolio_metrics(period="1y"): annualized return, vol, Sharpe, Sortino, max drawdown, beta vs SPY
|
|
280
|
-
- portfolio_var(period="1y", confidence=0.95): daily VaR + Expected Shortfall + 10-day VaR
|
|
281
|
-
- portfolio_correlation(period="1y"): full correlation matrix + concentration pairs
|
|
282
|
-
- portfolio_sector_breakdown: % allocation by sector, country, currency
|
|
283
|
-
- portfolio_rebalance: current vs target weights drift + exact trades to bring back in line
|
|
284
|
-
- peer_comparison for the TOP 3 positions: side-by-side P/E, P/B, ROE, D/E, dividend yield
|
|
285
|
-
- news_sentiment for each position with weight > 10%: aggregate verdict + key headlines
|
|
286
|
-
- economic_calendar(country="US", days=7): macro events that could move the book
|
|
287
|
-
- market_news(query="Federal Reserve" OR "ECB"): central bank chatter
|
|
288
|
-
|
|
289
|
-
Then produce a structured report:
|
|
290
|
-
|
|
291
|
-
1. EXECUTIVE SUMMARY (3 bullets max) — overall health (green/yellow/red), biggest concentration risk, one concrete action this week.
|
|
292
|
-
2. PERFORMANCE & RISK — YTD vs SPY, Sharpe, max drawdown, beta. Flag Sharpe < 0.5 or beta > 1.3. VaR 95% in $ and %.
|
|
293
|
-
3. DIVERSIFICATION SCORECARD — sector concentration > 35%? unhedged FX > 20%? correlated pairs r > 0.7? effectively independent bets (1/sum(weight²)).
|
|
294
|
-
4. POSITION-BY-POSITION REVIEW — for each holding > 5%: fundamentals snapshot, technical signal, news sentiment, catalyst calendar, verdict HOLD/TRIM/ADD/EXIT with rationale.
|
|
295
|
-
5. REBALANCING PLAN — use portfolio_rebalance output. Sort by absolute drift. Flag tax implications if gain > 30%.
|
|
296
|
-
6. WEEK AHEAD WATCHLIST — macro events, earnings dates, technical levels to monitor.
|
|
297
|
-
7. ONE-LINE BOTTOM LINE — the sentence the user should remember in 30 seconds.
|
|
298
|
-
|
|
299
|
-
Quantitative. Numbers. No vague platitudes.`,agents:[{icon:`💼`,agent:`oracle`,label:`Oracle`,status:`waiting`,output:``},{icon:`⚠️`,agent:`cassandra`,label:`Cassandra`,status:`waiting`,output:``},{icon:`💹`,agent:`mercury`,label:`Mercury`,status:`waiting`,output:``},{icon:`📰`,agent:`herald`,label:`Herald`,status:`waiting`,output:``},{icon:`🔥`,agent:`prometheus`,label:`Prometheus`,status:`waiting`,output:``}]},{label:`📊 Earnings Preview — Week Ahead`,task:`You are an earnings strategist. For each ticker the user names (or the most-watched names of the week if none): pull earnings_calendar (date + EPS estimate + last 4 surprises), market_indicators (current valuation), peer_comparison (vs industry), options_chain (implied move = straddle / spot × 100), news_sentiment (pre-earnings tone), market_chart period="3mo" (technical setup, RSI, key levels).
|
|
300
|
-
|
|
301
|
-
Then produce:
|
|
302
|
-
1. CONSENSUS vs OPTIONS-IMPLIED MOVE — disagreement is the trade.
|
|
303
|
-
2. SETUP CATEGORIZATION — 🟢 HIGH-CONVICTION LONG (beats + cheap IV + bullish chart) | 🔴 SHORT INTO PRINT (deteriorating + expensive IV) | 🟡 STRADDLE (binary, no directional edge) | ⚪ SKIP.
|
|
304
|
-
3. SIZING & RISK — % of book, stop loss $ and %, hedging idea (peer offset, sector ETF, VIX call).
|
|
305
|
-
4. POST-EARNINGS PLAYBOOK — beats+raises: trail stop to BE at +5%. Misses+solid guidance: fade. Misses+lowers: short reversal. Beats+weak guidance: tactical short.
|
|
306
|
-
|
|
307
|
-
Specific prices. Specific levels.`,agents:[{icon:`💹`,agent:`mercury`,label:`Mercury`,status:`waiting`,output:``},{icon:`💼`,agent:`oracle`,label:`Oracle`,status:`waiting`,output:``},{icon:`📰`,agent:`herald`,label:`Herald`,status:`waiting`,output:``},{icon:`⚠️`,agent:`cassandra`,label:`Cassandra`,status:`waiting`,output:``}]},{label:`🔄 Sector Rotation Scan`,task:`You are a top-down sector strategist. Run a 4-week rotation scan.
|
|
308
|
-
|
|
309
|
-
Data: macro_data(indicator="all") for regime, stock_screener(day_gainers/day_losers, 20 each) for breadth, for each SPDR sector ETF (XLK, XLF, XLE, XLV, XLI, XLP, XLY, XLU, XLB, XLRE, XLC): market_chart period="3mo" + market_indicators. Plus market_news(query="sector rotation") and economic_calendar(country="US", days=14).
|
|
310
|
-
|
|
311
|
-
Report:
|
|
312
|
-
1. MACRO REGIME — cycle phase, risk-on/off, dollar regime, inflation surprise direction.
|
|
313
|
-
2. SECTOR LEADERSHIP TABLE — 11 sectors ranked by 1mo / 3mo / YTD performance, RSI, distance from 50d MA.
|
|
314
|
-
3. CROSS-SECTOR SIGNALS — cyclicals vs defensives (XLI+XLY+XLB vs XLP+XLV+XLU), banks vs gold (XLF vs GLD), energy vs tech (XLE vs XLK), discretionary vs staples (XLY vs XLP).
|
|
315
|
-
4. TACTICAL CALLS — 2 OVERWEIGHT + 2 UNDERWEIGHT with specific ETF + 1-3 leading names + entry zone + invalidation.
|
|
316
|
-
5. KEY RISK — the macro event that breaks the thesis + stop-loss conditions at the ETF level.`,agents:[{icon:`🌍`,agent:`oracle`,label:`Oracle`,status:`waiting`,output:``},{icon:`💹`,agent:`mercury`,label:`Mercury`,status:`waiting`,output:``},{icon:`📊`,agent:`cartographer`,label:`Cartographer`,status:`waiting`,output:``},{icon:`⚠️`,agent:`cassandra`,label:`Cassandra`,status:`waiting`,output:``}]},{label:`🇮🇹 Italian Market Daily Brief`,task:`Sei uno strategist del mercato italiano. Produci il brief giornaliero in italiano. Usa: italian_market(what="all"), macro_data(indicator="indices"), macro_data(indicator="commodities"), market_news(query="Borsa Italiana"), news_sentiment(query="MIB", limit=15), economic_calendar(country="IT", days=5), economic_calendar(country="EU", days=5), earnings_calendar per i top 5 MIB con earnings nei prossimi 14 giorni, peer_comparison per i 3 titoli più mossi.
|
|
317
|
-
|
|
318
|
-
Struttura:
|
|
319
|
-
1. APERTURA in 3 righe — FTSE MIB livello + delta %, tono, notizia dominante.
|
|
320
|
-
2. SETTORI MOTORI E FRENI — top 3 su / top 3 giù + ragione, performance vs DAX e CAC.
|
|
321
|
-
3. TITOLI DA SEGUIRE — 3 movimenti significativi (% + volume + news), 2 breakout/breakdown tecnici da 50d MA.
|
|
322
|
-
4. CONTESTO MACRO ITALIA — spread BTP-Bund, EUR/USD impatto su esportatrici (ENI, STM), BCE/Fed.
|
|
323
|
-
5. EVENTI SETTIMANA — earnings (UCG, ISP, ENI…), dati macro, decisioni politiche.
|
|
324
|
-
6. SENTIMENT — mood stampa, flussi, idea direzionale.
|
|
325
|
-
7. TRADE DEL GIORNO — 1 long + 1 short con entry, stop, target precisi. Sizing in % portafoglio.
|
|
326
|
-
|
|
327
|
-
Tutto quantitativo. Niente "il mercato è cauto" senza numeri.`,agents:[{icon:`🇮🇹`,agent:`oracle`,label:`Oracle`,status:`waiting`,output:``},{icon:`💹`,agent:`mercury`,label:`Mercury`,status:`waiting`,output:``},{icon:`📰`,agent:`herald`,label:`Herald`,status:`waiting`,output:``},{icon:`⚠️`,agent:`cassandra`,label:`Cassandra`,status:`waiting`,output:``}]}],De=`trading strategy.fundamental analysis.portfolio risk.sector deep dive.crypto analysis.quant factor.macro regime.cross-asset.hedge.derivative.yield curve.market_price.market_chart.market_indicators.macro_data.crypto_data.valuation.equity.earnings.dividend.short interest.volatility.options.futures.bitcoin.ethereum`.split(`.`),Oe=[`Analyze my unread emails and create a priority action plan`,`Search the web for AI news today and summarize it in a canvas report`,`Check my calendar for this week and suggest how to optimize my schedule`,`Review my GitHub notifications and draft responses to open issues`,`Search for information about a topic, fact-check it, and write a report`],I={bg:`#0a0d14`,wall:`#0d1117`,wallStripe:`#0f1520`,baseboard:`#1e293b`,floorA:`#111827`,floorB:`#141c2b`,floorLine:`#1e293b`,ceiling:`#0b0f18`,lampBody:`#854d0e`,lampGlow:`#fef08a`,partition:`#1a2436`,partitionH:`#253347`,partitionT:`#2d4a6e`,deskTop:`#2d4263`,deskFace:`#1e3352`,deskSide:`#192b43`,deskLeg:`#0f1e30`,monBody:`#0f172a`,monFace:`#162032`,monScrIdle:`#060b12`,monScrOn:`#001208`,monScrDone:`#001a08`,monStand:`#0d1625`,keyboard:`#162032`,chairBack:`#1a3a5c`,chairSeat:`#1e4068`,chairLeg:`#0f1e30`,plant1:`#14532d`,plant2:`#166534`,pot:`#78350f`,cup:`#7c2d12`,paper:`#e2e8f0`,paperLine:`#94a3b8`,skin:[`#f5c97a`,`#fbbf24`,`#fca5a5`,`#86efac`,`#a5f3fc`,`#c4b5fd`,`#fde68a`,`#f9a8d4`],shirt:[`#1e40af`,`#065f46`,`#312e81`,`#be123c`,`#164e63`,`#7c3aed`,`#7f1d1d`,`#0e7490`],hair:[`#7c3aed`,`#92400e`,`#1e293b`,`#6b21a8`,`#78350f`,`#292524`,`#422006`,`#0c4a6e`],pants:`#1e293b`,shoes:`#0f172a`,cSkin:`#fbbf24`,cShirt:`#4f46e5`,cHair:`#111827`,cTie:`#dc2626`,cPants:`#1e293b`,cShoes:`#0f172a`,cBag:`#78350f`,green:`#22c55e`,greenDim:`#14532d`,cyan:`#67e8f9`,purple:`#a78bfa`,red:`#ef4444`,amber:`#fbbf24`,dim:`#334155`,white:`#f1f5f9`,bubbleBg:`#0f172a`,bubbleBdr:`#334155`},L=2,ke=1200,Ae=140,je=ke*L,Me=Ae*L,Ne=Math.round(Ae*.78),Pe=130,Fe=14,Ie=Ne-Fe-2,Le=8,Re=36;function R(e,t,n,r,i=1,a=1){e.fillStyle=t,e.fillRect(n*L,r*L,i*L,a*L)}function ze(e){R(e,I.ceiling,0,0,ke,7);for(let t=0;t<ke;t++)R(e,t%20<10?I.wall:I.wallStripe,t,7,1,Ne-7);R(e,I.baseboard,0,Ne-3,ke,3);for(let t=0;t<ke;t+=14)for(let n=Ne;n<Ae;n+=7)R(e,(Math.floor(t/14)+Math.floor((n-Ne)/7))%2==0?I.floorA:I.floorB,t,n,14,7),R(e,I.floorLine,t,n,14,1),R(e,I.floorLine,t,n,1,7);for(let t=40;t<ke;t+=120){R(e,I.lampBody,t,1,40,4),R(e,I.lampGlow,t+2,2,36,2);for(let n=0;n<18;n++)e.fillStyle=`rgba(254,240,138,${(.06-n*.003).toFixed(4)})`,e.fillRect((t+20-n*1.1)*L,(5+n)*L,n*2.2*L,L)}}function Be(e,t,n,r){let i=t.x,a=t.status===`running`,o=t.status===`done`,s=t.status===`error`,c=Math.abs(n-(i+Pe/2))<30;a&&(e.fillStyle=`rgba(99,102,241,0.09)`,e.fillRect(i*L,10*L,Pe*L,(Ae-10)*L)),o&&(e.fillStyle=`rgba(34,197,94,0.05)`,e.fillRect(i*L,10*L,Pe*L,(Ae-10)*L));let l=Ne-8;R(e,I.partition,i,8,3,l),R(e,I.partitionH,i+1,8,2,l),R(e,I.partition,i+Pe,8,3,l),R(e,a?I.partitionT:o?`#1a3a2e`:s?`#3a1a1a`:I.partitionH,i,8,Pe+3,4),R(e,`#0f172a`,i+5,14,16,10),R(e,`#162032`,i+6,15,14,3),a?(R(e,I.green,i+7,19,11,1),R(e,I.greenDim,i+7,21,12,1)):o?(R(e,I.green,i+7,18,12,1),R(e,I.green,i+7,20,9,1),R(e,I.green,i+7,22,11,1)):(R(e,I.dim,i+7,19,10,1),R(e,I.dim,i+7,21,7,1));let u=i+Pe-14;R(e,I.pot,u+2,Ie+Fe-5,7,5),R(e,I.plant1,u,Ie+Fe-13,10,8),R(e,I.plant2,u+2,Ie+Fe-17,6,5),R(e,I.plant2,u-2,Ie+Fe-12,5,4),R(e,I.plant2,u+7,Ie+Fe-13,5,4),R(e,I.deskTop,i+4,Ie,Pe-6,3),R(e,I.deskFace,i+4,Ie+3,Pe-6,Fe-3),R(e,I.deskSide,i+4,Ie+Fe,Pe-6,3);let d=Ne-Ie-Fe-3;R(e,I.deskLeg,i+8,Ie+Fe+3,4,d),R(e,I.deskLeg,i+Pe-10,Ie+Fe+3,4,d);let f=i+14,p=Ie-18;if(R(e,I.monBody,f,p,22,14),R(e,I.monFace,f+1,p+1,20,12),R(e,a?I.monScrOn:o?I.monScrDone:I.monScrIdle,f+2,p+2,18,8),a)for(let t=0;t<3;t++){let n=3+Math.floor((r/90+t*5)%12);R(e,I.green,f+3,p+3+t*2,n,1),R(e,I.greenDim,f+3+n,p+3+t*2,12-n,1)}else o?(R(e,I.green,f+3,p+3,10,1),R(e,I.green,f+3,p+5,8,1),R(e,I.green,f+3,p+7,9,1),R(e,I.green,f+13,p+3,2,4)):s?(R(e,I.red,f+8,p+2,4,6),R(e,I.red,f+8,p+9,4,2)):(R(e,I.dim,f+3,p+3,12,1),R(e,I.dim,f+3,p+5,8,1),R(e,I.dim,f+3,p+7,10,1));R(e,I.monStand,f+8,p+14,4,3),R(e,I.monStand,f+5,p+17,10,1),R(e,I.keyboard,f-1,Ie+1,16,4);for(let t=0;t<5;t++)R(e,I.monFace,f+t*3,Ie+2,2,2);R(e,I.cup,i+7,Ie+2,5,5),R(e,`#92400e`,i+12,Ie+4,2,3),R(e,I.paper,i+52,Ie+2,12,7),R(e,I.paper,i+54,Ie+1,12,7),R(e,I.paperLine,i+56,Ie+3,7,1),R(e,I.paperLine,i+56,Ie+5,5,1),R(e,I.chairBack,i+Pe/2-12,Ne-20,24,3),R(e,I.chairSeat,i+Pe/2-13,Ne-14,26,8),R(e,I.chairLeg,i+Pe/2-8,Ne-6,4,6),R(e,I.chairLeg,i+Pe/2+5,Ne-6,4,6),Ve(e,t,i+Pe/2-8,Ne-Re,a,c,r);let m=a?I.cyan:o?I.green:s?I.red:I.dim;e.font=`bold ${4*L}px monospace`,e.fillStyle=m,e.textBaseline=`alphabetic`;let h=t.label.length>14?t.label.slice(0,13)+`…`:t.label;e.fillText(h,(i+4)*L,8*L),R(e,m,i+Pe-4,9,4,4),a&&Math.floor(r/250)%2==0&&R(e,I.white,i+Pe-3,10,2,2)}function Ve(e,t,n,r,i,a,o){let s=I.skin[t.skinIdx],c=I.shirt[t.shirtIdx],l=I.hair[t.hairIdx],u=i&&!a?Math.floor(o/700)%2:0;R(e,l,n+1,r+u,12,3),R(e,l,n,r+1+u,14,2),R(e,l,n,r+3+u,2,5),R(e,l,n+12,r+3+u,2,5),R(e,s,n+1,r+3+u,12,9);let d=l;R(e,d,n+2,r+4+u,3,1),R(e,d,n+9,r+4+u,3,1),R(e,`#e2e8f0`,n+2,r+5+u,3,3),R(e,`#e2e8f0`,n+9,r+5+u,3,3);let f=t.skinIdx%2==0?`#1d4ed8`:`#065f46`;if(R(e,f,n+3,r+6+u,2,2),R(e,f,n+10,r+6+u,2,2),R(e,`#0f172a`,n+3,r+7+u,1,1),R(e,`#0f172a`,n+10,r+7+u,1,1),R(e,`#c97a4a`,n+7,r+9+u,1,2),t.status===`done`)R(e,`#991b1b`,n+4,r+11+u,6,1),R(e,`#991b1b`,n+3,r+10+u,1,1),R(e,`#991b1b`,n+10,r+10+u,1,1);else if(t.status===`error`)R(e,`#991b1b`,n+4,r+10+u,6,1),R(e,`#991b1b`,n+3,r+11+u,1,1),R(e,`#991b1b`,n+10,r+11+u,1,1);else if(t.status===`running`){let t=Math.floor(o/250)%2;R(e,`#991b1b`,n+5,r+10+u,4,t?2:1)}else R(e,`#7f1d1d`,n+5,r+11+u,4,1);if(R(e,s,n+4,r+12,6,2),R(e,c,n+1,r+14,14,11),R(e,`#f1f5f9`,n+4,r+14,3,4),R(e,`#f1f5f9`,n+9,r+14,3,4),e.font=`${4*L}px serif`,e.textBaseline=`middle`,e.textAlign=`center`,e.fillText(t.icon,(n+8)*L,(r+19)*L),e.textAlign=`left`,i&&!a){let t=Math.floor(o/120)%2;R(e,c,n-2,r+14,3,9),R(e,s,n-2,r+22-t,3,3),R(e,c,n+15,r+14,3,9),R(e,s,n+15,r+22-(1-t),3,3)}else if(a&&i){let t=Math.floor(o/180)%3;R(e,c,n-2,r+14,3,8),R(e,s,n-2,r+22,3,3),R(e,c,n+15,r+8+t,3,9),R(e,s,n+15,r+5+t,3,4)}else R(e,c,n-2,r+14,3,9),R(e,s,n-2,r+23,3,2),R(e,c,n+15,r+14,3,9),R(e,s,n+15,r+23,3,2);R(e,I.pants,n+2,r+25,5,7),R(e,I.pants,n+9,r+25,5,7),R(e,`#2d3f5f`,n+3,r+29,3,1),R(e,`#2d3f5f`,n+10,r+29,3,1),R(e,I.shoes,n,r+32,7,4),R(e,I.shoes,n+9,r+32,7,4),R(e,`#1e2a3a`,n+1,r+32,5,1),R(e,`#1e2a3a`,n+10,r+32,5,1),e.fillStyle=`rgba(0,0,0,0.35)`,e.beginPath(),e.ellipse((n+8)*L,(Ne-1)*L,9*L,2*L,0,0,Math.PI*2),e.fill()}function He(e){e.papers.length>=6||e.papers.push({x:e.x+20+Math.random()*(Pe-40),y:Ie-4,vx:(Math.random()-.5)*1.5,vy:-1.5-Math.random()*1,rot:Math.random()*360,vrot:(Math.random()-.5)*10,life:0,maxLife:70+Math.random()*40})}function Ue(e){e.papers=e.papers.filter(e=>e.life<e.maxLife);for(let t of e.papers)t.x+=t.vx,t.y+=t.vy,t.vy+=.06,t.rot+=t.vrot,t.life++}function We(e,t){for(let n of t.papers){let t=1-n.life/n.maxLife;e.save(),e.globalAlpha=t,e.translate(n.x*L,n.y*L),e.rotate(n.rot*Math.PI/180),e.fillStyle=I.paper,e.fillRect(-7*L,-5*L,14*L,10*L),e.fillStyle=I.paperLine,e.fillRect(-5*L,-2*L,8*L,L),e.fillRect(-5*L,0,6*L,L),e.restore()}e.globalAlpha=1}var Ge=`ABCDEFGHIJKLMNOPRSTUVWXYZ0123456789!?-_.:`;function Ke(e,t){return t<=0?e:Ge[Math.floor(Math.random()*41)]??e}function qe(e,t,n,r,i,a=110,o=`down`){if(t.length===0)return;e.fillStyle=I.bubbleBg,e.fillRect(r*L,i*L,a*L,36*L),e.strokeStyle=I.bubbleBdr,e.lineWidth=L,e.strokeRect(r*L,i*L,a*L,36*L),e.fillStyle=I.cyan,e.fillRect(r*L,i*L,a*L,L),e.fillStyle=I.bubbleBdr,e.fillRect(r*L,(i+13+5)*L,a*L,L);for(let o=0;o<2;o++){let s=t[(Math.floor(n)+o)%t.length];if(!s)continue;let c=i+5+o*14;e.fillStyle=o%2==0?`#0f172a`:`#111827`,e.fillRect(r*L,c*L,a*L,13*L);let l=n-Math.floor(n),u=s.text.split(``);e.font=`bold ${5*L}px monospace`,e.textBaseline=`middle`;let d=Math.floor(a/7)-1;for(let t=0;t<Math.min(u.length,d);t++){let n=l>.3&&t>u.length*(1-l)?Ke(u[t],3):u[t];e.globalAlpha=l>0&&t>u.length*(1-l)?.5+l*.5:1,e.fillStyle=s.color,e.fillText(n,(r+4+t*7)*L,(c+6)*L)}e.globalAlpha=1}let s=r+a/2;if(e.fillStyle=I.bubbleBdr,o===`down`){let t=i+36;e.fillRect((s-2)*L,t*L,4*L,4*L),e.fillRect((s-3)*L,(t+4)*L,6*L,3*L)}else e.fillRect((s-2)*L,(i-4)*L,4*L,4*L),e.fillRect((s-3)*L,(i-7)*L,6*L,3*L)}function Je(e,t,n,r){let i=Ne-Re-8,a=n%2,o=a===0?2:0,s=a===0?0:2;e.fillStyle=`rgba(0,0,0,0.4)`,e.beginPath(),e.ellipse(t*L,(Ne-1)*L,9*L,2*L,0,0,Math.PI*2),e.fill(),e.save(),e.translate(t*L,0),e.scale(r?1:-1,1),R(e,I.cHair,-4,i,9,3),R(e,I.cHair,-5,i+1,11,2),R(e,I.cHair,-5,i+3,2,3),R(e,I.cHair,5,i+3,2,3),R(e,I.cSkin,-4,i+3,8,7),R(e,`#0f172a`,-2,i+5,2,2),R(e,`#0f172a`,2,i+5,2,2),R(e,`#1d4ed8`,-1,i+6,1,1),R(e,`#1d4ed8`,3,i+6,1,1),R(e,`#7f1d1d`,-2,i+9,5,1),R(e,I.cSkin,-1,i+10,3,2),R(e,I.cShirt,-5,i+12,11,9),R(e,`#3730a3`,-5,i+12,3,5),R(e,`#3730a3`,3,i+12,3,5),R(e,I.cTie,-1,i+12,3,7),R(e,`#f1f5f9`,-2,i+12,1,3),R(e,`#f1f5f9`,2,i+12,1,3),R(e,I.cShirt,-7,i+13,3,9),R(e,I.cSkin,-7,i+21,3,3),R(e,I.cShirt,5,i+13,3,9),R(e,I.cSkin,5,i+21,3,3),R(e,I.cBag,6,i+24,6,4),R(e,`#92400e`,7,i+23,4,1),R(e,I.cPants,-3,i+21+o,5,10),R(e,I.cPants,1,i+21+s,5,10),R(e,I.cShoes,-5,i+29+o,6,3),R(e,I.cShoes,-1,i+29+s,6,3),e.restore()}var Ye=[[{text:`RUNNING WORKFLOW`,color:I.cyan},{text:`DISPATCHING...`,color:I.amber}],[{text:`ORCHESTRATING`,color:I.cyan},{text:`ALL SYSTEMS GO`,color:I.green}],[{text:`AGENT PIPELINE`,color:I.purple},{text:`EXECUTING...`,color:I.cyan}],[{text:`MONITORING ALL`,color:I.amber},{text:`ON SCHEDULE`,color:I.green}]];function Xe(e,t){let n=e.toUpperCase().slice(0,14);return t===`running`?[{text:n,color:I.cyan},{text:`WORKING...`,color:I.green}]:t===`done`?[{text:n,color:I.green},{text:`TASK DONE`,color:I.green}]:t===`error`?[{text:n,color:I.red},{text:`ERR`,color:I.red}]:[{text:n,color:I.dim},{text:`STANDBY`,color:I.dim}]}function Ze({nodes:e,running:t}){let n=(0,_.useRef)(null),r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(e.length===0)return;let t=Math.min(e.length,8)*(Pe+Le)-Le,n=Math.max(6,Math.round((ke-t)/2));if(!r.current)r.current={agents:e.slice(0,8).map((e,t)=>({x:n+t*(Pe+Le),icon:e.icon,label:e.label,status:e.status,skinIdx:t%I.skin.length,shirtIdx:t%I.shirt.length,hairIdx:t%I.hair.length,papers:[],bubbleLines:Xe(e.label,e.status),bubbleScroll:0,bubbleTimer:0})),condX:n+Pe/2,condTargetX:n+Pe/2,condFacing:!0,condFrame:0,condFrameTimer:0,condIdleTimer:0,condBubble:Ye[0],condBubbleScroll:0,condBubbleTimer:0,rafId:0};else{let t=r.current;for(let r=0;r<Math.min(e.length,8);r++){let i=e[r],a=t.agents[r];a?(a.status!==i.status&&(a.status=i.status,a.bubbleLines=Xe(i.label,i.status),a.bubbleScroll=0),a.icon=i.icon,a.label=i.label):t.agents.push({x:n+r*(Pe+Le),icon:i.icon,label:i.label,status:i.status,skinIdx:r%I.skin.length,shirtIdx:r%I.shirt.length,hairIdx:r%I.hair.length,papers:[],bubbleLines:Xe(i.label,i.status),bubbleScroll:0,bubbleTimer:0})}}},[e]),(0,_.useEffect)(()=>{let e=n.current;if(!e)return;let i=e.getContext(`2d`);if(!i||(i.imageSmoothingEnabled=!1,!r.current))return;let a=0,o=0;function s(e){let n=r.current,c=Math.min(e-a,50);a=e;let l=e,u=n.agents.find(e=>e.status===`running`);if(u){let e=u.x+Pe+12,t=u.x-18;n.condTargetX=e<ke-30?e:t,n.condBubbleTimer+=c,n.condBubbleTimer>2e3&&(n.condBubbleTimer=0,n.condBubble=Ye[Math.floor(Math.random()*Ye.length)],n.condBubbleScroll=(n.condBubbleScroll+1)%4)}else if(n.condIdleTimer-=c,n.condIdleTimer<=0){let e=n.agents[Math.floor(Math.random()*n.agents.length)];e&&(n.condTargetX=e.x+Pe/2),n.condIdleTimer=2e3+Math.random()*3e3}let d=n.condTargetX-n.condX;if(Math.abs(d)>1&&(n.condX+=d*(t?.12:.04)*(c/16),n.condFacing=d>0,n.condFrameTimer+=c,n.condFrameTimer>100&&(n.condFrame++,n.condFrameTimer=0)),o+=c,o>200){o=0;for(let e of n.agents)e.status===`running`&&He(e)}for(let e of n.agents)Ue(e);for(let e of n.agents)e.bubbleTimer+=c,e.bubbleTimer>1800&&(e.bubbleTimer=0,e.bubbleScroll=(e.bubbleScroll+1)%4);i.clearRect(0,0,je,Me),ze(i);for(let e of n.agents)Be(i,e,n.condX,l),We(i,e);Je(i,n.condX,n.condFrame,n.condFacing);for(let e of n.agents){if(e.status===`waiting`)continue;let t=Math.min(e.label.length*6+16,90),n=Math.max(e.x+1,Math.min(e.x+(Pe-t)/2,ke-t-2)),r=Ne-Re-36;qe(i,e.bubbleLines,e.bubbleScroll,n,r,t,`down`)}let f=Ne-Re-8-38,p=Math.max(4,Math.min(n.condX-50,ke-106));qe(i,n.condBubble,n.condBubbleScroll,p,f,100,`down`);for(let e=0;e<Me;e+=L*3)i.fillStyle=`rgba(0,0,0,0.04)`,i.fillRect(0,e,je,L);n.rafId=requestAnimationFrame(s)}return r.current.rafId=requestAnimationFrame(s),()=>{r.current&&cancelAnimationFrame(r.current.rafId)}},[t]),e.length===0?null:(0,A.jsx)(`div`,{style:{width:`100%`,lineHeight:0},children:(0,A.jsx)(`canvas`,{ref:n,width:je,height:Me,style:{width:`100%`,height:`auto`,imageRendering:`pixelated`,display:`block`,background:I.bg,boxShadow:`0 0 40px rgba(99,102,241,0.15), inset 0 0 80px rgba(0,0,0,0.4)`}})})}var Qe=[`#f4d4b8`,`#e0a878`,`#c98a5b`,`#9c6b48`,`#7a5238`,`#5a3a26`,`#3d2818`,`#deba90`],$e=[`#dc2626`,`#2563eb`,`#16a34a`,`#7c3aed`,`#f59e0b`,`#0891b2`,`#db2777`,`#475569`],et=[`#1a1a1a`,`#3d2817`,`#6b4423`,`#8b6f47`,`#c9a55c`,`#e4d4a8`,`#6b7280`,`#000000`],tt=[{x:50,y:16},{x:78,y:28},{x:86,y:52},{x:78,y:76},{x:50,y:84},{x:22,y:76},{x:14,y:52},{x:22,y:28}];function nt({agents:e,council:t}){let[n,r]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(!t||t.phase===`idle`||t.phase===`skipped`){r(0);return}let n=Math.min(e.length,tt.length),i=0;r(0);let a=()=>{i++,r(i),i<n&&setTimeout(a,250)},o=setTimeout(a,200);return()=>{clearTimeout(o)}},[t?.phase,e.length]);let[i,a]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(!t||t.phase!==`r2`&&t.phase!==`r3`)return;let n=setInterval(()=>{a(t=>(t+1)%Math.max(1,e.length))},2e3);return()=>clearInterval(n)},[t?.phase,e.length]);let o=t?.phase===`r2`?`Round 2 — Cross-reading (${t.r2Nodes.length}/${e.length})`:t?.phase===`r3`?`Round 3 — HERALD mediazione`:t?.phase===`done`?`Sintesi completata · convergenza ${Math.round((t.r2Convergence||0)*100)}%`:`In attesa…`;return(0,A.jsxs)(`div`,{style:{width:`100%`,height:`100%`,background:`linear-gradient(180deg, #1a1530 0%, #0f0d22 100%)`,position:`relative`,overflow:`hidden`,color:`#fff`,fontFamily:`inherit`},children:[(0,A.jsxs)(`div`,{style:{position:`absolute`,top:8,left:12,right:12,display:`flex`,justifyContent:`space-between`,alignItems:`center`,fontSize:11,letterSpacing:`0.8px`,textTransform:`uppercase`,color:`#a78bfa`,zIndex:10},children:[(0,A.jsx)(`span`,{style:{fontWeight:800},children:`🏛️ Council Room`}),(0,A.jsx)(`span`,{style:{color:`#c4b5fd`},children:o})]}),(0,A.jsxs)(`svg`,{viewBox:`0 0 100 100`,preserveAspectRatio:`none`,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`},children:[(0,A.jsxs)(`defs`,{children:[(0,A.jsxs)(`radialGradient`,{id:`tableGrad`,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,A.jsx)(`stop`,{offset:`0%`,stopColor:`#5b3a8b`}),(0,A.jsx)(`stop`,{offset:`100%`,stopColor:`#2d1d54`})]}),(0,A.jsxs)(`radialGradient`,{id:`floorGrad`,cx:`50%`,cy:`100%`,r:`80%`,children:[(0,A.jsx)(`stop`,{offset:`0%`,stopColor:`#241a3a`}),(0,A.jsx)(`stop`,{offset:`100%`,stopColor:`#15102a`})]})]}),(0,A.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`100`,fill:`url(#floorGrad)`}),(0,A.jsx)(`ellipse`,{cx:`50`,cy:`52`,rx:`32`,ry:`20`,fill:`url(#tableGrad)`,stroke:`#7c3aed`,strokeWidth:`0.4`}),(0,A.jsx)(`ellipse`,{cx:`50`,cy:`49`,rx:`28`,ry:`17`,fill:`rgba(0,0,0,0.18)`}),(0,A.jsx)(`circle`,{cx:`50`,cy:`50`,r:`38`,fill:`none`,stroke:`rgba(167,139,250,0.12)`,strokeWidth:`0.3`})]}),e.slice(0,tt.length).map((e,r)=>{let a=tt[r],o=r<n,s=o&&r===i&&(t?.phase===`r2`||t?.phase===`r3`),c=$e[r%$e.length],l=Qe[r%Qe.length],u=et[r%et.length];return(0,A.jsxs)(`div`,{style:{position:`absolute`,left:`${a.x}%`,top:`${a.y}%`,transform:`translate(-50%, -50%) translateX(${o?0:a.x<50?`-80px`:`80px`})`,opacity:+!!o,transition:`transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:2,pointerEvents:`none`,zIndex:5},children:[(0,A.jsxs)(`div`,{style:{fontSize:9,padding:`2px 6px`,background:`rgba(255,255,255,0.95)`,color:`#1e1b4b`,borderRadius:8,marginBottom:2,fontWeight:700,opacity:+!!s,transform:s?`translateY(0) scale(1)`:`translateY(4px) scale(0.85)`,transition:`opacity 0.25s, transform 0.25s`,whiteSpace:`nowrap`,maxWidth:110,overflow:`hidden`,textOverflow:`ellipsis`,boxShadow:`0 2px 6px rgba(0,0,0,0.4)`},children:[e.icon,` `,e.label.slice(0,12)]}),(0,A.jsxs)(`svg`,{width:`20`,height:`26`,viewBox:`0 0 20 26`,style:{filter:s?`drop-shadow(0 0 4px rgba(167,139,250,0.8))`:`none`,transition:`filter 0.25s`},children:[(0,A.jsx)(`rect`,{x:`6`,y:`2`,width:`8`,height:`3`,fill:u}),(0,A.jsx)(`rect`,{x:`6`,y:`4`,width:`8`,height:`6`,fill:l}),(0,A.jsx)(`rect`,{x:`8`,y:`7`,width:`1`,height:`1`,fill:`#000`}),(0,A.jsx)(`rect`,{x:`11`,y:`7`,width:`1`,height:`1`,fill:`#000`}),(0,A.jsx)(`rect`,{x:`5`,y:`10`,width:`10`,height:`9`,fill:c}),(0,A.jsx)(`rect`,{x:`9`,y:`10`,width:`2`,height:`2`,fill:l}),(0,A.jsx)(`rect`,{x:`3`,y:`11`,width:`2`,height:`7`,fill:c}),(0,A.jsx)(`rect`,{x:`15`,y:`11`,width:`2`,height:`7`,fill:c}),(0,A.jsx)(`rect`,{x:`3`,y:`18`,width:`2`,height:`2`,fill:l}),(0,A.jsx)(`rect`,{x:`15`,y:`18`,width:`2`,height:`2`,fill:l}),(0,A.jsx)(`rect`,{x:`6`,y:`19`,width:`3`,height:`4`,fill:`#1e293b`}),(0,A.jsx)(`rect`,{x:`11`,y:`19`,width:`3`,height:`4`,fill:`#1e293b`})]}),(0,A.jsx)(`div`,{style:{fontSize:9,color:`#c4b5fd`,fontWeight:600,maxWidth:80,textAlign:`center`,textShadow:`0 1px 2px rgba(0,0,0,0.6)`},children:e.label.slice(0,14)})]},e.agent+r)}),t?.phase===`done`&&(0,A.jsx)(`div`,{style:{position:`absolute`,bottom:10,left:0,right:0,textAlign:`center`,fontSize:10,color:`#c4b5fd`,letterSpacing:`0.5px`},children:t.converged?`✓ Consenso raggiunto`:`⚖ Mediazione completata`})]})}function rt(e){let t=e.toLowerCase();return De.some(e=>t.includes(e.toLowerCase()))}function it(e,t){let n=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),r=t.map(e=>e.output).join(`
|
|
328
|
-
|
|
329
|
-
`),i=/([+-]?\d+(?:\.\d+)?)\s*%/g,a=[],o;for(;(o=i.exec(r))!==null;){let e=parseFloat(o[1]);e>=-100&&e<=500&&a.push(e)}let s=t.filter(e=>e.output&&e.output!==`(no output)`).map(e=>{let t=xe(e.output);return`
|
|
330
|
-
<div class="section">
|
|
331
|
-
<div class="section-head">
|
|
332
|
-
<span class="section-icon">${n(e.icon)}</span>
|
|
333
|
-
<span class="section-title">${n(e.label)}</span>
|
|
334
|
-
<span class="section-badge">${n(e.status)}</span>
|
|
335
|
-
</div>
|
|
336
|
-
<div class="section-body">${t}</div>
|
|
337
|
-
</div>`}).join(``),c=t.filter(e=>e.output&&e.output!==`(no output)`).map(e=>e.label),l=t.filter(e=>e.output&&e.output!==`(no output)`).map(e=>{let t=(e.output.match(/bullish|buy|long|upside|growth|positive|strong|breakout|momentum/gi)??[]).length,n=(e.output.match(/bearish|sell|short|downside|risk|negative|weak|breakdown|reversal/gi)??[]).length;return Math.max(0,Math.min(100,50+(t-n)*5))}),u=a.filter(e=>e!==0).slice(0,8),d=u.map((e,t)=>`Signal ${t+1}`),f=[],p=/\b(20\d{2})\b[^|*\n]*\|[^|*\n]*(\d[\d,. ]+)[^|*\n]*\|[^|*\n]*(\d[\d,.]+)/g,m;for(;(m=p.exec(r))!==null;){let e=parseInt(m[1],10),t=parseFloat(m[2].replace(/[,\s]/g,``)),n=parseFloat(m[3].replace(/[,\s]/g,``));if(e>=2018&&e<=2027&&t>0&&n>0){let r=t>500?t:n>500?n:void 0,i=t<200&&t>10?t:n<200&&n>10?n:void 0;(r||i)&&f.push({year:e,gold:r,oil:i,ratio:void 0})}}let h=new Map;for(let e of f)h.set(e.year,{...h.get(e.year),...e});let g=[...h.values()].sort((e,t)=>e.year-t.year),_=g.map(e=>String(e.year)),v=g.map(e=>e.gold??null),y=g.map(e=>e.oil??null),b=g.length>=2&&v.some(e=>e!==null),x=c.map((e,r)=>{let i=l[r]??50,a=i>=65?`score-bull`:i<=35?`score-bear`:`score-neutral`,o=i>=65?`fill-bull`:i<=35?`fill-bear`:`fill-neutral`,s=i>=65?`BULLISH`:i<=35?`BEARISH`:`NEUTRAL`;return`<div class="gauge-card">
|
|
338
|
-
<div class="gauge-icon">${n(t.find(t=>t.label===e)?.icon??`📊`)}</div>
|
|
339
|
-
<div class="gauge-label">${n(e)}</div>
|
|
340
|
-
<div class="gauge-score ${a}">${i}</div>
|
|
341
|
-
<div style="font-size:9px;color:var(--dim);margin-bottom:6px">${s}</div>
|
|
342
|
-
<div class="gauge-bar"><div class="gauge-fill ${o}" style="width:${i}%"></div></div>
|
|
343
|
-
</div>`}).join(``),S=b?`<div class="chart-card chart-card-wide">
|
|
344
|
-
<div class="chart-title">Price History (extracted from analysis)</div>
|
|
345
|
-
<div class="chart-wrap"><canvas id="chartTimeSeries"></canvas></div>
|
|
346
|
-
</div>`:``,C=u.length>=3?`<div class="chart-card">
|
|
347
|
-
<div class="chart-title">Extracted % Signals</div>
|
|
348
|
-
<div class="chart-wrap"><canvas id="chartPct"></canvas></div>
|
|
349
|
-
</div>`:`<div class="chart-card">
|
|
350
|
-
<div class="chart-title">Bull vs Bear Count per Agent</div>
|
|
351
|
-
<div class="chart-wrap"><canvas id="chartBearBull"></canvas></div>
|
|
352
|
-
</div>`,w=JSON.stringify(t.filter(e=>e.output&&e.output!==`(no output)`).map(e=>(e.output.match(/bullish|buy|long|upside|growth|breakout/gi)??[]).length)),ee=JSON.stringify(t.filter(e=>e.output&&e.output!==`(no output)`).map(e=>(e.output.match(/bearish|sell|short|downside|risk|breakdown/gi)??[]).length)),T=b?`
|
|
353
|
-
const tsCtx = document.getElementById('chartTimeSeries');
|
|
354
|
-
if (tsCtx) {
|
|
355
|
-
new C(tsCtx, {
|
|
356
|
-
type: 'line',
|
|
357
|
-
data: {
|
|
358
|
-
labels: ${JSON.stringify(_)},
|
|
359
|
-
datasets: [
|
|
360
|
-
{ label: 'Gold (USD/oz)', data: ${JSON.stringify(v)}, borderColor: '#f59e0b', backgroundColor: 'rgba(245,158,11,0.1)', tension: 0.3, pointRadius: 4, yAxisID: 'yGold', spanGaps: true },
|
|
361
|
-
{ label: 'Oil WTI (USD/bbl)', data: ${JSON.stringify(y)}, borderColor: '#00e5ff', backgroundColor: 'rgba(0,229,255,0.1)', tension: 0.3, pointRadius: 4, yAxisID: 'yOil', spanGaps: true },
|
|
362
|
-
]
|
|
363
|
-
},
|
|
364
|
-
options: {
|
|
365
|
-
responsive: true, maintainAspectRatio: false,
|
|
366
|
-
interaction: { mode: 'index', intersect: false },
|
|
367
|
-
plugins: { legend: { labels: { color: '#8b949e', font: { size: 9 } } } },
|
|
368
|
-
scales: {
|
|
369
|
-
x: { ticks: { color: '#8b949e', font: { size: 9 } }, grid: { color: '#21262d' } },
|
|
370
|
-
yGold: { type: 'linear', position: 'left', ticks: { color: '#f59e0b', font: { size: 9 }, callback: (v) => '$' + v }, grid: { color: '#21262d' } },
|
|
371
|
-
yOil: { type: 'linear', position: 'right', ticks: { color: '#00e5ff', font: { size: 9 }, callback: (v) => '$' + v }, grid: { drawOnChartArea: false } },
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
}`:``,te=u.length>=3?`const pctCtx = document.getElementById('chartPct');
|
|
376
|
-
if (pctCtx) {
|
|
377
|
-
const pctVals = ${JSON.stringify(u)};
|
|
378
|
-
new C(pctCtx, {
|
|
379
|
-
type: 'bar',
|
|
380
|
-
data: {
|
|
381
|
-
labels: ${JSON.stringify(d)},
|
|
382
|
-
datasets: [{ label: '% Value', data: pctVals,
|
|
383
|
-
backgroundColor: pctVals.map(v => v >= 0 ? 'rgba(0,229,255,0.65)' : 'rgba(255,68,68,0.65)'),
|
|
384
|
-
borderColor: pctVals.map(v => v >= 0 ? '#00e5ff' : '#ff4444'),
|
|
385
|
-
borderWidth: 1, borderRadius: 3 }]
|
|
386
|
-
},
|
|
387
|
-
options: { responsive: true, maintainAspectRatio: false,
|
|
388
|
-
plugins: { legend: { display: false } },
|
|
389
|
-
scales: { x: { ticks: { color: '#8b949e', font: { size: 9 } }, grid: { color: '#21262d' } },
|
|
390
|
-
y: { ticks: { color: '#8b949e', font: { size: 9 } }, grid: { color: '#21262d' } } } }
|
|
391
|
-
});
|
|
392
|
-
}`:`const bbCtx = document.getElementById('chartBearBull');
|
|
393
|
-
if (bbCtx) {
|
|
394
|
-
new C(bbCtx, {
|
|
395
|
-
type: 'bar',
|
|
396
|
-
data: {
|
|
397
|
-
labels: ${JSON.stringify(c)},
|
|
398
|
-
datasets: [
|
|
399
|
-
{ label: 'Bullish signals', data: ${w}, backgroundColor: 'rgba(0,255,65,0.7)', borderColor: '#00ff41', borderWidth: 1, borderRadius: 3 },
|
|
400
|
-
{ label: 'Bearish signals', data: ${ee}, backgroundColor: 'rgba(255,68,68,0.7)', borderColor: '#ff4444', borderWidth: 1, borderRadius: 3 },
|
|
401
|
-
]
|
|
402
|
-
},
|
|
403
|
-
options: { responsive: true, maintainAspectRatio: false,
|
|
404
|
-
plugins: { legend: { labels: { color: '#8b949e', font: { size: 9 } } } },
|
|
405
|
-
scales: { x: { ticks: { color: '#8b949e', font: { size: 9 } }, grid: { color: '#21262d' } },
|
|
406
|
-
y: { ticks: { color: '#8b949e', font: { size: 9 } }, grid: { color: '#21262d' } } } }
|
|
407
|
-
});
|
|
408
|
-
}`,ne=new Date().toLocaleString(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`});return`<!DOCTYPE html>
|
|
409
|
-
<html lang="en">
|
|
410
|
-
<head>
|
|
411
|
-
<meta charset="UTF-8">
|
|
412
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
413
|
-
<title>NHA Financial Analysis</title>
|
|
414
|
-
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"><\/script>
|
|
415
|
-
<style>
|
|
416
|
-
*{box-sizing:border-box;margin:0;padding:0}
|
|
417
|
-
:root{
|
|
418
|
-
--bg:#070b0f;--bg2:#0d1117;--bg3:#161b22;--bg4:#1c2128;
|
|
419
|
-
--green:#00ff41;--green2:#00cc33;--greendim:rgba(0,255,65,0.08);
|
|
420
|
-
--amber:#f59e0b;--red:#ff4444;--blue:#00e5ff;
|
|
421
|
-
--text:#c9d1d9;--dim:#8b949e;--bright:#f0f6fc;
|
|
422
|
-
--border:#30363d;--border2:#484f58;
|
|
423
|
-
--font:'SF Mono','Fira Code',Consolas,monospace;
|
|
424
|
-
}
|
|
425
|
-
html,body{background:var(--bg);color:var(--text);font-family:var(--font);font-size:12px;line-height:1.6;min-height:100vh}
|
|
426
|
-
.page{padding:20px;max-width:1200px;margin:0 auto}
|
|
427
|
-
.header{background:linear-gradient(135deg,#0d1117 0%,#161b22 50%,#1c2128 100%);border:1px solid var(--border);border-radius:10px;padding:20px 24px;margin-bottom:20px;position:relative;overflow:hidden}
|
|
428
|
-
.header::before{content:'';position:absolute;inset:0;background:repeating-linear-gradient(0deg,transparent,transparent 40px,rgba(0,255,65,0.02) 40px,rgba(0,255,65,0.02) 41px),repeating-linear-gradient(90deg,transparent,transparent 40px,rgba(0,255,65,0.02) 40px,rgba(0,255,65,0.02) 41px)}
|
|
429
|
-
.header-inner{position:relative;z-index:1}
|
|
430
|
-
.header-tag{font-size:9px;text-transform:uppercase;letter-spacing:3px;color:var(--green);font-weight:700;margin-bottom:6px}
|
|
431
|
-
.header-title{font-size:18px;font-weight:800;color:var(--bright);margin-bottom:8px;line-height:1.3}
|
|
432
|
-
.header-task{font-size:11px;color:var(--dim);padding:8px 12px;background:rgba(255,255,255,0.04);border-left:3px solid var(--green);border-radius:4px;white-space:pre-wrap}
|
|
433
|
-
.header-meta{display:flex;gap:16px;margin-top:12px;flex-wrap:wrap}
|
|
434
|
-
.meta-badge{font-size:10px;color:var(--dim);background:var(--bg3);border:1px solid var(--border);padding:3px 8px;border-radius:4px}
|
|
435
|
-
.meta-badge b{color:var(--bright)}
|
|
436
|
-
.charts-row{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:20px}
|
|
437
|
-
.chart-card-wide{grid-column:1/-1}
|
|
438
|
-
.chart-card{background:var(--bg2);border:1px solid var(--border);border-radius:8px;padding:16px}
|
|
439
|
-
.chart-title{font-size:10px;text-transform:uppercase;letter-spacing:1.5px;color:var(--dim);font-weight:700;margin-bottom:12px}
|
|
440
|
-
.chart-wrap{position:relative;height:180px}
|
|
441
|
-
.gauges-row{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px;margin-bottom:20px}
|
|
442
|
-
.gauge-card{background:var(--bg2);border:1px solid var(--border);border-radius:8px;padding:12px;text-align:center}
|
|
443
|
-
.gauge-icon{font-size:20px;margin-bottom:4px}
|
|
444
|
-
.gauge-label{font-size:9px;color:var(--dim);text-transform:uppercase;letter-spacing:1px;margin-bottom:6px}
|
|
445
|
-
.gauge-score{font-size:22px;font-weight:800;margin-bottom:4px}
|
|
446
|
-
.gauge-bar{height:4px;background:var(--bg3);border-radius:2px;overflow:hidden}
|
|
447
|
-
.gauge-fill{height:100%;border-radius:2px;transition:width 0.5s ease}
|
|
448
|
-
.score-bull{color:var(--green)}.score-neutral{color:var(--amber)}.score-bear{color:var(--red)}
|
|
449
|
-
.fill-bull{background:linear-gradient(90deg,var(--green2),var(--green))}.fill-neutral{background:var(--amber)}.fill-bear{background:var(--red)}
|
|
450
|
-
.section{background:var(--bg2);border:1px solid var(--border);border-radius:8px;margin-bottom:14px;overflow:hidden}
|
|
451
|
-
.section-head{display:flex;align-items:center;gap:10px;padding:10px 14px;background:var(--bg3);border-bottom:1px solid var(--border)}
|
|
452
|
-
.section-icon{font-size:16px}.section-title{font-size:12px;font-weight:700;color:var(--bright);flex:1}
|
|
453
|
-
.section-badge{font-size:9px;text-transform:uppercase;letter-spacing:1px;color:var(--green);background:var(--greendim);padding:2px 7px;border-radius:10px}
|
|
454
|
-
.section-body{padding:14px 16px;font-size:11px;color:var(--text);line-height:1.8}
|
|
455
|
-
.section-body strong{color:var(--bright)}
|
|
456
|
-
.section-body .sh2{font-size:12px;font-weight:700;color:var(--bright);margin:10px 0 4px;padding-left:8px;border-left:2px solid var(--green)}
|
|
457
|
-
.section-body .sh3{font-size:11px;font-weight:700;color:var(--amber);margin:8px 0 3px}
|
|
458
|
-
.section-body .sh4,.section-body .sh5{font-size:11px;color:var(--blue);margin:6px 0 2px}
|
|
459
|
-
.section-body table{width:100%;border-collapse:collapse;margin:10px 0;font-size:11px}
|
|
460
|
-
.section-body th{background:rgba(0,255,65,0.08);color:var(--bright);font-weight:700;padding:6px 10px;text-align:left;border:1px solid var(--border);text-transform:uppercase;font-size:10px;letter-spacing:0.4px}
|
|
461
|
-
.section-body td{padding:5px 10px;border:1px solid var(--border);color:var(--text)}
|
|
462
|
-
.section-body tr:nth-child(even) td{background:rgba(255,255,255,0.03)}
|
|
463
|
-
.section-body p{margin:0 0 6px}
|
|
464
|
-
.section-body ul,.section-body ol{padding-left:18px;margin:6px 0}
|
|
465
|
-
.section-body li{margin-bottom:3px}
|
|
466
|
-
.section-body h1{font-size:14px;font-weight:800;color:var(--bright);margin:12px 0 6px;padding-bottom:4px;border-bottom:1px solid var(--border)}
|
|
467
|
-
.section-body h2{font-size:12px;font-weight:700;color:var(--bright);margin:10px 0 4px;padding-left:8px;border-left:2px solid var(--green)}
|
|
468
|
-
.section-body h3{font-size:11px;font-weight:700;color:var(--amber);margin:8px 0 3px}
|
|
469
|
-
.section-body h4,.section-body h5{font-size:11px;color:var(--blue);margin:6px 0 2px}
|
|
470
|
-
.section-body code{background:rgba(255,255,255,0.05);border:1px solid var(--border);border-radius:3px;padding:1px 4px;font-family:var(--font);font-size:10px;color:var(--blue)}
|
|
471
|
-
.section-body pre{background:var(--bg3);border:1px solid var(--border);border-radius:6px;padding:10px 12px;overflow-x:auto;margin:8px 0}
|
|
472
|
-
.section-body blockquote{border-left:3px solid var(--green);padding-left:12px;color:var(--dim);margin:8px 0}
|
|
473
|
-
.section-body hr{border:none;border-top:1px solid var(--border);margin:12px 0}
|
|
474
|
-
.footer{text-align:center;padding:16px;color:var(--dim);font-size:9px;border-top:1px solid var(--border);margin-top:20px}
|
|
475
|
-
.footer span{color:var(--green)}
|
|
476
|
-
::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:var(--bg)}::-webkit-scrollbar-thumb{background:var(--border2);border-radius:3px}
|
|
477
|
-
</style>
|
|
478
|
-
</head>
|
|
479
|
-
<body>
|
|
480
|
-
<div class="page">
|
|
481
|
-
<div class="header">
|
|
482
|
-
<div class="header-inner">
|
|
483
|
-
<div class="header-tag">NHA Studio • Financial Analysis Report</div>
|
|
484
|
-
<div class="header-title">${n(e.split(`
|
|
485
|
-
`)[0].slice(0,100))}</div>
|
|
486
|
-
<div class="header-task">${n(e.slice(0,400))}${e.length>400?`…`:``}</div>
|
|
487
|
-
<div class="header-meta">
|
|
488
|
-
<div class="meta-badge"><b>${t.length}</b> Agents</div>
|
|
489
|
-
<div class="meta-badge">Generated <b>${ne}</b></div>
|
|
490
|
-
<div class="meta-badge">NHA Studio <b>v13</b></div>
|
|
491
|
-
</div>
|
|
492
|
-
</div>
|
|
493
|
-
</div>
|
|
494
|
-
<div class="gauges-row">${x}</div>
|
|
495
|
-
${c.length>0?`<div class="charts-row">
|
|
496
|
-
${S}
|
|
497
|
-
<div class="chart-card">
|
|
498
|
-
<div class="chart-title">Agent Signal Scores</div>
|
|
499
|
-
<div class="chart-wrap"><canvas id="chartSignal"></canvas></div>
|
|
500
|
-
</div>
|
|
501
|
-
${C}
|
|
502
|
-
</div>`:``}
|
|
503
|
-
${s}
|
|
504
|
-
<div class="footer">Generated by <span>NotHumanAllowed</span> Studio • Real intelligence, real tools, free AI via Liara (Qwen3 32B)</div>
|
|
505
|
-
</div>
|
|
506
|
-
<script>
|
|
507
|
-
const C = Chart;
|
|
508
|
-
C.defaults.color = '#8b949e';
|
|
509
|
-
C.defaults.borderColor = '#30363d';
|
|
510
|
-
C.defaults.font.family = "'SF Mono','Fira Code',Consolas,monospace";
|
|
511
|
-
C.defaults.font.size = 10;
|
|
512
|
-
const signalCtx = document.getElementById('chartSignal');
|
|
513
|
-
if (signalCtx) {
|
|
514
|
-
const scores = ${JSON.stringify(l)};
|
|
515
|
-
new C(signalCtx, {
|
|
516
|
-
type: 'bar',
|
|
517
|
-
data: {
|
|
518
|
-
labels: ${JSON.stringify(c)},
|
|
519
|
-
datasets: [{
|
|
520
|
-
label: 'Signal Score (0=bear, 100=bull)',
|
|
521
|
-
data: scores,
|
|
522
|
-
backgroundColor: scores.map(s => s >= 65 ? 'rgba(0,255,65,0.7)' : s <= 35 ? 'rgba(255,68,68,0.7)' : 'rgba(245,158,11,0.7)'),
|
|
523
|
-
borderColor: scores.map(s => s >= 65 ? '#00ff41' : s <= 35 ? '#ff4444' : '#f59e0b'),
|
|
524
|
-
borderWidth: 1, borderRadius: 4,
|
|
525
|
-
}]
|
|
526
|
-
},
|
|
527
|
-
options: { responsive: true, maintainAspectRatio: false,
|
|
528
|
-
plugins: { legend: { display: false } },
|
|
529
|
-
scales: { x: { ticks: { color: '#8b949e', font: { size: 9 } }, grid: { color: '#21262d' } },
|
|
530
|
-
y: { min: 0, max: 100, ticks: { color: '#8b949e', font: { size: 9 } }, grid: { color: '#21262d' } } } }
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
${T}
|
|
534
|
-
${te}
|
|
535
|
-
<\/script>
|
|
536
|
-
</body>
|
|
537
|
-
</html>`}function at(e){return e&&e.replace(/Fetch failed:[^\n]*/gi,`_(fonte dati non raggiungibile)_`).replace(/Search failed:[^\n]*/gi,`_(ricerca non disponibile)_`).replace(/Fetch error:[^\n]*/gi,`_(fonte dati non raggiungibile)_`).replace(/^\s*Errore\s+\d{3}\b[^\n]*/gim,`_(fonte non disponibile)_`).replace(/HTTP_(?:4\d{2}|5\d{2})\b[^\n]*/gi,`_(fonte non disponibile)_`).replace(/(?:Network error|Timeout after \d+ms|Request timed out)[^\n]*/gi,`_(timeout sul server remoto)_`).replace(/SSRF_BLOCKED|DEADLINE_EXCEEDED|CONTENT_TYPE_BLOCKED|REDIRECT_BLOCKED/g,`_(richiesta bloccata)_`)}function ot(e){return e.dataQuality&&typeof e.dataQuality.score==`number`?Math.max(5,Math.min(95,Math.round(e.dataQuality.score*100))):60}function st(e,t,n){let r=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),i=e=>e.replace(/[┌┐└┘├┤┬┴┼─│╔╗╚╝╠╣╦╩╬═║╭╮╯╰┃┅┄┈┉]/g,` `).replace(/ {3,}/g,` `).replace(/[▓█░▒■□●○◆◇▲△▼▽★☆]+/g,`●`),a=e=>xe(i(at(e))),o=t.filter(e=>e.output&&e.output!==`(no output)`&&e.status!==`aborted`),s=o.map(ot),c=Math.floor(Math.min(560,o.length*80)),l=o.length>0?Math.floor(c/o.length)-6:40,u=s.length>0?Math.round(s.reduce((e,t)=>e+t,0)/s.length):0,d=u<50&&o.length>0?`<div class="chart-section" style="background:linear-gradient(135deg,#fef2f2,#fff1f2) !important;border:1px solid #fca5a5;">
|
|
538
|
-
<h3 class="chart-title" style="color:#b91c1c;">⚠ Data Quality Warning — punteggio medio ${u}%</h3>
|
|
539
|
-
<div style="font-size:12px;color:#7f1d1d;line-height:1.6;padding:4px 2px;">
|
|
540
|
-
Una o più fonti dati non sono state raccolte correttamente durante questa esecuzione.
|
|
541
|
-
Le sezioni con punteggio basso potrebbero contenere lacune o informazioni non verificate
|
|
542
|
-
— incrocia sempre con la fonte originale prima di prendere decisioni.
|
|
543
|
-
</div>
|
|
544
|
-
</div>`:``,f=o.length>=2?`
|
|
545
|
-
<div class="chart-section">
|
|
546
|
-
<h3 class="chart-title">Data Quality Score (verifiable signals)</h3>
|
|
547
|
-
<svg width="${c}" height="120" viewBox="0 0 ${c} 120" xmlns="http://www.w3.org/2000/svg">
|
|
548
|
-
<rect width="${c}" height="120" fill="#f8fafc" rx="6"/>
|
|
549
|
-
${s.map((e,t)=>{let n=t*(l+6)+4,r=Math.round(e*.8),i=100-r,a=e>=70?`#22c55e`:e>=50?`#f59e0b`:`#ef4444`;return`<rect x="${n}" y="${i}" width="${l}" height="${r}" fill="${a}" rx="3"/>
|
|
550
|
-
<text x="${n+l/2}" y="114" text-anchor="middle" font-size="8" fill="#64748b">${o[t].label.slice(0,8)}</text>
|
|
551
|
-
<text x="${n+l/2}" y="${i-4}" text-anchor="middle" font-size="9" font-weight="bold" fill="${a}">${e}%</text>`}).join(``)}
|
|
552
|
-
<line x1="0" y1="100" x2="${c}" y2="100" stroke="#e2e8f0" stroke-width="1"/>
|
|
553
|
-
</svg>
|
|
554
|
-
</div>${d}`:``,p=o.map(e=>`<div class="toc-item"><span class="toc-icon">${e.icon}</span>${r(e.label)}</div>`).join(``)+(n?.synthesis?`<div class="toc-item"><span class="toc-icon">🏛️</span>Parliament Synthesis (cross-reading)</div>`:``),m=o.map(e=>`<div class="section"><div class="agent-header"><span class="icon">${e.icon}</span><div class="agent-name">${r(e.label)}</div></div><div class="section-body">${a(e.output)}</div></div>`).join(``),h=n?.synthesis?`<div class="section" style="background:linear-gradient(135deg,#ede9fe,#f0f9ff) !important;border:2px solid #c4b5fd;">
|
|
555
|
-
<div class="agent-header"><span class="icon">🏛️</span><div class="agent-name">Parliament Synthesis — HERALD Mediation</div></div>
|
|
556
|
-
<div class="section-body">
|
|
557
|
-
<div style="font-size:11px;color:#6b21a8;text-transform:uppercase;letter-spacing:0.6px;margin-bottom:8px;">
|
|
558
|
-
Round 2 convergenza: ${Math.round((n.r2Convergence||0)*100)}% · ${n.converged?`CONSENSO`:`MEDIAZIONE`}
|
|
559
|
-
</div>
|
|
560
|
-
${a(n.synthesis)}
|
|
561
|
-
</div>
|
|
562
|
-
</div>`:``;return`<!DOCTYPE html><html lang="it"><head><meta charset="UTF-8"><title>NHA Studio — ${r(e.slice(0,80))}</title>
|
|
563
|
-
<style>
|
|
564
|
-
*{box-sizing:border-box;margin:0;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
565
|
-
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#1e293b;background:linear-gradient(180deg,#f8fafc 0%,#eef2ff 40%,#f0f9ff 70%,#faf5ff 100%) !important;font-size:13px;line-height:1.75;padding:40px;max-width:900px;margin:0 auto;min-height:100vh}
|
|
566
|
-
.cover{background:linear-gradient(135deg,#1e1b4b 0%,#312e81 30%,#4c1d95 60%,#0f172a 100%) !important;color:#fff !important;padding:52px 56px;margin-bottom:40px;border-radius:16px;box-shadow:0 25px 50px -12px rgba(30,27,75,0.4),0 0 0 1px rgba(99,102,241,0.1);-webkit-print-color-adjust:exact;print-color-adjust:exact;position:relative;overflow:hidden}
|
|
567
|
-
.cover::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:radial-gradient(ellipse at 20% 50%,rgba(139,92,246,0.15) 0%,transparent 60%),radial-gradient(ellipse at 80% 20%,rgba(59,130,246,0.1) 0%,transparent 50%);pointer-events:none}
|
|
568
|
-
.cover h1{color:#fff !important;font-size:30px;font-weight:900;margin-bottom:8px;letter-spacing:-0.5px;position:relative;text-shadow:0 2px 4px rgba(0,0,0,0.2)}
|
|
569
|
-
.cover .meta{color:rgba(255,255,255,.75) !important;font-size:11px;margin-bottom:20px;position:relative}
|
|
570
|
-
.task{color:#fff !important;font-size:14px;padding:16px 20px;background:rgba(99,102,241,0.2) !important;border-radius:10px;border-left:4px solid #a78bfa !important;line-height:1.7;position:relative;backdrop-filter:blur(4px)}
|
|
571
|
-
.toc{margin-bottom:36px;padding:20px 24px;background:linear-gradient(135deg,#f1f5f9,#eef2ff) !important;border-radius:12px;border-left:4px solid #6366f1 !important;box-shadow:0 4px 6px -1px rgba(99,102,241,0.08),0 2px 4px -2px rgba(99,102,241,0.05);-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
572
|
-
.toc h3{font-size:11px;font-weight:700;color:#6366f1;text-transform:uppercase;letter-spacing:1.2px;margin-bottom:12px}
|
|
573
|
-
.toc-item{display:flex;align-items:center;gap:8px;padding:5px 0;font-size:12px;color:#334155;border-bottom:1px solid rgba(99,102,241,0.06)}
|
|
574
|
-
.toc-item:last-child{border-bottom:none}
|
|
575
|
-
.toc-icon{font-size:14px;width:20px;text-align:center}
|
|
576
|
-
.section{margin-bottom:40px;padding:28px 32px;background:#ffffff !important;border-radius:14px;box-shadow:0 4px 6px -1px rgba(0,0,0,0.05),0 10px 15px -3px rgba(0,0,0,0.04),0 0 0 1px rgba(226,232,240,0.8);page-break-inside:avoid;border-bottom:none;transition:box-shadow 0.2s}
|
|
577
|
-
.agent-header{display:flex;align-items:center;gap:12px;margin-bottom:20px;padding-bottom:12px;border-bottom:2px solid transparent;background:linear-gradient(90deg,#6366f1,#8b5cf6,#6366f1) !important;-webkit-background-clip:padding-box;background-size:100% 2px;background-position:bottom;background-repeat:no-repeat}
|
|
578
|
-
.icon{font-size:24px;width:36px;height:36px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#eef2ff,#faf5ff) !important;border-radius:10px;box-shadow:0 2px 4px rgba(99,102,241,0.1)}
|
|
579
|
-
.agent-name{font-size:16px;font-weight:800;color:#0f172a;letter-spacing:-0.3px}
|
|
580
|
-
.section-body{font-size:13px;line-height:1.85;color:#374151}
|
|
581
|
-
.section-body h1{font-size:18px;font-weight:800;margin:24px 0 12px;color:#0f172a;padding-bottom:8px;border-bottom:3px solid #6366f1;background:linear-gradient(90deg,#eef2ff,transparent) !important;padding:8px 12px;border-radius:6px 6px 0 0}
|
|
582
|
-
.section-body h2{font-size:15px;font-weight:700;margin:20px 0 10px;color:#1e1b4b;padding-left:12px;border-left:4px solid #4f46e5;background:linear-gradient(90deg,rgba(238,242,255,0.5),transparent) !important;padding:6px 12px;border-radius:0 6px 6px 0}
|
|
583
|
-
.section-body h3{font-size:13px;font-weight:700;margin:16px 0 8px;color:#7c3aed;padding-left:10px;border-left:3px solid #7c3aed}
|
|
584
|
-
.section-body strong{color:#0f172a;font-weight:700}
|
|
585
|
-
.section-body em{font-style:italic;color:#64748b}
|
|
586
|
-
.section-body code{background:linear-gradient(135deg,#f1f5f9,#eef2ff) !important;border:1px solid #e2e8f0;border-radius:4px;padding:2px 6px;font-family:'SF Mono',Monaco,monospace;font-size:11px;color:#7c3aed !important;box-shadow:0 1px 2px rgba(0,0,0,0.04)}
|
|
587
|
-
.section-body table{width:100%;border-collapse:separate;border-spacing:0;margin:18px 0;border-radius:10px;overflow:hidden;box-shadow:0 4px 6px -1px rgba(0,0,0,0.07),0 2px 4px -2px rgba(0,0,0,0.05),0 0 0 1px rgba(226,232,240,0.8)}
|
|
588
|
-
.section-body thead{background:linear-gradient(135deg,#1e1b4b,#312e81) !important}
|
|
589
|
-
.section-body th{background:transparent !important;color:#ffffff !important;font-weight:700;padding:12px 16px;text-align:left;border:none;font-size:11px;text-transform:uppercase;letter-spacing:0.8px;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
590
|
-
.section-body td{padding:11px 16px;border-bottom:1px solid #f1f5f9;color:#374151;font-size:12px;border-left:none;border-right:none}
|
|
591
|
-
.section-body tr:nth-child(even) td{background:rgba(241,245,249,0.5) !important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
592
|
-
.section-body tr:last-child td{border-bottom:none}
|
|
593
|
-
.section-body tbody tr:hover td{background:rgba(238,242,255,0.7) !important}
|
|
594
|
-
.section-body ul{padding-left:22px;margin:10px 0}
|
|
595
|
-
.section-body ol{padding-left:22px;margin:10px 0}
|
|
596
|
-
.section-body li{margin-bottom:5px;padding-left:4px}
|
|
597
|
-
.section-body li::marker{color:#6366f1}
|
|
598
|
-
.section-body p{margin:0 0 10px}
|
|
599
|
-
.section-body blockquote{margin:16px 0;padding:16px 22px;background:linear-gradient(135deg,#eef2ff 0%,#f0fdf4 50%,#faf5ff 100%) !important;border-left:4px solid #6366f1 !important;border-radius:0 12px 12px 0;font-style:normal;color:#1e293b;box-shadow:0 2px 8px rgba(99,102,241,0.08);position:relative}
|
|
600
|
-
.section-body blockquote::before{content:open-quote;position:absolute;top:8px;left:10px;font-size:24px;color:rgba(99,102,241,0.2);font-family:Georgia,serif}
|
|
601
|
-
.section-body blockquote p{margin:0;padding-left:8px}
|
|
602
|
-
.section-body pre{margin:16px 0;padding:18px 22px;background:linear-gradient(135deg,#1e293b 0%,#0f172a 100%) !important;color:#e2e8f0 !important;border-radius:10px;overflow-x:auto;font-size:11px;line-height:1.6;box-shadow:0 4px 12px rgba(15,23,42,0.3),inset 0 1px 0 rgba(255,255,255,0.05);-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
603
|
-
.section-body hr{border:none;height:2px;background:linear-gradient(90deg,transparent,#6366f1,#8b5cf6,#6366f1,transparent) !important;margin:24px 0;border-radius:1px}
|
|
604
|
-
.chart-section{margin:28px 0;padding:20px 24px;background:linear-gradient(135deg,#ffffff,#f8fafc) !important;border-radius:12px;border:1px solid #e2e8f0;box-shadow:0 4px 6px -1px rgba(0,0,0,0.05);-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
605
|
-
.chart-title{font-size:12px;font-weight:700;color:#6366f1;text-transform:uppercase;letter-spacing:0.8px;margin-bottom:16px}
|
|
606
|
-
.footer{margin-top:56px;padding:20px 0;border-top:2px solid transparent;background:linear-gradient(90deg,transparent,#6366f1,#8b5cf6,#6366f1,transparent) !important;-webkit-background-clip:padding-box;background-size:100% 2px;background-position:top;background-repeat:no-repeat;color:#94a3b8;font-size:10px;text-align:center}
|
|
607
|
-
@media print{*{-webkit-print-color-adjust:exact !important;print-color-adjust:exact !important}
|
|
608
|
-
body{background:#fff !important;padding:20px}
|
|
609
|
-
.cover{background:linear-gradient(135deg,#1e1b4b 0%,#312e81 50%,#0f172a 100%) !important;page-break-after:always;box-shadow:none}
|
|
610
|
-
.section{box-shadow:none;border:1px solid #e2e8f0;page-break-inside:avoid}
|
|
611
|
-
@page{margin:1.5cm;size:A4}}
|
|
612
|
-
</style></head><body>
|
|
613
|
-
<div class="cover">
|
|
614
|
-
<h1>NHA Studio Report</h1>
|
|
615
|
-
<div class="meta">Generated ${new Date().toLocaleString()} · ${o.length} agents</div>
|
|
616
|
-
<div class="task">${r(e)}</div>
|
|
617
|
-
</div>
|
|
618
|
-
<div class="toc">
|
|
619
|
-
<h3>Table of Contents</h3>
|
|
620
|
-
${p}
|
|
621
|
-
</div>
|
|
622
|
-
${f}
|
|
623
|
-
${m}
|
|
624
|
-
${h}
|
|
625
|
-
<div class="footer">NHA Studio · nothumanallowed.com · ${new Date().getFullYear()}</div>
|
|
626
|
-
</body></html>`}function ct(e){try{localStorage.setItem(`nha_studio_sessions`,JSON.stringify(e.slice(0,20)))}catch{}}function lt(){try{return JSON.parse(localStorage.getItem(`nha_studio_sessions`)??`[]`)}catch{return[]}}var ut=`nha_studio_active`;function dt(e){try{sessionStorage.setItem(ut,JSON.stringify(e))}catch{}}function ft(){try{let e=sessionStorage.getItem(ut);return e?JSON.parse(e):null}catch{return null}}function pt(e){let t=[];return{clean:e.replace(/```json\s*\n?\s*\{[^`]*"action"\s*:\s*"canvas_render"[^`]*\}\s*```/g,e=>{try{let n=JSON.parse(e.replace(/```json\s*|\s*```/g,``).trim());n?.params?.html&&t.push(n.params.html)}catch{}return``}).replace(/\{"action"\s*:\s*"canvas_render"[^}]*"html"\s*:\s*"((?:[^"\\]|\\.)*)"/g,e=>{try{let n=JSON.parse(e+`}`);n?.params?.html&&t.push(n.params.html)}catch{try{let n=e.match(/"html"\s*:\s*"((?:[^"\\]|\\.)*?)"/);n&&t.push(JSON.parse(`"`+n[1]+`"`))}catch{}}return``}).trim(),canvasBlocks:t}}function mt(){return te.getState().apiBase}async function ht(e,t,n,r){let i=await fetch(mt()+e,{method:`POST`,headers:{"Content-Type":`application/json`,"x-nha-client":`web-ui`},body:JSON.stringify(t),signal:r});if(!i.ok||!i.body)throw Error(`HTTP ${i.status}`);let a=i.body.getReader(),o=new TextDecoder,s=``;for(;;){let{done:e,value:t}=await a.read();if(e)break;s+=o.decode(t,{stream:!0});let r=s.split(`
|
|
627
|
-
`);s=r.pop()??``;for(let e of r){if(!e.startsWith(`data: `))continue;let t=e.slice(6).trim();if(t===`[DONE]`)return;try{n(JSON.parse(t))}catch{}}}}function gt({label:e,value:t}){let n=Math.round(t*100),r=n>=60?`#22c55e`:n>=30?`#f59e0b`:`#ef4444`;return(0,A.jsxs)(`div`,{className:F.convRow,children:[(0,A.jsx)(`span`,{className:F.convLabel,children:e}),(0,A.jsx)(`div`,{className:F.convTrack,children:(0,A.jsx)(`div`,{className:F.convFill,style:{width:`${n}%`,background:r}})}),(0,A.jsxs)(`span`,{className:F.convPct,style:{color:r},children:[n,`%`]})]})}function _t({council:e}){let[t,n]=(0,_.useState)(null);if(e.skipped)return(0,A.jsxs)(`div`,{className:F.councilSkipped,children:[(0,A.jsx)(`span`,{className:F.councilSkipIcon,children:`🏛️`}),(0,A.jsxs)(`span`,{children:[`Council skipped — `,e.skipReason??`fewer than 2 eligible agents`]})]});let r=e.phase===`r2`?`⚡ Cross-reading & Refinement (Round 2)…`:e.phase===`r3`?`🏛️ HERALD Mediation (Round 3)…`:e.phase===`done`?`✅ Council Consensus Reached`:`🏛️ Council…`,i=e.converged?(0,A.jsx)(`span`,{className:F.councilConvergedBadge,children:`CONSENSUS`}):(0,A.jsx)(`span`,{className:F.councilDivergedBadge,children:`MEDIATED`});return(0,A.jsxs)(`div`,{className:F.councilPanel,children:[(0,A.jsxs)(`div`,{className:F.councilHeader,children:[(0,A.jsxs)(`div`,{className:F.councilHeaderLeft,children:[(0,A.jsx)(`span`,{className:F.councilIcon,children:`🏛️`}),(0,A.jsx)(`span`,{className:F.councilTitle,children:`Council · Geth Consensus`}),e.phase===`done`&&i]}),(0,A.jsx)(`div`,{className:F.councilHeaderRight,children:e.phase!==`idle`&&(0,A.jsx)(`span`,{className:`${F.councilPhaseTag} ${e.phase===`done`?F.councilPhaseDone:F.councilPhaseActive}`,children:r})})]}),(e.r1Convergence>0||e.r2Convergence>0)&&(0,A.jsxs)(`div`,{className:F.councilMetrics,children:[e.r1Convergence>0&&(0,A.jsx)(gt,{label:`Round 1`,value:e.r1Convergence}),e.r2Convergence>0&&(0,A.jsx)(gt,{label:`Round 2`,value:e.r2Convergence})]}),e.r2Nodes.length>0&&(0,A.jsxs)(`div`,{className:F.councilNodes,children:[(0,A.jsx)(`div`,{className:F.councilSectionTitle,children:`Refined Positions (Round 2)`}),e.r2Nodes.map(e=>(0,A.jsxs)(`div`,{className:F.councilNode,children:[(0,A.jsxs)(`button`,{className:F.councilNodeHeader,onClick:()=>n(t===e.agent?null:e.agent),children:[(0,A.jsx)(`span`,{className:F.councilNodeIcon,children:e.icon}),(0,A.jsx)(`span`,{className:F.councilNodeLabel,children:e.label}),(0,A.jsx)(`span`,{className:F.councilNodeToggle,children:t===e.agent?`▲`:`▼`})]}),t===e.agent&&(0,A.jsx)(`div`,{className:F.councilNodeBody,dangerouslySetInnerHTML:{__html:xe(e.output)}})]},e.agent))]}),e.synthesis&&(0,A.jsxs)(`div`,{className:F.councilSynthesis,children:[(0,A.jsxs)(`div`,{className:F.councilSynthesisHeader,children:[(0,A.jsx)(`span`,{className:F.heraldIcon,children:`📰`}),(0,A.jsx)(`span`,{className:F.heraldLabel,children:`HERALD — Final Synthesis`}),e.phase===`r3`&&(0,A.jsx)(`span`,{className:F.heraldStreaming,children:(0,A.jsx)(`span`,{className:`studio-cursor`})})]}),(0,A.jsx)(`div`,{className:F.councilSynthesisBody,dangerouslySetInnerHTML:{__html:xe(e.synthesis)+(e.phase===`r3`?`<span class="studio-cursor"></span>`:``)}})]})]})}function vt(){let e=te(e=>e.setView),t=ft(),[n,r]=(0,_.useState)(t?.task??``),[i,a]=(0,_.useState)(t?.nodes??[]),[o,s]=(0,_.useState)(t?.log??[]),[c,l]=(0,_.useState)(t?.result??``),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(lt),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useState)({in:0,out:0}),[x,S]=(0,_.useState)(t?.canvasHtml??``),[C,w]=(0,_.useState)(t?.council??null),[ee,T]=(0,_.useState)(!1),[ne,E]=(0,_.useState)([]),[D,O]=(0,_.useState)(!1),[re,k]=(0,_.useState)(`canvas`),[ie,j]=(0,_.useState)(``),[ae,oe]=(0,_.useState)(null),se=(0,_.useRef)(null),ce=(0,_.useRef)(null),le=(0,_.useRef)(null),ue=(0,_.useRef)(t?.canvasHtml??``),M=(0,_.useRef)(t?.council??null),N=(0,_.useRef)([]),de=(0,_.useRef)(null);(0,_.useEffect)(()=>{dt({task:n,nodes:i,log:o,result:c,canvasHtml:x,council:C})},[n,i,o,c,x,C]),(0,_.useEffect)(()=>{ce.current&&(ce.current.scrollTop=ce.current.scrollHeight)},[o]),(0,_.useEffect)(()=>{u&&le.current&&(le.current.scrollTop=le.current.scrollHeight)},[i,u]),(0,_.useEffect)(()=>{if(!m)return;let e=e=>{de.current&&!de.current.contains(e.target)&&h(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[m]);let fe=(0,_.useCallback)((e,t,n,r=`agent`)=>{let i=new Date().toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});s(a=>[...a,{agent:e,icon:t,text:n,time:i,type:r}])},[]),pe=e=>{if(!e)return;let t=e.name.toLowerCase();if(!t.endsWith(`.pdf`)&&!/\.(png|jpe?g|gif|webp)$/i.test(t)){alert(`Supported: PDF, PNG, JPG, GIF, WEBP`);return}let n=new FileReader;n.onload=t=>v({name:e.name,data:t.target?.result}),n.readAsDataURL(e)},me=async()=>{if(!n.trim()||u)return;d(!0),a([]),s([]),l(``),w(null),M.current=null,b({in:0,out:0}),ue.current=``,S(``);let e=new AbortController;se.current=e;try{let t=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`pdf`,`doc`,`docx`,`xls`,`xlsx`,`zip`,`mp3`,`mp4`,`js`,`css`,`json`,`xml`,`html`,`htm`,`md`,`txt`]),r=new Set;for(let e of n.matchAll(/https?:\/\/[^\s,)<>"'`]+/gi))r.add(e[0].replace(/[.,;:!?)\]]+$/,``));for(let e of n.matchAll(/(?<![\/@\w])(?:www\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.([a-z]{2,24})\b(?:\/[^\s,()<>"'`]*)?/gi)){let n=e[0].replace(/[.,;:!?)\]]+$/,``);if(n.startsWith(`http`))continue;let i=(e[1]||``).toLowerCase();t.has(i)||/^\d+(\.\d+)+$/.test(n)||r.add(`https://`+n)}let i=[...r];if(i.length>0){fe(`Studio`,`🩺`,`Smoke-test: ${i.length} URL — verifico raggiungibilità...`,`system`);try{let t=await fetch(mt()+`/api/studio/smoke-test`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({urls:i}),signal:e.signal});if(t.ok){let{probes:e}=await t.json(),n=e.filter(e=>!e.ok);n.length>0?fe(`Studio`,`⚠`,`URL primari non raggiungibili — proverò fonti indirette via web_search:\n${n.map(e=>`• ${e.url} → ${e.status||`NET`} ${e.reason}`).join(`
|
|
628
|
-
`)}`,`system`):fe(`Studio`,`✅`,`Smoke-test: tutti gli URL rispondono.`,`system`)}}catch(e){fe(`Studio`,`⚠`,`Smoke-test non eseguibile: ${e.message}. Procedo comunque — il backend gestirà i fetch falliti con fallback indiretto.`,`system`)}}fe(`Studio`,`🎬`,`Planning workflow…`,`system`);let o={task:n.trim()};g&&(o[g.name.endsWith(`.pdf`)?`pdfBase64`:`imageBase64`]=g.data,g.name.endsWith(`.pdf`)&&(o.pdfName=g.name));let s=[];try{let t=await fetch(mt()+`/api/studio/plan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o),signal:e.signal});if(t.ok){let e=await t.json();s=e.steps??e.nodes??[]}}catch{}s.length||(s=[{icon:`🤖`,agent:`general`,label:`Assistant`,status:`waiting`,output:``}]);let c=s.map(e=>({...e,status:`waiting`,output:``}));a(c),fe(`Studio`,`📋`,`${c.length} agents planned: ${c.map(e=>e.label).join(` → `)}`,`system`);let u=``,d=!1,f=[...c],m=[],h=e=>{let t=m.filter(t=>t.agent!==e);return t.length===0?``:t.map(e=>`### ${e.icon} ${e.label} (${e.agent}) ha proposto:\n${e.output.slice(0,6e3)}`).join(`
|
|
629
|
-
|
|
630
|
-
---
|
|
631
|
-
|
|
632
|
-
`)},_=e=>e.replace(/<think>[\s\S]*?<\/think>/gi,``).replace(/<tool[^>]*>[\s\S]*?<\/tool>/gi,``).replace(/<scratch[^>]*>[\s\S]*?<\/scratch>/gi,``).replace(/\[(?:Searching|Fetching|GET|POST|Raccolta dati web)[^\]]*\]\s*/gi,``).trim(),v=f.findIndex(e=>/WebSearch|Travel|HERALD|MERCURY|ATHENA|ORACLE|CASSANDRA|TEMPEST|EPICURE|CARTOGRAPHER|DataAnalyst/i.test(e.agent));for(let t=0;t<f.length&&!(e.signal.aborted||d);t++){let r=f[t],i=t===v||v===-1&&t===0;f[t]={...r,status:`running`,output:``,isPrimaryResearch:i},a([...f]),fe(r.label,r.icon,`Running ${r.label}…`,`agent`);let o=``,s,c=null,l=h(r.agent);try{if(await ht(`/api/studio/run`,{stepIdx:t,agent:r.agent,task:n.trim(),stepDef:{prompt:r.reason,isPrimaryResearch:i},isPrimaryResearch:i,context:u.length>12e4?u.slice(-12e4):u,proposalContext:l||void 0,...t===0&&g?g.name.endsWith(`.pdf`)?{pdfBase64:g.data,pdfName:g.name}:{imageBase64:g.data}:{}},e=>{if(e.aborted){c={reason:String(e.reason??`UNKNOWN`),message:String(e.message??`Pipeline interrotta dal backend.`)};return}if(e.data_unavailable){let t=e.data_unavailable;for(let e of t)fe(r.label,`⚠`,`Fonte non raggiungibile: ${e.url} → ${e.code} ${e.reason}`,`error`)}e.done&&e.dataQuality&&(s=e.dataQuality);let n=e.token??e.content??``;n&&(n.startsWith(`[`)&&n.trimEnd().endsWith(`]`)&&!n.includes(`
|
|
633
|
-
`)&&!n.includes(`*`)&&!n.includes(`#`)?(f[t]={...f[t],statusLine:n.replace(/^\[|\]\s*$/g,``)},a([...f])):(f[t]={...f[t],output:(f[t].output||``)+n,statusLine:void 0},o=f[t].output,a([...f])))},e.signal),c){let e=c;f[t]={...f[t],status:`aborted`,output:e.message},a([...f]),fe(r.label,`⛔`,`${e.reason}: ${e.message}`,`error`),i&&(fe(`Studio`,`⛔`,`Primary research fallita — pipeline interrotta per evitare contenuto inventato.`,`error`),d=!0);continue}let{clean:p,canvasBlocks:h}=pt(o),v=p||`(no output)`;f[t]={...f[t],status:`done`,output:v,dataQuality:s},a([...f]);let y=_(v);u+=`\n\n[${r.label}]:\n${y}`,m.push({agent:r.agent,label:r.label,icon:r.icon,output:y});let b=s?.label?` · quality:${s.label}(${Math.round(s.score*100)}%)`:``;if(fe(r.label,r.icon,`Done (${v.length} chars)${b}`,`agent`),i&&s&&s.label===`low`&&s.score<.3&&(fe(`Studio`,`⛔`,`Primary research score ${Math.round(s.score*100)}% — pipeline interrotta. Le sezioni a valle non riceveranno dati attendibili.`,`error`),d=!0),h.length>0){let e=h[h.length-1];ue.current=e,S(e),O(!0),k(`canvas`),fe(r.label,r.icon,`Canvas render captured`,`system`)}}catch(n){if(e.signal.aborted)break;f[t]={...f[t],status:`error`,output:n.message??`Error`},a([...f]),fe(r.label,r.icon,`Error: ${n.message}`,`error`)}}let y=f.filter(e=>e.status===`done`&&e.output&&e.output!==`(no output)`&&![`CanvasAgent`,`GitHubAgent`,`EmailAgent`,`CalendarAgent`].includes(e.agent)&&(!e.dataQuality||e.dataQuality.label!==`low`));!d&&y.length>=2?(N.current=y,E(y),T(!0),fe(`Consiglio`,`🏛️`,`${y.length} agenti pronti — clicca "Attiva" per il Consiglio (opt-in)`,`system`)):d?fe(`Consiglio`,`ℹ️`,`Deliberazione non proposta — pipeline interrotta prima del completamento`,`system`):fe(`Studio`,`ℹ️`,`Deliberazione non proposta — meno di 2 agenti specialisti con dati attendibili`,`system`);let b=M.current,x=f.filter(e=>e.output&&e.output!==`(no output)`).map(e=>`## ${e.icon} ${e.label}\n\n${e.output}`).join(`
|
|
634
|
-
|
|
635
|
-
---
|
|
636
|
-
|
|
637
|
-
`);if(l(x),fe(`Studio`,`✅`,`Workflow completo`,`system`),!ue.current){let e=f.filter(e=>e.output&&e.output!==`(no output)`),t=rt(n.trim())?it(n.trim(),e):st(n.trim(),e,b);ue.current=t,S(t),fe(`Studio`,`📊`,`Report canvas generato`,`system`)}let C=[{id:`s_${Date.now()}`,task:n.trim(),nodes:f,log:[],result:x,council:b??void 0,canvas:ue.current||void 0,ts:new Date().toISOString()},...lt()].slice(0,20);ct(C),p(C)}catch(e){e instanceof DOMException&&e.name===`AbortError`||fe(`Studio`,`❌`,`Fatal: ${e.message}`,`error`)}finally{d(!1),se.current=null}},he=()=>{se.current?.abort(),d(!1),a(e=>e.map(e=>e.status===`running`?{...e,status:`error`}:e)),fe(`Studio`,`⬛`,`Stopped`,`system`)},ge=async()=>{let e=N.current;if(!e.length)return;T(!1);let t=se.current??new AbortController;se.current=t;let r={phase:`r2`,r1Convergence:0,r2Convergence:0,converged:!1,r2Nodes:[],synthesis:``};M.current=r,w({...r}),fe(`Consiglio`,`🏛️`,`Avvio deliberazione — ${e.length} agenti`,`system`);try{await ht(`/api/studio/deliberate`,{task:n.trim(),proposals:e.map(e=>({agent:e.agent,label:e.label,icon:e.icon,output:e.output}))},e=>{let t=M.current;if(typeof e.token==`string`){e.token.startsWith(`[`)||fe(`Consiglio`,`🏛️`,e.token.trim(),`system`);return}if(e.deliberation_r2){let n=e.deliberation_r2,r={...t,phase:`r2`,r2Nodes:[...t.r2Nodes.filter(e=>e.agent!==n.agent),n]};M.current=r,w({...r}),fe(n.label,n.icon,`Posizione raffinata (Round 2)`,`agent`);return}if(e.deliberation_r3){let n=e.deliberation_r3,r={...t,phase:`r3`,synthesis:n.output,converged:n.converged};M.current=r,w({...r}),fe(`HERALD`,`📰`,n.converged?`Sintesi consenso`:`Mediazione divergenze`,`agent`);return}if(e.deliberation_done){let n=e;if(n.skipped){let e={...t,phase:`skipped`,skipped:!0,skipReason:n.reason};M.current=e,w({...e})}else{let e={...t,phase:`done`,r1Convergence:n.r1_convergence??t.r1Convergence,r2Convergence:n.r2_convergence??t.r2Convergence,converged:n.converged??t.converged,synthesis:n.mediation??t.synthesis};M.current=e,w({...e}),fe(`Parlamento`,`✅`,`Consenso — R2: ${Math.round((n.r2_convergence??0)*100)}%`,`system`)}}},t.signal);let r=M.current;if(r&&r.phase===`done`&&r.synthesis){let e=i.filter(e=>e.output&&e.output!==`(no output)`),t=rt(n.trim())?it(n.trim(),e):st(n.trim(),e,r);ue.current=t,S(t),fe(`Studio`,`📊`,`Report aggiornato con sintesi del Consiglio`,`system`);try{let n=lt();n.length>0&&n[0]&&(n[0]={...n[0],council:r,canvas:t,nodes:e},ct(n),p(n))}catch{}}}catch(e){t.signal.aborted||fe(`Parlamento`,`⚠️`,`Deliberazione fallita: ${e.message}`,`error`)}},_e=e=>{r(e.task),a(e.nodes.map(e=>({...e,status:`done`}))),s(e.log),l(e.result),w(e.council??null),e.canvas&&(S(e.canvas),ue.current=e.canvas),h(!1)},ve=e=>{if(!confirm(`Delete this session? This cannot be undone.`))return;let t=f.filter(t=>t.id!==e);ct(t),p(t),t.length===0&&h(!1)},ye=()=>{confirm(`Delete ALL sessions? This cannot be undone.`)&&(ct([]),p([]),h(!1))},be=()=>{if(!c&&i.length===0)return;let e=i.filter(e=>e.output&&e.output!==`(no output)`),t=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),r=e=>xe(at(e)),a=e.map(ot),o=a.length>0?Math.round(a.reduce((e,t)=>e+t,0)/a.length):0,s=Math.floor(Math.min(560,e.length*80)),l=e.length>0?Math.floor(s/e.length)-6:40,u=o<50&&e.length>0?`<div class="chart-section" style="background:#fef2f2 !important;border:1px solid #fca5a5;">
|
|
638
|
-
<h3 class="chart-title" style="color:#b91c1c;">⚠ Data Quality Warning — punteggio medio ${o}%</h3>
|
|
639
|
-
<div style="font-size:12px;color:#7f1d1d;line-height:1.6;">Una o più fonti dati non sono state raccolte correttamente durante questa esecuzione. Incrocia sempre con la fonte originale prima di prendere decisioni.</div>
|
|
640
|
-
</div>`:``,d=e.length>=2?`
|
|
641
|
-
<div class="chart-section">
|
|
642
|
-
<h3 class="chart-title">Data Quality Score (verifiable signals)</h3>
|
|
643
|
-
<svg width="${s}" height="120" viewBox="0 0 ${s} 120" xmlns="http://www.w3.org/2000/svg">
|
|
644
|
-
<rect width="${s}" height="120" fill="#f8fafc" rx="6"/>
|
|
645
|
-
${a.map((t,n)=>{let r=n*(l+6)+4,i=Math.round(t*.8),a=100-i,o=t>=70?`#22c55e`:t>=50?`#f59e0b`:`#ef4444`;return`<rect x="${r}" y="${a}" width="${l}" height="${i}" fill="${o}" rx="3"/>
|
|
646
|
-
<text x="${r+l/2}" y="114" text-anchor="middle" font-size="8" fill="#64748b">${e[n].label.slice(0,8)}</text>
|
|
647
|
-
<text x="${r+l/2}" y="${a-4}" text-anchor="middle" font-size="9" font-weight="bold" fill="${o}">${t}%</text>`}).join(``)}
|
|
648
|
-
<line x1="0" y1="100" x2="${s}" y2="100" stroke="#e2e8f0" stroke-width="1"/>
|
|
649
|
-
</svg>
|
|
650
|
-
</div>${u}`:``,f=C?.synthesis?`<div class="section parliament"><div class="agent-header"><span class="icon">🏛️</span><div class="agent-name">Parliament — HERALD Synthesis</div></div><div class="section-body"><p>${r(C.synthesis)}</p></div></div>`:``,p=`<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>NHA Studio — ${t(n)}</title>
|
|
651
|
-
<style>
|
|
652
|
-
*{box-sizing:border-box;margin:0;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
653
|
-
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#1e293b;background:#fff;font-size:13px;line-height:1.75;padding:40px;max-width:900px;margin:0 auto}
|
|
654
|
-
.cover{background:linear-gradient(135deg,#1e1b4b 0%,#312e81 50%,#0f172a 100%) !important;color:#fff !important;padding:48px 52px;margin-bottom:36px;border-radius:12px;page-break-after:always;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
655
|
-
.cover h1{color:#fff !important;font-size:28px;font-weight:900;margin-bottom:6px;letter-spacing:-0.5px}
|
|
656
|
-
.cover .meta{color:rgba(255,255,255,.7) !important;font-size:11px;margin-bottom:18px}
|
|
657
|
-
.task{color:#fff !important;font-size:14px;padding:14px 18px;background:rgba(99,102,241,0.25) !important;border-radius:8px;border-left:4px solid #818cf8 !important;line-height:1.6}
|
|
658
|
-
.toc{margin-bottom:32px;padding:16px 20px;background:#f1f5f9 !important;border-radius:8px;border-left:3px solid #6366f1 !important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
659
|
-
.toc h3{font-size:11px;font-weight:700;color:#64748b;text-transform:uppercase;letter-spacing:1px;margin-bottom:10px}
|
|
660
|
-
.toc-item{display:flex;align-items:center;gap:8px;padding:3px 0;font-size:12px;color:#334155}
|
|
661
|
-
.toc-icon{font-size:14px;width:20px;text-align:center}
|
|
662
|
-
.section{margin-bottom:36px;padding-bottom:36px;border-bottom:1px solid #e2e8f0;page-break-inside:avoid}
|
|
663
|
-
.section.parliament{background:linear-gradient(135deg,#ede9fe,#f0f9ff) !important;padding:20px 24px;border-radius:10px;border:1px solid #c4b5fd !important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
664
|
-
.agent-header{display:flex;align-items:center;gap:12px;margin-bottom:18px;padding-bottom:10px;border-bottom:2px solid #6366f1 !important}
|
|
665
|
-
.icon{font-size:22px;width:32px;text-align:center}
|
|
666
|
-
.agent-name{font-size:15px;font-weight:800;color:#0f172a}
|
|
667
|
-
.section-body{font-size:13px;line-height:1.8;color:#374151}
|
|
668
|
-
.section-body h1{font-size:17px;font-weight:800;margin:20px 0 10px;color:#0f172a;padding-bottom:6px;border-bottom:2px solid #6366f1}
|
|
669
|
-
.section-body h2{font-size:14px;font-weight:700;margin:16px 0 8px;color:#0f172a;padding-left:10px;border-left:3px solid #4f46e5}
|
|
670
|
-
.section-body h3{font-size:13px;font-weight:700;margin:12px 0 6px;color:#7c3aed;padding-left:8px;border-left:2px solid #7c3aed}
|
|
671
|
-
.section-body strong{color:#0f172a;font-weight:700}
|
|
672
|
-
.section-body em{font-style:italic;color:#64748b}
|
|
673
|
-
.section-body code{background:#f1f5f9 !important;border:1px solid #e2e8f0;border-radius:3px;padding:1px 5px;font-family:monospace;font-size:11px;color:#7c3aed !important}
|
|
674
|
-
.section-body table{width:100%;border-collapse:collapse;margin:14px 0}
|
|
675
|
-
.section-body th{background:#f1f5f9 !important;color:#0f172a;font-weight:700;padding:8px 12px;text-align:left;border:1px solid #e2e8f0;font-size:11px;text-transform:uppercase;letter-spacing:0.5px;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
676
|
-
.section-body td{padding:8px 12px;border:1px solid #e2e8f0;color:#374151;font-size:12px}
|
|
677
|
-
.section-body tr:nth-child(even) td{background:#f8fafc !important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
678
|
-
.section-body ul{padding-left:20px;margin:8px 0}
|
|
679
|
-
.section-body li{margin-bottom:4px}
|
|
680
|
-
.section-body p{margin:0 0 8px}
|
|
681
|
-
.chart-section{margin:24px 0;padding:16px 20px;background:#f8fafc !important;border-radius:8px;border:1px solid #e2e8f0;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
682
|
-
.chart-title{font-size:12px;font-weight:700;color:#64748b;text-transform:uppercase;letter-spacing:0.5px;margin-bottom:14px}
|
|
683
|
-
.footer{margin-top:48px;padding-top:16px;border-top:1px solid #e2e8f0;color:#94a3b8;font-size:10px;text-align:center}
|
|
684
|
-
@media print{*{-webkit-print-color-adjust:exact !important;print-color-adjust:exact !important}
|
|
685
|
-
.cover{page-break-after:always;background:linear-gradient(135deg,#1e1b4b 0%,#312e81 50%,#0f172a 100%) !important}
|
|
686
|
-
.section{page-break-inside:avoid}
|
|
687
|
-
@page{margin:1.5cm;size:A4}}
|
|
688
|
-
</style></head><body>
|
|
689
|
-
<div class="cover">
|
|
690
|
-
<h1>NHA Studio Report</h1>
|
|
691
|
-
<div class="meta">Generated ${new Date().toLocaleString()} · ${e.length} agents · ${C?.phase===`done`?`🏛️ Parliament`:`Solo analysis`}</div>
|
|
692
|
-
<div class="task">${t(n)}</div>
|
|
693
|
-
</div>
|
|
694
|
-
<div class="toc">
|
|
695
|
-
<h3>Table of Contents</h3>
|
|
696
|
-
${e.map(e=>`<div class="toc-item"><span class="toc-icon">${e.icon}</span>${e.label}</div>`).join(``)}
|
|
697
|
-
${C?.synthesis?`<div class="toc-item"><span class="toc-icon">🏛️</span>Parliament Synthesis</div>`:``}
|
|
698
|
-
</div>
|
|
699
|
-
${d}
|
|
700
|
-
${e.map(e=>`<div class="section"><div class="agent-header"><span class="icon">${e.icon}</span><div class="agent-name">${e.label}</div></div><div class="section-body"><p>${r(e.output)}</p></div></div>`).join(``)}
|
|
701
|
-
${f}
|
|
702
|
-
<div class="footer">NHA Studio · nothumanallowed.com · ${new Date().getFullYear()}</div>
|
|
703
|
-
</body></html>`,m=new Blob([p],{type:`text/html`}),h=URL.createObjectURL(m),g=document.createElement(`a`);g.href=h,g.download=`nha-report-${Date.now()}.html`,g.click(),URL.revokeObjectURL(h);let _=window.open(``,`_blank`,`width=1100,height=800`);_&&(_.document.open(),_.document.write(p),_.document.close(),_.onload=()=>setTimeout(()=>{_.focus(),_.print()},600))},P=t=>{let n=`**Studio Workflow Result**\n\nTask: ${t.task}\n\nAgents: ${t.nodes.map(e=>e.label).join(` → `)}\n\n---\n\n${t.result}`;try{sessionStorage.setItem(`nha_studio_import`,n)}catch{}e(`chat`)},Se=()=>{if(!u){r(``),a([]),s([]),l(``),S(``),ue.current=``,w(null),M.current=null,T(!1),b({in:0,out:0}),v(null),O(!1);try{sessionStorage.removeItem(ut)}catch{}}},Ce=i.some(e=>e.output||e.status===`running`);return(0,A.jsxs)(`div`,{className:F.root,children:[(0,A.jsxs)(`div`,{className:F.header,children:[(0,A.jsxs)(`div`,{className:F.headerLeft,children:[(0,A.jsx)(`div`,{className:F.title,children:`Studio`}),(0,A.jsx)(`div`,{className:F.subtitle,children:`Multi-agent orchestration · Council deliberation · Geth Consensus`})]}),(0,A.jsxs)(`div`,{className:F.headerActions,children:[y.in+y.out>0&&(0,A.jsxs)(`div`,{className:F.tokenBar,children:[(0,A.jsxs)(`span`,{className:F.tokIn,children:[`↑ `,y.in.toLocaleString()]}),(0,A.jsx)(`span`,{className:F.tokDim,children:` in `}),(0,A.jsxs)(`span`,{className:F.tokOut,children:[`↓ `,y.out.toLocaleString()]}),(0,A.jsx)(`span`,{className:F.tokDim,children:` out`})]}),(0,A.jsxs)(`div`,{style:{position:`relative`},ref:de,children:[(0,A.jsxs)(`button`,{className:F.sessionsBtn,onClick:()=>h(e=>!e),children:[`Sessions (`,f.length,`)`]}),m&&(0,A.jsx)(`div`,{className:F.sessionsDrawer,children:f.length===0?(0,A.jsx)(`div`,{className:F.noSessions,children:`No saved sessions yet.`}):(0,A.jsxs)(A.Fragment,{children:[f.map(e=>(0,A.jsxs)(`div`,{className:F.sessionItem,children:[(0,A.jsxs)(`div`,{className:F.sessionInfo,onClick:()=>_e(e),children:[(0,A.jsx)(`div`,{className:F.sessionTask,children:e.task.slice(0,80)}),(0,A.jsxs)(`div`,{className:F.sessionMeta,children:[e.ts.slice(0,16),` · `,e.nodes.length,` agents`,e.council?.phase===`done`?` · 🏛️ Council`:``]})]}),(0,A.jsxs)(`div`,{className:F.sessionBtns,children:[(0,A.jsx)(`button`,{className:F.importBtn,onClick:()=>P(e),children:`→ Chat`}),(0,A.jsx)(`button`,{className:F.delSessionBtn,onClick:()=>ve(e.id),children:`✕`})]})]},e.id)),(0,A.jsx)(`div`,{className:F.sessionsFooter,children:(0,A.jsx)(`button`,{className:F.clearAllSessionsBtn,onClick:ye,children:`Clear All`})})]})})]}),x&&(0,A.jsx)(`button`,{className:F.canvasToggleBtn,onClick:()=>{O(!0),k(`canvas`)},children:`📊 Panel`}),c&&(0,A.jsx)(`button`,{className:F.pdfBtn,onClick:be,children:`⬇ PDF / HTML`}),(i.length>0||c||o.length>0)&&!u&&(0,A.jsx)(`button`,{className:F.clearBtn,onClick:Se,title:`Clear all — start fresh`,children:`✕ Clear`})]})]}),(0,A.jsxs)(`div`,{className:F.inputArea,children:[(0,A.jsxs)(`div`,{className:F.inputRow,children:[(0,A.jsx)(`textarea`,{className:F.taskInput,value:n,onChange:e=>r(e.target.value),placeholder:`Describe your task… e.g. Analyze my emails and create a priority action plan`,rows:4,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),me())}}),(0,A.jsxs)(`div`,{className:F.inputControls,children:[u?(0,A.jsx)(`button`,{className:F.stopBtn,onClick:he,children:`■ Stop`}):(0,A.jsx)(`button`,{className:F.runBtn,onClick:me,disabled:!n.trim(),children:`Run ▶`}),(0,A.jsxs)(`label`,{className:F.attachBtn,title:`Attach PDF or image`,children:[`📎`,(0,A.jsx)(`input`,{type:`file`,accept:`.pdf,.png,.jpg,.jpeg,.gif,.webp`,style:{display:`none`},onChange:e=>pe(e.target.files?.[0])})]})]})]}),g&&(0,A.jsxs)(`div`,{className:F.attachBadge,children:[`📎 `,g.name,(0,A.jsx)(`button`,{className:F.clearAttach,onClick:()=>v(null),children:`✕`})]}),!u&&i.length===0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:F.examples,children:Oe.map((e,t)=>(0,A.jsx)(`button`,{className:F.exampleBtn,onClick:()=>r(e),children:e},t))}),(0,A.jsxs)(`div`,{className:F.financeSection,children:[(0,A.jsx)(`div`,{className:F.financeSectionTitle,children:`📈 Finance & Trading Workflows`}),(0,A.jsx)(`div`,{className:F.financePresets,children:Ee.map((e,t)=>(0,A.jsx)(`button`,{className:F.financeBtn,onClick:()=>{r(e.task),a(e.agents)},children:e.label},t))})]})]})]}),i.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:F.officeSceneWrap,style:{overflow:`hidden`,position:`relative`,height:`180px`},children:(0,A.jsxs)(`div`,{style:{display:`flex`,width:`200%`,height:`100%`,transition:`transform 700ms cubic-bezier(0.22, 1, 0.36, 1)`,transform:C&&C.phase!==`idle`&&C.phase!==`skipped`?`translateX(-50%)`:`translateX(0)`},children:[(0,A.jsx)(`div`,{style:{width:`50%`,height:`100%`,flexShrink:0},children:(0,A.jsx)(Ze,{nodes:i,running:u})}),(0,A.jsx)(`div`,{style:{width:`50%`,height:`100%`,flexShrink:0},children:(0,A.jsx)(nt,{agents:ne.length>0?ne:i,council:C})})]})}),(0,A.jsxs)(`div`,{className:`${F.pipelineWrap} ${u?F.pipelineRunning:``}`,children:[(0,A.jsxs)(`div`,{className:F.pipelineTitle,children:[`Agent Pipeline`,u&&(0,A.jsx)(`span`,{className:F.pipelineLiveTag,children:`● LIVE`})]}),(0,A.jsx)(`div`,{className:F.pipelineNodes,children:i.map((e,t)=>(0,A.jsxs)(`div`,{className:F.pipelineStep,children:[(0,A.jsxs)(`div`,{className:`${F.agentChip} ${F[`chip_${e.status}`]}`,children:[(0,A.jsx)(`span`,{className:F.chipIcon,children:e.icon}),(0,A.jsx)(`span`,{className:F.chipLabel,children:e.label}),e.status===`running`&&(0,A.jsxs)(`span`,{className:F.chipDots,children:[(0,A.jsx)(`span`,{className:F.dot1,children:`.`}),(0,A.jsx)(`span`,{className:F.dot2,children:`.`}),(0,A.jsx)(`span`,{className:F.dot3,children:`.`})]}),e.status===`done`&&(0,A.jsx)(`span`,{className:F.chipCheck,children:`✓`}),e.status===`error`&&(0,A.jsx)(`span`,{className:F.chipErr,children:`✗`})]}),t<i.length-1&&(0,A.jsx)(`div`,{className:`${F.arrow} ${u?F.arrowActive:``}`,children:`→`})]},t))}),i.some(e=>e.reason)&&(0,A.jsx)(`div`,{className:F.reasonRow,children:i.map((e,t)=>e.reason?(0,A.jsxs)(`div`,{className:F.reasonChip,title:e.reason,children:[(0,A.jsx)(`span`,{className:F.reasonIcon,children:e.icon}),(0,A.jsxs)(`span`,{className:F.reasonText,children:[e.reason.slice(0,60),e.reason.length>60?`…`:``]})]},t):null)})]})]}),(0,A.jsxs)(`div`,{className:F.body,ref:le,children:[(o.length>0||Ce)&&(0,A.jsxs)(`div`,{className:F.twoCol,children:[(0,A.jsxs)(`div`,{className:F.logPanel,children:[(0,A.jsx)(`div`,{className:F.panelTitle,children:`Live Log`}),(0,A.jsx)(`div`,{className:F.logBody,ref:ce,children:o.map((e,t)=>(0,A.jsxs)(`div`,{className:`${F.logEntry} ${F[`log_${e.type}`]}`,children:[(0,A.jsx)(`span`,{className:F.logTime,children:e.time}),(0,A.jsx)(`span`,{className:F.logIcon,children:e.icon}),(0,A.jsx)(`span`,{className:F.logAgent,children:e.agent}),(0,A.jsx)(`span`,{className:F.logText,children:e.text})]},t))})]}),(0,A.jsx)(`div`,{className:F.liveOutputPanel,children:i.filter(e=>e.output||e.status===`running`).map((e,t)=>(0,A.jsxs)(`div`,{className:`${F.liveBlock} ${e.status===`running`?F.liveBlockActive:``} ${e.status===`done`&&e.output?F.liveBlockClickable:``}`,onClick:()=>e.status===`done`&&e.output?oe(e):void 0,children:[(0,A.jsxs)(`div`,{className:F.liveBlockHeader,children:[(0,A.jsx)(`span`,{className:F.liveBlockIcon,children:e.icon}),(0,A.jsx)(`span`,{className:F.liveBlockLabel,children:e.label}),e.reason&&(0,A.jsx)(`span`,{className:F.liveBlockReason,title:e.reason,children:`ℹ`}),(0,A.jsx)(`span`,{className:`${F.outputStatus} ${F[`status_${e.status}`]}`,children:e.status}),e.status===`done`&&e.output&&(0,A.jsx)(`span`,{className:F.expandHint,children:`↗ espandi`})]}),e.status===`running`&&(0,A.jsxs)(`div`,{className:F.liveBlockWorking,children:[(0,A.jsx)(`span`,{className:F.workingDot}),(0,A.jsx)(`span`,{className:F.workingDot}),(0,A.jsx)(`span`,{className:F.workingDot}),(0,A.jsx)(`span`,{className:F.workingLabel,children:e.statusLine??`elaborazione in corso`})]}),(0,A.jsx)(`div`,{className:`${F.liveBlockBody} ${e.status===`done`&&e.output?F.liveBlockBodyClamped:``}`,dangerouslySetInnerHTML:{__html:xe(e.output)+(e.status===`running`&&e.output?`<span class="studio-cursor"></span>`:``)}})]},t))})]}),ee&&(0,A.jsxs)(`div`,{className:F.parliamentPrompt,children:[(0,A.jsx)(`div`,{className:F.parliamentPromptIcon,children:`🏛️`}),(0,A.jsxs)(`div`,{className:F.parliamentPromptContent,children:[(0,A.jsx)(`div`,{className:F.parliamentPromptTitle,children:`Attivare il Consiglio?`}),(0,A.jsxs)(`div`,{className:F.parliamentPromptDesc,children:[ne.length,` agenti (`,ne.map(e=>e.label).join(`, `),`) hanno prodotto output. Il Geth Consensus eseguirà cross-reading, refinement e mediazione HERALD per raggiungere un consenso collettivo.`]}),(0,A.jsxs)(`div`,{className:F.parliamentPromptMeta,children:[`Complessità: `,ne.length<=3?`⚡ Rapido (~30s)`:ne.length<=5?`⏱ Medio (~60s)`:`🕐 Lungo (~2min)`,`\xA0· Consigliato per task analitici complessi`]})]}),(0,A.jsxs)(`div`,{className:F.parliamentPromptBtns,children:[(0,A.jsx)(`button`,{className:F.parliamentActivateBtn,onClick:ge,children:`🏛️ Attiva`}),(0,A.jsx)(`button`,{className:F.parliamentSkipBtn,onClick:()=>T(!1),children:`Salta`})]})]}),C&&!ee&&(0,A.jsx)(`div`,{className:F.councilWrapper,children:(0,A.jsx)(_t,{council:C})}),c&&!u&&(0,A.jsxs)(`details`,{className:F.resultAccordion,open:i.length<=1,children:[(0,A.jsxs)(`summary`,{className:F.resultAccordionSummary,children:[`Full Combined Report (`,i.filter(e=>e.output&&e.output!==`(no output)`).length,` agents)`]}),(0,A.jsx)(`div`,{className:F.resultAccordionBody,dangerouslySetInnerHTML:{__html:xe(c)}})]})]}),D&&(0,A.jsxs)(`div`,{className:F.canvasPanel,children:[(0,A.jsxs)(`div`,{className:F.canvasPanelHeader,children:[(0,A.jsxs)(`div`,{className:F.panelTabs,children:[(0,A.jsx)(`button`,{className:`${F.panelTabBtn} ${re===`canvas`?F.panelTabActive:``}`,onClick:()=>k(`canvas`),children:`📊 Canvas`}),(0,A.jsx)(`button`,{className:`${F.panelTabBtn} ${re===`browser`?F.panelTabActive:``}`,onClick:()=>k(`browser`),children:`🌐 Browser`})]}),(0,A.jsxs)(`div`,{className:F.canvasPanelActions,children:[re===`canvas`&&x&&(0,A.jsx)(`button`,{className:F.canvasPanelBtn,onClick:()=>{let e=new Blob([x],{type:`text/html`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`nha-canvas-report.html`,n.click(),URL.revokeObjectURL(t)},children:`⬇ HTML`}),(0,A.jsx)(`button`,{className:F.canvasPanelClose,onClick:()=>O(!1),children:`✕`})]})]}),re===`canvas`?x?(0,A.jsx)(`iframe`,{className:F.canvasFrame,srcDoc:x,sandbox:`allow-scripts`,title:`Canvas Report`}):(0,A.jsx)(`div`,{className:F.panelEmpty,children:`No canvas report yet. Run a workflow first.`}):(0,A.jsxs)(`div`,{className:F.browserPanel,children:[(0,A.jsxs)(`div`,{className:F.browserBar,children:[(0,A.jsx)(`input`,{className:F.browserInput,value:ie,onChange:e=>j(e.target.value),placeholder:`https://…`,onKeyDown:e=>{e.key===`Enter`&&j(ie)}}),(0,A.jsx)(`button`,{className:F.browserGo,onClick:()=>j(ie),children:`Go`})]}),ie?(0,A.jsx)(`iframe`,{className:F.canvasFrame,src:ie,sandbox:`allow-scripts allow-same-origin allow-forms`,title:`Browser`}):(0,A.jsx)(`div`,{className:F.panelEmpty,children:`Enter a URL above to browse`})]})]}),ae&&(0,A.jsx)(`div`,{className:F.blockModalOverlay,onClick:()=>oe(null),children:(0,A.jsxs)(`div`,{className:F.blockModal,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:F.blockModalHeader,children:[(0,A.jsx)(`span`,{className:F.liveBlockIcon,children:ae.icon}),(0,A.jsx)(`span`,{className:F.blockModalTitle,children:ae.label}),(0,A.jsx)(`button`,{className:F.blockModalClose,onClick:()=>oe(null),children:`✕`})]}),(0,A.jsx)(`div`,{className:`${F.liveBlockBody} ${F.blockModalBody}`,dangerouslySetInnerHTML:{__html:xe(ae.output)}})]})})]})}var z={root:`_root_13wnr_2`,hero:`_hero_13wnr_12`,heroLeft:`_heroLeft_13wnr_21`,heroDate:`_heroDate_13wnr_22`,heroTitle:`_heroTitle_13wnr_23`,heroVer:`_heroVer_13wnr_24`,heroUptime:`_heroUptime_13wnr_25`,heroWeather:`_heroWeather_13wnr_27`,wIcon:`_wIcon_13wnr_35`,wInfo:`_wInfo_13wnr_36`,wTemp:`_wTemp_13wnr_37`,wCity:`_wCity_13wnr_38`,wDesc:`_wDesc_13wnr_39`,wEmpty:`_wEmpty_13wnr_40`,kpiRow:`_kpiRow_13wnr_43`,kpi:`_kpi_13wnr_43`,kpiNum:`_kpiNum_13wnr_55`,kpiLbl:`_kpiLbl_13wnr_56`,kpiBar:`_kpiBar_13wnr_57`,kpiFill:`_kpiFill_13wnr_58`,liveGrid:`_liveGrid_13wnr_61`,liveCard:`_liveCard_13wnr_67`,liveHdr:`_liveHdr_13wnr_71`,liveMore:`_liveMore_13wnr_79`,liveRow:`_liveRow_13wnr_81`,liveUnread:`_liveUnread_13wnr_89`,liveTitle:`_liveTitle_13wnr_89`,liveTime:`_liveTime_13wnr_91`,liveBody:`_liveBody_13wnr_95`,liveSub:`_liveSub_13wnr_97`,prio:`_prio_13wnr_99`,prio_high:`_prio_high_13wnr_103`,prio_medium:`_prio_medium_13wnr_104`,prio_low:`_prio_low_13wnr_105`,launcher:`_launcher_13wnr_108`,launchGroup:`_launchGroup_13wnr_115`,launchGroupLabel:`_launchGroupLabel_13wnr_117`,launchTiles:`_launchTiles_13wnr_123`,tile:`_tile_13wnr_129`,tileIcon:`_tileIcon_13wnr_143`,tileLabel:`_tileLabel_13wnr_144`},yt=[{view:`chat`,icon:`💬`,label:`Chat`,color:`#38bdf8`,group:`Panoramica`},{view:`plan`,icon:`🗓️`,label:`Daily Plan`,color:`#818cf8`,group:`Panoramica`},{view:`tasks`,icon:`✅`,label:`Tasks`,color:`#4ade80`,group:`Panoramica`},{view:`email`,icon:`📧`,label:`Email`,color:`#f87171`,group:`Google`},{view:`calendar`,icon:`📅`,label:`Calendar`,color:`#fb923c`,group:`Google`},{view:`drive`,icon:`💾`,label:`Drive`,color:`#facc15`,group:`Google`},{view:`contacts`,icon:`👤`,label:`Contacts`,color:`#34d399`,group:`Google`},{view:`notes`,icon:`📝`,label:`Notes`,color:`#a78bfa`,group:`Google`},{view:`onedrive`,icon:`☁️`,label:`OneDrive`,color:`#60a5fa`,group:`Microsoft`},{view:`mstodo`,icon:`📋`,label:`MS Todo`,color:`#38bdf8`,group:`Microsoft`},{view:`github`,icon:`🐙`,label:`GitHub`,color:`#e2e8f0`,group:`Tools`},{view:`notion`,icon:`📓`,label:`Notion`,color:`#94a3b8`,group:`Tools`},{view:`slack`,icon:`💼`,label:`Slack`,color:`#e879f9`,group:`Tools`},{view:`maps`,icon:`🗺️`,label:`Maps`,color:`#2dd4bf`,group:`Tools`},{view:`reminders`,icon:`🔔`,label:`Reminders`,color:`#fbbf24`,group:`Tools`},{view:`birthdays`,icon:`🎂`,label:`Birthdays`,color:`#f472b6`,group:`Tools`},{view:`cron`,icon:`⏰`,label:`Cron`,color:`#fb923c`,group:`Tools`},{view:`screen`,icon:`🖥️`,label:`Screen`,color:`#64748b`,group:`Tools`},{view:`agents`,icon:`🤖`,label:`Agents`,color:`#4ade80`,group:`AI`},{view:`studio`,icon:`🎭`,label:`Studio`,color:`#a78bfa`,group:`AI`},{view:`webcraft`,icon:`🔨`,label:`WebCraft`,color:`#f59e0b`,group:`AI`},{view:`collab`,icon:`🏛️`,label:`Alexandria`,color:`#38bdf8`,group:`AI`},{view:`connectors`,icon:`🔗`,label:`AWF - AutoWorkFlow`,color:`#94a3b8`,group:`Config`},{view:`settings`,icon:`⚙️`,label:`Settings`,color:`#64748b`,group:`Config`}],bt={Sunny:`☀️`,Clear:`☀️`,"Partly Cloudy":`⛅`,"Partly cloudy":`⛅`,Cloudy:`☁️`,Overcast:`☁️`,"Light rain":`🌧️`,Rain:`🌧️`,Drizzle:`🌧️`,"Moderate rain":`🌧️`,"Heavy rain":`🌧️`,Snow:`❄️`,"Light snow":`❄️`,Fog:`🌫️`,Mist:`🌫️`,Thunder:`⚡`,"Thundery outbreaks":`⚡`};function xt(e){try{return new Date(e).toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}catch{return e}}function St(e){try{return new Date(e).toLocaleDateString(`en`,{month:`short`,day:`numeric`})}catch{return e}}function Ct(){let e=te(e=>e.setView),t=M(),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(new Date);(0,_.useEffect)(()=>{let e=setInterval(()=>p(new Date),6e4);return()=>clearInterval(e)},[]),(0,_.useEffect)(()=>{let e=!0,t=t=>n=>{e&&n!=null&&t(n)};E(`/api/tasks`).then(e=>t(r)(e?.tasks??[])),E(`/api/emails?page=0&pageSize=8`).then(e=>t(a)(e?.emails??[])),E(`/api/calendar`).then(e=>t(s)(e?.events??[])),E(`/api/status`).then(t(l));let n=localStorage.getItem(`nha_weather_location`),i=t=>E(`/api/weather?location=${encodeURIComponent(t)}`).then(t=>{e&&t&&t.city&&d(t)});return n?i(n):navigator.geolocation?.getCurrentPosition(e=>i(`${e.coords.latitude.toFixed(4)},${e.coords.longitude.toFixed(4)}`),()=>{},{timeout:6e3}),()=>{e=!1}},[]);let m=n.filter(e=>e.status!==`done`),h=n.filter(e=>e.status===`done`),g=n.length>0?Math.round(h.length/n.length*100):0,v=i.filter(e=>e.isUnread).length,y=f.toLocaleDateString(`en`,{weekday:`long`,month:`long`,day:`numeric`}),b=[...new Set(yt.map(e=>e.group))];return(0,A.jsxs)(`div`,{className:z.root,children:[(0,A.jsxs)(`div`,{className:z.hero,children:[(0,A.jsxs)(`div`,{className:z.heroLeft,children:[(0,A.jsx)(`div`,{className:z.heroDate,children:y}),(0,A.jsx)(`div`,{className:z.heroTitle,children:c?(0,A.jsxs)(A.Fragment,{children:[`NHA `,(0,A.jsxs)(`span`,{className:z.heroVer,children:[`v`,c.version]}),` · `,(0,A.jsxs)(`span`,{className:z.heroUptime,children:[Math.floor(c.uptime/60),`m uptime`]})]}):`NotHumanAllowed`})]}),(0,A.jsx)(`div`,{className:z.heroWeather,onClick:()=>{let e=prompt(`City or lat,lon:`);e&&(localStorage.setItem(`nha_weather_location`,e),d(null),E(`/api/weather?location=${encodeURIComponent(e)}`).then(e=>{e&&e.city&&d(e)}))},children:u?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:z.wIcon,children:bt[u.desc]??u.icon??`🌡️`}),(0,A.jsxs)(`div`,{className:z.wInfo,children:[(0,A.jsxs)(`span`,{className:z.wTemp,children:[u.tempC,`°C`]}),(0,A.jsxs)(`span`,{className:z.wCity,children:[u.city.split(`,`)[0],u.country?`, ${u.country.slice(0,2).toUpperCase()}`:``]}),(0,A.jsxs)(`span`,{className:z.wDesc,children:[u.desc,` · 💧`,u.humidity,`%`]})]})]}):(0,A.jsxs)(`span`,{className:z.wEmpty,children:[`🌡️ `,t(`dashboard.weather`)]})})]}),(0,A.jsxs)(`div`,{className:z.kpiRow,children:[(0,A.jsxs)(`div`,{className:z.kpi,onClick:()=>e(`tasks`),role:`button`,children:[(0,A.jsx)(`span`,{className:z.kpiNum,children:m.length}),(0,A.jsx)(`span`,{className:z.kpiLbl,children:`Pending tasks`}),n.length>0&&(0,A.jsx)(`div`,{className:z.kpiBar,children:(0,A.jsx)(`div`,{className:z.kpiFill,style:{width:`${g}%`}})})]}),(0,A.jsxs)(`div`,{className:z.kpi,onClick:()=>e(`email`),role:`button`,children:[(0,A.jsx)(`span`,{className:z.kpiNum,children:v>0?v:i.length}),(0,A.jsx)(`span`,{className:z.kpiLbl,children:v>0?`Unread emails`:`Emails`})]}),(0,A.jsxs)(`div`,{className:z.kpi,onClick:()=>e(`calendar`),role:`button`,children:[(0,A.jsx)(`span`,{className:z.kpiNum,children:o.length}),(0,A.jsx)(`span`,{className:z.kpiLbl,children:`Today's events`})]}),u&&(0,A.jsxs)(`div`,{className:z.kpi,children:[(0,A.jsxs)(`span`,{className:z.kpiNum,children:[u.feelsC,`°`]}),(0,A.jsx)(`span`,{className:z.kpiLbl,children:`Feels like`})]})]}),(0,A.jsxs)(`div`,{className:z.liveGrid,children:[o.length>0&&(0,A.jsxs)(`div`,{className:z.liveCard,children:[(0,A.jsxs)(`div`,{className:z.liveHdr,onClick:()=>e(`calendar`),role:`button`,children:[(0,A.jsxs)(`span`,{children:[`📅 `,t(`calendar.title`)]}),(0,A.jsx)(`span`,{className:z.liveMore,children:`→`})]}),o.slice(0,5).map((t,n)=>(0,A.jsxs)(`div`,{className:z.liveRow,onClick:()=>e(`calendar`),role:`button`,children:[(0,A.jsx)(`span`,{className:z.liveTime,children:t.isAllDay?`All day`:xt(t.start)}),(0,A.jsxs)(`div`,{className:z.liveBody,children:[(0,A.jsx)(`span`,{className:z.liveTitle,children:t.summary}),t.location&&(0,A.jsx)(`span`,{className:z.liveSub,children:t.location})]})]},n))]}),i.length>0&&(0,A.jsxs)(`div`,{className:z.liveCard,children:[(0,A.jsxs)(`div`,{className:z.liveHdr,onClick:()=>e(`email`),role:`button`,children:[(0,A.jsxs)(`span`,{children:[`📧 `,t(`email.inbox`)]}),(0,A.jsx)(`span`,{className:z.liveMore,children:`→`})]}),i.slice(0,5).map((t,n)=>(0,A.jsxs)(`div`,{className:`${z.liveRow} ${t.isUnread?z.liveUnread:``}`,onClick:()=>e(`email`),role:`button`,children:[(0,A.jsx)(`span`,{className:z.liveTime,children:St(t.date)}),(0,A.jsxs)(`div`,{className:z.liveBody,children:[(0,A.jsx)(`span`,{className:z.liveTitle,children:t.subject}),(0,A.jsx)(`span`,{className:z.liveSub,children:t.from})]})]},n))]}),m.length>0&&(0,A.jsxs)(`div`,{className:z.liveCard,children:[(0,A.jsxs)(`div`,{className:z.liveHdr,onClick:()=>e(`tasks`),role:`button`,children:[(0,A.jsxs)(`span`,{children:[`✅ `,t(`tasks.title`),` · `,h.length,`/`,n.length,` (`,g,`%)`]}),(0,A.jsx)(`span`,{className:z.liveMore,children:`→`})]}),m.slice(0,5).map((t,n)=>(0,A.jsxs)(`div`,{className:z.liveRow,onClick:()=>e(`tasks`),role:`button`,children:[(0,A.jsx)(`span`,{className:`${z.prio} ${z[`prio_`+t.priority]}`,children:t.priority[0].toUpperCase()}),(0,A.jsx)(`div`,{className:z.liveBody,children:(0,A.jsx)(`span`,{className:z.liveTitle,children:t.description})})]},n))]})]}),(0,A.jsx)(`div`,{className:z.launcher,children:b.map(t=>(0,A.jsxs)(`div`,{className:z.launchGroup,children:[(0,A.jsx)(`div`,{className:z.launchGroupLabel,children:t}),(0,A.jsx)(`div`,{className:z.launchTiles,children:yt.filter(e=>e.group===t).map(t=>(0,A.jsxs)(`button`,{className:z.tile,onClick:()=>e(t.view),style:{"--tc":t.color},children:[(0,A.jsx)(`span`,{className:z.tileIcon,children:t.icon}),(0,A.jsx)(`span`,{className:z.tileLabel,children:t.label})]},t.view))})]},t))})]})}var wt={root:`_root_1pldx_1`,loading:`_loading_1pldx_2`,bar:`_bar_1pldx_4`,input:`_input_1pldx_5`,select:`_select_1pldx_6`,addBtn:`_addBtn_1pldx_7`,actions:`_actions_1pldx_10`,clearDone:`_clearDone_1pldx_11`,clearAll:`_clearAll_1pldx_12`,stats:`_stats_1pldx_14`,progress:`_progress_1pldx_15`,progressBar:`_progressBar_1pldx_16`,empty:`_empty_1pldx_18`,task:`_task_1pldx_20`,taskDone:`_taskDone_1pldx_22`,check:`_check_1pldx_23`,checkDone:`_checkDone_1pldx_25`,desc:`_desc_1pldx_26`,del:`_del_1pldx_27`,badge:`_badge_1pldx_30`,badge_high:`_badge_high_1pldx_31`,badge_medium:`_badge_medium_1pldx_32`,badge_low:`_badge_low_1pldx_33`,doneLabel:`_doneLabel_1pldx_35`};function Tt(){let e=M(),[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(`medium`),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=()=>E(`/api/tasks`).then(e=>{n(e?.tasks??[]),i(!1)});(0,_.useEffect)(()=>{f()},[]);let p=async()=>{a.trim()&&(u(!0),await D(`/api/tasks`,{description:a.trim(),priority:s}),o(``),u(!1),f(),d.current?.focus())},m=e=>D(`/api/tasks/${e}/done`,{},`PATCH`).then(f),h=e=>D(`/api/tasks/${e}/delete`,{}).then(f),g=()=>D(`/api/tasks/clear`,{filter:`done`}).then(f),v=()=>{confirm(e(`tasks.deleteTask`))&&D(`/api/tasks/clear`,{filter:`all`}).then(f)},y=t.filter(e=>e.status!==`done`),b=t.filter(e=>e.status===`done`);return r?(0,A.jsxs)(`div`,{className:wt.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),e(`common.loading`)]}):(0,A.jsxs)(`div`,{className:wt.root,children:[(0,A.jsxs)(`div`,{className:wt.bar,children:[(0,A.jsx)(`input`,{ref:d,className:wt.input,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>e.key===`Enter`&&p(),placeholder:e(`tasks.newTask`)}),(0,A.jsxs)(`select`,{className:wt.select,value:s,onChange:e=>c(e.target.value),children:[(0,A.jsx)(`option`,{value:`high`,children:`High`}),(0,A.jsx)(`option`,{value:`medium`,children:`Medium`}),(0,A.jsx)(`option`,{value:`low`,children:`Low`})]}),(0,A.jsx)(`button`,{className:wt.addBtn,onClick:p,disabled:l||!a.trim(),children:l?`…`:`+ `+e(`common.add`)})]}),t.length>0&&(0,A.jsxs)(`div`,{className:wt.actions,children:[(0,A.jsx)(`button`,{className:wt.clearDone,onClick:g,children:`Clear completed`}),(0,A.jsx)(`button`,{className:wt.clearAll,onClick:v,children:`Clear all`})]}),t.length>0&&(0,A.jsxs)(`div`,{className:wt.stats,children:[y.length,` pending · `,b.length,` done`,t.length>0&&(0,A.jsx)(`span`,{className:wt.progress,children:(0,A.jsx)(`span`,{className:wt.progressBar,style:{width:`${Math.round(b.length/t.length*100)}%`}})})]}),y.length===0&&b.length===0&&(0,A.jsx)(`div`,{className:wt.empty,children:`No tasks yet. Add one above ↑`}),y.map(e=>(0,A.jsxs)(`div`,{className:wt.task,children:[(0,A.jsx)(`span`,{className:wt.check,onClick:()=>m(e.id)}),(0,A.jsx)(`span`,{className:wt.desc,onClick:()=>m(e.id),children:e.description}),(0,A.jsx)(`span`,{className:`${wt.badge} ${wt[`badge_`+e.priority]}`,children:e.priority}),(0,A.jsx)(`span`,{className:wt.del,onClick:()=>h(e.id),children:`×`})]},e.id)),b.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:wt.doneLabel,children:`Completed`}),b.map(e=>(0,A.jsxs)(`div`,{className:`${wt.task} ${wt.taskDone}`,children:[(0,A.jsx)(`span`,{className:`${wt.check} ${wt.checkDone}`,onClick:()=>m(e.id),children:`✓`}),(0,A.jsx)(`span`,{className:wt.desc,onClick:()=>m(e.id),children:e.description}),(0,A.jsx)(`span`,{className:`${wt.badge} ${wt[`badge_`+e.priority]}`,children:e.priority}),(0,A.jsx)(`span`,{className:wt.del,onClick:()=>h(e.id),children:`×`})]},e.id))]})]})}var B={root:`_root_k5v14_1`,loading:`_loading_k5v14_2`,card:`_card_k5v14_4`,cardTitle:`_cardTitle_k5v14_5`,cardTitleRow:`_cardTitleRow_k5v14_6`,cardSub:`_cardSub_k5v14_7`,connected:`_connected_k5v14_8`,statusMsg:`_statusMsg_k5v14_9`,fields:`_fields_k5v14_11`,field:`_field_k5v14_11`,fieldLabel:`_fieldLabel_k5v14_13`,fieldInput:`_fieldInput_k5v14_14`,saveBtn:`_saveBtn_k5v14_17`,dangerBtn:`_dangerBtn_k5v14_18`,cancelBtn:`_cancelBtn_k5v14_19`,btnRow:`_btnRow_k5v14_20`,keySet:`_keySet_k5v14_22`,keySummary:`_keySummary_k5v14_23`,keySummaryIcon:`_keySummaryIcon_k5v14_24`,nhaFree:`_nhaFree_k5v14_26`,nhaFreeTitle:`_nhaFreeTitle_k5v14_27`,nhaFreeSub:`_nhaFreeSub_k5v14_28`,nhaFreeBtn:`_nhaFreeBtn_k5v14_29`,imapRow:`_imapRow_k5v14_31`,imapName:`_imapName_k5v14_32`,imapMeta:`_imapMeta_k5v14_33`,imapStatus:`_imapStatus_k5v14_34`,imapBtns:`_imapBtns_k5v14_38`,imapSyncBtn:`_imapSyncBtn_k5v14_39`,imapEditBtn:`_imapEditBtn_k5v14_40`,imapDelBtn:`_imapDelBtn_k5v14_41`,emptyImap:`_emptyImap_k5v14_42`,imapForm:`_imapForm_k5v14_44`,imapFormTitle:`_imapFormTitle_k5v14_45`,pwdNote:`_pwdNote_k5v14_46`,pwdRow:`_pwdRow_k5v14_47`,togglePwd:`_togglePwd_k5v14_48`},Et={id:``,display_name:``,email_address:``,from_name:``,imap_host:``,imap_port:`993`,smtp_host:``,smtp_port:`587`,username:``,password:``};function Dt({id:e,label:t,placeholder:n,value:r,onChange:i,type:a=`text`}){return(0,A.jsxs)(`div`,{className:B.field,children:[(0,A.jsx)(`label`,{className:B.fieldLabel,children:t}),(0,A.jsx)(`input`,{id:e,type:a,placeholder:n,value:r,onChange:e=>i(e.target.value),className:B.fieldInput})]})}function Ot(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(``),f=()=>{E(`/api/credentials`).then(e=>t(e?.credentials??[])).catch(()=>t([]))};(0,_.useEffect)(()=>{f()},[]);let p=async()=>{if(!/^[A-Za-z_][A-Za-z0-9_]{0,63}$/.test(n)){d(`Name: lettere, cifre, _ — primo carattere non numerico`);return}if(!i.trim()){d(`Value required`);return}l(!0),d(``);try{let e=await D(`/api/credentials`,{name:n,value:i,description:o});e&&!e.ok&&e.error?d(e.error):(r(``),a(``),s(``),f())}finally{l(!1)}},m=async e=>{confirm(`Delete credential "${e}"?`)&&(await fetch(`/api/credentials/${encodeURIComponent(e)}`,{method:`DELETE`}),f())};return(0,A.jsxs)(`div`,{style:{marginTop:16,padding:16,background:`var(--bg2, rgba(15,23,42,0.4))`,border:`1px solid var(--border, rgba(148,163,184,0.18))`,borderRadius:10},children:[(0,A.jsx)(`div`,{style:{fontSize:14,fontWeight:800,marginBottom:4},children:`Credentials Vault 🔐`}),(0,A.jsxs)(`div`,{style:{fontSize:11,opacity:.7,marginBottom:10},children:[`Encrypted secrets (AES-256-GCM, machine-bound key). Reference them in workflow nodes with `,(0,A.jsx)(`code`,{children:"${cred.NAME}"}),`. The raw value never leaves your computer.`]}),e.length>0&&(0,A.jsx)(`div`,{style:{marginBottom:12,border:`1px solid rgba(148,163,184,0.15)`,borderRadius:6},children:e.map(e=>(0,A.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 10px`,borderBottom:`1px solid rgba(148,163,184,0.1)`,fontSize:12},children:[(0,A.jsx)(`code`,{style:{background:`rgba(99,102,241,0.12)`,padding:`2px 6px`,borderRadius:4,color:`#a5b4fc`,fontWeight:700},children:e.name}),(0,A.jsx)(`span`,{style:{flex:1,opacity:.7},children:e.description||(0,A.jsx)(`em`,{children:`no description`})}),(0,A.jsx)(`span`,{style:{fontSize:10,opacity:.5},children:new Date(e.updatedAt).toLocaleString()}),e.hasError&&(0,A.jsx)(`span`,{style:{color:`#ef4444`,fontSize:10},children:`⚠ decrypt error`}),(0,A.jsx)(`button`,{onClick:()=>m(e.name),style:{background:`transparent`,border:`none`,cursor:`pointer`,color:`#ef4444`,fontSize:14},children:`✕`})]},e.name))}),(0,A.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:8},children:[(0,A.jsx)(`input`,{placeholder:`NAME (e.g. STRIPE_KEY)`,value:n,onChange:e=>r(e.target.value),style:{padding:6,borderRadius:4,border:`1px solid rgba(148,163,184,0.2)`,background:`transparent`,color:`inherit`,fontFamily:`SF Mono, monospace`}}),(0,A.jsx)(`input`,{placeholder:`Description (optional)`,value:o,onChange:e=>s(e.target.value),style:{padding:6,borderRadius:4,border:`1px solid rgba(148,163,184,0.2)`,background:`transparent`,color:`inherit`}})]}),(0,A.jsx)(`input`,{type:`password`,placeholder:`Value (encrypted at rest)`,value:i,onChange:e=>a(e.target.value),style:{width:`100%`,marginTop:6,padding:6,borderRadius:4,border:`1px solid rgba(148,163,184,0.2)`,background:`transparent`,color:`inherit`}}),u&&(0,A.jsx)(`div`,{style:{color:`#ef4444`,fontSize:11,marginTop:4},children:u}),(0,A.jsx)(`button`,{onClick:p,disabled:c,style:{marginTop:8,padding:`6px 14px`,borderRadius:4,border:`none`,background:`#6366f1`,color:`white`,fontWeight:700,cursor:`pointer`,opacity:c?.5:1},children:c?`Saving…`:`+ Add credential`})]})}function kt(){let{setConfig:e}=te(),t=M(),[n,r]=(0,_.useState)({}),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)([]),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)({name:``,email:``,phone:``,homeAddress:``,workAddress:``,city:``,country:``,company:``,role:``,notes:``}),[C,w]=(0,_.useState)(`nha`),[ee,T]=(0,_.useState)(``),[ne,O]=(0,_.useState)(``),[re,k]=(0,_.useState)(``),[ie,j]=(0,_.useState)(``),[ae,oe]=(0,_.useState)(``),[se,ce]=(0,_.useState)(``),[le,ue]=(0,_.useState)(``),[N,de]=(0,_.useState)(``),[fe,pe]=(0,_.useState)(!1),[me,he]=(0,_.useState)(``),[ge,_e]=(0,_.useState)(`en`),[ve,ye]=(0,_.useState)(`07:00`),[be,xe]=(0,_.useState)(`18:00`),[P,Se]=(0,_.useState)(`30`),[Ce,we]=(0,_.useState)(`off`),[Te,F]=(0,_.useState)(``),[Ee,De]=(0,_.useState)(``),[Oe,I]=(0,_.useState)(``),[L,ke]=(0,_.useState)(`agent`),[Ae,je]=(0,_.useState)(``),[Me,Ne]=(0,_.useState)(!0),[Pe,Fe]=(0,_.useState)(!0),[Ie,Le]=(0,_.useState)(`3`),[Re,R]=(0,_.useState)(`0.30`),[ze,Be]=(0,_.useState)(!0),[Ve,He]=(0,_.useState)(!1),[Ue,We]=(0,_.useState)(!1),[Ge,Ke]=(0,_.useState)(!1),[qe,Je]=(0,_.useState)(!1),[Ye,Xe]=(0,_.useState)(!1),[Ze,Qe]=(0,_.useState)(!1),[$e,et]=(0,_.useState)(!0),[tt,nt]=(0,_.useState)(``),[rt,it]=(0,_.useState)(!1),[at,ot]=(0,_.useState)(!1),[st,ct]=(0,_.useState)(!0),[lt,ut]=(0,_.useState)(``),[dt,ft]=(0,_.useState)(``),[pt,mt]=(0,_.useState)(``),[ht,gt]=(0,_.useState)(``),[_t,vt]=(0,_.useState)(`common`),[z,yt]=(0,_.useState)(!1),[bt,xt]=(0,_.useState)(``);(0,_.useEffect)(()=>{E(`/api/config`).then(t=>{r(t??{});let n=t?.profile??{};S({name:n.name??``,email:n.email??``,phone:n.phone??``,homeAddress:n.homeAddress??``,workAddress:n.workAddress??``,city:n.city??``,country:n.country??``,company:n.company??``,role:n.role??``,notes:n.notes??``}),w(t?.provider??`nha`),he(t?.model??``),_e(t?.lang??`en`),ye(t?.planTime??`07:00`),xe(t?.summaryTime??`18:00`),Se(String(t?.meetingAlert??`30`)),we(t?.thinking??`off`),T(``);let i=t?.responder,o=i?.telegram;I(String(o?.botName??``));let s=String(o?.personaMode??`agent`);ke(s===`persona`||s===`persona-only`||s===`persona+role`?s:`agent`),je(Array.isArray(o?.allowedChatIds)?o.allowedChatIds.join(`, `):``),Ne(i?.autoRoute!==!1);let c=t?.deliberation;Fe(c?.enabled!==!1),Le(String(c?.rounds??`3`)),R(String(c?.convergence??`0.30`)),Be(c?.tribunalEnabled!==!1);let l=t?.ops?.proactive;He(!!l?.enabled),We(!!l?.emailFollowUp),Ke(!!l?.meetingPrep),Je(!!l?.patterns),Xe(!!l?.deadlines);let u=t?.voice;Qe(!!u?.preferWhisper),et(u?.speechSynthesis!==!1),nt(String(u?.language??``));let d=t?.features;it(!!d?.verbose),ot(!!d?.immersive),ct(d?.knowledgeEnabled!==!1),ut(``),ft(String(t?.github?.defaultRepo??``)),mt(``),gt(``);let f=t?.microsoft;vt(String(f?.tenantId??`common`));let p=t?.plugins;yt(!!p?.autoRun),xt(String(p?.directory??``)),a(!1),t&&e(t)}),St()},[]);let St=()=>E(`/api/imap/accounts`).then(e=>d(e?.accounts??[])),Ct=async(e,t)=>{s(e),await D(`/api/config`,{key:e,value:t}),l(e),s(null),setTimeout(()=>l(null),2e3)},wt=()=>Ct(`profile`,x),Tt=()=>{Ct(`provider`,C),Ct(`model`,me),Ct(`thinking`,Ce),ee&&Ct(`key`,ee),ne&&Ct(`groq-key`,ne),re&&Ct(`openai-key`,re),ie&&Ct(`gemini-key`,ie),ae&&Ct(`deepseek-key`,ae),se&&Ct(`grok-key`,se),le&&Ct(`mistral-key`,le),N&&Ct(`cohere-key`,N)},kt=()=>{Ct(`planTime`,ve),Ct(`summaryTime`,be),Ct(`meetingAlert`,Number(P))},At=()=>{v(t(`settings.googleOpening`)),D(`/api/google/auth`,{}).then(e=>{e?.url?(window.open(e.url,`_blank`),v(t(`settings.googleOpened`))):e?.error&&v(t(`common.error`)+`: `+e.error)}).catch(e=>v(t(`common.error`)+`: `+e.message))},jt=()=>{confirm(t(`settings.disconnectGoogleConfirm`))&&D(`/api/google/revoke`,{}).then(()=>{r(e=>({...e,hasGoogle:!1})),v(t(`common.disconnected`))})},V=()=>{if(!f)return;let e=!!f.id,t={display_name:f.display_name,email_address:f.email_address,from_name:f.from_name,imap_host:f.imap_host,imap_port:Number(f.imap_port),smtp_host:f.smtp_host,smtp_port:Number(f.smtp_port),username:f.username};f.password&&(t.password=f.password),e&&(t.id=f.id),h(`Saving…`),D(e?`/api/imap/accounts/update`:`/api/imap/accounts`,t).then(e=>{e?.ok||e?.id?(h(`Saved!`),p(null),St()):h(`Error: `+(e?.error??`Unknown error`))}).catch(e=>h(`Error: `+e.message))},Mt=(e,n)=>{confirm(t(`settings.imapDelete`,{name:n}))&&D(`/api/imap/accounts/delete`,{id:e}).then(()=>St())},Nt=e=>{D(`/api/imap/sync`,{accountId:e}).then(()=>setTimeout(St,3e3))},Pt=async()=>{if(f){if(!f.imap_host||!f.imap_port){h(`⚠ Inserisci prima host e porta IMAP.`);return}h(`Diagnostica porta IMAP in corso…`);try{let e=await D(`/api/imap/probe`,{imap_host:f.imap_host,imap_port:Number(f.imap_port)});e?.ok?h(`✓ ${f.imap_host}:${f.imap_port} risponde\n${e.message}${e.banner?`\n\nBanner: ${e.banner}`:``}`):h(`✗ ${f.imap_host}:${f.imap_port} non risponde\n${e?.message??e?.error??`errore sconosciuto`}`)}catch(e){h(`✗ Diagnostica fallita: ${e.message}`)}}},Ft=async e=>{if(!f)return;if(!f.password&&!f.id){h(`⚠ Inserisci la password prima di testare.`);return}h(e?`Invio email di prova…`:`Test connessione in corso…`);let t={imap_host:f.imap_host,imap_port:Number(f.imap_port),smtp_host:f.smtp_host,smtp_port:Number(f.smtp_port),username:f.username,password:f.password,email_address:f.email_address,from_name:f.from_name,sendTest:e};try{let e=await D(`/api/imap/test`,t),n=e?.imap,r=e?.smtp,i=[];n?.ok?i.push(`✓ IMAP OK (TLS=${n.secure?`implicit`:`STARTTLS`}, ${n.folderCount??`?`} cartelle)`):i.push(`✗ IMAP errore: ${n?.error??`sconosciuto`}`),r?.ok?r.sent?i.push(`✓ SMTP OK — email di prova inviata a ${f.email_address} (id ${(r.messageId||``).slice(0,24)}…)`):i.push(`✓ SMTP OK (TLS=${r.secure?`implicit`:`STARTTLS`}, auth valida)`):i.push(`✗ SMTP errore: ${r?.error??`sconosciuto`}`),h(i.join(` · `))}catch(e){h(`✗ Test fallito: ${e.message}`)}};if(i)return(0,A.jsxs)(`div`,{className:B.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),t(`common.loading`)]});let It=e=>t(o===e?`common.saving`:c===e?`common.saved`:`common.save`);return(0,A.jsxs)(`div`,{className:B.root,children:[(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:t(`settings.profile`)}),(0,A.jsx)(`div`,{className:B.cardSub,children:t(`settings.profileSub`)}),(0,A.jsx)(`div`,{className:B.fields,children:[[`name`,t(`settings.name`),t(`settings.namePh`)],[`email`,t(`common.email`),t(`settings.emailPh`)],[`phone`,t(`common.phone`),t(`settings.phonePh`)],[`homeAddress`,t(`settings.homeAddress`),t(`settings.homeAddressPh`)],[`workAddress`,t(`settings.workAddress`),t(`settings.workAddressPh`)],[`city`,t(`settings.city`),t(`settings.cityPh`)],[`country`,t(`settings.country`),t(`settings.countryPh`)],[`company`,t(`settings.company`),t(`settings.companyPh`)],[`role`,t(`settings.role`),t(`settings.rolePh`)],[`notes`,t(`settings.notes`),t(`settings.notesPh`)]].map(([e,t,n])=>(0,A.jsx)(Dt,{id:e,label:t,placeholder:n,value:x[e],onChange:t=>S(n=>({...n,[e]:t}))},e))}),(0,A.jsxs)(`button`,{className:B.saveBtn,onClick:wt,children:[It(`profile`),` `,t(`settings.saveProfile`)]})]}),(0,A.jsxs)(`div`,{className:B.nhaFree,children:[(0,A.jsx)(`div`,{className:B.nhaFreeTitle,children:t(`settings.nhaFreeTitle`)}),(0,A.jsx)(`div`,{className:B.nhaFreeSub,children:t(`settings.nhaFreeSub`)}),(0,A.jsx)(`button`,{className:B.nhaFreeBtn,onClick:()=>{D(`/api/config`,{updates:[{key:`provider`,value:`nha`},{key:`model`,value:``},{key:`key`,value:``}]}).then(()=>{w(`nha`),he(``),T(``),l(`nhaFree`),setTimeout(()=>l(null),2e3)})},children:t(c===`nhaFree`?`settings.liaraActivated`:`settings.useLiara`)})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:t(`settings.llmProvider`)}),(0,A.jsx)(`div`,{className:B.cardSub,children:t(`settings.llmProviderSub`)}),(()=>{let e=[];return n.hasApiKey&&e.push(`Anthropic`),n.hasOpenaiKey&&e.push(`OpenAI`),n.hasGeminiKey&&e.push(`Gemini`),n.hasDeepseekKey&&e.push(`DeepSeek`),n.hasGrokKey&&e.push(`Grok`),n.hasMistralKey&&e.push(`Mistral`),n.hasCohereKey&&e.push(`Cohere`),e.length===0?null:(0,A.jsxs)(`div`,{className:B.keySummary,children:[(0,A.jsx)(`span`,{className:B.keySummaryIcon,children:`🔑`}),(0,A.jsxs)(`span`,{children:[`Chiavi configurate: `,(0,A.jsx)(`strong`,{children:e.join(`, `)})]})]})})(),(0,A.jsxs)(`div`,{className:B.field,children:[(0,A.jsx)(`label`,{className:B.fieldLabel,children:t(`settings.provider`)}),(0,A.jsxs)(`select`,{value:C,onChange:e=>w(e.target.value),className:B.fieldInput,children:[(0,A.jsx)(`option`,{value:`nha`,children:`NHA Free (Liara) — no API key needed`}),(0,A.jsx)(`option`,{value:`anthropic`,children:`Anthropic (Claude)`}),(0,A.jsx)(`option`,{value:`openai`,children:`OpenAI (GPT-4)`}),(0,A.jsx)(`option`,{value:`gemini`,children:`Google (Gemini)`}),(0,A.jsx)(`option`,{value:`deepseek`,children:`DeepSeek`}),(0,A.jsx)(`option`,{value:`grok`,children:`xAI (Grok)`}),(0,A.jsx)(`option`,{value:`mistral`,children:`Mistral`}),(0,A.jsx)(`option`,{value:`cohere`,children:`Cohere`})]})]}),C!==`nha`&&({anthropic:n.hasApiKey,openai:n.hasOpenaiKey,gemini:n.hasGeminiKey,deepseek:n.hasDeepseekKey,grok:n.hasGrokKey,mistral:n.hasMistralKey,cohere:n.hasCohereKey}[C]?(0,A.jsx)(`div`,{className:B.keySet,children:t(`settings.apiKeySet`)}):null),(0,A.jsx)(Dt,{id:`apiKey`,label:t(`settings.apiKey`),placeholder:t(C===`nha`?`settings.apiKeyFreeNote`:`settings.apiKeyPh`),type:`password`,value:ee,onChange:T}),(0,A.jsx)(Dt,{id:`groqKey`,label:`Groq Key (voice / Whisper)`,placeholder:n.hasGroqKey?`✓ configured — leave empty to keep`:`gsk_... (free at console.groq.com/keys) — enables Telegram voice transcription`,type:`password`,value:ne,onChange:O}),(0,A.jsx)(`div`,{style:{marginTop:8,marginBottom:4},children:(0,A.jsxs)(`button`,{type:`button`,onClick:()=>pe(!fe),style:{background:`transparent`,border:`none`,color:`var(--accent, #6366f1)`,cursor:`pointer`,fontSize:12,padding:0,fontWeight:600},children:[fe?`▾`:`▸`,` Optional provider keys (OpenAI, Gemini, DeepSeek, Grok, Mistral, Cohere)`]})}),fe&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Dt,{id:`openaiKey`,label:`OpenAI Key`,placeholder:n.hasOpenaiKey?`✓ configured — leave empty to keep`:`sk-... (platform.openai.com)`,type:`password`,value:re,onChange:k}),(0,A.jsx)(Dt,{id:`geminiKey`,label:`Gemini Key (Google)`,placeholder:n.hasGeminiKey?`✓ configured — leave empty to keep`:`AIza... (aistudio.google.com)`,type:`password`,value:ie,onChange:j}),(0,A.jsx)(Dt,{id:`deepseekKey`,label:`DeepSeek Key`,placeholder:n.hasDeepseekKey?`✓ configured — leave empty to keep`:`sk-... (platform.deepseek.com)`,type:`password`,value:ae,onChange:oe}),(0,A.jsx)(Dt,{id:`grokKey`,label:`Grok Key (X.AI)`,placeholder:n.hasGrokKey?`✓ configured — leave empty to keep`:`xai-... (console.x.ai)`,type:`password`,value:se,onChange:ce}),(0,A.jsx)(Dt,{id:`mistralKey`,label:`Mistral Key`,placeholder:n.hasMistralKey?`✓ configured — leave empty to keep`:`... (console.mistral.ai)`,type:`password`,value:le,onChange:ue}),(0,A.jsx)(Dt,{id:`cohereKey`,label:`Cohere Key`,placeholder:n.hasCohereKey?`✓ configured — leave empty to keep`:`... (dashboard.cohere.com)`,type:`password`,value:N,onChange:de})]}),(0,A.jsx)(Dt,{id:`model`,label:t(`settings.model`),placeholder:t(`settings.modelPh`),value:me,onChange:he}),(0,A.jsxs)(`div`,{className:B.field,children:[(0,A.jsx)(`label`,{className:B.fieldLabel,children:t(`settings.thinking`)}),(0,A.jsxs)(`select`,{value:Ce,onChange:e=>we(e.target.value),className:B.fieldInput,children:[(0,A.jsx)(`option`,{value:`off`,children:t(`settings.thinkingOff`)}),(0,A.jsx)(`option`,{value:`on`,children:t(`settings.thinkingOn`)})]})]}),(0,A.jsxs)(`button`,{className:B.saveBtn,onClick:Tt,children:[It(`provider`),` `,t(`settings.saveProvider`)]})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:t(`settings.language`)}),(0,A.jsxs)(`div`,{className:B.field,children:[(0,A.jsx)(`label`,{className:B.fieldLabel,children:t(`settings.languageLabel`)}),(0,A.jsx)(`select`,{value:ge,onChange:t=>{let r=t.target.value;_e(r),Ct(`lang`,r),e({...n,lang:r})},className:B.fieldInput,children:[[`it`,`Italiano`],[`en`,`English`],[`es`,`Español`],[`fr`,`Français`],[`de`,`Deutsch`],[`pt`,`Português`],[`nl`,`Nederlands`],[`pl`,`Polski`],[`ru`,`Русский`],[`zh`,`中文`],[`ja`,`日本語`],[`ko`,`한국어`],[`ar`,`العربية`],[`hi`,`हिन्दी`],[`tr`,`Türkçe`],[`sv`,`Svenska`],[`da`,`Dansk`],[`fi`,`Suomi`],[`cs`,`Čeština`]].map(([e,t])=>(0,A.jsx)(`option`,{value:e,children:t},e))})]})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:t(`settings.telegram`)}),(0,A.jsx)(`div`,{className:B.cardSub,children:t(`settings.telegramSub`)}),n.hasTelegram&&(0,A.jsxs)(`div`,{className:B.connected,children:[`Telegram: `,t(`common.connected`)]}),n.hasDiscord&&(0,A.jsxs)(`div`,{className:B.connected,children:[`Discord: `,t(`common.connected`)]}),(0,A.jsx)(Dt,{id:`tgToken`,label:t(`settings.telegramToken`),placeholder:n.hasTelegram?t(`settings.telegramSet`):t(`settings.telegramPh`),type:`password`,value:Te,onChange:F}),(0,A.jsx)(Dt,{id:`discordToken`,label:t(`settings.discordToken`),placeholder:n.hasDiscord?t(`settings.discordSet`):t(`settings.discordPh`),type:`password`,value:Ee,onChange:De}),(0,A.jsx)(Dt,{id:`botName`,label:`Bot Persona Name`,placeholder:`e.g. Agata — what name the bot uses when replying. Empty = show internal agent name (HERALD/ATHENA/...)`,value:Oe,onChange:I}),(0,A.jsxs)(`div`,{className:B.field,children:[(0,A.jsx)(`label`,{className:B.fieldLabel,children:`Persona display mode`}),(0,A.jsxs)(`select`,{value:L,onChange:e=>ke(e.target.value),className:B.fieldInput,children:[(0,A.jsx)(`option`,{value:`agent`,children:`agent — show internal name [HERALD] (legacy/debug)`}),(0,A.jsx)(`option`,{value:`persona`,children:`persona — show [BotName] only (recommended)`}),(0,A.jsx)(`option`,{value:`persona-only`,children:`persona-only — no prefix at all (most natural)`}),(0,A.jsx)(`option`,{value:`persona+role`,children:`persona+role — [BotName · agent] (power users)`})]})]}),(0,A.jsx)(Dt,{id:`allowedChatIds`,label:`Allowed Chat IDs (Telegram)`,placeholder:`comma-separated numeric chat IDs (empty = anyone can chat with the bot)`,value:Ae,onChange:je}),(0,A.jsx)(`div`,{className:B.field,children:(0,A.jsxs)(`label`,{className:B.fieldLabel,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:Me,onChange:e=>Ne(e.target.checked)}),` `,`Auto-route messages to specialist agents (recommended)`]})}),(0,A.jsxs)(`button`,{className:B.saveBtn,onClick:()=>{Te&&Ct(`telegram-bot-token`,Te),Ee&&Ct(`discord-bot-token`,Ee),Ct(`bot-name`,Oe),Ct(`persona-mode`,L),Ct(`responder.telegram.allowedChatIds`,Ae.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>Number(e)||e)),Ct(`responder-auto-route`,Me)},children:[It(`telegram-bot-token`),` `,t(`settings.saveBots`)]})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:t(`settings.dailyOps`)}),(0,A.jsx)(Dt,{id:`planTime`,label:t(`settings.planTime`),placeholder:`07:00`,value:ve,onChange:ye}),(0,A.jsx)(Dt,{id:`summaryTime`,label:t(`settings.summaryTime`),placeholder:`18:00`,value:be,onChange:xe}),(0,A.jsx)(Dt,{id:`meetingAlert`,label:t(`settings.meetingAlert`),placeholder:`30`,value:P,onChange:Se}),(0,A.jsxs)(`button`,{className:B.saveBtn,onClick:kt,children:[It(`planTime`),` `,t(`settings.saveSchedule`)]})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:`Deliberation (Geth Consensus)`}),(0,A.jsx)(`div`,{className:B.cardSub,children:`Multi-round inter-agent reasoning for higher-quality answers`}),(0,A.jsx)(`div`,{className:B.field,children:(0,A.jsxs)(`label`,{className:B.fieldLabel,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:Pe,onChange:e=>Fe(e.target.checked)}),` `,`Enable deliberation`]})}),(0,A.jsx)(Dt,{id:`delibRounds`,label:`Rounds (1–5)`,placeholder:`3`,value:Ie,onChange:Le}),(0,A.jsx)(Dt,{id:`delibConvergence`,label:`Convergence threshold (0–1, lower = stricter)`,placeholder:`0.30`,value:Re,onChange:R}),(0,A.jsx)(`div`,{className:B.field,children:(0,A.jsxs)(`label`,{className:B.fieldLabel,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:ze,onChange:e=>Be(e.target.checked)}),` `,`Tribunal (final HERALD mediation)`]})}),(0,A.jsxs)(`button`,{className:B.saveBtn,onClick:()=>{Ct(`deliberation`,Pe),Ct(`rounds`,Number(Ie)),Ct(`convergence`,Number(Re)),Ct(`tribunal`,ze)},children:[It(`deliberation`),` Save deliberation`]})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:`Proactive Intelligence`}),(0,A.jsx)(`div`,{className:B.cardSub,children:`The bot acts on its own initiative (follow-ups, meeting prep, pattern detection)`}),[[`proactive`,`Master switch — enable proactive`,Ve,He],[`proactive-email`,`Email follow-up reminders`,Ue,We],[`proactive-meeting`,`Meeting preparation digests`,Ge,Ke],[`proactive-patterns`,`Behavioural pattern detection`,qe,Je],[`proactive-deadlines`,`Deadline tracking`,Ye,Xe]].map(([e,t,n,r])=>(0,A.jsx)(`div`,{className:B.field,children:(0,A.jsxs)(`label`,{className:B.fieldLabel,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),` `,t]})},String(e))),(0,A.jsxs)(`button`,{className:B.saveBtn,onClick:()=>{Ct(`proactive`,Ve),Ct(`proactive-email`,Ue),Ct(`proactive-meeting`,Ge),Ct(`proactive-patterns`,qe),Ct(`proactive-deadlines`,Ye)},children:[It(`proactive`),` Save proactive`]})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:`Voice`}),(0,A.jsx)(`div`,{className:B.cardSub,children:`Transcription (Whisper via Groq) and text-to-speech`}),(0,A.jsx)(`div`,{className:B.field,children:(0,A.jsxs)(`label`,{className:B.fieldLabel,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:Ze,onChange:e=>Qe(e.target.checked)}),` `,`Prefer Whisper (Groq) over local STT`]})}),(0,A.jsx)(`div`,{className:B.field,children:(0,A.jsxs)(`label`,{className:B.fieldLabel,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:$e,onChange:e=>et(e.target.checked)}),` `,`Speech synthesis (read replies aloud)`]})}),(0,A.jsx)(Dt,{id:`voiceLanguage`,label:`Voice language (BCP 47, e.g. it-IT, en-US)`,placeholder:`empty = use UI language`,value:tt,onChange:nt}),(0,A.jsxs)(`button`,{className:B.saveBtn,onClick:()=>{Ct(`voice-whisper`,Ze),Ct(`voice-speech`,$e),tt&&Ct(`voice-language`,tt)},children:[It(`voice-whisper`),` Save voice`]})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:`Features`}),(0,A.jsx)(`div`,{className:B.cardSub,children:`Core behaviour toggles`}),[[`verbose`,`Verbose logging (more diagnostics, more tokens)`,rt,it],[`immersive`,`Immersive office scene animation in Studio`,at,ot],[`knowledge`,`Knowledge base (memories + skills retrieval)`,st,ct]].map(([e,t,n,r])=>(0,A.jsx)(`div`,{className:B.field,children:(0,A.jsxs)(`label`,{className:B.fieldLabel,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),` `,t]})},String(e))),(0,A.jsxs)(`button`,{className:B.saveBtn,onClick:()=>{Ct(`verbose`,rt),Ct(`immersive`,at),Ct(`knowledge`,st)},children:[It(`verbose`),` Save features`]})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:`Integration tokens`}),(0,A.jsx)(`div`,{className:B.cardSub,children:`GitHub, Notion, Slack — used by the corresponding tools`}),(0,A.jsx)(Dt,{id:`githubToken`,label:`GitHub Token (PAT)`,placeholder:n.hasGithubToken?`✓ configured — leave empty to keep`:`ghp_... — needs repo + read:org scopes`,type:`password`,value:lt,onChange:ut}),(0,A.jsx)(Dt,{id:`githubRepo`,label:`Default GitHub repo (owner/name)`,placeholder:`acme/website`,value:dt,onChange:ft}),(0,A.jsx)(Dt,{id:`notionToken`,label:`Notion Token (Internal Integration)`,placeholder:n.hasNotionToken?`✓ configured — leave empty to keep`:`secret_...`,type:`password`,value:pt,onChange:mt}),(0,A.jsx)(Dt,{id:`slackToken`,label:`Slack Bot Token (xoxb-)`,placeholder:n.hasSlackToken?`✓ configured — leave empty to keep`:`xoxb-...`,type:`password`,value:ht,onChange:gt}),(0,A.jsxs)(`button`,{className:B.saveBtn,onClick:()=>{lt&&Ct(`github-token`,lt),dt&&Ct(`github-repo`,dt),pt&&Ct(`notion-token`,pt),ht&&Ct(`slack-token`,ht)},children:[It(`github-token`),` Save tokens`]})]}),(0,A.jsx)(Ot,{}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:`Advanced`}),(0,A.jsx)(`div`,{className:B.cardSub,children:`Plugins, Microsoft tenant ID, runtime extras`}),(0,A.jsx)(`div`,{className:B.field,children:(0,A.jsxs)(`label`,{className:B.fieldLabel,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:z,onChange:e=>yt(e.target.checked)}),` `,`Auto-run plugins at startup`]})}),(0,A.jsx)(Dt,{id:`pluginDir`,label:`Plugin directory (absolute path)`,placeholder:`empty = ~/.nha/plugins`,value:bt,onChange:xt}),(0,A.jsx)(Dt,{id:`microsoftTenant`,label:`Microsoft Tenant ID`,placeholder:`common (default) | organizations | consumers | <GUID>`,value:_t,onChange:vt}),(0,A.jsxs)(`button`,{className:B.saveBtn,onClick:()=>{Ct(`plugin-autorun`,z),bt&&Ct(`plugin-dir`,bt),Ct(`microsoft-tenant`,_t)},children:[It(`plugin-autorun`),` Save advanced`]})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:t(`settings.googleAccount`)}),(0,A.jsx)(`div`,{className:B.cardSub,children:t(`settings.googleSub`)}),n.hasGoogle&&(0,A.jsxs)(`div`,{className:B.connected,children:[`✅ `,t(`common.connected`),n.googleEmail?` · ${n.googleEmail}`:``]}),(0,A.jsxs)(`div`,{className:B.btnRow,children:[(0,A.jsx)(`button`,{className:B.saveBtn,onClick:At,children:n.hasGoogle?t(`settings.reconnectGoogle`):t(`settings.connectGoogle`)}),n.hasGoogle&&(0,A.jsx)(`button`,{className:B.dangerBtn,onClick:jt,children:t(`settings.disconnectGoogle`)})]}),g&&(0,A.jsx)(`div`,{className:B.statusMsg,children:g})]}),(0,A.jsxs)(`div`,{className:B.card,children:[(0,A.jsxs)(`div`,{className:B.cardTitleRow,children:[(0,A.jsx)(`div`,{className:B.cardTitle,children:t(`settings.imapAccounts`)}),(0,A.jsx)(`button`,{className:B.saveBtn,onClick:()=>{p({...Et}),h(``)},children:t(`settings.addAccount`)})]}),(0,A.jsx)(`div`,{className:B.cardSub,children:t(`settings.imapSub`)}),u.length===0&&!f&&(0,A.jsx)(`div`,{className:B.emptyImap,children:t(`settings.noImapAccounts`)}),u.map(e=>(0,A.jsxs)(`div`,{className:B.imapRow,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:B.imapName,children:e.display_name}),(0,A.jsxs)(`div`,{className:B.imapMeta,children:[e.email_address,` · `,e.imap_host]}),(0,A.jsxs)(`div`,{className:B.imapStatus,"data-status":e.sync_status,children:[e.sync_status,e.last_sync_at?` · ${t(`email.lastSync`)}: ${e.last_sync_at.slice(0,16)}`:``]})]}),(0,A.jsxs)(`div`,{className:B.imapBtns,children:[(0,A.jsx)(`button`,{className:B.imapSyncBtn,onClick:()=>Nt(e.id),children:t(`settings.sync`)}),(0,A.jsx)(`button`,{className:B.imapEditBtn,onClick:()=>{p({...Et,id:e.id,display_name:e.display_name,email_address:e.email_address,from_name:e.from_name??``,imap_host:e.imap_host,imap_port:String(e.imap_port??993),smtp_host:e.smtp_host??``,smtp_port:String(e.smtp_port??587),username:e.username??``,password:``}),h(``)},children:t(`common.edit`)}),(0,A.jsx)(`button`,{className:B.imapDelBtn,onClick:()=>Mt(e.id,e.display_name),children:t(`common.delete`)})]})]},e.id)),f&&(0,A.jsxs)(`div`,{className:B.imapForm,children:[(0,A.jsx)(`div`,{className:B.imapFormTitle,children:f.id?t(`settings.editImapAccount`):t(`settings.addImapAccount`)}),[[`display_name`,t(`settings.displayName`),t(`settings.displayNamePh`)],[`email_address`,t(`common.email`),`user@example.com`],[`from_name`,t(`settings.fromName`),t(`settings.fromNamePh`)],[`imap_host`,t(`settings.imapServer`),`e.g. imap.gmail.com`],[`imap_port`,t(`settings.imapPort`),`993`],[`smtp_host`,t(`settings.smtpServer`),`e.g. smtp.gmail.com`],[`smtp_port`,t(`settings.smtpPort`),`587`],[`username`,t(`settings.username`),`user@example.com`]].map(([e,t,n])=>(0,A.jsx)(Dt,{id:`imap_${e}`,label:t,placeholder:n,value:f[e],onChange:t=>p(n=>n&&{...n,[e]:t})},e)),(0,A.jsxs)(`div`,{className:B.field,children:[(0,A.jsxs)(`label`,{className:B.fieldLabel,children:[t(`settings.password`),` `,f.id&&(0,A.jsx)(`span`,{className:B.pwdNote,children:t(`settings.passwordKeep`)})]}),(0,A.jsxs)(`div`,{className:B.pwdRow,children:[(0,A.jsx)(`input`,{type:y?`text`:`password`,placeholder:t(`settings.passwordPh`),value:f.password,onChange:e=>p(t=>t&&{...t,password:e.target.value}),className:B.fieldInput,style:{flex:1}}),(0,A.jsx)(`button`,{className:B.togglePwd,onClick:()=>b(e=>!e),children:t(y?`settings.hide`:`settings.show`)})]})]}),(0,A.jsxs)(`div`,{className:B.btnRow,children:[(0,A.jsx)(`button`,{className:B.saveBtn,onClick:V,children:t(`common.save`)}),(0,A.jsx)(`button`,{className:B.cancelBtn,onClick:()=>Ft(!1),title:`Verifica IMAP+SMTP senza inviare nulla`,children:`Test connessione`}),(0,A.jsx)(`button`,{className:B.cancelBtn,onClick:()=>Ft(!0),title:`Invia un'email di prova alla tua casella per verificare il round-trip`,children:`Invia email di prova`}),(0,A.jsx)(`button`,{className:B.cancelBtn,onClick:Pt,title:`Diagnostica raw: mostra cosa risponde realmente il server sulla porta indicata`,children:`Diagnostica porta`}),(0,A.jsx)(`button`,{className:B.cancelBtn,onClick:()=>p(null),children:t(`common.cancel`)})]}),m&&(0,A.jsx)(`div`,{className:B.statusMsg,style:{whiteSpace:`pre-line`},children:m})]})]})]})}var At={root:`_root_o07ov_1`,loading:`_loading_o07ov_2`,err:`_err_o07ov_3`,header:`_header_o07ov_4`,title:`_title_o07ov_5`,addBtn:`_addBtn_o07ov_6`,empty:`_empty_o07ov_7`,card:`_card_o07ov_8`,cardToday:`_cardToday_o07ov_9`,icon:`_icon_o07ov_10`,info:`_info_o07ov_11`,name:`_name_o07ov_12`,date:`_date_o07ov_13`,labelToday:`_labelToday_o07ov_14`,labelTomorrow:`_labelTomorrow_o07ov_15`,labelFuture:`_labelFuture_o07ov_16`,editBtn:`_editBtn_o07ov_17`,delBtn:`_delBtn_o07ov_18`,overlay:`_overlay_o07ov_20`,modal:`_modal_o07ov_21`,modalTitle:`_modalTitle_o07ov_22`,label:`_label_o07ov_14`,input:`_input_o07ov_24`,hint:`_hint_o07ov_25`,formErr:`_formErr_o07ov_26`,modalBtns:`_modalBtns_o07ov_27`,cancelBtn:`_cancelBtn_o07ov_28`,saveBtn:`_saveBtn_o07ov_29`};function jt(){let e=M(),[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(!1),p=(0,_.useCallback)(()=>{i(!0),E(`/api/birthdays`).then(e=>{e?.error?o(e.error):n(e?.birthdays??[]),i(!1)})},[]);(0,_.useEffect)(()=>{p()},[p]);let m=()=>{c({name:``,date:``}),u(``)},h=e=>{c({name:e.name,date:e.date,contactId:e.contactId}),u(``)},g=async()=>{if(!s)return;if(!s.name.trim()){u(`Name is required`);return}if(!s.date.trim()){u(`Date is required`);return}f(!0);let e=s.date;/^\d{2}-\d{2}$/.test(e)&&(e=`${new Date().getFullYear()}-${e}`),await D(`/api/birthdays`,{name:s.name,date:e,contactId:s.contactId??null,edit:!!s.contactId}),f(!1),c(null),p()},v=e=>{confirm(`Remove birthday for ${e.name}?`)&&D(`/api/birthdays/delete`,{contactId:e.contactId}).then(p)};return r?(0,A.jsxs)(`div`,{className:At.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),e(`common.loading`)]}):a?(0,A.jsx)(`div`,{className:At.err,children:a}):(0,A.jsxs)(`div`,{className:At.root,children:[(0,A.jsxs)(`div`,{className:At.header,children:[(0,A.jsx)(`div`,{className:At.title,children:`Upcoming Birthdays`}),(0,A.jsx)(`button`,{className:At.addBtn,onClick:m,children:`+ Add Birthday`})]}),t.length===0&&(0,A.jsxs)(`div`,{className:At.empty,children:[e(`birthdays.noBirthdays`),(0,A.jsx)(`br`,{}),(0,A.jsx)(`small`,{children:`Add one above, or add birthdays to your Google Contacts.`})]}),t.map((t,n)=>{let r=t.daysUntil===0,i=t.daysUntil===1;return(0,A.jsxs)(`div`,{className:`${At.card} ${r?At.cardToday:``}`,children:[(0,A.jsx)(`span`,{className:At.icon,children:`🎂`}),(0,A.jsxs)(`div`,{className:At.info,children:[(0,A.jsx)(`div`,{className:At.name,children:t.name}),(0,A.jsx)(`div`,{className:At.date,children:t.date})]}),(0,A.jsx)(`div`,{className:r?At.labelToday:i?At.labelTomorrow:At.labelFuture,children:r?`TODAY!`:i?`Tomorrow`:`in ${t.daysUntil} days`}),t.contactId&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{className:At.editBtn,onClick:()=>h(t),children:e(`common.edit`)}),(0,A.jsx)(`button`,{className:At.delBtn,onClick:()=>v(t),children:e(`common.delete`)})]})]},n)}),s&&(0,A.jsx)(`div`,{className:At.overlay,onClick:e=>{e.target===e.currentTarget&&c(null)},children:(0,A.jsxs)(`div`,{className:At.modal,children:[(0,A.jsx)(`div`,{className:At.modalTitle,children:s.contactId?`Edit Birthday`:`Add Birthday`}),(0,A.jsx)(`label`,{className:At.label,children:`Name *`}),(0,A.jsx)(`input`,{className:At.input,value:s.name,onChange:e=>c(t=>t&&{...t,name:e.target.value}),placeholder:`Contact name`}),(0,A.jsx)(`label`,{className:At.label,children:`Birthday (MM-DD or YYYY-MM-DD)`}),(0,A.jsx)(`input`,{className:At.input,value:s.date,onChange:e=>c(t=>t&&{...t,date:e.target.value}),placeholder:`e.g. 03-15 or 1990-03-15`}),(0,A.jsx)(`div`,{className:At.hint,children:`Birthday will be saved as a Google Calendar event.`}),l&&(0,A.jsx)(`div`,{className:At.formErr,children:l}),(0,A.jsxs)(`div`,{className:At.modalBtns,children:[(0,A.jsx)(`button`,{className:At.cancelBtn,onClick:()=>c(null),children:e(`common.cancel`)}),(0,A.jsx)(`button`,{className:At.saveBtn,onClick:g,disabled:d,children:d?`Saving…`:s.contactId?`Save`:`Add`})]})]})})]})}var V={root:`_root_1z04o_1`,header:`_header_1z04o_3`,title:`_title_1z04o_4`,subtitle:`_subtitle_1z04o_5`,code:`_code_1z04o_6`,addBtn:`_addBtn_1z04o_8`,tabs:`_tabs_1z04o_10`,tab:`_tab_1z04o_10`,tabActive:`_tabActive_1z04o_12`,loading:`_loading_1z04o_14`,err:`_err_1z04o_15`,empty:`_empty_1z04o_17`,emptyIcon:`_emptyIcon_1z04o_18`,emptyTitle:`_emptyTitle_1z04o_19`,emptySub:`_emptySub_1z04o_20`,card:`_card_1z04o_23`,cardDisabled:`_cardDisabled_1z04o_24`,cardTop:`_cardTop_1z04o_25`,cardLeft:`_cardLeft_1z04o_26`,jobName:`_jobName_1z04o_27`,schedule:`_schedule_1z04o_28`,agentBadge:`_agentBadge_1z04o_29`,statusBadge:`_statusBadge_1z04o_30`,statusActive:`_statusActive_1z04o_31`,statusPaused:`_statusPaused_1z04o_32`,jobPrompt:`_jobPrompt_1z04o_33`,jobMeta:`_jobMeta_1z04o_34`,cardActions:`_cardActions_1z04o_35`,runBtn:`_runBtn_1z04o_36`,editBtn:`_editBtn_1z04o_37`,pauseBtn:`_pauseBtn_1z04o_38`,resumeBtn:`_resumeBtn_1z04o_39`,delBtn:`_delBtn_1z04o_40`,templates:`_templates_1z04o_43`,templatesNote:`_templatesNote_1z04o_44`,templateCard:`_templateCard_1z04o_45`,templateLabel:`_templateLabel_1z04o_46`,templatePrompt:`_templatePrompt_1z04o_47`,templateBtns:`_templateBtns_1z04o_48`,scheduleTplBtn:`_scheduleTplBtn_1z04o_49`,runTplBtn:`_runTplBtn_1z04o_50`,formOverlay:`_formOverlay_1z04o_54`,formModal:`_formModal_1z04o_55`,formTitle:`_formTitle_1z04o_56`,label:`_label_1z04o_57`,input:`_input_1z04o_58`,textarea:`_textarea_1z04o_59`,presets:`_presets_1z04o_61`,preset:`_preset_1z04o_61`,presetActive:`_presetActive_1z04o_63`,cronHints:`_cronHints_1z04o_65`,cronHint:`_cronHint_1z04o_65`,formErr:`_formErr_1z04o_70`,formOk:`_formOk_1z04o_71`,formBtns:`_formBtns_1z04o_72`,cancelBtn:`_cancelBtn_1z04o_73`,saveBtn:`_saveBtn_1z04o_74`},Mt=[{label:`Every 15 min`,value:`every 15 minutes`},{label:`Every 30 min`,value:`every 30 minutes`},{label:`Every hour`,value:`every hour`},{label:`Every 6h`,value:`every 6 hours`},{label:`Daily 8am`,value:`every day at 08:00`},{label:`Daily 9am`,value:`every day at 09:00`},{label:`Daily noon`,value:`every day at 12:00`},{label:`Daily 6pm`,value:`every day at 18:00`},{label:`Mon–Fri 9am`,value:`weekdays at 09:00`},{label:`Every Monday`,value:`every monday at 09:00`}],Nt=[{label:`🌅 Morning Briefing`,prompt:`Summarize my unread emails from the last 12 hours, check today's calendar events, list my top 3 priority tasks, and give me a focused action plan for the day.`},{label:`🌆 Evening Review`,prompt:`Review what I accomplished today: check completed tasks, summarize any important emails received, flag unresolved issues, and prepare a priority list for tomorrow.`},{label:`📰 News Digest`,prompt:`Search for the top AI, tech, and finance news from the last 24 hours. Summarize the 5 most important stories with key takeaways and market implications.`},{label:`📈 Market Update`,prompt:`Provide a comprehensive market update: macro environment, major indices performance, top movers, notable events, and key levels to watch. Use herald and mercury agents.`},{label:`🐙 GitHub Monitor`,prompt:`Check my GitHub notifications, summarize open issues and pull requests that need attention, and draft brief responses for the most urgent ones.`},{label:`📊 Weekly Report`,prompt:`Generate a weekly productivity report: tasks completed vs pending, email response rate, upcoming calendar events, and 3 strategic priorities for next week.`},{label:`🔒 Security Scan`,prompt:`Run a security awareness check: scan recent code commits for potential vulnerabilities, check dependency alerts, and summarize any security-related GitHub notifications.`},{label:`🎯 Goal Tracker`,prompt:`Review my tasks and notes for goal progress. Identify what's on track, what's at risk, and suggest one concrete action to unblock the most important goal.`}],Pt=[{label:`0 9 * * 1-5`,desc:`Mon–Fri at 9:00 AM`},{label:`0 */6 * * *`,desc:`Every 6 hours`},{label:`*/30 * * * *`,desc:`Every 30 minutes`},{label:`0 8 * * *`,desc:`Daily at 8:00 AM`},{label:`0 20 * * 5`,desc:`Every Friday at 8 PM`}];function Ft(){let e=M(),t=te(e=>e.setView),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)({name:``,schedule:``,prompt:``,agent:``}),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(`jobs`),C=()=>{a(!0),E(`/api/cron`).then(e=>{e?.error?s(e.error):r(e?.jobs??[]),a(!1)}).catch(()=>{r([]),a(!1)})};(0,_.useEffect)(()=>{C()},[]);let w=()=>{d({name:``,schedule:``,prompt:``,agent:``}),h(``),v(``),b(null),l(!0)},ee=e=>{d({name:e.name??``,schedule:e.schedule,prompt:e.prompt??e.command??``,agent:e.agent??``}),h(``),v(``),b(e.id),l(!0)},T=async()=>{if(!u.schedule.trim()){h(`Schedule is required`);return}if(!u.prompt.trim()){h(`Task prompt is required`);return}p(!0),h(``);try{y?await D(`/api/cron/update`,{id:y,schedule:u.schedule,prompt:u.prompt,agent:u.agent||void 0,name:u.name||void 0}):await D(`/api/cron`,{schedule:u.schedule,prompt:u.prompt,agent:u.agent||void 0,name:u.name||void 0}),v(y?`Updated!`:`Job scheduled!`),setTimeout(()=>{v(``),l(!1)},1500),C()}catch(e){h(e.message??`Failed`)}p(!1)},ne=(e,t)=>D(`/api/cron/toggle`,{id:e,enabled:!t}).then(C),O=e=>{confirm(`Delete this scheduled task?`)&&D(`/api/cron/delete`,{id:e}).then(C)},re=e=>{try{sessionStorage.setItem(`nha_chat_prefill`,e)}catch{}t(`chat`)},k=e=>{d(t=>({...t,prompt:e.prompt,name:e.label.replace(/^[^\s]+\s/,``)})),S(`jobs`),l(!0)};return(0,A.jsxs)(`div`,{className:V.root,children:[(0,A.jsxs)(`div`,{className:V.header,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:V.title,children:`⏰ Scheduled Tasks`}),(0,A.jsxs)(`div`,{className:V.subtitle,children:[`Automate agents on a recurring schedule. Daemon must be running: `,(0,A.jsx)(`code`,{className:V.code,children:`nha ops start`})]})]}),(0,A.jsx)(`button`,{className:V.addBtn,onClick:w,children:`+ New Task`})]}),(0,A.jsxs)(`div`,{className:V.tabs,children:[(0,A.jsxs)(`button`,{className:`${V.tab} ${x===`jobs`?V.tabActive:``}`,onClick:()=>S(`jobs`),children:[`Jobs (`,n.length,`)`]}),(0,A.jsx)(`button`,{className:`${V.tab} ${x===`templates`?V.tabActive:``}`,onClick:()=>S(`templates`),children:`Templates`})]}),x===`templates`&&(0,A.jsxs)(`div`,{className:V.templates,children:[(0,A.jsx)(`div`,{className:V.templatesNote,children:`Click a template to pre-fill the job form or run it immediately in Chat.`}),Nt.map(t=>(0,A.jsxs)(`div`,{className:V.templateCard,children:[(0,A.jsx)(`div`,{className:V.templateLabel,children:t.label}),(0,A.jsx)(`div`,{className:V.templatePrompt,children:t.prompt}),(0,A.jsxs)(`div`,{className:V.templateBtns,children:[(0,A.jsx)(`button`,{className:V.scheduleTplBtn,onClick:()=>k(t),children:`Schedule`}),(0,A.jsxs)(`button`,{className:V.runTplBtn,onClick:()=>re(t.prompt),children:[e(`cron.run`),` in Chat →`]})]})]},t.label))]}),x===`jobs`&&(0,A.jsxs)(A.Fragment,{children:[i&&(0,A.jsxs)(`div`,{className:V.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),`Loading jobs…`]}),o&&(0,A.jsx)(`div`,{className:V.err,children:o}),!i&&n.length===0&&!c&&(0,A.jsxs)(`div`,{className:V.empty,children:[(0,A.jsx)(`div`,{className:V.emptyIcon,children:`⏰`}),(0,A.jsxs)(`div`,{className:V.emptyTitle,children:[e(`cron.noJobs`),` tasks`]}),(0,A.jsx)(`div`,{className:V.emptySub,children:`Create a job to automate agents on a recurring schedule, or browse the Templates tab for ready-made automation recipes.`}),(0,A.jsx)(`button`,{className:V.addBtn,onClick:w,children:`+ New Task`})]}),n.map(e=>(0,A.jsxs)(`div`,{className:`${V.card} ${e.enabled?``:V.cardDisabled}`,children:[(0,A.jsxs)(`div`,{className:V.cardTop,children:[(0,A.jsxs)(`div`,{className:V.cardLeft,children:[e.name&&(0,A.jsx)(`div`,{className:V.jobName,children:e.name}),(0,A.jsx)(`code`,{className:V.schedule,children:e.schedule}),e.agent&&(0,A.jsx)(`span`,{className:V.agentBadge,children:e.agent}),(0,A.jsx)(`span`,{className:`${V.statusBadge} ${e.enabled?V.statusActive:V.statusPaused}`,children:e.enabled?`active`:`paused`})]}),(0,A.jsxs)(`div`,{className:V.cardActions,children:[(0,A.jsx)(`button`,{className:V.runBtn,onClick:()=>re(e.prompt??e.command??``),title:`Run now in Chat`,children:`▶`}),(0,A.jsx)(`button`,{className:V.editBtn,onClick:()=>ee(e),children:`Edit`}),(0,A.jsx)(`button`,{className:e.enabled?V.pauseBtn:V.resumeBtn,onClick:()=>ne(e.id,e.enabled),children:e.enabled?`Pause`:`Resume`}),(0,A.jsx)(`button`,{className:V.delBtn,onClick:()=>O(e.id),children:`✕`})]})]}),(0,A.jsx)(`div`,{className:V.jobPrompt,children:e.prompt??e.command}),(0,A.jsxs)(`div`,{className:V.jobMeta,children:[e.runCount!==void 0&&(0,A.jsxs)(`span`,{children:[`ran `,e.runCount,`×`]}),e.lastRun&&(0,A.jsxs)(`span`,{children:[` · last `,new Date(e.lastRun).toLocaleString()]}),e.nextRun&&(0,A.jsxs)(`span`,{children:[` · next `,new Date(e.nextRun).toLocaleString()]})]})]},e.id))]}),c&&(0,A.jsx)(`div`,{className:V.formOverlay,onClick:e=>{e.target===e.currentTarget&&l(!1)},children:(0,A.jsxs)(`div`,{className:V.formModal,children:[(0,A.jsx)(`div`,{className:V.formTitle,children:y?`Edit Scheduled Task`:`New Scheduled Task`}),(0,A.jsx)(`label`,{className:V.label,children:`Name (optional)`}),(0,A.jsx)(`input`,{className:V.input,value:u.name,onChange:e=>d(t=>({...t,name:e.target.value})),placeholder:`e.g. Morning Briefing`}),(0,A.jsx)(`label`,{className:V.label,children:`Schedule *`}),(0,A.jsx)(`div`,{className:V.presets,children:Mt.map(e=>(0,A.jsx)(`button`,{className:`${V.preset} ${u.schedule===e.value?V.presetActive:``}`,onClick:()=>d(t=>({...t,schedule:e.value})),children:e.label},e.value))}),(0,A.jsx)(`input`,{className:V.input,value:u.schedule,onChange:e=>d(t=>({...t,schedule:e.target.value})),placeholder:`every day at 09:00 — or cron syntax: 0 9 * * 1-5`}),(0,A.jsx)(`div`,{className:V.cronHints,children:Pt.map(e=>(0,A.jsxs)(`span`,{className:V.cronHint,onClick:()=>d(t=>({...t,schedule:e.label})),children:[(0,A.jsx)(`code`,{children:e.label}),` `,e.desc]},e.label))}),(0,A.jsx)(`label`,{className:V.label,children:`Task / Prompt *`}),(0,A.jsx)(`textarea`,{className:V.textarea,value:u.prompt,onChange:e=>d(t=>({...t,prompt:e.target.value})),placeholder:`Describe what the agent should do (e.g. Summarize my unread emails and list my 3 top priority tasks)`,rows:4}),(0,A.jsx)(`label`,{className:V.label,children:`Agent (optional — leave blank for auto-routing)`}),(0,A.jsx)(`input`,{className:V.input,value:u.agent,onChange:e=>d(t=>({...t,agent:e.target.value})),placeholder:`e.g. herald, oracle, mercury, EmailAgent, general`}),m&&(0,A.jsx)(`div`,{className:V.formErr,children:m}),g&&(0,A.jsx)(`div`,{className:V.formOk,children:g}),(0,A.jsxs)(`div`,{className:V.formBtns,children:[(0,A.jsx)(`button`,{className:V.cancelBtn,onClick:()=>l(!1),children:`Cancel`}),(0,A.jsx)(`button`,{className:V.saveBtn,onClick:T,disabled:f,children:f?`Saving…`:y?`Update`:`Schedule`})]})]})})]})}var It={root:`_root_1npv7_1`,loading:`_loading_1npv7_2`,sidebar:`_sidebar_1npv7_4`,newBtn:`_newBtn_1npv7_5`,empty:`_empty_1npv7_6`,noteItem:`_noteItem_1npv7_8`,noteItemActive:`_noteItemActive_1npv7_10`,noteTitle:`_noteTitle_1npv7_11`,noteMeta:`_noteMeta_1npv7_12`,notePreview:`_notePreview_1npv7_13`,noteTags:`_noteTags_1npv7_14`,noteTag:`_noteTag_1npv7_14`,editor:`_editor_1npv7_17`,emptyEditor:`_emptyEditor_1npv7_18`,titleInput:`_titleInput_1npv7_19`,contentArea:`_contentArea_1npv7_21`,editorFooter:`_editorFooter_1npv7_22`,delNoteBtn:`_delNoteBtn_1npv7_23`,cancelBtn:`_cancelBtn_1npv7_24`,saveBtn:`_saveBtn_1npv7_25`};function Lt(){let e=M(),[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!1),h=()=>E(`/api/notes`).then(e=>{n(e?.notes??[]),i(!1)});(0,_.useEffect)(()=>{h()},[]);let g=e=>{o(e),c(e.title),u(e.content),m(!1)},v=()=>{o(null),c(``),u(``),m(!0)},y=async()=>{f(!0),p?await D(`/api/notes`,{title:s||`Untitled`,content:l}):a&&await D(`/api/notes/${a.id}`,{title:s,content:l}),f(!1),m(!1),h()},b=(e,t)=>{confirm(`Delete note "${t}"?`)&&D(`/api/notes/${e}/delete`,{}).then(h)};return r?(0,A.jsxs)(`div`,{className:It.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),e(`common.loading`)]}):(0,A.jsxs)(`div`,{className:It.root,children:[(0,A.jsxs)(`div`,{className:It.sidebar,children:[(0,A.jsx)(`button`,{className:It.newBtn,onClick:v,children:`+ New Note`}),t.length===0&&(0,A.jsx)(`div`,{className:It.empty,children:e(`notes.noNotes`)}),t.map(e=>(0,A.jsxs)(`div`,{className:`${It.noteItem} ${a?.id===e.id?It.noteItemActive:``}`,onClick:()=>g(e),children:[(0,A.jsx)(`div`,{className:It.noteTitle,children:e.title||`Untitled`}),(0,A.jsx)(`div`,{className:It.noteMeta,children:e.updatedAt?new Date(e.updatedAt).toLocaleDateString():``}),e.content&&(0,A.jsx)(`div`,{className:It.notePreview,children:e.content.slice(0,150)}),e.tags&&e.tags.length>0&&(0,A.jsx)(`div`,{className:It.noteTags,children:e.tags.map(e=>(0,A.jsx)(`span`,{className:It.noteTag,children:e},e))})]},e.id))]}),(0,A.jsx)(`div`,{className:It.editor,children:a||p?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`input`,{className:It.titleInput,value:s,onChange:e=>c(e.target.value),placeholder:`Note title…`}),(0,A.jsx)(`textarea`,{className:It.contentArea,value:l,onChange:e=>u(e.target.value),placeholder:`Start writing…`}),(0,A.jsxs)(`div`,{className:It.editorFooter,children:[a&&(0,A.jsx)(`button`,{className:It.delNoteBtn,onClick:()=>b(a.id,a.title),children:e(`common.delete`)}),(0,A.jsx)(`button`,{className:It.cancelBtn,onClick:()=>{o(null),m(!1)},children:e(`common.cancel`)}),(0,A.jsx)(`button`,{className:It.saveBtn,onClick:y,disabled:d,children:d?`Saving…`:`Save`})]})]}):(0,A.jsx)(`div`,{className:It.emptyEditor,children:`Select a note or create a new one`})})]})}var Rt={root:`_root_18yos_1`,loading:`_loading_18yos_2`,error:`_error_18yos_3`,toolbar:`_toolbar_18yos_5`,search:`_search_18yos_6`,addBtn:`_addBtn_18yos_7`,count:`_count_18yos_10`,empty:`_empty_18yos_12`,grid:`_grid_18yos_14`,card:`_card_18yos_16`,actions:`_actions_18yos_29`,avatar:`_avatar_18yos_31`,avatarImg:`_avatarImg_18yos_38`,info:`_info_18yos_40`,name:`_name_18yos_41`,row:`_row_18yos_42`,email:`_email_18yos_43`,phone:`_phone_18yos_44`,company:`_company_18yos_45`,birthday:`_birthday_18yos_46`,iconBtn:`_iconBtn_18yos_52`,iconBtnRed:`_iconBtnRed_18yos_58`,overlay:`_overlay_18yos_61`,modal:`_modal_18yos_62`,modalTitle:`_modalTitle_18yos_63`,field:`_field_18yos_64`,label:`_label_18yos_65`,input:`_input_18yos_66`,formStatus:`_formStatus_18yos_67`,formError:`_formError_18yos_68`,modalBtns:`_modalBtns_18yos_69`,cancelBtn:`_cancelBtn_18yos_70`,saveBtn:`_saveBtn_18yos_71`},zt={name:``,email:``,phone:``,company:``,address:``,notes:``};function Bt(){let e=M(),t=te(e=>e.setView),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(``),y=(0,_.useRef)(null),b=(e=``)=>{E(e?`/api/contacts?q=${encodeURIComponent(e)}`:`/api/contacts`).then(e=>{r(e?.contacts??[]),a(!1),s(``)}).catch(()=>{s(`Could not load contacts. Run nha google revoke then nha google auth.`),a(!1)})};(0,_.useEffect)(()=>{b()},[]);let x=e=>{l(e),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>b(e),400)},S=()=>{d(null),p({...zt}),v(``)},C=e=>{d(e),p({name:e.name,email:e.email??``,phone:e.phone??``,company:e.company??``,address:e.address??``,notes:e.notes??``}),v(``)},w=async()=>{if(f?.name){h(!0),v(`Saving…`);try{if(u?.resourceName){let e=await D(`/api/contacts/update`,{resourceName:u.resourceName,fields:f});if(e?.error){v(`Error: `+e.error);return}}else if(u)await D(`/api/contacts/update`,{resourceName:u.id,fields:f});else{let e=await D(`/api/contacts`,f);if(e?.error){v(`Error: `+e.error);return}}v(`Saved!`),setTimeout(()=>{p(null),d(null),b(c)},800)}catch(e){v(`Error: `+e.message)}finally{h(!1)}}},ee=(e,t)=>{e.stopPropagation(),confirm(`Delete "${t.name}"?`)&&D(`/api/contacts/delete`,{resourceName:t.resourceName||t.id}).then(e=>{let t=e;if(t?.error){alert(`Error: `+t.error);return}b(c)})},T=(e,n,r)=>{e.stopPropagation(),t(`chat`),setTimeout(()=>{let e=document.getElementById(`chatInput`);e&&(e.value=`Send an email to ${r} (${n}) about `,e.focus())},300)},ne=e=>(e||`?`).split(` `).map(e=>e[0]).slice(0,2).join(``).toUpperCase();return i?(0,A.jsxs)(`div`,{className:Rt.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),`Loading contacts…`]}):o?(0,A.jsx)(`div`,{className:Rt.error,children:o}):(0,A.jsxs)(`div`,{className:Rt.root,children:[(0,A.jsxs)(`div`,{className:Rt.toolbar,children:[(0,A.jsx)(`input`,{className:Rt.search,value:c,onChange:e=>x(e.target.value),placeholder:`Search contacts…`}),n.length>0&&(0,A.jsxs)(`span`,{className:Rt.count,children:[n.length,` contact`,n.length===1?``:`s`]}),(0,A.jsx)(`button`,{className:Rt.addBtn,onClick:S,children:`+ Add`})]}),n.length===0&&(0,A.jsxs)(`div`,{className:Rt.empty,children:[e(`contacts.noContacts`),(0,A.jsx)(`br`,{}),`Add a Google account or add contacts manually.`]}),(0,A.jsx)(`div`,{className:Rt.grid,children:n.map(e=>(0,A.jsxs)(`div`,{className:Rt.card,onClick:()=>C(e),children:[(0,A.jsx)(`div`,{className:Rt.avatar,children:e.photo?(0,A.jsx)(`img`,{src:e.photo,alt:e.name,className:Rt.avatarImg}):ne(e.name)}),(0,A.jsxs)(`div`,{className:Rt.info,children:[(0,A.jsx)(`div`,{className:Rt.name,children:e.name||`(no name)`}),(0,A.jsxs)(`div`,{className:Rt.row,children:[e.email&&(0,A.jsx)(`span`,{className:Rt.email,children:e.email}),e.phone&&(0,A.jsx)(`span`,{className:Rt.phone,children:e.phone}),e.company&&(0,A.jsxs)(`span`,{className:Rt.company,children:[e.company,e.title?` · ${e.title}`:``]}),e.birthday&&(0,A.jsxs)(`span`,{className:Rt.birthday,children:[`🎂 `,e.birthday]})]})]}),(0,A.jsxs)(`div`,{className:Rt.actions,children:[e.email&&(0,A.jsx)(`button`,{className:Rt.iconBtn,onClick:t=>T(t,e.email,e.name),title:`Send email via chat`,children:`✉`}),(0,A.jsx)(`button`,{className:Rt.iconBtn,onClick:t=>{t.stopPropagation(),C(e)},title:`Edit`,children:`✎`}),(0,A.jsx)(`button`,{className:`${Rt.iconBtn} ${Rt.iconBtnRed}`,onClick:t=>ee(t,e),title:`Delete`,children:`✕`})]})]},e.id))}),f&&(0,A.jsx)(`div`,{className:Rt.overlay,onClick:e=>{e.target===e.currentTarget&&p(null)},children:(0,A.jsxs)(`div`,{className:Rt.modal,children:[(0,A.jsx)(`div`,{className:Rt.modalTitle,children:u?`Edit Contact`:`New Contact`}),[[`name`,`Name`,`Full name *`],[`email`,`Email`,`user@example.com`],[`phone`,`Phone`,`+1 555 123 4567`],[`company`,`Company`,`Acme Inc`],[`address`,`Address`,`123 Main St, New York`],[`notes`,`Notes`,`Any additional info`]].map(([e,t,n])=>(0,A.jsxs)(`div`,{className:Rt.field,children:[(0,A.jsx)(`label`,{className:Rt.label,children:t}),(0,A.jsx)(`input`,{className:Rt.input,value:f[e],onChange:t=>p(n=>n&&{...n,[e]:t.target.value}),placeholder:n,onKeyDown:t=>t.key===`Enter`&&e===`name`&&w()})]},e)),g&&(0,A.jsx)(`div`,{className:g.startsWith(`Error`)?Rt.formError:Rt.formStatus,children:g}),(0,A.jsxs)(`div`,{className:Rt.modalBtns,children:[(0,A.jsx)(`button`,{className:Rt.cancelBtn,onClick:()=>p(null),children:e(`common.cancel`)}),(0,A.jsx)(`button`,{className:Rt.saveBtn,onClick:w,disabled:m||!f.name,children:m?`…`:`Save`})]})]})})]})}function Vt({open:e,onClose:t,children:n,className:r,handleClassName:i,backdropClassName:a,closeOnBackdrop:o=!0,ariaLabel:s}){let c=(0,_.useRef)(null),[l,u]=(0,_.useState)(0),d=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),(0,_.useEffect)(()=>{e||u(0)},[e]),e?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:a,onClick:o?t:void 0,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,zIndex:29}}),(0,A.jsxs)(`div`,{ref:c,className:r,role:`dialog`,"aria-modal":`true`,"aria-label":s,style:{transform:`translateY(${l}px)`,transition:l===0?`transform 0.2s ease`:`none`},children:[(0,A.jsx)(`div`,{className:i,onTouchStart:e=>{d.current=e.touches[0].clientY},onTouchMove:e=>{if(d.current==null)return;let t=e.touches[0].clientY-d.current;t>0&&u(t)},onTouchEnd:()=>{l>80&&t(),u(0),d.current=null}}),n]})]}):null}function Ht(e=768){let[t,n]=(0,_.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(max-width: ${e}px)`).matches);return(0,_.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let t=window.matchMedia(`(max-width: ${e}px)`),r=e=>n(e.matches);return typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}var H={root:`_root_cye93_2`,topbar:`_topbar_cye93_11`,topbarLeft:`_topbarLeft_cye93_20`,topbarTitle:`_topbarTitle_cye93_21`,topbarSub:`_topbarSub_cye93_22`,topbarActions:`_topbarActions_cye93_23`,runBtn:`_runBtn_cye93_25`,runBtnActive:`_runBtnActive_cye93_32`,logBtn:`_logBtn_cye93_34`,newWfBtn:`_newWfBtn_cye93_41`,body:`_body_cye93_50`,sidebar:`_sidebar_cye93_53`,sidebarTitle:`_sidebarTitle_cye93_61`,sidebarEmpty:`_sidebarEmpty_cye93_65`,wfItem:`_wfItem_cye93_67`,wfItemActive:`_wfItemActive_cye93_78`,wfItemRow:`_wfItemRow_cye93_79`,wfItemName:`_wfItemName_cye93_80`,wfItemMeta:`_wfItemMeta_cye93_81`,wfOn:`_wfOn_cye93_82`,wfOff:`_wfOff_cye93_83`,wfDelBtn:`_wfDelBtn_cye93_84`,canvasArea:`_canvasArea_cye93_92`,canvasHeader:`_canvasHeader_cye93_94`,wfNameInput:`_wfNameInput_cye93_99`,canvasHint:`_canvasHint_cye93_106`,portHint:`_portHint_cye93_107`,connectHint:`_connectHint_cye93_108`,cancelConnectBtn:`_cancelConnectBtn_cye93_109`,canvas:`_canvas_cye93_92`,canvasConnecting:`_canvasConnecting_cye93_122`,canvasSvg:`_canvasSvg_cye93_124`,canvasNode:`_canvasNode_cye93_134`,canvasNodeSelected:`_canvasNodeSelected_cye93_152`,canvasNodeConnecting:`_canvasNodeConnecting_cye93_153`,nodeIcon:`_nodeIcon_cye93_155`,nodeLabel:`_nodeLabel_cye93_156`,nodeConfigPreview:`_nodeConfigPreview_cye93_157`,nodeDelBtn:`_nodeDelBtn_cye93_159`,portOut:`_portOut_cye93_171`,portActive:`_portActive_cye93_182`,portIn:`_portIn_cye93_184`,pulse:`_pulse_cye93_1`,canvasDrop:`_canvasDrop_cye93_195`,canvasEmpty:`_canvasEmpty_cye93_203`,canvasEmptyIcon:`_canvasEmptyIcon_cye93_208`,canvasEmptyTitle:`_canvasEmptyTitle_cye93_209`,canvasEmptyDesc:`_canvasEmptyDesc_cye93_210`,logPanel:`_logPanel_cye93_213`,logHeader:`_logHeader_cye93_220`,logTime:`_logTime_cye93_226`,logClose:`_logClose_cye93_227`,logEmpty:`_logEmpty_cye93_228`,logStep:`_logStep_cye93_229`,logStepError:`_logStepError_cye93_230`,logStepHeader:`_logStepHeader_cye93_231`,logStepIcon:`_logStepIcon_cye93_232`,logStepLabel:`_logStepLabel_cye93_233`,logStepErrBadge:`_logStepErrBadge_cye93_234`,logStepErr:`_logStepErr_cye93_230`,logStepOutput:`_logStepOutput_cye93_236`,rightPanel:`_rightPanel_cye93_241`,configPanel:`_configPanel_cye93_252`,configHeader:`_configHeader_cye93_253`,configClose:`_configClose_cye93_254`,configDesc:`_configDesc_cye93_255`,configFields:`_configFields_cye93_256`,configField:`_configField_cye93_256`,configLabel:`_configLabel_cye93_258`,configRequired:`_configRequired_cye93_259`,configInput:`_configInput_cye93_260`,configTextarea:`_configTextarea_cye93_267`,zoomControls:`_zoomControls_cye93_277`,configHint:`_configHint_cye93_303`,configDelete:`_configDelete_cye93_305`,palette:`_palette_cye93_309`,paletteTitle:`_paletteTitle_cye93_310`,paletteTabs:`_paletteTabs_cye93_311`,paletteTab:`_paletteTab_cye93_311`,paletteTabActive:`_paletteTabActive_cye93_317`,paletteNodes:`_paletteNodes_cye93_318`,paletteDef:`_paletteDef_cye93_320`,paletteDefIcon:`_paletteDefIcon_cye93_328`,paletteDefLabel:`_paletteDefLabel_cye93_329`,paletteDefDesc:`_paletteDefDesc_cye93_330`,paletteFooter:`_paletteFooter_cye93_332`,paletteGuide:`_paletteGuide_cye93_336`,guideTitle:`_guideTitle_cye93_344`,guideStep:`_guideStep_cye93_353`,guideNum:`_guideNum_cye93_361`,guideTip:`_guideTip_cye93_377`,guideCode:`_guideCode_cye93_388`,nodeListMobile:`_nodeListMobile_cye93_432`,nodeRow:`_nodeRow_cye93_440`,nodeRowIcon:`_nodeRowIcon_cye93_453`,nodeRowBody:`_nodeRowBody_cye93_459`,nodeRowLabel:`_nodeRowLabel_cye93_463`,nodeRowDesc:`_nodeRowDesc_cye93_469`,nodeRowIndex:`_nodeRowIndex_cye93_476`,nodeRowBranch:`_nodeRowBranch_cye93_484`,configSheet:`_configSheet_cye93_492`,configSheetHandle:`_configSheetHandle_cye93_505`,runFab:`_runFab_cye93_515`,debuggerPanel:`_debuggerPanel_cye93_544`,dbgHeader:`_dbgHeader_cye93_558`,dbgHeaderLeft:`_dbgHeaderLeft_cye93_568`,dbgHeaderRight:`_dbgHeaderRight_cye93_568`,dbgTitle:`_dbgTitle_cye93_574`,dbgRunSelect:`_dbgRunSelect_cye93_575`,dbgStats:`_dbgStats_cye93_584`,dbgPausedBadge:`_dbgPausedBadge_cye93_585`,dbgPulse:`_dbgPulse_cye93_1`,dbgBtnResume:`_dbgBtnResume_cye93_599`,dbgBtnReplay:`_dbgBtnReplay_cye93_599`,dbgEmpty:`_dbgEmpty_cye93_612`,dbgTimeline:`_dbgTimeline_cye93_621`,dbgTlStep:`_dbgTlStep_cye93_630`,dbgTlStepOk:`_dbgTlStepOk_cye93_646`,dbgTlStepErr:`_dbgTlStepErr_cye93_647`,dbgTlStepPaused:`_dbgTlStepPaused_cye93_648`,dbgTlStepActive:`_dbgTlStepActive_cye93_649`,dbgTlIcon:`_dbgTlIcon_cye93_654`,dbgTlLabel:`_dbgTlLabel_cye93_655`,dbgTlMs:`_dbgTlMs_cye93_656`,dbgInspector:`_dbgInspector_cye93_659`,dbgInspHeader:`_dbgInspHeader_cye93_667`,dbgInspIcon:`_dbgInspIcon_cye93_673`,dbgInspLabel:`_dbgInspLabel_cye93_674`,dbgInspDuration:`_dbgInspDuration_cye93_675`,dbgInspActions:`_dbgInspActions_cye93_682`,dbgBtnExplain:`_dbgBtnExplain_cye93_688`,dbgBtnReplayFrom:`_dbgBtnReplayFrom_cye93_700`,dbgBtnBp:`_dbgBtnBp_cye93_711`,dbgBtnBpActive:`_dbgBtnBpActive_cye93_720`,dbgBpGroup:`_dbgBpGroup_cye93_725`,dbgBpCondition:`_dbgBpCondition_cye93_733`,dbgExplanation:`_dbgExplanation_cye93_752`,dbgExplanationIcon:`_dbgExplanationIcon_cye93_763`,dbgExplanationText:`_dbgExplanationText_cye93_764`,dbgTabs:`_dbgTabs_cye93_766`,dbgTab:`_dbgTab_cye93_766`,dbgTabActive:`_dbgTabActive_cye93_782`,dbgTabBody:`_dbgTabBody_cye93_786`,dbgPre:`_dbgPre_cye93_793`,dbgPreErr:`_dbgPreErr_cye93_804`,dbgMuted:`_dbgMuted_cye93_805`,canvasNodeOk:`_canvasNodeOk_cye93_808`,canvasNodeErr:`_canvasNodeErr_cye93_809`,canvasNodePaused:`_canvasNodePaused_cye93_810`,canvasNodeFocused:`_canvasNodeFocused_cye93_814`,nodeBpBadge:`_nodeBpBadge_cye93_819`,dbgWatcher:`_dbgWatcher_cye93_839`,dbgWatcherHeader:`_dbgWatcherHeader_cye93_847`,dbgWatcherTitle:`_dbgWatcherTitle_cye93_855`,dbgWatcherSub:`_dbgWatcherSub_cye93_860`,dbgWatcherBody:`_dbgWatcherBody_cye93_864`,dbgWatcherRow:`_dbgWatcherRow_cye93_869`,dbgWatcherKey:`_dbgWatcherKey_cye93_875`,dbgWatcherVal:`_dbgWatcherVal_cye93_882`,dbgEditConfig:`_dbgEditConfig_cye93_895`,dbgEditTitle:`_dbgEditTitle_cye93_900`,dbgEditRow:`_dbgEditRow_cye93_906`,dbgEditLabel:`_dbgEditLabel_cye93_913`,dbgEditInput:`_dbgEditInput_cye93_919`,dbgEditActions:`_dbgEditActions_cye93_934`,dbgDiffPicker:`_dbgDiffPicker_cye93_941`,dbgDiffOverlay:`_dbgDiffOverlay_cye93_942`,dbgDiffModal:`_dbgDiffModal_cye93_953`,dbgDiffHeader:`_dbgDiffHeader_cye93_963`,dbgDiffBody:`_dbgDiffBody_cye93_972`,dbgDiffRow:`_dbgDiffRow_cye93_980`,dbgDiffOk:`_dbgDiffOk_cye93_986`,dbgDiffChanged:`_dbgDiffChanged_cye93_987`,dbgDiffAdded:`_dbgDiffAdded_cye93_988`,dbgDiffRemoved:`_dbgDiffRemoved_cye93_989`,dbgDiffNodeLabel:`_dbgDiffNodeLabel_cye93_990`,dbgDiffDuration:`_dbgDiffDuration_cye93_998`,dbgDiffSplit:`_dbgDiffSplit_cye93_1005`,dbgDiffSide:`_dbgDiffSide_cye93_1011`,dbgDiffSideLabel:`_dbgDiffSideLabel_cye93_1017`,envSelect:`_envSelect_cye93_1025`,backupStatus:`_backupStatus_cye93_1035`,templateCard:`_templateCard_cye93_1042`,templateHeader:`_templateHeader_cye93_1051`,templateName:`_templateName_cye93_1057`,templateTag:`_templateTag_cye93_1062`,templateDesc:`_templateDesc_cye93_1071`,templateMeta:`_templateMeta_cye93_1077`},Ut=[{id:`trigger_manual`,type:`trigger`,label:`Manual`,icon:`▶`,color:`#6366f1`,description:`Run manually with optional text input.`,configFields:[{key:`input`,label:`Input text`,placeholder:`Optional initial input`}]},{id:`trigger_cron`,type:`trigger`,label:`Cron`,icon:`⏰`,color:`#fbbf24`,description:`Run on a schedule (cron expression).`,configFields:[{key:`schedule`,label:`Cron expression`,placeholder:`0 8 * * *`,required:!0}]},{id:`trigger_email`,type:`trigger`,label:`New Email`,icon:`📧`,color:`#38bdf8`,description:`Trigger when a new email arrives matching a filter.`,configFields:[{key:`filter`,label:`Gmail filter`,placeholder:`subject:TODO is:unread`}]},{id:`trigger_webhook`,type:`trigger`,label:`Webhook`,icon:`🔗`,color:`#a5b4fc`,description:`Trigger via HTTP POST/GET/PUT/DELETE. URL: http://localhost:3847/api/webhooks/<slug>`,configFields:[{key:`slug`,label:`Slug (URL path)`,placeholder:`my-trigger`,required:!0}]},{id:`trigger_file_watch`,type:`trigger`,label:`File Watch`,icon:`📁`,color:`#34d399`,description:`Fires when a file in the watched folder is created/modified.`,configFields:[{key:`path`,label:`Folder path`,placeholder:`/Users/me/inbox`,required:!0},{key:`recursive`,label:`Recursive (yes/no)`,placeholder:`no`}]},{id:`trigger_rss`,type:`trigger`,label:`RSS Feed`,icon:`📰`,color:`#fb923c`,description:`Polls an RSS/Atom feed; fires once per new item.`,configFields:[{key:`url`,label:`Feed URL`,placeholder:`https://example.com/feed.xml`,required:!0},{key:`intervalMin`,label:`Poll interval (min)`,placeholder:`15`}]},{id:`trigger_imap_folder`,type:`trigger`,label:`IMAP Folder`,icon:`📬`,color:`#60a5fa`,description:`Fires on new mail in a specific IMAP folder/label.`,configFields:[{key:`account`,label:`IMAP account id`,placeholder:`main`,required:!0},{key:`folder`,label:`Folder name`,placeholder:`INBOX`}]},{id:`trigger_discord_message`,type:`trigger`,label:`Discord Message`,icon:`🟣`,color:`#a78bfa`,description:`Fires on a new Discord message matching the filter (#channel or @mention).`,configFields:[{key:`filter`,label:`Filter`,placeholder:`#general OR @nha-bot`}]},{id:`action_email`,type:`action`,label:`Send Email`,icon:`✉`,color:`#38bdf8`,description:`Send email via Gmail or IMAP.`,configFields:[{key:`to`,label:`To`,placeholder:`email@example.com`,required:!0},{key:`subject`,label:`Subject`,placeholder:`Subject or {{output}}`},{key:`body`,label:`Body`,placeholder:`{{output}}`}]},{id:`action_slack`,type:`action`,label:`Slack Message`,icon:`💬`,color:`#818cf8`,description:`Post a message to a Slack channel.`,configFields:[{key:`channel`,label:`Channel`,placeholder:`#general`,required:!0},{key:`text`,label:`Text`,placeholder:`{{output}}`}]},{id:`action_calendar`,type:`action`,label:`Create Event`,icon:`📅`,color:`#4ade80`,description:`Create a Google Calendar event.`,configFields:[{key:`title`,label:`Title`,placeholder:`{{output}}`,required:!0},{key:`date`,label:`Date (YYYY-MM-DD)`,placeholder:`2025-01-15`},{key:`time`,label:`Time (HH:MM)`,placeholder:`09:00`}]},{id:`action_task`,type:`action`,label:`Create Task`,icon:`✅`,color:`#fbbf24`,description:`Add a task to your task list.`,configFields:[{key:`title`,label:`Title`,placeholder:`{{output}}`,required:!0},{key:`priority`,label:`Priority`,placeholder:`medium`}]},{id:`action_drive`,type:`action`,label:`Save to Drive`,icon:`💾`,color:`#a78bfa`,description:`Save a text file to Google Drive.`,configFields:[{key:`name`,label:`Filename`,placeholder:`output.txt`,required:!0},{key:`content`,label:`Content`,placeholder:`{{output}}`}]},{id:`action_notion`,type:`action`,label:`Notion Page`,icon:`📋`,color:`#e4e4e7`,description:`Create or update a Notion page.`,configFields:[{key:`title`,label:`Title`,placeholder:`{{output}}`,required:!0},{key:`content`,label:`Content`,placeholder:`{{output}}`}]},{id:`action_github`,type:`action`,label:`GitHub Issue`,icon:`🐙`,color:`#6ee7b7`,description:`Create a GitHub issue.`,configFields:[{key:`repo`,label:`Repo (owner/name)`,placeholder:`user/repo`,required:!0},{key:`title`,label:`Title`,placeholder:`{{output}}`,required:!0},{key:`body`,label:`Body`,placeholder:``}]},{id:`action_webhook`,type:`action`,label:`HTTP Request`,icon:`🌐`,color:`#38bdf8`,description:`Make an HTTP request.`,configFields:[{key:`url`,label:`URL`,placeholder:`https://…`,required:!0},{key:`method`,label:`Method`,placeholder:`POST`},{key:`body`,label:`Body`,placeholder:`{{output}}`}]},{id:`ai_agent`,type:`ai`,label:`Run Agent`,icon:`🤖`,color:`#818cf8`,description:`Run any of the 38 NHA specialist agents.`,configFields:[{key:`agent`,label:`Agent name`,placeholder:`herald, saber, forge…`,required:!0},{key:`prompt`,label:`Prompt`,placeholder:`Summarize this: {{output}}`,required:!0}]},{id:`ai_summarize`,type:`ai`,label:`Summarize`,icon:`📝`,color:`#a5b4fc`,description:`Summarize text with AI (free via Liara).`,configFields:[{key:`prompt`,label:`Prompt`,placeholder:`Summarize: {{output}}`}]},{id:`ai_classify`,type:`ai`,label:`Classify`,icon:`🏷`,color:`#a5b4fc`,description:`Classify content into categories.`,configFields:[{key:`categories`,label:`Categories (comma-separated)`,placeholder:`urgent, normal, spam`},{key:`prompt`,label:`Prompt`,placeholder:`Classify this email: {{output}}`}]},{id:`ai_extract`,type:`ai`,label:`Extract Data`,icon:`🔍`,color:`#a5b4fc`,description:`Extract structured data from text.`,configFields:[{key:`prompt`,label:`What to extract`,placeholder:`Extract name, email, date from: {{output}}`}]},{id:`ai_translate`,type:`ai`,label:`Translate`,icon:`🌍`,color:`#a5b4fc`,description:`Translate text to another language.`,configFields:[{key:`lang`,label:`Target language`,placeholder:`Italian`,required:!0},{key:`prompt`,label:`Text`,placeholder:`{{output}}`}]},{id:`ai_code`,type:`ai`,label:`Code (JS)`,icon:`💻`,color:`#818cf8`,description:"Execute JavaScript code. Access previous output via `input` variable. Return a value.",configFields:[{key:`code`,label:`JavaScript code`,placeholder:`const data = JSON.parse(input);
|
|
704
|
-
return data.map(x => x.name).join(", ");`,type:`textarea`}]},{id:`logic_if`,type:`logic`,label:`If / Condition`,icon:`🔀`,color:`#f59e0b`,description:`Branch based on a condition. Outputs to "true" or "false" path.`,configFields:[{key:`condition`,label:`Condition (JS expression)`,placeholder:`{{output}}.includes("urgent")`,required:!0}],outputs:[`true`,`false`]},{id:`logic_switch`,type:`logic`,label:`Switch`,icon:`🔄`,color:`#f59e0b`,description:`Route to different paths based on value. Add cases as comma-separated values.`,configFields:[{key:`expression`,label:`Expression`,placeholder:`{{output}}`,required:!0},{key:`cases`,label:`Cases (comma-separated)`,placeholder:`urgent, normal, spam`,required:!0}]},{id:`logic_loop`,type:`logic`,label:`Loop / For Each`,icon:`🔁`,color:`#f59e0b`,description:`Iterate over items. Input should be JSON array or newline-separated text.`,configFields:[{key:`separator`,label:`Separator`,placeholder:`\\n (newline) or , (comma)`}]},{id:`logic_merge`,type:`logic`,label:`Merge`,icon:`🔗`,color:`#f59e0b`,description:`Merge outputs from multiple branches into one.`,configFields:[{key:`mode`,label:`Mode`,placeholder:`concat`,type:`select`,options:[`concat`,`json_array`,`first_non_empty`]}]},{id:`logic_delay`,type:`logic`,label:`Delay`,icon:`⏳`,color:`#f59e0b`,description:`Wait before continuing.`,configFields:[{key:`seconds`,label:`Seconds`,placeholder:`5`,required:!0}]},{id:`logic_error`,type:`logic`,label:`Error Handler`,icon:`🛡`,color:`#ef4444`,description:`Catch errors from previous nodes. Configure retry count and fallback behavior.`,configFields:[{key:`retries`,label:`Max retries`,placeholder:`3`},{key:`fallback`,label:`Fallback output`,placeholder:`Default value if all retries fail`}]},{id:`logic_subworkflow`,type:`logic`,label:`Subworkflow`,icon:`🪆`,color:`#a855f7`,description:`Run another workflow inline. Output of the sub becomes this node's output. Max nesting depth 5.`,configFields:[{key:`workflowId`,label:`Target workflow ID`,placeholder:`wf_abc123`,required:!0},{key:`inputMapping`,label:`Input expression`,placeholder:`{{output}} (default)`}]},{id:`action_browser`,type:`action`,label:`Open URL`,icon:`🌐`,color:`#60a5fa`,description:`Open a URL in headless browser and extract text content.`,configFields:[{key:`url`,label:`URL`,placeholder:`https://example.com or {{output}}`,required:!0}]},{id:`action_file_read`,type:`action`,label:`Read File`,icon:`📖`,color:`#4ade80`,description:`Read a file from the filesystem.`,configFields:[{key:`path`,label:`File path`,placeholder:`/path/to/file.txt`,required:!0}]},{id:`action_file_write`,type:`action`,label:`Write File`,icon:`📝`,color:`#4ade80`,description:`Write content to a file.`,configFields:[{key:`path`,label:`File path`,placeholder:`/path/to/output.txt`,required:!0},{key:`content`,label:`Content`,placeholder:`{{output}}`}]},{id:`action_contact`,type:`action`,label:`Find Contact`,icon:`👤`,color:`#38bdf8`,description:`Search Google Contacts by name or email.`,configFields:[{key:`query`,label:`Search query`,placeholder:`John or john@example.com`,required:!0}]},{id:`action_screen`,type:`action`,label:`Screenshot`,icon:`📸`,color:`#c084fc`,description:`Take a screenshot of the screen.`,configFields:[]},{id:`action_maps`,type:`action`,label:`Maps Directions`,icon:`🗺`,color:`#4ade80`,description:`Get directions between two locations.`,configFields:[{key:`from`,label:`From`,placeholder:`Milan`,required:!0},{key:`to`,label:`To`,placeholder:`Rome`,required:!0}]},{id:`action_notify`,type:`action`,label:`Notification`,icon:`🔔`,color:`#fbbf24`,description:`Send a system notification or Telegram message.`,configFields:[{key:`message`,label:`Message`,placeholder:`{{output}}`,required:!0},{key:`channel`,label:`Channel`,placeholder:`telegram or system`,type:`select`,options:[`system`,`telegram`]}]}],Wt=90,Gt=72;function Kt(){return`n_${Date.now()}_${Math.random().toString(36).slice(2,6)}`}function qt(e,t){return{x:e.x+(t===`out`?Wt:0),y:e.y+Gt/2}}function Jt(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)([]),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(`trigger`),[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(-1),[C,w]=(0,_.useState)({}),[ee,T]=(0,_.useState)(null),[te,ne]=(0,_.useState)(`output`),[O,re]=(0,_.useState)(null),[k,ie]=(0,_.useState)({}),[j,ae]=(0,_.useState)(``),[oe,ce]=(0,_.useState)(null),[le,ue]=(0,_.useState)(!1),[M,N]=(0,_.useState)([]),[de,fe]=(0,_.useState)(!1),[pe,me]=(0,_.useState)(!1),[he,ge]=(0,_.useState)(`installed`),[_e,ve]=(0,_.useState)([]),[ye,be]=(0,_.useState)([]),[P,Se]=(0,_.useState)(``),Ce=(0,_.useMemo)(()=>{let e=_e.flatMap(e=>(e.nodes||[]).map(t=>({...t,id:t.id.startsWith(`${e.id}_`)?t.id:`${e.id}_${t.id}`})));return[...Ut,...e]},[_e]),we=(0,_.useMemo)(()=>Object.fromEntries(Ce.map(e=>[e.id,e])),[Ce]);(0,_.useEffect)(()=>{E(`/api/awf/connectors/installed`).then(e=>{e?.connectors&&ve(e.connectors)}).catch(()=>null)},[]);let Te=(0,_.useCallback)(async()=>{let[e,t]=await Promise.all([E(`/api/awf/connectors/installed`).catch(()=>null),E(`/api/awf/connectors/registry`).catch(()=>null)]);ve(e?.connectors??[]),be(t?.connectors??[])},[]),F=(0,_.useCallback)(async()=>{await Te(),me(!0)},[Te]),Ee=(0,_.useCallback)(async e=>{let t=await D(`/api/awf/connectors/install`,/^https?:\/\//i.test(e)?{url:e}:{url:`https://nothumanallowed.com/awf/connectors/${e}/manifest.json`}).catch(e=>({error:e.message}));t?.ok?(await Te(),Se(``)):alert(`Installazione fallita: `+(t?.error||`errore sconosciuto`))},[Te]),De=(0,_.useCallback)(async e=>{confirm(`Disinstallare il connector "${e}"?`)&&(await D(`/api/awf/connectors/${e}`,{},`DELETE`).catch(()=>null),await Te())},[Te]),[Oe,I]=(0,_.useState)(`prod`),[L,ke]=(0,_.useState)(``);(0,_.useEffect)(()=>{E(`/api/awf/env`).then(e=>{e?.env&&I(e.env)}).catch(()=>null)},[]);let Ae=(0,_.useCallback)(async()=>{N((await E(`/api/awf/templates`).catch(()=>null))?.templates??[]),fe(!0)},[]),je=(0,_.useCallback)(async e=>{let n=await D(`/api/awf/templates/import`,{templateId:e}).catch(()=>null);n?.workflow&&(t(e=>[...e,n.workflow]),r(n.workflow),fe(!1))},[]),Me=(0,_.useCallback)(async e=>{I(e),await D(`/api/awf/env`,{env:e}).catch(()=>null)},[]),Ne=(0,_.useCallback)(async()=>{ke(`⏳ Backup in corso…`);let e=await D(`/api/awf/backup`,{}).catch(e=>({error:e.message}));e?.ok?ke(`✅ Backup salvato su Drive`):ke(`❌ ${e?.error||`Backup fallito`}`),setTimeout(()=>ke(``),4500)},[]),Pe=(0,_.useCallback)(async()=>{ke(`⏳ Push in corso…`);let e=await D(`/api/awf/sync/push`,{}).catch(e=>({error:e.message}));ke(e?.ok?`✅ Push: ${e.fileName}`:`❌ ${e?.error||`Push fallito`}`),setTimeout(()=>ke(``),5e3)},[]),Fe=(0,_.useCallback)(async()=>{let e=confirm(`Modalità MERGE (OK) — importa solo i workflow mancanti localmente.
|
|
705
|
-
Annulla = REPLACE — sovrascrive tutto col contenuto Drive.`)?`merge`:`replace`;ke(`⏳ Pull in corso…`);let n=await D(`/api/awf/sync/pull`,{mode:e}).catch(e=>({error:e.message}));if(n?.ok){ke(`✅ Pull (${e}): importati ${n.imported??0}, saltati ${n.skipped??0}`);let r=await E(`/api/workflows`).catch(()=>null);r?.workflows&&t(r.workflows)}else ke(`❌ ${n?.error||`Pull fallito`}`);setTimeout(()=>ke(``),6e3)},[]),Ie=(0,_.useRef)(null),Le=(0,_.useRef)(null);Le.current=n?.id??null,se(e=>{let t=e;if(t.type?.startsWith(`awf:`)&&t.wfId===Le.current){if(t.type===`awf:run-start`){Ie.current=t.runId||null,d([]),p(!0),S(-1);return}t.runId&&t.runId!==Ie.current||(t.type===`awf:step-start`?(d(e=>[...e,{nodeId:t.nodeId||``,nodeLabel:t.nodeLabel||``,nodeIcon:t.nodeIcon||`⏳`,input:t.input||``,output:``,error:null,startedAt:t.ts||Date.now()}]),S(e=>e+1)):t.type===`awf:step-end`?d(e=>{let n=[...e];for(let e=n.length-1;e>=0;e--)if(n[e].nodeId===t.nodeId&&!n[e].endedAt){n[e]={...n[e],output:t.outputPreview||n[e].output,error:t.error??null,durationMs:t.durationMs,endedAt:t.ts};break}return n}):t.type===`awf:paused`?(d(e=>[...e,{nodeId:t.atNodeId||``,nodeLabel:t.nodeLabel||`paused`,nodeIcon:`⏸`,output:``,error:null,paused:!0,startedAt:t.ts,endedAt:t.ts,durationMs:0}]),S(e=>e+1)):t.type===`awf:complete`&&(Ie.current=null))}});let[Re,R]=(0,_.useState)(1),[ze,Be]=(0,_.useState)({x:0,y:0}),Ve=(0,_.useRef)(!1),He=Ht(),Ue=(0,_.useRef)({x:0,y:0,px:0,py:0}),We=(0,_.useRef)(null),Ge=(0,_.useRef)(null),Ke=(0,_.useRef)(null),qe=(0,_.useCallback)(async()=>{let e=(await E(`/api/workflows`).catch(()=>null))?.workflows??[];t(e),r(t=>t?e.find(e=>e.id===t.id)??e[0]??null:e[0]??null)},[]);(0,_.useEffect)(()=>{qe()},[qe]);let Je=(0,_.useCallback)(async e=>{r(e),t(t=>t.map(t=>t.id===e.id?e:t)),await D(`/api/workflows/${e.id}`,e,`PUT`).catch(()=>null)},[]),Ye=async()=>{let e={id:`wf_${Date.now()}`,name:`New Workflow`,enabled:!1,nodes:[],edges:[],nodeDefs:Ce},n=(await D(`/api/workflows`,e).catch(()=>null))?.workflow??e;t(e=>[...e,n]),r(n),a(null),d([]),p(!1)},Xe=async e=>{confirm(`Delete this workflow?`)&&(await D(`/api/workflows/${e}`,{},`DELETE`).catch(()=>null),qe())},Ze=(0,_.useCallback)(e=>{e.preventDefault();let t=Ge.current;if(!t||!n)return;let r=Ke.current.getBoundingClientRect(),i=Math.round((e.clientX-r.left-Wt/2)/20)*20,o=Math.round((e.clientY-r.top-Gt/2)/20)*20,s={id:Kt(),defId:t,x:Math.max(0,i),y:Math.max(0,o),config:{}};Je({...n,nodes:[...n.nodes,s]}),a(s.id),Ge.current=null},[n,Je]),Qe=(0,_.useCallback)((e,t)=>{if(e.stopPropagation(),o){o!==t&&n&&(n.edges.some(e=>e.from===o&&e.to===t)||Je({...n,edges:[...n.edges,{from:o,to:t}]})),s(null);return}a(t);let r=n?.nodes.find(e=>e.id===t);r&&(We.current={id:t,ox:e.clientX-r.x,oy:e.clientY-r.y})},[o,n,Je]),$e=(0,_.useCallback)(e=>{if(!We.current||!n)return;let{id:t,ox:i,oy:a}=We.current,o=e.clientX-i,s=e.clientY-a,c=Math.max(0,Math.round(o/20)*20),l=Math.max(0,Math.round(s/20)*20);r(e=>e&&{...e,nodes:e.nodes.map(e=>e.id===t?{...e,x:c,y:l}:e)})},[n]),et=(0,_.useCallback)(()=>{if(!We.current||!n){We.current=null;return}n.nodes.find(e=>e.id===We.current.id)&&Je(n),We.current=null},[n,Je]),tt=(0,_.useCallback)(e=>{n&&(Je({...n,nodes:n.nodes.filter(t=>t.id!==e),edges:n.edges.filter(t=>t.from!==e&&t.to!==e)}),a(null))},[n,Je]),nt=(0,_.useCallback)((e,t)=>{n&&Je({...n,edges:n.edges.filter(n=>!(n.from===e&&n.to===t))})},[n,Je]),rt=(0,_.useCallback)((e,i,a)=>{if(!n)return;let o={...n,nodes:n.nodes.map(t=>t.id===e?{...t,config:{...t.config,[i]:a}}:t)};r(o),t(e=>e.map(e=>e.id===o.id?o:e))},[n]),it=(0,_.useCallback)(()=>{n&&Je(n)},[n,Je]),at=async()=>{if(!(!n||c)){l(!0),p(!0),d([]),b(null),S(-1);try{let e={...n,nodeDefs:Ce};await D(`/api/workflows/${n.id}`,e,`PUT`).catch(()=>null);let t=await D(`/api/workflows/${n.id}/run`,{breakpoints:n.breakpoints||[]}),r=t?.steps??[];d(r),t?.ts&&(b({ts:t.ts,workflowId:n.id,input:``,steps:r,paused:t.paused??null,errorCount:r.filter(e=>e.error).length,totalDurationMs:r.reduce((e,t)=>e+(t.durationMs||0),0)}),S(r.length-1)),qe(),ot()}catch(e){d([{nodeId:`__error`,nodeLabel:`Error`,nodeIcon:`❌`,output:``,error:e.message}])}finally{l(!1)}}},ot=(0,_.useCallback)(async()=>{n&&v((await E(`/api/awf/${n.id}/run-history`).catch(()=>null))?.runs??[])},[n]);(0,_.useEffect)(()=>{ot()},[ot]),(0,_.useEffect)(()=>{if(!n||!y?.paused){re(null),ie({});return}let e=!1;return(async()=>{let t=await E(`/api/awf/${n.id}/paused-context/${y.ts}`).catch(()=>null);!e&&t&&(re(t),ie({...t.nodeConfig||{}}))})(),()=>{e=!0}},[n,y?.paused,y?.ts]);let st=(0,_.useCallback)(async e=>{if(!n)return;let t=await E(`/api/awf/${n.id}/run/${e}`).catch(()=>null);t&&(b(t),d(t.steps||[]),S((t.steps?.length??1)-1),p(!0))},[n]),ct=(0,_.useCallback)(async()=>{if(!(!n||!y)){l(!0);try{let e=await D(`/api/awf/${n.id}/replay/${y.ts}`,{});e?.ts&&await st(e.ts),ot()}finally{l(!1)}}},[n,y,st,ot]),lt=(0,_.useCallback)(async e=>{if(!(!n||!y)){l(!0);try{let t=await D(`/api/awf/${n.id}/replay-from/${y.ts}/${e}`,{});t?.ts&&await st(t.ts),ot()}finally{l(!1)}}},[n,y,st,ot]),ut=(0,_.useCallback)(async()=>{if(!(!n||!y)){l(!0);try{let e=await D(`/api/awf/${n.id}/resume/${y.ts}`,{});e?.ts&&await st(e.ts),ot()}finally{l(!1)}}},[n,y,st,ot]),dt=(0,_.useCallback)(async e=>{if(!n||!y||!e)return;let t=await E(`/api/awf/${n.id}/diff/${y.ts}/${e}`).catch(()=>null);t&&(ce(t),ue(!0))},[n,y]),ft=(0,_.useCallback)(async e=>{if(!n||!y)return;let t=`${y.ts}:${e}`;if(!C[t]){T(t);try{let r=await D(`/api/awf/${n.id}/explain/${y.ts}/${e}`,{});r?.explanation&&w(e=>({...e,[t]:r.explanation}))}finally{T(null)}}},[n,y,C]),pt=e=>typeof e==`string`?e:e.nodeId,mt=(0,_.useCallback)(e=>{let t=n?.breakpoints||[];for(let n of t)if(pt(n)===e)return typeof n==`string`?{nodeId:n}:n;return null},[n]),ht=(0,_.useCallback)(async e=>{if(!n)return;let i={...n,breakpoints:e};r(i),t(e=>e.map(e=>e.id===i.id?i:e)),await D(`/api/awf/${n.id}/breakpoints`,{breakpoints:e}).catch(()=>null)},[n]),gt=(0,_.useCallback)(async e=>{n&&await ht((n.breakpoints||[]).some(t=>pt(t)===e)?(n.breakpoints||[]).filter(t=>pt(t)!==e):[...n.breakpoints||[],{nodeId:e}])},[n,ht]),_t=(0,_.useCallback)(async(e,t)=>{if(!n)return;let r=[...n.breakpoints||[]],i=r.findIndex(t=>pt(t)===e),a={nodeId:e,condition:t.trim()||void 0};i>=0?r[i]=a:r.push(a),await ht(r)},[n,ht]),vt=async e=>{let i={...e,enabled:!e.enabled};await D(`/api/workflows/${e.id}`,i,`PUT`).catch(()=>null),t(t=>t.map(t=>t.id===e.id?i:t)),n?.id===e.id&&r(i)},z=n?.nodes.find(e=>e.id===i)??null,yt=z?we[z.defId]:null;return(0,A.jsxs)(`div`,{className:H.root,children:[(0,A.jsxs)(`div`,{className:H.topbar,children:[(0,A.jsxs)(`div`,{className:H.topbarLeft,children:[(0,A.jsx)(`span`,{className:H.topbarTitle,children:`AWF - AutoWorkFlow`}),(0,A.jsx)(`span`,{className:H.topbarSub,children:`Visual workflow automation · 80 tools · 38 AI agents · free AI via Liara`})]}),(0,A.jsxs)(`div`,{className:H.topbarActions,children:[n&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{className:`${H.runBtn} ${c?H.runBtnActive:``}`,onClick:at,disabled:c||n.nodes.length===0,children:c?`⏳ Running…`:`▶ Run`}),(0,A.jsx)(`button`,{className:H.logBtn,onClick:()=>p(e=>!e),children:f?`Hide Log`:`🔍 Debugger`})]}),(0,A.jsxs)(`select`,{className:H.envSelect,value:Oe,onChange:e=>Me(e.target.value),title:`Ambiente attivo: cambia quali credenziali vengono usate`,children:[(0,A.jsx)(`option`,{value:`dev`,children:`🟡 dev`}),(0,A.jsx)(`option`,{value:`staging`,children:`🟠 staging`}),(0,A.jsx)(`option`,{value:`prod`,children:`🟢 prod`})]}),(0,A.jsx)(`button`,{className:H.logBtn,onClick:Ae,title:`Importa un workflow predefinito`,children:`📚 Templates`}),(0,A.jsx)(`button`,{className:H.logBtn,onClick:F,title:`Gestisci i connector (estensioni con nuovi nodi e template)`,children:`🔌 Connectors`}),(0,A.jsx)(`button`,{className:H.logBtn,onClick:Ne,title:`Backup ora tutti i workflow su Google Drive`,children:`💾 Backup`}),(0,A.jsx)(`button`,{className:H.logBtn,onClick:Pe,title:`Push del workspace su Drive (sincronizzazione tra macchine)`,children:`↑ Push`}),(0,A.jsx)(`button`,{className:H.logBtn,onClick:Fe,title:`Pull del workspace da Drive (sincronizzazione tra macchine)`,children:`↓ Pull`}),L&&(0,A.jsx)(`span`,{className:H.backupStatus,children:L}),(0,A.jsx)(`button`,{className:H.newWfBtn,onClick:Ye,children:`+ New Workflow`})]})]}),de&&(0,A.jsx)(`div`,{className:H.dbgDiffOverlay,onClick:()=>fe(!1),children:(0,A.jsxs)(`div`,{className:H.dbgDiffModal,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:H.dbgDiffHeader,children:[(0,A.jsx)(`span`,{className:H.dbgTitle,children:`📚 Workflow Templates`}),(0,A.jsxs)(`span`,{className:H.dbgStats,children:[M.length,` disponibili (locali + community)`]}),(0,A.jsx)(`button`,{className:H.logClose,onClick:()=>fe(!1),children:`✕`})]}),(0,A.jsx)(`div`,{className:H.dbgDiffBody,children:M.length===0?(0,A.jsx)(`div`,{className:H.dbgEmpty,children:`Nessun template disponibile.`}):M.map(e=>(0,A.jsxs)(`div`,{className:H.templateCard,children:[(0,A.jsxs)(`div`,{className:H.templateHeader,children:[(0,A.jsx)(`span`,{className:H.templateName,children:e.name}),e.tags?.map(e=>(0,A.jsx)(`span`,{className:H.templateTag,children:e},e))]}),e.description&&(0,A.jsx)(`span`,{className:H.templateDesc,children:e.description}),(0,A.jsxs)(`div`,{className:H.templateMeta,children:[e.nodes?.length??0,` nodi · `,e.edges?.length??0,` connessioni`]}),(0,A.jsx)(`button`,{className:H.dbgBtnResume,onClick:()=>je(e.id),children:`⇩ Importa`})]},e.id))})]})}),pe&&(0,A.jsx)(`div`,{className:H.dbgDiffOverlay,onClick:()=>me(!1),children:(0,A.jsxs)(`div`,{className:H.dbgDiffModal,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:H.dbgDiffHeader,children:[(0,A.jsx)(`span`,{className:H.dbgTitle,children:`🔌 Connectors`}),(0,A.jsxs)(`span`,{className:H.dbgTabs,children:[(0,A.jsxs)(`button`,{className:`${H.dbgTab} ${he===`installed`?H.dbgTabActive:``}`,onClick:()=>ge(`installed`),children:[`Installati (`,_e.length,`)`]}),(0,A.jsxs)(`button`,{className:`${H.dbgTab} ${he===`marketplace`?H.dbgTabActive:``}`,onClick:()=>ge(`marketplace`),children:[`Marketplace (`,ye.length,`)`]})]}),(0,A.jsx)(`button`,{className:H.logClose,onClick:()=>me(!1),children:`✕`})]}),(0,A.jsxs)(`div`,{className:H.dbgDiffBody,children:[he===`installed`&&(0,A.jsxs)(A.Fragment,{children:[_e.length===0?(0,A.jsxs)(`div`,{className:H.dbgEmpty,children:[`Nessun connector installato. Vai su `,(0,A.jsx)(`b`,{children:`Marketplace`}),` per esplorare quelli disponibili, o installa via URL manifest qui sotto.`]}):_e.map(e=>(0,A.jsxs)(`div`,{className:H.templateCard,children:[(0,A.jsxs)(`div`,{className:H.templateHeader,children:[(0,A.jsx)(`span`,{style:{fontSize:18},children:e.icon||`🔌`}),(0,A.jsx)(`span`,{className:H.templateName,children:e.name}),(0,A.jsxs)(`span`,{className:H.templateTag,children:[`v`,e.version]}),e.author&&(0,A.jsxs)(`span`,{className:H.templateMeta,children:[`by `,e.author]})]}),e.description&&(0,A.jsx)(`span`,{className:H.templateDesc,children:e.description}),(0,A.jsxs)(`div`,{className:H.templateMeta,children:[e.nodes?.length??0,` nodi · `,e.templates?.length??0,` template`,e._installedAt&&` · installato ${new Date(e._installedAt).toLocaleDateString()}`]}),(0,A.jsx)(`button`,{className:H.dbgBtnBp,onClick:()=>De(e.id),children:`🗑 Disinstalla`})]},e.id)),(0,A.jsxs)(`div`,{className:H.templateCard,style:{borderStyle:`dashed`},children:[(0,A.jsx)(`div`,{className:H.templateName,children:`+ Installa via URL manifest`}),(0,A.jsx)(`span`,{className:H.templateMeta,children:`Solo host whitelisted: nothumanallowed.com, raw.githubusercontent.com`}),(0,A.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,A.jsx)(`input`,{type:`text`,placeholder:`https://… /manifest.json oppure id curato`,value:P,onChange:e=>Se(e.target.value),className:H.dbgEditInput,style:{flex:1}}),(0,A.jsx)(`button`,{className:H.dbgBtnResume,disabled:!P.trim(),onClick:()=>P.trim()&&Ee(P.trim()),children:`⇩ Installa`})]})]})]}),he===`marketplace`&&(0,A.jsx)(A.Fragment,{children:ye.length===0?(0,A.jsx)(`div`,{className:H.dbgEmpty,children:`Marketplace vuoto o irraggiungibile. Il registry è su nothumanallowed.com/awf/connectors/index.json.`}):ye.map(e=>(0,A.jsxs)(`div`,{className:H.templateCard,children:[(0,A.jsxs)(`div`,{className:H.templateHeader,children:[(0,A.jsx)(`span`,{style:{fontSize:18},children:e.icon||`🔌`}),(0,A.jsx)(`span`,{className:H.templateName,children:e.name}),(0,A.jsxs)(`span`,{className:H.templateTag,children:[`v`,e.version]}),e.installed&&(0,A.jsx)(`span`,{className:H.templateTag,style:{background:`rgba(34,197,94,0.2)`,color:`#4ade80`},children:`✓ installato`})]}),e.description&&(0,A.jsx)(`span`,{className:H.templateDesc,children:e.description}),(0,A.jsxs)(`div`,{className:H.templateMeta,children:[e.nodes?.length??0,` nodi · `,e.templates?.length??0,` template`]}),(0,A.jsx)(`button`,{className:e.installed?H.dbgBtnBp:H.dbgBtnResume,onClick:()=>e.installed?De(e.id):Ee(e.id),children:e.installed?`🗑 Disinstalla`:`⇩ Installa`})]},e.id))})]})]})}),(0,A.jsxs)(`div`,{className:H.body,children:[(0,A.jsxs)(`div`,{className:H.sidebar,children:[(0,A.jsx)(`div`,{className:H.sidebarTitle,children:`Workflows`}),e.length===0&&(0,A.jsxs)(`div`,{className:H.sidebarEmpty,children:[`No workflows yet.`,(0,A.jsx)(`br`,{}),`Click "New Workflow" to start.`]}),e.map(e=>(0,A.jsxs)(`div`,{className:`${H.wfItem} ${n?.id===e.id?H.wfItemActive:``}`,onClick:()=>{r(e),a(null),d(e.lastRun?.steps??[]),p(!1)},children:[(0,A.jsxs)(`div`,{className:H.wfItemRow,children:[(0,A.jsx)(`span`,{className:H.wfItemName,children:e.name}),(0,A.jsx)(`button`,{className:e.enabled?H.wfOn:H.wfOff,onClick:t=>{t.stopPropagation(),vt(e)},children:e.enabled?`ON`:`OFF`})]}),(0,A.jsxs)(`div`,{className:H.wfItemMeta,children:[e.nodes.length,` nodes · `,e.edges.length,` edges`,e.lastRun&&(0,A.jsxs)(`span`,{children:[` · ran `,new Date(e.lastRun.at).toLocaleTimeString()]})]}),(0,A.jsx)(`button`,{className:H.wfDelBtn,onClick:t=>{t.stopPropagation(),Xe(e.id)},children:`✕`})]},e.id))]}),(0,A.jsx)(`div`,{className:H.canvasArea,children:n?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:H.canvasHeader,children:[(0,A.jsx)(`input`,{className:H.wfNameInput,value:n.name,onChange:e=>r(t=>t&&{...t,name:e.target.value}),onBlur:()=>n&&Je(n)}),o?(0,A.jsxs)(`span`,{className:H.connectHint,children:[`Click a target node to connect · `,(0,A.jsx)(`button`,{className:H.cancelConnectBtn,onClick:()=>s(null),children:`Cancel`})]}):(0,A.jsxs)(`span`,{className:H.canvasHint,children:[`Drag nodes from palette · Click `,(0,A.jsx)(`span`,{className:H.portHint,children:`▶`}),` to connect · Drag nodes to reposition`]})]}),(0,A.jsxs)(`div`,{ref:Ke,className:`${H.canvas} ${o?H.canvasConnecting:``}`,onMouseMove:e=>{if(Ve.current){Be({x:Ue.current.px+(e.clientX-Ue.current.x),y:Ue.current.py+(e.clientY-Ue.current.y)});return}$e(e)},onMouseDown:e=>{e.button===1&&(e.preventDefault(),Ve.current=!0,Ue.current={x:e.clientX,y:e.clientY,px:ze.x,py:ze.y})},onMouseUp:()=>{Ve.current=!1,et()},onMouseLeave:()=>{Ve.current=!1,et()},onWheel:e=>{if(e.preventDefault(),e.ctrlKey||e.metaKey){let t=e.deltaY>0?-.1:.1;R(e=>Math.max(.3,Math.min(2,e+t)))}else Be(t=>({x:t.x-e.deltaX,y:t.y-e.deltaY}))},onDragOver:e=>e.preventDefault(),onDrop:Ze,onClick:()=>{o||a(null)},children:[(0,A.jsxs)(`div`,{className:H.zoomControls,children:[(0,A.jsx)(`button`,{onClick:()=>R(e=>Math.min(2,e+.1)),children:`+`}),(0,A.jsxs)(`span`,{children:[Math.round(Re*100),`%`]}),(0,A.jsx)(`button`,{onClick:()=>R(e=>Math.max(.3,e-.1)),children:`−`}),(0,A.jsx)(`button`,{onClick:()=>{R(1),Be({x:0,y:0})},children:`⊙`})]}),(0,A.jsxs)(`div`,{style:{transform:`translate(${ze.x}px, ${ze.y}px) scale(${Re})`,transformOrigin:`0 0`,position:`absolute`,inset:0},children:[(0,A.jsx)(`svg`,{className:H.canvasSvg,children:n.edges.map((e,t)=>{let r=n.nodes.find(t=>t.id===e.from),i=n.nodes.find(t=>t.id===e.to);if(!r||!i)return null;let a=qt(r,`out`),o=qt(i,`in`),s=(a.x+o.x)/2;return(0,A.jsxs)(`g`,{children:[(0,A.jsx)(`path`,{d:`M${a.x},${a.y} C${s},${a.y} ${s},${o.y} ${o.x},${o.y}`,stroke:`var(--green3)`,strokeWidth:`2`,fill:`none`,strokeDasharray:`6,3`,opacity:`0.8`}),(0,A.jsx)(`path`,{d:`M${a.x},${a.y} C${s},${a.y} ${s},${o.y} ${o.x},${o.y}`,stroke:`transparent`,strokeWidth:`12`,fill:`none`,style:{cursor:`pointer`},onClick:t=>{t.stopPropagation(),nt(e.from,e.to)}}),(0,A.jsx)(`circle`,{cx:s,cy:(a.y+o.y)/2,r:`7`,fill:`var(--bg2)`,stroke:`var(--border)`,strokeWidth:`1.5`,style:{cursor:`pointer`},onClick:t=>{t.stopPropagation(),nt(e.from,e.to)}}),(0,A.jsx)(`text`,{x:s,y:(a.y+o.y)/2+4,textAnchor:`middle`,fill:`var(--dim)`,fontSize:`9`,style:{cursor:`pointer`,pointerEvents:`none`},children:`✕`})]},t)})}),n.nodes.map(e=>{let t=we[e.defId];if(!t)return null;let n=i===e.id,r=o===e.id,a=!!mt(e.id),c=u[x]?.nodeId===e.id,l=null;for(let t=u.length-1;t>=0;t--)if(u[t].nodeId===e.id){l=u[t].error?`err`:u[t].paused?`paused`:`ok`;break}let d=l===`err`?H.canvasNodeErr:l===`paused`?H.canvasNodePaused:l===`ok`?H.canvasNodeOk:``;return(0,A.jsxs)(`div`,{className:`${H.canvasNode} ${n?H.canvasNodeSelected:``} ${r?H.canvasNodeConnecting:``} ${d} ${c?H.canvasNodeFocused:``}`,style:{left:e.x,top:e.y,borderColor:t.color+(n?`ff`:`88`),background:t.color+`18`},onMouseDown:t=>Qe(t,e.id),onClick:e=>e.stopPropagation(),onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),gt(e.id)},title:a?`Breakpoint attivo · click destro per toglierlo`:`Click destro per mettere un breakpoint qui`,children:[a&&(0,A.jsx)(`span`,{className:H.nodeBpBadge,title:`Breakpoint`,children:`●`}),(0,A.jsx)(`button`,{className:H.nodeDelBtn,onMouseDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),tt(e.id)},children:`✕`}),(0,A.jsx)(`span`,{className:H.nodeIcon,children:t.icon}),(0,A.jsx)(`span`,{className:H.nodeLabel,style:{color:t.color},children:t.label}),Object.values(e.config).filter(Boolean).slice(0,1).map((e,t)=>(0,A.jsx)(`span`,{className:H.nodeConfigPreview,children:String(e).slice(0,14)},t)),(0,A.jsx)(`button`,{className:`${H.portOut} ${r?H.portActive:``}`,onMouseDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),s(t=>t===e.id?null:e.id)},title:`Connect from here`,children:`▶`}),o&&o!==e.id&&(0,A.jsx)(`button`,{className:H.portIn,onMouseDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),Qe(t,e.id)},title:`Connect here`,children:`◀`})]},e.id)}),n.nodes.length===0&&(0,A.jsx)(`div`,{className:H.canvasDrop,children:`Drag nodes from the right panel and drop here`})]})]}),f&&(0,A.jsxs)(`div`,{className:H.debuggerPanel,children:[(0,A.jsxs)(`div`,{className:H.dbgHeader,children:[(0,A.jsxs)(`div`,{className:H.dbgHeaderLeft,children:[(0,A.jsx)(`span`,{className:H.dbgTitle,children:`🔍 Debugger`}),g.length>0&&(0,A.jsxs)(`select`,{className:H.dbgRunSelect,value:y?.ts||``,onChange:e=>e.target.value&&st(e.target.value),children:[(0,A.jsx)(`option`,{value:``,children:`— scegli una run —`}),g.map(e=>{let t=new Date(e.ts.replace(/-(\d{2})-(\d{2})-(\d{3})Z$/,`:$1:$2.$3Z`)),n=isNaN(t.getTime())?e.ts.slice(0,19):t.toLocaleString();return(0,A.jsxs)(`option`,{value:e.ts,children:[e.hasError?`❌ `:`✓ `,n,` · `,e.stepsCount,` step`,e.stepsCount===1?``:`s`,e.errorNode?` (err: ${e.errorNode})`:``]},e.ts)})]}),y?.paused&&(0,A.jsx)(`span`,{className:H.dbgPausedBadge,title:`Fermato al nodo ${y.paused.atNodeId}`,children:`⏸ FERMATO AL BREAKPOINT`}),y&&!y.paused&&(0,A.jsxs)(`span`,{className:H.dbgStats,children:[y.errorCount?`${y.errorCount} error${y.errorCount===1?``:`i`}`:`tutti i nodi OK`,` · `,y.totalDurationMs,`ms totali`]})]}),(0,A.jsxs)(`div`,{className:H.dbgHeaderRight,children:[y?.paused&&(0,A.jsx)(`button`,{className:H.dbgBtnResume,onClick:ut,disabled:c,children:`▶ Riprendi`}),y&&!y.paused&&(0,A.jsx)(`button`,{className:H.dbgBtnReplay,onClick:ct,disabled:c,title:`Riesegui questa run identica`,children:`🔁 Riesegui`}),y&&g.length>=2&&(0,A.jsx)(`span`,{className:H.dbgDiffPicker,children:(0,A.jsxs)(`select`,{className:H.dbgRunSelect,value:j,onChange:e=>{ae(e.target.value),e.target.value&&dt(e.target.value)},title:`Confronta questa run con una passata per trovare regressioni`,children:[(0,A.jsx)(`option`,{value:``,children:`📊 Diff vs…`}),g.filter(e=>e.ts!==y.ts).map(e=>(0,A.jsxs)(`option`,{value:e.ts,children:[`vs `,e.ts.slice(0,19),` (`,e.stepsCount,` step`,e.hasError?` · err`:``,`)`]},e.ts))]})}),(0,A.jsx)(`button`,{className:H.logClose,onClick:()=>p(!1),children:`✕`})]})]}),y?.paused&&O&&(0,A.jsxs)(`div`,{className:H.dbgWatcher,children:[(0,A.jsxs)(`div`,{className:H.dbgWatcherHeader,children:[(0,A.jsx)(`span`,{className:H.dbgWatcherTitle,children:`👁 Variable Watcher`}),(0,A.jsxs)(`span`,{className:H.dbgWatcherSub,children:[`contesto live al nodo `,(0,A.jsx)(`b`,{children:O.atNodeId}),` · `,`letto `,O.ageMs?`${Math.round(O.ageMs/1e3)}s`:`0s`,` fa`]})]}),(0,A.jsxs)(`div`,{className:H.dbgWatcherBody,children:[(0,A.jsxs)(`div`,{className:H.dbgWatcherRow,children:[(0,A.jsx)(`span`,{className:H.dbgWatcherKey,children:`ctx.input`}),(0,A.jsx)(`pre`,{className:H.dbgWatcherVal,children:typeof O.ctx?.input==`string`?O.ctx.input:JSON.stringify(O.ctx?.input??``,null,2)})]}),(0,A.jsxs)(`div`,{className:H.dbgWatcherRow,children:[(0,A.jsx)(`span`,{className:H.dbgWatcherKey,children:`ctx.output`}),(0,A.jsx)(`pre`,{className:H.dbgWatcherVal,children:typeof O.ctx?.output==`string`?O.ctx.output:JSON.stringify(O.ctx?.output??``,null,2)})]}),O.ctx?.loopItem!==void 0&&O.ctx?.loopItem!==null&&(0,A.jsxs)(`div`,{className:H.dbgWatcherRow,children:[(0,A.jsx)(`span`,{className:H.dbgWatcherKey,children:`ctx.loopItem`}),(0,A.jsx)(`pre`,{className:H.dbgWatcherVal,children:typeof O.ctx.loopItem==`string`?O.ctx.loopItem:JSON.stringify(O.ctx.loopItem,null,2)})]})]}),O.nodeConfig&&Object.keys(O.nodeConfig).length>0&&(0,A.jsxs)(`div`,{className:H.dbgEditConfig,children:[(0,A.jsx)(`div`,{className:H.dbgEditTitle,children:`✏ Modifica config (entrerà in vigore al Riprendi)`}),Object.entries(O.nodeConfig).map(([e,t])=>(0,A.jsxs)(`div`,{className:H.dbgEditRow,children:[(0,A.jsx)(`label`,{className:H.dbgEditLabel,children:e}),(0,A.jsx)(`textarea`,{className:H.dbgEditInput,value:k[e]??String(t),onChange:t=>ie(n=>({...n,[e]:t.target.value})),rows:String(t).length>60?3:1})]},e)),(0,A.jsxs)(`div`,{className:H.dbgEditActions,children:[(0,A.jsx)(`button`,{className:H.dbgBtnResume,disabled:c,onClick:async()=>{n&&(await Je({...n,nodes:n.nodes.map(e=>e.id===O.atNodeId?{...e,config:{...e.config,...k}}:e)}),await ut())},children:`▶ Riprendi con queste modifiche`}),(0,A.jsx)(`button`,{className:H.dbgBtnReplayFrom,onClick:()=>ie({...O.nodeConfig||{}}),children:`↺ Annulla modifiche`})]})]})]}),u.length===0&&(0,A.jsx)(`div`,{className:H.dbgEmpty,children:c?(0,A.jsx)(`span`,{children:`⏳ Sto eseguendo il workflow…`}):(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{style:{marginBottom:8},children:`Nessuna esecuzione ancora.`}),(0,A.jsxs)(`p`,{style:{opacity:.6,fontSize:12},children:[`Premi `,(0,A.jsx)(`b`,{children:`▶ Run`}),` per eseguire il workflow. Il debugger mostrerà ogni passaggio in dettaglio.`]}),(0,A.jsxs)(`p`,{style:{opacity:.5,fontSize:11,marginTop:12},children:[`💡 `,(0,A.jsx)(`b`,{children:`Tip:`}),` click destro su un nodo per mettere un `,(0,A.jsx)(`b`,{children:`breakpoint`}),`. Il workflow si fermerà prima di eseguirlo, e potrai ispezionare il contesto.`]})]})}),u.length>0&&(0,A.jsx)(`div`,{className:H.dbgTimeline,children:u.map((e,t)=>{let n=x===t,r=e.error?H.dbgTlStepErr:e.paused?H.dbgTlStepPaused:H.dbgTlStepOk;return(0,A.jsxs)(`button`,{className:`${H.dbgTlStep} ${r} ${n?H.dbgTlStepActive:``}`,onClick:()=>S(t),title:`${e.nodeLabel} · ${e.durationMs??0}ms${e.error?` · ERRORE: ${e.error}`:``}`,children:[(0,A.jsx)(`span`,{className:H.dbgTlIcon,children:e.nodeIcon}),(0,A.jsx)(`span`,{className:H.dbgTlLabel,children:e.nodeLabel}),typeof e.durationMs==`number`&&(0,A.jsxs)(`span`,{className:H.dbgTlMs,children:[e.durationMs,`ms`]})]},t)})}),u[x]&&(()=>{let e=u[x],t=`${y?.ts??`live`}:${e.nodeId}`,n=C[t],r=[{id:`output`,label:`Output`},{id:`input`,label:`Input`,hide:!e.input},{id:`config`,label:`Config`,hide:!e.nodeConfig||Object.keys(e.nodeConfig).length===0},{id:`error`,label:`Errore`,hide:!e.error}];return(0,A.jsxs)(`div`,{className:H.dbgInspector,children:[(0,A.jsxs)(`div`,{className:H.dbgInspHeader,children:[(0,A.jsx)(`span`,{className:H.dbgInspIcon,children:e.nodeIcon}),(0,A.jsx)(`span`,{className:H.dbgInspLabel,children:e.nodeLabel}),e.paused&&(0,A.jsx)(`span`,{className:H.dbgPausedBadge,children:`⏸ FERMATO QUI`}),e.error&&(0,A.jsx)(`span`,{className:H.logStepErrBadge,children:`ERRORE`}),typeof e.durationMs==`number`&&(0,A.jsxs)(`span`,{className:H.dbgInspDuration,children:[e.durationMs,`ms`]}),(0,A.jsxs)(`span`,{className:H.dbgInspActions,children:[e.error&&(0,A.jsx)(`button`,{className:H.dbgBtnExplain,onClick:()=>ft(e.nodeId),disabled:ee===t,children:ee===t?`🤔 Penso…`:`💡 Spiegami questo errore`}),(0,A.jsx)(`button`,{className:H.dbgBtnReplayFrom,onClick:()=>lt(e.nodeId),disabled:c,title:`Riesegui da questo nodo in giù (riusa output a monte)`,children:`↻ Riesegui da qui`}),(()=>{let t=mt(e.nodeId);return(0,A.jsxs)(`span`,{className:H.dbgBpGroup,children:[(0,A.jsx)(`button`,{className:`${H.dbgBtnBp} ${t?H.dbgBtnBpActive:``}`,onClick:()=>gt(e.nodeId),title:`Breakpoint on/off su questo nodo (click destro sul nodo nel canvas)`,children:t?`● BP attivo`:`○ Breakpoint`}),t&&(0,A.jsx)(`input`,{type:`text`,className:H.dbgBpCondition,placeholder:`condition (es: output.includes('errore'))`,defaultValue:t.condition||``,title:`Espressione JS valutata con (ctx, input, output). Vuoto = break sempre.`,onBlur:n=>{(n.target.value||``)!==(t.condition||``)&&_t(e.nodeId,n.target.value)},onKeyDown:t=>{t.key===`Enter`&&(_t(e.nodeId,t.target.value),t.target.blur())}})]})})()]})]}),n&&(0,A.jsxs)(`div`,{className:H.dbgExplanation,children:[(0,A.jsx)(`span`,{className:H.dbgExplanationIcon,children:`💡`}),(0,A.jsx)(`span`,{className:H.dbgExplanationText,children:n})]}),(0,A.jsx)(`div`,{className:H.dbgTabs,children:r.filter(e=>!e.hide).map(e=>(0,A.jsx)(`button`,{className:`${H.dbgTab} ${te===e.id?H.dbgTabActive:``}`,onClick:()=>ne(e.id),children:e.label},e.id))}),(0,A.jsxs)(`div`,{className:H.dbgTabBody,children:[te===`output`&&(e.output?(0,A.jsx)(`div`,{dangerouslySetInnerHTML:{__html:xe(e.output.slice(0,4e3))}}):(0,A.jsx)(`span`,{className:H.dbgMuted,children:`Nessun output prodotto.`})),te===`input`&&(0,A.jsx)(`pre`,{className:H.dbgPre,children:e.input||`(nessun input)`}),te===`config`&&e.nodeConfig&&(0,A.jsx)(`pre`,{className:H.dbgPre,children:JSON.stringify(e.nodeConfig,null,2)}),te===`error`&&e.error&&(0,A.jsx)(`pre`,{className:`${H.dbgPre} ${H.dbgPreErr}`,children:e.error})]})]})})(),le&&oe&&(0,A.jsx)(`div`,{className:H.dbgDiffOverlay,onClick:()=>ue(!1),children:(0,A.jsxs)(`div`,{className:H.dbgDiffModal,onClick:e=>e.stopPropagation(),children:[(0,A.jsxs)(`div`,{className:H.dbgDiffHeader,children:[(0,A.jsx)(`span`,{className:H.dbgTitle,children:`📊 Confronto run`}),(0,A.jsxs)(`span`,{className:H.dbgStats,children:[(0,A.jsx)(`b`,{style:{color:`#a5b4fc`},children:`A`}),` `,oe.a.ts.slice(0,19),` vs `,(0,A.jsx)(`b`,{style:{color:`#fbbf24`},children:`B`}),` `,oe.b.ts.slice(0,19)]}),(0,A.jsxs)(`span`,{className:H.dbgStats,children:[`✓ `,oe.summary.identical,` identici`,` · `,(0,A.jsxs)(`span`,{style:{color:`#ef4444`},children:[`≠ `,oe.summary.changed,` cambiati`]}),` · `,`+ `,oe.summary.added,` aggiunti`,` · `,`− `,oe.summary.removed,` rimossi`]}),(0,A.jsx)(`button`,{className:H.logClose,onClick:()=>ue(!1),children:`✕`})]}),(0,A.jsx)(`div`,{className:H.dbgDiffBody,children:oe.diff.map((e,t)=>{let n=e.status===`identical`?H.dbgDiffOk:e.status===`changed`?H.dbgDiffChanged:e.status===`added`?H.dbgDiffAdded:H.dbgDiffRemoved;return(0,A.jsxs)(`div`,{className:`${H.dbgDiffRow} ${n}`,children:[(0,A.jsxs)(`div`,{className:H.dbgDiffNodeLabel,children:[e.status===`identical`&&`✓ `,e.status===`changed`&&`≠ `,e.status===`added`&&`+ `,e.status===`removed`&&`− `,e.nodeLabel,typeof e.durationDelta==`number`&&e.durationDelta!==0&&(0,A.jsxs)(`span`,{className:H.dbgDiffDuration,children:[e.durationDelta>0?`+`:``,e.durationDelta,`ms`]})]}),e.status===`changed`&&(0,A.jsxs)(`div`,{className:H.dbgDiffSplit,children:[(0,A.jsxs)(`div`,{className:H.dbgDiffSide,children:[(0,A.jsxs)(`span`,{className:H.dbgDiffSideLabel,children:[`A · `,e.a?.durationMs??0,`ms`]}),(0,A.jsx)(`pre`,{className:H.dbgPre,children:String(e.a?.output??``).slice(0,800)}),e.a?.error&&(0,A.jsx)(`pre`,{className:`${H.dbgPre} ${H.dbgPreErr}`,children:e.a.error})]}),(0,A.jsxs)(`div`,{className:H.dbgDiffSide,children:[(0,A.jsxs)(`span`,{className:H.dbgDiffSideLabel,children:[`B · `,e.b?.durationMs??0,`ms`]}),(0,A.jsx)(`pre`,{className:H.dbgPre,children:String(e.b?.output??``).slice(0,800)}),e.b?.error&&(0,A.jsx)(`pre`,{className:`${H.dbgPre} ${H.dbgPreErr}`,children:e.b.error})]})]}),(e.status===`added`||e.status===`removed`)&&(()=>{let t=e.a||e.b;return(0,A.jsx)(`pre`,{className:H.dbgPre,children:String(t?.output??``).slice(0,800)})})()]},`${e.nodeId}_${t}`)})})]})})]})]}):(0,A.jsxs)(`div`,{className:H.canvasEmpty,children:[(0,A.jsx)(`div`,{className:H.canvasEmptyIcon,children:`🔗`}),(0,A.jsx)(`div`,{className:H.canvasEmptyTitle,children:`Select or create a workflow`}),(0,A.jsxs)(`div`,{className:H.canvasEmptyDesc,children:[`Drag nodes from the right panel onto the canvas.`,(0,A.jsx)(`br`,{}),`Connect them by clicking the `,(0,A.jsx)(`span`,{className:H.portHint,children:`▶`}),` output port then the target node.`,(0,A.jsx)(`br`,{}),`Run with one click — all 80 NHA tools already authenticated.`]}),(0,A.jsx)(`button`,{className:H.newWfBtn,onClick:Ye,children:`+ New Workflow`})]})}),(0,A.jsx)(`div`,{className:H.rightPanel,children:z&&yt&&!He?Yt(z,yt,rt,it,tt,a,H):(0,A.jsxs)(`div`,{className:H.palette,children:[(0,A.jsx)(`div`,{className:H.paletteTitle,children:`Node Palette`}),(0,A.jsx)(`div`,{className:H.paletteTabs,children:[{id:`trigger`,label:`Triggers`,color:`#fbbf24`},{id:`action`,label:`Actions`,color:`#38bdf8`},{id:`ai`,label:`AI`,color:`#a5b4fc`},{id:`logic`,label:`Logic`,color:`#f59e0b`}].map(e=>(0,A.jsx)(`button`,{className:`${H.paletteTab} ${m===e.id?H.paletteTabActive:``}`,style:m===e.id?{borderColor:e.color,color:e.color}:{},onClick:()=>h(e.id),children:e.label},e.id))}),(0,A.jsx)(`div`,{className:H.paletteNodes,children:Ce.filter(e=>e.type===m).map(e=>(0,A.jsxs)(`div`,{className:H.paletteDef,style:{borderColor:e.color+`44`,background:e.color+`14`},draggable:!0,onDragStart:()=>{Ge.current=e.id},onDragEnd:()=>{Ge.current=null},children:[(0,A.jsx)(`span`,{className:H.paletteDefIcon,children:e.icon}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:H.paletteDefLabel,style:{color:e.color},children:e.label}),(0,A.jsx)(`div`,{className:H.paletteDefDesc,children:e.description})]})]},e.id))}),(0,A.jsxs)(`div`,{className:H.paletteGuide,children:[(0,A.jsx)(`div`,{className:H.guideTitle,children:`How to use AWF`}),(0,A.jsxs)(`div`,{className:H.guideStep,children:[(0,A.jsx)(`span`,{className:H.guideNum,children:`1`}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`strong`,{children:`Create`}),` a workflow with "+ New Workflow"`]})]}),(0,A.jsxs)(`div`,{className:H.guideStep,children:[(0,A.jsx)(`span`,{className:H.guideNum,children:`2`}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`strong`,{children:`Drag`}),` a Trigger node (e.g. Manual, Cron) onto the canvas`]})]}),(0,A.jsxs)(`div`,{className:H.guideStep,children:[(0,A.jsx)(`span`,{className:H.guideNum,children:`3`}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`strong`,{children:`Drag`}),` Action or AI nodes to chain operations`]})]}),(0,A.jsxs)(`div`,{className:H.guideStep,children:[(0,A.jsx)(`span`,{className:H.guideNum,children:`4`}),(0,A.jsxs)(`span`,{children:[`Click the `,(0,A.jsx)(`strong`,{style:{color:`var(--green3)`},children:`▶`}),` port on a node then click the next to `,(0,A.jsx)(`strong`,{children:`connect`}),` them`]})]}),(0,A.jsxs)(`div`,{className:H.guideStep,children:[(0,A.jsx)(`span`,{className:H.guideNum,children:`5`}),(0,A.jsxs)(`span`,{children:[(0,A.jsx)(`strong`,{children:`Click`}),` a node to configure it — use `,(0,A.jsx)(`code`,{className:H.guideCode,children:`{{output}}`}),` to pass the previous result`]})]}),(0,A.jsxs)(`div`,{className:H.guideStep,children:[(0,A.jsx)(`span`,{className:H.guideNum,children:`6`}),(0,A.jsxs)(`span`,{children:[`Press `,(0,A.jsx)(`strong`,{children:`▶ Run`}),` to execute · toggle `,(0,A.jsx)(`strong`,{children:`ON`}),` to run automatically (cron/webhook)`]})]}),(0,A.jsxs)(`div`,{className:H.guideTip,children:[(0,A.jsx)(`strong`,{children:`Tip:`}),` Click an edge to delete it. Drag nodes on the canvas to reposition. All 80 NHA tools are pre-authenticated — no extra setup.`]}),(0,A.jsxs)(`div`,{className:H.guideTip,children:[(0,A.jsx)(`strong`,{children:`AI nodes`}),` use Liara (free) by default. They receive `,(0,A.jsx)(`code`,{className:H.guideCode,children:`{{output}}`}),` from the previous step automatically.`]})]})]})})]}),He&&n&&(0,A.jsxs)(`ul`,{className:H.nodeListMobile,children:[n.nodes.map((e,t)=>{let r=we[e.defId];if(!r)return null;let i=n.edges.filter(t=>t.from===e.id);return(0,A.jsxs)(`li`,{children:[(0,A.jsxs)(`div`,{className:H.nodeRow,onClick:()=>a(e.id),role:`button`,tabIndex:0,children:[(0,A.jsx)(`span`,{className:H.nodeRowIndex,children:t+1}),(0,A.jsx)(`span`,{className:H.nodeRowIcon,style:{color:r.color},children:r.icon}),(0,A.jsxs)(`div`,{className:H.nodeRowBody,children:[(0,A.jsx)(`div`,{className:H.nodeRowLabel,children:r.label}),(0,A.jsx)(`div`,{className:H.nodeRowDesc,children:r.description})]})]}),i.length>1&&r.outputs&&(0,A.jsx)(`div`,{className:H.nodeRowBranch,children:i.map((e,t)=>{let i=n.nodes.find(t=>t.id===e.to),a=i?we[i.defId]:null;return(0,A.jsxs)(`div`,{children:[`↳ `,e.label||(r.outputs?.[t]??``),` → `,a?.icon,` `,a?.label??`?`]},t)})})]},e.id)}),n.nodes.length===0&&(0,A.jsx)(`li`,{className:H.nodeRow,style:{justifyContent:`center`,color:`var(--dim)`},children:`Nessun nodo. Aggiungi triggers/actions dalla palette (apri il browser per editare).`})]}),He&&n&&n.nodes.length>0&&(0,A.jsx)(`button`,{className:H.runFab,onClick:at,disabled:c,"aria-label":`Run workflow`,title:`Esegui workflow`,children:c?`⏳`:`▶`}),He&&(0,A.jsx)(Vt,{open:!!(z&&yt),onClose:()=>a(null),className:H.configSheet,handleClassName:H.configSheetHandle,ariaLabel:`Node configuration`,children:z&&yt&&Yt(z,yt,rt,it,tt,a,H)})]})}function Yt(e,t,n,r,i,a,o){return(0,A.jsxs)(`div`,{className:o.configPanel,children:[(0,A.jsxs)(`div`,{className:o.configHeader,children:[(0,A.jsxs)(`span`,{style:{color:t.color},children:[t.icon,` `,t.label]}),(0,A.jsx)(`button`,{className:o.configClose,onClick:()=>a(null),children:`✕`})]}),(0,A.jsx)(`div`,{className:o.configDesc,children:t.description}),(0,A.jsx)(`div`,{className:o.configFields,children:(t.configFields??[]).map(t=>(0,A.jsxs)(`div`,{className:o.configField,children:[(0,A.jsxs)(`label`,{className:o.configLabel,children:[t.label,t.required&&(0,A.jsx)(`span`,{className:o.configRequired,children:`*`})]}),t.type===`textarea`?(0,A.jsx)(`textarea`,{className:o.configTextarea,value:e.config[t.key]??``,placeholder:t.placeholder??``,onChange:r=>n(e.id,t.key,r.target.value),onBlur:r,rows:4}):t.type===`select`&&t.options?(0,A.jsx)(`select`,{className:o.configInput,value:e.config[t.key]??t.options[0]??``,onChange:i=>{n(e.id,t.key,i.target.value),r()},children:t.options.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))}):(0,A.jsx)(`input`,{className:o.configInput,value:e.config[t.key]??``,placeholder:t.placeholder??``,onChange:r=>n(e.id,t.key,r.target.value),onBlur:r}),(t.placeholder?.includes(`{{`)??!1)&&(0,A.jsxs)(`div`,{className:o.configHint,children:[`Use `,(0,A.jsx)(`code`,{children:`{{output}}`}),` to pass previous node result`]})]},t.key))}),(0,A.jsx)(`button`,{className:o.configDelete,onClick:()=>i(e.id),children:`Delete node`})]})}var U={root:`_root_ohib4_1`,sidebar:`_sidebar_ohib4_12`,sidebarSection:`_sidebarSection_ohib4_23`,sidebarLabel:`_sidebarLabel_ohib4_28`,accountSelect:`_accountSelect_ohib4_36`,sidebarCompose:`_sidebarCompose_ohib4_46`,composeBtn:`_composeBtn_ohib4_51`,folderList:`_folderList_ohib4_63`,folderItem:`_folderItem_ohib4_69`,folderActive:`_folderActive_ohib4_82`,badge:`_badge_ohib4_88`,labelHeader:`_labelHeader_ohib4_103`,addLabelBtn:`_addLabelBtn_ohib4_114`,newLabelRow:`_newLabelRow_ohib4_123`,newLabelInput:`_newLabelInput_ohib4_129`,newLabelSave:`_newLabelSave_ohib4_139`,labelDot:`_labelDot_ohib4_150`,syncArea:`_syncArea_ohib4_158`,syncBtn:`_syncBtn_ohib4_166`,refreshSelect:`_refreshSelect_ohib4_186`,refreshCountdown:`_refreshCountdown_ohib4_206`,messageList:`_messageList_ohib4_217`,listHeader:`_listHeader_ohib4_227`,searchInput:`_searchInput_ohib4_236`,searchBtn:`_searchBtn_ohib4_246`,listBody:`_listBody_ohib4_256`,listLoading:`_listLoading_ohib4_261`,noMessages:`_noMessages_ohib4_266`,msgRow:`_msgRow_ohib4_273`,msgUnread:`_msgUnread_ohib4_284`,msgActive:`_msgActive_ohib4_289`,msgTop:`_msgTop_ohib4_293`,msgFrom:`_msgFrom_ohib4_299`,msgDate:`_msgDate_ohib4_312`,msgSubject:`_msgSubject_ohib4_319`,msgPreview:`_msgPreview_ohib4_331`,listFooter:`_listFooter_ohib4_342`,loadMoreBtn:`_loadMoreBtn_ohib4_353`,pane:`_pane_ohib4_364`,emptyPane:`_emptyPane_ohib4_372`,readingPane:`_readingPane_ohib4_379`,paneToolbar:`_paneToolbar_ohib4_386`,paneActions:`_paneActions_ohib4_396`,replyBtn:`_replyBtn_ohib4_402`,fwdBtn:`_fwdBtn_ohib4_413`,trashBtn:`_trashBtn_ohib4_413`,starBtn:`_starBtn_ohib4_413`,aiBtn:`_aiBtn_ohib4_426`,labelSelect:`_labelSelect_ohib4_436`,paneHeader:`_paneHeader_ohib4_445`,paneSubject:`_paneSubject_ohib4_451`,paneMeta:`_paneMeta_ohib4_458`,attachments:`_attachments_ohib4_466`,attachLink:`_attachLink_ohib4_473`,paneBody:`_paneBody_ohib4_483`,bodyFrame:`_bodyFrame_ohib4_489`,bodyText:`_bodyText_ohib4_497`,composePane:`_composePane_ohib4_507`,composeTitle:`_composeTitle_ohib4_516`,composeField:`_composeField_ohib4_525`,templateRow:`_templateRow_ohib4_537`,templateToggle:`_templateToggle_ohib4_542`,templateDrop:`_templateDrop_ohib4_552`,templateItem:`_templateItem_ohib4_566`,templateSubject:`_templateSubject_ohib4_576`,composeBody:`_composeBody_ohib4_582`,composeActions:`_composeActions_ohib4_598`,sendBtn:`_sendBtn_ohib4_605`,cancelBtn:`_cancelBtn_ohib4_616`,compStatus:`_compStatus_ohib4_626`,ok:`_ok_ohib4_627`,err:`_err_ohib4_628`},Xt=[{id:`INBOX`,name:`Inbox`,icon:`✉`},{id:`SENT`,name:`Sent`,icon:`→`},{id:`DRAFTS`,name:`Drafts`,icon:`📄`},{id:`SPAM`,name:`Spam`,icon:`🛡`},{id:`TRASH`,name:`Trash`,icon:`🗑`}],Zt=[{name:`Product Promo`,subject:`Discover our offer on [PRODUCT]`},{name:`Monthly Newsletter`,subject:`[COMPANY] Newsletter — [MONTH] [YEAR]`},{name:`Commercial Follow-up`,subject:`Following our conversation — [TOPIC]`},{name:`Offer / Quote`,subject:`Offer [NUMBER] — [SUBJECT]`},{name:`Event Invitation`,subject:`You are invited: [EVENT NAME] — [DATE]`},{name:`Customer Thank You`,subject:`Thank you for your trust, [NAME]`}];function Qt(e){return e?e.slice(0,10):``}function $t(e){if(!e)return``;try{let t=typeof e==`string`?JSON.parse(e):e;return Array.isArray(t)?t.map(e=>e.name?`${e.name} <${e.address}>`:e.address||``).join(`, `):String(e)}catch{return String(e)}}function en(){let e=M(),t=te(e=>e.setView),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(`google`),[u,d]=(0,_.useState)([]),[f,p]=(0,_.useState)(`INBOX`),[m,h]=(0,_.useState)([]),[g,v]=(0,_.useState)(0),[y,b]=(0,_.useState)(0),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),[ee,T]=(0,_.useState)(!1),[ne,O]=(0,_.useState)(!1),[re,k]=(0,_.useState)(``),[ie,j]=(0,_.useState)(``),[ae,oe]=(0,_.useState)(0),[se,ce]=(0,_.useState)(!1),[le,ue]=(0,_.useState)({}),[N,de]=(0,_.useState)(``),[fe,pe]=(0,_.useState)(``),[me,he]=(0,_.useState)(``),[ge,_e]=(0,_.useState)(``),[ve,ye]=(0,_.useState)(``),[be,xe]=(0,_.useState)(!1),[P,Se]=(0,_.useState)(``),[Ce,we]=(0,_.useState)(!1),Te=(0,_.useRef)(null),F=(0,_.useRef)(0),Ee=[{sec:0,label:`Off`},{sec:300,label:`Ogni 5 min`},{sec:600,label:`Ogni 10 min`},{sec:900,label:`Ogni 15 min`},{sec:1800,label:`Ogni 30 min`},{sec:3600,label:`Ogni 1 h`}],[De,Oe]=(0,_.useState)(()=>{let e=parseInt(localStorage.getItem(`nha-email-refresh-sec`)||`600`,10);return Number.isFinite(e)?e:600}),[I,L]=(0,_.useState)(!1),[ke,Ae]=(0,_.useState)(null),[je,Me]=(0,_.useState)(null),[Ne,Pe]=(0,_.useState)(Date.now()),Fe=(0,_.useRef)(!1),Ie=e=>{Oe(e),localStorage.setItem(`nha-email-refresh-sec`,String(e))},Le=async()=>{if(!Fe.current&&o){Fe.current=!0,L(!0);try{c===`imap`?(await D(`/api/imap/sync/${o}`,{}).catch(()=>{}),o&&ze(o,f,0,re)):c===`google`&&Be(f||`INBOX`,re),Ae(Date.now())}finally{Fe.current=!1,L(!1)}}};(0,_.useEffect)(()=>{if(!De||!o){Me(null);return}Me(Date.now()+De*1e3);let e=setInterval(()=>{document.visibilityState!==`hidden`&&(Le(),Me(Date.now()+De*1e3))},De*1e3);return()=>clearInterval(e)},[De,o,c,f]),(0,_.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&(!De||!o||(ke?Date.now()-ke:1/0)>=De*1e3&&(Le(),Me(Date.now()+De*1e3)))};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[De,o,ke]),(0,_.useEffect)(()=>{if(!je)return;let e=setInterval(()=>Pe(Date.now()),1e3);return()=>clearInterval(e)},[je]);let Re=(()=>{if(!je||!De)return null;let e=Math.max(0,Math.round((je-Ne)/1e3));return`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`})();(0,_.useEffect)(()=>{E(`/api/config`).then(e=>r(!!e?.hasGoogle)),E(`/api/imap/accounts`).then(e=>{let t=(e?.accounts??[]).filter(e=>e.id!==`google`);a(t);let n=localStorage.getItem(`nha-email-account-type`),r=localStorage.getItem(`nha-email-account-id`);n===`google`?R(`google`,`google`):n===`imap`&&r&&t.some(e=>e.id===r)?R(r,`imap`):t.length>0?R(t[0].id,`imap`):R(`google`,`google`)})},[]);let R=(e,t)=>{s(e),l(t),p(t===`google`?`INBOX`:null),localStorage.setItem(`nha-email-account-type`,t),localStorage.setItem(`nha-email-account-id`,e),h([]),b(0),S(null),w(null),t===`imap`?E(`/api/imap/labels?accountId=${e}`).then(t=>{let n=t?.labels??[];d(n);let r=n.find(e=>e.system_type===`inbox`)?.id??null;p(r),ze(e,r,0,``)}):(d([]),Be(`INBOX`,``))},ze=(e,t,n,r)=>{let i=++F.current;T(!0);let a=`/api/imap/messages?accountId=${encodeURIComponent(e)}&limit=50&offset=${n}`;t&&(a+=`&labelId=${encodeURIComponent(t)}`),r&&(a+=`&search=${encodeURIComponent(r)}`),E(a).then(e=>{i===F.current&&(h(n===0?e?.messages??[]:t=>[...t,...e?.messages??[]]),v(e?.total??0),T(!1))}).catch(()=>{i===F.current&&T(!1)})},Be=(e,t)=>{T(!0);let n=e||`INBOX`;E(`/api/emails?folder=${encodeURIComponent(n)}&page=0&pageSize=50${t?`&search=${encodeURIComponent(t)}`:``}`).then(e=>{if(e?.authRequired){h([]),v(0),T(!1);return}let t=e?.emails??[];if(t.length>0){let e=t.map(e=>({id:e.id,subject:e.subject,from_name:e.from,from_address:e.from,internal_date:e.date,body_preview:e.snippet,is_read:!e.isUnread,is_starred:!1,has_attachments:!1,_google:!0}));h(e),v(e.length),n===`INBOX`&&oe(e.filter(e=>!e.is_read).length)}else h([]),v(0);T(!1)}).catch(()=>{h([]),T(!1)})},Ve=()=>{k(ie),b(0),h([]),c===`imap`&&o?ze(o,f,0,ie):Be(f||`INBOX`,ie)},He=e=>{S(e),ce(!1),O(!0),c===`google`?E(`/api/imap/message?id=${encodeURIComponent(e)}`).then(t=>{t?.message&&(t.message.body_text||t.message.body_html)?(w({...t.message,id:e,_google:!0}),h(t=>t.map(t=>t.id===e?{...t,is_read:!0}:t)),O(!1)):D(`/api/email/read`,{messageId:e}).then(t=>{if(t?.message){let n=t.message;w({...t.message,body_text:n.body||n.body_text,body_html:n.body_html,from_address:n.from||n.from_address,id:e,_google:!0}),h(t=>t.map(t=>t.id===e?{...t,is_read:!0}:t)),D(`/api/email/mark-read`,{messageId:e}).catch(()=>{})}O(!1)}).catch(()=>O(!1))}).catch(()=>O(!1)):E(`/api/imap/message?id=${encodeURIComponent(e)}`).then(t=>{w(t?.message??null),h(t=>t.map(t=>t.id===e?{...t,is_read:!0}:t)),O(!1)}).catch(()=>O(!1))},Ue=(e={})=>{ce(!0),ue(e),de(e.to??``),pe(``),he(e.subject??``),_e(e.type===`forward`&&e.body?`\n\n---------- Forwarded message ----------\n${e.body}`:``),ye(``),xe(!1),S(null),w(null)},We=async()=>{if(!N.trim()){ye(`Recipient required`);return}ye(`Sending…`);try{if(c===`imap`&&o){let e=await D(`/api/imap/send`,{accountId:o,to:N.trim(),cc:fe.trim()||void 0,subject:me.trim(),bodyHtml:ge.replace(/\n/g,`<br>`),bodyText:ge,inReplyTo:le.inReplyTo||void 0});e?.ok?(ye(`Sent!`),setTimeout(()=>ce(!1),800)):ye(e?.error??`Error`)}else{let e=await D(`/api/email/send`,{to:N.trim(),subject:me.trim(),body:ge});e?.ok||e?.id?(ye(`Sent!`),setTimeout(()=>ce(!1),800)):ye(e?.error??`Error`)}}catch(e){ye(e.message??`Error`)}},Ge=e=>{confirm(`Move to trash? Email stays on the server.`)&&D(`/api/imap/trash`,{messageId:e}).then(()=>{h(t=>t.filter(t=>t.id!==e)),w(null),S(null)})},Ke=(e,t)=>{D(`/api/imap/mark-starred`,{messageId:e,isStarred:t}).then(()=>{C?.id===e&&w(e=>e&&{...e,is_starred:t})})},qe=(e,t)=>{t&&D(`/api/imap/labels/assign`,{messageId:e,labelId:t})},Je=()=>{!P.trim()||!o||D(`/api/imap/labels`,{accountId:o,name:P.trim()}).then(()=>{we(!1),Se(``),E(`/api/imap/labels?accountId=${o}`).then(e=>d(e?.labels??[]))})},Ye=()=>{if(c===`google`){T(!0);let e=f||`INBOX`,t=m.length+50;E(`/api/emails?folder=${encodeURIComponent(e)}&page=0&pageSize=${t}`).then(e=>{let t=(e?.emails??[]).map(e=>({id:e.id,subject:e.subject,from_name:e.from,from_address:e.from,internal_date:e.date,body_preview:e.snippet,is_read:!e.isUnread,is_starred:!1,has_attachments:!1,_google:!0}));h(t),v(t.length),T(!1)}).catch(()=>T(!1))}else{let e=y+50;b(e),o&&ze(o,f,e,re)}};return(0,A.jsxs)(`div`,{className:U.root,children:[(0,A.jsxs)(`div`,{className:U.sidebar,children:[(0,A.jsxs)(`div`,{className:U.sidebarSection,children:[(0,A.jsx)(`div`,{className:U.sidebarLabel,children:`Account`}),(0,A.jsxs)(`select`,{className:U.accountSelect,value:c===`google`?`google`:`imap:${o}`,onChange:e=>{let t=e.target.value;t===`google`?R(`google`,`google`):t.startsWith(`imap:`)&&R(t.slice(5),`imap`)},children:[n&&(0,A.jsx)(`option`,{value:`google`,children:`Google (Gmail)`}),i.map(e=>(0,A.jsx)(`option`,{value:`imap:${e.id}`,children:e.display_name||e.email_address},e.id)),!n&&i.length===0&&(0,A.jsx)(`option`,{value:``,children:`No accounts — add in Settings`})]})]}),(0,A.jsx)(`div`,{className:U.sidebarCompose,children:(0,A.jsx)(`button`,{className:U.composeBtn,onClick:()=>Ue(),children:`+ Compose`})}),(0,A.jsx)(`div`,{className:U.folderList,children:c===`google`?Xt.map(e=>(0,A.jsxs)(`div`,{className:`${U.folderItem} ${f===e.id?U.folderActive:``}`,onClick:()=>{p(e.id),h([]),b(0),Be(e.id,re)},children:[(0,A.jsx)(`span`,{children:e.icon}),(0,A.jsx)(`span`,{children:e.name}),e.id===`INBOX`&&ae>0&&(0,A.jsx)(`span`,{className:U.badge,children:ae})]},e.id)):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:U.labelHeader,children:[(0,A.jsx)(`span`,{children:`Labels`}),(0,A.jsx)(`button`,{className:U.addLabelBtn,onClick:()=>we(e=>!e),children:`+`})]}),Ce&&(0,A.jsxs)(`div`,{className:U.newLabelRow,children:[(0,A.jsx)(`input`,{className:U.newLabelInput,value:P,onChange:e=>Se(e.target.value),placeholder:`Label name`,onKeyDown:e=>e.key===`Enter`&&Je()}),(0,A.jsx)(`button`,{className:U.newLabelSave,onClick:Je,children:`+`})]}),u.map(e=>(0,A.jsxs)(`div`,{className:`${U.folderItem} ${f===e.id?U.folderActive:``}`,onClick:()=>{p(e.id),h([]),b(0),o&&ze(o,e.id,0,re)},children:[(0,A.jsx)(`span`,{className:U.labelDot,style:{background:e.color??`var(--dim)`}}),(0,A.jsx)(`span`,{children:e.name}),e.system_type===`inbox`&&e.unread_count?(0,A.jsx)(`span`,{className:U.badge,children:e.unread_count}):null]},e.id))]})}),o&&(0,A.jsxs)(`div`,{className:U.syncArea,children:[(0,A.jsx)(`button`,{className:U.syncBtn,onClick:Le,disabled:I,title:ke?`Ultimo sync: ${new Date(ke).toLocaleTimeString()}`:`Mai sincronizzato`,children:I?`⟳ Sync…`:`Sync ora`}),(0,A.jsx)(`select`,{className:U.refreshSelect,value:De,onChange:e=>Ie(parseInt(e.target.value,10)),title:`Intervallo di aggiornamento automatico`,children:Ee.map(e=>(0,A.jsx)(`option`,{value:e.sec,children:e.label},e.sec))}),Re&&(0,A.jsxs)(`span`,{className:U.refreshCountdown,title:`Prossimo refresh tra`,children:[`⏱ `,Re]})]})]}),(0,A.jsxs)(`div`,{className:U.messageList,children:[(0,A.jsxs)(`div`,{className:U.listHeader,children:[(0,A.jsx)(`input`,{className:U.searchInput,value:ie,onChange:e=>j(e.target.value),placeholder:`Search…`,onKeyDown:e=>e.key===`Enter`&&Ve()}),(0,A.jsx)(`button`,{className:U.searchBtn,onClick:Ve,children:`Go`})]}),(0,A.jsxs)(`div`,{className:U.listBody,children:[ee&&(0,A.jsx)(`div`,{className:U.listLoading,children:(0,A.jsx)(`div`,{className:`spinner`})}),!ee&&m.length===0&&(0,A.jsx)(`div`,{className:U.noMessages,children:`No messages`}),m.map(e=>(0,A.jsxs)(`div`,{className:`${U.msgRow} ${e.id===x?U.msgActive:``} ${e.is_read?``:U.msgUnread}`,onClick:()=>He(e.id),children:[(0,A.jsxs)(`div`,{className:U.msgTop,children:[(0,A.jsx)(`span`,{className:U.msgFrom,children:e.from_name||e.from_address||``}),(0,A.jsx)(`span`,{className:U.msgDate,children:Qt(e.internal_date)})]}),(0,A.jsx)(`div`,{className:U.msgSubject,children:e.subject||`(no subject)`}),(0,A.jsx)(`div`,{className:U.msgPreview,children:(e.body_preview||``).slice(0,80)})]},e.id))]}),(0,A.jsxs)(`div`,{className:U.listFooter,children:[(0,A.jsxs)(`span`,{children:[g,` messages`]}),c===`imap`&&m.length<g&&(0,A.jsx)(`button`,{className:U.loadMoreBtn,onClick:Ye,children:`Load more`}),c===`google`&&m.length>=50&&(0,A.jsx)(`button`,{className:U.loadMoreBtn,onClick:Ye,disabled:ee,children:ee?`Loading...`:`Scarica altre`})]})]}),(0,A.jsx)(`div`,{className:U.pane,children:(()=>{if(se)return(0,A.jsxs)(`div`,{className:U.composePane,children:[(0,A.jsx)(`div`,{className:U.composeTitle,children:e(`email.compose`)}),(0,A.jsx)(`input`,{className:U.composeField,value:N,onChange:e=>de(e.target.value),placeholder:`To`}),(0,A.jsx)(`input`,{className:U.composeField,value:fe,onChange:e=>pe(e.target.value),placeholder:`Cc`}),(0,A.jsx)(`input`,{className:U.composeField,value:me,onChange:e=>he(e.target.value),placeholder:`Subject`}),(0,A.jsxs)(`div`,{className:U.templateRow,children:[(0,A.jsx)(`button`,{className:U.templateToggle,onClick:()=>xe(e=>!e),children:`📄 Templates`}),be&&(0,A.jsx)(`div`,{className:U.templateDrop,children:Zt.map((e,t)=>(0,A.jsxs)(`div`,{className:U.templateItem,onClick:()=>{he(t=>t||e.subject),xe(!1)},children:[(0,A.jsx)(`strong`,{children:e.name}),(0,A.jsx)(`div`,{className:U.templateSubject,children:e.subject})]},t))})]}),(0,A.jsx)(`textarea`,{className:U.composeBody,value:ge,onChange:e=>_e(e.target.value),placeholder:`Write your message…`}),(0,A.jsxs)(`div`,{className:U.composeActions,children:[(0,A.jsx)(`button`,{className:U.sendBtn,onClick:We,children:e(`email.send_ok`)}),(0,A.jsx)(`button`,{className:U.cancelBtn,onClick:()=>ce(!1),children:`Discard`}),ve&&(0,A.jsx)(`span`,{className:`${U.compStatus} ${ve===`Sent!`?U.ok:U.err}`,children:ve})]})]});if(ne)return(0,A.jsx)(`div`,{className:U.emptyPane,children:(0,A.jsx)(`div`,{className:`spinner`})});if(!C)return(0,A.jsx)(`div`,{className:U.emptyPane,children:`Select a message`});let n=$t(C.to_addresses);return(0,A.jsxs)(`div`,{className:U.readingPane,children:[(0,A.jsx)(`div`,{className:U.paneToolbar,children:(0,A.jsxs)(`div`,{className:U.paneActions,children:[(0,A.jsx)(`button`,{className:U.replyBtn,onClick:()=>Ue({to:C.from_address,subject:`Re: ${C.subject??``}`,inReplyTo:C.message_id??C.id,replyTo:C.id,type:`reply`}),children:e(`email.reply`)}),(0,A.jsx)(`button`,{className:U.fwdBtn,onClick:()=>Ue({subject:`Fwd: ${C.subject??``}`,type:`forward`,body:C.body_text??C.body_preview??``}),children:`Forward`}),!C._google&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`button`,{className:U.trashBtn,onClick:()=>Ge(C.id),children:`🗑`}),(0,A.jsx)(`button`,{className:U.starBtn,onClick:()=>Ke(C.id,!C.is_starred),children:C.is_starred?`★`:`☆`}),u.length>0&&(0,A.jsxs)(`select`,{className:U.labelSelect,defaultValue:``,onChange:e=>qe(C.id,e.target.value),children:[(0,A.jsx)(`option`,{value:``,children:`+ Label`}),u.map(e=>(0,A.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,A.jsx)(`button`,{className:U.aiBtn,onClick:()=>t(`chat`),children:`Ask AI`})]})}),(0,A.jsxs)(`div`,{className:U.paneHeader,children:[(0,A.jsx)(`div`,{className:U.paneSubject,children:C.subject||`(no subject)`}),(0,A.jsxs)(`div`,{className:U.paneMeta,children:[(0,A.jsx)(`strong`,{children:`From:`}),` `,C.from_name&&C.from_name!==C.from_address?`${C.from_name} <${C.from_address}>`:C.from_address]}),(0,A.jsxs)(`div`,{className:U.paneMeta,children:[(0,A.jsx)(`strong`,{children:`To:`}),` `,n]}),(0,A.jsxs)(`div`,{className:U.paneMeta,children:[(0,A.jsx)(`strong`,{children:`Date:`}),` `,C.internal_date]}),C.attachments&&C.attachments.length>0&&(0,A.jsx)(`div`,{className:U.attachments,children:C.attachments.map((e,t)=>(0,A.jsxs)(`a`,{className:U.attachLink,href:`/api/imap/attachment?messageId=${encodeURIComponent(C.id)}&partId=${encodeURIComponent(e.part_id??``)}&accountId=${encodeURIComponent(o??``)}`,download:e.filename??`attachment`,children:[`📎 `,e.filename??`attachment`,` (`,Math.round((e.size_bytes??0)/1024),`KB)`]},t))})]}),(0,A.jsx)(`div`,{className:U.paneBody,children:C.body_html?(0,A.jsx)(`iframe`,{ref:Te,sandbox:`allow-same-origin allow-popups`,className:U.bodyFrame,srcDoc:C.body_html.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,``),title:`Email body`}):(0,A.jsx)(`pre`,{className:U.bodyText,children:C.body_text??C.body_preview??`(empty)`})})]})})()})]})}var W={root:`_root_7ur7d_1`,center:`_center_7ur7d_9`,noGoogle:`_noGoogle_7ur7d_16`,noGoogleIcon:`_noGoogleIcon_7ur7d_25`,noGoogleTitle:`_noGoogleTitle_7ur7d_26`,noGoogleSub:`_noGoogleSub_7ur7d_27`,connectBtn:`_connectBtn_7ur7d_29`,calCol:`_calCol_7ur7d_41`,navRow:`_navRow_7ur7d_49`,navBtn:`_navBtn_7ur7d_57`,monthTitle:`_monthTitle_7ur7d_70`,dayHeaders:`_dayHeaders_7ur7d_78`,dayHeader:`_dayHeader_7ur7d_78`,weekend:`_weekend_7ur7d_94`,grid:`_grid_7ur7d_96`,cell:`_cell_7ur7d_105`,emptyCell:`_emptyCell_7ur7d_119`,weekendCell:`_weekendCell_7ur7d_121`,todayCell:`_todayCell_7ur7d_122`,activeCell:`_activeCell_7ur7d_123`,hasEvtsCell:`_hasEvtsCell_7ur7d_124`,holidayCell:`_holidayCell_7ur7d_125`,dayNum:`_dayNum_7ur7d_127`,todayNum:`_todayNum_7ur7d_134`,weekendNum:`_weekendNum_7ur7d_135`,evtPills:`_evtPills_7ur7d_137`,evtPill:`_evtPill_7ur7d_137`,holidayPill:`_holidayPill_7ur7d_158`,morePill:`_morePill_7ur7d_160`,loadingBar:`_loadingBar_7ur7d_166`,detailCol:`_detailCol_7ur7d_175`,detailHeader:`_detailHeader_7ur7d_187`,detailDate:`_detailDate_7ur7d_197`,addEvtBtn:`_addEvtBtn_7ur7d_203`,noEvts:`_noEvts_7ur7d_218`,selectDay:`_selectDay_7ur7d_225`,evtCard:`_evtCard_7ur7d_233`,evtTop:`_evtTop_7ur7d_246`,evtTime:`_evtTime_7ur7d_253`,evtBtns:`_evtBtns_7ur7d_259`,editBtn:`_editBtn_7ur7d_265`,delBtn:`_delBtn_7ur7d_278`,readOnly:`_readOnly_7ur7d_291`,evtTitle:`_evtTitle_7ur7d_300`,evtLoc:`_evtLoc_7ur7d_306`,evtMeta:`_evtMeta_7ur7d_307`,attendees:`_attendees_7ur7d_309`,attendee:`_attendee_7ur7d_309`,evtDesc:`_evtDesc_7ur7d_320`,joinBtn:`_joinBtn_7ur7d_330`,gcalLink:`_gcalLink_7ur7d_337`,overlay:`_overlay_7ur7d_344`,formCard:`_formCard_7ur7d_354`,formTitle:`_formTitle_7ur7d_368`,formLabel:`_formLabel_7ur7d_375`,formInput:`_formInput_7ur7d_381`,formTextarea:`_formTextarea_7ur7d_394`,formError:`_formError_7ur7d_410`,formBtns:`_formBtns_7ur7d_415`,cancelFormBtn:`_cancelFormBtn_7ur7d_422`,saveFormBtn:`_saveFormBtn_7ur7d_432`};function tn(e,t,n){return`${e}-${String(t+1).padStart(2,`0`)}-${String(n).padStart(2,`0`)}`}function nn(e,t,n){let r=new Date;return r.getFullYear()===e&&r.getMonth()===t&&r.getDate()===n}function rn(e){if(!e)return``;let t=new Date(e);return isNaN(t.getTime())?e.slice(11,16):t.toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`})}function an(){let e=M(),t=te(e=>e.setView),[n,r]=(0,_.useState)(null),i=new Date,[a,o]=(0,_.useState)(i.getFullYear()),[s,c]=(0,_.useState)(i.getMonth()),[l,u]=(0,_.useState)({}),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(!1);(0,_.useEffect)(()=>{E(`/api/config`).then(e=>r(!!e?.hasGoogle))},[]);let S=(0,_.useCallback)((e,t)=>{let n=`${e}-${String(t+1).padStart(2,`0`)}`;f(!0),E(`/api/calendar?month=${n}`).then(e=>{e?.byDate&&u(t=>({...t,...e.byDate})),f(!1)}).catch(()=>f(!1))},[]);(0,_.useEffect)(()=>{n&&S(a,s)},[n,a,s,S]);let C=e=>{E(`/api/calendar?date=${e}`).then(t=>{u(n=>({...n,[e]:t?.events??[]}))})},w=(e,t,n)=>{confirm(`Delete this event?`)&&D(`/api/calendar/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{},`DELETE`).then(()=>C(n))},ee=e=>{g({title:``,start:`${e}T09:00`,end:`${e}T10:00`,location:``,description:``,isEdit:!1}),y(``)},T=(e,t)=>{let n=e.start?e.start.slice(0,16):`${t}T09:00`,r=e.end?e.end.slice(0,16):`${t}T10:00`;g({id:e.id,calId:e.calendarId??`primary`,title:e.summary,start:n,end:r,location:e.location??``,description:e.description??``,isEdit:!0}),y(``)},ne=async()=>{if(h){if(!h.title.trim()){y(`Title is required`);return}x(!0);try{if(h.isEdit&&h.id){let e=h.calId??`primary`;await D(`/api/calendar/${encodeURIComponent(e)}/${encodeURIComponent(h.id)}`,{summary:h.title,start:h.start,end:h.end,location:h.location||void 0,description:h.description||void 0},`PATCH`)}else{let e=h.start.split(`T`)[0];await D(`/api/calendar`,{summary:h.title,start:h.start,end:h.end,location:h.location||void 0,description:h.description||void 0,date:e})}let e=h.start.split(`T`)[0];C(e),g(null)}catch(e){y(`Error: `+(e.message??`Unknown`))}finally{x(!1)}}};if(n===null)return(0,A.jsx)(`div`,{className:W.center,children:(0,A.jsx)(`div`,{className:`spinner`})});if(!n)return(0,A.jsx)(`div`,{className:W.center,children:(0,A.jsxs)(`div`,{className:W.noGoogle,children:[(0,A.jsx)(`div`,{className:W.noGoogleIcon,children:`📅`}),(0,A.jsx)(`div`,{className:W.noGoogleTitle,children:`Calendar`}),(0,A.jsx)(`div`,{className:W.noGoogleSub,children:`Connect your Google account to view and manage calendar events.`}),(0,A.jsx)(`button`,{className:W.connectBtn,onClick:()=>t(`settings`),children:`Connect Google →`})]})});let O=new Date(a,s,1).getDay(),re=new Date(a,s+1,0).getDate(),k=new Date(a,s,1).toLocaleDateString(`en`,{month:`long`,year:`numeric`}),ie=(O+6)%7,j=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],ae=p?l[p]??[]:[];return(0,A.jsxs)(`div`,{className:W.root,children:[(0,A.jsxs)(`div`,{className:W.calCol,children:[(0,A.jsxs)(`div`,{className:W.navRow,children:[(0,A.jsx)(`button`,{className:W.navBtn,onClick:()=>{let e=s-1;e<0?(o(e=>e-1),c(11)):c(e)},children:`←`}),(0,A.jsx)(`div`,{className:W.monthTitle,children:k}),(0,A.jsx)(`button`,{className:W.navBtn,onClick:()=>{let e=s+1;e>11?(o(e=>e+1),c(0)):c(e)},children:`→`})]}),(0,A.jsx)(`div`,{className:W.dayHeaders,children:j.map((e,t)=>(0,A.jsx)(`div`,{className:`${W.dayHeader} ${t>=5?W.weekend:``}`,children:e},e))}),(0,A.jsxs)(`div`,{className:W.grid,children:[Array.from({length:ie}).map((e,t)=>(0,A.jsx)(`div`,{className:`${W.cell} ${W.emptyCell} ${t>=5?W.weekendCell:``}`},`e${t}`)),Array.from({length:re}).map((e,t)=>{let n=t+1,r=tn(a,s,n),i=nn(a,s,n),o=l[r]??[],c=o.length,u=(ie+n-1)%7>=5,d=o.some(e=>e._isHoliday||e.readOnly),f=p===r;return(0,A.jsxs)(`div`,{className:`${W.cell} ${i?W.todayCell:u?W.weekendCell:``} ${f?W.activeCell:``} ${d?W.holidayCell:c>0?W.hasEvtsCell:``}`,onClick:()=>m(r),children:[(0,A.jsx)(`div`,{className:`${W.dayNum} ${i?W.todayNum:u?W.weekendNum:``}`,children:n}),c>0&&(0,A.jsxs)(`div`,{className:W.evtPills,children:[o.slice(0,2).map((e,t)=>(0,A.jsx)(`div`,{className:`${W.evtPill} ${e._isHoliday||e.readOnly?W.holidayPill:``}`,children:e.summary},t)),c>2&&(0,A.jsxs)(`div`,{className:W.morePill,children:[`+`,c-2]})]})]},r)})]}),d&&(0,A.jsx)(`div`,{className:W.loadingBar,children:`Loading events…`})]}),(0,A.jsx)(`div`,{className:W.detailCol,children:p?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:W.detailHeader,children:[(0,A.jsx)(`div`,{className:W.detailDate,children:new Date(p+`T12:00:00`).toLocaleDateString(`en`,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`})}),(0,A.jsx)(`button`,{className:W.addEvtBtn,onClick:()=>ee(p),children:`+ Add Event`})]}),ae.length===0?(0,A.jsx)(`div`,{className:W.noEvts,children:`No events on this day`}):ae.map((t,n)=>{let r=t.isAllDay?`All day`:`${rn(t.start)} - ${rn(t.end)}`,i=t.calendarId??`primary`;return(0,A.jsxs)(`div`,{className:W.evtCard,children:[(0,A.jsxs)(`div`,{className:W.evtTop,children:[(0,A.jsx)(`div`,{className:W.evtTime,children:r}),t.id&&!t.readOnly&&(0,A.jsxs)(`div`,{className:W.evtBtns,children:[(0,A.jsx)(`button`,{className:W.editBtn,onClick:()=>T(t,p),children:`Edit`}),(0,A.jsx)(`button`,{className:W.delBtn,onClick:()=>w(i,t.id,p),children:e(`common.delete`)})]}),t.readOnly&&(0,A.jsx)(`span`,{className:W.readOnly,children:`read-only`})]}),(0,A.jsx)(`div`,{className:W.evtTitle,children:t.summary}),t.location&&(0,A.jsxs)(`div`,{className:W.evtLoc,children:[`📍 `,t.location]}),t.organizer&&(0,A.jsxs)(`div`,{className:W.evtMeta,children:[`Organizer: `,t.organizer]}),t.attendees&&t.attendees.length>0&&(0,A.jsxs)(`div`,{className:W.attendees,children:[(0,A.jsx)(`div`,{className:W.evtMeta,children:`Attendees:`}),t.attendees.map((e,t)=>(0,A.jsxs)(`div`,{className:W.attendee,"data-status":e.responseStatus,children:[e.name||e.email,` (`,e.responseStatus,`)`]},t))]}),t.description&&(0,A.jsx)(`div`,{className:W.evtDesc,children:t.description}),t.hangoutLink&&(0,A.jsx)(`a`,{className:W.joinBtn,href:t.hangoutLink,target:`_blank`,rel:`noreferrer`,children:`Join Video Call`}),t.htmlLink&&(0,A.jsx)(`a`,{className:W.gcalLink,href:t.htmlLink,target:`_blank`,rel:`noreferrer`,children:`Open in Google Calendar`})]},n)})]}):(0,A.jsxs)(`div`,{className:W.selectDay,children:[`Click a day to see events, edit or delete them.`,(0,A.jsx)(`br`,{}),(0,A.jsx)(`br`,{}),`Use `,(0,A.jsx)(`strong`,{children:`+ Add Event`}),` to create a new event — it syncs with Google Calendar.`]})}),h&&(0,A.jsx)(`div`,{className:W.overlay,onClick:e=>{e.target===e.currentTarget&&g(null)},children:(0,A.jsxs)(`div`,{className:W.formCard,children:[(0,A.jsx)(`div`,{className:W.formTitle,children:h.isEdit?`Edit Event`:`New Event`}),(0,A.jsx)(`label`,{className:W.formLabel,children:`Title *`}),(0,A.jsx)(`input`,{className:W.formInput,value:h.title,onChange:e=>g(t=>t&&{...t,title:e.target.value}),placeholder:`Event title`}),(0,A.jsx)(`label`,{className:W.formLabel,children:`Start`}),(0,A.jsx)(`input`,{className:W.formInput,type:`datetime-local`,value:h.start,onChange:e=>g(t=>t&&{...t,start:e.target.value})}),(0,A.jsx)(`label`,{className:W.formLabel,children:`End`}),(0,A.jsx)(`input`,{className:W.formInput,type:`datetime-local`,value:h.end,onChange:e=>g(t=>t&&{...t,end:e.target.value})}),(0,A.jsx)(`label`,{className:W.formLabel,children:`Location`}),(0,A.jsx)(`input`,{className:W.formInput,value:h.location,onChange:e=>g(t=>t&&{...t,location:e.target.value}),placeholder:`Optional`}),(0,A.jsx)(`label`,{className:W.formLabel,children:`Description`}),(0,A.jsx)(`textarea`,{className:W.formTextarea,value:h.description,onChange:e=>g(t=>t&&{...t,description:e.target.value})}),v&&(0,A.jsx)(`div`,{className:W.formError,children:v}),(0,A.jsxs)(`div`,{className:W.formBtns,children:[(0,A.jsx)(`button`,{className:W.cancelFormBtn,onClick:()=>g(null),children:e(`common.cancel`)}),(0,A.jsx)(`button`,{className:W.saveFormBtn,onClick:ne,disabled:b,children:b?`Saving…`:h.isEdit?`Save Changes`:`Create Event`})]})]})})]})}var G={root:`_root_1tngw_1`,gridSection:`_gridSection_1tngw_9`,gridHeader:`_gridHeader_1tngw_14`,headerRow:`_headerRow_1tngw_21`,search:`_search_1tngw_23`,createBtn:`_createBtn_1tngw_34`,catTabs:`_catTabs_1tngw_41`,catTab:`_catTab_1tngw_41`,catActive:`_catActive_1tngw_48`,grid:`_grid_1tngw_9`,agentCard:`_agentCard_1tngw_59`,agentActive:`_agentActive_1tngw_66`,agentCardTop:`_agentCardTop_1tngw_68`,agentIcon:`_agentIcon_1tngw_69`,agentActions:`_agentActions_1tngw_70`,agentEditBtn:`_agentEditBtn_1tngw_71`,agentDelBtn:`_agentDelBtn_1tngw_71`,agentLabel:`_agentLabel_1tngw_74`,agentDesc:`_agentDesc_1tngw_75`,agentCat:`_agentCat_1tngw_76`,loading:`_loading_1tngw_78`,chatArea:`_chatArea_1tngw_81`,emptyChat:`_emptyChat_1tngw_88`,emptyChatHint:`_emptyChatHint_1tngw_98`,chatPanel:`_chatPanel_1tngw_101`,chatHeader:`_chatHeader_1tngw_111`,chatIcon:`_chatIcon_1tngw_118`,chatHeaderInfo:`_chatHeaderInfo_1tngw_119`,chatAgentName:`_chatAgentName_1tngw_120`,chatAgentDesc:`_chatAgentDesc_1tngw_121`,closeChat:`_closeChat_1tngw_122`,chatMessages:`_chatMessages_1tngw_125`,chatEmpty:`_chatEmpty_1tngw_130`,chatMsg:`_chatMsg_1tngw_132`,msgUser:`_msgUser_1tngw_136`,msgAgent:`_msgAgent_1tngw_137`,thinking:`_thinking_1tngw_139`,dot:`_dot_1tngw_140`,dotPulse:`_dotPulse_1tngw_1`,chatInput:`_chatInput_1tngw_146`,chatTools:`_chatTools_1tngw_147`,toolBtn:`_toolBtn_1tngw_148`,toolBtnActive:`_toolBtnActive_1tngw_156`,attachBar:`_attachBar_1tngw_158`,attachClear:`_attachClear_1tngw_163`,chatInputRow:`_chatInputRow_1tngw_165`,chatTextarea:`_chatTextarea_1tngw_166`,sendBtn:`_sendBtn_1tngw_173`,orchBar:`_orchBar_1tngw_181`,orchLabel:`_orchLabel_1tngw_192`,orchRow:`_orchRow_1tngw_193`,orchInput:`_orchInput_1tngw_194`,orchBtn:`_orchBtn_1tngw_201`,orchSynthesis:`_orchSynthesis_1tngw_208`,orchSynthHeader:`_orchSynthHeader_1tngw_214`,orchSynthSpinner:`_orchSynthSpinner_1tngw_220`,blink:`_blink_1tngw_1`,orchSynthBody:`_orchSynthBody_1tngw_222`,modalOverlay:`_modalOverlay_1tngw_230`,modal:`_modal_1tngw_230`,modalTitle:`_modalTitle_1tngw_232`,formField:`_formField_1tngw_233`,formLabel:`_formLabel_1tngw_234`,formInput:`_formInput_1tngw_235`,formTextarea:`_formTextarea_1tngw_236`,formError:`_formError_1tngw_237`,modalBtns:`_modalBtns_1tngw_238`,cancelBtn:`_cancelBtn_1tngw_239`,modalSaveBtn:`_modalSaveBtn_1tngw_240`},on={saber:{icon:`🛡`},zero:{icon:`🔍`},ade:{icon:`🔬`},heimdall:{icon:`🔒`},cassandra:{icon:`⚠`},sauron:{icon:`👁`},jarvis:{icon:`💻`},forge:{icon:`⚙`},pipe:{icon:`🔧`},shell:{icon:`📟`},glitch:{icon:`🐛`},hermes:{icon:`🔗`},babel:{icon:`🌎`},shogun:{icon:`☸`},flux:{icon:`🔄`},cron:{icon:`⏰`},atlas:{icon:`🗺`},oracle:{icon:`📊`},logos:{icon:`🧮`},navi:{icon:`🧭`},edi:{icon:`📈`},mercury:{icon:`🌐`},tempest:{icon:`⛈`},cartographer:{icon:`🌍`},scheherazade:{icon:`✍`},quill:{icon:`📝`},muse:{icon:`🎨`},murasaki:{icon:`🖌`},echo:{icon:`📡`},polyglot:{icon:`🗣`},prometheus:{icon:`🔥`},herald:{icon:`📢`},veritas:{icon:`✓`},athena:{icon:`🧠`},conductor:{icon:`🎼`},link:{icon:`🔌`},macro:{icon:`⚡`},epicure:{icon:`🍽`}};function sn(e){let t=e.card??e,n=(t.name||t.displayName||t.agentName||e.name||``).toLowerCase().replace(/\s+/g,`-`),r=on[n],i=t.displayName||t.agentName||t.name||e.displayName||n,a=t.tagline||t.description||e.tagline||``,o=t.category||e.category||`Other`;return{id:n,icon:r?.icon??t.icon??`🤖`,label:i,description:a,category:o,isCustom:o===`custom`,systemPrompt:e.systemPrompt}}function cn(e){return{agent:e,history:[],streaming:!1,input:``,attachedFile:null,attachedImage:null,voiceActive:!1}}function ln(){let e=M(),[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(`All`),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(``),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(`create`),[w,ee]=(0,_.useState)(``),[T,te]=(0,_.useState)(!1),ne=(0,_.useRef)(new Map),O=(0,_.useRef)(new Map),k=(0,_.useRef)(new Map),ie=(0,_.useRef)(new Map),j=(0,_.useRef)(new Map),ae=(0,_.useRef)(null),oe=()=>{E(`/api/agents`).then(e=>{n((e?.agents??[]).map(sn)),i(!1)}).catch(()=>i(!1))};(0,_.useEffect)(()=>{oe()},[]);let se=[`All`,...Array.from(new Set(t.map(e=>e.category))).sort()],ce=t.filter(e=>{let t=s===`All`||e.category===s,n=a.toLowerCase();return t&&(!n||e.label.toLowerCase().includes(n)||e.description.toLowerCase().includes(n))}),le=e=>{u(t=>{let n=t.findIndex(t=>t.agent.id===e.id);return n>=0?(O.current.get(e.id)?.abort(),O.current.delete(e.id),t.filter((e,t)=>t!==n)):[...t,cn(e)]})},ue=e=>{O.current.get(e)?.abort(),O.current.delete(e),u(t=>t.filter(t=>t.agent.id!==e))},N=(e,t)=>{u(n=>n.map(n=>n.agent.id===e?{...n,...t}:n))},de=(e,t)=>{u(n=>n.map(n=>n.agent.id===e?{...n,history:[...n.history,t]}:n))},fe=(e,t)=>{u(n=>n.map(n=>{if(n.agent.id!==e)return n;let r=[...n.history];return r[r.length-1]={...r[r.length-1],content:t},{...n,history:r}}))},pe=async(e,t,n,r)=>{let i=e.agent.id;if(!t.trim()&&!n&&!r)return;de(i,{role:`user`,content:n?(t?t+` `:``)+`[File: ${n.name}]`:r?(t?t+` `:``)+`[Image: ${r.name}]`:t}),N(i,{streaming:!0,input:``,attachedFile:null,attachedImage:null});let a=e.history.slice(-20);if(n||r){try{let e={message:t||`Analyze this`,agent:i};n?.isPDF&&n.base64?(e.pdfBase64=n.base64,e.pdfName=n.name):n?.content&&(e.fileContent=n.content,e.fileName=n.name),r?.base64&&(e.imageBase64=r.base64,e.imageMimeType=r.mimeType??`image/jpeg`);let a=await D(`/api/chat`,e);de(i,{role:`assistant`,content:a?.response||a?.content||``})}catch{de(i,{role:`assistant`,content:`Error sending attachment.`})}N(i,{streaming:!1});return}de(i,{role:`assistant`,content:``,streaming:!0});let o=new AbortController;O.current.set(i,o);let s=``;try{await re(`/api/chat/stream`,{message:t,agent:i,history:a,_agentSystemPrompt:e.agent.systemPrompt},e=>{s+=e,fe(i,s);let t=k.current.get(i);t&&(t.scrollTop=t.scrollHeight)},o.signal)}catch{}finally{N(i,{streaming:!1}),O.current.delete(i)}},me=async()=>{let e=d.trim();if(!e||p||l.length===0)return;f(``),m(!0),g(``);let t=[];if(await Promise.all(l.map(async n=>{let r=n.agent.id;de(r,{role:`user`,content:e}),N(r,{streaming:!0});let i=``,a=new AbortController;O.current.set(r,a),de(r,{role:`assistant`,content:``,streaming:!0});try{await re(`/api/chat/stream`,{message:e,agent:r,history:n.history.slice(-20),_agentSystemPrompt:n.agent.systemPrompt},e=>{i+=e,fe(r,i);let t=k.current.get(r);t&&(t.scrollTop=t.scrollHeight)},a.signal)}catch{}finally{N(r,{streaming:!1}),O.current.delete(r)}t.push({agentId:r,agentLabel:n.agent.label,icon:n.agent.icon,content:i})})),m(!1),t.length<2)return;y(!0);let n=t.map(e=>`## ${e.icon} ${e.agentLabel}\n${e.content}`).join(`
|
|
706
|
-
|
|
707
|
-
---
|
|
708
|
-
|
|
709
|
-
`),r=`The user asked: "${e}"\n\nHere are the responses from ${t.length} specialist agents:\n\n${n}\n\nSynthesize these responses into a unified analysis.`,i=``;try{await re(`/api/chat/stream`,{message:r,systemPrompt:`You are the Conductor — a meta-agent that synthesizes the outputs of multiple specialist AI agents.
|
|
710
|
-
Your job: examine all agent responses to a user's question, identify agreements, disagreements, complementary insights, and deliver a unified, high-quality synthesis.
|
|
711
|
-
Be concise. Highlight what each agent contributed uniquely. Give your own synthesis verdict at the end.`},e=>{i+=e,g(i)})}catch{}finally{y(!1)}},he=e=>{let t=window.SpeechRecognition??window.webkitSpeechRecognition;if(!t){alert(`Speech recognition not supported.`);return}let n=ne.current.get(e);if(l.find(t=>t.agent.id===e)?.voiceActive&&n){n.stop(),N(e,{voiceActive:!1});return}let r=new t;ne.current.set(e,r),r.lang=`it-IT`,r.continuous=!1,r.interimResults=!1,r.onresult=t=>{let n=t.results[0][0].transcript;N(e,{input:(l.find(t=>t.agent.id===e)?.input??``)+(l.find(t=>t.agent.id===e)?.input?` `:``)+n})},r.onend=()=>N(e,{voiceActive:!1}),r.onerror=()=>N(e,{voiceActive:!1}),r.start(),N(e,{voiceActive:!0})},ge=(e,t)=>{if(!t)return;let n=t.name.toLowerCase().endsWith(`.pdf`)||t.type===`application/pdf`,r=new FileReader;n?(r.onload=n=>{let r=(n.target?.result).split(`,`)[1];N(e,{attachedFile:{name:t.name,size:t.size,base64:r,mimeType:`application/pdf`,isPDF:!0},attachedImage:null})},r.readAsDataURL(t)):(r.onload=n=>{N(e,{attachedFile:{name:t.name,size:t.size,content:n.target?.result},attachedImage:null})},r.readAsText(t))},_e=(e,t)=>{if(!t)return;let n=new FileReader;n.onload=n=>{let r=(n.target?.result).split(`,`)[1];N(e,{attachedImage:{name:t.name,size:t.size,base64:r,mimeType:t.type||`image/jpeg`},attachedFile:null})},n.readAsDataURL(t)},ve=()=>{x({name:``,tagline:``,systemPrompt:``}),C(`create`),ee(``)},ye=async e=>{let t=await E(`/api/agents/${e.id}`).catch(()=>null);x({name:e.id,tagline:t?.tagline??e.description,systemPrompt:t?.systemPrompt??``}),C(`edit`),ee(``)},be=async()=>{if(b){if(!b.tagline.trim()||!b.systemPrompt.trim()){ee(`Tagline and system prompt are required.`);return}te(!0),ee(``);try{if(S===`create`){let e=b.name.toLowerCase().replace(/[^a-z0-9_-]/g,``);if(!e){ee(`Agent name required (lowercase, no spaces).`),te(!1);return}let t=await D(`/api/agents`,{name:e,tagline:b.tagline,systemPrompt:b.systemPrompt});if(t?.error){ee(`Error: `+t.error),te(!1);return}}else await D(`/api/agents/${b.name}`,{tagline:b.tagline,systemPrompt:b.systemPrompt,category:`custom`},`PUT`);x(null),oe()}catch(e){ee(`Error: `+e.message)}finally{te(!1)}}},P=e=>{confirm(`Delete agent "${e.label}"?`)&&D(`/api/agents/${e.id}`,{},`DELETE`).then(()=>oe())};return r?(0,A.jsx)(`div`,{className:G.root,children:(0,A.jsx)(`div`,{className:G.loading,children:(0,A.jsx)(`div`,{className:`spinner`})})}):(0,A.jsxs)(`div`,{className:G.root,children:[(0,A.jsxs)(`div`,{className:G.gridSection,children:[(0,A.jsxs)(`div`,{className:G.gridHeader,children:[(0,A.jsxs)(`div`,{className:G.headerRow,children:[(0,A.jsx)(`input`,{className:G.search,value:a,onChange:e=>o(e.target.value),placeholder:`Search agents…`}),(0,A.jsx)(`button`,{className:G.createBtn,onClick:ve,children:`+ Create`})]}),(0,A.jsx)(`div`,{className:G.catTabs,children:se.map(e=>(0,A.jsxs)(`button`,{className:`${G.catTab} ${s===e?G.catActive:``}`,onClick:()=>c(e),children:[e,` (`,e===`All`?t.length:t.filter(t=>t.category===e).length,`)`]},e))})]}),(0,A.jsx)(`div`,{className:G.grid,children:ce.map(e=>{let t=l.some(t=>t.agent.id===e.id);return(0,A.jsxs)(`div`,{className:`${G.agentCard} ${t?G.agentActive:``}`,onClick:()=>le(e),children:[(0,A.jsxs)(`div`,{className:G.agentCardTop,children:[(0,A.jsx)(`div`,{className:G.agentIcon,children:e.icon}),e.isCustom&&(0,A.jsxs)(`div`,{className:G.agentActions,children:[(0,A.jsx)(`button`,{className:G.agentEditBtn,onClick:t=>{t.stopPropagation(),ye(e)},children:`✏️`}),(0,A.jsx)(`button`,{className:G.agentDelBtn,onClick:t=>{t.stopPropagation(),P(e)},children:`🗑`})]})]}),(0,A.jsx)(`div`,{className:G.agentLabel,children:e.label}),(0,A.jsx)(`div`,{className:G.agentDesc,children:e.description}),(0,A.jsx)(`div`,{className:G.agentCat,children:e.category})]},e.id)})})]}),(0,A.jsx)(`div`,{className:G.chatArea,children:l.length===0?(0,A.jsxs)(`div`,{className:G.emptyChat,children:[(0,A.jsx)(`span`,{children:`Click an agent above to open a chat`}),(0,A.jsx)(`span`,{className:G.emptyChatHint,children:`Open multiple agents to run them in parallel`})]}):l.map(e=>{let{agent:t}=e,n=e.attachedFile?`📎 ${e.attachedFile.name}`:e.attachedImage?`🖼 ${e.attachedImage.name}`:null;return(0,A.jsxs)(`div`,{className:G.chatPanel,children:[(0,A.jsxs)(`div`,{className:G.chatHeader,children:[(0,A.jsx)(`span`,{className:G.chatIcon,children:t.icon}),(0,A.jsxs)(`div`,{className:G.chatHeaderInfo,children:[(0,A.jsx)(`div`,{className:G.chatAgentName,children:t.label}),(0,A.jsx)(`div`,{className:G.chatAgentDesc,children:t.description})]}),(0,A.jsx)(`button`,{className:G.closeChat,onClick:()=>ue(t.id),children:`✕`})]}),(0,A.jsxs)(`div`,{className:G.chatMessages,ref:e=>{k.current.set(t.id,e)},children:[e.history.length===0&&(0,A.jsxs)(`div`,{className:G.chatEmpty,children:[`Ask `,t.label,` anything…`]}),e.history.map((e,t)=>(0,A.jsx)(`div`,{className:`${G.chatMsg} ${e.role===`user`?G.msgUser:G.msgAgent}`,children:e.role===`assistant`?(0,A.jsx)(`div`,{dangerouslySetInnerHTML:{__html:xe(e.content||`…`)}}):(0,A.jsx)(`span`,{children:e.content})},t)),e.streaming&&e.history[e.history.length-1]?.role===`assistant`&&e.history[e.history.length-1]?.content===``&&(0,A.jsxs)(`div`,{className:G.thinking,children:[(0,A.jsx)(`span`,{className:G.dot}),(0,A.jsx)(`span`,{className:G.dot}),(0,A.jsx)(`span`,{className:G.dot})]})]}),n&&(0,A.jsxs)(`div`,{className:G.attachBar,children:[(0,A.jsx)(`span`,{children:n}),(0,A.jsx)(`button`,{className:G.attachClear,onClick:()=>N(t.id,{attachedFile:null,attachedImage:null}),children:`×`})]}),(0,A.jsxs)(`div`,{className:G.chatInput,children:[(0,A.jsxs)(`div`,{className:G.chatTools,children:[(0,A.jsx)(`button`,{className:`${G.toolBtn} ${e.voiceActive?G.toolBtnActive:``}`,onClick:()=>he(t.id),title:`Voice`,children:`🎤`}),(0,A.jsx)(`button`,{className:G.toolBtn,onClick:()=>ie.current.get(t.id)?.click(),title:`Attach file`,children:`📎`}),(0,A.jsx)(`button`,{className:G.toolBtn,onClick:()=>j.current.get(t.id)?.click(),title:`Attach image`,children:`🖼`}),(0,A.jsx)(`input`,{type:`file`,style:{display:`none`},ref:e=>{ie.current.set(t.id,e)},onChange:e=>ge(t.id,e.target.files?.[0])}),(0,A.jsx)(`input`,{type:`file`,accept:`image/*`,style:{display:`none`},ref:e=>{j.current.set(t.id,e)},onChange:e=>_e(t.id,e.target.files?.[0])})]}),(0,A.jsxs)(`div`,{className:G.chatInputRow,children:[(0,A.jsx)(`textarea`,{className:G.chatTextarea,value:e.input,onChange:e=>N(t.id,{input:e.target.value}),placeholder:`Message ${t.label}…`,rows:2,onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),pe(e,e.input,e.attachedFile,e.attachedImage))}}),(0,A.jsx)(`button`,{className:G.sendBtn,onClick:()=>pe(e,e.input,e.attachedFile,e.attachedImage),disabled:e.streaming||!e.input.trim()&&!e.attachedFile&&!e.attachedImage,children:e.streaming?`…`:`→`})]})]})]},t.id)})}),l.length>=2&&(0,A.jsxs)(`div`,{className:G.orchBar,children:[(0,A.jsxs)(`div`,{className:G.orchLabel,children:[`🎼 Conductor · `,l.map(e=>`${e.agent.icon} ${e.agent.label}`).join(` · `)]}),(0,A.jsxs)(`div`,{className:G.orchRow,children:[(0,A.jsx)(`textarea`,{ref:ae,className:G.orchInput,value:d,onChange:e=>f(e.target.value),placeholder:`Ask all agents — Conductor will synthesize a unified response…`,rows:1,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),me())}}),(0,A.jsx)(`button`,{className:G.orchBtn,onClick:me,disabled:p||v||!d.trim(),children:p?`⏳`:v?`🔄`:`🎼 Run`})]}),(v||h)&&(0,A.jsxs)(`div`,{className:G.orchSynthesis,children:[(0,A.jsxs)(`div`,{className:G.orchSynthHeader,children:[(0,A.jsx)(`span`,{children:`🎼 Conductor Synthesis`}),v&&(0,A.jsx)(`span`,{className:G.orchSynthSpinner,children:`synthesizing…`})]}),(0,A.jsx)(`div`,{className:G.orchSynthBody,dangerouslySetInnerHTML:{__html:xe(h||`…`)}})]})]}),b&&(0,A.jsx)(`div`,{className:G.modalOverlay,onClick:e=>{e.target===e.currentTarget&&x(null)},children:(0,A.jsxs)(`div`,{className:G.modal,children:[(0,A.jsx)(`div`,{className:G.modalTitle,children:S===`create`?`+ New Agent`:`✏️ Edit Agent`}),S===`create`&&(0,A.jsxs)(`div`,{className:G.formField,children:[(0,A.jsx)(`label`,{className:G.formLabel,children:`Agent name (lowercase, no spaces)`}),(0,A.jsx)(`input`,{className:G.formInput,placeholder:`my-agent`,value:b.name,onChange:e=>x(t=>t&&{...t,name:e.target.value})})]}),(0,A.jsxs)(`div`,{className:G.formField,children:[(0,A.jsx)(`label`,{className:G.formLabel,children:`Tagline`}),(0,A.jsx)(`input`,{className:G.formInput,placeholder:`Short description`,value:b.tagline,onChange:e=>x(t=>t&&{...t,tagline:e.target.value})})]}),(0,A.jsxs)(`div`,{className:G.formField,children:[(0,A.jsx)(`label`,{className:G.formLabel,children:`System Prompt`}),(0,A.jsx)(`textarea`,{className:G.formTextarea,placeholder:`You are an expert in…`,value:b.systemPrompt,onChange:e=>x(t=>t&&{...t,systemPrompt:e.target.value})})]}),w&&(0,A.jsx)(`div`,{className:G.formError,children:w}),(0,A.jsxs)(`div`,{className:G.modalBtns,children:[(0,A.jsx)(`button`,{className:G.cancelBtn,onClick:()=>x(null),children:e(`common.cancel`)}),(0,A.jsx)(`button`,{className:G.modalSaveBtn,onClick:be,disabled:T,children:T?`…`:S===`create`?`Create Agent`:`Save`})]})]})})]})}var un={root:`_root_1mam6_1`,error:`_error_1mam6_10`,errorHint:`_errorHint_1mam6_16`,quotaBar:`_quotaBar_1mam6_29`,quotaText:`_quotaText_1mam6_37`,quotaUsed:`_quotaUsed_1mam6_43`,quotaPct:`_quotaPct_1mam6_44`,quotaTrack:`_quotaTrack_1mam6_46`,quotaFill:`_quotaFill_1mam6_53`,actionBar:`_actionBar_1mam6_59`,filterBtn:`_filterBtn_1mam6_67`,filterActive:`_filterActive_1mam6_79`,spacer:`_spacer_1mam6_85`,newBtn:`_newBtn_1mam6_87`,uploadBtn:`_uploadBtn_1mam6_98`,searchRow:`_searchRow_1mam6_108`,searchInput:`_searchInput_1mam6_114`,searchBtn:`_searchBtn_1mam6_126`,loading:`_loading_1mam6_136`,empty:`_empty_1mam6_141`,fileList:`_fileList_1mam6_151`,fileRow:`_fileRow_1mam6_159`,fileIcon:`_fileIcon_1mam6_172`,fileInfo:`_fileInfo_1mam6_174`,fileName:`_fileName_1mam6_176`,fileMeta:`_fileMeta_1mam6_184`,fileBtns:`_fileBtns_1mam6_190`,editBtn:`_editBtn_1mam6_196`,viewBtn:`_viewBtn_1mam6_197`,pdfBtn:`_pdfBtn_1mam6_198`,openBtn:`_openBtn_1mam6_199`,delBtn:`_delBtn_1mam6_200`,editorRoot:`_editorRoot_1mam6_204`,editorToolbar:`_editorToolbar_1mam6_211`,backBtn:`_backBtn_1mam6_221`,editorName:`_editorName_1mam6_231`,saveBtn:`_saveBtn_1mam6_238`,editorArea:`_editorArea_1mam6_251`,editorMeta:`_editorMeta_1mam6_266`,viewerRoot:`_viewerRoot_1mam6_276`,imgContainer:`_imgContainer_1mam6_283`,imgView:`_imgView_1mam6_292`,pdfFrame:`_pdfFrame_1mam6_298`};function dn(e,t){return e===`folder`?`📁`:e===`image`?`🖼`:e===`pdf`||t.includes(`pdf`)?`📕`:e===`video`?`🎬`:e===`audio`?`🎵`:t.includes(`spreadsheet`)||t.includes(`excel`)?`📊`:t.includes(`presentation`)||t.includes(`powerpoint`)?`📽`:t.includes(`document`)||t.includes(`word`)?`📄`:t.includes(`zip`)||t.includes(`archive`)?`📦`:`📄`}function fn(){let e=M(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(`list`),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(!1),S=(0,_.useRef)(null),C=(e=s,t=l)=>{i(!0);let r=`/api/drive`;e&&(r+=`?filter=${e}`),t&&(r+=`${e?`&`:`?`}search=${encodeURIComponent(t)}`),E(r).then(e=>{n(e??{files:[]}),i(!1)}).catch(e=>{o(e.message??`Error`),i(!1)})};(0,_.useEffect)(()=>{C()},[]);let w=e=>{c(e),C(e,l)},ee=()=>{u(d),C(s,d)},T=(e,t)=>{i(!0),E(`/api/drive/read/${e}`).then(n=>{g({id:e,name:t,content:n?.content??``}),y(n?.content??``),m(`editor`),i(!1)}).catch(()=>i(!1))},te=async()=>{if(h&&confirm(`Save changes to "${h.name}" on Drive?`)){x(!0);try{await D(`/api/drive/update/${h.id}`,{content:v}),g(e=>e&&{...e,content:v}),alert(`Saved!`)}catch(e){alert(`Save failed: `+e.message)}finally{x(!1)}}},ne=(e,t)=>{confirm(`Delete "${t}" from Drive? (moved to trash)`)&&D(`/api/drive/delete/${e}`,{}).then(()=>{n(null),C()})},O=()=>{let e=prompt(`File name (e.g. notes.txt, script.py):`);e&&D(`/api/drive/upload`,{name:e,content:``,mimeType:`text/plain`}).then(t=>{t?.id?T(t.id,e):C()}).catch(e=>alert(`Error: `+e.message))},re=()=>{S.current?.click()},k=e=>{if(!e)return;let t=new FileReader;t.onload=t=>{let r=(t.target?.result).split(`,`)[1]??``;D(`/api/drive/upload`,{name:e.name,content:r,mimeType:e.type||`application/octet-stream`,encoding:`base64`}).then(()=>{n(null),C()}).catch(e=>alert(`Upload error: `+e.message))},t.readAsDataURL(e)};if(a)return(0,A.jsxs)(`div`,{className:un.error,children:[(0,A.jsx)(`div`,{children:a}),(0,A.jsxs)(`div`,{className:un.errorHint,children:[`Run: `,(0,A.jsx)(`code`,{children:`nha google revoke`}),` then `,(0,A.jsx)(`code`,{children:`nha google auth`})]})]});if(p===`editor`&&h)return(0,A.jsxs)(`div`,{className:un.editorRoot,children:[(0,A.jsxs)(`div`,{className:un.editorToolbar,children:[(0,A.jsx)(`button`,{className:un.backBtn,onClick:()=>m(`list`),children:`← Back`}),(0,A.jsx)(`span`,{className:un.editorName,children:h.name}),(0,A.jsx)(`button`,{className:un.saveBtn,onClick:te,disabled:b,children:b?`Saving…`:`Save to Drive`})]}),(0,A.jsx)(`textarea`,{className:un.editorArea,value:v,onChange:e=>y(e.target.value),spellCheck:!1,onKeyDown:e=>{if(e.key===`Tab`){e.preventDefault();let t=e.currentTarget.selectionStart,n=e.currentTarget.selectionEnd,r=e.currentTarget.value;e.currentTarget.value=r.slice(0,t)+` `+r.slice(n),e.currentTarget.selectionStart=e.currentTarget.selectionEnd=t+2}}}),(0,A.jsxs)(`div`,{className:un.editorMeta,children:[`File ID: `,h.id,` · Tab = 2 spaces · Not auto-saved`]})]});let ie=t?.files??[],j=t?.quota;return(0,A.jsxs)(`div`,{className:un.root,children:[j&&(0,A.jsxs)(`div`,{className:un.quotaBar,children:[(0,A.jsxs)(`div`,{className:un.quotaText,children:[(0,A.jsxs)(`span`,{className:un.quotaUsed,children:[j.usage,` of `,j.limit,` used`]}),(0,A.jsxs)(`span`,{className:un.quotaPct,children:[j.percentUsed,`%`]})]}),(0,A.jsx)(`div`,{className:un.quotaTrack,children:(0,A.jsx)(`div`,{className:un.quotaFill,style:{width:`${Math.min(j.percentUsed,100)}%`,background:j.percentUsed>90?`var(--red)`:j.percentUsed>70?`var(--amber)`:`var(--green)`}})})]}),(0,A.jsxs)(`div`,{className:un.actionBar,children:[[``,`recent`,`starred`,`shared`].map(e=>(0,A.jsx)(`button`,{className:`${un.filterBtn} ${s===e?un.filterActive:``}`,onClick:()=>w(e),children:e?e.charAt(0).toUpperCase()+e.slice(1):`All Files`},e)),(0,A.jsx)(`div`,{className:un.spacer}),(0,A.jsx)(`button`,{className:un.newBtn,onClick:O,children:`+ New File`}),(0,A.jsx)(`button`,{className:un.uploadBtn,onClick:re,children:e(`drive.upload`)}),(0,A.jsx)(`input`,{ref:S,type:`file`,style:{display:`none`},onChange:e=>k(e.target.files?.[0])})]}),(0,A.jsxs)(`div`,{className:un.searchRow,children:[(0,A.jsx)(`input`,{className:un.searchInput,value:d,onChange:e=>f(e.target.value),placeholder:`Search files…`,onKeyDown:e=>e.key===`Enter`&&ee()}),(0,A.jsx)(`button`,{className:un.searchBtn,onClick:ee,children:`Search`})]}),r&&(0,A.jsx)(`div`,{className:un.loading,children:(0,A.jsx)(`div`,{className:`spinner`})}),!r&&ie.length===0&&(0,A.jsxs)(`div`,{className:un.empty,children:[e(`drive.noFiles`),` found`]}),(0,A.jsx)(`div`,{className:un.fileList,children:ie.map(e=>(0,A.jsxs)(`div`,{className:un.fileRow,onClick:()=>{e.webViewLink&&window.open(e.webViewLink,`_blank`)},style:{cursor:e.webViewLink?`pointer`:`default`},children:[(0,A.jsx)(`span`,{className:un.fileIcon,children:dn(e.type,e.mimeType)}),(0,A.jsxs)(`div`,{className:un.fileInfo,children:[(0,A.jsx)(`div`,{className:un.fileName,children:e.name}),(0,A.jsxs)(`div`,{className:un.fileMeta,children:[e.modifiedTime?new Date(e.modifiedTime).toLocaleDateString():``,e.size?` · ${e.size}`:``,e.shared?` · Shared`:``,e.starred?` ★`:``]})]}),(0,A.jsxs)(`div`,{className:un.fileBtns,children:[e.webViewLink&&(0,A.jsx)(`a`,{className:un.openBtn,href:e.webViewLink,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),children:`Open ↗`}),(0,A.jsx)(`button`,{className:un.delBtn,onClick:t=>{t.stopPropagation(),ne(e.id,e.name)},children:`Del`})]})]},e.id))})]})}var pn={root:`_root_p82nk_1`,loading:`_loading_p82nk_10`,errorBox:`_errorBox_p82nk_12`,errorHint:`_errorHint_p82nk_13`,connectBox:`_connectBox_p82nk_17`,connectIcon:`_connectIcon_p82nk_27`,connectTitle:`_connectTitle_p82nk_28`,connectDesc:`_connectDesc_p82nk_29`,connectLink:`_connectLink_p82nk_30`,connectRow:`_connectRow_p82nk_31`,connectInput:`_connectInput_p82nk_32`,connectBtn:`_connectBtn_p82nk_43`,connectError:`_connectError_p82nk_55`,userRow:`_userRow_p82nk_57`,avatar:`_avatar_p82nk_68`,userLogin:`_userLogin_p82nk_70`,userName:`_userName_p82nk_71`,disconnectBtn:`_disconnectBtn_p82nk_73`,repoBar:`_repoBar_p82nk_84`,repoInput:`_repoInput_p82nk_90`,issuesBtn:`_issuesBtn_p82nk_102`,prsBtn:`_prsBtn_p82nk_113`,repoPills:`_repoPills_p82nk_124`,repoPill:`_repoPill_p82nk_124`,issueCount:`_issueCount_p82nk_147`,tabs:`_tabs_p82nk_153`,tab:`_tab_p82nk_153`,tabActive:`_tabActive_p82nk_172`,markRead:`_markRead_p82nk_178`,content:`_content_p82nk_189`,empty:`_empty_p82nk_191`,notifRow:`_notifRow_p82nk_193`,issueRow:`_issueRow_p82nk_193`,prRow:`_prRow_p82nk_193`,notifRepo:`_notifRepo_p82nk_207`,notifType:`_notifType_p82nk_208`,notifTitle:`_notifTitle_p82nk_209`,notifMeta:`_notifMeta_p82nk_210`,issueNum:`_issueNum_p82nk_212`,issueTitle:`_issueTitle_p82nk_213`,issueMeta:`_issueMeta_p82nk_214`,issueLabel:`_issueLabel_p82nk_215`,prNum:`_prNum_p82nk_217`,prTitle:`_prTitle_p82nk_218`,prAuthor:`_prAuthor_p82nk_219`,prDraft:`_prDraft_p82nk_220`,prMeta:`_prMeta_p82nk_221`};function mn(){let e=M(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(`notifs`),d=(e=``)=>{i(!0),E(e?`/api/github?repo=${encodeURIComponent(e)}`:`/api/github`).then(e=>{n(e??{}),i(!1)}).catch(()=>i(!1))};(0,_.useEffect)(()=>{d()},[]);let f=()=>{let e=s.trim();o(e),d(e),u(`issues`)},p=()=>{let e=s.trim();o(e),d(e),u(`prs`)},m=()=>D(`/api/github/mark-read`,{}).then(()=>d(a)),h=()=>{confirm(`Remove GitHub connection? You can reconnect anytime.`)&&D(`/api/config`,{key:`github-token`,value:``}).then(()=>{n(null),i(!1)})},[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(!1),x=t?.user;if(r)return(0,A.jsx)(`div`,{className:pn.loading,children:(0,A.jsx)(`div`,{className:`spinner`})});let S=async()=>{g.trim()&&(b(!0),await D(`/api/config`,{key:`github-token`,value:g.trim()}),v(``),b(!1),d())};if(t?.error||!x?.login&&!r)return(0,A.jsxs)(`div`,{className:pn.connectBox,children:[(0,A.jsx)(`div`,{className:pn.connectIcon,children:`🔗`}),(0,A.jsx)(`div`,{className:pn.connectTitle,children:`Connect GitHub`}),(0,A.jsxs)(`div`,{className:pn.connectDesc,children:[`Enter your Personal Access Token to connect GitHub.`,(0,A.jsx)(`br`,{}),`Create one at `,(0,A.jsx)(`a`,{href:`https://github.com/settings/tokens`,target:`_blank`,rel:`noreferrer`,className:pn.connectLink,children:`github.com/settings/tokens`}),` with `,(0,A.jsx)(`strong`,{children:`repo`}),` scope.`]}),(0,A.jsxs)(`div`,{className:pn.connectRow,children:[(0,A.jsx)(`input`,{className:pn.connectInput,type:`password`,value:g,onChange:e=>v(e.target.value),placeholder:`ghp_xxxxxxxxxxxxxxxxxxxx`,onKeyDown:e=>e.key===`Enter`&&S()}),(0,A.jsx)(`button`,{className:pn.connectBtn,onClick:S,disabled:y||!g.trim(),children:y?`Connecting...`:`Connect`})]}),t?.error&&(0,A.jsx)(`div`,{className:pn.connectError,children:t.error})]});let C=Array.isArray(t?.notifications)?t.notifications:[],w=Array.isArray(t?.issues)?t.issues:[],ee=Array.isArray(t?.prs)?t.prs:[];return(0,A.jsxs)(`div`,{className:pn.root,children:[x?.login&&(0,A.jsxs)(`div`,{className:pn.userRow,children:[x.avatar&&(0,A.jsx)(`img`,{src:x.avatar,className:pn.avatar,alt:x.login}),(0,A.jsxs)(`div`,{style:{flex:1},children:[(0,A.jsxs)(`div`,{className:pn.userLogin,children:[`@`,x.login]}),x.name&&(0,A.jsx)(`div`,{className:pn.userName,children:x.name})]}),(0,A.jsx)(`button`,{className:pn.disconnectBtn,onClick:h,children:`Disconnect`})]}),(0,A.jsxs)(`div`,{className:pn.repoBar,children:[(0,A.jsx)(`input`,{className:pn.repoInput,value:s,onChange:e=>c(e.target.value),placeholder:`owner/repo`,onKeyDown:e=>e.key===`Enter`&&f()}),(0,A.jsx)(`button`,{className:pn.issuesBtn,onClick:f,children:`Issues`}),(0,A.jsx)(`button`,{className:pn.prsBtn,onClick:p,children:`PRs`})]}),x?.repos&&x.repos.length>0&&(0,A.jsx)(`div`,{className:pn.repoPills,children:x.repos.slice(0,12).map(e=>(0,A.jsxs)(`button`,{className:pn.repoPill,onClick:()=>{c(e.full_name),o(e.full_name),d(e.full_name),u(`issues`)},title:e.description??``,children:[e.private?`🔒 `:``,e.full_name,e.open_issues?(0,A.jsx)(`span`,{className:pn.issueCount,children:e.open_issues}):null]},e.full_name))}),(0,A.jsxs)(`div`,{className:pn.tabs,children:[(0,A.jsxs)(`button`,{className:`${pn.tab} ${l===`notifs`?pn.tabActive:``}`,onClick:()=>u(`notifs`),children:[`Notifications `,C.length>0?`(${C.length})`:``]}),w.length>0&&(0,A.jsxs)(`button`,{className:`${pn.tab} ${l===`issues`?pn.tabActive:``}`,onClick:()=>u(`issues`),children:[`Issues (`,w.length,`)`]}),ee.length>0&&(0,A.jsxs)(`button`,{className:`${pn.tab} ${l===`prs`?pn.tabActive:``}`,onClick:()=>u(`prs`),children:[`PRs (`,ee.length,`)`]}),l===`notifs`&&C.length>0&&(0,A.jsx)(`button`,{className:pn.markRead,onClick:m,children:`Mark all read`})]}),(0,A.jsxs)(`div`,{className:pn.content,children:[l===`notifs`&&(C.length===0?(0,A.jsx)(`div`,{className:pn.empty,children:`No notifications`}):C.map((e,t)=>(0,A.jsxs)(`a`,{className:pn.notifRow,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,A.jsx)(`span`,{className:pn.notifRepo,children:e.repo}),(0,A.jsxs)(`span`,{className:pn.notifType,children:[`[`,e.type,`]`]}),(0,A.jsx)(`div`,{className:pn.notifTitle,children:e.title}),(0,A.jsxs)(`div`,{className:pn.notifMeta,children:[e.reason,` · `,e.updated]})]},t))),l===`issues`&&(w.length===0?(0,A.jsxs)(`div`,{className:pn.empty,children:[e(`github.noIssues`),` for `,a]}):w.map((e,t)=>(0,A.jsxs)(`a`,{className:pn.issueRow,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,A.jsxs)(`span`,{className:pn.issueNum,children:[`#`,e.number]}),(0,A.jsx)(`span`,{className:pn.issueTitle,children:e.title}),e.assignee&&(0,A.jsxs)(`span`,{className:pn.issueMeta,children:[`→ `,e.assignee]}),e.labels&&(0,A.jsxs)(`span`,{className:pn.issueLabel,children:[`[`,e.labels,`]`]}),(0,A.jsx)(`div`,{className:pn.issueMeta,children:e.updated})]},t))),l===`prs`&&(ee.length===0?(0,A.jsxs)(`div`,{className:pn.empty,children:[`No PRs for `,a]}):ee.map((e,t)=>(0,A.jsxs)(`a`,{className:pn.prRow,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,A.jsxs)(`span`,{className:pn.prNum,children:[`#`,e.number]}),(0,A.jsx)(`span`,{className:pn.prTitle,children:e.title}),(0,A.jsxs)(`span`,{className:pn.prAuthor,children:[`by `,e.author]}),e.draft&&(0,A.jsx)(`span`,{className:pn.prDraft,children:`DRAFT`}),(0,A.jsx)(`div`,{className:pn.prMeta,children:e.updated})]},t)))]})]})}var hn={loading:`_loading_1h5ss_1`,errorBox:`_errorBox_1h5ss_3`,errorHint:`_errorHint_1h5ss_4`,twoPane:`_twoPane_1h5ss_7`,sidebar:`_sidebar_1h5ss_13`,sidebarTitle:`_sidebarTitle_1h5ss_24`,workspace:`_workspace_1h5ss_36`,searchRow:`_searchRow_1h5ss_42`,searchInput:`_searchInput_1h5ss_50`,searchBtn:`_searchBtn_1h5ss_63`,channelItem:`_channelItem_1h5ss_73`,channelActive:`_channelActive_1h5ss_83`,pageTitle:`_pageTitle_1h5ss_89`,pageMeta:`_pageMeta_1h5ss_97`,disconnectBtn:`_disconnectBtn_1h5ss_99`,empty:`_empty_1h5ss_110`,messagePane:`_messagePane_1h5ss_112`,channelHeader:`_channelHeader_1h5ss_120`,emptyPane:`_emptyPane_1h5ss_129`,message:`_message_1h5ss_112`,msgUser:`_msgUser_1h5ss_146`,msgText:`_msgText_1h5ss_147`,msgTs:`_msgTs_1h5ss_148`,openLink:`_openLink_1h5ss_150`,pageBody:`_pageBody_1h5ss_160`};function gn({onSaved:e}){let[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(``),s=async()=>{if(t.trim()){if(t.startsWith(`xoxe-`)){o(`"xoxe-" è un refresh token (Token Rotation attivata). NHA ha bisogno di "xoxb-". Disabilita Token Rotation in "OAuth & Permissions → Advanced Token Security" oppure crea una nuova app senza Token Rotation.`);return}if(t.startsWith(`xoxp-`)){o(`"xoxp-" è uno User OAuth Token. NHA usa il Bot Token "xoxb-". In "OAuth & Permissions" copia "Bot User OAuth Token" (la prima riga), non lo User Token.`);return}if(t.startsWith(`xoxa-`)||t.startsWith(`xoxr-`)||t.startsWith(`xoxs-`)){o(`Token type "${t.slice(0,5)}" non supportato. NHA accetta solo Bot User OAuth Token che iniziano con "xoxb-".`);return}if(!t.startsWith(`xoxb-`)){o(`Il token deve iniziare con "xoxb-" (Bot User OAuth Token).`);return}i(!0),o(``);try{await D(`/api/config`,{key:`slack-token`,value:t.trim()}),n(``),e()}catch(e){o(e.message||`errore`)}finally{i(!1)}}};return(0,A.jsxs)(`div`,{style:{display:`flex`,gap:6,marginTop:8,flexWrap:`wrap`},children:[(0,A.jsx)(`input`,{type:`password`,autoFocus:!0,placeholder:`xoxb-...`,value:t,onChange:e=>{n(e.target.value),o(``)},onKeyDown:e=>{e.key===`Enter`&&s()},style:{flex:1,minWidth:260,padding:`6px 10px`,borderRadius:6,border:`1px solid rgba(148,163,184,0.25)`,background:`rgba(15,23,42,0.4)`,color:`inherit`,fontFamily:`SF Mono, monospace`,fontSize:12}}),(0,A.jsx)(`button`,{onClick:s,disabled:!t.trim()||r,style:{padding:`6px 16px`,borderRadius:6,border:`none`,background:`#6366f1`,color:`white`,fontWeight:700,cursor:`pointer`,opacity:!t.trim()||r?.5:1},children:r?`Salvo...`:`Salva e connetti`}),a&&(0,A.jsx)(`div`,{style:{width:`100%`,color:`#ef4444`,fontSize:11},children:a})]})}function _n(){let e=M(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(``),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(null),[w,ee]=(0,_.useState)(!0),T=(0,_.useRef)(null),te=()=>{i(!0),E(`/api/slack/channels`).then(e=>{n(e??{}),i(!1)}).catch(()=>i(!1))},ne=e=>{o(e),C(null),E(`/api/slack/messages?channel=${e.id}&limit=80`).then(e=>c(e?.messages??[])),D(`/api/slack/mark-read`,{channel:e.id}).catch(()=>{})},O=e=>{a&&E(`/api/slack/thread?channel=${a.id}&ts=${e.ts}`).then(t=>C({parent:e,replies:(t?.messages??[]).filter(t=>t.ts!==e.ts)}))},re=async()=>{if(!(!a||!l.trim()||d)){f(!0);try{let e={channel:a.id,text:l};S&&(e.threadTs=S.parent.ts),await D(`/api/slack/send`,e),u(``),S?O(S.parent):ne(a)}finally{f(!1)}}},k=async()=>{if(!h.trim()){y(null);return}x(!0);try{y((await E(`/api/slack/search?q=${encodeURIComponent(h)}&count=30`))?.results??[])}finally{x(!1)}},ie=async(e,t)=>{a&&(await D(`/api/slack/react`,{channel:a.id,ts:e.ts,emoji:t}),ne(a))};if((0,_.useEffect)(()=>{te()},[]),(0,_.useEffect)(()=>(T.current&&window.clearInterval(T.current),w&&a&&(T.current=window.setInterval(()=>ne(a),15e3)),()=>{T.current&&window.clearInterval(T.current)}),[w,a?.id]),r)return(0,A.jsxs)(`div`,{className:hn.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),e(`common.loading`)]});if(t?.error)return/token not configured|missing.*token|slack.*token/i.test(t.error)?(0,A.jsxs)(`div`,{style:{maxWidth:720,margin:`40px auto`,padding:24,background:`rgba(15,23,42,0.4)`,border:`1px solid rgba(99,102,241,0.2)`,borderRadius:12,color:`inherit`},children:[(0,A.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:8},children:[(0,A.jsx)(`span`,{style:{fontSize:32},children:`💬`}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{style:{fontSize:20,fontWeight:800},children:`Collega il tuo Slack a NHA`}),(0,A.jsx)(`div`,{style:{fontSize:12,opacity:.7},children:`Bastano 4 passaggi · ~3 minuti · gratis`})]})]}),(0,A.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`32px 1fr`,gap:`12px 10px`,marginTop:16,fontSize:13,lineHeight:1.55},children:[(0,A.jsx)(`div`,{style:{fontSize:18,fontWeight:700,color:`#a78bfa`},children:`1.`}),(0,A.jsxs)(`div`,{children:[`Apri `,(0,A.jsx)(`a`,{href:`https://api.slack.com/apps?new_app=1`,target:`_blank`,rel:`noreferrer`,style:{color:`#6366f1`,fontWeight:700},children:`api.slack.com/apps → Create New App`}),` e scegli "From scratch". Dai un nome (es. `,(0,A.jsx)(`code`,{children:`NHA Bot`}),`) e seleziona il tuo workspace.`]}),(0,A.jsx)(`div`,{style:{fontSize:18,fontWeight:700,color:`#a78bfa`},children:`2.`}),(0,A.jsxs)(`div`,{children:[`Nel pannello sinistro vai su `,(0,A.jsx)(`strong`,{children:`OAuth & Permissions`}),`. In "Scopes → Bot Token Scopes" aggiungi `,(0,A.jsx)(`strong`,{children:`tutti questi`}),` permessi:`,(0,A.jsx)(`div`,{style:{marginTop:6,display:`flex`,flexWrap:`wrap`,gap:4,fontFamily:`SF Mono, monospace`,fontSize:11},children:[`channels:read`,`channels:history`,`groups:read`,`groups:history`,`im:read`,`im:history`,`mpim:read`,`mpim:history`,`users:read`,`users:read.email`,`team:read`,`chat:write`,`reactions:write`,`search:read`].map(e=>(0,A.jsx)(`code`,{style:{background:`rgba(99,102,241,0.12)`,padding:`2px 6px`,borderRadius:4,color:`#c4b5fd`},children:e},e))})]}),(0,A.jsx)(`div`,{style:{fontSize:18,fontWeight:700,color:`#a78bfa`},children:`3.`}),(0,A.jsxs)(`div`,{children:[`In cima alla stessa pagina clicca `,(0,A.jsx)(`strong`,{children:`"Install to Workspace"`}),` e conferma. Slack ti darà un `,(0,A.jsx)(`strong`,{children:`Bot User OAuth Token`}),` che inizia per `,(0,A.jsx)(`code`,{children:`xoxb-`}),`.`]}),(0,A.jsx)(`div`,{style:{fontSize:18,fontWeight:700,color:`#a78bfa`},children:`4.`}),(0,A.jsxs)(`div`,{children:[`Copia il token e incollalo qui sotto, oppure vai in `,(0,A.jsx)(`strong`,{children:`Settings → Integration tokens`}),`:`,(0,A.jsx)(gn,{onSaved:te})]})]}),(0,A.jsxs)(`div`,{style:{marginTop:18,padding:10,background:`rgba(99,102,241,0.06)`,borderRadius:8,fontSize:11,opacity:.8},children:[(0,A.jsx)(`strong`,{children:`Privacy:`}),` il token resta sul tuo computer in `,(0,A.jsx)(`code`,{children:`~/.nha/config.json`}),`. NHA non lo invia ai server.`,(0,A.jsx)(`br`,{}),(0,A.jsx)(`strong`,{children:`Tip:`}),` se hai canali privati che vuoi leggere, il bot deve essere invitato. Da Slack scrivi `,(0,A.jsx)(`code`,{children:`/invite @nome-del-bot`}),` nel canale.`]})]}):(0,A.jsxs)(`div`,{className:hn.errorBox,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`strong`,{children:`⚠ Slack:`}),` `,t.error]}),(0,A.jsxs)(`div`,{className:hn.errorHint,children:[`Se il problema persiste, verifica gli scopes del bot in `,(0,A.jsx)(`a`,{href:`https://api.slack.com/apps`,target:`_blank`,rel:`noreferrer`,children:`api.slack.com/apps`}),`.`]})]});let j=t?.channels??[],ae=p?j.filter(e=>e.name.toLowerCase().includes(p.toLowerCase())):j,oe=ae.filter(e=>!e.is_im&&!e.is_mpim&&!e.is_private),se=ae.filter(e=>e.is_private&&!e.is_im&&!e.is_mpim),ce=ae.filter(e=>e.is_im||e.is_mpim),le=(e,t)=>(0,A.jsxs)(`div`,{className:hn.message,style:{display:`flex`,flexDirection:`column`,gap:2},children:[(0,A.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6},children:[(0,A.jsx)(`span`,{className:hn.msgUser,style:{fontWeight:700},children:e.user||`Unknown`}),(0,A.jsx)(`span`,{className:hn.msgTs,style:{fontSize:11,opacity:.6},children:new Date(parseFloat(e.ts)*1e3).toLocaleString()}),e.reply_count?(0,A.jsxs)(`button`,{onClick:()=>O(e),style:{background:`transparent`,border:`none`,color:`#6366f1`,cursor:`pointer`,fontSize:11},children:[`💬 `,e.reply_count,` `,e.reply_count===1?`reply`:`replies`]}):null]}),(0,A.jsx)(`div`,{className:hn.msgText,style:{whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:e.text}),e.files&&e.files.length>0&&(0,A.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`,marginTop:2},children:e.files.map(e=>(0,A.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,style:{fontSize:11,padding:`2px 6px`,background:`rgba(99,102,241,0.1)`,borderRadius:4,color:`#6366f1`,textDecoration:`none`},children:[`📎 `,e.name]},e.id))}),e.reactions&&e.reactions.length>0&&(0,A.jsxs)(`div`,{style:{display:`flex`,gap:4,flexWrap:`wrap`,marginTop:2},children:[e.reactions.map((e,t)=>(0,A.jsxs)(`span`,{style:{fontSize:11,padding:`1px 6px`,background:`rgba(99,102,241,0.08)`,borderRadius:10},children:[`:`,e.name,`: `,e.count]},t)),(0,A.jsx)(`button`,{onClick:()=>ie(e,`thumbsup`),style:{background:`transparent`,border:`1px dashed rgba(148,163,184,0.3)`,borderRadius:10,fontSize:11,padding:`0 6px`,cursor:`pointer`},children:`+ 👍`})]})]},t);return(0,A.jsxs)(`div`,{className:hn.twoPane,children:[(0,A.jsxs)(`div`,{className:hn.sidebar,children:[(0,A.jsxs)(`div`,{className:hn.sidebarTitle,children:[(0,A.jsxs)(`span`,{children:[`💬 `,t?.workspace||`Slack`]}),(0,A.jsx)(`button`,{className:hn.disconnectBtn,onClick:te,title:`Refresh`,children:`↻`})]}),(0,A.jsx)(`input`,{type:`text`,placeholder:`🔎 Filter channels...`,value:p,onChange:e=>m(e.target.value),style:{width:`100%`,padding:`6px 8px`,marginBottom:6,borderRadius:6,border:`1px solid rgba(148,163,184,0.2)`,background:`transparent`,color:`inherit`,fontSize:12}}),(0,A.jsx)(`input`,{type:`text`,placeholder:`Search messages...`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&k()},style:{width:`100%`,padding:`6px 8px`,marginBottom:8,borderRadius:6,border:`1px solid rgba(148,163,184,0.2)`,background:`transparent`,color:`inherit`,fontSize:12}}),v!==null&&(0,A.jsxs)(`div`,{style:{marginBottom:8},children:[(0,A.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,marginBottom:2},children:b?`Searching…`:`${v.length} result(s)`}),(0,A.jsx)(`button`,{onClick:()=>{y(null),g(``)},style:{fontSize:11,background:`transparent`,border:`none`,color:`#6366f1`,cursor:`pointer`,padding:0},children:`← back to channels`})]}),v===null&&(0,A.jsxs)(A.Fragment,{children:[oe.length>0&&(0,A.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,textTransform:`uppercase`,marginTop:8,marginBottom:2},children:`Channels`}),oe.map(e=>(0,A.jsxs)(`div`,{className:`${hn.channelItem} ${a?.id===e.id?hn.channelActive:``}`,onClick:()=>ne(e),children:[`# `,e.name,(e.unread_count??0)>0&&(0,A.jsx)(`span`,{style:{float:`right`,background:`#ef4444`,color:`white`,borderRadius:8,padding:`0 6px`,fontSize:10},children:e.unread_count})]},e.id)),se.length>0&&(0,A.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,textTransform:`uppercase`,marginTop:8,marginBottom:2},children:`Private`}),se.map(e=>(0,A.jsxs)(`div`,{className:`${hn.channelItem} ${a?.id===e.id?hn.channelActive:``}`,onClick:()=>ne(e),children:[`🔒 `,e.name]},e.id)),ce.length>0&&(0,A.jsx)(`div`,{style:{fontSize:10,color:`#94a3b8`,textTransform:`uppercase`,marginTop:8,marginBottom:2},children:`Direct Messages`}),ce.map(e=>(0,A.jsx)(`div`,{className:`${hn.channelItem} ${a?.id===e.id?hn.channelActive:``}`,onClick:()=>ne(e),children:e.name},e.id))]})]}),(0,A.jsx)(`div`,{className:hn.messagePane,style:{display:`flex`,flexDirection:`column`,height:`100%`},children:v===null?a?S?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:hn.channelHeader,style:{display:`flex`,justifyContent:`space-between`},children:[(0,A.jsxs)(`span`,{children:[`💬 Thread in #`,a.name]}),(0,A.jsx)(`button`,{onClick:()=>C(null),style:{background:`transparent`,border:`none`,color:`#6366f1`,cursor:`pointer`},children:`✕ Close thread`})]}),(0,A.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,padding:8},children:[(0,A.jsx)(`div`,{style:{borderLeft:`3px solid #6366f1`,paddingLeft:8,marginBottom:8,opacity:.85},children:le(S.parent,-1)}),(0,A.jsxs)(`div`,{style:{fontSize:11,color:`#94a3b8`,textTransform:`uppercase`,margin:`8px 0 4px`},children:[S.replies.length,` `,S.replies.length===1?`reply`:`replies`]}),S.replies.map((e,t)=>le(e,t))]})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:hn.channelHeader,style:{display:`flex`,justifyContent:`space-between`},children:[(0,A.jsxs)(`span`,{children:[`#`,a.name,a.topic?(0,A.jsxs)(`span`,{style:{fontWeight:400,opacity:.6,marginLeft:8},children:[`— `,a.topic]}):null]}),(0,A.jsxs)(`label`,{style:{fontSize:11,opacity:.7},children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>ee(e.target.checked)}),` auto-refresh`]})]}),(0,A.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,padding:8},children:[s.length===0&&(0,A.jsx)(`div`,{className:hn.empty,children:`No messages`}),s.map((e,t)=>le(e,t))]}),(0,A.jsxs)(`div`,{style:{borderTop:`1px solid rgba(148,163,184,0.2)`,padding:8,display:`flex`,gap:6},children:[(0,A.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&re()},placeholder:`Message #${a.name} (Cmd/Ctrl+Enter to send)`,rows:2,style:{flex:1,padding:6,borderRadius:6,border:`1px solid rgba(148,163,184,0.2)`,background:`transparent`,color:`inherit`,fontFamily:`inherit`,resize:`vertical`}}),(0,A.jsx)(`button`,{onClick:re,disabled:!l.trim()||d,className:hn.disconnectBtn,style:{minWidth:80},children:d?`Sending…`:`Send`})]})]}):(0,A.jsx)(`div`,{className:hn.emptyPane,children:`Select a channel from the left`}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:hn.channelHeader,children:[`🔎 Search results for "`,h,`"`]}),(0,A.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,padding:8},children:[v.length===0&&(0,A.jsx)(`div`,{className:hn.empty,children:`No matches`}),v.map((e,t)=>(0,A.jsxs)(`div`,{className:hn.message,style:{marginBottom:6},children:[(0,A.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6},children:[(0,A.jsx)(`span`,{style:{fontWeight:700},children:e.user}),(0,A.jsxs)(`span`,{style:{fontSize:11,opacity:.6},children:[`in #`,e.channel]}),(0,A.jsx)(`span`,{style:{fontSize:11,opacity:.5},children:new Date(parseFloat(e.ts)*1e3).toLocaleString()}),e.permalink&&(0,A.jsx)(`a`,{href:e.permalink,target:`_blank`,rel:`noreferrer`,style:{fontSize:11,color:`#6366f1`},children:`↗ Slack`})]}),(0,A.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,wordBreak:`break-word`,marginTop:2},children:e.text})]},t))]})]})})]})}function vn(){let e=M(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(e=``)=>{i(!0),E(e?`/api/notion/search?q=${encodeURIComponent(e)}`:`/api/notion`).then(e=>{n(e??{}),i(!1)}).catch(()=>i(!1))},f=e=>{o(e),E(`/api/notion/page?id=${encodeURIComponent(e.id)}`).then(e=>c(e?.content??``))};(0,_.useEffect)(()=>{d()},[]);let p=()=>d(l);if(r)return(0,A.jsxs)(`div`,{className:hn.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),e(`common.loading`)]});if(t?.error)return(0,A.jsxs)(`div`,{className:hn.errorBox,children:[(0,A.jsx)(`div`,{children:t.error}),(0,A.jsxs)(`div`,{className:hn.errorHint,children:[`Run: `,(0,A.jsx)(`code`,{children:`nha config set notion-token secret_YOUR_TOKEN`})]})]});let m=t?.pages??[];return(0,A.jsxs)(`div`,{className:hn.twoPane,children:[(0,A.jsxs)(`div`,{className:hn.sidebar,children:[(0,A.jsx)(`div`,{className:hn.sidebarTitle,children:`📋 Notion`}),(0,A.jsxs)(`div`,{className:hn.searchRow,children:[(0,A.jsx)(`input`,{className:hn.searchInput,value:l,onChange:e=>u(e.target.value),placeholder:`Search pages…`,onKeyDown:e=>e.key===`Enter`&&p()}),(0,A.jsx)(`button`,{className:hn.searchBtn,onClick:p,children:`Go`})]}),m.length===0&&(0,A.jsx)(`div`,{className:hn.empty,children:`No pages found`}),m.map(e=>(0,A.jsxs)(`div`,{className:`${hn.channelItem} ${a?.id===e.id?hn.channelActive:``}`,onClick:()=>f(e),children:[(0,A.jsx)(`div`,{className:hn.pageTitle,children:e.title||`Untitled`}),e.last_edited&&(0,A.jsx)(`div`,{className:hn.pageMeta,children:e.last_edited.slice(0,10)})]},e.id)),(0,A.jsx)(`button`,{className:hn.disconnectBtn,onClick:()=>D(`/api/config`,{key:`notion-token`,value:``}).then(()=>d()),children:`Disconnect`})]}),(0,A.jsx)(`div`,{className:hn.messagePane,children:a?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:hn.channelHeader,children:a.title}),a.url&&(0,A.jsx)(`a`,{className:hn.openLink,href:a.url,target:`_blank`,rel:`noreferrer`,children:`Open in Notion ↗`}),(0,A.jsx)(`div`,{className:hn.pageBody,dangerouslySetInnerHTML:{__html:xe(s||`Loading…`)}})]}):(0,A.jsx)(`div`,{className:hn.emptyPane,children:`Select a page`})})]})}var yn={root:`_root_1l3ll_1`,sidebar:`_sidebar_1l3ll_8`,sidebarHeader:`_sidebarHeader_1l3ll_18`,sidebarTitle:`_sidebarTitle_1l3ll_19`,sidebarBtns:`_sidebarBtns_1l3ll_21`,createBtn:`_createBtn_1l3ll_22`,joinBtn:`_joinBtn_1l3ll_23`,noChannels:`_noChannels_1l3ll_25`,channelItem:`_channelItem_1l3ll_27`,channelActive:`_channelActive_1l3ll_29`,channelName:`_channelName_1l3ll_30`,channelMeta:`_channelMeta_1l3ll_31`,channelCode:`_channelCode_1l3ll_32`,channelDel:`_channelDel_1l3ll_34`,main:`_main_1l3ll_38`,chatHeader:`_chatHeader_1l3ll_41`,chatChannelName:`_chatChannelName_1l3ll_50`,chatChannelId:`_chatChannelId_1l3ll_51`,statusDot:`_statusDot_1l3ll_52`,connected:`_connected_1l3ll_53`,disconnected:`_disconnected_1l3ll_54`,statusText:`_statusText_1l3ll_55`,messages:`_messages_1l3ll_58`,emptyMsgs:`_emptyMsgs_1l3ll_66`,msg:`_msg_1l3ll_68`,msgSelf:`_msgSelf_1l3ll_69`,msgOther:`_msgOther_1l3ll_70`,msgSender:`_msgSender_1l3ll_71`,msgContent:`_msgContent_1l3ll_72`,msgTime:`_msgTime_1l3ll_82`,inputRow:`_inputRow_1l3ll_85`,textInput:`_textInput_1l3ll_86`,sendBtn:`_sendBtn_1l3ll_88`,welcome:`_welcome_1l3ll_92`,welcomeIcon:`_welcomeIcon_1l3ll_103`,welcomeTitle:`_welcomeTitle_1l3ll_104`,welcomeSub:`_welcomeSub_1l3ll_105`,welcomeBox:`_welcomeBox_1l3ll_106`,welcomeBoxTitle:`_welcomeBoxTitle_1l3ll_107`,welcomeStep:`_welcomeStep_1l3ll_108`,welcomeHint:`_welcomeHint_1l3ll_109`,cliCmd:`_cliCmd_1l3ll_110`};function bn(e){return e.content||e.plaintext||e.message||``}function xn(e){return e.senderName||e.senderFingerprint?.slice(0,8)||e.sender||`unknown`}function Sn(){let e=M(),[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d]=(0,_.useState)(()=>`nha-ui-${Math.random().toString(36).slice(2,8)}`),f=(0,_.useRef)(null),p=(0,_.useRef)(null);(0,_.useEffect)(()=>{E(`/api/collab/channels`).then(e=>{n(e?.channels??[])}).catch(()=>{})},[]),(0,_.useEffect)(()=>{if(r)return m(r),h(r),()=>{f.current?.close(),u(!1)}},[r]);let m=e=>{E(`/api/collab/messages?channelId=${e}`).then(e=>{e?.messages&&(o(e.messages),setTimeout(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},50))}).catch(()=>{})},h=e=>{f.current?.close();let t=window.location.protocol===`https:`?`wss:`:`ws:`,n=window.location.port===`3030`||window.location.port===`3031`?`3020`:window.location.port||`3020`,r=`${t}//${window.location.hostname}:${n}/ws/alexandria?channel=${e}&agentId=${encodeURIComponent(d)}`,i=new WebSocket(r);f.current=i,i.onopen=()=>u(!0),i.onclose=()=>u(!1),i.onmessage=e=>{try{let t=JSON.parse(e.data);if(!t)return;o(e=>[...e,{...t,id:t.id||Date.now().toString(),type:`message`}]),p.current&&(p.current.scrollTop=p.current.scrollHeight)}catch{}}},g=async()=>{let e=prompt(`Channel name:`);if(!e)return;let t=await D(`/api/collab/create`,{name:e}).catch(()=>null);if(!t||t.error){alert(t?.error||`Error creating channel`);return}let r=t.id;await D(`/api/collab/channels`,{id:r,name:e,role:`creator`}).catch(()=>{});let a={id:r,name:e,role:`creator`};n(e=>[...e,a]),i(r),prompt(`Share this invite code with collaborators:`,r)},v=async()=>{let e=prompt(`Invite code:`);if(!e)return;let t=await D(`/api/collab/join`,{channelId:e}).catch(()=>null);if(!t||t.error){alert(t?.error||`Error joining channel`);return}let r=t.name||e.slice(0,8);await D(`/api/collab/channels`,{id:e,name:r,role:`member`}).catch(()=>{}),n(t=>[...t,{id:e,name:r,role:`member`}]),i(e)},y=async e=>{confirm(`Delete this channel? Messages will be lost.`)&&(D(`/api/collab/delete`,{channelId:e}).catch(()=>{}),n(t=>t.filter(t=>t.id!==e)),r===e&&(i(null),o([]),f.current?.close(),u(!1)))},b=async()=>{let e=s.trim();if(!e||!r)return;c(``);let t=await D(`/api/collab/send`,{channelId:r,message:e}).catch(()=>null);t?.error&&alert(t.error),l||m(r)},x=e=>{navigator.clipboard.writeText(e).catch(()=>{})};return(0,A.jsxs)(`div`,{className:yn.root,children:[(0,A.jsxs)(`div`,{className:yn.sidebar,children:[(0,A.jsx)(`div`,{className:yn.sidebarHeader,children:(0,A.jsx)(`div`,{className:yn.sidebarTitle,children:`Alexandria`})}),(0,A.jsxs)(`div`,{className:yn.sidebarBtns,children:[(0,A.jsx)(`button`,{className:yn.createBtn,onClick:g,children:`+ Create`}),(0,A.jsx)(`button`,{className:yn.joinBtn,onClick:v,children:`Join`})]}),t.length===0?(0,A.jsxs)(`div`,{className:yn.noChannels,children:[e(`collab.noChannels`),` yet`]}):t.map(e=>(0,A.jsxs)(`div`,{className:`${yn.channelItem} ${r===e.id?yn.channelActive:``}`,onClick:()=>i(e.id),children:[(0,A.jsx)(`div`,{className:yn.channelName,children:e.name}),(0,A.jsxs)(`div`,{className:yn.channelMeta,children:[(0,A.jsxs)(`span`,{className:yn.channelCode,onClick:t=>{t.stopPropagation(),x(e.id)},title:`Click to copy invite code`,children:[e.id.slice(0,8),`…`]}),(0,A.jsx)(`button`,{className:yn.channelDel,onClick:t=>{t.stopPropagation(),y(e.id)},children:`del`})]})]},e.id))]}),(0,A.jsx)(`div`,{className:yn.main,children:r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:yn.chatHeader,children:[(0,A.jsx)(`div`,{className:yn.chatChannelName,children:t.find(e=>e.id===r)?.name??r.slice(0,12)}),(0,A.jsx)(`div`,{className:yn.chatChannelId,children:r}),(0,A.jsx)(`div`,{className:`${yn.statusDot} ${l?yn.connected:yn.disconnected}`}),(0,A.jsx)(`span`,{className:yn.statusText,children:l?`Live`:`HTTP`})]}),(0,A.jsxs)(`div`,{className:yn.messages,ref:p,children:[a.length===0&&(0,A.jsx)(`div`,{className:yn.emptyMsgs,children:`No messages yet`}),a.map((e,t)=>{let n=xn(e),r=bn(e),i=n===d;return(0,A.jsxs)(`div`,{className:`${yn.msg} ${i?yn.msgSelf:yn.msgOther}`,children:[!i&&(0,A.jsx)(`div`,{className:yn.msgSender,children:n}),(0,A.jsx)(`div`,{className:yn.msgContent,children:r}),(0,A.jsx)(`div`,{className:yn.msgTime,children:new Date(e.timestamp).toLocaleTimeString()})]},e.id||t)})]}),(0,A.jsxs)(`div`,{className:yn.inputRow,children:[(0,A.jsx)(`input`,{className:yn.textInput,value:s,onChange:e=>c(e.target.value),placeholder:`Send an encrypted message…`,onKeyDown:e=>e.key===`Enter`&&!e.shiftKey&&b()}),(0,A.jsx)(`button`,{className:yn.sendBtn,onClick:b,disabled:!s.trim(),children:e(`collab.send`)})]})]}):(0,A.jsxs)(`div`,{className:yn.welcome,children:[(0,A.jsx)(`div`,{className:yn.welcomeIcon,children:`🔐`}),(0,A.jsx)(`div`,{className:yn.welcomeTitle,children:`Alexandria`}),(0,A.jsx)(`div`,{className:yn.welcomeSub,children:`E2E encrypted messaging for AI agents and teams`}),(0,A.jsxs)(`div`,{className:yn.welcomeBox,children:[(0,A.jsx)(`div`,{className:yn.welcomeBoxTitle,children:`HOW TO USE`}),(0,A.jsxs)(`div`,{className:yn.welcomeStep,children:[(0,A.jsx)(`strong`,{children:`1. Create a channel`}),` — Click [+ Create] in the sidebar. Give it a name.`]}),(0,A.jsx)(`div`,{className:yn.welcomeHint,children:`You get an invite code. Share it with your team or another AI session.`}),(0,A.jsxs)(`div`,{className:yn.welcomeStep,children:[(0,A.jsx)(`strong`,{children:`2. Others join`}),` — They click [Join] and paste the invite code.`]}),(0,A.jsx)(`div`,{className:yn.welcomeHint,children:`Works from this web UI, the Android app, or the CLI.`}),(0,A.jsxs)(`div`,{className:yn.welcomeStep,children:[(0,A.jsx)(`strong`,{children:`3. Chat encrypted`}),` — All messages are E2E encrypted. The server sees only ciphertext.`]})]}),(0,A.jsxs)(`div`,{className:yn.welcomeBox,children:[(0,A.jsx)(`div`,{className:yn.welcomeBoxTitle,children:`FROM CLI (same channels)`}),(0,A.jsx)(`div`,{className:yn.cliCmd,children:`nha collab create "Project X"`}),(0,A.jsx)(`div`,{className:yn.cliCmd,children:`nha collab join <invite-code>`}),(0,A.jsx)(`div`,{className:yn.cliCmd,children:`nha collab send "Hello from CLI"`}),(0,A.jsx)(`div`,{className:yn.cliCmd,children:`nha collab read`})]})]})})]})}var Cn=[],wn=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?wn:Cn).push(n+=e[t])})();function Tn(e){if(e<768)return!1;for(let t=0,n=Cn.length;;){let r=t+n>>1;if(e<Cn[r])n=r;else if(e>=wn[r])t=r+1;else return!0;if(t==n)return!1}}function En(e){return e>=127462&&e<=127487}var Dn=8205;function On(e,t,n=!0,r=!0){return(n?kn:An)(e,t,r)}function kn(e,t,n){if(t==e.length)return t;t&&Mn(e.charCodeAt(t))&&Nn(e.charCodeAt(t-1))&&t--;let r=jn(e,t);for(t+=Pn(r);t<e.length;){let i=jn(e,t);if(r==Dn||i==Dn||n&&Tn(i))t+=Pn(i),r=i;else if(En(i)){let n=0,r=t-2;for(;r>=0&&En(jn(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function An(e,t,n){for(;t>0;){let r=kn(e,t-2,n);if(r<t)return r;t--}return 0}function jn(e,t){let n=e.charCodeAt(t);if(!Nn(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Mn(r)?(n-55296<<10)+(r-56320)+65536:n}function Mn(e){return e>=56320&&e<57344}function Nn(e){return e>=55296&&e<56320}function Pn(e){return e<65536?1:2}var Fn=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Gn(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ln.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Gn(this,e,t);let n=[];return this.decompose(e,t,n,0),Ln.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new Vn(this),i=new Vn(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new Vn(this,e)}iterRange(e,t=this.length){return new Hn(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Un(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new In(t):Ln.from(In.split(t,[]))}},In=class e extends Fn{constructor(e,t=Rn(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new Wn(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(Bn(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=zn(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=Gn(this,t,n);let i=zn(this.text,zn(r.text,Bn(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):Ln.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
|
712
|
-
`){[e,t]=Gn(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},Ln=class e extends Fn{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=Gn(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
|
|
713
|
-
`){[e,t]=Gn(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new In(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof In&&c&&(n=u[u.length-1])instanceof In&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new In(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};Fn.empty=new In([``],0);function Rn(e){let t=-1;for(let n of e)t+=n.length+1;return t}function zn(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function Bn(e,t,n){return zn(e,[``],t,n)}var Vn=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof In?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof In?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
714
|
-
`,this;e--}else if(r instanceof In){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof In?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Hn=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new Vn(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},Un=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(Fn.prototype[Symbol.iterator]=function(){return this.iter()},Vn.prototype[Symbol.iterator]=Hn.prototype[Symbol.iterator]=Un.prototype[Symbol.iterator]=function(){return this});var Wn=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function Gn(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Kn(e,t,n=!0,r=!0){return On(e,t,n,r)}function qn(e){return e>=56320&&e<57344}function Jn(e){return e>=55296&&e<56320}function Yn(e,t){let n=e.charCodeAt(t);if(!Jn(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return qn(r)?(n-55296<<10)+(r-56320)+65536:n}function Xn(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Zn(e){return e<65536?1:2}var Qn=/\r\n?|\n/,$n=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})($n||={}),er=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,i),r+=i):r+=a,n+=i}}iterChangedRanges(e,t=!1){ir(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],r=this.sections[e++];r<0?t.push(n,r):t.push(r,n)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:or(this,e)}mapDesc(e,t=!1){return e.empty?this:ar(this,e,t)}mapPos(e,t=-1,n=$n.Simple){let r=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],c=r+o;if(s<0){if(c>e)return i+(e-r);i+=o}else{if(n!=$n.Simple&&c>=e&&(n==$n.TrackDel&&r<e&&c>e||n==$n.TrackBefore&&r<e||n==$n.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],a=this.sections[n++],o=r+i;if(a>=0&&r<=t&&o>=e)return r<e&&o>t?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?` `:``)+n+(r>=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},tr=class e extends er{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return ir(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return ar(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e<n.length;e+=2){let a=n[e],o=n[e+1];if(o>=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length<s;)r.push(Fn.empty);r.push(a?t.slice(i,i+a):Fn.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:or(this,e,!0)}map(e,t=!1){return e.empty?this:ar(this,e,t,!0)}iterChanges(e,t=!1){ir(this,e,t)}get desc(){return er.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new sr(this);done:for(let e=0,o=0;;){let s=e==t.length?1e9:t[e++];for(;o<s||o==s&&a.len==0;){if(a.done)break done;let e=Math.min(a.len,s-o);nr(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;nr(n,e,t),t>0&&rr(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o<c;){if(a.done)break done;let e=Math.min(a.len,c-o);nr(n,e,-1),nr(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:er.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;o<n&&nr(i,n-o,-1);let r=new e(i,a);s=s?s.compose(r.map(s)):r,i=[],a=[],o=0}function l(t){if(Array.isArray(t))for(let e of t)l(e);else if(t instanceof e){if(t.length!=n)throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);c(),s=s?s.compose(t.map(s)):t}else{let{from:e,to:s=e,insert:l}=t;if(e>s||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?Fn.of(l.split(r||Qn)):l:Fn.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&nr(i,e-o,-1),nr(i,s-e,d),rr(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(typeof i==`number`)n.push(i,-1);else if(!Array.isArray(i)||typeof i[0]!=`number`||i.some((e,t)=>t&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length<e;)r.push(Fn.empty);r[e]=Fn.of(i.slice(1)),n.push(i[0],r[e].length)}}return new e(n,r)}static createSet(t,n){return new e(t,n)}};function nr(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function rr(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(Fn.empty);e.push(n)}}function ir(e,t,n){let r=e.inserted;for(let i=0,a=0,o=0;o<e.sections.length;){let s=e.sections[o++],c=e.sections[o++];if(c<0)i+=s,a+=s;else{let l=i,u=a,d=Fn.empty;for(;l+=s,u+=c,c&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function ar(e,t,n,r=!1){let i=[],a=r?[]:null,o=new sr(e),s=new sr(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);nr(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let t=s.len;for(nr(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(nr(i,0,o.ins),a&&rr(a,i,o.text),e=o.i),o.forward(n),t-=n}s.next()}else if(o.ins>=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.len<n)n-=s.len,s.next();else break;nr(i,t,e<o.i?o.ins:0),a&&e<o.i&&rr(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?tr.createSet(i,a):er.create(i);else throw Error(`Mismatched change set lengths`)}function or(e,t,n=!1){let r=[],i=n?[]:null,a=new sr(e),o=new sr(t);for(let e=!1;;)if(a.done&&o.done)return i?tr.createSet(r,i):er.create(r);else if(a.ins==0)nr(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)nr(r,0,o.ins,e),i&&rr(i,r,o.text),o.next();else if(a.done||o.done)throw Error(`Mismatched change set lengths`);else{let t=Math.min(a.len2,o.len),n=r.length;if(a.ins==-1){let n=o.ins==-1?-1:o.off?0:o.ins;nr(r,t,n,e),i&&n&&rr(i,r,o.text)}else o.ins==-1?(nr(r,a.off?0:a.len,t,e),i&&rr(i,r,a.textBit(t))):(nr(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&rr(i,r,o.text));e=(a.ins>t||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var sr=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Fn.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Fn.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},cr=class e{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return K.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return K.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return K.range(e.anchor,e.head)}static create(t,n,r){return new e(t,n,r)}},K=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new e([this.main],0)}addRange(t,n=!0){return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>cr.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;i<t.length;i++){let a=t[i];if(a.empty?a.from<=r:a.from<r)return e.normalized(t.slice(),n);r=a.to}return new e(t,n)}static cursor(e,t=0,n,r){return cr.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(r??16777215)<<6)}static range(e,t,n,r,i){let a=(n??16777215)<<6|(r==null?7:Math.min(6,r));return!i&&e!=t&&(i=t<e?1:-1),t<e?cr.create(t,e,48|a):cr.create(e,t,(i?i<0?8:16:0)|a)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function lr(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var ur=0,q=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=ur++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:dr),!!t.static,t.enables)}of(e){return new fr([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new fr(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new fr(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function dr(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var fr=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=ur++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||mr(e,c)){let r=t(e);if(a?!pr(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=Dr(o,c);if(this.dependencies.every(t=>t instanceof q?o.facet(t)===e.facet(t):t instanceof _r?o.field(t,!1)==e.field(t,!1):!0)||(a?pr(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}};function pr(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function mr(e,t){let n=!1;for(let r of t)Er(e,r)&1&&(n=!0);return n}function hr(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;t<r.length;t++){let a=Dr(e,r[t]);if(i[t]==2)for(let e of a)n.push(e);else n.push(a)}return t.combine(n)}return{create(e){for(let t of r)Er(e,t);return e.values[o]=s(e),1},update(e,n){if(!mr(e,a))return 0;let r=s(e);return t.compare(r,e.values[o])?0:(e.values[o]=r,1)},reconfigure(e,i){let a=mr(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&dr(n,c))return e.values[o]=l,0;let u=s(e);return t.compare(u,l)?(e.values[o]=l,0):(e.values[o]=u,1)}}}var gr=q.define({static:!0}),_r=class e{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new e(ur++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(gr).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(gr),i=n.facet(gr),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,gr.of({field:this,create:e})]}get extension(){return this}},vr={lowest:4,low:3,default:2,high:1,highest:0};function yr(e){return t=>new xr(t,e)}var br={highest:yr(vr.highest),high:yr(vr.high),default:yr(vr.default),low:yr(vr.low),lowest:yr(vr.lowest)},xr=class{constructor(e,t){this.inner=e,this.prec=t}},Sr=class e{of(e){return new Cr(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Cr=class{constructor(e,t){this.compartment=e,this.inner=t}},wr=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of Tr(t,n,o))e instanceof _r?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0))if(s[n.id]=c.length<<1|1,dr(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>hr(e,n,t))}}return new e(t,o,l.map(e=>e(s)),s,c,a)}};function Tr(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Cr&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Cr){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof xr)a(e.inner,e.prec);else if(e instanceof _r)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof fr)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,vr.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,vr.default),r.reduce((e,t)=>e.concat(t))}function Er(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Dr(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Or=q.define(),kr=q.define({combine:e=>e.some(e=>e),static:!0}),Ar=q.define({combine:e=>e.length?e[0]:void 0,static:!0}),jr=q.define(),Mr=q.define(),Nr=q.define(),Pr=q.define({combine:e=>e.length?e[0]:!1}),Fr=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Ir}},Ir=class{of(e){return new Fr(this,e)}},Lr=class{constructor(e){this.map=e}of(e){return new Rr(this,e)}},Rr=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new Lr(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};Rr.reconfigure=Rr.define(),Rr.appendConfig=Rr.define();var zr=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&lr(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};zr.time=Fr.define(),zr.userEvent=Fr.define(),zr.addToHistory=Fr.define(),zr.remote=Fr.define();function Br(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r<e.length&&(i==t.length||t[i]>=e[r]))a=e[r++],o=e[r++];else if(i<t.length)a=t[i++],o=t[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function Vr(e,t,n){let r,i,a;return n?(r=t.changes,i=tr.empty(t.changes.length),a=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(r)),{changes:a,selection:t.selection?t.selection.map(i):e.selection?.map(r),effects:Rr.mapEffects(e.effects,r).concat(Rr.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Hr(e,t,n){let r=t.selection,i=qr(t.annotations);return t.userEvent&&(i=i.concat(zr.userEvent.of(t.userEvent))),{changes:t.changes instanceof tr?t.changes:tr.of(t.changes||[],n,e.facet(Ar)),selection:r&&(r instanceof K?r:K.single(r.anchor,r.head)),effects:qr(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function Ur(e,t,n){let r=Hr(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let a=!!t[i].sequential;r=Vr(r,Hr(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=zr.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Gr(n?Wr(i):i)}function Wr(e){let t=e.startState,n=!0;for(let r of t.facet(jr)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:Br(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=tr.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=zr.create(t,r,e.selection&&e.selection.map(i),Rr.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Mr);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof zr?i:Array.isArray(i)&&i.length==1&&i[0]instanceof zr?i[0]:Ur(t,qr(i),!1)}return e}function Gr(e){let t=e.startState,n=t.facet(Nr),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=Vr(r,Hr(t,a,e.changes.newLength),!0))}return r==e?e:zr.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var Kr=[];function qr(e){return e==null?Kr:Array.isArray(e)?e:[e]}var Jr=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(Jr||={}),Yr=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Xr;try{Xr=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function Zr(e){if(Xr)return Xr.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||Yr.test(n)))return!0}return!1}function Qr(e){return t=>{if(!/\S/.test(t))return Jr.Space;if(Zr(t))return Jr.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Jr.Word;return Jr.Other}}var $r=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Er(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`);return}return Er(this,n),Dr(this,n)}update(...e){return Ur(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(Sr.reconfigure)?(n&&=(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(Rr.reconfigure)?(n=null,r=e.value):e.is(Rr.appendConfig)&&(n=null,r=qr(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=wr.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(kr)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:K.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=qr(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),s=this.changes(o.changes),c=s.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(c);let l=r.mapDesc(s,!0);i.push(o.range.map(l)),r=r.compose(c),a=Rr.mapEffects(a,c).concat(Rr.mapEffects(qr(o.effects),l))}return{changes:r,selection:K.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof tr?t:tr.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return Fn.of(t.split(this.facet(e.lineSeparator)||Qn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Er(this,t),Dr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof _r&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||typeof t.doc!=`string`)throw RangeError(`Invalid JSON representation for EditorState`);let i=[];if(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],a=t[e];i.push(n.init(e=>n.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:K.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=wr.resolve(t.extensions||[],new Map),r=t.doc instanceof Fn?t.doc:Fn.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||Qn)),i=t.selection?t.selection instanceof K?t.selection:K.single(t.selection.anchor,t.selection.head):K.single(0);return lr(i,r.length),n.staticFacet(kr)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||`
|
|
715
|
-
`}get readOnly(){return this.facet(Pr)}phrase(t,...n){for(let n of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(e,t)=>{if(t==`$`)return`$`;let r=+(t||1);return!r||r>n.length?e:n[r-1]})),t}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(Or))for(let a of i(this,t,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let t=this.languageDataAt(`wordChars`,e);return Qr(t.length?t[0]:``)}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-n,o=e-n;for(;a>0;){let e=Kn(t,a,!1);if(i(t.slice(e,a))!=Jr.Word)break;a=e}for(;o<r;){let e=Kn(t,o);if(i(t.slice(o,e))!=Jr.Word)break;o=e}return a==o?null:K.range(a+n,o+n)}};$r.allowMultipleSelections=kr,$r.tabSize=q.define({combine:e=>e.length?e[0]:4}),$r.lineSeparator=Ar,$r.readOnly=Pr,$r.phrases=q.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),$r.languageData=Or,$r.changeFilter=jr,$r.transactionFilter=Mr,$r.transactionExtender=Nr,Sr.reconfigure=Rr.define();function ei(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],a=r[e];if(a===void 0)r[e]=i;else if(!(a===i||i===void 0))if(Object.hasOwnProperty.call(n,e))r[e]=n[e](a,i);else throw Error(`Config merge conflict for field `+e)}for(let e in t)r[e]===void 0&&(r[e]=t[e]);return r}var ti=class{eq(e){return this==e}range(e,t=e){return ri.create(e,t,this)}};ti.prototype.startSide=ti.prototype.endSide=0,ti.prototype.point=!1,ti.prototype.mapMode=$n.TrackDel;function ni(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var ri=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,r){return new e(t,n,r)}};function ii(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var ai=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let a=r,o=i.length;;){if(a==o)return a;let r=a+o>>1,s=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==a)return s>=0?a:o;s>=0?o=r:a=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),a=this.findIndex(n,1e9,!1,i);i<a;i++)if(r(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(t,n){let r=[],i=[],a=[],o=-1,s=-1;for(let e=0;e<this.value.length;e++){let c=this.value[e],l=this.from[e]+t,u=this.to[e]+t,d,f;if(l==u){let e=n.mapPos(l,c.startSide,c.mapMode);if(e==null||(d=f=e,c.startSide!=c.endSide&&(f=n.mapPos(l,c.endSide),f<d)))continue}else if(d=n.mapPos(l,c.startSide),f=n.mapPos(u,c.endSide),d>f||d==f&&c.startSide>0&&c.endSide<=0)continue;(f-d||c.endSide-c.startSide)<0||(o<0&&(o=d),c.point&&(s=Math.max(s,f-d)),r.push(c),i.push(d-o),a.push(f-o))}return{mapped:r.length?new e(i,a,r,s):null,pos:o}}},oi=class e{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(t,n,r,i){return new e(t,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(t){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:a=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(ii)),this.isEmpty)return n.length?e.of(n):this;let s=new ui(this,null,-1).goto(0),c=0,l=[],u=new ci;for(;s.value||c<n.length;)if(c<n.length&&(s.from-n[c].from||s.startSide-n[c].value.startSide)>=0){let e=n[c++];u.addInner(e.from,e.to,e.value)||l.push(e)}else s.rangeIndex==1&&s.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(s.chunkIndex)<n[c].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||a<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||i>s.to||a<s.from||o(s.from,s.to,s.value))&&(u.addInner(s.from,s.to,s.value)||l.push(ri.create(s.from,s.to,s.value))),s.next());return u.finishInner(this.nextLayer.isEmpty&&!l.length?e.empty:this.nextLayer.update({add:l,filter:o,filterFrom:i,filterTo:a}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],i=-1;for(let e=0;e<this.chunk.length;e++){let a=this.chunkPos[e],o=this.chunk[e],s=t.touchesRange(a,a+o.length);if(s===!1)i=Math.max(i,o.maxPoint),n.push(o),r.push(t.mapPos(a));else if(s===!0){let{mapped:e,pos:s}=o.map(a,t);e&&(i=Math.max(i,e.maxPoint),n.push(e),r.push(s))}}let a=this.nextLayer.map(t);return n.length==0?a:new e(r,n,a||e.empty,i)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],a=this.chunk[r];if(t>=i&&e<=i+a.length&&a.between(i,e-i,t-i,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return di.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return di.from(e).goto(t)}static compare(e,t,n,r,i=-1){let a=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=li(a,o,n),c=new pi(a,s,i),l=new pi(o,s,i);n.iterGaps((e,t,n)=>mi(c,e,l,t,n,r)),n.empty&&n.length==0&&mi(c,0,l,0,0,r)}static eq(e,t,n=0,r){r??=999999999;let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),a=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=li(i,a),s=new pi(i,o,0).goto(n),c=new pi(a,o,0).goto(n);for(;;){if(s.to!=c.to||!hi(s.active,c.active)||s.point&&(!c.point||!ni(s.point,c.point)))return!1;if(s.to>r)return!0;s.next(),c.next()}}static spans(e,t,n,r,i=-1){let a=new pi(e,null,i).goto(t),o=t,s=a.openStart;for(;;){let e=Math.min(a.to,n);if(a.point){let n=a.activeForPoint(a.to),i=a.pointFrom<t?n.length+1:a.point.startSide<0?n.length:Math.min(n.length,s);r.point(o,e,a.point,n,i,a.pointRank),s=Math.min(a.openEnd(e),n.length)}else e>o&&(r.span(o,e,a.active,s),s=a.openEnd(e));if(a.to>n)return s+(a.point&&a.to>n?1:0);o=a.to,a.next()}}static of(e,t=!1){let n=new ci;for(let r of e instanceof ri?[e]:t?si(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=e.empty;i=i.nextLayer)n=new e(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}};oi.empty=new oi([],[],null,-1);function si(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(ii(t,r)>0)return e.slice().sort(ii);t=r}return e}oi.empty.nextLayer=oi.empty;var ci=class e{finishChunk(e){this.chunks.push(new ai(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,r){this.addInner(t,n,r)||(this.nextLayer||=new e).add(t,n,r)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(oi.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=oi.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function li(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let a=r.get(e.chunk[t]);a!=null&&(n?n.mapPos(a):a)==e.chunkPos[t]&&!n?.touchesRange(a,a+e.chunk[t].length)&&i.add(e.chunk[t])}return i}var ui=class{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},di=class e{constructor(e){this.heap=e}static from(t,n=null,r=-1){let i=[];for(let e=0;e<t.length;e++)for(let a=t[e];!a.isEmpty;a=a.nextLayer)a.maxPoint>=r&&i.push(new ui(a,n,r,e));return i.length==1?i[0]:new e(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)fi(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)fi(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),fi(this.heap,0)}}};function fi(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}var pi=class{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=di.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){gi(this.active,e),gi(this.activeTo,e),gi(this.activeRank,e),this.minActive=vi(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;_i(this.active,t,n),_i(this.activeTo,t,r),_i(this.activeRank,t,i),e&&_i(e,t,this.cursor.from),this.minActive=vi(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&gi(n,r)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let e=this.cursor.value;if(!e.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}};function mi(e,t,n,r,i,a){e.goto(t),n.goto(r);let o=r+i,s=r,c=r-t,l=!!a.boundChange;for(let t=!1;;){let r=e.to+c-n.to,i=r||e.endSide-n.endSide,u=i<0?e.to+c:n.to,d=Math.min(u,o);if(e.point||n.point?(e.point&&n.point&&ni(e.point,n.point)&&hi(e.activeForPoint(e.to),n.activeForPoint(n.to))||a.comparePoint(s,d,e.point,n.point),t=!1):(t&&a.boundChange(s),d>s&&!hi(e.active,n.active)&&a.compareRange(s,d,e.active,n.active),l&&d<o&&(r||e.openEnd(u)!=n.openEnd(u))&&(t=!0)),u>o)break;s=u,i<=0&&e.next(),i>=0&&n.next()}}function hi(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!ni(e[n],t[n]))return!1;return!0}function gi(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function _i(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function vi(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)(t[i]-r||e[i].endSide-e[n].endSide)<0&&(n=i,r=t[i]);return n}function yi(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)e.charCodeAt(i)==9?(r+=t-r%t,i++):(r++,i=Kn(e,i));return r}function bi(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=Kn(e,r)}return r===!0?-1:e.length}for(var xi=`ͼ`,Si=typeof Symbol>`u`?`__`+xi:Symbol.for(xi),Ci=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),wi=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},Ti=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,a,o){let s=[],c=/^@(\w+)\b/.exec(e[0]),l=c&&c[1]==`keyframes`;if(c&&t==null)return a.push(e[0]+`;`);for(let n in t){let o=t[n];if(/&/.test(n))i(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),o,a);else if(o&&typeof o==`object`){if(!c)throw RangeError(`The value of a property (`+n+`) should be a primitive value.`);i(r(n),o,s,l)}else o!=null&&s.push(n.replace(/_.*/,``).replace(/[A-Z]/g,e=>`-`+e.toLowerCase())+`: `+o+`;`)}(s.length||l)&&a.push((n&&!c&&!o?e.map(n):e).join(`, `)+` {`+s.join(` `)+`}`)}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join(`
|
|
716
|
-
`)}static newName(){let e=wi[Si]||1;return wi[Si]=e+1,xi+e.toString(36)}static mount(e,t,n){let r=e[Ci],i=n&&n.nonce;r?i&&r.setNonce(i):r=new Di(e,i),r.mount(Array.isArray(t)?t:[t],e)}},Ei=new Map,Di=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=Ei.get(n);if(t)return e[Ci]=t;this.sheet=new r.CSSStyleSheet,Ei.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[Ci]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t<e.length;t++){let a=e[t],o=this.modules.indexOf(a);if(o<i&&o>-1&&(this.modules.splice(o,1),i--,o=-1),o==-1){if(this.modules.splice(i++,0,a),n)for(let e=0;e<a.rules.length;e++)n.insertRule(a.rules[e],r++)}else{for(;i<o;)r+=this.modules[i++].rules.length;r+=a.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e=``;for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+`
|
|
717
|
-
`;this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute(`nonce`)!=e&&this.styleTag.setAttribute(`nonce`,e)}},Oi={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},ki={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},Ai=typeof navigator<`u`&&/Mac/.test(navigator.platform),ji=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Mi=0;Mi<10;Mi++)Oi[48+Mi]=Oi[96+Mi]=String(Mi);for(var Mi=1;Mi<=24;Mi++)Oi[Mi+111]=`F`+Mi;for(var Mi=65;Mi<=90;Mi++)Oi[Mi]=String.fromCharCode(Mi+32),ki[Mi]=String.fromCharCode(Mi);for(var Ni in Oi)ki.hasOwnProperty(Ni)||(ki[Ni]=Oi[Ni]);function Pi(e){var t=!(Ai&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ji&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?ki:Oi)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}function Fi(){var e=arguments[0];typeof e==`string`&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n==`object`&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i==`string`?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t<arguments.length;t++)Ii(e,arguments[t]);return e}function Ii(e,t){if(typeof t==`string`)e.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)Ii(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}var Li=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},Ri=typeof document<`u`?document:{documentElement:{style:{}}},zi=/Edge\/(\d+)/.exec(Li.userAgent),Bi=/MSIE \d/.test(Li.userAgent),Vi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Li.userAgent),Hi=!!(Bi||Vi||zi),Ui=!Hi&&/gecko\/(\d+)/i.test(Li.userAgent),Wi=!Hi&&/Chrome\/(\d+)/.exec(Li.userAgent),Gi=`webkitFontSmoothing`in Ri.documentElement.style,Ki=!Hi&&/Apple Computer/.test(Li.vendor),qi=Ki&&(/Mobile\/\w+/.test(Li.userAgent)||Li.maxTouchPoints>2),J={mac:qi||/Mac/.test(Li.platform),windows:/Win/.test(Li.platform),linux:/Linux|X11/.test(Li.platform),ie:Hi,ie_version:Bi?Ri.documentMode||6:Vi?+Vi[1]:zi?+zi[1]:0,gecko:Ui,gecko_version:Ui?+(/Firefox\/(\d+)/.exec(Li.userAgent)||[0,0])[1]:0,chrome:!!Wi,chrome_version:Wi?+Wi[1]:0,ios:qi,android:/Android\b/.test(Li.userAgent),webkit:Gi,webkit_version:Gi?+(/\bAppleWebKit\/(\d+)/.exec(Li.userAgent)||[0,0])[1]:0,safari:Ki,safari_version:Ki?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Li.userAgent)||[0,0])[1]:0,tabSize:Ri.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function Ji(e,t){for(let n in e)n==`class`&&t.class?t.class+=` `+e.class:n==`style`&&t.style?t.style+=`;`+e.style:t[n]=e[n];return t}var Yi=Object.create(null);function Xi(e,t,n){if(e==t)return!0;e||=Yi,t||=Yi;let r=Object.keys(e),i=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function Zi(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]??e.removeAttribute(r)}for(let n in t){let r=t[n];n==`style`?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function Qi(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i==`style`?e.style.cssText=``:e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i==`style`?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function $i(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}var ea=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},ta=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(ta||={}),na=class extends ti{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new ra(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new aa(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:a}=oa(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new aa(e,n,r,t,e.widget||null,!0)}static line(e){return new ia(e)}static set(e,t=!1){return oi.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};na.none=oi.empty;var ra=class e extends na{constructor(e){let{start:t,end:n}=oa(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?Ji(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Yi}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&Xi(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};ra.prototype.point=!1;var ia=class e extends na{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&Xi(this.spec.attributes,t.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError(`Line decoration ranges must be zero-length`);return super.range(e,t)}};ia.prototype.mapMode=$n.TrackBefore,ia.prototype.point=!0;var aa=class e extends na{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?$n.TrackBefore:$n.TrackAfter:$n.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?ta.WidgetBefore:ta.WidgetAfter:ta.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&sa(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError(`Invalid range for replacement decoration`);if(!this.isReplace&&t!=e)throw RangeError(`Widget decorations can only have zero-length ranges`);return super.range(e,t)}};aa.prototype.point=!0;function oa(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function sa(e,t){return e==t||!!(e&&t&&e.compare(t))}function ca(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}var la=class e extends ti{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&Xi(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||Yi)}static set(e,t=!1){return oi.of(e,t)}};la.prototype.startSide=la.prototype.endSide=-1;function ua(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function da(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function fa(e,t){if(!t.anchorNode)return!1;try{return da(e,t.anchorNode)}catch{return!1}}function pa(e){return e.nodeType==3?Oa(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function ma(e,t,n,r){return n?_a(e,t,n,r,-1)||_a(e,t,n,r,1):!1}function ha(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function ga(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function _a(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:va(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||n.nodeType!=1)return!1;t=ha(e)+(i<0?0:1),e=n}else if(e.nodeType==1){if(e=e.childNodes[t+(i<0?-1:0)],e.nodeType==1&&e.contentEditable==`false`)return!1;t=i<0?va(e):0}else return!1}}function va(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function ya(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function ba(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function xa(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Sa(e,t,n,r,i,a,o,s){let c=e.ownerDocument,l=c.defaultView||window;for(let u=e,d=!1;u&&!d;)if(u.nodeType==1){let e,f=u==c.body,p=1,m=1;if(f)e=ba(l);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(d=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let t=u.getBoundingClientRect();({scaleX:p,scaleY:m}=xa(u,t)),e={left:t.left,right:t.left+u.clientWidth*p,top:t.top,bottom:t.top+u.clientHeight*m}}let h=0,g=0;if(i==`nearest`)t.top<e.top+o?(g=t.top-(e.top+o),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(g=t.bottom-e.bottom+o,n<0&&t.top-g<e.top&&(g=t.top-(e.top+o)));else{let r=t.bottom-t.top,a=e.bottom-e.top;g=(i==`center`&&r<=a?t.top+r/2-a/2:i==`start`||i==`center`&&n<0?t.top-o:t.bottom-a+o)-e.top}if(r==`nearest`?t.left<e.left+a?(h=t.left-(e.left+a),n>0&&t.right>e.right+h&&(h=t.right-e.right+a)):t.right>e.right-a&&(h=t.right-e.right+a,n<0&&t.left<e.left+h&&(h=t.left-(e.left+a))):h=(r==`center`?t.left+(t.right-t.left)/2-(e.right-e.left)/2:r==`start`==s?t.left-a:t.right-(e.right-e.left)+a)-e.left,h||g)if(f)l.scrollBy(h,g);else{let e=0,n=0;if(g){let e=u.scrollTop;u.scrollTop+=g/m,n=(u.scrollTop-e)*m}if(h){let t=u.scrollLeft;u.scrollLeft+=h/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-h)<1&&(r=`nearest`),n&&Math.abs(n-g)<1&&(i=`nearest`)}if(f)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Ca(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(a.nodeType==1)!i&&a.scrollHeight>a.clientHeight&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var wa=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?va(t):0),n,Math.min(e.focusOffset,n?va(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}},Ta=null;J.safari&&J.safari_version>=26&&(Ta=!1);function Ea(e){if(e.setActive)return e.setActive();if(Ta)return e.focus(Ta);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Ta==null?{get preventScroll(){return Ta={preventScroll:!0},!0}}:void 0),!Ta){Ta=!1;for(let e=0;e<t.length;){let n=t[e++],r=t[e++],i=t[e++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=i&&(n.scrollLeft=i)}}}var Da;function Oa(e,t,n=t){let r=Da||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function ka(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let a=new KeyboardEvent(`keydown`,i);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent(`keyup`,i);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function Aa(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function ja(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,va(n));;)if(r){if(n.nodeType!=1)return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=va(n))}else if(n==e)return!0;else r=ha(n),n=n.parentNode}function Ma(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Na(e,t){for(let n=e,r=t;;)if(n.nodeType==3&&r>0)return{node:n,offset:r};else if(n.nodeType==1&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=va(n)}else if(n.parentNode&&!ga(n))r=ha(n),n=n.parentNode;else return null}function Pa(e,t){for(let n=e,r=t;;)if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};else if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!ga(n))r=ha(n)+1,n=n.parentNode;else return null}var Fa=class e{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(t,n){return new e(t.parentNode,ha(t),n)}static after(t,n){return new e(t.parentNode,ha(t)+1,n)}},Ia=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(Ia||={}),La=Ia.LTR,Ra=Ia.RTL;function za(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var Ba=za(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),Va=za(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),Ha=Object.create(null),Ua=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Ha[t]=n,Ha[n]=-t}function Wa(e){return e<=247?Ba[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Va[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var Ga=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Ka=class{get dir(){return this.level%2?Ra:La}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let a=0;a<e.length;a++){let o=e[a];if(o.from<=t&&o.to>=t){if(o.level==n)return a;(i<0||(r==0?e[i].level>o.level:r<0?o.from<t:o.to>t))&&(i=a)}}if(i<0)throw RangeError(`Index out of range`);return i}};function qa(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!qa(r.inner,i.inner))return!1}return!0}var Ja=[];function Ya(e,t,n,r,i){for(let a=0;a<=r.length;a++){let o=a?r[a-1].to:t,s=a<r.length?r[a].from:n,c=a?256:i;for(let t=o,n=c,r=c;t<s;t++){let i=Wa(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),Ja[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=Ja[e];if(i==128)e<s-1&&t==Ja[e+1]&&t&24?i=Ja[e]=t:Ja[e]=256;else if(i==64){let i=e+1;for(;i<s&&Ja[i]==64;)i++;let a=e&&t==8||i<n&&Ja[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)Ja[t]=a;e=i-1}else i==8&&r==1&&(Ja[e]=1);t=i,i&7&&(r=i)}}}function Xa(e,t,n,r,i){let a=i==1?2:1;for(let o=0,s=0,c=0;o<=r.length;o++){let l=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let t=l,n,r,o;t<u;t++)if(r=Ha[n=e.charCodeAt(t)])if(r<0){for(let e=s-3;e>=0;e-=3)if(Ua[e+1]==-r){let n=Ua[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(Ja[t]=Ja[Ua[e]]=r),s=e;break}}else if(Ua.length==189)break;else Ua[s++]=t,Ua[s++]=n,Ua[s++]=c;else if((o=Ja[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=Ua[t+2];if(n&2)break;if(e)Ua[t+2]|=2;else{if(n&4)break;Ua[t+2]|=4}}}}}function Za(e,t,n,r){for(let i=0,a=r;i<=n.length;i++){let o=i?n[i-1].to:e,s=i<n.length?n[i].from:t;for(let c=o;c<s;){let o=Ja[c];if(o==256){let o=c+1;for(;;)if(o==s){if(i==n.length)break;o=n[i++].to,s=i<n.length?n[i].from:t}else if(Ja[o]==256)o++;else break;let l=a==1,u=l==((o<t?Ja[o]:r)==1)?l?1:2:r;for(let t=o,r=i,a=r?n[r-1].to:e;t>c;)t==a&&(t=n[--r].from,a=r?n[r-1].to:e),Ja[--t]=u;c=o}else a=o,c++}}}function Qa(e,t,n,r,i,a,o){let s=r%2?2:1;if(r%2==i%2)for(let c=t,l=0;c<n;){let t=!0,u=!1;if(l==a.length||c<a[l].from){let e=Ja[c];e!=s&&(t=!1,u=e==16)}let d=!t&&s==1?[]:null,f=t?r:r+1,p=c;run:for(;;)if(l<a.length&&p==a[l].from){if(u)break run;let m=a[l];if(!t)for(let e=m.to,t=l+1;;){if(e==n)break run;if(t<a.length&&a[t].from==e)e=a[t++].to;else if(Ja[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new Ka(c,m.from,f)),$a(e,m.direction==La==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?Ja[p]!=s:Ja[p]==s))break;else p++;d?Qa(e,c,p,r+1,i,d,o):c<p&&o.push(new Ka(c,p,f)),c=p}else for(let c=n,l=a.length;c>t;){let n=!0,u=!1;if(!l||c>a[l-1].to){let e=Ja[c-1];e!=s&&(n=!1,u=e==16)}let d=!n&&s==1?[]:null,f=n?r:r+1,p=c;run:for(;;)if(l&&p==a[l-1].to){if(u)break run;let m=a[--l];if(!n)for(let e=m.from,n=l;;){if(e==t)break run;if(n&&a[n-1].to==e)e=a[--n].from;else if(Ja[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new Ka(m.to,c,f)),$a(e,m.direction==La==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?Ja[p-1]!=s:Ja[p-1]==s))break;else p--;d?Qa(e,p,c,r+1,i,d,o):p<c&&o.push(new Ka(p,c,f)),c=p}}function $a(e,t,n,r,i,a,o){let s=t%2?2:1;Ya(e,i,a,r,s),Xa(e,i,a,r,s),Za(i,a,r,s),Qa(e,i,a,t,n,r,o)}function eo(e,t,n){if(!e)return[new Ka(0,0,+(t==Ra))];if(t==La&&!n.length&&!Ga.test(e))return to(e.length);if(n.length)for(;e.length>Ja.length;)Ja[Ja.length]=256;let r=[],i=t==La?0:1;return $a(e,i,i,n,0,e.length,r),r}function to(e){return[new Ka(0,e,0)]}var no=``;function ro(e,t,n,r,i){let a=r.head-e.from,o=Ka.find(t,a,r.bidiLevel??-1,r.assoc),s=t[o],c=s.side(i,n);if(a==c){let e=o+=i?1:-1;if(e<0||e>=t.length)return null;s=t[o=e],a=s.side(!i,n),c=s.side(i,n)}let l=Kn(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),no=e.text.slice(Math.min(a,l),Math.max(a,l));let u=o==(i?t.length-1:0)?null:t[o+(i?1:-1)];return u&&l==c&&u.level+ +!i<s.level?K.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level):K.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function io(e,t,n){for(let r=t;r<n;r++){let t=Wa(e.charCodeAt(r));if(t==1)return La;if(t==2||t==4)return Ra}return La}var ao=q.define(),oo=q.define(),so=q.define(),co=q.define(),lo=q.define(),uo=q.define(),fo=q.define(),po=q.define(),mo=q.define(),ho=q.define({combine:e=>e.some(e=>e)}),go=q.define({combine:e=>e.some(e=>e)}),_o=q.define(),vo=class e{constructor(e,t,n,r,i,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=a}map(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new e(K.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},yo=Rr.define({map:(e,t)=>e.map(t)}),bo=Rr.define();function xo(e,t,n){let r=e.facet(co);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+`:`,t):console.error(t))}var So=q.define({combine:e=>e.length?e[0]:!0}),Co=0,wo=q.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}}),To=class e{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(wo.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(wo.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(Co++,t,r,i,e=>{let t=[];return o&&t.push(ko.of(t=>{let n=t.plugin(e);return n?o(n):na.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},Eo=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(!this.value){if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){xo(e.state,t,`CodeMirror plugin crashed`),this.deactivate()}}else if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(xo(e.state,t,`CodeMirror plugin crashed`),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){xo(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},Do=q.define(),Oo=q.define(),ko=q.define(),Ao=q.define(),jo=q.define(),Mo=q.define(),No=q.define();function Po(e,t){let n=e.state.facet(No);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return oi.spans(r,t.from,t.to,{point(){},span(e,n,r,a){let o=e-t.from,s=n-t.from,c=i;for(let e=r.length-1;e>=0;e--,a--){let n=r[e].spec.bidiIsolate,i;if(n??=io(t.text,o,s),a>0&&c.length&&(i=c[c.length-1]).to==o&&i.direction==n)i.to=s,c=i.inner;else{let e={from:o,to:s,direction:n,inner:[]};c.push(e),c=e.inner}}}}),i}var Fo=q.define();function Io(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(Fo)){let o=a(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:t,right:n,top:r,bottom:i}}var Lo=q.define(),Ro=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let i=0,a=0,o=0;;){let s=i<t.length?t[i].fromB:1e9,c=a<n.length?n[a]:1e9,l=Math.min(s,c);if(l==1e9)break;let u=l+o,d=l,f=u;for(;;)if(a<n.length&&n[a]<=d){let e=n[a+1];a+=2,d=Math.max(d,e);for(let e=i;e<t.length&&t[e].fromB<=d;e++)o=t[e].toA-t[e].toB;f=Math.max(f,e+o)}else if(i<t.length&&t[i].fromB<=d){let e=t[i++];d=Math.max(d,e.toB),f=Math.max(f,e.toA),o=e.toA-e.toB}else break;r.push(new e(u,f,l,d))}return r}},zo=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=tr.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new Ro(e,t,n,i))),this.changedRanges=r}static create(t,n,r){return new e(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Bo=[],Vo=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Bo}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&Zi(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:``)+(this.breakAfter?`#`:``)}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError(`Invalid child in posBefore`)}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=ha(this.dom),r=this.length?e>0:t>0;return new Fa(this.parent.dom,n+ +!!r,e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Wo)return e;return null}static get(e){return e.cmTile}},Ho=class extends Vo{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,i=e?.node==t?e:null,a=0;for(let o of this.children){if(o.sync(e),a+=o.length+o.breakAfter,r=n?n.nextSibling:t.firstChild,i&&r!=o.dom&&(i.written=!0),o.dom.parentNode==t)for(;r&&r!=o.dom;)r=Uo(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=Uo(r);this.length=a}};function Uo(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Wo=class extends Ho{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Vo.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let a=n.children[r++];if(a instanceof Go)t.push(r),n=a,r=0;else{let t=i+a.length,n=e(a,i);if(n!==void 0)return n;i=t+a.breakAfter}}}resolveBlock(e,t){let n,r=-1,i,a=-1;if(this.blockTiles((o,s)=>{let c=s+o.length;if(e>=s&&e<=c){if(o.isWidget()&&t>=-1&&t<=1){if(o.flags&32)return!0;o.flags&16&&(n=void 0)}(s<e||e==c&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-s),(c>e||e==s&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,a=e-s)}}),!n&&!i)throw Error(`No tile at position `+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:a}}},Go=class e extends Ho{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},Ko=class e extends Ho{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,n,r){let i=new e(n||document.createElement(`div`),t);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n){let r=null,i=-1,a=null,o=-1;function s(e,c){for(let l=0,u=0;l<e.children.length&&u<=c;l++){let d=e.children[l],f=u+d.length;f>=c&&(d.isComposite()?s(d,c-u):(!a||a.isHidden&&(t>0||n&&Jo(a,d)))&&(f>c||d.flags&32)?(a=d,o=c-u):(u<c||d.flags&16&&!d.isHidden)&&(r=d,i=c-u)),u=f}}s(this,e);let c=(t<0?r:a)||r||a;return c?{tile:c,offset:c==r?i:o}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):qo(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new Fa(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,e.flags&16?1:e.flags&32?-1:t);let i=n.tile.parent,a=!1;for(let e of i.children){if(a)return new Fa(e.dom,0);e==n.tile&&(a=!0)}}return new Fa(this.dom,0)}};function qo(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=pa(t);return n[n.length-1]||null}function Jo(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var Yo=class e extends Ho{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},Xo=class e extends Vo{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let r=e,i=e,a=0;e==0&&t<0||e==n&&t>=0?J.chrome||J.gecko||(e?(r--,a=1):i<n&&(i++,a=-1)):t<0?r--:i<n&&i++;let o=Oa(this.dom,r,i).getClientRects();if(!o.length)return null;let s=o[(a?a<0:t>=0)?0:o.length-1];return J.safari&&!a&&s.width==0&&(s=Array.prototype.find.call(o,e=>e.width)||s),a?ya(s,a<0):s||null}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},Zo=class e extends Vo{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return ya(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=this.flags&16?!0:this.flags&32?!1:e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?i==0:i==t.length-1||n.top<n.bottom);i+=r?-1:1);return ya(n,!r)}}get overrideDOMText(){if(!this.length)return Fn.empty;let{root:e}=this;if(!e)return Fn.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,i,a){return a||(a=t.toDOM(n),t.editable||(a.contentEditable=`false`)),new e(a,r,t,i)}},Qo=class extends Vo{constructor(e){let t=document.createElement(`img`);t.className=`cm-widgetBuffer`,t.setAttribute(`aria-hidden`,`true`),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return Fn.empty}coordsIn(e){return this.dom.getBoundingClientRect()}},$o=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:a,parents:o}=this;for(;e||t>0;)if(!r.isComposite())if(i==r.length)a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++;else if(e){let t=Math.min(e,r.length-i);n&&n.skip(r,i,i+t),e-=t,i+=t}else break;else if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(i==r.children.length){if(!e&&!o.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++}else{let s=r.children[i],c=s.breakAfter;(t>0?s.length<=e:s.length<e)&&(!n||n.skip(s,0,s.length)!==!1||!s.isComposite)?(a=!!c,i++,e-=s.length):(o.push({tile:r,index:i}),r=s,i=0,n&&s.isComposite()&&n.enter(s))}return this.tile=r,this.index=i,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},es=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},ts=class{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){this.flushBuffer();let i=this.ensureMarks(t,n),a=i.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let t=i.children[i.children.length-1]=new Xo(a.dom,a.text+e);t.parent=i}else i.append(r||Xo.of(e,this.cache.find(Xo)?.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?ds(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof Yo&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(ds(n.dom)),r=i;else{if(this.cache.reused.get(n)){let e=Vo.get(n.dom);e&&e.setDOM(ds(n.dom))}let e=Yo.of(n.mark,n.dom);r.append(e),r=e}this.cache.reused.set(n,2)}let i=Vo.get(e.text);i&&this.cache.reused.set(i,2);let a=new Xo(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let i=this.ensureMarks(t,n);!r&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){e||=cs;let n=Ko.start(e,t||this.cache.find(Ko)?.dom,!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){let n=this.curLine;for(let r=e.length-1;r>=0;r--){let i=e[r],a;if(t>0&&(a=n.lastChild)&&a instanceof Yo&&a.mark.eq(i))n=a,t--;else{let e=Yo.of(i,this.cache.find(Yo,e=>e.mark.eq(i))?.dom);n.append(e),n=e,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!os(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(J.ios&&os(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(ps,0,32)||new Zo(ps.toDOM(),0,ps,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new es(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){this.updateBlockWrappers();let e=this.root;for(let t of this.wrappers){let n=e.lastChild;if(t.from<this.pos&&n instanceof Go&&n.wrapper.eq(t.wrapper))e=n;else{let n=Go.of(t.wrapper,this.cache.find(Go,e=>e.wrapper.eq(t.wrapper))?.dom);e.append(n),e=n}}return e}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(Qo,void 0,1);return n&&(n.flags=t),n||new Qo(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},ns=class{constructor(e){this.skipCount=0,this.text=``,this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text=``,this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error(`Ran out of text content when drawing inline views`);this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},rs=[Zo,Ko,Xo,Yo,Qo,Go,Wo];for(let e=0;e<rs.length;e++)rs[e].bucket=e;var is=class{constructor(e){this.view=e,this.buckets=rs.map(()=>[]),this.index=rs.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],a=this.index[r];for(let e=i.length-1;e>=0;e--){let o=(e+a)%i.length,s=i[o];if((!t||t(s))&&!this.reused.has(s))return i.splice(o,1),o<a&&this.index[r]--,this.reused.set(s,n),s}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,a=0;;i++){if(i==r.length){if(a)return null;a=1,i=0}let o=r[i];if(!this.reused.has(o)&&(a==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(o.flags&497)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new Zo(o.dom,t,e,o.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},as=class{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new is(e),this.text=new ns(e.state.doc),this.builder=new ts(this.cache,new Wo(e,e.contentDOM),oi.iter(n)),this.cache.reused.set(t,2),this.old=new $o(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,a=0;;){let o=a<e.length?e[a++]:null,s=o?o.fromA:this.old.root.length;if(s>r){let e=s-r;this.preserve(e,!a,!o),r=s,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,r=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=us(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(n-t);else{let a=n>0||t<e.length?Zo.of(e.widget,this.view,n-t,e.flags&496,this.cache.maybeReuse(e)):this.cache.reuse(e);a.flags&256?(a.flags&=-2,this.builder.addBlockWidget(a)):(this.builder.ensureLine(null),this.builder.addInlineWidget(a,r,i),i=r.length)}else if(e.isText())this.builder.ensureLine(null),!t&&n==e.length&&!this.cache.reused.has(e)?this.builder.addText(e.text,r,i,this.cache.reuse(e)):(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof Qo)this.cache.add(e);else if(e instanceof Yo)this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length;else return!1;this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof Yo&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof Yo&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=0,a=oi.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof aa){if(this.disallowBlockEffectsFor[c]){if(a.block)throw RangeError(`Block decorations may not be specified via plugins`);if(t>this.view.state.doc.lineAt(e).to)throw RangeError(`Decorations that replace line breaks may not be specified via plugins`)}if(i=o.length,s>o.length)r.continueWidget(t-e);else{let i=a.widget||(a.block?fs.block:fs.inline),c=ss(a),l=this.cache.findWidget(i,t-e,c)||Zo.of(i,this.view,t-e,c);a.block?(a.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(l)):(r.ensureLine(n),r.addInlineWidget(l,o,s))}n=null}else n=ls(n,a);t>e&&this.text.skip(t-e)},span:(e,t,i,a)=>{for(let o=e;o<t;){let s=this.text.next(Math.min(512,t-o));s==null?(r.addLineStartIfNotCovered(n),r.addBreak(),o++):(r.ensureLine(n),r.addText(s,i,o==e?a:i.length),o+=s.length),n=null}}});r.addLineStartIfNotCovered(n),this.openWidget=a>i,this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=Vo.get(r);if(r==this.view.contentDOM)break;e instanceof Yo?t.push(e):e?.isLine()?n=e:e instanceof Go||(r.nodeName==`DIV`&&!n&&r!=this.view.contentDOM?n=new Ko(r,cs):n||t.push(Yo.of(new ra({tagName:r.nodeName.toLowerCase(),attributes:$i(r)}),r)))}return{line:n,marks:t}}};function os(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function ss(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}var cs={class:`cm-line`};function ls(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r?e:(e||={class:`cm-line`},n&&Ji(n,e),r&&(e.class+=` `+r),e)}function us(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof Yo&&t.push(r.mark)}return t}function ds(e){let t=Vo.get(e);return t&&t.setDOM(e.cloneNode()),e}var fs=class extends ea{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};fs.inline=new fs(`span`),fs.block=new fs(`div`);var ps=new class extends ea{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},ms=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=na.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Wo(e,e.contentDOM),this.updateInner([new Ro(0,0,0,e.state.doc.length)],null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?n=this.domChanged.newSel.head:!Ts(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?vs(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new Ro(n,r,e.changes.mapPos(n,-1),e.changes.mapPos(r,1)).addToSet(t.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(J.ie||J.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,a=this.blockWrappers;this.updateDeco();let o=xs(i,this.decorations,e.changes);o.length&&(t=Ro.extendWithRanges(t,o));let s=Cs(a,this.blockWrappers,e.changes);return s.length&&(t=Ro.extendWithRanges(t,s)),r&&!t.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(t=r.range.addToSet(t.slice())),this.tile.flags&2&&t.length==0?!1:(this.updateInner(t,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new as(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Vo.get(t.text)&&r.cache.reused.set(Vo.get(t.text),2),this.tile=r.run(e,t),hs(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+`px`,this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+`px`:``;let r=J.chrome||J.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=``});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof Es&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(bo)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,i=r==n,a=!i&&!(this.view.state.facet(So)||n.tabIndex>-1)&&fa(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||a))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,c,l;if(s.empty?l=c=this.inlineDOMNearPos(s.anchor,s.assoc||1):(l=this.inlineDOMNearPos(s.head,s.head==s.from?1:-1),c=this.inlineDOMNearPos(s.anchor,s.anchor==s.from?1:-1)),J.gecko&&s.empty&&!this.hasComposition&&gs(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new Fa(e,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!ma(c.node,c.offset,u.anchorNode,u.anchorOffset)||!ma(l.node,l.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,s))&&(this.view.observer.ignore(()=>{J.android&&J.chrome&&n.contains(u.focusNode)&&ws(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=ua(this.view.root);if(e)if(s.empty){if(J.gecko){let e=ys(c.node,c.offset);if(e&&e!=3){let t=(e==1?Na:Pa)(c.node,c.offset);t&&(c=new Fa(t.node,t.offset))}}e.collapse(c.node,c.offset),s.bidiLevel!=null&&e.caretBidiLevel!==void 0&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(c.node,c.offset);try{e.extend(l.node,l.offset)}catch{}}else{let t=document.createRange();s.anchor>s.head&&([c,l]=[l,c]),t.setEnd(l.node,l.offset),t.setStart(c.node,c.offset),e.removeAllRanges(),e.addRange(t)}a&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new Fa(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new Fa(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ma(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=ua(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let o=a.posAtStart;if(t.head==o||t.head==o+a.length)return;let s=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!s||!c||s.bottom>c.top)return;let l=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(l.node,l.offset),n.modify(`move`,t.assoc<0?`forward`:`backward`,`lineboundary`),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=va(e)==0?0:t==0?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;r==0&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!Vo.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,a,o=-1,s=!1;return this.tile.blockTiles((t,c)=>{if(t.isWidget()){if(t.flags&32&&c>=e)return!0;t.flags&16&&(i=!0)}else{let l=c+t.length;if(c<=e&&(n=t,r=e-c,i=l<e),l>=e&&!a&&(a=t,o=e-c,s=c>e),c>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(i&&a?n=null:s&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(o,t))}coordsAt(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof Es?null:n.coordsInWidget(r,t,!0):n.coordsIn(r,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(e,t){if(e.isComposite())for(let n of e.children){if(n.length>=t){let e=r(n,t);if(e)return e}if(t-=n.length,t<0)break}else if(e.isText()&&t<e.length){let n=Kn(e.text,t);if(n==t)return null;let r=Oa(e.dom,t,n).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}return r(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,s=this.view.textDirection==Ia.LTR,c=0,l=(e,u,d)=>{for(let f=0;f<e.children.length&&!(u>r);f++){let r=e.children[f],p=u+r.length,m=r.dom.getBoundingClientRect(),{height:h}=m;if(d&&!f&&(c+=m.top-d.top),r instanceof Go)p>n&&l(r,u,m);else if(u>=n&&(c>0&&t.push(-c),t.push(h+c),c=0,a)){let e=r.dom.lastChild,t=e?pa(e):[];if(t.length){let e=t[t.length-1],n=s?e.right-m.left:m.right-e.left;n>o&&(o=n,this.minWidth=i,this.minWidthFrom=u,this.minWidthTo=p)}}d&&f==e.children.length-1&&(c+=d.bottom-m.bottom),u=p+r.breakAfter}};return l(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction==`rtl`?Ia.RTL:Ia.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=pa(r.dom);if(e.length!=1)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement(`div`),n,r,i;return t.className=`cm-line`,t.style.width=`99999px`,t.style.position=`absolute`,t.textContent=`abc def ghi jkl mno pqr stu`,this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let e=pa(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,i=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],a=i?i.from-1:this.view.state.doc.length;if(a>n){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(na.replace({widget:new Es(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return na.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ko).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(jo).map((e,t)=>{let r=typeof e==`function`;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(oi.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Ao).map(e=>typeof e==`function`?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(_o))try{if(t(this.view,e.range,e))return!0}catch(e){xo(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc??(t.empty?0:t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=Io(this.view),a={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:o,offsetHeight:s}=this.view.scrollDOM;if(Sa(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,s),-s),this.view.textDirection==Ia.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(t.head,1);e&&e.dom.scrollIntoView({block:`nearest`})}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){hs(this.tile)}};function hs(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)hs(n,t)}}function gs(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable==`false`)&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable==`false`)}function _s(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Na(n.focusNode,n.focusOffset),i=Pa(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=Vo.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=Vo.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(a=i)}}if(e.docView.lastCompositionAfterCursor=a!=r,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function vs(e,t,n){let r=_s(e,n);if(!r)return null;let{node:i,from:a,to:o}=r,s=i.nodeValue;if(/[\n\r]/.test(s)||e.state.doc.sliceString(r.from,r.to)!=s)return null;let c=t.invertedDesc;return{range:new Ro(c.mapPos(a),c.mapPos(o),a,o),text:i}}function ys(e,t){return e.nodeType==1?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var bs=class{constructor(){this.changes=[]}compareRange(e,t){ca(e,t,this.changes)}comparePoint(e,t){ca(e,t,this.changes)}boundChange(e){ca(e,e,this.changes)}};function xs(e,t,n){let r=new bs;return oi.compare(e,t,n,r),r.changes}var Ss=class{constructor(){this.changes=[]}compareRange(e,t){ca(e,t,this.changes)}comparePoint(){}boundChange(e){ca(e,e,this.changes)}};function Cs(e,t,n){let r=new Ss;return oi.compare(e,t,n,r),r.changes}function ws(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable==`false`)return!0;return!1}function Ts(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var Es=class extends ea{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement(`div`);return e.className=`cm-gap`,this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+`px`,!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function Ds(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return K.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=Kn(i.text,a,!1):s=Kn(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=Kn(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=Kn(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return K.range(o+i.from,s+i.from)}function Os(e,t,n,r,i){let a=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let t=e.viewState.heightOracle.textHeight,r=Math.floor((i-n.top-(e.defaultLineHeight-t)*.5)/t);a+=r*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+bi(o,a,e.state.tabSize)}function ks(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!e||i.type==ta.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function As(e,t,n,r){let i=ks(e,t.head,t.assoc||-1),a=!r||i.type!=ta.Text||!(e.lineWrapping||i.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head);if(a){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),o=e.posAtCoords({x:n==(r==Ia.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o!=null)return K.cursor(o,n?-1:1)}return K.cursor(n?i.to:i.from,n?-1:1)}function js(e,t,n,r){let i=e.state.doc.lineAt(t.head),a=e.bidiSpans(i),o=e.textDirectionAt(i.from);for(let s=t,c=null;;){let t=ro(i,a,o,s,n),l=no;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`
|
|
718
|
-
`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function Ms(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==Jr.Space&&(i=t),i==t}}function Ns(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return K.cursor(i,t.assoc);let o=t.goalColumn,s,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(l)o??=l.left-c.left,s=a<0?l.top:l.bottom;else{let t=e.viewState.lineBlockAt(i);o??=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-t.from)),s=(a<0?t.top:t.bottom)+u}let d=c.left+o,f=e.viewState.heightOracle.textHeight>>1,p=r??f;for(let t=0;;t+=f){let r=s+(p+t)*a,i=Rs(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return K.cursor(i.pos,i.assoc);let l=e.coordsAtPos(i.pos,i.assoc),u=l?(l.top+l.bottom)/2:0;if(!l||(n?u>s:u<s))return K.cursor(i.pos,i.assoc,void 0,o)}}function Ps(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,a)=>{if(t>e&&t<i){let a=r||n||(t-e<i-t?-1:1);t=a<0?e:i,r=a}});if(!r)return t}}function Fs(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],a=null;if(i.empty){let t=Ps(e,i.from,0);t!=i.from&&(a=K.cursor(t,-1))}else{let t=Ps(e,i.from,-1),n=Ps(e,i.to,1);(t!=i.from||n!=i.to)&&(a=K.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?K.create(n,t.mainIndex):t}function Is(e,t,n){let r=Ps(e.state.facet(Mo).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:K.cursor(r,r<n.from?1:-1)}var Ls=class{constructor(e,t){this.pos=e,this.assoc=t}};function Rs(e,t,n,r){let i=e.contentDOM.getBoundingClientRect(),a=i.top+e.viewState.paddingTop,{x:o,y:s}=t,c=s-a,l;for(;;){if(c<0)return new Ls(0,1);if(c>e.viewState.docHeight)return new Ls(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==ta.Text){if(r<0?l.to<e.viewport.from:l.from>e.viewport.to)break;let t=e.docView.coordsAt(r<0?l.from:l.to,r>0?-1:1);if(t&&(r<0?t.top<=c+a:t.bottom>=c+a))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?l.bottom+t:l.top-t}if(e.viewport.from>=l.to||e.viewport.to<=l.from){if(n)return null;if(l.type==ta.Text){let t=Os(e,i,l,o,s);return new Ls(t,t==l.from?1:-1)}}if(l.type!=ta.Text)return c<(l.top+l.bottom)/2?new Ls(l.from,1):new Ls(l.to,-1);let u=e.docView.lineAt(l.from,2);return(!u||u.length!=l.length)&&(u=e.docView.lineAt(l.from,-2)),new zs(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var zs=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Ka.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Ka.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,i=e.length-1,a=new Set,o=this.bidiIn(e[0],e[i]),s,c,l=-1,u=1e9,d;search:for(;r<i;){let n=i-r,f=r+i>>1;adjust:if(a.has(f)){let e=r+Math.floor(Math.random()*n);for(let t=0;t<n;t++){if(!a.has(e)){f=e;break adjust}e++,e==i&&(e=r)}break search}a.add(f);let p=t(f);if(p)for(let t=0;t<p.length;t++){let n=p[t],a=0;if(!(n.width==0&&p.length>1)){if(n.bottom<this.y)(!s||s.bottom<n.bottom)&&(s=n),a=1;else if(n.top>this.y)(!c||c.top>n.top)&&(c=n),a=-1;else{let e=n.left>this.x?this.x-n.left:n.right<this.x?this.x-n.right:0,t=Math.abs(e);t<u&&(l=f,u=t,d=n),e&&(a=e<0==(this.baseDir==Ia.LTR)?-1:1)}a==-1&&(!o||this.baseDirAt(e[f],1))?i=f:a==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}}}if(!d){let n=s&&(!c||this.y-s.bottom<c.top-this.y)?s:c;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:n,bottom:r}=d;if(s&&s.bottom>(n+n+r)/3)return this.y=s.bottom-1,this.scan(e,t,!0);if(c&&c.top<(n+r+r)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(o?this.dirAt(e[l],1):this.baseDir)==Ia.LTR;return{i:l,after:this.x>(d.left+d.right)/2==f}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=Kn(e.text,r))n.push(t+r);n.push(t+e.length);let r=this.scan(n,r=>{let i=n[r]-t,a=n[r+1]-t;return Oa(e.dom,i,a).getClientRects()});return r.after?new Ls(n[r.i+1],-1):new Ls(n[r.i],1)}scanTile(e,t){if(!e.length)return new Ls(t,1);if(e.children.length==1){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r<e.children.length;r++)n.push(i+=e.children[r].length);let r=this.scan(n,t=>{let n=e.children[t];return n.flags&48?null:(n.dom.nodeType==1?n.dom:Oa(n.dom,0,n.length)).getClientRects()}),i=e.children[r.i],a=n[r.i];return i.isText()?this.scanText(i,a):i.isComposite()?this.scanTile(i,a):r.after?new Ls(n[r.i+1],-1):new Ls(a,1)}},Bs=``,Vs=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet($r.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Bs}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=Vo.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=Vo.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:ga(r))||ga(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!Us(a,t)&&this.lineBreak(),r=a}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(o=r.exec(t))&&(i=o.index,a=o[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=a-1);n=i+a}}readNode(e){let t=Vo.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Hs(e,n.node,n.offset)?t:0))}};function Hs(e,t,n){for(;;){if(!t||n<va(t))return!1;if(t==e)return!0;n=ha(t)+1,t=t.parentNode}}function Us(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let t=Vo.get(e);if(!t?.isWidget())return!1;t&&(n||=[]).push(t)}if(n){for(let e of n)if(e.overrideDOMText?.length)return!1}return!0}var Ws=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},Gs=class{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text=``,this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView,o=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Ks(e.docView.tile,t,n,0))){let t=i||a?[]:Zs(e),n=new Vs(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=Qs(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!da(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!da(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((J.ios||J.chrome)&&o.main.empty&&n!=r&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),a=s.from-t,o=s.to-i;(a==0||a==1||t==0)&&(o==0||o==-1||i==e.state.doc.length)&&(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(K.range(r,n));else if(e.lineWrapping&&r==n&&!(o.main.empty&&o.main.head==n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=K.create([K.cursor(n,r)])}else this.newSel=K.single(r,n)}}};function Ks(e,t,n,r){if(e.isComposite()){let i=-1,a=-1,o=-1,s=-1;for(let c=0,l=r,u=r;c<e.children.length;c++){let r=e.children[c],d=l+r.length;if(l<t&&d>n)return Ks(r,t,n,l);if(d>=t&&i==-1&&(i=c,a=l),l>n&&r.dom.parentNode==e.dom){o=c,s=u;break}u=d,l=d+r.breakAfter}return{from:a,to:s<0?r+e.length:s,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else if(e.isText())return{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling};else return null}function qs(e,t){let n,{newSel:r}=t,{state:i}=e,a=i.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,s=a.from,c=null;(o===8||J.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,Bs),u,d;!a.empty&&a.from>=e&&a.to<=r&&(t.typeOver||l!=t.text)&&l.slice(0,a.from-e)==t.text.slice(0,a.from-e)&&l.slice(a.to-e)==t.text.slice(u=t.text.length-(l.length-(a.to-e)))?n={from:a.from,to:a.to,insert:Fn.of(t.text.slice(a.from-e,u).split(Bs))}:(d=Xs(l,t.text,s-e,c))&&(J.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==Bs+Bs&&d.toB--,n={from:e+d.from,to:e+d.toA,insert:Fn.of(t.text.slice(d.from,d.toB).split(Bs))})}else r&&(!e.hasFocus&&i.facet(So)||$s(r,a))&&(r=null);if(!n&&!r)return!1;if((J.mac||J.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute(`autocorrect`)==`off`?(r&&n.insert.length==2&&(r=K.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Fn.of([n.insert.toString().replace(`.`,` `)])}):i.doc.lineAt(a.from).to<a.to&&e.docView.lineHasWidget(a.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:a.from,to:a.to,insert:i.toText(e.inputState.insertingText)}:J.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
|
|
719
|
-
`&&e.lineWrapping&&(r&&=K.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:Fn.of([` `])}),n)return Js(e,n,r,o);if(r&&!$s(r,a)){let t=!1,n=`select`;return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin==`select`&&(t=!0),n=e.inputState.lastSelectionOrigin,n==`select.pointer`&&(r=Fs(i.facet(Mo).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}else return!1}function Js(e,t,n,r=-1){if(J.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(J.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==` `)&&t.insert.length==1&&t.insert.lines==2&&ka(e.contentDOM,`Enter`,13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&ka(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&ka(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=Ys(e,t,n);return e.state.facet(uo).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function Ys(e,t,n){let r,i=e.state,a=i.selection.main,o=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let n=t.from<a.from?-1:1,r=n<0?a.from:a.to,s=Ps(i.facet(Mo).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:K.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=a.from<t.from?i.sliceDoc(a.from,t.from):``,o=a.to>t.to?i.sliceDoc(t.to,a.to):``;r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=i.changes(t),s=n&&n.main.to<=o.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let c=e.state.sliceDoc(t.from,t.to),l,u=n&&_s(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(a.head);let d=a.to-t.to;r=i.changeByRange(n=>{if(n.from==a.from&&n.to==a.to)return{changes:o,range:s||n.map(o)};let r=n.to-d,u=r-c.length;if(e.state.sliceDoc(u,r)!=c||r>=l.from&&u<=l.to)return{range:n};let f=i.changes({from:u,to:r,insert:t.insert}),p=n.to-a.to;return{changes:f,range:s?K.range(Math.max(0,s.anchor+p),Math.max(0,s.head+p)):n.map(f)}})}else r={changes:o,selection:s&&i.selection.replaceRange(s)}}let s=`input.type`;return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=`.compose`,e.inputState.compositionFirstChange&&(s+=`.start`,e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:s,scrollIntoView:!0})}function Xs(e,t,n,r){let i=Math.min(e.length,t.length),a=0;for(;a<i&&e.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==i&&e.length==t.length)return null;let o=e.length,s=t.length;for(;o>0&&s>0&&e.charCodeAt(o-1)==t.charCodeAt(s-1);)o--,s--;if(r==`end`){let e=Math.max(0,a-Math.min(o,s));n-=o+e-a}if(o<a&&e.length<t.length){let e=n<=a&&n>=o?a-n:0;a-=e,s=a+(s-o),o=a}else if(s<a){let e=n<=a&&n>=s?a-n:0;a-=e,o=a+(o-s),s=a}return{from:a,toA:o,toB:s}}function Zs(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}=e.observer.selectionRange;return n&&(t.push(new Ws(n,r)),(i!=n||a!=r)&&t.push(new Ws(i,a))),t}function Qs(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n>-1&&r>-1?K.single(n+t,r+t):null}function $s(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var ec=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText=``,this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,J.safari&&e.contentDOM.addEventListener(`input`,()=>null),J.gecko&&Ic(e.contentDOM.ownerDocument)}handleEvent(e){!pc(this.view,e)||this.ignoreDuringComposition(e)||e.type==`keydown`&&this.keydown(e)||(this.view.updateState==0?this.runHandlers(e.type,e):Promise.resolve().then(()=>this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=nc(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if(e!=`scroll`){let i=!t[e].handlers.length,a=n[e];a&&i!=!a.handlers.length&&(r.removeEventListener(e,this.handleEvent),a=null),a||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)e!=`scroll`&&!t[e]&&r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&ac.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),J.android&&J.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return J.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((t=rc.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||ic.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key==`Enter`&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,ka(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:J.safari&&!J.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function tc(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){xo(n.state,e)}}}function nc(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(tc(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(tc(t.value,r))}}for(let e in mc)n(e).handlers.push(mc[e]);for(let e in hc)n(e).observers.push(hc[e]);return t}var rc=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],ic=`dthko`,ac=[16,17,18,20,91,92,224,225],oc=6;function sc(e){return Math.max(0,e)*.7+8}function cc(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var lc=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Ca(e.contentDOM),this.atoms=e.state.facet(Mo).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener(`mousemove`,this.move=this.move.bind(this)),i.addEventListener(`mouseup`,this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet($r.allowMultipleSelections)&&uc(e,t),this.dragging=fc(e,t)&&Tc(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&cc(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let s=Io(this.view);e.clientX-s.left<=r+oc?t=-sc(r-e.clientX):e.clientX+s.right>=a-oc&&(t=sc(e.clientX-a)),e.clientY-s.top<=i+oc?n=-sc(i-e.clientY):e.clientY+s.bottom>=o-oc&&(n=sc(e.clientY-o)),this.setScrollSpeed(t,n)}up(e){this.dragging??this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener(`mousemove`,this.move),e.removeEventListener(`mouseup`,this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Fs(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:`select.pointer`}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent(`input.type`))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function uc(e,t){let n=e.state.facet(ao);return n.length?n[0](t):J.mac?t.metaKey:t.ctrlKey}function dc(e,t){let n=e.state.facet(oo);return n.length?n[0](t):J.mac?!t.altKey:!t.ctrlKey}function fc(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=ua(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function pc(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Vo.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var mc=Object.create(null),hc=Object.create(null),gc=J.ie&&J.ie_version<15||J.ios&&J.webkit_version<604;function _c(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement(`textarea`));n.style.cssText=`position: fixed; left: -10000px; top: 10px`,n.focus(),setTimeout(()=>{e.focus(),n.remove(),yc(e,n.value)},50)}function vc(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function yc(e,t){t=vc(e.state,po,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(jc!=null&&n.selection.ranges.every(e=>e.empty)&&jc==a.toString()){let e=-1;r=n.changeByRange(r=>{let s=n.doc.lineAt(r.from);if(s.from==e)return{range:r};e=s.from;let c=n.toText((o?a.line(i++).text:t)+n.lineBreak);return{changes:{from:s.from,insert:c},range:K.cursor(r.from+c.length)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:K.cursor(e.from+t.length)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}hc.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},hc.wheel=hc.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},mc.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),hc.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},hc.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},mc.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(so))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Ec(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new lc(e,t,n,r)),r&&e.observer.ignore(()=>{Ea(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin(`select.pointer`);return!1};function bc(e,t,n,r){if(r==1)return K.cursor(t,n);if(r==2)return Ds(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),a=r?r.posAtStart:i.from,o=r?r.posAtEnd:i.to;return o<e.state.doc.length&&o==i.to&&o++,K.range(a,o)}}var xc=J.ie&&J.ie_version<=11,Sc=null,Cc=0,wc=0;function Tc(e){if(!xc)return e.detail;let t=Sc,n=wc;return Sc=e,wc=Date.now(),Cc=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Cc+1)%3:1}function Ec(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Tc(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,a,o){let s=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c,l=bc(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=bc(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?K.range(i,a,l.assoc):K.range(a,i,l.assoc)}return a?i.replaceRange(i.main.extend(l.from,l.to,l.assoc)):o&&r==1&&i.ranges.length>1&&(c=Dc(i,s.pos))?c:o?i.addRange(l):K.create([l])}}}function Dc(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return K.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}mc.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=K.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,vc(e.state,mo,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},mc.dragend=e=>(e.inputState.draggedContent=null,!1);function Oc(e,t,n,r){if(n=vc(e.state,po,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&dc(e,t)?{from:a.from,to:a.to}:null,s={from:i,insert:n},c=e.state.changes(o?[o,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:o?`move.drop`:`input.drop`}),e.inputState.draggedContent=null}mc.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,a=()=>{++i==n.length&&Oc(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=a,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}else{let n=t.dataTransfer.getData(`Text`);if(n)return Oc(e,t,n,!0),!0}return!1},mc.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=gc?null:t.clipboardData;return n?(yc(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(_c(e),!1)};function kc(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement(`textarea`));r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function Ac(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let a=e.doc.lineAt(r);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:vc(e,mo,t.join(e.lineBreak)),ranges:n,linewise:r}}var jc=null;mc.copy=mc.cut=(e,t)=>{if(!fa(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=Ac(e.state);if(!n&&!i)return!1;jc=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=gc?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(kc(e,n),!1)};var Mc=Fr.define();function Nc(e,t){let n=[];for(let r of e.facet(fo)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Mc.of(!0)}):null}function Pc(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Nc(e.state,t);n?e.dispatch(n):e.update([])}},10)}hc.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),Pc(e)},hc.blur=e=>{e.observer.clearSelectionRange(),Pc(e)},hc.compositionstart=hc.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},hc.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,J.chrome&&J.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},hc.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},mc.beforeinput=(e,t)=>{if((t.inputType==`insertText`||t.inputType==`insertCompositionText`)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType==`insertReplacementText`&&e.observer.editContext){let n=t.dataTransfer?.getData(`text/plain`),r=t.getTargetRanges();if(n&&r.length){let t=r[0];return Js(e,{from:e.posAtDOM(t.startContainer,t.startOffset),to:e.posAtDOM(t.endContainer,t.endOffset),insert:e.state.toText(n)},null),!0}}let n;if(J.chrome&&J.android&&(n=rc.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(n.key,n.keyCode),n.key==`Backspace`||n.key==`Delete`)){let t=window.visualViewport?.height||0;setTimeout(()=>{(window.visualViewport?.height||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return J.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),J.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>hc.compositionend(e,t),20),!1};var Fc=new Set;function Ic(e){Fc.has(e)||(Fc.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var Lc=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],Rc=!1;function zc(){Rc=!1}var Bc=class{constructor(e){this.lineWrapping=e,this.doc=Fn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Lc.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,i,a){let o=Lc.indexOf(e)>-1,s=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,s){this.heightSamples={};for(let e=0;e<a.length;e++){let t=a[e];t<0?e++:this.heightSamples[Math.floor(t*10)]=!0}}return s}},Vc=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},Hc=class e{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return typeof this._content==`number`?ta.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof aa?this._content.widget:null}get widgetLineBreaks(){return typeof this._content==`number`?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new e(this.from,this.length+t.length,this.top,this.height+t.height,n)}},Uc=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(Uc||={}),Wc=.001,Gc=class e{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Wc&&(Rc=!0),this.height=e)}replace(t,n,r){return e.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,a=n.doc;for(let o=r.length-1;o>=0;o--){let{fromA:s,toA:c,fromB:l,toB:u}=r[o],d=i.lineAt(s,Uc.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,Uc.ByPosNoHeight,n,0,0);for(u+=f.to-c,c=f.to;o>0&&d.from<=r[o-1].toA;)s=r[o-1].fromA,l=r[o-1].fromB,o--,s<d.from&&(d=i.lineAt(s,Uc.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=el.build(n.setDoc(a),e,l,u);i=Kc(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new Yc(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,i=0,a=0;for(;;)if(n==r)if(i>a*2){let e=t[n-1];e.break?t.splice(--n,1,e.left,null,e.right):t.splice(--n,1,e.left,e.right),r+=1+e.break,i-=e.size}else if(a>i*2){let e=t[r];e.break?t.splice(r,1,e.left,null,e.right):t.splice(r,1,e.left,e.right),r+=2+e.break,a-=e.size}else break;else if(i<a){let e=t[n++];e&&(i+=e.size)}else{let e=t[--r];e&&(a+=e.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]??(o=1,r++),new Zc(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function Kc(e,t){return e==t?e:(e.constructor!=t.constructor&&(Rc=!0),t)}Gc.prototype.size=1;var qc=na.replace({}),Jc=class extends Gc{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new Hc(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new Hc(r,0,n,this.spaceAbove,qc):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let a=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(a):a}forEachLine(e,t,n,r,i,a){e<=i+this.length&&t>=i&&a(this.lineAt(0,Uc.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},Yc=class e extends Jc{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new Hc(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof e||i instanceof Xc&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Xc?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Gc.of(r)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:``}${this.widgetHeight?`:`+this.widgetHeight:``})`}},Xc=class e extends Gc{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,a,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);a=t/i,this.length>i+1&&(o=(this.height-t)/(this.length-i-1))}else a=this.height/i;return{firstLine:n,lastLine:r,perLine:a,perChar:o}}blockAt(e,t,n,r){let{firstLine:i,lastLine:a,perLine:o,perChar:s}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),a=t.doc.lineAt(i),c=o+a.length*s,l=Math.max(n,e-c/2);return new Hc(a.from,a.length,l,c,0)}else{let r=Math.max(0,Math.min(a-i,Math.floor((e-n)/o))),{from:s,length:c}=t.doc.line(i+r);return new Hc(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==Uc.ByHeight)return this.blockAt(e,n,r,i);if(t==Uc.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new Hc(t,r-t,0,0,0)}let{firstLine:a,perLine:o,perChar:s}=this.heightMetrics(n,i),c=n.doc.lineAt(e),l=o+c.length*s,u=c.number-a,d=r+o*u+s*(c.from-i-u);return new Hc(c.from,c.length,Math.max(r,Math.min(d,r+this.height-l)),l,0)}forEachLine(e,t,n,r,i,a){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:o,perLine:s,perChar:c}=this.heightMetrics(n,i);for(let l=e,u=r;l<=t;){let t=n.doc.lineAt(l);if(l==e){let n=t.number-o;u+=s*n+c*(e-i-n)}let r=s+c*t.length;a(new Hc(t.from,t.length,u,r,0)),u+=r,l=t.to+1}}replace(t,n,r){let i=this.length-n;if(i>0){let t=r[r.length-1];t instanceof e?r[r.length-1]=new e(t.length+i):r.push(null,new e(i-1))}if(t>0){let n=r[0];n instanceof e?r[0]=new e(t+n.length):r.unshift(new e(t-1),null)}return Gc.of(r)}decomposeLeft(t,n){n.push(new e(t-1),null)}decomposeRight(t,n){n.push(null,new e(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let a=n+this.length;if(i&&i.from<=n+this.length&&i.more){let r=[],o=Math.max(n,i.from),s=-1;for(i.from>n&&r.push(new e(i.from-n-1).updateHeight(t,n));o<=a&&i.more;){let e=t.doc.lineAt(o).length;r.length&&r.push(null);let n=i.heights[i.index++],a=0;n<0&&(a=-n,n=i.heights[i.index++]),s==-1?s=n:Math.abs(n-s)>=Wc&&(s=-2);let c=new Yc(e,n,a);c.outdated=!1,r.push(c),o+=e+1}o<=a&&r.push(null,new e(a-o).updateHeight(t,o));let c=Gc.of(r);return(s<0||Math.abs(c.height-this.height)>=Wc||Math.abs(s-this.heightMetrics(t,n).perLine)>=Wc)&&(Rc=!0),Kc(this,c)}else (r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},Zc=class extends Gc{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let a=r+this.left.height,o=i+this.left.length+this.break,s=t==Uc.ByHeight?e<a:e<o,c=s?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,a,o);if(this.break||(s?c.to<o:c.from>o))return c;let l=t==Uc.ByPosNoHeight?Uc.ByPosNoHeight:Uc.ByPos;return s?c.join(this.right.lineAt(o,l,n,a,o)):this.left.lineAt(o,l,n,r,i).join(c)}forEachLine(e,t,n,r,i,a){let o=r+this.left.height,s=i+this.left.length+this.break;if(this.break)e<s&&this.left.forEachLine(e,t,n,r,i,a),t>=s&&this.right.forEachLine(e,t,n,o,s,a);else{let c=this.lineAt(s,Uc.ByPos,n,r,i);e<c.from&&this.left.forEachLine(e,c.from-1,n,r,i,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let e of n)i.push(e);if(e>0&&Qc(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),Qc(i,e)}return Gc.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Gc.of(this.break?[e,null,t]:[e,t]):(this.left=Kc(this.left,e),this.right=Kc(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:a}=this,o=t+i.length+this.break,s=null;return r&&r.from<=t+i.length&&r.more?s=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=o+a.length&&r.more?s=a=a.updateHeight(e,o,n,r):a.updateHeight(e,o,n),s?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?` `:`-`)+this.right}};function Qc(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Xc&&(r=e[t+1])instanceof Xc&&e.splice(t-1,3,new Xc(n.length+1+r.length))}var $c=5,el=class e{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Yc?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Yc(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;n.block?this.addBlock(new Jc(a,r,n)):(a||i||r>=$c)&&this.addLineDeco(r,i,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Yc(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Xc(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Yc)return e;let t=new Yc(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos+=e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos+=n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Yc)&&!this.isCovered?this.nodes.push(new Yc(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let e of this.nodes)e instanceof Yc&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(t,n,r,i){let a=new e(r,t);return oi.spans(n,r,i,a,0),a.finish(r)}};function tl(e,t,n){let r=new nl;return oi.compare(e,t,n,r,0),r.changes}var nl=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&ca(e,t,this.changes,5)}};function rl(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,a=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),s=Math.max(0,n.top),c=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(t.nodeType==1){let n=t,r=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&r.overflow!=`visible`){let r=n.getBoundingClientRect();a=Math.max(a,r.left),o=Math.min(o,r.right),s=Math.max(s,r.top),c=Math.min(t==e.parentNode?i.innerHeight:c,r.bottom)}t=r.position==`absolute`||r.position==`fixed`?n.offsetParent:n.parentNode}else if(t.nodeType==11)t=t.host;else break;return{left:a-n.left,right:Math.max(a,o)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function il(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function al(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var ol=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return na.replace({widget:new sl(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},sl=class extends ea{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement(`div`);return this.vertical?e.style.height=this.size+`px`:(e.style.width=this.size+`px`,e.style.height=`2px`,e.style.display=`inline-block`),e}get estimatedHeight(){return this.vertical?this.size:-1}},cl=class{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=ml,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ia.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(Oo).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new Bc(n),this.stateDeco=hl(t),this.heightMap=Gc.empty().applyChanges(this.stateDeco,Fn.empty,this.heightOracle.setDoc(t.doc),[new Ro(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=na.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new ll(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?ml:new gl(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(_l(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=hl(this.state);let r=e.changedRanges,i=Ro.extendWithRanges(r,tl(n,this.stateDeco,e?e.changes:tr.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);zc(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||Rc)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let s=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<s.from||t.range.head>s.to)||!this.viewportIsAppropriate(s))&&(s=this.getViewport(0,t));let c=s.from!=this.viewport.from||s.to!=this.viewport.to;this.viewport=s,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(go)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction==`rtl`?Ia.RTL:Ia.LTR;let a=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent===`refresh`,o=t.getBoundingClientRect(),s=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,l=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=xa(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,c|=16,a=s=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(s=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=Ca(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=Ma(this.scrollParent||e.win);let m=(this.printing?al:rl)(t,this.paddingTop),h=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let _=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(_!=this.inView&&(this.inView=_,_&&(s=!0)),!this.inView&&!this.scrollTarget&&!il(e.dom))return 0;let v=o.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),s){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(a=!0),a||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:o,textHeight:s}=e.docView.measureTextSize();a=n>0&&r.refresh(i,n,o,s,Math.max(5,v/o),t),a&&(e.docView.minWidth=0,c|=16)}h>0&&g>0?l=Math.max(h,g):h<0&&g<0&&(l=Math.min(h,g)),zc();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?Gc.empty().applyChanges(this.stateDeco,Fn.empty,this.heightOracle,[new Ro(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new Vc(n.from,i))}Rc&&(c|=2)}let y=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(l,this.scrollTarget),c|=this.updateForViewport()),(c&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,s=new ll(r.lineAt(a-n*1e3,Uc.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,Uc.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<s.from||e>s.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),a=r.lineAt(e,Uc.ByPos,i,0,0),o;o=t.y==`center`?(a.top+a.bottom)/2-n/2:t.y==`start`||t.y==`nearest`&&e<s.from?a.top:a.bottom-n,s=new ll(r.lineAt(o-1e3/2,Uc.ByHeight,i,0,0).from,r.lineAt(o+n+1e3/2,Uc.ByHeight,i,0,0).to)}}return s}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new ll(this.heightMap.lineAt(n,Uc.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Uc.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Uc.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,Uc.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=o+Math.max(10,Math.min(n,250)))&&r>a-2*1e3&&i<o+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new ol(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,a=r<<1;if(this.defaultTextDirection!=Ia.LTR&&!n)return[];let o=[],s=(r,a,c,l)=>{if(a-r<i)return;let u=this.state.selection.main,d=[u.from];u.empty||d.push(u.to);for(let e of d)if(e>r&&e<a){s(r,e-10,c,l),s(e+10,a,c,l);return}let f=pl(e,e=>e.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-a)<i&&!d.some(t=>e.from<t&&e.to>t));if(!f){if(a<c.to&&t&&n&&t.visibleRanges.some(e=>e.from<=a&&e.to>=a)){let e=t.moveToLineBoundary(K.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new ol(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=ta.Text)return;let i=ul(t.from,t.to,this.stateDeco);if(i.total<a)return;let o=this.scrollTarget?this.scrollTarget.range.head:null,c,l;if(n){let e=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,n,a;if(o!=null){let r=fl(i,o),s=((this.visibleBottom-this.visibleTop)/2+e)/t.height;n=r-s,a=r+s}else n=(this.visibleTop-t.top-e)/t.height,a=(this.visibleBottom-t.top+e)/t.height;c=dl(i,n),l=dl(i,a)}else{let n=i.total*this.heightOracle.charWidth,a=r*this.heightOracle.charWidth,s=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+s<this.pixelViewport.left&&(s=n.size-n.displaySize);let u=this.pixelViewport.left+s,d=this.pixelViewport.right+s,f,p;if(o!=null){let e=fl(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=dl(i,f),l=dl(i,p)}c>t.from&&s(t.from,c,t,i),l<t.to&&s(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(c):c(e);return o}gapSize(e,t,n,r){let i=fl(r,n)-fl(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){ol.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=na.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];oi.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(r&8);t++){let i=this.visibleRanges[t],a=n[t];(i.from!=a.from||i.to!=a.to)&&(r|=4,e&&e.mapPos(i.from,-1)==a.from&&e.mapPos(i.to,1)==a.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||_l(this.heightMap.lineAt(e,Uc.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||_l(this.heightMap.lineAt(this.scaler.fromDOM(e),Uc.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return _l(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},ll=class{constructor(e,t){this.from=e,this.to=t}};function ul(e,t,n){let r=[],i=e,a=0;return oi.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),a+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),a+=t-i),{total:a,ranges:r}}function dl({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],a=i-n;if(r<=a)return n+r;r-=a}}function fl(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function pl(e,t){for(let n of e)if(t(n))return n}var ml={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function hl(e){let t=e.facet(ko).filter(e=>typeof e!=`function`),n=e.facet(jo).filter(e=>typeof e!=`function`);return n.length&&t.push(oi.join(n)),t}var gl=class e{constructor(e,t,n){let r=0,i=0,a=0;this.viewports=n.map(({from:n,to:i})=>{let a=t.lineAt(n,Uc.ByPos,e,0,0).top,o=t.lineAt(i,Uc.ByPos,e,0,0).bottom;return r+=o-a,{from:n,to:i,top:a,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=a+(e.top-i)*this.scale,a=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(t){return t instanceof e?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to):!1}};function _l(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Hc(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>_l(e,t)):e._content)}var vl=q.define({combine:e=>e.join(` `)}),yl=q.define({combine:e=>e.indexOf(!0)>-1}),bl=Ti.newName(),xl=Ti.newName(),Sl=Ti.newName(),Cl={"&light":`.`+xl,"&dark":`.`+Sl};function wl(e,t,n){return new Ti(t,{finish(t){return/&/.test(t)?t.replace(/&\w*/,t=>{if(t==`&`)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+` `+t}})}var Tl=wl(`.`+bl,{"&":{position:`relative !important`,boxSizing:`border-box`,"&.cm-focused":{outline:`1px dotted #212121`},display:`flex !important`,flexDirection:`column`},".cm-scroller":{display:`flex !important`,alignItems:`flex-start !important`,fontFamily:`monospace`,lineHeight:1.4,height:`100%`,overflowX:`auto`,position:`relative`,zIndex:0,overflowAnchor:`none`},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:`block`,whiteSpace:`pre`,wordWrap:`normal`,boxSizing:`border-box`,minHeight:`100%`,padding:`4px 0`,outline:`none`,"&[contenteditable=true]":{WebkitUserModify:`read-write-plaintext-only`}},".cm-lineWrapping":{whiteSpace_fallback:`pre-wrap`,whiteSpace:`break-spaces`,wordBreak:`break-word`,overflowWrap:`anywhere`,flexShrink:1},"&light .cm-content":{caretColor:`black`},"&dark .cm-content":{caretColor:`white`},".cm-line":{display:`block`,padding:`0 2px 0 6px`},".cm-layer":{position:`absolute`,left:0,top:0,contain:`size style`,"& > *":{position:`absolute`}},"&light .cm-selectionBackground":{background:`#d9d9d9`},"&dark .cm-selectionBackground":{background:`#222`},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#d7d4f0`},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#233`},".cm-cursorLayer":{pointerEvents:`none`},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:`steps(1) cm-blink 1.2s infinite`},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:`1.2px solid black`,marginLeft:`-0.6px`,pointerEvents:`none`},".cm-cursor":{display:`none`},"&dark .cm-cursor":{borderLeftColor:`#ddd`},".cm-selectionHandle":{backgroundColor:`currentColor`,width:`1.5px`},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:`""`,backgroundColor:`inherit`,borderRadius:`50%`,width:`8px`,height:`8px`,position:`absolute`,left:`-3.25px`},".cm-selectionHandle-start::before":{top:`-8px`},".cm-selectionHandle-end::before":{bottom:`-8px`},".cm-dropCursor":{position:`absolute`},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:`block`},".cm-iso":{unicodeBidi:`isolate`},".cm-announced":{position:`fixed`,top:`-10000px`},"@media print":{".cm-announced":{display:`none`}},"&light .cm-activeLine":{backgroundColor:`#cceeff44`},"&dark .cm-activeLine":{backgroundColor:`#99eeff33`},"&light .cm-specialChar":{color:`red`},"&dark .cm-specialChar":{color:`#f78`},".cm-gutters":{flexShrink:0,display:`flex`,height:`100%`,boxSizing:`border-box`,zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:`#f5f5f5`,color:`#6c6c6c`,border:`0px solid #ddd`,"&.cm-gutters-before":{borderRightWidth:`1px`},"&.cm-gutters-after":{borderLeftWidth:`1px`}},"&dark .cm-gutters":{backgroundColor:`#333338`,color:`#ccc`},".cm-gutter":{display:`flex !important`,flexDirection:`column`,flexShrink:0,boxSizing:`border-box`,minHeight:`100%`,overflow:`hidden`},".cm-gutterElement":{boxSizing:`border-box`},".cm-lineNumbers .cm-gutterElement":{padding:`0 3px 0 5px`,minWidth:`20px`,textAlign:`right`,whiteSpace:`nowrap`},"&light .cm-activeLineGutter":{backgroundColor:`#e2f2ff`},"&dark .cm-activeLineGutter":{backgroundColor:`#222227`},".cm-panels":{boxSizing:`border-box`,position:`sticky`,left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:`#f5f5f5`,color:`black`},"&light .cm-panels-top":{borderBottom:`1px solid #ddd`},"&light .cm-panels-bottom":{borderTop:`1px solid #ddd`},"&dark .cm-panels":{backgroundColor:`#333338`,color:`white`},".cm-dialog":{padding:`2px 19px 4px 6px`,position:`relative`,"& label":{fontSize:`80%`}},".cm-dialog-close":{position:`absolute`,top:`3px`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,fontSize:`14px`,padding:`0`},".cm-tab":{display:`inline-block`,overflow:`hidden`,verticalAlign:`bottom`},".cm-widgetBuffer":{verticalAlign:`text-top`,height:`1em`,width:0,display:`inline`},".cm-placeholder":{color:`#888`,display:`inline-block`,verticalAlign:`top`,userSelect:`none`},".cm-highlightSpace":{backgroundImage:`radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)`,backgroundPosition:`center`},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:`auto 100%`,backgroundPosition:`right 90%`,backgroundRepeat:`no-repeat`},".cm-trailingSpace":{backgroundColor:`#ff332255`},".cm-button":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,padding:`.2em 1em`,borderRadius:`1px`},"&light .cm-button":{backgroundImage:`linear-gradient(#eff1f5, #d9d9df)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#b4b4b4, #d0d3d6)`}},"&dark .cm-button":{backgroundImage:`linear-gradient(#393939, #111)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#111, #333)`}},".cm-textfield":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,border:`1px solid silver`,padding:`.2em .5em`},"&light .cm-textfield":{backgroundColor:`white`},"&dark .cm-textfield":{border:`1px solid #555`,backgroundColor:`inherit`}},Cl),El={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Dl=J.ie&&J.ie_version<=11,Ol=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new wa,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(J.ie&&J.ie_version<=11||J.ios&&e.composing)&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&J.android&&e.constructor.EDIT_CONTEXT!==!1&&!(J.chrome&&J.chrome_version<126)&&(this.editContext=new Ml(e),e.state.facet(So)&&(e.contentDOM.editContext=this.editContext.editContext)),Dl&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia(`print`)),typeof ResizeObserver==`function`&&(this.resizeScroll=new ResizeObserver(()=>{this.view.docView?.lastUpdate<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver==`function`&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(`Event`)))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(`Event`))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers(`scroll`,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type==`change`||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(So)?n.root.activeElement!=this.dom:!fa(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(J.ie&&J.ie_version<=11||J.android&&J.chrome)&&!n.state.selection.main.empty&&r.focusNode&&ma(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ua(e.root);if(!t)return!1;let n=J.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&jl(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=fa(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&ja(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||=this.scrollTargets.slice(0,e),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener(`scroll`,this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||=(this.observer.observe(this.dom,El),Dl&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Dl&&this.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&ka(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}(!this.delayedAndroidKey||e==`Enter`)&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!this.delayedAndroidKey?.force})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),t==-1?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&fa(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Gs(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=qs(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!$s(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type==`attributes`),e.type==`childList`){let n=kl(t,e.previousSibling||e.target.previousSibling,-1),r=kl(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else if(e.type==`characterData`)return{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue};else return null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener(`change`,this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener(`beforeprint`,this.onPrint),e.addEventListener(`scroll`,this.onScroll),e.document.addEventListener(`selectionchange`,this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener(`scroll`,this.onScroll),e.removeEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener(`change`,this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener(`beforeprint`,this.onPrint),e.document.removeEventListener(`selectionchange`,this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(So)!=e.state.facet(So)&&(e.view.contentDOM.editContext=e.state.facet(So)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)==null||e.disconnect(),(t=this.gapIntersection)==null||t.disconnect(),(n=this.resizeScroll)==null||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function kl(e,t,n){for(;t;){let r=Vo.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i==e.dom?n>0?t.nextSibling:t.previousSibling:i}return null}function Al(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return ma(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function jl(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Al(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener(`beforeinput`,r,!0),e.dom.ownerDocument.execCommand(`indent`),e.contentDOM.removeEventListener(`beforeinput`,r,!0),n?Al(e,n):null}var Ml=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:a}=r,o=this.toEditorPos(n.updateRangeStart),s=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let c=s-o>n.text.length;o==this.from&&i<this.from?o=i:s==this.to&&i>this.to&&(s=i);let l=Xs(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=K.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));$s(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:Fn.of(n.text.slice(l.from,l.toB).split(`
|
|
720
|
-
`))};if((J.mac||J.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:Fn.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);Js(e,u,K.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);t<a;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),a=this.toEditorPos(e.rangeEnd);if(i<a){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+` `:t==`Dashed`?`dashed `:t==`Squiggle`?`wavy `:``}${/thin/i.test(r)?1:2}px`;n.push(na.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:bo.of(na.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=ua(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,a,o,s,c)=>{if(n)return;let l=c.length-(a-i);if(r&&a>=r.to)if(r.from==i&&r.to==a&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=l,this.to+=l;return}else r=null,this.revertPending(e.state);if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),c.toString()),this.to+=l}t+=l}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent(`input.type`)&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},Y=class e{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement(`div`),this.scrollDOM=document.createElement(`div`),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=`cm-scroller`,this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(`div`),this.announceDOM.className=`cm-announced`,this.announceDOM.setAttribute(`aria-live`,`polite`),this.dom=document.createElement(`div`),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Aa(e.parent)||document,this.viewState=new cl(this,e.state||$r.create(e)),e.scrollTo&&e.scrollTo.is(yo)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(wo).map(e=>new Eo(e));for(let e of this.plugins)e.update(this);this.observer=new Ol(this),this.inputState=new ec(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ms(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=`refresh`,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof zr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(t){if(this.updateState!=0)throw Error(`Calls to EditorView.update are not allowed while an update is in progress`);let n=!1,r=!1,i,a=this.state;for(let e of t){if(e.startState!=a)throw RangeError(`Trying to update state with a transaction that doesn't start from the previous state.`);a=e.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,s=0,c=null;t.some(e=>e.annotation(Mc))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Nc(a,o),c||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(u=null)):this.observer.clear(),a.facet($r.phrases)!=this.state.facet($r.phrases))return this.setState(a);i=zo.create(this,a,t),i.flags|=s;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let n of t){if(d&&=d.map(n.changes),n.scrollIntoView){let{main:t}=n.state.selection,{x:r,y:i}=this.state.facet(e.cursorScrollMargin);d=new vo(t.empty?t:K.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(yo)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=Fl.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Lo)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(e=>e.isUserEvent(`select.pointer`)))}finally{this.updateState=0}if(i.startState.facet(vl)!=i.state.facet(vl)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let e of this.state.facet(lo))try{e(i)}catch(e){xo(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!qs(this,u)&&l.force&&ka(this.contentDOM,l.key,l.keyCode)})}setState(e){if(this.updateState!=0)throw Error(`Calls to EditorView.setState are not allowed while an update is in progress`);if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new cl(this,e),this.plugins=e.facet(wo).map(e=>new Eo(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new ms(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(wo),n=e.state.facet(wo);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new Eo(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){xo(this.state,e,`doc view update listener`)}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:a}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0)if(Ma(n||this.win))i=-1,a=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}this.updateState=1;let o=this.viewState.measure();if(!o&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(e>5){console.warn(this.measureRequests.length?`Measure loop restarted more than 5 times`:`Viewport failed to stabilize`);break}let s=[];o&4||([this.measureRequests,s]=[s,this.measureRequests]);let c=s.map(e=>{try{return e.read(this)}catch(e){return xo(this.state,e),Pl}}),l=zo.create(this,this.state,[]),u=!1;l.flags|=o,t?t.flags|=o:t=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),u=this.docView.update(l),u&&this.docViewUpdate());for(let e=0;e<s.length;e++)if(c[e]!=Pl)try{let t=s[e];t.write&&t.write(c[e],this)}catch(e){xo(this.state,e)}if(u&&this.docView.updateSelection(!0),!l.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let e=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-a)/this.scaleY;if((e>1||e<-1)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?n.scrollTop+=e:this.win.scrollBy(0,e),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(lo))e(t)}get themeClasses(){return bl+` `+(this.state.facet(yl)?Sl:xl)+` `+this.state.facet(vl)}updateAttrs(){let e=Il(this,Do,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(So)?`true`:`false`,class:`cm-content`,style:`${J.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),Il(this,Oo,t);let n=this.observer.ignore(()=>{let n=Qi(this.contentDOM,this.contentAttrs,t),r=Qi(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&(this.announceDOM.textContent=``),n=!1;let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Lo);let t=this.state.facet(e.cspNonce);Ti.mount(this.root,this.styleModules.concat(Tl).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw Error(`Reading the editor layout isn't allowed during an update`);this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Is(this,e,js(this,e,t,n))}moveByGroup(e,t){return Is(this,e,js(this,e,t,t=>Ms(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return K.cursor(i.side(t,r)+e.from,i.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return As(this,e,t,n)}moveVertically(e,t,n){return Is(this,e,Ns(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Rs(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Rs(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),a=i[Ka.find(i,e-r.from,-1,t)];return ya(n,a.dir==Ia.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ho)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Nl)return to(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||qa(r.isolates,n=Po(this,e))))return r.order;n||=Po(this,e);let r=eo(e.text,t,n);return this.bidiCache.push(new Fl(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||J.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ea(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return yo.of(new vo(typeof e==`number`?K.cursor(e):e,t.y??`nearest`,t.x??`nearest`,t.yMargin??5,t.xMargin??5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return yo.of(new vo(K.cursor(n.from),`start`,`start`,n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e==`boolean`?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return To.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return To.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Ti.newName(),r=[vl.of(n),Lo.of(wl(`.${n}`,e))];return t&&t.dark&&r.push(yl.of(!0)),r}static baseTheme(e){return br.lowest(Lo.of(wl(`.`+bl,e,Cl)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&Vo.get(t)||Vo.get(e))?.root?.view||null}};Y.styleModule=Lo,Y.inputHandler=uo,Y.clipboardInputFilter=po,Y.clipboardOutputFilter=mo,Y.scrollHandler=_o,Y.focusChangeEffect=fo,Y.perLineTextDirection=ho,Y.exceptionSink=co,Y.updateListener=lo,Y.editable=So,Y.mouseSelectionStyle=so,Y.dragMovesSelection=oo,Y.clickAddsSelectionRange=ao,Y.decorations=ko,Y.blockWrappers=Ao,Y.outerDecorations=jo,Y.atomicRanges=Mo,Y.bidiIsolatedRanges=No,Y.cursorScrollMargin=q.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r==`number`?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}}),Y.scrollMargins=Fo,Y.darkTheme=yl,Y.cspNonce=q.define({combine:e=>e.length?e[0]:``}),Y.contentAttributes=Oo,Y.editorAttributes=Do,Y.lineWrapping=Y.contentAttributes.of({class:`cm-lineWrapping`}),Y.announce=Rr.define();var Nl=4096,Pl={},Fl=class e{constructor(e,t,n,r,i,a){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=a}static update(t,n){if(n.empty&&!t.some(e=>e.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:Ia.LTR;for(let a=Math.max(0,t.length-10);a<t.length;a++){let o=t[a];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new e(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function Il(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],a=typeof t==`function`?t(e):t;a&&Ji(a,n)}return n}var Ll=J.mac?`mac`:J.windows?`win`:J.linux?`linux`:`key`;function Rl(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1];r==`Space`&&(r=` `);let i,a,o,s;for(let e=0;e<n.length-1;++e){let r=n[e];if(/^(cmd|meta|m)$/i.test(r))s=!0;else if(/^a(lt)?$/i.test(r))i=!0;else if(/^(c|ctrl|control)$/i.test(r))a=!0;else if(/^s(hift)?$/i.test(r))o=!0;else if(/^mod$/i.test(r))t==`mac`?s=!0:a=!0;else throw Error(`Unrecognized modifier name: `+r)}return i&&(r=`Alt-`+r),a&&(r=`Ctrl-`+r),s&&(r=`Meta-`+r),o&&(r=`Shift-`+r),r}function zl(e,t,n){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n!==!1&&t.shiftKey&&(e=`Shift-`+e),e}var Bl=br.default(Y.domEventHandlers({keydown(e,t){return Yl(Ul(t.state),e,t,`editor`)}})),Vl=q.define({enables:Bl}),Hl=new WeakMap;function Ul(e){let t=e.facet(Vl),n=Hl.get(t);return n||Hl.set(t,n=ql(t.reduce((e,t)=>e.concat(t),[]))),n}function Wl(e,t,n){return Yl(Ul(e.state),t,e,n)}var Gl=null,Kl=4e3;function ql(e,t=Ll){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(n==null)r[e]=t;else if(n!=t)throw Error(`Key binding `+e+` is used both as a regular binding and as a multi-stroke prefix`)},a=(e,r,a,o,s)=>{let c=n[e]||(n[e]=Object.create(null)),l=r.split(/ (?!$)/).map(e=>Rl(e,t));for(let t=1;t<l.length;t++){let n=l.slice(0,t).join(` `);i(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=Gl={view:t,prefix:n,scope:e};return setTimeout(()=>{Gl==r&&(Gl=null)},Kl),!0}]})}let u=l.join(` `);i(u,!1);let d=c[u]||(c[u]={preventDefault:!1,stopPropagation:!1,run:(c._any?.run)?.slice()||[]});a&&d.run.push(a),o&&(d.preventDefault=!0),s&&(d.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(` `):[`editor`];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||={preventDefault:!1,stopPropagation:!1,run:[]};let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,Jl))}let i=r[t]||r.key;if(i)for(let t of e)a(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&a(t,`Shift-`+i,r.shift,r.preventDefault,r.stopPropagation)}return n}var Jl=null;function Yl(e,t,n,r){Jl=t;let i=Pi(t),a=Zn(Yn(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;Gl&&Gl.view==n&&Gl.scope==r&&(o=Gl.prefix+` `,ac.indexOf(t.keyCode)<0&&(c=!0,Gl=null));let u=new Set,d=e=>{if(e){for(let t of e.run)if(!u.has(t)&&(u.add(t),t(n)))return e.stopPropagation&&(l=!0),!0;e.preventDefault&&(e.stopPropagation&&(l=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[o+zl(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(J.windows&&t.ctrlKey&&t.altKey)&&!(J.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Oi[t.keyCode])&&p!=i?(d(f[o+zl(p,t,!0)])||t.shiftKey&&(m=ki[t.keyCode])!=i&&m!=p&&d(f[o+zl(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+zl(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),Jl=null,s}var Xl=class e{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className?(this.adjust(e),!0):!1}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,this.width!=null&&(e.style.width=this.width+`px`),e.style.height=this.height+`px`}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let a=Zl(t);return[new e(n,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}else return $l(t,n,r)}};function Zl(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Ia.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Ql(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let a=e.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,s=e.posAtCoords({x:a.left+1,y:o}),c=e.posAtCoords({x:a.right-1,y:o});return s==null||c==null?r:{from:Math.max(r.from,Math.min(s,c)),to:Math.min(r.to,Math.max(s,c))}}function $l(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),a=e.textDirection==Ia.LTR,o=e.contentDOM,s=o.getBoundingClientRect(),c=Zl(e),l=o.querySelector(`.cm-line`),u=l&&window.getComputedStyle(l),d=s.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=s.right-(u?parseInt(u.paddingRight):0),p=ks(e,r,1),m=ks(e,i,-1),h=p.type==ta.Text?p:null,g=m.type==ta.Text?m:null;if(h&&(e.lineWrapping||p.widgetLineBreaks)&&(h=Ql(e,r,1,h)),g&&(e.lineWrapping||m.widgetLineBreaks)&&(g=Ql(e,i,-1,g)),h&&g&&h.from==g.from&&h.to==g.to)return v(y(n.from,n.to,h));{let t=h?y(n.from,null,h):b(p,!1),r=g?y(null,n.to,g):b(m,!0),i=[];return(h||p).to<(g||m).from-(h&&g?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(_(d,t.bottom,f,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==ta.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),v(t).concat(i).concat(v(r))}function _(e,n,r,i){return new Xl(t,e-c.left,n-c.top,Math.max(0,r-e),i-n)}function v({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(_(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,o=-1e9,s=[];function c(t,n,c,l,u){let p=e.coordsAtPos(t,t==r.to?-2:2),m=e.coordsAtPos(c,c==r.from?2:-2);!p||!m||(i=Math.min(p.top,m.top,i),o=Math.max(p.bottom,m.bottom,o),u==Ia.LTR?s.push(a&&n?d:p.left,a&&l?f:m.right):s.push(!a&&l?d:m.left,!a&&n?f:p.right))}let l=t??r.from,u=n??r.to;for(let r of e.visibleRanges)if(r.to>l&&r.from<u)for(let i=Math.max(r.from,l),a=Math.min(r.to,u);;){let r=e.state.doc.lineAt(i);for(let o of e.bidiSpans(r)){let e=o.from+r.from,s=o.to+r.from;if(e>=a)break;s>i&&c(Math.max(e,i),t==null&&e<=l,Math.min(s,a),n==null&&s>=u,o.dir)}if(i=r.to+1,i>=a)break}return s.length==0&&c(l,t==null,u,n==null,e.textDirection),{top:i,bottom:o,horizontal:s}}function b(e,t){let n=s.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}function eu(e,t){return e.constructor==t.constructor&&e.eq(t)}var tu=class{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement(`div`)),this.dom.classList.add(`cm-layer`),t.above&&this.dom.classList.add(`cm-layer-above`),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute(`aria-hidden`,`true`),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(nu)!=e.state.facet(nu)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(nu);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>!eu(e,this.drawn[t]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,J.webkit&&(this.dom.style.display=this.dom.firstChild?``:`none`)}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},nu=q.define();function ru(e){return[To.define(t=>new tu(t,e)),nu.of(e)]}var iu=q.define({combine(e){return ei(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function au(e={}){return[iu.of(e),su,lu,uu,go.of(!0)]}function ou(e){return e.startState.facet(iu)!=e.state.facet(iu)}var su=ru({above:!0,markers(e){let{state:t}=e,n=t.facet(iu),r=[];for(let i of t.selection.ranges){let a=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(a&&J.ios&&n.iosSelectionHandles)){let t=a?`cm-cursor cm-cursor-primary`:`cm-cursor cm-cursor-secondary`,n=i.empty?i:K.cursor(i.head,i.assoc);for(let i of Xl.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName=t.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`);let n=ou(e);return n&&cu(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){cu(t.state,e)},class:`cm-cursorLayer`});function cu(e,t){t.style.animationDuration=e.facet(iu).cursorBlinkRate+`ms`}var lu=ru({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let n of r)if(!n.empty)for(let r of Xl.forRange(e,`cm-selectionBackground`,n))t.push(r);if(J.ios&&!n.empty&&e.state.facet(iu).iosSelectionHandles){for(let r of Xl.forRange(e,`cm-selectionHandle cm-selectionHandle-start`,K.cursor(n.from,1)))t.push(r);for(let r of Xl.forRange(e,`cm-selectionHandle cm-selectionHandle-end`,K.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||ou(e)},class:`cm-selectionLayer`}),uu=br.highest(Y.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`transparent !important`},caretColor:`transparent !important`},".cm-content":{caretColor:`transparent !important`,"& :focus":{caretColor:`initial !important`,"&::selection, & ::selection":{backgroundColor:`Highlight !important`}}}})),du=Rr.define({map(e,t){return e==null?null:t.mapPos(e)}}),fu=_r.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(du)?t.value:e,e)}}),pu=To.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(fu);n==null?this.cursor!=null&&((t=this.cursor)==null||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement(`div`)),this.cursor.className=`cm-dropCursor`),(e.startState.field(fu)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(fu),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+`px`,this.cursor.style.top=e.top/n+`px`,this.cursor.style.height=e.height/n+`px`):this.cursor.style.left=`-100000px`}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(fu)!=e&&this.view.dispatch({effects:du.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function mu(){return[fu,pu]}/x/.unicode;var hu=To.fromClass(class{constructor(){this.height=1e3,this.attrs={style:`padding-bottom: 1000px`}}update(e){let{view:t}=e,n=t.viewState.editorHeight-t.defaultLineHeight-t.documentPadding.top-.5;n>=0&&n!=this.height&&(this.height=n,this.attrs={style:`padding-bottom: ${n}px`})}});function gu(){return[hu,Oo.of(e=>e.plugin(hu)?.attrs||null)]}function _u(){return yu}var vu=na.line({class:`cm-activeLine`}),yu=To.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(vu.range(i.from)),t=i.from)}return na.set(n)}},{decorations:e=>e.decorations}),bu=2e3;function xu(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),a=[];if(t.off>bu||n.off>bu||t.col<0||n.col<0){let o=Math.min(t.off,n.off),s=Math.max(t.off,n.off);for(let t=r;t<=i;t++){let n=e.doc.line(t);n.length<=s&&a.push(K.range(n.from+o,n.to+s))}}else{let o=Math.min(t.col,n.col),s=Math.max(t.col,n.col);for(let t=r;t<=i;t++){let n=e.doc.line(t),r=bi(n.text,o,e.tabSize,!0);if(r<0)a.push(K.cursor(n.to));else{let t=bi(n.text,s,e.tabSize);a.push(K.range(n.from+r,n.from+t))}}}return a}function Su(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function Cu(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,a=i>bu?-1:i==r.length?Su(e,t.clientX):yi(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:a,off:i}}function wu(e,t){let n=Cu(e,t),r=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},r=r.map(e.changes)}},get(t,i,a){let o=Cu(e,t);if(!o)return r;let s=xu(e.state,n,o);return s.length?a?K.create(s.concat(r.ranges)):K.create(s):r}}:null}function Tu(e){let t=e?.eventFilter||(e=>e.altKey&&e.button==0);return Y.mouseSelectionStyle.of((e,n)=>t(n)?wu(e,n):null)}var Eu={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},Du={style:`cursor: crosshair`};function Ou(e={}){let[t,n]=Eu[e.key||`Alt`],r=To.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){(e.keyCode==t||!n(e))&&this.set(!1)},mousemove(e){this.set(n(e))}}});return[r,Y.contentAttributes.of(e=>e.plugin(r)?.isDown?Du:null)]}var ku=`-10000px`,Au=class{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let a=[],o=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],s=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(s=e)}if(s<0)a[n]=this.createTooltipView(r,n?a[n-1]:null),o&&(o[n]=!!r.above);else{let r=a[n]=this.tooltipViews[s];o&&(o[n]=t[s]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)a.indexOf(e)<0&&(this.removeTooltipView(e),(n=e.destroy)==null||n.call(e));return t&&(o.forEach((e,n)=>t[n]=e),t.length=o.length),this.input=r,this.tooltips=i,this.tooltipViews=a,!0}};function ju(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}var Mu=q.define({combine:e=>({position:J.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||ju})}),Nu=new WeakMap,Pu=To.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Mu);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==`function`?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Au(e,Ru,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==`function`?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener(`resize`,this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(`div`),this.container.style.position=`relative`,this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(Mu);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add(`cm-tooltip`),e.arrow&&!n.dom.querySelector(`.cm-tooltip > .cm-tooltip-arrow`)){let e=document.createElement(`div`);e.className=`cm-tooltip-arrow`,n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=ku,n.dom.style.left=`0px`,this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener(`resize`,this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(e=t.destroy)==null||e.call(t);this.parent&&this.container.remove(),(t=this.resizeObserver)==null||t.disconnect(),(n=this.intersectionObserver)==null||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(J.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||this.position==`absolute`)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else ({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Io(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Mu).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){if(e.makeAbsolute){this.madeAbsolute=!0,this.position=`absolute`;for(let e of this.manager.tooltipViews)e.dom.style.position=`absolute`}let{visible:t,space:n,scaleX:r,scaleY:i}=e,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let s=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:l}=c,u=e.pos[o],d=e.size[o];if(!u||s.clip!==!1&&(u.bottom<=Math.max(t.top,n.top)||u.top>=Math.min(t.bottom,n.bottom)||u.right<Math.max(t.left,n.left)-.1||u.left>Math.min(t.right,n.right)+.1)){l.style.top=ku;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=Nu.get(c)??d.bottom-d.top,g=c.offset||Lu,_=this.view.textDirection==Ia.LTR,v=d.width>n.right-n.left?_?n.left:n.right-d.width:_?Math.max(n.left,Math.min(u.left-(f?14:0)+g.x,n.right-m)):Math.min(Math.max(n.left,u.left-m+(f?14:0)-g.x),n.right-m),y=this.above[o];!s.strictSide&&(y?u.top-h-p-g.y<n.top:u.bottom+h+p+g.y>n.bottom)&&y==n.bottom-u.bottom>u.top-n.top&&(y=this.above[o]=!y);let b=(y?u.top-n.top:n.bottom-u.bottom)-p;if(b<h&&c.resize!==!1){if(b<this.view.defaultLineHeight){l.style.top=ku;continue}Nu.set(c,h),l.style.height=(h=b)/i+`px`}else l.style.height&&(l.style.height=``);let x=y?u.top-h-p-g.y:u.bottom+p+g.y,S=v+m;if(c.overlap!==!0)for(let e of a)e.left<S&&e.right>v&&e.top<x+h&&e.bottom>x&&(x=y?e.top-h-2-p:e.bottom+p+2);if(this.position==`absolute`?(l.style.top=(x-e.parent.top)/i+`px`,Fu(l,(v-e.parent.left)/r)):(l.style.top=x/i+`px`,Fu(l,v/r)),f){let e=u.left+(_?g.x:-g.x)-(v+14-7);f.style.left=e/r+`px`}c.overlap!==!0&&a.push({left:v,top:x,right:S,bottom:x+h}),l.classList.toggle(`cm-tooltip-above`,y),l.classList.toggle(`cm-tooltip-below`,!y),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=ku}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Fu(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var Iu=Y.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:`border-box`},"&light .cm-tooltip":{border:`1px solid #bbb`,backgroundColor:`#f5f5f5`},"&light .cm-tooltip-section:not(:first-child)":{borderTop:`1px solid #bbb`},"&dark .cm-tooltip":{backgroundColor:`#333338`,color:`white`},".cm-tooltip-arrow":{height:`7px`,width:`14px`,position:`absolute`,zIndex:-1,overflow:`hidden`,"&:before, &:after":{content:`''`,position:`absolute`,width:0,height:0,borderLeft:`7px solid transparent`,borderRight:`7px solid transparent`},".cm-tooltip-above &":{bottom:`-7px`,"&:before":{borderTop:`7px solid #bbb`},"&:after":{borderTop:`7px solid #f5f5f5`,bottom:`1px`}},".cm-tooltip-below &":{top:`-7px`,"&:before":{borderBottom:`7px solid #bbb`},"&:after":{borderBottom:`7px solid #f5f5f5`,top:`1px`}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:`#333338`,borderBottomColor:`#333338`},"&:after":{borderTopColor:`transparent`,borderBottomColor:`transparent`}}}),Lu={x:0,y:0},Ru=q.define({enables:[Pu,Iu]}),zu=q.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])}),Bu=class e{static create(t){return new e(t)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement(`div`),this.dom.classList.add(`cm-tooltip-hover`),this.manager=new Au(e,zu,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add(`cm-tooltip-section`),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)==null||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(r!==void 0){if(t===void 0)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp(`offset`)}get getCoords(){return this.passProp(`getCoords`)}get overlap(){return this.passProp(`overlap`)}get resize(){return this.passProp(`resize`)}},Vu=Ru.compute([zu],e=>{let t=e.facet(zu);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>e.end??e.pos)),create:Bu.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),Hu=q.define(),Uu=class{constructor(e,t,n,r,i,a){this.view=e,this.source=t,this.field=n,this.locked=r,this.setHover=i,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener(`mouseleave`,this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener(`mousemove`,this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let r,i=1;if(n.isWidget())r=n.posAtStart;else{if(r=e.posAtCoords(t),r==null)return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),o=a&&a.dir==Ia.RTL?-1:1;i=t.x<n.left?-o:o}this.activateHover(e,r,i)}activateHover(e,t,n,r){let i=this.source(e,t,n),a=t=>{if(t&&!(Array.isArray(t)&&!t.length)){let n=Array.isArray(t)?t:[t];r&&this.locked.set(n,r),e.dispatch({effects:this.setHover.of(n)})}};if(i&&`then`in i){let n=this.pending={pos:t};i.then(e=>{this.pending==n&&(this.pending=null,a(e))},t=>xo(e.state,t,`hover tooltip`))}else a(i)}get tooltip(){let e=this.view.plugin(Pu),t=e?e.manager.tooltips.findIndex(e=>e.create==Bu.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:t,tooltip:n}=this;if(t.length&&!this.locked.has(t)&&n&&!Gu(n.dom,e)||this.pending){let{pos:n}=t[0]||this.pending,r=t[0]?.end??n;(n==r?this.view.posAtCoords(this.lastMove)!=n:!Ku(this.view,n,r,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener(`mouseleave`,t);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener(`mouseleave`,t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener(`mouseleave`,this.mouseleave),this.view.dom.removeEventListener(`mousemove`,this.mousemove)}},Wu=4;function Gu(e,t){let{left:n,right:r,top:i,bottom:a}=e.getBoundingClientRect(),o;if(o=e.querySelector(`.cm-tooltip-arrow`)){let e=o.getBoundingClientRect();i=Math.min(e.top,i),a=Math.max(e.bottom,a)}return t.clientX>=n-Wu&&t.clientX<=r+Wu&&t.clientY>=i-Wu&&t.clientY<=a+Wu}function Ku(e,t,n,r,i,a){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,s)<i)return!1;let c=e.posAtCoords({x:r,y:i},!1);return c>=t&&c<=n}function qu(e,t={}){let n=Rr.define(),r=new WeakMap,i=_r.define({create(){return[]},update(e,a){let o=r.get(e);if(e.length&&(t.hideOnChange&&(a.docChanged||a.selection)||o&&o(a)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(a,e)))),a.docChanged&&e.length){let t=[];for(let n of e){let e=a.changes.mapPos(n.pos,-1,$n.TrackDel);if(e!=null){let r=Object.assign(Object.create(null),n);r.pos=e,r.end!=null&&(r.end=a.changes.mapPos(r.end)),t.push(r)}}e=t}for(let t of a.effects)t.is(n)&&(e=t.value,o=void 0),(t.is(Xu)&&!t.value||t.value==i)&&(e=[]);return e.length&&o&&r.set(e,o),e},provide:e=>zu.from(e)}),a=To.define(a=>new Uu(a,e,i,r,n,t.hoverTime||300));return{active:i,extension:[i,a,Hu.of(a),Vu]}}function Ju(e,t,n,r={}){let i=e.state.facet(Hu).map(t=>e.plugin(t)).filter(e=>!!e);if(r.tooltip&&r.tooltip.active){let e=i.find(e=>e.field==r.tooltip.active);e&&(i=[e])}for(let a of i)a.activateHover(e,t,n,r.until??(()=>!1))}function Yu(e,t){let n=e.plugin(Pu);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}var Xu=Rr.define(),Zu=q.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function Qu(e,t){let n=e.plugin($u),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var $u=To.fromClass(class{constructor(e){this.input=e.state.facet(nd),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Zu);this.top=new ed(e,!0,t.topContainer),this.bottom=new ed(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}update(e){let t=e.state.facet(Zu);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new ed(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new ed(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(nd);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],a=[],o=[];for(let n of t){let t=this.specs.indexOf(n),s;t<0?(s=n(e.view),o.push(s)):(s=this.panels[t],s.update&&s.update(e)),r.push(s),(s.top?i:a).push(s)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(a);for(let e of o)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Y.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),ed=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes=``,this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&=(this.dom.remove(),void 0);return}if(!this.dom){this.dom=document.createElement(`div`),this.dom.className=this.top?`cm-panels cm-panels-top`:`cm-panels cm-panels-bottom`,this.dom.style[this.top?`top`:`bottom`]=`0`;let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=td(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=td(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(` `))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(` `))e&&this.container.classList.add(e)}}};function td(e){let t=e.nextSibling;return e.remove(),t}var nd=q.define({enables:$u});function rd(e,t){let n,r=new Promise(e=>n=e),i=e=>sd(e,t,n);e.state.field(id,!1)?e.dispatch({effects:ad.of(i)}):e.dispatch({effects:Rr.appendConfig.of(id.init(()=>[i]))});let a=od.of(i);return{close:a,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(id).indexOf(i)>-1&&e.dispatch({effects:a})}),t))}}var id=_r.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(ad)?e=[n.value].concat(e):n.is(od)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>nd.computeN([e],t=>t.field(e))}),ad=Rr.define(),od=Rr.define();function sd(e,t,n){let r=t.content?t.content(e,()=>o(null)):null;if(!r){if(r=Fi(`form`),t.input){let e=Fi(`input`,t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add(`cm-textfield`),e.name||=`input`,r.appendChild(Fi(`label`,(t.label||``)+`: `,e))}else r.appendChild(document.createTextNode(t.label||``));r.appendChild(document.createTextNode(` `)),r.appendChild(Fi(`button`,{class:`cm-button`,type:`submit`},t.submitLabel||`OK`))}let i=r.nodeName==`FORM`?[r]:r.querySelectorAll(`form`);for(let e=0;e<i.length;e++){let t=i[e];t.addEventListener(`keydown`,e=>{e.keyCode==27?(e.preventDefault(),o(null)):e.keyCode==13&&(e.preventDefault(),o(t))}),t.addEventListener(`submit`,e=>{e.preventDefault(),o(t)})}let a=Fi(`div`,r,Fi(`button`,{onclick:()=>o(null),"aria-label":e.state.phrase(`close`),class:`cm-dialog-close`,type:`button`},[`×`]));t.class&&(a.className=t.class),a.classList.add(`cm-dialog`);function o(t){a.contains(a.ownerDocument.activeElement)&&e.focus(),n(t)}return{dom:a,top:t.top,mount:()=>{if(t.focus){let e;e=typeof t.focus==`string`?r.querySelector(t.focus):r.querySelector(`input`)||r.querySelector(`button`),e&&`select`in e?e.select():e&&`focus`in e&&e.focus()}}}}var cd=class extends ti{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};cd.prototype.elementClass=``,cd.prototype.toDOM=void 0,cd.prototype.mapMode=$n.TrackBefore,cd.prototype.startSide=cd.prototype.endSide=-1,cd.prototype.point=!0;var ld=q.define(),ud=q.define(),dd={class:``,renderEmptyElements:!1,elementStyle:``,markers:()=>oi.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:`before`},fd=q.define();function pd(e){return[hd(),fd.of({...dd,...e})]}var md=q.define({combine:e=>e.some(e=>e)});function hd(e){let t=[gd];return e&&e.fixed===!1&&t.push(md.of(!0)),t}var gd=To.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement(`div`),this.dom.className=`cm-gutters cm-gutters-before`,this.dom.setAttribute(`aria-hidden`,`true`),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.gutters=e.state.facet(fd).map(t=>new bd(e,t)),this.fixed=!e.state.facet(md);for(let e of this.gutters)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position=`sticky`),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement(`div`),this.domAfter.className=`cm-gutters cm-gutters-after`,this.domAfter.setAttribute(`aria-hidden`,`true`),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+`px`,this.domAfter.style.position=this.fixed?`sticky`:``,this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+`px`;this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(md)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?`sticky`:``,this.domAfter&&(this.domAfter.style.position=this.fixed?`sticky`:``)),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=oi.iter(this.view.state.facet(ld),this.view.viewport.from),r=[],i=this.gutters.map(e=>new yd(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let a of e.type)if(a.type==ta.Text&&t){vd(n,r,a.from);for(let e of i)e.line(this.view,a,r);t=!1}else if(a.widget)for(let e of i)e.widget(this.view,a)}else if(e.type==ta.Text){vd(n,r,e.from);for(let t of i)t.line(this.view,e,r)}else if(e.widget)for(let t of i)t.widget(this.view,e);for(let e of i)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(fd),n=e.state.facet(fd),r=e.docChanged||e.heightChanged||e.viewportChanged||!oi.eq(e.startState.facet(ld),e.state.facet(ld),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new bd(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)e.config.side==`after`?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>Y.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==Ia.LTR?{left:r,right:i}:{right:r,left:i}})});function _d(e){return Array.isArray(e)?e:[e]}function vd(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}var yd=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=oi.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,i=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==r.elements.length){let t=new xd(e,a,i,n);r.elements.push(t),r.dom.appendChild(t.dom)}else r.elements[this.i].update(e,a,i,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];vd(this.cursor,r,t.from),n.length&&(r=r.concat(n));let i=this.gutter.config.lineMarker(e,t,r);i&&r.unshift(i);let a=this.gutter;r.length==0&&!a.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let n of e.state.facet(ud)){let i=n(e,t.widget,t);i&&(r||=[]).push(i)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},bd=class{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement(`div`),this.dom.className=`cm-gutter`+(this.config.class?` `+this.config.class:``);for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let i=r.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let e=i.getBoundingClientRect();a=(e.top+e.bottom)/2}else a=r.clientY;let o=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[n](e,o,r)&&r.preventDefault()});this.markers=_d(t.markers(e)),t.initialSpacer&&(this.spacer=new xd(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+=`visibility: hidden; pointer-events: none`)}update(e){let t=this.markers;if(this.markers=_d(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!oi.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},xd=class{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(`div`),this.dom.className=`cm-gutterElement`,this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+`px`),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+`px`:``),Sd(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n=`cm-gutterElement`,r=this.dom.firstChild;for(let i=0,a=0;;){let o=a,s=i<t.length?t[i++]:null,c=!1;if(s){let e=s.elementClass;e&&(n+=` `+e);for(let e=a;e<this.markers.length;e++)if(this.markers[e].compare(s)){o=e,c=!0;break}}else o=this.markers.length;for(;a<o;){let e=this.markers[a++];if(e.toDOM){e.destroy(r);let t=r.nextSibling;r.remove(),r=t}}if(!s)break;s.toDOM&&(c?r=r.nextSibling:this.dom.insertBefore(s.toDOM(e),r)),c&&a++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}};function Sd(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}var Cd=q.define(),wd=q.define(),Td=q.define({combine(e){return ei(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let r=n[e],i=t[e];n[e]=r?(e,t,n)=>r(e,t,n)||i(e,t,n):i}return n}})}}),Ed=class extends cd{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function Dd(e,t){return e.state.facet(Td).formatNumber(t,e.state)}var Od=fd.compute([Td],e=>({class:`cm-lineNumbers`,renderEmptyElements:!1,markers(e){return e.state.facet(Cd)},lineMarker(e,t,n){return n.some(e=>e.toDOM)?null:new Ed(Dd(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(wd)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Td)!=e.state.facet(Td),initialSpacer(e){return new Ed(Dd(e,Ad(e.state.doc.lines)))},updateSpacer(e,t){let n=Dd(t.view,Ad(t.view.state.doc.lines));return n==e.number?e:new Ed(n)},domEventHandlers:e.facet(Td).domEventHandlers,side:`before`}));function kd(e={}){return[Td.of(e),hd(),Od]}function Ad(e){let t=9;for(;t<e;)t=t*10+9;return t}var jd=new class extends cd{constructor(){super(...arguments),this.elementClass=`cm-activeLineGutter`}},Md=ld.compute([`selection`],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(jd.range(i)))}return oi.of(t)});function Nd(){return Md}var Pd=1024,Fd=0,Id=class{constructor(e,t){this.from=e,this.to=t}},Ld=class{constructor(e={}){this.id=Fd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=Bd.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};Ld.closedBy=new Ld({deserialize:e=>e.split(` `)}),Ld.openedBy=new Ld({deserialize:e=>e.split(` `)}),Ld.group=new Ld({deserialize:e=>e.split(` `)}),Ld.isolate=new Ld({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),Ld.contextHash=new Ld({perNode:!0}),Ld.lookAhead=new Ld({perNode:!0}),Ld.mounted=new Ld({perNode:!0});var Rd=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[Ld.mounted.id]}},zd=Object.create(null),Bd=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):zd,r=!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(Ld.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(Ld.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};Bd.none=new Bd(``,Object.create(null),0,8);var Vd=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new Bd(e.name,r,e.id,e.flags):e)}return new e(n)}},Hd=new WeakMap,Ud=new WeakMap,Wd;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(Wd||={});var Gd=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=Rd.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new of(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new of(Hd.get(this)||this.topNode);return r.moveTo(e,t),Hd.set(this,r._tree),r}get topNode(){return new Zd(this,0,0,null)}resolve(e,t=0){let n=Yd(Hd.get(this)||this.topNode,e,t,!1);return Hd.set(this,n),n}resolveInner(e,t=0){let n=Yd(Ud.get(this)||this.topNode,e,t,!0);return Ud.set(this,n),n}resolveStack(e,t=0){return af(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&Wd.IncludeAnonymous)>0;for(let e=this.cursor(a|Wd.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:df(Bd.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(Bd.none,t,n,r)))}static build(e){return cf(e)}};Gd.empty=new Gd(Bd.none,[],[],0);var Kd=class e{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new e(this.buffer,this.index)}},qd=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Bd.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(Jd(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function Jd(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function Yd(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof Zd&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:Wd.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof Zd&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var Xd=class{cursor(e=0){return new of(this,e)}getChild(e,t=null,n=null){let r=Qd(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Qd(this,e,t,n)}resolve(e,t=0){return Yd(this,e,t,!1)}resolveInner(e,t=0){return Yd(this,e,t,!0)}matchContext(e){return $d(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},Zd=class e extends Xd{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,a=0){for(let o=this;;){for(let{children:s,positions:c}=o._tree,l=n>0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(!(!(a&Wd.EnterBracketed&&l instanceof Gd&&(d=Rd.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length)&&!Jd(i,r,u,u+l.length))){if(l instanceof qd){if(a&Wd.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new tf(new ef(o,l,t,u),null,e)}else if(a&Wd.IncludeAnonymous||!l.type.isAnonymous||sf(l)){let s;if(!(a&Wd.IgnoreMounts)&&(s=Rd.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&Wd.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&Wd.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,n,r=0){let i;if(!(r&Wd.IgnoreOverlays)&&(i=Rd.get(this._tree))&&i.overlay){let a=t-this.from,o=r&Wd.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Qd(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function $d(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var ef=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},tf=class e extends Xd{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,n,r=0){if(r&Wd.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new Gd(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function nf(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof Zd&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new rf(i,n)}var rf=class{constructor(e,t){this.heads=e,this.node=t}get next(){return nf(this.heads)}};function af(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof Zd?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let a=Rd.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Zd(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(Yd(o,t,n,!1))}}return i?nf(i):r}var of=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Wd.EnterBracketed,e instanceof Zd)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Zd?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&Wd.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Wd.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Wd.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else ({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&Wd.IncludeAnonymous||e instanceof qd||!e.type.isAnonymous||sf(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new tf(this.buffer,t,this.stack[e]);return this.bufferNode=new tf(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return $d(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return $d(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function sf(e){return e.children.some(e=>e instanceof qd||!e.type.isAnonymous||sf(e))}function cf(e){let{buffer:t,nodeSet:n,maxBufferLength:r=Pd,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new Kd(t,t.length):t,s=n.types,c=0,l=0;function u(e,t,_,v,y,b){let{id:x,start:S,end:C,size:w}=o,ee=l,T=c;if(w<0)if(o.next(),w==-1){let t=i[x];_.push(t),v.push(S-e);return}else if(w==-3){c=x;return}else if(w==-4){l=x;return}else throw RangeError(`Unrecognized record size: ${w}`);let te=s[x],ne,E,D=S-e;if(C-S<=r&&(E=h(o.pos-t,y))){let t=new Uint16Array(E.size-E.skip),r=o.pos-E.size,i=t.length;for(;o.pos>r;)i=g(E.start,t,i);ne=new qd(t,C-E.start,n),D=E.start-e}else{let e=o.pos-w;o.next();let t=[],n=[],i=x>=a?x:-1,s=0,c=C;for(;o.pos>e;)i>=0&&o.id==i&&o.size>=0?(o.end<=c-r&&(p(t,n,S,s,o.end,c,i,ee,T),s=t.length,c=o.end),o.next()):b>2500?d(S,e,t,n):u(S,e,t,n,i,b+1);if(i>=0&&s>0&&s<t.length&&p(t,n,S,s,S,c,i,ee,T),t.reverse(),n.reverse(),i>-1&&s>0){let e=f(te,T);ne=df(te,t,n,0,t.length,0,C-S,e,e)}else ne=m(te,t,n,C-S,ee-C,T)}_.push(ne),v.push(D)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new qd(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof Gd){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(Ld.lookAhead))&&(a=r[o]+s.length+c)}return m(e,n,r,i,a,t)}}function p(e,t,r,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(m(n.types[s],u,d,o-a,c-o,l)),t.push(a-r)}function m(e,t,n,r,i,a,o){if(a){let e=[Ld.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[Ld.lookAhead,i];o=o?[e].concat(o):[e]}return new Gd(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o<r||n.start<l)break;let d=n.id>=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0)if(n.size==-3||n.size==-4)d+=4;else break scan;else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r<a){let a=n;if(u>4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new Gd(s[e.topID],_.reverse(),v.reverse(),y)}var lf=new WeakMap;function uf(e,t){if(!e.isAnonymous||t instanceof qd||t.type!=e)return 1;let n=lf.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Gd)){n=1;break}n+=uf(e,r)}lf.set(t,n)}return n}function df(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=uf(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=uf(e,t[s]);for(s++;s<i;s++){let n=uf(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(df(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var ff=class{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof tf?this.setBuffer(e.context.buffer,e.index,t):e instanceof Zd&&this.map.set(e.tree,t)}get(e){return e instanceof tf?this.getBuffer(e.context.buffer,e.index):e instanceof Zd?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},pf=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},mf=class{startParse(e,t,n){return typeof e==`string`&&(e=new hf(e)),n=n?n.length?n.map(e=>new Id(e.from,e.to)):[new Id(0,0)]:[new Id(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},hf=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};function gf(e){return(t,n,r,i)=>new xf(t,e,n,r,i)}var _f=class{constructor(e,t,n,r,i,a){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=i,this.from=a}};function vf(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var yf=class{constructor(e,t,n,r,i,a,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.bracketed=a,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}},bf=new Ld({perNode:!0}),xf=class{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),this.stoppedAt!=null)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return this.stoppedAt!=null&&(e=new Gd(e.type,e.children,e.positions,e.length,e.propValues.concat([[bf,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Ld.mounted.id]=new Rd(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new Ef(this.fragments),t=null,n=null,r=new of(new Zd(this.baseTree,this.ranges[0].from,0,null),Wd.IncludeAnonymous|Wd.IgnoreMounts);scan:for(let i,a;;){let o=!0,s;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)o=!1;else if(e.hasNode(r)){if(t){let e=t.mounts.find(e=>e.frag.from<=r.from&&e.frag.to>=r.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let i=n.from+e.pos,a=n.to+e.pos;i>=r.from&&a<=r.to&&!t.ranges.some(e=>e.from<a&&e.to>i)&&t.ranges.push({from:i,to:a})}}o=!1}else if(n&&(a=Sf(n.ranges,r.from,r.to)))o=a!=2;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.from<r.to||!i.overlay)){r.tree||(wf(r),t&&t.depth++,n&&n.depth++);let a=e.findMounts(r.from,i.parser);if(typeof i.overlay==`function`)t=new yf(i.parser,i.overlay,a,this.inner.length,r.from,!!i.bracketed,r.tree,t);else{let e=Df(this.ranges,i.overlay||(r.from<r.to?[new Id(r.from,r.to)]:[]));e.length&&vf(e),(e.length||!i.overlay)&&this.inner.push(new _f(i.parser,e.length?i.parser.startParse(this.input,kf(a,e),e):i.parser.startParse(``),i.overlay?i.overlay.map(e=>new Id(e.from-r.from,e.to-r.from)):null,!!i.bracketed,r.tree,e.length?e[0].from:r.from)),i.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):o=!1}}else if(t&&(s=t.predicate(r))&&(s===!0&&(s=new Id(r.from,r.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(o&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break scan;if(t&&!--t.depth){let e=Df(this.ranges,t.ranges);e.length&&(vf(e),this.inner.splice(t.index,0,new _f(t.parser,t.parser.startParse(this.input,kf(t.mounts,e),e),t.ranges.map(e=>new Id(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}};function Sf(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function Cf(e,t,n,r,i,a){if(t<n){let o=e.buffer[t+1];r.push(e.slice(t,n,o)),i.push(o-a)}}function wf(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,a=i.children.indexOf(r),o=i.children[a],s=o.buffer,c=[a];function l(e,r,i,a,u,d){let f=n[d],p=[],m=[];Cf(o,e,f,p,m,a);let h=s[f+1],g=s[f+2];c.push(p.length);let _=d?l(f+4,s[f+3],o.set.types[s[f]],h,g-h,d-1):t.toTree();return p.push(_),m.push(h-a),Cf(o,s[f+3],r,p,m,a),new Gd(i,p,m,u)}i.children[a]=l(0,s.length,Bd.none,0,o.length,n.length-1);for(let t of c){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new Zd(n,r+e.from,t,e._tree))}}var Tf=class{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(Wd.IncludeAnonymous|Wd.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)if(!(t.to>=e&&t.enter(n,1,Wd.IgnoreOverlays|Wd.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof Gd)t=t.children[0];else break}return!1}},Ef=class{constructor(e){if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let t=this.curFrag=e[0];this.curTo=t.tree.prop(bf)??t.to,this.inner=new Tf(t.tree,-t.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=e.tree.prop(bf)??e.to,this.inner=new Tf(e.tree,-e.offset)}}findMounts(e,t){let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let r=e.tree?.prop(Ld.mounted);if(r&&r.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let i=this.fragments[t];if(i.from>=e.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:e.from-i.offset,mount:r})}}}return n}};function Df(e,t){let n=null,r=t;for(let i=1,a=0;i<e.length;i++){let o=e[i-1].to,s=e[i].from;for(;a<r.length;a++){let e=r[a];if(e.from>=s)break;e.to<=o||(n||(r=n=t.slice()),e.from<o?(n[a]=new Id(e.from,o),e.to>s&&n.splice(a+1,0,new Id(s,e.to))):e.to>s?n[a--]=new Id(s,e.to):n.splice(a--,1))}}return r}function Of(e,t,n,r){let i=0,a=0,o=!1,s=!1,c=-1e9,l=[];for(;;){let u=i==e.length?1e9:o?e[i].to:e[i].from,d=a==t.length?1e9:s?t[a].to:t[a].from;if(o!=s){let e=Math.max(c,n),t=Math.min(u,d,r);e<t&&l.push(new Id(e,t))}if(c=Math.min(u,d),c==1e9)break;u==c&&(o?(o=!1,i++):o=!0),d==c&&(s?(s=!1,a++):s=!0)}return l}function kf(e,t){let n=[];for(let{pos:r,mount:i,frag:a}of e){let e=r+(i.overlay?i.overlay[0].from:0),o=e+i.tree.length,s=Math.max(a.from,e),c=Math.min(a.to,o);if(i.overlay){let o=Of(t,i.overlay.map(e=>new Id(e.from+r,e.to+r)),s,c);for(let t=0,r=s;;t++){let s=t==o.length,l=s?c:o[t].from;if(l>r&&n.push(new pf(r,l,i.tree,-e,a.from>=r||a.openStart,a.to<=l||a.openEnd)),s)break;r=o[t].to}}else n.push(new pf(s,c,i.tree,-e,a.from>=e||a.openStart,a.to<=o||a.openEnd))}return n}var Af=0,jf=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Af++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new Nf(e);return e=>e.modified.indexOf(t)>-1?e:Nf.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},Mf=0,Nf=class e{constructor(e){this.name=e,this.instances=[],this.id=Mf++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&Pf(n,e.modified));if(r)return r;let i=[],a=new jf(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=Ff(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function Pf(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function Ff(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function If(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new Rf(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Lf.add(t)}var Lf=new Ld({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new Rf(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),Rf=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};Rf.empty=new Rf([],2,null);function zf(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function Bf(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function Vf(e,t,n,r=0,i=e.length){let a=new Hf(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var Hf=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=``}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:a,from:o,to:s}=e;if(o>=n||s<=t)return;a.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(a)));let c=r,l=Uf(e)||Rf.empty,u=Bf(i,l.tags);if(u&&(c&&(c+=` `),c+=u,l.mode==1&&(r+=(r?` `:``)+u)),this.startSpan(Math.max(t,o),c),l.opaque)return;let d=e.tree&&e.tree.prop(Ld.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do{if(e.to<=t)continue;if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function Uf(e){let t=e.type.prop(Lf);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var X=jf.define,Wf=X(),Gf=X(),Kf=X(Gf),qf=X(Gf),Jf=X(),Yf=X(Jf),Xf=X(Jf),Zf=X(),Qf=X(Zf),$f=X(),ep=X(),tp=X(),np=X(tp),rp=X(),Z={comment:Wf,lineComment:X(Wf),blockComment:X(Wf),docComment:X(Wf),name:Gf,variableName:X(Gf),typeName:Kf,tagName:X(Kf),propertyName:qf,attributeName:X(qf),className:X(Gf),labelName:X(Gf),namespace:X(Gf),macroName:X(Gf),literal:Jf,string:Yf,docString:X(Yf),character:X(Yf),attributeValue:X(Yf),number:Xf,integer:X(Xf),float:X(Xf),bool:X(Jf),regexp:X(Jf),escape:X(Jf),color:X(Jf),url:X(Jf),keyword:$f,self:X($f),null:X($f),atom:X($f),unit:X($f),modifier:X($f),operatorKeyword:X($f),controlKeyword:X($f),definitionKeyword:X($f),moduleKeyword:X($f),operator:ep,derefOperator:X(ep),arithmeticOperator:X(ep),logicOperator:X(ep),bitwiseOperator:X(ep),compareOperator:X(ep),updateOperator:X(ep),definitionOperator:X(ep),typeOperator:X(ep),controlOperator:X(ep),punctuation:tp,separator:X(tp),bracket:np,angleBracket:X(np),squareBracket:X(np),paren:X(np),brace:X(np),content:Zf,heading:Qf,heading1:X(Qf),heading2:X(Qf),heading3:X(Qf),heading4:X(Qf),heading5:X(Qf),heading6:X(Qf),contentSeparator:X(Zf),list:X(Zf),quote:X(Zf),emphasis:X(Zf),strong:X(Zf),link:X(Zf),monospace:X(Zf),strikethrough:X(Zf),inserted:X(),deleted:X(),changed:X(),invalid:X(),meta:rp,documentMeta:X(rp),annotation:X(rp),processingInstruction:X(rp),definition:jf.defineModifier(`definition`),constant:jf.defineModifier(`constant`),function:jf.defineModifier(`function`),standard:jf.defineModifier(`standard`),local:jf.defineModifier(`local`),special:jf.defineModifier(`special`)};for(let e in Z){let t=Z[e];t instanceof jf&&(t.name=e)}zf([{tag:Z.link,class:`tok-link`},{tag:Z.heading,class:`tok-heading`},{tag:Z.emphasis,class:`tok-emphasis`},{tag:Z.strong,class:`tok-strong`},{tag:Z.keyword,class:`tok-keyword`},{tag:Z.atom,class:`tok-atom`},{tag:Z.bool,class:`tok-bool`},{tag:Z.url,class:`tok-url`},{tag:Z.labelName,class:`tok-labelName`},{tag:Z.inserted,class:`tok-inserted`},{tag:Z.deleted,class:`tok-deleted`},{tag:Z.literal,class:`tok-literal`},{tag:Z.string,class:`tok-string`},{tag:Z.number,class:`tok-number`},{tag:[Z.regexp,Z.escape,Z.special(Z.string)],class:`tok-string2`},{tag:Z.variableName,class:`tok-variableName`},{tag:Z.local(Z.variableName),class:`tok-variableName tok-local`},{tag:Z.definition(Z.variableName),class:`tok-variableName tok-definition`},{tag:Z.special(Z.variableName),class:`tok-variableName2`},{tag:Z.definition(Z.propertyName),class:`tok-propertyName tok-definition`},{tag:Z.typeName,class:`tok-typeName`},{tag:Z.namespace,class:`tok-namespace`},{tag:Z.className,class:`tok-className`},{tag:Z.macroName,class:`tok-macroName`},{tag:Z.propertyName,class:`tok-propertyName`},{tag:Z.operator,class:`tok-operator`},{tag:Z.comment,class:`tok-comment`},{tag:Z.meta,class:`tok-meta`},{tag:Z.invalid,class:`tok-invalid`},{tag:Z.punctuation,class:`tok-punctuation`}]);var ip=new Ld;function ap(e){return q.define({combine:e?t=>t.concat(e):void 0})}var op=new Ld,sp=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,$r.prototype.hasOwnProperty(`tree`)||Object.defineProperty($r.prototype,`tree`,{get(){return up(this)}}),this.parser=t,this.extension=[yp.of(this),$r.languageData.of((e,t,n)=>{let r=cp(e,t,n),i=r.type.prop(ip);if(!i)return[];let a=e.facet(i),o=r.type.prop(op);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return cp(e,t,n).type.prop(ip)==this.data}findRegions(e){let t=e.facet(yp);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(ip)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(Ld.mounted);if(i){if(i.tree.prop(ip)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}else if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof Gd&&r(i,e.positions[n]+t)}};return r(up(e),0),n}get allowsNesting(){return!0}};sp.setState=Rr.define();function cp(e,t,n){let r=e.facet(yp),i=up(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,Wd.ExcludeBuffers|Wd.EnterBracketed))e.type.isTop&&(i=e);return i}var lp=class e extends sp{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=ap(t.languageData);return new e(n,t.parser.configure({props:[ip.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function up(e){let t=e.field(sp.state,!1);return t?t.tree:Gd.empty}var dp=class{constructor(e){this.doc=e,this.cursorPos=0,this.string=``,this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},fp=null,pp=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],Gd.empty,0,r,[],null)}startParse(){return this.parser.startParse(new dp(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Gd.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n)if(this.fragments=this.withoutTempSkipped(pf.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(pf.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=fp;fp=this;try{return e()}finally{fp=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=mp(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=pf.applyChanges(r,e),i=Gd.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=mp(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends mf{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=fp;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new Gd(Bd.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return fp}};function mp(e,t,n){return pf.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var hp=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=pp.create(t.facet(yp).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};sp.state=_r.define({create:hp.init,update(e,t){for(let e of t.effects)if(e.is(sp.setState))return e.value;return t.startState.facet(yp)==t.state.facet(yp)?e.apply(t):hp.init(t.state)}});var gp=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(gp=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var _p=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,vp=To.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(sp.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(sp.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=gp(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(sp.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!_p?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>_p&&_p()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:sp.setState.of(new hp(i.context))})),this.chunkBudget>0&&!(s&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>xo(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),yp=q.define({combine(e){return e.length?e[0]:null},enables:e=>[sp.state,vp,Y.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),bp=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},xp=q.define(),Sp=q.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function Cp(e){let t=e.facet(Sp);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function wp(e,t){let n=``,r=e.tabSize,i=e.facet(Sp)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function Tp(e,t){e instanceof $r&&(e=new Ep(e));for(let n of e.state.facet(xp)){let r=n(e,t);if(r!==void 0)return r}let n=up(e.state);return n.length>=t?Op(e,n,t):null}var Ep=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=Cp(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return``;let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(i+=a-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return yi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},Dp=new Ld;function Op(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return kp(r,e,n)}function kp(e,t,n){for(let r=e;r;r=r.next){let e=jp(r.node);if(e)return e(Np.create(t,n,r))}return 0}function Ap(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function jp(e){let t=e.type.prop(Dp);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(Ld.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>Lp(e,!0,1,void 0,n&&!Ap(e)?t.from:void 0)}return e.parent==null?Mp:null}function Mp(){return 0}var Np=class e extends Ep{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(t,n,r){return new e(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Pp(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return kp(this.context.next,this.base,this.pos)}};function Pp(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Fp(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function Ip({closing:e,align:t=!0,units:n=1}){return r=>Lp(r,t,n,e)}function Lp(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?Fp(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var Rp=e=>e.baseIndent;function zp({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var Bp=200;function Vp(){return $r.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent(`input.type`)&&!e.isUserEvent(`input.complete`))return e;let t=e.startState.languageDataAt(`indentOnInput`,e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+Bp)return e;let a=n.sliceString(i.from,r);if(!t.some(e=>e.test(a)))return e;let{state:o}=e,s=-1,c=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==s)continue;s=t.from;let n=Tp(o,t.from);if(n==null)continue;let r=/^\s*/.exec(t.text)[0],i=wp(o,n);r!=i&&c.push({from:t.from,to:t.from+r.length,insert:i})}return c.length?[e,{changes:c,sequential:!0}]:e})}var Hp=q.define(),Up=new Ld;function Wp(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function Gp(e,t,n){let r=up(e);if(r.length<n)return null;let i=r.resolveStack(n,1),a=null;for(let o=i;o;o=o.next){let i=o.node;if(i.to<=n||i.from>n)continue;if(a&&i.from<t)break;let s=i.type.prop(Up);if(s&&(i.to<r.length-50||r.length==e.doc.length||!Kp(i))){let r=s(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(a=r)}}return a}function Kp(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function qp(e,t,n){for(let r of e.facet(Hp)){let i=r(e,t,n);if(i)return i}return Gp(e,t,n)}function Jp(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}var Yp=Rr.define({map:Jp}),Xp=Rr.define({map:Jp});function Zp(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}var Qp=_r.define({create(){return na.none},update(e,t){t.isUserEvent(`delete`)&&t.changes.iterChangedRanges((t,n)=>e=$p(e,t,n)),e=e.map(t.changes);for(let n of t.effects)if(n.is(Yp)&&!tm(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(cm),i=r?na.replace({widget:new fm(r(t.state,n.value))}):dm;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(Xp)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=$p(e,t.selection.main.head)),e},provide:e=>Y.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError(`Invalid JSON for fold state`);let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid JSON for fold state`);t.push(dm.range(r,i))}return na.set(t,!0)}});function $p(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function em(e,t,n){var r;let i=null;return(r=e.field(Qp,!1))==null||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function tm(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function nm(e,t){return e.field(Qp,!1)?t:t.concat(Rr.appendConfig.of(lm()))}var rm=e=>{for(let t of Zp(e)){let n=qp(e.state,t.from,t.to);if(n)return e.dispatch({effects:nm(e.state,[Yp.of(n),am(e,n)])}),!0}return!1},im=e=>{if(!e.state.field(Qp,!1))return!1;let t=[];for(let n of Zp(e)){let r=em(e.state,n.from,n.to);r&&t.push(Xp.of(r),am(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function am(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return Y.announce.of(`${e.state.phrase(n?`Folded lines`:`Unfolded lines`)} ${r} ${e.state.phrase(`to`)} ${i}.`)}var om=[{key:`Ctrl-Shift-[`,mac:`Cmd-Alt-[`,run:rm},{key:`Ctrl-Shift-]`,mac:`Cmd-Alt-]`,run:im},{key:`Ctrl-Alt-[`,run:e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),a=qp(t,i.from,i.to);a&&n.push(Yp.of(a)),r=(a?e.lineBlockAt(a.to):i).to+1}return n.length&&e.dispatch({effects:nm(e.state,n)}),!!n.length}},{key:`Ctrl-Alt-]`,run:e=>{let t=e.state.field(Qp,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(Xp.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],sm={placeholderDOM:null,preparePlaceholder:null,placeholderText:`…`},cm=q.define({combine(e){return ei(e,sm)}});function lm(e){let t=[Qp,gm];return e&&t.push(cm.of(e)),t}function um(e,t){let{state:n}=e,r=n.facet(cm),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=em(e.state,n.from,n.to);r&&e.dispatch({effects:Xp.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let a=document.createElement(`span`);return a.textContent=r.placeholderText,a.setAttribute(`aria-label`,n.phrase(`folded code`)),a.title=n.phrase(`unfold`),a.className=`cm-foldPlaceholder`,a.onclick=i,a}var dm=na.replace({widget:new class extends ea{toDOM(e){return um(e,null)}}}),fm=class extends ea{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return um(e,this.value)}},pm={openText:`⌄`,closedText:`›`,markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},mm=class extends cd{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement(`span`);return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?`Fold line`:`Unfold line`),t}};function hm(e={}){let t={...pm,...e},n=new mm(t,!0),r=new mm(t,!1),i=To.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(yp)!=e.state.facet(yp)||e.startState.field(Qp,!1)!=e.state.field(Qp,!1)||up(e.startState)!=up(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new ci;for(let i of e.viewportLineBlocks){let a=em(e.state,i.from,i.to)?r:qp(e.state,i.from,i.to)?n:null;a&&t.add(i.from,i.from,a)}return t.finish()}}),{domEventHandlers:a}=t;return[i,pd({class:`cm-foldGutter`,markers(e){return e.plugin(i)?.markers||oi.empty},initialSpacer(){return new mm(t,!1)},domEventHandlers:{...a,click:(e,t,n)=>{if(a.click&&a.click(e,t,n))return!0;let r=em(e.state,t.from,t.to);if(r)return e.dispatch({effects:Xp.of(r)}),!0;let i=qp(e.state,t.from,t.to);return i?(e.dispatch({effects:Yp.of(i)}),!0):!1}}}),lm()]}var gm=Y.baseTheme({".cm-foldPlaceholder":{backgroundColor:`#eee`,border:`1px solid #ddd`,color:`#888`,borderRadius:`.2em`,margin:`0 1px`,padding:`0 1px`,cursor:`pointer`},".cm-foldGutter span":{padding:`0 1px`,cursor:`pointer`}}),_m=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=Ti.newName();return(n||=Object.create(null))[`.`+t]=e,t}let i=typeof t.all==`string`?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof sp?e=>e.prop(ip)==a.data:a?e=>e==a:void 0,this.style=zf(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new Ti(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},vm=q.define(),ym=q.define({combine(e){return e.length?[e[0]]:null}});function bm(e){let t=e.facet(vm);return t.length?t:e.facet(ym)}function xm(e,t){let n=[Cm],r;return e instanceof _m&&(e.module&&n.push(Y.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(ym.of(e)):r?n.push(vm.computeN([Y.darkTheme],t=>t.facet(Y.darkTheme)==(r==`dark`)?[e]:[])):n.push(vm.of(e)),n}var Sm=class{constructor(e){this.markCache=Object.create(null),this.tree=up(e.state),this.decorations=this.buildDeco(e,bm(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=up(e.state),n=bm(e.state),r=n!=bm(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return na.none;let n=new ci;for(let{from:r,to:i}of e.visibleRanges)Vf(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=na.mark({class:r})))},r,i);return n.finish()}},Cm=br.high(To.fromClass(Sm,{decorations:e=>e.decorations})),wm=_m.define([{tag:Z.meta,color:`#404740`},{tag:Z.link,textDecoration:`underline`},{tag:Z.heading,textDecoration:`underline`,fontWeight:`bold`},{tag:Z.emphasis,fontStyle:`italic`},{tag:Z.strong,fontWeight:`bold`},{tag:Z.strikethrough,textDecoration:`line-through`},{tag:Z.keyword,color:`#708`},{tag:[Z.atom,Z.bool,Z.url,Z.contentSeparator,Z.labelName],color:`#219`},{tag:[Z.literal,Z.inserted],color:`#164`},{tag:[Z.string,Z.deleted],color:`#a11`},{tag:[Z.regexp,Z.escape,Z.special(Z.string)],color:`#e40`},{tag:Z.definition(Z.variableName),color:`#00f`},{tag:Z.local(Z.variableName),color:`#30a`},{tag:[Z.typeName,Z.namespace],color:`#085`},{tag:Z.className,color:`#167`},{tag:[Z.special(Z.variableName),Z.macroName],color:`#256`},{tag:Z.definition(Z.propertyName),color:`#00c`},{tag:Z.comment,color:`#940`},{tag:Z.invalid,color:`#f00`}]),Tm=Y.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:`#328c8252`},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bb555544`}}),Em=1e4,Dm=`()[]{}`,Om=q.define({combine(e){return ei(e,{afterCursor:!0,brackets:Dm,maxScanDistance:Em,renderMatch:jm})}}),km=na.mark({class:`cm-matchingBracket`}),Am=na.mark({class:`cm-nonmatchingBracket`});function jm(e){let t=[],n=e.matched?km:Am;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function Mm(e){let t=[],n=e.facet(Om);for(let r of e.selection.ranges){if(!r.empty)continue;let i=Rm(e,r.head,-1,n)||r.head>0&&Rm(e,r.head-1,1,n)||n.afterCursor&&(Rm(e,r.head,1,n)||r.head<e.doc.length&&Rm(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return na.set(t,!0)}var Nm=[To.fromClass(class{constructor(e){this.paused=!1,this.decorations=Mm(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=Mm(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),Tm];function Pm(e={}){return[Om.of(e),Nm]}var Fm=new Ld;function Im(e,t,n){let r=e.prop(t<0?Ld.openedBy:Ld.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function Lm(e){let t=e.type.prop(Fm);return t?t(e.node):e}function Rm(e,t,n,r={}){let i=r.maxScanDistance||Em,a=r.brackets||Dm,o=up(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=Im(r.type,n,a);if(i&&r.from<r.to){let o=Lm(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return zm(e,t,n,r,o,i,a)}}return Bm(e,t,n,o,s.type,i,a)}function zm(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from<u.to){let e=Lm(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}else if(Im(u.type,n,o))l++;else if(Im(u.type,-n,o)){if(l==0){let e=Lm(u);return{start:c,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}l--}}while(n<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function Bm(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i))if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}var Vm=Object.create(null),Hm=[Bd.none],Um=[],Wm=Object.create(null),Gm=Object.create(null);for(let[e,t]of[[`variable`,`variableName`],[`variable-2`,`variableName.special`],[`string-2`,`string.special`],[`def`,`variableName.definition`],[`tag`,`tagName`],[`attribute`,`attributeName`],[`type`,`typeName`],[`builtin`,`variableName.standard`],[`qualifier`,`modifier`],[`error`,`invalid`],[`header`,`heading`],[`property`,`propertyName`]])Gm[e]=qm(Vm,t);function Km(e,t){Um.indexOf(e)>-1||(Um.push(e),console.warn(t))}function qm(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||Z[n];r?typeof r==`function`?t.length?t=t.map(r):Km(n,`Modifier ${n} used at start of tag`):t.length?Km(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:Km(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,`_`),i=r+` `+n.map(e=>e.id),a=Wm[i];if(a)return a.id;let o=Wm[i]=Bd.define({id:Hm.length,name:r,props:[If({[r]:n})]});return Hm.push(o),o.id}Ia.RTL,Ia.LTR;var Jm=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=$m(e.state,n.from);return r.line?Xm(e):r.block?Qm(e):!1};function Ym(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var Xm=Ym(ih,0),Zm=Ym(rh,0),Qm=Ym((e,t)=>rh(e,t,nh(t)),0);function $m(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var eh=50;function th(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-eh,r),o=e.sliceDoc(i,i+eh),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=2*eh?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+eh),d=e.sliceDoc(i-eh,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function nh(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function rh(e,t,n=t.selection.ranges){let r=n.map(e=>$m(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>th(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function ih(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=$m(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}else if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var ah=Fr.define(),oh=Fr.define(),sh=q.define(),ch=q.define({combine(e){return ei(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),lh=_r.define({create(){return Oh.empty},update(e,t){let n=t.state.facet(ch),r=t.annotation(ah);if(r){let i=gh.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?_h(o,o.length,n.minDepth,i):Ch(o,t.startState.selection),new Oh(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(oh);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(zr.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=gh.fromTransaction(t),o=t.annotation(zr.time),s=t.annotation(zr.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new Oh(e.done.map(gh.fromJSON),e.undone.map(gh.fromJSON))}});function uh(e={}){return[lh,ch.of(e),Y.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?fh:e.inputType==`historyRedo`?ph:null;return n?(e.preventDefault(),n(t)):!1}})]}function dh(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(lh,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var fh=dh(0,!1),ph=dh(1,!1),mh=dh(0,!0),hh=dh(1,!0),gh=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&tr.fromJSON(t.changes),[],t.mapped&&er.fromJSON(t.mapped),t.startSelection&&K.fromJSON(t.startSelection),t.selectionsAfter.map(K.fromJSON))}static fromTransaction(t,n){let r=xh;for(let e of t.startState.facet(sh)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,xh)}static selection(t){return new e(void 0,xh,void 0,void 0,t)}};function _h(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function vh(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function yh(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function bh(e,t){return e.length?t.length?e.concat(t):e:t}var xh=[],Sh=200;function Ch(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Sh));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),_h(e,e.length-1,1e9,n.setSelAfter(r)))}else return[gh.selection([t])]}function wh(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Th(e,t){if(!e.length)return e;let n=e.length,r=xh;for(;n;){let i=Eh(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[gh.selection(r)]:xh}function Eh(e,t,n){let r=bh(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):xh,n);if(!e.changes)return gh.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new gh(i,Rr.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Dh=/^(input\.type|delete)($|\.)/,Oh=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||Dh.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,vh(s.changes,t.changes))||r==`input.type.compose`)?_h(o,o.length-1,i.minDepth,new gh(t.changes.compose(s.changes),bh(Rr.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,xh)):_h(o,o.length,i.minDepth,t),new e(o,xh,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:xh;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&yh(a[a.length-1],t)?this:new e(Ch(this.done,t),this.undone,n,r)}addMapping(t){return new e(Th(this.done,t),Th(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:ah.of({side:e,rest:wh(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?xh:r.slice(0,r.length-1);return i.mapped&&(n=Th(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:ah.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};Oh.empty=new Oh(xh,xh);var kh=[{key:`Mod-z`,run:fh,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:ph,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:ph,preventDefault:!0},{key:`Mod-u`,run:mh,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:hh,preventDefault:!0}];function Ah(e,t){return K.create(e.ranges.map(t),e.mainIndex)}function jh(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function Mh({state:e,dispatch:t},n){let r=Ah(e.selection,n);return r.eq(e.selection,!0)?!1:(t(jh(e,r)),!0)}function Nh(e,t){return K.cursor(t?e.to:e.from)}function Ph(e,t){return Mh(e,n=>n.empty?e.moveByChar(n,t):Nh(n,t))}function Fh(e){return e.textDirectionAt(e.state.selection.main.head)==Ia.LTR}var Ih=e=>Ph(e,!Fh(e)),Lh=e=>Ph(e,Fh(e));function Rh(e,t){return Mh(e,n=>n.empty?e.moveByGroup(n,t):Nh(n,t))}var zh=e=>Rh(e,!Fh(e)),Bh=e=>Rh(e,Fh(e));typeof Intl<`u`&&Intl.Segmenter;function Vh(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Hh(e,t,n){let r=up(e).resolveInner(t.head),i=n?Ld.closedBy:Ld.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;Vh(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?Rm(e,r.from,1):Rm(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,K.cursor(s,n?-1:1)}var Uh=e=>Mh(e,t=>Hh(e.state,t,!Fh(e))),Wh=e=>Mh(e,t=>Hh(e.state,t,Fh(e)));function Gh(e,t){return Mh(e,n=>{if(!n.empty)return Nh(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var Kh=e=>Gh(e,!1),qh=e=>Gh(e,!0);function Jh(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(Y.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function Yh(e,t){let n=Jh(e),{state:r}=e,i=Ah(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):Nh(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=Y.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(jh(r,i),{effects:a}),!0}var Xh=e=>Yh(e,!1),Zh=e=>Yh(e,!0);function Qh(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=K.cursor(r.from+n))}return i}var $h=e=>Mh(e,t=>Qh(e,t,!0)),eg=e=>Mh(e,t=>Qh(e,t,!1)),tg=e=>Mh(e,t=>Qh(e,t,!Fh(e))),ng=e=>Mh(e,t=>Qh(e,t,Fh(e))),rg=e=>Mh(e,t=>K.cursor(e.lineBlockAt(t.head).from,1)),ig=e=>Mh(e,t=>K.cursor(e.lineBlockAt(t.head).to,-1));function ag(e,t,n){let r=!1,i=Ah(e.selection,t=>{let i=Rm(e,t.head,-1)||Rm(e,t.head,1)||t.head>0&&Rm(e,t.head-1,1)||t.head<e.doc.length&&Rm(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?K.range(t.anchor,a):K.cursor(a)});return r?(t(jh(e,i)),!0):!1}var og=({state:e,dispatch:t})=>ag(e,t,!1);function sg(e,t){let n=Ah(e.state.selection,e=>{let n=t(e);return K.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(jh(e.state,n)),!0)}function cg(e,t){return sg(e,n=>e.moveByChar(n,t))}var lg=e=>cg(e,!Fh(e)),ug=e=>cg(e,Fh(e));function dg(e,t){return sg(e,n=>e.moveByGroup(n,t))}var fg=e=>dg(e,!Fh(e)),pg=e=>dg(e,Fh(e)),mg=e=>sg(e,t=>Hh(e.state,t,!Fh(e))),hg=e=>sg(e,t=>Hh(e.state,t,Fh(e)));function gg(e,t){return sg(e,n=>e.moveVertically(n,t))}var _g=e=>gg(e,!1),vg=e=>gg(e,!0);function yg(e,t){return sg(e,n=>e.moveVertically(n,t,Jh(e).height))}var bg=e=>yg(e,!1),xg=e=>yg(e,!0),Sg=e=>sg(e,t=>Qh(e,t,!0)),Cg=e=>sg(e,t=>Qh(e,t,!1)),wg=e=>sg(e,t=>Qh(e,t,!Fh(e))),Tg=e=>sg(e,t=>Qh(e,t,Fh(e))),Eg=e=>sg(e,t=>K.cursor(e.lineBlockAt(t.head).from)),Dg=e=>sg(e,t=>K.cursor(e.lineBlockAt(t.head).to)),Og=({state:e,dispatch:t})=>(t(jh(e,{anchor:0})),!0),kg=({state:e,dispatch:t})=>(t(jh(e,{anchor:e.doc.length})),!0),Ag=({state:e,dispatch:t})=>(t(jh(e,{anchor:e.selection.main.anchor,head:0})),!0),jg=({state:e,dispatch:t})=>(t(jh(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Mg=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Ng=({state:e,dispatch:t})=>{let n=Qg(e).map(({from:t,to:n})=>K.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:K.create(n),userEvent:`select`})),!0},Pg=({state:e,dispatch:t})=>{let n=Ah(e.selection,t=>{let n=up(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return K.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(jh(e,n)),!0)};function Fg(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}else if(r.head==n.head)break;else n=r}}return i.length==r.ranges.length?!1:(e.dispatch(jh(n,K.create(i,i.length-1))),!0)}var Ig=e=>Fg(e,!1),Lg=e=>Fg(e,!0),Rg=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=K.create([n.main]):n.main.empty||(r=K.create([K.cursor(n.main.head)])),r?(t(jh(e,r)),!0):!1};function zg(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=Bg(e,o,!1)):o>i&&(n=`delete.forward`,o=Bg(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Bg(e,i,!1),a=Bg(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:K.cursor(i,i<r.head?-1:1)}});return i.changes.empty?!1:(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?Y.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function Bg(e,t,n){if(e instanceof Y)for(let r of e.state.facet(Y.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var Vg=(e,t,n)=>zg(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=yi(s,a.tabSize)%Cp(a)||Cp(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=Kn(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=Kn(o.text,c-o.from,!1,!1)+o.from);return c}),Hg=e=>Vg(e,!1,!0),Ug=e=>Vg(e,!0,!1),Wg=(e,t)=>zg(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=Kn(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),Gg=e=>Wg(e,!1),Kg=e=>Wg(e,!0),qg=e=>zg(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Jg=e=>zg(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Yg=e=>zg(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Xg=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Fn.of([``,``])},range:K.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},Zg=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:Kn(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:Kn(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:K.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Qg(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function $g(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of Qg(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(K.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(K.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:K.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var e_=({state:e,dispatch:t})=>$g(e,t,!1),t_=({state:e,dispatch:t})=>$g(e,t,!0);function n_(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Qg(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var r_=({state:e,dispatch:t})=>n_(e,t,!1),i_=({state:e,dispatch:t})=>n_(e,t,!0),a_=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Qg(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Ah(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function o_(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=up(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(Ld.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var s_=l_(!1),c_=l_(!0);function l_(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&o_(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new Ep(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=Tp(s,r);for(c??=yi(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,wp(t,c)];return o&&l.push(wp(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:Fn.of(l)},range:K.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function u_(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:K.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var d_=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Ep(e,{overrideIndentation:e=>n[e]??-1}),i=u_(e,(t,i,a)=>{let o=Tp(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=wp(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},f_=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(u_(e,(t,n)=>{n.push({from:t.from,insert:e.facet(Sp)})}),{userEvent:`input.indent`})),!0),p_=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(u_(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=yi(r,e.tabSize),a=0,o=wp(e,Math.max(0,i-Cp(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),m_=e=>(e.setTabFocusMode(),!0),h_=[{key:`Ctrl-b`,run:Ih,shift:lg,preventDefault:!0},{key:`Ctrl-f`,run:Lh,shift:ug},{key:`Ctrl-p`,run:Kh,shift:_g},{key:`Ctrl-n`,run:qh,shift:vg},{key:`Ctrl-a`,run:rg,shift:Eg},{key:`Ctrl-e`,run:ig,shift:Dg},{key:`Ctrl-d`,run:Ug},{key:`Ctrl-h`,run:Hg},{key:`Ctrl-k`,run:qg},{key:`Ctrl-Alt-h`,run:Gg},{key:`Ctrl-o`,run:Xg},{key:`Ctrl-t`,run:Zg},{key:`Ctrl-v`,run:Zh}],g_=[{key:`ArrowLeft`,run:Ih,shift:lg,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:zh,shift:fg,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:tg,shift:wg,preventDefault:!0},{key:`ArrowRight`,run:Lh,shift:ug,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Bh,shift:pg,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:ng,shift:Tg,preventDefault:!0},{key:`ArrowUp`,run:Kh,shift:_g,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Og,shift:Ag},{mac:`Ctrl-ArrowUp`,run:Xh,shift:bg},{key:`ArrowDown`,run:qh,shift:vg,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:kg,shift:jg},{mac:`Ctrl-ArrowDown`,run:Zh,shift:xg},{key:`PageUp`,run:Xh,shift:bg},{key:`PageDown`,run:Zh,shift:xg},{key:`Home`,run:eg,shift:Cg,preventDefault:!0},{key:`Mod-Home`,run:Og,shift:Ag},{key:`End`,run:$h,shift:Sg,preventDefault:!0},{key:`Mod-End`,run:kg,shift:jg},{key:`Enter`,run:s_,shift:s_},{key:`Mod-a`,run:Mg},{key:`Backspace`,run:Hg,shift:Hg,preventDefault:!0},{key:`Delete`,run:Ug,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Gg,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:Kg,preventDefault:!0},{mac:`Mod-Backspace`,run:Jg,preventDefault:!0},{mac:`Mod-Delete`,run:Yg,preventDefault:!0}].concat(h_.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),__=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Uh,shift:mg},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:Wh,shift:hg},{key:`Alt-ArrowUp`,run:e_},{key:`Shift-Alt-ArrowUp`,run:r_},{key:`Alt-ArrowDown`,run:t_},{key:`Shift-Alt-ArrowDown`,run:i_},{key:`Mod-Alt-ArrowUp`,run:Ig},{key:`Mod-Alt-ArrowDown`,run:Lg},{key:`Escape`,run:Rg},{key:`Mod-Enter`,run:c_},{key:`Alt-l`,mac:`Ctrl-l`,run:Ng},{key:`Mod-i`,run:Pg,preventDefault:!0},{key:`Mod-[`,run:p_},{key:`Mod-]`,run:f_},{key:`Mod-Alt-\\`,run:d_},{key:`Shift-Mod-k`,run:a_},{key:`Shift-Mod-\\`,run:og},{key:`Mod-/`,run:Jm},{key:`Alt-A`,run:Zm},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:m_}].concat(g_),v_={key:`Tab`,run:f_,shift:p_},y_=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new b_(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&s==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new x_(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216))if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new b_(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},b_=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},x_=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},S_=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function C_(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var w_=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},T_=new w_,E_=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=T_,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=T_,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},D_=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;A_(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};D_.prototype.contextual=D_.prototype.fallback=D_.prototype.extend=!1;var O_=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?C_(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(A_(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};O_.prototype.contextual=D_.prototype.fallback=D_.prototype.extend=!1;var k_=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function A_(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||M_(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function j_(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function M_(e,t,n,r){let i=j_(n,r,t);return i<0||j_(n,r,e)<i}var N_=typeof process<`u`&&/\bparse\b/.test({}.LOG),P_=null;function F_(e,t,n){let r=e.cursor(Wd.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var I_=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?F_(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?F_(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=n.children[r],a=this.start[t]+n.positions[r];if(a>e)return this.nextStart=a,null;if(i instanceof Gd){if(a==e){if(a<this.safeFrom)return null;let e=a+i.length;if(e<=this.safeTo){let t=i.prop(Ld.lookAhead);if(!t||e+t<this.fragment.to)return i}}this.index[t]++,a+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}},L_=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new w_)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if(!(n&&!c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new w_,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new w_,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535)if(o[s+1]==1)s=W_(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(W_(o,s+2),t,n,r));break}o[s]==t&&(r=this.putAction(W_(o,s+1),t,n,r))}return r}},R_=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new E_(t,r),this.tokens=new L_(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[y_.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new I_(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&G_(r);if(e)return N_&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw N_&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return N_&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500)if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=N_?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(r);o;){let r=this.parser.nodeSet.types[o.type.id]==o.type?i.getGoto(e.state,o.type.id):-1;if(r>-1&&o.length&&(!t||(o.prop(Ld.contextHash)||0)==n))return e.useNode(o,r),N_&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(o.type.id)})`),!0;if(!(o instanceof Gd)||o.children.length==0||o.positions[0]>0)break;let s=o.children[0];if(s instanceof Gd&&o.positions[0]==0)o=s;else break}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),N_&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let o=0;o<s.length;){let c=s[o++],l=s[o++],u=s[o++],d=o==s.length||!n,f=d?e:e.split(),p=this.tokens.mainToken;if(f.apply(c,l,p?p.start:f.pos,u),N_&&console.log(a+this.stackID(f)+` (via ${c&65536?`reduce of ${i.getName(c&65535)}`:`shift`} for ${i.getName(l)} @ ${r}${f==e?``:`, split`})`),d)return!0;f.pos>r?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return z_(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=N_?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),N_&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(N_&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)N_&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))N_&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),N_&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),z_(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),Gd.build({buffer:S_.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(P_||=new WeakMap).get(e);return t||P_.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function z_(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var B_=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},V_=e=>e,H_=class{constructor(e){this.start=e.start,this.shift=e.shift||V_,this.reduce=e.reduce||V_,this.reuse=e.reuse||V_,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},U_=class e extends mf{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(` `);this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push(``);let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),r=[];for(let e=0;e<t.length;e++)r.push([]);function i(e,t,n){r[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];typeof e==`string`&&(e=Ld[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)i(r,e,t[n++]);else{let a=t[n+-r];for(let o=-r;o>0;o--)i(t[n++],e,a);n++}}}this.nodeSet=new Vd(t.map((t,i)=>Bd.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:i==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Pd;let a=C_(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(K_),this.states=C_(e.states,Uint32Array),this.data=C_(e.stateData),this.goto=C_(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new D_(a,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new R_(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535)if(n[i+1]==1)a=n[i=W_(n,i+2)];else if(n[i+1]==2)return W_(n,i+2);else break;if(a==t||a==0)return W_(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=W_(this.data,n+2);else break;r=t(W_(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=W_(this.data,n+2);else break;if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=K_(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new B_(e,n,r)}static deserialize(t){return new e(t)}};function W_(e,t){return e[t]|e[t+1]<<16}function G_(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function K_(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}var q_=316,J_=317,Y_=1,X_=2,Z_=3,Q_=4,$_=318,ev=320,tv=321,nv=5,rv=6,iv=0,av=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],ov=125,sv=59,cv=47,lv=42,uv=43,dv=45,fv=60,pv=44,mv=63,hv=46,gv=91,_v=new H_({start:!1,shift(e,t){return t==nv||t==rv||t==ev?e:t==tv},strict:!1}),vv=new k_((e,t)=>{let{next:n}=e;(n==ov||n==-1||t.context)&&e.acceptToken($_)},{contextual:!0,fallback:!0}),yv=new k_((e,t)=>{let{next:n}=e,r;av.indexOf(n)>-1||n==cv&&((r=e.peek(1))==cv||r==lv)||n!=ov&&n!=sv&&n!=-1&&!t.context&&e.acceptToken(q_)},{contextual:!0}),bv=new k_((e,t)=>{e.next==gv&&!t.context&&e.acceptToken(J_)},{contextual:!0}),xv=new k_((e,t)=>{let{next:n}=e;if(n==uv||n==dv){if(e.advance(),n==e.next){e.advance();let n=!t.context&&t.canShift(Y_);e.acceptToken(n?Y_:X_)}}else n==mv&&e.peek(1)==hv&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(Z_))},{contextual:!0});function Sv(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}var Cv=new k_((e,t)=>{if(e.next!=fv||!t.dialectEnabled(iv)||(e.advance(),e.next==cv))return;let n=0;for(;av.indexOf(e.next)>-1;)e.advance(),n++;if(Sv(e.next,!0)){for(e.advance(),n++;Sv(e.next,!1);)e.advance(),n++;for(;av.indexOf(e.next)>-1;)e.advance(),n++;if(e.next==pv)return;for(let t=0;;t++){if(t==7){if(!Sv(e.next,!0))return;break}if(e.next!=`extends`.charCodeAt(t))break;e.advance(),n++}}e.acceptToken(Q_,-n)}),wv=If({"get set async static":Z.modifier,"for while do if else switch try catch finally return throw break continue default case defer":Z.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":Z.operatorKeyword,"let var const using function class extends":Z.definitionKeyword,"import export from":Z.moduleKeyword,"with debugger new":Z.keyword,TemplateString:Z.special(Z.string),super:Z.atom,BooleanLiteral:Z.bool,this:Z.self,null:Z.null,Star:Z.modifier,VariableName:Z.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Z.function(Z.variableName),VariableDefinition:Z.definition(Z.variableName),Label:Z.labelName,PropertyName:Z.propertyName,PrivatePropertyName:Z.special(Z.propertyName),"CallExpression/MemberExpression/PropertyName":Z.function(Z.propertyName),"FunctionDeclaration/VariableDefinition":Z.function(Z.definition(Z.variableName)),"ClassDeclaration/VariableDefinition":Z.definition(Z.className),"NewExpression/VariableName":Z.className,PropertyDefinition:Z.definition(Z.propertyName),PrivatePropertyDefinition:Z.definition(Z.special(Z.propertyName)),UpdateOp:Z.updateOperator,"LineComment Hashbang":Z.lineComment,BlockComment:Z.blockComment,Number:Z.number,String:Z.string,Escape:Z.escape,ArithOp:Z.arithmeticOperator,LogicOp:Z.logicOperator,BitOp:Z.bitwiseOperator,CompareOp:Z.compareOperator,RegExp:Z.regexp,Equals:Z.definitionOperator,Arrow:Z.function(Z.punctuation),": Spread":Z.punctuation,"( )":Z.paren,"[ ]":Z.squareBracket,"{ }":Z.brace,"InterpolationStart InterpolationEnd":Z.special(Z.brace),".":Z.derefOperator,", ;":Z.separator,"@":Z.meta,TypeName:Z.typeName,TypeDefinition:Z.definition(Z.typeName),"type enum interface implements namespace module declare":Z.definitionKeyword,"abstract global Privacy readonly override":Z.modifier,"is keyof unique infer asserts":Z.operatorKeyword,JSXAttributeValue:Z.attributeValue,JSXText:Z.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Z.angleBracket,"JSXIdentifier JSXNameSpacedName":Z.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Z.attributeName,"JSXBuiltin/JSXIdentifier":Z.standard(Z.tagName)}),Tv={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},Ev={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Dv={__proto__:null,"<":193},Ov=U_.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-E<j-E<jO9kQ`O,5=_O!$rQ`O,5=_O!$wQlO,5;ZO!&zQMhO'#EkO!(eQ`O,5;ZO!(jQlO'#DyO!(tQpO,5;dO!(|QpO,5;dO%[QlO,5;dOOQ['#FT'#FTOOQ['#FV'#FVO%[QlO,5;eO%[QlO,5;eO%[QlO,5;eO%[QlO,5;eO%[QlO,5;eO%[QlO,5;eO%[QlO,5;eO%[QlO,5;eO%[QlO,5;eO%[QlO,5;eOOQ['#FZ'#FZO!)[QlO,5;tOOQ!0Lf,5;y,5;yOOQ!0Lf,5;z,5;zOOQ!0Lf,5;|,5;|O%[QlO'#IpO!+_Q!0LrO,5<iO%[QlO,5;eO!&zQMhO,5;eO!+|QMhO,5;eO!-nQMhO'#E^O%[QlO,5;wOOQ!0Lf,5;{,5;{O!-uQ,UO'#FjO!.rQ,UO'#KXO!.^Q,UO'#KXO!.yQ,UO'#KXOOQO'#KX'#KXO!/_Q,UO,5<SOOOW,5<`,5<`O!/pQlO'#FvOOOW'#Io'#IoO7VO7dO,5<QO!/wQ,UO'#FxOOQ!0Lf,5<Q,5<QO!0hQ$IUO'#CyOOQ!0Lh'#C}'#C}O!0{O#@ItO'#DRO!1iQMjO,5<eO!1pQ`O,5<hO!3YQ(CWO'#GXO!3jQ`O'#GYO!3oQ`O'#GYO!5_Q(CWO'#G^O!6dQpO'#GbOOQO'#Gn'#GnO!,TQMhO'#GmOOQO'#Gp'#GpO!,TQMhO'#GoO!7VQ$IUO'#JlOOQ!0Lh'#Jl'#JlO!7aQ`O'#JkO!7oQ`O'#JjO!7wQ`O'#CuOOQ!0Lh'#C{'#C{O!8YQ`O'#C}OOQ!0Lh'#DV'#DVOOQ!0Lh'#DX'#DXO!8_Q`O,5<eO1SQ`O'#DZO!,TQMhO'#GPO!,TQMhO'#GRO!8gQ`O'#GTO!8lQ`O'#GUO!3oQ`O'#G[O!,TQMhO'#GaO<]Q`O'#JkO!8qQ`O'#EqO!9`Q`O,5<gOOQ!0Lb'#Cr'#CrO!9hQ`O'#ErO!:bQpO'#EsOOQ!0Lb'#KR'#KRO!:iQ!0LrO'#KaO9uQ!0LrO,5=cO`QlO,5>tOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!<hQ!0MxO,5:bO!:]QpO,5:`O!?RQ!0MxO,5:jO%[QlO,5:jO!AiQ!0MxO,5:lOOQO,5@z,5@zO!BYQMhO,5=_O!BhQ!0LrO'#JiO9`Q`O'#JiO!ByQ!0LrO,59ZO!CUQpO,59ZO!C^QMhO,59ZO:dQMhO,59ZO!CiQ`O,5;ZO!CqQ`O'#HbO!DVQ`O'#KdO%[QlO,5;}O!:]QpO,5<PO!D_Q`O,5=zO!DdQ`O,5=zO!DiQ`O,5=zO!DwQ`O,5=zO9uQ!0LrO,5=zO<]Q`O,5=jOOQO'#Cy'#CyO!EOQpO,5=gO!EWQMhO,5=hO!EcQ`O,5=jO!EhQ!bO,5=mO!EpQ`O'#K`O?YQ`O'#HWO9kQ`O'#HYO!EuQ`O'#HYO:dQMhO'#H[O!EzQ`O'#H[OOQ[,5=p,5=pO!FPQ`O'#H]O!FbQ`O'#CoO!FgQ`O,59PO!FqQ`O,59PO!HvQlO,59POOQ[,59P,59PO!IWQ!0LrO,59PO%[QlO,59PO!KcQlO'#HeOOQ['#Hf'#HfOOQ['#Hg'#HgO`QlO,5=}O!KyQ`O,5=}O`QlO,5>TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-E<f-E<fO#)kQ!0MSO,5;RODWQpO,5:rO#)uQpO,5:rODWQpO,5;RO!ByQ!0LrO,5:rOOQ!0Lb'#Ej'#EjOOQO,5;R,5;RO%[QlO,5;RO#*SQ!0LrO,5;RO#*_Q!0LrO,5;RO!CUQpO,5:rOOQO,5;X,5;XO#*mQ!0LrO,5;RPOOO'#I^'#I^P#+RO&2DjO,58|POOO,58|,58|OOOO-E<^-E<^OOQ!0Lh1G.p1G.pOOOO-E<_-E<_OOOO,59},59}O#+^Q!bO,59}OOOO-E<a-E<aOOQ!0Lf1G/g1G/gO#+cQ!fO,5?OO+}QlO,5?OOOQO,5?U,5?UO#+mQlO'#IdOOQO-E<b-E<bO#+zQ`O,5@`O#,SQ!fO,5@`O#,ZQ`O,5@nOOQ!0Lf1G/m1G/mO%[QlO,5@oO#,cQ`O'#IjOOQO-E<h-E<hO#,ZQ`O,5@nOOQ!0Lb1G0x1G0xOOQ!0Ln1G/x1G/xOOQ!0Ln1G0Y1G0YO%[QlO,5@lO#,wQ!0LrO,5@lO#-YQ!0LrO,5@lO#-aQ`O,5@kO9eQ`O,5@kO#-iQ`O,5@kO#-wQ`O'#ImO#-aQ`O,5@kOOQ!0Lb1G0w1G0wO!(tQpO,5:uO!)PQpO,5:uOOQS,5:w,5:wO#.iQdO,5:wO#.qQMhO1G2yO9kQ`O1G2yOOQ!0Lf1G0u1G0uO#/PQ!0MxO1G0uO#0UQ!0MvO,5;VOOQ!0Lh'#GW'#GWO#0rQ!0MzO'#JlO!$wQlO1G0uO#2}Q!fO'#JwO%[QlO'#JwO#3XQ`O,5:eOOQ!0Lh'#D_'#D_OOQ!0Lf1G1O1G1OO%[QlO1G1OOOQ!0Lf1G1f1G1fO#3^Q`O1G1OO#5rQ!0MxO1G1PO#5yQ!0MxO1G1PO#8aQ!0MxO1G1PO#8hQ!0MxO1G1PO#;OQ!0MxO1G1PO#=fQ!0MxO1G1PO#=mQ!0MxO1G1PO#=tQ!0MxO1G1PO#@[Q!0MxO1G1PO#@cQ!0MxO1G1PO#BpQ?MtO'#CiO#DkQ?MtO1G1`O#DrQ?MtO'#JsO#EVQ!0MxO,5?[OOQ!0Lb-E<n-E<nO#GdQ!0MxO1G1PO#HaQ!0MzO1G1POOQ!0Lf1G1P1G1PO#IdQMjO'#J|O#InQ`O,5:xO#IsQ!0MxO1G1cO#JgQ,UO,5<WO#JoQ,UO,5<XO#JwQ,UO'#FoO#K`Q`O'#FnOOQO'#KY'#KYOOQO'#In'#InO#KeQ,UO1G1nOOQ!0Lf1G1n1G1nOOOW1G1y1G1yO#KvQ?MtO'#JrO#LQQ`O,5<bO!)[QlO,5<bOOOW-E<m-E<mOOQ!0Lf1G1l1G1lO#LVQpO'#KXOOQ!0Lf,5<d,5<dO#L_QpO,5<dO#LdQMhO'#DTOOOO'#Ib'#IbO#LkO#@ItO,59mOOQ!0Lh,59m,59mO%[QlO1G2PO!8lQ`O'#IrO#LvQ`O,5<zOOQ!0Lh,5<w,5<wO!,TQMhO'#IuO#MdQMjO,5=XO!,TQMhO'#IwO#NVQMjO,5=ZO!&zQMhO,5=]OOQO1G2S1G2SO#NaQ!dO'#CrO#NtQ(CWO'#ErO$ |QpO'#GbO$!dQ!dO,5<sO$!kQ`O'#K[O9eQ`O'#K[O$!yQ`O,5<uO$#aQ!dO'#C{O!,TQMhO,5<tO$#kQ`O'#GZO$$PQ`O,5<tO$$UQ!dO'#GWO$$cQ!dO'#K]O$$mQ`O'#K]O!&zQMhO'#K]O$$rQ`O,5<xO$$wQlO'#JvO$%RQpO'#GcO#$`QpO'#GcO$%dQ`O'#GgO!3oQ`O'#GkO$%iQ!0LrO'#ItO$%tQpO,5<|OOQ!0Lp,5<|,5<|O$%{QpO'#GcO$&YQpO'#GdO$&kQpO'#GdO$&pQMjO,5=XO$'QQMjO,5=ZOOQ!0Lh,5=^,5=^O!,TQMhO,5@VO!,TQMhO,5@VO$'bQ`O'#IyO$'vQ`O,5@UO$(OQ`O,59aOOQ!0Lh,59i,59iO$(TQ`O,5@VO$)TQ$IYO,59uOOQ!0Lh'#Jp'#JpO$)vQMjO,5<kO$*iQMjO,5<mO@zQ`O,5<oOOQ!0Lh,5<p,5<pO$*sQ`O,5<vO$*xQMjO,5<{O$+YQ`O'#KPO!$wQlO1G2RO$+_Q`O1G2RO9eQ`O'#KSO9eQ`O'#EtO%[QlO'#EtO9eQ`O'#I{O$+dQ!0LrO,5@{OOQ[1G2}1G2}OOQ[1G4`1G4`OOQ!0Lf1G/|1G/|OOQ!0Lf1G/z1G/zO$-fQ!0MxO1G0UOOQ[1G2y1G2yO!&zQMhO1G2yO%[QlO1G2yO#.tQ`O1G2yO$/jQMhO'#EkOOQ!0Lb,5@T,5@TO$/wQ!0LrO,5@TOOQ[1G.u1G.uO!ByQ!0LrO1G.uO!CUQpO1G.uO!C^QMhO1G.uO$0YQ`O1G0uO$0_Q`O'#CiO$0jQ`O'#KeO$0rQ`O,5=|O$0wQ`O'#KeO$0|Q`O'#KeO$1[Q`O'#JRO$1jQ`O,5AOO$1rQ!fO1G1iOOQ!0Lf1G1k1G1kO9kQ`O1G3fO@zQ`O1G3fO$1yQ`O1G3fO$2OQ`O1G3fO!DiQ`O1G3fO9uQ!0LrO1G3fOOQ[1G3f1G3fO!EcQ`O1G3UO!&zQMhO1G3RO$2TQ`O1G3ROOQ[1G3S1G3SO!&zQMhO1G3SO$2YQ`O1G3SO$2bQpO'#HQOOQ[1G3U1G3UO!6_QpO'#I}O!EhQ!bO1G3XOOQ[1G3X1G3XOOQ[,5=r,5=rO$2jQMhO,5=tO9kQ`O,5=tO$%dQ`O,5=vO9`Q`O,5=vO!CUQpO,5=vO!C^QMhO,5=vO:dQMhO,5=vO$2xQ`O'#KcO$3TQ`O,5=wOOQ[1G.k1G.kO$3YQ!0LrO1G.kO@zQ`O1G.kO$3eQ`O1G.kO9uQ!0LrO1G.kO$5mQ!fO,5AQO$5zQ`O,5AQO9eQ`O,5AQO$6VQlO,5>PO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5<iO$BOQ!fO1G4jOOQO1G4p1G4pO%[QlO,5?OO$BYQ`O1G5zO$BbQ`O1G6YO$BjQ!fO1G6ZO9eQ`O,5?UO$BtQ!0MxO1G6WO%[QlO1G6WO$CUQ!0LrO1G6WO$CgQ`O1G6VO$CgQ`O1G6VO9eQ`O1G6VO$CoQ`O,5?XO9eQ`O,5?XOOQO,5?X,5?XO$DTQ`O,5?XO$+YQ`O,5?XOOQO-E<k-E<kOOQS1G0a1G0aOOQS1G0c1G0cO#.lQ`O1G0cOOQ[7+(e7+(eO!&zQMhO7+(eO%[QlO7+(eO$DcQ`O7+(eO$DnQMhO7+(eO$D|Q!0MzO,5=XO$GXQ!0MzO,5=ZO$IdQ!0MzO,5=XO$KuQ!0MzO,5=ZO$NWQ!0MzO,59uO%!]Q!0MzO,5<kO%$hQ!0MzO,5<mO%&sQ!0MzO,5<{OOQ!0Lf7+&a7+&aO%)UQ!0MxO7+&aO%)xQlO'#IfO%*VQ`O,5@cO%*_Q!fO,5@cOOQ!0Lf1G0P1G0PO%*iQ`O7+&jOOQ!0Lf7+&j7+&jO%*nQ?MtO,5:fO%[QlO7+&zO%*xQ?MtO,5:bO%+VQ?MtO,5:jO%+aQ?MtO,5:lO%+kQMhO'#IiO%+uQ`O,5@hOOQ!0Lh1G0d1G0dOOQO1G1r1G1rOOQO1G1s1G1sO%+}Q!jO,5<ZO!)[QlO,5<YOOQO-E<l-E<lOOQ!0Lf7+'Y7+'YOOOW7+'e7+'eOOOW1G1|1G1|O%,YQ`O1G1|OOQ!0Lf1G2O1G2OOOOO,59o,59oO%,_Q!dO,59oOOOO-E<`-E<`OOQ!0Lh1G/X1G/XO%,fQ!0MxO7+'kOOQ!0Lh,5?^,5?^O%-YQMhO1G2fP%-aQ`O'#IrPOQ!0Lh-E<p-E<pO%-}QMjO,5?aOOQ!0Lh-E<s-E<sO%.pQMjO,5?cOOQ!0Lh-E<u-E<uO%.zQ!dO1G2wO%/RQ!dO'#CrO%/iQMhO'#KSO$$wQlO'#JvOOQ!0Lh1G2_1G2_O%/sQ`O'#IqO%0[Q`O,5@vO%0[Q`O,5@vO%0dQ`O,5@vO%0oQ`O,5@vOOQO1G2a1G2aO%0}QMjO1G2`O$+YQ`O'#K[O!,TQMhO1G2`O%1_Q(CWO'#IsO%1lQ`O,5@wO!&zQMhO,5@wO%1tQ!dO,5@wOOQ!0Lh1G2d1G2dO%4UQ!fO'#CiO%4`Q`O,5=POOQ!0Lb,5<},5<}O%4hQpO,5<}OOQ!0Lb,5=O,5=OOCwQ`O,5<}O%4sQpO,5<}OOQ!0Lb,5=R,5=RO$+YQ`O,5=VOOQO,5?`,5?`OOQO-E<r-E<rOOQ!0Lp1G2h1G2hO#$`QpO,5<}O$$wQlO,5=PO%5RQ`O,5=OO%5^QpO,5=OO!,TQMhO'#IuO%6WQMjO1G2sO!,TQMhO'#IwO%6yQMjO1G2uO%7TQMjO1G5qO%7_QMjO1G5qOOQO,5?e,5?eOOQO-E<w-E<wOOQO1G.{1G.{O!,TQMhO1G5qO!,TQMhO1G5qO!:]QpO,59wO%[QlO,59wOOQ!0Lh,5<j,5<jO%7lQ`O1G2ZO!,TQMhO1G2bO%7qQ!0MxO7+'mOOQ!0Lf7+'m7+'mO!$wQlO7+'mO%8eQ`O,5;`OOQ!0Lb,5?g,5?gOOQ!0Lb-E<y-E<yO%8jQ!dO'#K^O#(ZQ`O7+(eO4UQ!fO7+(eO$DfQ`O7+(eO%8tQ!0MvO'#CiO%9XQ!0MvO,5=SO%9lQ`O,5=SO%9tQ`O,5=SOOQ!0Lb1G5o1G5oOOQ[7+$a7+$aO!ByQ!0LrO7+$aO!CUQpO7+$aO!$wQlO7+&aO%9yQ`O'#JQO%:bQ`O,5APOOQO1G3h1G3hO9kQ`O,5APO%:bQ`O,5APO%:jQ`O,5APOOQO,5?m,5?mOOQO-E=P-E=POOQ!0Lf7+'T7+'TO%:oQ`O7+)QO9uQ!0LrO7+)QO9kQ`O7+)QO@zQ`O7+)QO%:tQ`O7+)QOOQ[7+)Q7+)QOOQ[7+(p7+(pO%:yQ!0MvO7+(mO!&zQMhO7+(mO!E^Q`O7+(nOOQ[7+(n7+(nO!&zQMhO7+(nO%;TQ`O'#KbO%;`Q`O,5=lOOQO,5?i,5?iOOQO-E<{-E<{OOQ[7+(s7+(sO%<rQpO'#HZOOQ[1G3`1G3`O!&zQMhO1G3`O%[QlO1G3`O%<yQ`O1G3`O%=UQMhO1G3`O9uQ!0LrO1G3bO$%dQ`O1G3bO9`Q`O1G3bO!CUQpO1G3bO!C^QMhO1G3bO%=dQ`O'#JPO%=xQ`O,5@}O%>QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-E<c-E<cOOQO,5?V,5?VOOQO-E<i-E<iO!CUQpO1G/sOOQO-E<e-E<eOOQ!0Ln1G0]1G0]OOQ!0Lf7+%u7+%uO#(ZQ`O7+%uOOQ!0Lf7+&`7+&`O?YQ`O7+&`O!CUQpO7+&`OOQO7+%x7+%xO$AlQ!0MxO7+&XOOQO7+&X7+&XO%[QlO7+&XO%@nQ!0LrO7+&XO!ByQ!0LrO7+%xO!CUQpO7+%xO%@yQ!0LrO7+&XO%AXQ!0MxO7++rO%[QlO7++rO%AiQ`O7++qO%AiQ`O7++qOOQO1G4s1G4sO9eQ`O1G4sO%AqQ`O1G4sOOQS7+%}7+%}O#(ZQ`O<<LPO4UQ!fO<<LPO%BPQ`O<<LPOOQ[<<LP<<LPO!&zQMhO<<LPO%[QlO<<LPO%BXQ`O<<LPO%BdQ!0MzO,5?aO%DoQ!0MzO,5?cO%FzQ!0MzO1G2`O%I]Q!0MzO1G2sO%KhQ!0MzO1G2uO%MsQ!fO,5?QO%[QlO,5?QOOQO-E<d-E<dO%M}Q`O1G5}OOQ!0Lf<<JU<<JUO%NVQ?MtO1G0uO&!^Q?MtO1G1PO&!eQ?MtO1G1PO&$fQ?MtO1G1PO&$mQ?MtO1G1PO&&nQ?MtO1G1PO&(oQ?MtO1G1PO&(vQ?MtO1G1PO&(}Q?MtO1G1PO&+OQ?MtO1G1PO&+VQ?MtO1G1PO&+^Q!0MxO<<JfO&-UQ?MtO1G1PO&.RQ?MvO1G1PO&/UQ?MvO'#JlO&1[Q?MtO1G1cO&1iQ?MtO1G0UO&1sQMjO,5?TOOQO-E<g-E<gO!)[QlO'#FqOOQO'#KZ'#KZOOQO1G1u1G1uO&1}Q`O1G1tO&2SQ?MtO,5?[OOOW7+'h7+'hOOOO1G/Z1G/ZO&2^Q!dO1G4xOOQ!0Lh7+(Q7+(QP!&zQMhO,5?^O!,TQMhO7+(cO&2eQ`O,5?]O9eQ`O,5?]O$+YQ`O,5?]OOQO-E<o-E<oO&2sQ`O1G6bO&2sQ`O1G6bO&2{Q`O1G6bO&3WQMjO7+'zO&3hQ!dO,5?_O&3rQ`O,5?_O!&zQMhO,5?_OOQO-E<q-E<qO&3wQ!dO1G6cO&4RQ`O1G6cO&4ZQ`O1G2kO!&zQMhO1G2kOOQ!0Lb1G2i1G2iOOQ!0Lb1G2j1G2jO%4hQpO1G2iO!CUQpO1G2iOCwQ`O1G2iOOQ!0Lb1G2q1G2qO&4`QpO1G2iO&4nQ`O1G2kO$+YQ`O1G2jOCwQ`O1G2jO$$wQlO1G2kO&4vQ`O1G2jO&5jQMjO,5?aOOQ!0Lh-E<t-E<tO&6]QMjO,5?cOOQ!0Lh-E<v-E<vO!,TQMhO7++]O&6gQMjO7++]O&6qQMjO7++]OOQ!0Lh1G/c1G/cO&7OQ`O1G/cOOQ!0Lh7+'u7+'uO&7TQMjO7+'|O&7eQ!0MxO<<KXOOQ!0Lf<<KX<<KXO&8XQ`O1G0zO!&zQMhO'#IzO&8^Q`O,5@xO&:`Q!fO<<LPO!&zQMhO1G2nO&:gQ!0LrO1G2nOOQ[<<G{<<G{O!ByQ!0LrO<<G{O&:xQ!0MxO<<I{OOQ!0Lf<<I{<<I{OOQO,5?l,5?lO&;lQ`O,5?lO&;qQ`O,5?lOOQO-E=O-E=OO&<PQ`O1G6kO&<PQ`O1G6kO9kQ`O1G6kO@zQ`O<<LlOOQ[<<Ll<<LlO&<XQ`O<<LlO9uQ!0LrO<<LlO9kQ`O<<LlOOQ[<<LX<<LXO%:yQ!0MvO<<LXOOQ[<<LY<<LYO!E^Q`O<<LYO&<^QpO'#I|O&<iQ`O,5@|O!)[QlO,5@|OOQ[1G3W1G3WOOQO'#JO'#JOO9uQ!0LrO'#JOO&<qQpO,5=uOOQ[,5=u,5=uO&<xQpO'#EgO&=PQpO'#GeO&=UQ`O7+(zO&=ZQ`O7+(zOOQ[7+(z7+(zO!&zQMhO7+(zO%[QlO7+(zO&=cQ`O7+(zOOQ[7+(|7+(|O9uQ!0LrO7+(|O$%dQ`O7+(|O9`Q`O7+(|O!CUQpO7+(|O&=nQ`O,5?kOOQO-E<}-E<}OOQO'#H^'#H^O&=yQ`O1G6iO9uQ!0LrO<<GqOOQ[<<Gq<<GqO@zQ`O<<GqO&>RQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<<Ly<<LyOOQ[<<L{<<L{OOQ[-E=Q-E=QOOQ[1G3z1G3zO&>nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<<Ia<<IaOOQ!0Lf<<Iz<<IzO?YQ`O<<IzOOQO<<Is<<IsO$AlQ!0MxO<<IsO%[QlO<<IsOOQO<<Id<<IdO!ByQ!0LrO<<IdO&?SQ!0LrO<<IsO&?_Q!0MxO<= ^O&?oQ`O<= ]OOQO7+*_7+*_O9eQ`O7+*_OOQ[ANAkANAkO&?wQ!fOANAkO!&zQMhOANAkO#(ZQ`OANAkO4UQ!fOANAkO&@OQ`OANAkO%[QlOANAkO&@WQ!0MzO7+'zO&BiQ!0MzO,5?aO&DtQ!0MzO,5?cO&GPQ!0MzO7+'|O&IbQ!fO1G4lO&IlQ?MtO7+&aO&KpQ?MvO,5=XO&MwQ?MvO,5=ZO&NXQ?MvO,5=XO&NiQ?MvO,5=ZO&NyQ?MvO,59uO'#PQ?MvO,5<kO'%SQ?MvO,5<mO''hQ?MvO,5<{O')^Q?MtO7+'kO')kQ?MtO7+'mO')xQ`O,5<]OOQO7+'`7+'`OOQ!0Lh7+*d7+*dO')}QMjO<<K}OOQO1G4w1G4wO'*UQ`O1G4wO'*aQ`O1G4wO'*oQ`O7++|O'*oQ`O7++|O!&zQMhO1G4yO'*wQ!dO1G4yO'+RQ`O7++}O'+ZQ`O7+(VO'+fQ!dO7+(VOOQ!0Lb7+(T7+(TOOQ!0Lb7+(U7+(UO!CUQpO7+(TOCwQ`O7+(TO'+pQ`O7+(VO!&zQMhO7+(VO$+YQ`O7+(UO'+uQ`O7+(VOCwQ`O7+(UO'+}QMjO<<NwO!,TQMhO<<NwOOQ!0Lh7+$}7+$}O',XQ!dO,5?fOOQO-E<x-E<xO',cQ!0MvO7+(YO!&zQMhO7+(YOOQ[AN=gAN=gO9kQ`O1G5WOOQO1G5W1G5WO',sQ`O1G5WO',xQ`O7+,VO',xQ`O7+,VO9uQ!0LrOANBWO@zQ`OANBWOOQ[ANBWANBWO'-QQ`OANBWOOQ[ANAsANAsOOQ[ANAtANAtO'-VQ`O,5?hOOQO-E<z-E<zO'-bQ?MtO1G6hOOQO,5?j,5?jOOQO-E<|-E<|OOQ[1G3a1G3aO'-lQ`O,5=POOQ[<<Lf<<LfO!&zQMhO<<LfO&=UQ`O<<LfO'-qQ`O<<LfO%[QlO<<LfOOQ[<<Lh<<LhO9uQ!0LrO<<LhO$%dQ`O<<LhO9`Q`O<<LhO'-yQpO1G5VO'.UQ`O7+,TOOQ[AN=]AN=]O9uQ!0LrOAN=]OOQ[<= r<= rOOQ[<= s<= sO'.^Q`O<= rO'.cQ`O<= sOOQ[<<Lq<<LqO'.hQ`O<<LqO'.mQlO<<LqOOQ[1G3{1G3{O?YQ`O7+)lO'.tQ`O<<JQO'/PQ?MtO<<JQOOQO<<Hy<<HyOOQ!0LfAN?fAN?fOOQOAN?_AN?_O$AlQ!0MxOAN?_OOQOAN?OAN?OO%[QlOAN?_OOQO<<My<<MyOOQ[G27VG27VO!&zQMhOG27VO#(ZQ`OG27VO'/ZQ!fOG27VO4UQ!fOG27VO'/bQ`OG27VO'/jQ?MtO<<JfO'/wQ?MvO1G2`O'1mQ?MvO,5?aO'3pQ?MvO,5?cO'5sQ?MvO1G2sO'7vQ?MvO1G2uO'9yQ?MtO<<KXO':WQ?MtO<<I{OOQO1G1w1G1wO!,TQMhOANAiOOQO7+*c7+*cO':eQ`O7+*cO':pQ`O<= hO':xQ!dO7+*eOOQ!0Lb<<Kq<<KqO$+YQ`O<<KqOCwQ`O<<KqO';SQ`O<<KqO!&zQMhO<<KqOOQ!0Lb<<Ko<<KoO!CUQpO<<KoO';_Q!dO<<KqOOQ!0Lb<<Kp<<KpO';iQ`O<<KqO!&zQMhO<<KqO$+YQ`O<<KpO';nQMjOANDcO';xQ!0MvO<<KtOOQO7+*r7+*rO9kQ`O7+*rO'<YQ`O<= qOOQ[G27rG27rO9uQ!0LrOG27rO@zQ`OG27rO!)[QlO1G5SO'<bQ`O7+,SO'<jQ`O1G2kO&=UQ`OANBQOOQ[ANBQANBQO!&zQMhOANBQO'<oQ`OANBQOOQ[ANBSANBSO9uQ!0LrOANBSO$%dQ`OANBSOOQO'#H_'#H_OOQO7+*q7+*qOOQ[G22wG22wOOQ[ANE^ANE^OOQ[ANE_ANE_OOQ[ANB]ANB]O'<wQ`OANB]OOQ[<<MW<<MWO!)[QlOAN?lOOQOG24yG24yO$AlQ!0MxOG24yO#(ZQ`OLD,qOOQ[LD,qLD,qO!&zQMhOLD,qO'<|Q!fOLD,qO'=TQ?MvO7+'zO'>yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<<M}<<M}OOQ!0LbANA]ANA]O$+YQ`OANA]OCwQ`OANA]O'EVQ!dOANA]OOQ!0LbANAZANAZO'E^Q`OANA]O!&zQMhOANA]O'EiQ!dOANA]OOQ!0LbANA[ANA[OOQO<<N^<<N^OOQ[LD-^LD-^O9uQ!0LrOLD-^O'EsQ?MtO7+*nOOQO'#Gf'#GfOOQ[G27lG27lO&=UQ`OG27lO!&zQMhOG27lOOQ[G27nG27nO9uQ!0LrOG27nOOQ[G27wG27wO'E}Q?MtOG25WOOQOLD*eLD*eOOQ[!$(!]!$(!]O#(ZQ`O!$(!]O!&zQMhO!$(!]O'FXQ!0MzOG27TOOQ!0LbG26wG26wO$+YQ`OG26wO'HjQ`OG26wOCwQ`OG26wO'HuQ!dOG26wO!&zQMhOG26wOOQ[!$(!x!$(!xOOQ[LD-WLD-WO&=UQ`OLD-WOOQ[LD-YLD-YOOQ[!)9Ew!)9EwO#(ZQ`O!)9EwOOQ!0LbLD,cLD,cO$+YQ`OLD,cOCwQ`OLD,cO'H|Q`OLD,cO'IXQ!dOLD,cOOQ[!$(!r!$(!rOOQ[!.K;c!.K;cO'I`Q?MvOG27TOOQ!0Lb!$( }!$( }O$+YQ`O!$( }OCwQ`O!$( }O'KUQ`O!$( }OOQ!0Lb!)9Ei!)9EiO$+YQ`O!)9EiOCwQ`O!)9EiOOQ!0Lb!.K;T!.K;TO$+YQ`O!.K;TOOQ!0Lb!4/0o!4/0oO!)[QlO'#DzO1PQ`O'#EXO'KaQ!fO'#JrO'KhQ!L^O'#DvO'KoQlO'#EOO'KvQ!fO'#CiO'N^Q!fO'#CiO!)[QlO'#EQO'NnQlO,5;ZO!)[QlO,5;eO!)[QlO,5;eO!)[QlO,5;eO!)[QlO,5;eO!)[QlO,5;eO!)[QlO,5;eO!)[QlO,5;eO!)[QlO,5;eO!)[QlO,5;eO!)[QlO,5;eO!)[QlO'#IpO(!qQ`O,5<iO!)[QlO,5;eO(!yQMhO,5;eO($dQMhO,5;eO!)[QlO,5;wO!&zQMhO'#GmO(!yQMhO'#GmO!&zQMhO'#GoO(!yQMhO'#GoO1SQ`O'#DZO1SQ`O'#DZO!&zQMhO'#GPO(!yQMhO'#GPO!&zQMhO'#GRO(!yQMhO'#GRO!&zQMhO'#GaO(!yQMhO'#GaO!)[QlO,5:jO($kQpO'#D_O($uQpO'#JvO!)[QlO,5@oO'NnQlO1G0uO(%PQ?MtO'#CiO!)[QlO1G2PO!&zQMhO'#IuO(!yQMhO'#IuO!&zQMhO'#IwO(!yQMhO'#IwO(%ZQ!dO'#CrO!&zQMhO,5<tO(!yQMhO,5<tO'NnQlO1G2RO!)[QlO7+&zO!&zQMhO1G2`O(!yQMhO1G2`O!&zQMhO'#IuO(!yQMhO'#IuO!&zQMhO'#IwO(!yQMhO'#IwO!&zQMhO1G2bO(!yQMhO1G2bO'NnQlO7+'mO'NnQlO7+&aO!&zQMhOANAiO(!yQMhOANAiO(%nQ`O'#EoO(%sQ`O'#EoO(%{Q`O'#F]O(&QQ`O'#EyO(&VQ`O'#KTO(&bQ`O'#KRO(&mQ`O,5;ZO(&rQMjO,5<eO(&yQ`O'#GYO('OQ`O'#GYO('TQ`O,5<eO(']Q`O,5<gO('eQ`O,5;ZO('mQ?MtO1G1`O('tQ`O,5<tO('yQ`O,5<tO((OQ`O,5<vO((TQ`O,5<vO((YQ`O1G2RO((_Q`O1G0uO((dQMjO<<K}O((kQMjO<<K}O((rQMhO'#F|O9`Q`O'#F{OAuQ`O'#EnO!)[QlO,5;tO!3oQ`O'#GYO!3oQ`O'#GYO!3oQ`O'#G[O!3oQ`O'#G[O!,TQMhO7+(cO!,TQMhO7+(cO%.zQ!dO1G2wO%.zQ!dO1G2wO!&zQMhO,5=]O!&zQMhO,5=]",stateData:"()x~O'|OS'}OSTOS(ORQ~OPYOQYOSfOY!VOaqOdzOeyOl!POpkOrYOskOtkOzkO|YO!OYO!SWO!WkO!XkO!_XO!iuO!lZO!oYO!pYO!qYO!svO!uwO!xxO!|]O$W|O$niO%h}O%j!QO%l!OO%m!OO%n!OO%q!RO%s!SO%v!TO%w!TO%y!UO&W!WO&^!XO&`!YO&b!ZO&d![O&g!]O&m!^O&s!_O&u!`O&w!aO&y!bO&{!cO(TSO(VTO(YUO(aVO(o[O~OWtO~P`OPYOQYOSfOd!jOe!iOpkOrYOskOtkOzkO|YO!OYO!SWO!WkO!XkO!_!eO!iuO!lZO!oYO!pYO!qYO!svO!u!gO!x!hO$W!kO$niO(T!dO(VTO(YUO(aVO(o[O~Oa!wOs!nO!S!oO!b!yO!c!vO!d!vO!|<VO#T!pO#U!pO#V!xO#W!pO#X!pO#[!zO#]!zO(U!lO(VTO(YUO(e!mO(o!sO~O(O!{O~OP]XR]X[]Xa]Xj]Xr]X!Q]X!S]X!]]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X'z]X(a]X(r]X(y]X(z]X~O!g%RX~P(qO_!}O(V#PO(W!}O(X#PO~O_#QO(X#PO(Y#PO(Z#QO~Ox#SO!U#TO(b#TO(c#VO~OPYOQYOSfOd!jOe!iOpkOrYOskOtkOzkO|YO!OYO!SWO!WkO!XkO!_!eO!iuO!lZO!oYO!pYO!qYO!svO!u!gO!x!hO$W!kO$niO(T<ZO(VTO(YUO(aVO(o[O~O![#ZO!]#WO!Y(hP!Y(vP~P+}O!^#cO~P`OPYOQYOSfOd!jOe!iOrYOskOtkOzkO|YO!OYO!SWO!WkO!XkO!_!eO!iuO!lZO!oYO!pYO!qYO!svO!u!gO!x!hO$W!kO$niO(VTO(YUO(aVO(o[O~Op#mO![#iO!|]O#i#lO#j#iO(T<[O!k(sP~P.iO!l#oO(T#nO~O!x#sO!|]O%h#tO~O#k#uO~O!g#vO#k#uO~OP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!]$_O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO#z$WO#{$XO(aVO(r$YO(y#|O(z#}O~Oa(fX'z(fX'w(fX!k(fX!Y(fX!_(fX%i(fX!g(fX~P1qO#S$dO#`$eO$Q$eOP(gXR(gX[(gXj(gXr(gX!Q(gX!S(gX!](gX!l(gX!p(gX#R(gX#n(gX#o(gX#p(gX#q(gX#r(gX#s(gX#t(gX#u(gX#v(gX#x(gX#z(gX#{(gX(a(gX(r(gX(y(gX(z(gX!_(gX%i(gX~Oa(gX'z(gX'w(gX!Y(gX!k(gXv(gX!g(gX~P4UO#`$eO~O$]$hO$_$gO$f$mO~OSfO!_$nO$i$oO$k$qO~Oh%VOj%dOk%dOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T$sO(VTO(YUO(a$uO(y$}O(z%POg(^P~Ol%[O~P7eO!l%eO~O!S%hO!_%iO(T%gO~O!g%mO~Oa%nO'z%nO~O!Q%rO~P%[O(U!lO~P%[O%n%vO~P%[Oh%VO!l%eO(T%gO(U!lO~Oe%}O!l%eO(T%gO~Oj$RO~O!_&PO(T%gO(U!lO(VTO(YUO`)WP~O!Q&SO!l&RO%j&VO&T&WO~P;SO!x#sO~O%s&YO!S)SX!_)SX(T)SX~O(T&ZO~Ol!PO!u&`O%j!QO%l!OO%m!OO%n!OO%q!RO%s!SO%v!TO%w!TO~Od&eOe&dO!x&bO%h&cO%{&aO~P<bOd&hOeyOl!PO!_&gO!u&`O!xxO!|]O%h}O%l!OO%m!OO%n!OO%q!RO%s!SO%v!TO%w!TO%y!UO~Ob&kO#`&nO%j&iO(U!lO~P=gO!l&oO!u&sO~O!l#oO~O!_XO~Oa%nO'x&{O'z%nO~Oa%nO'x'OO'z%nO~Oa%nO'x'QO'z%nO~O'w]X!Y]Xv]X!k]X&[]X!_]X%i]X!g]X~P(qO!b'_O!c'WO!d'WO(U!lO(VTO(YUO~Os'UO!S'TO!['XO(e'SO!^(iP!^(xP~P@nOn'bO!_'`O(T%gO~Oe'gO!l%eO(T%gO~O!Q&SO!l&RO~Os!nO!S!oO!|<VO#T!pO#U!pO#W!pO#X!pO(U!lO(VTO(YUO(e!mO(o!sO~O!b'mO!c'lO!d'lO#V!pO#['nO#]'nO~PBYOa%nOh%VO!g#vO!l%eO'z%nO(r'pO~O!p'tO#`'rO~PChOs!nO!S!oO(VTO(YUO(e!mO(o!sO~O!_XOs(mX!S(mX!b(mX!c(mX!d(mX!|(mX#T(mX#U(mX#V(mX#W(mX#X(mX#[(mX#](mX(U(mX(V(mX(Y(mX(e(mX(o(mX~O!c'lO!d'lO(U!lO~PDWO(P'xO(Q'xO(R'zO~O_!}O(V'|O(W!}O(X'|O~O_#QO(X'|O(Y'|O(Z#QO~Ov(OO~P%[Ox#SO!U#TO(b#TO(c(RO~O![(TO!Y'WX!Y'^X!]'WX!]'^X~P+}O!](VO!Y(hX~OP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!](VO!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO#z$WO#{$XO(aVO(r$YO(y#|O(z#}O~O!Y(hX~PHRO!Y([O~O!Y(uX!](uX!g(uX!k(uX(r(uX~O#`(uX#k#dX!^(uX~PJUO#`(]O!Y(wX!](wX~O!](^O!Y(vX~O!Y(aO~O#`$eO~PJUO!^(bO~P`OR#zO!Q#yO!S#{O!l#xO(aVOP!na[!naj!nar!na!]!na!p!na#R!na#n!na#o!na#p!na#q!na#r!na#s!na#t!na#u!na#v!na#x!na#z!na#{!na(r!na(y!na(z!na~Oa!na'z!na'w!na!Y!na!k!nav!na!_!na%i!na!g!na~PKlO!k(cO~O!g#vO#`(dO(r'pO!](tXa(tX'z(tX~O!k(tX~PNXO!S%hO!_%iO!|]O#i(iO#j(hO(T%gO~O!](jO!k(sX~O!k(lO~O!S%hO!_%iO#j(hO(T%gO~OP(gXR(gX[(gXj(gXr(gX!Q(gX!S(gX!](gX!l(gX!p(gX#R(gX#n(gX#o(gX#p(gX#q(gX#r(gX#s(gX#t(gX#u(gX#v(gX#x(gX#z(gX#{(gX(a(gX(r(gX(y(gX(z(gX~O!g#vO!k(gX~P! uOR(nO!Q(mO!l#xO#S$dO!|!{a!S!{a~O!x!{a%h!{a!_!{a#i!{a#j!{a(T!{a~P!#vO!x(rO~OPYOQYOSfOd!jOe!iOpkOrYOskOtkOzkO|YO!OYO!SWO!WkO!XkO!_XO!iuO!lZO!oYO!pYO!qYO!svO!u!gO!x!hO$W!kO$niO(T!dO(VTO(YUO(aVO(o[O~Oh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O<sO!S${O!_$|O!i>VO!l$xO#j<yO$W%`O$t<uO$v<wO$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~O#k(xO~O![(zO!k(kP~P%[O(e(|O(o[O~O!S)OO!l#xO(e(|O(o[O~OP<UOQ<UOSfOd>ROe!iOpkOr<UOskOtkOzkO|<UO!O<UO!SWO!WkO!XkO!_!eO!i<XO!lZO!o<UO!p<UO!q<UO!s<YO!u<]O!x!hO$W!kO$n>PO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!O<sO!S*YO!_*ZO!i>VO!l$xO#j<yO$W%`O$t<uO$v<wO$y%aO(VTO(YUO(a$uO(y$}O(z%PO~Op*`O}O(T&ZO~O!l+SO~O(T(vO~Op+WO!S%hO![#iO!_%iO!|]O#i#lO#j#iO(T%gO!k(sP~O!g#vO#k+XO~O!S%hOTX'z)TX~OP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO#z$WO#{$XO(aVO(r$YO(y#|O(z#}O~Oa!ja!]!ja'z!ja'w!ja!Y!ja!k!jav!ja!_!ja%i!ja!g!ja~P!:tOR#zO!Q#yO!S#{O!l#xO(aVOP!ra[!raj!rar!ra!]!ra!p!ra#R!ra#n!ra#o!ra#p!ra#q!ra#r!ra#s!ra#t!ra#u!ra#v!ra#x!ra#z!ra#{!ra(r!ra(y!ra(z!ra~Oa!ra'z!ra'w!ra!Y!ra!k!rav!ra!_!ra%i!ra!g!ra~P!=[OR#zO!Q#yO!S#{O!l#xO(aVOP!ta[!taj!tar!ta!]!ta!p!ta#R!ta#n!ta#o!ta#p!ta#q!ta#r!ta#s!ta#t!ta#u!ta#v!ta#x!ta#z!ta#{!ta(r!ta(y!ta(z!ta~Oa!ta'z!ta'w!ta!Y!ta!k!tav!ta!_!ta%i!ta!g!ta~P!?rOh%VOn+gO!_'`O%i+fO~O!g+iOa(]X!_(]X'z(]X!](]X~Oa%nO!_XO'z%nO~Oh%VO!l%eO~Oh%VO!l%eO(T%gO~O!g#vO#k(xO~Ob+tO%j+uO(T+qO(VTO(YUO!^)XP~O!]+vO`)WX~O[+zO~O`+{O~O!_&PO(T%gO(U!lO`)WP~O%j,OO~P;SOh%VO#`,SO~Oh%VOn,VO!_$|O~O!_,XO~O!Q,ZO!_XO~O%n%vO~O!x,`O~Oe,eO~Ob,fO(T#nO(VTO(YUO!^)VP~Oe%}O~O%j!QO(T&ZO~P=gO[,kO`,jO~OPYOQYOSfOdzOeyOpkOrYOskOtkOzkO|YO!OYO!SWO!WkO!XkO!iuO!lZO!oYO!pYO!qYO!svO!xxO!|]O$niO%h}O(VTO(YUO(aVO(o[O~O!_!eO!u!gO$W!kO(T!dO~P!FyO`,jOa%nO'z%nO~OPYOQYOSfOd!jOe!iOpkOrYOskOtkOzkO|YO!OYO!SWO!WkO!XkO!_!eO!iuO!lZO!oYO!pYO!qYO!svO!x!hO$W!kO$niO(T!dO(VTO(YUO(aVO(o[O~Oa,pOl!OO!uwO%l!OO%m!OO%n!OO~P!IcO!l&oO~O&^,vO~O!_,xO~O&o,zO&q,{OP&laQ&laS&laY&laa&lad&lae&lal&lap&lar&las&lat&laz&la|&la!O&la!S&la!W&la!X&la!_&la!i&la!l&la!o&la!p&la!q&la!s&la!u&la!x&la!|&la$W&la$n&la%h&la%j&la%l&la%m&la%n&la%q&la%s&la%v&la%w&la%y&la&W&la&^&la&`&la&b&la&d&la&g&la&m&la&s&la&u&la&w&la&y&la&{&la'w&la(T&la(V&la(Y&la(a&la(o&la!^&la&e&lab&la&j&la~O(T-QO~Oh!eX!]!RX!^!RX!g!RX!g!eX!l!eX#`!RX~O!]!eX!^!eX~P#!iO!g-VO#`-UOh(jX!]#hX!^#hX!g(jX!l(jX~O!](jX!^(jX~P##[Oh%VO!g-XO!l%eO!]!aX!^!aX~Os!nO!S!oO(VTO(YUO(e!mO~OP<UOQ<UOSfOd>ROe!iOpkOr<UOskOtkOzkO|<UO!O<UO!SWO!WkO!XkO!_!eO!i<XO!lZO!o<UO!p<UO!q<UO!s<YO!u<]O!x!hO$W!kO$n>PO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[<mOj<bOr<kO!Q#yO!S#{O!l#xO!p$[O#R<bO#n<_O#o<`O#p<`O#q<`O#r<aO#s<bO#t<bO#u<lO#v<cO#x<eO#z<gO#{<hO(aVO(r$YO(y#|O(z#}O~O$O.{O~P#BwO#S$dO#`<nO$Q<nO$O(gX!^(gX~P! uOa'da!]'da'z'da'w'da!k'da!Y'dav'da!_'da%i'da!g'da~P!:tO[#mia#mij#mir#mi!]#mi#R#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO(y#mi(z#mi~P#EyOn>]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]<iO!^(fX~P#BwO!^/ZO~O!g)hO$f({X~O$f/]O~Ov/^O~P!&zOx)yO(b)zO(c/aO~O!S/dO~O(y$}On%aa!Q%aa'y%aa(z%aa!]%aa#`%aa~Og%aa$O%aa~P#L{O(z%POn%ca!Q%ca'y%ca(y%ca!]%ca#`%ca~Og%ca$O%ca~P#MnO!]fX!gfX!kfX!k$zX(rfX~P!0SOp%WOPP~P!1uOr*sO!b*qO!c*kO!d*kO!l*bO#[*rO%`*mO(U!lO(VTO(YUO~Os<}O!S/nO![+[O!^*pO(e<|O!^(xP~P$ [O!k/oO~P#/sO!]/pO!g#vO(r'pO!k)OX~O!k/uO~OnoX!QoX'yoX(yoX(zoX~O!g#vO!koX~P$#OOp/wO!S%hO![*^O!_%iO(T%gO!k)OP~O#k/xO~O!Y$zX!]$zX!g%RX~P!0SO!]/yO!Y)PX~P#/sO!g/{O~O!Y/}O~OpkO(T0OO~P.iOh%VOr0TO!g#vO!l%eO(r'pO~O!g+iO~Oa%nO!]0XO'z%nO~O!^0ZO~P!5iO!c0[O!d0[O(U!lO~P#$`Os!nO!S0]O(VTO(YUO(e!mO~O#[0_O~Og%aa!]%aa#`%aa$O%aa~P!1WOg%ca!]%ca#`%ca$O%ca~P!1WOj%dOk%dOl%dO(T&ZOg'mX!]'mX~O!]*yOg(^a~Og0hO~On0jO#`0iOg(_a!](_a~OR0kO!Q0kO!S0lO#S$dOn}a'y}a(y}a(z}a!]}a#`}a~Og}a$O}a~P$(cO!Q*OO'y*POn$sa(y$sa(z$sa!]$sa#`$sa~Og$sa$O$sa~P$)_O!Q*OO'y*POn$ua(y$ua(z$ua!]$ua#`$ua~Og$ua$O$ua~P$*QO#k0oO~Og%Ta!]%Ta#`%Ta$O%Ta~P!1WO!g#vO~O#k0rO~O!]+^Oa)Ta'z)Ta~OR#zO!Q#yO!S#{O!l#xO(aVOP!ri[!rij!rir!ri!]!ri!p!ri#R!ri#n!ri#o!ri#p!ri#q!ri#r!ri#s!ri#t!ri#u!ri#v!ri#x!ri#z!ri#{!ri(r!ri(y!ri(z!ri~Oa!ri'z!ri'w!ri!Y!ri!k!riv!ri!_!ri%i!ri!g!ri~P$+oOh%VOr%XOs$tOt$tOz%YO|%ZO!O<sO!S${O!_$|O!i>VO!l$xO#j<yO$W%`O$t<uO$v<wO$y%aO(VTO(YUO(a$uO(y$}O(z%PO~Op0{O%]0|O(T0zO~P$.VO!g+iOa(]a!_(]a'z(]a!](]a~O#k1SO~O[]X!]fX!^fX~O!]1TO!^)XX~O!^1VO~O[1WO~Ob1YO(T+qO(VTO(YUO~O!_&PO(T%gO`'uX!]'uX~O!]+vO`)Wa~O!k1]O~P!:tO[1`O~O`1aO~O#`1fO~On1iO!_$|O~O(e(|O!^)UP~Oh%VOn1rO!_1oO%i1qO~O[1|O!]1zO!^)VX~O!^1}O~O`2POa%nO'z%nO~O(T#nO(VTO(YUO~O#S$dO#`$eO$Q$eOP(gXR(gX[(gXr(gX!Q(gX!S(gX!](gX!l(gX!p(gX#R(gX#n(gX#o(gX#p(gX#q(gX#r(gX#s(gX#t(gX#u(gX#v(gX#x(gX#z(gX#{(gX(a(gX(r(gX(y(gX(z(gX~Oj2SO&[2TOa(gX~P$3pOj2SO#`$eO&[2TO~Oa2VO~P%[Oa2XO~O&e2[OP&ciQ&ciS&ciY&cia&cid&cie&cil&cip&cir&cis&cit&ciz&ci|&ci!O&ci!S&ci!W&ci!X&ci!_&ci!i&ci!l&ci!o&ci!p&ci!q&ci!s&ci!u&ci!x&ci!|&ci$W&ci$n&ci%h&ci%j&ci%l&ci%m&ci%n&ci%q&ci%s&ci%v&ci%w&ci%y&ci&W&ci&^&ci&`&ci&b&ci&d&ci&g&ci&m&ci&s&ci&u&ci&w&ci&y&ci&{&ci'w&ci(T&ci(V&ci(Y&ci(a&ci(o&ci!^&cib&ci&j&ci~Ob2bO!^2`O&j2aO~P`O!_XO!l2dO~O&q,{OP&liQ&liS&liY&lia&lid&lie&lil&lip&lir&lis&lit&liz&li|&li!O&li!S&li!W&li!X&li!_&li!i&li!l&li!o&li!p&li!q&li!s&li!u&li!x&li!|&li$W&li$n&li%h&li%j&li%l&li%m&li%n&li%q&li%s&li%v&li%w&li%y&li&W&li&^&li&`&li&b&li&d&li&g&li&m&li&s&li&u&li&w&li&y&li&{&li'w&li(T&li(V&li(Y&li(a&li(o&li!^&li&e&lib&li&j&li~O!Y2jO~O!]!aa!^!aa~P#BwOs!nO!S!oO![2pO(e!mO!]'XX!^'XX~P@nO!]-]O!^(ia~O!]'_X!^'_X~P!9|O!]-`O!^(xa~O!^2wO~P'_Oa%nO#`3QO'z%nO~Oa%nO!g#vO#`3QO'z%nO~Oa%nO!g#vO!p3UO#`3QO'z%nO(r'pO~Oa%nO'z%nO~P!:tO!]$_Ov$qa~O!Y'Wi!]'Wi~P!:tO!](VO!Y(hi~O!](^O!Y(vi~O!Y(wi!](wi~P!:tO!](ti!k(tia(ti'z(ti~P!:tO#`3WO!](ti!k(tia(ti'z(ti~O!](jO!k(si~O!S%hO!_%iO!|]O#i3]O#j3[O(T%gO~O!S%hO!_%iO#j3[O(T%gO~On3dO!_'`O%i3cO~Oh%VOn3dO!_'`O%i3cO~O#k%aaP%aaR%aa[%aaa%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa'z%aa(a%aa(r%aa!k%aa!Y%aa'w%aav%aa!_%aa%i%aa!g%aa~P#L{O#k%caP%caR%ca[%caa%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca'z%ca(a%ca(r%ca!k%ca!Y%ca'w%cav%ca!_%ca%i%ca!g%ca~P#MnO#k%aaP%aaR%aa[%aaa%aaj%aar%aa!S%aa!]%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa'z%aa(a%aa(r%aa!k%aa!Y%aa'w%aa#`%aav%aa!_%aa%i%aa!g%aa~P#/sO#k%caP%caR%ca[%caa%caj%car%ca!S%ca!]%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca'z%ca(a%ca(r%ca!k%ca!Y%ca'w%ca#`%cav%ca!_%ca%i%ca!g%ca~P#/sO#k}aP}a[}aa}aj}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a'z}a(a}a(r}a!k}a!Y}a'w}av}a!_}a%i}a!g}a~P$(cO#k$saP$saR$sa[$saa$saj$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa'z$sa(a$sa(r$sa!k$sa!Y$sa'w$sav$sa!_$sa%i$sa!g$sa~P$)_O#k$uaP$uaR$ua[$uaa$uaj$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua'z$ua(a$ua(r$ua!k$ua!Y$ua'w$uav$ua!_$ua%i$ua!g$ua~P$*QO#k%TaP%TaR%Ta[%Taa%Taj%Tar%Ta!S%Ta!]%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta'z%Ta(a%Ta(r%Ta!k%Ta!Y%Ta'w%Ta#`%Tav%Ta!_%Ta%i%Ta!g%Ta~P#/sOa#cq!]#cq'z#cq'w#cq!Y#cq!k#cqv#cq!_#cq%i#cq!g#cq~P!:tO![3lO!]'YX!k'YX~P%[O!].tO!k(ka~O!].tO!k(ka~P!:tO!Y3oO~O$O!na!^!na~PKlO$O!ja!]!ja!^!ja~P#BwO$O!ra!^!ra~P!=[O$O!ta!^!ta~P!?rOg']X!]']X~P!,TO!]/POg(pa~OSfO!_4TO$d4UO~O!^4YO~Ov4ZO~P#/sOa$mq!]$mq'z$mq'w$mq!Y$mq!k$mqv$mq!_$mq%i$mq!g$mq~P!:tO!Y4]O~P!&zO!S4^O~O!Q*OO'y*PO(z%POn'ia(y'ia!]'ia#`'ia~Og'ia$O'ia~P%-fO!Q*OO'y*POn'ka(y'ka(z'ka!]'ka#`'ka~Og'ka$O'ka~P%.XO(r$YO~P#/sO!YfX!Y$zX!]fX!]$zX!g%RX#`fX~P!0SOp%WO(T=WO~P!1uOp4bO!S%hO![4aO!_%iO(T%gO!]'eX!k'eX~O!]/pO!k)Oa~O!]/pO!g#vO!k)Oa~O!]/pO!g#vO(r'pO!k)Oa~Og$|i!]$|i#`$|i$O$|i~P!1WO![4jO!Y'gX!]'gX~P!3tO!]/yO!Y)Pa~O!]/yO!Y)Pa~P#/sOP]XR]X[]Xj]Xr]X!Q]X!S]X!Y]X!]]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X~Oj%YX!g%YX~P%2OOj4oO!g#vO~Oh%VO!g#vO!l%eO~Oh%VOr4tO!l%eO(r'pO~Or4yO!g#vO(r'pO~Os!nO!S4zO(VTO(YUO(e!mO~O(y$}On%ai!Q%ai'y%ai(z%ai!]%ai#`%ai~Og%ai$O%ai~P%5oO(z%POn%ci!Q%ci'y%ci(y%ci!]%ci#`%ci~Og%ci$O%ci~P%6bOg(_i!](_i~P!1WO#`5QOg(_i!](_i~P!1WO!k5VO~Oa$oq!]$oq'z$oq'w$oq!Y$oq!k$oqv$oq!_$oq%i$oq!g$oq~P!:tO!Y5ZO~O!]5[O!_)QX~P#/sOa$zX!_$zX%^]X'z$zX!]$zX~P!0SO%^5_OaoX!_oX'zoX!]oX~P$#OOp5`O(T#nO~O%^5_O~Ob5fO%j5gO(T+qO(VTO(YUO!]'tX!^'tX~O!]1TO!^)Xa~O[5kO~O`5lO~O[5pO~Oa%nO'z%nO~P#/sO!]5uO#`5wO!^)UX~O!^5xO~Or6OOs!nO!S*iO!b!yO!c!vO!d!vO!|<VO#T!pO#U!pO#V!pO#W!pO#X!pO#[5}O#]!zO(U!lO(VTO(YUO(e!mO(o!sO~O!^5|O~P%;eOn6TO!_1oO%i6SO~Oh%VOn6TO!_1oO%i6SO~Ob6[O(T#nO(VTO(YUO!]'sX!^'sX~O!]1zO!^)Va~O(VTO(YUO(e6^O~O`6bO~Oj6eO&[6fO~PNXO!k6gO~P%[Oa6iO~Oa6iO~P%[Ob2bO!^6nO&j2aO~P`O!g6pO~O!g6rOh(ji!](ji!^(ji!g(ji!l(jir(ji(r(ji~O!]#hi!^#hi~P#BwO#`6sO!]#hi!^#hi~O!]!ai!^!ai~P#BwOa%nO#`6|O'z%nO~Oa%nO!g#vO#`6|O'z%nO~O!](tq!k(tqa(tq'z(tq~P!:tO!](jO!k(sq~O!S%hO!_%iO#j7TO(T%gO~O!_'`O%i7WO~On7[O!_'`O%i7WO~O#k'iaP'iaR'ia['iaa'iaj'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia'z'ia(a'ia(r'ia!k'ia!Y'ia'w'iav'ia!_'ia%i'ia!g'ia~P%-fO#k'kaP'kaR'ka['kaa'kaj'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka'z'ka(a'ka(r'ka!k'ka!Y'ka'w'kav'ka!_'ka%i'ka!g'ka~P%.XO#k$|iP$|iR$|i[$|ia$|ij$|ir$|i!S$|i!]$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i'z$|i(a$|i(r$|i!k$|i!Y$|i'w$|i#`$|iv$|i!_$|i%i$|i!g$|i~P#/sO#k%aiP%aiR%ai[%aia%aij%air%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai'z%ai(a%ai(r%ai!k%ai!Y%ai'w%aiv%ai!_%ai%i%ai!g%ai~P%5oO#k%ciP%ciR%ci[%cia%cij%cir%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci'z%ci(a%ci(r%ci!k%ci!Y%ci'w%civ%ci!_%ci%i%ci!g%ci~P%6bO!]'Ya!k'Ya~P!:tO!].tO!k(ki~O$O#ci!]#ci!^#ci~P#BwOP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mij#mir#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi$O#mi(r#mi(y#mi(z#mi!]#mi!^#mi~O#n#mi~P%NdO#n<_O~P%NdOP$[OR#zOr<kO!Q#yO!S#{O!l#xO!p$[O#n<_O#o<`O#p<`O#q<`O(aVO[#mij#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi$O#mi(r#mi(y#mi(z#mi!]#mi!^#mi~O#r#mi~P&!lO#r<aO~P&!lOP$[OR#zO[<mOj<bOr<kO!Q#yO!S#{O!l#xO!p$[O#R<bO#n<_O#o<`O#p<`O#q<`O#r<aO#s<bO#t<bO#u<lO(aVO#x#mi#z#mi#{#mi$O#mi(r#mi(y#mi(z#mi!]#mi!^#mi~O#v#mi~P&$tOP$[OR#zO[<mOj<bOr<kO!Q#yO!S#{O!l#xO!p$[O#R<bO#n<_O#o<`O#p<`O#q<`O#r<aO#s<bO#t<bO#u<lO#v<cO(aVO(z#}O#z#mi#{#mi$O#mi(r#mi(y#mi!]#mi!^#mi~O#x<eO~P&&uO#x#mi~P&&uO#v<cO~P&$tOP$[OR#zO[<mOj<bOr<kO!Q#yO!S#{O!l#xO!p$[O#R<bO#n<_O#o<`O#p<`O#q<`O#r<aO#s<bO#t<bO#u<lO#v<cO#x<eO(aVO(y#|O(z#}O#{#mi$O#mi(r#mi!]#mi!^#mi~O#z#mi~P&)UO#z<gO~P&)UOa#|y!]#|y'z#|y'w#|y!Y#|y!k#|yv#|y!_#|y%i#|y!g#|y~P!:tO[#mij#mir#mi#R#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi$O#mi(r#mi!]#mi!^#mi~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O#n<_O#o<`O#p<`O#q<`O(aVO(y#mi(z#mi~P&,QOn>^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOr<QO!g#vO(r'pO~Ov(fX~P1qO!Q%rO~P!)[O(U!lO~P!)[O!YfX!]fX#`fX~P%2OOP]XR]X[]Xj]Xr]X!Q]X!S]X!]]X!]fX!l]X!p]X#R]X#S]X#`]X#`fX#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X~O!gfX!k]X!kfX(rfX~P'LTOP<UOQ<UOSfOd>ROe!iOpkOr<UOskOtkOzkO|<UO!O<UO!SWO!WkO!XkO!_XO!i<XO!lZO!o<UO!p<UO!q<UO!s<YO!u<]O!x!hO$W!kO$n>PO(T)]O(VTO(YUO(aVO(o[O~O!]<iO!^$qa~Oh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O<tO!S${O!_$|O!i>WO!l$xO#j<zO$W%`O$t<vO$v<xO$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Ol)dO~P(!yOr!eX(r!eX~P#!iOr(jX(r(jX~P##[O!^]X!^fX~P'LTO!YfX!Y$zX!]fX!]$zX#`fX~P!0SO#k<^O~O!g#vO#k<^O~O#`<nO~Oj<bO~O#`=OO!](wX!^(wX~O#`<nO!](uX!^(uX~O#k=PO~Og=RO~P!1WO#k=XO~O#k=YO~Og=RO(T&ZO~O!g#vO#k=ZO~O!g#vO#k=PO~O$O=[O~P#BwO#k=]O~O#k=^O~O#k=cO~O#k=dO~O#k=eO~O#k=fO~O$O=gO~P!1WO$O=hO~P!1WOl=sO~P7eOk#S#T#U#W#X#[#i#j#u$n$t$v$y%]%^%h%i%j%q%s%v%w%y%{~(OT#o!X'|(U#ps#n#qr!Q'}$]'}(T$_(e~",goto:"$9Y)]PPPPPP)^PP)aP)rP+W/]PPPP6mPP7TPP=QPPP@tPA^PA^PPPA^PCfPA^PA^PA^PCjPCoPD^PIWPPPI[PPPPI[L_PPPLeMVPI[PI[PP! eI[PPPI[PI[P!#lI[P!'S!(X!(bP!)U!)Y!)U!,gPPPPPPP!-W!(XPP!-h!/YP!2iI[I[!2n!5z!:h!:h!>gPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#<e#<k#<n)aP#<q)aP#<z#<z#<zP)aP)aP)aP)aPP)aP#=Q#=TP#=T)aP#=XP#=[P)aP)aP)aP)aP)aP)a)aPP#=b#=h#=s#=y#>P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{<Y%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_S#q]<V!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>SU+P%]<s<tQ+t&PQ,f&gQ,m&oQ0x+gQ0}+iQ1Y+uQ2R,kQ3`.gQ5`0|Q5f1TQ6[1zQ7Y3dQ8`5gR9e7['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;k<l<m<o<p<q<r<u<v<w<x<y<z=S=T=U=V=X=Y=]=^=_=`=a=b=c=d=g=h>P>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>R>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k<o<q<u<w<y=S=U=X=]=_=a=c=g>]>^o>U<l<m<p<r<v<x<z=T=V=Y=^=`=b=d=hW%Ti%V*y>PS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;k<l<m<o<p<q<r<u<v<w<x<y<z=S=T=U=V=X=Y=]=^=_=`=a=b=c=d=g=h>P>X>Y>]>^T)z$u){V+P%]<s<tW'[!e%i*Z-`S(}#y#zQ+c%rQ+y&SS.b(m(nQ1j,XQ5T0kR8i5u'QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`<W=vT#TV#U'RkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`<W=vS(o#p'iQ)P#zS+b%q.|S.c(n(pR3^.d'QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>SS#q]<VQ&t!XQ&u!YQ&w![Q&x!]R2Z,vQ'a!hQ+e%wQ-h'cS.e(q+hQ2x-gW3b.h.i0w0yQ6w2yW7U3_3a3e5^U9a7V7X7ZU:q9c9d9fS;b:p:sQ;p;cR;x;qU!wQ'`-eT5y1o5{!Q_OXZ`st!V!Z#d#h%e%m&i&k&r&t&u&w(j,s,x.[2[2_]!pQ!r'`-e1o5{T#q]<V%^{OPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_S(}#y#zS.b(m(n!s=l$Z$n'X)s-U-X/V2p4T5w6s:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uS<P;|;}R<S<QQ#wbQ's!uS(e#g2US(g#m+WQ+Y%fQ+j%xQ+p&OU-r'k't'wQ.W(fU/r*]*`/wQ0S*jQ0V*lQ1O+kQ1u,aS3R-s-vQ3Z.`S4e/s/tQ4n0PS4q0R0^Q4u0WQ6W1vQ7P3US7q4`4bQ7u4fU7|4r4x4{Q8P4wQ8v6XS9q7r7sQ9u7yQ9}8RQ:O8SQ:c8wQ:y9rS:z9v9xQ;S:QQ;^:dS;f:{;PS;r;g;hS;z;s;uS<O;{;}Q<R<PQ<T<SQ=o=jQ={=tR=|=uV!wQ'`-e%^aOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_S#wz!j!r=i$Z$n'X)s-U-X/V2p4T5w6s:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>SR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>SQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>SR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>SQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:o<W!P<d)^)q-Z.|2k2n3p3y3z4P4X6u7b7k7l8k9X9g9m9n;W;`=v!f$Vc#Y%q(S(Y(t(y)W)X)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:o<W!T<f)^)q-Z.|2k2n3p3v3w3y3z4P4X6u7b7k7l8k9X9g9m9n;W;`=v!^$Zc#Y%q(S(Y(t(y)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:o<WQ4_/kz>S)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>SS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>ST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>ST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:m<U<X<Y<]<^<_<`<a<b<c<d<e<f<g<h<i<k<n<{=O=P=R=Z=[=e=f>S#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k<o<q<u<w<y=S=U=X=]=_=a=c=g>]>^Q+T%aQ/c*Oo4O<l<m<p<r<v<x<z=T=V=Y=^=`=b=d=h!U$yi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k<o<q<u<w<y=S=U=X=]=_=a=c=g>]>^n=r<l<m<p<r<v<x<z=T=V=Y=^=`=b=d=hQ=w>TQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k<o<q<u<w<y=S=U=X=]=_=a=c=g>]>^o4O<l<m<p<r<v<x<z=T=V=Y=^=`=b=d=hnoOXst!Z#d%m&r&t&u&w,s,x2[2_S*f${*YQ-R'OQ-S'QR4i/y%[%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;k<l<m<o<p<q<r<u<v<w<x<y<z=S=T=U=V=X=Y=]=^=_=`=a=b=c=d=g=h>P>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f<o#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k<o<q<u<w<y=S=U=X=]=_=a=c=g>]>^n<p<l<m<p<r<v<x<z=T=V=Y=^=`=b=d=h!d=S(u)c*[*e.j.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f<q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k<o<q<u<w<y=S=U=X=]=_=a=c=g>]>^n<r<l<m<p<r<v<x<z=T=V=Y=^=`=b=d=h!h=U(u)c*[*e.k.l.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|<jQ-|<WR<j)qQ/q*]W4c/q4d7t9sU4d/r/s/tS7t4e4fR9s7u$e*Q$v(u)c)e*[*e*t*u+Q+R+V.l.m.o.p.q/_/g/i/k/v/|0d0e0v1e3f3g3h3}4R4[4g4h4l4|5O5R5S5W5r7]7^7_7`7e7f7h7i7j7p7w7z8U8X8Z9h9i9j9t9|:R:S:t:u:v:w:x:};R;e;j;v;y=p=}>O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.l<oQ.m<qQ.o<uQ.p<wQ.q<yQ/_)yQ/g*RQ/i*TQ/k*VQ/v*aS/|*g/mQ0d*wQ0e*xl0v+f,V.f1i1q3c6S7W8q9b:`:r;[;dQ1e,SQ3f=SQ3g=UQ3h=XS3}<l<mQ4R/PS4[/d4^Q4g/xQ4h/yQ4l/{Q4|0`Q5O0bQ5R0iQ5S0jQ5W0oQ5r1fQ7]=]Q7^=_Q7_=aQ7`=cQ7e<pQ7f<rQ7h<vQ7i<xQ7j<zQ7p4_Q7w4jQ7z4oQ8U5QQ8X5[Q8Z5_Q9h=YQ9i=TQ9j=VQ9t7vQ9|8QQ:R8VQ:S8[Q:t=^Q:u=`Q:v=bQ:w=dQ:x9pQ:}9yQ;R:PQ;e=gQ;j;QQ;v;kQ;y=hQ=p>PQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.n<sR7g<tnpOXst!Z#d%m&r&t&u&w,s,x2[2_Q!fPS#fZ#oQ&|!`W'h!o*i0]4zQ(P#SQ)Q#{Q)r$nS,l&k&nQ,q&oQ-O&{S-T'T/nQ-g'bQ.x)OQ/[)sQ0s+]Q0y+gQ2W,pQ2y-iQ3a.gQ4W/VQ5U0lQ6Q1rQ6c2SQ6d2TQ6h2VQ6j2XQ6o2aQ7Z3dQ7m4TQ8s6TQ9P6eQ9Q6fQ9S6iQ9f7[Q:a8tR:k9T#[cOPXZst!Z!`!o#d#o#{%m&k&n&o&r&t&u&w&{'T'b)O*i+]+g,p,s,x-i.g/n0]0l1r2S2T2V2X2[2_2a3d4z6T6e6f6i7[8t9TQ#YWQ#eYQ%quQ%svS%uw!gS(S#W(VQ(Y#ZQ(t#uQ(y#xQ)R$OQ)S$PQ)T$QQ)U$RQ)V$SQ)W$TQ)X$UQ)Y$VQ)Z$WQ)[$XQ)^$ZQ)`$_Q)b$aQ)g$eW)q$n)s/V4TQ+d%tQ+x&RS-Z'X2pQ-x'rS-}(T.PQ.S(]Q.U(dQ.s(xQ.v(zQ.z<UQ.|<XQ.}<YQ/O<]Q/b)}Q0p+XQ2k-UQ2n-XQ3O-qQ3V.VQ3k.tQ3p<^Q3q<_Q3r<`Q3s<aQ3t<bQ3u<cQ3v<dQ3w<eQ3x<fQ3y<gQ3z<hQ3{.{Q3|<kQ4P<nQ4Q<{Q4X<iQ5X0rQ5c1SQ6u=OQ6{3QQ7Q3WQ7a3lQ7b=PQ7k=RQ7l=ZQ8k5wQ9X6sQ9]6|Q9g=[Q9m=eQ9n=fQ:o9_Q;W:ZQ;`:mQ<W#SR=v>SR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i<VR)f$dY!uQ'`-e1o5{Q'k!rS'u!v!yS'w!z5}S-t'l'mQ-v'nR3T-uT#kZ%eS#jZ%eS%km,oU(g#h#i#lS.Y(h(iQ.^(jQ0t+^Q3Y.ZU3Z.[.]._S7S3[3]R9`7Td#^W#W#Z%h(T(^*Y+Z.T/mr#gZm#h#i#l%e(h(i(j+^.Z.[.]._3[3]7TS*]$x*bQ/t*^Q2U,oQ2l-VQ4`/pQ6q2dQ7s4aQ9W6rT=m'X+[V#aW%h*YU#`W%h*YS(U#W(^U(Z#Z+Z/mS-['X+[T.O(T.TV'^!e%i*ZQ$lfR)x$qT)m$l)nR4V/UT*_$x*bT*h${*YQ0w+fQ1g,VQ3_.fQ5t1iQ6P1qQ7X3cQ8r6SQ9c7WQ:^8qQ:p9bQ;Z:`Q;c:rQ;n;[R;q;dnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&l!VR,h&itmOXst!U!V!Z#d%m&i&r&t&u&w,s,x2[2_R,o&oT%lm,oR1k,XR,g&gQ&U|S+}&V&WR1^,OR+s&PT&p!W&sT&q!W&sT2^,x2_",nodeNames:`⚠ ArithOp ArithOp ?. JSXStartTag LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem`,maxTerm:380,context:_v,nodeProps:[[`isolate`,-8,5,6,14,37,39,51,53,55,``],[`group`,-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,`Statement`,-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,`Expression`,-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,`Type`,-3,88,103,109,`ClassItem`],[`openedBy`,23,`<`,38,`InterpolationStart`,56,`[`,60,`{`,73,`(`,160,`JSXStartCloseTag`],[`closedBy`,-2,24,168,`>`,40,`InterpolationEnd`,50,`]`,61,`}`,74,`)`,165,`JSXEndTag`]],propSources:[wv],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$<r#p#q$=h#q#r$>x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr<Srs&}st%ZtuCruw%Zwx(rx!^%Z!^!_*g!_!c%Z!c!}Cr!}#O%Z#O#P&c#P#R%Z#R#SCr#S#T%Z#T#oCr#o#p*g#p$g%Z$g;'SCr;'S;=`El<%lOCr(r<__WS$i&j(Wp(Z!bOY<SYZ&cZr<Srs=^sw<Swx@nx!^<S!^!_Bm!_#O<S#O#P>`#P#o<S#o#pBm#p;'S<S;'S;=`Cl<%lO<S(Q=g]WS$i&j(Z!bOY=^YZ&cZw=^wx>`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l<S%9[C}i$i&j(o%1l(Wp(Z!bOY%ZYZ&cZr%Zrs&}st%ZtuCruw%Zwx(rx!Q%Z!Q![Cr![!^%Z!^!_*g!_!c%Z!c!}Cr!}#O%Z#O#P&c#P#R%Z#R#SCr#S#T%Z#T#oCr#o#p*g#p$g%Z$g;'SCr;'S;=`El<%lOCr%9[EoP;=`<%lCr07[FRk$i&j(Wp(Z!b$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr+dHRk$i&j(Wp(Z!b$]#tOY%ZYZ&cZr%Zrs&}st%ZtuGvuw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Gv![!^%Z!^!_*g!_!c%Z!c!}Gv!}#O%Z#O#P&c#P#R%Z#R#SGv#S#T%Z#T#oGv#o#p*g#p$g%Z$g;'SGv;'S;=`Iv<%lOGv+dIyP;=`<%lGv07[JPP;=`<%lEr(KWJ_`$i&j(Wp(Z!b#p(ChOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Ka!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KWKl_$i&j$Q(Ch(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z,#xLva(z+JY$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sv%ZvwM{wx(rx!^%Z!^!_*g!_!`Ka!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KWNW`$i&j#z(Ch(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Ka!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At! c_(Y';W$i&j(WpOY!!bYZ!#hZr!!brs!#hsw!!bwx!$xx!^!!b!^!_!%z!_#O!!b#O#P!#h#P#o!!b#o#p!%z#p;'S!!b;'S;=`!'c<%lO!!b'l!!i_$i&j(WpOY!!bYZ!#hZr!!brs!#hsw!!bwx!$xx!^!!b!^!_!%z!_#O!!b#O#P!#h#P#o!!b#o#p!%z#p;'S!!b;'S;=`!'c<%lO!!b&z!#mX$i&jOw!#hwx6cx!^!#h!^!_!$Y!_#o!#h#o#p!$Y#p;'S!#h;'S;=`!$r<%lO!#h`!$]TOw!$Ywx7]x;'S!$Y;'S;=`!$l<%lO!$Y`!$oP;=`<%l!$Y&z!$uP;=`<%l!#h'l!%R]$d`$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(r!Q!&PZ(WpOY!%zYZ!$YZr!%zrs!$Ysw!%zwx!&rx#O!%z#O#P!$Y#P;'S!%z;'S;=`!']<%lO!%z!Q!&yU$d`(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)r!Q!'`P;=`<%l!%z'l!'fP;=`<%l!!b/5|!'t_!l/.^$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z#&U!)O_!k!Lf$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z-!n!*[b$i&j(Wp(Z!b(U%&f#q(ChOY%ZYZ&cZr%Zrs&}sw%Zwx(rxz%Zz{!+d{!^%Z!^!_*g!_!`Ka!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW!+o`$i&j(Wp(Z!b#n(ChOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Ka!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z+;x!,|`$i&j(Wp(Z!br+4YOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Ka!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z,$U!.Z_!]+Jf$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[!/ec$i&j(Wp(Z!b!Q.2^OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!O%Z!O!P!0p!P!Q%Z!Q![!3Y![!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z#%|!0ya$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!O%Z!O!P!2O!P!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z#%|!2Z_![!L^$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad!3eg$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![!3Y![!^%Z!^!_*g!_!g%Z!g!h!4|!h#O%Z#O#P&c#P#R%Z#R#S!3Y#S#X%Z#X#Y!4|#Y#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad!5Vg$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx{%Z{|!6n|}%Z}!O!6n!O!Q%Z!Q![!8S![!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S!8S#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad!6wc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![!8S![!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S!8S#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad!8_c$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![!8S![!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S!8S#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[!9uf$i&j(Wp(Z!b#o(ChOY!;ZYZ&cZr!;Zrs!<nsw!;Zwx!Lcxz!;Zz{#-}{!P!;Z!P!Q#/d!Q!^!;Z!^!_#(i!_!`#7S!`!a#8i!a!}!;Z!}#O#,f#O#P!Dy#P#o!;Z#o#p#(i#p;'S!;Z;'S;=`#-w<%lO!;Z?O!;fb$i&j(Wp(Z!b!X7`OY!;ZYZ&cZr!;Zrs!<nsw!;Zwx!Lcx!P!;Z!P!Q#&`!Q!^!;Z!^!_#(i!_!}!;Z!}#O#,f#O#P!Dy#P#o!;Z#o#p#(i#p;'S!;Z;'S;=`#-w<%lO!;Z>^!<w`$i&j(Z!b!X7`OY!<nYZ&cZw!<nwx!=yx!P!<n!P!Q!Eq!Q!^!<n!^!_!Gr!_!}!<n!}#O!KS#O#P!Dy#P#o!<n#o#p!Gr#p;'S!<n;'S;=`!L]<%lO!<n<z!>Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y<z!?Td$i&j!X7`O!^&c!_#W&c#W#X!>|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c<z!C][$i&jOY!CWYZ&cZ!^!CW!^!_!Ar!_#O!CW#O#P!DR#P#Q!=y#Q#o!CW#o#p!Ar#p;'S!CW;'S;=`!Ds<%lO!CW<z!DWX$i&jOY!CWYZ&cZ!^!CW!^!_!Ar!_#o!CW#o#p!Ar#p;'S!CW;'S;=`!Ds<%lO!CW<z!DvP;=`<%l!CW<z!EOX$i&jOY!=yYZ&cZ!^!=y!^!_!@c!_#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y<z!EnP;=`<%l!=y>^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!<n#Q#o!KS#o#p!JU#p;'S!KS;'S;=`!LV<%lO!KS>^!LYP;=`<%l!KS>^!L`P;=`<%l!<n=l!Ll`$i&j(Wp!X7`OY!LcYZ&cZr!Lcrs!=ys!P!Lc!P!Q!Mn!Q!^!Lc!^!_# o!_!}!Lc!}#O#%P#O#P!Dy#P#o!Lc#o#p# o#p;'S!Lc;'S;=`#&Y<%lO!Lc=l!Mwl$i&j(Wp!X7`OY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#W(r#W#X!Mn#X#Z(r#Z#[!Mn#[#](r#]#^!Mn#^#a(r#a#b!Mn#b#g(r#g#h!Mn#h#i(r#i#j!Mn#j#k!Mn#k#m(r#m#n!Mn#n#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(r8Q# vZ(Wp!X7`OY# oZr# ors!@cs!P# o!P!Q#!i!Q!}# o!}#O#$R#O#P!Bq#P;'S# o;'S;=`#$y<%lO# o8Q#!pe(Wp!X7`OY)rZr)rs#O)r#P#W)r#W#X#!i#X#Z)r#Z#[#!i#[#])r#]#^#!i#^#a)r#a#b#!i#b#g)r#g#h#!i#h#i)r#i#j#!i#j#k#!i#k#m)r#m#n#!i#n;'S)r;'S;=`*Z<%lO)r8Q#$WX(WpOY#$RZr#$Rrs!Ars#O#$R#O#P!B[#P#Q# o#Q;'S#$R;'S;=`#$s<%lO#$R8Q#$vP;=`<%l#$R8Q#$|P;=`<%l# o=l#%W^$i&j(WpOY#%PYZ&cZr#%Prs!CWs!^#%P!^!_#$R!_#O#%P#O#P!DR#P#Q!Lc#Q#o#%P#o#p#$R#p;'S#%P;'S;=`#&S<%lO#%P=l#&VP;=`<%l#%P=l#&]P;=`<%l!Lc?O#&kn$i&j(Wp(Z!b!X7`OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#W%Z#W#X#&`#X#Z%Z#Z#[#&`#[#]%Z#]#^#&`#^#a%Z#a#b#&`#b#g%Z#g#h#&`#h#i%Z#i#j#&`#j#k#&`#k#m%Z#m#n#&`#n#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z9d#(r](Wp(Z!b!X7`OY#(iZr#(irs!Grsw#(iwx# ox!P#(i!P!Q#)k!Q!}#(i!}#O#+`#O#P!Bq#P;'S#(i;'S;=`#,`<%lO#(i9d#)th(Wp(Z!b!X7`OY*gZr*grs'}sw*gwx)rx#O*g#P#W*g#W#X#)k#X#Z*g#Z#[#)k#[#]*g#]#^#)k#^#a*g#a#b#)k#b#g*g#g#h#)k#h#i*g#i#j#)k#j#k#)k#k#m*g#m#n#)k#n;'S*g;'S;=`+Z<%lO*g9d#+gZ(Wp(Z!bOY#+`Zr#+`rs!JUsw#+`wx#$Rx#O#+`#O#P!B[#P#Q#(i#Q;'S#+`;'S;=`#,Y<%lO#+`9d#,]P;=`<%l#+`9d#,cP;=`<%l#(i?O#,o`$i&j(Wp(Z!bOY#,fYZ&cZr#,frs!KSsw#,fwx#%Px!^#,f!^!_#+`!_#O#,f#O#P!DR#P#Q!;Z#Q#o#,f#o#p#+`#p;'S#,f;'S;=`#-q<%lO#,f?O#-tP;=`<%l#,f?O#-zP;=`<%l!;Z07[#.[b$i&j(Wp(Z!b(O0/l!X7`OY!;ZYZ&cZr!;Zrs!<nsw!;Zwx!Lcx!P!;Z!P!Q#&`!Q!^!;Z!^!_#(i!_!}!;Z!}#O#,f#O#P!Dy#P#o!;Z#o#p#(i#p;'S!;Z;'S;=`#-w<%lO!;Z07[#/o_$i&j(Wp(Z!bT0/lOY#/dYZ&cZr#/drs#0nsw#/dwx#4Ox!^#/d!^!_#5}!_#O#/d#O#P#1p#P#o#/d#o#p#5}#p;'S#/d;'S;=`#6|<%lO#/d06j#0w]$i&j(Z!bT0/lOY#0nYZ&cZw#0nwx#1px!^#0n!^!_#3R!_#O#0n#O#P#1p#P#o#0n#o#p#3R#p;'S#0n;'S;=`#3x<%lO#0n05W#1wX$i&jT0/lOY#1pYZ&cZ!^#1p!^!_#2d!_#o#1p#o#p#2d#p;'S#1p;'S;=`#2{<%lO#1p0/l#2iST0/lOY#2dZ;'S#2d;'S;=`#2u<%lO#2d0/l#2xP;=`<%l#2d05W#3OP;=`<%l#1p01O#3YW(Z!bT0/lOY#3RZw#3Rwx#2dx#O#3R#O#P#2d#P;'S#3R;'S;=`#3r<%lO#3R01O#3uP;=`<%l#3R06j#3{P;=`<%l#0n05x#4X]$i&j(WpT0/lOY#4OYZ&cZr#4Ors#1ps!^#4O!^!_#5Q!_#O#4O#O#P#1p#P#o#4O#o#p#5Q#p;'S#4O;'S;=`#5w<%lO#4O00^#5XW(WpT0/lOY#5QZr#5Qrs#2ds#O#5Q#O#P#2d#P;'S#5Q;'S;=`#5q<%lO#5Q00^#5tP;=`<%l#5Q05x#5zP;=`<%l#4O01p#6WY(Wp(Z!bT0/lOY#5}Zr#5}rs#3Rsw#5}wx#5Qx#O#5}#O#P#2d#P;'S#5};'S;=`#6v<%lO#5}01p#6yP;=`<%l#5}07[#7PP;=`<%l#/d)3h#7ab$i&j$Q(Ch(Wp(Z!b!X7`OY!;ZYZ&cZr!;Zrs!<nsw!;Zwx!Lcx!P!;Z!P!Q#&`!Q!^!;Z!^!_#(i!_!}!;Z!}#O#,f#O#P!Dy#P#o!;Z#o#p#(i#p;'S!;Z;'S;=`#-w<%lO!;ZAt#8vb$Z#t$i&j(Wp(Z!b!X7`OY!;ZYZ&cZr!;Zrs!<nsw!;Zwx!Lcx!P!;Z!P!Q#&`!Q!^!;Z!^!_#(i!_!}!;Z!}#O#,f#O#P!Dy#P#o!;Z#o#p#(i#p;'S!;Z;'S;=`#-w<%lO!;Z'Ad#:Zp$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!O%Z!O!P!3Y!P!Q%Z!Q![#<_![!^%Z!^!_*g!_!g%Z!g!h!4|!h#O%Z#O#P&c#P#R%Z#R#S#<_#S#U%Z#U#V#?i#V#X%Z#X#Y!4|#Y#b%Z#b#c#>_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#<jk$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!O%Z!O!P!3Y!P!Q%Z!Q![#<_![!^%Z!^!_*g!_!g%Z!g!h!4|!h#O%Z#O#P&c#P#R%Z#R#S#<_#S#X%Z#X#Y!4|#Y#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-<U(Wp(Z!b$n7`OY*gZr*grs'}sw*gwx)rx!P*g!P!Q#MO!Q!^*g!^!_#Mt!_!`$ f!`#O*g#P;'S*g;'S;=`+Z<%lO*g(n#MXX$k&j(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g(El#M}Z#r(Ch(Wp(Z!bOY*gZr*grs'}sw*gwx)rx!_*g!_!`#Np!`#O*g#P;'S*g;'S;=`+Z<%lO*g(El#NyX$Q(Ch(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g(El$ oX#s(Ch(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g*)x$!ga#`*!Y$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`!a$#l!a#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(K[$#w_#k(Cl$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x$%Vag!*r#s(Ch$f#|$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`$&[!`!a$'f!a#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW$&g_#s(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW$'qa#r(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Ka!`!a$(v!a#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW$)R`#r(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Ka!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(Kd$*`a(r(Ct$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!a%Z!a!b$+e!b#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW$+p`$i&j#{(Ch(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Ka!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`$,}_!|$Ip$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f$.X_!S0,v$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(n$/]Z$i&jO!^$0O!^!_$0f!_#i$0O#i#j$0k#j#l$0O#l#m$2^#m#o$0O#o#p$0f#p;'S$0O;'S;=`$4i<%lO$0O(n$0VT_#S$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c#S$0kO_#S(n$0p[$i&jO!Q&c!Q![$1f![!^&c!_!c&c!c!i$1f!i#T&c#T#Z$1f#Z#o&c#o#p$3|#p;'S&c;'S;=`&w<%lO&c(n$1kZ$i&jO!Q&c!Q![$2^![!^&c!_!c&c!c!i$2^!i#T&c#T#Z$2^#Z#o&c#p;'S&c;'S;=`&w<%lO&c(n$2cZ$i&jO!Q&c!Q![$3U![!^&c!_!c&c!c!i$3U!i#T&c#T#Z$3U#Z#o&c#p;'S&c;'S;=`&w<%lO&c(n$3ZZ$i&jO!Q&c!Q![$0O![!^&c!_!c&c!c!i$0O!i#T&c#T#Z$0O#Z#o&c#p;'S&c;'S;=`&w<%lO&c#S$4PR!Q![$4Y!c!i$4Y#T#Z$4Y#S$4]S!Q![$4Y!c!i$4Y#T#Z$4Y#q#r$0f(n$4lP;=`<%l$0O#1[$4z_!Y#)l$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW$6U`#x(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Ka!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z+;p$7c_$i&j(Wp(Z!b(a+4QOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$8qk$i&j(Wp(Z!b(T,2j$_#t(e$I[OY%ZYZ&cZr%Zrs&}st%Ztu$8buw%Zwx(rx}%Z}!O$:f!O!Q%Z!Q![$8b![!^%Z!^!_*g!_!c%Z!c!}$8b!}#O%Z#O#P&c#P#R%Z#R#S$8b#S#T%Z#T#o$8b#o#p*g#p$g%Z$g;'S$8b;'S;=`$<l<%lO$8b+d$:qk$i&j(Wp(Z!b$_#tOY%ZYZ&cZr%Zrs&}st%Ztu$:fuw%Zwx(rx}%Z}!O$:f!O!Q%Z!Q![$:f![!^%Z!^!_*g!_!c%Z!c!}$:f!}#O%Z#O#P&c#P#R%Z#R#S$:f#S#T%Z#T#o$:f#o#p*g#p$g%Z$g;'S$:f;'S;=`$<f<%lO$:f+d$<iP;=`<%l$:f07[$<oP;=`<%l$8b#Jf$<{X!_#Hb(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g,#x$=sa(y+JY$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Ka!`#O%Z#O#P&c#P#o%Z#o#p*g#p#q$+e#q;'S%Z;'S;=`+a<%lO%Z)>v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[yv,bv,xv,Cv,2,3,4,5,6,7,8,9,10,11,12,13,14,vv,new O_("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new O_(`j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~`,25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:e=>Tv[e]||-1},{term:343,get:e=>Ev[e]||-1},{term:95,get:e=>Dv[e]||-1}],tokenPrec:15201}),kv=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=up(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(Iv(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Av(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function jv(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=Av(t)+Av(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function Mv(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:jv(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function Nv(e,t){return n=>{for(let t=up(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var Pv=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function Fv(e){return e.selection.main.from}function Iv(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var Lv=Fr.define();function Rv(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:K.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var zv=new WeakMap;function Bv(e){if(!Array.isArray(e))return e;let t=zv.get(e);return t||zv.set(e,t=Mv(e)),t}var Vv=Rr.define(),Hv=Rr.define(),Uv=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Yn(e,t),r=Zn(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(Yn(a==i?i.toLowerCase():a,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:a}=this;if(t.length==1){let r=Yn(e,0),i=Zn(r),a=i==e.length?0:-100;if(r!=t[0])if(r==n[0])a+=-200;else return null;return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=Yn(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=Zn(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,m=-1,h=/[a-z]/.test(e),g=!0;for(let r=0,c=Math.min(e.length,200),_=0;r<c&&u<s;){let c=Yn(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),m=r+1,f++):f=0));let v,y=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(v=Xn(c))==v.toLowerCase()?v==v.toUpperCase()?0:2:1;(!r||y==1&&h||_==0&&y!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(g=!1)),_=y,r+=Zn(c)}return u==s&&a[0]==0&&g?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,m]):u==s?this.result(-100+(d?-200:0)+-700+(g?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?Zn(Yn(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},Wv=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},Gv=q.define({combine(e){return ei(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:qv,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Kv(e(n),t(n)),optionClass:(e,t)=>n=>Kv(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Kv(e,t){return e?t?e+` `+t:e:t}function qv(e,t,n,r,i,a){let o=e.textDirection==Ia.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var Jv=Rr.define();function Yv(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function Xv(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var Zv=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(Gv);this.optionContent=Yv(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Xv(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:Jv.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(Gv).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:Hv.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=Xv(r.length,i,e.state.facet(Gv).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Xv(t.options.length,t.selected,this.view.state.facet(Gv).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>xo(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&$v(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(Gv).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0))if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function Qv(e,t){return n=>new Zv(n,e,t)}function $v(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function ey(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function ty(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(Gv);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new Pv(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new Wv(n):new Uv(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new Pv(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):ey(e.completion)>ey(c)&&(s[s.length-1]=e),c=e.completion}return s}var ny=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,sy(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=ty(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(Gv).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,sy(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:gy,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},ry=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(cy,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Gv),i=(r.override||n.languageDataAt(`autocomplete`,Fv(n)).map(Bv)).map(e=>(this.active.find(t=>t.source==e)||new uy(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(py));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!iy(i,this.active)||o?a=ny.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new uy(e.source,0):e));for(let e of t.effects)e.is(Jv)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?ay:oy}};function iy(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var ay={"aria-autocomplete":`list`},oy={};function sy(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var cy=[];function ly(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(Lv);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var uy=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=ly(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(Vv))i=new e(i.source,1,n.value);else if(n.is(Hv))i=new e(i.source,0);else if(n.is(py))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Fv(e.state))}},dy=class e extends uy{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=Fv(t.state);if(o>a||!r||n&2&&(Fv(t.startState)==this.from||o<this.limit))return new uy(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return fy(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new kv(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??Fv(t.state)):new uy(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new e(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new uy(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function fy(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):Iv(e,!0).test(i)}var py=Rr.define({map(e,t){return e.map(e=>e.map(t))}}),my=_r.define({create(){return ry.start()},update(e,t){return e.update(t)},provide:e=>[Ru.from(e,e=>e.tooltip),Y.contentAttributes.from(e,e=>e.attrs)]});function hy(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(my).active.find(e=>e.source==t.source);return r instanceof dy?(typeof n==`string`?e.dispatch({...Rv(e.state,n,r.from,r.to),annotations:Lv.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}var gy=Qv(my,hy);function _y(e,t=`option`){return n=>{let r=n.state.field(my,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Gv).interactionDelay)return!1;let i=1,a;t==`page`&&(a=Yu(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:Jv.of(s)}),!0}}var vy=e=>{let t=e.state.field(my,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Gv).interactionDelay?!1:hy(e,t.open.options[t.open.selected])},yy=e=>e.state.field(my,!1)?(e.dispatch({effects:Vv.of(!0)}),!0):!1,by=e=>{let t=e.state.field(my,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:Hv.of(null)}),!0)},xy=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},Sy=50,Cy=1e3,wy=To.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(my).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(my),n=e.state.facet(Gv);if(!e.selectionSet&&!e.docChanged&&e.startState.field(my)==t)return;let r=e.transactions.some(e=>{let t=ly(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>Sy&&Date.now()-n.time>Cy){for(let e of n.context.abortListeners)try{e()}catch(e){xo(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(Vv)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(my);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Gv).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new kv(t,Fv(t),e.explicit,this.view),r=new xy(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:Hv.of(null)}),xo(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Gv).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Gv),n=this.view.state.field(my);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=Fv(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new dy(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending)if(i.done==null){let n=new uy(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:py.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(my,!1);if(t&&t.tooltip&&this.view.state.facet(Gv).closeOnBlur){let n=t.open&&Yu(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Hv.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Vv.of(!1)}),20),this.composing=0}}}),Ty=typeof navigator==`object`&&/Win/.test(navigator.platform),Ey=br.highest(Y.domEventHandlers({keydown(e,t){let n=t.state.field(my,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Ty&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&hy(t,r),!1}})),Dy=Y.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),Oy=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},ky=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,$n.TrackDel),r=t.mapPos(this.to,1,$n.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},Ay=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(Sp);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new ky(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1,c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new Oy(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},jy=na.widget({widget:new class extends ea{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),My=na.mark({class:`cm-snippetField`}),Ny=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=na.set(e.map(e=>(e.from==e.to?jy:My).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},Py=Rr.define({map(e,t){return e&&e.map(t)}}),Fy=Rr.define(),Iy=_r.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Py))return n.value;if(n.is(Fy)&&e)return new Ny(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>Y.decorations.from(e,e=>e?e.deco:na.none)});function Ly(e,t){return K.create(e.filter(e=>e.field==t).map(e=>K.range(e.from,e.to)))}function Ry(e){let t=Ay.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:s}=e.state.selection,c={changes:{from:r,to:i==s.from?s.to:i,insert:Fn.of(a)},scrollIntoView:!0,annotations:n?[Lv.of(n),zr.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=Ly(o,0)),o.some(e=>e.field>0)){let t=new Ny(o,0),n=c.effects=[Py.of(t)];e.state.field(Iy,!1)===void 0&&n.push(Rr.appendConfig.of([Iy,Hy,Wy,Dy]))}e.dispatch(e.state.update(c))}}function zy(e){return({state:t,dispatch:n})=>{let r=t.field(Iy,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:Ly(r.ranges,i),effects:Py.of(a?null:new Ny(r.ranges,i)),scrollIntoView:!0})),!0}}var By=[{key:`Tab`,run:zy(1),shift:zy(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(Iy,!1)?(t(e.update({effects:Py.of(null)})),!0):!1}],Vy=q.define({combine(e){return e.length?e[0]:By}}),Hy=br.highest(Vl.compute([Vy],e=>e.facet(Vy)));function Uy(e,t){return{...t,apply:Ry(e)}}var Wy=Y.domEventHandlers({mousedown(e,t){let n=t.state.field(Iy,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:Ly(n.ranges,i.field),effects:Py.of(n.ranges.some(e=>e.field>i.field)?new Ny(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),Gy={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},Ky=Rr.define({map(e,t){return t.mapPos(e,-1,$n.TrackAfter)??void 0}}),qy=new class extends ti{};qy.startSide=1,qy.endSide=-1;var Jy=_r.define({create(){return oi.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(Ky)&&(e=e.update({add:[qy.range(n.value,n.value+1)]}));return e}});function Yy(){return[eb,Jy]}var Xy=`()[]{}<>«»»«[]{}`;function Zy(e){for(let t=0;t<16;t+=2)if(Xy.charCodeAt(t)==e)return Xy.charAt(t+1);return Xn(e<128?e:e+1)}function Qy(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||Gy}var $y=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),eb=Y.inputHandler.of((e,t,n,r)=>{if(($y?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&Zn(Yn(r,0))==1||t!=i.from||n!=i.to)return!1;let a=nb(e.state,r);return a?(e.dispatch(a),!0):!1}),tb=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Qy(e,e.selection.main.head).brackets||Gy.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=ab(e.doc,t.head);for(let i of n)if(i==r&&ib(e.doc,t.head)==Zy(Yn(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:K.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function nb(e,t){let n=Qy(e,e.selection.main.head),r=n.brackets||Gy.brackets;for(let i of r){let a=Zy(Yn(i,0));if(t==i)return a==i?cb(e,i,r.indexOf(i+i+i)>-1,n):ob(e,i,a,n.before||Gy.before);if(t==a&&rb(e,e.selection.main.from))return sb(e,i,a)}return null}function rb(e,t){let n=!1;return e.field(Jy).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function ib(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Zn(Yn(n,0)))}function ab(e,t){let n=e.sliceString(t-2,t);return Zn(Yn(n,0))==n.length?n:n.slice(1)}function ob(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:Ky.of(a.to+t.length),range:K.range(a.anchor+t.length,a.head+t.length)};let o=ib(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:Ky.of(a.head+t.length),range:K.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function sb(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&ib(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:K.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function cb(e,t,n,r){let i=r.stringPrefixes||Gy.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:Ky.of(r.to+t.length),range:K.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=ib(e.doc,o),c;if(s==t){if(lb(e,o))return{changes:{insert:t+t,from:o},effects:Ky.of(o+t.length),range:K.cursor(o+t.length)};if(rb(e,o)){let r=n&&e.sliceDoc(o,o+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:K.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=db(e,o-2*t.length,i))>-1&&lb(e,c))return{changes:{insert:t+t+t+t,from:o},effects:Ky.of(o+t.length),range:K.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=Jr.Word&&db(e,o,i)>-1&&!ub(e,o,t,i))return{changes:{insert:t+t,from:o},effects:Ky.of(o+t.length),range:K.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function lb(e,t){let n=up(e).resolveInner(t+1);return n.parent&&n.from==t}function ub(e,t,n,r){let i=up(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function db(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=Jr.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=Jr.Word)return n}return-1}function fb(e={}){return[Ey,my,Gv.of(e),wy,mb,Dy]}var pb=[{key:`Ctrl-Space`,run:yy},{mac:"Alt-`",run:yy},{mac:`Alt-i`,run:yy},{key:`Escape`,run:by},{key:`ArrowDown`,run:_y(!0)},{key:`ArrowUp`,run:_y(!1)},{key:`PageDown`,run:_y(!0,`page`)},{key:`PageUp`,run:_y(!1,`page`)},{key:`Enter`,run:vy}],mb=br.highest(Vl.computeN([Gv],e=>e.facet(Gv).defaultKeymap?[pb]:[])),hb=[Uy("function ${name}(${params}) {\n ${}\n}",{label:`function`,detail:`definition`,type:`keyword`}),Uy("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:`for`,detail:`loop`,type:`keyword`}),Uy("for (let ${name} of ${collection}) {\n ${}\n}",{label:`for`,detail:`of loop`,type:`keyword`}),Uy(`do {
|
|
721
|
-
\${}
|
|
722
|
-
} while (\${})`,{label:`do`,detail:`loop`,type:`keyword`}),Uy(`while (\${}) {
|
|
723
|
-
\${}
|
|
724
|
-
}`,{label:`while`,detail:`loop`,type:`keyword`}),Uy(`try {
|
|
725
|
-
\${}
|
|
726
|
-
} catch (\${error}) {
|
|
727
|
-
\${}
|
|
728
|
-
}`,{label:`try`,detail:`/ catch block`,type:`keyword`}),Uy(`if (\${}) {
|
|
729
|
-
\${}
|
|
730
|
-
}`,{label:`if`,detail:`block`,type:`keyword`}),Uy(`if (\${}) {
|
|
731
|
-
\${}
|
|
732
|
-
} else {
|
|
733
|
-
\${}
|
|
734
|
-
}`,{label:`if`,detail:`/ else block`,type:`keyword`}),Uy(`class \${name} {
|
|
735
|
-
constructor(\${params}) {
|
|
736
|
-
\${}
|
|
737
|
-
}
|
|
738
|
-
}`,{label:`class`,detail:`definition`,type:`keyword`}),Uy('import {${names}} from "${module}"\n${}',{label:`import`,detail:`named`,type:`keyword`}),Uy('import ${name} from "${module}"\n${}',{label:`import`,detail:`default`,type:`keyword`})],gb=hb.concat([Uy(`interface \${name} {
|
|
739
|
-
\${}
|
|
740
|
-
}`,{label:`interface`,detail:`definition`,type:`keyword`}),Uy("type ${name} = ${type}",{label:`type`,detail:`definition`,type:`keyword`}),Uy(`enum \${name} {
|
|
741
|
-
\${}
|
|
742
|
-
}`,{label:`enum`,detail:`definition`,type:`keyword`})]),_b=new ff,vb=new Set([`Script`,`Block`,`FunctionExpression`,`FunctionDeclaration`,`ArrowFunction`,`MethodDeclaration`,`ForStatement`]);function yb(e){return(t,n)=>{let r=t.node.getChild(`VariableDefinition`);return r&&n(r,e),!0}}var bb=[`FunctionDeclaration`],xb={FunctionDeclaration:yb(`function`),ClassDeclaration:yb(`class`),ClassExpression:()=>!0,EnumDeclaration:yb(`constant`),TypeAliasDeclaration:yb(`type`),NamespaceDeclaration:yb(`namespace`),VariableDefinition(e,t){e.matchContext(bb)||t(e,`variable`)},TypeDefinition(e,t){t(e,`type`)},__proto__:null};function Sb(e,t){let n=_b.get(t);if(n)return n;let r=[],i=!0;function a(t,n){let i=e.sliceString(t.from,t.to);r.push({label:i,type:n})}return t.cursor(Wd.IncludeAnonymous).iterate(t=>{if(i)i=!1;else if(t.name){let e=xb[t.name];if(e&&e(t,a)||vb.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of Sb(e,t.node))r.push(n);return!1}}),_b.set(t,r),r}var Cb=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,wb=[`TemplateString`,`String`,`RegExp`,`LineComment`,`BlockComment`,`VariableDefinition`,`TypeDefinition`,`Label`,`PropertyDefinition`,`PropertyName`,`PrivatePropertyDefinition`,`PrivatePropertyName`,`JSXText`,`JSXAttributeValue`,`JSXOpenTag`,`JSXCloseTag`,`JSXSelfClosingTag`,`.`,`?.`];function Tb(e){let t=up(e.state).resolveInner(e.pos,-1);if(wb.indexOf(t.name)>-1)return null;let n=t.name==`VariableName`||t.to-t.from<20&&Cb.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let n=t;n;n=n.parent)vb.has(n.name)&&(r=r.concat(Sb(e.state.doc,n)));return{options:r,from:n?t.from:e.pos,validFor:Cb}}var Eb=lp.define({name:`javascript`,parser:Ov.configure({props:[Dp.add({IfStatement:zp({except:/^\s*({|else\b)/}),TryStatement:zp({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Rp,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:Ip({closing:`}`}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":zp({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Up.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Wp,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name==`JSXSelfClosingTag`)return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){let t=e.firstChild?.nextSibling,n=e.lastChild;return!t||t.type.isError?null:{from:t.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]},commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:`$`}}),Db={test:e=>/^JSX/.test(e.name),facet:ap({commentTokens:{block:{open:`{/*`,close:`*/}`}}})},Ob=Eb.configure({dialect:`ts`},`typescript`),kb=Eb.configure({dialect:`jsx`,props:[op.add(e=>e.isTop?[Db]:void 0)]}),Ab=Eb.configure({dialect:`jsx ts`,props:[op.add(e=>e.isTop?[Db]:void 0)]},`typescript`),jb=e=>({label:e,type:`keyword`}),Mb=`break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield`.split(` `).map(jb),Nb=Mb.concat([`declare`,`implements`,`private`,`protected`,`public`].map(jb));function Pb(e={}){let t=e.jsx?e.typescript?Ab:kb:e.typescript?Ob:Eb,n=e.typescript?gb.concat(Nb):hb.concat(Mb);return new bp(t,[Eb.data.of({autocomplete:Nv(wb,Mv(n))}),Eb.data.of({autocomplete:Tb}),e.jsx?Rb:[]])}function Fb(e){for(;;){if(e.name==`JSXOpenTag`||e.name==`JSXSelfClosingTag`||e.name==`JSXFragmentTag`)return e;if(e.name==`JSXEscape`||!e.parent)return null;e=e.parent}}function Ib(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name==`JSXIdentifier`||r.name==`JSXBuiltin`||r.name==`JSXNamespacedName`||r.name==`JSXMemberExpression`)return e.sliceString(r.from,Math.min(r.to,n));return``}var Lb=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),Rb=Y.inputHandler.of((e,t,n,r,i)=>{if((Lb?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!Eb.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let{head:t}=e,n=up(o).resolveInner(t-1,-1),i;if(n.name==`JSXStartTag`&&(n=n.parent),!(o.doc.sliceString(t-1,t)!=r||n.name==`JSXAttributeValue`&&n.to>t)){if(r==`>`&&n.name==`JSXFragmentTag`)return{range:e,changes:{from:t,insert:`</>`}};if(r==`/`&&n.name==`JSXStartCloseTag`){let e=n.parent,r=e.parent;if(r&&e.from==t-2&&((i=Ib(o.doc,r.firstChild,t))||r.firstChild?.name==`JSXFragmentTag`)){let e=`${i}>`;return{range:K.cursor(t+e.length,-1),changes:{from:t,insert:e}}}}else if(r==`>`){let r=Fb(n);if(r&&r.name==`JSXOpenTag`&&!/^\/?>|^<\//.test(o.doc.sliceString(t,t+2))&&(i=Ib(o.doc,r,t)))return{range:e,changes:{from:t,insert:`</${i}>`}}}}return{range:e}});return s.changes.empty?!1:(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),zb=55,Bb=1,Vb=56,Hb=2,Ub=57,Wb=3,Gb=4,Kb=5,qb=6,Jb=7,Yb=8,Xb=9,Zb=10,Qb=11,$b=12,ex=13,tx=58,nx=14,rx=15,ix=59,ax=21,ox=23,sx=24,cx=25,lx=27,ux=28,dx=29,fx=32,px=35,mx=37,hx=38,gx=0,_x=1,vx={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},yx={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},bx={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function xx(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}var Sx=null,Cx=null,wx=0;function Tx(e,t){let n=e.pos+t;if(wx==n&&Cx==e)return Sx;let r=e.peek(t),i=``;for(;xx(r);)i+=String.fromCharCode(r),r=e.peek(++t);return Cx=e,wx=n,Sx=i?i.toLowerCase():r==kx||r==Ax?void 0:null}var Ex=60,Dx=62,Ox=47,kx=63,Ax=33,jx=45;function Mx(e,t){this.name=e,this.parent=t}var Nx=[qb,Zb,Jb,Yb,Xb],Px=new H_({start:null,shift(e,t,n,r){return Nx.indexOf(t)>-1?new Mx(Tx(r,1)||``,e):e},reduce(e,t){return t==ax&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==qb||i==mx?new Mx(Tx(r,1)||``,e):e},strict:!1}),Fx=new k_((e,t)=>{if(e.next!=Ex){e.next<0&&t.context&&e.acceptToken(tx);return}e.advance();let n=e.next==Ox;n&&e.advance();let r=Tx(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?rx:nx);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(Qb);if(i&&yx[i])return e.acceptToken(tx,-2);if(t.dialectEnabled(gx))return e.acceptToken($b);for(let e=t.context;e;e=e.parent)if(e.name==r)return;e.acceptToken(ex)}else{if(r==`script`)return e.acceptToken(Jb);if(r==`style`)return e.acceptToken(Yb);if(r==`textarea`)return e.acceptToken(Xb);if(vx.hasOwnProperty(r))return e.acceptToken(Zb);i&&bx[i]&&bx[i][r]?e.acceptToken(tx,-1):e.acceptToken(qb)}},{contextual:!0}),Ix=new k_(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(ix);break}if(e.next==jx)t++;else if(e.next==Dx&&t>=2){n>=3&&e.acceptToken(ix,-2);break}else t=0;e.advance()}});function Lx(e){for(;e;e=e.parent)if(e.name==`svg`||e.name==`math`)return!0;return!1}var Rx=new k_((e,t)=>{if(e.next==Ox&&e.peek(1)==Dx){let n=t.dialectEnabled(_x)||Lx(t.context);e.acceptToken(n?Kb:Gb,2)}else e.next==Dx&&e.acceptToken(Gb,1)});function zx(e,t,n){let r=2+e.length;return new k_(i=>{for(let a=0,o=0,s=0;;s++){if(i.next<0){s&&i.acceptToken(t);break}if(a==0&&i.next==Ex||a==1&&i.next==Ox||a>=2&&a<r&&i.next==e.charCodeAt(a-2))a++,o++;else if(a==r&&i.next==Dx){s>o?i.acceptToken(t,-o):i.acceptToken(n,-(o-2));break}else if((i.next==10||i.next==13)&&s){i.acceptToken(t,1);break}else a=o=0;i.advance()}})}var Bx=zx(`script`,zb,Bb),Vx=zx(`style`,Vb,Hb),Hx=zx(`textarea`,Ub,Wb),Ux=If({"Text RawText IncompleteTag IncompleteCloseTag":Z.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Z.angleBracket,TagName:Z.tagName,"MismatchedCloseTag/TagName":[Z.tagName,Z.invalid],AttributeName:Z.attributeName,"AttributeValue UnquotedAttributeValue":Z.attributeValue,Is:Z.definitionOperator,"EntityReference CharacterReference":Z.character,Comment:Z.blockComment,ProcessingInst:Z.processingInstruction,DoctypeDecl:Z.documentMeta}),Wx=U_.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:`,c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~`,goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:`⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl`,maxTerm:68,context:Px,nodeProps:[[`closedBy`,-10,1,2,3,7,8,9,10,11,12,13,`EndTag`,6,`EndTag SelfClosingEndTag`,-4,22,31,34,37,`CloseTag`],[`openedBy`,4,`StartTag StartCloseTag`,5,`StartTag`,-4,30,33,36,38,`OpenTag`],[`group`,-10,14,15,18,19,20,21,40,41,42,43,`Entity`,17,`Entity TextContent`,-3,29,32,35,`TextContent Entity`],[`isolate`,-11,22,30,31,33,34,36,37,38,39,42,43,`ltr`,-3,27,28,40,``]],propSources:[Ux],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4U-_4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!Z$|caPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bXaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UVaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pTaPOv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!dpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&}a({WaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t`)jT!b`Or)esv)ew;'S)e;'S;=`)y<%lO)e`)|P;=`<%l)ea*SP;=`<%l(t!Q*^V!b`!dpOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!Q*vP;=`<%l*V!R*|P;=`<%l&XW+UYlWOX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+PW+wP;=`<%l+P!Z+}P;=`<%l$q!a,]`aP!b`!dp!_^OX&XXY,QYZ,QZ]&X]^,Q^p&Xpq,Qqr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!_-ljiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q[/ebiSlWOX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+PS0rXiSqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0mS1bP;=`<%l0m[1hP;=`<%l/^!V1vciSaP!b`!dpOq&Xqr1krs&}sv1kvw0mwx(tx!P1k!P!Q&X!Q!^1k!^!_*V!_!a&X!a#s1k#s$f&X$f;'S1k;'S;=`3R<%l?Ah1k?Ah?BY&X?BY?Mn1k?MnO&X!V3UP;=`<%l1k!_3[P;=`<%l-_!Z3hV!ahaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}!_4WiiSlWd!ROX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst>]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!V<QciSOp7Sqr;{rs7Sst0mtw;{wx7Sx!P;{!P!Q7S!Q!];{!]!^=]!^!a7S!a#s;{#s$f7S$f;'S;{;'S;=`>P<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[Bx,Vx,Hx,Rx,Fx,Ix,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517});function Gx(e,t){let n=Object.create(null);for(let r of e.getChildren(sx)){let e=r.getChild(cx),i=r.getChild(lx)||r.getChild(ux);e&&(n[t.read(e.from,e.to)]=i?i.type.id==lx?t.read(i.from+1,i.to-1):t.read(i.from,i.to):``)}return n}function Kx(e,t){let n=e.getChild(ox);return n?t.read(n.from,n.to):` `}function qx(e,t,n){let r;for(let i of n)if(!i.attrs||i.attrs(r||=Gx(e.node.parent.firstChild,t)))return{parser:i.parser,bracketed:!0};return null}function Jx(e=[],t=[]){let n=[],r=[],i=[],a=[];for(let t of e)(t.tag==`script`?n:t.tag==`style`?r:t.tag==`textarea`?i:a).push(t);let o=t.length?Object.create(null):null;for(let e of t)(o[e.name]||(o[e.name]=[])).push(e);return gf((e,t)=>{let s=e.type.id;if(s==dx)return qx(e,t,n);if(s==fx)return qx(e,t,r);if(s==px)return qx(e,t,i);if(s==ax&&a.length){let n=e.node,r=n.firstChild,i=r&&Kx(r,t),o;if(i){for(let e of a)if(e.tag==i&&(!e.attrs||e.attrs(o||=Gx(r,t)))){let t=n.lastChild,i=t.type.id==hx?t.from:n.to;if(i>r.to)return{parser:e.parser,overlay:[{from:r.to,to:i}]}}}}if(o&&s==sx){let n=e.node,r;if(r=n.firstChild){let e=o[t.read(r.from,r.to)];if(e)for(let r of e){if(r.tagName&&r.tagName!=Kx(n.parent,t))continue;let e=n.lastChild;if(e.type.id==lx){let t=e.from+1,n=e.lastChild,i=e.to-(n&&n.isError?0:1);if(i>t)return{parser:r.parser,overlay:[{from:t,to:i}],bracketed:!0}}else if(e.type.id==ux)return{parser:r.parser,overlay:[{from:e.from,to:e.to}]}}}}return null})}var Yx=135,Xx=1,Zx=136,Qx=137,$x=2,eS=138,tS=3,nS=4,rS=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],iS=58,aS=40,oS=95,sS=91,cS=45,lS=46,uS=35,dS=37,fS=38,pS=92,mS=10,hS=42;function gS(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function _S(e){return e>=48&&e<=57}function vS(e){return _S(e)||e>=97&&e<=102||e>=65&&e<=70}var yS=(e,t,n)=>(r,i)=>{for(let a=!1,o=0,s=0;;s++){let{next:c}=r;if(gS(c)||c==cS||c==oS||a&&_S(c))!a&&(c!=cS||s>0)&&(a=!0),o===s&&c==cS&&o++,r.advance();else if(c==pS&&r.peek(1)!=mS){if(r.advance(),vS(r.next)){do r.advance();while(vS(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();a=!0}else{a&&r.acceptToken(o==2&&i.canShift($x)?t:c==aS?n:e);break}}},bS=new k_(yS(Zx,$x,Qx),{contextual:!0}),xS=new k_(yS(eS,tS,nS),{contextual:!0}),SS=new k_(e=>{if(rS.includes(e.peek(-1))){let{next:t}=e;(gS(t)||t==oS||t==uS||t==lS||t==hS||t==sS||t==iS&&gS(e.peek(1))||t==cS||t==fS)&&e.acceptToken(Yx)}}),CS=new k_(e=>{if(!rS.includes(e.peek(-1))){let{next:t}=e;if(t==dS&&(e.advance(),e.acceptToken(Xx)),gS(t)){do e.advance();while(gS(e.next)||_S(e.next));e.acceptToken(Xx)}}}),wS=If({"AtKeyword import charset namespace keyframes media supports font-feature-values":Z.definitionKeyword,"from to selector scope MatchFlag":Z.keyword,NamespaceName:Z.namespace,KeyframeName:Z.labelName,KeyframeRangeName:Z.operatorKeyword,TagName:Z.tagName,ClassName:Z.className,PseudoClassName:Z.constant(Z.className),IdName:Z.labelName,"FeatureName PropertyName":Z.propertyName,AttributeName:Z.attributeName,NumberLiteral:Z.number,KeywordQuery:Z.keyword,UnaryQueryOp:Z.operatorKeyword,"CallTag ValueName FontName":Z.atom,VariableName:Z.variableName,Callee:Z.operatorKeyword,Unit:Z.unit,"UniversalSelector NestingSelector":Z.definitionOperator,"MatchOp CompareOp":Z.compareOperator,"ChildOp SiblingOp, LogicOp":Z.logicOperator,BinOp:Z.arithmeticOperator,Important:Z.modifier,Comment:Z.blockComment,ColorLiteral:Z.color,"ParenthesizedContent StringLiteral":Z.string,":":Z.punctuation,"PseudoOp #":Z.derefOperator,"; , |":Z.separator,"( )":Z.paren,"[ ]":Z.squareBracket,"{ }":Z.brace}),TS={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:132,"url-prefix":132,domain:132,regexp:132},ES={__proto__:null,or:104,and:104,not:112,only:112,layer:186},DS={__proto__:null,selector:118,layer:182},OS={__proto__:null,"@import":178,"@media":190,"@charset":194,"@namespace":198,"@keyframes":204,"@supports":216,"@scope":220,"@font-feature-values":226},kS={__proto__:null,to:223},AS=U_.deserialize({version:14,states:"IpQYQdOOO#}QdOOP$UO`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q`O'#CgO%aQaO'#FdO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#DtO'dQdO'#DvO'oQdO'#D}O'oQdO'#EQOOQP'#Fd'#FdO)OQhO'#EsOOQS'#Fc'#FcOOQS'#Ev'#EvQYQdOOO)VQdO'#EWO*cQhO'#E^O)VQdO'#E`O*jQdO'#EbO*uQdO'#EeO)zQhO'#EkO*}QdO'#EmO+YQdO'#EpO+_QaO'#CfO+fQ`O'#ETO+kQ`O'#FnO+vQdO'#FnQOQ`OOP,QO&jO'#CaPOOO)CAR)CAROOQP'#Ci'#CiOOQP,59R,59RO%VQdO,59ROOQP'#Cm'#CmOOQP,59V,59VO&XQdO,59VO,]QdO,59YO'_QdO,5:`O'dQdO,5:bO'oQdO,5:iO'oQdO,5:kO'oQdO,5:lO'oQdO'#E}O,hQ`O,58}O,pQdO'#ESOOQS,58},58}OOQP'#Cq'#CqOOQO'#Dr'#DrOOQP,59Y,59YO,wQ`O,59YO,|Q`O,59YOOQP'#Du'#DuOOQP,5:`,5:`O-RQpO'#DwO-^QdO'#DxO-cQ`O'#DxO-hQpO,5:bO.RQaO,5:iO.iQaO,5:lOOQW'#D^'#D^O/eQhO'#DgO/xQhO,5;_O)zQhO'#DeO0VQ`O'#DkO0[QhO'#DnOOQW'#Fj'#FjOOQS,5;_,5;_O0aQ`O'#DhOOQS-E8t-E8tOOQ['#Cv'#CvO0fQdO'#CwO0|QdO'#C}O1dQdO'#DQO1zQ!pO'#DSO4TQ!jO,5:rOOQO'#DX'#DXO,|Q`O'#DWO4eQ!nO'#FgO6hQ`O'#DYO6mQ`O'#DoOOQ['#Fg'#FgO6rQhO'#FqO7QQ`O,5:xO7VQ!bO,5:zOOQS'#Ed'#EdO7_Q`O,5:|O7dQdO,5:|OOQO'#Eg'#EgO7lQ`O,5;PO7qQhO,5;VO'oQdO'#DjOOQS,5;X,5;XO0aQ`O,5;XO7yQdO,5;XOOQS'#FU'#FUO8RQdO'#ErO7QQ`O,5;[O8ZQdO,5:oO8kQdO'#FPO8xQ`O,5<YO8xQ`O,5<YPOOO'#Eu'#EuP9TO&jO,58{POOO,58{,58{OOQP1G.m1G.mOOQP1G.q1G.qOOQP1G.t1G.tO,wQ`O1G.tO,|Q`O1G.tOOQP1G/z1G/zO9`QpO1G/|O9hQaO1G0TO:OQaO1G0VO:fQaO1G0WO:|QaO,5;iOOQO-E8{-E8{OOQS1G.i1G.iO;WQ`O,5:nO;]QdO'#DsO;dQdO'#CuOOQO'#Dz'#DzOOQO,5:d,5:dO-^QdO,5:dOOQP1G/|1G/|O)VQdO1G/|O;kQ!jO'#D^O;yQ!bO,59yO<RQhO,5:ROOQO'#Fk'#FkO;|Q!bO,59}O<ZQhO'#FVO)zQhO,59{O)zQhO'#FVO=OQhO1G0yOOQS1G0y1G0yO=YQhO,5:PO>QQhO'#DlOOQW,5:V,5:VOOQW,5:Y,5:YOOQW,5:S,5:SO>[Q!fO'#FhOOQS'#Fh'#FhOOQS'#Ex'#ExO?lQdO,59cOOQ[,59c,59cO@SQdO,59iOOQ[,59i,59iO@jQdO,59lOOQ[,59l,59lOOQ[,59n,59nO)VQdO,59pOAQQhO'#EYOOQW'#EY'#EYOAlQ`O1G0^O4^QhO1G0^OOQ[,59r,59rO)zQhO'#D[OOQ[,59t,59tOAqQ#tO,5:ZOA|QhO'#FROBZQ`O,5<]OOQS1G0d1G0dOOQS1G0f1G0fOOQS1G0h1G0hOBfQ`O1G0hOBkQdO'#EhOOQS1G0k1G0kOOQS1G0q1G0qOBvQaO,5:UO7QQ`O1G0sOOQS1G0s1G0sO0aQ`O1G0sOOQS-E9S-E9SOOQS1G0v1G0vOB}Q!fO1G0ZOCeQ`O'#EVOOQO1G0Z1G0ZOOQO,5;k,5;kOCjQdO,5;kOOQO-E8}-E8}OCwQ`O1G1tPOOO-E8s-E8sPOOO1G.g1G.gOOQP7+$`7+$`OOQP7+%h7+%hO)VQdO7+%hOOQS1G0Y1G0YODSQaO'#FmOD^Q`O,5:_ODcQ!fO'#EwOEaQdO'#FfOEkQ`O,59aOOQO1G0O1G0OOEpQ!bO7+%hO)VQdO1G/eOE{QhO1G/iOOQW1G/m1G/mOOQW1G/g1G/gOF^QhO,5;qOOQW-E9T-E9TOOQS7+&e7+&eOGRQhO'#D^OGaQhO'#FlOGlQ`O'#FlOGqQ`O,5:WOOQS-E8v-E8vOOQ[1G.}1G.}OOQ[1G/T1G/TOOQ[1G/W1G/WOOQ[1G/[1G/[OGvQdO,5:tOOQS7+%x7+%xOG{Q`O7+%xOHQQhO'#D]OHYQ`O,59vO)zQhO,59vOOQ[1G/u1G/uOHbQ`O1G/uOHgQhO,5;mOOQO-E9P-E9POOQS7+&S7+&SOHuQbO'#DSOOQO'#Ej'#EjOITQ`O'#EiOOQO'#Ei'#EiOI`Q`O'#FSOIhQdO,5;SOOQS,5;S,5;SOOQ[1G/p1G/pOOQS7+&_7+&_O7QQ`O7+&_OIsQ!fO'#FOO)VQdO'#FOOJzQdO7+%uOOQO7+%u7+%uOOQO,5:q,5:qOOQO1G1V1G1VOK_Q!bO<<ISOKjQdO'#E|OKtQ`O,5<XOOQP1G/y1G/yOOQS-E8u-E8uOK|QdO'#E{OLWQ`O,5<QOOQ]1G.{1G.{OOQP<<IS<<ISOL`Q`O<<ISOLeQdO7+%POOQO'#D`'#D`OLlQ!bO7+%TOLtQhO'#EzOMRQ`O,5<WO)VQdO,5<WOOQW1G/r1G/rOOQO'#E['#E[OMZQ`O1G0`OOQS<<Id<<IdO)VQdO,59wOMzQhO1G/bOOQ[1G/b1G/bONRQ`O1G/bOOQW-E8w-E8wOOQ[7+%a7+%aOOQO,5;T,5;TOBnQdO'#FTOI`Q`O,5;nOOQS,5;n,5;nOOQS-E9Q-E9QOOQS1G0n1G0nOOQS<<Iy<<IyONZQ!fO,5;jOOQS-E8|-E8|OOQO<<Ia<<IaOOQPAN>nAN>nO! bQ`OAN>nO! gQaO,5;hOOQO-E8z-E8zO! qQdO,5;gOOQO-E8y-E8yOOQW<<Hk<<HkOOQW<<Ho<<HoO! {QhO<<HoO!!^QhO,5;fO!!iQ`O,5;fOOQO-E8x-E8xO!!nQdO1G1rOGvQdO'#FQO!!xQ`O7+%zOOQW7+%z7+%zO!#QQ!bO1G/cOOQ[7+$|7+$|O!#]QhO7+$|P!#dQ`O'#EyOOQO,5;o,5;oOOQO-E9R-E9ROOQS1G1Y1G1YOOQPG24YG24YO!#iQ`OAN>ZO)VQdO1G1QO!#nQ`O7+'^OOQO,5;l,5;lOOQO-E9O-E9OOOQW<<If<<IfOOQ[<<Hh<<HhPOQW,5;e,5;eOOQWG23uG23uO!#vQdO7+&l",stateData:"!$Z~O$QOS$RQQ~OWVO^_O`WOcYOdYOl`OmZOp[O!r]O!u^O!{dO#ReO#TfO#VgO#YhO#`iO#bjO#ekO#|RO$XTO~OQmOWVO^_O`WOcYOdYOl`OmZOp[O!r]O!u^O!{dO#ReO#TfO#VgO#YhO#`iO#bjO#ekO#|lO$XTO~O#z$bP~P!jO$RqO~O`YXcYXdYXmYXpYXsYX!aYX!rYX!uYX#{YX$X[X~OgYX~P$ZO#|sO~O$XuO~O$XuO`$WXc$WXd$WXm$WXp$WXs$WX!a$WX!r$WX!u$WX#{$WXg$WX~O#|vO~O`xOcyOdyOmzOp{O!r|O!u!OO#{}O~Os!RO!a!PO~P&^Of!XO#|!TO#}!UO~O#|!YO~OW!^O#|![O$X!]O~OWVO^_O`WOcYOdYOmZOp[O!r]O!u^O#|RO$XTO~OS!fOc!gOd!gOh!cOs!RO!Y!eO!]!jO$O!bO~On!iO~P(dOQ!tOh!mOp!nOs!oOu!wOw!wO}!uO!d!vO#|!lO#}!rO$]!pO~OS!fOc!gOd!gOh!cO!Y!eO!]!jO$O!bO~Os$eP~P)zOw!|O!d!vO#|!{O~Ow#OO#|#OO~Oh#ROs!RO#c#TO~O#|#VO~Oc!xX~P$ZOc#YO~On#ZO#z$bXr$bX~O#z$bXr$bX~P!jO$S#^O$T#^O$U#`O~Of#eO#|!TO#}!UO~Os!RO!a!PO~Or$bP~P!jOh#oO~Oh#pO~Oo!kX!o!kX$X!mX~O#|#qO~O$X#sO~Oo#tO!o#uO~O`xOcyOdyOmzOp{O~Os!qa!a!qa!r!qa!u!qa#{!qag!qa~P-pOs!ta!a!ta!r!ta!u!ta#{!tag!ta~P-pOS!fOc!gOd!gOh!cO!Y!eO!]!jO~OR#yOu#yOw#yO$O#vO$]!pO~P/POn$PO!U#|O!a#}O~P(dOh$RO~O$O$TO~Oh#RO~O`$WOc$WOg$ZOl$WOm$WOn$WO~P)VO`$WOc$WOl$WOm$WOn$WOo$]O~P)VO`$WOc$WOl$WOm$WOn$WOr$_O~P)VOP$`OSvXcvXdvXhvXnvXyvX!YvX!]vX!}vX#PvX$OvX!WvXQvX`vXgvXlvXmvXpvXsvXuvXwvX}vX!dvX#|vX#}vX$]vXovXrvX!avX#zvX$dvX!pvX~Oy$aO!}$bO#P$cOn$eP~P)zOh#pOS$ZXc$ZXd$ZXn$ZXy$ZX!Y$ZX!]$ZX!}$ZX#P$ZX$O$ZXQ$ZX`$ZXg$ZXl$ZXm$ZXp$ZXs$ZXu$ZXw$ZX}$ZX!d$ZX#|$ZX#}$ZX$]$ZXo$ZXr$ZX!a$ZX#z$ZX$d$ZX!p$ZX~Oh$gO~Oh$iO~O!U#|O!a$jOs$eXn$eX~Os!RO~On$mOy$aO~On$nO~Ow$oO!d!vO~Os$pO~Os!RO!U#|O~Os!RO#c$vO~O#|#VOs#fX~O$d$zOn!wa#z!war!wa~P)VOn#sX#z#sXr#sX~P!jOn#ZO#z$bar$ba~O$S#^O$T#^O$U%RO~Oo%TO!o%UO~Os!qi!a!qi!r!qi!u!qi#{!qig!qi~P-pOs!si!a!si!r!si!u!si#{!sig!si~P-pOs!ti!a!ti!r!ti!u!ti#{!tig!ti~P-pOs#qa!a#qa~P&^Or%VO~Og$aP~P'oOg$YP~P)VOc!SXg!QX!U!QX!W!SX~Oc%_O!W%`O~Og%aO!U#|O~O!U#|OS#yXc#yXd#yXh#yXn#yXs#yX!Y#yX!]#yX!a#yX$O#yX~On%eO!a#}O~P(dO!U#|OS!Xac!Xad!Xah!Xan!Xas!Xa!Y!Xa!]!Xa!a!Xa$O!Xag!Xa~O$O%fOg$`P~P/POy$aOQ$[X`$[Xc$[Xg$[Xh$[Xl$[Xm$[Xn$[Xp$[Xs$[Xu$[Xw$[X}$[X!d$[X#|$[X#}$[X$]$[Xo$[Xr$[X~O`$WOc$WOg%kOl$WOm$WOn$WO~P)VO`$WOc$WOl$WOm$WOn$WOo%lO~P)VO`$WOc$WOl$WOm$WOn$WOr%mO~P)VOh%oOS!|Xc!|Xd!|Xn!|X!Y!|X!]!|X$O!|X~On%pO~Og%uOw%vO!e%vO~Os#uX!a#uXn#uX~P)zO!a$jOs$ean$ea~On%yO~Or&QO#|%{O$]%zO~Og&RO~P&^Oy$aO!a&VO$d$zOn!wi#z!wir!wi~P)VO$c&YO~On#sa#z#sar#sa~P!jOn#ZO#z$bir$bi~O!a&]Og$aX~P&^Og&_O~Oy$aOQ#kXg#kXh#kXp#kXs#kXu#kXw#kX}#kX!a#kX!d#kX#|#kX#}#kX$]#kX~O!a&aOg$YX~P)VOg&cO~Oo&dOy$aO!p&eO~OR#yOu#yOw#yO$O&gO$]!pO~O!U#|OS#yac#yad#yah#yan#yas#ya!Y#ya!]#ya!a#ya$O#ya~Oc!SXg!QX!U!QX!a!QX~O!U#|O!a&iOg$`X~Oc&kO~Og&lO~O#|&mO~On&oO~Oc&pO!U#|O~Og&rOn&qO~Og&uO~O!U#|Os#ua!a#uan#ua~OP$`OsvX!avXgvX~O$]%zOs#]X!a#]X~Os!RO!a&wO~Or&{O#|%{O$]%zO~Oy$aOQ#rXh#rXn#rXp#rXs#rXu#rXw#rX}#rX!a#rX!d#rX#z#rX#|#rX#}#rX$]#rX$d#rXr#rX~O!a&VO$d$zOn!wq#z!wqr!wq~P)VOo'QOy$aO!p'RO~Og#pX!a#pX~P'oO!a&]Og$aa~Og#oX!a#oX~P)VO!a&aOg$Ya~Oo'QO~Og'WO~P)VOg'XO!W'YO~O$O%fOg#nX!a#nX~P/PO!a&iOg$`a~O`'_Og'aO~OS#mac#mad#mah#ma!Y#ma!]#ma$O#ma~Og'cO~PMcOg'cOn'dO~Oy$aOQ#rah#ran#rap#ras#rau#raw#ra}#ra!a#ra!d#ra#z#ra#|#ra#}#ra$]#ra$d#rar#ra~Oo'iO~Og#pa!a#pa~P&^Og#oa!a#oa~P)VOR#yOu#yOw#yO$O&gO$]%zO~O!U#|Og#na!a#na~Oc'kO~O!a&iOg$`i~P)VO`'_Og'oO~Oy$aOg!Pin!Pi~Og'pO~PMcOn'qO~Og'rO~O!a&iOg$`q~Og#nq!a#nq~P)VO$Q!e$R$]`$]y!u~",goto:"4h$fPPPPP$gP$jP$s%V$s%i%{P$sP&R$sPP&XPPP&_&i&iPPPPP&iPP&iP'VP&iP&i(Q&iP(n(q(w(w)Z(wP(wP(wP(w(wP)j(w)vP(w)yPP*m*s$s*y$s+P+P+V+ZPP$sP$s$sP+a,],j,q$jP,zP,}P$jP$jP$jP-T$jP-W-Z-^-e$jP$jPP$jP-j$jP-m-s.S.j.x/O/Y/`/f/l/r/|0S0Y0`0f0lPPPPPPPPPPP0r0{P1q1t2vP3O3x4R4U4XPP4_RrQ_aOPco!R#Z$}q_OP]^co|}!O!P!R#R#Z#o$}&]qSOP]^co|}!O!P!R#R#Z#o$}&]qUOP]^co|}!O!P!R#R#Z#o$}&]QtTR#auQwWR#bxQ!VYR#cyQ#c!XS$f!s!tR%S#e!V!wdf!m!n!o#Y#p#u$Y$[$^$a$y%U%Z%_&V&W&a&f&k&p'U'^'k's!U!wdf!m!n!o#Y#p#u$Y$[$^$a$y%U%Z%_&V&W&a&f&k&p'U'^'k'sU#y!c%`'YU%}$p&P&wR&v%|!V!sdf!m!n!o#Y#p#u$Y$[$^$a$y%U%Z%_&V&W&a&f&k&p'U'^'k'sR$h!uQ%s$gR&s%tq!h`ei!c!d!e!q#|#}$O$R$e$g$j%t&iQ#w!cQ%h$RQ&h%`Q'[&iR'j'YQ#UjQ$U!jQ$t#TR&T$vR$S!f!U!wdf!m!n!o#Y#p#u$Y$[$^$a$y%U%Z%_&V&W&a&f&k&p'U'^'k'sQ!|gR$o!}Q!WYR#dyQ#c!WR%S#dQ!ZZR#fzQ!_[R#g{T!^[{Q#r!]R%]#sQ!SXQ!i`Q#SjQ#m!QQ$P!dQ$l!yQ$r#QQ$u#UQ$x#XQ%e$OQ&S$tQ&y&OQ&|&TR'h&xSnP!RQ#]oQ$|#ZR&Z$}ZmPo!R#Z$}Q${#YQ&X$yR'P&WR$e!qQ&n%oR'm'_R!}gR#PhR$q#PS&O$p&PR'f&wV%|$p&P&wR#XkQ#_qR%Q#_QcOSoP!RU!kco$}R$}#ZQ%Z#pY&`%Z&f'U'^'sQ&f%_Q'U&aQ'^&kR's'kQ$Y!mQ$[!nQ$^!oV%j$Y$[$^Q%t$gR&t%tQ&j%gS']&j'lR'l'^Q&b%ZR'V&bQ&^%WR'T&^Q!QXR#l!QQ&W$yR'O&WQ#[nS%O#[%PR%P#]Q'`&nR'n'`Q$k!xR%x$kQ&P$pR&z&PQ&x&OR'g&xQ#WkR$w#WQ$O!dR%d$O_bOPco!R#Z$}^XOPco!R#Z$}Q!`]Q!a^Q#h|Q#i}Q#j!OQ#k!PQ$s#RQ%W#oR'S&]R%[#pQ!qdQ!zf[$V!m!n!o$Y$[$^Q$y#Yd%Y#p%Z%_&a&f&k'U'^'k'sQ%^#uQ%n$aS&U$y&WQ&[%UQ&}&VR'b&p]$X!m!n!o$Y$[$^Q!d`U!xe!q$eQ#QiQ#x!cS#{!d$OQ$Q!eQ%b#|Q%c#}Q%g$RS%r$g%tQ%w$jR'Z&iQ#z!cQ&h%`R'j'YR%i$RR%X#oQpPR#n!RQ!yeQ$d!qR%q$e",nodeNames:`⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NamespacedTagSelector NamespaceName TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , PseudoQuery CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName NamespacedAttribute NamespaceName AttributeName MatchOp MatchFlag ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to FontFeatureStatement font-feature-values FontName AtRule Styles`,maxTerm:159,nodeProps:[[`isolate`,-2,5,39,``],[`openedBy`,23,`(`,31,`[`,34,`{`],[`closedBy`,24,`)`,32,`]`,35,`}`]],propSources:[wS],skippedNodes:[0,5,117],repeatNodeCount:17,tokenData:"K`~R!bOX%ZX^&R^p%Zpq&Rqr)ers)vst+jtu2Xuv%Zvw3Rwx3dxy5Ryz5dz{5i{|6S|}:u}!O;W!O!P;u!P!Q<^!Q![=V![!]>Q!]!^>|!^!_?_!_!`@Z!`!a@n!a!b%Z!b!cAo!c!k%Z!k!lC|!l!u%Z!u!vC|!v!}%Z!}#OD_#O#P%Z#P#QDp#Q#R2X#R#]%Z#]#^ER#^#g%Z#g#hC|#h#o%Z#o#pIf#p#qIw#q#rJ`#r#sJq#s#y%Z#y#z&R#z$f%Z$f$g&R$g#BY%Z#BY#BZ&R#BZ$IS%Z$IS$I_&R$I_$I|%Z$I|$JO&R$JO$JT%Z$JT$JU&R$JU$KV%Z$KV$KW&R$KW&FU%Z&FU&FV&R&FV;'S%Z;'S;=`KY<%lO%Z`%^SOy%jz;'S%j;'S;=`%{<%lO%j`%oS!e`Oy%jz;'S%j;'S;=`%{<%lO%j`&OP;=`<%l%j~&Wh$Q~OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%j~'yh$Q~!e`OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%jj)jS$dYOy%jz;'S%j;'S;=`%{<%lO%j~)yWOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d<%lO)v~*hOw~~*kRO;'S)v;'S;=`*t;=`O)v~*wXOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d;=`<%l)v<%lO)v~+gP;=`<%l)vj+oYmYOy%jz!Q%j!Q![,_![!c%j!c!i,_!i#T%j#T#Z,_#Z;'S%j;'S;=`%{<%lO%jj,dY!e`Oy%jz!Q%j!Q![-S![!c%j!c!i-S!i#T%j#T#Z-S#Z;'S%j;'S;=`%{<%lO%jj-XY!e`Oy%jz!Q%j!Q![-w![!c%j!c!i-w!i#T%j#T#Z-w#Z;'S%j;'S;=`%{<%lO%jj.OYuY!e`Oy%jz!Q%j!Q![.n![!c%j!c!i.n!i#T%j#T#Z.n#Z;'S%j;'S;=`%{<%lO%jj.uYuY!e`Oy%jz!Q%j!Q![/e![!c%j!c!i/e!i#T%j#T#Z/e#Z;'S%j;'S;=`%{<%lO%jj/jY!e`Oy%jz!Q%j!Q![0Y![!c%j!c!i0Y!i#T%j#T#Z0Y#Z;'S%j;'S;=`%{<%lO%jj0aYuY!e`Oy%jz!Q%j!Q![1P![!c%j!c!i1P!i#T%j#T#Z1P#Z;'S%j;'S;=`%{<%lO%jj1UY!e`Oy%jz!Q%j!Q![1t![!c%j!c!i1t!i#T%j#T#Z1t#Z;'S%j;'S;=`%{<%lO%jj1{SuY!e`Oy%jz;'S%j;'S;=`%{<%lO%jd2[UOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jd2uS!oS!e`Oy%jz;'S%j;'S;=`%{<%lO%jb3WS^QOy%jz;'S%j;'S;=`%{<%lO%j~3gWOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{<%lO3d~4SRO;'S3d;'S;=`4];=`O3d~4`XOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{;=`<%l3d<%lO3d~5OP;=`<%l3dj5WShYOy%jz;'S%j;'S;=`%{<%lO%j~5iOg~n5pUWQyWOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jj6ZWyW!uQOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj6xU!e`Oy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%jj7cY!e`$]YOy%jz!Q%j!Q![7[![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj8WY!e`Oy%jz{%j{|8v|}%j}!O8v!O!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj8{U!e`Oy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj9fU!e`$]YOy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj:P[!e`$]YOy%jz!O%j!O!P7[!P!Q%j!Q![9x![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj:zS!aYOy%jz;'S%j;'S;=`%{<%lO%jj;]WyWOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj;zU`YOy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%j~<cTyWOy%jz{<r{;'S%j;'S;=`%{<%lO%j~<yS!e`$R~Oy%jz;'S%j;'S;=`%{<%lO%jj=[[$]YOy%jz!O%j!O!P7[!P!Q%j!Q![9x![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj>VUcYOy%jz![%j![!]>i!];'S%j;'S;=`%{<%lO%jj>pSdY!e`Oy%jz;'S%j;'S;=`%{<%lO%jj?RSnYOy%jz;'S%j;'S;=`%{<%lO%jh?dU!WWOy%jz!_%j!_!`?v!`;'S%j;'S;=`%{<%lO%jh?}S!WW!e`Oy%jz;'S%j;'S;=`%{<%lO%jl@bS!WW!oSOy%jz;'S%j;'S;=`%{<%lO%jj@uV!rQ!WWOy%jz!_%j!_!`?v!`!aA[!a;'S%j;'S;=`%{<%lO%jbAcS!rQ!e`Oy%jz;'S%j;'S;=`%{<%lO%jjArYOy%jz}%j}!OBb!O!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjBgW!e`Oy%jz!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjCW[lY!e`Oy%jz}%j}!OCP!O!Q%j!Q![CP![!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jhDRS!pWOy%jz;'S%j;'S;=`%{<%lO%jjDdSpYOy%jz;'S%j;'S;=`%{<%lO%jnDuSo^Oy%jz;'S%j;'S;=`%{<%lO%jjEWU!pWOy%jz#a%j#a#bEj#b;'S%j;'S;=`%{<%lO%jbEoU!e`Oy%jz#d%j#d#eFR#e;'S%j;'S;=`%{<%lO%jbFWU!e`Oy%jz#c%j#c#dFj#d;'S%j;'S;=`%{<%lO%jbFoU!e`Oy%jz#f%j#f#gGR#g;'S%j;'S;=`%{<%lO%jbGWU!e`Oy%jz#h%j#h#iGj#i;'S%j;'S;=`%{<%lO%jbGoU!e`Oy%jz#T%j#T#UHR#U;'S%j;'S;=`%{<%lO%jbHWU!e`Oy%jz#b%j#b#cHj#c;'S%j;'S;=`%{<%lO%jbHoU!e`Oy%jz#h%j#h#iIR#i;'S%j;'S;=`%{<%lO%jbIYS$cQ!e`Oy%jz;'S%j;'S;=`%{<%lO%jjIkSsYOy%jz;'S%j;'S;=`%{<%lO%jfI|U$XUOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jjJeSrYOy%jz;'S%j;'S;=`%{<%lO%jfJvU!uQOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%j`K]P;=`<%l%Z",tokenizers:[SS,CS,bS,xS,1,2,3,4,new O_(`m~RRYZ[z{a~~g~aO$T~~dP!P!Qg~lO$U~~`,28,142)],topRules:{StyleSheet:[0,6],Styles:[1,116]},dynamicPrecedences:{84:1},specialized:[{term:137,get:e=>TS[e]||-1},{term:138,get:e=>ES[e]||-1},{term:4,get:e=>DS[e]||-1},{term:28,get:e=>OS[e]||-1},{term:136,get:e=>kS[e]||-1}],tokenPrec:2256}),jS=null;function MS(){if(!jS&&typeof document==`object`&&document.body){let{style:e}=document.body,t=[],n=new Set;for(let r in e)r!=`cssText`&&r!=`cssFloat`&&typeof e[r]==`string`&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,e=>`-`+e.toLowerCase())),n.has(r)||(t.push(r),n.add(r)));jS=t.sort().map(e=>({type:`property`,label:e,apply:e+`: `}))}return jS||[]}var NS=`active.after.any-link.autofill.backdrop.before.checked.cue.default.defined.disabled.empty.enabled.file-selector-button.first.first-child.first-letter.first-line.first-of-type.focus.focus-visible.focus-within.fullscreen.has.host.host-context.hover.in-range.indeterminate.invalid.is.lang.last-child.last-of-type.left.link.marker.modal.not.nth-child.nth-last-child.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.part.placeholder.placeholder-shown.read-only.read-write.required.right.root.scope.selection.slotted.target.target-text.valid.visited.where`.split(`.`).map(e=>({type:`class`,label:e})),PS=`above.absolute.activeborder.additive.activecaption.after-white-space.ahead.alias.all.all-scroll.alphabetic.alternate.always.antialiased.appworkspace.asterisks.attr.auto.auto-flow.avoid.avoid-column.avoid-page.avoid-region.axis-pan.background.backwards.baseline.below.bidi-override.blink.block.block-axis.bold.bolder.border.border-box.both.bottom.break.break-all.break-word.bullets.button.button-bevel.buttonface.buttonhighlight.buttonshadow.buttontext.calc.capitalize.caps-lock-indicator.caption.captiontext.caret.cell.center.checkbox.circle.cjk-decimal.clear.clip.close-quote.col-resize.collapse.color.color-burn.color-dodge.column.column-reverse.compact.condensed.contain.content.contents.content-box.context-menu.continuous.copy.counter.counters.cover.crop.cross.crosshair.currentcolor.cursive.cyclic.darken.dashed.decimal.decimal-leading-zero.default.default-button.dense.destination-atop.destination-in.destination-out.destination-over.difference.disc.discard.disclosure-closed.disclosure-open.document.dot-dash.dot-dot-dash.dotted.double.down.e-resize.ease.ease-in.ease-in-out.ease-out.element.ellipse.ellipsis.embed.end.ethiopic-abegede-gez.ethiopic-halehame-aa-er.ethiopic-halehame-gez.ew-resize.exclusion.expanded.extends.extra-condensed.extra-expanded.fantasy.fast.fill.fill-box.fixed.flat.flex.flex-end.flex-start.footnotes.forwards.from.geometricPrecision.graytext.grid.groove.hand.hard-light.help.hidden.hide.higher.highlight.highlighttext.horizontal.hsl.hsla.hue.icon.ignore.inactiveborder.inactivecaption.inactivecaptiontext.infinite.infobackground.infotext.inherit.initial.inline.inline-axis.inline-block.inline-flex.inline-grid.inline-table.inset.inside.intrinsic.invert.italic.justify.keep-all.landscape.large.larger.left.level.lighter.lighten.line-through.linear.linear-gradient.lines.list-item.listbox.listitem.local.logical.loud.lower.lower-hexadecimal.lower-latin.lower-norwegian.lowercase.ltr.luminosity.manipulation.match.matrix.matrix3d.medium.menu.menutext.message-box.middle.min-intrinsic.mix.monospace.move.multiple.multiple_mask_images.multiply.n-resize.narrower.ne-resize.nesw-resize.no-close-quote.no-drop.no-open-quote.no-repeat.none.normal.not-allowed.nowrap.ns-resize.numbers.numeric.nw-resize.nwse-resize.oblique.opacity.open-quote.optimizeLegibility.optimizeSpeed.outset.outside.outside-shape.overlay.overline.padding.padding-box.painted.page.paused.perspective.pinch-zoom.plus-darker.plus-lighter.pointer.polygon.portrait.pre.pre-line.pre-wrap.preserve-3d.progress.push-button.radial-gradient.radio.read-only.read-write.read-write-plaintext-only.rectangle.region.relative.repeat.repeating-linear-gradient.repeating-radial-gradient.repeat-x.repeat-y.reset.reverse.rgb.rgba.ridge.right.rotate.rotate3d.rotateX.rotateY.rotateZ.round.row.row-resize.row-reverse.rtl.run-in.running.s-resize.sans-serif.saturation.scale.scale3d.scaleX.scaleY.scaleZ.screen.scroll.scrollbar.scroll-position.se-resize.self-start.self-end.semi-condensed.semi-expanded.separate.serif.show.single.skew.skewX.skewY.skip-white-space.slide.slider-horizontal.slider-vertical.sliderthumb-horizontal.sliderthumb-vertical.slow.small.small-caps.small-caption.smaller.soft-light.solid.source-atop.source-in.source-out.source-over.space.space-around.space-between.space-evenly.spell-out.square.start.static.status-bar.stretch.stroke.stroke-box.sub.subpixel-antialiased.svg_masks.super.sw-resize.symbolic.symbols.system-ui.table.table-caption.table-cell.table-column.table-column-group.table-footer-group.table-header-group.table-row.table-row-group.text.text-bottom.text-top.textarea.textfield.thick.thin.threeddarkshadow.threedface.threedhighlight.threedlightshadow.threedshadow.to.top.transform.translate.translate3d.translateX.translateY.translateZ.transparent.ultra-condensed.ultra-expanded.underline.unidirectional-pan.unset.up.upper-latin.uppercase.url.var.vertical.vertical-text.view-box.visible.visibleFill.visiblePainted.visibleStroke.visual.w-resize.wait.wave.wider.window.windowframe.windowtext.words.wrap.wrap-reverse.x-large.x-small.xor.xx-large.xx-small`.split(`.`).map(e=>({type:`keyword`,label:e})).concat(`aliceblue.antiquewhite.aqua.aquamarine.azure.beige.bisque.black.blanchedalmond.blue.blueviolet.brown.burlywood.cadetblue.chartreuse.chocolate.coral.cornflowerblue.cornsilk.crimson.cyan.darkblue.darkcyan.darkgoldenrod.darkgray.darkgreen.darkkhaki.darkmagenta.darkolivegreen.darkorange.darkorchid.darkred.darksalmon.darkseagreen.darkslateblue.darkslategray.darkturquoise.darkviolet.deeppink.deepskyblue.dimgray.dodgerblue.firebrick.floralwhite.forestgreen.fuchsia.gainsboro.ghostwhite.gold.goldenrod.gray.grey.green.greenyellow.honeydew.hotpink.indianred.indigo.ivory.khaki.lavender.lavenderblush.lawngreen.lemonchiffon.lightblue.lightcoral.lightcyan.lightgoldenrodyellow.lightgray.lightgreen.lightpink.lightsalmon.lightseagreen.lightskyblue.lightslategray.lightsteelblue.lightyellow.lime.limegreen.linen.magenta.maroon.mediumaquamarine.mediumblue.mediumorchid.mediumpurple.mediumseagreen.mediumslateblue.mediumspringgreen.mediumturquoise.mediumvioletred.midnightblue.mintcream.mistyrose.moccasin.navajowhite.navy.oldlace.olive.olivedrab.orange.orangered.orchid.palegoldenrod.palegreen.paleturquoise.palevioletred.papayawhip.peachpuff.peru.pink.plum.powderblue.purple.rebeccapurple.red.rosybrown.royalblue.saddlebrown.salmon.sandybrown.seagreen.seashell.sienna.silver.skyblue.slateblue.slategray.snow.springgreen.steelblue.tan.teal.thistle.tomato.turquoise.violet.wheat.white.whitesmoke.yellow.yellowgreen`.split(`.`).map(e=>({type:`constant`,label:e}))),FS=`a.abbr.address.article.aside.b.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.dd.del.details.dfn.dialog.div.dl.dt.em.figcaption.figure.footer.form.header.hgroup.h1.h2.h3.h4.h5.h6.hr.html.i.iframe.img.input.ins.kbd.label.legend.li.main.meter.nav.ol.output.p.pre.ruby.section.select.small.source.span.strong.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.tr.u.ul`.split(`.`).map(e=>({type:`type`,label:e})),IS=[`@charset`,`@color-profile`,`@container`,`@counter-style`,`@font-face`,`@font-feature-values`,`@font-palette-values`,`@import`,`@keyframes`,`@layer`,`@media`,`@namespace`,`@page`,`@position-try`,`@property`,`@scope`,`@starting-style`,`@supports`,`@view-transition`].map(e=>({type:`keyword`,label:e})),LS=/^(\w[\w-]*|-\w[\w-]*|)$/,RS=/^-(-[\w-]*)?$/;function zS(e,t){if((e.name==`(`||e.type.isError)&&(e=e.parent||e),e.name!=`ArgList`)return!1;let n=e.parent?.firstChild;return n?.name==`Callee`?t.sliceString(n.from,n.to)==`var`:!1}var BS=new ff,VS=[`Declaration`];function HS(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function US(e,t,n){if(t.to-t.from>4096){let r=BS.get(t);if(r)return r;let i=[],a=new Set,o=t.cursor(Wd.IncludeAnonymous);if(o.firstChild())do for(let t of US(e,o.node,n))a.has(t.label)||(a.add(t.label),i.push(t));while(o.nextSibling());return BS.set(t,i),i}else{let r=[],i=new Set;return t.cursor().iterate(t=>{if(n(t)&&t.matchContext(VS)&&t.node.nextSibling?.name==`:`){let n=e.sliceString(t.from,t.to);i.has(n)||(i.add(n),r.push({label:n,type:`variable`}))}}),r}}var WS=(e=>t=>{let{state:n,pos:r}=t,i=up(n).resolveInner(r,-1),a=i.type.isError&&i.from==i.to-1&&n.doc.sliceString(i.from,i.to)==`-`;if(i.name==`PropertyName`||(a||i.name==`TagName`)&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:MS(),validFor:LS};if(i.name==`ValueName`)return{from:i.from,options:PS,validFor:LS};if(i.name==`PseudoClassName`)return{from:i.from,options:NS,validFor:LS};if(e(i)||(t.explicit||a)&&zS(i,n.doc))return{from:e(i)||a?i.from:r,options:US(n.doc,HS(i),e),validFor:RS};if(i.name==`TagName`){for(let{parent:e}=i;e;e=e.parent)if(e.name==`Block`)return{from:i.from,options:MS(),validFor:LS};return{from:i.from,options:FS,validFor:LS}}if(i.name==`AtKeyword`)return{from:i.from,options:IS,validFor:LS};if(!t.explicit)return null;let o=i.resolve(r),s=o.childBefore(r);return s&&s.name==`:`&&o.name==`PseudoClassSelector`?{from:r,options:NS,validFor:LS}:s&&s.name==`:`&&o.name==`Declaration`||o.name==`ArgList`?{from:r,options:PS,validFor:LS}:o.name==`Block`||o.name==`Styles`?{from:r,options:MS(),validFor:LS}:null})(e=>e.name==`VariableName`),GS=lp.define({name:`css`,parser:AS.configure({props:[Dp.add({Declaration:zp()}),Up.add({"Block KeyframeList":Wp})]}),languageData:{commentTokens:{block:{open:`/*`,close:`*/`}},indentOnInput:/^\s*\}$/,wordChars:`-`}});function KS(){return new bp(GS,GS.data.of({autocomplete:WS}))}var qS=[`_blank`,`_self`,`_top`,`_parent`],JS=[`ascii`,`utf-8`,`utf-16`,`latin1`,`latin1`],YS=[`get`,`post`,`put`,`delete`],XS=[`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`],ZS=[`true`,`false`],QS={},$S={a:{attrs:{href:null,ping:null,type:null,media:null,target:qS,hreflang:null}},abbr:QS,address:QS,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:[`default`,`rect`,`circle`,`poly`]}},article:QS,aside:QS,audio:{attrs:{src:null,mediagroup:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`none`,`metadata`,`auto`],autoplay:[`autoplay`],loop:[`loop`],controls:[`controls`]}},b:QS,base:{attrs:{href:null,target:qS}},bdi:QS,bdo:QS,blockquote:{attrs:{cite:null}},body:QS,br:QS,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:[`autofocus`],disabled:[`autofocus`],formenctype:XS,formmethod:YS,formnovalidate:[`novalidate`],formtarget:qS,type:[`submit`,`reset`,`button`]}},canvas:{attrs:{width:null,height:null}},caption:QS,center:QS,cite:QS,code:QS,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:[`command`,`checkbox`,`radio`],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:[`disabled`],checked:[`checked`]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:[`disabled`],multiple:[`multiple`]}},datalist:{attrs:{data:null}},dd:QS,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:[`open`]}},dfn:QS,div:QS,dl:QS,dt:QS,em:QS,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:[`disabled`],form:null,name:null}},figcaption:QS,figure:QS,footer:QS,form:{attrs:{action:null,name:null,"accept-charset":JS,autocomplete:[`on`,`off`],enctype:XS,method:YS,novalidate:[`novalidate`],target:qS}},h1:QS,h2:QS,h3:QS,h4:QS,h5:QS,h6:QS,head:{children:[`title`,`base`,`link`,`style`,`meta`,`script`,`noscript`,`command`]},header:QS,hgroup:QS,hr:QS,html:{attrs:{manifest:null}},i:QS,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:[`allow-top-navigation`,`allow-same-origin`,`allow-forms`,`allow-scripts`],seamless:[`seamless`]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:[`audio/*`,`video/*`,`image/*`],autocomplete:[`on`,`off`],autofocus:[`autofocus`],checked:[`checked`],disabled:[`disabled`],formenctype:XS,formmethod:YS,formnovalidate:[`novalidate`],formtarget:qS,multiple:[`multiple`],readonly:[`readonly`],required:[`required`],type:[`hidden`,`text`,`search`,`tel`,`url`,`email`,`password`,`datetime`,`date`,`month`,`week`,`time`,`datetime-local`,`number`,`range`,`color`,`checkbox`,`radio`,`file`,`submit`,`image`,`reset`,`button`]}},ins:{attrs:{cite:null,datetime:null}},kbd:QS,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:[`autofocus`],disabled:[`disabled`],keytype:[`RSA`]}},label:{attrs:{for:null,form:null}},legend:QS,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:[`all`,`16x16`,`16x16 32x32`,`16x16 32x32 64x64`]}},map:{attrs:{name:null}},mark:QS,menu:{attrs:{label:null,type:[`list`,`context`,`toolbar`]}},meta:{attrs:{content:null,charset:JS,name:[`viewport`,`application-name`,`author`,`description`,`generator`,`keywords`],"http-equiv":[`content-language`,`content-type`,`default-style`,`refresh`]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:QS,noscript:QS,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:[`typemustmatch`]}},ol:{attrs:{reversed:[`reversed`],start:null,type:[`1`,`a`,`A`,`i`,`I`]},children:[`li`,`script`,`template`,`ul`,`ol`]},optgroup:{attrs:{disabled:[`disabled`],label:null}},option:{attrs:{disabled:[`disabled`],label:null,selected:[`selected`],value:null}},output:{attrs:{for:null,form:null,name:null}},p:QS,param:{attrs:{name:null,value:null}},pre:QS,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:QS,rt:QS,ruby:QS,samp:QS,script:{attrs:{type:[`text/javascript`],src:null,async:[`async`],defer:[`defer`],charset:JS}},section:QS,select:{attrs:{form:null,name:null,size:null,autofocus:[`autofocus`],disabled:[`disabled`],multiple:[`multiple`]}},slot:{attrs:{name:null}},small:QS,source:{attrs:{src:null,type:null,media:null}},span:QS,strong:QS,style:{attrs:{type:[`text/css`],media:null,scoped:null}},sub:QS,summary:QS,sup:QS,table:QS,tbody:QS,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:QS,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:[`autofocus`],disabled:[`disabled`],readonly:[`readonly`],required:[`required`],wrap:[`soft`,`hard`]}},tfoot:QS,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:[`row`,`col`,`rowgroup`,`colgroup`]}},thead:QS,time:{attrs:{datetime:null}},title:QS,tr:QS,track:{attrs:{src:null,label:null,default:null,kind:[`subtitles`,`captions`,`descriptions`,`chapters`,`metadata`],srclang:null}},ul:{children:[`li`,`script`,`template`,`ul`,`ol`]},var:QS,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`auto`,`metadata`,`none`],autoplay:[`autoplay`],mediagroup:[`movie`],muted:[`muted`],controls:[`controls`]}},wbr:QS},eC={accesskey:null,class:null,contenteditable:ZS,contextmenu:null,dir:[`ltr`,`rtl`,`auto`],draggable:[`true`,`false`,`auto`],dropzone:[`copy`,`move`,`link`,`string:`,`file:`],hidden:[`hidden`],id:null,inert:[`inert`],itemid:null,itemprop:null,itemref:null,itemscope:[`itemscope`],itemtype:null,lang:[`ar`,`bn`,`de`,`en-GB`,`en-US`,`es`,`fr`,`hi`,`id`,`ja`,`pa`,`pt`,`ru`,`tr`,`zh`],spellcheck:ZS,autocorrect:ZS,autocapitalize:ZS,style:null,tabindex:null,title:null,translate:[`yes`,`no`],rel:[`stylesheet`,`alternate`,`author`,`bookmark`,`help`,`license`,`next`,`nofollow`,`noreferrer`,`prefetch`,`prev`,`search`,`tag`],role:`alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer`.split(` `),"aria-activedescendant":null,"aria-atomic":ZS,"aria-autocomplete":[`inline`,`list`,`both`,`none`],"aria-busy":ZS,"aria-checked":[`true`,`false`,`mixed`,`undefined`],"aria-controls":null,"aria-describedby":null,"aria-disabled":ZS,"aria-dropeffect":null,"aria-expanded":[`true`,`false`,`undefined`],"aria-flowto":null,"aria-grabbed":[`true`,`false`,`undefined`],"aria-haspopup":ZS,"aria-hidden":ZS,"aria-invalid":[`true`,`false`,`grammar`,`spelling`],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":[`off`,`polite`,`assertive`],"aria-multiline":ZS,"aria-multiselectable":ZS,"aria-owns":null,"aria-posinset":null,"aria-pressed":[`true`,`false`,`mixed`,`undefined`],"aria-readonly":ZS,"aria-relevant":null,"aria-required":ZS,"aria-selected":[`true`,`false`,`undefined`],"aria-setsize":null,"aria-sort":[`ascending`,`descending`,`none`,`other`],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},tC=`beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload`.split(` `).map(e=>`on`+e);for(let e of tC)eC[e]=null;var nC=class{constructor(e,t){this.tags={...$S,...e},this.globalAttrs={...eC,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};nC.default=new nC;function rC(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}function iC(e,t=!1){for(;e;e=e.parent)if(e.name==`Element`)if(t)t=!1;else return e;return null}function aC(e,t,n){return n.tags[rC(e,iC(t))]?.children||n.allTags}function oC(e,t){let n=[];for(let r=iC(t);r&&!r.type.isTop;r=iC(r.parent)){let i=rC(e,r);if(i&&r.lastChild.name==`CloseTag`)break;i&&n.indexOf(i)<0&&(t.name==`EndTag`||t.from>=r.firstChild.to)&&n.push(i)}return n}var sC=/^[:\-\.\w\u00b7-\uffff]*$/;function cC(e,t,n,r,i){let a=/\s*>/.test(e.sliceDoc(i,i+5))?``:`>`,o=iC(n,n.name==`StartTag`||n.name==`TagName`);return{from:r,to:i,options:aC(e.doc,o,t).map(e=>({label:e,type:`type`})).concat(oC(e.doc,n).map((e,t)=>({label:`/`+e,apply:`/`+e+a,type:`type`,boost:99-t}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function lC(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?``:`>`;return{from:n,to:r,options:oC(e.doc,t).map((e,t)=>({label:e,apply:e+i,type:`type`,boost:99-t})),validFor:sC}}function uC(e,t,n,r){let i=[],a=0;for(let r of aC(e.doc,n,t))i.push({label:`<`+r,type:`type`});for(let t of oC(e.doc,n))i.push({label:`</`+t+`>`,type:`type`,boost:99-a++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function dC(e,t,n,r,i){let a=iC(n),o=a?t.tags[rC(e.doc,a)]:null,s=o&&o.attrs?Object.keys(o.attrs):[];return{from:r,to:i,options:(o&&o.globalAttrs===!1?s:s.length?s.concat(t.globalAttrNames):t.globalAttrNames).map(e=>({label:e,type:`property`})),validFor:sC}}function fC(e,t,n,r,i){let a=n.parent?.getChild(`AttributeName`),o=[],s;if(a){let c=e.sliceDoc(a.from,a.to),l=t.globalAttrs[c];if(!l){let r=iC(n),i=r?t.tags[rC(e.doc,r)]:null;l=i?.attrs&&i.attrs[c]}if(l){let t=e.sliceDoc(r,i).toLowerCase(),n=`"`,a=`"`;/^['"]/.test(t)?(s=t[0]==`"`?/^[^"]*$/:/^[^']*$/,n=``,a=e.sliceDoc(i,i+1)==t[0]?``:t[0],t=t.slice(1),r++):s=/^[^\s<>='"]*$/;for(let e of l)o.push({label:e,apply:n+e+a,type:`constant`})}}return{from:r,to:i,options:o,validFor:s}}function pC(e,t){let{state:n,pos:r}=t,i=up(n).resolveInner(r,-1),a=i.resolve(r);for(let e=r,t;a==i&&(t=i.childBefore(e));){let n=t.lastChild;if(!n||!n.type.isError||n.from<n.to)break;a=i=t,e=n.from}return i.name==`TagName`?i.parent&&/CloseTag$/.test(i.parent.name)?lC(n,i,i.from,r):cC(n,e,i,i.from,r):i.name==`StartTag`||i.name==`IncompleteTag`?cC(n,e,i,r,r):i.name==`StartCloseTag`||i.name==`IncompleteCloseTag`?lC(n,i,r,r):i.name==`OpenTag`||i.name==`SelfClosingTag`||i.name==`AttributeName`?dC(n,e,i,i.name==`AttributeName`?i.from:r,r):i.name==`Is`||i.name==`AttributeValue`||i.name==`UnquotedAttributeValue`?fC(n,e,i,i.name==`Is`?r:i.from,r):t.explicit&&(a.name==`Element`||a.name==`Text`||a.name==`Document`)?uC(n,e,i,r):null}function mC(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new nC(t,n):nC.default;return e=>pC(r,e)}var hC=Eb.parser.configure({top:`SingleExpression`}),gC=[{tag:`script`,attrs:e=>e.type==`text/typescript`||e.lang==`ts`,parser:Ob.parser},{tag:`script`,attrs:e=>e.type==`text/babel`||e.type==`text/jsx`,parser:kb.parser},{tag:`script`,attrs:e=>e.type==`text/typescript-jsx`,parser:Ab.parser},{tag:`script`,attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:hC},{tag:`script`,attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Eb.parser},{tag:`style`,attrs(e){return(!e.lang||e.lang==`css`)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:GS.parser}],_C=[{name:`style`,parser:GS.parser.configure({top:`Styles`})}].concat(tC.map(e=>({name:e,parser:Eb.parser}))),vC=lp.define({name:`html`,parser:Wx.configure({props:[Dp.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let n=e.node;;){let e=n.lastChild;if(!e||e.name!=`Element`||e.to!=n.to)break;t=n=e}return t&&!((n=t.lastChild)&&(n.name==`CloseTag`||n.name==`SelfClosingTag`))?e.lineIndent(t.from)+e.unit:null}}),Up.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),Fm.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:`-_`}}),yC=vC.configure({wrap:Jx(gC,_C)});function bC(e={}){let t=``,n;return e.matchClosingTags===!1&&(t=`noMatch`),e.selfClosingTags===!0&&(t=(t?t+` `:``)+`selfClosing`),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=Jx((e.nestedLanguages||[]).concat(gC),(e.nestedAttributes||[]).concat(_C))),new bp(n?vC.configure({wrap:n,dialect:t}):t?yC.configure({dialect:t}):yC,[yC.data.of({autocomplete:mC(e)}),e.autoCloseTags===!1?[]:SC,Pb().support,KS().support])}var xC=new Set(`area base br col command embed frame hr img input keygen link meta param source track wbr menuitem`.split(` `)),SC=Y.inputHandler.of((e,t,n,r,i)=>{if(e.composing||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!yC.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let t=o.doc.sliceString(e.from-1,e.to)==r,{head:n}=e,i=up(o).resolveInner(n,-1),a;if(t&&r==`>`&&i.name==`EndTag`){let t=i.parent;if(t.parent?.lastChild?.name!=`CloseTag`&&(a=rC(o.doc,t.parent,n))&&!xC.has(a))return{range:e,changes:{from:n,to:n+ +(o.doc.sliceString(n,n+1)===`>`),insert:`</${a}>`}}}else if(t&&r==`/`&&i.name==`IncompleteCloseTag`){let e=i.parent;if(i.from==n-2&&e.lastChild?.name!=`CloseTag`&&(a=rC(o.doc,e,n))&&!xC.has(a)){let e=n+ +(o.doc.sliceString(n,n+1)===`>`),t=`${a}>`;return{range:K.cursor(n+t.length,-1),changes:{from:n,to:e,insert:t}}}}return{range:e}});return s.changes.empty?!1:(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),CC=If({String:Z.string,Number:Z.number,"True False":Z.bool,PropertyName:Z.propertyName,Null:Z.null,", :":Z.separator,"[ ]":Z.squareBracket,"{ }":Z.brace}),wC=U_.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:`#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O`,goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:`⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array`,maxTerm:25,nodeProps:[[`isolate`,-2,6,11,``],[`openedBy`,7,`{`,14,`[`],[`closedBy`,8,`}`,15,`]`]],propSources:[CC],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),TC=lp.define({name:`json`,parser:wC.configure({props:[Dp.add({Object:zp({except:/^\s*\}/}),Array:zp({except:/^\s*\]/})}),Up.add({"Object Array":Wp})]}),languageData:{closeBrackets:{brackets:[`[`,`{`,`"`]},indentOnInput:/^\s*[\}\]]$/}});function EC(){return new bp(TC)}var DC=`#e5c07b`,OC=`#e06c75`,kC=`#56b6c2`,AC=`#ffffff`,jC=`#abb2bf`,MC=`#7d8799`,NC=`#61afef`,PC=`#98c379`,FC=`#d19a66`,IC=`#c678dd`,LC=`#21252b`,RC=`#2c313a`,zC=`#282c34`,BC=`#353a42`,VC=`#3E4451`,HC=`#528bff`,UC=[Y.theme({"&":{color:jC,backgroundColor:zC},".cm-content":{caretColor:HC},".cm-cursor, .cm-dropCursor":{borderLeftColor:HC},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:VC},".cm-panels":{backgroundColor:LC,color:jC},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid #457dff`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#6699ff0b`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:zC,color:MC,border:`none`},".cm-activeLineGutter":{backgroundColor:RC},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:BC},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:BC,borderBottomColor:BC},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:RC,color:jC}}},{dark:!0}),xm(_m.define([{tag:Z.keyword,color:IC},{tag:[Z.name,Z.deleted,Z.character,Z.propertyName,Z.macroName],color:OC},{tag:[Z.function(Z.variableName),Z.labelName],color:NC},{tag:[Z.color,Z.constant(Z.name),Z.standard(Z.name)],color:FC},{tag:[Z.definition(Z.name),Z.separator],color:jC},{tag:[Z.typeName,Z.className,Z.number,Z.changed,Z.annotation,Z.modifier,Z.self,Z.namespace],color:DC},{tag:[Z.operator,Z.operatorKeyword,Z.url,Z.escape,Z.regexp,Z.link,Z.special(Z.string)],color:kC},{tag:[Z.meta,Z.comment],color:MC},{tag:Z.strong,fontWeight:`bold`},{tag:Z.emphasis,fontStyle:`italic`},{tag:Z.strikethrough,textDecoration:`line-through`},{tag:Z.link,color:MC,textDecoration:`underline`},{tag:Z.heading,fontWeight:`bold`,color:OC},{tag:[Z.atom,Z.bool,Z.special(Z.variableName)],color:FC},{tag:[Z.processingInstruction,Z.string,Z.inserted],color:PC},{tag:Z.invalid,color:AC}]))],WC=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,GC=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(WC(e)):WC,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Yn(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Xn(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Zn(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(GC.prototype[Symbol.iterator]=function(){return this});var KC={from:-1,to:-1,match:/.*/.exec(``),precise:!0},qC=`gm`+(/x/.unicode==null?``:`u`),JC=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=KC,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new ZC(e,t,n,r,i);this.re=new RegExp(t,qC+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=$C(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=$C(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},YC=new WeakMap,XC=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=YC.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return YC.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),YC.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},ZC=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=KC,this.matchPos=$C(e,r),this.re=new RegExp(t,qC+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=XC.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=$C(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=XC.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(JC.prototype[Symbol.iterator]=ZC.prototype[Symbol.iterator]=function(){return this});function QC(e){try{return new RegExp(e,qC),!0}catch{return!1}}function $C(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var ew=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=rd(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),p=K.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,Y.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},tw={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},nw=q.define({combine(e){return ei(e,tw,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function rw(e){let t=[lw,cw];return e&&t.push(nw.of(e)),t}var iw=na.mark({class:`cm-selectionMatch`}),aw=na.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function ow(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=Jr.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=Jr.Word)}function sw(e,t,n,r){return e(t.sliceDoc(n,n+1))==Jr.Word&&e(t.sliceDoc(r-1,r))==Jr.Word}var cw=To.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(nw),{state:n}=e,r=n.selection;if(r.ranges.length>1)return na.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return na.none;let e=n.wordAt(i.head);if(!e)return na.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return na.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(ow(o,n,i.from,i.to)&&sw(o,n,i.from,i.to)))return na.none}else if(a=n.sliceDoc(i.from,i.to),!a)return na.none}let s=[];for(let r of e.visibleRanges){let e=new GC(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||ow(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(aw.range(r,a)):(r>=i.to||a<=i.from)&&s.push(iw.range(r,a)),s.length>t.maxMatches))return na.none}}return na.set(s)}},{decorations:e=>e.decorations}),lw=Y.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),uw=({state:e,dispatch:t})=>{let{selection:n}=e,r=K.create(n.ranges.map(t=>e.wordAt(t.head)||K.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function dw(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new GC(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new GC(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var fw=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return uw({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=dw(e,r);return i?(t(e.update({selection:e.selection.addRange(K.range(i.from,i.to),!1),effects:Y.scrollIntoView(i.to)})),!0):!1},pw=q.define({combine(e){return ei(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Jw(e),scrollToMatch:e=>Y.scrollIntoView(e)})}});function mw(e){return e?[pw.of(e),eT]:eT}var hw=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||QC(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
743
|
-
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Ew(this):new bw(this)}getCursor(e,t=0,n){let r=e.doc?e:$r.create({doc:e});return n??=r.doc.length,this.regexp?Sw(this,r,t,n):vw(this,r,t,n)}},gw=class{constructor(e){this.spec=e}};function _w(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function vw(e,t,n,r){let i;return e.wholeWord&&(i=yw(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=_w(e.test,t,i)),new GC(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function yw(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(Cw(i,n-a))!=Jr.Word||t(ww(i,n-a))!=Jr.Word)&&(t(ww(i,r-a))!=Jr.Word||t(Cw(i,r-a))!=Jr.Word))}var bw=class extends gw{constructor(e){super(e)}nextMatch(e,t,n){let r=vw(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=vw(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=vw(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=vw(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=vw(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function xw(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function Sw(e,t,n,r){let i;return e.wholeWord&&(i=Tw(t.charCategorizer(t.selection.main.head))),e.test&&(i=xw(e.test,t,i)),new JC(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function Cw(e,t){return e.slice(Kn(e,t,!1),t)}function ww(e,t){return e.slice(t,Kn(e,t))}function Tw(e){return(t,n,r)=>!r[0].length||(e(Cw(r.input,r.index))!=Jr.Word||e(ww(r.input,r.index))!=Jr.Word)&&(e(ww(r.input,r.index+r[0].length))!=Jr.Word||e(Cw(r.input,r.index+r[0].length))!=Jr.Word)}var Ew=class extends gw{nextMatch(e,t,n){let r=Sw(this.spec,e,n,e.doc.length).next();return r.done&&(r=Sw(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=Sw(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=Sw(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Sw(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},Dw=Rr.define(),Ow=Rr.define(),kw=_r.define({create(e){return new Aw(Hw(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Dw)?e=new Aw(n.value.create(),e.panel):n.is(Ow)&&(e=new Aw(e.query,n.value?Vw:null));return e},provide:e=>nd.from(e,e=>e.panel)}),Aw=class{constructor(e,t){this.query=e,this.panel=t}},jw=na.mark({class:`cm-searchMatch`}),Mw=na.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Nw=To.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(kw))}update(e){let t=e.state.field(kw);(t!=e.startState.field(kw)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return na.none;let{view:n}=this,r=new ci;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Mw:jw)})}return r.finish()}},{decorations:e=>e.decorations});function Pw(e){return t=>{let n=t.state.field(kw,!1);return n&&n.query.spec.valid?e(t,n):Gw(t)}}var Fw=Pw((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=K.single(r.from,r.to),a=e.state.facet(pw);return e.dispatch({selection:i,effects:[Qw(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Ww(e),!0}),Iw=Pw((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=K.single(i.from,i.to),o=e.state.facet(pw);return e.dispatch({selection:a,effects:[Qw(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Ww(e),!0}),Lw=Pw((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:K.create(n.map(e=>K.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Rw=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new GC(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(K.range(t.value.from,t.value.to))}return t(e.update({selection:K.create(a,o),userEvent:`select.search.matches`})),!0},zw=Pw((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),u.push(Y.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=K.single(o.from,o.to).map(d),u.push(Qw(e,o)),u.push(n.facet(pw).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Bw=Pw((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:Y.announce.of(r),userEvent:`input.replace.all`}),!0});function Vw(e){return e.state.facet(pw).createPanel(e)}function Hw(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(pw);return new hw({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Uw(e){let t=Qu(e,Vw);return t&&t.dom.querySelector(`[main-field]`)}function Ww(e){let t=Uw(e);t&&t==e.root.activeElement&&t.select()}var Gw=e=>{let t=e.state.field(kw,!1);if(t&&t.panel){let n=Uw(e);if(n&&n!=e.root.activeElement){let r=Hw(e.state,t.query.spec);r.valid&&e.dispatch({effects:Dw.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Ow.of(!0),t?Dw.of(Hw(e.state,t.query.spec)):Rr.appendConfig.of(eT)]});return!0},Kw=e=>{let t=e.state.field(kw,!1);if(!t||!t.panel)return!1;let n=Qu(e,Vw);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Ow.of(!1)}),!0},qw=[{key:`Mod-f`,run:Gw,scope:`editor search-panel`},{key:`F3`,run:Fw,shift:Iw,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Fw,shift:Iw,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Kw,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Rw},{key:`Mod-Alt-g`,run:ew},{key:`Mod-d`,run:fw,preventDefault:!0}],Jw=class{constructor(e){this.view=e;let t=this.query=e.state.field(kw).query.spec;this.commit=this.commit.bind(this),this.searchField=Fi(`input`,{value:t.search,placeholder:Yw(e,`Find`),"aria-label":Yw(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=Fi(`input`,{value:t.replace,placeholder:Yw(e,`Replace`),"aria-label":Yw(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=Fi(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=Fi(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=Fi(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return Fi(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=Fi(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>Fw(e),[Yw(e,`next`)]),n(`prev`,()=>Iw(e),[Yw(e,`previous`)]),n(`select`,()=>Lw(e),[Yw(e,`all`)]),Fi(`label`,null,[this.caseField,Yw(e,`match case`)]),Fi(`label`,null,[this.reField,Yw(e,`regexp`)]),Fi(`label`,null,[this.wordField,Yw(e,`by word`)]),...e.state.readOnly?[]:[Fi(`br`),this.replaceField,n(`replace`,()=>zw(e),[Yw(e,`replace`)]),n(`replaceAll`,()=>Bw(e),[Yw(e,`replace all`)])],Fi(`button`,{name:`close`,onclick:()=>Kw(e),"aria-label":Yw(e,`close`),type:`button`},[`×`])])}commit(){let e=new hw({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Dw.of(e)}))}keydown(e){Wl(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Iw:Fw)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),zw(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(Dw)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(pw).top}};function Yw(e,t){return e.state.phrase(t)}var Xw=30,Zw=/[\s\.,:;?!]/;function Qw(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-Xw),o=Math.min(i,n+Xw),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Xw;e++)if(!Zw.test(s[e+1])&&Zw.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Xw;e--)if(!Zw.test(s[e-1])&&Zw.test(s[e])){s=s.slice(0,e);break}}return Y.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var $w=Y.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),eT=[kw,br.low(Nw),$w],tT=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},nT=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(yT).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new ci,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=jT(s);if(i)o.add(n,n,na.widget({widget:new wT(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,na.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,rT(f))}};function rT(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new tT(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new tT(r.from,n,r.diagnostic)}),r}function iT(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(yT).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(sT))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function aT(e,t){return e.field(uT,!1)?t:t.concat(Rr.appendConfig.of(NT))}function oT(e,t){return{effects:aT(e,[sT.of(t)])}}var sT=Rr.define(),cT=Rr.define(),lT=Rr.define(),uT=_r.define({create(){return new nT(na.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=rT(n,e.selected.diagnostic,i)||rT(n,null,i)}!n.size&&i&&t.state.facet(yT).autoPanel&&(i=null),e=new nT(n,i,r)}for(let n of t.effects)if(n.is(sT)){let r=t.state.facet(yT).autoPanel?n.value.length?ET.open:null:e.panel;e=nT.init(n.value,r,t.state)}else n.is(cT)?e=new nT(e.diagnostics,n.value?ET.open:null,e.selected):n.is(lT)&&(e=new nT(e.diagnostics,e.panel,n.value));return e},provide:e=>[nd.from(e,e=>e.panel),Y.decorations.from(e,e=>e.diagnostics)]}),dT=na.mark({class:`cm-lintRange cm-lintRange-active`});function fT(e,t,n){let{diagnostics:r}=e.state.field(uT),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(yT).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:pT(e,i)}}}:null}function pT(e,t){return Fi(`ul`,{class:`cm-tooltip-lint`},t.map(t=>CT(e,t,!1)))}var mT=e=>{let t=e.state.field(uT,!1);(!t||!t.panel)&&e.dispatch({effects:aT(e.state,[cT.of(!0)])});let n=Qu(e,ET.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},hT=e=>{let t=e.state.field(uT,!1);return!t||!t.panel?!1:(e.dispatch({effects:cT.of(!1)}),!0)},gT=[{key:`Mod-Shift-m`,run:mT,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(uT,!1);if(!t)return!1;let n=e.state.selection.main,r=rT(t.diagnostics,null,n.to+1);return!r&&(r=rT(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),Ju(e,r.from,1,{tooltip:MT,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),!0)}}],_T=To.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(yT);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(yT);t.length&&vT(t.map(e=>Promise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(oT(this.view.state,t.reduce((e,t)=>e.concat(t))))},e=>{xo(this.view.state,e)})}}update(e){let t=e.state.facet(yT);(e.docChanged||t!=e.startState.facet(yT)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function vT(e,t,n){let r=[],i=-1;for(let a of e)a.then(n=>{r.push(n),clearTimeout(i),r.length==e.length?t(r):i=setTimeout(()=>t(r),200)},n)}var yT=q.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...ei(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:bT,tooltipFilter:bT,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function bT(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function xT(e,t={}){return[yT.of({source:e,config:t}),_T,NT]}function ST(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function CT(e,t,n){let r=n?ST(t.actions):[];return Fi(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},Fi(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=rT(e.state.field(uT).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),Fi(`u`,s.slice(c,c+1)),s.slice(c+1)];return Fi(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&Fi(`div`,{class:`cm-diagnosticSource`},t.source))}var wT=class extends ea{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Fi(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},TT=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=CT(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},ET=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)hT(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=ST(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=rT(this.view.state.field(uT).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=Fi(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=Fi(`div`,{class:`cm-panel-lint`},this.list,Fi(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>hT(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(uT).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(uT),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new TT(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new TT(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=rT(this.view.state.field(uT).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:lT.of(t)})}static open(t){return new e(t)}};function DT(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function OT(e){return DT(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var kT=Y.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:OT(`#f11`)},".cm-lintRange-warning":{backgroundImage:OT(`orange`)},".cm-lintRange-info":{backgroundImage:OT(`#999`)},".cm-lintRange-hint":{backgroundImage:OT(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function AT(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function jT(e){let t=`hint`,n=1;for(let r of e){let e=AT(r.severity);e>n&&(n=e,t=r.severity)}return t}var MT=qu(fT,{hideOn:iT}),NT=[uT,Y.decorations.compute([uT],e=>{let{selected:t,panel:n}=e.field(uT);return!t||!n||t.from==t.to?na.none:na.set([dT.range(t.from,t.to)])}),MT,kT],PT=Y.theme({"&":{height:`100%`,fontSize:`12px`,backgroundColor:`var(--bg3, #1a1a2e)`,color:`var(--text, #e2e8f0)`},".cm-content":{fontFamily:`'SF Mono', Monaco, 'Cascadia Code', 'Fira Code', monospace`,padding:`8px 0`,caretColor:`#6366f1`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`#6366f1`,borderLeftWidth:`2px`},".cm-selectionBackground, .cm-content ::selection":{backgroundColor:`rgba(99, 102, 241, 0.3) !important`},".cm-activeLine":{backgroundColor:`rgba(255, 255, 255, 0.03)`},".cm-activeLineGutter":{backgroundColor:`rgba(255, 255, 255, 0.05)`,color:`#6366f1`},".cm-gutters":{backgroundColor:`rgba(0, 0, 0, 0.2)`,color:`rgba(255, 255, 255, 0.2)`,border:`none`,borderRight:`1px solid rgba(255, 255, 255, 0.06)`},".cm-lineNumbers .cm-gutterElement":{padding:`0 8px 0 4px`,minWidth:`32px`,fontSize:`10px`},".cm-foldGutter .cm-gutterElement":{padding:`0 4px`,cursor:`pointer`,color:`rgba(255, 255, 255, 0.15)`},".cm-foldGutter .cm-gutterElement:hover":{color:`#6366f1`},"&.cm-focused .cm-matchingBracket":{backgroundColor:`rgba(99, 102, 241, 0.4)`,outline:`1px solid rgba(99, 102, 241, 0.6)`},".cm-searchMatch":{backgroundColor:`rgba(250, 204, 21, 0.3)`,outline:`1px solid rgba(250, 204, 21, 0.5)`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`rgba(250, 204, 21, 0.5)`},".cm-selectionMatch":{backgroundColor:`rgba(99, 102, 241, 0.15)`},".cm-tooltip":{backgroundColor:`var(--bg2, #16162a)`,border:`1px solid var(--border, #2a2a4a)`,borderRadius:`8px`,boxShadow:`0 8px 24px rgba(0,0,0,0.4)`},".cm-tooltip-autocomplete":{"& > ul > li":{padding:`4px 8px`,fontSize:`11px`},"& > ul > li[aria-selected]":{backgroundColor:`rgba(99, 102, 241, 0.2)`,color:`#fff`}},".cm-panels":{backgroundColor:`var(--bg2, #16162a)`,borderBottom:`1px solid var(--border, #2a2a4a)`,color:`var(--text, #e2e8f0)`},".cm-panel.cm-search":{padding:`6px 10px`,fontSize:`12px`},".cm-panel.cm-search input":{backgroundColor:`var(--bg3, #1a1a2e)`,border:`1px solid var(--border2, #333)`,borderRadius:`4px`,color:`var(--text, #e2e8f0)`,padding:`3px 6px`,fontSize:`11px`},".cm-panel.cm-search button":{backgroundColor:`var(--bg3, #1a1a2e)`,border:`1px solid var(--border2, #333)`,borderRadius:`4px`,color:`var(--dim, #888)`,padding:`3px 8px`,fontSize:`10px`,cursor:`pointer`},".cm-panel.cm-search button:hover":{borderColor:`#6366f1`,color:`#6366f1`},".cm-scroller::-webkit-scrollbar":{width:`12px`},".cm-scroller::-webkit-scrollbar-track":{background:`rgba(0,0,0,0.1)`},".cm-scroller::-webkit-scrollbar-thumb":{background:`rgba(99, 102, 241, 0.2)`,borderRadius:`6px`,border:`2px solid transparent`,backgroundClip:`content-box`},".cm-scroller::-webkit-scrollbar-thumb:hover":{background:`rgba(99, 102, 241, 0.4)`}},{dark:!0});function FT(e){switch((e.split(`.`).pop()||``).toLowerCase()){case`js`:case`mjs`:case`jsx`:return Pb({jsx:!0});case`ts`:case`tsx`:return Pb({jsx:!0,typescript:!0});case`html`:case`htm`:return bC();case`css`:return KS();case`json`:return EC();default:return Pb()}}function IT({value:e,filename:t,readOnly:n=!1,onChange:r,onSave:i,projectName:a,className:o}){let s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(r),u=(0,_.useRef)(i),d=(0,_.useRef)(a),f=(0,_.useRef)(t),p=(0,_.useRef)(!1);return l.current=r,u.current=i,d.current=a,f.current=t,(0,_.useEffect)(()=>()=>{c.current&&=(c.current.destroy(),null)},[]),(0,_.useEffect)(()=>{if(!s.current)return;c.current&&=(c.current.destroy(),null);let r=Vl.of([{key:`Mod-s`,run:e=>(u.current?.(e.state.doc.toString()),!0)}]),i=Y.updateListener.of(e=>{e.docChanged&&!p.current&&l.current?.(e.state.doc.toString())}),a=xT(async e=>{if(!d.current)return[];try{let t=await fetch(`/api/studio/webcraft/lint`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectName:d.current,path:f.current})});if(!t.ok)return[];let{diagnostics:n}=await t.json();if(!n?.length)return[];let r=e.state.doc;return n.map(e=>{let t=Math.min(e.from.line,r.lines),n=r.line(t),i=n.from,a=n.text,o=Math.min(e.from.col,a.length),s=i+o,c=a.slice(o).match(/^[\w$]+/),l=c?c[0].length:Math.max(1,a.trimEnd().length-o);return{from:s,to:Math.min(s+Math.max(l,1),r.length),severity:e.severity,message:e.message}})}catch{return[]}},{delay:2e3}),o=[kd(),Nd(),_u(),uh(),hm(),au(),mu(),Tu(),Ou(),Vp(),Pm(),Yy(),fb(),rw(),mw({top:!0}),gu(),FT(t),xm(wm,{fallback:!0}),Vl.of([...tb,...__,...qw,...kh,...om,...pb,...gT,v_]),r,UC,PT,a,i,$r.tabSize.of(2)];n&&(o.push($r.readOnly.of(!0)),o.push(Y.editable.of(!1))),c.current=new Y({state:$r.create({doc:e,extensions:o}),parent:s.current})},[t,n]),(0,_.useEffect)(()=>{let t=c.current;if(!t)return;let n=t.state.doc.toString();n!==e&&(p.current=!0,t.dispatch({changes:{from:0,to:n.length,insert:e}}),p.current=!1)},[e]),(0,A.jsx)(`div`,{ref:s,className:o,style:{flex:1,minHeight:0,overflow:`hidden`}})}var LT={tree:`_tree_kg9rf_1`,header:`_header_kg9rf_9`,headerTitle:`_headerTitle_kg9rf_17`,headerCount:`_headerCount_kg9rf_18`,body:`_body_kg9rf_20`,dirRow:`_dirRow_kg9rf_27`,arrow:`_arrow_kg9rf_38`,dirIcon:`_dirIcon_kg9rf_39`,dirName:`_dirName_kg9rf_40`,dirCount:`_dirCount_kg9rf_41`,fileRow:`_fileRow_kg9rf_44`,fileRowActive:`_fileRowActive_kg9rf_55`,fileRowError:`_fileRowError_kg9rf_60`,fileIcon:`_fileIcon_kg9rf_62`,fileName:`_fileName_kg9rf_63`,unsavedDot:`_unsavedDot_kg9rf_70`,errorDot:`_errorDot_kg9rf_71`},RT={js:`📄`,mjs:`📄`,ts:`📘`,tsx:`📘`,jsx:`📄`,css:`🎨`,html:`🌐`,htm:`🌐`,json:`📋`,md:`📑`,env:`🔐`,gitignore:`⚙`,lock:`🔒`,svg:`🖼`,png:`🖼`,jpg:`🖼`,ico:`🖼`,txt:`📝`,log:`📝`,sql:`🗂`,sh:`⚙`};function zT(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return e.startsWith(`.env`)?`🔐`:e===`.gitignore`?`⚙`:RT[t]??`📄`}function BT(e,t,n){let r=[];e.forEach((e,i)=>{let a=e.name.split(`/`),o=r;for(let r=0;r<a.length;r++){let s=a[r],c=r===a.length-1,l=a.slice(0,r+1).join(`/`),u=o.find(e=>e.name===s&&e.isDir===!c);u||(u={name:s,fullPath:l,isDir:!c,fileIndex:c?i:void 0,children:[],hasError:c?e._error||!!e._syntaxError||(n?.has(e.name)??!1):!1,hasPending:c?e._pending:!1,hasUnsaved:c?t.has(e.name):!1},o.push(u)),c||(o=u.children)}});let i=e=>{e.sort((e,t)=>e.isDir===t.isDir?e.name.localeCompare(t.name):e.isDir?-1:1),e.forEach(e=>{e.isDir&&i(e.children)})};return i(r),r}function VT({node:e,depth:t,activeIndex:n,onSelect:r,expandedDirs:i,toggleDir:a}){let o=i.has(e.fullPath),s=e.fileIndex===n;return e.isDir?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:LT.dirRow,style:{paddingLeft:t*14+6},onClick:()=>a(e.fullPath),children:[(0,A.jsx)(`span`,{className:LT.arrow,children:o?`▼`:`▶`}),(0,A.jsx)(`span`,{className:LT.dirIcon,children:o?`📂`:`📁`}),(0,A.jsx)(`span`,{className:LT.dirName,children:e.name}),(0,A.jsx)(`span`,{className:LT.dirCount,children:e.children.length})]}),o&&e.children.map(e=>(0,A.jsx)(VT,{node:e,depth:t+1,activeIndex:n,onSelect:r,expandedDirs:i,toggleDir:a},e.fullPath))]}):(0,A.jsxs)(`div`,{className:`${LT.fileRow} ${s?LT.fileRowActive:``} ${e.hasError?LT.fileRowError:``}`,style:{paddingLeft:t*14+6},onClick:()=>e.fileIndex!==void 0&&r(e.fileIndex),children:[(0,A.jsx)(`span`,{className:LT.fileIcon,children:e.hasPending?`⌛`:e.hasError?`⚠`:zT(e.name)}),(0,A.jsx)(`span`,{className:LT.fileName,children:e.name}),e.hasUnsaved&&(0,A.jsx)(`span`,{className:LT.unsavedDot,children:`●`}),e.hasError&&(0,A.jsx)(`span`,{className:LT.errorDot})]})}function HT({files:e,activeIndex:t,unsavedFiles:n,onSelect:r,errorFiles:i}){let[a,o]=(0,_.useState)(new Set),s=(0,_.useMemo)(()=>BT(e,n,i),[e,n,i]);(0,_.useMemo)(()=>{let e=new Set,t=n=>{n.forEach(n=>{n.isDir&&(e.add(n.fullPath),t(n.children))})};t(s),e.size>0&&a.size===0&&o(e)},[s]);let c=e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,A.jsxs)(`div`,{className:LT.tree,children:[(0,A.jsxs)(`div`,{className:LT.header,children:[(0,A.jsx)(`span`,{className:LT.headerTitle,children:`FILES`}),(0,A.jsx)(`span`,{className:LT.headerCount,children:e.length})]}),(0,A.jsx)(`div`,{className:LT.body,children:s.map(e=>(0,A.jsx)(VT,{node:e,depth:0,activeIndex:t,onSelect:r,expandedDirs:a,toggleDir:c},e.fullPath))})]})}var UT=o(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(self,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(6114),s=n(9924),c=n(844),l=n(5596),u=n(4725),d=n(3656),f=t.AccessibilityManager=class extends c.Disposable{constructor(e,t){super(),this._terminal=e,this._renderService=t,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=document.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=document.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._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new s.TimeBasedDebouncer(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(`
|
|
744
|
-
`)))),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._screenDprMonitor=new l.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,d.addDisposableDomListener)(window,`resize`,(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,c.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
745
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)),o.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0,o.isMac&&this._liveRegion.remove()}_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.translateBufferLineToString(n.ydisp+i,!0),t=(n.ydisp+i+1).toString(),a=this._rowElements[i];a&&(e.length===0?a.innerText=`\xA0`:a.textContent=e,a.setAttribute(`aria-posinset`,t),a.setAttribute(`aria-setsize`,r))}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()}_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=document.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}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])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=f=r([i(1,u.IRenderService)],f)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(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()}Object.defineProperty(t,`__esModule`,{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}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()}}},3656:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},6465:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.Linkifier2=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=t.Linkifier2=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{let t=this._linkProviders.indexOf(e);t!==-1&&this._linkProviders.splice(t,1)}}}attachToDom(e,t,n){this._element=e,this._mouseService=t,this._renderService=n,this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;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)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var n,r;this._activeProviderReplies&&t||((n=this._activeProviderReplies)==null||n.forEach((e=>{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,a]of this._linkProviders.entries())t?(r=this._activeProviderReplies)!=null&&r.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):a.provideLinks(e.y,(t=>{var r;if(this._isMouseOut)return;let a=t?.map((e=>({link:e})));(r=this._activeProviderReplies)==null||r.set(n,a),i=this._checkLinkProviderResult(n,e,i),this._activeProviderReplies?.size===this._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._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._element||!this._mouseService||!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._element&&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,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)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=>{var t,n;(t=this._currentLink)!=null&&t.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&((n=this._element)==null||n.classList.toggle(`xterm-cursor-pointer`,e)))}},underline:{get:()=>(this._currentLink?.state)?.decorations.underline,set:t=>{var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink?.state)?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&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&&this._element)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.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){var r;(r=this._currentLink)!=null&&r.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}}};t.Linkifier2=l=r([i(0,c.IBufferService)],l)},9042:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=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)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>(i?.hover)?.call(i,e,t,a),leave:(e,t)=>(i?.leave)?.call(i,e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: 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`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._parentWindow=e,this._renderCallback=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._parentWindow.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._parentWindow.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._parentWindow.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();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=[]}}},5596:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ScreenDprMonitor=void 0;let r=n(844);class i extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,r.toDisposable)((()=>{this.clearListener()})))}setListener(e){this._listener&&this.clearListener(),this._listener=e,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}t.ScreenDprMonitor=i},3236:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(6465),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),ee=n(6114),T=n(8437),te=n(2584),ne=n(7399),E=n(5941),D=n(9074),O=n(2585),re=n(5435),k=n(4567),ie=typeof window<`u`?window.document:null;class A extends S.CoreTerminal{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}constructor(e={}){super(e),this.browser=ee,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(a.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(D.DecorationService),this._instantiationService.setService(O.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),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((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{var e;this._customKeyEventHandler=void 0,(e=this.element?.parentNode)==null||e.removeChild(this.element)})))}_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=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${te.C0.ESC}]${n};${(0,E.toRgbString)(r)}${te.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.rgba.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.rgba.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(k.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(te.C0.ESC+`[I`),this.updateCursorStyle(e),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(te.C0.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((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),ee.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),ee.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(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.`);e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this._document=e.ownerDocument,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=ie.createDocumentFragment();this._viewportElement=ie.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=ie.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=ie.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._helperContainer=ie.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=ie.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),ee.isChromeOS||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._coreBrowserService=this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,this._document.defaultView??window),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=ie.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(y.ISelectionService,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(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(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(k.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}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=1&t.buttons?0:4&t.buttons?1:2&t.buttons?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.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&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},a={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()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=(t.addEventListener(`mouseup`,a.mouseup),a.mouseup):(this._document.removeEventListener(`mouseup`,r.mouseup),t.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(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((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=te.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.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,n=0){var r;n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):(r=this.viewport)==null||r.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}registerLinkProvider(e){return this.linkifier2.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}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(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))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(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,ne.evaluateKeyboardEvent)(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)}return 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)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==te.C0.ETX&&n.key!==te.C0.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?this.cancel(e,!0):void(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&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))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)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){var n,r;(n=this._charSizeService)==null||n.measure(),(r=this.viewport)==null||r.syncScrollArea(!0)}clear(){var e;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(T.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(e=this.viewport)==null||e.reset(),this.refresh(0,this.rows-1)}}reset(){var e,t;this.options.rows=this.rows,this.options.cols=this.cols;let n=this._customKeyEventHandler;this._setup(),super.reset(),(e=this._selectionService)==null||e.reset(),this._decorationService.reset(),(t=this.viewport)==null||t.reset(),this._customKeyEventHandler=n,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(te.C0.ESC+`[I`):this.coreService.triggerDataEvent(te.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case re.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${te.C0.ESC}[4;${t};${e}t`);break;case re.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${te.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=A},9924:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){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=Date.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=Date.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)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0)if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(3656),o=n(4725),s=n(844),c=n(2585),l=t.BufferDecorationRenderer=class extends s.Disposable{constructor(e,t,n,r){super(),this._screenElement=e,this._bufferService=t,this._decorationService=n,this._renderService=r,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((0,a.addDisposableDomListener)(window,`resize`,(()=>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((0,s.toDisposable)((()=>{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=document.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.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,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){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=l=r([i(1,c.IBufferService),i(2,c.IDecorationService),i(3,o.IRenderService)],l)},5871:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=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))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return 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,void this._zones.push(this._zonePool[this._zonePoolIndex++]);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)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(3656),s=n(4725),c=n(844),l=n(2585),u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0},p=t.OverviewRulerRenderer=class extends c.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,s){var l;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowseService=s,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),(l=this._viewportElement.parentElement)==null||l.insertBefore(this._canvas,this._viewportElement);let u=this._canvas.getContext(`2d`);if(!u)throw Error(`Ctx cannot be null`);this._ctx=u,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,c.toDisposable)((()=>{var e;(e=this._canvas)==null||e.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register((0,o.addDisposableDomListener)(this._coreBrowseService.window,`resize`,(()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=e,d.center=t,d.right=e,this._refreshDrawHeightConstants(),f.full=0,f.left=0,f.center=d.left,f.right=d.left+d.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowseService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowseService.dpr);u.left=t,u.center=t,u.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.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._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.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;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}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(f[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-u[e.position||`full`]/2),d[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=p=r([i(2,l.IBufferService),i(3,l.IDecorationService),i(4,s.IRenderService),i(5,l.IOptionsService),i(6,s.ICoreBrowserService)],p)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}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=``}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===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){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):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(`${s.C0.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)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,`__esModule`,{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1,c=n.buffer.lines.get(i+s*a);c!=null&&c.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(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 o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)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 c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(4725),u=n(8055),d=n(8460),f=n(844),p=n(2585),m=`xterm-dom-renderer-owner-`,h=`xterm-rows`,g=`xterm-fg-`,_=`xterm-bg-`,v=`xterm-focus`,y=`xterm-selection`,b=1,x=t.DomRenderer=class extends f.Disposable{constructor(e,t,n,r,i,s,l,u,p,g){super(),this._element=e,this._screenElement=t,this._viewportElement=n,this._linkifier2=r,this._charSizeService=s,this._optionsService=l,this._bufferService=u,this._coreBrowserService=p,this._themeService=g,this._terminalClass=b++,this._rowElements=[],this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=document.createElement(`div`),this._rowContainer.classList.add(h),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement(`div`),this._selectionContainer.classList.add(y),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),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=i.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(m+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((0,f.toDisposable)((()=>{this._element.classList.remove(m+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(document),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=document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${h} 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=document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${h} { 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} .${h} .xterm-dim { color: ${u.color.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;}`,t+=`@keyframes blink_box_shadow_`+this._terminalClass+` { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes blink_block_`+this._terminalClass+` { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${h}.${v} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${h}.${v} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${h} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${h} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${h} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${h} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${y} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${y} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${g}${n} { color: ${r.css}; }${this._terminalSelector} .${g}${n}.xterm-dim { color: ${u.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${_}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${g}${s.INVERTED_DEFAULT_COLOR} { color: ${u.color.opaque(e.background).css}; }${this._terminalSelector} .${g}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${u.color.multiplyOpacity(u.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { 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=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()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(v)}handleFocus(){this._rowContainer.classList.add(v),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)return;let r=e[1]-this._bufferService.buffer.ydisp,i=t[1]-this._bufferService.buffer.ydisp,a=Math.max(r,0),o=Math.min(i,this._bufferService.rows-1);if(a>=this._bufferService.rows||o<0)return;let s=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=document.createElement(`div`);return i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=t*this.dimensions.css.cell.width+`px`,i.style.width=this.dimensions.css.cell.width*(n-t)+`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._optionsService.rawOptions.cursorBlink,o=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`.${m}${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))}}};t.DomRenderer=x=r([i(4,p.IInstantiationService),i(5,l.ICharSizeService),i(6,p.IOptionsService),i(7,p.IBufferService),i(8,l.ICoreBrowserService),i(9,l.IThemeService)],x)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=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 s.CellData,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,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,ee=0,T=0,te=!1,ne=0,E=!1,D=0,O=[],re=m!==-1&&g!==-1;for(let k=0;k<x;k++){e.loadCell(k,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let ie=!1,A=k,j=this._workCell;if(v.length>0&&k===v[0][0]){ie=!0;let t=v.shift();j=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),A=t[1]-1,x=j.getWidth()}let ae=this._isCellInSelection(k,t),oe=n&&k===s,se=re&&k>=m&&k<=g,ce=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,(e=>{ce=!0}));let le=j.getChars()||o.WHITESPACE_CELL_CHAR;if(le===` `&&(j.isUnderline()||j.isOverline())&&(le=`\xA0`),D=x*u-f.get(le,j.isBold(),j.isItalic()),b){if(S&&(ae&&E||!ae&&!E&&j.bg===w)&&(ae&&E&&y.selectionForeground||j.fg===ee)&&j.extended.ext===T&&se===te&&D===ne&&!oe&&!ie&&!ce){C+=le,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=j.bg,ee=j.fg,T=j.extended.ext,te=se,ne=D,E=ae,ie&&s>=k&&s<=A&&(s=k),!this._coreService.isCursorHidden&&oe){if(O.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&O.push(`xterm-cursor-blink`),O.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:O.push(`xterm-cursor-outline`);break;case`block`:O.push(`xterm-cursor-block`);break;case`bar`:O.push(`xterm-cursor-bar`);break;case`underline`:O.push(`xterm-cursor-underline`)}}if(j.isBold()&&O.push(`xterm-bold`),j.isItalic()&&O.push(`xterm-italic`),j.isDim()&&O.push(`xterm-dim`),C=j.isInvisible()?o.WHITESPACE_CELL_CHAR:j.getChars()||o.WHITESPACE_CELL_CHAR,j.isUnderline()&&(O.push(`xterm-underline-${j.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!j.isUnderlineColorDefault()))if(j.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(j.getUnderlineColor()).join(`,`)})`;else{let e=j.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&j.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}j.isOverline()&&(O.push(`xterm-overline`),C===` `&&(C=`\xA0`)),j.isStrikethrough()&&O.push(`xterm-strikethrough`),se&&(b.style.textDecoration=`underline`);let ue=j.getFgColor(),M=j.getFgColorMode(),N=j.getBgColor(),de=j.getBgColorMode(),fe=!!j.isInverse();if(fe){let e=ue;ue=N,N=e;let t=M;M=de,de=t}let pe,me,he,ge=!1;switch(this._decorationService.forEachDecorationAtCell(k,t,void 0,(e=>{e.options.layer!==`top`&&ge||(e.backgroundColorRGB&&(de=50331648,N=e.backgroundColorRGB.rgba>>8&16777215,pe=e.backgroundColorRGB),e.foregroundColorRGB&&(M=50331648,ue=e.foregroundColorRGB.rgba>>8&16777215,me=e.foregroundColorRGB),ge=e.options.layer===`top`)})),!ge&&ae&&(pe=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,N=pe.rgba>>8&16777215,de=50331648,ge=!0,y.selectionForeground&&(M=50331648,ue=y.selectionForeground.rgba>>8&16777215,me=y.selectionForeground)),ge&&O.push(`xterm-decoration-top`),de){case 16777216:case 33554432:he=y.ansi[N],O.push(`xterm-bg-${N}`);break;case 50331648:he=l.rgba.toColor(N>>16,N>>8&255,255&N),this._addStyle(b,`background-color:#${h((N>>>0).toString(16),`0`,6)}`);break;default:fe?(he=y.foreground,O.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):he=y.background}switch(pe||j.isDim()&&(pe=l.color.multiplyOpacity(he,.5)),M){case 16777216:case 33554432:j.isBold()&&ue<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ue+=8),this._applyMinimumContrast(b,he,y.ansi[ue],j,pe,void 0)||O.push(`xterm-fg-${ue}`);break;case 50331648:let e=l.rgba.toColor(ue>>16&255,ue>>8&255,255&ue);this._applyMinimumContrast(b,he,e,j,pe,me)||this._addStyle(b,`color:#${h(ue.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,he,y.foreground,j,pe,void 0)||fe&&O.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}O.length&&=(b.className=O.join(` `),0),oe||ie||ce?b.textContent=C:S++,D!==this.defaultSpacing&&(b.style.letterSpacing=`${D}px`),_.push(b),k=A}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.excludeFromContrastRatioDemands)(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=l.color.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)}_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)&&(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])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e){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.style.position=`absolute`,this._container.style.top=`-50000px`,this._container.style.width=`50000px`,this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let t=e.createElement(`span`),n=e.createElement(`span`);n.style.fontWeight=`bold`;let r=e.createElement(`span`);r.style.fontStyle=`italic`;let i=e.createElement(`span`);i.style.fontWeight=`bold`,i.style.fontStyle=`italic`,this._measureElements=[t,n,r,i],this._container.appendChild(t),this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),e.body.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)return this._flat[r]===-9999?this._flat[r]=this._measure(e,0):this._flat[r];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),this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}Object.defineProperty(t,`__esModule`,{value:!0}),t.createRenderDimensions=t.excludeFromContrastRatioDemands=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.excludeFromContrastRatioDemands=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}},456:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SelectionModel=void 0,t.SelectionModel=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.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)&&(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)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new l(e,t,this._optionsService),this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}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())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l{constructor(e,t,n){this._document=e,this._parentElement=t,this._optionsService=n,this._result={width:0,height:0},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(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;let e={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return e.width!==0&&e.height!==0&&(this._result.width=e.width/32,this._result.height=Math.ceil(e.height)),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{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()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}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,s=0,c=t.getFg(0),l=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!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[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)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreBrowserService=void 0,t.CoreBrowserService=class{constructor(e,t){this._textarea=e,this.window=t,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}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}}},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(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=(0,o.getCoordsRelativeToElement)(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])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.RenderService=void 0;let a=n(3656),o=n(6193),s=n(5596),c=n(4725),l=n(8460),u=n(844),d=n(7226),f=n(2585),p=t.RenderService=class extends u.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,c,f,p){if(super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new u.MutableDisposable),this._pausedResizeTask=new d.DebouncedIdleTask,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 l.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new l.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new l.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new l.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new o.RenderDebouncer(f.window,((e,t)=>this._renderRows(e,t))),this.register(this._renderDebouncer),this._screenDprMonitor=new s.ScreenDprMonitor(f.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(c.onResize((()=>this._fullRefresh()))),this.register(c.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`],(()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(c.buffer.y,c.buffer.y,!0)))),this.register((0,a.addDisposableDomListener)(f.window,`resize`,(()=>this.handleDevicePixelRatioChange()))),this.register(p.onChangeColors((()=>this._fullRefresh()))),`IntersectionObserver`in f.window){let e=new f.window.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});e.observe(t),this.register({dispose:()=>e.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){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(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.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(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),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(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};t.RenderService=p=r([i(2,f.IOptionsService),i(3,c.ICharSizeService),i(4,f.IDecorationService),i(5,f.IBufferService),i(6,c.ICoreBrowserService),i(7,c.IThemeService)],p)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),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 s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}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||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(h,` `))).join(d.isWindows?`\r
|
|
746
|
-
`:`
|
|
747
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh())),d.isLinux&&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)&&this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!(!n||!r)&&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=(0,f.getRangeLength)(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)}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=(0,a.getCoordsRelativeToElement)(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,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?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()),50)}_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&&!(d.isMac&&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)return void this.refresh(!0);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]++}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<500&&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=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);n?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,n)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((e=>this._handleTrim(e)))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,f.getRangeLength)(n,this._bufferService.cols)}};t.SelectionService=g=r([i(3,m.IBufferService),i(4,m.ICoreService),i(5,c.IMouseService),i(6,m.IOptionsService),i(7,c.IRenderService),i(8,c.ICoreBrowserService)],g)},4725:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;let r=n(8343);t.ICharSizeService=(0,r.createDecorator)(`CharSizeService`),t.ICoreBrowserService=(0,r.createDecorator)(`CoreBrowserService`),t.IMouseService=(0,r.createDecorator)(`MouseService`),t.IRenderService=(0,r.createDecorator)(`RenderService`),t.ISelectionService=(0,r.createDecorator)(`SelectionService`),t.ICharacterJoinerService=(0,r.createDecorator)(`CharacterJoinerService`),t.IThemeService=(0,r.createDecorator)(`ThemeService`)},6731:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;let a=n(7239),o=n(8055),s=n(8460),c=n(844),l=n(2585),u=o.css.toColor(`#ffffff`),d=o.css.toColor(`#000000`),f=o.css.toColor(`#ffffff`),p=o.css.toColor(`#000000`),m={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let e=[o.css.toColor(`#2e3436`),o.css.toColor(`#cc0000`),o.css.toColor(`#4e9a06`),o.css.toColor(`#c4a000`),o.css.toColor(`#3465a4`),o.css.toColor(`#75507b`),o.css.toColor(`#06989a`),o.css.toColor(`#d3d7cf`),o.css.toColor(`#555753`),o.css.toColor(`#ef2929`),o.css.toColor(`#8ae234`),o.css.toColor(`#fce94f`),o.css.toColor(`#729fcf`),o.css.toColor(`#ad7fa8`),o.css.toColor(`#34e2e2`),o.css.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:o.channels.toCss(r,i,a),rgba:o.channels.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+10*t;e.push({css:o.channels.toCss(n,n,n),rgba:o.channels.toRgba(n,n,n)})}return e})());let h=t.ThemeService=class extends c.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new s.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:f,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:m,selectionBackgroundOpaque:o.color.blend(d,m),selectionInactiveBackgroundTransparent:m,selectionInactiveBackgroundOpaque:o.color.blend(d,m),ansi:t.DEFAULT_ANSI_COLORS.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))))}_setTheme(e={}){let n=this._colors;if(n.foreground=g(e.foreground,u),n.background=g(e.background,d),n.cursor=g(e.cursor,f),n.cursorAccent=g(e.cursorAccent,p),n.selectionBackgroundTransparent=g(e.selectionBackground,m),n.selectionBackgroundOpaque=o.color.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=g(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=o.color.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?g(e.selectionForeground,o.NULL_COLOR):void 0,n.selectionForeground===o.NULL_COLOR&&(n.selectionForeground=void 0),o.color.isOpaque(n.selectionBackgroundTransparent)&&(n.selectionBackgroundTransparent=o.color.opacity(n.selectionBackgroundTransparent,.3)),o.color.isOpaque(n.selectionInactiveBackgroundTransparent)&&(n.selectionInactiveBackgroundTransparent=o.color.opacity(n.selectionInactiveBackgroundTransparent,.3)),n.ansi=t.DEFAULT_ANSI_COLORS.slice(),n.ansi[0]=g(e.black,t.DEFAULT_ANSI_COLORS[0]),n.ansi[1]=g(e.red,t.DEFAULT_ANSI_COLORS[1]),n.ansi[2]=g(e.green,t.DEFAULT_ANSI_COLORS[2]),n.ansi[3]=g(e.yellow,t.DEFAULT_ANSI_COLORS[3]),n.ansi[4]=g(e.blue,t.DEFAULT_ANSI_COLORS[4]),n.ansi[5]=g(e.magenta,t.DEFAULT_ANSI_COLORS[5]),n.ansi[6]=g(e.cyan,t.DEFAULT_ANSI_COLORS[6]),n.ansi[7]=g(e.white,t.DEFAULT_ANSI_COLORS[7]),n.ansi[8]=g(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),n.ansi[9]=g(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),n.ansi[10]=g(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),n.ansi[11]=g(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),n.ansi[12]=g(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),n.ansi[13]=g(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),n.ansi[14]=g(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),n.ansi[15]=g(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){let r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)n.ansi[i+16]=g(e.extendedAnsi[i],t.DEFAULT_ANSI_COLORS[i+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)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]}else for(let e=0;e<this._restoreColors.ansi.length;++e)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()}}};function g(e,t){if(e!==void 0)try{return o.css.toColor(e)}catch{}return t}t.ThemeService=h=r([i(0,l.IOptionsService)],h)},6349:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CircularList=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new r.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new r.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new r.EventEmitter),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}}t.CircularList=a},1439:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.clone=void 0,t.clone=function e(t,n=5){if(typeof t!=`object`)return t;let r=Array.isArray(t)?[]:{};for(let i in t)r[i]=n<=1?t[i]:t[i]&&e(t[i],n-1);return r}},8055:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let r=n(6114),i=0,a=0,o=0,s=0;var c,l,u,d,f;function p(e){let t=e.toString(16);return t.length<2?`0`+t:t}function m(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${p(e)}${p(t)}${p(n)}`:`#${p(e)}${p(t)}${p(n)}${p(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}}(c||(t.channels=c={})),function(e){function t(e,t){return s=Math.round(255*t),[i,a,o]=f.toChannels(e.rgba),{css:c.toCss(i,a,o,s),rgba:c.toRgba(i,a,o,s)}}e.blend=function(e,t){if(s=(255&t.rgba)/255,s===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return i=u+Math.round((n-u)*s),a=d+Math.round((r-d)*s),o=f+Math.round((l-f)*s),{css:c.toCss(i,a,o),rgba:c.toRgba(i,a,o)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=f.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return f.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[i,a,o]=f.toChannels(t),{css:c.toCss(i,a,o),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return s=255&e.rgba,t(e,s*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(l||(t.color=l={})),function(e){let t,n;if(!r.isNode){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))}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return i=parseInt(e.slice(1,2).repeat(2),16),a=parseInt(e.slice(2,3).repeat(2),16),o=parseInt(e.slice(3,4).repeat(2),16),f.toColor(i,a,o);case 5:return i=parseInt(e.slice(1,2).repeat(2),16),a=parseInt(e.slice(2,3).repeat(2),16),o=parseInt(e.slice(3,4).repeat(2),16),s=parseInt(e.slice(4,5).repeat(2),16),f.toColor(i,a,o,s);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 i=parseInt(r[1]),a=parseInt(r[2]),o=parseInt(r[3]),s=Math.round(255*(r[5]===void 0?1:parseFloat(r[5]))),f.toColor(i,a,o,s);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[i,a,o,s]=t.getImageData(0,0,1,1).data,s!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:c.toRgba(i,a,o,s),css:e}}}(u||(t.css=u={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(d||(t.rgb=d={})),function(e){function t(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=m(d.relativeLuminance2(o,s,c),d.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),l=m(d.relativeLuminance2(o,s,c),d.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function n(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=m(d.relativeLuminance2(o,s,c),d.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),l=m(d.relativeLuminance2(o,s,c),d.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.ensureContrastRatio=function(e,r,i){let a=d.relativeLuminance(e>>8),o=d.relativeLuminance(r>>8);if(m(a,o)<i){if(o<a){let o=t(e,r,i),s=m(a,d.relativeLuminance(o>>8));if(s<i){let t=n(e,r,i);return s>m(a,d.relativeLuminance(t>>8))?o:t}return o}let s=n(e,r,i),c=m(a,d.relativeLuminance(s>>8));if(c<i){let n=t(e,r,i);return c>m(a,d.relativeLuminance(n>>8))?s:n}return s}},e.reduceLuminance=t,e.increaseLuminance=n,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,n,r){return{css:c.toCss(e,t,n,r),rgba:c.toRgba(e,t,n,r)}}}(f||(t.rgba=f={})),t.toPaddedHex=p,t.contrastRatio=m},8969:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreTerminal=void 0;let r=n(844),i=n(2585),a=n(4348),o=n(7866),s=n(744),c=n(7302),l=n(6975),u=n(8460),d=n(1753),f=n(1480),p=n(7994),m=n(9282),h=n(5435),g=n(5981),_=n(2660),v=!1;class y extends r.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event((e=>{var t;(t=this._onScrollApi)==null||t.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]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new r.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new c.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(s.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(l.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(f.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(_.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new h.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new g.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!v&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),v=!0),this._writeBuffer.writeSync(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,s.MINIMUM_COLS),t=Math.max(t,s.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,n){this._bufferService.scrollLines(e,t,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){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(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},(()=>((0,m.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,r.toDisposable)((()=>{for(let t of e)t.dispose()}))}}}t.CoreTerminal=y},8460:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))}},5435:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;let a=n(2584),o=n(7116),s=n(2015),c=n(844),l=n(482),u=n(8437),d=n(8460),f=n(643),p=n(511),m=n(3734),h=n(2585),g=n(6242),_=n(6351),v=n(5941),y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},b=131072;function x(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 S;(function(e){e[e.GET_WIN_SIZE_PIXELS=0]=`GET_WIN_SIZE_PIXELS`,e[e.GET_CELL_SIZE_PIXELS=1]=`GET_CELL_SIZE_PIXELS`})(S||(t.WindowsOptionsReportType=S={}));let C=0;class w extends c.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,n,r,i,c,f,m,h=new s.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=c,this._coreMouseService=f,this._unicodeService=m,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),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 ee(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(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new g.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new g.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new g.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new g.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new g.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new g.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new g.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new g.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new g.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new g.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new g.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new g.OscHandler((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 o.CHARSETS)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 _.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}_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<=h.LogLevelEnum.WARN&&Promise.race([e,new Promise(((e,t)=>setTimeout((()=>t(`#SLOW_TIMEOUT`)),5e3)))]).catch((e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than 5000 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>b&&(a=this._parseStack.position+b)}if(this._logService.logLevel<=h.LogLevelEnum.DEBUG&&this._logService.debug(`parsing data`+(typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,(e=>String.fromCharCode(e))).join(``)}"`),typeof e==`string`?e.split(``).map((e=>e.charCodeAt(0))):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<b&&(this._parseBuffer=new Uint32Array(Math.min(e.length,b))),o||this._dirtyRowTracker.clearRange(),e.length>b)for(let t=a;t<e.length;t+=b){let a=t+b<e.length?t+b: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(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}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,u=this._coreService.modes.insertMode,d=this._curAttrData,p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&p.getWidth(this._activeBuffer.x-1)===2&&p.setCellFromCodePoint(this._activeBuffer.x-1,0,1,d.fg,d.bg,d.extended);for(let m=t;m<n;++m){if(r=e[m],i=this._unicodeService.wcwidth(r),r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}if(o&&this._onA11yChar.fire((0,l.stringFromCodePoint)(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),i||!this._activeBuffer.x){if(this._activeBuffer.x+i-1>=s){if(c){for(;this._activeBuffer.x<s;)p.setCellFromCodePoint(this._activeBuffer.x++,0,1,d.fg,d.bg,d.extended);this._activeBuffer.x=0,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),p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=s-1,i===2)continue}if(u&&(p.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(d),d),p.getWidth(s-1)===2&&p.setCellFromCodePoint(s-1,f.NULL_CELL_CODE,f.NULL_CELL_WIDTH,d.fg,d.bg,d.extended)),p.setCellFromCodePoint(this._activeBuffer.x++,r,i,d.fg,d.bg,d.extended),i>0)for(;--i;)p.setCellFromCodePoint(this._activeBuffer.x++,0,0,d.fg,d.bg,d.extended)}else p.getWidth(this._activeBuffer.x-1)?p.addCodepointToCell(this._activeBuffer.x-1,r):p.addCodepointToCell(this._activeBuffer.x-2,r)}n-t>0&&(p.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<s&&n-t>0&&p.getWidth(this._activeBuffer.x)===0&&!p.hasContent(this._activeBuffer.x)&&p.setCellFromCodePoint(this._activeBuffer.x,0,1,d.fg,d.bg,d.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final!==`t`||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(e=>!x(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new _.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new g.OscHandler(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()),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){let n;switch(this._restrictCursor(this._bufferService.cols),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: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._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._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(u.DEFAULT_ATTR_DATA));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()),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()),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()),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()),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._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){if(!this._parser.precedingCodepoint)return!0;let t=e.params[0]||1,n=new Uint32Array(t);for(let e=0;e<t;++e)n[e]=this._parser.precedingCodepoint;return this.print(n,0,n.length),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(a.C0.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(a.C0.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(a.C0.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,o.DEFAULT_CHARSET),this._charsetService.setgCharset(1,o.DEFAULT_CHARSET),this._charsetService.setgCharset(2,o.DEFAULT_CHARSET),this._charsetService.setgCharset(3,o.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(e,t){let n=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:i}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=e=>e?1:2,p=e.params[0];return m=p,h=t?p===2?4:p===4?f(o.modes.insertMode):p===12?3:p===20?f(d.convertEol):0:p===1?f(n.applicationCursorKeys):p===3?d.windowOptions.setWinLines?c===80?2:+(c===132):0:p===6?f(n.origin):p===7?f(n.wraparound):p===8?3:p===9?f(r===`X10`):p===12?f(d.cursorBlink):p===25?f(!o.isCursorHidden):p===45?f(n.reverseWraparound):p===66?f(n.applicationKeypad):p===67?4:p===1e3?f(r===`VT200`):p===1002?f(r===`DRAG`):p===1003?f(r===`ANY`):p===1004?f(n.sendFocus):p===1005?4:p===1006?f(i===`SGR`):p===1015?4:p===1016?f(i===`SGR_PIXELS`):p===1048?1:p===47||p===1047||p===1049?f(l===u):p===2004?f(n.bracketedPasteMode):0,o.triggerDataEvent(`${a.C0.ESC}[${t?``:`?`}${m};${h}$y`),!0;var m,h}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=m.AttributeData.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|255&n),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=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.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|=16777224|n-90):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777224|n-100):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|=16777215&u.DEFAULT_ATTR_DATA.fg):n===49?(r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):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|=16777215&u.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.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(`${a.C0.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=u.DEFAULT_ATTR_DATA.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.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle=`block`;break;case 3:case 4:this._optionsService.options.cursorStyle=`underline`;break;case 5:case 6:this._optionsService.options.cursorStyle=`bar`}let n=t%2==1;return this._optionsService.options.cursorBlink=n,!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(!x(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(S.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(S.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:t!==0&&t!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),t!==0&&t!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&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(T(n))if(r===`?`)t.push({type:0,index:n});else{let e=(0,v.parseColor)(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.split(`;`);return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&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=(0,v.parseColor)(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]);T(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,o.DEFAULT_CHARSET),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(y[e[0]],o.CHARSETS[e[1]]||o.DEFAULT_CHARSET),!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=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new p.CellData;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=this._bufferService.buffer,r=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${e}${a.C0.ESC}\\`),!0))(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-+!!r.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=w;let ee=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&&(C=e,e=t,t=C),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function T(e){return 0<=e&&e<256}ee=r([i(0,h.IBufferService)],ee)},844:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,`__esModule`,{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},1505:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{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={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof navigator>`u`;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},6106:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.SortedList=void 0;let n=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){this._array.length===0?this._array.push(e):(n=this._search(this._getKey(e)),this._array.splice(n,0,e))}delete(e){if(this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(n=this._search(t),n===-1)||this._getKey(this._array[n])!==t)return!1;do if(this._array[n]===e)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===t);return!1}*getKeyIterator(e){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===e)}forEachByKey(e,t){if(this._array.length!==0&&(n=this._search(e),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===e))do t(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===e)}values(){return[...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)){for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}t=r+1}}return t}}},7226:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(6114);class i{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=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.updateWindowsModeWrappedState=void 0;let r=n(643);t.updateWindowsModeWrappedState=function(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[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&t[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},9092:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;let r=n(6349),i=n(7226),a=n(3734),o=n(8437),s=n(4634),c=n(511),l=n(643),u=n(4863),d=n(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=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=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=c.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]),this._whitespaceCell=c.CellData.fromCharData([0,l.WHITESPACE_CELL_CHAR,l.WHITESPACE_CELL_WIDTH,l.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(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 a.ExtendedAttrs),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 a.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(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 n=e+this._optionsService.rawOptions.scrollback;return n>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=o.DEFAULT_ATTR_DATA);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 r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),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 o.BufferLine(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 o.BufferLine(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=(0,s.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(n.length>0){let r=(0,s.reflowLargerCreateNewLayout)(this.lines,n);(0,s.reflowLargerApplyNewLayout)(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(o.DEFAULT_ATTR_DATA),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new o.BufferLine(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this.getNullCell(o.DEFAULT_ATTR_DATA),r=[],i=0;for(let a=this.lines.length-1;a>=0;a--){let c=this.lines.get(a);if(!c||!c.isWrapped&&c.getTrimmedLength()<=e)continue;let l=[c];for(;c.isWrapped&&a>0;)c=this.lines.get(--a),l.unshift(c);let u=this.ybase+this.y;if(u>=a&&u<a+l.length)continue;let d=l[l.length-1].getTrimmedLength(),f=(0,s.reflowSmallerGetNewLineLengths)(l,this._cols,e),p=f.length-l.length,m;m=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+p):Math.max(0,this.lines.length-this.lines.maxLength+p);let h=[];for(let e=0;e<p;e++){let e=this.getBlankLine(o.DEFAULT_ATTR_DATA,!0);h.push(e)}h.length>0&&(r.push({start:a+l.length+i,newLines:h}),i+=h.length),l.push(...h);let g=f.length-1,_=f[g];_===0&&(g--,_=f[g]);let v=l.length-p-1,y=d;for(;v>=0;){let e=Math.min(y,_);if(l[g]===void 0)break;if(l[g].copyCellsFrom(l[v],y-e,_-e,e,!0),_-=e,_===0&&(g--,_=f[g]),y-=e,y===0){v--;let e=Math.max(v,0);y=(0,s.getWrappedLineTrimmedLength)(l,e,this._cols)}}for(let t=0;t<l.length;t++)f[t]<e&&l[t].setCell(f[t],n);let b=p-m;for(;b-- >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+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+p,this.ybase+t-1)}if(r.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,a=n-1,o=0,s=r[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+i-1);l>=0;l--)if(s&&s.start>a+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:a+1,amount:s.newLines.length}),c+=s.newLines.length,s=r[++o]}else this.lines.set(l,t[a--]);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+i-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.splice(e--,1);this._isClearing=!1}addMarker(e){let t=new u.Marker(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)}}},8437:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;let r=n(3734),i=n(511),a=n(643),o=n(482);t.DEFAULT_ATTR_DATA=Object.freeze(new r.AttributeData);let s=0;class c{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=t||i.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[3*e+0],n=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:n?(0,o.stringFromCodePoint)(n):``,t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[3*e+1]=t[a.CHAR_DATA_ATTR_INDEX],t[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):``}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return s=3*e,t.content=this._data[s+0],t.fg=this._data[s+1],t.bg=this._data[s+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodePoint(e,t,n,r,i,a){268435456&i&&(this._extendedAttrs[e]=a),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=r,this._data[3*e+2]=i}addCodepointToCell(e,t){let n=this._data[3*e+0];2097152&n?this._combined[e]+=(0,o.stringFromCodePoint)(t):(2097151&n?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&n)+(0,o.stringFromCodePoint)(t),n&=-2097152,n|=2097152):n=t|1<<22,this._data[3*e+0]=n)}insertCells(e,t,n,a){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,a?.fg||0,a?.bg||0,a?.extended||new r.ExtendedAttrs),t<this.length-e){let r=new i.CellData;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,a?.fg||0,a?.bg||0,a?.extended||new r.ExtendedAttrs)}deleteCells(e,t,n,a){if(e%=this.length,t<this.length-e){let r=new i.CellData;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,a?.fg||0,a?.bg||0,a?.extended||new r.ExtendedAttrs),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodePoint(e,0,1,a?.fg||0,a?.bg||0,a?.extended||new r.ExtendedAttrs)}replaceCells(e,t,n,i,a=!1){if(a)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodePoint(e-1,0,1,i?.fg||0,i?.bg||0,i?.extended||new r.ExtendedAttrs),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodePoint(t,0,1,i?.fg||0,i?.bg||0,i?.extended||new r.ExtendedAttrs);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,i?.fg||0,i?.bg||0,i?.extended||new r.ExtendedAttrs),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodePoint(t,0,1,i?.fg||0,i?.bg||0,i?.extended||new r.ExtendedAttrs);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let n=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*n)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,4*n*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new c(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<3;e++)this._data[3*(n+i)+e]=a[3*(t+i)+e];268435456&a[3*(t+i)+2]&&(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=!1,t=0,n=this.length){e&&(n=Math.min(n,this.getTrimmedLength()));let r=``;for(;t<n;){let e=this._data[3*t+0],n=2097151&e;r+=2097152&e?this._combined[t]:n?(0,o.stringFromCodePoint)(n):a.WHITESPACE_CELL_CHAR,t+=e>>22||1}return r}}t.BufferLine=c},4841:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(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)}},4634:(e,t)=>{function n(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}Object.defineProperty(t,`__esModule`,{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,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(i>=s&&i<c){s+=u.length-1;continue}let d=0,f=n(u,d,t),p=1,m=0;for(;p<u.length;){let e=n(u,p,t),i=e-m,o=r-f,s=Math.min(i,o);u[d].copyCellsFrom(u[p],m,f,s,!1),f+=s,f===r&&(d++,f=0),m+=s,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(r-1)===2&&(u[d].copyCellsFrom(u[d-1],r-1,f++,1,!1),u[d-1].setCell(r-1,a))}u[d].replaceCells(f,r,a);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},t.reflowLargerCreateNewLayout=function(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}},t.reflowLargerApplyNewLayout=function(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},t.reflowSmallerGetNewLineLengths=function(e,t,r){let i=[],a=e.map(((r,i)=>n(e,i,t))).reduce(((e,t)=>e+t)),o=0,s=0,c=0;for(;c<a;){if(a-c<r){i.push(a-c);break}o+=r;let l=n(e,s,t);o>l&&(o-=l,s++);let u=e[s].getWidth(o-1)===2;u&&o--;let d=u?r-1:r;i.push(d),c+=d}return i},t.getWrappedLineTrimmedLength=n},5295:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferSet=void 0;let r=n(8460),i=n(844),a=n(9092);class o extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new r.EventEmitter),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 a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!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)}}t.BufferSet=o},511:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CellData=void 0;let r=n(482),i=n(643),a=n(3734);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Marker=void 0;let r=n(8460),i=n(844);class a{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new r.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=a,a._nextId=1},7116:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},t.CHARSETS.A={"#":`£`},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},t.CHARSETS.C=t.CHARSETS[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},t.CHARSETS.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},t.CHARSETS.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},t.CHARSETS.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},t.CHARSETS.E=t.CHARSETS[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},t.CHARSETS.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},t.CHARSETS.H=t.CHARSETS[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},t.CHARSETS[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`}},2584:(e,t)=>{var n,r,i;Object.defineProperty(t,`__esModule`,{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(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=`
|
|
748
|
-
`,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=``}(n||(t.C0=n={})),function(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=``}(r||(t.C1=r={})),function(e){e.ST=`${n.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.evaluateKeyboardEvent=void 0;let r=n(2584),i={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:[`'`,`"`]};t.evaluateKeyboardEvent=function(e,t,n,a){let o={type:0,cancel:!1,key:void 0},s=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`:e.key===`UIKeyInputRightArrow`?o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`);break;case 8:if(e.altKey){o.key=r.C0.ESC+r.C0.DEL;break}o.key=r.C0.DEL;break;case 9:if(e.shiftKey){o.key=r.C0.ESC+`[Z`;break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`D`,o.key===r.C0.ESC+`[1;3D`&&(o.key=r.C0.ESC+(n?`b`:`[1;5D`))):o.key=t?r.C0.ESC+`OD`:r.C0.ESC+`[D`;break;case 39:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`C`,o.key===r.C0.ESC+`[1;3C`&&(o.key=r.C0.ESC+(n?`f`:`[1;5C`))):o.key=t?r.C0.ESC+`OC`:r.C0.ESC+`[C`;break;case 38:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`A`,n||o.key!==r.C0.ESC+`[1;3A`||(o.key=r.C0.ESC+`[1;5A`)):o.key=t?r.C0.ESC+`OA`:r.C0.ESC+`[A`;break;case 40:if(e.metaKey)break;s?(o.key=r.C0.ESC+`[1;`+(s+1)+`B`,n||o.key!==r.C0.ESC+`[1;3B`||(o.key=r.C0.ESC+`[1;5B`)):o.key=t?r.C0.ESC+`OB`:r.C0.ESC+`[B`;break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+`[2~`);break;case 46:o.key=s?r.C0.ESC+`[3;`+(s+1)+`~`:r.C0.ESC+`[3~`;break;case 36:o.key=s?r.C0.ESC+`[1;`+(s+1)+`H`:t?r.C0.ESC+`OH`:r.C0.ESC+`[H`;break;case 35:o.key=s?r.C0.ESC+`[1;`+(s+1)+`F`:t?r.C0.ESC+`OF`:r.C0.ESC+`[F`;break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=r.C0.ESC+`[5;`+(s+1)+`~`:o.key=r.C0.ESC+`[5~`;break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=r.C0.ESC+`[6;`+(s+1)+`~`:o.key=r.C0.ESC+`[6~`;break;case 112:o.key=s?r.C0.ESC+`[1;`+(s+1)+`P`:r.C0.ESC+`OP`;break;case 113:o.key=s?r.C0.ESC+`[1;`+(s+1)+`Q`:r.C0.ESC+`OQ`;break;case 114:o.key=s?r.C0.ESC+`[1;`+(s+1)+`R`:r.C0.ESC+`OR`;break;case 115:o.key=s?r.C0.ESC+`[1;`+(s+1)+`S`:r.C0.ESC+`OS`;break;case 116:o.key=s?r.C0.ESC+`[15;`+(s+1)+`~`:r.C0.ESC+`[15~`;break;case 117:o.key=s?r.C0.ESC+`[17;`+(s+1)+`~`:r.C0.ESC+`[17~`;break;case 118:o.key=s?r.C0.ESC+`[18;`+(s+1)+`~`:r.C0.ESC+`[18~`;break;case 119:o.key=s?r.C0.ESC+`[19;`+(s+1)+`~`:r.C0.ESC+`[19~`;break;case 120:o.key=s?r.C0.ESC+`[20;`+(s+1)+`~`:r.C0.ESC+`[20~`;break;case 121:o.key=s?r.C0.ESC+`[21;`+(s+1)+`~`:r.C0.ESC+`[21~`;break;case 122:o.key=s?r.C0.ESC+`[23;`+(s+1)+`~`:r.C0.ESC+`[23~`;break;case 123:o.key=s?r.C0.ESC+`[24;`+(s+1)+`~`:r.C0.ESC+`[24~`;break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!a||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(o.key=r.C0.US),e.key===`@`&&(o.key=r.C0.NUL)):e.keyCode===65&&(o.type=1);else{let t=i[e.keyCode]?.[+!!e.shiftKey];if(t)o.key=r.C0.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()),o.key=r.C0.ESC+n}else if(e.keyCode===32)o.key=r.C0.ESC+(e.ctrlKey?r.C0.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=r.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=r.C0.DEL:e.keyCode===219?o.key=r.C0.ESC:e.keyCode===220?o.key=r.C0.FS:e.keyCode===221&&(o.key=r.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(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(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=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++]=1024*(this._interim-55296)+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++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=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,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},225:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeV6=void 0;let n=[[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]],r=[[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]],i;t.UnicodeV6=class{constructor(){if(this.version=`6`,!i){i=new Uint8Array(65536),i.fill(1),i[0]=0,i.fill(0,1,32),i.fill(0,127,160),i.fill(2,4352,4448),i[9001]=2,i[9002]=2,i.fill(2,11904,42192),i[12351]=1,i.fill(2,44032,55204),i.fill(2,63744,64256),i.fill(2,65040,65050),i.fill(2,65072,65136),i.fill(2,65280,65377),i.fill(2,65504,65511);for(let e=0;e<n.length;++e)i.fill(0,n[e][0],n[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?i[e]:function(e,t){let n,r=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=r;)if(n=r+i>>1,e>t[n][1])r=n+1;else{if(!(e<t[n][0]))return!0;i=n-1}return!1}(e,r)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}}},5981:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.WriteBuffer=void 0;let r=n(8460),i=n(844);class a extends i.Disposable{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 r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let n;for(this._isSyncWriting=!0;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>5e7)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||Date.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=>Date.now()-n>=12?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,Date.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}t.WriteBuffer=a},5941:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.toRgbString=t.parseColor=void 0;let n=/^([\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})$/,r=/^[\da-f]+$/;function i(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}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=n.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),r.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}},t.toRgbString=function(e,t=16){let[n,r,a]=e;return`rgb:${i(n,t)}/${i(r,t)}/${i(a,t)}`}},5770:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DcsHandler=t.DcsParser=void 0;let r=n(482),i=n(8742),a=n(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}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=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,`HOOK`,t)}put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._ident,`PUT`,(0,r.utf32ToString)(e,t,n))}unhook(e,t=!0){if(this._active.length){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&&!1===n){for(;r>=0&&(n=this._active[r].unhook(e),!0!==n);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}else this._handlerFb(this._ident,`UNHOOK`,e);this._active=o,this._ident=0}};let s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=``,this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,n),this._data.length>a.PAYLOAD_LIMIT&&(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=s,this._data=``,this._hitLimit=!1,e)));return this._params=s,this._data=``,this._hitLimit=!1,t}}},2015:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;let r=n(844),i=n(8742),a=n(6242),o=n(6351);class s{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}}t.TransitionTable=s,t.VT500_TRANSITION_TABLE=function(){let e=new s(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(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}();class c extends r.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){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 i.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=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((0,r.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new o.DcsParser),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(255&e)),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.precedingCodepoint=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,i=0,a=0,o=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=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,a=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](this._params),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 4:if(!1===n&&a>-1){for(;a>=0&&(r=t[a](),!0!==r);a--)if(r instanceof Promise)return this._parseStack.handlerPos=a,r}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],r=this._dcsParser.unhook(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],r=this._oscParser.end(i!==24&&i!==26,n),r)return r;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let n=o;n<t;++n){switch(i=e[n],a=this._transitions.table[this.currentState<<8|(i<160?i:160)],a>>4){case 2:for(let r=n+1;;++r){if(r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}if(++r>=t||(i=e[r])<32||i>126&&i<160){this._printHandler(e,n,r),n=r-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|i],s=o?o.length-1:-1;for(;s>=0&&(r=o[s](this._params),!0!==r);s--)if(r instanceof Promise)return this._preserveStack(3,o,s,a,n),r;s<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingCodepoint=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++n<t&&(i=e[n])>47&&i<60);n--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let c=this._escHandlers[this._collect<<8|i],l=c?c.length-1:-1;for(;l>=0&&(r=c[l](),!0!==r);l--)if(r instanceof Promise)return this._preserveStack(4,c,l,a,n),r;l<0&&this._escHandlerFb(this._collect<<8|i),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let r=n+1;;++r)if(r>=t||(i=e[r])===24||i===26||i===27||i>127&&i<160){this._dcsParser.put(e,n,r),n=r-1;break}break;case 14:if(r=this._dcsParser.unhook(i!==24&&i!==26),r)return this._preserveStack(6,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let r=n+1;;r++)if(r>=t||(i=e[r])<32||i>127&&i<160){this._oscParser.put(e,n,r),n=r-1;break}break;case 6:if(r=this._oscParser.end(i!==24&&i!==26),r)return this._preserveStack(5,[],0,a,n),r;i===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&a}}}t.EscapeSequenceParser=c},6242:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OscHandler=t.OscParser=void 0;let r=n(5770),i=n(482),a=[];t.OscParser=class{constructor(){this._state=0,this._active=a,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=a}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=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,`START`)}_put(e,t,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,`PUT`,(0,i.utf32ToString)(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)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+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){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&&!1===n){for(;r>=0&&(n=this._active[r].end(e),!0!==n);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}else this._handlerFb(this._id,`END`,e);this._active=a,this._id=-1,this._state=0}}},t.OscHandler=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+=(0,i.utf32ToString)(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(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}}},8742:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Params=void 0;let n=2147483647;class r{static fromArray(e){let t=new r;if(!e.length)return t;for(let n=+!!Array.isArray(e[0]);n<e.length;++n){let r=e[n];if(Array.isArray(r))for(let e=0;e<r.length;++e)t.addSubParam(r[e]);else t.addParam(r)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)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}clone(){let e=new r(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];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=255&this._subParamsIdx[t];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 r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}}t.Params=r},5741:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.AddonManager=void 0,t.AddonManager=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)}}},8771:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferApiView=void 0;let r=n(3785),i=n(511);t.BufferApiView=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 r.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferLineApiView=void 0;let r=n(511);t.BufferLineApiView=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 r.CellData)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}}},8285:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferNamespaceApi=void 0;let r=n(8771),i=n(8460),a=n(844);class o extends a.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new r.BufferApiView(this._core.buffers.normal,`normal`),this._alternate=new r.BufferApiView(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)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.ParserApi=void 0,t.ParserApi=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)}}},7090:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=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}}},744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;let a=n(8460),o=n(844),s=n(5295),c=n(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let l=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}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,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};t.BufferService=l=r([i(0,c.IOptionsService)],l)},7994:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.CharsetService=void 0,t.CharsetService=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)}}},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreMouseService=void 0;let a=n(2585),o=n(8460),s=n(844),c={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button!==4&&e.action===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 l(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|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),e.action===32?n|=32:e.action!==0||t||(n|=3)),n}let u=String.fromCharCode,d={DEFAULT:e=>{let t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`[M${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`[<${l(e,!0)};${e.x};${e.y}${t}`}},f=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(c))this.addProtocol(e,c[e]);for(let e of Object.keys(d))this.addEncoding(e,d[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}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:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_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}};t.CoreMouseService=f=r([i(0,a.IBufferService),i(1,a.ICoreService)],f)},6975:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.CoreService=void 0;let a=n(1439),o=n(8460),s=n(844),c=n(2585),l=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),d=t.CoreService=class extends s.Disposable{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 o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}reset(){this.modes=(0,a.clone)(l),this.decPrivateModes=(0,a.clone)(u)}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}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split(``).map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=r([i(0,c.IBufferService),i(1,c.ILogService),i(2,c.IOptionsService)],d)},9074:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DecorationService=void 0;let r=n(8055),i=n(8460),a=n(844),o=n(6106),s=0,c=0;class l extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new u(e);if(t){let e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{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=>{s=t.options.x??0,c=s+(t.options.width??1),e>=s&&e<c&&(!n||(t.options.layer??`bottom`)===n)&&r(t)}))}}t.DecorationService=l;class u extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=r.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=r.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),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`)}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;let r=n(2585),i=n(8343);class a{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)}}t.ServiceCollection=a,t.InstantiationService=class{constructor(){this._services=new a,this._services.set(r.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=(0,i.getServiceDependencies)(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}.`);r.push(n)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}}},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(844),o=n(2585),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[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?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},7302:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;let r=n(8460),i=n(844);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`courier-new, courier, monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:n(6114).isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRulerWidth:0};let a=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`];class o extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new r.EventEmitter),this.onOptionChange=this._onOptionChange.event;let n=Object.assign({},t.DEFAULT_OPTIONS);for(let t in e)if(t in n)try{let r=e[t];n[t]=this._sanitizeAndValidateOption(t,r)}catch(e){console.error(e)}this.rawOptions=n,this.options=Object.assign({},n),this._setupOptions()}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 t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},n=(e,n)=>{if(!(e in t.DEFAULT_OPTIONS))throw Error(`No option with key "${e}"`);n=this._sanitizeAndValidateOption(e,n),this.rawOptions[e]!==n&&(this.rawOptions[e]=n,this._onOptionChange.fire(e))};for(let t in this.rawOptions){let r={get:e.bind(this,t),set:n.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(e,n){switch(e){case`cursorStyle`:if(n||=t.DEFAULT_OPTIONS[e],!function(e){return e===`block`||e===`underline`||e===`bar`}(n))throw Error(`"${n}" is not a valid value for ${e}`);break;case`wordSeparator`:n||=t.DEFAULT_OPTIONS[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof n==`number`&&1<=n&&n<=1e3)break;n=a.includes(n)?n:t.DEFAULT_OPTIONS[e];break;case`cursorWidth`:n=Math.floor(n);case`lineHeight`:case`tabStopWidth`:if(n<1)throw Error(`${e} cannot be less than 1, value: ${n}`);break;case`minimumContrastRatio`:n=Math.max(1,Math.min(21,Math.round(10*n)/10));break;case`scrollback`:if((n=Math.min(n,4294967295))<0)throw Error(`${e} cannot be less than 0, value: ${n}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(n<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case`rows`:case`cols`:if(!n&&n!==0)throw Error(`${e} must be numeric, value: ${n}`);break;case`windowsPty`:n??={}}return n}}t.OptionsService=o},2660:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,`__esModule`,{value:!0}),t.OscLinkService=void 0;let a=n(2585),o=t.OscLinkService=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)))}};t.OscLinkService=o=r([i(0,a.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(8343);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)},1480:(e,t,n)=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.UnicodeService=void 0;let r=n(8460),i=n(225);t.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new r.EventEmitter,this.onChange=this._onChange.event;let e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}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(e){let t=0,n=e.length;for(let r=0;r<n;++r){let i=e.charCodeAt(r);if(55296<=i&&i<=56319){if(++r>=n)return t+this.wcwidth(i);let a=e.charCodeAt(r);56320<=a&&a<=57343?i=1024*(i-55296)+a-56320+65536:t+=this.wcwidth(a)}t+=this.wcwidth(i)}return t}}}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,`__esModule`,{value:!0}),e.Terminal=void 0;let t=n(9042),i=n(3236),a=n(844),o=n(5741),s=n(8285),c=n(7975),l=n(7090),u=[`cols`,`rows`];class d extends a.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions=Object.assign({},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(u.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 c.ParserApi(this._core),this._parser}get unicode(){return this._checkProposedApi(),new l.UnicodeApi(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 s.BufferNamespaceApi(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,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()}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(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
|
|
749
|
-
`,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 t}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(let t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw Error(`This API only accepts positive integers`)}}e.Terminal=d})(),r})()))}))(),WT=2,GT=1,KT=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(WT,Math.floor(u/e.css.cell.width)),rows:Math.max(GT,Math.floor(l/e.css.cell.height))}}};function qT({wsUrl:e,projectDir:t,logs:n,className:r}){let i=(0,_.useRef)(null),a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!i.current)return;let e=new UT.Terminal({theme:{background:`#0d1117`,foreground:`#e6edf3`,cursor:`#6366f1`,selectionBackground:`rgba(99, 102, 241, 0.3)`,black:`#0d1117`,red:`#f87171`,green:`#4ade80`,yellow:`#facc15`,blue:`#60a5fa`,magenta:`#c084fc`,cyan:`#22d3ee`,white:`#e6edf3`,brightBlack:`#484f58`,brightRed:`#fca5a5`,brightGreen:`#86efac`,brightYellow:`#fde68a`,brightBlue:`#93c5fd`,brightMagenta:`#d8b4fe`,brightCyan:`#67e8f9`,brightWhite:`#ffffff`},fontSize:12,fontFamily:`'SF Mono', Monaco, 'Cascadia Code', monospace`,cursorBlink:!0,cursorStyle:`bar`,scrollback:5e3,convertEol:!0}),t=new KT;e.loadAddon(t),e.open(i.current),t.fit(),a.current=e,o.current=t;let n=new ResizeObserver(()=>{try{t.fit()}catch{}});return n.observe(i.current),()=>{n.disconnect(),e.dispose(),a.current=null,o.current=null}},[]),(0,_.useEffect)(()=>{if(!a.current)return;let n=a.current,r=window.location.protocol===`https:`?`wss:`:`ws:`,i=e||`${r}//${window.location.host}/ws/terminal${t?`?cwd=${encodeURIComponent(t)}`:``}`,o=new WebSocket(i);return s.current=o,o.binaryType=`arraybuffer`,o.onmessage=e=>{e.data instanceof ArrayBuffer?n.write(new Uint8Array(e.data)):n.write(e.data)},o.onclose=()=>{n.write(`\r
|
|
750
|
-
\x1B[90m[disconnected]\x1B[0m\r
|
|
751
|
-
`)},n.onData(e=>{o.readyState===WebSocket.OPEN&&o.send(e)}),()=>{o.close(),s.current=null}},[e,t]),(0,_.useEffect)(()=>{if(!n||!a.current)return;let e=a.current;for(let t of n)e.writeln(t)},[n]),(0,A.jsx)(`div`,{ref:i,className:r,style:{flex:1,minHeight:0,overflow:`hidden`,background:`#0d1117`}})}function JT({tabs:e,active:t,onChange:n,className:r,buttonClassName:i,activeClassName:a}){return(0,A.jsx)(`nav`,{className:r,role:`tablist`,"aria-label":`Mobile navigation`,children:e.map(e=>{let r=e.id===t;return(0,A.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:`${i??``} ${r?a??``:``}`,onClick:()=>n(e.id),children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:e.icon}),(0,A.jsx)(`span`,{children:e.label})]},e.id)})})}var Q={root:`_root_1wqny_2`,header:`_header_1wqny_10`,title:`_title_1wqny_21`,subtitle:`_subtitle_1wqny_28`,headerTabs:`_headerTabs_1wqny_34`,tabBtn:`_tabBtn_1wqny_40`,tabActive:`_tabActive_1wqny_51`,body:`_body_1wqny_58`,editor:`_editor_1wqny_67`,examples:`_examples_1wqny_75`,sectionLabel:`_sectionLabel_1wqny_81`,examplePills:`_examplePills_1wqny_89`,examplePill:`_examplePill_1wqny_89`,editorCols:`_editorCols_1wqny_109`,leftSidebar:`_leftSidebar_1wqny_119`,panel:`_panel_1wqny_128`,panelHeader:`_panelHeader_1wqny_135`,panelTitle:`_panelTitle_1wqny_142`,addBtn:`_addBtn_1wqny_149`,blockLabel:`_blockLabel_1wqny_160`,blockCheck:`_blockCheck_1wqny_170`,authField:`_authField_1wqny_173`,authFieldInput:`_authFieldInput_1wqny_183`,authFieldSelect:`_authFieldSelect_1wqny_193`,authFieldReq:`_authFieldReq_1wqny_204`,removeFieldBtn:`_removeFieldBtn_1wqny_205`,skillsList:`_skillsList_1wqny_208`,skillRow:`_skillRow_1wqny_210`,skillIcon:`_skillIcon_1wqny_218`,skillName:`_skillName_1wqny_220`,skillBadge:`_skillBadge_1wqny_229`,skillBadge_skill:`_skillBadge_skill_1wqny_237`,skillBadge_memory:`_skillBadge_memory_1wqny_238`,skillBadge_provider:`_skillBadge_provider_1wqny_239`,skillBadge_log:`_skillBadge_log_1wqny_240`,skillEmpty:`_skillEmpty_1wqny_242`,skillBtn:`_skillBtn_1wqny_244`,skillsEmpty:`_skillsEmpty_1wqny_246`,snapshotRow:`_snapshotRow_1wqny_249`,snapshotTs:`_snapshotTs_1wqny_258`,snapshotCount:`_snapshotCount_1wqny_259`,snapshotBtn:`_snapshotBtn_1wqny_260`,genStatus:`_genStatus_1wqny_263`,repairStatus:`_repairStatus_1wqny_265`,repairStatusTitle:`_repairStatusTitle_1wqny_266`,repairStatusProg:`_repairStatusProg_1wqny_267`,repairStatusFile:`_repairStatusFile_1wqny_268`,actionRow:`_actionRow_1wqny_271`,actionBtn:`_actionBtn_1wqny_273`,actionBtnIcon:`_actionBtnIcon_1wqny_275`,actionBtnActive:`_actionBtnActive_1wqny_276`,repairBtn:`_repairBtn_1wqny_278`,sandboxBtn:`_sandboxBtn_1wqny_280`,statsBar:`_statsBar_1wqny_282`,rightPanel:`_rightPanel_1wqny_285`,rightTabBar:`_rightTabBar_1wqny_296`,rightTab:`_rightTab_1wqny_296`,rightTabActive:`_rightTabActive_1wqny_313`,repairBar:`_repairBar_1wqny_316`,repairBarRow:`_repairBarRow_1wqny_326`,repairBarIcon:`_repairBarIcon_1wqny_327`,repairBarLabel:`_repairBarLabel_1wqny_328`,repairBarFile:`_repairBarFile_1wqny_329`,repairBarCounter:`_repairBarCounter_1wqny_330`,repairBarTime:`_repairBarTime_1wqny_331`,genBar:`_genBar_1wqny_333`,genBarRow:`_genBarRow_1wqny_343`,genBarRobot:`_genBarRobot_1wqny_344`,robotBob:`_robotBob_1wqny_1`,genBarLabel:`_genBarLabel_1wqny_345`,genBarFile:`_genBarFile_1wqny_346`,genBarCounter:`_genBarCounter_1wqny_347`,genBarTime:`_genBarTime_1wqny_348`,progressTrack:`_progressTrack_1wqny_350`,repairProgress:`_repairProgress_1wqny_351`,genProgress:`_genProgress_1wqny_352`,genDots:`_genDots_1wqny_355`,dot:`_dot_1wqny_356`,dot1:`_dot1_1wqny_357`,dotBounce:`_dotBounce_1wqny_1`,dot2:`_dot2_1wqny_358`,dot3:`_dot3_1wqny_359`,stopBtn:`_stopBtn_1wqny_362`,codeArea:`_codeArea_1wqny_365`,sandboxWrap:`_sandboxWrap_1wqny_366`,sandboxFrame:`_sandboxFrame_1wqny_367`,sandboxEmpty:`_sandboxEmpty_1wqny_368`,sandboxStartBtn:`_sandboxStartBtn_1wqny_369`,sandboxStatusBar:`_sandboxStatusBar_1wqny_372`,sandboxStatusDot:`_sandboxStatusDot_1wqny_381`,sandboxStatusText:`_sandboxStatusText_1wqny_382`,sandboxStartBtnSmall:`_sandboxStartBtnSmall_1wqny_383`,runtimeErrors:`_runtimeErrors_1wqny_386`,runtimeErrorsHeader:`_runtimeErrorsHeader_1wqny_392`,runtimeErrorsFix:`_runtimeErrorsFix_1wqny_401`,runtimeErrorsDismiss:`_runtimeErrorsDismiss_1wqny_413`,runtimeErrorLine:`_runtimeErrorLine_1wqny_414`,sandboxConsole:`_sandboxConsole_1wqny_425`,sandboxConsoleCollapsed:`_sandboxConsoleCollapsed_1wqny_434`,sandboxConsoleHeader:`_sandboxConsoleHeader_1wqny_435`,sandboxConsoleTitle:`_sandboxConsoleTitle_1wqny_447`,sandboxConsolePort:`_sandboxConsolePort_1wqny_448`,sandboxConsoleDots:`_sandboxConsoleDots_1wqny_449`,sandboxConsoleToggle:`_sandboxConsoleToggle_1wqny_450`,sandboxReloadBtn:`_sandboxReloadBtn_1wqny_451`,sandboxStopBtn:`_sandboxStopBtn_1wqny_453`,sandboxConsoleBody:`_sandboxConsoleBody_1wqny_455`,sandboxLogLine:`_sandboxLogLine_1wqny_461`,sandboxLogPhase:`_sandboxLogPhase_1wqny_470`,sandboxLogError:`_sandboxLogError_1wqny_471`,sandboxLogWarn:`_sandboxLogWarn_1wqny_472`,sandboxLogOk:`_sandboxLogOk_1wqny_473`,codeLayout:`_codeLayout_1wqny_476`,codeRow:`_codeRow_1wqny_485`,ideTabBar:`_ideTabBar_1wqny_493`,ideTab:`_ideTab_1wqny_493`,ideTabActive:`_ideTabActive_1wqny_525`,ideTabError:`_ideTabError_1wqny_530`,ideTabPending:`_ideTabPending_1wqny_531`,ideTabIcon:`_ideTabIcon_1wqny_532`,ideTabName:`_ideTabName_1wqny_533`,ideTabDot:`_ideTabDot_1wqny_534`,ideTabUnsaved:`_ideTabUnsaved_1wqny_540`,codeEditorWrap:`_codeEditorWrap_1wqny_548`,editToggleBtn:`_editToggleBtn_1wqny_559`,editToggleBtnActive:`_editToggleBtnActive_1wqny_570`,codeEditor:`_codeEditor_1wqny_548`,genCursor:`_genCursor_1wqny_592`,cursorBlink:`_cursorBlink_1wqny_1`,diffOverlay:`_diffOverlay_1wqny_601`,diffOverlayHeader:`_diffOverlayHeader_1wqny_610`,diffOverlayActions:`_diffOverlayActions_1wqny_621`,diffAcceptBtn:`_diffAcceptBtn_1wqny_622`,diffRejectBtn:`_diffRejectBtn_1wqny_623`,diffOverlayBody:`_diffOverlayBody_1wqny_624`,diffSame:`_diffSame_1wqny_625`,diffRem:`_diffRem_1wqny_626`,diffAdd:`_diffAdd_1wqny_627`,noFiles:`_noFiles_1wqny_629`,noFilesHero:`_noFilesHero_1wqny_639`,noFilesIcon:`_noFilesIcon_1wqny_646`,noFilesTitle:`_noFilesTitle_1wqny_648`,noFilesTagline:`_noFilesTagline_1wqny_655`,noFilesSteps:`_noFilesSteps_1wqny_660`,noFilesStep:`_noFilesStep_1wqny_660`,noFilesStepNum:`_noFilesStepNum_1wqny_677`,noFilesExamplesHint:`_noFilesExamplesHint_1wqny_691`,noFilesExampleBtn:`_noFilesExampleBtn_1wqny_701`,codeViewer:`_codeViewer_1wqny_713`,codeHeader:`_codeHeader_1wqny_721`,codeFileIcon:`_codeFileIcon_1wqny_734`,codeFileName:`_codeFileName_1wqny_735`,codeFileMeta:`_codeFileMeta_1wqny_736`,fileError:`_fileError_1wqny_738`,fileSyntaxError:`_fileSyntaxError_1wqny_739`,filePending:`_filePending_1wqny_740`,codeWithLines:`_codeWithLines_1wqny_743`,lineNumbers:`_lineNumbers_1wqny_750`,lineNum:`_lineNum_1wqny_750`,code:`_code_1wqny_365`,codeError:`_codeError_1wqny_781`,codeSyntaxError:`_codeSyntaxError_1wqny_782`,fileSidebar:`_fileSidebar_1wqny_785`,fileSidebarHeader:`_fileSidebarHeader_1wqny_794`,fileTab:`_fileTab_1wqny_804`,fileTabActive:`_fileTabActive_1wqny_820`,fileTabError:`_fileTabError_1wqny_821`,fileTabRow:`_fileTabRow_1wqny_823`,fileTabIcon:`_fileTabIcon_1wqny_824`,fileTabName:`_fileTabName_1wqny_825`,fileTabSize:`_fileTabSize_1wqny_826`,fileTabDir:`_fileTabDir_1wqny_827`,fileTabTokens:`_fileTabTokens_1wqny_828`,fileTabMeta:`_fileTabMeta_1wqny_829`,projectsList:`_projectsList_1wqny_832`,emptyProjects:`_emptyProjects_1wqny_834`,emptyIcon:`_emptyIcon_1wqny_835`,emptyHint:`_emptyHint_1wqny_836`,projectCard:`_projectCard_1wqny_838`,projectInfo:`_projectInfo_1wqny_839`,projectName:`_projectName_1wqny_840`,projectDesc:`_projectDesc_1wqny_841`,projectMeta:`_projectMeta_1wqny_842`,openBtn:`_openBtn_1wqny_843`,deleteBtn:`_deleteBtn_1wqny_844`,planBanner:`_planBanner_1wqny_847`,planTitle:`_planTitle_1wqny_856`,planText:`_planText_1wqny_857`,planActions:`_planActions_1wqny_858`,planApprove:`_planApprove_1wqny_859`,planReject:`_planReject_1wqny_860`,grepPanel:`_grepPanel_1wqny_863`,grepRow:`_grepRow_1wqny_872`,grepInput:`_grepInput_1wqny_873`,grepBtn:`_grepBtn_1wqny_875`,grepClose:`_grepClose_1wqny_876`,grepCount:`_grepCount_1wqny_877`,grepResults:`_grepResults_1wqny_878`,grepEmpty:`_grepEmpty_1wqny_879`,grepMatch:`_grepMatch_1wqny_880`,grepMatchFile:`_grepMatchFile_1wqny_882`,grepMatchLine:`_grepMatchLine_1wqny_883`,diffPanel:`_diffPanel_1wqny_886`,diffHeader:`_diffHeader_1wqny_895`,diffClose:`_diffClose_1wqny_896`,diffFile:`_diffFile_1wqny_897`,diffSummary:`_diffSummary_1wqny_898`,diffArrow:`_diffArrow_1wqny_899`,diffFileName:`_diffFileName_1wqny_900`,diffAdded:`_diffAdded_1wqny_901`,diffRemoved:`_diffRemoved_1wqny_902`,diffContent:`_diffContent_1wqny_903`,diffInline:`_diffInline_1wqny_906`,diffInlineHeader:`_diffInlineHeader_1wqny_907`,diffRemLine:`_diffRemLine_1wqny_908`,diffAddLine:`_diffAddLine_1wqny_909`,chatPanel:`_chatPanel_1wqny_912`,chatPanelCollapsed:`_chatPanelCollapsed_1wqny_921`,chatCollapseBtn:`_chatCollapseBtn_1wqny_922`,chatMessages:`_chatMessages_1wqny_930`,chatWelcome:`_chatWelcome_1wqny_932`,doctrineOpenBtn:`_doctrineOpenBtn_1wqny_933`,streamingPre:`_streamingPre_1wqny_936`,streamingCursor:`_streamingCursor_1wqny_949`,streamBlink:`_streamBlink_1wqny_1`,doctrineSubtitle:`_doctrineSubtitle_1wqny_956`,doctrineSection:`_doctrineSection_1wqny_957`,doctrineSectionTitle:`_doctrineSectionTitle_1wqny_962`,doctrineSectionBody:`_doctrineSectionBody_1wqny_969`,doctrineBullet:`_doctrineBullet_1wqny_978`,chatUser:`_chatUser_1wqny_988`,chatUserBubble:`_chatUserBubble_1wqny_989`,chatAttachPreviews:`_chatAttachPreviews_1wqny_990`,chatAttachBadge:`_chatAttachBadge_1wqny_991`,chatSystem:`_chatSystem_1wqny_993`,chatSystemBubble:`_chatSystemBubble_1wqny_994`,chatSyntaxErr:`_chatSyntaxErr_1wqny_995`,chatAgent:`_chatAgent_1wqny_997`,chatAgentCard:`_chatAgentCard_1wqny_998`,chatAgentHeader:`_chatAgentHeader_1wqny_999`,chatAgentRobot:`_chatAgentRobot_1wqny_1000`,chatAgentRobotAnim:`_chatAgentRobotAnim_1wqny_1001`,chatAgentLabel:`_chatAgentLabel_1wqny_1002`,chatRunningDots:`_chatRunningDots_1wqny_1003`,chatAgentText:`_chatAgentText_1wqny_1004`,chatToolBadges:`_chatToolBadges_1wqny_1005`,toolBadge:`_toolBadge_1wqny_1006`,toolBadgeOk:`_toolBadgeOk_1wqny_1007`,toolBadgeErr:`_toolBadgeErr_1wqny_1008`,cursor:`_cursor_1wqny_1010`,blink:`_blink_1wqny_1`,attachPreviews:`_attachPreviews_1wqny_1013`,attachBadge:`_attachBadge_1wqny_1014`,removeAttachBtn:`_removeAttachBtn_1wqny_1015`,projNameRow:`_projNameRow_1wqny_1018`,projNameLabel:`_projNameLabel_1wqny_1019`,projNameInput:`_projNameInput_1wqny_1020`,projActiveRow:`_projActiveRow_1wqny_1021`,projActiveName:`_projActiveName_1wqny_1022`,chatInputRow:`_chatInputRow_1wqny_1025`,attachLabel:`_attachLabel_1wqny_1026`,chatTextarea:`_chatTextarea_1wqny_1027`,chatSendCol:`_chatSendCol_1wqny_1030`,chatSendBtn:`_chatSendBtn_1wqny_1031`,chatStopBtn:`_chatStopBtn_1wqny_1033`,modalOverlay:`_modalOverlay_1wqny_1036`,modal:`_modal_1wqny_1036`,modalHeader:`_modalHeader_1wqny_1058`,modalTitle:`_modalTitle_1wqny_1059`,modalClose:`_modalClose_1wqny_1060`,modalBody:`_modalBody_1wqny_1062`,modalRow:`_modalRow_1wqny_1064`,modalField:`_modalField_1wqny_1065`,modalLabel:`_modalLabel_1wqny_1066`,modalLabelRow:`_modalLabelRow_1wqny_1067`,modalSelect:`_modalSelect_1wqny_1069`,modalInput:`_modalInput_1wqny_1070`,modalHint:`_modalHint_1wqny_1073`,modalAiBox:`_modalAiBox_1wqny_1075`,modalAiRow:`_modalAiRow_1wqny_1076`,modalAiDesc:`_modalAiDesc_1wqny_1077`,modalAiBtn:`_modalAiBtn_1wqny_1078`,modalContentArea:`_modalContentArea_1wqny_1081`,logView:`_logView_1wqny_1084`,modalFooter:`_modalFooter_1wqny_1086`,modalCancelBtn:`_modalCancelBtn_1wqny_1087`,modalSaveBtn:`_modalSaveBtn_1wqny_1088`,fileTreeWrap:`_fileTreeWrap_1wqny_1091`,headerIconBtn:`_headerIconBtn_1wqny_1101`,headerIconBtnActive:`_headerIconBtnActive_1wqny_1112`,terminalPanel:`_terminalPanel_1wqny_1115`,terminalHeader:`_terminalHeader_1wqny_1123`,terminalTitle:`_terminalTitle_1wqny_1132`,terminalClose:`_terminalClose_1wqny_1133`,scanBanner:`_scanBanner_1wqny_1136`,scanBannerIcon:`_scanBannerIcon_1wqny_1145`,scanBannerText:`_scanBannerText_1wqny_1146`,scanBannerFix:`_scanBannerFix_1wqny_1147`,findBar:`_findBar_1wqny_1150`,findInput:`_findInput_1wqny_1159`,findCount:`_findCount_1wqny_1170`,findBtn:`_findBtn_1wqny_1171`,findClose:`_findClose_1wqny_1173`,mobileTabBar:`_mobileTabBar_1wqny_1253`,mobileTabBtn:`_mobileTabBtn_1wqny_1263`,mobileTabBtnActive:`_mobileTabBtnActive_1wqny_1276`,mobileTabBtnIcon:`_mobileTabBtnIcon_1wqny_1279`},YT=[{id:`editor`,label:`Editor`,icon:`💻`},{id:`preview`,label:`Preview`,icon:`📱`},{id:`skills`,label:`Skills`,icon:`🛠`}];function XT(e,t){if(!e)return``;let n=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`);return e.split(`
|
|
752
|
-
`).map(e=>{let r=n(e);if(t===`css`)r=r.replace(/([a-z-]+)\s*(?=:)/g,`<span style="color:#82aaff">$1</span>`),r=r.replace(/(\/\*[\s\S]*?\*\/)/g,`<span style="color:#546e7a;font-style:italic">$1</span>`);else if(t===`html`||t===`htm`)r=r.replace(/(<\/?)([\w-]+)/g,`$1<span style="color:#f07178">$2</span>`),r=r.replace(/\s([\w-]+)(?==)/g,` <span style="color:#ffcb6b">$1</span>`),r=r.replace(/(["'])(?:(?!\1).)*?\1/g,`<span style="color:#c3e88d">$&</span>`);else if(t===`json`)r=r.replace(/(["'])(?:(?!\1|\\).|\\.)*?\1(?=\s*:)/g,`<span style="color:#82aaff">$&</span>`),r=r.replace(/:\s*(["'])(?:(?!\1|\\).|\\.)*?\1/g,e=>`: <span style="color:#c3e88d">`+e.slice(2)+`</span>`),r=r.replace(/:\s*(true|false|null)\b/g,`: <span style="color:#c792ea">$1</span>`),r=r.replace(/:\s*(\d+\.?\d*)/g,`: <span style="color:#f78c6c">$1</span>`);else{if(/^\s*\/\//.test(r))return`<span style="color:#546e7a;font-style:italic">`+r+`</span>`;r=r.replace(/(["'`])(?:(?!\1|\\).|\\.)*?\1/g,`<span style="color:#c3e88d">$&</span>`),r=r.replace(/\b(const|let|var|function|return|if|else|for|while|switch|case|break|continue|try|catch|throw|new|class|extends|import|export|from|default|async|await|typeof|instanceof)\b/g,`<span style="color:#c792ea">$&</span>`),r=r.replace(/\b(null|undefined|true|false)\b/g,`<span style="color:#ff5370">$&</span>`),r=r.replace(/\b(require|module|exports|console|process)\b/g,`<span style="color:#82aaff">$&</span>`)}return r}).join(`
|
|
753
|
-
`)}function ZT(e){if(!e)return``;let t=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`);return e.split(/(```[\s\S]*?```)/g).map(e=>{if(e.startsWith("```")&&e.endsWith("```")){let n=e.slice(3,-3),r=n.indexOf(`
|
|
754
|
-
`);return`<pre style="background:rgba(0,0,0,0.3);border:1px solid rgba(255,255,255,0.08);border-radius:6px;padding:8px 10px;margin:6px 0;overflow-x:auto;font-size:11px;line-height:1.5"><code>${t(r>0?n.slice(r+1):n)}</code></pre>`}let n=t(e);return n=n.replace(/`([^`]+)`/g,`<code style="background:rgba(99,102,241,0.15);padding:1px 5px;border-radius:3px;font-size:0.9em">$1</code>`),n=n.replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`),n=n.replace(/\*([^*]+)\*/g,`<em>$1</em>`),n=n.replace(/^### (.+)$/gm,`<div style="font-weight:700;font-size:13px;margin-top:8px;color:#6366f1">$1</div>`),n=n.replace(/^## (.+)$/gm,`<div style="font-weight:700;font-size:14px;margin-top:10px;color:#818cf8">$1</div>`),n=n.replace(/^[-*] (.+)$/gm,`<div style="padding-left:12px">• $1</div>`),n=n.replace(/^\d+\. (.+)$/gm,(e,t)=>`<div style="padding-left:12px">${t}</div>`),n=n.replace(/\n/g,`<br/>`),n}).join(``)}var QT=[{name:`MySaaS`,desc:`Full-stack SaaS web application with Node.js/Express backend and vanilla JS frontend.
|
|
755
|
-
|
|
756
|
-
BACKEND (server.js + routes/):
|
|
757
|
-
- Express server with helmet, cors, rate-limiting, compression middleware
|
|
758
|
-
- JWT authentication: POST /api/auth/register, /api/auth/login, /api/auth/refresh, /api/auth/logout
|
|
759
|
-
- Protected routes middleware checking Bearer token
|
|
760
|
-
- User model with bcrypt password hashing stored in JSON file DB (no external DB needed)
|
|
761
|
-
- Stripe-style subscription routes: GET /api/billing/plans, POST /api/billing/subscribe
|
|
762
|
-
- Dashboard API: GET /api/dashboard/stats (returns mock metrics), GET /api/user/profile
|
|
763
|
-
- Error handling middleware with proper HTTP status codes
|
|
764
|
-
|
|
765
|
-
FRONTEND (public/):
|
|
766
|
-
- index.html: Marketing landing page — sticky glass-morphism nav with logo + "Login" + "Start Free" buttons, animated gradient hero (#6366f1→#8b5cf6→#06b6d4) with headline "Ship faster. Scale smarter." + subheadline + 2 CTA buttons, features grid (6 cards with SVG icons: ⚡Speed, 🔒Security, 📊Analytics, 🤖AI, 🌍Global, 💬Support), pricing section (3 cards: Free/€0 · Pro/€29/mo · Enterprise/custom, Pro card highlighted with gradient border), testimonials carousel (3 quotes with avatar initials), FAQ accordion (5 items), footer with 4 column links + social icons
|
|
767
|
-
- dashboard.html: Protected SPA dashboard — sidebar nav with icons (Dashboard, Analytics, Users, Billing, Settings, Logout), top bar with user avatar + notifications bell, main content: KPI cards row (Total Users, MRR, Churn Rate, Active Sessions all with trend arrows), line chart (Chart.js), recent activity feed, quick actions panel
|
|
768
|
-
- login.html: Split-screen auth page — left panel gradient background with product tagline, right panel with tabbed Login/Register form, social login buttons (Google/GitHub), "Forgot password" link, real-time form validation with inline error messages
|
|
769
|
-
- public/css/main.css: CSS custom properties (--primary, --surface, --text, --border, --radius), dark theme by default, full responsive (mobile breakpoints at 768px, 480px), smooth transitions, glass-morphism card style (backdrop-filter: blur), custom scrollbar
|
|
770
|
-
- public/css/animations.css: keyframes for fadeInUp, slideInRight, pulse, shimmer loading skeleton, gradient-shift for hero background
|
|
771
|
-
- public/js/app.js: SPA router (hash-based), auth token management (localStorage), fetch wrapper with auto-refresh token on 401, Intersection Observer for scroll animations, mobile menu toggle
|
|
772
|
-
- public/js/auth.js: register/login/logout functions, form validation, error display, redirect after auth
|
|
773
|
-
- public/js/dashboard.js: load dashboard stats from API, render Chart.js line chart, populate activity feed, handle logout
|
|
774
|
-
|
|
775
|
-
CONFIG: package.json with all dependencies, .env.example with JWT_SECRET/PORT/NODE_ENV, README with setup instructions`},{name:`MyShop`,desc:`Full-stack e-commerce platform with Express backend and rich frontend.
|
|
776
|
-
|
|
777
|
-
BACKEND:
|
|
778
|
-
- server.js: Express + cors + helmet + morgan logging + static file serving
|
|
779
|
-
- routes/products.js: GET /api/products (with ?category=&sort=&search= query params), GET /api/products/:id, POST /api/products (admin), PUT/DELETE
|
|
780
|
-
- routes/cart.js: session-based cart — GET /api/cart, POST /api/cart/add, PUT /api/cart/update, DELETE /api/cart/remove, POST /api/cart/clear
|
|
781
|
-
- routes/orders.js: POST /api/orders/checkout (validates cart, creates order, returns order ID), GET /api/orders/:id
|
|
782
|
-
- models/products.js: 24 hardcoded products across 6 categories (Electronics, Clothing, Home, Books, Sports, Beauty) each with id/name/price/oldPrice/rating/reviews/image(emoji)/stock/badge(New/Sale/Hot)
|
|
783
|
-
- middleware/auth.js: simple API key middleware for admin routes
|
|
784
|
-
|
|
785
|
-
FRONTEND:
|
|
786
|
-
- index.html: Full e-commerce homepage — sticky nav with logo, search bar (live search on keyup), cart icon with animated badge counter, hamburger mobile menu. Hero: full-width banner with gradient + "Summer Sale — Up to 50% off" + CTA. Category strip: 6 clickable filter pills with emoji icons. Featured products: responsive grid (4 col desktop, 2 mobile) of product cards with image/name/rating stars/price with strikethrough old price/Add to Cart button with animation/wishlist heart toggle. "Load More" button. Promo banner: "Free shipping over €50". Newsletter signup with email input.
|
|
787
|
-
- product.html: Product detail page — breadcrumb, image gallery (main + 4 thumbnails), product info (name, rating, price, stock status), quantity selector, Add to Cart + Buy Now buttons, tabs (Description/Specifications/Reviews), related products grid
|
|
788
|
-
- cart.html: Cart page — line items with image/name/price/quantity stepper/remove button, order summary sidebar (subtotal/shipping/discount/total), promo code input, "Proceed to Checkout" button, "Continue Shopping" link, empty cart state
|
|
789
|
-
- checkout.html: Multi-step checkout — Step 1: Shipping address form (name/email/address/city/zip/country), Step 2: Payment method (Credit Card mock form with card number formatter, PayPal button), Step 3: Order confirmation with order number
|
|
790
|
-
- public/css/main.css: Full e-commerce design system — product card hover effects (translateY + shadow), star rating CSS, badge styles (New=green, Sale=red, Hot=orange), cart animation, responsive grid, dark/light mode toggle
|
|
791
|
-
- public/js/app.js: cart state management (add/remove/update quantity, persist to localStorage), live product filtering by category, search functionality, wishlist toggle, cart badge update animation, fetch products from API
|
|
792
|
-
- public/js/checkout.js: multi-step form navigation, credit card number formatting (spaces every 4 digits), form validation, order submission, confirmation display`},{name:`MyBlog`,desc:`Full-stack blog platform with markdown support, categories, tags, and comments.
|
|
793
|
-
|
|
794
|
-
BACKEND:
|
|
795
|
-
- server.js: Express + marked (markdown parser) + hljs (syntax highlighting) + RSS feed endpoint
|
|
796
|
-
- routes/posts.js: GET /api/posts (paginated, ?page=&category=&tag=&search=), GET /api/posts/:slug, POST/PUT/DELETE (admin auth)
|
|
797
|
-
- routes/comments.js: GET /api/posts/:slug/comments, POST (with name/email/content), DELETE (admin)
|
|
798
|
-
- routes/admin.js: POST /api/admin/login, GET /api/admin/posts, POST /api/admin/posts (create with markdown body), PUT, DELETE
|
|
799
|
-
- models/posts.js: 12 hardcoded blog posts in 4 categories (Tech, Design, Business, Life) with full markdown content, slug, author, date, readTime, tags, coverEmoji
|
|
800
|
-
- Middleware: markdown-to-HTML rendering, excerpt generation (first 160 chars), reading time calc
|
|
801
|
-
|
|
802
|
-
FRONTEND:
|
|
803
|
-
- index.html: Magazine-style homepage — sticky nav with logo + category links + search icon + dark mode toggle. Hero: featured post card (full-width with gradient overlay, category badge, title, excerpt, author + date + read time). Posts grid: masonry-style 3-column layout with post cards (cover emoji in colored square, category pill, title, excerpt, author avatar initials + name + date). Sidebar: "Trending" list (5 posts with rank numbers), Tag cloud (20 tags with size based on frequency), Newsletter signup, About widget. Pagination with numbered pages.
|
|
804
|
-
- post.html: Full article page — hero image area (large emoji + gradient bg), article header (category/title/subtitle/author card with avatar/date/readTime/share buttons), article body with styled markdown (h2 anchors, code blocks with syntax highlighting, blockquotes styled, inline code), "In this article" TOC sidebar (auto-generated from h2/h3), Comments section (threaded list + new comment form with name/email/message), Related posts grid (3 cards)
|
|
805
|
-
- admin.html: Minimal CMS — login form, then: posts list table (title/date/category/status/edit/delete), "New Post" button opens split-view editor (textarea left + live preview right with marked.js), category/tags/slug fields, publish toggle
|
|
806
|
-
- public/css/main.css: Editorial design system — serif font for headings (Georgia/Times), readable line-height 1.8, max-width 720px for article body, syntax highlight theme (dark), category color mapping, dark mode with prefers-color-scheme + toggle class
|
|
807
|
-
- public/js/app.js: dark mode toggle (localStorage persist), search overlay (keyboard shortcut /), category filter, lazy load images, smooth scroll ToC navigation, reading progress bar at top of article page`},{name:`MyPortfolio`,desc:`Developer portfolio — single-page app with animations and a working contact form backend.
|
|
808
|
-
|
|
809
|
-
BACKEND:
|
|
810
|
-
- server.js: Express serving static files + contact form endpoint
|
|
811
|
-
- routes/contact.js: POST /api/contact — validates name/email/message, rate-limits to 3/hour per IP, saves to contacts.json, returns success/error JSON
|
|
812
|
-
- routes/projects.js: GET /api/projects — returns 8 hardcoded project objects with title/description/techStack[]/githubUrl/liveUrl/image(emoji)/featured
|
|
813
|
-
|
|
814
|
-
FRONTEND (single HTML page + separate CSS/JS files):
|
|
815
|
-
- index.html: Full single-page portfolio — (1) Sticky nav: logo initials in gradient circle, links that highlight on scroll (About/Work/Skills/Contact), dark mode toggle, hamburger mobile. (2) Hero: full-viewport, name with gradient text effect, animated typewriter cycling through ["Full-Stack Developer", "UI/UX Designer", "Open Source Contributor", "Problem Solver"], subtext, two buttons (View Work → scroll / Download CV → fake PDF link), animated floating code snippets in background (CSS only). (3) About: two-column — photo placeholder (gradient circle with initials + CSS decoration), bio text + 4 stat counters (Years/Projects/Clients/Coffee) that count up on scroll into view. (4) Work: filter tabs (All/Frontend/Backend/Mobile), responsive project grid, each card has emoji image, title, description, 3 tech badges, GitHub + Live links. (5) Skills: grouped sections — Frontend (HTML/CSS/JS/React/Vue each with animated progress bar %), Backend (Node/Python/Go/SQL), Tools (Git/Docker/AWS/Figma), Languages (EN/IT/ES with flag). (6) Experience: vertical timeline — 4 entries with company, role, date range, bullet points, alternating left/right layout. (7) Contact: two-column — contact info (email/location/availability status green dot), social links (GitHub/LinkedIn/Twitter/Dribbble), contact form (name/email/subject/message textarea + send button with loading state). (8) Footer: minimal — copyright, back-to-top button.
|
|
816
|
-
- public/css/main.css: CSS custom properties for full theming, dark/light mode, smooth transitions on all interactive elements, gradient definitions, card hover effects (lift + shadow), timeline CSS, progress bar animations
|
|
817
|
-
- public/css/animations.css: Intersection Observer triggered classes (.visible), fadeInUp/fadeInLeft/fadeInRight keyframes, typewriter cursor blink, counter increment CSS trick, floating animation for hero decorations
|
|
818
|
-
- public/js/app.js: typewriter effect (array cycling with cursor), scroll-triggered animations (IntersectionObserver), counter animation (requestAnimationFrame), project filter (show/hide by category), dark mode toggle, active nav link on scroll (IntersectionObserver per section), contact form submit (fetch POST to backend, show success/error message, loading spinner on button), mobile menu`},{name:`MyRestaurant`,desc:`Restaurant website with online reservation system and menu management.
|
|
819
|
-
|
|
820
|
-
BACKEND:
|
|
821
|
-
- server.js: Express + nodemailer (mock) for reservation confirmation emails
|
|
822
|
-
- routes/reservations.js: POST /api/reservations (name/email/phone/date/time/guests/notes, validate date is future and time in range 12:00-22:00, check availability mock, save to reservations.json, return confirmation number), GET /api/reservations/availability?date=&guests= (returns available time slots)
|
|
823
|
-
- routes/menu.js: GET /api/menu (full menu grouped by category), GET /api/menu/:category
|
|
824
|
-
- models/menu.js: 40 menu items across 5 categories — Antipasti (8), Primi (8), Secondi (8), Contorni (6), Dolci (5), Bevande (5) — each with name/description/price/allergens[]/isVegetarian/isGlutenFree/emoji
|
|
825
|
-
|
|
826
|
-
FRONTEND:
|
|
827
|
-
- index.html: Premium restaurant website — (1) Full-screen hero: video-style background (CSS animated gradient in warm amber/brown tones), centered logo + tagline "Cucina Autentica dal 1987", reservation CTA button that opens modal. (2) Sticky nav: logo centered, links left/right symmetrically (Menu/Story/Gallery / Reservations/Events/Contact), transparent on hero, solid dark on scroll. (3) Story section: two-column layout — left: chef photo placeholder (sepia gradient + fork/knife icons), right: story text with pull quote, founding year counter. (4) Menu section: tab navigation (Antipasti/Primi/Secondi/Dolci/Bevande), 2-column menu list with item name + description + price, vegetarian/GF badges, "Full Menu" PDF button. (5) Reservation form embedded (name/phone/date picker/time select/guests 1-10/special requests), real-time availability check on date+guests change. (6) Gallery: CSS masonry grid 3x3 with hover overlay (category label + zoom icon), lightbox on click. (7) Hours & Location: two-column — opening hours table (Mon-Sun with times, today highlighted), Google Maps embed placeholder + address/phone/email. (8) Footer: warm dark background, logo, newsletter, social icons (Instagram/Facebook/TripAdvisor).
|
|
828
|
-
- public/css/main.css: Warm luxury design system — amber/gold palette (#d4a853, #8b6914), serif fonts (Georgia for headings), elegant spacing, menu item line styles, reservation form dark theme, gallery hover effects, mobile-first responsive`},{name:`MyJobBoard`,desc:`Full-stack job board with search, filters, applications, and company profiles.
|
|
829
|
-
|
|
830
|
-
BACKEND:
|
|
831
|
-
- server.js: Express + full REST API
|
|
832
|
-
- routes/jobs.js: GET /api/jobs (with ?q=&location=&type=&category=&salary_min=&page=&limit=), GET /api/jobs/:id, POST /api/jobs (company auth), PUT/DELETE. Returns paginated results with total count.
|
|
833
|
-
- routes/companies.js: GET /api/companies/:id, POST /api/companies/register, PUT (update profile)
|
|
834
|
-
- routes/applications.js: POST /api/applications (jobId/name/email/coverLetter/resumeText), GET /api/applications/job/:id (company only)
|
|
835
|
-
- models/jobs.js: 24 hardcoded jobs across 6 categories (Engineering/Design/Marketing/Sales/Data/DevOps), each with title/company/location/type(Remote/Hybrid/Onsite)/salary(€K range)/posted(relative date)/description/requirements[]/benefits[]/companyLogo(emoji)/featured/urgent badges
|
|
836
|
-
- Middleware: search text matching (title+description), salary range filter, pagination logic
|
|
837
|
-
|
|
838
|
-
FRONTEND:
|
|
839
|
-
- index.html: Job board homepage — (1) Hero: gradient background, large search widget (keyword input + location input + category select + Search button), quick stats bar (12,847 Jobs / 3,420 Companies / 45K Candidates). (2) Featured jobs: horizontal scroll row of 4 "Featured" cards with company logo (colored emoji), job title, company name, location + type badge + salary range + "Easy Apply" button. (3) Main layout: left sidebar filters (Job Type checkboxes, Salary Range slider, Category checkboxes, Location input, Posted Within select, Remote Only toggle) + right: jobs list (job row cards with company logo/title/company/location/type/salary/time-ago posted/Save bookmark/Apply button). (4) "Load More" button + results count "Showing 12 of 247 jobs". (5) Top companies section: 8 company cards with logo/name/industry/openings count. (6) Category browsing: 6 category cards with icon/name/count/link. (7) Job seeker CTA banner. (8) Newsletter.
|
|
840
|
-
- job.html: Job detail page — company header (logo + name + industry + website + size + "Follow" button), job title + badges (Remote, Senior, Urgent), salary + location + posted date, Apply Now button (sticky on scroll), job description (markdown-rendered sections: About/Responsibilities/Requirements/Nice-to-Have/Benefits), company sidebar card (description + stats), similar jobs list (4 cards)
|
|
841
|
-
- apply.html: Application modal/page — job summary header, form (Full Name / Email / Phone / LinkedIn URL / Portfolio URL / Cover Letter textarea with character count / Resume paste textarea), Submit button with loading state, success page with application reference number
|
|
842
|
-
- public/css/main.css: Modern job board design — tag/badge system (Remote=blue, Onsite=green, Urgent=red), salary range display, company logo placeholder styles, filter sidebar collapse on mobile, job card hover effects, application form validation styles`}],$T=[{key:`auth`,label:`Auth (register/login/JWT)`,icon:`🔒`},{key:`cookieBanner`,label:`GDPR Cookie Banner`,icon:`🍪`},{key:`securityMiddleware`,label:`Security Middleware`,icon:`🛡️`},{key:`emailVerification`,label:`Email Verification`,icon:`✉️`}],eE={js:`📄`,ts:`📄`,css:`🎨`,html:`🌐`,json:`📋`,md:`📑`,sql:`🗂`,env:`🔐`,conf:`⚙`,lock:`🔒`};function tE(e){return eE[e.split(`.`).pop()?.toLowerCase()??``]??`📄`}function nE(e){let t=new TextEncoder().encode(e).length;return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function rE(e){return e===`memory`?`🧠`:e===`provider`?`🤖`:e===`log`?`📄`:`📋`}function iE(){let e=M(),[t,n]=(0,_.useState)(`new`),[r,i]=(0,_.useState)(`files`),a=Ht(),[o,s]=(0,_.useState)(`editor`);(0,_.useEffect)(()=>{a&&(o===`preview`&&i(`preview`),o===`editor`&&i(`files`))},[a,o]);let[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)({auth:!0,cookieBanner:!0,securityMiddleware:!0,emailVerification:!0}),[m,h]=(0,_.useState)([{label:`Email`,type:`email`,required:!0},{label:`Password`,type:`password`,required:!0},{label:`Name`,type:`text`,required:!0}]),[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(0),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),[ee,T]=(0,_.useState)(new Set),[te,ne]=(0,_.useState)(!1),[O,re]=(0,_.useState)(``),[k,ie]=(0,_.useState)(``),[j,ae]=(0,_.useState)(!1),[oe,se]=(0,_.useState)(null),[ce,le]=(0,_.useState)(!1),[ue,N]=(0,_.useState)([]),[de,fe]=(0,_.useState)([]),pe=(0,_.useRef)(null),me=(0,_.useRef)(null),he=(0,_.useRef)(!0),ge=(0,_.useRef)(null),_e=(0,_.useRef)(null),ve=(0,_.useRef)(null),ye=(0,_.useRef)(null),[be,xe]=(0,_.useState)(null),[P,Se]=(0,_.useState)(!1),[Ce,we]=(0,_.useState)(!1),[Te,F]=(0,_.useState)(0),[Ee,De]=(0,_.useState)(0),[Oe,I]=(0,_.useState)(``),[L,ke]=(0,_.useState)({fi:0,total:0,name:``}),[Ae,je]=(0,_.useState)({tokIn:0,tokOut:0}),[Me,Ne]=(0,_.useState)(null),[Pe,Fe]=(0,_.useState)([]),[Ie,Le]=(0,_.useState)(``),[Re,R]=(0,_.useState)(!1),[ze,Be]=(0,_.useState)([]),[Ve,He]=(0,_.useState)(null),[Ue,We]=(0,_.useState)([]),[Ge,Ke]=(0,_.useState)(!1),[qe,Je]=(0,_.useState)(null),[Ye,Xe]=(0,_.useState)([]),[Ze,Qe]=(0,_.useState)(!1),[$e,et]=(0,_.useState)(``),[tt,nt]=(0,_.useState)([]),[rt,it]=(0,_.useState)([]),[at,ot]=(0,_.useState)([]),[st,ct]=(0,_.useState)(null),[lt,ut]=(0,_.useState)(!1),[dt,ft]=(0,_.useState)(!1),[pt,mt]=(0,_.useState)(null),[ht,gt]=(0,_.useState)([]),[_t,vt]=(0,_.useState)(`0s`),[z,yt]=(0,_.useState)(`0s`),bt=(0,_.useRef)(0),xt=(0,_.useRef)(0),St=(0,_.useRef)(null),Ct=(0,_.useRef)(null),wt=(0,_.useRef)(null),Tt=(0,_.useRef)(null),B=(0,_.useRef)(null),Et=(0,_.useRef)(!1),Dt=(0,_.useRef)(null);function Ot(e){console.log(`[WC-SCAN] scanning:`,e),D(`/api/studio/webcraft/scan`,{projectName:e}).then(e=>{console.log(`[WC-SCAN] result:`,e?.issues?.length,`issues`),e?.issues!==void 0&&fe(e.issues)}).catch(e=>{console.error(`[WC-SCAN] error:`,e)})}(0,_.useEffect)(()=>{if(!st){N([]);return}let e=setInterval(()=>{E(`/api/studio/webcraft/sandbox/errors`).then(e=>{e?.errors?.length&&N(e.errors)}).catch(()=>{})},5e3);return()=>clearInterval(e)},[st]);let kt=(0,_.useRef)(st);kt.current=st,(0,_.useEffect)(()=>{let e=()=>{kt.current&&(navigator.sendBeacon(`/api/studio/webcraft/sandbox/stop-beacon`,``),fetch(`/api/studio/webcraft/sandbox`,{method:`DELETE`,keepalive:!0}).catch(()=>{}))};return window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`beforeunload`,e),e()}},[]),(0,_.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key===`f`&&(e.preventDefault(),ne(e=>!e)),(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),C!==null&&g[y])){let e=g[y];v(e=>e.map((e,t)=>t===y?{...e,content:C}:e)),D(`/api/studio/webcraft/file/write`,{projectName:c,path:e.name,content:C}),w(null),T(t=>{let n=new Set(t);return n.delete(e.name),n})}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[C,y,g,c]),(0,_.useEffect)(()=>{let e=()=>{let e=C===null?ve.current:_e.current;e&&ye.current&&(ye.current.scrollTop=e.scrollTop)},t=C===null?ve.current:_e.current;return t&&t.addEventListener(`scroll`,e),()=>{t&&t.removeEventListener(`scroll`,e)}},[C,y]);function At(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function jt(e){let t=Math.floor((Date.now()-e)/1e3),n=Math.floor(t/60);return(n>0?`${n}m `:``)+`${t%60}s`}(0,_.useEffect)(()=>(P||Ce?St.current=setInterval(()=>{P&&vt(jt(bt.current)),Ce&&yt(jt(xt.current))},1e3):St.current&&=(clearInterval(St.current),null),()=>{St.current&&clearInterval(St.current)}),[P,Ce]);function V(){wt.current&&(wt.current.scrollTop=wt.current.scrollHeight)}(0,_.useEffect)(()=>{V()},[Pe]),(0,_.useEffect)(()=>{if(!c){We([]),Ke(!1);return}We([]),Ke(!1),E(`/api/studio/webcraft/skills/${encodeURIComponent(c)}`).then(e=>{e?.skills&&We(e.skills),Ke(!0)}).catch(()=>{Ke(!0)})},[c]);async function Mt(e,t){if(P||!e||e.length<5)return;Se(!0),v([]),b(0),S(null),ke({fi:0,total:0,name:``}),je({tokIn:0,tokOut:0}),bt.current=Date.now(),vt(`0s`),Ct.current=new AbortController;let n=Date.now();try{let r=await fetch(`/api/studio/webcraft/generate`,{method:`POST`,headers:{"Content-Type":`application/json`},signal:Ct.current.signal,body:JSON.stringify({projectName:t,description:e,blocks:f,authFields:m})});if(!r.ok||!r.body){Se(!1);return}let i=r.body.getReader(),a=Ct.current,o=new TextDecoder,s=``,u=[];for(;;){if(a?.signal?.aborted){try{i.cancel()}catch{}break}let{done:e,value:t}=await i.read();if(e)break;s+=o.decode(t,{stream:!0});let r=s.split(`
|
|
843
|
-
|
|
844
|
-
`);s=r.pop()??``;for(let e of r){let t=e.replace(/^data: /,``).trim();if(t)try{let e=JSON.parse(t);if(e.type===`project_renamed`)l(e.name);else if(e.type===`processing`||e.type===`planning`)ke(t=>({...t,name:e.type===`planning`?`📋 Pianificazione struttura...`:e.msg||`Avvio...`}));else if(e.type===`file_start`)u.push({name:e.name,content:``,_pending:!0}),v([...u]),ke({fi:e.fi,total:e.total,name:e.name}),pe.current=u.length-1,me.current||(b(u.length-1),S(``)),he.current=!0;else if(e.type===`file_chunk`){let t=u.find(t=>t.name===e.name);t&&(t.content+=e.chunk,t._pending=!1),v([...u]);let n=u.findIndex(t=>t.name===e.name);n>=0&&(pe.current=n,S(t?t.content:null))}else if(e.type===`file_done`){let t=u.find(t=>t.name===e.name);t&&(t._pending=!1,e.syntaxError&&(t._syntaxError=e.syntaxError)),v([...u]),ke({fi:e.fi,total:e.total,name:e.name}),(e.cumTokIn||e.cumTokOut)&&je({tokIn:e.cumTokIn||0,tokOut:e.cumTokOut||0})}else if(e.type===`file_error`){let t=u.find(t=>t.name===e.name);t&&(t._error=!0,t._pending=!1),v([...u])}else e.type===`phase`||e.type===`status`&&!e.op?ke(t=>({...t,name:e.msg||e.phase||``})):e.type===`done`&&(Ne({seconds:Math.round((Date.now()-n)/1e3),tokIn:e.tokIn??0,tokOut:e.tokOut??0,files:u.length}),S(null),Se(!1),pe.current=null,me.current&&=(clearTimeout(me.current),null),c&&Ot(c),le(!0),Ke(!1),We([]),u.some(e=>e._error||e._syntaxError)?setTimeout(()=>B.current?.(),800):setTimeout(()=>Dt.current?.(),800))}catch{}}}}catch(e){e.name!==`AbortError`&&Fe(t=>[...t,{role:`system`,text:`Errore generazione: `+e.message}]),Se(!1)}}async function Nt(){let e=Ie.trim();if(!(c&&g.length>0)){if(!e||e.length<5)return;let t=c||`MyProject`;l(t),d(e),Le(``),await Mt(e,t);return}if(!e&&ze.length===0||Re||P)return;let t=[...ze];if(Be([]),Le(``),e.toLowerCase().startsWith(`/plan `)||e.toLowerCase().startsWith(`piano: `)){let t=e.replace(/^\/plan[ ]*/i,``).replace(/^piano:[ ]*/i,``);Fe(t=>[...t,{role:`user`,text:e}]),await Pt(`[MODALITA PIANO] Descrivi cosa modificheresti per: "${t}". Elenca i file e cosa faresti. NON applicare modifiche ancora. Rispondi con il piano in bullet list.`,t,[]);return}Fe(n=>[...n,{role:`user`,text:e,attachments:t}]),await Pt(e,null,t)}async function Pt(e,t,n){if(Re)return;R(!0),c&&g.length>0&&D(`/api/studio/webcraft/snapshot`,{projectName:c}).catch(()=>{});let r={};g.forEach(e=>{r[e.name]=e.content});try{let i=new AbortController;Ct.current=i;let a=await fetch(`/api/studio/webcraft/agent`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectName:c,message:e,attachments:n.map(e=>({name:e.name,mimeType:e.mimeType,base64:e.base64}))}),signal:i.signal});if(!a.ok||!a.body){Fe(e=>[...e,{role:`agent`,text:`Errore: ${a.status}`,tools:[]}]),R(!1);return}let o={role:`agent`,text:``,tools:[]};Fe(e=>[...e,o]);let s=a.body.getReader(),l=new TextDecoder,u=``,d=!1,f=``;for(;;){if(i.signal.aborted){try{s.cancel()}catch{}break}let{done:e,value:n}=await s.read();if(e)break;u+=l.decode(n,{stream:!0});let a=u.split(`
|
|
845
|
-
|
|
846
|
-
`);u=a.pop()??``;for(let e of a){let n=e.replace(/^data: /,``).trim();if(n)try{let e=JSON.parse(n);if(e.type===`text`){f+=e.token;let t=f.lastIndexOf(`<`),n;t>=0&&!f.slice(t).includes(`>`)?(n=f.slice(0,t),f=f.slice(t)):(n=f.replace(/<tool>[\s\S]*?<\/tool>/g,``).replace(/<done\s*\/>/g,``),f=``),n&&(o.text+=n)}else if(e.type===`step`)o.text+=`\n\n**[Step ${e.step}/${e.max}]** `;else if(e.type===`tool`)(e.op===`edit`||e.op===`write`)&&console.log(`[WC-DEBUG] tool event:`,e.op,e.path,`result:`,e.result,`oldSnippet:`,(e.oldSnippet||``).length,`newSnippet:`,(e.newSnippet||``).length),o.tools.push({op:e.op,path:e.path,result:e.result,oldSnippet:e.oldSnippet??``,newSnippet:e.newSnippet??``}),(e.op===`edit`||e.op===`write`)&&(e.result===`ok`||e.result===`ok_fuzzy`||e.result===`ok_repaired`)&&(d=!0),Fe(e=>{let t=[...e];return t[t.length-1]={...o},t});else if(e.type===`files_changed`)e.files?.length&&await Ft(e.files,r);else if(e.type===`syntax_errors`)e.errors?.length&&(o.syntaxErrors=e.errors,Fe(e=>{let t=[...e];return t[t.length-1]={...o},t}));else if(e.type===`sandbox_restart`)o.text+=`
|
|
847
|
-
|
|
848
|
-
🔄 `+(e.msg||`Restarting sandbox...`),Fe(e=>{let t=[...e];return t[t.length-1]={...o},t});else if(e.type===`sandbox_ready`)ct(e.port),o.text+=`
|
|
849
|
-
✅ Sandbox ready on port `+e.port,Fe(e=>{let t=[...e];return t[t.length-1]={...o},t});else if(e.type===`sandbox_error`)o.text+=`
|
|
850
|
-
❌ Sandbox error: `+e.msg,Fe(e=>{let t=[...e];return t[t.length-1]={...o},t});else if(e.type===`done`){if(f){let e=f.replace(/<tool>[\s\S]*?<\/tool>/g,``).replace(/<done\s*\/>/g,``);e&&(o.text+=e),f=``}t&&!d&&He({plan:o.text,originalMessage:t}),R(!1),await Ft((o.tools??[]).filter(e=>(e.op===`edit`||e.op===`write`)&&(e.result===`ok`||e.result===`ok_fuzzy`||e.result===`ok_repaired`)).map(e=>e.path),r),c&&Ot(c)}else e.type===`error`&&(o.text+=`
|
|
851
|
-
Errore: `+e.msg,R(!1))}catch{}}}}catch(e){e instanceof DOMException&&e.name===`AbortError`||Fe(t=>[...t,{role:`agent`,text:`Errore di rete: `+e.message,tools:[]}])}if(R(!1),c){try{let e=await E(`/api/studio/webcraft/projects/load/${encodeURIComponent(c)}`);e?.files&&v(e.files)}catch{}setTimeout(()=>{c&&Ot(c)},200)}}async function Ft(e,t){if(!c)return;let n=await E(`/api/studio/webcraft/projects/load/${encodeURIComponent(c)}`);if(n?.files&&(v(n.files),c&&setTimeout(()=>Ot(c),300),e.length>0)){let r=e.map(e=>{let r=n.files.find(t=>t.name===e);return r?{file:e,before:t[e]??``,after:r.content??``}:null}).filter(Boolean);it(e=>[...e,...r])}}function It(){Ct.current&&=(Ct.current.abort(),null),Et.current=!0,Se(!1),R(!1),we(!1),I(``),S(null),Fe(e=>[...e,{role:`system`,text:`⏹ Generazione interrotta.`}])}async function Lt(){return c?(await D(`/api/studio/webcraft/snapshot`,{projectName:c}))?.snapshot??null:null}async function Rt(){let e=await Lt();e&&(Fe(t=>[...t,{role:`system`,text:`💾 Snapshot salvato (${e.slice(0,16).replace(`T`,` `)})`}]),zt())}async function zt(){if(!c)return;let e=await E(`/api/studio/webcraft/snapshots/${encodeURIComponent(c)}`);e?.snapshots&&Xe(e.snapshots)}async function Bt(e){confirm(`Ripristinare lo snapshot del ${e.replace(`T`,` `).slice(0,16)}? I file attuali verranno sovrascritti.`)&&await D(`/api/studio/webcraft/restore`,{projectName:c,ts:e})!==null&&(Fe(t=>[...t,{role:`agent`,text:`Snapshot ripristinato (${e}). Ricarico i file...`}]),Ft([],{}))}async function Vt(){if(!c)return;let e=await D(`/api/studio/webcraft/syntax-check`,{projectName:c});if(e?.results){let t=e.results.filter(e=>!e.ok);t.length>0?Fe(e=>[...e,{role:`system`,text:`⚠ Syntax check: ${t.length} errore/i trovato/i.`,syntaxErrors:t}]):Fe(e=>[...e,{role:`system`,text:`✓ Syntax check: tutti i file JS sono validi.`}])}}async function H(){let e=g.filter(e=>e._error||e._syntaxError);if(e.length===0){Dt.current?.();return}Et.current=!1,we(!0),F(0),De(e.length),xt.current=Date.now(),yt(`0s`);for(let t=0;t<e.length&&!Et.current;t++){let n=e[t];I(n.name),F(t);let r=`FIX ERROR in ${n.name}: ${n._syntaxError??`generazione fallita`}\n\nUse the edit tool to make surgical fixes. Do NOT rewrite the entire file — only change the broken parts. Read the file first, identify the exact lines with errors, and edit only those lines.`;try{await Pt(r,null,[])}catch{if(Et.current)break}}c&&Ot(c),Et.current||(F(e.length),setTimeout(()=>Dt.current?.(),500)),I(``),we(!1)}async function Ut(e){if(!dt){ft(!0),mt(null),ct(null),gt([]),i(`preview`);try{let t=await fetch(`/api/studio/webcraft/sandbox/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({projectName:e})});if(!t.ok||!t.body){mt(t.ok?`No response body`:`HTTP ${t.status}`),ft(!1);return}let n=t.body.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,{stream:!0});let a=i.split(`
|
|
852
|
-
|
|
853
|
-
`);i=a.pop()??``;for(let e of a){let t=e.replace(/^data: /,``).trim();if(t)try{let e=JSON.parse(t);(e.type===`phase`||e.type===`status`||e.type===`log`||e.type===`warn`||e.type===`error`)&>(t=>[...t.slice(-49),{kind:e.type,msg:String(e.msg||``),ts:Date.now()}]),e.type===`ready`&&e.port?(ct(e.port),ft(!1)):e.type===`error`&&mt(e.msg)}catch{}}}}catch(e){mt(e.message||`Connection failed`)}ft(!1)}}async function Wt(){c&&await Ut(c)}(0,_.useEffect)(()=>{B.current=H,Dt.current=Wt});async function Gt(){if(!$e||!c)return;let e=await D(`/api/studio/webcraft/grep`,{projectName:c,query:$e});e?.matches&&nt(e.matches)}function Kt(e){let t=g.findIndex(t=>t.name===e);t>=0&&(b(t),i(`files`))}function qt(){window.open(`/api/studio/webcraft/download/${encodeURIComponent(c)}`,`_blank`)}async function Jt(e,t,n,r){t.endsWith(`.md`)||(t+=`.md`);let i={name:t,content:n,type:r},a;a=e.mode===`edit`&&e.idx!==null?Ue.map((t,n)=>n===e.idx?i:t):[...Ue,i],We(a),Je(null);let o=c||`MyProject`;c||l(o),await D(`/api/studio/webcraft/skills/${encodeURIComponent(o)}`,{skills:a})}async function Yt(e){let t=Ue[e];!t||!confirm(`Eliminare "${t.name}"?`)||(await D(`/api/studio/webcraft/skills/${encodeURIComponent(c)}/delete`,{name:t.name}),We(Ue.filter((t,n)=>n!==e)))}async function U(e){let t=Ue[e];if(!t||!confirm(`Svuotare "${t.name}"? Il file rimane ma il contenuto viene cancellato.`))return;let n=Ue.map((t,n)=>n===e?{...t,content:``}:t);We(n),await D(`/api/studio/webcraft/skills/${encodeURIComponent(c)}`,{skills:n})}async function Xt(){let e=await E(`/api/studio/webcraft/projects`);e?.projects&&ot(e.projects)}async function Zt(e){let t=await E(`/api/studio/webcraft/projects/load/${encodeURIComponent(e.name)}`);if(!t)return;let r=t.projectName??e.name;l(r),d(t.description??``),v(t.files??[]),b(0),n(`new`),i(`files`),Fe([]),We([]),Ke(!1),fe([]),Ot(r);let a=await E(`/api/studio/webcraft/projects/chat/load/${encodeURIComponent(r)}`);a?.chat&&Fe(a.chat);let o=await E(`/api/studio/webcraft/skills/${encodeURIComponent(r)}`);o?.skills&&(We(o.skills),Ke(!0))}async function Qt(e){confirm(`Eliminare: ${e.name} - ${e.dir}?`)&&(await D(`/api/studio/webcraft/projects/${encodeURIComponent(e.name)}`,{},`DELETE`),ot(at.filter(t=>t.name!==e.name)),c===e.name&&(l(``),v([]),Fe([]),d(``)))}async function $t(){if(!Ve)return;let e=Ve.originalMessage;He(null),await Pt(e+`
|
|
854
|
-
[Piano approvato — procedi con le modifiche]`,null,[])}function en(e){e&&Array.from(e).forEach(e=>{let t=new FileReader;t.onload=t=>{let n=(t.target?.result).split(`,`)[1];Be(t=>[...t,{name:e.name,mimeType:e.type,base64:n,size:e.size}])},t.readAsDataURL(e)})}let W=c&&g.length>0,tn=g[y],nn=Re||P;return(0,A.jsxs)(`div`,{className:Q.root,children:[(0,A.jsxs)(`div`,{className:Q.header,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:Q.title,children:[`⚙ WebCraft`,c?` — ${c}`:``]}),!c&&(0,A.jsx)(`div`,{className:Q.subtitle,children:`Genera progetti web completi con agenti AI`})]}),(0,A.jsxs)(`div`,{className:Q.headerTabs,children:[(0,A.jsx)(`button`,{className:`${Q.tabBtn} ${t===`new`?Q.tabActive:``}`,onClick:async()=>{if(!(ee.size>0&&!confirm(`${ee.size} unsaved file(s). Discard changes and create new project?`))){if(st){try{await fetch(`/api/studio/webcraft/sandbox`,{method:`DELETE`})}catch{}ct(null)}v([]),b(0),S(null),w(null),T(new Set),Fe([]),l(``),d(``),Le(``),We([]),Ke(!1),Ne(null),Se(!1),R(!1),ae(!1),se(null),n(`new`)}},children:`+ Nuovo`}),(0,A.jsx)(`button`,{className:`${Q.tabBtn} ${t===`projects`?Q.tabActive:``}`,onClick:()=>{n(`projects`),Xt()},children:`📁 Progetti`})]})]}),(0,A.jsx)(`div`,{className:Q.body,children:t===`projects`?(0,A.jsx)(`div`,{className:Q.projectsList,children:at.length===0?(0,A.jsxs)(`div`,{className:Q.emptyProjects,children:[(0,A.jsx)(`span`,{className:Q.emptyIcon,children:`📁`}),(0,A.jsx)(`span`,{children:e(`webcraft.noProjects`)}),(0,A.jsx)(`span`,{className:Q.emptyHint,children:`Crea un progetto nella tab Nuovo`})]}):at.map(e=>(0,A.jsxs)(`div`,{className:Q.projectCard,children:[(0,A.jsxs)(`div`,{className:Q.projectInfo,children:[(0,A.jsx)(`div`,{className:Q.projectName,children:e.name}),(0,A.jsx)(`div`,{className:Q.projectDesc,children:e.description}),(0,A.jsxs)(`div`,{className:Q.projectMeta,children:[(0,A.jsxs)(`span`,{children:[`📄 `,e.fileCount,` file`]}),(0,A.jsxs)(`span`,{children:[`📅 `,e.createdAt?new Date(e.createdAt).toLocaleString():``]})]})]}),(0,A.jsx)(`button`,{className:Q.openBtn,onClick:()=>Zt(e),children:`↗ Apri`}),(0,A.jsx)(`button`,{className:Q.deleteBtn,onClick:()=>Qt(e),children:`🗑`})]},e.name))}):(0,A.jsxs)(`div`,{className:Q.editor,"data-mobile-view":a?o:void 0,children:[(0,A.jsxs)(`div`,{className:Q.examples,children:[(0,A.jsx)(`div`,{className:Q.sectionLabel,children:`Esempi`}),(0,A.jsx)(`div`,{className:Q.examplePills,children:QT.map(e=>(0,A.jsx)(`button`,{className:Q.examplePill,onClick:()=>{l(e.name),d(e.desc),Le(e.desc)},children:e.name},e.name))})]}),(0,A.jsxs)(`div`,{className:Q.editorCols,children:[(0,A.jsxs)(`div`,{className:Q.leftSidebar,children:[(0,A.jsxs)(`div`,{className:Q.panel,children:[(0,A.jsx)(`div`,{className:Q.panelTitle,children:`Blocchi`}),$T.map(e=>(0,A.jsxs)(`label`,{className:Q.blockLabel,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:f[e.key],onChange:t=>p(n=>({...n,[e.key]:t.target.checked})),className:Q.blockCheck}),(0,A.jsx)(`span`,{children:e.icon}),(0,A.jsx)(`span`,{children:e.label})]},e.key))]}),f.auth&&(0,A.jsxs)(`div`,{className:Q.panel,children:[(0,A.jsxs)(`div`,{className:Q.panelHeader,children:[(0,A.jsx)(`div`,{className:Q.panelTitle,children:`Campi Auth`}),(0,A.jsx)(`button`,{className:Q.addBtn,onClick:()=>h(e=>[...e,{label:`New field`,type:`text`,required:!1}]),children:`+ Campo`})]}),m.map((e,t)=>(0,A.jsxs)(`div`,{className:Q.authField,children:[(0,A.jsx)(`input`,{value:e.label,onChange:e=>h(n=>n.map((n,r)=>r===t?{...n,label:e.target.value}:n)),className:Q.authFieldInput}),(0,A.jsx)(`select`,{value:e.type,onChange:e=>h(n=>n.map((n,r)=>r===t?{...n,type:e.target.value}:n)),className:Q.authFieldSelect,children:[`text`,`email`,`password`,`tel`,`date`,`number`].map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))}),(0,A.jsx)(`input`,{type:`checkbox`,checked:e.required,onChange:e=>h(n=>n.map((n,r)=>r===t?{...n,required:e.target.checked}:n)),title:`Required`,className:Q.authFieldReq}),(0,A.jsx)(`button`,{onClick:()=>h(e=>e.filter((e,n)=>n!==t)),className:Q.removeFieldBtn,children:`×`})]},t))]}),(0,A.jsxs)(`div`,{className:Q.panel,children:[(0,A.jsxs)(`div`,{className:Q.panelHeader,children:[(0,A.jsx)(`div`,{className:Q.panelTitle,children:`🗂 Contesto AI`}),(0,A.jsx)(`button`,{className:Q.addBtn,onClick:()=>Je({mode:`new`,idx:null,name:``,content:``,type:`skill`,generating:!1}),children:`+ Skill`})]}),Ue.length>0?(0,A.jsx)(`div`,{className:Q.skillsList,children:Ue.map((e,t)=>(0,A.jsxs)(`div`,{className:Q.skillRow,children:[(0,A.jsx)(`span`,{className:Q.skillIcon,children:rE(e.type)}),(0,A.jsx)(`span`,{className:Q.skillName,title:e.name,children:e.name}),(0,A.jsx)(`span`,{className:`${Q.skillBadge} ${Q[`skillBadge_`+e.type]}`,children:e.type}),!e.content&&e.type!==`log`&&(0,A.jsx)(`span`,{className:Q.skillEmpty,children:`⚠`}),(0,A.jsx)(`button`,{className:Q.skillBtn,onClick:()=>Je({mode:e.type===`log`?`view`:`edit`,idx:t,name:e.name,content:e.content,type:e.type,generating:!1}),children:e.type===`log`?`👁`:`✏`}),e.type!==`memory`&&e.type!==`provider`&&e.type!==`log`&&(0,A.jsx)(`button`,{className:Q.skillBtn,onClick:()=>U(t),children:`🗑`}),e.type===`log`&&(0,A.jsx)(`button`,{className:Q.skillBtn,onClick:()=>Yt(t),children:`🗑`})]},t))}):(0,A.jsx)(`div`,{className:Q.skillsEmpty,children:Ge?`Nessun file di contesto. Clicca "+ Skill" per aggiungerne uno.`:`Crea o carica un progetto per i file di contesto.`})]}),Ye.length>0&&(0,A.jsxs)(`div`,{className:Q.panel,children:[(0,A.jsx)(`div`,{className:Q.panelTitle,children:`💾 Snapshot`}),Ye.slice(0,5).map(e=>{let t=e.ts.replace(`T`,` `).slice(0,16);return(0,A.jsxs)(`div`,{className:Q.snapshotRow,children:[(0,A.jsx)(`span`,{className:Q.snapshotTs,children:t}),(0,A.jsxs)(`span`,{className:Q.snapshotCount,children:[e.fileCount,`f`]}),(0,A.jsx)(`button`,{className:Q.snapshotBtn,onClick:()=>Bt(e.ts),children:`↺`})]},e.ts)})]}),P&&(0,A.jsx)(`div`,{className:Q.genStatus,children:`⏳ Generazione...`}),Ce&&(0,A.jsxs)(`div`,{className:Q.repairStatus,children:[(0,A.jsx)(`div`,{className:Q.repairStatusTitle,children:`🔧 Correzione automatica...`}),(0,A.jsxs)(`div`,{className:Q.repairStatusProg,children:[Te,` / `,Ee,` file`]}),(0,A.jsx)(`div`,{className:Q.repairStatusFile,children:Oe})]}),g.length>0&&!P&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:Q.actionRow,children:[(0,A.jsx)(`button`,{className:Q.actionBtn,onClick:qt,children:`⬇ ZIP`}),(0,A.jsx)(`button`,{className:Q.actionBtnIcon,title:`Syntax check`,onClick:Vt,children:`✅`}),(0,A.jsx)(`button`,{className:`${Q.actionBtnIcon} ${Ze?Q.actionBtnActive:``}`,title:`Grep`,onClick:()=>Qe(!Ze),children:`🔍`}),(0,A.jsx)(`button`,{className:Q.actionBtnIcon,title:`Snapshot`,onClick:Rt,children:`💾`})]}),g.some(e=>e._error||e._syntaxError)&&!Ce&&(0,A.jsx)(`button`,{className:Q.repairBtn,onClick:H,children:`🔧 Correggi tutti i file rossi`}),(0,A.jsx)(`button`,{className:Q.sandboxBtn,onClick:()=>{c?Ut(c):i(`preview`)},children:dt?`⏳ Starting...`:st?`🌐 Sandbox Live`:`▶ Sandbox`}),Me&&(0,A.jsxs)(`div`,{className:Q.statsBar,children:[(0,A.jsxs)(`span`,{children:[`⏱ `,Me.seconds>=60?`${Math.floor(Me.seconds/60)}m ${Me.seconds%60}s`:`${Me.seconds}s`]}),(0,A.jsxs)(`span`,{children:[`↑ `,Me.tokIn.toLocaleString(),` tok`]}),(0,A.jsxs)(`span`,{children:[`↓ `,Me.tokOut.toLocaleString(),` tok`]}),(0,A.jsxs)(`span`,{children:[`📄 `,Me.files,` file`]})]})]})]}),(0,A.jsxs)(`div`,{className:Q.rightPanel,children:[(0,A.jsxs)(`div`,{className:Q.rightTabBar,children:[(0,A.jsx)(`button`,{className:`${Q.rightTab} ${r===`preview`?``:Q.rightTabActive}`,onClick:()=>i(`files`),children:`📄 File`}),(0,A.jsx)(`button`,{className:`${Q.rightTab} ${r===`preview`?Q.rightTabActive:``}`,onClick:()=>i(`preview`),children:`🌐 Sandbox`})]}),Ce&&(0,A.jsxs)(`div`,{className:Q.repairBar,children:[(0,A.jsxs)(`div`,{className:Q.repairBarRow,children:[(0,A.jsx)(`span`,{className:Q.repairBarIcon,children:`🔧`}),(0,A.jsx)(`span`,{className:Q.repairBarLabel,children:`Auto-fix`}),(0,A.jsx)(`span`,{className:Q.repairBarFile,children:Oe}),(0,A.jsxs)(`span`,{className:Q.repairBarCounter,children:[Te,` / `,Ee]}),(0,A.jsx)(`span`,{className:Q.repairBarTime,children:z}),(0,A.jsx)(`button`,{className:Q.stopBtn,onClick:It,children:`⏹ Stop`})]}),(0,A.jsx)(`div`,{className:Q.progressTrack,children:(0,A.jsx)(`div`,{className:Q.repairProgress,style:{width:Ee>0?`${Math.round(Te/Ee*100)}%`:`0%`}})})]}),P&&(0,A.jsxs)(`div`,{className:Q.genBar,children:[(0,A.jsxs)(`div`,{className:Q.genBarRow,children:[(0,A.jsx)(`span`,{className:Q.genBarRobot,children:`🤖`}),(0,A.jsx)(`span`,{className:Q.genBarLabel,children:L.total===0?`Pianificazione...`:`Generazione`}),(0,A.jsx)(`span`,{className:Q.genBarFile,children:(L.name||``).split(`,`)[0].trim()}),(0,A.jsx)(`span`,{className:Q.genBarCounter,children:L.total>0?`${L.fi} / ${L.total}`:``}),(0,A.jsx)(`span`,{className:Q.genBarCounter,children:Ae.tokIn+Ae.tokOut>0?`↑${At(Ae.tokIn)} ↓${At(Ae.tokOut)}`:``}),(0,A.jsx)(`span`,{className:Q.genBarTime,children:_t}),(0,A.jsxs)(`span`,{className:Q.genDots,children:[(0,A.jsx)(`span`,{className:`${Q.dot} ${Q.dot1}`}),(0,A.jsx)(`span`,{className:`${Q.dot} ${Q.dot2}`}),(0,A.jsx)(`span`,{className:`${Q.dot} ${Q.dot3}`})]})]}),(0,A.jsx)(`div`,{className:Q.progressTrack,children:(0,A.jsx)(`div`,{className:Q.genProgress,style:{width:L.total>0?`${Math.round(L.fi/L.total*100)}%`:`0%`}})})]}),r===`preview`?(0,A.jsxs)(`div`,{className:Q.sandboxWrap,children:[(0,A.jsxs)(`div`,{className:Q.sandboxStatusBar,children:[(0,A.jsx)(`span`,{className:Q.sandboxStatusDot,style:{background:st?`#4ade80`:dt?`#facc15`:`#64748b`}}),(0,A.jsx)(`span`,{className:Q.sandboxStatusText,children:st?`Live :${st}`:dt?`Starting...`:`Stopped`}),st&&(0,A.jsx)(`button`,{className:Q.sandboxReloadBtn,onClick:()=>{let e=document.querySelector(`iframe[title="WebCraft Sandbox"]`);e&&(e.src=e.src)},children:`↻`}),st&&(0,A.jsx)(`button`,{className:Q.sandboxStopBtn,onClick:async()=>{ct(null),N([]);try{await fetch(`/api/studio/webcraft/sandbox`,{method:`DELETE`})}catch{}},children:`⏹`}),!st&&!dt&&(0,A.jsx)(`button`,{className:Q.sandboxStartBtnSmall,onClick:()=>{c&&Ut(c)},children:`▶ Start`})]}),ue.length>0&&(0,A.jsxs)(`div`,{className:Q.runtimeErrors,children:[(0,A.jsxs)(`div`,{className:Q.runtimeErrorsHeader,children:[(0,A.jsxs)(`span`,{children:[`❌ `,ue.length,` runtime error`,ue.length>1?`s`:``]}),(0,A.jsx)(`button`,{className:Q.runtimeErrorsFix,onClick:()=>{Le(`Fix these runtime errors:\n${ue.map(e=>`${e.message} (${e.source||``}:${e.line||0})`).join(`
|
|
855
|
-
`)}`),fetch(`/api/studio/webcraft/sandbox/errors`,{method:`DELETE`}),N([]),i(`files`)},children:`🔧 Auto-fix`}),(0,A.jsx)(`button`,{className:Q.runtimeErrorsDismiss,onClick:()=>{fetch(`/api/studio/webcraft/sandbox/errors`,{method:`DELETE`}),N([])},children:`✕`})]}),ue.slice(0,3).map((e,t)=>(0,A.jsxs)(`div`,{className:Q.runtimeErrorLine,children:[e.message,e.source?` — ${e.source.split(`/`).pop()}:${e.line}`:``]},t))]}),st?(0,A.jsx)(`iframe`,{src:`http://localhost:${st}`,className:Q.sandboxFrame,title:`WebCraft Sandbox`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`}):(0,A.jsxs)(`div`,{className:Q.sandboxEmpty,children:[(0,A.jsx)(`span`,{style:{fontSize:48},children:dt?`⏳`:pt?`❌`:`🌐`}),(0,A.jsx)(`span`,{style:{fontWeight:700,fontSize:16},children:dt?`Starting sandbox...`:pt?`Sandbox Error`:`Preview`}),pt&&(0,A.jsx)(`pre`,{style:{fontSize:11,maxWidth:600,textAlign:`left`,color:`#f87171`,background:`rgba(248,113,113,0.08)`,border:`1px solid rgba(248,113,113,0.2)`,borderRadius:6,padding:`8px 12px`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,margin:`8px 0`,lineHeight:1.5,maxHeight:200,overflow:`auto`},children:pt}),ht.length>0&&(0,A.jsxs)(`div`,{style:{width:`100%`,maxWidth:720,margin:`8px 0`,textAlign:`left`},children:[(0,A.jsxs)(`div`,{style:{fontSize:10,color:`#94a3b8`,textTransform:`uppercase`,letterSpacing:`0.5px`,marginBottom:4},children:[`Sandbox log (`,ht.length,`)`]}),(0,A.jsx)(`pre`,{style:{fontSize:11,lineHeight:1.5,fontFamily:`SF Mono, Monaco, monospace`,background:`rgba(15, 23, 42, 0.6)`,border:`1px solid rgba(148, 163, 184, 0.18)`,borderRadius:6,padding:`8px 12px`,maxHeight:240,overflow:`auto`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,color:`#cbd5e1`},children:ht.slice(-40).map((e,t)=>(0,A.jsx)(`div`,{style:{color:e.kind===`error`?`#f87171`:e.kind===`warn`?`#fbbf24`:e.kind===`phase`?`#60a5fa`:e.kind===`status`?`#34d399`:`#94a3b8`},children:`[${e.kind}] ${e.msg}`},t))})]}),!dt&&(0,A.jsxs)(`button`,{className:Q.sandboxStartBtn,onClick:()=>{c&&Ut(c)},children:[`▶ `,pt?`Retry`:`Start Sandbox`]})]})]}):(0,A.jsx)(`div`,{className:Q.codeArea,children:g.length===0&&P?(0,A.jsx)(`div`,{className:Q.noFiles,children:(0,A.jsxs)(`div`,{className:Q.noFilesHero,children:[(0,A.jsx)(`span`,{className:Q.noFilesIcon,children:`⏳`}),(0,A.jsx)(`span`,{className:Q.noFilesTitle,children:`Pianificazione...`}),(0,A.jsx)(`span`,{className:Q.noFilesTagline,children:L.name||`Analisi della struttura del progetto in corso`})]})}):g.length===0?(0,A.jsxs)(`div`,{className:Q.noFiles,children:[(0,A.jsxs)(`div`,{className:Q.noFilesHero,children:[(0,A.jsx)(`span`,{className:Q.noFilesIcon,children:`🔨`}),(0,A.jsx)(`span`,{className:Q.noFilesTitle,children:`WebCraft`}),(0,A.jsx)(`span`,{className:Q.noFilesTagline,children:`Genera progetti web completi con AI`})]}),(0,A.jsxs)(`div`,{className:Q.noFilesSteps,children:[(0,A.jsxs)(`div`,{className:Q.noFilesStep,children:[(0,A.jsx)(`span`,{className:Q.noFilesStepNum,children:`1`}),(0,A.jsx)(`span`,{children:`Scegli un esempio o scrivi una descrizione nel box in basso`})]}),(0,A.jsxs)(`div`,{className:Q.noFilesStep,children:[(0,A.jsx)(`span`,{className:Q.noFilesStepNum,children:`2`}),(0,A.jsxs)(`span`,{children:[`Premi `,(0,A.jsx)(`strong`,{children:`▶ Genera`}),` — l'AI crea tutti i file del progetto`]})]}),(0,A.jsxs)(`div`,{className:Q.noFilesStep,children:[(0,A.jsx)(`span`,{className:Q.noFilesStepNum,children:`3`}),(0,A.jsx)(`span`,{children:`Chiedi modifiche in chat, scarica lo ZIP o avvia il Sandbox`})]})]}),(0,A.jsxs)(`div`,{className:Q.noFilesExamplesHint,children:[`💡 Prova: `,(0,A.jsx)(`button`,{className:Q.noFilesExampleBtn,onClick:()=>{let e=QT[0];l(e.name),d(e.desc),Le(e.desc)},children:`MySaaS`}),(0,A.jsx)(`button`,{className:Q.noFilesExampleBtn,onClick:()=>{let e=QT[1];l(e.name),d(e.desc),Le(e.desc)},children:`MyShop`}),(0,A.jsx)(`button`,{className:Q.noFilesExampleBtn,onClick:()=>{let e=QT[3];l(e.name),d(e.desc),Le(e.desc)},children:`MyPortfolio`})]})]}):(0,A.jsxs)(`div`,{className:Q.codeLayout,children:[(0,A.jsx)(`div`,{className:Q.ideTabBar,children:g.map((e,t)=>{let n=e._error||!!e._syntaxError,r=t===y;return(0,A.jsxs)(`button`,{className:`${Q.ideTab} ${r?Q.ideTabActive:``} ${n?Q.ideTabError:``} ${e._pending?Q.ideTabPending:``}`,onClick:()=>{b(t),w(null),S(null),P&&pe.current!==null&&t!==pe.current&&(me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{pe.current!==null&&(b(pe.current),S(null))},1e4))},title:e.name,children:[(0,A.jsx)(`span`,{className:Q.ideTabIcon,children:e._pending?`⌛`:n?`⚠`:tE(e.name)}),(0,A.jsx)(`span`,{className:Q.ideTabName,children:(e.name||``).split(`/`).pop()}),ee.has(e.name)&&(0,A.jsx)(`span`,{className:Q.ideTabUnsaved,children:`●`}),n&&(0,A.jsx)(`span`,{className:Q.ideTabDot})]},t)})}),be&&(0,A.jsxs)(`div`,{className:Q.diffOverlay,children:[(0,A.jsxs)(`div`,{className:Q.diffOverlayHeader,children:[(0,A.jsxs)(`span`,{children:[`✏ Modifica proposta — `,(0,A.jsx)(`strong`,{children:be.file})]}),(0,A.jsxs)(`div`,{className:Q.diffOverlayActions,children:[(0,A.jsx)(`button`,{className:Q.diffAcceptBtn,onClick:()=>{v(e=>e.map(e=>e.name===be.file?{...e,content:be.after}:e)),xe(null)},children:`✓ Accetta`}),(0,A.jsx)(`button`,{className:Q.diffRejectBtn,onClick:()=>xe(null),children:`✕ Rifiuta`})]})]}),(0,A.jsx)(`div`,{className:Q.diffOverlayBody,children:(0,A.jsx)(cE,{before:be.before,after:be.after})})]}),(0,A.jsxs)(`div`,{className:Q.codeRow,children:[(0,A.jsxs)(`div`,{className:Q.fileTreeWrap,children:[de.length>0&&(0,A.jsxs)(`div`,{className:Q.scanBanner,children:[(0,A.jsx)(`span`,{className:Q.scanBannerIcon,children:`⚠`}),(0,A.jsxs)(`span`,{className:Q.scanBannerText,children:[de.length,` issue`,de.length>1?`s`:``]}),(0,A.jsx)(`button`,{className:Q.scanBannerFix,onClick:()=>{Le(`Fix all these issues:\n${de.map(e=>`[${e.severity}] ${e.file}: ${e.message}`).join(`
|
|
856
|
-
`)}`),i(`files`)},children:`Fix`})]}),(0,A.jsx)(HT,{files:g,activeIndex:y,unsavedFiles:ee,errorFiles:new Set(de.filter(e=>e.severity===`error`).map(e=>e.file)),onSelect:e=>{b(e),w(null),S(null),P&&pe.current!==null&&e!==pe.current&&(me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{pe.current!==null&&(b(pe.current),S(null))},1e4))}})]}),(0,A.jsx)(`div`,{className:Q.codeEditorWrap,children:tn&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:Q.codeHeader,children:[(0,A.jsx)(`span`,{className:Q.codeFileIcon,children:tE(tn.name)}),(0,A.jsx)(`span`,{className:Q.codeFileName,children:tn.name}),tn.content&&!tn._error&&(0,A.jsxs)(`span`,{className:Q.codeFileMeta,children:[(tn.content||``).split(`
|
|
857
|
-
`).length,` righe · `,nE(tn.content||``)]}),!tn._pending&&!tn._error&&tn.content&&(0,A.jsx)(`button`,{className:`${Q.editToggleBtn} ${C===null?``:Q.editToggleBtnActive}`,onClick:()=>{C===null?w(tn.content):(v(e=>e.map((e,t)=>t===y?{...e,content:C}:e)),D(`/api/studio/webcraft/file/write`,{projectName:c,path:tn.name,content:C}),w(null))},children:C===null?`✏ Modifica`:`💾 Salva`}),(0,A.jsx)(`button`,{className:Q.headerIconBtn,title:`Split view`,onClick:()=>se(oe===null?+(y===0&&g.length>1):null),children:`⫼`}),(0,A.jsx)(`button`,{className:`${Q.headerIconBtn} ${j?Q.headerIconBtnActive:``}`,title:`Terminal`,onClick:()=>ae(!j),children:`⌨`}),(0,A.jsx)(`button`,{className:Q.headerIconBtn,title:`Development Guide`,onClick:()=>le(!0),children:`📖`})]}),te&&(0,A.jsxs)(`div`,{className:Q.findBar,children:[(0,A.jsx)(`input`,{className:Q.findInput,value:O,onChange:e=>re(e.target.value),placeholder:`Find...`,autoFocus:!0}),(0,A.jsx)(`input`,{className:Q.findInput,value:k,onChange:e=>ie(e.target.value),placeholder:`Replace...`}),(0,A.jsx)(`span`,{className:Q.findCount,children:O?((tn.content||``).match(new RegExp(O.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),`gi`))?.length||0)+` found`:``}),(0,A.jsx)(`button`,{className:Q.findBtn,onClick:()=>{!O||C===null||w(C.replace(new RegExp(O.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),`i`),k))},children:`Replace`}),(0,A.jsx)(`button`,{className:Q.findBtn,onClick:()=>{!O||C===null||w(C.replace(new RegExp(O.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),`gi`),k))},children:`All`}),(0,A.jsx)(`button`,{className:Q.findClose,onClick:()=>ne(!1),children:`×`})]}),tn._error&&(0,A.jsx)(`div`,{className:Q.fileError,children:`⚠ Generazione fallita — chiedi al modello di rigenerare questo file`}),tn._syntaxError&&!tn._error&&(0,A.jsxs)(`div`,{className:Q.fileSyntaxError,children:[`⚠ Syntax error: `,tn._syntaxError]}),P&&x!==null?(0,A.jsx)(`pre`,{className:Q.streamingPre,ref:e=>{e&&he.current&&(e.scrollTop=e.scrollHeight)},onScroll:e=>{let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<50?he.current=!0:(he.current=!1,ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>{he.current=!0},15e3))},dangerouslySetInnerHTML:{__html:XT(x||``,(tn.name.split(`.`).pop()||`js`).toLowerCase())+`<span class="`+Q.streamingCursor+`">▋</span>`}}):(0,A.jsx)(IT,{value:C===null?tn.content||``:C,filename:tn.name,readOnly:C===null,projectName:c,onChange:e=>{w(e),tn&&T(e=>new Set(e).add(tn.name))},onSave:e=>{v(t=>t.map((t,n)=>n===y?{...t,content:e}:t)),D(`/api/studio/webcraft/file/write`,{projectName:c,path:tn.name,content:e}),w(null),T(e=>{let t=new Set(e);return t.delete(tn.name),t})}})]})}),oe!==null&&g[oe]&&(0,A.jsxs)(`div`,{className:Q.codeEditorWrap,children:[(0,A.jsxs)(`div`,{className:Q.codeHeader,children:[(0,A.jsx)(`span`,{className:Q.codeFileIcon,children:tE(g[oe].name)}),(0,A.jsx)(`span`,{className:Q.codeFileName,children:g[oe].name}),(0,A.jsx)(`button`,{className:Q.headerIconBtn,onClick:()=>se(null),children:`✕`})]}),(0,A.jsx)(IT,{value:g[oe].content||``,filename:g[oe].name,readOnly:!0})]})]}),j&&(0,A.jsxs)(`div`,{className:Q.terminalPanel,children:[(0,A.jsxs)(`div`,{className:Q.terminalHeader,children:[(0,A.jsx)(`span`,{className:Q.terminalTitle,children:`Terminal`}),(0,A.jsx)(`button`,{className:Q.terminalClose,onClick:()=>ae(!1),children:`✕`})]}),(0,A.jsx)(qT,{projectDir:c||void 0})]})]})})]})]})]})}),Ve&&t!==`projects`&&(0,A.jsxs)(`div`,{className:Q.planBanner,children:[(0,A.jsx)(`div`,{className:Q.planTitle,children:`📌 Piano proposto — approva per eseguire`}),(0,A.jsx)(`pre`,{className:Q.planText,children:Ve.plan}),(0,A.jsxs)(`div`,{className:Q.planActions,children:[(0,A.jsx)(`button`,{className:Q.planApprove,onClick:$t,children:`✓ Esegui`}),(0,A.jsx)(`button`,{className:Q.planReject,onClick:()=>He(null),children:`✕ Annulla`})]})]}),Ze&&t!==`projects`&&(0,A.jsxs)(`div`,{className:Q.grepPanel,children:[(0,A.jsxs)(`div`,{className:Q.grepRow,children:[(0,A.jsx)(`input`,{className:Q.grepInput,value:$e,onChange:e=>et(e.target.value),onKeyDown:e=>e.key===`Enter`&&Gt(),placeholder:`Cerca nel codice...`}),(0,A.jsx)(`button`,{className:Q.grepBtn,onClick:Gt,children:`🔍`}),(0,A.jsx)(`button`,{className:Q.grepClose,onClick:()=>Qe(!1),children:`×`})]}),tt.length>0&&(0,A.jsxs)(`div`,{className:Q.grepCount,children:[tt.length,` risultati`]}),(0,A.jsx)(`div`,{className:Q.grepResults,children:tt.length===0?(0,A.jsx)(`div`,{className:Q.grepEmpty,children:`Nessun risultato.`}):tt.map((e,t)=>(0,A.jsxs)(`div`,{className:Q.grepMatch,onClick:()=>Kt(e.file),children:[(0,A.jsxs)(`span`,{className:Q.grepMatchFile,children:[e.file,`:`,e.lineNum]}),(0,A.jsx)(`pre`,{className:Q.grepMatchLine,children:e.line})]},t))})]}),rt.length>0&&t!==`projects`&&(0,A.jsxs)(`div`,{className:Q.diffPanel,children:[(0,A.jsxs)(`div`,{className:Q.diffHeader,children:[(0,A.jsxs)(`span`,{children:[`🔌 Diff — `,rt.length,` file modificati`]}),(0,A.jsx)(`button`,{className:Q.diffClose,onClick:()=>it([]),children:`✕ Chiudi`})]}),rt.map((e,t)=>{let n=(e.after||``).split(`
|
|
858
|
-
`).length-(e.before||``).split(`
|
|
859
|
-
`).length;return(0,A.jsxs)(`details`,{open:!0,className:Q.diffFile,children:[(0,A.jsxs)(`summary`,{className:Q.diffSummary,children:[(0,A.jsx)(`span`,{className:Q.diffArrow,children:`▲`}),(0,A.jsx)(`span`,{className:Q.diffFileName,children:e.file}),(0,A.jsxs)(`span`,{className:n>=0?Q.diffAdded:Q.diffRemoved,children:[n>=0?`+`:``,n,` linee`]})]}),(0,A.jsx)(`div`,{className:Q.diffContent,children:(0,A.jsx)(cE,{before:e.before,after:e.after})})]},t)})]}),t!==`projects`&&(0,A.jsxs)(`div`,{className:`${Q.chatPanel} ${lt?Q.chatPanelCollapsed:``}`,children:[(0,A.jsxs)(`button`,{className:Q.chatCollapseBtn,onClick:()=>ut(e=>!e),children:[(0,A.jsx)(`span`,{children:lt?`▲`:`▼`}),(0,A.jsx)(`span`,{children:lt?`Show Chat`:`Hide Chat`}),Pe.length>0&&(0,A.jsxs)(`span`,{style:{opacity:.5},children:[`(`,Pe.length,`)`]})]}),(0,A.jsxs)(`div`,{className:Q.chatMessages,ref:wt,children:[Pe.length===0&&W&&(0,A.jsxs)(`div`,{className:Q.chatWelcome,children:[`🤖 `,e(`webcraft.doctrine.title`),` — `,(0,A.jsx)(`button`,{className:Q.doctrineOpenBtn,onClick:()=>le(!0),children:`📖 Open Guide`})]}),Pe.map((e,t)=>(0,A.jsxs)(`div`,{className:e.role===`user`?Q.chatUser:e.role===`system`?Q.chatSystem:Q.chatAgent,children:[e.role===`user`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:Q.chatUserBubble,children:e.text}),e.attachments&&e.attachments.length>0&&(0,A.jsx)(`div`,{className:Q.chatAttachPreviews,children:e.attachments.map((e,t)=>(0,A.jsxs)(`span`,{className:Q.chatAttachBadge,children:[`📎 `,e.name]},t))})]}),e.role===`system`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:Q.chatSystemBubble,children:e.text}),e.syntaxErrors?.map((e,t)=>(0,A.jsxs)(`div`,{className:Q.chatSyntaxErr,children:[`✕ `,e.file,`: `,e.error]},t))]}),e.role===`agent`&&(()=>{let t=e.text.replace(/<tool>[\s\S]*?<\/tool>/g,``).replace(/<done\s*\/?>/g,``).trim(),n=(e.tools||[]).filter(e=>(e.op===`edit`||e.op===`write`)&&(e.result===`ok`||e.result===`ok_fuzzy`||e.result===`ok_repaired`)),r=(e.tools||[]).filter(e=>e.result?.includes(`not_found`)||e.result?.includes(`error`)||e.result===`blocked_use_edit`),a=t.match(/^(.{10,120}?)[.\n]/),o=a?a[1]+`.`:t.slice(0,120),s=t.length>130;return(0,A.jsxs)(`div`,{className:Q.chatAgentCard,children:[n.map((e,t)=>(0,A.jsxs)(`div`,{style:{margin:`6px 0`,borderRadius:8,overflow:`hidden`,border:`1px solid rgba(255,255,255,0.08)`},children:[(0,A.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`6px 10px`,background:`rgba(99,102,241,0.1)`,fontSize:11},children:[(0,A.jsxs)(`span`,{style:{fontWeight:600,color:`#818cf8`,cursor:`pointer`},onClick:()=>{let t=g.findIndex(t=>t.name===e.path);t>=0&&(b(t),i(`files`))},children:[`✏ `,e.path]}),(0,A.jsx)(`span`,{style:{color:`#4ade80`,fontSize:10,fontWeight:600},children:e.result===`ok_fuzzy`?`applied (fuzzy)`:e.result===`ok_repaired`?`applied (repaired)`:`✓ applied`})]}),e.oldSnippet||e.newSnippet?(0,A.jsx)(cE,{before:e.oldSnippet||``,after:e.newSnippet||``,contextLines:3}):(0,A.jsx)(`div`,{style:{padding:`6px 10px`,fontSize:11,color:`#4ade80`,background:`rgba(74,222,128,0.05)`},children:`File modified successfully`})]},t)),r.length>0&&(0,A.jsx)(`div`,{style:{margin:`6px 0`,padding:`6px 10px`,background:`rgba(248,113,113,0.08)`,borderRadius:6,fontSize:11,color:`#f87171`},children:r.map((e,t)=>(0,A.jsxs)(`div`,{children:[`❌ `,e.op,` `,e.path,`: `,typeof e.result==`string`?e.result.slice(0,100):``]},t))}),t&&(s?(0,A.jsxs)(`details`,{style:{margin:`6px 0`,fontSize:11},children:[(0,A.jsx)(`summary`,{style:{cursor:`pointer`,color:`var(--dim)`,padding:`4px 0`,userSelect:`none`},children:o.slice(0,100)}),(0,A.jsx)(`div`,{className:Q.chatAgentText,style:{fontSize:11,opacity:.8,marginTop:4},dangerouslySetInnerHTML:{__html:ZT(t)}})]}):(0,A.jsx)(`div`,{className:Q.chatAgentText,style:{fontSize:11,opacity:.8},dangerouslySetInnerHTML:{__html:ZT(t)}}))]})})()]},t)),Re&&(()=>{let e=Pe[Pe.length-1]?.tools??[],t=e[e.length-1],n=t?t.op===`read`?`Reading ${t.path}`:t.op===`edit`?`Editing ${t.path}`:t.op===`search`?`Searching...`:t.op===`lint`?`Linting ${t.path}`:t.op===`check`?`Checking ${t.path}`:t.op===`run`?`Running command...`:t.op===`sandbox`?`Starting sandbox...`:t.op:`Thinking...`;return(0,A.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,fontSize:12,color:`#818cf8`},children:[(0,A.jsx)(`span`,{className:Q.chatAgentRobotAnim,style:{fontSize:14},children:`⟳`}),(0,A.jsx)(`span`,{style:{fontWeight:500},children:n})]})})()]}),ze.length>0&&(0,A.jsx)(`div`,{className:Q.attachPreviews,children:ze.map((e,t)=>(0,A.jsxs)(`span`,{className:Q.attachBadge,children:[`📎 `,e.name,(0,A.jsx)(`button`,{className:Q.removeAttachBtn,onClick:()=>Be(e=>e.filter((e,n)=>n!==t)),children:`×`})]},t))}),W?(0,A.jsxs)(`div`,{className:Q.projActiveRow,children:[`📄 `,(0,A.jsx)(`strong`,{className:Q.projActiveName,children:c}),` — scrivi per modificare o migliorare il progetto`]}):(0,A.jsxs)(`div`,{className:Q.projNameRow,children:[(0,A.jsx)(`span`,{className:Q.projNameLabel,children:`Nome progetto:`}),(0,A.jsx)(`input`,{className:Q.projNameInput,value:c,onChange:e=>l(e.target.value),placeholder:`MioProgetto`})]}),(0,A.jsxs)(`div`,{className:Q.chatInputRow,children:[(0,A.jsxs)(`label`,{className:Q.attachLabel,title:`Allega immagine o PDF`,children:[`📎`,(0,A.jsx)(`input`,{ref:Tt,type:`file`,multiple:!0,accept:`image/*,.pdf`,style:{display:`none`},onChange:e=>en(e.target.files)})]}),(0,A.jsx)(`textarea`,{className:Q.chatTextarea,value:Ie,onChange:e=>Le(e.target.value),placeholder:W?`Parla con il tuo agente: chiedi correzioni, migliorie, nuove funzionalità...`:`Descrivi il progetto da creare, poi premi Genera...`,disabled:nn,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Nt())},rows:4}),(0,A.jsxs)(`div`,{className:Q.chatSendCol,children:[(0,A.jsx)(`button`,{className:Q.chatSendBtn,onClick:Nt,disabled:nn,children:P?`⏳`:W?`▶`:`▶ Genera`}),nn&&!Ce&&(0,A.jsx)(`button`,{className:Q.chatStopBtn,onClick:It,children:`⏹ Stop`})]})]})]}),ce&&(0,A.jsx)(`div`,{className:Q.modalOverlay,onClick:()=>le(!1),children:(0,A.jsxs)(`div`,{className:Q.modal,onClick:e=>e.stopPropagation(),style:{width:720,maxHeight:`90vh`},children:[(0,A.jsxs)(`div`,{className:Q.modalHeader,children:[(0,A.jsxs)(`span`,{className:Q.modalTitle,children:[`📖 `,e(`webcraft.doctrine.title`)]}),(0,A.jsx)(`span`,{className:Q.doctrineSubtitle,children:e(`webcraft.doctrine.subtitle`)}),(0,A.jsx)(`button`,{className:Q.modalClose,onClick:()=>le(!1),children:`✕`})]}),(0,A.jsx)(`div`,{className:Q.modalBody,style:{gap:0},children:[`phase1`,`phase2`,`phase3`,`phase4`,`phase5`,`tools`,`golden`].map(t=>(0,A.jsxs)(`div`,{className:Q.doctrineSection,children:[(0,A.jsx)(`div`,{className:Q.doctrineSectionTitle,children:e(`webcraft.doctrine.${t}.title`)}),(0,A.jsx)(`div`,{className:Q.doctrineSectionBody,children:e(`webcraft.doctrine.${t}.desc`).split(`
|
|
860
|
-
`).map((e,t)=>(0,A.jsx)(`p`,{className:e.startsWith(`•`)||e.startsWith(`1.`)||e.startsWith(`2.`)||e.startsWith(`3.`)||e.startsWith(`4.`)||e.startsWith(`5.`)||e.startsWith(`6.`)?Q.doctrineBullet:``,children:e},t))})]},t))}),(0,A.jsx)(`div`,{className:Q.modalFooter,children:(0,A.jsx)(`button`,{className:Q.modalSaveBtn,onClick:()=>le(!1),style:{padding:`10px 28px`,fontSize:14},children:e(`webcraft.doctrine.close`)})})]})}),qe&&(0,A.jsx)(lE,{modal:qe,skills:Ue,projectName:c,onClose:()=>Je(null),onSave:(e,t,n)=>Jt(qe,e,t,n)}),a&&t===`new`&&(0,A.jsx)(JT,{tabs:YT,active:o,onChange:s,className:Q.mobileTabBar,buttonClassName:Q.mobileTabBtn,activeClassName:Q.mobileTabBtnActive})]})}function aE(e,t){let n=e.length,r=t.length;if(n===0&&r===0)return[];if(n===r&&e.every((e,n)=>e===t[n]))return e.map((e,t)=>({type:`same`,text:e,oldLine:t+1,newLine:t+1}));if(n+r>8e3)return oE(e,t);let i=n+r,a=2*i+1,o=new Int32Array(a).fill(-1),s=i;o[s+1]=0;let c=[];outer:for(let l=0;l<=i;l++){let i=new Int32Array(a);i.set(o),c.push(i);for(let i=-l;i<=l;i+=2){let a;a=i===-l||i!==l&&o[s+i-1]<o[s+i+1]?o[s+i+1]:o[s+i-1]+1;let c=a-i;for(;a<n&&c<r&&e[a]===t[c];)a++,c++;if(o[s+i]=a,a>=n&&c>=r)break outer}}let l=[],u=n,d=r;for(let n=c.length-1;n>0;n--){let r=c[n-1],i=u-d,a;a=i===-n||i!==n&&r[s+i-1]<r[s+i+1]?i+1:i-1;let o=r[s+a],f=o-a;for(;u>o&&d>f;)u--,d--,l.push({type:`same`,text:e[u],oldLine:u+1,newLine:d+1});u>o?(u--,l.push({type:`rem`,text:e[u],oldLine:u+1})):d>f&&(d--,l.push({type:`add`,text:t[d],newLine:d+1}))}for(;u>0&&d>0;)u--,d--,l.push({type:`same`,text:e[u],oldLine:u+1,newLine:d+1});return l.reverse(),l}function oE(e,t){let n=[],r=0,i=0;for(;(r<e.length||i<t.length)&&(r>=e.length?(n.push({type:`add`,text:t[i],newLine:i+1}),i++):i>=t.length?(n.push({type:`rem`,text:e[r],oldLine:r+1}),r++):e[r]===t[i]?(n.push({type:`same`,text:e[r],oldLine:r+1,newLine:i+1}),r++,i++):(n.push({type:`rem`,text:e[r],oldLine:r+1}),n.push({type:`add`,text:t[i],newLine:i+1}),r++,i++),!(n.length>4e3)););return n}function sE(e,t){let n=(e||``).split(/(\s+)/),r=(t||``).split(/(\s+)/),i=n.length,a=r.length;if(i+a>400)return{old:(0,A.jsx)(A.Fragment,{children:e}),new:(0,A.jsx)(A.Fragment,{children:t})};let o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=n[e-1]===r[t-1]?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],c=[],l=i,u=a,d=[],f=[];for(;l>0||u>0;)l>0&&u>0&&n[l-1]===r[u-1]?(d.push({text:n[l-1],changed:!1}),f.push({text:r[u-1],changed:!1}),l--,u--):u>0&&(l===0||o[l][u-1]>=o[l-1][u])?(f.push({text:r[u-1],changed:!0}),u--):(d.push({text:n[l-1],changed:!0}),l--);return d.reverse().forEach(e=>s.push(e)),f.reverse().forEach(e=>c.push(e)),{old:(0,A.jsx)(A.Fragment,{children:s.map((e,t)=>e.changed?(0,A.jsx)(`span`,{style:{background:`rgba(248,113,113,0.3)`,borderRadius:2},children:e.text},t):(0,A.jsx)(`span`,{children:e.text},t))}),new:(0,A.jsx)(A.Fragment,{children:c.map((e,t)=>e.changed?(0,A.jsx)(`span`,{style:{background:`rgba(74,222,128,0.3)`,borderRadius:2},children:e.text},t):(0,A.jsx)(`span`,{children:e.text},t))})}}function cE({before:e,after:t,contextLines:n=3}){let r=aE((e||``).split(`
|
|
861
|
-
`),(t||``).split(`
|
|
862
|
-
`)),i=new Set;r.forEach((e,t)=>{e.type!==`same`&&i.add(t)});let a=new Set;if(i.forEach(e=>{for(let t=Math.max(0,e-n);t<=Math.min(r.length-1,e+n);t++)a.add(t)}),i.size===0)for(let e=0;e<Math.min(5,r.length);e++)a.add(e);let o=new Map;for(let e=0;e<r.length-1;e++)r[e].type===`rem`&&r[e+1].type===`add`&&o.set(e,sE(r[e].text,r[e+1].text));let s=[],c=-1;for(let e=0;e<r.length;e++){if(!a.has(e))continue;if(c>=0&&e-c>1){let t=e-c-1;s.push((0,A.jsxs)(`div`,{style:{padding:`2px 8px`,background:`rgba(99,102,241,0.08)`,color:`#6366f1`,fontSize:9,textAlign:`center`,borderTop:`1px solid rgba(99,102,241,0.15)`,borderBottom:`1px solid rgba(99,102,241,0.15)`,userSelect:`none`},children:[`@@ `,t,` righe nascoste @@`]},`fold-${e}`))}c=e;let t=r[e],n=t.type===`add`?`rgba(74,222,128,0.08)`:t.type===`rem`?`rgba(248,113,113,0.08)`:`transparent`,i=t.type===`add`?`3px solid #4ade80`:t.type===`rem`?`3px solid #f87171`:`3px solid transparent`,l=t.type===`add`?`#4ade80`:t.type===`rem`?`#f87171`:`var(--dim)`,u=t.type===`add`?`+`:t.type===`rem`?`-`:` `,d=t.text,f=o.get(e);f&&t.type===`rem`&&(d=f.old);let p=o.get(e-1);p&&t.type===`add`&&(d=p.new),s.push((0,A.jsxs)(`div`,{style:{display:`flex`,alignItems:`stretch`,background:n,borderLeft:i,fontFamily:`var(--mono)`,fontSize:11,lineHeight:`18px`},children:[(0,A.jsx)(`span`,{style:{width:36,textAlign:`right`,padding:`0 4px`,color:`rgba(255,255,255,0.2)`,fontSize:10,flexShrink:0,userSelect:`none`},children:t.oldLine??``}),(0,A.jsx)(`span`,{style:{width:36,textAlign:`right`,padding:`0 4px`,color:`rgba(255,255,255,0.2)`,fontSize:10,flexShrink:0,userSelect:`none`},children:t.newLine??``}),(0,A.jsx)(`span`,{style:{width:14,textAlign:`center`,color:l,fontWeight:700,flexShrink:0,userSelect:`none`},children:u}),(0,A.jsx)(`span`,{style:{flex:1,padding:`0 4px`,color:l,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:d})]},e))}return(0,A.jsx)(`div`,{style:{overflow:`auto`,maxHeight:400},children:s})}function lE({modal:e,skills:t,projectName:n,onClose:r,onSave:i}){let[a,o]=(0,_.useState)(e.name),[s,c]=(0,_.useState)(e.content),[l,u]=(0,_.useState)(e.type),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(!1),h=l===`skill`?6e3:4e3,g=s.length>h;async function v(){if(!d.trim())return;m(!0);let e={skill:`Sei un esperto di sviluppo web fullstack. Genera un file Markdown "skill" per il WebCraft Agent. Deve contenere istruzioni, pattern di codice, best practice e snippet pronti all uso come contesto persistente. Scrivi SOLO il contenuto Markdown, niente altro.`,memory:`Sei un assistente tecnico. Genera un file Markdown "memory" per il WebCraft Agent. Deve riassumere decisioni architetturali, preferenze dello sviluppatore e contesto generale del progetto. Scrivi SOLO il Markdown.`,provider:`Sei un esperto di prompt engineering. Genera un file Markdown con istruzioni specifiche per calibrare il comportamento del modello AI. Scrivi SOLO il Markdown.`},t=await D(`/api/studio/webcraft`,{system:e[l]??e.skill,user:`Progetto: ${n}\n\n${d}`,max_tokens:2048});t?.text&&(c(t.text),a||o(l===`memory`?`memory.md`:l===`provider`?`liara.md`:d.toLowerCase().replace(/[^a-z0-9]+/g,`-`).slice(0,30)+`.md`)),m(!1)}function y(){if(!a.trim()){alert(`Inserisci un nome per il file.`);return}let n=a.endsWith(`.md`)?a:a+`.md`;if((l===`memory`||l===`provider`)&&e.mode===`new`&&t.findIndex(e=>e.type===l)>=0){alert(`Esiste già un file di tipo "${l}". Modificalo direttamente.`);return}i(n,s,l)}return(0,A.jsx)(`div`,{className:Q.modalOverlay,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,A.jsxs)(`div`,{className:Q.modal,children:[(0,A.jsxs)(`div`,{className:Q.modalHeader,children:[(0,A.jsxs)(`span`,{className:Q.modalTitle,children:[rE(l),` `,e.mode===`new`?`Nuovo file di contesto`:`Modifica ${e.name}`]}),(0,A.jsx)(`button`,{className:Q.modalClose,onClick:r,children:`×`})]}),(0,A.jsx)(`div`,{className:Q.modalBody,children:e.mode===`view`?(0,A.jsx)(`pre`,{className:Q.logView,children:s}):(0,A.jsxs)(A.Fragment,{children:[e.mode===`new`&&(0,A.jsxs)(`div`,{className:Q.modalRow,children:[(0,A.jsxs)(`div`,{className:Q.modalField,children:[(0,A.jsx)(`div`,{className:Q.modalLabel,children:`TIPO`}),(0,A.jsx)(`select`,{value:l,onChange:e=>{let t=e.target.value;u(t),t===`memory`?o(`memory.md`):t===`provider`&&o(`liara.md`)},className:Q.modalSelect,children:[`skill`,`memory`,`provider`].map(e=>{let n=(e===`memory`||e===`provider`)&&t.some(t=>t.type===e);return(0,A.jsxs)(`option`,{value:e,disabled:n,children:[e,n?` (esiste già)`:``]},e)})})]}),(0,A.jsxs)(`div`,{className:Q.modalField,style:{flex:2},children:[(0,A.jsx)(`div`,{className:Q.modalLabel,children:`NOME FILE`}),(0,A.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:l===`memory`?`memory.md`:l===`provider`?`liara.md`:`nome-skill.md`,className:Q.modalInput})]})]}),(0,A.jsxs)(`div`,{className:Q.modalHint,children:[`💡 `,l===`skill`?`Istruzioni tecniche, snippet, pattern di codice specifici. Max ~6000 caratteri.`:l===`memory`?`Note persistenti sul progetto: decisioni architetturali, preferenze. Solo UN file. Max ~4000 caratteri.`:`Istruzioni specifiche per il modello AI (tono, formato, vincoli). Solo UN file. Max ~4000 caratteri.`]}),(0,A.jsxs)(`div`,{className:Q.modalAiBox,children:[(0,A.jsx)(`div`,{className:Q.modalLabel,children:`🤖 GENERA CON AI`}),(0,A.jsxs)(`div`,{className:Q.modalAiRow,children:[(0,A.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:2,placeholder:`Descrivi cosa deve contenere questo file...`,className:Q.modalAiDesc}),(0,A.jsx)(`button`,{onClick:v,disabled:p,className:Q.modalAiBtn,children:p?`⏳ ...`:`▶ Genera`})]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:Q.modalLabelRow,children:[(0,A.jsx)(`span`,{children:`CONTENUTO (markdown)`}),(0,A.jsxs)(`span`,{style:{color:g?`#e05050`:`var(--dim)`},children:[s.length,` car.`,g?` ⚠ Troppo lungo`:``]})]}),(0,A.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:14,placeholder:`# Titolo
|
|
863
|
-
Scrivi le istruzioni in Markdown...`,className:Q.modalContentArea,style:{borderColor:g?`#e05050`:`var(--border2)`}})]})]})}),(0,A.jsxs)(`div`,{className:Q.modalFooter,children:[(0,A.jsx)(`button`,{onClick:r,className:Q.modalCancelBtn,children:`Annulla`}),e.mode!==`view`&&(0,A.jsx)(`button`,{onClick:y,className:Q.modalSaveBtn,children:`✓ Salva`})]})]})})}var uE={root:`_root_x9yvu_1`,loading:`_loading_x9yvu_7`,empty:`_empty_x9yvu_18`,emptyIcon:`_emptyIcon_x9yvu_29`,emptyTitle:`_emptyTitle_x9yvu_30`,emptySub:`_emptySub_x9yvu_31`,generateBtn:`_generateBtn_x9yvu_33`,summary:`_summary_x9yvu_46`,sectionTitle:`_sectionTitle_x9yvu_57`,alertTitle:`_alertTitle_x9yvu_68`,actionCard:`_actionCard_x9yvu_70`,actionTime:`_actionTime_x9yvu_81`,actionText:`_actionText_x9yvu_89`,schedCard:`_schedCard_x9yvu_95`,schedTime:`_schedTime_x9yvu_106`,schedTitle:`_schedTitle_x9yvu_114`,alertCard:`_alertCard_x9yvu_119`,alertSev:`_alertSev_x9yvu_129`,alertAction:`_alertAction_x9yvu_135`,insight:`_insight_x9yvu_141`,regenRow:`_regenRow_x9yvu_148`,regenBtn:`_regenBtn_x9yvu_153`};function dE(){let e=M(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(!1),l=()=>{i(!0),c(!1),E(`/api/plan`).then(e=>{e?.plan?(n(e.plan),c(!1)):(n(null),c(!0)),i(!1)}).catch(()=>{i(!1),c(!0)})},u=async()=>{o(!0),i(!0),n(null);try{await D(`/api/plan/refresh`,{}),l()}catch{i(!1)}finally{o(!1)}};if((0,_.useEffect)(()=>{l()},[]),r)return(0,A.jsxs)(`div`,{className:uE.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),(0,A.jsx)(`div`,{children:a?`Generating plan with 5 agents...`:`Loading plan...`})]});if(s||!t)return(0,A.jsxs)(`div`,{className:uE.empty,children:[(0,A.jsx)(`div`,{className:uE.emptyIcon,children:`🗓️`}),(0,A.jsxs)(`div`,{className:uE.emptyTitle,children:[e(`plan.noplan`),` generated yet`]}),(0,A.jsx)(`div`,{className:uE.emptySub,children:`Generate a daily plan using your calendar, tasks, and emails.`}),(0,A.jsx)(`button`,{className:uE.generateBtn,onClick:u,children:e(`plan.generate`)})]});let d=e=>typeof e==`string`?e:e.description??e.message??e.action_required??`Alert`,f=e=>typeof e==`object`&&e.severity?` [${e.severity.toUpperCase()}]`:``,p=e=>typeof e==`object`&&e.action_required&&e.action_required!==d(e)?e.action_required:``,m=e=>typeof e==`string`?e:e.message??e.insight??``;return(0,A.jsxs)(`div`,{className:uE.root,children:[t.executive_summary&&(0,A.jsx)(`div`,{className:uE.summary,children:t.executive_summary}),t.priority_actions&&t.priority_actions.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:uE.sectionTitle,children:`Priority Actions`}),t.priority_actions.map((e,t)=>(0,A.jsxs)(`div`,{className:uE.actionCard,children:[e.time&&(0,A.jsx)(`span`,{className:uE.actionTime,children:e.time}),(0,A.jsx)(`span`,{className:uE.actionText,children:e.action})]},t))]}),t.schedule&&t.schedule.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:uE.sectionTitle,children:`Schedule`}),t.schedule.map((e,t)=>(0,A.jsxs)(`div`,{className:uE.schedCard,children:[(0,A.jsxs)(`span`,{className:uE.schedTime,children:[e.time_start,`–`,e.time_end]}),(0,A.jsx)(`span`,{className:uE.schedTitle,children:e.title})]},t))]}),t.security_alerts&&t.security_alerts.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`${uE.sectionTitle} ${uE.alertTitle}`,children:`Security Alerts`}),t.security_alerts.map((e,t)=>(0,A.jsxs)(`div`,{className:uE.alertCard,children:[(0,A.jsxs)(`span`,{className:uE.alertSev,children:[`!`,f(e)]}),(0,A.jsx)(`span`,{children:d(e)}),p(e)&&(0,A.jsxs)(`div`,{className:uE.alertAction,children:[`Action: `,p(e)]})]},t))]}),t.insights&&t.insights.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:uE.sectionTitle,children:`Insights`}),t.insights.map((e,t)=>(0,A.jsxs)(`div`,{className:uE.insight,children:[`→ `,m(e)]},t))]}),(0,A.jsx)(`div`,{className:uE.regenRow,children:(0,A.jsx)(`button`,{className:uE.regenBtn,onClick:u,disabled:a,children:a?`Regenerating…`:`↺ Regenerate`})})]})}function fE(e){return e===`folder`?`📁`:e===`image`?`🖼`:e===`pdf`?`📕`:e===`video`?`🎬`:e===`audio`?`🎵`:e===`sheet`?`📊`:e===`slides`?`📽`:`📄`}function pE(){let e=M(),[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),l=(e=``)=>{i(!0),E(e?`/api/onedrive?q=${encodeURIComponent(e)}`:`/api/onedrive`).then(e=>{n(e??{files:[]}),i(!1)}).catch(()=>{o(`Could not load OneDrive. Run nha microsoft auth in the terminal to connect.`),i(!1)})};if((0,_.useEffect)(()=>{l()},[]),a)return(0,A.jsx)(`div`,{className:un.error,children:a});let u=t?.files??[],d=t?.quota;return(0,A.jsxs)(`div`,{className:un.root,children:[d&&(0,A.jsxs)(`div`,{className:un.quotaBar,children:[(0,A.jsxs)(`div`,{className:un.quotaText,children:[(0,A.jsxs)(`span`,{className:un.quotaUsed,children:[d.usage,` of `,d.limit,` used`]}),(0,A.jsxs)(`span`,{className:un.quotaPct,children:[d.percentUsed,`%`]})]}),(0,A.jsx)(`div`,{className:un.quotaTrack,children:(0,A.jsx)(`div`,{className:un.quotaFill,style:{width:`${Math.min(d.percentUsed,100)}%`,background:d.percentUsed>90?`var(--red)`:d.percentUsed>70?`var(--amber)`:`var(--cyan)`}})})]}),(0,A.jsxs)(`div`,{className:un.searchRow,children:[(0,A.jsx)(`input`,{className:un.searchInput,value:s,onChange:e=>c(e.target.value),placeholder:`Search OneDrive files…`,onKeyDown:e=>e.key===`Enter`&&l(s)}),(0,A.jsx)(`button`,{className:un.searchBtn,onClick:()=>l(s),children:`Search`})]}),r&&(0,A.jsxs)(`div`,{className:un.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),e(`common.loading`)]}),!r&&u.length===0&&(0,A.jsx)(`div`,{className:un.empty,children:e(`drive.noFiles`)}),(0,A.jsx)(`div`,{className:un.fileList,children:u.map(e=>(0,A.jsxs)(`div`,{className:un.fileRow,children:[(0,A.jsx)(`span`,{className:un.fileIcon,children:fE(e.type)}),(0,A.jsxs)(`div`,{className:un.fileInfo,children:[(0,A.jsx)(`div`,{className:un.fileName,children:e.name}),(0,A.jsxs)(`div`,{className:un.fileMeta,children:[e.modifiedTime?new Date(e.modifiedTime).toLocaleDateString():``,e.size?` · ${e.size}`:``]})]}),(0,A.jsx)(`div`,{className:un.fileBtns,children:e.webViewLink&&(0,A.jsx)(`a`,{className:un.openBtn,href:e.webViewLink,target:`_blank`,rel:`noreferrer`,children:`Open`})})]},e.id))})]})}var mE={root:`_root_1vbmp_1`,loading:`_loading_1vbmp_2`,error:`_error_1vbmp_3`,empty:`_empty_1vbmp_4`,addRow:`_addRow_1vbmp_6`,addInput:`_addInput_1vbmp_7`,addBtn:`_addBtn_1vbmp_8`,list:`_list_1vbmp_10`,taskRow:`_taskRow_1vbmp_11`,checkBtn:`_checkBtn_1vbmp_12`,taskInfo:`_taskInfo_1vbmp_14`,taskTitle:`_taskTitle_1vbmp_15`,taskDue:`_taskDue_1vbmp_16`,taskImp:`_taskImp_1vbmp_17`};function hE(){let e=M(),[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),l=()=>{E(`/api/mstodo`).then(e=>{n(e?.tasks??[]),i(!1)}).catch(()=>{o(`Microsoft To Do requires Microsoft authentication. Run nha microsoft auth in the terminal.`),i(!1)})};(0,_.useEffect)(()=>{l()},[]);let u=()=>{let e=s.trim();e&&(c(``),D(`/api/mstodo`,{title:e}).then(e=>{e?.task&&l()}))},d=(e,t)=>{D(`/api/mstodo/${e}/complete`,{listId:t}).then(()=>l())};return r?(0,A.jsxs)(`div`,{className:mE.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),e(`common.loading`)]}):a?(0,A.jsx)(`div`,{className:mE.error,children:a}):(0,A.jsxs)(`div`,{className:mE.root,children:[(0,A.jsxs)(`div`,{className:mE.addRow,children:[(0,A.jsx)(`input`,{className:mE.addInput,value:s,onChange:e=>c(e.target.value),placeholder:`Add a new task…`,onKeyDown:e=>e.key===`Enter`&&u()}),(0,A.jsx)(`button`,{className:mE.addBtn,onClick:u,children:`+ Add`})]}),t.length===0&&(0,A.jsx)(`div`,{className:mE.empty,children:`No active tasks`}),(0,A.jsx)(`div`,{className:mE.list,children:t.map(e=>{let t=e.importance===`high`?`var(--red)`:e.importance===`low`?`var(--dim)`:`var(--amber)`;return(0,A.jsxs)(`div`,{className:mE.taskRow,children:[(0,A.jsx)(`button`,{className:mE.checkBtn,onClick:()=>d(e.id,e.listId)}),(0,A.jsxs)(`div`,{className:mE.taskInfo,children:[(0,A.jsx)(`div`,{className:mE.taskTitle,children:e.title}),e.dueDate&&(0,A.jsxs)(`div`,{className:mE.taskDue,children:[`Due: `,e.dueDate.split(`T`)[0]]})]}),e.importance&&(0,A.jsx)(`span`,{className:mE.taskImp,style:{color:t},children:e.importance})]},e.id)})})]})}var gE={root:`_root_1ag4s_1`,header:`_header_1ag4s_3`,title:`_title_1ag4s_4`,subtitle:`_subtitle_1ag4s_5`,controls:`_controls_1ag4s_7`,monitorRow:`_monitorRow_1ag4s_8`,label:`_label_1ag4s_9`,monitorBtn:`_monitorBtn_1ag4s_10`,monitorActive:`_monitorActive_1ag4s_11`,captureBtn:`_captureBtn_1ag4s_12`,analyzeSection:`_analyzeSection_1ag4s_15`,sectionTitle:`_sectionTitle_1ag4s_16`,presets:`_presets_1ag4s_17`,preset:`_preset_1ag4s_17`,presetActive:`_presetActive_1ag4s_20`,questionRow:`_questionRow_1ag4s_21`,questionInput:`_questionInput_1ag4s_22`,analyzeBtn:`_analyzeBtn_1ag4s_23`,error:`_error_1ag4s_26`,screenshotContainer:`_screenshotContainer_1ag4s_28`,screenshot:`_screenshot_1ag4s_28`,screenshotMeta:`_screenshotMeta_1ag4s_30`,analysis:`_analysis_1ag4s_32`,analysisTitle:`_analysisTitle_1ag4s_33`,analysisText:`_analysisText_1ag4s_34`,continueInChat:`_continueInChat_1ag4s_35`,history:`_history_1ag4s_37`,historyGrid:`_historyGrid_1ag4s_38`,historyItem:`_historyItem_1ag4s_39`,historyThumb:`_historyThumb_1ag4s_40`,historyMeta:`_historyMeta_1ag4s_41`,historyTs:`_historyTs_1ag4s_42`,historyQ:`_historyQ_1ag4s_43`,historyA:`_historyA_1ag4s_44`},_E=[`Describe exactly what you see on the screen`,`Identify any errors, warnings, or issues visible`,`What application is open and what is the user doing?`,`Summarize the content visible on screen and suggest next actions`,`Read and extract all visible text from the screen`,`Analyze the code visible on screen and identify bugs or improvements`,`What financial data or charts are visible? Summarize key numbers`,`Is there anything sensitive or that should be kept private?`];function vE(){let e=M(),t=te(e=>e.setView),n=te(e=>e.apiBase),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(1),[p,m]=(0,_.useState)([]),h=async()=>{i(!0),c(null);try{let e=await D(`/api/screen/capture`,{monitor:d});c(e),(e?.base64||e?.file)&&m(t=>[{ts:new Date().toLocaleTimeString(),question:`Screenshot`,analysis:``,src:e.base64?`data:image/${e.format??`jpeg`};base64,${e.base64}`:`${n}/api/screenshots/${e.file}`},...t.slice(0,9)])}catch(e){c({error:e.message})}i(!1)},g=async()=>{if(l.trim()){o(!0);try{let e=await D(`/api/screen/analyze`,{question:l.trim(),monitor:d});if(c(e),e?.analysis){let t=e.base64?`data:image/${e.format??`jpeg`};base64,${e.base64}`:e.file?`${n}/api/screenshots/${e.file}`:``;m(n=>[{ts:new Date().toLocaleTimeString(),question:l.trim(),analysis:e.analysis??``,src:t},...n.slice(0,9)])}}catch(e){c({error:e.message})}o(!1)}},v=e=>{try{sessionStorage.setItem(`nha_chat_prefill`,e)}catch{}t(`chat`)},y=s?.base64?`data:image/${s.format??`jpeg`};base64,${s.base64}`:s?.file?`${n}/api/screenshots/${s.file}`:null;return(0,A.jsxs)(`div`,{className:gE.root,children:[(0,A.jsx)(`div`,{className:gE.header,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:gE.title,children:`🖥️ Screen Capture`}),(0,A.jsxs)(`div`,{className:gE.subtitle,children:[e(`screen.capture`),` and analyze your desktop screen with AI vision`]})]})}),(0,A.jsxs)(`div`,{className:gE.controls,children:[(0,A.jsxs)(`div`,{className:gE.monitorRow,children:[(0,A.jsx)(`label`,{className:gE.label,children:`Monitor`}),[1,2,3].map(e=>(0,A.jsxs)(`button`,{className:`${gE.monitorBtn} ${d===e?gE.monitorActive:``}`,onClick:()=>f(e),children:[`Monitor `,e]},e))]}),(0,A.jsx)(`button`,{className:gE.captureBtn,onClick:h,disabled:r||a,children:r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`spinner`}),` Capturing…`]}):`📷 Capture Screen`})]}),(0,A.jsxs)(`div`,{className:gE.analyzeSection,children:[(0,A.jsx)(`div`,{className:gE.sectionTitle,children:`Capture + Analyze`}),(0,A.jsx)(`div`,{className:gE.presets,children:_E.map(e=>(0,A.jsxs)(`button`,{className:`${gE.preset} ${l===e?gE.presetActive:``}`,onClick:()=>u(e),children:[e.slice(0,50),e.length>50?`…`:``]},e))}),(0,A.jsxs)(`div`,{className:gE.questionRow,children:[(0,A.jsx)(`input`,{className:gE.questionInput,value:l,onChange:e=>u(e.target.value),placeholder:`Ask something about your screen…`,onKeyDown:e=>e.key===`Enter`&&g()}),(0,A.jsx)(`button`,{className:gE.analyzeBtn,onClick:g,disabled:!l.trim()||r||a,children:a?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`spinner`}),` Analyzing…`]}):`🔍 Analyze`})]})]}),s?.error&&(0,A.jsx)(`div`,{className:gE.error,children:s.error}),y&&(0,A.jsxs)(`div`,{className:gE.screenshotContainer,children:[(0,A.jsx)(`img`,{src:y,className:gE.screenshot,alt:`Screen capture`}),s?.width&&s?.height&&(0,A.jsxs)(`div`,{className:gE.screenshotMeta,children:[s.width,` × `,s.height,`px`]})]}),s?.analysis&&(0,A.jsxs)(`div`,{className:gE.analysis,children:[(0,A.jsx)(`div`,{className:gE.analysisTitle,children:`AI Analysis`}),(0,A.jsx)(`div`,{className:gE.analysisText,children:s.analysis}),(0,A.jsx)(`button`,{className:gE.continueInChat,onClick:()=>v(`I captured my screen. Here's what the AI saw:\n\n${s.analysis}\n\nCan you help me with this?`),children:`Continue in Chat →`})]}),p.length>0&&(0,A.jsxs)(`div`,{className:gE.history,children:[(0,A.jsx)(`div`,{className:gE.sectionTitle,children:`Recent Captures`}),(0,A.jsx)(`div`,{className:gE.historyGrid,children:p.map((e,t)=>(0,A.jsxs)(`div`,{className:gE.historyItem,children:[e.src&&(0,A.jsx)(`img`,{src:e.src,className:gE.historyThumb,alt:e.question}),(0,A.jsxs)(`div`,{className:gE.historyMeta,children:[(0,A.jsx)(`div`,{className:gE.historyTs,children:e.ts}),(0,A.jsx)(`div`,{className:gE.historyQ,children:e.question}),e.analysis&&(0,A.jsxs)(`div`,{className:gE.historyA,children:[e.analysis.slice(0,120),`…`]})]})]},t))})]})]})}var yE={root:`_root_v12qq_1`,header:`_header_v12qq_3`,title:`_title_v12qq_4`,subtitle:`_subtitle_v12qq_5`,section:`_section_v12qq_7`,sectionTitle:`_sectionTitle_v12qq_8`,quickBtns:`_quickBtns_v12qq_10`,quickBtn:`_quickBtn_v12qq_10`,searchRow:`_searchRow_v12qq_14`,searchInput:`_searchInput_v12qq_15`,searchBtn:`_searchBtn_v12qq_16`,modeRow:`_modeRow_v12qq_19`,modeBtn:`_modeBtn_v12qq_20`,modeActive:`_modeActive_v12qq_21`,routeInputs:`_routeInputs_v12qq_23`,inputWrapper:`_inputWrapper_v12qq_24`,inputIcon:`_inputIcon_v12qq_25`,routeInput:`_routeInput_v12qq_23`,swapBtn:`_swapBtn_v12qq_27`,dirBtns:`_dirBtns_v12qq_29`,dirBtn:`_dirBtn_v12qq_29`,openMapsBtn:`_openMapsBtn_v12qq_32`,error:`_error_v12qq_34`,resultCard:`_resultCard_v12qq_36`,routeSummary:`_routeSummary_v12qq_37`,routeDistance:`_routeDistance_v12qq_38`,routeDuration:`_routeDuration_v12qq_39`,routeMode:`_routeMode_v12qq_40`,steps:`_steps_v12qq_41`,step:`_step_v12qq_41`,stepNum:`_stepNum_v12qq_43`,stepText:`_stepText_v12qq_44`,mapLink:`_mapLink_v12qq_45`,askChatBtn:`_askChatBtn_v12qq_47`,savedRoute:`_savedRoute_v12qq_49`,savedFrom:`_savedFrom_v12qq_51`,savedArrow:`_savedArrow_v12qq_52`,savedTo:`_savedTo_v12qq_53`,savedTs:`_savedTs_v12qq_54`},bE=[`driving`,`walking`,`bicycling`,`transit`],xE={driving:`🚗`,walking:`🚶`,bicycling:`🚲`,transit:`🚌`},SE=[{label:`🏥 Nearest Hospital`,query:`nearest hospital`},{label:`⛽ Gas Station`,query:`gas station near me`},{label:`🛒 Supermarket`,query:`supermarket near me`},{label:`☕ Coffee Shop`,query:`coffee shop near me`},{label:`🏧 ATM`,query:`ATM near me`},{label:`🍕 Pizza`,query:`pizza restaurant near me`}];function CE(e,t,n){try{let r=JSON.parse(localStorage.getItem(`nha_maps_routes`)??`[]`),i=[{from:e,to:t,label:n,ts:new Date().toISOString()},...r.filter(n=>!(n.from===e&&n.to===t))].slice(0,10);localStorage.setItem(`nha_maps_routes`,JSON.stringify(i))}catch{}}function wE(){try{return JSON.parse(localStorage.getItem(`nha_maps_routes`)??`[]`)}catch{return[]}}function TE(){let e=M(),t=te(e=>e.setView),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(`driving`),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(wE),[m,h]=(0,_.useState)(``),g=async()=>{if(!(!n.trim()||!i.trim())){l(!0),d(null);try{let e=await E(`/api/maps/directions?from=${encodeURIComponent(n.trim())}&to=${encodeURIComponent(i.trim())}&mode=${o}`);e&&(d(e),e.error||(CE(n.trim(),i.trim()),p(wE())))}catch{d({url:`https://www.google.com/maps/dir/${encodeURIComponent(n.trim())}/${encodeURIComponent(i.trim())}/?travelmode=${o}`}),CE(n.trim(),i.trim()),p(wE())}l(!1)}},v=e=>{let t=`https://www.google.com/maps/search/${encodeURIComponent(e)}`;window.open(t,`_blank`)},y=e=>{try{sessionStorage.setItem(`nha_chat_prefill`,e)}catch{}t(`chat`)},b=e=>{r(e.from),a(e.to)},x=n.trim()&&i.trim()?`https://www.google.com/maps/dir/${encodeURIComponent(n.trim())}/${encodeURIComponent(i.trim())}/?travelmode=${o}`:null;return(0,A.jsxs)(`div`,{className:yE.root,children:[(0,A.jsx)(`div`,{className:yE.header,children:(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:yE.title,children:`🗺️ Maps & Directions`}),(0,A.jsx)(`div`,{className:yE.subtitle,children:e(`maps.directions`)})]})}),(0,A.jsxs)(`div`,{className:yE.section,children:[(0,A.jsx)(`div`,{className:yE.sectionTitle,children:e(`common.search`)}),(0,A.jsx)(`div`,{className:yE.quickBtns,children:SE.map(e=>(0,A.jsx)(`button`,{className:yE.quickBtn,onClick:()=>v(e.query),children:e.label},e.label))}),(0,A.jsxs)(`div`,{className:yE.searchRow,children:[(0,A.jsx)(`input`,{className:yE.searchInput,value:m,onChange:e=>h(e.target.value),placeholder:`Search for a place, address, or business…`,onKeyDown:e=>e.key===`Enter`&&v(m)}),(0,A.jsx)(`button`,{className:yE.searchBtn,onClick:()=>v(m),disabled:!m.trim(),children:`Search ↗`})]})]}),(0,A.jsxs)(`div`,{className:yE.section,children:[(0,A.jsx)(`div`,{className:yE.sectionTitle,children:`Directions`}),(0,A.jsx)(`div`,{className:yE.modeRow,children:bE.map(e=>(0,A.jsxs)(`button`,{className:`${yE.modeBtn} ${o===e?yE.modeActive:``}`,onClick:()=>s(e),title:e,children:[xE[e],` `,e.charAt(0).toUpperCase()+e.slice(1)]},e))}),(0,A.jsxs)(`div`,{className:yE.routeInputs,children:[(0,A.jsxs)(`div`,{className:yE.inputWrapper,children:[(0,A.jsx)(`span`,{className:yE.inputIcon,children:`A`}),(0,A.jsx)(`input`,{className:yE.routeInput,value:n,onChange:e=>r(e.target.value),placeholder:`From (address, city, or 'my location')`,onKeyDown:e=>e.key===`Enter`&&g()})]}),(0,A.jsx)(`button`,{className:yE.swapBtn,onClick:()=>{r(i),a(n)},title:`Swap`,children:`⇅`}),(0,A.jsxs)(`div`,{className:yE.inputWrapper,children:[(0,A.jsx)(`span`,{className:yE.inputIcon,children:`B`}),(0,A.jsx)(`input`,{className:yE.routeInput,value:i,onChange:e=>a(e.target.value),placeholder:`To (address, city, or landmark)`,onKeyDown:e=>e.key===`Enter`&&g()})]})]}),(0,A.jsxs)(`div`,{className:yE.dirBtns,children:[(0,A.jsx)(`button`,{className:yE.dirBtn,onClick:g,disabled:c||!n.trim()||!i.trim(),children:c?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`spinner`}),` Getting route…`]}):`🗺️ Get Directions`}),x&&(0,A.jsx)(`a`,{className:yE.openMapsBtn,href:x,target:`_blank`,rel:`noreferrer`,children:`Open in Google Maps ↗`})]})]}),u?.error&&(0,A.jsx)(`div`,{className:yE.error,children:u.error}),u&&!u.error&&(0,A.jsxs)(`div`,{className:yE.resultCard,children:[(u.distance||u.duration)&&(0,A.jsxs)(`div`,{className:yE.routeSummary,children:[u.distance&&(0,A.jsxs)(`span`,{className:yE.routeDistance,children:[`📏 `,u.distance]}),u.duration&&(0,A.jsxs)(`span`,{className:yE.routeDuration,children:[`⏱ `,u.duration]}),(0,A.jsxs)(`span`,{className:yE.routeMode,children:[xE[o],` `,o]})]}),u.steps&&u.steps.length>0&&(0,A.jsx)(`div`,{className:yE.steps,children:u.steps.map((e,t)=>(0,A.jsxs)(`div`,{className:yE.step,children:[(0,A.jsx)(`span`,{className:yE.stepNum,children:t+1}),(0,A.jsx)(`span`,{className:yE.stepText,children:e})]},t))}),u.url&&(0,A.jsx)(`a`,{className:yE.mapLink,href:u.url,target:`_blank`,rel:`noreferrer`,children:`View full route on Google Maps ↗`}),(0,A.jsx)(`button`,{className:yE.askChatBtn,onClick:()=>y(`Give me directions from "${n}" to "${i}" by ${o}. Include estimated time, distance, and any traffic alerts or alternative routes.`),children:`Ask AI for detailed route advice →`})]}),f.length>0&&(0,A.jsxs)(`div`,{className:yE.section,children:[(0,A.jsx)(`div`,{className:yE.sectionTitle,children:`Recent Routes`}),f.map((e,t)=>(0,A.jsxs)(`div`,{className:yE.savedRoute,onClick:()=>b(e),children:[(0,A.jsx)(`span`,{className:yE.savedFrom,children:e.from}),(0,A.jsx)(`span`,{className:yE.savedArrow,children:`→`}),(0,A.jsx)(`span`,{className:yE.savedTo,children:e.to}),(0,A.jsx)(`span`,{className:yE.savedTs,children:new Date(e.ts).toLocaleDateString()})]},t))]})]})}var $={root:`_root_esnjz_1`,header:`_header_esnjz_3`,title:`_title_esnjz_4`,subtitle:`_subtitle_esnjz_5`,addBtn:`_addBtn_esnjz_6`,quickAdd:`_quickAdd_esnjz_8`,quickLabel:`_quickLabel_esnjz_9`,quickPresets:`_quickPresets_esnjz_10`,quickPreset:`_quickPreset_esnjz_10`,section:`_section_esnjz_14`,sectionTitle:`_sectionTitle_esnjz_15`,loading:`_loading_esnjz_17`,empty:`_empty_esnjz_18`,card:`_card_esnjz_20`,cardPast:`_cardPast_esnjz_21`,cardLeft:`_cardLeft_esnjz_22`,reminderMsg:`_reminderMsg_esnjz_23`,reminderTime:`_reminderTime_esnjz_24`,timeBadge:`_timeBadge_esnjz_25`,countdown:`_countdown_esnjz_26`,timePast:`_timePast_esnjz_27`,sentBadge:`_sentBadge_esnjz_28`,cancelledBadge:`_cancelledBadge_esnjz_29`,cancelBtn:`_cancelBtn_esnjz_30`,repeatBtn:`_repeatBtn_esnjz_31`,aiButtons:`_aiButtons_esnjz_33`,aiBtn:`_aiBtn_esnjz_34`,overlay:`_overlay_esnjz_38`,modal:`_modal_esnjz_39`,modalTitle:`_modalTitle_esnjz_40`,label:`_label_esnjz_41`,input:`_input_esnjz_42`,msgTemplates:`_msgTemplates_esnjz_44`,msgTemplate:`_msgTemplate_esnjz_44`,msgTemplateActive:`_msgTemplateActive_esnjz_47`,typeTabs:`_typeTabs_esnjz_49`,typeTab:`_typeTab_esnjz_49`,typeTabActive:`_typeTabActive_esnjz_51`,relRow:`_relRow_esnjz_53`,inLabel:`_inLabel_esnjz_54`,relInput:`_relInput_esnjz_55`,relSelect:`_relSelect_esnjz_56`,formErr:`_formErr_esnjz_58`,formOk:`_formOk_esnjz_59`,modalBtns:`_modalBtns_esnjz_60`,cancelModalBtn:`_cancelModalBtn_esnjz_61`,saveBtn:`_saveBtn_esnjz_62`},EE=[{label:`In 5 min`,value:`in 5 minutes`},{label:`In 15 min`,value:`in 15 minutes`},{label:`In 30 min`,value:`in 30 minutes`},{label:`In 1 hour`,value:`in 1 hour`},{label:`In 2 hours`,value:`in 2 hours`},{label:`In 3 hours`,value:`in 3 hours`},{label:`Tomorrow 9am`,value:`tomorrow at 09:00`},{label:`Tomorrow noon`,value:`tomorrow at 12:00`}],DE=[`Take a break and stretch`,`Check emails`,`Join the standup call`,`Review and respond to messages`,`Take your medication`,`Drink water`,`Focus review — what did you accomplish in the last hour?`,`Follow up on pending tasks`,`End of work day — log your achievements`,`Weekly review — prepare for next week`];function OE(e){if(e<1)return`now`;if(e<60)return`in ${e}m`;let t=Math.floor(e/60),n=e%60;return n>0?`in ${t}h ${n}m`:`in ${t}h`}function kE(){let e=M(),t=te(e=>e.setView),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)({message:``,atTime:``,atTimeType:`relative`,relValue:`30`,relUnit:`minutes`}),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)(!1),g=()=>{a(!0),E(`/api/reminders`).then(e=>{r(e?.reminders??[]),a(!1)}).catch(()=>{r([]),a(!1)})};(0,_.useEffect)(()=>{g()},[]);let v=async()=>{if(!o.message.trim()){d(`Message is required`);return}let e=``;if(o.atTimeType===`relative`)e=`in ${o.relValue} ${o.relUnit}`;else{if(!o.atTime){d(`Time is required`);return}e=o.atTime}l(!0),d(``);try{await D(`/api/reminders`,{message:o.message.trim(),atTime:e}),p(`Reminder set!`),setTimeout(()=>{p(``),h(!1)},1500),g()}catch(e){d(e.message??`Failed to set reminder`)}l(!1)},y=e=>{confirm(`Cancel this reminder?`)&&D(`/api/reminders/cancel`,{id:e}).then(g)},b=e=>{try{sessionStorage.setItem(`nha_chat_prefill`,e)}catch{}t(`chat`)},x=n.filter(e=>e.status===`pending`),S=n.filter(e=>e.status!==`pending`);return(0,A.jsxs)(`div`,{className:$.root,children:[(0,A.jsxs)(`div`,{className:$.header,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:$.title,children:`🔔 Reminders`}),(0,A.jsx)(`div`,{className:$.subtitle,children:`Set one-time notifications via the NHA daemon`})]}),(0,A.jsx)(`button`,{className:$.addBtn,onClick:()=>{h(!0),d(``),p(``)},children:`+ New Reminder`})]}),(0,A.jsxs)(`div`,{className:$.quickAdd,children:[(0,A.jsx)(`div`,{className:$.quickLabel,children:`Quick reminder for now:`}),(0,A.jsx)(`div`,{className:$.quickPresets,children:EE.map(e=>(0,A.jsx)(`button`,{className:$.quickPreset,onClick:()=>{s(e=>({...e,atTimeType:`relative`,atTime:``,message:e.message||`Reminder`})),h(!0),d(``),p(``)},children:e.label},e.value))})]}),i&&(0,A.jsxs)(`div`,{className:$.loading,children:[(0,A.jsx)(`div`,{className:`spinner`}),e(`common.loading`)]}),!i&&(0,A.jsxs)(`div`,{className:$.section,children:[(0,A.jsxs)(`div`,{className:$.sectionTitle,children:[`Pending (`,x.length,`)`]}),x.length===0&&(0,A.jsx)(`div`,{className:$.empty,children:`No pending reminders. Set one to get notified.`}),x.map(e=>(0,A.jsxs)(`div`,{className:$.card,children:[(0,A.jsxs)(`div`,{className:$.cardLeft,children:[(0,A.jsx)(`div`,{className:$.reminderMsg,children:e.message}),(0,A.jsxs)(`div`,{className:$.reminderTime,children:[(0,A.jsx)(`span`,{className:$.timeBadge,children:new Date(e.atTime).toLocaleString()}),e.minutesUntil!==void 0&&(0,A.jsx)(`span`,{className:$.countdown,children:OE(e.minutesUntil)})]})]}),(0,A.jsx)(`button`,{className:$.cancelBtn,onClick:()=>y(e.id),children:`Cancel`})]},e.id))]}),S.length>0&&(0,A.jsxs)(`div`,{className:$.section,children:[(0,A.jsxs)(`div`,{className:$.sectionTitle,children:[`Recent (`,S.length,`)`]}),S.slice(0,10).map(e=>(0,A.jsxs)(`div`,{className:`${$.card} ${$.cardPast}`,children:[(0,A.jsxs)(`div`,{className:$.cardLeft,children:[(0,A.jsx)(`div`,{className:$.reminderMsg,children:e.message}),(0,A.jsxs)(`div`,{className:$.reminderTime,children:[(0,A.jsx)(`span`,{className:e.status===`sent`?$.sentBadge:$.cancelledBadge,children:e.status}),(0,A.jsx)(`span`,{className:$.timePast,children:new Date(e.atTime).toLocaleString()})]})]}),(0,A.jsx)(`button`,{className:$.repeatBtn,onClick:()=>{s(t=>({...t,message:e.message,atTimeType:`relative`,relValue:`30`,relUnit:`minutes`})),h(!0)},children:`Repeat`})]},e.id))]}),(0,A.jsxs)(`div`,{className:$.section,children:[(0,A.jsx)(`div`,{className:$.sectionTitle,children:`AI-Powered Reminders`}),(0,A.jsxs)(`div`,{className:$.aiButtons,children:[(0,A.jsx)(`button`,{className:$.aiBtn,onClick:()=>b(`Set a reminder to check my emails in 30 minutes`),children:`📧 Email check in 30min`}),(0,A.jsx)(`button`,{className:$.aiBtn,onClick:()=>b(`Set a reminder every hour to take a break and drink water`),children:`💧 Hourly water break`}),(0,A.jsx)(`button`,{className:$.aiBtn,onClick:()=>b(`Set a reminder at the end of the work day (6pm) to do an evening review of my tasks and prepare tomorrow's plan`),children:`🌆 Evening review 6pm`}),(0,A.jsx)(`button`,{className:$.aiBtn,onClick:()=>b(`Look at my calendar and set reminders for all events today`),children:`📅 Remind me of today's events`})]})]}),m&&(0,A.jsx)(`div`,{className:$.overlay,onClick:e=>{e.target===e.currentTarget&&h(!1)},children:(0,A.jsxs)(`div`,{className:$.modal,children:[(0,A.jsx)(`div`,{className:$.modalTitle,children:e(`reminders.new`)}),(0,A.jsx)(`div`,{className:$.label,children:`Message *`}),(0,A.jsx)(`div`,{className:$.msgTemplates,children:DE.map(e=>(0,A.jsx)(`button`,{className:`${$.msgTemplate} ${o.message===e?$.msgTemplateActive:``}`,onClick:()=>s(t=>({...t,message:e})),children:e},e))}),(0,A.jsx)(`input`,{className:$.input,value:o.message,onChange:e=>s(t=>({...t,message:e.target.value})),placeholder:`Reminder message (e.g. Call John)`}),(0,A.jsx)(`div`,{className:$.label,children:`When *`}),(0,A.jsxs)(`div`,{className:$.typeTabs,children:[(0,A.jsx)(`button`,{className:`${$.typeTab} ${o.atTimeType===`relative`?$.typeTabActive:``}`,onClick:()=>s(e=>({...e,atTimeType:`relative`})),children:`Relative`}),(0,A.jsx)(`button`,{className:`${$.typeTab} ${o.atTimeType===`absolute`?$.typeTabActive:``}`,onClick:()=>s(e=>({...e,atTimeType:`absolute`})),children:`Exact time`})]}),o.atTimeType===`relative`?(0,A.jsxs)(`div`,{className:$.relRow,children:[(0,A.jsx)(`span`,{className:$.inLabel,children:`in`}),(0,A.jsx)(`input`,{className:$.relInput,type:`number`,min:`1`,value:o.relValue,onChange:e=>s(t=>({...t,relValue:e.target.value}))}),(0,A.jsxs)(`select`,{className:$.relSelect,value:o.relUnit,onChange:e=>s(t=>({...t,relUnit:e.target.value})),children:[(0,A.jsx)(`option`,{value:`minutes`,children:`minutes`}),(0,A.jsx)(`option`,{value:`hours`,children:`hours`}),(0,A.jsx)(`option`,{value:`days`,children:`days`})]})]}):(0,A.jsx)(`input`,{className:$.input,type:`datetime-local`,value:o.atTime,onChange:e=>s(t=>({...t,atTime:e.target.value}))}),u&&(0,A.jsx)(`div`,{className:$.formErr,children:u}),f&&(0,A.jsx)(`div`,{className:$.formOk,children:f}),(0,A.jsxs)(`div`,{className:$.modalBtns,children:[(0,A.jsx)(`button`,{className:$.cancelModalBtn,onClick:()=>h(!1),children:`Cancel`}),(0,A.jsx)(`button`,{className:$.saveBtn,onClick:v,disabled:c,children:c?`Setting…`:`🔔 Set Reminder`})]})]})})]})}var AE={root:`_root_atgeb_1`,icon:`_icon_atgeb_10`,title:`_title_atgeb_11`,sub:`_sub_atgeb_12`},jE={dashboard:`⚡`,email:`📧`,calendar:`📅`,tasks:`✅`,contacts:`👤`,notes:`📝`,drive:`💾`,onedrive:`☁️`,mstodo:`📋`,github:`🐙`,slack:`💬`,notion:`📋`,collab:`🏛️`,maps:`🗺️`,cron:`⏰`,screen:`🖥️`,reminders:`🔔`,birthdays:`🎂`,settings:`⚙️`,agents:`🤖`,plan:`🗓️`,webcraft:`🔨`,connectors:`🔗`};function ME({view:e}){let t=M();return(0,A.jsxs)(`div`,{className:AE.root,children:[(0,A.jsx)(`div`,{className:AE.icon,children:jE[e]??`🔧`}),(0,A.jsx)(`div`,{className:AE.title,children:e.charAt(0).toUpperCase()+e.slice(1)}),(0,A.jsx)(`div`,{className:AE.sub,children:t(`common.comingSoon`)})]})}function NE({activeView:e}){switch(e){case`dashboard`:return(0,A.jsx)(Ct,{});case`chat`:return(0,A.jsx)(Te,{});case`email`:return(0,A.jsx)(en,{});case`calendar`:return(0,A.jsx)(an,{});case`tasks`:return(0,A.jsx)(Tt,{});case`notes`:return(0,A.jsx)(Lt,{});case`contacts`:return(0,A.jsx)(Bt,{});case`birthdays`:return(0,A.jsx)(jt,{});case`cron`:return(0,A.jsx)(Ft,{});case`connectors`:return(0,A.jsx)(Jt,{});case`agents`:return(0,A.jsx)(ln,{});case`drive`:return(0,A.jsx)(fn,{});case`onedrive`:return(0,A.jsx)(pE,{});case`mstodo`:return(0,A.jsx)(hE,{});case`github`:return(0,A.jsx)(mn,{});case`slack`:return(0,A.jsx)(_n,{});case`notion`:return(0,A.jsx)(vn,{});case`collab`:return(0,A.jsx)(Sn,{});case`plan`:return(0,A.jsx)(dE,{});case`screen`:return(0,A.jsx)(vE,{});case`maps`:return(0,A.jsx)(TE,{});case`reminders`:return(0,A.jsx)(kE,{});case`settings`:return(0,A.jsx)(kt,{});default:return(0,A.jsx)(ME,{view:e})}}function PE(){let{activeView:e}=te();return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{style:{display:e===`studio`?`contents`:`none`},children:(0,A.jsx)(vt,{})}),(0,A.jsx)(`div`,{style:{display:e===`webcraft`?`contents`:`none`},children:(0,A.jsx)(iE,{})}),e!==`studio`&&e!==`webcraft`&&(0,A.jsx)(NE,{activeView:e})]})}(0,v.createRoot)(document.getElementById(`root`)).render((0,A.jsx)(_.StrictMode,{children:(0,A.jsx)(pe,{children:(0,A.jsx)(PE,{})})}));
|