@thebuoyant-tsdev/mui-ts-library 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +4 -33
- package/README.md +5 -34
- package/dist/components/gantt-chart/GanttBarRow.d.ts +24 -0
- package/dist/components/gantt-chart/GanttChart.constants.d.ts +4 -0
- package/dist/components/gantt-chart/GanttDependencyArrows.d.ts +22 -0
- package/dist/components/gantt-chart/GanttStatusContextMenu.d.ts +19 -0
- package/dist/components/gantt-chart/GanttWeekendStrips.d.ts +17 -0
- package/dist/components/gantt-chart/hooks/useGanttDrag.d.ts +44 -0
- package/dist/components/password-strength-meter/PasswordStrengthBar.d.ts +12 -0
- package/dist/components/shared/ToolbarButton.d.ts +13 -0
- package/dist/components/shared/normalizeSize.d.ts +11 -0
- package/dist/index.cjs +1 -230
- package/dist/index.d.cts +14 -0
- package/dist/index.js +4227 -43419
- package/package.json +11 -6
package/dist/index.cjs
CHANGED
|
@@ -1,230 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require(`react`);u=l(u,1);let d=require(`@mui/material`),f=require(`@emotion/styled`);f=l(f,1),require(`@emotion/react`);let p=require(`react-dom`);p=l(p,1);var m=o((e=>{var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case l:case u:case i:case o:case a:case f:return e;default:switch(e&&=e.$$typeof,e){case c:case d:case h:case m:case s:return e;default:return t}}case r:return t}}}function x(e){return b(e)===u}e.AsyncMode=l,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=s,e.Element=n,e.ForwardRef=d,e.Fragment=i,e.Lazy=h,e.Memo=m,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=f,e.isAsyncMode=function(e){return x(e)||b(e)===l},e.isConcurrentMode=x,e.isContextConsumer=function(e){return b(e)===c},e.isContextProvider=function(e){return b(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return b(e)===d},e.isFragment=function(e){return b(e)===i},e.isLazy=function(e){return b(e)===h},e.isMemo=function(e){return b(e)===m},e.isPortal=function(e){return b(e)===r},e.isProfiler=function(e){return b(e)===o},e.isStrictMode=function(e){return b(e)===a},e.isSuspense=function(e){return b(e)===f},e.isValidElementType=function(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},e.typeOf=b})),h=o((e=>{process.env.NODE_ENV!==`production`&&(function(){"use strict";var t=typeof Symbol==`function`&&Symbol.for,n=t?Symbol.for(`react.element`):60103,r=t?Symbol.for(`react.portal`):60106,i=t?Symbol.for(`react.fragment`):60107,a=t?Symbol.for(`react.strict_mode`):60108,o=t?Symbol.for(`react.profiler`):60114,s=t?Symbol.for(`react.provider`):60109,c=t?Symbol.for(`react.context`):60110,l=t?Symbol.for(`react.async_mode`):60111,u=t?Symbol.for(`react.concurrent_mode`):60111,d=t?Symbol.for(`react.forward_ref`):60112,f=t?Symbol.for(`react.suspense`):60113,p=t?Symbol.for(`react.suspense_list`):60120,m=t?Symbol.for(`react.memo`):60115,h=t?Symbol.for(`react.lazy`):60116,g=t?Symbol.for(`react.block`):60121,_=t?Symbol.for(`react.fundamental`):60117,v=t?Symbol.for(`react.responder`):60118,y=t?Symbol.for(`react.scope`):60119;function b(e){return typeof e==`string`||typeof e==`function`||e===i||e===u||e===o||e===a||e===f||e===p||typeof e==`object`&&!!e&&(e.$$typeof===h||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===_||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)}function x(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:var p=e.type;switch(p){case l:case u:case i:case o:case a:case f:return p;default:var g=p&&p.$$typeof;switch(g){case c:case d:case h:case m:case s:return g;default:return t}}case r:return t}}}var S=l,C=u,w=c,T=s,E=n,ee=d,te=i,ne=h,D=m,re=r,O=o,ie=a,ae=f,oe=!1;function se(e){return oe||(oe=!0,console.warn(`The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.`)),ce(e)||x(e)===l}function ce(e){return x(e)===u}function le(e){return x(e)===c}function k(e){return x(e)===s}function ue(e){return typeof e==`object`&&!!e&&e.$$typeof===n}function de(e){return x(e)===d}function fe(e){return x(e)===i}function pe(e){return x(e)===h}function me(e){return x(e)===m}function he(e){return x(e)===r}function ge(e){return x(e)===o}function _e(e){return x(e)===a}function ve(e){return x(e)===f}e.AsyncMode=S,e.ConcurrentMode=C,e.ContextConsumer=w,e.ContextProvider=T,e.Element=E,e.ForwardRef=ee,e.Fragment=te,e.Lazy=ne,e.Memo=D,e.Portal=re,e.Profiler=O,e.StrictMode=ie,e.Suspense=ae,e.isAsyncMode=se,e.isConcurrentMode=ce,e.isContextConsumer=le,e.isContextProvider=k,e.isElement=ue,e.isForwardRef=de,e.isFragment=fe,e.isLazy=pe,e.isMemo=me,e.isPortal=he,e.isProfiler=ge,e.isStrictMode=_e,e.isSuspense=ve,e.isValidElementType=b,e.typeOf=x})()})),g=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=m():t.exports=h()})),_=o(((e,t)=>{var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(e==null)throw TypeError(`Object.assign cannot be called with null or undefined`);return Object(e)}function o(){try{if(!Object.assign)return!1;var e=new String(`abc`);if(e[5]=`de`,Object.getOwnPropertyNames(e)[0]===`5`)return!1;for(var t={},n=0;n<10;n++)t[`_`+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(``)!==`0123456789`)return!1;var r={};return`abcdefghijklmnopqrst`.split(``).forEach(function(e){r[e]=e}),Object.keys(Object.assign({},r)).join(``)===`abcdefghijklmnopqrst`}catch{return!1}}t.exports=o()?Object.assign:function(e,t){for(var o,s=a(e),c,l=1;l<arguments.length;l++){for(var u in o=Object(arguments[l]),o)r.call(o,u)&&(s[u]=o[u]);if(n){c=n(o);for(var d=0;d<c.length;d++)i.call(o,c[d])&&(s[c[d]]=o[c[d]])}}return s}})),v=o(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),y=o(((e,t)=>{t.exports=Function.call.bind(Object.prototype.hasOwnProperty)})),b=o(((e,t)=>{var n=function(){};if(process.env.NODE_ENV!==`production`){var r=v(),i={},a=y();n=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}}}function o(e,t,o,s,c){if(process.env.NODE_ENV!==`production`){for(var l in e)if(a(e,l)){var u;try{if(typeof e[l]!=`function`){var d=Error((s||`React class`)+`: `+o+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name=`Invariant Violation`,d}u=e[l](t,l,s,o,null,r)}catch(e){u=e}if(u&&!(u instanceof Error)&&n((s||`React class`)+`: type specification of `+o+" `"+l+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+`. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).`),u instanceof Error&&!(u.message in i)){i[u.message]=!0;var f=c?c():``;n(`Failed `+o+` type: `+u.message+(f??``))}}}}o.resetWarningCache=function(){process.env.NODE_ENV!==`production`&&(i={})},t.exports=o})),x=o(((e,t)=>{var n=g(),r=_(),i=v(),a=y(),o=b(),s=function(){};process.env.NODE_ENV!==`production`&&(s=function(e){var t=`Warning: `+e;typeof console<`u`&&console.error(t);try{throw Error(t)}catch{}});function c(){return null}t.exports=function(e,t){var l=typeof Symbol==`function`&&Symbol.iterator,u=`@@iterator`;function d(e){var t=e&&(l&&e[l]||e[u]);if(typeof t==`function`)return t}var f=`<<anonymous>>`,p={array:_(`array`),bigint:_(`bigint`),bool:_(`boolean`),func:_(`function`),number:_(`number`),object:_(`object`),string:_(`string`),symbol:_(`symbol`),any:v(),arrayOf:y,element:b(),elementType:x(),instanceOf:S,node:E(),objectOf:w,oneOf:C,oneOfType:T,shape:te,exact:ne};function m(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function h(e,t){this.message=e,this.data=t&&typeof t==`object`?t:{},this.stack=``}h.prototype=Error.prototype;function g(e){if(process.env.NODE_ENV!==`production`)var n={},r=0;function a(a,o,c,l,u,d,p){if(l||=f,d||=c,p!==i){if(t){var m=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name=`Invariant Violation`,m}else if(process.env.NODE_ENV!==`production`&&typeof console<`u`){var g=l+`:`+c;!n[g]&&r<3&&(s("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+l+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[g]=!0,r++)}}return o[c]==null?a?o[c]===null?new h(`The `+u+" `"+d+"` is marked as required "+("in `"+l+"`, but its value is `null`.")):new h(`The `+u+" `"+d+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(o,c,l,u,d)}var o=a.bind(null,!1);return o.isRequired=a.bind(null,!0),o}function _(e){function t(t,n,r,i,a,o){var s=t[n];if(O(s)!==e){var c=ie(s);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return g(t)}function v(){return g(c)}function y(e){function t(t,n,r,a,o){if(typeof e!=`function`)return new h("Property `"+o+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var c=O(s);return new h(`Invalid `+a+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<s.length;l++){var u=e(s,l,r,a,o+`[`+l+`]`,i);if(u instanceof Error)return u}return null}return g(t)}function b(){function t(t,n,r,i,a){var o=t[n];if(!e(o)){var s=O(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return g(t)}function x(){function e(e,t,r,i,a){var o=e[t];if(!n.isValidElementType(o)){var s=O(o);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement type."))}return null}return g(e)}function S(e){function t(t,n,r,i,a){if(!(t[n]instanceof e)){var o=e.name||f,s=oe(t[n]);return new h(`Invalid `+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+o+"`."))}return null}return g(t)}function C(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&(arguments.length>1?s(`Invalid arguments supplied to oneOf, expected an array, got `+arguments.length+` arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).`):s(`Invalid argument supplied to oneOf, expected an array.`)),c;function t(t,n,r,i,a){for(var o=t[n],s=0;s<e.length;s++)if(m(o,e[s]))return null;var c=JSON.stringify(e,function(e,t){return ie(t)===`symbol`?String(t):t});return new h(`Invalid `+i+" `"+a+"` of value `"+String(o)+"` "+("supplied to `"+r+"`, expected one of "+c+`.`))}return g(t)}function w(e){function t(t,n,r,o,s){if(typeof e!=`function`)return new h("Property `"+s+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var c=t[n],l=O(c);if(l!==`object`)return new h(`Invalid `+o+" `"+s+"` of type "+("`"+l+"` supplied to `"+r+"`, expected an object."));for(var u in c)if(a(c,u)){var d=e(c,u,r,o,s+`.`+u,i);if(d instanceof Error)return d}return null}return g(t)}function T(e){if(!Array.isArray(e))return process.env.NODE_ENV!==`production`&&s(`Invalid argument supplied to oneOfType, expected an instance of array.`),c;for(var t=0;t<e.length;t++){var n=e[t];if(typeof n!=`function`)return s(`Invalid argument supplied to oneOfType. Expected an array of check functions, but received `+ae(n)+` at index `+t+`.`),c}function r(t,n,r,o,s){for(var c=[],l=0;l<e.length;l++){var u=e[l],d=u(t,n,r,o,s,i);if(d==null)return null;d.data&&a(d.data,`expectedType`)&&c.push(d.data.expectedType)}var f=c.length>0?`, expected one of type [`+c.join(`, `)+`]`:``;return new h(`Invalid `+o+" `"+s+"` supplied to "+("`"+r+"`"+f+`.`))}return g(r)}function E(){function e(e,t,n,r,i){return D(e[t])?null:new h(`Invalid `+r+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return g(e)}function ee(e,t,n,r,i){return new h((e||`React class`)+`: `+t+" type `"+n+`.`+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function te(e){function t(t,n,r,a,o){var s=t[n],c=O(s);if(c!==`object`)return new h(`Invalid `+a+" `"+o+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));for(var l in e){var u=e[l];if(typeof u!=`function`)return ee(r,a,o,l,ie(u));var d=u(s,l,r,a,o+`.`+l,i);if(d)return d}return null}return g(t)}function ne(e){function t(t,n,o,s,c){var l=t[n],u=O(l);if(u!==`object`)return new h(`Invalid `+s+" `"+c+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var d in r({},t[n],e)){var f=e[d];if(a(e,d)&&typeof f!=`function`)return ee(o,s,c,d,ie(f));if(!f)return new h(`Invalid `+s+" `"+c+"` key `"+d+"` supplied to `"+o+`\`.
|
|
2
|
-
Bad object: `+JSON.stringify(t[n],null,` `)+`
|
|
3
|
-
Valid keys: `+JSON.stringify(Object.keys(e),null,` `));var p=f(l,d,o,s,c+`.`+d,i);if(p)return p}return null}return g(t)}function D(t){switch(typeof t){case`number`:case`string`:case`undefined`:return!0;case`boolean`:return!t;case`object`:if(Array.isArray(t))return t.every(D);if(t===null||e(t))return!0;var n=d(t);if(n){var r=n.call(t),i;if(n!==t.entries){for(;!(i=r.next()).done;)if(!D(i.value))return!1}else for(;!(i=r.next()).done;){var a=i.value;if(a&&!D(a[1]))return!1}}else return!1;return!0;default:return!1}}function re(e,t){return e===`symbol`?!0:t?t[`@@toStringTag`]===`Symbol`||typeof Symbol==`function`&&t instanceof Symbol:!1}function O(e){var t=typeof e;return Array.isArray(e)?`array`:e instanceof RegExp?`object`:re(t,e)?`symbol`:t}function ie(e){if(e==null)return``+e;var t=O(e);if(t===`object`){if(e instanceof Date)return`date`;if(e instanceof RegExp)return`regexp`}return t}function ae(e){var t=ie(e);switch(t){case`array`:case`object`:return`an `+t;case`boolean`:case`date`:case`regexp`:return`a `+t;default:return t}}function oe(e){return!e.constructor||!e.constructor.name?f:e.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p}})),S=o(((e,t)=>{var n=v();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),C=o(((e,t)=>{if(process.env.NODE_ENV!==`production`){var n=g();t.exports=x()(n.isElement,!0)}else t.exports=S()()}));function w(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=w(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function T(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=w(e))&&(r&&(r+=` `),r+=t);return r}function E(e,t,n=void 0){let r={};for(let i in e){let a=e[i],o=``,s=!0;for(let e=0;e<a.length;e+=1){let r=a[e];r&&(o+=(s===!0?``:` `)+t(r),s=!1,n&&n[r]&&(o+=` `+n[r]))}r[i]=o}return r}function ee(e,...t){let n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Minified MUI error #${e}; visit ${n} for the full message.`}function te(e){if(typeof e!=`string`)throw Error(process.env.NODE_ENV===`production`?ee(7):"MUI: `capitalize(string)` expects a string argument.");return e.charAt(0).toUpperCase()+e.slice(1)}var ne=te;function D(e,t){let n=Array.isArray(t),r=Array.isArray(e);return oe(t)?t:se(e)?ce(t):n&&r?ie(e,t):n===r?le(e,t):ce(t)}function re(e){let t=0,n=e.length,r=Array(n);for(t=0;t<n;t+=1)r[t]=ce(e[t]);return r}function O(e){let t={};for(let n in e)t[n]=ce(e[n]);return t}function ie(e,t){let n=e.length;for(let r=0;r<t.length;r+=1)e[n+r]=ce(t[r]);return e}function ae(e){return typeof e==`object`&&!!e&&!(e instanceof RegExp)&&!(e instanceof Date)}function oe(e){return typeof e!=`object`||!e}function se(e){return typeof e!=`object`||!e||e instanceof RegExp||e instanceof Date}function ce(e){return ae(e)?Array.isArray(e)?re(e):O(e):e}function le(e,t){for(let n in t)n in e?e[n]=D(e[n],t[n]):e[n]=ce(t[n]);return e}var k=l(C(),1),ue=process.env.NODE_ENV===`production`?{}:k.default.oneOfType([k.default.number,k.default.string,k.default.object,k.default.array]);function de(e){if(e==null)return!0;for(let t in e)return!1;return!0}var fe=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.suspense_list`),d=Symbol.for(`react.memo`),f=Symbol.for(`react.lazy`),p=Symbol.for(`react.view_transition`),m=Symbol.for(`react.client.reference`);function h(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case l:case u:case p:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:return e;case o:return e;default:return m}}case n:return m}}}e.ContextConsumer=o,e.ContextProvider=s,e.Element=t,e.ForwardRef=c,e.Fragment=r,e.Lazy=f,e.Memo=d,e.Portal=n,e.Profiler=a,e.StrictMode=i,e.Suspense=l,e.SuspenseList=u,e.isContextConsumer=function(e){return h(e)===o},e.isContextProvider=function(e){return h(e)===s},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===t},e.isForwardRef=function(e){return h(e)===c},e.isFragment=function(e){return h(e)===r},e.isLazy=function(e){return h(e)===f},e.isMemo=function(e){return h(e)===d},e.isPortal=function(e){return h(e)===n},e.isProfiler=function(e){return h(e)===a},e.isStrictMode=function(e){return h(e)===i},e.isSuspense=function(e){return h(e)===l},e.isSuspenseList=function(e){return h(e)===u},e.isValidElementType=function(e){return!!(typeof e==`string`||typeof e==`function`||e===r||e===a||e===i||e===l||e===u||typeof e==`object`&&e&&(e.$$typeof===f||e.$$typeof===d||e.$$typeof===s||e.$$typeof===o||e.$$typeof===c||e.$$typeof===m||e.getModuleId!==void 0))},e.typeOf=h})),pe=o((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(typeof e==`object`&&e){var t=e.$$typeof;switch(t){case n:switch(e=e.type,e){case i:case o:case a:case u:case d:case m:return e;default:switch(e&&=e.$$typeof,e){case c:case l:case p:case f:return e;case s:return e;default:return t}}case r:return t}}}var n=Symbol.for(`react.transitional.element`),r=Symbol.for(`react.portal`),i=Symbol.for(`react.fragment`),a=Symbol.for(`react.strict_mode`),o=Symbol.for(`react.profiler`),s=Symbol.for(`react.consumer`),c=Symbol.for(`react.context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`),m=Symbol.for(`react.view_transition`),h=Symbol.for(`react.client.reference`);e.ContextConsumer=s,e.ContextProvider=c,e.Element=n,e.ForwardRef=l,e.Fragment=i,e.Lazy=p,e.Memo=f,e.Portal=r,e.Profiler=o,e.StrictMode=a,e.Suspense=u,e.SuspenseList=d,e.isContextConsumer=function(e){return t(e)===s},e.isContextProvider=function(e){return t(e)===c},e.isElement=function(e){return typeof e==`object`&&!!e&&e.$$typeof===n},e.isForwardRef=function(e){return t(e)===l},e.isFragment=function(e){return t(e)===i},e.isLazy=function(e){return t(e)===p},e.isMemo=function(e){return t(e)===f},e.isPortal=function(e){return t(e)===r},e.isProfiler=function(e){return t(e)===o},e.isStrictMode=function(e){return t(e)===a},e.isSuspense=function(e){return t(e)===u},e.isSuspenseList=function(e){return t(e)===d},e.isValidElementType=function(e){return!!(typeof e==`string`||typeof e==`function`||e===i||e===o||e===a||e===u||e===d||typeof e==`object`&&e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===c||e.$$typeof===s||e.$$typeof===l||e.$$typeof===h||e.getModuleId!==void 0))},e.typeOf=t})()})),me=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=fe():t.exports=pe()}))();function he(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function ge(e){if(u.isValidElement(e)||(0,me.isValidElementType)(e)||!he(e))return e;let t={};return Object.keys(e).forEach(n=>{t[n]=ge(e[n])}),t}function _e(e,t,n={clone:!0}){let r=n.clone?{...e}:e;return he(e)&&he(t)&&Object.keys(t).forEach(i=>{u.isValidElement(t[i])||(0,me.isValidElementType)(t[i])?r[i]=t[i]:he(t[i])&&Object.prototype.hasOwnProperty.call(e,i)&&he(e[i])?r[i]=_e(e[i],t[i],n):n.clone?r[i]=he(t[i])?ge(t[i]):t[i]:r[i]=t[i]}),r}var ve=/min-width:\s*([0-9.]+)/;function ye(e,t){if(!e.containerQueries||!be(t))return t;let n=[];for(let e in t)e.startsWith(`@container`)&&n.push(e);n.sort((e,t)=>(e.match(ve)?.[1]||0)-+(t.match(ve)?.[1]||0));let r=t;for(let e=0;e<n.length;e+=1){let t=n[e],i=r[t];delete r[t],r[t]=i}return r}function be(e){for(let t in e)if(t.startsWith(`@container`))return!0;return!1}function xe(e,t){return t===`@`||t.startsWith(`@`)&&(e.some(e=>t.startsWith(`@${e}`))||!!t.match(/^@\d/))}function Se(e,t){let n=t.match(/^@([^/]+)?\/?(.+)?$/);if(!n){if(process.env.NODE_ENV!==`production`)throw Error(`MUI: The provided shorthand ${`(${t})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\nFor example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`);return null}let[,r,i]=n,a=Number.isNaN(+r)?r||0:+r;return e.containerQueries(i).up(a)}function Ce(e){let t=(e,t)=>e.replace(`@media`,t?`@container ${t}`:`@container`);function n(n,r){n.up=(...n)=>t(e.breakpoints.up(...n),r),n.down=(...n)=>t(e.breakpoints.down(...n),r),n.between=(...n)=>t(e.breakpoints.between(...n),r),n.only=(...n)=>t(e.breakpoints.only(...n),r),n.not=(...n)=>{let i=t(e.breakpoints.not(...n),r);return i.includes(`not all and`)?i.replace(`not all and `,``).replace(`min-width:`,`width<`).replace(`max-width:`,`width>`).replace(`and`,`or`):i}}let r={},i=e=>(n(r,e),r);return n(i),{...e,containerQueries:i}}var we=e=>{let t=Object.keys(e).map(t=>({key:t,val:e[t]}))||[];return t.sort((e,t)=>e.val-t.val),t.reduce((e,t)=>({...e,[t.key]:t.val}),{})};function Te(e){let{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n=`px`,step:r=5,...i}=e,a=we(t),o=Object.keys(a);function s(e){return`@media (min-width:${typeof t[e]==`number`?t[e]:e}${n})`}function c(e){return`@media (max-width:${(typeof t[e]==`number`?t[e]:e)-r/100}${n})`}function l(e,i){let a=o.indexOf(i);return`@media (min-width:${typeof t[e]==`number`?t[e]:e}${n}) and (max-width:${(a!==-1&&typeof t[o[a]]==`number`?t[o[a]]:i)-r/100}${n})`}function u(e){return o.indexOf(e)+1<o.length?l(e,o[o.indexOf(e)+1]):s(e)}function d(e){let t=o.indexOf(e);return t===0?s(o[1]):t===o.length-1?c(o[t]):l(e,o[o.indexOf(e)+1]).replace(`@media`,`@media not all and`)}let f=[];for(let e=0;e<o.length;e+=1)f.push(s(o[e]));return{keys:o,values:a,up:s,down:c,between:l,only:u,not:d,unit:n,internal_mediaKeys:f,...i}}var Ee={},De={xs:0,sm:600,md:900,lg:1200,xl:1536},Oe=Te({values:De}),ke={containerQueries:e=>({up:t=>{let n=typeof t==`number`?t:De[t]||t;return typeof n==`number`&&(n=`${n}px`),e?`@container ${e} (min-width:${n})`:`@container (min-width:${n})`}})};function Ae(e,t,n){let r={};return je(r,e.theme,t,(e,t,i)=>{let a=n(t,i);e?r[e]=a:D(r,a)})}function je(e,t,n,r){if(t??=Ee,Array.isArray(n)){let i=t.breakpoints??Oe;for(let t=0;t<n.length;t+=1)Me(e,i.up(i.keys[t]),n[t],void 0,r);return e}if(typeof n==`object`){let i=t.breakpoints??Oe,a=i.values??De;for(let o in n)if(xe(i.keys,o)){let i=Se(t.containerQueries?t:ke,o);i&&Me(e,i,n[o],o,r)}else if(o in a)Me(e,i.up(o),n[o],o,r);else{let t=o;e[t]=n[t]}return e}return r(void 0,n),e}function Me(e,t,n,r,i){e[t]??={},i(t,n,r)}function Ne(e=Oe){let{internal_mediaKeys:t}=e,n={};for(let e=0;e<t.length;e+=1)n[t[e]]={};return n}function Pe(e,t){let n=e.internal_mediaKeys;for(let e=0;e<n.length;e+=1){let r=n[e];de(t[r])&&delete t[r]}return t}function Fe(e,t){if(Array.isArray(t))return!0;if(typeof t==`object`&&t){for(let n=0;n<e.keys.length;n+=1)if(e.keys[n]in t)return!0;let n=Object.keys(t);for(let t=0;t<n.length;t+=1)if(xe(e.keys,n[t]))return!0}return!1}function Ie(e,t,n,r){let i;return i=typeof e==`function`?e(n):Array.isArray(e)?e[n]||n:typeof n==`string`&&Le(e,n,!0,r)||n,t&&(i=t(i,n,e)),i}function Le(e,t,n=!0,r=void 0){if(!e||!t)return null;let i=t.split(`.`);if(e.vars&&n){let t=Re(e.vars,i,r);if(t!=null)return t}return Re(e,i,r)}function Re(e,t,n=void 0){let r,i=e,a=0;for(;a<t.length;){if(i==null)return i;r=i,i=i[t[a]],a+=1}if(n&&i===void 0){let e=t[t.length-1],i=`${n}${e===`default`?``:te(e)}`;return r?.[i]}return i}function ze(e){let{prop:t,cssProperty:n=e.prop,themeKey:r,transform:i}=e,a=e=>{if(e[t]==null)return null;let a=e[t],o=e.theme,s=Le(o,r)||{};return Ae(e,a,e=>{let r=Ie(s,i,e,t);return n===!1?r:{[n]:r}})};return a.propTypes=process.env.NODE_ENV===`production`?{}:{[t]:ue},a.filterProps=[t],a}var Be={internal_cache:{}},Ve={m:`margin`,p:`padding`},He={t:`Top`,r:`Right`,b:`Bottom`,l:`Left`,x:[`Left`,`Right`],y:[`Top`,`Bottom`]},Ue={marginX:`mx`,marginY:`my`,paddingX:`px`,paddingY:`py`},We={};for(let e in Ve)We[e]=[Ve[e]];for(let e in Ve)for(let t in He){let n=Ve[e],r=He[t],i=Array.isArray(r)?r.map(e=>n+e):[n+r];We[e+t]=i}for(let e in Ue)We[e]=We[Ue[e]];var Ge=new Set([`m`,`mt`,`mr`,`mb`,`ml`,`mx`,`my`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`,`marginX`,`marginY`,`marginInline`,`marginInlineStart`,`marginInlineEnd`,`marginBlock`,`marginBlockStart`,`marginBlockEnd`]),Ke=new Set([`p`,`pt`,`pr`,`pb`,`pl`,`px`,`py`,`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`paddingX`,`paddingY`,`paddingInline`,`paddingInlineStart`,`paddingInlineEnd`,`paddingBlock`,`paddingBlockStart`,`paddingBlockEnd`]),qe=new Set([...Ge,...Ke]);function Je(e,t,n,r){let i=Le(e,t,!0)??n;return typeof i==`number`||typeof i==`string`?e=>typeof e==`string`?e:(process.env.NODE_ENV!==`production`&&typeof e!=`number`&&console.error(`MUI: Expected ${r} argument to be a number or a string, got ${e}.`),typeof i==`string`?i.startsWith(`var(`)&&e===0?0:i.startsWith(`var(`)&&e===1?i:`calc(${e} * ${i})`:i*e):Array.isArray(i)?e=>{if(typeof e==`string`)return e;let n=Math.abs(e);process.env.NODE_ENV!==`production`&&(Number.isInteger(n)?n>i.length-1&&console.error([`MUI: The value provided (${n}) overflows.`,`The supported values are: ${JSON.stringify(i)}.`,`${n} > ${i.length-1}, you need to add the missing values.`].join(`
|
|
4
|
-
`)):console.error([`MUI: The \`theme.${t}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${t}\` as a number.`].join(`
|
|
5
|
-
`)));let r=i[n];return e>=0?r:typeof r==`number`?-r:typeof r==`string`&&r.startsWith(`var(`)?`calc(-1 * ${r})`:`-${r}`}:typeof i==`function`?i:(process.env.NODE_ENV!==`production`&&console.error([`MUI: The \`theme.${t}\` value (${i}) is invalid.`,`It should be a number, an array or a function.`].join(`
|
|
6
|
-
`)),()=>void 0)}function Ye(e){return Je(e,`spacing`,8,`spacing`)}function Xe(e,t){return typeof t==`string`||t==null?t:e(t)}var Ze=[``];function Qe(e,t){let n=e.theme??Be,r=n?.internal_cache?.unarySpacing??Ye(n),i={};for(let n in e){if(!t.has(n))continue;let a=We[n]??(Ze[0]=n,Ze),o=e[n];je(i,e.theme,o,(e,t)=>{let n=e?i[e]:i;for(let e=0;e<a.length;e+=1)n[a[e]]=Xe(r,t)})}return i}function $e(e){return Qe(e,Ge)}$e.propTypes=process.env.NODE_ENV===`production`?{}:Array.from(Ge).reduce((e,t)=>(e[t]=ue,e),{}),$e.filterProps=Ge;function et(e){return Qe(e,Ke)}et.propTypes=process.env.NODE_ENV===`production`?{}:Array.from(Ke).reduce((e,t)=>(e[t]=ue,e),{}),et.filterProps=Ke;function tt(e){return Qe(e,qe)}tt.propTypes=process.env.NODE_ENV===`production`?{}:Array.from(qe).reduce((e,t)=>(e[t]=ue,e),{}),tt.filterProps=qe;function nt(...e){let t=e.reduce((e,t)=>(t.filterProps.forEach(n=>{e[n]=t}),e),{}),n=e=>{let n={};for(let r in e)t[r]&&D(n,t[r](e));return n};return n.propTypes=process.env.NODE_ENV===`production`?{}:e.reduce((e,t)=>Object.assign(e,t.propTypes),{}),n.filterProps=e.reduce((e,t)=>e.concat(t.filterProps),[]),n}function rt(e){return typeof e==`number`?`${e}px solid`:e}function it(e,t){return ze({prop:e,themeKey:`borders`,transform:t})}var at=it(`border`,rt),ot=it(`borderTop`,rt),st=it(`borderRight`,rt),ct=it(`borderBottom`,rt),lt=it(`borderLeft`,rt),ut=it(`borderColor`),dt=it(`borderTopColor`),ft=it(`borderRightColor`),pt=it(`borderBottomColor`),mt=it(`borderLeftColor`),ht=it(`outline`,rt),gt=it(`outlineColor`),_t=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){let t=Je(e.theme,`shape.borderRadius`,4,`borderRadius`);return Ae(e,e.borderRadius,e=>({borderRadius:Xe(t,e)}))}return null};_t.propTypes=process.env.NODE_ENV===`production`?{}:{borderRadius:ue},_t.filterProps=[`borderRadius`],nt(at,ot,st,ct,lt,ut,dt,ft,pt,mt,_t,ht,gt);var vt=e=>{if(e.gap!==void 0&&e.gap!==null){let t=Je(e.theme,`spacing`,8,`gap`);return Ae(e,e.gap,e=>({gap:Xe(t,e)}))}return null};vt.propTypes=process.env.NODE_ENV===`production`?{}:{gap:ue},vt.filterProps=[`gap`];var yt=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){let t=Je(e.theme,`spacing`,8,`columnGap`);return Ae(e,e.columnGap,e=>({columnGap:Xe(t,e)}))}return null};yt.propTypes=process.env.NODE_ENV===`production`?{}:{columnGap:ue},yt.filterProps=[`columnGap`];var bt=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){let t=Je(e.theme,`spacing`,8,`rowGap`);return Ae(e,e.rowGap,e=>({rowGap:Xe(t,e)}))}return null};bt.propTypes=process.env.NODE_ENV===`production`?{}:{rowGap:ue},bt.filterProps=[`rowGap`],nt(vt,yt,bt,ze({prop:`gridColumn`}),ze({prop:`gridRow`}),ze({prop:`gridAutoFlow`}),ze({prop:`gridAutoColumns`}),ze({prop:`gridAutoRows`}),ze({prop:`gridTemplateColumns`}),ze({prop:`gridTemplateRows`}),ze({prop:`gridTemplateAreas`}),ze({prop:`gridArea`}));function xt(e,t){return t===`grey`?t:e}nt(ze({prop:`color`,themeKey:`palette`,transform:xt}),ze({prop:`bgcolor`,cssProperty:`backgroundColor`,themeKey:`palette`,transform:xt}),ze({prop:`backgroundColor`,themeKey:`palette`,transform:xt}));function St(e){return e<=1&&e!==0?`${e*100}%`:e}var Ct=ze({prop:`width`,transform:St}),wt=e=>e.maxWidth!==void 0&&e.maxWidth!==null?Ae(e,e.maxWidth,t=>{let n=e.theme?.breakpoints?.values?.[t]||De[t];return n?e.theme?.breakpoints?.unit===`px`?{maxWidth:n}:{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:St(t)}}):null;wt.filterProps=[`maxWidth`];var Tt=ze({prop:`minWidth`,transform:St}),Et=ze({prop:`height`,transform:St}),Dt=ze({prop:`maxHeight`,transform:St}),Ot=ze({prop:`minHeight`,transform:St});ze({prop:`size`,cssProperty:`width`,transform:St}),ze({prop:`size`,cssProperty:`height`,transform:St}),nt(Ct,wt,Tt,Et,Dt,Ot,ze({prop:`boxSizing`}));var kt={border:{themeKey:`borders`,transform:rt},borderTop:{themeKey:`borders`,transform:rt},borderRight:{themeKey:`borders`,transform:rt},borderBottom:{themeKey:`borders`,transform:rt},borderLeft:{themeKey:`borders`,transform:rt},borderColor:{themeKey:`palette`},borderTopColor:{themeKey:`palette`},borderRightColor:{themeKey:`palette`},borderBottomColor:{themeKey:`palette`},borderLeftColor:{themeKey:`palette`},outline:{themeKey:`borders`,transform:rt},outlineColor:{themeKey:`palette`},borderRadius:{themeKey:`shape.borderRadius`,style:_t},color:{themeKey:`palette`,transform:xt},bgcolor:{themeKey:`palette`,cssProperty:`backgroundColor`,transform:xt},backgroundColor:{themeKey:`palette`,transform:xt},p:{style:et},pt:{style:et},pr:{style:et},pb:{style:et},pl:{style:et},px:{style:et},py:{style:et},padding:{style:et},paddingTop:{style:et},paddingRight:{style:et},paddingBottom:{style:et},paddingLeft:{style:et},paddingX:{style:et},paddingY:{style:et},paddingInline:{style:et},paddingInlineStart:{style:et},paddingInlineEnd:{style:et},paddingBlock:{style:et},paddingBlockStart:{style:et},paddingBlockEnd:{style:et},m:{style:$e},mt:{style:$e},mr:{style:$e},mb:{style:$e},ml:{style:$e},mx:{style:$e},my:{style:$e},margin:{style:$e},marginTop:{style:$e},marginRight:{style:$e},marginBottom:{style:$e},marginLeft:{style:$e},marginX:{style:$e},marginY:{style:$e},marginInline:{style:$e},marginInlineStart:{style:$e},marginInlineEnd:{style:$e},marginBlock:{style:$e},marginBlockStart:{style:$e},marginBlockEnd:{style:$e},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:vt},rowGap:{style:bt},columnGap:{style:yt},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:`zIndex`},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:`shadows`},width:{transform:St},maxWidth:{style:wt},minWidth:{transform:St},height:{transform:St},maxHeight:{transform:St},minHeight:{transform:St},boxSizing:{},font:{themeKey:`font`},fontFamily:{themeKey:`typography`},fontSize:{themeKey:`typography`},fontStyle:{themeKey:`typography`},fontWeight:{themeKey:`typography`},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:`typography`}},At={};function jt(){function e(t){if(!t.sx)return null;let{sx:n,theme:r=At,nested:i}=t,a=r.unstable_sxConfig??kt,o={sx:null,theme:r,nested:!0};function s(n){let s=n;if(typeof n==`function`)s=n(r);else if(typeof n!=`object`)return n;if(!s)return null;let c=r.breakpoints??Oe,l=Ne(c);for(let n in s){let i=Pt(s[n],r);if(i!=null){if(typeof i!=`object`){Nt(l,n,i,r,a);continue}if(a[n]){Nt(l,n,i,r,a);continue}Fe(c,i)?je(l,t.theme,i,(e,t)=>{l[e][n]=t}):(o.sx=i,l[n]=e(o))}}return!i&&r.modularCssLayers?{"@layer sx":ye(r,Pe(c,l))}:ye(r,Pe(c,l))}return Array.isArray(n)?n.map(s):s(n)}return e.filterProps=[`sx`],e}var Mt=jt();function Nt(e,t,n,r,i){let a=i[t];if(!a){e[t]=n;return}if(n==null)return;let{themeKey:o}=a;if(o===`typography`&&n===`inherit`){e[t]=n;return}let{style:s}=a;if(s){D(e,s({[t]:n,theme:r}));return}let{cssProperty:c=t,transform:l}=a,u=Le(r,o);je(e,r,n,(n,r)=>{let i=Ie(u,l,r,t);c===!1?D(n?e[n]:e,i):n?e[n][c]=i:e[c]=i})}function Pt(e,t){return typeof e==`function`?e(t):e}function Ft(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var It={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function Lt(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var Rt=!1,zt=/[A-Z]|^ms/g,Bt=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Vt=function(e){return e.charCodeAt(1)===45},Ht=function(e){return e!=null&&typeof e!=`boolean`},Ut=Lt(function(e){return Vt(e)?e:e.replace(zt,`-$&`).toLowerCase()}),Wt=function(e,t){switch(e){case`animation`:case`animationName`:if(typeof t==`string`)return t.replace(Bt,function(e,t,n){return Yt={name:t,styles:n,next:Yt},t})}return It[e]!==1&&!Vt(e)&&typeof t==`number`&&t!==0?t+`px`:t},Gt=`Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.`;function Kt(e,t,n){if(n==null)return``;var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case`boolean`:return``;case`object`:var i=n;if(i.anim===1)return Yt={name:i.name,styles:i.styles,next:Yt},i.name;var a=n;if(a.styles!==void 0){var o=a.next;if(o!==void 0)for(;o!==void 0;)Yt={name:o.name,styles:o.styles,next:Yt},o=o.next;return a.styles+`;`}return qt(e,t,n);case`function`:if(e!==void 0){var s=Yt,c=n(e);return Yt=s,Kt(e,t,c)}break}var l=n;if(t==null)return l;var u=t[l];return u===void 0?l:u}function qt(e,t,n){var r=``;if(Array.isArray(n))for(var i=0;i<n.length;i++)r+=Kt(e,t,n[i])+`;`;else for(var a in n){var o=n[a];if(typeof o!=`object`){var s=o;t!=null&&t[s]!==void 0?r+=a+`{`+t[s]+`}`:Ht(s)&&(r+=Ut(a)+`:`+Wt(a,s)+`;`)}else{if(a===`NO_COMPONENT_SELECTOR`&&Rt)throw Error(Gt);if(Array.isArray(o)&&typeof o[0]==`string`&&(t==null||t[o[0]]===void 0))for(var c=0;c<o.length;c++)Ht(o[c])&&(r+=Ut(a)+`:`+Wt(a,o[c])+`;`);else{var l=Kt(e,t,o);switch(a){case`animation`:case`animationName`:r+=Ut(a)+`:`+l+`;`;break;default:r+=a+`{`+l+`}`}}}}return r}var Jt=/label:\s*([^\s;{]+)\s*(;|$)/g,Yt;function Xt(e,t,n){if(e.length===1&&typeof e[0]==`object`&&e[0]!==null&&e[0].styles!==void 0)return e[0];var r=!0,i=``;Yt=void 0;var a=e[0];a==null||a.raw===void 0?(r=!1,i+=Kt(n,t,a)):i+=a[0];for(var o=1;o<e.length;o++)i+=Kt(n,t,e[o]),r&&(i+=a[o]);Jt.lastIndex=0;for(var s=``,c;(c=Jt.exec(i))!==null;)s+=`-`+c[1];return{name:Ft(i)+s,styles:i,next:Yt}}var Zt=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})),Qt=o((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=ne.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(D.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){ie||(ie=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return ae[e]||(ae[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(re(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(D.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,ce[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
7
|
-
let props = %s;
|
|
8
|
-
<%s {...props} />
|
|
9
|
-
React keys must be passed directly to JSX without using spread:
|
|
10
|
-
let props = %s;
|
|
11
|
-
<%s key={someKey} {...props} />`,o,p,m,p),ce[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),te=Symbol.for(`react.client.reference`),ne=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,re=Array.isArray,O=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var ie,ae={},oe=m.react_stack_bottom_frame.bind(m,o)(),se=O(i(o)),ce={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>ne.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):oe,r?O(i(e)):se)},e.jsxs=function(e,t,n){var r=1e4>ne.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):oe,r?O(i(e)):se)}})()})),$t=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Zt():t.exports=Qt()}));function en(e,t){let n=(0,f.default)(e,t);return process.env.NODE_ENV===`production`?n:(...t)=>{let r=typeof e==`string`?`"${e}"`:`component`;return t.length===0?console.error([`MUI: Seems like you called \`styled(${r})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join(`
|
|
12
|
-
`)):t.some(e=>e===void 0)&&console.error(`MUI: the styled(${r})(...args) API requires all its args to be defined.`),n(...t)}}function tn(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}var nn=[];function rn(e){return nn[0]=e,Xt(nn)}var an={borderRadius:4};function on(e=8,t=Ye({spacing:e})){if(e.mui)return e;let n=(...e)=>(process.env.NODE_ENV!==`production`&&(e.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${e.length}`)),(e.length===0?[1]:e).map(e=>{let n=t(e);return typeof n==`number`?`${n}px`:n}).join(` `));return n.mui=!0,n}function sn(e,t){let n=this;if(n.vars){if(!n.colorSchemes?.[e]||typeof n.getColorSchemeSelector!=`function`)return{};let r=n.getColorSchemeSelector(e);return r===`&`?t:((r.includes(`data-`)||r.includes(`.`))&&(r=`*:where(${r.replace(/\s*&$/,``)}) &`),{[r]:t})}return n.palette.mode===e?t:{}}function cn(e={},...t){let{breakpoints:n={},palette:r={},spacing:i,shape:a={},...o}=e,s=Te(n),c=on(i),l=_e({breakpoints:s,direction:`ltr`,components:{},palette:{mode:`light`,...r},spacing:c,shape:{...an,...a}},o);return l=Ce(l),l.applyStyles=sn,l=t.reduce((e,t)=>_e(e,t),l),l.unstable_sxConfig={...kt,...o?.unstable_sxConfig},l.unstable_sx=function(e){return Mt({sx:e,theme:this})},l.internal_cache={},l}var ln=e=>e,un=(()=>{let e=ln;return{configure(t){e=t},generate(t){return e(t)},reset(){e=ln}}})(),dn={active:`active`,checked:`checked`,completed:`completed`,disabled:`disabled`,error:`error`,expanded:`expanded`,focused:`focused`,focusVisible:`focusVisible`,open:`open`,readOnly:`readOnly`,required:`required`,selected:`selected`};function fn(e,t,n=`Mui`){let r=dn[t];return r?`${n}-${r}`:`${un.generate(e)}-${t}`}function pn(e,t,n=`Mui`){let r={};return t.forEach(t=>{r[t]=fn(e,t,n)}),r}function mn(e,t=``){return e.displayName||e.name||t}function hn(e,t,n){let r=mn(t);return e.displayName||(r===``?n:`${n}(${r})`)}function gn(e){if(e!=null){if(typeof e==`string`)return e;if(typeof e==`function`)return mn(e,`Component`);if(typeof e==`object`)switch(e.$$typeof){case me.ForwardRef:return hn(e,e.render,`ForwardRef`);case me.Memo:return hn(e,e.type,`memo`);default:return}}}function _n(e){let{variants:t,...n}=e,r={variants:t,style:rn(n),isProcessed:!0};return r.style===n||t&&t.forEach(e=>{typeof e.style!=`function`&&(e.style=rn(e.style))}),r}var vn=cn();function yn(e){return e!==`ownerState`&&e!==`theme`&&e!==`sx`&&e!==`as`}function bn(e,t){return t&&e&&typeof e==`object`&&e.styles&&!e.styles.startsWith(`@layer`)&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function xn(e){return e?(t,n)=>n[e]:null}function Sn(e,t,n){e.theme=de(e.theme)?n:e.theme[t]||e.theme}function Cn(e,t,n){let r=typeof t==`function`?t(e):t;if(Array.isArray(r))return r.flatMap(t=>Cn(e,t,n));if(Array.isArray(r?.variants)){let t;if(r.isProcessed)t=n?bn(r.style,n):r.style;else{let{variants:e,...i}=r;t=n?bn(rn(i),n):i}return wn(e,r.variants,[t],n)}return r?.isProcessed?n?bn(rn(r.style),n):r.style:n?bn(rn(r),n):r}function wn(e,t,n=[],r=void 0){let i;variantLoop:for(let a=0;a<t.length;a+=1){let o=t[a];if(typeof o.props==`function`){if(i??={...e,...e.ownerState,ownerState:e.ownerState},!o.props(i))continue}else for(let t in o.props)if(e[t]!==o.props[t]&&e.ownerState?.[t]!==o.props[t])continue variantLoop;typeof o.style==`function`?(i??={...e,...e.ownerState,ownerState:e.ownerState},n.push(r?bn(rn(o.style(i)),r):o.style(i))):n.push(r?bn(rn(o.style),r):o.style)}return n}function Tn(e={}){let{themeId:t,defaultTheme:n=vn,rootShouldForwardProp:r=yn,slotShouldForwardProp:i=yn}=e;function a(e){Sn(e,t,n)}return(e,t={})=>{tn(e,e=>e.filter(e=>e!==Mt));let{name:n,slot:o,skipVariantsResolver:s,skipSx:c,overridesResolver:l=xn(kn(o)),...u}=t,d=n&&n.startsWith(`Mui`)||o?`components`:`custom`,f=s===void 0?o&&o!==`Root`&&o!==`root`||!1:s,p=c||!1,m=yn;o===`Root`||o===`root`?m=r:o?m=i:On(e)&&(m=void 0);let h=en(e,{shouldForwardProp:m,label:Dn(n,o),...u}),g=e=>{if(e.__emotion_real===e)return e;if(typeof e==`function`)return function(t){return Cn(t,e,t.theme.modularCssLayers?d:void 0)};if(he(e)){let t=_n(e);return function(e){return t.variants?Cn(e,t,e.theme.modularCssLayers?d:void 0):e.theme.modularCssLayers?bn(t.style,d):t.style}}return e},_=(...t)=>{let r=[],i=t.map(g),s=[];if(r.push(a),n&&l&&s.push(function(e){let t=e.theme.components?.[n]?.styleOverrides;if(!t)return null;let r={};for(let n in t)r[n]=Cn(e,t[n],e.theme.modularCssLayers?`theme`:void 0);return l(e,r)}),n&&!f&&s.push(function(e){let t=e.theme?.components?.[n]?.variants;return t?wn(e,t,[],e.theme.modularCssLayers?`theme`:void 0):null}),p||s.push(Mt),Array.isArray(i[0])){let e=i.shift(),t=Array(r.length).fill(``),n=Array(s.length).fill(``),a;a=[...t,...e,...n],a.raw=[...t,...e.raw,...n],r.unshift(a)}let c=h(...r,...i,...s);return e.muiName&&(c.muiName=e.muiName),process.env.NODE_ENV!==`production`&&(c.displayName=En(n,o,e)),c};return h.withConfig&&(_.withConfig=h.withConfig),_}}function En(e,t,n){return e?`${e}${te(t||``)}`:`Styled(${gn(n)})`}function Dn(e,t){let n;return process.env.NODE_ENV!==`production`&&e&&(n=`${e}-${kn(t||`Root`)}`),n}function On(e){return typeof e==`string`&&e.charCodeAt(0)>96}function kn(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function An(e,t,n=!1){let r={...t};for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let a=i;if(a===`components`||a===`slots`)r[a]={...e[a],...r[a]};else if(a===`componentsProps`||a===`slotProps`){let i=e[a],o=t[a];if(!o)r[a]=i||{};else if(!i)r[a]=o;else{r[a]={...o};for(let e in i)if(Object.prototype.hasOwnProperty.call(i,e)){let t=e;r[a][t]=An(i[t],o[t],n)}}}else a===`className`&&n&&t.className!==void 0?r.className=T(e?.className,t?.className):a===`style`&&n&&t.style?r.style={...e?.style,...t?.style}:r[a]===void 0&&(r[a]=e[a])}return r}function jn(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function Mn(e,t=0,n=1){return process.env.NODE_ENV!==`production`&&(e<t||e>n)&&console.error(`MUI: The value provided ${e} is out of range [${t}, ${n}].`),jn(e,t,n)}function Nn(e){e=e.slice(1);let t=RegExp(`.{1,${e.length>=6?2:1}}`,`g`),n=e.match(t);return n&&n[0].length===1&&(n=n.map(e=>e+e)),process.env.NODE_ENV!==`production`&&e.length!==e.trim().length&&console.error(`MUI: The color: "${e}" is invalid. Make sure the color input doesn't contain leading/trailing space.`),n?`rgb${n.length===4?`a`:``}(${n.map((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3).join(`, `)})`:``}function Pn(e){if(e.type)return e;if(e.charAt(0)===`#`)return Pn(Nn(e));let t=e.indexOf(`(`),n=e.substring(0,t);if(![`rgb`,`rgba`,`hsl`,`hsla`,`color`].includes(n))throw Error(process.env.NODE_ENV===`production`?ee(9,e):`MUI: Unsupported \`${e}\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`);let r=e.substring(t+1,e.length-1),i;if(n===`color`){if(r=r.split(` `),i=r.shift(),r.length===4&&r[3].charAt(0)===`/`&&(r[3]=r[3].slice(1)),![`srgb`,`display-p3`,`a98-rgb`,`prophoto-rgb`,`rec-2020`].includes(i))throw Error(process.env.NODE_ENV===`production`?ee(10,i):`MUI: unsupported \`${i}\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`)}else r=r.split(`,`);return r=r.map(e=>parseFloat(e)),{type:n,values:r,colorSpace:i}}var Fn=e=>{let t=Pn(e);return t.values.slice(0,3).map((e,n)=>t.type.includes(`hsl`)&&n!==0?`${e}%`:e).join(` `)},In=(e,t)=>{try{return Fn(e)}catch{return t&&process.env.NODE_ENV!==`production`&&console.warn(t),e}};function Ln(e){let{type:t,colorSpace:n}=e,{values:r}=e;return t.includes(`rgb`)?r=r.map((e,t)=>t<3?parseInt(e,10):e):t.includes(`hsl`)&&(r[1]=`${r[1]}%`,r[2]=`${r[2]}%`),r=t.includes(`color`)?`${n} ${r.join(` `)}`:`${r.join(`, `)}`,`${t}(${r})`}function Rn(e){e=Pn(e);let{values:t}=e,n=t[0],r=t[1]/100,i=t[2]/100,a=r*Math.min(i,1-i),o=(e,t=(e+n/30)%12)=>i-a*Math.max(Math.min(t-3,9-t,1),-1),s=`rgb`,c=[Math.round(o(0)*255),Math.round(o(8)*255),Math.round(o(4)*255)];return e.type===`hsla`&&(s+=`a`,c.push(t[3])),Ln({type:s,values:c})}function zn(e){e=Pn(e);let t=e.type===`hsl`||e.type===`hsla`?Pn(Rn(e)).values:e.values;return t=t.map(t=>(e.type!==`color`&&(t/=255),t<=.03928?t/12.92:((t+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function Bn(e,t){let n=zn(e),r=zn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Vn(e,t){return e=Pn(e),t=Mn(t),(e.type===`rgb`||e.type===`hsl`)&&(e.type+=`a`),e.type===`color`?e.values[3]=`/${t}`:e.values[3]=t,Ln(e)}function Hn(e,t,n){try{return Vn(e,t)}catch{return n&&process.env.NODE_ENV!==`production`&&console.warn(n),e}}function Un(e,t){if(e=Pn(e),t=Mn(t),e.type.includes(`hsl`))e.values[2]*=1-t;else if(e.type.includes(`rgb`)||e.type.includes(`color`))for(let n=0;n<3;n+=1)e.values[n]*=1-t;return Ln(e)}function Wn(e,t,n){try{return Un(e,t)}catch{return n&&process.env.NODE_ENV!==`production`&&console.warn(n),e}}function Gn(e,t){if(e=Pn(e),t=Mn(t),e.type.includes(`hsl`))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes(`rgb`))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(e.type.includes(`color`))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return Ln(e)}function Kn(e,t,n){try{return Gn(e,t)}catch{return n&&process.env.NODE_ENV!==`production`&&console.warn(n),e}}function qn(e,t=.15){return zn(e)>.5?Un(e,t):Gn(e,t)}function Jn(e,t,n){try{return qn(e,t)}catch{return n&&process.env.NODE_ENV!==`production`&&console.warn(n),e}}var A=$t(),Yn=u.createContext(void 0);function Xn({value:e,children:t}){return(0,A.jsx)(Yn.Provider,{value:e,children:t})}process.env.NODE_ENV!==`production`&&(Xn.propTypes={children:k.default.node,value:k.default.object});function Zn(e){let{theme:t,name:n,props:r}=e;if(!t||!t.components||!t.components[n])return r;let i=t.components[n];return i.defaultProps?An(i.defaultProps,r,t.components.mergeClassNameAndStyle):!i.styleOverrides&&!i.variants?An(i,r,t.components.mergeClassNameAndStyle):r}function Qn({props:e,name:t}){return Zn({props:e,name:t,theme:{components:u.useContext(Yn)}})}var $n={theme:void 0};function er(e){let t,n;return function(r){let i=t;return(i===void 0||r.theme!==n)&&($n.theme=r.theme,i=_n(e($n)),t=i,n=r.theme),i}}function tr(e=``){function t(...n){if(!n.length)return``;let r=n[0];return typeof r==`string`&&!r.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${e?`${e}-`:``}${r}${t(...n.slice(1))})`:`, ${r}`}return(n,...r)=>`var(--${e?`${e}-`:``}${n}${t(...r)})`}var nr=(e,t,n,r=[])=>{let i=e;t.forEach((e,a)=>{a===t.length-1?Array.isArray(i)?i[Number(e)]=n:i&&typeof i==`object`&&(i[e]=n):i&&typeof i==`object`&&(i[e]||(i[e]=r.includes(e)?[]:{}),i=i[e])})},rr=(e,t,n)=>{function r(e,i=[],a=[]){Object.entries(e).forEach(([e,o])=>{(!n||n&&!n([...i,e]))&&o!=null&&(typeof o==`object`&&Object.keys(o).length>0?r(o,[...i,e],Array.isArray(o)?[...a,e]:a):t([...i,e],o,a))})}r(e)},ir=(e,t)=>typeof t==`number`?[`lineHeight`,`fontWeight`,`opacity`,`zIndex`].some(t=>e.includes(t))||e[e.length-1].toLowerCase().includes(`opacity`)?t:`${t}px`:t;function ar(e,t){let{prefix:n,shouldSkipGeneratingVar:r}=t||{},i={},a={},o={};return rr(e,(e,t,s)=>{if((typeof t==`string`||typeof t==`number`)&&(!r||!r(e,t))){let r=`--${n?`${n}-`:``}${e.join(`-`)}`,c=ir(e,t);Object.assign(i,{[r]:c}),nr(a,e,`var(${r})`,s),nr(o,e,`var(${r}, ${c})`,s)}},e=>e[0]===`vars`),{css:i,vars:a,varsWithDefaults:o}}function or(e,t={}){let{getSelector:n=_,disableCssColorScheme:r,colorSchemeSelector:i,enableContrastVars:a}=t,{colorSchemes:o={},components:s,defaultColorScheme:c=`light`,...l}=e,{vars:u,css:d,varsWithDefaults:f}=ar(l,t),p=f,m={},{[c]:h,...g}=o;if(Object.entries(g||{}).forEach(([e,n])=>{let{vars:r,css:i,varsWithDefaults:a}=ar(n,t);p=_e(p,a),m[e]={css:i,vars:r}}),h){let{css:e,vars:n,varsWithDefaults:r}=ar(h,t);p=_e(p,r),m[c]={css:e,vars:n}}function _(t,n){let r=i;if(i===`class`&&(r=`.%s`),i===`data`&&(r=`[data-%s]`),i?.startsWith(`data-`)&&!i.includes(`%s`)&&(r=`[${i}="%s"]`),t){if(r===`media`)return e.defaultColorScheme===t?`:root`:{[`@media (prefers-color-scheme: ${o[t]?.palette?.mode||t})`]:{":root":n}};if(r)return e.defaultColorScheme===t?`:root, ${r.replace(`%s`,String(t))}`:r.replace(`%s`,String(t))}return`:root`}return{vars:p,generateThemeVars:()=>{let e={...u};return Object.entries(m).forEach(([,{vars:t}])=>{e=_e(e,t)}),e},generateStyleSheets:()=>{let t=[],i=e.defaultColorScheme||`light`;function s(e,n){Object.keys(n).length&&t.push(typeof e==`string`?{[e]:{...n}}:e)}s(n(void 0,{...d}),d);let{[i]:c,...l}=m;if(c){let{css:e}=c,t=o[i]?.palette?.mode,a=!r&&t?{colorScheme:t,...e}:{...e};s(n(i,{...a}),a)}return Object.entries(l).forEach(([e,{css:t}])=>{let i=o[e]?.palette?.mode,a=!r&&i?{colorScheme:i,...t}:{...t};s(n(e,{...a}),a)}),a&&t.push({":root":{"--__l-threshold":`0.7`,"--__l":`clamp(0, (l / var(--__l-threshold) - 1) * -infinity, 1)`,"--__a":`clamp(0.87, (l / var(--__l-threshold) - 1) * -infinity, 1)`}}),t}}}function sr(e){return function(t){return e===`media`?(process.env.NODE_ENV!==`production`&&t!==`light`&&t!==`dark`&&console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${t}'.`),`@media (prefers-color-scheme: ${t})`):e?e.startsWith(`data-`)&&!e.includes(`%s`)?`[${e}="${t}"] &`:e===`class`?`.${t} &`:e===`data`?`[data-${t}] &`:`${e.replace(`%s`,t)} &`:`&`}}var cr={black:`#000`,white:`#fff`},lr={50:`#fafafa`,100:`#f5f5f5`,200:`#eeeeee`,300:`#e0e0e0`,400:`#bdbdbd`,500:`#9e9e9e`,600:`#757575`,700:`#616161`,800:`#424242`,900:`#212121`,A100:`#f5f5f5`,A200:`#eeeeee`,A400:`#bdbdbd`,A700:`#616161`},ur={50:`#f3e5f5`,100:`#e1bee7`,200:`#ce93d8`,300:`#ba68c8`,400:`#ab47bc`,500:`#9c27b0`,600:`#8e24aa`,700:`#7b1fa2`,800:`#6a1b9a`,900:`#4a148c`,A100:`#ea80fc`,A200:`#e040fb`,A400:`#d500f9`,A700:`#aa00ff`},dr={50:`#ffebee`,100:`#ffcdd2`,200:`#ef9a9a`,300:`#e57373`,400:`#ef5350`,500:`#f44336`,600:`#e53935`,700:`#d32f2f`,800:`#c62828`,900:`#b71c1c`,A100:`#ff8a80`,A200:`#ff5252`,A400:`#ff1744`,A700:`#d50000`},fr={50:`#fff3e0`,100:`#ffe0b2`,200:`#ffcc80`,300:`#ffb74d`,400:`#ffa726`,500:`#ff9800`,600:`#fb8c00`,700:`#f57c00`,800:`#ef6c00`,900:`#e65100`,A100:`#ffd180`,A200:`#ffab40`,A400:`#ff9100`,A700:`#ff6d00`},pr={50:`#e3f2fd`,100:`#bbdefb`,200:`#90caf9`,300:`#64b5f6`,400:`#42a5f5`,500:`#2196f3`,600:`#1e88e5`,700:`#1976d2`,800:`#1565c0`,900:`#0d47a1`,A100:`#82b1ff`,A200:`#448aff`,A400:`#2979ff`,A700:`#2962ff`},mr={50:`#e1f5fe`,100:`#b3e5fc`,200:`#81d4fa`,300:`#4fc3f7`,400:`#29b6f6`,500:`#03a9f4`,600:`#039be5`,700:`#0288d1`,800:`#0277bd`,900:`#01579b`,A100:`#80d8ff`,A200:`#40c4ff`,A400:`#00b0ff`,A700:`#0091ea`},hr={50:`#e8f5e9`,100:`#c8e6c9`,200:`#a5d6a7`,300:`#81c784`,400:`#66bb6a`,500:`#4caf50`,600:`#43a047`,700:`#388e3c`,800:`#2e7d32`,900:`#1b5e20`,A100:`#b9f6ca`,A200:`#69f0ae`,A400:`#00e676`,A700:`#00c853`};function gr(){return{text:{primary:`rgba(0, 0, 0, 0.87)`,secondary:`rgba(0, 0, 0, 0.6)`,disabled:`rgba(0, 0, 0, 0.38)`},divider:`rgba(0, 0, 0, 0.12)`,background:{paper:cr.white,default:cr.white},action:{active:`rgba(0, 0, 0, 0.54)`,hover:`rgba(0, 0, 0, 0.04)`,hoverOpacity:.04,selected:`rgba(0, 0, 0, 0.08)`,selectedOpacity:.08,disabled:`rgba(0, 0, 0, 0.26)`,disabledBackground:`rgba(0, 0, 0, 0.12)`,disabledOpacity:.38,focus:`rgba(0, 0, 0, 0.12)`,focusOpacity:.12,activatedOpacity:.12}}}var _r=gr();function vr(){return{text:{primary:cr.white,secondary:`rgba(255, 255, 255, 0.7)`,disabled:`rgba(255, 255, 255, 0.5)`,icon:`rgba(255, 255, 255, 0.5)`},divider:`rgba(255, 255, 255, 0.12)`,background:{paper:`#121212`,default:`#121212`},action:{active:cr.white,hover:`rgba(255, 255, 255, 0.08)`,hoverOpacity:.08,selected:`rgba(255, 255, 255, 0.16)`,selectedOpacity:.16,disabled:`rgba(255, 255, 255, 0.3)`,disabledBackground:`rgba(255, 255, 255, 0.12)`,disabledOpacity:.38,focus:`rgba(255, 255, 255, 0.12)`,focusOpacity:.12,activatedOpacity:.24}}}var yr=vr();function br(e,t,n,r){let i=r.light||r,a=r.dark||r*1.5;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:t===`light`?e.light=Gn(e.main,i):t===`dark`&&(e.dark=Un(e.main,a)))}function xr(e,t,n,r,i){let a=i.light||i,o=i.dark||i*1.5;t[n]||(t.hasOwnProperty(r)?t[n]=t[r]:n===`light`?t.light=`color-mix(in ${e}, ${t.main}, #fff ${(a*100).toFixed(0)}%)`:n===`dark`&&(t.dark=`color-mix(in ${e}, ${t.main}, #000 ${(o*100).toFixed(0)}%)`))}function Sr(e=`light`){return e===`dark`?{main:pr[200],light:pr[50],dark:pr[400]}:{main:pr[700],light:pr[400],dark:pr[800]}}function Cr(e=`light`){return e===`dark`?{main:ur[200],light:ur[50],dark:ur[400]}:{main:ur[500],light:ur[300],dark:ur[700]}}function wr(e=`light`){return e===`dark`?{main:dr[500],light:dr[300],dark:dr[700]}:{main:dr[700],light:dr[400],dark:dr[800]}}function Tr(e=`light`){return e===`dark`?{main:mr[400],light:mr[300],dark:mr[700]}:{main:mr[700],light:mr[500],dark:mr[900]}}function Er(e=`light`){return e===`dark`?{main:hr[400],light:hr[300],dark:hr[700]}:{main:hr[800],light:hr[500],dark:hr[900]}}function Dr(e=`light`){return e===`dark`?{main:fr[400],light:fr[300],dark:fr[700]}:{main:`#ed6c02`,light:fr[500],dark:fr[900]}}function Or(e){return`oklch(from ${e} var(--__l) 0 h / var(--__a))`}function kr(e){let{mode:t=`light`,contrastThreshold:n=3,tonalOffset:r=.2,colorSpace:i,...a}=e,o=e.primary||Sr(t),s=e.secondary||Cr(t),c=e.error||wr(t),l=e.info||Tr(t),u=e.success||Er(t),d=e.warning||Dr(t);function f(e){if(i)return Or(e);let t=Bn(e,yr.text.primary)>=n?yr.text.primary:_r.text.primary;if(process.env.NODE_ENV!==`production`){let n=Bn(e,t);n<3&&console.error([`MUI: The contrast ratio of ${n}:1 for ${t} on ${e}`,`falls below the WCAG recommended absolute minimum contrast ratio of 3:1.`,`https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast`].join(`
|
|
13
|
-
`))}return t}let p=({color:e,name:t,mainShade:n=500,lightShade:a=300,darkShade:o=700})=>{if(e={...e},!e.main&&e[n]&&(e.main=e[n]),!e.hasOwnProperty(`main`))throw Error(process.env.NODE_ENV===`production`?ee(11,t?` (${t})`:``,n):`MUI: The color${t?` (${t})`:``} provided to augmentColor(color) is invalid.\nThe color object needs to have a \`main\` property or a \`${n}\` property.`);if(typeof e.main!=`string`)throw Error(process.env.NODE_ENV===`production`?ee(12,t?` (${t})`:``,JSON.stringify(e.main)):`MUI: The color${t?` (${t})`:``} provided to augmentColor(color) is invalid.\n\`color.main\` should be a string, but \`${JSON.stringify(e.main)}\` was provided instead.\n
|
|
14
|
-
Did you intend to use one of the following approaches?
|
|
15
|
-
|
|
16
|
-
import { green } from "@mui/material/colors";
|
|
17
|
-
|
|
18
|
-
const theme1 = createTheme({ palette: {
|
|
19
|
-
primary: green,
|
|
20
|
-
} });
|
|
21
|
-
|
|
22
|
-
const theme2 = createTheme({ palette: {
|
|
23
|
-
primary: { main: green[500] },
|
|
24
|
-
} });`);return i?(xr(i,e,`light`,a,r),xr(i,e,`dark`,o,r)):(br(e,`light`,a,r),br(e,`dark`,o,r)),e.contrastText||=f(e.main),e},m;return t===`light`?m=gr():t===`dark`&&(m=vr()),process.env.NODE_ENV!==`production`&&(m||console.error(`MUI: The palette mode \`${t}\` is not supported.`)),_e({common:{...cr},mode:t,primary:p({color:o,name:`primary`}),secondary:p({color:s,name:`secondary`,mainShade:`A400`,lightShade:`A200`,darkShade:`A700`}),error:p({color:c,name:`error`}),warning:p({color:d,name:`warning`}),info:p({color:l,name:`info`}),success:p({color:u,name:`success`}),grey:lr,contrastThreshold:n,getContrastText:f,augmentColor:p,tonalOffset:r,...m},a)}function Ar(e){let t={};return Object.entries(e).forEach(e=>{let[n,r]=e;typeof r==`object`&&(t[n]=`${r.fontStyle?`${r.fontStyle} `:``}${r.fontVariant?`${r.fontVariant} `:``}${r.fontWeight?`${r.fontWeight} `:``}${r.fontStretch?`${r.fontStretch} `:``}${r.fontSize||``}${r.lineHeight?`/${r.lineHeight} `:``}${r.fontFamily||``}`)}),t}function jr(e,t){return{toolbar:{minHeight:56,[e.up(`xs`)]:{"@media (orientation: landscape)":{minHeight:48}},[e.up(`sm`)]:{minHeight:64}},...t}}function Mr(e){return Math.round(e*1e5)/1e5}var Nr={textTransform:`uppercase`},Pr=`"Roboto", "Helvetica", "Arial", sans-serif`;function Fr(e,t){let{fontFamily:n=Pr,fontSize:r=14,fontWeightLight:i=300,fontWeightRegular:a=400,fontWeightMedium:o=500,fontWeightBold:s=700,htmlFontSize:c=16,allVariants:l,pxToRem:u,...d}=typeof t==`function`?t(e):t;process.env.NODE_ENV!==`production`&&(typeof r!=`number`&&console.error("MUI: `fontSize` is required to be a number."),typeof c!=`number`&&console.error("MUI: `htmlFontSize` is required to be a number."));let f=r/14,p=u||(e=>`${e/c*f}rem`),m=(e,t,r,i,a)=>({fontFamily:n,fontWeight:e,fontSize:p(t),lineHeight:r,...n===Pr?{letterSpacing:`${Mr(i/t)}em`}:{},...a,...l});return _e({htmlFontSize:c,pxToRem:p,fontFamily:n,fontSize:r,fontWeightLight:i,fontWeightRegular:a,fontWeightMedium:o,fontWeightBold:s,h1:m(i,96,1.167,-1.5),h2:m(i,60,1.2,-.5),h3:m(a,48,1.167,0),h4:m(a,34,1.235,.25),h5:m(a,24,1.334,0),h6:m(o,20,1.6,.15),subtitle1:m(a,16,1.75,.15),subtitle2:m(o,14,1.57,.1),body1:m(a,16,1.5,.15),body2:m(a,14,1.43,.15),button:m(o,14,1.75,.4,Nr),caption:m(a,12,1.66,.4),overline:m(a,12,2.66,1,Nr),inherit:{fontFamily:`inherit`,fontWeight:`inherit`,fontSize:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},d,{clone:!1})}var Ir=.2,Lr=.14,Rr=.12;function zr(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Ir})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${Lr})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${Rr})`].join(`,`)}var Br=[`none`,zr(0,2,1,-1,0,1,1,0,0,1,3,0),zr(0,3,1,-2,0,2,2,0,0,1,5,0),zr(0,3,3,-2,0,3,4,0,0,1,8,0),zr(0,2,4,-1,0,4,5,0,0,1,10,0),zr(0,3,5,-1,0,5,8,0,0,1,14,0),zr(0,3,5,-1,0,6,10,0,0,1,18,0),zr(0,4,5,-2,0,7,10,1,0,2,16,1),zr(0,5,5,-3,0,8,10,1,0,3,14,2),zr(0,5,6,-3,0,9,12,1,0,3,16,2),zr(0,6,6,-3,0,10,14,1,0,4,18,3),zr(0,6,7,-4,0,11,15,1,0,4,20,3),zr(0,7,8,-4,0,12,17,2,0,5,22,4),zr(0,7,8,-4,0,13,19,2,0,5,24,4),zr(0,7,9,-4,0,14,21,2,0,5,26,4),zr(0,8,9,-5,0,15,22,2,0,6,28,5),zr(0,8,10,-5,0,16,24,2,0,6,30,5),zr(0,8,11,-5,0,17,26,2,0,6,32,5),zr(0,9,11,-5,0,18,28,2,0,7,34,6),zr(0,9,12,-6,0,19,29,2,0,7,36,6),zr(0,10,13,-6,0,20,31,3,0,8,38,7),zr(0,10,13,-6,0,21,33,3,0,8,40,7),zr(0,10,14,-6,0,22,35,3,0,8,42,7),zr(0,11,14,-7,0,23,36,3,0,9,44,8),zr(0,11,15,-7,0,24,38,3,0,9,46,8)],Vr={easeInOut:`cubic-bezier(0.4, 0, 0.2, 1)`,easeOut:`cubic-bezier(0.0, 0, 0.2, 1)`,easeIn:`cubic-bezier(0.4, 0, 1, 1)`,sharp:`cubic-bezier(0.4, 0, 0.6, 1)`},Hr={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function Ur(e){return`${Math.round(e)}ms`}function Wr(e){if(!e)return 0;let t=e/36;return Math.min(Math.round((4+15*t**.25+t/5)*10),3e3)}function Gr(e){let t={...Vr,...e.easing},n={...Hr,...e.duration};return{getAutoHeightDuration:Wr,create:(e=[`all`],r={})=>{let{duration:i=n.standard,easing:a=t.easeInOut,delay:o=0,...s}=r;if(process.env.NODE_ENV!==`production`){let t=e=>typeof e==`string`,n=e=>!Number.isNaN(parseFloat(e));!t(e)&&!Array.isArray(e)&&console.error(`MUI: Argument "props" must be a string or Array.`),!n(i)&&!t(i)&&console.error(`MUI: Argument "duration" must be a number or a string but found ${i}.`),t(a)||console.error(`MUI: Argument "easing" must be a string.`),!n(o)&&!t(o)&&console.error(`MUI: Argument "delay" must be a number or a string.`),typeof r!=`object`&&console.error([`MUI: Secong argument of transition.create must be an object.`,"Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join(`
|
|
25
|
-
`)),Object.keys(s).length!==0&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(s).join(`,`)}].`)}return(Array.isArray(e)?e:[e]).map(e=>`${e} ${typeof i==`string`?i:Ur(i)} ${a} ${typeof o==`string`?o:Ur(o)}`).join(`,`)},...e,easing:t,duration:n}}var Kr={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function qr(e){return he(e)||e===void 0||typeof e==`string`||typeof e==`boolean`||typeof e==`number`||Array.isArray(e)}function Jr(e={}){let t={...e};function n(e){let t=Object.entries(e);for(let r=0;r<t.length;r++){let[i,a]=t[r];!qr(a)||i.startsWith(`unstable_`)||i.startsWith(`internal_`)?delete e[i]:he(a)&&(e[i]={...a},n(e[i]))}}return n(t),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
|
|
26
|
-
|
|
27
|
-
const theme = ${JSON.stringify(t,null,2)};
|
|
28
|
-
|
|
29
|
-
theme.breakpoints = createBreakpoints(theme.breakpoints || {});
|
|
30
|
-
theme.transitions = createTransitions(theme.transitions || {});
|
|
31
|
-
|
|
32
|
-
export default theme;`}function Yr(e){return typeof e==`number`?`${(e*100).toFixed(0)}%`:`calc((${e}) * 100%)`}var Xr=e=>{if(!Number.isNaN(+e))return+e;let t=e.match(/\d*\.?\d+/g);if(!t)return 0;let n=0;for(let e=0;e<t.length;e+=1)n+=+t[e];return n};function Zr(e){Object.assign(e,{alpha(t,n){let r=this||e;return r.colorSpace?`oklch(from ${t} l c h / ${typeof n==`string`?`calc(${n})`:n})`:r.vars?`rgba(${t.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,`var(--$1Channel)`)} / ${typeof n==`string`?`calc(${n})`:n})`:Vn(t,Xr(n))},lighten(t,n){let r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #fff ${Yr(n)})`:Gn(t,n)},darken(t,n){let r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #000 ${Yr(n)})`:Un(t,n)}})}function Qr(e={},...t){let{breakpoints:n,mixins:r={},spacing:i,palette:a={},transitions:o={},typography:s={},shape:c,colorSpace:l,...u}=e;if(e.vars&&e.generateThemeVars===void 0)throw Error(process.env.NODE_ENV===`production`?ee(22):"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.");let d=kr({...a,colorSpace:l}),f=cn(e),p=_e(f,{mixins:jr(f.breakpoints,r),palette:d,shadows:Br.slice(),typography:Fr(d,s),transitions:Gr(o),zIndex:{...Kr}});if(p=_e(p,u),p=t.reduce((e,t)=>_e(e,t),p),process.env.NODE_ENV!==`production`){let e=[`active`,`checked`,`completed`,`disabled`,`error`,`expanded`,`focused`,`focusVisible`,`required`,`selected`],t=(t,n)=>{let r;for(r in t){let i=t[r];if(e.includes(r)&&Object.keys(i).length>0){if(process.env.NODE_ENV!==`production`){let e=fn(``,r);console.error([`MUI: The \`${n}\` component increases the CSS specificity of the \`${r}\` internal state.`,`You can not override it like this: `,JSON.stringify(t,null,2),``,`Instead, you need to use the '&.${e}' syntax:`,JSON.stringify({root:{[`&.${e}`]:i}},null,2),``,`https://mui.com/r/state-classes-guide`].join(`
|
|
33
|
-
`))}t[r]={}}}};Object.keys(p.components).forEach(e=>{let n=p.components[e].styleOverrides;n&&e.startsWith(`Mui`)&&t(n,e)})}return p.unstable_sxConfig={...kt,...u?.unstable_sxConfig},p.unstable_sx=function(e){return Mt({sx:e,theme:this})},p.toRuntimeSource=Jr,Zr(p),p}function $r(e){let t;return t=e<1?5.11916*e**2:4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}var ei=[...Array(25)].map((e,t)=>{if(t===0)return`none`;let n=$r(t);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function ti(e){return{inputPlaceholder:e===`dark`?.5:.42,inputUnderline:e===`dark`?.7:.42,switchTrackDisabled:e===`dark`?.2:.12,switchTrack:e===`dark`?.3:.38}}function ni(e){return e===`dark`?ei:[]}function ri(e){let{palette:t={mode:`light`},opacity:n,overlays:r,colorSpace:i,...a}=e,o=kr({...t,colorSpace:i});return{palette:o,opacity:{...ti(o.mode),...n},overlays:r||ni(o.mode),...a}}function ii(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]===`palette`&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}var ai=e=>[...[...Array(25)].map((t,n)=>`--${e?`${e}-`:``}overlays-${n}`),`--${e?`${e}-`:``}palette-AppBar-darkBg`,`--${e?`${e}-`:``}palette-AppBar-darkColor`],oi=e=>(t,n)=>{let r=e.rootSelector||`:root`,i=e.colorSchemeSelector,a=i;if(i===`class`&&(a=`.%s`),i===`data`&&(a=`[data-%s]`),i?.startsWith(`data-`)&&!i.includes(`%s`)&&(a=`[${i}="%s"]`),e.defaultColorScheme===t){if(t===`dark`){let i={};return ai(e.cssVarPrefix).forEach(e=>{i[e]=n[e],delete n[e]}),a===`media`?{[r]:n,"@media (prefers-color-scheme: dark)":{[r]:i}}:a?{[a.replace(`%s`,t)]:i,[`${r}, ${a.replace(`%s`,t)}`]:n}:{[r]:{...n,...i}}}if(a&&a!==`media`)return`${r}, ${a.replace(`%s`,String(t))}`}else if(t){if(a===`media`)return{[`@media (prefers-color-scheme: ${String(t)})`]:{[r]:n}};if(a)return a.replace(`%s`,String(t))}return r};function si(e,t){t.forEach(t=>{e[t]||(e[t]={})})}function j(e,t,n){!e[t]&&n&&(e[t]=n)}function ci(e){return typeof e!=`string`||!e.startsWith(`hsl`)?e:Rn(e)}function li(e,t){`${t}Channel`in e||(e[`${t}Channel`]=In(ci(e[t]),`MUI: Can't create \`palette.${t}Channel\` because \`palette.${t}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
|
|
34
|
-
To suppress this warning, you need to explicitly provide the \`palette.${t}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function ui(e){return typeof e==`number`?`${e}px`:typeof e==`string`||typeof e==`function`||Array.isArray(e)?e:`8px`}var di=e=>{try{return e()}catch{}},fi=(e=`mui`)=>tr(e);function pi(e,t,n,r,i){if(!n)return;n=n===!0?{}:n;let a=i===`dark`?`dark`:`light`;if(!r){t[i]=ri({...n,palette:{mode:a,...n?.palette},colorSpace:e});return}let{palette:o,...s}=Qr({...r,palette:{mode:a,...n?.palette},colorSpace:e});return t[i]={...n,palette:o,opacity:{...ti(a),...n?.opacity},overlays:n?.overlays||ni(a)},s}function mi(e={},...t){let{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:i=!1,cssVarPrefix:a=`mui`,nativeColor:o=!1,shouldSkipGeneratingVar:s=ii,colorSchemeSelector:c=n.light&&n.dark?`media`:void 0,rootSelector:l=`:root`,...u}=e,d=Object.keys(n)[0],f=r||(n.light&&d!==`light`?`light`:d),p=fi(a),{[f]:m,light:h,dark:g,..._}=n,v={..._},y=m;if((f===`dark`&&!(`dark`in n)||f===`light`&&!(`light`in n))&&(y=!0),!y)throw Error(process.env.NODE_ENV===`production`?ee(21,f):`MUI: The \`colorSchemes.${f}\` option is either missing or invalid.`);let b;o&&(b=`oklch`);let x=pi(b,v,y,u,f);h&&!v.light&&pi(b,v,h,void 0,`light`),g&&!v.dark&&pi(b,v,g,void 0,`dark`);let S={defaultColorScheme:f,...x,cssVarPrefix:a,colorSchemeSelector:c,rootSelector:l,getCssVar:p,colorSchemes:v,font:{...Ar(x.typography),...x.font},spacing:ui(u.spacing)};Object.keys(S.colorSchemes).forEach(e=>{let t=S.colorSchemes[e].palette,n=e=>{let n=e.split(`-`),r=n[1],i=n[2];return p(e,t[r][i])};t.mode===`light`&&(j(t.common,`background`,`#fff`),j(t.common,`onBackground`,`#000`)),t.mode===`dark`&&(j(t.common,`background`,`#000`),j(t.common,`onBackground`,`#fff`));function r(e,t,n){if(b){let r;return e===Hn&&(r=`transparent ${((1-n)*100).toFixed(0)}%`),e===Wn&&(r=`#000 ${(n*100).toFixed(0)}%`),e===Kn&&(r=`#fff ${(n*100).toFixed(0)}%`),`color-mix(in ${b}, ${t}, ${r})`}return e(t,n)}if(si(t,[`Alert`,`AppBar`,`Avatar`,`Button`,`Chip`,`FilledInput`,`LinearProgress`,`Skeleton`,`Slider`,`SnackbarContent`,`SpeedDialAction`,`StepConnector`,`StepContent`,`Switch`,`TableCell`,`Tooltip`]),t.mode===`light`){j(t.Alert,`errorColor`,r(Wn,o?p(`palette-error-light`):t.error.light,.6)),j(t.Alert,`infoColor`,r(Wn,o?p(`palette-info-light`):t.info.light,.6)),j(t.Alert,`successColor`,r(Wn,o?p(`palette-success-light`):t.success.light,.6)),j(t.Alert,`warningColor`,r(Wn,o?p(`palette-warning-light`):t.warning.light,.6)),j(t.Alert,`errorFilledBg`,n(`palette-error-main`)),j(t.Alert,`infoFilledBg`,n(`palette-info-main`)),j(t.Alert,`successFilledBg`,n(`palette-success-main`)),j(t.Alert,`warningFilledBg`,n(`palette-warning-main`)),j(t.Alert,`errorFilledColor`,di(()=>t.getContrastText(t.error.main))),j(t.Alert,`infoFilledColor`,di(()=>t.getContrastText(t.info.main))),j(t.Alert,`successFilledColor`,di(()=>t.getContrastText(t.success.main))),j(t.Alert,`warningFilledColor`,di(()=>t.getContrastText(t.warning.main))),j(t.Alert,`errorStandardBg`,r(Kn,o?p(`palette-error-light`):t.error.light,.9)),j(t.Alert,`infoStandardBg`,r(Kn,o?p(`palette-info-light`):t.info.light,.9)),j(t.Alert,`successStandardBg`,r(Kn,o?p(`palette-success-light`):t.success.light,.9)),j(t.Alert,`warningStandardBg`,r(Kn,o?p(`palette-warning-light`):t.warning.light,.9)),j(t.Alert,`errorIconColor`,n(`palette-error-main`)),j(t.Alert,`infoIconColor`,n(`palette-info-main`)),j(t.Alert,`successIconColor`,n(`palette-success-main`)),j(t.Alert,`warningIconColor`,n(`palette-warning-main`)),j(t.AppBar,`defaultBg`,n(`palette-grey-100`)),j(t.Avatar,`defaultBg`,n(`palette-grey-400`)),j(t.Button,`inheritContainedBg`,n(`palette-grey-300`)),j(t.Button,`inheritContainedHoverBg`,n(`palette-grey-A100`)),j(t.Chip,`defaultBorder`,n(`palette-grey-400`)),j(t.Chip,`defaultAvatarColor`,n(`palette-grey-700`)),j(t.Chip,`defaultIconColor`,n(`palette-grey-700`)),j(t.FilledInput,`bg`,`rgba(0, 0, 0, 0.06)`),j(t.FilledInput,`hoverBg`,`rgba(0, 0, 0, 0.09)`),j(t.FilledInput,`disabledBg`,`rgba(0, 0, 0, 0.12)`),j(t.LinearProgress,`primaryBg`,r(Kn,o?p(`palette-primary-main`):t.primary.main,.62)),j(t.LinearProgress,`secondaryBg`,r(Kn,o?p(`palette-secondary-main`):t.secondary.main,.62)),j(t.LinearProgress,`errorBg`,r(Kn,o?p(`palette-error-main`):t.error.main,.62)),j(t.LinearProgress,`infoBg`,r(Kn,o?p(`palette-info-main`):t.info.main,.62)),j(t.LinearProgress,`successBg`,r(Kn,o?p(`palette-success-main`):t.success.main,.62)),j(t.LinearProgress,`warningBg`,r(Kn,o?p(`palette-warning-light`):t.warning.main,.62)),j(t.Skeleton,`bg`,b?r(Hn,o?p(`palette-text-primary`):t.text.primary,.11):`rgba(${n(`palette-text-primaryChannel`)} / 0.11)`),j(t.Slider,`primaryTrack`,r(Kn,o?p(`palette-primary-main`):t.primary.main,.62)),j(t.Slider,`secondaryTrack`,r(Kn,o?p(`palette-secondary-main`):t.secondary.main,.62)),j(t.Slider,`errorTrack`,r(Kn,o?p(`palette-error-main`):t.error.main,.62)),j(t.Slider,`infoTrack`,r(Kn,o?p(`palette-info-main`):t.info.main,.62)),j(t.Slider,`successTrack`,r(Kn,o?p(`palette-success-main`):t.success.main,.62)),j(t.Slider,`warningTrack`,r(Kn,o?p(`palette-warning-main`):t.warning.main,.62));let e=b?r(Wn,o?p(`palette-background-default`):t.background.default,.6825):Jn(t.background.default,.8);j(t.SnackbarContent,`bg`,e),j(t.SnackbarContent,`color`,di(()=>b?yr.text.primary:t.getContrastText(e))),j(t.SpeedDialAction,`fabHoverBg`,Jn(t.background.paper,.15)),j(t.StepConnector,`border`,n(`palette-grey-400`)),j(t.StepContent,`border`,n(`palette-grey-400`)),j(t.Switch,`defaultColor`,n(`palette-common-white`)),j(t.Switch,`defaultDisabledColor`,n(`palette-grey-100`)),j(t.Switch,`primaryDisabledColor`,r(Kn,o?p(`palette-primary-main`):t.primary.main,.62)),j(t.Switch,`secondaryDisabledColor`,r(Kn,o?p(`palette-secondary-main`):t.secondary.main,.62)),j(t.Switch,`errorDisabledColor`,r(Kn,o?p(`palette-error-main`):t.error.main,.62)),j(t.Switch,`infoDisabledColor`,r(Kn,o?p(`palette-info-main`):t.info.main,.62)),j(t.Switch,`successDisabledColor`,r(Kn,o?p(`palette-success-main`):t.success.main,.62)),j(t.Switch,`warningDisabledColor`,r(Kn,o?p(`palette-warning-main`):t.warning.main,.62)),j(t.TableCell,`border`,r(Kn,Hn(o?p(`palette-divider`):t.divider,1),.88)),j(t.Tooltip,`bg`,r(Hn,o?p(`palette-grey-700`):t.grey[700],.92))}if(t.mode===`dark`){j(t.Alert,`errorColor`,r(Kn,o?p(`palette-error-light`):t.error.light,.6)),j(t.Alert,`infoColor`,r(Kn,o?p(`palette-info-light`):t.info.light,.6)),j(t.Alert,`successColor`,r(Kn,o?p(`palette-success-light`):t.success.light,.6)),j(t.Alert,`warningColor`,r(Kn,o?p(`palette-warning-light`):t.warning.light,.6)),j(t.Alert,`errorFilledBg`,n(`palette-error-dark`)),j(t.Alert,`infoFilledBg`,n(`palette-info-dark`)),j(t.Alert,`successFilledBg`,n(`palette-success-dark`)),j(t.Alert,`warningFilledBg`,n(`palette-warning-dark`)),j(t.Alert,`errorFilledColor`,di(()=>t.getContrastText(t.error.dark))),j(t.Alert,`infoFilledColor`,di(()=>t.getContrastText(t.info.dark))),j(t.Alert,`successFilledColor`,di(()=>t.getContrastText(t.success.dark))),j(t.Alert,`warningFilledColor`,di(()=>t.getContrastText(t.warning.dark))),j(t.Alert,`errorStandardBg`,r(Wn,o?p(`palette-error-light`):t.error.light,.9)),j(t.Alert,`infoStandardBg`,r(Wn,o?p(`palette-info-light`):t.info.light,.9)),j(t.Alert,`successStandardBg`,r(Wn,o?p(`palette-success-light`):t.success.light,.9)),j(t.Alert,`warningStandardBg`,r(Wn,o?p(`palette-warning-light`):t.warning.light,.9)),j(t.Alert,`errorIconColor`,n(`palette-error-main`)),j(t.Alert,`infoIconColor`,n(`palette-info-main`)),j(t.Alert,`successIconColor`,n(`palette-success-main`)),j(t.Alert,`warningIconColor`,n(`palette-warning-main`)),j(t.AppBar,`defaultBg`,n(`palette-grey-900`)),j(t.AppBar,`darkBg`,n(`palette-background-paper`)),j(t.AppBar,`darkColor`,n(`palette-text-primary`)),j(t.Avatar,`defaultBg`,n(`palette-grey-600`)),j(t.Button,`inheritContainedBg`,n(`palette-grey-800`)),j(t.Button,`inheritContainedHoverBg`,n(`palette-grey-700`)),j(t.Chip,`defaultBorder`,n(`palette-grey-700`)),j(t.Chip,`defaultAvatarColor`,n(`palette-grey-300`)),j(t.Chip,`defaultIconColor`,n(`palette-grey-300`)),j(t.FilledInput,`bg`,`rgba(255, 255, 255, 0.09)`),j(t.FilledInput,`hoverBg`,`rgba(255, 255, 255, 0.13)`),j(t.FilledInput,`disabledBg`,`rgba(255, 255, 255, 0.12)`),j(t.LinearProgress,`primaryBg`,r(Wn,o?p(`palette-primary-main`):t.primary.main,.5)),j(t.LinearProgress,`secondaryBg`,r(Wn,o?p(`palette-secondary-main`):t.secondary.main,.5)),j(t.LinearProgress,`errorBg`,r(Wn,o?p(`palette-error-main`):t.error.main,.5)),j(t.LinearProgress,`infoBg`,r(Wn,o?p(`palette-info-main`):t.info.main,.5)),j(t.LinearProgress,`successBg`,r(Wn,o?p(`palette-success-main`):t.success.main,.5)),j(t.LinearProgress,`warningBg`,r(Wn,o?p(`palette-warning-main`):t.warning.main,.5)),j(t.Skeleton,`bg`,b?r(Hn,o?p(`palette-text-primary`):t.text.primary,.13):`rgba(${n(`palette-text-primaryChannel`)} / 0.13)`),j(t.Slider,`primaryTrack`,r(Wn,o?p(`palette-primary-main`):t.primary.main,.5)),j(t.Slider,`secondaryTrack`,r(Wn,o?p(`palette-secondary-main`):t.secondary.main,.5)),j(t.Slider,`errorTrack`,r(Wn,o?p(`palette-error-main`):t.error.main,.5)),j(t.Slider,`infoTrack`,r(Wn,o?p(`palette-info-main`):t.info.main,.5)),j(t.Slider,`successTrack`,r(Wn,o?p(`palette-success-main`):t.success.main,.5)),j(t.Slider,`warningTrack`,r(Wn,o?p(`palette-warning-light`):t.warning.main,.5));let e=b?r(Kn,o?p(`palette-background-default`):t.background.default,.985):Jn(t.background.default,.98);j(t.SnackbarContent,`bg`,e),j(t.SnackbarContent,`color`,di(()=>b?_r.text.primary:t.getContrastText(e))),j(t.SpeedDialAction,`fabHoverBg`,Jn(t.background.paper,.15)),j(t.StepConnector,`border`,n(`palette-grey-600`)),j(t.StepContent,`border`,n(`palette-grey-600`)),j(t.Switch,`defaultColor`,n(`palette-grey-300`)),j(t.Switch,`defaultDisabledColor`,n(`palette-grey-600`)),j(t.Switch,`primaryDisabledColor`,r(Wn,o?p(`palette-primary-main`):t.primary.main,.55)),j(t.Switch,`secondaryDisabledColor`,r(Wn,o?p(`palette-secondary-main`):t.secondary.main,.55)),j(t.Switch,`errorDisabledColor`,r(Wn,o?p(`palette-error-main`):t.error.main,.55)),j(t.Switch,`infoDisabledColor`,r(Wn,o?p(`palette-info-main`):t.info.main,.55)),j(t.Switch,`successDisabledColor`,r(Wn,o?p(`palette-success-main`):t.success.main,.55)),j(t.Switch,`warningDisabledColor`,r(Wn,o?p(`palette-warning-light`):t.warning.main,.55)),j(t.TableCell,`border`,r(Wn,Hn(o?p(`palette-divider`):t.divider,1),.68)),j(t.Tooltip,`bg`,r(Hn,o?p(`palette-grey-700`):t.grey[700],.92))}o||(li(t.background,`default`),li(t.background,`paper`),li(t.common,`background`),li(t.common,`onBackground`),li(t,`divider`)),Object.keys(t).forEach(e=>{let n=t[e];e!==`tonalOffset`&&!o&&n&&typeof n==`object`&&(n.main&&j(t[e],`mainChannel`,In(ci(n.main))),n.light&&j(t[e],`lightChannel`,In(ci(n.light))),n.dark&&j(t[e],`darkChannel`,In(ci(n.dark))),n.contrastText&&j(t[e],`contrastTextChannel`,In(ci(n.contrastText))),e===`text`&&(li(t[e],`primary`),li(t[e],`secondary`)),e===`action`&&(n.active&&li(t[e],`active`),n.selected&&li(t[e],`selected`)))})}),S=t.reduce((e,t)=>_e(e,t),S);let C={prefix:a,disableCssColorScheme:i,shouldSkipGeneratingVar:s,getSelector:oi(S),enableContrastVars:o},{vars:w,generateThemeVars:T,generateStyleSheets:E}=or(S,C);return S.vars=w,Object.entries(S.colorSchemes[S.defaultColorScheme]).forEach(([e,t])=>{S[e]=t}),S.generateThemeVars=T,S.generateStyleSheets=E,S.generateSpacing=function(){return on(u.spacing,Ye(this))},S.getColorSchemeSelector=sr(c),S.spacing=S.generateSpacing(),S.shouldSkipGeneratingVar=s,S.unstable_sxConfig={...kt,...u?.unstable_sxConfig},S.unstable_sx=function(e){return Mt({sx:e,theme:this})},S.internal_cache={},S.toRuntimeSource=Jr,S}function hi(e,t,n){e.colorSchemes&&n&&(e.colorSchemes[t]={...n!==!0&&n,palette:kr({...n===!0?{}:n.palette,mode:t})})}function gi(e={},...t){let{palette:n,cssVariables:r=!1,colorSchemes:i=n?void 0:{light:!0},defaultColorScheme:a=n?.mode,...o}=e,s=a||`light`,c=i?.[s],l={...i,...n?{[s]:{...typeof c!=`boolean`&&c,palette:n}}:void 0};if(r===!1){if(!(`colorSchemes`in e))return Qr(e,...t);let r=n;`palette`in e||l[s]&&(l[s]===!0?s===`dark`&&(r={mode:`dark`}):r=l[s].palette);let i=Qr({...e,palette:r},...t);return i.defaultColorScheme=s,i.colorSchemes=l,i.palette.mode===`light`&&(i.colorSchemes.light={...l.light!==!0&&l.light,palette:i.palette},hi(i,`dark`,l.dark)),i.palette.mode===`dark`&&(i.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:i.palette},hi(i,`light`,l.light)),i}return!n&&!(`light`in l)&&s===`light`&&(l.light=!0),mi({...o,colorSchemes:l,defaultColorScheme:s,...typeof r!=`boolean`&&r},...t)}var _i=gi(),vi=`$$material`;function yi(e){return e!==`ownerState`&&e!==`theme`&&e!==`sx`&&e!==`as`}var bi=Tn({themeId:vi,defaultTheme:_i,rootShouldForwardProp:e=>yi(e)&&e!==`classes`}),xi=er;function Si(e){return(0,A.jsx)(Xn,{...e})}process.env.NODE_ENV!==`production`&&(Si.propTypes={children:k.default.node,value:k.default.object.isRequired});function Ci(e){return Qn(e)}function wi(e){return fn(`MuiSvgIcon`,e)}pn(`MuiSvgIcon`,[`root`,`colorPrimary`,`colorSecondary`,`colorAction`,`colorError`,`colorDisabled`,`fontSizeInherit`,`fontSizeSmall`,`fontSizeMedium`,`fontSizeLarge`]);var Ti=e=>{let{color:t,fontSize:n,classes:r}=e;return E({root:[`root`,t!==`inherit`&&`color${ne(t)}`,`fontSize${ne(n)}`]},wi,r)},Ei=bi(`svg`,{name:`MuiSvgIcon`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.color!==`inherit`&&t[`color${ne(n.color)}`],t[`fontSize${ne(n.fontSize)}`]]}})(xi(({theme:e})=>({userSelect:`none`,width:`1em`,height:`1em`,display:`inline-block`,flexShrink:0,transition:e.transitions?.create?.(`fill`,{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:e=>!e.hasSvgAsChild,style:{fill:`currentColor`}},{props:{fontSize:`inherit`},style:{fontSize:`inherit`}},{props:{fontSize:`small`},style:{fontSize:e.typography?.pxToRem?.(20)||`1.25rem`}},{props:{fontSize:`medium`},style:{fontSize:e.typography?.pxToRem?.(24)||`1.5rem`}},{props:{fontSize:`large`},style:{fontSize:e.typography?.pxToRem?.(35)||`2.1875rem`}},...Object.entries((e.vars??e).palette).filter(([,e])=>e&&e.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:`action`},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:`disabled`},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:`inherit`},style:{color:void 0}}]}))),Di=u.forwardRef(function(e,t){let n=Ci({props:e,name:`MuiSvgIcon`}),{children:r,className:i,color:a=`inherit`,component:o=`svg`,fontSize:s=`medium`,htmlColor:c,inheritViewBox:l=!1,titleAccess:d,viewBox:f=`0 0 24 24`,...p}=n,m=u.isValidElement(r)&&r.type===`svg`,h={...n,color:a,component:o,fontSize:s,instanceFontSize:e.fontSize,inheritViewBox:l,viewBox:f,hasSvgAsChild:m},g={};return l||(g.viewBox=f),(0,A.jsxs)(Ei,{as:o,className:T(Ti(h).root,i),focusable:`false`,color:c,"aria-hidden":d?void 0:!0,role:d?`img`:void 0,ref:t,...g,...p,...m&&r.props,ownerState:h,children:[m?r.props.children:r,d?(0,A.jsx)(`title`,{children:d}):null]})});process.env.NODE_ENV!==`production`&&(Di.propTypes={children:k.default.node,classes:k.default.object,className:k.default.string,color:k.default.oneOfType([k.default.oneOf([`inherit`,`action`,`disabled`,`primary`,`secondary`,`error`,`info`,`success`,`warning`]),k.default.string]),component:k.default.elementType,fontSize:k.default.oneOfType([k.default.oneOf([`inherit`,`large`,`medium`,`small`]),k.default.string]),htmlColor:k.default.string,inheritViewBox:k.default.bool,shapeRendering:k.default.string,sx:k.default.oneOfType([k.default.arrayOf(k.default.oneOfType([k.default.func,k.default.object,k.default.bool])),k.default.func,k.default.object]),titleAccess:k.default.string,viewBox:k.default.string}),Di.muiName=`SvgIcon`;function M(e,t){function n(n,r){return(0,A.jsx)(Di,{"data-testid":process.env.NODE_ENV===`production`?void 0:`${t}Icon`,ref:r,...n,children:e})}return process.env.NODE_ENV!==`production`&&(n.displayName=`${t}Icon`),n.muiName=Di.muiName,u.memo(u.forwardRef(n))}var Oi=M((0,A.jsx)(`path`,{d:`M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8`}),`InfoOutlined`),ki=M((0,A.jsx)(`path`,{d:`M12 5.99 19.53 19H4.47zM12 2 1 21h22zm1 14h-2v2h2zm0-6h-2v4h2z`}),`WarningAmberOutlined`),Ai=M((0,A.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z`}),`ErrorOutlined`),ji=M((0,A.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z`}),`CheckCircleOutlined`),Mi={confirmLabel:`Confirm`,cancelLabel:`Cancel`},Ni={info:Oi,warning:ki,error:Ai,success:ji},Pi={info:`primary`,warning:`warning`,error:`error`,success:`success`};function Fi({open:e,options:t,translation:n,onConfirm:r,onCancel:i}){let{title:a,description:o,confirmLabel:s,cancelLabel:c,severity:l=`info`,hideCancelButton:u=!1,maxWidth:f=`xs`,showIcon:p=!0}=t,m=p?Ni[l]:null,h=Pi[l],g=s??n.confirmLabel,_=c??n.cancelLabel;return(0,A.jsxs)(d.Dialog,{open:e,onClose:i,maxWidth:f,fullWidth:!0,"aria-labelledby":a?`confirm-dialog-title`:void 0,"aria-describedby":o?`confirm-dialog-description`:void 0,children:[a&&(0,A.jsxs)(d.DialogTitle,{id:`confirm-dialog-title`,"data-testid":`confirm-dialog-title`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[m&&(0,A.jsx)(m,{color:l,"data-testid":`confirm-dialog-icon`,fontSize:`small`}),a]}),o&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(d.Divider,{}),(0,A.jsx)(d.DialogContent,{children:typeof o==`string`?(0,A.jsx)(d.Typography,{id:`confirm-dialog-description`,"data-testid":`confirm-dialog-description`,variant:`body2`,color:`text.secondary`,children:o}):(0,A.jsx)(`div`,{id:`confirm-dialog-description`,"data-testid":`confirm-dialog-description`,children:o})})]}),(0,A.jsx)(d.Divider,{}),(0,A.jsxs)(d.DialogActions,{sx:{px:2,py:1.5},children:[!u&&(0,A.jsx)(d.Button,{"data-testid":`confirm-dialog-cancel-btn`,onClick:i,color:`inherit`,children:_}),(0,A.jsx)(d.Button,{"data-testid":`confirm-dialog-confirm-btn`,onClick:r,color:h,variant:`contained`,autoFocus:!0,children:g})]})]})}var Ii=(0,u.createContext)(()=>Promise.resolve(!1));function Li({children:e,translation:t}){let n={...Mi,...t},r=(0,u.useRef)(null),[i,a]=(0,u.useState)({open:!1,options:{}}),o=(0,u.useCallback)(e=>(r.current?.(!1),new Promise(t=>{r.current=t,a({open:!0,options:e})})),[]);return(0,A.jsxs)(Ii.Provider,{value:o,children:[e,(0,A.jsx)(Fi,{open:i.open,options:i.options,translation:n,onConfirm:()=>{r.current?.(!0),r.current=null,a(e=>({...e,open:!1}))},onCancel:()=>{r.current?.(!1),r.current=null,a(e=>({...e,open:!1}))}})]})}function Ri(){return(0,u.useContext)(Ii)}var zi={showFormat:!0,showCompact:!0,showCopy:!0,showClear:!0,showUndoRedo:!0},Bi={format:`Format JSON`,compact:`Compact JSON`,copy:`Copy`,copySuccess:`Copied!`,clear:`Clear`,undo:`Undo`,redo:`Redo`,lineColumn:`Ln {line}, Col {col}`,validJson:`Valid JSON`,invalidJson:`Invalid JSON`},Vi=[],Hi=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?Hi:Vi).push(n+=e[t])})();function Ui(e){if(e<768)return!1;for(let t=0,n=Vi.length;;){let r=t+n>>1;if(e<Vi[r])n=r;else if(e>=Hi[r])t=r+1;else return!0;if(t==n)return!1}}function Wi(e){return e>=127462&&e<=127487}var Gi=8205;function Ki(e,t,n=!0,r=!0){return(n?qi:Ji)(e,t,r)}function qi(e,t,n){if(t==e.length)return t;t&&Xi(e.charCodeAt(t))&&Zi(e.charCodeAt(t-1))&&t--;let r=Yi(e,t);for(t+=Qi(r);t<e.length;){let i=Yi(e,t);if(r==Gi||i==Gi||n&&Ui(i))t+=Qi(i),r=i;else if(Wi(i)){let n=0,r=t-2;for(;r>=0&&Wi(Yi(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function Ji(e,t,n){for(;t>0;){let r=qi(e,t-2,n);if(r<t)return r;t--}return 0}function Yi(e,t){let n=e.charCodeAt(t);if(!Zi(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Xi(r)?(n-55296<<10)+(r-56320)+65536:n}function Xi(e){return e>=56320&&e<57344}function Zi(e){return e>=55296&&e<56320}function Qi(e){return e<65536?1:2}var $i=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]=la(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),ta.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]=la(this,e,t);let n=[];return this.decompose(e,t,n,0),ta.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 aa(this),i=new aa(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 aa(this,e)}iterRange(e,t=this.length){return new oa(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 sa(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 ea(t):ta.from(ea.split(t,[]))}},ea=class e extends $i{constructor(e,t=na(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 ca(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(ia(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=ra(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]=la(this,t,n);let i=ra(this.text,ra(r.text,ia(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):ta.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
|
35
|
-
`){[e,t]=la(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}},ta=class e extends $i{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]=la(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=`
|
|
36
|
-
`){[e,t]=la(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 ea(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 ea&&c&&(n=u[u.length-1])instanceof ea&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new ea(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)}};$i.empty=new ea([``],0);function na(e){let t=-1;for(let n of e)t+=n.length+1;return t}function ra(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 ia(e,t,n){return ra(e,[``],t,n)}var aa=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 ea?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 ea?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=`
|
|
37
|
-
`,this;e--}else if(r instanceof ea){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 ea?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)}},oa=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new aa(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!=``}},sa=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`&&($i.prototype[Symbol.iterator]=function(){return this.iter()},aa.prototype[Symbol.iterator]=oa.prototype[Symbol.iterator]=sa.prototype[Symbol.iterator]=function(){return this});var ca=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 la(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function ua(e,t,n=!0,r=!0){return Ki(e,t,n,r)}function da(e){return e>=56320&&e<57344}function fa(e){return e>=55296&&e<56320}function pa(e,t){let n=e.charCodeAt(t);if(!fa(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return da(r)?(n-55296<<10)+(r-56320)+65536:n}function ma(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function ha(e){return e<65536?1:2}var ga=/\r\n?|\n/,_a=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(_a||={}),va=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){Sa(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:wa(this,e)}mapDesc(e,t=!1){return e.empty?this:Ca(this,e,t)}mapPos(e,t=-1,n=_a.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!=_a.Simple&&c>=e&&(n==_a.TrackDel&&r<e&&c>e||n==_a.TrackBefore&&r<e||n==_a.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)}},ya=class e extends va{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 Sa(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return Ca(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($i.empty);r.push(a?t.slice(i,i+a):$i.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:wa(this,e,!0)}map(e,t=!1){return e.empty?this:Ca(this,e,t,!0)}iterChanges(e,t=!1){Sa(this,e,t)}get desc(){return va.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new Ta(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);ba(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;ba(n,e,t),t>0&&xa(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);ba(n,e,-1),ba(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:va.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&&ba(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`?$i.of(l.split(r||ga)):l:$i.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&ba(i,e-o,-1),ba(i,s-e,d),xa(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($i.empty);r[e]=$i.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 ba(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 xa(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($i.empty);e.push(n)}}function Sa(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=$i.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 Ca(e,t,n,r=!1){let i=[],a=r?[]:null,o=new Ta(e),s=new Ta(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);ba(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(ba(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(ba(i,0,o.ins),a&&xa(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;ba(i,t,e<o.i?o.ins:0),a&&e<o.i&&xa(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?ya.createSet(i,a):va.create(i);else throw Error(`Mismatched change set lengths`)}function wa(e,t,n=!1){let r=[],i=n?[]:null,a=new Ta(e),o=new Ta(t);for(let e=!1;;)if(a.done&&o.done)return i?ya.createSet(r,i):va.create(r);else if(a.ins==0)ba(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)ba(r,0,o.ins,e),i&&xa(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;ba(r,t,n,e),i&&n&&xa(i,r,o.text)}else o.ins==-1?(ba(r,a.off?0:a.len,t,e),i&&xa(i,r,a.textBit(t))):(ba(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&xa(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 Ta=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?$i.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?$i.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)}},Ea=class e{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return N.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return N.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 N.range(e.anchor,e.head)}static create(t,n,r){return new e(t,n,r)}},N=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=>Ea.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 Ea.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(r??16777215)<<6)}static range(e,t,n,r,i){let a=(n??16777215)<<6|(r==null?7:Math.min(6,r));return!i&&e!=t&&(i=t<e?1:-1),t<e?Ea.create(t,e,48|a):Ea.create(e,t,(i?i<0?8:16:0)|a)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function Da(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var Oa=0,P=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=Oa++,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:ka),!!t.static,t.enables)}of(e){return new Aa([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Aa(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Aa(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function ka(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var Aa=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=Oa++}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)||Ma(e,c)){let r=t(e);if(a?!ja(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=Ga(o,c);if(this.dependencies.every(t=>t instanceof P?o.facet(t)===e.facet(t):t instanceof Fa?o.field(t,!1)==e.field(t,!1):!0)||(a?ja(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}};function ja(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 Ma(e,t){let n=!1;for(let r of t)Wa(e,r)&1&&(n=!0);return n}function Na(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=Ga(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)Wa(e,t);return e.values[o]=s(e),1},update(e,n){if(!Ma(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=Ma(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&ka(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 Pa=P.define({static:!0}),Fa=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(Oa++,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(Pa).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(Pa),i=n.facet(Pa),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,Pa.of({field:this,create:e})]}get extension(){return this}},Ia={lowest:4,low:3,default:2,high:1,highest:0};function La(e){return t=>new za(t,e)}var Ra={highest:La(Ia.highest),high:La(Ia.high),default:La(Ia.default),low:La(Ia.low),lowest:La(Ia.lowest)},za=class{constructor(e,t){this.inner=e,this.prec=t}},Ba=class e{of(e){return new Va(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Va=class{constructor(e,t){this.compartment=e,this.inner=t}},Ha=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 Ua(t,n,o))e instanceof Fa?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,ka(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=>Na(e,n,t))}}return new e(t,o,l.map(e=>e(s)),s,c,a)}};function Ua(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 Va&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Va){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 za)a(e.inner,e.prec);else if(e instanceof Fa)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof Aa)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,Ia.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,Ia.default),r.reduce((e,t)=>e.concat(t))}function Wa(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 Ga(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Ka=P.define(),qa=P.define({combine:e=>e.some(e=>e),static:!0}),Ja=P.define({combine:e=>e.length?e[0]:void 0,static:!0}),Ya=P.define(),Xa=P.define(),Za=P.define(),Qa=P.define({combine:e=>e.length?e[0]:!1}),$a=class{constructor(e,t){this.type=e,this.value=t}static define(){return new eo}},eo=class{of(e){return new $a(this,e)}},to=class{constructor(e){this.map=e}of(e){return new no(this,e)}},no=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 to(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}};no.reconfigure=no.define(),no.appendConfig=no.define();var ro=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&&Da(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]==`.`))}};ro.time=$a.define(),ro.userEvent=$a.define(),ro.addToHistory=$a.define(),ro.remote=$a.define();function io(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 ao(e,t,n){let r,i,a;return n?(r=t.changes,i=ya.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:no.mapEffects(e.effects,r).concat(no.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function oo(e,t,n){let r=t.selection,i=fo(t.annotations);return t.userEvent&&(i=i.concat(ro.userEvent.of(t.userEvent))),{changes:t.changes instanceof ya?t.changes:ya.of(t.changes||[],n,e.facet(Ja)),selection:r&&(r instanceof N?r:N.single(r.anchor,r.head)),effects:fo(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function so(e,t,n){let r=oo(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=ao(r,oo(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=ro.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return lo(n?co(i):i)}function co(e){let t=e.startState,n=!0;for(let r of t.facet(Ya)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:io(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=ya.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=ro.create(t,r,e.selection&&e.selection.map(i),no.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Xa);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof ro?i:Array.isArray(i)&&i.length==1&&i[0]instanceof ro?i[0]:so(t,fo(i),!1)}return e}function lo(e){let t=e.startState,n=t.facet(Za),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=ao(r,oo(t,a,e.changes.newLength),!0))}return r==e?e:ro.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var uo=[];function fo(e){return e==null?uo:Array.isArray(e)?e:[e]}var po=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(po||={}),mo=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,ho;try{ho=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function go(e){if(ho)return ho.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||mo.test(n)))return!0}return!1}function _o(e){return t=>{if(!/\S/.test(t))return po.Space;if(go(t))return po.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return po.Word;return po.Other}}var vo=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++)Wa(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`);return}return Wa(this,n),Ga(this,n)}update(...e){return so(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(Ba.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(no.reconfigure)?(n=null,r=e.value):e.is(no.appendConfig)&&(n=null,r=fo(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Ha.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(qa)?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:N.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=fo(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=no.mapEffects(a,c).concat(no.mapEffects(fo(o.effects),l))}return{changes:r,selection:N.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof ya?t:ya.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return $i.of(t.split(this.facet(e.lineSeparator)||ga))}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:(Wa(this,t),Ga(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 Fa&&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:N.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Ha.resolve(t.extensions||[],new Map),r=t.doc instanceof $i?t.doc:$i.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||ga)),i=t.selection?t.selection instanceof N?t.selection:N.single(t.selection.anchor,t.selection.head):N.single(0);return Da(i,r.length),n.staticFacet(qa)||(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)||`
|
|
38
|
-
`}get readOnly(){return this.facet(Qa)}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(Ka))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 _o(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=ua(t,a,!1);if(i(t.slice(e,a))!=po.Word)break;a=e}for(;o<r;){let e=ua(t,o);if(i(t.slice(o,e))!=po.Word)break;o=e}return a==o?null:N.range(a+n,o+n)}};vo.allowMultipleSelections=qa,vo.tabSize=P.define({combine:e=>e.length?e[0]:4}),vo.lineSeparator=Ja,vo.readOnly=Qa,vo.phrases=P.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])}}),vo.languageData=Ka,vo.changeFilter=Ya,vo.transactionFilter=Xa,vo.transactionExtender=Za,Ba.reconfigure=no.define();function yo(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 bo=class{eq(e){return this==e}range(e,t=e){return So.create(e,t,this)}};bo.prototype.startSide=bo.prototype.endSide=0,bo.prototype.point=!1,bo.prototype.mapMode=_a.TrackDel;function xo(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var So=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 Co(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var wo=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let a=r,o=i.length;;){if(a==o)return a;let r=a+o>>1,s=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==a)return s>=0?a:o;s>=0?o=r:a=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),a=this.findIndex(n,1e9,!1,i);i<a;i++)if(r(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(t,n){let r=[],i=[],a=[],o=-1,s=-1;for(let e=0;e<this.value.length;e++){let c=this.value[e],l=this.from[e]+t,u=this.to[e]+t,d,f;if(l==u){let e=n.mapPos(l,c.startSide,c.mapMode);if(e==null||(d=f=e,c.startSide!=c.endSide&&(f=n.mapPos(l,c.endSide),f<d)))continue}else if(d=n.mapPos(l,c.startSide),f=n.mapPos(u,c.endSide),d>f||d==f&&c.startSide>0&&c.endSide<=0)continue;(f-d||c.endSide-c.startSide)<0||(o<0&&(o=d),c.point&&(s=Math.max(s,f-d)),r.push(c),i.push(d-o),a.push(f-o))}return{mapped:r.length?new e(i,a,r,s):null,pos:o}}},To=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(Co)),this.isEmpty)return n.length?e.of(n):this;let s=new ko(this,null,-1).goto(0),c=0,l=[],u=new Do;for(;s.value||c<n.length;)if(c<n.length&&(s.from-n[c].from||s.startSide-n[c].value.startSide)>=0){let e=n[c++];u.addInner(e.from,e.to,e.value)||l.push(e)}else s.rangeIndex==1&&s.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(s.chunkIndex)<n[c].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||a<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||i>s.to||a<s.from||o(s.from,s.to,s.value))&&(u.addInner(s.from,s.to,s.value)||l.push(So.create(s.from,s.to,s.value))),s.next());return u.finishInner(this.nextLayer.isEmpty&&!l.length?e.empty:this.nextLayer.update({add:l,filter:o,filterFrom:i,filterTo:a}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],i=-1;for(let e=0;e<this.chunk.length;e++){let a=this.chunkPos[e],o=this.chunk[e],s=t.touchesRange(a,a+o.length);if(s===!1)i=Math.max(i,o.maxPoint),n.push(o),r.push(t.mapPos(a));else if(s===!0){let{mapped:e,pos:s}=o.map(a,t);e&&(i=Math.max(i,e.maxPoint),n.push(e),r.push(s))}}let a=this.nextLayer.map(t);return n.length==0?a:new e(r,n,a||e.empty,i)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],a=this.chunk[r];if(t>=i&&e<=i+a.length&&a.between(i,e-i,t-i,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Ao.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ao.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=Oo(a,o,n),c=new Mo(a,s,i),l=new Mo(o,s,i);n.iterGaps((e,t,n)=>No(c,e,l,t,n,r)),n.empty&&n.length==0&&No(c,0,l,0,0,r)}static eq(e,t,n=0,r){r??=999999999;let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),a=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=Oo(i,a),s=new Mo(i,o,0).goto(n),c=new Mo(a,o,0).goto(n);for(;;){if(s.to!=c.to||!Po(s.active,c.active)||s.point&&(!c.point||!xo(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 Mo(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 Do;for(let r of e instanceof So?[e]:t?Eo(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=e.empty;i=i.nextLayer)n=new e(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}};To.empty=new To([],[],null,-1);function Eo(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(Co(t,r)>0)return e.slice().sort(Co);t=r}return e}To.empty.nextLayer=To.empty;var Do=class e{finishChunk(e){this.chunks.push(new wo(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,r){this.addInner(t,n,r)||(this.nextLayer||=new e).add(t,n,r)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(To.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=To.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function Oo(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 ko=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}},Ao=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 ko(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--)jo(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--)jo(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(),jo(this.heap,0)}}};function jo(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 Mo=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=Ao.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){Fo(this.active,e),Fo(this.activeTo,e),Fo(this.activeRank,e),this.minActive=Lo(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++;Io(this.active,t,n),Io(this.activeTo,t,r),Io(this.activeRank,t,i),e&&Io(e,t,this.cursor.from),this.minActive=Lo(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&&Fo(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 No(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&&xo(e.point,n.point)&&Po(e.activeForPoint(e.to),n.activeForPoint(n.to))||a.comparePoint(s,d,e.point,n.point),t=!1):(t&&a.boundChange(s),d>s&&!Po(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 Po(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!xo(e[n],t[n]))return!1;return!0}function Fo(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function Io(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function Lo(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 Ro(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=ua(e,i));return r}function zo(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=ua(e,r)}return r===!0?-1:e.length}for(var Bo=`ͼ`,Vo=typeof Symbol>`u`?`__`+Bo:Symbol.for(Bo),Ho=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),Uo=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},Wo=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(`
|
|
39
|
-
`)}static newName(){let e=Uo[Vo]||1;return Uo[Vo]=e+1,Bo+e.toString(36)}static mount(e,t,n){let r=e[Ho],i=n&&n.nonce;r?i&&r.setNonce(i):r=new Ko(e,i),r.mount(Array.isArray(t)?t:[t],e)}},Go=new Map,Ko=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=Go.get(n);if(t)return e[Ho]=t;this.sheet=new r.CSSStyleSheet,Go.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[Ho]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t<e.length;t++){let a=e[t],o=this.modules.indexOf(a);if(o<i&&o>-1&&(this.modules.splice(o,1),i--,o=-1),o==-1){if(this.modules.splice(i++,0,a),n)for(let e=0;e<a.rules.length;e++)n.insertRule(a.rules[e],r++)}else{for(;i<o;)r+=this.modules[i++].rules.length;r+=a.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e=``;for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+`
|
|
40
|
-
`;this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute(`nonce`)!=e&&this.styleTag.setAttribute(`nonce`,e)}},qo={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:`'`},Jo={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},Yo=typeof navigator<`u`&&/Mac/.test(navigator.platform),Xo=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Zo=0;Zo<10;Zo++)qo[48+Zo]=qo[96+Zo]=String(Zo);for(var Zo=1;Zo<=24;Zo++)qo[Zo+111]=`F`+Zo;for(var Zo=65;Zo<=90;Zo++)qo[Zo]=String.fromCharCode(Zo+32),Jo[Zo]=String.fromCharCode(Zo);for(var Qo in qo)Jo.hasOwnProperty(Qo)||(Jo[Qo]=qo[Qo]);function $o(e){var t=!(Yo&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Xo&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?Jo:qo)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}function es(){var e=arguments[0];typeof e==`string`&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n==`object`&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i==`string`?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t<arguments.length;t++)ts(e,arguments[t]);return e}function ts(e,t){if(typeof t==`string`)e.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)ts(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}var ns=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},rs=typeof document<`u`?document:{documentElement:{style:{}}},is=/Edge\/(\d+)/.exec(ns.userAgent),as=/MSIE \d/.test(ns.userAgent),ss=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ns.userAgent),cs=!!(as||ss||is),ls=!cs&&/gecko\/(\d+)/i.test(ns.userAgent),us=!cs&&/Chrome\/(\d+)/.exec(ns.userAgent),ds=`webkitFontSmoothing`in rs.documentElement.style,fs=!cs&&/Apple Computer/.test(ns.vendor),ps=fs&&(/Mobile\/\w+/.test(ns.userAgent)||ns.maxTouchPoints>2),F={mac:ps||/Mac/.test(ns.platform),windows:/Win/.test(ns.platform),linux:/Linux|X11/.test(ns.platform),ie:cs,ie_version:as?rs.documentMode||6:ss?+ss[1]:is?+is[1]:0,gecko:ls,gecko_version:ls?+(/Firefox\/(\d+)/.exec(ns.userAgent)||[0,0])[1]:0,chrome:!!us,chrome_version:us?+us[1]:0,ios:ps,android:/Android\b/.test(ns.userAgent),webkit:ds,webkit_version:ds?+(/\bAppleWebKit\/(\d+)/.exec(ns.userAgent)||[0,0])[1]:0,safari:fs,safari_version:fs?+(/\bVersion\/(\d+(\.\d+)?)/.exec(ns.userAgent)||[0,0])[1]:0,tabSize:rs.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function ms(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 hs=Object.create(null);function gs(e,t,n){if(e==t)return!0;e||=hs,t||=hs;let r=Object.keys(e),i=Object.keys(t);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function _s(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 vs(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 ys(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 bs=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){}},xs=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(xs||={}),Ss=class extends bo{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 Cs(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 Ts(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}=Es(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new Ts(e,n,r,t,e.widget||null,!0)}static line(e){return new ws(e)}static set(e,t=!1){return To.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};Ss.none=To.empty;var Cs=class e extends Ss{constructor(e){let{start:t,end:n}=Es(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?ms(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||hs}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&gs(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};Cs.prototype.point=!1;var ws=class e extends Ss{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&gs(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)}};ws.prototype.mapMode=_a.TrackBefore,ws.prototype.point=!0;var Ts=class e extends Ss{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?_a.TrackBefore:_a.TrackAfter:_a.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?xs.WidgetBefore:xs.WidgetAfter:xs.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&Ds(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)}};Ts.prototype.point=!0;function Es(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function Ds(e,t){return e==t||!!(e&&t&&e.compare(t))}function Os(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 ks=class e extends bo{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&&gs(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||hs,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return To.of(e,t)}};ks.prototype.startSide=ks.prototype.endSide=-1;function As(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function js(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function Ms(e,t){if(!t.anchorNode)return!1;try{return js(e,t.anchorNode)}catch{return!1}}function Ns(e){return e.nodeType==3?Js(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function Ps(e,t,n,r){return n?Ls(e,t,n,r,-1)||Ls(e,t,n,r,1):!1}function Fs(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function Is(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function Ls(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Rs(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||n.nodeType!=1)return!1;t=Fs(e)+(i<0?0:1),e=n}else if(e.nodeType==1){if(e=e.childNodes[t+(i<0?-1:0)],e.nodeType==1&&e.contentEditable==`false`)return!1;t=i<0?Rs(e):0}else return!1}}function Rs(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function zs(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Bs(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 Vs(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 Hs(e,t,n,r,i,a,o,s){let c=e.ownerDocument,l=c.defaultView||window;for(let u=e,d=!1;u&&!d;)if(u.nodeType==1){let e,f=u==c.body,p=1,m=1;if(f)e=Bs(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}=Vs(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 Us(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(a.nodeType==1)!i&&a.scrollHeight>a.clientHeight&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var Ws=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?Rs(t):0),n,Math.min(e.focusOffset,n?Rs(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}},Gs=null;F.safari&&F.safari_version>=26&&(Gs=!1);function Ks(e){if(e.setActive)return e.setActive();if(Gs)return e.focus(Gs);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Gs==null?{get preventScroll(){return Gs={preventScroll:!0},!0}}:void 0),!Gs){Gs=!1;for(let e=0;e<t.length;){let n=t[e++],r=t[e++],i=t[e++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=i&&(n.scrollLeft=i)}}}var qs;function Js(e,t,n=t){let r=qs||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function Ys(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 Xs(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function Zs(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,Rs(n));;)if(r){if(n.nodeType!=1)return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=Rs(n))}else if(n==e)return!0;else r=Fs(n),n=n.parentNode}function Qs(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 $s(e,t){for(let n=e,r=t;;)if(n.nodeType==3&&r>0)return{node:n,offset:r};else if(n.nodeType==1&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=Rs(n)}else if(n.parentNode&&!Is(n))r=Fs(n),n=n.parentNode;else return null}function ec(e,t){for(let n=e,r=t;;)if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};else if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!Is(n))r=Fs(n)+1,n=n.parentNode;else return null}var tc=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,Fs(t),n)}static after(t,n){return new e(t.parentNode,Fs(t)+1,n)}},nc=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(nc||={}),rc=nc.LTR,ic=nc.RTL;function ac(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var oc=ac(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),sc=ac(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),cc=Object.create(null),lc=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);cc[t]=n,cc[n]=-t}function uc(e){return e<=247?oc[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?sc[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var dc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,fc=class{get dir(){return this.level%2?ic:rc}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 pc(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||!pc(r.inner,i.inner))return!1}return!0}var mc=[];function hc(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=uc(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),mc[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=mc[e];if(i==128)e<s-1&&t==mc[e+1]&&t&24?i=mc[e]=t:mc[e]=256;else if(i==64){let i=e+1;for(;i<s&&mc[i]==64;)i++;let a=e&&t==8||i<n&&mc[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)mc[t]=a;e=i-1}else i==8&&r==1&&(mc[e]=1);t=i,i&7&&(r=i)}}}function gc(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=cc[n=e.charCodeAt(t)])if(r<0){for(let e=s-3;e>=0;e-=3)if(lc[e+1]==-r){let n=lc[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(mc[t]=mc[lc[e]]=r),s=e;break}}else if(lc.length==189)break;else lc[s++]=t,lc[s++]=n,lc[s++]=c;else if((o=mc[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=lc[t+2];if(n&2)break;if(e)lc[t+2]|=2;else{if(n&4)break;lc[t+2]|=4}}}}}function _c(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=mc[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(mc[o]==256)o++;else break;let l=a==1,u=l==((o<t?mc[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),mc[--t]=u;c=o}else a=o,c++}}}function vc(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=mc[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(mc[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new fc(c,m.from,f)),yc(e,m.direction==rc==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?mc[p]!=s:mc[p]==s))break;else p++;d?vc(e,c,p,r+1,i,d,o):c<p&&o.push(new fc(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=mc[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(mc[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new fc(m.to,c,f)),yc(e,m.direction==rc==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?mc[p-1]!=s:mc[p-1]==s))break;else p--;d?vc(e,p,c,r+1,i,d,o):p<c&&o.push(new fc(p,c,f)),c=p}}function yc(e,t,n,r,i,a,o){let s=t%2?2:1;hc(e,i,a,r,s),gc(e,i,a,r,s),_c(i,a,r,s),vc(e,i,a,t,n,r,o)}function bc(e,t,n){if(!e)return[new fc(0,0,+(t==ic))];if(t==rc&&!n.length&&!dc.test(e))return xc(e.length);if(n.length)for(;e.length>mc.length;)mc[mc.length]=256;let r=[],i=t==rc?0:1;return yc(e,i,i,n,0,e.length,r),r}function xc(e){return[new fc(0,e,0)]}var Sc=``;function Cc(e,t,n,r,i){let a=r.head-e.from,o=fc.find(t,a,r.bidiLevel??-1,r.assoc),s=t[o],c=s.side(i,n);if(a==c){let e=o+=i?1:-1;if(e<0||e>=t.length)return null;s=t[o=e],a=s.side(!i,n),c=s.side(i,n)}let l=ua(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),Sc=e.text.slice(Math.min(a,l),Math.max(a,l));let u=o==(i?t.length-1:0)?null:t[o+(i?1:-1)];return u&&l==c&&u.level+ +!i<s.level?N.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level):N.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function wc(e,t,n){for(let r=t;r<n;r++){let t=uc(e.charCodeAt(r));if(t==1)return rc;if(t==2||t==4)return ic}return rc}var Tc=P.define(),Ec=P.define(),Dc=P.define(),Oc=P.define(),kc=P.define(),Ac=P.define(),jc=P.define(),Mc=P.define(),Nc=P.define(),Pc=P.define({combine:e=>e.some(e=>e)}),Fc=P.define({combine:e=>e.some(e=>e)}),Ic=P.define(),Lc=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(N.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Rc=no.define({map:(e,t)=>e.map(t)}),zc=no.define();function Bc(e,t,n){let r=e.facet(Oc);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 Vc=P.define({combine:e=>e.length?e[0]:!0}),Hc=0,Uc=P.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})}}),Wc=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(Uc.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Uc.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(Hc++,t,r,i,e=>{let t=[];return o&&t.push(Jc.of(t=>{let n=t.plugin(e);return n?o(n):Ss.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},Gc=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){Bc(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(Bc(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){Bc(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},Kc=P.define(),qc=P.define(),Jc=P.define(),Yc=P.define(),Xc=P.define(),Zc=P.define(),Qc=P.define();function $c(e,t){let n=e.state.facet(Qc);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return To.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??=wc(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 el=P.define();function tl(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(el)){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 nl=P.define(),rl=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}},il=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=ya.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 rl(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}},al=[],ol=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 al}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&&_s(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:``)+(this.breakAfter?`#`:``)}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError(`Invalid child in posBefore`)}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=Fs(this.dom),r=this.length?e>0:t>0;return new tc(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 ll)return e;return null}static get(e){return e.cmTile}},sl=class extends ol{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=cl(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=cl(r);this.length=a}};function cl(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var ll=class extends sl{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=ol.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 ul)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}}},ul=class e extends sl{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}},dl=class e extends sl{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,n,r){let i=new e(n||document.createElement(`div`),t);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n){let r=null,i=-1,a=null,o=-1;function s(e,c){for(let l=0,u=0;l<e.children.length&&u<=c;l++){let d=e.children[l],f=u+d.length;f>=c&&(d.isComposite()?s(d,c-u):(!a||a.isHidden&&(t>0||n&&pl(a,d)))&&(f>c||d.flags&32)?(a=d,o=c-u):(u<c||d.flags&16&&!d.isHidden)&&(r=d,i=c-u)),u=f}}s(this,e);let c=(t<0?r:a)||r||a;return c?{tile:c,offset:c==r?i:o}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):fl(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 tc(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 tc(e.dom,0);e==n.tile&&(a=!0)}}return new tc(this.dom,0)}};function fl(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Ns(t);return n[n.length-1]||null}function pl(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var ml=class e extends sl{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}},hl=class e extends ol{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let r=e,i=e,a=0;e==0&&t<0||e==n&&t>=0?F.chrome||F.gecko||(e?(r--,a=1):i<n&&(i++,a=-1)):t<0?r--:i<n&&i++;let o=Js(this.dom,r,i).getClientRects();if(!o.length)return null;let s=o[(a?a<0:t>=0)?0:o.length-1];return F.safari&&!a&&s.width==0&&(s=Array.prototype.find.call(o,e=>e.width)||s),a?zs(s,a<0):s||null}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},gl=class e extends ol{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 zs(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 zs(n,!r)}}get overrideDOMText(){if(!this.length)return $i.empty;let{root:e}=this;if(!e)return $i.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)}},_l=class extends ol{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 $i.empty}coordsIn(e){return this.dom.getBoundingClientRect()}},vl=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:a,parents:o}=this;for(;e||t>0;)if(!r.isComposite())if(i==r.length)a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++;else if(e){let t=Math.min(e,r.length-i);n&&n.skip(r,i,i+t),e-=t,i+=t}else break;else if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(i==r.children.length){if(!e&&!o.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++}else{let s=r.children[i],c=s.breakAfter;(t>0?s.length<=e:s.length<e)&&(!n||n.skip(s,0,s.length)!==!1||!s.isComposite)?(a=!!c,i++,e-=s.length):(o.push({tile:r,index:i}),r=s,i=0,n&&s.isComposite()&&n.enter(s))}return this.tile=r,this.index=i,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},yl=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},bl=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 hl(a.dom,a.text+e);t.parent=i}else i.append(r||hl.of(e,this.cache.find(hl)?.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)?Al(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 ml&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(Al(n.dom)),r=i;else{if(this.cache.reused.get(n)){let e=ol.get(n.dom);e&&e.setDOM(Al(n.dom))}let e=ml.of(n.mark,n.dom);r.append(e),r=e}this.cache.reused.set(n,2)}let i=ol.get(e.text);i&&this.cache.reused.set(i,2);let a=new hl(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||=Dl;let n=dl.start(e,t||this.cache.find(dl)?.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 ml&&a.mark.eq(i))n=a,t--;else{let e=ml.of(i,this.cache.find(ml,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||!Tl(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(F.ios&&Tl(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Ml,0,32)||new gl(Ml.toDOM(),0,Ml,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 yl(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 ul&&n.wrapper.eq(t.wrapper))e=n;else{let n=ul.of(t.wrapper,this.cache.find(ul,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(_l,void 0,1);return n&&(n.flags=t),n||new _l(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},xl=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}},Sl=[gl,dl,hl,ml,_l,ul,ll];for(let e=0;e<Sl.length;e++)Sl[e].bucket=e;var Cl=class{constructor(e){this.view=e,this.buckets=Sl.map(()=>[]),this.index=Sl.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],a=this.index[r];for(let e=i.length-1;e>=0;e--){let o=(e+a)%i.length,s=i[o];if((!t||t(s))&&!this.reused.has(s))return i.splice(o,1),o<a&&this.index[r]--,this.reused.set(s,n),s}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,a=0;;i++){if(i==r.length){if(a)return null;a=1,i=0}let o=r[i];if(!this.reused.has(o)&&(a==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(o.flags&497)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new gl(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}},wl=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 Cl(e),this.text=new xl(e.state.doc),this.builder=new bl(this.cache,new ll(e,e.contentDOM),To.iter(n)),this.cache.reused.set(t,2),this.old=new vl(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,a=0;;){let o=a<e.length?e[a++]:null,s=o?o.fromA:this.old.root.length;if(s>r){let e=s-r;this.preserve(e,!a,!o),r=s,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,r=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=kl(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?gl.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 _l)this.cache.add(e);else if(e instanceof ml)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 ml&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof ml&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=0,a=To.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof Ts){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?jl.block:jl.inline),c=El(a),l=this.cache.findWidget(i,t-e,c)||gl.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=Ol(n,a);t>e&&this.text.skip(t-e)},span:(e,t,i,a)=>{for(let o=e;o<t;){let s=this.text.next(Math.min(512,t-o));s==null?(r.addLineStartIfNotCovered(n),r.addBreak(),o++):(r.ensureLine(n),r.addText(s,i,o==e?a:i.length),o+=s.length),n=null}}});r.addLineStartIfNotCovered(n),this.openWidget=a>i,this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=ol.get(r);if(r==this.view.contentDOM)break;e instanceof ml?t.push(e):e?.isLine()?n=e:e instanceof ul||(r.nodeName==`DIV`&&!n&&r!=this.view.contentDOM?n=new dl(r,Dl):n||t.push(ml.of(new Cs({tagName:r.nodeName.toLowerCase(),attributes:ys(r)}),r)))}return{line:n,marks:t}}};function Tl(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 El(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 Dl={class:`cm-line`};function Ol(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r?e:(e||={class:`cm-line`},n&&ms(n,e),r&&(e.class+=` `+r),e)}function kl(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 ml&&t.push(r.mark)}return t}function Al(e){let t=ol.get(e);return t&&t.setDOM(e.cloneNode()),e}var jl=class extends bs{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}};jl.inline=new jl(`span`),jl.block=new jl(`div`);var Ml=new class extends bs{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},Nl=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Ss.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 ll(e,e.contentDOM),this.updateInner([new rl(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:!Wl(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?Ll(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new rl(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,(F.ie||F.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=Bl(i,this.decorations,e.changes);o.length&&(t=rl.extendWithRanges(t,o));let s=Hl(a,this.blockWrappers,e.changes);return s.length&&(t=rl.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 wl(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&ol.get(t.text)&&r.cache.reused.set(ol.get(t.text),2),this.tile=r.run(e,t),Pl(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=F.chrome||F.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 Gl&&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(zc)&&(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(Vc)||n.tabIndex>-1)&&Ms(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)),F.gecko&&s.empty&&!this.hasComposition&&Fl(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new tc(e,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!Ps(c.node,c.offset,u.anchorNode,u.anchorOffset)||!Ps(l.node,l.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,s))&&(this.view.observer.ignore(()=>{F.android&&F.chrome&&n.contains(u.focusNode)&&Ul(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=As(this.view.root);if(e)if(s.empty){if(F.gecko){let e=Rl(c.node,c.offset);if(e&&e!=3){let t=(e==1?$s:ec)(c.node,c.offset);t&&(c=new tc(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 tc(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new tc(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ps(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=As(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=Rs(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&&!ol.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,a,o=-1,s=!1;return this.tile.blockTiles((t,c)=>{if(t.isWidget()){if(t.flags&32&&c>=e)return!0;t.flags&16&&(i=!0)}else{let l=c+t.length;if(c<=e&&(n=t,r=e-c,i=l<e),l>=e&&!a&&(a=t,o=e-c,s=c>e),c>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(i&&a?n=null:s&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(o,t))}coordsAt(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof Gl?null:n.coordsInWidget(r,t,!0):n.coordsIn(r,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(e,t){if(e.isComposite())for(let n of e.children){if(n.length>=t){let e=r(n,t);if(e)return e}if(t-=n.length,t<0)break}else if(e.isText()&&t<e.length){let n=ua(e.text,t);if(n==t)return null;let r=Js(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==nc.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 ul)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?Ns(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`?nc.RTL:nc.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=Ns(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=Ns(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(Ss.replace({widget:new Gl(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return Ss.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Jc).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(Xc).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(To.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(Yc).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(Ic))try{if(t(this.view,e.range,e))return!0}catch(e){Bc(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc??(t.empty?0:t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=tl(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(Hs(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==nc.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(t.head,1);e&&e.dom.scrollIntoView({block:`nearest`})}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Pl(this.tile)}};function Pl(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)Pl(n,t)}}function Fl(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable==`false`)&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable==`false`)}function Il(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=$s(n.focusNode,n.focusOffset),i=ec(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=ol.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=ol.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 Ll(e,t,n){let r=Il(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 rl(c.mapPos(a),c.mapPos(o),a,o),text:i}}function Rl(e,t){return e.nodeType==1?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var zl=class{constructor(){this.changes=[]}compareRange(e,t){Os(e,t,this.changes)}comparePoint(e,t){Os(e,t,this.changes)}boundChange(e){Os(e,e,this.changes)}};function Bl(e,t,n){let r=new zl;return To.compare(e,t,n,r),r.changes}var Vl=class{constructor(){this.changes=[]}compareRange(e,t){Os(e,t,this.changes)}comparePoint(){}boundChange(e){Os(e,e,this.changes)}};function Hl(e,t,n){let r=new Vl;return To.compare(e,t,n,r),r.changes}function Ul(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable==`false`)return!0;return!1}function Wl(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var Gl=class extends bs{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 Kl(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return N.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=ua(i.text,a,!1):s=ua(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=ua(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=ua(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return N.range(o+i.from,s+i.from)}function ql(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+zo(o,a,e.state.tabSize)}function Jl(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==xs.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function Yl(e,t,n,r){let i=Jl(e,t.head,t.assoc||-1),a=!r||i.type!=xs.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==nc.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o!=null)return N.cursor(o,n?-1:1)}return N.cursor(n?i.to:i.from,n?-1:1)}function Xl(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=Cc(i,a,o,s,n),l=Sc;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`
|
|
41
|
-
`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function Zl(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==po.Space&&(i=t),i==t}}function Ql(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return N.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=ru(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return N.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 N.cursor(i.pos,i.assoc,void 0,o)}}function $l(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 eu(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=$l(e,i.from,0);t!=i.from&&(a=N.cursor(t,-1))}else{let t=$l(e,i.from,-1),n=$l(e,i.to,1);(t!=i.from||n!=i.to)&&(a=N.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?N.create(n,t.mainIndex):t}function tu(e,t,n){let r=$l(e.state.facet(Zc).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:N.cursor(r,r<n.from?1:-1)}var nu=class{constructor(e,t){this.pos=e,this.assoc=t}};function ru(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 nu(0,1);if(c>e.viewState.docHeight)return new nu(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==xs.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==xs.Text){let t=ql(e,i,l,o,s);return new nu(t,t==l.from?1:-1)}}if(l.type!=xs.Text)return c<(l.top+l.bottom)/2?new nu(l.from,1):new nu(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 iu(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var iu=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[fc.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[fc.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,i=e.length-1,a=new Set,o=this.bidiIn(e[0],e[i]),s,c,l=-1,u=1e9,d;search:for(;r<i;){let n=i-r,f=r+i>>1;adjust:if(a.has(f)){let e=r+Math.floor(Math.random()*n);for(let t=0;t<n;t++){if(!a.has(e)){f=e;break adjust}e++,e==i&&(e=r)}break search}a.add(f);let p=t(f);if(p)for(let t=0;t<p.length;t++){let n=p[t],a=0;if(!(n.width==0&&p.length>1)){if(n.bottom<this.y)(!s||s.bottom<n.bottom)&&(s=n),a=1;else if(n.top>this.y)(!c||c.top>n.top)&&(c=n),a=-1;else{let e=n.left>this.x?this.x-n.left:n.right<this.x?this.x-n.right:0,t=Math.abs(e);t<u&&(l=f,u=t,d=n),e&&(a=e<0==(this.baseDir==nc.LTR)?-1:1)}a==-1&&(!o||this.baseDirAt(e[f],1))?i=f:a==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}}}if(!d){let n=s&&(!c||this.y-s.bottom<c.top-this.y)?s:c;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:n,bottom:r}=d;if(s&&s.bottom>(n+n+r)/3)return this.y=s.bottom-1,this.scan(e,t,!0);if(c&&c.top<(n+r+r)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(o?this.dirAt(e[l],1):this.baseDir)==nc.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=ua(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 Js(e.dom,i,a).getClientRects()});return r.after?new nu(n[r.i+1],-1):new nu(n[r.i],1)}scanTile(e,t){if(!e.length)return new nu(t,1);if(e.children.length==1){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r<e.children.length;r++)n.push(i+=e.children[r].length);let r=this.scan(n,t=>{let n=e.children[t];return n.flags&48?null:(n.dom.nodeType==1?n.dom:Js(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 nu(n[r.i+1],-1):new nu(a,1)}},au=``,ou=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(vo.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=au}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=ol.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=ol.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:Is(r))||Is(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!cu(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=ol.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(su(e,n.node,n.offset)?t:0))}};function su(e,t,n){for(;;){if(!t||n<Rs(t))return!1;if(t==e)return!0;n=Fs(t)+1,t=t.parentNode}}function cu(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let t=ol.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 lu=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},uu=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=du(e.docView.tile,t,n,0))){let t=i||a?[]:gu(e),n=new ou(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=_u(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!js(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!js(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((F.ios||F.chrome)&&o.main.empty&&n!=r&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),a=s.from-t,o=s.to-i;(a==0||a==1||t==0)&&(o==0||o==-1||i==e.state.doc.length)&&(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(N.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=N.create([N.cursor(n,r)])}else this.newSel=N.single(r,n)}}};function du(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 du(r,t,n,l);if(d>=t&&i==-1&&(i=c,a=l),l>n&&r.dom.parentNode==e.dom){o=c,s=u;break}u=d,l=d+r.breakAfter}return{from:a,to:s<0?r+e.length:s,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else if(e.isText())return{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling};else return null}function fu(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||F.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,au),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:$i.of(t.text.slice(a.from-e,u).split(au))}:(d=hu(l,t.text,s-e,c))&&(F.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==au+au&&d.toB--,n={from:e+d.from,to:e+d.toA,insert:$i.of(t.text.slice(d.from,d.toB).split(au))})}else r&&(!e.hasFocus&&i.facet(Vc)||vu(r,a))&&(r=null);if(!n&&!r)return!1;if((F.mac||F.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=N.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:$i.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)}:F.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
|
|
42
|
-
`&&e.lineWrapping&&(r&&=N.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:$i.of([` `])}),n)return pu(e,n,r,o);if(r&&!vu(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=eu(i.facet(Zc).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}else return!1}function pu(e,t,n,r=-1){if(F.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(F.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&&Ys(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)&&Ys(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&Ys(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=mu(e,t,n);return e.state.facet(Ac).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function mu(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=$l(i.facet(Zc).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:N.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&&Il(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?N.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 hu(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 gu(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 lu(n,r)),(i!=n||a!=r)&&t.push(new lu(i,a))),t}function _u(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n>-1&&r>-1?N.single(n+t,r+t):null}function vu(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var yu=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText=``,this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,F.safari&&e.contentDOM.addEventListener(`input`,()=>null),F.gecko&&td(e.contentDOM.ownerDocument)}handleEvent(e){!Mu(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=xu(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&&wu.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),F.android&&F.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return F.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((t=Su.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||Cu.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key==`Enter`&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Ys(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:F.safari&&!F.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 bu(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){Bc(n.state,e)}}}function xu(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(bu(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(bu(t.value,r))}}for(let e in Nu)n(e).handlers.push(Nu[e]);for(let e in Pu)n(e).observers.push(Pu[e]);return t}var Su=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],Cu=`dthko`,wu=[16,17,18,20,91,92,224,225],Tu=6;function Eu(e){return Math.max(0,e)*.7+8}function Du(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var Ou=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=Us(e.contentDOM),this.atoms=e.state.facet(Zc).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(vo.allowMultipleSelections)&&ku(e,t),this.dragging=ju(e,t)&&Wu(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&&Du(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=tl(this.view);e.clientX-s.left<=r+Tu?t=-Eu(r-e.clientX):e.clientX+s.right>=a-Tu&&(t=Eu(e.clientX-a)),e.clientY-s.top<=i+Tu?n=-Eu(i-e.clientY):e.clientY+s.bottom>=o-Tu&&(n=Eu(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=eu(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 ku(e,t){let n=e.state.facet(Tc);return n.length?n[0](t):F.mac?t.metaKey:t.ctrlKey}function Au(e,t){let n=e.state.facet(Ec);return n.length?n[0](t):F.mac?!t.altKey:!t.ctrlKey}function ju(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=As(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 Mu(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=ol.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var Nu=Object.create(null),Pu=Object.create(null),Fu=F.ie&&F.ie_version<15||F.ios&&F.webkit_version<604;function Iu(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(),Ru(e,n.value)},50)}function Lu(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Ru(e,t){t=Lu(e.state,Mc,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(Xu!=null&&n.selection.ranges.every(e=>e.empty)&&Xu==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:N.cursor(r.from+c.length)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:N.cursor(e.from+t.length)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}Pu.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Pu.wheel=Pu.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},Nu.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),Pu.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},Pu.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},Nu.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(Dc))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Gu(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new Ou(e,t,n,r)),r&&e.observer.ignore(()=>{Ks(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 zu(e,t,n,r){if(r==1)return N.cursor(t,n);if(r==2)return Kl(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++,N.range(a,o)}}var Bu=F.ie&&F.ie_version<=11,Vu=null,Hu=0,Uu=0;function Wu(e){if(!Bu)return e.detail;let t=Vu,n=Uu;return Vu=e,Uu=Date.now(),Hu=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Hu+1)%3:1}function Gu(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Wu(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=zu(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=zu(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?N.range(i,a,l.assoc):N.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=Ku(i,s.pos))?c:o?i.addRange(l):N.create([l])}}}function Ku(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 N.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}Nu.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=N.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,Lu(e.state,Nc,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},Nu.dragend=e=>(e.inputState.draggedContent=null,!1);function qu(e,t,n,r){if(n=Lu(e.state,Mc,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&Au(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}Nu.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&&qu(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=a,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}else{let n=t.dataTransfer.getData(`Text`);if(n)return qu(e,t,n,!0),!0}return!1},Nu.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Fu?null:t.clipboardData;return n?(Ru(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(Iu(e),!1)};function Ju(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 Yu(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:Lu(e,Nc,t.join(e.lineBreak)),ranges:n,linewise:r}}var Xu=null;Nu.copy=Nu.cut=(e,t)=>{if(!Ms(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=Yu(e.state);if(!n&&!i)return!1;Xu=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=Fu?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(Ju(e,n),!1)};var Zu=$a.define();function Qu(e,t){let n=[];for(let r of e.facet(jc)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Zu.of(!0)}):null}function $u(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Qu(e.state,t);n?e.dispatch(n):e.update([])}},10)}Pu.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),$u(e)},Pu.blur=e=>{e.observer.clearSelectionRange(),$u(e)},Pu.compositionstart=Pu.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},Pu.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,F.chrome&&F.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},Pu.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Nu.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 pu(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(F.chrome&&F.android&&(n=Su.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 F.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),F.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>Pu.compositionend(e,t),20),!1};var ed=new Set;function td(e){ed.has(e)||(ed.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var nd=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],rd=!1;function id(){rd=!1}var ad=class{constructor(e){this.lineWrapping=e,this.doc=$i.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 nd.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=nd.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}},od=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},sd=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`?xs.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 Ts?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)}},cd=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(cd||={}),ld=.001,ud=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)>ld&&(rd=!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,cd.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,cd.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,cd.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=yd.build(n.setDoc(a),e,l,u);i=dd(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new md(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,i=0,a=0;for(;;)if(n==r)if(i>a*2){let e=t[n-1];e.break?t.splice(--n,1,e.left,null,e.right):t.splice(--n,1,e.left,e.right),r+=1+e.break,i-=e.size}else if(a>i*2){let e=t[r];e.break?t.splice(r,1,e.left,null,e.right):t.splice(r,1,e.left,e.right),r+=2+e.break,a-=e.size}else break;else if(i<a){let e=t[n++];e&&(i+=e.size)}else{let e=t[--r];e&&(a+=e.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]??(o=1,r++),new gd(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function dd(e,t){return e==t?e:(e.constructor!=t.constructor&&(rd=!0),t)}ud.prototype.size=1;var fd=Ss.replace({}),pd=class extends ud{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new sd(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 sd(r,0,n,this.spaceAbove,fd):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,cd.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})`}},md=class e extends pd{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 sd(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 hd&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof hd?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):ud.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:``})`}},hd=class e extends ud{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 sd(a.from,a.length,l,c,0)}else{let r=Math.max(0,Math.min(a-i,Math.floor((e-n)/o))),{from:s,length:c}=t.doc.line(i+r);return new sd(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==cd.ByHeight)return this.blockAt(e,n,r,i);if(t==cd.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new sd(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 sd(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 sd(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 ud.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)>=ld&&(s=-2);let c=new md(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=ud.of(r);return(s<0||Math.abs(c.height-this.height)>=ld||Math.abs(s-this.heightMetrics(t,n).perLine)>=ld)&&(rd=!0),dd(this,c)}else (r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},gd=class extends ud{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==cd.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==cd.ByPosNoHeight?cd.ByPosNoHeight:cd.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,cd.ByPos,n,r,i);e<c.from&&this.left.forEachLine(e,c.from-1,n,r,i,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let e of n)i.push(e);if(e>0&&_d(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),_d(i,e)}return ud.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?ud.of(this.break?[e,null,t]:[e,t]):(this.left=dd(this.left,e),this.right=dd(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 _d(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof hd&&(r=e[t+1])instanceof hd&&e.splice(t-1,3,new hd(n.length+1+r.length))}var vd=5,yd=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 md?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new md(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 pd(a,r,n)):(a||i||r>=vd)&&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 md(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new hd(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 md)return e;let t=new md(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 md)&&!this.isCovered?this.nodes.push(new md(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 md&&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 To.spans(n,r,i,a,0),a.finish(r)}};function bd(e,t,n){let r=new xd;return To.compare(e,t,n,r,0),r.changes}var xd=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&Os(e,t,this.changes,5)}};function Sd(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,a=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),s=Math.max(0,n.top),c=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(t.nodeType==1){let n=t,r=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&r.overflow!=`visible`){let r=n.getBoundingClientRect();a=Math.max(a,r.left),o=Math.min(o,r.right),s=Math.max(s,r.top),c=Math.min(t==e.parentNode?i.innerHeight:c,r.bottom)}t=r.position==`absolute`||r.position==`fixed`?n.offsetParent:n.parentNode}else if(t.nodeType==11)t=t.host;else break;return{left:a-n.left,right:Math.max(a,o)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function Cd(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 wd(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var Td=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 Ss.replace({widget:new Ed(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},Ed=class extends bs{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}},Dd=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=Nd,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=nc.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(qc).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new ad(n),this.stateDeco=Pd(t),this.heightMap=ud.empty().applyChanges(this.stateDeco,$i.empty,this.heightOracle.setDoc(t.doc),[new rl(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=Ss.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 Od(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?Nd:new Fd(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(Id(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Pd(this.state);let r=e.changedRanges,i=rl.extendWithRanges(r,bd(n,this.stateDeco,e?e.changes:ya.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);id(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||rd)&&(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(Fc)&&(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`?nc.RTL:nc.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}=Vs(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=Us(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=Qs(this.scrollParent||e.win);let m=(this.printing?wd:Sd)(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&&!Cd(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)),id();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?ud.empty().applyChanges(this.stateDeco,$i.empty,this.heightOracle,[new rl(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new od(n.from,i))}rd&&(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 Od(r.lineAt(a-n*1e3,cd.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,cd.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,cd.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 Od(r.lineAt(o-1e3/2,cd.ByHeight,i,0,0).from,r.lineAt(o+n+1e3/2,cd.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 Od(this.heightMap.lineAt(n,cd.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,cd.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,cd.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,cd.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=o+Math.max(10,Math.min(n,250)))&&r>a-2*1e3&&i<o+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new Td(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!=nc.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=Md(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(N.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new Td(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=xs.Text)return;let i=kd(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=jd(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=Ad(i,n),l=Ad(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=jd(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=Ad(i,f),l=Ad(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=jd(r,n)-jd(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){Td.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ss.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=[];To.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)||Id(this.heightMap.lineAt(e,cd.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)||Id(this.heightMap.lineAt(this.scaler.fromDOM(e),cd.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Id(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}},Od=class{constructor(e,t){this.from=e,this.to=t}};function kd(e,t,n){let r=[],i=e,a=0;return To.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 Ad({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 jd(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 Md(e,t){for(let n of e)if(t(n))return n}var Nd={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function Pd(e){let t=e.facet(Jc).filter(e=>typeof e!=`function`),n=e.facet(Xc).filter(e=>typeof e!=`function`);return n.length&&t.push(To.join(n)),t}var Fd=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,cd.ByPos,e,0,0).top,o=t.lineAt(i,cd.ByPos,e,0,0).bottom;return r+=o-a,{from:n,to:i,top:a,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=a+(e.top-i)*this.scale,a=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(t){return t instanceof e?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to):!1}};function Id(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new sd(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>Id(e,t)):e._content)}var Ld=P.define({combine:e=>e.join(` `)}),Rd=P.define({combine:e=>e.indexOf(!0)>-1}),zd=Wo.newName(),Bd=Wo.newName(),Vd=Wo.newName(),Hd={"&light":`.`+Bd,"&dark":`.`+Vd};function Ud(e,t,n){return new Wo(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 Wd=Ud(`.`+zd,{"&":{position:`relative !important`,boxSizing:`border-box`,"&.cm-focused":{outline:`1px dotted #212121`},display:`flex !important`,flexDirection:`column`},".cm-scroller":{display:`flex !important`,alignItems:`flex-start !important`,fontFamily:`monospace`,lineHeight:1.4,height:`100%`,overflowX:`auto`,position:`relative`,zIndex:0,overflowAnchor:`none`},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:`block`,whiteSpace:`pre`,wordWrap:`normal`,boxSizing:`border-box`,minHeight:`100%`,padding:`4px 0`,outline:`none`,"&[contenteditable=true]":{WebkitUserModify:`read-write-plaintext-only`}},".cm-lineWrapping":{whiteSpace_fallback:`pre-wrap`,whiteSpace:`break-spaces`,wordBreak:`break-word`,overflowWrap:`anywhere`,flexShrink:1},"&light .cm-content":{caretColor:`black`},"&dark .cm-content":{caretColor:`white`},".cm-line":{display:`block`,padding:`0 2px 0 6px`},".cm-layer":{position:`absolute`,left:0,top:0,contain:`size style`,"& > *":{position:`absolute`}},"&light .cm-selectionBackground":{background:`#d9d9d9`},"&dark .cm-selectionBackground":{background:`#222`},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#d7d4f0`},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#233`},".cm-cursorLayer":{pointerEvents:`none`},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:`steps(1) cm-blink 1.2s infinite`},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:`1.2px solid black`,marginLeft:`-0.6px`,pointerEvents:`none`},".cm-cursor":{display:`none`},"&dark .cm-cursor":{borderLeftColor:`#ddd`},".cm-selectionHandle":{backgroundColor:`currentColor`,width:`1.5px`},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:`""`,backgroundColor:`inherit`,borderRadius:`50%`,width:`8px`,height:`8px`,position:`absolute`,left:`-3.25px`},".cm-selectionHandle-start::before":{top:`-8px`},".cm-selectionHandle-end::before":{bottom:`-8px`},".cm-dropCursor":{position:`absolute`},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:`block`},".cm-iso":{unicodeBidi:`isolate`},".cm-announced":{position:`fixed`,top:`-10000px`},"@media print":{".cm-announced":{display:`none`}},"&light .cm-activeLine":{backgroundColor:`#cceeff44`},"&dark .cm-activeLine":{backgroundColor:`#99eeff33`},"&light .cm-specialChar":{color:`red`},"&dark .cm-specialChar":{color:`#f78`},".cm-gutters":{flexShrink:0,display:`flex`,height:`100%`,boxSizing:`border-box`,zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:`#f5f5f5`,color:`#6c6c6c`,border:`0px solid #ddd`,"&.cm-gutters-before":{borderRightWidth:`1px`},"&.cm-gutters-after":{borderLeftWidth:`1px`}},"&dark .cm-gutters":{backgroundColor:`#333338`,color:`#ccc`},".cm-gutter":{display:`flex !important`,flexDirection:`column`,flexShrink:0,boxSizing:`border-box`,minHeight:`100%`,overflow:`hidden`},".cm-gutterElement":{boxSizing:`border-box`},".cm-lineNumbers .cm-gutterElement":{padding:`0 3px 0 5px`,minWidth:`20px`,textAlign:`right`,whiteSpace:`nowrap`},"&light .cm-activeLineGutter":{backgroundColor:`#e2f2ff`},"&dark .cm-activeLineGutter":{backgroundColor:`#222227`},".cm-panels":{boxSizing:`border-box`,position:`sticky`,left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:`#f5f5f5`,color:`black`},"&light .cm-panels-top":{borderBottom:`1px solid #ddd`},"&light .cm-panels-bottom":{borderTop:`1px solid #ddd`},"&dark .cm-panels":{backgroundColor:`#333338`,color:`white`},".cm-dialog":{padding:`2px 19px 4px 6px`,position:`relative`,"& label":{fontSize:`80%`}},".cm-dialog-close":{position:`absolute`,top:`3px`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,fontSize:`14px`,padding:`0`},".cm-tab":{display:`inline-block`,overflow:`hidden`,verticalAlign:`bottom`},".cm-widgetBuffer":{verticalAlign:`text-top`,height:`1em`,width:0,display:`inline`},".cm-placeholder":{color:`#888`,display:`inline-block`,verticalAlign:`top`,userSelect:`none`},".cm-highlightSpace":{backgroundImage:`radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)`,backgroundPosition:`center`},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:`auto 100%`,backgroundPosition:`right 90%`,backgroundRepeat:`no-repeat`},".cm-trailingSpace":{backgroundColor:`#ff332255`},".cm-button":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,padding:`.2em 1em`,borderRadius:`1px`},"&light .cm-button":{backgroundImage:`linear-gradient(#eff1f5, #d9d9df)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#b4b4b4, #d0d3d6)`}},"&dark .cm-button":{backgroundImage:`linear-gradient(#393939, #111)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#111, #333)`}},".cm-textfield":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,border:`1px solid silver`,padding:`.2em .5em`},"&light .cm-textfield":{backgroundColor:`white`},"&dark .cm-textfield":{border:`1px solid #555`,backgroundColor:`inherit`}},Hd),Gd={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Kd=F.ie&&F.ie_version<=11,qd=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Ws,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);(F.ie&&F.ie_version<=11||F.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&&F.android&&e.constructor.EDIT_CONTEXT!==!1&&!(F.chrome&&F.chrome_version<126)&&(this.editContext=new Zd(e),e.state.facet(Vc)&&(e.contentDOM.editContext=this.editContext.editContext)),Kd&&(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(Vc)?n.root.activeElement!=this.dom:!Ms(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(F.ie&&F.ie_version<=11||F.android&&F.chrome)&&!n.state.selection.main.empty&&r.focusNode&&Ps(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=As(e.root);if(!t)return!1;let n=F.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Xd(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=Ms(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Zs(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||=this.scrollTargets.slice(0,e),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener(`scroll`,this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||=(this.observer.observe(this.dom,Gd),Kd&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Kd&&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&&Ys(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&&Ms(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 uu(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=fu(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!vu(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type==`attributes`),e.type==`childList`){let n=Jd(t,e.previousSibling||e.target.previousSibling,-1),r=Jd(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else if(e.type==`characterData`)return{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue};else return null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener(`change`,this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener(`beforeprint`,this.onPrint),e.addEventListener(`scroll`,this.onScroll),e.document.addEventListener(`selectionchange`,this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener(`scroll`,this.onScroll),e.removeEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener(`change`,this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener(`beforeprint`,this.onPrint),e.document.removeEventListener(`selectionchange`,this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Vc)!=e.state.facet(Vc)&&(e.view.contentDOM.editContext=e.state.facet(Vc)?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 Jd(e,t,n){for(;t;){let r=ol.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 Yd(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 Ps(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function Xd(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Yd(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?Yd(e,n):null}var Zd=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=hu(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=N.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));vu(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:$i.of(n.text.slice(l.from,l.toB).split(`
|
|
43
|
-
`))};if((F.mac||F.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:$i.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);pu(e,u,N.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(Ss.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:zc.of(Ss.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=As(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,a,o,s,c)=>{if(n)return;let l=c.length-(a-i);if(r&&a>=r.to)if(r.from==i&&r.to==a&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=l,this.to+=l;return}else r=null,this.revertPending(e.state);if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),c.toString()),this.to+=l}t+=l}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent(`input.type`)&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},I=class e{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement(`div`),this.scrollDOM=document.createElement(`div`),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=`cm-scroller`,this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(`div`),this.announceDOM.className=`cm-announced`,this.announceDOM.setAttribute(`aria-live`,`polite`),this.dom=document.createElement(`div`),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Xs(e.parent)||document,this.viewState=new Dd(this,e.state||vo.create(e)),e.scrollTo&&e.scrollTo.is(Rc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Uc).map(e=>new Gc(e));for(let e of this.plugins)e.update(this);this.observer=new qd(this),this.inputState=new yu(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Nl(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 ro?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(Zu))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Qu(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(vo.phrases)!=this.state.facet(vo.phrases))return this.setState(a);i=il.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 Lc(t.empty?t:N.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(Rc)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=ef.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(nl)!=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(Ld)!=i.state.facet(Ld)&&(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(kc))try{e(i)}catch(e){Bc(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!fu(this,u)&&l.force&&Ys(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 Dd(this,e),this.plugins=e.facet(Uc).map(e=>new Gc(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new Nl(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(Uc),n=e.state.facet(Uc);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new Gc(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){Bc(this.state,e,`doc view update listener`)}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:a}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0)if(Qs(n||this.win))i=-1,a=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}this.updateState=1;let o=this.viewState.measure();if(!o&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(e>5){console.warn(this.measureRequests.length?`Measure loop restarted more than 5 times`:`Viewport failed to stabilize`);break}let s=[];o&4||([this.measureRequests,s]=[s,this.measureRequests]);let c=s.map(e=>{try{return e.read(this)}catch(e){return Bc(this.state,e),$d}}),l=il.create(this,this.state,[]),u=!1;l.flags|=o,t?t.flags|=o:t=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),u=this.docView.update(l),u&&this.docViewUpdate());for(let e=0;e<s.length;e++)if(c[e]!=$d)try{let t=s[e];t.write&&t.write(c[e],this)}catch(e){Bc(this.state,e)}if(u&&this.docView.updateSelection(!0),!l.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let e=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-a)/this.scaleY;if((e>1||e<-1)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?n.scrollTop+=e:this.win.scrollBy(0,e),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(kc))e(t)}get themeClasses(){return zd+` `+(this.state.facet(Rd)?Vd:Bd)+` `+this.state.facet(Ld)}updateAttrs(){let e=tf(this,Kc,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(Vc)?`true`:`false`,class:`cm-content`,style:`${F.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),tf(this,qc,t);let n=this.observer.ignore(()=>{let n=vs(this.contentDOM,this.contentAttrs,t),r=vs(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&(this.announceDOM.textContent=``),n=!1;let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(nl);let t=this.state.facet(e.cspNonce);Wo.mount(this.root,this.styleModules.concat(Wd).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 tu(this,e,Xl(this,e,t,n))}moveByGroup(e,t){return tu(this,e,Xl(this,e,t,t=>Zl(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return N.cursor(i.side(t,r)+e.from,i.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return Yl(this,e,t,n)}moveVertically(e,t,n){return tu(this,e,Ql(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=ru(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),ru(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),a=i[fc.find(i,e-r.from,-1,t)];return zs(n,a.dir==nc.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Pc)||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>Qd)return xc(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||pc(r.isolates,n=$c(this,e))))return r.order;n||=$c(this,e);let r=bc(e.text,t,n);return this.bidiCache.push(new ef(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||F.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ks(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Rc.of(new Lc(typeof e==`number`?N.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 Rc.of(new Lc(N.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 Wc.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Wc.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Wo.newName(),r=[Ld.of(n),nl.of(Ud(`.${n}`,e))];return t&&t.dark&&r.push(Rd.of(!0)),r}static baseTheme(e){return Ra.lowest(nl.of(Ud(`.`+zd,e,Hd)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&ol.get(t)||ol.get(e))?.root?.view||null}};I.styleModule=nl,I.inputHandler=Ac,I.clipboardInputFilter=Mc,I.clipboardOutputFilter=Nc,I.scrollHandler=Ic,I.focusChangeEffect=jc,I.perLineTextDirection=Pc,I.exceptionSink=Oc,I.updateListener=kc,I.editable=Vc,I.mouseSelectionStyle=Dc,I.dragMovesSelection=Ec,I.clickAddsSelectionRange=Tc,I.decorations=Jc,I.blockWrappers=Yc,I.outerDecorations=Xc,I.atomicRanges=Zc,I.bidiIsolatedRanges=Qc,I.cursorScrollMargin=P.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}}}),I.scrollMargins=el,I.darkTheme=Rd,I.cspNonce=P.define({combine:e=>e.length?e[0]:``}),I.contentAttributes=qc,I.editorAttributes=Kc,I.lineWrapping=I.contentAttributes.of({class:`cm-lineWrapping`}),I.announce=no.define();var Qd=4096,$d={},ef=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:nc.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 tf(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&&ms(a,n)}return n}var nf=F.mac?`mac`:F.windows?`win`:F.linux?`linux`:`key`;function rf(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 af(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 of=Ra.default(I.domEventHandlers({keydown(e,t){return mf(lf(t.state),e,t,`editor`)}})),sf=P.define({enables:of}),cf=new WeakMap;function lf(e){let t=e.facet(sf),n=cf.get(t);return n||cf.set(t,n=ff(t.reduce((e,t)=>e.concat(t),[]))),n}var uf=null,df=4e3;function ff(e,t=nf){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=>rf(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=uf={view:t,prefix:n,scope:e};return setTimeout(()=>{uf==r&&(uf=null)},df),!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,pf))}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 pf=null;function mf(e,t,n,r){pf=t;let i=$o(t),a=ha(pa(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;uf&&uf.view==n&&uf.scope==r&&(o=uf.prefix+` `,wu.indexOf(t.keyCode)<0&&(c=!0,uf=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+af(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(F.windows&&t.ctrlKey&&t.altKey)&&!(F.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=qo[t.keyCode])&&p!=i?(d(f[o+af(p,t,!0)])||t.shiftKey&&(m=Jo[t.keyCode])!=i&&m!=p&&d(f[o+af(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+af(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),pf=null,s}/x/.unicode;function hf(){return _f}var gf=Ss.line({class:`cm-activeLine`}),_f=Wc.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(gf.range(i.from)),t=i.from)}return Ss.set(n)}},{decorations:e=>e.decorations}),vf=class extends bs{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?Ns(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=zs(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 yf(e){let t=Wc.fromClass(class{constructor(t){this.view=t,this.placeholder=e?Ss.set([Ss.widget({widget:new vf(e),side:1}).range(0)]):Ss.none}get decorations(){return this.view.state.doc.length?Ss.none:this.placeholder}},{decorations:e=>e.decorations});return typeof e==`string`?[t,I.contentAttributes.of({"aria-placeholder":e})]:t}var bf=`-10000px`,xf=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 Sf(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}var Cf=P.define({combine:e=>({position:F.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||Sf})}),wf=new WeakMap,Tf=Wc.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(Cf);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 xf(e,kf,(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(Cf);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=bf,n.dom.style.left=`0px`,this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener(`resize`,this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(e=t.destroy)==null||e.call(t);this.parent&&this.container.remove(),(t=this.resizeObserver)==null||t.disconnect(),(n=this.intersectionObserver)==null||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(F.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||this.position==`absolute`)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else ({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=tl(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Cf).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){if(e.makeAbsolute){this.madeAbsolute=!0,this.position=`absolute`;for(let e of this.manager.tooltipViews)e.dom.style.position=`absolute`}let{visible:t,space:n,scaleX:r,scaleY:i}=e,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let s=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:l}=c,u=e.pos[o],d=e.size[o];if(!u||s.clip!==!1&&(u.bottom<=Math.max(t.top,n.top)||u.top>=Math.min(t.bottom,n.bottom)||u.right<Math.max(t.left,n.left)-.1||u.left>Math.min(t.right,n.right)+.1)){l.style.top=bf;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=wf.get(c)??d.bottom-d.top,g=c.offset||Of,_=this.view.textDirection==nc.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=bf;continue}wf.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`,Ef(l,(v-e.parent.left)/r)):(l.style.top=x/i+`px`,Ef(l,v/r)),f){let e=u.left+(_?g.x:-g.x)-(v+14-7);f.style.left=e/r+`px`}c.overlap!==!0&&a.push({left:v,top:x,right:S,bottom:x+h}),l.classList.toggle(`cm-tooltip-above`,y),l.classList.toggle(`cm-tooltip-below`,!y),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=bf}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Ef(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var Df=I.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`}}}),Of={x:0,y:0},kf=P.define({enables:[Tf,Df]}),Af=P.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])}),jf=class e{static create(t){return new e(t)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement(`div`),this.dom.classList.add(`cm-tooltip-hover`),this.manager=new xf(e,Af,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add(`cm-tooltip-section`),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)==null||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(r!==void 0){if(t===void 0)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp(`offset`)}get getCoords(){return this.passProp(`getCoords`)}get overlap(){return this.passProp(`overlap`)}get resize(){return this.passProp(`resize`)}},Mf=kf.compute([Af],e=>{let t=e.facet(Af);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>e.end??e.pos)),create:jf.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),Nf=P.define(),Pf=class{constructor(e,t,n,r,i,a){this.view=e,this.source=t,this.field=n,this.locked=r,this.setHover=i,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener(`mouseleave`,this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener(`mousemove`,this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let r,i=1;if(n.isWidget())r=n.posAtStart;else{if(r=e.posAtCoords(t),r==null)return;let n=e.coordsAtPos(r);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),o=a&&a.dir==nc.RTL?-1:1;i=t.x<n.left?-o:o}this.activateHover(e,r,i)}activateHover(e,t,n,r){let i=this.source(e,t,n),a=t=>{if(t&&!(Array.isArray(t)&&!t.length)){let n=Array.isArray(t)?t:[t];r&&this.locked.set(n,r),e.dispatch({effects:this.setHover.of(n)})}};if(i&&`then`in i){let n=this.pending={pos:t};i.then(e=>{this.pending==n&&(this.pending=null,a(e))},t=>Bc(e.state,t,`hover tooltip`))}else a(i)}get tooltip(){let e=this.view.plugin(Tf),t=e?e.manager.tooltips.findIndex(e=>e.create==jf.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:t,tooltip:n}=this;if(t.length&&!this.locked.has(t)&&n&&!If(n.dom,e)||this.pending){let{pos:n}=t[0]||this.pending,r=t[0]?.end??n;(n==r?this.view.posAtCoords(this.lastMove)!=n:!Lf(this.view,n,r,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener(`mouseleave`,t);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener(`mouseleave`,t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener(`mouseleave`,this.mouseleave),this.view.dom.removeEventListener(`mousemove`,this.mousemove)}},Ff=4;function If(e,t){let{left:n,right:r,top:i,bottom:a}=e.getBoundingClientRect(),o;if(o=e.querySelector(`.cm-tooltip-arrow`)){let e=o.getBoundingClientRect();i=Math.min(e.top,i),a=Math.max(e.bottom,a)}return t.clientX>=n-Ff&&t.clientX<=r+Ff&&t.clientY>=i-Ff&&t.clientY<=a+Ff}function Lf(e,t,n,r,i,a){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,s)<i)return!1;let c=e.posAtCoords({x:r,y:i},!1);return c>=t&&c<=n}function Rf(e,t={}){let n=no.define(),r=new WeakMap,i=Fa.define({create(){return[]},update(e,a){let o=r.get(e);if(e.length&&(t.hideOnChange&&(a.docChanged||a.selection)||o&&o(a)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(a,e)))),a.docChanged&&e.length){let t=[];for(let n of e){let e=a.changes.mapPos(n.pos,-1,_a.TrackDel);if(e!=null){let r=Object.assign(Object.create(null),n);r.pos=e,r.end!=null&&(r.end=a.changes.mapPos(r.end)),t.push(r)}}e=t}for(let t of a.effects)t.is(n)&&(e=t.value,o=void 0),(t.is(Bf)&&!t.value||t.value==i)&&(e=[]);return e.length&&o&&r.set(e,o),e},provide:e=>Af.from(e)}),a=Wc.define(a=>new Pf(a,e,i,r,n,t.hoverTime||300));return{active:i,extension:[i,a,Nf.of(a),Mf]}}function zf(e,t){let n=e.plugin(Tf);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}var Bf=no.define(),Vf=P.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}}),Hf=Wc.fromClass(class{constructor(e){this.input=e.state.facet(Gf),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Vf);this.top=new Uf(e,!0,t.topContainer),this.bottom=new Uf(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}update(e){let t=e.state.facet(Vf);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Uf(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Uf(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Gf);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],a=[],o=[];for(let n of t){let t=this.specs.indexOf(n),s;t<0?(s=n(e.view),o.push(s)):(s=this.panels[t],s.update&&s.update(e)),r.push(s),(s.top?i:a).push(s)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(a);for(let e of o)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>I.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),Uf=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes=``,this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&=(this.dom.remove(),void 0);return}if(!this.dom){this.dom=document.createElement(`div`),this.dom.className=this.top?`cm-panels cm-panels-top`:`cm-panels cm-panels-bottom`,this.dom.style[this.top?`top`:`bottom`]=`0`;let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Wf(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Wf(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(` `))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(` `))e&&this.container.classList.add(e)}}};function Wf(e){let t=e.nextSibling;return e.remove(),t}var Gf=P.define({enables:Hf}),Kf=class extends bo{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};Kf.prototype.elementClass=``,Kf.prototype.toDOM=void 0,Kf.prototype.mapMode=_a.TrackBefore,Kf.prototype.startSide=Kf.prototype.endSide=-1,Kf.prototype.point=!0;var qf=P.define(),Jf=P.define(),Yf={class:``,renderEmptyElements:!1,elementStyle:``,markers:()=>To.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:`before`},Xf=P.define();function Zf(e){return[$f(),Xf.of({...Yf,...e})]}var Qf=P.define({combine:e=>e.some(e=>e)});function $f(e){let t=[ep];return e&&e.fixed===!1&&t.push(Qf.of(!0)),t}var ep=Wc.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(Xf).map(t=>new ip(e,t)),this.fixed=!e.state.facet(Qf);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(Qf)!=!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=To.iter(this.view.state.facet(qf),this.view.viewport.from),r=[],i=this.gutters.map(e=>new rp(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==xs.Text&&t){np(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==xs.Text){np(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(Xf),n=e.state.facet(Xf),r=e.docChanged||e.heightChanged||e.viewportChanged||!To.eq(e.startState.facet(qf),e.state.facet(qf),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 ip(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=>I.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==nc.LTR?{left:r,right:i}:{right:r,left:i}})});function tp(e){return Array.isArray(e)?e:[e]}function np(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}var rp=class{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=To.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 ap(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=[];np(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(Jf)){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()}}},ip=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=tp(t.markers(e)),t.initialSpacer&&(this.spacer=new ap(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=tp(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!To.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()}},ap=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`:``),op(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 op(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 sp=P.define(),cp=P.define(),lp=P.define({combine(e){return yo(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}})}}),up=class extends Kf{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function dp(e,t){return e.state.facet(lp).formatNumber(t,e.state)}var fp=Xf.compute([lp],e=>({class:`cm-lineNumbers`,renderEmptyElements:!1,markers(e){return e.state.facet(sp)},lineMarker(e,t,n){return n.some(e=>e.toDOM)?null:new up(dp(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(cp)){let i=r(e,t,n);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(lp)!=e.state.facet(lp),initialSpacer(e){return new up(dp(e,mp(e.state.doc.lines)))},updateSpacer(e,t){let n=dp(t.view,mp(t.view.state.doc.lines));return n==e.number?e:new up(n)},domEventHandlers:e.facet(lp).domEventHandlers,side:`before`}));function pp(e={}){return[lp.of(e),$f(),fp]}function mp(e){let t=9;for(;t<e;)t=t*10+9;return t}var hp=new class extends Kf{constructor(){super(...arguments),this.elementClass=`cm-activeLineGutter`}},gp=qf.compute([`selection`],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(hp.range(i)))}return To.of(t)});function _p(){return gp}var vp=1024,yp=0,bp=class{constructor(e,t){this.from=e,this.to=t}},L=class{constructor(e={}){this.id=yp++,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=Cp.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};L.closedBy=new L({deserialize:e=>e.split(` `)}),L.openedBy=new L({deserialize:e=>e.split(` `)}),L.group=new L({deserialize:e=>e.split(` `)}),L.isolate=new L({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),L.contextHash=new L({perNode:!0}),L.lookAhead=new L({perNode:!0}),L.mounted=new L({perNode:!0});var xp=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[L.mounted.id]}},Sp=Object.create(null),Cp=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):Sp,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(L.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(L.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};Cp.none=new Cp(``,Object.create(null),0,8);var wp=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 Cp(e.name,r,e.id,e.flags):e)}return new e(n)}},Tp=new WeakMap,Ep=new WeakMap,Dp;(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`})(Dp||={});var Op=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=xp.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 Hp(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new Hp(Tp.get(this)||this.topNode);return r.moveTo(e,t),Tp.set(this,r._tree),r}get topNode(){return new Pp(this,0,0,null)}resolve(e,t=0){let n=Mp(Tp.get(this)||this.topNode,e,t,!1);return Tp.set(this,n),n}resolveInner(e,t=0){let n=Mp(Ep.get(this)||this.topNode,e,t,!0);return Ep.set(this,n),n}resolveStack(e,t=0){return Vp(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&Dp.IncludeAnonymous)>0;for(let e=this.cursor(a|Dp.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:qp(Cp.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(Cp.none,t,n,r)))}static build(e){return Wp(e)}};Op.empty=new Op(Cp.none,[],[],0);var kp=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)}},Ap=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Cp.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&&!(jp(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 jp(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 Mp(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 Pp&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:Dp.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof Pp&&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 Np=class{cursor(e=0){return new Hp(this,e)}getChild(e,t=null,n=null){let r=Fp(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Fp(this,e,t,n)}resolve(e,t=0){return Mp(this,e,t,!1)}resolveInner(e,t=0){return Mp(this,e,t,!0)}matchContext(e){return Ip(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}},Pp=class e extends Np{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&Dp.EnterBracketed&&l instanceof Op&&(d=xp.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length)&&!jp(i,r,u,u+l.length))){if(l instanceof Ap){if(a&Dp.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new Rp(new Lp(o,l,t,u),null,e)}else if(a&Dp.IncludeAnonymous||!l.type.isAnonymous||Up(l)){let s;if(!(a&Dp.IgnoreMounts)&&(s=xp.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&Dp.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&Dp.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&Dp.IgnoreOverlays)&&(i=xp.get(this._tree))&&i.overlay){let a=t-this.from,o=r&Dp.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 Fp(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 Ip(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 Lp=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},Rp=class e extends Np{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&Dp.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 Op(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function zp(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 Pp&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new Bp(i,n)}var Bp=class{constructor(e,t){this.heads=e,this.node=t}get next(){return zp(this.heads)}};function Vp(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof Pp?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=xp.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Pp(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(Mp(o,t,n,!1))}}return i?zp(i):r}var Hp=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&~Dp.EnterBracketed,e instanceof Pp)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 Pp?(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&Dp.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Dp.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Dp.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else ({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&Dp.IncludeAnonymous||e instanceof Ap||!e.type.isAnonymous||Up(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 Rp(this.buffer,t,this.stack[e]);return this.bufferNode=new Rp(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 Ip(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 Ip(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 Up(e){return e.children.some(e=>e instanceof Ap||!e.type.isAnonymous||Up(e))}function Wp(e){let{buffer:t,nodeSet:n,maxBufferLength:r=vp,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new kp(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}else if(w==-3){c=x;return}else if(w==-4){l=x;return}else throw RangeError(`Unrecognized record size: ${w}`);let ee=s[x],te,ne,D=S-e;if(C-S<=r&&(ne=h(o.pos-t,y))){let t=new Uint16Array(ne.size-ne.skip),r=o.pos-ne.size,i=t.length;for(;o.pos>r;)i=g(ne.start,t,i);te=new Ap(t,C-ne.start,n),D=ne.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(ee,E);te=qp(ee,t,n,0,t.length,0,C-S,e,e)}else te=m(ee,t,n,C-S,T-C,E)}_.push(te),v.push(D)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new Ap(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 Op){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(L.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=[L.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[L.lookAhead,i];o=o?[e].concat(o):[e]}return new Op(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 Op(s[e.topID],_.reverse(),v.reverse(),y)}var Gp=new WeakMap;function Kp(e,t){if(!e.isAnonymous||t instanceof Ap||t.type!=e)return 1;let n=Gp.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Op)){n=1;break}n+=Kp(e,r)}Gp.set(t,n)}return n}function qp(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=Kp(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=Kp(e,t[s]);for(s++;s<i;s++){let n=Kp(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(qp(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 Jp=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}},Yp=class{startParse(e,t,n){return typeof e==`string`&&(e=new Xp(e)),n=n?n.length?n.map(e=>new bp(e.from,e.to)):[new bp(0,0)]:[new bp(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}}},Xp=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 L({perNode:!0});var Zp=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 Qp(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){n<r.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from;n<r.minRepeatTerm&&s==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new $p(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216))if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Qp(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()}},Qp=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},$p=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}},em=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 tm(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 nm=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},rm=new nm,im=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=rm,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=rm,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}},am=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;cm(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};am.prototype.contextual=am.prototype.fallback=am.prototype.extend=!1;var om=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?tm(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(cm(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))}};om.prototype.contextual=am.prototype.fallback=am.prototype.extend=!1;var sm=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function cm(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||um(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 lm(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function um(e,t,n,r){let i=lm(n,r,t);return i<0||lm(n,r,e)<i}var dm=typeof process<`u`&&process.env&&/\bparse\b/.test(process.env.LOG),fm=null;function pm(e,t,n){let r=e.cursor(Dp.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 mm=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?pm(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?pm(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 Op){if(a==e){if(a<this.safeFrom)return null;let e=a+i.length;if(e<=this.safeTo){let t=i.prop(L.lookAhead);if(!t||e+t<this.fragment.to)return i}}this.index[t]++,a+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}},hm=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new nm)}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 nm,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 nm,{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=bm(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(bm(o,s+2),t,n,r));break}o[s]==t&&(r=this.putAction(bm(o,s+1),t,n,r))}return r}},gm=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 im(t,r),this.tokens=new hm(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[Zp.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new mm(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&xm(r);if(e)return dm&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw dm&&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 dm&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500)if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=dm?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(r);o;){let r=this.parser.nodeSet.types[o.type.id]==o.type?i.getGoto(e.state,o.type.id):-1;if(r>-1&&o.length&&(!t||(o.prop(L.contextHash)||0)==n))return e.useNode(o,r),dm&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(o.type.id)})`),!0;if(!(o instanceof Op)||o.children.length==0||o.positions[0]>0)break;let s=o.children[0];if(s instanceof Op&&o.positions[0]==0)o=s;else break}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),dm&&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),dm&&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 _m(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=dm?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),dm&&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()&&(dm&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)dm&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))dm&&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),dm&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),_m(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),Op.build({buffer:em.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=(fm||=new WeakMap).get(e);return t||fm.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function _m(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 vm=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},ym=class e extends Yp{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=L[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 wp(t.map((t,i)=>Cp.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=vp;let a=tm(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(Sm),this.states=tm(e.states,Uint32Array),this.data=tm(e.stateData),this.goto=tm(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new am(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 gm(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=bm(n,i+2)];else if(n[i+1]==2)return bm(n,i+2);else break;if(a==t||a==0)return bm(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=bm(this.data,n+2);else break;r=t(bm(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=bm(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]=Sm(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 vm(e,n,r)}static deserialize(t){return new e(t)}};function bm(e,t){return e[t]|e[t+1]<<16}function xm(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 Sm(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}var Cm=0,wm=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Cm++}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 Em(e);return e=>e.modified.indexOf(t)>-1?e:Em.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},Tm=0,Em=class e{constructor(e){this.name=e,this.instances=[],this.id=Tm++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&Dm(n,e.modified));if(r)return r;let i=[],a=new wm(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=Om(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 Dm(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function Om(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 km(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 jm(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Am.add(t)}var Am=new L({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 jm(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),jm=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}};jm.empty=new jm([],2,null);function Mm(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 Nm(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function Pm(e,t,n,r=0,i=e.length){let a=new Fm(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var Fm=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=Im(e)||jm.empty,u=Nm(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(L.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do{if(e.to<=t)continue;if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function Im(e){let t=e.type.prop(Am);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var R=wm.define,Lm=R(),Rm=R(),zm=R(Rm),Bm=R(Rm),Vm=R(),Hm=R(Vm),Um=R(Vm),Wm=R(),Gm=R(Wm),Km=R(),qm=R(),Jm=R(),Ym=R(Jm),Xm=R(),z={comment:Lm,lineComment:R(Lm),blockComment:R(Lm),docComment:R(Lm),name:Rm,variableName:R(Rm),typeName:zm,tagName:R(zm),propertyName:Bm,attributeName:R(Bm),className:R(Rm),labelName:R(Rm),namespace:R(Rm),macroName:R(Rm),literal:Vm,string:Hm,docString:R(Hm),character:R(Hm),attributeValue:R(Hm),number:Um,integer:R(Um),float:R(Um),bool:R(Vm),regexp:R(Vm),escape:R(Vm),color:R(Vm),url:R(Vm),keyword:Km,self:R(Km),null:R(Km),atom:R(Km),unit:R(Km),modifier:R(Km),operatorKeyword:R(Km),controlKeyword:R(Km),definitionKeyword:R(Km),moduleKeyword:R(Km),operator:qm,derefOperator:R(qm),arithmeticOperator:R(qm),logicOperator:R(qm),bitwiseOperator:R(qm),compareOperator:R(qm),updateOperator:R(qm),definitionOperator:R(qm),typeOperator:R(qm),controlOperator:R(qm),punctuation:Jm,separator:R(Jm),bracket:Ym,angleBracket:R(Ym),squareBracket:R(Ym),paren:R(Ym),brace:R(Ym),content:Wm,heading:Gm,heading1:R(Gm),heading2:R(Gm),heading3:R(Gm),heading4:R(Gm),heading5:R(Gm),heading6:R(Gm),contentSeparator:R(Wm),list:R(Wm),quote:R(Wm),emphasis:R(Wm),strong:R(Wm),link:R(Wm),monospace:R(Wm),strikethrough:R(Wm),inserted:R(),deleted:R(),changed:R(),invalid:R(),meta:Xm,documentMeta:R(Xm),annotation:R(Xm),processingInstruction:R(Xm),definition:wm.defineModifier(`definition`),constant:wm.defineModifier(`constant`),function:wm.defineModifier(`function`),standard:wm.defineModifier(`standard`),local:wm.defineModifier(`local`),special:wm.defineModifier(`special`)};for(let e in z){let t=z[e];t instanceof wm&&(t.name=e)}Mm([{tag:z.link,class:`tok-link`},{tag:z.heading,class:`tok-heading`},{tag:z.emphasis,class:`tok-emphasis`},{tag:z.strong,class:`tok-strong`},{tag:z.keyword,class:`tok-keyword`},{tag:z.atom,class:`tok-atom`},{tag:z.bool,class:`tok-bool`},{tag:z.url,class:`tok-url`},{tag:z.labelName,class:`tok-labelName`},{tag:z.inserted,class:`tok-inserted`},{tag:z.deleted,class:`tok-deleted`},{tag:z.literal,class:`tok-literal`},{tag:z.string,class:`tok-string`},{tag:z.number,class:`tok-number`},{tag:[z.regexp,z.escape,z.special(z.string)],class:`tok-string2`},{tag:z.variableName,class:`tok-variableName`},{tag:z.local(z.variableName),class:`tok-variableName tok-local`},{tag:z.definition(z.variableName),class:`tok-variableName tok-definition`},{tag:z.special(z.variableName),class:`tok-variableName2`},{tag:z.definition(z.propertyName),class:`tok-propertyName tok-definition`},{tag:z.typeName,class:`tok-typeName`},{tag:z.namespace,class:`tok-namespace`},{tag:z.className,class:`tok-className`},{tag:z.macroName,class:`tok-macroName`},{tag:z.propertyName,class:`tok-propertyName`},{tag:z.operator,class:`tok-operator`},{tag:z.comment,class:`tok-comment`},{tag:z.meta,class:`tok-meta`},{tag:z.invalid,class:`tok-invalid`},{tag:z.punctuation,class:`tok-punctuation`}]);var Zm=km({String:z.string,Number:z.number,"True False":z.bool,PropertyName:z.propertyName,Null:z.null,", :":z.separator,"[ ]":z.squareBracket,"{ }":z.brace}),Qm=ym.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:[Zm],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}),$m=new L;function eh(e){return P.define({combine:e?t=>t.concat(e):void 0})}var th=new L,nh=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,vo.prototype.hasOwnProperty(`tree`)||Object.defineProperty(vo.prototype,`tree`,{get(){return ah(this)}}),this.parser=t,this.extension=[mh.of(this),vo.languageData.of((e,t,n)=>{let r=rh(e,t,n),i=r.type.prop($m);if(!i)return[];let a=e.facet(i),o=r.type.prop(th);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 rh(e,t,n).type.prop($m)==this.data}findRegions(e){let t=e.facet(mh);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($m)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(L.mounted);if(i){if(i.tree.prop($m)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}else if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof Op&&r(i,e.positions[n]+t)}};return r(ah(e),0),n}get allowsNesting(){return!0}};nh.setState=no.define();function rh(e,t,n){let r=e.facet(mh),i=ah(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,Dp.ExcludeBuffers|Dp.EnterBracketed))e.type.isTop&&(i=e);return i}var ih=class e extends nh{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=eh(t.languageData);return new e(n,t.parser.configure({props:[$m.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 ah(e){let t=e.field(nh.state,!1);return t?t.tree:Op.empty}var oh=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)}},sh=null,ch=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,[],Op.empty,0,r,[],null)}startParse(){return this.parser.startParse(new oh(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Op.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(Jp.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(Jp.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=sh;sh=this;try{return e()}finally{sh=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=lh(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=Jp.applyChanges(r,e),i=Op.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=lh(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 Yp{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=sh;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 Op(Cp.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 sh}};function lh(e,t,n){return Jp.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var uh=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=ch.create(t.facet(mh).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};nh.state=Fa.define({create:uh.init,update(e,t){for(let e of t.effects)if(e.is(nh.setState))return e.value;return t.startState.facet(mh)==t.state.facet(mh)?e.apply(t):uh.init(t.state)}});var dh=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(dh=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var fh=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,ph=Wc.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(nh.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(nh.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=dh(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(nh.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!fh?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>fh&&fh()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:nh.setState.of(new uh(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=>Bc(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),mh=P.define({combine(e){return e.length?e[0]:null},enables:e=>[nh.state,ph,I.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),hh=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},gh=P.define(),_h=P.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 vh(e){let t=e.facet(_h);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function yh(e,t){let n=``,r=e.tabSize,i=e.facet(_h)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function bh(e,t){e instanceof vo&&(e=new xh(e));for(let n of e.state.facet(gh)){let r=n(e,t);if(r!==void 0)return r}let n=ah(e.state);return n.length>=t?Ch(e,n,t):null}var xh=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=vh(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 Ro(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}},Sh=new L;function Ch(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 wh(r,e,n)}function wh(e,t,n){for(let r=e;r;r=r.next){let e=Eh(r.node);if(e)return e(Oh.create(t,n,r))}return 0}function Th(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Eh(e){let t=e.type.prop(Sh);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(L.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>jh(e,!0,1,void 0,n&&!Th(e)?t.from:void 0)}return e.parent==null?Dh:null}function Dh(){return 0}var Oh=class e extends xh{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(kh(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return wh(this.context.next,this.base,this.pos)}};function kh(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Ah(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 jh(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?Ah(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}function Mh({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var Nh=new L;function Ph(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 Fh=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=Wo.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 nh?e=>e.prop($m)==a.data:a?e=>e==a:void 0,this.style=Mm(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new Wo(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},Ih=P.define(),Lh=P.define({combine(e){return e.length?[e[0]]:null}});function Rh(e){let t=e.facet(Ih);return t.length?t:e.facet(Lh)}function zh(e,t){let n=[Vh],r;return e instanceof Fh&&(e.module&&n.push(I.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(Lh.of(e)):r?n.push(Ih.computeN([I.darkTheme],t=>t.facet(I.darkTheme)==(r==`dark`)?[e]:[])):n.push(Ih.of(e)),n}var Bh=class{constructor(e){this.markCache=Object.create(null),this.tree=ah(e.state),this.decorations=this.buildDeco(e,Rh(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=ah(e.state),n=Rh(e.state),r=n!=Rh(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 Ss.none;let n=new Do;for(let{from:r,to:i}of e.visibleRanges)Pm(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=Ss.mark({class:r})))},r,i);return n.finish()}},Vh=Ra.high(Wc.fromClass(Bh,{decorations:e=>e.decorations}));z.meta,z.link,z.heading,z.emphasis,z.strong,z.strikethrough,z.keyword,z.atom,z.bool,z.url,z.contentSeparator,z.labelName,z.literal,z.inserted,z.string,z.deleted,z.regexp,z.escape,z.string,z.variableName,z.variableName,z.typeName,z.namespace,z.className,z.variableName,z.macroName,z.propertyName,z.comment,z.invalid;var Hh=1e4,Uh=`()[]{}`,Wh=new L;function Gh(e,t,n){let r=e.prop(t<0?L.openedBy:L.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 Kh(e){let t=e.type.prop(Wh);return t?t(e.node):e}function qh(e,t,n,r={}){let i=r.maxScanDistance||Hh,a=r.brackets||Uh,o=ah(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=Gh(r.type,n,a);if(i&&r.from<r.to){let o=Kh(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return Jh(e,t,n,r,o,i,a)}}return Yh(e,t,n,o,s.type,i,a)}function Jh(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=Kh(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}else if(Gh(u.type,n,o))l++;else if(Gh(u.type,-n,o)){if(l==0){let e=Kh(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 Yh(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i))if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}var Xh=Object.create(null),Zh=[Cp.none],Qh=[],$h=Object.create(null),eg=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`]])eg[e]=ng(Xh,t);function tg(e,t){Qh.indexOf(e)>-1||(Qh.push(e),console.warn(t))}function ng(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||z[n];r?typeof r==`function`?t.length?t=t.map(r):tg(n,`Modifier ${n} used at start of tag`):t.length?tg(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:tg(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=$h[i];if(a)return a.id;let o=$h[i]=Cp.define({id:Zh.length,name:r,props:[km({[r]:n})]});return Zh.push(o),o.id}nc.RTL,nc.LTR;var rg=()=>e=>{try{JSON.parse(e.state.doc.toString())}catch(t){if(!(t instanceof SyntaxError))throw t;let n=ig(t,e.state.doc);return[{from:n,message:t.message,severity:`error`,to:n}]}return[]};function ig(e,t){let n;return(n=e.message.match(/at position (\d+)/))?Math.min(+n[1],t.length):(n=e.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+n[1]).from+ +n[2]-1,t.length):0}var ag=ih.define({name:`json`,parser:Qm.configure({props:[Sh.add({Object:Mh({except:/^\s*\}/}),Array:Mh({except:/^\s*\]/})}),Nh.add({"Object Array":Ph})]}),languageData:{closeBrackets:{brackets:[`[`,`{`,`"`]},indentOnInput:/^\s*[\}\]]$/}});function og(){return new hh(ag)}var sg=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=fg(e.state,n.from);return r.line?lg(e):r.block?dg(e):!1};function cg(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 lg=cg(_g,0),ug=cg(gg,0),dg=cg((e,t)=>gg(e,t,hg(t)),0);function fg(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var pg=50;function mg(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-pg,r),o=e.sliceDoc(i,i+pg),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=2*pg?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+pg),d=e.sliceDoc(i-pg,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 hg(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 gg(e,t,n=t.selection.ranges){let r=n.map(e=>fg(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>mg(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 _g(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=fg(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}else if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var vg=$a.define(),yg=$a.define(),bg=P.define(),xg=P.define({combine(e){return yo(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)})}}),Sg=Fa.define({create(){return Vg.empty},update(e,t){let n=t.state.facet(xg),r=t.annotation(vg);if(r){let i=kg.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Ag(o,o.length,n.minDepth,i):Ig(o,t.startState.selection),new Vg(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(yg);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(ro.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=kg.fromTransaction(t),o=t.annotation(ro.time),s=t.annotation(ro.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 Vg(e.done.map(kg.fromJSON),e.undone.map(kg.fromJSON))}});function Cg(e={}){return[Sg,xg.of(e),I.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Tg:e.inputType==`historyRedo`?Eg:null;return n?(e.preventDefault(),n(t)):!1}})]}function wg(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Sg,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Tg=wg(0,!1),Eg=wg(1,!1),Dg=wg(0,!0),Og=wg(1,!0),kg=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&&ya.fromJSON(t.changes),[],t.mapped&&va.fromJSON(t.mapped),t.startSelection&&N.fromJSON(t.startSelection),t.selectionsAfter.map(N.fromJSON))}static fromTransaction(t,n){let r=Pg;for(let e of t.startState.facet(bg)){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,Pg)}static selection(t){return new e(void 0,Pg,void 0,void 0,t)}};function Ag(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 jg(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 Mg(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Ng(e,t){return e.length?t.length?e.concat(t):e:t}var Pg=[],Fg=200;function Ig(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Fg));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Ag(e,e.length-1,1e9,n.setSelAfter(r)))}else return[kg.selection([t])]}function Lg(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 Rg(e,t){if(!e.length)return e;let n=e.length,r=Pg;for(;n;){let i=zg(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[kg.selection(r)]:Pg}function zg(e,t,n){let r=Ng(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Pg,n);if(!e.changes)return kg.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new kg(i,no.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Bg=/^(input\.type|delete)($|\.)/,Vg=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||Bg.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,jg(s.changes,t.changes))||r==`input.type.compose`)?Ag(o,o.length-1,i.minDepth,new kg(t.changes.compose(s.changes),Ng(no.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,Pg)):Ag(o,o.length,i.minDepth,t),new e(o,Pg,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Pg;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Mg(a[a.length-1],t)?this:new e(Ig(this.done,t),this.undone,n,r)}addMapping(t){return new e(Rg(this.done,t),Rg(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:vg.of({side:e,rest:Lg(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?Pg:r.slice(0,r.length-1);return i.mapped&&(n=Rg(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:vg.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};Vg.empty=new Vg(Pg,Pg);var Hg=[{key:`Mod-z`,run:Tg,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:Eg,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:Eg,preventDefault:!0},{key:`Mod-u`,run:Dg,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Og,preventDefault:!0}];function Ug(e,t){return N.create(e.ranges.map(t),e.mainIndex)}function Wg(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function Gg({state:e,dispatch:t},n){let r=Ug(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Wg(e,r)),!0)}function Kg(e,t){return N.cursor(t?e.to:e.from)}function qg(e,t){return Gg(e,n=>n.empty?e.moveByChar(n,t):Kg(n,t))}function Jg(e){return e.textDirectionAt(e.state.selection.main.head)==nc.LTR}var Yg=e=>qg(e,!Jg(e)),Xg=e=>qg(e,Jg(e));function Zg(e,t){return Gg(e,n=>n.empty?e.moveByGroup(n,t):Kg(n,t))}var Qg=e=>Zg(e,!Jg(e)),$g=e=>Zg(e,Jg(e));typeof Intl<`u`&&Intl.Segmenter;function e_(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 t_(e,t,n){let r=ah(e).resolveInner(t.head),i=n?L.closedBy:L.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;e_(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?qh(e,r.from,1):qh(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,N.cursor(s,n?-1:1)}var n_=e=>Gg(e,t=>t_(e.state,t,!Jg(e))),r_=e=>Gg(e,t=>t_(e.state,t,Jg(e)));function i_(e,t){return Gg(e,n=>{if(!n.empty)return Kg(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var a_=e=>i_(e,!1),o_=e=>i_(e,!0);function s_(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(I.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 c_(e,t){let n=s_(e),{state:r}=e,i=Ug(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):Kg(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=I.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(Wg(r,i),{effects:a}),!0}var l_=e=>c_(e,!1),u_=e=>c_(e,!0);function d_(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=N.cursor(r.from+n))}return i}var f_=e=>Gg(e,t=>d_(e,t,!0)),p_=e=>Gg(e,t=>d_(e,t,!1)),m_=e=>Gg(e,t=>d_(e,t,!Jg(e))),h_=e=>Gg(e,t=>d_(e,t,Jg(e))),g_=e=>Gg(e,t=>N.cursor(e.lineBlockAt(t.head).from,1)),__=e=>Gg(e,t=>N.cursor(e.lineBlockAt(t.head).to,-1));function v_(e,t,n){let r=!1,i=Ug(e.selection,t=>{let i=qh(e,t.head,-1)||qh(e,t.head,1)||t.head>0&&qh(e,t.head-1,1)||t.head<e.doc.length&&qh(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?N.range(t.anchor,a):N.cursor(a)});return r?(t(Wg(e,i)),!0):!1}var y_=({state:e,dispatch:t})=>v_(e,t,!1);function b_(e,t){let n=Ug(e.state.selection,e=>{let n=t(e);return N.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Wg(e.state,n)),!0)}function x_(e,t){return b_(e,n=>e.moveByChar(n,t))}var S_=e=>x_(e,!Jg(e)),C_=e=>x_(e,Jg(e));function w_(e,t){return b_(e,n=>e.moveByGroup(n,t))}var T_=e=>w_(e,!Jg(e)),E_=e=>w_(e,Jg(e)),D_=e=>b_(e,t=>t_(e.state,t,!Jg(e))),O_=e=>b_(e,t=>t_(e.state,t,Jg(e)));function k_(e,t){return b_(e,n=>e.moveVertically(n,t))}var A_=e=>k_(e,!1),j_=e=>k_(e,!0);function M_(e,t){return b_(e,n=>e.moveVertically(n,t,s_(e).height))}var N_=e=>M_(e,!1),P_=e=>M_(e,!0),F_=e=>b_(e,t=>d_(e,t,!0)),I_=e=>b_(e,t=>d_(e,t,!1)),L_=e=>b_(e,t=>d_(e,t,!Jg(e))),R_=e=>b_(e,t=>d_(e,t,Jg(e))),z_=e=>b_(e,t=>N.cursor(e.lineBlockAt(t.head).from)),B_=e=>b_(e,t=>N.cursor(e.lineBlockAt(t.head).to)),V_=({state:e,dispatch:t})=>(t(Wg(e,{anchor:0})),!0),H_=({state:e,dispatch:t})=>(t(Wg(e,{anchor:e.doc.length})),!0),U_=({state:e,dispatch:t})=>(t(Wg(e,{anchor:e.selection.main.anchor,head:0})),!0),W_=({state:e,dispatch:t})=>(t(Wg(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),G_=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),K_=({state:e,dispatch:t})=>{let n=dv(e).map(({from:t,to:n})=>N.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:N.create(n),userEvent:`select`})),!0},q_=({state:e,dispatch:t})=>{let n=Ug(e.selection,t=>{let n=ah(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 N.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(Wg(e,n)),!0)};function J_(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}else if(r.head==n.head)break;else n=r}}return i.length==r.ranges.length?!1:(e.dispatch(Wg(n,N.create(i,i.length-1))),!0)}var Y_=e=>J_(e,!1),X_=e=>J_(e,!0),Z_=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=N.create([n.main]):n.main.empty||(r=N.create([N.cursor(n.main.head)])),r?(t(Wg(e,r)),!0):!1};function Q_(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=$_(e,o,!1)):o>i&&(n=`delete.forward`,o=$_(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=$_(e,i,!1),a=$_(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:N.cursor(i,i<r.head?-1:1)}});return i.changes.empty?!1:(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?I.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function $_(e,t,n){if(e instanceof I)for(let r of e.state.facet(I.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var ev=(e,t,n)=>Q_(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=Ro(s,a.tabSize)%vh(a)||vh(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=ua(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=ua(o.text,c-o.from,!1,!1)+o.from);return c}),tv=e=>ev(e,!1,!0),nv=e=>ev(e,!0,!1),rv=(e,t)=>Q_(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=ua(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}),iv=e=>rv(e,!1),av=e=>rv(e,!0),ov=e=>Q_(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),sv=e=>Q_(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),cv=e=>Q_(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),lv=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:$i.of([``,``])},range:N.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},uv=({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:ua(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:ua(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:N.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function dv(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 fv(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of dv(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(N.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(N.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:N.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var pv=({state:e,dispatch:t})=>fv(e,t,!1),mv=({state:e,dispatch:t})=>fv(e,t,!0);function hv(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of dv(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 gv=({state:e,dispatch:t})=>hv(e,t,!1),_v=({state:e,dispatch:t})=>hv(e,t,!0),vv=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(dv(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Ug(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 yv(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=ah(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(L.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 bv=Sv(!1),xv=Sv(!0);function Sv(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&&yv(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new xh(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=bh(s,r);for(c??=Ro(/^\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=[``,yh(t,c)];return o&&l.push(yh(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:$i.of(l)},range:N.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function Cv(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:N.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var wv=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new xh(e,{overrideIndentation:e=>n[e]??-1}),i=Cv(e,(t,i,a)=>{let o=bh(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=yh(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},Tv=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Cv(e,(t,n)=>{n.push({from:t.from,insert:e.facet(_h)})}),{userEvent:`input.indent`})),!0),Ev=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Cv(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=Ro(r,e.tabSize),a=0,o=yh(e,Math.max(0,i-vh(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),Dv=e=>(e.setTabFocusMode(),!0),Ov=[{key:`Ctrl-b`,run:Yg,shift:S_,preventDefault:!0},{key:`Ctrl-f`,run:Xg,shift:C_},{key:`Ctrl-p`,run:a_,shift:A_},{key:`Ctrl-n`,run:o_,shift:j_},{key:`Ctrl-a`,run:g_,shift:z_},{key:`Ctrl-e`,run:__,shift:B_},{key:`Ctrl-d`,run:nv},{key:`Ctrl-h`,run:tv},{key:`Ctrl-k`,run:ov},{key:`Ctrl-Alt-h`,run:iv},{key:`Ctrl-o`,run:lv},{key:`Ctrl-t`,run:uv},{key:`Ctrl-v`,run:u_}],kv=[{key:`ArrowLeft`,run:Yg,shift:S_,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Qg,shift:T_,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:m_,shift:L_,preventDefault:!0},{key:`ArrowRight`,run:Xg,shift:C_,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:$g,shift:E_,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:h_,shift:R_,preventDefault:!0},{key:`ArrowUp`,run:a_,shift:A_,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:V_,shift:U_},{mac:`Ctrl-ArrowUp`,run:l_,shift:N_},{key:`ArrowDown`,run:o_,shift:j_,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:H_,shift:W_},{mac:`Ctrl-ArrowDown`,run:u_,shift:P_},{key:`PageUp`,run:l_,shift:N_},{key:`PageDown`,run:u_,shift:P_},{key:`Home`,run:p_,shift:I_,preventDefault:!0},{key:`Mod-Home`,run:V_,shift:U_},{key:`End`,run:f_,shift:F_,preventDefault:!0},{key:`Mod-End`,run:H_,shift:W_},{key:`Enter`,run:bv,shift:bv},{key:`Mod-a`,run:G_},{key:`Backspace`,run:tv,shift:tv,preventDefault:!0},{key:`Delete`,run:nv,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:iv,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:av,preventDefault:!0},{mac:`Mod-Backspace`,run:sv,preventDefault:!0},{mac:`Mod-Delete`,run:cv,preventDefault:!0}].concat(Ov.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Av=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:n_,shift:D_},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:r_,shift:O_},{key:`Alt-ArrowUp`,run:pv},{key:`Shift-Alt-ArrowUp`,run:gv},{key:`Alt-ArrowDown`,run:mv},{key:`Shift-Alt-ArrowDown`,run:_v},{key:`Mod-Alt-ArrowUp`,run:Y_},{key:`Mod-Alt-ArrowDown`,run:X_},{key:`Escape`,run:Z_},{key:`Mod-Enter`,run:xv},{key:`Alt-l`,mac:`Ctrl-l`,run:K_},{key:`Mod-i`,run:q_,preventDefault:!0},{key:`Mod-[`,run:Ev},{key:`Mod-]`,run:Tv},{key:`Mod-Alt-\\`,run:wv},{key:`Shift-Mod-k`,run:vv},{key:`Shift-Mod-\\`,run:y_},{key:`Mod-/`,run:sg},{key:`Alt-A`,run:ug},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Dv}].concat(kv),jv=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},Mv=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(qv).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new Do,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=ay(s);if(i)o.add(n,n,Ss.widget({widget:new Qv(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,Ss.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,Nv(f))}};function Nv(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new jv(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new jv(r.from,n,r.diagnostic)}),r}function Pv(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(qv).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Lv))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function Fv(e,t){return e.field(Bv,!1)?t:t.concat(no.appendConfig.of(gy))}function Iv(e,t){return{effects:Fv(e,[Lv.of(t)])}}var Lv=no.define(),Rv=no.define(),zv=no.define(),Bv=Fa.define({create(){return new Mv(Ss.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=Nv(n,e.selected.diagnostic,i)||Nv(n,null,i)}!n.size&&i&&t.state.facet(qv).autoPanel&&(i=null),e=new Mv(n,i,r)}for(let n of t.effects)if(n.is(Lv)){let r=t.state.facet(qv).autoPanel?n.value.length?ey.open:null:e.panel;e=Mv.init(n.value,r,t.state)}else n.is(Rv)?e=new Mv(e.diagnostics,n.value?ey.open:null,e.selected):n.is(zv)&&(e=new Mv(e.diagnostics,e.panel,n.value));return e},provide:e=>[Gf.from(e,e=>e.panel),I.decorations.from(e,e=>e.diagnostics)]}),Vv=Ss.mark({class:`cm-lintRange cm-lintRange-active`});function Hv(e,t,n){let{diagnostics:r}=e.state.field(Bv),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(qv).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:Uv(e,i)}}}:null}function Uv(e,t){return es(`ul`,{class:`cm-tooltip-lint`},t.map(t=>Zv(e,t,!1)))}var Wv=e=>{let t=e.state.field(Bv,!1);return!t||!t.panel?!1:(e.dispatch({effects:Rv.of(!1)}),!0)},Gv=Wc.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(qv);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(qv);t.length&&Kv(t.map(e=>Promise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(Iv(this.view.state,t.reduce((e,t)=>e.concat(t))))},e=>{Bc(this.view.state,e)})}}update(e){let t=e.state.facet(qv);(e.docChanged||t!=e.startState.facet(qv)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function Kv(e,t,n){let r=[],i=-1;for(let a of e)a.then(n=>{r.push(n),clearTimeout(i),r.length==e.length?t(r):i=setTimeout(()=>t(r),200)},n)}var qv=P.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...yo(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Jv,tooltipFilter:Jv,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function Jv(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Yv(e,t={}){return[qv.of({source:e,config:t}),Gv,gy]}function Xv(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function Zv(e,t,n){let r=n?Xv(t.actions):[];return es(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},es(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=Nv(e.state.field(Bv).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),es(`u`,s.slice(c,c+1)),s.slice(c+1)];return es(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&es(`div`,{class:`cm-diagnosticSource`},t.source))}var Qv=class extends bs{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return es(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},$v=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=Zv(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},ey=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)Wv(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=Xv(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Nv(this.view.state.field(Bv).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=es(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=es(`div`,{class:`cm-panel-lint`},this.list,es(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>Wv(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(Bv).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Bv),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new $v(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new $v(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Nv(this.view.state.field(Bv).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:zv.of(t)})}static open(t){return new e(t)}};function ty(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function ny(e){return ty(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var ry=I.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:ny(`#f11`)},".cm-lintRange-warning":{backgroundImage:ny(`orange`)},".cm-lintRange-info":{backgroundImage:ny(`#999`)},".cm-lintRange-hint":{backgroundImage:ny(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function iy(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function ay(e){let t=`hint`,n=1;for(let r of e){let e=iy(r.severity);e>n&&(n=e,t=r.severity)}return t}var oy=class extends Kf{constructor(e){super(),this.diagnostics=e,this.severity=ay(e)}toDOM(e){let t=document.createElement(`div`);t.className=`cm-lint-marker cm-lint-marker-`+this.severity;let n=this.diagnostics,r=e.state.facet(_y).tooltipFilter;return r&&(n=r(n,e.state)),n.length&&(t.onmouseover=()=>cy(e,t,n)),t}};function sy(e,t){let n=r=>{let i=t.getBoundingClientRect();if(!(r.clientX>i.left-10&&r.clientX<i.right+10&&r.clientY>i.top-10&&r.clientY<i.bottom+10)){for(let e=r.target;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains(`cm-tooltip-lint`))return;window.removeEventListener(`mousemove`,n),e.state.field(py)&&e.dispatch({effects:fy.of(null)})}};window.addEventListener(`mousemove`,n)}function cy(e,t,n){function r(){let r=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(r.from)&&e.dispatch({effects:fy.of({pos:r.from,above:!1,clip:!1,create(){return{dom:Uv(e,n),getCoords:()=>t.getBoundingClientRect()}}})}),t.onmouseout=t.onmousemove=null,sy(e,t)}let{hoverTime:i}=e.state.facet(_y),a=setTimeout(r,i);t.onmouseout=()=>{clearTimeout(a),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(a),a=setTimeout(r,i)}}function ly(e,t){let n=Object.create(null);for(let r of t){let t=e.lineAt(r.from);(n[t.from]||(n[t.from]=[])).push(r)}let r=[];for(let e in n)r.push(new oy(n[e]).range(+e));return To.of(r,!0)}var uy=Zf({class:`cm-gutter-lint`,markers:e=>e.state.field(dy),widgetMarker:(e,t,n)=>{let r=[];return e.state.field(dy).between(n.from,n.to,(e,t,i)=>{e>n.from&&e<n.to&&r.push(...i.diagnostics)}),r.length?new oy(r):null}}),dy=Fa.define({create(){return To.empty},update(e,t){e=e.map(t.changes);let n=t.state.facet(_y).markerFilter;for(let r of t.effects)if(r.is(Lv)){let i=r.value;n&&(i=n(i||[],t.state)),e=ly(t.state.doc,i.slice(0))}return e}}),fy=no.define(),py=Fa.define({create(){return null},update(e,t){return e&&t.docChanged&&(e=Pv(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(fy)?t.value:e,e)},provide:e=>kf.from(e)}),my=I.baseTheme({".cm-gutter-lint":{width:`1.4em`,"& .cm-gutterElement":{padding:`.2em`}},".cm-lint-marker":{width:`1em`,height:`1em`},".cm-lint-marker-info":{content:ty(`<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>`)},".cm-lint-marker-warning":{content:ty(`<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>`)},".cm-lint-marker-error":{content:ty(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`)}}),hy=Rf(Hv,{hideOn:Pv}),gy=[Bv,I.decorations.compute([Bv],e=>{let{selected:t,panel:n}=e.field(Bv);return!t||!n||t.from==t.to?Ss.none:Ss.set([Vv.range(t.from,t.to)])}),hy,ry],_y=P.define({combine(e){return yo(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function vy(e={}){return[_y.of(e),dy,uy,my,py]}function yy({value:e,onChange:t,placeholder:n,disabled:r=!1,readonly:i=!1,showLineNumbers:a=!0,highlightColors:o,onViewReady:s,onCursorChange:c,onBlur:l,onFocus:f}){let p=(0,u.useRef)(null),m=(0,u.useRef)(null),h=(0,u.useRef)(t),g=(0,u.useRef)(c),_=(0,u.useRef)(l),v=(0,u.useRef)(f),y=(0,u.useRef)(s),b=(0,u.useRef)(new Ba),x=(0,u.useRef)(new Ba),S=(0,d.useTheme)(),C=S.palette.mode===`dark`,w=o?.propertyName??S.palette.primary.main,T=o?.string??S.palette.success.main,E=o?.number??S.palette.warning.main,ee=o?.boolean??S.palette.info.main,te=o?.null??S.palette.text.secondary;return(0,u.useEffect)(()=>{h.current=t},[t]),(0,u.useEffect)(()=>{g.current=c},[c]),(0,u.useEffect)(()=>{_.current=l},[l]),(0,u.useEffect)(()=>{v.current=f},[f]),(0,u.useEffect)(()=>{y.current=s},[s]),(0,u.useEffect)(()=>{if(!p.current)return;let t=m.current?.state.doc.toString()??e??``,o=Fh.define([{tag:z.propertyName,color:w,fontWeight:`bold`},{tag:z.string,color:T},{tag:z.number,color:E},{tag:z.bool,color:ee,fontWeight:`bold`},{tag:z.null,color:te,fontStyle:`italic`},{tag:z.bracket,color:S.palette.text.secondary},{tag:z.punctuation,color:S.palette.text.disabled},{tag:z.invalid,color:S.palette.error.main,textDecoration:`underline wavy`}]),s=[I.theme({"&":{height:`100%`,fontFamily:`'Fira Code', 'JetBrains Mono', 'Consolas', monospace`,fontSize:`0.875rem`},".cm-scroller":{overflow:`auto`},".cm-content":{padding:`8px 4px`,caretColor:S.palette.text.primary},".cm-gutters":{backgroundColor:C?S.palette.grey[900]:S.palette.grey[50],color:S.palette.text.disabled,border:`none`,borderRight:`1px solid ${S.palette.divider}`},".cm-lineNumbers .cm-gutterElement":{minWidth:`36px`,paddingLeft:`4px`},".cm-activeLineGutter":{backgroundColor:S.palette.action.selected},".cm-activeLine":{backgroundColor:S.palette.action.hover},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{backgroundColor:S.palette.primary.main+`40`},".cm-cursor, .cm-dropCursor":{borderLeftColor:S.palette.text.primary},"&.cm-focused":{outline:`none`},".cm-placeholder":{color:S.palette.text.disabled,fontStyle:`italic`},".cm-gutter-lint":{width:`16px`},".cm-lint-marker-error":{color:S.palette.error.main},".cm-lint-marker-warning":{color:S.palette.warning.main},".cm-tooltip.cm-tooltip-lint":{backgroundColor:S.palette.background.paper,border:`1px solid ${S.palette.divider}`,borderRadius:`4px`},".cm-diagnostic-error":{borderLeft:`3px solid ${S.palette.error.main}`},".cm-diagnostic-warning":{borderLeft:`3px solid ${S.palette.warning.main}`}},{dark:C}),zh(o),og(),vy(),Yv(rg()),Cg(),sf.of([...Av,...Hg]),b.current.of(I.editable.of(!r&&!i)),x.current.of(vo.readOnly.of(i)),hf(),...a?[pp(),_p()]:[],...n?[yf(n)]:[],I.updateListener.of(e=>{e.docChanged&&h.current?.(e.state.doc.toString());let t=e.state.selection.main.head,n=e.state.doc.lineAt(t);g.current(n.number,t-n.from+1)}),I.domEventHandlers({blur:()=>{_.current?.()},focus:()=>{v.current?.()}})],c=new I({state:vo.create({doc:t,extensions:s}),parent:p.current});return m.current=c,y.current(c),()=>{y.current(null),c.destroy(),m.current=null}},[C,w,T,E,ee,te]),(0,u.useEffect)(()=>{let t=m.current;if(!t)return;let n=t.state.doc.toString();n!==(e??``)&&t.dispatch({changes:{from:0,to:n.length,insert:e??``}})},[e]),(0,u.useEffect)(()=>{m.current?.dispatch({effects:[b.current.reconfigure(I.editable.of(!r&&!i)),x.current.reconfigure(vo.readOnly.of(i))]})},[r,i]),(0,A.jsx)(d.Box,{ref:p,sx:{flex:1,overflow:`hidden`,display:`flex`,flexDirection:`column`,opacity:r?.5:1,backgroundColor:S.palette.background.paper,"& .cm-editor":{flex:1,display:`flex`,flexDirection:`column`}}})}var by=M((0,A.jsx)(`path`,{d:`M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z`}),`ContentCopy`),xy=M((0,A.jsx)(`path`,{d:`M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`}),`Check`),Sy=M((0,A.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z`}),`Delete`),Cy=M((0,A.jsx)(`path`,{d:`M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8`}),`Undo`),wy=M((0,A.jsx)(`path`,{d:`M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z`}),`Redo`),Ty=M((0,A.jsx)(`path`,{d:`M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z`}),`AutoFixHigh`),Ey=M((0,A.jsx)(`path`,{d:`M8 19h3v3h2v-3h3l-4-4zm8-15h-3V1h-2v3H8l4 4zM4 9v2h16V9zm0 3h16v2H4z`}),`Compress`);function Dy({label:e,icon:t,onClick:n,disabled:r}){return(0,A.jsx)(d.Tooltip,{title:e,arrow:!0,children:(0,A.jsx)(`span`,{children:(0,A.jsx)(d.IconButton,{size:`small`,onClick:n,disabled:r,color:`default`,sx:{borderRadius:1},"aria-label":e,children:t})})})}function Oy({viewRef:e,toolbarConfig:t,translation:n,indent:r,disabled:i}){let[a,o]=(0,u.useState)(!1),s=i||!e.current;function c(){let t=e.current;if(!t)return;let n=t.state.doc.toString();try{let e=JSON.stringify(JSON.parse(n),null,r);t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})}catch{}t.focus()}function l(){let t=e.current;if(!t)return;let n=t.state.doc.toString();try{let e=JSON.stringify(JSON.parse(n));t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})}catch{}t.focus()}function f(){let t=e.current?.state.doc.toString()??``;navigator.clipboard.writeText(t).then(()=>{o(!0),setTimeout(()=>o(!1),2e3)})}function p(){let t=e.current;t&&(t.dispatch({changes:{from:0,to:t.state.doc.length,insert:``}}),t.focus())}function m(){let t=e.current;t&&(Tg(t),t.focus())}function h(){let t=e.current;t&&(Eg(t),t.focus())}let g=t.showFormat||t.showCompact,_=t.showCopy||t.showClear,v=t.showUndoRedo;return(0,A.jsxs)(d.Box,{sx:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:.25,px:1,py:.5},role:`toolbar`,"aria-label":`JSON editor actions`,children:[g&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[t.showFormat&&(0,A.jsx)(Dy,{label:n.format,icon:(0,A.jsx)(Ty,{fontSize:`small`}),onClick:c,disabled:s}),t.showCompact&&(0,A.jsx)(Dy,{label:n.compact,icon:(0,A.jsx)(Ey,{fontSize:`small`}),onClick:l,disabled:s})]}),g&&(_||v)&&(0,A.jsx)(d.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}}),_&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[t.showCopy&&(0,A.jsx)(Dy,{label:a?n.copySuccess:n.copy,icon:a?(0,A.jsx)(xy,{fontSize:`small`,color:`success`}):(0,A.jsx)(by,{fontSize:`small`}),onClick:f,disabled:s}),t.showClear&&(0,A.jsx)(Dy,{label:n.clear,icon:(0,A.jsx)(Sy,{fontSize:`small`}),onClick:p,disabled:s})]}),_&&v&&(0,A.jsx)(d.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}}),v&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[(0,A.jsx)(Dy,{label:n.undo,icon:(0,A.jsx)(Cy,{fontSize:`small`}),onClick:m,disabled:s}),(0,A.jsx)(Dy,{label:n.redo,icon:(0,A.jsx)(wy,{fontSize:`small`}),onClick:h,disabled:s})]}),!g&&!_&&!v&&(0,A.jsx)(d.Box,{sx:{height:32}})]})}function ky({helperText:e,error:t,showLineColumn:n,showValidation:r,isValid:i,cursorLine:a,cursorCol:o,translation:s}){let c=s.lineColumn.replace(`{line}`,String(a)).replace(`{col}`,String(o));return(0,A.jsxs)(d.Box,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,mt:.5,px:.5},children:[(0,A.jsxs)(d.Box,{children:[r&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[i?(0,A.jsx)(ji,{sx:{fontSize:`0.875rem`,color:`success.main`},"data-testid":`json-valid-icon`}):(0,A.jsx)(Ai,{sx:{fontSize:`0.875rem`,color:`error.main`},"data-testid":`json-invalid-icon`}),(0,A.jsx)(d.FormHelperText,{sx:{color:i?`success.main`:`error.main`,m:0},children:i?s.validJson:s.invalidJson})]}),(0,A.jsx)(d.FormHelperText,{error:t,children:e??``})]}),n&&(0,A.jsx)(d.FormHelperText,{sx:{color:`text.disabled`,fontFamily:`monospace`,whiteSpace:`nowrap`},children:c})]})}function Ay(e){if(!(e===``||e===void 0))return typeof e==`string`&&e!==`auto`&&!isNaN(Number(e))?Number(e):e}function jy(e){if(!e.trim())return!1;try{return JSON.parse(e),!0}catch{return!1}}function My({value:e,onChange:t,onValidChange:n,placeholder:r,height:i,width:a,disabled:o=!1,readonly:s=!1,error:c=!1,helperText:l,name:f,indent:p=2,showLineNumbers:m=!0,showLineColumn:h=!0,showValidation:g=!1,toolbarConfig:_,translation:v,highlightColors:y,onBlur:b,onFocus:x}){let S={...Bi,...v},C={...zi,..._},w=Ay(i),T=Ay(a),E=w===`auto`,ee=E?void 0:w??300,te=(0,u.useRef)(null),[ne,D]=(0,u.useState)({line:1,col:1}),[re,O]=(0,u.useState)(()=>jy(e??``)),ie=(0,u.useCallback)(e=>{te.current=e},[]),ae=(0,u.useCallback)((e,t)=>{D({line:e,col:t})},[]),oe=(0,u.useCallback)(e=>{let r=jy(e);O(r),n?.(r),t?.(e)},[t,n]),se=h||g||!!l;return(0,A.jsxs)(d.Box,{sx:{width:T??`100%`,...E?{display:`flex`,flexDirection:`column`,flex:1}:{}},children:[(0,A.jsxs)(d.Paper,{variant:`outlined`,sx:{display:`flex`,flexDirection:`column`,overflow:`hidden`,...E?{flex:1}:{height:ee},borderColor:c?`error.main`:void 0,"&:focus-within":{borderColor:c?`error.main`:`primary.main`,borderWidth:2}},children:[!s&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Oy,{viewRef:te,toolbarConfig:C,translation:S,indent:p,disabled:o}),(0,A.jsx)(d.Divider,{})]}),(0,A.jsx)(yy,{value:e,onChange:oe,placeholder:r,disabled:o,readonly:s,showLineNumbers:m,highlightColors:y,onViewReady:ie,onCursorChange:ae,onBlur:b,onFocus:x})]}),se&&(0,A.jsx)(ky,{helperText:l,error:c,showLineColumn:h,showValidation:g,isValid:re,cursorLine:ne.line,cursorCol:ne.col,translation:S}),f&&(0,A.jsx)(`input`,{type:`hidden`,name:f,value:e??``})]})}var Ny=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Py=(e=>e?Ny(e):Ny),Fy=e=>e;function Iy(e,t=Fy){let n=u.default.useSyncExternalStore(e.subscribe,u.default.useCallback(()=>t(e.getState()),[e,t]),u.default.useCallback(()=>t(e.getInitialState()),[e,t]));return u.default.useDebugValue(n),n}function Ly(e){let t=new Date,n=$y(t),r=eb(t);if(e.length===0)return{start:n,end:r};let i=e.map(e=>e.startDate.getTime()),a=e.map(e=>e.endDate.getTime()),o=Uy(Gy(new Date(Math.min(...i)),-1)),s=Wy(Gy(new Date(Math.max(...a)),1));return{start:o<n?o:n,end:s>r?s:r}}function Ry(e,t){return t===`weeks`?{start:Yy(e.start),end:e.end}:t===`quarters`?{start:$y(e.start),end:eb(e.end)}:e}function zy(e,t){let n=t.end.getTime()-t.start.getTime();if(n<=0)return{left:0,width:0};let r=(e.startDate.getTime()-t.start.getTime())/n*100,i=(e.endDate.getTime()-e.startDate.getTime())/n*100;return{left:Math.max(0,r),width:Math.max(0,i)}}function By(e){let t=new Map;for(let n of e)t.set(n.id,{...n,children:[],depth:0});let n=[];for(let e of t.values())e.parentId&&t.has(e.parentId)?t.get(e.parentId).children.push(e):n.push(e);return Vy(n,0),n}function Vy(e,t){for(let n of e)n.depth=t,Vy(n.children,t+1)}function Hy(e,t){let n=[];function r(e){for(let i of e)n.push(i),i.children.length>0&&t.has(i.id)&&r(i.children)}return r(e),n}function Uy(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}function Wy(e){return new Date(e.getFullYear(),e.getMonth()+1,0,23,59,59,999)}function Gy(e,t){return new Date(e.getFullYear(),e.getMonth()+t,e.getDate())}function Ky(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+t,0,0,0,0)}function qy(e,t,n){if(n===0)return e;let r=new Map;for(let t of e)for(let e of t.dependencies??[])r.has(e)||r.set(e,[]),r.get(e).push(t.id);let i=new Map(e.map(e=>[e.id,e])),a=[...r.get(t)??[]],o=new Set;for(;a.length>0;){let e=a.shift();if(o.has(e))continue;o.add(e);let t=i.get(e);i.set(e,{...t,startDate:new Date(t.startDate.getTime()+n),endDate:new Date(t.endDate.getTime()+n)}),a.push(...r.get(e)??[])}return e.map(e=>i.get(e.id))}function Jy(e){let t=[],n=Uy(e.start);for(;n<=e.end;)t.push(n),n=Gy(n,1);return t}function Yy(e){let t=new Date(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t.setHours(0,0,0,0),t}function Xy(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())),n=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-n);let r=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-r.getTime())/864e5+1)/7)}function Zy(e){let t=[],n=Yy(e.start);for(;n<=e.end;)t.push(new Date(n)),n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+7);return t}function Qy(e){let t=[],n=new Date(e.start.getFullYear(),e.start.getMonth(),e.start.getDate(),0,0,0,0),r=new Date(e.end.getFullYear(),e.end.getMonth(),e.end.getDate(),0,0,0,0).getTime();for(;n.getTime()<=r;)t.push(new Date(n)),n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1,0,0,0,0);return t}function $y(e){let t=Math.floor(e.getMonth()/3)*3;return new Date(e.getFullYear(),t,1,0,0,0,0)}function eb(e){let t=Math.floor(e.getMonth()/3)*3+2;return Wy(new Date(e.getFullYear(),t,1))}function tb(e){let t=[],n=$y(e.start);for(;n<=e.end;){let e=Math.floor(n.getMonth()/3)+1;t.push({key:`${n.getFullYear()}-Q${e}`,label:`Q${e} ${n.getFullYear()}`,start:new Date(n)}),n=new Date(n.getFullYear(),n.getMonth()+3,1)}return t}function nb(e){if(e.length===0)return new Set;let t=new Map;for(let n of e)for(let e of n.dependencies??[])t.has(e)||t.set(e,[]),t.get(e).push(n.id);let n=new Map(e.map(e=>[e.id,e])),r=new Map,i=new Set;function a(e){if(r.has(e))return r.get(e);if(i.has(e))return n.get(e)?.endDate.getTime()??0;i.add(e);let o=n.get(e)?.endDate.getTime()??0;for(let n of t.get(e)??[])o=Math.max(o,a(n));return i.delete(e),r.set(e,o),o}for(let t of e)a(t.id);let o=Math.max(...r.values()),s=new Set;for(let t of e)a(t.id)===o&&s.add(t.id);return s}function rb(e,t){let n=t.startDate<e.start?Uy(Gy(t.startDate,-1)):e.start,r=t.endDate>e.end?Wy(Gy(t.endDate,1)):e.end;return n===e.start&&r===e.end?e:{start:n,end:r}}function ib(e,t=`months`,n=!1,r,i=!1){let a=Ly(e);return Py((o,s)=>({tasks:e,taskTree:By(e),expandedIds:n?new Set(e.map(e=>e.id)):new Set(e.filter(e=>!e.parentId).map(e=>e.id)),timeScale:t,timelineRange:r??a,isRangeCustomized:r!==void 0,cascadeDependencies:i,defaultTimeScale:t,initialExpandAll:n,isExpandedCustomized:!1,setTasks:e=>{o(t=>({tasks:e,taskTree:By(e),...t.isRangeCustomized?{}:{timelineRange:Ly(e)}}))},addTask:e=>{o(t=>{let n=[...t.tasks,e];return{tasks:n,taskTree:By(n),timelineRange:rb(t.timelineRange,e)}})},updateTask:e=>{o(t=>{let n=t.tasks.find(t=>t.id===e.id),r=t.tasks.map(t=>t.id===e.id?e:t);if(t.cascadeDependencies&&n){let t=e.endDate.getTime()-n.endDate.getTime();r=qy(r,e.id,t)}let i=rb(t.timelineRange,e);for(let e of r)i=rb(i,e);return{tasks:r,taskTree:By(r),timelineRange:i}})},deleteTask:e=>{o(t=>{let n=new Set,r=e=>{n.add(e),t.tasks.filter(t=>t.parentId===e).forEach(e=>r(e.id))};r(e);let i=t.tasks.filter(e=>!n.has(e.id));return{tasks:i,taskTree:By(i)}})},toggleExpand:e=>{o(t=>{let n=new Set(t.expandedIds);return n.has(e)?n.delete(e):n.add(e),{expandedIds:n}})},expandAll:()=>{o(e=>({expandedIds:new Set(e.tasks.map(e=>e.id)),isExpandedCustomized:!0}))},collapseAll:()=>{o({expandedIds:new Set,isExpandedCustomized:!0})},setTimeScale:e=>{o({timeScale:e})},setTimelineRange:e=>{o({timelineRange:e,isRangeCustomized:!0})},resetTimelineRange:()=>{o(e=>({timelineRange:Ly(e.tasks),isRangeCustomized:!1}))},resetView:()=>{o(e=>({timeScale:e.defaultTimeScale,timelineRange:Ly(e.tasks),isRangeCustomized:!1,isExpandedCustomized:!1,expandedIds:e.initialExpandAll?new Set(e.tasks.map(e=>e.id)):new Set(e.tasks.filter(e=>!e.parentId).map(e=>e.id))}))},getVisibleTasks:()=>{let{taskTree:e,expandedIds:t}=s();return Hy(e,t)}}))}var ab={scaleDays:`Tage`,scaleWeeks:`Wochen`,scaleMonths:`Monate`,scaleQuarters:`Quartale`,rangeFrom:`Von`,rangeTo:`Bis`,rangeResetTooltip:`Bereich zurücksetzen`,columnName:`Name`,columnStatus:`Status`,statusPlanned:`Planned`,statusInProgress:`In Progress`,statusDone:`Done`,statusBlocked:`Blocked`,weekColumnPrefix:`KW`,dateLocale:`de-DE`,dialogAddTitle:`Aufgabe hinzufügen`,dialogEditTitle:`Aufgabe bearbeiten`,dialogDeleteTitle:`Aufgabe löschen`,dialogSave:`Speichern`,dialogCancel:`Abbrechen`,dialogDelete:`Löschen`,dialogFieldName:`Name`,dialogFieldStartDate:`Startdatum`,dialogFieldEndDate:`Enddatum`,dialogFieldStatus:`Status`,dialogFieldMilestone:`Ist Meilenstein`,dialogFieldParent:`Übergeordnete Aufgabe`,dialogFieldParentNone:`— Keine —`,dialogDeleteConfirm:`Soll die Aufgabe "{name}" wirklich gelöscht werden?`,dialogFieldDependencies:`Vorgänger`,dialogFieldDependenciesNone:`— Keine —`,scrollToTodayTooltip:`Zum heutigen Tag`,expandAllTooltip:`Alle aufklappen`,collapseAllTooltip:`Alle zuklappen`,resetViewTooltip:`Ansicht zurücksetzen`,columnActions:`Aktionen`,addTaskTooltip:`Aufgabe hinzufügen`,editTaskTooltip:`Aufgabe bearbeiten`,deleteTaskTooltip:`Aufgabe löschen`};function ob(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o;n.key&&n.debug?.call(n)&&(o=Date.now());let s=e();if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug?.call(n)&&(c=Date.now()),i=t(...s),n.key&&n.debug?.call(n)){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
44
|
-
font-size: .6rem;
|
|
45
|
-
font-weight: bold;
|
|
46
|
-
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i}return o.updateDeps=e=>{r=e},o}function sb(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var cb=(e,t)=>Math.abs(e-t)<1.01,lb=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},ub=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},db=e=>e,fb=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},pb=(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(ub(n)),!r.ResizeObserver)return()=>{};let a=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(ub(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},mb={passive:!0},hb=typeof window>`u`?!0:`onscrollend`in window,gb=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&hb?()=>void 0:lb(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),o=r=>()=>{let{horizontal:o,isRtl:s}=e.options;i=o?n.scrollLeft*(s&&-1||1):n.scrollTop,a(),t(i,r)},s=o(!0),c=o(!1);n.addEventListener(`scroll`,s,mb);let l=e.options.useScrollendEvent&&hb;return l&&n.addEventListener(`scrollend`,c,mb),()=>{n.removeEventListener(`scroll`,s),l&&n.removeEventListener(`scrollend`,c)}},_b=(e,t,n)=>{if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},vb=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;let o=e+t;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:o,behavior:n})},yb=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{n===void 0&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:db,rangeExtractor:fb,onChange:()=>{},measureElement:_b,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,...e}},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=ob(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:process.env.NODE_ENV!==`production`&&`maybeNotify`,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{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,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.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=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)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},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.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=ob(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=ob(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},s)=>{if(!i)return this.measurementsCache=[],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.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let l=this.measurementsCache.slice(0,c),u=Array(a).fill(void 0);for(let e=0;e<c;e++){let t=l[e];t&&(u[t.lane]=e)}for(let i=c;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),c,d,f=o===`estimate`||s.has(e);if(a!==void 0&&this.options.lanes>1){c=a;let e=u[c],r=e===void 0?void 0:l[e];d=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?l[i-1]:this.getFurthestMeasurement(l,i);d=e?e.end+this.options.gap:t+n,c=e?e.lane:i%this.options.lanes,this.options.lanes>1&&f&&this.laneAssignments.set(i,c)}let p=s.get(e),m=typeof p==`number`?p:this.options.estimateSize(i),h=d+m;l[i]={index:i,start:d,size:m,end:h,key:e,lane:c},u[c]=i}return this.measurementsCache=l,l},{key:process.env.NODE_ENV!==`production`&&`getMeasurements`,debug:()=>this.options.debug}),this.calculateRange=ob(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?xb({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:process.env.NODE_ENV!==`production`&&`calculateRange`,debug:()=>this.options.debug}),this.getVirtualIndexes=ob(()=>{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]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:process.env.NODE_ENV!==`production`&&`getVirtualIndexes`,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(!this.scrollState||this.scrollState.behavior!==`smooth`)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),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)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{let n=this.measurementsCache[e];if(!n)return;let r=t-(this.itemSizeCache.get(n.key)??n.size);r!==0&&(this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?n.start<this.getScrollOffset()+this.scrollAdjustments:this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this))&&(process.env.NODE_ENV!==`production`&&this.options.debug&&console.info(`correction`,r),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))},this.getVirtualItems=ob(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:process.env.NODE_ENV!==`production`&&`getVirtualItems`,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length!==0)return sb(t[bb(0,t.length-1,e=>sb(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},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)return[this.getMaxScrollOffset(),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`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},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,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=e[e.length-1]?.end??0;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._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&cb(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,n&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior=`auto`,this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}));this.scheduleScrollReconcile()}},bb=(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 xb({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){let i=e.length-1,a=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:i};let o=bb(0,i,a,n),s=o;if(r===1)for(;s<i&&e[s].end<n+t;)s++;else if(r>1){let a=Array(r).fill(0);for(;s<i&&a.some(e=>e<n+t);){let t=e[s];a[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(i,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var Sb=typeof document<`u`?u.useLayoutEffect:u.useEffect;function Cb({useFlushSync:e=!0,...t}){let n=u.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,p.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=u.useState(()=>new yb(r));return i.setOptions(r),Sb(()=>i._didMount(),[]),Sb(()=>i._willUpdate()),i}function wb(e){return Cb({observeElementRect:pb,observeElementOffset:gb,scrollToFn:vb,...e})}var Tb=M((0,A.jsx)(`path`,{d:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z`}),`Add`),Eb=M((0,A.jsx)(`path`,{d:`M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z`}),`Edit`);function Db(e){return e.toISOString().slice(0,10)}function Ob(e,t,n){return e<t?t:e>n?n:e}function kb(e){return e.flatMap(e=>[e,...kb(e.children)])}function Ab({label:e}){let t=(0,u.useRef)(null),[n,r]=(0,u.useState)(!1);return(0,A.jsx)(d.Tooltip,{title:e,disableHoverListener:!n,children:(0,A.jsx)(d.Typography,{ref:t,component:`span`,variant:`body2`,noWrap:!0,sx:{display:`block`,overflow:`hidden`,textOverflow:`ellipsis`,minWidth:0},onMouseEnter:()=>{t.current&&r(t.current.scrollWidth>t.current.clientWidth)},children:e})})}function jb({open:e,mode:t,initialTask:n,defaultParentId:r,onSave:i,onClose:a}){let o=tx(),s=B(e=>e.taskTree),c=B(e=>e.timelineRange),l=(0,u.useMemo)(()=>kb(s),[s]),f=(0,u.useMemo)(()=>{if(t===`add`||!n)return new Set;let e=t=>[t.id,...t.children.flatMap(e)],r=l.find(e=>e.id===n.id);return new Set(r?e(r):[n.id])},[t,n,l]),p=l.filter(e=>!f.has(e.id)),m=p,h=Db(Ob(new Date,c.start,c.end)),[g,_]=(0,u.useState)({name:``,startDate:h,endDate:h,status:`planned`,isMilestone:!1,parentId:``,dependencies:[]});(0,u.useEffect)(()=>{if(!e)return;let i=Db(Ob(new Date,c.start,c.end));_(t===`edit`&&n?{name:n.name,startDate:Db(n.startDate),endDate:Db(n.endDate),status:n.status,isMilestone:n.isMilestone??!1,parentId:n.parentId??``,dependencies:n.dependencies??[]}:{name:``,startDate:i,endDate:i,status:`planned`,isMilestone:!1,parentId:r??``,dependencies:[]})},[e,t,n,r,c]);let v=e=>{_(t=>({...t,startDate:e,endDate:t.isMilestone||t.endDate<e?e:t.endDate}))},y=e=>{_(t=>({...t,endDate:e<t.startDate?t.startDate:e}))},b=e=>{_(t=>({...t,isMilestone:e,endDate:e?t.startDate:t.endDate}))},x=g.name.trim()!==``&&g.startDate!==``&&g.endDate!==``&&g.endDate>=g.startDate,S=()=>{x&&i({name:g.name.trim(),startDate:new Date(g.startDate),endDate:new Date(g.endDate),status:g.status,isMilestone:g.isMilestone||void 0,parentId:g.parentId||void 0,dependencies:g.dependencies.length>0?g.dependencies:void 0})},C=[`planned`,`in-progress`,`done`,`blocked`],w={planned:o.statusPlanned,"in-progress":o.statusInProgress,done:o.statusDone,blocked:o.statusBlocked};return(0,A.jsxs)(d.Dialog,{open:e,onClose:a,maxWidth:`xs`,fullWidth:!0,"data-testid":`gantt-task-dialog`,children:[(0,A.jsx)(d.DialogTitle,{children:t===`add`?o.dialogAddTitle:o.dialogEditTitle}),(0,A.jsxs)(d.DialogContent,{sx:{display:`flex`,flexDirection:`column`,gap:2,pt:`16px !important`},children:[(0,A.jsx)(d.TextField,{label:o.dialogFieldName,value:g.name,onChange:e=>_(t=>({...t,name:e.target.value})),required:!0,fullWidth:!0,size:`small`,autoFocus:!0,slotProps:{htmlInput:{"data-testid":`gantt-dialog-field-name`}}}),(0,A.jsx)(d.TextField,{label:o.dialogFieldStartDate,type:`date`,value:g.startDate,onChange:e=>v(e.target.value),required:!0,fullWidth:!0,size:`small`,slotProps:{inputLabel:{shrink:!0},htmlInput:{"data-testid":`gantt-dialog-field-start`}}}),(0,A.jsx)(d.TextField,{label:o.dialogFieldEndDate,type:`date`,value:g.endDate,onChange:e=>y(e.target.value),required:!0,fullWidth:!0,size:`small`,disabled:g.isMilestone,slotProps:{inputLabel:{shrink:!0},htmlInput:{"data-testid":`gantt-dialog-field-end`,min:g.startDate}}}),(0,A.jsxs)(d.FormControl,{size:`small`,fullWidth:!0,children:[(0,A.jsx)(d.InputLabel,{children:o.dialogFieldStatus}),(0,A.jsx)(d.Select,{value:g.status,label:o.dialogFieldStatus,onChange:e=>_(t=>({...t,status:e.target.value})),inputProps:{"data-testid":`gantt-dialog-field-status`},children:C.map(e=>(0,A.jsx)(d.MenuItem,{value:e,children:w[e]},e))})]}),(0,A.jsx)(d.FormControlLabel,{control:(0,A.jsx)(d.Checkbox,{checked:g.isMilestone,onChange:e=>b(e.target.checked),size:`small`,"data-testid":`gantt-dialog-field-milestone`}),label:o.dialogFieldMilestone}),(0,A.jsxs)(d.FormControl,{size:`small`,fullWidth:!0,children:[(0,A.jsx)(d.InputLabel,{children:o.dialogFieldParent}),(0,A.jsxs)(d.Select,{value:g.parentId,label:o.dialogFieldParent,onChange:e=>_(t=>({...t,parentId:e.target.value})),inputProps:{"data-testid":`gantt-dialog-field-parent`},MenuProps:{slotProps:{paper:{sx:{maxHeight:280}}}},children:[(0,A.jsx)(d.MenuItem,{value:``,children:o.dialogFieldParentNone}),p.map(e=>(0,A.jsx)(d.MenuItem,{value:e.id,sx:{minWidth:0},children:(0,A.jsxs)(d.Box,{sx:{display:`flex`,alignItems:`center`,pl:e.depth*2,gap:.75,minWidth:0,width:`100%`,overflow:`hidden`},children:[e.depth>0&&(0,A.jsx)(d.Typography,{component:`span`,variant:`caption`,sx:{color:`text.disabled`,lineHeight:1,flexShrink:0},children:`└`}),(0,A.jsx)(Ab,{label:e.name})]})},e.id))]})]}),(0,A.jsxs)(d.FormControl,{size:`small`,fullWidth:!0,children:[(0,A.jsx)(d.InputLabel,{children:o.dialogFieldDependencies}),(0,A.jsx)(d.Select,{multiple:!0,value:g.dependencies,label:o.dialogFieldDependencies,onChange:e=>{let t=e.target.value;_(e=>({...e,dependencies:typeof t==`string`?t.split(`,`):t}))},inputProps:{"data-testid":`gantt-dialog-field-dependencies`},renderValue:e=>e.length===0?o.dialogFieldDependenciesNone:e.map(e=>l.find(t=>t.id===e)?.name??e).join(`, `),MenuProps:{slotProps:{paper:{sx:{maxHeight:280}}}},children:m.map(e=>(0,A.jsx)(d.MenuItem,{value:e.id,sx:{minWidth:0},children:(0,A.jsxs)(d.Box,{sx:{display:`flex`,alignItems:`center`,pl:e.depth*2,gap:.75,minWidth:0,width:`100%`,overflow:`hidden`},children:[e.depth>0&&(0,A.jsx)(d.Typography,{component:`span`,variant:`caption`,sx:{color:`text.disabled`,lineHeight:1,flexShrink:0},children:`└`}),(0,A.jsx)(Ab,{label:e.name})]})},e.id))})]})]}),(0,A.jsxs)(d.DialogActions,{children:[(0,A.jsx)(d.Button,{onClick:a,children:o.dialogCancel}),(0,A.jsx)(d.Button,{onClick:S,variant:`contained`,disabled:!x,"data-testid":`gantt-dialog-save`,children:o.dialogSave})]})]})}function Mb({open:e,task:t,onConfirm:n,onClose:r}){let i=tx(),a=i.dialogDeleteConfirm.replace(`{name}`,t?.name??``);return(0,A.jsxs)(d.Dialog,{open:e,onClose:r,maxWidth:`xs`,fullWidth:!0,"data-testid":`gantt-delete-dialog`,children:[(0,A.jsx)(d.DialogTitle,{children:i.dialogDeleteTitle}),(0,A.jsx)(d.DialogContent,{children:(0,A.jsx)(d.DialogContentText,{children:a})}),(0,A.jsxs)(d.DialogActions,{children:[(0,A.jsx)(d.Button,{onClick:r,children:i.dialogCancel}),(0,A.jsx)(d.Button,{onClick:n,variant:`contained`,color:`error`,"data-testid":`gantt-dialog-delete-confirm`,children:i.dialogDelete})]})]})}var Nb={planned:`warning.main`,"in-progress":`info.main`,done:`success.main`,blocked:`error.main`},Pb={planned:`warning`,"in-progress":`info`,done:`success`,blocked:`error`};function Fb(e,t){return{planned:t.statusPlanned,"in-progress":t.statusInProgress,done:t.statusDone,blocked:t.statusBlocked}[e]}function Ib({task:e,expandedIds:t,toggleExpand:n,hasActionsColumn:r,onTaskClick:i,onAddTask:a,onEditTask:o,onDeleteTask:s,onStatusChange:c,inlineEdit:l,onInlineRename:f}){let[p,m]=(0,u.useState)(null),[h,g]=(0,u.useState)(null),_=tx(),{statusColors:v}=rx(),y=()=>{h!==null&&h.trim()&&f?.(e,h.trim()),g(null)};return(0,A.jsxs)(d.Box,{className:`gantt-task-row`,"data-testid":`gantt-task-row-${e.id}`,sx:{height:40,display:`flex`,alignItems:`center`,borderBottom:`1px solid`,borderRight:`1px solid`,borderColor:`divider`,cursor:i?`pointer`:`default`,"&:hover":i?{bgcolor:`action.hover`}:void 0},onClick:()=>i?.(e),children:[(0,A.jsxs)(d.Box,{sx:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,gap:.75,pl:1+e.depth*2,pr:.5,height:`100%`},children:[(0,A.jsx)(d.Box,{sx:{width:16,flexShrink:0,display:`flex`,justifyContent:`center`},children:e.children.length>0&&(0,A.jsx)(d.Box,{component:`span`,sx:{fontSize:9,userSelect:`none`,cursor:`pointer`},onClick:t=>{t.stopPropagation(),n(e.id)},children:t.has(e.id)?`▼`:`▶`})}),(0,A.jsx)(d.Box,{sx:{width:8,height:8,borderRadius:e.isMilestone?0:`50%`,transform:e.isMilestone?`rotate(45deg)`:void 0,flexShrink:0,bgcolor:e.color??v?.[e.status]??Nb[e.status]??`grey.400`}}),h===null?(0,A.jsx)(d.Typography,{variant:`body2`,noWrap:!0,sx:{flex:1,minWidth:0,cursor:l?`text`:`inherit`},onDoubleClick:l?t=>{t.stopPropagation(),g(e.name)}:void 0,children:e.name}):(0,A.jsx)(d.TextField,{size:`small`,variant:`standard`,value:h,autoFocus:!0,onChange:e=>g(e.target.value),onBlur:y,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),y()),e.key===`Escape`&&(e.stopPropagation(),g(null))},onClick:e=>e.stopPropagation(),sx:{flex:1,minWidth:0},slotProps:{htmlInput:{"data-testid":`gantt-inline-edit-${e.id}`}}})]}),r&&(0,A.jsxs)(d.Box,{className:`gantt-row-actions`,sx:{width:96,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`flex-end`,pr:.5},children:[o&&(0,A.jsx)(d.Tooltip,{title:_.editTaskTooltip,children:(0,A.jsx)(d.IconButton,{size:`small`,"data-testid":`gantt-edit-task-${e.id}`,onClick:t=>{t.stopPropagation(),o(e)},children:(0,A.jsx)(Eb,{fontSize:`inherit`})})}),a&&(0,A.jsx)(d.Tooltip,{title:_.addTaskTooltip,children:(0,A.jsx)(d.IconButton,{size:`small`,"data-testid":`gantt-add-task-${e.id}`,onClick:t=>{t.stopPropagation(),a(e)},children:(0,A.jsx)(Tb,{fontSize:`inherit`})})}),s&&(0,A.jsx)(d.Tooltip,{title:_.deleteTaskTooltip,children:(0,A.jsx)(d.IconButton,{size:`small`,"data-testid":`gantt-delete-task-${e.id}`,onClick:t=>{t.stopPropagation(),s(e)},children:(0,A.jsx)(Sy,{fontSize:`inherit`})})})]}),(0,A.jsxs)(d.Box,{sx:{width:90,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,A.jsx)(d.Chip,{label:Fb(e.status,_),size:`small`,variant:`outlined`,color:e.color??v?.[e.status]?`default`:Pb[e.status]??`default`,sx:{height:20,fontSize:10,cursor:c?`pointer`:`default`,...(e.color??v?.[e.status])&&{borderColor:e.color??v?.[e.status],color:e.color??v?.[e.status]}},onClick:c?e=>{e.stopPropagation(),m(e.currentTarget)}:void 0}),c&&(0,A.jsx)(d.Menu,{anchorEl:p,open:!!p,onClose:()=>m(null),children:[`planned`,`in-progress`,`done`,`blocked`].map(t=>(0,A.jsx)(d.MenuItem,{selected:e.status===t,onClick:()=>{c(e,t),m(null)},children:Fb(t,_)},t))})]})]})}function Lb({scrollRef:e,onScroll:t,panelWidth:n,onTaskClick:r,onAddTask:i,onEditTask:a,onDeleteTask:o,onStatusChange:s,onTasksChange:c,enableBuiltinDialogs:l,onTaskCreated:f,onTaskUpdated:p,onTaskDeleted:m,inlineEdit:h,virtualizeRows:g=!1}){let _=tx(),v=$b(),y=B(e=>e.taskTree),b=B(e=>e.expandedIds),x=B(e=>e.toggleExpand),S=B(e=>e.timeScale),C=B(e=>e.addTask),w=B(e=>e.updateTask),T=B(e=>e.deleteTask),E=(0,u.useMemo)(()=>Hy(y,b),[y,b]),ee=wb({count:E.length,getScrollElement:()=>e.current,estimateSize:()=>40,overscan:5}),[te,ne]=(0,u.useState)(!1),[D,re]=(0,u.useState)(!1),[O,ie]=(0,u.useState)(!1),[ae,oe]=(0,u.useState)(null),se=e=>{let t={...e,id:crypto.randomUUID()};C(t),c?.(v.getState().tasks),f?.(t),ne(!1)},ce=e=>{if(!ae)return;let t={...e,id:ae.id};w(t),c?.(v.getState().tasks),p?.(t),re(!1)},le=()=>{ae&&(T(ae.id),c?.(v.getState().tasks),m?.(ae.id),ie(!1))},k=(e,t)=>{let n={...e,name:t};w(n),c?.(v.getState().tasks),p?.(n)},ue=l?e=>{oe(e),ne(!0)}:i,de=l?e=>{oe(e),re(!0)}:a,fe=l?e=>{oe(e),ie(!0)}:o,pe=!!(ue||de||fe),me=S===`days`?80:40;return(0,A.jsxs)(d.Box,{ref:e,onScroll:t,sx:{width:n,flexShrink:0,overflowY:`auto`,overflowX:`hidden`},children:[(0,A.jsxs)(d.Box,{sx:{height:me,position:`sticky`,top:0,bgcolor:`background.paper`,zIndex:1,borderBottom:`1px solid`,borderRight:`1px solid`,borderColor:`divider`,display:`flex`,flexDirection:`column`},children:[(0,A.jsxs)(d.Box,{sx:{height:40,display:`flex`,alignItems:`center`,borderBottom:S===`days`?`1px solid`:void 0,borderColor:S===`days`?`divider`:void 0},children:[(0,A.jsx)(d.Box,{sx:{flex:1,minWidth:0,pl:2},children:(0,A.jsx)(d.Typography,{variant:`caption`,color:`text.secondary`,children:_.columnName})}),pe&&(0,A.jsx)(d.Box,{sx:{width:96,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,A.jsx)(d.Typography,{variant:`caption`,color:`text.secondary`,children:_.columnActions})}),(0,A.jsx)(d.Box,{sx:{width:90,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,A.jsx)(d.Typography,{variant:`caption`,color:`text.secondary`,children:_.columnStatus})})]}),S===`days`&&(0,A.jsx)(d.Box,{sx:{flex:1}})]}),g?(0,A.jsx)(d.Box,{sx:{position:`relative`,height:ee.getTotalSize()},children:ee.getVirtualItems().map(e=>(0,A.jsx)(d.Box,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:40,transform:`translateY(${e.start}px)`},children:(0,A.jsx)(Ib,{task:E[e.index],expandedIds:b,toggleExpand:x,hasActionsColumn:pe,onTaskClick:r,onAddTask:ue,onEditTask:de,onDeleteTask:fe,onStatusChange:s,inlineEdit:h,onInlineRename:h?k:void 0})},e.key))}):E.map(e=>(0,A.jsx)(Ib,{task:e,expandedIds:b,toggleExpand:x,hasActionsColumn:pe,onTaskClick:r,onAddTask:ue,onEditTask:de,onDeleteTask:fe,onStatusChange:s,inlineEdit:h,onInlineRename:h?k:void 0},e.id)),l&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(jb,{open:te,mode:`add`,defaultParentId:ae?.id,onSave:se,onClose:()=>ne(!1)}),(0,A.jsx)(jb,{open:D,mode:`edit`,initialTask:ae??void 0,onSave:ce,onClose:()=>re(!1)}),(0,A.jsx)(Mb,{open:O,task:ae,onConfirm:le,onClose:()=>ie(!1)})]})]})}function Rb({items:e}){return(0,A.jsx)(d.Box,{sx:{display:`flex`},children:e.map(e=>(0,A.jsx)(d.Box,{sx:{width:e.width,flexShrink:0,height:40,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRight:`1px solid`,borderColor:`divider`,bgcolor:e.isWeekend?`action.hover`:`transparent`},children:(0,A.jsx)(d.Typography,{variant:`caption`,color:e.isWeekend?`text.disabled`:`text.secondary`,children:e.label})},e.key))})}function zb({columns:e,groups:t}){return(0,A.jsxs)(d.Box,{sx:{position:`sticky`,top:0,bgcolor:`background.paper`,zIndex:1,borderBottom:`1px solid`,borderColor:`divider`,height:t?80:40,overflow:`visible`},children:[t&&(0,A.jsx)(d.Box,{sx:{height:40,borderBottom:`1px solid`,borderColor:`divider`,overflow:`visible`},children:(0,A.jsx)(Rb,{items:t})}),(0,A.jsx)(Rb,{items:e})]})}var Bb={planned:`warning.light`,"in-progress":`info.main`,done:`success.main`,blocked:`error.main`},Vb=864e5;function Hb(e,t,n){if(n===0)return[];let r=[],i=new Map(e.map((e,t)=>[e.id,t]));for(let a of e){if(!a.dependencies?.length)continue;let o=i.get(a.id),s=zy(a,t).left/100*n,c=o*40+40/2;for(let o of a.dependencies){let l=i.get(o);if(l===void 0)continue;let u=e[l],d=zy(u,t),f=(d.left+d.width)/100*n,p=l*40+40/2,m;m=s>=f+48?(f+s)/2:f+24<=n-8?f+24:Math.max(s-24,8),r.push({key:`${o}-${a.id}`,d:`M ${f} ${p} H ${m} V ${c} H ${s}`})}}return r}function Ub({scrollRef:e,onScroll:t,onTaskClick:n,onMilestoneClick:r,draggable:i=!1,resizable:a=!1,progressDraggable:o=!1,showCriticalPath:s=!1,virtualizeRows:c=!1,onTaskMoved:l,onTaskResized:f,onTasksChange:p,onStatusChange:m}){let h=(0,d.useTheme)(),g=B(e=>e.taskTree),_=B(e=>e.tasks),v=B(e=>e.expandedIds),y=B(e=>e.timelineRange),b=B(e=>e.timeScale),x=B(e=>e.updateTask),S=$b(),C=tx(),{statusColors:w,criticalPathColor:T,milestoneColor:E,todayLineColor:ee,weekendColor:te,barBorderRadius:ne}=rx(),D=`gantt-arrow-${(0,u.useId)().replace(/:/g,``)}`,re=(0,u.useMemo)(()=>Hy(g,v),[g,v]),O=(0,u.useMemo)(()=>Ry(y,b),[y,b]),ie=(0,u.useMemo)(()=>b===`days`?Qy(O).map(e=>({key:e.toISOString(),label:String(e.getDate()),width:20,isWeekend:e.getDay()===0||e.getDay()===6})):b===`weeks`?Zy(O).map(e=>({key:e.toISOString(),label:`${C.weekColumnPrefix}${Xy(e)}`,width:40})):b===`quarters`?tb(O).map(e=>({key:e.key,label:e.label,width:360})):Jy(O).map(e=>({key:e.toISOString(),label:e.toLocaleString(C.dateLocale,{month:`short`,year:`2-digit`}),width:120})),[b,O,C.weekColumnPrefix,C.dateLocale]),ae=(0,u.useMemo)(()=>ie.reduce((e,t)=>e+t.width,0),[ie]),oe=(0,u.useMemo)(()=>{if(b!==`days`)return;let e=new Map;for(let t of ie){let n=new Date(t.key),r=`${n.getFullYear()}-${n.getMonth()}`;e.has(r)||e.set(r,{label:n.toLocaleString(C.dateLocale,{month:`short`,year:`2-digit`}),width:0}),e.get(r).width+=20}return Array.from(e.entries()).map(([e,t])=>({key:e,...t}))},[b,ie,C.dateLocale]),se=(0,u.useMemo)(()=>Hb(re,O,ae),[re,O,ae]),ce=(0,u.useMemo)(()=>s?nb(_):new Set,[s,_]),le=wb({count:re.length,getScrollElement:()=>e.current,estimateSize:()=>40,overscan:5}),k=(0,u.useMemo)(()=>{if(b!==`days`)return[];let e=0;return ie.flatMap(t=>{let n=t.isWeekend?[{key:t.key,left:e}]:[];return e+=t.width,n})},[b,ie]),ue=(0,u.useMemo)(()=>{let e=Date.now(),t=O.start.getTime(),n=O.end.getTime();return e<t||e>n?null:(e-t)/(n-t)*ae},[O,ae]);(0,u.useEffect)(()=>{if(ue===null||!e.current)return;let t=e.current.clientWidth;e.current.scrollLeft=Math.max(0,ue-t/2)},[]);let de=b===`days`?20:b===`weeks`?40:b===`quarters`?360:120,fe=oe?80:40,pe=(0,u.useRef)(1);pe.current=ae>0?ae/((O.end.getTime()-O.start.getTime())/Vb):1;let me=(0,u.useRef)(null),he=(0,u.useRef)(null),[ge,_e]=(0,u.useState)(null),ve=(0,u.useRef)(!1),[ye,be]=(0,u.useState)(null),xe=(0,u.useRef)(l);xe.current=l;let Se=(0,u.useRef)(f);Se.current=f;let Ce=(0,u.useRef)(p);Ce.current=p;let we=(0,u.useRef)(m);we.current=m;let Te=(e,t,n)=>{e.stopPropagation(),ve.current=!1,me.current={type:n,taskId:t.id,startX:e.clientX,originalStart:t.startDate,originalEnd:t.endDate},document.body.style.cursor=n===`resize`?`ew-resize`:`grabbing`;let r=e=>{let t=me.current;if(!t||t.type===`progress`)return;let n=e.clientX-t.startX,r=Math.round(n/pe.current);Math.abs(n)>=5&&(ve.current=!0);let i={taskId:t.taskId,type:t.type,deltaDays:r};he.current=i,_e(i)},i=()=>{document.body.style.cursor=``;let e=me.current,t=he.current;if(e&&t&&ve.current&&t.deltaDays!==0){let n=S.getState().tasks.find(t=>t.id===e.taskId);if(n){if(t.type===`move`){let r=Ky(e.originalStart,t.deltaDays),i=Ky(e.originalEnd,t.deltaDays);x({...n,startDate:r,endDate:i}),xe.current?.(n,r,i)}else{let r=Ky(e.originalEnd,t.deltaDays),i=r>e.originalStart?r:Ky(e.originalStart,1);x({...n,endDate:i}),Se.current?.(n,i)}Ce.current?.(S.getState().tasks)}}me.current=null,he.current=null,_e(null),document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},Ee=(e,t,n,r)=>{e.stopPropagation(),ve.current=!1,me.current={type:`progress`,taskId:t.id,startX:e.clientX,originalStart:t.startDate,originalEnd:t.endDate,initialProgress:n,barWidthPx:r},document.body.style.cursor=`ew-resize`;let i=e=>{let t=me.current;if(!t||t.type!==`progress`)return;let n=e.clientX-t.startX;Math.abs(n)>=5&&(ve.current=!0);let r=n/(t.barWidthPx??1)*100,i=Math.round(Math.max(0,Math.min(100,(t.initialProgress??0)+r))),a={taskId:t.taskId,type:`progress`,deltaDays:0,newProgress:i};he.current=a,_e(a)},a=()=>{document.body.style.cursor=``;let e=me.current,t=he.current;if(e&&t&&t.type===`progress`&&t.newProgress!==void 0&&ve.current){let n=S.getState().tasks.find(t=>t.id===e.taskId);n&&(x({...n,progress:t.newProgress}),Ce.current?.(S.getState().tasks))}me.current=null,he.current=null,_e(null),document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a)};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)},De=e=>e.toLocaleDateString(C.dateLocale,{day:`2-digit`,month:`short`});return(0,A.jsx)(d.Box,{ref:e,onScroll:t,"data-testid":`gantt-timeline-scroll`,sx:{flex:1,overflow:`auto`},children:(0,A.jsxs)(d.Box,{sx:{minWidth:ae,position:`relative`},children:[(0,A.jsx)(zb,{columns:ie,groups:oe}),k.length>0&&(0,A.jsx)(d.Box,{"aria-hidden":!0,"data-testid":`gantt-weekend-strips`,sx:{position:`absolute`,top:fe,left:0,width:ae,height:re.length*40,pointerEvents:`none`},children:k.map(e=>(0,A.jsx)(d.Box,{sx:{position:`absolute`,left:e.left,width:20,top:0,height:`100%`,bgcolor:te??`action.hover`}},e.key))}),(()=>{let e=(e,t,s)=>{let c=ge?.taskId===e.id,l=e;if(c&&ge)if(ge.type===`move`)l={...e,startDate:Ky(e.startDate,ge.deltaDays),endDate:Ky(e.endDate,ge.deltaDays)};else if(ge.type===`resize`){let t=Ky(e.endDate,ge.deltaDays);l={...e,endDate:t>e.startDate?t:Ky(e.startDate,1)}}else ge.type===`progress`&&ge.newProgress!==void 0&&(l={...e,progress:ge.newProgress});let{left:u,width:f}=zy(l,O);return(0,A.jsx)(d.Box,{"data-testid":`gantt-bar-row-${e.id}`,style:s===void 0?void 0:{position:`absolute`,top:s,left:0,width:`100%`},sx:{height:40,position:`relative`,borderBottom:`1px solid`,borderColor:`divider`,backgroundImage:e=>`linear-gradient(to right, transparent calc(${de}px - 1px), ${e.palette.divider} calc(${de}px - 1px), ${e.palette.divider} ${de}px)`,backgroundSize:`${de}px 100%`,backgroundRepeat:`repeat-x`},children:e.isMilestone?u>=0&&u<=100?(0,A.jsx)(d.Box,{"data-testid":`gantt-milestone-${e.id}`,sx:{position:`absolute`,left:`${u}%`,top:`50%`,width:12,height:12,bgcolor:E??`warning.main`,transform:`translate(-50%, -50%) rotate(45deg)`,cursor:r?`pointer`:`default`,boxShadow:ce.has(e.id)?`0 0 0 2.5px ${T??h.palette.error.main}`:void 0,"&:hover":r?{opacity:.8}:void 0},onClick:()=>r?.(e)}):null:(()=>{let t=Math.max(0,u),r=Math.min(100,u+Math.max(f,.5))-t;return r<=0?null:(0,A.jsxs)(A.Fragment,{children:[c&&ge&&ge.type!==`progress`&&ge.deltaDays!==0&&(0,A.jsx)(d.Box,{sx:{position:`absolute`,left:`${t}%`,top:2,bgcolor:`grey.800`,color:`common.white`,borderRadius:.5,px:.75,lineHeight:`18px`,fontSize:`0.65rem`,whiteSpace:`nowrap`,pointerEvents:`none`,zIndex:100},children:ge.type===`move`?`${De(l.startDate)} – ${De(l.endDate)}`:`→ ${De(l.endDate)}`}),c&&ge?.type===`progress`&&ge.newProgress!==void 0&&(0,A.jsxs)(d.Box,{sx:{position:`absolute`,left:`${t}%`,top:2,bgcolor:`grey.800`,color:`common.white`,borderRadius:.5,px:.75,lineHeight:`18px`,fontSize:`0.65rem`,whiteSpace:`nowrap`,pointerEvents:`none`,zIndex:100},children:[ge.newProgress,`%`]}),(0,A.jsxs)(d.Box,{"data-testid":`gantt-bar-${e.id}`,sx:{position:`absolute`,left:`${t}%`,width:`${r}%`,height:16,top:`50%`,transform:`translateY(-50%)`,bgcolor:e.color??w?.[e.status]??Bb[e.status]??`grey.300`,borderRadius:ne===void 0?1:`${ne}px`,overflow:`hidden`,opacity:c?.75:1,boxShadow:ce.has(e.id)?`inset 0 0 0 2.5px ${T??h.palette.error.main}`:void 0,cursor:c?`grabbing`:i?`grab`:n?`pointer`:`default`,userSelect:`none`,"&:hover":i||n?{opacity:c?.75:.8}:void 0},onMouseDown:i?t=>Te(t,e,`move`):void 0,onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),be({task:e,mouseX:t.clientX,mouseY:t.clientY})},onClick:()=>{if(ve.current){ve.current=!1;return}n?.(e)},children:[l.progress!==void 0&&l.progress>0&&(0,A.jsx)(d.Box,{"data-testid":`gantt-progress-${e.id}`,sx:{position:`absolute`,left:0,top:0,width:`${Math.min(l.progress,100)}%`,height:`100%`,bgcolor:`currentColor`,opacity:.4}}),o&&(0,A.jsx)(d.Box,{"data-testid":`gantt-progress-handle-${e.id}`,sx:{position:`absolute`,left:`${Math.min(l.progress??0,100)}%`,top:0,width:6,height:`100%`,transform:`translateX(-50%)`,cursor:`ew-resize`,bgcolor:`rgba(255,255,255,0.35)`},onMouseDown:t=>{t.stopPropagation();let n=r/100*ae;Ee(t,e,l.progress??0,n)}}),a&&(0,A.jsx)(d.Box,{"data-testid":`gantt-resize-handle-${e.id}`,sx:{position:`absolute`,right:0,top:0,width:6,height:`100%`,cursor:`ew-resize`},onMouseDown:t=>{t.stopPropagation(),Te(t,e,`resize`)}})]})]})})()},t)};return c?(0,A.jsx)(d.Box,{sx:{position:`relative`,height:le.getTotalSize()},children:le.getVirtualItems().map(t=>e(re[t.index],t.key,t.start))}):(0,A.jsx)(A.Fragment,{children:re.map(t=>e(t,t.id))})})(),(0,A.jsx)(d.Menu,{open:ye!==null,onClose:()=>be(null),anchorReference:`anchorPosition`,anchorPosition:ye===null?void 0:{top:ye.mouseY,left:ye.mouseX},children:[`planned`,`in-progress`,`done`,`blocked`].map(e=>{let t={planned:C.statusPlanned,"in-progress":C.statusInProgress,done:C.statusDone,blocked:C.statusBlocked};return(0,A.jsx)(d.MenuItem,{selected:ye?.task.status===e,"data-testid":`gantt-status-menu-${e}`,onClick:()=>{if(!ye)return;let t=S.getState().tasks.find(e=>e.id===ye.task.id)??ye.task;x({...t,status:e}),we.current?.(t,e),Ce.current?.(S.getState().tasks),be(null)},children:t[e]},e)})}),(se.length>0||ue!==null)&&(0,A.jsxs)(`svg`,{"data-testid":`gantt-dependency-arrows`,style:{position:`absolute`,top:fe,left:0,width:ae,height:re.length*40,pointerEvents:`none`,overflow:`visible`},children:[se.length>0&&(0,A.jsx)(`defs`,{children:(0,A.jsx)(`marker`,{id:D,markerWidth:`6`,markerHeight:`4`,refX:`5`,refY:`2`,orient:`auto`,children:(0,A.jsx)(`polygon`,{points:`0 0, 6 2, 0 4`,fill:`currentColor`})})}),se.map(e=>(0,A.jsx)(`path`,{"data-testid":`gantt-dep-${e.key}`,d:e.d,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeOpacity:.4,markerEnd:`url(#${D})`},e.key)),ue!==null&&(0,A.jsx)(`line`,{"data-testid":`gantt-today-line`,x1:ue,y1:0,x2:ue,y2:re.length*40,stroke:ee??h.palette.primary.main,strokeWidth:1.5,strokeDasharray:`4 2`})]})]})})}var Wb=M((0,A.jsx)(`path`,{d:`M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91`}),`RestartAlt`),Gb=M((0,A.jsx)(`path`,{d:`M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9m-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z`}),`Restore`),Kb=M((0,A.jsx)(`path`,{d:`M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V8h14zM7 10h5v5H7z`}),`Today`),qb=M((0,A.jsx)(`path`,{d:`M7.41 18.59 8.83 20 12 16.83 15.17 20l1.41-1.41L12 14zm9.18-13.18L15.17 4 12 7.17 8.83 4 7.41 5.41 12 10z`}),`UnfoldLess`),Jb=M((0,A.jsx)(`path`,{d:`M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15z`}),`UnfoldMore`);function Yb(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function Xb(e){let[t,n,r]=e.split(`-`).map(Number);return!t||!n||!r?null:new Date(t,n-1,r,0,0,0,0)}function Zb({onScrollToToday:e,config:t}){let n=tx(),r=B(e=>e.timeScale),i=B(e=>e.defaultTimeScale),a=B(e=>e.setTimeScale),o=B(e=>e.timelineRange),s=B(e=>e.isRangeCustomized),c=B(e=>e.isExpandedCustomized),l=B(e=>e.setTimelineRange),f=B(e=>e.resetTimelineRange),p=B(e=>e.resetView),m=B(e=>e.tasks),h=B(e=>e.expandedIds),g=B(e=>e.expandAll),_=B(e=>e.collapseAll),v=m.length>0&&m.every(e=>h.has(e.id)),y=r!==i||s||c,b=(0,u.useMemo)(()=>Date.now(),[]),x=b>=o.start.getTime()&&b<=o.end.getTime(),S={days:n.scaleDays,weeks:n.scaleWeeks,months:n.scaleMonths,quarters:n.scaleQuarters},C={days:t.showScaleDays,weeks:t.showScaleWeeks,months:t.showScaleMonths,quarters:t.showScaleQuarters},w=Object.keys(S).filter(e=>C[e]);return(0,A.jsxs)(d.Box,{"data-testid":`gantt-toolbar`,sx:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1,px:1.5,py:.75,borderBottom:`1px solid`,borderColor:`divider`,bgcolor:`background.paper`},children:[w.length>0&&(0,A.jsx)(d.ToggleButtonGroup,{value:r,exclusive:!0,onChange:(e,t)=>{t&&a(t)},size:`small`,"aria-label":n.scaleMonths,children:w.map(e=>(0,A.jsx)(d.ToggleButton,{value:e,"data-testid":`gantt-scale-${e}`,children:S[e]},e))}),(0,A.jsxs)(d.Box,{sx:{ml:`auto`,display:`flex`,alignItems:`center`,gap:1},children:[t.showExpandCollapseAll&&(0,A.jsx)(d.Tooltip,{title:v?n.collapseAllTooltip:n.expandAllTooltip,children:(0,A.jsx)(d.IconButton,{size:`small`,onClick:v?_:g,"data-testid":`gantt-expand-collapse-all`,children:v?(0,A.jsx)(qb,{fontSize:`small`}):(0,A.jsx)(Jb,{fontSize:`small`})})}),t.showScrollToToday&&e&&(0,A.jsx)(d.Tooltip,{title:n.scrollToTodayTooltip,children:(0,A.jsx)(`span`,{children:(0,A.jsx)(d.IconButton,{size:`small`,onClick:e,disabled:!x,"data-testid":`gantt-scroll-to-today`,children:(0,A.jsx)(Kb,{fontSize:`small`})})})}),t.showDateRange&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(d.TextField,{type:`date`,size:`small`,label:n.rangeFrom,value:Yb(o.start),onChange:e=>{let t=Xb(e.target.value);t&&l({start:t,end:o.end})},slotProps:{inputLabel:{shrink:!0},htmlInput:{"data-testid":`gantt-range-start`}},sx:{width:148}}),(0,A.jsx)(d.TextField,{type:`date`,size:`small`,label:n.rangeTo,value:Yb(o.end),onChange:e=>{let t=Xb(e.target.value);t&&l({start:o.start,end:t})},slotProps:{inputLabel:{shrink:!0},htmlInput:{"data-testid":`gantt-range-end`}},sx:{width:148}})]}),t.showRangeReset&&s&&(0,A.jsx)(d.Tooltip,{title:n.rangeResetTooltip,children:(0,A.jsx)(d.IconButton,{size:`small`,onClick:f,"data-testid":`gantt-range-reset`,children:(0,A.jsx)(Gb,{fontSize:`small`})})}),t.showResetView&&(0,A.jsx)(d.Tooltip,{title:n.resetViewTooltip,children:(0,A.jsx)(`span`,{children:(0,A.jsx)(d.IconButton,{size:`small`,onClick:p,disabled:!y,"data-testid":`gantt-reset-view`,children:(0,A.jsx)(Wb,{fontSize:`small`})})})})]})]})}var Qb=(0,u.createContext)(null);function B(e){let t=(0,u.useContext)(Qb);if(!t)throw Error(`GanttChartStoreContext is missing.`);return Iy(t,e)}function $b(){let e=(0,u.useContext)(Qb);if(!e)throw Error(`GanttChartStoreContext is missing.`);return e}var ex=(0,u.createContext)(ab);function tx(){return(0,u.useContext)(ex)}var nx=(0,u.createContext)({});function rx(){return(0,u.useContext)(nx)}function ix(e,t){return e===void 0?t:e===`auto`?`100%`:typeof e==`string`&&/^\d+$/.test(e)?Number(e):e}var ax=[`days`,`weeks`,`months`,`quarters`],ox={showScaleDays:!0,showScaleWeeks:!0,showScaleMonths:!0,showScaleQuarters:!0,showExpandCollapseAll:!0,showScrollToToday:!0,showDateRange:!0,showRangeReset:!0,showResetView:!0};function sx({tasks:e,onTaskClick:t,onMilestoneClick:n,onAddTask:r,onEditTask:i,onDeleteTask:a,onStatusChange:o,onTasksChange:s,enableBuiltinDialogs:c=!0,onTaskCreated:l,onTaskUpdated:f,onTaskDeleted:p,showToolbar:m=!0,toolbarConfig:h,height:g,width:_,minPanelWidth:v=200,maxPanelWidth:y=600,zoomable:b=!1,draggable:x=!1,resizable:S=!1,inlineEdit:C=!1,progressDraggable:w=!1,showCriticalPath:T=!1,virtualizeRows:E=!1,onTaskMoved:ee,onTaskResized:te}){let ne=ix(g,400),D=(0,u.useMemo)(()=>({...ox,...h}),[h]),re=ix(_,`100%`),O=B(e=>e.setTasks),ie=B(e=>e.timeScale),ae=B(e=>e.setTimeScale),oe=B(e=>e.timelineRange),se=(0,u.useRef)(null),ce=(0,u.useRef)(null),le=(0,u.useRef)(!1),[k,ue]=(0,u.useState)(320);(0,u.useEffect)(()=>{O(e)},[e,O]);let de=()=>{le.current||=(le.current=!0,ce.current&&se.current&&(ce.current.scrollTop=se.current.scrollTop),!1)},fe=()=>{le.current||=(le.current=!0,se.current&&ce.current&&(se.current.scrollTop=ce.current.scrollTop),!1)},pe=(0,u.useCallback)(()=>{if(!ce.current)return;let e=Ry(oe,ie),t=Date.now(),n=e.start.getTime(),r=e.end.getTime(),i=(t-n)/(r-n)*ce.current.scrollWidth;ce.current.scrollLeft=Math.max(0,i-ce.current.clientWidth/2)},[oe,ie]);(0,u.useEffect)(()=>{if(!b||!ce.current)return;let e=ce.current,t=e=>{if(!e.ctrlKey)return;e.preventDefault();let t=ax.indexOf(ie);e.deltaY<0&&t>0?ae(ax[t-1]):e.deltaY>0&&t<ax.length-1&&ae(ax[t+1])};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[b,ie,ae]);let me=(0,u.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=k,r=e=>{let r=e.clientX-t;ue(Math.max(v,Math.min(y,n+r)))},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[k,v,y]);return(0,A.jsxs)(d.Box,{sx:{display:`flex`,flexDirection:`column`,height:ne,width:re,border:`1px solid`,borderColor:`divider`,borderRadius:1,overflow:`hidden`},children:[m&&(0,A.jsx)(Zb,{onScrollToToday:pe,config:D}),(0,A.jsxs)(d.Box,{sx:{display:`flex`,flex:1,overflow:`hidden`},children:[(0,A.jsx)(Lb,{scrollRef:se,onScroll:de,panelWidth:k,onTaskClick:t,onAddTask:r,onEditTask:i,onDeleteTask:a,onStatusChange:o,onTasksChange:s,enableBuiltinDialogs:c,onTaskCreated:l,onTaskUpdated:f,onTaskDeleted:p,inlineEdit:C,virtualizeRows:E}),(0,A.jsx)(d.Box,{"data-testid":`gantt-panel-divider`,sx:{width:4,flexShrink:0,bgcolor:`divider`,cursor:`col-resize`,"&:hover":{bgcolor:`action.hover`}},onMouseDown:me}),(0,A.jsx)(Ub,{scrollRef:ce,onScroll:fe,onTaskClick:t,onMilestoneClick:n,draggable:x,resizable:S,progressDraggable:w,showCriticalPath:T,virtualizeRows:E,onTaskMoved:ee,onTaskResized:te,onTasksChange:s,onStatusChange:o})]})]})}function cx({tasks:e,timeScale:t=`months`,initialExpandAll:n=!1,showToolbar:r=!0,defaultRangeStart:i,defaultRangeEnd:a,translations:o,enableBuiltinDialogs:s=!0,toolbarConfig:c,zoomable:l=!1,draggable:d=!1,resizable:f=!1,inlineEdit:p=!1,progressDraggable:m=!1,showCriticalPath:h=!1,virtualizeRows:g=!1,cascadeDependencies:_=!1,statusColors:v,ganttTheme:y,onTaskClick:b,onMilestoneClick:x,onAddTask:S,onEditTask:C,onDeleteTask:w,onStatusChange:T,onTasksChange:E,onTaskMoved:ee,onTaskResized:te,onTaskCreated:ne,onTaskUpdated:D,onTaskDeleted:re,height:O,width:ie,minPanelWidth:ae,maxPanelWidth:oe}){let se=(0,u.useMemo)(()=>({...ab,...o}),[o]),[ce]=(0,u.useState)(()=>{if(!(i!==void 0||a!==void 0))return ib(e,t,n,void 0,_);let r=Ly(e);return ib(e,t,n,{start:i??r.start,end:a??r.end},_)}),le=(0,u.useMemo)(()=>({...y,statusColors:{...v,...y?.statusColors}}),[v,y]);return(0,A.jsx)(ex.Provider,{value:se,children:(0,A.jsx)(nx.Provider,{value:le,children:(0,A.jsx)(Qb.Provider,{value:ce,children:(0,A.jsx)(sx,{tasks:e,timeScale:t,enableBuiltinDialogs:s,showToolbar:r,toolbarConfig:c,zoomable:l,draggable:d,resizable:f,inlineEdit:p,progressDraggable:m,showCriticalPath:h,virtualizeRows:g,onTaskClick:b,onMilestoneClick:x,onAddTask:S,onEditTask:C,onDeleteTask:w,onStatusChange:T,onTasksChange:E,onTaskMoved:ee,onTaskResized:te,onTaskCreated:ne,onTaskUpdated:D,onTaskDeleted:re,height:O,width:ie,minPanelWidth:ae,maxPanelWidth:oe})})})})}var lx=M((0,A.jsx)(`path`,{d:`M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3`}),`Visibility`),ux=M((0,A.jsx)(`path`,{d:`M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z`}),`VisibilityOff`),dx=e=>Math.max(0,Math.min(4,Math.round(e)));function fx(e,t){let n=e??``,r=n.length,i=/[a-z]/.test(n),a=/[A-Z]/.test(n),o=/\d/.test(n),s=/[^A-Za-z0-9]/.test(n),c=[i,a,o,s].filter(Boolean).length;if(r<t){let e=r===0?0:1;return{score:e,percent:e*25,meterStatus:`weak`,length:r,hasLower:i,hasUpper:a,hasDigit:o,hasSymbol:s}}let l=0;l+=1,r>=t+4&&(l+=1),c>=2&&(l+=1),c>=3&&(l+=1),/^(.)\1+$/.test(n)&&(l-=2),/1234|abcd|qwer|password|passwort|admin/i.test(n)&&(l-=2);let u=dx(l),d=u<=1?`weak`:u===2?`ok`:u===3?`good`:`very good`;return{score:u,percent:u*25,meterStatus:d,length:r,hasLower:i,hasUpper:a,hasDigit:o,hasSymbol:s}}var px={label:`Password`,summaryHeaderLabel:`Requirements for your password`,summaryMinChars:`At least {n} characters`,summaryCapitalLetter:`At least 1 capital letter`,summaryLowerCaseLetter:`At least 1 lowercase letter`,summaryNumber:`At least 1 number`,summarySpecialChar:`At least 1 special character`,showPasswordLabel:`Show password`,hidePasswordLabel:`Hide password`,meterAriaLabel:`Password strength`},mx={weak:`#cc0000`,ok:`#fdc010`,good:`#8bc34a`,veryGood:`#43a047`},hx={failure:`#cc0000`,success:`#43a047`};function gx({label:e,fulfilled:t,checkColors:n}){return(0,A.jsxs)(d.Stack,{direction:`row`,sx:{alignItems:`center`,mb:.25},spacing:.5,children:[(0,A.jsx)(d.Typography,{variant:`caption`,children:e}),t?(0,A.jsx)(ji,{"data-testid":`psm-req-success`,style:{fontSize:16,color:n.success}}):(0,A.jsx)(Ai,{"data-testid":`psm-req-failure`,style:{fontSize:16,color:n.failure}})]})}function _x({value:e,name:t,inputRef:n,disabled:r=!1,error:i=!1,helperText:a,autoComplete:o,showPasswordAdornment:s=!0,showMeter:c=!0,showSummary:l=!0,inputSize:f=`medium`,translation:p,meterColors:m,passwordMinLength:h=8,checkColors:g=hx,onPasswordChange:_}){let v={...px,...p},y={...mx,...m},b=`${(0,u.useId)()}-password`,[x,S]=(0,u.useState)(!1),[C,w]=(0,u.useState)(``),T=e===void 0?C:e,E=(0,u.useMemo)(()=>fx(T,h),[T,h]);return(0,A.jsxs)(d.Stack,{children:[(0,A.jsxs)(d.FormControl,{variant:`outlined`,fullWidth:!0,error:i,children:[(0,A.jsx)(d.InputLabel,{htmlFor:b,size:f,children:v.label}),(0,A.jsx)(d.OutlinedInput,{id:b,type:x?`text`:`password`,fullWidth:!0,size:f,value:T,onChange:t=>{let n=t.target.value;e===void 0&&w(n),_&&_(n,fx(n,h))},disabled:r,inputRef:n,inputProps:{"data-testid":`psm-input`,name:t,autoComplete:o},endAdornment:s?(0,A.jsx)(d.InputAdornment,{position:`end`,children:(0,A.jsx)(d.IconButton,{"data-testid":`psm-toggle`,disabled:r,"aria-label":x?v.hidePasswordLabel:v.showPasswordLabel,onClick:()=>{S(e=>!e)},onMouseDown:e=>{e.preventDefault()},onMouseUp:e=>{e.preventDefault()},edge:`end`,children:x?(0,A.jsx)(ux,{}):(0,A.jsx)(lx,{})})}):null,label:v.label}),a&&(0,A.jsx)(d.FormHelperText,{children:a})]}),c&&(0,A.jsx)(d.Box,{role:`progressbar`,"aria-label":v.meterAriaLabel,"aria-valuenow":E.percent,"aria-valuemin":0,"aria-valuemax":100,sx:{width:`100%`,height:`8px`,border:`1px solid`,borderColor:`divider`,borderRadius:`6px`,mt:.5,display:`flex`},children:(0,A.jsx)(d.Box,{"data-testid":`psm-meter`,sx:{height:`100%`,width:`${E.percent}%`,backgroundColor:(e=>{switch(e.meterStatus){case`weak`:return y.weak;case`ok`:return y.ok;case`good`:return y.good;case`very good`:return y.veryGood;default:return`transparent`}})(E),borderRadius:`6px`,transition:`width 0.2s ease-in-out`}})}),l&&(0,A.jsxs)(d.Box,{"data-testid":`psm-summary`,sx:{mt:.5,p:.5},children:[(0,A.jsx)(d.Typography,{variant:`caption`,gutterBottom:!0,sx:{display:`block`,fontSize:14},children:v.summaryHeaderLabel}),(0,A.jsxs)(d.Stack,{direction:`row`,spacing:6,children:[(0,A.jsxs)(d.Stack,{direction:`column`,children:[(0,A.jsx)(gx,{label:v.summaryMinChars.replace(`{n}`,String(h)),fulfilled:E.length>=h,checkColors:g}),(0,A.jsx)(gx,{label:v.summaryCapitalLetter,fulfilled:E.hasUpper,checkColors:g}),(0,A.jsx)(gx,{label:v.summaryLowerCaseLetter,fulfilled:E.hasLower,checkColors:g})]}),(0,A.jsxs)(d.Stack,{direction:`column`,children:[(0,A.jsx)(gx,{label:v.summaryNumber,fulfilled:E.hasDigit,checkColors:g}),(0,A.jsx)(gx,{label:v.summarySpecialChar,fulfilled:E.hasSymbol,checkColors:g})]})]})]})]})}function vx(e){return Py(t=>({tags:e,searchValue:``,setTags:e=>{t({tags:e})},setSearchValue:e=>{t({searchValue:e})},selectTag:e=>{t(t=>({tags:t.tags.map(t=>t.id===e&&!t.disabled?{...t,selected:!0}:t),searchValue:``}))},deleteTag:e=>{t(t=>({tags:t.tags.map(t=>t.id===e?{...t,selected:!1}:t)}))},addTag:e=>{t(t=>({tags:[...t.tags,{...e,selected:!0}],searchValue:``}))}}))}var yx=M((0,A.jsx)(`path`,{d:`M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`}),`Close`),bx=[`default`,`primary`,`secondary`,`error`,`info`,`success`,`warning`];function xx({availableTags:e,searchValue:t,translation:n,onSearchChange:r,onTagSelect:i,onTagCreate:a,inputSize:o=`medium`,chipSize:s=`medium`,disabled:c=!1,loading:l=!1,isMaxReached:f=!1,allowCreate:p=!1,listboxMaxHeight:m}){let[h,g]=(0,u.useState)(`default`),[_,v]=(0,u.useState)(!1),y=c||f,b=e.filter(e=>e.label.toLowerCase().includes(t.trim().toLowerCase())),x=p&&t.trim()!==``&&b.length===0,S=_&&!x,C=()=>{a?.(t.trim(),h),g(`default`)},w=()=>{r(``),g(`default`)};return(0,A.jsxs)(d.Box,{sx:{mb:2},children:[(0,A.jsx)(d.Autocomplete,{options:e,value:null,open:S,onOpen:()=>{x||v(!0)},onClose:()=>v(!1),size:o,disabled:y,loading:l,getOptionLabel:e=>e.label,inputValue:t,onInputChange:(e,t)=>{r(t)},onChange:(e,t)=>{t&&i(t)},slotProps:{listbox:{sx:{display:`flex`,flexWrap:`wrap`,gap:1,padding:1,...m!==void 0&&{maxHeight:m,overflowY:`auto`}}}},renderInput:e=>(0,A.jsx)(d.TextField,{...e,label:n.autoCompleteLabel,placeholder:n.placeholder,helperText:f&&!c?n.maxTagsReachedText:void 0,onKeyDown:e=>{x&&e.key===`Enter`&&(e.preventDefault(),C())},slotProps:{...e.slotProps,input:{...e.slotProps?.input,endAdornment:(0,A.jsxs)(A.Fragment,{children:[x&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(d.IconButton,{size:`small`,sx:{color:`success.main`},onMouseDown:e=>{e.preventDefault()},onClick:C,children:(0,A.jsx)(xy,{fontSize:`small`})}),(0,A.jsx)(d.IconButton,{size:`small`,onMouseDown:e=>{e.preventDefault()},onClick:w,children:(0,A.jsx)(yx,{fontSize:`small`})})]}),e.slotProps?.input?.endAdornment]})}}}),renderOption:({key:e,...t},n)=>{let r=!!(n.foregroundColor||n.backgroundColor);return(0,A.jsx)(`li`,{...t,style:{width:`auto`,padding:0,margin:0},children:(0,A.jsx)(d.Chip,{size:s,label:n.label,color:r?void 0:n.color??`default`,sx:r?{color:n.foregroundColor??`inherit`,backgroundColor:n.backgroundColor??`transparent`}:void 0})},e)},isOptionEqualToValue:(e,t)=>e.id===t.id,noOptionsText:n.noAvailableTagsText,loadingText:n.loadingText}),x&&(0,A.jsx)(d.Stack,{direction:`row`,sx:{mt:.5,flexWrap:`wrap`,gap:.5,alignItems:`center`},children:bx.map(e=>(0,A.jsx)(d.Chip,{size:s,color:e,label:e,variant:h===e?`filled`:`outlined`,onClick:()=>g(e),clickable:!0},e))})]})}function Sx({tag:e,onDelete:t,onClick:n,chipSize:r=`medium`,disabled:i=!1}){let a=!!(e.foregroundColor||e.backgroundColor);return(0,A.jsx)(d.Chip,{size:r,label:e.label,onDelete:t?()=>t(e):void 0,onClick:n?()=>n(e):void 0,clickable:!!n&&!e.disabled&&!i,disabled:i||e.disabled,variant:e.selected?`filled`:`outlined`,color:a?void 0:e.color??`default`,sx:{...a&&{color:e.foregroundColor??`inherit`,backgroundColor:e.backgroundColor??`transparent`,borderColor:e.backgroundColor??void 0,"& .MuiChip-deleteIcon":{color:e.foregroundColor?`${e.foregroundColor}99`:`inherit`,"&:hover":{color:e.foregroundColor??`inherit`}}},cursor:n&&!e.disabled&&!i?`pointer`:`default`}})}function Cx({selectedTags:e,translation:t,onTagDelete:n,showSelectedTagsLabel:r,chipSize:i=`medium`,disabled:a=!1,maxVisibleChips:o,popoverPlacement:s=`bottom`}){let[c,l]=(0,u.useState)(null),f=o===void 0?e:e.slice(0,o),p=o===void 0?[]:e.slice(o),m=!!c&&p.length>0,h=s===`top`?{vertical:`top`,horizontal:`left`}:{vertical:`bottom`,horizontal:`left`},g=s===`top`?{vertical:`bottom`,horizontal:`left`}:{vertical:`top`,horizontal:`left`};return(0,A.jsxs)(d.Box,{sx:{mb:2},children:[r&&(0,A.jsx)(d.Typography,{variant:`subtitle2`,gutterBottom:!0,children:t.selectedTagsLabel}),e.length===0?(0,A.jsx)(d.Typography,{variant:`body2`,color:`text.secondary`,children:t.noSelectedTagsText}):(0,A.jsxs)(d.Stack,{direction:`row`,sx:{flexWrap:`wrap`,gap:1},children:[f.map(e=>(0,A.jsx)(Sx,{tag:e,onDelete:n,chipSize:i,disabled:a},e.id)),p.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(d.Chip,{size:i,label:`+${p.length}`,variant:`outlined`,clickable:!0,onClick:e=>l(e.currentTarget)}),(0,A.jsx)(d.Popover,{open:m,anchorEl:c,onClose:()=>l(null),anchorOrigin:h,transformOrigin:g,children:(0,A.jsx)(d.Box,{sx:{p:1,display:`flex`,flexWrap:`wrap`,gap:.5,maxWidth:320},children:p.map(e=>(0,A.jsx)(Sx,{tag:e,onDelete:a?void 0:n,chipSize:i,disabled:a},e.id))})})]})]})]})}var wx={selectedTagsLabel:`Selected tags`,autoCompleteLabel:`Search and add tags`,noSelectedTagsText:`No tags selected.`,noAvailableTagsText:`No tags available.`,placeholder:`Type to search...`,loadingText:`Loading...`,maxTagsReachedText:`Maximum number of tags reached.`},Tx=(0,u.createContext)(null);function Ex(e){let t=(0,u.useContext)(Tx);if(!t)throw Error(`TagSelectionStoreContext is missing.`);return Iy(t,e)}function Dx({tags:e,showSelectedTags:t=!0,showSelectedTagsLabel:n=!0,showAutoComplete:r=!0,inputSize:i=`medium`,chipSize:a=`small`,disabled:o=!1,loading:s=!1,maxTags:c,allowCreate:l=!1,maxVisibleChips:f,popoverPlacement:p=`bottom`,listboxMaxHeight:m,translation:h,onTagSelect:g,onTagDelete:_,onTagsChange:v,onSearchChange:y,onTagCreate:b}){let x=Ex(e=>e.tags),S=Ex(e=>e.searchValue),C=Ex(e=>e.setTags),w=Ex(e=>e.setSearchValue),T=Ex(e=>e.selectTag),E=Ex(e=>e.deleteTag),ee=Ex(e=>e.addTag);(0,u.useEffect)(()=>{C(e)},[e,C]);let te=(0,u.useMemo)(()=>x.filter(e=>e.selected).sort((e,t)=>e.label.localeCompare(t.label)),[x]),ne=(0,u.useMemo)(()=>x.filter(e=>!e.selected&&!e.disabled).sort((e,t)=>e.label.localeCompare(t.label)),[x]),D=c!==void 0&&te.length>=c,re=e=>{v&&v(e.filter(e=>e.selected),e)};return(0,A.jsx)(d.Box,{sx:{width:`100%`},children:(0,A.jsxs)(d.Stack,{children:[t&&(0,A.jsx)(Cx,{selectedTags:te,translation:h,onTagDelete:e=>{E(e.id);let t=x.map(t=>t.id===e.id?{...t,selected:!1}:t),n=t.filter(e=>e.selected),r=t.find(t=>t.id===e.id);r&&_&&_(r,n,t),re(t)},showSelectedTagsLabel:n,chipSize:a,disabled:o,maxVisibleChips:f,popoverPlacement:p}),r&&(0,A.jsx)(xx,{availableTags:ne,searchValue:S,translation:h,onSearchChange:e=>{w(e),y&&y(e)},onTagSelect:e=>{if(e.disabled||e.selected)return;T(e.id);let t=x.map(t=>t.id===e.id?{...t,selected:!0}:t),n=t.filter(e=>e.selected),r=t.find(t=>t.id===e.id);r&&g&&g(r,n,t),re(t)},onTagCreate:(e,t)=>{let n={id:e.toLowerCase().replace(/\s+/g,`-`),label:e,color:t,selected:!0};ee(n);let r=[...x,n],i=r.filter(e=>e.selected);g&&g(n,i,r),re(r),b&&b(e,t)},inputSize:i,chipSize:a,disabled:o,loading:s,isMaxReached:D,allowCreate:l,listboxMaxHeight:m})]})})}function Ox({tags:e,showSelectedTags:t=!0,showSelectedTagsLabel:n=!0,showAutoComplete:r=!0,translation:i,inputSize:a=`medium`,chipSize:o=`small`,disabled:s=!1,loading:c=!1,maxTags:l,allowCreate:d=!1,maxVisibleChips:f,popoverPlacement:p=`bottom`,listboxMaxHeight:m,onTagSelect:h,onTagDelete:g,onTagsChange:_,onSearchChange:v,onTagCreate:y}){let b={...wx,...i},[x]=(0,u.useState)(()=>vx(e));return(0,A.jsx)(Tx.Provider,{value:x,children:(0,A.jsx)(Dx,{tags:e,showSelectedTags:t,showSelectedTagsLabel:n,showAutoComplete:r,translation:b,inputSize:a,chipSize:o,disabled:s,loading:c,maxTags:l,allowCreate:d,maxVisibleChips:f,popoverPlacement:p,listboxMaxHeight:m,onTagSelect:h,onTagDelete:g,onTagsChange:_,onSearchChange:v,onTagCreate:y})})}var kx=o((e=>{var t=require(`react`);function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Ax=o((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}function n(e,t){d||a.startTransition===void 0||(d=!0,console.error(`You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.`));var n=t();if(!f){var i=t();o(n,i)||(console.error(`The result of getSnapshot should be cached to avoid an infinite loop`),f=!0)}i=s({inst:{value:n,getSnapshot:t}});var p=i[0].inst,m=i[1];return l(function(){p.value=n,p.getSnapshot=t,r(p)&&m({inst:p})},[e,n,t]),c(function(){return r(p)&&m({inst:p}),e(function(){r(p)&&m({inst:p})})},[e]),u(n),n}function r(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch{return!0}}function i(e,t){return t()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=require(`react`),o=typeof Object.is==`function`?Object.is:t,s=a.useState,c=a.useEffect,l=a.useLayoutEffect,u=a.useDebugValue,d=!1,f=!1,p=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?i:n;e.useSyncExternalStore=a.useSyncExternalStore===void 0?p:a.useSyncExternalStore,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()})),jx=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=kx():t.exports=Ax()})),Mx=jx();function Nx(e){this.content=e}Nx.prototype={constructor:Nx,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new Nx(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Nx(n)},addToStart:function(e,t){return new Nx([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Nx(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new Nx(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Nx.from(e),e.size?new Nx(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Nx.from(e),e.size?new Nx(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Nx.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Nx.from=function(e){if(e instanceof Nx)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Nx(t)};function Px(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Px(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Fx(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Fx(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var V=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Px(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Fx(this,e,t,n)}findIndex(e){if(e==0)return Lx(0,e);if(e==this.size)return Lx(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Lx(t+1,i):Lx(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};V.empty=new V([],0);var Ix={index:0,offset:0};function Lx(e,t){return Ix.index=e,Ix.offset=t,Ix}function Rx(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Rx(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Rx(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var zx=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Rx(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};zx.none=[];var Bx=class extends Error{},H=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Hx(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Vx(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(V.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};H.empty=new H(V.empty,0,0);function Vx(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Vx(a.content,t-i-1,n-i-1)))}function Hx(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Hx(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function Ux(e,t,n){if(n.openStart>e.depth)throw new Bx(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Bx(`Inconsistent open depths`);return Wx(e,t,n,0)}function Wx(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Wx(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Yx(a,Zx(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Yx(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Qx(n,e);return Yx(a,Xx(e,i,o,t,r))}}function Gx(e,t){if(!t.type.compatibleContent(e.type))throw new Bx(`Cannot join `+t.type.name+` onto `+e.type.name)}function Kx(e,t,n){let r=e.node(n);return Gx(r,t.node(n)),r}function qx(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Jx(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(qx(e.nodeAfter,r),a++));for(let e=a;e<o;e++)qx(i.child(e),r);t&&t.depth==n&&t.textOffset&&qx(t.nodeBefore,r)}function Yx(e,t){return e.type.checkContent(t),e.copy(t)}function Xx(e,t,n,r,i){let a=e.depth>i&&Kx(e,t,i+1),o=r.depth>i&&Kx(n,r,i+1),s=[];return Jx(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Gx(a,o),qx(Yx(a,Xx(e,t,n,r,i+1)),s)):(a&&qx(Yx(a,Zx(e,t,i+1)),s),Jx(t,n,i,s),o&&qx(Yx(o,Zx(n,r,i+1)),s)),Jx(r,null,i,s),new V(s)}function Zx(e,t,n){let r=[];return Jx(null,e,n,r),e.depth>n&&qx(Yx(Kx(e,t,n+1),Zx(e,t,n+1)),r),Jx(t,null,n,r),new V(r)}function Qx(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(V.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var $x=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return zx.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new rS(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=nS.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else nS.set(t,r=new eS);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%tS,i}},eS=class{constructor(){this.elts=[],this.i=0}},tS=12,nS=new WeakMap,rS=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},iS=Object.create(null),aS=class e{constructor(e,t,n,r=zx.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||V.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Rx(this.attrs,t||e.defaultAttrs||iS)&&zx.sameSet(this.marks,n||zx.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return H.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new H(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Ux(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return $x.resolveCached(this,e)}resolveNoCache(e){return $x.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),sS(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=V.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=zx.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!zx.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=V.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};aS.prototype.text=void 0;var oS=class e extends aS{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):sS(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function sS(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var cS=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new lS(t,n);if(r.next==null)return e.empty;let i=uS(r);r.next&&r.err(`Unexpected trailing text`);let a=bS(_S(i));return xS(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return V.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
47
|
-
`)}};cS.empty=new cS(!0);var lS=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function uS(e){let t=[];do t.push(dS(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function dS(e){let t=[];do t.push(fS(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function fS(e){let t=gS(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=mS(e,t);else break;return t}function pS(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function mS(e,t){let n=pS(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:pS(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function hS(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function gS(e){if(e.eat(`(`)){let t=uS(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=hS(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function _S(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function vS(e,t){return t-e}function yS(e,t){let n=[];return r(t),n.sort(vS);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function bS(e){let t=Object.create(null);return n(yS(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);yS(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new cS(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(vS);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function xS(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function SS(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function CS(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function wS(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function TS(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new OS(e,r,t[r]);return n}var ES=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=TS(e,n.attrs),this.defaultAttrs=SS(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==cS.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:CS(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new aS(this,this.computeAttrs(e),V.from(t),zx.setFrom(n))}createChecked(e=null,t,n){return t=V.from(t),this.checkContent(t),new aS(this,this.computeAttrs(e),t,zx.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=V.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(V.empty,!0);return i?new aS(this,e,t.append(i),zx.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){wS(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:zx.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function DS(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var OS=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?DS(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},kS=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=TS(e,r.attrs),this.excluded=null;let i=SS(this.attrs);this.instance=i?new zx(this,i):null}create(e=null){return!e&&this.instance?this.instance:new zx(this,CS(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){wS(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},AS=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Nx.from(e.nodes),t.marks=Nx.from(e.marks||{}),this.nodes=ES.compile(this.spec.nodes,this),this.marks=kS.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=cS.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?jS(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:jS(this,n.split(` `))}this.nodeFromJSON=e=>aS.fromJSON(this,e),this.markFromJSON=e=>zx.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof ES))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new oS(n,n.defaultAttrs,e,zx.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function jS(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function MS(e){return e.tag!=null}function NS(e){return e.style!=null}var PS=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(MS(e))this.tags.push(e);else if(NS(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new US(this,t,!1);return n.addAll(e,zx.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new US(this,t,!0);return n.addAll(e,zx.none,t.from,t.to),H.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(GS(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=KS(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=KS(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},FS={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},IS={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},LS={ol:!0,ul:!0},RS=1,zS=2,BS=4;function VS(e,t,n){return t==null?e&&e.whitespace==`pre`?RS|zS:n&~BS:(t?RS:0)|(t===`full`?zS:0)}var HS=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=zx.none,this.match=i||(a&BS?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(V.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&RS)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=V.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(V.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!FS.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},US=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=VS(null,t.preserveWhitespace,0)|(n?BS:0);i=r?new HS(r.type,r.attrs,zx.none,!0,t.topMatch||r.type.contentMatch,a):n?new HS(null,null,zx.none,!0,null,a):new HS(e.schema.topNodeType,null,zx.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&zS?`full`:this.localPreserveWS||(r.options&RS)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
48
|
-
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;LS.hasOwnProperty(a)&&this.parser.normalizeLists&&WS(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:IS.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(FS.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
49
|
-
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=zx.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):qS(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=VS(e,i,a.options);a.options&BS&&a.content.length==0&&(o|=BS);let s=zx.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):qS(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new HS(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=RS);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function WS(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&LS.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function GS(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function KS(e){let t={};for(let n in e)t[n]=e[n];return t}function qS(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var JS=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=XS(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return XS(t).createTextNode(e.text);let{dom:n,contentDOM:r}=eC(XS(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&eC(XS(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:eC(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=YS(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return YS(e.marks)}};function YS(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function XS(e){return e.document||window.document}var ZS=new WeakMap;function QS(e){let t=ZS.get(e);return t===void 0&&ZS.set(e,t=$S(e)),t}function $S(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function eC(e,t,n,r){if(t.nodeType==3)return{dom:t};if(t.dom&&t.dom.nodeType==3)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=QS(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=eC(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var tC=65535,nC=2**16;function rC(e,t){return e+t*nC}function iC(e){return e&tC}function aC(e){return(e-(e&tC))/nC}var oC=1,sC=2,cC=4,lC=8,uC=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&lC)>0}get deletedBefore(){return(this.delInfo&(oC|cC))>0}get deletedAfter(){return(this.delInfo&(sC|cC))>0}get deletedAcross(){return(this.delInfo&cC)>0}},dC=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=iC(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+aC(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:rC(o/3,e-s),f=e==s?sC:e==u?oC:cC;return(t<0?e!=s:e!=u)&&(f|=lC),new uC(a,f,d)}r+=l-c}return n?e+r:new uC(e+r,0,null)}touches(e,t){let n=0,r=iC(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};dC.empty=new dC([]);var fC=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new uC(e,r,null)}},pC=Object.create(null),mC=class{getMap(){return dC.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=pC[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in pC)throw RangeError(`Duplicate use of step JSON ID `+e);return pC[e]=t,t.prototype.jsonID=e,t}},hC=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Bx)return e.fail(t.message);throw t}}};function gC(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(gC(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return V.fromArray(r)}var _C=class e extends mC{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new H(gC(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return hC.fromReplace(e,this.from,this.to,i)}invert(){return new vC(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};mC.jsonID(`addMark`,_C);var vC=class e extends mC{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new H(gC(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return hC.fromReplace(e,this.from,this.to,n)}invert(){return new _C(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};mC.jsonID(`removeMark`,vC);var yC=class e extends mC{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return hC.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return hC.fromReplace(e,this.pos,this.pos+1,new H(V.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new bC(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};mC.jsonID(`addNodeMark`,yC);var bC=class e extends mC{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return hC.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return hC.fromReplace(e,this.pos,this.pos+1,new H(V.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new yC(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};mC.jsonID(`removeNodeMark`,bC);var xC=class e extends mC{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&CC(e,this.from,this.to)?hC.fail(`Structure replace would overwrite content`):hC.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new dC([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?H.empty:new H(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?H.empty:new H(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,H.fromJSON(t,n.slice),!!n.structure)}};xC.MAP_BIAS=1,mC.jsonID(`replace`,xC);var SC=class e extends mC{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(CC(e,this.from,this.gapFrom)||CC(e,this.gapTo,this.to)))return hC.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return hC.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?hC.fromReplace(e,this.from,this.to,n):hC.fail(`Content does not fit in gap`)}getMap(){return new dC([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(t,n.slice),n.insert,!!n.structure)}};mC.jsonID(`replaceAround`,SC);function CC(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function wC(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new vC(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new _C(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function TC(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof kS){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new vC(t.from,t.to,t.style)))}function EC(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new xC(s,l,H.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new vC(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new H(V.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new xC(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(V.empty,!0);e.replace(s,s,new H(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function DC(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function OC(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!DC(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function kC(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=V.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=V.from(r.node(e).copy(u)),d++):c--;let f=V.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=V.from(i.node(e).copy(f)),p++):l++;e.step(new SC(c,l,o,s,new H(u.append(f),d,p),u.size-d,!0))}function AC(e,t,n=null,r=e){let i=MC(e,t),a=i&&NC(r,t);return a?i.map(jC).concat({type:t,attrs:n}).concat(a.map(jC)):null}function jC(e){return{type:e,attrs:null}}function MC(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function NC(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function PC(e,t,n){let r=V.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=V.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new SC(i,a,i,a,new H(r,0,0),n.length,!0))}function FC(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&RC(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&LC(e,t,n,a),EC(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new SC(c,l,c+1,l-1,new H(V.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&IC(e,t,n,a),!1}})}function IC(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function LC(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
50
|
-
`))}})}function RC(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function zC(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new SC(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new H(V.from(o),0,0),1,!0))}function BC(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function VC(e,t,n=1,r){let i=e.doc.resolve(t),a=V.empty,o=V.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=V.from(i.node(e).copy(a));let t=r&&r[s];o=V.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new xC(t,t,new H(a.append(o),n,n),!0))}function HC(e,t){let n=e.resolve(t),r=n.index();return WC(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function UC(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function WC(e,t){return!!(e&&t&&!e.isLeaf&&UC(e,t))}function GC(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&WC(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function KC(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);LC(e,r.node(),r.before(),s)}o.inlineContent&&EC(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new xC(l,c.map(t+n,-1),H.empty,!0)),r===!0){let t=e.doc.resolve(l);IC(e,t.node(),t.before(),e.steps.length)}return e}function qC(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function JC(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function YC(e,t,n=t,r=H.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return XC(i,a,r)?new xC(t,n,r):new ZC(i,a,r).fit()}function XC(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var ZC=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=V.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=V.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new H(i,a,o);return e>-1?new SC(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new xC(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=ew(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(V.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=ew(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new H(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=ew(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new H(QC(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new H(QC(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(tw(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=$C(this.placed,t,V.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?H.empty:new H(QC(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new H(QC(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!nw(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=nw(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=nw(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=$C(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=$C(this.placed,this.depth,V.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(V.empty,!0);e.childCount&&(this.placed=$C(this.placed,this.frontier.length,e))}};function QC(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(QC(e.firstChild.content,t-1,n)))}function $C(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy($C(e.lastChild.content,t-1,n)))}function ew(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function tw(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,tw(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(V.empty,!0)))),e.copy(r)}function nw(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!rw(n,a.content,o)?s:null}function rw(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function iw(e){return e.spec.defining||e.spec.definingForContent}function aw(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(XC(i,a,r))return e.step(new xC(t,n,r));let o=lw(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=iw(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new H(ow(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function ow(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(ow(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(V.empty,!0))}return e}function sw(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=qC(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new H(V.from(r),0,0))}function cw(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=lw(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function lw(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var uw=class e extends mC{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return hC.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return hC.fromReplace(e,this.pos,this.pos+1,new H(V.from(r),0,+!t.isLeaf))}getMap(){return dC.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};mC.jsonID(`attr`,uw);var dw=class e extends mC{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return hC.ok(n)}getMap(){return dC.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};mC.jsonID(`docAttr`,dw);var fw=class extends Error{};fw=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},fw.prototype=Object.create(Error.prototype),fw.prototype.constructor=fw,fw.prototype.name=`TransformError`;var pw=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new fC}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new fw(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=H.empty){let r=YC(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new H(V.from(n),0,0))}delete(e,t){return this.replace(e,t,H.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return aw(this,e,t,n),this}replaceRangeWith(e,t,n){return sw(this,e,t,n),this}deleteRange(e,t){return cw(this,e,t),this}lift(e,t){return kC(this,e,t),this}join(e,t=1){return KC(this,e,t),this}wrap(e,t){return PC(this,e,t),this}setBlockType(e,t=e,n,r=null){return FC(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return zC(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new uw(e,t,n)),this}setDocAttribute(e,t){return this.step(new dw(e,t)),this}addNodeMark(e,t){return this.step(new yC(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof zx)t.isInSet(n.marks)&&this.step(new bC(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new bC(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return VC(this,e,t,n),this}addMark(e,t,n){return wC(this,e,t,n),this}removeMark(e,t,n){return TC(this,e,t,n),this}clearIncompatible(e,t,n){return EC(this,e,t,n),this}},mw=Object.create(null),U=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new hw(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=H.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?H.empty:t),o==0&&Cw(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),Cw(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new W(e):Sw(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?Sw(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Sw(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new bw(e.node(0))}static atStart(e){return Sw(e,e,0,0,1)||new bw(e)}static atEnd(e){return Sw(e,e,e.content.size,e.childCount,-1)||new bw(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=mw[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in mw)throw RangeError(`Duplicate use of selection JSON ID `+e);return mw[e]=t,t.prototype.jsonID=e,t}getBookmark(){return W.between(this.$anchor,this.$head).getBookmark()}};U.prototype.visible=!0;var hw=class{constructor(e,t){this.$from=e,this.$to=t}},gw=!1;function _w(e){!gw&&!e.parent.inlineContent&&(gw=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var W=class e extends U{constructor(e,t=e){_w(e),_w(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return U.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=H.empty){if(super.replace(e,t),t==H.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new vw(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=U.findFrom(n,r,!0)||U.findFrom(n,-r,!0);if(e)n=e.$head;else return U.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(U.findFrom(t,-r,!0)||U.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};U.jsonID(`text`,W);var vw=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return W.between(e.resolve(this.anchor),e.resolve(this.head))}},G=class e extends U{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?U.near(a):new e(a)}content(){return new H(V.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new yw(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};G.prototype.visible=!1,U.jsonID(`node`,G);var yw=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new vw(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&G.isSelectable(n)?new G(t):U.near(t)}},bw=class e extends U{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=H.empty){if(t==H.empty){e.delete(0,e.doc.content.size);let t=U.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return xw}};U.jsonID(`all`,bw);var xw={map(){return this},resolve(e){return new bw(e)}};function Sw(e,t,n,r,i,a=!1){if(t.inlineContent)return W.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=Sw(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&G.isSelectable(r))return G.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function Cw(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof xC||i instanceof SC))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(U.near(e.doc.resolve(o),n))}var ww=1,Tw=2,Ew=4,Dw=class extends pw{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|ww)&~Tw,this.storedMarks=null,this}get selectionSet(){return(this.updated&ww)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Tw,this}ensureMarks(e){return zx.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Tw)>0}addStep(e,t){super.addStep(e,t),this.updated&=~Tw,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||zx.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(U.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Ew,this}get scrolledIntoView(){return(this.updated&Ew)>0}};function Ow(e,t){return!t||!e?e:e.bind(t)}var kw=class{constructor(e,t,n){this.name=e,this.init=Ow(t.init,n),this.apply=Ow(t.apply,n)}},Aw=[new kw(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new kw(`selection`,{init(e,t){return e.selection||U.atStart(t.doc)},apply(e){return e.selection}}),new kw(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new kw(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],jw=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Aw.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new kw(e.key,e.spec.state,e))})}},Mw=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new Dw(this)}static create(t){let n=new jw(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new jw(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new jw(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=aS.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=U.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function Nw(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=Nw(i,t,{})),n[r]=i}return n}var Pw=class{constructor(e){this.spec=e,this.props={},e.props&&Nw(e.props,this,this.props),this.key=e.key?e.key.key:Iw(`plugin`)}getState(e){return e[this.key]}},Fw=Object.create(null);function Iw(e){return e in Fw?e+`$`+ ++Fw[e]:(Fw[e]=0,e+`$`)}var Lw=class{constructor(e=`key`){this.key=Iw(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},Rw=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function zw(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var Bw=(e,t,n)=>{let r=zw(e,n);if(!r)return!1;let i=Kw(r);if(!i){let n=r.blockRange(),i=n&&OC(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(uT(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Ww(a,`end`)||G.isSelectable(a)))for(let n=r.depth;;n--){let o=YC(e.doc,r.before(n),r.after(n),H.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(Ww(a,`end`)?U.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):G.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Vw=(e,t,n)=>{let r=zw(e,n);if(!r)return!1;let i=Kw(r);return i?Uw(e,i,t):!1},Hw=(e,t,n)=>{let r=qw(e,n);if(!r)return!1;let i=Xw(r);return i?Uw(e,i,t):!1};function Uw(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=YC(e.doc,i,o,H.empty);if(!s||s.from!=i||s instanceof xC&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(W.create(t.doc,i)),n(t.scrollIntoView())}return!0}function Ww(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Gw=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=Kw(r)}let o=a&&a.nodeBefore;return!o||!G.isSelectable(o)?!1:(t&&t(e.tr.setSelection(G.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Kw(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function qw(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var Jw=(e,t,n)=>{let r=qw(e,n);if(!r)return!1;let i=Xw(r);if(!i)return!1;let a=i.nodeAfter;if(uT(e,i,t,1))return!0;if(r.parent.content.size==0&&(Ww(a,`start`)||G.isSelectable(a))){let n=YC(e.doc,r.before(),r.after(),H.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Ww(a,`start`)?U.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):G.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Yw=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=Xw(r)}let o=a&&a.nodeAfter;return!o||!G.isSelectable(o)?!1:(t&&t(e.tr.setSelection(G.create(e.doc,a.pos)).scrollIntoView()),!0)};function Xw(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var Zw=(e,t)=>{let n=e.selection,r=n instanceof G,i;if(r){if(n.node.isTextblock||!HC(e.doc,n.from))return!1;i=n.from}else if(i=GC(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(G.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},Qw=(e,t)=>{let n=e.selection,r;if(n instanceof G){if(n.node.isTextblock||!HC(e.doc,n.to))return!1;r=n.to}else if(r=GC(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},$w=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&OC(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},eT=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
51
|
-
`).scrollIntoView()),!0)};function tT(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var nT=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=tT(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(U.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},rT=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof bw||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=tT(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(W.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},iT=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(BC(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&OC(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function aT(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof G&&t.selection.node.isBlock)return!r.parentOffset||!BC(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=tT(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof W||t.selection instanceof bw)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=BC(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,BC(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var oT=aT(),sT=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(G.create(e.doc,i))),!0)},cT=(e,t)=>(t&&t(e.tr.setSelection(new bw(e.doc))),!0);function lT(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||HC(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function uT(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&lT(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=V.empty;for(let e=o.length-1;e>=0;e--)s=V.from(o[e].create(null,s));s=V.from(i.copy(s));let c=e.tr.step(new SC(t.pos-1,r,t.pos,r,new H(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&HC(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:U.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&OC(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&Ww(a,`start`,!0)&&Ww(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=V.empty;for(let e=o.length-1;e>=0;e--)r=V.from(o[e].copy(r));n(e.tr.step(new SC(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new H(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function dT(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(W.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var fT=dT(-1),pT=dT(1);function mT(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&AC(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function hT(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function gT(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var _T=gT(Rw,Bw,Gw),vT=gT(Rw,Jw,Yw),yT={Enter:gT(eT,rT,iT,oT),"Mod-Enter":nT,Backspace:_T,"Mod-Backspace":_T,"Shift-Backspace":_T,Delete:vT,"Mod-Delete":vT,"Mod-a":cT},bT={"Ctrl-h":yT.Backspace,"Alt-Backspace":yT[`Mod-Backspace`],"Ctrl-d":yT.Delete,"Ctrl-Alt-Backspace":yT[`Mod-Delete`],"Alt-Delete":yT[`Mod-Delete`],"Alt-d":yT[`Mod-Delete`],"Ctrl-a":fT,"Ctrl-e":pT};for(let e in yT)bT[e]=yT[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function xT(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return ST(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function ST(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new rS(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new rS(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=AC(a,n,r,t);return s?(e&&CT(e,t,s,i,n),!0):!1}function CT(e,t,n,r,i){let a=V.empty;for(let e=n.length-1;e>=0;e--)a=V.from(n[e].type.create(n[e].attrs,a));e.step(new SC(t.start-(r?2:0),t.end,t.start,t.end,new H(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&BC(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function wT(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?TT(t,n,e,a):ET(t,n,a):!0:!1}}function TT(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new SC(a-1,o,a,o,new H(V.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new rS(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=OC(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return HC(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function ET(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?V.empty:V.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new SC(d-+!!s,f+ +!!c,d+1,f-1,new H((s?V.empty:V.from(i.copy(V.empty))).append(c?V.empty:V.from(i.copy(V.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function DT(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=V.from(r?e.create():null),o=new H(V.from(e.create(null,V.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new SC(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var OT=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},kT=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},AT=null,jT=function(e,t,n){let r=AT||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},MT=function(){AT=null},NT=function(e,t,n,r){return n&&(FT(e,t,n,r,-1)||FT(e,t,n,r,1))},PT=/^(img|br|input|textarea|hr)$/i;function FT(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:IT(e))){let n=e.parentNode;if(!n||n.nodeType!=1||BT(e)||PT.test(e.nodeName)||e.contentEditable==`false`)return!1;t=OT(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?IT(e):0}else return!1}}function IT(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function LT(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=IT(e)}else if(e.parentNode&&!BT(e))t=OT(e),e=e.parentNode;else return null}}function RT(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!BT(e))t=OT(e)+1,e=e.parentNode;else return null}}function zT(e,t,n){for(let r=t==0,i=t==IT(e);r||i;){if(e==n)return!0;let t=OT(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==IT(e)}}function BT(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var VT=function(e){return e.focusNode&&NT(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function HT(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function UT(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function WT(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(IT(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(IT(r.startContainer),r.startOffset)}}}var GT=typeof navigator<`u`?navigator:null,KT=typeof document<`u`?document:null,qT=GT&>.userAgent||``,JT=/Edge\/(\d+)/.exec(qT),YT=/MSIE \d/.exec(qT),XT=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(qT),ZT=!!(YT||XT||JT),QT=YT?document.documentMode:XT?+XT[1]:JT?+JT[1]:0,$T=!ZT&&/gecko\/(\d+)/i.test(qT);$T&&+(/Firefox\/(\d+)/.exec(qT)||[0,0])[1];var eE=!ZT&&/Chrome\/(\d+)/.exec(qT),tE=!!eE,nE=eE?+eE[1]:0,rE=!ZT&&!!GT&&/Apple Computer/.test(GT.vendor),iE=rE&&(/Mobile\/\w+/.test(qT)||!!GT&>.maxTouchPoints>2),aE=iE||(GT?/Mac/.test(GT.platform):!1),oE=GT?/Win/.test(GT.platform):!1,sE=/Android \d/.test(qT),cE=!!KT&&`webkitFontSmoothing`in KT.documentElement.style,lE=cE?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function uE(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function dE(e,t){return typeof e==`number`?e:e[t]}function fE(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function pE(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=kT(o);continue}let e=o,n=e==a.body,s=n?uE(a):fE(e),c=0,l=0;if(t.top<s.top+dE(r,`top`)?l=-(s.top-t.top+dE(i,`top`)):t.bottom>s.bottom-dE(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+dE(i,`top`)-s.top:t.bottom-s.bottom+dE(i,`bottom`)),t.left<s.left+dE(r,`left`)?c=-(s.left-t.left+dE(i,`left`)):t.right>s.right-dE(r,`right`)&&(c=t.right-s.right+dE(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:kT(o)}}function mE(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:hE(e.dom)}}function hE(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=kT(r));return t}function gE({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;_E(n,r==0?0:r-t)}function _E(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var vE=null;function yE(e){if(e.setActive)return e.setActive();if(vE)return e.focus(vE);let t=hE(e);e.focus(vE==null?{get preventScroll(){return vE={preventScroll:!0},!0}}:void 0),vE||(vE=!1,_E(t,0))}function bE(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=jT(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?xE(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:bE(n,i)}function xE(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=kE(r,1);if(n.top!=n.bottom&&SE(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function SE(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function CE(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function wE(e,t,n){let{node:r,offset:i}=bE(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function TE(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function EE(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(SE(t,i))return EE(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function DE(e,t){let n=e.dom.ownerDocument,r,i=0,a=WT(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!SE(t,n)||(o=EE(e.dom,t,n),!o))return null}if(rE)for(let e=o;r&&e;e=kT(e))e.draggable&&(r=void 0);if(o=CE(o,t),r){if($T&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;cE&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=TE(e,r,i,t))}s??=wE(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function OE(e){return e.top<e.bottom||e.left<e.right}function kE(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(OE(e))return e}return Array.prototype.find.call(n,OE)||e.getBoundingClientRect()}var AE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function jE(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=cE||$T;if(r.nodeType==3)if(o&&(AE.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=kE(jT(r,i,i),n);if($T&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=kE(jT(r,i-1,i-1),-1);if(t.top==e.top){let n=kE(jT(r,i,i+1),-1);if(n.top!=e.top)return ME(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,ME(kE(jT(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==IT(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return NE(e.getBoundingClientRect(),!1)}if(a==null&&i<IT(r)){let e=r.childNodes[i];if(e.nodeType==1)return NE(e.getBoundingClientRect(),!0)}return NE(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==IT(r))){let e=r.childNodes[i-1],t=e.nodeType==3?jT(e,IT(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return ME(kE(t,1),!1)}if(a==null&&i<IT(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?jT(e,0,+!o):e.nodeType==1?e:null:null;if(t)return ME(kE(t,-1),!0)}return ME(kE(r.nodeType==3?jT(r):r,-n),n>=0)}function ME(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function NE(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function PE(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function FE(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return PE(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=jE(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=jT(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var IE=/[\u0590-\u08ac]/;function LE(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!IE.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:PE(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var RE=null,zE=null,BE=!1;function VE(e,t,n){return RE==t&&zE==n?BE:(RE=t,zE=n,BE=n==`up`||n==`down`?FE(e,t,n):LE(e,t,n))}var HE=0,UE=1,WE=2,GE=3,KE=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=HE,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>OT(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof $E){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof qE&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?OT(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?OT(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=OT(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=OT(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if(($T||rE)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
52
|
-
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:OT(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if($T&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&rE)&&NT(o.node,o.offset,l.anchorNode,l.anchorOffset)&&NT(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&$T)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?WE:UE,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=GE:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?WE:GE}n=a}this.dirty=WE}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?WE:UE;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},qE=class extends KE{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==HE&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},JE=class extends KE{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},YE=class e extends KE{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=JS.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&GE||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=GE&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=HE){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=HE}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=gD(a,n,o,r)),t>0&&(a=gD(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},XE=class e extends KE{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=JS.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=sD(u,r,n),l?c=new eD(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new QE(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>V.empty)}return e}matchesNode(e,t,n){return this.dirty==HE&&e.eq(this.node)&&cD(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new uD(this,a&&a.node,e);pD(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?zx.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==WE)&&(a&&this.protectLocalComposition(e,a),tD(this.contentDOM,this.children,e),iE&&mD(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof W)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=hD(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new JE(this,i,t,r);e.input.compositionNodes.push(a),this.children=gD(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==GE||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=HE}updateOuterDeco(e){if(cD(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=aD(this.dom,this.nodeDOM,iD(this.outerDeco,this.node,t),iD(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function ZE(e,t,n,r,i){sD(r,t,e);let a=new XE(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var QE=class e extends XE{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==GE||this.dirty!=HE&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=HE||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=HE,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=GE)}get domAtom(){return!1}isText(e){return this.node.text==e}},$E=class extends KE{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==HE&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},eD=class extends XE{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==GE)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function tD(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=lD(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof YE){let t=r?r.previousSibling:e.lastChild;tD(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=lD(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var nD=function(e){e&&(this.nodeName=e)};nD.prototype=Object.create(null);var rD=[new nD];function iD(e,t,n){if(e.length==0)return rD;let r=n?rD[0]:new nD,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new nD(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new nD(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function aD(e,t,n,r){if(n==rD&&r==rD)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=rD[0],i=t)}oD(i,o||rD[0],a)}return i}function oD(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function sD(e,t,n){return aD(e,e,rD,iD(t,n,e.nodeType!=1))}function cD(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function lD(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var uD=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=dD(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=HE,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=YE.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==GE&&a.dom==a.contentDOM&&(a.dirty=WE),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof XE){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=GE&&cD(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=WE,u.updateChildren(r,a+1),u.dirty=HE),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!cD(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=XE.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=XE.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new qE(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof YE;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof QE)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((rE||tE)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new $E(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function dD(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof YE)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function fD(e,t){return e.type.side-t.type.side}function pD(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(fD);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function mD(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function hD(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function gD(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function _D(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(VT(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&G.isSelectable(e)&&i.parent&&!(e.isInline&&zT(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new G(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=OD(e,u,s,n)}return l}function vD(e){return e.editable?e.hasFocus():AD(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function yD(e,t=!1){let n=e.state.selection;if(ED(e,n),vD(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&tE){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&NT(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)TD(e);else{let{anchor:r,head:i}=n,a,o;bD&&!(n instanceof W)&&(n.$from.parent.inlineContent||(a=xD(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=xD(e,n.to))),e.docView.setSelection(r,i,e,t),bD&&(a&&CD(a),o&&CD(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&wD(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var bD=rE||tE&&nE<63;function xD(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(rE&&i&&i.contentEditable==`false`)return SD(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return SD(i);if(a)return SD(a)}}function SD(e){return e.contentEditable=`true`,rE&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function CD(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function wD(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!vD(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function TD(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,OT(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&ZT&&QT<=11&&(n.disabled=!0,n.disabled=!1)}function ED(e,t){if(t instanceof G){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(DD(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else DD(e)}function DD(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function OD(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||W.between(t,n,r)}function kD(e){return e.editable&&!e.hasFocus()?!1:AD(e)}function AD(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function jD(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return NT(t.node,t.offset,n.anchorNode,n.anchorOffset)}function MD(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&U.findFrom(a,t)}function ND(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function PD(e,t,n){let r=e.state.selection;if(r instanceof W){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return ND(e,new W(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=MD(e.state,t);return n&&n instanceof G?ND(e,n):!1}else if(!(aE&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?G.isSelectable(i)?ND(e,new G(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):cE?ND(e,new W(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof G&&r.node.isInline)return ND(e,new W(t>0?r.$to:r.$from));else{let n=MD(e.state,t);return n?ND(e,n):!1}}function FD(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function ID(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function LD(e,t){return t<0?RD(e):zD(e)}function RD(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for($T&&n.nodeType==1&&r<FD(n)&&ID(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(ID(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(BD(n))break;else{let t=n.previousSibling;for(;t&&ID(t,-1);)i=n.parentNode,a=OT(t),t=t.previousSibling;if(t)n=t,r=FD(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?UD(e,n,r):i&&UD(e,i,a)}function zD(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=FD(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(ID(e,1))a=n,o=++r;else break}else if(BD(n))break;else{let t=n.nextSibling;for(;t&&ID(t,1);)a=t.parentNode,o=OT(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=FD(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&UD(e,a,o)}function BD(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function VD(e,t){for(;e&&t==e.childNodes.length&&!BT(e);)t=OT(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function HD(e,t){for(;e&&!t&&!BT(e);)t=OT(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function UD(e,t,n){if(t.nodeType!=3){let e,r;(r=VD(t,n))?(t=r,n=0):(e=HD(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(VT(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&yD(e)},50)}function WD(e,t){let n=e.state.doc.resolve(t);if(!(tE||oE)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function GD(e,t,n){let r=e.state.selection;if(r instanceof W&&!r.empty||n.indexOf(`s`)>-1||aE&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=MD(e.state,t);if(n&&n instanceof G)return ND(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof bw?U.near(n,t):U.findFrom(n,t);return o?ND(e,o):!1}return!1}function KD(e,t){if(!(e.state.selection instanceof W))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function qD(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function JD(e){if(!rE||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;qD(e,n,`true`),setTimeout(()=>qD(e,n,`false`),20)}return!1}function YD(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function XD(e,t){let n=t.keyCode,r=YD(t);if(n==8||aE&&n==72&&r==`c`)return KD(e,-1)||LD(e,-1);if(n==46&&!t.shiftKey||aE&&n==68&&r==`c`)return KD(e,1)||LD(e,1);if(n==13||n==27)return!0;if(n==37||aE&&n==66&&r==`c`){let t=n==37?WD(e,e.state.selection.from)==`ltr`?-1:1:-1;return PD(e,t,r)||LD(e,t)}else if(n==39||aE&&n==70&&r==`c`){let t=n==39?WD(e,e.state.selection.from)==`ltr`?1:-1:1;return PD(e,t,r)||LD(e,t)}else if(n==38||aE&&n==80&&r==`c`)return GD(e,-1,r)||LD(e,-1);else if(n==40||aE&&n==78&&r==`c`)return JD(e)||GD(e,1,r)||LD(e,1);else if(r==(aE?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function ZD(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||JS.fromSchema(e.state.schema),s=cO(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=oO[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
53
|
-
|
|
54
|
-
`),slice:t}}function QD(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new H(V.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
55
|
-
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=JS.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=dO(n),cE&&fO(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||PS.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!$D.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=pO(aO(s,+u[1],+u[2]),u[4]);else if(s=H.maxOpen(eO(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=aO(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var $D=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function eO(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&nO(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=rO(a[a.length-1],i.length));let n=tO(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return V.from(a)}return e}function tO(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,V.from(e));return e}function nO(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=nO(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(V.from(tO(n,e,i+1))))}}function rO(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,rO(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(V.empty,!0);return e.copy(n.append(r))}function iO(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=iO(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(V.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function aO(e,t,n){return t<e.openStart&&(e=new H(iO(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new H(iO(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var oO={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},sO=null;function cO(){return sO||=document.implementation.createHTMLDocument(`title`)}var lO=null;function uO(e){let t=window.trustedTypes;return t?(lO||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),lO.createHTML(e)):e}function dO(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=cO().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&oO[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=uO(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function fO(e){let t=e.querySelectorAll(tE?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function pO(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=V.from(t.create(r[e+1],i)),a++,o++}return new H(i,a,o)}var mO={},hO={},gO={touchstart:!0,touchmove:!0},_O=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function vO(e){for(let t in mO){let n=mO[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{CO(e,t)&&!SO(e,t)&&(e.editable||!(t.type in hO))&&n(e,t)},gO[t]?{passive:!0}:void 0)}rE&&e.dom.addEventListener(`input`,()=>null),xO(e)}function yO(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function bO(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function xO(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>SO(e,t))})}function SO(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function CO(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function wO(e,t){!SO(e,t)&&mO[t.type]&&(e.editable||!(t.type in hO))&&mO[t.type](e,t)}hO.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!RO(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(sE&&tE&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),iE&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,HT(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||XD(e,n)?n.preventDefault():yO(e,`key`)},hO.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},hO.keypress=(e,t)=>{let n=t;if(RO(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||aE&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof W)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function TO(e){return{left:e.clientX,top:e.clientY}}function EO(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function DO(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function OO(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function kO(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&G.isSelectable(r)?(OO(e,new G(n),`pointer`),!0):!1}function AO(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof G&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(G.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(OO(e,G.create(e.state.doc,i),`pointer`),!0)}function jO(e,t,n,r,i){return DO(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?AO(e,n):kO(e,n))}function MO(e,t,n,r){return DO(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function NO(e,t,n,r){return DO(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||PO(e,n,r)}function PO(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(OO(e,W.create(r,0,r.content.size),`pointer`),!0):!1;let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(n.inlineContent)OO(e,W.create(r,a+1,a+1+n.content.size),`pointer`);else if(G.isSelectable(n))OO(e,G.create(r,a),`pointer`);else continue;return!0}}function FO(e){return GO(e)}var IO=aE?`metaKey`:`ctrlKey`;mO.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=FO(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&EO(n,e.input.lastClick)&&!n[IO]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=e.posAtCoords(TO(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new LO(e,o,n,!!r)):(a==`doubleClick`?MO:NO)(e,o.pos,o.inside,n)?n.preventDefault():yO(e,`pointer`))};var LO=class{constructor(e,t,n,r){this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[IO],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof G&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&$T&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this)),yO(e,`pointer`)}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>yD(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(TO(e))),this.updateAllowDefault(e),this.allowDefault||!t?yO(this.view,`pointer`):jO(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||rE&&this.mightDrag&&!this.mightDrag.node.isAtom||tE&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(OO(this.view,U.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):yO(this.view,`pointer`)}move(e){this.updateAllowDefault(e),yO(this.view,`pointer`),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};mO.touchstart=e=>{e.input.lastTouch=Date.now(),FO(e),yO(e,`pointer`)},mO.touchmove=e=>{e.input.lastTouch=Date.now(),yO(e,`pointer`)},mO.contextmenu=e=>FO(e);function RO(e,t){return e.composing?!0:rE&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var zO=sE?5e3:-1;hO.compositionstart=hO.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof W&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||tE&&oE&&BO(e)))e.markCursor=e.state.storedMarks||n.marks(),GO(e,!0),e.markCursor=null;else if(GO(e,!t.selection.empty),$T&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}VO(e,zO)};function BO(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}hO.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,VO(e,20))};function VO(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>GO(e),t))}function HO(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=WO());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function UO(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=LT(t.focusNode,t.focusOffset),r=RT(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function WO(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function GO(e,t=!1){if(!(sE&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),HO(e),t||e.docView&&e.docView.dirty){let n=_D(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function KO(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var qO=ZT&&QT<15||iE&&lE<604;mO.copy=hO.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=qO?null:n.clipboardData,{dom:o,text:s}=ZD(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):KO(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function JO(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function YO(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?XO(e,r.value,null,i,t):XO(e,r.textContent,r.innerHTML,i,t)},50)}function XO(e,t,n,r,i){let a=QD(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||H.empty)))return!0;if(!a)return!1;let o=JO(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function ZO(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}hO.paste=(e,t)=>{let n=t;if(e.composing&&!sE)return;let r=qO?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&XO(e,ZO(r),r.getData(`text/html`),i,n)?n.preventDefault():YO(e,n)};var QO=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},$O=aE?`altKey`:`ctrlKey`;function ek(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[$O]:!n}mO.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(TO(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof G?i.to-1:i.to))){if(r&&r.mightDrag)o=G.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=G.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=ZD(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!tE||nE>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(qO?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,qO||n.dataTransfer.setData(`text/plain`,c),e.dragging=new QO(l,ek(e,n),o)},mO.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},hO.dragover=hO.dragenter=(e,t)=>t.preventDefault(),hO.drop=(e,t)=>{try{tk(e,t,e.dragging)}finally{e.dragging=null}};function tk(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(TO(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=QD(e,ZO(t.dataTransfer),qO?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&ek(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||H.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?JC(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&G.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new G(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(OD(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}mO.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&yD(e)},20))},mO.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},mO.beforeinput=(e,t)=>{if(tE&&sE&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,HT(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in hO)mO[e]=hO[e];function nk(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var rk=class e{constructor(e,t){this.toDOM=e,this.spec=t||ck,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new ok(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&nk(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},ik=class e{constructor(e,t){this.attrs=e,this.spec=t||ck}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new ok(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&nk(this.attrs,t.attrs)&&nk(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},ak=class e{constructor(e,t){this.attrs=e,this.spec=t||ck}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new ok(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&nk(this.attrs,t.attrs)&&nk(this.spec,t.spec)}destroy(){}},ok=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new rk(n,r))}static inline(t,n,r,i){return new e(t,n,new ik(r,i))}static node(t,n,r,i){return new e(t,n,new ak(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ik}get widget(){return this.type instanceof rk}},sk=[],ck={},lk=class e{constructor(e,t){this.local=e.length?e:sk,this.children=t.length?t:sk}static create(e,t){return t.length?_k(t,e,0,ck):uk}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==uk||e.maps.length==0?this:this.mapInner(e,t,0,0,n||ck)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?fk(this.children,o||[],t,n,r,i,a):o?new e(o.sort(vk),sk):uk}add(t,n){return n.length?this==uk?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=hk(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,_k(s,e,o+1,ck)),a+=3}});let o=pk(a?gk(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(vk):this.local,i||this.children)}remove(e){return e.length==0||this==uk?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==uk?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):uk}forChild(t,n){if(this==uk)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof ik){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(vk),sk);return r?new dk([t,r]):t}return r||uk}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return yk(this.localsInner(e))}localsInner(e){if(this==uk)return sk;if(e.inlineContent||!this.local.some(ik.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof ik||t.push(this.local[e]);return t}forEachSet(e){e(this)}};lk.empty=new lk([],[]),lk.removeOverlap=yk;var uk=lk.empty,dk=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,ck));return e.from(r)}forChild(t,n){if(n.isLeaf)return lk.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=uk&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?yk(n?t:t.sort(vk)):sk}static from(t){switch(t.length){case 0:return uk;case 1:return t[0];default:return new e(t.every(e=>e instanceof lk)?t:t.reduce((e,t)=>e.concat(t instanceof lk?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function fk(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==uk?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=_k(mk(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new lk(t.sort(vk),s)}function pk(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new ok(i.from+t,i.to+t,i.type))}return n}function mk(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function hk(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function gk(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function _k(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=hk(e,t,o+n);if(s){a=!0;let e=_k(s,t,n+o+1,r);e!=uk&&i.push(o,o+t.nodeSize,e)}});let o=pk(a?gk(e):e,-n).sort(vk);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new lk(o,i):uk}function vk(e,t){return e.from-t.from||e.to-t.to}function yk(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),bk(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),bk(t,i,r.copy(a.from,r.to)));break}}}return t}function bk(e,t,n){for(;t<e.length&&vk(n,e[t])>0;)t++;e.splice(t,0,n)}function xk(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=uk&&t.push(r)}),e.cursorWrapper&&t.push(lk.create(e.state.doc,[e.cursorWrapper.deco])),dk.from(t)}var Sk={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ck=ZT&&QT<=11,wk=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},Tk=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new wk,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);ZT&&QT<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():rE&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ck&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Sk)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(kD(this.view)){if(this.suppressingSelectionUpdates)return yD(this.view);if(ZT&&QT<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&NT(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=kT(n))t.add(n);for(let r=e.anchorNode;r;r=kT(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&kD(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if($T&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||jk(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&VT(n)&&(c=_D(e))&&c.eq(U.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,yD(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Ok(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Mk(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||yD(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(ZT&&QT<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?OT(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?OT(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},Ek=new WeakMap,Dk=!1;function Ok(e){if(!Ek.has(e)&&(Ek.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=$T,Dk)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),Dk=!0}}function kk(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return NT(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function Ak(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return kk(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?kk(e,n):null}function jk(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Mk(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function Nk(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],VT(c)||l.push({node:c.focusNode,offset:c.focusOffset})),tE&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||PS.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:Pk,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function Pk(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(rE&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||rE&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var Fk=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Ik(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=_D(e,t);if(n&&!e.state.selection.eq(n)){if(tE&&sE&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,HT(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=Nk(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=Vk(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(iE&&e.input.lastIOSEnter>Date.now()-225||sE)&&i.some(e=>e.nodeType==1&&!Fk.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,HT(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof W&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Lk(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof W&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),ZT&&QT<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((iE&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,HT(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&zk(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,HT(8,`Backspace`)))){sE&&tE&&e.domObserver.suppressSelectionUpdates();return}tE&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),sE&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,HT(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Lk(e,n.doc,l.sel);t&&!(tE&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||ZT&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){ZT&&QT<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>yD(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=Rk(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function Lk(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:OD(e,t.resolve(n.anchor),t.resolve(n.head))}function Rk(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(V.from(l).eq(e))return{mark:s,type:o}}function zk(e,t,n,r,i){if(n-t<=i.pos-r.pos||Bk(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(Bk(a,!0,!0));return!o.parent.isTextblock||o.pos>n||Bk(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Bk(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Vk(e,t,n,r,i){let a=e.findDiffStart(t,n);if(a==null)return null;let{a:o,b:s}=e.findDiffEnd(t,n+e.size,n+t.size);if(i==`end`){let e=Math.max(0,a-Math.min(o,s));r-=o+e-a}if(o<a&&e.size<t.size){let e=r<=a&&r>=o?a-r:0;a-=e,a&&a<t.size&&Hk(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=r<=a&&r>=s?a-r:0;a-=t,a&&a<e.size&&Hk(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function Hk(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var Uk=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new _O,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Xk),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Kk(this),Gk(this),this.nodeViews=Jk(this),this.docView=ZE(this.state.doc,Wk(this),xk(this),this.dom,this),this.domObserver=new Tk(this,(e,t,n,r)=>Ik(this,e,t,n,r)),this.domObserver.start(),vO(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&xO(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Xk),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(HO(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Jk(this);Yk(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&xO(this),this.editable=Kk(this),Gk(this);let o=xk(this),s=Wk(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&mE(this);if(i){this.domObserver.stop();let t=l&&(ZT||tE)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&qk(n.selection,e.selection);if(l){let n=tE?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=UO(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=ZE(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&jD(this))?yD(this,t):(ED(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&gE(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof G){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&pE(this,t.getBoundingClientRect(),e)}else pE(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new QO(e.slice,e.move,r<0?void 0:G.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(ZT){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&yE(this.dom),yD(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return DE(this,e)}coordsAtPos(e,t=1){return jE(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return VE(this,t||this.state,e)}pasteHTML(e,t){return XO(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return XO(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return ZD(this,e)}destroy(){this.docView&&(bO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],xk(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,MT())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return wO(this,e)}domSelectionRange(){let e=this.domSelection();return e?rE&&this.root.nodeType===11&&UT(this.dom.ownerDocument)==this.dom&&Ak(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Uk.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Wk(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[ok.node(0,e.state.doc.content.size,t)]}function Gk(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:ok.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Kk(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function qk(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function Jk(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function Yk(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function Xk(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}var Zk=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Qk=typeof navigator<`u`&&/Win/.test(navigator.platform);function $k(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))Zk?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function eA(e){let t=Object.create(null);for(let n in e)t[$k(n)]=e[n];return t}function tA(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function nA(e){return new Pw({props:{handleKeyDown:rA(e)}})}function rA(e){let t=eA(e);return function(e,n){let r=$o(n),i,a=t[tA(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[tA(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Qk&&n.ctrlKey&&n.altKey)&&(i=qo[n.keyCode])&&i!=r){let r=t[tA(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var iA=Object.defineProperty,aA=(e,t)=>{for(var n in t)iA(e,n,{get:t[n],enumerable:!0})};function oA(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var sA=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:oA({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},cA={};aA(cA,{blur:()=>lA,clearContent:()=>uA,clearNodes:()=>dA,command:()=>fA,createParagraphNear:()=>pA,cut:()=>mA,deleteCurrentNode:()=>hA,deleteNode:()=>_A,deleteRange:()=>vA,deleteSelection:()=>yA,enter:()=>bA,exitCode:()=>xA,extendMarkRange:()=>OA,first:()=>kA,focus:()=>IA,forEach:()=>LA,insertContent:()=>RA,insertContentAt:()=>WA,joinBackward:()=>qA,joinDown:()=>KA,joinForward:()=>JA,joinItemBackward:()=>YA,joinItemForward:()=>XA,joinTextblockBackward:()=>ZA,joinTextblockForward:()=>QA,joinUp:()=>GA,keyboardShortcut:()=>tj,lift:()=>rj,liftEmptyBlock:()=>ij,liftListItem:()=>aj,newlineInCode:()=>oj,resetAttributes:()=>lj,scrollIntoView:()=>uj,selectAll:()=>dj,selectNodeBackward:()=>fj,selectNodeForward:()=>pj,selectParentNode:()=>mj,selectTextblockEnd:()=>hj,selectTextblockStart:()=>gj,setContent:()=>vj,setMark:()=>hM,setMeta:()=>gM,setNode:()=>_M,setNodeSelection:()=>vM,setTextDirection:()=>yM,setTextSelection:()=>bM,sinkListItem:()=>xM,splitBlock:()=>CM,splitListItem:()=>wM,toggleList:()=>OM,toggleMark:()=>kM,toggleNode:()=>AM,toggleWrap:()=>jM,undoInputRule:()=>MM,unsetAllMarks:()=>NM,unsetMark:()=>PM,unsetTextDirection:()=>FM,updateAttributes:()=>IM,wrapIn:()=>LM,wrapInList:()=>RM});var lA=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),uA=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),dA=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=OC(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},fA=e=>t=>e(t),pA=()=>({state:e,dispatch:t})=>rT(e,t),mA=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new W(r.doc.resolve(Math.max(o-1,0)))),!0},hA=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function gA(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var _A=e=>({tr:t,state:n,dispatch:r})=>{let i=gA(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},vA=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},yA=()=>({state:e,dispatch:t})=>Rw(e,t),bA=()=>({commands:e})=>e.keyboardShortcut(`Enter`),xA=()=>({state:e,dispatch:t})=>nT(e,t);function SA(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function CA(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:SA(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function wA(e,t,n={}){return e.find(e=>e.type===t&&CA(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function TA(e,t,n={}){return!!wA(e,t,n)}function EA(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!wA([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&TA([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&TA([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function DA(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var OA=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=DA(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=EA(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=W.create(o,e.from,e.to);n.setSelection(t)}}return!0},kA=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function AA(e){return e instanceof W}function jA(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function MA(e,t=null){if(!t)return null;let n=U.atStart(e),r=U.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?W.create(e,jA(0,i,a),jA(e.content.size,i,a)):W.create(e,jA(t,i,a),jA(t,i,a))}function NA(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function PA(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function FA(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var IA=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(PA()||NA())&&r.dom.focus(),FA()&&!PA()&&!NA()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!AA(n.state.selection))return o(),!0;let s=MA(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},LA=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),RA=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),zA=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&zA(r)}return e};function BA(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return zA(n)}function VA(e,t,n){if(e instanceof aS||e instanceof V)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return V.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),VA(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new AS({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?PS.fromSchema(a).parseSlice(BA(e),n.parseOptions):PS.fromSchema(a).parse(BA(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=PS.fromSchema(t);return n.slice?r.parseSlice(BA(e),n.parseOptions).content:r.parse(BA(e),n.parseOptions)}return VA(``,t,n)}function HA(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof xC||i instanceof SC))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(U.near(e.doc.resolve(o),n))}var UA=e=>!(`type`in e),WA=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{VA(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=VA(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((UA(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof V){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&HA(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},GA=()=>({state:e,dispatch:t})=>Zw(e,t),KA=()=>({state:e,dispatch:t})=>Qw(e,t),qA=()=>({state:e,dispatch:t})=>Bw(e,t),JA=()=>({state:e,dispatch:t})=>Jw(e,t),YA=()=>({state:e,dispatch:t,tr:n})=>{try{let r=GC(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},XA=()=>({state:e,dispatch:t,tr:n})=>{try{let r=GC(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},ZA=()=>({state:e,dispatch:t})=>Vw(e,t),QA=()=>({state:e,dispatch:t})=>Hw(e,t);function $A(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function ej(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))PA()||$A()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var tj=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=ej(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function nj(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?gA(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>CA(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var rj=(e,t={})=>({state:n,dispatch:r})=>nj(n,gA(e,n.schema),t)?$w(n,r):!1,ij=()=>({state:e,dispatch:t})=>iT(e,t),aj=e=>({state:t,dispatch:n})=>wT(gA(e,t.schema))(t,n),oj=()=>({state:e,dispatch:t})=>eT(e,t);function sj(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function cj(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var lj=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=sj(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=gA(e,r.schema)),s===`mark`&&(o=DA(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,cj(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(cj(a.attrs,t))))})})}),c},uj=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),dj=()=>({tr:e,dispatch:t})=>{if(t){let t=new bw(e.doc);e.setSelection(t)}return!0},fj=()=>({state:e,dispatch:t})=>Gw(e,t),pj=()=>({state:e,dispatch:t})=>Yw(e,t),mj=()=>({state:e,dispatch:t})=>sT(e,t),hj=()=>({state:e,dispatch:t})=>pT(e,t),gj=()=>({state:e,dispatch:t})=>fT(e,t);function _j(e,t,n={},r={}){return VA(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var vj=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=_j(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function yj(e,t){let n=DA(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function bj(e,t){let n=new pw(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function xj(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Sj(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function Cj(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function wj(e){return t=>Cj(t.$from,e)}function K(e,t,n){return e.config[t]===void 0&&e.parent?K(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?K(e.parent,t,n):null}):e.config[t]}function Tj(e){return e.map(e=>{let t=K(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...Tj(t())]:e}).flat(10)}function Ej(e,t){let n=JS.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function Dj(e){return typeof e==`function`}function Oj(e,t=void 0,...n){return Dj(e)?t?e.bind(t)(...n):e(...n):e}function kj(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Aj(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function jj(e){let t=[],{nodeExtensions:n,markExtensions:r}=Aj(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=K(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=K(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function Mj(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function Nj(e){let t=[],n=Mj(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function Pj(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...Nj(n[e]),...Nj(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function Fj(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>Pj(e,t),{})}function Ij(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function Lj(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):Ij(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function Rj(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&kj(t)?!1:t!=null))}function zj(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function Bj(e,t){let n=jj(e),{nodeExtensions:r,markExtensions:i}=Aj(e);return new AS({topNode:r.find(e=>K(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=Rj({...e.reduce((e,t)=>{let n=K(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:Oj(K(r,`content`,a)),marks:Oj(K(r,`marks`,a)),group:Oj(K(r,`group`,a)),inline:Oj(K(r,`inline`,a)),atom:Oj(K(r,`atom`,a)),selectable:Oj(K(r,`selectable`,a)),draggable:Oj(K(r,`draggable`,a)),code:Oj(K(r,`code`,a)),whitespace:Oj(K(r,`whitespace`,a)),linebreakReplacement:Oj(K(r,`linebreakReplacement`,a)),defining:Oj(K(r,`defining`,a)),isolating:Oj(K(r,`isolating`,a)),attrs:Object.fromEntries(i.map(zj))}),s=Oj(K(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Lj(e,i)));let c=K(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:Fj(e,i)}));let l=K(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=Rj({...e.reduce((e,t)=>{let n=K(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:Oj(K(r,`inclusive`,a)),excludes:Oj(K(r,`excludes`,a)),group:Oj(K(r,`group`,a)),spanning:Oj(K(r,`spanning`,a)),code:Oj(K(r,`code`,a)),attrs:Object.fromEntries(i.map(zj))}),s=Oj(K(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Lj(e,i)));let c=K(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:Fj(e,i)})),[r.name,o]}))})}function Vj(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function Hj(e){return e.sort((e,t)=>{let n=K(e,`priority`)||100,r=K(t,`priority`)||100;return n>r?-1:+(n<r)})}function Uj(e){let t=Hj(Tj(e)),n=Vj(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function Wj(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
|
|
56
|
-
|
|
57
|
-
`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function Gj(e,t){return Wj(e,{from:0,to:e.content.size},t)}function Kj(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function qj(e,t){let n=gA(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function Jj(e,t){let n=sj(typeof t==`string`?t:t.name,e.schema);return n===`node`?qj(e,t):n===`mark`?yj(e,t):{}}function Yj(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function Xj(e){let t=Yj(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Zj(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),Xj(r)}function Qj(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=EA(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var $j=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]};function eM(e,t){return t.nodes[e]||t.marks[e]||null}function tM(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var nM=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function rM(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?DA(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>CA(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>CA(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function iM(e,t,n={}){if(!t)return nj(e,null,n)||rM(e,null,n);let r=sj(t,e.schema);return r===`node`?nj(e,t,n):r===`mark`?rM(e,t,n):!1}var aM=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=wj(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},oM=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function sM(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function cM(e,t){let{nodeExtensions:n}=Aj(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=Oj(K(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function lM(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(lM(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function uM(e){return e instanceof G}var dM=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function fM(e,t){let n=t.mapping.mapResult(e.position);return{position:new dM(n.pos),mapResult:n}}function pM(e){return new dM(e)}function mM(e,t,n){let{selection:r}=t,i=null;if(AA(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var hM=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=DA(e,r.schema);if(i)if(o){let e=yj(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return mM(r,n,c)},gM=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),_M=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=gA(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>hT(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>hT(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},vM=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=jA(e,0,n.content.size),i=G.create(n,r);t.setSelection(i)}return!0},yM=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},bM=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=W.atStart(n).from,o=W.atEnd(n).to,s=jA(r,a,o),c=jA(i,a,o),l=W.create(n,s,c);t.setSelection(l)}return!0},xM=e=>({state:t,dispatch:n})=>DT(gA(e,t.schema))(t,n);function SM(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var CM=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=tM(l,s.node().type.name,s.node().attrs);if(a instanceof G&&a.node.isBlock)return!s.parentOffset||!BC(o,s.pos)?!1:(r&&(e&&SM(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:xj(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=BC(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&BC(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof W&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&SM(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},wM=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=gA(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=V.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=V.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...tM(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(V.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new H(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(W.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...tM(d,u.type.name,u.attrs),...t},m={...tM(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!BC(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},TM=(e,t)=>{let n=wj(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&HC(e.doc,n.pos)&&e.join(n.pos),!0},EM=(e,t)=>{let n=wj(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&HC(e.doc,r)&&e.join(r),!0};function DM(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return W.between(r,i)}var OM=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=gA(e,o.schema),m=gA(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=wj(e=>cM(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,T=S&&w&&cM(w.type.name,d)?{node:w,pos:0,depth:0}:null,E=x??T,ee=!!x&&y.depth>=1&&y.depth-x.depth<=1,te=!!T;if((ee||te)&&E){if(E.node.type===p)return S&&te?c().command(({tr:e,dispatch:t})=>{let n=DM(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(cM(E.node.type.name,d)&&p.validContent(E.node.content))return c().command(()=>(a.setNodeMarkup(E.pos,p),!0)).command(()=>TM(a,p)).command(()=>EM(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>TM(a,p)).command(()=>EM(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>TM(a,p)).command(()=>EM(a,p)).run()},kM=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=DA(e,r.schema);return rM(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},AM=(e,t,n={})=>({state:r,commands:i})=>{let a=gA(e,r.schema),o=gA(t,r.schema),s=nj(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},jM=(e,t={})=>({state:n,commands:r})=>{let i=gA(e,n.schema);return nj(n,i,t)?r.lift(i):r.wrapIn(i,t)},MM=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},NM=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},PM=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=DA(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=EA(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},FM=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},IM=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=sj(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=gA(e,r.schema)),s===`mark`&&(o=DA(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},LM=(e,t={})=>({state:n,dispatch:r})=>mT(gA(e,n.schema),t)(n,r),RM=(e,t={})=>({state:n,dispatch:r})=>xT(gA(e,n.schema),t)(n,r),zM=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},BM=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},VM=(e,t)=>{if(SA(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function HM(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=nM(c)+i;return a.forEach(e=>{if(l)return;let a=VM(u,e.find);if(!a)return;let c=s.state.tr,d=oA({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new sA({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function UM(e){let{editor:t,rules:n}=e,r=new Pw({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:Ej(V.from(e),a.schema);let{from:i}=s;HM({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return HM({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&HM({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?HM({editor:t,from:a.pos,to:a.pos,text:`
|
|
58
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function WM(e){return Object.prototype.toString.call(e).slice(8,-1)}function GM(e){return WM(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function KM(e,t){let n={...e};return GM(e)&&GM(t)&&Object.keys(t).forEach(r=>{GM(t[r])&&GM(e[r])?n[r]=KM(e[r],t[r]):n[r]=t[r]}),n}var qM=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...Oj(K(this,`addOptions`,{name:this.name}))||{}}}get storage(){return{...Oj(K(this,`addStorage`,{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>KM(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},JM=class e extends qM{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function YM(e){return typeof e==`number`}var XM=class{constructor(e){this.find=e.find,this.handler=e.handler}},ZM=(e,t,n)=>{if(SA(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function QM(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new sA({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||ZM(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var $M=null,eN=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function tN(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!QM({editor:t,state:oA({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new Pw({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&($M=t)},i=()=>{$M&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=$M;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:Ej(V.from(t),r.schema);let{from:n}=d,i=n+t.length,a=eN(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!YM(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var nN=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Uj(e),this.schema=Bj(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=K(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:eM(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return Hj([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:eM(t.name,this.schema)},r=[],i=K(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&K(t,`exitable`,n)&&(a.ArrowRight=()=>JM.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=nA(a);r.push(o);let s=K(t,`addInputRules`,n);if(sM(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=UM({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=K(t,`addPasteRules`,n);if(sM(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=tN({editor:e,rules:t});r.push(...n)}}let l=K(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return jj(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=Aj(this.extensions);return Object.fromEntries(t.filter(e=>!!K(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=K(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:gA(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:Fj(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return Hj([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:eM(n.name,this.schema)},i=K(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return Hj([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:eM(n.name,this.schema)},i=K(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=Aj(this.extensions);return Object.fromEntries(t.filter(e=>!!K(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=K(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:DA(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=Fj(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{FN(i,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:eM(e.name,this.schema)};e.type===`mark`&&(Oj(K(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=K(e,`onBeforeCreate`,t),r=K(e,`onCreate`,t),i=K(e,`onUpdate`,t),a=K(e,`onSelectionUpdate`,t),o=K(e,`onTransaction`,t),s=K(e,`onFocus`,t),c=K(e,`onBlur`,t),l=K(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};nN.resolve=Uj,nN.sort=Hj,nN.flatten=Tj;var rN={};aA(rN,{ClipboardTextSerializer:()=>aN,Commands:()=>oN,Delete:()=>sN,Drop:()=>cN,Editable:()=>lN,FocusEvents:()=>dN,Keymap:()=>fN,Paste:()=>pN,Tabindex:()=>mN,TextDirection:()=>hN,focusEventsPluginKey:()=>uN});var iN=class e extends qM{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},aN=iN.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Pw({key:new Lw(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:a}=i,o=Math.min(...a.map(e=>e.$from.pos)),s=Math.max(...a.map(e=>e.$to.pos)),c=Kj(n);return Wj(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),oN=iN.create({name:`commands`,addCommands(){return{...cA}}}),sN=iN.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=bj(e.before,[e,...t]);Zj(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof vC){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),cN=iN.create({name:`drop`,addProseMirrorPlugins(){return[new Pw({key:new Lw(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),lN=iN.create({name:`editable`,addProseMirrorPlugins(){return[new Pw({key:new Lw(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),uN=new Lw(`focusEvents`),dN=iN.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new Pw({key:uN,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),fN=iN.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:U.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return PA()||$A()?i:r},addProseMirrorPlugins(){return[new Pw({key:new Lw(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=U.atStart(t.doc).from,l=U.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!lM(n.doc))return;let u=n.tr,d=oA({state:n,transaction:u}),{commands:f}=new sA({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),pN=iN.create({name:`paste`,addProseMirrorPlugins(){return[new Pw({key:new Lw(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),mN=iN.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Pw({key:new Lw(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),hN=iN.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=Aj(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Pw({key:new Lw(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),gN=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},_N=`.ProseMirror {
|
|
59
|
-
position: relative;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.ProseMirror {
|
|
63
|
-
word-wrap: break-word;
|
|
64
|
-
white-space: pre-wrap;
|
|
65
|
-
white-space: break-spaces;
|
|
66
|
-
-webkit-font-variant-ligatures: none;
|
|
67
|
-
font-variant-ligatures: none;
|
|
68
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.ProseMirror [contenteditable="false"] {
|
|
72
|
-
white-space: normal;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
76
|
-
white-space: pre-wrap;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.ProseMirror pre {
|
|
80
|
-
white-space: pre-wrap;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
img.ProseMirror-separator {
|
|
84
|
-
display: inline !important;
|
|
85
|
-
border: none !important;
|
|
86
|
-
margin: 0 !important;
|
|
87
|
-
width: 0 !important;
|
|
88
|
-
height: 0 !important;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.ProseMirror-gapcursor {
|
|
92
|
-
display: none;
|
|
93
|
-
pointer-events: none;
|
|
94
|
-
position: absolute;
|
|
95
|
-
margin: 0;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.ProseMirror-gapcursor:after {
|
|
99
|
-
content: "";
|
|
100
|
-
display: block;
|
|
101
|
-
position: absolute;
|
|
102
|
-
top: -2px;
|
|
103
|
-
width: 20px;
|
|
104
|
-
border-top: 1px solid black;
|
|
105
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
@keyframes ProseMirror-cursor-blink {
|
|
109
|
-
to {
|
|
110
|
-
visibility: hidden;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.ProseMirror-hideselection *::selection {
|
|
115
|
-
background: transparent;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
119
|
-
background: transparent;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.ProseMirror-hideselection * {
|
|
123
|
-
caret-color: transparent;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
127
|
-
display: block;
|
|
128
|
-
}`;function vN(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}var yN=class extends zM{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:fM,createMappablePosition:pM},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc(),n=MA(t,this.options.autofocus);this.editorState=Mw.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=vN(_N,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=Dj(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){let e=[...this.options.enableCoreExtensions?[lN,aN.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),oN,dN,fN,mN.configure({value:this.options.coreExtensionOptions?.tabindex?.value}),cN,pN,sN,hN.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new nN(e,this)}createCommandManager(){this.commandManager=new sA({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=_j(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=_j(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new Uk(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return Jj(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return iM(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ej(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
129
|
-
|
|
130
|
-
`,textSerializers:n={}}=e||{};return Gj(this.state.doc,{blockSeparator:t,textSerializers:{...Kj(this.schema),...n}})}get isEmpty(){return lM(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){return new gN(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function bN(e){return new BM({find:e.find,handler:({state:t,range:n,match:r})=>{let i=Oj(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Qj(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function xN(e){return new BM({find:e.find,handler:({state:t,range:n,match:r})=>{let i=Oj(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function SN(e){return new BM({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=Oj(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function CN(e){return new BM({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=Oj(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&AC(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&HC(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}function wN(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof G){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function TN(e,t){let n=e.getAttribute(`style`);if(!n)return null;let r=n.split(`;`).map(e=>e.trim()).filter(Boolean),i=t.toLowerCase();for(let e=r.length-1;e>=0;--e){let t=r[e],n=t.indexOf(`:`);if(n!==-1&&t.slice(0,n).trim().toLowerCase()===i)return t.slice(n+1).trim()}return null}aA({},{createAtomBlockMarkdownSpec:()=>ON,createBlockMarkdownSpec:()=>kN,createInlineMarkdownSpec:()=>MN,parseAttributes:()=>EN,parseIndentedBlocks:()=>NN,renderNestedMarkdownContent:()=>PN,serializeAttributes:()=>DN});function EN(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,``).replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function DN(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function ON(e){let{nodeName:t,name:n,parseAttributes:r=EN,serializeAttributes:i=DN,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function kN(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=EN,serializeAttributes:a=DN,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}
|
|
131
|
-
|
|
132
|
-
${t.renderChildren(e.content||[],`
|
|
133
|
-
|
|
134
|
-
`)}
|
|
135
|
-
|
|
136
|
-
:::`}}}function AN(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function jN(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function MN(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=AN,serializeAttributes:a=jN,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=RegExp(s?`\\[${d}\\s*[^\\]]*\\]`:`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(s?`^\\[${d}\\s*([^\\]]*)\\]`:`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function NN(e,t,n){let r=e.split(`
|
|
137
|
-
`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],c=e.match(t.itemPattern);if(!c){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}
|
|
138
|
-
`;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e}
|
|
139
|
-
`;let f=[d];for(o+=1;o<r.length;){let e=r[o];if(e.trim()===``){let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((r[o+1+t].match(/^(\s*)/)?.[1]?.length||0)>u){f.push(e),a=`${a}${e}
|
|
140
|
-
`,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e}
|
|
141
|
-
`,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(`
|
|
142
|
-
`);e.trim()&&(p=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let h=t.createToken(l,p);i.push(h)}if(i.length!==0)return{items:i,raw:a}}function PN(e,t,n,r){if(!e||!Array.isArray(e.content))return``;let i=typeof n==`function`?n(r):n,[a,...o]=e.content,s=`${i}${t.renderChildren([a])}`;return o&&o.length>0&&o.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=r.split(`
|
|
143
|
-
`).map(e=>e?t.indent(e):t.indent(``)).join(`
|
|
144
|
-
`);s+=e.type===`paragraph`?`
|
|
145
|
-
|
|
146
|
-
${n}`:`
|
|
147
|
-
${n}`}}),s}function FN(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var IN=class e extends qM{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function LN(e){return new XM({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=Oj(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Qj(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:RN,getOwnPropertySymbols:zN}=Object,{hasOwnProperty:BN}=Object.prototype;function VN(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function HN(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function UN(e){return e?.[Symbol.toStringTag]}function WN(e){return RN(e).concat(zN(e))}var GN=Object.hasOwn||((e,t)=>BN.call(e,t));function KN(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var qN=`__v`,JN=`__o`,YN=`_owner`,{getOwnPropertyDescriptor:XN,keys:ZN}=Object;function QN(e,t){return e.byteLength===t.byteLength&&dP(new Uint8Array(e),new Uint8Array(t))}function $N(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function eP(e,t){return e.byteLength===t.byteLength&&dP(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function tP(e,t){return KN(e.getTime(),t.getTime())}function nP(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function rP(e,t){return e===t}function iP(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var aP=KN;function oP(e,t,n){let r=ZN(e),i=r.length;if(ZN(t).length!==i)return!1;for(;i-- >0;)if(!pP(e,t,n,r[i]))return!1;return!0}function sP(e,t,n){let r=WN(e),i=r.length;if(WN(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!pP(e,t,n,a)||(o=XN(e,a),s=XN(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function cP(e,t){return KN(e.valueOf(),t.valueOf())}function lP(e,t){return e.source===t.source&&e.flags===t.flags}function uP(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function dP(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function fP(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function pP(e,t,n,r){return(r===YN||r===JN||r===qN)&&(e.$$typeof||t.$$typeof)?!0:GN(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var mP=`[object ArrayBuffer]`,hP=`[object Arguments]`,gP=`[object Boolean]`,_P=`[object DataView]`,vP=`[object Date]`,yP=`[object Error]`,bP=`[object Map]`,xP=`[object Number]`,SP=`[object Object]`,CP=`[object RegExp]`,wP=`[object Set]`,TP=`[object String]`,EP={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},DP=`[object URL]`,OP=Object.prototype.toString;function kP({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=OP.call(h);if(b===vP)return r(h,g,_);if(b===CP)return u(h,g,_);if(b===bP)return o(h,g,_);if(b===wP)return d(h,g,_);if(b===SP)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===DP)return p(h,g,_);if(b===yP)return i(h,g,_);if(b===hP)return c(h,g,_);if(EP[b])return f(h,g,_);if(b===mP)return e(h,g,_);if(b===_P)return n(h,g,_);if(b===gP||b===xP||b===TP)return l(h,g,_);if(m){let e=m[b];if(!e){let t=UN(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function AP({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:QN,areArraysEqual:n?sP:$N,areDataViewsEqual:eP,areDatesEqual:tP,areErrorsEqual:nP,areFunctionsEqual:rP,areMapsEqual:n?VN(iP,sP):iP,areNumbersEqual:aP,areObjectsEqual:n?sP:oP,arePrimitiveWrappersEqual:cP,areRegExpsEqual:lP,areSetsEqual:n?VN(uP,sP):uP,areTypedArraysEqual:n?VN(dP,sP):dP,areUrlsEqual:fP,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=HN(r.areArraysEqual),t=HN(r.areMapsEqual),n=HN(r.areObjectsEqual),i=HN(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function jP(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function MP({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var NP=PP();PP({strict:!0}),PP({circular:!0}),PP({circular:!0,strict:!0}),PP({createInternalComparator:()=>KN}),PP({strict:!0,createInternalComparator:()=>KN}),PP({circular:!0,createInternalComparator:()=>KN}),PP({circular:!0,createInternalComparator:()=>KN,strict:!0});function PP(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=kP(AP(e));return MP({circular:t,comparator:a,createState:r,equals:n?n(a):jP(a),strict:i})}var FP=o((e=>{var t=require(`react`),n=jx();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),IP=o((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=require(`react`),r=jx(),i=typeof Object.is==`function`?Object.is:t,a=r.useSyncExternalStore,o=n.useRef,s=n.useEffect,c=n.useMemo,l=n.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==`function`&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()})),LP=o(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=FP():t.exports=IP()}))(),RP=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},zP=({contentComponent:e})=>{let t=(0,Mx.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,A.jsx)(A.Fragment,{children:Object.values(t)})};function BP(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:p.default.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var VP=class extends u.default.Component{constructor(e){super(e),this.editorContentRef=u.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=BP(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{ref:RP(t,this.editorContentRef),...n}),e?.contentComponent&&(0,A.jsx)(zP,{contentComponent:e.contentComponent})]})}},HP=(0,u.forwardRef)((e,t)=>{let n=u.default.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return u.default.createElement(VP,{key:n,innerRef:t,...e})}),UP=u.default.memo(HP),WP=typeof window<`u`?u.useLayoutEffect:u.useEffect,GP=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function KP(e){let[t]=(0,u.useState)(()=>new GP(e.editor)),n=(0,LP.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??NP);return WP(()=>t.watch(e.editor),[e.editor,t]),(0,u.useDebugValue)(n),n}var qP=process.env.NODE_ENV!==`production`,JP=typeof window>`u`,YP=JP||!!(typeof window<`u`&&window.next),XP=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender??!0;return e&&(JP||YP)&&(e=!1,qP&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches")),e?this.createEditor():null}createEditor(){return new yN({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function ZP(e={},t=[]){let n=(0,u.useRef)(e);n.current=e;let[r]=(0,u.useState)(()=>new XP(n)),i=(0,Mx.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,u.useDebugValue)(i),(0,u.useEffect)(r.onRender(t)),KP({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var QP=(0,u.createContext)({editor:null});QP.Consumer;var $P=(0,u.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),eF=()=>(0,u.useContext)($P);u.default.forwardRef((e,t)=>{let{onDragStart:n}=eF();return(0,A.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})}),u.default.createContext({markViewContentRef:()=>{}});var tF=(0,u.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});tF.displayName=`TiptapContext`;var nF=()=>(0,u.useContext)(tF);function rF({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,u.useMemo)(()=>({editor:r}),[r]),a=(0,u.useMemo)(()=>({editor:r}),[r]);return(0,A.jsx)(QP.Provider,{value:a,children:(0,A.jsx)(tF.Provider,{value:i,children:n})})}rF.displayName=`Tiptap`;function iF({...e}){let{editor:t}=nF();return(0,A.jsx)(UP,{editor:t,...e})}iF.displayName=`Tiptap.Content`,Object.assign(rF,{Content:iF});var aF=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]},oF=/^\s*>\s$/,sF=IN.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return aF(`blockquote`,{...Pj(this.options.HTMLAttributes,e),children:aF(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
148
|
-
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
|
|
149
|
-
`))}),n.join(`
|
|
150
|
-
>
|
|
151
|
-
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[CN({find:oF,type:this.type})]}}),cF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,lF=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,uF=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,dF=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,fF=JM.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return aF(`strong`,{...Pj(this.options.HTMLAttributes,e),children:aF(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[bN({find:cF,type:this.type}),bN({find:uF,type:this.type})]},addPasteRules(){return[LN({find:lF,type:this.type}),LN({find:dF,type:this.type})]}}),pF=/(^|[^`])`([^`]+)`(?!`)$/,mF=/(^|[^`])`([^`]+)`(?!`)/g,hF=JM.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,Pj(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[bN({find:pF,type:this.type})]},addPasteRules(){return[LN({find:mF,type:this.type})]}}),gF=4,_F=/^```([a-z]+)?[\s\n]$/,vF=/^~~~([a-z]+)?[\s\n]$/,yF=IN.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:gF,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,Pj(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
|
|
152
|
-
`):`\`\`\`${r}
|
|
153
|
-
|
|
154
|
-
\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??gF,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
|
|
155
|
-
`,`
|
|
156
|
-
`).split(`
|
|
157
|
-
`).map(e=>o+e).join(`
|
|
158
|
-
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??gF,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
|
|
159
|
-
`,`
|
|
160
|
-
`).split(`
|
|
161
|
-
`),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(W.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
|
|
162
|
-
`,`
|
|
163
|
-
`).split(`
|
|
164
|
-
`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
|
|
165
|
-
`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
166
|
-
|
|
167
|
-
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(U.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[SN({find:_F,type:this.type,getAttributes:e=>({language:e[1]})}),SN({find:vF,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Pw({key:new Lw(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
|
|
168
|
-
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(W.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),bF=IN.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
169
|
-
|
|
170
|
-
`):``}),xF=IN.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,Pj(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
171
|
-
`},renderMarkdown:()=>`
|
|
172
|
-
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),SF=IN.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Pj(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>SN({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),CF=IN.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,Pj(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!wN(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return uM(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(W.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(G.create(t.doc,n.pos)):t.setSelection(W.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(W.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[xN({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),wF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,TF=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,EF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,DF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,OF=JM.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,Pj(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bN({find:wF,type:this.type}),bN({find:EF,type:this.type})]},addPasteRules(){return[LN({find:TF,type:this.type}),LN({find:DF,type:this.type})]}}),kF=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,AF=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,jF=`numeric`,MF=`ascii`,NF=`alpha`,PF=`asciinumeric`,FF=`alphanumeric`,IF=`domain`,LF=`emoji`,RF=`scheme`,zF=`slashscheme`,BF=`whitespace`;function VF(e,t){return e in t||(t[e]=[]),t[e]}function HF(e,t,n){t[jF]&&(t[PF]=!0,t[FF]=!0),t[MF]&&(t[PF]=!0,t[NF]=!0),t[PF]&&(t[FF]=!0),t[NF]&&(t[FF]=!0),t[FF]&&(t[IF]=!0),t[LF]&&(t[IF]=!0);for(let r in t){let t=VF(r,n);t.indexOf(e)<0&&t.push(e)}}function UF(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function WF(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}WF.groups={},WF.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=WF.groups;let i;return t&&t.j?i=t:(i=new WF(t),n&&r&&HF(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=WF.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new WF,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new WF,a&&(r&&(o.t&&typeof o.t==`string`?HF(a,Object.assign(UF(o.t,r),n),r):n&&HF(a,n,r)),o.t=a),i.j[e]=o,o}};var q=(e,t,n,r,i)=>e.ta(t,n,r,i),GF=(e,t,n,r,i)=>e.tr(t,n,r,i),KF=(e,t,n,r,i)=>e.ts(t,n,r,i),J=(e,t,n,r,i)=>e.tt(t,n,r,i),qF=`WORD`,JF=`UWORD`,YF=`ASCIINUMERICAL`,XF=`ALPHANUMERICAL`,ZF=`LOCALHOST`,QF=`TLD`,$F=`UTLD`,eI=`SCHEME`,tI=`SLASH_SCHEME`,nI=`NUM`,rI=`WS`,iI=`NL`,aI=`OPENBRACE`,oI=`CLOSEBRACE`,sI=`OPENBRACKET`,cI=`CLOSEBRACKET`,lI=`OPENPAREN`,uI=`CLOSEPAREN`,dI=`OPENANGLEBRACKET`,fI=`CLOSEANGLEBRACKET`,pI=`FULLWIDTHLEFTPAREN`,mI=`FULLWIDTHRIGHTPAREN`,hI=`LEFTCORNERBRACKET`,gI=`RIGHTCORNERBRACKET`,_I=`LEFTWHITECORNERBRACKET`,vI=`RIGHTWHITECORNERBRACKET`,yI=`FULLWIDTHLESSTHAN`,bI=`FULLWIDTHGREATERTHAN`,xI=`AMPERSAND`,SI=`APOSTROPHE`,CI=`ASTERISK`,wI=`AT`,TI=`BACKSLASH`,EI=`BACKTICK`,DI=`CARET`,OI=`COLON`,kI=`COMMA`,AI=`DOLLAR`,jI=`DOT`,MI=`EQUALS`,NI=`EXCLAMATION`,PI=`HYPHEN`,FI=`PERCENT`,II=`PIPE`,LI=`PLUS`,RI=`POUND`,zI=`QUERY`,BI=`QUOTE`,VI=`FULLWIDTHMIDDLEDOT`,HI=`SEMI`,UI=`SLASH`,WI=`TILDE`,GI=`UNDERSCORE`,KI=`EMOJI`,qI=`SYM`,JI=Object.freeze({__proto__:null,ALPHANUMERICAL:XF,AMPERSAND:xI,APOSTROPHE:SI,ASCIINUMERICAL:YF,ASTERISK:CI,AT:wI,BACKSLASH:TI,BACKTICK:EI,CARET:DI,CLOSEANGLEBRACKET:fI,CLOSEBRACE:oI,CLOSEBRACKET:cI,CLOSEPAREN:uI,COLON:OI,COMMA:kI,DOLLAR:AI,DOT:jI,EMOJI:KI,EQUALS:MI,EXCLAMATION:NI,FULLWIDTHGREATERTHAN:bI,FULLWIDTHLEFTPAREN:pI,FULLWIDTHLESSTHAN:yI,FULLWIDTHMIDDLEDOT:VI,FULLWIDTHRIGHTPAREN:mI,HYPHEN:PI,LEFTCORNERBRACKET:hI,LEFTWHITECORNERBRACKET:_I,LOCALHOST:ZF,NL:iI,NUM:nI,OPENANGLEBRACKET:dI,OPENBRACE:aI,OPENBRACKET:sI,OPENPAREN:lI,PERCENT:FI,PIPE:II,PLUS:LI,POUND:RI,QUERY:zI,QUOTE:BI,RIGHTCORNERBRACKET:gI,RIGHTWHITECORNERBRACKET:vI,SCHEME:eI,SEMI:HI,SLASH:UI,SLASH_SCHEME:tI,SYM:qI,TILDE:WI,TLD:QF,UNDERSCORE:GI,UTLD:$F,UWORD:JF,WORD:qF,WS:rI}),YI=/[a-z]/,XI=/\p{L}/u,ZI=/\p{Emoji}/u,QI=/\d/,$I=/\s/,eL=`\r`,tL=`
|
|
173
|
-
`,nL=`️`,rL=``,iL=``,aL=null,oL=null;function sL(e=[]){let t={};WF.groups=t;let n=new WF;aL??=dL(kF),oL??=dL(AF),J(n,`'`,SI),J(n,`{`,aI),J(n,`}`,oI),J(n,`[`,sI),J(n,`]`,cI),J(n,`(`,lI),J(n,`)`,uI),J(n,`<`,dI),J(n,`>`,fI),J(n,`(`,pI),J(n,`)`,mI),J(n,`「`,hI),J(n,`」`,gI),J(n,`『`,_I),J(n,`』`,vI),J(n,`<`,yI),J(n,`>`,bI),J(n,`&`,xI),J(n,`*`,CI),J(n,`@`,wI),J(n,"`",EI),J(n,`^`,DI),J(n,`:`,OI),J(n,`,`,kI),J(n,`$`,AI),J(n,`.`,jI),J(n,`=`,MI),J(n,`!`,NI),J(n,`-`,PI),J(n,`%`,FI),J(n,`|`,II),J(n,`+`,LI),J(n,`#`,RI),J(n,`?`,zI),J(n,`"`,BI),J(n,`/`,UI),J(n,`;`,HI),J(n,`~`,WI),J(n,`_`,GI),J(n,`\\`,TI),J(n,`・`,VI);let r=GF(n,QI,nI,{[jF]:!0});GF(r,QI,r);let i=GF(r,YI,YF,{[PF]:!0}),a=GF(r,XI,XF,{[FF]:!0}),o=GF(n,YI,qF,{[MF]:!0});GF(o,QI,i),GF(o,YI,o),GF(i,QI,i),GF(i,YI,i);let s=GF(n,XI,JF,{[NF]:!0});GF(s,YI),GF(s,QI,a),GF(s,XI,s),GF(a,QI,a),GF(a,YI),GF(a,XI,a);let c=J(n,tL,iI,{[BF]:!0}),l=J(n,eL,rI,{[BF]:!0}),u=GF(n,$I,rI,{[BF]:!0});J(n,iL,u),J(l,tL,c),J(l,iL,u),GF(l,$I,u),J(u,eL),J(u,tL),GF(u,$I,u),J(u,iL,u);let d=GF(n,ZI,KI,{[LF]:!0});J(d,`#`),GF(d,ZI,d),J(d,nL,d);let f=J(d,rL);J(f,`#`),GF(f,ZI,d);let p=[[YI,o],[QI,i]],m=[[YI,null],[XI,s],[QI,a]];for(let e=0;e<aL.length;e++)uL(n,aL[e],QF,qF,p);for(let e=0;e<oL.length;e++)uL(n,oL[e],$F,JF,m);HF(QF,{tld:!0,ascii:!0},t),HF($F,{utld:!0,alpha:!0},t),uL(n,`file`,eI,qF,p),uL(n,`mailto`,eI,qF,p),uL(n,`http`,tI,qF,p),uL(n,`https`,tI,qF,p),uL(n,`ftp`,tI,qF,p),uL(n,`ftps`,tI,qF,p),HF(eI,{scheme:!0,ascii:!0},t),HF(tI,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[RF]:!0}:{[zF]:!0};r.indexOf(`-`)>=0?i[IF]=!0:YI.test(r)?QI.test(r)?i[PF]=!0:i[MF]=!0:i[jF]=!0,KF(n,r,r,i)}return KF(n,`localhost`,ZF,{ascii:!0}),n.jd=new WF(qI),{start:n,tokens:Object.assign({groups:t},JI)}}function cL(e,t){let n=lL(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function lL(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function uL(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new WF(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new WF(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function dL(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var fL={defaultProtocol:`http`,events:null,format:mL,formatHref:mL,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function pL(e,t=null){let n=Object.assign({},fL);e&&(n=Object.assign(n,e instanceof pL?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}pL.prototype={o:fL,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:fL[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function mL(e){return e}function hL(e,t){this.t=`token`,this.v=e,this.tk=t}hL.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=fL.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function gL(e,t){class n extends hL{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var _L=gL(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),vL=gL(`text`),yL=gL(`nl`),bL=gL(`url`,{isLink:!0,toHref(e=fL.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==ZF&&e[1].t===OI}}),xL=e=>new WF(e);function SL({groups:e}){let t=e.domain.concat([xI,CI,wI,TI,EI,DI,AI,MI,PI,nI,FI,II,LI,RI,UI,qI,WI,GI]),n=[SI,OI,kI,jI,NI,FI,zI,BI,HI,dI,fI,aI,oI,cI,sI,lI,uI,pI,mI,hI,gI,_I,vI,yI,bI],r=[xI,SI,CI,TI,EI,DI,AI,MI,PI,aI,oI,FI,II,LI,RI,zI,UI,qI,WI,GI],i=xL(),a=J(i,WI);q(a,r,a),q(a,e.domain,a);let o=xL(),s=xL(),c=xL();q(i,e.domain,o),q(i,e.scheme,s),q(i,e.slashscheme,c),q(o,r,a),q(o,e.domain,o);let l=J(o,wI);J(a,wI,l),J(s,wI,l),J(c,wI,l);let u=J(a,jI);q(u,r,a),q(u,e.domain,a);let d=xL();q(l,e.domain,d),q(d,e.domain,d);let f=J(d,jI);q(f,e.domain,d);let p=xL(_L);q(f,e.tld,p),q(f,e.utld,p),J(l,ZF,p);let m=J(d,PI);J(m,PI,m),q(m,e.domain,d),q(p,e.domain,d),J(p,jI,f),J(p,PI,m);let h=J(o,PI),g=J(o,jI);J(h,PI,h),q(h,e.domain,o),q(g,r,a),q(g,e.domain,o);let _=xL(bL);q(g,e.tld,_),q(g,e.utld,_),q(_,e.domain,o),q(_,r,a),J(_,jI,g),J(_,PI,h),J(_,wI,l);let v=J(_,OI),y=xL(bL);q(v,e.numeric,y);let b=xL(bL),x=xL();q(b,t,b),q(b,n,x),q(x,t,b),q(x,n,x),J(_,UI,b),J(y,UI,b);let S=J(s,OI),C=J(J(J(c,OI),UI),UI);q(s,e.domain,o),J(s,jI,g),J(s,PI,h),q(c,e.domain,o),J(c,jI,g),J(c,PI,h),q(S,e.domain,b),J(S,UI,b),J(S,zI,b),q(C,e.domain,b),q(C,t,b),J(C,UI,b);let w=[[aI,oI],[sI,cI],[lI,uI],[dI,fI],[pI,mI],[hI,gI],[_I,vI],[yI,bI]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=J(b,r);J(x,r,a);let o=xL(bL);q(a,t,o);let s=xL();q(a,n,s),J(a,i,b),q(o,t,o),q(o,n,s),q(s,t,o),q(s,n,s),J(o,i,b),J(s,i,b)}return J(i,ZF,_),J(i,iI,yL),{start:i,tokens:JI}}function CL(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(wL(vL,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(wL(e,t,r))}}return o.length>0&&a.push(wL(vL,t,o)),a}function wL(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var TL=typeof console<`u`&&console&&console.warn||(()=>{}),EL=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,DL={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function OL(){return WF.groups={},DL.scanner=null,DL.parser=null,DL.tokenQueue=[],DL.pluginQueue=[],DL.customSchemes=[],DL.initialized=!1,DL}function kL(e,t=!1){if(DL.initialized&&TL(`linkifyjs: already initialized - will not register custom scheme "${e}" ${EL}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
174
|
-
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
175
|
-
2. Cannot start or end with "-"
|
|
176
|
-
3. "-" cannot repeat`);DL.customSchemes.push([e,t])}function AL(){DL.scanner=sL(DL.customSchemes);for(let e=0;e<DL.tokenQueue.length;e++)DL.tokenQueue[e][1]({scanner:DL.scanner});DL.parser=SL(DL.scanner.tokens);for(let e=0;e<DL.pluginQueue.length;e++)DL.pluginQueue[e][1]({scanner:DL.scanner,parser:DL.parser});return DL.initialized=!0,DL}function jL(e){return DL.initialized||AL(),CL(DL.parser.start,e,cL(DL.scanner.start,e))}jL.scan=cL;function ML(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new pL(n),i=jL(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var NL=`[\0- \xA0 -\u2029 ]`,PL=new RegExp(NL),FL=RegExp(`${NL}$`),IL=new RegExp(NL,`g`);function LL(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function RL(e){return new Pw({key:new Lw(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(Zj(bj(n.doc,[...t])).forEach(({newRange:t})=>{let n=Sj(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!FL.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(PL).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=jL(n).map(t=>t.toObject(e.defaultProtocol));if(!LL(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Qj(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function zL(e){return new Pw({key:new Lw(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=Jj(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function BL(e){return new Pw({key:new Lw(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=ML(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function VL(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(IL,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var HL=JM.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){kL(e);return}kL(e.scheme,e.optionalSlashes)})},onDestroy(){OL()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!VL(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!VL(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!VL(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,Pj(this.options.HTMLAttributes,e),0]:[`a`,Pj(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!VL(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!VL(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[LN({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=ML(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!VL(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(RL({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!VL(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(zL({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(BL({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),UL=Object.defineProperty,WL=(e,t)=>{for(var n in t)UL(e,n,{get:t[n],enumerable:!0})},GL=`listItem`,KL=`textStyle`,qL=/^\s*([-+*])\s$/,JL=IN.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,Pj(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
177
|
-
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(GL,this.editor.getAttributes(KL)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=CN({find:qL,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=CN({find:qL,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(KL),editor:this.editor})),[e]}});function YL(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function XL(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var ZL=IN.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,Pj(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(YL(e))return{type:`listItem`,content:[{type:`paragraph`,content:XL(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>PN(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});WL({},{findListItemPos:()=>QL,getNextListDepth:()=>$L,handleBackspace:()=>rR,handleDelete:()=>oR,hasListBefore:()=>eR,hasListItemAfter:()=>sR,hasListItemBefore:()=>tR,listItemHasSubList:()=>nR,nextListIsDeeper:()=>iR,nextListIsHigher:()=>aR});var QL=(e,t)=>{let{$from:n}=t.selection,r=gA(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},$L=(e,t)=>{let n=QL(e,t);if(!n)return!1;let[,r]=$j(t,e,n.$pos.pos+4);return r},eR=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},tR=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},nR=(e,t,n)=>{if(!n)return!1;let r=gA(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},rR=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!nj(e.state,t)&&eR(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!nj(e.state,t)||!oM(e.state))return!1;let r=QL(t,e.state);if(!r)return!1;let i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),a=nR(t,e.state,i);return tR(t,e.state)&&!a?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},iR=(e,t)=>{let n=$L(e,t),r=QL(e,t);return!r||!n?!1:n>r.depth},aR=(e,t)=>{let n=$L(e,t),r=QL(e,t);return!r||!n?!1:n<r.depth},oR=(e,t)=>{if(!nj(e.state,t)||!aM(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:iR(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():aR(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},sR=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},cR=iN.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&oR(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&oR(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&rR(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&rR(e,n,r)&&(t=!0)}),t}}}}),lR=/^(\s*)(\d+)\.\s+(.*)$/,uR=/^\s/;function dR(e){let t=e.trimStart();return/^[-+*]\s+/.test(t)||/^\d+\.\s+/.test(t)||/^>\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function fR(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&dR(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function pR(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(lR);if(!a)break;let[,o,s,c]=a,l=o.length,u=[c],d=n+1,f=[i],p=!1;for(;d<e.length;){let t=e[d];if(t.match(lR))break;if(t.trim()===``)f.push(t),u.push(``),p=!0,d+=1;else if(t.match(uR))f.push(t),u.push(t.slice(l+2)),d+=1;else{if(p)break;f.push(t),u.push(t),d+=1}}t.push({indent:l,number:parseInt(s,10),content:u.join(`
|
|
178
|
-
`).trim(),contentLines:u,raw:f.join(`
|
|
179
|
-
`)}),r=d,n=d}return[t,r]}function mR(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=fR(a.contentLines),c=o.join(`
|
|
180
|
-
`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
|
|
181
|
-
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=mR(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,items:e,raw:f.map(e=>e.raw).join(`
|
|
182
|
-
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function hR(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var gR=`listItem`,_R=`textStyle`,vR=/^(\d+)\.\s$/,yR=IN.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,Pj(this.options.HTMLAttributes,n),0]:[`ol`,Pj(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?hR(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
183
|
-
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
|
|
184
|
-
`),[i,a]=pR(r);if(i.length===0)return;let o=mR(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
|
|
185
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(gR,this.editor.getAttributes(_R)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=CN({find:vR,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=CN({find:vR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(_R)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),bR=/^\s*(\[([( |x])?\])\s$/,xR=IN.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,Pj(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>PN(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=Fj(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[CN({find:bR,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),SR=IN.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,Pj(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
186
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=NN(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=NN(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});iN.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(JL.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(ZL.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(cR.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(yR.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(xR.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(SR.configure(this.options.taskList)),e}});var CR=` `,wR=`\xA0`,TR=IN.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,Pj(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===CR||n[0].text===CR||n[0].raw===wR||n[0].text===wR)&&r.length===1&&r[0].type===`text`&&(r[0].text===CR||r[0].text===wR)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?CR:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ER=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,DR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,kR=JM.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,Pj(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[bN({find:ER,type:this.type})]},addPasteRules(){return[LN({find:DR,type:this.type})]}}),AR=IN.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),jR=JM.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,Pj(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function MR(e={}){return new Pw({view(t){return new NR(t,e)}})}var NR=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=JC(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},PR=class e extends U{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):U.near(r)}content(){return H.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new FR(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!LR(e)||!RR(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!G.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};PR.prototype.visible=!1,PR.findFrom=PR.findGapCursorFrom,U.jsonID(`gapcursor`,PR);var FR=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return PR.valid(t)?new PR(t):U.near(t)}};function IR(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function LR(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||IR(e.type))return!0;if(e.inlineContent)return!1}}return!0}function RR(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||IR(e.type))return!0;if(e.inlineContent)return!1}}return!0}function zR(){return new Pw({props:{decorations:WR,createSelectionBetween(e,t,n){return t.pos==n.pos&&PR.valid(n)?new PR(n):null},handleClick:HR,handleKeyDown:BR,handleDOMEvents:{beforeinput:UR}}})}var BR=rA({ArrowLeft:VR(`horiz`,-1),ArrowRight:VR(`horiz`,1),ArrowUp:VR(`vert`,-1),ArrowDown:VR(`vert`,1)});function VR(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof W){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=PR.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new PR(c))),!0):!1}}function HR(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!PR.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&G.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new PR(r))),!0)}function UR(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof PR))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=V.empty;for(let e=r.length-1;e>=0;e--)i=V.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new H(i,0,0));return a.setSelection(W.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function WR(e){if(!(e.selection instanceof PR))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,lk.create(e.doc,[ok.widget(e.selection.head,t,{key:`gapcursor`})])}var GR=200,KR=function(){};KR.prototype.append=function(e){return e.length?(e=KR.from(e),!this.length&&e||e.length<GR&&this.leafAppend(e)||this.length<GR&&e.leafPrepend(this)||this.appendInner(e)):this},KR.prototype.prepend=function(e){return e.length?KR.from(e).append(this):this},KR.prototype.appendInner=function(e){return new JR(this,e)},KR.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?KR.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},KR.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},KR.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},KR.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},KR.from=function(e){return e instanceof KR?e:e&&e.length?new qR(e):KR.empty};var qR=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=GR)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=GR)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(KR);KR.empty=new qR([]);var JR=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(KR),YR=500,XR=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new QR(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new QR(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new QR(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>ez&&(s=ZR(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new fC;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new QR(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new QR(i,o,l))}else r.push(new QR(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new QR(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>YR&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new QR(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(KR.from(i.reverse()),a)}};XR.empty=new XR(KR.empty,0);function ZR(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var QR=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},$R=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},ez=20;function tz(e,t,n,r){let i=n.getMeta(lz),a;if(i)return i.historyState;n.getMeta(uz)&&(e=new $R(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(lz))return o.getMeta(lz).redo?new $R(e.done.addTransform(n,void 0,r,cz(t)),e.undone,rz(n.mapping.maps),e.prevTime,e.prevComposition):new $R(e.done,e.undone.addTransform(n,void 0,r,cz(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!nz(n,e.prevRanges)),s=o?iz(e.prevRanges,n.mapping):rz(n.mapping.maps);return new $R(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,cz(t)),XR.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new $R(e.done.rebased(n,a),e.undone.rebased(n,a),iz(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new $R(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),iz(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function nz(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function rz(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function iz(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function az(e,t,n){let r=cz(t),i=lz.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new $R(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(lz,{redo:n,historyState:c})}var oz=!1,sz=null;function cz(e){let t=e.plugins;if(sz!=t){oz=!1,sz=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){oz=!0;break}}return oz}var lz=new Lw(`history`),uz=new Lw(`closeHistory`);function dz(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Pw({key:lz,state:{init(){return new $R(XR.empty,XR.empty,null,0,-1)},apply(t,n,r){return tz(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?pz:n==`historyRedo`?mz:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function fz(e,t){return(n,r)=>{let i=lz.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=az(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var pz=fz(!1,!0),mz=fz(!0,!0),hz=iN.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Pw({key:new Lw(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}}),gz=iN.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[MR(this.options)]}});iN.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Pw({key:new Lw(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return lk.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(ok.node(t,t+e.nodeSize,{class:this.options.className}))}),lk.create(e,a)}}})]}});var _z=iN.create({name:`gapCursor`,addProseMirrorPlugins(){return[zR()]},extendNodeSchema(e){return{allowGapCursor:Oj(K(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),vz=`placeholder`;function yz(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}var bz=iN.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:vz,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${yz(this.options.dataAttribute)}`:`data-${vz}`;return[new Pw({key:new Lw(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&lM(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=ok.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),lk.create(t,a)}}})]}});iN.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new Pw({key:new Lw(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||uM(n.selection)||e.view.dragging?null:lk.create(n.doc,[ok.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function xz({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var Sz=iN.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new Lw(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new Pw({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!xz({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!xz({node:r,types:n})}}})]}}),Cz=iN.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>pz(e,t),redo:()=>({state:e,dispatch:t})=>mz(e,t)}},addProseMirrorPlugins(){return[dz(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),wz=iN.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(fF.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(sF.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(JL.configure(this.options.bulletList)),this.options.code!==!1&&e.push(hF.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(yF.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(bF.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(gz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(_z.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(xF.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(SF.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(Cz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(CF.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(OF.configure(this.options.italic)),this.options.listItem!==!1&&e.push(ZL.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(cR.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(HL.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(yR.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(TR.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(kR.configure(this.options.strike)),this.options.text!==!1&&e.push(AR.configure(this.options.text)),this.options.underline!==!1&&e.push(jR.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(Sz.configure(this.options?.trailingNode)),e}}),Tz=20,Ez=(e,t=0)=>{let n=[];return!e.children.length||t>Tz||Array.from(e.children).forEach(e=>{e.tagName===`SPAN`?n.push(e):e.children.length&&n.push(...Ez(e,t+1))}),n},Dz=e=>{if(!e.children.length)return;let t=Ez(e);t&&t.forEach(e=>{let t=e.getAttribute(`style`),n=(e.parentElement?.closest(`span`))?.getAttribute(`style`);e.setAttribute(`style`,`${n};${t}`)})},Oz=JM.create({name:`textStyle`,priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:`span`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?(this.options.mergeNestedSpanStyles&&Dz(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return[`span`,Pj(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),kz=iN.create({name:`backgroundColor`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>(TN(e,`background-color`)??e.style.backgroundColor)?.replace(/['"]+/g,``),renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark(`textStyle`,{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark(`textStyle`,{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Az=iN.create({name:`color`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>(TN(e,`color`)??e.style.color)?.replace(/['"]+/g,``),renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark(`textStyle`,{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark(`textStyle`,{color:null}).removeEmptyTextStyle().run()}}}),jz=iN.create({name:`fontFamily`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>TN(e,`font-family`)??e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark(`textStyle`,{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark(`textStyle`,{fontFamily:null}).removeEmptyTextStyle().run()}}}),Mz=iN.create({name:`fontSize`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>TN(e,`font-size`)??e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark(`textStyle`,{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark(`textStyle`,{fontSize:null}).removeEmptyTextStyle().run()}}}),Nz=iN.create({name:`lineHeight`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>TN(e,`line-height`)??e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark(`textStyle`,{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark(`textStyle`,{lineHeight:null}).removeEmptyTextStyle().run()}}});iN.create({name:`textStyleKit`,addExtensions(){let e=[];return this.options.backgroundColor!==!1&&e.push(kz.configure(this.options.backgroundColor)),this.options.color!==!1&&e.push(Az.configure(this.options.color)),this.options.fontFamily!==!1&&e.push(jz.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(Mz.configure(this.options.fontSize)),this.options.lineHeight!==!1&&e.push(Nz.configure(this.options.lineHeight)),this.options.textStyle!==!1&&e.push(Oz.configure(this.options.textStyle)),e}});var Pz=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Fz=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Iz=JM.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||TN(e,`background-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,Pj(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark(`highlight`,t.parseInline(e.tokens||[])),markdownTokenizer:{name:`highlight`,level:`inline`,start:e=>e.indexOf(`==`),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:`highlight`,raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[bN({find:Pz,type:this.type})]},addPasteRules(){return[LN({find:Fz,type:this.type})]}}),Lz={};function Rz(e){let t=Lz[e];if(t)return t;t=Lz[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function zz(e,t){typeof t!=`string`&&(t=zz.defaultChars);let n=Rz(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;e<128?t+=`��`:t+=String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;e<2048||e>=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}zz.defaultChars=`;/?:@&=+$,#`,zz.componentChars=``;var Bz={};function Vz(e){let t=Bz[e];if(t)return t;t=Bz[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function Hz(e,t,n){typeof t!=`string`&&(n=t,t=Hz.defaultChars),n===void 0&&(n=!0);let r=Vz(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}Hz.defaultChars=`;/?:@&=+$,-_.!~*'()#`,Hz.componentChars=`-_.!~*'()`;function Uz(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function Wz(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var Gz=/^([a-z0-9.+-]+:)/i,Kz=/:[0-9]*$/,qz=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Jz=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
|
|
187
|
-
`,` `],Yz=[`/`,`?`,`#`],Xz=255,Zz=/^[+a-z0-9A-Z_-]{0,63}$/,Qz=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,$z={javascript:!0,"javascript:":!0},eB={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function tB(e,t){if(e&&e instanceof Wz)return e;let n=new Wz;return n.parse(e,t),n}Wz.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=qz.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=Gz.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&$z[o])&&(a=a.substr(2),this.slashes=!0)),!$z[o]&&(i||o&&!eB[o])){let e=-1;for(let t=0;t<Yz.length;t++)r=a.indexOf(Yz[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<Jz.length;t++)r=a.indexOf(Jz[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(Zz)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(Zz)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(Qz);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>Xz&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),eB[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},Wz.prototype.parseHost=function(e){let t=Kz.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var nB=s({decode:()=>zz,encode:()=>Hz,format:()=>Uz,parse:()=>tB}),rB=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,iB=/[\0-\x1F\x7F-\x9F]/,aB=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,oB=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,sB=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,cB=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,lB=s({Any:()=>rB,Cc:()=>iB,Cf:()=>aB,P:()=>oB,S:()=>sB,Z:()=>cB}),uB=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),dB=new Uint16Array(`Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢`.split(``).map(e=>e.charCodeAt(0))),fB=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),pB=String.fromCodePoint??function(e){let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function mB(e){return e>=55296&&e<=57343||e>1114111?65533:fB.get(e)??e}var hB;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(hB||={});var gB=32,_B;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(_B||={});function vB(e){return e>=hB.ZERO&&e<=hB.NINE}function yB(e){return e>=hB.UPPER_A&&e<=hB.UPPER_F||e>=hB.LOWER_A&&e<=hB.LOWER_F}function bB(e){return e>=hB.UPPER_A&&e<=hB.UPPER_Z||e>=hB.LOWER_A&&e<=hB.LOWER_Z||vB(e)}function xB(e){return e===hB.EQUALS||bB(e)}var SB;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(SB||={});var CB;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(CB||={});var wB=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=SB.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=CB.Strict}startEntity(e){this.decodeMode=e,this.state=SB.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case SB.EntityStart:return e.charCodeAt(t)===hB.NUM?(this.state=SB.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=SB.NamedEntity,this.stateNamedEntity(e,t));case SB.NumericStart:return this.stateNumericStart(e,t);case SB.NumericDecimal:return this.stateNumericDecimal(e,t);case SB.NumericHex:return this.stateNumericHex(e,t);case SB.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|gB)===hB.LOWER_X?(this.state=SB.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=SB.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(vB(r)||yB(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(vB(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===hB.SEMI)this.consumed+=1;else if(this.decodeMode===CB.Strict)return 0;return this.emitCodePoint(mB(this.result),this.consumed),this.errors&&(e!==hB.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&_B.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=EB(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===CB.Attribute&&(i===0||xB(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&_B.VALUE_LENGTH)>>14,i!==0){if(a===hB.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==CB.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&_B.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~_B.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case SB.NamedEntity:return this.result!==0&&(this.decodeMode!==CB.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case SB.NumericDecimal:return this.emitNumericEntity(0,2);case SB.NumericHex:return this.emitNumericEntity(0,3);case SB.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case SB.EntityStart:return 0}}};function TB(e){let t=``,n=new wB(e,e=>t+=pB(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function EB(e,t,n,r){let i=(t&_B.BRANCH_LENGTH)>>7,a=t&_B.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var DB=TB(uB);TB(dB);function OB(e,t=CB.Legacy){return DB(e,t)}var kB=s({arrayReplaceAt:()=>FB,assign:()=>PB,escapeHtml:()=>JB,escapeRE:()=>XB,fromCodePoint:()=>LB,has:()=>NB,isMdAsciiPunct:()=>eV,isPunctChar:()=>$B,isSpace:()=>ZB,isString:()=>jB,isValidEntityCode:()=>IB,isWhiteSpace:()=>QB,lib:()=>nV,normalizeReference:()=>tV,unescapeAll:()=>UB,unescapeMd:()=>HB});function AB(e){return Object.prototype.toString.call(e)}function jB(e){return AB(e)===`[object String]`}var MB=Object.prototype.hasOwnProperty;function NB(e,t){return MB.call(e,t)}function PB(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if(typeof t!=`object`)throw TypeError(t+`must be object`);Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function FB(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function IB(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function LB(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var RB=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,zB=RegExp(RB.source+`|&([a-z#][a-z0-9]{1,31});`,`gi`),BB=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function VB(e,t){if(t.charCodeAt(0)===35&&BB.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return IB(n)?LB(n):e}let n=OB(e);return n===e?e:n}function HB(e){return e.indexOf(`\\`)<0?e:e.replace(RB,`$1`)}function UB(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(zB,function(e,t,n){return t||VB(e,n)})}var WB=/[&<>"]/,GB=/[&<>"]/g,KB={"&":`&`,"<":`<`,">":`>`,'"':`"`};function qB(e){return KB[e]}function JB(e){return WB.test(e)?e.replace(GB,qB):e}var YB=/[.?*+^$[\]\\(){}|-]/g;function XB(e){return e.replace(YB,`\\$&`)}function ZB(e){switch(e){case 9:case 32:return!0}return!1}function QB(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function $B(e){return oB.test(e)||sB.test(e)}function eV(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function tV(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}var nV={mdurl:nB,ucmicro:lB};function rV(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function iV(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=UB(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=UB(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function aV(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=UB(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=UB(e.slice(t,a)),o}var oV=s({parseLinkDestination:()=>iV,parseLinkLabel:()=>rV,parseLinkTitle:()=>aV}),sV={};sV.code_inline=function(e,t,n,r,i){let a=e[t];return`<code`+i.renderAttrs(a)+`>`+JB(a.content)+`</code>`},sV.code_block=function(e,t,n,r,i){let a=e[t];return`<pre`+i.renderAttrs(a)+`><code>`+JB(e[t].content)+`</code></pre>
|
|
188
|
-
`},sV.fence=function(e,t,n,r,i){let a=e[t],o=a.info?UB(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||JB(a.content),l.indexOf(`<pre`)===0)return l+`
|
|
189
|
-
`;if(o){let e=a.attrIndex(`class`),t=a.attrs?a.attrs.slice():[];e<0?t.push([`class`,n.langPrefix+s]):(t[e]=t[e].slice(),t[e][1]+=` `+n.langPrefix+s);let r={attrs:t};return`<pre><code${i.renderAttrs(r)}>${l}</code></pre>\n`}return`<pre><code${i.renderAttrs(a)}>${l}</code></pre>\n`},sV.image=function(e,t,n,r,i){let a=e[t];return a.attrs[a.attrIndex(`alt`)][1]=i.renderInlineAsText(a.children,n,r),i.renderToken(e,t,n)},sV.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
|
|
190
|
-
`:`<br>
|
|
191
|
-
`},sV.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
|
|
192
|
-
`:`<br>
|
|
193
|
-
`:`
|
|
194
|
-
`},sV.text=function(e,t){return JB(e[t].content)},sV.html_block=function(e,t){return e[t].content},sV.html_inline=function(e,t){return e[t].content};function cV(){this.rules=PB({},sV)}cV.prototype.renderAttrs=function(e){let t,n,r;if(!e.attrs)return``;for(r=``,t=0,n=e.attrs.length;t<n;t++)r+=` `+JB(e.attrs[t][0])+`="`+JB(e.attrs[t][1])+`"`;return r},cV.prototype.renderToken=function(e,t,n){let r=e[t],i=``;if(r.hidden)return``;r.block&&r.nesting!==-1&&t&&e[t-1].hidden&&(i+=`
|
|
195
|
-
`),i+=(r.nesting===-1?`</`:`<`)+r.tag,i+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(i+=` /`);let a=!1;if(r.block&&(a=!0,r.nesting===1&&t+1<e.length)){let n=e[t+1];(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===r.tag)&&(a=!1)}return i+=a?`>
|
|
196
|
-
`:`>`,i},cV.prototype.renderInline=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r},cV.prototype.renderInlineAsText=function(e,t,n){let r=``;for(let i=0,a=e.length;i<a;i++)switch(e[i].type){case`text`:r+=e[i].content;break;case`image`:r+=this.renderInlineAsText(e[i].children,t,n);break;case`html_inline`:case`html_block`:r+=e[i].content;break;case`softbreak`:case`hardbreak`:r+=`
|
|
197
|
-
`;break;default:}return r},cV.prototype.render=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;o===`inline`?r+=this.renderInline(e[a].children,t,n):i[o]===void 0?r+=this.renderToken(e,a,t,n):r+=i[o](e,a,t,n,this)}return r};function lV(){this.__rules__=[],this.__cache__=null}lV.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1},lV.prototype.__compile__=function(){let e=this,t=[``];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){t.indexOf(e)<0&&t.push(e)})}),e.__cache__={},t.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(n){n.enabled&&(t&&n.alt.indexOf(t)<0||e.__cache__[t].push(n.fn))})})},lV.prototype.at=function(e,t,n){let r=this.__find__(e),i=n||{};if(r===-1)throw Error(`Parser rule not found: `+e);this.__rules__[r].fn=t,this.__rules__[r].alt=i.alt||[],this.__cache__=null},lV.prototype.before=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},lV.prototype.after=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},lV.prototype.push=function(e,t,n){let r=n||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null},lV.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!0,n.push(e)},this),this.__cache__=null,n},lV.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,t)},lV.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!1,n.push(e)},this),this.__cache__=null,n},lV.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function uV(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content=``,this.markup=``,this.info=``,this.meta=null,this.block=!1,this.hidden=!1}uV.prototype.attrIndex=function(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1},uV.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},uV.prototype.attrSet=function(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r},uV.prototype.attrGet=function(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n},uV.prototype.attrJoin=function(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=this.attrs[n][1]+` `+t};function dV(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}dV.prototype.Token=uV;var fV=/\r\n?|\n/g,pV=/\0/g;function mV(e){let t;t=e.src.replace(fV,`
|
|
198
|
-
`),t=t.replace(pV,`�`),e.src=t}function hV(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function gV(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function _V(e){return/^<a[>\s]/i.test(e)}function vV(e){return/^<\/a\s*>/i.test(e)}function yV(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.pretest(t[n].content))continue;let r=t[n].children,i=0;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.type===`link_close`){for(a--;r[a].level!==o.level&&r[a].type!==`link_open`;)a--;continue}if(o.type===`html_inline`&&(_V(o.content)&&i>0&&i--,vV(o.content)&&i++),!(i>0)&&o.type===`text`&&e.md.linkify.test(o.content)){let i=o.content,s=e.md.linkify.match(i),c=[],l=o.level,u=0;s.length>0&&s[0].index===0&&a>0&&r[a-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let a=s[t].text;a=s[t].schema?s[t].schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:`+a).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://`+a).replace(/^http:\/\//,``);let o=s[t].index;if(o>u){let t=new e.Token(`text`,``,0);t.content=i.slice(u,o),t.level=l,c.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new e.Token(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=s[t].lastIndex}if(u<i.length){let t=new e.Token(`text`,``,0);t.content=i.slice(u),t.level=l,c.push(t)}t[n].children=r=FB(r,a,c)}}}}var bV=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,xV=/\((c|tm|r)\)/i,SV=/\((c|tm|r)\)/gi,CV={c:`©`,r:`®`,tm:`™`};function wV(e,t){return CV[t.toLowerCase()]}function TV(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(SV,wV)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function EV(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&bV.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`…`).replace(/([?!])…/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1—`).replace(/(^|\s)--(?=\s|$)/gm,`$1–`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1–`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function DV(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(xV.test(e.tokens[t].content)&&TV(e.tokens[t].children),bV.test(e.tokens[t].content)&&EV(e.tokens[t].children))}var OV=/['"]/,kV=/['"]/g,AV=`’`;function jV(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function MV(e,t){let n,r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,a.type!==`text`)continue;let s=a.content,c=0,l=s.length;OUTER:for(;c<l;){kV.lastIndex=c;let u=kV.exec(s);if(!u)break;let d=!0,f=!0;c=u.index+1;let p=u[0]===`'`,m=32;if(u.index-1>=0)m=s.charCodeAt(u.index-1);else for(n=i-1;n>=0&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(c<l)h=s.charCodeAt(c);else for(n=i+1;n<e.length&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=eV(m)||$B(String.fromCharCode(m)),_=eV(h)||$B(String.fromCharCode(h)),v=QB(m),y=QB(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&u[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&(a.content=jV(a.content,u.index,AV));continue}if(f)for(n=r.length-1;n>=0;n--){let d=r[n];if(r[n].level<o)break;if(d.single===p&&r[n].level===o){d=r[n];let o,f;p?(o=t.md.options.quotes[2],f=t.md.options.quotes[3]):(o=t.md.options.quotes[0],f=t.md.options.quotes[1]),a.content=jV(a.content,u.index,f),e[d.token].content=jV(e[d.token].content,d.pos,o),c+=f.length-1,d.token===i&&(c+=o.length-1),s=a.content,l=s.length,r.length=n;continue OUTER}}d?r.push({token:i,pos:u.index,single:p,level:o}):f&&p&&(a.content=jV(a.content,u.index,AV))}}}function NV(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!OV.test(e.tokens[t].content)||MV(e.tokens[t].children,e)}function PV(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var FV=[[`normalize`,mV],[`block`,hV],[`inline`,gV],[`linkify`,yV],[`replacements`,DV],[`smartquotes`,NV],[`text_join`,PV]];function IV(){this.ruler=new lV;for(let e=0;e<FV.length;e++)this.ruler.push(FV[e][0],FV[e][1])}IV.prototype.process=function(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)},IV.prototype.State=dV;function LV(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType=`root`,this.level=0;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o)if(ZB(s)){n++,s===9?r+=4-r%4:r++;continue}else o=!0;(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}LV.prototype.push=function(e,t,n){let r=new uV(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},LV.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},LV.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},LV.prototype.skipSpaces=function(e){for(let t=this.src.length;e<t&&ZB(this.src.charCodeAt(e));e++);return e},LV.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!ZB(this.src.charCodeAt(--e)))return e+1;return e},LV.prototype.skipChars=function(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e},LV.prototype.skipCharsBack=function(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e},LV.prototype.getLines=function(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if(ZB(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)},LV.prototype.Token=uV;var RV=65536;function zV(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function BV(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function VV(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!ZB(s)||o===45&&ZB(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!ZB(t))return!1;a++}let c=zV(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=zV(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=BV(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=zV(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=BV(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>RV))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function HV(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+`
|
|
199
|
-
`,a.map=[t,e.line],!0}function UV(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function WV(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if(ZB(t))t===9?o+=4-(o+e.bsCount[m]+ +!!r)%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+ +!!n,l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function GV(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!ZB(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function KV(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!ZB(e.src.charCodeAt(r))?-1:r}function qV(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1;continue}if(a===41||a===46)break;return-1}return i<r&&(a=e.src.charCodeAt(i),!ZB(a))?-1:i}function JV(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function YV(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=qV(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=KV(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n,!0),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=qV(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=KV(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&JV(e,h),!0}function XV(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}else if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!ZB(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!ZB(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&ZB(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&ZB(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=tV(c.slice(1,l));return _?r?!0:(e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d}),e.line=o,!0):!1}var ZV=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),QV=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,$V=RegExp(`^(?:`+QV+`|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),eH=RegExp(`^(?:`+QV+`|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)`),tH=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(`+ZV.join(`|`)+`)(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(eH.source+`\\s*$`),/^$/,!1]];function nH(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<tH.length&&!tH[s][0].test(o);s++);if(s===tH.length)return!1;if(r)return tH[s][2];let c=t+1;if(!tH[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent);c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),tH[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let l=e.push(`html_block`,``,0);return l.map=[t,c],l.content=e.getLines(t,c,e.blkIndent,!0),!0}function rH(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!ZB(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&ZB(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h`+String(s),1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=e.src.slice(i,a).trim(),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h`+String(s),-1);return d.markup=`########`.slice(0,s),!0}function iH(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return!1;let c=e.getLines(t,s,e.blkIndent,!1).trim();e.line=s+1;let l=e.push(`heading_open`,`h`+String(a),1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h`+String(a),-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function aH(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=e.getLines(t,a,e.blkIndent,!1).trim();e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var oH=[[`table`,VV,[`paragraph`,`reference`]],[`code`,HV],[`fence`,UV,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,WV,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,GV,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,YV,[`paragraph`,`reference`,`blockquote`]],[`reference`,XV],[`html_block`,nH,[`paragraph`,`reference`,`blockquote`]],[`heading`,rH,[`paragraph`,`reference`,`blockquote`]],[`lheading`,iH],[`paragraph`,aH]];function sH(){this.ruler=new lV;for(let e=0;e<oH.length;e++)this.ruler.push(oH[e][0],oH[e][1],{alt:(oH[e][2]||[]).slice()})}sH.prototype.tokenize=function(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}},sH.prototype.parse=function(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)},sH.prototype.State=LV;function cH(e,t,n,r){this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending=``,this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}cH.prototype.pushPending=function(){let e=new uV(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e},cH.prototype.push=function(e,t,n){this.pending&&this.pushPending();let r=new uV(e,t,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r},cH.prototype.scanDelims=function(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i=e>0?this.src.charCodeAt(e-1):32,a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32,c=eV(i)||$B(String.fromCharCode(i)),l=eV(s)||$B(String.fromCharCode(s)),u=QB(i),d=QB(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}},cH.prototype.Token=uV;function lH(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function uH(e,t){let n=e.pos;for(;n<e.posMax&&!lH(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var dH=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function fH(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=e.pending.match(dH);if(!i)return!1;let a=i[1],o=e.md.linkify.matchAtStart(e.src.slice(n-a.length));if(!o)return!1;let s=o.url;if(s.length<=a.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-a.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-a.length,!0}function pH(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0);else e.push(`softbreak`,`br`,0);for(n++;n<i&&ZB(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var mH=[];for(let e=0;e<256;e++)mH.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){mH[e.charCodeAt(0)]=1});function hH(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),ZB(i));)n++;return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);i<256&&mH[i]!==0?t.content=a:t.content=o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function gH(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=n;n++;let i=e.posMax;for(;n<i&&e.src.charCodeAt(n)===96;)n++;let a=e.src.slice(r,n),o=a.length;if(e.backticksScanned&&(e.backticks[o]||0)<=r)return t||(e.pending+=a),e.pos+=o,!0;let s=n,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<i&&e.src.charCodeAt(s)===96;)s++;let r=s-c;if(r===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a,t.content=e.src.slice(n,c).replace(/\n/g,` `).replace(/^ (.+) $/,`$1`)}return e.pos=s,!0}e.backticks[r]=c}return e.backticksScanned=!0,t||(e.pending+=a),e.pos+=o,!0}function _H(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function vH(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function yH(e){let t=e.tokens_meta,n=e.tokens_meta.length;vH(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&vH(e,t[r].delimiters)}var bH={tokenize:_H,postProcess:yH};function xH(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function SH(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function CH(e){let t=e.tokens_meta,n=e.tokens_meta.length;SH(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&SH(e,t[r].delimiters)}var wH={tokenize:xH,postProcess:CH};function TH(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),!(!ZB(n)&&n!==10));m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),!(!ZB(n)&&n!==10));m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),!(!ZB(n)&&n!==10));m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),a=e.env.references[tV(r)],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];t.attrs=n,s&&n.push([`title`,s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function EH(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),!(!ZB(n)&&n!==10));a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),!(!ZB(n)&&n!==10));a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),!(!ZB(n)&&n!==10));a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),o=e.env.references[tV(i)],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),i=[[`src`,u],[`alt`,``]];n.attrs=i,n.children=t,n.content=r,c&&i.push([`title`,c])}return e.pos=a,e.posMax=f,!0}var DH=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,OH=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function kH(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(OH.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(DH.test(a)){let n=e.md.normalizeLink(`mailto:`+a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function AH(e){return/^<a[>\s]/i.test(e)}function jH(e){return/^<\/a\s*>/i.test(e)}function MH(e){let t=e|32;return t>=97&&t<=122}function NH(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!MH(i))return!1;let a=e.src.slice(r).match($V);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],AH(t.content)&&e.linkLevel++,jH(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var PH=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,FH=/^&([a-z][a-z0-9]{1,31});/i;function IH(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(PH);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=IB(t)?LB(t):LB(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(FH);if(r){let n=OB(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function LH(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function RH(e){let t=e.tokens_meta,n=e.tokens_meta.length;LH(e.delimiters);for(let e=0;e<n;e++)t[e]&&t[e].delimiters&&LH(t[e].delimiters)}function zH(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var BH=[[`text`,uH],[`linkify`,fH],[`newline`,pH],[`escape`,hH],[`backticks`,gH],[`strikethrough`,bH.tokenize],[`emphasis`,wH.tokenize],[`link`,TH],[`image`,EH],[`autolink`,kH],[`html_inline`,NH],[`entity`,IH]],VH=[[`balance_pairs`,RH],[`strikethrough`,bH.postProcess],[`emphasis`,wH.postProcess],[`fragments_join`,zH]];function HH(){this.ruler=new lV;for(let e=0;e<BH.length;e++)this.ruler.push(BH[e][0],BH[e][1]);this.ruler2=new lV;for(let e=0;e<VH.length;e++)this.ruler2.push(VH[e][0],VH[e][1])}HH.prototype.skipToken=function(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos},HH.prototype.tokenize=function(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},HH.prototype.parse=function(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)},HH.prototype.State=cH;function UH(e){let t={};e||={},t.src_Any=rB.source,t.src_Cc=iB.source,t.src_Z=cB.source,t.src_P=oB.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);let n=`[><|]`;return t.src_pseudo_letter=`(?:(?!`+n+`|`+t.src_ZPCc+`)`+t.src_Any+`)`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!`+t.src_ZCc+`|[@/\\[\\]()]).)+@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|`+n+`|`+t.src_ZPCc+`)(?!`+(e[`---`]?`-(?!--)|`:`-|`)+`_|:\\d|\\.-|\\.(?!$|`+t.src_ZPCc+`))`,t.src_path=`(?:[/?#](?:(?!`+t.src_ZCc+`|[><|]|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+`|\\]).)*\\]|\\((?:(?!`+t.src_ZCc+`|[)]).)*\\)|\\{(?:(?!`+t.src_ZCc+`|[}]).)*\\}|\\"(?:(?!`+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+`|[']).)+\\'|\\'(?=`+t.src_pseudo_letter+`|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!`+t.src_ZCc+`|[.]|$)|`+(e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!`+t.src_ZCc+`|$)|;(?!`+t.src_ZCc+`|$)|\\!+(?!`+t.src_ZCc+`|[!]|$)|\\?(?!`+t.src_ZCc+`|[?]|$))+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|`+t.src_pseudo_letter+`{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:`+t.src_pseudo_letter+`)|(?:`+t.src_pseudo_letter+`(?:-|`+t.src_pseudo_letter+`){0,61}`+t.src_pseudo_letter+`))`,t.src_host=`(?:(?:(?:(?:`+t.src_domain+`)\\.)*`+t.src_domain+`))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:`+t.src_ZPCc+`|>|$))`,t.tpl_email_fuzzy=`(^|`+n+`|"|\\(|`+t.src_ZCc+`)(`+t.src_email_name+`@`+t.tpl_host_fuzzy_strict+`)`,t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+`)`,t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+`)`,t}function WH(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function GH(e){return Object.prototype.toString.call(e)}function KH(e){return GH(e)===`[object String]`}function qH(e){return GH(e)===`[object Object]`}function JH(e){return GH(e)===`[object RegExp]`}function YH(e){return GH(e)===`[object Function]`}function XH(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var ZH={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function QH(e){return Object.keys(e||{}).reduce(function(e,t){return e||ZH.hasOwnProperty(t)},!1)}var $H={"http:":{validate:function(e,t,n){let r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/`+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){let r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:`+n.re.src_domain+`)\\.)+`+n.re.src_domain_root+`)`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){let r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^`+n.re.src_email_name+`@`+n.re.src_host_strict,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},eU=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,tU=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function nU(e){e.__index__=-1,e.__text_cache__=``}function rU(e){return function(t,n){let r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function iU(){return function(e,t){t.normalize(e)}}function aU(e){let t=e.re=UH(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(eU),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);let i=[];e.__compiled__={};function a(e,t){throw Error(`(LinkifyIt) Invalid schema "`+e+`": `+t)}Object.keys(e.__schemas__).forEach(function(t){let n=e.__schemas__[t];if(n===null)return;let r={validate:null,link:null};if(e.__compiled__[t]=r,qH(n)){JH(n.validate)?r.validate=rU(n.validate):YH(n.validate)?r.validate=n.validate:a(t,n),YH(n.normalize)?r.normalize=n.normalize:n.normalize?a(t,n):r.normalize=iU();return}if(KH(n)){i.push(t);return}a(t,n)}),i.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:iU()};let o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(XH).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+o+`)`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+o+`)`,`ig`),e.re.schema_at_start=RegExp(`^`+e.re.schema_search.source,`i`),e.re.pretest=RegExp(`(`+e.re.schema_test.source+`)|(`+e.re.host_fuzzy_test.source+`)|@`,`i`),nU(e)}function oU(e,t){let n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function sU(e,t){let n=new oU(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function cU(e,t){if(!(this instanceof cU))return new cU(e,t);t||QH(e)&&(t=e,e={}),this.__opts__=WH({},ZH,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=WH({},$H,e),this.__compiled__={},this.__tlds__=tU,this.__tlds_replaced__=!1,this.re={},aU(this)}cU.prototype.add=function(e,t){return this.__schemas__[e]=t,aU(this),this},cU.prototype.set=function(e){return this.__opts__=WH(this.__opts__,e),this},cU.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let t,n,r,i,a,o,s,c,l;if(this.re.schema_test.test(e)){for(s=this.re.schema_search,s.lastIndex=0;(t=s.exec(e))!==null;)if(i=this.testSchemaAt(e,t[2],s.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=n.index+n[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__=``,this.__index__=a,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&(l=e.indexOf(`@`),l>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(a=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__=`mailto:`,this.__index__=a,this.__last_index__=o))),this.__index__>=0},cU.prototype.pretest=function(e){return this.re.pretest.test(e)},cU.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},cU.prototype.match=function(e){let t=[],n=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(sU(this,n)),n=this.__last_index__);let r=n?e.slice(n):e;for(;this.test(r);)t.push(sU(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return t.length?t:null},cU.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;let t=this.re.schema_at_start.exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);return n?(this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+n,sU(this,0)):null},cU.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),aU(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,aU(this),this)},cU.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},cU.prototype.onCompile=function(){};var lU=2147483647,uU=36,dU=1,fU=26,pU=38,mU=700,hU=72,gU=128,_U=`-`,vU=/^xn--/,yU=/[^\0-\x7F]/,bU=/[\x2E\u3002\uFF0E\uFF61]/g,xU={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},SU=uU-dU,CU=Math.floor,wU=String.fromCharCode;function TU(e){throw RangeError(xU[e])}function EU(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function DU(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(bU,`.`);let i=EU(e.split(`.`),t).join(`.`);return r+i}function OU(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}var kU=e=>String.fromCodePoint(...e),AU=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:uU},jU=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},MU=function(e,t,n){let r=0;for(e=n?CU(e/mU):e>>1,e+=CU(e/t);e>SU*fU>>1;r+=uU)e=CU(e/SU);return CU(r+(SU+1)*e/(e+pU))},NU=function(e){let t=[],n=e.length,r=0,i=gU,a=hU,o=e.lastIndexOf(_U);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&TU(`not-basic`),t.push(e.charCodeAt(n));for(let s=o>0?o+1:0;s<n;){let o=r;for(let t=1,i=uU;;i+=uU){s>=n&&TU(`invalid-input`);let o=AU(e.charCodeAt(s++));o>=uU&&TU(`invalid-input`),o>CU((lU-r)/t)&&TU(`overflow`),r+=o*t;let c=i<=a?dU:i>=a+fU?fU:i-a;if(o<c)break;let l=uU-c;t>CU(lU/l)&&TU(`overflow`),t*=l}let c=t.length+1;a=MU(r-o,c,o==0),CU(r/c)>lU-i&&TU(`overflow`),i+=CU(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},PU=function(e){let t=[];e=OU(e);let n=e.length,r=gU,i=0,a=hU;for(let n of e)n<128&&t.push(wU(n));let o=t.length,s=o;for(o&&t.push(_U);s<n;){let n=lU;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>CU((lU-i)/c)&&TU(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>lU&&TU(`overflow`),n===r){let e=i;for(let n=uU;;n+=uU){let r=n<=a?dU:n>=a+fU?fU:n-a;if(e<r)break;let i=e-r,o=uU-r;t.push(wU(jU(r+i%o,0))),e=CU(i/o)}t.push(wU(jU(e,0))),a=MU(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},FU={version:`2.3.1`,ucs2:{decode:OU,encode:kU},decode:NU,encode:PU,toASCII:function(e){return DU(e,function(e){return yU.test(e)?`xn--`+PU(e):e})},toUnicode:function(e){return DU(e,function(e){return vU.test(e)?NU(e.slice(4).toLowerCase()):e})}},IU={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`“”‘’`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},LU=/^(vbscript|javascript|file|data):/,RU=/^data:image\/(gif|png|jpeg|webp);/;function zU(e){let t=e.trim().toLowerCase();return LU.test(t)?RU.test(t):!0}var BU=[`http:`,`https:`,`mailto:`];function VU(e){let t=tB(e,!0);if(t.hostname&&(!t.protocol||BU.indexOf(t.protocol)>=0))try{t.hostname=FU.toASCII(t.hostname)}catch{}return Hz(Uz(t))}function HU(e){let t=tB(e,!0);if(t.hostname&&(!t.protocol||BU.indexOf(t.protocol)>=0))try{t.hostname=FU.toUnicode(t.hostname)}catch{}return zz(Uz(t),zz.defaultChars+`%`)}function UU(e,t){if(!(this instanceof UU))return new UU(e,t);t||jB(e)||(t=e||{},e=`default`),this.inline=new HH,this.block=new sH,this.core=new IV,this.renderer=new cV,this.linkify=new cU,this.validateLink=zU,this.normalizeLink=VU,this.normalizeLinkText=HU,this.utils=kB,this.helpers=PB({},oV),this.options={},this.configure(e),t&&this.set(t)}UU.prototype.set=function(e){return PB(this.options,e),this},UU.prototype.configure=function(e){let t=this;if(jB(e)){let t=e;if(e=IU[t],!e)throw Error('Wrong `markdown-it` preset "'+t+`", check name`)}if(!e)throw Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[n].ruler2.enableOnly(e.components[n].rules2)}),this},UU.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): `+r);return this},UU.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): `+r);return this},UU.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},UU.prototype.parse=function(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens},UU.prototype.render=function(e,t){return t||={},this.renderer.render(this.parse(e,t),this.options,t)},UU.prototype.parseInline=function(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens},UU.prototype.renderInline=function(e,t){return t||={},this.renderer.render(this.parseInline(e,t),this.options,t)};var WU=new AS({nodes:{doc:{content:`block+`},paragraph:{content:`inline*`,group:`block`,parseDOM:[{tag:`p`}],toDOM(){return[`p`,0]}},blockquote:{content:`block+`,group:`block`,parseDOM:[{tag:`blockquote`}],toDOM(){return[`blockquote`,0]}},horizontal_rule:{group:`block`,parseDOM:[{tag:`hr`}],toDOM(){return[`div`,[`hr`]]}},heading:{attrs:{level:{default:1}},content:`(text | image)*`,group:`block`,defining:!0,parseDOM:[{tag:`h1`,attrs:{level:1}},{tag:`h2`,attrs:{level:2}},{tag:`h3`,attrs:{level:3}},{tag:`h4`,attrs:{level:4}},{tag:`h5`,attrs:{level:5}},{tag:`h6`,attrs:{level:6}}],toDOM(e){return[`h`+e.attrs.level,0]}},code_block:{content:`text*`,group:`block`,code:!0,defining:!0,marks:``,attrs:{params:{default:``}},parseDOM:[{tag:`pre`,preserveWhitespace:`full`,getAttrs:e=>({params:e.getAttribute(`data-params`)||``})}],toDOM(e){return[`pre`,e.attrs.params?{"data-params":e.attrs.params}:{},[`code`,0]]}},ordered_list:{content:`list_item+`,group:`block`,attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:`ol`,getAttrs(e){return{order:e.hasAttribute(`start`)?+e.getAttribute(`start`):1,tight:e.hasAttribute(`data-tight`)}}}],toDOM(e){return[`ol`,{start:e.attrs.order==1?null:e.attrs.order,"data-tight":e.attrs.tight?`true`:null},0]}},bullet_list:{content:`list_item+`,group:`block`,attrs:{tight:{default:!1}},parseDOM:[{tag:`ul`,getAttrs:e=>({tight:e.hasAttribute(`data-tight`)})}],toDOM(e){return[`ul`,{"data-tight":e.attrs.tight?`true`:null},0]}},list_item:{content:`block+`,defining:!0,parseDOM:[{tag:`li`}],toDOM(){return[`li`,0]}},text:{group:`inline`},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:`inline`,draggable:!0,parseDOM:[{tag:`img[src]`,getAttrs(e){return{src:e.getAttribute(`src`),title:e.getAttribute(`title`),alt:e.getAttribute(`alt`)}}}],toDOM(e){return[`img`,e.attrs]}},hard_break:{inline:!0,group:`inline`,selectable:!1,parseDOM:[{tag:`br`}],toDOM(){return[`br`]}}},marks:{em:{parseDOM:[{tag:`i`},{tag:`em`},{style:`font-style=italic`},{style:`font-style=normal`,clearMark:e=>e.type.name==`em`}],toDOM(){return[`em`]}},strong:{parseDOM:[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!=`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name==`strong`},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM(){return[`strong`]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:`a[href]`,getAttrs(e){return{href:e.getAttribute(`href`),title:e.getAttribute(`title`)}}}],toDOM(e){return[`a`,e.attrs]}},code:{code:!0,parseDOM:[{tag:`code`}],toDOM(){return[`code`]}}}});function GU(e,t){if(e.isText&&t.isText&&zx.sameSet(e.marks,t.marks))return e.withText(e.text+t.text)}var KU=class{constructor(e,t){this.schema=e,this.tokenHandlers=t,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:zx.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let t=this.top(),n=t.content,r=n[n.length-1],i=this.schema.text(e,t.marks),a;r&&(a=GU(r,i))?n[n.length-1]=a:n.push(i)}openMark(e){let t=this.top();t.marks=e.addToSet(t.marks)}closeMark(e){let t=this.top();t.marks=e.removeFromSet(t.marks)}parseTokens(e){for(let t=0;t<e.length;t++){let n=e[t],r=this.tokenHandlers[n.type];if(!r)throw Error("Token type `"+n.type+"` not supported by Markdown parser");r(this,n,e,t)}}addNode(e,t,n){let r=this.top(),i=e.createAndFill(t,n,r?r.marks:[]);return i?(this.push(i),i):null}openNode(e,t){this.stack.push({type:e,attrs:t,content:[],marks:zx.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}};function qU(e,t,n,r){return e.getAttrs?e.getAttrs(t,n,r):e.attrs instanceof Function?e.attrs(t):e.attrs}function JU(e,t){return e.noCloseToken||t==`code_inline`||t==`code_block`||t==`fence`}function YU(e){return e[e.length-1]==`
|
|
200
|
-
`?e.slice(0,e.length-1):e}function XU(){}function ZU(e,t){let n=Object.create(null);for(let r in t){let i=t[r];if(i.block){let t=e.nodeType(i.block);JU(i,r)?n[r]=(e,n,r,a)=>{e.openNode(t,qU(i,n,r,a)),e.addText(YU(n.content)),e.closeNode()}:(n[r+`_open`]=(e,n,r,a)=>e.openNode(t,qU(i,n,r,a)),n[r+`_close`]=e=>e.closeNode())}else if(i.node){let t=e.nodeType(i.node);n[r]=(e,n,r,a)=>e.addNode(t,qU(i,n,r,a))}else if(i.mark){let t=e.marks[i.mark];JU(i,r)?n[r]=(e,n,r,a)=>{e.openMark(t.create(qU(i,n,r,a))),e.addText(YU(n.content)),e.closeMark(t)}:(n[r+`_open`]=(e,n,r,a)=>e.openMark(t.create(qU(i,n,r,a))),n[r+`_close`]=e=>e.closeMark(t))}else if(i.ignore)JU(i,r)?n[r]=XU:(n[r+`_open`]=XU,n[r+`_close`]=XU);else throw RangeError(`Unrecognized parsing spec `+JSON.stringify(i))}return n.text=(e,t)=>e.addText(t.content),n.inline=(e,t)=>e.parseTokens(t.children),n.softbreak=n.softbreak||(e=>e.addText(` `)),n}var QU=class{constructor(e,t,n){this.schema=e,this.tokenizer=t,this.tokens=n,this.tokenHandlers=ZU(e,n)}parse(e,t={}){let n=new KU(this.schema,this.tokenHandlers),r;n.parseTokens(this.tokenizer.parse(e,t));do r=n.closeNode();while(n.stack.length);return r||this.schema.topNodeType.createAndFill()}};function $U(e,t){for(;++t<e.length;)if(e[t].type!=`list_item_open`)return e[t].hidden;return!1}new QU(WU,UU(`commonmark`,{html:!1}),{blockquote:{block:`blockquote`},paragraph:{block:`paragraph`},list_item:{block:`list_item`},bullet_list:{block:`bullet_list`,getAttrs:(e,t,n)=>({tight:$U(t,n)})},ordered_list:{block:`ordered_list`,getAttrs:(e,t,n)=>({order:+e.attrGet(`start`)||1,tight:$U(t,n)})},heading:{block:`heading`,getAttrs:e=>({level:+e.tag.slice(1)})},code_block:{block:`code_block`,noCloseToken:!0},fence:{block:`code_block`,getAttrs:e=>({params:e.info||``}),noCloseToken:!0},hr:{node:`horizontal_rule`},image:{node:`image`,getAttrs:e=>({src:e.attrGet(`src`),title:e.attrGet(`title`)||null,alt:e.children[0]&&e.children[0].content||null})},hardbreak:{node:`hard_break`},em:{mark:`em`},strong:{mark:`strong`},link:{mark:`link`,getAttrs:e=>({href:e.attrGet(`href`),title:e.attrGet(`title`)||null})},code_inline:{mark:`code`,noCloseToken:!0}});var eW={open:``,close:``,mixable:!0},tW=new class{constructor(e,t,n={}){this.nodes=e,this.marks=t,this.options=n}serialize(e,t={}){t=Object.assign({},this.options,t);let n=new iW(this.nodes,this.marks,t);return n.renderContent(e),n.out}}({blockquote(e,t){e.wrapBlock(`> `,null,t,()=>e.renderContent(t))},code_block(e,t){let n=t.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";e.write(r+(t.attrs.params||``)+`
|
|
201
|
-
`),e.text(t.textContent,!1),e.write(`
|
|
202
|
-
`),e.write(r),e.closeBlock(t)},heading(e,t){e.write(e.repeat(`#`,t.attrs.level)+` `),e.renderInline(t,!1),e.closeBlock(t)},horizontal_rule(e,t){e.write(t.attrs.markup||`---`),e.closeBlock(t)},bullet_list(e,t){e.renderList(t,` `,()=>(t.attrs.bullet||`*`)+` `)},ordered_list(e,t){let n=t.attrs.order||1,r=String(n+t.childCount-1).length,i=e.repeat(` `,r+2);e.renderList(t,i,t=>{let i=String(n+t);return e.repeat(` `,r-i.length)+i+`. `})},list_item(e,t){e.renderContent(t)},paragraph(e,t){e.renderInline(t),e.closeBlock(t)},image(e,t){e.write(`]/g,`\\$&`)+(t.attrs.title?` "`+t.attrs.title.replace(/"/g,`\\"`)+`"`:``)+`)`)},hard_break(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(`\\
|
|
203
|
-
`);return}},text(e,t){e.text(t.text,!e.inAutolink)}},{em:{open:`*`,close:`*`,mixable:!0,expelEnclosingWhitespace:!0},strong:{open:`**`,close:`**`,mixable:!0,expelEnclosingWhitespace:!0},link:{open(e,t,n,r){return e.inAutolink=rW(t,n,r),e.inAutolink?`<`:`[`},close(e,t,n,r){let{inAutolink:i}=e;return e.inAutolink=void 0,i?`>`:`](`+t.attrs.href.replace(/[\(\)"]/g,`\\$&`)+(t.attrs.title?` "${t.attrs.title.replace(/"/g,`\\"`)}"`:``)+`)`},mixable:!0},code:{open(e,t,n,r){return nW(n.child(r),-1)},close(e,t,n,r){return nW(n.child(r-1),1)},escape:!1}});function nW(e,t){let n=/`+/g,r,i=0;if(e.isText)for(;r=n.exec(e.text);)i=Math.max(i,r[0].length);let a=i>0&&t>0?" `":"`";for(let e=0;e<i;e++)a+="`";return i>0&&t<0&&(a+=` `),a}function rW(e,t,n){if(e.attrs.title||!/^\w+:/.test(e.attrs.href))return!1;let r=t.child(n);return!r.isText||r.text!=e.attrs.href||r.marks[r.marks.length-1]!=e?!1:n==t.childCount-1||!e.isInSet(t.child(n+1).marks)}var iW=class{constructor(e,t,n){this.nodes=e,this.marks=t,this.options=n,this.delim=``,this.out=``,this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,this.options.tightLists===void 0&&(this.options.tightLists=!1),this.options.hardBreakNodeName===void 0&&(this.options.hardBreakNodeName=`hard_break`)}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
|
|
204
|
-
`),e>1){let t=this.delim,n=/\s+$/.exec(t);n&&(t=t.slice(0,t.length-n[0].length));for(let n=1;n<e;n++)this.out+=t+`
|
|
205
|
-
`}this.closed=null}}getMark(e){let t=this.marks[e];if(!t){if(this.options.strict!==!1)throw Error(`Mark type \`${e}\` not supported by Markdown renderer`);t=eW}return t}wrapBlock(e,t,n,r){let i=this.delim;this.write(t??e),this.delim+=e,r(),this.delim=i,this.closeBlock(n)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
|
|
206
|
-
`)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,t=!0){let n=e.split(`
|
|
207
|
-
`);for(let e=0;e<n.length;e++)this.write(),!t&&n[e][0]==`[`&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+`\\!`),this.out+=t?this.esc(n[e],this.atBlockStart):n[e],e!=n.length-1&&(this.out+=`
|
|
208
|
-
`)}render(e,t,n){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,t,n);else if(this.options.strict!==!1)throw Error("Token type `"+e.type.name+"` not supported by Markdown renderer");else e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}renderContent(e){e.forEach((t,n,r)=>this.render(t,e,r))}renderInline(e,t=!0){this.atBlockStart=t;let n=[],r=``,i=(t,i,a)=>{let o=t?t.marks:[];t&&t.type.name===this.options.hardBreakNodeName&&(o=o.filter(t=>{if(a+1==e.childCount)return!1;let n=e.child(a+1);return t.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))}));let s=r;if(r=``,t&&t.isText&&o.some(e=>{let t=this.getMark(e.type.name);return t&&t.expelEnclosingWhitespace&&!e.isInSet(n)})){let[e,r,i]=/^(\s*)(.*)$/m.exec(t.text);r&&(s+=r,t=i?t.withText(i):null,t||(o=n))}if(t&&t.isText&&o.some(t=>{let n=this.getMark(t.type.name);return n&&n.expelEnclosingWhitespace&&!this.isMarkAhead(e,a+1,t)})){let[e,i,a]=/^(.*?)(\s*)$/m.exec(t.text);a&&(r=a,t=i?t.withText(i):null,t||(o=n))}let c=o.length?o[o.length-1]:null,l=c&&this.getMark(c.type.name).escape===!1,u=o.length-+!!l;outer:for(let e=0;e<u;e++){let t=o[e];if(!this.getMark(t.type.name).mixable)break;for(let r=0;r<n.length;r++){let i=n[r];if(!this.getMark(i.type.name).mixable)break;if(t.eq(i)){e>r?o=o.slice(0,r).concat(t).concat(o.slice(r,e)).concat(o.slice(e+1,u)):r>e&&(o=o.slice(0,e).concat(o.slice(e+1,r)).concat(t).concat(o.slice(r,u)));continue outer}}}let d=0;for(;d<Math.min(n.length,u)&&o[d].eq(n[d]);)++d;for(;d<n.length;)this.text(this.markString(n.pop(),!1,e,a),!1);if(s&&this.text(s),t){for(;n.length<u;){let t=o[n.length];n.push(t),this.text(this.markString(t,!0,e,a),!1),this.atBlockStart=!1}l&&t.isText?this.text(this.markString(c,!0,e,a)+t.text+this.markString(c,!1,e,a+1),!1):this.render(t,e,a),this.atBlockStart=!1}t?.isText&&t.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(i),i(null,0,e.childCount),this.atBlockStart=!1}renderList(e,t,n){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let r=e.attrs.tight===void 0?this.options.tightLists:e.attrs.tight,i=this.inTightList;this.inTightList=r,e.forEach((i,a,o)=>{o&&r&&this.flushClose(1),this.wrapBlock(t,n(o),e,()=>this.render(i,e,o))}),this.inTightList=i}esc(e,t=!1){return e=e.replace(/[`*\\~\[\]_]/g,(t,n)=>t==`_`&&n>0&&n+1<e.length&&e[n-1].match(/\w/)&&e[n+1].match(/\w/)?t:`\\`+t),t&&(e=e.replace(/^(\+[ ]|[\-*>])/,`\\$&`).replace(/^(\s*)(#{1,6})(\s|$)/,`$1\\$2$3`).replace(/^(\s*\d+)\.\s/,`$1\\. `)),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,`\\$&`)),e}quote(e){let t=e.indexOf(`"`)==-1?`""`:e.indexOf(`'`)==-1?`''`:`()`;return t[0]+e+t[1]}repeat(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}markString(e,t,n,r){let i=this.getMark(e.type.name),a=t?i.open:i.close;return typeof a==`string`?a:a(this,e,n,r)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,t,n){for(;;t++){if(t>=e.childCount)return!1;let r=e.child(t);if(r.type.name!=this.options.hardBreakNodeName)return n.isInSet(r.marks);t++}}},aW=l(o(((e,t)=>{var n=!0,r=!1,i=!1;t.exports=function(e,t){t&&(n=!t.enabled,r=!!t.label,i=!!t.labelAfter),e.core.ruler.after(`inline`,`github-task-lists`,function(e){for(var t=e.tokens,r=2;r<t.length;r++)s(t,r)&&(c(t[r],e.Token),a(t[r-2],`class`,`task-list-item`+(n?``:` enabled`)),a(t[o(t,r-2)],`class`,`contains-task-list`))})};function a(e,t,n){var r=e.attrIndex(t),i=[t,n];r<0?e.attrPush(i):e.attrs[r]=i}function o(e,t){for(var n=e[t].level-1,r=t-1;r>=0;r--)if(e[r].level===n)return r;return-1}function s(e,t){return p(e[t])&&m(e[t-1])&&h(e[t-2])&&g(e[t])}function c(e,t){if(e.children.unshift(l(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),r)if(i){e.children.pop();var n=`task-item-`+Math.ceil(1e4*1e3*Math.random()-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+` id="`+n+`">`,e.children.push(f(e.content,n,t))}else e.children.unshift(u(t)),e.children.push(d(t))}function l(e,t){var r=new t(`html_inline`,``,0),i=n?` disabled="" `:``;return e.content.indexOf(`[ ] `)===0?r.content=`<input class="task-list-item-checkbox"`+i+`type="checkbox">`:(e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0)&&(r.content=`<input class="task-list-item-checkbox" checked=""`+i+`type="checkbox">`),r}function u(e){var t=new e(`html_inline`,``,0);return t.content=`<label>`,t}function d(e){var t=new e(`html_inline`,``,0);return t.content=`</label>`,t}function f(e,t,n){var r=new n(`html_inline`,``,0);return r.content=`<label class="task-list-item-label" for="`+t+`">`+e+`</label>`,r.attrs=[{for:t}],r}function p(e){return e.type===`inline`}function m(e){return e.type===`paragraph_open`}function h(e){return e.type===`list_item_open`}function g(e){return e.content.indexOf(`[ ] `)===0||e.content.indexOf(`[x] `)===0||e.content.indexOf(`[X] `)===0}}))(),1),oW=Object.defineProperty,sW=(e,t,n)=>t in e?oW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cW=(e,t,n)=>(sW(e,typeof t==`symbol`?t:t+``,n),n),lW=iN.create({name:`markdownTightLists`,addOptions:()=>({tight:!0,tightClass:`tight`,listTypes:[`bulletList`,`orderedList`]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:e=>e.getAttribute(`data-tight`)===`true`||!e.querySelector(`p`),renderHTML:e=>({class:e.tight?this.options.tightClass:null,"data-tight":e.tight?`true`:null})}}}]},addCommands(){var e=this;return{toggleTight:function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return n=>{let{editor:r,commands:i}=n;function a(e){if(!r.isActive(e))return!1;let n=r.getAttributes(e);return i.updateAttributes(e,{tight:t??!(n!=null&&n.tight)})}return e.options.listTypes.some(e=>a(e))}}}}}),uW=UU();function dW(e,t){return uW.inline.State.prototype.scanDelims.call({src:e,posMax:e.length}),new uW.inline.State(e,null,null,[]).scanDelims(t,!0)}function fW(e,t,n,r){let i=e.substring(0,n)+e.substring(n+t.length);return i=i.substring(0,n+r)+t+i.substring(n+r),i}function pW(e,t,n,r){let i=n,a=e;for(;i<r&&!dW(a,i).can_open;)a=fW(a,t,i,1),i++;return{text:a,from:i,to:r}}function mW(e,t,n,r){let i=r,a=e;for(;i>n&&!dW(a,i).can_close;)a=fW(a,t,i,-1),i--;return{text:a,from:n,to:i}}function hW(e,t,n,r){let i={text:e,from:n,to:r};return i=pW(i.text,t,i.from,i.to),i=mW(i.text,t,i.from,i.to),i.to-i.from<t.length+1&&(i.text=i.text.substring(0,i.from)+i.text.substring(i.to+t.length)),i.text}var gW=class extends iW{constructor(e,t,n){super(e,t,n??{}),cW(this,`inTable`,!1),this.inlines=[]}render(e,t,n){super.render(e,t,n);let r=this.inlines[this.inlines.length-1];if(r!=null&&r.start&&r!=null&&r.end){let{delimiter:e,start:t,end:n}=this.normalizeInline(r);this.out=hW(this.out,e,t,n),this.inlines.pop()}}markString(e,t,n,r){let i=this.marks[e.type.name];if(i.expelEnclosingWhitespace)if(t)this.inlines.push({start:this.out.length,delimiter:i.open});else{let e=this.inlines.pop();this.inlines.push({...e,end:this.out.length})}return super.markString(e,t,n,r)}normalizeInline(e){let{start:t,end:n}=e;for(;this.out.charAt(t).match(/\s/);)t++;return{...e,start:t}}},_W=JM.create({name:`markdownHTMLMark`,addStorage(){return{markdown:{serialize:{open(e,t){return this.editor.storage.markdown.options.html?vW(t)?.[0]??``:(console.warn(`Tiptap Markdown: "${t.type.name}" mark is only available in html mode`),``)},close(e,t){return this.editor.storage.markdown.options.html?vW(t)?.[1]??``:``}},parse:{}}}}});function vW(e){let t=e.type.schema,n=t.text(` `,[e]),r=Ej(V.from(n),t).match(/^(<.*?>) (<\/.*?>)$/);return r?[r[1],r[2]]:null}function yW(e){let t=`<body>${e}</body>`;return new window.DOMParser().parseFromString(t,`text/html`).body}function bW(e){return e?.replace(/</g,`<`).replace(/>/g,`>`)}function xW(e){let t=e.parentElement,n=t.cloneNode();for(;t.firstChild&&t.firstChild!==e;)n.appendChild(t.firstChild);n.childNodes.length>0&&t.parentElement.insertBefore(n,t),t.parentElement.insertBefore(e,t),t.childNodes.length===0&&t.remove()}function SW(e){let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}var CW=IN.create({name:`markdownHTMLNode`,addStorage(){return{markdown:{serialize(e,t,n){this.editor.storage.markdown.options.html?e.write(wW(t,n)):(console.warn(`Tiptap Markdown: "${t.type.name}" node is only available in html mode`),e.write(`[${t.type.name}]`)),t.isBlock&&e.closeBlock(t)},parse:{}}}}});function wW(e,t){let n=e.type.schema,r=Ej(V.from(e),n);return e.isBlock&&(t instanceof V||t.type.name===n.topNodeType.name)?TW(r):r}function TW(e){let t=yW(e).firstElementChild;return t.innerHTML=t.innerHTML.trim()?`
|
|
209
|
-
${t.innerHTML}
|
|
210
|
-
`:`
|
|
211
|
-
`,t.outerHTML}var EW=IN.create({name:`blockquote`}).extend({addStorage(){return{markdown:{serialize:tW.nodes.blockquote,parse:{}}}}}),DW=IN.create({name:`bulletList`}).extend({addStorage(){return{markdown:{serialize(e,t){return e.renderList(t,` `,()=>(this.editor.storage.markdown.options.bulletListMarker||`-`)+` `)},parse:{}}}}}),OW=IN.create({name:`codeBlock`}).extend({addStorage(){return{markdown:{serialize(e,t){e.write("```"+(t.attrs.language||``)+`
|
|
212
|
-
`),e.text(t.textContent,!1),e.ensureNewLine(),e.write("```"),e.closeBlock(t)},parse:{setup(e){e.set({langPrefix:this.options.languageClassPrefix??`language-`})},updateDOM(e){e.innerHTML=e.innerHTML.replace(/\n<\/code><\/pre>/g,`</code></pre>`)}}}}}}),kW=IN.create({name:`hardBreak`}).extend({addStorage(){return{markdown:{serialize(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(e.inTable?CW.storage.markdown.serialize.call(this,e,t,n):`\\
|
|
213
|
-
`);return}},parse:{}}}}}),AW=IN.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:tW.nodes.heading,parse:{}}}}}),jW=IN.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:tW.nodes.horizontal_rule,parse:{}}}}}),MW=IN.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:tW.nodes.image,parse:{}}}}}),NW=IN.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:tW.nodes.list_item,parse:{}}}}}),PW=IN.create({name:`orderedList`});function FW(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var IW=PW.extend({addStorage(){return{markdown:{serialize(e,t,n,r){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(` `,a+2),s=FW(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),LW=IN.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:tW.nodes.paragraph,parse:{}}}}});function RW(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var zW=IN.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!VW(t)){CW.storage.markdown.serialize.call(this,e,t,n);return}e.inTable=!0,t.forEach((t,n,r)=>{if(e.write(`| `),t.forEach((t,n,r)=>{r&&e.write(` | `);let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(` |`),e.ensureNewLine(),!r){let n=Array.from({length:t.childCount}).map(()=>`---`).join(` | `);e.write(`| ${n} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1},parse:{}}}}});function BW(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function VW(e){let t=RW(e),n=t[0],r=t.slice(1);return!(RW(n).some(e=>e.type.name!==`tableHeader`||BW(e)||e.childCount>1)||r.some(e=>RW(e).some(e=>e.type.name===`tableHeader`||BW(e)||e.childCount>1)))}var HW=[EW,DW,OW,kW,AW,jW,CW,MW,NW,IW,LW,zW,IN.create({name:`taskItem`}).extend({addStorage(){return{markdown:{serialize(e,t){let n=t.attrs.checked?`[x]`:`[ ]`;e.write(`${n} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(`.task-list-item`)].forEach(e=>{let t=e.querySelector(`input`);e.setAttribute(`data-type`,`taskItem`),t&&(e.setAttribute(`data-checked`,t.checked),t.remove())})}}}}}}),IN.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:DW.storage.markdown.serialize,parse:{setup(e){e.use(aW.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),IN.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(bW(t.text))},parse:{}}}}}),JM.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:tW.marks.strong,parse:{}}}}}),JM.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:tW.marks.code,parse:{}}}}}),_W,JM.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:tW.marks.em,parse:{}}}}}),JM.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:tW.marks.link,parse:{}}}}}),JM.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function UW(e){let t=e.storage?.markdown,n=HW.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var WW=class{constructor(e){cW(this,`editor`,null),this.editor=e}serialize(e){let t=new gW(this.nodes,this.marks,{hardBreakNodeName:kW.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(CW)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`node`&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(_W)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`mark`&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[])}}serializeNode(e){var t;return(t=UW(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=UW(e)?.serialize;return t?{...t,open:typeof t.open==`function`?t.open.bind({editor:this.editor,options:e.options}):t.open,close:typeof t.close==`function`?t.close.bind({editor:this.editor,options:e.options}):t.close}:null}},GW=class{constructor(e,t){cW(this,`editor`,null),cW(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(UU({html:n,linkify:r,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e==`string`){this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=UW(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=yW(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=UW(e))==null||(t=t.parse)==null||(t=t.updateDOM)==null?void 0:t.call({editor:this.editor,options:e.options},n)}),this.normalizeDOM(n,{inline:t,content:e}),n.innerHTML}return e}normalizeDOM(e,t){let{inline:n,content:r}=t;return this.normalizeBlocks(e),e.querySelectorAll(`*`).forEach(e=>{e.nextSibling?.nodeType===Node.TEXT_NODE&&!e.closest(`pre`)&&(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,``))}),n&&this.normalizeInline(e,r),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>e.spec.parseDOM?.map(e=>e.tag)).flat().filter(Boolean).join(`,`);t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches(`p`)&&xW(e)})}normalizeInline(e,t){var n;if((n=e.firstElementChild)!=null&&n.matches(`p`)){let n=e.firstElementChild,{nextElementSibling:r}=n,i=t.match(/^\s+/)?.[0]??``,a=r?``:t.match(/\s+$/)?.[0]??``;if(t.match(/^\n\n/)){n.innerHTML=`${n.innerHTML}${a}`;return}SW(n),e.innerHTML=`${i}${e.innerHTML}${a}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return t===`
|
|
214
|
-
`?t:t[t.length-1]===`
|
|
215
|
-
`?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},KW=iN.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new Pw({key:new Lw(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return PS.fromSchema(this.editor.schema).parseSlice(yW(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),qW=iN.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=rN.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new GW(this.editor,this.options),serializer:new WW(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[lW.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),KW.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),JW={showBold:!0,showItalic:!0,showUnderline:!0,showStrike:!0,showHeading1:!0,showHeading2:!0,showHeading3:!0,showBulletList:!0,showOrderedList:!0,showBlockquote:!0,showCodeBlock:!0,showLink:!0,showHorizontalRule:!0,showTextColor:!0,showHighlight:!0,showUndoRedo:!0,showClearFormat:!0},YW={bold:`Bold`,italic:`Italic`,underline:`Underline`,strike:`Strikethrough`,heading1:`Heading 1`,heading2:`Heading 2`,heading3:`Heading 3`,bulletList:`Bullet list`,orderedList:`Numbered list`,blockquote:`Blockquote`,codeBlock:`Code block`,link:`Insert link`,horizontalRule:`Horizontal rule`,textColor:`Text color`,removeTextColor:`Remove text color`,highlight:`Highlight`,removeHighlight:`Remove highlight`,undo:`Undo`,redo:`Redo`,clearFormat:`Clear formatting`,linkDialogTitle:`Insert link`,linkDialogUrlLabel:`URL`,linkDialogSave:`Save`,linkDialogCancel:`Cancel`,linkDialogRemove:`Remove link`,characterCount:`{count} characters`,characterCountMax:`{count} / {max} characters`};function XW({editor:e,error:t,disabled:n,readonly:r}){return(0,A.jsx)(d.Box,{sx:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`,px:1.5,py:1,cursor:n||r?`default`:`text`,opacity:n?.5:1,"& > div":{flex:1,display:`flex`,flexDirection:`column`,minHeight:0},"& .ProseMirror":{flex:1,minHeight:0,overflowY:`auto`,overflowX:`hidden`,wordBreak:`break-word`,overflowWrap:`break-word`,outline:`none`,"& p.is-editor-empty:first-of-type::before":{content:`attr(data-placeholder)`,color:`text.disabled`,pointerEvents:`none`,float:`left`,height:0},"& h1":{typography:`h4`,mb:1},"& h2":{typography:`h5`,mb:1},"& h3":{typography:`h6`,mb:1},"& p":{my:.5},"& ul, & ol":{pl:3},"& blockquote":{borderLeft:`4px solid`,borderColor:t?`error.main`:`divider`,pl:2,color:`text.secondary`,my:1},"& code":{bgcolor:`action.hover`,px:.5,borderRadius:.5,fontFamily:`monospace`,fontSize:`0.875em`},"& pre":{bgcolor:`action.hover`,p:1.5,borderRadius:1,overflowX:`auto`,"& code":{bgcolor:`transparent`,px:0}},"& a":{color:`primary.main`,cursor:`pointer`},"& mark":{borderRadius:.5,px:.25},"& hr":{borderColor:`divider`,my:2}}},children:(0,A.jsx)(UP,{editor:e})})}var ZW=M((0,A.jsx)(`path`,{d:`M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42M10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5`}),`FormatBold`),QW=M((0,A.jsx)(`path`,{d:`M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z`}),`FormatItalic`),$W=M((0,A.jsx)(`path`,{d:`M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6m-7 2v2h14v-2z`}),`FormatUnderlined`),eG=M((0,A.jsx)(`path`,{d:`M6.85 7.08C6.85 4.37 9.45 3 12.24 3c1.64 0 3 .49 3.9 1.28.77.65 1.46 1.73 1.46 3.24h-3.01c0-.31-.05-.59-.15-.85-.29-.86-1.2-1.28-2.25-1.28-1.86 0-2.34 1.02-2.34 1.7 0 .48.25.88.74 1.21.38.25.77.48 1.41.7H7.39c-.21-.34-.54-.89-.54-1.92M21 12v-2H3v2h9.62c1.15.45 1.96.75 1.96 1.97 0 1-.81 1.67-2.28 1.67-1.54 0-2.93-.54-2.93-2.51H6.4c0 .55.08 1.13.24 1.58.81 2.29 3.29 3.3 5.67 3.3 2.27 0 5.3-.89 5.3-4.05 0-.3-.01-1.16-.48-1.94H21z`}),`StrikethroughS`),tG=M((0,A.jsx)(`path`,{d:`M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z`}),`FormatListBulleted`),nG=M((0,A.jsx)(`path`,{d:`M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z`}),`FormatListNumbered`),rG=M((0,A.jsx)(`path`,{d:`M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z`}),`FormatQuote`),iG=M((0,A.jsx)(`path`,{d:`M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z`}),`Code`),aG=M((0,A.jsx)(`path`,{d:`M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5`}),`InsertLink`),oG=M((0,A.jsx)(`path`,{fillRule:`evenodd`,d:`M4 11h16v2H4z`}),`HorizontalRule`),sG=M((0,A.jsx)(`path`,{d:`M2 20h20v4H2zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5zm4.42-5.61 2.03-5.79h.12l2.03 5.79z`}),`FormatColorText`),cG=M((0,A.jsx)(`path`,{d:`M22 24H2v-4h20zM13.06 5.19l3.75 3.75L7.75 18H4v-3.75zm4.82 2.68-3.75-3.75 1.83-1.83c.39-.39 1.02-.39 1.41 0l2.34 2.34c.39.39.39 1.02 0 1.41z`}),`BorderColor`),lG=M((0,A.jsx)(`path`,{d:`M3.27 5 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21 18 19.73 3.55 5.27zM6 5v.18L8.82 8h2.4l-.72 1.68 2.1 2.1L14.21 8H20V5z`}),`FormatClear`);function uG({open:e,onClose:t,editor:n,translation:r}){let[i,a]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(e){let e=n.getAttributes(`link`).href;a(e??``)}},[e,n]);let o=n.isActive(`link`);function s(){i.trim()?n.chain().focus().extendMarkRange(`link`).setLink({href:i.trim()}).run():n.chain().focus().extendMarkRange(`link`).unsetLink().run(),t()}function c(){n.chain().focus().extendMarkRange(`link`).unsetLink().run(),t()}function l(e){e.key===`Enter`&&s()}return(0,A.jsxs)(d.Dialog,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,A.jsx)(d.DialogTitle,{children:r.linkDialogTitle}),(0,A.jsx)(d.DialogContent,{children:(0,A.jsx)(d.TextField,{autoFocus:!0,fullWidth:!0,label:r.linkDialogUrlLabel,value:i,onChange:e=>a(e.target.value),onKeyDown:l,variant:`outlined`,size:`small`,sx:{mt:1},placeholder:`https://`})}),(0,A.jsxs)(d.DialogActions,{sx:{px:3,pb:2,gap:1},children:[o&&(0,A.jsx)(d.Button,{onClick:c,color:`error`,sx:{mr:`auto`},children:r.linkDialogRemove}),(0,A.jsx)(d.Button,{onClick:t,children:r.linkDialogCancel}),(0,A.jsx)(d.Button,{onClick:s,variant:`contained`,children:r.linkDialogSave})]})]})}var dG=M((0,A.jsx)(`path`,{d:`M18 14c0-4-6-10.8-6-10.8s-1.33 1.51-2.73 3.52l8.59 8.59c.09-.42.14-.86.14-1.31m-.88 3.12L12.5 12.5 5.27 5.27 4 6.55l3.32 3.32C6.55 11.32 6 12.79 6 14c0 3.31 2.69 6 6 6 1.52 0 2.9-.57 3.96-1.5l2.63 2.63 1.27-1.27z`}),`FormatColorReset`),fG=[`#000000`,`#434343`,`#666666`,`#999999`,`#b7b7b7`,`#ffffff`,`#ff0000`,`#ff4500`,`#ff8c00`,`#ffd700`,`#9acd32`,`#008000`,`#00ced1`,`#1e90ff`,`#0000ff`,`#8a2be2`,`#ff1493`,`#a52a2a`],pG=[`#ffff00`,`#ffd700`,`#ffa500`,`#ff69b4`,`#ff6347`,`#fa8072`,`#adff2f`,`#90ee90`,`#00fa9a`,`#00ffff`,`#87ceeb`,`#add8e6`,`#dda0dd`,`#ee82ee`,`#d2b48c`,`#f5f5dc`,`#ffffff`,`#000000`];function mG({color:e,active:t,onClick:n}){return(0,A.jsx)(d.Tooltip,{title:e,placement:`top`,arrow:!0,children:(0,A.jsx)(d.Box,{component:`button`,type:`button`,onClick:()=>n(e),sx:{width:22,height:22,bgcolor:e,border:t?`2px solid`:`1px solid`,borderColor:t?`primary.main`:e===`#ffffff`||e===`#f5f5dc`?`divider`:`transparent`,borderRadius:.5,cursor:`pointer`,p:0,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`transform 0.1s`,"&:hover":{transform:`scale(1.2)`,zIndex:1}},children:t&&(0,A.jsx)(d.Box,{component:`span`,sx:{width:10,height:6,borderLeft:`2px solid`,borderBottom:`2px solid`,borderColor:e===`#ffffff`||e===`#f5f5dc`||e===`#ffd700`||e===`#ffff00`||e===`#adff2f`||e===`#ffa500`||e===`#b7b7b7`||e===`#d2b48c`?`#000`:`#fff`,transform:`rotate(-45deg) translateY(-1px)`,display:`block`}})})})}function hG({anchorEl:e,open:t,onClose:n,mode:r,activeColor:i,onSelectColor:a,onRemoveColor:o,removeLabel:s}){let c=(0,u.useRef)(null),l=r===`highlight`?pG:fG;function f(e){a(e.target.value)}return(0,A.jsxs)(d.Popover,{open:t,anchorEl:e,onClose:n,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},slotProps:{paper:{sx:{p:1.5}}},children:[(0,A.jsx)(d.Box,{sx:{display:`grid`,gridTemplateColumns:`repeat(6, 22px)`,gap:.5,mb:1},children:l.map(e=>(0,A.jsx)(mG,{color:e,active:i?.toLowerCase()===e.toLowerCase(),onClick:e=>{a(e),n()}},e))}),(0,A.jsxs)(d.Box,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,A.jsx)(d.Tooltip,{title:`Custom color`,arrow:!0,children:(0,A.jsx)(d.Box,{component:`button`,type:`button`,onClick:()=>c.current?.click(),sx:{width:22,height:22,background:`conic-gradient(red, yellow, lime, cyan, blue, magenta, red)`,border:`1px solid`,borderColor:`divider`,borderRadius:.5,cursor:`pointer`,p:0,flexShrink:0,"&:hover":{transform:`scale(1.2)`},transition:`transform 0.1s`}})}),(0,A.jsx)(`input`,{ref:c,type:`color`,defaultValue:i??`#000000`,onChange:f,onBlur:n,style:{visibility:`hidden`,width:0,height:0,position:`absolute`}}),(0,A.jsx)(d.Tooltip,{title:s,arrow:!0,children:(0,A.jsx)(d.IconButton,{size:`small`,onClick:()=>{o(),n()},sx:{borderRadius:1,ml:`auto`},children:(0,A.jsx)(dG,{fontSize:`small`})})})]})]})}function gG({label:e,icon:t,onClick:n,active:r,disabled:i}){return(0,A.jsx)(d.Tooltip,{title:e,arrow:!0,children:(0,A.jsx)(`span`,{children:(0,A.jsx)(d.IconButton,{size:`small`,onMouseDown:e=>e.preventDefault(),onClick:n,disabled:i,color:r?`primary`:`default`,sx:{borderRadius:1},"aria-label":e,"aria-pressed":r,children:t})})})}function _G({label:e,icon:t,activeColor:n,disabled:r,onClick:i}){return(0,A.jsx)(d.Tooltip,{title:e,arrow:!0,children:(0,A.jsx)(`span`,{children:(0,A.jsxs)(d.IconButton,{size:`small`,onMouseDown:e=>e.preventDefault(),onClick:i,disabled:r,sx:{borderRadius:1,flexDirection:`column`,gap:0,pb:.25},"aria-label":e,children:[(0,A.jsx)(d.Box,{sx:{display:`flex`,alignItems:`center`},children:t}),(0,A.jsx)(d.Box,{sx:{width:`80%`,height:3,bgcolor:n??`text.primary`,borderRadius:.5,mt:`1px`}})]})})})}function vG(){return(0,A.jsx)(d.Box,{component:`span`,sx:{fontWeight:`bold`,fontSize:`0.875rem`,lineHeight:1},children:`H1`})}function yG(){return(0,A.jsx)(d.Box,{component:`span`,sx:{fontWeight:`bold`,fontSize:`0.875rem`,lineHeight:1},children:`H2`})}function bG(){return(0,A.jsx)(d.Box,{component:`span`,sx:{fontWeight:`bold`,fontSize:`0.875rem`,lineHeight:1},children:`H3`})}function xG({editor:e,toolbarConfig:t,translation:n,disabled:r}){let[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)(null),[c,l]=(0,u.useState)(null),f=r||!e,p=e?.getAttributes(`textStyle`)?.color,m=e?.getAttributes(`highlight`)?.color,h=t.showBold||t.showItalic||t.showUnderline||t.showStrike,g=t.showHeading1||t.showHeading2||t.showHeading3,_=t.showBulletList||t.showOrderedList,v=t.showBlockquote||t.showCodeBlock||t.showLink||t.showHorizontalRule,y=t.showTextColor||t.showHighlight,b=t.showUndoRedo||t.showClearFormat,x=[h,g,_,v,y,b],S=x.filter(Boolean).length;function C(e,t){return!e||x.slice(t+1).findIndex(Boolean)===-1?null:(0,A.jsx)(d.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}},`div-${t}`)}return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(d.Box,{sx:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:.25,px:1,py:.5},role:`toolbar`,"aria-label":`Text formatting`,children:[h&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[t.showBold&&(0,A.jsx)(gG,{label:n.bold,icon:(0,A.jsx)(ZW,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleBold().run(),active:e?.isActive(`bold`),disabled:f}),t.showItalic&&(0,A.jsx)(gG,{label:n.italic,icon:(0,A.jsx)(QW,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleItalic().run(),active:e?.isActive(`italic`),disabled:f}),t.showUnderline&&(0,A.jsx)(gG,{label:n.underline,icon:(0,A.jsx)($W,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleUnderline().run(),active:e?.isActive(`underline`),disabled:f}),t.showStrike&&(0,A.jsx)(gG,{label:n.strike,icon:(0,A.jsx)(eG,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleStrike().run(),active:e?.isActive(`strike`),disabled:f})]}),C(h,0),g&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[t.showHeading1&&(0,A.jsx)(gG,{label:n.heading1,icon:(0,A.jsx)(vG,{}),onClick:()=>e?.chain().focus().toggleHeading({level:1}).run(),active:e?.isActive(`heading`,{level:1}),disabled:f}),t.showHeading2&&(0,A.jsx)(gG,{label:n.heading2,icon:(0,A.jsx)(yG,{}),onClick:()=>e?.chain().focus().toggleHeading({level:2}).run(),active:e?.isActive(`heading`,{level:2}),disabled:f}),t.showHeading3&&(0,A.jsx)(gG,{label:n.heading3,icon:(0,A.jsx)(bG,{}),onClick:()=>e?.chain().focus().toggleHeading({level:3}).run(),active:e?.isActive(`heading`,{level:3}),disabled:f})]}),C(g,1),_&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[t.showBulletList&&(0,A.jsx)(gG,{label:n.bulletList,icon:(0,A.jsx)(tG,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleBulletList().run(),active:e?.isActive(`bulletList`),disabled:f}),t.showOrderedList&&(0,A.jsx)(gG,{label:n.orderedList,icon:(0,A.jsx)(nG,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleOrderedList().run(),active:e?.isActive(`orderedList`),disabled:f})]}),C(_,2),v&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[t.showBlockquote&&(0,A.jsx)(gG,{label:n.blockquote,icon:(0,A.jsx)(rG,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleBlockquote().run(),active:e?.isActive(`blockquote`),disabled:f}),t.showCodeBlock&&(0,A.jsx)(gG,{label:n.codeBlock,icon:(0,A.jsx)(iG,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleCodeBlock().run(),active:e?.isActive(`codeBlock`),disabled:f}),t.showLink&&(0,A.jsx)(gG,{label:n.link,icon:(0,A.jsx)(aG,{fontSize:`small`}),onClick:()=>a(!0),active:e?.isActive(`link`),disabled:f}),t.showHorizontalRule&&(0,A.jsx)(gG,{label:n.horizontalRule,icon:(0,A.jsx)(oG,{fontSize:`small`}),onClick:()=>e?.chain().focus().setHorizontalRule().run(),disabled:f})]}),C(v,3),y&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[t.showTextColor&&(0,A.jsx)(_G,{label:n.textColor,icon:(0,A.jsx)(sG,{fontSize:`small`}),activeColor:p,disabled:f,onClick:e=>s(e.currentTarget)}),t.showHighlight&&(0,A.jsx)(_G,{label:n.highlight,icon:(0,A.jsx)(cG,{fontSize:`small`}),activeColor:m,disabled:f,onClick:e=>l(e.currentTarget)})]}),C(y,4),b&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[t.showUndoRedo&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(gG,{label:n.undo,icon:(0,A.jsx)(Cy,{fontSize:`small`}),onClick:()=>e?.chain().focus().undo().run(),disabled:f||!e?.can().undo()}),(0,A.jsx)(gG,{label:n.redo,icon:(0,A.jsx)(wy,{fontSize:`small`}),onClick:()=>e?.chain().focus().redo().run(),disabled:f||!e?.can().redo()})]}),t.showClearFormat&&(0,A.jsx)(gG,{label:n.clearFormat,icon:(0,A.jsx)(lG,{fontSize:`small`}),onClick:()=>e?.chain().focus().clearNodes().unsetAllMarks().run(),disabled:f})]}),S===0&&(0,A.jsx)(d.Box,{sx:{height:32}})]}),t.showLink&&e&&(0,A.jsx)(uG,{open:i,onClose:()=>a(!1),editor:e,translation:n}),t.showTextColor&&(0,A.jsx)(hG,{anchorEl:o,open:!!o,onClose:()=>s(null),mode:`textColor`,activeColor:p,onSelectColor:t=>e?.chain().focus().setColor(t).run(),onRemoveColor:()=>e?.chain().focus().unsetColor().run(),removeLabel:n.removeTextColor}),t.showHighlight&&(0,A.jsx)(hG,{anchorEl:c,open:!!c,onClose:()=>l(null),mode:`highlight`,activeColor:m,onSelectColor:t=>e?.chain().focus().setHighlight({color:t}).run(),onRemoveColor:()=>e?.chain().focus().unsetHighlight().run(),removeLabel:n.removeHighlight})]})}function SG({helperText:e,error:t,showCharacterCount:n,charCount:r,maxCharacters:i,translation:a}){let o=i===void 0?a.characterCount.replace(`{count}`,String(r)):a.characterCountMax.replace(`{count}`,String(r)).replace(`{max}`,String(i));return(0,A.jsxs)(d.Box,{sx:{display:`flex`,justifyContent:`space-between`,mt:.5,px:.5},children:[(0,A.jsx)(d.FormHelperText,{error:t,children:e??``}),n&&(0,A.jsx)(d.FormHelperText,{sx:{color:i!==void 0&&r>=i?`error`:`text.secondary`},children:o})]})}function CG(e){if(!(e===``||e===void 0))return typeof e==`string`&&e!==`auto`&&!isNaN(Number(e))?Number(e):e}function wG({value:e,onChange:t,placeholder:n,outputFormat:r=`html`,height:i,width:a,showCharacterCount:o=!1,maxCharacters:s,toolbarConfig:c,disabled:l=!1,readonly:f=!1,name:p,error:m=!1,helperText:h,translation:g,onBlur:_,onFocus:v}){let y={...YW,...g},b={...JW,...c},x=CG(i),S=CG(a),C=x===`auto`,w=C?void 0:x??200,T=ZP({shouldRerenderOnTransaction:!0,extensions:[wz.configure({link:{openOnClick:!1}}),Oz,Az,Iz.configure({multicolor:!0}),qW.configure({transformPastedText:!0,transformCopiedText:!1}),bz.configure({placeholder:n??``}),...s!==void 0&&s>0?[hz.configure({limit:s})]:o?[hz]:[]],content:e??``,editable:!l&&!f,onUpdate({editor:e}){t&&t(r===`json`?JSON.stringify(e.getJSON()):e.getHTML())},onBlur(){_?.()},onFocus(){v?.()}});(0,u.useEffect)(()=>{!T||e===void 0||(r===`json`?JSON.stringify(T.getJSON()):T.getHTML())!==e&&T.commands.setContent(e,{emitUpdate:!1})},[T,e,r]),(0,u.useEffect)(()=>{T&&T.setEditable(!l&&!f)},[T,l,f]);let E=T?.storage.characterCount?.characters?.()??0,ee=o||s!==void 0&&s>0||!!h;return(0,A.jsxs)(d.Box,{sx:{width:S??`100%`,...C?{display:`flex`,flexDirection:`column`,flex:1}:{}},children:[(0,A.jsxs)(d.Paper,{variant:`outlined`,sx:{display:`flex`,flexDirection:`column`,overflow:`hidden`,...C?{flex:1}:{height:w},borderColor:m?`error.main`:void 0,"&:focus-within":{borderColor:m?`error.main`:`primary.main`,borderWidth:2}},children:[!f&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(xG,{editor:T,toolbarConfig:b,translation:y,disabled:l}),(0,A.jsx)(d.Divider,{})]}),(0,A.jsx)(XW,{editor:T,error:m,disabled:l,readonly:f})]}),ee&&(0,A.jsx)(SG,{helperText:h,error:m,showCharacterCount:o||s!==void 0&&s>0,charCount:E,maxCharacters:s&&s>0?s:void 0,translation:y}),p&&(0,A.jsx)(`input`,{type:`hidden`,name:p,value:T?r===`json`?JSON.stringify(T.getJSON()):T.getHTML():``})]})}var TG={showFormat:!0,showCopy:!0,showClear:!0,showExecute:!1,showUndoRedo:!0},EG={format:`Format SQL`,copy:`Copy`,copySuccess:`Copied!`,clear:`Clear`,execute:`Execute`,undo:`Undo`,redo:`Redo`,lineColumn:`Ln {line}, Col {col}`,errorCount:`{count} error(s)`},DG=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=ah(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(PG(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 OG(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 kG(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=OG(t)+OG(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function AG(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:kG(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function jG(e,t){return n=>{for(let t=ah(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 MG=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function NG(e){return e.selection.main.from}function PG(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 FG=$a.define();function IG(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:N.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var LG=new WeakMap;function RG(e){if(!Array.isArray(e))return e;let t=LG.get(e);return t||LG.set(e,t=AG(e)),t}var zG=no.define(),BG=no.define(),VG=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=pa(e,t),r=ha(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(pa(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=pa(e,0),i=ha(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=pa(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=ha(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=pa(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=ma(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+=ha(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?ha(pa(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)}},HG=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)}},UG=P.define({combine(e){return yo(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:GG,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=>WG(e(n),t(n)),optionClass:(e,t)=>n=>WG(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function WG(e,t){return e?t?e+` `+t:e:t}function GG(e,t,n,r,i,a){let o=e.textDirection==nc.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 KG=no.define();function qG(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 JG(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 YG=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(UG);this.optionContent=qG(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=JG(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:KG.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(UG).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:BG.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=JG(r.length,i,e.state.facet(UG).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=JG(t.options.length,t.selected,this.view.state.facet(UG).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=>Bc(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&&ZG(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(UG).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 XG(e,t){return n=>new YG(n,e,t)}function ZG(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 QG(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function $G(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(UG);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 MG(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new HG(n):new VG(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 MG(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):QG(e.completion)>QG(c)&&(s[s.length-1]=e),c=e.completion}return s}var eK=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,aK(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=$G(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(UG).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,aK(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:mK,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)}},tK=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(oK,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(UG),i=(r.override||n.languageDataAt(`autocomplete`,NG(n)).map(RG)).map(e=>(this.active.find(t=>t.source==e)||new cK(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(dK));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!nK(i,this.active)||o?a=eK.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 cK(e.source,0):e));for(let e of t.effects)e.is(KG)&&(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?rK:iK}};function nK(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 rK={"aria-autocomplete":`list`},iK={};function aK(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var oK=[];function sK(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(FG);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 cK=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=sK(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(zG))i=new e(i.source,1,n.value);else if(n.is(BG))i=new e(i.source,0);else if(n.is(dK))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(NG(e.state))}},lK=class e extends cK{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=NG(t.state);if(o>a||!r||n&2&&(NG(t.startState)==this.from||o<this.limit))return new cK(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return uK(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 DG(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??NG(t.state)):new cK(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new e(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new cK(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function uK(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):PG(e,!0).test(i)}var dK=no.define({map(e,t){return e.map(e=>e.map(t))}}),fK=Fa.define({create(){return tK.start()},update(e,t){return e.update(t)},provide:e=>[kf.from(e,e=>e.tooltip),I.contentAttributes.from(e,e=>e.attrs)]});function pK(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(fK).active.find(e=>e.source==t.source);return r instanceof lK?(typeof n==`string`?e.dispatch({...IG(e.state,n,r.from,r.to),annotations:FG.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}var mK=XG(fK,pK);function hK(e,t=`option`){return n=>{let r=n.state.field(fK,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(UG).interactionDelay)return!1;let i=1,a;t==`page`&&(a=zf(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:KG.of(s)}),!0}}var gK=e=>{let t=e.state.field(fK,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(UG).interactionDelay?!1:pK(e,t.open.options[t.open.selected])},_K=e=>e.state.field(fK,!1)?(e.dispatch({effects:zG.of(!0)}),!0):!1,vK=e=>{let t=e.state.field(fK,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:BG.of(null)}),!0)},yK=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},bK=50,xK=1e3,SK=Wc.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(fK).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(fK),n=e.state.facet(UG);if(!e.selectionSet&&!e.docChanged&&e.startState.field(fK)==t)return;let r=e.transactions.some(e=>{let t=sK(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>bK&&Date.now()-n.time>xK){for(let e of n.context.abortListeners)try{e()}catch(e){Bc(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(zG)))&&(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(fK);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(UG).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new DG(t,NG(t),e.explicit,this.view),r=new yK(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:BG.of(null)}),Bc(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(UG).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(UG),n=this.view.state.field(fK);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=NG(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new lK(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 cK(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:dK.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(fK,!1);if(t&&t.tooltip&&this.view.state.facet(UG).closeOnBlur){let n=t.open&&zf(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:BG.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:zG.of(!1)}),20),this.composing=0}}}),CK=typeof navigator==`object`&&/Win/.test(navigator.platform),wK=Ra.highest(I.domEventHandlers({keydown(e,t){let n=t.state.field(fK,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(CK&&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&&pK(t,r),!1}})),TK=I.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`}}}),EK=new class extends bo{};EK.startSide=1,EK.endSide=-1,typeof navigator==`object`&&navigator.userAgent;function DK(e={}){return[wK,fK,UG.of(e),SK,kK,TK]}var OK=[{key:`Ctrl-Space`,run:_K},{mac:"Alt-`",run:_K},{mac:`Alt-i`,run:_K},{key:`Escape`,run:vK},{key:`ArrowDown`,run:hK(!0)},{key:`ArrowUp`,run:hK(!1)},{key:`PageDown`,run:hK(!0,`page`)},{key:`PageUp`,run:hK(!1,`page`)},{key:`Enter`,run:gK}],kK=Ra.highest(sf.computeN([UG],e=>e.facet(UG).defaultKeymap?[OK]:[])),AK=36,jK=1,MK=2,NK=3,PK=4,FK=5,IK=6,LK=7,RK=8,zK=9,BK=10,VK=11,HK=12,UK=13,WK=14,GK=15,KK=16,qK=17,JK=18,YK=19,XK=20,ZK=21,QK=22,$K=23,eq=24;function tq(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function nq(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function rq(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 iq(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 aq(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 oq(e,t){for(;!(e.next!=95&&!tq(e.next));)t!=null&&(t+=String.fromCharCode(e.next)),e.advance();return t}function sq(e){if(e.next==39||e.next==34||e.next==96){let t=e.next;e.advance(),rq(e,t,!1)}else oq(e)}function cq(e,t){for(;e.next==48||e.next==49;)e.advance();t&&e.next==t&&e.advance()}function lq(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 uq(e){for(;!(e.next<0||e.next==10);)e.advance()}function dq(e,t){for(let n=0;n<t.length;n++)if(t.charCodeAt(n)==e)return!0;return!1}var fq=` \r
|
|
216
|
-
`;function pq(e,t,n){let r=Object.create(null);r.true=r.false=FK,r.null=r.unknown=IK;for(let t of e.split(` `))t&&(r[t]=XK);for(let e of t.split(` `))e&&(r[e]=ZK);for(let e of(n||``).split(` `))e&&(r[e]=eq);return r}var mq=`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 `,hq=`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 `,gq={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:pq(hq,mq)};function _q(e,t,n,r){let i={};for(let t in gq)i[t]=(e.hasOwnProperty(t)?e:gq)[t];return t&&(i.words=pq(t,n||``,r)),i}function vq(e){return new sm(t=>{let{next:n}=t;if(t.advance(),dq(n,fq)){for(;dq(t.next,fq);)t.advance();t.acceptToken(AK)}else if(n==36&&e.doubleDollarQuotedStrings){let e=oq(t,``);t.next==36&&(t.advance(),iq(t,e),t.acceptToken(NK))}else if(n==39||n==34&&e.doubleQuotedStrings)rq(t,n,e.backslashEscapes),t.acceptToken(NK);else if(n==35&&e.hashComments||n==47&&t.next==47&&e.slashComments)uq(t),t.acceptToken(jK);else if(n==45&&t.next==45&&(!e.spaceAfterDashes||t.peek(1)==32))uq(t),t.acceptToken(jK);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(MK)}else if((n==101||n==69)&&t.next==39)t.advance(),rq(t,39,!0),t.acceptToken(NK);else if((n==110||n==78)&&t.next==39&&e.charSetCasts)t.advance(),rq(t,39,e.backslashEscapes),t.acceptToken(NK);else if(n==95&&e.charSetCasts)for(let n=0;;n++){if(t.next==39&&n>1){t.advance(),rq(t,39,e.backslashEscapes),t.acceptToken(NK);break}if(!tq(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(n==113||n==81)&&t.next==39&&t.peek(1)>0&&!dq(t.peek(1),fq)){let e=t.peek(1);t.advance(2),aq(t,e),t.acceptToken(NK)}else if(dq(n,e.identifierQuotes))rq(t,n==91?93:n,!1),t.acceptToken(YK);else if(n==40)t.acceptToken(LK);else if(n==41)t.acceptToken(RK);else if(n==123)t.acceptToken(zK);else if(n==125)t.acceptToken(BK);else if(n==91)t.acceptToken(VK);else if(n==93)t.acceptToken(HK);else if(n==59)t.acceptToken(UK);else if(e.unquotedBitLiterals&&n==48&&t.next==98)t.advance(),cq(t),t.acceptToken(QK);else if((n==98||n==66)&&(t.next==39||t.next==34)){let n=t.next;t.advance(),e.treatBitsAsBytes?(rq(t,n,e.backslashEscapes),t.acceptToken($K)):(cq(t,n),t.acceptToken(QK))}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();nq(t.next);)t.advance();e&&t.next==39&&t.advance(),t.acceptToken(PK)}else if(n==46&&t.next>=48&&t.next<=57)lq(t,!0),t.acceptToken(PK);else if(n==46)t.acceptToken(WK);else if(n>=48&&n<=57)lq(t,!1),t.acceptToken(PK);else if(dq(n,e.operatorChars)){for(;dq(t.next,e.operatorChars);)t.advance();t.acceptToken(GK)}else if(dq(n,e.specialVar))t.next==n&&t.advance(),sq(t),t.acceptToken(qK);else if(n==58||n==44)t.acceptToken(KK);else if(tq(n)){let r=oq(t,String.fromCharCode(n));t.acceptToken(t.next==46||t.peek(-r.length-1)==46?JK:e.words[r.toLowerCase()]??JK)}})}var yq=vq(gq),bq=ym.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,yq],topRules:{Script:[0,25]},tokenPrec:0});function xq(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function Sq(e,t){let n=e.sliceString(t.from,t.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(n);return r?r[2]:n}function Cq(e){return e&&(e.name==`Identifier`||e.name==`QuotedIdentifier`)}function wq(e,t){if(t.name==`CompositeIdentifier`){let n=[];for(let r=t.firstChild;r;r=r.nextSibling)Cq(r)&&n.push(Sq(e,r));return n}return[Sq(e,t)]}function Tq(e,t){for(let n=[];;){if(!t||t.name!=`.`)return n;let r=xq(t);if(!Cq(r))return n;n.unshift(Sq(e,r)),t=xq(r)}}function Eq(e,t){let n=ah(e).resolveInner(t,-1),r=Oq(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:Tq(e.doc,xq(n)),aliases:r}:n.name==`.`?{from:t,quoted:null,parents:Tq(e.doc,n),aliases:r}:{from:t,quoted:null,parents:[],empty:!0,aliases:r}}var Dq=new Set(`where group having order union intersect except all distinct limit offset fetch for`.split(` `));function Oq(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&&Cq(t.nextSibling))o=Sq(e,t.nextSibling);else if(n&&Dq.has(n))break;else a&&Cq(t)&&(o=Sq(e,t));o&&(r||=Object.create(null),r[o]=wq(e,a)),a=/Identifier$/.test(t.name)?t:null}return r}function kq(e,t,n){return n.map(n=>({...n,label:n.label[0]==e?n.label:e+n.label+t,apply:void 0}))}var Aq=/^\w*$/,jq=/^[`'"\[]?\w*[`'"\]]?$/;function Mq(e){return e.self&&typeof e.self.label==`string`}var Nq=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(Pq(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`?Pq(t,`property`,this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):Mq(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;Mq(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 Pq(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+Fq(n)}}function Fq(e){return e===`[`?`]`:e}function Iq(e,t,n,r,i,a){let o=new Nq(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}=Eq(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=Fq(t);return{from:n,to:e.state.sliceDoc(e.pos,e.pos+1)==r?e.pos+1:void 0,options:kq(t,r,u),validFor:jq}}else return{from:n,options:u,validFor:Aq}}}function Lq(e){return e==ZK?`type`:e==XK?`keyword`:`variable`}function Rq(e,t,n){return jG([`QuotedIdentifier`,`String`,`LineComment`,`BlockComment`,`.`],AG(Object.keys(e).map(r=>n(t?r.toUpperCase():r,Lq(e[r])))))}var zq=bq.configure({props:[Sh.add({Statement:Mh()}),Nh.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}}}),km({Keyword:z.keyword,Type:z.typeName,Builtin:z.standard(z.name),Bits:z.number,Bytes:z.string,Bool:z.bool,Null:z.null,Number:z.number,String:z.string,Identifier:z.name,QuotedIdentifier:z.special(z.string),SpecialVar:z.special(z.name),LineComment:z.lineComment,BlockComment:z.blockComment,Operator:z.operator,"Semi Punctuation":z.punctuation,"( )":z.paren,"{ }":z.brace,"[ ]":z.squareBracket})]}),Bq=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=_q(t,t.keywords,t.types,t.builtin);return new e(n,ih.define({name:`sql`,parser:zq.configure({tokenizers:[{from:yq,to:vq(n)}]}),languageData:{commentTokens:{line:`--`,block:{open:`/*`,close:`*/`}},closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]}}}),t)}};function Vq(e,t){return{label:e,type:t,boost:-1}}function Hq(e,t=!1,n){return Rq(e.dialect.words,t,n||Vq)}function Uq(e){return e.schema?Iq(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||Kq):()=>null}function Wq(e){return e.schema?(e.dialect||Kq).language.data.of({autocomplete:Uq(e)}):[]}function Gq(e={}){let t=e.dialect||Kq;return new hh(t.language,[Wq(e),t.language.data.of({autocomplete:Hq(t,e.upperCaseKeywords,e.keywordCompletion)})])}var Kq=Bq.define({}),qq=Bq.define({charSetCasts:!0,doubleDollarQuotedStrings:!0,operatorChars:"+-*/<>=~!@#%^&|`?",specialVar:``,keywords:hq+`abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes`,types:mq+`bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml`}),Jq=mq+`bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int1 int2 int3 int4 int8 float4 float8 varbinary varcharacter precision datetime unsigned signed`,Yq=Bq.define({operatorChars:`*+-%<>!=&|^`,charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:`@?`,identifierQuotes:"`",keywords:hq+`group_concat accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill`,types:Jq,builtin:`charset clear edit ego help nopager notee nowarning pager print prompt quit rehash source status system tee`});hq+``;var Xq=Bq.define({keywords:hq+`add external procedure all fetch public alter file raiserror and fillfactor read any for readtext as foreign reconfigure asc freetext references authorization freetexttable replication backup from restore begin full restrict between function return break goto revert browse grant revoke bulk group right by having rollback cascade holdlock rowcount case identity rowguidcol check identity_insert rule checkpoint identitycol save close if schema clustered in securityaudit coalesce index select collate inner semantickeyphrasetable column insert semanticsimilaritydetailstable commit intersect semanticsimilaritytable compute into session_user constraint is set contains join setuser containstable key shutdown continue kill some convert left statistics create like system_user cross lineno table current load tablesample current_date merge textsize current_time national then current_timestamp nocheck to current_user nonclustered top cursor not tran database null transaction dbcc nullif trigger deallocate of truncate declare off try_convert default offsets tsequal delete on union deny open unique desc opendatasource unpivot disk openquery update distinct openrowset updatetext distributed openxml use double option user drop or values dump order varying else outer view end over waitfor errlvl percent when escape pivot where except plan while exec precision with execute primary within group exists print writetext exit proc noexpand index forceseek forcescan holdlock nolock nowait paglock readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot spatial_window_max_cells tablock tablockx updlock xlock keepidentity keepdefaults ignore_constraints ignore_triggers`,types:mq+`smalldatetime datetimeoffset datetime2 datetime bigint smallint smallmoney tinyint money real text nvarchar ntext varbinary image hierarchyid uniqueidentifier sql_variant xml`,builtin:`approx_count_distinct approx_percentile_cont approx_percentile_disc avg checksum_agg count count_big grouping grouping_id max min product stdev stdevp sum var varp ai_generate_embeddings ai_generate_chunks cume_dist first_value lag last_value lead percentile_cont percentile_disc percent_rank left_shift right_shift bit_count get_bit set_bit collationproperty tertiary_weights @@datefirst @@dbts @@langid @@language @@lock_timeout @@max_connections @@max_precision @@nestlevel @@options @@remserver @@servername @@servicename @@spid @@textsize @@version cast convert parse try_cast try_convert try_parse asymkey_id asymkeyproperty certproperty cert_id crypt_gen_random decryptbyasymkey decryptbycert decryptbykey decryptbykeyautoasymkey decryptbykeyautocert decryptbypassphrase encryptbyasymkey encryptbycert encryptbykey encryptbypassphrase hashbytes is_objectsigned key_guid key_id key_name signbyasymkey signbycert symkeyproperty verifysignedbycert verifysignedbyasymkey @@cursor_rows @@fetch_status cursor_status datalength ident_current ident_incr ident_seed identity sql_variant_property @@datefirst current_timestamp current_timezone current_timezone_id date_bucket dateadd datediff datediff_big datefromparts datename datepart datetime2fromparts datetimefromparts datetimeoffsetfromparts datetrunc day eomonth getdate getutcdate isdate month smalldatetimefromparts switchoffset sysdatetime sysdatetimeoffset sysutcdatetime timefromparts todatetimeoffset year edit_distance edit_distance_similarity jaro_winkler_distance jaro_winkler_similarity edge_id_from_parts graph_id_from_edge_id graph_id_from_node_id node_id_from_parts object_id_from_edge_id object_id_from_node_id json isjson json_array json_contains json_modify json_object json_path_exists json_query json_value regexp_like regexp_replace regexp_substr regexp_instr regexp_count regexp_matches regexp_split_to_table abs acos asin atan atn2 ceiling cos cot degrees exp floor log log10 pi power radians rand round sign sin sqrt square tan choose greatest iif least @@procid app_name applock_mode applock_test assemblyproperty col_length col_name columnproperty databasepropertyex db_id db_name file_id file_idex file_name filegroup_id filegroup_name filegroupproperty fileproperty filepropertyex fulltextcatalogproperty fulltextserviceproperty index_col indexkey_property indexproperty next value for object_definition object_id object_name object_schema_name objectproperty objectpropertyex original_db_name parsename schema_id schema_name scope_identity serverproperty stats_date type_id type_name typeproperty dense_rank ntile rank row_number publishingservername certenclosed certprivatekey current_user database_principal_id has_dbaccess has_perms_by_name is_member is_rolemember is_srvrolemember loginproperty original_login permissions pwdencrypt pwdcompare session_user sessionproperty suser_id suser_name suser_sid suser_sname system_user user user_id user_name ascii char charindex concat concat_ws difference format left len lower ltrim nchar patindex quotename replace replicate reverse right rtrim soundex space str string_agg string_escape stuff substring translate trim unicode upper $partition @@error @@identity @@pack_received @@rowcount @@trancount binary_checksum checksum compress connectionproperty context_info current_request_id current_transaction_id decompress error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big session_context xact_state @@connections @@cpu_busy @@idle @@io_busy @@pack_sent @@packet_errors @@timeticks @@total_errors @@total_read @@total_write textptr textvalid columns_updated eventdata trigger_nestlevel vector_distance vectorproperty vector_search generate_series opendatasource openjson openquery openrowset openxml predict string_split coalesce nullif apply catch filter force include keep keepfixed modify optimize parameterization parameters partition recompile sequence set`,operatorChars:`*+-%<>!=^&|/`,specialVar:`@`,identifierQuotes:`"[`}),Zq=Bq.define({keywords:hq+`abort analyze attach autoincrement conflict database detach exclusive fail glob ignore index indexed instead isnull notnull offset plan pragma query raise regexp reindex rename replace temp vacuum virtual`,types:mq+`bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int2 int8 unsigned signed real`,builtin:`auth backup bail changes clone databases dbinfo dump echo eqp explain fullschema headers help import imposter indexes iotrace lint load log mode nullvalue once print prompt quit restore save scanstats separator shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width`,operatorChars:`*+-%<>!=&|/~`,identifierQuotes:'`"',specialVar:`@:?$`});mq+``,hq+``,mq+``;var Qq={standard:Kq,mysql:Yq,postgresql:qq,sqlite:Zq,mssql:Xq};function $q({value:e,onChange:t,placeholder:n,disabled:r=!1,readonly:i=!1,showLineNumbers:a=!0,dialect:o=`standard`,keywordColor:s,stringColor:c,identifierColor:l,schema:f,onLint:p,onDiagnosticsChange:m,onViewReady:h,onCursorChange:g,onBlur:_,onFocus:v}){let y=(0,u.useRef)(null),b=(0,u.useRef)(null),x=(0,u.useRef)(t),S=(0,u.useRef)(g),C=(0,u.useRef)(_),w=(0,u.useRef)(v),T=(0,u.useRef)(h),E=(0,u.useRef)(p),ee=(0,u.useRef)(m),te=(0,u.useRef)(new Ba),ne=(0,u.useRef)(new Ba),D=(0,d.useTheme)(),re=D.palette.mode===`dark`,O=!!p,ie=JSON.stringify(f);return(0,u.useEffect)(()=>{x.current=t},[t]),(0,u.useEffect)(()=>{S.current=g},[g]),(0,u.useEffect)(()=>{C.current=_},[_]),(0,u.useEffect)(()=>{w.current=v},[v]),(0,u.useEffect)(()=>{T.current=h},[h]),(0,u.useEffect)(()=>{E.current=p},[p]),(0,u.useEffect)(()=>{ee.current=m},[m]),(0,u.useEffect)(()=>{if(!y.current)return;let t=b.current?.state.doc.toString()??e??``,u=s??D.palette.primary.main,d=c??D.palette.success.main,p=l??D.palette.info.main,m=Fh.define([{tag:z.keyword,color:u,fontWeight:`bold`},{tag:z.name,color:p},{tag:[z.string,z.special(z.string)],color:d,fontWeight:`bold`},{tag:z.number,color:D.palette.warning.main},{tag:[z.lineComment,z.blockComment],color:D.palette.text.disabled,fontStyle:`italic`},{tag:z.operator,color:D.palette.text.secondary},{tag:[z.function(z.variableName),z.function(z.name)],color:D.palette.secondary.main},{tag:z.typeName,color:D.palette.info.main},{tag:z.invalid,color:D.palette.error.main,textDecoration:`underline wavy`}]),h=I.theme({"&":{height:`100%`,fontFamily:`'Fira Code', 'JetBrains Mono', 'Consolas', monospace`,fontSize:`0.875rem`},".cm-scroller":{overflow:`auto`},".cm-content":{padding:`8px 4px`,caretColor:D.palette.text.primary},".cm-gutters":{backgroundColor:re?D.palette.grey[900]:D.palette.grey[50],color:D.palette.text.disabled,border:`none`,borderRight:`1px solid ${D.palette.divider}`},".cm-lineNumbers .cm-gutterElement":{minWidth:`36px`,paddingLeft:`4px`},".cm-activeLineGutter":{backgroundColor:D.palette.action.selected},".cm-activeLine":{backgroundColor:D.palette.action.hover},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{backgroundColor:D.palette.primary.main+`40`},".cm-cursor, .cm-dropCursor":{borderLeftColor:D.palette.text.primary},"&.cm-focused":{outline:`none`},".cm-placeholder":{color:D.palette.text.disabled,fontStyle:`italic`},".cm-tooltip":{backgroundColor:D.palette.background.paper,border:`1px solid ${D.palette.divider}`,borderRadius:`4px`,boxShadow:D.shadows[4]},".cm-tooltip-autocomplete > ul > li":{color:D.palette.text.primary},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:D.palette.primary.main+`20`,color:D.palette.primary.main},".cm-completionMatchedText":{color:D.palette.primary.main,textDecoration:`none`,fontWeight:`bold`},".cm-completionDetail":{color:D.palette.text.secondary,fontStyle:`italic`},".cm-gutter-lint":{width:`16px`},".cm-lint-marker-error":{color:D.palette.error.main},".cm-lint-marker-warning":{color:D.palette.warning.main},".cm-tooltip.cm-tooltip-lint":{backgroundColor:D.palette.background.paper,border:`1px solid ${D.palette.divider}`,borderRadius:`4px`},".cm-diagnostic-error":{borderLeft:`3px solid ${D.palette.error.main}`},".cm-diagnostic-warning":{borderLeft:`3px solid ${D.palette.warning.main}`},".cm-diagnostic-info":{borderLeft:`3px solid ${D.palette.info.main}`}},{dark:re}),g=f?Object.fromEntries(f.tables.map(e=>[e.name,(e.columns??[]).map(e=>({label:e.name,detail:e.type,type:`property`}))])):void 0,_=async e=>{let t=E.current;if(!t)return[];let n=e.state.doc.toString();try{let r=(await t(n)).map(t=>{let n=Math.max(1,Math.min(t.line,e.state.doc.lines)),r=e.state.doc.line(n);return{from:r.from+Math.max(0,(t.col??1)-1),to:r.to,severity:t.severity??`error`,message:t.message}});return ee.current?.(r.length),r}catch{return[]}},v=[h,zh(m),Gq({dialect:Qq[o],schema:g}),Cg(),DK(),sf.of([...Av,...Hg,...OK]),te.current.of(I.editable.of(!r&&!i)),ne.current.of(vo.readOnly.of(i)),hf(),...a?[pp(),_p()]:[],...n?[yf(n)]:[],...O?[vy(),Yv(_,{delay:600})]:[],I.updateListener.of(e=>{e.docChanged&&x.current?.(e.state.doc.toString());let t=e.state.selection.main.head,n=e.state.doc.lineAt(t);S.current(n.number,t-n.from+1)}),I.domEventHandlers({blur:()=>{C.current?.()},focus:()=>{w.current?.()}})],ie=new I({state:vo.create({doc:t,extensions:v}),parent:y.current});return b.current=ie,T.current(ie),()=>{T.current(null),ie.destroy(),b.current=null}},[re,o,O,s,c,l,ie]),(0,u.useEffect)(()=>{let t=b.current;if(!t)return;let n=t.state.doc.toString();n!==(e??``)&&t.dispatch({changes:{from:0,to:n.length,insert:e??``}})},[e]),(0,u.useEffect)(()=>{b.current?.dispatch({effects:[te.current.reconfigure(I.editable.of(!r&&!i)),ne.current.reconfigure(vo.readOnly.of(i))]})},[r,i]),(0,A.jsx)(d.Box,{ref:y,sx:{flex:1,overflow:`hidden`,display:`flex`,flexDirection:`column`,opacity:r?.5:1,backgroundColor:D.palette.background.paper,"& .cm-editor":{flex:1,display:`flex`,flexDirection:`column`}}})}var eJ=M((0,A.jsx)(`path`,{d:`M8 5v14l11-7z`}),`PlayArrow`),Y=e=>e.flatMap(tJ),tJ=e=>lJ(rJ(e)).map(nJ),nJ=e=>e.replace(/ +/g,` `).trim(),rJ=e=>({type:`mandatory_block`,items:iJ(e,0)[0]}),iJ=(e,t,n)=>{let r=[];for(;e[t];){let[i,a]=aJ(e,t);if(r.push(i),t=a,e[t]===`|`)t++;else if(e[t]===`}`||e[t]===`]`){if(n!==e[t])throw Error(`Unbalanced parenthesis in: ${e}`);return t++,[r,t]}else if(t===e.length){if(n)throw Error(`Unbalanced parenthesis in: ${e}`);return[r,t]}else throw Error(`Unexpected "${e[t]}"`)}return[r,t]},aJ=(e,t)=>{let n=[];for(;;){let[r,i]=oJ(e,t);if(r)n.push(r),t=i;else break}return n.length===1?[n[0],t]:[{type:`concatenation`,items:n},t]},oJ=(e,t)=>{if(e[t]===`{`)return sJ(e,t+1);if(e[t]===`[`)return cJ(e,t+1);{let n=``;for(;e[t]&&/[A-Za-z0-9_ ]/.test(e[t]);)n+=e[t],t++;return[n,t]}},sJ=(e,t)=>{let[n,r]=iJ(e,t,`}`);return[{type:`mandatory_block`,items:n},r]},cJ=(e,t)=>{let[n,r]=iJ(e,t,`]`);return[{type:`optional_block`,items:n},r]},lJ=e=>{if(typeof e==`string`)return[e];if(e.type===`concatenation`)return e.items.map(lJ).reduce(uJ,[``]);if(e.type===`mandatory_block`)return e.items.flatMap(lJ);if(e.type===`optional_block`)return[``,...e.items.flatMap(lJ)];throw Error(`Unknown node type: ${e}`)},uJ=(e,t)=>{let n=[];for(let r of e)for(let e of t)n.push(r+e);return n},X;(function(e){e.QUOTED_IDENTIFIER=`QUOTED_IDENTIFIER`,e.IDENTIFIER=`IDENTIFIER`,e.STRING=`STRING`,e.VARIABLE=`VARIABLE`,e.RESERVED_DATA_TYPE=`RESERVED_DATA_TYPE`,e.RESERVED_PARAMETERIZED_DATA_TYPE=`RESERVED_PARAMETERIZED_DATA_TYPE`,e.RESERVED_KEYWORD=`RESERVED_KEYWORD`,e.RESERVED_FUNCTION_NAME=`RESERVED_FUNCTION_NAME`,e.RESERVED_KEYWORD_PHRASE=`RESERVED_KEYWORD_PHRASE`,e.RESERVED_DATA_TYPE_PHRASE=`RESERVED_DATA_TYPE_PHRASE`,e.RESERVED_SET_OPERATION=`RESERVED_SET_OPERATION`,e.RESERVED_CLAUSE=`RESERVED_CLAUSE`,e.RESERVED_SELECT=`RESERVED_SELECT`,e.RESERVED_JOIN=`RESERVED_JOIN`,e.ARRAY_IDENTIFIER=`ARRAY_IDENTIFIER`,e.ARRAY_KEYWORD=`ARRAY_KEYWORD`,e.CASE=`CASE`,e.END=`END`,e.WHEN=`WHEN`,e.ELSE=`ELSE`,e.THEN=`THEN`,e.LIMIT=`LIMIT`,e.BETWEEN=`BETWEEN`,e.AND=`AND`,e.OR=`OR`,e.XOR=`XOR`,e.OPERATOR=`OPERATOR`,e.COMMA=`COMMA`,e.ASTERISK=`ASTERISK`,e.PROPERTY_ACCESS_OPERATOR=`PROPERTY_ACCESS_OPERATOR`,e.OPEN_PAREN=`OPEN_PAREN`,e.CLOSE_PAREN=`CLOSE_PAREN`,e.LINE_COMMENT=`LINE_COMMENT`,e.BLOCK_COMMENT=`BLOCK_COMMENT`,e.DISABLE_COMMENT=`DISABLE_COMMENT`,e.NUMBER=`NUMBER`,e.NAMED_PARAMETER=`NAMED_PARAMETER`,e.QUOTED_PARAMETER=`QUOTED_PARAMETER`,e.NUMBERED_PARAMETER=`NUMBERED_PARAMETER`,e.POSITIONAL_PARAMETER=`POSITIONAL_PARAMETER`,e.CUSTOM_PARAMETER=`CUSTOM_PARAMETER`,e.DELIMITER=`DELIMITER`,e.EOF=`EOF`})(X=X||={});var dJ=e=>({type:X.EOF,raw:`«EOF»`,text:`«EOF»`,start:e}),fJ=dJ(1/0),pJ=e=>t=>t.type===e.type&&t.text===e.text,mJ={ARRAY:pJ({text:`ARRAY`,type:X.RESERVED_DATA_TYPE}),BY:pJ({text:`BY`,type:X.RESERVED_KEYWORD}),SET:pJ({text:`SET`,type:X.RESERVED_CLAUSE}),STRUCT:pJ({text:`STRUCT`,type:X.RESERVED_DATA_TYPE}),WINDOW:pJ({text:`WINDOW`,type:X.RESERVED_CLAUSE}),VALUES:pJ({text:`VALUES`,type:X.RESERVED_CLAUSE})},hJ=e=>e===X.RESERVED_DATA_TYPE||e===X.RESERVED_KEYWORD||e===X.RESERVED_FUNCTION_NAME||e===X.RESERVED_KEYWORD_PHRASE||e===X.RESERVED_DATA_TYPE_PHRASE||e===X.RESERVED_CLAUSE||e===X.RESERVED_SELECT||e===X.RESERVED_SET_OPERATION||e===X.RESERVED_JOIN||e===X.ARRAY_KEYWORD||e===X.CASE||e===X.END||e===X.WHEN||e===X.ELSE||e===X.THEN||e===X.LIMIT||e===X.BETWEEN||e===X.AND||e===X.OR||e===X.XOR,gJ=e=>e===X.AND||e===X.OR||e===X.XOR,_J=`KEYS.NEW_KEYSET,KEYS.ADD_KEY_FROM_RAW_BYTES,AEAD.DECRYPT_BYTES,AEAD.DECRYPT_STRING,AEAD.ENCRYPT,KEYS.KEYSET_CHAIN,KEYS.KEYSET_FROM_JSON,KEYS.KEYSET_TO_JSON,KEYS.ROTATE_KEYSET,KEYS.KEYSET_LENGTH,ANY_VALUE,ARRAY_AGG,AVG,CORR,COUNT,COUNTIF,COVAR_POP,COVAR_SAMP,MAX,MIN,ST_CLUSTERDBSCAN,STDDEV_POP,STDDEV_SAMP,STRING_AGG,SUM,VAR_POP,VAR_SAMP,ANY_VALUE,ARRAY_AGG,ARRAY_CONCAT_AGG,AVG,BIT_AND,BIT_OR,BIT_XOR,COUNT,COUNTIF,LOGICAL_AND,LOGICAL_OR,MAX,MIN,STRING_AGG,SUM,APPROX_COUNT_DISTINCT,APPROX_QUANTILES,APPROX_TOP_COUNT,APPROX_TOP_SUM,ARRAY_CONCAT,ARRAY_LENGTH,ARRAY_TO_STRING,GENERATE_ARRAY,GENERATE_DATE_ARRAY,GENERATE_TIMESTAMP_ARRAY,ARRAY_REVERSE,OFFSET,SAFE_OFFSET,ORDINAL,SAFE_ORDINAL,BIT_COUNT,PARSE_BIGNUMERIC,PARSE_NUMERIC,SAFE_CAST,CURRENT_DATE,EXTRACT,DATE,DATE_ADD,DATE_SUB,DATE_DIFF,DATE_TRUNC,DATE_FROM_UNIX_DATE,FORMAT_DATE,LAST_DAY,PARSE_DATE,UNIX_DATE,CURRENT_DATETIME,DATETIME,EXTRACT,DATETIME_ADD,DATETIME_SUB,DATETIME_DIFF,DATETIME_TRUNC,FORMAT_DATETIME,LAST_DAY,PARSE_DATETIME,ERROR,EXTERNAL_QUERY,S2_CELLIDFROMPOINT,S2_COVERINGCELLIDS,ST_ANGLE,ST_AREA,ST_ASBINARY,ST_ASGEOJSON,ST_ASTEXT,ST_AZIMUTH,ST_BOUNDARY,ST_BOUNDINGBOX,ST_BUFFER,ST_BUFFERWITHTOLERANCE,ST_CENTROID,ST_CENTROID_AGG,ST_CLOSESTPOINT,ST_CLUSTERDBSCAN,ST_CONTAINS,ST_CONVEXHULL,ST_COVEREDBY,ST_COVERS,ST_DIFFERENCE,ST_DIMENSION,ST_DISJOINT,ST_DISTANCE,ST_DUMP,ST_DWITHIN,ST_ENDPOINT,ST_EQUALS,ST_EXTENT,ST_EXTERIORRING,ST_GEOGFROM,ST_GEOGFROMGEOJSON,ST_GEOGFROMTEXT,ST_GEOGFROMWKB,ST_GEOGPOINT,ST_GEOGPOINTFROMGEOHASH,ST_GEOHASH,ST_GEOMETRYTYPE,ST_INTERIORRINGS,ST_INTERSECTION,ST_INTERSECTS,ST_INTERSECTSBOX,ST_ISCOLLECTION,ST_ISEMPTY,ST_LENGTH,ST_MAKELINE,ST_MAKEPOLYGON,ST_MAKEPOLYGONORIENTED,ST_MAXDISTANCE,ST_NPOINTS,ST_NUMGEOMETRIES,ST_NUMPOINTS,ST_PERIMETER,ST_POINTN,ST_SIMPLIFY,ST_SNAPTOGRID,ST_STARTPOINT,ST_TOUCHES,ST_UNION,ST_UNION_AGG,ST_WITHIN,ST_X,ST_Y,FARM_FINGERPRINT,MD5,SHA1,SHA256,SHA512,HLL_COUNT.INIT,HLL_COUNT.MERGE,HLL_COUNT.MERGE_PARTIAL,HLL_COUNT.EXTRACT,MAKE_INTERVAL,EXTRACT,JUSTIFY_DAYS,JUSTIFY_HOURS,JUSTIFY_INTERVAL,JSON_EXTRACT,JSON_QUERY,JSON_EXTRACT_SCALAR,JSON_VALUE,JSON_EXTRACT_ARRAY,JSON_QUERY_ARRAY,JSON_EXTRACT_STRING_ARRAY,JSON_VALUE_ARRAY,TO_JSON_STRING,ABS,SIGN,IS_INF,IS_NAN,IEEE_DIVIDE,RAND,SQRT,POW,POWER,EXP,LN,LOG,LOG10,GREATEST,LEAST,DIV,SAFE_DIVIDE,SAFE_MULTIPLY,SAFE_NEGATE,SAFE_ADD,SAFE_SUBTRACT,MOD,ROUND,TRUNC,CEIL,CEILING,FLOOR,COS,COSH,ACOS,ACOSH,SIN,SINH,ASIN,ASINH,TAN,TANH,ATAN,ATANH,ATAN2,RANGE_BUCKET,FIRST_VALUE,LAST_VALUE,NTH_VALUE,LEAD,LAG,PERCENTILE_CONT,PERCENTILE_DISC,NET.IP_FROM_STRING,NET.SAFE_IP_FROM_STRING,NET.IP_TO_STRING,NET.IP_NET_MASK,NET.IP_TRUNC,NET.IPV4_FROM_INT64,NET.IPV4_TO_INT64,NET.HOST,NET.PUBLIC_SUFFIX,NET.REG_DOMAIN,RANK,DENSE_RANK,PERCENT_RANK,CUME_DIST,NTILE,ROW_NUMBER,SESSION_USER,CORR,COVAR_POP,COVAR_SAMP,STDDEV_POP,STDDEV_SAMP,STDDEV,VAR_POP,VAR_SAMP,VARIANCE,ASCII,BYTE_LENGTH,CHAR_LENGTH,CHARACTER_LENGTH,CHR,CODE_POINTS_TO_BYTES,CODE_POINTS_TO_STRING,CONCAT,CONTAINS_SUBSTR,ENDS_WITH,FORMAT,FROM_BASE32,FROM_BASE64,FROM_HEX,INITCAP,INSTR,LEFT,LENGTH,LPAD,LOWER,LTRIM,NORMALIZE,NORMALIZE_AND_CASEFOLD,OCTET_LENGTH,REGEXP_CONTAINS,REGEXP_EXTRACT,REGEXP_EXTRACT_ALL,REGEXP_INSTR,REGEXP_REPLACE,REGEXP_SUBSTR,REPLACE,REPEAT,REVERSE,RIGHT,RPAD,RTRIM,SAFE_CONVERT_BYTES_TO_STRING,SOUNDEX,SPLIT,STARTS_WITH,STRPOS,SUBSTR,SUBSTRING,TO_BASE32,TO_BASE64,TO_CODE_POINTS,TO_HEX,TRANSLATE,TRIM,UNICODE,UPPER,CURRENT_TIME,TIME,EXTRACT,TIME_ADD,TIME_SUB,TIME_DIFF,TIME_TRUNC,FORMAT_TIME,PARSE_TIME,CURRENT_TIMESTAMP,EXTRACT,STRING,TIMESTAMP,TIMESTAMP_ADD,TIMESTAMP_SUB,TIMESTAMP_DIFF,TIMESTAMP_TRUNC,FORMAT_TIMESTAMP,PARSE_TIMESTAMP,TIMESTAMP_SECONDS,TIMESTAMP_MILLIS,TIMESTAMP_MICROS,UNIX_SECONDS,UNIX_MILLIS,UNIX_MICROS,GENERATE_UUID,COALESCE,IF,IFNULL,NULLIF,AVG,BIT_AND,BIT_OR,BIT_XOR,CORR,COUNT,COVAR_POP,COVAR_SAMP,EXACT_COUNT_DISTINCT,FIRST,GROUP_CONCAT,GROUP_CONCAT_UNQUOTED,LAST,MAX,MIN,NEST,NTH,QUANTILES,STDDEV,STDDEV_POP,STDDEV_SAMP,SUM,TOP,UNIQUE,VARIANCE,VAR_POP,VAR_SAMP,BIT_COUNT,BOOLEAN,BYTES,CAST,FLOAT,HEX_STRING,INTEGER,STRING,COALESCE,GREATEST,IFNULL,IS_INF,IS_NAN,IS_EXPLICITLY_DEFINED,LEAST,NVL,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,DATE,DATE_ADD,DATEDIFF,DAY,DAYOFWEEK,DAYOFYEAR,FORMAT_UTC_USEC,HOUR,MINUTE,MONTH,MSEC_TO_TIMESTAMP,NOW,PARSE_UTC_USEC,QUARTER,SEC_TO_TIMESTAMP,SECOND,STRFTIME_UTC_USEC,TIME,TIMESTAMP,TIMESTAMP_TO_MSEC,TIMESTAMP_TO_SEC,TIMESTAMP_TO_USEC,USEC_TO_TIMESTAMP,UTC_USEC_TO_DAY,UTC_USEC_TO_HOUR,UTC_USEC_TO_MONTH,UTC_USEC_TO_WEEK,UTC_USEC_TO_YEAR,WEEK,YEAR,FORMAT_IP,PARSE_IP,FORMAT_PACKED_IP,PARSE_PACKED_IP,JSON_EXTRACT,JSON_EXTRACT_SCALAR,ABS,ACOS,ACOSH,ASIN,ASINH,ATAN,ATANH,ATAN2,CEIL,COS,COSH,DEGREES,EXP,FLOOR,LN,LOG,LOG2,LOG10,PI,POW,RADIANS,RAND,ROUND,SIN,SINH,SQRT,TAN,TANH,REGEXP_MATCH,REGEXP_EXTRACT,REGEXP_REPLACE,CONCAT,INSTR,LEFT,LENGTH,LOWER,LPAD,LTRIM,REPLACE,RIGHT,RPAD,RTRIM,SPLIT,SUBSTR,UPPER,TABLE_DATE_RANGE,TABLE_DATE_RANGE_STRICT,TABLE_QUERY,HOST,DOMAIN,TLD,AVG,COUNT,MAX,MIN,STDDEV,SUM,CUME_DIST,DENSE_RANK,FIRST_VALUE,LAG,LAST_VALUE,LEAD,NTH_VALUE,NTILE,PERCENT_RANK,PERCENTILE_CONT,PERCENTILE_DISC,RANK,RATIO_TO_REPORT,ROW_NUMBER,CURRENT_USER,EVERY,FROM_BASE64,HASH,FARM_FINGERPRINT,IF,POSITION,SHA1,SOME,TO_BASE64,BQ.JOBS.CANCEL,BQ.REFRESH_MATERIALIZED_VIEW,OPTIONS,PIVOT,UNPIVOT`.split(`,`),vJ=`ALL.AND.ANY.AS.ASC.ASSERT_ROWS_MODIFIED.AT.BETWEEN.BY.CASE.CAST.COLLATE.CONTAINS.CREATE.CROSS.CUBE.CURRENT.DEFAULT.DEFINE.DESC.DISTINCT.ELSE.END.ENUM.ESCAPE.EXCEPT.EXCLUDE.EXISTS.EXTRACT.FALSE.FETCH.FOLLOWING.FOR.FROM.FULL.GROUP.GROUPING.GROUPS.HASH.HAVING.IF.IGNORE.IN.INNER.INTERSECT.INTO.IS.JOIN.LATERAL.LEFT.LIMIT.LOOKUP.MERGE.NATURAL.NEW.NO.NOT.NULL.NULLS.OF.ON.OR.ORDER.OUTER.OVER.PARTITION.PRECEDING.PROTO.RANGE.RECURSIVE.RESPECT.RIGHT.ROLLUP.ROWS.SELECT.SET.SOME.TABLE.TABLESAMPLE.THEN.TO.TREAT.TRUE.UNBOUNDED.UNION.UNNEST.USING.WHEN.WHERE.WINDOW.WITH.WITHIN.SAFE.LIKE.COPY.CLONE.IN.OUT.INOUT.RETURNS.LANGUAGE.CASCADE.RESTRICT.DETERMINISTIC`.split(`.`),yJ=[`ARRAY`,`BOOL`,`BYTES`,`DATE`,`DATETIME`,`GEOGRAPHY`,`INTERVAL`,`INT64`,`INT`,`SMALLINT`,`INTEGER`,`BIGINT`,`TINYINT`,`BYTEINT`,`NUMERIC`,`DECIMAL`,`BIGNUMERIC`,`BIGDECIMAL`,`FLOAT64`,`STRING`,`STRUCT`,`TIME`,`TIMEZONE`],bJ=Y([`SELECT [ALL | DISTINCT] [AS STRUCT | AS VALUE]`]),xJ=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`QUALIFY`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`OMIT RECORD IF`,`INSERT [INTO]`,`VALUES`,`SET`,`MERGE [INTO]`,`WHEN [NOT] MATCHED [BY SOURCE | BY TARGET] [THEN]`,`UPDATE SET`,`CLUSTER BY`,`FOR SYSTEM_TIME AS OF`,`WITH CONNECTION`,`WITH PARTITION COLUMNS`,`REMOTE WITH CONNECTION`]),SJ=Y([`CREATE [OR REPLACE] [TEMP|TEMPORARY|SNAPSHOT|EXTERNAL] TABLE [IF NOT EXISTS]`]),CJ=Y(`CREATE [OR REPLACE] [MATERIALIZED] VIEW [IF NOT EXISTS].UPDATE.DELETE [FROM].DROP [SNAPSHOT | EXTERNAL] TABLE [IF EXISTS].ALTER TABLE [IF EXISTS].ADD COLUMN [IF NOT EXISTS].DROP COLUMN [IF EXISTS].RENAME TO.ALTER COLUMN [IF EXISTS].SET DEFAULT COLLATE.SET OPTIONS.DROP NOT NULL.SET DATA TYPE.ALTER SCHEMA [IF EXISTS].ALTER [MATERIALIZED] VIEW [IF EXISTS].ALTER BI_CAPACITY.TRUNCATE TABLE.CREATE SCHEMA [IF NOT EXISTS].DEFAULT COLLATE.CREATE [OR REPLACE] [TEMP|TEMPORARY|TABLE] FUNCTION [IF NOT EXISTS].CREATE [OR REPLACE] PROCEDURE [IF NOT EXISTS].CREATE [OR REPLACE] ROW ACCESS POLICY [IF NOT EXISTS].GRANT TO.FILTER USING.CREATE CAPACITY.AS JSON.CREATE RESERVATION.CREATE ASSIGNMENT.CREATE SEARCH INDEX [IF NOT EXISTS].DROP SCHEMA [IF EXISTS].DROP [MATERIALIZED] VIEW [IF EXISTS].DROP [TABLE] FUNCTION [IF EXISTS].DROP PROCEDURE [IF EXISTS].DROP ROW ACCESS POLICY.DROP ALL ROW ACCESS POLICIES.DROP CAPACITY [IF EXISTS].DROP RESERVATION [IF EXISTS].DROP ASSIGNMENT [IF EXISTS].DROP SEARCH INDEX [IF EXISTS].DROP [IF EXISTS].GRANT.REVOKE.DECLARE.EXECUTE IMMEDIATE.LOOP.END LOOP.REPEAT.END REPEAT.WHILE.END WHILE.BREAK.LEAVE.CONTINUE.ITERATE.FOR.END FOR.BEGIN.BEGIN TRANSACTION.COMMIT TRANSACTION.ROLLBACK TRANSACTION.RAISE.RETURN.CALL.ASSERT.EXPORT DATA`.split(`.`)),wJ=Y([`UNION {ALL | DISTINCT}`,`EXCEPT DISTINCT`,`INTERSECT DISTINCT`]),TJ=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`]),EJ=Y([`TABLESAMPLE SYSTEM`,`ANY TYPE`,`ALL COLUMNS`,`NOT DETERMINISTIC`,`{ROWS | RANGE} BETWEEN`,`IS [NOT] DISTINCT FROM`]),DJ=Y([]),OJ={name:`bigquery`,tokenizerOptions:{reservedSelect:bJ,reservedClauses:[...xJ,...CJ,...SJ],reservedSetOperations:wJ,reservedJoins:TJ,reservedKeywordPhrases:EJ,reservedDataTypePhrases:DJ,reservedKeywords:vJ,reservedDataTypes:yJ,reservedFunctionNames:_J,extraParens:[`[]`],stringTypes:[{quote:`""".."""`,prefixes:[`R`,`B`,`RB`,`BR`]},{quote:`'''..'''`,prefixes:[`R`,`B`,`RB`,`BR`]},`""-bs`,`''-bs`,{quote:`""-raw`,prefixes:[`R`,`B`,`RB`,`BR`],requirePrefix:!0},{quote:`''-raw`,prefixes:[`R`,`B`,`RB`,`BR`],requirePrefix:!0}],identTypes:["``"],identChars:{dashes:!0},paramTypes:{positional:!0,named:[`@`],quoted:[`@`]},variableTypes:[{regex:String.raw`@@\w+`}],lineCommentTypes:[`--`,`#`],operators:[`&`,`|`,`^`,`~`,`>>`,`<<`,`||`,`=>`],postProcess:kJ},formatOptions:{onelineClauses:[...SJ,...CJ],tabularOnelineClauses:CJ}};function kJ(e){return AJ(jJ(e))}function AJ(e){let t=fJ;return e.map(e=>e.text===`OFFSET`&&t.text===`[`?(t=e,Object.assign(Object.assign({},e),{type:X.RESERVED_FUNCTION_NAME})):(t=e,e))}function jJ(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if((mJ.ARRAY(r)||mJ.STRUCT(r))&&e[n+1]?.text===`<`){let i=NJ(e,n+1),a=e.slice(n,i+1);t.push({type:X.IDENTIFIER,raw:a.map(MJ(`raw`)).join(``),text:a.map(MJ(`text`)).join(``),start:r.start}),n=i}else t.push(r)}return t}var MJ=e=>t=>t.type===X.IDENTIFIER||t.type===X.COMMA?t[e]+` `:t[e];function NJ(e,t){let n=0;for(let r=t;r<e.length;r++){let t=e[r];if(t.text===`<`?n++:t.text===`>`?n--:t.text===`>>`&&(n-=2),n===0)return r}return e.length-1}var PJ=`BIT_AND.BIT_OR.BIT_XOR.BLAKE3.CAST.CHARACTER_LENGTH.CHAR_LENGTH.COVAR_POP.COVAR_SAMP.CRC32.CRC32IEEE.CRC64.DATE.DATE_DIFF.DATE_FORMAT.DATE_TRUNC.DAY.DAYOFMONTH.DAYOFWEEK.DAYOFYEAR.FORMAT_BYTES.FQDN.FROM_BASE64.FROM_DAYS.FROM_UNIXTIME.HOUR.INET6_ATON.INET6_NTOA.INET_ATON.INET_NTOA.IPv4CIDRToRange.IPv4NumToString.IPv4NumToStringClassC.IPv4StringToNum.IPv4StringToNumOrDefault.IPv4StringToNumOrNull.IPv4ToIPv6.IPv6CIDRToRange.IPv6NumToString.IPv6StringToNum.IPv6StringToNumOrDefault.IPv6StringToNumOrNull.JSONAllPaths.JSONAllPathsWithTypes.JSONArrayLength.JSONDynamicPaths.JSONDynamicPathsWithTypes.JSONExtract.JSONExtractArrayRaw.JSONExtractArrayRawCaseInsensitive.JSONExtractBool.JSONExtractBoolCaseInsensitive.JSONExtractCaseInsensitive.JSONExtractFloat.JSONExtractFloatCaseInsensitive.JSONExtractInt.JSONExtractIntCaseInsensitive.JSONExtractKeys.JSONExtractKeysAndValues.JSONExtractKeysAndValuesCaseInsensitive.JSONExtractKeysAndValuesRaw.JSONExtractKeysAndValuesRawCaseInsensitive.JSONExtractKeysCaseInsensitive.JSONExtractRaw.JSONExtractRawCaseInsensitive.JSONExtractString.JSONExtractStringCaseInsensitive.JSONExtractUInt.JSONExtractUIntCaseInsensitive.JSONHas.JSONKey.JSONLength.JSONMergePatch.JSONSharedDataPaths.JSONSharedDataPathsWithTypes.JSONType.JSON_ARRAY_LENGTH.JSON_EXISTS.JSON_QUERY.JSON_VALUE.L1Distance.L1Norm.L1Normalize.L2Distance.L2Norm.L2Normalize.L2SquaredDistance.L2SquaredNorm.LAST_DAY.LinfDistance.LinfNorm.LinfNormalize.LpDistance.LpNorm.LpNormalize.MACNumToString.MACStringToNum.MACStringToOUI.MAP_FROM_ARRAYS.MD4.MD5.MILLISECOND.MINUTE.MONTH.OCTET_LENGTH.QUARTER.REGEXP_EXTRACT.REGEXP_MATCHES.REGEXP_REPLACE.RIPEMD160.SCHEMA.SECOND.SHA1.SHA224.SHA256.SHA384.SHA512.SHA512_256.STD.STDDEV_POP.STDDEV_SAMP.ST_LineFromWKB.ST_MLineFromWKB.ST_MPolyFromWKB.ST_PointFromWKB.ST_PolyFromWKB.SUBSTRING_INDEX.SVG.TIMESTAMP_DIFF.TO_BASE64.TO_DAYS.TO_UNIXTIME.ULIDStringToDateTime.URLHash.URLHierarchy.URLPathHierarchy.UTCTimestamp.UTC_timestamp.UUIDNumToString.UUIDStringToNum.UUIDToNum.UUIDv7ToDateTime.VAR_POP.VAR_SAMP.YEAR.YYYYMMDDToDate.YYYYMMDDToDate32.YYYYMMDDhhmmssToDateTime.YYYYMMDDhhmmssToDateTime64._CAST.__actionName.__bitBoolMaskAnd.__bitBoolMaskOr.__bitSwapLastTwo.__bitWrapperFunc.__getScalar.__patchPartitionID.__scalarSubqueryResult.abs.accurateCast.accurateCastOrDefault.accurateCastOrNull.acos.acosh.addDate.addDays.addHours.addInterval.addMicroseconds.addMilliseconds.addMinutes.addMonths.addNanoseconds.addQuarters.addSeconds.addTupleOfIntervals.addWeeks.addYears.addressToLine.addressToLineWithInlines.addressToSymbol.aes_decrypt_mysql.aes_encrypt_mysql.age.aggThrow.alphaTokens.analysisOfVariance.anova.any.anyHeavy.anyLast.anyLastRespectNulls.anyLast_respect_nulls.anyRespectNulls.anyValueRespectNulls.any_respect_nulls.any_value.any_value_respect_nulls.appendTrailingCharIfAbsent.approx_top_count.approx_top_k.approx_top_sum.argMax.argMin.array.arrayAUC.arrayAUCPR.arrayAll.arrayAvg.arrayCompact.arrayConcat.arrayCount.arrayCumSum.arrayCumSumNonNegative.arrayDifference.arrayDistinct.arrayDotProduct.arrayElement.arrayElementOrNull.arrayEnumerate.arrayEnumerateDense.arrayEnumerateDenseRanked.arrayEnumerateUniq.arrayEnumerateUniqRanked.arrayExists.arrayFill.arrayFilter.arrayFirst.arrayFirstIndex.arrayFirstOrNull.arrayFlatten.arrayFold.arrayIntersect.arrayJaccardIndex.arrayJoin.arrayLast.arrayLastIndex.arrayLastOrNull.arrayLevenshteinDistance.arrayLevenshteinDistanceWeighted.arrayMap.arrayMax.arrayMin.arrayNormalizedGini.arrayPRAUC.arrayPartialReverseSort.arrayPartialShuffle.arrayPartialSort.arrayPopBack.arrayPopFront.arrayProduct.arrayPushBack.arrayPushFront.arrayROCAUC.arrayRandomSample.arrayReduce.arrayReduceInRanges.arrayResize.arrayReverse.arrayReverseFill.arrayReverseSort.arrayReverseSplit.arrayRotateLeft.arrayRotateRight.arrayShiftLeft.arrayShiftRight.arrayShingles.arrayShuffle.arraySimilarity.arraySlice.arraySort.arraySplit.arrayStringConcat.arraySum.arraySymmetricDifference.arrayUnion.arrayUniq.arrayWithConstant.arrayZip.arrayZipUnaligned.array_agg.array_concat_agg.ascii.asin.asinh.assumeNotNull.atan.atan2.atanh.authenticatedUser.avg.avgWeighted.bar.base32Decode.base32Encode.base58Decode.base58Encode.base64Decode.base64Encode.base64URLDecode.base64URLEncode.basename.bech32Decode.bech32Encode.bin.bitAnd.bitCount.bitHammingDistance.bitNot.bitOr.bitPositionsToArray.bitRotateLeft.bitRotateRight.bitShiftLeft.bitShiftRight.bitSlice.bitTest.bitTestAll.bitTestAny.bitXor.bitmapAnd.bitmapAndCardinality.bitmapAndnot.bitmapAndnotCardinality.bitmapBuild.bitmapCardinality.bitmapContains.bitmapHasAll.bitmapHasAny.bitmapMax.bitmapMin.bitmapOr.bitmapOrCardinality.bitmapSubsetInRange.bitmapSubsetLimit.bitmapToArray.bitmapTransform.bitmapXor.bitmapXorCardinality.bitmaskToArray.bitmaskToList.blockNumber.blockSerializedSize.blockSize.boundingRatio.buildId.byteHammingDistance.byteSize.byteSlice.byteSwap.caseWithExpr.caseWithExpression.caseWithoutExpr.caseWithoutExpression.catboostEvaluate.categoricalInformationValue.cbrt.ceil.ceiling.changeDay.changeHour.changeMinute.changeMonth.changeSecond.changeYear.char.cityHash64.clamp.coalesce.colorOKLCHToSRGB.colorSRGBToOKLCH.compareSubstrings.concat.concatAssumeInjective.concatWithSeparator.concatWithSeparatorAssumeInjective.concat_ws.connectionId.connection_id.contingency.convertCharset.corr.corrMatrix.corrStable.cos.cosh.cosineDistance.count.countDigits.countEqual.countMatches.countMatchesCaseInsensitive.countSubstrings.countSubstringsCaseInsensitive.countSubstringsCaseInsensitiveUTF8.covarPop.covarPopMatrix.covarPopStable.covarSamp.covarSampMatrix.covarSampStable.cramersV.cramersVBiasCorrected.curdate.currentDatabase.currentProfiles.currentQueryID.currentRoles.currentSchemas.currentUser.current_database.current_date.current_query_id.current_schemas.current_timestamp.current_user.cutFragment.cutIPv6.cutQueryString.cutQueryStringAndFragment.cutToFirstSignificantSubdomain.cutToFirstSignificantSubdomainCustom.cutToFirstSignificantSubdomainCustomRFC.cutToFirstSignificantSubdomainCustomWithWWW.cutToFirstSignificantSubdomainCustomWithWWWRFC.cutToFirstSignificantSubdomainRFC.cutToFirstSignificantSubdomainWithWWW.cutToFirstSignificantSubdomainWithWWWRFC.cutURLParameter.cutWWW.damerauLevenshteinDistance.dateDiff.dateName.dateTime64ToSnowflake.dateTime64ToSnowflakeID.dateTimeToSnowflake.dateTimeToSnowflakeID.dateTimeToUUIDv7.dateTrunc.date_bin.date_diff.decodeHTMLComponent.decodeURLComponent.decodeURLFormComponent.decodeXMLComponent.decrypt.defaultProfiles.defaultRoles.defaultValueOfArgumentType.defaultValueOfTypeName.degrees.deltaSum.deltaSumTimestamp.demangle.denseRank.dense_rank.detectCharset.detectLanguage.detectLanguageMixed.detectLanguageUnknown.detectProgrammingLanguage.detectTonality.dictGet.dictGetAll.dictGetChildren.dictGetDate.dictGetDateOrDefault.dictGetDateTime.dictGetDateTimeOrDefault.dictGetDescendants.dictGetFloat32.dictGetFloat32OrDefault.dictGetFloat64.dictGetFloat64OrDefault.dictGetHierarchy.dictGetIPv4.dictGetIPv4OrDefault.dictGetIPv6.dictGetIPv6OrDefault.dictGetInt16.dictGetInt16OrDefault.dictGetInt32.dictGetInt32OrDefault.dictGetInt64.dictGetInt64OrDefault.dictGetInt8.dictGetInt8OrDefault.dictGetOrDefault.dictGetOrNull.dictGetString.dictGetStringOrDefault.dictGetUInt16.dictGetUInt16OrDefault.dictGetUInt32.dictGetUInt32OrDefault.dictGetUInt64.dictGetUInt64OrDefault.dictGetUInt8.dictGetUInt8OrDefault.dictGetUUID.dictGetUUIDOrDefault.dictHas.dictIsIn.displayName.distanceL1.distanceL2.distanceL2Squared.distanceLinf.distanceLp.distinctDynamicTypes.distinctJSONPaths.distinctJSONPathsAndTypes.divide.divideDecimal.divideOrNull.domain.domainRFC.domainWithoutWWW.domainWithoutWWWRFC.dotProduct.dumpColumnStructure.dynamicElement.dynamicType.e.editDistance.editDistanceUTF8.empty.emptyArrayDate.emptyArrayDateTime.emptyArrayFloat32.emptyArrayFloat64.emptyArrayInt16.emptyArrayInt32.emptyArrayInt64.emptyArrayInt8.emptyArrayString.emptyArrayToSingle.emptyArrayUInt16.emptyArrayUInt32.emptyArrayUInt64.emptyArrayUInt8.enabledProfiles.enabledRoles.encodeURLComponent.encodeURLFormComponent.encodeXMLComponent.encrypt.endsWith.endsWithUTF8.entropy.equals.erf.erfc.errorCodeToName.estimateCompressionRatio.evalMLMethod.exp.exp10.exp2.exponentialMovingAverage.exponentialTimeDecayedAvg.exponentialTimeDecayedCount.exponentialTimeDecayedMax.exponentialTimeDecayedSum.extract.extractAll.extractAllGroups.extractAllGroupsHorizontal.extractAllGroupsVertical.extractGroups.extractKeyValuePairs.extractKeyValuePairsWithEscaping.extractTextFromHTML.extractURLParameter.extractURLParameterNames.extractURLParameters.factorial.farmFingerprint64.farmHash64.file.filesystemAvailable.filesystemCapacity.filesystemUnreserved.finalizeAggregation.financialInternalRateOfReturn.financialInternalRateOfReturnExtended.financialNetPresentValue.financialNetPresentValueExtended.firstLine.firstSignificantSubdomain.firstSignificantSubdomainCustom.firstSignificantSubdomainCustomRFC.firstSignificantSubdomainRFC.firstValueRespectNulls.first_value.first_value_respect_nulls.flameGraph.flatten.flattenTuple.floor.formatDateTime.formatDateTimeInJodaSyntax.formatQuery.formatQueryOrNull.formatQuerySingleLine.formatQuerySingleLineOrNull.formatReadableDecimalSize.formatReadableQuantity.formatReadableSize.formatReadableTimeDelta.formatRow.formatRowNoNewline.fragment.fromDaysSinceYearZero.fromDaysSinceYearZero32.fromModifiedJulianDay.fromModifiedJulianDayOrNull.fromUTCTimestamp.fromUnixTimestamp.fromUnixTimestamp64Micro.fromUnixTimestamp64Milli.fromUnixTimestamp64Nano.fromUnixTimestamp64Second.fromUnixTimestampInJodaSyntax.from_utc_timestamp.fullHostName.fuzzBits.gccMurmurHash.gcd.generateRandomStructure.generateSerialID.generateSnowflakeID.generateULID.generateUUIDv4.generateUUIDv7.geoDistance.geoToH3.geoToS2.geohashDecode.geohashEncode.geohashesInBox.getClientHTTPHeader.getMacro.getMaxTableNameLengthForDatabase.getMergeTreeSetting.getOSKernelVersion.getServerPort.getServerSetting.getSetting.getSettingOrDefault.getSizeOfEnumType.getSubcolumn.getTypeSerializationStreams.globalIn.globalInIgnoreSet.globalNotIn.globalNotInIgnoreSet.globalNotNullIn.globalNotNullInIgnoreSet.globalNullIn.globalNullInIgnoreSet.globalVariable.greatCircleAngle.greatCircleDistance.greater.greaterOrEquals.greatest.groupArray.groupArrayInsertAt.groupArrayIntersect.groupArrayLast.groupArrayMovingAvg.groupArrayMovingSum.groupArraySample.groupArraySorted.groupBitAnd.groupBitOr.groupBitXor.groupBitmap.groupBitmapAnd.groupBitmapOr.groupBitmapXor.groupConcat.groupNumericIndexedVector.groupUniqArray.group_concat.h3CellAreaM2.h3CellAreaRads2.h3Distance.h3EdgeAngle.h3EdgeLengthKm.h3EdgeLengthM.h3ExactEdgeLengthKm.h3ExactEdgeLengthM.h3ExactEdgeLengthRads.h3GetBaseCell.h3GetDestinationIndexFromUnidirectionalEdge.h3GetFaces.h3GetIndexesFromUnidirectionalEdge.h3GetOriginIndexFromUnidirectionalEdge.h3GetPentagonIndexes.h3GetRes0Indexes.h3GetResolution.h3GetUnidirectionalEdge.h3GetUnidirectionalEdgeBoundary.h3GetUnidirectionalEdgesFromHexagon.h3HexAreaKm2.h3HexAreaM2.h3HexRing.h3IndexesAreNeighbors.h3IsPentagon.h3IsResClassIII.h3IsValid.h3Line.h3NumHexagons.h3PointDistKm.h3PointDistM.h3PointDistRads.h3ToCenterChild.h3ToChildren.h3ToGeo.h3ToGeoBoundary.h3ToParent.h3ToString.h3UnidirectionalEdgeIsValid.h3kRing.halfMD5.has.hasAll.hasAny.hasColumnInTable.hasSubsequence.hasSubsequenceCaseInsensitive.hasSubsequenceCaseInsensitiveUTF8.hasSubsequenceUTF8.hasSubstr.hasThreadFuzzer.hasToken.hasTokenCaseInsensitive.hasTokenCaseInsensitiveOrNull.hasTokenOrNull.hex.hilbertDecode.hilbertEncode.histogram.hiveHash.hop.hopEnd.hopStart.hostName.hostname.hypot.icebergBucket.icebergHash.icebergTruncate.identity.idnaDecode.idnaEncode.if.ifNotFinite.ifNull.ignore.inIgnoreSet.indexHint.indexOf.indexOfAssumeSorted.initcap.initcapUTF8.initialQueryID.initialQueryStartTime.initial_query_id.initial_query_start_time.initializeAggregation.instr.intDiv.intDivOrNull.intDivOrZero.intExp10.intExp2.intHash32.intHash64.intervalLengthSum.isConstant.isDecimalOverflow.isDynamicElementInSharedData.isFinite.isIPAddressInRange.isIPv4String.isIPv6String.isInfinite.isMergeTreePartCoveredBy.isNaN.isNotDistinctFrom.isNotNull.isNull.isNullable.isValidJSON.isValidUTF8.isZeroOrNull.jaroSimilarity.jaroWinklerSimilarity.javaHash.javaHashUTF16LE.joinGet.joinGetOrNull.jsonMergePatch.jumpConsistentHash.kafkaMurmurHash.keccak256.kolmogorovSmirnovTest.kostikConsistentHash.kql_array_sort_asc.kql_array_sort_desc.kurtPop.kurtSamp.lag.lagInFrame.largestTriangleThreeBuckets.lastValueRespectNulls.last_value.last_value_respect_nulls.lcase.lcm.lead.leadInFrame.least.left.leftPad.leftPadUTF8.leftUTF8.lemmatize.length.lengthUTF8.less.lessOrEquals.levenshteinDistance.levenshteinDistanceUTF8.lgamma.ln.locate.log.log10.log1p.log2.logTrace.lowCardinalityIndices.lowCardinalityKeys.lower.lowerUTF8.lpad.ltrim.lttb.makeDate.makeDate32.makeDateTime.makeDateTime64.mannWhitneyUTest.map.mapAdd.mapAll.mapApply.mapConcat.mapContains.mapContainsKey.mapContainsKeyLike.mapContainsValue.mapContainsValueLike.mapExists.mapExtractKeyLike.mapExtractValueLike.mapFilter.mapFromArrays.mapFromString.mapKeys.mapPartialReverseSort.mapPartialSort.mapPopulateSeries.mapReverseSort.mapSort.mapSubtract.mapUpdate.mapValues.match.materialize.max.max2.maxIntersections.maxIntersectionsPosition.maxMappedArrays.meanZTest.median.medianBFloat16.medianBFloat16Weighted.medianDD.medianDeterministic.medianExact.medianExactHigh.medianExactLow.medianExactWeighted.medianExactWeightedInterpolated.medianGK.medianInterpolatedWeighted.medianTDigest.medianTDigestWeighted.medianTiming.medianTimingWeighted.mergeTreePartInfo.metroHash64.mid.min.min2.minMappedArrays.minSampleSizeContinous.minSampleSizeContinuous.minSampleSizeConversion.minus.mismatches.mod.modOrNull.modulo.moduloLegacy.moduloOrNull.moduloOrZero.monthName.mortonDecode.mortonEncode.multiFuzzyMatchAllIndices.multiFuzzyMatchAny.multiFuzzyMatchAnyIndex.multiIf.multiMatchAllIndices.multiMatchAny.multiMatchAnyIndex.multiSearchAllPositions.multiSearchAllPositionsCaseInsensitive.multiSearchAllPositionsCaseInsensitiveUTF8.multiSearchAllPositionsUTF8.multiSearchAny.multiSearchAnyCaseInsensitive.multiSearchAnyCaseInsensitiveUTF8.multiSearchAnyUTF8.multiSearchFirstIndex.multiSearchFirstIndexCaseInsensitive.multiSearchFirstIndexCaseInsensitiveUTF8.multiSearchFirstIndexUTF8.multiSearchFirstPosition.multiSearchFirstPositionCaseInsensitive.multiSearchFirstPositionCaseInsensitiveUTF8.multiSearchFirstPositionUTF8.multiply.multiplyDecimal.murmurHash2_32.murmurHash2_64.murmurHash3_128.murmurHash3_32.murmurHash3_64.negate.neighbor.nested.netloc.ngramDistance.ngramDistanceCaseInsensitive.ngramDistanceCaseInsensitiveUTF8.ngramDistanceUTF8.ngramMinHash.ngramMinHashArg.ngramMinHashArgCaseInsensitive.ngramMinHashArgCaseInsensitiveUTF8.ngramMinHashArgUTF8.ngramMinHashCaseInsensitive.ngramMinHashCaseInsensitiveUTF8.ngramMinHashUTF8.ngramSearch.ngramSearchCaseInsensitive.ngramSearchCaseInsensitiveUTF8.ngramSearchUTF8.ngramSimHash.ngramSimHashCaseInsensitive.ngramSimHashCaseInsensitiveUTF8.ngramSimHashUTF8.ngrams.nonNegativeDerivative.normL1.normL2.normL2Squared.normLinf.normLp.normalizeL1.normalizeL2.normalizeLinf.normalizeLp.normalizeQuery.normalizeQueryKeepNames.normalizeUTF8NFC.normalizeUTF8NFD.normalizeUTF8NFKC.normalizeUTF8NFKD.normalizedQueryHash.normalizedQueryHashKeepNames.notEmpty.notEquals.notILike.notIn.notInIgnoreSet.notLike.notNullIn.notNullInIgnoreSet.nothing.nothingNull.nothingUInt64.now.now64.nowInBlock.nowInBlock64.nth_value.ntile.nullIf.nullIn.nullInIgnoreSet.numbers.numericIndexedVectorAllValueSum.numericIndexedVectorBuild.numericIndexedVectorCardinality.numericIndexedVectorGetValue.numericIndexedVectorPointwiseAdd.numericIndexedVectorPointwiseDivide.numericIndexedVectorPointwiseEqual.numericIndexedVectorPointwiseGreater.numericIndexedVectorPointwiseGreaterEqual.numericIndexedVectorPointwiseLess.numericIndexedVectorPointwiseLessEqual.numericIndexedVectorPointwiseMultiply.numericIndexedVectorPointwiseNotEqual.numericIndexedVectorPointwiseSubtract.numericIndexedVectorShortDebugString.numericIndexedVectorToMap.overlay.overlayUTF8.parseDateTime.parseDateTime32BestEffort.parseDateTime32BestEffortOrNull.parseDateTime32BestEffortOrZero.parseDateTime64.parseDateTime64BestEffort.parseDateTime64BestEffortOrNull.parseDateTime64BestEffortOrZero.parseDateTime64BestEffortUS.parseDateTime64BestEffortUSOrNull.parseDateTime64BestEffortUSOrZero.parseDateTime64InJodaSyntax.parseDateTime64InJodaSyntaxOrNull.parseDateTime64InJodaSyntaxOrZero.parseDateTime64OrNull.parseDateTime64OrZero.parseDateTimeBestEffort.parseDateTimeBestEffortOrNull.parseDateTimeBestEffortOrZero.parseDateTimeBestEffortUS.parseDateTimeBestEffortUSOrNull.parseDateTimeBestEffortUSOrZero.parseDateTimeInJodaSyntax.parseDateTimeInJodaSyntaxOrNull.parseDateTimeInJodaSyntaxOrZero.parseDateTimeOrNull.parseDateTimeOrZero.parseReadableSize.parseReadableSizeOrNull.parseReadableSizeOrZero.parseTimeDelta.partitionID.partitionId.path.pathFull.percentRank.percent_rank.pi.plus.pmod.pmodOrNull.pointInEllipses.pointInPolygon.polygonAreaCartesian.polygonAreaSpherical.polygonConvexHullCartesian.polygonPerimeterCartesian.polygonPerimeterSpherical.polygonsDistanceCartesian.polygonsDistanceSpherical.polygonsEqualsCartesian.polygonsIntersectCartesian.polygonsIntersectSpherical.polygonsIntersectionCartesian.polygonsIntersectionSpherical.polygonsSymDifferenceCartesian.polygonsSymDifferenceSpherical.polygonsUnionCartesian.polygonsUnionSpherical.polygonsWithinCartesian.polygonsWithinSpherical.port.portRFC.position.positionCaseInsensitive.positionCaseInsensitiveUTF8.positionUTF8.positiveModulo.positiveModuloOrNull.positive_modulo.positive_modulo_or_null.pow.power.printf.proportionsZTest.protocol.punycodeDecode.punycodeEncode.quantile.quantileBFloat16.quantileBFloat16Weighted.quantileDD.quantileDeterministic.quantileExact.quantileExactExclusive.quantileExactHigh.quantileExactInclusive.quantileExactLow.quantileExactWeighted.quantileExactWeightedInterpolated.quantileGK.quantileInterpolatedWeighted.quantileTDigest.quantileTDigestWeighted.quantileTiming.quantileTimingWeighted.quantiles.quantilesBFloat16.quantilesBFloat16Weighted.quantilesDD.quantilesDeterministic.quantilesExact.quantilesExactExclusive.quantilesExactHigh.quantilesExactInclusive.quantilesExactLow.quantilesExactWeighted.quantilesExactWeightedInterpolated.quantilesGK.quantilesInterpolatedWeighted.quantilesTDigest.quantilesTDigestWeighted.quantilesTiming.quantilesTimingWeighted.queryID.queryString.queryStringAndFragment.query_id.radians.rand.rand32.rand64.randBernoulli.randBinomial.randCanonical.randChiSquared.randConstant.randExponential.randFisherF.randLogNormal.randNegativeBinomial.randNormal.randPoisson.randStudentT.randUniform.randomFixedString.randomPrintableASCII.randomString.randomStringUTF8.rank.rankCorr.readWKBLineString.readWKBMultiLineString.readWKBMultiPolygon.readWKBPoint.readWKBPolygon.readWKTLineString.readWKTMultiLineString.readWKTMultiPolygon.readWKTPoint.readWKTPolygon.readWKTRing.regexpExtract.regexpQuoteMeta.regionHierarchy.regionIn.regionToArea.regionToCity.regionToContinent.regionToCountry.regionToDistrict.regionToName.regionToPopulation.regionToTopContinent.reinterpret.reinterpretAsDate.reinterpretAsDateTime.reinterpretAsFixedString.reinterpretAsFloat32.reinterpretAsFloat64.reinterpretAsInt128.reinterpretAsInt16.reinterpretAsInt256.reinterpretAsInt32.reinterpretAsInt64.reinterpretAsInt8.reinterpretAsString.reinterpretAsUInt128.reinterpretAsUInt16.reinterpretAsUInt256.reinterpretAsUInt32.reinterpretAsUInt64.reinterpretAsUInt8.reinterpretAsUUID.repeat.replace.replaceAll.replaceOne.replaceRegexpAll.replaceRegexpOne.replicate.retention.reverse.reverseUTF8.revision.right.rightPad.rightPadUTF8.rightUTF8.round.roundAge.roundBankers.roundDown.roundDuration.roundToExp2.rowNumberInAllBlocks.rowNumberInBlock.row_number.rpad.rtrim.runningAccumulate.runningConcurrency.runningDifference.runningDifferenceStartingWithFirstValue.s2CapContains.s2CapUnion.s2CellsIntersect.s2GetNeighbors.s2RectAdd.s2RectContains.s2RectIntersection.s2RectUnion.s2ToGeo.scalarProduct.searchAll.searchAny.sequenceCount.sequenceMatch.sequenceMatchEvents.sequenceNextNode.seriesDecomposeSTL.seriesOutliersDetectTukey.seriesPeriodDetectFFT.serverTimeZone.serverTimezone.serverUUID.shardCount.shardNum.showCertificate.sigmoid.sign.simpleJSONExtractBool.simpleJSONExtractFloat.simpleJSONExtractInt.simpleJSONExtractRaw.simpleJSONExtractString.simpleJSONExtractUInt.simpleJSONHas.simpleLinearRegression.sin.singleValueOrNull.sinh.sipHash128.sipHash128Keyed.sipHash128Reference.sipHash128ReferenceKeyed.sipHash64.sipHash64Keyed.skewPop.skewSamp.sleep.sleepEachRow.snowflakeIDToDateTime.snowflakeIDToDateTime64.snowflakeToDateTime.snowflakeToDateTime64.soundex.space.sparkBar.sparkbar.sparseGrams.sparseGramsHashes.sparseGramsHashesUTF8.sparseGramsUTF8.splitByAlpha.splitByChar.splitByNonAlpha.splitByRegexp.splitByString.splitByWhitespace.sqid.sqidDecode.sqidEncode.sqrt.startsWith.startsWithUTF8.stddevPop.stddevPopStable.stddevSamp.stddevSampStable.stem.stochasticLinearRegression.stochasticLogisticRegression.str_to_date.str_to_map.stringBytesEntropy.stringBytesUniq.stringJaccardIndex.stringJaccardIndexUTF8.stringToH3.structureToCapnProtoSchema.structureToProtobufSchema.studentTTest.subBitmap.subDate.substr.substring.substringIndex.substringIndexUTF8.substringUTF8.subtractDays.subtractHours.subtractInterval.subtractMicroseconds.subtractMilliseconds.subtractMinutes.subtractMonths.subtractNanoseconds.subtractQuarters.subtractSeconds.subtractTupleOfIntervals.subtractWeeks.subtractYears.sum.sumCount.sumKahan.sumMapFiltered.sumMapFilteredWithOverflow.sumMapWithOverflow.sumMappedArrays.sumWithOverflow.svg.synonyms.tan.tanh.tcpPort.tgamma.theilsU.throwIf.tid.timeDiff.timeSeriesDeltaToGrid.timeSeriesDerivToGrid.timeSeriesFromGrid.timeSeriesGroupArray.timeSeriesIdToTags.timeSeriesIdToTagsGroup.timeSeriesIdeltaToGrid.timeSeriesInstantDeltaToGrid.timeSeriesInstantRateToGrid.timeSeriesIrateToGrid.timeSeriesLastToGrid.timeSeriesLastTwoSamples.timeSeriesPredictLinearToGrid.timeSeriesRange.timeSeriesRateToGrid.timeSeriesResampleToGridWithStaleness.timeSeriesStoreTags.timeSeriesTagsGroupToTags.timeSlot.timeSlots.timeZone.timeZoneOf.timeZoneOffset.time_bucket.timestamp.timestampDiff.timestamp_diff.timezone.timezoneOf.timezoneOffset.toBFloat16.toBFloat16OrNull.toBFloat16OrZero.toBool.toColumnTypeName.toDate.toDate32.toDate32OrDefault.toDate32OrNull.toDate32OrZero.toDateOrDefault.toDateOrNull.toDateOrZero.toDateTime.toDateTime32.toDateTime64.toDateTime64OrDefault.toDateTime64OrNull.toDateTime64OrZero.toDateTimeOrDefault.toDateTimeOrNull.toDateTimeOrZero.toDayOfMonth.toDayOfWeek.toDayOfYear.toDaysSinceYearZero.toDecimal128.toDecimal128OrDefault.toDecimal128OrNull.toDecimal128OrZero.toDecimal256.toDecimal256OrDefault.toDecimal256OrNull.toDecimal256OrZero.toDecimal32.toDecimal32OrDefault.toDecimal32OrNull.toDecimal32OrZero.toDecimal64.toDecimal64OrDefault.toDecimal64OrNull.toDecimal64OrZero.toDecimalString.toFixedString.toFloat32.toFloat32OrDefault.toFloat32OrNull.toFloat32OrZero.toFloat64.toFloat64OrDefault.toFloat64OrNull.toFloat64OrZero.toHour.toIPv4.toIPv4OrDefault.toIPv4OrNull.toIPv4OrZero.toIPv6.toIPv6OrDefault.toIPv6OrNull.toIPv6OrZero.toISOWeek.toISOYear.toInt128.toInt128OrDefault.toInt128OrNull.toInt128OrZero.toInt16.toInt16OrDefault.toInt16OrNull.toInt16OrZero.toInt256.toInt256OrDefault.toInt256OrNull.toInt256OrZero.toInt32.toInt32OrDefault.toInt32OrNull.toInt32OrZero.toInt64.toInt64OrDefault.toInt64OrNull.toInt64OrZero.toInt8.toInt8OrDefault.toInt8OrNull.toInt8OrZero.toInterval.toIntervalDay.toIntervalHour.toIntervalMicrosecond.toIntervalMillisecond.toIntervalMinute.toIntervalMonth.toIntervalNanosecond.toIntervalQuarter.toIntervalSecond.toIntervalWeek.toIntervalYear.toJSONString.toLastDayOfMonth.toLastDayOfWeek.toLowCardinality.toMillisecond.toMinute.toModifiedJulianDay.toModifiedJulianDayOrNull.toMonday.toMonth.toMonthNumSinceEpoch.toNullable.toQuarter.toRelativeDayNum.toRelativeHourNum.toRelativeMinuteNum.toRelativeMonthNum.toRelativeQuarterNum.toRelativeSecondNum.toRelativeWeekNum.toRelativeYearNum.toSecond.toStartOfDay.toStartOfFifteenMinutes.toStartOfFiveMinute.toStartOfFiveMinutes.toStartOfHour.toStartOfISOYear.toStartOfInterval.toStartOfMicrosecond.toStartOfMillisecond.toStartOfMinute.toStartOfMonth.toStartOfNanosecond.toStartOfQuarter.toStartOfSecond.toStartOfTenMinutes.toStartOfWeek.toStartOfYear.toString.toStringCutToZero.toTime.toTime64.toTime64OrNull.toTime64OrZero.toTimeOrNull.toTimeOrZero.toTimeWithFixedDate.toTimeZone.toTimezone.toTypeName.toUInt128.toUInt128OrDefault.toUInt128OrNull.toUInt128OrZero.toUInt16.toUInt16OrDefault.toUInt16OrNull.toUInt16OrZero.toUInt256.toUInt256OrDefault.toUInt256OrNull.toUInt256OrZero.toUInt32.toUInt32OrDefault.toUInt32OrNull.toUInt32OrZero.toUInt64.toUInt64OrDefault.toUInt64OrNull.toUInt64OrZero.toUInt8.toUInt8OrDefault.toUInt8OrNull.toUInt8OrZero.toUTCTimestamp.toUUID.toUUIDOrDefault.toUUIDOrNull.toUUIDOrZero.toUnixTimestamp.toUnixTimestamp64Micro.toUnixTimestamp64Milli.toUnixTimestamp64Nano.toUnixTimestamp64Second.toValidUTF8.toWeek.toYYYYMM.toYYYYMMDD.toYYYYMMDDhhmmss.toYear.toYearNumSinceEpoch.toYearWeek.to_utc_timestamp.today.tokens.topK.topKWeighted.topLevelDomain.topLevelDomainRFC.transactionID.transactionLatestSnapshot.transactionOldestSnapshot.transform.translate.translateUTF8.trim.trimBoth.trimLeft.trimRight.trunc.tryBase32Decode.tryBase58Decode.tryBase64Decode.tryBase64URLDecode.tryDecrypt.tryIdnaEncode.tryPunycodeDecode.tumble.tumbleEnd.tumbleStart.tuple.tupleConcat.tupleDivide.tupleDivideByNumber.tupleElement.tupleHammingDistance.tupleIntDiv.tupleIntDivByNumber.tupleIntDivOrZero.tupleIntDivOrZeroByNumber.tupleMinus.tupleModulo.tupleModuloByNumber.tupleMultiply.tupleMultiplyByNumber.tupleNames.tupleNegate.tuplePlus.tupleToNameValuePairs.ucase.unbin.unhex.uniq.uniqCombined.uniqCombined64.uniqExact.uniqHLL12.uniqTheta.uniqThetaIntersect.uniqThetaNot.uniqThetaUnion.uniqUpTo.upper.upperUTF8.uptime.user.validateNestedArraySizes.varPop.varPopStable.varSamp.varSampStable.variantElement.variantType.vectorDifference.vectorSum.version.visibleWidth.visitParamExtractBool.visitParamExtractFloat.visitParamExtractInt.visitParamExtractRaw.visitParamExtractString.visitParamExtractUInt.visitParamHas.week.welchTTest.widthBucket.width_bucket.windowFunnel.windowID.wkb.wkt.wordShingleMinHash.wordShingleMinHashArg.wordShingleMinHashArgCaseInsensitive.wordShingleMinHashArgCaseInsensitiveUTF8.wordShingleMinHashArgUTF8.wordShingleMinHashCaseInsensitive.wordShingleMinHashCaseInsensitiveUTF8.wordShingleMinHashUTF8.wordShingleSimHash.wordShingleSimHashCaseInsensitive.wordShingleSimHashCaseInsensitiveUTF8.wordShingleSimHashUTF8.wyHash64.xor.xxHash32.xxHash64.xxh3.yandexConsistentHash.yearweek.yesterday.zookeeperSessionUptime.MergeTree.ReplacingMergeTree.SummingMergeTree.AggregatingMergeTree.CollapsingMergeTree.VersionedCollapsingMergeTree.GraphiteMergeTree.CoalescingMergeTree.Atomic.Shared.Lazy.Replicated.PostgreSQL.MySQL.SQLite.MaterializedPostgreSQL.DataLakeCatalog`.split(`.`),FJ=`ACCESS.ACTION.ADD.ADMIN.AFTER.ALGORITHM.ALIAS.ALL.ALLOWED_LATENESS.ALTER.AND.ANTI.APPEND.APPLY.AS.ASC.ASCENDING.ASOF.ASSUME.AST.ASYNC.ATTACH.AUTO_INCREMENT.AZURE.BACKUP.BAGEXPANSION.BASE_BACKUP.BCRYPT_HASH.BCRYPT_PASSWORD.BEGIN.BETWEEN.BIDIRECTIONAL.BOTH.BY.CACHE.CACHES.CASCADE.CASE.CHANGE.CHANGEABLE_IN_READONLY.CHANGED.CHARACTER.CHECK.CLEANUP.CLEAR.CLUSTER.CLUSTERS.CLUSTER_HOST_IDS.CN.CODEC.COLLATE.COLLECTION.COLUMN.COLUMNS.COMMENT.COMMIT.COMPRESSION.CONST.CONSTRAINT.CREATE.CROSS.CUBE.CURRENT.D.DATA.DATABASE.DATABASES.DAYS.DD.DDL.DEDUPLICATE.DEFAULT.DEFINER.DELAY.DELETE.DELETED.DEPENDS.DESC.DESCENDING.DESCRIBE.DETACH.DETACHED.DICTIONARIES.DICTIONARY.DISK.DISTINCT.DIV.DOUBLE_SHA1_HASH.DOUBLE_SHA1_PASSWORD.DROP.ELSE.ENABLED.END.ENFORCED.ENGINE.ENGINES.EPHEMERAL.ESTIMATE.EVENT.EVENTS.EVERY.EXCEPT.EXCHANGE.EXISTS.EXPLAIN.EXPRESSION.EXTENDED.EXTERNAL.FAKE.FALSE.FETCH.FIELDS.FILESYSTEM.FILL.FILTER.FINAL.FIRST.FOLLOWING.FOR.FOREIGN.FORMAT.FREEZE.FROM.FULL.FULLTEXT.FUNCTION.FUNCTIONS.GLOBAL.GRANT.GRANTEES.GRANTS.GRANULARITY.GROUP.GROUPING.GROUPS.H.HASH.HAVING.HDFS.HH.HIERARCHICAL.HOST.HOURS.HTTP.IDENTIFIED.ILIKE.IN.INDEX.INDEXES.INDICES.INFILE.INHERIT.INJECTIVE.INNER.INSERT.INTERPOLATE.INTERSECT.INTERVAL.INTO.INVISIBLE.INVOKER.IP.IS.IS_OBJECT_ID.JOIN.JWT.KERBEROS.KEY.KEYED.KEYS.KILL.KIND.LARGE.LAST.LAYOUT.LDAP.LEADING.LEVEL.LIFETIME.LIGHTWEIGHT.LIKE.LIMIT.LIMITS.LINEAR.LIST.LIVE.LOCAL.M.MASK.MATERIALIZED.MCS.MEMORY.MERGES.METRICS.MI.MICROSECOND.MICROSECONDS.MILLISECONDS.MINUTES.MM.MODIFY.MONTHS.MOVE.MS.MUTATION.N.NAME.NAMED.NANOSECOND.NANOSECONDS.NEXT.NO.NONE.NOT.NO_PASSWORD.NS.NULL.NULLS.OBJECT.OFFSET.ON.ONLY.OPTIMIZE.OPTION.OR.ORDER.OUTER.OUTFILE.OVER.OVERRIDABLE.OVERRIDE.PART.PARTIAL.PARTITION.PARTITIONS.PART_MOVE_TO_SHARD.PASTE.PERIODIC.PERMANENTLY.PERMISSIVE.PERSISTENT.PIPELINE.PLAINTEXT_PASSWORD.PLAN.POLICY.POPULATE.PRECEDING.PRECISION.PREWHERE.PRIMARY.PRIVILEGES.PROCESSLIST.PROFILE.PROJECTION.PROTOBUF.PULL.Q.QQ.QUALIFY.QUARTERS.QUERY.QUOTA.RANDOMIZE.RANDOMIZED.RANGE.READONLY.REALM.RECOMPRESS.RECURSIVE.REFERENCES.REFRESH.REGEXP.REMOVE.RENAME.RESET.RESPECT.RESTORE.RESTRICT.RESTRICTIVE.RESUME.REVOKE.ROLE.ROLES.ROLLBACK.ROLLUP.ROW.ROWS.S.S3.SALT.SAMPLE.SAN.SCHEME.SECONDS.SECURITY.SELECT.SEMI.SEQUENTIAL.SERVER.SET.SETS.SETTING.SETTINGS.SHA256_HASH.SHA256_PASSWORD.SHARD.SHOW.SIGNED.SIMPLE.SNAPSHOT.SOURCE.SPATIAL.SQL.SQL_TSI_DAY.SQL_TSI_HOUR.SQL_TSI_MICROSECOND.SQL_TSI_MILLISECOND.SQL_TSI_MINUTE.SQL_TSI_MONTH.SQL_TSI_NANOSECOND.SQL_TSI_QUARTER.SQL_TSI_SECOND.SQL_TSI_WEEK.SQL_TSI_YEAR.SS.SSH_KEY.SSL_CERTIFICATE.STALENESS.START.STATISTICS.STDOUT.STEP.STORAGE.STRICT.STRICTLY_ASCENDING.SUBPARTITION.SUBPARTITIONS.SUSPEND.SYNC.SYNTAX.SYSTEM.TABLE.TABLES.TAGS.TEMPORARY.TEST.THAN.THEN.TIES.TIME.TO.TOP.TOTALS.TRACKING.TRAILING.TRANSACTION.TREE.TRIGGER.TRUE.TRUNCATE.TTL.TYPE.TYPEOF.UNBOUNDED.UNDROP.UNFREEZE.UNION.UNIQUE.UNSET.UNSIGNED.UNTIL.UPDATE.URL.USE.USING.UUID.VALID.VALUES.VARYING.VIEW.VISIBLE.VOLUME.WATCH.WATERMARK.WEEKS.WHEN.WHERE.WINDOW.WITH.WITH_ITEMINDEX.WK.WRITABLE.WW.YEARS.YY.YYYY.ZKPATH`.split(`.`),IJ=`AGGREGATEFUNCTION.ARRAY.BFLOAT16.BIGINT.BIGINT SIGNED.BIGINT UNSIGNED.BINARY.BINARY LARGE OBJECT.BINARY VARYING.BIT.BLOB.BYTE.BYTEA.BOOL.CHAR.CHAR LARGE OBJECT.CHAR VARYING.CHARACTER.CHARACTER LARGE OBJECT.CHARACTER VARYING.CLOB.DEC.DOUBLE.DOUBLE PRECISION.DATE.DATE32.DATETIME.DATETIME32.DATETIME64.DECIMAL.DECIMAL128.DECIMAL256.DECIMAL32.DECIMAL64.DYNAMIC.ENUM.ENUM.ENUM16.ENUM8.FIXED.FLOAT.FIXEDSTRING.FLOAT32.FLOAT64.GEOMETRY.INET4.INET6.INT.INT SIGNED.INT UNSIGNED.INT1.INT1 SIGNED.INT1 UNSIGNED.INTEGER.INTEGER SIGNED.INTEGER UNSIGNED.IPV4.IPV6.INT128.INT16.INT256.INT32.INT64.INT8.INTERVALDAY.INTERVALHOUR.INTERVALMICROSECOND.INTERVALMILLISECOND.INTERVALMINUTE.INTERVALMONTH.INTERVALNANOSECOND.INTERVALQUARTER.INTERVALSECOND.INTERVALWEEK.INTERVALYEAR.JSON.LONGBLOB.LONGTEXT.LINESTRING.LOWCARDINALITY.MEDIUMBLOB.MEDIUMINT.MEDIUMINT SIGNED.MEDIUMINT UNSIGNED.MEDIUMTEXT.MAP.MULTILINESTRING.MULTIPOLYGON.NATIONAL CHAR.NATIONAL CHAR VARYING.NATIONAL CHARACTER.NATIONAL CHARACTER LARGE OBJECT.NATIONAL CHARACTER VARYING.NCHAR.NCHAR LARGE OBJECT.NCHAR VARYING.NUMERIC.NVARCHAR.NESTED.NOTHING.NULLABLE.OBJECT.POINT.POLYGON.REAL.RING.SET.SIGNED.SINGLE.SMALLINT.SMALLINT SIGNED.SMALLINT UNSIGNED.SIMPLEAGGREGATEFUNCTION.STRING.TEXT.TIMESTAMP.TINYBLOB.TINYINT.TINYINT SIGNED.TINYINT UNSIGNED.TINYTEXT.TIME.TIME64.TUPLE.UINT128.UINT16.UINT256.UINT32.UINT64.UINT8.UNSIGNED.UUID.VARBINARY.VARCHAR.VARCHAR2.VARIANT.YEAR.BOOL.BOOLEAN`.split(`.`),LJ=Y([`SELECT [DISTINCT]`,`MODIFY QUERY SELECT [DISTINCT]`]),RJ=Y(`SET.WITH.FROM.SAMPLE.PREWHERE.WHERE.GROUP BY.HAVING.QUALIFY.ORDER BY.LIMIT.SETTINGS.INTO OUTFILE.FORMAT.WINDOW.PARTITION BY.INSERT INTO.VALUES.DEPENDS ON.MOVE {USER | ROLE | QUOTA | SETTINGS PROFILE | ROW POLICY}.GRANT.REVOKE.CHECK GRANT.SET [DEFAULT] ROLE [NONE | ALL | ALL EXCEPT].DEDUPLICATE BY.MODIFY STATISTICS.TYPE.ALTER USER [IF EXISTS].ALTER [ROW] POLICY [IF EXISTS].DROP {USER | ROLE | QUOTA | PROFILE | SETTINGS PROFILE | ROW POLICY | POLICY} [IF EXISTS]`.split(`.`)),zJ=Y([`CREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]`]),BJ=Y(`ALL EXCEPT.ON CLUSTER.UPDATE.SYSTEM RELOAD {DICTIONARIES | DICTIONARY | FUNCTIONS | FUNCTION | ASYNCHRONOUS METRICS}.SYSTEM DROP {DNS CACHE | MARK CACHE | ICEBERG METADATA CACHE | TEXT INDEX DICTIONARY CACHE | TEXT INDEX HEADER CACHE | TEXT INDEX POSTINGS CACHE | REPLICA | DATABASE REPLICA | UNCOMPRESSED CACHE | COMPILED EXPRESSION CACHE | QUERY CONDITION CACHE | QUERY CACHE | FORMAT SCHEMA CACHE | FILESYSTEM CACHE}.SYSTEM FLUSH LOGS.SYSTEM RELOAD {CONFIG | USERS}.SYSTEM SHUTDOWN.SYSTEM KILL.SYSTEM FLUSH DISTRIBUTED.SYSTEM START DISTRIBUTED SENDS.SYSTEM {STOP | START} {LISTEN | MERGES | TTL MERGES | MOVES | FETCHES | REPLICATED SENDS | REPLICATION QUEUES | PULLING REPLICATION LOG}.SYSTEM {SYNC | RESTART | RESTORE} REPLICA.SYSTEM {SYNC | RESTORE} DATABASE REPLICA.SYSTEM RESTART REPLICAS.SYSTEM UNFREEZE.SYSTEM WAIT LOADING PARTS.SYSTEM {LOAD | UNLOAD} PRIMARY KEY.SYSTEM {STOP | START} [REPLICATED] VIEW.SYSTEM {STOP | START} VIEWS.SYSTEM {REFRESH | CANCEL | WAIT} VIEW.WITH NAME.SHOW [CREATE] {TABLE | TEMPORARY TABLE | DICTIONARY | VIEW | DATABASE}.SHOW DATABASES [[NOT] {LIKE | ILIKE}].SHOW [FULL] [TEMPORARY] TABLES [FROM | IN].SHOW [EXTENDED] [FULL] COLUMNS {FROM | IN}.ATTACH {TABLE | DICTIONARY | DATABASE} [IF NOT EXISTS].DETACH {TABLE | DICTIONARY | DATABASE} [IF EXISTS].PERMANENTLY.SYNC.DROP {DICTIONARY | DATABASE | PROFILE | VIEW | FUNCTION | NAMED COLLECTION} [IF EXISTS].DROP [TEMPORARY] TABLE [IF EXISTS] [IF EMPTY].RENAME TO.EXISTS [TEMPORARY] {TABLE | DICTIONARY | DATABASE}.KILL QUERY.OPTIMIZE TABLE.RENAME {TABLE | DICTIONARY | DATABASE}.EXCHANGE {TABLES | DICTIONARIES}.TRUNCATE TABLE [IF EXISTS].EXECUTE AS.USE.TO.UNDROP TABLE.CREATE {DATABASE | NAMED COLLECTION} [IF NOT EXISTS].CREATE [OR REPLACE] {VIEW | DICTIONARY} [IF NOT EXISTS].CREATE MATERIALIZED VIEW [IF NOT EXISTS].CREATE FUNCTION.CREATE {USER | ROLE | QUOTA | SETTINGS PROFILE} [IF NOT EXISTS | OR REPLACE].CREATE [ROW] POLICY [IF NOT EXISTS | OR REPLACE].REPLACE [TEMPORARY] TABLE [IF NOT EXISTS].ALTER {ROLE | QUOTA | SETTINGS PROFILE} [IF EXISTS].ALTER [TEMPORARY] TABLE.ALTER NAMED COLLECTION [IF EXISTS].GRANTEES.NOT IDENTIFIED.RESET AUTHENTICATION METHODS TO NEW.{IDENTIFIED | ADD IDENTIFIED} [WITH | BY].[ADD | DROP] HOST {LOCAL | NAME | REGEXP | IP | LIKE}.VALID UNTIL.DROP [ALL] {PROFILES | SETTINGS}.{ADD | MODIFY} SETTINGS.ADD PROFILES.APPLY DELETED MASK.IN PARTITION.{ADD | DROP | RENAME | CLEAR | COMMENT | MODIFY | ALTER | MATERIALIZE} COLUMN.{DETACH | DROP | ATTACH | FETCH | MOVE} {PART | PARTITION}.DROP DETACHED {PART | PARTITION}.{FORGET | REPLACE} PARTITION.CLEAR COLUMN.{FREEZE | UNFREEZE} [PARTITION].CLEAR INDEX.TO {DISK | VOLUME}.[DELETE | REWRITE PARTS] IN PARTITION.{MODIFY | RESET} SETTING.DELETE WHERE.MODIFY ORDER BY.{MODIFY | REMOVE} SAMPLE BY.{ADD | MATERIALIZE | CLEAR} INDEX [IF NOT EXISTS].DROP INDEX [IF EXISTS].GRANULARITY.AFTER.FIRST.ADD CONSTRAINT [IF NOT EXISTS].DROP CONSTRAINT [IF EXISTS].MODIFY TTL.REMOVE TTL.ADD STATISTICS [IF NOT EXISTS].{DROP | CLEAR} STATISTICS [IF EXISTS].MATERIALIZE STATISTICS [ALL | IF EXISTS].KEYED BY.NOT KEYED.FOR [RANDOMIZED] INTERVAL.AS {PERMISSIVE | RESTRICTIVE}.FOR SELECT.ADD PROJECTION [IF NOT EXISTS].{DROP | MATERIALIZE | CLEAR} PROJECTION [IF EXISTS].REFRESH {EVERY | AFTER}.RANDOMIZE FOR.APPEND.APPEND TO.DELETE FROM.EXPLAIN [AST | SYNTAX | QUERY TREE | PLAN | PIPELINE | ESTIMATE | TABLE OVERRIDE].GRANT ON CLUSTER.GRANT CURRENT GRANTS.WITH GRANT OPTION.REVOKE ON CLUSTER.ADMIN OPTION FOR.CHECK TABLE.PARTITION ID.{DESC | DESCRIBE} TABLE`.split(`.`)),VJ=Y([`UNION [ALL | DISTINCT]`,`PARALLEL WITH`]),HJ=Y([`[GLOBAL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER|SEMI|ANTI|ANY|ALL|ASOF] JOIN`,`[LEFT] ARRAY JOIN`]),UJ=Y([`{ROWS | RANGE} BETWEEN`,`ALTER MATERIALIZE STATISTICS`]),WJ={name:`clickhouse`,tokenizerOptions:{reservedSelect:LJ,reservedClauses:[...RJ,...zJ,...BJ],reservedSetOperations:VJ,reservedJoins:HJ,reservedKeywordPhrases:UJ,reservedKeywords:FJ,reservedDataTypes:IJ,reservedFunctionNames:PJ,extraParens:[`[]`,`{}`],lineCommentTypes:[`#`,`--`],nestedBlockComments:!1,underscoresInNumbers:!0,stringTypes:[`$$`,`''-qq-bs`],identTypes:[`""-qq-bs`,"``"],paramTypes:{custom:[{regex:String.raw`\{[^:']+:[^}]+\}`,key:e=>{let t=/\{([^:]+):/.exec(e);return t?t[1].trim():e}}]},operators:[`%`,`||`,`?`,`:`,`==`,`<=>`,`->`],postProcess:GJ},formatOptions:{onelineClauses:[...zJ,...BJ],tabularOnelineClauses:BJ}};function GJ(e){return e.map((t,n)=>{let r=e[n+1]||fJ,i=e[n-1]||fJ;return t.type===X.RESERVED_SELECT&&(r.type===X.COMMA||i.type===X.RESERVED_CLAUSE||i.type===X.COMMA)?Object.assign(Object.assign({},t),{type:X.RESERVED_KEYWORD}):mJ.SET(t)&&r.type===X.OPEN_PAREN?Object.assign(Object.assign({},t),{type:X.RESERVED_FUNCTION_NAME}):t})}var KJ=`ARRAY_AGG.AVG.CORRELATION.COUNT.COUNT_BIG.COVARIANCE.COVARIANCE_SAMP.CUME_DIST.GROUPING.LISTAGG.MAX.MEDIAN.MIN.PERCENTILE_CONT.PERCENTILE_DISC.PERCENT_RANK.REGR_AVGX.REGR_AVGY.REGR_COUNT.REGR_INTERCEPT.REGR_ICPT.REGR_R2.REGR_SLOPE.REGR_SXX.REGR_SXY.REGR_SYY.STDDEV.STDDEV_SAMP.SUM.VARIANCE.VARIANCE_SAMP.XMLAGG.XMLGROUP.ABS.ABSVAL.ACOS.ADD_DAYS.ADD_HOURS.ADD_MINUTES.ADD_MONTHS.ADD_SECONDS.ADD_YEARS.AGE.ARRAY_DELETE.ARRAY_FIRST.ARRAY_LAST.ARRAY_NEXT.ARRAY_PRIOR.ASCII.ASCII_STR.ASIN.ATAN.ATAN2.ATANH.BITAND.BITANDNOT.BITOR.BITXOR.BITNOT.BPCHAR.BSON_TO_JSON.BTRIM.CARDINALITY.CEILING.CEIL.CHARACTER_LENGTH.CHR.COALESCE.COLLATION_KEY.COLLATION_KEY_BIT.COMPARE_DECFLOAT.CONCAT.COS.COSH.COT.CURSOR_ROWCOUNT.DATAPARTITIONNUM.DATE_PART.DATE_TRUNC.DAY.DAYNAME.DAYOFMONTH.DAYOFWEEK.DAYOFWEEK_ISO.DAYOFYEAR.DAYS.DAYS_BETWEEN.DAYS_TO_END_OF_MONTH.DBPARTITIONNUM.DECFLOAT.DECFLOAT_FORMAT.DECODE.DECRYPT_BIN.DECRYPT_CHAR.DEGREES.DEREF.DIFFERENCE.DIGITS.DOUBLE_PRECISION.EMPTY_BLOB.EMPTY_CLOB.EMPTY_DBCLOB.EMPTY_NCLOB.ENCRYPT.EVENT_MON_STATE.EXP.EXTRACT.FIRST_DAY.FLOOR.FROM_UTC_TIMESTAMP.GENERATE_UNIQUE.GETHINT.GREATEST.HASH.HASH4.HASH8.HASHEDVALUE.HEX.HEXTORAW.HOUR.HOURS_BETWEEN.IDENTITY_VAL_LOCAL.IFNULL.INITCAP.INSERT.INSTR.INSTR2.INSTR4.INSTRB.INTNAND.INTNOR.INTNXOR.INTNNOT.ISNULL.JSON_ARRAY.JSON_OBJECT.JSON_QUERY.JSON_TO_BSON.JSON_VALUE.JULIAN_DAY.LAST_DAY.LCASE.LEAST.LEFT.LENGTH.LENGTH2.LENGTH4.LENGTHB.LN.LOCATE.LOCATE_IN_STRING.LOG10.LONG_VARCHAR.LONG_VARGRAPHIC.LOWER.LPAD.LTRIM.MAX.MAX_CARDINALITY.MICROSECOND.MIDNIGHT_SECONDS.MIN.MINUTE.MINUTES_BETWEEN.MOD.MONTH.MONTHNAME.MONTHS_BETWEEN.MULTIPLY_ALT.NEXT_DAY.NEXT_MONTH.NEXT_QUARTER.NEXT_WEEK.NEXT_YEAR.NORMALIZE_DECFLOAT.NOW.NULLIF.NVL.NVL2.OCTET_LENGTH.OVERLAY.PARAMETER.POSITION.POSSTR.POW.POWER.QUANTIZE.QUARTER.QUOTE_IDENT.QUOTE_LITERAL.RADIANS.RAISE_ERROR.RAND.RANDOM.RAWTOHEX.REC2XML.REGEXP_COUNT.REGEXP_EXTRACT.REGEXP_INSTR.REGEXP_LIKE.REGEXP_MATCH_COUNT.REGEXP_REPLACE.REGEXP_SUBSTR.REPEAT.REPLACE.RID.RID_BIT.RIGHT.ROUND.ROUND_TIMESTAMP.RPAD.RTRIM.SECLABEL.SECLABEL_BY_NAME.SECLABEL_TO_CHAR.SECOND.SECONDS_BETWEEN.SIGN.SIN.SINH.SOUNDEX.SPACE.SQRT.STRIP.STRLEFT.STRPOS.STRRIGHT.SUBSTR.SUBSTR2.SUBSTR4.SUBSTRB.SUBSTRING.TABLE_NAME.TABLE_SCHEMA.TAN.TANH.THIS_MONTH.THIS_QUARTER.THIS_WEEK.THIS_YEAR.TIMESTAMP_FORMAT.TIMESTAMP_ISO.TIMESTAMPDIFF.TIMEZONE.TO_CHAR.TO_CLOB.TO_DATE.TO_HEX.TO_MULTI_BYTE.TO_NCHAR.TO_NCLOB.TO_NUMBER.TO_SINGLE_BYTE.TO_TIMESTAMP.TO_UTC_TIMESTAMP.TOTALORDER.TRANSLATE.TRIM.TRIM_ARRAY.TRUNC_TIMESTAMP.TRUNCATE.TRUNC.TYPE_ID.TYPE_NAME.TYPE_SCHEMA.UCASE.UNICODE_STR.UPPER.VALUE.VARCHAR_BIT_FORMAT.VARCHAR_FORMAT.VARCHAR_FORMAT_BIT.VERIFY_GROUP_FOR_USER.VERIFY_ROLE_FOR_USER.VERIFY_TRUSTED_CONTEXT_ROLE_FOR_USER.WEEK.WEEK_ISO.WEEKS_BETWEEN.WIDTH_BUCKET.XMLATTRIBUTES.XMLCOMMENT.XMLCONCAT.XMLDOCUMENT.XMLELEMENT.XMLFOREST.XMLNAMESPACES.XMLPARSE.XMLPI.XMLQUERY.XMLROW.XMLSERIALIZE.XMLTEXT.XMLVALIDATE.XMLXSROBJECTID.XSLTRANSFORM.YEAR.YEARS_BETWEEN.YMD_BETWEEN.BASE_TABLE.JSON_TABLE.UNNEST.XMLTABLE.RANK.DENSE_RANK.NTILE.LAG.LEAD.ROW_NUMBER.FIRST_VALUE.LAST_VALUE.NTH_VALUE.RATIO_TO_REPORT.CAST`.split(`.`),qJ=`ACTIVATE.ADD.AFTER.ALIAS.ALL.ALLOCATE.ALLOW.ALTER.AND.ANY.AS.ASENSITIVE.ASSOCIATE.ASUTIME.AT.ATTRIBUTES.AUDIT.AUTHORIZATION.AUX.AUXILIARY.BEFORE.BEGIN.BETWEEN.BINARY.BUFFERPOOL.BY.CACHE.CALL.CALLED.CAPTURE.CARDINALITY.CASCADED.CASE.CAST.CHECK.CLONE.CLOSE.CLUSTER.COLLECTION.COLLID.COLUMN.COMMENT.COMMIT.CONCAT.CONDITION.CONNECT.CONNECTION.CONSTRAINT.CONTAINS.CONTINUE.COUNT.COUNT_BIG.CREATE.CROSS.CURRENT.CURRENT_DATE.CURRENT_LC_CTYPE.CURRENT_PATH.CURRENT_SCHEMA.CURRENT_SERVER.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_TIMEZONE.CURRENT_USER.CURSOR.CYCLE.DATA.DATABASE.DATAPARTITIONNAME.DATAPARTITIONNUM.DAY.DAYS.DB2GENERAL.DB2GENRL.DB2SQL.DBINFO.DBPARTITIONNAME.DBPARTITIONNUM.DEALLOCATE.DECLARE.DEFAULT.DEFAULTS.DEFINITION.DELETE.DENSERANK.DENSE_RANK.DESCRIBE.DESCRIPTOR.DETERMINISTIC.DIAGNOSTICS.DISABLE.DISALLOW.DISCONNECT.DISTINCT.DO.DOCUMENT.DROP.DSSIZE.DYNAMIC.EACH.EDITPROC.ELSE.ELSEIF.ENABLE.ENCODING.ENCRYPTION.END.END-EXEC.ENDING.ERASE.ESCAPE.EVERY.EXCEPT.EXCEPTION.EXCLUDING.EXCLUSIVE.EXECUTE.EXISTS.EXIT.EXPLAIN.EXTENDED.EXTERNAL.EXTRACT.FENCED.FETCH.FIELDPROC.FILE.FINAL.FIRST1.FOR.FOREIGN.FREE.FROM.FULL.FUNCTION.GENERAL.GENERATED.GET.GLOBAL.GO.GOTO.GRANT.GRAPHIC.GROUP.HANDLER.HASH.HASHED_VALUE.HAVING.HINT.HOLD.HOUR.HOURS.IDENTITY.IF.IMMEDIATE.IMPORT.IN.INCLUDING.INCLUSIVE.INCREMENT.INDEX.INDICATOR.INDICATORS.INF.INFINITY.INHERIT.INNER.INOUT.INSENSITIVE.INSERT.INTEGRITY.INTERSECT.INTO.IS.ISNULL.ISOBID.ISOLATION.ITERATE.JAR.JAVA.JOIN.KEEP.KEY.LABEL.LANGUAGE.LAST3.LATERAL.LC_CTYPE.LEAVE.LEFT.LIKE.LIMIT.LINKTYPE.LOCAL.LOCALDATE.LOCALE.LOCALTIME.LOCALTIMESTAMP.LOCATOR.LOCATORS.LOCK.LOCKMAX.LOCKSIZE.LOOP.MAINTAINED.MATERIALIZED.MAXVALUE.MICROSECOND.MICROSECONDS.MINUTE.MINUTES.MINVALUE.MODE.MODIFIES.MONTH.MONTHS.NAN.NEW.NEW_TABLE.NEXTVAL.NO.NOCACHE.NOCYCLE.NODENAME.NODENUMBER.NOMAXVALUE.NOMINVALUE.NONE.NOORDER.NORMALIZED.NOT2.NOTNULL.NULL.NULLS.NUMPARTS.OBID.OF.OFF.OFFSET.OLD.OLD_TABLE.ON.OPEN.OPTIMIZATION.OPTIMIZE.OPTION.OR.ORDER.OUT.OUTER.OVER.OVERRIDING.PACKAGE.PADDED.PAGESIZE.PARAMETER.PART.PARTITION.PARTITIONED.PARTITIONING.PARTITIONS.PASSWORD.PATH.PERCENT.PIECESIZE.PLAN.POSITION.PRECISION.PREPARE.PREVVAL.PRIMARY.PRIQTY.PRIVILEGES.PROCEDURE.PROGRAM.PSID.PUBLIC.QUERY.QUERYNO.RANGE.RANK.READ.READS.RECOVERY.REFERENCES.REFERENCING.REFRESH.RELEASE.RENAME.REPEAT.RESET.RESIGNAL.RESTART.RESTRICT.RESULT.RESULT_SET_LOCATOR.RETURN.RETURNS.REVOKE.RIGHT.ROLE.ROLLBACK.ROUND_CEILING.ROUND_DOWN.ROUND_FLOOR.ROUND_HALF_DOWN.ROUND_HALF_EVEN.ROUND_HALF_UP.ROUND_UP.ROUTINE.ROW.ROWNUMBER.ROWS.ROWSET.ROW_NUMBER.RRN.RUN.SAVEPOINT.SCHEMA.SCRATCHPAD.SCROLL.SEARCH.SECOND.SECONDS.SECQTY.SECURITY.SELECT.SENSITIVE.SEQUENCE.SESSION.SESSION_USER.SET.SIGNAL.SIMPLE.SNAN.SOME.SOURCE.SPECIFIC.SQL.SQLID.STACKED.STANDARD.START.STARTING.STATEMENT.STATIC.STATMENT.STAY.STOGROUP.STORES.STYLE.SUBSTRING.SUMMARY.SYNONYM.SYSFUN.SYSIBM.SYSPROC.SYSTEM.SYSTEM_USER.TABLE.TABLESPACE.THEN.TO.TRANSACTION.TRIGGER.TRIM.TRUNCATE.TYPE.UNDO.UNION.UNIQUE.UNTIL.UPDATE.USAGE.USER.USING.VALIDPROC.VALUE.VALUES.VARIABLE.VARIANT.VCAT.VERSION.VIEW.VOLATILE.VOLUMES.WHEN.WHENEVER.WHERE.WHILE.WITH.WITHOUT.WLM.WRITE.XMLELEMENT.XMLEXISTS.XMLNAMESPACES.YEAR.YEARS`.split(`.`),JJ=`ARRAY.BIGINT.BINARY.BLOB.BOOLEAN.CCSID.CHAR.CHARACTER.CLOB.DATE.DATETIME.DBCLOB.DEC.DECIMAL.DOUBLE.DOUBLE PRECISION.FLOAT.FLOAT4.FLOAT8.GRAPHIC.INT.INT2.INT4.INT8.INTEGER.INTERVAL.LONG VARCHAR.LONG VARGRAPHIC.NCHAR.NCHR.NCLOB.NVARCHAR.NUMERIC.SMALLINT.REAL.TIME.TIMESTAMP.VARBINARY.VARCHAR.VARGRAPHIC`.split(`.`),YJ=Y([`SELECT [ALL | DISTINCT]`]),XJ=Y([`WITH`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`PARTITION BY`,`ORDER BY [INPUT SEQUENCE]`,`LIMIT`,`OFFSET`,`FETCH NEXT`,`FOR UPDATE [OF]`,`FOR {READ | FETCH} ONLY`,`FOR {RR | CS | UR | RS} [USE AND KEEP {SHARE | UPDATE | EXCLUSIVE} LOCKS]`,`WAIT FOR OUTCOME`,`SKIP LOCKED DATA`,`INTO`,`INSERT INTO`,`VALUES`,`SET`,`MERGE INTO`,`WHEN [NOT] MATCHED [THEN]`,`UPDATE SET`,`INSERT`]),ZJ=Y([`CREATE [GLOBAL TEMPORARY | EXTERNAL] TABLE [IF NOT EXISTS]`]),QJ=Y(`CREATE [OR REPLACE] VIEW.UPDATE.WHERE CURRENT OF.WITH {RR | RS | CS | UR}.DELETE FROM.DROP TABLE [IF EXISTS].ALTER TABLE.ADD [COLUMN].DROP [COLUMN].RENAME COLUMN.ALTER [COLUMN].SET DATA TYPE.SET NOT NULL.DROP {DEFAULT | GENERATED | NOT NULL}.TRUNCATE [TABLE].ALLOCATE.ALTER AUDIT POLICY.ALTER BUFFERPOOL.ALTER DATABASE PARTITION GROUP.ALTER DATABASE.ALTER EVENT MONITOR.ALTER FUNCTION.ALTER HISTOGRAM TEMPLATE.ALTER INDEX.ALTER MASK.ALTER METHOD.ALTER MODULE.ALTER NICKNAME.ALTER PACKAGE.ALTER PERMISSION.ALTER PROCEDURE.ALTER SCHEMA.ALTER SECURITY LABEL COMPONENT.ALTER SECURITY POLICY.ALTER SEQUENCE.ALTER SERVER.ALTER SERVICE CLASS.ALTER STOGROUP.ALTER TABLESPACE.ALTER THRESHOLD.ALTER TRIGGER.ALTER TRUSTED CONTEXT.ALTER TYPE.ALTER USAGE LIST.ALTER USER MAPPING.ALTER VIEW.ALTER WORK ACTION SET.ALTER WORK CLASS SET.ALTER WORKLOAD.ALTER WRAPPER.ALTER XSROBJECT.ALTER STOGROUP.ALTER TABLESPACE.ALTER TRIGGER.ALTER TRUSTED CONTEXT.ALTER VIEW.ASSOCIATE [RESULT SET] {LOCATOR | LOCATORS}.AUDIT.BEGIN DECLARE SECTION.CALL.CLOSE.COMMENT ON.COMMIT [WORK].CONNECT.CREATE [OR REPLACE] [PUBLIC] ALIAS.CREATE AUDIT POLICY.CREATE BUFFERPOOL.CREATE DATABASE PARTITION GROUP.CREATE EVENT MONITOR.CREATE [OR REPLACE] FUNCTION.CREATE FUNCTION MAPPING.CREATE HISTOGRAM TEMPLATE.CREATE [UNIQUE] INDEX.CREATE INDEX EXTENSION.CREATE [OR REPLACE] MASK.CREATE [SPECIFIC] METHOD.CREATE [OR REPLACE] MODULE.CREATE [OR REPLACE] NICKNAME.CREATE [OR REPLACE] PERMISSION.CREATE [OR REPLACE] PROCEDURE.CREATE ROLE.CREATE SCHEMA.CREATE SECURITY LABEL [COMPONENT].CREATE SECURITY POLICY.CREATE [OR REPLACE] SEQUENCE.CREATE SERVICE CLASS.CREATE SERVER.CREATE STOGROUP.CREATE SYNONYM.CREATE [LARGE | REGULAR | {SYSTEM | USER} TEMPORARY] TABLESPACE.CREATE THRESHOLD.CREATE {TRANSFORM | TRANSFORMS} FOR.CREATE [OR REPLACE] TRIGGER.CREATE TRUSTED CONTEXT.CREATE [OR REPLACE] TYPE.CREATE TYPE MAPPING.CREATE USAGE LIST.CREATE USER MAPPING FOR.CREATE [OR REPLACE] VARIABLE.CREATE WORK ACTION SET.CREATE WORK CLASS SET.CREATE WORKLOAD.CREATE WRAPPER.DECLARE.DECLARE GLOBAL TEMPORARY TABLE.DESCRIBE [INPUT | OUTPUT].DISCONNECT.DROP [PUBLIC] ALIAS.DROP AUDIT POLICY.DROP BUFFERPOOL.DROP DATABASE PARTITION GROUP.DROP EVENT MONITOR.DROP [SPECIFIC] FUNCTION.DROP FUNCTION MAPPING.DROP HISTOGRAM TEMPLATE.DROP INDEX [EXTENSION].DROP MASK.DROP [SPECIFIC] METHOD.DROP MODULE.DROP NICKNAME.DROP PACKAGE.DROP PERMISSION.DROP [SPECIFIC] PROCEDURE.DROP ROLE.DROP SCHEMA.DROP SECURITY LABEL [COMPONENT].DROP SECURITY POLICY.DROP SEQUENCE.DROP SERVER.DROP SERVICE CLASS.DROP STOGROUP.DROP TABLE HIERARCHY.DROP {TABLESPACE | TABLESPACES}.DROP {TRANSFORM | TRANSFORMS}.DROP THRESHOLD.DROP TRIGGER.DROP TRUSTED CONTEXT.DROP TYPE [MAPPING].DROP USAGE LIST.DROP USER MAPPING FOR.DROP VARIABLE.DROP VIEW [HIERARCHY].DROP WORK {ACTION | CLASS} SET.DROP WORKLOAD.DROP WRAPPER.DROP XSROBJECT.END DECLARE SECTION.EXECUTE [IMMEDIATE].EXPLAIN {PLAN [SECTION] | ALL}.FETCH [FROM].FLUSH {BUFFERPOOL | BUFFERPOOLS} ALL.FLUSH EVENT MONITOR.FLUSH FEDERATED CACHE.FLUSH OPTIMIZATION PROFILE CACHE.FLUSH PACKAGE CACHE [DYNAMIC].FLUSH AUTHENTICATION CACHE [FOR ALL].FREE LOCATOR.GET DIAGNOSTICS.GOTO.GRANT.INCLUDE.ITERATE.LEAVE.LOCK TABLE.LOOP.OPEN.PIPE.PREPARE.REFRESH TABLE.RELEASE.RELEASE [TO] SAVEPOINT.RENAME [TABLE | INDEX | STOGROUP | TABLESPACE].REPEAT.RESIGNAL.RETURN.REVOKE.ROLLBACK [WORK] [TO SAVEPOINT].SAVEPOINT.SET COMPILATION ENVIRONMENT.SET CONNECTION.SET CURRENT.SET ENCRYPTION PASSWORD.SET EVENT MONITOR STATE.SET INTEGRITY.SET PASSTHRU.SET PATH.SET ROLE.SET SCHEMA.SET SERVER OPTION.SET {SESSION AUTHORIZATION | SESSION_USER}.SET USAGE LIST.SIGNAL.TRANSFER OWNERSHIP OF.WHENEVER {NOT FOUND | SQLERROR | SQLWARNING}.WHILE`.split(`.`)),$J=Y([`UNION [ALL]`,`EXCEPT [ALL]`,`INTERSECT [ALL]`]),eY=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`]),tY=Y([`ON DELETE`,`ON UPDATE`,`SET NULL`,`{ROWS | RANGE} BETWEEN`]),nY=Y([]),rY={name:`db2`,tokenizerOptions:{reservedSelect:YJ,reservedClauses:[...XJ,...ZJ,...QJ],reservedSetOperations:$J,reservedJoins:eY,reservedKeywordPhrases:tY,reservedDataTypePhrases:nY,reservedKeywords:qJ,reservedDataTypes:JJ,reservedFunctionNames:KJ,extraParens:[`[]`],stringTypes:[{quote:`''-qq`,prefixes:[`G`,`N`,`U&`]},{quote:`''-raw`,prefixes:[`X`,`BX`,`GX`,`UX`],requirePrefix:!0}],identTypes:[`""-qq`],identChars:{first:`@#$`,rest:`@#$`},paramTypes:{positional:!0,named:[`:`]},paramChars:{first:`@#$`,rest:`@#$`},operators:[`**`,`%`,`|`,`&`,`^`,`~`,`¬=`,`¬>`,`¬<`,`!>`,`!<`,`^=`,`^>`,`^<`,`||`,`->`,`=>`]},formatOptions:{onelineClauses:[...ZJ,...QJ],tabularOnelineClauses:QJ}},iY=`ARRAY_AGG.AVG.CORR.CORRELATION.COUNT.COUNT_BIG.COVAR_POP.COVARIANCE.COVAR.COVAR_SAMP.COVARIANCE_SAMP.EVERY.GROUPING.JSON_ARRAYAGG.JSON_OBJECTAGG.LISTAGG.MAX.MEDIAN.MIN.PERCENTILE_CONT.PERCENTILE_DISC.REGR_AVGX.REGR_AVGY.REGR_COUNT.REGR_INTERCEPT.REGR_R2.REGR_SLOPE.REGR_SXX.REGR_SXY.REGR_SYY.SOME.STDDEV_POP.STDDEV.STDDEV_SAMP.SUM.VAR_POP.VARIANCE.VAR.VAR_SAMP.VARIANCE_SAMP.XMLAGG.XMLGROUP.ABS.ABSVAL.ACOS.ADD_DAYS.ADD_HOURS.ADD_MINUTES.ADD_MONTHS.ADD_SECONDS.ADD_YEARS.ANTILOG.ARRAY_MAX_CARDINALITY.ARRAY_TRIM.ASCII.ASIN.ATAN.ATAN2.ATANH.BASE64_DECODE.BASE64_ENCODE.BIT_LENGTH.BITAND.BITANDNOT.BITNOT.BITOR.BITXOR.BSON_TO_JSON.CARDINALITY.CEIL.CEILING.CHAR_LENGTH.CHARACTER_LENGTH.CHR.COALESCE.COMPARE_DECFLOAT.CONCAT.CONTAINS.COS.COSH.COT.CURDATE.CURTIME.DATABASE.DATAPARTITIONNAME.DATAPARTITIONNUM.DAY.DAYNAME.DAYOFMONTH.DAYOFWEEK_ISO.DAYOFWEEK.DAYOFYEAR.DAYS.DBPARTITIONNAME.DBPARTITIONNUM.DECFLOAT_FORMAT.DECFLOAT_SORTKEY.DECRYPT_BINARY.DECRYPT_BIT.DECRYPT_CHAR.DECRYPT_DB.DEGREES.DIFFERENCE.DIGITS.DLCOMMENT.DLLINKTYPE.DLURLCOMPLETE.DLURLPATH.DLURLPATHONLY.DLURLSCHEME.DLURLSERVER.DLVALUE.DOUBLE_PRECISION.DOUBLE.ENCRPYT.ENCRYPT_AES.ENCRYPT_AES256.ENCRYPT_RC2.ENCRYPT_TDES.EXP.EXTRACT.FIRST_DAY.FLOOR.GENERATE_UNIQUE.GET_BLOB_FROM_FILE.GET_CLOB_FROM_FILE.GET_DBCLOB_FROM_FILE.GET_XML_FILE.GETHINT.GREATEST.HASH_MD5.HASH_ROW.HASH_SHA1.HASH_SHA256.HASH_SHA512.HASH_VALUES.HASHED_VALUE.HEX.HEXTORAW.HOUR.HTML_ENTITY_DECODE.HTML_ENTITY_ENCODE.HTTP_DELETE_BLOB.HTTP_DELETE.HTTP_GET_BLOB.HTTP_GET.HTTP_PATCH_BLOB.HTTP_PATCH.HTTP_POST_BLOB.HTTP_POST.HTTP_PUT_BLOB.HTTP_PUT.IDENTITY_VAL_LOCAL.IFNULL.INSERT.INSTR.INTERPRET.ISFALSE.ISNOTFALSE.ISNOTTRUE.ISTRUE.JSON_ARRAY.JSON_OBJECT.JSON_QUERY.JSON_TO_BSON.JSON_UPDATE.JSON_VALUE.JULIAN_DAY.LAND.LAST_DAY.LCASE.LEAST.LEFT.LENGTH.LN.LNOT.LOCATE_IN_STRING.LOCATE.LOG10.LOR.LOWER.LPAD.LTRIM.MAX_CARDINALITY.MAX.MICROSECOND.MIDNIGHT_SECONDS.MIN.MINUTE.MOD.MONTH.MONTHNAME.MONTHS_BETWEEN.MQREAD.MQREADCLOB.MQRECEIVE.MQRECEIVECLOB.MQSEND.MULTIPLY_ALT.NEXT_DAY.NORMALIZE_DECFLOAT.NOW.NULLIF.NVL.OCTET_LENGTH.OVERLAY.PI.POSITION.POSSTR.POW.POWER.QUANTIZE.QUARTER.RADIANS.RAISE_ERROR.RANDOM.RAND.REGEXP_COUNT.REGEXP_INSTR.REGEXP_REPLACE.REGEXP_SUBSTR.REPEAT.REPLACE.RID.RIGHT.ROUND_TIMESTAMP.ROUND.RPAD.RRN.RTRIM.SCORE.SECOND.SIGN.SIN.SINH.SOUNDEX.SPACE.SQRT.STRIP.STRLEFT.STRPOS.STRRIGHT.SUBSTR.SUBSTRING.TABLE_NAME.TABLE_SCHEMA.TAN.TANH.TIMESTAMP_FORMAT.TIMESTAMP_ISO.TIMESTAMPDIFF_BIG.TIMESTAMPDIFF.TO_CHAR.TO_CLOB.TO_DATE.TO_NUMBER.TO_TIMESTAMP.TOTALORDER.TRANSLATE.TRIM_ARRAY.TRIM.TRUNC_TIMESTAMP.TRUNC.TRUNCATE.UCASE.UPPER.URL_DECODE.URL_ENCODE.VALUE.VARBINARY_FORMAT.VARCHAR_BIT_FORMAT.VARCHAR_FORMAT_BINARY.VARCHAR_FORMAT.VERIFY_GROUP_FOR_USER.WEEK_ISO.WEEK.WRAP.XMLATTRIBUTES.XMLCOMMENT.XMLCONCAT.XMLDOCUMENT.XMLELEMENT.XMLFOREST.XMLNAMESPACES.XMLPARSE.XMLPI.XMLROW.XMLSERIALIZE.XMLTEXT.XMLVALIDATE.XOR.XSLTRANSFORM.YEAR.ZONED.BASE_TABLE.HTTP_DELETE_BLOB_VERBOSE.HTTP_DELETE_VERBOSE.HTTP_GET_BLOB_VERBOSE.HTTP_GET_VERBOSE.HTTP_PATCH_BLOB_VERBOSE.HTTP_PATCH_VERBOSE.HTTP_POST_BLOB_VERBOSE.HTTP_POST_VERBOSE.HTTP_PUT_BLOB_VERBOSE.HTTP_PUT_VERBOSE.JSON_TABLE.MQREADALL.MQREADALLCLOB.MQRECEIVEALL.MQRECEIVEALLCLOB.XMLTABLE.UNPACK.CUME_DIST.DENSE_RANK.FIRST_VALUE.LAG.LAST_VALUE.LEAD.NTH_VALUE.NTILE.PERCENT_RANK.RANK.RATIO_TO_REPORT.ROW_NUMBER.CAST`.split(`.`),aY=`ABSENT.ACCORDING.ACCTNG.ACTION.ACTIVATE.ADD.ALIAS.ALL.ALLOCATE.ALLOW.ALTER.AND.ANY.APPEND.APPLNAME.ARRAY.ARRAY_AGG.ARRAY_TRIM.AS.ASC.ASENSITIVE.ASSOCIATE.ATOMIC.ATTACH.ATTRIBUTES.AUTHORIZATION.AUTONOMOUS.BEFORE.BEGIN.BETWEEN.BIND.BSON.BUFFERPOOL.BY.CACHE.CALL.CALLED.CARDINALITY.CASE.CAST.CHECK.CL.CLOSE.CLUSTER.COLLECT.COLLECTION.COLUMN.COMMENT.COMMIT.COMPACT.COMPARISONS.COMPRESS.CONCAT.CONCURRENT.CONDITION.CONNECT.CONNECT_BY_ROOT.CONNECTION.CONSTANT.CONSTRAINT.CONTAINS.CONTENT.CONTINUE.COPY.COUNT.COUNT_BIG.CREATE.CREATEIN.CROSS.CUBE.CUME_DIST.CURRENT.CURRENT_DATE.CURRENT_PATH.CURRENT_SCHEMA.CURRENT_SERVER.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_TIMEZONE.CURRENT_USER.CURSOR.CYCLE.DATABASE.DATAPARTITIONNAME.DATAPARTITIONNUM.DAY.DAYS.DB2GENERAL.DB2GENRL.DB2SQL.DBINFO.DBPARTITIONNAME.DBPARTITIONNUM.DEACTIVATE.DEALLOCATE.DECLARE.DEFAULT.DEFAULTS.DEFER.DEFINE.DEFINITION.DELETE.DELETING.DENSE_RANK.DENSERANK.DESC.DESCRIBE.DESCRIPTOR.DETACH.DETERMINISTIC.DIAGNOSTICS.DISABLE.DISALLOW.DISCONNECT.DISTINCT.DO.DOCUMENT.DROP.DYNAMIC.EACH.ELSE.ELSEIF.EMPTY.ENABLE.ENCODING.ENCRYPTION.END.END-EXEC.ENDING.ENFORCED.ERROR.ESCAPE.EVERY.EXCEPT.EXCEPTION.EXCLUDING.EXCLUSIVE.EXECUTE.EXISTS.EXIT.EXTEND.EXTERNAL.EXTRACT.FALSE.FENCED.FETCH.FIELDPROC.FILE.FINAL.FIRST_VALUE.FOR.FOREIGN.FORMAT.FREE.FREEPAGE.FROM.FULL.FUNCTION.GBPCACHE.GENERAL.GENERATED.GET.GLOBAL.GO.GOTO.GRANT.GROUP.HANDLER.HASH.HASH_ROW.HASHED_VALUE.HAVING.HINT.HOLD.HOUR.HOURS.IDENTITY.IF.IGNORE.IMMEDIATE.IMPLICITLY.IN.INCLUDE.INCLUDING.INCLUSIVE.INCREMENT.INDEX.INDEXBP.INDICATOR.INF.INFINITY.INHERIT.INLINE.INNER.INOUT.INSENSITIVE.INSERT.INSERTING.INTEGRITY.INTERPRET.INTERSECT.INTO.IS.ISNULL.ISOLATION.ITERATE.JAVA.JOIN.JSON.JSON_ARRAY.JSON_ARRAYAGG.JSON_EXISTS.JSON_OBJECT.JSON_OBJECTAGG.JSON_QUERY.JSON_TABLE.JSON_VALUE.KEEP.KEY.KEYS.LABEL.LAG.LANGUAGE.LAST_VALUE.LATERAL.LEAD.LEAVE.LEFT.LEVEL2.LIKE.LIMIT.LINKTYPE.LISTAGG.LOCAL.LOCALDATE.LOCALTIME.LOCALTIMESTAMP.LOCATION.LOCATOR.LOCK.LOCKSIZE.LOG.LOGGED.LOOP.MAINTAINED.MASK.MATCHED.MATERIALIZED.MAXVALUE.MERGE.MICROSECOND.MICROSECONDS.MINPCTUSED.MINUTE.MINUTES.MINVALUE.MIRROR.MIXED.MODE.MODIFIES.MONTH.MONTHS.NAMESPACE.NAN.NATIONAL.NCHAR.NCLOB.NESTED.NEW.NEW_TABLE.NEXTVAL.NO.NOCACHE.NOCYCLE.NODENAME.NODENUMBER.NOMAXVALUE.NOMINVALUE.NONE.NOORDER.NORMALIZED.NOT.NOTNULL.NTH_VALUE.NTILE.NULL.NULLS.NVARCHAR.OBID.OBJECT.OF.OFF.OFFSET.OLD.OLD_TABLE.OMIT.ON.ONLY.OPEN.OPTIMIZE.OPTION.OR.ORDER.ORDINALITY.ORGANIZE.OUT.OUTER.OVER.OVERLAY.OVERRIDING.PACKAGE.PADDED.PAGE.PAGESIZE.PARAMETER.PART.PARTITION.PARTITIONED.PARTITIONING.PARTITIONS.PASSING.PASSWORD.PATH.PCTFREE.PERCENT_RANK.PERCENTILE_CONT.PERCENTILE_DISC.PERIOD.PERMISSION.PIECESIZE.PIPE.PLAN.POSITION.PREPARE.PREVVAL.PRIMARY.PRIOR.PRIQTY.PRIVILEGES.PROCEDURE.PROGRAM.PROGRAMID.QUERY.RANGE.RANK.RATIO_TO_REPORT.RCDFMT.READ.READS.RECOVERY.REFERENCES.REFERENCING.REFRESH.REGEXP_LIKE.RELEASE.RENAME.REPEAT.RESET.RESIGNAL.RESTART.RESULT.RESULT_SET_LOCATOR.RETURN.RETURNING.RETURNS.REVOKE.RID.RIGHT.ROLLBACK.ROLLUP.ROUTINE.ROW.ROW_NUMBER.ROWNUMBER.ROWS.RRN.RUN.SAVEPOINT.SBCS.SCALAR.SCHEMA.SCRATCHPAD.SCROLL.SEARCH.SECOND.SECONDS.SECQTY.SECURED.SELECT.SENSITIVE.SEQUENCE.SESSION.SESSION_USER.SET.SIGNAL.SIMPLE.SKIP.SNAN.SOME.SOURCE.SPECIFIC.SQL.SQLID.SQLIND_DEFAULT.SQLIND_UNASSIGNED.STACKED.START.STARTING.STATEMENT.STATIC.STOGROUP.SUBSTRING.SUMMARY.SYNONYM.SYSTEM_TIME.SYSTEM_USER.TABLE.TABLESPACE.TABLESPACES.TAG.THEN.THREADSAFE.TO.TRANSACTION.TRANSFER.TRIGGER.TRIM.TRIM_ARRAY.TRUE.TRUNCATE.TRY_CAST.TYPE.UNDO.UNION.UNIQUE.UNIT.UNKNOWN.UNNEST.UNTIL.UPDATE.UPDATING.URI.USAGE.USE.USER.USERID.USING.VALUE.VALUES.VARIABLE.VARIANT.VCAT.VERSION.VERSIONING.VIEW.VOLATILE.WAIT.WHEN.WHENEVER.WHERE.WHILE.WITH.WITHIN.WITHOUT.WRAPPED.WRAPPER.WRITE.WRKSTNNAME.XMLAGG.XMLATTRIBUTES.XMLCAST.XMLCOMMENT.XMLCONCAT.XMLDOCUMENT.XMLELEMENT.XMLFOREST.XMLGROUP.XMLNAMESPACES.XMLPARSE.XMLPI.XMLROW.XMLSERIALIZE.XMLTABLE.XMLTEXT.XMLVALIDATE.XSLTRANSFORM.XSROBJECT.YEAR.YEARS.YES.ZONE`.split(`.`),oY=`ARRAY.BIGINT.BINARY.BIT.BLOB.BOOLEAN.CCSID.CHAR.CHARACTER.CLOB.DATA.DATALINK.DATE.DBCLOB.DECFLOAT.DECIMAL.DEC.DOUBLE.DOUBLE PRECISION.FLOAT.GRAPHIC.INT.INTEGER.LONG.NUMERIC.REAL.ROWID.SMALLINT.TIME.TIMESTAMP.VARBINARY.VARCHAR.VARGRAPHIC.XML`.split(`.`),sY=Y([`SELECT [ALL | DISTINCT]`]),cY=Y([`WITH [RECURSIVE]`,`INTO`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`PARTITION BY`,`ORDER [SIBLINGS] BY [INPUT SEQUENCE]`,`LIMIT`,`OFFSET`,`FETCH {FIRST | NEXT}`,`FOR UPDATE [OF]`,`FOR READ ONLY`,`OPTIMIZE FOR`,`INSERT INTO`,`VALUES`,`SET`,`MERGE INTO`,`WHEN [NOT] MATCHED [THEN]`,`UPDATE SET`,`DELETE`,`INSERT`,`FOR SYSTEM NAME`]),lY=Y([`CREATE [OR REPLACE] TABLE`]),uY=Y(`CREATE [OR REPLACE] [RECURSIVE] VIEW.UPDATE.WHERE CURRENT OF.WITH {NC | RR | RS | CS | UR}.DELETE FROM.DROP TABLE.ALTER TABLE.ADD [COLUMN].ALTER [COLUMN].DROP [COLUMN].SET DATA TYPE.SET {GENERATED ALWAYS | GENERATED BY DEFAULT}.SET NOT NULL.SET {NOT HIDDEN | IMPLICITLY HIDDEN}.SET FIELDPROC.DROP {DEFAULT | NOT NULL | GENERATED | IDENTITY | ROW CHANGE TIMESTAMP | FIELDPROC}.TRUNCATE [TABLE].SET [CURRENT] SCHEMA.SET CURRENT_SCHEMA.ALLOCATE CURSOR.ALLOCATE [SQL] DESCRIPTOR [LOCAL | GLOBAL] SQL.ALTER [SPECIFIC] {FUNCTION | PROCEDURE}.ALTER {MASK | PERMISSION | SEQUENCE | TRIGGER}.ASSOCIATE [RESULT SET] {LOCATOR | LOCATORS}.BEGIN DECLARE SECTION.CALL.CLOSE.COMMENT ON {ALIAS | COLUMN | CONSTRAINT | INDEX | MASK | PACKAGE | PARAMETER | PERMISSION | SEQUENCE | TABLE | TRIGGER | VARIABLE | XSROBJECT}.COMMENT ON [SPECIFIC] {FUNCTION | PROCEDURE | ROUTINE}.COMMENT ON PARAMETER SPECIFIC {FUNCTION | PROCEDURE | ROUTINE}.COMMENT ON [TABLE FUNCTION] RETURN COLUMN.COMMENT ON [TABLE FUNCTION] RETURN COLUMN SPECIFIC [PROCEDURE | ROUTINE].COMMIT [WORK] [HOLD].CONNECT [TO | RESET] USER.CREATE [OR REPLACE] {ALIAS | FUNCTION | MASK | PERMISSION | PROCEDURE | SEQUENCE | TRIGGER | VARIABLE}.CREATE [ENCODED VECTOR] INDEX.CREATE UNIQUE [WHERE NOT NULL] INDEX.CREATE SCHEMA.CREATE TYPE.DEALLOCATE [SQL] DESCRIPTOR [LOCAL | GLOBAL].DECLARE CURSOR.DECLARE GLOBAL TEMPORARY TABLE.DECLARE.DESCRIBE CURSOR.DESCRIBE INPUT.DESCRIBE [OUTPUT].DESCRIBE {PROCEDURE | ROUTINE}.DESCRIBE TABLE.DISCONNECT ALL [SQL].DISCONNECT [CURRENT].DROP {ALIAS | INDEX | MASK | PACKAGE | PERMISSION | SCHEMA | SEQUENCE | TABLE | TYPE | VARIABLE | XSROBJECT} [IF EXISTS].DROP [SPECIFIC] {FUNCTION | PROCEDURE | ROUTINE} [IF EXISTS].END DECLARE SECTION.EXECUTE [IMMEDIATE].FREE LOCATOR.GET [SQL] DESCRIPTOR [LOCAL | GLOBAL].GET [CURRENT | STACKED] DIAGNOSTICS.GRANT {ALL [PRIVILEGES] | ALTER | EXECUTE} ON {FUNCTION | PROCEDURE | ROUTINE | PACKAGE | SCHEMA | SEQUENCE | TABLE | TYPE | VARIABLE | XSROBJECT}.HOLD LOCATOR.INCLUDE.LABEL ON {ALIAS | COLUMN | CONSTRAINT | INDEX | MASK | PACKAGE | PERMISSION | SEQUENCE | TABLE | TRIGGER | VARIABLE | XSROBJECT}.LABEL ON [SPECIFIC] {FUNCTION | PROCEDURE | ROUTINE}.LOCK TABLE.OPEN.PREPARE.REFRESH TABLE.RELEASE.RELEASE [TO] SAVEPOINT.RENAME [TABLE | INDEX] TO.REVOKE {ALL [PRIVILEGES] | ALTER | EXECUTE} ON {FUNCTION | PROCEDURE | ROUTINE | PACKAGE | SCHEMA | SEQUENCE | TABLE | TYPE | VARIABLE | XSROBJECT}.ROLLBACK [WORK] [HOLD | TO SAVEPOINT].SAVEPOINT.SET CONNECTION.SET CURRENT {DEBUG MODE | DECFLOAT ROUNDING MODE | DEGREE | IMPLICIT XMLPARSE OPTION | TEMPORAL SYSTEM_TIME}.SET [SQL] DESCRIPTOR [LOCAL | GLOBAL].SET ENCRYPTION PASSWORD.SET OPTION.SET {[CURRENT [FUNCTION]] PATH | CURRENT_PATH}.SET RESULT SETS [WITH RETURN [TO CALLER | TO CLIENT]].SET SESSION AUTHORIZATION.SET SESSION_USER.SET TRANSACTION.SIGNAL SQLSTATE [VALUE].TAG.TRANSFER OWNERSHIP OF.WHENEVER {NOT FOUND | SQLERROR | SQLWARNING}`.split(`.`)),dY=Y([`UNION [ALL]`,`EXCEPT [ALL]`,`INTERSECT [ALL]`]),fY=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`[LEFT | RIGHT] EXCEPTION JOIN`,`{INNER | CROSS} JOIN`]),pY=Y([`ON DELETE`,`ON UPDATE`,`SET NULL`,`{ROWS | RANGE} BETWEEN`]),mY=Y([]),hY={name:`db2i`,tokenizerOptions:{reservedSelect:sY,reservedClauses:[...cY,...lY,...uY],reservedSetOperations:dY,reservedJoins:fY,reservedKeywordPhrases:pY,reservedDataTypePhrases:mY,reservedKeywords:aY,reservedDataTypes:oY,reservedFunctionNames:iY,nestedBlockComments:!0,extraParens:[`[]`],stringTypes:[{quote:`''-qq`,prefixes:[`G`,`N`]},{quote:`''-raw`,prefixes:[`X`,`BX`,`GX`,`UX`],requirePrefix:!0}],identTypes:[`""-qq`],identChars:{first:`@#$`,rest:`@#$`},paramTypes:{positional:!0,named:[`:`]},paramChars:{first:`@#$`,rest:`@#$`},operators:[`**`,`¬=`,`¬>`,`¬<`,`!>`,`!<`,`||`,`=>`]},formatOptions:{onelineClauses:[...lY,...uY],tabularOnelineClauses:uY}},gY=`ABS.ACOS.ADD.ADD_PARQUET_KEY.AGE.AGGREGATE.ALIAS.ALL_PROFILING_OUTPUT.ANY_VALUE.APPLY.APPROX_COUNT_DISTINCT.APPROX_QUANTILE.ARBITRARY.ARGMAX.ARGMIN.ARG_MAX.ARG_MAX_NULL.ARG_MIN.ARG_MIN_NULL.ARRAY_AGG.ARRAY_AGGR.ARRAY_AGGREGATE.ARRAY_APPEND.ARRAY_APPLY.ARRAY_CAT.ARRAY_CONCAT.ARRAY_CONTAINS.ARRAY_COSINE_SIMILARITY.ARRAY_CROSS_PRODUCT.ARRAY_DISTANCE.ARRAY_DISTINCT.ARRAY_DOT_PRODUCT.ARRAY_EXTRACT.ARRAY_FILTER.ARRAY_GRADE_UP.ARRAY_HAS.ARRAY_HAS_ALL.ARRAY_HAS_ANY.ARRAY_INDEXOF.ARRAY_INNER_PRODUCT.ARRAY_INTERSECT.ARRAY_LENGTH.ARRAY_POP_BACK.ARRAY_POP_FRONT.ARRAY_POSITION.ARRAY_PREPEND.ARRAY_PUSH_BACK.ARRAY_PUSH_FRONT.ARRAY_REDUCE.ARRAY_RESIZE.ARRAY_REVERSE.ARRAY_REVERSE_SORT.ARRAY_SELECT.ARRAY_SLICE.ARRAY_SORT.ARRAY_TO_JSON.ARRAY_TO_STRING.ARRAY_TRANSFORM.ARRAY_UNIQUE.ARRAY_VALUE.ARRAY_WHERE.ARRAY_ZIP.ARROW_SCAN.ARROW_SCAN_DUMB.ASCII.ASIN.ATAN.ATAN2.AVG.BASE64.BIN.BITSTRING.BITSTRING_AGG.BIT_AND.BIT_COUNT.BIT_LENGTH.BIT_OR.BIT_POSITION.BIT_XOR.BOOL_AND.BOOL_OR.CARDINALITY.CBRT.CEIL.CEILING.CENTURY.CHECKPOINT.CHR.COLLATIONS.COL_DESCRIPTION.COMBINE.CONCAT.CONCAT_WS.CONSTANT_OR_NULL.CONTAINS.COPY_DATABASE.CORR.COS.COT.COUNT.COUNT_IF.COUNT_STAR.COVAR_POP.COVAR_SAMP.CREATE_SORT_KEY.CURRENT_CATALOG.CURRENT_DATABASE.CURRENT_DATE.CURRENT_LOCALTIME.CURRENT_LOCALTIMESTAMP.CURRENT_QUERY.CURRENT_ROLE.CURRENT_SCHEMA.CURRENT_SCHEMAS.CURRENT_SETTING.CURRENT_USER.CURRVAL.DAMERAU_LEVENSHTEIN.DATABASE_LIST.DATABASE_SIZE.DATEDIFF.DATEPART.DATESUB.DATETRUNC.DATE_ADD.DATE_DIFF.DATE_PART.DATE_SUB.DATE_TRUNC.DAY.DAYNAME.DAYOFMONTH.DAYOFWEEK.DAYOFYEAR.DECADE.DECODE.DEGREES.DISABLE_CHECKPOINT_ON_SHUTDOWN.DISABLE_OBJECT_CACHE.DISABLE_OPTIMIZER.DISABLE_PRINT_PROGRESS_BAR.DISABLE_PROFILE.DISABLE_PROFILING.DISABLE_PROGRESS_BAR.DISABLE_VERIFICATION.DISABLE_VERIFY_EXTERNAL.DISABLE_VERIFY_FETCH_ROW.DISABLE_VERIFY_PARALLELISM.DISABLE_VERIFY_SERIALIZER.DIVIDE.DUCKDB_COLUMNS.DUCKDB_CONSTRAINTS.DUCKDB_DATABASES.DUCKDB_DEPENDENCIES.DUCKDB_EXTENSIONS.DUCKDB_FUNCTIONS.DUCKDB_INDEXES.DUCKDB_KEYWORDS.DUCKDB_MEMORY.DUCKDB_OPTIMIZERS.DUCKDB_SCHEMAS.DUCKDB_SECRETS.DUCKDB_SEQUENCES.DUCKDB_SETTINGS.DUCKDB_TABLES.DUCKDB_TEMPORARY_FILES.DUCKDB_TYPES.DUCKDB_VIEWS.EDIT.EDITDIST3.ELEMENT_AT.ENABLE_CHECKPOINT_ON_SHUTDOWN.ENABLE_OBJECT_CACHE.ENABLE_OPTIMIZER.ENABLE_PRINT_PROGRESS_BAR.ENABLE_PROFILE.ENABLE_PROFILING.ENABLE_PROGRESS_BAR.ENABLE_VERIFICATION.ENCODE.ENDS_WITH.ENTROPY.ENUM_CODE.ENUM_FIRST.ENUM_LAST.ENUM_RANGE.ENUM_RANGE_BOUNDARY.EPOCH.EPOCH_MS.EPOCH_NS.EPOCH_US.ERA.ERROR.EVEN.EXP.FACTORIAL.FAVG.FDIV.FILTER.FINALIZE.FIRST.FLATTEN.FLOOR.FMOD.FORCE_CHECKPOINT.FORMAT.FORMATREADABLEDECIMALSIZE.FORMATREADABLESIZE.FORMAT_BYTES.FORMAT_PG_TYPE.FORMAT_TYPE.FROM_BASE64.FROM_BINARY.FROM_HEX.FROM_JSON.FROM_JSON_STRICT.FSUM.FUNCTIONS.GAMMA.GCD.GENERATE_SERIES.GENERATE_SUBSCRIPTS.GEN_RANDOM_UUID.GEOMEAN.GEOMETRIC_MEAN.GETENV.GET_BIT.GET_BLOCK_SIZE.GET_CURRENT_TIME.GET_CURRENT_TIMESTAMP.GLOB.GRADE_UP.GREATEST.GREATEST_COMMON_DIVISOR.GROUP_CONCAT.HAMMING.HASH.HAS_ANY_COLUMN_PRIVILEGE.HAS_COLUMN_PRIVILEGE.HAS_DATABASE_PRIVILEGE.HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE.HAS_FUNCTION_PRIVILEGE.HAS_LANGUAGE_PRIVILEGE.HAS_SCHEMA_PRIVILEGE.HAS_SEQUENCE_PRIVILEGE.HAS_SERVER_PRIVILEGE.HAS_TABLESPACE_PRIVILEGE.HAS_TABLE_PRIVILEGE.HEX.HISTOGRAM.HOUR.ICU_CALENDAR_NAMES.ICU_SORT_KEY.ILIKE_ESCAPE.IMPORT_DATABASE.INDEX_SCAN.INET_CLIENT_ADDR.INET_CLIENT_PORT.INET_SERVER_ADDR.INET_SERVER_PORT.INSTR.IN_SEARCH_PATH.ISFINITE.ISINF.ISNAN.ISODOW.ISOYEAR.JACCARD.JARO_SIMILARITY.JARO_WINKLER_SIMILARITY.JSON_ARRAY.JSON_ARRAY_LENGTH.JSON_CONTAINS.JSON_DESERIALIZE_SQL.JSON_EXECUTE_SERIALIZED_SQL.JSON_EXTRACT.JSON_EXTRACT_PATH.JSON_EXTRACT_PATH_TEXT.JSON_EXTRACT_STRING.JSON_GROUP_ARRAY.JSON_GROUP_OBJECT.JSON_GROUP_STRUCTURE.JSON_KEYS.JSON_MERGE_PATCH.JSON_OBJECT.JSON_QUOTE.JSON_SERIALIZE_PLAN.JSON_SERIALIZE_SQL.JSON_STRUCTURE.JSON_TRANSFORM.JSON_TRANSFORM_STRICT.JSON_TYPE.JSON_VALID.JULIAN.KAHAN_SUM.KURTOSIS.KURTOSIS_POP.LAST.LAST_DAY.LCASE.LCM.LEAST.LEAST_COMMON_MULTIPLE.LEFT.LEFT_GRAPHEME.LEN.LENGTH.LENGTH_GRAPHEME.LEVENSHTEIN.LGAMMA.LIKE_ESCAPE.LIST.LISTAGG.LIST_AGGR.LIST_AGGREGATE.LIST_ANY_VALUE.LIST_APPEND.LIST_APPLY.LIST_APPROX_COUNT_DISTINCT.LIST_AVG.LIST_BIT_AND.LIST_BIT_OR.LIST_BIT_XOR.LIST_BOOL_AND.LIST_BOOL_OR.LIST_CAT.LIST_CONCAT.LIST_CONTAINS.LIST_COSINE_SIMILARITY.LIST_COUNT.LIST_DISTANCE.LIST_DISTINCT.LIST_DOT_PRODUCT.LIST_ELEMENT.LIST_ENTROPY.LIST_EXTRACT.LIST_FILTER.LIST_FIRST.LIST_GRADE_UP.LIST_HAS.LIST_HAS_ALL.LIST_HAS_ANY.LIST_HISTOGRAM.LIST_INDEXOF.LIST_INNER_PRODUCT.LIST_INTERSECT.LIST_KURTOSIS.LIST_KURTOSIS_POP.LIST_LAST.LIST_MAD.LIST_MAX.LIST_MEDIAN.LIST_MIN.LIST_MODE.LIST_PACK.LIST_POSITION.LIST_PREPEND.LIST_PRODUCT.LIST_REDUCE.LIST_RESIZE.LIST_REVERSE.LIST_REVERSE_SORT.LIST_SELECT.LIST_SEM.LIST_SKEWNESS.LIST_SLICE.LIST_SORT.LIST_STDDEV_POP.LIST_STDDEV_SAMP.LIST_STRING_AGG.LIST_SUM.LIST_TRANSFORM.LIST_UNIQUE.LIST_VALUE.LIST_VAR_POP.LIST_VAR_SAMP.LIST_WHERE.LIST_ZIP.LN.LOG.LOG10.LOG2.LOWER.LPAD.LSMODE.LTRIM.MAD.MAKE_DATE.MAKE_TIME.MAKE_TIMESTAMP.MAKE_TIMESTAMPTZ.MAP.MAP_CONCAT.MAP_ENTRIES.MAP_EXTRACT.MAP_FROM_ENTRIES.MAP_KEYS.MAP_VALUES.MAX.MAX_BY.MD5.MD5_NUMBER.MD5_NUMBER_LOWER.MD5_NUMBER_UPPER.MEAN.MEDIAN.METADATA_INFO.MICROSECOND.MILLENNIUM.MILLISECOND.MIN.MINUTE.MIN_BY.MISMATCHES.MOD.MODE.MONTH.MONTHNAME.MULTIPLY.NEXTAFTER.NEXTVAL.NFC_NORMALIZE.NOT_ILIKE_ESCAPE.NOT_LIKE_ESCAPE.NOW.NULLIF.OBJ_DESCRIPTION.OCTET_LENGTH.ORD.PARQUET_FILE_METADATA.PARQUET_KV_METADATA.PARQUET_METADATA.PARQUET_SCAN.PARQUET_SCHEMA.PARSE_DIRNAME.PARSE_DIRPATH.PARSE_FILENAME.PARSE_PATH.PG_COLLATION_IS_VISIBLE.PG_CONF_LOAD_TIME.PG_CONVERSION_IS_VISIBLE.PG_FUNCTION_IS_VISIBLE.PG_GET_CONSTRAINTDEF.PG_GET_EXPR.PG_GET_VIEWDEF.PG_HAS_ROLE.PG_IS_OTHER_TEMP_SCHEMA.PG_MY_TEMP_SCHEMA.PG_OPCLASS_IS_VISIBLE.PG_OPERATOR_IS_VISIBLE.PG_OPFAMILY_IS_VISIBLE.PG_POSTMASTER_START_TIME.PG_SIZE_PRETTY.PG_TABLE_IS_VISIBLE.PG_TIMEZONE_NAMES.PG_TS_CONFIG_IS_VISIBLE.PG_TS_DICT_IS_VISIBLE.PG_TS_PARSER_IS_VISIBLE.PG_TS_TEMPLATE_IS_VISIBLE.PG_TYPEOF.PG_TYPE_IS_VISIBLE.PI.PLATFORM.POSITION.POW.POWER.PRAGMA_COLLATIONS.PRAGMA_DATABASE_SIZE.PRAGMA_METADATA_INFO.PRAGMA_PLATFORM.PRAGMA_SHOW.PRAGMA_STORAGE_INFO.PRAGMA_TABLE_INFO.PRAGMA_USER_AGENT.PRAGMA_VERSION.PREFIX.PRINTF.PRODUCT.QUANTILE.QUANTILE_CONT.QUANTILE_DISC.QUARTER.RADIANS.RANDOM.RANGE.READFILE.READ_BLOB.READ_CSV.READ_CSV_AUTO.READ_JSON.READ_JSON_AUTO.READ_JSON_OBJECTS.READ_JSON_OBJECTS_AUTO.READ_NDJSON.READ_NDJSON_AUTO.READ_NDJSON_OBJECTS.READ_PARQUET.READ_TEXT.REDUCE.REGEXP_ESCAPE.REGEXP_EXTRACT.REGEXP_EXTRACT_ALL.REGEXP_FULL_MATCH.REGEXP_MATCHES.REGEXP_REPLACE.REGEXP_SPLIT_TO_ARRAY.REGEXP_SPLIT_TO_TABLE.REGR_AVGX.REGR_AVGY.REGR_COUNT.REGR_INTERCEPT.REGR_R2.REGR_SLOPE.REGR_SXX.REGR_SXY.REGR_SYY.REPEAT.REPEAT_ROW.REPLACE.RESERVOIR_QUANTILE.REVERSE.RIGHT.RIGHT_GRAPHEME.ROUND.ROUNDBANKERS.ROUND_EVEN.ROW.ROW_TO_JSON.RPAD.RTRIM.SECOND.SEM.SEQ_SCAN.SESSION_USER.SETSEED.SET_BIT.SHA256.SHA3.SHELL_ADD_SCHEMA.SHELL_ESCAPE_CRNL.SHELL_IDQUOTE.SHELL_MODULE_SCHEMA.SHELL_PUTSNL.SHOBJ_DESCRIPTION.SHOW.SHOW_DATABASES.SHOW_TABLES.SHOW_TABLES_EXPANDED.SIGN.SIGNBIT.SIN.SKEWNESS.SNIFF_CSV.SPLIT.SPLIT_PART.SQL_AUTO_COMPLETE.SQRT.STARTS_WITH.STATS.STDDEV.STDDEV_POP.STDDEV_SAMP.STORAGE_INFO.STRFTIME.STRING_AGG.STRING_SPLIT.STRING_SPLIT_REGEX.STRING_TO_ARRAY.STRIP_ACCENTS.STRLEN.STRPOS.STRPTIME.STRUCT_EXTRACT.STRUCT_INSERT.STRUCT_PACK.STR_SPLIT.STR_SPLIT_REGEX.SUBSTR.SUBSTRING.SUBSTRING_GRAPHEME.SUBTRACT.SUFFIX.SUM.SUMKAHAN.SUMMARY.SUM_NO_OVERFLOW.TABLE_INFO.TAN.TEST_ALL_TYPES.TEST_VECTOR_TYPES.TIMEZONE.TIMEZONE_HOUR.TIMEZONE_MINUTE.TIME_BUCKET.TODAY.TO_BASE.TO_BASE64.TO_BINARY.TO_CENTURIES.TO_DAYS.TO_DECADES.TO_HEX.TO_HOURS.TO_JSON.TO_MICROSECONDS.TO_MILLENNIA.TO_MILLISECONDS.TO_MINUTES.TO_MONTHS.TO_SECONDS.TO_TIMESTAMP.TO_WEEKS.TO_YEARS.TRANSACTION_TIMESTAMP.TRANSLATE.TRIM.TRUNC.TRY_STRPTIME.TXID_CURRENT.TYPEOF.UCASE.UNBIN.UNHEX.UNICODE.UNION_EXTRACT.UNION_TAG.UNION_VALUE.UNNEST.UNPIVOT_LIST.UPPER.USER.USER_AGENT.UUID.VARIANCE.VAR_POP.VAR_SAMP.VECTOR_TYPE.VERIFY_EXTERNAL.VERIFY_FETCH_ROW.VERIFY_PARALLELISM.VERIFY_SERIALIZER.VERSION.WEEK.WEEKDAY.WEEKOFYEAR.WHICH_SECRET.WRITEFILE.XOR.YEAR.YEARWEEK.CAST.COALESCE.RANK.ROW_NUMBER`.split(`.`),_Y=`ALL.ANALYSE.ANALYZE.AND.ANY.AS.ASC.ATTACH.ASYMMETRIC.BOTH.CASE.CAST.CHECK.COLLATE.COLUMN.CONSTRAINT.CREATE.DEFAULT.DEFERRABLE.DESC.DESCRIBE.DETACH.DISTINCT.DO.ELSE.END.EXCEPT.FALSE.FETCH.FOR.FOREIGN.FROM.GRANT.GROUP.HAVING.IN.INITIALLY.INTERSECT.INTO.IS.LATERAL.LEADING.LIMIT.NOT.NULL.OFFSET.ON.ONLY.OR.ORDER.PIVOT.PIVOT_LONGER.PIVOT_WIDER.PLACING.PRIMARY.REFERENCES.RETURNING.SELECT.SHOW.SOME.SUMMARIZE.SYMMETRIC.TABLE.THEN.TO.TRAILING.TRUE.UNION.UNIQUE.UNPIVOT.USING.VARIADIC.WHEN.WHERE.WINDOW.WITH`.split(`.`),vY=`ARRAY.BIGINT.BINARY.BIT.BITSTRING.BLOB.BOOL.BOOLEAN.BPCHAR.BYTEA.CHAR.DATE.DATETIME.DEC.DECIMAL.DOUBLE.ENUM.FLOAT.FLOAT4.FLOAT8.GUID.HUGEINT.INET.INT.INT1.INT128.INT16.INT2.INT32.INT4.INT64.INT8.INTEGER.INTEGRAL.INTERVAL.JSON.LIST.LOGICAL.LONG.MAP.NUMERIC.NVARCHAR.OID.REAL.ROW.SHORT.SIGNED.SMALLINT.STRING.STRUCT.TEXT.TIME.TIMESTAMP_MS.TIMESTAMP_NS.TIMESTAMP_S.TIMESTAMP_US.TIMESTAMP.TIMESTAMPTZ.TIMETZ.TINYINT.UBIGINT.UHUGEINT.UINT128.UINT16.UINT32.UINT64.UINT8.UINTEGER.UNION.USMALLINT.UTINYINT.UUID.VARBINARY.VARCHAR`.split(`.`),yY=Y([`SELECT [ALL | DISTINCT]`]),bY=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY [ALL]`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY [ALL]`,`LIMIT`,`OFFSET`,`USING SAMPLE`,`QUALIFY`,`INSERT [OR REPLACE] INTO`,`VALUES`,`DEFAULT VALUES`,`SET`,`RETURNING`]),xY=Y([`CREATE [OR REPLACE] [TEMPORARY | TEMP] TABLE [IF NOT EXISTS]`]),SY=Y(`UPDATE.ON CONFLICT.DELETE FROM.DROP TABLE [IF EXISTS].TRUNCATE.ALTER TABLE.ADD [COLUMN] [IF NOT EXISTS].ADD PRIMARY KEY.DROP [COLUMN] [IF EXISTS].ALTER [COLUMN].RENAME [COLUMN].RENAME TO.SET [DATA] TYPE.{SET | DROP} DEFAULT.{SET | DROP} NOT NULL.CREATE [OR REPLACE] [TEMPORARY | TEMP] {MACRO | FUNCTION}.DROP MACRO [TABLE] [IF EXISTS].DROP FUNCTION [IF EXISTS].CREATE [UNIQUE] INDEX [IF NOT EXISTS].DROP INDEX [IF EXISTS].CREATE [OR REPLACE] SCHEMA [IF NOT EXISTS].DROP SCHEMA [IF EXISTS].CREATE [OR REPLACE] [PERSISTENT | TEMPORARY] SECRET [IF NOT EXISTS].DROP [PERSISTENT | TEMPORARY] SECRET [IF EXISTS].CREATE [OR REPLACE] [TEMPORARY | TEMP] SEQUENCE.DROP SEQUENCE [IF EXISTS].CREATE [OR REPLACE] [TEMPORARY | TEMP] VIEW [IF NOT EXISTS].DROP VIEW [IF EXISTS].ALTER VIEW.CREATE TYPE.DROP TYPE [IF EXISTS].ANALYZE.ATTACH [DATABASE] [IF NOT EXISTS].DETACH [DATABASE] [IF EXISTS].CALL.[FORCE] CHECKPOINT.COMMENT ON [TABLE | COLUMN | VIEW | INDEX | SEQUENCE | TYPE | MACRO | MACRO TABLE].COPY [FROM DATABASE].DESCRIBE.EXPORT DATABASE.IMPORT DATABASE.INSTALL.LOAD.PIVOT.PIVOT_WIDER.UNPIVOT.EXPLAIN [ANALYZE].SET {LOCAL | SESSION | GLOBAL}.RESET [LOCAL | SESSION | GLOBAL].{SET | RESET} VARIABLE.SUMMARIZE.BEGIN TRANSACTION.ROLLBACK.COMMIT.ABORT.USE.VACUUM [ANALYZE].PREPARE.EXECUTE.DEALLOCATE [PREPARE]`.split(`.`)),CY=Y([`UNION [ALL | BY NAME]`,`EXCEPT [ALL]`,`INTERSECT [ALL]`]),wY=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`{NATURAL | ASOF} [INNER] JOIN`,`{NATURAL | ASOF} {LEFT | RIGHT | FULL} [OUTER] JOIN`,`POSITIONAL JOIN`,`ANTI JOIN`,`SEMI JOIN`]),TY=Y([`{ROWS | RANGE | GROUPS} BETWEEN`,`SIMILAR TO`,`IS [NOT] DISTINCT FROM`]),EY=Y([`TIMESTAMP WITH TIME ZONE`]),DY={name:`duckdb`,tokenizerOptions:{reservedSelect:yY,reservedClauses:[...bY,...xY,...SY],reservedSetOperations:CY,reservedJoins:wY,reservedKeywordPhrases:TY,reservedDataTypePhrases:EY,supportsXor:!0,reservedKeywords:_Y,reservedDataTypes:vY,reservedFunctionNames:gY,nestedBlockComments:!0,extraParens:[`[]`,`{}`],underscoresInNumbers:!0,stringTypes:[`$$`,`''-qq`,{quote:`''-qq-bs`,prefixes:[`E`],requirePrefix:!0},{quote:`''-raw`,prefixes:[`B`,`X`],requirePrefix:!0}],identTypes:[`""-qq`],identChars:{rest:`$`},paramTypes:{positional:!0,numbered:[`$`],quoted:[`$`]},operators:`//.%.**.^.!.&.|.~.<<.>>.::.==.->.->>.:.:=.=>.~~.!~~.~~*.!~~*.~~~.~.!~.~*.!~*.^@.||.>>=.<<=`.split(`.`)},formatOptions:{alwaysDenseOperators:[`::`],onelineClauses:[...xY,...SY],tabularOnelineClauses:SY}},OY=`ABS.ACOS.ASIN.ATAN.BIN.BROUND.CBRT.CEIL.CEILING.CONV.COS.DEGREES.EXP.FACTORIAL.FLOOR.GREATEST.HEX.LEAST.LN.LOG.LOG10.LOG2.NEGATIVE.PI.PMOD.POSITIVE.POW.POWER.RADIANS.RAND.ROUND.SHIFTLEFT.SHIFTRIGHT.SHIFTRIGHTUNSIGNED.SIGN.SIN.SQRT.TAN.UNHEX.WIDTH_BUCKET.ARRAY_CONTAINS.MAP_KEYS.MAP_VALUES.SIZE.SORT_ARRAY.BINARY.CAST.ADD_MONTHS.DATE.DATE_ADD.DATE_FORMAT.DATE_SUB.DATEDIFF.DAY.DAYNAME.DAYOFMONTH.DAYOFYEAR.EXTRACT.FROM_UNIXTIME.FROM_UTC_TIMESTAMP.HOUR.LAST_DAY.MINUTE.MONTH.MONTHS_BETWEEN.NEXT_DAY.QUARTER.SECOND.TIMESTAMP.TO_DATE.TO_UTC_TIMESTAMP.TRUNC.UNIX_TIMESTAMP.WEEKOFYEAR.YEAR.ASSERT_TRUE.COALESCE.IF.ISNOTNULL.ISNULL.NULLIF.NVL.ASCII.BASE64.CHARACTER_LENGTH.CHR.CONCAT.CONCAT_WS.CONTEXT_NGRAMS.DECODE.ELT.ENCODE.FIELD.FIND_IN_SET.FORMAT_NUMBER.GET_JSON_OBJECT.IN_FILE.INITCAP.INSTR.LCASE.LENGTH.LEVENSHTEIN.LOCATE.LOWER.LPAD.LTRIM.NGRAMS.OCTET_LENGTH.PARSE_URL.PRINTF.QUOTE.REGEXP_EXTRACT.REGEXP_REPLACE.REPEAT.REVERSE.RPAD.RTRIM.SENTENCES.SOUNDEX.SPACE.SPLIT.STR_TO_MAP.SUBSTR.SUBSTRING.TRANSLATE.TRIM.UCASE.UNBASE64.UPPER.MASK.MASK_FIRST_N.MASK_HASH.MASK_LAST_N.MASK_SHOW_FIRST_N.MASK_SHOW_LAST_N.AES_DECRYPT.AES_ENCRYPT.CRC32.CURRENT_DATABASE.CURRENT_USER.HASH.JAVA_METHOD.LOGGED_IN_USER.MD5.REFLECT.SHA.SHA1.SHA2.SURROGATE_KEY.VERSION.AVG.COLLECT_LIST.COLLECT_SET.CORR.COUNT.COVAR_POP.COVAR_SAMP.HISTOGRAM_NUMERIC.MAX.MIN.NTILE.PERCENTILE.PERCENTILE_APPROX.REGR_AVGX.REGR_AVGY.REGR_COUNT.REGR_INTERCEPT.REGR_R2.REGR_SLOPE.REGR_SXX.REGR_SXY.REGR_SYY.STDDEV_POP.STDDEV_SAMP.SUM.VAR_POP.VAR_SAMP.VARIANCE.EXPLODE.INLINE.JSON_TUPLE.PARSE_URL_TUPLE.POSEXPLODE.STACK.LEAD.LAG.FIRST_VALUE.LAST_VALUE.RANK.ROW_NUMBER.DENSE_RANK.CUME_DIST.PERCENT_RANK.NTILE`.split(`.`),kY=`ADD.ADMIN.AFTER.ANALYZE.ARCHIVE.ASC.BEFORE.BUCKET.BUCKETS.CASCADE.CHANGE.CLUSTER.CLUSTERED.CLUSTERSTATUS.COLLECTION.COLUMNS.COMMENT.COMPACT.COMPACTIONS.COMPUTE.CONCATENATE.CONTINUE.DATA.DATABASES.DATETIME.DAY.DBPROPERTIES.DEFERRED.DEFINED.DELIMITED.DEPENDENCY.DESC.DIRECTORIES.DIRECTORY.DISABLE.DISTRIBUTE.ELEM_TYPE.ENABLE.ESCAPED.EXCLUSIVE.EXPLAIN.EXPORT.FIELDS.FILE.FILEFORMAT.FIRST.FORMAT.FORMATTED.FUNCTIONS.HOLD_DDLTIME.HOUR.IDXPROPERTIES.IGNORE.INDEX.INDEXES.INPATH.INPUTDRIVER.INPUTFORMAT.ITEMS.JAR.KEYS.KEY_TYPE.LIMIT.LINES.LOAD.LOCATION.LOCK.LOCKS.LOGICAL.LONG.MAPJOIN.MATERIALIZED.METADATA.MINUS.MINUTE.MONTH.MSCK.NOSCAN.NO_DROP.OFFLINE.OPTION.OUTPUTDRIVER.OUTPUTFORMAT.OVERWRITE.OWNER.PARTITIONED.PARTITIONS.PLUS.PRETTY.PRINCIPALS.PROTECTION.PURGE.READ.READONLY.REBUILD.RECORDREADER.RECORDWRITER.RELOAD.RENAME.REPAIR.REPLACE.REPLICATION.RESTRICT.REWRITE.ROLE.ROLES.SCHEMA.SCHEMAS.SECOND.SEMI.SERDE.SERDEPROPERTIES.SERVER.SETS.SHARED.SHOW.SHOW_DATABASE.SKEWED.SORT.SORTED.SSL.STATISTICS.STORED.STREAMTABLE.STRING.TABLES.TBLPROPERTIES.TEMPORARY.TERMINATED.TINYINT.TOUCH.TRANSACTIONS.UNARCHIVE.UNDO.UNIONTYPE.UNLOCK.UNSET.UNSIGNED.URI.USE.UTC.UTCTIMESTAMP.VALUE_TYPE.VIEW.WHILE.YEAR.AUTOCOMMIT.ISOLATION.LEVEL.OFFSET.SNAPSHOT.TRANSACTION.WORK.WRITE.ABORT.KEY.LAST.NORELY.NOVALIDATE.NULLS.RELY.VALIDATE.DETAIL.DOW.EXPRESSION.OPERATOR.QUARTER.SUMMARY.VECTORIZATION.WEEK.YEARS.MONTHS.WEEKS.DAYS.HOURS.MINUTES.SECONDS.TIMESTAMPTZ.ZONE.ALL.ALTER.AND.AS.AUTHORIZATION.BETWEEN.BOTH.BY.CASE.CAST.COLUMN.CONF.CREATE.CROSS.CUBE.CURRENT.CURRENT_DATE.CURRENT_TIMESTAMP.CURSOR.DATABASE.DELETE.DESCRIBE.DISTINCT.DROP.ELSE.END.EXCHANGE.EXISTS.EXTENDED.EXTERNAL.FALSE.FETCH.FOLLOWING.FOR.FROM.FULL.FUNCTION.GRANT.GROUP.GROUPING.HAVING.IF.IMPORT.IN.INNER.INSERT.INTERSECT.INTO.IS.JOIN.LATERAL.LEFT.LESS.LIKE.LOCAL.MACRO.MORE.NONE.NOT.NULL.OF.ON.OR.ORDER.OUT.OUTER.OVER.PARTIALSCAN.PARTITION.PERCENT.PRECEDING.PRESERVE.PROCEDURE.RANGE.READS.REDUCE.REVOKE.RIGHT.ROLLUP.ROW.ROWS.SELECT.SET.TABLE.TABLESAMPLE.THEN.TO.TRANSFORM.TRIGGER.TRUE.TRUNCATE.UNBOUNDED.UNION.UNIQUEJOIN.UPDATE.USER.USING.UTC_TMESTAMP.VALUES.WHEN.WHERE.WINDOW.WITH.COMMIT.ONLY.REGEXP.RLIKE.ROLLBACK.START.CACHE.CONSTRAINT.FOREIGN.PRIMARY.REFERENCES.DAYOFWEEK.EXTRACT.FLOOR.VIEWS.TIME.SYNC.TEXTFILE.SEQUENCEFILE.ORC.CSV.TSV.PARQUET.AVRO.RCFILE.JSONFILE.INPUTFORMAT.OUTPUTFORMAT`.split(`.`),AY=[`ARRAY`,`BIGINT`,`BINARY`,`BOOLEAN`,`CHAR`,`DATE`,`DECIMAL`,`DOUBLE`,`FLOAT`,`INT`,`INTEGER`,`INTERVAL`,`MAP`,`NUMERIC`,`PRECISION`,`SMALLINT`,`STRUCT`,`TIMESTAMP`,`VARCHAR`],jY=Y([`SELECT [ALL | DISTINCT]`]),MY=Y([`WITH`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`SORT BY`,`CLUSTER BY`,`DISTRIBUTE BY`,`LIMIT`,`INSERT INTO [TABLE]`,`VALUES`,`SET`,`MERGE INTO`,`WHEN [NOT] MATCHED [THEN]`,`UPDATE SET`,`INSERT [VALUES]`,`INSERT OVERWRITE [LOCAL] DIRECTORY`,`LOAD DATA [LOCAL] INPATH`,`[OVERWRITE] INTO TABLE`]),NY=Y([`CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS]`]),PY=Y([`CREATE [MATERIALIZED] VIEW [IF NOT EXISTS]`,`UPDATE`,`DELETE FROM`,`DROP TABLE [IF EXISTS]`,`ALTER TABLE`,`RENAME TO`,`TRUNCATE [TABLE]`,`ALTER`,`CREATE`,`USE`,`DESCRIBE`,`DROP`,`FETCH`,`SHOW`,`STORED AS`,`STORED BY`,`ROW FORMAT`]),FY=Y([`UNION [ALL | DISTINCT]`]),IY=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`LEFT SEMI JOIN`]),LY=Y([`{ROWS | RANGE} BETWEEN`]),RY=Y([]),zY={name:`hive`,tokenizerOptions:{reservedSelect:jY,reservedClauses:[...MY,...NY,...PY],reservedSetOperations:FY,reservedJoins:IY,reservedKeywordPhrases:LY,reservedDataTypePhrases:RY,reservedKeywords:kY,reservedDataTypes:AY,reservedFunctionNames:OY,extraParens:[`[]`],stringTypes:[`""-bs`,`''-bs`],identTypes:["``"],variableTypes:[{quote:`{}`,prefixes:[`$`],requirePrefix:!0}],operators:[`%`,`~`,`^`,`|`,`&`,`<=>`,`==`,`!`,`||`]},formatOptions:{onelineClauses:[...NY,...PY],tabularOnelineClauses:PY}};function BY(e){return e.map((t,n)=>{let r=e[n+1]||fJ;if(mJ.SET(t)&&r.text===`(`)return Object.assign(Object.assign({},t),{type:X.RESERVED_FUNCTION_NAME});let i=e[n-1]||fJ;return mJ.VALUES(t)&&i.text===`=`?Object.assign(Object.assign({},t),{type:X.RESERVED_FUNCTION_NAME}):t})}var VY=`ACCESSIBLE.ADD.ALL.ALTER.ANALYZE.AND.AS.ASC.ASENSITIVE.BEFORE.BETWEEN.BOTH.BY.CALL.CASCADE.CASE.CHANGE.CHECK.COLLATE.COLUMN.CONDITION.CONSTRAINT.CONTINUE.CONVERT.CREATE.CROSS.CURRENT_DATE.CURRENT_ROLE.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.CURSOR.DATABASE.DATABASES.DAY_HOUR.DAY_MICROSECOND.DAY_MINUTE.DAY_SECOND.DECLARE.DEFAULT.DELAYED.DELETE.DELETE_DOMAIN_ID.DESC.DESCRIBE.DETERMINISTIC.DISTINCT.DISTINCTROW.DIV.DO_DOMAIN_IDS.DROP.DUAL.EACH.ELSE.ELSEIF.ENCLOSED.ESCAPED.EXCEPT.EXISTS.EXIT.EXPLAIN.FALSE.FETCH.FOR.FORCE.FOREIGN.FROM.FULLTEXT.GENERAL.GRANT.GROUP.HAVING.HIGH_PRIORITY.HOUR_MICROSECOND.HOUR_MINUTE.HOUR_SECOND.IF.IGNORE.IGNORE_DOMAIN_IDS.IGNORE_SERVER_IDS.IN.INDEX.INFILE.INNER.INOUT.INSENSITIVE.INSERT.INTERSECT.INTERVAL.INTO.IS.ITERATE.JOIN.KEY.KEYS.KILL.LEADING.LEAVE.LEFT.LIKE.LIMIT.LINEAR.LINES.LOAD.LOCALTIME.LOCALTIMESTAMP.LOCK.LOOP.LOW_PRIORITY.MASTER_HEARTBEAT_PERIOD.MASTER_SSL_VERIFY_SERVER_CERT.MATCH.MAXVALUE.MINUTE_MICROSECOND.MINUTE_SECOND.MOD.MODIFIES.NATURAL.NOT.NO_WRITE_TO_BINLOG.NULL.OFFSET.ON.OPTIMIZE.OPTION.OPTIONALLY.OR.ORDER.OUT.OUTER.OUTFILE.OVER.PAGE_CHECKSUM.PARSE_VCOL_EXPR.PARTITION.POSITION.PRIMARY.PROCEDURE.PURGE.RANGE.READ.READS.READ_WRITE.RECURSIVE.REF_SYSTEM_ID.REFERENCES.REGEXP.RELEASE.RENAME.REPEAT.REPLACE.REQUIRE.RESIGNAL.RESTRICT.RETURN.RETURNING.REVOKE.RIGHT.RLIKE.ROW_NUMBER.ROWS.SCHEMA.SCHEMAS.SECOND_MICROSECOND.SELECT.SENSITIVE.SEPARATOR.SET.SHOW.SIGNAL.SLOW.SPATIAL.SPECIFIC.SQL.SQLEXCEPTION.SQLSTATE.SQLWARNING.SQL_BIG_RESULT.SQL_CALC_FOUND_ROWS.SQL_SMALL_RESULT.SSL.STARTING.STATS_AUTO_RECALC.STATS_PERSISTENT.STATS_SAMPLE_PAGES.STRAIGHT_JOIN.TABLE.TERMINATED.THEN.TO.TRAILING.TRIGGER.TRUE.UNDO.UNION.UNIQUE.UNLOCK.UNSIGNED.UPDATE.USAGE.USE.USING.UTC_DATE.UTC_TIME.UTC_TIMESTAMP.VALUES.WHEN.WHERE.WHILE.WINDOW.WITH.WRITE.XOR.YEAR_MONTH.ZEROFILL`.split(`.`),HY=`BIGINT.BINARY.BIT.BLOB.CHAR BYTE.CHAR.CHARACTER.DATETIME.DEC.DECIMAL.DOUBLE PRECISION.DOUBLE.ENUM.FIXED.FLOAT.FLOAT4.FLOAT8.INT.INT1.INT2.INT3.INT4.INT8.INTEGER.LONG.LONGBLOB.LONGTEXT.MEDIUMBLOB.MEDIUMINT.MEDIUMTEXT.MIDDLEINT.NATIONAL CHAR.NATIONAL VARCHAR.NUMERIC.PRECISION.REAL.SMALLINT.TEXT.TIMESTAMP.TINYBLOB.TINYINT.TINYTEXT.VARBINARY.VARCHAR.VARCHARACTER.VARYING.YEAR`.split(`.`),UY=`ADDDATE.ADD_MONTHS.BIT_AND.BIT_OR.BIT_XOR.CAST.COUNT.CUME_DIST.CURDATE.CURTIME.DATE_ADD.DATE_SUB.DATE_FORMAT.DECODE.DENSE_RANK.EXTRACT.FIRST_VALUE.GROUP_CONCAT.JSON_ARRAYAGG.JSON_OBJECTAGG.LAG.LEAD.MAX.MEDIAN.MID.MIN.NOW.NTH_VALUE.NTILE.POSITION.PERCENT_RANK.PERCENTILE_CONT.PERCENTILE_DISC.RANK.ROW_NUMBER.SESSION_USER.STD.STDDEV.STDDEV_POP.STDDEV_SAMP.SUBDATE.SUBSTR.SUBSTRING.SUM.SYSTEM_USER.TRIM.TRIM_ORACLE.VARIANCE.VAR_POP.VAR_SAMP.ABS.ACOS.ADDTIME.AES_DECRYPT.AES_ENCRYPT.ASIN.ATAN.ATAN2.BENCHMARK.BIN.BINLOG_GTID_POS.BIT_COUNT.BIT_LENGTH.CEIL.CEILING.CHARACTER_LENGTH.CHAR_LENGTH.CHR.COERCIBILITY.COLUMN_CHECK.COLUMN_EXISTS.COLUMN_LIST.COLUMN_JSON.COMPRESS.CONCAT.CONCAT_OPERATOR_ORACLE.CONCAT_WS.CONNECTION_ID.CONV.CONVERT_TZ.COS.COT.CRC32.DATEDIFF.DAYNAME.DAYOFMONTH.DAYOFWEEK.DAYOFYEAR.DEGREES.DECODE_HISTOGRAM.DECODE_ORACLE.DES_DECRYPT.DES_ENCRYPT.ELT.ENCODE.ENCRYPT.EXP.EXPORT_SET.EXTRACTVALUE.FIELD.FIND_IN_SET.FLOOR.FORMAT.FOUND_ROWS.FROM_BASE64.FROM_DAYS.FROM_UNIXTIME.GET_LOCK.GREATEST.HEX.IFNULL.INSTR.ISNULL.IS_FREE_LOCK.IS_USED_LOCK.JSON_ARRAY.JSON_ARRAY_APPEND.JSON_ARRAY_INSERT.JSON_COMPACT.JSON_CONTAINS.JSON_CONTAINS_PATH.JSON_DEPTH.JSON_DETAILED.JSON_EXISTS.JSON_EXTRACT.JSON_INSERT.JSON_KEYS.JSON_LENGTH.JSON_LOOSE.JSON_MERGE.JSON_MERGE_PATCH.JSON_MERGE_PRESERVE.JSON_QUERY.JSON_QUOTE.JSON_OBJECT.JSON_REMOVE.JSON_REPLACE.JSON_SET.JSON_SEARCH.JSON_TYPE.JSON_UNQUOTE.JSON_VALID.JSON_VALUE.LAST_DAY.LAST_INSERT_ID.LCASE.LEAST.LENGTH.LENGTHB.LN.LOAD_FILE.LOCATE.LOG.LOG10.LOG2.LOWER.LPAD.LPAD_ORACLE.LTRIM.LTRIM_ORACLE.MAKEDATE.MAKETIME.MAKE_SET.MASTER_GTID_WAIT.MASTER_POS_WAIT.MD5.MONTHNAME.NAME_CONST.NVL.NVL2.OCT.OCTET_LENGTH.ORD.PERIOD_ADD.PERIOD_DIFF.PI.POW.POWER.QUOTE.REGEXP_INSTR.REGEXP_REPLACE.REGEXP_SUBSTR.RADIANS.RAND.RELEASE_ALL_LOCKS.RELEASE_LOCK.REPLACE_ORACLE.REVERSE.ROUND.RPAD.RPAD_ORACLE.RTRIM.RTRIM_ORACLE.SEC_TO_TIME.SHA.SHA1.SHA2.SIGN.SIN.SLEEP.SOUNDEX.SPACE.SQRT.STRCMP.STR_TO_DATE.SUBSTR_ORACLE.SUBSTRING_INDEX.SUBTIME.SYS_GUID.TAN.TIMEDIFF.TIME_FORMAT.TIME_TO_SEC.TO_BASE64.TO_CHAR.TO_DAYS.TO_SECONDS.UCASE.UNCOMPRESS.UNCOMPRESSED_LENGTH.UNHEX.UNIX_TIMESTAMP.UPDATEXML.UPPER.UUID.UUID_SHORT.VERSION.WEEKDAY.WEEKOFYEAR.WSREP_LAST_WRITTEN_GTID.WSREP_LAST_SEEN_GTID.WSREP_SYNC_WAIT_UPTO_GTID.YEARWEEK.COALESCE.NULLIF`.split(`.`),WY=Y([`SELECT [ALL | DISTINCT | DISTINCTROW]`]),GY=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`FETCH {FIRST | NEXT}`,`INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO]`,`REPLACE [LOW_PRIORITY | DELAYED] [INTO]`,`VALUES`,`ON DUPLICATE KEY UPDATE`,`SET`,`RETURNING`]),KY=Y([`CREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]`]),qY=Y(`CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS].UPDATE [LOW_PRIORITY] [IGNORE].DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM.DROP [TEMPORARY] TABLE [IF EXISTS].ALTER [ONLINE] [IGNORE] TABLE [IF EXISTS].ADD [COLUMN] [IF NOT EXISTS].{CHANGE | MODIFY} [COLUMN] [IF EXISTS].DROP [COLUMN] [IF EXISTS].RENAME [TO].RENAME COLUMN.ALTER [COLUMN].{SET | DROP} DEFAULT.SET {VISIBLE | INVISIBLE}.TRUNCATE [TABLE].ALTER DATABASE.ALTER DATABASE COMMENT.ALTER EVENT.ALTER FUNCTION.ALTER PROCEDURE.ALTER SCHEMA.ALTER SCHEMA COMMENT.ALTER SEQUENCE.ALTER SERVER.ALTER USER.ALTER VIEW.ANALYZE.ANALYZE TABLE.BACKUP LOCK.BACKUP STAGE.BACKUP UNLOCK.BEGIN.BINLOG.CACHE INDEX.CALL.CHANGE MASTER TO.CHECK TABLE.CHECK VIEW.CHECKSUM TABLE.COMMIT.CREATE AGGREGATE FUNCTION.CREATE DATABASE.CREATE EVENT.CREATE FUNCTION.CREATE INDEX.CREATE PROCEDURE.CREATE ROLE.CREATE SEQUENCE.CREATE SERVER.CREATE SPATIAL INDEX.CREATE TRIGGER.CREATE UNIQUE INDEX.CREATE USER.DEALLOCATE PREPARE.DESCRIBE.DROP DATABASE.DROP EVENT.DROP FUNCTION.DROP INDEX.DROP PREPARE.DROP PROCEDURE.DROP ROLE.DROP SEQUENCE.DROP SERVER.DROP TRIGGER.DROP USER.DROP VIEW.EXECUTE.EXPLAIN.FLUSH.GET DIAGNOSTICS.GET DIAGNOSTICS CONDITION.GRANT.HANDLER.HELP.INSTALL PLUGIN.INSTALL SONAME.KILL.LOAD DATA INFILE.LOAD INDEX INTO CACHE.LOAD XML INFILE.LOCK TABLE.OPTIMIZE TABLE.PREPARE.PURGE BINARY LOGS.PURGE MASTER LOGS.RELEASE SAVEPOINT.RENAME TABLE.RENAME USER.REPAIR TABLE.REPAIR VIEW.RESET MASTER.RESET QUERY CACHE.RESET REPLICA.RESET SLAVE.RESIGNAL.REVOKE.ROLLBACK.SAVEPOINT.SET CHARACTER SET.SET DEFAULT ROLE.SET GLOBAL TRANSACTION.SET NAMES.SET PASSWORD.SET ROLE.SET STATEMENT.SET TRANSACTION.SHOW.SHOW ALL REPLICAS STATUS.SHOW ALL SLAVES STATUS.SHOW AUTHORS.SHOW BINARY LOGS.SHOW BINLOG EVENTS.SHOW BINLOG STATUS.SHOW CHARACTER SET.SHOW CLIENT_STATISTICS.SHOW COLLATION.SHOW COLUMNS.SHOW CONTRIBUTORS.SHOW CREATE DATABASE.SHOW CREATE EVENT.SHOW CREATE FUNCTION.SHOW CREATE PACKAGE.SHOW CREATE PACKAGE BODY.SHOW CREATE PROCEDURE.SHOW CREATE SEQUENCE.SHOW CREATE TABLE.SHOW CREATE TRIGGER.SHOW CREATE USER.SHOW CREATE VIEW.SHOW DATABASES.SHOW ENGINE.SHOW ENGINE INNODB STATUS.SHOW ENGINES.SHOW ERRORS.SHOW EVENTS.SHOW EXPLAIN.SHOW FUNCTION CODE.SHOW FUNCTION STATUS.SHOW GRANTS.SHOW INDEX.SHOW INDEXES.SHOW INDEX_STATISTICS.SHOW KEYS.SHOW LOCALES.SHOW MASTER LOGS.SHOW MASTER STATUS.SHOW OPEN TABLES.SHOW PACKAGE BODY CODE.SHOW PACKAGE BODY STATUS.SHOW PACKAGE STATUS.SHOW PLUGINS.SHOW PLUGINS SONAME.SHOW PRIVILEGES.SHOW PROCEDURE CODE.SHOW PROCEDURE STATUS.SHOW PROCESSLIST.SHOW PROFILE.SHOW PROFILES.SHOW QUERY_RESPONSE_TIME.SHOW RELAYLOG EVENTS.SHOW REPLICA.SHOW REPLICA HOSTS.SHOW REPLICA STATUS.SHOW SCHEMAS.SHOW SLAVE.SHOW SLAVE HOSTS.SHOW SLAVE STATUS.SHOW STATUS.SHOW STORAGE ENGINES.SHOW TABLE STATUS.SHOW TABLES.SHOW TRIGGERS.SHOW USER_STATISTICS.SHOW VARIABLES.SHOW WARNINGS.SHOW WSREP_MEMBERSHIP.SHOW WSREP_STATUS.SHUTDOWN.SIGNAL.START ALL REPLICAS.START ALL SLAVES.START REPLICA.START SLAVE.START TRANSACTION.STOP ALL REPLICAS.STOP ALL SLAVES.STOP REPLICA.STOP SLAVE.UNINSTALL PLUGIN.UNINSTALL SONAME.UNLOCK TABLE.USE.XA BEGIN.XA COMMIT.XA END.XA PREPARE.XA RECOVER.XA ROLLBACK.XA START`.split(`.`)),JY=Y([`UNION [ALL | DISTINCT]`,`EXCEPT [ALL | DISTINCT]`,`INTERSECT [ALL | DISTINCT]`,`MINUS [ALL | DISTINCT]`]),YY=Y([`JOIN`,`{LEFT | RIGHT} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL JOIN`,`NATURAL {LEFT | RIGHT} [OUTER] JOIN`,`STRAIGHT_JOIN`]),XY=Y([`ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]`,`CHARACTER SET`,`{ROWS | RANGE} BETWEEN`,`IDENTIFIED BY`]),ZY=Y([]),QY={name:`mariadb`,tokenizerOptions:{reservedSelect:WY,reservedClauses:[...GY,...KY,...qY],reservedSetOperations:JY,reservedJoins:YY,reservedKeywordPhrases:XY,reservedDataTypePhrases:ZY,supportsXor:!0,reservedKeywords:VY,reservedDataTypes:HY,reservedFunctionNames:UY,stringTypes:[`""-qq-bs`,`''-qq-bs`,{quote:`''-raw`,prefixes:[`B`,`X`],requirePrefix:!0}],identTypes:["``"],identChars:{first:`$`,rest:`$`,allowFirstCharNumber:!0},variableTypes:[{regex:`@@?[A-Za-z0-9_.$]+`},{quote:`""-qq-bs`,prefixes:[`@`],requirePrefix:!0},{quote:`''-qq-bs`,prefixes:[`@`],requirePrefix:!0},{quote:"``",prefixes:[`@`],requirePrefix:!0}],paramTypes:{positional:!0},lineCommentTypes:[`--`,`#`],operators:[`%`,`:=`,`&`,`|`,`^`,`~`,`<<`,`>>`,`<=>`,`&&`,`||`,`!`,`*.*`],postProcess:BY},formatOptions:{onelineClauses:[...KY,...qY],tabularOnelineClauses:qY}},$Y=`ACCESSIBLE.ADD.ALL.ALTER.ANALYZE.AND.AS.ASC.ASENSITIVE.BEFORE.BETWEEN.BOTH.BY.CALL.CASCADE.CASE.CHANGE.CHECK.COLLATE.COLUMN.CONDITION.CONSTRAINT.CONTINUE.CONVERT.CREATE.CROSS.CUBE.CUME_DIST.CURRENT_DATE.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.CURSOR.DATABASE.DATABASES.DAY_HOUR.DAY_MICROSECOND.DAY_MINUTE.DAY_SECOND.DECLARE.DEFAULT.DELAYED.DELETE.DENSE_RANK.DESC.DESCRIBE.DETERMINISTIC.DISTINCT.DISTINCTROW.DIV.DROP.DUAL.EACH.ELSE.ELSEIF.EMPTY.ENCLOSED.ESCAPED.EXCEPT.EXISTS.EXIT.EXPLAIN.FALSE.FETCH.FIRST_VALUE.FOR.FORCE.FOREIGN.FROM.FULLTEXT.FUNCTION.GENERATED.GET.GRANT.GROUP.GROUPING.GROUPS.HAVING.HIGH_PRIORITY.HOUR_MICROSECOND.HOUR_MINUTE.HOUR_SECOND.IF.IGNORE.IN.INDEX.INFILE.INNER.INOUT.INSENSITIVE.INSERT.IN.INTERSECT.INTERVAL.INTO.IO_AFTER_GTIDS.IO_BEFORE_GTIDS.IS.ITERATE.JOIN.JSON_TABLE.KEY.KEYS.KILL.LAG.LAST_VALUE.LATERAL.LEAD.LEADING.LEAVE.LEFT.LIKE.LIMIT.LINEAR.LINES.LOAD.LOCALTIME.LOCALTIMESTAMP.LOCK.LONG.LOOP.LOW_PRIORITY.MASTER_BIND.MASTER_SSL_VERIFY_SERVER_CERT.MATCH.MAXVALUE.MINUTE_MICROSECOND.MINUTE_SECOND.MOD.MODIFIES.NATURAL.NOT.NO_WRITE_TO_BINLOG.NTH_VALUE.NTILE.NULL.OF.ON.OPTIMIZE.OPTIMIZER_COSTS.OPTION.OPTIONALLY.OR.ORDER.OUT.OUTER.OUTFILE.OVER.PARTITION.PERCENT_RANK.PRIMARY.PROCEDURE.PURGE.RANGE.RANK.READ.READS.READ_WRITE.RECURSIVE.REFERENCES.REGEXP.RELEASE.RENAME.REPEAT.REPLACE.REQUIRE.RESIGNAL.RESTRICT.RETURN.REVOKE.RIGHT.RLIKE.ROW.ROWS.ROW_NUMBER.SCHEMA.SCHEMAS.SECOND_MICROSECOND.SELECT.SENSITIVE.SEPARATOR.SET.SHOW.SIGNAL.SPATIAL.SPECIFIC.SQL.SQLEXCEPTION.SQLSTATE.SQLWARNING.SQL_BIG_RESULT.SQL_CALC_FOUND_ROWS.SQL_SMALL_RESULT.SSL.STARTING.STORED.STRAIGHT_JOIN.SYSTEM.TABLE.TERMINATED.THEN.TO.TRAILING.TRIGGER.TRUE.UNDO.UNION.UNIQUE.UNLOCK.UNSIGNED.UPDATE.USAGE.USE.USING.UTC_DATE.UTC_TIME.UTC_TIMESTAMP.VALUES.VIRTUAL.WHEN.WHERE.WHILE.WINDOW.WITH.WRITE.XOR.YEAR_MONTH.ZEROFILL`.split(`.`),eX=`BIGINT.BINARY.BIT.BLOB.BOOL.BOOLEAN.CHAR.CHARACTER.DATE.DATETIME.DEC.DECIMAL.DOUBLE PRECISION.DOUBLE.ENUM.FIXED.FLOAT.FLOAT4.FLOAT8.INT.INT1.INT2.INT3.INT4.INT8.INTEGER.LONGBLOB.LONGTEXT.MEDIUMBLOB.MEDIUMINT.MEDIUMTEXT.MIDDLEINT.NATIONAL CHAR.NATIONAL VARCHAR.NUMERIC.PRECISION.REAL.SMALLINT.TEXT.TIME.TIMESTAMP.TINYBLOB.TINYINT.TINYTEXT.VARBINARY.VARCHAR.VARCHARACTER.VARYING.YEAR`.split(`.`),tX=`ABS.ACOS.ADDDATE.ADDTIME.AES_DECRYPT.AES_ENCRYPT.ANY_VALUE.ASCII.ASIN.ATAN.ATAN2.AVG.BENCHMARK.BIN.BIN_TO_UUID.BINARY.BIT_AND.BIT_COUNT.BIT_LENGTH.BIT_OR.BIT_XOR.CAN_ACCESS_COLUMN.CAN_ACCESS_DATABASE.CAN_ACCESS_TABLE.CAN_ACCESS_USER.CAN_ACCESS_VIEW.CAST.CEIL.CEILING.CHAR.CHAR_LENGTH.CHARACTER_LENGTH.CHARSET.COALESCE.COERCIBILITY.COLLATION.COMPRESS.CONCAT.CONCAT_WS.CONNECTION_ID.CONV.CONVERT.CONVERT_TZ.COS.COT.COUNT.CRC32.CUME_DIST.CURDATE.CURRENT_DATE.CURRENT_ROLE.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.CURTIME.DATABASE.DATE.DATE_ADD.DATE_FORMAT.DATE_SUB.DATEDIFF.DAY.DAYNAME.DAYOFMONTH.DAYOFWEEK.DAYOFYEAR.DEFAULT.DEGREES.DENSE_RANK.DIV.ELT.EXP.EXPORT_SET.EXTRACT.EXTRACTVALUE.FIELD.FIND_IN_SET.FIRST_VALUE.FLOOR.FORMAT.FORMAT_BYTES.FORMAT_PICO_TIME.FOUND_ROWS.FROM_BASE64.FROM_DAYS.FROM_UNIXTIME.GEOMCOLLECTION.GEOMETRYCOLLECTION.GET_DD_COLUMN_PRIVILEGES.GET_DD_CREATE_OPTIONS.GET_DD_INDEX_SUB_PART_LENGTH.GET_FORMAT.GET_LOCK.GREATEST.GROUP_CONCAT.GROUPING.GTID_SUBSET.GTID_SUBTRACT.HEX.HOUR.ICU_VERSION.IF.IFNULL.INET_ATON.INET_NTOA.INET6_ATON.INET6_NTOA.INSERT.INSTR.INTERNAL_AUTO_INCREMENT.INTERNAL_AVG_ROW_LENGTH.INTERNAL_CHECK_TIME.INTERNAL_CHECKSUM.INTERNAL_DATA_FREE.INTERNAL_DATA_LENGTH.INTERNAL_DD_CHAR_LENGTH.INTERNAL_GET_COMMENT_OR_ERROR.INTERNAL_GET_ENABLED_ROLE_JSON.INTERNAL_GET_HOSTNAME.INTERNAL_GET_USERNAME.INTERNAL_GET_VIEW_WARNING_OR_ERROR.INTERNAL_INDEX_COLUMN_CARDINALITY.INTERNAL_INDEX_LENGTH.INTERNAL_IS_ENABLED_ROLE.INTERNAL_IS_MANDATORY_ROLE.INTERNAL_KEYS_DISABLED.INTERNAL_MAX_DATA_LENGTH.INTERNAL_TABLE_ROWS.INTERNAL_UPDATE_TIME.INTERVAL.IS.IS_FREE_LOCK.IS_IPV4.IS_IPV4_COMPAT.IS_IPV4_MAPPED.IS_IPV6.IS NOT.IS NOT NULL.IS NULL.IS_USED_LOCK.IS_UUID.ISNULL.JSON_ARRAY.JSON_ARRAY_APPEND.JSON_ARRAY_INSERT.JSON_ARRAYAGG.JSON_CONTAINS.JSON_CONTAINS_PATH.JSON_DEPTH.JSON_EXTRACT.JSON_INSERT.JSON_KEYS.JSON_LENGTH.JSON_MERGE.JSON_MERGE_PATCH.JSON_MERGE_PRESERVE.JSON_OBJECT.JSON_OBJECTAGG.JSON_OVERLAPS.JSON_PRETTY.JSON_QUOTE.JSON_REMOVE.JSON_REPLACE.JSON_SCHEMA_VALID.JSON_SCHEMA_VALIDATION_REPORT.JSON_SEARCH.JSON_SET.JSON_STORAGE_FREE.JSON_STORAGE_SIZE.JSON_TABLE.JSON_TYPE.JSON_UNQUOTE.JSON_VALID.JSON_VALUE.LAG.LAST_DAY.LAST_INSERT_ID.LAST_VALUE.LCASE.LEAD.LEAST.LEFT.LENGTH.LIKE.LINESTRING.LN.LOAD_FILE.LOCALTIME.LOCALTIMESTAMP.LOCATE.LOG.LOG10.LOG2.LOWER.LPAD.LTRIM.MAKE_SET.MAKEDATE.MAKETIME.MASTER_POS_WAIT.MATCH.MAX.MBRCONTAINS.MBRCOVEREDBY.MBRCOVERS.MBRDISJOINT.MBREQUALS.MBRINTERSECTS.MBROVERLAPS.MBRTOUCHES.MBRWITHIN.MD5.MICROSECOND.MID.MIN.MINUTE.MOD.MONTH.MONTHNAME.MULTILINESTRING.MULTIPOINT.MULTIPOLYGON.NAME_CONST.NOW.NTH_VALUE.NTILE.NULLIF.OCT.OCTET_LENGTH.ORD.PERCENT_RANK.PERIOD_ADD.PERIOD_DIFF.PI.POINT.POLYGON.POSITION.POW.POWER.PS_CURRENT_THREAD_ID.PS_THREAD_ID.QUARTER.QUOTE.RADIANS.RAND.RANDOM_BYTES.RANK.REGEXP.REGEXP_INSTR.REGEXP_LIKE.REGEXP_REPLACE.REGEXP_SUBSTR.RELEASE_ALL_LOCKS.RELEASE_LOCK.REPEAT.REPLACE.REVERSE.RIGHT.RLIKE.ROLES_GRAPHML.ROUND.ROW_COUNT.ROW_NUMBER.RPAD.RTRIM.SCHEMA.SEC_TO_TIME.SECOND.SESSION_USER.SHA1.SHA2.SIGN.SIN.SLEEP.SOUNDEX.SOUNDS LIKE.SOURCE_POS_WAIT.SPACE.SQRT.ST_AREA.ST_ASBINARY.ST_ASGEOJSON.ST_ASTEXT.ST_BUFFER.ST_BUFFER_STRATEGY.ST_CENTROID.ST_COLLECT.ST_CONTAINS.ST_CONVEXHULL.ST_CROSSES.ST_DIFFERENCE.ST_DIMENSION.ST_DISJOINT.ST_DISTANCE.ST_DISTANCE_SPHERE.ST_ENDPOINT.ST_ENVELOPE.ST_EQUALS.ST_EXTERIORRING.ST_FRECHETDISTANCE.ST_GEOHASH.ST_GEOMCOLLFROMTEXT.ST_GEOMCOLLFROMWKB.ST_GEOMETRYN.ST_GEOMETRYTYPE.ST_GEOMFROMGEOJSON.ST_GEOMFROMTEXT.ST_GEOMFROMWKB.ST_HAUSDORFFDISTANCE.ST_INTERIORRINGN.ST_INTERSECTION.ST_INTERSECTS.ST_ISCLOSED.ST_ISEMPTY.ST_ISSIMPLE.ST_ISVALID.ST_LATFROMGEOHASH.ST_LATITUDE.ST_LENGTH.ST_LINEFROMTEXT.ST_LINEFROMWKB.ST_LINEINTERPOLATEPOINT.ST_LINEINTERPOLATEPOINTS.ST_LONGFROMGEOHASH.ST_LONGITUDE.ST_MAKEENVELOPE.ST_MLINEFROMTEXT.ST_MLINEFROMWKB.ST_MPOINTFROMTEXT.ST_MPOINTFROMWKB.ST_MPOLYFROMTEXT.ST_MPOLYFROMWKB.ST_NUMGEOMETRIES.ST_NUMINTERIORRING.ST_NUMPOINTS.ST_OVERLAPS.ST_POINTATDISTANCE.ST_POINTFROMGEOHASH.ST_POINTFROMTEXT.ST_POINTFROMWKB.ST_POINTN.ST_POLYFROMTEXT.ST_POLYFROMWKB.ST_SIMPLIFY.ST_SRID.ST_STARTPOINT.ST_SWAPXY.ST_SYMDIFFERENCE.ST_TOUCHES.ST_TRANSFORM.ST_UNION.ST_VALIDATE.ST_WITHIN.ST_X.ST_Y.STATEMENT_DIGEST.STATEMENT_DIGEST_TEXT.STD.STDDEV.STDDEV_POP.STDDEV_SAMP.STR_TO_DATE.STRCMP.SUBDATE.SUBSTR.SUBSTRING.SUBSTRING_INDEX.SUBTIME.SUM.SYSDATE.SYSTEM_USER.TAN.TIME.TIME_FORMAT.TIME_TO_SEC.TIMEDIFF.TIMESTAMP.TIMESTAMPADD.TIMESTAMPDIFF.TO_BASE64.TO_DAYS.TO_SECONDS.TRIM.TRUNCATE.UCASE.UNCOMPRESS.UNCOMPRESSED_LENGTH.UNHEX.UNIX_TIMESTAMP.UPDATEXML.UPPER.UTC_DATE.UTC_TIME.UTC_TIMESTAMP.UUID.UUID_SHORT.UUID_TO_BIN.VALIDATE_PASSWORD_STRENGTH.VALUES.VAR_POP.VAR_SAMP.VARIANCE.VERSION.WAIT_FOR_EXECUTED_GTID_SET.WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS.WEEK.WEEKDAY.WEEKOFYEAR.WEIGHT_STRING.YEAR.YEARWEEK`.split(`.`),nX=Y([`SELECT [ALL | DISTINCT | DISTINCTROW]`]),rX=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO]`,`REPLACE [LOW_PRIORITY | DELAYED] [INTO]`,`VALUES`,`ON DUPLICATE KEY UPDATE`,`SET`]),iX=Y([`CREATE [TEMPORARY] TABLE [IF NOT EXISTS]`]),aX=Y(`CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS].UPDATE [LOW_PRIORITY] [IGNORE].DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM.DROP [TEMPORARY] TABLE [IF EXISTS].ALTER TABLE.ADD [COLUMN].{CHANGE | MODIFY} [COLUMN].DROP [COLUMN].RENAME [TO | AS].RENAME COLUMN.ALTER [COLUMN].{SET | DROP} DEFAULT.TRUNCATE [TABLE].ALTER DATABASE.ALTER EVENT.ALTER FUNCTION.ALTER INSTANCE.ALTER LOGFILE GROUP.ALTER PROCEDURE.ALTER RESOURCE GROUP.ALTER SERVER.ALTER TABLESPACE.ALTER USER.ALTER VIEW.ANALYZE TABLE.BINLOG.CACHE INDEX.CALL.CHANGE MASTER TO.CHANGE REPLICATION FILTER.CHANGE REPLICATION SOURCE TO.CHECK TABLE.CHECKSUM TABLE.CLONE.COMMIT.CREATE DATABASE.CREATE EVENT.CREATE FUNCTION.CREATE FUNCTION.CREATE INDEX.CREATE LOGFILE GROUP.CREATE PROCEDURE.CREATE RESOURCE GROUP.CREATE ROLE.CREATE SERVER.CREATE SPATIAL REFERENCE SYSTEM.CREATE TABLESPACE.CREATE TRIGGER.CREATE USER.DEALLOCATE PREPARE.DESCRIBE.DROP DATABASE.DROP EVENT.DROP FUNCTION.DROP FUNCTION.DROP INDEX.DROP LOGFILE GROUP.DROP PROCEDURE.DROP RESOURCE GROUP.DROP ROLE.DROP SERVER.DROP SPATIAL REFERENCE SYSTEM.DROP TABLESPACE.DROP TRIGGER.DROP USER.DROP VIEW.EXECUTE.EXPLAIN.FLUSH.GRANT.HANDLER.HELP.IMPORT TABLE.INSTALL COMPONENT.INSTALL PLUGIN.KILL.LOAD DATA.LOAD INDEX INTO CACHE.LOAD XML.LOCK INSTANCE FOR BACKUP.LOCK TABLES.MASTER_POS_WAIT.OPTIMIZE TABLE.PREPARE.PURGE BINARY LOGS.RELEASE SAVEPOINT.RENAME TABLE.RENAME USER.REPAIR TABLE.RESET.RESET MASTER.RESET PERSIST.RESET REPLICA.RESET SLAVE.RESTART.REVOKE.ROLLBACK.ROLLBACK TO SAVEPOINT.SAVEPOINT.SET CHARACTER SET.SET DEFAULT ROLE.SET NAMES.SET PASSWORD.SET RESOURCE GROUP.SET ROLE.SET TRANSACTION.SHOW.SHOW BINARY LOGS.SHOW BINLOG EVENTS.SHOW CHARACTER SET.SHOW COLLATION.SHOW COLUMNS.SHOW CREATE DATABASE.SHOW CREATE EVENT.SHOW CREATE FUNCTION.SHOW CREATE PROCEDURE.SHOW CREATE TABLE.SHOW CREATE TRIGGER.SHOW CREATE USER.SHOW CREATE VIEW.SHOW DATABASES.SHOW ENGINE.SHOW ENGINES.SHOW ERRORS.SHOW EVENTS.SHOW FUNCTION CODE.SHOW FUNCTION STATUS.SHOW GRANTS.SHOW INDEX.SHOW MASTER STATUS.SHOW OPEN TABLES.SHOW PLUGINS.SHOW PRIVILEGES.SHOW PROCEDURE CODE.SHOW PROCEDURE STATUS.SHOW PROCESSLIST.SHOW PROFILE.SHOW PROFILES.SHOW RELAYLOG EVENTS.SHOW REPLICA STATUS.SHOW REPLICAS.SHOW SLAVE.SHOW SLAVE HOSTS.SHOW STATUS.SHOW TABLE STATUS.SHOW TABLES.SHOW TRIGGERS.SHOW VARIABLES.SHOW WARNINGS.SHUTDOWN.SOURCE_POS_WAIT.START GROUP_REPLICATION.START REPLICA.START SLAVE.START TRANSACTION.STOP GROUP_REPLICATION.STOP REPLICA.STOP SLAVE.TABLE.UNINSTALL COMPONENT.UNINSTALL PLUGIN.UNLOCK INSTANCE.UNLOCK TABLES.USE.XA.ITERATE.LEAVE.LOOP.REPEAT.RETURN.WHILE`.split(`.`)),oX=Y([`UNION [ALL | DISTINCT]`]),sX=Y([`JOIN`,`{LEFT | RIGHT} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL [INNER] JOIN`,`NATURAL {LEFT | RIGHT} [OUTER] JOIN`,`STRAIGHT_JOIN`]),cX=Y([`ON {UPDATE | DELETE} [SET NULL]`,`CHARACTER SET`,`{ROWS | RANGE} BETWEEN`,`IDENTIFIED BY`]),lX=Y([]),uX={name:`mysql`,tokenizerOptions:{reservedSelect:nX,reservedClauses:[...rX,...iX,...aX],reservedSetOperations:oX,reservedJoins:sX,reservedKeywordPhrases:cX,reservedDataTypePhrases:lX,supportsXor:!0,reservedKeywords:$Y,reservedDataTypes:eX,reservedFunctionNames:tX,stringTypes:[`""-qq-bs`,{quote:`''-qq-bs`,prefixes:[`N`]},{quote:`''-raw`,prefixes:[`B`,`X`],requirePrefix:!0}],identTypes:["``"],identChars:{first:`$`,rest:`$`,allowFirstCharNumber:!0},variableTypes:[{regex:`@@?[A-Za-z0-9_.$]+`},{quote:`""-qq-bs`,prefixes:[`@`],requirePrefix:!0},{quote:`''-qq-bs`,prefixes:[`@`],requirePrefix:!0},{quote:"``",prefixes:[`@`],requirePrefix:!0}],paramTypes:{positional:!0},lineCommentTypes:[`--`,`#`],operators:[`%`,`:=`,`&`,`|`,`^`,`~`,`<<`,`>>`,`<=>`,`->`,`->>`,`&&`,`||`,`!`,`*.*`],postProcess:BY},formatOptions:{onelineClauses:[...iX,...aX],tabularOnelineClauses:aX}},dX=`ADD.ALL.ALTER.ANALYZE.AND.ARRAY.AS.ASC.BETWEEN.BOTH.BY.CALL.CASCADE.CASE.CHANGE.CHECK.COLLATE.COLUMN.CONSTRAINT.CONTINUE.CONVERT.CREATE.CROSS.CURRENT_DATE.CURRENT_ROLE.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.CURSOR.DATABASE.DATABASES.DAY_HOUR.DAY_MICROSECOND.DAY_MINUTE.DAY_SECOND.DEFAULT.DELAYED.DELETE.DESC.DESCRIBE.DISTINCT.DISTINCTROW.DIV.DOUBLE.DROP.DUAL.ELSE.ELSEIF.ENCLOSED.ESCAPED.EXCEPT.EXISTS.EXIT.EXPLAIN.FALSE.FETCH.FOR.FORCE.FOREIGN.FROM.FULLTEXT.GENERATED.GRANT.GROUP.GROUPS.HAVING.HIGH_PRIORITY.HOUR_MICROSECOND.HOUR_MINUTE.HOUR_SECOND.IF.IGNORE.ILIKE.IN.INDEX.INFILE.INNER.INOUT.INSERT.INTERSECT.INTERVAL.INTO.IS.ITERATE.JOIN.KEY.KEYS.KILL.LEADING.LEAVE.LEFT.LIKE.LIMIT.LINEAR.LINES.LOAD.LOCALTIME.LOCALTIMESTAMP.LOCK.LONG.LOW_PRIORITY.MATCH.MAXVALUE.MINUTE_MICROSECOND.MINUTE_SECOND.MOD.NATURAL.NOT.NO_WRITE_TO_BINLOG.NULL.OF.ON.OPTIMIZE.OPTION.OPTIONALLY.OR.ORDER.OUT.OUTER.OUTFILE.OVER.PARTITION.PRIMARY.PROCEDURE.RANGE.READ.RECURSIVE.REFERENCES.REGEXP.RELEASE.RENAME.REPEAT.REPLACE.REQUIRE.RESTRICT.REVOKE.RIGHT.RLIKE.ROW.ROWS.SECOND_MICROSECOND.SELECT.SET.SHOW.SPATIAL.SQL.SQLEXCEPTION.SQLSTATE.SQLWARNING.SQL_BIG_RESULT.SQL_CALC_FOUND_ROWS.SQL_SMALL_RESULT.SSL.STARTING.STATS_EXTENDED.STORED.STRAIGHT_JOIN.TABLE.TABLESAMPLE.TERMINATED.THEN.TO.TRAILING.TRIGGER.TRUE.TiDB_CURRENT_TSO.UNION.UNIQUE.UNLOCK.UNSIGNED.UNTIL.UPDATE.USAGE.USE.USING.UTC_DATE.UTC_TIME.UTC_TIMESTAMP.VALUES.VIRTUAL.WHEN.WHERE.WHILE.WINDOW.WITH.WRITE.XOR.YEAR_MONTH.ZEROFILL`.split(`.`),fX=`BIGINT.BINARY.BIT.BLOB.BOOL.BOOLEAN.CHAR.CHARACTER.DATE.DATETIME.DEC.DECIMAL.DOUBLE PRECISION.DOUBLE.ENUM.FIXED.INT.INT1.INT2.INT3.INT4.INT8.INTEGER.LONGBLOB.LONGTEXT.MEDIUMBLOB.MEDIUMINT.MIDDLEINT.NATIONAL CHAR.NATIONAL VARCHAR.NUMERIC.PRECISION.SMALLINT.TEXT.TIME.TIMESTAMP.TINYBLOB.TINYINT.TINYTEXT.VARBINARY.VARCHAR.VARCHARACTER.VARYING.YEAR`.split(`.`),pX=`ABS.ACOS.ADDDATE.ADDTIME.AES_DECRYPT.AES_ENCRYPT.ANY_VALUE.ASCII.ASIN.ATAN.ATAN2.AVG.BENCHMARK.BIN.BIN_TO_UUID.BIT_AND.BIT_COUNT.BIT_LENGTH.BIT_OR.BIT_XOR.BITAND.BITNEG.BITOR.BITXOR.CASE.CAST.CEIL.CEILING.CHAR_FUNC.CHAR_LENGTH.CHARACTER_LENGTH.CHARSET.COALESCE.COERCIBILITY.COLLATION.COMPRESS.CONCAT.CONCAT_WS.CONNECTION_ID.CONV.CONVERT.CONVERT_TZ.COS.COT.COUNT.CRC32.CUME_DIST.CURDATE.CURRENT_DATE.CURRENT_RESOURCE_GROUP.CURRENT_ROLE.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.CURTIME.DATABASE.DATE.DATE_ADD.DATE_FORMAT.DATE_SUB.DATEDIFF.DAY.DAYNAME.DAYOFMONTH.DAYOFWEEK.DAYOFYEAR.DECODE.DEFAULT_FUNC.DEGREES.DENSE_RANK.DES_DECRYPT.DES_ENCRYPT.DIV.ELT.ENCODE.ENCRYPT.EQ.EXP.EXPORT_SET.EXTRACT.FIELD.FIND_IN_SET.FIRST_VALUE.FLOOR.FORMAT.FORMAT_BYTES.FORMAT_NANO_TIME.FOUND_ROWS.FROM_BASE64.FROM_DAYS.FROM_UNIXTIME.GE.GET_FORMAT.GET_LOCK.GETPARAM.GREATEST.GROUP_CONCAT.GROUPING.GT.HEX.HOUR.IF.IFNULL.ILIKE.INET6_ATON.INET6_NTOA.INET_ATON.INET_NTOA.INSERT_FUNC.INSTR.INTDIV.INTERVAL.IS_FREE_LOCK.IS_IPV4.IS_IPV4_COMPAT.IS_IPV4_MAPPED.IS_IPV6.IS_USED_LOCK.IS_UUID.ISFALSE.ISNULL.ISTRUE.JSON_ARRAY.JSON_ARRAYAGG.JSON_ARRAY_APPEND.JSON_ARRAY_INSERT.JSON_CONTAINS.JSON_CONTAINS_PATH.JSON_DEPTH.JSON_EXTRACT.JSON_INSERT.JSON_KEYS.JSON_LENGTH.JSON_MEMBEROF.JSON_MERGE.JSON_MERGE_PATCH.JSON_MERGE_PRESERVE.JSON_OBJECT.JSON_OBJECTAGG.JSON_OVERLAPS.JSON_PRETTY.JSON_QUOTE.JSON_REMOVE.JSON_REPLACE.JSON_SEARCH.JSON_SET.JSON_STORAGE_FREE.JSON_STORAGE_SIZE.JSON_TYPE.JSON_UNQUOTE.JSON_VALID.LAG.LAST_DAY.LAST_INSERT_ID.LAST_VALUE.LASTVAL.LCASE.LE.LEAD.LEAST.LEFT.LEFTSHIFT.LENGTH.LIKE.LN.LOAD_FILE.LOCALTIME.LOCALTIMESTAMP.LOCATE.LOG.LOG10.LOG2.LOWER.LPAD.LT.LTRIM.MAKE_SET.MAKEDATE.MAKETIME.MASTER_POS_WAIT.MAX.MD5.MICROSECOND.MID.MIN.MINUS.MINUTE.MOD.MONTH.MONTHNAME.MUL.NAME_CONST.NE.NEXTVAL.NOT.NOW.NTH_VALUE.NTILE.NULLEQ.OCT.OCTET_LENGTH.OLD_PASSWORD.ORD.PASSWORD_FUNC.PERCENT_RANK.PERIOD_ADD.PERIOD_DIFF.PI.PLUS.POSITION.POW.POWER.QUARTER.QUOTE.RADIANS.RAND.RANDOM_BYTES.RANK.REGEXP.REGEXP_INSTR.REGEXP_LIKE.REGEXP_REPLACE.REGEXP_SUBSTR.RELEASE_ALL_LOCKS.RELEASE_LOCK.REPEAT.REPLACE.REVERSE.RIGHT.RIGHTSHIFT.ROUND.ROW_COUNT.ROW_NUMBER.RPAD.RTRIM.SCHEMA.SEC_TO_TIME.SECOND.SESSION_USER.SETVAL.SETVAR.SHA.SHA1.SHA2.SIGN.SIN.SLEEP.SM3.SPACE.SQRT.STD.STDDEV.STDDEV_POP.STDDEV_SAMP.STR_TO_DATE.STRCMP.SUBDATE.SUBSTR.SUBSTRING.SUBSTRING_INDEX.SUBTIME.SUM.SYSDATE.SYSTEM_USER.TAN.TIDB_BOUNDED_STALENESS.TIDB_CURRENT_TSO.TIDB_DECODE_BINARY_PLAN.TIDB_DECODE_KEY.TIDB_DECODE_PLAN.TIDB_DECODE_SQL_DIGESTS.TIDB_ENCODE_SQL_DIGEST.TIDB_IS_DDL_OWNER.TIDB_PARSE_TSO.TIDB_PARSE_TSO_LOGICAL.TIDB_ROW_CHECKSUM.TIDB_SHARD.TIDB_VERSION.TIME.TIME_FORMAT.TIME_TO_SEC.TIMEDIFF.TIMESTAMP.TIMESTAMPADD.TIMESTAMPDIFF.TO_BASE64.TO_DAYS.TO_SECONDS.TRANSLATE.TRIM.TRUNCATE.UCASE.UNARYMINUS.UNCOMPRESS.UNCOMPRESSED_LENGTH.UNHEX.UNIX_TIMESTAMP.UPPER.UTC_DATE.UTC_TIME.UTC_TIMESTAMP.UUID.UUID_SHORT.UUID_TO_BIN.VALIDATE_PASSWORD_STRENGTH.VAR_POP.VAR_SAMP.VARIANCE.VERSION.VITESS_HASH.WEEK.WEEKDAY.WEEKOFYEAR.WEIGHT_STRING.YEAR.YEARWEEK`.split(`.`),mX=Y([`SELECT [ALL | DISTINCT | DISTINCTROW]`]),hX=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO]`,`REPLACE [LOW_PRIORITY | DELAYED] [INTO]`,`VALUES`,`ON DUPLICATE KEY UPDATE`,`SET`]),gX=Y([`CREATE [TEMPORARY] TABLE [IF NOT EXISTS]`]),_X=Y(`CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS].UPDATE [LOW_PRIORITY] [IGNORE].DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM.DROP [TEMPORARY] TABLE [IF EXISTS].ALTER TABLE.ADD [COLUMN].{CHANGE | MODIFY} [COLUMN].DROP [COLUMN].RENAME [TO | AS].RENAME COLUMN.ALTER [COLUMN].{SET | DROP} DEFAULT.TRUNCATE [TABLE].ALTER DATABASE.ALTER INSTANCE.ALTER RESOURCE GROUP.ALTER SEQUENCE.ALTER USER.ALTER VIEW.ANALYZE TABLE.CHECK TABLE.CHECKSUM TABLE.COMMIT.CREATE DATABASE.CREATE INDEX.CREATE RESOURCE GROUP.CREATE ROLE.CREATE SEQUENCE.CREATE USER.DEALLOCATE PREPARE.DESCRIBE.DROP DATABASE.DROP INDEX.DROP RESOURCE GROUP.DROP ROLE.DROP TABLESPACE.DROP USER.DROP VIEW.EXPLAIN.FLUSH.GRANT.IMPORT TABLE.INSTALL COMPONENT.INSTALL PLUGIN.KILL.LOAD DATA.LOCK INSTANCE FOR BACKUP.LOCK TABLES.OPTIMIZE TABLE.PREPARE.RELEASE SAVEPOINT.RENAME TABLE.RENAME USER.REPAIR TABLE.RESET.REVOKE.ROLLBACK.ROLLBACK TO SAVEPOINT.SAVEPOINT.SET CHARACTER SET.SET DEFAULT ROLE.SET NAMES.SET PASSWORD.SET RESOURCE GROUP.SET ROLE.SET TRANSACTION.SHOW.SHOW BINARY LOGS.SHOW BINLOG EVENTS.SHOW CHARACTER SET.SHOW COLLATION.SHOW COLUMNS.SHOW CREATE DATABASE.SHOW CREATE TABLE.SHOW CREATE USER.SHOW CREATE VIEW.SHOW DATABASES.SHOW ENGINE.SHOW ENGINES.SHOW ERRORS.SHOW EVENTS.SHOW GRANTS.SHOW INDEX.SHOW MASTER STATUS.SHOW OPEN TABLES.SHOW PLUGINS.SHOW PRIVILEGES.SHOW PROCESSLIST.SHOW PROFILE.SHOW PROFILES.SHOW STATUS.SHOW TABLE STATUS.SHOW TABLES.SHOW TRIGGERS.SHOW VARIABLES.SHOW WARNINGS.TABLE.UNINSTALL COMPONENT.UNINSTALL PLUGIN.UNLOCK INSTANCE.UNLOCK TABLES.USE`.split(`.`)),vX=Y([`UNION [ALL | DISTINCT]`]),yX=Y([`JOIN`,`{LEFT | RIGHT} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL [INNER] JOIN`,`NATURAL {LEFT | RIGHT} [OUTER] JOIN`,`STRAIGHT_JOIN`]),bX=Y([`ON {UPDATE | DELETE} [SET NULL]`,`CHARACTER SET`,`{ROWS | RANGE} BETWEEN`,`IDENTIFIED BY`]),xX=Y([]),SX={name:`tidb`,tokenizerOptions:{reservedSelect:mX,reservedClauses:[...hX,...gX,..._X],reservedSetOperations:vX,reservedJoins:yX,reservedKeywordPhrases:bX,reservedDataTypePhrases:xX,supportsXor:!0,reservedKeywords:dX,reservedDataTypes:fX,reservedFunctionNames:pX,stringTypes:[`""-qq-bs`,{quote:`''-qq-bs`,prefixes:[`N`]},{quote:`''-raw`,prefixes:[`B`,`X`],requirePrefix:!0}],identTypes:["``"],identChars:{first:`$`,rest:`$`,allowFirstCharNumber:!0},variableTypes:[{regex:`@@?[A-Za-z0-9_.$]+`},{quote:`""-qq-bs`,prefixes:[`@`],requirePrefix:!0},{quote:`''-qq-bs`,prefixes:[`@`],requirePrefix:!0},{quote:"``",prefixes:[`@`],requirePrefix:!0}],paramTypes:{positional:!0},lineCommentTypes:[`--`,`#`],operators:[`%`,`:=`,`&`,`|`,`^`,`~`,`<<`,`>>`,`<=>`,`->`,`->>`,`&&`,`||`,`!`,`*.*`],postProcess:BY},formatOptions:{onelineClauses:[...gX,..._X],tabularOnelineClauses:_X}},CX=`ABORT.ABS.ACOS.ADVISOR.ARRAY_AGG.ARRAY_AGG.ARRAY_APPEND.ARRAY_AVG.ARRAY_BINARY_SEARCH.ARRAY_CONCAT.ARRAY_CONTAINS.ARRAY_COUNT.ARRAY_DISTINCT.ARRAY_EXCEPT.ARRAY_FLATTEN.ARRAY_IFNULL.ARRAY_INSERT.ARRAY_INTERSECT.ARRAY_LENGTH.ARRAY_MAX.ARRAY_MIN.ARRAY_MOVE.ARRAY_POSITION.ARRAY_PREPEND.ARRAY_PUT.ARRAY_RANGE.ARRAY_REMOVE.ARRAY_REPEAT.ARRAY_REPLACE.ARRAY_REVERSE.ARRAY_SORT.ARRAY_STAR.ARRAY_SUM.ARRAY_SYMDIFF.ARRAY_SYMDIFF1.ARRAY_SYMDIFFN.ARRAY_UNION.ASIN.ATAN.ATAN2.AVG.BASE64.BASE64_DECODE.BASE64_ENCODE.BITAND .BITCLEAR .BITNOT .BITOR .BITSET .BITSHIFT .BITTEST .BITXOR .CEIL.CLOCK_LOCAL.CLOCK_MILLIS.CLOCK_STR.CLOCK_TZ.CLOCK_UTC.COALESCE.CONCAT.CONCAT2.CONTAINS.CONTAINS_TOKEN.CONTAINS_TOKEN_LIKE.CONTAINS_TOKEN_REGEXP.COS.COUNT.COUNT.COUNTN.CUME_DIST.CURL.DATE_ADD_MILLIS.DATE_ADD_STR.DATE_DIFF_MILLIS.DATE_DIFF_STR.DATE_FORMAT_STR.DATE_PART_MILLIS.DATE_PART_STR.DATE_RANGE_MILLIS.DATE_RANGE_STR.DATE_TRUNC_MILLIS.DATE_TRUNC_STR.DECODE.DECODE_JSON.DEGREES.DENSE_RANK.DURATION_TO_STR.ENCODED_SIZE.ENCODE_JSON.EXP.FIRST_VALUE.FLOOR.GREATEST.HAS_TOKEN.IFINF.IFMISSING.IFMISSINGORNULL.IFNAN.IFNANORINF.IFNULL.INITCAP.ISARRAY.ISATOM.ISBITSET.ISBOOLEAN.ISNUMBER.ISOBJECT.ISSTRING.LAG.LAST_VALUE.LEAD.LEAST.LENGTH.LN.LOG.LOWER.LTRIM.MAX.MEAN.MEDIAN.META.MILLIS.MILLIS_TO_LOCAL.MILLIS_TO_STR.MILLIS_TO_TZ.MILLIS_TO_UTC.MILLIS_TO_ZONE_NAME.MIN.MISSINGIF.NANIF.NEGINFIF.NOW_LOCAL.NOW_MILLIS.NOW_STR.NOW_TZ.NOW_UTC.NTH_VALUE.NTILE.NULLIF.NVL.NVL2.OBJECT_ADD.OBJECT_CONCAT.OBJECT_INNER_PAIRS.OBJECT_INNER_VALUES.OBJECT_LENGTH.OBJECT_NAMES.OBJECT_PAIRS.OBJECT_PUT.OBJECT_REMOVE.OBJECT_RENAME.OBJECT_REPLACE.OBJECT_UNWRAP.OBJECT_VALUES.PAIRS.PERCENT_RANK.PI.POLY_LENGTH.POSINFIF.POSITION.POWER.RADIANS.RANDOM.RANK.RATIO_TO_REPORT.REGEXP_CONTAINS.REGEXP_LIKE.REGEXP_MATCHES.REGEXP_POSITION.REGEXP_REPLACE.REGEXP_SPLIT.REGEX_CONTAINS.REGEX_LIKE.REGEX_MATCHES.REGEX_POSITION.REGEX_REPLACE.REGEX_SPLIT.REPEAT.REPLACE.REVERSE.ROUND.ROW_NUMBER.RTRIM.SEARCH.SEARCH_META.SEARCH_SCORE.SIGN.SIN.SPLIT.SQRT.STDDEV.STDDEV_POP.STDDEV_SAMP.STR_TO_DURATION.STR_TO_MILLIS.STR_TO_TZ.STR_TO_UTC.STR_TO_ZONE_NAME.SUBSTR.SUFFIXES.SUM.TAN.TITLE.TOARRAY.TOATOM.TOBOOLEAN.TOKENS.TOKENS.TONUMBER.TOOBJECT.TOSTRING.TRIM.TRUNC.UPPER.UUID.VARIANCE.VARIANCE_POP.VARIANCE_SAMP.VAR_POP.VAR_SAMP.WEEKDAY_MILLIS.WEEKDAY_STR.CAST`.split(`.`),wX=`ADVISE.ALL.ALTER.ANALYZE.AND.ANY.ARRAY.AS.ASC.AT.BEGIN.BETWEEN.BINARY.BOOLEAN.BREAK.BUCKET.BUILD.BY.CALL.CASE.CAST.CLUSTER.COLLATE.COLLECTION.COMMIT.COMMITTED.CONNECT.CONTINUE.CORRELATED.COVER.CREATE.CURRENT.DATABASE.DATASET.DATASTORE.DECLARE.DECREMENT.DELETE.DERIVED.DESC.DESCRIBE.DISTINCT.DO.DROP.EACH.ELEMENT.ELSE.END.EVERY.EXCEPT.EXCLUDE.EXECUTE.EXISTS.EXPLAIN.FALSE.FETCH.FILTER.FIRST.FLATTEN.FLUSH.FOLLOWING.FOR.FORCE.FROM.FTS.FUNCTION.GOLANG.GRANT.GROUP.GROUPS.GSI.HASH.HAVING.IF.IGNORE.ILIKE.IN.INCLUDE.INCREMENT.INDEX.INFER.INLINE.INNER.INSERT.INTERSECT.INTO.IS.ISOLATION.JAVASCRIPT.JOIN.KEY.KEYS.KEYSPACE.KNOWN.LANGUAGE.LAST.LEFT.LET.LETTING.LEVEL.LIKE.LIMIT.LSM.MAP.MAPPING.MATCHED.MATERIALIZED.MERGE.MINUS.MISSING.NAMESPACE.NEST.NL.NO.NOT.NTH_VALUE.NULL.NULLS.NUMBER.OBJECT.OFFSET.ON.OPTION.OPTIONS.OR.ORDER.OTHERS.OUTER.OVER.PARSE.PARTITION.PASSWORD.PATH.POOL.PRECEDING.PREPARE.PRIMARY.PRIVATE.PRIVILEGE.PROBE.PROCEDURE.PUBLIC.RANGE.RAW.REALM.REDUCE.RENAME.RESPECT.RETURN.RETURNING.REVOKE.RIGHT.ROLE.ROLLBACK.ROW.ROWS.SATISFIES.SAVEPOINT.SCHEMA.SCOPE.SELECT.SELF.SEMI.SET.SHOW.SOME.START.STATISTICS.STRING.SYSTEM.THEN.TIES.TO.TRAN.TRANSACTION.TRIGGER.TRUE.TRUNCATE.UNBOUNDED.UNDER.UNION.UNIQUE.UNKNOWN.UNNEST.UNSET.UPDATE.UPSERT.USE.USER.USING.VALIDATE.VALUE.VALUED.VALUES.VIA.VIEW.WHEN.WHERE.WHILE.WINDOW.WITH.WITHIN.WORK.XOR`.split(`.`),TX=[],EX=Y([`SELECT [ALL | DISTINCT]`]),DX=Y([`WITH`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`INSERT INTO`,`VALUES`,`SET`,`MERGE INTO`,`WHEN [NOT] MATCHED THEN`,`UPDATE SET`,`INSERT`,`NEST`,`UNNEST`,`RETURNING`]),OX=Y(`UPDATE.DELETE FROM.SET SCHEMA.ADVISE.ALTER INDEX.BEGIN TRANSACTION.BUILD INDEX.COMMIT TRANSACTION.CREATE COLLECTION.CREATE FUNCTION.CREATE INDEX.CREATE PRIMARY INDEX.CREATE SCOPE.DROP COLLECTION.DROP FUNCTION.DROP INDEX.DROP PRIMARY INDEX.DROP SCOPE.EXECUTE.EXECUTE FUNCTION.EXPLAIN.GRANT.INFER.PREPARE.REVOKE.ROLLBACK TRANSACTION.SAVEPOINT.SET TRANSACTION.UPDATE STATISTICS.UPSERT.LET.SET CURRENT SCHEMA.SHOW.USE [PRIMARY] KEYS`.split(`.`)),kX=Y([`UNION [ALL]`,`EXCEPT [ALL]`,`INTERSECT [ALL]`]),AX=Y([`JOIN`,`{LEFT | RIGHT} [OUTER] JOIN`,`INNER JOIN`]),jX=Y([`{ROWS | RANGE | GROUPS} BETWEEN`]),MX=Y([]),NX={name:`n1ql`,tokenizerOptions:{reservedSelect:EX,reservedClauses:[...DX,...OX],reservedSetOperations:kX,reservedJoins:AX,reservedKeywordPhrases:jX,reservedDataTypePhrases:MX,supportsXor:!0,reservedKeywords:wX,reservedDataTypes:TX,reservedFunctionNames:CX,stringTypes:[`""-bs`,`''-bs`],identTypes:["``"],extraParens:[`[]`,`{}`],paramTypes:{positional:!0,numbered:[`$`],named:[`$`]},lineCommentTypes:[`#`,`--`],operators:[`%`,`==`,`:`,`||`]},formatOptions:{onelineClauses:OX}},PX=`ADD.AGENT.AGGREGATE.ALL.ALTER.AND.ANY.ARROW.AS.ASC.AT.ATTRIBUTE.AUTHID.AVG.BEGIN.BETWEEN.BLOCK.BODY.BOTH.BOUND.BULK.BY.BYTE.CALL.CALLING.CASCADE.CASE.CHARSET.CHARSETFORM.CHARSETID.CHECK.CLOSE.CLUSTER.CLUSTERS.COLAUTH.COLLECT.COLUMNS.COMMENT.COMMIT.COMMITTED.COMPILED.COMPRESS.CONNECT.CONSTANT.CONSTRUCTOR.CONTEXT.CONVERT.COUNT.CRASH.CREATE.CURRENT.CURSOR.CUSTOMDATUM.DANGLING.DATA.DAY.DECLARE.DEFAULT.DEFINE.DELETE.DESC.DETERMINISTIC.DISTINCT.DROP.DURATION.ELEMENT.ELSE.ELSIF.EMPTY.END.ESCAPE.EXCEPT.EXCEPTION.EXCEPTIONS.EXCLUSIVE.EXECUTE.EXISTS.EXIT.EXTERNAL.FETCH.FINAL.FIXED.FOR.FORALL.FORCE.FORM.FROM.FUNCTION.GENERAL.GOTO.GRANT.GROUP.HASH.HAVING.HEAP.HIDDEN.HOUR.IDENTIFIED.IF.IMMEDIATE.IN.INCLUDING.INDEX.INDEXES.INDICATOR.INDICES.INFINITE.INSERT.INSTANTIABLE.INTERFACE.INTERSECT.INTERVAL.INTO.INVALIDATE.IS.ISOLATION.JAVA.LANGUAGE.LARGE.LEADING.LENGTH.LEVEL.LIBRARY.LIKE.LIKE2.LIKE4.LIKEC.LIMIT.LIMITED.LOCAL.LOCK.LOOP.MAP.MAX.MAXLEN.MEMBER.MERGE.MIN.MINUS.MINUTE.MOD.MODE.MODIFY.MONTH.MULTISET.NAME.NAN.NATIONAL.NATIVE.NEW.NOCOMPRESS.NOCOPY.NOT.NOWAIT.NULL.OBJECT.OCICOLL.OCIDATE.OCIDATETIME.OCIDURATION.OCIINTERVAL.OCILOBLOCATOR.OCINUMBER.OCIRAW.OCIREF.OCIREFCURSOR.OCIROWID.OCISTRING.OCITYPE.OF.ON.ONLY.OPAQUE.OPEN.OPERATOR.OPTION.OR.ORACLE.ORADATA.ORDER.OVERLAPS.ORGANIZATION.ORLANY.ORLVARY.OTHERS.OUT.OVERRIDING.PACKAGE.PARALLEL_ENABLE.PARAMETER.PARAMETERS.PARTITION.PASCAL.PIPE.PIPELINED.PRAGMA.PRIOR.PRIVATE.PROCEDURE.PUBLIC.RAISE.RANGE.READ.RECORD.REF.REFERENCE.REM.REMAINDER.RENAME.RESOURCE.RESULT.RETURN.RETURNING.REVERSE.REVOKE.ROLLBACK.ROW.SAMPLE.SAVE.SAVEPOINT.SB1.SB2.SB4.SECOND.SEGMENT.SELECT.SELF.SEPARATE.SEQUENCE.SERIALIZABLE.SET.SHARE.SHORT.SIZE.SIZE_T.SOME.SPARSE.SQL.SQLCODE.SQLDATA.SQLNAME.SQLSTATE.STANDARD.START.STATIC.STDDEV.STORED.STRING.STRUCT.STYLE.SUBMULTISET.SUBPARTITION.SUBSTITUTABLE.SUBTYPE.SUM.SYNONYM.TABAUTH.TABLE.TDO.THE.THEN.TIME.TIMEZONE_ABBR.TIMEZONE_HOUR.TIMEZONE_MINUTE.TIMEZONE_REGION.TO.TRAILING.TRANSAC.TRANSACTIONAL.TRUSTED.TYPE.UB1.UB2.UB4.UNDER.UNION.UNIQUE.UNSIGNED.UNTRUSTED.UPDATE.USE.USING.VALIST.VALUE.VALUES.VARIABLE.VARIANCE.VARRAY.VIEW.VIEWS.VOID.WHEN.WHERE.WHILE.WITH.WORK.WRAPPED.WRITE.YEAR.ZONE`.split(`.`),FX=`ARRAY.BFILE_BASE.BINARY.BLOB_BASE.CHAR VARYING.CHAR_BASE.CHAR.CHARACTER VARYING.CHARACTER.CLOB_BASE.DATE_BASE.DATE.DECIMAL.DOUBLE.FLOAT.INT.INTERVAL DAY.INTERVAL YEAR.LONG.NATIONAL CHAR VARYING.NATIONAL CHAR.NATIONAL CHARACTER VARYING.NATIONAL CHARACTER.NCHAR VARYING.NCHAR.NCHAR.NUMBER_BASE.NUMBER.NUMBERIC.NVARCHAR.PRECISION.RAW.TIMESTAMP.UROWID.VARCHAR.VARCHAR2`.split(`.`),IX=`ABS.ACOS.ASIN.ATAN.ATAN2.BITAND.CEIL.COS.COSH.EXP.FLOOR.LN.LOG.MOD.NANVL.POWER.REMAINDER.ROUND.SIGN.SIN.SINH.SQRT.TAN.TANH.TRUNC.WIDTH_BUCKET.CHR.CONCAT.INITCAP.LOWER.LPAD.LTRIM.NLS_INITCAP.NLS_LOWER.NLSSORT.NLS_UPPER.REGEXP_REPLACE.REGEXP_SUBSTR.REPLACE.RPAD.RTRIM.SOUNDEX.SUBSTR.TRANSLATE.TREAT.TRIM.UPPER.NLS_CHARSET_DECL_LEN.NLS_CHARSET_ID.NLS_CHARSET_NAME.ASCII.INSTR.LENGTH.REGEXP_INSTR.ADD_MONTHS.CURRENT_DATE.CURRENT_TIMESTAMP.DBTIMEZONE.EXTRACT.FROM_TZ.LAST_DAY.LOCALTIMESTAMP.MONTHS_BETWEEN.NEW_TIME.NEXT_DAY.NUMTODSINTERVAL.NUMTOYMINTERVAL.ROUND.SESSIONTIMEZONE.SYS_EXTRACT_UTC.SYSDATE.SYSTIMESTAMP.TO_CHAR.TO_TIMESTAMP.TO_TIMESTAMP_TZ.TO_DSINTERVAL.TO_YMINTERVAL.TRUNC.TZ_OFFSET.GREATEST.LEAST.ASCIISTR.BIN_TO_NUM.CAST.CHARTOROWID.COMPOSE.CONVERT.DECOMPOSE.HEXTORAW.NUMTODSINTERVAL.NUMTOYMINTERVAL.RAWTOHEX.RAWTONHEX.ROWIDTOCHAR.ROWIDTONCHAR.SCN_TO_TIMESTAMP.TIMESTAMP_TO_SCN.TO_BINARY_DOUBLE.TO_BINARY_FLOAT.TO_CHAR.TO_CLOB.TO_DATE.TO_DSINTERVAL.TO_LOB.TO_MULTI_BYTE.TO_NCHAR.TO_NCLOB.TO_NUMBER.TO_DSINTERVAL.TO_SINGLE_BYTE.TO_TIMESTAMP.TO_TIMESTAMP_TZ.TO_YMINTERVAL.TO_YMINTERVAL.TRANSLATE.UNISTR.BFILENAME.EMPTY_BLOB,.EMPTY_CLOB.CARDINALITY.COLLECT.POWERMULTISET.POWERMULTISET_BY_CARDINALITY.SET.SYS_CONNECT_BY_PATH.CLUSTER_ID.CLUSTER_PROBABILITY.CLUSTER_SET.FEATURE_ID.FEATURE_SET.FEATURE_VALUE.PREDICTION.PREDICTION_COST.PREDICTION_DETAILS.PREDICTION_PROBABILITY.PREDICTION_SET.APPENDCHILDXML.DELETEXML.DEPTH.EXTRACT.EXISTSNODE.EXTRACTVALUE.INSERTCHILDXML.INSERTXMLBEFORE.PATH.SYS_DBURIGEN.SYS_XMLAGG.SYS_XMLGEN.UPDATEXML.XMLAGG.XMLCDATA.XMLCOLATTVAL.XMLCOMMENT.XMLCONCAT.XMLFOREST.XMLPARSE.XMLPI.XMLQUERY.XMLROOT.XMLSEQUENCE.XMLSERIALIZE.XMLTABLE.XMLTRANSFORM.DECODE.DUMP.ORA_HASH.VSIZE.COALESCE.LNNVL.NULLIF.NVL.NVL2.SYS_CONTEXT.SYS_GUID.SYS_TYPEID.UID.USER.USERENV.AVG.COLLECT.CORR.CORR_S.CORR_K.COUNT.COVAR_POP.COVAR_SAMP.CUME_DIST.DENSE_RANK.FIRST.GROUP_ID.GROUPING.GROUPING_ID.LAST.MAX.MEDIAN.MIN.PERCENTILE_CONT.PERCENTILE_DISC.PERCENT_RANK.RANK.REGR_SLOPE.REGR_INTERCEPT.REGR_COUNT.REGR_R2.REGR_AVGX.REGR_AVGY.REGR_SXX.REGR_SYY.REGR_SXY.STATS_BINOMIAL_TEST.STATS_CROSSTAB.STATS_F_TEST.STATS_KS_TEST.STATS_MODE.STATS_MW_TEST.STATS_ONE_WAY_ANOVA.STATS_T_TEST_ONE.STATS_T_TEST_PAIRED.STATS_T_TEST_INDEP.STATS_T_TEST_INDEPU.STATS_WSR_TEST.STDDEV.STDDEV_POP.STDDEV_SAMP.SUM.VAR_POP.VAR_SAMP.VARIANCE.FIRST_VALUE.LAG.LAST_VALUE.LEAD.NTILE.RATIO_TO_REPORT.ROW_NUMBER.DEREF.MAKE_REF.REF.REFTOHEX.VALUE.CV.ITERATION_NUMBER.PRESENTNNV.PRESENTV.PREVIOUS`.split(`.`),LX=Y([`SELECT [ALL | DISTINCT | UNIQUE]`]),RX=Y([`WITH`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`PARTITION BY`,`ORDER [SIBLINGS] BY`,`OFFSET`,`FETCH {FIRST | NEXT}`,`FOR UPDATE [OF]`,`INSERT [INTO | ALL INTO]`,`VALUES`,`SET`,`MERGE [INTO]`,`WHEN [NOT] MATCHED [THEN]`,`UPDATE SET`,`RETURNING`]),zX=Y([`CREATE [GLOBAL TEMPORARY | PRIVATE TEMPORARY | SHARDED | DUPLICATED | IMMUTABLE BLOCKCHAIN | BLOCKCHAIN | IMMUTABLE] TABLE`]),BX=Y([`CREATE [OR REPLACE] [NO FORCE | FORCE] [EDITIONING | EDITIONABLE | EDITIONABLE EDITIONING | NONEDITIONABLE] VIEW`,`CREATE MATERIALIZED VIEW`,`UPDATE [ONLY]`,`DELETE FROM [ONLY]`,`DROP TABLE`,`ALTER TABLE`,`ADD`,`DROP {COLUMN | UNUSED COLUMNS | COLUMNS CONTINUE}`,`MODIFY`,`RENAME TO`,`RENAME COLUMN`,`TRUNCATE TABLE`,`SET SCHEMA`,`BEGIN`,`CONNECT BY`,`DECLARE`,`EXCEPT`,`EXCEPTION`,`LOOP`,`START WITH`]),VX=Y([`UNION [ALL]`,`MINUS`,`INTERSECT`]),HX=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL [INNER] JOIN`,`NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN`,`{CROSS | OUTER} APPLY`]),UX=Y([`ON {UPDATE | DELETE} [SET NULL]`,`ON COMMIT`,`{ROWS | RANGE} BETWEEN`]),WX=Y([]),GX={name:`plsql`,tokenizerOptions:{reservedSelect:LX,reservedClauses:[...RX,...zX,...BX],reservedSetOperations:VX,reservedJoins:HX,reservedKeywordPhrases:UX,reservedDataTypePhrases:WX,supportsXor:!0,reservedKeywords:PX,reservedDataTypes:FX,reservedFunctionNames:IX,stringTypes:[{quote:`''-qq`,prefixes:[`N`]},{quote:`q''`,prefixes:[`N`]}],identTypes:[`""-qq`],identChars:{rest:`$#`},variableTypes:[{regex:`&{1,2}[A-Za-z][A-Za-z0-9_$#]*`}],paramTypes:{numbered:[`:`],named:[`:`]},operators:[`**`,`:=`,`%`,`~=`,`^=`,`>>`,`<<`,`=>`,`@`,`||`],postProcess:KX},formatOptions:{alwaysDenseOperators:[`@`],onelineClauses:[...zX,...BX],tabularOnelineClauses:BX}};function KX(e){let t=fJ;return e.map(e=>mJ.SET(e)&&mJ.BY(t)?Object.assign(Object.assign({},e),{type:X.RESERVED_KEYWORD}):(hJ(e.type)&&(t=e),e))}var qX=`ABS.ACOS.ACOSD.ACOSH.ASIN.ASIND.ASINH.ATAN.ATAN2.ATAN2D.ATAND.ATANH.CBRT.CEIL.CEILING.COS.COSD.COSH.COT.COTD.DEGREES.DIV.EXP.FACTORIAL.FLOOR.GCD.LCM.LN.LOG.LOG10.MIN_SCALE.MOD.PI.POWER.RADIANS.RANDOM.ROUND.SCALE.SETSEED.SIGN.SIN.SIND.SINH.SQRT.TAN.TAND.TANH.TRIM_SCALE.TRUNC.WIDTH_BUCKET.ABS.ASCII.BIT_LENGTH.BTRIM.CHARACTER_LENGTH.CHAR_LENGTH.CHR.CONCAT.CONCAT_WS.FORMAT.INITCAP.LEFT.LENGTH.LOWER.LPAD.LTRIM.MD5.NORMALIZE.OCTET_LENGTH.OVERLAY.PARSE_IDENT.PG_CLIENT_ENCODING.POSITION.QUOTE_IDENT.QUOTE_LITERAL.QUOTE_NULLABLE.REGEXP_MATCH.REGEXP_MATCHES.REGEXP_REPLACE.REGEXP_SPLIT_TO_ARRAY.REGEXP_SPLIT_TO_TABLE.REPEAT.REPLACE.REVERSE.RIGHT.RPAD.RTRIM.SPLIT_PART.SPRINTF.STARTS_WITH.STRING_AGG.STRING_TO_ARRAY.STRING_TO_TABLE.STRPOS.SUBSTR.SUBSTRING.TO_ASCII.TO_HEX.TRANSLATE.TRIM.UNISTR.UPPER.BIT_COUNT.BIT_LENGTH.BTRIM.CONVERT.CONVERT_FROM.CONVERT_TO.DECODE.ENCODE.GET_BIT.GET_BYTE.LENGTH.LTRIM.MD5.OCTET_LENGTH.OVERLAY.POSITION.RTRIM.SET_BIT.SET_BYTE.SHA224.SHA256.SHA384.SHA512.STRING_AGG.SUBSTR.SUBSTRING.TRIM.BIT_COUNT.BIT_LENGTH.GET_BIT.LENGTH.OCTET_LENGTH.OVERLAY.POSITION.SET_BIT.SUBSTRING.REGEXP_MATCH.REGEXP_MATCHES.REGEXP_REPLACE.REGEXP_SPLIT_TO_ARRAY.REGEXP_SPLIT_TO_TABLE.TO_CHAR.TO_DATE.TO_NUMBER.TO_TIMESTAMP.CLOCK_TIMESTAMP.CURRENT_DATE.CURRENT_TIME.CURRENT_TIMESTAMP.DATE_BIN.DATE_PART.DATE_TRUNC.EXTRACT.ISFINITE.JUSTIFY_DAYS.JUSTIFY_HOURS.JUSTIFY_INTERVAL.LOCALTIME.LOCALTIMESTAMP.MAKE_DATE.MAKE_INTERVAL.MAKE_TIME.MAKE_TIMESTAMP.MAKE_TIMESTAMPTZ.NOW.PG_SLEEP.PG_SLEEP_FOR.PG_SLEEP_UNTIL.STATEMENT_TIMESTAMP.TIMEOFDAY.TO_TIMESTAMP.TRANSACTION_TIMESTAMP.ENUM_FIRST.ENUM_LAST.ENUM_RANGE.AREA.BOUND_BOX.BOX.CENTER.CIRCLE.DIAGONAL.DIAMETER.HEIGHT.ISCLOSED.ISOPEN.LENGTH.LINE.LSEG.NPOINTS.PATH.PCLOSE.POINT.POLYGON.POPEN.RADIUS.SLOPE.WIDTH.ABBREV.BROADCAST.FAMILY.HOST.HOSTMASK.INET_MERGE.INET_SAME_FAMILY.MACADDR8_SET7BIT.MASKLEN.NETMASK.NETWORK.SET_MASKLEN.TRUNC.ARRAY_TO_TSVECTOR.GET_CURRENT_TS_CONFIG.JSONB_TO_TSVECTOR.JSON_TO_TSVECTOR.LENGTH.NUMNODE.PHRASETO_TSQUERY.PLAINTO_TSQUERY.QUERYTREE.SETWEIGHT.STRIP.TO_TSQUERY.TO_TSVECTOR.TSQUERY_PHRASE.TSVECTOR_TO_ARRAY.TS_DEBUG.TS_DELETE.TS_FILTER.TS_HEADLINE.TS_LEXIZE.TS_PARSE.TS_RANK.TS_RANK_CD.TS_REWRITE.TS_STAT.TS_TOKEN_TYPE.WEBSEARCH_TO_TSQUERY.GEN_RANDOM_UUID.UUIDV4.UUIDV7.UUID_EXTRACT_TIMESTAMP.UUID_EXTRACT_VERSION.CURSOR_TO_XML.CURSOR_TO_XMLSCHEMA.DATABASE_TO_XML.DATABASE_TO_XMLSCHEMA.DATABASE_TO_XML_AND_XMLSCHEMA.NEXTVAL.QUERY_TO_XML.QUERY_TO_XMLSCHEMA.QUERY_TO_XML_AND_XMLSCHEMA.SCHEMA_TO_XML.SCHEMA_TO_XMLSCHEMA.SCHEMA_TO_XML_AND_XMLSCHEMA.STRING.TABLE_TO_XML.TABLE_TO_XMLSCHEMA.TABLE_TO_XML_AND_XMLSCHEMA.XMLAGG.XMLCOMMENT.XMLCONCAT.XMLELEMENT.XMLEXISTS.XMLFOREST.XMLPARSE.XMLPI.XMLROOT.XMLSERIALIZE.XMLTABLE.XML_IS_WELL_FORMED.XML_IS_WELL_FORMED_CONTENT.XML_IS_WELL_FORMED_DOCUMENT.XPATH.XPATH_EXISTS.ARRAY_TO_JSON.JSONB_AGG.JSONB_ARRAY_ELEMENTS.JSONB_ARRAY_ELEMENTS_TEXT.JSONB_ARRAY_LENGTH.JSONB_BUILD_ARRAY.JSONB_BUILD_OBJECT.JSONB_EACH.JSONB_EACH_TEXT.JSONB_EXTRACT_PATH.JSONB_EXTRACT_PATH_TEXT.JSONB_INSERT.JSONB_OBJECT.JSONB_OBJECT_AGG.JSONB_OBJECT_KEYS.JSONB_PATH_EXISTS.JSONB_PATH_EXISTS_TZ.JSONB_PATH_MATCH.JSONB_PATH_MATCH_TZ.JSONB_PATH_QUERY.JSONB_PATH_QUERY_ARRAY.JSONB_PATH_QUERY_ARRAY_TZ.JSONB_PATH_QUERY_FIRST.JSONB_PATH_QUERY_FIRST_TZ.JSONB_PATH_QUERY_TZ.JSONB_POPULATE_RECORD.JSONB_POPULATE_RECORDSET.JSONB_PRETTY.JSONB_SET.JSONB_SET_LAX.JSONB_STRIP_NULLS.JSONB_TO_RECORD.JSONB_TO_RECORDSET.JSONB_TYPEOF.JSON_AGG.JSON_ARRAY_ELEMENTS.JSON_ARRAY_ELEMENTS_TEXT.JSON_ARRAY_LENGTH.JSON_BUILD_ARRAY.JSON_BUILD_OBJECT.JSON_EACH.JSON_EACH_TEXT.JSON_EXTRACT_PATH.JSON_EXTRACT_PATH_TEXT.JSON_OBJECT.JSON_OBJECT_AGG.JSON_OBJECT_KEYS.JSON_POPULATE_RECORD.JSON_POPULATE_RECORDSET.JSON_STRIP_NULLS.JSON_TO_RECORD.JSON_TO_RECORDSET.JSON_TYPEOF.ROW_TO_JSON.TO_JSON.TO_JSONB.TO_TIMESTAMP.CURRVAL.LASTVAL.NEXTVAL.SETVAL.COALESCE.GREATEST.LEAST.NULLIF.ARRAY_AGG.ARRAY_APPEND.ARRAY_CAT.ARRAY_DIMS.ARRAY_FILL.ARRAY_LENGTH.ARRAY_LOWER.ARRAY_NDIMS.ARRAY_POSITION.ARRAY_POSITIONS.ARRAY_PREPEND.ARRAY_REMOVE.ARRAY_REPLACE.ARRAY_TO_STRING.ARRAY_UPPER.CARDINALITY.STRING_TO_ARRAY.TRIM_ARRAY.UNNEST.ISEMPTY.LOWER.LOWER_INC.LOWER_INF.MULTIRANGE.RANGE_MERGE.UPPER.UPPER_INC.UPPER_INF.ARRAY_AGG.AVG.BIT_AND.BIT_OR.BIT_XOR.BOOL_AND.BOOL_OR.COALESCE.CORR.COUNT.COVAR_POP.COVAR_SAMP.CUME_DIST.DENSE_RANK.EVERY.GROUPING.JSONB_AGG.JSONB_OBJECT_AGG.JSON_AGG.JSON_OBJECT_AGG.MAX.MIN.MODE.PERCENTILE_CONT.PERCENTILE_DISC.PERCENT_RANK.RANGE_AGG.RANGE_INTERSECT_AGG.RANK.REGR_AVGX.REGR_AVGY.REGR_COUNT.REGR_INTERCEPT.REGR_R2.REGR_SLOPE.REGR_SXX.REGR_SXY.REGR_SYY.STDDEV.STDDEV_POP.STDDEV_SAMP.STRING_AGG.SUM.TO_JSON.TO_JSONB.VARIANCE.VAR_POP.VAR_SAMP.XMLAGG.CUME_DIST.DENSE_RANK.FIRST_VALUE.LAG.LAST_VALUE.LEAD.NTH_VALUE.NTILE.PERCENT_RANK.RANK.ROW_NUMBER.GENERATE_SERIES.GENERATE_SUBSCRIPTS.ACLDEFAULT.ACLEXPLODE.COL_DESCRIPTION.CURRENT_CATALOG.CURRENT_DATABASE.CURRENT_QUERY.CURRENT_ROLE.CURRENT_SCHEMA.CURRENT_SCHEMAS.CURRENT_USER.FORMAT_TYPE.HAS_ANY_COLUMN_PRIVILEGE.HAS_COLUMN_PRIVILEGE.HAS_DATABASE_PRIVILEGE.HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE.HAS_FUNCTION_PRIVILEGE.HAS_LANGUAGE_PRIVILEGE.HAS_SCHEMA_PRIVILEGE.HAS_SEQUENCE_PRIVILEGE.HAS_SERVER_PRIVILEGE.HAS_TABLESPACE_PRIVILEGE.HAS_TABLE_PRIVILEGE.HAS_TYPE_PRIVILEGE.INET_CLIENT_ADDR.INET_CLIENT_PORT.INET_SERVER_ADDR.INET_SERVER_PORT.MAKEACLITEM.OBJ_DESCRIPTION.PG_BACKEND_PID.PG_BLOCKING_PIDS.PG_COLLATION_IS_VISIBLE.PG_CONF_LOAD_TIME.PG_CONTROL_CHECKPOINT.PG_CONTROL_INIT.PG_CONTROL_SYSTEM.PG_CONVERSION_IS_VISIBLE.PG_CURRENT_LOGFILE.PG_CURRENT_SNAPSHOT.PG_CURRENT_XACT_ID.PG_CURRENT_XACT_ID_IF_ASSIGNED.PG_DESCRIBE_OBJECT.PG_FUNCTION_IS_VISIBLE.PG_GET_CATALOG_FOREIGN_KEYS.PG_GET_CONSTRAINTDEF.PG_GET_EXPR.PG_GET_FUNCTIONDEF.PG_GET_FUNCTION_ARGUMENTS.PG_GET_FUNCTION_IDENTITY_ARGUMENTS.PG_GET_FUNCTION_RESULT.PG_GET_INDEXDEF.PG_GET_KEYWORDS.PG_GET_OBJECT_ADDRESS.PG_GET_OWNED_SEQUENCE.PG_GET_RULEDEF.PG_GET_SERIAL_SEQUENCE.PG_GET_STATISTICSOBJDEF.PG_GET_TRIGGERDEF.PG_GET_USERBYID.PG_GET_VIEWDEF.PG_HAS_ROLE.PG_IDENTIFY_OBJECT.PG_IDENTIFY_OBJECT_AS_ADDRESS.PG_INDEXAM_HAS_PROPERTY.PG_INDEX_COLUMN_HAS_PROPERTY.PG_INDEX_HAS_PROPERTY.PG_IS_OTHER_TEMP_SCHEMA.PG_JIT_AVAILABLE.PG_LAST_COMMITTED_XACT.PG_LISTENING_CHANNELS.PG_MY_TEMP_SCHEMA.PG_NOTIFICATION_QUEUE_USAGE.PG_OPCLASS_IS_VISIBLE.PG_OPERATOR_IS_VISIBLE.PG_OPFAMILY_IS_VISIBLE.PG_OPTIONS_TO_TABLE.PG_POSTMASTER_START_TIME.PG_SAFE_SNAPSHOT_BLOCKING_PIDS.PG_SNAPSHOT_XIP.PG_SNAPSHOT_XMAX.PG_SNAPSHOT_XMIN.PG_STATISTICS_OBJ_IS_VISIBLE.PG_TABLESPACE_DATABASES.PG_TABLESPACE_LOCATION.PG_TABLE_IS_VISIBLE.PG_TRIGGER_DEPTH.PG_TS_CONFIG_IS_VISIBLE.PG_TS_DICT_IS_VISIBLE.PG_TS_PARSER_IS_VISIBLE.PG_TS_TEMPLATE_IS_VISIBLE.PG_TYPEOF.PG_TYPE_IS_VISIBLE.PG_VISIBLE_IN_SNAPSHOT.PG_XACT_COMMIT_TIMESTAMP.PG_XACT_COMMIT_TIMESTAMP_ORIGIN.PG_XACT_STATUS.PQSERVERVERSION.ROW_SECURITY_ACTIVE.SESSION_USER.SHOBJ_DESCRIPTION.TO_REGCLASS.TO_REGCOLLATION.TO_REGNAMESPACE.TO_REGOPER.TO_REGOPERATOR.TO_REGPROC.TO_REGPROCEDURE.TO_REGROLE.TO_REGTYPE.TXID_CURRENT.TXID_CURRENT_IF_ASSIGNED.TXID_CURRENT_SNAPSHOT.TXID_SNAPSHOT_XIP.TXID_SNAPSHOT_XMAX.TXID_SNAPSHOT_XMIN.TXID_STATUS.TXID_VISIBLE_IN_SNAPSHOT.USER.VERSION.BRIN_DESUMMARIZE_RANGE.BRIN_SUMMARIZE_NEW_VALUES.BRIN_SUMMARIZE_RANGE.CONVERT_FROM.CURRENT_SETTING.GIN_CLEAN_PENDING_LIST.PG_ADVISORY_LOCK.PG_ADVISORY_LOCK_SHARED.PG_ADVISORY_UNLOCK.PG_ADVISORY_UNLOCK_ALL.PG_ADVISORY_UNLOCK_SHARED.PG_ADVISORY_XACT_LOCK.PG_ADVISORY_XACT_LOCK_SHARED.PG_BACKUP_START_TIME.PG_CANCEL_BACKEND.PG_COLLATION_ACTUAL_VERSION.PG_COLUMN_COMPRESSION.PG_COLUMN_SIZE.PG_COPY_LOGICAL_REPLICATION_SLOT.PG_COPY_PHYSICAL_REPLICATION_SLOT.PG_CREATE_LOGICAL_REPLICATION_SLOT.PG_CREATE_PHYSICAL_REPLICATION_SLOT.PG_CREATE_RESTORE_POINT.PG_CURRENT_WAL_FLUSH_LSN.PG_CURRENT_WAL_INSERT_LSN.PG_CURRENT_WAL_LSN.PG_DATABASE_SIZE.PG_DROP_REPLICATION_SLOT.PG_EXPORT_SNAPSHOT.PG_FILENODE_RELATION.PG_GET_WAL_REPLAY_PAUSE_STATE.PG_IMPORT_SYSTEM_COLLATIONS.PG_INDEXES_SIZE.PG_IS_IN_BACKUP.PG_IS_IN_RECOVERY.PG_IS_WAL_REPLAY_PAUSED.PG_LAST_WAL_RECEIVE_LSN.PG_LAST_WAL_REPLAY_LSN.PG_LAST_XACT_REPLAY_TIMESTAMP.PG_LOGICAL_EMIT_MESSAGE.PG_LOGICAL_SLOT_GET_BINARY_CHANGES.PG_LOGICAL_SLOT_GET_CHANGES.PG_LOGICAL_SLOT_PEEK_BINARY_CHANGES.PG_LOGICAL_SLOT_PEEK_CHANGES.PG_LOG_BACKEND_MEMORY_CONTEXTS.PG_LS_ARCHIVE_STATUSDIR.PG_LS_DIR.PG_LS_LOGDIR.PG_LS_TMPDIR.PG_LS_WALDIR.PG_PARTITION_ANCESTORS.PG_PARTITION_ROOT.PG_PARTITION_TREE.PG_PROMOTE.PG_READ_BINARY_FILE.PG_READ_FILE.PG_RELATION_FILENODE.PG_RELATION_FILEPATH.PG_RELATION_SIZE.PG_RELOAD_CONF.PG_REPLICATION_ORIGIN_ADVANCE.PG_REPLICATION_ORIGIN_CREATE.PG_REPLICATION_ORIGIN_DROP.PG_REPLICATION_ORIGIN_OID.PG_REPLICATION_ORIGIN_PROGRESS.PG_REPLICATION_ORIGIN_SESSION_IS_SETUP.PG_REPLICATION_ORIGIN_SESSION_PROGRESS.PG_REPLICATION_ORIGIN_SESSION_RESET.PG_REPLICATION_ORIGIN_SESSION_SETUP.PG_REPLICATION_ORIGIN_XACT_RESET.PG_REPLICATION_ORIGIN_XACT_SETUP.PG_REPLICATION_SLOT_ADVANCE.PG_ROTATE_LOGFILE.PG_SIZE_BYTES.PG_SIZE_PRETTY.PG_START_BACKUP.PG_STAT_FILE.PG_STOP_BACKUP.PG_SWITCH_WAL.PG_TABLESPACE_SIZE.PG_TABLE_SIZE.PG_TERMINATE_BACKEND.PG_TOTAL_RELATION_SIZE.PG_TRY_ADVISORY_LOCK.PG_TRY_ADVISORY_LOCK_SHARED.PG_TRY_ADVISORY_XACT_LOCK.PG_TRY_ADVISORY_XACT_LOCK_SHARED.PG_WALFILE_NAME.PG_WALFILE_NAME_OFFSET.PG_WAL_LSN_DIFF.PG_WAL_REPLAY_PAUSE.PG_WAL_REPLAY_RESUME.SET_CONFIG.SUPPRESS_REDUNDANT_UPDATES_TRIGGER.TSVECTOR_UPDATE_TRIGGER.TSVECTOR_UPDATE_TRIGGER_COLUMN.PG_EVENT_TRIGGER_DDL_COMMANDS.PG_EVENT_TRIGGER_DROPPED_OBJECTS.PG_EVENT_TRIGGER_TABLE_REWRITE_OID.PG_EVENT_TRIGGER_TABLE_REWRITE_REASON.PG_GET_OBJECT_ADDRESS.PG_MCV_LIST_ITEMS.CAST`.split(`.`),JX=`ALL.ANALYSE.ANALYZE.AND.ANY.AS.ASC.ASYMMETRIC.AUTHORIZATION.BETWEEN.BINARY.BOTH.CASE.CAST.CHECK.COLLATE.COLLATION.COLUMN.CONCURRENTLY.CONSTRAINT.CREATE.CROSS.CURRENT_CATALOG.CURRENT_DATE.CURRENT_ROLE.CURRENT_SCHEMA.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.DAY.DEFAULT.DEFERRABLE.DESC.DISTINCT.DO.ELSE.END.EXCEPT.EXISTS.FALSE.FETCH.FILTER.FOR.FOREIGN.FREEZE.FROM.FULL.GRANT.GROUP.HAVING.HOUR.ILIKE.IN.INITIALLY.INNER.INOUT.INTERSECT.INTO.IS.ISNULL.JOIN.LATERAL.LEADING.LEFT.LIKE.LIMIT.LOCALTIME.LOCALTIMESTAMP.MINUTE.MONTH.NATURAL.NOT.NOTNULL.NULL.NULLIF.OFFSET.ON.ONLY.OR.ORDER.OUT.OUTER.OVER.OVERLAPS.PLACING.PRIMARY.REFERENCES.RETURNING.RIGHT.ROW.SECOND.SELECT.SESSION_USER.SIMILAR.SOME.SYMMETRIC.TABLE.TABLESAMPLE.THEN.TO.TRAILING.TRUE.UNION.UNIQUE.USER.USING.VALUES.VARIADIC.VERBOSE.WHEN.WHERE.WINDOW.WITH.WITHIN.WITHOUT.YEAR`.split(`.`),YX=`ARRAY.BIGINT.BIT.BIT VARYING.BOOL.BOOLEAN.CHAR.CHARACTER.CHARACTER VARYING.DECIMAL.DEC.DOUBLE.ENUM.FLOAT.INT.INTEGER.INTERVAL.NCHAR.NUMERIC.JSON.JSONB.PRECISION.REAL.SMALLINT.TEXT.TIME.TIMESTAMP.TIMESTAMPTZ.UUID.VARCHAR.XML.ZONE`.split(`.`),XX=Y([`SELECT [ALL | DISTINCT]`]),ZX=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY [ALL | DISTINCT]`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`FETCH {FIRST | NEXT}`,`FOR {UPDATE | NO KEY UPDATE | SHARE | KEY SHARE} [OF]`,`INSERT INTO`,`VALUES`,`DEFAULT VALUES`,`SET`,`RETURNING`]),QX=Y([`CREATE [GLOBAL | LOCAL] [TEMPORARY | TEMP | UNLOGGED] TABLE [IF NOT EXISTS]`]),$X=Y(`CREATE [OR REPLACE] [TEMP | TEMPORARY] [RECURSIVE] VIEW.CREATE [MATERIALIZED] VIEW [IF NOT EXISTS].UPDATE [ONLY].WHERE CURRENT OF.ON CONFLICT.DELETE FROM [ONLY].DROP TABLE [IF EXISTS].ALTER TABLE [IF EXISTS] [ONLY].ALTER TABLE ALL IN TABLESPACE.RENAME [COLUMN].RENAME TO.ADD [COLUMN] [IF NOT EXISTS].DROP [COLUMN] [IF EXISTS].ALTER [COLUMN].SET DATA TYPE.{SET | DROP} DEFAULT.{SET | DROP} NOT NULL.TRUNCATE [TABLE] [ONLY].SET SCHEMA.{BEFORE | AFTER | INSTEAD OF} {INSERT | UPDATE [OF] | DELETE | TRUNCATE}.[NOT] DEFERRABLE.INITIALLY {DEFERRED | IMMEDIATE}.[NOT] DEFERRABLE INITIALLY {DEFERRED | IMMEDIATE}.ABORT.ALTER AGGREGATE.ALTER COLLATION.ALTER CONVERSION.ALTER DATABASE.ALTER DEFAULT PRIVILEGES.ALTER DOMAIN.ALTER EVENT TRIGGER.ALTER EXTENSION.ALTER FOREIGN DATA WRAPPER.ALTER FOREIGN TABLE.ALTER FUNCTION.ALTER GROUP.ALTER INDEX.ALTER LANGUAGE.ALTER LARGE OBJECT.ALTER MATERIALIZED VIEW.ALTER OPERATOR.ALTER OPERATOR CLASS.ALTER OPERATOR FAMILY.ALTER POLICY.ALTER PROCEDURE.ALTER PUBLICATION.ALTER ROLE.ALTER ROUTINE.ALTER RULE.ALTER SCHEMA.ALTER SEQUENCE.ALTER SERVER.ALTER STATISTICS.ALTER SUBSCRIPTION.ALTER SYSTEM.ALTER TABLESPACE.ALTER TEXT SEARCH CONFIGURATION.ALTER TEXT SEARCH DICTIONARY.ALTER TEXT SEARCH PARSER.ALTER TEXT SEARCH TEMPLATE.ALTER TRIGGER.ALTER TYPE.ALTER USER.ALTER USER MAPPING.ALTER VIEW.ANALYZE.BEGIN.CALL.CHECKPOINT.CLOSE.CLUSTER.COMMENT ON.COMMIT.COMMIT PREPARED.COPY.CREATE ACCESS METHOD.CREATE [OR REPLACE] AGGREGATE.CREATE CAST.CREATE COLLATION.CREATE [DEFAULT] CONVERSION.CREATE DATABASE.CREATE DOMAIN.CREATE EVENT TRIGGER.CREATE EXTENSION.CREATE FOREIGN DATA WRAPPER.CREATE FOREIGN TABLE.CREATE [OR REPLACE] FUNCTION.CREATE GROUP.CREATE [UNIQUE] INDEX.CREATE [OR REPLACE] [TRUSTED] [PROCEDURAL] LANGUAGE.CREATE OPERATOR.CREATE OPERATOR CLASS.CREATE OPERATOR FAMILY.CREATE POLICY.CREATE [OR REPLACE] PROCEDURE.CREATE PUBLICATION.CREATE ROLE.CREATE [OR REPLACE] RULE.CREATE SCHEMA [AUTHORIZATION].CREATE [TEMPORARY | TEMP | UNLOGGED] SEQUENCE.CREATE SERVER.CREATE STATISTICS.CREATE SUBSCRIPTION.CREATE TABLESPACE.CREATE TEXT SEARCH CONFIGURATION.CREATE TEXT SEARCH DICTIONARY.CREATE TEXT SEARCH PARSER.CREATE TEXT SEARCH TEMPLATE.CREATE [OR REPLACE] TRANSFORM.CREATE [OR REPLACE] [CONSTRAINT] TRIGGER.CREATE TYPE.CREATE USER.CREATE USER MAPPING.DEALLOCATE.DECLARE.DISCARD.DROP ACCESS METHOD.DROP AGGREGATE.DROP CAST.DROP COLLATION.DROP CONVERSION.DROP DATABASE.DROP DOMAIN.DROP EVENT TRIGGER.DROP EXTENSION.DROP FOREIGN DATA WRAPPER.DROP FOREIGN TABLE.DROP FUNCTION.DROP GROUP.DROP IDENTITY.DROP INDEX.DROP LANGUAGE.DROP MATERIALIZED VIEW [IF EXISTS].DROP OPERATOR.DROP OPERATOR CLASS.DROP OPERATOR FAMILY.DROP OWNED.DROP POLICY.DROP PROCEDURE.DROP PUBLICATION.DROP ROLE.DROP ROUTINE.DROP RULE.DROP SCHEMA.DROP SEQUENCE.DROP SERVER.DROP STATISTICS.DROP SUBSCRIPTION.DROP TABLESPACE.DROP TEXT SEARCH CONFIGURATION.DROP TEXT SEARCH DICTIONARY.DROP TEXT SEARCH PARSER.DROP TEXT SEARCH TEMPLATE.DROP TRANSFORM.DROP TRIGGER.DROP TYPE.DROP USER.DROP USER MAPPING.DROP VIEW.EXECUTE [FUNCTION | PROCEDURE].EXPLAIN.FETCH.GRANT.IMPORT FOREIGN SCHEMA.LISTEN.LOAD.LOCK.MOVE.NOTIFY.OVERRIDING SYSTEM VALUE.PREPARE.PREPARE TRANSACTION.REASSIGN OWNED.REFRESH MATERIALIZED VIEW.REINDEX.RELEASE SAVEPOINT.RESET [ALL|ROLE|SESSION AUTHORIZATION].REVOKE.ROLLBACK.ROLLBACK PREPARED.ROLLBACK TO SAVEPOINT.SAVEPOINT.SECURITY LABEL.SELECT INTO.SET CONSTRAINTS.SET ROLE.SET SESSION AUTHORIZATION.SET TRANSACTION.SHOW.START TRANSACTION.UNLISTEN.VACUUM`.split(`.`)),eZ=Y([`UNION [ALL | DISTINCT]`,`EXCEPT [ALL | DISTINCT]`,`INTERSECT [ALL | DISTINCT]`]),tZ=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL [INNER] JOIN`,`NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN`]),nZ=Y([`PRIMARY KEY`,`GENERATED {ALWAYS | BY DEFAULT} AS IDENTITY`,`ON {UPDATE | DELETE} [NO ACTION | RESTRICT | CASCADE | SET NULL | SET DEFAULT]`,`DO {NOTHING | UPDATE}`,`AS MATERIALIZED`,`FOR EACH ROW`,`OR {INSERT | UPDATE [OF] | DELETE | TRUNCATE}`,`{ROWS | RANGE | GROUPS} BETWEEN`,`IS [NOT] DISTINCT FROM`,`NULLS {FIRST | LAST}`,`WITH ORDINALITY`]),rZ=Y([`[TIMESTAMP | TIME] {WITH | WITHOUT} TIME ZONE`]),iZ={name:`postgresql`,tokenizerOptions:{reservedSelect:XX,reservedClauses:[...ZX,...QX,...$X],reservedSetOperations:eZ,reservedJoins:tZ,reservedKeywordPhrases:nZ,reservedDataTypePhrases:rZ,reservedKeywords:JX,reservedDataTypes:YX,reservedFunctionNames:qX,nestedBlockComments:!0,extraParens:[`[]`],underscoresInNumbers:!0,stringTypes:[`$$`,{quote:`''-qq`,prefixes:[`U&`]},{quote:`''-qq-bs`,prefixes:[`E`],requirePrefix:!0},{quote:`''-raw`,prefixes:[`B`,`X`],requirePrefix:!0}],identTypes:[{quote:`""-qq`,prefixes:[`U&`]}],identChars:{rest:`$`},paramTypes:{numbered:[`$`]},operators:`%.^.|/.||/.@.:=.&.|.#.~.<<.>>.~>~.~<~.~>=~.~<=~.@-@.@@.##.<->.&&.&<.&>.<<|.&<|.|>>.|&>.<^.>^.?#.?-.?|.?-|.?||.@>.<@.<@>.~=.?.@?.?&.->.->>.#>.#>>.#-.=>.>>=.<<=.~~.~~*.!~~.!~~*.~.~*.!~.!~*.-|-.||.@@@.!!.^@.<%.%>.<<%.%>>.<<->.<->>.<<<->.<->>>.~>.#=.::.:.<#>.<=>.<+>.<~>.<%>.&&&.|=|`.split(`.`),operatorKeyword:!0},formatOptions:{alwaysDenseOperators:[`::`,`:`],onelineClauses:[...QX,...$X],tabularOnelineClauses:$X}},aZ=`ANY_VALUE.APPROXIMATE PERCENTILE_DISC.AVG.COUNT.LISTAGG.MAX.MEDIAN.MIN.PERCENTILE_CONT.STDDEV_SAMP.STDDEV_POP.SUM.VAR_SAMP.VAR_POP.array_concat.array_flatten.get_array_length.split_to_array.subarray.BIT_AND.BIT_OR.BOOL_AND.BOOL_OR.COALESCE.DECODE.GREATEST.LEAST.NVL.NVL2.NULLIF.ADD_MONTHS.AT TIME ZONE.CONVERT_TIMEZONE.CURRENT_DATE.CURRENT_TIME.CURRENT_TIMESTAMP.DATE_CMP.DATE_CMP_TIMESTAMP.DATE_CMP_TIMESTAMPTZ.DATE_PART_YEAR.DATEADD.DATEDIFF.DATE_PART.DATE_TRUNC.EXTRACT.GETDATE.INTERVAL_CMP.LAST_DAY.MONTHS_BETWEEN.NEXT_DAY.SYSDATE.TIMEOFDAY.TIMESTAMP_CMP.TIMESTAMP_CMP_DATE.TIMESTAMP_CMP_TIMESTAMPTZ.TIMESTAMPTZ_CMP.TIMESTAMPTZ_CMP_DATE.TIMESTAMPTZ_CMP_TIMESTAMP.TIMEZONE.TO_TIMESTAMP.TRUNC.AddBBox.DropBBox.GeometryType.ST_AddPoint.ST_Angle.ST_Area.ST_AsBinary.ST_AsEWKB.ST_AsEWKT.ST_AsGeoJSON.ST_AsText.ST_Azimuth.ST_Boundary.ST_Collect.ST_Contains.ST_ContainsProperly.ST_ConvexHull.ST_CoveredBy.ST_Covers.ST_Crosses.ST_Dimension.ST_Disjoint.ST_Distance.ST_DistanceSphere.ST_DWithin.ST_EndPoint.ST_Envelope.ST_Equals.ST_ExteriorRing.ST_Force2D.ST_Force3D.ST_Force3DM.ST_Force3DZ.ST_Force4D.ST_GeometryN.ST_GeometryType.ST_GeomFromEWKB.ST_GeomFromEWKT.ST_GeomFromText.ST_GeomFromWKB.ST_InteriorRingN.ST_Intersects.ST_IsPolygonCCW.ST_IsPolygonCW.ST_IsClosed.ST_IsCollection.ST_IsEmpty.ST_IsSimple.ST_IsValid.ST_Length.ST_LengthSphere.ST_Length2D.ST_LineFromMultiPoint.ST_LineInterpolatePoint.ST_M.ST_MakeEnvelope.ST_MakeLine.ST_MakePoint.ST_MakePolygon.ST_MemSize.ST_MMax.ST_MMin.ST_Multi.ST_NDims.ST_NPoints.ST_NRings.ST_NumGeometries.ST_NumInteriorRings.ST_NumPoints.ST_Perimeter.ST_Perimeter2D.ST_Point.ST_PointN.ST_Points.ST_Polygon.ST_RemovePoint.ST_Reverse.ST_SetPoint.ST_SetSRID.ST_Simplify.ST_SRID.ST_StartPoint.ST_Touches.ST_Within.ST_X.ST_XMax.ST_XMin.ST_Y.ST_YMax.ST_YMin.ST_Z.ST_ZMax.ST_ZMin.SupportsBBox.CHECKSUM.FUNC_SHA1.FNV_HASH.MD5.SHA.SHA1.SHA2.HLL.HLL_CREATE_SKETCH.HLL_CARDINALITY.HLL_COMBINE.IS_VALID_JSON.IS_VALID_JSON_ARRAY.JSON_ARRAY_LENGTH.JSON_EXTRACT_ARRAY_ELEMENT_TEXT.JSON_EXTRACT_PATH_TEXT.JSON_PARSE.JSON_SERIALIZE.ABS.ACOS.ASIN.ATAN.ATAN2.CBRT.CEILING.CEIL.COS.COT.DEGREES.DEXP.DLOG1.DLOG10.EXP.FLOOR.LN.LOG.MOD.PI.POWER.RADIANS.RANDOM.ROUND.SIN.SIGN.SQRT.TAN.TO_HEX.TRUNC.EXPLAIN_MODEL.ASCII.BPCHARCMP.BTRIM.BTTEXT_PATTERN_CMP.CHAR_LENGTH.CHARACTER_LENGTH.CHARINDEX.CHR.COLLATE.CONCAT.CRC32.DIFFERENCE.INITCAP.LEFT.RIGHT.LEN.LENGTH.LOWER.LPAD.RPAD.LTRIM.OCTETINDEX.OCTET_LENGTH.POSITION.QUOTE_IDENT.QUOTE_LITERAL.REGEXP_COUNT.REGEXP_INSTR.REGEXP_REPLACE.REGEXP_SUBSTR.REPEAT.REPLACE.REPLICATE.REVERSE.RTRIM.SOUNDEX.SPLIT_PART.STRPOS.STRTOL.SUBSTRING.TEXTLEN.TRANSLATE.TRIM.UPPER.decimal_precision.decimal_scale.is_array.is_bigint.is_boolean.is_char.is_decimal.is_float.is_integer.is_object.is_scalar.is_smallint.is_varchar.json_typeof.AVG.COUNT.CUME_DIST.DENSE_RANK.FIRST_VALUE.LAST_VALUE.LAG.LEAD.LISTAGG.MAX.MEDIAN.MIN.NTH_VALUE.NTILE.PERCENT_RANK.PERCENTILE_CONT.PERCENTILE_DISC.RANK.RATIO_TO_REPORT.ROW_NUMBER.STDDEV_SAMP.STDDEV_POP.SUM.VAR_SAMP.VAR_POP.CAST.CONVERT.TO_CHAR.TO_DATE.TO_NUMBER.TEXT_TO_INT_ALT.TEXT_TO_NUMERIC_ALT.CHANGE_QUERY_PRIORITY.CHANGE_SESSION_PRIORITY.CHANGE_USER_PRIORITY.CURRENT_SETTING.PG_CANCEL_BACKEND.PG_TERMINATE_BACKEND.REBOOT_CLUSTER.SET_CONFIG.CURRENT_AWS_ACCOUNT.CURRENT_DATABASE.CURRENT_NAMESPACE.CURRENT_SCHEMA.CURRENT_SCHEMAS.CURRENT_USER.CURRENT_USER_ID.HAS_ASSUMEROLE_PRIVILEGE.HAS_DATABASE_PRIVILEGE.HAS_SCHEMA_PRIVILEGE.HAS_TABLE_PRIVILEGE.PG_BACKEND_PID.PG_GET_COLS.PG_GET_GRANTEE_BY_IAM_ROLE.PG_GET_IAM_ROLE_BY_USER.PG_GET_LATE_BINDING_VIEW_COLS.PG_LAST_COPY_COUNT.PG_LAST_COPY_ID.PG_LAST_UNLOAD_ID.PG_LAST_QUERY_ID.PG_LAST_UNLOAD_COUNT.SESSION_USER.SLICE_NUM.USER.VERSION`.split(`.`),oZ=`AES128.AES256.ALL.ALLOWOVERWRITE.ANY.AS.ASC.AUTHORIZATION.BACKUP.BETWEEN.BINARY.BOTH.CHECK.COLUMN.CONSTRAINT.CREATE.CROSS.DEFAULT.DEFERRABLE.DEFLATE.DEFRAG.DESC.DISABLE.DISTINCT.DO.ENABLE.ENCODE.ENCRYPT.ENCRYPTION.EXPLICIT.FALSE.FOR.FOREIGN.FREEZE.FROM.FULL.GLOBALDICT256.GLOBALDICT64K.GROUP.IDENTITY.IGNORE.ILIKE.IN.INITIALLY.INNER.INTO.IS.ISNULL.LANGUAGE.LEADING.LIKE.LIMIT.LOCALTIME.LOCALTIMESTAMP.LUN.LUNS.MINUS.NATURAL.NEW.NOT.NOTNULL.NULL.NULLS.OFF.OFFLINE.OFFSET.OID.OLD.ON.ONLY.OPEN.ORDER.OUTER.OVERLAPS.PARALLEL.PARTITION.PERCENT.PERMISSIONS.PLACING.PRIMARY.RECOVER.REFERENCES.REJECTLOG.RESORT.RESPECT.RESTORE.SIMILAR.SNAPSHOT.SOME.SYSTEM.TABLE.TAG.TDES.THEN.TIMESTAMP.TO.TOP.TRAILING.TRUE.UNIQUE.USING.VERBOSE.WALLET.WITHOUT.ACCEPTANYDATE.ACCEPTINVCHARS.BLANKSASNULL.DATEFORMAT.EMPTYASNULL.ENCODING.ESCAPE.EXPLICIT_IDS.FILLRECORD.IGNOREBLANKLINES.IGNOREHEADER.REMOVEQUOTES.ROUNDEC.TIMEFORMAT.TRIMBLANKS.TRUNCATECOLUMNS.COMPROWS.COMPUPDATE.MAXERROR.NOLOAD.STATUPDATE.FORMAT.CSV.DELIMITER.FIXEDWIDTH.SHAPEFILE.AVRO.JSON.PARQUET.ORC.ACCESS_KEY_ID.CREDENTIALS.ENCRYPTED.IAM_ROLE.MASTER_SYMMETRIC_KEY.SECRET_ACCESS_KEY.SESSION_TOKEN.BZIP2.GZIP.LZOP.ZSTD.MANIFEST.READRATIO.REGION.SSH.RAW.AZ64.BYTEDICT.DELTA.DELTA32K.LZO.MOSTLY8.MOSTLY16.MOSTLY32.RUNLENGTH.TEXT255.TEXT32K.CATALOG_ROLE.SECRET_ARN.EXTERNAL.AUTO.EVEN.KEY.PREDICATE.COMPRESSION`.split(`.`),sZ=[`ARRAY`,`BIGINT`,`BPCHAR`,`CHAR`,`CHARACTER VARYING`,`CHARACTER`,`DECIMAL`,`INT`,`INT2`,`INT4`,`INT8`,`INTEGER`,`NCHAR`,`NUMERIC`,`NVARCHAR`,`SMALLINT`,`TEXT`,`VARBYTE`,`VARCHAR`],cZ=Y([`SELECT [ALL | DISTINCT]`]),lZ=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`QUALIFY`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`INSERT INTO`,`VALUES`,`SET`]),uZ=Y([`CREATE [TEMPORARY | TEMP | LOCAL TEMPORARY | LOCAL TEMP] TABLE [IF NOT EXISTS]`]),dZ=Y(`CREATE [OR REPLACE | MATERIALIZED] VIEW.UPDATE.DELETE [FROM].DROP TABLE [IF EXISTS].ALTER TABLE.ALTER TABLE APPEND.ADD [COLUMN].DROP [COLUMN].RENAME TO.RENAME COLUMN.ALTER COLUMN.TYPE.ENCODE.TRUNCATE [TABLE].ABORT.ALTER DATABASE.ALTER DATASHARE.ALTER DEFAULT PRIVILEGES.ALTER GROUP.ALTER MATERIALIZED VIEW.ALTER PROCEDURE.ALTER SCHEMA.ALTER USER.ANALYSE.ANALYZE.ANALYSE COMPRESSION.ANALYZE COMPRESSION.BEGIN.CALL.CANCEL.CLOSE.COMMIT.COPY.CREATE DATABASE.CREATE DATASHARE.CREATE EXTERNAL FUNCTION.CREATE EXTERNAL SCHEMA.CREATE EXTERNAL TABLE.CREATE FUNCTION.CREATE GROUP.CREATE LIBRARY.CREATE MODEL.CREATE PROCEDURE.CREATE SCHEMA.CREATE USER.DEALLOCATE.DECLARE.DESC DATASHARE.DROP DATABASE.DROP DATASHARE.DROP FUNCTION.DROP GROUP.DROP LIBRARY.DROP MODEL.DROP MATERIALIZED VIEW.DROP PROCEDURE.DROP SCHEMA.DROP USER.DROP VIEW.DROP.EXECUTE.EXPLAIN.FETCH.GRANT.LOCK.PREPARE.REFRESH MATERIALIZED VIEW.RESET.REVOKE.ROLLBACK.SELECT INTO.SET SESSION AUTHORIZATION.SET SESSION CHARACTERISTICS.SHOW.SHOW EXTERNAL TABLE.SHOW MODEL.SHOW DATASHARES.SHOW PROCEDURE.SHOW TABLE.SHOW VIEW.START TRANSACTION.UNLOAD.VACUUM`.split(`.`)),fZ=Y([`UNION [ALL]`,`EXCEPT`,`INTERSECT`,`MINUS`]),pZ=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL [INNER] JOIN`,`NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN`]),mZ=Y([`NULL AS`,`DATA CATALOG`,`HIVE METASTORE`,`{ROWS | RANGE} BETWEEN`]),hZ=Y([]),gZ={name:`redshift`,tokenizerOptions:{reservedSelect:cZ,reservedClauses:[...lZ,...uZ,...dZ],reservedSetOperations:fZ,reservedJoins:pZ,reservedKeywordPhrases:mZ,reservedDataTypePhrases:hZ,reservedKeywords:oZ,reservedDataTypes:sZ,reservedFunctionNames:aZ,extraParens:[`[]`],stringTypes:[`''-qq`],identTypes:[`""-qq`],identChars:{first:`#`},paramTypes:{numbered:[`$`]},operators:[`^`,`%`,`@`,`|/`,`||/`,`&`,`|`,`~`,`<<`,`>>`,`||`,`::`]},formatOptions:{alwaysDenseOperators:[`::`],onelineClauses:[...uZ,...dZ],tabularOnelineClauses:dZ}},_Z=`ADD.AFTER.ALL.ALTER.ANALYZE.AND.ANTI.ANY.ARCHIVE.AS.ASC.AT.AUTHORIZATION.BETWEEN.BOTH.BUCKET.BUCKETS.BY.CACHE.CASCADE.CAST.CHANGE.CHECK.CLEAR.CLUSTER.CLUSTERED.CODEGEN.COLLATE.COLLECTION.COLUMN.COLUMNS.COMMENT.COMMIT.COMPACT.COMPACTIONS.COMPUTE.CONCATENATE.CONSTRAINT.COST.CREATE.CROSS.CUBE.CURRENT.CURRENT_DATE.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.DATA.DATABASE.DATABASES.DAY.DBPROPERTIES.DEFINED.DELETE.DELIMITED.DESC.DESCRIBE.DFS.DIRECTORIES.DIRECTORY.DISTINCT.DISTRIBUTE.DIV.DROP.ESCAPE.ESCAPED.EXCEPT.EXCHANGE.EXISTS.EXPORT.EXTENDED.EXTERNAL.EXTRACT.FALSE.FETCH.FIELDS.FILTER.FILEFORMAT.FIRST.FIRST_VALUE.FOLLOWING.FOR.FOREIGN.FORMAT.FORMATTED.FULL.FUNCTION.FUNCTIONS.GLOBAL.GRANT.GROUP.GROUPING.HOUR.IF.IGNORE.IMPORT.IN.INDEX.INDEXES.INNER.INPATH.INPUTFORMAT.INTERSECT.INTO.IS.ITEMS.KEYS.LAST.LAST_VALUE.LATERAL.LAZY.LEADING.LEFT.LIKE.LINES.LIST.LOCAL.LOCATION.LOCK.LOCKS.LOGICAL.MACRO.MATCHED.MERGE.MINUTE.MONTH.MSCK.NAMESPACE.NAMESPACES.NATURAL.NO.NOT.NULL.NULLS.OF.ONLY.OPTION.OPTIONS.OR.ORDER.OUT.OUTER.OUTPUTFORMAT.OVER.OVERLAPS.OVERLAY.OVERWRITE.OWNER.PARTITION.PARTITIONED.PARTITIONS.PERCENT.PLACING.POSITION.PRECEDING.PRIMARY.PRINCIPALS.PROPERTIES.PURGE.QUERY.RANGE.RECORDREADER.RECORDWRITER.RECOVER.REDUCE.REFERENCES.RENAME.REPAIR.REPLACE.RESPECT.RESTRICT.REVOKE.RIGHT.RLIKE.ROLE.ROLES.ROLLBACK.ROLLUP.ROW.ROWS.SCHEMA.SECOND.SELECT.SEMI.SEPARATED.SERDE.SERDEPROPERTIES.SESSION_USER.SETS.SHOW.SKEWED.SOME.SORT.SORTED.START.STATISTICS.STORED.STRATIFY.SUBSTR.SUBSTRING.TABLE.TABLES.TBLPROPERTIES.TEMPORARY.TERMINATED.THEN.TO.TOUCH.TRAILING.TRANSACTION.TRANSACTIONS.TRIM.TRUE.TRUNCATE.UNARCHIVE.UNBOUNDED.UNCACHE.UNIQUE.UNKNOWN.UNLOCK.UNSET.USE.USER.USING.VIEW.WINDOW.YEAR.ANALYSE.ARRAY_ZIP.COALESCE.CONTAINS.CONVERT.DAYS.DAY_HOUR.DAY_MINUTE.DAY_SECOND.DECODE.DEFAULT.DISTINCTROW.ENCODE.EXPLODE.EXPLODE_OUTER.FIXED.GREATEST.GROUP_CONCAT.HOURS.HOUR_MINUTE.HOUR_SECOND.IFNULL.LEAST.LEVEL.MINUTE_SECOND.NULLIF.OFFSET.ON.OPTIMIZE.REGEXP.SEPARATOR.SIZE.TYPE.TYPES.UNSIGNED.VARIABLES.YEAR_MONTH`.split(`.`),vZ=`ARRAY.BIGINT.BINARY.BOOLEAN.BYTE.CHAR.DATE.DEC.DECIMAL.DOUBLE.FLOAT.INT.INTEGER.INTERVAL.LONG.MAP.NUMERIC.REAL.SHORT.SMALLINT.STRING.STRUCT.TIMESTAMP_LTZ.TIMESTAMP_NTZ.TIMESTAMP.TINYINT.VARCHAR`.split(`.`),yZ=`APPROX_COUNT_DISTINCT.APPROX_PERCENTILE.AVG.BIT_AND.BIT_OR.BIT_XOR.BOOL_AND.BOOL_OR.COLLECT_LIST.COLLECT_SET.CORR.COUNT.COUNT.COUNT.COUNT_IF.COUNT_MIN_SKETCH.COVAR_POP.COVAR_SAMP.EVERY.FIRST.FIRST_VALUE.GROUPING.GROUPING_ID.KURTOSIS.LAST.LAST_VALUE.MAX.MAX_BY.MEAN.MIN.MIN_BY.PERCENTILE.PERCENTILE.PERCENTILE_APPROX.SKEWNESS.STD.STDDEV.STDDEV_POP.STDDEV_SAMP.SUM.VAR_POP.VAR_SAMP.VARIANCE.CUME_DIST.DENSE_RANK.LAG.LEAD.NTH_VALUE.NTILE.PERCENT_RANK.RANK.ROW_NUMBER.ARRAY.ARRAY_CONTAINS.ARRAY_DISTINCT.ARRAY_EXCEPT.ARRAY_INTERSECT.ARRAY_JOIN.ARRAY_MAX.ARRAY_MIN.ARRAY_POSITION.ARRAY_REMOVE.ARRAY_REPEAT.ARRAY_UNION.ARRAYS_OVERLAP.ARRAYS_ZIP.FLATTEN.SEQUENCE.SHUFFLE.SLICE.SORT_ARRAY.ELEMENT_AT.ELEMENT_AT.MAP_CONCAT.MAP_ENTRIES.MAP_FROM_ARRAYS.MAP_FROM_ENTRIES.MAP_KEYS.MAP_VALUES.STR_TO_MAP.ADD_MONTHS.CURRENT_DATE.CURRENT_DATE.CURRENT_TIMESTAMP.CURRENT_TIMESTAMP.CURRENT_TIMEZONE.DATE_ADD.DATE_FORMAT.DATE_FROM_UNIX_DATE.DATE_PART.DATE_SUB.DATE_TRUNC.DATEDIFF.DAY.DAYOFMONTH.DAYOFWEEK.DAYOFYEAR.EXTRACT.FROM_UNIXTIME.FROM_UTC_TIMESTAMP.HOUR.LAST_DAY.MAKE_DATE.MAKE_DT_INTERVAL.MAKE_INTERVAL.MAKE_TIMESTAMP.MAKE_YM_INTERVAL.MINUTE.MONTH.MONTHS_BETWEEN.NEXT_DAY.NOW.QUARTER.SECOND.SESSION_WINDOW.TIMESTAMP_MICROS.TIMESTAMP_MILLIS.TIMESTAMP_SECONDS.TO_DATE.TO_TIMESTAMP.TO_UNIX_TIMESTAMP.TO_UTC_TIMESTAMP.TRUNC.UNIX_DATE.UNIX_MICROS.UNIX_MILLIS.UNIX_SECONDS.UNIX_TIMESTAMP.WEEKDAY.WEEKOFYEAR.WINDOW.YEAR.FROM_JSON.GET_JSON_OBJECT.JSON_ARRAY_LENGTH.JSON_OBJECT_KEYS.JSON_TUPLE.SCHEMA_OF_JSON.TO_JSON.ABS.ACOS.ACOSH.AGGREGATE.ARRAY_SORT.ASCII.ASIN.ASINH.ASSERT_TRUE.ATAN.ATAN2.ATANH.BASE64.BIN.BIT_COUNT.BIT_GET.BIT_LENGTH.BROUND.BTRIM.CARDINALITY.CBRT.CEIL.CEILING.CHAR_LENGTH.CHARACTER_LENGTH.CHR.CONCAT.CONCAT_WS.CONV.COS.COSH.COT.CRC32.CURRENT_CATALOG.CURRENT_DATABASE.CURRENT_USER.DEGREES.ELT.EXP.EXPM1.FACTORIAL.FIND_IN_SET.FLOOR.FORALL.FORMAT_NUMBER.FORMAT_STRING.FROM_CSV.GETBIT.HASH.HEX.HYPOT.INITCAP.INLINE.INLINE_OUTER.INPUT_FILE_BLOCK_LENGTH.INPUT_FILE_BLOCK_START.INPUT_FILE_NAME.INSTR.ISNAN.ISNOTNULL.ISNULL.JAVA_METHOD.LCASE.LEFT.LENGTH.LEVENSHTEIN.LN.LOCATE.LOG.LOG10.LOG1P.LOG2.LOWER.LPAD.LTRIM.MAP_FILTER.MAP_ZIP_WITH.MD5.MOD.MONOTONICALLY_INCREASING_ID.NAMED_STRUCT.NANVL.NEGATIVE.NVL.NVL2.OCTET_LENGTH.OVERLAY.PARSE_URL.PI.PMOD.POSEXPLODE.POSEXPLODE_OUTER.POSITION.POSITIVE.POW.POWER.PRINTF.RADIANS.RAISE_ERROR.RAND.RANDN.RANDOM.REFLECT.REGEXP_EXTRACT.REGEXP_EXTRACT_ALL.REGEXP_LIKE.REGEXP_REPLACE.REPEAT.REPLACE.REVERSE.RIGHT.RINT.ROUND.RPAD.RTRIM.SCHEMA_OF_CSV.SENTENCES.SHA.SHA1.SHA2.SHIFTLEFT.SHIFTRIGHT.SHIFTRIGHTUNSIGNED.SIGN.SIGNUM.SIN.SINH.SOUNDEX.SPACE.SPARK_PARTITION_ID.SPLIT.SQRT.STACK.SUBSTR.SUBSTRING.SUBSTRING_INDEX.TAN.TANH.TO_CSV.TRANSFORM_KEYS.TRANSFORM_VALUES.TRANSLATE.TRIM.TRY_ADD.TRY_DIVIDE.TYPEOF.UCASE.UNBASE64.UNHEX.UPPER.UUID.VERSION.WIDTH_BUCKET.XPATH.XPATH_BOOLEAN.XPATH_DOUBLE.XPATH_FLOAT.XPATH_INT.XPATH_LONG.XPATH_NUMBER.XPATH_SHORT.XPATH_STRING.XXHASH64.ZIP_WITH.CAST.COALESCE.NULLIF`.split(`.`),bZ=Y([`SELECT [ALL | DISTINCT]`]),xZ=Y([`WITH`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`SORT BY`,`CLUSTER BY`,`DISTRIBUTE BY`,`LIMIT`,`INSERT [INTO | OVERWRITE] [TABLE]`,`VALUES`,`INSERT OVERWRITE [LOCAL] DIRECTORY`,`LOAD DATA [LOCAL] INPATH`,`[OVERWRITE] INTO TABLE`]),SZ=Y([`CREATE [EXTERNAL] TABLE [IF NOT EXISTS]`]),CZ=Y(`CREATE [OR REPLACE] [GLOBAL TEMPORARY | TEMPORARY] VIEW [IF NOT EXISTS].DROP TABLE [IF EXISTS].ALTER TABLE.ADD COLUMNS.DROP {COLUMN | COLUMNS}.RENAME TO.RENAME COLUMN.ALTER COLUMN.TRUNCATE TABLE.LATERAL VIEW.ALTER DATABASE.ALTER VIEW.CREATE DATABASE.CREATE FUNCTION.DROP DATABASE.DROP FUNCTION.DROP VIEW.REPAIR TABLE.USE DATABASE.TABLESAMPLE.PIVOT.TRANSFORM.EXPLAIN.ADD FILE.ADD JAR.ANALYZE TABLE.CACHE TABLE.CLEAR CACHE.DESCRIBE DATABASE.DESCRIBE FUNCTION.DESCRIBE QUERY.DESCRIBE TABLE.LIST FILE.LIST JAR.REFRESH.REFRESH TABLE.REFRESH FUNCTION.RESET.SHOW COLUMNS.SHOW CREATE TABLE.SHOW DATABASES.SHOW FUNCTIONS.SHOW PARTITIONS.SHOW TABLE EXTENDED.SHOW TABLES.SHOW TBLPROPERTIES.SHOW VIEWS.UNCACHE TABLE`.split(`.`)),wZ=Y([`UNION [ALL | DISTINCT]`,`EXCEPT [ALL | DISTINCT]`,`INTERSECT [ALL | DISTINCT]`]),TZ=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL [INNER] JOIN`,`NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN`,`[LEFT] {ANTI | SEMI} JOIN`,`NATURAL [LEFT] {ANTI | SEMI} JOIN`]),EZ=Y([`ON DELETE`,`ON UPDATE`,`CURRENT ROW`,`{ROWS | RANGE} BETWEEN`]),DZ=Y([]),OZ={name:`spark`,tokenizerOptions:{reservedSelect:bZ,reservedClauses:[...xZ,...SZ,...CZ],reservedSetOperations:wZ,reservedJoins:TZ,reservedKeywordPhrases:EZ,reservedDataTypePhrases:DZ,supportsXor:!0,reservedKeywords:_Z,reservedDataTypes:vZ,reservedFunctionNames:yZ,extraParens:[`[]`],stringTypes:[`''-bs`,`""-bs`,{quote:`''-raw`,prefixes:[`R`,`X`],requirePrefix:!0},{quote:`""-raw`,prefixes:[`R`,`X`],requirePrefix:!0}],identTypes:["``"],identChars:{allowFirstCharNumber:!0},variableTypes:[{quote:`{}`,prefixes:[`$`],requirePrefix:!0}],operators:[`%`,`~`,`^`,`|`,`&`,`<=>`,`==`,`!`,`||`,`->`],postProcess:kZ},formatOptions:{onelineClauses:[...SZ,...CZ],tabularOnelineClauses:CZ}};function kZ(e){return e.map((t,n)=>{let r=e[n-1]||fJ,i=e[n+1]||fJ;return mJ.WINDOW(t)&&i.type===X.OPEN_PAREN?Object.assign(Object.assign({},t),{type:X.RESERVED_FUNCTION_NAME}):t.text===`ITEMS`&&t.type===X.RESERVED_KEYWORD&&!(r.text===`COLLECTION`&&i.text===`TERMINATED`)?Object.assign(Object.assign({},t),{type:X.IDENTIFIER,text:t.raw}):t})}var AZ=`ABS.CHANGES.CHAR.COALESCE.FORMAT.GLOB.HEX.IFNULL.IIF.INSTR.LAST_INSERT_ROWID.LENGTH.LIKE.LIKELIHOOD.LIKELY.LOAD_EXTENSION.LOWER.LTRIM.NULLIF.PRINTF.QUOTE.RANDOM.RANDOMBLOB.REPLACE.ROUND.RTRIM.SIGN.SOUNDEX.SQLITE_COMPILEOPTION_GET.SQLITE_COMPILEOPTION_USED.SQLITE_OFFSET.SQLITE_SOURCE_ID.SQLITE_VERSION.SUBSTR.SUBSTRING.TOTAL_CHANGES.TRIM.TYPEOF.UNICODE.UNLIKELY.UPPER.ZEROBLOB.AVG.COUNT.GROUP_CONCAT.MAX.MIN.SUM.TOTAL.DATE.TIME.DATETIME.JULIANDAY.UNIXEPOCH.STRFTIME.row_number.rank.dense_rank.percent_rank.cume_dist.ntile.lag.lead.first_value.last_value.nth_value.ACOS.ACOSH.ASIN.ASINH.ATAN.ATAN2.ATANH.CEIL.CEILING.COS.COSH.DEGREES.EXP.FLOOR.LN.LOG.LOG.LOG10.LOG2.MOD.PI.POW.POWER.RADIANS.SIN.SINH.SQRT.TAN.TANH.TRUNC.JSON.JSON_ARRAY.JSON_ARRAY_LENGTH.JSON_ARRAY_LENGTH.JSON_EXTRACT.JSON_INSERT.JSON_OBJECT.JSON_PATCH.JSON_REMOVE.JSON_REPLACE.JSON_SET.JSON_TYPE.JSON_TYPE.JSON_VALID.JSON_QUOTE.JSON_GROUP_ARRAY.JSON_GROUP_OBJECT.JSON_EACH.JSON_TREE.CAST`.split(`.`),jZ=`ABORT.ACTION.ADD.AFTER.ALL.ALTER.AND.ARE.ALWAYS.ANALYZE.AS.ASC.ATTACH.AUTOINCREMENT.BEFORE.BEGIN.BETWEEN.BY.CASCADE.CASE.CAST.CHECK.COLLATE.COLUMN.COMMIT.CONFLICT.CONSTRAINT.CREATE.CROSS.CURRENT.CURRENT_DATE.CURRENT_TIME.CURRENT_TIMESTAMP.DATABASE.DEFAULT.DEFERRABLE.DEFERRED.DELETE.DESC.DETACH.DISTINCT.DO.DROP.EACH.ELSE.END.ESCAPE.EXCEPT.EXCLUDE.EXCLUSIVE.EXISTS.EXPLAIN.FAIL.FILTER.FIRST.FOLLOWING.FOR.FOREIGN.FROM.FULL.GENERATED.GLOB.GROUP.HAVING.IF.IGNORE.IMMEDIATE.IN.INDEX.INDEXED.INITIALLY.INNER.INSERT.INSTEAD.INTERSECT.INTO.IS.ISNULL.JOIN.KEY.LAST.LEFT.LIKE.LIMIT.MATCH.MATERIALIZED.NATURAL.NO.NOT.NOTHING.NOTNULL.NULL.NULLS.OF.OFFSET.ON.ONLY.OPEN.OR.ORDER.OTHERS.OUTER.OVER.PARTITION.PLAN.PRAGMA.PRECEDING.PRIMARY.QUERY.RAISE.RANGE.RECURSIVE.REFERENCES.REGEXP.REINDEX.RELEASE.RENAME.REPLACE.RESTRICT.RETURNING.RIGHT.ROLLBACK.ROW.ROWS.SAVEPOINT.SELECT.SET.TABLE.TEMP.TEMPORARY.THEN.TIES.TO.TRANSACTION.TRIGGER.UNBOUNDED.UNION.UNIQUE.UPDATE.USING.VACUUM.VALUES.VIEW.VIRTUAL.WHEN.WHERE.WINDOW.WITH.WITHOUT`.split(`.`),MZ=[`ANY`,`ARRAY`,`BLOB`,`CHARACTER`,`DECIMAL`,`INT`,`INTEGER`,`NATIVE CHARACTER`,`NCHAR`,`NUMERIC`,`NVARCHAR`,`REAL`,`TEXT`,`VARCHAR`,`VARYING CHARACTER`],NZ=Y([`SELECT [ALL | DISTINCT]`]),PZ=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`INSERT [OR ABORT | OR FAIL | OR IGNORE | OR REPLACE | OR ROLLBACK] INTO`,`REPLACE INTO`,`VALUES`,`SET`,`RETURNING`]),FZ=Y([`CREATE [TEMPORARY | TEMP] TABLE [IF NOT EXISTS]`]),IZ=Y([`CREATE [TEMPORARY | TEMP] VIEW [IF NOT EXISTS]`,`UPDATE [OR ABORT | OR FAIL | OR IGNORE | OR REPLACE | OR ROLLBACK]`,`ON CONFLICT`,`DELETE FROM`,`DROP TABLE [IF EXISTS]`,`ALTER TABLE`,`ADD [COLUMN]`,`DROP [COLUMN]`,`RENAME [COLUMN]`,`RENAME TO`,`SET SCHEMA`]),LZ=Y([`UNION [ALL]`,`EXCEPT`,`INTERSECT`]),RZ=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL [INNER] JOIN`,`NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN`]),zZ=Y([`ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]`,`{ROWS | RANGE | GROUPS} BETWEEN`,`DO UPDATE`]),BZ=Y([]),VZ={name:`sqlite`,tokenizerOptions:{reservedSelect:NZ,reservedClauses:[...PZ,...FZ,...IZ],reservedSetOperations:LZ,reservedJoins:RZ,reservedKeywordPhrases:zZ,reservedDataTypePhrases:BZ,reservedKeywords:jZ,reservedDataTypes:MZ,reservedFunctionNames:AZ,stringTypes:[`''-qq`,{quote:`''-raw`,prefixes:[`X`],requirePrefix:!0}],identTypes:[`""-qq`,"``",`[]`],paramTypes:{positional:!0,numbered:[`?`],named:[`:`,`@`],custom:[{regex:String.raw`\$[a-zA-Z_][a-zA-Z0-9_]*(?:::[a-zA-Z_][a-zA-Z0-9_]*)*(?:\([^)]*\))?`,key:e=>e.slice(1)}]},operators:[`%`,`~`,`&`,`|`,`<<`,`>>`,`==`,`->`,`->>`,`||`]},formatOptions:{onelineClauses:[...FZ,...IZ],tabularOnelineClauses:IZ}},HZ=`GROUPING.RANK.DENSE_RANK.PERCENT_RANK.CUME_DIST.ROW_NUMBER.POSITION.OCCURRENCES_REGEX.POSITION_REGEX.EXTRACT.CHAR_LENGTH.CHARACTER_LENGTH.OCTET_LENGTH.CARDINALITY.ABS.MOD.LN.EXP.POWER.SQRT.FLOOR.CEIL.CEILING.WIDTH_BUCKET.SUBSTRING.SUBSTRING_REGEX.UPPER.LOWER.CONVERT.TRANSLATE.TRANSLATE_REGEX.TRIM.OVERLAY.NORMALIZE.SPECIFICTYPE.CURRENT_DATE.CURRENT_TIME.LOCALTIME.CURRENT_TIMESTAMP.LOCALTIMESTAMP.COUNT.AVG.MAX.MIN.SUM.STDDEV_POP.STDDEV_SAMP.VAR_SAMP.VAR_POP.COLLECT.FUSION.INTERSECTION.COVAR_POP.COVAR_SAMP.CORR.REGR_SLOPE.REGR_INTERCEPT.REGR_COUNT.REGR_R2.REGR_AVGX.REGR_AVGY.REGR_SXX.REGR_SYY.REGR_SXY.PERCENTILE_CONT.PERCENTILE_DISC.CAST.COALESCE.NULLIF.ROUND.SIN.COS.TAN.ASIN.ACOS.ATAN`.split(`.`),UZ=`ALL.ALLOCATE.ALTER.ANY.ARE.AS.ASC.ASENSITIVE.ASYMMETRIC.AT.ATOMIC.AUTHORIZATION.BEGIN.BETWEEN.BOTH.BY.CALL.CALLED.CASCADED.CAST.CHECK.CLOSE.COALESCE.COLLATE.COLUMN.COMMIT.CONDITION.CONNECT.CONSTRAINT.CORRESPONDING.CREATE.CROSS.CUBE.CURRENT.CURRENT_CATALOG.CURRENT_DEFAULT_TRANSFORM_GROUP.CURRENT_PATH.CURRENT_ROLE.CURRENT_SCHEMA.CURRENT_TRANSFORM_GROUP_FOR_TYPE.CURRENT_USER.CURSOR.CYCLE.DEALLOCATE.DAY.DECLARE.DEFAULT.DELETE.DEREF.DESC.DESCRIBE.DETERMINISTIC.DISCONNECT.DISTINCT.DROP.DYNAMIC.EACH.ELEMENT.END-EXEC.ESCAPE.EVERY.EXCEPT.EXEC.EXECUTE.EXISTS.EXTERNAL.FALSE.FETCH.FILTER.FOR.FOREIGN.FREE.FROM.FULL.FUNCTION.GET.GLOBAL.GRANT.GROUP.HAVING.HOLD.HOUR.IDENTITY.IN.INDICATOR.INNER.INOUT.INSENSITIVE.INSERT.INTERSECT.INTO.IS.LANGUAGE.LARGE.LATERAL.LEADING.LEFT.LIKE.LIKE_REGEX.LOCAL.MATCH.MEMBER.MERGE.METHOD.MINUTE.MODIFIES.MODULE.MONTH.NATURAL.NEW.NO.NONE.NOT.NULL.NULLIF.OF.OLD.ON.ONLY.OPEN.ORDER.OUT.OUTER.OVER.OVERLAPS.PARAMETER.PARTITION.PRECISION.PREPARE.PRIMARY.PROCEDURE.RANGE.READS.REAL.RECURSIVE.REF.REFERENCES.REFERENCING.RELEASE.RESULT.RETURN.RETURNS.REVOKE.RIGHT.ROLLBACK.ROLLUP.ROW.ROWS.SAVEPOINT.SCOPE.SCROLL.SEARCH.SECOND.SELECT.SENSITIVE.SESSION_USER.SET.SIMILAR.SOME.SPECIFIC.SQL.SQLEXCEPTION.SQLSTATE.SQLWARNING.START.STATIC.SUBMULTISET.SYMMETRIC.SYSTEM.SYSTEM_USER.TABLE.TABLESAMPLE.THEN.TIMEZONE_HOUR.TIMEZONE_MINUTE.TO.TRAILING.TRANSLATION.TREAT.TRIGGER.TRUE.UESCAPE.UNION.UNIQUE.UNKNOWN.UNNEST.UPDATE.USER.USING.VALUE.VALUES.WHENEVER.WINDOW.WITHIN.WITHOUT.YEAR`.split(`.`),WZ=`ARRAY.BIGINT.BINARY LARGE OBJECT.BINARY VARYING.BINARY.BLOB.BOOLEAN.CHAR LARGE OBJECT.CHAR VARYING.CHAR.CHARACTER LARGE OBJECT.CHARACTER VARYING.CHARACTER.CLOB.DATE.DEC.DECIMAL.DOUBLE.FLOAT.INT.INTEGER.INTERVAL.MULTISET.NATIONAL CHAR VARYING.NATIONAL CHAR.NATIONAL CHARACTER LARGE OBJECT.NATIONAL CHARACTER VARYING.NATIONAL CHARACTER.NCHAR LARGE OBJECT.NCHAR VARYING.NCHAR.NCLOB.NUMERIC.SMALLINT.TIME.TIMESTAMP.VARBINARY.VARCHAR`.split(`.`),GZ=Y([`SELECT [ALL | DISTINCT]`]),KZ=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY [ALL | DISTINCT]`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`FETCH {FIRST | NEXT}`,`INSERT INTO`,`VALUES`,`SET`]),qZ=Y([`CREATE [GLOBAL TEMPORARY | LOCAL TEMPORARY] TABLE`]),JZ=Y([`CREATE [RECURSIVE] VIEW`,`UPDATE`,`WHERE CURRENT OF`,`DELETE FROM`,`DROP TABLE`,`ALTER TABLE`,`ADD COLUMN`,`DROP [COLUMN]`,`RENAME COLUMN`,`RENAME TO`,`ALTER [COLUMN]`,`{SET | DROP} DEFAULT`,`ADD SCOPE`,`DROP SCOPE {CASCADE | RESTRICT}`,`RESTART WITH`,`TRUNCATE TABLE`,`SET SCHEMA`]),YZ=Y([`UNION [ALL | DISTINCT]`,`EXCEPT [ALL | DISTINCT]`,`INTERSECT [ALL | DISTINCT]`]),XZ=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL [INNER] JOIN`,`NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN`]),ZZ=Y([`ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]`,`{ROWS | RANGE} BETWEEN`]),QZ=Y([]),$Z={name:`sql`,tokenizerOptions:{reservedSelect:GZ,reservedClauses:[...KZ,...qZ,...JZ],reservedSetOperations:YZ,reservedJoins:XZ,reservedKeywordPhrases:ZZ,reservedDataTypePhrases:QZ,reservedKeywords:UZ,reservedDataTypes:WZ,reservedFunctionNames:HZ,stringTypes:[{quote:`''-qq-bs`,prefixes:[`N`,`U&`]},{quote:`''-raw`,prefixes:[`X`],requirePrefix:!0}],identTypes:[`""-qq`,"``"],paramTypes:{positional:!0},operators:[`||`]},formatOptions:{onelineClauses:[...qZ,...JZ],tabularOnelineClauses:JZ}},eQ=`ABS.ACOS.ALL_MATCH.ANY_MATCH.APPROX_DISTINCT.APPROX_MOST_FREQUENT.APPROX_PERCENTILE.APPROX_SET.ARBITRARY.ARRAYS_OVERLAP.ARRAY_AGG.ARRAY_DISTINCT.ARRAY_EXCEPT.ARRAY_INTERSECT.ARRAY_JOIN.ARRAY_MAX.ARRAY_MIN.ARRAY_POSITION.ARRAY_REMOVE.ARRAY_SORT.ARRAY_UNION.ASIN.ATAN.ATAN2.AT_TIMEZONE.AVG.BAR.BETA_CDF.BING_TILE.BING_TILES_AROUND.BING_TILE_AT.BING_TILE_COORDINATES.BING_TILE_POLYGON.BING_TILE_QUADKEY.BING_TILE_ZOOM_LEVEL.BITWISE_AND.BITWISE_AND_AGG.BITWISE_LEFT_SHIFT.BITWISE_NOT.BITWISE_OR.BITWISE_OR_AGG.BITWISE_RIGHT_SHIFT.BITWISE_RIGHT_SHIFT_ARITHMETIC.BITWISE_XOR.BIT_COUNT.BOOL_AND.BOOL_OR.CARDINALITY.CAST.CBRT.CEIL.CEILING.CHAR2HEXINT.CHECKSUM.CHR.CLASSIFY.COALESCE.CODEPOINT.COLOR.COMBINATIONS.CONCAT.CONCAT_WS.CONTAINS.CONTAINS_SEQUENCE.CONVEX_HULL_AGG.CORR.COS.COSH.COSINE_SIMILARITY.COUNT.COUNT_IF.COVAR_POP.COVAR_SAMP.CRC32.CUME_DIST.CURRENT_CATALOG.CURRENT_DATE.CURRENT_GROUPS.CURRENT_SCHEMA.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_TIMEZONE.CURRENT_USER.DATE.DATE_ADD.DATE_DIFF.DATE_FORMAT.DATE_PARSE.DATE_TRUNC.DAY.DAY_OF_MONTH.DAY_OF_WEEK.DAY_OF_YEAR.DEGREES.DENSE_RANK.DOW.DOY.E.ELEMENT_AT.EMPTY_APPROX_SET.EVALUATE_CLASSIFIER_PREDICTIONS.EVERY.EXP.EXTRACT.FEATURES.FILTER.FIRST_VALUE.FLATTEN.FLOOR.FORMAT.FORMAT_DATETIME.FORMAT_NUMBER.FROM_BASE.FROM_BASE32.FROM_BASE64.FROM_BASE64URL.FROM_BIG_ENDIAN_32.FROM_BIG_ENDIAN_64.FROM_ENCODED_POLYLINE.FROM_GEOJSON_GEOMETRY.FROM_HEX.FROM_IEEE754_32.FROM_IEEE754_64.FROM_ISO8601_DATE.FROM_ISO8601_TIMESTAMP.FROM_ISO8601_TIMESTAMP_NANOS.FROM_UNIXTIME.FROM_UNIXTIME_NANOS.FROM_UTF8.GEOMETRIC_MEAN.GEOMETRY_FROM_HADOOP_SHAPE.GEOMETRY_INVALID_REASON.GEOMETRY_NEAREST_POINTS.GEOMETRY_TO_BING_TILES.GEOMETRY_UNION.GEOMETRY_UNION_AGG.GREATEST.GREAT_CIRCLE_DISTANCE.HAMMING_DISTANCE.HASH_COUNTS.HISTOGRAM.HMAC_MD5.HMAC_SHA1.HMAC_SHA256.HMAC_SHA512.HOUR.HUMAN_READABLE_SECONDS.IF.INDEX.INFINITY.INTERSECTION_CARDINALITY.INVERSE_BETA_CDF.INVERSE_NORMAL_CDF.IS_FINITE.IS_INFINITE.IS_JSON_SCALAR.IS_NAN.JACCARD_INDEX.JSON_ARRAY_CONTAINS.JSON_ARRAY_GET.JSON_ARRAY_LENGTH.JSON_EXISTS.JSON_EXTRACT.JSON_EXTRACT_SCALAR.JSON_FORMAT.JSON_PARSE.JSON_QUERY.JSON_SIZE.JSON_VALUE.KURTOSIS.LAG.LAST_DAY_OF_MONTH.LAST_VALUE.LEAD.LEARN_CLASSIFIER.LEARN_LIBSVM_CLASSIFIER.LEARN_LIBSVM_REGRESSOR.LEARN_REGRESSOR.LEAST.LENGTH.LEVENSHTEIN_DISTANCE.LINE_INTERPOLATE_POINT.LINE_INTERPOLATE_POINTS.LINE_LOCATE_POINT.LISTAGG.LN.LOCALTIME.LOCALTIMESTAMP.LOG.LOG10.LOG2.LOWER.LPAD.LTRIM.LUHN_CHECK.MAKE_SET_DIGEST.MAP.MAP_AGG.MAP_CONCAT.MAP_ENTRIES.MAP_FILTER.MAP_FROM_ENTRIES.MAP_KEYS.MAP_UNION.MAP_VALUES.MAP_ZIP_WITH.MAX.MAX_BY.MD5.MERGE.MERGE_SET_DIGEST.MILLISECOND.MIN.MINUTE.MIN_BY.MOD.MONTH.MULTIMAP_AGG.MULTIMAP_FROM_ENTRIES.MURMUR3.NAN.NGRAMS.NONE_MATCH.NORMALIZE.NORMAL_CDF.NOW.NTH_VALUE.NTILE.NULLIF.NUMERIC_HISTOGRAM.OBJECTID.OBJECTID_TIMESTAMP.PARSE_DATA_SIZE.PARSE_DATETIME.PARSE_DURATION.PERCENT_RANK.PI.POSITION.POW.POWER.QDIGEST_AGG.QUARTER.RADIANS.RAND.RANDOM.RANK.REDUCE.REDUCE_AGG.REGEXP_COUNT.REGEXP_EXTRACT.REGEXP_EXTRACT_ALL.REGEXP_LIKE.REGEXP_POSITION.REGEXP_REPLACE.REGEXP_SPLIT.REGRESS.REGR_INTERCEPT.REGR_SLOPE.RENDER.REPEAT.REPLACE.REVERSE.RGB.ROUND.ROW_NUMBER.RPAD.RTRIM.SECOND.SEQUENCE.SHA1.SHA256.SHA512.SHUFFLE.SIGN.SIMPLIFY_GEOMETRY.SIN.SKEWNESS.SLICE.SOUNDEX.SPATIAL_PARTITIONING.SPATIAL_PARTITIONS.SPLIT.SPLIT_PART.SPLIT_TO_MAP.SPLIT_TO_MULTIMAP.SPOOKY_HASH_V2_32.SPOOKY_HASH_V2_64.SQRT.STARTS_WITH.STDDEV.STDDEV_POP.STDDEV_SAMP.STRPOS.ST_AREA.ST_ASBINARY.ST_ASTEXT.ST_BOUNDARY.ST_BUFFER.ST_CENTROID.ST_CONTAINS.ST_CONVEXHULL.ST_COORDDIM.ST_CROSSES.ST_DIFFERENCE.ST_DIMENSION.ST_DISJOINT.ST_DISTANCE.ST_ENDPOINT.ST_ENVELOPE.ST_ENVELOPEASPTS.ST_EQUALS.ST_EXTERIORRING.ST_GEOMETRIES.ST_GEOMETRYFROMTEXT.ST_GEOMETRYN.ST_GEOMETRYTYPE.ST_GEOMFROMBINARY.ST_INTERIORRINGN.ST_INTERIORRINGS.ST_INTERSECTION.ST_INTERSECTS.ST_ISCLOSED.ST_ISEMPTY.ST_ISRING.ST_ISSIMPLE.ST_ISVALID.ST_LENGTH.ST_LINEFROMTEXT.ST_LINESTRING.ST_MULTIPOINT.ST_NUMGEOMETRIES.ST_NUMINTERIORRING.ST_NUMPOINTS.ST_OVERLAPS.ST_POINT.ST_POINTN.ST_POINTS.ST_POLYGON.ST_RELATE.ST_STARTPOINT.ST_SYMDIFFERENCE.ST_TOUCHES.ST_UNION.ST_WITHIN.ST_X.ST_XMAX.ST_XMIN.ST_Y.ST_YMAX.ST_YMIN.SUBSTR.SUBSTRING.SUM.TAN.TANH.TDIGEST_AGG.TIMESTAMP_OBJECTID.TIMEZONE_HOUR.TIMEZONE_MINUTE.TO_BASE.TO_BASE32.TO_BASE64.TO_BASE64URL.TO_BIG_ENDIAN_32.TO_BIG_ENDIAN_64.TO_CHAR.TO_DATE.TO_ENCODED_POLYLINE.TO_GEOJSON_GEOMETRY.TO_GEOMETRY.TO_HEX.TO_IEEE754_32.TO_IEEE754_64.TO_ISO8601.TO_MILLISECONDS.TO_SPHERICAL_GEOGRAPHY.TO_TIMESTAMP.TO_UNIXTIME.TO_UTF8.TRANSFORM.TRANSFORM_KEYS.TRANSFORM_VALUES.TRANSLATE.TRIM.TRIM_ARRAY.TRUNCATE.TRY.TRY_CAST.TYPEOF.UPPER.URL_DECODE.URL_ENCODE.URL_EXTRACT_FRAGMENT.URL_EXTRACT_HOST.URL_EXTRACT_PARAMETER.URL_EXTRACT_PATH.URL_EXTRACT_PORT.URL_EXTRACT_PROTOCOL.URL_EXTRACT_QUERY.UUID.VALUES_AT_QUANTILES.VALUE_AT_QUANTILE.VARIANCE.VAR_POP.VAR_SAMP.VERSION.WEEK.WEEK_OF_YEAR.WIDTH_BUCKET.WILSON_INTERVAL_LOWER.WILSON_INTERVAL_UPPER.WITH_TIMEZONE.WORD_STEM.XXHASH64.YEAR.YEAR_OF_WEEK.YOW.ZIP.ZIP_WITH.CLASSIFIER.FIRST.LAST.MATCH_NUMBER.NEXT.PERMUTE.PREV`.split(`.`),tQ=`ABSENT.ADD.ADMIN.AFTER.ALL.ALTER.ANALYZE.AND.ANY.AS.ASC.AT.AUTHORIZATION.BERNOULLI.BETWEEN.BOTH.BY.CALL.CASCADE.CASE.CATALOGS.COLUMN.COLUMNS.COMMENT.COMMIT.COMMITTED.CONDITIONAL.CONSTRAINT.COPARTITION.CREATE.CROSS.CUBE.CURRENT.CURRENT_PATH.CURRENT_ROLE.DATA.DEALLOCATE.DEFAULT.DEFINE.DEFINER.DELETE.DENY.DESC.DESCRIBE.DESCRIPTOR.DISTINCT.DISTRIBUTED.DOUBLE.DROP.ELSE.EMPTY.ENCODING.END.ERROR.ESCAPE.EXCEPT.EXCLUDING.EXECUTE.EXISTS.EXPLAIN.FALSE.FETCH.FINAL.FIRST.FOLLOWING.FOR.FROM.FULL.FUNCTIONS.GRANT.GRANTED.GRANTS.GRAPHVIZ.GROUP.GROUPING.GROUPS.HAVING.IGNORE.IN.INCLUDING.INITIAL.INNER.INPUT.INSERT.INTERSECT.INTERVAL.INTO.INVOKER.IO.IS.ISOLATION.JOIN.JSON.JSON_ARRAY.JSON_OBJECT.KEEP.KEY.KEYS.LAST.LATERAL.LEADING.LEFT.LEVEL.LIKE.LIMIT.LOCAL.LOGICAL.MATCH.MATCHED.MATCHES.MATCH_RECOGNIZE.MATERIALIZED.MEASURES.NATURAL.NEXT.NFC.NFD.NFKC.NFKD.NO.NONE.NOT.NULL.NULLS.OBJECT.OF.OFFSET.OMIT.ON.ONE.ONLY.OPTION.OR.ORDER.ORDINALITY.OUTER.OUTPUT.OVER.OVERFLOW.PARTITION.PARTITIONS.PASSING.PAST.PATH.PATTERN.PER.PERMUTE.PRECEDING.PRECISION.PREPARE.PRIVILEGES.PROPERTIES.PRUNE.QUOTES.RANGE.READ.RECURSIVE.REFRESH.RENAME.REPEATABLE.RESET.RESPECT.RESTRICT.RETURNING.REVOKE.RIGHT.ROLE.ROLES.ROLLBACK.ROLLUP.ROW.ROWS.RUNNING.SCALAR.SCHEMA.SCHEMAS.SECURITY.SEEK.SELECT.SERIALIZABLE.SESSION.SET.SETS.SHOW.SKIP.SOME.START.STATS.STRING.SUBSET.SYSTEM.TABLE.TABLES.TABLESAMPLE.TEXT.THEN.TIES.TIME.TIMESTAMP.TO.TRAILING.TRANSACTION.TRUE.TYPE.UESCAPE.UNBOUNDED.UNCOMMITTED.UNCONDITIONAL.UNION.UNIQUE.UNKNOWN.UNMATCHED.UNNEST.UPDATE.USE.USER.USING.UTF16.UTF32.UTF8.VALIDATE.VALUE.VALUES.VERBOSE.VIEW.WHEN.WHERE.WINDOW.WITH.WITHIN.WITHOUT.WORK.WRAPPER.WRITE.ZONE`.split(`.`),nQ=`BIGINT.INT.INTEGER.SMALLINT.TINYINT.BOOLEAN.DATE.DECIMAL.REAL.DOUBLE.HYPERLOGLOG.QDIGEST.TDIGEST.P4HYPERLOGLOG.INTERVAL.TIMESTAMP.TIME.VARBINARY.VARCHAR.CHAR.ROW.ARRAY.MAP.JSON.JSON2016.IPADDRESS.GEOMETRY.UUID.SETDIGEST.JONIREGEXP.RE2JREGEXP.LIKEPATTERN.COLOR.CODEPOINTS.FUNCTION.JSONPATH`.split(`.`),rQ=Y([`SELECT [ALL | DISTINCT]`]),iQ=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY [ALL | DISTINCT]`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`FETCH {FIRST | NEXT}`,`INSERT INTO`,`VALUES`,`SET`,`MATCH_RECOGNIZE`,`MEASURES`,`ONE ROW PER MATCH`,`ALL ROWS PER MATCH`,`AFTER MATCH`,`PATTERN`,`SUBSET`,`DEFINE`]),aQ=Y([`CREATE TABLE [IF NOT EXISTS]`]),oQ=Y(`CREATE [OR REPLACE] [MATERIALIZED] VIEW.UPDATE.DELETE FROM.DROP TABLE [IF EXISTS].ALTER TABLE [IF EXISTS].ADD COLUMN [IF NOT EXISTS].DROP COLUMN [IF EXISTS].RENAME COLUMN [IF EXISTS].RENAME TO.SET AUTHORIZATION [USER | ROLE].SET PROPERTIES.EXECUTE.TRUNCATE TABLE.ALTER SCHEMA.ALTER MATERIALIZED VIEW.ALTER VIEW.CREATE SCHEMA.CREATE ROLE.DROP SCHEMA.DROP MATERIALIZED VIEW.DROP VIEW.DROP ROLE.EXPLAIN.ANALYZE.EXPLAIN ANALYZE.EXPLAIN ANALYZE VERBOSE.USE.DESCRIBE INPUT.DESCRIBE OUTPUT.REFRESH MATERIALIZED VIEW.RESET SESSION.SET SESSION.SET PATH.SET TIME ZONE.SHOW GRANTS.SHOW CREATE TABLE.SHOW CREATE SCHEMA.SHOW CREATE VIEW.SHOW CREATE MATERIALIZED VIEW.SHOW TABLES.SHOW SCHEMAS.SHOW CATALOGS.SHOW COLUMNS.SHOW STATS FOR.SHOW ROLES.SHOW CURRENT ROLES.SHOW ROLE GRANTS.SHOW FUNCTIONS.SHOW SESSION`.split(`.`)),sQ=Y([`UNION [ALL | DISTINCT] [CORRESPONDING]`,`EXCEPT [ALL | DISTINCT] [CORRESPONDING]`,`INTERSECT [ALL | DISTINCT] [CORRESPONDING]`]),cQ=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL [INNER] JOIN`,`NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN`]),lQ=Y([`{ROWS | RANGE | GROUPS} BETWEEN`,`IS [NOT] DISTINCT FROM`,`[TIMESTAMP | TIME] {WITH | WITHOUT} TIME ZONE`]),uQ=Y([]),dQ={name:`trino`,tokenizerOptions:{reservedSelect:rQ,reservedClauses:[...iQ,...aQ,...oQ],reservedSetOperations:sQ,reservedJoins:cQ,reservedKeywordPhrases:lQ,reservedDataTypePhrases:uQ,reservedKeywords:tQ,reservedDataTypes:nQ,reservedFunctionNames:eQ,extraParens:[`[]`,`{}`],stringTypes:[{quote:`''-qq`,prefixes:[`U&`]},{quote:`''-raw`,prefixes:[`X`],requirePrefix:!0}],identTypes:[`""-qq`],paramTypes:{positional:!0},operators:[`%`,`->`,`=>`,`:`,`||`,`|`,`^`,`$`]},formatOptions:{onelineClauses:[...aQ,...oQ],tabularOnelineClauses:oQ}},fQ=`APPROX_COUNT_DISTINCT.AVG.CHECKSUM_AGG.COUNT.COUNT_BIG.GROUPING.GROUPING_ID.MAX.MIN.STDEV.STDEVP.SUM.VAR.VARP.CUME_DIST.FIRST_VALUE.LAG.LAST_VALUE.LEAD.PERCENTILE_CONT.PERCENTILE_DISC.PERCENT_RANK.Collation - COLLATIONPROPERTY.Collation - TERTIARY_WEIGHTS.@@DBTS.@@LANGID.@@LANGUAGE.@@LOCK_TIMEOUT.@@MAX_CONNECTIONS.@@MAX_PRECISION.@@NESTLEVEL.@@OPTIONS.@@REMSERVER.@@SERVERNAME.@@SERVICENAME.@@SPID.@@TEXTSIZE.@@VERSION.CAST.CONVERT.PARSE.TRY_CAST.TRY_CONVERT.TRY_PARSE.ASYMKEY_ID.ASYMKEYPROPERTY.CERTPROPERTY.CERT_ID.CRYPT_GEN_RANDOM.DECRYPTBYASYMKEY.DECRYPTBYCERT.DECRYPTBYKEY.DECRYPTBYKEYAUTOASYMKEY.DECRYPTBYKEYAUTOCERT.DECRYPTBYPASSPHRASE.ENCRYPTBYASYMKEY.ENCRYPTBYCERT.ENCRYPTBYKEY.ENCRYPTBYPASSPHRASE.HASHBYTES.IS_OBJECTSIGNED.KEY_GUID.KEY_ID.KEY_NAME.SIGNBYASYMKEY.SIGNBYCERT.SYMKEYPROPERTY.VERIFYSIGNEDBYCERT.VERIFYSIGNEDBYASYMKEY.@@CURSOR_ROWS.@@FETCH_STATUS.CURSOR_STATUS.DATALENGTH.IDENT_CURRENT.IDENT_INCR.IDENT_SEED.IDENTITY.SQL_VARIANT_PROPERTY.@@DATEFIRST.CURRENT_TIMESTAMP.CURRENT_TIMEZONE.CURRENT_TIMEZONE_ID.DATEADD.DATEDIFF.DATEDIFF_BIG.DATEFROMPARTS.DATENAME.DATEPART.DATETIME2FROMPARTS.DATETIMEFROMPARTS.DATETIMEOFFSETFROMPARTS.DAY.EOMONTH.GETDATE.GETUTCDATE.ISDATE.MONTH.SMALLDATETIMEFROMPARTS.SWITCHOFFSET.SYSDATETIME.SYSDATETIMEOFFSET.SYSUTCDATETIME.TIMEFROMPARTS.TODATETIMEOFFSET.YEAR.JSON.ISJSON.OPENJSON.JSON_VALUE.JSON_QUERY.JSON_MODIFY.ABS.ACOS.ASIN.ATAN.ATN2.CEILING.COS.COT.DEGREES.EXP.FLOOR.LOG.LOG10.PI.POWER.RADIANS.RAND.ROUND.SIGN.SIN.SQRT.SQUARE.TAN.CHOOSE.GREATEST.IIF.LEAST.@@PROCID.APP_NAME.APPLOCK_MODE.APPLOCK_TEST.ASSEMBLYPROPERTY.COL_LENGTH.COL_NAME.COLUMNPROPERTY.DATABASEPROPERTYEX.DB_ID.DB_NAME.FILE_ID.FILE_IDEX.FILE_NAME.FILEGROUP_ID.FILEGROUP_NAME.FILEGROUPPROPERTY.FILEPROPERTY.FILEPROPERTYEX.FULLTEXTCATALOGPROPERTY.FULLTEXTSERVICEPROPERTY.INDEX_COL.INDEXKEY_PROPERTY.INDEXPROPERTY.NEXT VALUE FOR.OBJECT_DEFINITION.OBJECT_ID.OBJECT_NAME.OBJECT_SCHEMA_NAME.OBJECTPROPERTY.OBJECTPROPERTYEX.ORIGINAL_DB_NAME.PARSENAME.SCHEMA_ID.SCHEMA_NAME.SCOPE_IDENTITY.SERVERPROPERTY.STATS_DATE.TYPE_ID.TYPE_NAME.TYPEPROPERTY.DENSE_RANK.NTILE.RANK.ROW_NUMBER.PUBLISHINGSERVERNAME.CERTENCODED.CERTPRIVATEKEY.CURRENT_USER.DATABASE_PRINCIPAL_ID.HAS_DBACCESS.HAS_PERMS_BY_NAME.IS_MEMBER.IS_ROLEMEMBER.IS_SRVROLEMEMBER.LOGINPROPERTY.ORIGINAL_LOGIN.PERMISSIONS.PWDENCRYPT.PWDCOMPARE.SESSION_USER.SESSIONPROPERTY.SUSER_ID.SUSER_NAME.SUSER_SID.SUSER_SNAME.SYSTEM_USER.USER.USER_ID.USER_NAME.ASCII.CHARINDEX.CONCAT.CONCAT_WS.DIFFERENCE.FORMAT.LEFT.LEN.LOWER.LTRIM.PATINDEX.QUOTENAME.REPLACE.REPLICATE.REVERSE.RIGHT.RTRIM.SOUNDEX.SPACE.STR.STRING_AGG.STRING_ESCAPE.STUFF.SUBSTRING.TRANSLATE.TRIM.UNICODE.UPPER.$PARTITION.@@ERROR.@@IDENTITY.@@PACK_RECEIVED.@@ROWCOUNT.@@TRANCOUNT.BINARY_CHECKSUM.CHECKSUM.COMPRESS.CONNECTIONPROPERTY.CONTEXT_INFO.CURRENT_REQUEST_ID.CURRENT_TRANSACTION_ID.DECOMPRESS.ERROR_LINE.ERROR_MESSAGE.ERROR_NUMBER.ERROR_PROCEDURE.ERROR_SEVERITY.ERROR_STATE.FORMATMESSAGE.GET_FILESTREAM_TRANSACTION_CONTEXT.GETANSINULL.HOST_ID.HOST_NAME.ISNULL.ISNUMERIC.MIN_ACTIVE_ROWVERSION.NEWID.NEWSEQUENTIALID.ROWCOUNT_BIG.SESSION_CONTEXT.XACT_STATE.@@CONNECTIONS.@@CPU_BUSY.@@IDLE.@@IO_BUSY.@@PACK_SENT.@@PACKET_ERRORS.@@TIMETICKS.@@TOTAL_ERRORS.@@TOTAL_READ.@@TOTAL_WRITE.TEXTPTR.TEXTVALID.COLUMNS_UPDATED.EVENTDATA.TRIGGER_NESTLEVEL.UPDATE.COALESCE.NULLIF`.split(`.`),pQ=`ADD.ALL.ALTER.AND.ANY.AS.ASC.AUTHORIZATION.BACKUP.BEGIN.BETWEEN.BREAK.BROWSE.BULK.BY.CASCADE.CHECK.CHECKPOINT.CLOSE.CLUSTERED.COALESCE.COLLATE.COLUMN.COMMIT.COMPUTE.CONSTRAINT.CONTAINS.CONTAINSTABLE.CONTINUE.CONVERT.CREATE.CROSS.CURRENT.CURRENT_DATE.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.CURSOR.DATABASE.DBCC.DEALLOCATE.DECLARE.DEFAULT.DELETE.DENY.DESC.DISK.DISTINCT.DISTRIBUTED.DROP.DUMP.ERRLVL.ESCAPE.EXEC.EXECUTE.EXISTS.EXIT.EXTERNAL.FETCH.FILE.FILLFACTOR.FOR.FOREIGN.FREETEXT.FREETEXTTABLE.FROM.FULL.FUNCTION.GOTO.GRANT.GROUP.HAVING.HOLDLOCK.IDENTITY.IDENTITYCOL.IDENTITY_INSERT.IF.IN.INDEX.INNER.INSERT.INTERSECT.INTO.IS.JOIN.KEY.KILL.LEFT.LIKE.LINENO.LOAD.MERGE.NOCHECK.NONCLUSTERED.NOT.NULL.NULLIF.OF.OFF.OFFSETS.ON.OPEN.OPENDATASOURCE.OPENQUERY.OPENROWSET.OPENXML.OPTION.OR.ORDER.OUTER.OVER.PERCENT.PIVOT.PLAN.PRIMARY.PRINT.PROC.PROCEDURE.PUBLIC.RAISERROR.READ.READTEXT.RECONFIGURE.REFERENCES.REPLICATION.RESTORE.RESTRICT.RETURN.REVERT.REVOKE.RIGHT.ROLLBACK.ROWCOUNT.ROWGUIDCOL.RULE.SAVE.SCHEMA.SECURITYAUDIT.SELECT.SEMANTICKEYPHRASETABLE.SEMANTICSIMILARITYDETAILSTABLE.SEMANTICSIMILARITYTABLE.SESSION_USER.SET.SETUSER.SHUTDOWN.SOME.STATISTICS.SYSTEM_USER.TABLE.TABLESAMPLE.TEXTSIZE.THEN.TO.TOP.TRAN.TRANSACTION.TRIGGER.TRUNCATE.TRY_CONVERT.TSEQUAL.UNION.UNIQUE.UNPIVOT.UPDATE.UPDATETEXT.USE.USER.VALUES.VIEW.WAITFOR.WHERE.WHILE.WITH.WITHIN GROUP.WRITETEXT.$ACTION`.split(`.`),mQ=[`BINARY`,`BIT`,`CHAR`,`CHAR`,`CHARACTER`,`DATE`,`DATETIME2`,`DATETIMEOFFSET`,`DEC`,`DECIMAL`,`DOUBLE`,`FLOAT`,`INT`,`INTEGER`,`NATIONAL`,`NCHAR`,`NUMERIC`,`NVARCHAR`,`PRECISION`,`REAL`,`SMALLINT`,`TIME`,`TIMESTAMP`,`VARBINARY`,`VARCHAR`],hQ=Y([`SELECT [ALL | DISTINCT]`]),gQ=Y([`WITH`,`INTO`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`WINDOW`,`PARTITION BY`,`ORDER BY`,`OFFSET`,`FETCH {FIRST | NEXT}`,`FOR {BROWSE | XML | JSON}`,`OPTION`,`INSERT [INTO]`,`VALUES`,`SET`,`MERGE [INTO]`,`WHEN [NOT] MATCHED [BY TARGET | BY SOURCE] [THEN]`,`UPDATE SET`]),_Q=Y([`CREATE TABLE`]),vQ=Y(`CREATE [OR ALTER] [MATERIALIZED] VIEW.UPDATE.WHERE CURRENT OF.DELETE [FROM].DROP TABLE [IF EXISTS].ALTER TABLE.ADD.DROP COLUMN [IF EXISTS].ALTER COLUMN.TRUNCATE TABLE.CREATE [UNIQUE] [CLUSTERED] INDEX.CREATE DATABASE.ALTER DATABASE.DROP DATABASE [IF EXISTS].CREATE [OR ALTER] [PARTITION] {FUNCTION | PROCEDURE | PROC}.ALTER [PARTITION] {FUNCTION | PROCEDURE | PROC}.DROP [PARTITION] {FUNCTION | PROCEDURE | PROC} [IF EXISTS].GO.USE.ADD SENSITIVITY CLASSIFICATION.ADD SIGNATURE.AGGREGATE.ANSI_DEFAULTS.ANSI_NULLS.ANSI_NULL_DFLT_OFF.ANSI_NULL_DFLT_ON.ANSI_PADDING.ANSI_WARNINGS.APPLICATION ROLE.ARITHABORT.ARITHIGNORE.ASSEMBLY.ASYMMETRIC KEY.AUTHORIZATION.AVAILABILITY GROUP.BACKUP.BACKUP CERTIFICATE.BACKUP MASTER KEY.BACKUP SERVICE MASTER KEY.BEGIN CONVERSATION TIMER.BEGIN DIALOG CONVERSATION.BROKER PRIORITY.BULK INSERT.CERTIFICATE.CLOSE MASTER KEY.CLOSE SYMMETRIC KEY.COLUMN ENCRYPTION KEY.COLUMN MASTER KEY.COLUMNSTORE INDEX.CONCAT_NULL_YIELDS_NULL.CONTEXT_INFO.CONTRACT.CREDENTIAL.CRYPTOGRAPHIC PROVIDER.CURSOR_CLOSE_ON_COMMIT.DATABASE.DATABASE AUDIT SPECIFICATION.DATABASE ENCRYPTION KEY.DATABASE HADR.DATABASE SCOPED CONFIGURATION.DATABASE SCOPED CREDENTIAL.DATABASE SET.DATEFIRST.DATEFORMAT.DEADLOCK_PRIORITY.DENY.DENY XML.DISABLE TRIGGER.ENABLE TRIGGER.END CONVERSATION.ENDPOINT.EVENT NOTIFICATION.EVENT SESSION.EXECUTE AS.EXTERNAL DATA SOURCE.EXTERNAL FILE FORMAT.EXTERNAL LANGUAGE.EXTERNAL LIBRARY.EXTERNAL RESOURCE POOL.EXTERNAL TABLE.FIPS_FLAGGER.FMTONLY.FORCEPLAN.FULLTEXT CATALOG.FULLTEXT INDEX.FULLTEXT STOPLIST.GET CONVERSATION GROUP.GET_TRANSMISSION_STATUS.GRANT.GRANT XML.IDENTITY_INSERT.IMPLICIT_TRANSACTIONS.INDEX.LANGUAGE.LOCK_TIMEOUT.LOGIN.MASTER KEY.MESSAGE TYPE.MOVE CONVERSATION.NOCOUNT.NOEXEC.NUMERIC_ROUNDABORT.OFFSETS.OPEN MASTER KEY.OPEN SYMMETRIC KEY.PARSEONLY.PARTITION SCHEME.QUERY_GOVERNOR_COST_LIMIT.QUEUE.QUOTED_IDENTIFIER.RECEIVE.REMOTE SERVICE BINDING.REMOTE_PROC_TRANSACTIONS.RESOURCE GOVERNOR.RESOURCE POOL.RESTORE.RESTORE FILELISTONLY.RESTORE HEADERONLY.RESTORE LABELONLY.RESTORE MASTER KEY.RESTORE REWINDONLY.RESTORE SERVICE MASTER KEY.RESTORE VERIFYONLY.REVERT.REVOKE.REVOKE XML.ROLE.ROUTE.ROWCOUNT.RULE.SCHEMA.SEARCH PROPERTY LIST.SECURITY POLICY.SELECTIVE XML INDEX.SEND.SENSITIVITY CLASSIFICATION.SEQUENCE.SERVER AUDIT.SERVER AUDIT SPECIFICATION.SERVER CONFIGURATION.SERVER ROLE.SERVICE.SERVICE MASTER KEY.SETUSER.SHOWPLAN_ALL.SHOWPLAN_TEXT.SHOWPLAN_XML.SIGNATURE.SPATIAL INDEX.STATISTICS.STATISTICS IO.STATISTICS PROFILE.STATISTICS TIME.STATISTICS XML.SYMMETRIC KEY.SYNONYM.TABLE.TABLE IDENTITY.TEXTSIZE.TRANSACTION ISOLATION LEVEL.TRIGGER.TYPE.UPDATE STATISTICS.USER.WORKLOAD GROUP.XACT_ABORT.XML INDEX.XML SCHEMA COLLECTION`.split(`.`)),yQ=Y([`UNION [ALL]`,`EXCEPT`,`INTERSECT`]),bQ=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`{CROSS | OUTER} APPLY`]),xQ=Y([`ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]`,`{ROWS | RANGE} BETWEEN`]),SQ=Y([]),CQ={name:`transactsql`,tokenizerOptions:{reservedSelect:hQ,reservedClauses:[...gQ,..._Q,...vQ],reservedSetOperations:yQ,reservedJoins:bQ,reservedKeywordPhrases:xQ,reservedDataTypePhrases:SQ,reservedKeywords:pQ,reservedDataTypes:mQ,reservedFunctionNames:fQ,nestedBlockComments:!0,stringTypes:[{quote:`''-qq`,prefixes:[`N`]},`{}`],identTypes:[`""-qq`,`[]`],identChars:{first:`#@`,rest:`#@$`},paramTypes:{named:[`@`],quoted:[`@`]},operators:[`%`,`&`,`|`,`^`,`~`,`!<`,`!>`,`+=`,`-=`,`*=`,`/=`,`%=`,`|=`,`&=`,`^=`,`::`,`:`],propertyAccessOperators:[`..`]},formatOptions:{alwaysDenseOperators:[`::`],onelineClauses:[..._Q,...vQ],tabularOnelineClauses:vQ}},wQ=`ADD.ALL.ALTER.ANALYZE.AND.AS.ASC.ASENSITIVE.BEFORE.BETWEEN._BINARY.BOTH.BY.CALL.CASCADE.CASE.CHANGE.CHECK.COLLATE.COLUMN.CONDITION.CONSTRAINT.CONTINUE.CONVERT.CREATE.CROSS.CURRENT_DATE.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.CURSOR.DATABASE.DATABASES.DAY_HOUR.DAY_MICROSECOND.DAY_MINUTE.DAY_SECOND.DECLARE.DEFAULT.DELAYED.DELETE.DESC.DESCRIBE.DETERMINISTIC.DISTINCT.DISTINCTROW.DIV.DROP.DUAL.EACH.ELSE.ELSEIF.ENCLOSED.ESCAPED.EXCEPT.EXISTS.EXIT.EXPLAIN.EXTRA_JOIN.FALSE.FETCH.FOR.FORCE.FORCE_COMPILED_MODE.FORCE_INTERPRETER_MODE.FOREIGN.FROM.FULL.FULLTEXT.GRANT.GROUP.HAVING.HEARTBEAT_NO_LOGGING.HIGH_PRIORITY.HOUR_MICROSECOND.HOUR_MINUTE.HOUR_SECOND.IF.IGNORE.IN.INDEX.INFILE.INNER.INOUT.INSENSITIVE.INSERT.IN._INTERNAL_DYNAMIC_TYPECAST.INTERSECT.INTERVAL.INTO.ITERATE.JOIN.KEY.KEYS.KILL.LEADING.LEAVE.LEFT.LIKE.LIMIT.LINES.LOAD.LOCALTIME.LOCALTIMESTAMP.LOCK.LOOP.LOW_PRIORITY.MATCH.MAXVALUE.MINUS.MINUTE_MICROSECOND.MINUTE_SECOND.MOD.MODIFIES.NATURAL.NO_QUERY_REWRITE.NOT.NO_WRITE_TO_BINLOG.NO_QUERY_REWRITE.NULL.ON.OPTIMIZE.OPTION.OPTIONALLY.OR.ORDER.OUT.OUTER.OUTFILE.OVER.PRIMARY.PROCEDURE.PURGE.RANGE.READ.READS.REFERENCES.REGEXP.RELEASE.RENAME.REPEAT.REPLACE.REQUIRE.RESTRICT.RETURN.REVOKE.RIGHT.RIGHT_ANTI_JOIN.RIGHT_SEMI_JOIN.RIGHT_STRAIGHT_JOIN.RLIKE.SCHEMA.SCHEMAS.SECOND_MICROSECOND.SELECT.SEMI_JOIN.SENSITIVE.SEPARATOR.SET.SHOW.SIGNAL.SPATIAL.SPECIFIC.SQL.SQL_BIG_RESULT.SQL_BUFFER_RESULT.SQL_CACHE.SQL_CALC_FOUND_ROWS.SQLEXCEPTION.SQL_NO_CACHE.SQL_NO_LOGGING.SQL_SMALL_RESULT.SQLSTATE.SQLWARNING.STRAIGHT_JOIN.TABLE.TERMINATED.THEN.TO.TRAILING.TRIGGER.TRUE.UNBOUNDED.UNDO.UNION.UNIQUE.UNLOCK.UPDATE.USAGE.USE.USING.UTC_DATE.UTC_TIME.UTC_TIMESTAMP._UTF8.VALUES.WHEN.WHERE.WHILE.WINDOW.WITH.WITHIN.WRITE.XOR.YEAR_MONTH.ZEROFILL`.split(`.`),TQ=`BIGINT.BINARY.BIT.BLOB.CHAR.CHARACTER.DATETIME.DEC.DECIMAL.DOUBLE PRECISION.DOUBLE.ENUM.FIXED.FLOAT.FLOAT4.FLOAT8.INT.INT1.INT2.INT3.INT4.INT8.INTEGER.LONG.LONGBLOB.LONGTEXT.MEDIUMBLOB.MEDIUMINT.MEDIUMTEXT.MIDDLEINT.NATIONAL CHAR.NATIONAL VARCHAR.NUMERIC.PRECISION.REAL.SMALLINT.TEXT.TIME.TIMESTAMP.TINYBLOB.TINYINT.TINYTEXT.UNSIGNED.VARBINARY.VARCHAR.VARCHARACTER.YEAR`.split(`.`),EQ=`ABS.ACOS.ADDDATE.ADDTIME.AES_DECRYPT.AES_ENCRYPT.ANY_VALUE.APPROX_COUNT_DISTINCT.APPROX_COUNT_DISTINCT_ACCUMULATE.APPROX_COUNT_DISTINCT_COMBINE.APPROX_COUNT_DISTINCT_ESTIMATE.APPROX_GEOGRAPHY_INTERSECTS.APPROX_PERCENTILE.ASCII.ASIN.ATAN.ATAN2.AVG.BIN.BINARY.BIT_AND.BIT_COUNT.BIT_OR.BIT_XOR.CAST.CEIL.CEILING.CHAR.CHARACTER_LENGTH.CHAR_LENGTH.CHARSET.COALESCE.COERCIBILITY.COLLATION.COLLECT.CONCAT.CONCAT_WS.CONNECTION_ID.CONV.CONVERT.CONVERT_TZ.COS.COT.COUNT.CUME_DIST.CURDATE.CURRENT_DATE.CURRENT_ROLE.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.CURTIME.DATABASE.DATE.DATE_ADD.DATEDIFF.DATE_FORMAT.DATE_SUB.DATE_TRUNC.DAY.DAYNAME.DAYOFMONTH.DAYOFWEEK.DAYOFYEAR.DECODE.DEFAULT.DEGREES.DENSE_RANK.DIV.DOT_PRODUCT.ELT.EUCLIDEAN_DISTANCE.EXP.EXTRACT.FIELD.FIRST.FIRST_VALUE.FLOOR.FORMAT.FOUND_ROWS.FROM_BASE64.FROM_DAYS.FROM_UNIXTIME.GEOGRAPHY_AREA.GEOGRAPHY_CONTAINS.GEOGRAPHY_DISTANCE.GEOGRAPHY_INTERSECTS.GEOGRAPHY_LATITUDE.GEOGRAPHY_LENGTH.GEOGRAPHY_LONGITUDE.GEOGRAPHY_POINT.GEOGRAPHY_WITHIN_DISTANCE.GEOMETRY_AREA.GEOMETRY_CONTAINS.GEOMETRY_DISTANCE.GEOMETRY_FILTER.GEOMETRY_INTERSECTS.GEOMETRY_LENGTH.GEOMETRY_POINT.GEOMETRY_WITHIN_DISTANCE.GEOMETRY_X.GEOMETRY_Y.GREATEST.GROUPING.GROUP_CONCAT.HEX.HIGHLIGHT.HOUR.ICU_VERSION.IF.IFNULL.INET_ATON.INET_NTOA.INET6_ATON.INET6_NTOA.INITCAP.INSERT.INSTR.INTERVAL.IS.IS NULL.JSON_AGG.JSON_ARRAY_CONTAINS_DOUBLE.JSON_ARRAY_CONTAINS_JSON.JSON_ARRAY_CONTAINS_STRING.JSON_ARRAY_PUSH_DOUBLE.JSON_ARRAY_PUSH_JSON.JSON_ARRAY_PUSH_STRING.JSON_DELETE_KEY.JSON_EXTRACT_DOUBLE.JSON_EXTRACT_JSON.JSON_EXTRACT_STRING.JSON_EXTRACT_BIGINT.JSON_GET_TYPE.JSON_LENGTH.JSON_SET_DOUBLE.JSON_SET_JSON.JSON_SET_STRING.JSON_SPLICE_DOUBLE.JSON_SPLICE_JSON.JSON_SPLICE_STRING.LAG.LAST_DAY.LAST_VALUE.LCASE.LEAD.LEAST.LEFT.LENGTH.LIKE.LN.LOCALTIME.LOCALTIMESTAMP.LOCATE.LOG.LOG10.LOG2.LPAD.LTRIM.MATCH.MAX.MD5.MEDIAN.MICROSECOND.MIN.MINUTE.MOD.MONTH.MONTHNAME.MONTHS_BETWEEN.NOT.NOW.NTH_VALUE.NTILE.NULLIF.OCTET_LENGTH.PERCENT_RANK.PERCENTILE_CONT.PERCENTILE_DISC.PI.PIVOT.POSITION.POW.POWER.QUARTER.QUOTE.RADIANS.RAND.RANK.REGEXP.REPEAT.REPLACE.REVERSE.RIGHT.RLIKE.ROUND.ROW_COUNT.ROW_NUMBER.RPAD.RTRIM.SCALAR.SCHEMA.SEC_TO_TIME.SHA1.SHA2.SIGMOID.SIGN.SIN.SLEEP.SPLIT.SOUNDEX.SOUNDS LIKE.SOURCE_POS_WAIT.SPACE.SQRT.STDDEV.STDDEV_POP.STDDEV_SAMP.STR_TO_DATE.SUBDATE.SUBSTR.SUBSTRING.SUBSTRING_INDEX.SUM.SYS_GUID.TAN.TIME.TIMEDIFF.TIME_BUCKET.TIME_FORMAT.TIMESTAMP.TIMESTAMPADD.TIMESTAMPDIFF.TIME_TO_SEC.TO_BASE64.TO_CHAR.TO_DAYS.TO_JSON.TO_NUMBER.TO_SECONDS.TO_TIMESTAMP.TRIM.TRUNC.TRUNCATE.UCASE.UNHEX.UNIX_TIMESTAMP.UPDATEXML.UPPER.UTC_DATE.UTC_TIME.UTC_TIMESTAMP.UUID.VALUES.VARIANCE.VAR_POP.VAR_SAMP.VECTOR_SUB.VERSION.WEEK.WEEKDAY.WEEKOFYEAR.YEAR`.split(`.`),DQ=Y([`SELECT [ALL | DISTINCT | DISTINCTROW]`]),OQ=Y([`WITH`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`PARTITION BY`,`ORDER BY`,`LIMIT`,`OFFSET`,`INSERT [IGNORE] [INTO]`,`VALUES`,`REPLACE [INTO]`,`ON DUPLICATE KEY UPDATE`,`SET`,`CREATE [OR REPLACE] [TEMPORARY] PROCEDURE [IF NOT EXISTS]`,`CREATE [OR REPLACE] [EXTERNAL] FUNCTION`]),kQ=Y([`CREATE [ROWSTORE] [REFERENCE | TEMPORARY | GLOBAL TEMPORARY] TABLE [IF NOT EXISTS]`]),AQ=Y(`CREATE VIEW.UPDATE.DELETE [FROM].DROP [TEMPORARY] TABLE [IF EXISTS].ALTER [ONLINE] TABLE.ADD [COLUMN].ADD [UNIQUE] {INDEX | KEY}.DROP [COLUMN].MODIFY [COLUMN].CHANGE.RENAME [TO | AS].TRUNCATE [TABLE].ADD AGGREGATOR.ADD LEAF.AGGREGATOR SET AS MASTER.ALTER DATABASE.ALTER PIPELINE.ALTER RESOURCE POOL.ALTER USER.ALTER VIEW.ANALYZE TABLE.ATTACH DATABASE.ATTACH LEAF.ATTACH LEAF ALL.BACKUP DATABASE.BINLOG.BOOTSTRAP AGGREGATOR.CACHE INDEX.CALL.CHANGE.CHANGE MASTER TO.CHANGE REPLICATION FILTER.CHANGE REPLICATION SOURCE TO.CHECK BLOB CHECKSUM.CHECK TABLE.CHECKSUM TABLE.CLEAR ORPHAN DATABASES.CLONE.COMMIT.CREATE DATABASE.CREATE GROUP.CREATE INDEX.CREATE LINK.CREATE MILESTONE.CREATE PIPELINE.CREATE RESOURCE POOL.CREATE ROLE.CREATE USER.DEALLOCATE PREPARE.DESCRIBE.DETACH DATABASE.DETACH PIPELINE.DROP DATABASE.DROP FUNCTION.DROP INDEX.DROP LINK.DROP PIPELINE.DROP PROCEDURE.DROP RESOURCE POOL.DROP ROLE.DROP USER.DROP VIEW.EXECUTE.EXPLAIN.FLUSH.FORCE.GRANT.HANDLER.HELP.KILL CONNECTION.KILLALL QUERIES.LOAD DATA.LOAD INDEX INTO CACHE.LOAD XML.LOCK INSTANCE FOR BACKUP.LOCK TABLES.MASTER_POS_WAIT.OPTIMIZE TABLE.PREPARE.PURGE BINARY LOGS.REBALANCE PARTITIONS.RELEASE SAVEPOINT.REMOVE AGGREGATOR.REMOVE LEAF.REPAIR TABLE.REPLACE.REPLICATE DATABASE.RESET.RESET MASTER.RESET PERSIST.RESET REPLICA.RESET SLAVE.RESTART.RESTORE DATABASE.RESTORE REDUNDANCY.REVOKE.ROLLBACK.ROLLBACK TO SAVEPOINT.SAVEPOINT.SET CHARACTER SET.SET DEFAULT ROLE.SET NAMES.SET PASSWORD.SET RESOURCE GROUP.SET ROLE.SET TRANSACTION.SHOW.SHOW CHARACTER SET.SHOW COLLATION.SHOW COLUMNS.SHOW CREATE DATABASE.SHOW CREATE FUNCTION.SHOW CREATE PIPELINE.SHOW CREATE PROCEDURE.SHOW CREATE TABLE.SHOW CREATE USER.SHOW CREATE VIEW.SHOW DATABASES.SHOW ENGINE.SHOW ENGINES.SHOW ERRORS.SHOW FUNCTION CODE.SHOW FUNCTION STATUS.SHOW GRANTS.SHOW INDEX.SHOW MASTER STATUS.SHOW OPEN TABLES.SHOW PLUGINS.SHOW PRIVILEGES.SHOW PROCEDURE CODE.SHOW PROCEDURE STATUS.SHOW PROCESSLIST.SHOW PROFILE.SHOW PROFILES.SHOW RELAYLOG EVENTS.SHOW REPLICA STATUS.SHOW REPLICAS.SHOW SLAVE.SHOW SLAVE HOSTS.SHOW STATUS.SHOW TABLE STATUS.SHOW TABLES.SHOW VARIABLES.SHOW WARNINGS.SHUTDOWN.SNAPSHOT DATABASE.SOURCE_POS_WAIT.START GROUP_REPLICATION.START PIPELINE.START REPLICA.START SLAVE.START TRANSACTION.STOP GROUP_REPLICATION.STOP PIPELINE.STOP REPLICA.STOP REPLICATING.STOP SLAVE.TEST PIPELINE.UNLOCK INSTANCE.UNLOCK TABLES.USE.XA.ITERATE.LEAVE.LOOP.REPEAT.RETURN.WHILE`.split(`.`)),jQ=Y([`UNION [ALL | DISTINCT]`,`EXCEPT`,`INTERSECT`,`MINUS`]),MQ=Y([`JOIN`,`{LEFT | RIGHT | FULL} [OUTER] JOIN`,`{INNER | CROSS} JOIN`,`NATURAL {LEFT | RIGHT} [OUTER] JOIN`,`STRAIGHT_JOIN`]),NQ=Y([`ON DELETE`,`ON UPDATE`,`CHARACTER SET`,`{ROWS | RANGE} BETWEEN`,`IDENTIFIED BY`]),PQ=Y([]),FQ={name:`singlestoredb`,tokenizerOptions:{reservedSelect:DQ,reservedClauses:[...OQ,...kQ,...AQ],reservedSetOperations:jQ,reservedJoins:MQ,reservedKeywordPhrases:NQ,reservedDataTypePhrases:PQ,reservedKeywords:wQ,reservedDataTypes:TQ,reservedFunctionNames:EQ,stringTypes:[`""-qq-bs`,`''-qq-bs`,{quote:`''-raw`,prefixes:[`B`,`X`],requirePrefix:!0}],identTypes:["``"],identChars:{first:`$`,rest:`$`,allowFirstCharNumber:!0},variableTypes:[{regex:`@@?[A-Za-z0-9_$]+`},{quote:"``",prefixes:[`@`],requirePrefix:!0}],lineCommentTypes:[`--`,`#`],operators:[`:=`,`&`,`|`,`^`,`~`,`<<`,`>>`,`<=>`,`&&`,`||`,`::`,`::$`,`::%`,`:>`,`!:>`,`*.*`],postProcess:BY},formatOptions:{alwaysDenseOperators:[`::`,`::$`,`::%`],onelineClauses:[...kQ,...AQ],tabularOnelineClauses:AQ}},IQ=`ABS.ACOS.ACOSH.ADD_MONTHS.ALL_USER_NAMES.ANY_VALUE.APPROX_COUNT_DISTINCT.APPROX_PERCENTILE.APPROX_PERCENTILE_ACCUMULATE.APPROX_PERCENTILE_COMBINE.APPROX_PERCENTILE_ESTIMATE.APPROX_TOP_K.APPROX_TOP_K_ACCUMULATE.APPROX_TOP_K_COMBINE.APPROX_TOP_K_ESTIMATE.APPROXIMATE_JACCARD_INDEX.APPROXIMATE_SIMILARITY.ARRAY_AGG.ARRAY_APPEND.ARRAY_CAT.ARRAY_COMPACT.ARRAY_CONSTRUCT.ARRAY_CONSTRUCT_COMPACT.ARRAY_CONTAINS.ARRAY_INSERT.ARRAY_INTERSECTION.ARRAY_POSITION.ARRAY_PREPEND.ARRAY_SIZE.ARRAY_SLICE.ARRAY_TO_STRING.ARRAY_UNION_AGG.ARRAY_UNIQUE_AGG.ARRAYS_OVERLAP.AS_ARRAY.AS_BINARY.AS_BOOLEAN.AS_CHAR.AS_VARCHAR.AS_DATE.AS_DECIMAL.AS_NUMBER.AS_DOUBLE.AS_REAL.AS_INTEGER.AS_OBJECT.AS_TIME.AS_TIMESTAMP_LTZ.AS_TIMESTAMP_NTZ.AS_TIMESTAMP_TZ.ASCII.ASIN.ASINH.ATAN.ATAN2.ATANH.AUTO_REFRESH_REGISTRATION_HISTORY.AUTOMATIC_CLUSTERING_HISTORY.AVG.BASE64_DECODE_BINARY.BASE64_DECODE_STRING.BASE64_ENCODE.BIT_LENGTH.BITAND.BITAND_AGG.BITMAP_BIT_POSITION.BITMAP_BUCKET_NUMBER.BITMAP_CONSTRUCT_AGG.BITMAP_COUNT.BITMAP_OR_AGG.BITNOT.BITOR.BITOR_AGG.BITSHIFTLEFT.BITSHIFTRIGHT.BITXOR.BITXOR_AGG.BOOLAND.BOOLAND_AGG.BOOLNOT.BOOLOR.BOOLOR_AGG.BOOLXOR.BOOLXOR_AGG.BUILD_SCOPED_FILE_URL.BUILD_STAGE_FILE_URL.CASE.CAST.CBRT.CEIL.CHARINDEX.CHECK_JSON.CHECK_XML.CHR.CHAR.COALESCE.COLLATE.COLLATION.COMPLETE_TASK_GRAPHS.COMPRESS.CONCAT.CONCAT_WS.CONDITIONAL_CHANGE_EVENT.CONDITIONAL_TRUE_EVENT.CONTAINS.CONVERT_TIMEZONE.COPY_HISTORY.CORR.COS.COSH.COT.COUNT.COUNT_IF.COVAR_POP.COVAR_SAMP.CUME_DIST.CURRENT_ACCOUNT.CURRENT_AVAILABLE_ROLES.CURRENT_CLIENT.CURRENT_DATABASE.CURRENT_DATE.CURRENT_IP_ADDRESS.CURRENT_REGION.CURRENT_ROLE.CURRENT_SCHEMA.CURRENT_SCHEMAS.CURRENT_SECONDARY_ROLES.CURRENT_SESSION.CURRENT_STATEMENT.CURRENT_TASK_GRAPHS.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_TRANSACTION.CURRENT_USER.CURRENT_VERSION.CURRENT_WAREHOUSE.DATA_TRANSFER_HISTORY.DATABASE_REFRESH_HISTORY.DATABASE_REFRESH_PROGRESS.DATABASE_REFRESH_PROGRESS_BY_JOB.DATABASE_STORAGE_USAGE_HISTORY.DATE_FROM_PARTS.DATE_PART.DATE_TRUNC.DATEADD.DATEDIFF.DAYNAME.DECODE.DECOMPRESS_BINARY.DECOMPRESS_STRING.DECRYPT.DECRYPT_RAW.DEGREES.DENSE_RANK.DIV0.EDITDISTANCE.ENCRYPT.ENCRYPT_RAW.ENDSWITH.EQUAL_NULL.EXP.EXPLAIN_JSON.EXTERNAL_FUNCTIONS_HISTORY.EXTERNAL_TABLE_FILES.EXTERNAL_TABLE_FILE_REGISTRATION_HISTORY.EXTRACT.EXTRACT_SEMANTIC_CATEGORIES.FACTORIAL.FILTER.FIRST_VALUE.FLATTEN.FLOOR.GENERATE_COLUMN_DESCRIPTION.GENERATOR.GET.GET_ABSOLUTE_PATH.GET_DDL.GET_IGNORE_CASE.GET_OBJECT_REFERENCES.GET_PATH.GET_PRESIGNED_URL.GET_RELATIVE_PATH.GET_STAGE_LOCATION.GETBIT.GREATEST.GREATEST_IGNORE_NULLS.GROUPING.GROUPING_ID.HASH.HASH_AGG.HAVERSINE.HEX_DECODE_BINARY.HEX_DECODE_STRING.HEX_ENCODE.HLL.HLL_ACCUMULATE.HLL_COMBINE.HLL_ESTIMATE.HLL_EXPORT.HLL_IMPORT.HOUR.MINUTE.SECOND.IDENTIFIER.IFF.IFNULL.ILIKE.ILIKE ANY.INFER_SCHEMA.INITCAP.INSERT.INVOKER_ROLE.INVOKER_SHARE.IS_ARRAY.IS_BINARY.IS_BOOLEAN.IS_CHAR.IS_VARCHAR.IS_DATE.IS_DATE_VALUE.IS_DECIMAL.IS_DOUBLE.IS_REAL.IS_GRANTED_TO_INVOKER_ROLE.IS_INTEGER.IS_NULL_VALUE.IS_OBJECT.IS_ROLE_IN_SESSION.IS_TIME.IS_TIMESTAMP_LTZ.IS_TIMESTAMP_NTZ.IS_TIMESTAMP_TZ.JAROWINKLER_SIMILARITY.JSON_EXTRACT_PATH_TEXT.KURTOSIS.LAG.LAST_DAY.LAST_QUERY_ID.LAST_TRANSACTION.LAST_VALUE.LEAD.LEAST.LEFT.LENGTH.LEN.LIKE.LIKE ALL.LIKE ANY.LISTAGG.LN.LOCALTIME.LOCALTIMESTAMP.LOG.LOGIN_HISTORY.LOGIN_HISTORY_BY_USER.LOWER.LPAD.LTRIM.MATERIALIZED_VIEW_REFRESH_HISTORY.MD5.MD5_HEX.MD5_BINARY.MD5_NUMBER — Obsoleted.MD5_NUMBER_LOWER64.MD5_NUMBER_UPPER64.MEDIAN.MIN.MAX.MINHASH.MINHASH_COMBINE.MOD.MODE.MONTHNAME.MONTHS_BETWEEN.NEXT_DAY.NORMAL.NTH_VALUE.NTILE.NULLIF.NULLIFZERO.NVL.NVL2.OBJECT_AGG.OBJECT_CONSTRUCT.OBJECT_CONSTRUCT_KEEP_NULL.OBJECT_DELETE.OBJECT_INSERT.OBJECT_KEYS.OBJECT_PICK.OCTET_LENGTH.PARSE_IP.PARSE_JSON.PARSE_URL.PARSE_XML.PERCENT_RANK.PERCENTILE_CONT.PERCENTILE_DISC.PI.PIPE_USAGE_HISTORY.POLICY_CONTEXT.POLICY_REFERENCES.POSITION.POW.POWER.PREVIOUS_DAY.QUERY_ACCELERATION_HISTORY.QUERY_HISTORY.QUERY_HISTORY_BY_SESSION.QUERY_HISTORY_BY_USER.QUERY_HISTORY_BY_WAREHOUSE.RADIANS.RANDOM.RANDSTR.RANK.RATIO_TO_REPORT.REGEXP.REGEXP_COUNT.REGEXP_INSTR.REGEXP_LIKE.REGEXP_REPLACE.REGEXP_SUBSTR.REGEXP_SUBSTR_ALL.REGR_AVGX.REGR_AVGY.REGR_COUNT.REGR_INTERCEPT.REGR_R2.REGR_SLOPE.REGR_SXX.REGR_SXY.REGR_SYY.REGR_VALX.REGR_VALY.REPEAT.REPLACE.REPLICATION_GROUP_REFRESH_HISTORY.REPLICATION_GROUP_REFRESH_PROGRESS.REPLICATION_GROUP_REFRESH_PROGRESS_BY_JOB.REPLICATION_GROUP_USAGE_HISTORY.REPLICATION_USAGE_HISTORY.REST_EVENT_HISTORY.RESULT_SCAN.REVERSE.RIGHT.RLIKE.ROUND.ROW_NUMBER.RPAD.RTRIM.RTRIMMED_LENGTH.SEARCH_OPTIMIZATION_HISTORY.SEQ1.SEQ2.SEQ4.SEQ8.SERVERLESS_TASK_HISTORY.SHA1.SHA1_HEX.SHA1_BINARY.SHA2.SHA2_HEX.SHA2_BINARY.SIGN.SIN.SINH.SKEW.SOUNDEX.SPACE.SPLIT.SPLIT_PART.SPLIT_TO_TABLE.SQRT.SQUARE.ST_AREA.ST_ASEWKB.ST_ASEWKT.ST_ASGEOJSON.ST_ASWKB.ST_ASBINARY.ST_ASWKT.ST_ASTEXT.ST_AZIMUTH.ST_CENTROID.ST_COLLECT.ST_CONTAINS.ST_COVEREDBY.ST_COVERS.ST_DIFFERENCE.ST_DIMENSION.ST_DISJOINT.ST_DISTANCE.ST_DWITHIN.ST_ENDPOINT.ST_ENVELOPE.ST_GEOGFROMGEOHASH.ST_GEOGPOINTFROMGEOHASH.ST_GEOGRAPHYFROMWKB.ST_GEOGRAPHYFROMWKT.ST_GEOHASH.ST_GEOMETRYFROMWKB.ST_GEOMETRYFROMWKT.ST_HAUSDORFFDISTANCE.ST_INTERSECTION.ST_INTERSECTS.ST_LENGTH.ST_MAKEGEOMPOINT.ST_GEOM_POINT.ST_MAKELINE.ST_MAKEPOINT.ST_POINT.ST_MAKEPOLYGON.ST_POLYGON.ST_NPOINTS.ST_NUMPOINTS.ST_PERIMETER.ST_POINTN.ST_SETSRID.ST_SIMPLIFY.ST_SRID.ST_STARTPOINT.ST_SYMDIFFERENCE.ST_UNION.ST_WITHIN.ST_X.ST_XMAX.ST_XMIN.ST_Y.ST_YMAX.ST_YMIN.STAGE_DIRECTORY_FILE_REGISTRATION_HISTORY.STAGE_STORAGE_USAGE_HISTORY.STARTSWITH.STDDEV.STDDEV_POP.STDDEV_SAMP.STRIP_NULL_VALUE.STRTOK.STRTOK_SPLIT_TO_TABLE.STRTOK_TO_ARRAY.SUBSTR.SUBSTRING.SUM.SYSDATE.SYSTEM$ABORT_SESSION.SYSTEM$ABORT_TRANSACTION.SYSTEM$AUTHORIZE_PRIVATELINK.SYSTEM$AUTHORIZE_STAGE_PRIVATELINK_ACCESS.SYSTEM$BEHAVIOR_CHANGE_BUNDLE_STATUS.SYSTEM$CANCEL_ALL_QUERIES.SYSTEM$CANCEL_QUERY.SYSTEM$CLUSTERING_DEPTH.SYSTEM$CLUSTERING_INFORMATION.SYSTEM$CLUSTERING_RATIO .SYSTEM$CURRENT_USER_TASK_NAME.SYSTEM$DATABASE_REFRESH_HISTORY .SYSTEM$DATABASE_REFRESH_PROGRESS.SYSTEM$DATABASE_REFRESH_PROGRESS_BY_JOB .SYSTEM$DISABLE_BEHAVIOR_CHANGE_BUNDLE.SYSTEM$DISABLE_DATABASE_REPLICATION.SYSTEM$ENABLE_BEHAVIOR_CHANGE_BUNDLE.SYSTEM$ESTIMATE_QUERY_ACCELERATION.SYSTEM$ESTIMATE_SEARCH_OPTIMIZATION_COSTS.SYSTEM$EXPLAIN_JSON_TO_TEXT.SYSTEM$EXPLAIN_PLAN_JSON.SYSTEM$EXTERNAL_TABLE_PIPE_STATUS.SYSTEM$GENERATE_SAML_CSR.SYSTEM$GENERATE_SCIM_ACCESS_TOKEN.SYSTEM$GET_AWS_SNS_IAM_POLICY.SYSTEM$GET_PREDECESSOR_RETURN_VALUE.SYSTEM$GET_PRIVATELINK.SYSTEM$GET_PRIVATELINK_AUTHORIZED_ENDPOINTS.SYSTEM$GET_PRIVATELINK_CONFIG.SYSTEM$GET_SNOWFLAKE_PLATFORM_INFO.SYSTEM$GET_TAG.SYSTEM$GET_TAG_ALLOWED_VALUES.SYSTEM$GET_TAG_ON_CURRENT_COLUMN.SYSTEM$GET_TAG_ON_CURRENT_TABLE.SYSTEM$GLOBAL_ACCOUNT_SET_PARAMETER.SYSTEM$LAST_CHANGE_COMMIT_TIME.SYSTEM$LINK_ACCOUNT_OBJECTS_BY_NAME.SYSTEM$MIGRATE_SAML_IDP_REGISTRATION.SYSTEM$PIPE_FORCE_RESUME.SYSTEM$PIPE_STATUS.SYSTEM$REVOKE_PRIVATELINK.SYSTEM$REVOKE_STAGE_PRIVATELINK_ACCESS.SYSTEM$SET_RETURN_VALUE.SYSTEM$SHOW_OAUTH_CLIENT_SECRETS.SYSTEM$STREAM_GET_TABLE_TIMESTAMP.SYSTEM$STREAM_HAS_DATA.SYSTEM$TASK_DEPENDENTS_ENABLE.SYSTEM$TYPEOF.SYSTEM$USER_TASK_CANCEL_ONGOING_EXECUTIONS.SYSTEM$VERIFY_EXTERNAL_OAUTH_TOKEN.SYSTEM$WAIT.SYSTEM$WHITELIST.SYSTEM$WHITELIST_PRIVATELINK.TAG_REFERENCES.TAG_REFERENCES_ALL_COLUMNS.TAG_REFERENCES_WITH_LINEAGE.TAN.TANH.TASK_DEPENDENTS.TASK_HISTORY.TIME_FROM_PARTS.TIME_SLICE.TIMEADD.TIMEDIFF.TIMESTAMP_FROM_PARTS.TIMESTAMPADD.TIMESTAMPDIFF.TO_ARRAY.TO_BINARY.TO_BOOLEAN.TO_CHAR.TO_VARCHAR.TO_DATE.DATE.TO_DECIMAL.TO_NUMBER.TO_NUMERIC.TO_DOUBLE.TO_GEOGRAPHY.TO_GEOMETRY.TO_JSON.TO_OBJECT.TO_TIME.TIME.TO_TIMESTAMP.TO_TIMESTAMP_LTZ.TO_TIMESTAMP_NTZ.TO_TIMESTAMP_TZ.TO_VARIANT.TO_XML.TRANSLATE.TRIM.TRUNCATE.TRUNC.TRUNC.TRY_BASE64_DECODE_BINARY.TRY_BASE64_DECODE_STRING.TRY_CAST.TRY_HEX_DECODE_BINARY.TRY_HEX_DECODE_STRING.TRY_PARSE_JSON.TRY_TO_BINARY.TRY_TO_BOOLEAN.TRY_TO_DATE.TRY_TO_DECIMAL.TRY_TO_NUMBER.TRY_TO_NUMERIC.TRY_TO_DOUBLE.TRY_TO_GEOGRAPHY.TRY_TO_GEOMETRY.TRY_TO_TIME.TRY_TO_TIMESTAMP.TRY_TO_TIMESTAMP_LTZ.TRY_TO_TIMESTAMP_NTZ.TRY_TO_TIMESTAMP_TZ.TYPEOF.UNICODE.UNIFORM.UPPER.UUID_STRING.VALIDATE.VALIDATE_PIPE_LOAD.VAR_POP.VAR_SAMP.VARIANCE.VARIANCE_SAMP.VARIANCE_POP.WAREHOUSE_LOAD_HISTORY.WAREHOUSE_METERING_HISTORY.WIDTH_BUCKET.XMLGET.YEAR.YEAROFWEEK.YEAROFWEEKISO.DAY.DAYOFMONTH.DAYOFWEEK.DAYOFWEEKISO.DAYOFYEAR.WEEK.WEEK.WEEKOFYEAR.WEEKISO.MONTH.QUARTER.ZEROIFNULL.ZIPF`.split(`.`),LQ=`ACCOUNT.ALL.ALTER.AND.ANY.AS.BETWEEN.BY.CASE.CAST.CHECK.COLUMN.CONNECT.CONNECTION.CONSTRAINT.CREATE.CROSS.CURRENT.CURRENT_DATE.CURRENT_TIME.CURRENT_TIMESTAMP.CURRENT_USER.DATABASE.DELETE.DISTINCT.DROP.ELSE.EXISTS.FALSE.FOLLOWING.FOR.FROM.FULL.GRANT.GROUP.GSCLUSTER.HAVING.ILIKE.IN.INCREMENT.INNER.INSERT.INTERSECT.INTO.IS.ISSUE.JOIN.LATERAL.LEFT.LIKE.LOCALTIME.LOCALTIMESTAMP.MINUS.NATURAL.NOT.NULL.OF.ON.OR.ORDER.ORGANIZATION.QUALIFY.REGEXP.REVOKE.RIGHT.RLIKE.ROW.ROWS.SAMPLE.SCHEMA.SELECT.SET.SOME.START.TABLE.TABLESAMPLE.THEN.TO.TRIGGER.TRUE.TRY_CAST.UNION.UNIQUE.UPDATE.USING.VALUES.VIEW.WHEN.WHENEVER.WHERE.WITH.COMMENT`.split(`.`),RQ=`NUMBER.DECIMAL.NUMERIC.INT.INTEGER.BIGINT.SMALLINT.TINYINT.BYTEINT.FLOAT.FLOAT4.FLOAT8.DOUBLE.DOUBLE PRECISION.REAL.VARCHAR.CHAR.CHARACTER.STRING.TEXT.BINARY.VARBINARY.BOOLEAN.DATE.DATETIME.TIME.TIMESTAMP.TIMESTAMP_LTZ.TIMESTAMP_NTZ.TIMESTAMP.TIMESTAMP_TZ.VARIANT.OBJECT.ARRAY.GEOGRAPHY.GEOMETRY`.split(`.`),zQ=Y([`SELECT [ALL | DISTINCT]`]),BQ=Y([`WITH [RECURSIVE]`,`FROM`,`WHERE`,`GROUP BY`,`HAVING`,`PARTITION BY`,`ORDER BY`,`QUALIFY`,`LIMIT`,`OFFSET`,`FETCH [FIRST | NEXT]`,`INSERT [OVERWRITE] [ALL INTO | INTO | ALL | FIRST]`,`{THEN | ELSE} INTO`,`VALUES`,`SET`,`CLUSTER BY`,`[WITH] {MASKING POLICY | TAG | ROW ACCESS POLICY}`,`COPY GRANTS`,`USING TEMPLATE`,`MERGE INTO`,`WHEN MATCHED [AND]`,`THEN {UPDATE SET | DELETE}`,`WHEN NOT MATCHED THEN INSERT`]),VQ=Y([`CREATE [OR REPLACE] [VOLATILE] TABLE [IF NOT EXISTS]`,`CREATE [OR REPLACE] [LOCAL | GLOBAL] {TEMP|TEMPORARY} TABLE [IF NOT EXISTS]`]),HQ=Y(`CREATE [OR REPLACE] [SECURE] [RECURSIVE] VIEW [IF NOT EXISTS].UPDATE.DELETE FROM.DROP TABLE [IF EXISTS].ALTER TABLE [IF EXISTS].RENAME TO.SWAP WITH.[SUSPEND | RESUME] RECLUSTER.DROP CLUSTERING KEY.ADD [COLUMN].RENAME COLUMN.{ALTER | MODIFY} [COLUMN].DROP [COLUMN].{ADD | ALTER | MODIFY | DROP} [CONSTRAINT].RENAME CONSTRAINT.{ADD | DROP} SEARCH OPTIMIZATION.{SET | UNSET} TAG.{ADD | DROP} ROW ACCESS POLICY.DROP ALL ROW ACCESS POLICIES.{SET | DROP} DEFAULT.{SET | DROP} NOT NULL.SET DATA TYPE.UNSET COMMENT.{SET | UNSET} MASKING POLICY.TRUNCATE [TABLE] [IF EXISTS].ALTER ACCOUNT.ALTER API INTEGRATION.ALTER CONNECTION.ALTER DATABASE.ALTER EXTERNAL TABLE.ALTER FAILOVER GROUP.ALTER FILE FORMAT.ALTER FUNCTION.ALTER INTEGRATION.ALTER MASKING POLICY.ALTER MATERIALIZED VIEW.ALTER NETWORK POLICY.ALTER NOTIFICATION INTEGRATION.ALTER PIPE.ALTER PROCEDURE.ALTER REPLICATION GROUP.ALTER RESOURCE MONITOR.ALTER ROLE.ALTER ROW ACCESS POLICY.ALTER SCHEMA.ALTER SECURITY INTEGRATION.ALTER SEQUENCE.ALTER SESSION.ALTER SESSION POLICY.ALTER SHARE.ALTER STAGE.ALTER STORAGE INTEGRATION.ALTER STREAM.ALTER TAG.ALTER TASK.ALTER USER.ALTER VIEW.ALTER WAREHOUSE.BEGIN.CALL.COMMIT.COPY INTO.CREATE ACCOUNT.CREATE API INTEGRATION.CREATE CONNECTION.CREATE DATABASE.CREATE EXTERNAL FUNCTION.CREATE EXTERNAL TABLE.CREATE FAILOVER GROUP.CREATE FILE FORMAT.CREATE FUNCTION.CREATE INTEGRATION.CREATE MANAGED ACCOUNT.CREATE MASKING POLICY.CREATE MATERIALIZED VIEW.CREATE NETWORK POLICY.CREATE NOTIFICATION INTEGRATION.CREATE PIPE.CREATE PROCEDURE.CREATE REPLICATION GROUP.CREATE RESOURCE MONITOR.CREATE ROLE.CREATE ROW ACCESS POLICY.CREATE SCHEMA.CREATE SECURITY INTEGRATION.CREATE SEQUENCE.CREATE SESSION POLICY.CREATE SHARE.CREATE STAGE.CREATE STORAGE INTEGRATION.CREATE STREAM.CREATE TAG.CREATE TASK.CREATE USER.CREATE WAREHOUSE.DELETE.DESCRIBE DATABASE.DESCRIBE EXTERNAL TABLE.DESCRIBE FILE FORMAT.DESCRIBE FUNCTION.DESCRIBE INTEGRATION.DESCRIBE MASKING POLICY.DESCRIBE MATERIALIZED VIEW.DESCRIBE NETWORK POLICY.DESCRIBE PIPE.DESCRIBE PROCEDURE.DESCRIBE RESULT.DESCRIBE ROW ACCESS POLICY.DESCRIBE SCHEMA.DESCRIBE SEQUENCE.DESCRIBE SESSION POLICY.DESCRIBE SHARE.DESCRIBE STAGE.DESCRIBE STREAM.DESCRIBE TABLE.DESCRIBE TASK.DESCRIBE TRANSACTION.DESCRIBE USER.DESCRIBE VIEW.DESCRIBE WAREHOUSE.DROP CONNECTION.DROP DATABASE.DROP EXTERNAL TABLE.DROP FAILOVER GROUP.DROP FILE FORMAT.DROP FUNCTION.DROP INTEGRATION.DROP MANAGED ACCOUNT.DROP MASKING POLICY.DROP MATERIALIZED VIEW.DROP NETWORK POLICY.DROP PIPE.DROP PROCEDURE.DROP REPLICATION GROUP.DROP RESOURCE MONITOR.DROP ROLE.DROP ROW ACCESS POLICY.DROP SCHEMA.DROP SEQUENCE.DROP SESSION POLICY.DROP SHARE.DROP STAGE.DROP STREAM.DROP TAG.DROP TASK.DROP USER.DROP VIEW.DROP WAREHOUSE.EXECUTE IMMEDIATE.EXECUTE TASK.EXPLAIN.GET.GRANT OWNERSHIP.GRANT ROLE.INSERT.LIST.MERGE.PUT.REMOVE.REVOKE ROLE.ROLLBACK.SHOW COLUMNS.SHOW CONNECTIONS.SHOW DATABASES.SHOW DATABASES IN FAILOVER GROUP.SHOW DATABASES IN REPLICATION GROUP.SHOW DELEGATED AUTHORIZATIONS.SHOW EXTERNAL FUNCTIONS.SHOW EXTERNAL TABLES.SHOW FAILOVER GROUPS.SHOW FILE FORMATS.SHOW FUNCTIONS.SHOW GLOBAL ACCOUNTS.SHOW GRANTS.SHOW INTEGRATIONS.SHOW LOCKS.SHOW MANAGED ACCOUNTS.SHOW MASKING POLICIES.SHOW MATERIALIZED VIEWS.SHOW NETWORK POLICIES.SHOW OBJECTS.SHOW ORGANIZATION ACCOUNTS.SHOW PARAMETERS.SHOW PIPES.SHOW PRIMARY KEYS.SHOW PROCEDURES.SHOW REGIONS.SHOW REPLICATION ACCOUNTS.SHOW REPLICATION DATABASES.SHOW REPLICATION GROUPS.SHOW RESOURCE MONITORS.SHOW ROLES.SHOW ROW ACCESS POLICIES.SHOW SCHEMAS.SHOW SEQUENCES.SHOW SESSION POLICIES.SHOW SHARES.SHOW SHARES IN FAILOVER GROUP.SHOW SHARES IN REPLICATION GROUP.SHOW STAGES.SHOW STREAMS.SHOW TABLES.SHOW TAGS.SHOW TASKS.SHOW TRANSACTIONS.SHOW USER FUNCTIONS.SHOW USERS.SHOW VARIABLES.SHOW VIEWS.SHOW WAREHOUSES.TRUNCATE MATERIALIZED VIEW.UNDROP DATABASE.UNDROP SCHEMA.UNDROP TABLE.UNDROP TAG.UNSET.USE DATABASE.USE ROLE.USE SCHEMA.USE SECONDARY ROLES.USE WAREHOUSE`.split(`.`)),UQ=Y([`UNION [ALL]`,`MINUS`,`EXCEPT`,`INTERSECT`]),WQ=Y([`[INNER] JOIN`,`[NATURAL] {LEFT | RIGHT | FULL} [OUTER] JOIN`,`{CROSS | NATURAL} JOIN`]),GQ=Y([`{ROWS | RANGE} BETWEEN`,`ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]`]),KQ=Y([]),qQ={name:`snowflake`,tokenizerOptions:{reservedSelect:zQ,reservedClauses:[...BQ,...VQ,...HQ],reservedSetOperations:UQ,reservedJoins:WQ,reservedKeywordPhrases:GQ,reservedDataTypePhrases:KQ,reservedKeywords:LQ,reservedDataTypes:RQ,reservedFunctionNames:IQ,stringTypes:[`$$`,`''-qq-bs`],identTypes:[`""-qq`],variableTypes:[{regex:`[$][1-9]\\d*`},{regex:`[$][_a-zA-Z][_a-zA-Z0-9$]*`}],extraParens:[`[]`],identChars:{rest:`$`},lineCommentTypes:[`--`,`//`],operators:[`%`,`::`,`||`,`=>`,`:=`,`->`],propertyAccessOperators:[`:`]},formatOptions:{alwaysDenseOperators:[`::`],onelineClauses:[...VQ,...HQ],tabularOnelineClauses:HQ}},JQ=s({bigquery:()=>OJ,clickhouse:()=>WJ,db2:()=>rY,db2i:()=>hY,duckdb:()=>DY,hive:()=>zY,mariadb:()=>QY,mysql:()=>uX,n1ql:()=>NX,plsql:()=>GX,postgresql:()=>iZ,redshift:()=>gZ,singlestoredb:()=>FQ,snowflake:()=>qQ,spark:()=>OZ,sql:()=>$Z,sqlite:()=>VZ,tidb:()=>SX,transactsql:()=>CQ,trino:()=>dQ}),YQ=e=>e[e.length-1],XQ=e=>e.sort((e,t)=>t.length-e.length||e.localeCompare(t)),ZQ=e=>e.replace(/\s+/gu,` `),QQ=e=>/\n/.test(e),$Q=e=>e.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`),e$=/\s+/uy,t$=e=>RegExp(`(?:${e})`,`uy`),n$=e=>e.split(``).map(e=>/ /gu.test(e)?`\\s+`:`[${e.toUpperCase()}${e.toLowerCase()}]`).join(``),r$=e=>e+`(?:-`+e+`)*`,i$=({prefixes:e,requirePrefix:t})=>`(?:${e.map(n$).join(`|`)}${t?``:`|`})`,a$=e=>RegExp(`(?:${e.map($Q).join(`|`)}).*?(?=\r\n|\r|\n|$)`,`uy`),o$=(e,t=[])=>{let n=e===`open`?0:1;return t$([`()`,...t].map(e=>e[n]).map($Q).join(`|`))},s$=e=>t$(`${XQ(e).map($Q).join(`|`)}`),c$=({rest:e,dashes:t})=>e||t?`(?![${e||``}${t?`-`:``}])`:``,l$=(e,t={})=>{if(e.length===0)return/^\b$/u;let n=c$(t),r=XQ(e).map($Q).join(`|`).replace(/ /gu,`\\s+`);return RegExp(`(?:${r})${n}\\b`,`iuy`)},u$=(e,t)=>{if(e.length)return t$(`(?:${e.map($Q).join(`|`)})(?:${t})`)},d$={"``":"(?:`[^`]*`)+","[]":String.raw`(?:\[[^\]]*\])(?:\][^\]]*\])*`,'""-qq':String.raw`(?:"[^"]*")+`,'""-bs':String.raw`(?:"[^"\\]*(?:\\.[^"\\]*)*")`,'""-qq-bs':String.raw`(?:"[^"\\]*(?:\\.[^"\\]*)*")+`,'""-raw':String.raw`(?:"[^"]*")`,"''-qq":String.raw`(?:'[^']*')+`,"''-bs":String.raw`(?:'[^'\\]*(?:\\.[^'\\]*)*')`,"''-qq-bs":String.raw`(?:'[^'\\]*(?:\\.[^'\\]*)*')+`,"''-raw":String.raw`(?:'[^']*')`,$$:String.raw`(?<tag>\$\w*\$)[\s\S]*?\k<tag>`,"'''..'''":String.raw`'''[^\\]*?(?:\\.[^\\]*?)*?'''`,'""".."""':String.raw`"""[^\\]*?(?:\\.[^\\]*?)*?"""`,"{}":String.raw`(?:\{[^\}]*\})`,"q''":(()=>{let e={"<":`>`,"[":`]`,"(":`)`,"{":`}`},t=Object.entries(e).map(([e,t])=>`{left}(?:(?!{right}').)*?{right}`.replace(/{left}/g,$Q(e)).replace(/{right}/g,$Q(t))),n=$Q(Object.keys(e).join(``));return`[Qq]'(?:${String.raw`(?<tag>[^\s${n}])(?:(?!\k<tag>').)*?\k<tag>`}|${t.join(`|`)})'`})()},f$=e=>typeof e==`string`?d$[e]:`regex`in e?e.regex:i$(e)+d$[e.quote],p$=e=>t$(e.map(e=>`regex`in e?e.regex:f$(e)).join(`|`)),m$=e=>e.map(f$).join(`|`),h$=e=>t$(m$(e)),g$=(e={})=>t$(_$(e)),_$=({first:e,rest:t,dashes:n,allowFirstCharNumber:r}={})=>{let i=`\\p{Alphabetic}\\p{Mark}_`,a=`\\p{Decimal_Number}`,o=$Q(e??``),s=$Q(t??``),c=r?`[${i}${a}${o}][${i}${a}${s}]*`:`[${i}${o}][${i}${a}${s}]*`;return n?r$(c):c};function v$(e,t){let n=e.slice(0,t).split(/\n/);return{line:n.length,col:n[n.length-1].length+1}}var y$=class{constructor(e,t){this.rules=e,this.dialectName=t,this.input=``,this.index=0}tokenize(e){this.input=e,this.index=0;let t=[],n;for(;this.index<this.input.length;){let e=this.getWhitespace();if(this.index<this.input.length){if(n=this.getNextToken(),!n)throw this.createParseError();t.push(Object.assign(Object.assign({},n),{precedingWhitespace:e}))}}return t}createParseError(){let e=this.input.slice(this.index,this.index+10),{line:t,col:n}=v$(this.input,this.index);return Error(`Parse error: Unexpected "${e}" at line ${t} column ${n}.\n${this.dialectInfo()}`)}dialectInfo(){return this.dialectName===`sql`?`This likely happens because you're using the default "sql" dialect.
|
|
217
|
-
If possible, please select a more specific dialect (like sqlite, postgresql, etc).`:`SQL dialect used: "${this.dialectName}".`}getWhitespace(){e$.lastIndex=this.index;let e=e$.exec(this.input);if(e)return this.index+=e[0].length,e[0]}getNextToken(){for(let e of this.rules){let t=this.match(e);if(t)return t}}match(e){e.regex.lastIndex=this.index;let t=e.regex.exec(this.input);if(t){let n=t[0],r={type:e.type,raw:n,text:e.text?e.text(n):n,start:this.index};return e.key&&(r.key=e.key(n)),this.index+=n.length,r}}},b$=/\/\*/uy,x$=/[\s\S]/uy,S$=/\*\//uy,C$=class{constructor(){this.lastIndex=0}exec(e){let t=``,n,r=0;if(n=this.matchSection(b$,e))t+=n,r++;else return null;for(;r>0;)if(n=this.matchSection(b$,e))t+=n,r++;else if(n=this.matchSection(S$,e))t+=n,r--;else if(n=this.matchSection(x$,e))t+=n;else return null;return[t]}matchSection(e,t){e.lastIndex=this.lastIndex;let n=e.exec(t);return n&&(this.lastIndex+=n[0].length),n?n[0]:null}},w$=class{constructor(e,t){this.cfg=e,this.dialectName=t,this.rulesBeforeParams=this.buildRulesBeforeParams(e),this.rulesAfterParams=this.buildRulesAfterParams(e)}tokenize(e,t){let n=new y$([...this.rulesBeforeParams,...this.buildParamRules(this.cfg,t),...this.rulesAfterParams],this.dialectName).tokenize(e);return this.cfg.postProcess?this.cfg.postProcess(n):n}buildRulesBeforeParams(e){return this.validRules([{type:X.DISABLE_COMMENT,regex:/(\/\* *sql-formatter-disable *\*\/[\s\S]*?(?:\/\* *sql-formatter-enable *\*\/|$))/uy},{type:X.BLOCK_COMMENT,regex:e.nestedBlockComments?new C$:/(\/\*[^]*?\*\/)/uy},{type:X.LINE_COMMENT,regex:a$(e.lineCommentTypes??[`--`])},{type:X.QUOTED_IDENTIFIER,regex:h$(e.identTypes)},{type:X.NUMBER,regex:e.underscoresInNumbers?/(?:0x[0-9a-fA-F_]+|0b[01_]+|(?:-\s*)?(?:[0-9_]*\.[0-9_]+|[0-9_]+(?:\.[0-9_]*)?)(?:[eE][-+]?[0-9_]+(?:\.[0-9_]+)?)?)(?![\w\p{Alphabetic}])/uy:/(?:0x[0-9a-fA-F]+|0b[01]+|(?:-\s*)?(?:[0-9]*\.[0-9]+|[0-9]+(?:\.[0-9]*)?)(?:[eE][-+]?[0-9]+(?:\.[0-9]+)?)?)(?![\w\p{Alphabetic}])/uy},{type:X.RESERVED_KEYWORD_PHRASE,regex:l$(e.reservedKeywordPhrases??[],e.identChars),text:T$},{type:X.RESERVED_DATA_TYPE_PHRASE,regex:l$(e.reservedDataTypePhrases??[],e.identChars),text:T$},{type:X.CASE,regex:/CASE\b/iuy,text:T$},{type:X.END,regex:/END\b/iuy,text:T$},{type:X.BETWEEN,regex:/BETWEEN\b/iuy,text:T$},{type:X.LIMIT,regex:e.reservedClauses.includes(`LIMIT`)?/LIMIT\b/iuy:void 0,text:T$},{type:X.RESERVED_CLAUSE,regex:l$(e.reservedClauses,e.identChars),text:T$},{type:X.RESERVED_SELECT,regex:l$(e.reservedSelect,e.identChars),text:T$},{type:X.RESERVED_SET_OPERATION,regex:l$(e.reservedSetOperations,e.identChars),text:T$},{type:X.WHEN,regex:/WHEN\b/iuy,text:T$},{type:X.ELSE,regex:/ELSE\b/iuy,text:T$},{type:X.THEN,regex:/THEN\b/iuy,text:T$},{type:X.RESERVED_JOIN,regex:l$(e.reservedJoins,e.identChars),text:T$},{type:X.AND,regex:/AND\b/iuy,text:T$},{type:X.OR,regex:/OR\b/iuy,text:T$},{type:X.XOR,regex:e.supportsXor?/XOR\b/iuy:void 0,text:T$},...e.operatorKeyword?[{type:X.OPERATOR,regex:/OPERATOR *\([^)]+\)/iuy}]:[],{type:X.RESERVED_FUNCTION_NAME,regex:l$(e.reservedFunctionNames,e.identChars),text:T$},{type:X.RESERVED_DATA_TYPE,regex:l$(e.reservedDataTypes,e.identChars),text:T$},{type:X.RESERVED_KEYWORD,regex:l$(e.reservedKeywords,e.identChars),text:T$}])}buildRulesAfterParams(e){return this.validRules([{type:X.VARIABLE,regex:e.variableTypes?p$(e.variableTypes):void 0},{type:X.STRING,regex:h$(e.stringTypes)},{type:X.IDENTIFIER,regex:g$(e.identChars)},{type:X.DELIMITER,regex:/[;]/uy},{type:X.COMMA,regex:/[,]/y},{type:X.OPEN_PAREN,regex:o$(`open`,e.extraParens)},{type:X.CLOSE_PAREN,regex:o$(`close`,e.extraParens)},{type:X.OPERATOR,regex:s$([`+`,`-`,`/`,`>`,`<`,`=`,`<>`,`<=`,`>=`,`!=`,...e.operators??[]])},{type:X.ASTERISK,regex:/[*]/uy},{type:X.PROPERTY_ACCESS_OPERATOR,regex:s$([`.`,...e.propertyAccessOperators??[]])}])}buildParamRules(e,t){let n={named:t?.named||e.paramTypes?.named||[],quoted:t?.quoted||e.paramTypes?.quoted||[],numbered:t?.numbered||e.paramTypes?.numbered||[],positional:typeof t?.positional==`boolean`?t.positional:e.paramTypes?.positional,custom:t?.custom||e.paramTypes?.custom||[]};return this.validRules([{type:X.NAMED_PARAMETER,regex:u$(n.named,_$(e.paramChars||e.identChars)),key:e=>e.slice(1)},{type:X.QUOTED_PARAMETER,regex:u$(n.quoted,m$(e.identTypes)),key:e=>(({tokenKey:e,quoteChar:t})=>e.replace(new RegExp($Q(`\\`+t),`gu`),t))({tokenKey:e.slice(2,-1),quoteChar:e.slice(-1)})},{type:X.NUMBERED_PARAMETER,regex:u$(n.numbered,`[0-9]+`),key:e=>e.slice(1)},{type:X.POSITIONAL_PARAMETER,regex:n.positional?/[?]/y:void 0},...n.custom.map(e=>({type:X.CUSTOM_PARAMETER,regex:t$(e.regex),key:e.key??(e=>e)}))])}validRules(e){return e.filter(e=>!!e.regex)}},T$=e=>ZQ(e.toUpperCase()),E$=new Map,D$=e=>{let t=E$.get(e);return t||(t=O$(e),E$.set(e,t)),t},O$=e=>({tokenizer:new w$(e.tokenizerOptions,e.name),formatOptions:k$(e.formatOptions)}),k$=e=>({alwaysDenseOperators:e.alwaysDenseOperators||[],onelineClauses:Object.fromEntries(e.onelineClauses.map(e=>[e,!0])),tabularOnelineClauses:Object.fromEntries((e.tabularOnelineClauses??e.onelineClauses).map(e=>[e,!0]))});function A$(e){return e.indentStyle===`tabularLeft`||e.indentStyle===`tabularRight`?` `.repeat(10):e.useTabs?` `:` `.repeat(e.tabWidth)}function j$(e){return e.indentStyle===`tabularLeft`||e.indentStyle===`tabularRight`}var M$=class{constructor(e){this.params=e,this.index=0}get({key:e,text:t}){return this.params?e?this.params[e]:this.params[this.index++]:t}getPositionalParameterIndex(){return this.index}setPositionalParameterIndex(e){this.index=e}},N$=o(((e,t)=>{(function(e,n){typeof t==`object`&&t.exports?t.exports=n():e.nearley=n()})(e,function(){function e(t,n,r){return this.id=++e.highestId,this.name=t,this.symbols=n,this.postprocess=r,this}e.highestId=0,e.prototype.toString=function(e){var t=e===void 0?this.symbols.map(s).join(` `):this.symbols.slice(0,e).map(s).join(` `)+` ● `+this.symbols.slice(e).map(s).join(` `);return this.name+` → `+t};function t(e,t,n,r){this.rule=e,this.dot=t,this.reference=n,this.data=[],this.wantedBy=r,this.isComplete=this.dot===e.symbols.length}t.prototype.toString=function(){return`{`+this.rule.toString(this.dot)+`}, from: `+(this.reference||0)},t.prototype.nextState=function(e){var n=new t(this.rule,this.dot+1,this.reference,this.wantedBy);return n.left=this,n.right=e,n.isComplete&&(n.data=n.build(),n.right=void 0),n},t.prototype.build=function(){var e=[],t=this;do e.push(t.right.data),t=t.left;while(t.left);return e.reverse(),e},t.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,a.fail))};function n(e,t){this.grammar=e,this.index=t,this.states=[],this.wants={},this.scannable=[],this.completed={}}n.prototype.process=function(e){for(var t=this.states,n=this.wants,r=this.completed,i=0;i<t.length;i++){var o=t[i];if(o.isComplete){if(o.finish(),o.data!==a.fail){for(var s=o.wantedBy,c=s.length;c--;){var l=s[c];this.complete(l,o)}if(o.reference===this.index){var u=o.rule.name;(this.completed[u]=this.completed[u]||[]).push(o)}}}else{var u=o.rule.symbols[o.dot];if(typeof u!=`string`){this.scannable.push(o);continue}if(n[u]){if(n[u].push(o),r.hasOwnProperty(u))for(var d=r[u],c=0;c<d.length;c++){var f=d[c];this.complete(o,f)}}else n[u]=[o],this.predict(u)}}},n.prototype.predict=function(e){for(var n=this.grammar.byName[e]||[],r=0;r<n.length;r++){var i=n[r],a=this.wants[e],o=new t(i,0,this.index,a);this.states.push(o)}},n.prototype.complete=function(e,t){var n=e.nextState(t);this.states.push(n)};function r(e,t){this.rules=e,this.start=t||this.rules[0].name;var n=this.byName={};this.rules.forEach(function(e){n.hasOwnProperty(e.name)||(n[e.name]=[]),n[e.name].push(e)})}r.fromCompiled=function(t,n){var i=t.Lexer;t.ParserStart&&(n=t.ParserStart,t=t.ParserRules);var t=t.map(function(t){return new e(t.name,t.symbols,t.postprocess)}),a=new r(t,n);return a.lexer=i,a};function i(){this.reset(``)}i.prototype.reset=function(e,t){this.buffer=e,this.index=0,this.line=t?t.line:1,this.lastLineBreak=t?-t.col:0},i.prototype.next=function(){if(this.index<this.buffer.length){var e=this.buffer[this.index++];return e===`
|
|
218
|
-
`&&(this.line+=1,this.lastLineBreak=this.index),{value:e}}},i.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},i.prototype.formatError=function(e,t){var n=this.buffer;if(typeof n==`string`){var r=n.split(`
|
|
219
|
-
`).slice(Math.max(0,this.line-5),this.line),i=n.indexOf(`
|
|
220
|
-
`,this.index);i===-1&&(i=n.length);var a=this.index-this.lastLineBreak,o=String(this.line).length;return t+=` at line `+this.line+` col `+a+`:
|
|
221
|
-
|
|
222
|
-
`,t+=r.map(function(e,t){return s(this.line-r.length+t+1,o)+` `+e},this).join(`
|
|
223
|
-
`),t+=`
|
|
224
|
-
`+s(``,o+a)+`^
|
|
225
|
-
`,t}else return t+` at index `+(this.index-1);function s(e,t){var n=String(e);return Array(t-n.length+1).join(` `)+n}};function a(e,t,a){if(e instanceof r)var o=e,a=t;else var o=r.fromCompiled(e,t);for(var s in this.grammar=o,this.options={keepHistory:!1,lexer:o.lexer||new i},a||{})this.options[s]=a[s];this.lexer=this.options.lexer,this.lexerState=void 0;var c=new n(o,0);this.table=[c],c.wants[o.start]=[],c.predict(o.start),c.process(),this.current=0}a.fail={},a.prototype.feed=function(e){var t=this.lexer;t.reset(e,this.lexerState);for(var r;;){try{if(r=t.next(),!r)break}catch(e){var a=new n(this.grammar,this.current+1);this.table.push(a);var o=Error(this.reportLexerError(e));throw o.offset=this.current,o.token=e.token,o}var s=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var c=this.current+1,a=new n(this.grammar,c);this.table.push(a);for(var l=r.text===void 0?r.value:r.text,u=t.constructor===i?r.value:r,d=s.scannable,f=d.length;f--;){var p=d[f],m=p.rule.symbols[p.dot];if(m.test?m.test(u):m.type?m.type===r.type:m.literal===l){var h=p.nextState({data:u,token:r,isToken:!0,reference:c-1});a.states.push(h)}}if(a.process(),a.states.length===0){var o=Error(this.reportError(r));throw o.offset=this.current,o.token=r,o}this.options.keepHistory&&(s.lexerState=t.save()),this.current++}return s&&(this.lexerState=t.save()),this.results=this.finish(),this},a.prototype.reportLexerError=function(e){var t,n,r=e.token;return r?(t=`input `+JSON.stringify(r.text[0])+` (lexer error)`,n=this.lexer.formatError(r,`Syntax error`)):(t=`input (lexer error)`,n=e.message),this.reportErrorCommon(n,t)},a.prototype.reportError=function(e){var t=(e.type?e.type+` token: `:``)+JSON.stringify(e.value===void 0?e:e.value),n=this.lexer.formatError(e,`Syntax error`);return this.reportErrorCommon(n,t)},a.prototype.reportErrorCommon=function(e,t){var n=[];n.push(e);var r=this.table.length-2,i=this.table[r],a=i.states.filter(function(e){var t=e.rule.symbols[e.dot];return t&&typeof t!=`string`});return a.length===0?(n.push(`Unexpected `+t+`. I did not expect any more input. Here is the state of my parse table:
|
|
226
|
-
`),this.displayStateStack(i.states,n)):(n.push(`Unexpected `+t+`. Instead, I was expecting to see one of the following:
|
|
227
|
-
`),a.map(function(e){return this.buildFirstStateStack(e,[])||[e]},this).forEach(function(e){var t=e[0],r=t.rule.symbols[t.dot],i=this.getSymbolDisplay(r);n.push(`A `+i+` based on:`),this.displayStateStack(e,n)},this)),n.push(``),n.join(`
|
|
228
|
-
`)},a.prototype.displayStateStack=function(e,t){for(var n,r=0,i=0;i<e.length;i++){var a=e[i],o=a.rule.toString(a.dot);o===n?r++:(r>0&&t.push(` ^ `+r+` more lines identical to this`),r=0,t.push(` `+o)),n=o}},a.prototype.getSymbolDisplay=function(e){return o(e)},a.prototype.buildFirstStateStack=function(e,t){if(t.indexOf(e)!==-1)return null;if(e.wantedBy.length===0)return[e];var n=e.wantedBy[0],r=[e].concat(t),i=this.buildFirstStateStack(n,r);return i===null?null:[e].concat(i)},a.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},a.prototype.restore=function(e){var t=e.index;this.current=t,this.table[t]=e,this.table.splice(t+1),this.lexerState=e.lexerState,this.results=this.finish()},a.prototype.rewind=function(e){if(!this.options.keepHistory)throw Error("set option `keepHistory` to enable rewinding");this.restore(this.table[e])},a.prototype.finish=function(){var e=[],t=this.grammar.start;return this.table[this.table.length-1].states.forEach(function(n){n.rule.name===t&&n.dot===n.rule.symbols.length&&n.reference===0&&n.data!==a.fail&&e.push(n)}),e.map(function(e){return e.data})};function o(e){var t=typeof e;if(t===`string`)return e;if(t===`object`){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return`character matching `+e;if(e.type)return e.type+` token`;if(e.test)return`token matching `+String(e.test);throw Error(`Unknown symbol type: `+e)}}function s(e){var t=typeof e;if(t===`string`)return e;if(t===`object`){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return e.toString();if(e.type)return`%`+e.type;if(e.test)return`<`+String(e.test)+`>`;throw Error(`Unknown symbol type: `+e)}}return{Parser:a,Grammar:r,Rule:e}})}));function P$(e){return e.map(F$).map(I$).map(L$).map(R$).map(z$)}var F$=(e,t,n)=>{if(hJ(e.type)){let r=B$(n,t);if(r&&r.type===X.PROPERTY_ACCESS_OPERATOR)return Object.assign(Object.assign({},e),{type:X.IDENTIFIER,text:e.raw});let i=V$(n,t);if(i&&i.type===X.PROPERTY_ACCESS_OPERATOR)return Object.assign(Object.assign({},e),{type:X.IDENTIFIER,text:e.raw})}return e},I$=(e,t,n)=>{if(e.type===X.RESERVED_FUNCTION_NAME){let r=V$(n,t);if(!r||!H$(r))return Object.assign(Object.assign({},e),{type:X.IDENTIFIER,text:e.raw})}return e},L$=(e,t,n)=>{if(e.type===X.RESERVED_DATA_TYPE){let r=V$(n,t);if(r&&H$(r))return Object.assign(Object.assign({},e),{type:X.RESERVED_PARAMETERIZED_DATA_TYPE})}return e},R$=(e,t,n)=>{if(e.type===X.IDENTIFIER){let r=V$(n,t);if(r&&U$(r))return Object.assign(Object.assign({},e),{type:X.ARRAY_IDENTIFIER})}return e},z$=(e,t,n)=>{if(e.type===X.RESERVED_DATA_TYPE){let r=V$(n,t);if(r&&U$(r))return Object.assign(Object.assign({},e),{type:X.ARRAY_KEYWORD})}return e},B$=(e,t)=>V$(e,t,-1),V$=(e,t,n=1)=>{let r=1;for(;e[t+r*n]&&W$(e[t+r*n]);)r++;return e[t+r*n]},H$=e=>e.type===X.OPEN_PAREN&&e.text===`(`,U$=e=>e.type===X.OPEN_PAREN&&e.text===`[`,W$=e=>e.type===X.BLOCK_COMMENT||e.type===X.LINE_COMMENT,G$=class{constructor(e){this.tokenize=e,this.index=0,this.tokens=[],this.input=``}reset(e,t){this.input=e,this.index=0,this.tokens=this.tokenize(e)}next(){return this.tokens[this.index++]}save(){}formatError(e){let{line:t,col:n}=v$(this.input,e.start);return`Parse error at token: ${e.text} at line ${t} column ${n}`}has(e){return e in X}},Z;(function(e){e.statement=`statement`,e.clause=`clause`,e.set_operation=`set_operation`,e.function_call=`function_call`,e.parameterized_data_type=`parameterized_data_type`,e.array_subscript=`array_subscript`,e.property_access=`property_access`,e.parenthesis=`parenthesis`,e.between_predicate=`between_predicate`,e.case_expression=`case_expression`,e.case_when=`case_when`,e.case_else=`case_else`,e.limit_clause=`limit_clause`,e.all_columns_asterisk=`all_columns_asterisk`,e.literal=`literal`,e.identifier=`identifier`,e.keyword=`keyword`,e.data_type=`data_type`,e.parameter=`parameter`,e.operator=`operator`,e.comma=`comma`,e.line_comment=`line_comment`,e.block_comment=`block_comment`,e.disable_comment=`disable_comment`})(Z=Z||={});function K$(e){return e[0]}var Q=new G$(e=>[]),q$=([[e]])=>e,J$=e=>({type:Z.keyword,tokenType:e.type,text:e.text,raw:e.raw}),Y$=e=>({type:Z.data_type,text:e.text,raw:e.raw}),X$=(e,{leading:t,trailing:n})=>(t?.length&&(e=Object.assign(Object.assign({},e),{leadingComments:t})),n?.length&&(e=Object.assign(Object.assign({},e),{trailingComments:n})),e),Z$=(e,{leading:t,trailing:n})=>{if(t?.length){let[n,...r]=e;e=[X$(n,{leading:t}),...r]}if(n?.length){let t=e.slice(0,-1),r=e[e.length-1];e=[...t,X$(r,{trailing:n})]}return e},Q$={Lexer:Q,ParserRules:[{name:`main$ebnf$1`,symbols:[]},{name:`main$ebnf$1`,symbols:[`main$ebnf$1`,`statement`],postprocess:e=>e[0].concat([e[1]])},{name:`main`,symbols:[`main$ebnf$1`],postprocess:([e])=>{let t=e[e.length-1];return t&&!t.hasSemicolon?t.children.length>0?e:e.slice(0,-1):e}},{name:`statement$subexpression$1`,symbols:[Q.has(`DELIMITER`)?{type:`DELIMITER`}:DELIMITER]},{name:`statement$subexpression$1`,symbols:[Q.has(`EOF`)?{type:`EOF`}:EOF]},{name:`statement`,symbols:[`expressions_or_clauses`,`statement$subexpression$1`],postprocess:([e,[t]])=>({type:Z.statement,children:e,hasSemicolon:t.type===X.DELIMITER})},{name:`expressions_or_clauses$ebnf$1`,symbols:[]},{name:`expressions_or_clauses$ebnf$1`,symbols:[`expressions_or_clauses$ebnf$1`,`free_form_sql`],postprocess:e=>e[0].concat([e[1]])},{name:`expressions_or_clauses$ebnf$2`,symbols:[]},{name:`expressions_or_clauses$ebnf$2`,symbols:[`expressions_or_clauses$ebnf$2`,`clause`],postprocess:e=>e[0].concat([e[1]])},{name:`expressions_or_clauses`,symbols:[`expressions_or_clauses$ebnf$1`,`expressions_or_clauses$ebnf$2`],postprocess:([e,t])=>[...e,...t]},{name:`clause$subexpression$1`,symbols:[`limit_clause`]},{name:`clause$subexpression$1`,symbols:[`select_clause`]},{name:`clause$subexpression$1`,symbols:[`other_clause`]},{name:`clause$subexpression$1`,symbols:[`set_operation`]},{name:`clause`,symbols:[`clause$subexpression$1`],postprocess:q$},{name:`limit_clause$ebnf$1$subexpression$1$ebnf$1`,symbols:[`free_form_sql`]},{name:`limit_clause$ebnf$1$subexpression$1$ebnf$1`,symbols:[`limit_clause$ebnf$1$subexpression$1$ebnf$1`,`free_form_sql`],postprocess:e=>e[0].concat([e[1]])},{name:`limit_clause$ebnf$1$subexpression$1`,symbols:[Q.has(`COMMA`)?{type:`COMMA`}:COMMA,`limit_clause$ebnf$1$subexpression$1$ebnf$1`]},{name:`limit_clause$ebnf$1`,symbols:[`limit_clause$ebnf$1$subexpression$1`],postprocess:K$},{name:`limit_clause$ebnf$1`,symbols:[],postprocess:()=>null},{name:`limit_clause`,symbols:[Q.has(`LIMIT`)?{type:`LIMIT`}:LIMIT,`_`,`expression_chain_`,`limit_clause$ebnf$1`],postprocess:([e,t,n,r])=>{if(r){let[i,a]=r;return{type:Z.limit_clause,limitKw:X$(J$(e),{trailing:t}),offset:n,count:a}}else return{type:Z.limit_clause,limitKw:X$(J$(e),{trailing:t}),count:n}}},{name:`select_clause$subexpression$1$ebnf$1`,symbols:[]},{name:`select_clause$subexpression$1$ebnf$1`,symbols:[`select_clause$subexpression$1$ebnf$1`,`free_form_sql`],postprocess:e=>e[0].concat([e[1]])},{name:`select_clause$subexpression$1`,symbols:[`all_columns_asterisk`,`select_clause$subexpression$1$ebnf$1`]},{name:`select_clause$subexpression$1$ebnf$2`,symbols:[]},{name:`select_clause$subexpression$1$ebnf$2`,symbols:[`select_clause$subexpression$1$ebnf$2`,`free_form_sql`],postprocess:e=>e[0].concat([e[1]])},{name:`select_clause$subexpression$1`,symbols:[`asteriskless_free_form_sql`,`select_clause$subexpression$1$ebnf$2`]},{name:`select_clause`,symbols:[Q.has(`RESERVED_SELECT`)?{type:`RESERVED_SELECT`}:RESERVED_SELECT,`select_clause$subexpression$1`],postprocess:([e,[t,n]])=>({type:Z.clause,nameKw:J$(e),children:[t,...n]})},{name:`select_clause`,symbols:[Q.has(`RESERVED_SELECT`)?{type:`RESERVED_SELECT`}:RESERVED_SELECT],postprocess:([e])=>({type:Z.clause,nameKw:J$(e),children:[]})},{name:`all_columns_asterisk`,symbols:[Q.has(`ASTERISK`)?{type:`ASTERISK`}:ASTERISK],postprocess:()=>({type:Z.all_columns_asterisk})},{name:`other_clause$ebnf$1`,symbols:[]},{name:`other_clause$ebnf$1`,symbols:[`other_clause$ebnf$1`,`free_form_sql`],postprocess:e=>e[0].concat([e[1]])},{name:`other_clause`,symbols:[Q.has(`RESERVED_CLAUSE`)?{type:`RESERVED_CLAUSE`}:RESERVED_CLAUSE,`other_clause$ebnf$1`],postprocess:([e,t])=>({type:Z.clause,nameKw:J$(e),children:t})},{name:`set_operation$ebnf$1`,symbols:[]},{name:`set_operation$ebnf$1`,symbols:[`set_operation$ebnf$1`,`free_form_sql`],postprocess:e=>e[0].concat([e[1]])},{name:`set_operation`,symbols:[Q.has(`RESERVED_SET_OPERATION`)?{type:`RESERVED_SET_OPERATION`}:RESERVED_SET_OPERATION,`set_operation$ebnf$1`],postprocess:([e,t])=>({type:Z.set_operation,nameKw:J$(e),children:t})},{name:`expression_chain_$ebnf$1`,symbols:[`expression_with_comments_`]},{name:`expression_chain_$ebnf$1`,symbols:[`expression_chain_$ebnf$1`,`expression_with_comments_`],postprocess:e=>e[0].concat([e[1]])},{name:`expression_chain_`,symbols:[`expression_chain_$ebnf$1`],postprocess:K$},{name:`expression_chain$ebnf$1`,symbols:[]},{name:`expression_chain$ebnf$1`,symbols:[`expression_chain$ebnf$1`,`_expression_with_comments`],postprocess:e=>e[0].concat([e[1]])},{name:`expression_chain`,symbols:[`expression`,`expression_chain$ebnf$1`],postprocess:([e,t])=>[e,...t]},{name:`andless_expression_chain$ebnf$1`,symbols:[]},{name:`andless_expression_chain$ebnf$1`,symbols:[`andless_expression_chain$ebnf$1`,`_andless_expression_with_comments`],postprocess:e=>e[0].concat([e[1]])},{name:`andless_expression_chain`,symbols:[`andless_expression`,`andless_expression_chain$ebnf$1`],postprocess:([e,t])=>[e,...t]},{name:`expression_with_comments_`,symbols:[`expression`,`_`],postprocess:([e,t])=>X$(e,{trailing:t})},{name:`_expression_with_comments`,symbols:[`_`,`expression`],postprocess:([e,t])=>X$(t,{leading:e})},{name:`_andless_expression_with_comments`,symbols:[`_`,`andless_expression`],postprocess:([e,t])=>X$(t,{leading:e})},{name:`free_form_sql$subexpression$1`,symbols:[`asteriskless_free_form_sql`]},{name:`free_form_sql$subexpression$1`,symbols:[`asterisk`]},{name:`free_form_sql`,symbols:[`free_form_sql$subexpression$1`],postprocess:q$},{name:`asteriskless_free_form_sql$subexpression$1`,symbols:[`asteriskless_andless_expression`]},{name:`asteriskless_free_form_sql$subexpression$1`,symbols:[`logic_operator`]},{name:`asteriskless_free_form_sql$subexpression$1`,symbols:[`comma`]},{name:`asteriskless_free_form_sql$subexpression$1`,symbols:[`comment`]},{name:`asteriskless_free_form_sql$subexpression$1`,symbols:[`other_keyword`]},{name:`asteriskless_free_form_sql`,symbols:[`asteriskless_free_form_sql$subexpression$1`],postprocess:q$},{name:`expression$subexpression$1`,symbols:[`andless_expression`]},{name:`expression$subexpression$1`,symbols:[`logic_operator`]},{name:`expression`,symbols:[`expression$subexpression$1`],postprocess:q$},{name:`andless_expression$subexpression$1`,symbols:[`asteriskless_andless_expression`]},{name:`andless_expression$subexpression$1`,symbols:[`asterisk`]},{name:`andless_expression`,symbols:[`andless_expression$subexpression$1`],postprocess:q$},{name:`asteriskless_andless_expression$subexpression$1`,symbols:[`atomic_expression`]},{name:`asteriskless_andless_expression$subexpression$1`,symbols:[`between_predicate`]},{name:`asteriskless_andless_expression$subexpression$1`,symbols:[`case_expression`]},{name:`asteriskless_andless_expression`,symbols:[`asteriskless_andless_expression$subexpression$1`],postprocess:q$},{name:`atomic_expression$subexpression$1`,symbols:[`array_subscript`]},{name:`atomic_expression$subexpression$1`,symbols:[`function_call`]},{name:`atomic_expression$subexpression$1`,symbols:[`property_access`]},{name:`atomic_expression$subexpression$1`,symbols:[`parenthesis`]},{name:`atomic_expression$subexpression$1`,symbols:[`curly_braces`]},{name:`atomic_expression$subexpression$1`,symbols:[`square_brackets`]},{name:`atomic_expression$subexpression$1`,symbols:[`operator`]},{name:`atomic_expression$subexpression$1`,symbols:[`identifier`]},{name:`atomic_expression$subexpression$1`,symbols:[`parameter`]},{name:`atomic_expression$subexpression$1`,symbols:[`literal`]},{name:`atomic_expression$subexpression$1`,symbols:[`data_type`]},{name:`atomic_expression$subexpression$1`,symbols:[`keyword`]},{name:`atomic_expression`,symbols:[`atomic_expression$subexpression$1`],postprocess:q$},{name:`array_subscript`,symbols:[Q.has(`ARRAY_IDENTIFIER`)?{type:`ARRAY_IDENTIFIER`}:ARRAY_IDENTIFIER,`_`,`square_brackets`],postprocess:([e,t,n])=>({type:Z.array_subscript,array:X$({type:Z.identifier,quoted:!1,text:e.text},{trailing:t}),parenthesis:n})},{name:`array_subscript`,symbols:[Q.has(`ARRAY_KEYWORD`)?{type:`ARRAY_KEYWORD`}:ARRAY_KEYWORD,`_`,`square_brackets`],postprocess:([e,t,n])=>({type:Z.array_subscript,array:X$(J$(e),{trailing:t}),parenthesis:n})},{name:`function_call`,symbols:[Q.has(`RESERVED_FUNCTION_NAME`)?{type:`RESERVED_FUNCTION_NAME`}:RESERVED_FUNCTION_NAME,`_`,`parenthesis`],postprocess:([e,t,n])=>({type:Z.function_call,nameKw:X$(J$(e),{trailing:t}),parenthesis:n})},{name:`parenthesis`,symbols:[{literal:`(`},`expressions_or_clauses`,{literal:`)`}],postprocess:([e,t,n])=>({type:Z.parenthesis,children:t,openParen:`(`,closeParen:`)`})},{name:`curly_braces$ebnf$1`,symbols:[]},{name:`curly_braces$ebnf$1`,symbols:[`curly_braces$ebnf$1`,`free_form_sql`],postprocess:e=>e[0].concat([e[1]])},{name:`curly_braces`,symbols:[{literal:`{`},`curly_braces$ebnf$1`,{literal:`}`}],postprocess:([e,t,n])=>({type:Z.parenthesis,children:t,openParen:`{`,closeParen:`}`})},{name:`square_brackets$ebnf$1`,symbols:[]},{name:`square_brackets$ebnf$1`,symbols:[`square_brackets$ebnf$1`,`free_form_sql`],postprocess:e=>e[0].concat([e[1]])},{name:`square_brackets`,symbols:[{literal:`[`},`square_brackets$ebnf$1`,{literal:`]`}],postprocess:([e,t,n])=>({type:Z.parenthesis,children:t,openParen:`[`,closeParen:`]`})},{name:`property_access$subexpression$1`,symbols:[`identifier`]},{name:`property_access$subexpression$1`,symbols:[`array_subscript`]},{name:`property_access$subexpression$1`,symbols:[`all_columns_asterisk`]},{name:`property_access$subexpression$1`,symbols:[`parameter`]},{name:`property_access`,symbols:[`atomic_expression`,`_`,Q.has(`PROPERTY_ACCESS_OPERATOR`)?{type:`PROPERTY_ACCESS_OPERATOR`}:PROPERTY_ACCESS_OPERATOR,`_`,`property_access$subexpression$1`],postprocess:([e,t,n,r,[i]])=>({type:Z.property_access,object:X$(e,{trailing:t}),operator:n.text,property:X$(i,{leading:r})})},{name:`between_predicate`,symbols:[Q.has(`BETWEEN`)?{type:`BETWEEN`}:BETWEEN,`_`,`andless_expression_chain`,`_`,Q.has(`AND`)?{type:`AND`}:AND,`_`,`andless_expression`],postprocess:([e,t,n,r,i,a,o])=>({type:Z.between_predicate,betweenKw:J$(e),expr1:Z$(n,{leading:t,trailing:r}),andKw:J$(i),expr2:[X$(o,{leading:a})]})},{name:`case_expression$ebnf$1`,symbols:[`expression_chain_`],postprocess:K$},{name:`case_expression$ebnf$1`,symbols:[],postprocess:()=>null},{name:`case_expression$ebnf$2`,symbols:[]},{name:`case_expression$ebnf$2`,symbols:[`case_expression$ebnf$2`,`case_clause`],postprocess:e=>e[0].concat([e[1]])},{name:`case_expression`,symbols:[Q.has(`CASE`)?{type:`CASE`}:CASE,`_`,`case_expression$ebnf$1`,`case_expression$ebnf$2`,Q.has(`END`)?{type:`END`}:END],postprocess:([e,t,n,r,i])=>({type:Z.case_expression,caseKw:X$(J$(e),{trailing:t}),endKw:J$(i),expr:n||[],clauses:r})},{name:`case_clause`,symbols:[Q.has(`WHEN`)?{type:`WHEN`}:WHEN,`_`,`expression_chain_`,Q.has(`THEN`)?{type:`THEN`}:THEN,`_`,`expression_chain_`],postprocess:([e,t,n,r,i,a])=>({type:Z.case_when,whenKw:X$(J$(e),{trailing:t}),thenKw:X$(J$(r),{trailing:i}),condition:n,result:a})},{name:`case_clause`,symbols:[Q.has(`ELSE`)?{type:`ELSE`}:ELSE,`_`,`expression_chain_`],postprocess:([e,t,n])=>({type:Z.case_else,elseKw:X$(J$(e),{trailing:t}),result:n})},{name:`comma$subexpression$1`,symbols:[Q.has(`COMMA`)?{type:`COMMA`}:COMMA]},{name:`comma`,symbols:[`comma$subexpression$1`],postprocess:([[e]])=>({type:Z.comma})},{name:`asterisk$subexpression$1`,symbols:[Q.has(`ASTERISK`)?{type:`ASTERISK`}:ASTERISK]},{name:`asterisk`,symbols:[`asterisk$subexpression$1`],postprocess:([[e]])=>({type:Z.operator,text:e.text})},{name:`operator$subexpression$1`,symbols:[Q.has(`OPERATOR`)?{type:`OPERATOR`}:OPERATOR]},{name:`operator`,symbols:[`operator$subexpression$1`],postprocess:([[e]])=>({type:Z.operator,text:e.text})},{name:`identifier$subexpression$1`,symbols:[Q.has(`IDENTIFIER`)?{type:`IDENTIFIER`}:IDENTIFIER]},{name:`identifier$subexpression$1`,symbols:[Q.has(`QUOTED_IDENTIFIER`)?{type:`QUOTED_IDENTIFIER`}:QUOTED_IDENTIFIER]},{name:`identifier$subexpression$1`,symbols:[Q.has(`VARIABLE`)?{type:`VARIABLE`}:VARIABLE]},{name:`identifier`,symbols:[`identifier$subexpression$1`],postprocess:([[e]])=>({type:Z.identifier,quoted:e.type!==`IDENTIFIER`,text:e.text})},{name:`parameter$subexpression$1`,symbols:[Q.has(`NAMED_PARAMETER`)?{type:`NAMED_PARAMETER`}:NAMED_PARAMETER]},{name:`parameter$subexpression$1`,symbols:[Q.has(`QUOTED_PARAMETER`)?{type:`QUOTED_PARAMETER`}:QUOTED_PARAMETER]},{name:`parameter$subexpression$1`,symbols:[Q.has(`NUMBERED_PARAMETER`)?{type:`NUMBERED_PARAMETER`}:NUMBERED_PARAMETER]},{name:`parameter$subexpression$1`,symbols:[Q.has(`POSITIONAL_PARAMETER`)?{type:`POSITIONAL_PARAMETER`}:POSITIONAL_PARAMETER]},{name:`parameter$subexpression$1`,symbols:[Q.has(`CUSTOM_PARAMETER`)?{type:`CUSTOM_PARAMETER`}:CUSTOM_PARAMETER]},{name:`parameter`,symbols:[`parameter$subexpression$1`],postprocess:([[e]])=>({type:Z.parameter,key:e.key,text:e.text})},{name:`literal$subexpression$1`,symbols:[Q.has(`NUMBER`)?{type:`NUMBER`}:NUMBER]},{name:`literal$subexpression$1`,symbols:[Q.has(`STRING`)?{type:`STRING`}:STRING]},{name:`literal`,symbols:[`literal$subexpression$1`],postprocess:([[e]])=>({type:Z.literal,text:e.text})},{name:`keyword$subexpression$1`,symbols:[Q.has(`RESERVED_KEYWORD`)?{type:`RESERVED_KEYWORD`}:RESERVED_KEYWORD]},{name:`keyword$subexpression$1`,symbols:[Q.has(`RESERVED_KEYWORD_PHRASE`)?{type:`RESERVED_KEYWORD_PHRASE`}:RESERVED_KEYWORD_PHRASE]},{name:`keyword$subexpression$1`,symbols:[Q.has(`RESERVED_JOIN`)?{type:`RESERVED_JOIN`}:RESERVED_JOIN]},{name:`keyword`,symbols:[`keyword$subexpression$1`],postprocess:([[e]])=>J$(e)},{name:`data_type$subexpression$1`,symbols:[Q.has(`RESERVED_DATA_TYPE`)?{type:`RESERVED_DATA_TYPE`}:RESERVED_DATA_TYPE]},{name:`data_type$subexpression$1`,symbols:[Q.has(`RESERVED_DATA_TYPE_PHRASE`)?{type:`RESERVED_DATA_TYPE_PHRASE`}:RESERVED_DATA_TYPE_PHRASE]},{name:`data_type`,symbols:[`data_type$subexpression$1`],postprocess:([[e]])=>Y$(e)},{name:`data_type`,symbols:[Q.has(`RESERVED_PARAMETERIZED_DATA_TYPE`)?{type:`RESERVED_PARAMETERIZED_DATA_TYPE`}:RESERVED_PARAMETERIZED_DATA_TYPE,`_`,`parenthesis`],postprocess:([e,t,n])=>({type:Z.parameterized_data_type,dataType:X$(Y$(e),{trailing:t}),parenthesis:n})},{name:`logic_operator$subexpression$1`,symbols:[Q.has(`AND`)?{type:`AND`}:AND]},{name:`logic_operator$subexpression$1`,symbols:[Q.has(`OR`)?{type:`OR`}:OR]},{name:`logic_operator$subexpression$1`,symbols:[Q.has(`XOR`)?{type:`XOR`}:XOR]},{name:`logic_operator`,symbols:[`logic_operator$subexpression$1`],postprocess:([[e]])=>J$(e)},{name:`other_keyword$subexpression$1`,symbols:[Q.has(`WHEN`)?{type:`WHEN`}:WHEN]},{name:`other_keyword$subexpression$1`,symbols:[Q.has(`THEN`)?{type:`THEN`}:THEN]},{name:`other_keyword$subexpression$1`,symbols:[Q.has(`ELSE`)?{type:`ELSE`}:ELSE]},{name:`other_keyword$subexpression$1`,symbols:[Q.has(`END`)?{type:`END`}:END]},{name:`other_keyword`,symbols:[`other_keyword$subexpression$1`],postprocess:([[e]])=>J$(e)},{name:`_$ebnf$1`,symbols:[]},{name:`_$ebnf$1`,symbols:[`_$ebnf$1`,`comment`],postprocess:e=>e[0].concat([e[1]])},{name:`_`,symbols:[`_$ebnf$1`],postprocess:([e])=>e},{name:`comment`,symbols:[Q.has(`LINE_COMMENT`)?{type:`LINE_COMMENT`}:LINE_COMMENT],postprocess:([e])=>({type:Z.line_comment,text:e.text,precedingWhitespace:e.precedingWhitespace})},{name:`comment`,symbols:[Q.has(`BLOCK_COMMENT`)?{type:`BLOCK_COMMENT`}:BLOCK_COMMENT],postprocess:([e])=>({type:Z.block_comment,text:e.text,precedingWhitespace:e.precedingWhitespace})},{name:`comment`,symbols:[Q.has(`DISABLE_COMMENT`)?{type:`DISABLE_COMMENT`}:DISABLE_COMMENT],postprocess:([e])=>({type:Z.disable_comment,text:e.text,precedingWhitespace:e.precedingWhitespace})}],ParserStart:`main`},{Parser:$$,Grammar:e1}=l(N$(),1).default;function t1(e){let t={},n=new G$(n=>[...P$(e.tokenize(n,t)),dJ(n.length)]),r=new $$(e1.fromCompiled(Q$),{lexer:n});return{parse:(e,n)=>{t=n;let{results:i}=r.feed(e);if(i.length===1)return i[0];throw i.length===0?Error(`Parse error: Invalid SQL`):Error(`Parse error: Ambiguous grammar\n${JSON.stringify(i,void 0,2)}`)}}}var $;(function(e){e[e.SPACE=0]=`SPACE`,e[e.NO_SPACE=1]=`NO_SPACE`,e[e.NO_NEWLINE=2]=`NO_NEWLINE`,e[e.NEWLINE=3]=`NEWLINE`,e[e.MANDATORY_NEWLINE=4]=`MANDATORY_NEWLINE`,e[e.INDENT=5]=`INDENT`,e[e.SINGLE_INDENT=6]=`SINGLE_INDENT`})($=$||={});var n1=class{constructor(e){this.indentation=e,this.items=[]}add(...e){for(let t of e)switch(t){case $.SPACE:this.items.push($.SPACE);break;case $.NO_SPACE:this.trimHorizontalWhitespace();break;case $.NO_NEWLINE:this.trimWhitespace();break;case $.NEWLINE:this.trimHorizontalWhitespace(),this.addNewline($.NEWLINE);break;case $.MANDATORY_NEWLINE:this.trimHorizontalWhitespace(),this.addNewline($.MANDATORY_NEWLINE);break;case $.INDENT:this.addIndentation();break;case $.SINGLE_INDENT:this.items.push($.SINGLE_INDENT);break;default:this.items.push(t)}}trimHorizontalWhitespace(){for(;r1(YQ(this.items));)this.items.pop()}trimWhitespace(){for(;i1(YQ(this.items));)this.items.pop()}addNewline(e){if(this.items.length>0)switch(YQ(this.items)){case $.NEWLINE:this.items.pop(),this.items.push(e);break;case $.MANDATORY_NEWLINE:break;default:this.items.push(e);break}}addIndentation(){for(let e=0;e<this.indentation.getLevel();e++)this.items.push($.SINGLE_INDENT)}toString(){return this.items.map(e=>this.itemToString(e)).join(``)}getLayoutItems(){return this.items}itemToString(e){switch(e){case $.SPACE:return` `;case $.NEWLINE:case $.MANDATORY_NEWLINE:return`
|
|
229
|
-
`;case $.SINGLE_INDENT:return this.indentation.getSingleIndent();default:return e}}},r1=e=>e===$.SPACE||e===$.SINGLE_INDENT,i1=e=>e===$.SPACE||e===$.SINGLE_INDENT||e===$.NEWLINE;function a1(e,t){if(t===`standard`)return e;let n=[];return e.length>=10&&e.includes(` `)&&([e,...n]=e.split(` `)),e=t===`tabularLeft`?e.padEnd(9,` `):e.padStart(9,` `),e+[``,...n].join(` `)}function o1(e){return gJ(e)||e===X.RESERVED_CLAUSE||e===X.RESERVED_SELECT||e===X.RESERVED_SET_OPERATION||e===X.RESERVED_JOIN||e===X.LIMIT}var s1=`top-level`,c1=`block-level`,l1=class{constructor(e){this.indent=e,this.indentTypes=[]}getSingleIndent(){return this.indent}getLevel(){return this.indentTypes.length}increaseTopLevel(){this.indentTypes.push(s1)}increaseBlockLevel(){this.indentTypes.push(c1)}decreaseTopLevel(){this.indentTypes.length>0&&YQ(this.indentTypes)===s1&&this.indentTypes.pop()}decreaseBlockLevel(){for(;this.indentTypes.length>0&&this.indentTypes.pop()===s1;);}},u1=class extends n1{constructor(e){super(new l1(``)),this.expressionWidth=e,this.length=0,this.trailingSpace=!1}add(...e){if(e.forEach(e=>this.addToLength(e)),this.length>this.expressionWidth)throw new d1;super.add(...e)}addToLength(e){if(typeof e==`string`)this.length+=e.length,this.trailingSpace=!1;else if(e===$.MANDATORY_NEWLINE||e===$.NEWLINE)throw new d1;else e===$.INDENT||e===$.SINGLE_INDENT||e===$.SPACE?this.trailingSpace||=(this.length++,!0):(e===$.NO_NEWLINE||e===$.NO_SPACE)&&this.trailingSpace&&(this.trailingSpace=!1,this.length--)}},d1=class extends Error{},f1=class e{constructor({cfg:e,dialectCfg:t,params:n,layout:r,inline:i=!1}){this.inline=!1,this.nodes=[],this.index=-1,this.cfg=e,this.dialectCfg=t,this.inline=i,this.params=n,this.layout=r}format(e){for(this.nodes=e,this.index=0;this.index<this.nodes.length;this.index++)this.formatNode(this.nodes[this.index]);return this.layout}formatNode(e){this.formatComments(e.leadingComments),this.formatNodeWithoutComments(e),this.formatComments(e.trailingComments)}formatNodeWithoutComments(e){switch(e.type){case Z.function_call:return this.formatFunctionCall(e);case Z.parameterized_data_type:return this.formatParameterizedDataType(e);case Z.array_subscript:return this.formatArraySubscript(e);case Z.property_access:return this.formatPropertyAccess(e);case Z.parenthesis:return this.formatParenthesis(e);case Z.between_predicate:return this.formatBetweenPredicate(e);case Z.case_expression:return this.formatCaseExpression(e);case Z.case_when:return this.formatCaseWhen(e);case Z.case_else:return this.formatCaseElse(e);case Z.clause:return this.formatClause(e);case Z.set_operation:return this.formatSetOperation(e);case Z.limit_clause:return this.formatLimitClause(e);case Z.all_columns_asterisk:return this.formatAllColumnsAsterisk(e);case Z.literal:return this.formatLiteral(e);case Z.identifier:return this.formatIdentifier(e);case Z.parameter:return this.formatParameter(e);case Z.operator:return this.formatOperator(e);case Z.comma:return this.formatComma(e);case Z.line_comment:return this.formatLineComment(e);case Z.block_comment:return this.formatBlockComment(e);case Z.disable_comment:return this.formatBlockComment(e);case Z.data_type:return this.formatDataType(e);case Z.keyword:return this.formatKeywordNode(e)}}formatFunctionCall(e){this.withComments(e.nameKw,()=>{this.layout.add(this.showFunctionKw(e.nameKw))}),this.formatNode(e.parenthesis)}formatParameterizedDataType(e){this.withComments(e.dataType,()=>{this.layout.add(this.showDataType(e.dataType))}),this.formatNode(e.parenthesis)}formatArraySubscript(e){let t;switch(e.array.type){case Z.data_type:t=this.showDataType(e.array);break;case Z.keyword:t=this.showKw(e.array);break;default:t=this.showIdentifier(e.array);break}this.withComments(e.array,()=>{this.layout.add(t)}),this.formatNode(e.parenthesis)}formatPropertyAccess(e){this.formatNode(e.object),this.layout.add($.NO_SPACE,e.operator),this.formatNode(e.property)}formatParenthesis(e){let t=this.formatInlineExpression(e.children);t?(this.layout.add(e.openParen),this.layout.add(...t.getLayoutItems()),this.layout.add($.NO_SPACE,e.closeParen,$.SPACE)):(this.layout.add(e.openParen,$.NEWLINE),j$(this.cfg)?(this.layout.add($.INDENT),this.layout=this.formatSubExpression(e.children)):(this.layout.indentation.increaseBlockLevel(),this.layout.add($.INDENT),this.layout=this.formatSubExpression(e.children),this.layout.indentation.decreaseBlockLevel()),this.layout.add($.NEWLINE,$.INDENT,e.closeParen,$.SPACE))}formatBetweenPredicate(e){this.layout.add(this.showKw(e.betweenKw),$.SPACE),this.layout=this.formatSubExpression(e.expr1),this.layout.add($.NO_SPACE,$.SPACE,this.showNonTabularKw(e.andKw),$.SPACE),this.layout=this.formatSubExpression(e.expr2),this.layout.add($.SPACE)}formatCaseExpression(e){this.formatNode(e.caseKw),this.layout.indentation.increaseBlockLevel(),this.layout=this.formatSubExpression(e.expr),this.layout=this.formatSubExpression(e.clauses),this.layout.indentation.decreaseBlockLevel(),this.layout.add($.NEWLINE,$.INDENT),this.formatNode(e.endKw)}formatCaseWhen(e){this.layout.add($.NEWLINE,$.INDENT),this.formatNode(e.whenKw),this.layout=this.formatSubExpression(e.condition),this.formatNode(e.thenKw),this.layout=this.formatSubExpression(e.result)}formatCaseElse(e){this.layout.add($.NEWLINE,$.INDENT),this.formatNode(e.elseKw),this.layout=this.formatSubExpression(e.result)}formatClause(e){this.isOnelineClause(e)?this.formatClauseInOnelineStyle(e):j$(this.cfg)?this.formatClauseInTabularStyle(e):this.formatClauseInIndentedStyle(e)}isOnelineClause(e){return j$(this.cfg)?this.dialectCfg.tabularOnelineClauses[e.nameKw.text]:this.dialectCfg.onelineClauses[e.nameKw.text]}formatClauseInIndentedStyle(e){this.layout.add($.NEWLINE,$.INDENT,this.showKw(e.nameKw),$.NEWLINE),this.layout.indentation.increaseTopLevel(),this.layout.add($.INDENT),this.layout=this.formatSubExpression(e.children),this.layout.indentation.decreaseTopLevel()}formatClauseInOnelineStyle(e){this.layout.add($.NEWLINE,$.INDENT,this.showKw(e.nameKw),$.SPACE),this.layout=this.formatSubExpression(e.children)}formatClauseInTabularStyle(e){this.layout.add($.NEWLINE,$.INDENT,this.showKw(e.nameKw),$.SPACE),this.layout.indentation.increaseTopLevel(),this.layout=this.formatSubExpression(e.children),this.layout.indentation.decreaseTopLevel()}formatSetOperation(e){this.layout.add($.NEWLINE,$.INDENT,this.showKw(e.nameKw),$.NEWLINE),this.layout.add($.INDENT),this.layout=this.formatSubExpression(e.children)}formatLimitClause(e){this.withComments(e.limitKw,()=>{this.layout.add($.NEWLINE,$.INDENT,this.showKw(e.limitKw))}),this.layout.indentation.increaseTopLevel(),j$(this.cfg)?this.layout.add($.SPACE):this.layout.add($.NEWLINE,$.INDENT),e.offset?(this.layout=this.formatSubExpression(e.offset),this.layout.add($.NO_SPACE,`,`,$.SPACE),this.layout=this.formatSubExpression(e.count)):this.layout=this.formatSubExpression(e.count),this.layout.indentation.decreaseTopLevel()}formatAllColumnsAsterisk(e){this.layout.add(`*`,$.SPACE)}formatLiteral(e){this.layout.add(e.text,$.SPACE)}formatIdentifier(e){this.layout.add(this.showIdentifier(e),$.SPACE)}formatParameter(e){this.layout.add(this.params.get(e),$.SPACE)}formatOperator({text:e}){this.cfg.denseOperators||this.dialectCfg.alwaysDenseOperators.includes(e)?this.layout.add($.NO_SPACE,e):e===`:`?this.layout.add($.NO_SPACE,e,$.SPACE):this.layout.add(e,$.SPACE)}formatComma(e){this.inline?this.layout.add($.NO_SPACE,`,`,$.SPACE):this.layout.add($.NO_SPACE,`,`,$.NEWLINE,$.INDENT)}withComments(e,t){this.formatComments(e.leadingComments),t(),this.formatComments(e.trailingComments)}formatComments(e){e&&e.forEach(e=>{e.type===Z.line_comment?this.formatLineComment(e):this.formatBlockComment(e)})}formatLineComment(e){QQ(e.precedingWhitespace||``)?this.layout.add($.NEWLINE,$.INDENT,e.text,$.MANDATORY_NEWLINE,$.INDENT):this.layout.getLayoutItems().length>0?this.layout.add($.NO_NEWLINE,$.SPACE,e.text,$.MANDATORY_NEWLINE,$.INDENT):this.layout.add(e.text,$.MANDATORY_NEWLINE,$.INDENT)}formatBlockComment(e){e.type===Z.block_comment&&this.isMultilineBlockComment(e)?(this.splitBlockComment(e.text).forEach(e=>{this.layout.add($.NEWLINE,$.INDENT,e)}),this.layout.add($.NEWLINE,$.INDENT)):this.layout.add(e.text,$.SPACE)}isMultilineBlockComment(e){return QQ(e.text)||QQ(e.precedingWhitespace||``)}isDocComment(e){let t=e.split(/\n/);return/^\/\*\*?$/.test(t[0])&&t.slice(1,t.length-1).every(e=>/^\s*\*/.test(e))&&/^\s*\*\/$/.test(YQ(t))}splitBlockComment(e){return this.isDocComment(e)?e.split(/\n/).map(e=>/^\s*\*/.test(e)?` `+e.replace(/^\s*/,``):e):e.split(/\n/).map(e=>e.replace(/^\s*/,``))}formatSubExpression(t){return new e({cfg:this.cfg,dialectCfg:this.dialectCfg,params:this.params,layout:this.layout,inline:this.inline}).format(t)}formatInlineExpression(t){let n=this.params.getPositionalParameterIndex();try{return new e({cfg:this.cfg,dialectCfg:this.dialectCfg,params:this.params,layout:new u1(this.cfg.expressionWidth),inline:!0}).format(t)}catch(e){if(e instanceof d1){this.params.setPositionalParameterIndex(n);return}else throw e}}formatKeywordNode(e){switch(e.tokenType){case X.RESERVED_JOIN:return this.formatJoin(e);case X.AND:case X.OR:case X.XOR:return this.formatLogicalOperator(e);default:return this.formatKeyword(e)}}formatJoin(e){j$(this.cfg)?(this.layout.indentation.decreaseTopLevel(),this.layout.add($.NEWLINE,$.INDENT,this.showKw(e),$.SPACE),this.layout.indentation.increaseTopLevel()):this.layout.add($.NEWLINE,$.INDENT,this.showKw(e),$.SPACE)}formatKeyword(e){this.layout.add(this.showKw(e),$.SPACE)}formatLogicalOperator(e){this.cfg.logicalOperatorNewline===`before`?j$(this.cfg)?(this.layout.indentation.decreaseTopLevel(),this.layout.add($.NEWLINE,$.INDENT,this.showKw(e),$.SPACE),this.layout.indentation.increaseTopLevel()):this.layout.add($.NEWLINE,$.INDENT,this.showKw(e),$.SPACE):this.layout.add(this.showKw(e),$.NEWLINE,$.INDENT)}formatDataType(e){this.layout.add(this.showDataType(e),$.SPACE)}showKw(e){return o1(e.tokenType)?a1(this.showNonTabularKw(e),this.cfg.indentStyle):this.showNonTabularKw(e)}showNonTabularKw(e){switch(this.cfg.keywordCase){case`preserve`:return ZQ(e.raw);case`upper`:return e.text;case`lower`:return e.text.toLowerCase()}}showFunctionKw(e){return o1(e.tokenType)?a1(this.showNonTabularFunctionKw(e),this.cfg.indentStyle):this.showNonTabularFunctionKw(e)}showNonTabularFunctionKw(e){switch(this.cfg.functionCase){case`preserve`:return ZQ(e.raw);case`upper`:return e.text;case`lower`:return e.text.toLowerCase()}}showIdentifier(e){if(e.quoted)return e.text;switch(this.cfg.identifierCase){case`preserve`:return e.text;case`upper`:return e.text.toUpperCase();case`lower`:return e.text.toLowerCase()}}showDataType(e){switch(this.cfg.dataTypeCase){case`preserve`:return ZQ(e.raw);case`upper`:return e.text;case`lower`:return e.text.toLowerCase()}}},p1=class{constructor(e,t){this.dialect=e,this.cfg=t,this.params=new M$(this.cfg.params)}format(e){let t=this.parse(e);return this.formatAst(t).trimEnd()}parse(e){return t1(this.dialect.tokenizer).parse(e,this.cfg.paramTypes||{})}formatAst(e){return e.map(e=>this.formatStatement(e)).join(`
|
|
230
|
-
`.repeat(this.cfg.linesBetweenQueries+1))}formatStatement(e){let t=new f1({cfg:this.cfg,dialectCfg:this.dialect.formatOptions,params:this.params,layout:new n1(new l1(A$(this.cfg)))}).format(e.children);return e.hasSemicolon&&(this.cfg.newlineBeforeSemicolon?t.add($.NEWLINE,`;`):t.add($.NO_NEWLINE,`;`)),t.toString()}},m1=class extends Error{};function h1(e){for(let t of[`multilineLists`,`newlineBeforeOpenParen`,`newlineBeforeCloseParen`,`aliasAs`,`commaPosition`,`tabulateAlias`])if(t in e)throw new m1(`${t} config is no more supported.`);if(e.expressionWidth<=0)throw new m1(`expressionWidth config must be positive number. Received ${e.expressionWidth} instead.`);if(e.params&&!g1(e.params)&&console.warn(`WARNING: All "params" option values should be strings.`),e.paramTypes&&!_1(e.paramTypes))throw new m1(`Empty regex given in custom paramTypes. That would result in matching infinite amount of parameters.`);return e}function g1(e){return(e instanceof Array?e:Object.values(e)).every(e=>typeof e==`string`)}function _1(e){return e.custom&&Array.isArray(e.custom)?e.custom.every(e=>e.regex!==``):!0}var v1=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},y1={bigquery:`bigquery`,clickhouse:`clickhouse`,db2:`db2`,db2i:`db2i`,duckdb:`duckdb`,hive:`hive`,mariadb:`mariadb`,mysql:`mysql`,n1ql:`n1ql`,plsql:`plsql`,postgresql:`postgresql`,redshift:`redshift`,spark:`spark`,sqlite:`sqlite`,sql:`sql`,tidb:`tidb`,trino:`trino`,transactsql:`transactsql`,tsql:`transactsql`,singlestoredb:`singlestoredb`,snowflake:`snowflake`},b1=Object.keys(y1),x1={tabWidth:2,useTabs:!1,keywordCase:`preserve`,identifierCase:`preserve`,dataTypeCase:`preserve`,functionCase:`preserve`,indentStyle:`standard`,logicalOperatorNewline:`before`,expressionWidth:50,linesBetweenQueries:1,denseOperators:!1,newlineBeforeSemicolon:!1},S1=(e,t={})=>{if(typeof t.language==`string`&&!b1.includes(t.language))throw new m1(`Unsupported SQL dialect: ${t.language}`);let n=y1[t.language||`sql`];return C1(e,Object.assign(Object.assign({},t),{dialect:JQ[n]}))},C1=(e,t)=>{var{dialect:n}=t,r=v1(t,[`dialect`]);if(typeof e!=`string`)throw Error(`Invalid query argument. Expected string, instead got `+typeof e);let i=h1(Object.assign(Object.assign({},x1),r));return new p1(D$(n),i).format(e)},w1={standard:`sql`,mysql:`mysql`,postgresql:`postgresql`,sqlite:`sqlite`,mssql:`tsql`};function T1({label:e,icon:t,onClick:n,active:r,disabled:i}){return(0,A.jsx)(d.Tooltip,{title:e,arrow:!0,children:(0,A.jsx)(`span`,{children:(0,A.jsx)(d.IconButton,{size:`small`,onClick:n,disabled:i,color:r?`primary`:`default`,sx:{borderRadius:1},"aria-label":e,children:t})})})}function E1({viewRef:e,toolbarConfig:t,translation:n,dialect:r,disabled:i,onExecute:a}){let[o,s]=(0,u.useState)(!1),c=i||!e.current;function l(){let t=e.current?.state.doc.toString()??``;navigator.clipboard.writeText(t).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})}function f(){let t=e.current;t&&(t.dispatch({changes:{from:0,to:t.state.doc.length,insert:``}}),t.focus())}function p(){let t=e.current;t&&(Tg(t),t.focus())}function m(){let t=e.current;t&&(Eg(t),t.focus())}function h(){let t=e.current;if(!t)return;let n=t.state.doc.toString();try{let e=S1(n,{language:w1[r]});t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})}catch{}t.focus()}function g(){let t=e.current;!t||!a||a(t.state.doc.toString())}let _=t.showFormat,v=t.showCopy||t.showClear,y=t.showUndoRedo,b=t.showExecute&&!!a;return(0,A.jsxs)(d.Box,{sx:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:.25,px:1,py:.5},role:`toolbar`,"aria-label":`SQL editor actions`,children:[_&&(0,A.jsx)(d.Box,{sx:{display:`flex`,gap:.25},children:(0,A.jsx)(T1,{label:n.format,icon:(0,A.jsx)(Ty,{fontSize:`small`}),onClick:h,disabled:c})}),_&&(v||y)&&(0,A.jsx)(d.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}}),v&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[t.showCopy&&(0,A.jsx)(T1,{label:o?n.copySuccess:n.copy,icon:o?(0,A.jsx)(xy,{fontSize:`small`,color:`success`}):(0,A.jsx)(by,{fontSize:`small`}),onClick:l,disabled:c}),t.showClear&&(0,A.jsx)(T1,{label:n.clear,icon:(0,A.jsx)(Sy,{fontSize:`small`}),onClick:f,disabled:c})]}),v&&y&&(0,A.jsx)(d.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}}),y&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,gap:.25},children:[(0,A.jsx)(T1,{label:n.undo,icon:(0,A.jsx)(Cy,{fontSize:`small`}),onClick:p,disabled:c}),(0,A.jsx)(T1,{label:n.redo,icon:(0,A.jsx)(wy,{fontSize:`small`}),onClick:m,disabled:c})]}),b&&(0,A.jsxs)(A.Fragment,{children:[(v||y)&&(0,A.jsx)(d.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}}),(0,A.jsx)(T1,{label:n.execute,icon:(0,A.jsx)(eJ,{fontSize:`small`}),onClick:g,disabled:c})]}),!_&&!v&&!y&&!b&&(0,A.jsx)(d.Box,{sx:{height:32}})]})}var D1=M([(0,A.jsx)(`path`,{d:`M12 5.99 19.53 19H4.47zM12 2 1 21h22z`},`0`),(0,A.jsx)(`path`,{d:`M13 16h-2v2h2zm0-6h-2v5h2z`},`1`)],`WarningAmber`);function O1({helperText:e,error:t,showLineColumn:n,showErrorCount:r,diagnosticsCount:i,cursorLine:a,cursorCol:o,translation:s}){let c=s.lineColumn.replace(`{line}`,String(a)).replace(`{col}`,String(o)),l=s.errorCount.replace(`{count}`,String(i));return(0,A.jsxs)(d.Box,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,mt:.5,px:.5},children:[(0,A.jsxs)(d.Box,{children:[r&&i>0&&(0,A.jsxs)(d.Box,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,A.jsx)(D1,{sx:{fontSize:`0.875rem`,color:`error.main`}}),(0,A.jsx)(d.FormHelperText,{sx:{color:`error.main`,m:0},children:l})]}),(0,A.jsx)(d.FormHelperText,{error:t,children:e??``})]}),n&&(0,A.jsx)(d.FormHelperText,{sx:{color:`text.disabled`,fontFamily:`monospace`,whiteSpace:`nowrap`},children:c})]})}function k1(e){if(!(e===``||e===void 0))return typeof e==`string`&&e!==`auto`&&!isNaN(Number(e))?Number(e):e}function A1({value:e,onChange:t,placeholder:n,height:r,width:i,disabled:a=!1,readonly:o=!1,error:s=!1,helperText:c,name:l,dialect:f=`standard`,showLineNumbers:p=!0,showLineColumn:m=!0,showErrorCount:h=!1,toolbarConfig:g,translation:_,highlightColors:v,schema:y,onExecute:b,onLint:x,onBlur:S,onFocus:C}){let w={...EG,..._},T={...TG,...g},E=k1(r),ee=k1(i),te=E===`auto`,ne=te?void 0:E??300,D=(0,u.useRef)(null),[re,O]=(0,u.useState)({line:1,col:1}),[ie,ae]=(0,u.useState)(0),oe=(0,u.useCallback)(e=>{D.current=e},[]),se=(0,u.useCallback)((e,t)=>{O({line:e,col:t})},[]),ce=(0,u.useCallback)(e=>{ae(e)},[]),le=m||h||!!c;return(0,A.jsxs)(d.Box,{sx:{width:ee??`100%`,...te?{display:`flex`,flexDirection:`column`,flex:1}:{}},children:[(0,A.jsxs)(d.Paper,{variant:`outlined`,sx:{display:`flex`,flexDirection:`column`,overflow:`hidden`,...te?{flex:1}:{height:ne},borderColor:s?`error.main`:void 0,"&:focus-within":{borderColor:s?`error.main`:`primary.main`,borderWidth:2}},children:[!o&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(E1,{viewRef:D,toolbarConfig:T,translation:w,dialect:f,disabled:a,onExecute:b}),(0,A.jsx)(d.Divider,{})]}),(0,A.jsx)($q,{value:e,onChange:t,placeholder:n,disabled:a,readonly:o,showLineNumbers:p,dialect:f,keywordColor:v?.keyword,stringColor:v?.string,identifierColor:v?.identifier,schema:y,onLint:x,onDiagnosticsChange:x?ce:void 0,onViewReady:oe,onCursorChange:se,onBlur:S,onFocus:C})]}),le&&(0,A.jsx)(O1,{helperText:c,error:s,showLineColumn:m,showErrorCount:h,diagnosticsCount:ie,cursorLine:re.line,cursorCol:re.col,translation:w}),l&&(0,A.jsx)(`input`,{type:`hidden`,name:l,value:e??``})]})}exports.ConfirmDialogProvider=Li,exports.DEFAULT_CHECK_COLORS=hx,exports.DEFAULT_CONFIRM_DIALOG_TRANSLATION=Mi,exports.DEFAULT_GANTT_TRANSLATIONS=ab,exports.DEFAULT_JSON_EDITOR_TOOLBAR_CONFIG=zi,exports.DEFAULT_JSON_EDITOR_TRANSLATION=Bi,exports.DEFAULT_METER_COLORS=mx,exports.DEFAULT_PASSWORD_TRANSLATIONS=px,exports.DEFAULT_RICH_TEXT_EDITOR_TOOLBAR_CONFIG=JW,exports.DEFAULT_RICH_TEXT_EDITOR_TRANSLATION=YW,exports.DEFAULT_SQL_EDITOR_TOOLBAR_CONFIG=TG,exports.DEFAULT_SQL_EDITOR_TRANSLATION=EG,exports.DEFAULT_TAG_SELECTION_TRANSLATION=wx,exports.GanttChart=cx,exports.JsonEditor=My,exports.PasswordStrengthMeter=_x,exports.RichTextEditor=wG,exports.SqlEditor=A1,exports.TagSelection=Ox,exports.useConfirm=Ri,exports.useGanttChartStore=B,exports.useGanttTheme=rx,exports.useGanttTranslations=tx,exports.useRawGanttChartStore=$b;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(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},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`react`),l=require(`@mui/material`),u=require(`@mui/icons-material/InfoOutlined`);u=s(u,1);let d=require(`@mui/icons-material/WarningAmberOutlined`);d=s(d,1);let f=require(`@mui/icons-material/ErrorOutlined`);f=s(f,1);let p=require(`@mui/icons-material/CheckCircleOutlined`);p=s(p,1);let m=require(`react/jsx-runtime`),h=require(`@codemirror/view`),g=require(`@codemirror/state`),_=require(`@codemirror/lang-json`),v=require(`@codemirror/commands`),y=require(`@codemirror/language`),b=require(`@codemirror/lint`),x=require(`@lezer/highlight`),S=require(`@mui/icons-material/ContentCopy`);S=s(S,1);let C=require(`@mui/icons-material/Check`);C=s(C,1);let w=require(`@mui/icons-material/Delete`);w=s(w,1);let T=require(`@mui/icons-material/Undo`);T=s(T,1);let E=require(`@mui/icons-material/Redo`);E=s(E,1);let D=require(`@mui/icons-material/AutoFixHigh`);D=s(D,1);let O=require(`@mui/icons-material/Compress`);O=s(O,1);let k=require(`zustand`),A=require(`zustand/vanilla`),j=require(`@tanstack/react-virtual`),M=require(`@mui/icons-material/Add`);M=s(M,1);let N=require(`@mui/icons-material/Edit`);N=s(N,1);let P=require(`@mui/icons-material/RestartAlt`);P=s(P,1);let F=require(`@mui/icons-material/Restore`);F=s(F,1);let I=require(`@mui/icons-material/Today`);I=s(I,1);let L=require(`@mui/icons-material/UnfoldLess`);L=s(L,1);let R=require(`@mui/icons-material/UnfoldMore`);R=s(R,1);let z=require(`@mui/icons-material/Visibility`);z=s(z,1);let B=require(`@mui/icons-material/VisibilityOff`);B=s(B,1);let V=require(`@mui/icons-material/Close`);V=s(V,1);let H=require(`@tiptap/react`),U=require(`@tiptap/starter-kit`),W=require(`@tiptap/extension-text-style`),G=require(`@tiptap/extension-color`),ee=require(`@tiptap/extension-highlight`),te=require(`@tiptap/extension-placeholder`),ne=require(`@tiptap/extension-character-count`),re=require(`tiptap-markdown`),ie=require(`@mui/icons-material/FormatBold`);ie=s(ie,1);let ae=require(`@mui/icons-material/FormatItalic`);ae=s(ae,1);let oe=require(`@mui/icons-material/FormatUnderlined`);oe=s(oe,1);let se=require(`@mui/icons-material/StrikethroughS`);se=s(se,1);let ce=require(`@mui/icons-material/FormatListBulleted`);ce=s(ce,1);let le=require(`@mui/icons-material/FormatListNumbered`);le=s(le,1);let ue=require(`@mui/icons-material/FormatQuote`);ue=s(ue,1);let de=require(`@mui/icons-material/Code`);de=s(de,1);let fe=require(`@mui/icons-material/InsertLink`);fe=s(fe,1);let pe=require(`@mui/icons-material/HorizontalRule`);pe=s(pe,1);let me=require(`@mui/icons-material/FormatColorText`);me=s(me,1);let he=require(`@mui/icons-material/BorderColor`);he=s(he,1);let ge=require(`@mui/icons-material/FormatClear`);ge=s(ge,1);let _e=require(`@mui/icons-material/FormatColorReset`);_e=s(_e,1);let K=require(`@codemirror/lang-sql`),ve=require(`@codemirror/autocomplete`),ye=require(`@mui/icons-material/PlayArrow`);ye=s(ye,1);let be=require(`sql-formatter`),xe=require(`@mui/icons-material/WarningAmber`);xe=s(xe,1);var Se={confirmLabel:`Confirm`,cancelLabel:`Cancel`},Ce={info:u.default,warning:d.default,error:f.default,success:p.default},we={info:`primary`,warning:`warning`,error:`error`,success:`success`};function Te({open:e,options:t,translation:n,onConfirm:r,onCancel:i}){let{title:a,description:o,confirmLabel:s,cancelLabel:c,severity:u=`info`,hideCancelButton:d=!1,maxWidth:f=`xs`,showIcon:p=!0}=t,h=p?Ce[u]:null,g=we[u],_=s??n.confirmLabel,v=c??n.cancelLabel;return(0,m.jsxs)(l.Dialog,{open:e,onClose:i,maxWidth:f,fullWidth:!0,"aria-labelledby":a?`confirm-dialog-title`:void 0,"aria-describedby":o?`confirm-dialog-description`:void 0,children:[a&&(0,m.jsxs)(l.DialogTitle,{id:`confirm-dialog-title`,"data-testid":`confirm-dialog-title`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[h&&(0,m.jsx)(h,{color:u,"data-testid":`confirm-dialog-icon`,fontSize:`small`}),a]}),o&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(l.Divider,{}),(0,m.jsx)(l.DialogContent,{children:typeof o==`string`?(0,m.jsx)(l.Typography,{id:`confirm-dialog-description`,"data-testid":`confirm-dialog-description`,variant:`body2`,color:`text.secondary`,children:o}):(0,m.jsx)(`div`,{id:`confirm-dialog-description`,"data-testid":`confirm-dialog-description`,children:o})})]}),(0,m.jsx)(l.Divider,{}),(0,m.jsxs)(l.DialogActions,{sx:{px:2,py:1.5},children:[!d&&(0,m.jsx)(l.Button,{"data-testid":`confirm-dialog-cancel-btn`,onClick:i,color:`inherit`,children:v}),(0,m.jsx)(l.Button,{"data-testid":`confirm-dialog-confirm-btn`,onClick:r,color:g,variant:`contained`,autoFocus:!0,children:_})]})]})}var Ee=(0,c.createContext)(()=>Promise.resolve(!1));function De({children:e,translation:t}){let n={...Se,...t},r=(0,c.useRef)(null),[i,a]=(0,c.useState)({open:!1,options:{}}),o=(0,c.useCallback)(e=>(r.current?.(!1),new Promise(t=>{r.current=t,a({open:!0,options:e})})),[]);return(0,m.jsxs)(Ee.Provider,{value:o,children:[e,(0,m.jsx)(Te,{open:i.open,options:i.options,translation:n,onConfirm:()=>{r.current?.(!0),r.current=null,a(e=>({...e,open:!1}))},onCancel:()=>{r.current?.(!1),r.current=null,a(e=>({...e,open:!1}))}})]})}function Oe(){return(0,c.useContext)(Ee)}var ke={showFormat:!0,showCompact:!0,showCopy:!0,showClear:!0,showUndoRedo:!0},Ae={format:`Format JSON`,compact:`Compact JSON`,copy:`Copy`,copySuccess:`Copied!`,clear:`Clear`,undo:`Undo`,redo:`Redo`,lineColumn:`Ln {line}, Col {col}`,validJson:`Valid JSON`,invalidJson:`Invalid JSON`};function je({value:e,onChange:t,placeholder:n,disabled:r=!1,readonly:i=!1,showLineNumbers:a=!0,highlightColors:o,onViewReady:s,onCursorChange:u,onBlur:d,onFocus:f}){let p=(0,c.useRef)(null),S=(0,c.useRef)(null),C=(0,c.useRef)(t),w=(0,c.useRef)(u),T=(0,c.useRef)(d),E=(0,c.useRef)(f),D=(0,c.useRef)(s),O=(0,c.useRef)(new g.Compartment),k=(0,c.useRef)(new g.Compartment),A=(0,l.useTheme)(),j=A.palette.mode===`dark`,M=o?.propertyName??A.palette.primary.main,N=o?.string??A.palette.success.main,P=o?.number??A.palette.warning.main,F=o?.boolean??A.palette.info.main,I=o?.null??A.palette.text.secondary;return(0,c.useEffect)(()=>{C.current=t},[t]),(0,c.useEffect)(()=>{w.current=u},[u]),(0,c.useEffect)(()=>{T.current=d},[d]),(0,c.useEffect)(()=>{E.current=f},[f]),(0,c.useEffect)(()=>{D.current=s},[s]),(0,c.useEffect)(()=>{if(!p.current)return;let t=S.current?.state.doc.toString()??e??``,o=y.HighlightStyle.define([{tag:x.tags.propertyName,color:M,fontWeight:`bold`},{tag:x.tags.string,color:N},{tag:x.tags.number,color:P},{tag:x.tags.bool,color:F,fontWeight:`bold`},{tag:x.tags.null,color:I,fontStyle:`italic`},{tag:x.tags.bracket,color:A.palette.text.secondary},{tag:x.tags.punctuation,color:A.palette.text.disabled},{tag:x.tags.invalid,color:A.palette.error.main,textDecoration:`underline wavy`}]),s=[h.EditorView.theme({"&":{height:`100%`,fontFamily:`'Fira Code', 'JetBrains Mono', 'Consolas', monospace`,fontSize:`0.875rem`},".cm-scroller":{overflow:`auto`},".cm-content":{padding:`8px 4px`,caretColor:A.palette.text.primary},".cm-gutters":{backgroundColor:j?A.palette.grey[900]:A.palette.grey[50],color:A.palette.text.disabled,border:`none`,borderRight:`1px solid ${A.palette.divider}`},".cm-lineNumbers .cm-gutterElement":{minWidth:`36px`,paddingLeft:`4px`},".cm-activeLineGutter":{backgroundColor:A.palette.action.selected},".cm-activeLine":{backgroundColor:A.palette.action.hover},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{backgroundColor:A.palette.primary.main+`40`},".cm-cursor, .cm-dropCursor":{borderLeftColor:A.palette.text.primary},"&.cm-focused":{outline:`none`},".cm-placeholder":{color:A.palette.text.disabled,fontStyle:`italic`},".cm-gutter-lint":{width:`16px`},".cm-lint-marker-error":{color:A.palette.error.main},".cm-lint-marker-warning":{color:A.palette.warning.main},".cm-tooltip.cm-tooltip-lint":{backgroundColor:A.palette.background.paper,border:`1px solid ${A.palette.divider}`,borderRadius:`4px`},".cm-diagnostic-error":{borderLeft:`3px solid ${A.palette.error.main}`},".cm-diagnostic-warning":{borderLeft:`3px solid ${A.palette.warning.main}`}},{dark:j}),(0,y.syntaxHighlighting)(o),(0,_.json)(),(0,b.lintGutter)(),(0,b.linter)((0,_.jsonParseLinter)()),(0,v.history)(),h.keymap.of([...v.defaultKeymap,...v.historyKeymap]),O.current.of(h.EditorView.editable.of(!r&&!i)),k.current.of(g.EditorState.readOnly.of(i)),(0,h.highlightActiveLine)(),...a?[(0,h.lineNumbers)(),(0,h.highlightActiveLineGutter)()]:[],...n?[(0,h.placeholder)(n)]:[],h.EditorView.updateListener.of(e=>{e.docChanged&&C.current?.(e.state.doc.toString());let t=e.state.selection.main.head,n=e.state.doc.lineAt(t);w.current(n.number,t-n.from+1)}),h.EditorView.domEventHandlers({blur:()=>{T.current?.()},focus:()=>{E.current?.()}})],c=new h.EditorView({state:g.EditorState.create({doc:t,extensions:s}),parent:p.current});return S.current=c,D.current(c),()=>{D.current(null),c.destroy(),S.current=null}},[j,M,N,P,F,I]),(0,c.useEffect)(()=>{let t=S.current;if(!t)return;let n=t.state.doc.toString();n!==(e??``)&&t.dispatch({changes:{from:0,to:n.length,insert:e??``}})},[e]),(0,c.useEffect)(()=>{S.current?.dispatch({effects:[O.current.reconfigure(h.EditorView.editable.of(!r&&!i)),k.current.reconfigure(g.EditorState.readOnly.of(i))]})},[r,i]),(0,m.jsx)(l.Box,{ref:p,sx:{flex:1,overflow:`hidden`,display:`flex`,flexDirection:`column`,opacity:r?.5:1,backgroundColor:A.palette.background.paper,"& .cm-editor":{flex:1,display:`flex`,flexDirection:`column`}}})}function q({label:e,icon:t,onClick:n,active:r,disabled:i}){return(0,m.jsx)(l.Tooltip,{title:e,arrow:!0,children:(0,m.jsx)(`span`,{children:(0,m.jsx)(l.IconButton,{size:`small`,onMouseDown:e=>e.preventDefault(),onClick:n,disabled:i,color:r?`primary`:`default`,sx:{borderRadius:1},"aria-label":e,"aria-pressed":r,children:t})})})}function Me({viewRef:e,toolbarConfig:t,translation:n,indent:r,disabled:i}){let[a,o]=(0,c.useState)(!1),s=i||!e.current;function u(){let t=e.current;if(!t)return;let n=t.state.doc.toString();try{let e=JSON.stringify(JSON.parse(n),null,r);t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})}catch{}t.focus()}function d(){let t=e.current;if(!t)return;let n=t.state.doc.toString();try{let e=JSON.stringify(JSON.parse(n));t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})}catch{}t.focus()}function f(){let t=e.current?.state.doc.toString()??``;navigator.clipboard.writeText(t).then(()=>{o(!0),setTimeout(()=>o(!1),2e3)})}function p(){let t=e.current;t&&(t.dispatch({changes:{from:0,to:t.state.doc.length,insert:``}}),t.focus())}function h(){let t=e.current;t&&((0,v.undo)(t),t.focus())}function g(){let t=e.current;t&&((0,v.redo)(t),t.focus())}let _=t.showFormat||t.showCompact,y=t.showCopy||t.showClear,b=t.showUndoRedo;return(0,m.jsxs)(l.Box,{sx:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:.25,px:1,py:.5},role:`toolbar`,"aria-label":`JSON editor actions`,children:[_&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[t.showFormat&&(0,m.jsx)(q,{label:n.format,icon:(0,m.jsx)(D.default,{fontSize:`small`}),onClick:u,disabled:s}),t.showCompact&&(0,m.jsx)(q,{label:n.compact,icon:(0,m.jsx)(O.default,{fontSize:`small`}),onClick:d,disabled:s})]}),_&&(y||b)&&(0,m.jsx)(l.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}}),y&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[t.showCopy&&(0,m.jsx)(q,{label:a?n.copySuccess:n.copy,icon:a?(0,m.jsx)(C.default,{fontSize:`small`,color:`success`}):(0,m.jsx)(S.default,{fontSize:`small`}),onClick:f,disabled:s}),t.showClear&&(0,m.jsx)(q,{label:n.clear,icon:(0,m.jsx)(w.default,{fontSize:`small`}),onClick:p,disabled:s})]}),y&&b&&(0,m.jsx)(l.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}}),b&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[(0,m.jsx)(q,{label:n.undo,icon:(0,m.jsx)(T.default,{fontSize:`small`}),onClick:h,disabled:s}),(0,m.jsx)(q,{label:n.redo,icon:(0,m.jsx)(E.default,{fontSize:`small`}),onClick:g,disabled:s})]}),!_&&!y&&!b&&(0,m.jsx)(l.Box,{sx:{height:32}})]})}function Ne({helperText:e,error:t,showLineColumn:n,showValidation:r,isValid:i,cursorLine:a,cursorCol:o,translation:s}){let c=s.lineColumn.replace(`{line}`,String(a)).replace(`{col}`,String(o));return(0,m.jsxs)(l.Box,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,mt:.5,px:.5},children:[(0,m.jsxs)(l.Box,{children:[r&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[i?(0,m.jsx)(p.default,{sx:{fontSize:`0.875rem`,color:`success.main`},"data-testid":`json-valid-icon`}):(0,m.jsx)(f.default,{sx:{fontSize:`0.875rem`,color:`error.main`},"data-testid":`json-invalid-icon`}),(0,m.jsx)(l.FormHelperText,{sx:{color:i?`success.main`:`error.main`,m:0},children:i?s.validJson:s.invalidJson})]}),(0,m.jsx)(l.FormHelperText,{error:t,children:e??``})]}),n&&(0,m.jsx)(l.FormHelperText,{sx:{color:`text.disabled`,fontFamily:`monospace`,whiteSpace:`nowrap`},children:c})]})}function J(e){if(!(e===``||e===void 0))return typeof e==`string`&&e!==`auto`&&!isNaN(Number(e))?Number(e):e}function Pe(e){if(!e.trim())return!1;try{return JSON.parse(e),!0}catch{return!1}}function Fe({value:e,onChange:t,onValidChange:n,placeholder:r,height:i,width:a,disabled:o=!1,readonly:s=!1,error:u=!1,helperText:d,name:f,indent:p=2,showLineNumbers:h=!0,showLineColumn:g=!0,showValidation:_=!1,toolbarConfig:v,translation:y,highlightColors:b,onBlur:x,onFocus:S}){let C={...Ae,...y},w={...ke,...v},T=J(i),E=J(a),D=T===`auto`,O=D?void 0:T??300,k=(0,c.useRef)(null),[A,j]=(0,c.useState)({line:1,col:1}),[M,N]=(0,c.useState)(()=>Pe(e??``)),P=(0,c.useCallback)(e=>{k.current=e},[]),F=(0,c.useCallback)((e,t)=>{j({line:e,col:t})},[]),I=(0,c.useCallback)(e=>{let r=Pe(e);N(r),n?.(r),t?.(e)},[t,n]),L=g||_||!!d;return(0,m.jsxs)(l.Box,{sx:{width:E??`100%`,...D?{display:`flex`,flexDirection:`column`,flex:1}:{}},children:[(0,m.jsxs)(l.Paper,{variant:`outlined`,sx:{display:`flex`,flexDirection:`column`,overflow:`hidden`,...D?{flex:1}:{height:O},borderColor:u?`error.main`:void 0,"&:focus-within":{borderColor:u?`error.main`:`primary.main`,borderWidth:2}},children:[!s&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Me,{viewRef:k,toolbarConfig:w,translation:C,indent:p,disabled:o}),(0,m.jsx)(l.Divider,{})]}),(0,m.jsx)(je,{value:e,onChange:I,placeholder:r,disabled:o,readonly:s,showLineNumbers:h,highlightColors:b,onViewReady:P,onCursorChange:F,onBlur:x,onFocus:S})]}),L&&(0,m.jsx)(Ne,{helperText:d,error:u,showLineColumn:g,showValidation:_,isValid:M,cursorLine:A.line,cursorCol:A.col,translation:C}),f&&(0,m.jsx)(`input`,{type:`hidden`,name:f,value:e??``})]})}function Y(e){let t=new Date,n=Xe(t),r=Ze(t);if(e.length===0)return{start:n,end:r};let i=e.map(e=>e.startDate.getTime()),a=e.map(e=>e.endDate.getTime()),o=Ve(Ue(new Date(Math.min(...i)),-1)),s=He(Ue(new Date(Math.max(...a)),1));return{start:o<n?o:n,end:s>r?s:r}}function Ie(e,t){return t===`weeks`?{start:Ke(e.start),end:e.end}:t===`quarters`?{start:Xe(e.start),end:Ze(e.end)}:e}function Le(e,t){let n=t.end.getTime()-t.start.getTime();if(n<=0)return{left:0,width:0};let r=(e.startDate.getTime()-t.start.getTime())/n*100,i=(e.endDate.getTime()-e.startDate.getTime())/n*100;return{left:Math.max(0,r),width:Math.max(0,i)}}function Re(e){let t=new Map;for(let n of e)t.set(n.id,{...n,children:[],depth:0});let n=[];for(let e of t.values())e.parentId&&t.has(e.parentId)?t.get(e.parentId).children.push(e):n.push(e);return ze(n,0),n}function ze(e,t){for(let n of e)n.depth=t,ze(n.children,t+1)}function Be(e,t){let n=[];function r(e){for(let i of e)n.push(i),i.children.length>0&&t.has(i.id)&&r(i.children)}return r(e),n}function Ve(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}function He(e){return new Date(e.getFullYear(),e.getMonth()+1,0,23,59,59,999)}function Ue(e,t){return new Date(e.getFullYear(),e.getMonth()+t,e.getDate())}function X(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+t,0,0,0,0)}function We(e,t,n){if(n===0)return e;let r=new Map;for(let t of e)for(let e of t.dependencies??[])r.has(e)||r.set(e,[]),r.get(e).push(t.id);let i=new Map(e.map(e=>[e.id,e])),a=[...r.get(t)??[]],o=new Set;for(;a.length>0;){let e=a.shift();if(o.has(e))continue;o.add(e);let t=i.get(e);i.set(e,{...t,startDate:new Date(t.startDate.getTime()+n),endDate:new Date(t.endDate.getTime()+n)}),a.push(...r.get(e)??[])}return e.map(e=>i.get(e.id))}function Ge(e){let t=[],n=Ve(e.start);for(;n<=e.end;)t.push(n),n=Ue(n,1);return t}function Ke(e){let t=new Date(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t.setHours(0,0,0,0),t}function qe(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())),n=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-n);let r=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-r.getTime())/864e5+1)/7)}function Je(e){let t=[],n=Ke(e.start);for(;n<=e.end;)t.push(new Date(n)),n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+7);return t}function Ye(e){let t=[],n=new Date(e.start.getFullYear(),e.start.getMonth(),e.start.getDate(),0,0,0,0),r=new Date(e.end.getFullYear(),e.end.getMonth(),e.end.getDate(),0,0,0,0).getTime();for(;n.getTime()<=r;)t.push(new Date(n)),n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1,0,0,0,0);return t}function Xe(e){let t=Math.floor(e.getMonth()/3)*3;return new Date(e.getFullYear(),t,1,0,0,0,0)}function Ze(e){let t=Math.floor(e.getMonth()/3)*3+2;return He(new Date(e.getFullYear(),t,1))}function Qe(e){let t=[],n=Xe(e.start);for(;n<=e.end;){let e=Math.floor(n.getMonth()/3)+1;t.push({key:`${n.getFullYear()}-Q${e}`,label:`Q${e} ${n.getFullYear()}`,start:new Date(n)}),n=new Date(n.getFullYear(),n.getMonth()+3,1)}return t}function $e(e){if(e.length===0)return new Set;let t=new Map;for(let n of e)for(let e of n.dependencies??[])t.has(e)||t.set(e,[]),t.get(e).push(n.id);let n=new Map(e.map(e=>[e.id,e])),r=new Map,i=new Set;function a(e){if(r.has(e))return r.get(e);if(i.has(e))return n.get(e)?.endDate.getTime()??0;i.add(e);let o=n.get(e)?.endDate.getTime()??0;for(let n of t.get(e)??[])o=Math.max(o,a(n));return i.delete(e),r.set(e,o),o}for(let t of e)a(t.id);let o=Math.max(...r.values()),s=new Set;for(let t of e)a(t.id)===o&&s.add(t.id);return s}function et(e,t){let n=t.startDate<e.start?Ve(Ue(t.startDate,-1)):e.start,r=t.endDate>e.end?He(Ue(t.endDate,1)):e.end;return n===e.start&&r===e.end?e:{start:n,end:r}}function tt(e,t=`months`,n=!1,r,i=!1){let a=Y(e);return(0,A.createStore)((o,s)=>({tasks:e,taskTree:Re(e),expandedIds:n?new Set(e.map(e=>e.id)):new Set(e.filter(e=>!e.parentId).map(e=>e.id)),timeScale:t,timelineRange:r??a,isRangeCustomized:r!==void 0,cascadeDependencies:i,defaultTimeScale:t,initialExpandAll:n,isExpandedCustomized:!1,setTasks:e=>{o(t=>({tasks:e,taskTree:Re(e),...t.isRangeCustomized?{}:{timelineRange:Y(e)}}))},addTask:e=>{o(t=>{let n=[...t.tasks,e];return{tasks:n,taskTree:Re(n),timelineRange:et(t.timelineRange,e)}})},updateTask:e=>{o(t=>{let n=t.tasks.find(t=>t.id===e.id),r=t.tasks.map(t=>t.id===e.id?e:t);if(t.cascadeDependencies&&n){let t=e.endDate.getTime()-n.endDate.getTime();r=We(r,e.id,t)}let i=et(t.timelineRange,e);for(let e of r)i=et(i,e);return{tasks:r,taskTree:Re(r),timelineRange:i}})},deleteTask:e=>{o(t=>{let n=new Set,r=e=>{n.add(e),t.tasks.filter(t=>t.parentId===e).forEach(e=>r(e.id))};r(e);let i=t.tasks.filter(e=>!n.has(e.id));return{tasks:i,taskTree:Re(i)}})},toggleExpand:e=>{o(t=>{let n=new Set(t.expandedIds);return n.has(e)?n.delete(e):n.add(e),{expandedIds:n}})},expandAll:()=>{o(e=>({expandedIds:new Set(e.tasks.map(e=>e.id)),isExpandedCustomized:!0}))},collapseAll:()=>{o({expandedIds:new Set,isExpandedCustomized:!0})},setTimeScale:e=>{o({timeScale:e})},setTimelineRange:e=>{o({timelineRange:e,isRangeCustomized:!0})},resetTimelineRange:()=>{o(e=>({timelineRange:Y(e.tasks),isRangeCustomized:!1}))},resetView:()=>{o(e=>({timeScale:e.defaultTimeScale,timelineRange:Y(e.tasks),isRangeCustomized:!1,isExpandedCustomized:!1,expandedIds:e.initialExpandAll?new Set(e.tasks.map(e=>e.id)):new Set(e.tasks.filter(e=>!e.parentId).map(e=>e.id))}))},getVisibleTasks:()=>{let{taskTree:e,expandedIds:t}=s();return Be(e,t)}}))}var nt={scaleDays:`Tage`,scaleWeeks:`Wochen`,scaleMonths:`Monate`,scaleQuarters:`Quartale`,rangeFrom:`Von`,rangeTo:`Bis`,rangeResetTooltip:`Bereich zurücksetzen`,columnName:`Name`,columnStatus:`Status`,statusPlanned:`Planned`,statusInProgress:`In Progress`,statusDone:`Done`,statusBlocked:`Blocked`,weekColumnPrefix:`KW`,dateLocale:`de-DE`,dialogAddTitle:`Aufgabe hinzufügen`,dialogEditTitle:`Aufgabe bearbeiten`,dialogDeleteTitle:`Aufgabe löschen`,dialogSave:`Speichern`,dialogCancel:`Abbrechen`,dialogDelete:`Löschen`,dialogFieldName:`Name`,dialogFieldStartDate:`Startdatum`,dialogFieldEndDate:`Enddatum`,dialogFieldStatus:`Status`,dialogFieldMilestone:`Ist Meilenstein`,dialogFieldParent:`Übergeordnete Aufgabe`,dialogFieldParentNone:`— Keine —`,dialogDeleteConfirm:`Soll die Aufgabe "{name}" wirklich gelöscht werden?`,dialogFieldDependencies:`Vorgänger`,dialogFieldDependenciesNone:`— Keine —`,scrollToTodayTooltip:`Zum heutigen Tag`,expandAllTooltip:`Alle aufklappen`,collapseAllTooltip:`Alle zuklappen`,resetViewTooltip:`Ansicht zurücksetzen`,columnActions:`Aktionen`,addTaskTooltip:`Aufgabe hinzufügen`,editTaskTooltip:`Aufgabe bearbeiten`,deleteTaskTooltip:`Aufgabe löschen`},rt={planned:`warning.light`,"in-progress":`info.main`,done:`success.main`,blocked:`error.main`},it={planned:`warning`,"in-progress":`info`,done:`success`,blocked:`error`};function at(e){return e.toISOString().slice(0,10)}function ot(e,t,n){return e<t?t:e>n?n:e}function st(e){return e.flatMap(e=>[e,...st(e.children)])}function ct({label:e}){let t=(0,c.useRef)(null),[n,r]=(0,c.useState)(!1);return(0,m.jsx)(l.Tooltip,{title:e,disableHoverListener:!n,children:(0,m.jsx)(l.Typography,{ref:t,component:`span`,variant:`body2`,noWrap:!0,sx:{display:`block`,overflow:`hidden`,textOverflow:`ellipsis`,minWidth:0},onMouseEnter:()=>{t.current&&r(t.current.scrollWidth>t.current.clientWidth)},children:e})})}function lt({open:e,mode:t,initialTask:n,defaultParentId:r,onSave:i,onClose:a}){let o=Q(),s=Z(e=>e.taskTree),u=Z(e=>e.timelineRange),d=(0,c.useMemo)(()=>st(s),[s]),f=(0,c.useMemo)(()=>{if(t===`add`||!n)return new Set;let e=t=>[t.id,...t.children.flatMap(e)],r=d.find(e=>e.id===n.id);return new Set(r?e(r):[n.id])},[t,n,d]),p=d.filter(e=>!f.has(e.id)),h=p,g=at(ot(new Date,u.start,u.end)),[_,v]=(0,c.useState)({name:``,startDate:g,endDate:g,status:`planned`,isMilestone:!1,parentId:``,dependencies:[]});(0,c.useEffect)(()=>{if(!e)return;let i=at(ot(new Date,u.start,u.end));v(t===`edit`&&n?{name:n.name,startDate:at(n.startDate),endDate:at(n.endDate),status:n.status,isMilestone:n.isMilestone??!1,parentId:n.parentId??``,dependencies:n.dependencies??[]}:{name:``,startDate:i,endDate:i,status:`planned`,isMilestone:!1,parentId:r??``,dependencies:[]})},[e,t,n,r,u]);let y=e=>{v(t=>({...t,startDate:e,endDate:t.isMilestone||t.endDate<e?e:t.endDate}))},b=e=>{v(t=>({...t,endDate:e<t.startDate?t.startDate:e}))},x=e=>{v(t=>({...t,isMilestone:e,endDate:e?t.startDate:t.endDate}))},S=_.name.trim()!==``&&_.startDate!==``&&_.endDate!==``&&_.endDate>=_.startDate,C=()=>{S&&i({name:_.name.trim(),startDate:new Date(_.startDate),endDate:new Date(_.endDate),status:_.status,isMilestone:_.isMilestone||void 0,parentId:_.parentId||void 0,dependencies:_.dependencies.length>0?_.dependencies:void 0})},w=[`planned`,`in-progress`,`done`,`blocked`],T={planned:o.statusPlanned,"in-progress":o.statusInProgress,done:o.statusDone,blocked:o.statusBlocked};return(0,m.jsxs)(l.Dialog,{open:e,onClose:a,maxWidth:`xs`,fullWidth:!0,"data-testid":`gantt-task-dialog`,children:[(0,m.jsx)(l.DialogTitle,{children:t===`add`?o.dialogAddTitle:o.dialogEditTitle}),(0,m.jsxs)(l.DialogContent,{sx:{display:`flex`,flexDirection:`column`,gap:2,pt:`16px !important`},children:[(0,m.jsx)(l.TextField,{label:o.dialogFieldName,value:_.name,onChange:e=>v(t=>({...t,name:e.target.value})),required:!0,fullWidth:!0,size:`small`,autoFocus:!0,slotProps:{htmlInput:{"data-testid":`gantt-dialog-field-name`}}}),(0,m.jsx)(l.TextField,{label:o.dialogFieldStartDate,type:`date`,value:_.startDate,onChange:e=>y(e.target.value),required:!0,fullWidth:!0,size:`small`,slotProps:{inputLabel:{shrink:!0},htmlInput:{"data-testid":`gantt-dialog-field-start`}}}),(0,m.jsx)(l.TextField,{label:o.dialogFieldEndDate,type:`date`,value:_.endDate,onChange:e=>b(e.target.value),required:!0,fullWidth:!0,size:`small`,disabled:_.isMilestone,slotProps:{inputLabel:{shrink:!0},htmlInput:{"data-testid":`gantt-dialog-field-end`,min:_.startDate}}}),(0,m.jsxs)(l.FormControl,{size:`small`,fullWidth:!0,children:[(0,m.jsx)(l.InputLabel,{children:o.dialogFieldStatus}),(0,m.jsx)(l.Select,{value:_.status,label:o.dialogFieldStatus,onChange:e=>v(t=>({...t,status:e.target.value})),inputProps:{"data-testid":`gantt-dialog-field-status`},children:w.map(e=>(0,m.jsx)(l.MenuItem,{value:e,children:T[e]},e))})]}),(0,m.jsx)(l.FormControlLabel,{control:(0,m.jsx)(l.Checkbox,{checked:_.isMilestone,onChange:e=>x(e.target.checked),size:`small`,"data-testid":`gantt-dialog-field-milestone`}),label:o.dialogFieldMilestone}),(0,m.jsxs)(l.FormControl,{size:`small`,fullWidth:!0,children:[(0,m.jsx)(l.InputLabel,{children:o.dialogFieldParent}),(0,m.jsxs)(l.Select,{value:_.parentId,label:o.dialogFieldParent,onChange:e=>v(t=>({...t,parentId:e.target.value})),inputProps:{"data-testid":`gantt-dialog-field-parent`},MenuProps:{slotProps:{paper:{sx:{maxHeight:280}}}},children:[(0,m.jsx)(l.MenuItem,{value:``,children:o.dialogFieldParentNone}),p.map(e=>(0,m.jsx)(l.MenuItem,{value:e.id,sx:{minWidth:0},children:(0,m.jsxs)(l.Box,{sx:{display:`flex`,alignItems:`center`,pl:e.depth*2,gap:.75,minWidth:0,width:`100%`,overflow:`hidden`},children:[e.depth>0&&(0,m.jsx)(l.Typography,{component:`span`,variant:`caption`,sx:{color:`text.disabled`,lineHeight:1,flexShrink:0},children:`└`}),(0,m.jsx)(ct,{label:e.name})]})},e.id))]})]}),(0,m.jsxs)(l.FormControl,{size:`small`,fullWidth:!0,children:[(0,m.jsx)(l.InputLabel,{children:o.dialogFieldDependencies}),(0,m.jsx)(l.Select,{multiple:!0,value:_.dependencies,label:o.dialogFieldDependencies,onChange:e=>{let t=e.target.value;v(e=>({...e,dependencies:typeof t==`string`?t.split(`,`):t}))},inputProps:{"data-testid":`gantt-dialog-field-dependencies`},renderValue:e=>e.length===0?o.dialogFieldDependenciesNone:e.map(e=>d.find(t=>t.id===e)?.name??e).join(`, `),MenuProps:{slotProps:{paper:{sx:{maxHeight:280}}}},children:h.map(e=>(0,m.jsx)(l.MenuItem,{value:e.id,sx:{minWidth:0},children:(0,m.jsxs)(l.Box,{sx:{display:`flex`,alignItems:`center`,pl:e.depth*2,gap:.75,minWidth:0,width:`100%`,overflow:`hidden`},children:[e.depth>0&&(0,m.jsx)(l.Typography,{component:`span`,variant:`caption`,sx:{color:`text.disabled`,lineHeight:1,flexShrink:0},children:`└`}),(0,m.jsx)(ct,{label:e.name})]})},e.id))})]})]}),(0,m.jsxs)(l.DialogActions,{children:[(0,m.jsx)(l.Button,{onClick:a,children:o.dialogCancel}),(0,m.jsx)(l.Button,{onClick:C,variant:`contained`,disabled:!S,"data-testid":`gantt-dialog-save`,children:o.dialogSave})]})]})}function ut({open:e,task:t,onConfirm:n,onClose:r}){let i=Q(),a=i.dialogDeleteConfirm.replace(`{name}`,t?.name??``);return(0,m.jsxs)(l.Dialog,{open:e,onClose:r,maxWidth:`xs`,fullWidth:!0,"data-testid":`gantt-delete-dialog`,children:[(0,m.jsx)(l.DialogTitle,{children:i.dialogDeleteTitle}),(0,m.jsx)(l.DialogContent,{children:(0,m.jsx)(l.DialogContentText,{children:a})}),(0,m.jsxs)(l.DialogActions,{children:[(0,m.jsx)(l.Button,{onClick:r,children:i.dialogCancel}),(0,m.jsx)(l.Button,{onClick:n,variant:`contained`,color:`error`,"data-testid":`gantt-dialog-delete-confirm`,children:i.dialogDelete})]})]})}function dt(e,t){return{planned:t.statusPlanned,"in-progress":t.statusInProgress,done:t.statusDone,blocked:t.statusBlocked}[e]}function ft({task:e,expandedIds:t,toggleExpand:n,hasActionsColumn:r,onTaskClick:i,onAddTask:a,onEditTask:o,onDeleteTask:s,onStatusChange:u,inlineEdit:d,onInlineRename:f}){let[p,h]=(0,c.useState)(null),[g,_]=(0,c.useState)(null),v=Q(),{statusColors:y}=Pt(),b=()=>{g!==null&&g.trim()&&f?.(e,g.trim()),_(null)};return(0,m.jsxs)(l.Box,{className:`gantt-task-row`,"data-testid":`gantt-task-row-${e.id}`,sx:{height:40,display:`flex`,alignItems:`center`,borderBottom:`1px solid`,borderRight:`1px solid`,borderColor:`divider`,cursor:i?`pointer`:`default`,"&:hover":i?{bgcolor:`action.hover`}:void 0},onClick:()=>i?.(e),children:[(0,m.jsxs)(l.Box,{sx:{flex:1,minWidth:0,display:`flex`,alignItems:`center`,gap:.75,pl:1+e.depth*2,pr:.5,height:`100%`},children:[(0,m.jsx)(l.Box,{sx:{width:16,flexShrink:0,display:`flex`,justifyContent:`center`},children:e.children.length>0&&(0,m.jsx)(l.Box,{component:`span`,sx:{fontSize:9,userSelect:`none`,cursor:`pointer`},onClick:t=>{t.stopPropagation(),n(e.id)},children:t.has(e.id)?`▼`:`▶`})}),(0,m.jsx)(l.Box,{sx:{width:8,height:8,borderRadius:e.isMilestone?0:`50%`,transform:e.isMilestone?`rotate(45deg)`:void 0,flexShrink:0,bgcolor:e.color??y?.[e.status]??rt[e.status]??`grey.400`}}),g===null?(0,m.jsx)(l.Typography,{variant:`body2`,noWrap:!0,sx:{flex:1,minWidth:0,cursor:d?`text`:`inherit`},onDoubleClick:d?t=>{t.stopPropagation(),_(e.name)}:void 0,children:e.name}):(0,m.jsx)(l.TextField,{size:`small`,variant:`standard`,value:g,autoFocus:!0,onChange:e=>_(e.target.value),onBlur:b,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),b()),e.key===`Escape`&&(e.stopPropagation(),_(null))},onClick:e=>e.stopPropagation(),sx:{flex:1,minWidth:0},slotProps:{htmlInput:{"data-testid":`gantt-inline-edit-${e.id}`}}})]}),r&&(0,m.jsxs)(l.Box,{className:`gantt-row-actions`,sx:{width:96,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`flex-end`,pr:.5},children:[o&&(0,m.jsx)(l.Tooltip,{title:v.editTaskTooltip,children:(0,m.jsx)(l.IconButton,{size:`small`,"data-testid":`gantt-edit-task-${e.id}`,onClick:t=>{t.stopPropagation(),o(e)},children:(0,m.jsx)(N.default,{fontSize:`inherit`})})}),a&&(0,m.jsx)(l.Tooltip,{title:v.addTaskTooltip,children:(0,m.jsx)(l.IconButton,{size:`small`,"data-testid":`gantt-add-task-${e.id}`,onClick:t=>{t.stopPropagation(),a(e)},children:(0,m.jsx)(M.default,{fontSize:`inherit`})})}),s&&(0,m.jsx)(l.Tooltip,{title:v.deleteTaskTooltip,children:(0,m.jsx)(l.IconButton,{size:`small`,"data-testid":`gantt-delete-task-${e.id}`,onClick:t=>{t.stopPropagation(),s(e)},children:(0,m.jsx)(w.default,{fontSize:`inherit`})})})]}),(0,m.jsxs)(l.Box,{sx:{width:90,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,m.jsx)(l.Chip,{label:dt(e.status,v),size:`small`,variant:`outlined`,color:e.color??y?.[e.status]?`default`:it[e.status]??`default`,sx:{height:20,fontSize:10,cursor:u?`pointer`:`default`,...(e.color??y?.[e.status])&&{borderColor:e.color??y?.[e.status],color:e.color??y?.[e.status]}},onClick:u?e=>{e.stopPropagation(),h(e.currentTarget)}:void 0}),u&&(0,m.jsx)(l.Menu,{anchorEl:p,open:!!p,onClose:()=>h(null),children:[`planned`,`in-progress`,`done`,`blocked`].map(t=>(0,m.jsx)(l.MenuItem,{selected:e.status===t,onClick:()=>{u(e,t),h(null)},children:dt(t,v)},t))})]})]})}function pt({scrollRef:e,onScroll:t,panelWidth:n,onTaskClick:r,onAddTask:i,onEditTask:a,onDeleteTask:o,onStatusChange:s,onTasksChange:u,enableBuiltinDialogs:d,onTaskCreated:f,onTaskUpdated:p,onTaskDeleted:h,inlineEdit:g,virtualizeRows:_=!1}){let v=Q(),y=jt(),b=Z(e=>e.taskTree),x=Z(e=>e.expandedIds),S=Z(e=>e.toggleExpand),C=Z(e=>e.timeScale),w=Z(e=>e.addTask),T=Z(e=>e.updateTask),E=Z(e=>e.deleteTask),D=(0,c.useMemo)(()=>Be(b,x),[b,x]),O=(0,j.useVirtualizer)({count:D.length,getScrollElement:()=>e.current,estimateSize:()=>40,overscan:5}),[k,A]=(0,c.useState)(!1),[M,N]=(0,c.useState)(!1),[P,F]=(0,c.useState)(!1),[I,L]=(0,c.useState)(null),R=e=>{let t={...e,id:crypto.randomUUID()};w(t),u?.(y.getState().tasks),f?.(t),A(!1)},z=e=>{if(!I)return;let t={...e,id:I.id};T(t),u?.(y.getState().tasks),p?.(t),N(!1)},B=()=>{I&&(E(I.id),u?.(y.getState().tasks),h?.(I.id),F(!1))},V=(e,t)=>{let n={...e,name:t};T(n),u?.(y.getState().tasks),p?.(n)},H=d?e=>{L(e),A(!0)}:i,U=d?e=>{L(e),N(!0)}:a,W=d?e=>{L(e),F(!0)}:o,G=!!(H||U||W),ee=C===`days`?80:40;return(0,m.jsxs)(l.Box,{ref:e,onScroll:t,sx:{width:n,flexShrink:0,overflowY:`auto`,overflowX:`hidden`},children:[(0,m.jsxs)(l.Box,{sx:{height:ee,position:`sticky`,top:0,bgcolor:`background.paper`,zIndex:1,borderBottom:`1px solid`,borderRight:`1px solid`,borderColor:`divider`,display:`flex`,flexDirection:`column`},children:[(0,m.jsxs)(l.Box,{sx:{height:40,display:`flex`,alignItems:`center`,borderBottom:C===`days`?`1px solid`:void 0,borderColor:C===`days`?`divider`:void 0},children:[(0,m.jsx)(l.Box,{sx:{flex:1,minWidth:0,pl:2},children:(0,m.jsx)(l.Typography,{variant:`caption`,color:`text.secondary`,children:v.columnName})}),G&&(0,m.jsx)(l.Box,{sx:{width:96,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,m.jsx)(l.Typography,{variant:`caption`,color:`text.secondary`,children:v.columnActions})}),(0,m.jsx)(l.Box,{sx:{width:90,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,m.jsx)(l.Typography,{variant:`caption`,color:`text.secondary`,children:v.columnStatus})})]}),C===`days`&&(0,m.jsx)(l.Box,{sx:{flex:1}})]}),_?(0,m.jsx)(l.Box,{sx:{position:`relative`,height:O.getTotalSize()},children:O.getVirtualItems().map(e=>(0,m.jsx)(l.Box,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:40,transform:`translateY(${e.start}px)`},children:(0,m.jsx)(ft,{task:D[e.index],expandedIds:x,toggleExpand:S,hasActionsColumn:G,onTaskClick:r,onAddTask:H,onEditTask:U,onDeleteTask:W,onStatusChange:s,inlineEdit:g,onInlineRename:g?V:void 0})},e.key))}):D.map(e=>(0,m.jsx)(ft,{task:e,expandedIds:x,toggleExpand:S,hasActionsColumn:G,onTaskClick:r,onAddTask:H,onEditTask:U,onDeleteTask:W,onStatusChange:s,inlineEdit:g,onInlineRename:g?V:void 0},e.id)),d&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(lt,{open:k,mode:`add`,defaultParentId:I?.id,onSave:R,onClose:()=>A(!1)}),(0,m.jsx)(lt,{open:M,mode:`edit`,initialTask:I??void 0,onSave:z,onClose:()=>N(!1)}),(0,m.jsx)(ut,{open:P,task:I,onConfirm:B,onClose:()=>F(!1)})]})]})}var mt=864e5;function ht({totalWidth:e,displayRange:t,onTaskMoved:n,onTaskResized:r,onTasksChange:i}){let a=Z(e=>e.updateTask),o=jt(),s=Q(),l=(0,c.useRef)(1);l.current=e>0?e/((t.end.getTime()-t.start.getTime())/mt):1;let u=(0,c.useRef)(n);u.current=n;let d=(0,c.useRef)(r);d.current=r;let f=(0,c.useRef)(i);f.current=i;let p=(0,c.useRef)(null),m=(0,c.useRef)(null),[h,g]=(0,c.useState)(null),_=(0,c.useRef)(!1);return{activeDrag:h,suppressClickRef:_,handleBarMouseDown:(e,t,n)=>{e.stopPropagation(),_.current=!1,p.current={type:n,taskId:t.id,startX:e.clientX,originalStart:t.startDate,originalEnd:t.endDate},document.body.style.cursor=n===`resize`?`ew-resize`:`grabbing`;let r=e=>{let t=p.current;if(!t||t.type===`progress`)return;let n=e.clientX-t.startX,r=Math.round(n/l.current);Math.abs(n)>=5&&(_.current=!0);let i={taskId:t.taskId,type:t.type,deltaDays:r};m.current=i,g(i)},i=()=>{document.body.style.cursor=``;let e=p.current,t=m.current;if(e&&t&&_.current&&t.deltaDays!==0){let n=o.getState().tasks.find(t=>t.id===e.taskId);if(n){if(t.type===`move`){let r=X(e.originalStart,t.deltaDays),i=X(e.originalEnd,t.deltaDays);a({...n,startDate:r,endDate:i}),u.current?.(n,r,i)}else{let r=X(e.originalEnd,t.deltaDays),i=r>e.originalStart?r:X(e.originalStart,1);a({...n,endDate:i}),d.current?.(n,i)}f.current?.(o.getState().tasks)}}p.current=null,m.current=null,g(null),document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},handleProgressMouseDown:(e,t,n,r)=>{e.stopPropagation(),_.current=!1,p.current={type:`progress`,taskId:t.id,startX:e.clientX,originalStart:t.startDate,originalEnd:t.endDate,initialProgress:n,barWidthPx:r},document.body.style.cursor=`ew-resize`;let i=e=>{let t=p.current;if(!t||t.type!==`progress`)return;let n=e.clientX-t.startX;Math.abs(n)>=5&&(_.current=!0);let r=n/(t.barWidthPx??1)*100,i=Math.round(Math.max(0,Math.min(100,(t.initialProgress??0)+r))),a={taskId:t.taskId,type:`progress`,deltaDays:0,newProgress:i};m.current=a,g(a)},s=()=>{document.body.style.cursor=``;let e=p.current,t=m.current;if(e&&t&&t.type===`progress`&&t.newProgress!==void 0&&_.current){let n=o.getState().tasks.find(t=>t.id===e.taskId);n&&(a({...n,progress:t.newProgress}),f.current?.(o.getState().tasks))}p.current=null,m.current=null,g(null),document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,s)};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,s)},formatDragDate:e=>e.toLocaleDateString(s.dateLocale,{day:`2-digit`,month:`short`})}}function gt({items:e}){return(0,m.jsx)(l.Box,{sx:{display:`flex`},children:e.map(e=>(0,m.jsx)(l.Box,{sx:{width:e.width,flexShrink:0,height:40,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRight:`1px solid`,borderColor:`divider`,bgcolor:e.isWeekend?`action.hover`:`transparent`},children:(0,m.jsx)(l.Typography,{variant:`caption`,color:e.isWeekend?`text.disabled`:`text.secondary`,children:e.label})},e.key))})}function _t({columns:e,groups:t}){return(0,m.jsxs)(l.Box,{sx:{position:`sticky`,top:0,bgcolor:`background.paper`,zIndex:1,borderBottom:`1px solid`,borderColor:`divider`,height:t?80:40,overflow:`visible`},children:[t&&(0,m.jsx)(l.Box,{sx:{height:40,borderBottom:`1px solid`,borderColor:`divider`,overflow:`visible`},children:(0,m.jsx)(gt,{items:t})}),(0,m.jsx)(gt,{items:e})]})}function vt({task:e,virtualTop:t,activeDrag:n,displayRange:r,totalWidth:i,gridColumnWidth:a,criticalTaskIds:o,draggable:s=!1,resizable:c=!1,progressDraggable:u=!1,onTaskClick:d,onMilestoneClick:f,onContextMenu:p,suppressClickRef:h,handleBarMouseDown:g,handleProgressMouseDown:_,formatDragDate:v}){let y=(0,l.useTheme)(),{statusColors:b,criticalPathColor:x,milestoneColor:S,barBorderRadius:C}=Pt(),w=n?.taskId===e.id,T=e;if(w&&n)if(n.type===`move`)T={...e,startDate:X(e.startDate,n.deltaDays),endDate:X(e.endDate,n.deltaDays)};else if(n.type===`resize`){let t=X(e.endDate,n.deltaDays);T={...e,endDate:t>e.startDate?t:X(e.startDate,1)}}else n.type===`progress`&&n.newProgress!==void 0&&(T={...e,progress:n.newProgress});let{left:E,width:D}=Le(T,r);return(0,m.jsx)(l.Box,{"data-testid":`gantt-bar-row-${e.id}`,style:t===void 0?void 0:{position:`absolute`,top:t,left:0,width:`100%`},sx:{height:40,position:`relative`,borderBottom:`1px solid`,borderColor:`divider`,backgroundImage:e=>`linear-gradient(to right, transparent calc(${a}px - 1px), ${e.palette.divider} calc(${a}px - 1px), ${e.palette.divider} ${a}px)`,backgroundSize:`${a}px 100%`,backgroundRepeat:`repeat-x`},children:e.isMilestone?(0,m.jsx)(yt,{task:e,left:E,milestoneColor:S,criticalPathColor:x,isCritical:o.has(e.id),onMilestoneClick:f,theme:y}):(0,m.jsx)(bt,{task:e,effectiveTask:T,left:E,width:D,totalWidth:i,isDragging:w,activeDrag:n,draggable:s,resizable:c,progressDraggable:u,isCritical:o.has(e.id),statusColors:b,criticalPathColor:x,barBorderRadius:C,onTaskClick:d,onContextMenu:p,suppressClickRef:h,handleBarMouseDown:g,handleProgressMouseDown:_,formatDragDate:v,theme:y})})}function yt({task:e,left:t,milestoneColor:n,criticalPathColor:r,isCritical:i,onMilestoneClick:a,theme:o}){return t<0||t>100?null:(0,m.jsx)(l.Box,{"data-testid":`gantt-milestone-${e.id}`,sx:{position:`absolute`,left:`${t}%`,top:`50%`,width:12,height:12,bgcolor:n??`warning.main`,transform:`translate(-50%, -50%) rotate(45deg)`,cursor:a?`pointer`:`default`,boxShadow:i?`0 0 0 2.5px ${r??o.palette.error.main}`:void 0,"&:hover":a?{opacity:.8}:void 0},onClick:()=>a?.(e)})}function bt({task:e,effectiveTask:t,left:n,width:r,totalWidth:i,isDragging:a,activeDrag:o,draggable:s,resizable:c,progressDraggable:u,isCritical:d,statusColors:f,criticalPathColor:p,barBorderRadius:h,onTaskClick:g,onContextMenu:_,suppressClickRef:v,handleBarMouseDown:y,handleProgressMouseDown:b,formatDragDate:x,theme:S}){let C=Math.max(0,n),w=Math.min(100,n+Math.max(r,.5))-C;return w<=0?null:(0,m.jsxs)(m.Fragment,{children:[a&&o&&o.type!==`progress`&&o.deltaDays!==0&&(0,m.jsx)(xt,{left:C,children:o.type===`move`?`${x(t.startDate)} – ${x(t.endDate)}`:`→ ${x(t.endDate)}`}),a&&o?.type===`progress`&&o.newProgress!==void 0&&(0,m.jsxs)(xt,{left:C,children:[o.newProgress,`%`]}),(0,m.jsxs)(l.Box,{"data-testid":`gantt-bar-${e.id}`,sx:{position:`absolute`,left:`${C}%`,width:`${w}%`,height:16,top:`50%`,transform:`translateY(-50%)`,bgcolor:e.color??f?.[e.status]??rt[e.status]??`grey.300`,borderRadius:h===void 0?1:`${h}px`,overflow:`hidden`,opacity:a?.75:1,boxShadow:d?`inset 0 0 0 2.5px ${p??S.palette.error.main}`:void 0,cursor:a?`grabbing`:s?`grab`:g?`pointer`:`default`,userSelect:`none`,"&:hover":s||g?{opacity:a?.75:.8}:void 0},onMouseDown:s?t=>y(t,e,`move`):void 0,onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),_(e,t.clientX,t.clientY)},onClick:()=>{if(v.current){v.current=!1;return}g?.(e)},children:[t.progress!==void 0&&t.progress>0&&(0,m.jsx)(l.Box,{"data-testid":`gantt-progress-${e.id}`,sx:{position:`absolute`,left:0,top:0,width:`${Math.min(t.progress,100)}%`,height:`100%`,bgcolor:`currentColor`,opacity:.4}}),u&&(0,m.jsx)(l.Box,{"data-testid":`gantt-progress-handle-${e.id}`,sx:{position:`absolute`,left:`${Math.min(t.progress??0,100)}%`,top:0,width:6,height:`100%`,transform:`translateX(-50%)`,cursor:`ew-resize`,bgcolor:`rgba(255,255,255,0.35)`},onMouseDown:n=>{n.stopPropagation();let r=w/100*i;b(n,e,t.progress??0,r)}}),c&&(0,m.jsx)(l.Box,{"data-testid":`gantt-resize-handle-${e.id}`,sx:{position:`absolute`,right:0,top:0,width:6,height:`100%`,cursor:`ew-resize`},onMouseDown:t=>{t.stopPropagation(),y(t,e,`resize`)}})]})]})}function xt({left:e,children:t}){return(0,m.jsx)(l.Box,{sx:{position:`absolute`,left:`${e}%`,top:2,bgcolor:`grey.800`,color:`common.white`,borderRadius:.5,px:.75,lineHeight:`18px`,fontSize:`0.65rem`,whiteSpace:`nowrap`,pointerEvents:`none`,zIndex:100},children:t})}function St({strips:e,totalWidth:t,height:n,top:r}){let{weekendColor:i}=Pt();return e.length===0?null:(0,m.jsx)(l.Box,{"aria-hidden":!0,"data-testid":`gantt-weekend-strips`,sx:{position:`absolute`,top:r,left:0,width:t,height:n,pointerEvents:`none`},children:e.map(e=>(0,m.jsx)(l.Box,{sx:{position:`absolute`,left:e.left,width:20,top:0,height:`100%`,bgcolor:i??`action.hover`}},e.key))})}function Ct({contextMenu:e,onClose:t,onSelect:n}){let r=Q(),i={planned:r.statusPlanned,"in-progress":r.statusInProgress,done:r.statusDone,blocked:r.statusBlocked};return(0,m.jsx)(l.Menu,{open:e!==null,onClose:t,anchorReference:`anchorPosition`,anchorPosition:e===null?void 0:{top:e.mouseY,left:e.mouseX},children:[`planned`,`in-progress`,`done`,`blocked`].map(t=>(0,m.jsx)(l.MenuItem,{selected:e?.task.status===t,"data-testid":`gantt-status-menu-${t}`,onClick:()=>{e&&n(e.task,t)},children:i[t]},t))})}function wt({dependencyLines:e,todayX:t,totalWidth:n,height:r,top:i,arrowMarkerId:a}){let o=(0,l.useTheme)(),{todayLineColor:s}=Pt();return e.length===0&&t===null?null:(0,m.jsxs)(`svg`,{"data-testid":`gantt-dependency-arrows`,style:{position:`absolute`,top:i,left:0,width:n,height:r,pointerEvents:`none`,overflow:`visible`},children:[e.length>0&&(0,m.jsx)(`defs`,{children:(0,m.jsx)(`marker`,{id:a,markerWidth:`6`,markerHeight:`4`,refX:`5`,refY:`2`,orient:`auto`,children:(0,m.jsx)(`polygon`,{points:`0 0, 6 2, 0 4`,fill:`currentColor`})})}),e.map(e=>(0,m.jsx)(`path`,{"data-testid":`gantt-dep-${e.key}`,d:e.d,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeOpacity:.4,markerEnd:`url(#${a})`},e.key)),t!==null&&(0,m.jsx)(`line`,{"data-testid":`gantt-today-line`,x1:t,y1:0,x2:t,y2:r,stroke:s??o.palette.primary.main,strokeWidth:1.5,strokeDasharray:`4 2`})]})}function Tt(e,t,n){if(n===0)return[];let r=[],i=new Map(e.map((e,t)=>[e.id,t]));for(let a of e){if(!a.dependencies?.length)continue;let o=i.get(a.id),s=Le(a,t).left/100*n,c=o*40+40/2;for(let o of a.dependencies){let l=i.get(o);if(l===void 0)continue;let u=e[l],d=Le(u,t),f=(d.left+d.width)/100*n,p=l*40+40/2,m;m=s>=f+48?(f+s)/2:f+24<=n-8?f+24:Math.max(s-24,8),r.push({key:`${o}-${a.id}`,d:`M ${f} ${p} H ${m} V ${c} H ${s}`})}}return r}function Et({scrollRef:e,onScroll:t,onTaskClick:n,onMilestoneClick:r,draggable:i=!1,resizable:a=!1,progressDraggable:o=!1,showCriticalPath:s=!1,virtualizeRows:u=!1,onTaskMoved:d,onTaskResized:f,onTasksChange:p,onStatusChange:h}){let g=Z(e=>e.taskTree),_=Z(e=>e.tasks),v=Z(e=>e.expandedIds),y=Z(e=>e.timelineRange),b=Z(e=>e.timeScale),x=Z(e=>e.updateTask),S=jt(),C=Q(),w=`gantt-arrow-${(0,c.useId)().replace(/:/g,``)}`,T=(0,c.useMemo)(()=>Be(g,v),[g,v]),E=(0,c.useMemo)(()=>Ie(y,b),[y,b]),D=(0,c.useMemo)(()=>b===`days`?Ye(E).map(e=>({key:e.toISOString(),label:String(e.getDate()),width:20,isWeekend:e.getDay()===0||e.getDay()===6})):b===`weeks`?Je(E).map(e=>({key:e.toISOString(),label:`${C.weekColumnPrefix}${qe(e)}`,width:40})):b===`quarters`?Qe(E).map(e=>({key:e.key,label:e.label,width:360})):Ge(E).map(e=>({key:e.toISOString(),label:e.toLocaleString(C.dateLocale,{month:`short`,year:`2-digit`}),width:120})),[b,E,C.weekColumnPrefix,C.dateLocale]),O=(0,c.useMemo)(()=>D.reduce((e,t)=>e+t.width,0),[D]),k=(0,c.useMemo)(()=>{if(b!==`days`)return;let e=new Map;for(let t of D){let n=new Date(t.key),r=`${n.getFullYear()}-${n.getMonth()}`;e.has(r)||e.set(r,{label:n.toLocaleString(C.dateLocale,{month:`short`,year:`2-digit`}),width:0}),e.get(r).width+=20}return Array.from(e.entries()).map(([e,t])=>({key:e,...t}))},[b,D,C.dateLocale]),A=(0,c.useMemo)(()=>Tt(T,E,O),[T,E,O]),M=(0,c.useMemo)(()=>s?$e(_):new Set,[s,_]),N=(0,j.useVirtualizer)({count:T.length,getScrollElement:()=>e.current,estimateSize:()=>40,overscan:5}),P=(0,c.useMemo)(()=>{if(b!==`days`)return[];let e=0;return D.flatMap(t=>{let n=t.isWeekend?[{key:t.key,left:e}]:[];return e+=t.width,n})},[b,D]),F=(0,c.useMemo)(()=>{let e=Date.now(),t=E.start.getTime(),n=E.end.getTime();return e<t||e>n?null:(e-t)/(n-t)*O},[E,O]);(0,c.useEffect)(()=>{if(F===null||!e.current)return;let t=e.current.clientWidth;e.current.scrollLeft=Math.max(0,F-t/2)},[]);let I=b===`days`?20:b===`weeks`?40:b===`quarters`?360:120,L=k?80:40,{activeDrag:R,suppressClickRef:z,handleBarMouseDown:B,handleProgressMouseDown:V,formatDragDate:H}=ht({totalWidth:O,displayRange:E,onTaskMoved:d,onTaskResized:f,onTasksChange:p}),[U,W]=(0,c.useState)(null),G=(0,c.useRef)(h);G.current=h;let ee=(0,c.useRef)(p);return ee.current=p,(0,m.jsx)(l.Box,{ref:e,onScroll:t,"data-testid":`gantt-timeline-scroll`,sx:{flex:1,overflow:`auto`},children:(0,m.jsxs)(l.Box,{sx:{minWidth:O,position:`relative`},children:[(0,m.jsx)(_t,{columns:D,groups:k}),(0,m.jsx)(St,{strips:P,totalWidth:O,height:T.length*40,top:L}),u?(0,m.jsx)(l.Box,{sx:{position:`relative`,height:N.getTotalSize()},children:N.getVirtualItems().map(e=>(0,m.jsx)(vt,{task:T[e.index],virtualTop:e.start,activeDrag:R,displayRange:E,totalWidth:O,gridColumnWidth:I,criticalTaskIds:M,draggable:i,resizable:a,progressDraggable:o,onTaskClick:n,onMilestoneClick:r,onContextMenu:(e,t,n)=>W({task:e,mouseX:t,mouseY:n}),suppressClickRef:z,handleBarMouseDown:B,handleProgressMouseDown:V,formatDragDate:H},e.key))}):(0,m.jsx)(m.Fragment,{children:T.map(e=>(0,m.jsx)(vt,{task:e,activeDrag:R,displayRange:E,totalWidth:O,gridColumnWidth:I,criticalTaskIds:M,draggable:i,resizable:a,progressDraggable:o,onTaskClick:n,onMilestoneClick:r,onContextMenu:(e,t,n)=>W({task:e,mouseX:t,mouseY:n}),suppressClickRef:z,handleBarMouseDown:B,handleProgressMouseDown:V,formatDragDate:H},e.id))}),(0,m.jsx)(Ct,{contextMenu:U,onClose:()=>W(null),onSelect:(e,t)=>{let n=S.getState().tasks.find(t=>t.id===e.id)??e;x({...n,status:t}),G.current?.(n,t),ee.current?.(S.getState().tasks),W(null)}}),(0,m.jsx)(wt,{dependencyLines:A,todayX:F,totalWidth:O,height:T.length*40,top:L,arrowMarkerId:w})]})})}function Dt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function Ot(e){let[t,n,r]=e.split(`-`).map(Number);return!t||!n||!r?null:new Date(t,n-1,r,0,0,0,0)}function kt({onScrollToToday:e,config:t}){let n=Q(),r=Z(e=>e.timeScale),i=Z(e=>e.defaultTimeScale),a=Z(e=>e.setTimeScale),o=Z(e=>e.timelineRange),s=Z(e=>e.isRangeCustomized),u=Z(e=>e.isExpandedCustomized),d=Z(e=>e.setTimelineRange),f=Z(e=>e.resetTimelineRange),p=Z(e=>e.resetView),h=Z(e=>e.tasks),g=Z(e=>e.expandedIds),_=Z(e=>e.expandAll),v=Z(e=>e.collapseAll),y=h.length>0&&h.every(e=>g.has(e.id)),b=r!==i||s||u,x=(0,c.useMemo)(()=>Date.now(),[]),S=x>=o.start.getTime()&&x<=o.end.getTime(),C={days:n.scaleDays,weeks:n.scaleWeeks,months:n.scaleMonths,quarters:n.scaleQuarters},w={days:t.showScaleDays,weeks:t.showScaleWeeks,months:t.showScaleMonths,quarters:t.showScaleQuarters},T=Object.keys(C).filter(e=>w[e]);return(0,m.jsxs)(l.Box,{"data-testid":`gantt-toolbar`,sx:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1,px:1.5,py:.75,borderBottom:`1px solid`,borderColor:`divider`,bgcolor:`background.paper`},children:[T.length>0&&(0,m.jsx)(l.ToggleButtonGroup,{value:r,exclusive:!0,onChange:(e,t)=>{t&&a(t)},size:`small`,"aria-label":n.scaleMonths,children:T.map(e=>(0,m.jsx)(l.ToggleButton,{value:e,"data-testid":`gantt-scale-${e}`,children:C[e]},e))}),(0,m.jsxs)(l.Box,{sx:{ml:`auto`,display:`flex`,alignItems:`center`,gap:1},children:[t.showExpandCollapseAll&&(0,m.jsx)(l.Tooltip,{title:y?n.collapseAllTooltip:n.expandAllTooltip,children:(0,m.jsx)(l.IconButton,{size:`small`,onClick:y?v:_,"data-testid":`gantt-expand-collapse-all`,children:y?(0,m.jsx)(L.default,{fontSize:`small`}):(0,m.jsx)(R.default,{fontSize:`small`})})}),t.showScrollToToday&&e&&(0,m.jsx)(l.Tooltip,{title:n.scrollToTodayTooltip,children:(0,m.jsx)(`span`,{children:(0,m.jsx)(l.IconButton,{size:`small`,onClick:e,disabled:!S,"data-testid":`gantt-scroll-to-today`,children:(0,m.jsx)(I.default,{fontSize:`small`})})})}),t.showDateRange&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(l.TextField,{type:`date`,size:`small`,label:n.rangeFrom,value:Dt(o.start),onChange:e=>{let t=Ot(e.target.value);t&&d({start:t,end:o.end})},slotProps:{inputLabel:{shrink:!0},htmlInput:{"data-testid":`gantt-range-start`}},sx:{width:148}}),(0,m.jsx)(l.TextField,{type:`date`,size:`small`,label:n.rangeTo,value:Dt(o.end),onChange:e=>{let t=Ot(e.target.value);t&&d({start:o.start,end:t})},slotProps:{inputLabel:{shrink:!0},htmlInput:{"data-testid":`gantt-range-end`}},sx:{width:148}})]}),t.showRangeReset&&s&&(0,m.jsx)(l.Tooltip,{title:n.rangeResetTooltip,children:(0,m.jsx)(l.IconButton,{size:`small`,onClick:f,"data-testid":`gantt-range-reset`,children:(0,m.jsx)(F.default,{fontSize:`small`})})}),t.showResetView&&(0,m.jsx)(l.Tooltip,{title:n.resetViewTooltip,children:(0,m.jsx)(`span`,{children:(0,m.jsx)(l.IconButton,{size:`small`,onClick:p,disabled:!b,"data-testid":`gantt-reset-view`,children:(0,m.jsx)(P.default,{fontSize:`small`})})})})]})]})}var At=(0,c.createContext)(null);function Z(e){let t=(0,c.useContext)(At);if(!t)throw Error(`GanttChartStoreContext is missing.`);return(0,k.useStore)(t,e)}function jt(){let e=(0,c.useContext)(At);if(!e)throw Error(`GanttChartStoreContext is missing.`);return e}var Mt=(0,c.createContext)(nt);function Q(){return(0,c.useContext)(Mt)}var Nt=(0,c.createContext)({});function Pt(){return(0,c.useContext)(Nt)}function Ft(e,t){return e===void 0?t:e===`auto`?`100%`:typeof e==`string`&&/^\d+$/.test(e)?Number(e):e}var It=[`days`,`weeks`,`months`,`quarters`],Lt={showScaleDays:!0,showScaleWeeks:!0,showScaleMonths:!0,showScaleQuarters:!0,showExpandCollapseAll:!0,showScrollToToday:!0,showDateRange:!0,showRangeReset:!0,showResetView:!0};function Rt({tasks:e,onTaskClick:t,onMilestoneClick:n,onAddTask:r,onEditTask:i,onDeleteTask:a,onStatusChange:o,onTasksChange:s,enableBuiltinDialogs:u=!0,onTaskCreated:d,onTaskUpdated:f,onTaskDeleted:p,showToolbar:h=!0,toolbarConfig:g,height:_,width:v,minPanelWidth:y=200,maxPanelWidth:b=600,zoomable:x=!1,draggable:S=!1,resizable:C=!1,inlineEdit:w=!1,progressDraggable:T=!1,showCriticalPath:E=!1,virtualizeRows:D=!1,onTaskMoved:O,onTaskResized:k}){let A=Ft(_,400),j=(0,c.useMemo)(()=>({...Lt,...g}),[g]),M=Ft(v,`100%`),N=Z(e=>e.setTasks),P=Z(e=>e.timeScale),F=Z(e=>e.setTimeScale),I=Z(e=>e.timelineRange),L=(0,c.useRef)(null),R=(0,c.useRef)(null),z=(0,c.useRef)(!1),[B,V]=(0,c.useState)(320);(0,c.useEffect)(()=>{N(e)},[e,N]);let H=()=>{z.current||=(z.current=!0,R.current&&L.current&&(R.current.scrollTop=L.current.scrollTop),!1)},U=()=>{z.current||=(z.current=!0,L.current&&R.current&&(L.current.scrollTop=R.current.scrollTop),!1)},W=(0,c.useCallback)(()=>{if(!R.current)return;let e=Ie(I,P),t=Date.now(),n=e.start.getTime(),r=e.end.getTime(),i=(t-n)/(r-n)*R.current.scrollWidth;R.current.scrollLeft=Math.max(0,i-R.current.clientWidth/2)},[I,P]);(0,c.useEffect)(()=>{if(!x||!R.current)return;let e=R.current,t=e=>{if(!e.ctrlKey)return;e.preventDefault();let t=It.indexOf(P);e.deltaY<0&&t>0?F(It[t-1]):e.deltaY>0&&t<It.length-1&&F(It[t+1])};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[x,P,F]);let G=(0,c.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=B,r=e=>{let r=e.clientX-t;V(Math.max(y,Math.min(b,n+r)))},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[B,y,b]);return(0,m.jsxs)(l.Box,{sx:{display:`flex`,flexDirection:`column`,height:A,width:M,border:`1px solid`,borderColor:`divider`,borderRadius:1,overflow:`hidden`},children:[h&&(0,m.jsx)(kt,{onScrollToToday:W,config:j}),(0,m.jsxs)(l.Box,{sx:{display:`flex`,flex:1,overflow:`hidden`},children:[(0,m.jsx)(pt,{scrollRef:L,onScroll:H,panelWidth:B,onTaskClick:t,onAddTask:r,onEditTask:i,onDeleteTask:a,onStatusChange:o,onTasksChange:s,enableBuiltinDialogs:u,onTaskCreated:d,onTaskUpdated:f,onTaskDeleted:p,inlineEdit:w,virtualizeRows:D}),(0,m.jsx)(l.Box,{"data-testid":`gantt-panel-divider`,sx:{width:4,flexShrink:0,bgcolor:`divider`,cursor:`col-resize`,"&:hover":{bgcolor:`action.hover`}},onMouseDown:G}),(0,m.jsx)(Et,{scrollRef:R,onScroll:U,onTaskClick:t,onMilestoneClick:n,draggable:S,resizable:C,progressDraggable:T,showCriticalPath:E,virtualizeRows:D,onTaskMoved:O,onTaskResized:k,onTasksChange:s,onStatusChange:o})]})]})}function zt({tasks:e,timeScale:t=`months`,initialExpandAll:n=!1,showToolbar:r=!0,defaultRangeStart:i,defaultRangeEnd:a,translations:o,enableBuiltinDialogs:s=!0,toolbarConfig:l,zoomable:u=!1,draggable:d=!1,resizable:f=!1,inlineEdit:p=!1,progressDraggable:h=!1,showCriticalPath:g=!1,virtualizeRows:_=!1,cascadeDependencies:v=!1,statusColors:y,ganttTheme:b,onTaskClick:x,onMilestoneClick:S,onAddTask:C,onEditTask:w,onDeleteTask:T,onStatusChange:E,onTasksChange:D,onTaskMoved:O,onTaskResized:k,onTaskCreated:A,onTaskUpdated:j,onTaskDeleted:M,height:N,width:P,minPanelWidth:F,maxPanelWidth:I}){let L=(0,c.useMemo)(()=>({...nt,...o}),[o]),[R]=(0,c.useState)(()=>{if(!(i!==void 0||a!==void 0))return tt(e,t,n,void 0,v);let r=Y(e);return tt(e,t,n,{start:i??r.start,end:a??r.end},v)}),z=(0,c.useMemo)(()=>({...b,statusColors:{...y,...b?.statusColors}}),[y,b]);return(0,m.jsx)(Mt.Provider,{value:L,children:(0,m.jsx)(Nt.Provider,{value:z,children:(0,m.jsx)(At.Provider,{value:R,children:(0,m.jsx)(Rt,{tasks:e,timeScale:t,enableBuiltinDialogs:s,showToolbar:r,toolbarConfig:l,zoomable:u,draggable:d,resizable:f,inlineEdit:p,progressDraggable:h,showCriticalPath:g,virtualizeRows:_,onTaskClick:x,onMilestoneClick:S,onAddTask:C,onEditTask:w,onDeleteTask:T,onStatusChange:E,onTasksChange:D,onTaskMoved:O,onTaskResized:k,onTaskCreated:A,onTaskUpdated:j,onTaskDeleted:M,height:N,width:P,minPanelWidth:F,maxPanelWidth:I})})})})}var Bt=e=>Math.max(0,Math.min(4,Math.round(e)));function Vt(e,t){let n=e??``,r=n.length,i=/[a-z]/.test(n),a=/[A-Z]/.test(n),o=/\d/.test(n),s=/[^A-Za-z0-9]/.test(n),c=[i,a,o,s].filter(Boolean).length;if(r<t){let e=r===0?0:1;return{score:e,percent:e*25,meterStatus:`weak`,length:r,hasLower:i,hasUpper:a,hasDigit:o,hasSymbol:s}}let l=0;l+=1,r>=t+4&&(l+=1),c>=2&&(l+=1),c>=3&&(l+=1),/^(.)\1+$/.test(n)&&(l-=2),/1234|abcd|qwer|password|passwort|admin/i.test(n)&&(l-=2);let u=Bt(l),d=u<=1?`weak`:u===2?`ok`:u===3?`good`:`very good`;return{score:u,percent:u*25,meterStatus:d,length:r,hasLower:i,hasUpper:a,hasDigit:o,hasSymbol:s}}function Ht({percent:e,color:t,ariaLabel:n}){return(0,m.jsx)(l.Box,{role:`progressbar`,"aria-label":n,"aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,sx:{width:`100%`,height:`8px`,border:`1px solid`,borderColor:`divider`,borderRadius:`6px`,mt:.5,display:`flex`},children:(0,m.jsx)(l.Box,{"data-testid":`psm-meter`,sx:{height:`100%`,width:`${e}%`,backgroundColor:t,borderRadius:`6px`,transition:`width 0.2s ease-in-out`}})})}var Ut={label:`Password`,summaryHeaderLabel:`Requirements for your password`,summaryMinChars:`At least {n} characters`,summaryCapitalLetter:`At least 1 capital letter`,summaryLowerCaseLetter:`At least 1 lowercase letter`,summaryNumber:`At least 1 number`,summarySpecialChar:`At least 1 special character`,showPasswordLabel:`Show password`,hidePasswordLabel:`Hide password`,meterAriaLabel:`Password strength`},Wt={weak:`#cc0000`,ok:`#fdc010`,good:`#8bc34a`,veryGood:`#43a047`},Gt={failure:`#cc0000`,success:`#43a047`};function Kt({label:e,fulfilled:t,checkColors:n}){return(0,m.jsxs)(l.Stack,{direction:`row`,sx:{alignItems:`center`,mb:.25},spacing:.5,children:[(0,m.jsx)(l.Typography,{variant:`caption`,children:e}),t?(0,m.jsx)(p.default,{"data-testid":`psm-req-success`,style:{fontSize:16,color:n.success}}):(0,m.jsx)(f.default,{"data-testid":`psm-req-failure`,style:{fontSize:16,color:n.failure}})]})}function qt({value:e,name:t,inputRef:n,disabled:r=!1,error:i=!1,helperText:a,autoComplete:o,showPasswordAdornment:s=!0,showMeter:u=!0,showSummary:d=!0,inputSize:f=`medium`,translation:p,meterColors:h,passwordMinLength:g=8,checkColors:_=Gt,onPasswordChange:v}){let y={...Ut,...p},b={...Wt,...h},x=`${(0,c.useId)()}-password`,[S,C]=(0,c.useState)(!1),[w,T]=(0,c.useState)(``),E=e===void 0?w:e,D=(0,c.useMemo)(()=>Vt(E,g),[E,g]);return(0,m.jsxs)(l.Stack,{children:[(0,m.jsxs)(l.FormControl,{variant:`outlined`,fullWidth:!0,error:i,children:[(0,m.jsx)(l.InputLabel,{htmlFor:x,size:f,children:y.label}),(0,m.jsx)(l.OutlinedInput,{id:x,type:S?`text`:`password`,fullWidth:!0,size:f,value:E,onChange:t=>{let n=t.target.value;e===void 0&&T(n),v&&v(n,Vt(n,g))},disabled:r,inputRef:n,inputProps:{"data-testid":`psm-input`,name:t,autoComplete:o},endAdornment:s?(0,m.jsx)(l.InputAdornment,{position:`end`,children:(0,m.jsx)(l.IconButton,{"data-testid":`psm-toggle`,disabled:r,"aria-label":S?y.hidePasswordLabel:y.showPasswordLabel,onClick:()=>{C(e=>!e)},onMouseDown:e=>{e.preventDefault()},onMouseUp:e=>{e.preventDefault()},edge:`end`,children:S?(0,m.jsx)(B.default,{}):(0,m.jsx)(z.default,{})})}):null,label:y.label}),a&&(0,m.jsx)(l.FormHelperText,{children:a})]}),u&&(0,m.jsx)(Ht,{percent:D.percent,color:(e=>{switch(e.meterStatus){case`weak`:return b.weak;case`ok`:return b.ok;case`good`:return b.good;case`very good`:return b.veryGood;default:return`transparent`}})(D),ariaLabel:y.meterAriaLabel}),d&&(0,m.jsxs)(l.Box,{"data-testid":`psm-summary`,sx:{mt:.5,p:.5},children:[(0,m.jsx)(l.Typography,{variant:`caption`,gutterBottom:!0,sx:{display:`block`,fontSize:14},children:y.summaryHeaderLabel}),(0,m.jsxs)(l.Stack,{direction:`row`,spacing:6,children:[(0,m.jsxs)(l.Stack,{direction:`column`,children:[(0,m.jsx)(Kt,{label:y.summaryMinChars.replace(`{n}`,String(g)),fulfilled:D.length>=g,checkColors:_}),(0,m.jsx)(Kt,{label:y.summaryCapitalLetter,fulfilled:D.hasUpper,checkColors:_}),(0,m.jsx)(Kt,{label:y.summaryLowerCaseLetter,fulfilled:D.hasLower,checkColors:_})]}),(0,m.jsxs)(l.Stack,{direction:`column`,children:[(0,m.jsx)(Kt,{label:y.summaryNumber,fulfilled:D.hasDigit,checkColors:_}),(0,m.jsx)(Kt,{label:y.summarySpecialChar,fulfilled:D.hasSymbol,checkColors:_})]})]})]})]})}function Jt(e){return(0,A.createStore)(t=>({tags:e,searchValue:``,setTags:e=>{t({tags:e})},setSearchValue:e=>{t({searchValue:e})},selectTag:e=>{t(t=>({tags:t.tags.map(t=>t.id===e&&!t.disabled?{...t,selected:!0}:t),searchValue:``}))},deleteTag:e=>{t(t=>({tags:t.tags.map(t=>t.id===e?{...t,selected:!1}:t)}))},addTag:e=>{t(t=>({tags:[...t.tags,{...e,selected:!0}],searchValue:``}))}}))}var Yt=[`default`,`primary`,`secondary`,`error`,`info`,`success`,`warning`];function Xt({availableTags:e,searchValue:t,translation:n,onSearchChange:r,onTagSelect:i,onTagCreate:a,inputSize:o=`medium`,chipSize:s=`medium`,disabled:u=!1,loading:d=!1,isMaxReached:f=!1,allowCreate:p=!1,listboxMaxHeight:h}){let[g,_]=(0,c.useState)(`default`),[v,y]=(0,c.useState)(!1),b=u||f,x=e.filter(e=>e.label.toLowerCase().includes(t.trim().toLowerCase())),S=p&&t.trim()!==``&&x.length===0,w=v&&!S,T=()=>{a?.(t.trim(),g),_(`default`)},E=()=>{r(``),_(`default`)};return(0,m.jsxs)(l.Box,{sx:{mb:2},children:[(0,m.jsx)(l.Autocomplete,{options:e,value:null,open:w,onOpen:()=>{S||y(!0)},onClose:()=>y(!1),size:o,disabled:b,loading:d,getOptionLabel:e=>e.label,inputValue:t,onInputChange:(e,t)=>{r(t)},onChange:(e,t)=>{t&&i(t)},slotProps:{listbox:{sx:{display:`flex`,flexWrap:`wrap`,gap:1,padding:1,...h!==void 0&&{maxHeight:h,overflowY:`auto`}}}},renderInput:e=>(0,m.jsx)(l.TextField,{...e,label:n.autoCompleteLabel,placeholder:n.placeholder,helperText:f&&!u?n.maxTagsReachedText:void 0,onKeyDown:e=>{S&&e.key===`Enter`&&(e.preventDefault(),T())},slotProps:{...e.slotProps,input:{...e.slotProps?.input,endAdornment:(0,m.jsxs)(m.Fragment,{children:[S&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(l.IconButton,{size:`small`,sx:{color:`success.main`},onMouseDown:e=>{e.preventDefault()},onClick:T,children:(0,m.jsx)(C.default,{fontSize:`small`})}),(0,m.jsx)(l.IconButton,{size:`small`,onMouseDown:e=>{e.preventDefault()},onClick:E,children:(0,m.jsx)(V.default,{fontSize:`small`})})]}),e.slotProps?.input?.endAdornment]})}}}),renderOption:({key:e,...t},n)=>{let r=!!(n.foregroundColor||n.backgroundColor);return(0,m.jsx)(`li`,{...t,style:{width:`auto`,padding:0,margin:0},children:(0,m.jsx)(l.Chip,{size:s,label:n.label,color:r?void 0:n.color??`default`,sx:r?{color:n.foregroundColor??`inherit`,backgroundColor:n.backgroundColor??`transparent`}:void 0})},e)},isOptionEqualToValue:(e,t)=>e.id===t.id,noOptionsText:n.noAvailableTagsText,loadingText:n.loadingText}),S&&(0,m.jsx)(l.Stack,{direction:`row`,sx:{mt:.5,flexWrap:`wrap`,gap:.5,alignItems:`center`},children:Yt.map(e=>(0,m.jsx)(l.Chip,{size:s,color:e,label:e,variant:g===e?`filled`:`outlined`,onClick:()=>_(e),clickable:!0},e))})]})}function Zt({tag:e,onDelete:t,onClick:n,chipSize:r=`medium`,disabled:i=!1}){let a=!!(e.foregroundColor||e.backgroundColor);return(0,m.jsx)(l.Chip,{size:r,label:e.label,onDelete:t?()=>t(e):void 0,onClick:n?()=>n(e):void 0,clickable:!!n&&!e.disabled&&!i,disabled:i||e.disabled,variant:e.selected?`filled`:`outlined`,color:a?void 0:e.color??`default`,sx:{...a&&{color:e.foregroundColor??`inherit`,backgroundColor:e.backgroundColor??`transparent`,borderColor:e.backgroundColor??void 0,"& .MuiChip-deleteIcon":{color:e.foregroundColor?`${e.foregroundColor}99`:`inherit`,"&:hover":{color:e.foregroundColor??`inherit`}}},cursor:n&&!e.disabled&&!i?`pointer`:`default`}})}function Qt({selectedTags:e,translation:t,onTagDelete:n,showSelectedTagsLabel:r,chipSize:i=`medium`,disabled:a=!1,maxVisibleChips:o,popoverPlacement:s=`bottom`}){let[u,d]=(0,c.useState)(null),f=o===void 0?e:e.slice(0,o),p=o===void 0?[]:e.slice(o),h=!!u&&p.length>0,g=s===`top`?{vertical:`top`,horizontal:`left`}:{vertical:`bottom`,horizontal:`left`},_=s===`top`?{vertical:`bottom`,horizontal:`left`}:{vertical:`top`,horizontal:`left`};return(0,m.jsxs)(l.Box,{sx:{mb:2},children:[r&&(0,m.jsx)(l.Typography,{variant:`subtitle2`,gutterBottom:!0,children:t.selectedTagsLabel}),e.length===0?(0,m.jsx)(l.Typography,{variant:`body2`,color:`text.secondary`,children:t.noSelectedTagsText}):(0,m.jsxs)(l.Stack,{direction:`row`,sx:{flexWrap:`wrap`,gap:1},children:[f.map(e=>(0,m.jsx)(Zt,{tag:e,onDelete:n,chipSize:i,disabled:a},e.id)),p.length>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(l.Chip,{size:i,label:`+${p.length}`,variant:`outlined`,clickable:!0,onClick:e=>d(e.currentTarget)}),(0,m.jsx)(l.Popover,{open:h,anchorEl:u,onClose:()=>d(null),anchorOrigin:g,transformOrigin:_,children:(0,m.jsx)(l.Box,{sx:{p:1,display:`flex`,flexWrap:`wrap`,gap:.5,maxWidth:320},children:p.map(e=>(0,m.jsx)(Zt,{tag:e,onDelete:a?void 0:n,chipSize:i,disabled:a},e.id))})})]})]})]})}var $t={selectedTagsLabel:`Selected tags`,autoCompleteLabel:`Search and add tags`,noSelectedTagsText:`No tags selected.`,noAvailableTagsText:`No tags available.`,placeholder:`Type to search...`,loadingText:`Loading...`,maxTagsReachedText:`Maximum number of tags reached.`},en=(0,c.createContext)(null);function $(e){let t=(0,c.useContext)(en);if(!t)throw Error(`TagSelectionStoreContext is missing.`);return(0,k.useStore)(t,e)}function tn({tags:e,showSelectedTags:t=!0,showSelectedTagsLabel:n=!0,showAutoComplete:r=!0,inputSize:i=`medium`,chipSize:a=`small`,disabled:o=!1,loading:s=!1,maxTags:u,allowCreate:d=!1,maxVisibleChips:f,popoverPlacement:p=`bottom`,listboxMaxHeight:h,translation:g,onTagSelect:_,onTagDelete:v,onTagsChange:y,onSearchChange:b,onTagCreate:x}){let S=$(e=>e.tags),C=$(e=>e.searchValue),w=$(e=>e.setTags),T=$(e=>e.setSearchValue),E=$(e=>e.selectTag),D=$(e=>e.deleteTag),O=$(e=>e.addTag);(0,c.useEffect)(()=>{w(e)},[e,w]);let k=(0,c.useMemo)(()=>S.filter(e=>e.selected).sort((e,t)=>e.label.localeCompare(t.label)),[S]),A=(0,c.useMemo)(()=>S.filter(e=>!e.selected&&!e.disabled).sort((e,t)=>e.label.localeCompare(t.label)),[S]),j=u!==void 0&&k.length>=u,M=e=>{y&&y(e.filter(e=>e.selected),e)};return(0,m.jsx)(l.Box,{sx:{width:`100%`},children:(0,m.jsxs)(l.Stack,{children:[t&&(0,m.jsx)(Qt,{selectedTags:k,translation:g,onTagDelete:e=>{D(e.id);let t=S.map(t=>t.id===e.id?{...t,selected:!1}:t),n=t.filter(e=>e.selected),r=t.find(t=>t.id===e.id);r&&v&&v(r,n,t),M(t)},showSelectedTagsLabel:n,chipSize:a,disabled:o,maxVisibleChips:f,popoverPlacement:p}),r&&(0,m.jsx)(Xt,{availableTags:A,searchValue:C,translation:g,onSearchChange:e=>{T(e),b&&b(e)},onTagSelect:e=>{if(e.disabled||e.selected)return;E(e.id);let t=S.map(t=>t.id===e.id?{...t,selected:!0}:t),n=t.filter(e=>e.selected),r=t.find(t=>t.id===e.id);r&&_&&_(r,n,t),M(t)},onTagCreate:(e,t)=>{let n={id:e.toLowerCase().replace(/\s+/g,`-`),label:e,color:t,selected:!0};O(n);let r=[...S,n],i=r.filter(e=>e.selected);_&&_(n,i,r),M(r),x&&x(e,t)},inputSize:i,chipSize:a,disabled:o,loading:s,isMaxReached:j,allowCreate:d,listboxMaxHeight:h})]})})}function nn({tags:e,showSelectedTags:t=!0,showSelectedTagsLabel:n=!0,showAutoComplete:r=!0,translation:i,inputSize:a=`medium`,chipSize:o=`small`,disabled:s=!1,loading:l=!1,maxTags:u,allowCreate:d=!1,maxVisibleChips:f,popoverPlacement:p=`bottom`,listboxMaxHeight:h,onTagSelect:g,onTagDelete:_,onTagsChange:v,onSearchChange:y,onTagCreate:b}){let x={...$t,...i},[S]=(0,c.useState)(()=>Jt(e));return(0,m.jsx)(en.Provider,{value:S,children:(0,m.jsx)(tn,{tags:e,showSelectedTags:t,showSelectedTagsLabel:n,showAutoComplete:r,translation:x,inputSize:a,chipSize:o,disabled:s,loading:l,maxTags:u,allowCreate:d,maxVisibleChips:f,popoverPlacement:p,listboxMaxHeight:h,onTagSelect:g,onTagDelete:_,onTagsChange:v,onSearchChange:y,onTagCreate:b})})}var rn={showBold:!0,showItalic:!0,showUnderline:!0,showStrike:!0,showHeading1:!0,showHeading2:!0,showHeading3:!0,showBulletList:!0,showOrderedList:!0,showBlockquote:!0,showCodeBlock:!0,showLink:!0,showHorizontalRule:!0,showTextColor:!0,showHighlight:!0,showUndoRedo:!0,showClearFormat:!0},an={bold:`Bold`,italic:`Italic`,underline:`Underline`,strike:`Strikethrough`,heading1:`Heading 1`,heading2:`Heading 2`,heading3:`Heading 3`,bulletList:`Bullet list`,orderedList:`Numbered list`,blockquote:`Blockquote`,codeBlock:`Code block`,link:`Insert link`,horizontalRule:`Horizontal rule`,textColor:`Text color`,removeTextColor:`Remove text color`,highlight:`Highlight`,removeHighlight:`Remove highlight`,undo:`Undo`,redo:`Redo`,clearFormat:`Clear formatting`,linkDialogTitle:`Insert link`,linkDialogUrlLabel:`URL`,linkDialogSave:`Save`,linkDialogCancel:`Cancel`,linkDialogRemove:`Remove link`,characterCount:`{count} characters`,characterCountMax:`{count} / {max} characters`};function on({editor:e,error:t,disabled:n,readonly:r}){return(0,m.jsx)(l.Box,{sx:{flex:1,minHeight:0,display:`flex`,flexDirection:`column`,px:1.5,py:1,cursor:n||r?`default`:`text`,opacity:n?.5:1,"& > div":{flex:1,display:`flex`,flexDirection:`column`,minHeight:0},"& .ProseMirror":{flex:1,minHeight:0,overflowY:`auto`,overflowX:`hidden`,wordBreak:`break-word`,overflowWrap:`break-word`,outline:`none`,"& p.is-editor-empty:first-of-type::before":{content:`attr(data-placeholder)`,color:`text.disabled`,pointerEvents:`none`,float:`left`,height:0},"& h1":{typography:`h4`,mb:1},"& h2":{typography:`h5`,mb:1},"& h3":{typography:`h6`,mb:1},"& p":{my:.5},"& ul, & ol":{pl:3},"& blockquote":{borderLeft:`4px solid`,borderColor:t?`error.main`:`divider`,pl:2,color:`text.secondary`,my:1},"& code":{bgcolor:`action.hover`,px:.5,borderRadius:.5,fontFamily:`monospace`,fontSize:`0.875em`},"& pre":{bgcolor:`action.hover`,p:1.5,borderRadius:1,overflowX:`auto`,"& code":{bgcolor:`transparent`,px:0}},"& a":{color:`primary.main`,cursor:`pointer`},"& mark":{borderRadius:.5,px:.25},"& hr":{borderColor:`divider`,my:2}}},children:(0,m.jsx)(H.EditorContent,{editor:e})})}function sn({open:e,onClose:t,editor:n,translation:r}){let[i,a]=(0,c.useState)(``);(0,c.useEffect)(()=>{if(e){let e=n.getAttributes(`link`).href;a(e??``)}},[e,n]);let o=n.isActive(`link`);function s(){i.trim()?n.chain().focus().extendMarkRange(`link`).setLink({href:i.trim()}).run():n.chain().focus().extendMarkRange(`link`).unsetLink().run(),t()}function u(){n.chain().focus().extendMarkRange(`link`).unsetLink().run(),t()}function d(e){e.key===`Enter`&&s()}return(0,m.jsxs)(l.Dialog,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,m.jsx)(l.DialogTitle,{children:r.linkDialogTitle}),(0,m.jsx)(l.DialogContent,{children:(0,m.jsx)(l.TextField,{autoFocus:!0,fullWidth:!0,label:r.linkDialogUrlLabel,value:i,onChange:e=>a(e.target.value),onKeyDown:d,variant:`outlined`,size:`small`,sx:{mt:1},placeholder:`https://`})}),(0,m.jsxs)(l.DialogActions,{sx:{px:3,pb:2,gap:1},children:[o&&(0,m.jsx)(l.Button,{onClick:u,color:`error`,sx:{mr:`auto`},children:r.linkDialogRemove}),(0,m.jsx)(l.Button,{onClick:t,children:r.linkDialogCancel}),(0,m.jsx)(l.Button,{onClick:s,variant:`contained`,children:r.linkDialogSave})]})]})}var cn=[`#000000`,`#434343`,`#666666`,`#999999`,`#b7b7b7`,`#ffffff`,`#ff0000`,`#ff4500`,`#ff8c00`,`#ffd700`,`#9acd32`,`#008000`,`#00ced1`,`#1e90ff`,`#0000ff`,`#8a2be2`,`#ff1493`,`#a52a2a`],ln=[`#ffff00`,`#ffd700`,`#ffa500`,`#ff69b4`,`#ff6347`,`#fa8072`,`#adff2f`,`#90ee90`,`#00fa9a`,`#00ffff`,`#87ceeb`,`#add8e6`,`#dda0dd`,`#ee82ee`,`#d2b48c`,`#f5f5dc`,`#ffffff`,`#000000`];function un({color:e,active:t,onClick:n}){return(0,m.jsx)(l.Tooltip,{title:e,placement:`top`,arrow:!0,children:(0,m.jsx)(l.Box,{component:`button`,type:`button`,onClick:()=>n(e),sx:{width:22,height:22,bgcolor:e,border:t?`2px solid`:`1px solid`,borderColor:t?`primary.main`:e===`#ffffff`||e===`#f5f5dc`?`divider`:`transparent`,borderRadius:.5,cursor:`pointer`,p:0,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`transform 0.1s`,"&:hover":{transform:`scale(1.2)`,zIndex:1}},children:t&&(0,m.jsx)(l.Box,{component:`span`,sx:{width:10,height:6,borderLeft:`2px solid`,borderBottom:`2px solid`,borderColor:e===`#ffffff`||e===`#f5f5dc`||e===`#ffd700`||e===`#ffff00`||e===`#adff2f`||e===`#ffa500`||e===`#b7b7b7`||e===`#d2b48c`?`#000`:`#fff`,transform:`rotate(-45deg) translateY(-1px)`,display:`block`}})})})}function dn({anchorEl:e,open:t,onClose:n,mode:r,activeColor:i,onSelectColor:a,onRemoveColor:o,removeLabel:s}){let u=(0,c.useRef)(null),d=r===`highlight`?ln:cn;function f(e){a(e.target.value)}return(0,m.jsxs)(l.Popover,{open:t,anchorEl:e,onClose:n,anchorOrigin:{vertical:`bottom`,horizontal:`left`},transformOrigin:{vertical:`top`,horizontal:`left`},slotProps:{paper:{sx:{p:1.5}}},children:[(0,m.jsx)(l.Box,{sx:{display:`grid`,gridTemplateColumns:`repeat(6, 22px)`,gap:.5,mb:1},children:d.map(e=>(0,m.jsx)(un,{color:e,active:i?.toLowerCase()===e.toLowerCase(),onClick:e=>{a(e),n()}},e))}),(0,m.jsxs)(l.Box,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,m.jsx)(l.Tooltip,{title:`Custom color`,arrow:!0,children:(0,m.jsx)(l.Box,{component:`button`,type:`button`,onClick:()=>u.current?.click(),sx:{width:22,height:22,background:`conic-gradient(red, yellow, lime, cyan, blue, magenta, red)`,border:`1px solid`,borderColor:`divider`,borderRadius:.5,cursor:`pointer`,p:0,flexShrink:0,"&:hover":{transform:`scale(1.2)`},transition:`transform 0.1s`}})}),(0,m.jsx)(`input`,{ref:u,type:`color`,defaultValue:i??`#000000`,onChange:f,onBlur:n,style:{visibility:`hidden`,width:0,height:0,position:`absolute`}}),(0,m.jsx)(l.Tooltip,{title:s,arrow:!0,children:(0,m.jsx)(l.IconButton,{size:`small`,onClick:()=>{o(),n()},sx:{borderRadius:1,ml:`auto`},children:(0,m.jsx)(_e.default,{fontSize:`small`})})})]})]})}function fn({label:e,icon:t,activeColor:n,disabled:r,onClick:i}){return(0,m.jsx)(l.Tooltip,{title:e,arrow:!0,children:(0,m.jsx)(`span`,{children:(0,m.jsxs)(l.IconButton,{size:`small`,onMouseDown:e=>e.preventDefault(),onClick:i,disabled:r,sx:{borderRadius:1,flexDirection:`column`,gap:0,pb:.25},"aria-label":e,children:[(0,m.jsx)(l.Box,{sx:{display:`flex`,alignItems:`center`},children:t}),(0,m.jsx)(l.Box,{sx:{width:`80%`,height:3,bgcolor:n??`text.primary`,borderRadius:.5,mt:`1px`}})]})})})}function pn({level:e}){return(0,m.jsxs)(l.Box,{component:`span`,sx:{fontWeight:`bold`,fontSize:`0.875rem`,lineHeight:1},children:[`H`,e]})}function mn({editor:e,toolbarConfig:t,translation:n,disabled:r}){let[i,a]=(0,c.useState)(!1),[o,s]=(0,c.useState)(null),[u,d]=(0,c.useState)(null),f=r||!e,p=e?.getAttributes(`textStyle`)?.color,h=e?.getAttributes(`highlight`)?.color,g=t.showBold||t.showItalic||t.showUnderline||t.showStrike,_=t.showHeading1||t.showHeading2||t.showHeading3,v=t.showBulletList||t.showOrderedList,y=t.showBlockquote||t.showCodeBlock||t.showLink||t.showHorizontalRule,b=t.showTextColor||t.showHighlight,x=t.showUndoRedo||t.showClearFormat,S=[g,_,v,y,b,x],C=S.filter(Boolean).length;function w(e,t){return!e||S.slice(t+1).findIndex(Boolean)===-1?null:(0,m.jsx)(l.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}},`div-${t}`)}return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(l.Box,{sx:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:.25,px:1,py:.5},role:`toolbar`,"aria-label":`Text formatting`,children:[g&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[t.showBold&&(0,m.jsx)(q,{label:n.bold,icon:(0,m.jsx)(ie.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleBold().run(),active:e?.isActive(`bold`),disabled:f}),t.showItalic&&(0,m.jsx)(q,{label:n.italic,icon:(0,m.jsx)(ae.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleItalic().run(),active:e?.isActive(`italic`),disabled:f}),t.showUnderline&&(0,m.jsx)(q,{label:n.underline,icon:(0,m.jsx)(oe.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleUnderline().run(),active:e?.isActive(`underline`),disabled:f}),t.showStrike&&(0,m.jsx)(q,{label:n.strike,icon:(0,m.jsx)(se.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleStrike().run(),active:e?.isActive(`strike`),disabled:f})]}),w(g,0),_&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[t.showHeading1&&(0,m.jsx)(q,{label:n.heading1,icon:(0,m.jsx)(pn,{level:1}),onClick:()=>e?.chain().focus().toggleHeading({level:1}).run(),active:e?.isActive(`heading`,{level:1}),disabled:f}),t.showHeading2&&(0,m.jsx)(q,{label:n.heading2,icon:(0,m.jsx)(pn,{level:2}),onClick:()=>e?.chain().focus().toggleHeading({level:2}).run(),active:e?.isActive(`heading`,{level:2}),disabled:f}),t.showHeading3&&(0,m.jsx)(q,{label:n.heading3,icon:(0,m.jsx)(pn,{level:3}),onClick:()=>e?.chain().focus().toggleHeading({level:3}).run(),active:e?.isActive(`heading`,{level:3}),disabled:f})]}),w(_,1),v&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[t.showBulletList&&(0,m.jsx)(q,{label:n.bulletList,icon:(0,m.jsx)(ce.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleBulletList().run(),active:e?.isActive(`bulletList`),disabled:f}),t.showOrderedList&&(0,m.jsx)(q,{label:n.orderedList,icon:(0,m.jsx)(le.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleOrderedList().run(),active:e?.isActive(`orderedList`),disabled:f})]}),w(v,2),y&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[t.showBlockquote&&(0,m.jsx)(q,{label:n.blockquote,icon:(0,m.jsx)(ue.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleBlockquote().run(),active:e?.isActive(`blockquote`),disabled:f}),t.showCodeBlock&&(0,m.jsx)(q,{label:n.codeBlock,icon:(0,m.jsx)(de.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().toggleCodeBlock().run(),active:e?.isActive(`codeBlock`),disabled:f}),t.showLink&&(0,m.jsx)(q,{label:n.link,icon:(0,m.jsx)(fe.default,{fontSize:`small`}),onClick:()=>a(!0),active:e?.isActive(`link`),disabled:f}),t.showHorizontalRule&&(0,m.jsx)(q,{label:n.horizontalRule,icon:(0,m.jsx)(pe.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().setHorizontalRule().run(),disabled:f})]}),w(y,3),b&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[t.showTextColor&&(0,m.jsx)(fn,{label:n.textColor,icon:(0,m.jsx)(me.default,{fontSize:`small`}),activeColor:p,disabled:f,onClick:e=>s(e.currentTarget)}),t.showHighlight&&(0,m.jsx)(fn,{label:n.highlight,icon:(0,m.jsx)(he.default,{fontSize:`small`}),activeColor:h,disabled:f,onClick:e=>d(e.currentTarget)})]}),w(b,4),x&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[t.showUndoRedo&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(q,{label:n.undo,icon:(0,m.jsx)(T.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().undo().run(),disabled:f||!e?.can().undo()}),(0,m.jsx)(q,{label:n.redo,icon:(0,m.jsx)(E.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().redo().run(),disabled:f||!e?.can().redo()})]}),t.showClearFormat&&(0,m.jsx)(q,{label:n.clearFormat,icon:(0,m.jsx)(ge.default,{fontSize:`small`}),onClick:()=>e?.chain().focus().clearNodes().unsetAllMarks().run(),disabled:f})]}),C===0&&(0,m.jsx)(l.Box,{sx:{height:32}})]}),t.showLink&&e&&(0,m.jsx)(sn,{open:i,onClose:()=>a(!1),editor:e,translation:n}),t.showTextColor&&(0,m.jsx)(dn,{anchorEl:o,open:!!o,onClose:()=>s(null),mode:`textColor`,activeColor:p,onSelectColor:t=>e?.chain().focus().setColor(t).run(),onRemoveColor:()=>e?.chain().focus().unsetColor().run(),removeLabel:n.removeTextColor}),t.showHighlight&&(0,m.jsx)(dn,{anchorEl:u,open:!!u,onClose:()=>d(null),mode:`highlight`,activeColor:h,onSelectColor:t=>e?.chain().focus().setHighlight({color:t}).run(),onRemoveColor:()=>e?.chain().focus().unsetHighlight().run(),removeLabel:n.removeHighlight})]})}function hn({helperText:e,error:t,showCharacterCount:n,charCount:r,maxCharacters:i,translation:a}){let o=i===void 0?a.characterCount.replace(`{count}`,String(r)):a.characterCountMax.replace(`{count}`,String(r)).replace(`{max}`,String(i));return(0,m.jsxs)(l.Box,{sx:{display:`flex`,justifyContent:`space-between`,mt:.5,px:.5},children:[(0,m.jsx)(l.FormHelperText,{error:t,children:e??``}),n&&(0,m.jsx)(l.FormHelperText,{sx:{color:i!==void 0&&r>=i?`error`:`text.secondary`},children:o})]})}function gn({value:e,onChange:t,placeholder:n,outputFormat:r=`html`,height:i,width:a,showCharacterCount:o=!1,maxCharacters:s,toolbarConfig:u,disabled:d=!1,readonly:f=!1,name:p,error:h=!1,helperText:g,translation:_,onBlur:v,onFocus:y}){let b={...an,..._},x={...rn,...u},S=J(i),C=J(a),w=S===`auto`,T=w?void 0:S??200,E=(0,H.useEditor)({shouldRerenderOnTransaction:!0,extensions:[U.StarterKit.configure({link:{openOnClick:!1}}),W.TextStyle,G.Color,ee.Highlight.configure({multicolor:!0}),re.Markdown.configure({transformPastedText:!0,transformCopiedText:!1}),te.Placeholder.configure({placeholder:n??``}),...s!==void 0&&s>0?[ne.CharacterCount.configure({limit:s})]:o?[ne.CharacterCount]:[]],content:e??``,editable:!d&&!f,onUpdate({editor:e}){t&&t(r===`json`?JSON.stringify(e.getJSON()):e.getHTML())},onBlur(){v?.()},onFocus(){y?.()}});(0,c.useEffect)(()=>{!E||e===void 0||(r===`json`?JSON.stringify(E.getJSON()):E.getHTML())!==e&&E.commands.setContent(e,{emitUpdate:!1})},[E,e,r]),(0,c.useEffect)(()=>{E&&E.setEditable(!d&&!f)},[E,d,f]);let D=E?.storage.characterCount?.characters?.()??0,O=o||s!==void 0&&s>0||!!g;return(0,m.jsxs)(l.Box,{sx:{width:C??`100%`,...w?{display:`flex`,flexDirection:`column`,flex:1}:{}},children:[(0,m.jsxs)(l.Paper,{variant:`outlined`,sx:{display:`flex`,flexDirection:`column`,overflow:`hidden`,...w?{flex:1}:{height:T},borderColor:h?`error.main`:void 0,"&:focus-within":{borderColor:h?`error.main`:`primary.main`,borderWidth:2}},children:[!f&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(mn,{editor:E,toolbarConfig:x,translation:b,disabled:d}),(0,m.jsx)(l.Divider,{})]}),(0,m.jsx)(on,{editor:E,error:h,disabled:d,readonly:f})]}),O&&(0,m.jsx)(hn,{helperText:g,error:h,showCharacterCount:o||s!==void 0&&s>0,charCount:D,maxCharacters:s&&s>0?s:void 0,translation:b}),p&&(0,m.jsx)(`input`,{type:`hidden`,name:p,value:E?r===`json`?JSON.stringify(E.getJSON()):E.getHTML():``})]})}var _n={showFormat:!0,showCopy:!0,showClear:!0,showExecute:!1,showUndoRedo:!0},vn={format:`Format SQL`,copy:`Copy`,copySuccess:`Copied!`,clear:`Clear`,execute:`Execute`,undo:`Undo`,redo:`Redo`,lineColumn:`Ln {line}, Col {col}`,errorCount:`{count} error(s)`},yn={standard:K.StandardSQL,mysql:K.MySQL,postgresql:K.PostgreSQL,sqlite:K.SQLite,mssql:K.MSSQL};function bn({value:e,onChange:t,placeholder:n,disabled:r=!1,readonly:i=!1,showLineNumbers:a=!0,dialect:o=`standard`,keywordColor:s,stringColor:u,identifierColor:d,schema:f,onLint:p,onDiagnosticsChange:_,onViewReady:S,onCursorChange:C,onBlur:w,onFocus:T}){let E=(0,c.useRef)(null),D=(0,c.useRef)(null),O=(0,c.useRef)(t),k=(0,c.useRef)(C),A=(0,c.useRef)(w),j=(0,c.useRef)(T),M=(0,c.useRef)(S),N=(0,c.useRef)(p),P=(0,c.useRef)(_),F=(0,c.useRef)(new g.Compartment),I=(0,c.useRef)(new g.Compartment),L=(0,l.useTheme)(),R=L.palette.mode===`dark`,z=!!p,B=JSON.stringify(f);return(0,c.useEffect)(()=>{O.current=t},[t]),(0,c.useEffect)(()=>{k.current=C},[C]),(0,c.useEffect)(()=>{A.current=w},[w]),(0,c.useEffect)(()=>{j.current=T},[T]),(0,c.useEffect)(()=>{M.current=S},[S]),(0,c.useEffect)(()=>{N.current=p},[p]),(0,c.useEffect)(()=>{P.current=_},[_]),(0,c.useEffect)(()=>{if(!E.current)return;let t=D.current?.state.doc.toString()??e??``,c=s??L.palette.primary.main,l=u??L.palette.success.main,p=d??L.palette.info.main,m=y.HighlightStyle.define([{tag:x.tags.keyword,color:c,fontWeight:`bold`},{tag:x.tags.name,color:p},{tag:[x.tags.string,x.tags.special(x.tags.string)],color:l,fontWeight:`bold`},{tag:x.tags.number,color:L.palette.warning.main},{tag:[x.tags.lineComment,x.tags.blockComment],color:L.palette.text.disabled,fontStyle:`italic`},{tag:x.tags.operator,color:L.palette.text.secondary},{tag:[x.tags.function(x.tags.variableName),x.tags.function(x.tags.name)],color:L.palette.secondary.main},{tag:x.tags.typeName,color:L.palette.info.main},{tag:x.tags.invalid,color:L.palette.error.main,textDecoration:`underline wavy`}]),_=h.EditorView.theme({"&":{height:`100%`,fontFamily:`'Fira Code', 'JetBrains Mono', 'Consolas', monospace`,fontSize:`0.875rem`},".cm-scroller":{overflow:`auto`},".cm-content":{padding:`8px 4px`,caretColor:L.palette.text.primary},".cm-gutters":{backgroundColor:R?L.palette.grey[900]:L.palette.grey[50],color:L.palette.text.disabled,border:`none`,borderRight:`1px solid ${L.palette.divider}`},".cm-lineNumbers .cm-gutterElement":{minWidth:`36px`,paddingLeft:`4px`},".cm-activeLineGutter":{backgroundColor:L.palette.action.selected},".cm-activeLine":{backgroundColor:L.palette.action.hover},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{backgroundColor:L.palette.primary.main+`40`},".cm-cursor, .cm-dropCursor":{borderLeftColor:L.palette.text.primary},"&.cm-focused":{outline:`none`},".cm-placeholder":{color:L.palette.text.disabled,fontStyle:`italic`},".cm-tooltip":{backgroundColor:L.palette.background.paper,border:`1px solid ${L.palette.divider}`,borderRadius:`4px`,boxShadow:L.shadows[4]},".cm-tooltip-autocomplete > ul > li":{color:L.palette.text.primary},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:L.palette.primary.main+`20`,color:L.palette.primary.main},".cm-completionMatchedText":{color:L.palette.primary.main,textDecoration:`none`,fontWeight:`bold`},".cm-completionDetail":{color:L.palette.text.secondary,fontStyle:`italic`},".cm-gutter-lint":{width:`16px`},".cm-lint-marker-error":{color:L.palette.error.main},".cm-lint-marker-warning":{color:L.palette.warning.main},".cm-tooltip.cm-tooltip-lint":{backgroundColor:L.palette.background.paper,border:`1px solid ${L.palette.divider}`,borderRadius:`4px`},".cm-diagnostic-error":{borderLeft:`3px solid ${L.palette.error.main}`},".cm-diagnostic-warning":{borderLeft:`3px solid ${L.palette.warning.main}`},".cm-diagnostic-info":{borderLeft:`3px solid ${L.palette.info.main}`}},{dark:R}),S=f?Object.fromEntries(f.tables.map(e=>[e.name,(e.columns??[]).map(e=>({label:e.name,detail:e.type,type:`property`}))])):void 0,C=async e=>{let t=N.current;if(!t)return[];let n=e.state.doc.toString();try{let r=(await t(n)).map(t=>{let n=Math.max(1,Math.min(t.line,e.state.doc.lines)),r=e.state.doc.line(n);return{from:r.from+Math.max(0,(t.col??1)-1),to:r.to,severity:t.severity??`error`,message:t.message}});return P.current?.(r.length),r}catch{return[]}},w=[_,(0,y.syntaxHighlighting)(m),(0,K.sql)({dialect:yn[o],schema:S}),(0,v.history)(),(0,ve.autocompletion)(),h.keymap.of([...v.defaultKeymap,...v.historyKeymap,...ve.completionKeymap]),F.current.of(h.EditorView.editable.of(!r&&!i)),I.current.of(g.EditorState.readOnly.of(i)),(0,h.highlightActiveLine)(),...a?[(0,h.lineNumbers)(),(0,h.highlightActiveLineGutter)()]:[],...n?[(0,h.placeholder)(n)]:[],...z?[(0,b.lintGutter)(),(0,b.linter)(C,{delay:600})]:[],h.EditorView.updateListener.of(e=>{e.docChanged&&O.current?.(e.state.doc.toString());let t=e.state.selection.main.head,n=e.state.doc.lineAt(t);k.current(n.number,t-n.from+1)}),h.EditorView.domEventHandlers({blur:()=>{A.current?.()},focus:()=>{j.current?.()}})],T=new h.EditorView({state:g.EditorState.create({doc:t,extensions:w}),parent:E.current});return D.current=T,M.current(T),()=>{M.current(null),T.destroy(),D.current=null}},[R,o,z,s,u,d,B]),(0,c.useEffect)(()=>{let t=D.current;if(!t)return;let n=t.state.doc.toString();n!==(e??``)&&t.dispatch({changes:{from:0,to:n.length,insert:e??``}})},[e]),(0,c.useEffect)(()=>{D.current?.dispatch({effects:[F.current.reconfigure(h.EditorView.editable.of(!r&&!i)),I.current.reconfigure(g.EditorState.readOnly.of(i))]})},[r,i]),(0,m.jsx)(l.Box,{ref:E,sx:{flex:1,overflow:`hidden`,display:`flex`,flexDirection:`column`,opacity:r?.5:1,backgroundColor:L.palette.background.paper,"& .cm-editor":{flex:1,display:`flex`,flexDirection:`column`}}})}var xn={standard:`sql`,mysql:`mysql`,postgresql:`postgresql`,sqlite:`sqlite`,mssql:`tsql`};function Sn({viewRef:e,toolbarConfig:t,translation:n,dialect:r,disabled:i,onExecute:a}){let[o,s]=(0,c.useState)(!1),u=i||!e.current;function d(){let t=e.current?.state.doc.toString()??``;navigator.clipboard.writeText(t).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})}function f(){let t=e.current;t&&(t.dispatch({changes:{from:0,to:t.state.doc.length,insert:``}}),t.focus())}function p(){let t=e.current;t&&((0,v.undo)(t),t.focus())}function h(){let t=e.current;t&&((0,v.redo)(t),t.focus())}function g(){let t=e.current;if(!t)return;let n=t.state.doc.toString();try{let e=(0,be.format)(n,{language:xn[r]});t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})}catch{}t.focus()}function _(){let t=e.current;!t||!a||a(t.state.doc.toString())}let y=t.showFormat,b=t.showCopy||t.showClear,x=t.showUndoRedo,O=t.showExecute&&!!a;return(0,m.jsxs)(l.Box,{sx:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:.25,px:1,py:.5},role:`toolbar`,"aria-label":`SQL editor actions`,children:[y&&(0,m.jsx)(l.Box,{sx:{display:`flex`,gap:.25},children:(0,m.jsx)(q,{label:n.format,icon:(0,m.jsx)(D.default,{fontSize:`small`}),onClick:g,disabled:u})}),y&&(b||x)&&(0,m.jsx)(l.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}}),b&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[t.showCopy&&(0,m.jsx)(q,{label:o?n.copySuccess:n.copy,icon:o?(0,m.jsx)(C.default,{fontSize:`small`,color:`success`}):(0,m.jsx)(S.default,{fontSize:`small`}),onClick:d,disabled:u}),t.showClear&&(0,m.jsx)(q,{label:n.clear,icon:(0,m.jsx)(w.default,{fontSize:`small`}),onClick:f,disabled:u})]}),b&&x&&(0,m.jsx)(l.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}}),x&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,gap:.25},children:[(0,m.jsx)(q,{label:n.undo,icon:(0,m.jsx)(T.default,{fontSize:`small`}),onClick:p,disabled:u}),(0,m.jsx)(q,{label:n.redo,icon:(0,m.jsx)(E.default,{fontSize:`small`}),onClick:h,disabled:u})]}),O&&(0,m.jsxs)(m.Fragment,{children:[(b||x)&&(0,m.jsx)(l.Divider,{orientation:`vertical`,flexItem:!0,sx:{mx:.5}}),(0,m.jsx)(q,{label:n.execute,icon:(0,m.jsx)(ye.default,{fontSize:`small`}),onClick:_,disabled:u})]}),!y&&!b&&!x&&!O&&(0,m.jsx)(l.Box,{sx:{height:32}})]})}function Cn({helperText:e,error:t,showLineColumn:n,showErrorCount:r,diagnosticsCount:i,cursorLine:a,cursorCol:o,translation:s}){let c=s.lineColumn.replace(`{line}`,String(a)).replace(`{col}`,String(o)),u=s.errorCount.replace(`{count}`,String(i));return(0,m.jsxs)(l.Box,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,mt:.5,px:.5},children:[(0,m.jsxs)(l.Box,{children:[r&&i>0&&(0,m.jsxs)(l.Box,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,m.jsx)(xe.default,{sx:{fontSize:`0.875rem`,color:`error.main`}}),(0,m.jsx)(l.FormHelperText,{sx:{color:`error.main`,m:0},children:u})]}),(0,m.jsx)(l.FormHelperText,{error:t,children:e??``})]}),n&&(0,m.jsx)(l.FormHelperText,{sx:{color:`text.disabled`,fontFamily:`monospace`,whiteSpace:`nowrap`},children:c})]})}function wn({value:e,onChange:t,placeholder:n,height:r,width:i,disabled:a=!1,readonly:o=!1,error:s=!1,helperText:u,name:d,dialect:f=`standard`,showLineNumbers:p=!0,showLineColumn:h=!0,showErrorCount:g=!1,toolbarConfig:_,translation:v,highlightColors:y,schema:b,onExecute:x,onLint:S,onBlur:C,onFocus:w}){let T={...vn,...v},E={..._n,..._},D=J(r),O=J(i),k=D===`auto`,A=k?void 0:D??300,j=(0,c.useRef)(null),[M,N]=(0,c.useState)({line:1,col:1}),[P,F]=(0,c.useState)(0),I=(0,c.useCallback)(e=>{j.current=e},[]),L=(0,c.useCallback)((e,t)=>{N({line:e,col:t})},[]),R=(0,c.useCallback)(e=>{F(e)},[]),z=h||g||!!u;return(0,m.jsxs)(l.Box,{sx:{width:O??`100%`,...k?{display:`flex`,flexDirection:`column`,flex:1}:{}},children:[(0,m.jsxs)(l.Paper,{variant:`outlined`,sx:{display:`flex`,flexDirection:`column`,overflow:`hidden`,...k?{flex:1}:{height:A},borderColor:s?`error.main`:void 0,"&:focus-within":{borderColor:s?`error.main`:`primary.main`,borderWidth:2}},children:[!o&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Sn,{viewRef:j,toolbarConfig:E,translation:T,dialect:f,disabled:a,onExecute:x}),(0,m.jsx)(l.Divider,{})]}),(0,m.jsx)(bn,{value:e,onChange:t,placeholder:n,disabled:a,readonly:o,showLineNumbers:p,dialect:f,keywordColor:y?.keyword,stringColor:y?.string,identifierColor:y?.identifier,schema:b,onLint:S,onDiagnosticsChange:S?R:void 0,onViewReady:I,onCursorChange:L,onBlur:C,onFocus:w})]}),z&&(0,m.jsx)(Cn,{helperText:u,error:s,showLineColumn:h,showErrorCount:g,diagnosticsCount:P,cursorLine:M.line,cursorCol:M.col,translation:T}),d&&(0,m.jsx)(`input`,{type:`hidden`,name:d,value:e??``})]})}exports.ConfirmDialogProvider=De,exports.DEFAULT_CHECK_COLORS=Gt,exports.DEFAULT_CONFIRM_DIALOG_TRANSLATION=Se,exports.DEFAULT_GANTT_TRANSLATIONS=nt,exports.DEFAULT_JSON_EDITOR_TOOLBAR_CONFIG=ke,exports.DEFAULT_JSON_EDITOR_TRANSLATION=Ae,exports.DEFAULT_METER_COLORS=Wt,exports.DEFAULT_PASSWORD_TRANSLATIONS=Ut,exports.DEFAULT_RICH_TEXT_EDITOR_TOOLBAR_CONFIG=rn,exports.DEFAULT_RICH_TEXT_EDITOR_TRANSLATION=an,exports.DEFAULT_SQL_EDITOR_TOOLBAR_CONFIG=_n,exports.DEFAULT_SQL_EDITOR_TRANSLATION=vn,exports.DEFAULT_TAG_SELECTION_TRANSLATION=$t,exports.GanttChart=zt,exports.JsonEditor=Fe,exports.PasswordStrengthMeter=qt,exports.RichTextEditor=gn,exports.SqlEditor=wn,exports.TagSelection=nn,exports.useConfirm=Oe,exports.useGanttChartStore=Z,exports.useGanttTheme=Pt,exports.useGanttTranslations=Q,exports.useRawGanttChartStore=jt;
|