sfbench 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja.md +165 -0
- package/README.md +164 -0
- package/dist/server/ai/agent.js +132 -0
- package/dist/server/ai/agentTasks.js +296 -0
- package/dist/server/ai/anthropic.js +36 -0
- package/dist/server/ai/conversation.js +3 -0
- package/dist/server/ai/errors.js +75 -0
- package/dist/server/ai/openai.js +53 -0
- package/dist/server/ai/tools.js +249 -0
- package/dist/server/browser.js +26 -0
- package/dist/server/cli.js +151 -0
- package/dist/server/fsutil.js +17 -0
- package/dist/server/http/security.js +37 -0
- package/dist/server/http/server.js +778 -0
- package/dist/server/launcher.js +170 -0
- package/dist/server/log.js +33 -0
- package/dist/server/orgs.js +143 -0
- package/dist/server/paths.js +35 -0
- package/dist/server/records.js +118 -0
- package/dist/server/rest.js +120 -0
- package/dist/server/salesforce.js +348 -0
- package/dist/server/serve.js +121 -0
- package/dist/server/sf/apexRun.js +112 -0
- package/dist/server/sf/apiRequest.js +138 -0
- package/dist/server/sf/commands.js +143 -0
- package/dist/server/sf/errors.js +38 -0
- package/dist/server/sf/run.js +163 -0
- package/dist/server/state.js +103 -0
- package/dist/server/store.js +201 -0
- package/dist/server/version.js +8 -0
- package/dist/shared/api.js +31 -0
- package/dist/shared/namespace.js +28 -0
- package/dist/web/assets/index-CW8D9pEg.js +210 -0
- package/dist/web/assets/index-LqgSbazj.css +1 -0
- package/dist/web/favicon.svg +1 -0
- package/dist/web/index.html +14 -0
- package/dist/web/licenses.txt +1434 -0
- package/package.json +78 -0
|
@@ -0,0 +1,210 @@
|
|
|
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,t.exports),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,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var 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.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.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`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function ee(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=N(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(ee(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function te(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ne=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)};function re(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,ne)}catch(e){ne(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function ie(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else re(ie.bind(null,e))}var ae={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ae,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=ie,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=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.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 D(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)E.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 D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:te}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=re,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.1`})),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,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),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`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(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.browser=function(e){return{$$typeof:o,_reason:e}},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 c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.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=d(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=d(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,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority: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=d(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=d(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,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority: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 l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),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){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e: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}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function E(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var D=Object.assign,O=Symbol.for(`react.element`),k=Symbol.for(`react.transitional.element`),A=Symbol.for(`react.portal`),j=Symbol.for(`react.fragment`),M=Symbol.for(`react.strict_mode`),ee=Symbol.for(`react.profiler`),N=Symbol.for(`react.consumer`),P=Symbol.for(`react.context`),te=Symbol.for(`react.forward_ref`),ne=Symbol.for(`react.suspense`),re=Symbol.for(`react.suspense_list`),ie=Symbol.for(`react.memo`),ae=Symbol.for(`react.lazy`),oe=Symbol.for(`react.activity`),se=Symbol.for(`react.legacy_hidden`),ce=Symbol.for(`react.memo_cache_sentinel`),le=Symbol.for(`react.view_transition`),ue=Symbol.for(`react.recoverable`),de=Symbol.iterator;function F(e){return typeof e!=`object`||!e?null:(e=de&&e[de]||e[`@@iterator`],typeof e==`function`?e:null)}var fe=Symbol.for(`react.client.reference`);function pe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===fe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case j:return`Fragment`;case ee:return`Profiler`;case M:return`StrictMode`;case ne:return`Suspense`;case re:return`SuspenseList`;case oe:return`Activity`;case le:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case A:return`Portal`;case P:return e.displayName||`Context`;case N:return(e._context.displayName||`Context`)+`.Consumer`;case te:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ie:return t=e.displayName||null,t===null?pe(e.type)||`Memo`:t;case ae:t=e._payload,e=e._init;try{return pe(e(t))}catch{}}return null}var me=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},he=[],ge=-1;function _e(e){return{current:e}}function ve(e){0>ge||(e.current=he[ge],he[ge]=null,ge--)}function ye(e,t){ge++,he[ge]=e.current,e.current=t}var be=_e(null),xe=_e(null),Se=_e(null),Ce=_e(null);function we(e,t){switch(ye(Se,t),ye(xe,e),ye(be,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?_p(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=_p(t),e=vp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ve(be),ye(be,e)}function Te(){ve(be),ve(xe),ve(Se)}function Ee(e){var t=e.memoizedState;t!==null&&(fh._currentValue=t.memoizedState,ye(Ce,e)),t=be.current;var n=vp(t,e.type);t!==n&&(ye(xe,e),ye(be,n))}function De(e){xe.current===e&&(ve(be),ve(xe)),Ce.current===e&&(ve(Ce),fh._currentValue=R)}var Oe,ke;function Ae(e){if(Oe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Oe=t&&t[1]||``,ke=-1<e.stack.indexOf(`
|
|
2
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
+
`+Oe+e+ke}var je=!1;function Me(e,t){if(!e||je)return``;je=!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}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}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{je=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ae(n):``}function Ne(e,t){switch(e.tag){case 26:case 27:case 5:return Ae(e.type);case 16:return Ae(`Lazy`);case 13:return e.child!==t&&t!==null?Ae(`Suspense Fallback`):Ae(`Suspense`);case 19:return Ae(`SuspenseList`);case 0:case 15:return Me(e.type,!1);case 11:return Me(e.type.render,!1);case 1:return Me(e.type,!0);case 31:return Ae(`Activity`);case 30:return Ae(`ViewTransition`);default:return``}}function Pe(e){try{var t=``,n=null;do t+=Ne(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}}var Fe=Object.prototype.hasOwnProperty,Ie=t.unstable_scheduleCallback,Le=t.unstable_cancelCallback,Re=t.unstable_shouldYield,ze=t.unstable_requestPaint,Be=t.unstable_now,Ve=t.unstable_getCurrentPriorityLevel,He=t.unstable_ImmediatePriority,Ue=t.unstable_UserBlockingPriority,We=t.unstable_NormalPriority,Ge=t.unstable_LowPriority,Ke=t.unstable_IdlePriority,z=t.log,qe=t.unstable_setDisableYieldValue,Je=null,Ye=null;function Xe(e){if(typeof z==`function`&&qe(e),Ye&&typeof Ye.setStrictMode==`function`)try{Ye.setStrictMode(Je,e)}catch{}}var Ze=Math.clz32?Math.clz32:et,Qe=Math.log,$e=Math.LN2;function et(e){return e>>>=0,e===0?32:31-(Qe(e)/$e|0)|0}var tt=256,nt=262144,rt=4194304;function it(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&-e;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 at(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=it(n))):i=it(o):i=it(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=it(n))):i=it(o)):i=it(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 ot(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function st(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-Ze(n),i=1<<r;t|=e[r],n&=~i}return t}function ct(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 lt(){var e=rt;return rt<<=1,!(rt&62914560)&&(rt=4194304),e}function ut(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function dt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ft(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ze(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&pt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function pt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ze(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function mt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ze(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ht(e,t){var n=t&-t;return n=n&42?1:gt(n),(n&(e.suspendedLanes|t))===0?n:0}function gt(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 _t(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function vt(){var e=L.p;return e===0?(e=window.event,e===void 0?32:Oh(e.type)):e}function yt(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var bt=Math.random().toString(36).slice(2),xt=`__reactFiber$`+bt,St=`__reactProps$`+bt,Ct=`__reactContainer$`+bt,wt=`__reactEvents$`+bt,Tt=`__reactListeners$`+bt,Et=`__reactHandles$`+bt,Dt=`__reactResources$`+bt,Ot=`__reactMarker$`+bt,kt=`__reactLoad$`+bt;function At(e){delete e[xt],delete e[St],delete e[Tt],delete e[Et]}function jt(e){var t;if(t=e[xt])return t;for(var n=e.parentNode;n;){if(t=n[Ct]||n[xt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=_m(e);e!==null;){if(n=e[xt])return n;e=_m(e)}return t}e=n,n=e.parentNode}return null}function Mt(e){if(e=e[xt]||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 Nt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Pt(e){var t=e[Dt];return t||=e[Dt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ft(e){e[Ot]=!0}function It(e){e[kt]=void 0}var Lt=new Set,Rt={};function zt(e,t){Bt(e,t),Bt(e+`Capture`,t)}function Bt(e,t){for(Rt[e]=t,e=0;e<t.length;e++)Lt.add(t[e])}var Vt=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]*$`),Ht={},Ut={};function Wt(e){return Fe.call(Ut,e)?!0:Fe.call(Ht,e)?!1:Vt.test(e)?Ut[e]=!0:(Ht[e]=!0,!1)}var Gt=!1;function Kt(){var e=Gt;return Gt=!1,e}function qt(e,t,n){if(Wt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Jt(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 Yt(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 Xt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Zt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Qt(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 $t(e){if(!e._valueTracker){var t=Zt(e)?`checked`:`value`;e._valueTracker=Qt(e,t,``+e[t])}}function en(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Zt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var tn=/[\n"\\]/g;function nn(e){return e.replace(tn,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function rn(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=``+Xt(t)):e.value!==``+Xt(t)&&(e.value=``+Xt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):on(e,Xt(n)):o===`number`&&e.value==t?on(e,Xt(e.value)):on(e,Xt(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=``+Xt(s):e.removeAttribute(`name`)}function an(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)){$t(e);return}n=n==null?``:``+Xt(n),t=t==null?n:``+Xt(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),$t(e)}function on(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function sn(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=``+Xt(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 cn(e,t,n){t!=null&&(t=``+Xt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Xt(n)}function ln(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(me(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Xt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),$t(e)}function un(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var dn=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 fn(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||dn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function pn(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]=``,Gt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(fn(e,a,r),Gt=!0)}else for(var o in t)t.hasOwnProperty(o)&&fn(e,o,t[o])}function mn(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 hn=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`],[`maskType`,`mask-type`],[`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`]]),gn=/^[\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 _n(e){return gn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function vn(){}var yn=null;function bn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xn=null,Sn=null;function Cn(e){var t=Mt(e);if(t&&(e=t.stateNode)){var n=e[St]||null;a:switch(e=t.stateNode,t.type){case`input`:if(rn(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="`+nn(``+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));rn(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&&en(r)}break a;case`textarea`:cn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&sn(e,!!n.multiple,t,!1)}}}var wn=!1;function Tn(e,t,n){if(wn)return e(t,n);wn=!0;try{return e(t)}finally{if(wn=!1,(xn!==null||Sn!==null)&&(Wd(),xn&&(t=xn,e=Sn,Sn=xn=null,Cn(t),e)))for(t=0;t<e.length;t++)Cn(e[t])}}function En(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 Dn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,On=!1;if(Dn)try{var kn={};Object.defineProperty(kn,"passive",{get:function(){On=!0}}),window.addEventListener(`test`,kn,kn),window.removeEventListener(`test`,kn,kn)}catch{On=!1}var An=null,jn=null,Mn=null;function Nn(){if(Mn)return Mn;var e,t=jn,n=t.length,r,i=`value`in An?An.value:An.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 Mn=i.slice(e,1<r?1-r:void 0)}function Pn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Fn(){return!0}function In(){return!1}function Ln(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)?Fn:In,this.isPropagationStopped=In,this}return D(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=Fn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Fn)},persist:function(){},isPersistent:Fn}),t}var Rn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zn=Ln(Rn),Bn=D({},Rn,{view:0,detail:0}),Vn=Ln(Bn),Hn,Un,Wn,Gn=D({},Bn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nr,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!==Wn&&(Wn&&e.type===`mousemove`?(Hn=e.screenX-Wn.screenX,Un=e.screenY-Wn.screenY):Un=Hn=0,Wn=e),Hn)},movementY:function(e){return`movementY`in e?e.movementY:Un}}),Kn=Ln(Gn),qn=Ln(D({},Gn,{dataTransfer:0})),Jn=Ln(D({},Bn,{relatedTarget:0})),Yn=Ln(D({},Rn,{animationName:0,elapsedTime:0,pseudoElement:0})),Xn=Ln(D({},Rn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Zn=Ln(D({},Rn,{data:0})),Qn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},$n={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`},er={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function tr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=er[e])?!!t[e]:!1}function nr(){return tr}var rr=Ln(D({},Bn,{key:function(e){if(e.key){var t=Qn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Pn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?$n[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nr,charCode:function(e){return e.type===`keypress`?Pn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Pn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),ir=Ln(D({},Gn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),ar=Ln(D({},Rn,{submitter:0})),or=Ln(D({},Bn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nr})),sr=Ln(D({},Rn,{propertyName:0,elapsedTime:0,pseudoElement:0})),cr=Ln(D({},Gn,{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})),lr=Ln(D({},Rn,{newState:0,oldState:0,source:0})),ur=[9,13,27,32],dr=Dn&&`CompositionEvent`in window,fr=null;Dn&&`documentMode`in document&&(fr=document.documentMode);var pr=Dn&&`TextEvent`in window&&!fr,mr=Dn&&(!dr||fr&&8<fr&&11>=fr),hr=` `,gr=!1;function _r(e,t){switch(e){case`keyup`:return ur.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function vr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var yr=!1;function br(e,t){switch(e){case`compositionend`:return vr(t);case`keypress`:return t.which===32?(gr=!0,hr):null;case`textInput`:return e=t.data,e===hr&&gr?null:e;default:return null}}function xr(e,t){if(yr)return e===`compositionend`||!dr&&_r(e,t)?(e=Nn(),Mn=jn=An=null,yr=!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 mr&&t.locale!==`ko`?null:t.data;default:return null}}var Sr={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 Cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Sr[e.type]:t===`textarea`}function wr(e,t,n,r){xn?Sn?Sn.push(r):Sn=[r]:xn=r,t=K(t,`onChange`),0<t.length&&(n=new zn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Tr=null,Er=null;function Dr(e){qf(e,0)}function Or(e){if(en(Nt(e)))return e}function kr(e,t){if(e===`change`)return t}var Ar=!1;if(Dn){var jr;if(Dn){var Mr=`oninput`in document;if(!Mr){var Nr=document.createElement(`div`);Nr.setAttribute(`oninput`,`return;`),Mr=typeof Nr.oninput==`function`}jr=Mr}else jr=!1;Ar=jr&&(!document.documentMode||9<document.documentMode)}function Pr(){Tr&&(Tr.detachEvent(`onpropertychange`,Fr),Er=Tr=null)}function Fr(e){if(e.propertyName===`value`&&Or(Er)){var t=[];wr(t,Er,e,bn(e)),Tn(Dr,t)}}function Ir(e,t,n){e===`focusin`?(Pr(),Tr=t,Er=n,Tr.attachEvent(`onpropertychange`,Fr)):e===`focusout`&&Pr()}function Lr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Or(Er)}function Rr(e,t){if(e===`click`)return Or(t)}function zr(e,t){if(e===`input`||e===`change`)return Or(t)}function Br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Vr=typeof Object.is==`function`?Object.is:Br;function Hr(e,t){if(Vr(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(!Fe.call(t,i)||!Vr(e[i],t[i]))return!1}return!0}function Ur(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gr(e,t){var n=Wr(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=Wr(n)}}function Kr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ur(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=Ur(e.document)}return t}function Jr(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 Yr=Dn&&`documentMode`in document&&11>=document.documentMode,Xr=null,Zr=null,Qr=null,$r=!1;function ei(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$r||Xr==null||Xr!==Ur(r)||(r=Xr,`selectionStart`in r&&Jr(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}),Qr&&Hr(Qr,r)||(Qr=r,r=K(Zr,`onSelect`),0<r.length&&(t=new zn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Xr)))}function ti(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var ni={animationend:ti(`Animation`,`AnimationEnd`),animationiteration:ti(`Animation`,`AnimationIteration`),animationstart:ti(`Animation`,`AnimationStart`),transitionrun:ti(`Transition`,`TransitionRun`),transitionstart:ti(`Transition`,`TransitionStart`),transitioncancel:ti(`Transition`,`TransitionCancel`),transitionend:ti(`Transition`,`TransitionEnd`)},ri={},ii={};Dn&&(ii=document.createElement(`div`).style,`AnimationEvent`in window||(delete ni.animationend.animation,delete ni.animationiteration.animation,delete ni.animationstart.animation),`TransitionEvent`in window||delete ni.transitionend.transition);function ai(e){if(ri[e])return ri[e];if(!ni[e])return e;var t=ni[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ii)return ri[e]=t[n];return e}var oi=ai(`animationend`),si=ai(`animationiteration`),ci=ai(`animationstart`),li=ai(`transitionrun`),ui=ai(`transitionstart`),di=ai(`transitioncancel`),fi=ai(`transitionend`),pi=new Map,mi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(` `);mi.push(`scrollEnd`);function hi(e,t){pi.set(e,t),zt(t,[e])}var gi=0;function _i(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=Td.identifierPrefix;var n=gi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function vi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Nd;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function yi(e,t){return e=vi(e),t=vi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var bi=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)},xi=[],Si=0,Ci=0;function wi(){for(var e=Si,t=Ci=Si=0;t<e;){var n=xi[t];xi[t++]=null;var r=xi[t];xi[t++]=null;var i=xi[t];xi[t++]=null;var a=xi[t];if(xi[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&&Oi(n,i,a)}}function Ti(e,t,n,r){xi[Si++]=e,xi[Si++]=t,xi[Si++]=n,xi[Si++]=r,Ci|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ei(e,t,n,r){return Ti(e,t,n,r),ki(e)}function Di(e,t){return Ti(e,null,null,t),ki(e)}function Oi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ze(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ki(e){if(50<Pd)throw Pd=0,Fd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ai={};function ji(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 Mi(e,t,n,r){return new ji(e,t,n,r)}function Ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pi(e,t){var n=e.alternate;return n===null?(n=Mi(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&1206910976,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 Fi(e,t){e.flags&=1206910978;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 Ii(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Ni(r)&&(s=1);else if(typeof r==`string`)s=Qm(e,n,be.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case oe:return e=Mi(31,n,t,a),e.elementType=oe,e.lanes=o,e;case j:return Li(n.children,a,o,t);case M:s=8,a|=24;break;case ee:return e=Mi(12,n,t,a|2),e.elementType=ee,e.lanes=o,e;case ne:return e=Mi(13,n,t,a),e.elementType=ne,e.lanes=o,e;case re:return e=Mi(19,n,t,a),e.elementType=re,e.lanes=o,e;case se:case le:return e=a|32,e=Mi(30,n,t,e),e.elementType=le,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case P:s=10;break a;case N:s=9;break a;case te:s=11;break a;case ie:s=14;break a;case ae:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Mi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Li(e,t,n,r){return e=Mi(7,e,r,t),e.lanes=n,e}function Ri(e,t,n){return e=Mi(6,e,null,t),e.lanes=n,e}function zi(e){var t=Mi(18,null,null,0);return t.stateNode=e,t}function Bi(e,t,n){return t=Mi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Vi=new WeakMap;function Hi(e,t){if(typeof e==`object`&&e){var n=Vi.get(e);return n===void 0?(t={value:e,source:t,stack:Pe(t)},Vi.set(e,t),t):n}return{value:e,source:t,stack:Pe(t)}}var Ui=[],Wi=0,Gi=null,Ki=0,qi=[],Ji=0,Yi=null,Xi=1,Zi=``;function Qi(e,t){Ui[Wi++]=Ki,Ui[Wi++]=Gi,Gi=e,Ki=t}function $i(e,t,n){qi[Ji++]=Xi,qi[Ji++]=Zi,qi[Ji++]=Yi,Yi=e;var r=Xi;e=Zi;var i=32-Ze(r)-1;r&=~(1<<i),n+=1;var a=32-Ze(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Xi=1<<32-Ze(t)+i|n<<i|r,Zi=a+e}else Xi=1<<a|n<<i|r,Zi=e}function ea(e){e.return!==null&&(Qi(e,1),$i(e,1,0))}function ta(e){for(;e===Gi;)Gi=Ui[--Wi],Ui[Wi]=null,Ki=Ui[--Wi],Ui[Wi]=null;for(;e===Yi;)Yi=qi[--Ji],qi[Ji]=null,Zi=qi[--Ji],qi[Ji]=null,Xi=qi[--Ji],qi[Ji]=null}function na(e,t){qi[Ji++]=Xi,qi[Ji++]=Zi,qi[Ji++]=Yi,Xi=t.id,Zi=t.overflow,Yi=e}var ra=null,ia=null,aa=!1,oa=null,sa=!1,ca=Error(i(519));function la(e){throw ha(Hi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ca}function ua(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[xt]=e,t[St]=r,n){case`dialog`:Jf(`cancel`,t),Jf(`close`,t);break;case`iframe`:case`object`:case`embed`:Jf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Gf.length;n++)Jf(Gf[n],t);break;case`source`:Jf(`error`,t);break;case`img`:case`image`:case`link`:Jf(`error`,t),Jf(`load`,t);break;case`details`:Jf(`toggle`,t);break;case`input`:Jf(`invalid`,t),an(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Jf(`invalid`,t);break;case`textarea`:Jf(`invalid`,t),ln(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||op(t.textContent,n)?(r.popover!=null&&(Jf(`beforetoggle`,t),Jf(`toggle`,t)),r.onScroll!=null&&Jf(`scroll`,t),r.onScrollEnd!=null&&Jf(`scrollend`,t),r.onClick!=null&&(t.onclick=vn),t=!0):t=!1,t||la(e,!0)}function da(e){for(ra=e.return;ra;)switch(ra.tag){case 5:case 31:case 13:sa=!1;return;case 27:case 3:sa=!0;return;default:ra=ra.return}}function fa(e){if(e!==ra)return!1;if(!aa)return da(e),aa=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||bp(e.type,e.memoizedProps)),n=!n),n&&ia&&la(e),da(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ia=gm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ia=gm(e)}else t===27?(t=ia,kp(e.type)?(e=hm,hm=null,ia=e):ia=t):ia=ra?mm(e.stateNode.nextSibling):null;return!0}function pa(){ia=ra=null,aa=!1}function ma(){var e=oa;return e!==null&&(_d===null?_d=e:_d.push.apply(_d,e),oa=null),e}function ha(e){oa===null?oa=[e]:oa.push(e)}var ga=_e(null),_a=null,va=null;function ya(e,t,n){ye(ga,t._currentValue),t._currentValue=n}function ba(e){e._currentValue=ga.current,ve(ga)}function xa(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 Sa(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),xa(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),xa(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),xa(a.return,n,e),s=a.child,s=s===null?null:s.sibling):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 Ca(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;Vr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===Ce.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[fh]:e.push(fh))}a=a.return}return e!==null&&Sa(t,e,n,r),t.flags|=262144,e!==null}function wa(e){for(e=e.firstContext;e!==null;){if(!Vr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ta(e){_a=e,va=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ea(e){return Oa(_a,e)}function Da(e,t){return _a===null&&Ta(e),Oa(e,t)}function Oa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},va===null){if(e===null)throw Error(i(308));va=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else va=va.next=t;return n}var ka=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()})}},Aa=t.unstable_scheduleCallback,ja=t.unstable_NormalPriority,Ma={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Na(){return{controller:new ka,data:new Map,refCount:0}}function Pa(e){e.refCount--,e.refCount===0&&Aa(ja,function(){e.controller.abort()})}function Fa(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Ia=null;function La(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ra=null,za=0,Ba=0,Va=null;function Ha(e,t){if(Ra===null){var n=Ra=[];za=0,Ba=Bf(),Va={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return za++,t.then(Ua,Ua),t}function Ua(){if(--za===0&&(Ia=null,Ra!==null)){Va!==null&&(Va.status=`fulfilled`);var e=Ra;Ra=null,Ba=0,Va=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Wa(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 Ga=I.S;I.S=function(e,t){if(bd=Be(),typeof t==`object`&&t&&typeof t.then==`function`&&Ha(e,t),Ia!==null)for(var n=Ef;n!==null;)Fa(n,Ia),n=n.next;if(n=e.types,n!==null){for(var r=Ef;r!==null;)Fa(r,n),r=r.next;if(Ba!==0){r=Ia,r===null&&(r=Ia=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ga!==null&&Ga(e,t)};var Ka=_e(null);function qa(){var e=Ka.current;return e===null?nd.pooledCache:e}function Ja(e,t){t===null?ye(Ka,Ka.current):ye(Ka,t.pool)}function Ya(){var e=qa();return e===null?null:{parent:Ma._currentValue,pool:e}}var Xa=Error(i(460)),Za=Error(i(474)),Qa=Error(i(542)),$a={then:function(){}};function eo(e){return e=e.status,e===`fulfilled`||e===`rejected`}function to(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(vn,vn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ao(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(vn,vn);else{if(e=nd,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,ao(e),e}throw ro=t,Xa}}function no(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ro=e,Xa):e}}var ro=null;function io(){if(ro===null)throw Error(i(459));var e=ro;return ro=null,e}function ao(e){if(e===Xa||e===Qa)throw Error(i(483))}var oo=null,so=0;function co(e){var t=so;return so+=1,oo===null&&(oo=[]),to(oo,e,t)}function lo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function uo(e,t){throw t.$$typeof===O?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function fo(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=Pi(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|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ri(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===j?(e=d(e,t,n.props.children,r,n.key),lo(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===ae&&no(i)===t.type)?(t=a(t,n.props),lo(t,n),t.return=e,t):(t=Ii(n.type,n.key,n.props,null,e.mode,r),lo(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=Bi(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=Li(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=Ri(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case k:return n=Ii(t.type,t.key,t.props,null,e.mode,n),lo(n,t),n.return=e,n;case A:return t=Bi(t,e.mode,n),t.return=e,t;case ae:return t=no(t),f(e,t,n)}if(me(t)||F(t))return t=Li(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,co(t),n);if(t.$$typeof===P)return f(e,Da(e,t),n);uo(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 k:return n.key===i?l(e,t,n,r):null;case A:return n.key===i?u(e,t,n,r):null;case ae:return n=no(n),p(e,t,n,r)}if(me(n)||F(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,co(n),r);if(n.$$typeof===P)return p(e,t,Da(e,n),r);uo(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 k:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case A:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case ae:return r=no(r),m(e,t,n,r,i)}if(me(r)||F(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,co(r),i);if(r.$$typeof===P)return m(e,t,n,Da(t,r),i);uo(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),aa&&Qi(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 aa&&Qi(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(_.key===null?h:_.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)}),aa&&Qi(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),aa&&Qi(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 aa&&Qi(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(_.key===null?g:_.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)}),aa&&Qi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===j&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case k:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===j){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),lo(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ae&&no(l)===r.type){n(e,r.sibling),c=a(r,o.props),lo(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===j?(c=Li(o.props.children,e.mode,c,o.key),lo(c,o),c.return=e,e=c):(c=Ii(o.type,o.key,o.props,null,e.mode,c),lo(c,o),c.return=e,e=c)}return s(e);case A:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Bi(o,e.mode,c),c.return=e,e=c}return s(e);case ae:return o=no(o),_(e,r,o,c)}if(me(o))return h(e,r,o,c);if(F(o)){if(l=F(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,co(o),c);if(o.$$typeof===P)return _(e,r,Da(e,o),c);uo(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=Ri(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{so=0;var i=_(e,t,n,r);return oo=null,i}catch(t){if(t===Xa||t===Qa)throw t;var a=Mi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var po=fo(!0),mo=fo(!1),ho=!1;function go(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _o(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 vo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function yo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,td&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ki(e),Oi(e,null,n),t}return Ti(e,r,t,n),ki(e)}function bo(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,mt(e,n)}}function xo(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}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var So=!1;function Co(){if(So){var e=Va;if(e!==null)throw e}}function wo(e,t,n,r){So=!1;var i=e.updateQueue;ho=!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?(id&f)===f:(r&f)===f){f!==0&&f===Ba&&(So=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=D({},d,f);break a;case 2:ho=!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),dd|=o,e.lanes=o,e.memoizedState=d}}function To(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Eo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)To(n[e],t)}var Do=_e(null),Oo=_e(0);function ko(e,t){e=ld,ye(Oo,e),ye(Do,t),ld=e|t.baseLanes}function Ao(){ye(Oo,ld),ye(Do,Do.current)}function jo(){ld=Oo.current,ve(Do),ve(Oo)}var Mo=_e(null),No=null;function Po(e){var t=e.alternate;ye(zo,zo.current&1),ye(Mo,e),No===null&&(t===null||Do.current!==null||t.memoizedState!==null)&&(No=e)}function Fo(e){ye(zo,zo.current),ye(Mo,e),No===null&&(No=e)}function Io(e){e.tag===22?(ye(zo,zo.current),ye(Mo,e),No===null&&(No=e)):Lo()}function Lo(){ye(zo,zo.current),ye(Mo,Mo.current)}function Ro(e){ve(Mo),No===e&&(No=null),ve(zo)}var zo=_e(0);function Bo(e,t){ye(Mo,Mo.current),ye(zo,t)}function Vo(e){ve(zo),ve(Mo),No===e&&(No=null)}function Ho(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||dm(n)||fm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Uo=0,B=null,Wo=null,Go=null,Ko=!1,qo=!1,Jo=!1,Yo=0,Xo=0,Zo=null,Qo=0;function $o(){throw Error(i(321))}function es(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vr(e[n],t[n]))return!1;return!0}function ts(e,t,n,r,i,a){return Uo=a,B=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?mc:hc,Jo=!1,a=n(r,i),Jo=!1,qo&&(a=rs(t,n,r,i)),ns(e),a}function ns(e){I.H=pc;var t=Wo!==null&&Wo.next!==null;if(Uo=0,Go=Wo=B=null,Ko=!1,Xo=0,Zo=null,t)throw Error(i(300));e===null||Mc||(e=e.dependencies,e!==null&&wa(e)&&(Mc=!0))}function rs(e,t,n,r){B=e;var a=0;do{if(qo&&(Zo=null),Xo=0,qo=!1,25<=a)throw Error(i(301));if(a+=1,Go=Wo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}I.H=gc,o=t(n,r)}while(qo);return o}function is(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?ds(t):t,e=e.useState()[0],(Wo===null?null:Wo.memoizedState)!==e&&(B.flags|=1024),t}function as(){var e=Yo!==0;return Yo=0,e}function os(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ss(e){if(Ko){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ko=!1}Uo=0,Go=Wo=B=null,qo=!1,Xo=Yo=0,Zo=null}function cs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Go===null?B.memoizedState=Go=e:Go=Go.next=e,Go}function ls(){if(Wo===null){var e=B.alternate;e=e===null?null:e.memoizedState}else e=Wo.next;var t=Go===null?B.memoizedState:Go.next;if(t!==null)Go=t,Wo=e;else{if(e===null)throw B.alternate===null?Error(i(467)):Error(i(310));Wo=e,e={memoizedState:Wo.memoizedState,baseState:Wo.baseState,baseQueue:Wo.baseQueue,queue:Wo.queue,next:null},Go===null?B.memoizedState=Go=e:Go=Go.next=e}return Go}function us(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ds(e){var t=Xo;return Xo+=1,Zo===null&&(Zo=[]),e=to(Zo,e,t),t=B,(Go===null?t.memoizedState:Go.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?mc:hc),e}function fs(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ds(e);if(e.$$typeof===ue)return;if(e.$$typeof===P)return Ea(e)}throw Error(i(438,String(e)))}function ps(e){var t=null,n=B.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=B.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=us(),B.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]=ce;return t.index++,n}function ms(e,t){return typeof t==`function`?t(e):t}function hs(e){return gs(ls(),Wo,e)}function gs(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Uo&f)===f:(id&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===Ba&&(d=!0);else if((Uo&p)===p){u=u.next,p===Ba&&(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,B.lanes|=p,dd|=p;f=u.action,Jo&&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,B.lanes|=f,dd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Vr(o,e.memoizedState)&&(Mc=!0,d&&(n=Va,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 _s(e){var t=ls(),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);Vr(o,t.memoizedState)||(Mc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function vs(e,t,n){var r=B,a=ls(),o=aa;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Vr((Wo||a).memoizedState,n);if(s&&(a.memoizedState=n,Mc=!0),a=a.queue,Bs(xs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Go!==null&&!!(Go.memoizedState.tag&1),Fs(e?9:8,{destroy:void 0},bs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,nd===null)throw Error(i(349));o||Uo&127||ys(r,t,n)}return n}function ys(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=B.updateQueue,t===null?(t=us(),B.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function bs(e,t,n,r){t.value=n,t.getSnapshot=r,V(t)&&Ss(e)}function xs(e,t,n){return n(function(){V(t)&&Ss(e)})}function V(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vr(e,n)}catch{return!0}}function Ss(e){var t=Di(e,2);t!==null&&zd(t,e,2)}function Cs(e){var t=cs();if(typeof e==`function`){var n=e;if(e=n(),Jo){Xe(!0);try{n()}finally{Xe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:e},t}function H(e,t,n,r){return e.baseState=n,gs(e,Wo,typeof r==`function`?r:ms)}function ws(e,t,n,r,a){if(uc(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)}};I.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,U(t,o)):(o.next=n.next,t.pending=n.next=o)}}function U(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};o.types=a===null?null:a.types,I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),Ts(e,t,s)}catch(n){Ds(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Ts(e,t,a)}catch(n){Ds(e,t,n)}}function Ts(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Es(e,t,n)},function(n){return Ds(e,t,n)}):Es(e,t,n)}function Es(e,t,n){t.status=`fulfilled`,t.value=n,Os(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,U(e,n)))}function Ds(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Os(t),t=t.next;while(t!==r)}e.action=null}function Os(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ks(e,t){return t}function As(e,t){if(aa){var n=nd.formState;if(n!==null){a:{var r=B;if(aa){if(ia){b:{for(var i=ia,a=sa;i.nodeType!==8;)if(!a||(i=mm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ia=mm(i.nextSibling),r=i.data===`F!`;break a}}la(r)}r=!1}r&&(t=n[0])}}return n=cs(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ks,lastRenderedState:t},n.queue=r,n=sc.bind(null,B,r),r.dispatch=n,r=Cs(!1),a=lc.bind(null,B,!1,r.queue),r=cs(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=ws.bind(null,B,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function js(e){return Ms(ls(),Wo,e)}function Ms(e,t,n){if(t=gs(e,t,ks)[0],e=hs(ms)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ds(t)}catch(e){throw e===Xa?Qa:e}else r=t;t=ls();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(B.flags|=2048,Fs(9,{destroy:void 0},Ns.bind(null,i,n),null)),[r,a,e]}function Ns(e,t){e.action=t}function Ps(e){var t=ls(),n=Wo;if(n!==null)return Ms(t,n,e);ls(),t=t.memoizedState,n=ls();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Fs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=B.updateQueue,t===null&&(t=us(),B.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 Is(){return ls().memoizedState}function Ls(e,t,n,r){var i=cs();B.flags|=e,i.memoizedState=Fs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Rs(e,t,n,r){var i=ls();r=r===void 0?null:r;var a=i.memoizedState.inst;Wo!==null&&r!==null&&es(r,Wo.memoizedState.deps)?i.memoizedState=Fs(t,a,n,r):(B.flags|=e,i.memoizedState=Fs(1|t,a,n,r))}function zs(e,t){Ls(8390656,8,e,t)}function Bs(e,t){Rs(2048,8,e,t)}function Vs(e){B.flags|=4;var t=B.updateQueue;if(t===null)t=us(),B.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Hs(e){var t=ls().memoizedState;return Vs({ref:t,nextImpl:e}),function(){if(td&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Us(e,t){return Rs(4,2,e,t)}function Ws(e,t){return Rs(4,4,e,t)}function W(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 Gs(e,t,n){n=n==null?null:n.concat([e]),Rs(4,4,W.bind(null,t,e),n)}function Ks(){}function qs(e,t){var n=ls();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&es(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Js(e,t){var n=ls();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&es(t,r[1]))return r[0];if(r=e(),Jo){Xe(!0);try{e()}finally{Xe(!1)}}return n.memoizedState=[r,t],r}function Ys(e,t,n){return n===void 0||Uo&1073741824&&!(id&261930)?e.memoizedState=t:(e.memoizedState=n,e=Ld(),B.lanes|=e,dd|=e,n)}function Xs(e,t,n,r){return Vr(n,t)?n:Do.current===null?!(Uo&106)||Uo&1073741824&&!(id&261930)?(Mc=!0,e.memoizedState=n):(e=Ld(),B.lanes|=e,dd|=e,t):(e=Ys(e,n,r),Vr(e,t)||(Mc=!0),e)}function Zs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};s.types=o===null?null:o.types,I.T=s,lc(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?cc(e,t,Wa(c,r),Id(e)):cc(e,t,r,Id(e))}catch(n){cc(e,t,{then:function(){},status:`rejected`,reason:n},Id())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function Qs(){}function $s(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ec(e).queue;Zs(e,a,t,R,n===null?Qs:function(){return tc(e),n(r)})}function ec(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function tc(e){var t=ec(e);t.next===null&&(t=e.alternate.memoizedState),cc(e,t.next.queue,{},Id())}function nc(){return Ea(fh)}function rc(){return ls().memoizedState}function ic(){return ls().memoizedState}function ac(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Id();e=vo(n);var r=yo(t,e,n);r!==null&&(zd(r,t,n),bo(r,t,n)),t={cache:Na()},e.payload=t;return}t=t.return}}function oc(e,t,n){var r=Id();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},uc(e)?dc(t,n):(n=Ei(e,t,n,r),n!==null&&(zd(n,e,r),fc(n,t,r)))}function sc(e,t,n){cc(e,t,n,Id())}function cc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(uc(e))dc(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,Vr(s,o))return Ti(e,t,i,0),nd===null&&wi(),!1}catch{}if(n=Ei(e,t,i,r),n!==null)return zd(n,e,r),fc(n,t,r),!0}return!1}function lc(e,t,n,r){if(r={lane:2,revertLane:Bf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},uc(e)){if(t)throw Error(i(479))}else t=Ei(e,n,r,2),t!==null&&zd(t,e,2)}function uc(e){var t=e.alternate;return e===B||t!==null&&t===B}function dc(e,t){qo=Ko=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,mt(e,n)}}var pc={readContext:Ea,use:fs,useCallback:$o,useContext:$o,useEffect:$o,useImperativeHandle:$o,useLayoutEffect:$o,useInsertionEffect:$o,useMemo:$o,useReducer:$o,useRef:$o,useState:$o,useDebugValue:$o,useDeferredValue:$o,useTransition:$o,useSyncExternalStore:$o,useId:$o,useHostTransitionStatus:$o,useFormState:$o,useActionState:$o,useOptimistic:$o,useMemoCache:$o,useCacheRefresh:$o,useEffectEvent:$o},mc={readContext:Ea,use:fs,useCallback:function(e,t){return cs().memoizedState=[e,t===void 0?null:t],e},useContext:Ea,useEffect:zs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Ls(4194308,4,W.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ls(4194308,4,e,t)},useInsertionEffect:function(e,t){Ls(4,2,e,t)},useMemo:function(e,t){var n=cs();t=t===void 0?null:t;var r=e();if(Jo){Xe(!0);try{e()}finally{Xe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=cs();if(n!==void 0){var i=n(t);if(Jo){Xe(!0);try{n(t)}finally{Xe(!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=oc.bind(null,B,e),[r.memoizedState,e]},useRef:function(e){var t=cs();return e={current:e},t.memoizedState=e},useState:function(e){e=Cs(e);var t=e.queue,n=sc.bind(null,B,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ks,useDeferredValue:function(e,t){return Ys(cs(),e,t)},useTransition:function(){var e=Cs(!1);return e=Zs.bind(null,B,e.queue,!0,!1),cs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=B,a=cs();if(aa){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),nd===null)throw Error(i(349));id&127||ys(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,zs(xs.bind(null,r,o,e),[e]),r.flags|=2048,Fs(9,{destroy:void 0},bs.bind(null,r,o,n,t),null),n},useId:function(){var e=cs(),t=nd.identifierPrefix;if(aa){var n=Zi,r=Xi;n=(r&~(1<<32-Ze(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Yo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Qo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:nc,useFormState:As,useActionState:As,useOptimistic:function(e){var t=cs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=lc.bind(null,B,!0,n),n.dispatch=t,[e,t]},useMemoCache:ps,useCacheRefresh:function(){return cs().memoizedState=ac.bind(null,B)},useEffectEvent:function(e){var t=cs(),n={impl:e};return t.memoizedState=n,function(){if(td&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},hc={readContext:Ea,use:fs,useCallback:qs,useContext:Ea,useEffect:Bs,useImperativeHandle:Gs,useInsertionEffect:Us,useLayoutEffect:Ws,useMemo:Js,useReducer:hs,useRef:Is,useState:function(){return hs(ms)},useDebugValue:Ks,useDeferredValue:function(e,t){return Xs(ls(),Wo.memoizedState,e,t)},useTransition:function(){var e=hs(ms)[0],t=ls().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:rc,useHostTransitionStatus:nc,useFormState:js,useActionState:js,useOptimistic:function(e,t){return H(ls(),Wo,e,t)},useMemoCache:ps,useCacheRefresh:ic,useEffectEvent:Hs},gc={readContext:Ea,use:fs,useCallback:qs,useContext:Ea,useEffect:Bs,useImperativeHandle:Gs,useInsertionEffect:Us,useLayoutEffect:Ws,useMemo:Js,useReducer:_s,useRef:Is,useState:function(){return _s(ms)},useDebugValue:Ks,useDeferredValue:function(e,t){var n=ls();return Wo===null?Ys(n,e,t):Xs(n,Wo.memoizedState,e,t)},useTransition:function(){var e=_s(ms)[0],t=ls().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:rc,useHostTransitionStatus:nc,useFormState:Ps,useActionState:Ps,useOptimistic:function(e,t){var n=ls();return Wo===null?(n.baseState=e,[e,n.queue.dispatch]):H(n,Wo,e,t)},useMemoCache:ps,useCacheRefresh:ic,useEffectEvent:Hs};function _c(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:D({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Id(),i=vo(r);i.payload=t,n!=null&&(i.callback=n),t=yo(e,i,r),t!==null&&(zd(t,e,r),bo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Id(),i=vo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=yo(e,i,r),t!==null&&(zd(t,e,r),bo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Id(),r=vo(n);r.tag=2,t!=null&&(r.callback=t),t=yo(e,r,n),t!==null&&(zd(t,e,n),bo(t,e,n))}};function yc(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?!Hr(n,r)||!Hr(i,a):!0}function bc(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&&vc.enqueueReplaceState(t,t.state,null)}function xc(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=D({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Sc(e){bi(e)}function Cc(e){console.error(e)}function wc(e){bi(e)}function Tc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ec(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 Dc(e,t,n){return n=vo(n),n.tag=3,n.payload={element:null},n.callback=function(){Tc(e,t)},n}function Oc(e){return e=vo(e),e.tag=3,e}function kc(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(){Ec(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ec(t,n,r),typeof i!=`function`&&(Cd===null?Cd=new Set([this]):Cd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ac(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ca(t,n,a,!0),n=Mo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return No===null?Zd():n.alternate===null&&ud===0&&(ud=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===$a?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),bf(e,r,a)),!1;case 22:return n.flags|=65536,r===$a?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)),bf(e,r,a)),!1}throw Error(i(435,n.tag))}return bf(e,r,a),Zd(),!1}if(aa)return t=Mo.current,t===null?(r!==ca&&(t=Error(i(423),{cause:r}),ha(Hi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Hi(r,n),a=Dc(e.stateNode,r,a),xo(e,a),ud!==4&&(ud=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ca&&(e=Error(i(422),{cause:r}),ha(Hi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Hi(o,n),gd===null?gd=[o]:gd.push(o),ud!==4&&(ud=2),t===null)return!0;r=Hi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Dc(n.stateNode,r,e),xo(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`&&(Cd===null||!Cd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Oc(a),kc(a,e,n,r),xo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var jc=Error(i(461)),Mc=!1;function Nc(e,t,n,r){t.child=e===null?mo(t,null,n,r):po(t,e.child,n,r)}function Pc(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 Ta(t),r=ts(e,t,n,o,a,i),s=as(),e!==null&&!Mc?(os(e,t,i),cl(e,t,i)):(aa&&s&&ea(t),t.flags|=1,Nc(e,t,r,i),t.child)}function Fc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Ic(e,t,a,r,i)):(e=Ii(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!ll(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Hr:n,n(o,r)&&e.ref===t.ref)return cl(e,t,i)}return t.flags|=1,e=Pi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Ic(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Hr(a,r)&&e.ref===t.ref){if(Mc=!1,t.pendingProps=r=a,ll(e,i))e.flags&131072&&(Mc=!0);else return t.lanes=e.lanes,cl(e,t,i)}}return Wc(e,t,n,r,i)}function Lc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return zc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ja(t,a===null?null:a.cachePool),a===null?Ao():ko(t,a),Io(t);else return r=t.lanes=536870912,zc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ja(t,null),Ao(),Lo()):(Ja(t,a.cachePool),ko(t,a),Lo(),t.memoizedState=null);return Nc(e,t,i,n),t.child}function Rc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function zc(e,t,n,r,i){var a=qa();return a=a===null?null:{parent:Ma._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ja(t,null),Ao(),Io(t),e!==null&&Ca(e,t,r,!0),t.childLanes=i,null}function Bc(e,t){return t=$c({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Vc(e,t,n){return po(t,e.child,null,n),e=Bc(t,t.pendingProps),e.flags|=2,Ro(t),t.memoizedState=null,e}function Hc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(aa){if(r.mode===`hidden`)return e=Bc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Rc(null,e);if(Fo(t),(e=ia)?(e=um(e,sa),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi===null?null:{id:Xi,overflow:Zi},retryLane:536870912,hydrationErrors:null},n=zi(e),n.return=t,t.child=n,ra=t,ia=null)):e=null,e===null)throw la(t);return t.lanes=536870912,null}return Bc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Fo(t),a){if(t.flags&256)t.flags&=-257,t=Vc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Mc||Ca(e,t,n,!1),a=(n&e.childLanes)!==0,Mc||a){if(Do.current===null){if(r=nd,r!==null&&(s=ht(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Di(e,s),zd(r,e,s),jc;Zd()}t=Vc(e,t,n)}else e=o.treeContext,ia=mm(s.nextSibling),ra=t,aa=!0,oa=null,sa=!1,e!==null&&na(t,e),t=Bc(t,r),t.flags|=134221824;return t}return e=Pi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Uc(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 Wc(e,t,n,r,i){return Ta(t),n=ts(e,t,n,r,void 0,i),r=as(),e!==null&&!Mc?(os(e,t,i),cl(e,t,i)):(aa&&r&&ea(t),t.flags|=1,Nc(e,t,n,i),t.child)}function Gc(e,t,n,r,i,a){return Ta(t),t.updateQueue=null,n=rs(t,r,n,i),ns(e),r=as(),e!==null&&!Mc?(os(e,t,a),cl(e,t,a)):(aa&&r&&ea(t),t.flags|=1,Nc(e,t,n,a),t.child)}function Kc(e,t,n,r,i){if(Ta(t),t.stateNode===null){var a=Ai,o=n.contextType;typeof o==`object`&&o&&(a=Ea(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=vc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},go(t),o=n.contextType,a.context=typeof o==`object`&&o?Ea(o):Ai,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(_c(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&&vc.enqueueReplaceState(a,a.state,null),wo(t,r,a,i),Co(),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=xc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Ai,typeof u==`object`&&u&&(o=Ea(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)&&bc(t,a,r,o),ho=!1;var f=t.memoizedState;a.state=f,wo(t,r,a,i),Co(),l=t.memoizedState,s||f!==l||ho?(typeof d==`function`&&(_c(t,n,d,r),l=t.memoizedState),(c=ho||yc(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,_o(e,t),o=t.memoizedProps,u=xc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Ai,typeof l==`object`&&l&&(c=Ea(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)&&bc(t,a,r,c),ho=!1,f=t.memoizedState,a.state=f,wo(t,r,a,i),Co();var p=t.memoizedState;o!==d||f!==p||ho||e!==null&&e.dependencies!==null&&wa(e.dependencies)?(typeof s==`function`&&(_c(t,n,s,r),p=t.memoizedState),(u=ho||yc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&wa(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,Uc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=po(t,e.child,null,i),t.child=po(t,null,n,i)):Nc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=cl(e,t,i),e}function qc(e,t,n,r){return pa(),t.flags|=256,Nc(e,t,n,r),t.child}var Jc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yc(e){return{baseLanes:e,cachePool:Ya()}}function Xc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=md),e}function Zc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(zo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(aa){if(i?Po(t):Lo(),(e=ia)?(e=um(e,sa),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Yi===null?null:{id:Xi,overflow:Zi},retryLane:536870912,hydrationErrors:null},n=zi(e),n.return=t,t.child=n,ra=t,ia=null)):e=null,e===null)throw la(t);return t.lanes=fm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Lo(),i=t.mode,a=$c({mode:`hidden`,children:a},i),r=Li(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Yc(n),r.childLanes=Xc(e,o,n),t.memoizedState=Jc,Rc(null,r)):(Po(t),Qc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return tl(e,t,a,o,r,c,s,n)}return i?(Lo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Pi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Li(i,a,n,null),i.flags|=2):i=Pi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Rc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Yc(n):(a=i.cachePool,a===null?a=Ya():(s=Ma._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Xc(e,o,n),t.memoizedState=Jc,Rc(e.child,r)):(Po(t),n=e.child,e=n.sibling,n=Pi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Qc(e,t){return t=$c({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function $c(e,t){return e=Mi(22,e,null,t),e.lanes=0,e}function el(e,t,n){return po(t,e.child,null,n),e=Qc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function tl(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Po(t),t.flags&=-257,el(e,t,c)):t.memoizedState===null?(Lo(),o=a.fallback,s=t.mode,a=$c({mode:`visible`,children:a.children},s),o=Li(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,po(t,e.child,null,c),a=t.child,a.memoizedState=Yc(c),a.childLanes=Xc(e,r,c),t.memoizedState=Jc,Rc(null,a)):(Lo(),t.child=e.child,t.flags|=128,null);if(Po(t),fm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,ha({value:a,source:null,stack:null})),el(e,t,c)}if(Mc||Ca(e,t,c,!1),r=(c&e.childLanes)!==0,Mc||r){if(Do.current!==null)return el(e,t,c);if(r=nd,r!==null&&(a=ht(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,Di(e,a),zd(r,e,a),jc;return dm(o)||Zd(),el(e,t,c)}return dm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,ia=mm(o.nextSibling),ra=t,aa=!0,oa=null,sa=!1,e!==null&&na(t,e),t=Qc(t,a.children),t.flags|=134221824,t)}function nl(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),xa(e.return,t,n)}function rl(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Ho(n)===null&&(t=e),e=e.sibling}return t}function il(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 al(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function ol(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=zo.current;if(t.flags&128)return Bo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Bo(t,o),i===`backwards`&&e!==null?(al(e),Nc(e,t,r,n),al(e)):Nc(e,t,r,n),r=aa?Ki:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&nl(e,n,t);else if(e.tag===19)nl(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`backwards`:n=rl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,al(t)),il(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ho(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}il(t,!0,n,null,a,r);break;case`together`:il(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=rl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),il(t,!1,i,n,a,r)}return t.child}function sl(e,t,n){var r=t.pendingProps;return ya(t,t.type,r.value),Nc(e,t,r.children,n),t.child}function cl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),dd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ca(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=Pi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Pi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ll(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&wa(e)))}function ul(e,t,n){switch(t.tag){case 3:we(t,t.stateNode.containerInfo),ya(t,Ma,e.memoizedState.cache),pa();break;case 27:case 5:Ee(t);break;case 4:we(t,t.stateNode.containerInfo);break;case 10:ya(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Fo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Po(t),t.flags|=128,null;r=Ca(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Zc(e,t,n):(Po(t),e=cl(e,t,n),e===null?null:e.sibling)}Po(t);break;case 19:if(t.flags&128)return ol(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(Ca(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return ol(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Bo(t,zo.current),r)break;return null;case 22:return t.lanes=0,Lc(e,t,n,t.pendingProps);case 24:ya(t,Ma,e.memoizedState.cache)}return cl(e,t,n)}function dl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Mc=!0;else{if(!ll(e,n)&&!(t.flags&128))return Mc=!1,ul(e,t,n);Mc=!!(e.flags&131072)}}else Mc=!1,aa&&t.flags&1048576&&$i(t,Ki,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=no(t.elementType),t.type=e,typeof e==`function`)Ni(e)?(r=xc(e,r),t.tag=1,t=Kc(null,t,e,r,n)):(t.tag=0,t=Wc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===te){t.tag=11,t=Pc(null,t,e,r,n);break a}if(a===ie){t.tag=14,t=Fc(null,t,e,r,n);break a}if(a===P){t.tag=10,t.type=e,t=sl(null,t,n);break a}}throw t=pe(e)||e,Error(i(306,t,``))}}return t;case 0:return Wc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=xc(r,t.pendingProps),Kc(e,t,r,a,n);case 3:a:{if(we(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,_o(e,t),wo(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ya(t,Ma,r),r!==o.cache&&Sa(t,[Ma],n,!0),Co(),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=qc(e,t,r,n);break a}if(r!==a){a=Hi(Error(i(424)),t),ha(a),t=qc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ia=mm(e.firstChild),ra=t,aa=!0,oa=null,sa=!0,n=mo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(pa(),r===a){t=cl(e,t,n);break a}Nc(e,t,r,n)}t=t.child}return t;case 26:return Uc(e,t),e===null?(n=Rm(t.type,null,t.pendingProps,null))?t.memoizedState=n:aa||(t.stateNode=yp(t.type,t.pendingProps,Se.current,t)):t.memoizedState=Rm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ee(t),e===null&&aa&&(r=t.stateNode=bm(t.type,t.pendingProps,Se.current),ra=t,sa=!0,a=ia,kp(t.type)?(hm=a,ia=mm(r.firstChild)):ia=a),Nc(e,t,t.pendingProps.children,n),Uc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&aa&&((a=r=ia)&&(r=cm(r,t.type,t.pendingProps,sa),r===null?a=!1:(t.stateNode=r,ra=t,ia=mm(r.firstChild),sa=!1,a=!0)),a||la(t)),Ee(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,bp(a,o)?r=null:s!==null&&bp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ts(e,t,is,null,null,n),fh._currentValue=a),Uc(e,t),Nc(e,t,r,n),t.child;case 6:return e===null&&aa&&((e=n=ia)&&(n=lm(n,t.pendingProps,sa),n===null?e=!1:(t.stateNode=n,ra=t,ia=null,e=!0)),e||la(t)),null;case 13:return Zc(e,t,n);case 4:return we(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=po(t,null,r,n):Nc(e,t,r,n),t.child;case 11:return Pc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Uc(e,t),Nc(e,t,r,n),t.child;case 8:return Nc(e,t,t.pendingProps.children,n),t.child;case 12:return Nc(e,t,t.pendingProps.children,n),t.child;case 10:return sl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,Ta(t),a=Ea(a),r=r(a),t.flags|=1,Nc(e,t,r,n),t.child;case 14:return Fc(e,t,t.type,t.pendingProps,n);case 15:return Ic(e,t,t.type,t.pendingProps,n);case 19:return ol(e,t,n);case 31:return Hc(e,t,n);case 22:return Lc(e,t,n,t.pendingProps);case 24:return Ta(t),r=Ea(Ma),e===null?(a=qa(),a===null&&(a=nd,o=Na(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},go(t),ya(t,Ma,a)):((e.lanes&n)!==0&&(_o(e,t),wo(t,null,null,n),Co()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,ya(t,Ma,r),r!==a.cache&&Sa(t,[Ma],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),ya(t,Ma,r))),Nc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:aa&&ea(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Uc(e,t),Nc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function fl(e){e.flags|=4}function pl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?$m(t,r):$m(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Jd())e.flags|=8192;else throw ro=$a,Za}}else e.flags&=-16777217}function ml(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!eh(t)){if(Jd())e.flags|=8192;else throw ro=$a,Za}}function hl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:lt(),e.lanes|=t,hd|=t)}function gl(e,t){if(!aa)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,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;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function _l(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&1206910976,r|=i.flags&1206910976,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 vl(e,t,n){var r=t.pendingProps;switch(ta(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _l(t),null;case 1:return _l(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ba(Ma),Te(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(fa(t)?fl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ma())),_l(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(fl(t),o===null?(_l(t),pl(t,a,null,r,n)):(_l(t),ml(t,o))):o?o===e.memoizedState?(_l(t),t.flags&=-16777217):(fl(t),_l(t),ml(t,o)):(e=e.memoizedProps,e!==r&&fl(t),_l(t),pl(t,a,e,r,n)),null;case 27:if(De(t),n=Se.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&fl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return _l(t),t.subtreeFlags&=-33554433,null}e=be.current,fa(t)?ua(t,e):(e=bm(a,r,n),t.stateNode=e,fl(t))}return _l(t),t.subtreeFlags&=-33554433,null;case 5:if(De(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&fl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return _l(t),t.subtreeFlags&=-33554433,null}if(o=be.current,fa(t))ua(t,o);else{var s=gp(Se.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[xt]=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(lp(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&&fl(t)}}return _l(t),t.subtreeFlags&=-33554433,pl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&fl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=Se.current,fa(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ra,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[xt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||op(e.nodeValue,n)),e||la(t,!0)}else e=gp(e).createTextNode(r),e[xt]=t,t.stateNode=e}return _l(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=fa(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[xt]=t}else pa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;_l(t),e=!1}else n=ma(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ro(t),t):(Ro(t),null);if(t.flags&128)throw Error(i(558))}return _l(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=fa(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[xt]=t}else pa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;_l(t),a=!1}else a=ma(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Ro(t),t):(Ro(t),null)}return Ro(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),hl(t,t.updateQueue),_l(t),null);case 4:return Te(),e===null&&Zf(t.stateNode.containerInfo),t.flags|=67108864,_l(t),null;case 10:return ba(t.type),_l(t),null;case 19:if(Vo(t),r=t.memoizedState,r===null)return _l(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)gl(r,!1);else{if(ud!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Ho(e),o!==null){for(t.flags|=128,gl(r,!1),e=o.updateQueue,t.updateQueue=e,hl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Fi(n,e),n=n.sibling;return Bo(t,zo.current&1|2),aa&&Qi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Be()>xd&&(t.flags|=128,a=!0,gl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Ho(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,hl(t,e),gl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!aa)return _l(t),null}else 2*Be()-r.renderingStartTime>xd&&n!==536870912&&(t.flags|=128,a=!0,gl(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)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Be(),e.sibling=null,o=zo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||aa?Bo(t,o):(n=o,ye(Mo,t),ye(zo,n),No===null&&(No=t)),aa&&Qi(t,r.treeForkCount),e}return _l(t),null;case 22:case 23:return Ro(t),jo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(_l(t),t.subtreeFlags&6&&(t.flags|=8192)):_l(t),n=t.updateQueue,n!==null&&hl(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&&ve(Ka),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ba(Ma),_l(t),null;case 25:return null;case 30:return t.flags|=33554432,_l(t),null}throw Error(i(156,t.tag))}function yl(e,t){switch(ta(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ba(Ma),Te(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return De(t),null;case 31:if(t.memoizedState!==null){if(Ro(t),t.alternate===null)throw Error(i(340));pa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ro(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));pa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Vo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Te(),null;case 10:return ba(t.type),null;case 22:case 23:return Ro(t),jo(),e!==null&&ve(Ka),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ba(Ma),null;case 25:return null;default:return null}}function bl(e,t){switch(ta(t),t.tag){case 3:ba(Ma),Te();break;case 26:case 27:case 5:De(t);break;case 4:Te();break;case 31:t.memoizedState!==null&&Ro(t);break;case 13:Ro(t);break;case 19:Vo(t);break;case 10:ba(t.type);break;case 22:case 23:Ro(t),jo(),e!==null&&ve(Ka);break;case 24:ba(Ma)}}function xl(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){yf(t,t.return,e)}}function Sl(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){yf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){yf(t,t.return,e)}}function Cl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Eo(t,n)}catch(t){yf(e,e.return,t)}}}function wl(e,t,n){n.props=xc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){yf(e,t,n)}}function Tl(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:var i=e.stateNode,a=_i(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Vp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Hp(e);h(e.child,!1,rm,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){yf(e,t,n)}}function El(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){yf(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){yf(e,t,n)}else n.current=null}}function Dl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)am(e.stateNode,t[n])}function Ol(e){for(var t=e.return;t!==null&&(jl(t)&&am(e.stateNode,t.stateNode),!Al(t));)t=t.return}function kl(e){for(var t=e.return;t!==null&&(jl(t)&&om(e.stateNode,t.stateNode),!Al(t));)t=t.return}function Al(e){return e.tag===5||e.tag===3||e.tag===27}function jl(e){return e&&e.tag===7&&e.stateNode!==null}function Ml(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){yf(e,e.return,t)}}function Nl(e,t,n){try{var r=e.stateNode;dp(r,e.type,n,t),r[St]=t}catch(t){yf(e,e.return,t)}}function Pl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&kp(e.type)||e.tag===4}function Fl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Pl(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&&kp(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 Il(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vn)),Dl(e,r),Gt=!0;else if(i!==4&&(i===27&&(Dl(e,r),r=null,kp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Il(e,t,n,r),e=e.sibling;e!==null;)Il(e,t,n,r),e=e.sibling}function Ll(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Dl(e,r),Gt=!0;else if(i!==4&&(i===27&&(Dl(e,r),r=null,kp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Ll(e,t,n,r),e=e.sibling;e!==null;)Ll(e,t,n,r),e=e.sibling}function Rl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);lp(t,r,n),t[xt]=e,t[St]=n}catch(t){yf(e,e.return,t)}}var zl=!1,Bl=null;function Vl(e){(e.tag===30||e.subtreeFlags&33554432)&&(zl=!0)}var Hl=null;function Ul(){var e=Hl;return Hl=null,e}var Wl=0;function Gl(e,t,n,r,i){return Wl=0,Kl(e.child,t,n,r,i)}function Kl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Fp(o);r.push(s),s.view&&(a=!0)}else a||Fp(o).view&&(a=!0);zl=!0,Mp(o,Wl===0?t:t+`_`+Wl,n),Wl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Kl(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function ql(e,t){for(;e!==null;)e.tag===5?Np(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||ql(e.child,t)),e=e.sibling}function Jl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Jl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=yi(t.default,t.share),t!==`none`&&(Gl(e,n,t,null,!1)||ql(e.child,!1))}e=e.sibling}}function Yl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=_i(r,n),a=yi(r.default,n.paired?r.share:r.enter);a===`none`?Jl(e):Gl(e,i,a,null,!1)?(Jl(e),n.paired||t||Rd(e,r.onEnter)):ql(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Yl(e,t),e=e.sibling;else Jl(e)}function Xl(e){if(Bl!==null&&Bl.size!==0){var t=Bl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=yi(n.default,n.share);if(a!==`none`&&(Gl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Rd(e,n.onShare)):ql(e.child,!1)),t.delete(r),t.size===0)break}}}Xl(e)}e=e.sibling}}}function Zl(e){if(e.tag===30){var t=e.memoizedProps,n=_i(t,e.stateNode),r=Bl===null?void 0:Bl.get(n),i=yi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Gl(e,n,i,null,!1)?r===void 0?Rd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Bl.delete(n),Rd(e,t.onShare)):ql(e.child,!1)),Bl!==null&&Xl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Zl(e),e=e.sibling;else Bl!==null&&Xl(e)}function Ql(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=_i(t,e.stateNode);t=yi(t.default,t.update),e.flags&=-5,t!==`none`&&Gl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Ql(e);e=e.sibling}}function $l(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,ql(e.child,!1))}$l(e)}e=e.sibling}}function eu(e){if(e.tag===30)e.stateNode.paired=null,ql(e.child,!1),$l(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)eu(e),e=e.sibling;else $l(e)}function tu(e){for(e=e.child;e!==null;)e.tag===30?ql(e.child,!1):e.subtreeFlags&33554432&&tu(e),e=e.sibling}function nu(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Wl<a.length){var l=a[Wl],u=Fp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Mp(c,Wl===0?n:n+`_`+Wl,i),s&&e.flags&4||(Hl===null&&(Hl=[]),Hl.push(c,Wl===0?r:r+`_`+Wl,t.memoizedProps)),Wl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:nu(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function ru(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=_i(n,r),a=yi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Ip)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Wl=0,i=nu(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Rd(e,n.onUpdate))}else e.subtreeFlags&33554432&&ru(e,t);e=e.sibling}}var iu=!1,au=!1,ou=!1,su=!1,cu=typeof WeakSet==`function`?WeakSet:Set,lu=null,uu=!1,du=!1,fu=!1,pu=!1;function mu(e,t,n){if(e=e.containerInfo,mp=xh,e=qr(e),Jr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(hp={focusedElem:e,selectionRange:r},xh=!1,n=(n&335544064)===n,lu=t,t=n?9270:1024;lu!==null;){if(e=lu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Zl(r[a]);if(e.alternate===null&&e.flags&2)n&&Vl(e),hu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Zl(r),hu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Vl(e),hu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,lu=r):(n&&Ql(e),hu(n))}}Bl=null}function hu(e){for(;lu!==null;){var t=lu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=xc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){yf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)sm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:sm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=_i(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=yi(a.default,a.update),a!==`none`&&Gl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,lu=r;break}lu=t.return}}function gu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Iu(e,n),r&4&&xl(5,n);break;case 1:if(Iu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){yf(n,n.return,e)}else{var i=xc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){yf(n,n.return,e)}}}r&64&&Cl(n),r&512&&Tl(n,n.return);break;case 3:if(Iu(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{Eo(e,t)}catch(e){yf(n,n.return,e)}}break;case 27:t===null&&r&4&&Rl(n);case 26:case 5:Iu(e,n),t===null&&r&4&&Ml(n),r&512&&Tl(n,n.return);break;case 12:Iu(e,n);break;case 31:Iu(e,n),r&4&&Tu(e,n);break;case 13:Iu(e,n),r&4&&Eu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Cf.bind(null,n),pm(e,n))));break;case 22:if(r=n.memoizedState!==null||iu,!r){var a=t!==null&&t.memoizedState!==null||au;t=iu,i=au,iu=r,(au=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Ru(e,n,r)):Iu(e,n),iu=t,au=i}break;case 30:Iu(e,n),r&512&&Tl(n,n.return);break;case 7:r&512&&Tl(n,n.return);default:Iu(e,n)}}function _u(e,t){for(e=e.child;e!==null;)vu(e,t),e=e.sibling}function vu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){yf(e,e.return,t)}yu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Gt=!0}catch(t){yf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?jp(s,!0):jp(e.stateNode,!1)}catch(t){yf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&_u(e,t);break;default:_u(e,t)}}function yu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:vu(n,r);break a;case 22:n.memoizedState===null&&yu(n,r);break a;default:yu(n,r)}}e=e.sibling}}function bu(e){var t=e.alternate;t!==null&&(e.alternate=null,bu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&At(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 xu=null,Su=!1;function Cu(e,t,n){for(n=n.child;n!==null;)wu(e,t,n),n=n.sibling}function wu(e,t,n){if(Ye&&typeof Ye.onCommitFiberUnmount==`function`)try{Ye.onCommitFiberUnmount(Je,n)}catch{}switch(n.tag){case 26:au||El(n,t),Cu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!au&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:au||El(n,t),kl(n);var r=xu,i=Su;kp(n.type)&&(xu=n.stateNode,Su=!1),Cu(e,t,n),xm(n.stateNode,n.type,n.memoizedProps),xu=r,Su=i;break;case 5:au||El(n,t),kl(n);case 6:if(n.tag===6&&kl(n),r=xu,i=Su,xu=null,Cu(e,t,n),xu=r,Su=i,xu!==null){if(Su)try{(xu.nodeType===9?xu.body:xu.nodeName===`HTML`?xu.ownerDocument.body:xu).removeChild(n.stateNode),Gt=!0}catch(e){yf(n,t,e)}else try{xu.removeChild(n.stateNode),Gt=!0}catch(e){yf(n,t,e)}}break;case 18:xu!==null&&(Su?(e=xu,Ap(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Kh(e)):Ap(xu,n.stateNode));break;case 4:r=xu,i=Su,xu=n.stateNode.containerInfo,Su=!0,Cu(e,t,n),xu=r,Su=i;break;case 0:case 11:case 14:case 15:Sl(2,n,t),au||Sl(4,n,t),Cu(e,t,n);break;case 1:au||(El(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&wl(n,t,r)),Cu(e,t,n);break;case 21:Cu(e,t,n);break;case 22:au=(r=au)||n.memoizedState!==null,Cu(e,t,n),au=r;break;case 30:El(n,t),Cu(e,t,n);break;case 7:au||El(n,t),Cu(e,t,n);break;default:Cu(e,t,n)}}function Tu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Kh(e)}catch(e){yf(t,t.return,e)}}}function Eu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Kh(e)}catch(e){yf(t,t.return,e)}}function Du(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new cu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new cu),t;default:throw Error(i(435,e.tag))}}function Ou(e,t){var n=Du(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=wf.bind(null,e,t);t.then(r,r)}})}function ku(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(kp(l.type)){xu=l.stateNode,Su=!1;break a}break;case 5:xu=l.stateNode,Su=!1;break a;case 3:case 4:xu=l.stateNode.containerInfo,Su=!0;break a}l=l.return}if(xu===null)throw Error(i(160));wu(s,c,o),xu=null,Su=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ju(t,e,n),t=t.sibling}var Au=null;function ju(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}ku(t,e,n),Mu(e),a&4&&(Sl(3,e,e.return),xl(3,e),Sl(5,e,e.return));break;case 1:ku(t,e,n),Mu(e),a&512&&(au||r===null||El(r,r.return)),a&64&&iu&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Au,ku(t,e,n),Mu(e),a&512&&(au||r===null||El(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(iu)e.stateNode=yp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[Ot]||r[xt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),lp(r,t,n),r[xt]=e,Ft(r),t=r;break a;case`link`:if(o=Xm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),lp(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Xm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),lp(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[xt]=e,Ft(r),t=r}e.stateNode=t}}else iu||Zm(o,e.type,e.stateNode)}else e.stateNode=Gm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Nl(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||au||t.parentNode.removeChild(t)):a.count--,n===null?iu||Zm(o,e.type,e.stateNode):Gm(o,n,e.memoizedProps))}break;case 27:ku(t,e,n),Mu(e),a&512&&(au||r===null||El(r,r.return)),r!==null&&a&4&&Nl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=ou,ou=!1,ku(t,e,n),ou=o,Mu(e),a&512&&(au||r===null||El(r,r.return)),e.flags&32){t=e.stateNode;try{un(t,``),Gt=!0}catch(t){yf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Nl(e,t,r===null?t:r.memoizedProps)),a&1024&&(su=!0);break;case 6:if(ku(t,e,n),Mu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Gt=!0}catch(t){yf(e,e.return,t)}}break;case 3:if(Gt=!1,Ym=null,o=Au,Au=Tm(t.containerInfo),ku(t,e,n),Au=o,Mu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Kh(t.containerInfo)}catch(t){yf(e,e.return,t)}su&&(su=!1,Nu(e)),Gt=!1;break;case 4:a=ou,ou=iu,r=Kt(),o=Au,Au=Tm(e.stateNode.containerInfo),ku(t,e,n),Mu(e),Au=o,Gt&&du&&(fu=!0),Gt=r,ou=a;break;case 12:ku(t,e,n),Mu(e);break;case 31:ku(t,e,n),Mu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ou(e,t)));break;case 13:ku(t,e,n),Mu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(yd=Be()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ou(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=iu,l=au,u=ou;iu=c||o,ou=u||o,au=l||s,ku(t,e,n),au=l,ou=u,iu=c,Mu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||iu||au||(t=s||au,n=iu,r=au,iu=o||iu,au=t,Lu(e,2),iu=n,au=r),!o&&ou||_u(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Ou(e,n))));break;case 19:ku(t,e,n),Mu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Ou(e,t)));break;case 30:a&512&&(au||r===null||El(r,r.return)),a=Kt(),o=du,s=(n&335544064)===n,c=e.memoizedProps,du=s&&yi(c.default,c.update)!==`none`,ku(t,e,n),Mu(e),s&&r!==null&&Gt&&(e.flags|=4),du=o,Gt=a;break;case 21:break;case 7:a&512&&(au||r===null||El(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:ku(t,e,n),Mu(e)}}function Mu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Pl(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(jl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Al(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Ll(e,Fl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(un(l,``),n.flags&=-33),Ll(e,Fl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Il(e,Fl(e),u,s);break;default:throw Error(i(161))}}catch(t){yf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Nu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,xh=!0,t.reset(),xh=!1),e=e.sibling}}function Pu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Fu(t,e),t=t.sibling;else ru(t,!1)}function Fu(e,t){var n=e.alternate;if(n===null)Yl(e,!1);else switch(e.tag){case 3:if(pu=uu=!1,Ul(),Pu(t,e),!uu&&!fu){if(e=Hl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Np(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),pu=!0}Hl=null;break;case 5:Pu(t,e);break;case 4:r=uu,uu=!1,Pu(t,e),uu&&(fu=!0),uu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Pu(t,e):Yl(e,!1));break;case 30:r=uu,i=Ul(),uu=!1,Pu(t,e),uu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=_i(a,o),o=_i(n.memoizedProps,o);var s=yi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Wl=0,t=nu(e,n,t,o,s,a,!0),Wl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Rd(e,e.memoizedProps.onUpdate),Hl=i):i!==null&&(i.push.apply(i,Hl),Hl=i),uu=e.flags&32?!0:r;break;default:Pu(t,e)}}function Iu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)gu(e,t.alternate,t),t=t.sibling}function Lu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Sl(4,n,n.return),Lu(n,r);break;case 1:El(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&wl(n,n.return,i),Lu(n,r);break;case 27:r&2&&xm(n.stateNode,n.type,n.memoizedProps);case 5:El(n,n.return),n.tag!==5&&n.tag!==27||kl(n),Lu(n,r);break;case 6:kl(n);break;case 26:El(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||au||i.parentNode.removeChild(i),Lu(n,r);break;case 22:n.memoizedState===null&&Lu(n,r);break;case 30:El(n,n.return),Lu(n,r);break;case 7:El(n,n.return);default:Lu(n,r)}e=e.sibling}}function Ru(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Ru(i,a,n),xl(4,a);break;case 1:if(Ru(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){yf(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)To(l[i],c)}catch(e){yf(r,r.return,e)}}s&&o&64&&Cl(a),Tl(a,a.return);break;case 27:n&2&&Rl(a);case 5:a.tag!==5&&a.tag!==27||Ol(a),Ru(i,a,n),s&&r===null&&o&4&&Ml(a),Tl(a,a.return);break;case 6:Ol(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||iu||Zm(Tm(c.ownerDocument),a.type,c),Ru(i,a,n),s&&r===null&&o&4&&Ml(a),Tl(a,a.return);break;case 12:Ru(i,a,n);break;case 31:Ru(i,a,n),s&&o&4&&Tu(i,a);break;case 13:Ru(i,a,n),s&&o&4&&Eu(i,a);break;case 22:a.memoizedState===null&&Ru(i,a,n),Tl(a,a.return);break;case 30:Ru(i,a,n),Tl(a,a.return);break;case 7:Tl(a,a.return);default:Ru(i,a,n)}t=t.sibling}}function zu(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&&Pa(n))}function Bu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Pa(e))}function Vu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Hu(e,t,n,r),t=t.sibling;else i&&tu(t)}function Hu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&eu(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Vu(e,t,n,r),a&2048&&xl(9,t);break;case 1:Vu(e,t,n,r);break;case 3:Vu(e,t,n,r),i&&pu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Pa(a)));break;case 12:if(a&2048){Vu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){yf(t,t.return,e)}}else Vu(e,t,n,r);break;case 31:Vu(e,t,n,r);break;case 13:Vu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&eu(t),o._visibility&2?Vu(e,t,n,r):(o._visibility|=2,Uu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&eu(s),o._visibility&2?Vu(e,t,n,r):Wu(e,t)),a&2048&&zu(s,t);break;case 24:Vu(e,t,n,r),a&2048&&Bu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(ql(a.child,!0),ql(t.child,!0))),Vu(e,t,n,r);break;default:Vu(e,t,n,r)}}function Uu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Uu(a,o,s,c,i),xl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Uu(a,o,s,c,i)):u._visibility&2?Uu(a,o,s,c,i):Wu(a,o),i&&l&2048&&zu(o.alternate,o);break;case 24:Uu(a,o,s,c,i),i&&l&2048&&Bu(o.alternate,o);break;default:Uu(a,o,s,c,i)}t=t.sibling}}function Wu(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:Wu(n,r),i&2048&&zu(r.alternate,r);break;case 24:Wu(n,r),i&2048&&Bu(r.alternate,r);break;default:Wu(n,r)}t=t.sibling}}var Gu=8192;function Ku(e,t,n){if(e.subtreeFlags&Gu)for(e=e.child;e!==null;)qu(e,t,n),e=e.sibling}function qu(e,t,n){switch(e.tag){case 26:Ku(e,t,n),e.flags&Gu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&nh(n,e)):rh(n,Au,e.memoizedState,e.memoizedProps));break;case 5:Ku(e,t,n),e.flags&Gu&&(e=e.stateNode,(t&335544128)===t&&nh(n,e));break;case 3:case 4:var r=Au;Au=Tm(e.stateNode.containerInfo),Ku(e,t,n),Au=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Gu,Gu=16777216,Ku(e,t,n),Gu=r):Ku(e,t,n));break;case 30:if((e.flags&Gu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Bl===null&&(Bl=new Map),Bl.set(r,i)}Ku(e,t,n);break;default:Ku(e,t,n)}}function Ju(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 Yu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];lu=r,Qu(r,e)}Ju(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Xu(e),e=e.sibling}function Xu(e){switch(e.tag){case 0:case 11:case 15:Yu(e),e.flags&2048&&Sl(9,e,e.return);break;case 3:Yu(e);break;case 12:Yu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Zu(e)):Yu(e);break;default:Yu(e)}}function Zu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];lu=r,Qu(r,e)}Ju(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Sl(8,t,t.return),Zu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Zu(t));break;default:Zu(t)}e=e.sibling}}function Qu(e,t){for(;lu!==null;){var n=lu;switch(n.tag){case 0:case 11:case 15:Sl(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:Pa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,lu=r;else a:for(n=e;lu!==null;){r=lu;var i=r.sibling,a=r.return;if(bu(r),r===n){lu=null;break a}if(i!==null){i.return=a,lu=i;break a}lu=a}}}var $u={getCacheForType:function(e){var t=Ea(Ma),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ea(Ma).controller.signal}},ed=typeof WeakMap==`function`?WeakMap:Map,td=0,nd=null,rd=null,id=0,G=0,ad=null,od=!1,sd=!1,cd=!1,ld=0,ud=0,dd=0,fd=0,pd=0,md=0,hd=0,gd=null,_d=null,vd=!1,yd=0,bd=0,xd=1/0,Sd=null,Cd=null,wd=0,Td=null,Ed=null,Dd=0,Od=0,kd=null,Ad=null,jd=null,Md=null,Nd=null,Pd=0,Fd=null;function Id(){return td&2&&id!==0?id&-id:I.T===null?vt():Bf()}function Ld(){if(md===0){if(!(id&536870912)||aa){var e=nt;nt<<=1,!(nt&3932160)&&(nt=262144),md=e}else md=536870912}return e=Mo.current,e!==null&&(e.flags|=32),md}function Rd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Vp(_i(e.memoizedProps,n))),Md===null&&(Md=[]),Md.push(t.bind(null,r))}}function zd(e,t,n){(e===nd&&(G===2||G===9)||e.cancelPendingCommit!==null)&&(Kd(e,0),Ud(e,id,md,!1)),dt(e,n),(!(td&2)||e!==nd)&&(e===nd&&(!(td&2)&&(fd|=n),ud===4&&Ud(e,id,md,!1)),Mf(e))}function Bd(e,t,n){if(td&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||ot(e,t),a=r?ef(e,t):Qd(e,t,!0),o=r;do{if(a===0){sd&&!r&&Ud(e,t,0,!1);break}if(n=e.current.alternate,o&&!Hd(n))a=Qd(e,t,!1),o=!1;else{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=gd;var l=c.current.memoizedState.isDehydrated;if(l&&(Kd(c,s).flags|=256),s=Qd(c,s,!1),s!==2&&s!==6){if(cd&&!l){c.errorRecoveryDisabledLanes|=o,fd|=o,a=4;break a}o=_d,_d=a,o!==null&&(_d===null?_d=o:_d.push.apply(_d,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Kd(e,0),Ud(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&&(t&62914560)!==t)break;case 6:Ud(r,t,md,!od);break a;case 2:_d=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=yd+300-Be(),10<a)){if(Ud(r,t,md,!od),at(r,0,!0)!==0)break a;Dd=t,r.timeoutHandle=Cp(Vd.bind(null,r,n,_d,Sd,vd,t,md,fd,hd,od,o,`Throttled`,-0,0),a);break a}Vd(r,n,_d,Sd,vd,t,md,fd,hd,od,o,null,-0,0)}break}}while(1);Mf(e)}function Vd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vn},Bl=null,qu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=sh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?yd-Be():(a&4194048)===a?bd-Be():0,m=ah(d,m),m!==null)?(Dd=a,e.cancelPendingCommit=m(cf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Ud(e,a,o,!l)):cf(e,t,a,n,r,i,o,s,c,l,u,d)}function Hd(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(!Vr(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 Ud(e,t,n,r){t=st(e,t),t&=~pd,t&=~fd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ze(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&pt(e,n,t)}function Wd(){return td&6?!0:(Nf(0,!1),!1)}function Gd(){if(rd!==null){if(G===0)var e=rd.return;else e=rd,va=_a=null,ss(e),oo=null,so=0,e=rd;for(;e!==null;)bl(e.alternate,e),e=e.return;rd=null}}function Kd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,wp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Dd=0,Gd(),nd=e,rd=n=Pi(e.current,null),id=t,G=0,ad=null,od=!1,sd=ot(e,t),cd=!1,hd=md=pd=fd=dd=ud=0,_d=gd=null,vd=!1,ld=st(e,t),wi(),n}function qd(e,t){B=null,I.H=pc,t===Xa||t===Qa?(t=io(),G=3):t===Za?(t=io(),G=4):G=t===jc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,ad=t,rd===null&&(ud=1,Tc(e,Hi(t,e.current)))}function Jd(){var e=Mo.current;return e===null?!0:(id&4194048)===id?No===null:(id&62914560)===id||id&536870912?e===No:!1}function Yd(){var e=I.H;return I.H=pc,e===null?pc:e}function Xd(){var e=I.A;return I.A=$u,e}function Zd(){ud=4,od||(id&4194048)!==id&&Mo.current!==null||(sd=!0),!(dd&134217727)&&!(fd&134217727)||nd===null||Ud(nd,id,md,!1)}function Qd(e,t,n){var r=td;td|=2;var i=Yd(),a=Xd();(nd!==e||id!==t)&&(Sd=null,Kd(e,t)),t=!1;var o=ud;a:do try{if(G!==0&&rd!==null){var s=rd,c=ad;switch(G){case 8:Gd(),o=6;break a;case 3:case 2:case 9:case 6:Mo.current===null&&(t=!0);var l=G;if(G=0,ad=null,af(e,s,c,l),n&&sd){o=0;break a}break;default:l=G,G=0,ad=null,af(e,s,c,l)}}$d(),o=ud;break}catch(t){qd(e,t)}while(1);return t&&e.shellSuspendCounter++,va=_a=null,td=r,I.H=i,I.A=a,rd===null&&(nd=null,id=0,wi()),o}function $d(){for(;rd!==null;)nf(rd)}function ef(e,t){var n=td;td|=2;var r=Yd(),a=Xd();nd!==e||id!==t?(Sd=null,xd=Be()+500,Kd(e,t)):sd=ot(e,t);a:do try{if(G!==0&&rd!==null){t=rd;var o=ad;b:switch(G){case 1:G=0,ad=null,af(e,t,o,1);break;case 2:case 9:if(eo(o)){G=0,ad=null,rf(t);break}t=function(){G!==2&&G!==9||nd!==e||(G=7),Mf(e)},o.then(t,t);break a;case 3:G=7;break a;case 4:G=5;break a;case 7:eo(o)?(G=0,ad=null,rf(t)):(G=0,ad=null,af(e,t,o,7));break;case 5:var s=null;switch(rd.tag){case 26:s=rd.memoizedState;case 5:case 27:var c=rd;if(s?eh(s):c.stateNode.complete){G=0,ad=null;var l=c.sibling;if(l!==null)rd=l;else{var u=c.return;u===null?rd=null:(rd=u,of(u))}break b}}G=0,ad=null,af(e,t,o,5);break;case 6:G=0,ad=null,af(e,t,o,6);break;case 8:Gd(),ud=6;break a;default:throw Error(i(462))}}tf();break}catch(t){qd(e,t)}while(1);return va=_a=null,I.H=r,I.A=a,td=n,rd===null?(nd=null,id=0,wi(),ud):0}function tf(){for(;rd!==null&&!Re();)nf(rd)}function nf(e){var t=dl(e.alternate,e,ld);e.memoizedProps=e.pendingProps,t===null?of(e):rd=t}function rf(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Gc(n,t,t.pendingProps,t.type,void 0,id);break;case 11:t=Gc(n,t,t.pendingProps,t.type.render,t.ref,id);break;case 5:ss(t);var r=t;r===ra&&(aa?(da(r),r.tag===5&&r.stateNode!=null&&(ia=r.stateNode)):(da(r),aa=!0));default:bl(n,t),t=rd=Fi(t,ld),t=dl(n,t,ld)}e.memoizedProps=e.pendingProps,t===null?of(e):rd=t}function af(e,t,n,r){va=_a=null,ss(t),oo=null,so=0;var i=t.return;try{if(Ac(e,i,t,n,id)){ud=1,Tc(e,Hi(n,e.current)),rd=null;return}}catch(t){if(i!==null)throw rd=i,t;ud=1,Tc(e,Hi(n,e.current)),rd=null;return}t.flags&32768?(aa||r===1?e=!0:sd||id&536870912?e=!1:(od=e=!0,(r===2||r===9||r===3||r===6)&&(r=Mo.current,r!==null&&r.tag===13&&(r.flags|=16384))),sf(t,e)):of(t)}function of(e){var t=e;do{if(t.flags&32768){sf(t,od);return}e=t.return;var n=vl(t.alternate,t,ld);if(n!==null){rd=n;return}if(t=t.sibling,t!==null){rd=t;return}rd=t=e}while(t!==null);ud===0&&(ud=5)}function sf(e,t){do{var n=yl(e.alternate,e);if(n!==null){n.flags&=32767,rd=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){rd=e;return}rd=e=n}while(e!==null);ud=6,rd=null}function cf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do gf();while(wd!==0);if(td&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===nd&&(rd=nd=null,id=0),Ed=t,Td=e,Dd=n,kd=a,Ad=r,lf(e,t,n,s,c,l,f)}}function lf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Od=s,s|=Ci,ft(e,n,s,r,i,a),Md=null,(n&335544064)===n?(Nd=La(e),r=10262):(Nd=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Tf(We,function(){return _f(),null})):(e.callbackNode=null,e.callbackPriority=0),zl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=I.T,I.T=null,i=L.p,L.p=2,a=td,td|=4;try{mu(e,t,n)}finally{td=a,L.p=i,I.T=r}}wd=1,zl?jd=zp(o,e.containerInfo,Nd,ff,pf,df,mf,_f,uf,null,null):(ff(),pf(),mf())}function uf(e){if(wd!==0){var t=Td.onRecoverableError;t(e,{componentStack:null})}}function df(){wd===3&&(wd=0,Fu(Ed,Td),wd=4)}function ff(){if(wd===1){wd=0;var e=Td,t=Ed,n=Dd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=I.T,I.T=null;var i=L.p;L.p=2;var a=td;td|=4;try{du=fu=!1,ju(t,e,n),n=hp;var o=qr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Kr(s.ownerDocument.documentElement,s)){if(c!==null&&Jr(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}}xh=!!mp,hp=mp=null}finally{td=a,L.p=i,I.T=r}}e.current=t,wd=2}}function pf(){if(wd===2){wd=0;var e=Td,t=Ed,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=td;td|=4;try{gu(e,t.alternate,t)}finally{td=i,L.p=r,I.T=n}}wd=3}}function mf(){if(wd===4||wd===3){wd=0;var e=jd;jd=null,ze();var t=Td,n=Ed,r=Dd,i=Ad,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?wd=5:(wd=0,Ed=Td=null,hf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Cd=null),_t(r),n=n.stateNode,Ye&&typeof Ye.onCommitFiberRoot==`function`)try{Ye.onCommitFiberRoot(Je,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=I.T,a=L.p,L.p=2,I.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{I.T=n,L.p=a}}if(i=Md,o=Nd,Nd=null,i!==null&&(Md=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Dd&3&&gf(),Mf(t),a=t.pendingLanes,r&261930&&a&42?t===Fd?Pd++:(Pd=0,Fd=t):(Pd=0,Fd=null),Nf(0,!1)}}function hf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Pa(t)))}function gf(){return jd!==null&&(jd.skipTransition(),jd=null),ff(),pf(),mf(),_f()}function _f(){if(wd!==5)return!1;var e=Td,t=Od;Od=0;var n=_t(Dd),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=kd,kd=null;var o=Td,s=Dd;if(wd=0,Ed=Td=null,Dd=0,td&6)throw Error(i(331));var c=td;if(td|=4,Xu(o.current),Hu(o,o.current,s,n),td=c,Nf(0,!1),Ye&&typeof Ye.onPostCommitFiberRoot==`function`)try{Ye.onPostCommitFiberRoot(Je,o)}catch{}return!0}finally{L.p=a,I.T=r,hf(e,t)}}function vf(e,t,n){t=Hi(n,t),t=Dc(e.stateNode,t,2),e=yo(e,t,2),e!==null&&(dt(e,2),Mf(e))}function yf(e,t,n){if(e.tag===3)vf(e,e,n);else for(;t!==null;){if(t.tag===3){vf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Cd===null||!Cd.has(r))){e=Hi(n,e),n=Oc(2),r=yo(t,n,2),r!==null&&(kc(n,r,t,e),dt(r,2),Mf(r));break}}t=t.return}}function bf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ed;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)||(cd=!0,i.add(n),e=xf.bind(null,e,t,n),t.then(e,e))}function xf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,nd===e&&(id&n)===n&&(ud===4||ud===3&&(id&62914560)===id&&300>Be()-yd?td&2?pd|=n:Kd(e,0):pd|=n,hd===id&&(hd=0)),Mf(e)}function Sf(e,t){t===0&&(t=lt()),e=Di(e,t),e!==null&&(dt(e,t),Mf(e))}function Cf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Sf(e,n)}function wf(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),Sf(e,n)}function Tf(e,t){return Ie(e,t)}var Ef=null,Df=null,Of=!1,kf=!1,Af=!1,jf=0;function Mf(e){e!==Df&&e.next===null&&(Df===null?Ef=Df=e:Df=Df.next=e),kf=!0,Of||(Of=!0,zf())}function Nf(e,t){if(!Af&&kf){Af=!0;do for(var n=!1,r=Ef;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ze(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Rf(r,a))}else a=id,a=at(r,r===nd?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ot(r,a)||(n=!0,Rf(r,a))}r=r.next}while(n);Af=!1}}function Pf(){Ff()}function Ff(){kf=Of=!1;var e=0;jf!==0&&Sp()&&(e=jf);for(var t=Be(),n=null,r=Ef;r!==null;){var i=r.next,a=If(r,t);a===0?(r.next=null,n===null?Ef=i:n.next=i,i===null&&(Df=n)):(n=r,(e!==0||a&3)&&(kf=!0)),r=i}wd!==0&&wd!==5||Nf(e,!1),jf!==0&&(jf=0)}function If(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ze(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=ct(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=nd,n=id,n=at(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(G===2||G===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Le(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ot(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Le(r),_t(n)){case 2:case 8:n=Ue;break;case 32:n=We;break;case 268435456:n=Ke;break;default:n=We}return r=Lf.bind(null,e),n=Ie(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Le(r),e.callbackPriority=2,e.callbackNode=null,2}function Lf(e,t){if(wd!==0&&wd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(gf()&&e.callbackNode!==n)return null;var r=id;return r=at(e,e===nd?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Bd(e,r,t),If(e,Be()),e.callbackNode!=null&&e.callbackNode===n?Lf.bind(null,e):null)}function Rf(e,t){if(gf())return null;Bd(e,t,!0)}function zf(){Dp(function(){td&6?Ie(He,Pf):Ff()})}function Bf(){if(jf===0){var e=Ba;e===0&&(e=tt,tt<<=1,!(tt&261888)&&(tt=256)),jf=e}return jf}function Vf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:_n(e)}function Hf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Vf((i[St]||null).action),o=r.submitter;o&&(t=(t=o[St]||null)?Vf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new zn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(jf!==0){var e=new FormData(i,o);$s(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),$s(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Uf=0;Uf<mi.length;Uf++){var Wf=mi[Uf];hi(Wf.toLowerCase(),`on`+(Wf[0].toUpperCase()+Wf.slice(1)))}hi(oi,`onAnimationEnd`),hi(si,`onAnimationIteration`),hi(ci,`onAnimationStart`),hi(`dblclick`,`onDoubleClick`),hi(`focusin`,`onFocus`),hi(`focusout`,`onBlur`),hi(li,`onTransitionRun`),hi(ui,`onTransitionStart`),hi(di,`onTransitionCancel`),hi(fi,`onTransitionEnd`),Bt(`onMouseEnter`,[`mouseout`,`mouseover`]),Bt(`onMouseLeave`,[`mouseout`,`mouseover`]),Bt(`onPointerEnter`,[`pointerout`,`pointerover`]),Bt(`onPointerLeave`,[`pointerout`,`pointerover`]),zt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),zt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),zt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),zt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),zt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),zt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Gf=`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(` `),Kf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Gf));function qf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){bi(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){bi(e)}i.currentTarget=null,a=c}}}}function Jf(e,t){var n=t[wt];n===void 0&&(n=t[wt]=new Set);var r=e+`__bubble`;n.has(r)||(Qf(t,e,2,!1),n.add(r))}function Yf(e,t,n){var r=0;t&&(r|=4),Qf(n,e,r,t)}var Xf=`_reactListening`+Math.random().toString(36).slice(2);function Zf(e){if(!e[Xf]){e[Xf]=!0,Lt.forEach(function(t){t!==`selectionchange`&&(Kf.has(t)||Yf(t,!1,e),Yf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Xf]||(t[Xf]=!0,Yf(`selectionchange`,!1,t))}}function Qf(e,t,n,r){switch(Oh(t)){case 2:var i=Sh;break;case 8:i=Ch;break;default:i=wh}n=i.bind(null,t,n,e),i=void 0,!On||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 $f(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=jt(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}Tn(function(){var r=a,i=bn(n),s=[];a:{var c=pi.get(e);if(c!==void 0){var l=zn,u=e;switch(e){case`keypress`:if(Pn(n)===0)break a;case`keydown`:case`keyup`:l=rr;break;case`focusin`:u=`focus`,l=Jn;break;case`focusout`:u=`blur`,l=Jn;break;case`beforeblur`:case`afterblur`:l=Jn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Kn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=qn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=or;break;case oi:case si:case ci:l=Yn;break;case fi:l=sr;break;case`scroll`:case`scrollend`:l=Vn;break;case`wheel`:l=cr;break;case`copy`:case`cut`:case`paste`:l=Xn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=ir;break;case`submit`:l=ar;break;case`toggle`:case`beforetoggle`:l=lr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=En(m,p),g!=null&&d.push(ep(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(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==yn&&(u=n.relatedTarget||n.fromElement)&&(jt(u)||u[Ct]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?jt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Kn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=ir,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Nt(c),h=l==null?u:Nt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,jt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?E(c,l,tp):null,c!==null&&np(s,u,c,d,!1),l!==null&&f!==null&&np(s,f,l,d,!0)))}a:{if(c=r?Nt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=kr;else if(Cr(c)){if(Ar)_=zr;else{_=Lr;var v=Ir}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&mn(r.elementType)&&(_=kr):_=Rr;if(_&&=_(e,r)){wr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Nt(r):window,e){case`focusin`:(Cr(v)||v.contentEditable===`true`)&&(Xr=v,Zr=r,Qr=null);break;case`focusout`:Qr=Zr=Xr=null;break;case`mousedown`:$r=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:$r=!1,ei(s,n,i);break;case`selectionchange`:if(Yr)break;case`keydown`:case`keyup`:ei(s,n,i)}var y;if(dr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else yr?_r(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(mr&&n.locale!==`ko`&&(yr||b!==`onCompositionStart`?b===`onCompositionEnd`&&yr&&(y=Nn()):(An=i,jn=`value`in An?An.value:An.textContent,yr=!0)),v=K(r,b),0<v.length&&(b=new Zn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=vr(n),y!==null&&(b.data=y)))),(y=pr?br(e,n):xr(e,n))&&(b=K(r,`onBeforeInput`),0<b.length&&(v=new Zn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Hf(s,e,r,n,i)}qf(s,t)})}function ep(e,t,n){return{instance:e,listener:t,currentTarget:n}}function K(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=En(e,n),i!=null&&r.unshift(ep(e,i,a)),i=En(e,t),i!=null&&r.push(ep(e,i,a))),e.tag===3)return r;e=e.return}return[]}function tp(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function np(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=En(n,a),l!=null&&o.unshift(ep(n,l,c))):i||(l=En(n,a),l!=null&&o.push(ep(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var rp=/\r\n?/g,ip=/\u0000|\uFFFD/g;function ap(e){return(typeof e==`string`?e:``+e).replace(rp,`
|
|
9
|
+
`).replace(ip,``)}function op(e,t){return t=ap(t),ap(e)===t}function sp(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||un(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&un(e,``+r);else return;break;case`className`:Jt(e,`class`,r);break;case`tabIndex`:Jt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Jt(e,n,r);break;case`style`:pn(e,r,o);return;case`data`:if(t!==`object`){Jt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=_n(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&sp(e,t,`name`,a.name,a,null),sp(e,t,`formEncType`,a.formEncType,a,null),sp(e,t,`formMethod`,a.formMethod,a,null),sp(e,t,`formTarget`,a.formTarget,a,null)):(sp(e,t,`encType`,a.encType,a,null),sp(e,t,`method`,a.method,a,null),sp(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=_n(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=vn);return;case`onScroll`:r!=null&&Jf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Jf(`scrollend`,e);return;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));o?.__html!==n&&(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=_n(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`credentialless`: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`:Jf(`beforetoggle`,e),Jf(`toggle`,e),qt(e,`popover`,r);break;case`xlinkActuate`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:qt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=hn.get(n)||n,qt(e,n,r);else return}Gt=!0}function cp(e,t,n,r,a,o){switch(n){case`style`:pn(e,r,o);return;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));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)un(e,r);else if(typeof r==`number`||typeof r==`bigint`)un(e,``+r);else return;break;case`onScroll`:r!=null&&Jf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Jf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=vn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Rt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[St]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Gt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):qt(e,n,r)}return}Gt=!0}function lp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Jf(`error`,e),Jf(`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:sp(e,t,o,s,n,null)}}a&&sp(e,t,`srcSet`,n.srcSet,n,null),r&&sp(e,t,`src`,n.src,n,null);return;case`input`:Jf(`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:sp(e,t,r,d,n,null)}}an(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Jf(`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:sp(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&sn(e,!!r,n,!0):sn(e,!!r,t,!1);return;case`textarea`:for(s in Jf(`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:sp(e,t,s,c,n,null)}ln(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:sp(e,t,l,r,n,null)}return;case`dialog`:Jf(`beforetoggle`,e),Jf(`toggle`,e),Jf(`cancel`,e),Jf(`close`,e);break;case`iframe`:case`object`:Jf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Gf.length;r++)Jf(Gf[r],e);break;case`image`:Jf(`error`,e),Jf(`load`,e);break;case`details`:Jf(`toggle`,e);break;case`embed`:case`source`:case`link`:Jf(`error`,e),Jf(`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:sp(e,t,u,r,n,null)}return;default:if(mn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&cp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&sp(e,t,c,r,n,null))}var up={};function dp(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)||sp(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`:m!==f&&(Gt=!0),o=m;break;case`name`:m!==f&&(Gt=!0),a=m;break;case`checked`:m!==f&&(Gt=!0),u=m;break;case`defaultChecked`:m!==f&&(Gt=!0),d=m;break;case`value`:m!==f&&(Gt=!0),s=m;break;case`defaultValue`:m!==f&&(Gt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&sp(e,t,p,m,r,f)}}rn(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)||sp(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`:o!==l&&(Gt=!0),p=o;break;case`defaultValue`:o!==l&&(Gt=!0),c=o;break;case`multiple`:o!==l&&(Gt=!0),s=o;default:o!==l&&sp(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?sn(e,!!n,n?[]:``,!1):sn(e,!!n,t,!0)):sn(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:sp(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`:a!==o&&(Gt=!0),p=a;break;case`defaultValue`:a!==o&&(Gt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&sp(e,t,s,a,r,o)}cn(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:sp(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`:p!==m&&(Gt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:sp(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)&&sp(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:sp(e,t,u,p,r,m)}return;default:if(mn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&cp(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||cp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&sp(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||sp(e,t,f,p,r,m)}function fp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function pp(){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&&fp(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&&fp(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 mp=null,hp=null;function gp(e){return e.nodeType===9?e:e.ownerDocument}function _p(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 vp(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 yp(e,t,n,r){return n=gp(n).createElement(e),n[xt]=r,n[St]=t,lp(n,e,t),Ft(n),n}function bp(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 xp=null;function Sp(){var e=window.event;return e&&e.type===`popstate`?e!==xp&&(xp=e,!0):(xp=null,!1)}var Cp=typeof setTimeout==`function`?setTimeout:void 0,wp=typeof clearTimeout==`function`?clearTimeout:void 0,Tp=typeof Promise==`function`?Promise:void 0,Ep=typeof requestAnimationFrame==`function`?requestAnimationFrame:Cp,Dp=typeof queueMicrotask==`function`?queueMicrotask:Tp===void 0?Cp:function(e){return Tp.resolve(null).then(e).catch(Op)};function Op(e){setTimeout(function(){throw e})}function kp(e){return e===`head`}function Ap(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),Kh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Sm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Sm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Ot]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Sm(e.ownerDocument.body)}n=i}while(n);Kh(t)}function jp(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 Mp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Np(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Pp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Fp(e){return Pp(e.getBoundingClientRect(),getComputedStyle(e),e)}function Ip(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Pp(t,n,e)}function Lp(e){return e.documentElement.clientHeight}function Rp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function zp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Lp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=th(f),u>ih){s.length=o;break}f=new Promise(Rp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Bp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Bp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Bp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Bp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Vp(e){return{name:e,group:new Bp(`group`,e),imagePair:new Bp(`image-pair`,e),old:new Bp(`old`,e),new:new Bp(`new`,e)}}function Hp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Hp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(qp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Gp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Up,e,s,r)}this._eventListeners=a}};function Up(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Hp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=qp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Gp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Wp,e,n,i),r.splice(t,1),a!==null&&a()}};function Wp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Gp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Kp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function qp(e,t,n,r){if(e.length===0)return-1;r=Kp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Kp(a.optionsOrUseCapture)===r)return i}return-1}Hp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Gp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Gp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Hp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Jp,e,void 0,void 0)};function Jp(e,t){return e.tag!==6&&(e=b(e),vm(e,t))}Hp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Yp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Jp(t[n],e);n--);};function Yp(e,t){return t.push(e),!1}Hp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=gp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Xp,e,void 0,void 0))};function Xp(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Hp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,Zp,e,void 0,void 0)};function Zp(e,t){return e.tag===6||(e=b(e),t.observe(e)),!1}Hp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,Qp,e,void 0,void 0);for(var n=t=0;n<$p.length;n++){var r=$p[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):$p[t++]=r}$p.length=t}};function Qp(e,t){return e.tag===6||(e=b(e),t.unobserve(e)),!1}var $p=[],q=!1;function em(e,t,n){$p.push({fragmentInstance:e,observer:t,instance:n}),q||(q=!0,ym(function(){q=!1;var e=$p;$p=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Hp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,tm,e,void 0,void 0),e};function tm(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Hp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Hp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Yp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||J(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function J(e,t,n,r,i){var a=jt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(h(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(h(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function nm(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Hp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];h(this._fragmentFiber.child,!1,Yp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),nm(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=b(a),nm(a,n)):b(a).scrollIntoView(e),r+=n?-1:1}};function rm(e,t){return e=b(e),im(e,t),!1}function im(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function am(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Gp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<$p.length;i++){var a=$p[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&($p[r++]=a)}$p.length=r,n.observe(e)}),im(e,t))}function om(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Gp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?em(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function sm(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`:sm(n),At(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function cm(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[Ot])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=mm(e.nextSibling),e===null)break}return null}function lm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=mm(e.nextSibling),e===null))return null;return e}function um(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=mm(e.nextSibling),e===null))return null;return e}function dm(e){return e.data===`$?`||e.data===`$~`}function fm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function pm(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 mm(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 hm=null;function gm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return mm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function _m(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 vm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function ym(e){Ep(function(){Ep(function(t){return e(t)})})}function bm(e,t,n){switch(t=gp(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 xm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&sp(e,t,r,null,up,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===vn&&(e.onclick=null),At(e)}function Sm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);At(e)}var Cm=new Map,wm=new Set;function Tm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Em=L.d;L.d={f:Dm,r:Om,D:jm,C:Mm,L:Nm,m:Pm,X:Im,S:Fm,M:Lm};function Dm(){var e=Em.f(),t=Wd();return e||t}function Om(e){var t=Mt(e);t!==null&&t.tag===5&&t.type===`form`?tc(t):Em.r(e)}var km=typeof document>`u`?null:document;function Am(e,t,n){var r=km;if(r&&typeof t==`string`&&t){var i=nn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),wm.has(i)||(wm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),lp(t,`link`,e),Ft(t),r.head.appendChild(t)))}}function jm(e){Em.D(e),Am(`dns-prefetch`,e,null)}function Mm(e,t){Em.C(e,t),Am(`preconnect`,e,t)}function Nm(e,t,n){Em.L(e,t,n);var r=km;if(r&&e&&t){var i=`link[rel="preload"][as="`+nn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+nn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+nn(n.imageSizes)+`"]`)):i+=`[href="`+nn(e)+`"]`;var a=i;switch(t){case`style`:a=zm(e);break;case`script`:a=Um(e)}if(!(Cm.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Cm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Bm(a))||t===`script`&&r.querySelector(Wm(a))))){var o=r.createElement(`link`);lp(o,`link`,e),t===`style`&&(o[kt]=!0,o.onload=o.onerror=function(){It(o)}),Ft(o),r.head.appendChild(o)}}}function Pm(e,t){Em.m(e,t);var n=km;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+nn(r)+`"][href="`+nn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Um(e)}if(!Cm.has(a)&&(e=D({rel:`modulepreload`,href:e},t),Cm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Wm(a)))return}r=n.createElement(`link`),lp(r,`link`,e),Ft(r),n.head.appendChild(r)}}}function Fm(e,t,n){Em.S(e,t,n);var r=km;if(r&&e){var i=Pt(r).hoistableStyles,a=zm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Bm(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Cm.get(a))&&qm(e,n);var c=o=r.createElement(`link`);Ft(c),lp(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,Km(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Im(e,t){Em.X(e,t);var n=km;if(n&&e){var r=Pt(n).hoistableScripts,i=Um(e),a=r.get(i);a||(a=n.querySelector(Wm(i)),a||(e=D({src:e,async:!0},t),(t=Cm.get(i))&&Jm(e,t),a=n.createElement(`script`),Ft(a),lp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lm(e,t){Em.M(e,t);var n=km;if(n&&e){var r=Pt(n).hoistableScripts,i=Um(e),a=r.get(i);a||(a=n.querySelector(Wm(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=Cm.get(i))&&Jm(e,t),a=n.createElement(`script`),Ft(a),lp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Rm(e,t,n,r){var a=(a=Se.current)?Tm(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`?(n=zm(n.href),t=Pt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,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=zm(n.href);var o=Pt(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(Bm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=Cm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Cm.set(e,o)),Hm(a,e,o,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`?(n=Um(n),t=Pt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function zm(e){return`href="`+nn(e)+`"`}function Bm(e){return`link[rel="stylesheet"][`+e+`]`}function Vm(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function Hm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[kt]){r.loading=1;return}}else t=e.createElement(`link`),t[kt]=!0,t.onload=t.onerror=It.bind(null,t),lp(t,`link`,n),Ft(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Um(e){return`[src="`+nn(e)+`"]`}function Wm(e){return`script[async]`+e}function Gm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+nn(n.href)+`"]`);if(r)return t.instance=r,Ft(r),r;var a=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ft(r),lp(r,`style`,a),Km(r,n.precedence,e),t.instance=r;case`stylesheet`:a=zm(n.href);var o=e.querySelector(Bm(a));if(o)return t.state.loading|=4,t.instance=o,Ft(o),o;r=Vm(n),(a=Cm.get(a))&&qm(r,a),o=(e.ownerDocument||e).createElement(`link`),Ft(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),lp(o,`link`,r),t.state.loading|=4,Km(o,n.precedence,e),t.instance=o;case`script`:return o=Um(n.src),(a=e.querySelector(Wm(o)))?(t.instance=a,Ft(a),a):(r=n,(a=Cm.get(o))&&(r=D({},n),Jm(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ft(a),lp(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,Km(r,n.precedence,e));return t.instance}function Km(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 qm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Jm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Ym=null;function Xm(e,t,n){if(Ym===null){var r=new Map,i=Ym=new Map;i.set(n,r)}else i=Ym,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[Ot]||a[xt]||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 Zm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Qm(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 $m(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function eh(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function th(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function nh(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=th(t),e.suspenseyImages.push(t)),e=ch.bind(e),t.decode().then(e,e))}function rh(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=zm(r.href),a=t.querySelector(Bm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=sh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ft(a);return}a=t.ownerDocument||t,r=Vm(r),(i=Cm.get(i))&&qm(r,i),a=a.createElement(`link`),Ft(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),lp(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=sh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ih=0;function ah(e,t){return e.stylesheets&&e.count===0&&uh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&uh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ih===0&&(ih=62500*pp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&uh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ih?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function oh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)uh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function sh(){this.count--,oh(this)}function ch(){this.imgCount--,oh(this)}var lh=null;function uh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,lh=new Map,t.forEach(dh,e),lh=null,sh.call(e))}function dh(e,t){if(!(t.state.loading&4)){var n=lh.get(e);if(n)var r=n.get(null);else{n=new Map,lh.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=sh.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 fh={$$typeof:P,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function ph(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=ut(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ut(0),this.hiddenUpdates=ut(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function mh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ph(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Mi(3,null,null,t),e.current=a,a.stateNode=e,t=Na(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},go(a),e}function hh(e){return e?(e=Ai,e):Ai}function gh(e,t,n,r,i,a){i=hh(i),r.context===null?r.context=i:r.pendingContext=i,r=vo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=yo(e,r,t),n!==null&&(zd(n,e,t),bo(n,e,t))}function _h(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function vh(e,t){_h(e,t),(e=e.alternate)&&_h(e,t)}function yh(e){if(e.tag===13||e.tag===31){var t=Di(e,67108864);t!==null&&zd(t,e,67108864),vh(e,67108864)}}function bh(e){if(e.tag===13||e.tag===31){var t=Id();t=gt(t);var n=Di(e,t);n!==null&&zd(n,e,t),vh(e,t)}}var xh=!0;function Sh(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,wh(e,t,n,r)}finally{L.p=a,I.T=i}}function Ch(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,wh(e,t,n,r)}finally{L.p=a,I.T=i}}function wh(e,t,n,r){if(xh){var i=Th(r);if(i===null)$f(e,t,r,Eh,n),Lh(e,r);else if(Rh(i,e,t,n,r))r.stopPropagation();else if(Lh(e,r),t&4&&-1<Ih.indexOf(e)){for(;i!==null;){var a=Mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=it(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ze(o);s.entanglements[1]|=c,o&=~c}Mf(a),!(td&6)&&(xd=Be()+500,Nf(0,!1))}}break;case 31:case 13:s=Di(a,2),s!==null&&zd(s,a,2),Wd(),vh(a,2)}if(a=Th(r),a===null&&$f(e,t,r,Eh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else $f(e,t,r,null,n)}}function Th(e){return e=bn(e),Dh(e)}var Eh=null;function Dh(e){if(Eh=null,e=jt(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 Eh=e,null}function Oh(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`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`fullscreenerror`: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`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ve()){case He:return 2;case Ue:return 8;case We:case Ge:return 32;case Ke:return 268435456;default:return 32}default:return 32}}var kh=!1,Ah=null,jh=null,Mh=null,Nh=new Map,Ph=new Map,Fh=[],Ih=`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 Lh(e,t){switch(e){case`focusin`:case`focusout`:Ah=null;break;case`dragenter`:case`dragleave`:jh=null;break;case`mouseover`:case`mouseout`:Mh=null;break;case`pointerover`:case`pointerout`:Nh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ph.delete(t.pointerId)}}function Y(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=Mt(t),t!==null&&yh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Rh(e,t,n,r,i){switch(t){case`focusin`:return Ah=Y(Ah,e,t,n,r,i),!0;case`dragenter`:return jh=Y(jh,e,t,n,r,i),!0;case`mouseover`:return Mh=Y(Mh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Nh.set(a,Y(Nh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ph.set(a,Y(Ph.get(a)||null,e,t,n,r,i)),!0}return!1}function zh(e){var t=jt(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,yt(e.priority,function(){bh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,yt(e.priority,function(){bh(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 Bh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Th(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);yn=r,n.target.dispatchEvent(r),yn=null}else return t=Mt(n),t!==null&&yh(t),e.blockedOn=n,!1;t.shift()}return!0}function Vh(e,t,n){Bh(e)&&n.delete(t)}function Hh(){kh=!1,Ah!==null&&Bh(Ah)&&(Ah=null),jh!==null&&Bh(jh)&&(jh=null),Mh!==null&&Bh(Mh)&&(Mh=null),Nh.forEach(Vh),Ph.forEach(Vh)}function Uh(e,n){e.blockedOn===n&&(e.blockedOn=null,kh||(kh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Hh)))}var Wh=null;function Gh(e){Wh!==e&&(Wh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Wh===e&&(Wh=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(Dh(r||n)===null)continue;break}var a=Mt(n);a!==null&&(e.splice(t,3),t-=3,$s(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Kh(e){function t(t){return Uh(t,e)}Ah!==null&&Uh(Ah,e),jh!==null&&Uh(jh,e),Mh!==null&&Uh(Mh,e),Nh.forEach(t),Ph.forEach(t);for(var n=0;n<Fh.length;n++){var r=Fh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Fh.length&&(n=Fh[0],n.blockedOn===null);)zh(n),n.blockedOn===null&&Fh.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||Gh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[St]||null)s=o.formAction;else if(Dh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Gh(n)}}}function qh(){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 Jh(e){this._internalRoot=e}Yh.prototype.render=Jh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;gh(n,Id(),e,t,null,null)},Yh.prototype.unmount=Jh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;gh(e.current,2,null,e,null,null),Wd(),t[Ct]=null}};function Yh(e){this._internalRoot=e}Yh.prototype.unstable_scheduleHydration=function(e){if(e){var t=vt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Fh.length&&t!==0&&t<Fh[n].priority;n++);Fh.splice(n,0,e),n===0&&zh(e)}};var Xh=n.version;if(Xh!==`19.3.1`)throw Error(i(527,Xh,`19.3.1`));L.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 Zh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Qh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qh.isDisabled&&Qh.supportsFiber)try{Je=Qh.inject(Zh),Ye=Qh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Sc,s=Cc,c=wc;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=mh(e,1,!1,null,null,n,r,null,o,s,c,qh),e[Ct]=t.current,Zf(e),new Jh(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={app:`_app_8kl1w_1`,main:`_main_8kl1w_7`},b={appName:`sfbench`,loadingOrgs:`Loading the orgs from the sf CLI…`,selectOrg:`Select an org`,selectOrgFirst:`Choose an org from the org switcher at the top right to start.`,findOrg:`Find by alias or username`,noOrgs:`No orgs. Log in to an org with the sf CLI:`,addOrg:`Add an org with the sf CLI, then reopen this list:`,noDefaultOrg:"No default org is set in the sf CLI. Pick one to start. Next time, start with `npx sfbench -o <alias>` or set a default with `sf config set target-org <alias>`.",unknownLaunchOrg:e=>`The sf CLI has no org named ${e}. Pick one from the list.`,salesforceTimeout:`Salesforce did not respond in time. It may still have processed the request. You can wait longer in the settings.`,salesforceUnreachable:`The connection to Salesforce broke while sending the request. Salesforce may already have processed it, so sfbench did not send it again. Check the result in Salesforce.`,notRun:`sfbench could not write its history or temporary file in ~/.sfbench, so the code was not run. Check the disk space and permissions.`,orgAuthError:`Session expired. Log in again from a terminal:`,openOrg:`Open the org in your browser, logged in`,openingOrg:`Opening…`,documentation:`Documentation`,licenses:`Licenses`,settings:`Settings`,production:`PRODUCTION`,apiUsage:(e,t)=>`API ${e} / ${t}`,copy:`Copy`,copied:`Copied`,cancel:`Cancel`,save:`Save`,close:`Close`,settingsSoql:`SOQL`,settingsOmitNamespace:`Omit the org's namespace prefix`,settingsOmitNamespaceNote:`Write Invoice__c instead of acme__Invoice__c in orgs with a namespace. Applies to all orgs.`,settingsAi:`AI`,aiOff:`AI is off.`,aiEditorTooLong:`The editor text is too long to send to the AI. Turn off "Editor text" and try again.`,aiQueryTooLong:`The query is too long to send to the AI.`,aiRequestTooLong:`The request is too long to send to the AI. Shorten it and try again.`,aiSetUp:`Set up AI`,aiSetUpNote:`Choose an AI and enter its model and API key in the settings.`,aiPlaceholder:`Describe the query, e.g. opportunities won this month, largest first`,aiRequestLabel:`Request to the AI`,aiGenerate:`Generate`,aiSends:`Sends:`,aiEditorChip:`Editor text`,aiOpenObjectHint:e=>`Tells the AI that ${e} is open, as a hint for which objects to use`,aiDiffStale:`The editor has changed, so no differences are shown.`,aiThinking:`Thinking…`,aiSendMetadata:`The org's metadata (read by the AI as it needs)`,aiSendCurrentRequest:`The request now`,aiSendCurrentCode:`The code now`,aiSendPrevious:`The last result`,aiSendPreviousHint:`Sends the result of the last run. It can hold record values.`,aiUseResult:`Use this result with AI`,aiUsingResult:`✓ This result goes to the AI`,aiPreviousPlaceholder:`Write what to do with this result (e.g. update the record of this Id)`,aiSendError:`The error`,aiRestPlaceholder:`Write what to do (e.g. create an account, see the API usage)`,aiApexPlaceholder:`Write what to do (e.g. change all Hot accounts' rating to Warm)`,aiFixRequest:`The request to fix`,aiProposalRequest:`Proposed request`,aiProposal:`Proposal from the AI`,aiDiscard:`Discard`,aiReplace:`Replace`,aiReplaceRun:`Replace & Run`,aiFix:`Fix with AI`,aiProviderName:{off:`Off`,anthropic:`Anthropic`,openai:`OpenAI`},aiModel:`Model ID`,aiModelList:`List of model IDs`,aiModelRequired:`Enter the model ID.`,aiKey:`API key`,aiKeySaved:`Saved`,aiKeyClear:`Remove key`,aiKeyOtherProvider:`The saved key is for another provider and is removed when you save. Enter a key for this provider.`,aiTest:`Test connection`,aiTesting:`Testing…`,aiTestOk:e=>`Connected (${e} s).`,aiNoteOff:`sfbench calls the AI only when you press Generate or Fix with AI. Off hides everything about AI.`,aiNoteCost:`Each call is charged by the provider to your API key.`,aiNoteSent:`Sent to the AI: names, labels and types of objects and fields, picklist values, the editor text (including values in conditions) and error messages. SOQL results are never sent. A REST API response or an Apex result is sent only when you press "Use this result with AI".`,aiNoteKey:`The key is saved in ~/.sfbench/settings.json on this computer, readable by you only, and never shown in the browser.`,aiNoteTest:`Test connection sends a short request with the settings above (unsaved), in which the AI calls a tool, as it does on every screen. It costs a few tokens.`,settingsConnection:`Connection`,settingsTimeout:`Wait for Salesforce (seconds)`,settingsTimeoutNote:(e,t)=>`From ${e} to ${t}. Raise it for long queries or large describe results.`,settingsTimeoutInvalid:(e,t)=>`Enter a whole number from ${e} to ${t}.`,expired:`expired`,expires:e=>`Expires ${e}`,sessionLost:"sfbench cannot be reached. Run `npx sfbench` to open it again.",launchExpired:"This URL has expired or was already used. Run `npx sfbench` to open sfbench again.",noSession:"Run `npx sfbench` to open sfbench.",sfNotFound:"The Salesforce CLI (sf) was not found. Install it, then run `npx sfbench` again.",installSf:`How to install the Salesforce CLI`,needsLogin:e=>`Orgs that need a new login (${e})`,checkConnections:`Check connections again`,checkingConnections:`Checking the connection to each org…`,cannotParseSoql:`The SOQL cannot be parsed, so it cannot be changed from the field list.`,editorPlaceholder:`SELECT Id FROM … Pick an object on the left, or type a query.`,editorLabel:`SOQL editor`,sObjects:`Objects`,filterObjects:`Filter by label or API name`,noMatchingObjects:`No matching objects`,reloadObjects:`Reload the objects from the org`,reloadFields:`Reload the fields from the org`,loadedAt:e=>`loaded ${e}`,fieldCount:e=>`${e} fields`,backToObjects:`Back to the objects`,fieldsTab:`Fields`,childRelationshipsTab:`Child Relationships`,filterFields:`Filter by label or API name`,clearFilter:`Clear filter`,fieldMenu:`Field actions`,selectAllFields:`Select all fields`,clearAllFields:`Clear all fields`,sortAsc:`Sort by API name (A to Z)`,sortDesc:`Sort by API name (Z to A)`,expandReference:`Show the fields of this reference`,collapseReference:`Hide the fields of this reference`,expandRelationship:`Show the fields of this child relationship`,collapseRelationship:`Hide the fields of this child relationship`,maxDepth:`A query can follow at most five levels of parent relationships.`,noMatchingFields:`No matching fields`,noChildRelationships:`No matching child relationships`,loadFailed:`Could not load.`,loading:`Loading…`,run:`Run`,queryAll:`Query All`,queryAllTitle:`Also return deleted and archived records`,tooling:`Tooling API`,format:`Format`,recent:`Recent`,recentEmpty:`Queries you run in this org show up here.`,running:`Running…`,runningQuery:`Running the query…`,cancelRunNote:`Processing that already started in Salesforce is not stopped.`,results:`Results`,hideObjects:`Hide the object list`,showObjects:`Show the object list`,hideEditor:`Hide editor`,showEditor:`Show editor`,hideRecent:`Hide recent queries`,showRecent:`Show recent queries`,noResults:`Run a query to see records here. Press ⌘↵ / Ctrl+Enter in the editor.`,recordCount:e=>`${e.toLocaleString()} records`,elapsed:e=>`${e} s`,loadedCount:e=>`${e.toLocaleString()} loaded`,matchedCount:e=>`${e.toLocaleString()} matching`,filterRows:`Filter loaded rows`,loadMore:e=>`Load the next ${e.toLocaleString()}`,loadingMore:`Loading more…`,loadMoreFailed:`Could not load more records.`,locatorExpired:`The rest of this result is no longer available (it expires after a while). Run the query again.`,openChildRecords:`Show these child records`,childRecordsTitle:(e,t)=>`${e} of row ${t}`,childFirstPageOnly:`First page only`,exportCsv:`Export CSV`,csvConfirm:(e,t)=>`Loads ${e.toLocaleString()} more records with ${t.toLocaleString()} API calls.`,csvContinue:`Continue`,csvProgress:(e,t)=>`CSV: ${e.toLocaleString()} / ${t.toLocaleString()}`,modeSoql:`SOQL`,modeRest:`REST API`,modes:`Screens`,restHistory:`History`,showRestHistory:`Show the history`,hideRestHistory:`Hide the history`,showRestRequest:`Show the request`,hideRestRequest:`Hide the request`,restHistoryEmpty:`No requests sent yet.`,reloadRestHistory:`Load the history again`,restRequest:`REST API request`,restMethod:`Method`,restPath:`Path`,restPathPlaceholder:`/services/data/v62.0/sobjects/Account`,restNoPath:`No path yet`,restSend:`Send`,restSending:`Sending…`,restBody:`Body`,restHeaders:`Headers`,restAddHeader:`Add a header`,restHeaderName:`Header name`,restHeaderValue:`Header value`,restRemoveHeader:e=>`Remove ${e||`this header`}`,restFormat:`Format`,restCannotFormat:`The body is not JSON, so it cannot be formatted.`,restNoBody:e=>`A ${e} request sends no body.`,restBodyLabel:`Request body`,restResponse:`Response`,restNotSent:`Not sent yet. The status, time, headers and body appear here after you press Send.`,restSentRequest:(e,t)=>`${e} ${t}`,restSize:e=>`${e}`,restCopy:`Copy`,restCopied:`Copied`,restBodyEmpty:`No body.`,restBodyBinary:`The body is not text, so it is not shown.`,restBodyTooLarge:`The body is over 20 MB, so it is not shown.`,restBodyIncomplete:`The body stopped arriving. Salesforce has processed the request.`,restBodyCut:`The body is large: only its first 200 KB is shown, unformatted. Copy takes the whole of it.`,restUnknown:`Salesforce may already have processed the request. Check in Salesforce or in the history before you send it again.`,restWaiting:e=>`This request may change data, so it waits for the answer (up to ${e} seconds).`,restCancelNote:`Cancel does not stop what Salesforce has started.`,restModEnterHint:`Requests are sent with the Send button only.`,restLaunchNotice:`Filled in from the command line. This request may change data, so it was not sent. Check it, then press Send.`,restLeftOut:e=>`The REST API request from the command line was for the org ${e}, so it was not put in.`,restConfirmTitle:`Send this request?`,restConfirmProduction:(e,t)=>`This runs ${t} in the production org ${e}.`,restConfirmUnknown:`The outcome of the last time this request was sent is not known. Check in Salesforce before you send it.`,restConfirmNoHistory:`The history has not been loaded, so whether this request was sent before with an unknown outcome cannot be told.`,restConfirmSend:`Send`,restPendingShort:`Waiting`,restUnknownShort:`Unknown`,apiVersion:`API`,apiVersionLabel:`API version`,apiVersionLatest:e=>`Latest (${e})`,apiVersionLatestUnknown:`Latest`,apiVersionChip:e=>`API ${e}`,modeApex:`Apex`,apexEditor:`Apex code`,apexEditorLabel:`Anonymous Apex`,apexPlaceholder:`System.debug('Hello');`,apexRun:`Run`,apexRunning:`Running…`,apexModEnterHint:`Apex runs with the Run button only.`,apexNoCode:`No code yet`,apexTooLong:e=>`Anonymous Apex can be at most ${e} characters.`,apexHistory:`History`,showApexHistory:`Show the history`,hideApexHistory:`Hide the history`,showApexEditor:`Show the code`,hideApexEditor:`Hide the code`,apexHistoryEmpty:`No code has been run yet.`,reloadApexHistory:`Reload the history`,apexResult:`Result`,apexNotRun:`Not run yet. Run the code to see its result and debug log here.`,apexSuccess:`Success`,apexCompileError:`Compile error`,apexRuntimeError:`Exception`,apexPendingShort:`Waiting`,apexUnknownShort:`Unknown`,apexRunningNote:e=>`Running. It cannot be cancelled (up to ${e} s).`,apexPosition:(e,t)=>t?`Line ${e}, column ${t}`:`Line ${e}`,apexGoTo:e=>`Go to ${e} in the code`,apexCodeChanged:`The code has changed since it was run.`,apexSideEffects:`Even though it ended with an exception, what already reached other systems (callouts, for example) is not undone.`,apexStackTrace:`Stack trace`,apexLog:`Debug log`,apexLogSearch:`Search the log`,apexSearchPrevious:`Previous match`,apexSearchNext:`Next match`,apexMatches:(e,t,n)=>t===0?`No match`:`${e}/${t}${n?`+`:``}`,apexUserDebugOnly:`USER_DEBUG only`,apexNoUserDebug:`No USER_DEBUG lines. What System.debug writes shows here.`,apexLogEmpty:`No debug log.`,apexLogTooLarge:`The debug log is over 20 MB, so it is not shown.`,apexDownload:`Download`,apexUnknown:`Salesforce may have run it. Check in Salesforce or the history before running it again.`,apexLaunchNotice:`Put in from the command line. It may change data, so it was not run. Check it, then press Run.`,apexLeftOut:e=>`The Apex from the command line was for the org ${e}, so it was not put in.`,apexConfirmTitle:`Run anonymous Apex?`,apexConfirmProduction:e=>`This runs anonymous Apex in the production org ${e}.`,apexConfirmUnknown:`The outcome of the last run of the same code is not known. Check in Salesforce before running it.`,apexConfirmNoHistory:`The history has not been loaded, so the outcome of earlier runs cannot be checked.`,apexConfirmOtherPending:`Another run is still waiting for its answer. Check its outcome before running.`,apexConfirmRun:`Run`,cellChanged:` (changed, not saved)`,editToggle:`Edit`,editTooling:`Tooling API results cannot be edited.`,editAggregate:`Aggregate results cannot be edited.`,editNoId:`Select Id in the query to edit the rows.`,editEmpty:`There are no records to edit.`,editLoadingFields:`Loading the fields that can be edited…`,editFieldsFailed:`The fields that can be edited could not be loaded.`,editRounded:`This number has too many digits to edit here: it was rounded when it was read.`,editCell:e=>`Edit ${e}`,picklistNone:`(none)`,selectRow:`Select this row`,selectAllRows:`Select all rows shown`,saveChanges:e=>`Save ${e} changed ${e===1?`row`:`rows`}`,discardChanges:`Undo changes`,deleteRows:e=>`Delete ${e}`,allOrNone:`Undo all if one fails`,allOrNoneTooMany:`Undo all if one fails works for up to 200 rows at a time.`,savingRows:(e,t)=>`Saving (${e}/${t})`,deletingRows:(e,t)=>`Deleting (${e}/${t})`,editsSending:`Records are being saved or deleted. Wait until that ends.`,savedRows:(e,t)=>t?`Saved ${e}. ${t} failed: see the marked rows.`:`Saved ${e}.`,deletedRows:(e,t)=>t?`Deleted ${e}. ${t} failed: see the marked rows.`:`Deleted ${e}.`,editsUnknown:`The outcome is not known. Run the query again to check the records.`,editsStopped:`Stopped. The rows not sent keep their changes.`,rowError:`This row failed`,rolledBack:`Undone because another row failed.`,confirmSaveTitle:`Save the changes?`,confirmSaveProduction:(e,t,n)=>`This updates ${n} ${t} records in the production org ${e}.`,confirmSave:`Save`,confirmDeleteTitle:`Delete the records?`,confirmDelete:(e,t)=>`This deletes ${t} ${e} records. They go to the Recycle Bin.`,confirmDeleteProduction:e=>`This is the production org ${e}.`,confirmDeleteButton:`Delete`,discardTitle:`Throw away the changes?`,discardMessage:e=>`${e} ${e===1?`row has`:`rows have`} changes not saved.`,discardConfirm:`Throw away`,errorDetails:`Details`,dismiss:`Dismiss`},x={appName:`sfbench`,loadingOrgs:`sf CLI から組織の一覧を読み込んでいます…`,selectOrg:`組織を選択`,selectOrgFirst:`右上の組織の切り替えから、組織を選んでください。`,findOrg:`エイリアスかユーザー名で探す`,noOrgs:`組織がありません。sf CLI で組織にログインしてください:`,addOrg:`sf CLI で組織を追加してから、この一覧を開き直してください:`,noDefaultOrg:"sf CLI に既定の組織が設定されていません。組織を選んでください。次回からは `npx sfbench -o <alias>` で起動するか、`sf config set target-org <alias>` で既定の組織を設定できます。",unknownLaunchOrg:e=>`sf CLI に ${e} という組織はありません。一覧から選んでください。`,salesforceTimeout:`Salesforce が時間内に応答しませんでした。Salesforce の側で処理が終わっている場合があります。待つ時間は設定で延ばせます。`,salesforceUnreachable:`Salesforce への送信の途中で接続が切れました。Salesforce が処理した場合があるので、送り直していません。Salesforce で結果を確かめてください。`,notRun:`sfbench が ~/.sfbench に実行履歴か一時ファイルを書けなかったので、実行していません。ディスクの空きと権限を確かめてください。`,orgAuthError:`セッションが切れています。ターミナルでログインし直してください:`,openOrg:`ログイン済みの状態でブラウザに組織を開く`,openingOrg:`開いています…`,documentation:`ドキュメント`,licenses:`ライセンス`,settings:`設定`,production:`本番`,apiUsage:(e,t)=>`API ${e} / ${t}`,copy:`コピー`,copied:`コピーしました`,cancel:`キャンセル`,save:`保存`,close:`閉じる`,settingsSoql:`SOQL`,settingsOmitNamespace:`組織の名前空間を省く`,settingsOmitNamespaceNote:`名前空間のある組織で acme__Invoice__c の代わりに Invoice__c と書けます。全組織に効きます。`,settingsAi:`AI`,aiOff:`AI は使えません。`,aiEditorTooLong:`エディタの内容が長すぎて AI に送れません。「エディタの内容」の札を外してから、もう一度試してください。`,aiQueryTooLong:`クエリが長すぎて AI に送れません。`,aiRequestTooLong:`要望が長すぎて AI に送れません。短くしてから、もう一度試してください。`,aiSetUp:`AI を設定`,aiSetUpNote:`設定で AI を選び、モデルと API キーを入れてください。`,aiPlaceholder:`やりたいことを書く(例: 今月成約した商談を金額の大きい順に)`,aiRequestLabel:`AI への要望`,aiGenerate:`生成`,aiSends:`送る情報:`,aiEditorChip:`エディタの内容`,aiOpenObjectHint:e=>`開いている ${e} を、どのオブジェクトを使うかの手がかりとして伝えます`,aiThinking:`考えています…`,aiSendMetadata:`組織のメタデータ(必要なときに AI が読む)`,aiSendCurrentRequest:`いまの要求`,aiSendCurrentCode:`いまのコード`,aiSendPrevious:`前の結果`,aiSendPreviousHint:`直前の実行の結果を送ります。レコードの値が入ることがあります。`,aiUseResult:`この結果を使って AI に頼む`,aiUsingResult:`✓ この結果を AI に渡します`,aiPreviousPlaceholder:`この結果を使ってやりたいことを書く(例: この Id のレコードを更新する)`,aiSendError:`エラー文`,aiRestPlaceholder:`やりたいことを書く(例: 取引先を1件作る、API の使用状況を見る)`,aiApexPlaceholder:`やりたいことを書く(例: 評価が Hot の取引先を Warm に一括で変える)`,aiFixRequest:`直す要求`,aiProposalRequest:`提案された要求`,aiProposal:`AI の提案`,aiDiffStale:`エディタが変わったため、差分を出していません。`,aiDiscard:`破棄`,aiReplace:`置き換え`,aiReplaceRun:`置き換えて実行`,aiFix:`AI で直す`,aiProviderName:{off:`使わない`,anthropic:`Anthropic`,openai:`OpenAI`},aiModel:`モデル ID`,aiModelList:`モデル ID の一覧`,aiModelRequired:`モデル ID を入力してください。`,aiKey:`API キー`,aiKeySaved:`保存済み`,aiKeyClear:`キーを消す`,aiKeyOtherProvider:`保存済みのキーはほかの提供元のもので、保存すると消えます。この提供元のキーを入力してください。`,aiTest:`接続を確かめる`,aiTesting:`確かめています…`,aiTestOk:e=>`接続できました(${e} 秒)。`,aiNoteOff:`AI を呼ぶのは、「生成」か「AI で直す」を押したときだけです。「使わない」にすると、AI に関する表示をすべて隠します。`,aiNoteCost:`呼ぶたびに、API キーの持ち主に提供元の料金がかかります。`,aiNoteSent:`AI に送るのは、オブジェクトと項目の名前、ラベル、型、選択リストの値、エディタの内容(条件に書いた値を含む)、エラー文です。SOQL の結果は送りません。REST API のレスポンスと Apex の実行結果は、「この結果を使って AI に頼む」を押したときだけ送ります。`,aiNoteKey:`キーはこの PC の ~/.sfbench/settings.json に、本人だけが読める形で保存し、ブラウザには表示しません。`,aiNoteTest:`「接続を確かめる」は、上の内容(保存前のもの)で、AI がツールを呼ぶ短い要求を1回送ります。どの画面の AI もツールを呼ぶからです。数トークン分の料金がかかります。`,settingsConnection:`接続`,settingsTimeout:`Salesforce の応答を待つ時間(秒)`,settingsTimeoutNote:(e,t)=>`${e} から ${t} まで。長いクエリや大きな describe で足りないときに延ばします。`,settingsTimeoutInvalid:(e,t)=>`${e} から ${t} までの整数を入れてください。`,expired:`期限切れ`,expires:e=>`${e} まで`,sessionLost:"sfbench に接続できません。`npx sfbench` を実行して開き直してください。",launchExpired:"この URL は使えません(期限切れか使用済み)。`npx sfbench` を実行して開き直してください。",noSession:"`npx sfbench` を実行して開いてください。",sfNotFound:"Salesforce CLI(sf)が見つかりません。インストールしてから `npx sfbench` を実行し直してください。",installSf:`Salesforce CLI のインストール方法`,needsLogin:e=>`再ログインが必要な組織(${e}件)`,checkConnections:`接続を確かめ直す`,checkingConnections:`各組織への接続を確かめています…`,cannotParseSoql:`SOQL を解析できないので、項目の一覧から変更できません。`,editorPlaceholder:`SELECT Id FROM … 左の一覧からオブジェクトを選ぶか、クエリを入力してください。`,editorLabel:`SOQL エディタ`,sObjects:`オブジェクト`,filterObjects:`ラベルか API 名で絞り込む`,noMatchingObjects:`一致するオブジェクトはありません`,reloadObjects:`組織からオブジェクトの一覧を読み込み直す`,reloadFields:`組織から項目を読み込み直す`,loadedAt:e=>`${e} に読み込み`,fieldCount:e=>`${e} 項目`,backToObjects:`オブジェクトの一覧に戻る`,fieldsTab:`項目`,childRelationshipsTab:`子リレーション`,filterFields:`ラベルか API 名で絞り込む`,clearFilter:`絞り込みを消す`,fieldMenu:`項目の操作`,selectAllFields:`すべての項目を選ぶ`,clearAllFields:`すべての選択を外す`,sortAsc:`API 名の昇順`,sortDesc:`API 名の降順`,expandReference:`この参照先の項目を表示する`,collapseReference:`この参照先の項目を隠す`,expandRelationship:`この子リレーションの項目を表示する`,collapseRelationship:`この子リレーションの項目を隠す`,maxDepth:`親リレーションは5階層までしかたどれません。`,noMatchingFields:`一致する項目はありません`,noChildRelationships:`一致する子リレーションはありません`,loadFailed:`読み込めませんでした。`,loading:`読み込んでいます…`,run:`実行`,queryAll:`Query All`,queryAllTitle:`削除済みとアーカイブ済みのレコードも返す`,tooling:`Tooling API`,format:`整形`,recent:`最近のクエリ`,recentEmpty:`この組織で実行したクエリがここに表示されます。`,running:`実行中…`,runningQuery:`クエリを実行しています…`,cancelRunNote:`Salesforce の側で始まった処理までは止まりません。`,results:`結果`,loadedCount:e=>`${e.toLocaleString()} 件を読み込み済み`,matchedCount:e=>`${e.toLocaleString()} 件が一致`,filterRows:`読み込んだ行を絞り込む`,loadMore:e=>`次の ${e.toLocaleString()} 件を読み込む`,loadingMore:`続きを読み込んでいます…`,loadMoreFailed:`続きを読み込めませんでした。`,locatorExpired:`この結果の続きは、時間が経って取得できなくなりました。もう一度実行してください。`,openChildRecords:`子レコードを表示`,childRecordsTitle:(e,t)=>`${t} 行目の ${e}`,childFirstPageOnly:`最初のページのみ`,exportCsv:`CSV を出力`,csvConfirm:(e,t)=>`残り ${e.toLocaleString()} 件を、API を ${t.toLocaleString()} 回呼んで取得します。`,csvContinue:`続ける`,csvProgress:(e,t)=>`CSV: ${e.toLocaleString()} / ${t.toLocaleString()} 件`,hideObjects:`オブジェクトの一覧を隠す`,showObjects:`オブジェクトの一覧を表示`,hideEditor:`エディタを隠す`,showEditor:`エディタを表示`,hideRecent:`最近のクエリを隠す`,showRecent:`最近のクエリを表示`,noResults:`クエリを実行すると、ここにレコードが表示されます。エディタで ⌘↵ / Ctrl+Enter でも実行できます。`,recordCount:e=>`${e.toLocaleString()} 件`,elapsed:e=>`${e} 秒`,modeSoql:`SOQL`,modeRest:`REST API`,modes:`画面`,restHistory:`実行履歴`,showRestHistory:`実行履歴を表示`,hideRestHistory:`実行履歴を隠す`,showRestRequest:`要求の欄を表示`,hideRestRequest:`要求の欄を隠す`,restHistoryEmpty:`まだ送った要求はありません。`,reloadRestHistory:`実行履歴を読み込み直す`,restRequest:`REST API の要求`,restMethod:`メソッド`,restPath:`パス`,restPathPlaceholder:`/services/data/v62.0/sobjects/Account`,restNoPath:`パスが入っていません`,restSend:`送信`,restSending:`送信しています…`,restBody:`ボディ`,restHeaders:`ヘッダー`,restAddHeader:`ヘッダーを足す`,restHeaderName:`ヘッダーの名前`,restHeaderValue:`ヘッダーの値`,restRemoveHeader:e=>`${e||`このヘッダー`}を外す`,restFormat:`整形`,restCannotFormat:`ボディが JSON ではないので、整形できません。`,restNoBody:e=>`${e} の要求はボディを送りません。`,restBodyLabel:`要求のボディ`,restResponse:`レスポンス`,restNotSent:`まだ送っていません。送信すると、ステータス、所要時間、ヘッダー、本文がここに出ます。`,restSentRequest:(e,t)=>`${e} ${t}`,restSize:e=>`${e}`,restCopy:`コピー`,restCopied:`コピーしました`,restBodyEmpty:`本文はありません。`,restBodyBinary:`テキストでない本文なので、表示していません。`,restBodyTooLarge:`本文が 20 MB を超えるので、表示していません。`,restBodyIncomplete:`本文の受け取りが途中で止まりました。Salesforce は要求を処理しています。`,restBodyCut:`本文が大きいので、整形せずに先頭の 200 KB だけを表示しています。全体はコピーで取り出せます。`,restUnknown:`Salesforce の側で処理が終わっている場合があります。Salesforce か実行履歴で確かめてから送り直してください。`,restWaiting:e=>`データを変えうる要求なので、応答まで待ちます(最長 ${e} 秒)。`,restCancelNote:`キャンセルしても、Salesforce の側の処理は止まりません。`,restModEnterHint:`REST API の要求は送信ボタンで送ります。`,restLaunchNotice:`コマンドラインから入力しました。データを変更しうるので、送信していません。確かめてから送信を押してください。`,restLeftOut:e=>`コマンドラインの REST API の要求は ${e} の組織用なので、入れていません。`,restConfirmTitle:`送信の確認`,restConfirmProduction:(e,t)=>`本番の組織 ${e} で ${t} を実行します。`,restConfirmUnknown:`同じ要求の前の送信は、結果が分かっていません。Salesforce で確かめてから送ってください。`,restConfirmNoHistory:`実行履歴を読み込めていないので、同じ要求を前に送った結果を確かめられません。`,restConfirmSend:`送信する`,restPendingShort:`応答待ち`,restUnknownShort:`不明`,apiVersion:`API`,apiVersionLabel:`API バージョン`,apiVersionLatest:e=>`最新(${e})`,apiVersionLatestUnknown:`最新`,apiVersionChip:e=>`API ${e}`,modeApex:`Apex`,apexEditor:`Apex のコード`,apexEditorLabel:`匿名 Apex`,apexPlaceholder:`System.debug('Hello');`,apexRun:`実行`,apexRunning:`実行しています…`,apexModEnterHint:`Apex は実行ボタンで実行します。`,apexNoCode:`コードが入っていません`,apexTooLong:e=>`匿名 Apex は ${e} 文字までです。`,apexHistory:`実行履歴`,showApexHistory:`実行履歴を表示`,hideApexHistory:`実行履歴を隠す`,showApexEditor:`コードの欄を表示`,hideApexEditor:`コードの欄を隠す`,apexHistoryEmpty:`まだ実行したコードはありません。`,reloadApexHistory:`実行履歴を読み込み直す`,apexResult:`実行結果`,apexNotRun:`まだ実行していません。実行すると、結果とデバッグログがここに出ます。`,apexSuccess:`成功`,apexCompileError:`コンパイルエラー`,apexRuntimeError:`例外`,apexPendingShort:`応答待ち`,apexUnknownShort:`不明`,apexRunningNote:e=>`実行しています。取り消せません(最長 ${e} 秒)。`,apexPosition:(e,t)=>t?`${e}行目 ${t}列`:`${e}行目`,apexGoTo:e=>`コードの${e}へ移る`,apexCodeChanged:`実行したあとでコードが変わっています。`,apexSideEffects:`例外で終わっても、すでに行ったコールアウトなど、外部への影響は戻りません。`,apexStackTrace:`スタックトレース`,apexLog:`デバッグログ`,apexLogSearch:`ログを検索`,apexSearchPrevious:`前の一致`,apexSearchNext:`次の一致`,apexMatches:(e,t,n)=>t===0?`一致なし`:`${e}/${t}${n?`+`:``}`,apexUserDebugOnly:`USER_DEBUG だけ`,apexNoUserDebug:`USER_DEBUG の行はありません。System.debug の出力がここに出ます。`,apexLogEmpty:`デバッグログはありません。`,apexLogTooLarge:`デバッグログが 20 MB を超えるので、表示していません。`,apexDownload:`ダウンロード`,apexUnknown:`Salesforce の側で実行が終わっている場合があります。Salesforce か実行履歴で確かめてから実行し直してください。`,apexLaunchNotice:`コマンドラインから入力しました。データを変更しうるので、実行していません。確かめてから実行を押してください。`,apexLeftOut:e=>`コマンドラインの Apex は ${e} の組織用なので、入れていません。`,apexConfirmTitle:`実行の確認`,apexConfirmProduction:e=>`本番の組織 ${e} で匿名 Apex を実行します。`,apexConfirmUnknown:`同じコードの前の実行は、結果が分かっていません。Salesforce で確かめてから実行してください。`,apexConfirmNoHistory:`実行履歴を読み込めていないので、前の実行の結果を確かめられません。`,apexConfirmOtherPending:`別の実行が、まだ応答を待っています。その結果を確かめてから実行してください。`,apexConfirmRun:`実行する`,cellChanged:`(変更あり、未保存)`,editToggle:`編集`,editTooling:`Tooling API の結果は編集できません。`,editAggregate:`集計の結果は編集できません。`,editNoId:`クエリで Id を SELECT すると編集できます。`,editEmpty:`編集するレコードがありません。`,editLoadingFields:`編集できる項目を読み込んでいます…`,editFieldsFailed:`編集できる項目を読み込めませんでした。`,editRounded:`桁が多い数値は、読み込んだときに丸まっているので、ここでは編集できません。`,editCell:e=>`${e} を編集`,picklistNone:`(なし)`,selectRow:`この行を選ぶ`,selectAllRows:`表示している行をすべて選ぶ`,saveChanges:e=>`${e}件の変更を保存`,discardChanges:`変更を取り消す`,deleteRows:e=>`${e}件を削除`,allOrNone:`1件でも失敗したら全部取り消す`,allOrNoneTooMany:`「1件でも失敗したら全部取り消す」は、200件までのときだけ使えます。`,savingRows:(e,t)=>`保存しています(${e}/${t}件)`,deletingRows:(e,t)=>`削除しています(${e}/${t}件)`,editsSending:`保存か削除を送っています。終わるまで待ってください。`,savedRows:(e,t)=>t?`${e}件を保存しました。${t}件は失敗しました(印のある行)。`:`${e}件を保存しました。`,deletedRows:(e,t)=>t?`${e}件を削除しました。${t}件は失敗しました(印のある行)。`:`${e}件を削除しました。`,editsUnknown:`結果が分かりません。クエリを実行し直して、レコードを確かめてください。`,editsStopped:`途中で止まりました。送っていない行は、変更を残しています。`,rowError:`この行は失敗しました`,rolledBack:`ほかの行の失敗で取り消しました。`,confirmSaveTitle:`保存の確認`,confirmSaveProduction:(e,t,n)=>`本番の組織 ${e} の ${t} の ${n}件を更新します。`,confirmSave:`保存する`,confirmDeleteTitle:`削除の確認`,confirmDelete:(e,t)=>`${e} の ${t}件を削除します。削除したレコードはごみ箱に入ります。`,confirmDeleteProduction:e=>`本番の組織 ${e} です。`,confirmDeleteButton:`削除する`,discardTitle:`変更を捨てる`,discardMessage:e=>`保存していない変更が${e}件あります。捨てますか。`,discardConfirm:`捨てる`,errorDetails:`詳細`,dismiss:`閉じる`};function S(e){return e?.toLowerCase().startsWith(`ja`)?x:b}var C=S(typeof navigator>`u`?void 0:navigator.language),w=C===x?`ja`:`en`,T=`sfbench.session`;function E(){try{return sessionStorage.getItem(T)??void 0}catch{return}}function D(e){try{sessionStorage.setItem(T,e)}catch{}O=e}var O,k=class extends Error{status;code;body;constructor(e,t,n,r){super(n),this.name=`ApiRequestError`,this.status=e,this.code=t,this.body=r}get isSessionRefused(){return this.status===401&&this.code===`UNAUTHORIZED`}get isSessionLost(){return this.isSessionRefused||this.code===`NETWORK_ERROR`}};async function A(e,t,n,r){let i=O??E(),a;try{a=await fetch(t,{method:e,headers:{...i?{"X-Sfbench-Session":i}:{},...n===void 0?{}:{"Content-Type":`application/json`}},body:n===void 0?void 0:JSON.stringify(n),signal:r})}catch(e){throw r?.aborted||e.name===`AbortError`?new k(0,`ABORTED`,`Aborted`):new k(0,`NETWORK_ERROR`,`Could not reach the sfbench server.`)}let o=await a.json().catch(e=>{if(e.name===`AbortError`)throw new k(0,`ABORTED`,`Aborted`)});if(r?.aborted)throw new k(0,`ABORTED`,`Aborted`);if(!a.ok){let e=o?.error;throw new k(a.status,e?.code??`INTERNAL_ERROR`,e?.message??`HTTP ${a.status}`,e)}return o}var j=e=>`/api/orgs/${encodeURIComponent(e)}`,M=(e,t)=>t?`${e}=1`:``,ee=e=>e?`version=${encodeURIComponent(e)}`:``,N=(...e)=>{let t=e.filter(Boolean).join(`&`);return t?`?${t}`:``},P={async exchangeLaunchCode(e){let t=await A(`POST`,`/api/session`,{code:e});return D(t.sessionToken),t},orgs:(e=!1,t=!1,n)=>A(`GET`,`/api/orgs${N(M(`refresh`,e),M(`waitForCheck`,t))}`,void 0,n),checkConnections:e=>A(`POST`,`/api/orgs/check`,void 0,e),summary:(e,t)=>A(`GET`,`${j(e)}/summary`,void 0,t),sobjects:(e,t,n,r=!1)=>A(`GET`,`${j(e)}/sobjects${N(M(`tooling`,t),ee(n),M(`refresh`,r))}`),describe:(e,t,n,r,i=!1)=>A(`GET`,`${j(e)}/sobjects/${encodeURIComponent(t)}${N(M(`tooling`,n),ee(r),M(`refresh`,i))}`),recordsUpdate:(e,t,n)=>A(`POST`,`${j(e)}/records/update`,t,n),recordsDelete:(e,t,n)=>A(`POST`,`${j(e)}/records/delete`,t,n),versions:(e,t)=>A(`GET`,`${j(e)}/versions`,void 0,t),query:(e,t,n)=>A(`POST`,`${j(e)}/query`,t,n),nextPage:(e,t,n)=>A(`POST`,`${j(e)}/query/next`,{nextRecordsUrl:t},n),history:(e,t)=>A(`GET`,`${j(e)}/history`,void 0,t),openOrg:(e,t)=>A(`POST`,`${j(e)}/open`,void 0,t),settings:e=>A(`GET`,`/api/settings`,void 0,e),saveSettings:(e,t)=>A(`PUT`,`/api/settings`,e,t),aiAgent:(e,t,n)=>A(`POST`,`${j(e)}/ai/agent`,t,n),aiTest:(e,t)=>A(`POST`,`/api/ai/test`,e,t),rest:(e,t,n)=>A(`POST`,`${j(e)}/rest`,t,n),restHistory:(e,t)=>A(`GET`,`${j(e)}/rest/history`,void 0,t),apex:(e,t,n)=>A(`POST`,`${j(e)}/apex`,t,n),apexHistory:(e,t)=>A(`GET`,`${j(e)}/apex/history`,void 0,t)};function te(e){if(!(e instanceof k))return`other`;if(e.code===`ABORTED`)return`aborted`;if(e.isSessionLost)return`sessionLost`;switch(e.code){case`SF_CLI_NOT_FOUND`:return`sfNotFound`;case`ORG_AUTH_ERROR`:return`orgAuth`;case`ORG_NOT_FOUND`:return`orgNotFound`;case`SALESFORCE_ERROR`:return e.body?.status===400?`rejected`:`other`;default:return`other`}}function ne(e){return e!==`rejected`&&e!==`other`}function re(e){return e instanceof k?e.code===`SALESFORCE_TIMEOUT`?C.salesforceTimeout:e.code===`SALESFORCE_UNREACHABLE`?C.salesforceUnreachable:e.code===`ORG_AUTH_ERROR`?C.orgAuthError:e.code===`NOT_RUN`?C.notRun:e.message:e instanceof Error?e.message:String(e)}function ie(e){return e instanceof k?e.body?.details:void 0}function ae(e){return e instanceof k?e.body?.reloginCommand:void 0}function oe(e){return te(e)===`rejected`&&JSON.stringify(ie(e)??``).includes(`INVALID_QUERY_LOCATOR`)}function se(e){let t=te(e);if(t===`orgAuth`)return{message:C.orgAuthError,reloginCommand:ae(e),orgAuth:!0,rejected:!1};if(!ne(t))return{message:re(e),details:ie(e),orgAuth:!1,rejected:t===`rejected`}}function ce(e,t){if(e instanceof k&&(e.code===`SALESFORCE_TIMEOUT`||e.code===`SALESFORCE_UNREACHABLE`))return!0;let n=te(e);return n===`aborted`||n===`orgAuth`||n===`orgNotFound`||n===`sfNotFound`||n===`rejected`||e instanceof k&&(e.code===`BAD_REQUEST`||e.code===`NOT_RUN`)||e instanceof k&&e.isSessionRefused?!1:t}var le={kind:`stale`};function ue(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(),i=(0,_.useRef)({controller:void 0,gone:!1}),a=(0,_.useCallback)(()=>{i.current.controller=void 0,t(!1),r(void 0)},[]),o=(0,_.useCallback)(()=>{let{controller:e}=i.current;return e?.abort(),a(),e!==void 0},[a]),s=(0,_.useCallback)(async(e,n)=>{let s=i.current;if(s.gone||s.controller&&n===`ignore`)return le;o();let c=new AbortController;s.controller=c,t(!0);let l=()=>s.controller===c,u=e=>{l()&&r(()=>e)};try{let t=await e(c.signal,u);return l()?(a(),{kind:`done`,value:t}):le}catch(e){return l()?(a(),{kind:`error`,error:e}):le}},[o,a]);return(0,_.useLayoutEffect)(()=>{let e=i.current;return e.gone=!1,()=>{e.gone=!0,o()}},[o]),{start:s,cancel:o,running:e,progress:n}}var de=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})),F=o(((e,t)=>{t.exports=de()}))(),fe=(0,_.createContext)(void 0),pe=1,me=`sfbench.mode`;function I(){try{let e=sessionStorage.getItem(me);return e===`rest`||e===`apex`?e:`soql`}catch{return`soql`}}function L(e){try{sessionStorage.setItem(me,e)}catch{}}function R({initialMode:e,children:t}){let[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(()=>(e&&L(e),e??I())),m=(0,_.useCallback)(e=>{p(e),L(e)},[]),h=(0,_.useCallback)(e=>{s(t=>t.some(t=>t.message===e.message&&t.command===e.command)?t:[...t.slice(-4),{...e,id:pe++}])},[]),g=(0,_.useCallback)(e=>s(t=>t.filter(t=>t.id!==e)),[]),[v,y]=(0,_.useState)(!1),b=(0,_.useRef)({count:0,sending:!1}),x=(0,_.useCallback)((e,t=!1)=>{b.current={count:e,sending:t},y(e>0||t)},[]),[S,w]=(0,_.useState)(),T=(0,_.useRef)(S),E=(0,_.useCallback)(e=>{T.current=e,w(e)},[]),D=(0,_.useCallback)(e=>{b.current.sending?h({message:C.editsSending}):b.current.count>0?E({count:b.current.count,action:e}):e()},[E,h]),O=(0,_.useCallback)(()=>{let e=T.current?.action;E(void 0),e?.()},[E]),k=(0,_.useCallback)(()=>E(void 0),[E]);(0,_.useEffect)(()=>{if(!v)return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[v]);let A=(0,_.useCallback)(e=>{let t=te(e);return t===`sessionLost`&&r(!0),t===`sfNotFound`&&a(!0),t===`aborted`||t===`sessionLost`||t===`sfNotFound`},[]),j=(0,_.useCallback)(e=>{A(e)||h({message:re(e),details:ie(e)})},[A,h]),M=ue(),{start:ee}=M,N=M.progress===`save`;(0,_.useEffect)(()=>{ee(e=>P.settings(e),`ignore`).then(e=>{e.kind===`done`&&l(e.value),e.kind===`error`&&A(e.error)})},[ee,A]);let ne=(0,_.useCallback)(async e=>{let t=await ee((t,n)=>(n(`save`),P.saveSettings(e,t)),`replace`);return t.kind===`done`&&l(t.value),t.kind===`error`&&j(t.error),t.kind===`done`},[ee,j]),ae=(0,_.useMemo)(()=>S?{count:S.count}:void 0,[S]),oe=(0,_.useMemo)(()=>({settings:c,saveSettings:ne,savingSettings:N,sessionLost:n,sfNotFound:i,notifications:o,notify:h,dismiss:g,handleCommonError:A,reportError:j,mode:f,setMode:m,settingsOpen:u,setSettingsOpen:d,setUnsavedEdits:x,guardDiscard:D,discarding:ae,confirmDiscard:O,cancelDiscard:k}),[c,ne,N,n,i,o,h,g,A,j,f,m,u,x,D,ae,O,k]);return(0,F.jsx)(fe.Provider,{value:oe,children:t})}function he(){let e=(0,_.useContext)(fe);if(!e)throw Error(`useApp must be used inside AppProvider`);return e}var ge=/developer edition/i;function _e(e){return!(e.kind===`sandbox`||e.kind===`scratch`||e.edition&&ge.test(e.edition))}function ve(e,t){return t?t.isSandbox||e.kind===`scratch`?!1:!ge.test(t.organizationType):_e(e)}function ye(e,t){return e.kind===`scratch`?be(e):t?t.isSandbox?`Sandbox`:t.organizationType||be(e):e.kind===`sandbox`||e.kind===`devhub`?be(e):e.edition??be(e)}function be(e){switch(e.kind){case`sandbox`:return`Sandbox`;case`scratch`:return`Scratch`;case`devhub`:return`Dev Hub`;default:return`Production`}}function xe(e,t){return e.alias===t||e.username===t}function Se(e,t){switch(t.type){case`loaded`:return{...e,orgs:t.orgs,connectionCheck:t.connectionCheck,loadError:void 0};case`loadFailed`:return{...e,loadError:t.message};case`waitFailed`:return{...e,connectionCheck:`failed`};case`select`:{let n={...e,pickerOpen:!1,notice:void 0};if(t.username===e.selected)return n;let{launch:r}=e,i=e.orgs?.find(e=>e.username===t.username)??{username:t.username},a=r?.org!==void 0&&xe(i,r.org),o=r?.rest&&(a?{rest:r.rest}:{restLeftOutFor:r.org??``}),s=r?.apex&&(a?{apex:r.apex}:{apexLeftOutFor:r.org??``}),c=r&&{query:r.query,run:r.run&&a,...o,...s};return{...n,selected:t.username,launch:void 0,seed:c}}case`summary`:return{...e,summaries:{...e.summaries,[t.username]:t.summary}};case`status`:return{...e,status:{...e.status,[t.username]:t.status}};case`apiUsage`:return{...e,apiUsage:{...e.apiUsage,[t.username]:t.usage}};case`picker`:return{...e,pickerOpen:t.open,notice:t.open?t.notice??e.notice:void 0}}}function Ce(e){return{orgs:void 0,connectionCheck:`pending`,loadError:void 0,selected:void 0,summaries:{},status:{},apiUsage:{},pickerOpen:!1,notice:void 0,launch:e?.query||e?.rest||e?.apex?{org:e.org,query:e.query,run:e.run===!0,rest:e.rest,apex:e.apex}:void 0,seed:void 0}}var we=`sfbench.selectedOrg`,Te=(0,_.createContext)(void 0);function Ee(e,t){return new Promise((n,r)=>{if(t.aborted)return r(t.reason);let i=()=>{clearTimeout(a),r(t.reason)},a=setTimeout(()=>{t.removeEventListener(`abort`,i),n()},e);t.addEventListener(`abort`,i,{once:!0})})}function De(){try{return sessionStorage.getItem(we)??void 0}catch{return}}function Oe(e){try{sessionStorage.setItem(we,e)}catch{}}function ke({launch:e,children:t}){let{handleCommonError:n,notify:r,reportError:i}=he(),[a,o]=(0,_.useReducer)(Se,e,Ce),s=ue(),{start:c}=s,{start:l}=ue(),u=(0,_.useCallback)((e,t)=>{t&&o({type:`apiUsage`,username:e,usage:t})},[]),d=(0,_.useCallback)((e,t)=>c((n,r)=>(r(e),t(n)),`replace`),[c]),f=(0,_.useCallback)(async e=>{let t=await d(`load`,t=>P.orgs(e,!1,t));if(t.kind===`done`&&o({type:`loaded`,...t.value}),t.kind===`error`){let e=n(t.error);o({type:`loadFailed`,message:e?``:re(t.error)})}},[d,n]),p=(0,_.useCallback)((e,t)=>{if(n(t))return!0;let i=te(t);if(i===`orgAuth`){let n=ae(t);return o({type:`status`,username:e,status:{state:`authError`,reloginCommand:n}}),r({message:C.orgAuthError,command:n}),!0}return i===`orgNotFound`&&(f(!0),o({type:`picker`,open:!0}),!0)},[n,f,r]),m=(0,_.useCallback)((e,t)=>{p(e,t)||r({message:re(t),details:ie(t)})},[p,r]),h=(0,_.useCallback)((e,t)=>{o({type:`status`,username:e,status:{state:`authError`,reloginCommand:t}})},[]),g=(0,_.useCallback)(e=>{o({type:`select`,username:e}),Oe(e),l(t=>P.summary(e,t),`replace`).then(t=>{t.kind===`done`&&(o({type:`summary`,username:e,summary:t.value}),o({type:`status`,username:e,status:{state:`ok`}}),u(e,t.value.apiUsage)),t.kind===`error`&&ne(te(t.error))&&p(e,t.error)})},[l,p,u]);(0,_.useEffect)(()=>{f(!1)},[f]);let v=a.orgs!==void 0&&a.connectionCheck===`pending`&&!s.running;(0,_.useEffect)(()=>{v&&d(`wait`,async e=>{let t=await P.orgs(!1,!0,e);return t.connectionCheck===`pending`&&await Ee(2e3,e),t}).then(e=>{e.kind===`done`&&o({type:`loaded`,...e.value}),e.kind===`error`&&(n(e.error),o({type:`waitFailed`}))})},[v,d,n]);let y=(0,_.useCallback)(async()=>{let e=await d(`check`,e=>P.checkConnections(e));e.kind===`done`&&o({type:`loaded`,...e.value}),e.kind===`error`&&i(e.error)},[d,i]),b=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(b.current)return;if(a.orgs===void 0){a.loadError&&(b.current=!0,o({type:`picker`,open:!0}));return}b.current=!0;let t=e?e.org:De(),n=t?a.orgs.find(e=>xe(e,t)):void 0;if(n){g(n.username);return}let r=e?.org?C.unknownLaunchOrg(e.org):e?C.noDefaultOrg:void 0;o({type:`picker`,open:!0,notice:r})},[a.orgs,a.loadError,e,g]);let x=(0,_.useCallback)(e=>{o({type:`picker`,open:e}),e&&f(!0)},[f]),S=s.progress,w=(0,_.useMemo)(()=>{let e=a.orgs?.find(e=>e.username===a.selected),t=a.selected?a.summaries[a.selected]:void 0;return{...a,loading:S===`load`||a.orgs===void 0&&a.loadError===void 0,connectionCheck:S===`check`?`pending`:a.connectionCheck,selectedOrg:e,selectedSummary:t,isProduction:e?ve(e,t):a.selected!==void 0,recheckConnections:y,selectOrg:g,setPickerOpen:x,reportApiUsage:u,handleOrgError:p,reportOrgError:m,markAuthError:h}},[a,S,y,g,x,u,p,m,h]);return(0,F.jsx)(Te.Provider,{value:w,children:t})}function Ae(){let e=(0,_.useContext)(Te);if(!e)throw Error(`useOrgs must be used inside OrgProvider`);return e}function je(e,t){let{reportOrgError:n}=Ae();(0,_.useEffect)(()=>{t!==void 0&&n(e,t)},[e,t])}var Me={band:`_band_46r5y_1`,lost:`_lost_46r5y_9`,production:`_production_46r5y_15`};function Ne({text:e}){let t=e.split(/(`[^`]+`)/g);return(0,F.jsx)(F.Fragment,{children:t.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>1?(0,F.jsx)(`code`,{children:e.slice(1,-1)},t):(0,F.jsx)(_.Fragment,{children:e},t))})}function Pe(){let{sessionLost:e}=he(),{isProduction:t,selectedOrg:n,selected:r}=Ae();return(0,F.jsxs)(F.Fragment,{children:[e&&(0,F.jsx)(`div`,{className:`${Me.band} ${Me.lost}`,role:`alert`,children:(0,F.jsx)(Ne,{text:C.sessionLost})}),t&&r&&(0,F.jsxs)(`div`,{className:`${Me.band} ${Me.production}`,role:`status`,children:[(0,F.jsx)(`strong`,{children:C.production}),(0,F.jsx)(`span`,{children:n?.alias??r})]})]})}var Fe={dialog:`_dialog_1b3j3_2`,small:`_small_1b3j3_13`,head:`_head_1b3j3_21`,title:`_title_1b3j3_28`,section:`_section_1b3j3_34`,actions:`_actions_1b3j3_42`,button:`_button_1b3j3_50`,primary:`_primary_1b3j3_59`,message:`_message_1b3j3_72`};function Ie({title:e,message:t,confirmLabel:n,onConfirm:r,onCancel:i}){let a=(0,_.useRef)(null),o=(0,_.useId)(),s=(0,_.useId)();return(0,_.useEffect)(()=>{a.current?.showModal?.()},[]),(0,F.jsxs)(`dialog`,{ref:a,className:`${Fe.dialog} ${Fe.small}`,"aria-labelledby":o,"aria-describedby":s,onCancel:i,children:[(0,F.jsx)(`div`,{className:Fe.head,children:(0,F.jsx)(`h2`,{id:o,className:Fe.title,children:e})}),(0,F.jsx)(`p`,{id:s,className:`${Fe.section} ${Fe.message}`,children:t}),(0,F.jsxs)(`div`,{className:Fe.actions,children:[(0,F.jsx)(`button`,{type:`button`,className:Fe.button,onClick:i,children:C.cancel}),(0,F.jsx)(`button`,{type:`button`,className:`${Fe.button} ${Fe.primary}`,onClick:r,children:n})]})]})}var Le=typeof navigator<`u`&&navigator.language?.toLowerCase().startsWith(`ja`)?`https://github.com/atskimura/sfbench/blob/main/help/ja/README.md`:`https://github.com/atskimura/sfbench/blob/main/help/en/README.md`,Re=`https://github.com/atskimura/sfbench`,ze={header:`_header_1pnp1_1`,brand:`_brand_1pnp1_13`,spacer:`_spacer_1pnp1_21`,modes:`_modes_1pnp1_26`,mode:`_mode_1pnp1_26`,usage:`_usage_1pnp1_54`,iconButton:`_iconButton_1pnp1_61`};function Be({size:e=20}){return(0,F.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 20 20`,"aria-hidden":`true`,fill:`none`,stroke:`var(--color-ok)`,strokeWidth:`1.8`,strokeLinecap:`round`,children:[(0,F.jsx)(`rect`,{x:`2.5`,y:`11`,width:`15`,height:`4`,rx:`1`}),(0,F.jsx)(`path`,{d:`M5 11V6.5M15 11V6.5M3.5 6.5h13`})]})}function Ve({size:e=18}){return(0,F.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 20 20`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinejoin:`round`,children:[(0,F.jsx)(`path`,{d:`M16.11 8.11 L18.04 8.37 L18.04 11.63 L16.11 11.89 L15.66 12.99 L16.83 14.53 L14.53 16.83 L12.99 15.66 L11.89 16.11 L11.63 18.04 L8.37 18.04 L8.11 16.11 L7.01 15.66 L5.47 16.83 L3.17 14.53 L4.34 12.99 L3.89 11.89 L1.96 11.63 L1.96 8.37 L3.89 8.11 L4.34 7.01 L3.17 5.47 L5.47 3.17 L7.01 4.34 L8.11 3.89 L8.37 1.96 L11.63 1.96 L11.89 3.89 L12.99 4.34 L14.53 3.17 L16.83 5.47 L15.66 7.01 Z`}),(0,F.jsx)(`circle`,{cx:`10`,cy:`10`,r:`2.6`})]})}function He({size:e=18}){return(0,F.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 20 20`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,children:[(0,F.jsx)(`circle`,{cx:`10`,cy:`10`,r:`7.5`}),(0,F.jsx)(`path`,{d:`M7.8 7.6a2.3 2.3 0 1 1 3.2 2.1c-.7.3-1 .8-1 1.5v.4M10 14.2h.01`})]})}function Ue({size:e=18}){return(0,F.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 20 20`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,children:(0,F.jsx)(`path`,{d:`M11 3.5h5.5V9M16.5 3.5 9 11M14 12v4.5H3.5V6H8`})})}function We({size:e=12}){return(0,F.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 12 12`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,children:(0,F.jsx)(`path`,{d:`M3 4.5l3 3 3-3`})})}var Ge={command:`_command_17pli_1`,text:`_text_17pli_10`,copy:`_copy_17pli_18`};function Ke({command:e}){let[t,n]=(0,_.useState)(!1);return(0,F.jsxs)(`span`,{className:Ge.command,children:[(0,F.jsx)(`code`,{className:Ge.text,children:e}),(0,F.jsx)(`button`,{type:`button`,className:Ge.copy,onClick:()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)},()=>n(!1))},children:t?C.copied:C.copy})]})}var z={root:`_root_mor4p_1`,button:`_button_mor4p_5`,alias:`_alias_mor4p_22`,kind:`_kind_mor4p_26`,dot:`_dot_mor4p_31`,dotOk:`_dotOk_mor4p_40`,dotUnknown:`_dotUnknown_mor4p_44`,dotError:`_dotError_mor4p_49`,popover:`_popover_mor4p_53`,top:`_top_mor4p_70`,notice:`_notice_mor4p_78`,filter:`_filter_mor4p_85`,list:`_list_mor4p_93`,message:`_message_mor4p_98`,orgs:`_orgs_mor4p_111`,row:`_row_mor4p_117`,current:`_current_mor4p_121`,select:`_select_mor4p_125`,names:`_names_mor4p_141`,rowTitle:`_rowTitle_mor4p_148`,rowAlias:`_rowAlias_mor4p_154`,username:`_username_mor4p_158`,note:`_note_mor4p_167`,badge:`_badge_mor4p_172`,badgeProduction:`_badgeProduction_mor4p_180`,badgeSandbox:`_badgeSandbox_mor4p_186`,badgeScratch:`_badgeScratch_mor4p_191`,badgeNeutral:`_badgeNeutral_mor4p_196`,relogin:`_relogin_mor4p_201`,bottom:`_bottom_mor4p_210`,needsLogin:`_needsLogin_mor4p_221`,check:`_check_mor4p_227`,link:`_link_mor4p_234`};function qe(){let{selectedOrg:e,selectedSummary:t,pickerOpen:n,setPickerOpen:r,status:i}=Ae(),a=(0,_.useId)(),o=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!n)return;let t=t=>t.key===`Escape`&&e&&r(!1),i=t=>{e&&o.current&&!o.current.contains(t.target)&&r(!1)};return document.addEventListener(`keydown`,t),document.addEventListener(`mousedown`,i),()=>{document.removeEventListener(`keydown`,t),document.removeEventListener(`mousedown`,i)}},[n,e,r]);let s=e?Ye(Je(e,i[e.username])):z.dotUnknown;return(0,F.jsxs)(`div`,{className:z.root,ref:o,children:[(0,F.jsxs)(`button`,{type:`button`,className:z.button,"aria-expanded":n,"aria-controls":a,onClick:()=>r(!n),children:[(0,F.jsx)(`span`,{className:`${z.dot} ${s}`}),(0,F.jsx)(`span`,{className:z.alias,children:e?e.alias??e.username:C.selectOrg}),e&&(0,F.jsx)(`span`,{className:z.kind,children:ye(e,t)}),(0,F.jsx)(We,{})]}),n&&(0,F.jsx)(Xe,{id:a})]})}function Je(e,t){if(t)return t;if(e.availability===`ok`)return{state:`ok`};if(e.availability===`authError`)return{state:`authError`,reloginCommand:e.reloginCommand}}function Ye(e){return e?e.state===`ok`?z.dotOk:z.dotError:z.dotUnknown}function Xe({id:e}){let{orgs:t,loading:n,loadError:r,selected:i,selectOrg:a,status:o,notice:s,connectionCheck:c,recheckConnections:l}=Ae(),{guardDiscard:u}=he(),d=e=>e===i?a(e):u(()=>a(e)),[f,p]=(0,_.useState)(``),m=(0,_.useId)(),{usable:h,needsLogin:g}=(0,_.useMemo)(()=>{let e=f.trim().toLowerCase(),n=(t??[]).filter(t=>!e||t.username.toLowerCase().includes(e)||t.alias?.toLowerCase().includes(e)),r=e=>Je(e,o[e.username])?.state;return{usable:n.filter(e=>e.username===i||e.availability!==`unavailable`&&r(e)!==`authError`),needsLogin:n.filter(e=>e.username!==i&&r(e)===`authError`)}},[t,f,o,i]);return(0,F.jsxs)(`div`,{className:z.popover,id:e,role:`dialog`,"aria-label":C.selectOrg,children:[(0,F.jsxs)(`div`,{className:z.top,children:[s&&(0,F.jsx)(`p`,{className:z.notice,children:(0,F.jsx)(Ne,{text:s})}),(0,F.jsx)(`label`,{htmlFor:m,className:`visually-hidden`,children:C.findOrg}),(0,F.jsx)(`input`,{id:m,className:z.filter,type:`search`,placeholder:C.findOrg,value:f,onChange:e=>p(e.target.value),autoFocus:!0})]}),(0,F.jsxs)(`div`,{className:z.list,"aria-busy":n,children:[t===void 0&&n&&(0,F.jsx)(`p`,{className:z.message,children:C.loadingOrgs}),r&&!n&&(0,F.jsx)(`p`,{className:z.message,children:r}),t?.length===0&&!n&&(0,F.jsxs)(`div`,{className:z.message,children:[(0,F.jsx)(`p`,{children:C.noOrgs}),(0,F.jsx)(Ke,{command:`sf org login web -a <alias>`})]}),(0,F.jsx)(`ul`,{className:z.orgs,children:h.map(e=>(0,F.jsx)(Ze,{org:e,current:e.username===i,status:Je(e,o[e.username]),onSelect:()=>d(e.username)},e.username))}),g.length>0&&(0,F.jsxs)(`details`,{className:z.needsLogin,children:[(0,F.jsx)(`summary`,{children:C.needsLogin(g.length)}),(0,F.jsx)(`ul`,{className:z.orgs,children:g.map(e=>(0,F.jsx)(Ze,{org:e,current:!1,status:Je(e,o[e.username]),onSelect:()=>d(e.username)},e.username))})]})]}),(0,F.jsx)(`div`,{className:z.check,children:c===`pending`?(0,F.jsx)(`span`,{"aria-live":`polite`,children:C.checkingConnections}):(0,F.jsx)(`button`,{type:`button`,className:z.link,onClick:()=>void l(),children:C.checkConnections})}),(0,F.jsxs)(`div`,{className:z.bottom,children:[(0,F.jsx)(`span`,{children:C.addOrg}),(0,F.jsx)(Ke,{command:`sf org login web -a <alias>`})]})]})}function Ze({org:e,current:t,status:n,onSelect:r}){let i=e.kind===`sandbox`?z.badgeSandbox:e.kind===`scratch`?z.badgeScratch:_e(e)?z.badgeProduction:z.badgeNeutral;return(0,F.jsxs)(`li`,{className:`${z.row} ${t?z.current:``}`,children:[(0,F.jsxs)(`button`,{type:`button`,className:z.select,onClick:r,"aria-current":t,children:[(0,F.jsx)(`span`,{className:`${z.dot} ${Ye(n)}`}),(0,F.jsxs)(`span`,{className:z.names,children:[(0,F.jsxs)(`span`,{className:z.rowTitle,children:[(0,F.jsx)(`span`,{className:z.rowAlias,children:e.alias??e.username}),(0,F.jsx)(`span`,{className:`${z.badge} ${i}`,children:ye(e)}),e.isExpired&&(0,F.jsx)(`span`,{className:`${z.badge} ${z.badgeNeutral}`,children:C.expired})]}),e.alias&&(0,F.jsx)(`span`,{className:z.username,children:e.username}),e.expirationDate&&!e.isExpired&&(0,F.jsx)(`span`,{className:z.note,children:C.expires(e.expirationDate)})]})]}),n?.state===`authError`&&n.reloginCommand&&(0,F.jsxs)(`div`,{className:z.relogin,children:[(0,F.jsx)(`span`,{children:C.orgAuthError}),(0,F.jsx)(Ke,{command:n.reloginCommand})]})]})}function Qe(e){return Number.isInteger(e)&&e>=10&&e<=600}var $e=[`off`,`anthropic`,`openai`],et=32e3,tt=[`GET`,`POST`,`PATCH`,`PUT`,`DELETE`];function nt(e){return e===`POST`||e===`PATCH`||e===`PUT`}function rt(e){return e.trim().replace(/\s+/g,` `)}function it(e){return{provider:e?.provider??`off`,model:e?.model??``,apiKey:``,clearKey:!1,touched:!1,typed:{}}}function at(e){return e?.provider===`off`?e.keyProvider:e?.provider}function ot(e,t,n){if(t===e.provider)return e;let r=e.provider===`off`?e.typed:{...e.typed,[e.provider]:{model:e.model,apiKey:e.apiKey}};if(t===`off`)return{...e,provider:t,typed:r};let i=r[t],a=i?.model??(at(n)===t?n?.model??``:``);return{...e,provider:t,model:a,apiKey:i?.apiKey??``,typed:r}}function st(e){let t={provider:e.provider,model:e.model.trim()};return e.clearKey?t.apiKey=null:e.apiKey.trim()&&(t.apiKey=e.apiKey.trim()),t}function ct(e){return e.provider===`off`||e.model.trim()!==``}var lt={close:`_close_70bdh_1`,sectionTitle:`_sectionTitle_70bdh_11`,check:`_check_70bdh_16`,note:`_note_70bdh_26`,error:`_error_70bdh_33`,number:`_number_70bdh_38`,footer:`_footer_70bdh_47`,version:`_version_70bdh_57`,choices:`_choices_70bdh_61`,text:`_text_70bdh_67`,row:`_row_70bdh_83`,notes:`_notes_70bdh_93`},ut={anthropic:`https://platform.claude.com/docs/en/about-claude/models/overview`,openai:`https://developers.openai.com/api/docs/models`};function dt({saved:e,draft:t,onChange:n}){let r={model:(0,_.useId)(),key:(0,_.useId)(),notes:(0,_.useId)()},[i,a]=(0,_.useState)(),{start:o,cancel:s,running:c}=ue(),{handleCommonError:l}=he(),u=e=>{s(),a(void 0),n({...t,...e,touched:!0})},d=t.provider!==`off`,f=!(!e?.hasApiKey||e.keyProvider!==t.provider||t.clearKey),p=!!(d&&e?.hasApiKey&&e.keyProvider!==t.provider),m=d&&ct(t)&&(t.apiKey.trim()!==``||f),h=async()=>{a(void 0);let e=st(t),n=await o(t=>P.aiTest({ai:e},t),`replace`);n.kind===`done`&&a({state:`ok`,ms:n.value.elapsedMs}),n.kind===`error`&&!l(n.error)&&a({state:`error`,message:re(n.error)})};return(0,F.jsxs)(`section`,{className:Fe.section,"aria-describedby":r.notes,children:[(0,F.jsx)(`h3`,{className:lt.sectionTitle,children:C.settingsAi}),(0,F.jsx)(`div`,{className:lt.choices,role:`radiogroup`,"aria-label":C.settingsAi,children:$e.map(n=>(0,F.jsxs)(`label`,{className:lt.check,children:[(0,F.jsx)(`input`,{type:`radio`,name:`ai-provider`,checked:t.provider===n,onChange:()=>u(ot(t,n,e))}),C.aiProviderName[n]]},n))}),d&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`label`,{htmlFor:r.model,children:C.aiModel}),(0,F.jsx)(`input`,{id:r.model,className:lt.text,value:t.model,"aria-invalid":!ct(t),spellCheck:!1,autoComplete:`off`,onChange:e=>u({model:e.target.value})}),(0,F.jsx)(`span`,{className:lt.note,children:(0,F.jsx)(`a`,{href:ut[t.provider],target:`_blank`,rel:`noreferrer`,children:C.aiModelList})}),!ct(t)&&(0,F.jsx)(`span`,{className:lt.error,children:C.aiModelRequired}),(0,F.jsx)(`label`,{htmlFor:r.key,children:C.aiKey}),(0,F.jsxs)(`div`,{className:lt.row,children:[(0,F.jsx)(`input`,{id:r.key,className:lt.text,type:`password`,value:t.apiKey,placeholder:f?C.aiKeySaved:``,autoComplete:`off`,onChange:e=>u({apiKey:e.target.value,clearKey:!1})}),f&&(0,F.jsx)(`button`,{type:`button`,className:Fe.button,onClick:()=>u({clearKey:!0,apiKey:``}),children:C.aiKeyClear})]}),p&&(0,F.jsx)(`span`,{className:lt.error,children:C.aiKeyOtherProvider}),(0,F.jsxs)(`div`,{className:lt.row,children:[(0,F.jsx)(`button`,{type:`button`,className:Fe.button,disabled:!m||c,onClick:()=>void h(),children:c?C.aiTesting:C.aiTest}),(0,F.jsxs)(`span`,{role:`status`,className:i?.state===`error`?lt.error:lt.note,children:[i?.state===`ok`&&C.aiTestOk((i.ms/1e3).toFixed(1)),i?.state===`error`&&i.message]})]})]}),(0,F.jsxs)(`ul`,{id:r.notes,className:lt.notes,children:[(0,F.jsx)(`li`,{children:C.aiNoteOff}),(0,F.jsx)(`li`,{children:C.aiNoteCost}),(0,F.jsx)(`li`,{children:C.aiNoteSent}),(0,F.jsx)(`li`,{children:C.aiNoteKey}),d&&(0,F.jsx)(`li`,{children:C.aiNoteTest})]})]})}function ft({onClose:e}){let{reportError:t,saveSettings:n,savingSettings:r}=he(),i=(0,_.useRef)(null),[a,o]=(0,_.useState)(),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(it(void 0)),{start:d}=ue(),f=(0,_.useId)(),p=(0,_.useId)(),m=(0,_.useId)(),h=(0,_.useRef)({reportError:t,onClose:e});(0,_.useEffect)(()=>{h.current={reportError:t,onClose:e}}),(0,_.useEffect)(()=>{i.current?.showModal?.(),d(e=>P.settings(e),`ignore`).then(e=>{if(e.kind===`done`&&(o(e.value),c(String(e.value.requestTimeoutSeconds)),u(it(e.value.ai))),e.kind===`error`){let{reportError:t,onClose:n}=h.current;t(e.error),n()}})},[d]);let g=/^\d+$/.test(s)?Number(s):NaN,v=Qe(g),y=async()=>{if(!a||!v||!ct(l)&&l.touched)return;let t={omitNamespace:a.omitNamespace,requestTimeoutSeconds:g,...l.touched?{ai:st(l)}:{}};await n(t)&&e()};return(0,F.jsx)(`dialog`,{ref:i,className:Fe.dialog,"aria-label":C.settings,onCancel:e,children:(0,F.jsxs)(`form`,{method:`dialog`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,F.jsxs)(`div`,{className:Fe.head,children:[(0,F.jsx)(`h2`,{className:Fe.title,children:C.settings}),(0,F.jsx)(`button`,{type:`button`,className:lt.close,"aria-label":C.close,onClick:e,children:`×`})]}),a&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`section`,{className:Fe.section,children:[(0,F.jsx)(`h3`,{className:lt.sectionTitle,children:C.settingsSoql}),(0,F.jsxs)(`label`,{className:lt.check,htmlFor:f,children:[(0,F.jsx)(`input`,{id:f,type:`checkbox`,checked:a.omitNamespace,onChange:e=>o({...a,omitNamespace:e.target.checked})}),(0,F.jsxs)(`span`,{children:[C.settingsOmitNamespace,(0,F.jsx)(`span`,{className:lt.note,children:C.settingsOmitNamespaceNote})]})]})]}),(0,F.jsxs)(`section`,{className:Fe.section,children:[(0,F.jsx)(`h3`,{className:lt.sectionTitle,children:C.settingsConnection}),(0,F.jsx)(`label`,{htmlFor:p,children:C.settingsTimeout}),(0,F.jsx)(`input`,{id:p,className:lt.number,type:`number`,inputMode:`numeric`,min:10,max:600,step:1,value:s,"aria-invalid":!v,"aria-describedby":m,onChange:e=>c(e.target.value)}),(0,F.jsx)(`span`,{id:m,className:v?lt.note:lt.error,children:v?C.settingsTimeoutNote(10,600):C.settingsTimeoutInvalid(10,600)})]}),(0,F.jsx)(dt,{saved:a.ai,draft:l,onChange:u})]}),(0,F.jsxs)(`div`,{className:Fe.actions,children:[(0,F.jsx)(`button`,{type:`button`,className:Fe.button,onClick:e,children:C.cancel}),(0,F.jsx)(`button`,{type:`submit`,className:`${Fe.button} ${Fe.primary}`,disabled:!a||!v||!(ct(l)||!l.touched)||r,children:C.save})]}),(0,F.jsxs)(`div`,{className:lt.footer,children:[(0,F.jsxs)(`span`,{className:lt.version,children:[`sfbench `,`0.1.0`]}),(0,F.jsx)(`a`,{href:Le,target:`_blank`,rel:`noreferrer`,children:C.documentation}),(0,F.jsx)(`a`,{href:Re,target:`_blank`,rel:`noreferrer`,children:`GitHub`}),(0,F.jsx)(`a`,{href:`/licenses.txt`,target:`_blank`,rel:`noreferrer`,children:C.licenses})]})]})})}var pt=new Intl.NumberFormat;function mt(){let{selected:e,apiUsage:t}=Ae(),{settingsOpen:n,setSettingsOpen:r,mode:i,setMode:a}=he(),o=e?t[e]:void 0;return(0,F.jsxs)(`header`,{className:ze.header,children:[(0,F.jsxs)(`div`,{className:ze.brand,children:[(0,F.jsx)(Be,{}),(0,F.jsx)(`span`,{children:C.appName})]}),(0,F.jsx)(`nav`,{className:ze.modes,"aria-label":C.modes,children:[`soql`,`rest`,`apex`].map(e=>(0,F.jsx)(`button`,{type:`button`,className:ze.mode,"aria-current":i===e?`page`:void 0,onClick:()=>a(e),children:e===`soql`?C.modeSoql:e===`rest`?C.modeRest:C.modeApex},e))}),(0,F.jsx)(`div`,{className:ze.spacer}),o&&(0,F.jsx)(`span`,{className:ze.usage,children:C.apiUsage(pt.format(o.used),pt.format(o.max))}),(0,F.jsx)(qe,{}),(0,F.jsx)(ht,{},e),(0,F.jsx)(`a`,{className:ze.iconButton,href:Le,target:`_blank`,rel:`noreferrer`,"aria-label":C.documentation,title:C.documentation,children:(0,F.jsx)(He,{})}),(0,F.jsx)(`button`,{type:`button`,className:ze.iconButton,"aria-label":C.settings,title:C.settings,onClick:()=>r(!0),children:(0,F.jsx)(Ve,{})}),n&&(0,F.jsx)(ft,{onClose:()=>r(!1)})]})}function ht(){let{selected:e,reportOrgError:t}=Ae(),{start:n,running:r}=ue();if(!e)return null;let i=async()=>{let r=await n(t=>P.openOrg(e,t),`ignore`);r.kind===`error`&&t(e,r.error)};return(0,F.jsx)(`button`,{type:`button`,className:ze.iconButton,"aria-label":r?C.openingOrg:C.openOrg,title:r?C.openingOrg:C.openOrg,"aria-busy":r,disabled:r,onClick:()=>void i(),children:(0,F.jsx)(Ue,{})})}var gt={details:`_details_1k0vf_1`};function _t({details:e}){return e===void 0?null:(0,F.jsxs)(`details`,{children:[(0,F.jsx)(`summary`,{children:C.errorDetails}),(0,F.jsx)(`pre`,{className:gt.details,children:typeof e==`string`?e:JSON.stringify(e,null,2)})]})}var vt={stack:`_stack_12dqh_1`,item:`_item_12dqh_13`,row:`_row_12dqh_25`,message:`_message_12dqh_31`,dismiss:`_dismiss_12dqh_37`};function yt(){let{notifications:e,dismiss:t}=he();return e.length===0?null:(0,F.jsx)(`div`,{className:vt.stack,role:`status`,"aria-live":`polite`,children:e.map(e=>(0,F.jsxs)(`div`,{className:vt.item,children:[(0,F.jsxs)(`div`,{className:vt.row,children:[(0,F.jsx)(`span`,{className:vt.message,children:e.message}),(0,F.jsx)(`button`,{type:`button`,className:vt.dismiss,"aria-label":C.dismiss,onClick:()=>t(e.id),children:`×`})]}),e.command&&(0,F.jsx)(Ke,{command:e.command}),(0,F.jsx)(_t,{details:e.details})]},e.id))})}var bt={page:`_page_19wqg_1`,box:`_box_19wqg_10`,title:`_title_19wqg_19`};function xt({message:e,children:t}){return(0,F.jsx)(`main`,{className:bt.page,children:(0,F.jsxs)(`div`,{className:bt.box,role:`alert`,children:[(0,F.jsx)(`h1`,{className:bt.title,children:`sfbench`}),(0,F.jsx)(`p`,{children:(0,F.jsx)(Ne,{text:e})}),t]})})}var St=16e3;function Ct(e){return e.length>16e3?`${e.slice(0,St)}\n(cut)`:e}var wt=/[\p{L}\p{N}_]/u,Tt=new Set([`select`,`from`,`where`,`group`,`having`,`order`,`limit`,`offset`,`with`,`for`,`using`]),Et=new Set([`select`,`where`,`group`,`having`,`order`]);function Dt(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(/\s/.test(r))n++;else if(r===`'`){let r=n++;for(;n<e.length&&e[n]!==`'`;)n+=e[n]===`\\`?2:1;n=Math.min(n+1,e.length+1),t.push({type:`string`,text:e.slice(r,n),start:r,end:n})}else if(wt.test(r)){let r=n;for(;n<e.length&&wt.test(e[n]);)n++;t.push({type:`word`,text:e.slice(r,n),start:r,end:n})}else t.push({type:`punct`,text:r,start:n,end:++n})}return t}function Ot(e,t,n){let r=Dt(e),i={from:void 0,alias:void 0,child:!1,parent:void 0},a={scope:i,clause:void 0,clauseWords:0,sawFrom:!1,fromListed:!1,query:void 0};a.query=a;let o=[a],s=()=>{let e=o[o.length-1];return{frame:e,clause:e.query?.clause,clauseWords:e.query?.clauseWords??0}},c,l=!1;for(let e=0;e<r.length;e++){let i=r[e];!c&&i.end>t&&(l=i.type===`string`&&i.start<n,c=s());let u=o[o.length-1];if(i.type===`punct`){if(i.text===`(`){let t=r[e+1]?.type===`word`&&r[e+1].text.toLowerCase()===`select`,n=u.query,i=t?{from:void 0,alias:void 0,child:n?.clause===`select`,parent:n?.scope}:void 0,a={scope:i,clause:void 0,clauseWords:0,sawFrom:!1,fromListed:!1,query:void 0};a.query=i?a:u.query,o.push(a)}else i.text===`)`&&o.length>1?o.pop():i.text===`,`&&u===u.query&&u.clause===`from`&&(u.fromListed=!0);continue}if(i.type!==`word`)continue;let d=u.query;if(!d)continue;let f=i.text.toLowerCase(),p=r[e+1]?.text===`.`&&r[e+1].start===i.end||r[e-1]?.text===`.`&&r[e-1].end===i.start,m=Tt.has(f)&&!p&&(f!==`group`&&f!==`order`||r[e+1]?.text.toLowerCase()===`by`);if(m&&f===`from`&&(u!==d||d.sawFrom&&d!==a)){if(u!==d)for(;o[o.length-1]!==d;)o.pop();else for(;o.pop()!==d;);e--}else if(u===d&&m)d.clause=f,d.clauseWords=0,d.fromListed=!1,f===`from`&&(d.sawFrom=!0);else{if(u===d&&d.clause===`from`&&d.scope){let t=r[e-1]?.text===`.`&&d.clauseWords>0&&!d.fromListed;d.clauseWords===0||t?d.scope.from=i.text:!d.scope.alias&&f!==`as`&&(d.scope.alias=i.text)}u===d&&d.clauseWords++}}return{root:i,atCursor:c??s(),inString:l}}function kt(e,t){let n=t;for(;n>0&&(wt.test(e[n-1])||e[n-1]===`.`);)n--;let r=e.slice(n,t).split(`.`),i=r[r.length-1],a=r.slice(0,-1),o={word:i,from:t-i.length,dotted:a.length>0,afterDot:a.length>0&&i===``},{atCursor:s,inString:c}=Ot(e,n,t);if(c)return{...o,context:{kind:`none`}};let l=s.frame.query?.scope;if(!l)return{...o,context:{kind:`keyword`}};if(s.clause===`from`)return{...o,context:s.clauseWords===0&&a.length===0?{kind:`from`,scope:l}:{kind:`keyword`}};if(s.clause&&Et.has(s.clause)){let e=l.alias&&a[0]?.toLowerCase()===l.alias.toLowerCase()?a.slice(1):a;return{...o,context:{kind:`field`,scope:l,path:e}}}return{...o,context:{kind:`keyword`}}}function At(e){return Ot(e,e.length,e.length).root.from}var jt={objects:!0,editor:!0,recent:!0,restRequest:!0,restHistory:!0,apexEditor:!0,apexHistory:!0};function Mt(e,t){let n={...jt};try{let r=JSON.parse(localStorage.getItem(e)??`{}`);for(let e of t)typeof r[e]==`boolean`&&(n[e]=r[e])}catch{}return n}var Nt=(0,_.createContext)(void 0);function Pt({storageKey:e,names:t,children:n}){let[r,i]=(0,_.useState)(()=>Mt(e,t)),a=(0,_.useCallback)((n,r)=>{i(i=>{let a={...i,[n]:r};try{localStorage.setItem(e,JSON.stringify(Object.fromEntries(t.map(e=>[e,a[e]]))))}catch{}return a})},[e]),o=(0,_.useMemo)(()=>({open:r,setOpen:a}),[r,a]);return(0,F.jsx)(Nt.Provider,{value:o,children:n})}function Ft(){let e=(0,_.useContext)(Nt);if(!e)throw Error(`usePanels must be used inside PanelsProvider`);return e}function It(e){return e=Array.isArray(e)?e[0]:e,e.image&&!0}function Lt(e,t){return t}function Rt(e){return typeof e==`string`}function zt(e){return Number.isFinite(e)}function Bt(e){return e==null}function Vt(e,t,n){return Bt(e)?``:`${n||``}${e}${t||``}`}function Ht(e,t){return t===void 0&&(t=!1),Array.isArray(e)?e.length>0?`(${e.join(`, `)})`:t?`()`:``:t?`(${e||``})`:e||``}function Ut(e,t,n){return n===void 0&&(n=``),zt(e)&&e>0?Array(e).fill(t).join(n):``}function Wt(e){return e&&!Bt(e.alias)}function Gt(e){return Rt(e.field)&&!Array.isArray(e.relationships)&&!Array.isArray(e.conditions)}function Kt(e){return!Bt(e.functionName||e.fn)}function qt(e){return Rt(e.field)&&Array.isArray(e.relationships)}function Jt(e){return!Bt(e.subquery)}function Yt(e){return Rt(e.field)&&Array.isArray(e.conditions)}function Xt(e){return Rt(e.relationshipName)}function Zt(e){return!!e&&!!e.operator&&!!e.right}function Qt(e){return!!e&&!!e.operator&&!!e.right}function $t(e){return e&&!Bt(e.fn)&&Rt(e.operator)&&!Bt(e.value)}function en(e){return e&&zt(e.openParen)&&Bt(e.operator)&&Bt(e.field)&&Bt(e.fn)&&Bt(e.closeParen)}function tn(e){return e&&Rt(e.field)&&Rt(e.operator)&&!Bt(e.valueQuery)&&Bt(e.value)}function nn(e){return e&&!Bt(e.field)}function rn(e){return e&&!Bt(e.field)}function an(e){return[`IN`,`NOT IN`,`INCLUDES`,`EXCLUDES`].includes(e)}function on(e,t,n){if(Bt(t))return e;if(n&&t!==`APEX_BIND_VARIABLE`&&an(n)&&!Array.isArray(e)&&(e=[e],t=Array.isArray(t)?t:[t]),Array.isArray(t)&&Array.isArray(e))return e.map(function(e,n){return sn(e,t?.[n])});switch(Array.isArray(t)&&(t=t[0]),t){case`STRING`:return Array.isArray(e)?e.filter(Boolean).map(function(e){return Rt(e)&&e.startsWith(`'`)?e:`'${e??``}'`}):(e=String(e??``),Rt(e)&&e.startsWith(`'`)?e:`'${e??``}'`);case`APEX_BIND_VARIABLE`:return`:${e}`;default:return e}}function sn(e,t){switch(t){case`STRING`:return Rt(e)&&e.startsWith(`'`)?e:`'${e??``}'`;default:return e}}var cn=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION=`10.5.0`})),ln=o(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),un=o(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),dn=o(((e,t)=>{t.exports=un()(Object.keys,Object)})),fn=o(((e,t)=>{var n=ln(),r=dn(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),pn=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),mn=o(((e,t)=>{var n=pn(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),hn=o(((e,t)=>{t.exports=mn().Symbol})),gn=o(((e,t)=>{var n=hn(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),_n=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),vn=o(((e,t)=>{var n=hn(),r=gn(),i=_n(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),yn=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),bn=o(((e,t)=>{var n=vn(),r=yn(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),xn=o(((e,t)=>{t.exports=mn()[`__core-js_shared__`]})),Sn=o(((e,t)=>{var n=xn(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),Cn=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),wn=o(((e,t)=>{var n=bn(),r=Sn(),i=yn(),a=Cn(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Tn=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),En=o(((e,t)=>{var n=wn(),r=Tn();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),Dn=o(((e,t)=>{t.exports=En()(mn(),`DataView`)})),On=o(((e,t)=>{t.exports=En()(mn(),`Map`)})),kn=o(((e,t)=>{t.exports=En()(mn(),`Promise`)})),An=o(((e,t)=>{t.exports=En()(mn(),`Set`)})),jn=o(((e,t)=>{t.exports=En()(mn(),`WeakMap`)})),Mn=o(((e,t)=>{var n=Dn(),r=On(),i=kn(),a=An(),o=jn(),s=vn(),c=Cn(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),Nn=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),Pn=o(((e,t)=>{var n=vn(),r=Nn(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),Fn=o(((e,t)=>{var n=Pn(),r=Nn(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),In=o(((e,t)=>{t.exports=Array.isArray})),Ln=o(((e,t)=>{function n(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=9007199254740991}t.exports=n})),Rn=o(((e,t)=>{var n=bn(),r=Ln();function i(e){return e!=null&&r(e.length)&&!n(e)}t.exports=i})),zn=o(((e,t)=>{function n(){return!1}t.exports=n})),Bn=o(((e,t)=>{var n=mn(),r=zn(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),Vn=o(((e,t)=>{var n=vn(),r=Ln(),i=Nn(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),Hn=o(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),Un=o(((e,t)=>{var n=pn(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),Wn=o(((e,t)=>{var n=Vn(),r=Hn(),i=Un(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),Gn=o(((e,t)=>{var n=fn(),r=Mn(),i=Fn(),a=In(),o=Rn(),s=Bn(),c=ln(),l=Wn(),u=`[object Map]`,d=`[object Set]`,f=Object.prototype.hasOwnProperty;function p(e){if(e==null)return!0;if(o(e)&&(a(e)||typeof e==`string`||typeof e.splice==`function`||s(e)||l(e)||i(e)))return!e.length;var t=r(e);if(t==u||t==d)return!e.size;if(c(e))return!n(e).length;for(var p in e)if(f.call(e,p))return!1;return!0}t.exports=p})),Kn=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}t.exports=n})),qn=o(((e,t)=>{function n(){this.__data__=[],this.size=0}t.exports=n})),Jn=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),Yn=o(((e,t)=>{var n=Jn();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),Xn=o(((e,t)=>{var n=Yn(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),Zn=o(((e,t)=>{var n=Yn();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),Qn=o(((e,t)=>{var n=Yn();function r(e){return n(this.__data__,e)>-1}t.exports=r})),$n=o(((e,t)=>{var n=Yn();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),er=o(((e,t)=>{var n=qn(),r=Xn(),i=Zn(),a=Qn(),o=$n();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),tr=o(((e,t)=>{var n=er();function r(){this.__data__=new n,this.size=0}t.exports=r})),nr=o(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),rr=o(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),ir=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),ar=o(((e,t)=>{t.exports=En()(Object,`create`)})),or=o(((e,t)=>{var n=ar();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),sr=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),cr=o(((e,t)=>{var n=ar(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),lr=o(((e,t)=>{var n=ar(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),ur=o(((e,t)=>{var n=ar(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),dr=o(((e,t)=>{var n=or(),r=sr(),i=cr(),a=lr(),o=ur();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),fr=o(((e,t)=>{var n=dr(),r=er(),i=On();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),pr=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),mr=o(((e,t)=>{var n=pr();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),hr=o(((e,t)=>{var n=mr();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),gr=o(((e,t)=>{var n=mr();function r(e){return n(this,e).get(e)}t.exports=r})),_r=o(((e,t)=>{var n=mr();function r(e){return n(this,e).has(e)}t.exports=r})),vr=o(((e,t)=>{var n=mr();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),yr=o(((e,t)=>{var n=fr(),r=hr(),i=gr(),a=_r(),o=vr();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}s.prototype.clear=n,s.prototype.delete=r,s.prototype.get=i,s.prototype.has=a,s.prototype.set=o,t.exports=s})),br=o(((e,t)=>{var n=er(),r=On(),i=yr(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length<a-1)return s.push([e,t]),this.size=++o.size,this;o=this.__data__=new i(s)}return o.set(e,t),this.size=o.size,this}t.exports=o})),xr=o(((e,t)=>{var n=er(),r=tr(),i=nr(),a=rr(),o=ir(),s=br();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),Sr=o(((e,t)=>{function n(e){return this.__data__.set(e,`__lodash_hash_undefined__`),this}t.exports=n})),Cr=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),wr=o(((e,t)=>{var n=yr(),r=Sr(),i=Cr();function a(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new n;++t<r;)this.add(e[t])}a.prototype.add=a.prototype.push=r,a.prototype.has=i,t.exports=a})),Tr=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}t.exports=n})),Er=o(((e,t)=>{function n(e,t){return e.has(t)}t.exports=n})),Dr=o(((e,t)=>{var n=wr(),r=Tr(),i=Er(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g<f;){var y=e[g],b=t[g];if(c)var x=d?c(b,y,g,t,e,u):c(y,b,g,e,t,u);if(x!==void 0){if(x)continue;_=!1;break}if(v){if(!r(t,function(e,t){if(!i(v,t)&&(y===e||l(y,e,s,c,u)))return v.push(t)})){_=!1;break}}else if(!(y===b||l(y,b,s,c,u))){_=!1;break}}return u.delete(e),u.delete(t),_}t.exports=s})),Or=o(((e,t)=>{t.exports=mn().Uint8Array})),kr=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),Ar=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}t.exports=n})),jr=o(((e,t)=>{var n=hn(),r=Or(),i=Jn(),a=Dr(),o=kr(),s=Ar(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),Mr=o(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}t.exports=n})),Nr=o(((e,t)=>{var n=Mr(),r=In();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),Pr=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}t.exports=n})),Fr=o(((e,t)=>{function n(){return[]}t.exports=n})),Ir=o(((e,t)=>{var n=Pr(),r=Fr(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),Lr=o(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}t.exports=n})),Rr=o(((e,t)=>{var n=/^(?:0|[1-9]\d*)$/;function r(e,t){var r=typeof e;return t??=9007199254740991,!!t&&(r==`number`||r!=`symbol`&&n.test(e))&&e>-1&&e%1==0&&e<t}t.exports=r})),zr=o(((e,t)=>{var n=Lr(),r=Fn(),i=In(),a=Bn(),o=Rr(),s=Wn(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),Br=o(((e,t)=>{var n=zr(),r=fn(),i=Rn();function a(e){return i(e)?n(e):r(e)}t.exports=a})),Vr=o(((e,t)=>{var n=Nr(),r=Ir(),i=Br();function a(e){return n(e,i,r)}t.exports=a})),Hr=o(((e,t)=>{var n=Vr(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f<d;){p=u[f];var v=e[p],y=t[p];if(o)var b=l?o(y,v,p,t,e,c):o(v,y,p,e,t,c);if(!(b===void 0?v===y||s(v,y,a,o,c):b)){g=!1;break}_||=p==`constructor`}if(g&&!_){var x=e.constructor,S=t.constructor;x!=S&&`constructor`in e&&`constructor`in t&&!(typeof x==`function`&&x instanceof x&&typeof S==`function`&&S instanceof S)&&(g=!1)}return c.delete(e),c.delete(t),g}t.exports=a})),Ur=o(((e,t)=>{var n=xr(),r=Dr(),i=jr(),a=Hr(),o=Mn(),s=In(),c=Bn(),l=Wn(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),Wr=o(((e,t)=>{var n=Ur(),r=Nn();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),Gr=o(((e,t)=>{var n=xr(),r=Wr(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c<l;){d=o[c];var f=d[0],p=e[f],m=d[1];if(u&&d[2]){if(p===void 0&&!(f in e))return!1}else{var h=new n;if(s)var g=s(p,m,f,e,t,h);if(!(g===void 0?r(m,p,i|a,s,h):g))return!1}}return!0}t.exports=o})),Kr=o(((e,t)=>{var n=yn();function r(e){return e===e&&!n(e)}t.exports=r})),qr=o(((e,t)=>{var n=Kr(),r=Br();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),Jr=o(((e,t)=>{function n(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),Yr=o(((e,t)=>{var n=Gr(),r=qr(),i=Jr();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),Xr=o(((e,t)=>{var n=vn(),r=Nn(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),Zr=o(((e,t)=>{var n=In(),r=Xr(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),Qr=o(((e,t)=>{var n=yr(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),$r=o(((e,t)=>{var n=Qr(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),ei=o(((e,t)=>{var n=$r(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),ti=o(((e,t)=>{var n=hn(),r=Kn(),i=In(),a=Xr(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),ni=o(((e,t)=>{var n=ti();function r(e){return e==null?``:n(e)}t.exports=r})),ri=o(((e,t)=>{var n=In(),r=Zr(),i=ei(),a=ni();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),ii=o(((e,t)=>{var n=Xr(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),ai=o(((e,t)=>{var n=ri(),r=ii();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i<a;)e=e[r(t[i++])];return i&&i==a?e:void 0}t.exports=i})),oi=o(((e,t)=>{var n=ai();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),si=o(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),ci=o(((e,t)=>{var n=ri(),r=Fn(),i=In(),a=Rr(),o=Ln(),s=ii();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l<u;){var f=s(t[l]);if(!(d=e!=null&&c(e,f)))break;e=e[f]}return d||++l!=u?d:(u=e==null?0:e.length,!!u&&o(u)&&a(f,u)&&(i(e)||r(e)))}t.exports=c})),li=o(((e,t)=>{var n=si(),r=ci();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),ui=o(((e,t)=>{var n=Wr(),r=oi(),i=li(),a=Zr(),o=Kr(),s=Jr(),c=ii(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),di=o(((e,t)=>{function n(e){return e}t.exports=n})),fi=o(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),pi=o(((e,t)=>{var n=ai();function r(e){return function(t){return n(t,e)}}t.exports=r})),mi=o(((e,t)=>{var n=fi(),r=pi(),i=Zr(),a=ii();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),hi=o(((e,t)=>{var n=Yr(),r=ui(),i=di(),a=In(),o=mi();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),gi=o(((e,t)=>{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),_i=o(((e,t)=>{t.exports=gi()()})),vi=o(((e,t)=>{var n=_i(),r=Br();function i(e,t){return e&&n(e,t,r)}t.exports=i})),yi=o(((e,t)=>{var n=Rn();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o<a)&&i(s[o],o,s)!==!1;);return r}}t.exports=r})),bi=o(((e,t)=>{var n=vi();t.exports=yi()(n)})),xi=o(((e,t)=>{var n=bi(),r=Rn();function i(e,t){var i=-1,a=r(e)?Array(e.length):[];return n(e,function(e,n,r){a[++i]=t(e,n,r)}),a}t.exports=i})),Si=o(((e,t)=>{var n=Kn(),r=hi(),i=xi(),a=In();function o(e,t){return(a(e)?n:i)(e,r(t,3))}t.exports=o})),Ci=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}t.exports=n})),wi=o(((e,t)=>{var n=di();function r(e){return typeof e==`function`?e:n}t.exports=r})),Ti=o(((e,t)=>{var n=Ci(),r=bi(),i=wi(),a=In();function o(e,t){return(a(e)?n:r)(e,i(t))}t.exports=o})),Ei=o(((e,t)=>{var n=Kn();function r(e,t){return n(t,function(t){return e[t]})}t.exports=r})),Di=o(((e,t)=>{var n=Ei(),r=Br();function i(e){return e==null?[]:n(e,r(e))}t.exports=i})),Oi=o(((e,t)=>{var n=Object.prototype.hasOwnProperty;function r(e,t){return e!=null&&n.call(e,t)}t.exports=r})),ki=o(((e,t)=>{var n=Oi(),r=ci();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),Ai=o(((e,t)=>{var n=En();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),ji=o(((e,t)=>{var n=Ai();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),Mi=o(((e,t)=>{var n=ji(),r=Jn(),i=Object.prototype.hasOwnProperty;function a(e,t,a){var o=e[t];(!(i.call(e,t)&&r(o,a))||a===void 0&&!(t in e))&&n(e,t,a)}t.exports=a})),Ni=o(((e,t)=>{var n=Mi(),r=ji();function i(e,t,i,a){var o=!i;i||={};for(var s=-1,c=t.length;++s<c;){var l=t[s],u=a?a(i[l],e[l],l,i,e):void 0;u===void 0&&(u=e[l]),o?r(i,l,u):n(i,l,u)}return i}t.exports=i})),Pi=o(((e,t)=>{var n=Ni(),r=Br();function i(e,t){return e&&n(t,r(t),e)}t.exports=i})),Fi=o(((e,t)=>{function n(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}t.exports=n})),Ii=o(((e,t)=>{var n=yn(),r=ln(),i=Fi(),a=Object.prototype.hasOwnProperty;function o(e){if(!n(e))return i(e);var t=r(e),o=[];for(var s in e)(s!=`constructor`||!t&&a.call(e,s))&&o.push(s);return o}t.exports=o})),Li=o(((e,t)=>{var n=zr(),r=Ii(),i=Rn();function a(e){return i(e)?n(e,!0):r(e)}t.exports=a})),Ri=o(((e,t)=>{var n=Ni(),r=Li();function i(e,t){return e&&n(t,r(t),e)}t.exports=i})),zi=o(((e,t)=>{var n=mn(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r?n.Buffer:void 0,o=a?a.allocUnsafe:void 0;function s(e,t){if(t)return e.slice();var n=e.length,r=o?o(n):new e.constructor(n);return e.copy(r),r}t.exports=s})),Bi=o(((e,t)=>{function n(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}t.exports=n})),Vi=o(((e,t)=>{var n=Ni(),r=Ir();function i(e,t){return n(e,r(e),t)}t.exports=i})),Hi=o(((e,t)=>{t.exports=un()(Object.getPrototypeOf,Object)})),Ui=o(((e,t)=>{var n=Mr(),r=Hi(),i=Ir(),a=Fr();t.exports=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)n(t,i(e)),e=r(e);return t}:a})),Wi=o(((e,t)=>{var n=Ni(),r=Ui();function i(e,t){return n(e,r(e),t)}t.exports=i})),Gi=o(((e,t)=>{var n=Nr(),r=Ui(),i=Li();function a(e){return n(e,i,r)}t.exports=a})),Ki=o(((e,t)=>{var n=Object.prototype.hasOwnProperty;function r(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]==`string`&&n.call(e,`index`)&&(r.index=e.index,r.input=e.input),r}t.exports=r})),qi=o(((e,t)=>{var n=Or();function r(e){var t=new e.constructor(e.byteLength);return new n(t).set(new n(e)),t}t.exports=r})),Ji=o(((e,t)=>{var n=qi();function r(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}t.exports=r})),Yi=o(((e,t)=>{var n=/\w*$/;function r(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}t.exports=r})),Xi=o(((e,t)=>{var n=hn(),r=n?n.prototype:void 0,i=r?r.valueOf:void 0;function a(e){return i?Object(i.call(e)):{}}t.exports=a})),Zi=o(((e,t)=>{var n=qi();function r(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}t.exports=r})),Qi=o(((e,t)=>{var n=qi(),r=Ji(),i=Yi(),a=Xi(),o=Zi(),s=`[object Boolean]`,c=`[object Date]`,l=`[object Map]`,u=`[object Number]`,d=`[object RegExp]`,f=`[object Set]`,p=`[object String]`,m=`[object Symbol]`,h=`[object ArrayBuffer]`,g=`[object DataView]`,_=`[object Float32Array]`,v=`[object Float64Array]`,y=`[object Int8Array]`,b=`[object Int16Array]`,x=`[object Int32Array]`,S=`[object Uint8Array]`,C=`[object Uint8ClampedArray]`,w=`[object Uint16Array]`,T=`[object Uint32Array]`;function E(e,t,E){var D=e.constructor;switch(t){case h:return n(e);case s:case c:return new D(+e);case g:return r(e,E);case _:case v:case y:case b:case x:case S:case C:case w:case T:return o(e,E);case l:return new D;case u:case p:return new D(e);case d:return i(e);case f:return new D;case m:return a(e)}}t.exports=E})),$i=o(((e,t)=>{var n=yn(),r=Object.create;t.exports=function(){function e(){}return function(t){if(!n(t))return{};if(r)return r(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}()})),ea=o(((e,t)=>{var n=$i(),r=Hi(),i=ln();function a(e){return typeof e.constructor==`function`&&!i(e)?n(r(e)):{}}t.exports=a})),ta=o(((e,t)=>{var n=Mn(),r=Nn(),i=`[object Map]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),na=o(((e,t)=>{var n=ta(),r=Hn(),i=Un(),a=i&&i.isMap;t.exports=a?r(a):n})),ra=o(((e,t)=>{var n=Mn(),r=Nn(),i=`[object Set]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),ia=o(((e,t)=>{var n=ra(),r=Hn(),i=Un(),a=i&&i.isSet;t.exports=a?r(a):n})),aa=o(((e,t)=>{var n=xr(),r=Ci(),i=Mi(),a=Pi(),o=Ri(),s=zi(),c=Bi(),l=Vi(),u=Wi(),d=Vr(),f=Gi(),p=Mn(),m=Ki(),h=Qi(),g=ea(),_=In(),v=Bn(),y=na(),b=yn(),x=ia(),S=Br(),C=Li(),w=1,T=2,E=4,D=`[object Arguments]`,O=`[object Array]`,k=`[object Boolean]`,A=`[object Date]`,j=`[object Error]`,M=`[object Function]`,ee=`[object GeneratorFunction]`,N=`[object Map]`,P=`[object Number]`,te=`[object Object]`,ne=`[object RegExp]`,re=`[object Set]`,ie=`[object String]`,ae=`[object Symbol]`,oe=`[object WeakMap]`,se=`[object ArrayBuffer]`,ce=`[object DataView]`,le=`[object Float32Array]`,ue=`[object Float64Array]`,de=`[object Int8Array]`,F=`[object Int16Array]`,fe=`[object Int32Array]`,pe=`[object Uint8Array]`,me=`[object Uint8ClampedArray]`,I=`[object Uint16Array]`,L=`[object Uint32Array]`,R={};R[D]=R[O]=R[se]=R[ce]=R[k]=R[A]=R[le]=R[ue]=R[de]=R[F]=R[fe]=R[N]=R[P]=R[te]=R[ne]=R[re]=R[ie]=R[ae]=R[pe]=R[me]=R[I]=R[L]=!0,R[j]=R[M]=R[oe]=!1;function he(e,t,O,k,A,j){var N,P=t&w,ne=t&T,re=t&E;if(O&&(N=A?O(e,k,A,j):O(e)),N!==void 0)return N;if(!b(e))return e;var ie=_(e);if(ie){if(N=m(e),!P)return c(e,N)}else{var ae=p(e),oe=ae==M||ae==ee;if(v(e))return s(e,P);if(ae==te||ae==D||oe&&!A){if(N=ne||oe?{}:g(e),!P)return ne?u(e,o(N,e)):l(e,a(N,e))}else{if(!R[ae])return A?e:{};N=h(e,ae,P)}}j||=new n;var se=j.get(e);if(se)return se;j.set(e,N),x(e)?e.forEach(function(n){N.add(he(n,t,O,n,e,j))}):y(e)&&e.forEach(function(n,r){N.set(r,he(n,t,O,r,e,j))});var ce=ie?void 0:(re?ne?f:d:ne?C:S)(e);return r(ce||e,function(n,r){ce&&(r=n,n=e[r]),i(N,r,he(n,t,O,r,e,j))}),N}t.exports=he})),oa=o(((e,t)=>{var n=aa(),r=4;function i(e){return n(e,r)}t.exports=i})),sa=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PRINT_WARNING=e.PRINT_ERROR=void 0;function t(e){console&&console.error&&console.error(`Error: ${e}`)}e.PRINT_ERROR=t;function n(e){console&&console.warn&&console.warn(`Warning: ${e}`)}e.PRINT_WARNING=n})),ca=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.timer=void 0;function t(e){var t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}e.timer=t})),la=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.toFastProperties=void 0;function t(e){function t(){}t.prototype=e;var n=new t;function r(){return typeof n.bar}return r(),r(),e}e.toFastProperties=t})),ua=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.toFastProperties=e.timer=e.PRINT_ERROR=e.PRINT_WARNING=void 0;var t=sa();Object.defineProperty(e,"PRINT_WARNING",{enumerable:!0,get:function(){return t.PRINT_WARNING}}),Object.defineProperty(e,"PRINT_ERROR",{enumerable:!0,get:function(){return t.PRINT_ERROR}});var n=ca();Object.defineProperty(e,"timer",{enumerable:!0,get:function(){return n.timer}});var r=la();Object.defineProperty(e,"toFastProperties",{enumerable:!0,get:function(){return r.toFastProperties}})})),da=o(((e,t)=>{function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}t.exports=n})),fa=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),pa=o(((e,t)=>{var n=fa(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),ma=o(((e,t)=>{var n=pa(),r=yn(),i=Xr(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),ha=o(((e,t)=>{var n=ma(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),ga=o(((e,t)=>{var n=ha();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),_a=o(((e,t)=>{var n=da(),r=ga();function i(e,t,i){var a=e==null?0:e.length;return a?(t=i||t===void 0?1:r(t),n(e,t<0?0:t,a)):[]}t.exports=i})),va=o(((e,t)=>{var n=vn(),r=In(),i=Nn(),a=`[object String]`;function o(e){return typeof e==`string`||!r(e)&&i(e)&&n(e)==a}t.exports=o})),ya=o(((e,t)=>{var n=vn(),r=Nn(),i=`[object RegExp]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),ba=o(((e,t)=>{var n=ya(),r=Hn(),i=Un(),a=i&&i.isRegExp;t.exports=a?r(a):n})),xa=o(((e,t)=>{var n=Mi(),r=ri(),i=Rr(),a=yn(),o=ii();function s(e,t,s,c){if(!a(e))return e;t=r(t,e);for(var l=-1,u=t.length,d=u-1,f=e;f!=null&&++l<u;){var p=o(t[l]),m=s;if(p===`__proto__`||p===`constructor`||p===`prototype`)return e;if(l!=d){var h=f[p];m=c?c(h,p,f):void 0,m===void 0&&(m=a(h)?h:i(t[l+1])?[]:{})}n(f,p,m),f=f[p]}return e}t.exports=s})),Sa=o(((e,t)=>{var n=ai(),r=xa(),i=ri();function a(e,t,a){for(var o=-1,s=t.length,c={};++o<s;){var l=t[o],u=n(e,l);a(u,l)&&r(c,i(l,e),u)}return c}t.exports=a})),Ca=o(((e,t)=>{var n=Kn(),r=hi(),i=Sa(),a=Gi();function o(e,t){if(e==null)return{};var o=n(a(e),function(e){return[e]});return t=r(t),i(e,o,function(e,n){return t(e,n[0])})}t.exports=o})),wa=o(((e,t)=>{function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}t.exports=n})),Ta=o(((e,t)=>{var n=wa(),r=Math.max;function i(e,t,i){return t=r(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=r(a.length-t,0),c=Array(s);++o<s;)c[o]=a[t+o];o=-1;for(var l=Array(t+1);++o<t;)l[o]=a[o];return l[t]=i(c),n(e,this,l)}}t.exports=i})),Ea=o(((e,t)=>{function n(e){return function(){return e}}t.exports=n})),Da=o(((e,t)=>{var n=Ea(),r=Ai(),i=di();t.exports=r?function(e,t){return r(e,`toString`,{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i})),Oa=o(((e,t)=>{var n=Date.now;function r(e){var t=0,r=0;return function(){var i=n(),a=16-(i-r);if(r=i,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}t.exports=r})),ka=o(((e,t)=>{var n=Da();t.exports=Oa()(n)})),Aa=o(((e,t)=>{var n=di(),r=Ta(),i=ka();function a(e,t){return i(r(e,t,n),e+``)}t.exports=a})),ja=o(((e,t)=>{var n=Jn(),r=Rn(),i=Rr(),a=yn();function o(e,t,o){if(!a(o))return!1;var s=typeof t;return(s==`number`?r(o)&&i(t,o.length):s==`string`&&t in o)?n(o[t],e):!1}t.exports=o})),Ma=o(((e,t)=>{var n=Aa(),r=ja();function i(e){return n(function(t,n){var i=-1,a=n.length,o=a>1?n[a-1]:void 0,s=a>2?n[2]:void 0;for(o=e.length>3&&typeof o==`function`?(a--,o):void 0,s&&r(n[0],n[1],s)&&(o=a<3?void 0:o,a=1),t=Object(t);++i<a;){var c=n[i];c&&e(t,c,i,o)}return t})}t.exports=i})),Na=o(((e,t)=>{var n=Mi(),r=Ni(),i=Ma(),a=Rn(),o=ln(),s=Br(),c=Object.prototype.hasOwnProperty;t.exports=i(function(e,t){if(o(t)||a(t))r(t,s(t),e);else for(var i in t)c.call(t,i)&&n(e,i,t[i])})})),Pa=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.serializeProduction=e.serializeGrammar=e.Terminal=e.Alternation=e.RepetitionWithSeparator=e.Repetition=e.RepetitionMandatoryWithSeparator=e.RepetitionMandatory=e.Option=e.Alternative=e.Rule=e.NonTerminal=e.AbstractProduction=void 0;var a=i(Si()),o=i(Ti()),s=i(va()),c=i(ba()),l=i(Ca()),u=i(Na());function d(e){return f(e)?e.LABEL:e.name}function f(e){return(0,s.default)(e.LABEL)&&e.LABEL!==``}var p=function(){function e(e){this._definition=e}return Object.defineProperty(e.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),e.prototype.accept=function(e){e.visit(this),(0,o.default)(this.definition,function(t){t.accept(e)})},e}();e.AbstractProduction=p;var m=function(e){r(t,e);function t(t){var n=e.call(this,[])||this;return n.idx=1,(0,u.default)(n,(0,l.default)(t,function(e){return e!==void 0})),n}return Object.defineProperty(t.prototype,"definition",{get:function(){return this.referencedRule===void 0?[]:this.referencedRule.definition},set:function(e){},enumerable:!1,configurable:!0}),t.prototype.accept=function(e){e.visit(this)},t}(p);e.NonTerminal=m;var h=function(e){r(t,e);function t(t){var n=e.call(this,t.definition)||this;return n.orgText=``,(0,u.default)(n,(0,l.default)(t,function(e){return e!==void 0})),n}return t}(p);e.Rule=h;var g=function(e){r(t,e);function t(t){var n=e.call(this,t.definition)||this;return n.ignoreAmbiguities=!1,(0,u.default)(n,(0,l.default)(t,function(e){return e!==void 0})),n}return t}(p);e.Alternative=g;var _=function(e){r(t,e);function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,(0,u.default)(n,(0,l.default)(t,function(e){return e!==void 0})),n}return t}(p);e.Option=_;var v=function(e){r(t,e);function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,(0,u.default)(n,(0,l.default)(t,function(e){return e!==void 0})),n}return t}(p);e.RepetitionMandatory=v;var y=function(e){r(t,e);function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,(0,u.default)(n,(0,l.default)(t,function(e){return e!==void 0})),n}return t}(p);e.RepetitionMandatoryWithSeparator=y;var b=function(e){r(t,e);function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,(0,u.default)(n,(0,l.default)(t,function(e){return e!==void 0})),n}return t}(p);e.Repetition=b;var x=function(e){r(t,e);function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,(0,u.default)(n,(0,l.default)(t,function(e){return e!==void 0})),n}return t}(p);e.RepetitionWithSeparator=x;var S=function(e){r(t,e);function t(t){var n=e.call(this,t.definition)||this;return n.idx=1,n.ignoreAmbiguities=!1,n.hasPredicates=!1,(0,u.default)(n,(0,l.default)(t,function(e){return e!==void 0})),n}return Object.defineProperty(t.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),t}(p);e.Alternation=S;var C=function(){function e(e){this.idx=1,(0,u.default)(this,(0,l.default)(e,function(e){return e!==void 0}))}return e.prototype.accept=function(e){e.visit(this)},e}();e.Terminal=C;function w(e){return(0,a.default)(e,T)}e.serializeGrammar=w;function T(e){function t(e){return(0,a.default)(e,T)}if(e instanceof m){var n={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return(0,s.default)(e.label)&&(n.label=e.label),n}if(e instanceof g)return{type:`Alternative`,definition:t(e.definition)};if(e instanceof _)return{type:`Option`,idx:e.idx,definition:t(e.definition)};if(e instanceof v)return{type:`RepetitionMandatory`,idx:e.idx,definition:t(e.definition)};if(e instanceof y)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:T(new C({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof x)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:T(new C({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof b)return{type:`Repetition`,idx:e.idx,definition:t(e.definition)};if(e instanceof S)return{type:`Alternation`,idx:e.idx,definition:t(e.definition)};if(e instanceof C){var r={type:`Terminal`,name:e.terminalType.name,label:d(e.terminalType),idx:e.idx};(0,s.default)(e.label)&&(r.terminalLabel=e.label);var i=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(r.pattern=(0,c.default)(i)?i.source:i),r}if(e instanceof h)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error(`non exhaustive match`)}e.serializeProduction=T})),Fa=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GAstVisitor=void 0;var t=Pa();e.GAstVisitor=function(){function e(){}return e.prototype.visit=function(e){var n=e;switch(n.constructor){case t.NonTerminal:return this.visitNonTerminal(n);case t.Alternative:return this.visitAlternative(n);case t.Option:return this.visitOption(n);case t.RepetitionMandatory:return this.visitRepetitionMandatory(n);case t.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(n);case t.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(n);case t.Repetition:return this.visitRepetition(n);case t.Alternation:return this.visitAlternation(n);case t.Terminal:return this.visitTerminal(n);case t.Rule:return this.visitRule(n);default:throw Error(`non exhaustive match`)}},e.prototype.visitNonTerminal=function(e){},e.prototype.visitAlternative=function(e){},e.prototype.visitOption=function(e){},e.prototype.visitRepetition=function(e){},e.prototype.visitRepetitionMandatory=function(e){},e.prototype.visitRepetitionMandatoryWithSeparator=function(e){},e.prototype.visitRepetitionWithSeparator=function(e){},e.prototype.visitAlternation=function(e){},e.prototype.visitTerminal=function(e){},e.prototype.visitRule=function(e){},e}()})),Ia=o(((e,t)=>{var n=bi();function r(e,t){var r;return n(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}t.exports=r})),La=o(((e,t)=>{var n=Tr(),r=hi(),i=Ia(),a=In(),o=ja();function s(e,t,s){var c=a(e)?n:i;return s&&o(e,t,s)&&(t=void 0),c(e,r(t,3))}t.exports=s})),Ra=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}t.exports=n})),za=o(((e,t)=>{var n=bi();function r(e,t){var r=!0;return n(e,function(e,n,i){return r=!!t(e,n,i),r}),r}t.exports=r})),Ba=o(((e,t)=>{var n=Ra(),r=za(),i=hi(),a=In(),o=ja();function s(e,t,s){var c=a(e)?n:r;return s&&o(e,t,s)&&(t=void 0),c(e,i(t,3))}t.exports=s})),Va=o(((e,t)=>{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}t.exports=n})),Ha=o(((e,t)=>{function n(e){return e!==e}t.exports=n})),Ua=o(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}t.exports=n})),Wa=o(((e,t)=>{var n=Va(),r=Ha(),i=Ua();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),Ga=o(((e,t)=>{var n=Wa(),r=Rn(),i=va(),a=ga(),o=Di(),s=Math.max;function c(e,t,c,l){e=r(e)?e:o(e),c=c&&!l?a(c):0;var u=e.length;return c<0&&(c=s(u+c,0)),i(e)?c<=u&&e.indexOf(t,c)>-1:!!u&&n(e,t,c)>-1}t.exports=c})),Ka=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.getProductionDslName=e.isBranchingProd=e.isOptionalProd=e.isSequenceProd=void 0;var i=r(La()),a=r(Ba()),o=r(Ga()),s=Pa();function c(e){return e instanceof s.Alternative||e instanceof s.Option||e instanceof s.Repetition||e instanceof s.RepetitionMandatory||e instanceof s.RepetitionMandatoryWithSeparator||e instanceof s.RepetitionWithSeparator||e instanceof s.Terminal||e instanceof s.Rule}e.isSequenceProd=c;function l(e,t){return t===void 0&&(t=[]),e instanceof s.Option||e instanceof s.Repetition||e instanceof s.RepetitionWithSeparator?!0:e instanceof s.Alternation?(0,i.default)(e.definition,function(e){return l(e,t)}):e instanceof s.NonTerminal&&(0,o.default)(t,e)?!1:e instanceof s.AbstractProduction&&(e instanceof s.NonTerminal&&t.push(e),(0,a.default)(e.definition,function(e){return l(e,t)}))}e.isOptionalProd=l;function u(e){return e instanceof s.Alternation}e.isBranchingProd=u;function d(e){if(e instanceof s.NonTerminal)return`SUBRULE`;if(e instanceof s.Option)return`OPTION`;if(e instanceof s.Alternation)return`OR`;if(e instanceof s.RepetitionMandatory)return`AT_LEAST_ONE`;if(e instanceof s.RepetitionMandatoryWithSeparator)return`AT_LEAST_ONE_SEP`;if(e instanceof s.RepetitionWithSeparator)return`MANY_SEP`;if(e instanceof s.Repetition)return`MANY`;if(e instanceof s.Terminal)return`CONSUME`;throw Error(`non exhaustive match`)}e.getProductionDslName=d})),qa=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isSequenceProd=e.isBranchingProd=e.isOptionalProd=e.getProductionDslName=e.GAstVisitor=e.serializeProduction=e.serializeGrammar=e.Alternative=e.Alternation=e.RepetitionWithSeparator=e.RepetitionMandatoryWithSeparator=e.RepetitionMandatory=e.Repetition=e.Option=e.NonTerminal=e.Terminal=e.Rule=void 0;var t=Pa();Object.defineProperty(e,"Rule",{enumerable:!0,get:function(){return t.Rule}}),Object.defineProperty(e,"Terminal",{enumerable:!0,get:function(){return t.Terminal}}),Object.defineProperty(e,"NonTerminal",{enumerable:!0,get:function(){return t.NonTerminal}}),Object.defineProperty(e,"Option",{enumerable:!0,get:function(){return t.Option}}),Object.defineProperty(e,"Repetition",{enumerable:!0,get:function(){return t.Repetition}}),Object.defineProperty(e,"RepetitionMandatory",{enumerable:!0,get:function(){return t.RepetitionMandatory}}),Object.defineProperty(e,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return t.RepetitionMandatoryWithSeparator}}),Object.defineProperty(e,"RepetitionWithSeparator",{enumerable:!0,get:function(){return t.RepetitionWithSeparator}}),Object.defineProperty(e,"Alternation",{enumerable:!0,get:function(){return t.Alternation}}),Object.defineProperty(e,"Alternative",{enumerable:!0,get:function(){return t.Alternative}}),Object.defineProperty(e,"serializeGrammar",{enumerable:!0,get:function(){return t.serializeGrammar}}),Object.defineProperty(e,"serializeProduction",{enumerable:!0,get:function(){return t.serializeProduction}});var n=Fa();Object.defineProperty(e,"GAstVisitor",{enumerable:!0,get:function(){return n.GAstVisitor}});var r=Ka();Object.defineProperty(e,"getProductionDslName",{enumerable:!0,get:function(){return r.getProductionDslName}}),Object.defineProperty(e,"isOptionalProd",{enumerable:!0,get:function(){return r.isOptionalProd}}),Object.defineProperty(e,"isBranchingProd",{enumerable:!0,get:function(){return r.isBranchingProd}}),Object.defineProperty(e,"isSequenceProd",{enumerable:!0,get:function(){return r.isSequenceProd}})})),Ja=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.RestWalker=void 0;var i=r(_a()),a=r(Ti()),o=qa();e.RestWalker=function(){function e(){}return e.prototype.walk=function(e,t){var n=this;t===void 0&&(t=[]),(0,a.default)(e.definition,function(r,a){var s=(0,i.default)(e.definition,a+1);if(r instanceof o.NonTerminal)n.walkProdRef(r,s,t);else if(r instanceof o.Terminal)n.walkTerminal(r,s,t);else if(r instanceof o.Alternative)n.walkFlat(r,s,t);else if(r instanceof o.Option)n.walkOption(r,s,t);else if(r instanceof o.RepetitionMandatory)n.walkAtLeastOne(r,s,t);else if(r instanceof o.RepetitionMandatoryWithSeparator)n.walkAtLeastOneSep(r,s,t);else if(r instanceof o.RepetitionWithSeparator)n.walkManySep(r,s,t);else if(r instanceof o.Repetition)n.walkMany(r,s,t);else if(r instanceof o.Alternation)n.walkOr(r,s,t);else throw Error(`non exhaustive match`)})},e.prototype.walkTerminal=function(e,t,n){},e.prototype.walkProdRef=function(e,t,n){},e.prototype.walkFlat=function(e,t,n){var r=t.concat(n);this.walk(e,r)},e.prototype.walkOption=function(e,t,n){var r=t.concat(n);this.walk(e,r)},e.prototype.walkAtLeastOne=function(e,t,n){var r=[new o.Option({definition:e.definition})].concat(t,n);this.walk(e,r)},e.prototype.walkAtLeastOneSep=function(e,t,n){var r=s(e,t,n);this.walk(e,r)},e.prototype.walkMany=function(e,t,n){var r=[new o.Option({definition:e.definition})].concat(t,n);this.walk(e,r)},e.prototype.walkManySep=function(e,t,n){var r=s(e,t,n);this.walk(e,r)},e.prototype.walkOr=function(e,t,n){var r=this,i=t.concat(n);(0,a.default)(e.definition,function(e){var t=new o.Alternative({definition:[e]});r.walk(t,i)})},e}();function s(e,t,n){return[new o.Option({definition:[new o.Terminal({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}})),Ya=o(((e,t)=>{var n=hn(),r=Fn(),i=In(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),Xa=o(((e,t)=>{var n=Mr(),r=Ya();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c<l;){var u=e[c];t>0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),Za=o(((e,t)=>{var n=Xa();function r(e){return e!=null&&e.length?n(e,1):[]}t.exports=r})),Qa=o(((e,t)=>{var n=Wa();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),$a=o(((e,t)=>{function n(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}t.exports=n})),eo=o(((e,t)=>{function n(){}t.exports=n})),to=o(((e,t)=>{var n=An(),r=eo(),i=Ar();t.exports=n&&1/i(new n([,-0]))[1]==1/0?function(e){return new n(e)}:r})),no=o(((e,t)=>{var n=wr(),r=Qa(),i=$a(),a=Er(),o=to(),s=Ar(),c=200;function l(e,t,l){var u=-1,d=r,f=e.length,p=!0,m=[],h=m;if(l)p=!1,d=i;else if(f>=c){var g=t?null:o(e);if(g)return s(g);p=!1,d=a,h=new n}else h=t?[]:m;outer:for(;++u<f;){var _=e[u],v=t?t(_):_;if(_=l||_!==0?_:0,p&&v===v){for(var y=h.length;y--;)if(h[y]===v)continue outer;t&&h.push(v),m.push(_)}else d(h,v,l)||(h!==m&&h.push(v),m.push(_))}return m}t.exports=l})),ro=o(((e,t)=>{var n=no();function r(e){return e&&e.length?n(e):[]}t.exports=r})),io=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.firstForTerminal=e.firstForBranching=e.firstForSequence=e.first=void 0;var i=r(Za()),a=r(ro()),o=r(Si()),s=qa(),c=qa();function l(e){if(e instanceof s.NonTerminal)return l(e.referencedRule);if(e instanceof s.Terminal)return f(e);if((0,c.isSequenceProd)(e))return u(e);if((0,c.isBranchingProd)(e))return d(e);throw Error(`non exhaustive match`)}e.first=l;function u(e){for(var t=[],n=e.definition,r=0,i=n.length>r,o,s=!0;i&&s;)o=n[r],s=(0,c.isOptionalProd)(o),t=t.concat(l(o)),r+=1,i=n.length>r;return(0,a.default)(t)}e.firstForSequence=u;function d(e){var t=(0,o.default)(e.definition,function(e){return l(e)});return(0,a.default)((0,i.default)(t))}e.firstForBranching=d;function f(e){return[e.terminalType]}e.firstForTerminal=f})),ao=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IN=void 0,e.IN=`_~IN~_`})),oo=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.buildInProdFollowPrefix=e.buildBetweenProdsFollowPrefix=e.computeAllProdsFollows=e.ResyncFollowsWalker=void 0;var a=Ja(),o=io(),s=i(Ti()),c=i(Na()),l=ao(),u=qa(),d=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.topProd=t,n.follows={},n}return t.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},t.prototype.walkTerminal=function(e,t,n){},t.prototype.walkProdRef=function(e,t,n){var r=p(e.referencedRule,e.idx)+this.topProd.name,i=t.concat(n),a=new u.Alternative({definition:i}),s=(0,o.first)(a);this.follows[r]=s},t}(a.RestWalker);e.ResyncFollowsWalker=d;function f(e){var t={};return(0,s.default)(e,function(e){var n=new d(e).startWalking();(0,c.default)(t,n)}),t}e.computeAllProdsFollows=f;function p(e,t){return e.name+t+l.IN}e.buildBetweenProdsFollowPrefix=p;function m(e){return e.terminalType.name+e.idx+l.IN}e.buildInProdFollowPrefix=m})),so=o(((e,t)=>{function n(e){return e===void 0}t.exports=n})),co=o(((e,t,n)=>{(function(e,n){typeof define==`function`&&define.amd?define([],n):typeof t==`object`&&t.exports?t.exports=n():e.regexpToAst=n()})(typeof self<`u`?self:n,function(){function e(){}e.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},e.prototype.restoreState=function(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx},e.prototype.pattern=function(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);var t=this.disjunction();this.consumeChar(`/`);for(var n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case`g`:o(n,`global`);break;case`i`:o(n,`ignoreCase`);break;case`m`:o(n,`multiLine`);break;case`u`:o(n,`unicode`);break;case`y`:o(n,`sticky`)}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}},e.prototype.disjunction=function(){var e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}},e.prototype.alternative=function(){for(var e=[],t=this.idx;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}},e.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},e.prototype.assertion=function(){var e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:this.consumeChar(`?`);var t;switch(this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`}s(t);var n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}c()},e.prototype.quantifier=function(e){var t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:var r=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:r,atMost:r};break;case`,`:var i;this.isDigit()?(i=this.integerIncludingZero(),t={atLeast:r,atMost:i}):t={atLeast:r,atMost:1/0},this.consumeChar(`}`)}if(e===!0&&t===void 0)return;s(t)}if(e!==!0||t!==void 0)return s(t),this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t},e.prototype.atom=function(){var e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group()}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),s(e),e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e},e.prototype.dotAll=function(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[i(`
|
|
10
|
+
`),i(`\r`),i(`\u2028`),i(`\u2029`)]}},e.prototype.atomEscape=function(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.decimalEscapeAtom=function(){return{type:`GroupBackReference`,value:this.positiveInteger()}},e.prototype.characterClassEscape=function(){var e,t=!1;switch(this.popChar()){case`d`:e=u;break;case`D`:e=u,t=!0;break;case`s`:e=f;break;case`S`:e=f,t=!0;break;case`w`:e=d;break;case`W`:e=d,t=!0}return s(e),{type:`Set`,value:e,complement:t}},e.prototype.controlEscapeAtom=function(){var e;switch(this.popChar()){case`f`:e=i(`\f`);break;case`n`:e=i(`
|
|
11
|
+
`);break;case`r`:e=i(`\r`);break;case`t`:e=i(` `);break;case`v`:e=i(`\v`)}return s(e),{type:`Character`,value:e}},e.prototype.controlLetterEscapeAtom=function(){this.consumeChar(`c`);var e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error(`Invalid `);return{type:`Character`,value:e.toUpperCase().charCodeAt(0)-64}},e.prototype.nulCharacterAtom=function(){return this.consumeChar(`0`),{type:`Character`,value:i(`\0`)}},e.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar(`x`),this.parseHexDigits(2)},e.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar(`u`),this.parseHexDigits(4)},e.prototype.identityEscapeAtom=function(){return{type:`Character`,value:i(this.popChar())}},e.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
|
|
12
|
+
`:case`\r`:case`\u2028`:case`\u2029`:case`\\`:case`]`:throw Error(`TBD`);default:return{type:`Character`,value:i(this.popChar())}}},e.prototype.characterClass=function(){var e=[],t=!1;for(this.consumeChar(`[`),this.peekChar(0)===`^`&&(this.consumeChar(`^`),t=!0);this.isClassAtom();){var n=this.classAtom();if(n.type===`Character`&&this.isRangeDash()){this.consumeChar(`-`);var r=this.classAtom();if(r.type===`Character`){if(r.value<n.value)throw Error(`Range out of order in character class`);e.push({from:n.value,to:r.value})}else a(n.value,e),e.push(i(`-`)),a(r.value,e)}else a(n.value,e)}return this.consumeChar(`]`),{type:`Set`,complement:t,value:e}},e.prototype.classAtom=function(){switch(this.peekChar()){case`]`:case`
|
|
13
|
+
`:case`\r`:case`\u2028`:case`\u2029`:throw Error(`TBD`);case`\\`:return this.classEscape();default:return this.classPatternCharacterAtom()}},e.prototype.classEscape=function(){switch(this.consumeChar(`\\`),this.peekChar()){case`b`:return this.consumeChar(`b`),{type:`Character`,value:i(`\b`)};case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},e.prototype.group=function(){var e=!0;switch(this.consumeChar(`(`),this.peekChar(0)){case`?`:this.consumeChar(`?`),this.consumeChar(`:`),e=!1;break;default:this.groupIdx++}var t=this.disjunction();this.consumeChar(`)`);var n={type:`Group`,capturing:e,value:t};return e&&(n.idx=this.groupIdx),n},e.prototype.positiveInteger=function(){var e=this.popChar();if(r.test(e)===!1)throw Error(`Expecting a positive integer`);for(;n.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)},e.prototype.integerIncludingZero=function(){var e=this.popChar();if(n.test(e)===!1)throw Error(`Expecting an integer`);for(;n.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)},e.prototype.patternCharacter=function(){var e=this.popChar();switch(e){case`
|
|
14
|
+
`:case`\r`:case`\u2028`:case`\u2029`:case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:throw Error(`TBD`);default:return{type:`Character`,value:i(e)}}},e.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case`g`:case`i`:case`m`:case`u`:case`y`:return!0;default:return!1}},e.prototype.isRangeDash=function(){return this.peekChar()===`-`&&this.isClassAtom(1)},e.prototype.isDigit=function(){return n.test(this.peekChar(0))},e.prototype.isClassAtom=function(e){switch(e===void 0&&(e=0),this.peekChar(e)){case`]`:case`
|
|
15
|
+
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}},e.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},e.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case`.`:case`\\`:case`[`:case`(`:return!0;default:return!1}},e.prototype.isAssertion=function(){switch(this.peekChar(0)){case`^`:case`$`:return!0;case`\\`:switch(this.peekChar(1)){case`b`:case`B`:return!0;default:return!1}case`(`:return this.peekChar(1)===`?`&&(this.peekChar(2)===`=`||this.peekChar(2)===`!`);default:return!1}},e.prototype.isQuantifier=function(){var e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}},e.prototype.isPatternCharacter=function(){switch(this.peekChar()){case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:case`/`:case`
|
|
16
|
+
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}},e.prototype.parseHexDigits=function(e){for(var n=``,r=0;r<e;r++){var i=this.popChar();if(t.test(i)===!1)throw Error(`Expecting a HexDecimal digits`);n+=i}return{type:`Character`,value:parseInt(n,16)}},e.prototype.peekChar=function(e){return e===void 0&&(e=0),this.input[this.idx+e]},e.prototype.popChar=function(){var e=this.peekChar(0);return this.consumeChar(),e},e.prototype.consumeChar=function(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error(`Expected: '`+e+`' but found: '`+this.input[this.idx]+`' at offset: `+this.idx);if(this.idx>=this.input.length)throw Error(`Unexpected end of input`);this.idx++},e.prototype.loc=function(e){return{begin:e,end:this.idx}};var t=/[0-9a-fA-F]/,n=/[0-9]/,r=/[1-9]/;function i(e){return e.charCodeAt(0)}function a(e,t){e.length===void 0?t.push(e):e.forEach(function(e){t.push(e)})}function o(e,t){if(e[t]===!0)throw`duplicate flag `+t;e[t]=!0}function s(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`)}function c(){throw Error(`Internal Error - Should never get here!`)}var l,u=[];for(l=i(`0`);l<=i(`9`);l++)u.push(l);var d=[i(`_`)].concat(u);for(l=i(`a`);l<=i(`z`);l++)d.push(l);for(l=i(`A`);l<=i(`Z`);l++)d.push(l);var f=[i(` `),i(`\f`),i(`
|
|
17
|
+
`),i(`\r`),i(` `),i(`\v`),i(` `),i(`\xA0`),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(` `),i(`\u2028`),i(`\u2029`),i(` `),i(` `),i(` `),i(``)];function p(){}return p.prototype.visitChildren=function(e){for(var t in e){var n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(function(e){this.visit(e)},this):this.visit(n))}},p.prototype.visit=function(e){switch(e.type){case`Pattern`:this.visitPattern(e);break;case`Flags`:this.visitFlags(e);break;case`Disjunction`:this.visitDisjunction(e);break;case`Alternative`:this.visitAlternative(e);break;case`StartAnchor`:this.visitStartAnchor(e);break;case`EndAnchor`:this.visitEndAnchor(e);break;case`WordBoundary`:this.visitWordBoundary(e);break;case`NonWordBoundary`:this.visitNonWordBoundary(e);break;case`Lookahead`:this.visitLookahead(e);break;case`NegativeLookahead`:this.visitNegativeLookahead(e);break;case`Character`:this.visitCharacter(e);break;case`Set`:this.visitSet(e);break;case`Group`:this.visitGroup(e);break;case`GroupBackReference`:this.visitGroupBackReference(e);break;case`Quantifier`:this.visitQuantifier(e)}this.visitChildren(e)},p.prototype.visitPattern=function(e){},p.prototype.visitFlags=function(e){},p.prototype.visitDisjunction=function(e){},p.prototype.visitAlternative=function(e){},p.prototype.visitStartAnchor=function(e){},p.prototype.visitEndAnchor=function(e){},p.prototype.visitWordBoundary=function(e){},p.prototype.visitNonWordBoundary=function(e){},p.prototype.visitLookahead=function(e){},p.prototype.visitNegativeLookahead=function(e){},p.prototype.visitCharacter=function(e){},p.prototype.visitSet=function(e){},p.prototype.visitGroup=function(e){},p.prototype.visitGroupBackReference=function(e){},p.prototype.visitQuantifier=function(e){},{RegExpParser:e,BaseRegExpVisitor:p,VERSION:`0.5.0`}})})),lo=o(((e,t)=>{function n(e){return e&&e.length?e[0]:void 0}t.exports=n})),uo=o(((e,t)=>{t.exports=lo()})),fo=o(((e,t)=>{function n(e){for(var t=-1,n=e==null?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i}t.exports=n})),po=o(((e,t)=>{var n=bi();function r(e,t){var r=[];return n(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}t.exports=r})),mo=o(((e,t)=>{function n(e){if(typeof e!=`function`)throw TypeError(`Expected a function`);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}t.exports=n})),ho=o(((e,t)=>{var n=Pr(),r=po(),i=hi(),a=In(),o=mo();function s(e,t){return(a(e)?n:r)(e,o(i(t,3)))}t.exports=s})),go=o(((e,t)=>{var n=wr(),r=Qa(),i=$a(),a=Kn(),o=Hn(),s=Er(),c=200;function l(e,t,l,u){var d=-1,f=r,p=!0,m=e.length,h=[],g=t.length;if(!m)return h;l&&(t=a(t,o(l))),u?(f=i,p=!1):t.length>=c&&(f=s,p=!1,t=new n(t));outer:for(;++d<m;){var _=e[d],v=l==null?_:l(_);if(_=u||_!==0?_:0,p&&v===v){for(var y=g;y--;)if(t[y]===v)continue outer;h.push(_)}else f(t,v,u)||h.push(_)}return h}t.exports=l})),_o=o(((e,t)=>{var n=Rn(),r=Nn();function i(e){return r(e)&&n(e)}t.exports=i})),vo=o(((e,t)=>{var n=go(),r=Xa(),i=Aa(),a=_o();t.exports=i(function(e,t){return a(e)?n(e,r(t,1,a,!0)):[]})})),yo=o(((e,t)=>{var n=Wa(),r=ga(),i=Math.max;function a(e,t,a){var o=e==null?0:e.length;if(!o)return-1;var s=a==null?0:r(a);return s<0&&(s=i(o+s,0)),n(e,t,s)}t.exports=a})),bo=o(((e,t)=>{var n=hi(),r=Rn(),i=Br();function a(e){return function(t,a,o){var s=Object(t);if(!r(t)){var c=n(a,3);t=i(t),a=function(e){return c(s[e],e,s)}}var l=e(t,a,o);return l>-1?s[c?t[l]:l]:void 0}}t.exports=a})),xo=o(((e,t)=>{var n=Va(),r=hi(),i=ga(),a=Math.max;function o(e,t,o){var s=e==null?0:e.length;if(!s)return-1;var c=o==null?0:i(o);return c<0&&(c=a(s+c,0)),n(e,r(t,3),c)}t.exports=o})),So=o(((e,t)=>{t.exports=bo()(xo())})),Co=o(((e,t)=>{var n=Pr(),r=po(),i=hi(),a=In();function o(e,t){return(a(e)?n:r)(e,i(t,3))}t.exports=o})),wo=o(((e,t)=>{var n=Aa(),r=Jn(),i=ja(),a=Li(),o=Object.prototype,s=o.hasOwnProperty;t.exports=n(function(e,t){e=Object(e);var n=-1,c=t.length,l=c>2?t[2]:void 0;for(l&&i(t[0],t[1],l)&&(c=1);++n<c;)for(var u=t[n],d=a(u),f=-1,p=d.length;++f<p;){var m=d[f],h=e[m];(h===void 0||r(h,o[m])&&!s.call(e,m))&&(e[m]=u[m])}return e})})),To=o(((e,t)=>{function n(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}t.exports=n})),Eo=o(((e,t)=>{function n(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}t.exports=n})),Do=o(((e,t)=>{var n=To(),r=bi(),i=hi(),a=Eo(),o=In();function s(e,t,s){var c=o(e)?n:a,l=arguments.length<3;return c(e,i(t,4),s,l,r)}t.exports=s})),Oo=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.clearRegExpParserCache=e.getRegExpAst=void 0;var t=co(),n={},r=new t.RegExpParser;function i(e){var t=e.toString();if(n.hasOwnProperty(t))return n[t];var i=r.pattern(t);return n[t]=i,i}e.getRegExpAst=i;function a(){n={}}e.clearRegExpParserCache=a})),ko=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.canMatchCharCode=e.firstCharOptimizedIndices=e.getOptimizedStartCodesIndices=e.failedOptimizationPrefixMsg=void 0;var a=co(),o=i(In()),s=i(Ba()),c=i(Ti()),l=i(So()),u=i(Di()),d=i(Ga()),f=ua(),p=Oo(),m=Ao(),h=`Complement Sets are not supported for first char optimization`;e.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
|
|
18
|
+
`;function g(t,n){n===void 0&&(n=!1);try{var r=(0,p.getRegExpAst)(t);return _(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===h)n&&(0,f.PRINT_WARNING)(`${e.failedOptimizationPrefixMsg} Unable to optimize: < ${t.toString()} >
|
|
19
|
+
Complement Sets cannot be automatically optimized.
|
|
20
|
+
This will disable the lexer's first char optimizations.
|
|
21
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{var i=``;n&&(i=`
|
|
22
|
+
This will disable the lexer's first char optimizations.
|
|
23
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),(0,f.PRINT_ERROR)(`${e.failedOptimizationPrefixMsg}
|
|
24
|
+
Failed parsing: < ${t.toString()} >
|
|
25
|
+
Using the regexp-to-ast library version: ${a.VERSION}
|
|
26
|
+
Please open an issue at: https://github.com/bd82/regexp-to-ast/issues`+i)}}return[]}e.getOptimizedStartCodesIndices=g;function _(e,t,n){switch(e.type){case`Disjunction`:for(var r=0;r<e.value.length;r++)_(e.value[r],t,n);break;case`Alternative`:for(var i=e.value,r=0;r<i.length;r++){var a=i[r];switch(a.type){case`EndAnchor`:case`GroupBackReference`:case`Lookahead`:case`NegativeLookahead`:case`StartAnchor`:case`WordBoundary`:case`NonWordBoundary`:continue}var o=a;switch(o.type){case`Character`:v(o.value,t,n);break;case`Set`:if(o.complement===!0)throw Error(h);(0,c.default)(o.value,function(e){if(typeof e==`number`)v(e,t,n);else{var r=e;if(n===!0)for(var i=r.from;i<=r.to;i++)v(i,t,n);else{for(var i=r.from;i<=r.to&&i<m.minOptimizationVal;i++)v(i,t,n);if(r.to>=m.minOptimizationVal)for(var a=r.from>=m.minOptimizationVal?r.from:m.minOptimizationVal,o=r.to,s=(0,m.charCodeToOptimizedIndex)(a),c=(0,m.charCodeToOptimizedIndex)(o),l=s;l<=c;l++)t[l]=l}}});break;case`Group`:_(o.value,t,n);break;default:throw Error(`Non Exhaustive Match`)}var s=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type===`Group`&&x(o)===!1||o.type!==`Group`&&s===!1)break}break;default:throw Error(`non exhaustive match!`)}return(0,u.default)(t)}e.firstCharOptimizedIndices=_;function v(e,t,n){var r=(0,m.charCodeToOptimizedIndex)(e);t[r]=r,n===!0&&y(e,t)}function y(e,t){var n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){var i=(0,m.charCodeToOptimizedIndex)(r.charCodeAt(0));t[i]=i}else{var a=n.toLowerCase();if(a!==n){var i=(0,m.charCodeToOptimizedIndex)(a.charCodeAt(0));t[i]=i}}}function b(e,t){return(0,l.default)(e.value,function(e){if(typeof e==`number`)return(0,d.default)(t,e);var n=e;return(0,l.default)(t,function(e){return n.from<=e&&e<=n.to})!==void 0})}function x(e){var t=e.quantifier;return t&&t.atLeast===0?!0:e.value?(0,o.default)(e.value)?(0,s.default)(e.value,x):x(e.value):!1}var S=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n.targetCharCodes=t,n.found=!1,n}return t.prototype.visitChildren=function(t){if(this.found!==!0){switch(t.type){case`Lookahead`:this.visitLookahead(t);return;case`NegativeLookahead`:this.visitNegativeLookahead(t);return}e.prototype.visitChildren.call(this,t)}},t.prototype.visitCharacter=function(e){(0,d.default)(this.targetCharCodes,e.value)&&(this.found=!0)},t.prototype.visitSet=function(e){e.complement?b(e,this.targetCharCodes)===void 0&&(this.found=!0):b(e,this.targetCharCodes)!==void 0&&(this.found=!0)},t}(a.BaseRegExpVisitor);function C(e,t){if(t instanceof RegExp){var n=(0,p.getRegExpAst)(t),r=new S(e);return r.visit(n),r.found}return(0,l.default)(t,function(t){return(0,d.default)(e,t.charCodeAt(0))})!==void 0}e.canMatchCharCode=C})),Ao=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.charCodeToOptimizedIndex=e.minOptimizationVal=e.buildLineBreakIssueMessage=e.LineTerminatorOptimizedTester=e.isShortPattern=e.isCustomPattern=e.cloneEmptyGroups=e.performWarningRuntimeChecks=e.performRuntimeChecks=e.addStickyFlag=e.addStartOfInput=e.findUnreachablePatterns=e.findModesThatDoNotExist=e.findInvalidGroupType=e.findDuplicatePatterns=e.findUnsupportedFlags=e.findStartOfInputAnchor=e.findEmptyMatchRegExps=e.findEndOfInputAnchor=e.findInvalidPatterns=e.findMissingPatterns=e.validatePatterns=e.analyzeTokenTypes=e.enableSticky=e.disableSticky=e.SUPPORT_STICKY=e.MODES=e.DEFAULT_MODE=void 0;var a=co(),o=Po(),s=i(uo()),c=i(Gn()),l=i(fo()),u=i(In()),d=i(Di()),f=i(Za()),p=i(ho()),m=i(vo()),h=i(yo()),g=i(Si()),_=i(Ti()),v=i(va()),y=i(bn()),b=i(so()),x=i(So()),S=i(ki()),C=i(Br()),w=i(ba()),T=i(Co()),E=i(wo()),D=i(Do()),O=i(Ga()),k=ua(),A=ko(),j=Oo(),M=`PATTERN`;e.DEFAULT_MODE=`defaultMode`,e.MODES=`modes`,e.SUPPORT_STICKY=typeof RegExp(`(?:)`).sticky==`boolean`;function ee(){e.SUPPORT_STICKY=!1}e.disableSticky=ee;function N(){e.SUPPORT_STICKY=!0}e.enableSticky=N;function P(t,n){n=(0,E.default)(n,{useSticky:e.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:`full`,lineTerminatorCharacters:[`\r`,`
|
|
27
|
+
`],tracer:function(e,t){return t()}});var r=n.tracer;r(`initCharCodeToOptimizedIndexMap`,function(){Ee()});var i;r(`Reject Lexer.NA`,function(){i=(0,p.default)(t,function(e){return e[M]===o.Lexer.NA})});var a=!1,s;r(`Transform Patterns`,function(){a=!1,s=(0,g.default)(i,function(e){var t=e[M];if((0,w.default)(t)){var r=t.source;return r.length===1&&r!==`^`&&r!==`$`&&r!==`.`&&!t.ignoreCase?r:r.length===2&&r[0]===`\\`&&!(0,O.default)([`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`],r[1])?r[1]:n.useSticky?R(t):L(t)}if((0,y.default)(t))return a=!0,{exec:t};if(typeof t==`object`)return a=!0,t;if(typeof t==`string`){if(t.length===1)return t;var i=t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`),o=new RegExp(i);return n.useSticky?R(o):L(o)}throw Error(`non exhaustive match`)})});var l,d,f,m,x;r(`misc mapping`,function(){l=(0,g.default)(i,function(e){return e.tokenTypeIdx}),d=(0,g.default)(i,function(e){var t=e.GROUP;if(t!==o.Lexer.SKIPPED){if((0,v.default)(t))return t;if((0,b.default)(t))return!1;throw Error(`non exhaustive match`)}}),f=(0,g.default)(i,function(e){var t=e.LONGER_ALT;if(t)return(0,u.default)(t)?(0,g.default)(t,function(e){return(0,h.default)(i,e)}):[(0,h.default)(i,t)]}),m=(0,g.default)(i,function(e){return e.PUSH_MODE}),x=(0,g.default)(i,function(e){return(0,S.default)(e,`POP_MODE`)})});var C;r(`Line Terminator Handling`,function(){var e=Se(n.lineTerminatorCharacters);C=(0,g.default)(i,function(e){return!1}),n.positionTracking!==`onlyOffset`&&(C=(0,g.default)(i,function(t){return(0,S.default)(t,`LINE_BREAKS`)?!!t.LINE_BREAKS:be(t,e)===!1&&(0,A.canMatchCharCode)(e,t.PATTERN)}))});var T,j,ee,N;r(`Misc Mapping #2`,function(){T=(0,g.default)(i,ve),j=(0,g.default)(s,ye),ee=(0,D.default)(i,function(e,t){var n=t.GROUP;return(0,v.default)(n)&&n!==o.Lexer.SKIPPED&&(e[n]=[]),e},{}),N=(0,g.default)(s,function(e,t){return{pattern:s[t],longerAlt:f[t],canLineTerminator:C[t],isCustom:T[t],short:j[t],group:d[t],push:m[t],pop:x[t],tokenTypeIdx:l[t],tokenType:i[t]}})});var P=!0,te=[];return n.safeMode||r(`First Char Optimization`,function(){te=(0,D.default)(i,function(e,t,r){if(typeof t.PATTERN==`string`)Ce(e,Te(t.PATTERN.charCodeAt(0)),N[r]);else if((0,u.default)(t.START_CHARS_HINT)){var i;(0,_.default)(t.START_CHARS_HINT,function(t){var n=Te(typeof t==`string`?t.charCodeAt(0):t);i!==n&&(i=n,Ce(e,n,N[r]))})}else if((0,w.default)(t.PATTERN)){if(t.PATTERN.unicode)P=!1,n.ensureOptimizations&&(0,k.PRINT_ERROR)(`${A.failedOptimizationPrefixMsg} Unable to analyze < ${t.PATTERN.toString()} > pattern.
|
|
28
|
+
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
29
|
+
This will disable the lexer's first char optimizations.
|
|
30
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var a=(0,A.getOptimizedStartCodesIndices)(t.PATTERN,n.ensureOptimizations);(0,c.default)(a)&&(P=!1),(0,_.default)(a,function(t){Ce(e,t,N[r])})}}else n.ensureOptimizations&&(0,k.PRINT_ERROR)(`${A.failedOptimizationPrefixMsg} TokenType: <${t.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
31
|
+
This will disable the lexer's first char optimizations.
|
|
32
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),P=!1;return e},[])}),{emptyGroups:ee,patternIdxToConfig:N,charCodeToPatternIdxToConfig:te,hasCustom:a,canBeOptimized:P}}e.analyzeTokenTypes=P;function te(e,t){var n=[],r=re(e);n=n.concat(r.errors);var i=ie(r.valid),a=i.valid;return n=n.concat(i.errors),n=n.concat(ne(a)),n=n.concat(F(a)),n=n.concat(fe(a,t)),n=n.concat(pe(a)),n}e.validatePatterns=te;function ne(e){var t=[],n=(0,T.default)(e,function(e){return(0,w.default)(e[M])});return t=t.concat(oe(n)),t=t.concat(le(n)),t=t.concat(ue(n)),t=t.concat(de(n)),t=t.concat(se(n)),t}function re(e){var t=(0,T.default)(e,function(e){return!(0,S.default)(e,M)});return{errors:(0,g.default)(t,function(e){return{message:`Token Type: ->`+e.name+`<- missing static 'PATTERN' property`,type:o.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[e]}}),valid:(0,m.default)(e,t)}}e.findMissingPatterns=re;function ie(e){var t=(0,T.default)(e,function(e){var t=e[M];return!(0,w.default)(t)&&!(0,y.default)(t)&&!(0,S.default)(t,`exec`)&&!(0,v.default)(t)});return{errors:(0,g.default)(t,function(e){return{message:`Token Type: ->`+e.name+`<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.`,type:o.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[e]}}),valid:(0,m.default)(e,t)}}e.findInvalidPatterns=ie;var ae=/[^\\][$]/;function oe(e){var t=function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.found=!1,t}return t.prototype.visitEndAnchor=function(e){this.found=!0},t}(a.BaseRegExpVisitor),n=(0,T.default)(e,function(e){var n=e.PATTERN;try{var r=(0,j.getRegExpAst)(n),i=new t;return i.visit(r),i.found}catch{return ae.test(n.source)}});return(0,g.default)(n,function(e){return{message:`Unexpected RegExp Anchor Error:
|
|
33
|
+
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
34
|
+
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:o.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[e]}})}e.findEndOfInputAnchor=oe;function se(e){var t=(0,T.default)(e,function(e){return e.PATTERN.test(``)});return(0,g.default)(t,function(e){return{message:`Token Type: ->`+e.name+`<- static 'PATTERN' must not match an empty string`,type:o.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[e]}})}e.findEmptyMatchRegExps=se;var ce=/[^\\[][\^]|^\^/;function le(e){var t=function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.found=!1,t}return t.prototype.visitStartAnchor=function(e){this.found=!0},t}(a.BaseRegExpVisitor),n=(0,T.default)(e,function(e){var n=e.PATTERN;try{var r=(0,j.getRegExpAst)(n),i=new t;return i.visit(r),i.found}catch{return ce.test(n.source)}});return(0,g.default)(n,function(e){return{message:`Unexpected RegExp Anchor Error:
|
|
35
|
+
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
36
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:o.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[e]}})}e.findStartOfInputAnchor=le;function ue(e){var t=(0,T.default)(e,function(e){var t=e[M];return t instanceof RegExp&&(t.multiline||t.global)});return(0,g.default)(t,function(e){return{message:`Token Type: ->`+e.name+`<- static 'PATTERN' may NOT contain global('g') or multiline('m')`,type:o.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}})}e.findUnsupportedFlags=ue;function de(e){var t=[],n=(0,g.default)(e,function(n){return(0,D.default)(e,function(e,r){return n.PATTERN.source===r.PATTERN.source&&!(0,O.default)(t,r)&&r.PATTERN!==o.Lexer.NA&&(t.push(r),e.push(r)),e},[])});n=(0,l.default)(n);var r=(0,T.default)(n,function(e){return e.length>1});return(0,g.default)(r,function(e){var t=(0,g.default)(e,function(e){return e.name});return{message:`The same RegExp pattern ->${(0,s.default)(e).PATTERN}<-has been used in all of the following Token Types: ${t.join(`, `)} <-`,type:o.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})}e.findDuplicatePatterns=de;function F(e){var t=(0,T.default)(e,function(e){if(!(0,S.default)(e,`GROUP`))return!1;var t=e.GROUP;return t!==o.Lexer.SKIPPED&&t!==o.Lexer.NA&&!(0,v.default)(t)});return(0,g.default)(t,function(e){return{message:`Token Type: ->`+e.name+`<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String`,type:o.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}})}e.findInvalidGroupType=F;function fe(e,t){var n=(0,T.default)(e,function(e){return e.PUSH_MODE!==void 0&&!(0,O.default)(t,e.PUSH_MODE)});return(0,g.default)(n,function(e){return{message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:o.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}})}e.findModesThatDoNotExist=fe;function pe(e){var t=[],n=(0,D.default)(e,function(e,t,n){var r=t.PATTERN;return r===o.Lexer.NA||((0,v.default)(r)?e.push({str:r,idx:n,tokenType:t}):(0,w.default)(r)&&I(r)&&e.push({str:r.source,idx:n,tokenType:t})),e},[]);return(0,_.default)(e,function(e,r){(0,_.default)(n,function(n){var i=n.str,a=n.idx,s=n.tokenType;if(r<a&&me(i,e.PATTERN)){var c=`Token: ->${s.name}<- can never be matched.
|
|
37
|
+
Because it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.
|
|
38
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:c,type:o.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[e,s]})}})}),t}e.findUnreachablePatterns=pe;function me(e,t){if((0,w.default)(t)){var n=t.exec(e);return n!==null&&n.index===0}if((0,y.default)(t))return t(e,0,[],{});if((0,S.default)(t,`exec`))return t.exec(e,0,[],{});if(typeof t==`string`)return t===e;throw Error(`non exhaustive match`)}function I(e){return(0,x.default)([`.`,`\\`,`[`,`]`,`|`,`^`,`$`,`(`,`)`,`?`,`*`,`+`,`{`],function(t){return e.source.indexOf(t)!==-1})===void 0}function L(e){var t=e.ignoreCase?`i`:``;return RegExp(`^(?:${e.source})`,t)}e.addStartOfInput=L;function R(e){var t=e.ignoreCase?`iy`:`y`;return RegExp(`${e.source}`,t)}e.addStickyFlag=R;function he(t,n,r){var i=[];return(0,S.default)(t,e.DEFAULT_MODE)||i.push({message:`A MultiMode Lexer cannot be initialized without a <`+e.DEFAULT_MODE+`> property in its definition
|
|
39
|
+
`,type:o.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,S.default)(t,e.MODES)||i.push({message:`A MultiMode Lexer cannot be initialized without a <`+e.MODES+`> property in its definition
|
|
40
|
+
`,type:o.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,S.default)(t,e.MODES)&&(0,S.default)(t,e.DEFAULT_MODE)&&!(0,S.default)(t.modes,t.defaultMode)&&i.push({message:`A MultiMode Lexer cannot be initialized with a ${e.DEFAULT_MODE}: <${t.defaultMode}>which does not exist
|
|
41
|
+
`,type:o.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,S.default)(t,e.MODES)&&(0,_.default)(t.modes,function(e,t){(0,_.default)(e,function(n,r){if((0,b.default)(n))i.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${t}> at index: <${r}>
|
|
42
|
+
`,type:o.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if((0,S.default)(n,`LONGER_ALT`)){var a=(0,u.default)(n.LONGER_ALT)?n.LONGER_ALT:[n.LONGER_ALT];(0,_.default)(a,function(r){!(0,b.default)(r)&&!(0,O.default)(e,r)&&i.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${r.name}> on token <${n.name}> outside of mode <${t}>
|
|
43
|
+
`,type:o.LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),i}e.performRuntimeChecks=he;function ge(e,t,n){var r=[],i=!1,a=(0,l.default)((0,f.default)((0,d.default)(e.modes))),s=(0,p.default)(a,function(e){return e[M]===o.Lexer.NA}),c=Se(n);return t&&(0,_.default)(s,function(e){var t=be(e,c);if(t!==!1){var n={message:xe(e,t),type:t.issue,tokenType:e};r.push(n)}else(0,S.default)(e,`LINE_BREAKS`)?e.LINE_BREAKS===!0&&(i=!0):(0,A.canMatchCharCode)(c,e.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
|
|
44
|
+
This Lexer has been defined to track line and column information,
|
|
45
|
+
But none of the Token Types can be identified as matching a line terminator.
|
|
46
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
47
|
+
for details.`,type:o.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),r}e.performWarningRuntimeChecks=ge;function _e(e){var t={},n=(0,C.default)(e);return(0,_.default)(n,function(n){var r=e[n];if((0,u.default)(r))t[n]=[];else throw Error(`non exhaustive match`)}),t}e.cloneEmptyGroups=_e;function ve(e){var t=e.PATTERN;if((0,w.default)(t))return!1;if((0,y.default)(t)||(0,S.default)(t,`exec`))return!0;if((0,v.default)(t))return!1;throw Error(`non exhaustive match`)}e.isCustomPattern=ve;function ye(e){return(0,v.default)(e)&&e.length===1?e.charCodeAt(0):!1}e.isShortPattern=ye,e.LineTerminatorOptimizedTester={test:function(e){for(var t=e.length,n=this.lastIndex;n<t;n++){var r=e.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return this.lastIndex=e.charCodeAt(n+1)===10?n+2:n+1,!0}return!1},lastIndex:0};function be(e,t){if((0,S.default)(e,`LINE_BREAKS`))return!1;if((0,w.default)(e.PATTERN)){try{(0,A.canMatchCharCode)(t,e.PATTERN)}catch(e){return{issue:o.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if((0,v.default)(e.PATTERN))return!1;if(ve(e))return{issue:o.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error(`non exhaustive match`)}function xe(e,t){if(t.issue===o.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
48
|
+
The problem is in the <${e.name}> Token Type
|
|
49
|
+
Root cause: ${t.errMsg}.
|
|
50
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===o.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
51
|
+
The problem is in the <${e.name}> Token Type
|
|
52
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error(`non exhaustive match`)}e.buildLineBreakIssueMessage=xe;function Se(e){return(0,g.default)(e,function(e){return(0,v.default)(e)?e.charCodeAt(0):e})}function Ce(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}e.minOptimizationVal=256;var we=[];function Te(t){return t<e.minOptimizationVal?t:we[t]}e.charCodeToOptimizedIndex=Te;function Ee(){if((0,c.default)(we)){we=Array(65536);for(var e=0;e<65536;e++)we[e]=e>255?255+~~(e/255):e}}})),jo=o(((e,t)=>{function n(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}t.exports=n})),Mo=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.isTokenType=e.hasExtendingTokensTypesMapProperty=e.hasExtendingTokensTypesProperty=e.hasCategoriesProperty=e.hasShortKeyProperty=e.singleAssignCategoriesToksMap=e.assignCategoriesMapProp=e.assignCategoriesTokensProp=e.assignTokenDefaultProps=e.expandCategories=e.augmentTokenTypes=e.tokenIdxToClass=e.tokenShortNameIdx=e.tokenStructuredMatcherNoCategories=e.tokenStructuredMatcher=void 0;var i=r(Gn()),a=r(fo()),o=r(In()),s=r(Za()),c=r(vo()),l=r(Si()),u=r(Ti()),d=r(ki()),f=r(Ga()),p=r(oa());function m(e,t){var n=e.tokenTypeIdx;return n===t.tokenTypeIdx||t.isParent===!0&&t.categoryMatchesMap[n]===!0}e.tokenStructuredMatcher=m;function h(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}e.tokenStructuredMatcherNoCategories=h,e.tokenShortNameIdx=1,e.tokenIdxToClass={};function g(e){var t=_(e);v(t),b(t),y(t),(0,u.default)(t,function(e){e.isParent=e.categoryMatches.length>0})}e.augmentTokenTypes=g;function _(e){for(var t=(0,p.default)(e),n=e,r=!0;r;){n=(0,a.default)((0,s.default)((0,l.default)(n,function(e){return e.CATEGORIES})));var o=(0,c.default)(n,t);t=t.concat(o),(0,i.default)(o)?r=!1:n=o}return t}e.expandCategories=_;function v(t){(0,u.default)(t,function(t){S(t)||(e.tokenIdxToClass[e.tokenShortNameIdx]=t,t.tokenTypeIdx=e.tokenShortNameIdx++),C(t)&&!(0,o.default)(t.CATEGORIES)&&(t.CATEGORIES=[t.CATEGORIES]),C(t)||(t.CATEGORIES=[]),w(t)||(t.categoryMatches=[]),T(t)||(t.categoryMatchesMap={})})}e.assignTokenDefaultProps=v;function y(t){(0,u.default)(t,function(t){t.categoryMatches=[],(0,u.default)(t.categoryMatchesMap,function(n,r){t.categoryMatches.push(e.tokenIdxToClass[r].tokenTypeIdx)})})}e.assignCategoriesTokensProp=y;function b(e){(0,u.default)(e,function(e){x([],e)})}e.assignCategoriesMapProp=b;function x(e,t){(0,u.default)(e,function(e){t.categoryMatchesMap[e.tokenTypeIdx]=!0}),(0,u.default)(t.CATEGORIES,function(n){var r=e.concat(t);(0,f.default)(r,n)||x(r,n)})}e.singleAssignCategoriesToksMap=x;function S(e){return(0,d.default)(e,`tokenTypeIdx`)}e.hasShortKeyProperty=S;function C(e){return(0,d.default)(e,`CATEGORIES`)}e.hasCategoriesProperty=C;function w(e){return(0,d.default)(e,`categoryMatches`)}e.hasExtendingTokensTypesProperty=w;function T(e){return(0,d.default)(e,`categoryMatchesMap`)}e.hasExtendingTokensTypesMapProperty=T;function E(e){return(0,d.default)(e,`tokenTypeIdx`)}e.isTokenType=E})),No=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultLexerErrorProvider=void 0,e.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage:function(e,t,n,r,i){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`}}})),Po=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=e.LexerDefinitionErrorType=void 0;var i=Ao(),a=r(eo()),o=r(Gn()),s=r(In()),c=r(jo()),l=r(ho()),u=r(Si()),d=r(Ti()),f=r(Br()),p=r(so()),m=r(di()),h=r(Na()),g=r(Do()),_=r(oa()),v=ua(),y=Mo(),b=No(),x=Oo();(function(e){e[e.MISSING_PATTERN=0]=`MISSING_PATTERN`,e[e.INVALID_PATTERN=1]=`INVALID_PATTERN`,e[e.EOI_ANCHOR_FOUND=2]=`EOI_ANCHOR_FOUND`,e[e.UNSUPPORTED_FLAGS_FOUND=3]=`UNSUPPORTED_FLAGS_FOUND`,e[e.DUPLICATE_PATTERNS_FOUND=4]=`DUPLICATE_PATTERNS_FOUND`,e[e.INVALID_GROUP_TYPE_FOUND=5]=`INVALID_GROUP_TYPE_FOUND`,e[e.PUSH_MODE_DOES_NOT_EXIST=6]=`PUSH_MODE_DOES_NOT_EXIST`,e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]=`MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE`,e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]=`MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY`,e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]=`MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST`,e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]=`LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED`,e[e.SOI_ANCHOR_FOUND=11]=`SOI_ANCHOR_FOUND`,e[e.EMPTY_MATCH_PATTERN=12]=`EMPTY_MATCH_PATTERN`,e[e.NO_LINE_BREAKS_FLAGS=13]=`NO_LINE_BREAKS_FLAGS`,e[e.UNREACHABLE_PATTERN=14]=`UNREACHABLE_PATTERN`,e[e.IDENTIFY_TERMINATOR=15]=`IDENTIFY_TERMINATOR`,e[e.CUSTOM_LINE_BREAK=16]=`CUSTOM_LINE_BREAK`,e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]=`MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE`})(e.LexerDefinitionErrorType||={});var S={deferDefinitionErrorsHandling:!1,positionTracking:`full`,lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
53
|
+
`,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:b.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(S),e.Lexer=function(){function e(e,t){t===void 0&&(t=S);var n=this;if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=function(e,t){if(n.traceInitPerf===!0){n.traceInitIndent++;var r=Array(n.traceInitIndent+1).join(` `);n.traceInitIndent<n.traceInitMaxIdent&&console.log(`${r}--> <${e}>`);var i=(0,v.timer)(t),a=i.time,o=i.value,s=a>10?console.warn:console.log;return n.traceInitIndent<n.traceInitMaxIdent&&s(`${r}<-- <${e}> time: ${a}ms`),n.traceInitIndent--,o}return t()},typeof t==`boolean`)throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
54
|
+
a boolean 2nd argument is no longer supported`);this.config=(0,h.default)({},S,t);var r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r==`number`&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT(`Lexer Constructor`,function(){var r,c=!0;n.TRACE_INIT(`Lexer Config handling`,function(){if(n.config.lineTerminatorsPattern===S.lineTerminatorsPattern)n.config.lineTerminatorsPattern=i.LineTerminatorOptimizedTester;else if(n.config.lineTerminatorCharacters===S.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
55
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error(`"safeMode" and "ensureOptimizations" flags are mutually exclusive.`);n.trackStartLines=/full|onlyStart/i.test(n.config.positionTracking),n.trackEndLines=/full/i.test(n.config.positionTracking),(0,s.default)(e)?r={modes:{defaultMode:(0,_.default)(e)},defaultMode:i.DEFAULT_MODE}:(c=!1,r=(0,_.default)(e))}),n.config.skipValidations===!1&&(n.TRACE_INIT(`performRuntimeChecks`,function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat((0,i.performRuntimeChecks)(r,n.trackStartLines,n.config.lineTerminatorCharacters))}),n.TRACE_INIT(`performWarningRuntimeChecks`,function(){n.lexerDefinitionWarning=n.lexerDefinitionWarning.concat((0,i.performWarningRuntimeChecks)(r,n.trackStartLines,n.config.lineTerminatorCharacters))})),r.modes=r.modes?r.modes:{},(0,d.default)(r.modes,function(e,t){r.modes[t]=(0,l.default)(e,function(e){return(0,p.default)(e)})});var b=(0,f.default)(r.modes);if((0,d.default)(r.modes,function(e,r){n.TRACE_INIT(`Mode: <${r}> processing`,function(){if(n.modes.push(r),n.config.skipValidations===!1&&n.TRACE_INIT(`validatePatterns`,function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat((0,i.validatePatterns)(e,b))}),(0,o.default)(n.lexerDefinitionErrors)){(0,y.augmentTokenTypes)(e);var a;n.TRACE_INIT(`analyzeTokenTypes`,function(){a=(0,i.analyzeTokenTypes)(e,{lineTerminatorCharacters:n.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:n.TRACE_INIT})}),n.patternIdxToConfig[r]=a.patternIdxToConfig,n.charCodeToPatternIdxToConfig[r]=a.charCodeToPatternIdxToConfig,n.emptyGroups=(0,h.default)({},n.emptyGroups,a.emptyGroups),n.hasCustom=a.hasCustom||n.hasCustom,n.canModeBeOptimized[r]=a.canBeOptimized}})}),n.defaultMode=r.defaultMode,!(0,o.default)(n.lexerDefinitionErrors)&&!n.config.deferDefinitionErrorsHandling){var C=(0,u.default)(n.lexerDefinitionErrors,function(e){return e.message}).join(`-----------------------
|
|
56
|
+
`);throw Error(`Errors detected in definition of Lexer:
|
|
57
|
+
`+C)}(0,d.default)(n.lexerDefinitionWarning,function(e){(0,v.PRINT_WARNING)(e.message)}),n.TRACE_INIT(`Choosing sub-methods implementations`,function(){if(i.SUPPORT_STICKY?(n.chopInput=m.default,n.match=n.matchWithTest):(n.updateLastIndex=a.default,n.match=n.matchWithExec),c&&(n.handleModes=a.default),n.trackStartLines===!1&&(n.computeNewColumn=m.default),n.trackEndLines===!1&&(n.updateTokenEndLineColumnLocation=a.default),/full/i.test(n.config.positionTracking))n.createTokenInstance=n.createFullToken;else if(/onlyStart/i.test(n.config.positionTracking))n.createTokenInstance=n.createStartOnlyToken;else if(/onlyOffset/i.test(n.config.positionTracking))n.createTokenInstance=n.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${n.config.positionTracking}"`);n.hasCustom?(n.addToken=n.addTokenUsingPush,n.handlePayload=n.handlePayloadWithCustom):(n.addToken=n.addTokenUsingMemberAccess,n.handlePayload=n.handlePayloadNoCustom)}),n.TRACE_INIT(`Failed Optimization Warnings`,function(){var e=(0,g.default)(n.canModeBeOptimized,function(e,t,n){return t===!1&&e.push(n),e},[]);if(t.ensureOptimizations&&!(0,o.default)(e))throw Error(`Lexer Modes: < ${e.join(`, `)} > cannot be optimized.
|
|
58
|
+
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
59
|
+
Or inspect the console log for details on how to resolve these issues.`)}),n.TRACE_INIT(`clearRegExpParserCache`,function(){(0,x.clearRegExpParserCache)()}),n.TRACE_INIT(`toFastProperties`,function(){(0,v.toFastProperties)(n)})})}return e.prototype.tokenize=function(e,t){if(t===void 0&&(t=this.defaultMode),!(0,o.default)(this.lexerDefinitionErrors)){var n=(0,u.default)(this.lexerDefinitionErrors,function(e){return e.message}).join(`-----------------------
|
|
60
|
+
`);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
61
|
+
`+n)}return this.tokenizeInternal(e,t)},e.prototype.tokenizeInternal=function(e,t){var n=this,r,a,o,s,l,u,d,f,p,m,h,g,_,v,y,b=e,x=b.length,S=0,C=0,w=this.hasCustom?0:Math.floor(e.length/10),T=Array(w),E=[],D=this.trackStartLines?1:void 0,O=this.trackStartLines?1:void 0,k=(0,i.cloneEmptyGroups)(this.emptyGroups),A=this.trackStartLines,j=this.config.lineTerminatorsPattern,M=0,ee=[],N=[],P=[],te=[];Object.freeze(te);var ne;function re(){return ee}function ie(e){var t=(0,i.charCodeToOptimizedIndex)(e),n=N[t];return n===void 0?te:n}var ae=function(e){if(P.length===1&&e.tokenType.PUSH_MODE===void 0){var t=n.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);E.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{P.pop();var r=(0,c.default)(P);ee=n.patternIdxToConfig[r],N=n.charCodeToPatternIdxToConfig[r],M=ee.length;var i=n.canModeBeOptimized[r]&&n.config.safeMode===!1;ne=N&&i?ie:re}};function oe(e){P.push(e),N=this.charCodeToPatternIdxToConfig[e],ee=this.patternIdxToConfig[e],M=ee.length,M=ee.length;var t=this.canModeBeOptimized[e]&&this.config.safeMode===!1;ne=N&&t?ie:re}oe.call(this,t);for(var se,ce=this.config.recoveryEnabled;S<x;){u=null;var le=b.charCodeAt(S),ue=ne(le),de=ue.length;for(r=0;r<de;r++){se=ue[r];var F=se.pattern;d=null;var fe=se.short;if(fe===!1?se.isCustom===!0?(y=F.exec(b,S,T,k),y===null?u=null:(u=y[0],y.payload!==void 0&&(d=y.payload))):(this.updateLastIndex(F,S),u=this.match(F,e,S)):le===fe&&(u=F),u!==null){if(l=se.longerAlt,l!==void 0){var pe=l.length;for(o=0;o<pe;o++){var me=ee[l[o]],I=me.pattern;if(f=null,me.isCustom===!0?(y=I.exec(b,S,T,k),y===null?s=null:(s=y[0],y.payload!==void 0&&(f=y.payload))):(this.updateLastIndex(I,S),s=this.match(I,e,S)),s&&s.length>u.length){u=s,d=f,se=me;break}}}break}}if(u!==null){if(p=u.length,m=se.group,m!==void 0&&(h=se.tokenTypeIdx,g=this.createTokenInstance(u,S,h,se.tokenType,D,O,p),this.handlePayload(g,d),m===!1?C=this.addToken(T,C,g):k[m].push(g)),e=this.chopInput(e,p),S+=p,O=this.computeNewColumn(O,p),A===!0&&se.canLineTerminator===!0){var L=0,R=void 0,he=void 0;j.lastIndex=0;do R=j.test(u),R===!0&&(he=j.lastIndex-1,L++);while(R===!0);L!==0&&(D+=L,O=p-he,this.updateTokenEndLineColumnLocation(g,m,he,L,D,O,p))}this.handleModes(se,ae,oe,g)}else{for(var ge=S,_e=D,ve=O,ye=ce===!1;ye===!1&&S<x;)for(e=this.chopInput(e,1),S++,a=0;a<M;a++){var be=ee[a],F=be.pattern,fe=be.short;if(fe===!1?be.isCustom===!0?ye=F.exec(b,S,T,k)!==null:(this.updateLastIndex(F,S),ye=F.exec(e)!==null):b.charCodeAt(S)===fe&&(ye=!0),ye===!0)break}if(_=S-ge,v=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(b,ge,_,_e,ve),E.push({offset:ge,line:_e,column:ve,length:_,message:v}),ce===!1)break}}return this.hasCustom||(T.length=C),{tokens:T,groups:k,errors:E}},e.prototype.handleModes=function(e,t,n,r){if(e.pop===!0){var i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)},e.prototype.chopInput=function(e,t){return e.substring(t)},e.prototype.updateLastIndex=function(e,t){e.lastIndex=t},e.prototype.updateTokenEndLineColumnLocation=function(e,t,n,r,i,a,o){var s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,(r!==1||s!==!0)&&(e.endLine=i+c,e.endColumn=a-1+-c))},e.prototype.computeNewColumn=function(e,t){return e+t},e.prototype.createOffsetOnlyToken=function(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}},e.prototype.createStartOnlyToken=function(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}},e.prototype.createFullToken=function(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}},e.prototype.addTokenUsingPush=function(e,t,n){return e.push(n),t},e.prototype.addTokenUsingMemberAccess=function(e,t,n){return e[t]=n,t++,t},e.prototype.handlePayloadNoCustom=function(e,t){},e.prototype.handlePayloadWithCustom=function(e,t){t!==null&&(e.payload=t)},e.prototype.matchWithTest=function(e,t,n){return e.test(t)===!0?t.substring(n,e.lastIndex):null},e.prototype.matchWithExec=function(e,t){var n=e.exec(t);return n===null?null:n[0]},e.SKIPPED=`This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.`,e.NA=/NOT_APPLICABLE/,e}()})),Fo=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.tokenMatcher=e.createTokenInstance=e.EOF=e.createToken=e.hasTokenLabel=e.tokenName=e.tokenLabel=void 0;var i=r(va()),a=r(ki()),o=r(so()),s=Po(),c=Mo();function l(e){return d(e)?e.LABEL:e.name}e.tokenLabel=l;function u(e){return e.name}e.tokenName=u;function d(e){return(0,i.default)(e.LABEL)&&e.LABEL!==``}e.hasTokenLabel=d;var f=`parent`,p=`categories`,m=`label`,h=`group`,g=`push_mode`,_=`pop_mode`,v=`longer_alt`,y=`line_breaks`,b=`start_chars_hint`;function x(e){return S(e)}e.createToken=x;function S(e){var t=e.pattern,n={};if(n.name=e.name,(0,o.default)(t)||(n.PATTERN=t),(0,a.default)(e,f))throw`The parent property is no longer supported.
|
|
62
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return(0,a.default)(e,p)&&(n.CATEGORIES=e[p]),(0,c.augmentTokenTypes)([n]),(0,a.default)(e,m)&&(n.LABEL=e[m]),(0,a.default)(e,h)&&(n.GROUP=e[h]),(0,a.default)(e,_)&&(n.POP_MODE=e[_]),(0,a.default)(e,g)&&(n.PUSH_MODE=e[g]),(0,a.default)(e,v)&&(n.LONGER_ALT=e[v]),(0,a.default)(e,y)&&(n.LINE_BREAKS=e[y]),(0,a.default)(e,b)&&(n.START_CHARS_HINT=e[b]),n}e.EOF=x({name:`EOF`,pattern:s.Lexer.NA}),(0,c.augmentTokenTypes)([e.EOF]);function C(e,t,n,r,i,a,o,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:a,startColumn:o,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}e.createTokenInstance=C;function w(e,t){return(0,c.tokenStructuredMatcher)(e,t)}e.tokenMatcher=w})),Io=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.defaultGrammarValidatorErrorProvider=e.defaultGrammarResolverErrorProvider=e.defaultParserErrorProvider=void 0;var i=Fo(),a=r(uo()),o=r(Si()),s=r(Do()),c=qa(),l=qa();e.defaultParserErrorProvider={buildMismatchTokenMessage:function(e){var t=e.expected,n=e.actual;return e.previous,e.ruleName,`Expecting ${(0,i.hasTokenLabel)(t)?`--> ${(0,i.tokenLabel)(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${n.image}' <--`},buildNotAllInputParsedMessage:function(e){var t=e.firstRedundant;return e.ruleName,`Redundant input, expecting EOF but found: `+t.image},buildNoViableAltMessage:function(e){var t=e.expectedPathsPerAlt,n=e.actual;e.previous;var r=e.customUserDescription;e.ruleName;var c=`Expecting: `,l=`
|
|
63
|
+
but found: '`+(0,a.default)(n).image+`'`;if(r)return c+r+l;var u=(0,s.default)(t,function(e,t){return e.concat(t)},[]),d=(0,o.default)(u,function(e){return`[${(0,o.default)(e,function(e){return(0,i.tokenLabel)(e)}).join(`, `)}]`});return c+`one of these possible Token sequences:
|
|
64
|
+
${(0,o.default)(d,function(e,t){return` ${t+1}. ${e}`}).join(`
|
|
65
|
+
`)}`+l},buildEarlyExitMessage:function(e){var t=e.expectedIterationPaths,n=e.actual,r=e.customUserDescription;e.ruleName;var s=`Expecting: `,c=`
|
|
66
|
+
but found: '`+(0,a.default)(n).image+`'`;return r?s+r+c:s+`expecting at least one iteration which starts with one of these possible Token sequences::
|
|
67
|
+
<${(0,o.default)(t,function(e){return`[${(0,o.default)(e,function(e){return(0,i.tokenLabel)(e)}).join(`,`)}]`}).join(` ,`)}>`+c}},Object.freeze(e.defaultParserErrorProvider),e.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(e,t){return`Invalid grammar, reference to a rule which is not defined: ->`+t.nonTerminalName+`<-
|
|
68
|
+
inside top level rule: ->`+e.name+`<-`}},e.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(e,t){function n(e){return e instanceof c.Terminal?e.terminalType.name:e instanceof c.NonTerminal?e.nonTerminalName:``}var r=e.name,i=(0,a.default)(t),o=i.idx,s=(0,l.getProductionDslName)(i),u=n(i),d=`->${s}${o>0?o:``}<- ${u?`with argument: ->${u}<-`:``}
|
|
69
|
+
appears more than once (${t.length} times) in the top level rule: ->${r}<-.
|
|
70
|
+
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
71
|
+
`;return d=d.replace(/[ \t]+/g,` `),d=d.replace(/\s\s+/g,`
|
|
72
|
+
`),d},buildNamespaceConflictError:function(e){return`Namespace conflict found in grammar.
|
|
73
|
+
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.
|
|
74
|
+
To resolve this make sure each Terminal and Non-Terminal names are unique
|
|
75
|
+
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|
76
|
+
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError:function(e){var t=(0,o.default)(e.prefixPath,function(e){return(0,i.tokenLabel)(e)}).join(`, `),n=e.alternation.idx===0?``:e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(` ,`)}> due to common lookahead prefix
|
|
77
|
+
in <OR${n}> inside <${e.topLevelRule.name}> Rule,
|
|
78
|
+
<${t}> may appears as a prefix path in all these alternatives.
|
|
79
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|
80
|
+
For Further details.`},buildAlternationAmbiguityError:function(e){var t=(0,o.default)(e.prefixPath,function(e){return(0,i.tokenLabel)(e)}).join(`, `),n=e.alternation.idx===0?``:e.alternation.idx,r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(` ,`)}> in <OR${n}> inside <${e.topLevelRule.name}> Rule,
|
|
81
|
+
<${t}> may appears as a prefix path in all these alternatives.
|
|
82
|
+
`;return r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
83
|
+
For Further details.`,r},buildEmptyRepetitionError:function(e){var t=(0,l.getProductionDslName)(e.repetition);return e.repetition.idx!==0&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.
|
|
84
|
+
This could lead to an infinite loop.`},buildTokenNameError:function(e){return`deprecated`},buildEmptyAlternationError:function(e){return`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.
|
|
85
|
+
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError:function(e){return`An Alternation cannot have more than 256 alternatives:
|
|
86
|
+
<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.
|
|
87
|
+
has ${e.alternation.definition.length+1} alternatives.`},buildLeftRecursionError:function(e){var t=e.topLevelRule.name;return`Left Recursion found in grammar.
|
|
88
|
+
rule: <${t}> can be invoked from itself (directly or indirectly)
|
|
89
|
+
without consuming any Tokens. The grammar path that causes this is:
|
|
90
|
+
${`${t} --> ${(0,o.default)(e.leftRecursionPath,function(e){return e.name}).concat([t]).join(` --> `)}`}
|
|
91
|
+
To fix this refactor your grammar to remove the left recursion.
|
|
92
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:function(e){return`deprecated`},buildDuplicateRuleNameError:function(e){return`Duplicate definition, rule: ->${e.topLevelRule instanceof c.Rule?e.topLevelRule.name:e.topLevelRule}<- is already defined in the grammar: ->${e.grammarName}<-`}}})),Lo=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.GastRefResolverVisitor=e.resolveGrammar=void 0;var a=us(),o=i(Ti()),s=i(Di()),c=qa();function l(e,t){var n=new u(e,t);return n.resolveRefs(),n.errors}e.resolveGrammar=l;var u=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.nameToTopRule=t,r.errMsgProvider=n,r.errors=[],r}return t.prototype.resolveRefs=function(){var e=this;(0,o.default)((0,s.default)(this.nameToTopRule),function(t){e.currTopLevel=t,t.accept(e)})},t.prototype.visitNonTerminal=function(e){var t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{var n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:a.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}},t}(c.GAstVisitor);e.GastRefResolverVisitor=u})),Ro=o(((e,t)=>{function n(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}t.exports=n})),zo=o(((e,t)=>{var n=bi();function r(e,t,r,i){return n(e,function(e,n,a){t(i,e,r(e),a)}),i}t.exports=r})),Bo=o(((e,t)=>{var n=Ro(),r=zo(),i=hi(),a=In();function o(e,t){return function(o,s){var c=a(o)?n:r,l=t?t():{};return c(o,e,i(s,2),l)}}t.exports=o})),Vo=o(((e,t)=>{var n=ji(),r=Bo(),i=Object.prototype.hasOwnProperty;t.exports=r(function(e,t,r){i.call(e,r)?e[r].push(t):n(e,r,[t])})})),Ho=o(((e,t)=>{var n=Xa(),r=Si();function i(e,t){return n(r(e,t),1)}t.exports=i})),Uo=o(((e,t)=>{var n=da(),r=ga();function i(e,t,i){var a=e==null?0:e.length;return a?(t=i||t===void 0?1:r(t),t=a-t,n(e,0,t<0?0:t)):[]}t.exports=i})),B=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.nextPossibleTokensAfter=e.possiblePathsFrom=e.NextTerminalAfterAtLeastOneSepWalker=e.NextTerminalAfterAtLeastOneWalker=e.NextTerminalAfterManySepWalker=e.NextTerminalAfterManyWalker=e.AbstractNextTerminalAfterProductionWalker=e.NextAfterTokenWalker=e.AbstractNextPossibleTokensWalker=void 0;var a=Ja(),o=i(uo()),s=i(Gn()),c=i(Uo()),l=i(_a()),u=i(jo()),d=i(Ti()),f=i(oa()),p=io(),m=qa(),h=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.topProd=t,r.path=n,r.possibleTokTypes=[],r.nextProductionName=``,r.nextProductionOccurrence=0,r.found=!1,r.isAtEndOfPath=!1,r}return t.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error(`The path does not start with the walker's top Rule!`);return this.ruleStack=(0,f.default)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,f.default)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},t.prototype.walk=function(t,n){n===void 0&&(n=[]),this.found||e.prototype.walk.call(this,t,n)},t.prototype.walkProdRef=function(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){var r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}},t.prototype.updateExpectedNext=function(){(0,s.default)(this.ruleStack)?(this.nextProductionName=``,this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},t}(a.RestWalker);e.AbstractNextPossibleTokensWalker=h,e.NextAfterTokenWalker=function(e){r(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.path=n,r.nextTerminalName=``,r.nextTerminalOccurrence=0,r.nextTerminalName=r.path.lastTok.name,r.nextTerminalOccurrence=r.path.lastTokOccurrence,r}return t.prototype.walkTerminal=function(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){var r=t.concat(n),i=new m.Alternative({definition:r});this.possibleTokTypes=(0,p.first)(i),this.found=!0}},t}(h);var g=function(e){r(t,e);function t(t,n){var r=e.call(this)||this;return r.topRule=t,r.occurrence=n,r.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},r}return t.prototype.startWalking=function(){return this.walk(this.topRule),this.result},t}(a.RestWalker);e.AbstractNextTerminalAfterProductionWalker=g,e.NextTerminalAfterManyWalker=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.walkMany=function(t,n,r){if(t.idx===this.occurrence){var i=(0,o.default)(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof m.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkMany.call(this,t,n,r)},t}(g),e.NextTerminalAfterManySepWalker=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.walkManySep=function(t,n,r){if(t.idx===this.occurrence){var i=(0,o.default)(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof m.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkManySep.call(this,t,n,r)},t}(g),e.NextTerminalAfterAtLeastOneWalker=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.walkAtLeastOne=function(t,n,r){if(t.idx===this.occurrence){var i=(0,o.default)(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof m.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkAtLeastOne.call(this,t,n,r)},t}(g),e.NextTerminalAfterAtLeastOneSepWalker=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.walkAtLeastOneSep=function(t,n,r){if(t.idx===this.occurrence){var i=(0,o.default)(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof m.Terminal&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else e.prototype.walkAtLeastOneSep.call(this,t,n,r)},t}(g);function _(e,t,n){n===void 0&&(n=[]),n=(0,f.default)(n);var r=[],i=0;function a(t){return t.concat((0,l.default)(e,i+1))}function o(e){var i=_(a(e),t,n);return r.concat(i)}for(;n.length<t&&i<e.length;){var c=e[i];if(c instanceof m.Alternative||c instanceof m.NonTerminal)return o(c.definition);if(c instanceof m.Option)r=o(c.definition);else if(c instanceof m.RepetitionMandatory){var u=c.definition.concat([new m.Repetition({definition:c.definition})]);return o(u)}else if(c instanceof m.RepetitionMandatoryWithSeparator){var u=[new m.Alternative({definition:c.definition}),new m.Repetition({definition:[new m.Terminal({terminalType:c.separator})].concat(c.definition)})];return o(u)}else if(c instanceof m.RepetitionWithSeparator){var u=c.definition.concat([new m.Repetition({definition:[new m.Terminal({terminalType:c.separator})].concat(c.definition)})]);r=o(u)}else if(c instanceof m.Repetition){var u=c.definition.concat([new m.Repetition({definition:c.definition})]);r=o(u)}else if(c instanceof m.Alternation)return(0,d.default)(c.definition,function(e){(0,s.default)(e.definition)===!1&&(r=o(e.definition))}),r;else if(c instanceof m.Terminal)n.push(c.terminalType);else throw Error(`non exhaustive match`);i++}return r.push({partialPath:n,suffixDef:(0,l.default)(e,i)}),r}e.possiblePathsFrom=_;function v(e,t,n,r){var i=`EXIT_NONE_TERMINAL`,a=[i],o=`EXIT_ALTERNATIVE`,d=!1,p=t.length,h=p-r-1,g=[],_=[];for(_.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!(0,s.default)(_);){var v=_.pop();if(v===o)d&&(0,u.default)(_).idx<=h&&_.pop();else{var b=v.def,x=v.idx,S=v.ruleStack,C=v.occurrenceStack;if(!(0,s.default)(b)){var w=b[0];if(w===i){var T={idx:x,def:(0,l.default)(b),ruleStack:(0,c.default)(S),occurrenceStack:(0,c.default)(C)};_.push(T)}else if(w instanceof m.Terminal){if(x<p-1){var E=x+1,D=t[E];if(n(D,w.terminalType)){var T={idx:E,def:(0,l.default)(b),ruleStack:S,occurrenceStack:C};_.push(T)}}else if(x===p-1)g.push({nextTokenType:w.terminalType,nextTokenOccurrence:w.idx,ruleStack:S,occurrenceStack:C}),d=!0;else throw Error(`non exhaustive match`)}else if(w instanceof m.NonTerminal){var O=(0,f.default)(S);O.push(w.nonTerminalName);var k=(0,f.default)(C);k.push(w.idx);var T={idx:x,def:w.definition.concat(a,(0,l.default)(b)),ruleStack:O,occurrenceStack:k};_.push(T)}else if(w instanceof m.Option){var A={idx:x,def:(0,l.default)(b),ruleStack:S,occurrenceStack:C};_.push(A),_.push(o);var j={idx:x,def:w.definition.concat((0,l.default)(b)),ruleStack:S,occurrenceStack:C};_.push(j)}else if(w instanceof m.RepetitionMandatory){var M=new m.Repetition({definition:w.definition,idx:w.idx}),ee=w.definition.concat([M],(0,l.default)(b)),T={idx:x,def:ee,ruleStack:S,occurrenceStack:C};_.push(T)}else if(w instanceof m.RepetitionMandatoryWithSeparator){var N=new m.Terminal({terminalType:w.separator}),M=new m.Repetition({definition:[N].concat(w.definition),idx:w.idx}),ee=w.definition.concat([M],(0,l.default)(b)),T={idx:x,def:ee,ruleStack:S,occurrenceStack:C};_.push(T)}else if(w instanceof m.RepetitionWithSeparator){var A={idx:x,def:(0,l.default)(b),ruleStack:S,occurrenceStack:C};_.push(A),_.push(o);var N=new m.Terminal({terminalType:w.separator}),P=new m.Repetition({definition:[N].concat(w.definition),idx:w.idx}),ee=w.definition.concat([P],(0,l.default)(b)),j={idx:x,def:ee,ruleStack:S,occurrenceStack:C};_.push(j)}else if(w instanceof m.Repetition){var A={idx:x,def:(0,l.default)(b),ruleStack:S,occurrenceStack:C};_.push(A),_.push(o);var P=new m.Repetition({definition:w.definition,idx:w.idx}),ee=w.definition.concat([P],(0,l.default)(b)),j={idx:x,def:ee,ruleStack:S,occurrenceStack:C};_.push(j)}else if(w instanceof m.Alternation)for(var te=w.definition.length-1;te>=0;te--){var ne={idx:x,def:w.definition[te].definition.concat((0,l.default)(b)),ruleStack:S,occurrenceStack:C};_.push(ne),_.push(o)}else if(w instanceof m.Alternative)_.push({idx:x,def:w.definition.concat((0,l.default)(b)),ruleStack:S,occurrenceStack:C});else if(w instanceof m.Rule)_.push(y(w,x,S,C));else throw Error(`non exhaustive match`)}}}return g}e.nextPossibleTokensAfter=v;function y(e,t,n,r){var i=(0,f.default)(n);i.push(e.name);var a=(0,f.default)(r);return a.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:a}}})),Wo=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.areTokenCategoriesNotUsed=e.isStrictPrefixOfPath=e.containsPath=e.getLookaheadPathsForOptionalProd=e.getLookaheadPathsForOr=e.lookAheadSequenceFromAlternatives=e.buildSingleAlternativeLookaheadFunction=e.buildAlternativesLookAheadFunc=e.buildLookaheadFuncForOptionalProd=e.buildLookaheadFuncForOr=e.getLookaheadPaths=e.getProdType=e.PROD_TYPE=void 0;var a=i(Gn()),o=i(Za()),s=i(Ba()),c=i(Si()),l=i(Ti()),u=i(ki()),d=i(Do()),f=B(),p=Ja(),m=Mo(),h=qa(),g=qa(),_;(function(e){e[e.OPTION=0]=`OPTION`,e[e.REPETITION=1]=`REPETITION`,e[e.REPETITION_MANDATORY=2]=`REPETITION_MANDATORY`,e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]=`REPETITION_MANDATORY_WITH_SEPARATOR`,e[e.REPETITION_WITH_SEPARATOR=4]=`REPETITION_WITH_SEPARATOR`,e[e.ALTERNATION=5]=`ALTERNATION`})(_=e.PROD_TYPE||={});function v(e){if(e instanceof h.Option||e===`Option`)return _.OPTION;if(e instanceof h.Repetition||e===`Repetition`)return _.REPETITION;if(e instanceof h.RepetitionMandatory||e===`RepetitionMandatory`)return _.REPETITION_MANDATORY;if(e instanceof h.RepetitionMandatoryWithSeparator||e===`RepetitionMandatoryWithSeparator`)return _.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof h.RepetitionWithSeparator||e===`RepetitionWithSeparator`)return _.REPETITION_WITH_SEPARATOR;if(e instanceof h.Alternation||e===`Alternation`)return _.ALTERNATION;throw Error(`non exhaustive match`)}e.getProdType=v;function y(e){var t=e.occurrence,n=e.rule,r=e.prodType,i=e.maxLookahead,a=v(r);return a===_.ALTERNATION?A(t,n,i):j(t,n,a,i)}e.getLookaheadPaths=y;function b(e,t,n,r,i,a){var o=A(e,t,n);return a(o,r,N(o)?m.tokenStructuredMatcherNoCategories:m.tokenStructuredMatcher,i)}e.buildLookaheadFuncForOr=b;function x(e,t,n,r,i,a){var o=j(e,t,i,n),s=N(o)?m.tokenStructuredMatcherNoCategories:m.tokenStructuredMatcher;return a(o[0],s,r)}e.buildLookaheadFuncForOptionalProd=x;function S(e,t,n,r){var i=e.length,a=(0,s.default)(e,function(e){return(0,s.default)(e,function(e){return e.length===1})});if(t)return function(t){for(var r=(0,c.default)(t,function(e){return e.GATE}),a=0;a<i;a++){var o=e[a],s=o.length,l=r[a];if(l===void 0||l.call(this)!==!1)nextPath:for(var u=0;u<s;u++){for(var d=o[u],f=d.length,p=0;p<f;p++)if(n(this.LA(p+1),d[p])===!1)continue nextPath;return a}}};if(a&&!r){var f=(0,c.default)(e,function(e){return(0,o.default)(e)}),p=(0,d.default)(f,function(e,t,n){return(0,l.default)(t,function(t){(0,u.default)(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=n),(0,l.default)(t.categoryMatches,function(t){(0,u.default)(e,t)||(e[t]=n)})}),e},{});return function(){return p[this.LA(1).tokenTypeIdx]}}return function(){for(var t=0;t<i;t++){var r=e[t],a=r.length;nextPath:for(var o=0;o<a;o++){for(var s=r[o],c=s.length,l=0;l<c;l++)if(n(this.LA(l+1),s[l])===!1)continue nextPath;return t}}}}e.buildAlternativesLookAheadFunc=S;function C(e,t,n){var r=(0,s.default)(e,function(e){return e.length===1}),i=e.length;if(r&&!n){var c=(0,o.default)(e);if(c.length===1&&(0,a.default)(c[0].categoryMatches)){var u=c[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===u}}var f=(0,d.default)(c,function(e,t,n){return e[t.tokenTypeIdx]=!0,(0,l.default)(t.categoryMatches,function(t){e[t]=!0}),e},[]);return function(){return f[this.LA(1).tokenTypeIdx]===!0}}return function(){nextPath:for(var n=0;n<i;n++){for(var r=e[n],a=r.length,o=0;o<a;o++)if(t(this.LA(o+1),r[o])===!1)continue nextPath;return!0}return!1}}e.buildSingleAlternativeLookaheadFunction=C;var w=function(e){r(t,e);function t(t,n,r){var i=e.call(this)||this;return i.topProd=t,i.targetOccurrence=n,i.targetProdType=r,i}return t.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},t.prototype.checkIsTarget=function(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)},t.prototype.walkOption=function(t,n,r){this.checkIsTarget(t,_.OPTION,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkAtLeastOne=function(t,n,r){this.checkIsTarget(t,_.REPETITION_MANDATORY,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkAtLeastOneSep=function(t,n,r){this.checkIsTarget(t,_.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkMany=function(t,n,r){this.checkIsTarget(t,_.REPETITION,n,r)||e.prototype.walkOption.call(this,t,n,r)},t.prototype.walkManySep=function(t,n,r){this.checkIsTarget(t,_.REPETITION_WITH_SEPARATOR,n,r)||e.prototype.walkOption.call(this,t,n,r)},t}(p.RestWalker),T=function(e){r(t,e);function t(t,n,r){var i=e.call(this)||this;return i.targetOccurrence=t,i.targetProdType=n,i.targetRef=r,i.result=[],i}return t.prototype.checkIsTarget=function(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)},t.prototype.visitOption=function(e){this.checkIsTarget(e,_.OPTION)},t.prototype.visitRepetition=function(e){this.checkIsTarget(e,_.REPETITION)},t.prototype.visitRepetitionMandatory=function(e){this.checkIsTarget(e,_.REPETITION_MANDATORY)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.checkIsTarget(e,_.REPETITION_MANDATORY_WITH_SEPARATOR)},t.prototype.visitRepetitionWithSeparator=function(e){this.checkIsTarget(e,_.REPETITION_WITH_SEPARATOR)},t.prototype.visitAlternation=function(e){this.checkIsTarget(e,_.ALTERNATION)},t}(g.GAstVisitor);function E(e){for(var t=Array(e),n=0;n<e;n++)t[n]=[];return t}function D(e){for(var t=[``],n=0;n<e.length;n++){for(var r=e[n],i=[],a=0;a<t.length;a++){var o=t[a];i.push(o+`_`+r.tokenTypeIdx);for(var s=0;s<r.categoryMatches.length;s++){var c=`_`+r.categoryMatches[s];i.push(o+c)}}t=i}return t}function O(e,t,n){for(var r=0;r<e.length;r++)if(r!==n){for(var i=e[r],a=0;a<t.length;a++)if(i[t[a]]===!0)return!1}return!0}function k(e,t){for(var n=(0,c.default)(e,function(e){return(0,f.possiblePathsFrom)([e],1)}),r=E(n.length),i=(0,c.default)(n,function(e){var t={};return(0,l.default)(e,function(e){var n=D(e.partialPath);(0,l.default)(n,function(e){t[e]=!0})}),t}),o=n,s=1;s<=t;s++){var u=o;o=E(u.length);for(var d=function(e){for(var n=u[e],c=0;c<n.length;c++){var d=n[c].partialPath,p=n[c].suffixDef,m=D(d);if(O(i,m,e)||(0,a.default)(p)||d.length===t){var h=r[e];if(M(h,d)===!1){h.push(d);for(var g=0;g<m.length;g++){var _=m[g];i[e][_]=!0}}}else{var v=(0,f.possiblePathsFrom)(p,s+1,d);o[e]=o[e].concat(v),(0,l.default)(v,function(t){var n=D(t.partialPath);(0,l.default)(n,function(t){i[e][t]=!0})})}}},p=0;p<u.length;p++)d(p)}return r}e.lookAheadSequenceFromAlternatives=k;function A(e,t,n,r){var i=new T(e,_.ALTERNATION,r);return t.accept(i),k(i.result,n)}e.getLookaheadPathsForOr=A;function j(e,t,n,r){var i=new T(e,n);t.accept(i);var a=i.result,o=new w(t,e,n).startWalking();return k([new h.Alternative({definition:a}),new h.Alternative({definition:o})],r)}e.getLookaheadPathsForOptionalProd=j;function M(e,t){compareOtherPath:for(var n=0;n<e.length;n++){var r=e[n];if(r.length===t.length){for(var i=0;i<r.length;i++){var a=t[i],o=r[i];if(a!==o&&o.categoryMatchesMap[a.tokenTypeIdx]===void 0)continue compareOtherPath}return!0}}return!1}e.containsPath=M;function ee(e,t){return e.length<t.length&&(0,s.default)(e,function(e,n){var r=t[n];return e===r||r.categoryMatchesMap[e.tokenTypeIdx]})}e.isStrictPrefixOfPath=ee;function N(e){return(0,s.default)(e,function(e){return(0,s.default)(e,function(e){return(0,s.default)(e,function(e){return(0,a.default)(e.categoryMatches)})})})}e.areTokenCategoriesNotUsed=N})),Go=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)},a=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.checkPrefixAlternativesAmbiguities=e.validateSomeNonEmptyLookaheadPath=e.validateTooManyAlts=e.RepetitionCollector=e.validateAmbiguousAlternationAlternatives=e.validateEmptyOrAlternative=e.getFirstNoneTerminal=e.validateNoLeftRecursion=e.validateRuleIsOverridden=e.validateRuleDoesNotAlreadyExist=e.OccurrenceValidationCollector=e.identifyProductionForDuplicates=e.validateGrammar=e.validateLookahead=void 0;var o=a(uo()),s=a(Gn()),c=a(_a()),l=a(Za()),u=a(Co()),d=a(ho()),f=a(vo()),p=a(Si()),m=a(Ti()),h=a(Vo()),g=a(Do()),_=a(Ca()),v=a(Di()),y=a(Ga()),b=a(Ho()),x=a(oa()),S=us(),C=qa(),w=Wo(),T=B(),E=qa(),D=qa(),O=a(Uo()),k=a(fo()),A=Mo();function j(e){var t=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return(0,p.default)(t,function(e){return i({type:S.ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION},e)})}e.validateLookahead=j;function M(e,t,n,r){var i=(0,b.default)(e,function(e){return ee(e,n)}),a=pe(e,t,n),o=(0,b.default)(e,function(e){return ue(e,n)}),s=(0,b.default)(e,function(t){return ne(t,e,r,n)});return i.concat(a,o,s)}e.validateGrammar=M;function ee(e,t){var n=new te;e.accept(n);var r=n.allProductions,i=(0,h.default)(r,N),a=(0,_.default)(i,function(e){return e.length>1});return(0,p.default)((0,v.default)(a),function(n){var r=(0,o.default)(n),i=t.buildDuplicateFoundError(e,n),a=(0,C.getProductionDslName)(r),s={message:i,type:S.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:a,occurrence:r.idx},c=P(r);return c&&(s.parameter=c),s})}function N(e){return`${(0,C.getProductionDslName)(e)}_#_${e.idx}_#_${P(e)}`}e.identifyProductionForDuplicates=N;function P(e){return e instanceof E.Terminal?e.terminalType.name:e instanceof E.NonTerminal?e.nonTerminalName:``}var te=function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.allProductions=[],t}return t.prototype.visitNonTerminal=function(e){this.allProductions.push(e)},t.prototype.visitOption=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetition=function(e){this.allProductions.push(e)},t.prototype.visitAlternation=function(e){this.allProductions.push(e)},t.prototype.visitTerminal=function(e){this.allProductions.push(e)},t}(D.GAstVisitor);e.OccurrenceValidationCollector=te;function ne(e,t,n,r){var i=[];if((0,g.default)(t,function(t,n){return n.name===e.name?t+1:t},0)>1){var a=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:a,type:S.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}e.validateRuleDoesNotAlreadyExist=ne;function re(e,t,n){var r=[],i;return(0,y.default)(t,e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:S.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:e})),r}e.validateRuleIsOverridden=re;function ie(e,t,n,r){r===void 0&&(r=[]);var i=[],a=ae(t.definition);if((0,s.default)(a))return[];var o=e.name;(0,y.default)(a,e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:S.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:o});var c=(0,f.default)(a,r.concat([e])),l=(0,b.default)(c,function(t){var i=(0,x.default)(r);return i.push(t),ie(e,t,n,i)});return i.concat(l)}e.validateNoLeftRecursion=ie;function ae(e){var t=[];if((0,s.default)(e))return t;var n=(0,o.default)(e);if(n instanceof E.NonTerminal)t.push(n.referencedRule);else if(n instanceof E.Alternative||n instanceof E.Option||n instanceof E.RepetitionMandatory||n instanceof E.RepetitionMandatoryWithSeparator||n instanceof E.RepetitionWithSeparator||n instanceof E.Repetition)t=t.concat(ae(n.definition));else if(n instanceof E.Alternation)t=(0,l.default)((0,p.default)(n.definition,function(e){return ae(e.definition)}));else if(!(n instanceof E.Terminal))throw Error(`non exhaustive match`);var r=(0,C.isOptionalProd)(n),i=e.length>1;if(r&&i){var a=(0,c.default)(e);return t.concat(ae(a))}return t}e.getFirstNoneTerminal=ae;var oe=function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.alternations=[],t}return t.prototype.visitAlternation=function(e){this.alternations.push(e)},t}(D.GAstVisitor);function se(e,t){var n=new oe;e.accept(n);var r=n.alternations;return(0,b.default)(r,function(n){var r=(0,O.default)(n.definition);return(0,b.default)(r,function(r,i){var a=(0,T.nextPossibleTokensAfter)([r],[],A.tokenStructuredMatcher,1);return(0,s.default)(a)?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:S.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]})})}e.validateEmptyOrAlternative=se;function ce(e,t,n){var r=new oe;e.accept(r);var i=r.alternations;return i=(0,d.default)(i,function(e){return e.ignoreAmbiguities===!0}),(0,b.default)(i,function(r){var i=r.idx,a=r.maxLookahead||t,o=(0,w.getLookaheadPathsForOr)(i,e,a,r),s=F(o,r,e,n),c=fe(o,r,e,n);return s.concat(c)})}e.validateAmbiguousAlternationAlternatives=ce;var le=function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.allProductions=[],t}return t.prototype.visitRepetitionWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.allProductions.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.allProductions.push(e)},t.prototype.visitRepetition=function(e){this.allProductions.push(e)},t}(D.GAstVisitor);e.RepetitionCollector=le;function ue(e,t){var n=new oe;e.accept(n);var r=n.alternations;return(0,b.default)(r,function(n){return n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:S.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[]})}e.validateTooManyAlts=ue;function de(e,t,n){var r=[];return(0,m.default)(e,function(e){var i=new le;e.accept(i);var a=i.allProductions;(0,m.default)(a,function(i){var a=(0,w.getProdType)(i),o=i.maxLookahead||t,c=i.idx,u=(0,w.getLookaheadPathsForOptionalProd)(c,e,a,o)[0];if((0,s.default)((0,l.default)(u))){var d=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:d,type:S.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),r}e.validateSomeNonEmptyLookaheadPath=de;function F(e,t,n,r){var i=[],a=(0,g.default)(e,function(n,r,a){return t.definition[a].ignoreAmbiguities===!0||(0,m.default)(r,function(r){var o=[a];(0,m.default)(e,function(e,n){a!==n&&(0,w.containsPath)(e,r)&&t.definition[n].ignoreAmbiguities!==!0&&o.push(n)}),o.length>1&&!(0,w.containsPath)(i,r)&&(i.push(r),n.push({alts:o,path:r}))}),n},[]);return(0,p.default)(a,function(e){var i=(0,p.default)(e.alts,function(e){return e+1});return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:S.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}})}function fe(e,t,n,r){var i=(0,g.default)(e,function(e,t,n){var r=(0,p.default)(t,function(e){return{idx:n,path:e}});return e.concat(r)},[]);return(0,k.default)((0,b.default)(i,function(e){if(t.definition[e.idx].ignoreAmbiguities===!0)return[];var a=e.idx,o=e.path,s=(0,u.default)(i,function(e){return t.definition[e.idx].ignoreAmbiguities!==!0&&e.idx<a&&(0,w.isStrictPrefixOfPath)(e.path,o)});return(0,p.default)(s,function(e){var i=[e.idx+1,a+1],o=t.idx===0?``:t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:S.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:o,alternatives:i}})}))}e.checkPrefixAlternativesAmbiguities=fe;function pe(e,t,n){var r=[],i=(0,p.default)(t,function(e){return e.name});return(0,m.default)(e,function(e){var t=e.name;if((0,y.default)(i,t)){var a=n.buildNamespaceConflictError(e);r.push({message:a,type:S.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),r}})),Ko=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.validateGrammar=e.resolveGrammar=void 0;var i=r(Ti()),a=r(wo()),o=Lo(),s=Go(),c=Io();function l(e){var t=(0,a.default)(e,{errMsgProvider:c.defaultGrammarResolverErrorProvider}),n={};return(0,i.default)(e.rules,function(e){n[e.name]=e}),(0,o.resolveGrammar)(n,t.errMsgProvider)}e.resolveGrammar=l;function u(e){return e=(0,a.default)(e,{errMsgProvider:c.defaultGrammarValidatorErrorProvider}),(0,s.validateGrammar)(e.rules,e.tokenTypes,e.errMsgProvider,e.grammarName)}e.validateGrammar=u})),qo=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.EarlyExitException=e.NotAllInputParsedException=e.NoViableAltException=e.MismatchedTokenException=e.isRecognitionException=void 0;var a=i(Ga()),o=`MismatchedTokenException`,s=`NoViableAltException`,c=`EarlyExitException`,l=`NotAllInputParsedException`,u=[o,s,c,l];Object.freeze(u);function d(e){return(0,a.default)(u,e.name)}e.isRecognitionException=d;var f=function(e){r(t,e);function t(t,n){var r=this.constructor,i=e.call(this,t)||this;return i.token=n,i.resyncedTokens=[],Object.setPrototypeOf(i,r.prototype),Error.captureStackTrace&&Error.captureStackTrace(i,i.constructor),i}return t}(Error);e.MismatchedTokenException=function(e){r(t,e);function t(t,n,r){var i=e.call(this,t,n)||this;return i.previousToken=r,i.name=o,i}return t}(f),e.NoViableAltException=function(e){r(t,e);function t(t,n,r){var i=e.call(this,t,n)||this;return i.previousToken=r,i.name=s,i}return t}(f),e.NotAllInputParsedException=function(e){r(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.name=l,r}return t}(f),e.EarlyExitException=function(e){r(t,e);function t(t,n,r){var i=e.call(this,t,n)||this;return i.previousToken=r,i.name=c,i}return t}(f)})),Jo=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.attemptInRepetitionRecovery=e.Recoverable=e.InRuleRecoveryException=e.IN_RULE_RECOVERY_EXCEPTION=e.EOF_FOLLOW_KEY=void 0;var a=Fo(),o=i(Gn()),s=i(Uo()),c=i(Za()),l=i(Si()),u=i(So()),d=i(ki()),f=i(Ga()),p=i(oa()),m=qo(),h=ao(),g=us();e.EOF_FOLLOW_KEY={},e.IN_RULE_RECOVERY_EXCEPTION=`InRuleRecoveryException`;var _=function(t){r(n,t);function n(n){var r=t.call(this,n)||this;return r.name=e.IN_RULE_RECOVERY_EXCEPTION,r}return n}(Error);e.InRuleRecoveryException=_,e.Recoverable=function(){function t(){}return t.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,d.default)(e,`recoveryEnabled`)?e.recoveryEnabled:g.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=v)},t.prototype.getTokenToInsert=function(e){var t=(0,a.createTokenInstance)(e,``,NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t},t.prototype.canTokenTypeBeInsertedInRecovery=function(e){return!0},t.prototype.canTokenTypeBeDeletedInRecovery=function(e){return!0},t.prototype.tryInRepetitionRecovery=function(e,t,n,r){for(var i=this,a=this.findReSyncTokenType(),o=this.exportLexerState(),c=[],l=!1,u=this.LA(1),d=this.LA(1),f=function(){var e=i.LA(0),t=i.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:u,previous:e,ruleName:i.getCurrRuleFullName()}),n=new m.MismatchedTokenException(t,u,i.LA(0));n.resyncedTokens=(0,s.default)(c),i.SAVE_ERROR(n)};!l;)if(this.tokenMatcher(d,r)){f();return}else if(n.call(this)){f(),e.apply(this,t);return}else this.tokenMatcher(d,a)?l=!0:(d=this.SKIP_TOKEN(),this.addToResyncTokens(d,c));this.importLexerState(o)},t.prototype.shouldInRepetitionRecoveryBeTried=function(e,t,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))},t.prototype.getFollowsForInRuleRecovery=function(e,t){var n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)},t.prototype.tryInRuleRecovery=function(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){var n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new _(`sad sad panda`)},t.prototype.canPerformInRuleRecovery=function(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)},t.prototype.canRecoverWithSingleTokenInsertion=function(e,t){var n=this;if(!this.canTokenTypeBeInsertedInRecovery(e)||(0,o.default)(t))return!1;var r=this.LA(1);return(0,u.default)(t,function(e){return n.tokenMatcher(r,e)})!==void 0},t.prototype.canRecoverWithSingleTokenDeletion=function(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1},t.prototype.isInCurrentRuleReSyncSet=function(e){var t=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(t);return(0,f.default)(n,e)},t.prototype.findReSyncTokenType=function(){for(var e=this.flattenFollowSet(),t=this.LA(1),n=2;;){var r=(0,u.default)(e,function(e){return(0,a.tokenMatcher)(t,e)});if(r!==void 0)return r;t=this.LA(n),n++}},t.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return e.EOF_FOLLOW_KEY;var t=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(t),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}},t.prototype.buildFullFollowKeyStack=function(){var t=this,n=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return(0,l.default)(n,function(i,a){return a===0?e.EOF_FOLLOW_KEY:{ruleName:t.shortRuleNameToFullName(i),idxInCallingRule:r[a],inRule:t.shortRuleNameToFullName(n[a-1])}})},t.prototype.flattenFollowSet=function(){var e=this,t=(0,l.default)(this.buildFullFollowKeyStack(),function(t){return e.getFollowSetFromFollowKey(t)});return(0,c.default)(t)},t.prototype.getFollowSetFromFollowKey=function(t){if(t===e.EOF_FOLLOW_KEY)return[a.EOF];var n=t.ruleName+t.idxInCallingRule+h.IN+t.inRule;return this.resyncFollows[n]},t.prototype.addToResyncTokens=function(e,t){return this.tokenMatcher(e,a.EOF)||t.push(e),t},t.prototype.reSyncTo=function(e){for(var t=[],n=this.LA(1);this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return(0,s.default)(t)},t.prototype.attemptInRepetitionRecovery=function(e,t,n,r,i,a,o){},t.prototype.getCurrentGrammarPath=function(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:(0,p.default)(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}},t.prototype.getHumanReadableRuleStack=function(){var e=this;return(0,l.default)(this.RULE_STACK,function(t){return e.shortRuleNameToFullName(t)})},t}();function v(e,t,n,r,i,o,s){var c=this.getKeyForAutomaticLookahead(r,i),l=this.firstAfterRepMap[c];if(l===void 0){var u=this.getCurrRuleFullName(),d=this.getGAstProductions()[u];l=new o(d,i).startWalking(),this.firstAfterRepMap[c]=l}var f=l.token,p=l.occurrence,m=l.isEndOfRule;this.RULE_STACK.length===1&&m&&f===void 0&&(f=a.EOF,p=1),f!==void 0&&p!==void 0&&this.shouldInRepetitionRecoveryBeTried(f,p,s)&&this.tryInRepetitionRecovery(e,t,n,f)}e.attemptInRepetitionRecovery=v})),Yo=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getKeyForAutomaticLookahead=e.AT_LEAST_ONE_SEP_IDX=e.MANY_SEP_IDX=e.AT_LEAST_ONE_IDX=e.MANY_IDX=e.OPTION_IDX=e.OR_IDX=e.BITS_FOR_ALT_IDX=e.BITS_FOR_RULE_IDX=e.BITS_FOR_OCCURRENCE_IDX=e.BITS_FOR_METHOD_TYPE=void 0,e.BITS_FOR_METHOD_TYPE=4,e.BITS_FOR_OCCURRENCE_IDX=8,e.BITS_FOR_RULE_IDX=12,e.BITS_FOR_ALT_IDX=8,e.OR_IDX=1<<e.BITS_FOR_OCCURRENCE_IDX,e.OPTION_IDX=2<<e.BITS_FOR_OCCURRENCE_IDX,e.MANY_IDX=3<<e.BITS_FOR_OCCURRENCE_IDX,e.AT_LEAST_ONE_IDX=4<<e.BITS_FOR_OCCURRENCE_IDX,e.MANY_SEP_IDX=5<<e.BITS_FOR_OCCURRENCE_IDX,e.AT_LEAST_ONE_SEP_IDX=6<<e.BITS_FOR_OCCURRENCE_IDX;function t(e,t,n){return n|t|e}e.getKeyForAutomaticLookahead=t,32-e.BITS_FOR_ALT_IDX})),Xo=o(((e,t,n)=>{var r=n&&n.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.LLkLookaheadStrategy=void 0;var a=i(Ho()),o=i(Gn()),s=Io(),c=us(),l=Go(),u=Wo();e.LLkLookaheadStrategy=function(){function e(e){this.maxLookahead=e?.maxLookahead??c.DEFAULT_PARSER_CONFIG.maxLookahead}return e.prototype.validate=function(e){var t=this.validateNoLeftRecursion(e.rules);if((0,o.default)(t)){var n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),a=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return r(r(r(r([],t,!0),n,!0),i,!0),a,!0)}return t},e.prototype.validateNoLeftRecursion=function(e){return(0,a.default)(e,function(e){return(0,l.validateNoLeftRecursion)(e,e,s.defaultGrammarValidatorErrorProvider)})},e.prototype.validateEmptyOrAlternatives=function(e){return(0,a.default)(e,function(e){return(0,l.validateEmptyOrAlternative)(e,s.defaultGrammarValidatorErrorProvider)})},e.prototype.validateAmbiguousAlternationAlternatives=function(e,t){return(0,a.default)(e,function(e){return(0,l.validateAmbiguousAlternationAlternatives)(e,t,s.defaultGrammarValidatorErrorProvider)})},e.prototype.validateSomeNonEmptyLookaheadPath=function(e,t){return(0,l.validateSomeNonEmptyLookaheadPath)(e,t,s.defaultGrammarValidatorErrorProvider)},e.prototype.buildLookaheadForAlternation=function(e){return(0,u.buildLookaheadFuncForOr)(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,u.buildAlternativesLookAheadFunc)},e.prototype.buildLookaheadForOptional=function(e){return(0,u.buildLookaheadFuncForOptionalProd)(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,(0,u.getProdType)(e.prodType),u.buildSingleAlternativeLookaheadFunction)},e}()})),Zo=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.collectMethods=e.LooksAhead=void 0;var a=i(Ti()),o=i(ki()),s=us(),c=Yo(),l=qa(),u=qa(),d=Xo();e.LooksAhead=function(){function e(){}return e.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=(0,o.default)(e,`dynamicTokensEnabled`)?e.dynamicTokensEnabled:s.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=(0,o.default)(e,`maxLookahead`)?e.maxLookahead:s.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookaheadStrategy=(0,o.default)(e,`lookaheadStrategy`)?e.lookaheadStrategy:new d.LLkLookaheadStrategy({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map},e.prototype.preComputeLookaheadFunctions=function(e){var t=this;(0,a.default)(e,function(e){t.TRACE_INIT(`${e.name} Rule Lookahead`,function(){var n=p(e),r=n.alternation,i=n.repetition,o=n.option,s=n.repetitionMandatory,l=n.repetitionMandatoryWithSeparator,d=n.repetitionWithSeparator;(0,a.default)(r,function(n){var r=n.idx===0?``:n.idx;t.TRACE_INIT(`${(0,u.getProductionDslName)(n)}${r}`,function(){var r=t.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:n.idx,rule:e,maxLookahead:n.maxLookahead||t.maxLookahead,hasPredicates:n.hasPredicates,dynamicTokensEnabled:t.dynamicTokensEnabled}),i=(0,c.getKeyForAutomaticLookahead)(t.fullRuleNameToShort[e.name],c.OR_IDX,n.idx);t.setLaFuncCache(i,r)})}),(0,a.default)(i,function(n){t.computeLookaheadFunc(e,n.idx,c.MANY_IDX,`Repetition`,n.maxLookahead,(0,u.getProductionDslName)(n))}),(0,a.default)(o,function(n){t.computeLookaheadFunc(e,n.idx,c.OPTION_IDX,`Option`,n.maxLookahead,(0,u.getProductionDslName)(n))}),(0,a.default)(s,function(n){t.computeLookaheadFunc(e,n.idx,c.AT_LEAST_ONE_IDX,`RepetitionMandatory`,n.maxLookahead,(0,u.getProductionDslName)(n))}),(0,a.default)(l,function(n){t.computeLookaheadFunc(e,n.idx,c.AT_LEAST_ONE_SEP_IDX,`RepetitionMandatoryWithSeparator`,n.maxLookahead,(0,u.getProductionDslName)(n))}),(0,a.default)(d,function(n){t.computeLookaheadFunc(e,n.idx,c.MANY_SEP_IDX,`RepetitionWithSeparator`,n.maxLookahead,(0,u.getProductionDslName)(n))})})})},e.prototype.computeLookaheadFunc=function(e,t,n,r,i,a){var o=this;this.TRACE_INIT(`${a}${t===0?``:t}`,function(){var a=o.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||o.maxLookahead,dynamicTokensEnabled:o.dynamicTokensEnabled,prodType:r}),s=(0,c.getKeyForAutomaticLookahead)(o.fullRuleNameToShort[e.name],n,t);o.setLaFuncCache(s,a)})},e.prototype.getKeyForAutomaticLookahead=function(e,t){var n=this.getLastExplicitRuleShortName();return(0,c.getKeyForAutomaticLookahead)(n,e,t)},e.prototype.getLaFuncFromCache=function(e){return this.lookAheadFuncsCache.get(e)},e.prototype.setLaFuncCache=function(e,t){this.lookAheadFuncsCache.set(e,t)},e}();var f=new(function(e){r(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},t}return t.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},t.prototype.visitOption=function(e){this.dslMethods.option.push(e)},t.prototype.visitRepetitionWithSeparator=function(e){this.dslMethods.repetitionWithSeparator.push(e)},t.prototype.visitRepetitionMandatory=function(e){this.dslMethods.repetitionMandatory.push(e)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)},t.prototype.visitRepetition=function(e){this.dslMethods.repetition.push(e)},t.prototype.visitAlternation=function(e){this.dslMethods.alternation.push(e)},t}(l.GAstVisitor));function p(e){f.reset(),e.accept(f);var t=f.dslMethods;return f.reset(),t}e.collectMethods=p})),Qo=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.addNoneTerminalToCst=e.addTerminalToCst=e.setNodeLocationFull=e.setNodeLocationOnlyOffset=void 0;function t(e,t){isNaN(e.startOffset)===!0?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset)}e.setNodeLocationOnlyOffset=t;function n(e,t){isNaN(e.startOffset)===!0?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}e.setNodeLocationFull=n;function r(e,t,n){e.children[n]===void 0?e.children[n]=[t]:e.children[n].push(t)}e.addTerminalToCst=r;function i(e,t,n){e.children[t]===void 0?e.children[t]=[n]:e.children[t].push(n)}e.addNoneTerminalToCst=i})),$o=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defineNameProp=void 0;var t=`name`;function n(e,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!0,writable:!1,value:n})}e.defineNameProp=n})),es=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.validateMissingCstMethods=e.validateVisitor=e.CstVisitorDefinitionError=e.createBaseVisitorConstructorWithDefaults=e.createBaseSemanticVisitorConstructor=e.defaultVisit=void 0;var i=r(Gn()),a=r(fo()),o=r(In()),s=r(Si()),c=r(Ti()),l=r(Co()),u=r(Br()),d=r(bn()),f=r(so()),p=$o();function m(e,t){for(var n=(0,u.default)(e),r=n.length,i=0;i<r;i++)for(var a=e[n[i]],o=a.length,s=0;s<o;s++){var c=a[s];c.tokenTypeIdx===void 0&&this[c.name](c.children,t)}}e.defaultVisit=m;function h(e,t){var n=function(){};return(0,p.defineNameProp)(n,e+`BaseSemantics`),n.prototype={visit:function(e,t){if((0,o.default)(e)&&(e=e[0]),!(0,f.default)(e))return this[e.name](e.children,t)},validateVisitor:function(){var e=v(this,t);if(!(0,i.default)(e)){var n=(0,s.default)(e,function(e){return e.msg});throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
93
|
+
${n.join(`
|
|
94
|
+
|
|
95
|
+
`).replace(/\n/g,`
|
|
96
|
+
`)}`)}}},n.prototype.constructor=n,n._RULE_NAMES=t,n}e.createBaseSemanticVisitorConstructor=h;function g(e,t,n){var r=function(){};(0,p.defineNameProp)(r,e+`BaseSemanticsWithDefaults`);var i=Object.create(n.prototype);return(0,c.default)(t,function(e){i[e]=m}),r.prototype=i,r.prototype.constructor=r,r}e.createBaseVisitorConstructorWithDefaults=g;var _;(function(e){e[e.REDUNDANT_METHOD=0]=`REDUNDANT_METHOD`,e[e.MISSING_METHOD=1]=`MISSING_METHOD`})(_=e.CstVisitorDefinitionError||={});function v(e,t){return y(e,t)}e.validateVisitor=v;function y(e,t){var n=(0,l.default)(t,function(t){return(0,d.default)(e[t])===!1}),r=(0,s.default)(n,function(t){return{msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:_.MISSING_METHOD,methodName:t}});return(0,a.default)(r)}e.validateMissingCstMethods=y})),ts=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.TreeBuilder=void 0;var i=Qo(),a=r(eo()),o=r(ki()),s=r(Br()),c=r(so()),l=es(),u=us();e.TreeBuilder=function(){function e(){}return e.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=(0,o.default)(e,`nodeLocationTracking`)?e.nodeLocationTracking:u.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=a.default,this.cstFinallyStateUpdate=a.default,this.cstPostTerminal=a.default,this.cstPostNonTerminal=a.default,this.cstPostRule=a.default;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=i.setNodeLocationFull,this.setNodeLocationFromNode=i.setNodeLocationFull,this.cstPostRule=a.default,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=a.default,this.setNodeLocationFromNode=a.default,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=i.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=i.setNodeLocationOnlyOffset,this.cstPostRule=a.default,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=a.default,this.setNodeLocationFromNode=a.default,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=a.default,this.setNodeLocationFromNode=a.default,this.cstPostRule=a.default,this.setInitialNodeLocation=a.default;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)},e.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(e){e.location={startOffset:NaN,endOffset:NaN}},e.prototype.setInitialNodeLocationOnlyOffsetRegular=function(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},e.prototype.setInitialNodeLocationFullRecovery=function(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},e.prototype.setInitialNodeLocationFullRegular=function(e){var t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},e.prototype.cstInvocationStateUpdate=function(e){var t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)},e.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},e.prototype.cstPostRuleFull=function(e){var t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)},e.prototype.cstPostRuleOnlyOffset=function(e){var t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=NaN},e.prototype.cstPostTerminal=function(e,t){var n=this.CST_STACK[this.CST_STACK.length-1];(0,i.addTerminalToCst)(n,t,e),this.setNodeLocationFromToken(n.location,t)},e.prototype.cstPostNonTerminal=function(e,t){var n=this.CST_STACK[this.CST_STACK.length-1];(0,i.addNoneTerminalToCst)(n,t,e),this.setNodeLocationFromNode(n.location,e.location)},e.prototype.getBaseCstVisitorConstructor=function(){if((0,c.default)(this.baseCstVisitorConstructor)){var e=(0,l.createBaseSemanticVisitorConstructor)(this.className,(0,s.default)(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},e.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,c.default)(this.baseCstVisitorWithDefaultsConstructor)){var e=(0,l.createBaseVisitorConstructorWithDefaults)(this.className,(0,s.default)(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor},e.prototype.getLastExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-1]},e.prototype.getPreviousExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-2]},e.prototype.getLastExplicitRuleOccurrenceIndex=function(){var e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]},e}()})),ns=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LexerAdapter=void 0;var t=us();e.LexerAdapter=function(){function e(){}return e.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(e.prototype,"input",{get:function(){return this.tokVector},set:function(e){if(this.selfAnalysisDone!==!0)throw Error(`Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.`);this.reset(),this.tokVector=e,this.tokVectorLength=e.length},enumerable:!1,configurable:!0}),e.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):t.END_OF_FILE},e.prototype.LA=function(e){var n=this.currIdx+e;return n<0||this.tokVectorLength<=n?t.END_OF_FILE:this.tokVector[n]},e.prototype.consumeToken=function(){this.currIdx++},e.prototype.exportLexerState=function(){return this.currIdx},e.prototype.importLexerState=function(e){this.currIdx=e},e.prototype.resetLexerState=function(){this.currIdx=-1},e.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},e.prototype.getLexerPosition=function(){return this.exportLexerState()},e}()})),rs=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.RecognizerApi=void 0;var i=r(Di()),a=r(Ga()),o=qo(),s=us(),c=Io(),l=Go(),u=qa();e.RecognizerApi=function(){function e(){}return e.prototype.ACTION=function(e){return e.call(this)},e.prototype.consume=function(e,t,n){return this.consumeInternal(t,e,n)},e.prototype.subrule=function(e,t,n){return this.subruleInternal(t,e,n)},e.prototype.option=function(e,t){return this.optionInternal(t,e)},e.prototype.or=function(e,t){return this.orInternal(t,e)},e.prototype.many=function(e,t){return this.manyInternal(e,t)},e.prototype.atLeastOne=function(e,t){return this.atLeastOneInternal(e,t)},e.prototype.CONSUME=function(e,t){return this.consumeInternal(e,0,t)},e.prototype.CONSUME1=function(e,t){return this.consumeInternal(e,1,t)},e.prototype.CONSUME2=function(e,t){return this.consumeInternal(e,2,t)},e.prototype.CONSUME3=function(e,t){return this.consumeInternal(e,3,t)},e.prototype.CONSUME4=function(e,t){return this.consumeInternal(e,4,t)},e.prototype.CONSUME5=function(e,t){return this.consumeInternal(e,5,t)},e.prototype.CONSUME6=function(e,t){return this.consumeInternal(e,6,t)},e.prototype.CONSUME7=function(e,t){return this.consumeInternal(e,7,t)},e.prototype.CONSUME8=function(e,t){return this.consumeInternal(e,8,t)},e.prototype.CONSUME9=function(e,t){return this.consumeInternal(e,9,t)},e.prototype.SUBRULE=function(e,t){return this.subruleInternal(e,0,t)},e.prototype.SUBRULE1=function(e,t){return this.subruleInternal(e,1,t)},e.prototype.SUBRULE2=function(e,t){return this.subruleInternal(e,2,t)},e.prototype.SUBRULE3=function(e,t){return this.subruleInternal(e,3,t)},e.prototype.SUBRULE4=function(e,t){return this.subruleInternal(e,4,t)},e.prototype.SUBRULE5=function(e,t){return this.subruleInternal(e,5,t)},e.prototype.SUBRULE6=function(e,t){return this.subruleInternal(e,6,t)},e.prototype.SUBRULE7=function(e,t){return this.subruleInternal(e,7,t)},e.prototype.SUBRULE8=function(e,t){return this.subruleInternal(e,8,t)},e.prototype.SUBRULE9=function(e,t){return this.subruleInternal(e,9,t)},e.prototype.OPTION=function(e){return this.optionInternal(e,0)},e.prototype.OPTION1=function(e){return this.optionInternal(e,1)},e.prototype.OPTION2=function(e){return this.optionInternal(e,2)},e.prototype.OPTION3=function(e){return this.optionInternal(e,3)},e.prototype.OPTION4=function(e){return this.optionInternal(e,4)},e.prototype.OPTION5=function(e){return this.optionInternal(e,5)},e.prototype.OPTION6=function(e){return this.optionInternal(e,6)},e.prototype.OPTION7=function(e){return this.optionInternal(e,7)},e.prototype.OPTION8=function(e){return this.optionInternal(e,8)},e.prototype.OPTION9=function(e){return this.optionInternal(e,9)},e.prototype.OR=function(e){return this.orInternal(e,0)},e.prototype.OR1=function(e){return this.orInternal(e,1)},e.prototype.OR2=function(e){return this.orInternal(e,2)},e.prototype.OR3=function(e){return this.orInternal(e,3)},e.prototype.OR4=function(e){return this.orInternal(e,4)},e.prototype.OR5=function(e){return this.orInternal(e,5)},e.prototype.OR6=function(e){return this.orInternal(e,6)},e.prototype.OR7=function(e){return this.orInternal(e,7)},e.prototype.OR8=function(e){return this.orInternal(e,8)},e.prototype.OR9=function(e){return this.orInternal(e,9)},e.prototype.MANY=function(e){this.manyInternal(0,e)},e.prototype.MANY1=function(e){this.manyInternal(1,e)},e.prototype.MANY2=function(e){this.manyInternal(2,e)},e.prototype.MANY3=function(e){this.manyInternal(3,e)},e.prototype.MANY4=function(e){this.manyInternal(4,e)},e.prototype.MANY5=function(e){this.manyInternal(5,e)},e.prototype.MANY6=function(e){this.manyInternal(6,e)},e.prototype.MANY7=function(e){this.manyInternal(7,e)},e.prototype.MANY8=function(e){this.manyInternal(8,e)},e.prototype.MANY9=function(e){this.manyInternal(9,e)},e.prototype.MANY_SEP=function(e){this.manySepFirstInternal(0,e)},e.prototype.MANY_SEP1=function(e){this.manySepFirstInternal(1,e)},e.prototype.MANY_SEP2=function(e){this.manySepFirstInternal(2,e)},e.prototype.MANY_SEP3=function(e){this.manySepFirstInternal(3,e)},e.prototype.MANY_SEP4=function(e){this.manySepFirstInternal(4,e)},e.prototype.MANY_SEP5=function(e){this.manySepFirstInternal(5,e)},e.prototype.MANY_SEP6=function(e){this.manySepFirstInternal(6,e)},e.prototype.MANY_SEP7=function(e){this.manySepFirstInternal(7,e)},e.prototype.MANY_SEP8=function(e){this.manySepFirstInternal(8,e)},e.prototype.MANY_SEP9=function(e){this.manySepFirstInternal(9,e)},e.prototype.AT_LEAST_ONE=function(e){this.atLeastOneInternal(0,e)},e.prototype.AT_LEAST_ONE1=function(e){return this.atLeastOneInternal(1,e)},e.prototype.AT_LEAST_ONE2=function(e){this.atLeastOneInternal(2,e)},e.prototype.AT_LEAST_ONE3=function(e){this.atLeastOneInternal(3,e)},e.prototype.AT_LEAST_ONE4=function(e){this.atLeastOneInternal(4,e)},e.prototype.AT_LEAST_ONE5=function(e){this.atLeastOneInternal(5,e)},e.prototype.AT_LEAST_ONE6=function(e){this.atLeastOneInternal(6,e)},e.prototype.AT_LEAST_ONE7=function(e){this.atLeastOneInternal(7,e)},e.prototype.AT_LEAST_ONE8=function(e){this.atLeastOneInternal(8,e)},e.prototype.AT_LEAST_ONE9=function(e){this.atLeastOneInternal(9,e)},e.prototype.AT_LEAST_ONE_SEP=function(e){this.atLeastOneSepFirstInternal(0,e)},e.prototype.AT_LEAST_ONE_SEP1=function(e){this.atLeastOneSepFirstInternal(1,e)},e.prototype.AT_LEAST_ONE_SEP2=function(e){this.atLeastOneSepFirstInternal(2,e)},e.prototype.AT_LEAST_ONE_SEP3=function(e){this.atLeastOneSepFirstInternal(3,e)},e.prototype.AT_LEAST_ONE_SEP4=function(e){this.atLeastOneSepFirstInternal(4,e)},e.prototype.AT_LEAST_ONE_SEP5=function(e){this.atLeastOneSepFirstInternal(5,e)},e.prototype.AT_LEAST_ONE_SEP6=function(e){this.atLeastOneSepFirstInternal(6,e)},e.prototype.AT_LEAST_ONE_SEP7=function(e){this.atLeastOneSepFirstInternal(7,e)},e.prototype.AT_LEAST_ONE_SEP8=function(e){this.atLeastOneSepFirstInternal(8,e)},e.prototype.AT_LEAST_ONE_SEP9=function(e){this.atLeastOneSepFirstInternal(9,e)},e.prototype.RULE=function(e,t,n){if(n===void 0&&(n=s.DEFAULT_RULE_CONFIG),(0,a.default)(this.definedRulesNames,e)){var r={message:c.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:s.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(r)}this.definedRulesNames.push(e);var i=this.defineRule(e,t,n);return this[e]=i,i},e.prototype.OVERRIDE_RULE=function(e,t,n){n===void 0&&(n=s.DEFAULT_RULE_CONFIG);var r=(0,l.validateRuleIsOverridden)(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);var i=this.defineRule(e,t,n);return this[e]=i,i},e.prototype.BACKTRACK=function(e,t){return function(){this.isBackTrackingStack.push(1);var n=this.saveRecogState();try{return e.apply(this,t),!0}catch(e){if((0,o.isRecognitionException)(e))return!1;throw e}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}},e.prototype.getGAstProductions=function(){return this.gastProductionsCache},e.prototype.getSerializedGastProductions=function(){return(0,u.serializeGrammar)((0,i.default)(this.gastProductionsCache))},e}()})),is=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.RecognizerEngine=void 0;var i=r(Gn()),a=r(In()),o=r(Za()),s=r(Ba()),c=r(ro()),l=r(yn()),u=r(ki()),d=r(Di()),f=r(Do()),p=r(oa()),m=Yo(),h=qo(),g=Wo(),_=B(),v=us(),y=Jo(),b=Fo(),x=Mo();e.RecognizerEngine=function(){function e(){}return e.prototype.initRecognizerEngine=function(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=x.tokenStructuredMatcherNoCategories,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,u.default)(t,`serializedGrammar`))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
97
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
98
|
+
For Further details.`);if((0,a.default)(e)){if((0,i.default)(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
99
|
+
Note that the first argument for the parser constructor
|
|
100
|
+
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset==`number`)throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
101
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
102
|
+
For Further details.`)}if((0,a.default)(e))this.tokensMap=(0,f.default)(e,function(e,t){return e[t.name]=t,e},{});else if((0,u.default)(e,`modes`)&&(0,s.default)((0,o.default)((0,d.default)(e.modes)),x.isTokenType)){var n=(0,o.default)((0,d.default)(e.modes)),r=(0,c.default)(n);this.tokensMap=(0,f.default)(r,function(e,t){return e[t.name]=t,e},{})}else if((0,l.default)(e))this.tokensMap=(0,p.default)(e);else throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap.EOF=b.EOF;var m=(0,u.default)(e,`modes`)?(0,o.default)((0,d.default)(e.modes)):(0,d.default)(e),h=(0,s.default)(m,function(e){return(0,i.default)(e.categoryMatches)});this.tokenMatcher=h?x.tokenStructuredMatcherNoCategories:x.tokenStructuredMatcher,(0,x.augmentTokenTypes)((0,d.default)(this.tokensMap))},e.prototype.defineRule=function(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
103
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var r=(0,u.default)(n,`resyncEnabled`)?n.resyncEnabled:v.DEFAULT_RULE_CONFIG.resyncEnabled,i=(0,u.default)(n,`recoveryValueFunc`)?n.recoveryValueFunc:v.DEFAULT_RULE_CONFIG.recoveryValueFunc,a=this.ruleShortNameIdx<<m.BITS_FOR_METHOD_TYPE+m.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;var o=this.outputCst===!0?function(){var n=[...arguments];try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n);var o=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(o),o}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(){var n=[...arguments];try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}};return Object.assign(o,{ruleName:e,originalGrammarAction:t})},e.prototype.invokeRuleCatch=function(e,t,n){var r=this.RULE_STACK.length===1,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if((0,h.isRecognitionException)(e)){var a=e;if(i){var o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o)){if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){var s=this.CST_STACK[this.CST_STACK.length-1];return s.recoveredNode=!0,s}return n(e)}if(this.outputCst){var s=this.CST_STACK[this.CST_STACK.length-1];s.recoveredNode=!0,a.partialCstResult=s}throw a}if(r)return this.moveToTerminatedState(),n(e);throw a}throw e},e.prototype.optionInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(m.OPTION_IDX,t);return this.optionInternalLogic(e,t,n)},e.prototype.optionInternalLogic=function(e,t,n){var r=this,i=this.getLaFuncFromCache(n),a;if(typeof e!=`function`){a=e.DEF;var o=e.GATE;if(o!==void 0){var s=i;i=function(){return o.call(r)&&s.call(r)}}}else a=e;if(i.call(this)===!0)return a.call(this)},e.prototype.atLeastOneInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(m.AT_LEAST_ONE_IDX,e);return this.atLeastOneInternalLogic(e,t,n)},e.prototype.atLeastOneInternalLogic=function(e,t,n){var r=this,i=this.getLaFuncFromCache(n),a;if(typeof t!=`function`){a=t.DEF;var o=t.GATE;if(o!==void 0){var s=i;i=function(){return o.call(r)&&s.call(r)}}}else a=t;if(i.call(this)===!0)for(var c=this.doSingleRepetition(a);i.call(this)===!0&&c===!0;)c=this.doSingleRepetition(a);else throw this.raiseEarlyExitException(e,g.PROD_TYPE.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,m.AT_LEAST_ONE_IDX,e,_.NextTerminalAfterAtLeastOneWalker)},e.prototype.atLeastOneSepFirstInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(m.AT_LEAST_ONE_SEP_IDX,e);this.atLeastOneSepFirstInternalLogic(e,t,n)},e.prototype.atLeastOneSepFirstInternalLogic=function(e,t,n){var r=this,i=t.DEF,a=t.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);for(var o=function(){return r.tokenMatcher(r.LA(1),a)};this.tokenMatcher(this.LA(1),a)===!0;)this.CONSUME(a),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,o,i,_.NextTerminalAfterAtLeastOneSepWalker],o,m.AT_LEAST_ONE_SEP_IDX,e,_.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(e,g.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)},e.prototype.manyInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(m.MANY_IDX,e);return this.manyInternalLogic(e,t,n)},e.prototype.manyInternalLogic=function(e,t,n){var r=this,i=this.getLaFuncFromCache(n),a;if(typeof t!=`function`){a=t.DEF;var o=t.GATE;if(o!==void 0){var s=i;i=function(){return o.call(r)&&s.call(r)}}}else a=t;for(var c=!0;i.call(this)===!0&&c===!0;)c=this.doSingleRepetition(a);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,m.MANY_IDX,e,_.NextTerminalAfterManyWalker,c)},e.prototype.manySepFirstInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(m.MANY_SEP_IDX,e);this.manySepFirstInternalLogic(e,t,n)},e.prototype.manySepFirstInternalLogic=function(e,t,n){var r=this,i=t.DEF,a=t.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);for(var o=function(){return r.tokenMatcher(r.LA(1),a)};this.tokenMatcher(this.LA(1),a)===!0;)this.CONSUME(a),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,o,i,_.NextTerminalAfterManySepWalker],o,m.MANY_SEP_IDX,e,_.NextTerminalAfterManySepWalker)}},e.prototype.repetitionSepSecondInternal=function(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,m.AT_LEAST_ONE_SEP_IDX,e,i)},e.prototype.doSingleRepetition=function(e){var t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t},e.prototype.orInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(m.OR_IDX,t),r=(0,a.default)(e)?e:e.DEF,i=this.getLaFuncFromCache(n).call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)},e.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new h.NotAllInputParsedException(t,e))}},e.prototype.subruleInternal=function(e,t,n){var r;try{var i=n===void 0?void 0:n.ARGS;return this.subruleIdx=t,r=e.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}},e.prototype.subruleInternalError=function(e,t,n){throw(0,h.isRecognitionException)(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e},e.prototype.consumeInternal=function(e,t,n){var r;try{var i=this.LA(1);this.tokenMatcher(i,e)===!0?(this.consumeToken(),r=i):this.consumeInternalError(e,i,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,r),r},e.prototype.consumeInternalError=function(e,t,n){var r,i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new h.MismatchedTokenException(r,t,i))},e.prototype.consumeInternalRecovery=function(e,t,n){if(this.recoveryEnabled&&n.name===`MismatchedTokenException`&&!this.isBackTracking()){var r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===y.IN_RULE_RECOVERY_EXCEPTION?n:e}}throw n},e.prototype.saveRecogState=function(){var e=this.errors,t=(0,p.default)(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}},e.prototype.reloadRecogState=function(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK},e.prototype.ruleInvocationStateUpdate=function(e,t,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)},e.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},e.prototype.getCurrRuleFullName=function(){var e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]},e.prototype.shortRuleNameToFullName=function(e){return this.shortRuleNameToFull[e]},e.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),b.EOF)},e.prototype.reset=function(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},e}()})),as=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorHandler=void 0;var i=qo(),a=r(ki()),o=r(oa()),s=Wo(),c=us();e.ErrorHandler=function(){function e(){}return e.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=(0,a.default)(e,`errorMessageProvider`)?e.errorMessageProvider:c.DEFAULT_PARSER_CONFIG.errorMessageProvider},e.prototype.SAVE_ERROR=function(e){if((0,i.isRecognitionException)(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,o.default)(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error(`Trying to save an Error which is not a RecognitionException`)},Object.defineProperty(e.prototype,"errors",{get:function(){return(0,o.default)(this._errors)},set:function(e){this._errors=e},enumerable:!1,configurable:!0}),e.prototype.raiseEarlyExitException=function(e,t,n){for(var r=this.getCurrRuleFullName(),a=this.getGAstProductions()[r],o=(0,s.getLookaheadPathsForOptionalProd)(e,a,t,this.maxLookahead)[0],c=[],l=1;l<=this.maxLookahead;l++)c.push(this.LA(l));var u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:c,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new i.EarlyExitException(u,this.LA(1),this.LA(0)))},e.prototype.raiseNoAltException=function(e,t){for(var n=this.getCurrRuleFullName(),r=this.getGAstProductions()[n],a=(0,s.getLookaheadPathsForOr)(e,r,this.maxLookahead),o=[],c=1;c<=this.maxLookahead;c++)o.push(this.LA(c));var l=this.LA(0),u=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:a,actual:o,previous:l,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new i.NoViableAltException(u,this.LA(1),l))},e}()})),os=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.ContentAssist=void 0;var i=B(),a=r(uo()),o=r(so());e.ContentAssist=function(){function e(){}return e.prototype.initContentAssist=function(){},e.prototype.computeContentAssist=function(e,t){var n=this.gastProductionsCache[e];if((0,o.default)(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return(0,i.nextPossibleTokensAfter)([n],t,this.tokenMatcher,this.maxLookahead)},e.prototype.getNextPossibleTokenTypes=function(e){var t=(0,a.default)(e.ruleStack),n=this.getGAstProductions()[t];return new i.NextAfterTokenWalker(n,e).startWalking()},e}()})),ss=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.GastRecorder=void 0;var i=r(jo()),a=r(In()),o=r(La()),s=r(Ti()),c=r(bn()),l=r(ki()),u=qa(),d=Po(),f=Mo(),p=Fo(),m=us(),h=Yo(),g={description:`This Object indicates the Parser is during Recording Phase`};Object.freeze(g);var _=!0,v=2**h.BITS_FOR_OCCURRENCE_IDX-1,y=(0,p.createToken)({name:`RECORDING_PHASE_TOKEN`,pattern:d.Lexer.NA});(0,f.augmentTokenTypes)([y]);var b=(0,p.createTokenInstance)(y,`This IToken indicates the Parser is in Recording Phase
|
|
104
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(b);var x={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
105
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};e.GastRecorder=function(){function e(){}return e.prototype.initGastRecorder=function(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1},e.prototype.enableRecording=function(){var e=this;this.RECORDING_PHASE=!0,this.TRACE_INIT(`Enable Recording`,function(){for(var t=function(t){var n=t>0?t:``;e[`CONSUME${n}`]=function(e,n){return this.consumeInternalRecord(e,t,n)},e[`SUBRULE${n}`]=function(e,n){return this.subruleInternalRecord(e,t,n)},e[`OPTION${n}`]=function(e){return this.optionInternalRecord(e,t)},e[`OR${n}`]=function(e){return this.orInternalRecord(e,t)},e[`MANY${n}`]=function(e){this.manyInternalRecord(t,e)},e[`MANY_SEP${n}`]=function(e){this.manySepFirstInternalRecord(t,e)},e[`AT_LEAST_ONE${n}`]=function(e){this.atLeastOneInternalRecord(t,e)},e[`AT_LEAST_ONE_SEP${n}`]=function(e){this.atLeastOneSepFirstInternalRecord(t,e)}},n=0;n<10;n++)t(n);e.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},e.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},e.option=function(e,t){return this.optionInternalRecord(t,e)},e.or=function(e,t){return this.orInternalRecord(t,e)},e.many=function(e,t){this.manyInternalRecord(e,t)},e.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},e.ACTION=e.ACTION_RECORD,e.BACKTRACK=e.BACKTRACK_RECORD,e.LA=e.LA_RECORD})},e.prototype.disableRecording=function(){var e=this;this.RECORDING_PHASE=!1,this.TRACE_INIT(`Deleting Recording methods`,function(){for(var t=e,n=0;n<10;n++){var r=n>0?n:``;delete t[`CONSUME${r}`],delete t[`SUBRULE${r}`],delete t[`OPTION${r}`],delete t[`OR${r}`],delete t[`MANY${r}`],delete t[`MANY_SEP${r}`],delete t[`AT_LEAST_ONE${r}`],delete t[`AT_LEAST_ONE_SEP${r}`]}delete t.consume,delete t.subrule,delete t.option,delete t.or,delete t.many,delete t.atLeastOne,delete t.ACTION,delete t.BACKTRACK,delete t.LA})},e.prototype.ACTION_RECORD=function(e){},e.prototype.BACKTRACK_RECORD=function(e,t){return function(){return!0}},e.prototype.LA_RECORD=function(e){return m.END_OF_FILE},e.prototype.topLevelRuleRecord=function(e,t){try{var n=new u.Rule({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(e.KNOWN_RECORDER_ERROR!==!0)try{e.message+=`
|
|
106
|
+
This error was thrown during the "grammar recording phase" For more info see:
|
|
107
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}},e.prototype.optionInternalRecord=function(e,t){return S.call(this,u.Option,e,t)},e.prototype.atLeastOneInternalRecord=function(e,t){S.call(this,u.RepetitionMandatory,t,e)},e.prototype.atLeastOneSepFirstInternalRecord=function(e,t){S.call(this,u.RepetitionMandatoryWithSeparator,t,e,_)},e.prototype.manyInternalRecord=function(e,t){S.call(this,u.Repetition,t,e)},e.prototype.manySepFirstInternalRecord=function(e,t){S.call(this,u.RepetitionWithSeparator,t,e,_)},e.prototype.orInternalRecord=function(e,t){return C.call(this,e,t)},e.prototype.subruleInternalRecord=function(e,t,n){if(T(t),!e||(0,l.default)(e,`ruleName`)===!1){var r=Error(`<SUBRULE${w(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
108
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw r.KNOWN_RECORDER_ERROR=!0,r}var a=(0,i.default)(this.recordingProdStack),o=e.ruleName,s=new u.NonTerminal({idx:t,nonTerminalName:o,label:n?.LABEL,referencedRule:void 0});return a.definition.push(s),this.outputCst?x:g},e.prototype.consumeInternalRecord=function(e,t,n){if(T(t),!(0,f.hasShortKeyProperty)(e)){var r=Error(`<CONSUME${w(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
109
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw r.KNOWN_RECORDER_ERROR=!0,r}var a=(0,i.default)(this.recordingProdStack),o=new u.Terminal({idx:t,terminalType:e,label:n?.LABEL});return a.definition.push(o),b},e}();function S(e,t,n,r){r===void 0&&(r=!1),T(n);var a=(0,i.default)(this.recordingProdStack),o=(0,c.default)(t)?t:t.DEF,s=new e({definition:[],idx:n});return r&&(s.separator=t.SEP),(0,l.default)(t,`MAX_LOOKAHEAD`)&&(s.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),a.definition.push(s),this.recordingProdStack.pop(),g}function C(e,t){var n=this;T(t);var r=(0,i.default)(this.recordingProdStack),d=(0,a.default)(e)===!1,f=d===!1?e:e.DEF,p=new u.Alternation({definition:[],idx:t,ignoreAmbiguities:d&&e.IGNORE_AMBIGUITIES===!0});return(0,l.default)(e,`MAX_LOOKAHEAD`)&&(p.maxLookahead=e.MAX_LOOKAHEAD),p.hasPredicates=(0,o.default)(f,function(e){return(0,c.default)(e.GATE)}),r.definition.push(p),(0,s.default)(f,function(e){var t=new u.Alternative({definition:[]});p.definition.push(t),(0,l.default)(e,`IGNORE_AMBIGUITIES`)?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:(0,l.default)(e,`GATE`)&&(t.ignoreAmbiguities=!0),n.recordingProdStack.push(t),e.ALT.call(n),n.recordingProdStack.pop()}),g}function w(e){return e===0?``:`${e}`}function T(e){if(e<0||e>v){var t=Error(`Invalid DSL Method idx value: <${e}>
|
|
110
|
+
Idx value must be a none negative value smaller than ${v+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}})),cs=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.PerformanceTracer=void 0;var i=r(ki()),a=ua(),o=us();e.PerformanceTracer=function(){function e(){}return e.prototype.initPerformanceTracer=function(e){if((0,i.default)(e,`traceInitPerf`)){var t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=o.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},e.prototype.TRACE_INIT=function(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;var n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);var r=(0,a.timer)(t),i=r.time,o=r.value,s=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,o}return t()},e}()})),ls=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.applyMixins=void 0;function t(e,t){t.forEach(function(t){var n=t.prototype;Object.getOwnPropertyNames(n).forEach(function(r){if(r!==`constructor`){var i=Object.getOwnPropertyDescriptor(n,r);i&&(i.get||i.set)?Object.defineProperty(e.prototype,r,i):e.prototype[r]=t.prototype[r]}})})}e.applyMixins=t})),us=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.EmbeddedActionsParser=e.CstParser=e.Parser=e.EMPTY_ALT=e.ParserDefinitionErrorType=e.DEFAULT_RULE_CONFIG=e.DEFAULT_PARSER_CONFIG=e.END_OF_FILE=void 0;var a=i(Gn()),o=i(Si()),s=i(Ti()),c=i(Di()),l=i(ki()),u=i(oa()),d=ua(),f=oo(),p=Fo(),m=Io(),h=Ko(),g=Jo(),_=Zo(),v=ts(),y=ns(),b=rs(),x=is(),S=as(),C=os(),w=ss(),T=cs(),E=ls(),D=Go();e.END_OF_FILE=(0,p.createTokenInstance)(p.EOF,``,NaN,NaN,NaN,NaN,NaN,NaN),Object.freeze(e.END_OF_FILE),e.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:m.defaultParserErrorProvider,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),e.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0}),(function(e){e[e.INVALID_RULE_NAME=0]=`INVALID_RULE_NAME`,e[e.DUPLICATE_RULE_NAME=1]=`DUPLICATE_RULE_NAME`,e[e.INVALID_RULE_OVERRIDE=2]=`INVALID_RULE_OVERRIDE`,e[e.DUPLICATE_PRODUCTIONS=3]=`DUPLICATE_PRODUCTIONS`,e[e.UNRESOLVED_SUBRULE_REF=4]=`UNRESOLVED_SUBRULE_REF`,e[e.LEFT_RECURSION=5]=`LEFT_RECURSION`,e[e.NONE_LAST_EMPTY_ALT=6]=`NONE_LAST_EMPTY_ALT`,e[e.AMBIGUOUS_ALTS=7]=`AMBIGUOUS_ALTS`,e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]=`CONFLICT_TOKENS_RULES_NAMESPACE`,e[e.INVALID_TOKEN_NAME=9]=`INVALID_TOKEN_NAME`,e[e.NO_NON_EMPTY_LOOKAHEAD=10]=`NO_NON_EMPTY_LOOKAHEAD`,e[e.AMBIGUOUS_PREFIX_ALTS=11]=`AMBIGUOUS_PREFIX_ALTS`,e[e.TOO_MANY_ALTS=12]=`TOO_MANY_ALTS`,e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]=`CUSTOM_LOOKAHEAD_VALIDATION`})(e.ParserDefinitionErrorType||={});function O(e){return e===void 0&&(e=void 0),function(){return e}}e.EMPTY_ALT=O;var k=function(){function t(t,n){this.definitionErrors=[],this.selfAnalysisDone=!1;var r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(t,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),(0,l.default)(n,`ignoredIssues`))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
111
|
+
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
112
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
113
|
+
For further details.`);this.skipValidations=(0,l.default)(n,`skipValidations`)?n.skipValidations:e.DEFAULT_PARSER_CONFIG.skipValidations}return t.performSelfAnalysis=function(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},t.prototype.performSelfAnalysis=function(){var e=this;this.TRACE_INIT(`performSelfAnalysis`,function(){var n;e.selfAnalysisDone=!0;var r=e.className;e.TRACE_INIT(`toFastProps`,function(){(0,d.toFastProperties)(e)}),e.TRACE_INIT(`Grammar Recording`,function(){try{e.enableRecording(),(0,s.default)(e.definedRulesNames,function(t){var n=e[t].originalGrammarAction,r;e.TRACE_INIT(`${t} Rule`,function(){r=e.topLevelRuleRecord(t,n)}),e.gastProductionsCache[t]=r})}finally{e.disableRecording()}});var i=[];if(e.TRACE_INIT(`Grammar Resolving`,function(){i=(0,h.resolveGrammar)({rules:(0,c.default)(e.gastProductionsCache)}),e.definitionErrors=e.definitionErrors.concat(i)}),e.TRACE_INIT(`Grammar Validations`,function(){if((0,a.default)(i)&&e.skipValidations===!1){var t=(0,h.validateGrammar)({rules:(0,c.default)(e.gastProductionsCache),tokenTypes:(0,c.default)(e.tokensMap),errMsgProvider:m.defaultGrammarValidatorErrorProvider,grammarName:r}),n=(0,D.validateLookahead)({lookaheadStrategy:e.lookaheadStrategy,rules:(0,c.default)(e.gastProductionsCache),tokenTypes:(0,c.default)(e.tokensMap),grammarName:r});e.definitionErrors=e.definitionErrors.concat(t,n)}}),(0,a.default)(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT(`computeAllProdsFollows`,function(){e.resyncFollows=(0,f.computeAllProdsFollows)((0,c.default)(e.gastProductionsCache))}),e.TRACE_INIT(`ComputeLookaheadFunctions`,function(){var t,n;(n=(t=e.lookaheadStrategy).initialize)==null||n.call(t,{rules:(0,c.default)(e.gastProductionsCache)}),e.preComputeLookaheadFunctions((0,c.default)(e.gastProductionsCache))})),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,a.default)(e.definitionErrors))throw n=(0,o.default)(e.definitionErrors,function(e){return e.message}),Error(`Parser Definition Errors detected:
|
|
114
|
+
${n.join(`
|
|
115
|
+
-------------------------------
|
|
116
|
+
`)}`)})},t.DEFER_DEFINITION_ERRORS_HANDLING=!1,t}();e.Parser=k,(0,E.applyMixins)(k,[g.Recoverable,_.LooksAhead,v.TreeBuilder,y.LexerAdapter,x.RecognizerEngine,b.RecognizerApi,S.ErrorHandler,C.ContentAssist,w.GastRecorder,T.PerformanceTracer]),e.CstParser=function(t){r(n,t);function n(n,r){r===void 0&&(r=e.DEFAULT_PARSER_CONFIG);var i=(0,u.default)(r);return i.outputCst=!0,t.call(this,n,i)||this}return n}(k),e.EmbeddedActionsParser=function(t){r(n,t);function n(n,r){r===void 0&&(r=e.DEFAULT_PARSER_CONFIG);var i=(0,u.default)(r);return i.outputCst=!1,t.call(this,n,i)||this}return n}(k)})),ds=o(((e,t,n)=>{var r=n&&n.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.buildModel=void 0;var a=qa(),o=i(Si()),s=i(Za()),c=i(Di()),l=i(La()),u=i(Vo()),d=i(Na());function f(e){var t=new p,n=(0,c.default)(e);return(0,o.default)(n,function(e){return t.visitRule(e)})}e.buildModel=f;var p=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.visitRule=function(e){var t=this.visitEach(e.definition),n=(0,u.default)(t,function(e){return e.propertyName}),r=(0,o.default)(n,function(e,t){var n=!(0,l.default)(e,function(e){return!e.canBeNull}),r=e[0].type;return e.length>1&&(r=(0,o.default)(e,function(e){return e.type})),{name:t,type:r,optional:n}});return{name:e.name,properties:r}},t.prototype.visitAlternative=function(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})},t.prototype.visitOption=function(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})},t.prototype.visitRepetition=function(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})},t.prototype.visitRepetitionMandatory=function(e){return this.visitEach(e.definition)},t.prototype.visitRepetitionMandatoryWithSeparator=function(e){return this.visitEach(e.definition).concat({propertyName:e.separator.name,canBeNull:!0,type:m(e.separator)})},t.prototype.visitRepetitionWithSeparator=function(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0}).concat({propertyName:e.separator.name,canBeNull:!0,type:m(e.separator)})},t.prototype.visitAlternation=function(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})},t.prototype.visitTerminal=function(e){return[{propertyName:e.label||e.terminalType.name,canBeNull:!1,type:m(e)}]},t.prototype.visitNonTerminal=function(e){return[{propertyName:e.label||e.nonTerminalName,canBeNull:!1,type:m(e)}]},t.prototype.visitEachAndOverrideWith=function(e,t){return(0,o.default)(this.visitEach(e),function(e){return(0,d.default)({},e,t)})},t.prototype.visitEach=function(e){var t=this;return(0,s.default)((0,o.default)(e,function(e){return t.visit(e)}))},t}(a.GAstVisitor);function m(e){return e instanceof a.NonTerminal?{kind:`rule`,name:e.referencedRule.name}:{kind:`token`}}})),fs=o(((e,t)=>{var n=da();function r(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:n(e,t,r)}t.exports=r})),ps=o(((e,t)=>{var n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function r(e){return n.test(e)}t.exports=r})),ms=o(((e,t)=>{function n(e){return e.split(``)}t.exports=n})),hs=o(((e,t)=>{var n=`\\ud800-\\udfff`,r=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,i=`\\ufe0e\\ufe0f`,a=`[`+n+`]`,o=`[`+r+`]`,s=`\\ud83c[\\udffb-\\udfff]`,c=`(?:`+o+`|`+s+`)`,l=`[^`+n+`]`,u=`(?:\\ud83c[\\udde6-\\uddff]){2}`,d=`[\\ud800-\\udbff][\\udc00-\\udfff]`,f=`\\u200d`,p=c+`?`,m=`[`+i+`]?`,h=`(?:`+f+`(?:`+[l,u,d].join(`|`)+`)`+m+p+`)*`,g=m+p+h,_=`(?:`+[l+o+`?`,o,u,d,a].join(`|`)+`)`,v=RegExp(s+`(?=`+s+`)|`+_+g,`g`);function y(e){return e.match(v)||[]}t.exports=y})),gs=o(((e,t)=>{var n=ms(),r=ps(),i=hs();function a(e){return r(e)?i(e):n(e)}t.exports=a})),_s=o(((e,t)=>{var n=fs(),r=ps(),i=gs(),a=ni();function o(e){return function(t){t=a(t);var o=r(t)?i(t):void 0,s=o?o[0]:t.charAt(0),c=o?n(o,1).join(``):t.slice(1);return s[e]()+c}}t.exports=o})),vs=o(((e,t)=>{t.exports=_s()(`toUpperCase`)})),ys=o(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.genDts=void 0;var i=r(Za()),a=r(In()),o=r(Si()),s=r(Do()),c=r(ro()),l=r(vs());function u(e,t){var n=[];return n=n.concat(`import type { CstNode, ICstVisitor, IToken } from "chevrotain";`),n=n.concat((0,i.default)((0,o.default)(e,function(e){return d(e)}))),t.includeVisitorInterface&&(n=n.concat(h(t.visitorInterfaceName,e))),n.join(`
|
|
117
|
+
|
|
118
|
+
`)+`
|
|
119
|
+
`}e.genDts=u;function d(e){return[f(e),p(e)]}function f(e){var t=y(e.name),n=b(e.name);return`export interface ${t} extends CstNode {
|
|
120
|
+
name: "${e.name}";
|
|
121
|
+
children: ${n};
|
|
122
|
+
}`}function p(e){return`export type ${b(e.name)} = {
|
|
123
|
+
${(0,o.default)(e.properties,function(e){return m(e)}).join(`
|
|
124
|
+
`)}
|
|
125
|
+
};`}function m(e){var t=_(e.type);return`${e.name}${e.optional?`?`:``}: ${t}[];`}function h(e,t){return`export interface ${e}<IN, OUT> extends ICstVisitor<IN, OUT> {
|
|
126
|
+
${(0,o.default)(t,function(e){return g(e)}).join(`
|
|
127
|
+
`)}
|
|
128
|
+
}`}function g(e){var t=b(e.name);return`${e.name}(children: ${t}, param?: IN): OUT;`}function _(e){if((0,a.default)(e)){var t=(0,c.default)((0,o.default)(e,function(e){return v(e)}));return`(`+(0,s.default)(t,function(e,t){return e+` | `+t})+`)`}return v(e)}function v(e){return e.kind===`token`?`IToken`:y(e.name)}function y(e){return(0,l.default)(e)+`CstNode`}function b(e){return(0,l.default)(e)+`CstChildren`}})),bs=o(((e,t,n)=>{var r=n&&n.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.generateCstDts=void 0;var i=ds(),a=ys(),o={includeVisitorInterface:!0,visitorInterfaceName:`ICstNodeVisitor`};function s(e,t){var n=r(r({},o),t),s=(0,i.buildModel)(e);return(0,a.genDts)(s,n)}e.generateCstDts=s})),xs=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createSyntaxDiagramsCode=void 0;var t=cn();function n(e,n){var r=n===void 0?{}:n,i=r.resourceBase,a=i===void 0?`https://unpkg.com/chevrotain@${t.VERSION}/diagrams/`:i,o=r.css,s=o===void 0?`https://unpkg.com/chevrotain@${t.VERSION}/diagrams/diagrams.css`:o,c=`
|
|
129
|
+
<!-- This is a generated file -->
|
|
130
|
+
<!DOCTYPE html>
|
|
131
|
+
<meta charset="utf-8">
|
|
132
|
+
<style>
|
|
133
|
+
body {
|
|
134
|
+
background-color: hsl(30, 20%, 95%)
|
|
135
|
+
}
|
|
136
|
+
</style>
|
|
137
|
+
|
|
138
|
+
`,l=`
|
|
139
|
+
<link rel='stylesheet' href='${s}'>
|
|
140
|
+
`,u=`
|
|
141
|
+
<script src='${a}vendor/railroad-diagrams.js'><\/script>
|
|
142
|
+
<script src='${a}src/diagrams_builder.js'><\/script>
|
|
143
|
+
<script src='${a}src/diagrams_behavior.js'><\/script>
|
|
144
|
+
<script src='${a}src/main.js'><\/script>
|
|
145
|
+
`,d=`
|
|
146
|
+
<div id="diagrams" align="center"></div>
|
|
147
|
+
`,f=`
|
|
148
|
+
<script>
|
|
149
|
+
window.serializedGrammar = ${JSON.stringify(e,null,` `)};
|
|
150
|
+
<\/script>
|
|
151
|
+
`;return c+l+u+d+f+`
|
|
152
|
+
<script>
|
|
153
|
+
var diagramsDiv = document.getElementById("diagrams");
|
|
154
|
+
main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);
|
|
155
|
+
<\/script>
|
|
156
|
+
`}e.createSyntaxDiagramsCode=n})),V=c(o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=e.createSyntaxDiagramsCode=e.clearCache=e.generateCstDts=e.GAstVisitor=e.serializeProduction=e.serializeGrammar=e.Terminal=e.Rule=e.RepetitionWithSeparator=e.RepetitionMandatoryWithSeparator=e.RepetitionMandatory=e.Repetition=e.Option=e.NonTerminal=e.Alternative=e.Alternation=e.defaultLexerErrorProvider=e.NoViableAltException=e.NotAllInputParsedException=e.MismatchedTokenException=e.isRecognitionException=e.EarlyExitException=e.defaultParserErrorProvider=e.LLkLookaheadStrategy=e.getLookaheadPaths=e.tokenName=e.tokenMatcher=e.tokenLabel=e.EOF=e.createTokenInstance=e.createToken=e.LexerDefinitionErrorType=e.Lexer=e.EMPTY_ALT=e.ParserDefinitionErrorType=e.EmbeddedActionsParser=e.CstParser=e.VERSION=void 0;var t=cn();Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return t.VERSION}});var n=us();Object.defineProperty(e,"CstParser",{enumerable:!0,get:function(){return n.CstParser}}),Object.defineProperty(e,"EmbeddedActionsParser",{enumerable:!0,get:function(){return n.EmbeddedActionsParser}}),Object.defineProperty(e,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return n.ParserDefinitionErrorType}}),Object.defineProperty(e,"EMPTY_ALT",{enumerable:!0,get:function(){return n.EMPTY_ALT}});var r=Po();Object.defineProperty(e,"Lexer",{enumerable:!0,get:function(){return r.Lexer}}),Object.defineProperty(e,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return r.LexerDefinitionErrorType}});var i=Fo();Object.defineProperty(e,"createToken",{enumerable:!0,get:function(){return i.createToken}}),Object.defineProperty(e,"createTokenInstance",{enumerable:!0,get:function(){return i.createTokenInstance}}),Object.defineProperty(e,"EOF",{enumerable:!0,get:function(){return i.EOF}}),Object.defineProperty(e,"tokenLabel",{enumerable:!0,get:function(){return i.tokenLabel}}),Object.defineProperty(e,"tokenMatcher",{enumerable:!0,get:function(){return i.tokenMatcher}}),Object.defineProperty(e,"tokenName",{enumerable:!0,get:function(){return i.tokenName}});var a=Wo();Object.defineProperty(e,"getLookaheadPaths",{enumerable:!0,get:function(){return a.getLookaheadPaths}});var o=Xo();Object.defineProperty(e,"LLkLookaheadStrategy",{enumerable:!0,get:function(){return o.LLkLookaheadStrategy}});var s=Io();Object.defineProperty(e,"defaultParserErrorProvider",{enumerable:!0,get:function(){return s.defaultParserErrorProvider}});var c=qo();Object.defineProperty(e,"EarlyExitException",{enumerable:!0,get:function(){return c.EarlyExitException}}),Object.defineProperty(e,"isRecognitionException",{enumerable:!0,get:function(){return c.isRecognitionException}}),Object.defineProperty(e,"MismatchedTokenException",{enumerable:!0,get:function(){return c.MismatchedTokenException}}),Object.defineProperty(e,"NotAllInputParsedException",{enumerable:!0,get:function(){return c.NotAllInputParsedException}}),Object.defineProperty(e,"NoViableAltException",{enumerable:!0,get:function(){return c.NoViableAltException}});var l=No();Object.defineProperty(e,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return l.defaultLexerErrorProvider}});var u=qa();Object.defineProperty(e,"Alternation",{enumerable:!0,get:function(){return u.Alternation}}),Object.defineProperty(e,"Alternative",{enumerable:!0,get:function(){return u.Alternative}}),Object.defineProperty(e,"NonTerminal",{enumerable:!0,get:function(){return u.NonTerminal}}),Object.defineProperty(e,"Option",{enumerable:!0,get:function(){return u.Option}}),Object.defineProperty(e,"Repetition",{enumerable:!0,get:function(){return u.Repetition}}),Object.defineProperty(e,"RepetitionMandatory",{enumerable:!0,get:function(){return u.RepetitionMandatory}}),Object.defineProperty(e,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return u.RepetitionMandatoryWithSeparator}}),Object.defineProperty(e,"RepetitionWithSeparator",{enumerable:!0,get:function(){return u.RepetitionWithSeparator}}),Object.defineProperty(e,"Rule",{enumerable:!0,get:function(){return u.Rule}}),Object.defineProperty(e,"Terminal",{enumerable:!0,get:function(){return u.Terminal}});var d=qa();Object.defineProperty(e,"serializeGrammar",{enumerable:!0,get:function(){return d.serializeGrammar}}),Object.defineProperty(e,"serializeProduction",{enumerable:!0,get:function(){return d.serializeProduction}}),Object.defineProperty(e,"GAstVisitor",{enumerable:!0,get:function(){return d.GAstVisitor}});var f=bs();Object.defineProperty(e,"generateCstDts",{enumerable:!0,get:function(){return f.generateCstDts}});function p(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
|
|
157
|
+
It performs no action other than printing this message.
|
|
158
|
+
Please avoid using it as it will be completely removed in the future`)}e.clearCache=p;var m=xs();Object.defineProperty(e,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return m.createSyntaxDiagramsCode}}),e.Parser=function(){function e(){throw Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
|
|
159
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return e}()}))(),1);V.Alternation,V.Alternative;var Ss=V.CstParser;V.EMPTY_ALT,V.EOF,V.EarlyExitException,V.EmbeddedActionsParser,V.GAstVisitor,V.LLkLookaheadStrategy;var Cs=V.Lexer;V.LexerDefinitionErrorType,V.MismatchedTokenException,V.NoViableAltException,V.NonTerminal,V.NotAllInputParsedException,V.Option,V.default.Parser,V.ParserDefinitionErrorType,V.Repetition,V.RepetitionMandatory,V.RepetitionMandatoryWithSeparator,V.RepetitionWithSeparator,V.Rule,V.Terminal,V.VERSION,V.default.clearCache,V.createSyntaxDiagramsCode;var H=V.createToken;V.createTokenInstance,V.defaultLexerErrorProvider,V.defaultParserErrorProvider,V.generateCstDts,V.getLookaheadPaths,V.isRecognitionException,V.serializeGrammar,V.serializeProduction,V.tokenLabel,V.tokenMatcher,V.tokenName;var ws=H({name:`KeywordReserved`,pattern:Cs.NA}),U=H({name:`Keyword`,pattern:Cs.NA}),Ts=H({name:`DateFunction`,pattern:Cs.NA}),Es=H({name:`AggregateFunction`,pattern:Cs.NA}),Ds=H({name:`LocationFunction`,pattern:Cs.NA}),Os=H({name:`FieldsFunction`,pattern:Cs.NA}),ks=H({name:`FieldsFunctionParamIdentifier`,pattern:Cs.NA}),As=H({name:`OtherFunction`,pattern:Cs.NA}),js=H({name:`DateLiteral`,pattern:Cs.NA}),Ms=H({name:`DateLiteralNotIdentifier`,pattern:Cs.NA}),Ns=H({name:`DateNLiteral`,pattern:Cs.NA}),Ps=H({name:`RelationalOperator`,pattern:Cs.NA}),Fs=H({name:`SymbolIdentifier`,pattern:Cs.NA}),Is=H({name:`DateIdentifier`,pattern:Cs.NA}),Ls=H({name:`NumberIdentifier`,pattern:Cs.NA}),Rs=H({name:`DecimalNumberIdentifier`,pattern:Cs.NA}),zs=H({name:`IntegerNumberIdentifier`,pattern:Cs.NA}),Bs=H({name:`IdentifierNotKeyword`,pattern:Cs.NA}),Vs=H({name:`UsingScopeEnumeration`,pattern:Cs.NA}),Hs=H({name:`RParenMismatch`,pattern:Cs.NA}),Us=/[a-zA-Z][a-zA-Z0-9_.]*/y;function Ws(e,t){Us.lastIndex=t;var n=Us.exec(e);return n&&n[0].includes(`..`)?null:n}var W=H({name:`Identifier`,pattern:Ws,line_breaks:!1,categories:[Bs],start_chars_hint:`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)}),Gs=H({name:`StringIdentifier`,line_breaks:!0,pattern:/(')(?:(?=(\\?))\2.)*?\1/}),Ks=H({name:`WhiteSpace`,pattern:/\s+/,group:Cs.SKIPPED}),qs=H({name:`AND`,pattern:/AND/i,longer_alt:W,categories:[U,ws]}),Js=H({name:`AS`,pattern:/AS/i,longer_alt:W,categories:[U,ws]}),Ys=H({name:`DESC`,pattern:/DESC/i,longer_alt:W,categories:[U,ws]}),Xs=H({name:`ASC`,pattern:/ASC/i,longer_alt:W,categories:[U,ws]}),Zs=H({name:`ORDER_BY`,pattern:/ORDER BY/i,longer_alt:W}),Qs=H({name:`CUBE`,pattern:/CUBE/i,longer_alt:W,categories:[U,ws]}),$s=H({name:`ELSE`,pattern:/ELSE/i,longer_alt:W,categories:[U,ws]}),ec=H({name:`EXCLUDES`,pattern:/EXCLUDES/i,longer_alt:W,categories:[U,ws]}),tc=H({name:`FALSE`,pattern:/FALSE/i,longer_alt:W,categories:[U,ws]}),nc=H({name:`FIRST`,pattern:/FIRST/i,longer_alt:W,categories:[U,ws]}),rc=H({name:`FROM`,pattern:/FROM/i,longer_alt:W,categories:[U,ws]}),ic=H({name:`GROUP_BY`,pattern:/GROUP BY/i,longer_alt:W}),ac=H({name:`HAVING`,pattern:/HAVING/i,longer_alt:W,categories:[U,ws]}),oc=H({name:`IN`,pattern:/IN/i,longer_alt:W,categories:[U,ws]}),sc=H({name:`INCLUDES`,pattern:/INCLUDES/i,longer_alt:W,categories:[U,ws]}),cc=H({name:`LAST`,pattern:/LAST/i,longer_alt:W,categories:[U,ws]}),lc=H({name:`LIKE`,pattern:/LIKE/i,longer_alt:W,categories:[U,ws]}),uc=H({name:`LIMIT`,pattern:/LIMIT/i,longer_alt:W,categories:[U,ws]}),dc=H({name:`NOT`,pattern:/NOT/i,longer_alt:W,categories:[U,ws]}),fc=H({name:`NULL`,pattern:/NULL/i,longer_alt:W,categories:[U,ws]}),pc=H({name:`NULLS`,pattern:/NULLS/i,longer_alt:W,categories:[U,ws]}),mc=H({name:`OR`,pattern:/OR/i,longer_alt:W,categories:[U,ws]}),hc=H({name:`ROLLUP`,pattern:/ROLLUP/i,longer_alt:W,categories:[U,ws]}),gc=H({name:`SELECT`,pattern:/SELECT/i,longer_alt:W,categories:[U,ws]}),_c=H({name:`TRUE`,pattern:/TRUE/i,longer_alt:W,categories:[U,ws]}),vc=H({name:`USING`,pattern:/USING/i,longer_alt:W,categories:[U,ws]}),yc=H({name:`WHERE`,pattern:/WHERE/i,longer_alt:W,categories:[U,ws]}),bc=H({name:`WITH`,pattern:/WITH/i,longer_alt:W,categories:[U,ws]}),xc=H({name:`FOR`,pattern:/FOR/i,longer_alt:W,categories:[U,ws]}),Sc=H({name:`UPDATE`,pattern:/UPDATE/i,longer_alt:W,categories:[U,ws]}),Cc=H({name:`ABOVE`,pattern:/ABOVE/i,longer_alt:W,categories:[U,W]}),wc=H({name:`ABOVE_OR_BELOW`,pattern:/ABOVE_OR_BELOW/i,longer_alt:W,categories:[U,W]}),Tc=H({name:`new`,pattern:/new/i,longer_alt:W,categories:[U,W]}),Ec=H({name:`AT`,pattern:/AT/i,longer_alt:W,categories:[U,W]}),Dc=H({name:`BELOW`,pattern:/BELOW/i,longer_alt:W,categories:[U,W]}),Oc=H({name:`DATA_CATEGORY`,pattern:/DATA CATEGORY/i,longer_alt:W,categories:[U]}),kc=H({name:`END`,pattern:/END/i,longer_alt:W,categories:[U,W]}),Ac=H({name:`OFFSET`,pattern:/OFFSET/i,longer_alt:W,categories:[U,W]}),jc=H({name:`REFERENCE`,pattern:/REFERENCE/i,longer_alt:W,categories:[U,W]}),Mc=H({name:`SCOPE`,pattern:/SCOPE/i,longer_alt:W,categories:[U,W]}),Nc=H({name:`TRACKING`,pattern:/TRACKING/i,longer_alt:W,categories:[U,W]}),Pc=H({name:`THEN`,pattern:/THEN/i,longer_alt:W,categories:[U,W]}),Fc=H({name:`TYPEOF`,pattern:/TYPEOF/i,longer_alt:W,categories:[U,W]}),Ic=H({name:`VIEW`,pattern:/VIEW/i,longer_alt:W,categories:[U,W]}),Lc=H({name:`VIEWSTAT`,pattern:/VIEWSTAT/i,longer_alt:W,categories:[U,W]}),Rc=H({name:`WHEN`,pattern:/WHEN/i,longer_alt:W,categories:[U,W]}),zc=H({name:`SECURITY_ENFORCED`,pattern:/SECURITY_ENFORCED/i,longer_alt:W,categories:[U,W]}),Bc=H({name:`SYSTEM_MODE`,pattern:/SYSTEM_MODE/i,longer_alt:W,categories:[U,W]}),Vc=H({name:`USER_MODE`,pattern:/USER_MODE/i,longer_alt:W,categories:[U,W]}),Hc=H({name:`CALENDAR_MONTH`,pattern:/CALENDAR_MONTH/i,longer_alt:W,categories:[Ts,W]}),Uc=H({name:`CALENDAR_QUARTER`,pattern:/CALENDAR_QUARTER/i,longer_alt:W,categories:[Ts,W]}),Wc=H({name:`CALENDAR_YEAR`,pattern:/CALENDAR_YEAR/i,longer_alt:W,categories:[Ts,W]}),Gc=H({name:`DAY_IN_MONTH`,pattern:/DAY_IN_MONTH/i,longer_alt:W,categories:[Ts,W]}),Kc=H({name:`DAY_IN_WEEK`,pattern:/DAY_IN_WEEK/i,longer_alt:W,categories:[Ts,W]}),qc=H({name:`DAY_IN_YEAR`,pattern:/DAY_IN_YEAR/i,longer_alt:W,categories:[Ts,W]}),Jc=H({name:`DAY_ONLY`,pattern:/DAY_ONLY/i,longer_alt:W,categories:[Ts,W]}),Yc=H({name:`FISCAL_MONTH`,pattern:/FISCAL_MONTH/i,longer_alt:W,categories:[Ts,W]}),Xc=H({name:`FISCAL_QUARTER`,pattern:/FISCAL_QUARTER/i,longer_alt:W,categories:[Ts,W]}),Zc=H({name:`FISCAL_YEAR`,pattern:/FISCAL_YEAR/i,longer_alt:W,categories:[Ts,W]}),Qc=H({name:`HOUR_IN_DAY`,pattern:/HOUR_IN_DAY/i,longer_alt:W,categories:[Ts,W]}),$c=H({name:`WEEK_IN_MONTH`,pattern:/WEEK_IN_MONTH/i,longer_alt:W,categories:[Ts,W]}),el=H({name:`WEEK_IN_YEAR`,pattern:/WEEK_IN_YEAR/i,longer_alt:W,categories:[Ts,W]}),tl=H({name:`AVG`,pattern:/AVG/i,longer_alt:W,categories:[Es,W]}),nl=H({name:`COUNT`,pattern:/COUNT/i,longer_alt:W,categories:[Es,W]}),rl=H({name:`COUNT_DISTINCT`,pattern:/COUNT_DISTINCT/i,longer_alt:W,categories:[Es,W]}),il=H({name:`MIN`,pattern:/MIN/i,longer_alt:W,categories:[Es,W]}),al=H({name:`MAX`,pattern:/MAX/i,longer_alt:W,categories:[Es,W]}),ol=H({name:`SUM`,pattern:/SUM/i,longer_alt:W,categories:[Es,W]}),sl=H({name:`DISTANCE`,pattern:/DISTANCE/i,longer_alt:W,categories:[Ds,W]}),cl=H({name:`GEOLOCATION`,pattern:/GEOLOCATION/i,longer_alt:W,categories:[Ds,W]}),ll=H({name:`FIELDS`,pattern:/FIELDS/i,longer_alt:W,categories:[Os,W]}),ul=H({name:`FORMAT`,pattern:/FORMAT/i,longer_alt:W,categories:[As,W]}),dl=H({name:`toLabel`,pattern:/TOLABEL/i,longer_alt:W,categories:[As,W]}),fl=H({name:`convertTimezone`,pattern:/CONVERTTIMEZONE/i,longer_alt:W,categories:[As,W]}),pl=H({name:`convertCurrency`,pattern:/CONVERTCURRENCY/i,longer_alt:W,categories:[As,W]}),ml=H({name:`GROUPING`,pattern:/GROUPING/i,longer_alt:W,categories:[As,W]}),hl=H({name:`ALL`,pattern:/ALL/i,longer_alt:W,categories:[ks,W]}),gl=H({name:`CUSTOM`,pattern:/CUSTOM/i,longer_alt:W,categories:[ks,W]}),_l=H({name:`STANDARD`,pattern:/STANDARD/i,longer_alt:W,categories:[ks,W]}),vl=H({name:`YESTERDAY`,pattern:/YESTERDAY/i,longer_alt:W,categories:[js,W,Ms]}),yl=H({name:`TODAY`,pattern:/TODAY/i,longer_alt:W,categories:[js,W,Ms]}),bl=H({name:`TOMORROW`,pattern:/TOMORROW/i,longer_alt:W,categories:[js,W,Ms]}),xl=H({name:`LAST_WEEK`,pattern:/LAST_WEEK/i,longer_alt:W,categories:[js,W,Ms]}),Sl=H({name:`THIS_WEEK`,pattern:/THIS_WEEK/i,longer_alt:W,categories:[js,W,Ms]}),Cl=H({name:`NEXT_WEEK`,pattern:/NEXT_WEEK/i,longer_alt:W,categories:[js,W,Ms]}),wl=H({name:`LAST_MONTH`,pattern:/LAST_MONTH/i,longer_alt:W,categories:[js,W,Ms]}),Tl=H({name:`THIS_MONTH`,pattern:/THIS_MONTH/i,longer_alt:W,categories:[js,W,Ms]}),El=H({name:`NEXT_MONTH`,pattern:/NEXT_MONTH/i,longer_alt:W,categories:[js,W,Ms]}),Dl=H({name:`LAST_90_DAYS`,pattern:/LAST_90_DAYS/i,longer_alt:W,categories:[js,W,Ms]}),Ol=H({name:`NEXT_90_DAYS`,pattern:/NEXT_90_DAYS/i,longer_alt:W,categories:[js,W,Ms]}),kl=H({name:`THIS_QUARTER`,pattern:/THIS_QUARTER/i,longer_alt:W,categories:[js,W,Ms]}),Al=H({name:`LAST_QUARTER`,pattern:/LAST_QUARTER/i,longer_alt:W,categories:[js,W,Ms]}),jl=H({name:`NEXT_QUARTER`,pattern:/NEXT_QUARTER/i,longer_alt:W,categories:[js,W,Ms]}),Ml=H({name:`THIS_YEAR`,pattern:/THIS_YEAR/i,longer_alt:W,categories:[js,W,Ms]}),Nl=H({name:`LAST_YEAR`,pattern:/LAST_YEAR/i,longer_alt:W,categories:[js,W,Ms]}),Pl=H({name:`NEXT_YEAR`,pattern:/NEXT_YEAR/i,longer_alt:W,categories:[js,W,Ms]}),Fl=H({name:`THIS_FISCAL_QUARTER`,pattern:/THIS_FISCAL_QUARTER/i,longer_alt:W,categories:[js,W,Ms]}),Il=H({name:`LAST_FISCAL_QUARTER`,pattern:/LAST_FISCAL_QUARTER/i,longer_alt:W,categories:[js,W,Ms]}),Ll=H({name:`NEXT_FISCAL_QUARTER`,pattern:/NEXT_FISCAL_QUARTER/i,longer_alt:W,categories:[js,W,Ms]}),Rl=H({name:`THIS_FISCAL_YEAR`,pattern:/THIS_FISCAL_YEAR/i,longer_alt:W,categories:[js,W,Ms]}),zl=H({name:`LAST_FISCAL_YEAR`,pattern:/LAST_FISCAL_YEAR/i,longer_alt:W,categories:[js,W,Ms]}),Bl=H({name:`NEXT_FISCAL_YEAR`,pattern:/NEXT_FISCAL_YEAR/i,longer_alt:W,categories:[js,W,Ms]}),Vl=H({name:`NEXT_N_DAYS`,pattern:/NEXT_N_DAYS/i,longer_alt:W,categories:[Ns,W]}),Hl=H({name:`LAST_N_DAYS`,pattern:/LAST_N_DAYS/i,longer_alt:W,categories:[Ns,W]}),Ul=H({name:`N_DAYS_AGO`,pattern:/N_DAYS_AGO/i,longer_alt:W,categories:[Ns,W]}),Wl=H({name:`NEXT_N_WEEKS`,pattern:/NEXT_N_WEEKS/i,longer_alt:W,categories:[Ns,W]}),Gl=H({name:`LAST_N_WEEKS`,pattern:/LAST_N_WEEKS/i,longer_alt:W,categories:[Ns,W]}),Kl=H({name:`N_WEEKS_AGO`,pattern:/N_WEEKS_AGO/i,longer_alt:W,categories:[Ns,W]}),ql=H({name:`NEXT_N_MONTHS`,pattern:/NEXT_N_MONTHS/i,longer_alt:W,categories:[Ns,W]}),Jl=H({name:`LAST_N_MONTHS`,pattern:/LAST_N_MONTHS/i,longer_alt:W,categories:[Ns,W]}),Yl=H({name:`N_MONTHS_AGO`,pattern:/N_MONTHS_AGO/i,longer_alt:W,categories:[Ns,W]}),Xl=H({name:`NEXT_N_QUARTERS`,pattern:/NEXT_N_QUARTERS/i,longer_alt:W,categories:[Ns,W]}),Zl=H({name:`LAST_N_QUARTERS`,pattern:/LAST_N_QUARTERS/i,longer_alt:W,categories:[Ns,W]}),Ql=H({name:`N_QUARTERS_AGO`,pattern:/N_QUARTERS_AGO/i,longer_alt:W,categories:[Ns,W]}),$l=H({name:`NEXT_N_YEARS`,pattern:/NEXT_N_YEARS/i,longer_alt:W,categories:[Ns,W]}),eu=H({name:`LAST_N_YEARS`,pattern:/LAST_N_YEARS/i,longer_alt:W,categories:[Ns,W]}),tu=H({name:`N_YEARS_AGO`,pattern:/N_YEARS_AGO/i,longer_alt:W,categories:[Ns,W]}),nu=H({name:`NEXT_N_FISCAL_QUARTERS`,pattern:/NEXT_N_FISCAL_QUARTERS/i,longer_alt:W,categories:[Ns,W]}),ru=H({name:`LAST_N_FISCAL_QUARTERS`,pattern:/LAST_N_FISCAL_QUARTERS/i,longer_alt:W,categories:[Ns,W]}),iu=H({name:`N_FISCAL_QUARTERS_AGO`,pattern:/N_FISCAL_QUARTERS_AGO/i,longer_alt:W,categories:[Ns,W]}),au=H({name:`NEXT_N_FISCAL_YEARS`,pattern:/NEXT_N_FISCAL_YEARS/i,longer_alt:W,categories:[Ns,W]}),ou=H({name:`LAST_N_FISCAL_YEARS`,pattern:/LAST_N_FISCAL_YEARS/i,longer_alt:W,categories:[Ns,W]}),su=H({name:`N_FISCAL_YEARS_AGO`,pattern:/N_FISCAL_YEARS_AGO/i,longer_alt:W,categories:[Ns,W]}),cu=H({name:`EQUAL`,pattern:`=`,categories:[Ps]}),lu=H({name:`NOT_EQUAL`,pattern:/!=|<>/,categories:[Ps]}),uu=H({name:`LESS_THAN`,pattern:`<`,categories:[Ps]}),du=H({name:`LESS_THAN_OR_EQUAL`,pattern:`<=`,categories:[Ps]}),fu=H({name:`GREATER_THAN`,pattern:`>`,categories:[Ps]}),pu=H({name:`GREATER_THAN_OR_EQUAL`,pattern:`>=`,categories:[Ps]}),mu=H({name:`DECIMAL`,pattern:`.`,categories:[Fs]}),hu=H({name:`COLON`,pattern:`:`,categories:[Fs]}),gu=H({name:`SEMICOLON`,pattern:`;`,categories:[Fs]}),_u=H({name:`COMMA`,pattern:`,`,categories:[Fs]}),vu=H({name:`ASTERISK`,pattern:`*`,categories:[Fs]}),yu=H({name:`L_PAREN`,pattern:`(`,categories:[Fs]}),bu=H({name:`R_PAREN`,pattern:`)`,categories:[Fs]}),xu=H({name:`L_SQUARE_BRACKET`,pattern:`[`,categories:[Fs]}),Su=H({name:`R_SQUARE_BRACKET`,pattern:`]`,categories:[Fs]}),Cu=H({name:`PLUS`,pattern:`+`,categories:[Fs]}),wu=H({name:`MINUS`,pattern:`-`,categories:[Fs]}),Tu=H({name:`DATETIME`,pattern:/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(\Z|\.[0-9]+Z|\+[0-9]{2}:[0-9]{2}|\-[0-9]{2}:[0-9]{2}|\+[0-9]{4}|\-[0-9]{4})/i,categories:[Is]}),Eu=H({name:`DATE`,pattern:/[0-9]{4}-[0-9]{2}-[0-9]{2}/,categories:[Is]}),Du=H({name:`CURRENCY_PREFIXED_DECIMAL`,pattern:/[a-zA-Z]{3}[0-9]+\.\d+/,longer_alt:W,categories:[Rs]}),Ou=H({name:`SIGNED_DECIMAL`,pattern:/(\-|\+)[0-9]*\.\d+/,categories:[Ls,Rs]}),ku=H({name:`UNSIGNED_DECIMAL`,pattern:/[0-9]*\.\d+/,categories:[Ls,Rs]}),Au=H({name:`CURRENCY_PREFIXED_INTEGER`,pattern:/[a-zA-Z]{3}[0-9]+/,longer_alt:W,categories:[Rs,W]}),ju=H({name:`SIGNED_INTEGER`,pattern:/(\-|\+)[0-9]+/,categories:[Ls,zs]}),Mu=H({name:`GEOLOCATION_UNIT`,pattern:/'(mi|km)'/i,longer_alt:W,categories:[W]}),Nu=H({name:`UNSIGNED_INTEGER`,pattern:/0|[1-9]\d*/,categories:[Ls,zs]}),Pu=[Ks,qs,Xs,Js,Zs,Qs,Ys,$s,ec,tc,nc,rc,ml,ic,ac,sc,lc,uc,pc,fc,hc,gc,_c,vc,yc,bc,Sc,H({name:`Delegated`,pattern:/DELEGATED/i,longer_alt:W,categories:[Vs,W],start_chars_hint:[`D`,`d`]}),H({name:`Everything`,pattern:/EVERYTHING/i,longer_alt:W,categories:[Vs,W],start_chars_hint:[`E`,`e`]}),H({name:`MineAndMyGroups`,pattern:/MINEANDMYGROUPS/i,longer_alt:W,categories:[Vs,W],start_chars_hint:[`M`,`m`]}),H({name:`Mine`,pattern:/MINE/i,longer_alt:W,categories:[Vs,W],start_chars_hint:[`M`,`m`]}),H({name:`MyTerritory`,pattern:/MY_TERRITORY/i,longer_alt:W,categories:[Vs,W],start_chars_hint:[`M`,`m`]}),H({name:`MyTeamTerritory`,pattern:/MY_TEAM_TERRITORY/i,longer_alt:W,categories:[Vs,W],start_chars_hint:[`M`,`m`]}),H({name:`Team`,pattern:/TEAM/i,longer_alt:W,categories:[Vs,W],start_chars_hint:[`T`,`t`]}),H({name:`AllPrivate`,pattern:/ALLPRIVATE/i,longer_alt:W,categories:[Vs,W],start_chars_hint:[`A`,`a`]}),wc,Cc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Lc,Ic,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc,$c,el,tl,rl,nl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,Mu,hl,gl,_l,oc,xc,mc,cc,dc,Du,Au,Gs,W,Tu,Eu,Ou,ku,Nu,ju,cu,lu,du,uu,pu,fu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu],Fu=new Cs(Pu,{ensureOptimizations:!0,skipValidations:!1});function Iu(e){return Fu.tokenize(e)}var Lu=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Ru=function(e){Lu(t,e);function t(t){var n=e.call(this,`${t.message} (${t.line}:${t.column})`)||this;return n.name=`LexingError`,n}return t}(Error),zu=function(e){Lu(t,e);function t(t){var n=e.call(this,t.message)||this;return n.name=t.name,n}return t}(Error),Bu=function(e){Lu(t,e);function t(t){var n=(t===void 0?{ignoreParseErrors:!1}:t).ignoreParseErrors,r=e.call(this,Pu,{skipValidations:!1,recoveryEnabled:!!n})||this;return r.$_dateFunctionOr=void 0,r.$_aggregateFunction=void 0,r.$_otherFunction=void 0,r.$_atomicExpression=void 0,r.$_apexBindVariableExpression=void 0,r.$_arrayExpression=void 0,r.$_relationalOperator=void 0,r.$_selectClause=void 0,r.$_selectClauseFunctionIdentifier=void 0,r.$_withDataCategoryArr=void 0,r.allowApexBindVariables=!1,r.ignoreParseErrors=!1,r.selectStatement=r.RULE(`selectStatement`,function(){r.SUBRULE(r.selectClause),r.SUBRULE(r.fromClause),r.SUBRULE(r.clauseStatements)}),r.selectStatementPartial=r.RULE(`selectStatementPartial`,function(){r.OPTION(function(){r.SUBRULE(r.selectClause)}),r.OPTION1(function(){r.SUBRULE(r.fromClause)}),r.SUBRULE(r.clauseStatements)}),r.clauseStatements=r.RULE(`clauseStatements`,function(){r.OPTION(function(){r.SUBRULE(r.usingScopeClause)}),r.OPTION1(function(){r.SUBRULE(r.whereClause)}),r.OPTION2(function(){r.MANY({DEF:function(){r.SUBRULE(r.withClause)}})}),r.OPTION3(function(){r.SUBRULE(r.groupByClause),r.OPTION4(function(){r.SUBRULE(r.havingClause)})}),r.OPTION5(function(){r.SUBRULE(r.orderByClause)}),r.OPTION6(function(){r.SUBRULE(r.limitClause)}),r.OPTION7(function(){r.SUBRULE(r.offsetClause)}),r.OPTION8(function(){r.SUBRULE(r.forViewOrReference)}),r.OPTION9(function(){r.SUBRULE(r.updateTrackingViewstat)})}),r.selectClause=r.RULE(`selectClause`,function(){r.CONSUME(gc),r.AT_LEAST_ONE_SEP({SEP:_u,DEF:function(){r.OR(r.$_selectClause||=[{ALT:function(){return r.SUBRULE(r.selectClauseFunctionIdentifier,{LABEL:`field`})}},{ALT:function(){return r.SUBRULE(r.selectClauseSubqueryIdentifier,{LABEL:`field`})}},{ALT:function(){return r.SUBRULE(r.selectClauseTypeOf,{LABEL:`field`})}},{ALT:function(){return r.SUBRULE(r.selectClauseIdentifier,{LABEL:`field`})}}])}})},{resyncEnabled:!1}),r.selectClauseFunctionIdentifier=r.RULE(`selectClauseFunctionIdentifier`,function(){r.OR(r.$_selectClauseFunctionIdentifier||=[{ALT:function(){return r.SUBRULE(r.dateFunction,{LABEL:`fn`})}},{ALT:function(){return r.SUBRULE(r.aggregateFunction,{LABEL:`fn`})}},{ALT:function(){return r.SUBRULE(r.locationFunction,{LABEL:`fn`})}},{ALT:function(){return r.SUBRULE(r.fieldsFunction,{LABEL:`fn`})}},{ALT:function(){return r.SUBRULE(r.otherFunction,{LABEL:`fn`})}}]),r.OPTION(function(){return r.CONSUME(W,{LABEL:`alias`})})},{resyncEnabled:!1}),r.selectClauseSubqueryIdentifier=r.RULE(`selectClauseSubqueryIdentifier`,function(){r.CONSUME(yu),r.SUBRULE(r.selectStatement),r.CONSUME(bu)},{resyncEnabled:!1}),r.selectClauseTypeOf=r.RULE(`selectClauseTypeOf`,function(){r.CONSUME(Fc),r.CONSUME(W,{LABEL:`typeOfField`}),r.AT_LEAST_ONE({DEF:function(){r.SUBRULE(r.selectClauseTypeOfThen)}}),r.OPTION(function(){r.SUBRULE(r.selectClauseTypeOfElse)}),r.CONSUME(kc)},{resyncEnabled:!1}),r.selectClauseIdentifier=r.RULE(`selectClauseIdentifier`,function(){r.CONSUME(W,{LABEL:`field`}),r.OPTION(function(){return r.CONSUME1(W,{LABEL:`alias`})})},{resyncEnabled:!1}),r.selectClauseTypeOfThen=r.RULE(`selectClauseTypeOfThen`,function(){r.CONSUME(Rc),r.CONSUME(W,{LABEL:`typeOfField`}),r.CONSUME(Pc),r.AT_LEAST_ONE_SEP({SEP:_u,DEF:function(){r.CONSUME1(W,{LABEL:`field`})}})},{resyncEnabled:!1}),r.selectClauseTypeOfElse=r.RULE(`selectClauseTypeOfElse`,function(){r.CONSUME($s),r.AT_LEAST_ONE_SEP({SEP:_u,DEF:function(){r.CONSUME(W,{LABEL:`field`})}})},{resyncEnabled:!1}),r.fromClause=r.RULE(`fromClause`,function(){r.CONSUME(rc),r.CONSUME(W),r.OPTION({GATE:function(){return r.LA(1).tokenType!==Ac||r.LA(2).tokenType!==Nu},DEF:function(){return r.CONSUME1(W,{LABEL:`alias`})}})},{resyncEnabled:!1}),r.usingScopeClause=r.RULE(`usingScopeClause`,function(){r.CONSUME(vc),r.CONSUME(Mc),r.CONSUME(Vs)}),r.whereClause=r.RULE(`whereClause`,function(){r.CONSUME(yc);var e=r.getParenCount();r.AT_LEAST_ONE({DEF:function(){r.SUBRULE(r.conditionExpression,{ARGS:[e,!0,!0]})}}),r.$_checkBalancedParens(e)}),r.whereClauseSubqueryIdentifier=r.RULE(`whereClauseSubqueryIdentifier`,function(){r.CONSUME(yu),r.SUBRULE(r.selectStatement),r.CONSUME(bu)}),r.conditionExpression=r.RULE(`conditionExpression`,function(e,t,n){e=r.getParenCount(e),r.OPTION(function(){r.OR([{ALT:function(){return r.CONSUME(qs,{LABEL:`logicalOperator`})}},{ALT:function(){return r.CONSUME(mc,{LABEL:`logicalOperator`})}}])}),r.MANY({MAX_LOOKAHEAD:10,DEF:function(){return r.SUBRULE(r.expressionPartWithNegation,{ARGS:[e],LABEL:`expressionNegation`})}}),r.OR1({MAX_LOOKAHEAD:10,DEF:[{ALT:function(){return r.SUBRULE(r.expression,{ARGS:[e,!1,t,n]})}}]})}),r.withClause=r.RULE(`withClause`,function(){r.CONSUME(bc),r.OR([{ALT:function(){return r.CONSUME(zc,{LABEL:`withSecurityEnforced`})}},{ALT:function(){return r.CONSUME(Vc,{LABEL:`withAccessLevel`})}},{ALT:function(){return r.CONSUME(Bc,{LABEL:`withAccessLevel`})}},{ALT:function(){return r.SUBRULE(r.withDataCategory)}}])}),r.withDataCategory=r.RULE(`withDataCategory`,function(){r.CONSUME(Oc),r.AT_LEAST_ONE_SEP({SEP:qs,DEF:function(){r.SUBRULE(r.withDataCategoryArr)}})}),r.withDataCategoryArr=r.RULE(`withDataCategoryArr`,function(){r.CONSUME(W,{LABEL:`dataCategoryGroupName`}),r.OR(r.$_withDataCategoryArr||=[{ALT:function(){return r.CONSUME(Ec,{LABEL:`filteringSelector`})}},{ALT:function(){return r.CONSUME(Cc,{LABEL:`filteringSelector`})}},{ALT:function(){return r.CONSUME(Dc,{LABEL:`filteringSelector`})}},{ALT:function(){return r.CONSUME(wc,{LABEL:`filteringSelector`})}}]),r.OPTION(function(){r.CONSUME1(yu)}),r.AT_LEAST_ONE_SEP1({SEP:_u,DEF:function(){r.CONSUME1(W,{LABEL:`dataCategoryName`})}}),r.OPTION1(function(){r.CONSUME2(bu)})}),r.groupByClause=r.RULE(`groupByClause`,function(){r.CONSUME(ic),r.AT_LEAST_ONE_SEP({SEP:_u,DEF:function(){r.OR([{ALT:function(){return r.SUBRULE(r.cubeFunction,{LABEL:`groupBy`})}},{ALT:function(){return r.SUBRULE(r.rollupFunction,{LABEL:`groupBy`})}},{ALT:function(){return r.SUBRULE(r.dateFunction,{LABEL:`groupBy`})}},{ALT:function(){return r.CONSUME(W,{LABEL:`groupBy`})}}])}})}),r.havingClause=r.RULE(`havingClause`,function(){r.CONSUME(ac);var e=r.getParenCount();r.AT_LEAST_ONE({DEF:function(){r.SUBRULE(r.conditionExpression,{ARGS:[e,!0,!1]})}}),r.$_checkBalancedParens(e)}),r.orderByClause=r.RULE(`orderByClause`,function(){r.CONSUME(Zs),r.AT_LEAST_ONE_SEP({SEP:_u,DEF:function(){r.OR([{ALT:function(){return r.SUBRULE(r.orderByGroupingFunctionExpression,{LABEL:`orderByExpressionOrFn`})}},{ALT:function(){return r.SUBRULE(r.orderBySpecialFunctionExpression,{LABEL:`orderByExpressionOrFn`})}},{ALT:function(){return r.SUBRULE(r.orderByExpression,{LABEL:`orderByExpressionOrFn`})}}])}})}),r.orderByExpression=r.RULE(`orderByExpression`,function(){r.CONSUME(W),r.OPTION(function(){r.OR([{ALT:function(){return r.CONSUME(Xs,{LABEL:`order`})}},{ALT:function(){return r.CONSUME(Ys,{LABEL:`order`})}}])}),r.OPTION1(function(){r.CONSUME(pc),r.OR1([{ALT:function(){return r.CONSUME(nc,{LABEL:`nulls`})}},{ALT:function(){return r.CONSUME(cc,{LABEL:`nulls`})}}])})}),r.orderByGroupingFunctionExpression=r.RULE(`orderByGroupingFunctionExpression`,function(){r.CONSUME(ml,{LABEL:`fn`}),r.SUBRULE(r.functionExpression)}),r.orderBySpecialFunctionExpression=r.RULE(`orderBySpecialFunctionExpression`,function(){r.OR([{ALT:function(){return r.SUBRULE(r.aggregateFunction)}},{ALT:function(){return r.SUBRULE(r.dateFunction)}},{ALT:function(){return r.SUBRULE(r.locationFunction)}}]),r.OPTION(function(){r.OR1([{ALT:function(){return r.CONSUME(Xs,{LABEL:`order`})}},{ALT:function(){return r.CONSUME(Ys,{LABEL:`order`})}}])}),r.OPTION1(function(){r.CONSUME(pc),r.OR2([{ALT:function(){return r.CONSUME(nc,{LABEL:`nulls`})}},{ALT:function(){return r.CONSUME(cc,{LABEL:`nulls`})}}])})}),r.limitClause=r.RULE(`limitClause`,function(){r.CONSUME(uc),r.CONSUME(Nu,{LABEL:`value`})}),r.offsetClause=r.RULE(`offsetClause`,function(){r.CONSUME(Ac),r.CONSUME(Nu,{LABEL:`value`})}),r.dateFunction=r.RULE(`dateFunction`,function(){r.OR(r.$_dateFunctionOr||=[{ALT:function(){return r.CONSUME(Hc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(Uc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(Wc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(Gc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(Kc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(qc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(Jc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(Yc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(Xc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(Zc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(Qc,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME($c,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(el,{LABEL:`fn`})}}]),r.SUBRULE(r.functionExpression)}),r.aggregateFunction=r.RULE(`aggregateFunction`,function(){r.OR(r.$_aggregateFunction||=[{ALT:function(){return r.CONSUME(tl,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(nl,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(rl,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(il,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(al,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(ol,{LABEL:`fn`})}}]),r.SUBRULE(r.functionExpression,{ARGS:[!0]})}),r.fieldsFunction=r.RULE(`fieldsFunction`,function(){r.CONSUME(ll,{LABEL:`fn`}),r.CONSUME(yu),r.CONSUME(ks,{LABEL:`params`}),r.CONSUME(bu)}),r.otherFunction=r.RULE(`otherFunction`,function(){r.OR(r.$_otherFunction||=[{ALT:function(){return r.CONSUME(ul,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(dl,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(fl,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(pl,{LABEL:`fn`})}},{ALT:function(){return r.CONSUME(ml,{LABEL:`fn`})}}]),r.SUBRULE(r.functionExpression)}),r.cubeFunction=r.RULE(`cubeFunction`,function(){r.CONSUME(Qs,{LABEL:`fn`}),r.SUBRULE(r.functionExpression)}),r.rollupFunction=r.RULE(`rollupFunction`,function(){r.CONSUME(hc,{LABEL:`fn`}),r.SUBRULE(r.functionExpression)}),r.functionExpression=r.RULE(`functionExpression`,function(e){r.CONSUME(yu),r.MANY_SEP({SEP:_u,DEF:function(){r.OR([{GATE:function(){return!e},ALT:function(){return r.SUBRULE(r.aggregateFunction,{LABEL:`params`})}},{ALT:function(){return r.SUBRULE(r.otherFunction,{LABEL:`params`})}},{ALT:function(){return r.CONSUME(Gs,{LABEL:`params`})}},{ALT:function(){return r.CONSUME(Ls,{LABEL:`params`})}},{ALT:function(){return r.CONSUME(W,{LABEL:`params`})}}])}}),r.CONSUME(bu)}),r.locationFunction=r.RULE(`locationFunction`,function(){r.CONSUME(sl),r.CONSUME(yu),r.CONSUME(W,{LABEL:`location1`}),r.CONSUME(_u),r.OR([{ALT:function(){return r.SUBRULE(r.geolocationFunction,{LABEL:`location2`})}},{ALT:function(){return r.CONSUME1(W,{LABEL:`location2`})}}]),r.CONSUME1(_u),r.CONSUME(Mu,{LABEL:`unit`}),r.CONSUME(bu)}),r.geolocationFunction=r.RULE(`geolocationFunction`,function(){r.CONSUME(cl),r.CONSUME(yu),r.CONSUME(Ls,{LABEL:`latitude`}),r.CONSUME(_u),r.CONSUME1(Ls,{LABEL:`longitude`}),r.CONSUME(bu)}),r.expressionPartWithNegation=r.RULE(`expressionPartWithNegation`,function(e){var t=0;r.MANY(function(){r.CONSUME(yu),t++}),r.CONSUME(dc,{LABEL:`expressionNegation`}),e&&t&&(e.left+=t)}),r.expression=r.RULE(`expression`,function(e,t,n,i){r.OPTION1(function(){r.MANY1(function(){r.CONSUME(yu),e&&e.left++})}),r.OR1([{GATE:function(){return!!n},ALT:function(){return r.SUBRULE(r.aggregateFunction,{LABEL:`lhs`})}},{GATE:function(){return!!i},ALT:function(){return r.SUBRULE(r.locationFunction,{LABEL:`lhs`})}},{ALT:function(){return r.SUBRULE(r.dateFunction,{LABEL:`lhs`})}},{ALT:function(){return r.SUBRULE(r.otherFunction,{LABEL:`lhs`})}},{ALT:function(){return r.CONSUME(W,{LABEL:`lhs`})}}]),r.OR2([{ALT:function(){return r.SUBRULE(r.expressionWithRelationalOperator,{LABEL:`operator`})}},{ALT:function(){return r.SUBRULE(r.expressionWithSetOperator,{LABEL:`operator`,ARGS:[t]})}}]),r.OPTION3(function(){r.MANY2({GATE:function(){return!e||e.left>e.right},DEF:function(){r.CONSUME(bu),e&&e.right++}})})}),r.expressionWithRelationalOperator=r.RULE(`expressionWithRelationalOperator`,function(){r.SUBRULE(r.relationalOperator),r.SUBRULE(r.atomicExpression,{LABEL:`rhs`})}),r.expressionWithSetOperator=r.RULE(`expressionWithSetOperator`,function(e){r.SUBRULE(r.setOperator),r.SUBRULE2(r.atomicExpression,{LABEL:`rhs`,ARGS:[!0,e]})}),r.atomicExpression=r.RULE(`atomicExpression`,function(e,t){r.OR(r.$_atomicExpression||=[{GATE:function(){return r.allowApexBindVariables},ALT:function(){return r.SUBRULE(r.apexBindVariableExpression)}},{GATE:function(){return e},ALT:function(){return r.SUBRULE(r.arrayExpression)}},{GATE:function(){return e&&t},ALT:function(){return r.SUBRULE(r.whereClauseSubqueryIdentifier)}},{GATE:function(){return!e},ALT:function(){return r.CONSUME(Is)}},{GATE:function(){return!e},ALT:function(){return r.CONSUME(Du,{LABEL:`CurrencyPrefixedDecimal`})}},{GATE:function(){return!e},ALT:function(){return r.CONSUME(Au,{LABEL:`CurrencyPrefixedInteger`})}},{GATE:function(){return!e},ALT:function(){return r.CONSUME(Ls)}},{GATE:function(){return!e},ALT:function(){return r.CONSUME(fc)}},{GATE:function(){return!e},ALT:function(){return r.SUBRULE(r.booleanValue)}},{GATE:function(){return!e},ALT:function(){return r.CONSUME(js)}},{GATE:function(){return!e},ALT:function(){return r.SUBRULE(r.dateNLiteral)}},{GATE:function(){return!e},ALT:function(){return r.CONSUME(Mu,{LABEL:`StringIdentifier`})}},{GATE:function(){return!e},ALT:function(){return r.CONSUME(Gs)}}])}),r.apexBindVariableExpression=r.RULE(`apexBindVariableExpression`,function(){r.CONSUME(hu),r.OPTION(function(){r.SUBRULE(r.apexBindVariableNewInstantiation,{LABEL:`apex`}),r.OPTION1(function(){r.CONSUME(mu)})}),r.MANY_SEP({SEP:mu,DEF:function(){r.OR(r.$_apexBindVariableExpression||=[{ALT:function(){return r.SUBRULE(r.apexBindVariableFunctionCall,{LABEL:`apex`})}},{ALT:function(){return r.SUBRULE(r.apexBindVariableIdentifier,{LABEL:`apex`})}}])}})}),r.apexBindVariableIdentifier=r.RULE(`apexBindVariableIdentifier`,function(){r.CONSUME(W),r.OPTION(function(){return r.SUBRULE(r.apexBindVariableFunctionArrayAccessor)})}),r.apexBindVariableNewInstantiation=r.RULE(`apexBindVariableNewInstantiation`,function(){r.CONSUME(Tc,{LABEL:`new`}),r.CONSUME(W,{LABEL:`function`}),r.OPTION(function(){r.SUBRULE(r.apexBindVariableGeneric)}),r.SUBRULE(r.apexBindVariableFunctionParams),r.OPTION1(function(){return r.SUBRULE(r.apexBindVariableFunctionArrayAccessor)})}),r.apexBindVariableFunctionCall=r.RULE(`apexBindVariableFunctionCall`,function(){r.CONSUME(W,{LABEL:`function`}),r.SUBRULE(r.apexBindVariableFunctionParams),r.OPTION(function(){return r.SUBRULE(r.apexBindVariableFunctionArrayAccessor)})}),r.apexBindVariableGeneric=r.RULE(`apexBindVariableGeneric`,function(){r.CONSUME(uu),r.AT_LEAST_ONE_SEP({SEP:_u,DEF:function(){r.CONSUME(W,{LABEL:`parameter`})}}),r.CONSUME(fu)}),r.apexBindVariableFunctionParams=r.RULE(`apexBindVariableFunctionParams`,function(){r.CONSUME(yu),r.MANY_SEP({SEP:_u,DEF:function(){r.CONSUME(W,{LABEL:`parameter`})}}),r.CONSUME(bu)}),r.apexBindVariableFunctionArrayAccessor=r.RULE(`apexBindVariableFunctionArrayAccessor`,function(){r.CONSUME(xu),r.OR([{ALT:function(){return r.CONSUME(Nu,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(W,{LABEL:`value`})}}]),r.CONSUME(Su)}),r.arrayExpression=r.RULE(`arrayExpression`,function(){r.CONSUME(yu),r.AT_LEAST_ONE_SEP({SEP:_u,DEF:function(){r.OR(r.$_arrayExpression||=[{ALT:function(){return r.CONSUME(Du,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(Au,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(Ls,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(Is,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(fc,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(_c,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(tc,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(js,{LABEL:`value`})}},{ALT:function(){return r.SUBRULE(r.dateNLiteral,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(Mu,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(Gs,{LABEL:`value`})}}])}}),r.CONSUME(bu)}),r.relationalOperator=r.RULE(`relationalOperator`,function(){r.OR(r.$_relationalOperator||=[{ALT:function(){return r.CONSUME(cu,{LABEL:`operator`})}},{ALT:function(){return r.CONSUME(lu,{LABEL:`operator`})}},{ALT:function(){return r.CONSUME(fu,{LABEL:`operator`})}},{ALT:function(){return r.CONSUME(pu,{LABEL:`operator`})}},{ALT:function(){return r.CONSUME(uu,{LABEL:`operator`})}},{ALT:function(){return r.CONSUME(du,{LABEL:`operator`})}},{ALT:function(){return r.CONSUME(lc,{LABEL:`operator`})}}])}),r.setOperator=r.RULE(`setOperator`,function(){r.OR([{ALT:function(){return r.CONSUME(oc,{LABEL:`operator`})}},{ALT:function(){return r.SUBRULE(r.notInOperator,{LABEL:`notIn`})}},{ALT:function(){return r.CONSUME(sc,{LABEL:`operator`})}},{ALT:function(){return r.CONSUME(ec,{LABEL:`operator`})}}])}),r.notInOperator=r.RULE(`notInOperator`,function(){r.CONSUME(dc,{LABEL:`operator`}),r.CONSUME(oc,{LABEL:`operator`})}),r.booleanValue=r.RULE(`booleanValue`,function(){r.OR([{ALT:function(){return r.CONSUME(_c,{LABEL:`boolean`})}},{ALT:function(){return r.CONSUME(tc,{LABEL:`boolean`})}}])}),r.dateNLiteral=r.RULE(`dateNLiteral`,function(){r.CONSUME(Ns,{LABEL:`dateNLiteral`}),r.CONSUME(hu),r.OR1([{ALT:function(){return r.CONSUME(Nu,{LABEL:`variable`})}},{ALT:function(){return r.CONSUME(ju,{LABEL:`variable`})}}])}),r.forViewOrReference=r.RULE(`forViewOrReference`,function(){r.CONSUME(xc),r.OR([{ALT:function(){return r.CONSUME(Ic,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(jc,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(Sc,{LABEL:`value`})}}])}),r.updateTrackingViewstat=r.RULE(`updateTrackingViewstat`,function(){r.CONSUME(Sc),r.OR([{ALT:function(){return r.CONSUME(Nc,{LABEL:`value`})}},{ALT:function(){return r.CONSUME(Lc,{LABEL:`value`})}}])}),r.ignoreParseErrors=!!n,r.performSelfAnalysis(),r}return t.prototype.$_checkBalancedParens=function(e){!this.RECORDING_PHASE&&e&&e.left-e.right!==0&&this.CONSUME(Hs,{ERR_MSG:`Expecting a token type of --> RParen <-- but found --> '' <--`})},t.prototype.getParenCount=function(e){return e||{right:0,left:0}},t}(Ss),Vu=new Bu;function Hu(e,t){var n=t||{allowApexBindVariables:!1,logErrors:!1,ignoreParseErrors:!1},r=n.allowApexBindVariables,i=n.logErrors,a=n.ignoreParseErrors,o=n.allowPartialQuery,s=Iu(e);if(s.errors.length>0)throw i&&(console.log(`Lexing Errors:`),console.log(s.errors)),new Ru(s.errors[0]);Vu.ignoreParseErrors!==a&&(Vu=new Bu({ignoreParseErrors:a})),Vu.input=s.tokens,Vu.allowApexBindVariables=r||!1;var c=o?Vu.selectStatementPartial():Vu.selectStatement();if(Vu.errors.length>0&&(i&&(console.log(`Parsing Errors:`),console.log(Vu.errors)),!a))throw new zu(Vu.errors[0]);return{cst:c,parseErrors:Vu.errors.map(function(e){return new zu(e)})}}var Uu=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),Wu=function(){return Wu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Wu.apply(this,arguments)},Gu=new Bu().getBaseCstVisitorConstructor(),Ku=[`TRUE`,`FALSE`],qu=[`YESTERDAY`,`TODAY`,`TOMORROW`,`LAST_WEEK`,`THIS_WEEK`,`NEXT_WEEK`,`LAST_MONTH`,`THIS_MONTH`,`NEXT_MONTH`,`LAST_90_DAYS`,`NEXT_90_DAYS`,`THIS_QUARTER`,`LAST_QUARTER`,`NEXT_QUARTER`,`THIS_YEAR`,`LAST_YEAR`,`NEXT_YEAR`,`THIS_FISCAL_QUARTER`,`LAST_FISCAL_QUARTER`,`NEXT_FISCAL_QUARTER`,`THIS_FISCAL_YEAR`,`LAST_FISCAL_YEAR`,`NEXT_FISCAL_YEAR`],Ju=[`NEXT_N_DAYS`,`LAST_N_DAYS`,`N_DAYS_AGO`,`NEXT_N_WEEKS`,`LAST_N_WEEKS`,`N_WEEKS_AGO`,`NEXT_N_MONTHS`,`LAST_N_MONTHS`,`N_MONTHS_AGO`,`NEXT_N_QUARTERS`,`LAST_N_QUARTERS`,`N_QUARTERS_AGO`,`NEXT_N_YEARS`,`LAST_N_YEARS`,`N_YEARS_AGO`,`NEXT_N_FISCAL_QUARTERS`,`LAST_N_FISCAL_QUARTERS`,`N_FISCAL_QUARTERS_AGO`,`NEXT_N_FISCAL_YEARS`,`LAST_N_FISCAL_YEARS`,`N_FISCAL_YEARS_AGO`],Yu=new(function(e){Uu(t,e);function t(){var t=e.call(this)||this;return t.helpers={$_getFieldFunction:function(e,n,r){n===void 0&&(n=!1),r===void 0&&(r=!0);var i=e.functionExpression?e.functionExpression.map(function(e){return t.visit(e,{includeType:r})}).flat():[],a={};return r&&(a.type=`FieldFunctionExpression`),a.functionName=e.fn[0].tokenType.name,a.parameters=i,r&&n&&(a.isAggregateFn=n),a.rawValue=`${e.fn[0].image}(${i.map(function(e){return typeof e==`string`?e:e.rawValue}).join(`, `)})`,a},$_getLiteralTypeFromTokenType:function(e){return e===`REAL_NUMBER`?`DECIMAL`:e===`CURRENCY_PREFIXED_DECIMAL`?`DECIMAL_WITH_CURRENCY_PREFIX`:e===`CURRENCY_PREFIXED_INTEGER`?`INTEGER_WITH_CURRENCY_PREFIX`:e===`SIGNED_DECIMAL`||e===`UNSIGNED_DECIMAL`?`DECIMAL`:e===`UNSIGNED_INTEGER`||e===`SIGNED_INTEGER`?`INTEGER`:e===`DATETIME`?`DATETIME`:e===`DATE`?`DATE`:e===`NULL`?`NULL`:e===`StringIdentifier`||e===`Identifier`?`STRING`:Ku.includes(e)?`BOOLEAN`:qu.includes(e)?`DATE_LITERAL`:Ju.includes(e)?`DATE_N_LITERAL`:`STRING`},$_parseSelect:function(e,t){var n=(t||{isSubquery:!1}).isSubquery,r={};if(e.selectClause&&(r.fields=this.visit(e.selectClause)),e.fromClause){if(Lt(r,n)){var i=this.visit(e.fromClause),a=i.sObject,o=i.alias,s=i.sObjectPrefix;r.relationshipName=a,o&&(r.sObjectAlias=o),s&&(r.sObjectPrefix=s)}else{var c=this.visit(e.fromClause),a=c.sObject,o=c.alias;r.sObject=a,o&&(r.sObjectAlias=o)}}return Array.isArray(r.fields)&&r.sObjectAlias&&r.fields.forEach(function(e){e.relationships&&e.relationships[0]===r.sObjectAlias&&(e.relationships=e.relationships.slice(1),e.objectPrefix=r.sObjectAlias),e.relationships&&e.relationships.length===0&&(delete e.relationships,e.type=`Field`)}),r=Wu(Wu({},r),this.visit(e.clauseStatements)),r}},t.validateVisitor(),t}return t.prototype.selectStatement=function(e,t){return this.helpers.$_parseSelect.bind(this)(e,t)},t.prototype.selectStatementPartial=function(e,t){return this.helpers.$_parseSelect.bind(this)(e,t)},t.prototype.clauseStatements=function(e){var t=this,n={};return e.usingScopeClause&&!e.usingScopeClause[0].recoveredNode&&(n.usingScope=this.visit(e.usingScopeClause)),e.whereClause&&!e.whereClause[0].recoveredNode&&(n.where=this.visit(e.whereClause)),e.withClause&&e.withClause.filter(function(e){return!e.recoveredNode}).forEach(function(e){var r=t.visit(e),i=r.withSecurityEnforced,a=r.withAccessLevel,o=r.withDataCategory;i&&(n.withSecurityEnforced=i),a&&(n.withAccessLevel=a),o&&(n.withDataCategory=o)}),e.groupByClause&&!e.groupByClause[0].recoveredNode&&(n.groupBy=this.visit(e.groupByClause)),e.havingClause&&!e.havingClause[0].recoveredNode&&(n.having=this.visit(e.havingClause)),e.orderByClause&&!e.orderByClause[0].recoveredNode&&(n.orderBy=this.visit(e.orderByClause)),e.limitClause&&!e.limitClause[0].recoveredNode&&(n.limit=Number(this.visit(e.limitClause))),e.offsetClause&&!e.offsetClause[0].recoveredNode&&(n.offset=Number(this.visit(e.offsetClause))),e.forViewOrReference&&!e.forViewOrReference[0].recoveredNode&&(n.for=this.visit(e.forViewOrReference)),e.updateTrackingViewstat&&!e.updateTrackingViewstat[0].recoveredNode&&(n.update=this.visit(e.updateTrackingViewstat)),n},t.prototype.selectClause=function(e){var t=this;return e.field?e.field.map(function(e){if(It(e)){var n=e.image,r=void 0;if(!n.includes(`.`))r={type:`Field`,field:n};else{var i=n.split(`.`);r={type:`FieldRelationship`,field:i[i.length-1],relationships:i.slice(0,i.length-1),rawValue:n}}return r}return t.visit(e)}):[]},t.prototype.selectClauseFunctionIdentifier=function(e){var t=Wu({},this.visit(e.fn));return e.alias&&(t.alias=e.alias[0].image),t},t.prototype.selectClauseSubqueryIdentifier=function(e){return{type:`FieldSubquery`,subquery:this.visit(e.selectStatement,{isSubquery:!0})}},t.prototype.selectClauseTypeOf=function(e){var t=this,n=e.selectClauseTypeOfThen.map(function(e){return t.visit(e)});return e.selectClauseTypeOfElse&&n.push(this.visit(e.selectClauseTypeOfElse)),{type:`FieldTypeof`,field:e.typeOfField[0].image,conditions:n}},t.prototype.selectClauseIdentifier=function(e){var t=e.field[0],n=e.alias?e.alias[0].image:void 0,r=t.image,i;if(!r.includes(`.`))i={type:`Field`,field:r};else{var a=r.split(`.`);i={type:`FieldRelationship`,field:a[a.length-1],relationships:a.slice(0,a.length-1),rawValue:r}}return n&&(i.alias=n),i},t.prototype.selectClauseTypeOfThen=function(e){return{type:`WHEN`,objectType:e.typeOfField[0].image,fieldList:e.field.map(function(e){return e.image})}},t.prototype.selectClauseTypeOfElse=function(e){return{type:`ELSE`,fieldList:e.field.map(function(e){return e.image})}},t.prototype.fromClause=function(e){var t=e.Identifier[0].image,n;if(t.includes(`.`)){var r=t.split(`.`);n={sObjectPrefix:r.slice(0,r.length-1),sObject:r[r.length-1]}}else n={sObject:t};return e.alias&&e.alias[0]&&(n.alias=e.alias[0].image),n},t.prototype.usingScopeClause=function(e){return e.UsingScopeEnumeration[0].image},t.prototype.whereClauseSubqueryIdentifier=function(e){return this.visit(e.selectStatement,{isSubquery:!1})},t.prototype.whereClause=function(e){var t=this;return e.conditionExpression.reduce(function(e,n){var r;e.expressionTree?(r=t.visit(n,{prevExpression:e.prevExpression}),e.prevExpression.right=r):(r=t.visit(n),e.expressionTree=r),r.right;for(var i=r.right;Zt(i);)i=i.right;return e.prevExpression=i||r,e},{prevExpression:void 0,expressionTree:void 0}).expressionTree},t.prototype.conditionExpression=function(e,t){var n=this;t||={},t.prevExpression&&e.logicalOperator&&(t.prevExpression.operator=e.logicalOperator[0].tokenType.name);var r={},i=r;if(Array.isArray(e.expressionNegation)){if(e.expressionNegation.length===1)r=this.visit(e.expressionNegation),i=r.right;else{r=this.visit(e.expressionNegation[0]);var a=r;e.expressionNegation.slice(1).forEach(function(e){a.right=n.visit(e),i=a.right.right})}}return i.left=this.visit(e.expression),r},t.prototype.withClause=function(e){return e.withSecurityEnforced?{withSecurityEnforced:!0}:e.withAccessLevel?{withAccessLevel:e.withAccessLevel[0].image}:{withDataCategory:{conditions:this.visit(e.withDataCategory)}}},t.prototype.withDataCategory=function(e){var t=this;return e.withDataCategoryArr.map(function(e){return t.visit(e)})},t.prototype.withDataCategoryArr=function(e){return{groupName:e.dataCategoryGroupName[0].image,selector:e.filteringSelector[0].image,parameters:e.dataCategoryName.map(function(e){return e.image})}},t.prototype.groupByClause=function(e){var t=this;return e.groupBy.map(function(e){return It(e)?{field:e.image}:{fn:t.visit(e,{includeType:!1})}})},t.prototype.havingClause=function(e){var t=this;return e.conditionExpression.reduce(function(e,n){return e.expressionTree?(e.prevExpression.right=t.visit(n,{prevExpression:e.prevExpression}),e.prevExpression=e.prevExpression.right):(e.expressionTree=t.visit(n),e.prevExpression=e.expressionTree),e},{prevExpression:void 0,expressionTree:void 0}).expressionTree},t.prototype.orderByClause=function(e){var t=this;return e.orderByExpressionOrFn.map(function(e){return t.visit(e)})},t.prototype.orderByExpression=function(e){var t={field:e.Identifier[0].image};return e.order&&e.order[0]&&(t.order=e.order[0].tokenType.name),e.nulls&&e.nulls[0]&&(t.nulls=e.nulls[0].tokenType.name),t},t.prototype.orderByGroupingFunctionExpression=function(e){var t={fn:this.helpers.$_getFieldFunction(e,!1,!1)};return e.order&&e.order[0]&&(t.order=e.order[0].tokenType.name),e.nulls&&e.nulls[0]&&(t.nulls=e.nulls[0].tokenType.name),t},t.prototype.orderBySpecialFunctionExpression=function(e){var t={};return e.aggregateFunction?t.fn=this.visit(e.aggregateFunction,{includeType:!1}):e.dateFunction?t.fn=this.visit(e.dateFunction,{includeType:!1}):e.locationFunction&&(t.fn=this.visit(e.locationFunction,{includeType:!1})),e.order&&e.order[0]&&(t.order=e.order[0].tokenType.name),e.nulls&&e.nulls[0]&&(t.nulls=e.nulls[0].tokenType.name),t},t.prototype.limitClause=function(e){return e.value[0].image},t.prototype.offsetClause=function(e){return e.value[0].image},t.prototype.dateFunction=function(e,t){return t===void 0&&(t={includeType:!0}),this.helpers.$_getFieldFunction(e,!0,t.includeType)},t.prototype.aggregateFunction=function(e,t){return t===void 0&&(t={includeType:!0}),this.helpers.$_getFieldFunction(e,!0,t.includeType)},t.prototype.fieldsFunction=function(e,t){t===void 0&&(t={includeType:!0});var n={};return t.includeType&&(n.type=`FieldFunctionExpression`),n=Wu(Wu({},n),{functionName:`FIELDS`,parameters:[e.params[0].image]}),n.rawValue=`FIELDS(${n.parameters[0]})`,n},t.prototype.otherFunction=function(e,t){return t===void 0&&(t={includeType:!0}),this.helpers.$_getFieldFunction(e,!1,t.includeType)},t.prototype.cubeFunction=function(e){return this.helpers.$_getFieldFunction(e,!1,!1)},t.prototype.rollupFunction=function(e){return this.helpers.$_getFieldFunction(e,!1,!1)},t.prototype.locationFunction=function(e,t){t===void 0&&(t={includeType:!0});var n={};return t.includeType&&(n.type=`FieldFunctionExpression`),n=Wu(Wu({},n),{functionName:`DISTANCE`,parameters:[e.location1[0].image,It(e.location2)?e.location2[0].image:this.visit(e.location2,t),e.unit[0].image]}),t.includeType&&(n.isAggregateFn=!0),n.rawValue=`DISTANCE(${n.parameters[0]}, ${Rt(n.parameters[1])?n.parameters[1]:n.parameters[1].rawValue}, ${n.parameters[2]})`,n},t.prototype.geolocationFunction=function(e,t){t===void 0&&(t={includeType:!0});var n={};return t.includeType&&(n.type=`FieldFunctionExpression`),n=Wu(Wu({},n),{functionName:`GEOLOCATION`,parameters:[e.latitude[0].image,e.longitude[0].image],rawValue:`GEOLOCATION(${e.latitude[0].image}, ${e.longitude[0].image})`}),n},t.prototype.functionExpression=function(e,t){var n=this;return t===void 0&&(t={includeType:!0}),e.params?e.params.map(function(e){return e.image?e.image:n.visit(e,t)}):[]},t.prototype.expression=function(e){var t=this.visit(e.operator,{returnLiteralType:!0}),n=t.value,r=t.literalType,i=t.dateLiteralVariable,a=t.operator,o={};return It(e.lhs)?o.field=e.lhs[0].image:o.fn=this.visit(e.lhs,{includeType:!1}),o.operator=a,o.literalType=r,r===`SUBQUERY`?o.valueQuery=n:o.value=n,i&&(o.dateLiteralVariable=i),e.L_PAREN&&(o.openParen=e.L_PAREN.length),e.R_PAREN&&(o.closeParen=e.R_PAREN.length),o},t.prototype.expressionPartWithNegation=function(e){return{left:e.L_PAREN?{openParen:e.L_PAREN.length}:null,operator:`NOT`,right:{left:{}}}},t.prototype.expressionWithRelationalOperator=function(e){return e.relationalOperator?Wu({operator:this.visit(e.relationalOperator)},this.visit(e.rhs,{returnLiteralType:!0})):Wu({operator:this.visit(e.setOperator)},this.visit(e.rhs,{returnLiteralType:!0}))},t.prototype.expressionWithSetOperator=function(e){return e.relationalOperator?Wu({operator:this.visit(e.relationalOperator)},this.visit(e.rhs,{returnLiteralType:!0})):Wu({operator:this.visit(e.setOperator)},this.visit(e.rhs,{returnLiteralType:!0}))},t.prototype.atomicExpression=function(e,t){var n=this;t||={};var r,i,a;if(e.apexBindVariableExpression)r=this.visit(e.apexBindVariableExpression),i=`APEX_BIND_VARIABLE`;else if(e.NumberIdentifier)r=e.NumberIdentifier[0].image,i=this.helpers.$_getLiteralTypeFromTokenType(e.NumberIdentifier[0].tokenType.name);else if(e.UnsignedInteger)r=e.UnsignedInteger[0].image,i=`INTEGER`;else if(e.SignedInteger)r=e.SignedInteger[0].image,i=`INTEGER`;else if(e.RealNumber)r=e.RealNumber[0].image,i=`DECIMAL`;else if(e.DateIdentifier)r=e.DateIdentifier[0].image,i=this.helpers.$_getLiteralTypeFromTokenType(e.DateIdentifier[0].tokenType.name);else if(e.CurrencyPrefixedInteger)r=e.CurrencyPrefixedInteger[0].image,i=`INTEGER_WITH_CURRENCY_PREFIX`;else if(e.CurrencyPrefixedDecimal)r=e.CurrencyPrefixedDecimal[0].image,i=`DECIMAL_WITH_CURRENCY_PREFIX`;else if(e.DateTime)r=e.DateTime[0].image,i=`DATETIME`;else if(e.date)r=e.DateToken[0].image,i=`DATE`;else if(e.NULL)r=`NULL`,i=`NULL`;else if(e.StringIdentifier)r=e.StringIdentifier[0].image,i=`STRING`;else if(e.Identifier)r=e.Identifier[0].image,i=`STRING`;else if(e.booleanValue)r=this.visit(e.booleanValue),i=`BOOLEAN`;else if(e.DateLiteral)r=e.DateLiteral[0].image,i=`DATE_LITERAL`;else if(e.dateNLiteral){var o=this.visit(e.dateNLiteral);r=o.value,a=o.variable,i=`DATE_N_LITERAL`}else if(e.arrayExpression){var s=this.visit(e.arrayExpression);r=s.map(function(e){return e.value});var c=s.map(function(e){return e.variable||null}),l=c.some(function(e){return e!==null});i=new Set(s.map(function(e){return e.type})).size===1?this.helpers.$_getLiteralTypeFromTokenType(s[0].type):s.map(function(e){return n.helpers.$_getLiteralTypeFromTokenType(e.type)}),l&&(a=c),i||=`STRING`}else e.whereClauseSubqueryIdentifier&&(r=this.visit(e.whereClauseSubqueryIdentifier),i=`SUBQUERY`);return t.returnLiteralType?{value:r,literalType:i,dateLiteralVariable:a}:r},t.prototype.apexBindVariableExpression=function(e){var t=this;return e.apex.map(function(e){return t.visit(e)}).join(`.`)},t.prototype.apexBindVariableIdentifier=function(e){var t=e.Identifier[0].image;return e.apexBindVariableFunctionArrayAccessor&&(t+=this.visit(e.apexBindVariableFunctionArrayAccessor[0])),t},t.prototype.apexBindVariableNewInstantiation=function(e){var t=`new ${e.function[0].image}`;return e.apexBindVariableGeneric&&(t+=this.visit(e.apexBindVariableGeneric[0])),t+=this.visit(e.apexBindVariableFunctionParams[0]),e.apexBindVariableFunctionArrayAccessor&&(t+=this.visit(e.apexBindVariableFunctionArrayAccessor[0])),t},t.prototype.apexBindVariableFunctionCall=function(e){var t=`${e.function[0].image}${this.visit(e.apexBindVariableFunctionParams[0])}`;return e.apexBindVariableFunctionArrayAccessor&&(t+=this.visit(e.apexBindVariableFunctionArrayAccessor[0])),t},t.prototype.apexBindVariableGeneric=function(e){return`<${e.parameter.map(function(e){return e.image}).join(`, `)}>`},t.prototype.apexBindVariableFunctionParams=function(e){return`(${(Array.isArray(e.parameter)?e.parameter:[]).map(function(e){return e.image}).join(`, `)})`},t.prototype.apexBindVariableFunctionArrayAccessor=function(e){return`[${e.value[0].image}]`},t.prototype.arrayExpression=function(e){var t=this;return e.value.map(function(e){return It(e)?{type:e.tokenType.name,value:e.image}:t.visit(e,{includeType:!0})})},t.prototype.relationalOperator=function(e){return e.operator[0].image},t.prototype.setOperator=function(e){if(Array.isArray(e.operator))return e.operator[0].tokenType.name.replace(`_`,` `);if(Array.isArray(e.notIn))return this.visit(e.notIn)},t.prototype.notInOperator=function(e){return`NOT IN`},t.prototype.booleanValue=function(e){return e.boolean[0].tokenType.name},t.prototype.dateNLiteral=function(e,t){var n={value:`${e.dateNLiteral[0].image}:${e.variable[0].image}`,variable:Number(e.variable[0].image)};return t&&t.includeType&&(n.type=e.dateNLiteral[0].tokenType.name),n},t.prototype.forViewOrReference=function(e){return e.value[0].tokenType.name},t.prototype.updateTrackingViewstat=function(e){return e.value[0].tokenType.name},t}(Gu));function Xu(e,t){var n=Hu(e,t).cst;return Yu.visit(n)}function Zu(e,t){try{return Hu(e,t).parseErrors.length===0}catch{return!1}}function Qu(e){if(typeof e==`string`)return{type:`Field`,field:e};if(Kt(e)){var t=[];return e.parameters&&(t=Array.isArray(e.parameters)?e.parameters:[e.parameters]),{type:`FieldFunctionExpression`,functionName:e.functionName||e.fn,parameters:t,alias:e.alias}}if(qt(e))return{type:`FieldRelationship`,field:e.field,relationships:e.relationships,objectPrefix:e.objectPrefix};if(Jt(e))return{type:`FieldSubquery`,subquery:e.subquery};if(Yt(e))return{type:`FieldTypeof`,field:e.field,conditions:e.conditions};if(Gt(e))return{type:`Field`,field:e.field,objectPrefix:e.objectPrefix};throw TypeError(`The input object provided did not match any valid field types`)}var $u=function(){function e(e,t){this.currIndent=1,this.enabled=e,this.options={numIndent:t.numIndent??1,fieldMaxLineLength:t.fieldMaxLineLength??60,fieldSubqueryParensOnOwnLine:t.fieldSubqueryParensOnOwnLine??!0,whereClauseOperatorsIndented:!0,newLineAfterKeywords:t.newLineAfterKeywords??!1,logging:t.logging??!1},this.options.newLineAfterKeywords&&(this.options.fieldSubqueryParensOnOwnLine=!0)}return e.prototype.log=function(e){this.options.logging&&console.log(e)},e.prototype.getIndent=function(e){return e===void 0&&(e=0),this.repeatChar((this.currIndent+e)*(this.options.numIndent||1),` `)},e.prototype.repeatChar=function(e,t){return Array(e).fill(t).join(``)},e.prototype.setSubquery=function(e){this.currIndent=e?this.currIndent+=1:--this.currIndent},e.prototype.stepCurrIndex=function(e){this.currIndent+=e},e.prototype.formatFields=function(e){var t=this;function n(t){e.fields[t-1]&&(e.fields[t-1].suffix=e.fields[t-1].suffix.trim())}if(e.fields.forEach(function(t,n){t.suffix=e.fields.length-1===n?``:`, `}),this.enabled){var r=0,i=!1;e.fields.forEach(function(a,o){a.isSubquery?(n(o),a.prefix=`
|
|
160
|
+
${t.getIndent()}`,a.suffix=e.fields.length-1===o?``:`, `,r=0,i=!0):Array.isArray(a.typeOfClause)?(n(o),a.prefix=`
|
|
161
|
+
${t.getIndent()}`,i=!0):zt(t.options.fieldMaxLineLength)&&(r+=a.text.length+a.suffix.length,(r>t.options.fieldMaxLineLength||i)&&(n(o),(!t.options.newLineAfterKeywords||o>0)&&(a.prefix+=`
|
|
162
|
+
${t.getIndent()}`),r=0,i=!1)),t.log(a)})}},e.prototype.formatTyeOfField=function(e,t){var n=this;return this.enabled&&this.options.newLineAfterKeywords?t.map(function(e,r){return r===0?e:r===t.length-1?`${n.getIndent()}${e}`:`${n.getIndent()} ${e}`}).join(`
|
|
163
|
+
`):e},e.prototype.formatTypeofFieldCondition=function(e){var t=``,n=e.fieldList.join(`, `);if(this.enabled&&this.options.newLineAfterKeywords){var r=this.getIndent();t=`${e.type}`,e.objectType?t+=`
|
|
164
|
+
${r} ${e.objectType}
|
|
165
|
+
${r} THEN
|
|
166
|
+
${r} ${n}`:t+=`
|
|
167
|
+
${r} ${n}`}else t=e.type,e.objectType?t+=` ${e.objectType} THEN ${n}`:t+=` ${n}`;return t},e.prototype.formatSubquery=function(e,t,n){t===void 0&&(t=2),n===void 0&&(n=!1),n&&t++;var r=`(`,i=`)`;return this.enabled&&(this.options.fieldSubqueryParensOnOwnLine||this.options.newLineAfterKeywords?(e=e.replace(/\n/g,`
|
|
168
|
+
${this.repeatChar(t,` `)}`),r=`(
|
|
169
|
+
${this.repeatChar(t,` `)}`,i=`
|
|
170
|
+
${this.repeatChar(t-1,` `)})`):e=e.replace(/\n/g,`
|
|
171
|
+
`)),`${r}${e}${i}`},e.prototype.formatClause=function(e){return this.enabled?this.options.newLineAfterKeywords?`
|
|
172
|
+
${e}
|
|
173
|
+
`:`
|
|
174
|
+
${e}`:` ${e}`},e.prototype.formatText=function(e){return this.enabled&&(this.options.newLineAfterKeywords||e.startsWith(`
|
|
175
|
+
`))?e:` ${e}`},e.prototype.formatWithIndent=function(e){return this.enabled?`${this.getIndent()}${e}`:e},e.prototype.formatOrderByArray=function(e){var t=this;if(this.enabled){var n=0,r=``;return e.forEach(function(i,a){var o=e[a+1];n+=i.length,o&&(n+o.length>(t.options.fieldMaxLineLength||0)||t.options.newLineAfterKeywords)?(r+=`${i},
|
|
176
|
+
`,n=0):r+=`${i}${o?`, `:``}`}),r}return e.join(`, `)},e.prototype.formatParens=function(e,t,n){n===void 0&&(n=!1);var r=``;if(zt(e)&&e>0){if(this.enabled){if(t===`(`){for(var i=0;i<e;i++)n&&i===e-1?r+=`(`:i===0?r+=`(
|
|
177
|
+
`:(this.currIndent++,r+=`${this.getIndent()}(
|
|
178
|
+
`);(!n||e>1)&&this.currIndent++}else for(var i=e-1;i>=0;i--)n&&i===e-1?r+=`)`:(this.currIndent--,r+=`
|
|
179
|
+
${this.getIndent()})`)}else r+=Ut(e,t)}return r},e.prototype.formatWhereClauseOperators=function(e,t,n){n===void 0&&(n=0);var r=e===`NOT`;return this.enabled&&!r?`
|
|
180
|
+
${this.getIndent(n)}${e} ${t}`:`${r?``:` `}${e} ${t}`},e.prototype.formatAddNewLine=function(e,t){return e===void 0&&(e=` `),this.enabled&&!t?`
|
|
181
|
+
`:e},e}(),ed=function(){return ed=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ed.apply(this,arguments)};function td(e,t){if(t===void 0&&(t={}),!e)return``;t||={},t.format=!!t.format,t.logging&&(console.time(`composer`),console.log(`Composing Query:`,e),console.log(`Format output:`,t.format));var n=new nd(e,t).query;return t.logging&&console.timeEnd(`composer`),n}var nd=function(){function e(e,t){t===void 0&&(t={}),this.soql=e,this.logging=!1,this.format=!1,t=ed({autoCompose:!0},t);var n=t.logging,r=t.format;this.logging=!!n,this.format=!!r,this.query=``,this.formatter=new $u(this.format,ed({logging:this.logging},t.formatOptions)),t.autoCompose&&this.start()}return e.prototype.start=function(){this.query=this.parseQuery(this.soql)},e.prototype.log=function(e){this.logging&&console.log(`Current SOQL:`,e)},e.prototype.parseFn=function(e){var t=this,n;return e.rawValue?n=e.rawValue:(n=e.functionName,n+=`(${(e.parameters||[]).map(function(e){return Rt(e)?e:t.parseFn(e)}).join(`, `)})`),e.alias&&(n+=` ${e.alias}`),n},e.prototype.parseQuery=function(e){var t=this,n={fields:this.parseFields(e.fields||[]).map(function(e){return{text:e.text,typeOfClause:e.typeOfClause,isSubquery:e.text.startsWith(`(`),prefix:``,suffix:``}}),isSubquery:Xt(e),lineBreaks:[]},r=``;e.fields&&(r+=this.formatter.formatClause(`SELECT`).trimStart()),this.formatter.formatFields(n);var i=``;if(n.fields.forEach(function(e){Array.isArray(e.typeOfClause)?i+=`${e.prefix}${t.formatter.formatTyeOfField(e.text,e.typeOfClause)}${e.suffix}`:i+=`${e.prefix}${e.text}${e.suffix}`}),r+=this.formatter.formatText(i),(Xt(e)?e.relationshipName:e.sObject)&&(r+=this.formatter.formatClause(`FROM`)),Xt(e)){var a=e.sObjectPrefix||[];a.push(e.relationshipName),r+=this.formatter.formatText(`${a.join(`.`)}${Vt(e.sObjectAlias,``,` `)}`)}else e.sObject&&(r+=this.formatter.formatText(`${e.sObject}${Vt(e.sObjectAlias,``,` `)}`));return this.log(r),e.usingScope&&(r+=this.formatter.formatClause(`USING SCOPE`),r+=this.formatter.formatText(e.usingScope),this.log(r)),e.where&&(r+=this.formatter.formatClause(`WHERE`),r+=this.formatter.formatText(this.parseWhereOrHavingClause(e.where)),this.log(r)),e.groupBy&&(r+=this.formatter.formatClause(`GROUP BY`),r+=this.formatter.formatText(this.parseGroupByClause(e.groupBy)),this.log(r),e.having&&(r+=this.formatter.formatClause(`HAVING`),r+=this.formatter.formatText(this.parseWhereOrHavingClause(e.having)),this.log(r))),e.orderBy&&(!Array.isArray(e.orderBy)||e.orderBy.length>0)&&(r+=this.formatter.formatClause(`ORDER BY`),r+=this.formatter.formatText(this.parseOrderBy(e.orderBy)),this.log(r)),zt(e.limit)&&(r+=this.formatter.formatClause(`LIMIT`),r+=this.formatter.formatText(`${e.limit}`),this.log(r)),zt(e.offset)&&(r+=this.formatter.formatClause(`OFFSET`),r+=this.formatter.formatText(`${e.offset}`),this.log(r)),e.withDataCategory&&(r+=this.formatter.formatClause(`WITH DATA CATEGORY`),r+=this.formatter.formatText(this.parseWithDataCategory(e.withDataCategory)),this.log(r)),e.withSecurityEnforced&&(r+=this.formatter.formatClause(`WITH SECURITY_ENFORCED`),this.log(r)),e.withAccessLevel&&(r+=this.formatter.formatClause(`WITH ${e.withAccessLevel}`),this.log(r)),e.for&&(r+=this.formatter.formatClause(`FOR`),r+=this.formatter.formatText(e.for),this.log(r)),e.update&&(r+=this.formatter.formatClause(`UPDATE`),r+=this.formatter.formatText(e.update),this.log(r)),r.trim()},e.prototype.parseFields=function(e){var t=this;return e.map(function(e){var n=``,r,i=e.objectPrefix?`${e.objectPrefix}.`:``;switch(e.type){case`Field`:n=`${i}${e.field}${e.alias?` ${e.alias}`:``}`;break;case`FieldFunctionExpression`:var a=``;e.parameters&&(a=e.parameters.map(function(e){return Rt(e)?e:t.parseFields([e]).map(function(e){return e.text})}).join(`, `)),n=`${e.functionName}(${a})${e.alias?` ${e.alias}`:``}`;break;case`FieldRelationship`:n=`${i}${e.relationships.join(`.`)}.${e.field}${Wt(e)?` ${e.alias}`:``}`;break;case`FieldSubquery`:n=t.formatter.formatSubquery(t.parseQuery(e.subquery));break;case`FieldTypeof`:r=t.parseTypeOfField(e),n=r.join(` `)}return{text:n,typeOfClause:r}})},e.prototype.parseTypeOfField=function(e){var t=this,n=[`TYPEOF ${e.field}`].concat(e.conditions.map(function(e){return t.formatter.formatTypeofFieldCondition(e)}));return n.push(`END`),n},e.prototype.parseWhereOrHavingClause=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=!1);var r=``,i=e.left,a=!1;if(i&&(r+=this.formatter.formatParens(i.openParen,`(`,en(i)),!en(i))){t=t+(i.openParen||0)-(i.closeParen||0),n&&t++;var o=``;o+=$t(i)?this.parseFn(i.fn):i.field,o+=` ${i.operator} `,tn(i)?o+=this.formatter.formatSubquery(this.parseQuery(i.valueQuery),1,!0):o+=Ht(on(i.value,i.literalType,i.operator)),r+=this.formatter.formatWithIndent(o),r+=this.formatter.formatParens(i.closeParen,`)`,n)}if(Qt(e)){var s=Vt(e.operator);a=s===`NOT`;var c=this.formatter.formatWhereClauseOperators(s,this.parseWhereOrHavingClause(e.right,t,en(i)),t);return`${a?r.trimRight():r}${c}`.trim()}return r.trim()},e.prototype.parseGroupByClause=function(e){var t=this;return(Array.isArray(e)?e:[e]).map(function(e){return rn(e)?e.field:t.parseFn(e.fn)}).join(`, `)},e.prototype.parseOrderBy=function(e){var t=this;if(Array.isArray(e))return this.formatter.formatOrderByArray(e.map(function(e){return t.parseOrderBy(e)}));var n=``;return nn(e)?n=`${Vt(e.field,` `)}`:n+=`${this.parseFn(e.fn)} `,n+=`${Vt(e.order,` `)}${Vt(e.nulls,``,`NULLS `)}`,n.trim()},e.prototype.parseWithDataCategory=function(e){return e.conditions.map(function(e){var t=e.parameters.length>1?`(${e.parameters.join(`, `)})`:`${e.parameters.join(`, `)}`;return`${e.groupName} ${e.selector} ${t}`}).join(` AND `)},e}();function rd(e,t){let n=`${t}__`;return e.toLowerCase().startsWith(n.toLowerCase())?e.slice(n.length):e}function id(e,t){return t?e.split(`.`).map(e=>rd(e,t)).join(`.`):e}function G(e,t){return id(e,t).toLowerCase()}function ad(e,t,n){return n?id(e,t):e}function od(e,t,n){let r=G(t,n);return e.find(e=>G(e.name,n)===r)}function sd(e){if(e.trim())try{return Zu(e)?Xu(e):void 0}catch{return}}function cd(e){return td(e,{format:!0})}function ld(e){let t=sd(e);return t&&cd(t)}function ud(e,t){switch(e.type){case`Field`:return G(e.field,t);case`FieldRelationship`:return G([...e.relationships,e.field].join(`.`),t);default:return}}function dd(e,t){let n=new Set;for(let r of e??[]){let e=ud(r,t);e&&n.add(e)}return n}function fd(e,t){let n=new Map;for(let r of e.fields??[])r.type===`FieldSubquery`&&n.set(G(r.subquery.relationshipName,t),dd(r.subquery.fields,t));return{object:e.sObject??``,fields:dd(e.fields,t),subqueries:n}}function pd(e,t){return G([...e.relationships,e.name].join(`.`),t)}function md(e,t){let n=ad(e.name,t.ns,t.omitNamespace);return e.relationships.length===0?Qu(n):Qu({field:n,relationships:e.relationships.map(e=>ad(e,t.ns,t.omitNamespace))})}function hd(e,t,n){let r=pd(t,n.ns),i=e.fields??[],a=i.filter(e=>ud(e,n.ns)!==r);return{...e,fields:a.length===i.length?[...i,md(t,n)]:a}}function gd(e,t,n,r){let i=sd(e);if(!i)return;if(!r)return cd(hd(i,t,n));let a=G(r,n.ns),o=i.fields??[],s=o.findIndex(e=>e.type===`FieldSubquery`&&G(e.subquery.relationshipName,n.ns)===a);if(s===-1){let e={fields:[md(t,n)],relationshipName:ad(r,n.ns,n.omitNamespace)};return cd({...i,fields:[...o,Qu({subquery:e})]})}let c=o[s],l={...c,subquery:hd(c.subquery,t,n)};return cd({...i,fields:o.map((e,t)=>t===s?l:e)})}function _d(e,t,n){let r=sd(e);if(!r)return;let i=G(t,n.ns),a=r.fields??[],o=a.filter(e=>e.type!==`FieldSubquery`||G(e.subquery.relationshipName,n.ns)!==i);if(o.length!==a.length)return cd({...r,fields:o});let s={fields:[Qu(`Id`)],relationshipName:ad(t,n.ns,n.omitNamespace)};return cd({...r,fields:[...a,Qu({subquery:s})]})}function vd(e,t,n){let r=sd(e);if(r)return cd({...r,fields:t.map(e=>Qu(ad(e,n.ns,n.omitNamespace)))})}function yd(e){let t=sd(e);if(t)return cd({...t,fields:[Qu(`Id`)]})}function bd(e,t){return cd({fields:[Qu(`Id`)],sObject:ad(e,t.ns,t.omitNamespace)})}function xd(e){return typeof e==`object`&&!!e&&Array.isArray(e.records)}function Sd(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!xd(e)}function Cd(e,t,n){for(let[r,i]of Object.entries(e)){if(r===`attributes`)continue;let e=[...t,r];Sd(i)?Cd(i,e,n):n.push({key:e.join(`.`),path:e,kind:xd(i)?`child`:`value`})}}function wd(e,t){let n=[...e],r=!1,i=new Set(n.map(e=>e.key));for(let e of t){let t=[];Cd(e,[],t);for(let e of t){if(i.has(e.key)){if(e.kind===`child`){let t=n.findIndex(t=>t.key===e.key);n[t].kind!==`child`&&(n[t]=e,r=!0)}continue}if(n.some(t=>t.key.startsWith(`${e.key}.`)))continue;i.add(e.key),r=!0;let t=e.path.slice(0,-1).map((t,n)=>e.path.slice(0,n+1).join(`.`)).map(e=>n.findIndex(t=>t.key===e)).find(e=>e!==-1);t===void 0?n.splice(Td(n,e.path),0,e):(i.delete(n[t].key),n.splice(t,1,e))}}return r?n:e}function Td(e,t){for(let n=t.length-1;n>0;n--){let r=t.slice(0,n).join(`.`)+`.`,i=-1;if(e.forEach((e,t)=>{e.key.startsWith(r)&&(i=t)}),i!==-1)return i+1}return e.length}function Ed(e,t){let n=e;for(let e of t.path){if(!Sd(n))return null;n=n[e]}return n}function Dd(e){return e==null?``:xd(e)?`${e.totalSize??e.records.length} rows`:typeof e==`object`?JSON.stringify(e):String(e)}var Od=200,kd=4,Ad=48,jd=/[\u1100-\u115f\u2e80-\ua4cf\uac00-\ud7a3\uf900-\ufaff\ufe30-\ufe4f\uff00-\uff60\uffe0-\uffe6]/u;function Md(e,t){let n=0;for(let r of e)if(n+=jd.test(r)?2:1,n>=t)return t;return n}function Nd(e,t){let n=Md(e.key,Ad);for(let r of t.slice(0,Od)){if(n>=Ad)break;n=Math.max(n,Md(Dd(Ed(r,e)),Ad))}return Math.min(Math.max(n,kd),Ad)}function Pd(e,t){let n=!1;for(let r of t.slice(0,Od)){let t=Ed(r,e);if(t!=null){if(typeof t!=`number`)return!1;n=!0}}return n}function Fd(e){return rt(ld(e)??e)}function Id(e,t,n){return n?{soql:Fd(e),tooling:t,prompt:n}:void 0}function Ld(e,t,n){return e&&e.tooling===n&&e.soql===Fd(t)?e.prompt:void 0}var Rd=`sfbench.editor`,zd=`sfbench.apexDraft`;function Bd(e,t,n=Rd){if(t!==void 0)return Vd(e,t,n),t;try{let t=JSON.parse(sessionStorage.getItem(n)??`null`);if(t&&t.org===e&&typeof t.text==`string`)return t.text;sessionStorage.removeItem(n)}catch{}return``}function Vd(e,t,n=Rd){try{sessionStorage.setItem(n,JSON.stringify({org:e,text:t}))}catch{}}var Hd={soql:`sfbench.soqlApiVersion`,apex:`sfbench.apexApiVersion`};function Ud(e,t){return Bd(e,void 0,Hd[t])||void 0}function Wd(e,t,n){Vd(e,n??``,Hd[t])}var Gd=(0,_.createContext)(void 0),Kd=(0,_.createContext)(void 0);function qd({username:e,seed:t,initialApiVersion:n,children:r}){let{settings:i,notify:a,guardDiscard:o}=he(),{summaries:s,handleOrgError:c,markAuthError:l,reportApiUsage:u}=Ae(),d=s[e],f=(0,_.useRef)(null),[p,m]=(0,_.useState)(),[h,g]=(0,_.useState)(``),[v,y]=(0,_.useState)(),[b,x]=(0,_.useState)(!1),[S,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(n),[D,O]=(0,_.useState)([]),[k,A]=(0,_.useState)(``),[j,M]=(0,_.useState)(),[ee,N]=(0,_.useState)({state:`idle`}),{start:te,running:ne,cancel:re}=ue(),ie=(0,_.useRef)(0),{start:ae}=ue(),oe=(0,_.useMemo)(()=>({ns:d?.namespacePrefix,omitNamespace:i?.omitNamespace??!0}),[d,i]),ce=(0,_.useCallback)((e,t=!0)=>{let n=sd(e);if(A(e),g(e.trimStart().split(`
|
|
182
|
+
`,1)[0]),!e.trim()){m(void 0),t&&y(void 0);return}if(!n)return;let r=fd(n,oe.ns);m(r),t&&y(e=>e?.toLowerCase()===r.object.toLowerCase()?e:r.object)},[oe.ns]);(0,_.useEffect)(()=>{f.current&&ce(f.current.getText(),!1)},[ce]);let le=(0,_.useCallback)(e=>{f.current?.setText(e),ce(e)},[ce]),de=(0,_.useCallback)(e=>{let t=e(f.current?.getText()??``);t===void 0?a({message:C.cannotParseSoql}):le(t)},[a,le]),fe=(0,_.useCallback)(async()=>{let t=await ae(t=>P.history(e,t),`replace`);t.kind===`done`&&O(t.value.entries)},[ae,e]),pe=(0,_.useCallback)(async(t,n={})=>{if(!t.trim())return;let r=performance.now(),i=n.tooling??b,a=`apiVersion`in n?n.apiVersion:T,o=n.prompt,s=await te(n=>P.query(e,{soql:t,tooling:i,queryAll:!i&&S,...o?{prompt:o}:{},...a?{apiVersion:a}:{}},n),n.whileRunning??`ignore`);if(s.kind===`stale`)return;if(s.kind===`done`){let n=s.value;u(e,n.apiUsage),N({state:`done`,id:++ie.current,records:n.records,columns:wd([],n.records),totalSize:n.totalSize,nextRecordsUrl:n.done?void 0:n.nextRecordsUrl,pageSize:Math.max(n.records.length,1),username:e,object:sd(t)?.sObject??At(t),tooling:i,apiVersion:a,elapsedMs:performance.now()-r,executedAt:new Date}),fe();return}let d=se(s.error);if(!d){c(e,s.error),N({state:`idle`});return}d.orgAuth&&l(e,d.reloginCommand);let{rejected:f,orgAuth:p,...m}=d;N({state:`error`,...m,rejected:f?{soql:t,tooling:i,apiVersion:a,prompt:o}:void 0})},[te,e,b,S,T,u,c,l,fe]),me=(0,_.useCallback)(()=>{o(()=>{let e=f.current?.getText()??``;pe(e,{prompt:Ld(j,e,b)})})},[o,pe,j,b]),I=(0,_.useCallback)(t=>{E(t),Wd(e,`soql`,t)},[e]),L=(0,_.useCallback)(e=>{x(e),e&&w(!1)},[]),R=(0,_.useCallback)((e,t)=>{le(e.soql),L(e.tooling),I(e.apiVersion),M(Id(e.soql,e.tooling,e.prompt)),t&&o(()=>void pe(e.soql,{tooling:e.tooling,apiVersion:e.apiVersion,prompt:e.prompt,whileRunning:`replace`}))},[le,L,I,o,pe]);(0,_.useEffect)(()=>{fe();let e=t?.run?setTimeout(()=>void pe(t.query??``),0):void 0;return()=>clearTimeout(e)},[]);let ge=(0,_.useMemo)(()=>({names:oe,selection:p,firstLine:h,panelObject:v,tooling:b,queryAll:S,apiVersion:T,setApiVersion:I,history:D,settledText:k,registerEditor:e=>{f.current=e,e&&ce(e.getText())},getText:()=>f.current?.getText()??``,applyProposal:R,onTextSettled:e=>ce(e),setTooling:L,setQueryAll:e=>{w(e),e&&x(!1)},showObjectList:()=>y(void 0),pickObject:e=>le(bd(e,oe)),toggleField:(e,t)=>de(n=>gd(n,e,oe,t)),toggleSubquery:e=>de(t=>_d(t,e,oe)),selectAll:e=>de(t=>vd(t,e,oe)),clearAll:()=>de(yd),format:()=>de(ld),loadHistory:e=>{le(e.soql),M(Id(e.soql,e.tooling,e.prompt)),x(e.tooling),w(!e.tooling&&e.queryAll),I(e.apiVersion)},run:me}),[oe,p,h,v,b,S,T,I,D,k,ce,R,L,le,de,me]),_e=(0,_.useCallback)(()=>{re()&&N({state:`idle`})},[re]),ve=(0,_.useMemo)(()=>({result:ee,running:ne,cancel:_e}),[ee,ne,_e]);return(0,F.jsx)(Gd.Provider,{value:ge,children:(0,F.jsx)(Kd.Provider,{value:ve,children:r})})}function Jd(){let e=(0,_.useContext)(Gd);if(!e)throw Error(`useSoql must be used inside SoqlProvider`);return e}function Yd(){let e=(0,_.useContext)(Kd);if(!e)throw Error(`useResult must be used inside SoqlProvider`);return e}function Xd(e){if(!e)return`hidden`;let t=e.ai;return t?t.provider===`off`?`hidden`:t.model&&t.hasApiKey&&t.keyProvider===t.provider?`ready`:`setup`:`setup`}var Zd={proposal:void 0,failure:void 0};function Qd(e,t){switch(t.type){case`done`:return{proposal:t.proposal,failure:void 0};case`failed`:return{proposal:void 0,failure:t.failure};case`cancelled`:return Zd;case`discarded`:case`applied`:return{...e,proposal:void 0}}}var $d=()=>Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`;function ef(e){let{settings:t}=he(),{handleOrgError:n}=Ae(),{start:r,cancel:i,running:a,progress:o}=ue(),[s,c]=(0,_.useReducer)(Qd,Zd),[l,u]=(0,_.useState)(``),d=t?.ai,f=Xd(t),p=d&&d.provider!==`off`?`${C.aiProviderName[d.provider]} · ${d.model}`:``,m=(0,_.useCallback)((t,i)=>{r(t,`ignore`).then(t=>{if(t.kind===`done`&&c({type:`done`,proposal:{...t.value,before:i()}}),t.kind!==`error`)return;let r=t.error,a=ne(te(r))?void 0:{message:re(r),details:ie(r)};a||n(e,r),c({type:`failed`,failure:a})})},[r,n,e]),h=(0,_.useCallback)(()=>{i()&&c({type:`cancelled`})},[i]),g=(0,_.useCallback)(()=>c({type:`discarded`}),[]),v=(0,_.useCallback)(()=>c({type:`applied`}),[]);return(0,_.useMemo)(()=>({availability:f,label:p,request:l,setRequest:u,running:a,step:o,proposal:a||f!==`ready`?void 0:s.proposal,failure:a?void 0:s.failure,start:m,cancel:h,discard:g,applied:v}),[f,p,l,a,o,s,m,h,g,v])}var tf=(0,_.createContext)(void 0),nf=e=>t=>{throw t instanceof k&&(t.code===`AI_INPUT_TOO_LONG`||t.code===`PAYLOAD_TOO_LARGE`)?Error(e):t};function rf({username:e,children:t}){let n=Jd(),{getText:r}=n,{setOpen:i}=Ft(),a=ef(e),[o,s]=(0,_.useState)(!0),c=n.firstLine.trim()!==``,l=o&&c,{availability:u,request:d,start:f,proposal:p,applied:m}=a,h=(0,_.useCallback)(()=>{let t=d.trim();if(!t||u!==`ready`)return;let{tooling:i,apiVersion:a,panelObject:o}=n,s=l?n.getText():``,c={request:t,tooling:i,language:w,timeZone:$d(),...s.trim()?{editor:s}:{},...o?{openObject:o}:{}};f(async(n,r)=>{r(`think`);let{output:o}=await P.aiAgent(e,{task:`generateSoql`,input:c,...a?{apiVersion:a}:{}},n).catch(nf(s.trim()?C.aiEditorTooLong:C.aiRequestTooLong));return{...o,tooling:i,apiVersion:a,prompt:t}},r)},[d,u,e,l,n,f,r]),g=(0,_.useCallback)((t,n)=>{if(u!==`ready`)return;i(`editor`,!0);let{soql:a,tooling:o,apiVersion:s,prompt:c}=n,l=At(a),d={soql:a,error:Ct(t),tooling:o,language:w,timeZone:$d(),...l?{object:l}:{}};f(async(t,n)=>{n(`think`);let{output:r}=await P.aiAgent(e,{task:`fixSoql`,input:d,...s?{apiVersion:s}:{}},t).catch(nf(C.aiQueryTooLong));return{...r,tooling:o,apiVersion:s,prompt:c}},r)},[u,i,e,f,r]),{applyProposal:v}=n,y=(0,_.useCallback)(e=>{p&&(v(p,e),m())},[p,v,m]),b=(0,_.useMemo)(()=>({...a,panelObject:n.panelObject,hasEditorText:c,sendEditor:o,setSendEditor:s,generate:h,fix:g,apply:y}),[a,n.panelObject,c,o,h,g,y]);return(0,F.jsx)(tf.Provider,{value:b,children:t})}function af(){let e=(0,_.useContext)(tf);if(!e)throw Error(`useAi must be used inside AiProvider`);return e}function of(e){if(!e.changesData)return[];let t=[];return e.historyLoaded||t.push(`historyUnknown`),e.sameUnknown&&t.push(`unknownOutcome`),e.otherPending&&t.push(`otherPending`),e.isProduction&&t.push(`production`),t}function sf(e,t){if(ce(e,t))return{kind:`unknown`};let n=se(e);return n?{kind:`error`,message:n.message,details:n.details,reloginCommand:n.reloginCommand,orgAuth:n.orgAuth}:{kind:`elsewhere`}}function cf(e,t){return e.replace(/\r\n?/g,`
|
|
183
|
+
`)===t.replace(/\r\n?/g,`
|
|
184
|
+
`)}function lf(e,t){let n=t.history.filter(e=>e.outcome.state===`pending`||e.outcome.state===`unknown`),r=n.some(t=>cf(t.code,e));return of({changesData:!0,isProduction:t.isProduction,historyLoaded:t.historyLoaded,sameUnknown:r,otherPending:!r&&n.some(e=>e.outcome.state===`pending`)})}function uf(e){return{result:{state:`idle`},confirming:void 0,launchNotice:e}}function df(e,t){switch(t.type){case`confirm`:return{...e,confirming:{code:t.code,reasons:t.reasons}};case`confirmCancelled`:return{...e,confirming:void 0};case`running`:return{...e,confirming:void 0,launchNotice:!1};case`result`:return{...e,result:t.result};case`noticeClosed`:return{...e,launchNotice:!1}}}function ff(e){return e.split(`
|
|
185
|
+
`).find(e=>e.trim())?.trim()??``}var pf=(0,_.createContext)(void 0);function mf(e){return{id:`local-${Date.now()}`,code:e.code,sentAt:e.ranAt,outcome:{state:`unknown`,reason:`error`}}}function hf({username:e,seed:t,initialCode:n,initialApiVersion:r,children:i}){let{handleCommonError:a}=he(),{isProduction:o,handleOrgError:s,markAuthError:c}=Ae(),l=(0,_.useRef)(n),u=(0,_.useRef)(null),[d,f]=(0,_.useReducer)(df,!!t?.apex,uf),[p,m]=(0,_.useState)(()=>ff(n)),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(r),b=(0,_.useRef)(void 0),[x,S]=(0,_.useState)([]),[w,T]=(0,_.useState)(!1),{start:E,running:D}=ue(),{start:O,running:k}=ue(),A=(0,_.useCallback)(async()=>{let t=await O(t=>P.apexHistory(e,t),`replace`);t.kind===`done`&&(S(t.value.entries),T(!0))},[O,e]);(0,_.useEffect)(()=>{A()},[]);let j=(0,_.useCallback)(e=>{b.current=e.state===`idle`?void 0:e.run.code,g(b.current!==void 0&&!cf(b.current,l.current)),f({type:`result`,result:e})},[]),M=(0,_.useCallback)(async t=>{f({type:`running`});let n={code:t,ranAt:new Date().toISOString()},r=await E(n=>P.apex(e,{code:t,...v?{apiVersion:v}:{}},n),`ignore`);if(r.kind===`stale`)return;if(A(),r.kind===`done`){j({state:`response`,run:n,response:r.value});return}let i=r.error,o=sf(i,!0);o.kind===`unknown`?(a(i),S(e=>[mf(n),...e]),j({state:`unknown`,run:n,message:C.apexUnknown})):o.kind===`elsewhere`?(s(e,i),j({state:`idle`})):(o.orgAuth&&c(e,o.reloginCommand),j({state:`error`,run:n,message:o.message,details:o.details,reloginCommand:o.reloginCommand}))},[E,e,v,A,j,a,s,c]),ee=(0,_.useCallback)(()=>{if(D)return;let e=l.current;if(!e.trim())return;if(e.length>32e3){j({state:`error`,run:{code:e,ranAt:new Date().toISOString()},message:C.apexTooLong(et.toLocaleString())});return}let t=lf(e,{isProduction:o,history:x,historyLoaded:w});t.length>0?f({type:`confirm`,code:e,reasons:t}):M(e)},[D,o,x,w,M,j]),{confirming:N}=d,te=(0,_.useCallback)(()=>{N&&M(N.code)},[N,M]),ne=(0,_.useCallback)(t=>{l.current=t,Vd(e,t,zd),m(ff(t)),g(b.current!==void 0&&!cf(b.current,t))},[e]),re=(0,_.useMemo)(()=>({...d,username:e,initialCode:n,registerEditor:e=>{u.current=e},onCodeChange:ne,getCode:()=>l.current,setCode:e=>u.current?.setText(e),firstLine:p,empty:!p,codeChanged:h,goTo:(e,t)=>u.current?.goTo(e,t),apiVersion:v,setApiVersion:t=>{y(t),Wd(e,`apex`,t)},history:x,historyLoading:k,refreshHistory:()=>void A(),loadEntry:e=>u.current?.setText(e.code),running:D,run:ee,confirmRun:te,cancelConfirm:()=>f({type:`confirmCancelled`}),closeNotice:()=>f({type:`noticeClosed`}),apexLeftOutFor:t?.apexLeftOutFor}),[d,n,ne,p,h,v,e,x,k,A,D,ee,te,t?.apexLeftOutFor]);return(0,F.jsx)(pf.Provider,{value:re,children:i})}function gf(){let e=(0,_.useContext)(pf);if(!e)throw Error(`useApex must be used inside ApexProvider`);return e}var _f=/^\d{2}:\d{2}:\d{2}\.\d+ \(\d+\)\|/;function vf(e){let t=[],n=[];for(let r of e.split(`
|
|
186
|
+
`))_f.test(r)&&n.length>0&&(t.push(n.join(`
|
|
187
|
+
`)),n=[]),n.push(r);return n.length>0&&(n.length!==1||n[0]!==``)&&t.push(n.join(`
|
|
188
|
+
`)),t}function yf(e){return vf(e).filter(e=>_f.test(e)&&e.split(`
|
|
189
|
+
`,1)[0].split(`|`)[1]===`USER_DEBUG`).join(`
|
|
190
|
+
`)}function bf(e,t){if(!t)return[];let n=new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),`gi`),r=[];for(let t=n.exec(e);t&&r.length<1e4;t=n.exec(e))r.push({from:t.index,to:t.index+t[0].length});return r}var xf=(0,_.createContext)(void 0);function Sf(e){return{outcome:Ct(e.result===`success`?`Ran successfully.`:e.result===`compileError`?`Compile error: ${e.compileProblem??``}`:`Exception: ${e.exceptionMessage??``}`),debug:Ct(yf(e.logs))}}function Cf({username:e,children:t}){let n=gf(),r=ef(e),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(0),u=(0,_.useCallback)(e=>{s(e),e&&l(e=>e+1)},[]),d=n.result.state===`response`?n.result.response:void 0,[f,p]=(0,_.useState)(d);f!==d&&(p(d),s(!1));let m=!n.empty,{availability:h,request:g,start:v,proposal:y,applied:b}=r,{getCode:x,setCode:S}=n,C=(0,_.useCallback)(()=>{let t=g.trim();if(!t||h!==`ready`)return;let a=i&&m?x():void 0,c=o&&d?Sf(d):void 0,l=n.apiVersion?{apiVersion:n.apiVersion}:{};c&&!r.running&&s(!1);let u={request:t,language:w,timeZone:$d(),...a===void 0?{}:{code:a},...c?{previous:c}:{}};v(async(t,n)=>(n(`think`),(await P.aiAgent(e,{task:`generateApex`,input:u,...l},t)).output),x)},[g,h,i,m,o,d,r.running,n.apiVersion,x,e,v]),T=(0,_.useCallback)(t=>{if(h!==`ready`)return;let r={...t,language:w,timeZone:$d()},i=n.apiVersion?{apiVersion:n.apiVersion}:{};v(async(t,n)=>(n(`think`),(await P.aiAgent(e,{task:`fixApex`,input:r,...i},t)).output),x)},[h,e,v,x,n.apiVersion]),E=(0,_.useCallback)(()=>{y&&(S(y.code),b())},[y,S,b]),D=(0,_.useMemo)(()=>({...r,hasCode:m,sendCode:i,setSendCode:a,hasPrevious:d!==void 0,sendPrevious:o,setSendPrevious:s,takeResult:u,attention:c,generate:C,fix:T,apply:E}),[r,m,i,d,o,u,c,C,T,E]);return(0,F.jsx)(xf.Provider,{value:D,children:t})}function wf(){let e=(0,_.useContext)(xf);if(!e)throw Error(`useApexAi must be used inside ApexAiProvider`);return e}function Tf(e,t){if(e!==`GET`)return!0;let n=t.toLowerCase();return n.includes(`/services/apexrest/`)||n.includes(`/executeanonymous`)}var Ef={method:`GET`,path:``,headers:[],body:``};function Df(e){let t={};for(let{name:n,value:r}of e.headers)n.trim()&&(t[n.trim()]=r);let n=nt(e.method)&&e.body.trim()!==``?e.body:void 0;return{method:e.method,path:e.path.trim(),headers:t,...n===void 0?{}:{body:n}}}function Of(e,t){return e.method===t.method&&e.path===t.path&&(e.body??``)===(t.body??``)}function kf(e){return{method:e.method,path:e.path,headers:Object.entries(e.headers??{}).map(([e,t])=>({name:e,value:t})),body:e.body??``}}function Af(e,t){return e.bodyOmitted?e.method===t.method&&e.path===t.path:Of(e,t)}function jf(e,t){return of({changesData:Tf(e.method,e.path),isProduction:t.isProduction,historyLoaded:t.historyLoaded,sameUnknown:t.history.some(t=>(t.outcome.state===`pending`||t.outcome.state===`unknown`)&&Af(t,e))})}var Mf=`sfbench.restDraft`;function Nf(e,t,n){if(t)return Pf(e,t),t;try{let t=JSON.parse(sessionStorage.getItem(Mf)??`null`),n=t?.draft;if(t?.org===e&&n&&tt.includes(n.method)&&typeof n.path==`string`&&typeof n.body==`string`&&Array.isArray(n.headers))return n;sessionStorage.removeItem(Mf)}catch{}return n}function Pf(e,t){try{sessionStorage.setItem(Mf,JSON.stringify({org:e,draft:t}))}catch{}}function Ff(e){return{result:{state:`idle`},confirming:void 0,launchNotice:e}}function If(e,t){switch(t.type){case`confirm`:return{...e,confirming:{request:t.request,reasons:t.reasons}};case`confirmCancelled`:return{...e,confirming:void 0};case`sending`:return{...e,confirming:void 0,launchNotice:!1};case`result`:return{...e,result:t.result};case`cancelled`:return{...e,result:{state:`idle`}};case`noticeClosed`:return{...e,launchNotice:!1}}}var Lf=(0,_.createContext)(void 0);function Rf(e){return{id:`local-${Date.now()}`,method:e.method,path:e.path,headers:e.headers,...e.body===void 0?{}:{body:e.body},sentAt:new Date().toISOString(),outcome:{state:`unknown`,reason:`error`}}}function zf({username:e,seed:t,children:n}){let{handleCommonError:r}=he(),{isProduction:i,handleOrgError:a,markAuthError:o,reportApiUsage:s}=Ae(),[c]=(0,_.useState)(()=>Nf(e,t?.rest&&{method:t.rest.method,path:t.rest.path,headers:[],body:t.rest.body??``},Ef)),l=(0,_.useRef)(c),[u,d]=(0,_.useState)({method:c.method,path:c.path,headers:c.headers}),f=(0,_.useRef)(null),[p,m]=(0,_.useReducer)(If,!!t?.rest,Ff),[h,g]=(0,_.useState)([]),[v,y]=(0,_.useState)(!1),{start:b,cancel:x,running:S,progress:w}=ue(),{start:T,running:E}=ue(),D=(0,_.useRef)(void 0),O=(0,_.useCallback)(()=>{clearTimeout(D.current),D.current=void 0,Pf(e,l.current)},[e]),k=(0,_.useCallback)(()=>{clearTimeout(D.current),D.current=setTimeout(O,300)},[O]);(0,_.useEffect)(()=>{let e=()=>{D.current!==void 0&&O()};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),e()}},[O]);let A=(0,_.useCallback)((e,t)=>{l.current=e,d({method:e.method,path:e.path,headers:e.headers}),t===`now`?O():k()},[O,k]),j=(0,_.useCallback)(async()=>{let t=await T(t=>P.restHistory(e,t),`replace`);t.kind===`done`&&(g(t.value.entries),y(!0))},[T,e]);(0,_.useEffect)(()=>{j()},[]);let M=(0,_.useCallback)(async t=>{m({type:`sending`});let n=Tf(t.method,t.path),i=await b((r,i)=>(i(n),P.rest(e,t,r)),`ignore`);if(i.kind===`stale`)return;if(j(),i.kind===`done`){let{apiUsage:n,...r}=i.value;s(e,n),m({type:`result`,result:{state:`response`,request:t,response:r}});return}let c=i.error,l=sf(c,n);l.kind===`unknown`?(r(c),g(e=>[Rf(t),...e]),m({type:`result`,result:{state:`unknown`,request:t,message:C.restUnknown}})):l.kind===`elsewhere`?(a(e,c),m({type:`result`,result:{state:`idle`}})):(l.orgAuth&&o(e,l.reloginCommand),m({type:`result`,result:{state:`error`,request:t,message:l.message,details:l.details,reloginCommand:l.reloginCommand}}))},[b,e,j,s,r,a,o]),ee=(0,_.useCallback)(()=>{if(S)return;let e=Df(l.current);if(!e.path)return;let t=jf(e,{isProduction:i,history:h,historyLoaded:v});t.length>0?m({type:`confirm`,request:e,reasons:t}):M(e)},[S,i,h,v,M]),{confirming:N}=p,te=(0,_.useCallback)(()=>{N&&M(N.request)},[N,M]),ne=(0,_.useCallback)(()=>{x()&&(m({type:`cancelled`}),j())},[x,j]),re=(0,_.useCallback)(e=>{let t=kf(e);A(t,`now`),f.current?.setText(t.body)},[A]),ie=(0,_.useMemo)(()=>({...p,...u,initialBody:c.body,setMethod:e=>A({...l.current,method:e},`soon`),setPath:e=>A({...l.current,path:e},`soon`),setHeaders:e=>A({...l.current,headers:e},`soon`),registerBody:e=>{f.current=e},onBodyChange:e=>{e!==l.current.body&&(l.current={...l.current,body:e},k())},getBody:()=>l.current.body,setBody:e=>f.current?.setText(e),history:h,historyLoading:E,refreshHistory:()=>void j(),loadEntry:re,sending:S,sendingChangesData:S&&w===!0,send:ee,confirmSend:te,cancelConfirm:()=>m({type:`confirmCancelled`}),cancel:ne,closeNotice:()=>m({type:`noticeClosed`}),restLeftOutFor:t?.restLeftOutFor}),[p,u,c.body,A,k,h,E,j,re,S,w,ee,te,ne,t?.restLeftOutFor]);return(0,F.jsx)(Lf.Provider,{value:ie,children:n})}function Bf(){let e=(0,_.useContext)(Lf);if(!e)throw Error(`useRest must be used inside RestProvider`);return e}var Vf=(0,_.createContext)(void 0);function Hf(e){return{method:e.method,path:e.path,body:e.body??``}}function Uf({username:e,children:t}){let n=Bf(),r=ef(e),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(0),u=(0,_.useCallback)(e=>{s(e),e&&l(e=>e+1)},[]),d=n.result.state===`response`?n.result.response:void 0,[f,p]=(0,_.useState)(d);f!==d&&(p(d),s(!1));let m=n.path.trim()!==``,{availability:h,request:g,start:v,proposal:y,applied:b}=r,{getBody:x,setMethod:S,setPath:C,setBody:T}=n,E=(0,_.useCallback)(()=>{let t=g.trim();if(!t||h!==`ready`)return;let a=i&&m?Hf({method:n.method,path:n.path,body:x()}):void 0,c=o&&d?{status:d.status,body:Ct(d.body)}:void 0;c&&!r.running&&s(!1);let l={request:t,language:w,timeZone:$d(),...a?{current:a}:{},...c?{previous:c}:{}};v(async(t,n)=>{n(`think`);let{output:r}=await P.aiAgent(e,{task:`generateRest`,input:l},t);return{...r,fixing:!1}},x)},[g,h,i,m,o,d,r.running,n.method,n.path,x,e,v]),D=(0,_.useCallback)((t,n,r)=>{if(h!==`ready`)return;let i={sent:Hf(t),status:n,responseBody:Ct(r),language:w,timeZone:$d()};v(async(t,n)=>{n(`think`);let{output:r}=await P.aiAgent(e,{task:`fixRest`,input:i},t);return{...r,fixing:!0}},x)},[h,e,v,x]),O=(0,_.useCallback)(()=>{y&&(S(y.method),C(y.path),T(y.body),b())},[y,S,C,T,b]),k=(0,_.useMemo)(()=>({...r,hasCurrent:m,sendCurrent:i,setSendCurrent:a,hasPrevious:d!==void 0,sendPrevious:o,setSendPrevious:s,takeResult:u,attention:c,generate:E,fix:D,apply:O}),[r,m,i,d,o,u,c,E,D,O]);return(0,F.jsx)(Vf.Provider,{value:k,children:t})}function Wf(){let e=(0,_.useContext)(Vf);if(!e)throw Error(`useRestAi must be used inside RestAiProvider`);return e}var Gf=m();function Kf(e,t,n){let r=URL.createObjectURL(new Blob([e],{type:n})),i=document.createElement(`a`);i.href=r,i.download=t,document.body.append(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),6e4)}var qf=/\s*('(?:\\.|[^'\\\n])*'?|[\p{L}\p{N}_.]+|[^\s\p{L}\p{N}_.])/gu,Jf=1e6,Yf=.5,Xf=e=>[...e.matchAll(qf)].map(e=>({text:e[0],key:e[1].startsWith(`'`)?e[1]:e[1].toLowerCase()}));function Zf(e,t){let n=Xf(e),r=Xf(t);if(n.length*r.length>Jf)return;let i=(e,t)=>n[e].key===r[t].key,a=Array.from({length:n.length+1},()=>new Uint32Array(r.length+1));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)a[e][t]=i(e,t)?a[e+1][t+1]+1:Math.max(a[e+1][t],a[e][t+1]);if(r.length>0&&a[0][0]<r.length*Yf)return;let o=[],s=(e,t)=>{let n=o[o.length-1];n?.kind===t?n.text+=e:o.push({text:e,kind:t})},c=0,l=0;for(;c<n.length&&l<r.length;)i(c,l)?(s(r[l].text,`same`),c++,l++):a[c+1][l]>=a[c][l+1]?s(n[c++].text,`removed`):s(r[l++].text,`added`);for(;c<n.length;)s(n[c++].text,`removed`);for(;l<r.length;)s(r[l++].text,`added`);return o}var Qf=100;function $f(e,t){return e.isComposing||e.keyCode===229||Date.now()-t<Qf}var ep={bar:`_bar_1dye4_1`,row:`_row_1dye4_13`,request:`_request_1dye4_21`,model:`_model_1dye4_26`,setup:`_setup_1dye4_33`,send:`_send_1dye4_40`,sendFixed:`_sendFixed_1dye4_61`,sendMark:`_sendMark_1dye4_74`,busy:`_busy_1dye4_81`,"ai-sweep":`_ai-sweep_1dye4_1`,progress:`_progress_1dye4_101`,spinner:`_spinner_1dye4_110`,"ai-spin":`_ai-spin_1dye4_1`,error:`_error_1dye4_136`,card:`_card_1dye4_149`,proposal:`_proposal_1dye4_161`,added:`_added_1dye4_169`,removed:`_removed_1dye4_174`,explanation:`_explanation_1dye4_179`,actions:`_actions_1dye4_184`},K={panel:`_panel_pltqr_2`,header:`_header_pltqr_13`,title:`_title_pltqr_22`,body:`_body_pltqr_30`,empty:`_empty_pltqr_36`,search:`_search_pltqr_42`,input:`_input_pltqr_46`,button:`_button_pltqr_56`,primary:`_primary_pltqr_79`,meta:`_meta_pltqr_92`,mono:`_mono_pltqr_97`,spacer:`_spacer_pltqr_101`};function tp({session:e,stepText:t,onGenerate:n,placeholder:r,sends:i,attention:a=0}){let{setSettingsOpen:o}=he(),s=(0,_.useRef)(0),c=(0,_.useRef)(null),l=(0,_.useRef)(null);if((0,_.useEffect)(()=>{if(a===0)return;c.current?.focus(),c.current?.scrollIntoView?.({block:`nearest`});let e=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches,t={boxShadow:`inset 0 0 0 2px var(--color-accent)`,backgroundColor:`var(--color-accent-soft)`};l.current?.animate?.(e?[t,t]:[t,{...t,offset:.4},{boxShadow:`inset 0 0 0 2px transparent`}],{duration:1200,easing:`ease-out`})},[a]),e.availability===`hidden`)return null;if(e.availability===`setup`)return(0,F.jsx)(`div`,{className:ep.bar,"data-ai-bar":!0,children:(0,F.jsxs)(`div`,{className:ep.setup,children:[(0,F.jsx)(`span`,{children:C.aiOff}),(0,F.jsx)(`span`,{className:K.meta,children:C.aiSetUpNote}),(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:()=>o(!0),children:C.aiSetUp})]})});let{running:u,failure:d}=e;return(0,F.jsxs)(`div`,{ref:l,className:u?`${ep.bar} ${ep.busy}`:ep.bar,"data-ai-bar":!0,"aria-busy":u,children:[(0,F.jsxs)(`form`,{className:ep.row,onSubmit:e=>{e.preventDefault(),n()},children:[(0,F.jsx)(`input`,{ref:c,className:`${K.input} ${ep.request}`,"aria-label":C.aiRequestLabel,placeholder:r,value:e.request,readOnly:u,onChange:t=>e.setRequest(t.target.value),onKeyDown:e=>{e.key===`Enter`&&$f({isComposing:e.nativeEvent.isComposing,keyCode:e.keyCode},s.current)&&e.preventDefault()},onCompositionEnd:()=>s.current=Date.now()}),u?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{role:`status`,className:ep.progress,children:[(0,F.jsx)(`span`,{className:ep.spinner,"aria-hidden":`true`}),t]}),(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:e.cancel,children:C.cancel})]}):(0,F.jsx)(`button`,{type:`submit`,className:`${K.button} ${K.primary}`,disabled:!e.request.trim(),children:C.aiGenerate}),(0,F.jsx)(`span`,{className:`${K.meta} ${ep.model}`,title:e.label,children:e.label})]}),(0,F.jsxs)(`div`,{className:ep.row,children:[(0,F.jsx)(`span`,{className:K.meta,children:C.aiSends}),i]}),d&&(0,F.jsxs)(`div`,{role:`alert`,className:ep.error,children:[(0,F.jsx)(`span`,{children:d.message}),(0,F.jsx)(_t,{details:d.details})]})]})}function np(){let e=af();return(0,F.jsx)(tp,{session:e,stepText:e.step&&C.aiThinking,onGenerate:e.generate,placeholder:C.aiPlaceholder,sends:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(rp,{text:C.aiSendMetadata,title:e.panelObject?C.aiOpenObjectHint(e.panelObject):void 0}),e.hasEditorText&&(0,F.jsx)(ip,{text:C.aiEditorChip,checked:e.sendEditor,onChange:e.setSendEditor})]})})}function rp({text:e,title:t}){return(0,F.jsxs)(`span`,{className:ep.sendFixed,title:t,children:[(0,F.jsx)(ap,{}),e]})}function ip({text:e,title:t,checked:n,onChange:r}){return(0,F.jsxs)(`button`,{type:`button`,className:ep.send,"aria-pressed":n,title:t,onClick:()=>r(!n),children:[(0,F.jsx)(ap,{shown:n}),e]})}function ap({shown:e=!0}){return(0,F.jsx)(`span`,{className:ep.sendMark,"aria-hidden":`true`,children:e?`✓`:``})}function op({explanation:e,onDiscard:t,actions:n,children:r}){return(0,F.jsxs)(`section`,{className:ep.card,"aria-label":C.aiProposal,"data-ai-proposal":!0,children:[r,e&&(0,F.jsx)(`p`,{className:ep.explanation,children:e}),(0,F.jsxs)(`div`,{className:ep.actions,children:[(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:t,children:C.aiDiscard}),n]})]})}function sp({before:e,after:t,stale:n}){let r=(0,_.useMemo)(()=>e.trim()?Zf(e,t):void 0,[e,t]),i=n?void 0:r;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`pre`,{className:ep.proposal,children:i?i.map((e,t)=>(0,F.jsx)(`span`,{className:e.kind===`same`?void 0:ep[e.kind],children:e.text},t)):t}),n&&e.trim()&&(0,F.jsx)(`p`,{className:K.meta,children:C.aiDiffStale})]})}function cp(){let e=af(),{settledText:t}=Jd(),n=e.proposal;return n?(0,F.jsx)(op,{explanation:n.explanation,onDiscard:e.discard,actions:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:()=>e.apply(!1),children:C.aiReplace}),(0,F.jsx)(`button`,{type:`button`,className:`${K.button} ${K.primary}`,onClick:()=>e.apply(!0),children:C.aiReplaceRun})]}),children:(0,F.jsx)(sp,{before:n.before,after:n.soql,stale:t!==n.before})}):null}function lp({error:e,rejected:t}){let n=af();return n.availability===`ready`?(0,F.jsx)(`button`,{type:`button`,className:K.button,disabled:n.running,onClick:()=>n.fix(e,t),children:C.aiFix}):null}function up(){let e=wf();return(0,F.jsx)(tp,{session:e,stepText:e.step&&C.aiThinking,onGenerate:e.generate,placeholder:e.sendPrevious?C.aiPreviousPlaceholder:C.aiApexPlaceholder,attention:e.attention,sends:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(rp,{text:C.aiSendMetadata}),e.hasCode&&(0,F.jsx)(ip,{text:C.aiSendCurrentCode,checked:e.sendCode,onChange:e.setSendCode}),e.hasPrevious&&(0,F.jsx)(ip,{text:C.aiSendPrevious,title:C.aiSendPreviousHint,checked:e.sendPrevious,onChange:e.setSendPrevious})]})})}function dp(){let e=wf(),t=gf(),n=e.proposal;return n?(0,F.jsx)(op,{explanation:n.explanation,onDiscard:e.discard,actions:(0,F.jsx)(`button`,{type:`button`,className:`${K.button} ${K.primary}`,onClick:e.apply,children:C.aiReplace}),children:(0,F.jsx)(sp,{before:n.before,after:n.code,stale:t.getCode()!==n.before})}):null}function fp(){let e=wf(),{setOpen:t}=Ft();return e.availability!==`ready`||!e.hasPrevious?null:(0,F.jsx)(`button`,{type:`button`,className:K.button,"aria-pressed":e.sendPrevious,title:C.aiSendPreviousHint,onClick:()=>{e.sendPrevious||t(`apexEditor`,!0),e.takeResult(!e.sendPrevious)},children:e.sendPrevious?C.aiUsingResult:C.aiUseResult})}function pp(e){let t=wf();return t.availability!==`ready`||!e.problem?null:(0,F.jsx)(`button`,{type:`button`,className:K.button,disabled:t.running,title:C.aiSendError,onClick:()=>t.fix(e),children:C.aiFix})}var mp=[],hp=[];(()=>{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,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?hp:mp).push(n+=e[t])})();function gp(e){if(e<768)return!1;for(let t=0,n=mp.length;;){let r=t+n>>1;if(e<mp[r])n=r;else if(e>=hp[r])t=r+1;else return!0;if(t==n)return!1}}function _p(e){return e>=127462&&e<=127487}var vp=8205;function yp(e,t,n=!0,r=!0){return(n?bp:xp)(e,t,r)}function bp(e,t,n){if(t==e.length)return t;t&&Cp(e.charCodeAt(t))&&wp(e.charCodeAt(t-1))&&t--;let r=Sp(e,t);for(t+=Tp(r);t<e.length;){let i=Sp(e,t);if(r==vp||i==vp||n&&gp(i))t+=Tp(i),r=i;else if(_p(i)){let n=0,r=t-2;for(;r>=0&&_p(Sp(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function xp(e,t,n){for(;t>1;){let r=bp(e,t-2,n);if(r<t)return r;t--}return 0}function Sp(e,t){let n=e.charCodeAt(t);if(!wp(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Cp(r)?(n-55296<<10)+(r-56320)+65536:n}function Cp(e){return e>=56320&&e<57344}function wp(e){return e>=55296&&e<56320}function Tp(e){return e<65536?1:2}var Ep=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]=Ip(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),Op.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]=Ip(this,e,t);let n=[];return this.decompose(e,t,n,0),Op.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 Mp(this),i=new Mp(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 Mp(this,e)}iterRange(e,t=this.length){return new Np(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 Pp(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 Dp(t):Op.from(Dp.split(t,[]))}},Dp=class e extends Ep{constructor(e,t=kp(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 Fp(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(jp(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=Ap(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]=Ip(this,t,n);let i=Ap(this.text,Ap(r.text,jp(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):Op.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
|
191
|
+
`){[e,t]=Ip(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}},Op=class e extends Ep{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]=Ip(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=`
|
|
192
|
+
`){[e,t]=Ip(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 Dp(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 Dp&&c&&(n=u[u.length-1])instanceof Dp&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new Dp(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)}};Ep.empty=new Dp([``],0);function kp(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Ap(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 jp(e,t,n){return Ap(e,[``],t,n)}var Mp=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 Dp?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 Dp?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=`
|
|
193
|
+
`,this;e--}else if(r instanceof Dp){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 Dp?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)}},Np=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new Mp(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!=``}},Pp=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`&&(Ep.prototype[Symbol.iterator]=function(){return this.iter()},Mp.prototype[Symbol.iterator]=Np.prototype[Symbol.iterator]=Pp.prototype[Symbol.iterator]=function(){return this});var Fp=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 Ip(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Lp(e,t,n=!0,r=!0){return yp(e,t,n,r)}function Rp(e){return e>=56320&&e<57344}function zp(e){return e>=55296&&e<56320}function Bp(e,t){let n=e.charCodeAt(t);if(!zp(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Rp(r)?(n-55296<<10)+(r-56320)+65536:n}function Vp(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Hp(e){return e<65536?1:2}var Up=/\r\n?|\n/,Wp=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(Wp||={}),Gp=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){Yp(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:Zp(this,e)}mapDesc(e,t=!1){return e.empty?this:Xp(this,e,t)}mapPos(e,t=-1,n=Wp.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!=Wp.Simple&&c>=e&&(n==Wp.TrackDel&&r<e&&c>e||n==Wp.TrackBefore&&r<e||n==Wp.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)}},Kp=class e extends Gp{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 Yp(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return Xp(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(Ep.empty);r.push(a?t.slice(i,i+a):Ep.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:Zp(this,e,!0)}map(e,t=!1){return e.empty?this:Xp(this,e,t,!0)}iterChanges(e,t=!1){Yp(this,e,t)}get desc(){return Gp.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new Qp(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);qp(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;qp(n,e,t),t>0&&Jp(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);qp(n,e,-1),qp(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:Gp.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&&qp(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`?Ep.of(l.split(r||Up)):l:Ep.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&qp(i,e-o,-1),qp(i,s-e,d),Jp(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(Ep.empty);r[e]=Ep.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 qp(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 Jp(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(Ep.empty);e.push(n)}}function Yp(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=Ep.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 Xp(e,t,n,r=!1){let i=[],a=r?[]:null,o=new Qp(e),s=new Qp(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);qp(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(qp(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(qp(i,0,o.ins),a&&Jp(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;qp(i,t,e<o.i?o.ins:0),a&&e<o.i&&Jp(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?Kp.createSet(i,a):Gp.create(i);else throw Error(`Mismatched change set lengths`)}function Zp(e,t,n=!1){let r=[],i=n?[]:null,a=new Qp(e),o=new Qp(t);for(let e=!1;;)if(a.done&&o.done)return i?Kp.createSet(r,i):Gp.create(r);else if(a.ins==0)qp(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)qp(r,0,o.ins,e),i&&Jp(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;qp(r,t,n,e),i&&n&&Jp(i,r,o.text)}else o.ins==-1?(qp(r,a.off?0:a.len,t,e),i&&Jp(i,r,a.textBit(t))):(qp(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&Jp(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 Qp=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?Ep.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Ep.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)}},$p=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}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 undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null: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,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return q.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return q.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 q.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},q=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=>$p.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 $p.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let a=r==null?7:Math.min(6,r);return!i&&e!=t&&(i=t<e?1:-1),i&&(a|=i<0?8:16),t<e?$p.create(t,e,a|32,n):$p.create(e,t,a,n)}static undirectionalRange(e,t){return $p.create(e,t,64,void 0)}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 em(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var tm=0,J=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=tm++,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:nm),!!t.static,t.enables)}of(e){return new rm([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new rm(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new rm(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function nm(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var rm=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=tm++}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)||am(e,c)){let r=t(e);if(a?!im(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=vm(o,c);if(this.dependencies.every(t=>t instanceof J?o.facet(t)===e.facet(t):t instanceof cm?o.field(t,!1)==e.field(t,!1):!0)||(a?im(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}}}get extension(){return this}};function im(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 am(e,t){let n=!1;for(let r of t)_m(e,r)&1&&(n=!0);return n}function om(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=vm(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)_m(e,t);return e.values[o]=s(e),1},update(e,n){if(!am(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=am(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&nm(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 sm=J.define({static:!0}),cm=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(tm++,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(sm).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(sm),i=n.facet(sm),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,sm.of({field:this,create:e})]}get extension(){return this}},lm={lowest:4,low:3,default:2,high:1,highest:0};function um(e){return t=>new fm(t,e)}var dm={highest:um(lm.highest),high:um(lm.high),default:um(lm.default),low:um(lm.low),lowest:um(lm.lowest)},fm=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},pm=class e{of(e){return new mm(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},mm=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},hm=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 gm(t,n,o))e instanceof cm?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,nm(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=>om(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function gm(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 mm&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof mm){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 fm)a(e.inner,e.prec);else if(e instanceof cm)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof rm)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,lm.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)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,lm.default),r.reduce((e,t)=>e.concat(t))}function _m(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 vm(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var ym=J.define(),bm=J.define({combine:e=>e.some(e=>e),static:!0}),xm=J.define({combine:e=>e.length?e[0]:void 0,static:!0}),Sm=J.define(),Cm=J.define(),wm=J.define(),Tm=J.define({combine:e=>e.length?e[0]:!1}),Em=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Dm}},Dm=class{of(e){return new Em(this,e)}},Om=class{constructor(e){this.map=e}of(e){return new km(this,e)}},km=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 Om(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}};km.reconfigure=km.define(),km.appendConfig=km.define();var Am=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&&em(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]==`.`))}};Am.time=Em.define(),Am.userEvent=Em.define(),Am.addToHistory=Em.define(),Am.remote=Em.define();function jm(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 Mm(e,t,n){let r,i,a;return n?(r=t.changes,i=Kp.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:km.mapEffects(e.effects,r).concat(km.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Nm(e,t,n){let r=t.selection,i=Rm(t.annotations);return t.userEvent&&(i=i.concat(Am.userEvent.of(t.userEvent))),{changes:t.changes instanceof Kp?t.changes:Kp.of(t.changes||[],n,e.facet(xm)),selection:r&&(r instanceof q?r:q.single(r.anchor,r.head)),effects:Rm(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function Pm(e,t,n){let r=Nm(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=Mm(r,Nm(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=Am.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Im(n?Fm(i):i)}function Fm(e){let t=e.startState,n=!0;for(let r of t.facet(Sm)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:jm(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=Kp.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=Am.create(t,r,e.selection&&e.selection.map(i),km.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Cm);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof Am?i:Array.isArray(i)&&i.length==1&&i[0]instanceof Am?i[0]:Pm(t,Rm(i),!1)}return e}function Im(e){let t=e.startState,n=t.facet(wm),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=Mm(r,Nm(t,a,e.changes.newLength),!0))}return r==e?e:Am.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var Lm=[];function Rm(e){return e==null?Lm:Array.isArray(e)?e:[e]}var zm=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(zm||={}),Bm=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Vm;try{Vm=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function Hm(e){if(Vm)return Vm.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||Bm.test(n)))return!0}return!1}function Um(e){return t=>{if(!/\S/.test(t))return zm.Space;if(Hm(t))return zm.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return zm.Word;return zm.Other}}var Wm=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++)_m(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`)}else return _m(this,n),vm(this,n)}update(...e){return Pm(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(pm.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(km.reconfigure)?(n=null,r=e.value):e.is(km.appendConfig)&&(n=null,r=Rm(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=hm.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(bm)?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:q.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=Rm(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=km.mapEffects(a,c).concat(km.mapEffects(Rm(o.effects),l))}return{changes:r,selection:q.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof Kp?t:Kp.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return Ep.of(t.split(this.facet(e.lineSeparator)||Up))}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:(_m(this,t),vm(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 cm&&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:q.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=hm.resolve(t.extensions||[],new Map),r=t.doc instanceof Ep?t.doc:Ep.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||Up)),i=t.selection?t.selection instanceof q?t.selection:q.single(t.selection.anchor,t.selection.head):q.single(0);return em(i,r.length),n.staticFacet(bm)||(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)||`
|
|
194
|
+
`}get readOnly(){return this.facet(Tm)}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(ym))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 Um(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=Lp(t,a,!1);if(i(t.slice(e,a))!=zm.Word)break;a=e}for(;o<r;){let e=Lp(t,o);if(i(t.slice(o,e))!=zm.Word)break;o=e}return a==o?null:q.range(a+n,o+n)}};Wm.allowMultipleSelections=bm,Wm.tabSize=J.define({combine:e=>e.length?e[0]:4}),Wm.lineSeparator=xm,Wm.readOnly=Tm,Wm.phrases=J.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])}}),Wm.languageData=ym,Wm.changeFilter=Sm,Wm.transactionFilter=Cm,Wm.transactionExtender=wm,pm.reconfigure=km.define();function Gm(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 Km=class{eq(e){return this==e}range(e,t=e){return Jm.create(e,t,this)}};Km.prototype.startSide=Km.prototype.endSide=0,Km.prototype.point=!1,Km.prototype.mapMode=Wp.TrackDel;function qm(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var Jm=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 Ym(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var Xm=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return Qm(this.to)}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,r,i,a){let o=[],s=[],c=[],l=-1,u=-1;iter:for(let e=0;e<this.value.length;e++){let d=this.value[e],f=this.from[e]+t,p=this.to[e]+t,m,h;if(f==p){let e=n.mapPos(f,d.startSide,d.mapMode);if(e==null||(m=h=e,d.startSide!=d.endSide&&(h=n.mapPos(f,d.endSide),h<m)))continue}else if(m=n.mapPos(f,d.startSide),h=n.mapPos(p,d.endSide),m>h||m==h&&d.startSide>0&&d.endSide<=0)continue;if(!((h-m||d.endSide-d.startSide)<0)){if(l<0&&(l=m),d.point&&(u=Math.max(u,h-m)),(m-r||d.startSide-i)>=0)o.push(d),s.push(m-l),c.push(h-l),r=h,i=d.endSide;else{if(m==h)for(let e=o.length;e>0;e--){if((m-(c[e-1]+l)||d.startSide-o[e-1].endSide)>=0){o.splice(e,0,d),s.splice(e,0,m-l),c.splice(e,0,h-l);continue iter}if((m-(s[e-1]+l)||d.endSide-o[e-1].startSide)>0)break}a(m,h,d)}}}return{mapped:o.length?new e(s,c,o,u):null,pos:l}}},Zm=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(Ym)),this.isEmpty)return n.length?e.of(n):this;let s=new nh(this,null,-1).goto(0),c=0,l=[],u=new eh;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,!1)||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,!1)||l.push(Jm.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,a,o=(e,t,n)=>{a||=new eh,a.addRange(e,t,n,!1)};for(let e=0;e<this.chunk.length;e++){let a=this.chunkPos[e],s=this.chunk[e],c=t.touchesRange(a,a+s.length);if(c===!1)i=Math.max(i,s.maxPoint),n.push(s),r.push(t.mapPos(a));else if(c===!0){let[e,c]=n.length?[Qm(r)+Qm(n).length,Qm(Qm(n).value).endSide]:[-1,-1],{mapped:l,pos:u}=s.map(a,t,e,c,o);l&&(i=Math.max(i,l.maxPoint),n.push(l),r.push(u))}}let s=this.nextLayer.map(t);return a&&(s=a.finishInner(s)),n.length==0?s:new e(r,n,s||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 rh.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return rh.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=th(a,o,n),c=new ah(a,s,i),l=new ah(o,s,i);n.iterGaps((e,t,n)=>oh(c,e,l,t,n,r)),n.empty&&n.length==0&&oh(c,0,l,0,0,r)}static eq(e,t,n=0,r){r??=1e9-1;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=th(i,a),s=new ah(i,o,0).goto(n),c=new ah(a,o,0).goto(n);for(;;){if(s.to!=c.to||!sh(s.active,c.active)||s.point&&(!c.point||!qm(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 ah(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 eh;for(let r of e instanceof Jm?[e]:t?$m(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=Qm(t);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}};Zm.empty=new Zm([],[],null,-1);function Qm(e){return e[e.length-1]}function $m(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(Ym(t,r)>0)return e.slice().sort(Ym);t=r}return e}Zm.empty.nextLayer=Zm.empty;var eh=class e{finishChunk(e){this.chunks.push(new Xm(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(e,t,n){this.addRange(e,t,n,!0)}addRange(t,n,r,i){this.addInner(t,n,r,i)||(this.nextLayer||=new e).addRange(t,n,r,i)}addInner(e,t,n,r){let i=e-this.lastTo||n.startSide-this.last.endSide;if(r&&i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");return i<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(Zm.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Zm.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function th(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 nh=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}},rh=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 nh(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--)ih(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--)ih(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(),ih(this.heap,0)}}};function ih(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 ah=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=rh.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){ch(this.active,e),ch(this.activeTo,e),ch(this.activeRank,e),this.minActive=uh(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++;lh(this.active,t,n),lh(this.activeTo,t,r),lh(this.activeRank,t,i),e&&lh(e,t,this.cursor.from),this.minActive=uh(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&&ch(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 oh(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&&qm(e.point,n.point)&&sh(e.activeForPoint(e.to),n.activeForPoint(n.to))||a.comparePoint(s,d,e.point,n.point),t=!1):(t&&=(a.boundChange(s),!1),d>s&&!sh(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 sh(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!qm(e[n],t[n]))return!1;return!0}function ch(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function lh(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function uh(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 dh(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=Lp(e,i));return r}function fh(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=Lp(e,r)}return r===!0?-1:e.length}for(var ph=`ͼ`,mh=typeof Symbol>`u`?`__ͼ`:Symbol.for(ph),hh=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),gh=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},_h=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(`
|
|
195
|
+
`)}static newName(){let e=gh[mh]||1;return gh[mh]=e+1,ph+e.toString(36)}static mount(e,t,n){let r=e[hh],i=n&&n.nonce;r?i&&r.setNonce(i):r=new yh(e,i),r.mount(Array.isArray(t)?t:[t],e)}},vh=new Map,yh=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=vh.get(n);if(t)return e[hh]=t;this.sheet=new r.CSSStyleSheet,vh.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[hh]=this}mount(e,t){let n=this.sheet,r=0,i=0,a=!1;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),a=!0,i--,s=-1),s==-1){if(this.modules.splice(i++,0,o),a=!0,n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(a){let e=``;for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+`
|
|
196
|
+
`;this.styleTag.textContent=e}let e=t.head||t;this.styleTag.parentNode!=e&&e.insertBefore(this.styleTag,e.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute(`nonce`)!=e&&this.styleTag.setAttribute(`nonce`,e)}},bh={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:`'`},xh={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},Sh=typeof navigator<`u`&&/Mac/.test(navigator.platform),Ch=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),wh=0;wh<10;wh++)bh[48+wh]=bh[96+wh]=String(wh);for(var wh=1;wh<=24;wh++)bh[wh+111]=`F`+wh;for(var wh=65;wh<=90;wh++)bh[wh]=String.fromCharCode(wh+32),xh[wh]=String.fromCharCode(wh);for(var Th in bh)xh.hasOwnProperty(Th)||(xh[Th]=bh[Th]);function Eh(e){var t=!(Sh&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Ch&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?xh:bh)[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}var Dh=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},Oh=typeof document<`u`?document:{documentElement:{style:{}}},kh=/Edge\/(\d+)/.exec(Dh.userAgent),Ah=/MSIE \d/.test(Dh.userAgent),jh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dh.userAgent),Mh=!!(Ah||jh||kh),Nh=!Mh&&/gecko\/(\d+)/i.test(Dh.userAgent),Ph=!Mh&&/Chrome\/(\d+)/.exec(Dh.userAgent),Fh=`webkitFontSmoothing`in Oh.documentElement.style,Ih=!Mh&&/Apple Computer/.test(Dh.vendor),Lh=Ih&&(/Mobile\/\w+/.test(Dh.userAgent)||Dh.maxTouchPoints>2),Y={mac:Lh||/Mac/.test(Dh.platform),windows:/Win/.test(Dh.platform),linux:/Linux|X11/.test(Dh.platform),ie:Mh,ie_version:Ah?Oh.documentMode||6:jh?+jh[1]:kh?+kh[1]:0,gecko:Nh,gecko_version:Nh?+(/Firefox\/(\d+)/.exec(Dh.userAgent)||[0,0])[1]:0,chrome:!!Ph,chrome_version:Ph?+Ph[1]:0,ios:Lh,android:/Android\b/.test(Dh.userAgent),webkit:Fh,webkit_version:Fh?+(/\bAppleWebKit\/(\d+)/.exec(Dh.userAgent)||[0,0])[1]:0,safari:Ih,safari_version:Ih?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Dh.userAgent)||[0,0])[1]:0,tabSize:Oh.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function Rh(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 zh=Object.create(null);function Bh(e,t,n){if(e==t)return!0;e||=zh,t||=zh;let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function Vh(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 Hh(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 Uh(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 Wh=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){}},Gh=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(Gh||={}),Kh=class extends Km{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 qh(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 Yh(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}=Xh(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new Yh(e,n,r,t,e.widget||null,!0)}static line(e){return new Jh(e)}static set(e,t=!1){return Zm.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};Kh.none=Zm.empty;var qh=class e extends Kh{constructor(e){let{start:t,end:n}=Xh(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?Rh(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||zh}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&Bh(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};qh.prototype.point=!1;var Jh=class e extends Kh{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&Bh(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)}};Jh.prototype.mapMode=Wp.TrackBefore,Jh.prototype.point=!0;var Yh=class e extends Kh{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?Wp.TrackBefore:Wp.TrackAfter:Wp.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?Gh.WidgetBefore:Gh.WidgetAfter:Gh.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&Zh(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)}};Yh.prototype.point=!0;function Xh(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function Zh(e,t){return e==t||!!(e&&t&&e.compare(t))}function Qh(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 $h=class e extends Km{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&Bh(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||zh,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return Zm.of(e,t)}};$h.prototype.startSide=$h.prototype.endSide=-1;var eg=e=>e.nodeType==1,tg=e=>e.nodeType==3;function ng(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function rg(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function ig(e,t){if(!t.anchorNode)return!1;try{return rg(e,t.anchorNode)}catch{return!1}}function ag(e){return tg(e)?Sg(e,0,e.nodeValue.length).getClientRects():eg(e)?e.getClientRects():[]}function og(e,t,n,r){return n?lg(e,t,n,r,-1)||lg(e,t,n,r,1):!1}function sg(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function cg(e){return eg(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function lg(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ug(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!eg(n))return!1;t=sg(e)+(i<0?0:1),e=n}else if(eg(e)){if(e=e.childNodes[t+(i<0?-1:0)],eg(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?ug(e):0}else return!1}}function ug(e){return tg(e)?e.nodeValue.length:e.childNodes.length}function dg(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function fg(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 pg(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 mg(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(eg(u)){let e,f=u==c.body,p=1,m=1;if(f)e=fg(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}=pg(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 hg(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(eg(a))!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 gg=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?ug(t):0),n,Math.min(e.focusOffset,n?ug(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function _g(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)eg(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function vg(e,t=!0){for(let{node:n,left:r,top:i}of e)t&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}var yg=null;Y.safari&&Y.safari_version>=26&&(yg=!1);function bg(e){if(e.setActive)return e.setActive();if(yg)return e.focus(yg);let t=_g(e);e.focus(yg==null?{get preventScroll(){return yg={preventScroll:!0},!0}}:void 0),yg||(yg=!1,vg(t))}var xg;function Sg(e,t,n=t){let r=xg||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function Cg(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 wg(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function Tg(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,ug(n));;)if(r){if(!eg(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=ug(n))}else if(n==e)return!0;else r=sg(n),n=n.parentNode}function Eg(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 Dg(e,t){for(let n=e,r=t;;)if(tg(n)&&r>0)return{node:n,offset:r};else if(eg(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=ug(n)}else if(n.parentNode&&!cg(n))r=sg(n),n=n.parentNode;else return null}function Og(e,t){for(let n=e,r=t;;)if(tg(n)&&r<n.nodeValue.length)return{node:n,offset:r};else if(eg(n)&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!cg(n))r=sg(n)+1,n=n.parentNode;else return null}var kg=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,sg(t),n)}static after(t,n){return new e(t.parentNode,sg(t)+1,n)}},Ag=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(Ag||={}),jg=Ag.LTR,Mg=Ag.RTL;function Ng(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var Pg=Ng(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),Fg=Ng(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),Ig=Object.create(null),Lg=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Ig[t]=n,Ig[n]=-t}function Rg(e){return e<=247?Pg[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Fg[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var zg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Bg=class{get dir(){return this.level%2?Mg:jg}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 Vg(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||!Vg(r.inner,i.inner))return!1}return!0}var Hg=[];function Ug(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=Rg(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),Hg[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=Hg[e];if(i==128)e<s-1&&t==Hg[e+1]&&t&24?i=Hg[e]=t:Hg[e]=256;else if(i==64){let i=e+1;for(;i<s&&Hg[i]==64;)i++;let a=e&&t==8||i<n&&Hg[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)Hg[t]=a;e=i-1}else i==8&&r==1&&(Hg[e]=1);t=i,i&7&&(r=i)}}}function Wg(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=Ig[n=e.charCodeAt(t)]){if(r<0){for(let e=s-3;e>=0;e-=3)if(Lg[e+1]==-r){let n=Lg[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(Hg[t]=Hg[Lg[e]]=r),s=e;break}}else if(Lg.length==189)break;else Lg[s++]=t,Lg[s++]=n,Lg[s++]=c}else if((o=Hg[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=Lg[t+2];if(n&2)break;if(e)Lg[t+2]|=2;else{if(n&4)break;Lg[t+2]|=4}}}}}function Gg(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=Hg[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(Hg[o]==256)o++;else break;let l=a==1,u=l==((o<t?Hg[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),Hg[--t]=u;c=o}else a=o,c++}}}function Kg(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=Hg[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(Hg[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new Bg(c,m.from,f)),qg(e,m.direction==jg==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?Hg[p]!=s:Hg[p]==s))break;else p++;d?Kg(e,c,p,r+1,i,d,o):c<p&&o.push(new Bg(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=Hg[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(Hg[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new Bg(m.to,c,f)),qg(e,m.direction==jg==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?Hg[p-1]!=s:Hg[p-1]==s))break;else p--;d?Kg(e,p,c,r+1,i,d,o):p<c&&o.push(new Bg(p,c,f)),c=p}}function qg(e,t,n,r,i,a,o){let s=t%2?2:1;Ug(e,i,a,r,s),Wg(e,i,a,r,s),Gg(i,a,r,s),Kg(e,i,a,t,n,r,o)}function Jg(e,t,n){if(!e)return[new Bg(0,0,+(t==Mg))];if(t==jg&&!n.length&&!zg.test(e))return Yg(e.length);if(n.length)for(;e.length>Hg.length;)Hg[Hg.length]=256;let r=[],i=t==jg?0:1;return qg(e,i,i,n,0,e.length,r),r}function Yg(e){return[new Bg(0,e,0)]}var Xg=``;function Zg(e,t,n,r,i){if(!e.length)return null;let a=r.head-e.from,o;if(r.head==e.from&&r.assoc<0){if(!i)return null;a=t[o=0].side(!1,n)}else if(r.head==e.to&&r.assoc>0){if(i)return null;a=t[o=t.length-1].side(!0,n)}else o=Bg.find(t,a,r.bidiLevel??-1,r.assoc);let 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=Lp(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),Xg=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)];if(l==c){if(!u)return i?q.cursor(e.to,1):q.cursor(e.from,-1);if(u.level+ +!i<s.level)return q.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level)}return q.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function Qg(e,t,n){for(let r=t;r<n;r++){let t=Rg(e.charCodeAt(r));if(t==1)return jg;if(t==2||t==4)return Mg}return jg}var $g=J.define(),e_=J.define(),t_=J.define(),n_=J.define(),r_=J.define(),i_=J.define(),a_=J.define(),o_=J.define(),s_=J.define(),c_=J.define({combine:e=>e.some(e=>e)}),l_=J.define({combine:e=>e.some(e=>e)}),u_=J.define(),d_=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(q.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},f_=km.define({map:(e,t)=>e.map(t)}),p_=km.define();function m_(e,t,n){let r=e.facet(n_);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 h_=J.define({combine:e=>!e.length||e[0]}),g_=0,__=J.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})}}),v_=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(__.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(__.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(g_++,t,r,i,e=>{let t=[];return o&&t.push(S_.of(t=>{let n=t.plugin(e);return n?o(n):Kh.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},y_=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){m_(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(m_(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){m_(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},b_=J.define(),x_=J.define(),S_=J.define(),C_=J.define(),w_=J.define(),T_=J.define(),E_=J.define();function D_(e,t){let n=e.state.facet(E_);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return Zm.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??=Qg(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 O_=J.define();function k_(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(O_)){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 A_=J.define(),j_=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}},M_=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Kp.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 j_(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}},N_=[],P_=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 N_}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&&Vh(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,n){return null}domPosFor(e,t){let n=sg(this.dom),r=this.length?e>0:t>0;return new kg(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 L_)return e;return null}static get(e){return e.cmTile}},F_=class extends P_{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=I_(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=I_(r);this.length=a}};function I_(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var L_=class extends F_{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=P_.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 R_)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}}},R_=class e extends F_{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}},z_=class e extends F_{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=!1){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||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&V_(a,d)))&&(f>c||d.flags&32&&t<=1)?(a=d,o=c-u):(u<c||d.flags&16&&!(n&&d.isHidden)&&t>=-1)&&(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,n){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,n):B_(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 kg(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 kg(e.dom,0);e==n.tile&&(a=!0)}}return new kg(this.dom,0)}};function B_(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=ag(t);return n[n.length-1]||null}function V_(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var H_=class e extends F_{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}},U_=class e extends P_{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,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,a=e,o=0;e==0&&t<0||e==r&&t>=0?Y.chrome||Y.gecko||(e?(i--,o=1):a<r&&(a++,o=-1)):t<0?i--:a<r&&a++;let s=Sg(this.dom,i,a).getClientRects();if(!s.length)return null;let c=s[(o?o<0:t>=0)?0:s.length-1];return Y.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:dg(c,(o?o>0:t<0)==n)}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},W_=class e extends P_{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 dg(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 dg(n,!r)}}get overrideDOMText(){if(!this.length)return Ep.empty;let{root:e}=this;if(!e)return Ep.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)}},G_=class extends P_{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 Ep.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:dg(r,t>0==n)}},K_=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()){let t=r.length;if(i<t&&e){let a=Math.min(e,t-i);n&&n.skip(r,i,i+a),e-=a,i+=a}if(i==t)a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++;else if(!e)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}},q_=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},J_=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 U_(a.dom,a.text+e);t.parent=i}else i.append(r||U_.of(e,this.cache.find(U_)?.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)?iv(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 H_&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(iv(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&P_.get(n.dom)&&(e=iv(n.dom));let t=H_.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=P_.get(e.text);i&&this.cache.reused.set(i,2);let a=new U_(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||=tv;let n=z_.start(e,t||this.cache.find(z_)?.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 H_&&a.mark.eq(i))n=a,t--;else{let e=H_.of(i,this.cache.find(H_,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||!$_(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(Y.ios&&$_(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(ov,0,32)||new W_(ov.toDOM(),0,ov,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=e.rank*102+e.value.rank,n=new q_(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}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 R_&&n.wrapper.eq(t.wrapper))e=n;else{let n=R_.of(t.wrapper,this.cache.find(R_,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(G_,void 0,1);return n&&(n.flags=t),n||new G_(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},Y_=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}},X_=[W_,z_,U_,H_,G_,R_,L_];for(let e=0;e<X_.length;e++)X_[e].bucket=e;var Z_=class{constructor(e){this.view=e,this.buckets=X_.map(()=>[]),this.index=X_.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=0;e<i.length;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 W_(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}},Q_=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 Z_(e),this.text=new Y_(e.state.doc),this.builder=new J_(this.cache,new L_(e,e.contentDOM),Zm.iter(n)),this.cache.reused.set(t,2),this.old=new K_(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.builder.flushBuffer(),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=rv(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?W_.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 G_)this.cache.add(e);else if(e instanceof H_)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 H_&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof H_&&(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=-1,a=Zm.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof Yh){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?av.block:av.inline),c=ev(a),l=this.cache.findWidget(i,t-e,c)||W_.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=nv(n,a);t>e&&this.text.skip(t-e)},span:(e,t,a,o)=>{for(let i=e;i<t;){let s=this.text.next(Math.min(512,t-i));s==null?(r.addLineStartIfNotCovered(n),r.addBreak(),i++):(r.ensureLine(n),r.addText(s,a,i==e?o:a.length),i+=s.length),n=null}i=a.length}});i>-1&&(this.openWidget=a>i),this.openWidget||r.addLineStartIfNotCovered(n),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=P_.get(r);if(r==this.view.contentDOM)break;e instanceof H_?t.push(e):e?.isLine()?n=e:e instanceof R_||(r.nodeName==`DIV`&&!n?n=new z_(r,tv):n||t.push(H_.of(new qh({tagName:r.nodeName.toLowerCase(),attributes:Uh(r)}),r)))}return n?{line:n,marks:t}:null}};function $_(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 ev(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 tv={class:`cm-line`};function nv(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||={class:`cm-line`},n&&Rh(n,e),r&&(e.class+=` `+r)),e}function rv(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 H_&&t.push(r.mark)}return t}function iv(e){let t=P_.get(e);return t&&t.setDOM(e.cloneNode()),e}var av=class extends Wh{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}};av.inline=new av(`span`),av.block=new av(`div`);var ov=new class extends Wh{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},sv=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Kh.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 L_(e,e.contentDOM),this.updateInner([new j_(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:!vv(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?dv(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new j_(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,(Y.ie||Y.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=mv(i,this.decorations,e.changes);o.length&&(t=j_.extendWithRanges(t,o));let s=gv(a,this.blockWrappers,e.changes);return s.length&&(t=j_.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 Q_(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&P_.get(t.text)&&r.cache.reused.set(P_.get(t.text),2),this.tile=r.run(e,t),cv(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=Y.chrome||Y.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 yv&&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(p_)&&(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(h_)||n.tabIndex>-1)&&ig(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)),Y.gecko&&s.empty&&!this.hasComposition&&lv(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new kg(e,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!og(c.node,c.offset,u.anchorNode,u.anchorOffset)||!og(l.node,l.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,s))&&(this.view.observer.ignore(()=>{Y.android&&Y.chrome&&n.contains(u.focusNode)&&_v(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=ng(this.view.root);if(e){if(s.empty){if(Y.gecko){let e=fv(c.node,c.offset);if(e&&e!=3){let t=(e==1?Dg:Og)(c.node,c.offset);t&&(c=new kg(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 kg(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new kg(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&og(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=ng(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=ug(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&&!P_.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(r,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,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof yv?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t,n)}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=Lp(e.text,t);if(n==t)return null;let r=Sg(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==Ag.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 R_)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?ag(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`?Ag.RTL:Ag.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=ag(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=ag(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(Kh.replace({widget:new yv(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return Kh.set(e)}updateDeco(){let e=1,t=this.view.state.facet(S_).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(w_).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(Zm.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(C_).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(u_))try{if(t(this.view,e.range,e))return!0}catch(e){m_(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(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=k_(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(mg(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==Ag.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(t.head,1);if(e){let t=_g(e.dom);e.dom.scrollIntoView({block:`nearest`}),vg(t,!1)}}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){cv(this.tile)}};function cv(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)cv(n,t)}}function lv(e){return eg(e.node)&&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 uv(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Dg(n.focusNode,n.focusOffset),i=Og(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=P_.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=P_.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 dv(e,t,n){let r=uv(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 j_(c.mapPos(a),c.mapPos(o),a,o),text:i}}function fv(e,t){return eg(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var pv=class{constructor(){this.changes=[]}compareRange(e,t){Qh(e,t,this.changes)}comparePoint(e,t){Qh(e,t,this.changes)}boundChange(e){Qh(e,e,this.changes)}};function mv(e,t,n){let r=new pv;return Zm.compare(e,t,n,r),r.changes}var hv=class{constructor(){this.changes=[]}compareRange(e,t){Qh(e,t,this.changes)}comparePoint(){}boundChange(e){Qh(e,e,this.changes)}};function gv(e,t,n){let r=new hv;return Zm.compare(e,t,n,r),r.changes}function _v(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(eg(n)&&n.contentEditable==`false`)return!0;return!1}function vv(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var yv=class extends Wh{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 bv(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return q.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=Lp(i.text,a,!1):s=Lp(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=Lp(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=Lp(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return q.undirectionalRange(o+i.from,s+i.from)}function xv(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+fh(o,a,e.state.tabSize)}function Sv(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==Gh.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function Cv(e,t,n,r){let i=Sv(e,t.head,t.assoc||-1),a=!r||i.type!=Gh.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==Ag.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o!=null)return q.cursor(o,n?-1:1)}return q.cursor(n?i.to:i.from,n?-1:1)}function wv(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=Zg(i,a,o,s,n),l=Xg;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`
|
|
197
|
+
`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=n?q.cursor(i.from,-1):q.cursor(i.to,1)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function Tv(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==zm.Space&&(i=t),i==t}}function Ev(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return q.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=jv(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return q.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 q.cursor(i.pos,i.assoc,void 0,o)}}function Dv(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 Ov(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=Dv(e,i.from,0);t!=i.from&&(a=q.cursor(t,-1))}else{let t=Dv(e,i.from,-1),n=Dv(e,i.to,1);(t!=i.from||n!=i.to)&&(a=i.undirectional?q.undirectionalRange(i.from,i.to):q.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?q.create(n,t.mainIndex):t}function kv(e,t,n){let r=Dv(e.state.facet(T_).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:q.cursor(r,r<n.from?1:-1)}var Av=class{constructor(e,t){this.pos=e,this.assoc=t}};function jv(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 Av(0,1);if(c>e.viewState.docHeight)return new Av(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==Gh.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==Gh.Text){let t=xv(e,i,l,o,s);return new Av(t,t==l.from?1:-1)}}if(l.type!=Gh.Text)return c<(l.top+l.bottom)/2?new Av(l.from,1):new Av(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 Mv(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var Mv=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[Bg.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Bg.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)){for(let e=1;e<n;e++){let t=f+e;if(t>=i&&(t-=n),!a.has(t)){f=t;break adjust}}break search}a.add(f);let p=t(f),m=0;if(p)for(let e=0;e<p.length;e++){let t=p[e];if(!(t.width==0&&p.length>1)){if(t.bottom<this.y)(!s||s.bottom<t.bottom)&&(s=t),m=1;else if(t.top>this.y)(!c||c.top>t.top)&&(c=t),m=-1;else{let e=t.left>this.x?this.x-t.left:t.right<this.x?this.x-t.right:0,n=Math.abs(e);n<u&&(l=f,u=n,d=t),e&&(m=e<0==(this.baseDir==Ag.LTR)?-1:1)}}}m==-1&&(!o||this.baseDirAt(e[f],1))?i=f:m==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}if(!d){if(!c&&!s)return{i:0,after:!1};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)==Ag.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=Lp(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 Sg(e.dom,i,a).getClientRects()});return r.after?new Av(n[r.i+1],-1):new Av(n[r.i],1)}scanTile(e,t){if(!e.length)return new Av(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:(eg(n.dom)?n.dom:Sg(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 Av(n[r.i+1],-1):new Av(a,1)}},Nv=``,Pv=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(Wm.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Nv}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=P_.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=P_.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:cg(r))||cg(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!Iv(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=P_.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 tg(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():eg(e)&&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)(tg(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Fv(e,n.node,n.offset)?t:0))}};function Fv(e,t,n){for(;;){if(!t||n<ug(t))return!1;if(t==e)return!0;n=sg(t)+1,t=t.parentNode}}function Iv(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=P_.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 Lv=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},Rv=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=zv(e.docView.tile,t,n,0))){let t=i||a?[]:Wv(e),n=new Pv(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=Gv(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!rg(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!rg(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((Y.ios||Y.chrome)&&n!=r&&Math.min(n,r)<=o.main.from&&Math.max(n,r)>=o.main.to&&(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(q.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=q.create([q.cursor(n,r)])}else this.newSel=q.single(r,n)}}};function zv(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 zv(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}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function Bv(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||Y.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,Nv),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:Ep.of(t.text.slice(a.from-e,u).split(Nv))}:(d=Uv(l,t.text,s-e,c))&&(Y.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==``&&d.toB--,n={from:e+d.from,to:e+d.toA,insert:Ep.of(t.text.slice(d.from,d.toB).split(Nv))})}else r&&(!e.hasFocus&&i.facet(h_)||Kv(r,a))&&(r=null);if(!n&&!r)return!1;if((Y.mac||Y.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=q.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Ep.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)}:Y.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
|
|
198
|
+
`&&e.lineWrapping&&(r&&=q.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:Ep.of([` `])}),n)return Vv(e,n,r,o);if(r&&!Kv(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=Ov(i.facet(T_).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function Vv(e,t,n,r=-1){if(Y.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(Y.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&&Cg(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)&&Cg(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&Cg(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=Hv(e,t,n);return e.state.facet(i_).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function Hv(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=Dv(i.facet(T_).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:q.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&&uv(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?q.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 Uv(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 Wv(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 Lv(n,r)),(i!=n||a!=r)&&t.push(new Lv(i,a))),t}function Gv(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n<0||r<0?null:n==r?q.create([q.cursor(r+t,-1)]):q.single(n+t,r+t)}function Kv(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var qv=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,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.lastIOSMomentumScroll=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,Y.safari&&e.contentDOM.addEventListener(`input`,()=>null),Y.gecko&&Ay(e.contentDOM.ownerDocument)}handleEvent(e){sy(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=Xv(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&&$v.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Y.android&&Y.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Y.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(Zv.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||Qv.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&Y.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&Jv(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key==`Enter`&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Cg(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Y.safari&&!Y.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 Jv(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function Yv(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){m_(n.state,e)}}}function Xv(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(Yv(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(Yv(t.value,r))}}for(let e in cy)n(e).handlers.push(cy[e]);for(let e in ly)n(e).observers.push(ly[e]);return t}var Zv=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],Qv=`dthko`,$v=[16,17,18,20,91,92,224,225],ey=6;function ty(e){return Math.max(0,e)*.7+8}function ny(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var ry=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=hg(e.contentDOM),this.atoms=e.state.facet(T_).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(Wm.allowMultipleSelections)&&iy(e,t),this.dragging=oy(e,t)&&yy(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&&ny(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=k_(this.view);e.clientX-s.left<=r+ey?t=-ty(r-e.clientX):e.clientX+s.right>=a-ey&&(t=ty(e.clientX-a)),e.clientY-s.top<=i+ey?n=-ty(i-e.clientY):e.clientY+s.bottom>=o-ey&&(n=ty(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=Ov(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 iy(e,t){let n=e.state.facet($g);return n.length?n[0](t):Y.mac?t.metaKey:t.ctrlKey}function ay(e,t){let n=e.state.facet(e_);return n.length?n[0](t):Y.mac?!t.altKey:!t.ctrlKey}function oy(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=ng(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 sy(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=P_.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var cy=Object.create(null),ly=Object.create(null),uy=Y.ie&&Y.ie_version<15||Y.ios&&Y.webkit_version<604;function dy(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(),py(e,n.value)},50)}function fy(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function py(e,t){t=fy(e.state,o_,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(Ty!=null&&n.selection.ranges.every(e=>e.empty)&&Ty==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:q.cursor(r.from+c.length,-1)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:q.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}ly.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,Y.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},ly.wheel=ly.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},cy.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),ly.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},ly.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},ly.touchend=(e,t)=>{e.inputState.touchActive=!1},cy.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(t_))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=by(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new ry(e,t,n,r)),r&&e.observer.ignore(()=>{bg(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 my(e,t,n,r){if(r==1)return q.cursor(t,n);if(r==2)return bv(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++,q.undirectionalRange(a,o)}}var hy=Y.ie&&Y.ie_version<=11,gy=null,_y=0,vy=0;function yy(e){if(!hy)return e.detail;let t=gy,n=vy;return gy=e,vy=Date.now(),_y=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(_y+1)%3:1}function by(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=yy(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=my(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=my(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?q.range(i,a,l.assoc):q.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=xy(i,s.pos))?c:o?i.addRange(l):q.create([l])}}}function xy(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 q.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}cy.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=q.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,fy(e.state,s_,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},cy.dragend=e=>(e.inputState.draggedContent=null,!1);function Sy(e,t,n,r){if(n=fy(e.state,o_,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&ay(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}cy.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&&Sy(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}{let n=t.dataTransfer.getData(`Text`);if(n)return Sy(e,t,n,!0),!0}return!1},cy.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=uy?null:t.clipboardData;return n?(py(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(dy(e),!1)};function Cy(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 wy(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:fy(e,s_,t.join(e.lineBreak)),ranges:n,linewise:r}}var Ty=null;cy.copy=cy.cut=(e,t)=>{if(!ig(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=wy(e.state);if(!n&&!i)return!1;Ty=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=uy?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(Cy(e,n),!1)};var Ey=Em.define();function Dy(e,t){let n=[];for(let r of e.facet(a_)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Ey.of(!0)}):null}function Oy(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Dy(e.state,t);n?e.dispatch(n):e.update([])}},10)}ly.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),Oy(e)},ly.blur=e=>{e.observer.clearSelectionRange(),Oy(e)},ly.compositionstart=ly.compositionupdate=(e,t)=>{if(!e.observer.editContext&&(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0)){let{main:t}=e.state.selection;!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from&&!e.state.readOnly&&e.dispatch({changes:e.state.selection.ranges.filter(e=>!e.empty).map(e=>({from:e.from,to:e.to})),userEvent:`input`}),e.inputState.composing=0}},ly.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,Y.chrome&&Y.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},ly.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},cy.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 Vv(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(Y.chrome&&Y.android&&(n=Zv.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 Y.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),Y.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>ly.compositionend(e,t),20),!1};var ky=new Set;function Ay(e){ky.has(e)||(ky.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var jy=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],My=!1;function Ny(){My=!1}var Py=class{constructor(e){this.lineWrapping=e,this.doc=Ep.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 jy.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=jy.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}},Fy=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},Iy=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`?Gh.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 Yh?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)}},Ly=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(Ly||={}),Ry=.001,zy=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)>Ry&&(My=!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,Ly.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,Ly.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,Ly.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=Jy.build(n.setDoc(a),e,l,u);i=By(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new Uy(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=!1;return t[n-1]==null?(o=!0,n--):t[n]??(o=!0,r++),new Gy(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function By(e,t){return e==t?e:(e.constructor!=t.constructor&&(My=!0),t)}zy.prototype.size=1;var Vy=Kh.replace({}),Hy=class extends zy{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new Iy(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 Iy(r,0,n,this.spaceAbove,Vy):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,Ly.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})`}},Uy=class e extends Hy{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 Iy(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 Wy&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Wy?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):zy.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:``})`}},Wy=class e extends zy{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 Iy(a.from,a.length,l,c,0)}{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 Iy(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==Ly.ByHeight)return this.blockAt(e,n,r,i);if(t==Ly.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new Iy(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 Iy(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 Iy(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 zy.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)>=Ry&&(s=-2);let c=new Uy(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=zy.of(r);return(s<0||Math.abs(c.height-this.height)>=Ry||Math.abs(s-this.heightMetrics(t,n).perLine)>=Ry)&&(My=!0),By(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},Gy=class extends zy{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==Ly.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==Ly.ByPosNoHeight?Ly.ByPosNoHeight:Ly.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,Ly.ByPos,n,r,i);e<c.from&&this.left.forEachLine(e,Math.min(t,c.from-1),n,r,i,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(Math.max(e,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&&Ky(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),Ky(i,e)}return zy.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?zy.of(this.break?[e,null,t]:[e,t]):(this.left=By(this.left,e),this.right=By(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 Ky(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Wy&&(r=e[t+1])instanceof Wy&&e.splice(t-1,3,new Wy(n.length+1+r.length))}var qy=5,Jy=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 Uy?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Uy(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 Hy(a,r,n)):(a||i||r>=qy)&&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 Uy(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Wy(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 Uy)return e;let t=new Uy(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 Uy)&&!this.isCovered?this.nodes.push(new Uy(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 Uy&&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 Zm.spans(n,r,i,a,0),a.finish(r)}};function Yy(e,t,n){let r=new Xy;return Zm.compare(e,t,n,r,0),r.changes}var Xy=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&Qh(e,t,this.changes,5)}};function Zy(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(eg(t)){let n=window.getComputedStyle(t);if((t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&n.overflow!=`visible`){let n=t.getBoundingClientRect();a=Math.max(a,n.left),o=Math.min(o,n.right),s=Math.max(s,n.top),c=Math.min(t==e.parentNode?i.innerHeight:c,n.bottom)}t=n.position==`absolute`||n.position==`fixed`?t.offsetParent:t.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 Qy(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 $y(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var eb=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 Kh.replace({widget:new tb(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},tb=class extends Wh{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}},nb=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=cb,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ag.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(x_).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new Py(n),this.stateDeco=lb(t),this.heightMap=zy.empty().applyChanges(this.stateDeco,Ep.empty,this.heightOracle.setDoc(t.doc),[new j_(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=Kh.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 rb(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?cb:new ub(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(db(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=lb(this.state);let r=e.changedRanges,i=j_.extendWithRanges(r,Yy(n,this.stateDeco,e?e.changes:Kp.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Ny(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||My)&&(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(l_)&&(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`?Ag.RTL:Ag.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}=pg(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=hg(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=Eg(this.scrollParent||e.win);let m=(this.printing?$y:Zy)(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&&!Qy(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)),Ny();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?zy.empty().applyChanges(this.stateDeco,Ep.empty,this.heightOracle,[new j_(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new Fy(n.from,i))}My&&(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 rb(r.lineAt(a-n*1e3,Ly.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,Ly.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,Ly.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 rb(r.lineAt(o-500,Ly.ByHeight,i,0,0).from,r.lineAt(o+n+500,Ly.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 rb(this.heightMap.lineAt(n,Ly.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Ly.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,Ly.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,Ly.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-2e3&&i<o+2e3}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 eb(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!=Ag.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=sb(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(q.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new eb(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=Gh.Text)return;let i=ib(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=ob(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=ab(i,n),l=ab(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=ob(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=ab(i,f),l=ab(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=ob(r,n)-ob(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){eb.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Kh.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=[];Zm.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)||db(this.heightMap.lineAt(e,Ly.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)||db(this.heightMap.lineAt(this.scaler.fromDOM(e),Ly.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}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 db(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}},rb=class{constructor(e,t){this.from=e,this.to=t}};function ib(e,t,n){let r=[],i=e,a=0;return Zm.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 ab({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 ob(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 sb(e,t){for(let n of e)if(t(n))return n}var cb={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function lb(e){let t=e.facet(S_).filter(e=>typeof e!=`function`),n=e.facet(w_).filter(e=>typeof e!=`function`);return n.length&&t.push(Zm.join(n)),t}var ub=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,Ly.ByPos,e,0,0).top,o=t.lineAt(i,Ly.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)}};function db(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Iy(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>db(e,t)):e._content)}var fb=J.define({combine:e=>e.join(` `)}),pb=J.define({combine:e=>e.indexOf(!0)>-1}),mb=_h.newName(),hb=_h.newName(),gb=_h.newName(),_b={"&light":`.`+hb,"&dark":`.`+gb};function vb(e,t,n){return new _h(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 yb=vb(`.`+mb,{"&":{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":{userSelect:`none`,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`},".cm-panels-top":{top:`0`},".cm-panels-bottom":{bottom:`0`},"&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:`baseline`,height:`1em`,width:0,display:`inline`},".cm-placeholder":{color:`#888`,display:`inline-block`,verticalAlign:`top`,userSelect:`none`},".cm-highlightSpace":{background:`radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat`,backgroundSize:`.4em`,backgroundPosition:`calc(min(50%, 0px)) 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`}},_b),bb={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},xb=Y.ie&&Y.ie_version<=11,Sb=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new gg,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);(Y.ie&&Y.ie_version<=11||Y.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&&Y.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Y.chrome&&Y.chrome_version<126)&&(this.editContext=new Eb(e),e.state.facet(h_)&&(e.contentDOM.editContext=this.editContext.editContext)),xb&&(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(h_)?n.root.activeElement!=this.dom:!ig(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(Y.ie&&Y.ie_version<=11||Y.android&&Y.chrome)&&!n.state.selection.main.empty&&r.focusNode&&og(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ng(e.root);if(!t)return!1;let n=Y.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Tb(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=ig(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Tg(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(eg(n))!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,bb),xb&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),xb&&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&&Cg(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&&ig(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 Rv(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.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=Bv(this.view,n);return this.view.state==r&&(n.domChanged||t)&&this.view.update([]),i}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=Cb(t,e.previousSibling||e.target.previousSibling,-1),r=Cb(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return e.type==`characterData`?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}: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(h_)!=e.state.facet(h_)&&(e.view.contentDOM.editContext=e.state.facet(h_)?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 Cb(e,t,n){for(;t;){let r=P_.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 wb(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 og(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function Tb(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return wb(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?wb(e,n):null}var Eb=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=Uv(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=q.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));Kv(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:Ep.of(n.text.slice(l.from,l.toB).split(`
|
|
199
|
+
`))};if((Y.mac||Y.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:Ep.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);Vv(e,u,q.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(Kh.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:p_.of(Kh.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=>{let t=ng(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}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>3e4)}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])}},X=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.clearAnnouncement=-1,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||wg(e.parent)||document,this.viewState=new nb(this,e.state||Wm.create(e)),e.scrollTo&&e.scrollTo.is(f_)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(__).map(e=>new y_(e));for(let e of this.plugins)e.update(this);this.observer=new Sb(this),this.inputState=new qv(this),this.inputState.ensureHandlers(this.plugins),this.docView=new sv(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 Am?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(Ey))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Dy(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(Wm.phrases)!=this.state.facet(Wm.phrases))return this.setState(a);i=M_.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 d_(t.empty?t:q.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(f_)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=kb.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(A_)!=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(fb)!=i.state.facet(fb)&&(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(r_))try{e(i)}catch(e){m_(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!Bv(this,u)&&l.force&&Cg(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 nb(this,e),this.plugins=e.facet(__).map(e=>new y_(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new sv(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(__),n=e.state.facet(__);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new y_(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){m_(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,scaleY:o}=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(Eg(n||this.win))i=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}o=this.viewState.scaleY}this.updateState=1;let s=this.viewState.measure();if(!s&&!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 c=[];s&4||([this.measureRequests,c]=[c,this.measureRequests]);let l=c.map(e=>{try{return e.read(this)}catch(e){return m_(this.state,e),Ob}}),u=M_.create(this,this.state,[]),d=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let e=0;e<c.length;e++)if(l[e]!=Ob)try{let t=c[e];t.write&&t.write(l[e],this)}catch(e){m_(this.state,e)}if(d&&this.docView.updateSelection(!0),!u.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}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)/this.viewState.scaleY-a/o;if((e>1||e<-1)&&!(Y.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?i<0?n.scrollTop=n.scrollHeight: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(r_))e(t)}get themeClasses(){return mb+` `+(this.state.facet(pb)?gb:hb)+` `+this.state.facet(fb)}updateAttrs(){let e=Ab(this,b_,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(h_)?`true`:`false`,class:`cm-content`,style:`${Y.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),Ab(this,x_,t);let n=this.observer.ignore(()=>{let n=Hh(this.contentDOM,this.contentAttrs,t),r=Hh(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=``,this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=`\xA0`},200),!1);let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(A_);let t=this.state.facet(e.cspNonce);_h.mount(this.root,this.styleModules.concat(yb).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 kv(this,e,wv(this,e,t,n))}moveByGroup(e,t){return kv(this,e,wv(this,e,t,t=>Tv(this,e.head,t)))}visualLineSide(e,t){return t?q.cursor(e.to,1):q.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return Cv(this,e,t,n)}moveVertically(e,t,n){return kv(this,e,Ev(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=jv(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),jv(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[Bg.find(r,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&i.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+i.from,t=1):(e=n.from+i.to,t=-1)),this.docView.coordsAt(e,t,i.dir==Ag.RTL)}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(c_)||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>Db)return Yg(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||Vg(r.isolates,n=D_(this,e))))return r.order;n||=D_(this,e);let r=Jg(e.text,t,n);return this.bidiCache.push(new kb(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||Y.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{bg(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.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return f_.of(new d_(typeof e==`number`?q.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 f_.of(new d_(q.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 v_.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return v_.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=_h.newName(),r=[fb.of(n),A_.of(vb(`.${n}`,e))];return t&&t.dark&&r.push(pb.of(!0)),r}static baseTheme(e){return dm.lowest(A_.of(vb(`.`+mb,e,_b)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&P_.get(t)||P_.get(e))?.root?.view||null}};X.styleModule=A_,X.inputHandler=i_,X.clipboardInputFilter=o_,X.clipboardOutputFilter=s_,X.scrollHandler=u_,X.focusChangeEffect=a_,X.perLineTextDirection=c_,X.exceptionSink=n_,X.updateListener=r_,X.editable=h_,X.mouseSelectionStyle=t_,X.dragMovesSelection=e_,X.clickAddsSelectionRange=$g,X.decorations=S_,X.blockWrappers=C_,X.outerDecorations=w_,X.atomicRanges=T_,X.bidiIsolatedRanges=E_,X.cursorScrollMargin=J.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}}}),X.scrollMargins=O_,X.darkTheme=pb,X.cspNonce=J.define({combine:e=>e.length?e[0]:``}),X.contentAttributes=x_,X.editorAttributes=b_,X.lineWrapping=X.contentAttributes.of({class:`cm-lineWrapping`}),X.announce=km.define();var Db=4096,Ob={},kb=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:Ag.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 Ab(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&&Rh(a,n)}return n}var jb=Y.mac?`mac`:Y.windows?`win`:Y.linux?`linux`:`key`;function Mb(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 Nb(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 Pb=dm.default(X.domEventHandlers({keydown(e,t){return Hb(Lb(t.state),e,t,`editor`)}})),Fb=J.define({enables:Pb}),Ib=new WeakMap;function Lb(e){let t=e.facet(Fb),n=Ib.get(t);return n||Ib.set(t,n=Bb(t.reduce((e,t)=>e.concat(t),[]))),n}var Rb=null,zb=4e3;function Bb(e,t=jb){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=>Mb(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=Rb={view:t,prefix:n,scope:e};return setTimeout(()=>{Rb==r&&(Rb=null)},zb),!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,Vb))}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 Vb=null;function Hb(e,t,n,r){Vb=t;let i=Eh(t),a=Hp(Bp(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;Rb&&Rb.view==n&&Rb.scope==r&&(o=Rb.prefix+` `,$v.indexOf(t.keyCode)<0&&(c=!0,Rb=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+Nb(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Y.windows&&t.ctrlKey&&t.altKey)&&!(Y.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=bh[t.keyCode])&&p!=i?(d(f[o+Nb(p,t,!0)])||t.shiftKey&&(m=xh[t.keyCode])!=i&&m!=p&&d(f[o+Nb(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+Nb(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),Vb=null,s}var Ub=!Y.ios,Wb=Y.gecko&&Y.gecko_version==153?`#ffffff01`:`transparent`;({...Ub?{"& ::selection, &::selection":{backgroundColor:`${Wb} !important`}}:{}}),{...Ub?{"&::selection, & ::selection":{backgroundColor:`Highlight !important`}}:{}},/x/.unicode;var Gb=class extends Wh{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement(`span`);return t.className=`cm-placeholder`,t.style.pointerEvents=`none`,t.appendChild(typeof this.content==`string`?document.createTextNode(this.content):typeof this.content==`function`?this.content(e):this.content.cloneNode(!0)),t.setAttribute(`aria-hidden`,`true`),t}coordsAt(e){let t=e.firstChild?ag(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=dg(t[0],n.direction!=`rtl`),i=parseInt(n.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}};function Kb(e){let t=v_.fromClass(class{constructor(t){this.view=t,this.placeholder=e?Kh.set([Kh.widget({widget:new Gb(e),side:1}).range(0)]):Kh.none}get decorations(){return this.view.state.doc.length?Kh.none:this.placeholder}},{decorations:e=>e.decorations});return typeof e==`string`?[t,X.contentAttributes.of({"aria-placeholder":e})]:t}var qb=`-10000px`,Jb=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 Yb(e){let t=e.dom.ownerDocument.documentElement,n=t.clientWidth,r=getComputedStyle(t);if(!/stable/.test(r.scrollbarGutter||``))return{left:0,right:n};let i=t.getBoundingClientRect(),a=e.win.scrollX;return{left:Math.max(0,i.left+a-parseFloat(r.marginLeft)),right:Math.min(n,i.right+a+parseFloat(r.marginRight))}}function Xb(e){let{left:t,right:n}=Yb(e);return{top:0,left:t,right:n,bottom:e.dom.ownerDocument.documentElement.clientHeight}}var Zb=J.define({combine:e=>({position:Y.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||Xb})}),Qb=new WeakMap,$b=v_.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(Zb);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 Jb(e,rx,(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(Zb);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=qb,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,r=0;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(Y.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)}else r=Yb(this.view).left;let i=this.view.scrollDOM.getBoundingClientRect(),a=k_(this.view);return{visible:{left:i.left+a.left,top:i.top+a.top,right:i.right-a.right,bottom:i.bottom-a.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(Zb).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n,fixedLeft:r}}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=qb;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=Qb.get(c)??d.bottom-d.top,g=c.offset||nx,_=this.view.textDirection==Ag.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=qb;continue}Qb.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`,ex(l,(v-e.parent.left)/r)):(l.style.top=x/i+`px`,ex(l,(v-e.fixedLeft)/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=qb}},{eventObservers:{scroll(){this.maybeMeasure()}}});function ex(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var tx=X.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`}}}),nx={x:0,y:0},rx=J.define({enables:[$b,tx]});function ix(e,t){let n=e.plugin($b);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}var ax=class extends Km{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};ax.prototype.elementClass=``,ax.prototype.toDOM=void 0,ax.prototype.mapMode=Wp.TrackBefore,ax.prototype.startSide=ax.prototype.endSide=-1,ax.prototype.point=!0;var ox=J.define(),sx=J.define(),cx=J.define(),lx=J.define({combine:e=>e.some(e=>e)});function ux(e){let t=[dx];return e&&e.fixed===!1&&t.push(lx.of(!0)),t}var dx=v_.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(cx).map(t=>new hx(e,t)),this.fixed=!e.state.facet(lx);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(lx)!=!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=Zm.iter(this.view.state.facet(ox),this.view.viewport.from),r=[],i=this.gutters.map(e=>new mx(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==Gh.Text&&t){px(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==Gh.Text){px(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(cx),n=e.state.facet(cx),r=e.docChanged||e.heightChanged||e.viewportChanged||!Zm.eq(e.startState.facet(ox),e.state.facet(ox),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 hx(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=>X.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==Ag.LTR?{left:r,right:i}:{right:r,left:i}})});function fx(e){return Array.isArray(e)?e:[e]}function px(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}var mx=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Zm.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 gx(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=[];px(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(sx)){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()}}},hx=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=fx(t.markers(e)),t.initialSpacer&&(this.spacer=new gx(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=fx(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!Zm.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()}},gx=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`:``),_x(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 _x(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 vx=J.define(),yx=J.define(),bx=J.define({combine(e){return Gm(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}})}}),xx=class extends ax{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function Sx(e,t){return e.state.facet(bx).formatNumber(t,e.state)}var Cx=cx.compute([bx],e=>({class:`cm-lineNumbers`,renderEmptyElements:!1,markers(e){return e.state.facet(vx)},lineMarker(e,t,n){return n.some(e=>e.toDOM)?null:new xx(Sx(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(yx)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(bx)!=e.state.facet(bx),initialSpacer(e){return new xx(Sx(e,Tx(e.state.doc.lines)))},updateSpacer(e,t){let n=Sx(t.view,Tx(t.view.state.doc.lines));return n==e.number?e:new xx(n)},domEventHandlers:e.facet(bx).domEventHandlers,side:`before`}));function wx(e={}){return[bx.of(e),ux(),Cx]}function Tx(e){let t=9;for(;t<e;)t=t*10+9;return t}var Ex=1024,Dx=0,Ox=class{constructor(e,t){this.from=e,this.to=t}},kx=class{constructor(e={}){this.id=Dx++,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=Mx.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};kx.closedBy=new kx({deserialize:e=>e.split(` `)}),kx.openedBy=new kx({deserialize:e=>e.split(` `)}),kx.group=new kx({deserialize:e=>e.split(` `)}),kx.isolate=new kx({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),kx.contextHash=new kx({perNode:!0}),kx.lookAhead=new kx({perNode:!0}),kx.mounted=new kx({perNode:!0});var Ax=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[kx.mounted.id]}},jx=Object.create(null),Mx=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):jx,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(kx.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(kx.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};Mx.none=new Mx(``,Object.create(null),0,8);var Nx=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 Mx(e.name,r,e.id,e.flags):e)}return new e(n)}},Px=new WeakMap,Fx=new WeakMap,Ix;(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`})(Ix||={});var Lx=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=Ax.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 Zx(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new Zx(Px.get(this)||this.topNode);return r.moveTo(e,t),Px.set(this,r._tree),r}get topNode(){return new Ux(this,0,0,null)}resolve(e,t=0){let n=Vx(Px.get(this)||this.topNode,e,t,!1);return Px.set(this,n),n}resolveInner(e,t=0){let n=Vx(Fx.get(this)||this.topNode,e,t,!0);return Fx.set(this,n),n}resolveStack(e,t=0){return Xx(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&Ix.IncludeAnonymous)>0;for(let e=this.cursor(a|Ix.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:nS(Mx.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(Mx.none,t,n,r)))}static build(e){return $x(e)}};Lx.empty=new Lx(Mx.none,[],[],0);var Rx=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)}},zx=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Mx.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&&!(Bx(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 Bx(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 Vx(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 Ux&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:Ix.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof Ux&&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 Hx=class{cursor(e=0){return new Zx(this,e)}getChild(e,t=null,n=null){let r=Wx(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Wx(this,e,t,n)}resolve(e,t=0){return Vx(this,e,t,!1)}resolveInner(e,t=0){return Vx(this,e,t,!0)}matchContext(e){return Gx(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}},Ux=class e extends Hx{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&Ix.EnterBracketed&&l instanceof Lx&&(d=Ax.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||Bx(i,r,u,u+l.length)){if(l instanceof zx){if(a&Ix.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new qx(new Kx(o,l,t,u),null,e)}else if(a&Ix.IncludeAnonymous||!l.type.isAnonymous||Qx(l)){let s;if(!(a&Ix.IgnoreMounts)&&(s=Ax.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&Ix.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&Ix.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&Ix.IgnoreOverlays)&&(i=Ax.get(this._tree))&&i.overlay){let a=t-this.from,o=r&Ix.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 Wx(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 Gx(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 Kx=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},qx=class e extends Hx{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&Ix.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 Lx(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Jx(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 Ux&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new Yx(i,n)}var Yx=class{constructor(e,t){this.heads=e,this.node=t}get next(){return Jx(this.heads)}};function Xx(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof Ux?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=Ax.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Ux(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(Vx(o,t,n,!1))}}return i?Jx(i):r}var Zx=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&~Ix.EnterBracketed,e instanceof Ux)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 Ux?(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&Ix.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ix.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ix.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))}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&Ix.IncludeAnonymous||e instanceof zx||!e.type.isAnonymous||Qx(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 qx(this.buffer,t,this.stack[e]);return this.bufferNode=new qx(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 Gx(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 Gx(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 Qx(e){return e.children.some(e=>e instanceof zx||!e.type.isAnonymous||Qx(e))}function $x(e){let{buffer:t,nodeSet:n,maxBufferLength:r=Ex,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new Rx(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,T=l,E=c;if(w<0){if(o.next(),w==-1){let t=i[x];_.push(t),v.push(S-e);return}if(w==-3){c=x;return}if(w==-4){l=x;return}throw RangeError(`Unrecognized record size: ${w}`)}let D=s[x],O,k,A=S-e;if(C-S<=r&&(k=h(o.pos-t,y))){let t=new Uint16Array(k.size-k.skip),r=o.pos-k.size,i=t.length;for(;o.pos>r;)i=g(k.start,t,i);O=new zx(t,C-k.start,n),A=k.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,T,E),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,T,E),t.reverse(),n.reverse(),i>-1&&s>0){let e=f(D,E);O=nS(D,t,n,0,t.length,0,C-S,e,e)}else O=m(D,t,n,C-S,T-C,E)}_.push(O),v.push(A)}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 zx(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 Lx){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(kx.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=[kx.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[kx.lookAhead,i];o=o?[e].concat(o):[e]}return new Lx(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 Lx(s[e.topID],_.reverse(),v.reverse(),y)}var eS=new WeakMap;function tS(e,t){if(!e.isAnonymous||t instanceof zx||t.type!=e)return 1;let n=eS.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Lx)){n=1;break}n+=tS(e,r)}eS.set(t,n)}return n}function nS(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=tS(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=tS(e,t[s]);for(s++;s<i;s++){let n=tS(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(nS(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 rS=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}},iS=class{startParse(e,t,n){return typeof e==`string`&&(e=new aS(e)),n=n?n.length?n.map(e=>new Ox(e.from,e.to)):[new Ox(0,0)]:[new Ox(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}}},aS=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)}};new kx({perNode:!0});var oS=0,sS=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=oS++}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 lS(e);return e=>e.modified.indexOf(t)>-1?e:lS.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},cS=0,lS=class e{constructor(e){this.name=e,this.instances=[],this.id=cS++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&uS(n,e.modified));if(r)return r;let i=[],a=new sS(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=dS(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 uS(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function dS(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 fS(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 mS(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return pS.add(t)}var pS=new kx({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 mS(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),mS=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}};mS.empty=new mS([],2,null);function hS(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 gS(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function _S(e,t,n,r=0,i=e.length){let a=new vS(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var vS=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=yS(e)||mS.empty,u=gS(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(kx.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)){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 yS(e){let t=e.type.prop(pS);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Z=sS.define,bS=Z(),xS=Z(),SS=Z(xS),CS=Z(xS),wS=Z(),TS=Z(wS),ES=Z(wS),DS=Z(),OS=Z(DS),kS=Z(),AS=Z(),jS=Z(),MS=Z(jS),NS=Z(),Q={comment:bS,lineComment:Z(bS),blockComment:Z(bS),docComment:Z(bS),name:xS,variableName:Z(xS),typeName:SS,tagName:Z(SS),propertyName:CS,attributeName:Z(CS),className:Z(xS),labelName:Z(xS),namespace:Z(xS),macroName:Z(xS),literal:wS,string:TS,docString:Z(TS),character:Z(TS),attributeValue:Z(TS),number:ES,integer:Z(ES),float:Z(ES),bool:Z(wS),regexp:Z(wS),escape:Z(wS),color:Z(wS),url:Z(wS),keyword:kS,self:Z(kS),null:Z(kS),atom:Z(kS),unit:Z(kS),modifier:Z(kS),operatorKeyword:Z(kS),controlKeyword:Z(kS),definitionKeyword:Z(kS),moduleKeyword:Z(kS),operator:AS,derefOperator:Z(AS),arithmeticOperator:Z(AS),logicOperator:Z(AS),bitwiseOperator:Z(AS),compareOperator:Z(AS),updateOperator:Z(AS),definitionOperator:Z(AS),typeOperator:Z(AS),controlOperator:Z(AS),punctuation:jS,separator:Z(jS),bracket:MS,angleBracket:Z(MS),squareBracket:Z(MS),paren:Z(MS),brace:Z(MS),content:DS,heading:OS,heading1:Z(OS),heading2:Z(OS),heading3:Z(OS),heading4:Z(OS),heading5:Z(OS),heading6:Z(OS),contentSeparator:Z(DS),list:Z(DS),quote:Z(DS),emphasis:Z(DS),strong:Z(DS),link:Z(DS),monospace:Z(DS),strikethrough:Z(DS),inserted:Z(),deleted:Z(),changed:Z(),invalid:Z(),meta:NS,documentMeta:Z(NS),annotation:Z(NS),processingInstruction:Z(NS),definition:sS.defineModifier(`definition`),constant:sS.defineModifier(`constant`),function:sS.defineModifier(`function`),standard:sS.defineModifier(`standard`),local:sS.defineModifier(`local`),special:sS.defineModifier(`special`)};for(let e in Q){let t=Q[e];t instanceof sS&&(t.name=e)}hS([{tag:Q.link,class:`tok-link`},{tag:Q.heading,class:`tok-heading`},{tag:Q.emphasis,class:`tok-emphasis`},{tag:Q.strong,class:`tok-strong`},{tag:Q.keyword,class:`tok-keyword`},{tag:Q.atom,class:`tok-atom`},{tag:Q.bool,class:`tok-bool`},{tag:Q.url,class:`tok-url`},{tag:Q.labelName,class:`tok-labelName`},{tag:Q.inserted,class:`tok-inserted`},{tag:Q.deleted,class:`tok-deleted`},{tag:Q.literal,class:`tok-literal`},{tag:Q.string,class:`tok-string`},{tag:Q.number,class:`tok-number`},{tag:[Q.regexp,Q.escape,Q.special(Q.string)],class:`tok-string2`},{tag:Q.variableName,class:`tok-variableName`},{tag:Q.local(Q.variableName),class:`tok-variableName tok-local`},{tag:Q.definition(Q.variableName),class:`tok-variableName tok-definition`},{tag:Q.special(Q.variableName),class:`tok-variableName2`},{tag:Q.definition(Q.propertyName),class:`tok-propertyName tok-definition`},{tag:Q.typeName,class:`tok-typeName`},{tag:Q.namespace,class:`tok-namespace`},{tag:Q.className,class:`tok-className`},{tag:Q.macroName,class:`tok-macroName`},{tag:Q.propertyName,class:`tok-propertyName`},{tag:Q.operator,class:`tok-operator`},{tag:Q.comment,class:`tok-comment`},{tag:Q.meta,class:`tok-meta`},{tag:Q.invalid,class:`tok-invalid`},{tag:Q.punctuation,class:`tok-punctuation`}]);function PS(e,t,n,r=0,i=0){t??(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let a=i;for(let i=r;i<t;i++)e.charCodeAt(i)==9?a+=n-a%n:a++;return a}var FS=class{constructor(e,t,n,r){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(n=typeof e==`string`?t==e:t&&(e instanceof RegExp?e.test(t):e(t)),n)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=PS(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){return this.overrideIndent??PS(this.string,null,this.tabSize)}match(e,t,n){if(typeof e==`string`){let r=e=>n?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}},IS=new kx;function LS(e){return J.define({combine:e?t=>t.concat(e):void 0})}var RS=new kx,zS=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,Wm.prototype.hasOwnProperty(`tree`)||Object.defineProperty(Wm.prototype,"tree",{get(){return HS(this)}}),this.parser=t,this.extension=[ZS.of(this),Wm.languageData.of((e,t,n)=>{let r=BS(e,t,n),i=r.type.prop(IS);if(!i)return[];let a=e.facet(i),o=r.type.prop(RS);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 BS(e,t,n).type.prop(IS)==this.data}findRegions(e){let t=e.facet(ZS);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(IS)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(kx.mounted);if(i){if(i.tree.prop(IS)==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}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 Lx&&r(i,e.positions[n]+t)}};return r(HS(e),0),n}get allowsNesting(){return!0}};zS.setState=km.define();function BS(e,t,n){let r=e.facet(ZS),i=HS(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,Ix.ExcludeBuffers|Ix.EnterBracketed))e.type.isTop&&(i=e);return i}var VS=class e extends zS{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=LS(t.languageData);return new e(n,t.parser.configure({props:[IS.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 HS(e){let t=e.field(zS.state,!1);return t?t.tree:Lx.empty}var US=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)}},WS=null,GS=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,[],Lx.empty,0,r,[],null)}startParse(){return this.parser.startParse(new US(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Lx.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(rS.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(rS.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=WS;WS=this;try{return e()}finally{WS=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=KS(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=rS.applyChanges(r,e),i=Lx.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=KS(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 iS{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=WS;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 Lx(Mx.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 WS}};function KS(e,t,n){return rS.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var qS=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=GS.create(t.facet(ZS).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};zS.state=cm.define({create:qS.init,update(e,t){for(let e of t.effects)if(e.is(zS.setState))return e.value;return t.startState.facet(ZS)==t.state.facet(ZS)?e.apply(t):qS.init(t.state)}});var JS=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(JS=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var YS=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,XS=v_.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(zS.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(zS.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=JS(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(zS.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!YS?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>YS&&YS()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:zS.setState.of(new qS(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=>m_(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ZS=J.define({combine(e){return e.length?e[0]:null},enables:e=>[zS.state,XS,X.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),QS=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},$S=J.define(),eC=J.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 tC(e){let t=e.facet(eC);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function nC(e,t){let n=``,r=e.tabSize,i=e.facet(eC)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function rC(e,t){e instanceof Wm&&(e=new iC(e));for(let n of e.state.facet($S)){let r=n(e,t);if(r!==void 0)return r}let n=HS(e.state);return n.length>=t?oC(e,n,t):null}var iC=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=tC(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 dh(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}},aC=new kx;function oC(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 sC(r,e,n)}function sC(e,t,n){for(let r=e;r;r=r.next){let e=lC(r.node);if(e)return e(dC.create(t,n,r))}return 0}function cC(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function lC(e){let t=e.type.prop(aC);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(kx.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>mC(e,!0,1,void 0,n&&!cC(e)?t.from:void 0)}return e.parent==null?uC:null}function uC(){return 0}var dC=class e extends iC{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(fC(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return sC(this.context.next,this.base,this.pos)}};function fC(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function pC(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 mC(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?pC(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}function hC({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var gC=new kx;function _C(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}var vC=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=_h.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 zS?e=>e.prop(IS)==a.data:a?e=>e==a:void 0,this.style=hS(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new _h(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},yC=J.define(),bC=J.define({combine(e){return e.length?[e[0]]:null}});function xC(e){let t=e.facet(yC);return t.length?t:e.facet(bC)}function SC(e,t){let n=[wC],r;return e instanceof vC&&(e.module&&n.push(X.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(bC.of(e)):r?n.push(yC.computeN([X.darkTheme],t=>t.facet(X.darkTheme)==(r==`dark`)?[e]:[])):n.push(yC.of(e)),n}var CC=class{constructor(e){this.markCache=Object.create(null),this.tree=HS(e.state),this.decorations=this.buildDeco(e,xC(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=HS(e.state),n=xC(e.state),r=n!=xC(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 Kh.none;let n=new eh;for(let{from:r,to:i}of e.visibleRanges)_S(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=Kh.mark({class:r})))},r,i);return n.finish()}},wC=dm.high(v_.fromClass(CC,{decorations:e=>e.decorations}));Q.meta,Q.link,Q.heading,Q.emphasis,Q.strong,Q.strikethrough,Q.keyword,Q.atom,Q.bool,Q.url,Q.contentSeparator,Q.labelName,Q.literal,Q.inserted,Q.string,Q.deleted,Q.regexp,Q.escape,Q.string,Q.variableName,Q.variableName,Q.typeName,Q.namespace,Q.className,Q.variableName,Q.macroName,Q.propertyName,Q.comment,Q.invalid;var TC=1e4,EC=`()[]{}`,DC=new kx;function OC(e,t,n){let r=e.prop(t<0?kx.openedBy:kx.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 kC(e){let t=e.type.prop(DC);return t?t(e.node):e}function AC(e,t,n,r={}){let i=r.maxScanDistance||TC,a=r.brackets||EC,o=HS(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=OC(r.type,n,a);if(i&&r.from<r.to){let o=kC(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return jC(e,t,n,r,o,i,a)}}return MC(e,t,n,o,s.type,i,a)}function jC(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=kC(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(OC(u.type,n,o))l++;else if(OC(u.type,-n,o)){if(l==0){let e=kC(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 MC(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}function NC(e){return{name:e.name||``,token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||PC,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||HC,mergeTokens:e.mergeTokens!==!1}}function PC(e){if(typeof e!=`object`)return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}var FC=new WeakMap,IC=class e extends zS{constructor(e){let t=LS(e.languageData),n=NC(e),r,i=new class extends iS{createParse(e,t,n){return new BC(r,e,t,n)}};super(t,i,[],e.name),this.topNode=QC(t,this),r=this,this.streamParser=n,this.stateAfter=new kx({perNode:!0}),this.tokenTable=e.tokenTable?new JC(n.tokenTable):YC}static define(t){return new e(t)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=FC.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let r=LC(this,e.node.tree,e.node.from,e.node.from,t??e.pos),i,a;if(r?(a=r.state,i=r.pos+1):(a=this.streamParser.startState(e.unit),i=e.node.from),e.pos-i>1e4)return null;for(;i<e.pos;){let t=e.state.doc.lineAt(i),r=Math.min(e.pos,t.to);if(t.length){let i=n?n(t.from):-1,o=new FS(t.text,e.state.tabSize,e.unit,i<0?void 0:i);for(;o.pos<r-t.from;)VC(this.streamParser.token,o,a)}else this.streamParser.blankLine(a,e.unit);if(r==e.pos)break;i=t.to+1}let o=e.lineAt(e.pos);return n&&t==null&&FC.set(e.state,o.from),this.streamParser.indent(a,/^\s*(.*)/.exec(o.text)[1],e)}get allowsNesting(){return!1}};function LC(e,t,n,r,i){let a=n>=r&&n+t.length<=i&&t.prop(e.stateAfter);if(a)return{state:e.streamParser.copyState(a),pos:n+t.length};for(let a=t.children.length-1;a>=0;a--){let o=t.children[a],s=n+t.positions[a],c=o instanceof Lx&&s<i&&LC(e,o,s,r,i);if(c)return c}return null}function RC(e,t,n,r,i){if(i&&n<=0&&r>=t.length)return t;!i&&n==0&&t.type==e.topNode&&(i=!0);for(let a=t.children.length-1;a>=0;a--){let o=t.positions[a],s=t.children[a],c;if(o<r&&s instanceof Lx){if(!(c=RC(e,s,n-o,r-o,i)))break;return i?new Lx(t.type,t.children.slice(0,a).concat(c),t.positions.slice(0,a+1),o+c.length):c}}return null}function zC(e,t,n,r,i){for(let i of t){let t=i.from+(i.openStart?25:0),a=i.to-(i.openEnd?25:0),o=t<=n&&a>n&&LC(e,i.tree,0-i.offset,n,a),s;if(o&&o.pos<=r&&(s=RC(e,i.tree,n+i.offset,o.pos+i.offset,!1)))return{state:o.state,tree:s}}return{state:e.streamParser.startState(i?tC(i):4),tree:Lx.empty}}var BC=class{constructor(e,t,n,r){this.lang=e,this.input=t,this.fragments=n,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let i=GS.get(),a=r[0].from,{state:o,tree:s}=zC(e,n,a,this.to,i?.state);this.state=o,this.parsedPos=this.chunkStart=a+s.length;for(let e=0;e<s.children.length;e++)this.chunks.push(s.children[e]),this.chunkPos.push(s.positions[e]);i&&this.parsedPos<i.viewport.from-1e5&&r.some(e=>e.from<=i.viewport.from&&e.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(tC(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=GS.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+512);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
|
|
200
|
+
`&&(t=``);else{let e=t.indexOf(`
|
|
201
|
+
`);e>-1&&(t=t.slice(0,e))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let e=this.rangeIndex;;){let r=this.ranges[e].to;if(r>=n||(t=t.slice(0,r-(n-t.length)),e++,e==this.ranges.length))break;let i=this.ranges[e].from,a=this.lineAfter(i);t+=a,n=i+a.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let r=this.ranges[this.rangeIndex].to,i=e+t;if(n>0?r>i:r>=i)break;let a=this.ranges[++this.rangeIndex].from;t+=a-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,r){let i=4;if(this.ranges.length>1){r=this.skipGapsTo(t,r,1),t+=r;let e=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,i+=this.chunk.length-e}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==t?this.chunk[a+2]=n:this.chunk.push(e,t,n,i),r}parseLine(e){let{line:t,end:n}=this.nextLine(),r=0,{streamParser:i}=this.lang,a=new FS(t,e?e.state.tabSize:4,e?tC(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let e=VC(i.token,a,this.state);if(e&&(r=this.emitToken(this.lang.tokenTable.resolve(e),this.parsedPos+a.start,this.parsedPos+a.pos,r)),a.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Lx.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:WC,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Lx(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Lx(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function VC(e,t,n){t.start=t.pos;for(let r=0;r<10;r++){let r=e(t,n);if(t.pos>t.start)return r}throw Error(`Stream parser failed to advance stream.`)}var HC=Object.create(null),UC=[Mx.none],WC=new Nx(UC),GC=[],KC=Object.create(null),qC=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`]])qC[e]=ZC(HC,t);var JC=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),qC)}resolve(e){return e?this.table[e]||(this.table[e]=ZC(this.extra,e)):0}},YC=new JC(HC);function XC(e,t){GC.indexOf(e)>-1||(GC.push(e),console.warn(t))}function ZC(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||Q[n];r?typeof r==`function`?t.length?t=t.map(r):XC(n,`Modifier ${n} used at start of tag`):t.length?XC(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:XC(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=KC[i];if(a)return a.id;let o=KC[i]=Mx.define({id:UC.length,name:r,props:[fS({[r]:n})]});return UC.push(o),o.id}function QC(e,t){let n=Mx.define({id:UC.length,name:`Document`,props:[IS.add(()=>e),aC.add(()=>e=>t.getIndent(e))],top:!0});return UC.push(n),n}Ag.RTL,Ag.LTR;var $C=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=iw(e.state,n.from);return r.line?tw(e):r.block?rw(e):!1};function ew(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 tw=ew(lw,0),nw=ew(cw,0),rw=ew((e,t)=>cw(e,t,sw(t)),0);function iw(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var aw=50;function ow(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-aw,r),o=e.sliceDoc(i,i+aw),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<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+aw),d=e.sliceDoc(i-aw,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 sw(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 cw(e,t,n=t.selection.ranges){let r=n.map(e=>iw(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>ow(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 lw(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=iw(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)}}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 uw=Em.define(),dw=Em.define(),fw=J.define(),pw=J.define({combine(e){return Gm(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)})}}),mw=cm.define({create(){return Nw.empty},update(e,t){let n=t.state.facet(pw),r=t.annotation(uw);if(r){let i=xw.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Sw(o,o.length,n.minDepth,i):Ow(o,t.startState.selection),new Nw(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(dw);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(Am.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=xw.fromTransaction(t),o=t.annotation(Am.time),s=t.annotation(Am.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 Nw(e.done.map(xw.fromJSON),e.undone.map(xw.fromJSON))}});function hw(e={}){return[mw,pw.of(e),X.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?_w:e.inputType==`historyRedo`?vw:null;return n?(e.preventDefault(),n(t)):!1}})]}function gw(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(mw,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var _w=gw(0,!1),vw=gw(1,!1),yw=gw(0,!0),bw=gw(1,!0),xw=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&&Kp.fromJSON(t.changes),[],t.mapped&&Gp.fromJSON(t.mapped),t.startSelection&&q.fromJSON(t.startSelection),t.selectionsAfter.map(q.fromJSON))}static fromTransaction(t,n){let r=Ew;for(let e of t.startState.facet(fw)){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,Ew)}static selection(t){return new e(void 0,Ew,void 0,void 0,t)}};function Sw(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 Cw(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 ww(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Tw(e,t){return e.length?t.length?e.concat(t):e:t}var Ew=[],Dw=200;function Ow(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Dw));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Sw(e,e.length-1,1e9,n.setSelAfter(r)))}return[xw.selection([t])]}function kw(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 Aw(e,t){if(!e.length)return e;let n=e.length,r=Ew;for(;n;){let i=jw(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}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[xw.selection(r)]:Ew}function jw(e,t,n){let r=Tw(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Ew,n);if(!e.changes)return xw.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new xw(i,km.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Mw=/^(input\.type|delete)($|\.)/,Nw=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||Mw.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Cw(s.changes,t.changes))||r==`input.type.compose`)?Sw(o,o.length-1,i.minDepth,new xw(t.changes.compose(s.changes),Tw(km.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,Ew)):Sw(o,o.length,i.minDepth,t),new e(o,Ew,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Ew;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&ww(a[a.length-1],t)?this:new e(Ow(this.done,t),this.undone,n,r)}addMapping(t){return new e(Aw(this.done,t),Aw(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:uw.of({side:e,rest:kw(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?Ew:r.slice(0,r.length-1);return i.mapped&&(n=Aw(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:uw.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};Nw.empty=new Nw(Ew,Ew);var Pw=[{key:`Mod-z`,run:_w,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:vw,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:vw,preventDefault:!0},{key:`Mod-u`,run:yw,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:bw,preventDefault:!0}];function Fw(e,t){return q.create(e.ranges.map(t),e.mainIndex)}function Iw(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function Lw({state:e,dispatch:t},n){let r=Fw(e.selection,n);return!r.eq(e.selection,!0)&&(t(Iw(e,r)),!0)}function Rw(e,t){return q.cursor(t?e.to:e.from)}function zw(e,t){return Lw(e,n=>n.empty?e.moveByChar(n,t):Rw(n,t))}function Bw(e){return e.textDirectionAt(e.state.selection.main.head)==Ag.LTR}var Vw=e=>zw(e,!Bw(e)),Hw=e=>zw(e,Bw(e));function Uw(e,t){return Lw(e,n=>n.empty?e.moveByGroup(n,t):Rw(n,t))}var Ww=e=>Uw(e,!Bw(e)),Gw=e=>Uw(e,Bw(e));typeof Intl<`u`&&Intl.Segmenter;function Kw(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 qw(e,t,n){let r=HS(e).resolveInner(t.head),i=n?kx.closedBy:kx.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;Kw(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?AC(e,r.from,1):AC(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,q.cursor(s,n?-1:1)}var Jw=e=>Lw(e,t=>qw(e.state,t,!Bw(e))),Yw=e=>Lw(e,t=>qw(e.state,t,Bw(e)));function Xw(e,t){return Lw(e,n=>{if(!n.empty)return Rw(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var Zw=e=>Xw(e,!1),Qw=e=>Xw(e,!0);function $w(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(X.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 eT(e,t){let n=$w(e),{state:r}=e,i=Fw(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):Rw(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=X.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(Iw(r,i),{effects:a}),!0}var tT=e=>eT(e,!1),nT=e=>eT(e,!0);function rT(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=q.cursor(r.from+n))}return i}var iT=e=>Lw(e,t=>rT(e,t,!0)),aT=e=>Lw(e,t=>rT(e,t,!1)),oT=e=>Lw(e,t=>rT(e,t,!Bw(e))),sT=e=>Lw(e,t=>rT(e,t,Bw(e))),cT=e=>Lw(e,t=>e.moveToLineBoundary(t,!1,!1)),lT=e=>Lw(e,t=>e.moveToLineBoundary(t,!0,!1));function uT(e,t,n){let r=!1,i=Fw(e.selection,t=>{let i=AC(e,t.head,-1)||AC(e,t.head,1)||t.head>0&&AC(e,t.head-1,1)||t.head<e.doc.length&&AC(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?q.range(t.anchor,a):q.cursor(a)});return r?(t(Iw(e,i)),!0):!1}var dT=({state:e,dispatch:t})=>uT(e,t,!1);function fT(e,t,n){let r=Fw(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=q.range(e.head,e.anchor));let r=n(e);return q.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(Iw(e.state,r)),!0)}function pT(e,t){return fT(e,t,n=>e.moveByChar(n,t))}var mT=e=>pT(e,!Bw(e)),hT=e=>pT(e,Bw(e));function gT(e,t){return fT(e,t,n=>e.moveByGroup(n,t))}var _T=e=>gT(e,!Bw(e)),vT=e=>gT(e,Bw(e)),yT=e=>{let t=!Bw(e);return fT(e,t,n=>qw(e.state,n,t))},bT=e=>{let t=Bw(e);return fT(e,t,n=>qw(e.state,n,t))};function xT(e,t){return fT(e,t,n=>e.moveVertically(n,t))}var ST=e=>xT(e,!1),CT=e=>xT(e,!0);function wT(e,t){return fT(e,t,n=>e.moveVertically(n,t,$w(e).height))}var TT=e=>wT(e,!1),ET=e=>wT(e,!0),DT=e=>fT(e,!0,t=>rT(e,t,!0)),OT=e=>fT(e,!1,t=>rT(e,t,!1)),kT=e=>{let t=!Bw(e);return fT(e,t,n=>rT(e,n,t))},AT=e=>{let t=Bw(e);return fT(e,t,n=>rT(e,n,t))},jT=e=>fT(e,!1,t=>q.cursor(e.lineBlockAt(t.head).from)),MT=e=>fT(e,!0,t=>q.cursor(e.lineBlockAt(t.head).to)),NT=({state:e,dispatch:t})=>(t(Iw(e,{anchor:0})),!0),PT=({state:e,dispatch:t})=>(t(Iw(e,{anchor:e.doc.length})),!0),FT=({state:e,dispatch:t})=>(t(Iw(e,{anchor:e.selection.main.anchor,head:0})),!0),IT=({state:e,dispatch:t})=>(t(Iw(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),LT=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),RT=({state:e,dispatch:t})=>{let n=rE(e).map(({from:t,to:n})=>q.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:q.create(n),userEvent:`select`})),!0},zT=({state:e,dispatch:t})=>{let n=Fw(e.selection,t=>{let n=HS(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 q.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(Iw(e,n)),!0)};function BT(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}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(Iw(n,q.create(i,i.length-1))),!0)}var VT=e=>BT(e,!1),HT=e=>BT(e,!0),UT=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=q.create([n.main]):n.main.empty||(r=q.create([q.cursor(n.main.head)])),r?(t(Iw(e,r)),!0):!1};function WT(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=GT(e,o,!1)):o>i&&(n=`delete.forward`,o=GT(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=GT(e,i,!1),a=GT(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:q.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?X.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function GT(e,t,n){if(e instanceof X)for(let r of e.state.facet(X.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var KT=(e,t,n)=>WT(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=dh(s,a.tabSize)%tC(a)||tC(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=Lp(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=Lp(o.text,c-o.from,!1,!1)+o.from);return c}),qT=e=>KT(e,!1,!0),JT=e=>KT(e,!0,!1),YT=(e,t)=>WT(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=Lp(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}),XT=e=>YT(e,!1),ZT=e=>YT(e,!0),QT=e=>WT(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),$T=e=>WT(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),eE=e=>WT(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),tE=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Ep.of([``,``])},range:q.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},nE=({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:Lp(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:Lp(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:q.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function rE(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 iE(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of rE(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(q.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(q.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:q.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var aE=({state:e,dispatch:t})=>iE(e,t,!1),oE=({state:e,dispatch:t})=>iE(e,t,!0);function sE(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of rE(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 cE=({state:e,dispatch:t})=>sE(e,t,!1),lE=({state:e,dispatch:t})=>sE(e,t,!0),uE=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(rE(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Fw(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 dE(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=HS(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(kx.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 fE=mE(!1),pE=mE(!0);function mE(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&&dE(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new iC(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=rC(s,r);for(c??=dh(/^\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=[``,nC(t,c)];return o&&l.push(nC(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:Ep.of(l)},range:q.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function hE(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:q.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var gE=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new iC(e,{overrideIndentation:e=>n[e]??-1}),i=hE(e,(t,i,a)=>{let o=rC(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=nC(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},_E=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(hE(e,(t,n)=>{n.push({from:t.from,insert:e.facet(eC)})}),{userEvent:`input.indent`})),!0),vE=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(hE(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=dh(r,e.tabSize),a=0,o=nC(e,Math.max(0,i-tC(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),yE=e=>(e.setTabFocusMode(),!0),bE=[{key:`Ctrl-b`,run:Vw,shift:mT,preventDefault:!0},{key:`Ctrl-f`,run:Hw,shift:hT},{key:`Ctrl-p`,run:Zw,shift:ST},{key:`Ctrl-n`,run:Qw,shift:CT},{key:`Ctrl-a`,run:cT,shift:jT},{key:`Ctrl-e`,run:lT,shift:MT},{key:`Ctrl-d`,run:JT},{key:`Ctrl-h`,run:qT},{key:`Ctrl-k`,run:QT},{key:`Ctrl-Alt-h`,run:XT},{key:`Ctrl-o`,run:tE},{key:`Ctrl-t`,run:nE},{key:`Ctrl-v`,run:nT}],xE=[{key:`ArrowLeft`,run:Vw,shift:mT,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Ww,shift:_T,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:oT,shift:kT,preventDefault:!0},{key:`ArrowRight`,run:Hw,shift:hT,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Gw,shift:vT,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:sT,shift:AT,preventDefault:!0},{key:`ArrowUp`,run:Zw,shift:ST,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:NT,shift:FT},{mac:`Ctrl-ArrowUp`,run:tT,shift:TT},{key:`ArrowDown`,run:Qw,shift:CT,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:PT,shift:IT},{mac:`Ctrl-ArrowDown`,run:nT,shift:ET},{key:`PageUp`,run:tT,shift:TT},{key:`PageDown`,run:nT,shift:ET},{key:`Home`,run:aT,shift:OT,preventDefault:!0},{key:`Mod-Home`,run:NT,shift:FT},{key:`End`,run:iT,shift:DT,preventDefault:!0},{key:`Mod-End`,run:PT,shift:IT},{key:`Enter`,run:fE,shift:fE},{key:`Mod-a`,run:LT},{key:`Backspace`,run:qT,shift:qT,preventDefault:!0},{key:`Delete`,run:JT,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:XT,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:ZT,preventDefault:!0},{mac:`Mod-Backspace`,run:$T,preventDefault:!0},{mac:`Mod-Delete`,run:eE,preventDefault:!0}].concat(bE.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),SE=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Jw,shift:yT},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:Yw,shift:bT},{key:`Alt-ArrowUp`,run:aE},{key:`Shift-Alt-ArrowUp`,run:cE},{key:`Alt-ArrowDown`,run:oE},{key:`Shift-Alt-ArrowDown`,run:lE},{key:`Mod-Alt-ArrowUp`,run:VT},{key:`Mod-Alt-ArrowDown`,run:HT},{key:`Escape`,run:UT},{key:`Mod-Enter`,run:pE},{key:`Alt-l`,mac:`Ctrl-l`,run:RT},{key:`Mod-i`,run:zT,preventDefault:!0},{key:`Mod-[`,run:vE},{key:`Mod-]`,run:_E},{key:`Mod-Alt-\\`,run:gE},{key:`Shift-Mod-k`,run:uE},{key:`Shift-Mod-\\`,run:dT},{key:`Mod-/`,run:$C},{key:`Alt-A`,mac:`Ctrl-A`,run:nw},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:yE}].concat(xE),CE={key:`Tab`,run:_E,shift:vE},wE=e=>new Set(e.split(` `)),TE=wE(`abstract break catch class continue do else enum extends final finally for global if implements inherited interface instanceof new override private protected public return sharing static super switch on this throw transient try virtual webservice when while with without testmethod get set insert update upsert delete undelete merge`),EE=wE(`void string integer long double decimal boolean id date datetime time blob object list map sobject`),DE=wE(`null true false`),OE=wE(`select from where and or not in like limit offset order by asc desc nulls first last group having with security_enforced user_mode system_mode for update view reference includes excludes find returning all rows typeof when then else end using scope tracking viewstat`),kE=IC.define({name:`apex`,startState:()=>({inComment:!1,inSoql:!1,bracketOpen:!1}),token(e,t){if(t.inComment)return e.skipTo(`*/`)?(e.next(),e.next(),t.inComment=!1):e.skipToEnd(),`comment`;if(e.eatSpace())return null;if(t.bracketOpen&&(t.bracketOpen=!1,e.match(/^(select|find)\b/i,!1)&&(t.inSoql=!0)),e.match(`//`))return e.skipToEnd(),`comment`;if(e.match(`/*`))return t.inComment=!0,`comment`;if(e.peek()===`'`){e.next();let t=!1;for(let n=e.next();n!==void 0&&(n!==`'`||t);n=e.next())t=!t&&n===`\\`;return`string`}if(t.inSoql){if(e.eat(`]`))return t.inSoql=!1,`bracket`;if(e.match(/^:\s*[A-Za-z_]\w*/))return`variableName`}else if(e.match(/^\[(?=\s*(select|find)\b)/i))return t.inSoql=!0,`bracket`;else if(e.match(/^\[\s*$/))return t.bracketOpen=!0,`bracket`;if(e.match(/^@[A-Za-z_]\w*/))return`meta`;if(e.match(/^\d+(\.\d+)?[lLdD]?/))return`number`;if(e.match(/^[A-Za-z_]\w*/)){let n=e.current().toLowerCase();return DE.has(n)?`atom`:t.inSoql?OE.has(n)?`keyword`:null:TE.has(n)?`keyword`:EE.has(n)?`typeName`:null}return e.next(),null},languageData:{commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}}}}),AE={editor:`_editor_ge81v_2`,lineNumbers:`_lineNumbers_ge81v_47`},jE=vC.define([{tag:Q.keyword,color:`var(--color-syntax-keyword)`,fontWeight:`600`},{tag:[Q.typeName,Q.meta],color:`var(--color-syntax-builtin)`},{tag:Q.string,color:`var(--color-syntax-string)`},{tag:[Q.number,Q.atom],color:`var(--color-syntax-literal)`},{tag:Q.comment,color:`var(--color-muted)`}]),ME=X.theme({".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:`var(--color-selection) !important`},".cm-cursor":{borderLeftColor:`var(--color-ink)`}});function NE({initialText:e,onChange:t,onModEnter:n,register:r}){let i=(0,_.useRef)(null),a=(0,_.useRef)({onChange:t,onModEnter:n});return(0,_.useEffect)(()=>{a.current={onChange:t,onModEnter:n}}),(0,_.useEffect)(()=>{if(!i.current)return;let t=new X({parent:i.current,state:Wm.create({doc:e,extensions:[hw(),wx(),kE,SC(jE),ME,Kb(C.apexPlaceholder),X.contentAttributes.of({"aria-label":C.apexEditorLabel}),dm.highest(Fb.of([{key:`Mod-Enter`,run:()=>(a.current.onModEnter(),!0)}])),Fb.of([...SE,...Pw,CE]),X.updateListener.of(e=>{e.docChanged&&a.current.onChange(e.state.doc.toString())})]})});return r({getText:()=>t.state.doc.toString(),setText:e=>t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}}),focus:()=>t.focus(),goTo:(e,n)=>{let r=t.state.doc.line(Math.min(Math.max(e,1),t.state.doc.lines)),i=Math.min(r.from+Math.max((n??1)-1,0),r.to);t.dispatch({selection:{anchor:i},effects:X.scrollIntoView(i,{y:`center`})}),t.focus()}}),()=>{r(null),t.destroy()}},[]),(0,F.jsx)(`div`,{ref:i,className:`${AE.editor} ${AE.lineNumbers}`})}var PE=km.define(),FE=Kh.mark({class:`cm-searchMatch`}),IE=Kh.mark({class:`cm-searchMatch-current`}),LE=cm.define({create:()=>Kh.none,update(e,t){for(let e of t.effects)if(e.is(PE)){let{matches:t,current:n}=e.value;return Kh.set(t.map((e,t)=>(t===n?IE:FE).range(e.from,e.to)))}return e},provide:e=>X.decorations.from(e)});function RE({text:e,matches:t,current:n}){let r=(0,_.useRef)(null),i=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!r.current)return;let t=new X({parent:r.current,state:Wm.create({doc:e,extensions:[LE,ME,X.lineWrapping,X.editable.of(!1),Wm.readOnly.of(!0),X.contentAttributes.of({"aria-label":C.apexLog})]})});return i.current=t,()=>{t.destroy(),i.current=null}},[e]),(0,_.useEffect)(()=>{let e=i.current;if(!e)return;let r=t[n];e.dispatch({effects:[PE.of({matches:t,current:n}),...r?[X.scrollIntoView(r.from,{y:`center`})]:[]]})},[e,t,n]),(0,F.jsx)(`div`,{ref:r,className:AE.editor})}var zE=new Map,BE=new Map,VE=new Map,HE=(...e)=>e.join(`
|
|
202
|
+
`);function UE(e,t,n,r=!1){let i=HE(e,t,n??``),a=zE.get(i);if(!a||r){a=P.sobjects(e,t,n,r),zE.set(i,a);let o=a;a.catch(()=>zE.get(i)===o&&zE.delete(i))}return a}function WE(e,t,n,r,i=!1){let a=HE(e,n,r??``,t.toLowerCase()),o=VE.get(a);if(!o||i){o=P.describe(e,t,n,r,i),VE.set(a,o);let s=o;o.catch(()=>VE.get(a)===s&&VE.delete(a))}return o}function GE(e){let t=BE.get(e);if(!t){t=P.versions(e).then(e=>e.versions),BE.set(e,t);let n=t;t.catch(()=>BE.get(e)===n&&BE.delete(e))}return t}function KE(e,t){let[n,r]=(0,_.useState)(0),[i,a]=(0,_.useState)({}),o=e===void 0?void 0:`${e}\n${n}`,s=(0,_.useRef)(t);(0,_.useEffect)(()=>{s.current=t}),(0,_.useEffect)(()=>{if(e===void 0)return;let t=!0;return s.current(n>0).then(r=>t&&a({key:e,request:`${e}\n${n}`,data:r}),r=>t&&a(t=>({key:e,request:`${e}\n${n}`,data:t.key===e?t.data:void 0,error:r}))),()=>{t=!1}},[e,n]);let c=(0,_.useCallback)(()=>r(e=>e+1),[]),l=e!==void 0&&i.key===e?i.data:void 0,u=i.request===o?i.error:void 0,d=o!==void 0&&i.request!==o;return{data:l,error:u,loading:d,pending:d&&l===void 0,reload:c}}var qE={version:`_version_y2a6l_2`,select:`_select_y2a6l_10`};function JE({username:e,value:t,onChange:n}){let r=(0,_.useId)(),i=KE(e,()=>GE(e)).data??[],a=i[i.length-1];return(0,F.jsxs)(`span`,{className:qE.version,children:[(0,F.jsx)(`label`,{htmlFor:r,children:C.apiVersion}),(0,F.jsxs)(`select`,{id:r,"aria-label":C.apiVersionLabel,className:qE.select,value:t??``,onChange:e=>n(e.target.value||void 0),children:[(0,F.jsx)(`option`,{value:``,children:a?C.apiVersionLatest(a):C.apiVersionLatestUnknown}),[...t&&!i.slice(0,-1).includes(t)&&t!==a?[t]:[],...i.slice(0,-1).reverse()].map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]})]})}function YE({name:e,label:t,side:n}){let{setOpen:r}=Ft();return(0,F.jsx)(`button`,{type:`button`,className:K.button,"aria-label":t,title:t,onClick:()=>r(e,!1),children:(0,F.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,children:(0,F.jsx)(`path`,{d:n===`left`?`M10 3L5 8l5 5`:`M6 3l5 5-5 5`})})})}function XE({text:e}){let[t,n]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(!1),1500);return()=>clearTimeout(e)},[t]),(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>n(!0),()=>n(!1))},children:t?C.restCopied:C.restCopy})}var ZE={notice:`_notice_1rmlp_2`,close:`_close_1rmlp_18`};function QE({text:e,onClose:t}){return(0,F.jsxs)(`div`,{className:ZE.notice,role:`status`,children:[(0,F.jsx)(`span`,{children:e}),(0,F.jsx)(`button`,{type:`button`,className:ZE.close,"aria-label":C.dismiss,onClick:t,children:`×`})]})}function $E({label:e,busy:t,onClick:n}){return(0,F.jsx)(`button`,{type:`button`,className:K.button,title:e,"aria-label":e,"aria-busy":t,disabled:t,onClick:n,children:(0,F.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,children:[(0,F.jsx)(`path`,{d:`M13.5 8a5.5 5.5 0 1 1-1.6-3.9`}),(0,F.jsx)(`path`,{d:`M13.5 2.5v3.2h-3.2`})]})})}var eD={divider:`_divider_10h6b_2`,dividerButton:`_dividerButton_10h6b_11`,strip:`_strip_10h6b_19`,stripText:`_stripText_10h6b_38`};function tD({label:e,text:t,onClick:n}){return(0,F.jsx)(`button`,{type:`button`,className:eD.strip,"aria-label":e,title:e,onClick:n,children:(0,F.jsx)(`span`,{className:eD.stripText,children:t})})}function nD({open:e,showLabel:t,hideLabel:n,onToggle:r}){return(0,F.jsx)(`div`,{className:eD.divider,children:(0,F.jsx)(`button`,{type:`button`,className:`${K.button} ${eD.dividerButton}`,onClick:r,"aria-expanded":e,children:e?n:t})})}var rD={screen:`_screen_t4h5b_2`,top:`_top_t4h5b_12`,code:`_code_t4h5b_35`,hint:`_hint_t4h5b_40`,history:`_history_t4h5b_47`,closedCode:`_closedCode_t4h5b_54`,firstLine:`_firstLine_t4h5b_62`,itemCode:`_itemCode_t4h5b_63`,list:`_list_t4h5b_75`,item:`_item_t4h5b_63`,successMark:`_successMark_t4h5b_98`,failureMark:`_failureMark_t4h5b_103`,unknownMark:`_unknownMark_t4h5b_108`,result:`_result_t4h5b_113`,running:`_running_t4h5b_118`,resultBox:`_resultBox_t4h5b_122`,unknown:`_unknown_t4h5b_108`,error:`_error_t4h5b_135`,problem:`_problem_t4h5b_136`,errorMessage:`_errorMessage_t4h5b_153`,stackTrace:`_stackTrace_t4h5b_158`,log:`_log_t4h5b_165`,logBar:`_logBar_t4h5b_172`,search:`_search_t4h5b_181`,toggle:`_toggle_t4h5b_186`,toolbar:`_toolbar_t4h5b_200`},iD=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),aD=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),oD=[`apexEditor`,`apexHistory`],sD=15,cD=`sfbench.apexUserDebugOnly`;function lD(){return(0,F.jsx)(Pt,{storageKey:`sfbench.apexPanels`,names:oD,children:(0,F.jsx)(uD,{})})}function uD(){let e=gf(),{open:t,setOpen:n}=Ft();return(0,F.jsxs)(`div`,{className:rD.screen,children:[(0,F.jsx)(pD,{}),(0,F.jsxs)(`div`,{className:rD.top,hidden:!t.apexEditor,children:[(0,F.jsx)(mD,{}),t.apexHistory?(0,F.jsx)(hD,{}):(0,F.jsx)(tD,{label:C.showApexHistory,text:C.apexHistory,onClick:()=>n(`apexHistory`,!0)})]}),!t.apexEditor&&(0,F.jsx)(fD,{}),(0,F.jsx)(nD,{open:t.apexEditor,showLabel:C.showApexEditor,hideLabel:C.hideApexEditor,onToggle:()=>n(`apexEditor`,!t.apexEditor)}),(0,F.jsx)(_D,{}),e.confirming&&(0,F.jsx)(SD,{})]})}function dD(){let e=gf();return(0,F.jsx)(`button`,{type:`button`,className:`${K.button} ${K.primary}`,disabled:e.running||e.empty,onClick:e.run,children:e.running?C.apexRunning:C.apexRun})}function fD(){let e=gf();return(0,F.jsxs)(`div`,{className:`${K.panel} ${rD.closedCode}`,children:[(0,F.jsx)(dD,{}),(0,F.jsx)(`code`,{className:rD.firstLine,children:e.firstLine||(0,F.jsx)(`span`,{className:K.meta,children:C.apexNoCode})})]})}function pD(){let e=gf(),[t,n]=(0,_.useState)(!1);return(0,F.jsxs)(F.Fragment,{children:[e.launchNotice&&(0,F.jsx)(QE,{text:C.apexLaunchNotice,onClose:e.closeNotice}),e.apexLeftOutFor!==void 0&&!t&&(0,F.jsx)(QE,{text:C.apexLeftOut(e.apexLeftOutFor),onClose:()=>n(!0)})]})}function mD(){let e=gf(),[t,n]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(!1),4e3);return()=>clearTimeout(e)},[t]),(0,F.jsxs)(`section`,{className:`${K.panel} ${rD.code}`,"aria-label":C.apexEditor,children:[(0,F.jsx)(up,{}),(0,F.jsx)(dp,{}),(0,F.jsxs)(`div`,{className:`${K.header} ${rD.toolbar}`,children:[(0,F.jsx)(dD,{}),(0,F.jsx)(JE,{username:e.username,value:e.apiVersion,onChange:e.setApiVersion})]}),t&&(0,F.jsx)(`p`,{className:rD.hint,role:`status`,children:C.apexModEnterHint}),(0,F.jsx)(NE,{initialText:e.initialCode,onChange:e.onCodeChange,onModEnter:()=>n(!0),register:e.registerEditor})]})}function hD(){let e=gf();return(0,F.jsxs)(`section`,{className:`${K.panel} ${rD.history}`,"aria-label":C.apexHistory,children:[(0,F.jsxs)(`div`,{className:K.header,children:[(0,F.jsx)(`span`,{className:K.title,children:C.apexHistory}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsx)($E,{label:C.reloadApexHistory,busy:e.historyLoading,onClick:e.refreshHistory}),(0,F.jsx)(YE,{name:`apexHistory`,label:C.hideApexHistory,side:`right`})]}),(0,F.jsxs)(`div`,{className:K.body,children:[e.history.length===0&&(0,F.jsx)(`p`,{className:K.empty,children:e.historyLoading?C.loading:C.apexHistoryEmpty}),(0,F.jsx)(`ul`,{className:rD.list,children:e.history.map(t=>(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,className:rD.item,onClick:()=>e.loadEntry(t),title:t.code,children:[(0,F.jsx)(`code`,{className:rD.itemCode,children:ff(t.code)}),(0,F.jsxs)(`span`,{className:K.meta,children:[iD.format(new Date(t.sentAt)),` `,(0,F.jsx)(gD,{entry:t})]})]})},t.id))})]})]})}function gD({entry:e}){let{outcome:t}=e;return t.state===`pending`?(0,F.jsx)(`span`,{className:rD.unknownMark,children:C.apexPendingShort}):t.state===`unknown`?(0,F.jsx)(`span`,{className:rD.unknownMark,children:C.apexUnknownShort}):t.result===`success`?(0,F.jsx)(`span`,{className:rD.successMark,children:C.apexSuccess}):t.result===`compileError`?(0,F.jsx)(`span`,{className:rD.failureMark,children:C.apexCompileError}):(0,F.jsx)(`span`,{className:rD.failureMark,children:t.exceptionType??C.apexRuntimeError})}function _D(){let e=gf();return(0,F.jsx)(`section`,{className:`${K.panel} ${rD.result}`,"aria-label":C.apexResult,"aria-busy":e.running,children:e.running?(0,F.jsx)(vD,{}):(0,F.jsx)(yD,{result:e.result})})}function vD(){let{settings:e}=he();return(0,F.jsx)(`div`,{className:rD.running,children:(0,F.jsx)(`p`,{className:K.empty,children:C.apexRunningNote((e?.requestTimeoutSeconds??120)+sD)})})}function yD({result:e}){let t=gf(),{setOpen:n}=Ft(),r=(e,r)=>{(0,Gf.flushSync)(()=>n(`apexEditor`,!0)),t.goTo(e,r)};if(e.state===`idle`)return(0,F.jsx)(`p`,{className:K.empty,children:C.apexNotRun});if(e.state===`unknown`)return(0,F.jsx)(`div`,{className:rD.resultBox,children:(0,F.jsx)(`div`,{className:rD.unknown,role:`alert`,children:e.message})});if(e.state===`error`)return(0,F.jsx)(`div`,{className:rD.resultBox,children:(0,F.jsxs)(`div`,{className:rD.error,role:`alert`,children:[(0,F.jsx)(`p`,{className:rD.errorMessage,children:e.message}),e.reloginCommand&&(0,F.jsx)(Ke,{command:e.reloginCommand}),(0,F.jsx)(_t,{details:e.details})]})});let{response:i}=e,a=i.line===void 0?void 0:C.apexPosition(i.line,i.column);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:K.header,children:[(0,F.jsx)(`span`,{className:i.result===`success`?rD.successMark:rD.failureMark,children:i.result===`success`?C.apexSuccess:i.result===`compileError`?C.apexCompileError:C.apexRuntimeError}),(0,F.jsxs)(`span`,{className:K.meta,children:[C.elapsed((i.elapsedMs/1e3).toFixed(2)),` · `,aD.format(new Date(e.run.ranAt))]}),t.codeChanged&&(0,F.jsx)(`span`,{className:K.meta,children:C.apexCodeChanged}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsx)(fp,{})]}),i.result!==`success`&&(0,F.jsxs)(`div`,{className:rD.problem,role:`alert`,children:[(0,F.jsx)(`p`,{className:rD.errorMessage,children:i.result===`compileError`?i.compileProblem:i.exceptionMessage}),a&&(0,F.jsx)(`button`,{type:`button`,className:K.button,"aria-label":C.apexGoTo(a),onClick:()=>r(i.line,i.column),children:a}),i.exceptionStackTrace&&(0,F.jsxs)(`details`,{children:[(0,F.jsx)(`summary`,{children:C.apexStackTrace}),(0,F.jsx)(`pre`,{className:rD.stackTrace,children:i.exceptionStackTrace})]}),i.result===`runtimeError`&&(0,F.jsx)(`p`,{className:K.meta,children:C.apexSideEffects}),(0,F.jsx)(pp,{code:e.run.code,problem:(i.result===`compileError`?i.compileProblem:i.exceptionMessage)??``,...i.line===void 0?{}:{line:i.line},...i.column===void 0?{}:{column:i.column}})]}),i.logsOmitted?(0,F.jsx)(`p`,{className:K.empty,children:C.apexLogTooLarge}):(0,F.jsx)(xD,{logs:i.logs,ranAt:e.run.ranAt})]})}function bD(){try{return localStorage.getItem(cD)===`true`}catch{return!1}}function xD({logs:e,ranAt:t}){let[n,r]=(0,_.useState)(bD),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(0),c=(0,_.useMemo)(()=>n?yf(e):e,[e,n]),l=(0,_.useMemo)(()=>bf(c,i),[c,i]),u=l.length===0?0:Math.min(o,l.length-1),d=e=>{r(e);try{localStorage.setItem(cD,String(e))}catch{}},f=e=>{l.length>0&&s((u+e+l.length)%l.length)};return(0,F.jsxs)(`div`,{className:rD.log,children:[(0,F.jsxs)(`div`,{className:rD.logBar,children:[(0,F.jsx)(`span`,{className:K.title,children:C.apexLog}),(0,F.jsx)(`input`,{className:`${K.input} ${rD.search}`,type:`search`,"aria-label":C.apexLogSearch,placeholder:C.apexLogSearch,value:i,onChange:e=>{a(e.target.value),s(0)},onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Enter`||e.key===`ArrowDown`?(e.preventDefault(),f(e.key===`Enter`&&e.shiftKey?-1:1)):e.key===`ArrowUp`&&(e.preventDefault(),f(-1)))}}),i&&(0,F.jsx)(`span`,{className:K.meta,"aria-live":`polite`,children:C.apexMatches(u+1,l.length,l.length>=1e4)}),(0,F.jsx)(`button`,{type:`button`,className:K.button,"aria-label":C.apexSearchPrevious,disabled:l.length===0,onClick:()=>f(-1),children:`↑`}),(0,F.jsx)(`button`,{type:`button`,className:K.button,"aria-label":C.apexSearchNext,disabled:l.length===0,onClick:()=>f(1),children:`↓`}),(0,F.jsxs)(`label`,{className:rD.toggle,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>d(e.target.checked)}),C.apexUserDebugOnly]}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsx)(XE,{text:c}),(0,F.jsx)(`button`,{type:`button`,className:K.button,disabled:!e,onClick:()=>Kf(e,`apex-${t.replace(/[:.]/g,`-`)}.log`,`text/plain;charset=utf-8`),children:C.apexDownload})]}),c?(0,F.jsx)(RE,{text:c,matches:l,current:u}):(0,F.jsx)(`p`,{className:K.empty,children:n&&e?C.apexNoUserDebug:C.apexLogEmpty})]})}function SD(){let e=gf(),{selectedOrg:t,selected:n}=Ae(),r=e.confirming.reasons.map(e=>e===`production`?C.apexConfirmProduction(t?.alias??n??``):e===`unknownOutcome`?C.apexConfirmUnknown:e===`otherPending`?C.apexConfirmOtherPending:C.apexConfirmNoHistory);return(0,F.jsx)(Ie,{title:C.apexConfirmTitle,message:r.join(`
|
|
203
|
+
`),confirmLabel:C.apexConfirmRun,onConfirm:e.confirmRun,onCancel:e.cancelConfirm})}function CD(e){try{JSON.parse(e)}catch{return}let t=``,n=0,r=!1,i=()=>`
|
|
204
|
+
`+` `.repeat(n);for(let a=0;a<e.length;a++){let o=e[a];if(r)t+=o,o===`\\`?t+=e[++a]:o===`"`&&(r=!1);else if(o===`"`)r=!0,t+=o;else if(o===`{`||o===`[`){let r=o===`{`?`}`:`]`;e.slice(a+1).trimStart().startsWith(r)?(t+=o+r,a=e.indexOf(r,a+1)):(n++,t+=o+i())}else o===`}`||o===`]`?(n--,t+=i()+o):o===`,`?t+=`,`+i():o===`:`?t+=`: `:/\s/.test(o)||(t+=o)}return t}var wD=2097152,TD=204800;function ED(e){if(e.length>wD)return{text:e.slice(0,TD),json:!1,cut:!0};let t=CD(e);return t===void 0?{text:e,json:!1,cut:!1}:{text:t,json:!0,cut:!1}}function DD(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}var OD=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 kD(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,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.reducePos=this.pos=n+e.length;this.pushState(t,n),this.buffer.push(r,n,i,-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 AD(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.storeNode(this.curContext.hash,this.reducePos,this.reducePos,-3,!0)}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 kD(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()}},kD=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},AD=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}},jD=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 MD(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 ND=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},PD=new ND,FD=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=PD,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.next=this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?-1: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=PD,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}},ID=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;zD(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};ID.prototype.contextual=ID.prototype.fallback=ID.prototype.extend=!1;var LD=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?MD(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(zD(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))}};LD.prototype.contextual=ID.prototype.fallback=ID.prototype.extend=!1;var RD=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function zD(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||VD(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 BD(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function VD(e,t,n,r){let i=BD(n,r,t);return i<0||BD(n,r,e)<i}var HD=typeof process<`u`&&/\bparse\b/.test({}.LOG),UD=null;function WD(e,t,n){let r=e.cursor(Ix.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 GD=class{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?WD(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?WD(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 Lx){let n=a>this.lastRepeatPos&&i.type.id>=this.minRepeat;if(a==e||n){let t=a+i.length,r;if(a>=this.safeFrom&&t<=this.safeTo&&(!(r=i.prop(kx.lookAhead))||t+r<this.fragment.to)){if(n&&(this.lastRepeat=i,this.lastRepeatPos=a),a==e)return i}else if(a==e)return null}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}}},KD=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new ND)}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 ND,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 ND,{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=ZD(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(ZD(o,s+2),t,n,r));break}}o[s]==t&&(r=this.putAction(ZD(o,s+1),t,n,r))}return r}},qD=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 FD(t,r),this.tokens=new KD(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[OD.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new GD(n,e.minRepeatTerm):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&&QD(r);if(e)return HD&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw HD&&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 HD&&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}tryReuse(e,t,n,r){if(!n)return null;let i=e.curContext&&e.curContext.tracker.strict,a=i?e.curContext.hash:0;for(;n;){let o=this.parser.nodeSet.types[n.type.id]==n.type?this.parser.getGoto(e.state,n.type.id):-1;if(o>-1&&n.length&&(!i||(n.prop(kx.contextHash)||0)==a))return e.useNode(n,o,t),n;if(n.children.length==0||n.positions[0]>0)break;let s=n.children[0];if(s instanceof Lx&&(!r||s.type.id>=this.parser.minRepeatTerm))n=s;else break}return null}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=HD?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.reducePos<r&&e.buffer.length&&e.buffer[e.buffer.length-2]<=e.reducePos&&this.fragments.lastRepeatPos==e.reducePos&&this.tryReuse(e,e.reducePos,this.fragments.lastRepeat,!0)||this.tryReuse(e,r,this.fragments.nodeAt(r),!1);if(t)return HD&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(t.type.id)})`),!0}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),HD&&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),HD&&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 JD(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=HD?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),HD&&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()&&(HD&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)HD&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))HD&&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),HD&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),JD(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),Lx.build({buffer:jD.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=(UD||=new WeakMap).get(e);return t||UD.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function JD(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 YD=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},XD=class e extends iS{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=kx[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 Nx(t.map((t,i)=>Mx.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=Ex;let a=MD(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($D),this.states=MD(e.states,Uint32Array),this.data=MD(e.stateData),this.goto=MD(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new ID(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 qD(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=ZD(n,i+2)];else if(n[i+1]==2)return ZD(n,i+2);else break}if(a==t||a==0)return ZD(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||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=ZD(this.data,n+2);else break}r=t(ZD(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=ZD(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]=$D(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 YD(e,n,r)}static deserialize(t){return new e(t)}};function ZD(e,t){return e[t]|e[t+1]<<16}function QD(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 $D(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}var eO=fS({String:Q.string,Number:Q.number,"True False":Q.bool,PropertyName:Q.propertyName,Null:Q.null,", :":Q.separator,"[ ]":Q.squareBracket,"{ }":Q.brace}),tO=XD.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:[eO],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}),nO=VS.define({name:`json`,parser:tO.configure({props:[aC.add({Object:hC({except:/^\s*\}/}),Array:hC({except:/^\s*\]/})}),gC.add({"Object Array":_C})]}),languageData:{closeBrackets:{brackets:[`[`,`{`,`"`]},indentOnInput:/^\s*[\}\]]$/}});function rO(){return new QS(nO)}var iO=vC.define([{tag:Q.propertyName,color:`var(--color-syntax-keyword)`},{tag:Q.string,color:`var(--color-syntax-string)`},{tag:[Q.number,Q.bool,Q.null],color:`var(--color-syntax-literal)`}]),aO=X.theme({".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:`var(--color-selection) !important`},".cm-cursor":{borderLeftColor:`var(--color-ink)`}});function oO({initialText:e,label:t,readOnly:n,onChange:r,onModEnter:i,register:a}){let o=(0,_.useRef)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(new pm),l=(0,_.useRef)({onChange:r,onModEnter:i});return(0,_.useEffect)(()=>{l.current={onChange:r,onModEnter:i}}),(0,_.useEffect)(()=>{if(!o.current)return;let r=new X({parent:o.current,state:Wm.create({doc:e,extensions:[hw(),rO(),SC(iO),aO,Kb(`{ }`),X.lineWrapping,X.contentAttributes.of({"aria-label":t}),c.current.of([X.editable.of(!n),Wm.readOnly.of(n)]),dm.highest(Fb.of([{key:`Mod-Enter`,run:()=>(l.current.onModEnter(),!0)}])),Fb.of([...SE,...Pw,CE]),X.updateListener.of(e=>{e.docChanged&&l.current.onChange(e.state.doc.toString())})]})});return s.current=r,a({getText:()=>r.state.doc.toString(),setText:e=>r.dispatch({changes:{from:0,to:r.state.doc.length,insert:e}}),focus:()=>r.focus()}),()=>{a(null),r.destroy(),s.current=null}},[]),(0,_.useEffect)(()=>{s.current?.dispatch({effects:c.current.reconfigure([X.editable.of(!n),Wm.readOnly.of(n)])})},[n]),(0,F.jsx)(`div`,{ref:o,className:AE.editor})}function sO({text:e,isJson:t,label:n}){let r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!r.current)return;let i=new X({parent:r.current,state:Wm.create({doc:e,extensions:[...t?[rO(),SC(iO)]:[],aO,X.lineWrapping,X.editable.of(!1),Wm.readOnly.of(!0),X.contentAttributes.of({"aria-label":n})]})});return()=>i.destroy()},[e,t,n]),(0,F.jsx)(`div`,{ref:r,className:AE.editor})}var $={screen:`_screen_1sr0k_2`,top:`_top_1sr0k_12`,history:`_history_1sr0k_35`,closedRequest:`_closedRequest_1sr0k_42`,list:`_list_1sr0k_50`,item:`_item_1sr0k_56`,itemTop:`_itemTop_1sr0k_73`,sent:`_sent_1sr0k_74`,path:`_path_1sr0k_81`,method:`_method_1sr0k_90`,methodGET:`_methodGET_1sr0k_101`,methodPOST:`_methodPOST_1sr0k_106`,methodPATCH:`_methodPATCH_1sr0k_111`,methodPUT:`_methodPUT_1sr0k_116`,methodDELETE:`_methodDELETE_1sr0k_121`,status2:`_status2_1sr0k_126`,status3:`_status3_1sr0k_131`,status4:`_status4_1sr0k_136`,status5:`_status5_1sr0k_141`,statusUnknown:`_statusUnknown_1sr0k_146`,statusChip:`_statusChip_1sr0k_151`,request:`_request_1sr0k_156`,line:`_line_1sr0k_161`,methodSelect:`_methodSelect_1sr0k_169`,pathInput:`_pathInput_1sr0k_180`,hint:`_hint_1sr0k_187`,tabs:`_tabs_1sr0k_194`,response:`_response_1sr0k_202`,tab:`_tab_1sr0k_194`,count:`_count_1sr0k_222`,tabBody:`_tabBody_1sr0k_231`,noBody:`_noBody_1sr0k_243`,headerRows:`_headerRows_1sr0k_250`,headerRow:`_headerRow_1sr0k_250`,headerName:`_headerName_1sr0k_264`,headerValue:`_headerValue_1sr0k_269`,sending:`_sending_1sr0k_286`,resultBox:`_resultBox_1sr0k_294`,unknown:`_unknown_1sr0k_301`,error:`_error_1sr0k_310`,errorMessage:`_errorMessage_1sr0k_318`,proposalLine:`_proposalLine_1sr0k_324`};function cO(){let e=Wf();return(0,F.jsx)(tp,{session:e,stepText:e.step&&C.aiThinking,onGenerate:e.generate,placeholder:e.sendPrevious?C.aiPreviousPlaceholder:C.aiRestPlaceholder,attention:e.attention,sends:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(rp,{text:C.aiSendMetadata}),e.hasCurrent&&(0,F.jsx)(ip,{text:C.aiSendCurrentRequest,checked:e.sendCurrent,onChange:e.setSendCurrent}),e.hasPrevious&&(0,F.jsx)(ip,{text:C.aiSendPrevious,title:C.aiSendPreviousHint,checked:e.sendPrevious,onChange:e.setSendPrevious})]})})}function lO(){let e=Wf(),t=Bf(),n=e.proposal;return n?(0,F.jsxs)(op,{explanation:n.explanation,onDiscard:e.discard,actions:(0,F.jsx)(`button`,{type:`button`,className:`${K.button} ${K.primary}`,onClick:e.apply,children:C.aiReplace}),children:[(0,F.jsxs)(`p`,{className:$.proposalLine,"aria-label":C.aiProposalRequest,children:[(0,F.jsx)(`span`,{className:`${$.method} ${$[`method${n.method}`]}`,children:n.method}),(0,F.jsx)(`code`,{className:$.path,children:n.path})]}),n.body.trim()!==``&&(0,F.jsx)(sp,{before:n.before,after:n.body,stale:t.getBody()!==n.before})]}):null}function uO(){let e=Wf(),{setOpen:t}=Ft();return e.availability!==`ready`||!e.hasPrevious?null:(0,F.jsx)(`button`,{type:`button`,className:K.button,"aria-pressed":e.sendPrevious,title:C.aiSendPreviousHint,onClick:()=>{e.sendPrevious||t(`restRequest`,!0),e.takeResult(!e.sendPrevious)},children:e.sendPrevious?C.aiUsingResult:C.aiUseResult})}function dO({sent:e,status:t,body:n}){let r=Wf();return r.availability!==`ready`||t<400?null:(0,F.jsx)(`button`,{type:`button`,className:K.button,disabled:r.running,title:C.aiSendError,onClick:()=>r.fix(e,t,n),children:C.aiFix})}var fO=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),pO=[`restRequest`,`restHistory`];function mO(){return(0,F.jsx)(Pt,{storageKey:`sfbench.restPanels`,names:pO,children:(0,F.jsx)(hO,{})})}function hO(){let e=Bf(),{open:t,setOpen:n}=Ft();return(0,F.jsxs)(`div`,{className:$.screen,children:[(0,F.jsx)(SO,{}),(0,F.jsxs)(`div`,{className:$.top,hidden:!t.restRequest,children:[(0,F.jsx)(CO,{}),t.restHistory?(0,F.jsx)(yO,{}):(0,F.jsx)(tD,{label:C.showRestHistory,text:C.restHistory,onClick:()=>n(`restHistory`,!0)})]}),!t.restRequest&&(0,F.jsx)(_O,{}),(0,F.jsx)(nD,{open:t.restRequest,showLabel:C.showRestRequest,hideLabel:C.hideRestRequest,onToggle:()=>n(`restRequest`,!t.restRequest)}),(0,F.jsx)(TO,{}),e.confirming&&(0,F.jsx)(AO,{})]})}function gO(){let e=Bf();return(0,F.jsx)(`button`,{type:`button`,className:`${K.button} ${K.primary}`,disabled:e.sending||!e.path.trim(),onClick:e.send,children:e.sending?C.restSending:C.restSend})}function _O(){let e=Bf();return(0,F.jsxs)(`div`,{className:`${K.panel} ${$.closedRequest}`,children:[(0,F.jsx)(vO,{method:e.method}),(0,F.jsx)(`span`,{className:$.path,title:e.path,children:e.path.trim()||(0,F.jsx)(`span`,{className:K.meta,children:C.restNoPath})}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsx)(gO,{})]})}function vO({method:e}){return(0,F.jsx)(`span`,{className:`${$.method} ${$[`method${e}`]}`,children:e})}function yO(){let e=Bf();return(0,F.jsxs)(`section`,{className:`${K.panel} ${$.history}`,"aria-label":C.restHistory,children:[(0,F.jsxs)(`div`,{className:K.header,children:[(0,F.jsx)(`span`,{className:K.title,children:C.restHistory}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsx)($E,{label:C.reloadRestHistory,busy:e.historyLoading,onClick:e.refreshHistory}),(0,F.jsx)(YE,{name:`restHistory`,label:C.hideRestHistory,side:`right`})]}),(0,F.jsxs)(`div`,{className:K.body,children:[e.history.length===0&&(0,F.jsx)(`p`,{className:K.empty,children:e.historyLoading?C.loading:C.restHistoryEmpty}),(0,F.jsx)(`ul`,{className:$.list,children:e.history.map(t=>(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,className:$.item,onClick:()=>e.loadEntry(t),title:t.path,children:[(0,F.jsxs)(`span`,{className:$.itemTop,children:[(0,F.jsx)(vO,{method:t.method}),(0,F.jsx)(`span`,{className:$.path,children:t.path})]}),(0,F.jsxs)(`span`,{className:K.meta,children:[fO.format(new Date(t.sentAt)),` `,(0,F.jsx)(bO,{entry:t})]})]})},t.id))})]})]})}function bO({entry:e}){let{outcome:t}=e;return t.state===`done`?(0,F.jsx)(`span`,{className:xO(t.status),children:t.status}):(0,F.jsx)(`span`,{className:$.statusUnknown,children:t.state===`pending`?C.restPendingShort:C.restUnknownShort})}function xO(e){return e>=500?$.status5:e>=400?$.status4:e>=300?$.status3:$.status2}function SO(){let e=Bf(),[t,n]=(0,_.useState)(!1);return(0,F.jsxs)(F.Fragment,{children:[e.launchNotice&&(0,F.jsx)(QE,{text:C.restLaunchNotice,onClose:e.closeNotice}),e.restLeftOutFor!==void 0&&!t&&(0,F.jsx)(QE,{text:C.restLeftOut(e.restLeftOutFor),onClose:()=>n(!0)})]})}function CO(){let e=Bf(),[t,n]=(0,_.useState)(`body`),[r,i]=(0,_.useState)(),a=nt(e.method);(0,_.useEffect)(()=>{if(!r)return;let e=setTimeout(()=>i(void 0),4e3);return()=>clearTimeout(e)},[r]);let o=()=>i(C.restModEnterHint);return(0,F.jsxs)(`section`,{className:`${K.panel} ${$.request}`,"aria-label":C.restRequest,children:[(0,F.jsx)(cO,{}),(0,F.jsx)(lO,{}),(0,F.jsxs)(`div`,{className:$.line,children:[(0,F.jsx)(`label`,{className:`visually-hidden`,htmlFor:`rest-method`,children:C.restMethod}),(0,F.jsx)(`select`,{id:`rest-method`,className:`${$.methodSelect} ${$[`method${e.method}`]}`,value:e.method,onChange:t=>e.setMethod(t.target.value),children:tt.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))}),(0,F.jsx)(`label`,{className:`visually-hidden`,htmlFor:`rest-path`,children:C.restPath}),(0,F.jsx)(`input`,{id:`rest-path`,className:`${K.input} ${$.pathInput}`,value:e.path,placeholder:C.restPathPlaceholder,spellCheck:!1,autoComplete:`off`,onChange:t=>e.setPath(t.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),o())}}),(0,F.jsx)(gO,{})]}),r&&(0,F.jsx)(`p`,{className:$.hint,role:`status`,children:r}),(0,F.jsxs)(`div`,{className:$.tabs,role:`tablist`,children:[(0,F.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===`body`,className:$.tab,onClick:()=>n(`body`),children:C.restBody}),(0,F.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===`headers`,className:$.tab,onClick:()=>n(`headers`),children:[C.restHeaders,e.headers.length>0&&(0,F.jsx)(`span`,{className:$.count,children:e.headers.length})]}),(0,F.jsx)(`span`,{className:K.spacer}),t===`body`&&a&&(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:()=>{let t=CD(e.getBody());t===void 0?i(C.restCannotFormat):e.setBody(t)},children:C.restFormat})]}),(0,F.jsxs)(`div`,{className:$.tabBody,hidden:t!==`body`,children:[!a&&(0,F.jsx)(`p`,{className:$.noBody,children:C.restNoBody(e.method)}),(0,F.jsx)(oO,{initialText:e.initialBody,label:C.restBodyLabel,readOnly:!a,onChange:e.onBodyChange,onModEnter:o,register:e.registerBody})]}),t===`headers`&&(0,F.jsx)(wO,{})]})}function wO(){let e=Bf(),t=e.headers,n=(n,r)=>e.setHeaders(t.map((e,t)=>t===n?{...e,...r}:e));return(0,F.jsxs)(`div`,{className:$.tabBody,children:[(0,F.jsx)(`ul`,{className:$.headerRows,children:t.map((r,i)=>(0,F.jsxs)(`li`,{className:$.headerRow,children:[(0,F.jsx)(`input`,{className:`${K.input} ${$.headerName}`,"aria-label":C.restHeaderName,value:r.name,spellCheck:!1,onChange:e=>n(i,{name:e.target.value})}),(0,F.jsx)(`input`,{className:`${K.input} ${$.headerValue}`,"aria-label":C.restHeaderValue,value:r.value,spellCheck:!1,onChange:e=>n(i,{value:e.target.value})}),(0,F.jsx)(`button`,{type:`button`,className:K.button,"aria-label":C.restRemoveHeader(r.name),onClick:()=>e.setHeaders(t.filter((e,t)=>t!==i)),children:`×`})]},i))}),(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:()=>e.setHeaders([...t,{name:``,value:``}]),children:C.restAddHeader})]})}function TO(){let e=Bf(),{result:t}=e;return(0,F.jsx)(`section`,{className:`${K.panel} ${$.response}`,"aria-label":C.restResponse,"aria-busy":e.sending,children:e.sending?(0,F.jsx)(EO,{}):(0,F.jsx)(DO,{result:t})})}function EO(){let e=Bf(),{settings:t}=he();return(0,F.jsxs)(`div`,{className:$.sending,children:[(0,F.jsx)(`p`,{className:K.empty,children:C.restSending}),e.sendingChangesData&&(0,F.jsx)(`p`,{className:K.meta,children:C.restWaiting(t?.requestTimeoutSeconds??120)}),!e.sendingChangesData&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:e.cancel,children:C.cancel}),(0,F.jsx)(`p`,{className:K.meta,children:C.restCancelNote})]})]})}function DO({result:e}){let[t,n]=(0,_.useState)(`body`);if(e.state===`idle`)return(0,F.jsx)(`p`,{className:K.empty,children:C.restNotSent});let r=(0,F.jsxs)(`span`,{className:$.sent,children:[(0,F.jsx)(vO,{method:e.request.method}),(0,F.jsx)(`span`,{className:$.path,children:e.request.path})]});if(e.state===`unknown`)return(0,F.jsxs)(`div`,{className:$.resultBox,children:[r,(0,F.jsx)(`div`,{className:$.unknown,role:`alert`,children:e.message})]});if(e.state===`error`)return(0,F.jsxs)(`div`,{className:$.resultBox,children:[r,(0,F.jsxs)(`div`,{className:$.error,role:`alert`,children:[(0,F.jsx)(`p`,{className:$.errorMessage,children:e.message}),e.reloginCommand&&(0,F.jsx)(Ke,{command:e.reloginCommand}),(0,F.jsx)(_t,{details:e.details})]})]});let{response:i}=e;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:K.header,children:[(0,F.jsx)(`span`,{className:`${$.statusChip} ${xO(i.status)}`,children:i.status}),(0,F.jsxs)(`span`,{className:K.meta,children:[C.elapsed((i.elapsedMs/1e3).toFixed(2)),` · `,DD(i.size)]}),r,(0,F.jsx)(dO,{sent:e.request,status:i.status,body:i.body}),(0,F.jsx)(uO,{}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsxs)(`div`,{className:$.tabs,role:`tablist`,children:[(0,F.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===`body`,className:$.tab,onClick:()=>n(`body`),children:C.restBody}),(0,F.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===`headers`,className:$.tab,onClick:()=>n(`headers`),children:C.restHeaders})]}),(0,F.jsx)(XE,{text:t===`body`?i.body:OO(i.headers)})]}),t===`body`?(0,F.jsx)(kO,{body:i.body,omitted:i.bodyOmitted}):(0,F.jsx)(sO,{text:OO(i.headers),isJson:!1,label:C.restHeaders})]})}function OO(e){return Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`
|
|
205
|
+
`)}function kO({body:e,omitted:t}){let n=(0,_.useMemo)(()=>ED(e),[e]);if(t){let e=t===`binary`?C.restBodyBinary:t===`tooLarge`?C.restBodyTooLarge:C.restBodyIncomplete;return(0,F.jsx)(`p`,{className:K.empty,children:e})}return e?(0,F.jsxs)(F.Fragment,{children:[n.cut&&(0,F.jsx)(`p`,{className:$.hint,children:C.restBodyCut}),(0,F.jsx)(sO,{text:n.text,isJson:n.json,label:C.restResponse})]}):(0,F.jsx)(`p`,{className:K.empty,children:C.restBodyEmpty})}function AO(){let e=Bf(),{selectedOrg:t,selected:n}=Ae(),r=e.confirming,i=C.restSentRequest(r.request.method,r.request.path),a=r.reasons.map(e=>e===`production`?C.restConfirmProduction(t?.alias??n??``,i):e===`unknownOutcome`?C.restConfirmUnknown:C.restConfirmNoHistory);return(0,F.jsx)(Ie,{title:C.restConfirmTitle,message:a.join(`
|
|
206
|
+
`),confirmLabel:C.restConfirmSend,onConfirm:e.confirmSend,onCancel:e.cancelConfirm})}var jO={toolbar:`_toolbar_vmlw0_1`,check:`_check_vmlw0_5`,shortcut:`_shortcut_vmlw0_11`},MO=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=HS(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(zO(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 NO(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 PO(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=NO(t)+NO(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function FO(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:PO(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function IO(e,t){return n=>{for(let t=HS(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 LO=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function RO(e){return e.selection.main.from}function zO(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 BO=Em.define();function VO(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:q.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var HO=new WeakMap;function UO(e){if(!Array.isArray(e))return e;let t=HO.get(e);return t||HO.set(e,t=FO(e)),t}var WO=km.define(),GO=km.define(),KO=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=Bp(e,t),r=Hp(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(Bp(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=Bp(e,0),i=Hp(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=Bp(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=Hp(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=Bp(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=Vp(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+=Hp(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?Hp(Bp(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)}},qO=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)}},JO=J.define({combine(e){return Gm(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:XO,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=>YO(e(n),t(n)),optionClass:(e,t)=>n=>YO(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function YO(e,t){return e?t?e+` `+t:e:t}function XO(e,t,n,r,i,a){let o=e.textDirection==Ag.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 ZO=km.define();function QO(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 $O(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 ek=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(JO);this.optionContent=QO(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=$O(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:ZO.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(JO).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:GO.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=$O(r.length,i,e.state.facet(JO).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=$O(t.options.length,t.selected,this.view.state.facet(JO).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=>m_(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&&nk(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(JO).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 tk(e,t){return n=>new ek(n,e,t)}function nk(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 rk(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function ik(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(JO);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 LO(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new qO(n):new KO(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 LO(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):rk(e.completion)>rk(c)&&(s[s.length-1]=e),c=e.completion}return s}var ak=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,uk(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=ik(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(JO).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,uk(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:yk,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)}},ok=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(dk,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(JO),i=(r.override||n.languageDataAt(`autocomplete`,RO(n)).map(UO)).map(e=>(this.active.find(t=>t.source==e)||new pk(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(gk));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!sk(i,this.active)||o?a=ak.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 pk(e.source,0):e));for(let e of t.effects)e.is(ZO)&&(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?ck:lk}};function sk(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 ck={"aria-autocomplete":`list`},lk={};function uk(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var dk=[];function fk(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(BO);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 pk=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=fk(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(WO))i=new e(i.source,1,n.value);else if(n.is(GO))i=new e(i.source,0);else if(n.is(gk))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(RO(e.state))}},mk=class e extends pk{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=RO(t.state);if(o>a||!r||n&2&&(RO(t.startState)==this.from||o<this.limit))return new pk(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return hk(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 MO(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??RO(t.state)):new pk(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new pk(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function hk(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):zO(e,!0).test(i)}var gk=km.define({map(e,t){return e.map(e=>e.map(t))}}),_k=cm.define({create(){return ok.start()},update(e,t){return e.update(t)},provide:e=>[rx.from(e,e=>e.tooltip),X.contentAttributes.from(e,e=>e.attrs)]});function vk(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(_k).active.find(e=>e.source==t.source);return r instanceof mk&&(typeof n==`string`?e.dispatch({...VO(e.state,n,r.from,r.to),annotations:BO.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var yk=tk(_k,vk);function bk(e,t=`option`){return n=>{let r=n.state.field(_k,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(JO).interactionDelay)return!1;let i=1,a;t==`page`&&(a=ix(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:ZO.of(s)}),!0}}var xk=e=>{let t=e.state.field(_k,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(JO).interactionDelay?!1:vk(e,t.open.options[t.open.selected])},Sk=e=>e.state.field(_k,!1)?(e.dispatch({effects:WO.of(!0)}),!0):!1,Ck=e=>{let t=e.state.field(_k,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:GO.of(null)}),!0)},wk=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},Tk=50,Ek=1e3,Dk=v_.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(_k).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(_k),n=e.state.facet(JO);if(!e.selectionSet&&!e.docChanged&&e.startState.field(_k)==t)return;let r=e.transactions.some(e=>{let t=fk(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>Tk&&Date.now()-n.time>Ek){for(let e of n.context.abortListeners)try{e()}catch(e){m_(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(WO)))&&(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(_k);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(JO).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new MO(t,RO(t),e.explicit,this.view),r=new wk(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:GO.of(null)}),m_(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(JO).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(JO),n=this.view.state.field(_k);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=RO(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new mk(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 pk(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:gk.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(_k,!1);if(t&&t.tooltip&&this.view.state.facet(JO).closeOnBlur){let n=t.open&&ix(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:GO.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:WO.of(!1)}),20),this.composing=0}}}),Ok=typeof navigator==`object`&&/Win/.test(navigator.platform),kk=dm.highest(X.domEventHandlers({keydown(e,t){let n=t.state.field(_k,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Ok&&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&&vk(t,r),!1}})),Ak=X.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`}}}),jk=new class extends Km{};jk.startSide=1,jk.endSide=-1,typeof navigator==`object`&&navigator.userAgent;function Mk(e={}){return[kk,_k,JO.of(e),Dk,Pk,Ak]}var Nk=[{key:`Ctrl-Space`,run:Sk},{mac:"Alt-`",run:Sk},{mac:`Alt-i`,run:Sk},{key:`Escape`,run:Ck},{key:`ArrowDown`,run:bk(!0)},{key:`ArrowUp`,run:bk(!1)},{key:`PageDown`,run:bk(!0,`page`)},{key:`PageUp`,run:bk(!1,`page`)},{key:`Enter`,run:xk}],Pk=dm.highest(Fb.computeN([JO],e=>e.facet(JO).defaultKeymap?[Nk]:[])),Fk=36,Ik=1,Lk=2,Rk=3,zk=4,Bk=5,Vk=6,Hk=7,Uk=8,Wk=9,Gk=10,Kk=11,qk=12,Jk=13,Yk=14,Xk=15,Zk=16,Qk=17,$k=18,eA=19,tA=20,nA=21,rA=22,iA=23,aA=24;function oA(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function sA(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function cA(e,t,n){for(let r=!1;;){if(e.next<0)return;if(e.next==t&&!r){e.advance();return}r=n&&!r&&e.next==92,e.advance()}}function lA(e,t){scan:for(;;){if(e.next<0)return;if(e.next==36){e.advance();for(let n=0;n<t.length;n++){if(e.next!=t.charCodeAt(n))continue scan;e.advance()}if(e.next==36){e.advance();return}}else e.advance()}}function uA(e,t){let n=`[{<(`.indexOf(String.fromCharCode(t)),r=n<0?t:`]}>)`.charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==r&&e.peek(1)==39){e.advance(2);return}e.advance()}}function dA(e,t){for(;e.next==95||oA(e.next);)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function fA(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),cA(e,t,!1)}else dA(e)}function pA(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function mA(e,t){for(;;){if(e.next==46){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(e.next==69||e.next==101)for(e.advance(),(e.next==43||e.next==45)&&e.advance();e.next>=48&&e.next<=57;)e.advance()}function hA(e){for(;!(e.next<0||e.next==10);)e.advance()}function gA(e,t){for(let n=0;n<t.length;n++)if(t.charCodeAt(n)==e)return!0;return!1}var _A=` \r
|
|
207
|
+
`;function vA(e,t,n){let r=Object.create(null);r.true=r.false=Bk,r.null=r.unknown=Vk;for(let t of e.split(` `))t&&(r[t]=tA);for(let e of t.split(` `))e&&(r[e]=nA);for(let e of(n||``).split(` `))e&&(r[e]=aA);return r}var yA={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:`*+-%<>!=&|~^/`,specialVar:`?`,identifierQuotes:`"`,caseInsensitiveIdentifiers:!1,words:vA(`absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone `,`array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying `)};function bA(e,t,n,r){let i={};for(let t in yA)i[t]=(e.hasOwnProperty(t)?e:yA)[t];return t&&(i.words=vA(t,n||``,r)),i}function xA(e){return new RD(t=>{let{next:n}=t;if(t.advance(),gA(n,_A)){for(;gA(t.next,_A);)t.advance();t.acceptToken(Fk)}else if(n==36&&e.doubleDollarQuotedStrings){let e=dA(t,``);t.next==36&&(t.advance(),lA(t,e),t.acceptToken(Rk))}else if(n==39||n==34&&e.doubleQuotedStrings)cA(t,n,e.backslashEscapes),t.acceptToken(Rk);else if(n==35&&e.hashComments||n==47&&t.next==47&&e.slashComments)hA(t),t.acceptToken(Ik);else if(n==45&&t.next==45&&(!e.spaceAfterDashes||t.peek(1)==32))hA(t),t.acceptToken(Ik);else if(n==47&&t.next==42){t.advance();for(let e=1;;){let n=t.next;if(t.next<0)break;if(t.advance(),n==42&&t.next==47){if(e--,t.advance(),!e)break}else n==47&&t.next==42&&(e++,t.advance())}t.acceptToken(Lk)}else if((n==101||n==69)&&t.next==39)t.advance(),cA(t,39,!0),t.acceptToken(Rk);else if((n==110||n==78)&&t.next==39&&e.charSetCasts)t.advance(),cA(t,39,e.backslashEscapes),t.acceptToken(Rk);else if(n==95&&e.charSetCasts)for(let n=0;;n++){if(t.next==39&&n>1){t.advance(),cA(t,39,e.backslashEscapes),t.acceptToken(Rk);break}if(!oA(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(n==113||n==81)&&t.next==39&&t.peek(1)>0&&!gA(t.peek(1),_A)){let e=t.peek(1);t.advance(2),uA(t,e),t.acceptToken(Rk)}else if(gA(n,e.identifierQuotes))cA(t,n==91?93:n,!1),t.acceptToken(eA);else if(n==40)t.acceptToken(Hk);else if(n==41)t.acceptToken(Uk);else if(n==123)t.acceptToken(Wk);else if(n==125)t.acceptToken(Gk);else if(n==91)t.acceptToken(Kk);else if(n==93)t.acceptToken(qk);else if(n==59)t.acceptToken(Jk);else if(e.unquotedBitLiterals&&n==48&&t.next==98)t.advance(),pA(t),t.acceptToken(rA);else if((n==98||n==66)&&(t.next==39||t.next==34)){let n=t.next;t.advance(),e.treatBitsAsBytes?(cA(t,n,e.backslashEscapes),t.acceptToken(iA)):(pA(t,n),t.acceptToken(rA))}else if(n==48&&(t.next==120||t.next==88)||(n==120||n==88)&&t.next==39){let e=t.next==39;for(t.advance();sA(t.next);)t.advance();e&&t.next==39&&t.advance(),t.acceptToken(zk)}else if(n==46&&t.next>=48&&t.next<=57)mA(t,!0),t.acceptToken(zk);else if(n==46)t.acceptToken(Yk);else if(n>=48&&n<=57)mA(t,!1),t.acceptToken(zk);else if(gA(n,e.operatorChars)){for(;gA(t.next,e.operatorChars);)t.advance();t.acceptToken(Xk)}else if(gA(n,e.specialVar))t.next==n&&t.advance(),fA(t),t.acceptToken(Qk);else if(n==58||n==44)t.acceptToken(Zk);else if(oA(n)){let r=dA(t,String.fromCharCode(n));t.acceptToken(t.next==46||t.peek(-r.length-1)==46?$k:e.words[r.toLowerCase()]??$k)}})}var SA=xA(yA),CA=XD.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:`⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement`,maxTerm:38,nodeProps:[[`isolate`,-4,1,2,3,19,``]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:`RORO`,tokenizers:[0,SA],topRules:{Script:[0,25]},tokenPrec:0});function wA(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function TA(e,t){let n=e.sliceString(t.from,t.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(n);return r?r[2]:n}function EA(e){return e&&(e.name==`Identifier`||e.name==`QuotedIdentifier`)}function DA(e,t){if(t.name==`CompositeIdentifier`){let n=[];for(let r=t.firstChild;r;r=r.nextSibling)EA(r)&&n.push(TA(e,r));return n}return[TA(e,t)]}function OA(e,t){for(let n=[];;){if(!t||t.name!=`.`)return n;let r=wA(t);if(!EA(r))return n;n.unshift(TA(e,r)),t=wA(r)}}function kA(e,t){let n=HS(e).resolveInner(t,-1),r=jA(e.doc,n);return n.name==`Identifier`||n.name==`QuotedIdentifier`||n.name==`Keyword`?{from:n.from,quoted:n.name==`QuotedIdentifier`?e.doc.sliceString(n.from,n.from+1):null,parents:OA(e.doc,wA(n)),aliases:r}:n.name==`.`?{from:t,quoted:null,parents:OA(e.doc,n),aliases:r}:{from:t,quoted:null,parents:[],empty:!0,aliases:r}}var AA=new Set(`where group having order union intersect except all distinct limit offset fetch for`.split(` `));function jA(e,t){let n;for(let e=t;!n;e=e.parent){if(!e)return null;e.name==`Statement`&&(n=e)}let r=null;for(let t=n.firstChild,i=!1,a=null;t;t=t.nextSibling){let n=t.name==`Keyword`?e.sliceString(t.from,t.to).toLowerCase():null,o=null;if(!i)i=n==`from`;else if(n==`as`&&a&&EA(t.nextSibling))o=TA(e,t.nextSibling);else if(n&&AA.has(n))break;else a&&EA(t)&&(o=TA(e,t));o&&(r||=Object.create(null),r[o]=DA(e,a)),a=/Identifier$/.test(t.name)?t:null}return r}function MA(e,t,n){return n.map(n=>({...n,label:n.label[0]==e?n.label:e+n.label+t,apply:void 0}))}var NA=/^\w*$/,PA=/^[`'"\[]?\w*[`'"\]]?$/;function FA(e){return e.self&&typeof e.self.label==`string`}var IA=class e{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(t){let n=this.children||=Object.create(null);return n[t]||(t&&!this.list.some(e=>e.label==t)&&this.list.push(LA(t,`type`,this.idQuote,this.idCaseInsensitive)),n[t]=new e(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(t=>t.label==e.label);t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion(typeof t==`string`?LA(t,`property`,this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):FA(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let n=e[t],r=null,i=t.replace(/\\?\./g,e=>e==`.`?`\0`:e).split(`\0`),a=this;FA(n)&&(r=n.self,n=n.children);for(let e=0;e<i.length;e++)r&&e==i.length-1&&a.addCompletion(r),a=a.child(i[e].replace(/\\\./g,`.`));a.addNamespace(n)}}};function LA(e,t,n,r){return RegExp(`^[a-z_][a-z_\\d]*$`,r?`i`:``).test(e)?{label:e,type:t}:{label:e,type:t,apply:n+e+RA(n)}}function RA(e){return e===`[`?`]`:e}function zA(e,t,n,r,i,a){let o=new IA(a?.spec.identifierQuotes?.[0]||`"`,!!a?.spec.caseInsensitiveIdentifiers),s=i?o.child(i):null;return o.addNamespace(e),t&&(s||o).addCompletions(t),n&&o.addCompletions(n),s&&o.addCompletions(s.list),r&&o.addCompletions((s||o).child(r).list),e=>{let{parents:t,from:n,quoted:i,empty:a,aliases:c}=kA(e.state,e.pos);if(a&&!e.explicit)return null;c&&t.length==1&&(t=c[t[0]]||t);let l=o;for(let e of t){for(;!l.children||!l.children[e];)if(l==o&&s)l=s;else if(l==s&&r)l=l.child(r);else return null;let t=l.maybeChild(e);if(!t)return null;l=t}let u=l.list;if(l==o&&c&&(u=u.concat(Object.keys(c).map(e=>({label:e,type:`constant`})))),i){let t=i[0],r=RA(t);return{from:n,to:e.state.sliceDoc(e.pos,e.pos+1)==r?e.pos+1:void 0,options:MA(t,r,u),validFor:PA}}return{from:n,options:u,validFor:NA}}}function BA(e){return e==nA?`type`:e==tA?`keyword`:`variable`}function VA(e,t,n){return IO([`QuotedIdentifier`,`String`,`LineComment`,`BlockComment`,`.`],FO(Object.keys(e).map(r=>n(t?r.toUpperCase():r,BA(e[r])))))}var HA=CA.configure({props:[aC.add({Statement:hC()}),gC.add({Statement(e,t){return{from:Math.min(e.from+100,t.doc.lineAt(e.from).to),to:e.to}},BlockComment(e){return{from:e.from+2,to:e.to-2}}}),fS({Keyword:Q.keyword,Type:Q.typeName,Builtin:Q.standard(Q.name),Bits:Q.number,Bytes:Q.string,Bool:Q.bool,Null:Q.null,Number:Q.number,String:Q.string,Identifier:Q.name,QuotedIdentifier:Q.special(Q.string),SpecialVar:Q.special(Q.name),LineComment:Q.lineComment,BlockComment:Q.blockComment,Operator:Q.operator,"Semi Punctuation":Q.punctuation,"( )":Q.paren,"{ }":Q.brace,"[ ]":Q.squareBracket})]}),UA=class e{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}configureLanguage(t,n){return new e(this.dialect,this.language.configure(t,n),this.spec)}static define(t){let n=bA(t,t.keywords,t.types,t.builtin),r=VS.define({name:`sql`,parser:HA.configure({tokenizers:[{from:SA,to:xA(n)}]}),languageData:{commentTokens:{line:`--`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]}}});return new e(n,r,t)}};function WA(e,t){return{label:e,type:t,boost:-1}}function GA(e,t=!1,n){return VA(e.dialect.words,t,n||WA)}function KA(e){return e.schema?zA(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||YA):()=>null}function qA(e){return e.schema?(e.dialect||YA).language.data.of({autocomplete:KA(e)}):[]}function JA(e={}){let t=e.dialect||YA;return new QS(t.language,[qA(e),t.language.data.of({autocomplete:GA(t,e.upperCaseKeywords,e.keywordCompletion)})])}var YA=UA.define({}),XA=`SELECT.FROM.WHERE.AND.OR.NOT.IN.NOT IN.LIKE.INCLUDES.EXCLUDES.NULL.TRUE.FALSE.ORDER BY.ASC.DESC.NULLS FIRST.NULLS LAST.GROUP BY.HAVING.LIMIT.OFFSET.FOR VIEW.FOR REFERENCE.FOR UPDATE.WITH SECURITY_ENFORCED.WITH USER_MODE.WITH SYSTEM_MODE.USING SCOPE.TYPEOF.WHEN.THEN.ELSE.END.COUNT().COUNT_DISTINCT().SUM().AVG().MIN().MAX().FIELDS(ALL).FIELDS(STANDARD).FIELDS(CUSTOM).TODAY.YESTERDAY.TOMORROW.LAST_WEEK.THIS_WEEK.NEXT_WEEK.LAST_MONTH.THIS_MONTH.NEXT_MONTH.LAST_90_DAYS.NEXT_90_DAYS.THIS_QUARTER.LAST_QUARTER.NEXT_QUARTER.THIS_YEAR.LAST_YEAR.NEXT_YEAR.LAST_N_DAYS:.NEXT_N_DAYS:`.split(`.`);function ZA(e,...t){let n=e.toLowerCase();return t.some(e=>e?.toLowerCase().includes(n))}function QA(e,t,n){let r=t.toLowerCase(),i=e=>{let t=n(e).findIndex(e=>e?.toLowerCase().startsWith(r));return t===-1?2**53-1:t};return e.map((e,t)=>({item:e,index:t,rank:i(e)})).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.item)}function $A(e,t,n){return QA(e.filter(e=>ZA(t,e.name,e.label)),t,e=>[e.name,e.label]).map(e=>{let t=ad(e.name,n.ns,n.omitNamespace);return{label:`${t} / ${e.label}`,insert:t,secondary:e.label,kind:`field`}})}function ej(e){return QA(XA.filter(t=>ZA(e,t)),e,e=>[e]).map(e=>({label:e,insert:e,kind:`keyword`}))}async function tj(e,t,n){let r=e.from;if(r){if(e.child){let i=e.parent&&await tj(e.parent,t,n);return i?od((await t.describe(i)).childRelationships.flatMap(e=>e.relationshipName?[{...e,name:e.relationshipName}]:[]),r,n)?.childSObject:void 0}return od(await t.objects(),r,n)?.name}}async function nj(e,t,n,r){for(let i of t){if(!e)return;let t=G(i,r);e=(await n.describe(e)).fields.find(e=>e.relationshipName&&G(e.relationshipName,r)===t)?.referenceTo[0]}return e}async function rj(e,t,n){let{context:r,word:i}=e;switch(r.kind){case`none`:return[];case`keyword`:return e.dotted?[]:ej(i);case`from`:if(r.scope.child){let e=r.scope.parent&&await tj(r.scope.parent,t,n.ns);return e?QA((await t.describe(e)).childRelationships.filter(e=>!!e.relationshipName).filter(e=>ZA(i,e.relationshipName,e.childSObject)),i,e=>[e.relationshipName,e.childSObject]).map(e=>{let t=ad(e.relationshipName,n.ns,n.omitNamespace);return{label:`${t} / ${e.childSObject}`,insert:t,kind:`relationship`}}):[]}return QA((await t.objects()).filter(e=>e.queryable!==!1&&ZA(i,e.name,e.label)),i,e=>[e.name,e.label]).map(e=>{let t=ad(e.name,n.ns,n.omitNamespace);return{label:`${t} / ${e.label}`,insert:t,kind:`object`}});case`field`:{let a=await nj(await tj(r.scope,t,n.ns),r.path,t,n.ns),o=a?$A((await t.describe(a)).fields,i,n):[];return e.dotted?o:QA([...o,...ej(i)],i,e=>[e.insert,e.secondary])}}}var ij=UA.define({keywords:`select from where and or not in like includes excludes null true false order by asc desc nulls first last group having limit offset for view reference update with security_enforced user_mode system_mode using scope typeof when then else end rollup cube`,builtin:`count count_distinct sum avg min max fields all standard custom today yesterday tomorrow last_week this_week next_week last_month this_month next_month last_90_days next_90_days this_quarter last_quarter next_quarter this_year last_year next_year`}),aj=vC.define([{tag:Q.keyword,color:`var(--color-syntax-keyword)`,fontWeight:`600`},{tag:[Q.standard(Q.name),Q.function(Q.variableName)],color:`var(--color-syntax-builtin)`},{tag:Q.string,color:`var(--color-syntax-string)`},{tag:[Q.number,Q.bool,Q.null],color:`var(--color-syntax-literal)`},{tag:Q.comment,color:`var(--color-muted)`}]),oj=X.theme({".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:`var(--color-selection) !important`},".cm-cursor":{borderLeftColor:`var(--color-ink)`}}),sj=300,cj=3e4,lj={object:`class`,relationship:`type`,field:`property`,keyword:`keyword`};function uj({org:e,initialText:t}){let n=(0,_.useRef)(null),r=Jd(),i=(0,_.useRef)({soql:r});return(0,_.useEffect)(()=>{i.current={soql:r}}),(0,_.useEffect)(()=>{if(!n.current)return;let r,a=0,o=new Map,s=async(e,t)=>{if(Date.now()-(o.get(e)??0)<cj)throw Error(`failed recently`);try{return await t()}catch(t){throw o.set(e,Date.now()),t}},c=new X({parent:n.current,state:Wm.create({doc:Bd(e,t),extensions:[hw(),JA({dialect:ij}),SC(aj),oj,Kb(C.editorPlaceholder),X.lineWrapping,X.contentAttributes.of({"aria-label":C.editorLabel}),dm.highest(X.domEventHandlers({keydown:e=>e.key===`Enter`&&$f(e,a)})),Mk({override:[async t=>{let n=kt(t.state.doc.toString(),t.pos);if(n.context.kind===`none`||!n.word&&!n.afterDot&&!t.explicit)return null;let{soql:r}=i.current,a=n.dotted?[]:ej(n.word),o=`${e}\n${r.tooling}\n${r.apiVersion}\n`,c={objects:async()=>(await s(o,()=>UE(e,r.tooling,r.apiVersion))).sobjects,describe:t=>s(o+t.toLowerCase(),()=>WE(e,t,r.tooling,r.apiVersion))};try{a=await rj(n,c,r.names)}catch{}if(a.length===0)return null;let l=a.map(e=>({label:e.label,apply:e.insert,type:lj[e.kind]}));return{from:n.from,options:l,filter:!1}}],activateOnTyping:!0}),dm.highest(Fb.of([{key:`Mod-Enter`,run:()=>(i.current.soql.run(),!0)}])),Fb.of([...SE,...Pw]),X.domEventHandlers({compositionend:(e,t)=>(a=Date.now(),setTimeout(()=>Sk(t),0),!1)}),X.updateListener.of(t=>{if(!t.docChanged)return;let n=t.state.doc.toString();Vd(e,n),clearTimeout(r),r=setTimeout(()=>i.current.soql.onTextSettled(n),sj)})]})});return i.current.soql.registerEditor({getText:()=>c.state.doc.toString(),setText:e=>{c.dispatch({changes:{from:0,to:c.state.doc.length,insert:e}})},focus:()=>c.focus()}),()=>{clearTimeout(r),i.current.soql.registerEditor(null),c.destroy()}},[]),(0,F.jsx)(`div`,{ref:n,className:AE.editor})}function dj(){let e=Jd(),{running:t}=Yd();return(0,F.jsxs)(`button`,{type:`button`,className:`${K.button} ${K.primary}`,disabled:t,onClick:e.run,"aria-keyshortcuts":`Meta+Enter Control+Enter`,children:[t?C.running:C.run,(0,F.jsx)(`span`,{className:jO.shortcut,children:`⌘↵`})]})}function fj({username:e,initialText:t}){let n=Jd(),r=(0,_.useId)(),i=(0,_.useId)();return(0,F.jsxs)(`section`,{className:K.panel,"aria-label":C.editorLabel,children:[(0,F.jsx)(np,{}),(0,F.jsx)(cp,{}),(0,F.jsxs)(`div`,{className:`${K.header} ${jO.toolbar}`,children:[(0,F.jsx)(dj,{}),(0,F.jsxs)(`label`,{className:jO.check,htmlFor:r,title:C.queryAllTitle,children:[(0,F.jsx)(`input`,{id:r,type:`checkbox`,checked:n.queryAll,disabled:n.tooling,onChange:e=>n.setQueryAll(e.target.checked)}),C.queryAll]}),(0,F.jsxs)(`label`,{className:jO.check,htmlFor:i,children:[(0,F.jsx)(`input`,{id:i,type:`checkbox`,checked:n.tooling,disabled:n.queryAll,onChange:e=>n.setTooling(e.target.checked)}),C.tooling]}),(0,F.jsx)(JE,{username:e,value:n.apiVersion,onChange:n.setApiVersion}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:n.format,children:C.format})]}),(0,F.jsx)(uj,{org:e,initialText:t})]})}var pj={back:`_back_16rvz_1`,heading:`_heading_16rvz_10`,objectName:`_objectName_16rvz_16`,oneLine:`_oneLine_16rvz_21`,tabs:`_tabs_16rvz_27`,tab:`_tab_16rvz_27`,tree:`_tree_16rvz_48`,row:`_row_16rvz_54`,checked:`_checked_16rvz_70`,expand:`_expand_16rvz_74`,expandSpacer:`_expandSpacer_16rvz_90`,label:`_label_16rvz_95`,line:`_line_16rvz_105`,subline:`_subline_16rvz_112`,type:`_type_16rvz_121`,menuRoot:`_menuRoot_16rvz_125`,menu:`_menu_16rvz_125`},mj={root:`_root_1c95a_1`,input:`_input_1c95a_5`,clear:`_clear_1c95a_14`};function hj({label:e,value:t,onChange:n}){let r=(0,_.useRef)(null);return(0,F.jsxs)(`div`,{className:`${K.search} ${mj.root}`,children:[(0,F.jsx)(`input`,{ref:r,className:`${K.input} ${mj.input}`,type:`search`,"aria-label":e,placeholder:e,value:t,onChange:e=>n(e.target.value)}),t&&(0,F.jsx)(`button`,{type:`button`,className:mj.clear,"aria-label":C.clearFilter,title:C.clearFilter,onClick:()=>{n(``),r.current?.focus()},children:(0,F.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 16 16`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:(0,F.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}var gj=5,_j=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`});function vj({username:e,objectName:t}){let n=Jd(),[r,i]=(0,_.useState)(`fields`),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(`none`),l=(0,_.useId)(),u=KE(`${e}\n${t}\n${n.tooling}\n${n.apiVersion}`,r=>WE(e,t,n.tooling,n.apiVersion,r));je(e,u.error);let d=u.data,f=d?`${d.label} · ${C.fieldCount(d.fields.length)} · ${C.loadedAt(_j.format(new Date(d.fetchedAt)))}`:``;return(0,F.jsxs)(`section`,{className:K.panel,"aria-label":t,children:[(0,F.jsxs)(`div`,{className:K.header,children:[(0,F.jsx)(`button`,{type:`button`,className:pj.back,"aria-label":C.backToObjects,title:C.backToObjects,onClick:n.showObjectList,children:(0,F.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,children:(0,F.jsx)(`path`,{d:`M10 3L5 8l5 5`})})}),(0,F.jsxs)(`div`,{className:pj.heading,children:[(0,F.jsx)(`span`,{className:`${pj.objectName} ${pj.oneLine}`,title:t,children:t}),(0,F.jsx)(`span`,{className:`${K.meta} ${pj.oneLine}`,title:f,children:f})]}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsx)($E,{label:C.reloadFields,busy:u.loading,onClick:u.reload}),d&&(0,F.jsx)(yj,{fields:d.fields,onSort:c}),(0,F.jsx)(YE,{name:`objects`,label:C.hideObjects,side:`left`})]}),(0,F.jsxs)(`div`,{className:pj.tabs,role:`tablist`,children:[(0,F.jsx)(`button`,{type:`button`,role:`tab`,id:`${l}-fields`,"aria-selected":r===`fields`,className:pj.tab,onClick:()=>i(`fields`),children:C.fieldsTab}),(0,F.jsx)(`button`,{type:`button`,role:`tab`,id:`${l}-rels`,"aria-selected":r===`relationships`,className:pj.tab,onClick:()=>i(`relationships`),children:C.childRelationshipsTab})]}),(0,F.jsx)(hj,{label:C.filterFields,value:a,onChange:o}),(0,F.jsxs)(`div`,{className:K.body,role:`tabpanel`,"aria-labelledby":`${l}-${r===`fields`?`fields`:`rels`}`,"aria-busy":u.loading,children:[u.error!==void 0&&(0,F.jsx)(`p`,{className:K.empty,children:C.loadFailed}),u.pending&&(0,F.jsx)(`p`,{className:K.empty,children:C.loading}),d&&r===`fields`&&(0,F.jsx)(xj,{username:e,fields:d.fields,relationships:[],filter:a,sort:s}),d&&r===`relationships`&&(0,F.jsx)(wj,{username:e,relationships:d.childRelationships,filter:a})]})]})}function yj({fields:e,onSort:t}){let n=Jd(),[r,i]=(0,_.useState)(!1),a=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!r)return;let e=e=>{a.current?.contains(e.target)||i(!1)},t=e=>{e.key===`Escape`&&(i(!1),a.current?.querySelector(`button`)?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[r]);let o=e=>()=>{e(),i(!1)};return(0,F.jsxs)(`div`,{className:pj.menuRoot,ref:a,children:[(0,F.jsx)(`button`,{type:`button`,className:K.button,"aria-label":C.fieldMenu,title:C.fieldMenu,"aria-expanded":r,onClick:()=>i(!r),children:`⋯`}),r&&(0,F.jsxs)(`ul`,{className:pj.menu,role:`menu`,children:[(0,F.jsx)(`li`,{role:`none`,children:(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:o(()=>n.selectAll(e.map(e=>e.name))),children:C.selectAllFields})}),(0,F.jsx)(`li`,{role:`none`,children:(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:o(n.clearAll),children:C.clearAllFields})}),(0,F.jsx)(`li`,{role:`none`,children:(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:o(()=>t(`asc`)),children:C.sortAsc})}),(0,F.jsx)(`li`,{role:`none`,children:(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:o(()=>t(`desc`)),children:C.sortDesc})})]})]})}function bj(e,t){if(t===`none`)return e;let n=[...e].sort((e,t)=>e.name.localeCompare(t.name));return t===`asc`?n:n.reverse()}function xj({username:e,fields:t,relationships:n,childRelationship:r,filter:i=``,sort:a=`none`}){let o=Jd(),s=(0,_.useMemo)(()=>{let e=i.trim().toLowerCase();return bj(t,a).filter(t=>!e||ZA(e,t.name,t.label))},[t,i,a]),c=(0,_.useMemo)(()=>o.selection?r?o.selection.subqueries.get(G(r,o.names.ns))??new Set:o.selection.fields:new Set,[o.selection,o.names.ns,r]);return s.length===0?(0,F.jsx)(`p`,{className:K.empty,children:C.noMatchingFields}):(0,F.jsx)(`ul`,{className:pj.tree,role:`group`,children:s.map(t=>(0,F.jsx)(Sj,{username:e,field:t,relationships:n,childRelationship:r,checked:c.has(pd({name:t.name,relationships:n},o.names.ns))},t.name))})}function Sj({username:e,field:t,relationships:n,childRelationship:r,checked:i}){let a=Jd(),[o,s]=(0,_.useState)(!1),c=t.referenceTo[0],l=!!(t.relationshipName&&c),u=n.length>=gj,d=n.length+ +!!r,f=(0,_.useId)();return(0,F.jsxs)(`li`,{role:`treeitem`,"aria-expanded":l?o:void 0,"aria-selected":i,className:i?pj.checked:void 0,children:[(0,F.jsxs)(`div`,{className:pj.row,style:{paddingLeft:`calc(var(--space-3) + ${d} * var(--space-4))`},children:[l?(0,F.jsx)(`button`,{type:`button`,className:pj.expand,"aria-label":u?C.maxDepth:o?C.collapseReference:C.expandReference,title:u?C.maxDepth:o?C.collapseReference:C.expandReference,"aria-disabled":u||void 0,onClick:()=>!u&&s(!o),children:o?`▾`:`▸`}):(0,F.jsx)(`span`,{className:pj.expandSpacer}),(0,F.jsx)(`input`,{id:f,type:`checkbox`,checked:i,onChange:()=>a.toggleField({name:t.name,relationships:n},r)}),(0,F.jsxs)(`label`,{htmlFor:f,className:pj.label,title:`${t.label} (${t.name})`,children:[(0,F.jsx)(`span`,{className:pj.line,children:t.label}),(0,F.jsxs)(`span`,{className:`${pj.subline} ${K.meta} ${K.mono}`,children:[(0,F.jsx)(`span`,{className:pj.line,children:t.name}),(0,F.jsx)(`span`,{className:pj.type,children:t.type})]})]})]}),o&&c&&t.relationshipName&&(0,F.jsx)(Cj,{username:e,objectName:c,relationships:[...n,t.relationshipName],childRelationship:r})]})}function Cj({username:e,objectName:t,relationships:n,childRelationship:r}){let i=Jd(),a=KE(`${e}\n${t}\n${i.tooling}\n${i.apiVersion}`,()=>WE(e,t,i.tooling,i.apiVersion));return je(e,a.error),a.error===void 0?a.pending||!a.data?(0,F.jsx)(`p`,{className:K.empty,"aria-busy":`true`,children:C.loading}):(0,F.jsx)(xj,{username:e,fields:a.data.fields,relationships:n,childRelationship:r}):(0,F.jsx)(`p`,{className:K.empty,children:C.loadFailed})}function wj({username:e,relationships:t,filter:n}){let r=Jd(),i=KE(`${e}\n${r.tooling}\n${r.apiVersion}`,()=>UE(e,r.tooling,r.apiVersion)),a=(0,_.useMemo)(()=>new Map((i.data?.sobjects??[]).map(e=>[e.name,e.label])),[i.data]),o=(0,_.useMemo)(()=>{let e=n.trim().toLowerCase();return t.filter(e=>!!e.relationshipName).filter(t=>!e||ZA(e,t.relationshipName,t.childSObject)).sort((e,t)=>e.relationshipName.localeCompare(t.relationshipName))},[t,n]);return o.length===0?(0,F.jsx)(`p`,{className:K.empty,children:C.noChildRelationships}):(0,F.jsx)(`ul`,{className:pj.tree,role:`group`,children:o.map(t=>(0,F.jsx)(Tj,{username:e,relationship:t,childLabel:a.get(t.childSObject)},t.relationshipName))})}function Tj({username:e,relationship:t,childLabel:n}){let r=Jd(),[i,a]=(0,_.useState)(!1),o=(0,_.useId)(),s=r.selection?.subqueries.has(G(t.relationshipName,r.names.ns))??!1;return(0,F.jsxs)(`li`,{role:`treeitem`,"aria-expanded":i,"aria-selected":s,className:s?pj.checked:void 0,children:[(0,F.jsxs)(`div`,{className:pj.row,children:[(0,F.jsx)(`button`,{type:`button`,className:pj.expand,"aria-label":i?C.collapseRelationship:C.expandRelationship,title:i?C.collapseRelationship:C.expandRelationship,onClick:()=>a(!i),children:i?`▾`:`▸`}),(0,F.jsx)(`input`,{id:o,type:`checkbox`,checked:s,onChange:()=>r.toggleSubquery(t.relationshipName)}),(0,F.jsxs)(`label`,{htmlFor:o,className:pj.label,title:`${t.relationshipName} (${t.childSObject})`,children:[(0,F.jsx)(`span`,{className:pj.line,children:t.relationshipName}),(0,F.jsx)(`span`,{className:`${pj.line} ${K.meta} ${K.mono}`,children:n?`${n} · ${t.childSObject}`:t.childSObject})]})]}),i&&(0,F.jsx)(Cj,{username:e,objectName:t.childSObject,relationships:[],childRelationship:t.relationshipName})]})}var Ej={list:`_list_1hf7i_1`,item:`_item_1hf7i_7`,line:`_line_1hf7i_20`};function Dj({username:e}){let t=Jd(),n=KE(`${e}\n${t.tooling}\n${t.apiVersion}`,n=>UE(e,t.tooling,t.apiVersion,n));je(e,n.error);let r=t.panelObject&&n.data?od(n.data.sobjects,t.panelObject,t.names.ns):void 0,[i,a]=(0,_.useState)();r&&i!==r.name?a(r.name):!t.panelObject&&i&&a(void 0);let o=i!==void 0&&n.data?.sobjects.some(e=>e.name===i),s=r?.name??(t.panelObject&&o?i:void 0);return s?(0,F.jsx)(vj,{username:e,objectName:s},`${s}\n${t.tooling}\n${t.apiVersion}`):(0,F.jsx)(Oj,{globals:n})}function Oj({globals:e}){let t=Jd(),[n,r]=(0,_.useState)(``),i=(0,_.useMemo)(()=>{let t=n.trim().toLowerCase();return(e.data?.sobjects??[]).filter(e=>e.queryable!==!1).filter(e=>!t||ZA(t,e.name,e.label))},[e.data,n]);return(0,F.jsxs)(`section`,{className:K.panel,"aria-label":C.sObjects,children:[(0,F.jsxs)(`div`,{className:K.header,children:[(0,F.jsx)(`span`,{className:K.title,children:C.sObjects}),(0,F.jsx)(`span`,{className:K.spacer}),e.data&&(0,F.jsx)(`span`,{className:K.meta,children:e.data.sobjects.length}),(0,F.jsx)($E,{label:C.reloadObjects,busy:e.loading,onClick:e.reload}),(0,F.jsx)(YE,{name:`objects`,label:C.hideObjects,side:`left`})]}),(0,F.jsx)(hj,{label:C.filterObjects,value:n,onChange:r}),(0,F.jsxs)(`div`,{className:K.body,"aria-busy":e.loading,children:[e.error!==void 0&&(0,F.jsx)(`p`,{className:K.empty,children:C.loadFailed}),e.pending&&(0,F.jsx)(`p`,{className:K.empty,children:C.loading}),e.data&&i.length===0&&(0,F.jsx)(`p`,{className:K.empty,children:C.noMatchingObjects}),(0,F.jsx)(`ul`,{className:Ej.list,children:i.map(e=>(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,className:Ej.item,title:`${e.label} (${e.name})`,onClick:()=>t.pickObject(e.name),children:[(0,F.jsx)(`span`,{className:Ej.line,children:e.label}),(0,F.jsx)(`span`,{className:`${Ej.line} ${K.meta} ${K.mono}`,children:e.name})]})},e.name))})]})]})}var kj={list:`_list_18wmp_1`,item:`_item_18wmp_7`,soql:`_soql_18wmp_24`,chip:`_chip_18wmp_34`,prompt:`_prompt_18wmp_43`},Aj=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`});function jj(){let e=Jd();return(0,F.jsxs)(`section`,{className:K.panel,"aria-label":C.recent,children:[(0,F.jsxs)(`div`,{className:K.header,children:[(0,F.jsx)(`span`,{className:K.title,children:C.recent}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsx)(YE,{name:`recent`,label:C.hideRecent,side:`right`})]}),(0,F.jsxs)(`div`,{className:K.body,children:[e.history.length===0&&(0,F.jsx)(`p`,{className:K.empty,children:C.recentEmpty}),(0,F.jsx)(`ul`,{className:kj.list,children:e.history.map(t=>(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,className:kj.item,onClick:()=>e.loadHistory(t),title:t.soql,children:[t.prompt&&(0,F.jsx)(`span`,{className:kj.prompt,children:t.prompt}),(0,F.jsx)(`span`,{className:kj.soql,children:t.soql}),(0,F.jsxs)(`span`,{className:K.meta,children:[Aj.format(new Date(t.executedAt)),t.tooling&&(0,F.jsx)(`span`,{className:kj.chip,children:C.tooling}),t.queryAll&&(0,F.jsx)(`span`,{className:kj.chip,children:C.queryAll}),t.apiVersion&&(0,F.jsx)(`span`,{className:kj.chip,children:C.apiVersionChip(t.apiVersion)})]})]})},`${t.executedAt}\n${t.soql}`))})]})]})}function Mj(e,t){switch(t.type){case`page`:return t.from===e.next?{...e,records:e.records.concat(t.records),next:t.next,columns:wd(e.columns,t.records),failure:void 0}:e;case`failed`:return t.from===e.next?{...e,failure:t.failure}:e;case`patched`:return{...e,records:e.records.map(e=>{let n=typeof e.Id==`string`?t.values.get(e.Id):void 0;return n?{...e,...n}:e}),revision:e.revision+1};case`removed`:{let n=e.records.filter(e=>!(typeof e.Id==`string`&&t.ids.has(e.Id)));return{...e,records:n,removed:e.removed+e.records.length-n.length,revision:e.revision+1}}}}function Nj(e,t){if(e.tooling)return{reason:`tooling`};let n=e.records[0]?.attributes?.type;return typeof n==`string`?n===`AggregateResult`?{reason:`aggregate`}:t.some(e=>e.path.length===1&&e.key===`Id`)?{object:n}:{reason:`noId`}:{reason:`empty`}}function Pj(e,t,n){let r=new Map(t.map(e=>[e.name.toLowerCase(),e])),i=new Map;for(let t of e){if(t.kind!==`value`||t.path.length!==1||t.key===`Id`)continue;let e=t.key.toLowerCase(),a=r.get(e)??(n?r.get(`${n.toLowerCase()}__${e}`):void 0);a?.updateable&&i.set(t.key,a)}return i}function Fj(e){return e.type===`boolean`?`checkbox`:e.type===`picklist`?`picklist`:e.type===`textarea`?`textarea`:`text`}function Ij(e){if(typeof e!=`number`)return!0;let t=String(Math.abs(e));return!/e/i.test(t)&&t.replace(`.`,``).replace(/^0+/,``).length<=15}function Lj(e){return e==null?``:String(e)}function Rj(e){return e===``?null:e}function zj(e,t){return t===null?e==null||e===``:typeof t==`boolean`?e===t:Lj(e)===t}var Bj={editing:!1,changes:new Map,selected:new Set,errors:new Map};function Vj(e){return e.errors.map(e=>e.statusCode===`ALL_OR_NONE_OPERATION_ROLLED_BACK`?C.rolledBack:e.fields.length?`${e.message} (${e.fields.join(`, `)})`:e.message).join(`
|
|
208
|
+
`)}function Hj(e,t){let n=new Map(e);for(let e of t)e.success?n.delete(e.id):n.set(e.id,Vj(e));return n}function Uj(e,t){switch(t.type){case`start`:return{...e,editing:!0};case`stop`:return Bj;case`set`:{let n=new Map(e.changes),{[t.column]:r,...i}=n.get(t.id)??{},a=t.same?i:{...i,[t.column]:t.value};return Object.keys(a).length===0?n.delete(t.id):n.set(t.id,a),{...e,changes:n}}case`select`:{let n=new Set(e.selected);for(let e of t.ids)t.on?n.add(e):n.delete(e);return{...e,selected:n}}case`discard`:return{...e,changes:new Map,errors:new Map};case`saved`:{let n=new Map(e.changes);for(let e of t.results)e.success&&n.delete(e.id);return{...e,changes:n,errors:Hj(e.errors,t.results)}}case`deleted`:{let n=new Map(e.changes),r=new Set(e.selected);for(let e of t.results)e.success&&(n.delete(e.id),r.delete(e.id));return{...e,changes:n,selected:r,errors:Hj(e.errors,t.results)}}}}function Wj(e,t=200,n){let r=[],i=[],a=0;for(let o of e){let e=n?n(o):0;i.length>0&&(i.length>=t||a+e>4194304)&&(r.push(i),i=[],a=0),i.push(o),a+=e}return i.length>0&&r.push(i),r}var Gj=`sfbench.allOrNone`,Kj=new TextEncoder;function qj(){try{return localStorage.getItem(Gj)===`true`}catch{return!1}}function Jj({username:e,result:t,records:n,columns:r,shownIds:i,patchRows:a,removeRows:o,ns:s}){let{setUnsavedEdits:c,handleCommonError:l}=he(),{isProduction:u,selectedOrg:d,handleOrgError:f,markAuthError:p,reportApiUsage:m}=Ae(),[h,g]=(0,_.useReducer)(Uj,Bj),[v,y]=(0,_.useState)(qj),[b,x]=(0,_.useState)(),[S,w]=(0,_.useState)(),{start:T,running:E,progress:D}=ue(),O=(0,_.useMemo)(()=>Nj(t,r),[t,r]),k=`object`in O?O.object:void 0,A=KE(h.editing&&k?`${e}\n${k}\n${t.apiVersion}`:void 0,()=>WE(e,k,!1,t.apiVersion)),j=(0,_.useMemo)(()=>A.data?Pj(r,A.data.fields,s):void 0,[A.data,r,s]);(0,_.useEffect)(()=>c(h.changes.size,E),[h.changes.size,E,c]),(0,_.useEffect)(()=>()=>c(0),[c]),(0,_.useEffect)(()=>{if(h.selected.size===0)return;let e=new Set(i),t=[...h.selected].filter(t=>!e.has(t));t.length>0&&g({type:`select`,ids:t,on:!1})},[i,h.selected]);let M=(0,_.useMemo)(()=>new Map(n.map(e=>[e.Id,e])),[n]),ee=(0,_.useCallback)(e=>{y(e);try{localStorage.setItem(Gj,String(e))}catch{}},[]),N=(0,_.useCallback)(e=>Object.fromEntries(Object.entries(h.changes.get(e)??{}).map(([e,t])=>[j?.get(e)?.name??e,t])),[h.changes,j]),te=(0,_.useCallback)(e=>Wj(e,void 0,e=>Kj.encode(JSON.stringify(N(e))).length),[N]),ne=(0,_.useCallback)(async(n,r)=>{w(void 0);let i=t.apiVersion?{apiVersion:t.apiVersion}:{},s=n===`save`?te(r).map(t=>{let n=t.map(e=>({id:e,fields:N(e)}));return t=>P.recordsUpdate(e,{object:k,records:n,allOrNone:v,...i},t)}):Wj(r).map(t=>n=>P.recordsDelete(e,{ids:t,allOrNone:v,...i},n)),c=await T(async(e,t)=>{let i={results:[],apiUsage:void 0};for(let a of s){t({kind:n,done:i.results.length,total:r.length});try{let t=await a(e);i.results.push(...t.results),i.apiUsage=t.apiUsage??i.apiUsage}catch(e){return{...i,failure:{error:e}}}}return i},`ignore`);if(c.kind!==`done`)return;let{results:u,apiUsage:d,failure:_}=c.value;m(e,d);let y=u.filter(e=>e.success);n===`save`?(a(new Map(y.map(e=>[e.id,h.changes.get(e.id)??{}]))),g({type:`saved`,results:u})):(o(new Set(y.map(e=>e.id))),g({type:`deleted`,results:u}));let b=u.length-y.length,x=n===`save`?C.savedRows(y.length,b):C.deletedRows(y.length,b);if(!_){w({kind:`done`,text:x});return}let S=u.length>0?`${x}\n`:``,E=sf(_.error,!0);E.kind===`unknown`?(l(_.error),w({kind:`unknown`,text:S+C.editsUnknown})):E.kind===`elsewhere`?(f(e,_.error),w({kind:`error`,text:S+C.editsStopped})):(E.orgAuth&&p(e,E.reloginCommand),w({kind:`error`,text:`${S}${E.message}\n${C.editsStopped}`,details:E.details,reloginCommand:E.reloginCommand}))},[T,N,te,k,v,e,t.apiVersion,m,a,o,h.changes,l,f,p]),re=d?.alias??e,ie=(0,_.useCallback)(()=>{if(E||h.changes.size===0||!j)return;let e=h.changes.size;u?x({kind:`save`,lines:[C.confirmSaveProduction(re,k??``,e)]}):ne(`save`,[...h.changes.keys()])},[E,h.changes,j,u,re,k,ne]),ae=(0,_.useCallback)(()=>{if(E||h.selected.size===0)return;let e=[C.confirmDelete(k??``,h.selected.size),...u?[C.confirmDeleteProduction(re)]:[]];x({kind:`delete`,lines:e})},[E,h.selected,k,u,re]),oe=(0,_.useCallback)(()=>{b&&(x(void 0),ne(b.kind,b.kind===`save`?[...h.changes.keys()]:[...h.selected]))},[b,ne,h.changes,h.selected]),se=(0,_.useMemo)(()=>v&&te([...h.changes.keys()]).length>1,[v,te,h.changes]),ce=v&&h.selected.size>200;return{target:O,editing:h.editing,state:h,dispatch:g,fields:j,fieldsError:A.error,recordById:M,allOrNone:v,setAllOrNone:ee,saveTooManyForAllOrNone:se,deleteTooManyForAllOrNone:ce,save:ie,remove:ae,confirming:b,confirm:oe,cancelConfirm:()=>x(void 0),message:S,closeMessage:()=>w(void 0),sending:E,progress:E?D:void 0}}function Yj(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function Xj(e,t){let n=[e.map(e=>Yj(e.key)).join(`,`)];for(let r of t)n.push(e.map(e=>Yj(Dd(Ed(r,e)))).join(`,`));return`\uFEFF${n.join(`\r
|
|
209
|
+
`)}\r\n`}function Zj(e){return`${e||`query`}.csv`}var Qj={csvStatus:`_csvStatus_1mbm6_1`},$j=1e4;function eM({result:e,pages:t}){let{reportOrgError:n,reportApiUsage:r}=Ae(),[i,a]=(0,_.useState)({step:`idle`}),o=ue(),s=async()=>{a({step:`idle`});let{records:i,next:s,columns:c}=t,l=i.length,{username:u}=e,d=await o.start(async(e,t)=>{let n=[],r,i=s;for(t(l);i;){let a=await P.nextPage(u,i,e);r=a.apiUsage??r,n.push(...a.records),t(l+n.length),i=a.done?void 0:a.nextRecordsUrl}return{extra:n,usage:r}},`ignore`);if(d.kind===`error`&&n(u,d.error),d.kind!==`done`)return;let{extra:f,usage:p}=d.value;r(u,p),Kf(Xj(wd(c,f),f.length?i.concat(f):i),Zj(e.object),`text/csv;charset=utf-8`)},c=()=>{let n=t.next?Math.max(e.totalSize-t.records.length,0):0;n>$j?a({step:`confirm`,remaining:n}):s()},l=t.failure?.kind===`rerun`,u=(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:c,disabled:i.step===`confirm`||l,title:l?C.locatorExpired:void 0,children:C.exportCsv});return i.step===`confirm`?(0,F.jsxs)(F.Fragment,{children:[u,(0,F.jsx)(Ie,{title:C.exportCsv,message:C.csvConfirm(i.remaining,Math.ceil(i.remaining/e.pageSize)),confirmLabel:C.csvContinue,onConfirm:()=>void s(),onCancel:()=>a({step:`idle`})})]}):o.running?(0,F.jsxs)(`span`,{className:Qj.csvStatus,role:`status`,children:[C.csvProgress(o.progress??t.records.length,e.totalSize),(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:o.cancel,children:C.cancel})]}):u}var tM={result:`_result_47jcx_1`,count:`_count_47jcx_8`,body:`_body_47jcx_12`,filter:`_filter_47jcx_20`,matchCount:`_matchCount_47jcx_34`,more:`_more_47jcx_44`,detail:`_detail_47jcx_49`,detailText:`_detailText_47jcx_61`,childPanel:`_childPanel_47jcx_69`,error:`_error_47jcx_77`,message:`_message_47jcx_89`,running:`_running_47jcx_97`,editOn:`_editOn_47jcx_106`,editBar:`_editBar_47jcx_113`,danger:`_danger_47jcx_122`,allOrNone:`_allOrNone_47jcx_127`,editDone:`_editDone_47jcx_135`,editUnknown:`_editUnknown_47jcx_136`,editError:`_editError_47jcx_137`,messageClose:`_messageClose_47jcx_170`},nM={tooling:C.editTooling,aggregate:C.editAggregate,noId:C.editNoId,empty:C.editEmpty};function rM({edits:e}){let{guardDiscard:t}=he(),n=`reason`in e.target?nM[e.target.reason]:void 0;return(0,F.jsx)(`button`,{type:`button`,className:`${K.button} ${e.editing?tM.editOn:``}`,"aria-pressed":e.editing,disabled:n!==void 0||e.sending,title:n,onClick:()=>e.editing?t(()=>e.dispatch({type:`stop`})):e.dispatch({type:`start`}),children:C.editToggle})}function iM({edits:e}){let{state:t,sending:n,progress:r,message:i}=e,a=t.changes.size,o=t.selected.size,s=e.saveTooManyForAllOrNone,c=e.deleteTooManyForAllOrNone;return(0,F.jsxs)(`div`,{className:tM.editBar,children:[e.fieldsError===void 0?e.fields?null:(0,F.jsx)(`span`,{className:K.meta,children:C.editLoadingFields}):(0,F.jsx)(`span`,{className:K.meta,children:C.editFieldsFailed}),(0,F.jsx)(`button`,{type:`button`,className:`${K.button} ${K.primary}`,disabled:n||a===0||!e.fields||s,onClick:e.save,children:C.saveChanges(a)}),(0,F.jsx)(`button`,{type:`button`,className:K.button,disabled:n||a===0,onClick:()=>e.dispatch({type:`discard`}),children:C.discardChanges}),(0,F.jsx)(`button`,{type:`button`,className:`${K.button} ${tM.danger}`,disabled:n||o===0||c,onClick:e.remove,children:C.deleteRows(o)}),(0,F.jsxs)(`label`,{className:tM.allOrNone,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:e.allOrNone,disabled:n,onChange:t=>e.setAllOrNone(t.target.checked)}),C.allOrNone]}),(s||c)&&(0,F.jsx)(`span`,{className:K.meta,children:C.allOrNoneTooMany}),r&&(0,F.jsx)(`span`,{className:K.meta,role:`status`,children:r.kind===`save`?C.savingRows(r.done,r.total):C.deletingRows(r.done,r.total)}),i&&(0,F.jsxs)(`div`,{className:i.kind===`done`?tM.editDone:i.kind===`unknown`?tM.editUnknown:tM.editError,role:i.kind===`done`?`status`:`alert`,children:[(0,F.jsx)(`span`,{className:tM.message,children:i.text}),i.kind===`error`&&i.reloginCommand&&(0,F.jsx)(Ke,{command:i.reloginCommand}),i.kind===`error`&&(0,F.jsx)(_t,{details:i.details}),(0,F.jsx)(`button`,{type:`button`,className:tM.messageClose,"aria-label":C.dismiss,onClick:e.closeMessage,children:`×`})]}),e.confirming&&(0,F.jsx)(Ie,{title:e.confirming.kind===`save`?C.confirmSaveTitle:C.confirmDeleteTitle,message:e.confirming.lines.join(`
|
|
210
|
+
`),confirmLabel:e.confirming.kind===`save`?C.confirmSave:C.confirmDeleteButton,onConfirm:e.confirm,onCancel:e.cancelConfirm})]})}function aM(e){return typeof e==`object`?e.key:e}function oM(e,t){let n=e.length;return new Proxy(e,{get(e,r,i){if(typeof r==`string`){let i=r.charCodeAt(0);if(i>=48&&i<=57){let i=+r;if(Number.isInteger(i)&&i>=0&&i<n){let n=e[i];if(typeof n!=`object`){let r=t[i*2];n=e[i]={index:i,key:n,start:r,size:t[i*2+1],end:r+t[i*2+1],lane:0}}return n}}if(r===`length`)return n}return Reflect.get(e,r,i)}})}function sM(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return(o.length!==r.length||o.some((e,t)=>r[t]!==e))&&(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1),i}return o.updateDeps=e=>{r=e},o}function cM(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var lM=(e,t)=>Math.abs(e-t)<1.01,uM=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})};function dM({offset:e,isScrolling:t,elementMax:n,holdOffset:r,scrollOffset:i,pendingWrite:a,clampedMaxAtWrite:o}){return t&&a===null&&e===i?`spurious`:a!==null&&Math.abs(e-a.target)<1.5?`readBack`:a!==null&&!a.smooth&&n!==null&&a.target>n+r+.5&&Math.abs(e-(n+r))<1.5||a!==null&&!a.smooth&&a.lowMaxes?.some(t=>Math.abs(e-t)<1.5)?`clampedReadBack`:o!==null&&Math.abs(e-o)<1.5?`clampedEcho`:`external`}var fM=e=>e===`smooth`||e===`smoothFinishing`;function pM({kind:e,offset:t,command:n,target:r}){return e!==`spurious`&&e!==`readBack`&&e!==`clampedReadBack`&&n?.index!=null&&n.phase!==`queued`&&!fM(n.phase)&&!lM(t,n.lastTargetOffset)&&!lM(t,r())&&e!==`clampedEcho`}var mM=40;function hM(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<mM;)n--;if(n<0)return!1;let r=e[n],i=n-1;for(;i>=0&&r.t-e[i].t<mM;)i--;if(i<0)return!1;let a=e[i],o=(t.offset-r.offset)/(t.t-r.t),s=(r.offset-a.offset)/(r.t-a.t);return o*s>=0&&Math.abs(o)>=2*Math.abs(s)&&Math.abs(o)-Math.abs(s)>=.8}function gM(e){let t=e[e.length-1];if(t===void 0)return!1;let n=e.length-2;for(;n>=0&&t.t-e[n].t<mM;)n--;if(n<0)return!1;let r=e[n];return Math.abs(t.offset-r.offset)/(t.t-r.t)>=.05}var _M,vM=()=>{if(_M!==void 0)return _M;if(typeof navigator>`u`)return _M=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return _M=!0;let e=navigator.maxTouchPoints;return _M=navigator.platform===`MacIntel`&&e!==void 0&&e>0},yM,bM=()=>yM===void 0?yM=vM()&&typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`overflow-anchor: auto`):yM,xM={capture:!0,passive:!0},SM=class{constructor(e){this.host=e,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!==`lateFling`,this.dragging=()=>this._touch?.phase===`down`&&this._touch.moved,this.tail=()=>this._touch?.phase===`tail`?this._touch.moved?`fling`:`tap`:null,this.onScroll=({isScrolling:e,ownReadBack:t,moved:n,external:r})=>(e&&this._touch?.phase===`tail`?this._openTail(this._touch.moved||!t,!1):this._touch?.phase===`lateFling`&&(this.host.now()>this._touch.until?this._touch=null:r&&e&&n&&this._openTail(!0,!1)),!t&&e&&n&&this._touch?.phase===`down`?(this._touch.moved=!0,!0):!1),this.touchStart=()=>{this.end(),this._touch={phase:`down`,moved:!1}},this.touchEnd=()=>{let e=this._touch?.phase===`down`&&this._touch.moved;this.end(),this._openTail(e,e)},this.end=()=>{let e=this.host.getWindow();this._touch?.phase===`tail`&&e!=null&&e.clearTimeout(this._touch.timerId),this._touch=null},this.listen=e=>{let t=()=>this.touchStart(),n=()=>this.touchEnd();return e.addEventListener(`touchstart`,t,xM),e.addEventListener(`touchend`,n,xM),e.addEventListener(`touchcancel`,n,xM),()=>{e.removeEventListener(`touchstart`,t,xM),e.removeEventListener(`touchend`,n,xM),e.removeEventListener(`touchcancel`,n,xM),this.end()}},this._openTail=(e,t)=>{let n=this.host.getWindow();if(!vM()||n==null)return;this.end();let r={phase:`tail`,moved:e,awaitingFling:t,timerId:n.setTimeout(()=>{this.host.tailStillMoving()?this._openTail(r.moved,r.awaitingFling):(this._touch=r.awaitingFling?{phase:`lateFling`,until:this.host.now()+1e3}:null,this.host.onTailClosed())},150)};this._touch=r}}get touch(){return this._touch}},CM=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},wM=e=>{let t=new Set;return{schedule:n=>{let r=e.requestAnimationFrame(()=>{t.delete(r),n()});t.add(r)},cancel:()=>{t.forEach(t=>e.cancelAnimationFrame(t)),t.clear()}}},TM=e=>e,EM=e=>{let t=e.overscan*Math.max(e.lanes??1,1),n=Math.max(e.startIndex-t,0),r=Math.min(e.endIndex+t,e.count-1)-n+1,i=Array(r);for(let e=0;e<r;e++)i[e]=n+e;return i},DM=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(CM(n)),!r.ResizeObserver)return()=>{};let a=wM(r),o=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(CM(n))};e.options.useAnimationFrameWithResizeObserver?a.schedule(r):r()});return o.observe(n,{box:`border-box`}),()=>{o.unobserve(n),a.cancel()}},OM={passive:!0},kM=typeof window>`u`||`onscrollend`in window,AM=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&kM,o=0,s=a?null:uM(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,OM),a&&r.addEventListener(`scrollend`,u,OM),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},jM=(e,t)=>AM(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),MM=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},NM=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},PM=(e,t)=>e===`smooth`?t?`smoothLanded`:`smooth`:`instant`,FM=e=>e?.phase===`smooth`||e?.phase===`smoothLanded`;function IM(e,t,n,r){if(t===0)return!1;let i=r(0),a=new Set,o=0;for(;o<e;){let e=n(o);if(e===i)break;a.add(e),o++}let s=e-o;if(s===0||s>=t)return!1;for(let e=0;e<s;e++)if(r(e)!==n(o+e))return!1;for(let e=s;e<t;e++)if(a.has(r(e)))return!1;return!0}var LM=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new SM({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let e=this.scrollState;if(e?.phase!==`queued`||this.pendingWrite!==null)return!1;let t=this._readElementOffset();return t===null||this._lastElementOffset===null||Math.abs(t-this._lastElementOffset)<1?!1:(this._lastElementOffset=t,e.samples=[...e.samples??[],{t:this.now(),offset:t}],!0)},onTailClosed:()=>{let e=this.scrollState;e?.phase===`queued`&&gM(e.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=null,n=()=>{if(e)return e;let n=this.targetWindow;if(!n||!n.ResizeObserver)return null;let i=t=wM(n);return e=new n.ResizeObserver(e=>{let t=()=>{let t={sync:!1};this._resizeBatch=t;try{e.forEach(r)}finally{this._resizeBatch=null,t.notify&&(this.notify(t.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment())}};this.options.useAnimationFrameWithResizeObserver?i.schedule(t):t()})},r=e=>{let t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),t?.cancel(),e=null,t=null},observe:e=>n()?.observe(e,{box:`border-box`}),unobserve:e=>n()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:TM,rangeExtractor:EM,onChange:()=>{},measureElement:MM,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=this._singleLaneMeasurements?.items??s,l=e=>aM(c[e]),u=e>0?l(0):null,d=e>0?l(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==u||t.getItemKey(o-1)!==d)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>0&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==d)&&(o>e||IM(e,o,l,t.getItemKey))&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=null;if(r&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[e,t]=r,n=this.getMeasurements(),{count:a,getItemKey:s}=this.options,c=0;for(;c<a&&s(c)!==e;)c++;if(c<a){let e=n[c];if(e){let n=Math.max(0,e.start+t);!i&&n!==this.scrollOffset&&(o=n-this.scrollOffset,this.scrollOffset=n)}}}i?this.pendingScrollAnchor={kind:`follow`,behavior:i}:o!==null&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:`anchor`,delta:o}:(this._holdOffset+=o,this._followOffsetTarget(o)))},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=sM(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var e;this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(e=this._momentumStop)==null||e.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.targetWindow=this.scrollElement&&`ownerDocument`in this.scrollElement?this.scrollElement.ownerDocument.defaultView:this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{let n=t?this._elementMaxScrollOffset():null,r=this._reportedOverscroll;this._reportedOverscroll=e<0||n!==null&&e>n+1;let i=e;this._lastElementOffset=i,e=this._toLayoutOffset(e);let a=this._classifyScrollEvent(e,t,n);if(a===`spurious`)return;a===`readBack`?e=this.pendingWrite.target:a===`clampedReadBack`&&this.scrollState?.index!=null&&e<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=e:pM({kind:a,offset:e,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(e-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let o=this.getScrollOffset(),s=this.scrollDirection;this.scrollDirection=t?o===e?this.scrollDirection:o<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t;let c=this.scrollState;if(c?.phase===`queued`&&a===`external`&&t){if(r||this._reportedOverscroll)c.samples=[];else{let e=this.now();c.samples=[...(c.samples??[]).filter(t=>e-t.t<=200),{t:e,offset:i}],(s!==null&&this.scrollDirection!==s||hM(c.samples))&&(this.scrollState=null)}}this._iosGesture.onScroll({isScrolling:t,ownReadBack:a===`readBack`,moved:e!==o,external:a===`external`&&this.scrollState?.phase!==`smooth`&&this.scrollState?.phase!==`smoothFinishing`})&&this.scrollState?.phase===`queued`&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let t=this.pendingScrollAnchor;this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled&&(t.kind===`anchor`?this._canWriteScroll()?FM(this.scrollState)&&!lM(this.getScrollOffset()-t.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(t.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=t.delta,this._followOffsetTarget(t.delta),this.notify(!1)):this.scrollToEnd({behavior:t.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(e,t,n)=>dM({offset:e,isScrolling:t,elementMax:n,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:this._clampedAdjustment?.maxAtWrite??null}),this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;let{target:e,maxAtWrite:t}=this._clampedAdjustment,n=this.getMaxScrollOffset();n>t+.5&&(this._clampedAdjustment=e>n+.5?{target:e,maxAtWrite:n}:null,this._scrollToOffset(e))},this._writeAwaitingCommand=()=>{let e=this.scrollState;if(e===null||e.phase!==`queued`)return;let{behavior:t}=e;this.getMeasurements();let n=this.getScrollStateTarget(e);e.lastTargetOffset=n,this._clampedAdjustment=null,e.phase=PM(t,e.index!=null&&lM(n,this.getScrollOffset())),this._scrollToOffset(n,{behavior:t}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let e=this.scrollElement;if(e==null)return null;let{horizontal:t,isRtl:n}=this.options;return typeof e.scrollTop==`number`?t?e.scrollLeft*(n&&-1||1):e.scrollTop:typeof e.scrollY==`number`?t?e.scrollX:e.scrollY:null},this._canWriteScroll=()=>!(vM()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=e=>{if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||this.scrollState?.phase===`smooth`)return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(e);let t=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(t),this._scrollToOffset(t)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=sM(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=sM(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._singleLaneMeasurements?.flat;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e}let o=u===0?Array(e):this._singleLaneMeasurements.items.slice(),c;if(u===0)c=t+n;else{let e=u-1;c=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t);o[t]=e;let n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=c,a[t*2+1]=i,c+=i+s}this._singleLaneMeasurements={flat:a,items:o};let d=oM(o,a);return this.measurementsCache=d,d}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=sM(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=BM(e,t,n,r,r===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=sM(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t,this.options.lanes]},(e,t,n,r,i,a)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n,lanes:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!FM(this.scrollState))return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),e.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;if(!this.isIndexInRange(e))return;this._resizeBatch?.sync&&this.getMeasurements();let r,i,a,o=this._singleLaneMeasurements?.flat;if(this.options.lanes===1&&o!=null)a=this.options.getItemKey(e),i=o[e*2],r=o[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;a=t.key,i=t.start,r=t.size}let s=this.itemSizeCache.get(a)??r,c=t-s;if(c!==0){let o=this.options.anchorTo===`end`&&!FM(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,l=o?this._getLayoutTotalSize():0,u=this.getScrollOffset(),d=this.itemSizeCache.has(a)?i+s<=u&&this.scrollDirection!==`backward`:i<u,f=!FM(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?d:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:a,start:i,size:r,end:i+r,lane:0},c,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(a,t),this.itemSizeCacheVersion++;let p=!1;if(this._awaitingCommandReadBack()||(o?p=this.applyScrollAdjustment(this._getLayoutTotalSize()-l):f&&(p=this.applyScrollAdjustment(c))),this._resizeBatch){this._resizeBatch.notify=!0,(n=this._resizeBatch).sync||(n.sync=p);return}this.notify(p),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=sM(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(e,t,n)=>{let r=[];for(let i=0,a=e.length;i<a;i++){let a=t[e[i]];r.push(n===0?a:{...a,start:a.start-n,end:a.end-n})}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._singleLaneMeasurements?.flat,r=this.options.lanes===1&&n!=null;return cM(t[RM(0,t.length-1,r?e=>n[e*2]:e=>cM(t[e]).start,e)])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let e=this._elementMaxScrollOffset();if(e===null)return;let t=this.pendingWrite,n=Math.max(e,0)+this._holdOffset;if(n>=t.target)return;let r=t.lowMaxes??=[];r[r.length-1]!==n&&r.push(n)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=e=>{let t=e+this._holdOffset;return this.pendingScrollAnchor?.kind===`anchor`&&(t+=this.pendingScrollAnchor.delta),t},this._elementMaxScrollOffset=()=>{let e=this.scrollElement;if(e===null)return null;if(`scrollHeight`in e)return this.options.horizontal?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight;if(`document`in e){let t=e.document.documentElement;return this.options.horizontal?t.scrollWidth-e.innerWidth:t.scrollHeight-e.innerHeight}return null},this._momentumStop=null,this._stopMomentum=e=>{let t=this.scrollElement,n=this.targetWindow;if(t===null||n===null)return;let r=`document`in t?t.document.scrollingElement:t;if(!r?.style)return;if(this._momentumStop){this._momentumStop.done=e;return}let{style:i}=r,a=this.options.horizontal?`overflow-x`:`overflow-y`,o=i.getPropertyValue(a),s=i.getPropertyPriority(a);i.setProperty(a,`hidden`,`important`);let c={restore:()=>i.getPropertyValue(a)!==`hidden`||i.getPropertyPriority(a)!==`important`?!1:(i.setProperty(a,o,s),!0),done:e};this._momentumStop=c,n.requestAnimationFrame(()=>n.requestAnimationFrame(()=>{this._momentumStop===c&&(this._momentumStop=null,c.restore()&&c.done())}))},this._clampedBy=e=>{let t=this._elementMaxScrollOffset();if(t===null)return null;let n=t+this._holdOffset;return e>n+.5?{target:e,maxAtWrite:n}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`){if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t]}if(t===`end`&&e===this.options.count-1){let e=this.getMaxScrollOffset(),n=e-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(n,e),0),t]}let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._startScroll({index:null,align:t},this.getOffsetForAlignment(e,t),n,`absolute`)},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r;this._startScroll({index:e,align:a},i,n,`absolute`)},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+e,`start`);this._startScroll({index:null,align:`start`},n,t,`relative`)},this.scrollToEnd=({behavior:e=`auto`}={})=>{this.options.count>0?this._startScroll({index:this.options.count-1,align:`end`,toEnd:!0},Math.max(this.getMaxScrollOffset(),0),e,`absolute`):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._singleLaneMeasurements?.flat;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n}={})=>{let r={target:e+(t??0),smooth:n===`smooth`};return this.pendingWrite=r,this.options.scrollToFn(e-this._holdOffset,{behavior:n,adjustments:t},this),r},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let e=this.getCommandWrittenOffset();return!(vM()&&this._iosGesture.dragging())&&e!==null&&!lM(e,this.getScrollOffset())},this._followOffsetTarget=e=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=e)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}get scrollAdjustments(){return 0}applyScrollAdjustment(e,t){if(e===0)return!1;if(this._followOffsetTarget(e),this._canWriteScroll()){let n=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(n+e);let r=this._scrollToOffset(n,{adjustments:e,behavior:t});return this.scrollOffset!==null&&(this.pendingWrite===r&&(this.scrollOffset+=e),this.scrollOffset<0&&(this.scrollOffset=0)),!0}return this._holdOffset+=e,this.scrollOffset!==null&&(this.scrollOffset+=e),!0}scheduleScrollReconcile(){this.targetWindow?this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}):this.scrollState=null}getScrollStateTarget(e){let t=e.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:e.index==null?void 0:this.getOffsetForIndex(e.index,e.align);return t?t[0]:e.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase===`queued`){this.scheduleScrollReconcile();return}this.getMeasurements();let e=this.getScrollStateTarget(this.scrollState),t=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,n=e!==this.scrollState.lastTargetOffset;if(!n&&lM(e,this.getScrollOffset())){if(this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothLanded`:this.scrollState.phase===`smoothFinishing`&&(this.scrollState.phase=`instant`),this.scrollState.stableFrames++,this.scrollState.stableFrames>=t){this.getScrollOffset()!==e&&this._scrollToOffset(e,{behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let t=this.getSize()||600,n=Math.abs(e-this.getScrollOffset()),r=FM(this.scrollState)&&n>t;this.scrollState.lastTargetOffset=e,r?this.scrollState.phase=`smooth`:this.scrollState.phase===`smooth`?this.scrollState.phase=`smoothFinishing`:this.scrollState.phase===`smoothLanded`&&(this.scrollState.phase=`instant`),this._scrollToOffset(e,{behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}_startScroll(e,t,n,r){let i=this._iosGesture.tail();if(r===`absolute`&&i!==null){if(i===`fling`&&bM()){this._stopMomentum(()=>{this.scrollState?.phase!==`queued`||this._iosGesture.tail()!==`fling`||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:`queued`,behavior:n,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...e,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:n,phase:PM(n,e.index!=null&&lM(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:n}),this.scheduleScrollReconcile()}},RM=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function zM(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function BM(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=zM(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=RM(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var VM=typeof document<`u`?_.useLayoutEffect:_.useEffect;function HM({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=_.useReducer(e=>e+1,0)[1],a=_.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=_.useRef(!1),s=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},c=(e,t,n)=>{let r=a.current,i=!!e.options.horizontal,o=t.start-e.options.scrollMargin;r.lastPositions.get(n)!==o&&(r.lastPositions.set(n,o),r.mode===`transform`?n.style.transform=i?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:n.style[i?`left`:`top`]=`${o}px`)},l=e=>{let t=a.current;if(t.enabled&&t.container){s(e);for(let t of e.getVirtualItems()){let n=e.elementsCache.get(t.key);n&&c(e,t,n)}}},u={...r,onChange:(t,n)=>{var s;let c=a.current,u=!0;if(c.enabled){l(t);let e=t.range,n=c.prevRange;u=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,u&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}u&&(e&&n&&!o.current?(0,Gf.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[d]=_.useState(()=>{let e=new LM(u),t=e.measureElement;return e.measureElement=n=>{o.current=!0;try{t(n)}finally{o.current=!1}let r=a.current;if(n!==null&&r.enabled&&r.container){let t=e.measurementsCache[e.indexFromElement(n)];t&&c(e,t,n)}},Object.assign(e,{containerRef:t=>{let n=a.current;n.container=t,n.lastSize=null,t!==null&&l(e)}})});return d.setOptions(u),VM(()=>d._didMount(),[]),VM(()=>(s(d),d._willUpdate())),VM(()=>{l(d)}),d}function UM(e){return HM({observeElementRect:DM,observeElementOffset:jM,scrollToFn:NM,...e})}var WM=`ABCDEFGHIJKLMNOPQRSTUVWXYZ012345`;function GM(e){if(typeof e!=`string`||!/^[a-zA-Z0-9]{18}$/.test(e))return!1;let t=``;for(let n=0;n<3;n++){let r=0;for(let t=0;t<5;t++){let i=e[n*5+t];i>=`A`&&i<=`Z`&&(r|=1<<t)}t+=WM[r]}return e.slice(15)===t}var KM={scroll:`_scroll_g1hd2_1`,grid:`_grid_g1hd2_8`,row:`_row_g1hd2_16`,header:`_header_g1hd2_23`,spacer:`_spacer_g1hd2_32`,cell:`_cell_g1hd2_36`,number:`_number_g1hd2_50`,selected:`_selected_g1hd2_54`,child:`_child_g1hd2_59`,selectCell:`_selectCell_g1hd2_70`,changed:`_changed_g1hd2_78`,rowError:`_rowError_g1hd2_87`,editing:`_editing_g1hd2_104`,editor:`_editor_g1hd2_110`,textareaEditor:`_textareaEditor_g1hd2_122`,checkboxEditor:`_checkboxEditor_g1hd2_132`};function qM({field:e,value:t,label:n,onCommit:r,onCancel:i}){let a=(0,_.useRef)(null),o=(0,_.useRef)(!1),s=(0,_.useRef)(!1),c=(0,_.useRef)(0),l=Lj(t),u=Fj(e)===`text`&&/[\r\n]/.test(l)?`textarea`:Fj(e),d=e=>{if(o.current)return;o.current=!0;let t=a.current;e&&s.current&&t?r(u===`checkbox`&&t instanceof HTMLInputElement?t.checked:Rj(t.value)):i()},f=(0,_.useRef)(d);(0,_.useEffect)(()=>{f.current=d});let p=(0,_.useRef)(!1);(0,_.useEffect)(()=>(p.current=!0,()=>{p.current=!1,setTimeout(()=>{p.current||f.current(!0)},0)}),[]);let m={"aria-label":n,autoFocus:!0,defaultValue:l,onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`?(e.preventDefault(),d(!1)):e.key!==`Enter`||$f(e.nativeEvent,c.current)||(u!==`textarea`||e.metaKey||e.ctrlKey)&&(e.preventDefault(),d(!0)))},onChange:()=>s.current=!0,onBlur:()=>d(!0)};if(u===`checkbox`){let{defaultValue:e,...n}=m;return(0,F.jsx)(`span`,{className:KM.checkboxEditor,children:(0,F.jsx)(`input`,{ref:e=>void(a.current=e),type:`checkbox`,defaultChecked:t===!0,...n})})}if(u===`picklist`){let t=(e.picklistValues??[]).filter(e=>e.active).map(e=>e.value);return l&&!t.includes(l)&&t.unshift(l),(0,F.jsxs)(`select`,{ref:e=>void(a.current=e),className:KM.editor,...m,children:[(0,F.jsx)(`option`,{value:``,children:C.picklistNone}),t.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]})}return u===`textarea`?(0,F.jsx)(`textarea`,{ref:e=>void(a.current=e),className:`${KM.editor} ${KM.textareaEditor}`,...m,onCompositionEnd:()=>c.current=Date.now()}):(0,F.jsx)(`input`,{ref:e=>void(a.current=e),className:KM.editor,spellCheck:!1,...m,onCompositionEnd:()=>c.current=Date.now()})}var JM=28,YM=50,XM=`3.5em`;function ZM(e){return typeof e?.Id==`string`?e.Id:``}function QM({records:e,loaded:t=e.length,rows:n,columns:r,instanceUrl:i,selected:a,onSelect:o,onOpenChild:s,onNearEnd:c,label:l,edit:u}){let d=(0,_.useRef)(null),f=n?n.length:t,p=(0,_.useRef)(new Map),m=(0,_.useRef)(0),h=(0,_.useMemo)(()=>{let n=e.slice(m.current,t);for(let e of r)p.current.has(e.key)||p.current.set(e.key,{width:Nd(e,n),number:Pd(e,n)});m.current=t;let i=r.map(e=>`calc(${p.current.get(e.key).width*1.2}ch + 2 * var(--space-3))`);return(u?[XM,...i]:i).join(` `)},[r,e,t,u]),g=UM({count:f,getScrollElement:()=>d.current,estimateSize:()=>JM,overscan:10,scrollMargin:JM,initialRect:{width:0,height:600}}),v=g.getVirtualItems(),y=v.length>0?v[v.length-1].index:-1;(0,_.useEffect)(()=>{c&&f>0&&y>=f-YM&&c()},[c,y,f]);let b=e=>{if(e.target!==e.currentTarget)return;if(e.key===`Enter`&&u&&a){e.preventDefault(),x(a);return}if(!o||![`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(e.key)||f===0)return;e.preventDefault();let t=a?n?n.indexOf(a.row):a.row:-1,i=a?Math.max(r.findIndex(e=>e.key===a.column.key),0):0,s=Math.max(t,0),c=i;t!==-1&&(e.key===`ArrowUp`&&(s=Math.max(t-1,0)),e.key===`ArrowDown`&&(s=Math.min(t+1,f-1)),e.key===`ArrowLeft`&&(c=Math.max(i-1,0)),e.key===`ArrowRight`&&(c=Math.min(i+1,r.length-1))),o({row:n?n[s]:s,column:r[c]}),g.scrollToIndex(s)},x=t=>{if(!u||u.disabled)return;let n=u.fieldOf(t.column),r=e[t.row];n&&r&&Ij(Ed(r,t.column))&&u.onEdit(t)},S=u?u.shownIds.filter(e=>u.isSelected(e)).length:0,w=v.length>0?v[0].start-JM:0,T=v.length>0?g.getTotalSize()-v[v.length-1].end+JM:0;return(0,F.jsx)(`div`,{ref:d,className:KM.scroll,style:{"--row-height":`${JM}px`},tabIndex:o?0:void 0,onKeyDown:b,children:(0,F.jsxs)(`div`,{className:KM.grid,role:`table`,"aria-label":l,"aria-rowcount":f+1,style:{gridTemplateColumns:h},children:[(0,F.jsxs)(`div`,{className:`${KM.row} ${KM.header}`,role:`row`,"aria-rowindex":1,children:[u&&(0,F.jsx)(`div`,{role:`columnheader`,className:`${KM.cell} ${KM.selectCell}`,children:(0,F.jsx)(`input`,{type:`checkbox`,"aria-label":C.selectAllRows,disabled:u.disabled||u.shownIds.length===0,checked:u.shownIds.length>0&&S===u.shownIds.length,ref:e=>{e&&(e.indeterminate=S>0&&S<u.shownIds.length)},onChange:e=>u.onSelectRows(u.shownIds,e.target.checked)})}),r.map(e=>(0,F.jsx)(`div`,{role:`columnheader`,className:`${KM.cell} ${p.current.get(e.key)?.number?KM.number:``}`,title:e.key,children:e.key},e.key))]}),(0,F.jsx)(`div`,{className:KM.spacer,style:{height:w}}),v.map(t=>{let c=n?n[t.index]:t.index,l=e[c],f=ZM(l),m=u?.errorOf(f);return(0,F.jsxs)(`div`,{className:KM.row,role:`row`,"aria-rowindex":t.index+2,children:[u&&(0,F.jsxs)(`div`,{role:`cell`,className:`${KM.cell} ${KM.selectCell}`,children:[(0,F.jsx)(`input`,{type:`checkbox`,"aria-label":C.selectRow,disabled:u.disabled||!f,checked:u.isSelected(f),onChange:e=>u.onSelectRows([f],e.target.checked)}),m&&(0,F.jsx)(`button`,{type:`button`,className:KM.rowError,"aria-label":C.rowError,title:m,onClick:()=>u.onShowError(f),children:`!`})]}),r.map(e=>{let t=u?.fieldOf(e),n=u&&t?u.changed(f,e):void 0,r=n?n.value:Ed(l,e),m=a?.row===c&&a.column.key===e.key;if(u&&t&&u.editing?.row===c&&u.editing.column.key===e.key)return(0,F.jsx)(`div`,{role:`cell`,className:`${KM.cell} ${KM.editing}`,children:(0,F.jsx)(qM,{field:t,value:r,label:C.editCell(e.key),onCommit:t=>{u.onSet(c,e,t),u.onEdit(void 0),d.current?.focus()},onCancel:()=>{u.onEdit(void 0),d.current?.focus()}})},e.key);let h=t!==void 0&&!Ij(Ed(l,e));return(0,F.jsx)($M,{value:r,number:p.current.get(e.key)?.number??!1,instanceUrl:i,selected:m,changed:n!==void 0,linkable:!t,title:h?C.editRounded:void 0,onSelect:o&&(()=>o({row:c,column:e})),onDoubleClick:t?()=>x({row:c,column:e}):void 0,onOpenChild:s&&(t=>s(c,e,t))},e.key)})]},c)}),(0,F.jsx)(`div`,{className:KM.spacer,style:{height:T}})]})})}function $M({value:e,number:t,instanceUrl:n,selected:r,changed:i=!1,linkable:a=!0,title:o,onSelect:s,onDoubleClick:c,onOpenChild:l}){let u=Dd(e),d=`${KM.cell} ${t?KM.number:``} ${r?KM.selected:``} ${i?KM.changed:``}`,f=u;return xd(e)&&l?f=(0,F.jsx)(`button`,{type:`button`,className:KM.child,onClick:()=>l(e),title:C.openChildRecords,children:u}):GM(e)&&n&&a&&(f=(0,F.jsx)(`a`,{href:`${n}/${e}`,target:`_blank`,rel:`noreferrer`,children:u})),(0,F.jsxs)(`div`,{role:`cell`,className:d,title:o,onClick:s,onDoubleClick:c,children:[f,i&&(0,F.jsx)(`span`,{className:`visually-hidden`,children:C.cellChanged})]})}var eN=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function tN(){let{result:e,running:t,cancel:n}=Yd();return(0,F.jsx)(`section`,{className:`${K.panel} ${tM.result}`,"aria-label":C.results,"aria-busy":t,children:t?(0,F.jsxs)(`div`,{className:tM.running,children:[(0,F.jsx)(`p`,{className:K.empty,children:C.runningQuery}),(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:n,children:C.cancel}),(0,F.jsx)(`p`,{className:K.meta,children:C.cancelRunNote})]}):(0,F.jsx)(nN,{result:e})})}function nN({result:e}){return(0,F.jsxs)(F.Fragment,{children:[e.state===`idle`&&(0,F.jsx)(`p`,{className:K.empty,children:C.noResults}),e.state===`error`&&(0,F.jsxs)(`div`,{className:tM.error,role:`alert`,children:[(0,F.jsx)(`p`,{className:tM.message,children:e.message}),e.reloginCommand&&(0,F.jsx)(Ke,{command:e.reloginCommand}),e.rejected&&(0,F.jsx)(`div`,{children:(0,F.jsx)(lp,{error:e.message,rejected:e.rejected})}),(0,F.jsx)(_t,{details:e.details})]}),e.state===`done`&&(0,F.jsx)(oN,{result:e},e.id)]})}var rN=new WeakMap;function iN(e,t,n,r,i){let a=t.length,o=rN.get(e);(!o||o.filter!==i||o.columns!==n||o.revision!==r||o.count>a)&&(o={filter:i,columns:n,revision:r,count:0,matches:[]});let s=[...o.matches];for(let e=o.count;e<a;e++)n.some(n=>Dd(Ed(t[e],n)).toLowerCase().includes(i))&&s.push(e);return rN.set(e,{filter:i,columns:n,revision:r,count:a,matches:s}),s}function aN(e){let{reportApiUsage:t,reportOrgError:n}=Ae(),{start:r,running:i}=ue(),[a,o]=(0,_.useReducer)(Mj,e,e=>({records:e.records,next:e.nextRecordsUrl,columns:e.columns,failure:void 0,removed:0,revision:0})),s=(0,_.useCallback)(e=>o({type:`patched`,values:e}),[]),c=(0,_.useCallback)(e=>o({type:`removed`,ids:e}),[]),{next:l,failure:u}=a;(0,_.useEffect)(()=>{u?.kind===`retry`&&n(e.username,u.error)},[u]);let d=(0,_.useCallback)(async(n=!1)=>{if(!l||u&&!n)return;let i=await r(t=>P.nextPage(e.username,l,t),`ignore`);if(i.kind===`done`){let n=i.value;t(e.username,n.apiUsage),o({type:`page`,from:l,records:n.records,next:n.done?void 0:n.nextRecordsUrl})}else if(i.kind===`error`){let e=oe(i.error)?{kind:`rerun`}:{kind:`retry`,error:i.error};o({type:`failed`,from:l,failure:e})}},[e.username,l,u,i,r,t]);return{...a,load:d,loading:i,patchRows:s,removeRows:c}}function oN({result:e}){let t=aN(e),{orgs:n,summaries:r}=Ae(),{settings:i}=he(),a=n?.find(t=>t.username===e.username)?.instanceUrl,[o,s]=(0,_.useState)(``),c=(0,_.useId)(),l=(0,_.useDeferredValue)(o.trim().toLowerCase()),[u,d]=(0,_.useState)(),[f,p]=(0,_.useState)(),{records:m,columns:h}=t,g=m.length,v=(0,_.useMemo)(()=>l?iN(e,m,h,t.revision,l):void 0,[e,m,h,t.revision,l]),y=(0,_.useMemo)(()=>(v?v.map(e=>m[e]):m).map(e=>typeof e.Id==`string`?e.Id:``).filter(Boolean),[v,m]),b=i?.omitNamespace??!0?r[e.username]?.namespacePrefix:void 0,x=Jj({username:e.username,result:e,records:m,columns:h,shownIds:y,patchRows:t.patchRows,removeRows:t.removeRows,ns:b}),[S,w]=(0,_.useState)(),[T,E]=(0,_.useState)(),[D,O]=(0,_.useState)(t.removed);D!==t.removed&&(O(t.removed),d(void 0),p(void 0),w(void 0));let[k,A]=(0,_.useState)(v);k!==v&&(A(v),w(void 0));let{state:j,dispatch:M,fields:ee,sending:N}=x,P=(0,_.useMemo)(()=>{if(j.editing&&ee)return{fieldOf:e=>ee.get(e.key),changed:(e,t)=>{let n=j.changes.get(e);return n&&Object.hasOwn(n,t.key)?{value:n[t.key]}:void 0},editing:S,onEdit:w,onSet:(e,t,n)=>{let r=m[e],i=typeof r.Id==`string`?r.Id:``;i&&M({type:`set`,id:i,column:t.key,value:n,same:zj(Ed(r,t),n)})},isSelected:e=>j.selected.has(e),onSelectRows:(e,t)=>M({type:`select`,ids:e,on:t}),shownIds:y,errorOf:e=>j.errors.get(e),onShowError:E,disabled:N}},[j,ee,S,m,M,y,N]),te=t.next?Math.max(e.totalSize-t.removed-g,0):0,ne=te>0?Math.min(e.pageSize,te):e.pageSize;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:K.header,children:[(0,F.jsx)(`span`,{className:tM.count,children:C.recordCount(e.totalSize-t.removed)}),t.next&&(0,F.jsx)(`span`,{className:K.meta,children:C.loadedCount(g)}),(0,F.jsx)(`span`,{className:K.meta,children:[e.object,C.elapsed((e.elapsedMs/1e3).toFixed(2)),eN.format(e.executedAt)].filter(Boolean).join(` · `)}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsxs)(`span`,{className:tM.filter,children:[(0,F.jsx)(`input`,{className:K.input,type:`search`,"aria-label":C.filterRows,"aria-describedby":v?`${c}-count`:void 0,placeholder:C.filterRows,value:o,onChange:e=>s(e.target.value)}),v&&(0,F.jsx)(`span`,{id:`${c}-count`,className:tM.matchCount,children:C.matchedCount(v.length)})]}),(0,F.jsx)(eM,{result:e,pages:t}),(0,F.jsx)(rM,{edits:x})]}),x.editing&&(0,F.jsx)(iM,{edits:x}),(0,F.jsxs)(`div`,{className:tM.body,children:[(0,F.jsx)(QM,{records:m,loaded:g,rows:v,columns:h,instanceUrl:a,selected:u,onSelect:d,onOpenChild:(e,t,n)=>p({row:e,column:t,child:n}),onNearEnd:v?void 0:t.load,label:C.results,edit:P}),t.next&&(v||t.loading||t.failure)&&(0,F.jsx)(`div`,{className:tM.more,children:t.loading?(0,F.jsx)(`span`,{className:K.meta,children:C.loadingMore}):t.failure?.kind===`rerun`?(0,F.jsx)(`span`,{className:K.meta,children:C.locatorExpired}):(0,F.jsxs)(F.Fragment,{children:[t.failure&&(0,F.jsx)(`span`,{className:K.meta,children:C.loadMoreFailed}),(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:()=>void t.load(!0),children:C.loadMore(ne)})]})}),u&&(0,F.jsx)(sN,{records:m,cell:u}),T&&j.errors.has(T)&&(0,F.jsxs)(`div`,{className:tM.detail,role:`status`,children:[(0,F.jsx)(`span`,{className:`${K.meta} ${K.mono}`,children:T}),(0,F.jsx)(`span`,{className:tM.detailText,children:j.errors.get(T)})]}),f&&(0,F.jsx)(cN,{open:f,instanceUrl:a,onClose:()=>p(void 0)},`${f.row}\n${f.column.key}`)]})]})}function sN({records:e,cell:t}){let n=Dd(Ed(e[t.row],t.column));return(0,F.jsxs)(`div`,{className:tM.detail,children:[(0,F.jsx)(`span`,{className:`${K.meta} ${K.mono}`,children:t.column.key}),(0,F.jsx)(`span`,{className:tM.detailText,children:n})]})}function cN({open:e,instanceUrl:t,onClose:n}){let r=(0,_.useMemo)(()=>wd([],e.child.records),[e.child.records]),[i,a]=(0,_.useState)();return(0,F.jsxs)(`section`,{className:tM.childPanel,"aria-label":e.column.key,children:[(0,F.jsxs)(`div`,{className:K.header,children:[(0,F.jsx)(`span`,{className:tM.count,children:C.childRecordsTitle(e.column.key,e.row+1)}),(0,F.jsx)(`span`,{className:K.meta,children:C.recordCount(e.child.totalSize)}),e.child.records.length<e.child.totalSize&&(0,F.jsx)(`span`,{className:K.meta,children:C.childFirstPageOnly}),(0,F.jsx)(`span`,{className:K.spacer}),(0,F.jsx)(`button`,{type:`button`,className:K.button,onClick:n,children:C.close})]}),(0,F.jsx)(QM,{records:e.child.records,columns:r,instanceUrl:t,selected:i,onSelect:a,label:e.column.key}),i&&(0,F.jsx)(sN,{records:e.child.records,cell:i})]})}var lN={screen:`_screen_9j4j9_2`,workspace:`_workspace_9j4j9_13`,left:`_left_9j4j9_22`,leftClosed:`_leftClosed_9j4j9_23`,fill:`_fill_9j4j9_40`,top:`_top_9j4j9_52`,right:`_right_9j4j9_56`,closedEditor:`_closedEditor_9j4j9_87`,firstLine:`_firstLine_9j4j9_95`,noOrg:`_noOrg_9j4j9_104`},uN=[`objects`,`editor`,`recent`];function dN(){let{selected:e,seed:t,loading:n,orgs:r}=Ae();return e?(0,F.jsx)(fN,{username:e,seed:t},e):(0,F.jsx)(`section`,{className:`${K.panel} ${lN.noOrg}`,"aria-busy":n&&!r,children:(0,F.jsx)(`p`,{className:K.empty,children:!r&&n?C.loadingOrgs:r?.length===0?C.noOrgs:C.selectOrgFirst})})}function fN({username:e,seed:t}){let{mode:n}=he(),[r,i]=(0,_.useState)(n===`rest`);n===`rest`&&!r&&i(!0);let[a,o]=(0,_.useState)(n===`apex`),[s]=(0,_.useState)(()=>Bd(e,t?.apex?.code,zd)),[c]=(0,_.useState)(()=>({soql:Ud(e,`soql`),apex:Ud(e,`apex`)}));return n===`apex`&&!a&&o(!0),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:lN.screen,hidden:n!==`soql`,children:(0,F.jsx)(qd,{username:e,seed:t,initialApiVersion:c.soql,children:(0,F.jsx)(Pt,{storageKey:`sfbench.panels`,names:uN,children:(0,F.jsx)(rf,{username:e,children:(0,F.jsx)(pN,{username:e,initialText:t?.query})})})})}),r&&(0,F.jsx)(`div`,{className:lN.screen,hidden:n!==`rest`,children:(0,F.jsx)(zf,{username:e,seed:t,children:(0,F.jsx)(Uf,{username:e,children:(0,F.jsx)(mO,{})})})}),a&&(0,F.jsx)(`div`,{className:lN.screen,hidden:n!==`apex`,children:(0,F.jsx)(hf,{username:e,seed:t,initialCode:s,initialApiVersion:c.apex,children:(0,F.jsx)(Cf,{username:e,children:(0,F.jsx)(lD,{})})})})]})}function pN({username:e,initialText:t}){let{open:n,setOpen:r}=Ft();return(0,F.jsxs)(`div`,{className:lN.workspace,children:[(0,F.jsxs)(`div`,{className:n.objects?lN.left:lN.leftClosed,children:[!n.objects&&(0,F.jsx)(mN,{onClick:()=>r(`objects`,!0)}),(0,F.jsx)(`div`,{className:lN.fill,hidden:!n.objects,children:(0,F.jsx)(Dj,{username:e})})]}),(0,F.jsxs)(`div`,{className:lN.right,children:[(0,F.jsxs)(`div`,{className:lN.top,hidden:!n.editor,children:[(0,F.jsx)(fj,{username:e,initialText:t}),n.recent?(0,F.jsx)(jj,{}):(0,F.jsx)(tD,{label:C.showRecent,text:C.recent,onClick:()=>r(`recent`,!0)})]}),!n.editor&&(0,F.jsx)(hN,{}),(0,F.jsx)(nD,{open:n.editor,showLabel:C.showEditor,hideLabel:C.hideEditor,onToggle:()=>r(`editor`,!n.editor)}),(0,F.jsx)(tN,{})]})]})}function mN({onClick:e}){let t=Jd();return(0,F.jsx)(tD,{label:C.showObjects,text:t.panelObject??C.sObjects,onClick:e})}function hN(){let e=Jd();return(0,F.jsxs)(`div`,{className:`${K.panel} ${lN.closedEditor}`,children:[(0,F.jsx)(dj,{}),(0,F.jsx)(`code`,{className:lN.firstLine,children:e.firstLine})]})}function gN({launch:e}){return(0,F.jsx)(R,{initialMode:e?.rest?`rest`:e?.apex?`apex`:void 0,children:(0,F.jsx)(ke,{launch:e,children:(0,F.jsx)(_N,{})})})}function _N(){let{sfNotFound:e}=he();return e?(0,F.jsx)(xt,{message:C.sfNotFound,children:(0,F.jsx)(`a`,{href:`https://developer.salesforce.com/tools/salesforcecli`,target:`_blank`,rel:`noreferrer`,children:C.installSf})}):(0,F.jsxs)(`div`,{className:y.app,children:[(0,F.jsx)(mt,{}),(0,F.jsx)(Pe,{}),(0,F.jsx)(`main`,{className:y.main,children:(0,F.jsx)(dN,{})}),(0,F.jsx)(yt,{}),(0,F.jsx)(vN,{})]})}function vN(){let{discarding:e,confirmDiscard:t,cancelDiscard:n}=he();return e?(0,F.jsx)(Ie,{title:C.discardTitle,message:C.discardMessage(e.count),confirmLabel:C.discardConfirm,onConfirm:t,onCancel:n}):null}async function yN(e,t){let n=/^\/launch\/([^/]+)$/.exec(e.pathname);if(n)try{let{launch:e}=await P.exchangeLaunchCode(decodeURIComponent(n[1]));return t.replaceState(null,``,`/`),{kind:`ready`,launch:e}}catch(e){return t.replaceState(null,``,`/`),e instanceof k&&e.status===410?{kind:`expired`}:{kind:`error`,message:C.sessionLost}}return E()?{kind:`ready`}:{kind:`noSession`}}var bN=(0,v.createRoot)(document.getElementById(`root`));yN(window.location,window.history).then(e=>{bN.render((0,F.jsx)(_.StrictMode,{children:e.kind===`ready`?(0,F.jsx)(gN,{launch:e.launch}):(0,F.jsx)(xt,{message:e.kind===`expired`?C.launchExpired:e.kind===`noSession`?C.noSession:e.message})}))});
|