@pretextbook/web-editor 0.0.7 → 0.0.8

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/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- (function(Ot,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],z):(Ot=typeof globalThis<"u"?globalThis:Ot||self,z(Ot.PretextWebEditor={},Ot.React,Ot.ReactDOM))})(this,(function(Ot,z,Ui){"use strict";function A1(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ce=A1(z);var Gi={exports:{}},Qn={};var _0;function O1(){if(_0)return Qn;_0=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var a in i)a!=="key"&&(s[a]=i[a])}else s=i;return i=s.ref,{$$typeof:r,type:n,key:o,ref:i!==void 0?i:null,props:s}}return Qn.Fragment=e,Qn.jsx=t,Qn.jsxs=t,Qn}var ei={};var W0;function N1(){return W0||(W0=1,process.env.NODE_ENV!=="production"&&(function(){function r(x){if(x==null)return null;if(typeof x=="function")return x.$$typeof===te?null:x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case y:return"Fragment";case k:return"Profiler";case w:return"StrictMode";case N:return"Suspense";case D:return"SuspenseList";case V:return"Activity"}if(typeof x=="object")switch(typeof x.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),x.$$typeof){case v:return"Portal";case R:return x.displayName||"Context";case E:return(x._context.displayName||"Context")+".Consumer";case O:var I=x.render;return x=x.displayName,x||(x=I.displayName||I.name||"",x=x!==""?"ForwardRef("+x+")":"ForwardRef"),x;case B:return I=x.displayName||null,I!==null?I:r(x.type)||"Memo";case L:I=x._payload,x=x._init;try{return r(x(I))}catch{}}return null}function e(x){return""+x}function t(x){try{e(x);var I=!1}catch{I=!0}if(I){I=console;var q=I.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&x[Symbol.toStringTag]||x.constructor.name||"Object";return q.call(I,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),e(x)}}function n(x){if(x===y)return"<>";if(typeof x=="object"&&x!==null&&x.$$typeof===L)return"<...>";try{var I=r(x);return I?"<"+I+">":"<...>"}catch{return"<...>"}}function i(){var x=ne.A;return x===null?null:x.getOwner()}function s(){return Error("react-stack-top-frame")}function o(x){if(he.call(x,"key")){var I=Object.getOwnPropertyDescriptor(x,"key").get;if(I&&I.isReactWarning)return!1}return x.key!==void 0}function a(x,I){function q(){X||(X=!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)",I))}q.isReactWarning=!0,Object.defineProperty(x,"key",{get:q,configurable:!0})}function l(){var x=r(this.type);return ve[x]||(ve[x]=!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.")),x=this.props.ref,x!==void 0?x:null}function u(x,I,q,W,fe,Le){var me=q.ref;return x={$$typeof:m,type:x,key:I,props:q,_owner:W},(me!==void 0?me:null)!==null?Object.defineProperty(x,"ref",{enumerable:!1,get:l}):Object.defineProperty(x,"ref",{enumerable:!1,value:null}),x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(x,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(x,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:fe}),Object.defineProperty(x,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Le}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x}function c(x,I,q,W,fe,Le){var me=I.children;if(me!==void 0)if(W)if(re(me)){for(W=0;W<me.length;W++)d(me[W]);Object.freeze&&Object.freeze(me)}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 d(me);if(he.call(I,"key")){me=r(x);var Ue=Object.keys(I).filter(function(en){return en!=="key"});W=0<Ue.length?"{key: someKey, "+Ue.join(": ..., ")+": ...}":"{key: someKey}",C[me+W]||(Ue=0<Ue.length?"{"+Ue.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(Ot,z){typeof exports=="object"&&typeof module<"u"?z(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],z):(Ot=typeof globalThis<"u"?globalThis:Ot||self,z(Ot.PretextWebEditor={},Ot.React,Ot.ReactDOM))})(this,(function(Ot,z,Ui){"use strict";function A1(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ce=A1(z);var Gi={exports:{}},Qn={};var q0;function O1(){if(q0)return Qn;q0=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var a in i)a!=="key"&&(s[a]=i[a])}else s=i;return i=s.ref,{$$typeof:r,type:n,key:o,ref:i!==void 0?i:null,props:s}}return Qn.Fragment=e,Qn.jsx=t,Qn.jsxs=t,Qn}var ei={};var W0;function N1(){return W0||(W0=1,process.env.NODE_ENV!=="production"&&(function(){function r(x){if(x==null)return null;if(typeof x=="function")return x.$$typeof===te?null:x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case y:return"Fragment";case k:return"Profiler";case w:return"StrictMode";case N:return"Suspense";case D:return"SuspenseList";case V:return"Activity"}if(typeof x=="object")switch(typeof x.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),x.$$typeof){case v:return"Portal";case R:return x.displayName||"Context";case E:return(x._context.displayName||"Context")+".Consumer";case O:var I=x.render;return x=x.displayName,x||(x=I.displayName||I.name||"",x=x!==""?"ForwardRef("+x+")":"ForwardRef"),x;case B:return I=x.displayName||null,I!==null?I:r(x.type)||"Memo";case L:I=x._payload,x=x._init;try{return r(x(I))}catch{}}return null}function e(x){return""+x}function t(x){try{e(x);var I=!1}catch{I=!0}if(I){I=console;var j=I.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&x[Symbol.toStringTag]||x.constructor.name||"Object";return j.call(I,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),e(x)}}function n(x){if(x===y)return"<>";if(typeof x=="object"&&x!==null&&x.$$typeof===L)return"<...>";try{var I=r(x);return I?"<"+I+">":"<...>"}catch{return"<...>"}}function i(){var x=ne.A;return x===null?null:x.getOwner()}function s(){return Error("react-stack-top-frame")}function o(x){if(he.call(x,"key")){var I=Object.getOwnPropertyDescriptor(x,"key").get;if(I&&I.isReactWarning)return!1}return x.key!==void 0}function a(x,I){function j(){Z||(Z=!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)",I))}j.isReactWarning=!0,Object.defineProperty(x,"key",{get:j,configurable:!0})}function l(){var x=r(this.type);return ve[x]||(ve[x]=!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.")),x=this.props.ref,x!==void 0?x:null}function u(x,I,j,W,fe,Le){var me=j.ref;return x={$$typeof:m,type:x,key:I,props:j,_owner:W},(me!==void 0?me:null)!==null?Object.defineProperty(x,"ref",{enumerable:!1,get:l}):Object.defineProperty(x,"ref",{enumerable:!1,value:null}),x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(x,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(x,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:fe}),Object.defineProperty(x,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Le}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x}function c(x,I,j,W,fe,Le){var me=I.children;if(me!==void 0)if(W)if(re(me)){for(W=0;W<me.length;W++)d(me[W]);Object.freeze&&Object.freeze(me)}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 d(me);if(he.call(I,"key")){me=r(x);var Ue=Object.keys(I).filter(function(en){return en!=="key"});W=0<Ue.length?"{key: someKey, "+Ue.join(": ..., ")+": ...}":"{key: someKey}",C[me+W]||(Ue=0<Ue.length?"{"+Ue.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,W,me,Ue,me),C[me+W]=!0)}if(me=null,q!==void 0&&(t(q),me=""+q),o(I)&&(t(I.key),me=""+I.key),"key"in I){q={};for(var At in I)At!=="key"&&(q[At]=I[At])}else q=I;return me&&a(q,typeof x=="function"?x.displayName||x.name||"Unknown":x),u(x,me,q,i(),fe,Le)}function d(x){f(x)?x._store&&(x._store.validated=1):typeof x=="object"&&x!==null&&x.$$typeof===L&&(x._payload.status==="fulfilled"?f(x._payload.value)&&x._payload.value._store&&(x._payload.value._store.validated=1):x._store&&(x._store.validated=1))}function f(x){return typeof x=="object"&&x!==null&&x.$$typeof===m}var h=z,m=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),R=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),ne=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he=Object.prototype.hasOwnProperty,re=Array.isArray,G=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(x){return x()}};var X,ve={},ee=h.react_stack_bottom_frame.bind(h,s)(),Se=G(n(s)),C={};ei.Fragment=y,ei.jsx=function(x,I,q){var W=1e4>ne.recentlyCreatedOwnerStacks++;return c(x,I,q,!1,W?Error("react-stack-top-frame"):ee,W?G(n(x)):Se)},ei.jsxs=function(x,I,q){var W=1e4>ne.recentlyCreatedOwnerStacks++;return c(x,I,q,!0,W?Error("react-stack-top-frame"):ee,W?G(n(x)):Se)}})()),ei}var U0;function D1(){return U0||(U0=1,process.env.NODE_ENV==="production"?Gi.exports=O1():Gi.exports=N1()),Gi.exports}var Z=D1();function I1(r){if(Array.isArray(r))return r}function R1(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(r)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function Fo(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function G0(r,e){if(r){if(typeof r=="string")return Fo(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Fo(r,e):void 0}}function P1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
6
+ <%s key={someKey} {...props} />`,W,me,Ue,me),C[me+W]=!0)}if(me=null,j!==void 0&&(t(j),me=""+j),o(I)&&(t(I.key),me=""+I.key),"key"in I){j={};for(var At in I)At!=="key"&&(j[At]=I[At])}else j=I;return me&&a(j,typeof x=="function"?x.displayName||x.name||"Unknown":x),u(x,me,j,i(),fe,Le)}function d(x){f(x)?x._store&&(x._store.validated=1):typeof x=="object"&&x!==null&&x.$$typeof===L&&(x._payload.status==="fulfilled"?f(x._payload.value)&&x._payload.value._store&&(x._payload.value._store.validated=1):x._store&&(x._store.validated=1))}function f(x){return typeof x=="object"&&x!==null&&x.$$typeof===m}var h=z,m=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),R=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),ne=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he=Object.prototype.hasOwnProperty,re=Array.isArray,G=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(x){return x()}};var Z,ve={},ee=h.react_stack_bottom_frame.bind(h,s)(),Se=G(n(s)),C={};ei.Fragment=y,ei.jsx=function(x,I,j){var W=1e4>ne.recentlyCreatedOwnerStacks++;return c(x,I,j,!1,W?Error("react-stack-top-frame"):ee,W?G(n(x)):Se)},ei.jsxs=function(x,I,j){var W=1e4>ne.recentlyCreatedOwnerStacks++;return c(x,I,j,!0,W?Error("react-stack-top-frame"):ee,W?G(n(x)):Se)}})()),ei}var U0;function D1(){return U0||(U0=1,process.env.NODE_ENV==="production"?Gi.exports=O1():Gi.exports=N1()),Gi.exports}var J=D1();function I1(r){if(Array.isArray(r))return r}function R1(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(r)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function Fo(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function G0(r,e){if(r){if(typeof r=="string")return Fo(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Fo(r,e):void 0}}function P1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
7
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ki(r,e){return I1(r)||R1(r,e)||G0(r,e)||P1()}function De(r){"@babel/helpers - typeof";return De=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},De(r)}function ti(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];if(e){for(var n=[],i=0;i<e.length;i++){var s=e[i];if(s){var o=De(s);if(o==="string"||o==="number")n.push(s);else if(o==="object"){var a=Array.isArray(s)?s:Object.entries(s).map(function(l){var u=Ki(l,2),c=u[0],d=u[1];return d?c:null});n=a.length?n.concat(a.filter(function(l){return!!l})):n}}}return n.join(" ").trim()}}function z1(r){if(Array.isArray(r))return Fo(r)}function L1(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function B1(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
8
8
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $o(r){return z1(r)||L1(r)||G0(r)||B1()}function K0(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function F1(r,e){if(De(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(De(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function Y0(r){var e=F1(r,"string");return De(e)=="symbol"?e:e+""}function $1(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,Y0(n.key),n)}}function J0(r,e,t){return t&&$1(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function Ho(r,e,t){return(e=Y0(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vo(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=H1(r))||e){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
9
9
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(r)},n:function(){var u=t.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function H1(r,e){if(r){if(typeof r=="string")return X0(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?X0(r,e):void 0}}function X0(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}var Te=(function(){function r(){K0(this,r)}return J0(r,null,[{key:"innerWidth",value:function(t){if(t){var n=t.offsetWidth,i=getComputedStyle(t);return n=n+(parseFloat(i.paddingLeft)+parseFloat(i.paddingRight)),n}return 0}},{key:"width",value:function(t){if(t){var n=t.offsetWidth,i=getComputedStyle(t);return n=n-(parseFloat(i.paddingLeft)+parseFloat(i.paddingRight)),n}return 0}},{key:"getBrowserLanguage",value:function(){return navigator.userLanguage||navigator.languages&&navigator.languages.length&&navigator.languages[0]||navigator.language||navigator.browserLanguage||navigator.systemLanguage||"en"}},{key:"getWindowScrollTop",value:function(){var t=document.documentElement;return(window.pageYOffset||t.scrollTop)-(t.clientTop||0)}},{key:"getWindowScrollLeft",value:function(){var t=document.documentElement;return(window.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}},{key:"getOuterWidth",value:function(t,n){if(t){var i=t.getBoundingClientRect().width||t.offsetWidth;if(n){var s=getComputedStyle(t);i=i+(parseFloat(s.marginLeft)+parseFloat(s.marginRight))}return i}return 0}},{key:"getOuterHeight",value:function(t,n){if(t){var i=t.getBoundingClientRect().height||t.offsetHeight;if(n){var s=getComputedStyle(t);i=i+(parseFloat(s.marginTop)+parseFloat(s.marginBottom))}return i}return 0}},{key:"getClientHeight",value:function(t,n){if(t){var i=t.clientHeight;if(n){var s=getComputedStyle(t);i=i+(parseFloat(s.marginTop)+parseFloat(s.marginBottom))}return i}return 0}},{key:"getClientWidth",value:function(t,n){if(t){var i=t.clientWidth;if(n){var s=getComputedStyle(t);i=i+(parseFloat(s.marginLeft)+parseFloat(s.marginRight))}return i}return 0}},{key:"getViewport",value:function(){var t=window,n=document,i=n.documentElement,s=n.getElementsByTagName("body")[0],o=t.innerWidth||i.clientWidth||s.clientWidth,a=t.innerHeight||i.clientHeight||s.clientHeight;return{width:o,height:a}}},{key:"getOffset",value:function(t){if(t){var n=t.getBoundingClientRect();return{top:n.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:n.left+(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0)}}return{top:"auto",left:"auto"}}},{key:"index",value:function(t){if(t)for(var n=t.parentNode.childNodes,i=0,s=0;s<n.length;s++){if(n[s]===t)return i;n[s].nodeType===1&&i++}return-1}},{key:"addMultipleClasses",value:function(t,n){if(t&&n)if(t.classList)for(var i=n.split(" "),s=0;s<i.length;s++)t.classList.add(i[s]);else for(var o=n.split(" "),a=0;a<o.length;a++)t.className=t.className+(" "+o[a])}},{key:"removeMultipleClasses",value:function(t,n){if(t&&n)if(t.classList)for(var i=n.split(" "),s=0;s<i.length;s++)t.classList.remove(i[s]);else for(var o=n.split(" "),a=0;a<o.length;a++)t.className=t.className.replace(new RegExp("(^|\\b)"+o[a].split(" ").join("|")+"(\\b|$)","gi")," ")}},{key:"addClass",value:function(t,n){t&&n&&(t.classList?t.classList.add(n):t.className=t.className+(" "+n))}},{key:"removeClass",value:function(t,n){t&&n&&(t.classList?t.classList.remove(n):t.className=t.className.replace(new RegExp("(^|\\b)"+n.split(" ").join("|")+"(\\b|$)","gi")," "))}},{key:"hasClass",value:function(t,n){return t?t.classList?t.classList.contains(n):new RegExp("(^| )"+n+"( |$)","gi").test(t.className):!1}},{key:"addStyles",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t&&Object.entries(n).forEach(function(i){var s=Ki(i,2),o=s[0],a=s[1];return t.style[o]=a})}},{key:"find",value:function(t,n){return t?Array.from(t.querySelectorAll(n)):[]}},{key:"findSingle",value:function(t,n){return t?t.querySelector(n):null}},{key:"setAttributes",value:function(t){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t){var s=function(a,l){var u,c,d=t!=null&&(u=t.$attrs)!==null&&u!==void 0&&u[a]?[t==null||(c=t.$attrs)===null||c===void 0?void 0:c[a]]:[];return[l].flat().reduce(function(f,h){if(h!=null){var m=De(h);if(m==="string"||m==="number")f.push(h);else if(m==="object"){var v=Array.isArray(h)?s(a,h):Object.entries(h).map(function(y){var w=Ki(y,2),k=w[0],E=w[1];return a==="style"&&(E||E===0)?"".concat(k.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),":").concat(E):E?k:void 0});f=v.length?f.concat(v.filter(function(y){return!!y})):f}}return f},d)};Object.entries(i).forEach(function(o){var a=Ki(o,2),l=a[0],u=a[1];if(u!=null){var c=l.match(/^on(.+)/);c?t.addEventListener(c[1].toLowerCase(),u):l==="p-bind"?n.setAttributes(t,u):(u=l==="class"?$o(new Set(s("class",u))).join(" ").trim():l==="style"?s("style",u).join(";").trim():u,(t.$attrs=t.$attrs||{})&&(t.$attrs[l]=u),t.setAttribute(l,u))}})}}},{key:"getAttribute",value:function(t,n){if(t){var i=t.getAttribute(n);return isNaN(i)?i==="true"||i==="false"?i==="true":i:+i}}},{key:"isAttributeEquals",value:function(t,n,i){return t?this.getAttribute(t,n)===i:!1}},{key:"isAttributeNotEquals",value:function(t,n,i){return!this.isAttributeEquals(t,n,i)}},{key:"getHeight",value:function(t){if(t){var n=t.offsetHeight,i=getComputedStyle(t);return n=n-(parseFloat(i.paddingTop)+parseFloat(i.paddingBottom)+parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth)),n}return 0}},{key:"getWidth",value:function(t){if(t){var n=t.offsetWidth,i=getComputedStyle(t);return n=n-(parseFloat(i.paddingLeft)+parseFloat(i.paddingRight)+parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth)),n}return 0}},{key:"alignOverlay",value:function(t,n,i){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;t&&n&&(i==="self"?this.relativePosition(t,n):(s&&(t.style.minWidth=r.getOuterWidth(n)+"px"),this.absolutePosition(t,n)))}},{key:"absolutePosition",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"left";if(t&&n){var s=t.offsetParent?{width:t.offsetWidth,height:t.offsetHeight}:this.getHiddenElementDimensions(t),o=s.height,a=s.width,l=n.offsetHeight,u=n.offsetWidth,c=n.getBoundingClientRect(),d=this.getWindowScrollTop(),f=this.getWindowScrollLeft(),h=this.getViewport(),m,v;c.top+l+o>h.height?(m=c.top+d-o,m<0&&(m=d),t.style.transformOrigin="bottom"):(m=l+c.top+d,t.style.transformOrigin="top");var y=c.left;i==="left"?y+a>h.width?v=Math.max(0,y+f+u-a):v=y+f:y+u-a<0?v=f:v=y+u-a+f,t.style.top=m+"px",t.style.left=v+"px"}}},{key:"relativePosition",value:function(t,n){if(t&&n){var i=t.offsetParent?{width:t.offsetWidth,height:t.offsetHeight}:this.getHiddenElementDimensions(t),s=n.offsetHeight,o=n.getBoundingClientRect(),a=this.getViewport(),l,u;o.top+s+i.height>a.height?(l=-1*i.height,o.top+l<0&&(l=-1*o.top),t.style.transformOrigin="bottom"):(l=s,t.style.transformOrigin="top"),i.width>a.width?u=o.left*-1:o.left+i.width>a.width?u=(o.left+i.width-a.width)*-1:u=0,t.style.top=l+"px",t.style.left=u+"px"}}},{key:"flipfitCollision",value:function(t,n){var i=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"left top",o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"left bottom",a=arguments.length>4?arguments[4]:void 0;if(t&&n){var l=n.getBoundingClientRect(),u=this.getViewport(),c=s.split(" "),d=o.split(" "),f=function(w,k){return k?+w.substring(w.search(/(\+|-)/g))||0:w.substring(0,w.search(/(\+|-)/g))||w},h={my:{x:f(c[0]),y:f(c[1]||c[0]),offsetX:f(c[0],!0),offsetY:f(c[1]||c[0],!0)},at:{x:f(d[0]),y:f(d[1]||d[0]),offsetX:f(d[0],!0),offsetY:f(d[1]||d[0],!0)}},m={left:function(){var w=h.my.offsetX+h.at.offsetX;return w+l.left+(h.my.x==="left"?0:-1*(h.my.x==="center"?i.getOuterWidth(t)/2:i.getOuterWidth(t)))},top:function(){var w=h.my.offsetY+h.at.offsetY;return w+l.top+(h.my.y==="top"?0:-1*(h.my.y==="center"?i.getOuterHeight(t)/2:i.getOuterHeight(t)))}},v={count:{x:0,y:0},left:function(){var w=m.left(),k=r.getWindowScrollLeft();t.style.left=w+k+"px",this.count.x===2?(t.style.left=k+"px",this.count.x=0):w<0&&(this.count.x++,h.my.x="left",h.at.x="right",h.my.offsetX*=-1,h.at.offsetX*=-1,this.right())},right:function(){var w=m.left()+r.getOuterWidth(n),k=r.getWindowScrollLeft();t.style.left=w+k+"px",this.count.x===2?(t.style.left=u.width-r.getOuterWidth(t)+k+"px",this.count.x=0):w+r.getOuterWidth(t)>u.width&&(this.count.x++,h.my.x="right",h.at.x="left",h.my.offsetX*=-1,h.at.offsetX*=-1,this.left())},top:function(){var w=m.top(),k=r.getWindowScrollTop();t.style.top=w+k+"px",this.count.y===2?(t.style.left=k+"px",this.count.y=0):w<0&&(this.count.y++,h.my.y="top",h.at.y="bottom",h.my.offsetY*=-1,h.at.offsetY*=-1,this.bottom())},bottom:function(){var w=m.top()+r.getOuterHeight(n),k=r.getWindowScrollTop();t.style.top=w+k+"px",this.count.y===2?(t.style.left=u.height-r.getOuterHeight(t)+k+"px",this.count.y=0):w+r.getOuterHeight(n)>u.height&&(this.count.y++,h.my.y="bottom",h.at.y="top",h.my.offsetY*=-1,h.at.offsetY*=-1,this.top())},center:function(w){if(w==="y"){var k=m.top()+r.getOuterHeight(n)/2;t.style.top=k+r.getWindowScrollTop()+"px",k<0?this.bottom():k+r.getOuterHeight(n)>u.height&&this.top()}else{var E=m.left()+r.getOuterWidth(n)/2;t.style.left=E+r.getWindowScrollLeft()+"px",E<0?this.left():E+r.getOuterWidth(t)>u.width&&this.right()}}};v[h.at.x]("x"),v[h.at.y]("y"),this.isFunction(a)&&a(h)}}},{key:"findCollisionPosition",value:function(t){if(t){var n=t==="top"||t==="bottom",i=t==="left"?"right":"left",s=t==="top"?"bottom":"top";return n?{axis:"y",my:"center ".concat(s),at:"center ".concat(t)}:{axis:"x",my:"".concat(i," center"),at:"".concat(t," center")}}}},{key:"getParents",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.parentNode===null?n:this.getParents(t.parentNode,n.concat([t.parentNode]))}},{key:"getScrollableParents",value:function(t){var n=this,i=[];if(t){var s=this.getParents(t),o=/(auto|scroll)/,a=function(R){var O=R?getComputedStyle(R):null;return O&&(o.test(O.getPropertyValue("overflow"))||o.test(O.getPropertyValue("overflow-x"))||o.test(O.getPropertyValue("overflow-y")))},l=function(R){i.push(R.nodeName==="BODY"||R.nodeName==="HTML"||n.isDocument(R)?window:R)},u=Vo(s),c;try{for(u.s();!(c=u.n()).done;){var d,f=c.value,h=f.nodeType===1&&((d=f.dataset)===null||d===void 0?void 0:d.scrollselectors);if(h){var m=h.split(","),v=Vo(m),y;try{for(v.s();!(y=v.n()).done;){var w=y.value,k=this.findSingle(f,w);k&&a(k)&&l(k)}}catch(E){v.e(E)}finally{v.f()}}f.nodeType===1&&a(f)&&l(f)}}catch(E){u.e(E)}finally{u.f()}}return i}},{key:"getHiddenElementOuterHeight",value:function(t){if(t){t.style.visibility="hidden",t.style.display="block";var n=t.offsetHeight;return t.style.display="none",t.style.visibility="visible",n}return 0}},{key:"getHiddenElementOuterWidth",value:function(t){if(t){t.style.visibility="hidden",t.style.display="block";var n=t.offsetWidth;return t.style.display="none",t.style.visibility="visible",n}return 0}},{key:"getHiddenElementDimensions",value:function(t){var n={};return t&&(t.style.visibility="hidden",t.style.display="block",n.width=t.offsetWidth,n.height=t.offsetHeight,t.style.display="none",t.style.visibility="visible"),n}},{key:"fadeIn",value:function(t,n){if(t){t.style.opacity=0;var i=+new Date,s=0,o=function(){s=+t.style.opacity+(new Date().getTime()-i)/n,t.style.opacity=s,i=+new Date,+s<1&&(window.requestAnimationFrame&&requestAnimationFrame(o)||setTimeout(o,16))};o()}}},{key:"fadeOut",value:function(t,n){if(t)var i=1,s=50,o=s/n,a=setInterval(function(){i=i-o,i<=0&&(i=0,clearInterval(a)),t.style.opacity=i},s)}},{key:"getUserAgent",value:function(){return navigator.userAgent}},{key:"isIOS",value:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}},{key:"isAndroid",value:function(){return/(android)/i.test(navigator.userAgent)}},{key:"isChrome",value:function(){return/(chrome)/i.test(navigator.userAgent)}},{key:"isClient",value:function(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}},{key:"isFunction",value:function(t){return!!(t&&t.constructor&&t.call&&t.apply)}},{key:"appendChild",value:function(t,n){if(this.isElement(n))n.appendChild(t);else if(n.el&&n.el.nativeElement)n.el.nativeElement.appendChild(t);else throw new Error("Cannot append "+n+" to "+t)}},{key:"removeChild",value:function(t,n){if(this.isElement(n))n.removeChild(t);else if(n.el&&n.el.nativeElement)n.el.nativeElement.removeChild(t);else throw new Error("Cannot remove "+t+" from "+n)}},{key:"isElement",value:function(t){return(typeof HTMLElement>"u"?"undefined":De(HTMLElement))==="object"?t instanceof HTMLElement:t&&De(t)==="object"&&t!==null&&t.nodeType===1&&typeof t.nodeName=="string"}},{key:"isDocument",value:function(t){return(typeof Document>"u"?"undefined":De(Document))==="object"?t instanceof Document:t&&De(t)==="object"&&t!==null&&t.nodeType===9}},{key:"scrollInView",value:function(t,n){var i=getComputedStyle(t).getPropertyValue("border-top-width"),s=i?parseFloat(i):0,o=getComputedStyle(t).getPropertyValue("padding-top"),a=o?parseFloat(o):0,l=t.getBoundingClientRect(),u=n.getBoundingClientRect(),c=u.top+document.body.scrollTop-(l.top+document.body.scrollTop)-s-a,d=t.scrollTop,f=t.clientHeight,h=this.getOuterHeight(n);c<0?t.scrollTop=d+c:c+h>f&&(t.scrollTop=d+c-f+h)}},{key:"clearSelection",value:function(){if(window.getSelection)window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().rangeCount>0&&window.getSelection().getRangeAt(0).getClientRects().length>0&&window.getSelection().removeAllRanges();else if(document.selection&&document.selection.empty)try{document.selection.empty()}catch{}}},{key:"calculateScrollbarWidth",value:function(t){if(t){var n=getComputedStyle(t);return t.offsetWidth-t.clientWidth-parseFloat(n.borderLeftWidth)-parseFloat(n.borderRightWidth)}if(this.calculatedScrollbarWidth!=null)return this.calculatedScrollbarWidth;var i=document.createElement("div");i.className="p-scrollbar-measure",document.body.appendChild(i);var s=i.offsetWidth-i.clientWidth;return document.body.removeChild(i),this.calculatedScrollbarWidth=s,s}},{key:"calculateBodyScrollbarWidth",value:function(){return window.innerWidth-document.documentElement.offsetWidth}},{key:"getBrowser",value:function(){if(!this.browser){var t=this.resolveUserAgent();this.browser={},t.browser&&(this.browser[t.browser]=!0,this.browser.version=t.version),this.browser.chrome?this.browser.webkit=!0:this.browser.webkit&&(this.browser.safari=!0)}return this.browser}},{key:"resolveUserAgent",value:function(){var t=navigator.userAgent.toLowerCase(),n=/(chrome)[ ]([\w.]+)/.exec(t)||/(webkit)[ ]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ ]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[];return{browser:n[1]||"",version:n[2]||"0"}}},{key:"blockBodyScroll",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"p-overflow-hidden",n=!!document.body.style.getPropertyValue("--scrollbar-width");!n&&document.body.style.setProperty("--scrollbar-width",this.calculateBodyScrollbarWidth()+"px"),this.addClass(document.body,t)}},{key:"unblockBodyScroll",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"p-overflow-hidden";document.body.style.removeProperty("--scrollbar-width"),this.removeClass(document.body,t)}},{key:"isVisible",value:function(t){return t&&(t.clientHeight!==0||t.getClientRects().length!==0||getComputedStyle(t).display!=="none")}},{key:"isExist",value:function(t){return!!(t!==null&&typeof t<"u"&&t.nodeName&&t.parentNode)}},{key:"getFocusableElements",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",i=r.find(t,'button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])'.concat(n,`,
@@ -13,9 +13,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
13
13
  textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])`).concat(n,`,
14
14
  [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])`).concat(n,`,
15
15
  [contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])`).concat(n)),s=[],o=Vo(i),a;try{for(o.s();!(a=o.n()).done;){var l=a.value;getComputedStyle(l).display!=="none"&&getComputedStyle(l).visibility!=="hidden"&&s.push(l)}}catch(u){o.e(u)}finally{o.f()}return s}},{key:"getFirstFocusableElement",value:function(t,n){var i=r.getFocusableElements(t,n);return i.length>0?i[0]:null}},{key:"getLastFocusableElement",value:function(t,n){var i=r.getFocusableElements(t,n);return i.length>0?i[i.length-1]:null}},{key:"focus",value:function(t,n){var i=n===void 0?!0:!n;t&&document.activeElement!==t&&t.focus({preventScroll:i})}},{key:"focusFirstElement",value:function(t,n){if(t){var i=r.getFirstFocusableElement(t);return i&&r.focus(i,n),i}}},{key:"getCursorOffset",value:function(t,n,i,s){if(t){var o=getComputedStyle(t),a=document.createElement("div");a.style.position="absolute",a.style.top="0px",a.style.left="0px",a.style.visibility="hidden",a.style.pointerEvents="none",a.style.overflow=o.overflow,a.style.width=o.width,a.style.height=o.height,a.style.padding=o.padding,a.style.border=o.border,a.style.overflowWrap=o.overflowWrap,a.style.whiteSpace=o.whiteSpace,a.style.lineHeight=o.lineHeight,a.innerHTML=n.replace(/\r\n|\r|\n/g,"<br />");var l=document.createElement("span");l.textContent=s,a.appendChild(l);var u=document.createTextNode(i);a.appendChild(u),document.body.appendChild(a);var c=l.offsetLeft,d=l.offsetTop,f=l.clientHeight;return document.body.removeChild(a),{left:Math.abs(c-t.scrollLeft),top:Math.abs(d-t.scrollTop)+f}}return{top:"auto",left:"auto"}}},{key:"invokeElementMethod",value:function(t,n,i){t[n].apply(t,i)}},{key:"isClickable",value:function(t){var n=t.nodeName,i=t.parentElement&&t.parentElement.nodeName;return n==="INPUT"||n==="TEXTAREA"||n==="BUTTON"||n==="A"||i==="INPUT"||i==="TEXTAREA"||i==="BUTTON"||i==="A"||this.hasClass(t,"p-button")||this.hasClass(t.parentElement,"p-button")||this.hasClass(t.parentElement,"p-checkbox")||this.hasClass(t.parentElement,"p-radiobutton")}},{key:"applyStyle",value:function(t,n){if(typeof n=="string")t.style.cssText=n;else for(var i in n)t.style[i]=n[i]}},{key:"exportCSV",value:function(t,n){var i=new Blob([t],{type:"application/csv;charset=utf-8;"});if(window.navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(i,n+".csv");else{var s=r.saveAs({name:n+".csv",src:URL.createObjectURL(i)});s||(t="data:text/csv;charset=utf-8,"+t,window.open(encodeURI(t)))}}},{key:"saveAs",value:function(t){if(t){var n=document.createElement("a");if(n.download!==void 0){var i=t.name,s=t.src;return n.setAttribute("href",s),n.setAttribute("download",i),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n),!0}}return!1}},{key:"createInlineStyle",value:function(t,n){var i=document.createElement("style");return r.addNonce(i,t),n||(n=document.head),n.appendChild(i),i}},{key:"removeInlineStyle",value:function(t){if(this.isExist(t)){try{t.parentNode.removeChild(t)}catch{}t=null}return t}},{key:"addNonce",value:function(t,n){try{n||(n=process.env.REACT_APP_CSS_NONCE)}catch{}n&&t.setAttribute("nonce",n)}},{key:"getTargetElement",value:function(t){if(!t)return null;if(t==="document")return document;if(t==="window")return window;if(De(t)==="object"&&t.hasOwnProperty("current"))return this.isExist(t.current)?t.current:null;var n=function(o){return!!(o&&o.constructor&&o.call&&o.apply)},i=n(t)?t():t;return this.isDocument(i)||this.isExist(i)?i:null}},{key:"getAttributeNames",value:function(t){var n,i,s;for(i=[],s=t.attributes,n=0;n<s.length;++n)i.push(s[n].nodeName);return i.sort(),i}},{key:"isEqualElement",value:function(t,n){var i,s,o,a,l;if(i=r.getAttributeNames(t),s=r.getAttributeNames(n),i.join(",")!==s.join(","))return!1;for(var u=0;u<i.length;++u)if(o=i[u],o==="style")for(var c=t.style,d=n.style,f=/^\d+$/,h=0,m=Object.keys(c);h<m.length;h++){var v=m[h];if(!f.test(v)&&c[v]!==d[v])return!1}else if(t.getAttribute(o)!==n.getAttribute(o))return!1;for(a=t.firstChild,l=n.firstChild;a&&l;a=a.nextSibling,l=l.nextSibling){if(a.nodeType!==l.nodeType)return!1;if(a.nodeType===1){if(!r.isEqualElement(a,l))return!1}else if(a.nodeValue!==l.nodeValue)return!1}return!(a||l)}},{key:"hasCSSAnimation",value:function(t){if(t){var n=getComputedStyle(t),i=parseFloat(n.getPropertyValue("animation-duration")||"0");return i>0}return!1}},{key:"hasCSSTransition",value:function(t){if(t){var n=getComputedStyle(t),i=parseFloat(n.getPropertyValue("transition-duration")||"0");return i>0}return!1}}])})();Ho(Te,"DATA_PROPS",["data-"]),Ho(Te,"ARIA_PROPS",["aria","focus-target"]);function Z0(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=V1(r))||e){t&&(r=t);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
16
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(r)},n:function(){var u=t.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function V1(r,e){if(r){if(typeof r=="string")return Q0(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Q0(r,e):void 0}}function Q0(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}var Ee=(function(){function r(){K0(this,r)}return J0(r,null,[{key:"equals",value:function(t,n,i){return i&&t&&De(t)==="object"&&n&&De(n)==="object"?this.deepEquals(this.resolveFieldData(t,i),this.resolveFieldData(n,i)):this.deepEquals(t,n)}},{key:"deepEquals",value:function(t,n){if(t===n)return!0;if(t&&n&&De(t)==="object"&&De(n)==="object"){var i=Array.isArray(t),s=Array.isArray(n),o,a,l;if(i&&s){if(a=t.length,a!==n.length)return!1;for(o=a;o--!==0;)if(!this.deepEquals(t[o],n[o]))return!1;return!0}if(i!==s)return!1;var u=t instanceof Date,c=n instanceof Date;if(u!==c)return!1;if(u&&c)return t.getTime()===n.getTime();var d=t instanceof RegExp,f=n instanceof RegExp;if(d!==f)return!1;if(d&&f)return t.toString()===n.toString();var h=Object.keys(t);if(a=h.length,a!==Object.keys(n).length)return!1;for(o=a;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,h[o]))return!1;for(o=a;o--!==0;)if(l=h[o],!this.deepEquals(t[l],n[l]))return!1;return!0}return t!==t&&n!==n}},{key:"resolveFieldData",value:function(t,n){if(!t||!n)return null;try{var i=t[n];if(this.isNotEmpty(i))return i}catch{}if(Object.keys(t).length){if(this.isFunction(n))return n(t);if(this.isNotEmpty(t[n]))return t[n];if(n.indexOf(".")===-1)return t[n];for(var s=n.split("."),o=t,a=0,l=s.length;a<l;++a){if(o==null)return null;o=o[s[a]]}return o}return null}},{key:"findDiffKeys",value:function(t,n){return!t||!n?{}:Object.keys(t).filter(function(i){return!n.hasOwnProperty(i)}).reduce(function(i,s){return i[s]=t[s],i},{})}},{key:"reduceKeys",value:function(t,n){var i={};return!t||!n||n.length===0||Object.keys(t).filter(function(s){return n.some(function(o){return s.startsWith(o)})}).forEach(function(s){i[s]=t[s],delete t[s]}),i}},{key:"reorderArray",value:function(t,n,i){t&&n!==i&&(i>=t.length&&(i=i%t.length,n=n%t.length),t.splice(i,0,t.splice(n,1)[0]))}},{key:"findIndexInList",value:function(t,n,i){var s=this;return n?i?n.findIndex(function(o){return s.equals(o,t,i)}):n.findIndex(function(o){return o===t}):-1}},{key:"getJSXElement",value:function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return this.isFunction(t)?t.apply(void 0,i):t}},{key:"getItemValue",value:function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return this.isFunction(t)?t.apply(void 0,i):t}},{key:"getProp",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=t?t[n]:void 0;return s===void 0?i[n]:s}},{key:"getPropCaseInsensitive",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.toFlatCase(n);for(var o in t)if(t.hasOwnProperty(o)&&this.toFlatCase(o)===s)return t[o];for(var a in i)if(i.hasOwnProperty(a)&&this.toFlatCase(a)===s)return i[a]}},{key:"getMergedProps",value:function(t,n){return Object.assign({},n,t)}},{key:"getDiffProps",value:function(t,n){return this.findDiffKeys(t,n)}},{key:"getPropValue",value:function(t){if(!this.isFunction(t))return t;for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];if(i.length===1){var o=i[0];return t(Array.isArray(o)?o[0]:o)}return t.apply(void 0,i)}},{key:"getComponentProp",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.isNotEmpty(t)?this.getProp(t.props,n,i):void 0}},{key:"getComponentProps",value:function(t,n){return this.isNotEmpty(t)?this.getMergedProps(t.props,n):void 0}},{key:"getComponentDiffProps",value:function(t,n){return this.isNotEmpty(t)?this.getDiffProps(t.props,n):void 0}},{key:"isValidChild",value:function(t,n,i){if(t){var s,o=this.getComponentProp(t,"__TYPE")||(t.type?t.type.displayName:void 0);!o&&t!==null&&t!==void 0&&(s=t.type)!==null&&s!==void 0&&(s=s._payload)!==null&&s!==void 0&&s.value&&(o=t.type._payload.value.find(function(u){return u===n}));var a=o===n;try{var l}catch{}return a}return!1}},{key:"getRefElement",value:function(t){return t?De(t)==="object"&&t.hasOwnProperty("current")?t.current:t:null}},{key:"combinedRefs",value:function(t,n){t&&n&&(typeof n=="function"?n(t.current):n.current=t.current)}},{key:"removeAccents",value:function(t){return t&&t.search(/[\xC0-\xFF]/g)>-1&&(t=t.replace(/[\xC0-\xC5]/g,"A").replace(/[\xC6]/g,"AE").replace(/[\xC7]/g,"C").replace(/[\xC8-\xCB]/g,"E").replace(/[\xCC-\xCF]/g,"I").replace(/[\xD0]/g,"D").replace(/[\xD1]/g,"N").replace(/[\xD2-\xD6\xD8]/g,"O").replace(/[\xD9-\xDC]/g,"U").replace(/[\xDD]/g,"Y").replace(/[\xDE]/g,"P").replace(/[\xE0-\xE5]/g,"a").replace(/[\xE6]/g,"ae").replace(/[\xE7]/g,"c").replace(/[\xE8-\xEB]/g,"e").replace(/[\xEC-\xEF]/g,"i").replace(/[\xF1]/g,"n").replace(/[\xF2-\xF6\xF8]/g,"o").replace(/[\xF9-\xFC]/g,"u").replace(/[\xFE]/g,"p").replace(/[\xFD\xFF]/g,"y")),t}},{key:"toFlatCase",value:function(t){return this.isNotEmpty(t)&&this.isString(t)?t.replace(/(-|_)/g,"").toLowerCase():t}},{key:"toCapitalCase",value:function(t){return this.isNotEmpty(t)&&this.isString(t)?t[0].toUpperCase()+t.slice(1):t}},{key:"trim",value:function(t){return this.isNotEmpty(t)&&this.isString(t)?t.trim():t}},{key:"isEmpty",value:function(t){return t==null||t===""||Array.isArray(t)&&t.length===0||!(t instanceof Date)&&De(t)==="object"&&Object.keys(t).length===0}},{key:"isNotEmpty",value:function(t){return!this.isEmpty(t)}},{key:"isFunction",value:function(t){return!!(t&&t.constructor&&t.call&&t.apply)}},{key:"isObject",value:function(t){return t!==null&&t instanceof Object&&t.constructor===Object}},{key:"isDate",value:function(t){return t!==null&&t instanceof Date&&t.constructor===Date}},{key:"isArray",value:function(t){return t!==null&&Array.isArray(t)}},{key:"isString",value:function(t){return t!==null&&typeof t=="string"}},{key:"isPrintableCharacter",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return this.isNotEmpty(t)&&t.length===1&&t.match(/\S| /)}},{key:"isLetter",value:function(t){return/^[a-zA-Z\u00C0-\u017F]$/.test(t)}},{key:"isScalar",value:function(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="bigint"||typeof t=="boolean")}},{key:"findLast",value:function(t,n){var i;if(this.isNotEmpty(t))try{i=t.findLast(n)}catch{i=$o(t).reverse().find(n)}return i}},{key:"findLastIndex",value:function(t,n){var i=-1;if(this.isNotEmpty(t))try{i=t.findLastIndex(n)}catch{i=t.lastIndexOf($o(t).reverse().find(n))}return i}},{key:"sort",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=arguments.length>3?arguments[3]:void 0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=this.compare(t,n,s,i),l=i;return(this.isEmpty(t)||this.isEmpty(n))&&(l=o===1?i:o),l*a}},{key:"compare",value:function(t,n,i){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,o=-1,a=this.isEmpty(t),l=this.isEmpty(n);return a&&l?o=0:a?o=s:l?o=-s:typeof t=="string"&&typeof n=="string"?o=i(t,n):o=t<n?-1:t>n?1:0,o}},{key:"localeComparator",value:function(t){return new Intl.Collator(t,{numeric:!0}).compare}},{key:"findChildrenByKey",value:function(t,n){var i=Z0(t),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;if(o.key===n)return o.children||[];if(o.children){var a=this.findChildrenByKey(o.children,n);if(a.length>0)return a}}}catch(l){i.e(l)}finally{i.f()}return[]}},{key:"mutateFieldData",value:function(t,n,i){if(!(De(t)!=="object"||typeof n!="string"))for(var s=n.split("."),o=t,a=0,l=s.length;a<l;++a){if(a+1-l===0){o[s[a]]=i;break}o[s[a]]||(o[s[a]]={}),o=o[s[a]]}}},{key:"getNestedValue",value:function(t,n){return n.split(".").reduce(function(i,s){return i&&i[s]!==void 0?i[s]:void 0},t)}},{key:"absoluteCompare",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(!t||!n||s>i)return!0;if(De(t)!==De(n))return!1;var o=Object.keys(t),a=Object.keys(n);if(o.length!==a.length)return!1;for(var l=0,u=o;l<u.length;l++){var c=u[l],d=t[c],f=n[c],h=r.isObject(d)&&r.isObject(f),m=r.isFunction(d)&&r.isFunction(f);if((h||m)&&!this.absoluteCompare(d,f,i,s+1)||!h&&d!==f)return!1}return!0}},{key:"selectiveCompare",value:function(t,n,i){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(t===n)return!0;if(!t||!n||De(t)!=="object"||De(n)!=="object")return!1;if(!i)return this.absoluteCompare(t,n,1);var o=Z0(i),a;try{for(o.s();!(a=o.n()).done;){var l=a.value,u=this.getNestedValue(t,l),c=this.getNestedValue(n,l),d=De(u)==="object"&&u!==null&&De(c)==="object"&&c!==null;if(d&&!this.absoluteCompare(u,c,s)||!d&&u!==c)return!1}}catch(f){o.e(f)}finally{o.f()}return!0}}])})(),eu=0;function j1(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"pr_id_";return eu++,"".concat(r).concat(eu)}function tu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ru(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tu(Object(t),!0).forEach(function(n){Ho(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):tu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Yi(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(r){var t=function(o){return typeof o=="function"},n=e.classNameMergeFunction,i=t(n);return r.reduce(function(s,o){if(!o)return s;var a=function(){var c=o[l];if(l==="style")s.style=ru(ru({},s.style),o.style);else if(l==="className"){var d="";i?d=n(s.className,o.className):d=[s.className,o.className].join(" ").trim(),s.className=d||void 0}else if(t(c)){var f=s[l];s[l]=f?function(){f.apply(void 0,arguments),c.apply(void 0,arguments)}:c}else s[l]=c};for(var l in o)a();return s},{})}}var rt=Object.freeze({STARTS_WITH:"startsWith",CONTAINS:"contains",NOT_CONTAINS:"notContains",ENDS_WITH:"endsWith",EQUALS:"equals",NOT_EQUALS:"notEquals",IN:"in",NOT_IN:"notIn",LESS_THAN:"lt",LESS_THAN_OR_EQUAL_TO:"lte",GREATER_THAN:"gt",GREATER_THAN_OR_EQUAL_TO:"gte",BETWEEN:"between",DATE_IS:"dateIs",DATE_IS_NOT:"dateIsNot",DATE_BEFORE:"dateBefore",DATE_AFTER:"dateAfter",CUSTOM:"custom"});function ri(r){"@babel/helpers - typeof";return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ri(r)}function q1(r,e){if(ri(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(ri(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function _1(r){var e=q1(r,"string");return ri(e)=="symbol"?e:e+""}function wt(r,e,t){return(e=_1(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function W1(r,e,t){return Object.defineProperty(r,"prototype",{writable:!1}),r}function U1(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var ft=W1(function r(){U1(this,r)});wt(ft,"ripple",!1),wt(ft,"inputStyle","outlined"),wt(ft,"locale","en"),wt(ft,"appendTo",null),wt(ft,"cssTransition",!0),wt(ft,"autoZIndex",!0),wt(ft,"hideOverlaysOnDocumentScrolling",!1),wt(ft,"nonce",null),wt(ft,"nullSortOrder",1),wt(ft,"zIndex",{modal:1100,overlay:1e3,menu:1e3,tooltip:1100,toast:1200}),wt(ft,"pt",void 0),wt(ft,"filterMatchModeOptions",{text:[rt.STARTS_WITH,rt.CONTAINS,rt.NOT_CONTAINS,rt.ENDS_WITH,rt.EQUALS,rt.NOT_EQUALS],numeric:[rt.EQUALS,rt.NOT_EQUALS,rt.LESS_THAN,rt.LESS_THAN_OR_EQUAL_TO,rt.GREATER_THAN,rt.GREATER_THAN_OR_EQUAL_TO],date:[rt.DATE_IS,rt.DATE_IS_NOT,rt.DATE_BEFORE,rt.DATE_AFTER]}),wt(ft,"changeTheme",function(r,e,t,n){var i,s=document.getElementById(t);if(!s)throw Error("Element with id ".concat(t," not found."));var o=s.getAttribute("href").replace(r,e),a=document.createElement("link");a.setAttribute("rel","stylesheet"),a.setAttribute("id",t),a.setAttribute("href",o),a.addEventListener("load",function(){n&&n()}),(i=s.parentNode)===null||i===void 0||i.replaceChild(a,s)});var jo=z.createContext(),Ji=ft;function G1(r){if(Array.isArray(r))return r}function K1(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(r)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function nu(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function Y1(r,e){if(r){if(typeof r=="string")return nu(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?nu(r,e):void 0}}function J1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
17
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X1(r,e){return G1(r)||K1(r,e)||Y1(r,e)||J1()}var iu=function(e){var t=ce.useRef(null);return ce.useEffect(function(){return t.current=e,function(){t.current=null}},[e]),t.current},su=function(e){return ce.useEffect(function(){return e},[])},ou=function(e){var t=e.target,n=t===void 0?"document":t,i=e.type,s=e.listener,o=e.options,a=e.when,l=a===void 0?!0:a,u=ce.useRef(null),c=ce.useRef(null),d=iu(s),f=iu(o),h=function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},E=k.target;Ee.isNotEmpty(E)&&(m(),(k.when||l)&&(u.current=Te.getTargetElement(E))),!c.current&&u.current&&(c.current=function(R){return s&&s(R)},u.current.addEventListener(i,c.current,o))},m=function(){c.current&&(u.current.removeEventListener(i,c.current,o),c.current=null)},v=function(){m(),d=null,f=null},y=ce.useCallback(function(){l?u.current=Te.getTargetElement(n):(m(),u.current=null)},[n,l]);return ce.useEffect(function(){y()},[y]),ce.useEffect(function(){var w="".concat(d)!=="".concat(s),k=f!==o,E=c.current;E&&(w||k)?(m(),l&&h()):E||v()},[s,o,l]),su(function(){v()}),[h,m]},Z1=function(){var e=z.useContext(jo);return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Yi(n,e?.ptOptions)}},au=function(e){var t=ce.useRef(!1);return ce.useEffect(function(){if(!t.current)return t.current=!0,e&&e()},[])},Q1=0,Xi=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=z.useState(!1),i=X1(n,2),s=i[0],o=i[1],a=z.useRef(null),l=z.useContext(jo),u=Te.isClient()?window.document:void 0,c=t.document,d=c===void 0?u:c,f=t.manual,h=f===void 0?!1:f,m=t.name,v=m===void 0?"style_".concat(++Q1):m,y=t.id,w=y===void 0?void 0:y,k=t.media,E=k===void 0?void 0:k,R=function(L){var V=L.querySelector('style[data-primereact-style-id="'.concat(v,'"]'));if(V)return V;if(w!==void 0){var te=d.getElementById(w);if(te)return te}return d.createElement("style")},O=function(L){s&&e!==L&&(a.current.textContent=L)},N=function(){if(!(!d||s)){var L=l?.styleContainer||d.head;a.current=R(L),a.current.isConnected||(a.current.type="text/css",w&&(a.current.id=w),E&&(a.current.media=E),Te.addNonce(a.current,l&&l.nonce||Ji.nonce),L.appendChild(a.current),v&&a.current.setAttribute("data-primereact-style-id",v)),a.current.textContent=e,o(!0)}},D=function(){!d||!a.current||(Te.removeInlineStyle(a.current),o(!1))};return z.useEffect(function(){h||N()},[h]),{id:w,name:v,update:O,unload:D,load:N,isLoaded:s}},eg=function(e,t){var n=ce.useRef(!1);return ce.useEffect(function(){if(!n.current){n.current=!0;return}return e&&e()},t)};function qo(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function tg(r){if(Array.isArray(r))return qo(r)}function rg(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function ng(r,e){if(r){if(typeof r=="string")return qo(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?qo(r,e):void 0}}function ig(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
18
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lu(r){return tg(r)||rg(r)||ng(r)||ig()}function ni(r){"@babel/helpers - typeof";return ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ni(r)}function sg(r,e){if(ni(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(ni(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function og(r){var e=sg(r,"string");return ni(e)=="symbol"?e:e+""}function _o(r,e,t){return(e=og(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ke(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uu(Object(t),!0).forEach(function(n){_o(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):uu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var ag=`
16
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(r)},n:function(){var u=t.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function V1(r,e){if(r){if(typeof r=="string")return Q0(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Q0(r,e):void 0}}function Q0(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}var Ee=(function(){function r(){K0(this,r)}return J0(r,null,[{key:"equals",value:function(t,n,i){return i&&t&&De(t)==="object"&&n&&De(n)==="object"?this.deepEquals(this.resolveFieldData(t,i),this.resolveFieldData(n,i)):this.deepEquals(t,n)}},{key:"deepEquals",value:function(t,n){if(t===n)return!0;if(t&&n&&De(t)==="object"&&De(n)==="object"){var i=Array.isArray(t),s=Array.isArray(n),o,a,l;if(i&&s){if(a=t.length,a!==n.length)return!1;for(o=a;o--!==0;)if(!this.deepEquals(t[o],n[o]))return!1;return!0}if(i!==s)return!1;var u=t instanceof Date,c=n instanceof Date;if(u!==c)return!1;if(u&&c)return t.getTime()===n.getTime();var d=t instanceof RegExp,f=n instanceof RegExp;if(d!==f)return!1;if(d&&f)return t.toString()===n.toString();var h=Object.keys(t);if(a=h.length,a!==Object.keys(n).length)return!1;for(o=a;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,h[o]))return!1;for(o=a;o--!==0;)if(l=h[o],!this.deepEquals(t[l],n[l]))return!1;return!0}return t!==t&&n!==n}},{key:"resolveFieldData",value:function(t,n){if(!t||!n)return null;try{var i=t[n];if(this.isNotEmpty(i))return i}catch{}if(Object.keys(t).length){if(this.isFunction(n))return n(t);if(this.isNotEmpty(t[n]))return t[n];if(n.indexOf(".")===-1)return t[n];for(var s=n.split("."),o=t,a=0,l=s.length;a<l;++a){if(o==null)return null;o=o[s[a]]}return o}return null}},{key:"findDiffKeys",value:function(t,n){return!t||!n?{}:Object.keys(t).filter(function(i){return!n.hasOwnProperty(i)}).reduce(function(i,s){return i[s]=t[s],i},{})}},{key:"reduceKeys",value:function(t,n){var i={};return!t||!n||n.length===0||Object.keys(t).filter(function(s){return n.some(function(o){return s.startsWith(o)})}).forEach(function(s){i[s]=t[s],delete t[s]}),i}},{key:"reorderArray",value:function(t,n,i){t&&n!==i&&(i>=t.length&&(i=i%t.length,n=n%t.length),t.splice(i,0,t.splice(n,1)[0]))}},{key:"findIndexInList",value:function(t,n,i){var s=this;return n?i?n.findIndex(function(o){return s.equals(o,t,i)}):n.findIndex(function(o){return o===t}):-1}},{key:"getJSXElement",value:function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return this.isFunction(t)?t.apply(void 0,i):t}},{key:"getItemValue",value:function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return this.isFunction(t)?t.apply(void 0,i):t}},{key:"getProp",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=t?t[n]:void 0;return s===void 0?i[n]:s}},{key:"getPropCaseInsensitive",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.toFlatCase(n);for(var o in t)if(t.hasOwnProperty(o)&&this.toFlatCase(o)===s)return t[o];for(var a in i)if(i.hasOwnProperty(a)&&this.toFlatCase(a)===s)return i[a]}},{key:"getMergedProps",value:function(t,n){return Object.assign({},n,t)}},{key:"getDiffProps",value:function(t,n){return this.findDiffKeys(t,n)}},{key:"getPropValue",value:function(t){if(!this.isFunction(t))return t;for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];if(i.length===1){var o=i[0];return t(Array.isArray(o)?o[0]:o)}return t.apply(void 0,i)}},{key:"getComponentProp",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.isNotEmpty(t)?this.getProp(t.props,n,i):void 0}},{key:"getComponentProps",value:function(t,n){return this.isNotEmpty(t)?this.getMergedProps(t.props,n):void 0}},{key:"getComponentDiffProps",value:function(t,n){return this.isNotEmpty(t)?this.getDiffProps(t.props,n):void 0}},{key:"isValidChild",value:function(t,n,i){if(t){var s,o=this.getComponentProp(t,"__TYPE")||(t.type?t.type.displayName:void 0);!o&&t!==null&&t!==void 0&&(s=t.type)!==null&&s!==void 0&&(s=s._payload)!==null&&s!==void 0&&s.value&&(o=t.type._payload.value.find(function(u){return u===n}));var a=o===n;try{var l}catch{}return a}return!1}},{key:"getRefElement",value:function(t){return t?De(t)==="object"&&t.hasOwnProperty("current")?t.current:t:null}},{key:"combinedRefs",value:function(t,n){t&&n&&(typeof n=="function"?n(t.current):n.current=t.current)}},{key:"removeAccents",value:function(t){return t&&t.search(/[\xC0-\xFF]/g)>-1&&(t=t.replace(/[\xC0-\xC5]/g,"A").replace(/[\xC6]/g,"AE").replace(/[\xC7]/g,"C").replace(/[\xC8-\xCB]/g,"E").replace(/[\xCC-\xCF]/g,"I").replace(/[\xD0]/g,"D").replace(/[\xD1]/g,"N").replace(/[\xD2-\xD6\xD8]/g,"O").replace(/[\xD9-\xDC]/g,"U").replace(/[\xDD]/g,"Y").replace(/[\xDE]/g,"P").replace(/[\xE0-\xE5]/g,"a").replace(/[\xE6]/g,"ae").replace(/[\xE7]/g,"c").replace(/[\xE8-\xEB]/g,"e").replace(/[\xEC-\xEF]/g,"i").replace(/[\xF1]/g,"n").replace(/[\xF2-\xF6\xF8]/g,"o").replace(/[\xF9-\xFC]/g,"u").replace(/[\xFE]/g,"p").replace(/[\xFD\xFF]/g,"y")),t}},{key:"toFlatCase",value:function(t){return this.isNotEmpty(t)&&this.isString(t)?t.replace(/(-|_)/g,"").toLowerCase():t}},{key:"toCapitalCase",value:function(t){return this.isNotEmpty(t)&&this.isString(t)?t[0].toUpperCase()+t.slice(1):t}},{key:"trim",value:function(t){return this.isNotEmpty(t)&&this.isString(t)?t.trim():t}},{key:"isEmpty",value:function(t){return t==null||t===""||Array.isArray(t)&&t.length===0||!(t instanceof Date)&&De(t)==="object"&&Object.keys(t).length===0}},{key:"isNotEmpty",value:function(t){return!this.isEmpty(t)}},{key:"isFunction",value:function(t){return!!(t&&t.constructor&&t.call&&t.apply)}},{key:"isObject",value:function(t){return t!==null&&t instanceof Object&&t.constructor===Object}},{key:"isDate",value:function(t){return t!==null&&t instanceof Date&&t.constructor===Date}},{key:"isArray",value:function(t){return t!==null&&Array.isArray(t)}},{key:"isString",value:function(t){return t!==null&&typeof t=="string"}},{key:"isPrintableCharacter",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return this.isNotEmpty(t)&&t.length===1&&t.match(/\S| /)}},{key:"isLetter",value:function(t){return/^[a-zA-Z\u00C0-\u017F]$/.test(t)}},{key:"isScalar",value:function(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="bigint"||typeof t=="boolean")}},{key:"findLast",value:function(t,n){var i;if(this.isNotEmpty(t))try{i=t.findLast(n)}catch{i=$o(t).reverse().find(n)}return i}},{key:"findLastIndex",value:function(t,n){var i=-1;if(this.isNotEmpty(t))try{i=t.findLastIndex(n)}catch{i=t.lastIndexOf($o(t).reverse().find(n))}return i}},{key:"sort",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=arguments.length>3?arguments[3]:void 0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=this.compare(t,n,s,i),l=i;return(this.isEmpty(t)||this.isEmpty(n))&&(l=o===1?i:o),l*a}},{key:"compare",value:function(t,n,i){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,o=-1,a=this.isEmpty(t),l=this.isEmpty(n);return a&&l?o=0:a?o=s:l?o=-s:typeof t=="string"&&typeof n=="string"?o=i(t,n):o=t<n?-1:t>n?1:0,o}},{key:"localeComparator",value:function(t){return new Intl.Collator(t,{numeric:!0}).compare}},{key:"findChildrenByKey",value:function(t,n){var i=Z0(t),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;if(o.key===n)return o.children||[];if(o.children){var a=this.findChildrenByKey(o.children,n);if(a.length>0)return a}}}catch(l){i.e(l)}finally{i.f()}return[]}},{key:"mutateFieldData",value:function(t,n,i){if(!(De(t)!=="object"||typeof n!="string"))for(var s=n.split("."),o=t,a=0,l=s.length;a<l;++a){if(a+1-l===0){o[s[a]]=i;break}o[s[a]]||(o[s[a]]={}),o=o[s[a]]}}},{key:"getNestedValue",value:function(t,n){return n.split(".").reduce(function(i,s){return i&&i[s]!==void 0?i[s]:void 0},t)}},{key:"absoluteCompare",value:function(t,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;if(!t||!n||s>i)return!0;if(De(t)!==De(n))return!1;var o=Object.keys(t),a=Object.keys(n);if(o.length!==a.length)return!1;for(var l=0,u=o;l<u.length;l++){var c=u[l],d=t[c],f=n[c],h=r.isObject(d)&&r.isObject(f),m=r.isFunction(d)&&r.isFunction(f);if((h||m)&&!this.absoluteCompare(d,f,i,s+1)||!h&&d!==f)return!1}return!0}},{key:"selectiveCompare",value:function(t,n,i){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(t===n)return!0;if(!t||!n||De(t)!=="object"||De(n)!=="object")return!1;if(!i)return this.absoluteCompare(t,n,1);var o=Z0(i),a;try{for(o.s();!(a=o.n()).done;){var l=a.value,u=this.getNestedValue(t,l),c=this.getNestedValue(n,l),d=De(u)==="object"&&u!==null&&De(c)==="object"&&c!==null;if(d&&!this.absoluteCompare(u,c,s)||!d&&u!==c)return!1}}catch(f){o.e(f)}finally{o.f()}return!0}}])})(),eu=0;function _1(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"pr_id_";return eu++,"".concat(r).concat(eu)}function tu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ru(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tu(Object(t),!0).forEach(function(n){Ho(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):tu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Yi(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(r){var t=function(o){return typeof o=="function"},n=e.classNameMergeFunction,i=t(n);return r.reduce(function(s,o){if(!o)return s;var a=function(){var c=o[l];if(l==="style")s.style=ru(ru({},s.style),o.style);else if(l==="className"){var d="";i?d=n(s.className,o.className):d=[s.className,o.className].join(" ").trim(),s.className=d||void 0}else if(t(c)){var f=s[l];s[l]=f?function(){f.apply(void 0,arguments),c.apply(void 0,arguments)}:c}else s[l]=c};for(var l in o)a();return s},{})}}var rt=Object.freeze({STARTS_WITH:"startsWith",CONTAINS:"contains",NOT_CONTAINS:"notContains",ENDS_WITH:"endsWith",EQUALS:"equals",NOT_EQUALS:"notEquals",IN:"in",NOT_IN:"notIn",LESS_THAN:"lt",LESS_THAN_OR_EQUAL_TO:"lte",GREATER_THAN:"gt",GREATER_THAN_OR_EQUAL_TO:"gte",BETWEEN:"between",DATE_IS:"dateIs",DATE_IS_NOT:"dateIsNot",DATE_BEFORE:"dateBefore",DATE_AFTER:"dateAfter",CUSTOM:"custom"});function ri(r){"@babel/helpers - typeof";return ri=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ri(r)}function j1(r,e){if(ri(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(ri(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function q1(r){var e=j1(r,"string");return ri(e)=="symbol"?e:e+""}function wt(r,e,t){return(e=q1(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function W1(r,e,t){return Object.defineProperty(r,"prototype",{writable:!1}),r}function U1(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var ft=W1(function r(){U1(this,r)});wt(ft,"ripple",!1),wt(ft,"inputStyle","outlined"),wt(ft,"locale","en"),wt(ft,"appendTo",null),wt(ft,"cssTransition",!0),wt(ft,"autoZIndex",!0),wt(ft,"hideOverlaysOnDocumentScrolling",!1),wt(ft,"nonce",null),wt(ft,"nullSortOrder",1),wt(ft,"zIndex",{modal:1100,overlay:1e3,menu:1e3,tooltip:1100,toast:1200}),wt(ft,"pt",void 0),wt(ft,"filterMatchModeOptions",{text:[rt.STARTS_WITH,rt.CONTAINS,rt.NOT_CONTAINS,rt.ENDS_WITH,rt.EQUALS,rt.NOT_EQUALS],numeric:[rt.EQUALS,rt.NOT_EQUALS,rt.LESS_THAN,rt.LESS_THAN_OR_EQUAL_TO,rt.GREATER_THAN,rt.GREATER_THAN_OR_EQUAL_TO],date:[rt.DATE_IS,rt.DATE_IS_NOT,rt.DATE_BEFORE,rt.DATE_AFTER]}),wt(ft,"changeTheme",function(r,e,t,n){var i,s=document.getElementById(t);if(!s)throw Error("Element with id ".concat(t," not found."));var o=s.getAttribute("href").replace(r,e),a=document.createElement("link");a.setAttribute("rel","stylesheet"),a.setAttribute("id",t),a.setAttribute("href",o),a.addEventListener("load",function(){n&&n()}),(i=s.parentNode)===null||i===void 0||i.replaceChild(a,s)});var _o=z.createContext(),Ji=ft;function G1(r){if(Array.isArray(r))return r}function K1(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(r)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function nu(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function Y1(r,e){if(r){if(typeof r=="string")return nu(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?nu(r,e):void 0}}function J1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
17
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X1(r,e){return G1(r)||K1(r,e)||Y1(r,e)||J1()}var iu=function(e){var t=ce.useRef(null);return ce.useEffect(function(){return t.current=e,function(){t.current=null}},[e]),t.current},su=function(e){return ce.useEffect(function(){return e},[])},ou=function(e){var t=e.target,n=t===void 0?"document":t,i=e.type,s=e.listener,o=e.options,a=e.when,l=a===void 0?!0:a,u=ce.useRef(null),c=ce.useRef(null),d=iu(s),f=iu(o),h=function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},E=k.target;Ee.isNotEmpty(E)&&(m(),(k.when||l)&&(u.current=Te.getTargetElement(E))),!c.current&&u.current&&(c.current=function(R){return s&&s(R)},u.current.addEventListener(i,c.current,o))},m=function(){c.current&&(u.current.removeEventListener(i,c.current,o),c.current=null)},v=function(){m(),d=null,f=null},y=ce.useCallback(function(){l?u.current=Te.getTargetElement(n):(m(),u.current=null)},[n,l]);return ce.useEffect(function(){y()},[y]),ce.useEffect(function(){var w="".concat(d)!=="".concat(s),k=f!==o,E=c.current;E&&(w||k)?(m(),l&&h()):E||v()},[s,o,l]),su(function(){v()}),[h,m]},Z1=function(){var e=z.useContext(_o);return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Yi(n,e?.ptOptions)}},au=function(e){var t=ce.useRef(!1);return ce.useEffect(function(){if(!t.current)return t.current=!0,e&&e()},[])},Q1=0,Xi=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=z.useState(!1),i=X1(n,2),s=i[0],o=i[1],a=z.useRef(null),l=z.useContext(_o),u=Te.isClient()?window.document:void 0,c=t.document,d=c===void 0?u:c,f=t.manual,h=f===void 0?!1:f,m=t.name,v=m===void 0?"style_".concat(++Q1):m,y=t.id,w=y===void 0?void 0:y,k=t.media,E=k===void 0?void 0:k,R=function(L){var V=L.querySelector('style[data-primereact-style-id="'.concat(v,'"]'));if(V)return V;if(w!==void 0){var te=d.getElementById(w);if(te)return te}return d.createElement("style")},O=function(L){s&&e!==L&&(a.current.textContent=L)},N=function(){if(!(!d||s)){var L=l?.styleContainer||d.head;a.current=R(L),a.current.isConnected||(a.current.type="text/css",w&&(a.current.id=w),E&&(a.current.media=E),Te.addNonce(a.current,l&&l.nonce||Ji.nonce),L.appendChild(a.current),v&&a.current.setAttribute("data-primereact-style-id",v)),a.current.textContent=e,o(!0)}},D=function(){!d||!a.current||(Te.removeInlineStyle(a.current),o(!1))};return z.useEffect(function(){h||N()},[h]),{id:w,name:v,update:O,unload:D,load:N,isLoaded:s}},eg=function(e,t){var n=ce.useRef(!1);return ce.useEffect(function(){if(!n.current){n.current=!0;return}return e&&e()},t)};function jo(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function tg(r){if(Array.isArray(r))return jo(r)}function rg(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function ng(r,e){if(r){if(typeof r=="string")return jo(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?jo(r,e):void 0}}function ig(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
18
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lu(r){return tg(r)||rg(r)||ng(r)||ig()}function ni(r){"@babel/helpers - typeof";return ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ni(r)}function sg(r,e){if(ni(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(ni(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function og(r){var e=sg(r,"string");return ni(e)=="symbol"?e:e+""}function qo(r,e,t){return(e=og(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ke(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uu(Object(t),!0).forEach(function(n){qo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):uu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var ag=`
19
19
  .p-hidden-accessible {
20
20
  border: 0;
21
21
  clip: rect(0 0 0 0);
@@ -419,7 +419,7 @@ svg.p-icon g,
419
419
  `).concat(ug,`
420
420
  `).concat(cg,`
421
421
  }
422
- `),He={cProps:void 0,cParams:void 0,cName:void 0,defaultProps:{pt:void 0,ptOptions:void 0,unstyled:!1},context:{},globalCSS:void 0,classes:{},styles:"",extend:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.css,n=Ke(Ke({},e.defaultProps),He.defaultProps),i={},s=function(c){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return He.context=d,He.cProps=c,Ee.getMergedProps(c,n)},o=function(c){return Ee.getDiffProps(c,n)},a=function(){var c,d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;d.hasOwnProperty("pt")&&d.pt!==void 0&&(d=d.pt);var v=f,y=/./g.test(v)&&!!h[v.split(".")[0]],w=y?Ee.toFlatCase(v.split(".")[1]):Ee.toFlatCase(v),k=h.hostName&&Ee.toFlatCase(h.hostName),E=k||h.props&&h.props.__TYPE&&Ee.toFlatCase(h.props.__TYPE)||"",R=w==="transition",O="data-pc-",N=function(ee){return ee!=null&&ee.props?ee.hostName?ee.props.__TYPE===ee.hostName?ee.props:N(ee.parent):ee.parent:void 0},D=function(ee){var Se,C;return((Se=h.props)===null||Se===void 0?void 0:Se[ee])||((C=N(h))===null||C===void 0?void 0:C[ee])};He.cParams=h,He.cName=E;var B=D("ptOptions")||He.context.ptOptions||{},L=B.mergeSections,V=L===void 0?!0:L,te=B.mergeProps,ne=te===void 0?!1:te,he=function(){var ee=or.apply(void 0,arguments);return Array.isArray(ee)?{className:ti.apply(void 0,lu(ee))}:Ee.isString(ee)?{className:ee}:ee!=null&&ee.hasOwnProperty("className")&&Array.isArray(ee.className)?{className:ti.apply(void 0,lu(ee.className))}:ee},re=m?y?cu(he,v,h):du(he,v,h):void 0,G=y?void 0:Qi(Zi(d,E),he,v,h),X=!R&&Ke(Ke({},w==="root"&&_o({},"".concat(O,"name"),h.props&&h.props.__parentMetadata?Ee.toFlatCase(h.props.__TYPE):E)),{},_o({},"".concat(O,"section"),w));return V||!V&&G?ne?Yi([re,G,Object.keys(X).length?X:{}],{classNameMergeFunction:(c=He.context.ptOptions)===null||c===void 0?void 0:c.classNameMergeFunction}):Ke(Ke(Ke({},re),G),Object.keys(X).length?X:{}):Ke(Ke({},G),Object.keys(X).length?X:{})},l=function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=c.props,f=c.state,h=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return a((d||{}).pt,E,Ke(Ke({},c),R))},m=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return a(E,R,O,!1)},v=function(){return He.context.unstyled||Ji.unstyled||d.unstyled},y=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v()?void 0:or(t&&t.classes,E,Ke({props:d,state:f},R))},w=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(O){var N,D=or(t&&t.inlineStyles,E,Ke({props:d,state:f},R)),B=or(i,E,Ke({props:d,state:f},R));return Yi([B,D],{classNameMergeFunction:(N=He.context.ptOptions)===null||N===void 0?void 0:N.classNameMergeFunction})}};return{ptm:h,ptmo:m,sx:w,cx:y,isUnstyled:v}};return Ke(Ke({getProps:s,getOtherProps:o,setMetaData:l},e),{},{defaultProps:n})}},or=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=String(Ee.toFlatCase(t)).split("."),s=i.shift(),o=Ee.isNotEmpty(e)?Object.keys(e).find(function(a){return Ee.toFlatCase(a)===s}):"";return s?Ee.isObject(e)?or(Ee.getItemValue(e[o],n),i.join("."),n):void 0:Ee.getItemValue(e,n)},Zi=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,i=e?._usept,s=function(a){var l,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c=n?n(a):a,d=Ee.toFlatCase(t);return(l=u?d!==He.cName?c?.[d]:void 0:c?.[d])!==null&&l!==void 0?l:c};return Ee.isNotEmpty(i)?{_usept:i,originalValue:s(e.originalValue),value:s(e.value)}:s(e,!0)},Qi=function(e,t,n,i){var s=function(v){return t(v,n,i)};if(e!=null&&e.hasOwnProperty("_usept")){var o=e._usept||He.context.ptOptions||{},a=o.mergeSections,l=a===void 0?!0:a,u=o.mergeProps,c=u===void 0?!1:u,d=o.classNameMergeFunction,f=s(e.originalValue),h=s(e.value);return f===void 0&&h===void 0?void 0:Ee.isString(h)?h:Ee.isString(f)?f:l||!l&&h?c?Yi([f,h],{classNameMergeFunction:d}):Ke(Ke({},f),h):h}return s(e)},hg=function(){return Zi(He.context.pt||Ji.pt,void 0,function(e){return Ee.getItemValue(e,He.cParams)})},fg=function(){return Zi(He.context.pt||Ji.pt,void 0,function(e){return or(e,He.cName,He.cParams)||Ee.getItemValue(e,He.cParams)})},cu=function(e,t,n){return Qi(hg(),e,t,n)},du=function(e,t,n){return Qi(fg(),e,t,n)},pg=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},n=arguments.length>2?arguments[2]:void 0,i=n.name,s=n.styled,o=s===void 0?!1:s,a=n.hostName,l=a===void 0?"":a,u=cu(or,"global.css",He.cParams),c=Ee.toFlatCase(i),d=Xi(ag,{name:"base",manual:!0}),f=d.load,h=Xi(dg,{name:"common",manual:!0}),m=h.load,v=Xi(u,{name:"global",manual:!0}),y=v.load,w=Xi(e,{name:i,manual:!0}),k=w.load,E=function(O){if(!l){var N=Qi(Zi((He.cProps||{}).pt,c),or,"hooks.".concat(O)),D=du(or,"hooks.".concat(O));N?.(),D?.()}};E("useMountEffect"),au(function(){f(),y(),t()||(m(),o||k())}),eg(function(){E("useUpdateEffect")}),su(function(){E("useUnmountEffect")})};function Wo(){return Wo=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Wo.apply(null,arguments)}function Uo(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function mg(r){if(Array.isArray(r))return Uo(r)}function gg(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function hu(r,e){if(r){if(typeof r=="string")return Uo(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Uo(r,e):void 0}}function vg(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
422
+ `),He={cProps:void 0,cParams:void 0,cName:void 0,defaultProps:{pt:void 0,ptOptions:void 0,unstyled:!1},context:{},globalCSS:void 0,classes:{},styles:"",extend:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.css,n=Ke(Ke({},e.defaultProps),He.defaultProps),i={},s=function(c){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return He.context=d,He.cProps=c,Ee.getMergedProps(c,n)},o=function(c){return Ee.getDiffProps(c,n)},a=function(){var c,d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;d.hasOwnProperty("pt")&&d.pt!==void 0&&(d=d.pt);var v=f,y=/./g.test(v)&&!!h[v.split(".")[0]],w=y?Ee.toFlatCase(v.split(".")[1]):Ee.toFlatCase(v),k=h.hostName&&Ee.toFlatCase(h.hostName),E=k||h.props&&h.props.__TYPE&&Ee.toFlatCase(h.props.__TYPE)||"",R=w==="transition",O="data-pc-",N=function(ee){return ee!=null&&ee.props?ee.hostName?ee.props.__TYPE===ee.hostName?ee.props:N(ee.parent):ee.parent:void 0},D=function(ee){var Se,C;return((Se=h.props)===null||Se===void 0?void 0:Se[ee])||((C=N(h))===null||C===void 0?void 0:C[ee])};He.cParams=h,He.cName=E;var B=D("ptOptions")||He.context.ptOptions||{},L=B.mergeSections,V=L===void 0?!0:L,te=B.mergeProps,ne=te===void 0?!1:te,he=function(){var ee=or.apply(void 0,arguments);return Array.isArray(ee)?{className:ti.apply(void 0,lu(ee))}:Ee.isString(ee)?{className:ee}:ee!=null&&ee.hasOwnProperty("className")&&Array.isArray(ee.className)?{className:ti.apply(void 0,lu(ee.className))}:ee},re=m?y?cu(he,v,h):du(he,v,h):void 0,G=y?void 0:Qi(Zi(d,E),he,v,h),Z=!R&&Ke(Ke({},w==="root"&&qo({},"".concat(O,"name"),h.props&&h.props.__parentMetadata?Ee.toFlatCase(h.props.__TYPE):E)),{},qo({},"".concat(O,"section"),w));return V||!V&&G?ne?Yi([re,G,Object.keys(Z).length?Z:{}],{classNameMergeFunction:(c=He.context.ptOptions)===null||c===void 0?void 0:c.classNameMergeFunction}):Ke(Ke(Ke({},re),G),Object.keys(Z).length?Z:{}):Ke(Ke({},G),Object.keys(Z).length?Z:{})},l=function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=c.props,f=c.state,h=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return a((d||{}).pt,E,Ke(Ke({},c),R))},m=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return a(E,R,O,!1)},v=function(){return He.context.unstyled||Ji.unstyled||d.unstyled},y=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v()?void 0:or(t&&t.classes,E,Ke({props:d,state:f},R))},w=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(O){var N,D=or(t&&t.inlineStyles,E,Ke({props:d,state:f},R)),B=or(i,E,Ke({props:d,state:f},R));return Yi([B,D],{classNameMergeFunction:(N=He.context.ptOptions)===null||N===void 0?void 0:N.classNameMergeFunction})}};return{ptm:h,ptmo:m,sx:w,cx:y,isUnstyled:v}};return Ke(Ke({getProps:s,getOtherProps:o,setMetaData:l},e),{},{defaultProps:n})}},or=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=String(Ee.toFlatCase(t)).split("."),s=i.shift(),o=Ee.isNotEmpty(e)?Object.keys(e).find(function(a){return Ee.toFlatCase(a)===s}):"";return s?Ee.isObject(e)?or(Ee.getItemValue(e[o],n),i.join("."),n):void 0:Ee.getItemValue(e,n)},Zi=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,i=e?._usept,s=function(a){var l,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c=n?n(a):a,d=Ee.toFlatCase(t);return(l=u?d!==He.cName?c?.[d]:void 0:c?.[d])!==null&&l!==void 0?l:c};return Ee.isNotEmpty(i)?{_usept:i,originalValue:s(e.originalValue),value:s(e.value)}:s(e,!0)},Qi=function(e,t,n,i){var s=function(v){return t(v,n,i)};if(e!=null&&e.hasOwnProperty("_usept")){var o=e._usept||He.context.ptOptions||{},a=o.mergeSections,l=a===void 0?!0:a,u=o.mergeProps,c=u===void 0?!1:u,d=o.classNameMergeFunction,f=s(e.originalValue),h=s(e.value);return f===void 0&&h===void 0?void 0:Ee.isString(h)?h:Ee.isString(f)?f:l||!l&&h?c?Yi([f,h],{classNameMergeFunction:d}):Ke(Ke({},f),h):h}return s(e)},hg=function(){return Zi(He.context.pt||Ji.pt,void 0,function(e){return Ee.getItemValue(e,He.cParams)})},fg=function(){return Zi(He.context.pt||Ji.pt,void 0,function(e){return or(e,He.cName,He.cParams)||Ee.getItemValue(e,He.cParams)})},cu=function(e,t,n){return Qi(hg(),e,t,n)},du=function(e,t,n){return Qi(fg(),e,t,n)},pg=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){},n=arguments.length>2?arguments[2]:void 0,i=n.name,s=n.styled,o=s===void 0?!1:s,a=n.hostName,l=a===void 0?"":a,u=cu(or,"global.css",He.cParams),c=Ee.toFlatCase(i),d=Xi(ag,{name:"base",manual:!0}),f=d.load,h=Xi(dg,{name:"common",manual:!0}),m=h.load,v=Xi(u,{name:"global",manual:!0}),y=v.load,w=Xi(e,{name:i,manual:!0}),k=w.load,E=function(O){if(!l){var N=Qi(Zi((He.cProps||{}).pt,c),or,"hooks.".concat(O)),D=du(or,"hooks.".concat(O));N?.(),D?.()}};E("useMountEffect"),au(function(){f(),y(),t()||(m(),o||k())}),eg(function(){E("useUpdateEffect")}),su(function(){E("useUnmountEffect")})};function Wo(){return Wo=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Wo.apply(null,arguments)}function Uo(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function mg(r){if(Array.isArray(r))return Uo(r)}function gg(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function hu(r,e){if(r){if(typeof r=="string")return Uo(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Uo(r,e):void 0}}function vg(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
423
423
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fu(r){return mg(r)||gg(r)||hu(r)||vg()}function ii(r){"@babel/helpers - typeof";return ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ii(r)}function yg(r,e){if(ii(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(ii(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function bg(r){var e=yg(r,"string");return ii(e)=="symbol"?e:e+""}function wg(r,e,t){return(e=bg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xg(r){if(Array.isArray(r))return r}function Sg(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(r)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function kg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
424
424
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function es(r,e){return xg(r)||Sg(r,e)||hu(r,e)||kg()}var Tg={root:function(e){var t=e.props;return ti("p-splitter p-component p-splitter-".concat(t.layout))},gutter:"p-splitter-gutter",gutterHandler:"p-splitter-gutter-handle",panel:{root:"p-splitter-panel"}},Mg=`
425
425
  @layer primereact {
@@ -483,8 +483,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
483
483
  }
484
484
  }
485
485
 
486
- `,ts=He.extend({defaultProps:{__TYPE:"Splitter",className:null,gutterSize:4,id:null,step:5,layout:"horizontal",onResizeEnd:null,stateKey:null,stateStorage:"session",style:null,children:void 0},css:{classes:Tg,styles:Mg}}),rs=He.extend({defaultProps:{__TYPE:"SplitterPanel",className:null,minSize:null,size:null,style:null,children:void 0},getCProps:function(e){return Ee.getComponentProps(e,rs.defaultProps)},getCOtherProps:function(e){return Ee.getComponentDiffProps(e,rs.defaultProps)},getCProp:function(e,t){return Ee.getComponentProp(e,t,rs.defaultProps)}});function pu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Go(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pu(Object(t),!0).forEach(function(n){wg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):pu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Ko=function(){},mu=ce.memo(ce.forwardRef(function(r,e){var t=Z1(),n=ce.useContext(jo),i=ts.getProps(r,n),s=ce.useRef(""),o=ce.useRef(null),a=ce.useRef(),l=ce.useRef({}),u=ce.useRef(null),c=ce.useRef(null),d=ce.useRef(null),f=ce.useRef(null),h=ce.useRef(null),m=ce.useRef(null),v=ce.useRef(null),y=ce.useRef(null),w=ce.useRef(null),k=ce.useRef(null),E=ce.useRef(null),R=ce.useRef(null),O=ce.useState([]),N=es(O,2),D=N[0],B=N[1],L=ce.useState(!1),V=es(L,2),te=V[0],ne=V[1],he=i.stateKey!=null,re=i.children&&i.children.length||1,G=function(K,Q){return Q in K?K[Q]:i.children&&[].concat(i.children)[Q].props.size||100/re},X=i.layout==="horizontal",ve={props:i,state:{panelSizes:D,nested:Te.getAttribute(o.current&&o.current.parentElement,"data-p-splitter-panel-nested")===!0}},ee=ts.setMetaData(Go({},ve)),Se=ee.ptm,C=ee.cx,x=ee.isUnstyled;pg(ts.css.styles,x,{name:"splitter"});var I=function(K){return Se(K,{context:{nested:te}})},q=ou({type:"mousemove",listener:function(K){return z0(K)}}),W=es(q,2),fe=W[0],Le=W[1],me=ou({type:"mouseup",listener:function(K){L0(K),P0()}}),Ue=es(me,2),At=Ue[0],en=Ue[1],R0=function(){fe(),At()},P0=function(){Le(),en()},_t=function(K,Q){return rs.getCProp(K,Q)},ji=function(K,Q){return!(K>100||K<0||Q>100||Q<0||i.children[E.current].props&&i.children[E.current].props.minSize&&i.children[E.current].props.minSize>K||i.children[E.current+1].props&&i.children[E.current+1].props.minSize&&i.children[E.current+1].props.minSize>Q)},Lo=function(){c.current=!1,u.current=null,d.current=null,f.current=null,h.current=null,m.current=null,y.current=null,w.current=null,k.current=null,E.current=null},Jn=ce.useCallback(function(){switch(i.stateStorage){case"local":return window.localStorage;case"session":return window.sessionStorage;default:throw new Error(i.stateStorage+' is not a valid value for the state storage, supported values are "local" and "session".')}},[i.stateStorage]),qi=function(K){Ee.isArray(K)&&Jn().setItem(i.stateKey,JSON.stringify(K))},kn=ce.useCallback(function(){var we=Jn().getItem(i.stateKey);we&&B(JSON.parse(we))},[Jn,i.stateKey]),tn=function(K,Q,ke){var rn=K.type==="touchstart"?K.touches[0].pageX:K.pageX,nn=K.type==="touchstart"?K.touches[0].pageY:K.pageY;a.current=l.current[Q],u.current=X?Te.getWidth(o.current):Te.getHeight(o.current),c.current=!0,d.current=X?rn:nn,f.current=a.current.previousElementSibling,h.current=a.current.nextElementSibling,ke?(m.current=X?Te.getOuterWidth(f.current,!0):Te.getOuterHeight(f.current,!0),w.current=X?Te.getOuterWidth(h.current,!0):Te.getOuterHeight(h.current,!0)):(m.current=100*(X?Te.getOuterWidth(f.current,!0):Te.getOuterHeight(f.current,!0))/u.current,w.current=100*(X?Te.getOuterWidth(h.current,!0):Te.getOuterHeight(h.current,!0))/u.current),y.current=m.current,k.current=w.current,E.current=Q,!x()&&Te.addClass(a.current,"p-splitter-gutter-resizing"),a.current.setAttribute("data-p-splitter-gutter-resizing",!0),!x()&&Te.addClass(o.current,"p-splitter-resizing"),o.current.setAttribute("data-p-splitter-resizing",!0)},z0=function(K){var Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,rn,nn,Xn,$0=K.type==="touchmove"?K.touches[0].pageX:K.pageX,H0=K.type==="touchmove"?K.touches[0].pageY:K.pageY;ke?X?(Xn=100*(m.current+Q)/u.current,nn=100*(w.current-Q)/u.current):(Xn=100*(m.current-Q)/u.current,nn=100*(w.current+Q)/u.current):(X?rn=$0*100/u.current-d.current*100/u.current:rn=H0*100/u.current-d.current*100/u.current,Xn=m.current+rn,nn=w.current-rn),_i(E.current,Xn,nn)},L0=function(K){var Q=fu(D);Q[E.current]=y.current,Q[E.current+1]=k.current,i.onResizeEnd&&i.onResizeEnd({originalEvent:K,sizes:Q}),he&&qi(Q),B(Q),!x()&&Te.removeClass(a.current,"p-splitter-gutter-resizing"),l.current&&Object.keys(l.current).forEach(function(ke){return l.current[ke].setAttribute("data-p-splitter-gutter-resizing",!1)}),!x()&&Te.removeClass(o.current,"p-splitter-resizing"),o.current.setAttribute("data-p-splitter-resizing",!1),Lo()},Cx=function(){Ox(),L0()},Ex=function(K,Q){var ke=i.children[Q].props&&i.children[Q].props.minSize||0;switch(K.code){case"ArrowLeft":{X&&Bo(K,Q,i.step*-1),K.preventDefault();break}case"ArrowRight":{X&&Bo(K,Q,i.step),K.preventDefault();break}case"ArrowDown":{X||Bo(K,Q,i.step*-1),K.preventDefault();break}case"ArrowUp":{X||Bo(K,Q,i.step),K.preventDefault();break}case"Home":{_i(Q,100-ke,ke),K.preventDefault();break}case"End":{_i(Q,ke,100-ke),K.preventDefault();break}case"NumpadEnter":case"Enter":{v.current>=100-(ke||5)?_i(Q,ke,100-ke):_i(Q,100-ke,ke),K.preventDefault();break}}},_i=function(K,Q,ke){E.current=K,a.current=l.current[K],u.current=X?Te.getWidth(o.current):Te.getHeight(o.current),f.current=a.current.previousElementSibling,h.current=a.current.nextElementSibling,ji(Q,ke)&&(y.current=Q,k.current=ke,f.current.style.flexBasis="calc("+Q+"% - "+(i.children.length-1)*i.gutterSize+"px)",h.current.style.flexBasis="calc("+ke+"% - "+(i.children.length-1)*i.gutterSize+"px)",v.current=parseFloat(Q).toFixed(4))},Ax=function(K,Q,ke){tn(K,Q,!0),z0(K,ke,!0)},Bo=function(K,Q,ke){R.current||(R.current=setInterval(function(){Ax(K,Q,ke)},40))},Ox=function(){R.current&&(clearInterval(R.current),R.current=null)},Nx=function(K,Q){tn(K,Q,!1),R0()},Dx=function(K,Q){tn(K,Q,!1),window.addEventListener("touchmove",B0,{passive:!1,cancelable:!1}),window.addEventListener("touchend",F0)},B0=function(K){z0(K)},F0=function(K){L0(K),window.removeEventListener("touchmove",B0),window.removeEventListener("touchend",F0)};ce.useImperativeHandle(e,function(){return{props:i,getElement:function(){return o.current}}}),au(function(){o.current&&(s.current=j1())}),ce.useEffect(function(){var we=fu(o.current.children).filter(function(Q){return Te.getAttribute(Q,"data-pc-section")==="splitterpanel.root"}),K=[];we.map(function(Q,ke){v.current=G(D,0),K[ke]=G(D,ke),Q.childNodes&&Ee.isNotEmpty(Te.find(Q,"[data-pc-name='splitter']")&&Te.find(Q,"[data-pc-section='root']"))&&(!x()&&Te.addClass(Q,"p-splitter-panel-nested"),Q.setAttribute("data-p-splitter-panel-nested",!0),ne(!0))}),B(K)},[]),ce.useEffect(function(){he&&kn()},[kn,he]);var Ix=function(K,Q){var ke=_t(K,"id")||"".concat(s.current,"_").concat(Q),rn=ti(_t(K,"className"),C("panel.root")),nn=t({ref:function(Wt){return l.current[Q]=Wt},className:C("gutter"),style:X?{width:i.gutterSize+"px"}:{height:i.gutterSize+"px"},onMouseDown:function(Wt){return Nx(Wt,Q)},onKeyDown:function(Wt){return Ex(Wt,Q)},onKeyUp:Cx,onTouchStart:function(Wt){return Dx(Wt,Q)},onTouchMove:function(Wt){return B0(Wt)},onTouchEnd:function(Wt){return F0(Wt)},"data-p-splitter-gutter-resizing":!1},Se("gutter")),Xn=t({tabIndex:_t(K,"tabIndex")||0,className:C("gutterHandler"),role:"separator","aria-orientation":X?"vertical":"horizontal","aria-controls":ke,"aria-label":_t(K,"aria-label"),"aria-labelledby":_t(K,"aria-labelledby"),"aria-valuenow":v.current,"aria-valuetext":parseFloat(v.current).toFixed(0)+"%","aria-valuemin":_t(K,"minSize")||"0","aria-valuemax":"100"},Se("gutterHandler")),$0=Q!==i.children.length-1&&ce.createElement("div",nn,ce.createElement("div",Xn)),H0="calc("+G(D,Q)+"% - "+(re-1)*i.gutterSize+"px)",Lx=t({key:Q,id:ke,className:rn,style:Go(Go({},_t(K,"style")),{},{flexBasis:H0}),role:"presentation","data-p-splitter-panel-nested":!1,onClick:_t(K,"onClick")},I("splitterpanel.root"));return ce.createElement(ce.Fragment,null,ce.createElement("div",Lx,_t(K,"children")),$0)},Rx=function(){return ce.Children.map(i.children,Ix)},Px=t({id:i.id,style:i.style,className:ti(i.className,C("root")),"data-p-splitter-resizing":!1},ts.getOtherProps(i),Se("root")),zx=Rx();return ce.createElement("div",Wo({ref:o},Px),zx)}));Ko.displayName="SplitterPanel",mu.displayName="Splitter";function gu(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function Cg(r){if(Array.isArray(r))return r}function Eg(r,e,t){return(e=Pg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ag(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(r)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function Og(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
487
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function yu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vu(Object(t),!0).forEach(function(n){Eg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ng(r,e){if(r==null)return{};var t,n,i=Dg(r,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function Dg(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}function Ig(r,e){return Cg(r)||Ag(r,e)||zg(r,e)||Og()}function Rg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Pg(r){var e=Rg(r,"string");return typeof e=="symbol"?e:e+""}function zg(r,e){if(r){if(typeof r=="string")return gu(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?gu(r,e):void 0}}function Lg(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function wu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bu(Object(t),!0).forEach(function(n){Lg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):bu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Bg(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return function(n){return e.reduceRight(function(i,s){return s(i)},n)}}function si(r){return function e(){for(var t=this,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return i.length>=r.length?r.apply(this,i):function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return e.apply(t,[].concat(i,a))}}}function ns(r){return{}.toString.call(r).includes("Object")}function Fg(r){return!Object.keys(r).length}function oi(r){return typeof r=="function"}function $g(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Hg(r,e){return ns(e)||Er("changeType"),Object.keys(e).some(function(t){return!$g(r,t)})&&Er("changeField"),e}function Vg(r){oi(r)||Er("selectorType")}function jg(r){oi(r)||ns(r)||Er("handlerType"),ns(r)&&Object.values(r).some(function(e){return!oi(e)})&&Er("handlersType")}function qg(r){r||Er("initialIsRequired"),ns(r)||Er("initialType"),Fg(r)&&Er("initialContent")}function _g(r,e){throw new Error(r[e]||r.default)}var Wg={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Er=si(_g)(Wg),is={changes:Hg,selector:Vg,handler:jg,initial:qg};function Ug(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};is.initial(r),is.handler(e);var t={current:r},n=si(Yg)(t,e),i=si(Kg)(t),s=si(is.changes)(r),o=si(Gg)(t);function a(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(c){return c};return is.selector(u),u(t.current)}function l(u){Bg(n,i,s,o)(u)}return[a,l]}function Gg(r,e){return oi(e)?e(r.current):e}function Kg(r,e){return r.current=wu(wu({},r.current),e),e}function Yg(r,e,t){return oi(e)?e(r.current):Object.keys(t).forEach(function(n){var i;return(i=e[n])===null||i===void 0?void 0:i.call(e,r.current[n])}),t}var Jg={create:Ug},Xg={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Zg(r){return function e(){for(var t=this,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return i.length>=r.length?r.apply(this,i):function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return e.apply(t,[].concat(i,a))}}}function Qg(r){return{}.toString.call(r).includes("Object")}function e4(r){return r||Su("configIsRequired"),Qg(r)||Su("configType"),r.urls?(t4(),{paths:{vs:r.urls.monacoBase}}):r}function t4(){console.warn(xu.deprecation)}function r4(r,e){throw new Error(r[e]||r.default)}var xu={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
486
+ `,ts=He.extend({defaultProps:{__TYPE:"Splitter",className:null,gutterSize:4,id:null,step:5,layout:"horizontal",onResizeEnd:null,stateKey:null,stateStorage:"session",style:null,children:void 0},css:{classes:Tg,styles:Mg}}),rs=He.extend({defaultProps:{__TYPE:"SplitterPanel",className:null,minSize:null,size:null,style:null,children:void 0},getCProps:function(e){return Ee.getComponentProps(e,rs.defaultProps)},getCOtherProps:function(e){return Ee.getComponentDiffProps(e,rs.defaultProps)},getCProp:function(e,t){return Ee.getComponentProp(e,t,rs.defaultProps)}});function pu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Go(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pu(Object(t),!0).forEach(function(n){wg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):pu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}var Ko=function(){},mu=ce.memo(ce.forwardRef(function(r,e){var t=Z1(),n=ce.useContext(_o),i=ts.getProps(r,n),s=ce.useRef(""),o=ce.useRef(null),a=ce.useRef(),l=ce.useRef({}),u=ce.useRef(null),c=ce.useRef(null),d=ce.useRef(null),f=ce.useRef(null),h=ce.useRef(null),m=ce.useRef(null),v=ce.useRef(null),y=ce.useRef(null),w=ce.useRef(null),k=ce.useRef(null),E=ce.useRef(null),R=ce.useRef(null),O=ce.useState([]),N=es(O,2),D=N[0],B=N[1],L=ce.useState(!1),V=es(L,2),te=V[0],ne=V[1],he=i.stateKey!=null,re=i.children&&i.children.length||1,G=function(K,Q){return Q in K?K[Q]:i.children&&[].concat(i.children)[Q].props.size||100/re},Z=i.layout==="horizontal",ve={props:i,state:{panelSizes:D,nested:Te.getAttribute(o.current&&o.current.parentElement,"data-p-splitter-panel-nested")===!0}},ee=ts.setMetaData(Go({},ve)),Se=ee.ptm,C=ee.cx,x=ee.isUnstyled;pg(ts.css.styles,x,{name:"splitter"});var I=function(K){return Se(K,{context:{nested:te}})},j=ou({type:"mousemove",listener:function(K){return z0(K)}}),W=es(j,2),fe=W[0],Le=W[1],me=ou({type:"mouseup",listener:function(K){L0(K),P0()}}),Ue=es(me,2),At=Ue[0],en=Ue[1],R0=function(){fe(),At()},P0=function(){Le(),en()},qt=function(K,Q){return rs.getCProp(K,Q)},_i=function(K,Q){return!(K>100||K<0||Q>100||Q<0||i.children[E.current].props&&i.children[E.current].props.minSize&&i.children[E.current].props.minSize>K||i.children[E.current+1].props&&i.children[E.current+1].props.minSize&&i.children[E.current+1].props.minSize>Q)},Lo=function(){c.current=!1,u.current=null,d.current=null,f.current=null,h.current=null,m.current=null,y.current=null,w.current=null,k.current=null,E.current=null},Jn=ce.useCallback(function(){switch(i.stateStorage){case"local":return window.localStorage;case"session":return window.sessionStorage;default:throw new Error(i.stateStorage+' is not a valid value for the state storage, supported values are "local" and "session".')}},[i.stateStorage]),ji=function(K){Ee.isArray(K)&&Jn().setItem(i.stateKey,JSON.stringify(K))},kn=ce.useCallback(function(){var we=Jn().getItem(i.stateKey);we&&B(JSON.parse(we))},[Jn,i.stateKey]),tn=function(K,Q,ke){var rn=K.type==="touchstart"?K.touches[0].pageX:K.pageX,nn=K.type==="touchstart"?K.touches[0].pageY:K.pageY;a.current=l.current[Q],u.current=Z?Te.getWidth(o.current):Te.getHeight(o.current),c.current=!0,d.current=Z?rn:nn,f.current=a.current.previousElementSibling,h.current=a.current.nextElementSibling,ke?(m.current=Z?Te.getOuterWidth(f.current,!0):Te.getOuterHeight(f.current,!0),w.current=Z?Te.getOuterWidth(h.current,!0):Te.getOuterHeight(h.current,!0)):(m.current=100*(Z?Te.getOuterWidth(f.current,!0):Te.getOuterHeight(f.current,!0))/u.current,w.current=100*(Z?Te.getOuterWidth(h.current,!0):Te.getOuterHeight(h.current,!0))/u.current),y.current=m.current,k.current=w.current,E.current=Q,!x()&&Te.addClass(a.current,"p-splitter-gutter-resizing"),a.current.setAttribute("data-p-splitter-gutter-resizing",!0),!x()&&Te.addClass(o.current,"p-splitter-resizing"),o.current.setAttribute("data-p-splitter-resizing",!0)},z0=function(K){var Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ke=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,rn,nn,Xn,$0=K.type==="touchmove"?K.touches[0].pageX:K.pageX,H0=K.type==="touchmove"?K.touches[0].pageY:K.pageY;ke?Z?(Xn=100*(m.current+Q)/u.current,nn=100*(w.current-Q)/u.current):(Xn=100*(m.current-Q)/u.current,nn=100*(w.current+Q)/u.current):(Z?rn=$0*100/u.current-d.current*100/u.current:rn=H0*100/u.current-d.current*100/u.current,Xn=m.current+rn,nn=w.current-rn),qi(E.current,Xn,nn)},L0=function(K){var Q=fu(D);Q[E.current]=y.current,Q[E.current+1]=k.current,i.onResizeEnd&&i.onResizeEnd({originalEvent:K,sizes:Q}),he&&ji(Q),B(Q),!x()&&Te.removeClass(a.current,"p-splitter-gutter-resizing"),l.current&&Object.keys(l.current).forEach(function(ke){return l.current[ke].setAttribute("data-p-splitter-gutter-resizing",!1)}),!x()&&Te.removeClass(o.current,"p-splitter-resizing"),o.current.setAttribute("data-p-splitter-resizing",!1),Lo()},Cx=function(){Ox(),L0()},Ex=function(K,Q){var ke=i.children[Q].props&&i.children[Q].props.minSize||0;switch(K.code){case"ArrowLeft":{Z&&Bo(K,Q,i.step*-1),K.preventDefault();break}case"ArrowRight":{Z&&Bo(K,Q,i.step),K.preventDefault();break}case"ArrowDown":{Z||Bo(K,Q,i.step*-1),K.preventDefault();break}case"ArrowUp":{Z||Bo(K,Q,i.step),K.preventDefault();break}case"Home":{qi(Q,100-ke,ke),K.preventDefault();break}case"End":{qi(Q,ke,100-ke),K.preventDefault();break}case"NumpadEnter":case"Enter":{v.current>=100-(ke||5)?qi(Q,ke,100-ke):qi(Q,100-ke,ke),K.preventDefault();break}}},qi=function(K,Q,ke){E.current=K,a.current=l.current[K],u.current=Z?Te.getWidth(o.current):Te.getHeight(o.current),f.current=a.current.previousElementSibling,h.current=a.current.nextElementSibling,_i(Q,ke)&&(y.current=Q,k.current=ke,f.current.style.flexBasis="calc("+Q+"% - "+(i.children.length-1)*i.gutterSize+"px)",h.current.style.flexBasis="calc("+ke+"% - "+(i.children.length-1)*i.gutterSize+"px)",v.current=parseFloat(Q).toFixed(4))},Ax=function(K,Q,ke){tn(K,Q,!0),z0(K,ke,!0)},Bo=function(K,Q,ke){R.current||(R.current=setInterval(function(){Ax(K,Q,ke)},40))},Ox=function(){R.current&&(clearInterval(R.current),R.current=null)},Nx=function(K,Q){tn(K,Q,!1),R0()},Dx=function(K,Q){tn(K,Q,!1),window.addEventListener("touchmove",B0,{passive:!1,cancelable:!1}),window.addEventListener("touchend",F0)},B0=function(K){z0(K)},F0=function(K){L0(K),window.removeEventListener("touchmove",B0),window.removeEventListener("touchend",F0)};ce.useImperativeHandle(e,function(){return{props:i,getElement:function(){return o.current}}}),au(function(){o.current&&(s.current=_1())}),ce.useEffect(function(){var we=fu(o.current.children).filter(function(Q){return Te.getAttribute(Q,"data-pc-section")==="splitterpanel.root"}),K=[];we.map(function(Q,ke){v.current=G(D,0),K[ke]=G(D,ke),Q.childNodes&&Ee.isNotEmpty(Te.find(Q,"[data-pc-name='splitter']")&&Te.find(Q,"[data-pc-section='root']"))&&(!x()&&Te.addClass(Q,"p-splitter-panel-nested"),Q.setAttribute("data-p-splitter-panel-nested",!0),ne(!0))}),B(K)},[]),ce.useEffect(function(){he&&kn()},[kn,he]);var Ix=function(K,Q){var ke=qt(K,"id")||"".concat(s.current,"_").concat(Q),rn=ti(qt(K,"className"),C("panel.root")),nn=t({ref:function(Wt){return l.current[Q]=Wt},className:C("gutter"),style:Z?{width:i.gutterSize+"px"}:{height:i.gutterSize+"px"},onMouseDown:function(Wt){return Nx(Wt,Q)},onKeyDown:function(Wt){return Ex(Wt,Q)},onKeyUp:Cx,onTouchStart:function(Wt){return Dx(Wt,Q)},onTouchMove:function(Wt){return B0(Wt)},onTouchEnd:function(Wt){return F0(Wt)},"data-p-splitter-gutter-resizing":!1},Se("gutter")),Xn=t({tabIndex:qt(K,"tabIndex")||0,className:C("gutterHandler"),role:"separator","aria-orientation":Z?"vertical":"horizontal","aria-controls":ke,"aria-label":qt(K,"aria-label"),"aria-labelledby":qt(K,"aria-labelledby"),"aria-valuenow":v.current,"aria-valuetext":parseFloat(v.current).toFixed(0)+"%","aria-valuemin":qt(K,"minSize")||"0","aria-valuemax":"100"},Se("gutterHandler")),$0=Q!==i.children.length-1&&ce.createElement("div",nn,ce.createElement("div",Xn)),H0="calc("+G(D,Q)+"% - "+(re-1)*i.gutterSize+"px)",Lx=t({key:Q,id:ke,className:rn,style:Go(Go({},qt(K,"style")),{},{flexBasis:H0}),role:"presentation","data-p-splitter-panel-nested":!1,onClick:qt(K,"onClick")},I("splitterpanel.root"));return ce.createElement(ce.Fragment,null,ce.createElement("div",Lx,qt(K,"children")),$0)},Rx=function(){return ce.Children.map(i.children,Ix)},Px=t({id:i.id,style:i.style,className:ti(i.className,C("root")),"data-p-splitter-resizing":!1},ts.getOtherProps(i),Se("root")),zx=Rx();return ce.createElement("div",Wo({ref:o},Px),zx)}));Ko.displayName="SplitterPanel",mu.displayName="Splitter";function gu(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function Cg(r){if(Array.isArray(r))return r}function Eg(r,e,t){return(e=Pg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ag(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,s,o,a=[],l=!0,u=!1;try{if(s=(t=t.call(r)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function Og(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
487
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function yu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vu(Object(t),!0).forEach(function(n){Eg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ng(r,e){if(r==null)return{};var t,n,i=Dg(r,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function Dg(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}function Ig(r,e){return Cg(r)||Ag(r,e)||zg(r,e)||Og()}function Rg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Pg(r){var e=Rg(r,"string");return typeof e=="symbol"?e:e+""}function zg(r,e){if(r){if(typeof r=="string")return gu(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?gu(r,e):void 0}}function Lg(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function wu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bu(Object(t),!0).forEach(function(n){Lg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):bu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Bg(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return function(n){return e.reduceRight(function(i,s){return s(i)},n)}}function si(r){return function e(){for(var t=this,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return i.length>=r.length?r.apply(this,i):function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return e.apply(t,[].concat(i,a))}}}function ns(r){return{}.toString.call(r).includes("Object")}function Fg(r){return!Object.keys(r).length}function oi(r){return typeof r=="function"}function $g(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Hg(r,e){return ns(e)||Er("changeType"),Object.keys(e).some(function(t){return!$g(r,t)})&&Er("changeField"),e}function Vg(r){oi(r)||Er("selectorType")}function _g(r){oi(r)||ns(r)||Er("handlerType"),ns(r)&&Object.values(r).some(function(e){return!oi(e)})&&Er("handlersType")}function jg(r){r||Er("initialIsRequired"),ns(r)||Er("initialType"),Fg(r)&&Er("initialContent")}function qg(r,e){throw new Error(r[e]||r.default)}var Wg={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Er=si(qg)(Wg),is={changes:Hg,selector:Vg,handler:_g,initial:jg};function Ug(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};is.initial(r),is.handler(e);var t={current:r},n=si(Yg)(t,e),i=si(Kg)(t),s=si(is.changes)(r),o=si(Gg)(t);function a(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(c){return c};return is.selector(u),u(t.current)}function l(u){Bg(n,i,s,o)(u)}return[a,l]}function Gg(r,e){return oi(e)?e(r.current):e}function Kg(r,e){return r.current=wu(wu({},r.current),e),e}function Yg(r,e,t){return oi(e)?e(r.current):Object.keys(t).forEach(function(n){var i;return(i=e[n])===null||i===void 0?void 0:i.call(e,r.current[n])}),t}var Jg={create:Ug},Xg={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Zg(r){return function e(){for(var t=this,n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return i.length>=r.length?r.apply(this,i):function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return e.apply(t,[].concat(i,a))}}}function Qg(r){return{}.toString.call(r).includes("Object")}function e4(r){return r||Su("configIsRequired"),Qg(r)||Su("configType"),r.urls?(t4(),{paths:{vs:r.urls.monacoBase}}):r}function t4(){console.warn(xu.deprecation)}function r4(r,e){throw new Error(r[e]||r.default)}var xu={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
488
488
  You are using deprecated way of configuration.
489
489
 
490
490
  Instead of using
@@ -493,19 +493,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
493
493
  monaco.config({ paths: { vs: '...' } })
494
494
 
495
495
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
496
- `},Su=Zg(r4)(xu),n4={config:e4},i4=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(i){return t.reduceRight(function(s,o){return o(s)},i)}};function ku(r,e){return Object.keys(e).forEach(function(t){e[t]instanceof Object&&r[t]&&Object.assign(e[t],ku(r[t],e[t]))}),yu(yu({},r),e)}var s4={type:"cancelation",msg:"operation is manually canceled"};function Yo(r){var e=!1,t=new Promise(function(n,i){r.then(function(s){return e?i(s4):n(s)}),r.catch(i)});return t.cancel=function(){return e=!0},t}var o4=["monaco"],a4=Jg.create({config:Xg,isInitialized:!1,resolve:null,reject:null,monaco:null}),Tu=Ig(a4,2),ai=Tu[0],ss=Tu[1];function l4(r){var e=n4.config(r),t=e.monaco,n=Ng(e,o4);ss(function(i){return{config:ku(i.config,n),monaco:t}})}function u4(){var r=ai(function(e){var t=e.monaco,n=e.isInitialized,i=e.resolve;return{monaco:t,isInitialized:n,resolve:i}});if(!r.isInitialized){if(ss({isInitialized:!0}),r.monaco)return r.resolve(r.monaco),Yo(Jo);if(window.monaco&&window.monaco.editor)return Mu(window.monaco),r.resolve(window.monaco),Yo(Jo);i4(c4,h4)(f4)}return Yo(Jo)}function c4(r){return document.body.appendChild(r)}function d4(r){var e=document.createElement("script");return r&&(e.src=r),e}function h4(r){var e=ai(function(n){var i=n.config,s=n.reject;return{config:i,reject:s}}),t=d4("".concat(e.config.paths.vs,"/loader.js"));return t.onload=function(){return r()},t.onerror=e.reject,t}function f4(){var r=ai(function(t){var n=t.config,i=t.resolve,s=t.reject;return{config:n,resolve:i,reject:s}}),e=window.require;e.config(r.config),e(["vs/editor/editor.main"],function(t){var n=t.m||t;Mu(n),r.resolve(n)},function(t){r.reject(t)})}function Mu(r){ai().monaco||ss({monaco:r})}function p4(){return ai(function(r){var e=r.monaco;return e})}var Jo=new Promise(function(r,e){return ss({resolve:r,reject:e})}),Cu={config:l4,init:u4,__getMonacoInstance:p4},m4={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Xo=m4,g4={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},v4=g4;function y4({children:r}){return z.createElement("div",{style:v4.container},r)}var b4=y4,w4=b4;function x4({width:r,height:e,isEditorReady:t,loading:n,_ref:i,className:s,wrapperProps:o}){return z.createElement("section",{style:{...Xo.wrapper,width:r,height:e},...o},!t&&z.createElement(w4,null,n),z.createElement("div",{ref:i,style:{...Xo.fullWidth,...!t&&Xo.hide},className:s}))}var S4=x4,Eu=z.memo(S4);function k4(r){z.useEffect(r,[])}var Au=k4;function T4(r,e,t=!0){let n=z.useRef(!0);z.useEffect(n.current||!t?()=>{n.current=!1}:r,e)}var xt=T4;function li(){}function Tn(r,e,t,n){return M4(r,n)||C4(r,e,t,n)}function M4(r,e){return r.editor.getModel(Ou(r,e))}function C4(r,e,t,n){return r.editor.createModel(e,t,n?Ou(r,n):void 0)}function Ou(r,e){return r.Uri.parse(e)}function E4({original:r,modified:e,language:t,originalLanguage:n,modifiedLanguage:i,originalModelPath:s,modifiedModelPath:o,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:c="Loading...",options:d={},height:f="100%",width:h="100%",className:m,wrapperProps:v={},beforeMount:y=li,onMount:w=li}){let[k,E]=z.useState(!1),[R,O]=z.useState(!0),N=z.useRef(null),D=z.useRef(null),B=z.useRef(null),L=z.useRef(w),V=z.useRef(y),te=z.useRef(!1);Au(()=>{let G=Cu.init();return G.then(X=>(D.current=X)&&O(!1)).catch(X=>X?.type!=="cancelation"&&console.error("Monaco initialization: error:",X)),()=>N.current?re():G.cancel()}),xt(()=>{if(N.current&&D.current){let G=N.current.getOriginalEditor(),X=Tn(D.current,r||"",n||t||"text",s||"");X!==G.getModel()&&G.setModel(X)}},[s],k),xt(()=>{if(N.current&&D.current){let G=N.current.getModifiedEditor(),X=Tn(D.current,e||"",i||t||"text",o||"");X!==G.getModel()&&G.setModel(X)}},[o],k),xt(()=>{let G=N.current.getModifiedEditor();G.getOption(D.current.editor.EditorOption.readOnly)?G.setValue(e||""):e!==G.getValue()&&(G.executeEdits("",[{range:G.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),G.pushUndoStop())},[e],k),xt(()=>{N.current?.getModel()?.original.setValue(r||"")},[r],k),xt(()=>{let{original:G,modified:X}=N.current.getModel();D.current.editor.setModelLanguage(G,n||t||"text"),D.current.editor.setModelLanguage(X,i||t||"text")},[t,n,i],k),xt(()=>{D.current?.editor.setTheme(u)},[u],k),xt(()=>{N.current?.updateOptions(d)},[d],k);let ne=z.useCallback(()=>{if(!D.current)return;V.current(D.current);let G=Tn(D.current,r||"",n||t||"text",s||""),X=Tn(D.current,e||"",i||t||"text",o||"");N.current?.setModel({original:G,modified:X})},[t,e,i,r,n,s,o]),he=z.useCallback(()=>{!te.current&&B.current&&(N.current=D.current.editor.createDiffEditor(B.current,{automaticLayout:!0,...d}),ne(),D.current?.editor.setTheme(u),E(!0),te.current=!0)},[d,u,ne]);z.useEffect(()=>{k&&L.current(N.current,D.current)},[k]),z.useEffect(()=>{!R&&!k&&he()},[R,k,he]);function re(){let G=N.current?.getModel();a||G?.original?.dispose(),l||G?.modified?.dispose(),N.current?.dispose()}return z.createElement(Eu,{width:h,height:f,isEditorReady:k,loading:c,_ref:B,className:m,wrapperProps:v})}var A4=E4;z.memo(A4);function O4(r){let e=z.useRef();return z.useEffect(()=>{e.current=r},[r]),e.current}var N4=O4,as=new Map;function D4({defaultValue:r,defaultLanguage:e,defaultPath:t,value:n,language:i,path:s,theme:o="light",line:a,loading:l="Loading...",options:u={},overrideServices:c={},saveViewState:d=!0,keepCurrentModel:f=!1,width:h="100%",height:m="100%",className:v,wrapperProps:y={},beforeMount:w=li,onMount:k=li,onChange:E,onValidate:R=li}){let[O,N]=z.useState(!1),[D,B]=z.useState(!0),L=z.useRef(null),V=z.useRef(null),te=z.useRef(null),ne=z.useRef(k),he=z.useRef(w),re=z.useRef(),G=z.useRef(n),X=N4(s),ve=z.useRef(!1),ee=z.useRef(!1);Au(()=>{let x=Cu.init();return x.then(I=>(L.current=I)&&B(!1)).catch(I=>I?.type!=="cancelation"&&console.error("Monaco initialization: error:",I)),()=>V.current?C():x.cancel()}),xt(()=>{let x=Tn(L.current,r||n||"",e||i||"",s||t||"");x!==V.current?.getModel()&&(d&&as.set(X,V.current?.saveViewState()),V.current?.setModel(x),d&&V.current?.restoreViewState(as.get(s)))},[s],O),xt(()=>{V.current?.updateOptions(u)},[u],O),xt(()=>{!V.current||n===void 0||(V.current.getOption(L.current.editor.EditorOption.readOnly)?V.current.setValue(n):n!==V.current.getValue()&&(ee.current=!0,V.current.executeEdits("",[{range:V.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),V.current.pushUndoStop(),ee.current=!1))},[n],O),xt(()=>{let x=V.current?.getModel();x&&i&&L.current?.editor.setModelLanguage(x,i)},[i],O),xt(()=>{a!==void 0&&V.current?.revealLine(a)},[a],O),xt(()=>{L.current?.editor.setTheme(o)},[o],O);let Se=z.useCallback(()=>{if(!(!te.current||!L.current)&&!ve.current){he.current(L.current);let x=s||t,I=Tn(L.current,n||r||"",e||i||"",x||"");V.current=L.current?.editor.create(te.current,{model:I,automaticLayout:!0,...u},c),d&&V.current.restoreViewState(as.get(x)),L.current.editor.setTheme(o),a!==void 0&&V.current.revealLine(a),N(!0),ve.current=!0}},[r,e,t,n,i,s,u,c,d,o,a]);z.useEffect(()=>{O&&ne.current(V.current,L.current)},[O]),z.useEffect(()=>{!D&&!O&&Se()},[D,O,Se]),G.current=n,z.useEffect(()=>{O&&E&&(re.current?.dispose(),re.current=V.current?.onDidChangeModelContent(x=>{ee.current||E(V.current.getValue(),x)}))},[O,E]),z.useEffect(()=>{if(O){let x=L.current.editor.onDidChangeMarkers(I=>{let q=V.current.getModel()?.uri;if(q&&I.find(W=>W.path===q.path)){let W=L.current.editor.getModelMarkers({resource:q});R?.(W)}});return()=>{x?.dispose()}}return()=>{}},[O,R]);function C(){re.current?.dispose(),f?d&&as.set(s,V.current.saveViewState()):V.current.getModel()?.dispose(),V.current.dispose()}return z.createElement(Eu,{width:h,height:m,isEditorReady:O,loading:l,_ref:te,className:v,wrapperProps:y})}var I4=D4,R4=z.memo(I4);const P4={automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",insertSpaces:!0,tabSize:2,padding:{top:10,bottom:10}},Nu=({content:r,onChange:e})=>{const t=z.useRef(null),n=z.useRef(null),i=z.useRef(null),[,s]=z.useState(!1),[,o]=z.useState(!1);z.useEffect(()=>()=>{n.current?.dispose?.(),i.current&&clearTimeout(i.current)},[]);const a=c=>{t.current=c,n.current?.dispose?.(),n.current=c.onDidChangeModelContent(()=>{l()}),l()},l=()=>{const c=t.current?.getModel?.();if(c&&typeof c.canUndo=="function"&&typeof c.canRedo=="function")try{s(c.canUndo()),o(c.canRedo());return}catch{}const d=!!t.current;s(d),o(d)},u=c=>{e(c)};return Z.jsx("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%"},children:Z.jsx("div",{style:{flex:1,width:"100%"},children:Z.jsx(R4,{options:P4,width:"100%",height:"100%",language:"xml",value:r,onMount:a,onChange:c=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{u(c||"")},500)}})})})};function Qe(r){this.content=r}Qe.prototype={constructor:Qe,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new Qe(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Qe(t)},addToStart:function(r,e){return new Qe([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Qe(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new Qe(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Qe.from(r),r.size?new Qe(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Qe.from(r),r.size?new Qe(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Qe.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}},Qe.from=function(r){if(r instanceof Qe)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Qe(e)};function Du(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Du(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Iu(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,n-=l;continue}if(!o.sameMarkup(a))return{a:t,b:n};if(o.isText&&o.text!=a.text){let u=0,c=Math.min(o.text.length,a.text.length);for(;u<c&&o.text[o.text.length-u-1]==a.text[a.text.length-u-1];)u++,t--,n--;return{a:t,b:n}}if(o.content.size||a.content.size){let u=Iu(o.content,a.content,t-1,n-1);if(u)return u}t-=l,n-=l}}class F{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],u=a+l.nodeSize;if(u>e&&n(l,i+a,s||null,o)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,t-c),n,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&n&&(o?o=!1:s+=n),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new F(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),i+=a.nodeSize),o=l}return new F(n,i)}cutByIndex(e,t){return e==t?F.empty:e==0&&t==this.content.length?this:new F(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new F(i,s)}addToStart(e){return new F([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new F(this.content.concat(e),this.size+e.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 new 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 i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Du(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Iu(this,e,t,n)}findIndex(e){if(e==0)return ls(0,e);if(e==this.size)return ls(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?ls(t+1,s):ls(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return F.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new F(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return F.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new F(t||e,n)}static from(e){if(!e)return F.empty;if(e instanceof F)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new F([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}F.empty=new F([],0);const Zo={index:0,offset:0};function ls(r,e){return Zo.index=r,Zo.offset=e,Zo}function us(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!us(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!us(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let Ae=class V0{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(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&&us(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 new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}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(e){if(!e||Array.isArray(e)&&e.length==0)return V0.none;if(e instanceof V0)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};Ae.none=[];class cs extends Error{}class U{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Pu(this.content,e+this.openStart,t);return n&&new U(n,this.openStart,this.openEnd)}removeBetween(e,t){return new U(Ru(this.content,e+this.openStart,t+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(e,t){if(!t)return U.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new U(F.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new U(e,n,i)}}U.empty=new U(F.empty,0,0);function Ru(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:a}=r.findIndex(t);if(i==e||s.isText){if(a!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Ru(s.content,e-i-1,t-i-1)))}function Pu(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),o=r.maybeChild(i);if(s==e||o.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let a=Pu(o.content,e-s-1,t,o);return a&&r.replaceChild(i,o.copy(a))}function z4(r,e,t){if(t.openStart>r.depth)throw new cs("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new cs("Inconsistent open depths");return zu(r,e,t,0)}function zu(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=zu(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,a=o.content;return on(o,a.cut(0,r.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=L4(t,r);return on(s,Bu(r,o,a,e,n))}else return on(s,ds(r,e,n))}function Lu(r,e){if(!e.type.compatibleContent(r.type))throw new cs("Cannot join "+e.type.name+" onto "+r.type.name)}function Qo(r,e,t){let n=r.node(t);return Lu(n,e.node(t)),n}function sn(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function ui(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(sn(r.nodeAfter,n),s++));for(let a=s;a<o;a++)sn(i.child(a),n);e&&e.depth==t&&e.textOffset&&sn(e.nodeBefore,n)}function on(r,e){return r.type.checkContent(e),r.copy(e)}function Bu(r,e,t,n,i){let s=r.depth>i&&Qo(r,e,i+1),o=n.depth>i&&Qo(t,n,i+1),a=[];return ui(null,r,i,a),s&&o&&e.index(i)==t.index(i)?(Lu(s,o),sn(on(s,Bu(r,e,t,n,i+1)),a)):(s&&sn(on(s,ds(r,e,i+1)),a),ui(e,t,i,a),o&&sn(on(o,ds(t,n,i+1)),a)),ui(n,null,i,a),new F(a)}function ds(r,e,t){let n=[];if(ui(null,r,t,n),r.depth>t){let i=Qo(r,e,t+1);sn(on(i,ds(r,e,t+1)),n)}return ui(e,null,t,n),new F(n)}function L4(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(F.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class ci{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 new 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 new 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],i=e.child(t);return n?e.child(t).cut(n):i}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],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ae.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let a=n;n=i,i=a}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].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 hs(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(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),u=s-l;if(n.push(o,a,i+l),!u||(o=o.child(a),o.isText))break;s=u-1,i+=l+1}return new ci(t,n,s)}static resolveCached(e,t){let n=Fu.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else Fu.set(e,n=new B4);let i=n.elts[n.i]=ci.resolve(e,t);return n.i=(n.i+1)%F4,i}}class B4{constructor(){this.elts=[],this.i=0}}const F4=12,Fu=new WeakMap;class hs{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)}}const $4=Object.create(null);let Ar=class j0{constructor(e,t,n,i=Ae.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||F.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,i=0){this.content.nodesBetween(e,t,n,i,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,i){return this.content.textBetween(e,t,n,i)}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&&us(this.attrs,t||e.defaultAttrs||$4)&&Ae.sameSet(this.marks,n||Ae.none)}copy(e=null){return e==this.content?this:new j0(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new j0(this.type,this.attrs,this.content,e)}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 U.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),a=i.start(o),u=i.node(o).content.cut(i.pos-a,s.pos-a);return new U(u,i.depth-o,s.depth-o)}replace(e,t,n){return z4(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+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 i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return ci.resolveCached(this,e)}resolveNoCache(e){return ci.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),$u(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=F.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.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=Ae.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(!Ae.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=F.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};Ar.prototype.text=void 0;let H4=class q0 extends Ar{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):$u(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(e){return e==this.marks?this:new q0(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new q0(this.type,this.attrs,e,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 $u(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new V4(e,t);if(n.next==null)return an.empty;let i=Hu(n);n.next&&n.err("Unexpected trailing text");let s=K4(G4(i));return Y4(s,n),s}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 i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}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 i=[this];function s(o,a){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return F.from(a.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:d}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,a.concat(c));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+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 i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(n.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new 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 i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
497
- `)}}an.empty=new an(!0);class V4{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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Hu(r){let e=[];do e.push(j4(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function j4(r){let e=[];do e.push(q4(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function q4(r){let e=U4(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=_4(r,e);else break;return e}function Vu(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function _4(r,e){let t=Vu(r),n=t;return r.eat(",")&&(r.next!="}"?n=Vu(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function W4(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function U4(r){if(r.eat("(")){let e=Hu(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=W4(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function G4(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,a,l){let u={term:l,to:a};return e[o].push(u),u}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(s(u,a)),[]);if(o.type=="seq")for(let l=0;;l++){let u=s(o.exprs[l],a);if(l==o.exprs.length-1)return u;i(u,a=t())}else if(o.type=="star"){let l=t();return n(a,l),i(s(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let u=0;u<o.min;u++){let c=t();i(s(o.expr,l),c),l=c}if(o.max==-1)i(s(o.expr,l),l);else for(let u=o.min;u<o.max;u++){let c=t();n(l,c),i(s(o.expr,l),c),l=c}return[n(l)]}else{if(o.type=="name")return[n(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ju(r,e){return e-r}function qu(r,e){let t=[];return n(e),t.sort(ju);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&n(l)}}}function K4(r){let e=Object.create(null);return t(qu(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c<i.length;c++)i[c][0]==a&&(u=i[c][1]);qu(r,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let s=e[n.join(",")]=new an(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(ju);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function Y4(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:u}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),n.indexOf(u)==-1&&n.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function _u(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function Wu(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function Uu(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in r){let s=r[i];s.validate&&s.validate(e[i])}}function Gu(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new X4(r,n,e[n]);return t}let Ku=class b1{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=Gu(e,n.attrs),this.defaultAttrs=_u(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==an.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:Wu(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ar(this,this.computeAttrs(e),F.from(t),Ae.setFrom(n))}createChecked(e=null,t,n){return t=F.from(t),this.checkContent(t),new Ar(this,this.computeAttrs(e),t,Ae.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=F.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(F.empty,!0);return s?new Ar(this,e,t.append(s),Ae.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Uu(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||(t=e.slice(0,n));return t?t.length?t:Ae.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new b1(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function J4(r,e,t){let n=t.split("|");return i=>{let s=i===null?"null":typeof i;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`)}}class X4{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?J4(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class fs{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=Gu(e,i.attrs),this.excluded=null;let s=_u(this.attrs);this.instance=s?new Ae(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Ae(this,Wu(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new fs(s,i++,t,o)),n}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){Uu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Yu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Qe.from(e.nodes),t.marks=Qe.from(e.marks||{}),this.nodes=Ku.compile(this.spec.nodes,this),this.marks=fs.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=an.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Ju(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Ju(this,o.split(" "))}this.nodeFromJSON=i=>Ar.fromJSON(this,i),this.markFromJSON=i=>Ae.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ku){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new H4(n,n.defaultAttrs,e,Ae.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 new RangeError("Unknown node type: "+e);return t}}function Ju(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let a in r.marks){let l=r.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Z4(r){return r.tag!=null}function Q4(r){return r.style!=null}class Or{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(Z4(i))this.tags.push(i);else if(Q4(i)){let s=/[^=]*/.exec(i.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new ec(this,t,!1);return n.addAll(e,Ae.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ec(this,t,!0);return n.addAll(e,Ae.none,t.from,t.to),U.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(r2(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=tc(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=tc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Or(e,Or.schemaRules(e)))}}const Xu={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},e2={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Zu={ol:!0,ul:!0},di=1,ea=2,hi=4;function Qu(r,e,t){return e!=null?(e?di:0)|(e==="full"?ea:0):r&&r.whitespace=="pre"?di|ea:t&~hi}class ps{constructor(e,t,n,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=Ae.none,this.match=s||(o&hi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(F.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&di)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=F.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(F.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&&!Xu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ec{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=Qu(null,t.preserveWhitespace,0)|(n?hi:0);i?s=new ps(i.type,i.attrs,Ae.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new ps(null,null,Ae.none,!0,null,o):s=new ps(e.schema.topNodeType,null,Ae.none,!0,null,o),this.nodes=[s],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,i=this.top,s=i.options&ea?"full":this.localPreserveWS||(i.options&di)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)if(s==="full")n=n.replace(/\r\n?/g,`
496
+ `},Su=Zg(r4)(xu),n4={config:e4},i4=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(i){return t.reduceRight(function(s,o){return o(s)},i)}};function ku(r,e){return Object.keys(e).forEach(function(t){e[t]instanceof Object&&r[t]&&Object.assign(e[t],ku(r[t],e[t]))}),yu(yu({},r),e)}var s4={type:"cancelation",msg:"operation is manually canceled"};function Yo(r){var e=!1,t=new Promise(function(n,i){r.then(function(s){return e?i(s4):n(s)}),r.catch(i)});return t.cancel=function(){return e=!0},t}var o4=["monaco"],a4=Jg.create({config:Xg,isInitialized:!1,resolve:null,reject:null,monaco:null}),Tu=Ig(a4,2),ai=Tu[0],ss=Tu[1];function l4(r){var e=n4.config(r),t=e.monaco,n=Ng(e,o4);ss(function(i){return{config:ku(i.config,n),monaco:t}})}function u4(){var r=ai(function(e){var t=e.monaco,n=e.isInitialized,i=e.resolve;return{monaco:t,isInitialized:n,resolve:i}});if(!r.isInitialized){if(ss({isInitialized:!0}),r.monaco)return r.resolve(r.monaco),Yo(Jo);if(window.monaco&&window.monaco.editor)return Mu(window.monaco),r.resolve(window.monaco),Yo(Jo);i4(c4,h4)(f4)}return Yo(Jo)}function c4(r){return document.body.appendChild(r)}function d4(r){var e=document.createElement("script");return r&&(e.src=r),e}function h4(r){var e=ai(function(n){var i=n.config,s=n.reject;return{config:i,reject:s}}),t=d4("".concat(e.config.paths.vs,"/loader.js"));return t.onload=function(){return r()},t.onerror=e.reject,t}function f4(){var r=ai(function(t){var n=t.config,i=t.resolve,s=t.reject;return{config:n,resolve:i,reject:s}}),e=window.require;e.config(r.config),e(["vs/editor/editor.main"],function(t){var n=t.m||t;Mu(n),r.resolve(n)},function(t){r.reject(t)})}function Mu(r){ai().monaco||ss({monaco:r})}function p4(){return ai(function(r){var e=r.monaco;return e})}var Jo=new Promise(function(r,e){return ss({resolve:r,reject:e})}),Cu={config:l4,init:u4,__getMonacoInstance:p4},m4={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Xo=m4,g4={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},v4=g4;function y4({children:r}){return z.createElement("div",{style:v4.container},r)}var b4=y4,w4=b4;function x4({width:r,height:e,isEditorReady:t,loading:n,_ref:i,className:s,wrapperProps:o}){return z.createElement("section",{style:{...Xo.wrapper,width:r,height:e},...o},!t&&z.createElement(w4,null,n),z.createElement("div",{ref:i,style:{...Xo.fullWidth,...!t&&Xo.hide},className:s}))}var S4=x4,Eu=z.memo(S4);function k4(r){z.useEffect(r,[])}var Au=k4;function T4(r,e,t=!0){let n=z.useRef(!0);z.useEffect(n.current||!t?()=>{n.current=!1}:r,e)}var xt=T4;function li(){}function Tn(r,e,t,n){return M4(r,n)||C4(r,e,t,n)}function M4(r,e){return r.editor.getModel(Ou(r,e))}function C4(r,e,t,n){return r.editor.createModel(e,t,n?Ou(r,n):void 0)}function Ou(r,e){return r.Uri.parse(e)}function E4({original:r,modified:e,language:t,originalLanguage:n,modifiedLanguage:i,originalModelPath:s,modifiedModelPath:o,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:c="Loading...",options:d={},height:f="100%",width:h="100%",className:m,wrapperProps:v={},beforeMount:y=li,onMount:w=li}){let[k,E]=z.useState(!1),[R,O]=z.useState(!0),N=z.useRef(null),D=z.useRef(null),B=z.useRef(null),L=z.useRef(w),V=z.useRef(y),te=z.useRef(!1);Au(()=>{let G=Cu.init();return G.then(Z=>(D.current=Z)&&O(!1)).catch(Z=>Z?.type!=="cancelation"&&console.error("Monaco initialization: error:",Z)),()=>N.current?re():G.cancel()}),xt(()=>{if(N.current&&D.current){let G=N.current.getOriginalEditor(),Z=Tn(D.current,r||"",n||t||"text",s||"");Z!==G.getModel()&&G.setModel(Z)}},[s],k),xt(()=>{if(N.current&&D.current){let G=N.current.getModifiedEditor(),Z=Tn(D.current,e||"",i||t||"text",o||"");Z!==G.getModel()&&G.setModel(Z)}},[o],k),xt(()=>{let G=N.current.getModifiedEditor();G.getOption(D.current.editor.EditorOption.readOnly)?G.setValue(e||""):e!==G.getValue()&&(G.executeEdits("",[{range:G.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),G.pushUndoStop())},[e],k),xt(()=>{N.current?.getModel()?.original.setValue(r||"")},[r],k),xt(()=>{let{original:G,modified:Z}=N.current.getModel();D.current.editor.setModelLanguage(G,n||t||"text"),D.current.editor.setModelLanguage(Z,i||t||"text")},[t,n,i],k),xt(()=>{D.current?.editor.setTheme(u)},[u],k),xt(()=>{N.current?.updateOptions(d)},[d],k);let ne=z.useCallback(()=>{if(!D.current)return;V.current(D.current);let G=Tn(D.current,r||"",n||t||"text",s||""),Z=Tn(D.current,e||"",i||t||"text",o||"");N.current?.setModel({original:G,modified:Z})},[t,e,i,r,n,s,o]),he=z.useCallback(()=>{!te.current&&B.current&&(N.current=D.current.editor.createDiffEditor(B.current,{automaticLayout:!0,...d}),ne(),D.current?.editor.setTheme(u),E(!0),te.current=!0)},[d,u,ne]);z.useEffect(()=>{k&&L.current(N.current,D.current)},[k]),z.useEffect(()=>{!R&&!k&&he()},[R,k,he]);function re(){let G=N.current?.getModel();a||G?.original?.dispose(),l||G?.modified?.dispose(),N.current?.dispose()}return z.createElement(Eu,{width:h,height:f,isEditorReady:k,loading:c,_ref:B,className:m,wrapperProps:v})}var A4=E4;z.memo(A4);function O4(r){let e=z.useRef();return z.useEffect(()=>{e.current=r},[r]),e.current}var N4=O4,as=new Map;function D4({defaultValue:r,defaultLanguage:e,defaultPath:t,value:n,language:i,path:s,theme:o="light",line:a,loading:l="Loading...",options:u={},overrideServices:c={},saveViewState:d=!0,keepCurrentModel:f=!1,width:h="100%",height:m="100%",className:v,wrapperProps:y={},beforeMount:w=li,onMount:k=li,onChange:E,onValidate:R=li}){let[O,N]=z.useState(!1),[D,B]=z.useState(!0),L=z.useRef(null),V=z.useRef(null),te=z.useRef(null),ne=z.useRef(k),he=z.useRef(w),re=z.useRef(),G=z.useRef(n),Z=N4(s),ve=z.useRef(!1),ee=z.useRef(!1);Au(()=>{let x=Cu.init();return x.then(I=>(L.current=I)&&B(!1)).catch(I=>I?.type!=="cancelation"&&console.error("Monaco initialization: error:",I)),()=>V.current?C():x.cancel()}),xt(()=>{let x=Tn(L.current,r||n||"",e||i||"",s||t||"");x!==V.current?.getModel()&&(d&&as.set(Z,V.current?.saveViewState()),V.current?.setModel(x),d&&V.current?.restoreViewState(as.get(s)))},[s],O),xt(()=>{V.current?.updateOptions(u)},[u],O),xt(()=>{!V.current||n===void 0||(V.current.getOption(L.current.editor.EditorOption.readOnly)?V.current.setValue(n):n!==V.current.getValue()&&(ee.current=!0,V.current.executeEdits("",[{range:V.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),V.current.pushUndoStop(),ee.current=!1))},[n],O),xt(()=>{let x=V.current?.getModel();x&&i&&L.current?.editor.setModelLanguage(x,i)},[i],O),xt(()=>{a!==void 0&&V.current?.revealLine(a)},[a],O),xt(()=>{L.current?.editor.setTheme(o)},[o],O);let Se=z.useCallback(()=>{if(!(!te.current||!L.current)&&!ve.current){he.current(L.current);let x=s||t,I=Tn(L.current,n||r||"",e||i||"",x||"");V.current=L.current?.editor.create(te.current,{model:I,automaticLayout:!0,...u},c),d&&V.current.restoreViewState(as.get(x)),L.current.editor.setTheme(o),a!==void 0&&V.current.revealLine(a),N(!0),ve.current=!0}},[r,e,t,n,i,s,u,c,d,o,a]);z.useEffect(()=>{O&&ne.current(V.current,L.current)},[O]),z.useEffect(()=>{!D&&!O&&Se()},[D,O,Se]),G.current=n,z.useEffect(()=>{O&&E&&(re.current?.dispose(),re.current=V.current?.onDidChangeModelContent(x=>{ee.current||E(V.current.getValue(),x)}))},[O,E]),z.useEffect(()=>{if(O){let x=L.current.editor.onDidChangeMarkers(I=>{let j=V.current.getModel()?.uri;if(j&&I.find(W=>W.path===j.path)){let W=L.current.editor.getModelMarkers({resource:j});R?.(W)}});return()=>{x?.dispose()}}return()=>{}},[O,R]);function C(){re.current?.dispose(),f?d&&as.set(s,V.current.saveViewState()):V.current.getModel()?.dispose(),V.current.dispose()}return z.createElement(Eu,{width:h,height:m,isEditorReady:O,loading:l,_ref:te,className:v,wrapperProps:y})}var I4=D4,R4=z.memo(I4);const P4={automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",insertSpaces:!0,tabSize:2,padding:{top:10,bottom:10}},Nu=({content:r,onChange:e})=>{const t=z.useRef(null),n=z.useRef(null),i=z.useRef(null),[,s]=z.useState(!1),[,o]=z.useState(!1);z.useEffect(()=>()=>{n.current?.dispose?.(),i.current&&clearTimeout(i.current)},[]);const a=c=>{t.current=c,n.current?.dispose?.(),n.current=c.onDidChangeModelContent(()=>{l()}),l()},l=()=>{const c=t.current?.getModel?.();if(c&&typeof c.canUndo=="function"&&typeof c.canRedo=="function")try{s(c.canUndo()),o(c.canRedo());return}catch{}const d=!!t.current;s(d),o(d)},u=c=>{e(c)};return J.jsx("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%"},children:J.jsx("div",{style:{flex:1,width:"100%"},children:J.jsx(R4,{options:P4,width:"100%",height:"100%",language:"xml",value:r,onMount:a,onChange:c=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{u(c||"")},500)}})})})};function Qe(r){this.content=r}Qe.prototype={constructor:Qe,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new Qe(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Qe(t)},addToStart:function(r,e){return new Qe([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new Qe(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new Qe(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=Qe.from(r),r.size?new Qe(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=Qe.from(r),r.size?new Qe(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=Qe.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}},Qe.from=function(r){if(r instanceof Qe)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new Qe(e)};function Du(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=Du(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Iu(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,n-=l;continue}if(!o.sameMarkup(a))return{a:t,b:n};if(o.isText&&o.text!=a.text){let u=0,c=Math.min(o.text.length,a.text.length);for(;u<c&&o.text[o.text.length-u-1]==a.text[a.text.length-u-1];)u++,t--,n--;return{a:t,b:n}}if(o.content.size||a.content.size){let u=Iu(o.content,a.content,t-1,n-1);if(u)return u}t-=l,n-=l}}class F{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],u=a+l.nodeSize;if(u>e&&n(l,i+a,s||null,o)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,t-c),n,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&n&&(o?o=!1:s+=n),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new F(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),n.push(a),i+=a.nodeSize),o=l}return new F(n,i)}cutByIndex(e,t){return e==t?F.empty:e==0&&t==this.content.length?this:new F(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new F(i,s)}addToStart(e){return new F([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new F(this.content.concat(e),this.size+e.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 new 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 i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return Du(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Iu(this,e,t,n)}findIndex(e){if(e==0)return ls(0,e);if(e==this.size)return ls(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?ls(t+1,s):ls(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return F.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new F(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return F.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new F(t||e,n)}static from(e){if(!e)return F.empty;if(e instanceof F)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new F([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}F.empty=new F([],0);const Zo={index:0,offset:0};function ls(r,e){return Zo.index=r,Zo.offset=e,Zo}function us(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!us(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!us(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let Ae=class V0{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(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&&us(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 new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}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(e){if(!e||Array.isArray(e)&&e.length==0)return V0.none;if(e instanceof V0)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};Ae.none=[];class cs extends Error{}class U{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Pu(this.content,e+this.openStart,t);return n&&new U(n,this.openStart,this.openEnd)}removeBetween(e,t){return new U(Ru(this.content,e+this.openStart,t+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(e,t){if(!t)return U.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new U(F.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new U(e,n,i)}}U.empty=new U(F.empty,0,0);function Ru(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:a}=r.findIndex(t);if(i==e||s.isText){if(a!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Ru(s.content,e-i-1,t-i-1)))}function Pu(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),o=r.maybeChild(i);if(s==e||o.isText)return n&&!n.canReplace(i,i,t)?null:r.cut(0,e).append(t).append(r.cut(e));let a=Pu(o.content,e-s-1,t,o);return a&&r.replaceChild(i,o.copy(a))}function z4(r,e,t){if(t.openStart>r.depth)throw new cs("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new cs("Inconsistent open depths");return zu(r,e,t,0)}function zu(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=zu(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,a=o.content;return on(o,a.cut(0,r.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=L4(t,r);return on(s,Bu(r,o,a,e,n))}else return on(s,ds(r,e,n))}function Lu(r,e){if(!e.type.compatibleContent(r.type))throw new cs("Cannot join "+e.type.name+" onto "+r.type.name)}function Qo(r,e,t){let n=r.node(t);return Lu(n,e.node(t)),n}function sn(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function ui(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(sn(r.nodeAfter,n),s++));for(let a=s;a<o;a++)sn(i.child(a),n);e&&e.depth==t&&e.textOffset&&sn(e.nodeBefore,n)}function on(r,e){return r.type.checkContent(e),r.copy(e)}function Bu(r,e,t,n,i){let s=r.depth>i&&Qo(r,e,i+1),o=n.depth>i&&Qo(t,n,i+1),a=[];return ui(null,r,i,a),s&&o&&e.index(i)==t.index(i)?(Lu(s,o),sn(on(s,Bu(r,e,t,n,i+1)),a)):(s&&sn(on(s,ds(r,e,i+1)),a),ui(e,t,i,a),o&&sn(on(o,ds(t,n,i+1)),a)),ui(n,null,i,a),new F(a)}function ds(r,e,t){let n=[];if(ui(null,r,t,n),r.depth>t){let i=Qo(r,e,t+1);sn(on(i,ds(r,e,t+1)),n)}return ui(e,null,t,n),new F(n)}function L4(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(F.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class ci{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 new 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 new 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],i=e.child(t);return n?e.child(t).cut(n):i}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],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ae.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let a=n;n=i,i=a}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].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 hs(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(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),u=s-l;if(n.push(o,a,i+l),!u||(o=o.child(a),o.isText))break;s=u-1,i+=l+1}return new ci(t,n,s)}static resolveCached(e,t){let n=Fu.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else Fu.set(e,n=new B4);let i=n.elts[n.i]=ci.resolve(e,t);return n.i=(n.i+1)%F4,i}}class B4{constructor(){this.elts=[],this.i=0}}const F4=12,Fu=new WeakMap;class hs{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)}}const $4=Object.create(null);let Ar=class _0{constructor(e,t,n,i=Ae.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||F.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,i=0){this.content.nodesBetween(e,t,n,i,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,i){return this.content.textBetween(e,t,n,i)}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&&us(this.attrs,t||e.defaultAttrs||$4)&&Ae.sameSet(this.marks,n||Ae.none)}copy(e=null){return e==this.content?this:new _0(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new _0(this.type,this.attrs,this.content,e)}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 U.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),a=i.start(o),u=i.node(o).content.cut(i.pos-a,s.pos-a);return new U(u,i.depth-o,s.depth-o)}replace(e,t,n){return z4(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+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 i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return ci.resolveCached(this,e)}resolveNoCache(e){return ci.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),$u(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=F.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.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=Ae.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(!Ae.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=F.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}};Ar.prototype.text=void 0;let H4=class j0 extends Ar{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):$u(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(e){return e==this.marks?this:new j0(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new j0(this.type,this.attrs,e,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 $u(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new V4(e,t);if(n.next==null)return an.empty;let i=Hu(n);n.next&&n.err("Unexpected trailing text");let s=K4(G4(i));return Y4(s,n),s}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 i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}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 i=[this];function s(o,a){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return F.from(a.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:d}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,a.concat(c));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+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 i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(n.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new 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 i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
497
+ `)}}an.empty=new an(!0);class V4{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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Hu(r){let e=[];do e.push(_4(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function _4(r){let e=[];do e.push(j4(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function j4(r){let e=U4(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=q4(r,e);else break;return e}function Vu(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function q4(r,e){let t=Vu(r),n=t;return r.eat(",")&&(r.next!="}"?n=Vu(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function W4(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function U4(r){if(r.eat("(")){let e=Hu(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=W4(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function G4(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,a,l){let u={term:l,to:a};return e[o].push(u),u}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(s(u,a)),[]);if(o.type=="seq")for(let l=0;;l++){let u=s(o.exprs[l],a);if(l==o.exprs.length-1)return u;i(u,a=t())}else if(o.type=="star"){let l=t();return n(a,l),i(s(o.expr,l),l),[n(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[n(l)]}else{if(o.type=="opt")return[n(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let u=0;u<o.min;u++){let c=t();i(s(o.expr,l),c),l=c}if(o.max==-1)i(s(o.expr,l),l);else for(let u=o.min;u<o.max;u++){let c=t();n(l,c),i(s(o.expr,l),c),l=c}return[n(l)]}else{if(o.type=="name")return[n(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function _u(r,e){return e-r}function ju(r,e){let t=[];return n(e),t.sort(_u);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&n(l)}}}function K4(r){let e=Object.create(null);return t(ju(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c<i.length;c++)i[c][0]==a&&(u=i[c][1]);ju(r,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let s=e[n.join(",")]=new an(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(_u);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function Y4(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:u}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),n.indexOf(u)==-1&&n.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qu(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function Wu(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function Uu(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in r){let s=r[i];s.validate&&s.validate(e[i])}}function Gu(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new X4(r,n,e[n]);return t}let Ku=class b1{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=Gu(e,n.attrs),this.defaultAttrs=qu(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==an.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:Wu(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ar(this,this.computeAttrs(e),F.from(t),Ae.setFrom(n))}createChecked(e=null,t,n){return t=F.from(t),this.checkContent(t),new Ar(this,this.computeAttrs(e),t,Ae.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=F.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(F.empty,!0);return s?new Ar(this,e,t.append(s),Ae.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Uu(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||(t=e.slice(0,n));return t?t.length?t:Ae.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new b1(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function J4(r,e,t){let n=t.split("|");return i=>{let s=i===null?"null":typeof i;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`)}}class X4{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?J4(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class fs{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=Gu(e,i.attrs),this.excluded=null;let s=qu(this.attrs);this.instance=s?new Ae(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Ae(this,Wu(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new fs(s,i++,t,o)),n}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){Uu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Yu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Qe.from(e.nodes),t.marks=Qe.from(e.marks||{}),this.nodes=Ku.compile(this.spec.nodes,this),this.marks=fs.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=an.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?Ju(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Ju(this,o.split(" "))}this.nodeFromJSON=i=>Ar.fromJSON(this,i),this.markFromJSON=i=>Ae.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Ku){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new H4(n,n.defaultAttrs,e,Ae.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 new RangeError("Unknown node type: "+e);return t}}function Ju(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let a in r.marks){let l=r.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Z4(r){return r.tag!=null}function Q4(r){return r.style!=null}class Or{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(Z4(i))this.tags.push(i);else if(Q4(i)){let s=/[^=]*/.exec(i.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new ec(this,t,!1);return n.addAll(e,Ae.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ec(this,t,!0);return n.addAll(e,Ae.none,t.from,t.to),U.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(r2(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=tc(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=tc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Or(e,Or.schemaRules(e)))}}const Xu={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},e2={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Zu={ol:!0,ul:!0},di=1,ea=2,hi=4;function Qu(r,e,t){return e!=null?(e?di:0)|(e==="full"?ea:0):r&&r.whitespace=="pre"?di|ea:t&~hi}class ps{constructor(e,t,n,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=Ae.none,this.match=s||(o&hi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(F.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&di)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=F.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(F.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&&!Xu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ec{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=Qu(null,t.preserveWhitespace,0)|(n?hi:0);i?s=new ps(i.type,i.attrs,Ae.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new ps(null,null,Ae.none,!0,null,o):s=new ps(e.schema.topNodeType,null,Ae.none,!0,null,o),this.nodes=[s],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,i=this.top,s=i.options&ea?"full":this.localPreserveWS||(i.options&di)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)if(s==="full")n=n.replace(/\r\n?/g,`
498
498
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=n.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Zu.hasOwnProperty(o)&&this.parser.normalizeLists&&t2(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,n));e:if(l?l.ignore:e2.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(Xu.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),u&&this.sync(s),this.needsBlock=c}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,l,u,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
499
- `),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 i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=n.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(u=>!l.clearMark(u)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,n,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(o,t.attrs||null,n,t.preserveWhitespace);l&&(s=!0,n=l)}else{let l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,n,i){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,n){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+a)&&(i=u,s=l,!u.length))break;if(l.solid){if(n)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Ae.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):rc(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let s=this.findPlace(e.create(t),n,!1);return s&&(s=this.enterInner(e,t,n,!0,i)),s}enterInner(e,t,n,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Qu(e,s,o.options);o.options&hi&&o.content.length==0&&(a|=hi);let l=Ae.none;return n=n.filter(u=>(o.type?o.type.allowsMarkType(u.type):rc(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new ps(e,t,l,i,null,a)),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;this.localPreserveWS&&(this.nodes[t].options|=di)}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 i=n.length-1;i>=0;i--)e+=n[i].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 i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].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,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let u=t[a];if(u==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:n&&l>=s?n.node(l-s).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return o(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 t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function t2(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&Zu.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function r2(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function tc(r){let e={};for(let t in r)e[t]=r[t];return e}function rc(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class ln{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=ta(t).createDocumentFragment());let i=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let u=o.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(s[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let u=o.marks[l++],c=this.serializeMark(u,o.isInline,t);c&&(s.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=ms(ta(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&ms(ta(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return ms(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ln(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=nc(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return nc(e.marks)}}function nc(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function ta(r){return r.document||window.document}const ic=new WeakMap;function n2(r){let e=ic.get(r);return e===void 0&&ic.set(r,e=i2(r)),e}function i2(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function ms(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=n2(n))&&s.indexOf(e)>-1)throw new 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&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?r.createElementNS(t,i):r.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),u[d]):d=="style"&&l.style?l.style.cssText=u[d]:l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:m}=ms(r,f,t,n);if(l.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const sc=65535,oc=Math.pow(2,16);function s2(r,e){return r+e*oc}function ac(r){return r&sc}function o2(r){return(r-(r&sc))/oc}const lc=1,uc=2,gs=4,cc=8;class ra{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&cc)>0}get deletedBefore(){return(this.delInfo&(lc|gs))>0}get deletedAfter(){return(this.delInfo&(uc|gs))>0}get deletedAcross(){return(this.delInfo&gs)>0}}class St{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&St.empty)return St.empty}recover(e){let t=0,n=ac(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+o2(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 i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+s],c=this.ranges[a+o],d=l+u;if(e<=d){let f=u?e==l?-1:e==d?1:t:t,h=l+i+(f<0?0:c);if(n)return h;let m=e==(t<0?l:d)?null:s2(a/3,e-l),v=e==l?uc:e==d?lc:gs;return(t<0?e!=l:e!=d)&&(v|=cc),new ra(h,v,m)}i+=c-u}return n?e+i:new ra(e+i,0,null)}touches(e,t){let n=0,i=ac(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?n:0);if(l>e)break;let u=this.ranges[a+s],c=l+u;if(e<=c&&a==i*3)return!0;n+=this.ranges[a+o]-u}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),u=this.ranges[i+t],c=this.ranges[i+n];e(a,a+u,l,l+c),s+=c-u}}invert(){return new St(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?St.empty:new St(e<0?[0,-e,0]:[0,0,e])}}St.empty=new St([]);class fi{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new fi(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!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 i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i: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=[]),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 i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new fi;return e.appendMappingInverted(this),e}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 i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return n?e:new ra(e,i,null)}}const na=Object.create(null);class nt{getMap(){return St.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=na[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in na)throw new RangeError("Duplicate use of step JSON ID "+e);return na[e]=t,t.prototype.jsonID=e,t}}class qe{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new qe(e,null)}static fail(e){return new qe(null,e)}static fromReplace(e,t,n,i){try{return qe.ok(e.replace(t,n,i))}catch(s){if(s instanceof cs)return qe.fail(s.message);throw s}}}function ia(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(ia(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return F.fromArray(n)}class Nr extends nt{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),i=n.node(n.sharedDepth(this.to)),s=new U(ia(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return qe.fromReplace(e,this.from,this.to,s)}invert(){return new Ft(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Nr(t.pos,n.pos,this.mark)}merge(e){return e instanceof Nr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Nr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Nr(t.from,t.to,e.markFromJSON(t.mark))}}nt.jsonID("addMark",Nr);class Ft extends nt{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 U(ia(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return qe.fromReplace(e,this.from,this.to,n)}invert(){return new Nr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Ft(t.pos,n.pos,this.mark)}merge(e){return e instanceof Ft&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ft(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ft(t.from,t.to,e.markFromJSON(t.mark))}}nt.jsonID("removeMark",Ft);class Dr extends nt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return qe.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return qe.fromReplace(e,this.pos,this.pos+1,new U(F.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new Dr(this.pos,t.marks[i]);return new Dr(this.pos,this.mark)}}return new un(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Dr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Dr(t.pos,e.markFromJSON(t.mark))}}nt.jsonID("addNodeMark",Dr);class un extends nt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return qe.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return qe.fromReplace(e,this.pos,this.pos+1,new U(F.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Dr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new un(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new un(t.pos,e.markFromJSON(t.mark))}}nt.jsonID("removeNodeMark",un);class Ye extends nt{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&sa(e,this.from,this.to)?qe.fail("Structure replace would overwrite content"):qe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new St([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ye(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Ye(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ye)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?U.empty:new U(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ye(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?U.empty:new U(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ye(e.from,this.to,t,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(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ye(t.from,t.to,U.fromJSON(e,t.slice),!!t.structure)}}nt.jsonID("replace",Ye);class Je extends nt{constructor(e,t,n,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(sa(e,this.from,this.gapFrom)||sa(e,this.gapTo,this.to)))return qe.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return qe.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?qe.fromReplace(e,this.from,this.to,n):qe.fail("Content does not fit in gap")}getMap(){return new St([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Je(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new Je(t.pos,n.pos,i,s,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(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Je(t.from,t.to,t.gapFrom,t.gapTo,U.fromJSON(e,t.slice),t.insert,!!t.structure)}}nt.jsonID("replaceAround",Je);function sa(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function a2(r,e,t,n){let i=[],s=[],o,a;r.doc.nodesBetween(e,t,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let f=Math.max(u,e),h=Math.min(u+l.nodeSize,t),m=n.addToSet(d);for(let v=0;v<d.length;v++)d[v].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[v])?o.to=h:i.push(o=new Ft(f,h,d[v])));a&&a.to==f?a.to=h:s.push(a=new Nr(f,h,n))}}),i.forEach(l=>r.step(l)),s.forEach(l=>r.step(l))}function l2(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(n instanceof fs){let u=o.marks,c;for(;c=n.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,t);for(let c=0;c<l.length;c++){let d=l[c],f;for(let h=0;h<i.length;h++){let m=i[h];m.step==s-1&&d.eq(i[h].style)&&(f=m)}f?(f.to=u,f.step=s):i.push({style:d,from:Math.max(a,e),to:u,step:s})}}}),i.forEach(o=>r.step(new Ft(o.from,o.to,o.style)))}function oa(r,e,t,n=t.contentMatch,i=!0){let s=r.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let u=s.child(l),c=a+u.nodeSize,d=n.matchType(u.type);if(!d)o.push(new Ye(a,c,U.empty));else{n=d;for(let f=0;f<u.marks.length;f++)t.allowsMarkType(u.marks[f].type)||r.step(new Ft(a,c,u.marks[f]));if(i&&u.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(u.text);)m||(m=new U(F.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),o.push(new Ye(a+f.index,a+f.index+f[0].length,m))}}a=c}if(!n.validEnd){let l=n.fillBefore(F.empty,!0);r.replace(a,a,new U(l,0,0))}for(let l=o.length-1;l>=0;l--)r.step(o[l])}function u2(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Mn(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let o=r.$from.node(n),a=r.$from.index(n)+i,l=r.$to.indexAfter(n)-s;if(n<r.depth&&o.canReplace(a,l,t))return n;if(n==0||o.type.spec.isolating||!u2(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function c2(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),a=i.after(s+1),l=o,u=a,c=F.empty,d=0;for(let m=s,v=!1;m>t;m--)v||n.index(m)>0?(v=!0,c=F.from(n.node(m).copy(c)),d++):l--;let f=F.empty,h=0;for(let m=s,v=!1;m>t;m--)v||i.after(m+1)<i.end(m)?(v=!0,f=F.from(i.node(m).copy(f)),h++):u++;r.step(new Je(l,u,o,a,new U(c.append(f),d,h),c.size-d,!0))}function aa(r,e,t=null,n=r){let i=d2(r,e),s=i&&h2(n,e);return s?i.map(dc).concat({type:e,attrs:t}).concat(s.map(dc)):null}function dc(r){return{type:r,attrs:null}}function d2(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,i,o)?s:null}function h2(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let u=n;l&&u<i;u++)l=l.matchType(t.child(u).type);return!l||!l.validEnd?null:o}function f2(r,e,t){let n=F.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let a=t[o].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=F.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new Je(i,s,i,s,new U(n,0,0),t.length,!0))}function p2(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,l)&&m2(r.doc,r.mapping.slice(s).map(a),n)){let u=null;if(n.schema.linebreakReplacement){let h=n.whitespace=="pre",m=!!n.contentMatch.matchType(n.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&fc(r,o,a,s),oa(r,r.mapping.slice(s).map(a,1),n,void 0,u===null);let c=r.mapping.slice(s),d=c.map(a,1),f=c.map(a+o.nodeSize,1);return r.step(new Je(d,f,d+1,f-1,new U(F.from(n.create(l,null,o.marks)),0,0),1,!0)),u===!0&&hc(r,o,a,s),!1}})}function hc(r,e,t,n){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=r.mapping.slice(n).map(t+1+s+o.index);r.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function fc(r,e,t,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+s);r.replaceWith(o,o+1,e.type.schema.text(`
500
- `))}})}function m2(r,e,t){let n=r.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function g2(r,e,t,n,i){let s=r.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(n,null,i||s.marks);if(s.isLeaf)return r.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new Je(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new U(F.from(o),0,0),1,!0))}function ar(r,e,t=1,n){let i=r.resolve(e),s=i.depth-t,o=n&&n[n.length-1]||i.parent;if(s<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 u=i.depth-1,c=t-2;u>s;u--,c--){let d=i.node(u),f=i.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),m=n&&n[c+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let v=n&&n[c]||d;if(!d.canReplace(f+1,d.childCount)||!v.type.validContent(h))return!1}let a=i.indexAfter(s),l=n&&n[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function v2(r,e,t=1,n){let i=r.doc.resolve(e),s=F.empty,o=F.empty;for(let a=i.depth,l=i.depth-t,u=t-1;a>l;a--,u--){s=F.from(i.node(a).copy(s));let c=n&&n[u];o=F.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}r.step(new Ye(e,e,new U(s.append(o),t,t),!0))}function Ir(r,e){let t=r.resolve(e),n=t.index();return pc(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function y2(r,e){e.content.size||r.type.compatibleContent(e.type);let t=r.contentMatchAt(r.childCount),{linebreakReplacement:n}=r.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==n?r.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!r.type.allowsMarks(s.marks))return!1}return t.validEnd}function pc(r,e){return!!(r&&e&&!r.isLeaf&&y2(r,e))}function vs(r,e,t=-1){let n=r.resolve(e);for(let i=n.depth;;i--){let s,o,a=n.index(i);if(i==n.depth?(s=n.nodeBefore,o=n.nodeAfter):t>0?(s=n.node(i+1),a++,o=n.node(i).maybeChild(a)):(s=n.node(i).maybeChild(a-1),o=n.node(i+1)),s&&!s.isTextblock&&pc(s,o)&&n.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?n.before(i):n.after(i)}}function b2(r,e,t){let n=null,{linebreakReplacement:i}=r.doc.type.schema,s=r.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);c&&!d?n=!1:!c&&d&&(n=!0)}let a=r.steps.length;if(n===!1){let c=r.doc.resolve(e+t);fc(r,c.node(),c.before(),a)}o.inlineContent&&oa(r,e+t-1,o,s.node().contentMatchAt(s.index()),n==null);let l=r.mapping.slice(a),u=l.map(e-t);if(r.step(new Ye(u,l.map(e+t,-1),U.empty,!0)),n===!0){let c=r.doc.resolve(u);hc(r,c.node(),c.before(),r.steps.length)}return r}function w2(r,e,t){let n=r.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let s=n.index(i);if(n.node(i).canReplaceWith(s,s,t))return n.before(i+1);if(s>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let s=n.indexAfter(i);if(n.node(i).canReplaceWith(s,s,t))return n.after(i+1);if(s<n.node(i).childCount)return null}return null}function mc(r,e,t){let n=r.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=n.depth;o>=0;o--){let a=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,l=n.index(o)+(a>0?1:0),u=n.node(o),c=!1;if(s==1)c=u.canReplace(l,l,i);else{let d=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(l,l,d[0])}if(c)return a==0?n.pos:a<0?n.before(o+1):n.after(o+1)}return null}function ys(r,e,t=e,n=U.empty){if(e==t&&!n.size)return null;let i=r.resolve(e),s=r.resolve(t);return gc(i,s,n)?new Ye(e,t,n):new x2(i,s,n).fit()}function gc(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class x2{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=F.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=F.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let s=this.placed,o=n.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new U(s,o,a);return e>-1?new Je(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new Ye(n.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<e;n++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,s=null;n?(s=la(this.unplaced.content,n-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(t==1&&(o?u.matchType(o.type)||(d=u.fillBefore(F.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:a,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=la(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new U(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=la(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new U(pi(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new U(pi(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let v=0;v<s.length;v++)this.openFrontierNode(s[v]);let o=this.unplaced,a=n?n.content:o.content,l=o.openStart-e,u=0,c=[],{match:d,type:f}=this.frontier[t];if(i){for(let v=0;v<i.childCount;v++)c.push(i.child(v));d=d.matchFragment(i)}let h=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let v=a.child(u),y=d.matchType(v.type);if(!y)break;u++,(u>1||l==0||v.content.size)&&(d=y,c.push(vc(v.mark(f.allowedMarks(v.marks)),u==1?l:0,u==a.childCount?h:-1)))}let m=u==a.childCount;m||(h=-1),this.placed=mi(this.placed,t,F.from(c)),this.frontier[t].match=d,m&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,y=a;v<h;v++){let w=y.lastChild;this.frontier.push({type:w.type,match:w.contentMatchAt(w.childCount)}),y=w.content}this.unplaced=m?e==0?U.empty:new U(pi(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new U(pi(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ua(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,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=ua(e,t,i,n,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=ua(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:t,fit:o,move:s?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=mi(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=mi(this.placed,this.depth,F.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(F.empty,!0);t.childCount&&(this.placed=mi(this.placed,this.frontier.length,t))}}function pi(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(pi(r.firstChild.content,e-1,t)))}function mi(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(mi(r.lastChild.content,e-1,t)))}function la(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function vc(r,e,t){if(e<=0)return r;let n=r.content;return e>1&&(n=n.replaceChild(0,vc(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=r.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(r.type.contentMatch.matchFragment(n).fillBefore(F.empty,!0)))),r.copy(n)}function ua(r,e,t,n,i){let s=r.node(e),o=i?r.indexAfter(e):r.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=n.fillBefore(s.content,!0,o);return a&&!S2(t,s.content,o)?a:null}function S2(r,e,t){for(let n=t;n<e.childCount;n++)if(!r.allowsMarks(e.child(n).marks))return!0;return!1}function k2(r){return r.spec.defining||r.spec.definingForContent}function T2(r,e,t,n){if(!n.size)return r.deleteRange(e,t);let i=r.doc.resolve(e),s=r.doc.resolve(t);if(gc(i,s,n))return r.step(new Ye(e,t,n));let o=bc(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let m=i.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),u=[],c=n.openStart;for(let f=n.content,h=0;;h++){let m=f.firstChild;if(u.push(m),h==n.openStart)break;f=m.content}for(let f=c-1;f>=0;f--){let h=u[f],m=k2(h.type);if(m&&!h.sameMarkup(i.node(Math.abs(a)-1)))c=f;else if(m||!h.type.isTextblock)break}for(let f=n.openStart;f>=0;f--){let h=(f+c+1)%(n.openStart+1),m=u[h];if(m)for(let v=0;v<o.length;v++){let y=o[(v+l)%o.length],w=!0;y<0&&(w=!1,y=-y);let k=i.node(y-1),E=i.index(y-1);if(k.canReplaceWith(E,E,m.type,m.marks))return r.replace(i.before(y),w?s.after(y):t,new U(yc(n.content,0,n.openStart,h),h,n.openEnd))}}let d=r.steps.length;for(let f=o.length-1;f>=0&&(r.replace(e,t,n),!(r.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),t=s.after(h))}}function yc(r,e,t,n,i){if(e<t){let s=r.firstChild;r=r.replaceChild(0,s.copy(yc(s.content,e+1,t,n,s)))}if(e>n){let s=i.contentMatchAt(0),o=s.fillBefore(r).append(r);r=o.append(s.matchFragment(o).fillBefore(F.empty,!0))}return r}function M2(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=w2(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new U(F.from(n),0,0))}function C2(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t),s=bc(n,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||n.node(a).type.contentMatch.validEnd)return r.delete(n.start(a),i.end(a));if(a>0&&(l||n.node(a-1).canReplace(n.index(a-1),i.indexAfter(a-1))))return r.delete(n.before(a),i.after(a))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o&&n.start(o-1)==i.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),i.index(o-1)))return r.delete(n.before(o),t);r.delete(e,t)}function bc(r,e){let t=[],n=Math.min(r.depth,e.depth);for(let i=n;i>=0;i--){let s=r.start(i);if(s<r.pos-(r.depth-i)||e.end(i)>e.pos+(e.depth-i)||r.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==r.depth&&i==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Cn extends nt{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 qe.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return qe.fromReplace(e,this.pos,this.pos+1,new U(F.from(i),0,t.isLeaf?0:1))}getMap(){return St.empty}invert(e){return new Cn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Cn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Cn(t.pos,t.attr,t.value)}}nt.jsonID("attr",Cn);class gi extends nt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return qe.ok(n)}getMap(){return St.empty}invert(e){return new gi(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new gi(t.attr,t.value)}}nt.jsonID("docAttr",gi);let En=class extends Error{};En=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},En.prototype=Object.create(Error.prototype),En.prototype.constructor=En,En.prototype.name="TransformError";class wc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new fi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new En(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}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=U.empty){let i=ys(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new U(F.from(n),0,0))}delete(e,t){return this.replace(e,t,U.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return T2(this,e,t,n),this}replaceRangeWith(e,t,n){return M2(this,e,t,n),this}deleteRange(e,t){return C2(this,e,t),this}lift(e,t){return c2(this,e,t),this}join(e,t=1){return b2(this,e,t),this}wrap(e,t){return f2(this,e,t),this}setBlockType(e,t=e,n,i=null){return p2(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return g2(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new Cn(e,t,n)),this}setDocAttribute(e,t){return this.step(new gi(e,t)),this}addNodeMark(e,t){return this.step(new Dr(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Ae)t.isInSet(n.marks)&&this.step(new un(e,t));else{let i=n.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new un(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,n){return v2(this,e,t,n),this}addMark(e,t,n){return a2(this,e,t,n),this}removeMark(e,t,n){return l2(this,e,t,n),this}clearIncompatible(e,t,n){return oa(this,e,t,n),this}}const ca=Object.create(null);class le{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new xc(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=U.empty){let n=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:u}=o[a],c=e.mapping.slice(s);e.replaceRange(c.map(l.pos),c.map(u.pos),a?U.empty:t),a==0&&Tc(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(n),u=l.map(o.pos),c=l.map(a.pos);s?e.deleteRange(u,c):(e.replaceRangeWith(u,c,t),Tc(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new de(e):An(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?An(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):An(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new kt(e.node(0))}static atStart(e){return An(e,e,0,0,1)||new kt(e)}static atEnd(e){return An(e,e,e.content.size,e.childCount,-1)||new kt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=ca[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ca)throw new RangeError("Duplicate use of selection JSON ID "+e);return ca[e]=t,t.prototype.jsonID=e,t}getBookmark(){return de.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class xc{constructor(e,t){this.$from=e,this.$to=t}}let Sc=!1;function kc(r){!Sc&&!r.parent.inlineContent&&(Sc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class de extends le{constructor(e,t=e){kc(e),kc(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return le.near(n);let i=e.resolve(t.map(this.anchor));return new de(i.parent.inlineContent?i:n,n)}replace(e,t=U.empty){if(super.replace(e,t),t==U.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof de&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bs(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new de(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=le.findFrom(t,n,!0)||le.findFrom(t,-n,!0);if(s)t=s.$head;else return le.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(le.findFrom(e,-n,!0)||le.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new de(e,t)}}le.jsonID("text",de);class bs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new bs(e.map(this.anchor),e.map(this.head))}resolve(e){return de.between(e.resolve(this.anchor),e.resolve(this.head))}}class ie extends le{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?le.near(s):new ie(s)}content(){return new U(F.from(this.node),0,0)}eq(e){return e instanceof ie&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new da(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ie(e.resolve(t.anchor))}static create(e,t){return new ie(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ie.prototype.visible=!1,le.jsonID("node",ie);class da{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new bs(n,n):new da(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&ie.isSelectable(n)?new ie(t):le.near(t)}}class kt extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=U.empty){if(t==U.empty){e.delete(0,e.doc.content.size);let n=le.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new kt(e)}map(e){return new kt(e)}eq(e){return e instanceof kt}getBookmark(){return E2}}le.jsonID("all",kt);const E2={map(){return this},resolve(r){return new kt(r)}};function An(r,e,t,n,i,s=!1){if(e.inlineContent)return de.create(r,t);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&ie.isSelectable(a))return ie.create(r,t-(i<0?a.nodeSize:0))}else{let l=An(r,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function Tc(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof Ye||i instanceof Je))return;let s=r.mapping.maps[n],o;s.forEach((a,l,u,c)=>{o==null&&(o=c)}),r.setSelection(le.near(r.doc.resolve(o),t))}const Mc=1,ws=2,Cc=4;class A2 extends wc{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 new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Mc)&~ws,this.storedMarks=null,this}get selectionSet(){return(this.updated&Mc)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ws,this}ensureMarks(e){return Ae.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&ws)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ws,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)||Ae.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(n==null&&(n=t),!e)return this.deleteRange(t,n);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,i.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(le.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|=Cc,this}get scrolledIntoView(){return(this.updated&Cc)>0}}function Ec(r,e){return!e||!r?r:r.bind(e)}class vi{constructor(e,t,n){this.name=e,this.init=Ec(t.init,n),this.apply=Ec(t.apply,n)}}const O2=[new vi("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new vi("selection",{init(r,e){return r.selection||le.atStart(e.doc)},apply(r){return r.selection}}),new vi("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new vi("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class ha{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=O2.slice(),t&&t.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new vi(n.key,n.spec.state,n))})}}class On{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 i=this.config.plugins[n];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,u=i?i[o].state:this,c=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,u,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),s=!0}i&&(i[o]={state:n,n:t.length})}}if(!s)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new On(this.config),n=this.config.fields;for(let i=0;i<n.length;i++){let s=n[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new A2(this)}static create(e){let t=new ha(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new On(t);for(let i=0;i<t.fields.length;i++)n[t.fields[i].name]=t.fields[i].init(e,n);return n}reconfigure(e){let t=new ha(this.schema,e.plugins),n=t.fields,i=new On(t);for(let s=0;s<n.length;s++){let o=n[s].name;i[o]=this.hasOwnProperty(o)?this[o]:n[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[n],s=i.spec.state;s&&s.toJSON&&(t[n]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new ha(e.schema,e.plugins),s=new On(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Ar.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=le.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let a in n){let l=n[a],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=u.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function Ac(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=Ac(i,e,{})),t[n]=i}return t}class Be{constructor(e){this.spec=e,this.props={},e.props&&Ac(e.props,this,this.props),this.key=e.key?e.key.key:Oc("plugin")}getState(e){return e[this.key]}}const fa=Object.create(null);function Oc(r){return r in fa?r+"$"+ ++fa[r]:(fa[r]=0,r+"$")}class Ve{constructor(e="key"){this.key=Oc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const pa=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function Nc(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const Dc=(r,e,t)=>{let n=Nc(r,t);if(!n)return!1;let i=ma(n);if(!i){let o=n.blockRange(),a=o&&Mn(o);return a==null?!1:(e&&e(r.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(Hc(r,i,e,-1))return!0;if(n.parent.content.size==0&&(Nn(s,"end")||ie.isSelectable(s)))for(let o=n.depth;;o--){let a=ys(r.doc,n.before(o),n.after(o),U.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=r.tr.step(a);l.setSelection(Nn(s,"end")?le.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):ie.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},N2=(r,e,t)=>{let n=Nc(r,t);if(!n)return!1;let i=ma(n);return i?Ic(r,i,e):!1},D2=(r,e,t)=>{let n=Pc(r,t);if(!n)return!1;let i=ga(n);return i?Ic(r,i,e):!1};function Ic(r,e,t){let n=e.nodeBefore,i=n,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=ys(r.doc,s,l,U.empty);if(!u||u.from!=s||u instanceof Ye&&u.slice.size>=l-s)return!1;if(t){let c=r.tr.step(u);c.setSelection(de.create(c.doc,s)),t(c.scrollIntoView())}return!0}function Nn(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const Rc=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=ma(n)}let o=s&&s.nodeBefore;return!o||!ie.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ie.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function ma(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function Pc(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const zc=(r,e,t)=>{let n=Pc(r,t);if(!n)return!1;let i=ga(n);if(!i)return!1;let s=i.nodeAfter;if(Hc(r,i,e,1))return!0;if(n.parent.content.size==0&&(Nn(s,"start")||ie.isSelectable(s))){let o=ys(r.doc,n.before(),n.after(),U.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=r.tr.step(o);a.setSelection(Nn(s,"start")?le.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):ie.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Lc=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;s=ga(n)}let o=s&&s.nodeAfter;return!o||!ie.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ie.create(r.doc,s.pos)).scrollIntoView()),!0)};function ga(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const I2=(r,e)=>{let t=r.selection,n=t instanceof ie,i;if(n){if(t.node.isTextblock||!Ir(r.doc,t.from))return!1;i=t.from}else if(i=vs(r.doc,t.from,-1),i==null)return!1;if(e){let s=r.tr.join(i);n&&s.setSelection(ie.create(s.doc,i-r.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},R2=(r,e)=>{let t=r.selection,n;if(t instanceof ie){if(t.node.isTextblock||!Ir(r.doc,t.to))return!1;n=t.to}else if(n=vs(r.doc,t.to,1),n==null)return!1;return e&&e(r.tr.join(n).scrollIntoView()),!0},P2=(r,e)=>{let{$from:t,$to:n}=r.selection,i=t.blockRange(n),s=i&&Mn(i);return s==null?!1:(e&&e(r.tr.lift(i,s).scrollIntoView()),!0)},Bc=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
501
- `).scrollIntoView()),!0)};function va(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const z2=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=va(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=r.tr.replaceWith(a,a,o.createAndFill());l.setSelection(le.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Fc=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof kt||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=va(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,a=r.tr.insert(o,s.createAndFill());a.setSelection(de.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},$c=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(ar(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&Mn(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function L2(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof ie&&e.selection.node.isBlock)return!n.parentOffset||!ar(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,a,l=!1,u=!1;for(let h=n.depth;;h--)if(n.node(h).isBlock){l=n.end(h)==n.pos+(n.depth-h),u=n.start(h)==n.pos-(n.depth-h),a=va(n.node(h-1).contentMatchAt(n.indexAfter(h-1))),s.unshift(l&&a?{type:a}:null),o=h;break}else{if(h==1)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof de||e.selection instanceof kt)&&c.deleteSelection();let d=c.mapping.map(n.pos),f=ar(c.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=ar(c.doc,d,s.length,s)),!f)return!1;if(c.split(d,s.length,s),!l&&u&&n.node(o).type!=a){let h=c.mapping.map(n.before(o)),m=c.doc.resolve(h);a&&n.node(o-1).canReplaceWith(m.index(),m.index()+1,a)&&c.setNodeMarkup(c.mapping.map(n.before(o)),a)}return t&&t(c.scrollIntoView()),!0}}const B2=L2(),F2=(r,e)=>{let{$from:t,to:n}=r.selection,i,s=t.sharedDepth(n);return s==0?!1:(i=t.before(s),e&&e(r.tr.setSelection(ie.create(r.doc,i))),!0)};function $2(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Ir(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function Hc(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&$2(r,e,t))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,m=F.empty;for(let w=o.length-1;w>=0;w--)m=F.from(o[w].create(null,m));m=F.from(i.copy(m));let v=r.tr.step(new Je(e.pos-1,h,e.pos,h,new U(m,1,0),o.length,!0)),y=v.doc.resolve(h+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&Ir(v.doc,y.pos)&&v.join(y.pos),t(v.scrollIntoView())}return!0}let c=s.type.spec.isolating||n>0&&l?null:le.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),f=d&&Mn(d);if(f!=null&&f>=e.depth)return t&&t(r.tr.lift(d,f).scrollIntoView()),!0;if(u&&Nn(s,"start",!0)&&Nn(i,"end")){let h=i,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let v=s,y=1;for(;!v.isTextblock;v=v.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,v.content)){if(t){let w=F.empty;for(let E=m.length-1;E>=0;E--)w=F.from(m[E].copy(w));let k=r.tr.step(new Je(e.pos-m.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new U(w,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Vc(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(de.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const H2=Vc(-1),V2=Vc(1);function j2(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&aa(o,r,e);return a?(n&&n(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function jc(r,e=null){return function(t,n){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,u)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(r,e)))if(l.type==r)i=!0;else{let c=t.doc.resolve(u),d=c.index();i=c.parent.canReplaceWith(d,d+1,r)}})}if(!i)return!1;if(n){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,r,e)}n(s.scrollIntoView())}return!0}}function ya(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}ya(pa,Dc,Rc),ya(pa,zc,Lc),ya(Bc,Fc,$c,B2),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function q2(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=n?t.tr:null;return _2(a,o,r,e)?(n&&n(a.scrollIntoView()),!0):!1}}function _2(r,e,t,n=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new hs(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new hs(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=aa(s,t,n,e);return a?(r&&W2(r,e,a,i,t),!0):!1}function W2(r,e,t,n,i){let s=F.empty;for(let c=t.length-1;c>=0;c--)s=F.from(t[c].type.create(t[c].attrs,s));r.step(new Je(e.start-(n?2:0),e.end,e.start,e.end,new U(s,0,0),t.length,!0));let o=0;for(let c=0;c<t.length;c++)t[c].type==i&&(o=c+1);let a=t.length-o,l=e.start+t.length-(n?2:0),u=e.parent;for(let c=e.startIndex,d=e.endIndex,f=!0;c<d;c++,f=!1)!f&&ar(r.doc,l,a)&&(r.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return r}function U2(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,o=>o.childCount>0&&o.firstChild.type==r);return s?t?n.node(s.depth-1).type==r?G2(e,t,r,s):K2(e,t,s):!0:!1}}function G2(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new Je(s-1,o,s,o,new U(F.from(t.create(null,n.parent.copy())),1,0),1,!0)),n=new hs(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const a=Mn(n);if(a==null)return!1;i.lift(n,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return Ir(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function K2(r,e,t){let n=r.tr,i=t.parent;for(let h=t.end,m=t.endIndex-1,v=t.startIndex;m>v;m--)h-=i.child(m).nodeSize,n.delete(h-1,h+1);let s=n.doc.resolve(t.start),o=s.nodeAfter;if(n.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,u=s.node(-1),c=s.index(-1);if(!u.canReplace(c+(a?0:1),c+1,o.content.append(l?F.empty:F.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return n.step(new Je(d-(a?1:0),f+(l?1:0),d+1,f-1,new U((a?F.empty:F.from(i.copy(F.empty))).append(l?F.empty:F.from(i.copy(F.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function Y2(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,u=>u.childCount>0&&u.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=r)return!1;if(t){let u=l.lastChild&&l.lastChild.type==a.type,c=F.from(u?r.create():null),d=new U(F.from(r.create(null,F.from(a.type.create(null,c)))),u?3:1,0),f=s.start,h=s.end;t(e.tr.step(new Je(f-(u?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const et=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},Dn=function(r){let e=r.assignedSlot||r.parentNode;return e&&e.nodeType==11?e.host:e};let ba=null;const lr=function(r,e,t){let n=ba||(ba=document.createRange());return n.setEnd(r,t??r.nodeValue.length),n.setStart(r,e||0),n},J2=function(){ba=null},cn=function(r,e,t,n){return t&&(qc(r,e,t,n,-1)||qc(r,e,t,n,1))},X2=/^(img|br|input|textarea|hr)$/i;function qc(r,e,t,n,i){for(var s;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Nt(r))){let o=r.parentNode;if(!o||o.nodeType!=1||yi(r)||X2.test(r.nodeName)||r.contentEditable=="false")return!1;e=et(r)+(i<0?0:1),r=o}else if(r.nodeType==1){let o=r.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else r=o,e=i<0?Nt(r):0}else return!1}}function Nt(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Z2(r,e){for(;;){if(r.nodeType==3&&e)return r;if(r.nodeType==1&&e>0){if(r.contentEditable=="false")return null;r=r.childNodes[e-1],e=Nt(r)}else if(r.parentNode&&!yi(r))e=et(r),r=r.parentNode;else return null}}function Q2(r,e){for(;;){if(r.nodeType==3&&e<r.nodeValue.length)return r;if(r.nodeType==1&&e<r.childNodes.length){if(r.contentEditable=="false")return null;r=r.childNodes[e],e=0}else if(r.parentNode&&!yi(r))e=et(r)+1,r=r.parentNode;else return null}}function ev(r,e,t){for(let n=e==0,i=e==Nt(r);n||i;){if(r==t)return!0;let s=et(r);if(r=r.parentNode,!r)return!1;n=n&&s==0,i=i&&s==Nt(r)}}function yi(r){let e;for(let t=r;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==r||e.contentDOM==r)}const xs=function(r){return r.focusNode&&cn(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function dn(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}function tv(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function rv(r,e,t){if(r.caretPositionFromPoint)try{let n=r.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:Math.min(Nt(n.offsetNode),n.offset)}}catch{}if(r.caretRangeFromPoint){let n=r.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:Math.min(Nt(n.startContainer),n.startOffset)}}}const Ut=typeof navigator<"u"?navigator:null,_c=typeof document<"u"?document:null,Rr=Ut&&Ut.userAgent||"",wa=/Edge\/(\d+)/.exec(Rr),Wc=/MSIE \d/.exec(Rr),xa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Rr),pt=!!(Wc||xa||wa),Pr=Wc?document.documentMode:xa?+xa[1]:wa?+wa[1]:0,Dt=!pt&&/gecko\/(\d+)/i.test(Rr);Dt&&+(/Firefox\/(\d+)/.exec(Rr)||[0,0])[1];const Sa=!pt&&/Chrome\/(\d+)/.exec(Rr),Xe=!!Sa,Uc=Sa?+Sa[1]:0,it=!pt&&!!Ut&&/Apple Computer/.test(Ut.vendor),In=it&&(/Mobile\/\w+/.test(Rr)||!!Ut&&Ut.maxTouchPoints>2),It=In||(Ut?/Mac/.test(Ut.platform):!1),Gc=Ut?/Win/.test(Ut.platform):!1,ur=/Android \d/.test(Rr),bi=!!_c&&"webkitFontSmoothing"in _c.documentElement.style,nv=bi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function iv(r){let e=r.defaultView&&r.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.documentElement.clientWidth,top:0,bottom:r.documentElement.clientHeight}}function cr(r,e){return typeof r=="number"?r:r[e]}function sv(r){let e=r.getBoundingClientRect(),t=e.width/r.offsetWidth||1,n=e.height/r.offsetHeight||1;return{left:e.left,right:e.left+r.clientWidth*t,top:e.top,bottom:e.top+r.clientHeight*n}}function Kc(r,e,t){let n=r.someProp("scrollThreshold")||0,i=r.someProp("scrollMargin")||5,s=r.dom.ownerDocument;for(let o=t||r.dom;o;){if(o.nodeType!=1){o=Dn(o);continue}let a=o,l=a==s.body,u=l?iv(s):sv(a),c=0,d=0;if(e.top<u.top+cr(n,"top")?d=-(u.top-e.top+cr(i,"top")):e.bottom>u.bottom-cr(n,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+cr(i,"top")-u.top:e.bottom-u.bottom+cr(i,"bottom")),e.left<u.left+cr(n,"left")?c=-(u.left-e.left+cr(i,"left")):e.right>u.right-cr(n,"right")&&(c=e.right-u.right+cr(i,"right")),c||d)if(l)s.defaultView.scrollBy(c,d);else{let h=a.scrollLeft,m=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let v=a.scrollLeft-h,y=a.scrollTop-m;e={left:e.left-v,top:e.top-y,right:e.right-v,bottom:e.bottom-y}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Dn(o)}}function ov(r){let e=r.dom.getBoundingClientRect(),t=Math.max(0,e.top),n,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=r.root.elementFromPoint(s,o);if(!a||a==r.dom||!r.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){n=a,i=l.top;break}}return{refDOM:n,refTop:i,stack:Yc(r.dom)}}function Yc(r){let e=[],t=r.ownerDocument;for(let n=r;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),r!=t);n=Dn(n));return e}function av({refDOM:r,refTop:e,stack:t}){let n=r?r.getBoundingClientRect().top:0;Jc(t,n==0?0:n-e)}function Jc(r,e){for(let t=0;t<r.length;t++){let{dom:n,top:i,left:s}=r[t];n.scrollTop!=i+e&&(n.scrollTop=i+e),n.scrollLeft!=s&&(n.scrollLeft=s)}}let Rn=null;function lv(r){if(r.setActive)return r.setActive();if(Rn)return r.focus(Rn);let e=Yc(r);r.focus(Rn==null?{get preventScroll(){return Rn={preventScroll:!0},!0}}:void 0),Rn||(Rn=!1,Jc(e,0))}function Xc(r,e){let t,n=2e8,i,s=0,o=e.top,a=e.top,l,u;for(let c=r.firstChild,d=0;c;c=c.nextSibling,d++){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=lr(c).getClientRects();else continue;for(let h=0;h<f.length;h++){let m=f[h];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let v=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(v<n){t=c,n=v,i=v&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,c.nodeType==1&&v&&(s=d+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=c,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=d+1)}}return!t&&l&&(t=l,i=u,n=0),t&&t.nodeType==3?uv(t,i):!t||n&&t.nodeType==1?{node:r,offset:s}:Xc(t,i)}function uv(r,e){let t=r.nodeValue.length,n=document.createRange(),i;for(let s=0;s<t;s++){n.setEnd(r,s+1),n.setStart(r,s);let o=zr(n,1);if(o.top!=o.bottom&&ka(e,o)){i={node:r,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return n.detach(),i||{node:r,offset:0}}function ka(r,e){return r.left>=e.left-1&&r.left<=e.right+1&&r.top>=e.top-1&&r.top<=e.bottom+1}function cv(r,e){let t=r.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<r.getBoundingClientRect().left?t:r}function dv(r,e,t){let{node:n,offset:i}=Xc(e,t),s=-1;if(n.nodeType==1&&!n.firstChild){let o=n.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return r.docView.posFromDOM(n,i,s)}function hv(r,e,t,n){let i=-1;for(let s=e,o=!1;s!=r.dom;){let a=r.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>n.left||l.top>n.top?i=a.posBefore:(!o&&l.right<n.left||l.bottom<n.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?n.top<(l.top+l.bottom)/2:n.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:r.docView.posFromDOM(e,t,-1)}function Zc(r,e,t){let n=r.childNodes.length;if(n&&t.top<t.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=r.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(ka(e,u))return Zc(o,e,u)}}if((s=(s+1)%n)==i)break}return r}function fv(r,e){let t=r.dom.ownerDocument,n,i=0,s=rv(t,e.left,e.top);s&&({node:n,offset:i}=s);let o=(r.root.elementFromPoint?r.root:t).elementFromPoint(e.left,e.top),a;if(!o||!r.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=r.dom.getBoundingClientRect();if(!ka(e,u)||(o=Zc(r.dom,e,u),!o))return null}if(it)for(let u=o;n&&u;u=Dn(u))u.draggable&&(n=void 0);if(o=cv(o,e),n){if(Dt&&n.nodeType==1&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let c=n.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let u;bi&&i&&n.nodeType==1&&(u=n.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,n==r.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?a=r.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(a=hv(r,n,i,e))}a==null&&(a=dv(r,o,e));let l=r.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Qc(r){return r.top<r.bottom||r.left<r.right}function zr(r,e){let t=r.getClientRects();if(t.length){let n=t[e<0?0:t.length-1];if(Qc(n))return n}return Array.prototype.find.call(t,Qc)||r.getBoundingClientRect()}const pv=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ed(r,e,t){let{node:n,offset:i,atom:s}=r.docView.domFromPos(e,t<0?-1:1),o=bi||Dt;if(n.nodeType==3)if(o&&(pv.test(n.nodeValue)||(t<0?!i:i==n.nodeValue.length))){let l=zr(lr(n,i,i),t);if(Dt&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let u=zr(lr(n,i-1,i-1),-1);if(u.top==l.top){let c=zr(lr(n,i,i+1),-1);if(c.top!=l.top)return wi(c,c.left<u.left)}}return l}else{let l=i,u=i,c=t<0?1:-1;return t<0&&!i?(u++,c=-1):t>=0&&i==n.nodeValue.length?(l--,c=1):t<0?l--:u++,wi(zr(lr(n,l,u),c),c<0)}if(!r.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Nt(n))){let l=n.childNodes[i-1];if(l.nodeType==1)return Ta(l.getBoundingClientRect(),!1)}if(s==null&&i<Nt(n)){let l=n.childNodes[i];if(l.nodeType==1)return Ta(l.getBoundingClientRect(),!0)}return Ta(n.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Nt(n))){let l=n.childNodes[i-1],u=l.nodeType==3?lr(l,Nt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return wi(zr(u,1),!1)}if(s==null&&i<Nt(n)){let l=n.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let u=l?l.nodeType==3?lr(l,0,o?0:1):l.nodeType==1?l:null:null;if(u)return wi(zr(u,-1),!0)}return wi(zr(n.nodeType==3?lr(n):n,-t),t>=0)}function wi(r,e){if(r.width==0)return r;let t=e?r.left:r.right;return{top:r.top,bottom:r.bottom,left:t,right:t}}function Ta(r,e){if(r.height==0)return r;let t=e?r.top:r.bottom;return{top:t,bottom:t,left:r.left,right:r.right}}function td(r,e,t){let n=r.state,i=r.root.activeElement;n!=e&&r.updateState(e),i!=r.dom&&r.focus();try{return t()}finally{n!=e&&r.updateState(n),i!=r.dom&&i&&i.focus()}}function mv(r,e,t){let n=e.selection,i=t=="up"?n.$from:n.$to;return td(r,e,()=>{let{node:s}=r.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=r.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=ed(r,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=lr(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let c=l[u];if(c.bottom>c.top+1&&(t=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const gv=/[\u0590-\u08ac]/;function vv(r,e,t){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,s=!i,o=i==n.parent.content.size,a=r.domSelection();return a?!gv.test(n.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:td(r,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:d}=r.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let h=n.depth?r.docView.domAfterPos(n.before()):r.dom,{focusNode:m,focusOffset:v}=r.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==v;try{a.collapse(c,d),l&&(l!=c||u!=d)&&a.extend&&a.extend(l,u)}catch{}return f!=null&&(a.caretBidiLevel=f),y}):n.pos==n.start()||n.pos==n.end()}let rd=null,nd=null,id=!1;function yv(r,e,t){return rd==e&&nd==t?id:(rd=e,nd=t,id=t=="up"||t=="down"?mv(r,e,t):vv(r,e,t))}const Rt=0,sd=1,hn=2,Gt=3;class xi{constructor(e,t,n,i){this.parent=e,this.children=t,this.dom=n,this.contentDOM=i,this.dirty=Rt,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 i=this.children[t];if(i==e)return n;n+=i.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 s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>et(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(n&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))n=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let i=this.children[t],s=n+i.size;if(n==e&&s!=n){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-n-i.border);n=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,i=0;for(let s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.size;if(a>e||o instanceof ld){i=e-s;break}s=a}if(i)return this.children[n].domFromPos(i-this.children[n].border,t);for(let s;n&&!(s=this.children[n-1]).size&&s instanceof od&&s.side>=0;n--);if(t<=0){let s,o=!0;for(;s=n?this.children[n-1]:null,!(!s||s.dom.parentNode==this.contentDOM);n--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?et(s.dom)+1:0}}else{let s,o=!0;for(;s=n<this.children.length?this.children[n]:null,!(!s||s.dom.parentNode==this.contentDOM);n++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?et(s.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 i=-1,s=-1;for(let o=n,a=0;;a++){let l=this.children[a],u=o+l.size;if(i==-1&&e<=u){let c=o+l.border;if(e>=c&&t<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,c);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=et(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(u>t||a==this.children.length-1)){t=u;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=et(d.dom);break}t+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}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 new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let v=this.children[h],y=m+v.size;if(s>m&&o<y)return v.setSelection(e-m-v.border,t-m-v.border,n,i);m=y}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),u=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((Dt||it)&&e==t){let{node:h,offset:m}=a;if(h.nodeType==3){if(d=!!(m&&h.nodeValue[m-1]==`
499
+ `),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 i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=n.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(u=>!l.clearMark(u)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,n,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let l=this.enter(o,t.attrs||null,n,t.preserveWhitespace);l&&(s=!0,n=l)}else{let l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,n,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,n),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,n,i){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,n){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+a)&&(i=u,s=l,!u.length))break;if(l.solid){if(n)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Ae.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):rc(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let s=this.findPlace(e.create(t),n,!1);return s&&(s=this.enterInner(e,t,n,!0,i)),s}enterInner(e,t,n,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=Qu(e,s,o.options);o.options&hi&&o.content.length==0&&(a|=hi);let l=Ae.none;return n=n.filter(u=>(o.type?o.type.allowsMarkType(u.type):rc(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new ps(e,t,l,i,null,a)),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;this.localPreserveWS&&(this.nodes[t].options|=di)}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 i=n.length-1;i>=0;i--)e+=n[i].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 i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].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,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let u=t[a];if(u==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:n&&l>=s?n.node(l-s).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return o(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 t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function t2(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&Zu.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function r2(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function tc(r){let e={};for(let t in r)e[t]=r[t];return e}function rc(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class ln{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=ta(t).createDocumentFragment());let i=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let u=o.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(s[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let u=o.marks[l++],c=this.serializeMark(u,o.isInline,t);c&&(s.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=ms(ta(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&ms(ta(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return ms(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ln(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=nc(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return nc(e.marks)}}function nc(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function ta(r){return r.document||window.document}const ic=new WeakMap;function n2(r){let e=ic.get(r);return e===void 0&&ic.set(r,e=i2(r)),e}function i2(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function ms(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=n2(n))&&s.indexOf(e)>-1)throw new 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&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?r.createElementNS(t,i):r.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),u[d]):d=="style"&&l.style?l.style.cssText=u[d]:l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:m}=ms(r,f,t,n);if(l.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const sc=65535,oc=Math.pow(2,16);function s2(r,e){return r+e*oc}function ac(r){return r&sc}function o2(r){return(r-(r&sc))/oc}const lc=1,uc=2,gs=4,cc=8;class ra{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&cc)>0}get deletedBefore(){return(this.delInfo&(lc|gs))>0}get deletedAfter(){return(this.delInfo&(uc|gs))>0}get deletedAcross(){return(this.delInfo&gs)>0}}class St{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&St.empty)return St.empty}recover(e){let t=0,n=ac(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+o2(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 i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+s],c=this.ranges[a+o],d=l+u;if(e<=d){let f=u?e==l?-1:e==d?1:t:t,h=l+i+(f<0?0:c);if(n)return h;let m=e==(t<0?l:d)?null:s2(a/3,e-l),v=e==l?uc:e==d?lc:gs;return(t<0?e!=l:e!=d)&&(v|=cc),new ra(h,v,m)}i+=c-u}return n?e+i:new ra(e+i,0,null)}touches(e,t){let n=0,i=ac(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?n:0);if(l>e)break;let u=this.ranges[a+s],c=l+u;if(e<=c&&a==i*3)return!0;n+=this.ranges[a+o]-u}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),u=this.ranges[i+t],c=this.ranges[i+n];e(a,a+u,l,l+c),s+=c-u}}invert(){return new St(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?St.empty:new St(e<0?[0,-e,0]:[0,0,e])}}St.empty=new St([]);class fi{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new fi(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!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 i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i: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=[]),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 i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new fi;return e.appendMappingInverted(this),e}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 i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return n?e:new ra(e,i,null)}}const na=Object.create(null);class nt{getMap(){return St.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=na[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in na)throw new RangeError("Duplicate use of step JSON ID "+e);return na[e]=t,t.prototype.jsonID=e,t}}class je{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new je(e,null)}static fail(e){return new je(null,e)}static fromReplace(e,t,n,i){try{return je.ok(e.replace(t,n,i))}catch(s){if(s instanceof cs)return je.fail(s.message);throw s}}}function ia(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(ia(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return F.fromArray(n)}class Nr extends nt{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),i=n.node(n.sharedDepth(this.to)),s=new U(ia(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return je.fromReplace(e,this.from,this.to,s)}invert(){return new Ft(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Nr(t.pos,n.pos,this.mark)}merge(e){return e instanceof Nr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Nr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Nr(t.from,t.to,e.markFromJSON(t.mark))}}nt.jsonID("addMark",Nr);class Ft extends nt{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 U(ia(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return je.fromReplace(e,this.from,this.to,n)}invert(){return new Nr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Ft(t.pos,n.pos,this.mark)}merge(e){return e instanceof Ft&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ft(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ft(t.from,t.to,e.markFromJSON(t.mark))}}nt.jsonID("removeMark",Ft);class Dr extends nt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return je.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return je.fromReplace(e,this.pos,this.pos+1,new U(F.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new Dr(this.pos,t.marks[i]);return new Dr(this.pos,this.mark)}}return new un(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Dr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Dr(t.pos,e.markFromJSON(t.mark))}}nt.jsonID("addNodeMark",Dr);class un extends nt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return je.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return je.fromReplace(e,this.pos,this.pos+1,new U(F.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Dr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new un(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new un(t.pos,e.markFromJSON(t.mark))}}nt.jsonID("removeNodeMark",un);class Ye extends nt{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&sa(e,this.from,this.to)?je.fail("Structure replace would overwrite content"):je.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new St([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ye(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Ye(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ye)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?U.empty:new U(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ye(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?U.empty:new U(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ye(e.from,this.to,t,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(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ye(t.from,t.to,U.fromJSON(e,t.slice),!!t.structure)}}nt.jsonID("replace",Ye);class Je extends nt{constructor(e,t,n,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(sa(e,this.from,this.gapFrom)||sa(e,this.gapTo,this.to)))return je.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return je.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?je.fromReplace(e,this.from,this.to,n):je.fail("Content does not fit in gap")}getMap(){return new St([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Je(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new Je(t.pos,n.pos,i,s,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(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Je(t.from,t.to,t.gapFrom,t.gapTo,U.fromJSON(e,t.slice),t.insert,!!t.structure)}}nt.jsonID("replaceAround",Je);function sa(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function a2(r,e,t,n){let i=[],s=[],o,a;r.doc.nodesBetween(e,t,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let f=Math.max(u,e),h=Math.min(u+l.nodeSize,t),m=n.addToSet(d);for(let v=0;v<d.length;v++)d[v].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[v])?o.to=h:i.push(o=new Ft(f,h,d[v])));a&&a.to==f?a.to=h:s.push(a=new Nr(f,h,n))}}),i.forEach(l=>r.step(l)),s.forEach(l=>r.step(l))}function l2(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(n instanceof fs){let u=o.marks,c;for(;c=n.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else n?n.isInSet(o.marks)&&(l=[n]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,t);for(let c=0;c<l.length;c++){let d=l[c],f;for(let h=0;h<i.length;h++){let m=i[h];m.step==s-1&&d.eq(i[h].style)&&(f=m)}f?(f.to=u,f.step=s):i.push({style:d,from:Math.max(a,e),to:u,step:s})}}}),i.forEach(o=>r.step(new Ft(o.from,o.to,o.style)))}function oa(r,e,t,n=t.contentMatch,i=!0){let s=r.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let u=s.child(l),c=a+u.nodeSize,d=n.matchType(u.type);if(!d)o.push(new Ye(a,c,U.empty));else{n=d;for(let f=0;f<u.marks.length;f++)t.allowsMarkType(u.marks[f].type)||r.step(new Ft(a,c,u.marks[f]));if(i&&u.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(u.text);)m||(m=new U(F.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),o.push(new Ye(a+f.index,a+f.index+f[0].length,m))}}a=c}if(!n.validEnd){let l=n.fillBefore(F.empty,!0);r.replace(a,a,new U(l,0,0))}for(let l=o.length-1;l>=0;l--)r.step(o[l])}function u2(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function Mn(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let o=r.$from.node(n),a=r.$from.index(n)+i,l=r.$to.indexAfter(n)-s;if(n<r.depth&&o.canReplace(a,l,t))return n;if(n==0||o.type.spec.isolating||!u2(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function c2(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),a=i.after(s+1),l=o,u=a,c=F.empty,d=0;for(let m=s,v=!1;m>t;m--)v||n.index(m)>0?(v=!0,c=F.from(n.node(m).copy(c)),d++):l--;let f=F.empty,h=0;for(let m=s,v=!1;m>t;m--)v||i.after(m+1)<i.end(m)?(v=!0,f=F.from(i.node(m).copy(f)),h++):u++;r.step(new Je(l,u,o,a,new U(c.append(f),d,h),c.size-d,!0))}function aa(r,e,t=null,n=r){let i=d2(r,e),s=i&&h2(n,e);return s?i.map(dc).concat({type:e,attrs:t}).concat(s.map(dc)):null}function dc(r){return{type:r,attrs:null}}function d2(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,i,o)?s:null}function h2(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let u=n;l&&u<i;u++)l=l.matchType(t.child(u).type);return!l||!l.validEnd?null:o}function f2(r,e,t){let n=F.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let a=t[o].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=F.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new Je(i,s,i,s,new U(n,0,0),t.length,!0))}function p2(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,l)&&m2(r.doc,r.mapping.slice(s).map(a),n)){let u=null;if(n.schema.linebreakReplacement){let h=n.whitespace=="pre",m=!!n.contentMatch.matchType(n.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&fc(r,o,a,s),oa(r,r.mapping.slice(s).map(a,1),n,void 0,u===null);let c=r.mapping.slice(s),d=c.map(a,1),f=c.map(a+o.nodeSize,1);return r.step(new Je(d,f,d+1,f-1,new U(F.from(n.create(l,null,o.marks)),0,0),1,!0)),u===!0&&hc(r,o,a,s),!1}})}function hc(r,e,t,n){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=r.mapping.slice(n).map(t+1+s+o.index);r.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function fc(r,e,t,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+s);r.replaceWith(o,o+1,e.type.schema.text(`
500
+ `))}})}function m2(r,e,t){let n=r.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function g2(r,e,t,n,i){let s=r.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(n,null,i||s.marks);if(s.isLeaf)return r.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new Je(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new U(F.from(o),0,0),1,!0))}function ar(r,e,t=1,n){let i=r.resolve(e),s=i.depth-t,o=n&&n[n.length-1]||i.parent;if(s<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 u=i.depth-1,c=t-2;u>s;u--,c--){let d=i.node(u),f=i.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),m=n&&n[c+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let v=n&&n[c]||d;if(!d.canReplace(f+1,d.childCount)||!v.type.validContent(h))return!1}let a=i.indexAfter(s),l=n&&n[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function v2(r,e,t=1,n){let i=r.doc.resolve(e),s=F.empty,o=F.empty;for(let a=i.depth,l=i.depth-t,u=t-1;a>l;a--,u--){s=F.from(i.node(a).copy(s));let c=n&&n[u];o=F.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}r.step(new Ye(e,e,new U(s.append(o),t,t),!0))}function Ir(r,e){let t=r.resolve(e),n=t.index();return pc(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function y2(r,e){e.content.size||r.type.compatibleContent(e.type);let t=r.contentMatchAt(r.childCount),{linebreakReplacement:n}=r.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==n?r.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!r.type.allowsMarks(s.marks))return!1}return t.validEnd}function pc(r,e){return!!(r&&e&&!r.isLeaf&&y2(r,e))}function vs(r,e,t=-1){let n=r.resolve(e);for(let i=n.depth;;i--){let s,o,a=n.index(i);if(i==n.depth?(s=n.nodeBefore,o=n.nodeAfter):t>0?(s=n.node(i+1),a++,o=n.node(i).maybeChild(a)):(s=n.node(i).maybeChild(a-1),o=n.node(i+1)),s&&!s.isTextblock&&pc(s,o)&&n.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?n.before(i):n.after(i)}}function b2(r,e,t){let n=null,{linebreakReplacement:i}=r.doc.type.schema,s=r.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);c&&!d?n=!1:!c&&d&&(n=!0)}let a=r.steps.length;if(n===!1){let c=r.doc.resolve(e+t);fc(r,c.node(),c.before(),a)}o.inlineContent&&oa(r,e+t-1,o,s.node().contentMatchAt(s.index()),n==null);let l=r.mapping.slice(a),u=l.map(e-t);if(r.step(new Ye(u,l.map(e+t,-1),U.empty,!0)),n===!0){let c=r.doc.resolve(u);hc(r,c.node(),c.before(),r.steps.length)}return r}function w2(r,e,t){let n=r.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let s=n.index(i);if(n.node(i).canReplaceWith(s,s,t))return n.before(i+1);if(s>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let s=n.indexAfter(i);if(n.node(i).canReplaceWith(s,s,t))return n.after(i+1);if(s<n.node(i).childCount)return null}return null}function mc(r,e,t){let n=r.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=n.depth;o>=0;o--){let a=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,l=n.index(o)+(a>0?1:0),u=n.node(o),c=!1;if(s==1)c=u.canReplace(l,l,i);else{let d=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(l,l,d[0])}if(c)return a==0?n.pos:a<0?n.before(o+1):n.after(o+1)}return null}function ys(r,e,t=e,n=U.empty){if(e==t&&!n.size)return null;let i=r.resolve(e),s=r.resolve(t);return gc(i,s,n)?new Ye(e,t,n):new x2(i,s,n).fit()}function gc(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class x2{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=F.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=F.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let s=this.placed,o=n.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new U(s,o,a);return e>-1?new Je(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new Ye(n.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<e;n++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,s=null;n?(s=la(this.unplaced.content,n-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(t==1&&(o?u.matchType(o.type)||(d=u.fillBefore(F.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:a,parent:s,inject:d};if(t==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:a,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=la(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new U(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=la(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new U(pi(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new U(pi(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let v=0;v<s.length;v++)this.openFrontierNode(s[v]);let o=this.unplaced,a=n?n.content:o.content,l=o.openStart-e,u=0,c=[],{match:d,type:f}=this.frontier[t];if(i){for(let v=0;v<i.childCount;v++)c.push(i.child(v));d=d.matchFragment(i)}let h=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let v=a.child(u),y=d.matchType(v.type);if(!y)break;u++,(u>1||l==0||v.content.size)&&(d=y,c.push(vc(v.mark(f.allowedMarks(v.marks)),u==1?l:0,u==a.childCount?h:-1)))}let m=u==a.childCount;m||(h=-1),this.placed=mi(this.placed,t,F.from(c)),this.frontier[t].match=d,m&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,y=a;v<h;v++){let w=y.lastChild;this.frontier.push({type:w.type,match:w.contentMatchAt(w.childCount)}),y=w.content}this.unplaced=m?e==0?U.empty:new U(pi(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new U(pi(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!ua(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,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=ua(e,t,i,n,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=ua(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:t,fit:o,move:s?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=mi(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=mi(this.placed,this.depth,F.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(F.empty,!0);t.childCount&&(this.placed=mi(this.placed,this.frontier.length,t))}}function pi(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(pi(r.firstChild.content,e-1,t)))}function mi(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(mi(r.lastChild.content,e-1,t)))}function la(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function vc(r,e,t){if(e<=0)return r;let n=r.content;return e>1&&(n=n.replaceChild(0,vc(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=r.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(r.type.contentMatch.matchFragment(n).fillBefore(F.empty,!0)))),r.copy(n)}function ua(r,e,t,n,i){let s=r.node(e),o=i?r.indexAfter(e):r.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=n.fillBefore(s.content,!0,o);return a&&!S2(t,s.content,o)?a:null}function S2(r,e,t){for(let n=t;n<e.childCount;n++)if(!r.allowsMarks(e.child(n).marks))return!0;return!1}function k2(r){return r.spec.defining||r.spec.definingForContent}function T2(r,e,t,n){if(!n.size)return r.deleteRange(e,t);let i=r.doc.resolve(e),s=r.doc.resolve(t);if(gc(i,s,n))return r.step(new Ye(e,t,n));let o=bc(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let m=i.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),u=[],c=n.openStart;for(let f=n.content,h=0;;h++){let m=f.firstChild;if(u.push(m),h==n.openStart)break;f=m.content}for(let f=c-1;f>=0;f--){let h=u[f],m=k2(h.type);if(m&&!h.sameMarkup(i.node(Math.abs(a)-1)))c=f;else if(m||!h.type.isTextblock)break}for(let f=n.openStart;f>=0;f--){let h=(f+c+1)%(n.openStart+1),m=u[h];if(m)for(let v=0;v<o.length;v++){let y=o[(v+l)%o.length],w=!0;y<0&&(w=!1,y=-y);let k=i.node(y-1),E=i.index(y-1);if(k.canReplaceWith(E,E,m.type,m.marks))return r.replace(i.before(y),w?s.after(y):t,new U(yc(n.content,0,n.openStart,h),h,n.openEnd))}}let d=r.steps.length;for(let f=o.length-1;f>=0&&(r.replace(e,t,n),!(r.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),t=s.after(h))}}function yc(r,e,t,n,i){if(e<t){let s=r.firstChild;r=r.replaceChild(0,s.copy(yc(s.content,e+1,t,n,s)))}if(e>n){let s=i.contentMatchAt(0),o=s.fillBefore(r).append(r);r=o.append(s.matchFragment(o).fillBefore(F.empty,!0))}return r}function M2(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=w2(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new U(F.from(n),0,0))}function C2(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t),s=bc(n,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||n.node(a).type.contentMatch.validEnd)return r.delete(n.start(a),i.end(a));if(a>0&&(l||n.node(a-1).canReplace(n.index(a-1),i.indexAfter(a-1))))return r.delete(n.before(a),i.after(a))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o&&n.start(o-1)==i.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),i.index(o-1)))return r.delete(n.before(o),t);r.delete(e,t)}function bc(r,e){let t=[],n=Math.min(r.depth,e.depth);for(let i=n;i>=0;i--){let s=r.start(i);if(s<r.pos-(r.depth-i)||e.end(i)>e.pos+(e.depth-i)||r.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==r.depth&&i==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Cn extends nt{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 je.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return je.fromReplace(e,this.pos,this.pos+1,new U(F.from(i),0,t.isLeaf?0:1))}getMap(){return St.empty}invert(e){return new Cn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Cn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Cn(t.pos,t.attr,t.value)}}nt.jsonID("attr",Cn);class gi extends nt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return je.ok(n)}getMap(){return St.empty}invert(e){return new gi(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new gi(t.attr,t.value)}}nt.jsonID("docAttr",gi);let En=class extends Error{};En=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t},En.prototype=Object.create(Error.prototype),En.prototype.constructor=En,En.prototype.name="TransformError";class wc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new fi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new En(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}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=U.empty){let i=ys(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new U(F.from(n),0,0))}delete(e,t){return this.replace(e,t,U.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return T2(this,e,t,n),this}replaceRangeWith(e,t,n){return M2(this,e,t,n),this}deleteRange(e,t){return C2(this,e,t),this}lift(e,t){return c2(this,e,t),this}join(e,t=1){return b2(this,e,t),this}wrap(e,t){return f2(this,e,t),this}setBlockType(e,t=e,n,i=null){return p2(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return g2(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new Cn(e,t,n)),this}setDocAttribute(e,t){return this.step(new gi(e,t)),this}addNodeMark(e,t){return this.step(new Dr(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Ae)t.isInSet(n.marks)&&this.step(new un(e,t));else{let i=n.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new un(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,n){return v2(this,e,t,n),this}addMark(e,t,n){return a2(this,e,t,n),this}removeMark(e,t,n){return l2(this,e,t,n),this}clearIncompatible(e,t,n){return oa(this,e,t,n),this}}const ca=Object.create(null);class le{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new xc(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=U.empty){let n=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:u}=o[a],c=e.mapping.slice(s);e.replaceRange(c.map(l.pos),c.map(u.pos),a?U.empty:t),a==0&&Tc(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(n),u=l.map(o.pos),c=l.map(a.pos);s?e.deleteRange(u,c):(e.replaceRangeWith(u,c,t),Tc(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new de(e):An(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?An(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):An(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new kt(e.node(0))}static atStart(e){return An(e,e,0,0,1)||new kt(e)}static atEnd(e){return An(e,e,e.content.size,e.childCount,-1)||new kt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=ca[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ca)throw new RangeError("Duplicate use of selection JSON ID "+e);return ca[e]=t,t.prototype.jsonID=e,t}getBookmark(){return de.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class xc{constructor(e,t){this.$from=e,this.$to=t}}let Sc=!1;function kc(r){!Sc&&!r.parent.inlineContent&&(Sc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class de extends le{constructor(e,t=e){kc(e),kc(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return le.near(n);let i=e.resolve(t.map(this.anchor));return new de(i.parent.inlineContent?i:n,n)}replace(e,t=U.empty){if(super.replace(e,t),t==U.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof de&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bs(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new de(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=le.findFrom(t,n,!0)||le.findFrom(t,-n,!0);if(s)t=s.$head;else return le.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(le.findFrom(e,-n,!0)||le.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new de(e,t)}}le.jsonID("text",de);class bs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new bs(e.map(this.anchor),e.map(this.head))}resolve(e){return de.between(e.resolve(this.anchor),e.resolve(this.head))}}class ie extends le{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?le.near(s):new ie(s)}content(){return new U(F.from(this.node),0,0)}eq(e){return e instanceof ie&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new da(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ie(e.resolve(t.anchor))}static create(e,t){return new ie(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ie.prototype.visible=!1,le.jsonID("node",ie);class da{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new bs(n,n):new da(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&ie.isSelectable(n)?new ie(t):le.near(t)}}class kt extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=U.empty){if(t==U.empty){e.delete(0,e.doc.content.size);let n=le.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new kt(e)}map(e){return new kt(e)}eq(e){return e instanceof kt}getBookmark(){return E2}}le.jsonID("all",kt);const E2={map(){return this},resolve(r){return new kt(r)}};function An(r,e,t,n,i,s=!1){if(e.inlineContent)return de.create(r,t);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&ie.isSelectable(a))return ie.create(r,t-(i<0?a.nodeSize:0))}else{let l=An(r,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function Tc(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof Ye||i instanceof Je))return;let s=r.mapping.maps[n],o;s.forEach((a,l,u,c)=>{o==null&&(o=c)}),r.setSelection(le.near(r.doc.resolve(o),t))}const Mc=1,ws=2,Cc=4;class A2 extends wc{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 new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Mc)&~ws,this.storedMarks=null,this}get selectionSet(){return(this.updated&Mc)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ws,this}ensureMarks(e){return Ae.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&ws)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ws,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)||Ae.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(n==null&&(n=t),!e)return this.deleteRange(t,n);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,i.text(e,s)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(le.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|=Cc,this}get scrolledIntoView(){return(this.updated&Cc)>0}}function Ec(r,e){return!e||!r?r:r.bind(e)}class vi{constructor(e,t,n){this.name=e,this.init=Ec(t.init,n),this.apply=Ec(t.apply,n)}}const O2=[new vi("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new vi("selection",{init(r,e){return r.selection||le.atStart(e.doc)},apply(r){return r.selection}}),new vi("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new vi("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class ha{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=O2.slice(),t&&t.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new vi(n.key,n.spec.state,n))})}}class On{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 i=this.config.plugins[n];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,u=i?i[o].state:this,c=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,u,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),s=!0}i&&(i[o]={state:n,n:t.length})}}if(!s)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new On(this.config),n=this.config.fields;for(let i=0;i<n.length;i++){let s=n[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new A2(this)}static create(e){let t=new ha(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new On(t);for(let i=0;i<t.fields.length;i++)n[t.fields[i].name]=t.fields[i].init(e,n);return n}reconfigure(e){let t=new ha(this.schema,e.plugins),n=t.fields,i=new On(t);for(let s=0;s<n.length;s++){let o=n[s].name;i[o]=this.hasOwnProperty(o)?this[o]:n[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[n],s=i.spec.state;s&&s.toJSON&&(t[n]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new ha(e.schema,e.plugins),s=new On(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Ar.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=le.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let a in n){let l=n[a],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=u.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function Ac(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=Ac(i,e,{})),t[n]=i}return t}class Be{constructor(e){this.spec=e,this.props={},e.props&&Ac(e.props,this,this.props),this.key=e.key?e.key.key:Oc("plugin")}getState(e){return e[this.key]}}const fa=Object.create(null);function Oc(r){return r in fa?r+"$"+ ++fa[r]:(fa[r]=0,r+"$")}class Ve{constructor(e="key"){this.key=Oc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const pa=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function Nc(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const Dc=(r,e,t)=>{let n=Nc(r,t);if(!n)return!1;let i=ma(n);if(!i){let o=n.blockRange(),a=o&&Mn(o);return a==null?!1:(e&&e(r.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(Hc(r,i,e,-1))return!0;if(n.parent.content.size==0&&(Nn(s,"end")||ie.isSelectable(s)))for(let o=n.depth;;o--){let a=ys(r.doc,n.before(o),n.after(o),U.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=r.tr.step(a);l.setSelection(Nn(s,"end")?le.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):ie.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},N2=(r,e,t)=>{let n=Nc(r,t);if(!n)return!1;let i=ma(n);return i?Ic(r,i,e):!1},D2=(r,e,t)=>{let n=Pc(r,t);if(!n)return!1;let i=ga(n);return i?Ic(r,i,e):!1};function Ic(r,e,t){let n=e.nodeBefore,i=n,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=ys(r.doc,s,l,U.empty);if(!u||u.from!=s||u instanceof Ye&&u.slice.size>=l-s)return!1;if(t){let c=r.tr.step(u);c.setSelection(de.create(c.doc,s)),t(c.scrollIntoView())}return!0}function Nn(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const Rc=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=ma(n)}let o=s&&s.nodeBefore;return!o||!ie.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ie.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function ma(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function Pc(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const zc=(r,e,t)=>{let n=Pc(r,t);if(!n)return!1;let i=ga(n);if(!i)return!1;let s=i.nodeAfter;if(Hc(r,i,e,1))return!0;if(n.parent.content.size==0&&(Nn(s,"start")||ie.isSelectable(s))){let o=ys(r.doc,n.before(),n.after(),U.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=r.tr.step(o);a.setSelection(Nn(s,"start")?le.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):ie.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Lc=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;s=ga(n)}let o=s&&s.nodeAfter;return!o||!ie.isSelectable(o)?!1:(e&&e(r.tr.setSelection(ie.create(r.doc,s.pos)).scrollIntoView()),!0)};function ga(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const I2=(r,e)=>{let t=r.selection,n=t instanceof ie,i;if(n){if(t.node.isTextblock||!Ir(r.doc,t.from))return!1;i=t.from}else if(i=vs(r.doc,t.from,-1),i==null)return!1;if(e){let s=r.tr.join(i);n&&s.setSelection(ie.create(s.doc,i-r.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},R2=(r,e)=>{let t=r.selection,n;if(t instanceof ie){if(t.node.isTextblock||!Ir(r.doc,t.to))return!1;n=t.to}else if(n=vs(r.doc,t.to,1),n==null)return!1;return e&&e(r.tr.join(n).scrollIntoView()),!0},P2=(r,e)=>{let{$from:t,$to:n}=r.selection,i=t.blockRange(n),s=i&&Mn(i);return s==null?!1:(e&&e(r.tr.lift(i,s).scrollIntoView()),!0)},Bc=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
501
+ `).scrollIntoView()),!0)};function va(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const z2=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=va(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=r.tr.replaceWith(a,a,o.createAndFill());l.setSelection(le.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Fc=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof kt||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=va(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,a=r.tr.insert(o,s.createAndFill());a.setSelection(de.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},$c=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(ar(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&Mn(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function L2(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof ie&&e.selection.node.isBlock)return!n.parentOffset||!ar(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,a,l=!1,u=!1;for(let h=n.depth;;h--)if(n.node(h).isBlock){l=n.end(h)==n.pos+(n.depth-h),u=n.start(h)==n.pos-(n.depth-h),a=va(n.node(h-1).contentMatchAt(n.indexAfter(h-1))),s.unshift(l&&a?{type:a}:null),o=h;break}else{if(h==1)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof de||e.selection instanceof kt)&&c.deleteSelection();let d=c.mapping.map(n.pos),f=ar(c.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=ar(c.doc,d,s.length,s)),!f)return!1;if(c.split(d,s.length,s),!l&&u&&n.node(o).type!=a){let h=c.mapping.map(n.before(o)),m=c.doc.resolve(h);a&&n.node(o-1).canReplaceWith(m.index(),m.index()+1,a)&&c.setNodeMarkup(c.mapping.map(n.before(o)),a)}return t&&t(c.scrollIntoView()),!0}}const B2=L2(),F2=(r,e)=>{let{$from:t,to:n}=r.selection,i,s=t.sharedDepth(n);return s==0?!1:(i=t.before(s),e&&e(r.tr.setSelection(ie.create(r.doc,i))),!0)};function $2(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Ir(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function Hc(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&$2(r,e,t))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,m=F.empty;for(let w=o.length-1;w>=0;w--)m=F.from(o[w].create(null,m));m=F.from(i.copy(m));let v=r.tr.step(new Je(e.pos-1,h,e.pos,h,new U(m,1,0),o.length,!0)),y=v.doc.resolve(h+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&Ir(v.doc,y.pos)&&v.join(y.pos),t(v.scrollIntoView())}return!0}let c=s.type.spec.isolating||n>0&&l?null:le.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),f=d&&Mn(d);if(f!=null&&f>=e.depth)return t&&t(r.tr.lift(d,f).scrollIntoView()),!0;if(u&&Nn(s,"start",!0)&&Nn(i,"end")){let h=i,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let v=s,y=1;for(;!v.isTextblock;v=v.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,v.content)){if(t){let w=F.empty;for(let E=m.length-1;E>=0;E--)w=F.from(m[E].copy(w));let k=r.tr.step(new Je(e.pos-m.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new U(w,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Vc(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(de.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const H2=Vc(-1),V2=Vc(1);function _2(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&aa(o,r,e);return a?(n&&n(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function _c(r,e=null){return function(t,n){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,u)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(r,e)))if(l.type==r)i=!0;else{let c=t.doc.resolve(u),d=c.index();i=c.parent.canReplaceWith(d,d+1,r)}})}if(!i)return!1;if(n){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,r,e)}n(s.scrollIntoView())}return!0}}function ya(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}ya(pa,Dc,Rc),ya(pa,zc,Lc),ya(Bc,Fc,$c,B2),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function j2(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=n?t.tr:null;return q2(a,o,r,e)?(n&&n(a.scrollIntoView()),!0):!1}}function q2(r,e,t,n=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new hs(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new hs(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=aa(s,t,n,e);return a?(r&&W2(r,e,a,i,t),!0):!1}function W2(r,e,t,n,i){let s=F.empty;for(let c=t.length-1;c>=0;c--)s=F.from(t[c].type.create(t[c].attrs,s));r.step(new Je(e.start-(n?2:0),e.end,e.start,e.end,new U(s,0,0),t.length,!0));let o=0;for(let c=0;c<t.length;c++)t[c].type==i&&(o=c+1);let a=t.length-o,l=e.start+t.length-(n?2:0),u=e.parent;for(let c=e.startIndex,d=e.endIndex,f=!0;c<d;c++,f=!1)!f&&ar(r.doc,l,a)&&(r.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return r}function U2(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,o=>o.childCount>0&&o.firstChild.type==r);return s?t?n.node(s.depth-1).type==r?G2(e,t,r,s):K2(e,t,s):!0:!1}}function G2(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new Je(s-1,o,s,o,new U(F.from(t.create(null,n.parent.copy())),1,0),1,!0)),n=new hs(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const a=Mn(n);if(a==null)return!1;i.lift(n,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return Ir(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function K2(r,e,t){let n=r.tr,i=t.parent;for(let h=t.end,m=t.endIndex-1,v=t.startIndex;m>v;m--)h-=i.child(m).nodeSize,n.delete(h-1,h+1);let s=n.doc.resolve(t.start),o=s.nodeAfter;if(n.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,u=s.node(-1),c=s.index(-1);if(!u.canReplace(c+(a?0:1),c+1,o.content.append(l?F.empty:F.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return n.step(new Je(d-(a?1:0),f+(l?1:0),d+1,f-1,new U((a?F.empty:F.from(i.copy(F.empty))).append(l?F.empty:F.from(i.copy(F.empty))),a?0:1,l?0:1),a?0:1)),e(n.scrollIntoView()),!0}function Y2(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,u=>u.childCount>0&&u.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=r)return!1;if(t){let u=l.lastChild&&l.lastChild.type==a.type,c=F.from(u?r.create():null),d=new U(F.from(r.create(null,F.from(a.type.create(null,c)))),u?3:1,0),f=s.start,h=s.end;t(e.tr.step(new Je(f-(u?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const et=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},Dn=function(r){let e=r.assignedSlot||r.parentNode;return e&&e.nodeType==11?e.host:e};let ba=null;const lr=function(r,e,t){let n=ba||(ba=document.createRange());return n.setEnd(r,t??r.nodeValue.length),n.setStart(r,e||0),n},J2=function(){ba=null},cn=function(r,e,t,n){return t&&(jc(r,e,t,n,-1)||jc(r,e,t,n,1))},X2=/^(img|br|input|textarea|hr)$/i;function jc(r,e,t,n,i){for(var s;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Nt(r))){let o=r.parentNode;if(!o||o.nodeType!=1||yi(r)||X2.test(r.nodeName)||r.contentEditable=="false")return!1;e=et(r)+(i<0?0:1),r=o}else if(r.nodeType==1){let o=r.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else r=o,e=i<0?Nt(r):0}else return!1}}function Nt(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Z2(r,e){for(;;){if(r.nodeType==3&&e)return r;if(r.nodeType==1&&e>0){if(r.contentEditable=="false")return null;r=r.childNodes[e-1],e=Nt(r)}else if(r.parentNode&&!yi(r))e=et(r),r=r.parentNode;else return null}}function Q2(r,e){for(;;){if(r.nodeType==3&&e<r.nodeValue.length)return r;if(r.nodeType==1&&e<r.childNodes.length){if(r.contentEditable=="false")return null;r=r.childNodes[e],e=0}else if(r.parentNode&&!yi(r))e=et(r)+1,r=r.parentNode;else return null}}function ev(r,e,t){for(let n=e==0,i=e==Nt(r);n||i;){if(r==t)return!0;let s=et(r);if(r=r.parentNode,!r)return!1;n=n&&s==0,i=i&&s==Nt(r)}}function yi(r){let e;for(let t=r;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==r||e.contentDOM==r)}const xs=function(r){return r.focusNode&&cn(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function dn(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}function tv(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function rv(r,e,t){if(r.caretPositionFromPoint)try{let n=r.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:Math.min(Nt(n.offsetNode),n.offset)}}catch{}if(r.caretRangeFromPoint){let n=r.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:Math.min(Nt(n.startContainer),n.startOffset)}}}const Ut=typeof navigator<"u"?navigator:null,qc=typeof document<"u"?document:null,Rr=Ut&&Ut.userAgent||"",wa=/Edge\/(\d+)/.exec(Rr),Wc=/MSIE \d/.exec(Rr),xa=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Rr),pt=!!(Wc||xa||wa),Pr=Wc?document.documentMode:xa?+xa[1]:wa?+wa[1]:0,Dt=!pt&&/gecko\/(\d+)/i.test(Rr);Dt&&+(/Firefox\/(\d+)/.exec(Rr)||[0,0])[1];const Sa=!pt&&/Chrome\/(\d+)/.exec(Rr),Xe=!!Sa,Uc=Sa?+Sa[1]:0,it=!pt&&!!Ut&&/Apple Computer/.test(Ut.vendor),In=it&&(/Mobile\/\w+/.test(Rr)||!!Ut&&Ut.maxTouchPoints>2),It=In||(Ut?/Mac/.test(Ut.platform):!1),Gc=Ut?/Win/.test(Ut.platform):!1,ur=/Android \d/.test(Rr),bi=!!qc&&"webkitFontSmoothing"in qc.documentElement.style,nv=bi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function iv(r){let e=r.defaultView&&r.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.documentElement.clientWidth,top:0,bottom:r.documentElement.clientHeight}}function cr(r,e){return typeof r=="number"?r:r[e]}function sv(r){let e=r.getBoundingClientRect(),t=e.width/r.offsetWidth||1,n=e.height/r.offsetHeight||1;return{left:e.left,right:e.left+r.clientWidth*t,top:e.top,bottom:e.top+r.clientHeight*n}}function Kc(r,e,t){let n=r.someProp("scrollThreshold")||0,i=r.someProp("scrollMargin")||5,s=r.dom.ownerDocument;for(let o=t||r.dom;o;){if(o.nodeType!=1){o=Dn(o);continue}let a=o,l=a==s.body,u=l?iv(s):sv(a),c=0,d=0;if(e.top<u.top+cr(n,"top")?d=-(u.top-e.top+cr(i,"top")):e.bottom>u.bottom-cr(n,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+cr(i,"top")-u.top:e.bottom-u.bottom+cr(i,"bottom")),e.left<u.left+cr(n,"left")?c=-(u.left-e.left+cr(i,"left")):e.right>u.right-cr(n,"right")&&(c=e.right-u.right+cr(i,"right")),c||d)if(l)s.defaultView.scrollBy(c,d);else{let h=a.scrollLeft,m=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let v=a.scrollLeft-h,y=a.scrollTop-m;e={left:e.left-v,top:e.top-y,right:e.right-v,bottom:e.bottom-y}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Dn(o)}}function ov(r){let e=r.dom.getBoundingClientRect(),t=Math.max(0,e.top),n,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=r.root.elementFromPoint(s,o);if(!a||a==r.dom||!r.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){n=a,i=l.top;break}}return{refDOM:n,refTop:i,stack:Yc(r.dom)}}function Yc(r){let e=[],t=r.ownerDocument;for(let n=r;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),r!=t);n=Dn(n));return e}function av({refDOM:r,refTop:e,stack:t}){let n=r?r.getBoundingClientRect().top:0;Jc(t,n==0?0:n-e)}function Jc(r,e){for(let t=0;t<r.length;t++){let{dom:n,top:i,left:s}=r[t];n.scrollTop!=i+e&&(n.scrollTop=i+e),n.scrollLeft!=s&&(n.scrollLeft=s)}}let Rn=null;function lv(r){if(r.setActive)return r.setActive();if(Rn)return r.focus(Rn);let e=Yc(r);r.focus(Rn==null?{get preventScroll(){return Rn={preventScroll:!0},!0}}:void 0),Rn||(Rn=!1,Jc(e,0))}function Xc(r,e){let t,n=2e8,i,s=0,o=e.top,a=e.top,l,u;for(let c=r.firstChild,d=0;c;c=c.nextSibling,d++){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=lr(c).getClientRects();else continue;for(let h=0;h<f.length;h++){let m=f[h];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let v=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(v<n){t=c,n=v,i=v&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,c.nodeType==1&&v&&(s=d+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=c,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=d+1)}}return!t&&l&&(t=l,i=u,n=0),t&&t.nodeType==3?uv(t,i):!t||n&&t.nodeType==1?{node:r,offset:s}:Xc(t,i)}function uv(r,e){let t=r.nodeValue.length,n=document.createRange(),i;for(let s=0;s<t;s++){n.setEnd(r,s+1),n.setStart(r,s);let o=zr(n,1);if(o.top!=o.bottom&&ka(e,o)){i={node:r,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return n.detach(),i||{node:r,offset:0}}function ka(r,e){return r.left>=e.left-1&&r.left<=e.right+1&&r.top>=e.top-1&&r.top<=e.bottom+1}function cv(r,e){let t=r.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<r.getBoundingClientRect().left?t:r}function dv(r,e,t){let{node:n,offset:i}=Xc(e,t),s=-1;if(n.nodeType==1&&!n.firstChild){let o=n.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return r.docView.posFromDOM(n,i,s)}function hv(r,e,t,n){let i=-1;for(let s=e,o=!1;s!=r.dom;){let a=r.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>n.left||l.top>n.top?i=a.posBefore:(!o&&l.right<n.left||l.bottom<n.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?n.top<(l.top+l.bottom)/2:n.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:r.docView.posFromDOM(e,t,-1)}function Zc(r,e,t){let n=r.childNodes.length;if(n&&t.top<t.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=r.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(ka(e,u))return Zc(o,e,u)}}if((s=(s+1)%n)==i)break}return r}function fv(r,e){let t=r.dom.ownerDocument,n,i=0,s=rv(t,e.left,e.top);s&&({node:n,offset:i}=s);let o=(r.root.elementFromPoint?r.root:t).elementFromPoint(e.left,e.top),a;if(!o||!r.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=r.dom.getBoundingClientRect();if(!ka(e,u)||(o=Zc(r.dom,e,u),!o))return null}if(it)for(let u=o;n&&u;u=Dn(u))u.draggable&&(n=void 0);if(o=cv(o,e),n){if(Dt&&n.nodeType==1&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let c=n.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let u;bi&&i&&n.nodeType==1&&(u=n.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,n==r.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?a=r.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(a=hv(r,n,i,e))}a==null&&(a=dv(r,o,e));let l=r.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Qc(r){return r.top<r.bottom||r.left<r.right}function zr(r,e){let t=r.getClientRects();if(t.length){let n=t[e<0?0:t.length-1];if(Qc(n))return n}return Array.prototype.find.call(t,Qc)||r.getBoundingClientRect()}const pv=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ed(r,e,t){let{node:n,offset:i,atom:s}=r.docView.domFromPos(e,t<0?-1:1),o=bi||Dt;if(n.nodeType==3)if(o&&(pv.test(n.nodeValue)||(t<0?!i:i==n.nodeValue.length))){let l=zr(lr(n,i,i),t);if(Dt&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let u=zr(lr(n,i-1,i-1),-1);if(u.top==l.top){let c=zr(lr(n,i,i+1),-1);if(c.top!=l.top)return wi(c,c.left<u.left)}}return l}else{let l=i,u=i,c=t<0?1:-1;return t<0&&!i?(u++,c=-1):t>=0&&i==n.nodeValue.length?(l--,c=1):t<0?l--:u++,wi(zr(lr(n,l,u),c),c<0)}if(!r.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Nt(n))){let l=n.childNodes[i-1];if(l.nodeType==1)return Ta(l.getBoundingClientRect(),!1)}if(s==null&&i<Nt(n)){let l=n.childNodes[i];if(l.nodeType==1)return Ta(l.getBoundingClientRect(),!0)}return Ta(n.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Nt(n))){let l=n.childNodes[i-1],u=l.nodeType==3?lr(l,Nt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return wi(zr(u,1),!1)}if(s==null&&i<Nt(n)){let l=n.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let u=l?l.nodeType==3?lr(l,0,o?0:1):l.nodeType==1?l:null:null;if(u)return wi(zr(u,-1),!0)}return wi(zr(n.nodeType==3?lr(n):n,-t),t>=0)}function wi(r,e){if(r.width==0)return r;let t=e?r.left:r.right;return{top:r.top,bottom:r.bottom,left:t,right:t}}function Ta(r,e){if(r.height==0)return r;let t=e?r.top:r.bottom;return{top:t,bottom:t,left:r.left,right:r.right}}function td(r,e,t){let n=r.state,i=r.root.activeElement;n!=e&&r.updateState(e),i!=r.dom&&r.focus();try{return t()}finally{n!=e&&r.updateState(n),i!=r.dom&&i&&i.focus()}}function mv(r,e,t){let n=e.selection,i=t=="up"?n.$from:n.$to;return td(r,e,()=>{let{node:s}=r.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=r.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=ed(r,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=lr(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let c=l[u];if(c.bottom>c.top+1&&(t=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const gv=/[\u0590-\u08ac]/;function vv(r,e,t){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,s=!i,o=i==n.parent.content.size,a=r.domSelection();return a?!gv.test(n.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:td(r,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:d}=r.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let h=n.depth?r.docView.domAfterPos(n.before()):r.dom,{focusNode:m,focusOffset:v}=r.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==v;try{a.collapse(c,d),l&&(l!=c||u!=d)&&a.extend&&a.extend(l,u)}catch{}return f!=null&&(a.caretBidiLevel=f),y}):n.pos==n.start()||n.pos==n.end()}let rd=null,nd=null,id=!1;function yv(r,e,t){return rd==e&&nd==t?id:(rd=e,nd=t,id=t=="up"||t=="down"?mv(r,e,t):vv(r,e,t))}const Rt=0,sd=1,hn=2,Gt=3;class xi{constructor(e,t,n,i){this.parent=e,this.children=t,this.dom=n,this.contentDOM=i,this.dirty=Rt,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 i=this.children[t];if(i==e)return n;n+=i.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 s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>et(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(n&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))n=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let i=this.children[t],s=n+i.size;if(n==e&&s!=n){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-n-i.border);n=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,i=0;for(let s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.size;if(a>e||o instanceof ld){i=e-s;break}s=a}if(i)return this.children[n].domFromPos(i-this.children[n].border,t);for(let s;n&&!(s=this.children[n-1]).size&&s instanceof od&&s.side>=0;n--);if(t<=0){let s,o=!0;for(;s=n?this.children[n-1]:null,!(!s||s.dom.parentNode==this.contentDOM);n--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?et(s.dom)+1:0}}else{let s,o=!0;for(;s=n<this.children.length?this.children[n]:null,!(!s||s.dom.parentNode==this.contentDOM);n++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?et(s.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 i=-1,s=-1;for(let o=n,a=0;;a++){let l=this.children[a],u=o+l.size;if(i==-1&&e<=u){let c=o+l.border;if(e>=c&&t<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,c);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=et(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(u>t||a==this.children.length-1)){t=u;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=et(d.dom);break}t+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}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 new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let v=this.children[h],y=m+v.size;if(s>m&&o<y)return v.setSelection(e-m-v.border,t-m-v.border,n,i);m=y}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),u=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((Dt||it)&&e==t){let{node:h,offset:m}=a;if(h.nodeType==3){if(d=!!(m&&h.nodeValue[m-1]==`
502
502
  `),d&&m==h.nodeValue.length)for(let v=h,y;v;v=v.parentNode){if(y=v.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:et(y)+1});break}let w=v.pmViewDesc;if(w&&w.node&&w.node.isBlock)break}}else{let v=h.childNodes[m-1];d=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(Dt&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&it)&&cn(a.node,a.offset,c.anchorNode,c.anchorOffset)&&cn(l.node,l.offset,c.focusNode,c.focusOffset))return;let f=!1;if((u.extend||e==t)&&!(d&&Dt)){u.collapse(a.node,a.offset);try{e!=t&&u.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>t){let m=a;a=l,l=m}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(h)}}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,i=0;i<this.children.length;i++){let s=this.children[i],o=n+s.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let a=n+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==n||t==o?hn:sd,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Gt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?hn:Gt}n=o}this.dirty=hn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?hn:sd;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class od extends xi{constructor(e,t,n,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(n,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Rt&&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}}class bv extends xi{constructor(e,t,n,i){super(e,[],t,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class fn extends xi{constructor(e,t,n,i,s){super(e,[],n,i),this.mark=t,this.spec=s}static create(e,t,n,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,n);return(!o||!o.dom)&&(o=ln.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new fn(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Gt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Gt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Rt){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=Rt}}slice(e,t,n){let i=fn.create(this.parent,this.mark,!0,n),s=this.children,o=this.size;t<o&&(s=Ca(s,t,o,n)),e>0&&(s=Ca(s,0,e,n));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Lr extends xi{constructor(e,t,n,i,s,o,a,l,u){super(e,[],s,o),this.node=t,this.outerDeco=n,this.innerDeco=i,this.nodeDOM=a}static create(e,t,n,i,s,o){let a=s.nodeViews[t.type.name],l,u=a&&a(t,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},n,i),c=u&&u.dom,d=u&&u.contentDOM;if(t.isText){if(!c)c=document.createTextNode(t.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=ln.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let f=c;return c=dd(c,n,t),u?l=new wv(e,t,n,i,c,d||null,f,u,s,o+1):t.isText?new Ss(e,t,n,i,c,f,s):new Lr(e,t,n,i,c,d||null,f,s,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=()=>F.empty)}return e}matchesNode(e,t,n){return this.dirty==Rt&&e.eq(this.node)&&ks(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new Sv(this,o&&o.node,e);Mv(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,n,e):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?Ae.none:this.node.child(c).marks,n,e),l.placeWidget(u,e,i)},(u,c,d,f)=>{l.syncToMarks(u.marks,n,e);let h;l.findNodeMatch(u,c,d,f)||a&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(h=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(u,c,d,h,e)||l.updateNextNode(u,c,d,e,f,i)||l.addNode(u,c,d,e,i),i+=u.nodeSize}),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==hn)&&(o&&this.protectLocalComposition(e,o),ud(this.contentDOM,this.children,e),In&&Cv(this.dom))}localCompositionInfo(e,t){let{from:n,to:i}=e.state.selection;if(!(e.state.selection instanceof de)||n<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=Ev(this.node.content,o,n-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new bv(this,s,t,i);e.input.compositionNodes.push(o),this.children=Ca(this.children,n,n+i.length,e,o)}update(e,t,n,i){return this.dirty==Gt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,i),!0)}updateInner(e,t,n,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Rt}updateOuterDeco(e){if(ks(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=cd(this.dom,this.nodeDOM,Ma(this.outerDeco,this.node,t),Ma(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 ad(r,e,t,n,i){dd(n,e,r);let s=new Lr(void 0,r,e,t,n,n,n,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Ss extends Lr{constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,null,o,a,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,i){return this.dirty==Gt||this.dirty!=Rt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Rt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Rt,!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(e,t,n){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new Ss(this.parent,i,this.outerDeco,this.innerDeco,s,s,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Gt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class ld extends xi{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Rt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class wv extends Lr{constructor(e,t,n,i,s,o,a,l,u,c){super(e,t,n,i,s,o,a,u,c),this.spec=l}update(e,t,n,i){if(this.dirty==Gt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,n);return s&&this.updateInner(e,t,n,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,i){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,i)}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 ud(r,e,t){let n=r.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==r){for(;a!=n;)n=hd(n),i=!0;n=n.nextSibling}else i=!0,r.insertBefore(a,n);if(o instanceof fn){let l=n?n.previousSibling:r.lastChild;ud(o.contentDOM,o.children,t),n=l?l.nextSibling:r.firstChild}}for(;n;)n=hd(n),i=!0;i&&t.trackWrites==r&&(t.trackWrites=null)}const Si=function(r){r&&(this.nodeName=r)};Si.prototype=Object.create(null);const pn=[new Si];function Ma(r,e,t){if(r.length==0)return pn;let n=t?pn[0]:new Si,i=[n];for(let s=0;s<r.length;s++){let o=r[s].type.attrs;if(o){o.nodeName&&i.push(n=new Si(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(n=new Si(e.isInline?"span":"div")),a=="class"?n.class=(n.class?n.class+" ":"")+l:a=="style"?n.style=(n.style?n.style+";":"")+l:a!="nodeName"&&(n[a]=l))}}}return i}function cd(r,e,t,n){if(t==pn&&n==pn)return e;let i=e;for(let s=0;s<n.length;s++){let o=n[s],a=t[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=r&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=pn[0]),i=l}xv(i,a||pn[0],o)}return i}function xv(r,e,t){for(let n in e)n!="class"&&n!="style"&&n!="nodeName"&&!(n in t)&&r.removeAttribute(n);for(let n in t)n!="class"&&n!="style"&&n!="nodeName"&&t[n]!=e[n]&&r.setAttribute(n,t[n]);if(e.class!=t.class){let n=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<n.length;s++)i.indexOf(n[s])==-1&&r.classList.remove(n[s]);for(let s=0;s<i.length;s++)n.indexOf(i[s])==-1&&r.classList.add(i[s]);r.classList.length==0&&r.removeAttribute("class")}if(e.style!=t.style){if(e.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=n.exec(e.style);)r.style.removeProperty(i[1])}t.style&&(r.style.cssText+=t.style)}}function dd(r,e,t){return cd(r,r,pn,Ma(e,t,r.nodeType!=1))}function ks(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].type.eq(e[t].type))return!1;return!0}function hd(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class Sv{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=kv(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){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Rt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let u=this.top.children[l];if(u.matchesMark(e[s])&&!this.isLocked(u.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=fn.create(this.top,e[s],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,n,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(e,t,n)&&!this.preMatch.matched.has(u)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,n,i,s){let o=this.top.children[i];return o.dirty==Gt&&o.dom==o.contentDOM&&(o.dirty=hn),o.update(e,t,n,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let n=e.pmViewDesc;if(n){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==n)return i}return-1}e=t}}updateNextNode(e,t,n,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Lr){let u=this.preMatch.matched.get(l);if(u!=null&&u!=s)return!1;let c=l.dom,d,f=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Gt&&ks(t,l.outerDeco));if(!f&&l.update(e,t,n,i))return this.destroyBetween(this.index,a),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,t,n,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=hn,d.updateChildren(i,o+1),d.dirty=Rt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ks(n,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Lr.create(this.top,t,n,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,n,i,s){let o=Lr.create(this.top,e,t,n,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new od(this.top,e,t,n);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof fn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ss)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((it||Xe)&&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 i=new ld(this.top,[],n,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function kv(r,e){let t=e,n=t.children.length,i=r.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(n){let u=t.children[n-1];if(u instanceof fn)t=u,n=u.children.length;else{a=u,n--;break}}else{if(t==e)break e;n=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(l){if(l!=r.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function Tv(r,e){return r.type.side-e.type.side}function Mv(r,e,t,n){let i=e.locals(r),s=0;if(i.length==0){for(let u=0;u<r.childCount;u++){let c=r.child(u);n(c,i,e.forChild(s,c),u),s+=c.nodeSize}return}let o=0,a=[],l=null;for(let u=0;;){let c,d;for(;o<i.length&&i[o].to==s;){let y=i[o++];y.widget&&(c?(d||(d=[c])).push(y):c=y)}if(c)if(d){d.sort(Tv);for(let y=0;y<d.length;y++)t(d[y],u,!!l)}else t(c,u,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(u<r.childCount)h=u,f=r.child(u++);else break;for(let y=0;y<a.length;y++)a[y].to<=s&&a.splice(y--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let m=s+f.nodeSize;if(f.isText){let y=m;o<i.length&&i[o].from<y&&(y=i[o].from);for(let w=0;w<a.length;w++)a[w].to<y&&(y=a[w].to);y<m&&(l=f.cut(y-s),f=f.cut(0,y-s),m=y,h=-1)}else for(;o<i.length&&i[o].to<m;)o++;let v=f.isInline&&!f.isLeaf?a.filter(y=>!y.inline):a.slice();n(f,v,e.forChild(s,f),h),s=m}}function Cv(r){if(r.nodeName=="UL"||r.nodeName=="OL"){let e=r.style.cssText;r.style.cssText=e+"; list-style: square !important",window.getComputedStyle(r).listStyle,r.style.cssText=e}}function Ev(r,e,t,n){for(let i=0,s=0;i<r.childCount&&s<=n;){let o=r.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<r.childCount;){let u=r.child(i++);if(s+=u.nodeSize,!u.isText)break;l+=u.text}if(s>=t){if(s>=n&&l.slice(n-e.length-a,n-a)==e)return n-e.length;let u=a<n?l.lastIndexOf(e,n-a-1):-1;if(u>=0&&u+e.length+a>=t)return a+u;if(t==n&&l.length>=n+e.length-a&&l.slice(n-a,n-a+e.length)==e)return n}}return-1}function Ca(r,e,t,n,i){let s=[];for(let o=0,a=0;o<r.length;o++){let l=r[o],u=a,c=a+=l.size;u>=t||c<=e?s.push(l):(u<e&&s.push(l.slice(0,e-u,n)),i&&(s.push(i),i=void 0),c>t&&s.push(l.slice(t-u,l.size,n)))}return s}function Ea(r,e=null){let t=r.domSelectionRange(),n=r.state.doc;if(!t.focusNode)return null;let i=r.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=r.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=n.resolve(o),l,u;if(xs(t)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&ie.isSelectable(d)&&i.parent&&!(d.isInline&&ev(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;u=new ie(o==f?a:n.resolve(f))}}else{if(t instanceof r.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,f=o;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);d=Math.min(d,r.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,r.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,o]=f==r.state.selection.anchor?[f,d]:[d,f],a=n.resolve(o)}else l=r.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let c=n.resolve(l);if(!u){let d=e=="pointer"||r.state.selection.head<a.pos&&!s?1:-1;u=Oa(r,c,a,d)}return u}function fd(r){return r.editable?r.hasFocus():wd(r)&&document.activeElement&&document.activeElement.contains(r.dom)}function dr(r,e=!1){let t=r.state.selection;if(vd(r,t),!!fd(r)){if(!e&&r.input.mouseDown&&r.input.mouseDown.allowDefault&&Xe){let n=r.domSelectionRange(),i=r.domObserver.currentSelection;if(n.anchorNode&&i.anchorNode&&cn(n.anchorNode,n.anchorOffset,i.anchorNode,i.anchorOffset)){r.input.mouseDown.delayedSelectionSync=!0,r.domObserver.setCurSelection();return}}if(r.domObserver.disconnectSelection(),r.cursorWrapper)Ov(r);else{let{anchor:n,head:i}=t,s,o;pd&&!(t instanceof de)&&(t.$from.parent.inlineContent||(s=md(r,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=md(r,t.to))),r.docView.setSelection(n,i,r,e),pd&&(s&&gd(s),o&&gd(o)),t.visible?r.dom.classList.remove("ProseMirror-hideselection"):(r.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Av(r))}r.domObserver.setCurSelection(),r.domObserver.connectSelection()}}const pd=it||Xe&&Uc<63;function md(r,e){let{node:t,offset:n}=r.docView.domFromPos(e,0),i=n<t.childNodes.length?t.childNodes[n]:null,s=n?t.childNodes[n-1]:null;if(it&&i&&i.contentEditable=="false")return Aa(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Aa(i);if(s)return Aa(s)}}function Aa(r){return r.contentEditable="true",it&&r.draggable&&(r.draggable=!1,r.wasDraggable=!0),r}function gd(r){r.contentEditable="false",r.wasDraggable&&(r.draggable=!0,r.wasDraggable=null)}function Av(r){let e=r.dom.ownerDocument;e.removeEventListener("selectionchange",r.input.hideSelectionGuard);let t=r.domSelectionRange(),n=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(t.anchorNode!=n||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!fd(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ov(r){let e=r.domSelection();if(!e)return;let t=r.cursorWrapper.dom,n=t.nodeName=="IMG";n?e.collapse(t.parentNode,et(t)+1):e.collapse(t,0),!n&&!r.state.selection.visible&&pt&&Pr<=11&&(t.disabled=!0,t.disabled=!1)}function vd(r,e){if(e instanceof ie){let t=r.docView.descAt(e.from);t!=r.lastSelectedViewDesc&&(yd(r),t&&t.selectNode(),r.lastSelectedViewDesc=t)}else yd(r)}function yd(r){r.lastSelectedViewDesc&&(r.lastSelectedViewDesc.parent&&r.lastSelectedViewDesc.deselectNode(),r.lastSelectedViewDesc=void 0)}function Oa(r,e,t,n){return r.someProp("createSelectionBetween",i=>i(r,e,t))||de.between(e,t,n)}function bd(r){return r.editable&&!r.hasFocus()?!1:wd(r)}function wd(r){let e=r.domSelectionRange();if(!e.anchorNode)return!1;try{return r.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(r.editable||r.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Nv(r){let e=r.docView.domFromPos(r.state.selection.anchor,0),t=r.domSelectionRange();return cn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Na(r,e){let{$anchor:t,$head:n}=r.selection,i=e>0?t.max(n):t.min(n),s=i.parent.inlineContent?i.depth?r.doc.resolve(e>0?i.after():i.before()):null:i;return s&&le.findFrom(s,e)}function Br(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function xd(r,e,t){let n=r.state.selection;if(n instanceof de)if(t.indexOf("s")>-1){let{$head:i}=n,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=r.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Br(r,new de(n.$anchor,o))}else if(n.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let i=Na(r.state,e);return i&&i instanceof ie?Br(r,i):!1}else if(!(It&&t.indexOf("m")>-1)){let i=n.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=r.docView.descAt(a))&&!o.contentDOM?ie.isSelectable(s)?Br(r,new ie(e<0?r.state.doc.resolve(i.pos-s.nodeSize):i)):bi?Br(r,new de(r.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(n instanceof ie&&n.node.isInline)return Br(r,new de(e>0?n.$to:n.$from));{let i=Na(r.state,e);return i?Br(r,i):!1}}}function Ts(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function ki(r,e){let t=r.pmViewDesc;return t&&t.size==0&&(e<0||r.nextSibling||r.nodeName!="BR")}function Pn(r,e){return e<0?Dv(r):Iv(r)}function Dv(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i,s,o=!1;for(Dt&&t.nodeType==1&&n<Ts(t)&&ki(t.childNodes[n],-1)&&(o=!0);;)if(n>0){if(t.nodeType!=1)break;{let a=t.childNodes[n-1];if(ki(a,-1))i=t,s=--n;else if(a.nodeType==3)t=a,n=t.nodeValue.length;else break}}else{if(Sd(t))break;{let a=t.previousSibling;for(;a&&ki(a,-1);)i=t.parentNode,s=et(a),a=a.previousSibling;if(a)t=a,n=Ts(t);else{if(t=t.parentNode,t==r.dom)break;n=0}}}o?Da(r,t,n):i&&Da(r,i,s)}function Iv(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i=Ts(t),s,o;for(;;)if(n<i){if(t.nodeType!=1)break;let a=t.childNodes[n];if(ki(a,1))s=t,o=++n;else break}else{if(Sd(t))break;{let a=t.nextSibling;for(;a&&ki(a,1);)s=a.parentNode,o=et(a)+1,a=a.nextSibling;if(a)t=a,n=0,i=Ts(t);else{if(t=t.parentNode,t==r.dom)break;n=i=0}}}s&&Da(r,s,o)}function Sd(r){let e=r.pmViewDesc;return e&&e.node&&e.node.isBlock}function Rv(r,e){for(;r&&e==r.childNodes.length&&!yi(r);)e=et(r)+1,r=r.parentNode;for(;r&&e<r.childNodes.length;){let t=r.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=0}}function Pv(r,e){for(;r&&!e&&!yi(r);)e=et(r),r=r.parentNode;for(;r&&e;){let t=r.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=r.childNodes.length}}function Da(r,e,t){if(e.nodeType!=3){let s,o;(o=Rv(e,t))?(e=o,t=0):(s=Pv(e,t))&&(e=s,t=s.nodeValue.length)}let n=r.domSelection();if(!n)return;if(xs(n)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),n.removeAllRanges(),n.addRange(s)}else n.extend&&n.extend(e,t);r.domObserver.setCurSelection();let{state:i}=r;setTimeout(()=>{r.state==i&&dr(r)},50)}function kd(r,e){let t=r.state.doc.resolve(e);if(!(Xe||Gc)&&t.parent.inlineContent){let i=r.coordsAtPos(e);if(e>t.start()){let s=r.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=r.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(r.dom).direction=="rtl"?"rtl":"ltr"}function Td(r,e,t){let n=r.state.selection;if(n instanceof de&&!n.empty||t.indexOf("s")>-1||It&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=n;if(!i.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let o=Na(r.state,e);if(o&&o instanceof ie)return Br(r,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=n instanceof kt?le.near(o,e):le.findFrom(o,e);return a?Br(r,a):!1}return!1}function Md(r,e){if(!(r.state.selection instanceof de))return!0;let{$head:t,$anchor:n,empty:i}=r.state.selection;if(!t.sameParent(n))return!0;if(!i)return!1;if(r.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=r.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),r.dispatch(o),!0}return!1}function Cd(r,e,t){r.domObserver.stop(),e.contentEditable=t,r.domObserver.start()}function zv(r){if(!it||r.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;Cd(r,n,"true"),setTimeout(()=>Cd(r,n,"false"),20)}return!1}function Lv(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function Bv(r,e){let t=e.keyCode,n=Lv(e);if(t==8||It&&t==72&&n=="c")return Md(r,-1)||Pn(r,-1);if(t==46&&!e.shiftKey||It&&t==68&&n=="c")return Md(r,1)||Pn(r,1);if(t==13||t==27)return!0;if(t==37||It&&t==66&&n=="c"){let i=t==37?kd(r,r.state.selection.from)=="ltr"?-1:1:-1;return xd(r,i,n)||Pn(r,i)}else if(t==39||It&&t==70&&n=="c"){let i=t==39?kd(r,r.state.selection.from)=="ltr"?1:-1:1;return xd(r,i,n)||Pn(r,i)}else{if(t==38||It&&t==80&&n=="c")return Td(r,-1,n)||Pn(r,-1);if(t==40||It&&t==78&&n=="c")return zv(r)||Td(r,1,n)||Pn(r,1);if(n==(It?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Ia(r,e){r.someProp("transformCopied",h=>{e=h(e,r)});let t=[],{content:n,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,s--;let h=n.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),n=h.content}let o=r.someProp("clipboardSerializer")||ln.fromSchema(r.state.schema),a=Pd(),l=a.createElement("div");l.appendChild(o.serializeFragment(n,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=Id[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let m=a.createElement(c[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=r.someProp("clipboardTextSerializer",h=>h(e,r))||e.content.textBetween(0,e.content.size,`
503
503
 
504
504
  `);return{dom:l,text:f,slice:e}}function Ed(r,e,t,n,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=!!e&&(n||s||!t);if(l){if(r.someProp("transformPastedText",f=>{e=f(e,s||n,r)}),s)return a=new U(F.from(r.state.schema.text(e.replace(/\r\n?/g,`
505
- `))),0,0),r.someProp("transformPasted",f=>{a=f(a,r,!0)}),a;let d=r.someProp("clipboardTextParser",f=>f(e,i,n,r));if(d)a=d;else{let f=i.marks(),{schema:h}=r.state,m=ln.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let y=o.appendChild(document.createElement("p"));v&&y.appendChild(m.serializeNode(h.text(v,f)))})}}else r.someProp("transformPastedHTML",d=>{t=d(t,r)}),o=Vv(t),bi&&jv(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(r.someProp("clipboardParser")||r.someProp("domParser")||Or.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Fv.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)a=qv(Dd(a,+c[1],+c[2]),c[4]);else if(a=U.maxOpen($v(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Dd(a,d,f)}return r.someProp("transformPasted",d=>{a=d(a,r,l)}),a}const Fv=/^(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 $v(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(r.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),u;if(!l)return o=null;if(u=o.length&&s.length&&Od(l,s,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Nd(o[o.length-1],s.length));let c=Ad(a,l);o.push(c),i=i.matchType(c.type),s=l}}),o)return F.from(o)}return r}function Ad(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,F.from(r));return r}function Od(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let s=Od(r,e,t,n.lastChild,i+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(F.from(Ad(t,r,i+1))))}}function Nd(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,Nd(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(F.empty,!0);return r.copy(t.append(n))}function Ra(r,e,t,n,i,s){let o=e<0?r.firstChild:r.lastChild,a=o.content;return r.childCount>1&&(s=0),i<n-1&&(a=Ra(a,e,t,n,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(F.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(a))}function Dd(r,e,t){return e<r.openStart&&(r=new U(Ra(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new U(Ra(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const Id={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Rd=null;function Pd(){return Rd||(Rd=document.implementation.createHTMLDocument("title"))}let Pa=null;function Hv(r){let e=window.trustedTypes;return e?(Pa||(Pa=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Pa.createHTML(r)):r}function Vv(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=Pd().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&Id[n[1].toLowerCase()])&&(r=i.map(s=>"<"+s+">").join("")+r+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Hv(r),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function jv(r){let e=r.querySelectorAll(Xe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function qv(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:s,openEnd:o}=r;for(let a=n.length-2;a>=0;a-=2){let l=t.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;i=F.from(l.create(n[a+1],i)),s++,o++}return new U(i,s,o)}const ot={},at={},_v={touchstart:!0,touchmove:!0};class Wv{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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Uv(r){for(let e in ot){let t=ot[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{Kv(r,n)&&!La(r,n)&&(r.editable||!(n.type in at))&&t(r,n)},_v[e]?{passive:!0}:void 0)}it&&r.dom.addEventListener("input",()=>null),za(r)}function Fr(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function Gv(r){r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function za(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>La(r,n))})}function La(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function Kv(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Yv(r,e){!La(r,e)&&ot[e.type]&&(r.editable||!(e.type in at))&&ot[e.type](r,e)}at.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!Ld(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(ur&&Xe&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),In&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,dn(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||Bv(r,t)?t.preventDefault():Fr(r,"key")},at.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)},at.keypress=(r,e)=>{let t=e;if(Ld(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||It&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof de)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode),s=()=>r.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",o=>o(r,n.$from.pos,n.$to.pos,i,s))&&r.dispatch(s()),t.preventDefault()}};function Ms(r){return{left:r.clientX,top:r.clientY}}function Jv(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function Ba(r,e,t,n,i){if(n==-1)return!1;let s=r.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(r.someProp(e,a=>o>s.depth?a(r,t,s.nodeAfter,s.before(o),i,!0):a(r,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function zn(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function Xv(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&ie.isSelectable(n)?(zn(r,new ie(t)),!0):!1}function Zv(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof ie&&(n=t.node);let s=r.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(ie.isSelectable(a)){n&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(zn(r,ie.create(r.state.doc,i)),!0):!1}function Qv(r,e,t,n,i){return Ba(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?Zv(r,t):Xv(r,t))}function e5(r,e,t,n){return Ba(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function t5(r,e,t,n){return Ba(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||r5(r,t,n)}function r5(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(zn(r,de.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)zn(r,de.create(n,a+1,a+1+o.content.size));else if(ie.isSelectable(o))zn(r,ie.create(n,a));else continue;return!0}}function Fa(r){return Cs(r)}const zd=It?"metaKey":"ctrlKey";ot.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=Fa(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&Jv(t,r.input.lastClick)&&!t[zd]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?s="doubleClick":r.input.lastClick.type=="doubleClick"&&(s="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=r.posAtCoords(Ms(t));o&&(s=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new n5(r,o,t,!!n)):(s=="doubleClick"?e5:t5)(r,o.pos,o.inside,t)?t.preventDefault():Fr(r,"pointer"))};class n5{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[zd],this.allowDefault=n.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let c=e.state.doc.resolve(t.pos);s=c.parent,o=c.depth?c.before():0}const a=i?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;(n.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof ie&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Dt&&!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)),Fr(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(()=>dr(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(Ms(e))),this.updateAllowDefault(e),this.allowDefault||!t?Fr(this.view,"pointer"):Qv(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||it&&this.mightDrag&&!this.mightDrag.node.isAtom||Xe&&!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)?(zn(this.view,le.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Fr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Fr(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)}}ot.touchstart=r=>{r.input.lastTouch=Date.now(),Fa(r),Fr(r,"pointer")},ot.touchmove=r=>{r.input.lastTouch=Date.now(),Fr(r,"pointer")},ot.contextmenu=r=>Fa(r);function Ld(r,e){return r.composing?!0:it&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const i5=ur?5e3:-1;at.compositionstart=at.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof de&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||Xe&&Gc&&s5(r)))r.markCursor=r.state.storedMarks||t.marks(),Cs(r,!0),r.markCursor=null;else if(Cs(r,!e.selection.empty),Dt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,s=n.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=r.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}r.input.composing=!0}Bd(r,i5)};function s5(r){let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let n=e.childNodes[t];return n.nodeType==1&&n.contentEditable=="false"}at.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,Bd(r,20))};function Bd(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>Cs(r),e))}function Fd(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=a5());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function o5(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=Z2(e.focusNode,e.focusOffset),n=Q2(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,s=r.domObserver.lastChangedTextNode;if(t==s||n==s)return s;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function a5(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function Cs(r,e=!1){if(!(ur&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),Fd(r),e||r.docView&&r.docView.dirty){let t=Ea(r),n=r.state.selection;return t&&!t.eq(n)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function l5(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const Ti=pt&&Pr<15||In&&nv<604;ot.copy=at.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=Ti?null:t.clipboardData,o=n.content(),{dom:a,text:l}=Ia(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):l5(r,a),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function u5(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function c5(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?Mi(r,n.value,null,i,e):Mi(r,n.textContent,n.innerHTML,i,e)},50)}function Mi(r,e,t,n,i){let s=Ed(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",l=>l(r,i,s||U.empty)))return!0;if(!s)return!1;let o=u5(s),a=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(s);return r.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function $d(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}at.paste=(r,e)=>{let t=e;if(r.composing&&!ur)return;let n=Ti?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&Mi(r,$d(n),n.getData("text/html"),i,t)?t.preventDefault():c5(r,t)};class Hd{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const d5=It?"altKey":"ctrlKey";function Vd(r,e){let t=r.someProp("dragCopies",n=>!n(e));return t??!e[d5]}ot.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,s=i.empty?null:r.posAtCoords(Ms(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ie?i.to-1:i.to))){if(n&&n.mightDrag)o=ie.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=r.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=r.docView&&(o=ie.create(r.state.doc,d.posBefore))}}let a=(o||r.state.selection).content(),{dom:l,text:u,slice:c}=Ia(r,a);(!t.dataTransfer.files.length||!Xe||Uc>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ti?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ti||t.dataTransfer.setData("text/plain",u),r.dragging=new Hd(c,Vd(r,t),o)},ot.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)},at.dragover=at.dragenter=(r,e)=>e.preventDefault(),at.drop=(r,e)=>{try{h5(r,e,r.dragging)}finally{r.dragging=null}};function h5(r,e,t){if(!e.dataTransfer)return;let n=r.posAtCoords(Ms(e));if(!n)return;let i=r.state.doc.resolve(n.pos),s=t&&t.slice;s?r.someProp("transformPasted",h=>{s=h(s,r,!1)}):s=Ed(r,$d(e.dataTransfer),Ti?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&Vd(r,e));if(r.someProp("handleDrop",h=>h(r,e,s||U.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?mc(r.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=r.state.tr;if(o){let{node:h}=t;h?h.replace(l):l.deleteSelection()}let u=l.mapping.map(a),c=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(c?l.replaceRangeWith(u,u,s.content.firstChild):l.replaceRange(u,u,s),l.doc.eq(d))return;let f=l.doc.resolve(u);if(c&&ie.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new ie(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,v,y,w)=>h=w),l.setSelection(Oa(r,f,l.doc.resolve(h)))}r.focus(),r.dispatch(l.setMeta("uiEvent","drop"))}ot.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&dr(r)},20))},ot.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)},ot.beforeinput=(r,e)=>{if(Xe&&ur&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",s=>s(r,dn(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in at)ot[r]=at[r];function Ci(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Es{constructor(e,t){this.toDOM=e,this.spec=t||mn,this.side=this.spec.side||0}map(e,t,n,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new lt(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Es&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ci(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class $r{constructor(e,t){this.attrs=e,this.spec=t||mn}map(e,t,n,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new lt(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof $r&&Ci(this.attrs,e.attrs)&&Ci(this.spec,e.spec)}static is(e){return e.type instanceof $r}destroy(){}}class $a{constructor(e,t){this.attrs=e,this.spec=t||mn}map(e,t,n,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new lt(s.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(n)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof $a&&Ci(this.attrs,e.attrs)&&Ci(this.spec,e.spec)}destroy(){}}class lt{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new lt(e,t,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(e,t,n){return new lt(e,e,new Es(t,n))}static inline(e,t,n,i){return new lt(e,t,new $r(n,i))}static node(e,t,n,i){return new lt(e,t,new $a(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof $r}get widget(){return this.type instanceof Es}}const Ln=[],mn={};class Re{constructor(e,t){this.local=e.length?e:Ln,this.children=t.length?t:Ln}static create(e,t){return t.length?As(t,e,0,mn):st}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&n.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,n,i+a,s)}}map(e,t,n){return this==st||e.maps.length==0?this:this.mapInner(e,t,0,0,n||mn)}mapInner(e,t,n,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?f5(this.children,o||[],e,t,n,i,s):o?new Re(o.sort(gn),Ln):st}add(e,t){return t.length?this==st?Re.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,s=0;e.forEach((a,l)=>{let u=l+n,c;if(c=qd(t,a,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,c,u+1):i.splice(s,0,l,l+a.nodeSize,As(c,a,u+1,mn)),s+=3}});let o=jd(s?_d(t):t,-n);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Re(o.length?this.local.concat(o).sort(gn):this.local,i||this.children)}remove(e){return e.length==0||this==st?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let s=0;s<n.length;s+=3){let o,a=n[s]+t,l=n[s+1]+t;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<l&&(e[c]=null,(o||(o=[])).push(d));if(!o)continue;n==this.children&&(n=this.children.slice());let u=n[s+2].removeInner(o,a+1);u!=st?n[s+2]=u:(n.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new Re(i,n):st}forChild(e,t){if(this==st)return this;if(t.isLeaf)return Re.empty;let n,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(n=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof $r){let u=Math.max(s,l.from)-s,c=Math.min(o,l.to)-s;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new Re(i.sort(gn),Ln);return n?new Hr([a,n]):a}return n||st}eq(e){if(this==e)return!0;if(!(e instanceof Re)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ha(this.localsInner(e))}localsInner(e){if(this==st)return Ln;if(e.inlineContent||!this.local.some($r.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof $r||t.push(this.local[n]);return t}forEachSet(e){e(this)}}Re.empty=new Re([],[]),Re.removeOverlap=Ha;const st=Re.empty;class Hr{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,mn));return Hr.from(n)}forChild(e,t){if(t.isLeaf)return Re.empty;let n=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=st&&(s instanceof Hr?n=n.concat(s.members):n.push(s))}return Hr.from(n)}eq(e){if(!(e instanceof Hr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{n&&(t=t.slice(),n=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Ha(n?t:t.sort(gn)):Ln}static from(e){switch(e.length){case 0:return st;case 1:return e[0];default:return new Hr(e.every(t=>t instanceof Re)?e:e.reduce((t,n)=>t.concat(n instanceof Re?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function f5(r,e,t,n,i,s,o){let a=r.slice();for(let u=0,c=s;u<t.maps.length;u++){let d=0;t.maps[u].forEach((f,h,m,v)=>{let y=v-m-(h-f);for(let w=0;w<a.length;w+=3){let k=a[w+1];if(k<0||f>k+c-d)continue;let E=a[w]+c-d;h>=E?a[w+1]=f<=E?-2:-1:f>=c&&y&&(a[w]+=y,a[w+1]+=y)}d+=y}),c=t.maps[u].map(c,-1)}let l=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){l=!0,a[u+1]=-1;continue}let c=t.map(r[u]+s),d=c-i;if(d<0||d>=n.content.size){l=!0;continue}let f=t.map(r[u+1]+s,-1),h=f-i,{index:m,offset:v}=n.content.findIndex(d),y=n.maybeChild(m);if(y&&v==d&&v+y.nodeSize==h){let w=a[u+2].mapInner(t,y,c+1,r[u]+s+1,o);w!=st?(a[u]=d,a[u+1]=h,a[u+2]=w):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=p5(a,r,e,t,i,s,o),c=As(u,n,0,o);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<c.children.length;d+=3){let h=c.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Re(e.sort(gn),a)}function jd(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new lt(i.from+e,i.to+e,i.type))}return t}function p5(r,e,t,n,i,s,o){function a(l,u){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(n,i,u);d?t.push(d):o.onRemove&&o.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)a(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<r.length;l+=3)r[l+1]==-1&&a(r[l+2],e[l]+s+1);return t}function qd(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let s=0,o;s<r.length;s++)(o=r[s])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[s]=null);return i}function _d(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function As(r,e,t,n){let i=[],s=!1;e.forEach((a,l)=>{let u=qd(r,a,l+t);if(u){s=!0;let c=As(u,a,t+l+1,n);c!=st&&i.push(l,l+a.nodeSize,c)}});let o=jd(s?_d(r):r,-t).sort(gn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(n.onRemove&&n.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new Re(o,i):st}function gn(r,e){return r.from-e.from||r.to-e.to}function Ha(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==n.from){s.to!=n.to&&(e==r&&(e=r.slice()),e[i]=s.copy(s.from,n.to),Wd(e,i+1,s.copy(n.to,s.to)));continue}else{s.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,s.from),Wd(e,i,n.copy(s.from,n.to)));break}}}return e}function Wd(r,e,t){for(;e<r.length&&gn(t,r[e])>0;)e++;r.splice(e,0,t)}function Va(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=st&&e.push(n)}),r.cursorWrapper&&e.push(Re.create(r.state.doc,[r.cursorWrapper.deco])),Hr.from(e)}const m5={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},g5=pt&&Pr<=11;class v5{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}}class y5{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new v5,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);pt&&Pr<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),g5&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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,m5)),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(bd(this.view)){if(this.suppressingSelectionUpdates)return dr(this.view);if(pt&&Pr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&cn(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 s=e.focusNode;s;s=Dn(s))t.add(s);for(let s=e.anchorNode;s;s=Dn(s))if(t.has(s)){n=s;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.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(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&bd(e)&&!this.ignoreSelectionChange(n),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let c=0;c<t.length;c++){let d=this.registerMutation(t[c],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(Dt&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||x5(e,d)!=h)&&f.remove()}}}else if((Xe||it)&&l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&xs(n)&&(u=Ea(e))&&u.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,dr(e),this.currentSelection.set(n),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),b5(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||dr(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 c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,s=e.nextSibling;if(pt&&Pr<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?et(i)+1:0,a=n.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?et(s):e.target.childNodes.length,u=n.localPosFromDOM(e.target,l,1);return{from:a,to:u}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ud=new WeakMap,Gd=!1;function b5(r){if(!Ud.has(r)&&(Ud.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=Dt,Gd)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."),Gd=!0}}function Kd(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,s=e.endOffset,o=r.domAtPos(r.state.selection.anchor);return cn(o.node,o.offset,i,s)&&([t,n,i,s]=[i,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}}function w5(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return Kd(r,i)}let t;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",n,!0),t?Kd(r,t):null}function x5(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let n=r.docView.nearestDesc(t,!0);if(n&&n.node.isBlock)return t}return null}function S5(r,e,t){let{node:n,fromOffset:i,toOffset:s,from:o,to:a}=r.docView.parseRange(e,t),l=r.domSelectionRange(),u,c=l.anchorNode;if(c&&r.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:l.anchorOffset}],xs(l)||u.push({node:l.focusNode,offset:l.focusOffset})),Xe&&r.input.lastKeyCode===8)for(let y=s;y>i;y--){let w=n.childNodes[y-1],k=w.pmViewDesc;if(w.nodeName=="BR"&&!k){s=y;break}if(!k||k.size)break}let d=r.state.doc,f=r.someProp("domParser")||Or.fromSchema(r.state.schema),h=d.resolve(o),m=null,v=f.parse(n,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:k5,context:h});if(u&&u[0].pos!=null){let y=u[0].pos,w=u[1]&&u[1].pos;w==null&&(w=y),m={anchor:y+o,head:w+o}}return{doc:v,sel:m,from:o,to:a}}function k5(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(it&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||it&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const T5=/^(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 M5(r,e,t,n,i){let s=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let D=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,B=Ea(r,D);if(B&&!r.state.selection.eq(B)){if(Xe&&ur&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",V=>V(r,dn(13,"Enter"))))return;let L=r.state.tr.setSelection(B);D=="pointer"?L.setMeta("pointer",!0):D=="key"&&L.scrollIntoView(),s&&L.setMeta("composition",s),r.dispatch(L)}return}let o=r.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=r.state.doc.resolve(t).after(a+1);let l=r.state.selection,u=S5(r,e,t),c=r.state.doc,d=c.slice(u.from,u.to),f,h;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(f=r.state.selection.to,h="end"):(f=r.state.selection.from,h="start"),r.input.lastKeyCode=null;let m=A5(d.content,u.doc.content,u.from,f,h);if(m&&r.input.domChangeCount++,(In&&r.input.lastIOSEnter>Date.now()-225||ur)&&i.some(D=>D.nodeType==1&&!T5.test(D.nodeName))&&(!m||m.endA>=m.endB)&&r.someProp("handleKeyDown",D=>D(r,dn(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!m)if(n&&l instanceof de&&!l.empty&&l.$head.sameParent(l.$anchor)&&!r.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let D=Yd(r,r.state.doc,u.sel);if(D&&!D.eq(r.state.selection)){let B=r.state.tr.setSelection(D);s&&B.setMeta("composition",s),r.dispatch(B)}}return}r.state.selection.from<r.state.selection.to&&m.start==m.endB&&r.state.selection instanceof de&&(m.start>r.state.selection.from&&m.start<=r.state.selection.from+2&&r.state.selection.from>=u.from?m.start=r.state.selection.from:m.endA<r.state.selection.to&&m.endA>=r.state.selection.to-2&&r.state.selection.to<=u.to&&(m.endB+=r.state.selection.to-m.endA,m.endA=r.state.selection.to)),pt&&Pr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let v=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),w=c.resolve(m.start),k=v.sameParent(y)&&v.parent.inlineContent&&w.end()>=m.endA;if((In&&r.input.lastIOSEnter>Date.now()-225&&(!k||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!k&&v.pos<u.doc.content.size&&(!v.sameParent(y)||!v.parent.inlineContent)&&v.pos<y.pos&&!/\S/.test(u.doc.textBetween(v.pos,y.pos,"","")))&&r.someProp("handleKeyDown",D=>D(r,dn(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>m.start&&E5(c,m.start,m.endA,v,y)&&r.someProp("handleKeyDown",D=>D(r,dn(8,"Backspace")))){ur&&Xe&&r.domObserver.suppressSelectionUpdates();return}Xe&&m.endB==m.start&&(r.input.lastChromeDelete=Date.now()),ur&&!k&&v.start()!=y.start()&&y.parentOffset==0&&v.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{r.someProp("handleKeyDown",function(D){return D(r,dn(13,"Enter"))})},20));let E=m.start,R=m.endA,O=D=>{let B=D||r.state.tr.replace(E,R,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let L=Yd(r,B.doc,u.sel);L&&!(Xe&&r.composing&&L.empty&&(m.start!=m.endB||r.input.lastChromeDelete<Date.now()-100)&&(L.head==E||L.head==B.mapping.map(R)-1)||pt&&L.empty&&L.head==E)&&B.setSelection(L)}return s&&B.setMeta("composition",s),B.scrollIntoView()},N;if(k)if(v.pos==y.pos){pt&&Pr<=11&&v.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>dr(r),20));let D=O(r.state.tr.delete(E,R)),B=c.resolve(m.start).marksAcross(c.resolve(m.endA));B&&D.ensureMarks(B),r.dispatch(D)}else if(m.endA==m.endB&&(N=C5(v.parent.content.cut(v.parentOffset,y.parentOffset),w.parent.content.cut(w.parentOffset,m.endA-w.start())))){let D=O(r.state.tr);N.type=="add"?D.addMark(E,R,N.mark):D.removeMark(E,R,N.mark),r.dispatch(D)}else if(v.parent.child(v.index()).isText&&v.index()==y.index()-(y.textOffset?0:1)){let D=v.parent.textBetween(v.parentOffset,y.parentOffset),B=()=>O(r.state.tr.insertText(D,E,R));r.someProp("handleTextInput",L=>L(r,E,R,D,B))||r.dispatch(B())}else r.dispatch(O());else r.dispatch(O())}function Yd(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Oa(r,e.resolve(t.anchor),e.resolve(t.head))}function C5(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,s=n,o,a,l;for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);for(let c=0;c<t.length;c++)s=t[c].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(F.from(u).eq(r))return{mark:a,type:o}}function E5(r,e,t,n,i){if(t-e<=i.pos-n.pos||ja(n,!0,!1)<i.pos)return!1;let s=r.resolve(e);if(!n.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=r.resolve(ja(s,!0,!0));return!o.parent.isTextblock||o.pos>t||ja(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function ja(r,e,t){let n=r.depth,i=e?r.end():r.pos;for(;n>0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let s=r.node(n).maybeChild(r.indexAfter(n));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function A5(r,e,t,n,i){let s=r.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=r.findDiffEnd(e,t+r.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&r.size<e.size){let l=n<=s&&n>=o?s-n:0;s-=l,s&&s<e.size&&Jd(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,s&&s<r.size&&Jd(r.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Jd(r){if(r.length!=2)return!1;let e=r.charCodeAt(0),t=r.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Xd{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 Wv,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(rh),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=eh(this),Qd(this),this.nodeViews=th(this),this.docView=ad(this.state.doc,Zd(this),Va(this),this.dom,this),this.domObserver=new y5(this,(n,i,s,o)=>M5(this,n,i,s,o)),this.domObserver.start(),Uv(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&&za(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rh),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];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){var n;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Fd(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=th(this);N5(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&za(this),this.editable=eh(this),Qd(this);let l=Va(this),u=Zd(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(o=!0);let f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&ov(this);if(o){this.domObserver.stop();let h=d&&(pt||Xe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&O5(i.selection,e.selection);if(d){let m=Xe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=o5(this)),(s||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=ad(e.doc,u,l,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Nv(this))?dr(this,h):(vd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&av(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof ie){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Kc(this,t.getBoundingClientRect(),e)}else Kc(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 t=0;t<this.directPlugins.length;t++){let n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let n=this.state.plugins[t];n.spec.view&&this.pluginViews.push(n.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,i=-1;if(this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let s=n.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==n.node&&(i=s)}this.dragging=new Hd(e.slice,e.move,i<0?void 0:ie.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(pt){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&&lv(this.dom),dr(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return fv(this,e)}coordsAtPos(e,t=1){return ed(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 i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return yv(this,t||this.state,e)}pasteHTML(e,t){return Mi(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Mi(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ia(this,e)}destroy(){this.docView&&(Gv(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Va(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,J2())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Yv(this,e)}domSelectionRange(){let e=this.domSelection();return e?it&&this.root.nodeType===11&&tv(this.dom.ownerDocument)==this.dom&&w5(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Xd.prototype.dispatch=function(r){let e=this._props.dispatchTransaction;e?e.call(this,r):this.updateState(this.state.apply(r))};function Zd(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[lt.node(0,r.state.doc.content.size,e)]}function Qd(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:lt.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function eh(r){return!r.someProp("editable",e=>e(r.state)===!1)}function O5(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function th(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function N5(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function rh(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Vr={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:"'"},Os={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},D5=typeof navigator<"u"&&/Mac/.test(navigator.platform),I5=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tt=0;tt<10;tt++)Vr[48+tt]=Vr[96+tt]=String(tt);for(var tt=1;tt<=24;tt++)Vr[tt+111]="F"+tt;for(var tt=65;tt<=90;tt++)Vr[tt]=String.fromCharCode(tt+32),Os[tt]=String.fromCharCode(tt);for(var qa in Vr)Os.hasOwnProperty(qa)||(Os[qa]=Vr[qa]);function R5(r){var e=D5&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||I5&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Os:Vr)[r.keyCode]||r.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}const P5=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),z5=typeof navigator<"u"&&/Win/.test(navigator.platform);function L5(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))P5?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function B5(r){let e=Object.create(null);for(let t in r)e[L5(t)]=r[t];return e}function _a(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function F5(r){return new Be({props:{handleKeyDown:Wa(r)}})}function Wa(r){let e=B5(r);return function(t,n){let i=R5(n),s,o=e[_a(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let a=e[_a(i,n,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(z5&&n.ctrlKey&&n.altKey)&&(s=Vr[n.keyCode])&&s!=i){let a=e[_a(s,n)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var $5=Object.defineProperty,Ua=(r,e)=>{for(var t in e)$5(r,t,{get:e[t],enumerable:!0})};function Ns(r){const{state:e,transaction:t}=r;let{selection:n}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return n},get doc(){return i},get tr(){return n=t.selection,i=t.doc,s=t.storedMarks,t}}}var Ds=class{constructor(r){this.editor=r.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=r.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:r,editor:e,state:t}=this,{view:n}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(r).map(([o,a])=>[o,(...u)=>{const c=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(i),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(r,e=!0){const{rawCommands:t,editor:n,state:i}=this,{view:s}=n,o=[],a=!!r,l=r||i.tr,u=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(t).map(([d,f])=>[d,(...m)=>{const v=this.buildProps(l,e),y=f(...m)(v);return o.push(y),c}])),run:u};return c}createCan(r){const{rawCommands:e,state:t}=this,n=!1,i=r||t.tr,s=this.buildProps(i,n);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>l(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,n)}}buildProps(r,e=!0){const{rawCommands:t,editor:n,state:i}=this,{view:s}=n,o={tr:r,editor:n,view:s,state:Ns({state:i,transaction:r}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(r,e),can:()=>this.createCan(r),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...u)=>l(...u)(o)]))}};return o}},nh={};Ua(nh,{blur:()=>H5,clearContent:()=>V5,clearNodes:()=>j5,command:()=>q5,createParagraphNear:()=>_5,cut:()=>W5,deleteCurrentNode:()=>U5,deleteNode:()=>G5,deleteRange:()=>K5,deleteSelection:()=>Y5,enter:()=>J5,exitCode:()=>X5,extendMarkRange:()=>Z5,first:()=>Q5,focus:()=>ey,forEach:()=>ty,insertContent:()=>ry,insertContentAt:()=>sy,joinBackward:()=>ly,joinDown:()=>ay,joinForward:()=>uy,joinItemBackward:()=>cy,joinItemForward:()=>dy,joinTextblockBackward:()=>hy,joinTextblockForward:()=>fy,joinUp:()=>oy,keyboardShortcut:()=>my,lift:()=>gy,liftEmptyBlock:()=>vy,liftListItem:()=>yy,newlineInCode:()=>by,resetAttributes:()=>wy,scrollIntoView:()=>xy,selectAll:()=>Sy,selectNodeBackward:()=>ky,selectNodeForward:()=>Ty,selectParentNode:()=>My,selectTextblockEnd:()=>Cy,selectTextblockStart:()=>Ey,setContent:()=>Ay,setMark:()=>Jy,setMeta:()=>Xy,setNode:()=>Zy,setNodeSelection:()=>Qy,setTextDirection:()=>e3,setTextSelection:()=>t3,sinkListItem:()=>r3,splitBlock:()=>n3,splitListItem:()=>i3,toggleList:()=>s3,toggleMark:()=>o3,toggleNode:()=>a3,toggleWrap:()=>l3,undoInputRule:()=>u3,unsetAllMarks:()=>c3,unsetMark:()=>d3,unsetTextDirection:()=>h3,updateAttributes:()=>f3,wrapIn:()=>p3,wrapInList:()=>m3});var H5=()=>({editor:r,view:e})=>(requestAnimationFrame(()=>{var t;r.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),V5=(r=!0)=>({commands:e})=>e.setContent("",{emitUpdate:r}),j5=()=>({state:r,tr:e,dispatch:t})=>{const{selection:n}=e,{ranges:i}=n;return t&&i.forEach(({$from:s,$to:o})=>{r.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),f=u.resolve(c.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const m=Mn(h);if(a.type.isTextblock){const{defaultType:v}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,v)}(m||m===0)&&e.lift(h,m)})}),!0},q5=r=>e=>r(e),_5=()=>({state:r,dispatch:e})=>Fc(r,e),W5=(r,e)=>({editor:t,tr:n})=>{const{state:i}=t,s=i.doc.slice(r.from,r.to);n.deleteRange(r.from,r.to);const o=n.mapping.map(e);return n.insert(o,s.content),n.setSelection(new de(n.doc.resolve(Math.max(o-1,0)))),!0},U5=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,n=t.$anchor.node();if(n.content.size>0)return!1;const i=r.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===n.type){if(e){const a=i.before(s),l=i.after(s);r.delete(a,l).scrollIntoView()}return!0}return!1};function _e(r,e){if(typeof r=="string"){if(!e.nodes[r])throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);return e.nodes[r]}return r}var G5=r=>({tr:e,state:t,dispatch:n})=>{const i=_e(r,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(n){const l=s.before(o),u=s.after(o);e.delete(l,u).scrollIntoView()}return!0}return!1},K5=r=>({tr:e,dispatch:t})=>{const{from:n,to:i}=r;return t&&e.delete(n,i),!0},Y5=()=>({state:r,dispatch:e})=>pa(r,e),J5=()=>({commands:r})=>r.keyboardShortcut("Enter"),X5=()=>({state:r,dispatch:e})=>z2(r,e);function Ga(r){return Object.prototype.toString.call(r)==="[object RegExp]"}function Is(r,e,t={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>t.strict?e[i]===r[i]:Ga(e[i])?e[i].test(r[i]):e[i]===r[i]):!0}function ih(r,e,t={}){return r.find(n=>n.type===e&&Is(Object.fromEntries(Object.keys(t).map(i=>[i,n.attrs[i]])),t))}function sh(r,e,t={}){return!!ih(r,e,t)}function Ka(r,e,t){var n;if(!r||!e)return;let i=r.parent.childAfter(r.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=r.parent.childBefore(r.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(t=t||((n=i.node.marks[0])==null?void 0:n.attrs),!ih([...i.node.marks],e,t)))return;let o=i.index,a=r.start()+i.offset,l=o+1,u=a+i.node.nodeSize;for(;o>0&&sh([...r.parent.child(o-1).marks],e,t);)o-=1,a-=r.parent.child(o).nodeSize;for(;l<r.parent.childCount&&sh([...r.parent.child(l).marks],e,t);)u+=r.parent.child(l).nodeSize,l+=1;return{from:a,to:u}}function hr(r,e){if(typeof r=="string"){if(!e.marks[r])throw Error(`There is no mark type named '${r}'. Maybe you forgot to add the extension?`);return e.marks[r]}return r}var Z5=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const s=hr(r,n.schema),{doc:o,selection:a}=t,{$from:l,from:u,to:c}=a;if(i){const d=Ka(l,s,e);if(d&&d.from<=u&&d.to>=c){const f=de.create(o,d.from,d.to);t.setSelection(f)}}return!0},Q5=r=>e=>{const t=typeof r=="function"?r(e):r;for(let n=0;n<t.length;n+=1)if(t[n](e))return!0;return!1};function Ya(r){return r instanceof de}function fr(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function oh(r,e=null){if(!e)return null;const t=le.atStart(r),n=le.atEnd(r);if(e==="start"||e===!0)return t;if(e==="end")return n;const i=t.from,s=n.to;return e==="all"?de.create(r,fr(0,i,s),fr(r.content.size,i,s)):de.create(r,fr(e,i,s),fr(e,i,s))}function ah(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Rs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var ey=(r=null,e={})=>({editor:t,view:n,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Rs()||ah())&&n.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(n.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(n.hasFocus()&&r===null||r===!1)return!0;if(s&&r===null&&!Ya(t.state.selection))return o(),!0;const a=oh(i.doc,r)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ty=(r,e)=>t=>r.every((n,i)=>e(n,{...t,index:i})),ry=(r,e)=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),lh=r=>{const e=r.childNodes;for(let t=e.length-1;t>=0;t-=1){const n=e[t];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?r.removeChild(n):n.nodeType===1&&lh(n)}return r};function Ps(r){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${r}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return lh(t)}function Ei(r,e,t){if(r instanceof Ar||r instanceof F)return r;t={slice:!0,parseOptions:{},...t};const n=typeof r=="object"&&r!==null,i=typeof r=="string";if(n)try{if(Array.isArray(r)&&r.length>0)return F.fromArray(r.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(r);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",r,"Error:",s),Ei("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Yu({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?Or.fromSchema(l).parseSlice(Ps(r),t.parseOptions):Or.fromSchema(l).parse(Ps(r),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=Or.fromSchema(e);return t.slice?s.parseSlice(Ps(r),t.parseOptions).content:s.parse(Ps(r),t.parseOptions)}return Ei("",e,t)}function ny(r,e,t){const n=r.steps.length-1;if(n<e)return;const i=r.steps[n];if(!(i instanceof Ye||i instanceof Je))return;const s=r.mapping.maps[n];let o=0;s.forEach((a,l,u,c)=>{o===0&&(o=c)}),r.setSelection(le.near(r.doc.resolve(o),t))}var iy=r=>!("type"in r),sy=(r,e,t)=>({tr:n,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ei(e,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){l(y)}try{a=Ei(e,s.schema,{parseOptions:u,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(y){return l(y),!1}let{from:c,to:d}=typeof r=="number"?{from:r,to:r}:{from:r.from,to:r.to},f=!0,h=!0;if((iy(a)?a:[a]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),c===d&&h){const{parent:y}=n.doc.resolve(c);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(c-=1,d+=1)}let v;if(f){if(Array.isArray(e))v=e.map(y=>y.text||"").join("");else if(e instanceof F){let y="";e.forEach(w=>{w.text&&(y+=w.text)}),v=y}else typeof e=="object"&&e&&e.text?v=e.text:v=e;n.insertText(v,c,d)}else{v=a;const y=n.doc.resolve(c),w=y.node(),k=y.parentOffset===0,E=w.isText||w.isTextblock,R=w.content.size>0;k&&E&&R&&(c=Math.max(0,c-1)),n.replaceWith(c,d,v)}t.updateSelection&&ny(n,n.steps.length-1,-1),t.applyInputRules&&n.setMeta("applyInputRules",{from:c,text:v}),t.applyPasteRules&&n.setMeta("applyPasteRules",{from:c,text:v})}return!0},oy=()=>({state:r,dispatch:e})=>I2(r,e),ay=()=>({state:r,dispatch:e})=>R2(r,e),ly=()=>({state:r,dispatch:e})=>Dc(r,e),uy=()=>({state:r,dispatch:e})=>zc(r,e),cy=()=>({state:r,dispatch:e,tr:t})=>{try{const n=vs(r.doc,r.selection.$from.pos,-1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},dy=()=>({state:r,dispatch:e,tr:t})=>{try{const n=vs(r.doc,r.selection.$from.pos,1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},hy=()=>({state:r,dispatch:e})=>N2(r,e),fy=()=>({state:r,dispatch:e})=>D2(r,e);function uh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function py(r){const e=r.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Rs()||uh()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var my=r=>({editor:e,view:t,tr:n,dispatch:i})=>{const s=py(r).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,a))});return l?.steps.forEach(u=>{const c=u.map(n.mapping);c&&i&&n.maybeStep(c)}),!0};function jr(r,e,t={}){const{from:n,to:i,empty:s}=r.selection,o=e?_e(e,r.schema):null,a=[];r.doc.nodesBetween(n,i,(d,f)=>{if(d.isText)return;const h=Math.max(n,f),m=Math.min(i,f+d.nodeSize);a.push({node:d,from:h,to:m})});const l=i-n,u=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Is(d.node.attrs,t,{strict:!1}));return s?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=l}var gy=(r,e={})=>({state:t,dispatch:n})=>{const i=_e(r,t.schema);return jr(t,i,e)?P2(t,n):!1},vy=()=>({state:r,dispatch:e})=>$c(r,e),yy=r=>({state:e,dispatch:t})=>{const n=_e(r,e.schema);return U2(n)(e,t)},by=()=>({state:r,dispatch:e})=>Bc(r,e);function zs(r,e){return e.nodes[r]?"node":e.marks[r]?"mark":null}function ch(r,e){const t=typeof e=="string"?[e]:e;return Object.keys(r).reduce((n,i)=>(t.includes(i)||(n[i]=r[i]),n),{})}var wy=(r,e)=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=zs(typeof r=="string"?r:r.name,n.schema);if(!a)return!1;a==="node"&&(s=_e(r,n.schema)),a==="mark"&&(o=hr(r,n.schema));let l=!1;return t.selection.ranges.forEach(u=>{n.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,d)=>{s&&s===c.type&&(l=!0,i&&t.setNodeMarkup(d,void 0,ch(c.attrs,e))),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&(l=!0,i&&t.addMark(d,d+c.nodeSize,o.create(ch(f.attrs,e))))})})}),l},xy=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),Sy=()=>({tr:r,dispatch:e})=>{if(e){const t=new kt(r.doc);r.setSelection(t)}return!0},ky=()=>({state:r,dispatch:e})=>Rc(r,e),Ty=()=>({state:r,dispatch:e})=>Lc(r,e),My=()=>({state:r,dispatch:e})=>F2(r,e),Cy=()=>({state:r,dispatch:e})=>V2(r,e),Ey=()=>({state:r,dispatch:e})=>H2(r,e);function Ja(r,e,t={},n={}){return Ei(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:n.errorOnInvalidContent})}var Ay=(r,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:n={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(n.preserveWhitespace!=="full"){const u=Ja(r,i.schema,n,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},r,{parseOptions:n,errorOnInvalidContent:e??i.options.enableContentCheck})};function dh(r,e){const t=hr(e,r.schema),{from:n,to:i,empty:s}=r.selection,o=[];s?(r.storedMarks&&o.push(...r.storedMarks),o.push(...r.selection.$head.marks())):r.doc.nodesBetween(n,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function Oy(r,e){const t=new wc(r);return e.forEach(n=>{n.steps.forEach(i=>{t.step(i)})}),t}function Ny(r){for(let e=0;e<r.edgeCount;e+=1){const{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Dy(r,e){for(let t=r.depth;t>0;t-=1){const n=r.node(t);if(e(n))return{pos:t>0?r.before(t):0,start:r.start(t),depth:t,node:n}}}function Ls(r){return e=>Dy(e.$from,r)}function se(r,e,t){return r.config[e]===void 0&&r.parent?se(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?se(r.parent,e,t):null}):r.config[e]}function Xa(r){return r.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},n=se(e,"addExtensions",t);return n?[e,...Xa(n())]:e}).flat(10)}function Za(r,e){const t=ln.fromSchema(e).serializeFragment(r),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function hh(r){return typeof r=="function"}function Me(r,e=void 0,...t){return hh(r)?e?r.bind(e)(...t):r(...t):r}function Iy(r={}){return Object.keys(r).length===0&&r.constructor===Object}function Bn(r){const e=r.filter(i=>i.type==="extension"),t=r.filter(i=>i.type==="node"),n=r.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:n}}function fh(r){const e=[],{nodeExtensions:t,markExtensions:n}=Bn(r),i=[...t,...n],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return r.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=se(o,"addGlobalAttributes",a);if(!l)return;l().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...s,...h}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=se(o,"addAttributes",a);if(!l)return;const u=l();Object.entries(u).forEach(([c,d])=>{const f={...s,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:o.name,name:c,attribute:f})})}),e}function be(...r){return r.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([i,s])=>{if(!n[i]){n[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=n[i]?n[i].split(" "):[],u=a.filter(c=>!l.includes(c));n[i]=[...l,...u].join(" ")}else if(i==="style"){const a=s?s.split(";").map(c=>c.trim()).filter(Boolean):[],l=n[i]?n[i].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;l.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),a.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),n[i]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else n[i]=s}),n},{})}function Ai(r,e){return e.filter(t=>t.type===r.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(r.attrs)||{}:{[t.name]:r.attrs[t.name]}).reduce((t,n)=>be(t,n),{})}function Ry(r){return typeof r!="string"?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):r==="true"?!0:r==="false"?!1:r}function ph(r,e){return"style"in r?r:{...r,getAttrs:t=>{const n=r.getAttrs?r.getAttrs(t):r.attrs;if(n===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):Ry(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...n,...i}}}}function mh(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>e==="attrs"&&Iy(t)?!1:t!=null))}function gh(r){var e,t;const n={};return!((e=r?.attribute)!=null&&e.isRequired)&&"default"in(r?.attribute||{})&&(n.default=r.attribute.default),((t=r?.attribute)==null?void 0:t.validate)!==void 0&&(n.validate=r.attribute.validate),[r.name,n]}function Py(r,e){var t;const n=fh(r),{nodeExtensions:i,markExtensions:s}=Bn(r),o=(t=i.find(u=>se(u,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(u=>{const c=n.filter(w=>w.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=r.reduce((w,k)=>{const E=se(k,"extendNodeSchema",d);return{...w,...E?E(u):{}}},{}),h=mh({...f,content:Me(se(u,"content",d)),marks:Me(se(u,"marks",d)),group:Me(se(u,"group",d)),inline:Me(se(u,"inline",d)),atom:Me(se(u,"atom",d)),selectable:Me(se(u,"selectable",d)),draggable:Me(se(u,"draggable",d)),code:Me(se(u,"code",d)),whitespace:Me(se(u,"whitespace",d)),linebreakReplacement:Me(se(u,"linebreakReplacement",d)),defining:Me(se(u,"defining",d)),isolating:Me(se(u,"isolating",d)),attrs:Object.fromEntries(c.map(gh))}),m=Me(se(u,"parseHTML",d));m&&(h.parseDOM=m.map(w=>ph(w,c)));const v=se(u,"renderHTML",d);v&&(h.toDOM=w=>v({node:w,HTMLAttributes:Ai(w,c)}));const y=se(u,"renderText",d);return y&&(h.toText=y),[u.name,h]})),l=Object.fromEntries(s.map(u=>{const c=n.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=r.reduce((y,w)=>{const k=se(w,"extendMarkSchema",d);return{...y,...k?k(u):{}}},{}),h=mh({...f,inclusive:Me(se(u,"inclusive",d)),excludes:Me(se(u,"excludes",d)),group:Me(se(u,"group",d)),spanning:Me(se(u,"spanning",d)),code:Me(se(u,"code",d)),attrs:Object.fromEntries(c.map(gh))}),m=Me(se(u,"parseHTML",d));m&&(h.parseDOM=m.map(y=>ph(y,c)));const v=se(u,"renderHTML",d);return v&&(h.toDOM=y=>v({mark:y,HTMLAttributes:Ai(y,c)})),[u.name,h]}));return new Yu({topNode:o,nodes:a,marks:l})}function zy(r){const e=r.filter((t,n)=>r.indexOf(t)!==n);return Array.from(new Set(e))}function Qa(r){return r.sort((t,n)=>{const i=se(t,"priority")||100,s=se(n,"priority")||100;return i>s?-1:i<s?1:0})}function vh(r){const e=Qa(Xa(r)),t=zy(e.map(n=>n.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(n=>`'${n}'`).join(", ")}]. This can lead to issues.`),e}function yh(r,e,t){const{from:n,to:i}=e,{blockSeparator:s=`
505
+ `))),0,0),r.someProp("transformPasted",f=>{a=f(a,r,!0)}),a;let d=r.someProp("clipboardTextParser",f=>f(e,i,n,r));if(d)a=d;else{let f=i.marks(),{schema:h}=r.state,m=ln.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(v=>{let y=o.appendChild(document.createElement("p"));v&&y.appendChild(m.serializeNode(h.text(v,f)))})}}else r.someProp("transformPastedHTML",d=>{t=d(t,r)}),o=Vv(t),bi&&_v(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(r.someProp("clipboardParser")||r.someProp("domParser")||Or.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Fv.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)a=jv(Dd(a,+c[1],+c[2]),c[4]);else if(a=U.maxOpen($v(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Dd(a,d,f)}return r.someProp("transformPasted",d=>{a=d(a,r,l)}),a}const Fv=/^(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 $v(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(r.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),u;if(!l)return o=null;if(u=o.length&&s.length&&Od(l,s,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Nd(o[o.length-1],s.length));let c=Ad(a,l);o.push(c),i=i.matchType(c.type),s=l}}),o)return F.from(o)}return r}function Ad(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,F.from(r));return r}function Od(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let s=Od(r,e,t,n.lastChild,i+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(F.from(Ad(t,r,i+1))))}}function Nd(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,Nd(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(F.empty,!0);return r.copy(t.append(n))}function Ra(r,e,t,n,i,s){let o=e<0?r.firstChild:r.lastChild,a=o.content;return r.childCount>1&&(s=0),i<n-1&&(a=Ra(a,e,t,n,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(F.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(a))}function Dd(r,e,t){return e<r.openStart&&(r=new U(Ra(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new U(Ra(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const Id={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Rd=null;function Pd(){return Rd||(Rd=document.implementation.createHTMLDocument("title"))}let Pa=null;function Hv(r){let e=window.trustedTypes;return e?(Pa||(Pa=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Pa.createHTML(r)):r}function Vv(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=Pd().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&Id[n[1].toLowerCase()])&&(r=i.map(s=>"<"+s+">").join("")+r+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Hv(r),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function _v(r){let e=r.querySelectorAll(Xe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function jv(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:s,openEnd:o}=r;for(let a=n.length-2;a>=0;a-=2){let l=t.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;i=F.from(l.create(n[a+1],i)),s++,o++}return new U(i,s,o)}const ot={},at={},qv={touchstart:!0,touchmove:!0};class Wv{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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Uv(r){for(let e in ot){let t=ot[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{Kv(r,n)&&!La(r,n)&&(r.editable||!(n.type in at))&&t(r,n)},qv[e]?{passive:!0}:void 0)}it&&r.dom.addEventListener("input",()=>null),za(r)}function Fr(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function Gv(r){r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function za(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>La(r,n))})}function La(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function Kv(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Yv(r,e){!La(r,e)&&ot[e.type]&&(r.editable||!(e.type in at))&&ot[e.type](r,e)}at.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!Ld(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(ur&&Xe&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),In&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,dn(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||Bv(r,t)?t.preventDefault():Fr(r,"key")},at.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)},at.keypress=(r,e)=>{let t=e;if(Ld(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||It&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof de)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode),s=()=>r.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",o=>o(r,n.$from.pos,n.$to.pos,i,s))&&r.dispatch(s()),t.preventDefault()}};function Ms(r){return{left:r.clientX,top:r.clientY}}function Jv(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function Ba(r,e,t,n,i){if(n==-1)return!1;let s=r.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(r.someProp(e,a=>o>s.depth?a(r,t,s.nodeAfter,s.before(o),i,!0):a(r,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function zn(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function Xv(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&ie.isSelectable(n)?(zn(r,new ie(t)),!0):!1}function Zv(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof ie&&(n=t.node);let s=r.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(ie.isSelectable(a)){n&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(zn(r,ie.create(r.state.doc,i)),!0):!1}function Qv(r,e,t,n,i){return Ba(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?Zv(r,t):Xv(r,t))}function e5(r,e,t,n){return Ba(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function t5(r,e,t,n){return Ba(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||r5(r,t,n)}function r5(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(zn(r,de.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)zn(r,de.create(n,a+1,a+1+o.content.size));else if(ie.isSelectable(o))zn(r,ie.create(n,a));else continue;return!0}}function Fa(r){return Cs(r)}const zd=It?"metaKey":"ctrlKey";ot.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=Fa(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&Jv(t,r.input.lastClick)&&!t[zd]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?s="doubleClick":r.input.lastClick.type=="doubleClick"&&(s="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=r.posAtCoords(Ms(t));o&&(s=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new n5(r,o,t,!!n)):(s=="doubleClick"?e5:t5)(r,o.pos,o.inside,t)?t.preventDefault():Fr(r,"pointer"))};class n5{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[zd],this.allowDefault=n.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let c=e.state.doc.resolve(t.pos);s=c.parent,o=c.depth?c.before():0}const a=i?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;(n.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof ie&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Dt&&!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)),Fr(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(()=>dr(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(Ms(e))),this.updateAllowDefault(e),this.allowDefault||!t?Fr(this.view,"pointer"):Qv(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||it&&this.mightDrag&&!this.mightDrag.node.isAtom||Xe&&!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)?(zn(this.view,le.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Fr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Fr(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)}}ot.touchstart=r=>{r.input.lastTouch=Date.now(),Fa(r),Fr(r,"pointer")},ot.touchmove=r=>{r.input.lastTouch=Date.now(),Fr(r,"pointer")},ot.contextmenu=r=>Fa(r);function Ld(r,e){return r.composing?!0:it&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const i5=ur?5e3:-1;at.compositionstart=at.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof de&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||Xe&&Gc&&s5(r)))r.markCursor=r.state.storedMarks||t.marks(),Cs(r,!0),r.markCursor=null;else if(Cs(r,!e.selection.empty),Dt&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,s=n.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=r.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}r.input.composing=!0}Bd(r,i5)};function s5(r){let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let n=e.childNodes[t];return n.nodeType==1&&n.contentEditable=="false"}at.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,Bd(r,20))};function Bd(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>Cs(r),e))}function Fd(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=a5());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function o5(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=Z2(e.focusNode,e.focusOffset),n=Q2(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,s=r.domObserver.lastChangedTextNode;if(t==s||n==s)return s;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function a5(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function Cs(r,e=!1){if(!(ur&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),Fd(r),e||r.docView&&r.docView.dirty){let t=Ea(r),n=r.state.selection;return t&&!t.eq(n)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function l5(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const Ti=pt&&Pr<15||In&&nv<604;ot.copy=at.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=Ti?null:t.clipboardData,o=n.content(),{dom:a,text:l}=Ia(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):l5(r,a),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function u5(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function c5(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?Mi(r,n.value,null,i,e):Mi(r,n.textContent,n.innerHTML,i,e)},50)}function Mi(r,e,t,n,i){let s=Ed(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",l=>l(r,i,s||U.empty)))return!0;if(!s)return!1;let o=u5(s),a=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(s);return r.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function $d(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}at.paste=(r,e)=>{let t=e;if(r.composing&&!ur)return;let n=Ti?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&Mi(r,$d(n),n.getData("text/html"),i,t)?t.preventDefault():c5(r,t)};class Hd{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const d5=It?"altKey":"ctrlKey";function Vd(r,e){let t=r.someProp("dragCopies",n=>!n(e));return t??!e[d5]}ot.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,s=i.empty?null:r.posAtCoords(Ms(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ie?i.to-1:i.to))){if(n&&n.mightDrag)o=ie.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=r.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=r.docView&&(o=ie.create(r.state.doc,d.posBefore))}}let a=(o||r.state.selection).content(),{dom:l,text:u,slice:c}=Ia(r,a);(!t.dataTransfer.files.length||!Xe||Uc>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ti?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ti||t.dataTransfer.setData("text/plain",u),r.dragging=new Hd(c,Vd(r,t),o)},ot.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)},at.dragover=at.dragenter=(r,e)=>e.preventDefault(),at.drop=(r,e)=>{try{h5(r,e,r.dragging)}finally{r.dragging=null}};function h5(r,e,t){if(!e.dataTransfer)return;let n=r.posAtCoords(Ms(e));if(!n)return;let i=r.state.doc.resolve(n.pos),s=t&&t.slice;s?r.someProp("transformPasted",h=>{s=h(s,r,!1)}):s=Ed(r,$d(e.dataTransfer),Ti?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&Vd(r,e));if(r.someProp("handleDrop",h=>h(r,e,s||U.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?mc(r.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=r.state.tr;if(o){let{node:h}=t;h?h.replace(l):l.deleteSelection()}let u=l.mapping.map(a),c=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(c?l.replaceRangeWith(u,u,s.content.firstChild):l.replaceRange(u,u,s),l.doc.eq(d))return;let f=l.doc.resolve(u);if(c&&ie.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new ie(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,v,y,w)=>h=w),l.setSelection(Oa(r,f,l.doc.resolve(h)))}r.focus(),r.dispatch(l.setMeta("uiEvent","drop"))}ot.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&dr(r)},20))},ot.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)},ot.beforeinput=(r,e)=>{if(Xe&&ur&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",s=>s(r,dn(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in at)ot[r]=at[r];function Ci(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Es{constructor(e,t){this.toDOM=e,this.spec=t||mn,this.side=this.spec.side||0}map(e,t,n,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new lt(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Es&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ci(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class $r{constructor(e,t){this.attrs=e,this.spec=t||mn}map(e,t,n,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new lt(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof $r&&Ci(this.attrs,e.attrs)&&Ci(this.spec,e.spec)}static is(e){return e.type instanceof $r}destroy(){}}class $a{constructor(e,t){this.attrs=e,this.spec=t||mn}map(e,t,n,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new lt(s.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(n)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof $a&&Ci(this.attrs,e.attrs)&&Ci(this.spec,e.spec)}destroy(){}}class lt{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new lt(e,t,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(e,t,n){return new lt(e,e,new Es(t,n))}static inline(e,t,n,i){return new lt(e,t,new $r(n,i))}static node(e,t,n,i){return new lt(e,t,new $a(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof $r}get widget(){return this.type instanceof Es}}const Ln=[],mn={};class Re{constructor(e,t){this.local=e.length?e:Ln,this.children=t.length?t:Ln}static create(e,t){return t.length?As(t,e,0,mn):st}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&n.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,n,i+a,s)}}map(e,t,n){return this==st||e.maps.length==0?this:this.mapInner(e,t,0,0,n||mn)}mapInner(e,t,n,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?f5(this.children,o||[],e,t,n,i,s):o?new Re(o.sort(gn),Ln):st}add(e,t){return t.length?this==st?Re.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,s=0;e.forEach((a,l)=>{let u=l+n,c;if(c=jd(t,a,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,c,u+1):i.splice(s,0,l,l+a.nodeSize,As(c,a,u+1,mn)),s+=3}});let o=_d(s?qd(t):t,-n);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Re(o.length?this.local.concat(o).sort(gn):this.local,i||this.children)}remove(e){return e.length==0||this==st?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let s=0;s<n.length;s+=3){let o,a=n[s]+t,l=n[s+1]+t;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<l&&(e[c]=null,(o||(o=[])).push(d));if(!o)continue;n==this.children&&(n=this.children.slice());let u=n[s+2].removeInner(o,a+1);u!=st?n[s+2]=u:(n.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new Re(i,n):st}forChild(e,t){if(this==st)return this;if(t.isLeaf)return Re.empty;let n,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(n=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof $r){let u=Math.max(s,l.from)-s,c=Math.min(o,l.to)-s;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new Re(i.sort(gn),Ln);return n?new Hr([a,n]):a}return n||st}eq(e){if(this==e)return!0;if(!(e instanceof Re)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ha(this.localsInner(e))}localsInner(e){if(this==st)return Ln;if(e.inlineContent||!this.local.some($r.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof $r||t.push(this.local[n]);return t}forEachSet(e){e(this)}}Re.empty=new Re([],[]),Re.removeOverlap=Ha;const st=Re.empty;class Hr{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,mn));return Hr.from(n)}forChild(e,t){if(t.isLeaf)return Re.empty;let n=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=st&&(s instanceof Hr?n=n.concat(s.members):n.push(s))}return Hr.from(n)}eq(e){if(!(e instanceof Hr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{n&&(t=t.slice(),n=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Ha(n?t:t.sort(gn)):Ln}static from(e){switch(e.length){case 0:return st;case 1:return e[0];default:return new Hr(e.every(t=>t instanceof Re)?e:e.reduce((t,n)=>t.concat(n instanceof Re?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function f5(r,e,t,n,i,s,o){let a=r.slice();for(let u=0,c=s;u<t.maps.length;u++){let d=0;t.maps[u].forEach((f,h,m,v)=>{let y=v-m-(h-f);for(let w=0;w<a.length;w+=3){let k=a[w+1];if(k<0||f>k+c-d)continue;let E=a[w]+c-d;h>=E?a[w+1]=f<=E?-2:-1:f>=c&&y&&(a[w]+=y,a[w+1]+=y)}d+=y}),c=t.maps[u].map(c,-1)}let l=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){l=!0,a[u+1]=-1;continue}let c=t.map(r[u]+s),d=c-i;if(d<0||d>=n.content.size){l=!0;continue}let f=t.map(r[u+1]+s,-1),h=f-i,{index:m,offset:v}=n.content.findIndex(d),y=n.maybeChild(m);if(y&&v==d&&v+y.nodeSize==h){let w=a[u+2].mapInner(t,y,c+1,r[u]+s+1,o);w!=st?(a[u]=d,a[u+1]=h,a[u+2]=w):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=p5(a,r,e,t,i,s,o),c=As(u,n,0,o);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<c.children.length;d+=3){let h=c.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Re(e.sort(gn),a)}function _d(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new lt(i.from+e,i.to+e,i.type))}return t}function p5(r,e,t,n,i,s,o){function a(l,u){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(n,i,u);d?t.push(d):o.onRemove&&o.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)a(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<r.length;l+=3)r[l+1]==-1&&a(r[l+2],e[l]+s+1);return t}function jd(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let s=0,o;s<r.length;s++)(o=r[s])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[s]=null);return i}function qd(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function As(r,e,t,n){let i=[],s=!1;e.forEach((a,l)=>{let u=jd(r,a,l+t);if(u){s=!0;let c=As(u,a,t+l+1,n);c!=st&&i.push(l,l+a.nodeSize,c)}});let o=_d(s?qd(r):r,-t).sort(gn);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(n.onRemove&&n.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new Re(o,i):st}function gn(r,e){return r.from-e.from||r.to-e.to}function Ha(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==n.from){s.to!=n.to&&(e==r&&(e=r.slice()),e[i]=s.copy(s.from,n.to),Wd(e,i+1,s.copy(n.to,s.to)));continue}else{s.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,s.from),Wd(e,i,n.copy(s.from,n.to)));break}}}return e}function Wd(r,e,t){for(;e<r.length&&gn(t,r[e])>0;)e++;r.splice(e,0,t)}function Va(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=st&&e.push(n)}),r.cursorWrapper&&e.push(Re.create(r.state.doc,[r.cursorWrapper.deco])),Hr.from(e)}const m5={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},g5=pt&&Pr<=11;class v5{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}}class y5{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new v5,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);pt&&Pr<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),g5&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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,m5)),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(bd(this.view)){if(this.suppressingSelectionUpdates)return dr(this.view);if(pt&&Pr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&cn(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 s=e.focusNode;s;s=Dn(s))t.add(s);for(let s=e.anchorNode;s;s=Dn(s))if(t.has(s)){n=s;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.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(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&bd(e)&&!this.ignoreSelectionChange(n),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let c=0;c<t.length;c++){let d=this.registerMutation(t[c],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(Dt&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||x5(e,d)!=h)&&f.remove()}}}else if((Xe||it)&&l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&xs(n)&&(u=Ea(e))&&u.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,dr(e),this.currentSelection.set(n),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),b5(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||dr(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 c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,s=e.nextSibling;if(pt&&Pr<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?et(i)+1:0,a=n.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?et(s):e.target.childNodes.length,u=n.localPosFromDOM(e.target,l,1);return{from:a,to:u}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ud=new WeakMap,Gd=!1;function b5(r){if(!Ud.has(r)&&(Ud.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=Dt,Gd)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."),Gd=!0}}function Kd(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,s=e.endOffset,o=r.domAtPos(r.state.selection.anchor);return cn(o.node,o.offset,i,s)&&([t,n,i,s]=[i,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}}function w5(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return Kd(r,i)}let t;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",n,!0),t?Kd(r,t):null}function x5(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let n=r.docView.nearestDesc(t,!0);if(n&&n.node.isBlock)return t}return null}function S5(r,e,t){let{node:n,fromOffset:i,toOffset:s,from:o,to:a}=r.docView.parseRange(e,t),l=r.domSelectionRange(),u,c=l.anchorNode;if(c&&r.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:l.anchorOffset}],xs(l)||u.push({node:l.focusNode,offset:l.focusOffset})),Xe&&r.input.lastKeyCode===8)for(let y=s;y>i;y--){let w=n.childNodes[y-1],k=w.pmViewDesc;if(w.nodeName=="BR"&&!k){s=y;break}if(!k||k.size)break}let d=r.state.doc,f=r.someProp("domParser")||Or.fromSchema(r.state.schema),h=d.resolve(o),m=null,v=f.parse(n,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:k5,context:h});if(u&&u[0].pos!=null){let y=u[0].pos,w=u[1]&&u[1].pos;w==null&&(w=y),m={anchor:y+o,head:w+o}}return{doc:v,sel:m,from:o,to:a}}function k5(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(it&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||it&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const T5=/^(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 M5(r,e,t,n,i){let s=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let D=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,B=Ea(r,D);if(B&&!r.state.selection.eq(B)){if(Xe&&ur&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",V=>V(r,dn(13,"Enter"))))return;let L=r.state.tr.setSelection(B);D=="pointer"?L.setMeta("pointer",!0):D=="key"&&L.scrollIntoView(),s&&L.setMeta("composition",s),r.dispatch(L)}return}let o=r.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=r.state.doc.resolve(t).after(a+1);let l=r.state.selection,u=S5(r,e,t),c=r.state.doc,d=c.slice(u.from,u.to),f,h;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(f=r.state.selection.to,h="end"):(f=r.state.selection.from,h="start"),r.input.lastKeyCode=null;let m=A5(d.content,u.doc.content,u.from,f,h);if(m&&r.input.domChangeCount++,(In&&r.input.lastIOSEnter>Date.now()-225||ur)&&i.some(D=>D.nodeType==1&&!T5.test(D.nodeName))&&(!m||m.endA>=m.endB)&&r.someProp("handleKeyDown",D=>D(r,dn(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!m)if(n&&l instanceof de&&!l.empty&&l.$head.sameParent(l.$anchor)&&!r.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let D=Yd(r,r.state.doc,u.sel);if(D&&!D.eq(r.state.selection)){let B=r.state.tr.setSelection(D);s&&B.setMeta("composition",s),r.dispatch(B)}}return}r.state.selection.from<r.state.selection.to&&m.start==m.endB&&r.state.selection instanceof de&&(m.start>r.state.selection.from&&m.start<=r.state.selection.from+2&&r.state.selection.from>=u.from?m.start=r.state.selection.from:m.endA<r.state.selection.to&&m.endA>=r.state.selection.to-2&&r.state.selection.to<=u.to&&(m.endB+=r.state.selection.to-m.endA,m.endA=r.state.selection.to)),pt&&Pr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let v=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),w=c.resolve(m.start),k=v.sameParent(y)&&v.parent.inlineContent&&w.end()>=m.endA;if((In&&r.input.lastIOSEnter>Date.now()-225&&(!k||i.some(D=>D.nodeName=="DIV"||D.nodeName=="P"))||!k&&v.pos<u.doc.content.size&&(!v.sameParent(y)||!v.parent.inlineContent)&&v.pos<y.pos&&!/\S/.test(u.doc.textBetween(v.pos,y.pos,"","")))&&r.someProp("handleKeyDown",D=>D(r,dn(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>m.start&&E5(c,m.start,m.endA,v,y)&&r.someProp("handleKeyDown",D=>D(r,dn(8,"Backspace")))){ur&&Xe&&r.domObserver.suppressSelectionUpdates();return}Xe&&m.endB==m.start&&(r.input.lastChromeDelete=Date.now()),ur&&!k&&v.start()!=y.start()&&y.parentOffset==0&&v.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{r.someProp("handleKeyDown",function(D){return D(r,dn(13,"Enter"))})},20));let E=m.start,R=m.endA,O=D=>{let B=D||r.state.tr.replace(E,R,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let L=Yd(r,B.doc,u.sel);L&&!(Xe&&r.composing&&L.empty&&(m.start!=m.endB||r.input.lastChromeDelete<Date.now()-100)&&(L.head==E||L.head==B.mapping.map(R)-1)||pt&&L.empty&&L.head==E)&&B.setSelection(L)}return s&&B.setMeta("composition",s),B.scrollIntoView()},N;if(k)if(v.pos==y.pos){pt&&Pr<=11&&v.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>dr(r),20));let D=O(r.state.tr.delete(E,R)),B=c.resolve(m.start).marksAcross(c.resolve(m.endA));B&&D.ensureMarks(B),r.dispatch(D)}else if(m.endA==m.endB&&(N=C5(v.parent.content.cut(v.parentOffset,y.parentOffset),w.parent.content.cut(w.parentOffset,m.endA-w.start())))){let D=O(r.state.tr);N.type=="add"?D.addMark(E,R,N.mark):D.removeMark(E,R,N.mark),r.dispatch(D)}else if(v.parent.child(v.index()).isText&&v.index()==y.index()-(y.textOffset?0:1)){let D=v.parent.textBetween(v.parentOffset,y.parentOffset),B=()=>O(r.state.tr.insertText(D,E,R));r.someProp("handleTextInput",L=>L(r,E,R,D,B))||r.dispatch(B())}else r.dispatch(O());else r.dispatch(O())}function Yd(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Oa(r,e.resolve(t.anchor),e.resolve(t.head))}function C5(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,s=n,o,a,l;for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);for(let c=0;c<t.length;c++)s=t[c].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(F.from(u).eq(r))return{mark:a,type:o}}function E5(r,e,t,n,i){if(t-e<=i.pos-n.pos||_a(n,!0,!1)<i.pos)return!1;let s=r.resolve(e);if(!n.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=r.resolve(_a(s,!0,!0));return!o.parent.isTextblock||o.pos>t||_a(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function _a(r,e,t){let n=r.depth,i=e?r.end():r.pos;for(;n>0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let s=r.node(n).maybeChild(r.indexAfter(n));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function A5(r,e,t,n,i){let s=r.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=r.findDiffEnd(e,t+r.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o<s&&r.size<e.size){let l=n<=s&&n>=o?s-n:0;s-=l,s&&s<e.size&&Jd(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=n<=s&&n>=a?s-n:0;s-=l,s&&s<r.size&&Jd(r.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Jd(r){if(r.length!=2)return!1;let e=r.charCodeAt(0),t=r.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Xd{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 Wv,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(rh),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=eh(this),Qd(this),this.nodeViews=th(this),this.docView=ad(this.state.doc,Zd(this),Va(this),this.dom,this),this.domObserver=new y5(this,(n,i,s,o)=>M5(this,n,i,s,o)),this.domObserver.start(),Uv(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&&za(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rh),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];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){var n;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Fd(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=th(this);N5(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&za(this),this.editable=eh(this),Qd(this);let l=Va(this),u=Zd(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(o=!0);let f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&ov(this);if(o){this.domObserver.stop();let h=d&&(pt||Xe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&O5(i.selection,e.selection);if(d){let m=Xe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=o5(this)),(s||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=ad(e.doc,u,l,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Nv(this))?dr(this,h):(vd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&av(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof ie){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Kc(this,t.getBoundingClientRect(),e)}else Kc(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 t=0;t<this.directPlugins.length;t++){let n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let n=this.state.plugins[t];n.spec.view&&this.pluginViews.push(n.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,i=-1;if(this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let s=n.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==n.node&&(i=s)}this.dragging=new Hd(e.slice,e.move,i<0?void 0:ie.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(pt){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&&lv(this.dom),dr(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return fv(this,e)}coordsAtPos(e,t=1){return ed(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 i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return yv(this,t||this.state,e)}pasteHTML(e,t){return Mi(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Mi(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ia(this,e)}destroy(){this.docView&&(Gv(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Va(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,J2())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Yv(this,e)}domSelectionRange(){let e=this.domSelection();return e?it&&this.root.nodeType===11&&tv(this.dom.ownerDocument)==this.dom&&w5(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Xd.prototype.dispatch=function(r){let e=this._props.dispatchTransaction;e?e.call(this,r):this.updateState(this.state.apply(r))};function Zd(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[lt.node(0,r.state.doc.content.size,e)]}function Qd(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:lt.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function eh(r){return!r.someProp("editable",e=>e(r.state)===!1)}function O5(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function th(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function N5(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function rh(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Vr={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:"'"},Os={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},D5=typeof navigator<"u"&&/Mac/.test(navigator.platform),I5=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tt=0;tt<10;tt++)Vr[48+tt]=Vr[96+tt]=String(tt);for(var tt=1;tt<=24;tt++)Vr[tt+111]="F"+tt;for(var tt=65;tt<=90;tt++)Vr[tt]=String.fromCharCode(tt+32),Os[tt]=String.fromCharCode(tt);for(var ja in Vr)Os.hasOwnProperty(ja)||(Os[ja]=Vr[ja]);function R5(r){var e=D5&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||I5&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Os:Vr)[r.keyCode]||r.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}const P5=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),z5=typeof navigator<"u"&&/Win/.test(navigator.platform);function L5(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))P5?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function B5(r){let e=Object.create(null);for(let t in r)e[L5(t)]=r[t];return e}function qa(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function F5(r){return new Be({props:{handleKeyDown:Wa(r)}})}function Wa(r){let e=B5(r);return function(t,n){let i=R5(n),s,o=e[qa(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let a=e[qa(i,n,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(z5&&n.ctrlKey&&n.altKey)&&(s=Vr[n.keyCode])&&s!=i){let a=e[qa(s,n)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var $5=Object.defineProperty,Ua=(r,e)=>{for(var t in e)$5(r,t,{get:e[t],enumerable:!0})};function Ns(r){const{state:e,transaction:t}=r;let{selection:n}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return n},get doc(){return i},get tr(){return n=t.selection,i=t.doc,s=t.storedMarks,t}}}var Ds=class{constructor(r){this.editor=r.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=r.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:r,editor:e,state:t}=this,{view:n}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(r).map(([o,a])=>[o,(...u)=>{const c=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(i),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(r,e=!0){const{rawCommands:t,editor:n,state:i}=this,{view:s}=n,o=[],a=!!r,l=r||i.tr,u=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(t).map(([d,f])=>[d,(...m)=>{const v=this.buildProps(l,e),y=f(...m)(v);return o.push(y),c}])),run:u};return c}createCan(r){const{rawCommands:e,state:t}=this,n=!1,i=r||t.tr,s=this.buildProps(i,n);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>l(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,n)}}buildProps(r,e=!0){const{rawCommands:t,editor:n,state:i}=this,{view:s}=n,o={tr:r,editor:n,view:s,state:Ns({state:i,transaction:r}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(r,e),can:()=>this.createCan(r),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...u)=>l(...u)(o)]))}};return o}},nh={};Ua(nh,{blur:()=>H5,clearContent:()=>V5,clearNodes:()=>_5,command:()=>j5,createParagraphNear:()=>q5,cut:()=>W5,deleteCurrentNode:()=>U5,deleteNode:()=>G5,deleteRange:()=>K5,deleteSelection:()=>Y5,enter:()=>J5,exitCode:()=>X5,extendMarkRange:()=>Z5,first:()=>Q5,focus:()=>ey,forEach:()=>ty,insertContent:()=>ry,insertContentAt:()=>sy,joinBackward:()=>ly,joinDown:()=>ay,joinForward:()=>uy,joinItemBackward:()=>cy,joinItemForward:()=>dy,joinTextblockBackward:()=>hy,joinTextblockForward:()=>fy,joinUp:()=>oy,keyboardShortcut:()=>my,lift:()=>gy,liftEmptyBlock:()=>vy,liftListItem:()=>yy,newlineInCode:()=>by,resetAttributes:()=>wy,scrollIntoView:()=>xy,selectAll:()=>Sy,selectNodeBackward:()=>ky,selectNodeForward:()=>Ty,selectParentNode:()=>My,selectTextblockEnd:()=>Cy,selectTextblockStart:()=>Ey,setContent:()=>Ay,setMark:()=>Jy,setMeta:()=>Xy,setNode:()=>Zy,setNodeSelection:()=>Qy,setTextDirection:()=>e3,setTextSelection:()=>t3,sinkListItem:()=>r3,splitBlock:()=>n3,splitListItem:()=>i3,toggleList:()=>s3,toggleMark:()=>o3,toggleNode:()=>a3,toggleWrap:()=>l3,undoInputRule:()=>u3,unsetAllMarks:()=>c3,unsetMark:()=>d3,unsetTextDirection:()=>h3,updateAttributes:()=>f3,wrapIn:()=>p3,wrapInList:()=>m3});var H5=()=>({editor:r,view:e})=>(requestAnimationFrame(()=>{var t;r.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),V5=(r=!0)=>({commands:e})=>e.setContent("",{emitUpdate:r}),_5=()=>({state:r,tr:e,dispatch:t})=>{const{selection:n}=e,{ranges:i}=n;return t&&i.forEach(({$from:s,$to:o})=>{r.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),f=u.resolve(c.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const m=Mn(h);if(a.type.isTextblock){const{defaultType:v}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,v)}(m||m===0)&&e.lift(h,m)})}),!0},j5=r=>e=>r(e),q5=()=>({state:r,dispatch:e})=>Fc(r,e),W5=(r,e)=>({editor:t,tr:n})=>{const{state:i}=t,s=i.doc.slice(r.from,r.to);n.deleteRange(r.from,r.to);const o=n.mapping.map(e);return n.insert(o,s.content),n.setSelection(new de(n.doc.resolve(Math.max(o-1,0)))),!0},U5=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,n=t.$anchor.node();if(n.content.size>0)return!1;const i=r.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===n.type){if(e){const a=i.before(s),l=i.after(s);r.delete(a,l).scrollIntoView()}return!0}return!1};function qe(r,e){if(typeof r=="string"){if(!e.nodes[r])throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);return e.nodes[r]}return r}var G5=r=>({tr:e,state:t,dispatch:n})=>{const i=qe(r,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(n){const l=s.before(o),u=s.after(o);e.delete(l,u).scrollIntoView()}return!0}return!1},K5=r=>({tr:e,dispatch:t})=>{const{from:n,to:i}=r;return t&&e.delete(n,i),!0},Y5=()=>({state:r,dispatch:e})=>pa(r,e),J5=()=>({commands:r})=>r.keyboardShortcut("Enter"),X5=()=>({state:r,dispatch:e})=>z2(r,e);function Ga(r){return Object.prototype.toString.call(r)==="[object RegExp]"}function Is(r,e,t={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>t.strict?e[i]===r[i]:Ga(e[i])?e[i].test(r[i]):e[i]===r[i]):!0}function ih(r,e,t={}){return r.find(n=>n.type===e&&Is(Object.fromEntries(Object.keys(t).map(i=>[i,n.attrs[i]])),t))}function sh(r,e,t={}){return!!ih(r,e,t)}function Ka(r,e,t){var n;if(!r||!e)return;let i=r.parent.childAfter(r.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=r.parent.childBefore(r.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(t=t||((n=i.node.marks[0])==null?void 0:n.attrs),!ih([...i.node.marks],e,t)))return;let o=i.index,a=r.start()+i.offset,l=o+1,u=a+i.node.nodeSize;for(;o>0&&sh([...r.parent.child(o-1).marks],e,t);)o-=1,a-=r.parent.child(o).nodeSize;for(;l<r.parent.childCount&&sh([...r.parent.child(l).marks],e,t);)u+=r.parent.child(l).nodeSize,l+=1;return{from:a,to:u}}function hr(r,e){if(typeof r=="string"){if(!e.marks[r])throw Error(`There is no mark type named '${r}'. Maybe you forgot to add the extension?`);return e.marks[r]}return r}var Z5=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const s=hr(r,n.schema),{doc:o,selection:a}=t,{$from:l,from:u,to:c}=a;if(i){const d=Ka(l,s,e);if(d&&d.from<=u&&d.to>=c){const f=de.create(o,d.from,d.to);t.setSelection(f)}}return!0},Q5=r=>e=>{const t=typeof r=="function"?r(e):r;for(let n=0;n<t.length;n+=1)if(t[n](e))return!0;return!1};function Ya(r){return r instanceof de}function fr(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function oh(r,e=null){if(!e)return null;const t=le.atStart(r),n=le.atEnd(r);if(e==="start"||e===!0)return t;if(e==="end")return n;const i=t.from,s=n.to;return e==="all"?de.create(r,fr(0,i,s),fr(r.content.size,i,s)):de.create(r,fr(e,i,s),fr(e,i,s))}function ah(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Rs(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var ey=(r=null,e={})=>({editor:t,view:n,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Rs()||ah())&&n.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(n.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(n.hasFocus()&&r===null||r===!1)return!0;if(s&&r===null&&!Ya(t.state.selection))return o(),!0;const a=oh(i.doc,r)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ty=(r,e)=>t=>r.every((n,i)=>e(n,{...t,index:i})),ry=(r,e)=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),lh=r=>{const e=r.childNodes;for(let t=e.length-1;t>=0;t-=1){const n=e[t];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?r.removeChild(n):n.nodeType===1&&lh(n)}return r};function Ps(r){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${r}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return lh(t)}function Ei(r,e,t){if(r instanceof Ar||r instanceof F)return r;t={slice:!0,parseOptions:{},...t};const n=typeof r=="object"&&r!==null,i=typeof r=="string";if(n)try{if(Array.isArray(r)&&r.length>0)return F.fromArray(r.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(r);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",r,"Error:",s),Ei("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new Yu({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?Or.fromSchema(l).parseSlice(Ps(r),t.parseOptions):Or.fromSchema(l).parse(Ps(r),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=Or.fromSchema(e);return t.slice?s.parseSlice(Ps(r),t.parseOptions).content:s.parse(Ps(r),t.parseOptions)}return Ei("",e,t)}function ny(r,e,t){const n=r.steps.length-1;if(n<e)return;const i=r.steps[n];if(!(i instanceof Ye||i instanceof Je))return;const s=r.mapping.maps[n];let o=0;s.forEach((a,l,u,c)=>{o===0&&(o=c)}),r.setSelection(le.near(r.doc.resolve(o),t))}var iy=r=>!("type"in r),sy=(r,e,t)=>({tr:n,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ei(e,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){l(y)}try{a=Ei(e,s.schema,{parseOptions:u,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(y){return l(y),!1}let{from:c,to:d}=typeof r=="number"?{from:r,to:r}:{from:r.from,to:r.to},f=!0,h=!0;if((iy(a)?a:[a]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),c===d&&h){const{parent:y}=n.doc.resolve(c);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(c-=1,d+=1)}let v;if(f){if(Array.isArray(e))v=e.map(y=>y.text||"").join("");else if(e instanceof F){let y="";e.forEach(w=>{w.text&&(y+=w.text)}),v=y}else typeof e=="object"&&e&&e.text?v=e.text:v=e;n.insertText(v,c,d)}else{v=a;const y=n.doc.resolve(c),w=y.node(),k=y.parentOffset===0,E=w.isText||w.isTextblock,R=w.content.size>0;k&&E&&R&&(c=Math.max(0,c-1)),n.replaceWith(c,d,v)}t.updateSelection&&ny(n,n.steps.length-1,-1),t.applyInputRules&&n.setMeta("applyInputRules",{from:c,text:v}),t.applyPasteRules&&n.setMeta("applyPasteRules",{from:c,text:v})}return!0},oy=()=>({state:r,dispatch:e})=>I2(r,e),ay=()=>({state:r,dispatch:e})=>R2(r,e),ly=()=>({state:r,dispatch:e})=>Dc(r,e),uy=()=>({state:r,dispatch:e})=>zc(r,e),cy=()=>({state:r,dispatch:e,tr:t})=>{try{const n=vs(r.doc,r.selection.$from.pos,-1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},dy=()=>({state:r,dispatch:e,tr:t})=>{try{const n=vs(r.doc,r.selection.$from.pos,1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},hy=()=>({state:r,dispatch:e})=>N2(r,e),fy=()=>({state:r,dispatch:e})=>D2(r,e);function uh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function py(r){const e=r.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let n,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))Rs()||uh()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return n&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var my=r=>({editor:e,view:t,tr:n,dispatch:i})=>{const s=py(r).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,a))});return l?.steps.forEach(u=>{const c=u.map(n.mapping);c&&i&&n.maybeStep(c)}),!0};function _r(r,e,t={}){const{from:n,to:i,empty:s}=r.selection,o=e?qe(e,r.schema):null,a=[];r.doc.nodesBetween(n,i,(d,f)=>{if(d.isText)return;const h=Math.max(n,f),m=Math.min(i,f+d.nodeSize);a.push({node:d,from:h,to:m})});const l=i-n,u=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Is(d.node.attrs,t,{strict:!1}));return s?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=l}var gy=(r,e={})=>({state:t,dispatch:n})=>{const i=qe(r,t.schema);return _r(t,i,e)?P2(t,n):!1},vy=()=>({state:r,dispatch:e})=>$c(r,e),yy=r=>({state:e,dispatch:t})=>{const n=qe(r,e.schema);return U2(n)(e,t)},by=()=>({state:r,dispatch:e})=>Bc(r,e);function zs(r,e){return e.nodes[r]?"node":e.marks[r]?"mark":null}function ch(r,e){const t=typeof e=="string"?[e]:e;return Object.keys(r).reduce((n,i)=>(t.includes(i)||(n[i]=r[i]),n),{})}var wy=(r,e)=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=zs(typeof r=="string"?r:r.name,n.schema);if(!a)return!1;a==="node"&&(s=qe(r,n.schema)),a==="mark"&&(o=hr(r,n.schema));let l=!1;return t.selection.ranges.forEach(u=>{n.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,d)=>{s&&s===c.type&&(l=!0,i&&t.setNodeMarkup(d,void 0,ch(c.attrs,e))),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&(l=!0,i&&t.addMark(d,d+c.nodeSize,o.create(ch(f.attrs,e))))})})}),l},xy=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),Sy=()=>({tr:r,dispatch:e})=>{if(e){const t=new kt(r.doc);r.setSelection(t)}return!0},ky=()=>({state:r,dispatch:e})=>Rc(r,e),Ty=()=>({state:r,dispatch:e})=>Lc(r,e),My=()=>({state:r,dispatch:e})=>F2(r,e),Cy=()=>({state:r,dispatch:e})=>V2(r,e),Ey=()=>({state:r,dispatch:e})=>H2(r,e);function Ja(r,e,t={},n={}){return Ei(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:n.errorOnInvalidContent})}var Ay=(r,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:n={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(n.preserveWhitespace!=="full"){const u=Ja(r,i.schema,n,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},r,{parseOptions:n,errorOnInvalidContent:e??i.options.enableContentCheck})};function dh(r,e){const t=hr(e,r.schema),{from:n,to:i,empty:s}=r.selection,o=[];s?(r.storedMarks&&o.push(...r.storedMarks),o.push(...r.selection.$head.marks())):r.doc.nodesBetween(n,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function Oy(r,e){const t=new wc(r);return e.forEach(n=>{n.steps.forEach(i=>{t.step(i)})}),t}function Ny(r){for(let e=0;e<r.edgeCount;e+=1){const{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Dy(r,e){for(let t=r.depth;t>0;t-=1){const n=r.node(t);if(e(n))return{pos:t>0?r.before(t):0,start:r.start(t),depth:t,node:n}}}function Ls(r){return e=>Dy(e.$from,r)}function se(r,e,t){return r.config[e]===void 0&&r.parent?se(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?se(r.parent,e,t):null}):r.config[e]}function Xa(r){return r.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},n=se(e,"addExtensions",t);return n?[e,...Xa(n())]:e}).flat(10)}function Za(r,e){const t=ln.fromSchema(e).serializeFragment(r),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function hh(r){return typeof r=="function"}function Me(r,e=void 0,...t){return hh(r)?e?r.bind(e)(...t):r(...t):r}function Iy(r={}){return Object.keys(r).length===0&&r.constructor===Object}function Bn(r){const e=r.filter(i=>i.type==="extension"),t=r.filter(i=>i.type==="node"),n=r.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:n}}function fh(r){const e=[],{nodeExtensions:t,markExtensions:n}=Bn(r),i=[...t,...n],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return r.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=se(o,"addGlobalAttributes",a);if(!l)return;l().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...s,...h}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=se(o,"addAttributes",a);if(!l)return;const u=l();Object.entries(u).forEach(([c,d])=>{const f={...s,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,e.push({type:o.name,name:c,attribute:f})})}),e}function be(...r){return r.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([i,s])=>{if(!n[i]){n[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],l=n[i]?n[i].split(" "):[],u=a.filter(c=>!l.includes(c));n[i]=[...l,...u].join(" ")}else if(i==="style"){const a=s?s.split(";").map(c=>c.trim()).filter(Boolean):[],l=n[i]?n[i].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;l.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),a.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),n[i]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else n[i]=s}),n},{})}function Ai(r,e){return e.filter(t=>t.type===r.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(r.attrs)||{}:{[t.name]:r.attrs[t.name]}).reduce((t,n)=>be(t,n),{})}function Ry(r){return typeof r!="string"?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):r==="true"?!0:r==="false"?!1:r}function ph(r,e){return"style"in r?r:{...r,getAttrs:t=>{const n=r.getAttrs?r.getAttrs(t):r.attrs;if(n===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):Ry(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...n,...i}}}}function mh(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>e==="attrs"&&Iy(t)?!1:t!=null))}function gh(r){var e,t;const n={};return!((e=r?.attribute)!=null&&e.isRequired)&&"default"in(r?.attribute||{})&&(n.default=r.attribute.default),((t=r?.attribute)==null?void 0:t.validate)!==void 0&&(n.validate=r.attribute.validate),[r.name,n]}function Py(r,e){var t;const n=fh(r),{nodeExtensions:i,markExtensions:s}=Bn(r),o=(t=i.find(u=>se(u,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(u=>{const c=n.filter(w=>w.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=r.reduce((w,k)=>{const E=se(k,"extendNodeSchema",d);return{...w,...E?E(u):{}}},{}),h=mh({...f,content:Me(se(u,"content",d)),marks:Me(se(u,"marks",d)),group:Me(se(u,"group",d)),inline:Me(se(u,"inline",d)),atom:Me(se(u,"atom",d)),selectable:Me(se(u,"selectable",d)),draggable:Me(se(u,"draggable",d)),code:Me(se(u,"code",d)),whitespace:Me(se(u,"whitespace",d)),linebreakReplacement:Me(se(u,"linebreakReplacement",d)),defining:Me(se(u,"defining",d)),isolating:Me(se(u,"isolating",d)),attrs:Object.fromEntries(c.map(gh))}),m=Me(se(u,"parseHTML",d));m&&(h.parseDOM=m.map(w=>ph(w,c)));const v=se(u,"renderHTML",d);v&&(h.toDOM=w=>v({node:w,HTMLAttributes:Ai(w,c)}));const y=se(u,"renderText",d);return y&&(h.toText=y),[u.name,h]})),l=Object.fromEntries(s.map(u=>{const c=n.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=r.reduce((y,w)=>{const k=se(w,"extendMarkSchema",d);return{...y,...k?k(u):{}}},{}),h=mh({...f,inclusive:Me(se(u,"inclusive",d)),excludes:Me(se(u,"excludes",d)),group:Me(se(u,"group",d)),spanning:Me(se(u,"spanning",d)),code:Me(se(u,"code",d)),attrs:Object.fromEntries(c.map(gh))}),m=Me(se(u,"parseHTML",d));m&&(h.parseDOM=m.map(y=>ph(y,c)));const v=se(u,"renderHTML",d);return v&&(h.toDOM=y=>v({mark:y,HTMLAttributes:Ai(y,c)})),[u.name,h]}));return new Yu({topNode:o,nodes:a,marks:l})}function zy(r){const e=r.filter((t,n)=>r.indexOf(t)!==n);return Array.from(new Set(e))}function Qa(r){return r.sort((t,n)=>{const i=se(t,"priority")||100,s=se(n,"priority")||100;return i>s?-1:i<s?1:0})}function vh(r){const e=Qa(Xa(r)),t=zy(e.map(n=>n.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(n=>`'${n}'`).join(", ")}]. This can lead to issues.`),e}function yh(r,e,t){const{from:n,to:i}=e,{blockSeparator:s=`
506
506
 
507
- `,textSerializers:o={}}=t||{};let a="";return r.nodesBetween(n,i,(l,u,c,d)=>{var f;l.isBlock&&u>n&&(a+=s);const h=o?.[l.type.name];if(h)return c&&(a+=h({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(n,u)-u,i-u))}),a}function bh(r,e){const t={from:0,to:r.content.size};return yh(r,t,e)}function el(r){return Object.fromEntries(Object.entries(r.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Ly(r,e){const t=_e(e,r.schema),{from:n,to:i}=r.selection,s=[];r.doc.nodesBetween(n,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function By(r,e){const t=zs(typeof e=="string"?e:e.name,r.schema);return t==="node"?Ly(r,e):t==="mark"?dh(r,e):{}}function Fy(r,e=JSON.stringify){const t={};return r.filter(n=>{const i=e(n);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function $y(r){const e=Fy(r);return e.length===1?e:e.filter((t,n)=>!e.filter((s,o)=>o!==n).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Hy(r){const{mapping:e,steps:t}=r,n=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const u=e.slice(s).map(a,-1),c=e.slice(s).map(l),d=e.invert().map(u,-1),f=e.invert().map(c);n.push({oldRange:{from:d,to:f},newRange:{from:u,to:c}})})}),$y(n)}function wh(r,e,t){const n=[];return r===e?t.resolve(r).marks().forEach(i=>{const s=t.resolve(r),o=Ka(s,i.type);o&&n.push({mark:i,...o})}):t.nodesBetween(r,e,(i,s)=>{!i||i?.nodeSize===void 0||n.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),n}var Vy=(r,e,t,n=20)=>{const i=r.doc.resolve(t);let s=n,o=null;for(;s>0&&o===null;){const a=i.node(s);a?.type.name===e?o=a:s-=1}return[o,s]};function tl(r,e){return e.nodes[r]||e.marks[r]||null}function Bs(r,e,t){return Object.fromEntries(Object.entries(t).filter(([n])=>{const i=r.find(s=>s.type===e&&s.name===n);return i?i.attribute.keepOnSplit:!1}))}var jy=(r,e=500)=>{let t="";const n=r.parentOffset;return r.parent.nodesBetween(Math.max(0,n-e),n,(i,s,o,a)=>{var l,u;const c=((u=(l=i.type.spec).toText)==null?void 0:u.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,n-s))}),t};function rl(r,e,t={}){const{empty:n,ranges:i}=r.selection,s=e?hr(e,r.schema):null;if(n)return!!(r.storedMarks||r.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Is(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,m=f.pos;r.doc.nodesBetween(h,m,(v,y)=>{if(!v.isText&&!v.marks.length)return;const w=Math.max(h,y),k=Math.min(m,y+v.nodeSize),E=k-w;o+=E,a.push(...v.marks.map(R=>({mark:R,from:w,to:k})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Is(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+u:l)>=o}function qy(r,e,t={}){if(!e)return jr(r,null,t)||rl(r,null,t);const n=zs(e,r.schema);return n==="node"?jr(r,e,t):n==="mark"?rl(r,e,t):!1}var _y=(r,e)=>{const{$from:t,$to:n,$anchor:i}=r.selection;if(e){const s=Ls(a=>a.type.name===e)(r.selection);if(!s)return!1;const o=r.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(n.parentOffset<n.parent.nodeSize-2||t.pos!==n.pos)},Wy=r=>{const{$from:e,$to:t}=r.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function xh(r,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===r.name):e}function Sh(r,e){const{nodeExtensions:t}=Bn(e),n=t.find(o=>o.name===r);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},s=Me(se(n,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Fs(r,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var n;if(t){if(r.type.name==="hardBreak")return!0;if(r.isText)return/^\s*$/m.test((n=r.text)!=null?n:"")}if(r.isText)return!r.text;if(r.isAtom||r.isLeaf)return!1;if(r.content.childCount===0)return!0;if(e){let i=!0;return r.content.forEach(s=>{i!==!1&&(Fs(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Uy(r){return r instanceof ie}var kh=class w1{constructor(e){this.position=e}static fromJSON(e){return new w1(e.position)}toJSON(){return{position:this.position}}};function Gy(r,e){const t=e.mapping.mapResult(r.position);return{position:new kh(t.pos),mapResult:t}}function Ky(r){return new kh(r)}function Th(r,e,t){const i=r.state.doc.content.size,s=fr(e,0,i),o=fr(t,0,i),a=r.coordsAtPos(s),l=r.coordsAtPos(o,-1),u=Math.min(a.top,l.top),c=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),h=f-d,m=c-u,w={top:u,bottom:c,left:d,right:f,width:h,height:m,x:d,y:u};return{...w,toJSON:()=>w}}function Yy(r,e,t){var n;const{selection:i}=e;let s=null;if(Ya(i)&&(s=i.$cursor),s){const a=(n=r.storedMarks)!=null?n:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(u=>u.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let u=a.depth===0?r.doc.inlineContent&&r.doc.type.allowsMarkType(t):!1;return r.doc.nodesBetween(a.pos,l.pos,(c,d,f)=>{if(u)return!1;if(c.isInline){const h=!f||f.type.allowsMarkType(t),m=!!t.isInSet(c.marks)||!c.marks.some(v=>v.type.excludes(t));u=h&&m}return!u}),u})}var Jy=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=hr(r,n.schema);if(i)if(o){const u=dh(n,l);t.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;n.doc.nodesBetween(c,d,(f,h)=>{const m=Math.max(h,c),v=Math.min(h+f.nodeSize,d);f.marks.find(w=>w.type===l)?f.marks.forEach(w=>{l===w.type&&t.addMark(m,v,l.create({...w.attrs,...e}))}):t.addMark(m,v,l.create(e))})});return Yy(n,t,l)},Xy=(r,e)=>({tr:t})=>(t.setMeta(r,e),!0),Zy=(r,e={})=>({state:t,dispatch:n,chain:i})=>{const s=_e(r,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>jc(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>jc(s,{...o,...e})(a,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Qy=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,i=fr(r,0,n.content.size),s=ie.create(n,i);e.setSelection(s)}return!0},e3=(r,e)=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=n;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&t.doc.nodesBetween(o,a,(l,u)=>{l.isText||t.setNodeMarkup(u,void 0,{...l.attrs,dir:r})}),!0},t3=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,{from:i,to:s}=typeof r=="number"?{from:r,to:r}:r,o=de.atStart(n).from,a=de.atEnd(n).to,l=fr(i,o,a),u=fr(s,o,a),c=de.create(n,l,u);e.setSelection(c)}return!0},r3=r=>({state:e,dispatch:t})=>{const n=_e(r,e.schema);return Y2(n)(e,t)};function Mh(r,e){const t=r.storedMarks||r.selection.$to.parentOffset&&r.selection.$from.marks();if(t){const n=t.filter(i=>e?.includes(i.type.name));r.tr.ensureMarks(n)}}var n3=({keepMarks:r=!0}={})=>({tr:e,state:t,dispatch:n,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,u=i.extensionManager.attributes,c=Bs(u,a.node().type.name,a.node().attrs);if(s instanceof ie&&s.node.isBlock)return!a.parentOffset||!ar(o,a.pos)?!1:(n&&(r&&Mh(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:Ny(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:c}]:void 0,m=ar(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!m&&ar(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:c}]:void 0),n){if(m&&(s instanceof de&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const v=e.mapping.map(a.before()),y=e.doc.resolve(v);a.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}r&&Mh(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},i3=(r,e={})=>({tr:t,state:n,dispatch:i,editor:s})=>{var o;const a=_e(r,n.schema),{$from:l,$to:u}=n.selection,c=n.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let w=F.empty;const k=l.index(-1)?1:l.index(-2)?2:3;for(let B=l.depth-k;B>=l.depth-3;B-=1)w=F.from(l.node(B).copy(w));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,R={...Bs(f,l.node().type.name,l.node().attrs),...e},O=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(R))||void 0;w=w.append(F.from(a.createAndFill(null,O)||void 0));const N=l.before(l.depth-(k-1));t.replace(N,l.after(-E),new U(w,4-k,0));let D=-1;t.doc.nodesBetween(N,t.doc.content.size,(B,L)=>{if(D>-1)return!1;B.isTextblock&&B.content.size===0&&(D=L+1)}),D>-1&&t.setSelection(de.near(t.doc.resolve(D))),t.scrollIntoView()}return!0}const h=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,m={...Bs(f,d.type.name,d.attrs),...e},v={...Bs(f,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,u.pos);const y=h?[{type:a,attrs:m},{type:h,attrs:v}]:[{type:a,attrs:m}];if(!ar(t.doc,l.pos,2))return!1;if(i){const{selection:w,storedMarks:k}=n,{splittableMarks:E}=s.extensionManager,R=k||w.$to.parentOffset&&w.$from.marks();if(t.split(l.pos,2,y).scrollIntoView(),!R||!i)return!0;const O=R.filter(N=>E.includes(N.type.name));t.ensureMarks(O)}return!0},nl=(r,e)=>{const t=Ls(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&Ir(r.doc,t.pos)&&r.join(t.pos),!0},il=(r,e)=>{const t=Ls(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(t.start).after(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&Ir(r.doc,n)&&r.join(n),!0},s3=(r,e,t,n={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=_e(r,o.schema),m=_e(e,o.schema),{selection:v,storedMarks:y}=o,{$from:w,$to:k}=v,E=w.blockRange(k),R=y||v.$to.parentOffset&&v.$from.marks();if(!E)return!1;const O=Ls(N=>Sh(N.type.name,d))(v);if(E.depth>=1&&O&&E.depth-O.depth<=1){if(O.node.type===h)return u.liftListItem(m);if(Sh(O.node.type.name,d)&&h.validContent(O.node.content)&&a)return l().command(()=>(s.setNodeMarkup(O.pos,h),!0)).command(()=>nl(s,h)).command(()=>il(s,h)).run()}return!t||!R||!a?l().command(()=>c().wrapInList(h,n)?!0:u.clearNodes()).wrapInList(h,n).command(()=>nl(s,h)).command(()=>il(s,h)).run():l().command(()=>{const N=c().wrapInList(h,n),D=R.filter(B=>f.includes(B.type.name));return s.ensureMarks(D),N?!0:u.clearNodes()}).wrapInList(h,n).command(()=>nl(s,h)).command(()=>il(s,h)).run()},o3=(r,e={},t={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=hr(r,n.schema);return rl(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},a3=(r,e,t={})=>({state:n,commands:i})=>{const s=_e(r,n.schema),o=_e(e,n.schema),a=jr(n,s,t);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},l3=(r,e={})=>({state:t,commands:n})=>{const i=_e(r,t.schema);return jr(t,i,e)?n.lift(i):n.wrapIn(i,e)},u3=()=>({state:r,dispatch:e})=>{const t=r.plugins;for(let n=0;n<t.length;n+=1){const i=t[n];let s;if(i.spec.isInputRules&&(s=i.getState(r))){if(e){const o=r.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,r.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},c3=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,{empty:n,ranges:i}=t;return n||e&&i.forEach(s=>{r.removeMark(s.$from.pos,s.$to.pos)}),!0},d3=(r,e={})=>({tr:t,state:n,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=hr(r,n.schema),{$from:u,empty:c,ranges:d}=a;if(!i)return!0;if(c&&o){let{from:f,to:h}=a;const m=(s=u.marks().find(y=>y.type===l))==null?void 0:s.attrs,v=Ka(u,l,m);v&&(f=v.from,h=v.to),t.removeMark(f,h,l)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},h3=r=>({tr:e,state:t,dispatch:n})=>{const{selection:i}=t;let s,o;return typeof r=="number"?(s=r,o=r):r&&"from"in r&&"to"in r?(s=r.from,o=r.to):(s=i.from,o=i.to),n&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},f3=(r,e={})=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=zs(typeof r=="string"?r:r.name,n.schema);if(!a)return!1;a==="node"&&(s=_e(r,n.schema)),a==="mark"&&(o=hr(r,n.schema));let l=!1;return t.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let f,h,m,v;t.selection.empty?n.doc.nodesBetween(c,d,(y,w)=>{s&&s===y.type&&(l=!0,m=Math.max(w,c),v=Math.min(w+y.nodeSize,d),f=w,h=y)}):n.doc.nodesBetween(c,d,(y,w)=>{w<c&&s&&s===y.type&&(l=!0,m=Math.max(w,c),v=Math.min(w+y.nodeSize,d),f=w,h=y),w>=c&&w<=d&&(s&&s===y.type&&(l=!0,i&&t.setNodeMarkup(w,void 0,{...y.attrs,...e})),o&&y.marks.length&&y.marks.forEach(k=>{if(o===k.type&&(l=!0,i)){const E=Math.max(w,c),R=Math.min(w+y.nodeSize,d);t.addMark(E,R,o.create({...k.attrs,...e}))}}))}),h&&(f!==void 0&&i&&t.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(y=>{o===y.type&&i&&t.addMark(m,v,o.create({...y.attrs,...e}))}))}),l},p3=(r,e={})=>({state:t,dispatch:n})=>{const i=_e(r,t.schema);return j2(i,e)(t,n)},m3=(r,e={})=>({state:t,dispatch:n})=>{const i=_e(r,t.schema);return q2(i,e)(t,n)},g3=class{constructor(){this.callbacks={}}on(r,e){return this.callbacks[r]||(this.callbacks[r]=[]),this.callbacks[r].push(e),this}emit(r,...e){const t=this.callbacks[r];return t&&t.forEach(n=>n.apply(this,e)),this}off(r,e){const t=this.callbacks[r];return t&&(e?this.callbacks[r]=t.filter(n=>n!==e):delete this.callbacks[r]),this}once(r,e){const t=(...n)=>{this.off(r,t),e.apply(this,n)};return this.on(r,t)}removeAllListeners(){this.callbacks={}}},sl=class{constructor(r){var e;this.find=r.find,this.handler=r.handler,this.undoable=(e=r.undoable)!=null?e:!0}},v3=(r,e)=>{if(Ga(e))return e.exec(r);const t=e(r);if(!t)return null;const n=[t.text];return n.index=t.index,n.input=r,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(t.replaceWith)),n};function $s(r){var e;const{editor:t,from:n,to:i,text:s,rules:o,plugin:a}=r,{view:l}=t;if(l.composing)return!1;const u=l.state.doc.resolve(n);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=jy(u)+s;return o.forEach(f=>{if(c)return;const h=v3(d,f.find);if(!h)return;const m=l.state.tr,v=Ns({state:l.state,transaction:m}),y={from:n-(h[0].length-s.length),to:i},{commands:w,chain:k,can:E}=new Ds({editor:t,state:v});f.handler({state:v,range:y,match:h,commands:w,chain:k,can:E})===null||!m.steps.length||(f.undoable&&m.setMeta(a,{transform:m,from:n,to:i,text:s}),l.dispatch(m),c=!0)}),c}function y3(r){const{editor:e,rules:t}=r,n=new Be({state:{init(){return null},apply(i,s,o){const a=i.getMeta(n);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=Za(F.from(c),o.schema);const{from:d}=l,f=d+c.length;$s({editor:e,from:d,to:f,text:c,rules:t,plugin:n})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return $s({editor:e,from:s,to:o,text:a,rules:t,plugin:n})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&$s({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:n})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?$s({editor:e,from:o.pos,to:o.pos,text:`
508
- `,rules:t,plugin:n}):!1}},isInputRules:!0});return n}function b3(r){return Object.prototype.toString.call(r).slice(8,-1)}function Hs(r){return b3(r)!=="Object"?!1:r.constructor===Object&&Object.getPrototypeOf(r)===Object.prototype}function Ch(r,e){const t={...r};return Hs(r)&&Hs(e)&&Object.keys(e).forEach(n=>{Hs(e[n])&&Hs(r[n])?t[n]=Ch(r[n],e[n]):t[n]=e[n]}),t}var ol=class{constructor(r={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...r},this.name=this.config.name}get options(){return{...Me(se(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Me(se(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(r={}){const e=this.extend({...this.config,addOptions:()=>Ch(this.options,r)});return e.name=this.name,e.parent=this.parent,e}extend(r={}){const e=new this.constructor({...this.config,...r});return e.parent=this,this.child=e,e.name="name"in r?r.name:e.parent.name,e}},Oi=class x1 extends ol{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new x1(t)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>u?.type.name===t.name))return!1;const l=o.find(u=>u?.type.name===t.name);return l&&n.removeStoredMark(l),n.insertText(" ",i.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function w3(r){return typeof r=="number"}var x3=class{constructor(r){this.find=r.find,this.handler=r.handler}},S3=(r,e,t)=>{if(Ga(e))return[...r.matchAll(e)];const n=e(r,t);return n?n.map(i=>{const s=[i.text];return s.index=i.index,s.input=r,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function k3(r){const{editor:e,state:t,from:n,to:i,rule:s,pasteEvent:o,dropEvent:a}=r,{commands:l,chain:u,can:c}=new Ds({editor:e,state:t}),d=[];return t.doc.nodesBetween(n,i,(h,m)=>{var v,y,w,k,E;if((y=(v=h.type)==null?void 0:v.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const R=(E=(k=(w=h.content)==null?void 0:w.size)!=null?k:h.nodeSize)!=null?E:0,O=Math.max(n,m),N=Math.min(i,m+R);if(O>=N)return;const D=h.isText?h.text||"":h.textBetween(O-m,N-m,void 0,"");S3(D,s.find,o).forEach(L=>{if(L.index===void 0)return;const V=O+L.index+1,te=V+L[0].length,ne={from:t.tr.mapping.map(V),to:t.tr.mapping.map(te)},he=s.handler({state:t,range:ne,match:L,commands:l,chain:u,can:c,pasteEvent:o,dropEvent:a});d.push(he)})}),d.every(h=>h!==null)}var Vs=null,T3=r=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",r),t};function M3(r){const{editor:e,rules:t}=r;let n=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:c,from:d,to:f,rule:h,pasteEvt:m})=>{const v=c.tr,y=Ns({state:c,transaction:v});if(!(!k3({editor:e,state:y,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:m,dropEvent:a})||!v.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,v}};return t.map(c=>new Be({view(d){const f=m=>{var v;n=(v=d.dom.parentElement)!=null&&v.contains(m.target)?d.dom.parentElement:null,n&&(Vs=e)},h=()=>{Vs&&(Vs=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(s=n===d.dom.parentElement,a=f,!s){const h=Vs;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,f)=>{var h;const m=(h=f.clipboardData)==null?void 0:h.getData("text/html");return o=f,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const m=d[0],v=m.getMeta("uiEvent")==="paste"&&!i,y=m.getMeta("uiEvent")==="drop"&&!s,w=m.getMeta("applyPasteRules"),k=!!w;if(!v&&!y&&!k)return;if(k){let{text:O}=w;typeof O=="string"?O=O:O=Za(F.from(O),h.schema);const{from:N}=w,D=N+O.length,B=T3(O);return l({rule:c,state:h,from:N,to:{b:D},pasteEvt:B})}const E=f.doc.content.findDiffStart(h.doc.content),R=f.doc.content.findDiffEnd(h.doc.content);if(!(!w3(E)||!R||E===R.b))return l({rule:c,state:h,from:E,to:R,pasteEvt:o})}}))}var js=class{constructor(r,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=r,this.extensions=vh(r),this.schema=Py(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((r,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:tl(e.name,this.schema)},n=se(e,"addCommands",t);return n?{...r,...n()}:r},{})}get plugins(){const{editor:r}=this;return Qa([...this.extensions].reverse()).flatMap(n=>{const i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:r,type:tl(n.name,this.schema)},s=[],o=se(n,"addKeyboardShortcuts",i);let a={};if(n.type==="mark"&&se(n,"exitable",i)&&(a.ArrowRight=()=>Oi.handleExit({editor:r,mark:n})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,m])=>[h,()=>m({editor:r})]));a={...a,...f}}const l=F5(a);s.push(l);const u=se(n,"addInputRules",i);if(xh(n,r.options.enableInputRules)&&u){const f=u();if(f&&f.length){const h=y3({editor:r,rules:f}),m=Array.isArray(h)?h:[h];s.push(...m)}}const c=se(n,"addPasteRules",i);if(xh(n,r.options.enablePasteRules)&&c){const f=c();if(f&&f.length){const h=M3({editor:r,rules:f});s.push(...h)}}const d=se(n,"addProseMirrorPlugins",i);if(d){const f=d();s.push(...f)}return s})}get attributes(){return fh(this.extensions)}get nodeViews(){const{editor:r}=this,{nodeExtensions:e}=Bn(this.extensions);return Object.fromEntries(e.filter(t=>!!se(t,"addNodeView")).map(t=>{const n=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:_e(t.name,this.schema)},s=se(t,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,u,c,d,f)=>{const h=Ai(l,n);return o({node:l,view:u,getPos:c,decorations:d,innerDecorations:f,editor:r,extension:t,HTMLAttributes:h})};return[t.name,a]}))}get markViews(){const{editor:r}=this,{markExtensions:e}=Bn(this.extensions);return Object.fromEntries(e.filter(t=>!!se(t,"addMarkView")).map(t=>{const n=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:hr(t.name,this.schema)},s=se(t,"addMarkView",i);if(!s)return[];const o=(a,l,u)=>{const c=Ai(a,n);return s()({mark:a,view:l,inline:u,editor:r,extension:t,HTMLAttributes:c,updateAttributes:d=>{B3(a,r,d)}})};return[t.name,o]}))}setupExtensions(){const r=this.extensions;this.editor.extensionStorage=Object.fromEntries(r.map(e=>[e.name,e.storage])),r.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:tl(e.name,this.schema)};e.type==="mark"&&((t=Me(se(e,"keepOnSplit",n)))==null||t)&&this.splittableMarks.push(e.name);const i=se(e,"onBeforeCreate",n),s=se(e,"onCreate",n),o=se(e,"onUpdate",n),a=se(e,"onSelectionUpdate",n),l=se(e,"onTransaction",n),u=se(e,"onFocus",n),c=se(e,"onBlur",n),d=se(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};js.resolve=vh,js.sort=Qa,js.flatten=Xa;var C3={};Ua(C3,{ClipboardTextSerializer:()=>Eh,Commands:()=>Ah,Delete:()=>Oh,Drop:()=>Nh,Editable:()=>Dh,FocusEvents:()=>Rh,Keymap:()=>Ph,Paste:()=>zh,Tabindex:()=>Lh,TextDirection:()=>Bh,focusEventsPluginKey:()=>Ih});var xe=class S1 extends ol{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new S1(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Eh=xe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Be({key:new Ve("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:r}=this,{state:e,schema:t}=r,{doc:n,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),a=Math.max(...s.map(c=>c.$to.pos)),l=el(t);return yh(n,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Ah=xe.create({name:"commands",addCommands(){return{...nh}}}),Oh=xe.create({name:"delete",onUpdate({transaction:r,appendedTransactions:e}){var t,n,i;const s=()=>{var o,a,l,u;if((u=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,r))!=null?u:r.getMeta("y-sync$"))return;const c=Oy(r.before,[r,...e]);Hy(c).forEach(h=>{c.mapping.mapResult(h.oldRange.from).deletedAfter&&c.mapping.mapResult(h.oldRange.to).deletedBefore&&c.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,v)=>{const y=v+m.nodeSize-2,w=h.oldRange.from<=v&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:v,to:y,newFrom:c.mapping.map(v),newTo:c.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!w,editor:this.editor,transaction:r,combinedTransform:c})})});const f=c.mapping;c.steps.forEach((h,m)=>{var v,y;if(h instanceof Ft){const w=f.slice(m).map(h.from,-1),k=f.slice(m).map(h.to),E=f.invert().map(w,-1),R=f.invert().map(k),O=(v=c.doc.nodeAt(w-1))==null?void 0:v.marks.some(D=>D.eq(h.mark)),N=(y=c.doc.nodeAt(k))==null?void 0:y.marks.some(D=>D.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:E,to:R},newRange:{from:w,to:k},partial:!!(N||O),editor:this.editor,transaction:r,combinedTransform:c})}})};(i=(n=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:n.async)==null||i?setTimeout(s,0):s()}}),Nh=xe.create({name:"drop",addProseMirrorPlugins(){return[new Be({key:new Ve("tiptapDrop"),props:{handleDrop:(r,e,t,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:n})}}})]}}),Dh=xe.create({name:"editable",addProseMirrorPlugins(){return[new Be({key:new Ve("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ih=new Ve("focusEvents"),Rh=xe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new Be({key:Ih,props:{handleDOMEvents:{focus:(e,t)=>{r.isFocused=!0;const n=r.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,t)=>{r.isFocused=!1;const n=r.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),Ph=xe.create({name:"keymap",addKeyboardShortcuts(){const r=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:u}=a,{empty:c,$anchor:d}=l,{pos:f,parent:h}=d,m=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,v=m.parent.type.spec.isolating,y=d.pos-d.parentOffset,w=v&&m.parent.childCount===1?y===d.pos:le.atStart(u).from===f;return!c||!h.type.isTextblock||h.textContent.length||!w||w&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:r,"Mod-Backspace":r,"Shift-Backspace":r,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},s={...n,"Ctrl-h":r,"Alt-Backspace":r,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Rs()||uh()?s:i},addProseMirrorPlugins(){return[new Be({key:new Ve("clearDocument"),appendTransaction:(r,e,t)=>{if(r.some(v=>v.getMeta("composition")))return;const n=r.some(v=>v.docChanged)&&!e.doc.eq(t.doc),i=r.some(v=>v.getMeta("preventClearDocument"));if(!n||i)return;const{empty:s,from:o,to:a}=e.selection,l=le.atStart(e.doc).from,u=le.atEnd(e.doc).to;if(s||!(o===l&&a===u)||!Fs(t.doc))return;const f=t.tr,h=Ns({state:t,transaction:f}),{commands:m}=new Ds({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),zh=xe.create({name:"paste",addProseMirrorPlugins(){return[new Be({key:new Ve("tiptapPaste"),props:{handlePaste:(r,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Lh=xe.create({name:"tabindex",addProseMirrorPlugins(){return[new Be({key:new Ve("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Bh=xe.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:r}=Bn(this.extensions);return[{types:r.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const 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 Be({key:new Ve("textDirection"),props:{attributes:()=>{const r=this.options.direction;return r?{dir:r}:{}}}})]}}),E3=class Zn{constructor(e,t,n=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=i}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(){var e;return(e=this.actualDepth)!=null?e: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’t 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?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Zn(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Zn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Zn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,n)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+n+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new Zn(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new Zn(a,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,i=this.parent;for(;i&&!n;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else n=i;i=i.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{n&&i.length>0||(o.node.type.name===e&&s.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(n&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,n))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},A3=`.ProseMirror {
507
+ `,textSerializers:o={}}=t||{};let a="";return r.nodesBetween(n,i,(l,u,c,d)=>{var f;l.isBlock&&u>n&&(a+=s);const h=o?.[l.type.name];if(h)return c&&(a+=h({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(n,u)-u,i-u))}),a}function bh(r,e){const t={from:0,to:r.content.size};return yh(r,t,e)}function el(r){return Object.fromEntries(Object.entries(r.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Ly(r,e){const t=qe(e,r.schema),{from:n,to:i}=r.selection,s=[];r.doc.nodesBetween(n,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function By(r,e){const t=zs(typeof e=="string"?e:e.name,r.schema);return t==="node"?Ly(r,e):t==="mark"?dh(r,e):{}}function Fy(r,e=JSON.stringify){const t={};return r.filter(n=>{const i=e(n);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function $y(r){const e=Fy(r);return e.length===1?e:e.filter((t,n)=>!e.filter((s,o)=>o!==n).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Hy(r){const{mapping:e,steps:t}=r,n=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const u=e.slice(s).map(a,-1),c=e.slice(s).map(l),d=e.invert().map(u,-1),f=e.invert().map(c);n.push({oldRange:{from:d,to:f},newRange:{from:u,to:c}})})}),$y(n)}function wh(r,e,t){const n=[];return r===e?t.resolve(r).marks().forEach(i=>{const s=t.resolve(r),o=Ka(s,i.type);o&&n.push({mark:i,...o})}):t.nodesBetween(r,e,(i,s)=>{!i||i?.nodeSize===void 0||n.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),n}var Vy=(r,e,t,n=20)=>{const i=r.doc.resolve(t);let s=n,o=null;for(;s>0&&o===null;){const a=i.node(s);a?.type.name===e?o=a:s-=1}return[o,s]};function tl(r,e){return e.nodes[r]||e.marks[r]||null}function Bs(r,e,t){return Object.fromEntries(Object.entries(t).filter(([n])=>{const i=r.find(s=>s.type===e&&s.name===n);return i?i.attribute.keepOnSplit:!1}))}var _y=(r,e=500)=>{let t="";const n=r.parentOffset;return r.parent.nodesBetween(Math.max(0,n-e),n,(i,s,o,a)=>{var l,u;const c=((u=(l=i.type.spec).toText)==null?void 0:u.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,n-s))}),t};function rl(r,e,t={}){const{empty:n,ranges:i}=r.selection,s=e?hr(e,r.schema):null;if(n)return!!(r.storedMarks||r.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Is(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,m=f.pos;r.doc.nodesBetween(h,m,(v,y)=>{if(!v.isText&&!v.marks.length)return;const w=Math.max(h,y),k=Math.min(m,y+v.nodeSize),E=k-w;o+=E,a.push(...v.marks.map(R=>({mark:R,from:w,to:k})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Is(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+u:l)>=o}function jy(r,e,t={}){if(!e)return _r(r,null,t)||rl(r,null,t);const n=zs(e,r.schema);return n==="node"?_r(r,e,t):n==="mark"?rl(r,e,t):!1}var qy=(r,e)=>{const{$from:t,$to:n,$anchor:i}=r.selection;if(e){const s=Ls(a=>a.type.name===e)(r.selection);if(!s)return!1;const o=r.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(n.parentOffset<n.parent.nodeSize-2||t.pos!==n.pos)},Wy=r=>{const{$from:e,$to:t}=r.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function xh(r,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===r.name):e}function Sh(r,e){const{nodeExtensions:t}=Bn(e),n=t.find(o=>o.name===r);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},s=Me(se(n,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Fs(r,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var n;if(t){if(r.type.name==="hardBreak")return!0;if(r.isText)return/^\s*$/m.test((n=r.text)!=null?n:"")}if(r.isText)return!r.text;if(r.isAtom||r.isLeaf)return!1;if(r.content.childCount===0)return!0;if(e){let i=!0;return r.content.forEach(s=>{i!==!1&&(Fs(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Uy(r){return r instanceof ie}var kh=class w1{constructor(e){this.position=e}static fromJSON(e){return new w1(e.position)}toJSON(){return{position:this.position}}};function Gy(r,e){const t=e.mapping.mapResult(r.position);return{position:new kh(t.pos),mapResult:t}}function Ky(r){return new kh(r)}function Th(r,e,t){const i=r.state.doc.content.size,s=fr(e,0,i),o=fr(t,0,i),a=r.coordsAtPos(s),l=r.coordsAtPos(o,-1),u=Math.min(a.top,l.top),c=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),h=f-d,m=c-u,w={top:u,bottom:c,left:d,right:f,width:h,height:m,x:d,y:u};return{...w,toJSON:()=>w}}function Yy(r,e,t){var n;const{selection:i}=e;let s=null;if(Ya(i)&&(s=i.$cursor),s){const a=(n=r.storedMarks)!=null?n:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(u=>u.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let u=a.depth===0?r.doc.inlineContent&&r.doc.type.allowsMarkType(t):!1;return r.doc.nodesBetween(a.pos,l.pos,(c,d,f)=>{if(u)return!1;if(c.isInline){const h=!f||f.type.allowsMarkType(t),m=!!t.isInSet(c.marks)||!c.marks.some(v=>v.type.excludes(t));u=h&&m}return!u}),u})}var Jy=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=hr(r,n.schema);if(i)if(o){const u=dh(n,l);t.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;n.doc.nodesBetween(c,d,(f,h)=>{const m=Math.max(h,c),v=Math.min(h+f.nodeSize,d);f.marks.find(w=>w.type===l)?f.marks.forEach(w=>{l===w.type&&t.addMark(m,v,l.create({...w.attrs,...e}))}):t.addMark(m,v,l.create(e))})});return Yy(n,t,l)},Xy=(r,e)=>({tr:t})=>(t.setMeta(r,e),!0),Zy=(r,e={})=>({state:t,dispatch:n,chain:i})=>{const s=qe(r,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>_c(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>_c(s,{...o,...e})(a,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Qy=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,i=fr(r,0,n.content.size),s=ie.create(n,i);e.setSelection(s)}return!0},e3=(r,e)=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=n;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&t.doc.nodesBetween(o,a,(l,u)=>{l.isText||t.setNodeMarkup(u,void 0,{...l.attrs,dir:r})}),!0},t3=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,{from:i,to:s}=typeof r=="number"?{from:r,to:r}:r,o=de.atStart(n).from,a=de.atEnd(n).to,l=fr(i,o,a),u=fr(s,o,a),c=de.create(n,l,u);e.setSelection(c)}return!0},r3=r=>({state:e,dispatch:t})=>{const n=qe(r,e.schema);return Y2(n)(e,t)};function Mh(r,e){const t=r.storedMarks||r.selection.$to.parentOffset&&r.selection.$from.marks();if(t){const n=t.filter(i=>e?.includes(i.type.name));r.tr.ensureMarks(n)}}var n3=({keepMarks:r=!0}={})=>({tr:e,state:t,dispatch:n,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,u=i.extensionManager.attributes,c=Bs(u,a.node().type.name,a.node().attrs);if(s instanceof ie&&s.node.isBlock)return!a.parentOffset||!ar(o,a.pos)?!1:(n&&(r&&Mh(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:Ny(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:c}]:void 0,m=ar(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!m&&ar(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:c}]:void 0),n){if(m&&(s instanceof de&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const v=e.mapping.map(a.before()),y=e.doc.resolve(v);a.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}r&&Mh(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return m},i3=(r,e={})=>({tr:t,state:n,dispatch:i,editor:s})=>{var o;const a=qe(r,n.schema),{$from:l,$to:u}=n.selection,c=n.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let w=F.empty;const k=l.index(-1)?1:l.index(-2)?2:3;for(let B=l.depth-k;B>=l.depth-3;B-=1)w=F.from(l.node(B).copy(w));const E=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,R={...Bs(f,l.node().type.name,l.node().attrs),...e},O=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(R))||void 0;w=w.append(F.from(a.createAndFill(null,O)||void 0));const N=l.before(l.depth-(k-1));t.replace(N,l.after(-E),new U(w,4-k,0));let D=-1;t.doc.nodesBetween(N,t.doc.content.size,(B,L)=>{if(D>-1)return!1;B.isTextblock&&B.content.size===0&&(D=L+1)}),D>-1&&t.setSelection(de.near(t.doc.resolve(D))),t.scrollIntoView()}return!0}const h=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,m={...Bs(f,d.type.name,d.attrs),...e},v={...Bs(f,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,u.pos);const y=h?[{type:a,attrs:m},{type:h,attrs:v}]:[{type:a,attrs:m}];if(!ar(t.doc,l.pos,2))return!1;if(i){const{selection:w,storedMarks:k}=n,{splittableMarks:E}=s.extensionManager,R=k||w.$to.parentOffset&&w.$from.marks();if(t.split(l.pos,2,y).scrollIntoView(),!R||!i)return!0;const O=R.filter(N=>E.includes(N.type.name));t.ensureMarks(O)}return!0},nl=(r,e)=>{const t=Ls(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&Ir(r.doc,t.pos)&&r.join(t.pos),!0},il=(r,e)=>{const t=Ls(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(t.start).after(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&Ir(r.doc,n)&&r.join(n),!0},s3=(r,e,t,n={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=qe(r,o.schema),m=qe(e,o.schema),{selection:v,storedMarks:y}=o,{$from:w,$to:k}=v,E=w.blockRange(k),R=y||v.$to.parentOffset&&v.$from.marks();if(!E)return!1;const O=Ls(N=>Sh(N.type.name,d))(v);if(E.depth>=1&&O&&E.depth-O.depth<=1){if(O.node.type===h)return u.liftListItem(m);if(Sh(O.node.type.name,d)&&h.validContent(O.node.content)&&a)return l().command(()=>(s.setNodeMarkup(O.pos,h),!0)).command(()=>nl(s,h)).command(()=>il(s,h)).run()}return!t||!R||!a?l().command(()=>c().wrapInList(h,n)?!0:u.clearNodes()).wrapInList(h,n).command(()=>nl(s,h)).command(()=>il(s,h)).run():l().command(()=>{const N=c().wrapInList(h,n),D=R.filter(B=>f.includes(B.type.name));return s.ensureMarks(D),N?!0:u.clearNodes()}).wrapInList(h,n).command(()=>nl(s,h)).command(()=>il(s,h)).run()},o3=(r,e={},t={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=hr(r,n.schema);return rl(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},a3=(r,e,t={})=>({state:n,commands:i})=>{const s=qe(r,n.schema),o=qe(e,n.schema),a=_r(n,s,t);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},l3=(r,e={})=>({state:t,commands:n})=>{const i=qe(r,t.schema);return _r(t,i,e)?n.lift(i):n.wrapIn(i,e)},u3=()=>({state:r,dispatch:e})=>{const t=r.plugins;for(let n=0;n<t.length;n+=1){const i=t[n];let s;if(i.spec.isInputRules&&(s=i.getState(r))){if(e){const o=r.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,r.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},c3=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,{empty:n,ranges:i}=t;return n||e&&i.forEach(s=>{r.removeMark(s.$from.pos,s.$to.pos)}),!0},d3=(r,e={})=>({tr:t,state:n,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=hr(r,n.schema),{$from:u,empty:c,ranges:d}=a;if(!i)return!0;if(c&&o){let{from:f,to:h}=a;const m=(s=u.marks().find(y=>y.type===l))==null?void 0:s.attrs,v=Ka(u,l,m);v&&(f=v.from,h=v.to),t.removeMark(f,h,l)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},h3=r=>({tr:e,state:t,dispatch:n})=>{const{selection:i}=t;let s,o;return typeof r=="number"?(s=r,o=r):r&&"from"in r&&"to"in r?(s=r.from,o=r.to):(s=i.from,o=i.to),n&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},f3=(r,e={})=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const a=zs(typeof r=="string"?r:r.name,n.schema);if(!a)return!1;a==="node"&&(s=qe(r,n.schema)),a==="mark"&&(o=hr(r,n.schema));let l=!1;return t.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let f,h,m,v;t.selection.empty?n.doc.nodesBetween(c,d,(y,w)=>{s&&s===y.type&&(l=!0,m=Math.max(w,c),v=Math.min(w+y.nodeSize,d),f=w,h=y)}):n.doc.nodesBetween(c,d,(y,w)=>{w<c&&s&&s===y.type&&(l=!0,m=Math.max(w,c),v=Math.min(w+y.nodeSize,d),f=w,h=y),w>=c&&w<=d&&(s&&s===y.type&&(l=!0,i&&t.setNodeMarkup(w,void 0,{...y.attrs,...e})),o&&y.marks.length&&y.marks.forEach(k=>{if(o===k.type&&(l=!0,i)){const E=Math.max(w,c),R=Math.min(w+y.nodeSize,d);t.addMark(E,R,o.create({...k.attrs,...e}))}}))}),h&&(f!==void 0&&i&&t.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(y=>{o===y.type&&i&&t.addMark(m,v,o.create({...y.attrs,...e}))}))}),l},p3=(r,e={})=>({state:t,dispatch:n})=>{const i=qe(r,t.schema);return _2(i,e)(t,n)},m3=(r,e={})=>({state:t,dispatch:n})=>{const i=qe(r,t.schema);return j2(i,e)(t,n)},g3=class{constructor(){this.callbacks={}}on(r,e){return this.callbacks[r]||(this.callbacks[r]=[]),this.callbacks[r].push(e),this}emit(r,...e){const t=this.callbacks[r];return t&&t.forEach(n=>n.apply(this,e)),this}off(r,e){const t=this.callbacks[r];return t&&(e?this.callbacks[r]=t.filter(n=>n!==e):delete this.callbacks[r]),this}once(r,e){const t=(...n)=>{this.off(r,t),e.apply(this,n)};return this.on(r,t)}removeAllListeners(){this.callbacks={}}},sl=class{constructor(r){var e;this.find=r.find,this.handler=r.handler,this.undoable=(e=r.undoable)!=null?e:!0}},v3=(r,e)=>{if(Ga(e))return e.exec(r);const t=e(r);if(!t)return null;const n=[t.text];return n.index=t.index,n.input=r,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(t.replaceWith)),n};function $s(r){var e;const{editor:t,from:n,to:i,text:s,rules:o,plugin:a}=r,{view:l}=t;if(l.composing)return!1;const u=l.state.doc.resolve(n);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=_y(u)+s;return o.forEach(f=>{if(c)return;const h=v3(d,f.find);if(!h)return;const m=l.state.tr,v=Ns({state:l.state,transaction:m}),y={from:n-(h[0].length-s.length),to:i},{commands:w,chain:k,can:E}=new Ds({editor:t,state:v});f.handler({state:v,range:y,match:h,commands:w,chain:k,can:E})===null||!m.steps.length||(f.undoable&&m.setMeta(a,{transform:m,from:n,to:i,text:s}),l.dispatch(m),c=!0)}),c}function y3(r){const{editor:e,rules:t}=r,n=new Be({state:{init(){return null},apply(i,s,o){const a=i.getMeta(n);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=Za(F.from(c),o.schema);const{from:d}=l,f=d+c.length;$s({editor:e,from:d,to:f,text:c,rules:t,plugin:n})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return $s({editor:e,from:s,to:o,text:a,rules:t,plugin:n})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&$s({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:n})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?$s({editor:e,from:o.pos,to:o.pos,text:`
508
+ `,rules:t,plugin:n}):!1}},isInputRules:!0});return n}function b3(r){return Object.prototype.toString.call(r).slice(8,-1)}function Hs(r){return b3(r)!=="Object"?!1:r.constructor===Object&&Object.getPrototypeOf(r)===Object.prototype}function Ch(r,e){const t={...r};return Hs(r)&&Hs(e)&&Object.keys(e).forEach(n=>{Hs(e[n])&&Hs(r[n])?t[n]=Ch(r[n],e[n]):t[n]=e[n]}),t}var ol=class{constructor(r={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...r},this.name=this.config.name}get options(){return{...Me(se(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Me(se(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(r={}){const e=this.extend({...this.config,addOptions:()=>Ch(this.options,r)});return e.name=this.name,e.parent=this.parent,e}extend(r={}){const e=new this.constructor({...this.config,...r});return e.parent=this,this.child=e,e.name="name"in r?r.name:e.parent.name,e}},Oi=class x1 extends ol{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new x1(t)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>u?.type.name===t.name))return!1;const l=o.find(u=>u?.type.name===t.name);return l&&n.removeStoredMark(l),n.insertText(" ",i.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function w3(r){return typeof r=="number"}var x3=class{constructor(r){this.find=r.find,this.handler=r.handler}},S3=(r,e,t)=>{if(Ga(e))return[...r.matchAll(e)];const n=e(r,t);return n?n.map(i=>{const s=[i.text];return s.index=i.index,s.input=r,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function k3(r){const{editor:e,state:t,from:n,to:i,rule:s,pasteEvent:o,dropEvent:a}=r,{commands:l,chain:u,can:c}=new Ds({editor:e,state:t}),d=[];return t.doc.nodesBetween(n,i,(h,m)=>{var v,y,w,k,E;if((y=(v=h.type)==null?void 0:v.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const R=(E=(k=(w=h.content)==null?void 0:w.size)!=null?k:h.nodeSize)!=null?E:0,O=Math.max(n,m),N=Math.min(i,m+R);if(O>=N)return;const D=h.isText?h.text||"":h.textBetween(O-m,N-m,void 0,"");S3(D,s.find,o).forEach(L=>{if(L.index===void 0)return;const V=O+L.index+1,te=V+L[0].length,ne={from:t.tr.mapping.map(V),to:t.tr.mapping.map(te)},he=s.handler({state:t,range:ne,match:L,commands:l,chain:u,can:c,pasteEvent:o,dropEvent:a});d.push(he)})}),d.every(h=>h!==null)}var Vs=null,T3=r=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",r),t};function M3(r){const{editor:e,rules:t}=r;let n=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:c,from:d,to:f,rule:h,pasteEvt:m})=>{const v=c.tr,y=Ns({state:c,transaction:v});if(!(!k3({editor:e,state:y,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:m,dropEvent:a})||!v.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,v}};return t.map(c=>new Be({view(d){const f=m=>{var v;n=(v=d.dom.parentElement)!=null&&v.contains(m.target)?d.dom.parentElement:null,n&&(Vs=e)},h=()=>{Vs&&(Vs=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(s=n===d.dom.parentElement,a=f,!s){const h=Vs;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,f)=>{var h;const m=(h=f.clipboardData)==null?void 0:h.getData("text/html");return o=f,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const m=d[0],v=m.getMeta("uiEvent")==="paste"&&!i,y=m.getMeta("uiEvent")==="drop"&&!s,w=m.getMeta("applyPasteRules"),k=!!w;if(!v&&!y&&!k)return;if(k){let{text:O}=w;typeof O=="string"?O=O:O=Za(F.from(O),h.schema);const{from:N}=w,D=N+O.length,B=T3(O);return l({rule:c,state:h,from:N,to:{b:D},pasteEvt:B})}const E=f.doc.content.findDiffStart(h.doc.content),R=f.doc.content.findDiffEnd(h.doc.content);if(!(!w3(E)||!R||E===R.b))return l({rule:c,state:h,from:E,to:R,pasteEvt:o})}}))}var _s=class{constructor(r,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=r,this.extensions=vh(r),this.schema=Py(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((r,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:tl(e.name,this.schema)},n=se(e,"addCommands",t);return n?{...r,...n()}:r},{})}get plugins(){const{editor:r}=this;return Qa([...this.extensions].reverse()).flatMap(n=>{const i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:r,type:tl(n.name,this.schema)},s=[],o=se(n,"addKeyboardShortcuts",i);let a={};if(n.type==="mark"&&se(n,"exitable",i)&&(a.ArrowRight=()=>Oi.handleExit({editor:r,mark:n})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,m])=>[h,()=>m({editor:r})]));a={...a,...f}}const l=F5(a);s.push(l);const u=se(n,"addInputRules",i);if(xh(n,r.options.enableInputRules)&&u){const f=u();if(f&&f.length){const h=y3({editor:r,rules:f}),m=Array.isArray(h)?h:[h];s.push(...m)}}const c=se(n,"addPasteRules",i);if(xh(n,r.options.enablePasteRules)&&c){const f=c();if(f&&f.length){const h=M3({editor:r,rules:f});s.push(...h)}}const d=se(n,"addProseMirrorPlugins",i);if(d){const f=d();s.push(...f)}return s})}get attributes(){return fh(this.extensions)}get nodeViews(){const{editor:r}=this,{nodeExtensions:e}=Bn(this.extensions);return Object.fromEntries(e.filter(t=>!!se(t,"addNodeView")).map(t=>{const n=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:qe(t.name,this.schema)},s=se(t,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,u,c,d,f)=>{const h=Ai(l,n);return o({node:l,view:u,getPos:c,decorations:d,innerDecorations:f,editor:r,extension:t,HTMLAttributes:h})};return[t.name,a]}))}get markViews(){const{editor:r}=this,{markExtensions:e}=Bn(this.extensions);return Object.fromEntries(e.filter(t=>!!se(t,"addMarkView")).map(t=>{const n=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:r,type:hr(t.name,this.schema)},s=se(t,"addMarkView",i);if(!s)return[];const o=(a,l,u)=>{const c=Ai(a,n);return s()({mark:a,view:l,inline:u,editor:r,extension:t,HTMLAttributes:c,updateAttributes:d=>{B3(a,r,d)}})};return[t.name,o]}))}setupExtensions(){const r=this.extensions;this.editor.extensionStorage=Object.fromEntries(r.map(e=>[e.name,e.storage])),r.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:tl(e.name,this.schema)};e.type==="mark"&&((t=Me(se(e,"keepOnSplit",n)))==null||t)&&this.splittableMarks.push(e.name);const i=se(e,"onBeforeCreate",n),s=se(e,"onCreate",n),o=se(e,"onUpdate",n),a=se(e,"onSelectionUpdate",n),l=se(e,"onTransaction",n),u=se(e,"onFocus",n),c=se(e,"onBlur",n),d=se(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};_s.resolve=vh,_s.sort=Qa,_s.flatten=Xa;var C3={};Ua(C3,{ClipboardTextSerializer:()=>Eh,Commands:()=>Ah,Delete:()=>Oh,Drop:()=>Nh,Editable:()=>Dh,FocusEvents:()=>Rh,Keymap:()=>Ph,Paste:()=>zh,Tabindex:()=>Lh,TextDirection:()=>Bh,focusEventsPluginKey:()=>Ih});var xe=class S1 extends ol{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new S1(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Eh=xe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Be({key:new Ve("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:r}=this,{state:e,schema:t}=r,{doc:n,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),a=Math.max(...s.map(c=>c.$to.pos)),l=el(t);return yh(n,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Ah=xe.create({name:"commands",addCommands(){return{...nh}}}),Oh=xe.create({name:"delete",onUpdate({transaction:r,appendedTransactions:e}){var t,n,i;const s=()=>{var o,a,l,u;if((u=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,r))!=null?u:r.getMeta("y-sync$"))return;const c=Oy(r.before,[r,...e]);Hy(c).forEach(h=>{c.mapping.mapResult(h.oldRange.from).deletedAfter&&c.mapping.mapResult(h.oldRange.to).deletedBefore&&c.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,v)=>{const y=v+m.nodeSize-2,w=h.oldRange.from<=v&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:v,to:y,newFrom:c.mapping.map(v),newTo:c.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!w,editor:this.editor,transaction:r,combinedTransform:c})})});const f=c.mapping;c.steps.forEach((h,m)=>{var v,y;if(h instanceof Ft){const w=f.slice(m).map(h.from,-1),k=f.slice(m).map(h.to),E=f.invert().map(w,-1),R=f.invert().map(k),O=(v=c.doc.nodeAt(w-1))==null?void 0:v.marks.some(D=>D.eq(h.mark)),N=(y=c.doc.nodeAt(k))==null?void 0:y.marks.some(D=>D.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:E,to:R},newRange:{from:w,to:k},partial:!!(N||O),editor:this.editor,transaction:r,combinedTransform:c})}})};(i=(n=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:n.async)==null||i?setTimeout(s,0):s()}}),Nh=xe.create({name:"drop",addProseMirrorPlugins(){return[new Be({key:new Ve("tiptapDrop"),props:{handleDrop:(r,e,t,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:n})}}})]}}),Dh=xe.create({name:"editable",addProseMirrorPlugins(){return[new Be({key:new Ve("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ih=new Ve("focusEvents"),Rh=xe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new Be({key:Ih,props:{handleDOMEvents:{focus:(e,t)=>{r.isFocused=!0;const n=r.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,t)=>{r.isFocused=!1;const n=r.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),Ph=xe.create({name:"keymap",addKeyboardShortcuts(){const r=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:u}=a,{empty:c,$anchor:d}=l,{pos:f,parent:h}=d,m=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,v=m.parent.type.spec.isolating,y=d.pos-d.parentOffset,w=v&&m.parent.childCount===1?y===d.pos:le.atStart(u).from===f;return!c||!h.type.isTextblock||h.textContent.length||!w||w&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:r,"Mod-Backspace":r,"Shift-Backspace":r,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},s={...n,"Ctrl-h":r,"Alt-Backspace":r,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Rs()||uh()?s:i},addProseMirrorPlugins(){return[new Be({key:new Ve("clearDocument"),appendTransaction:(r,e,t)=>{if(r.some(v=>v.getMeta("composition")))return;const n=r.some(v=>v.docChanged)&&!e.doc.eq(t.doc),i=r.some(v=>v.getMeta("preventClearDocument"));if(!n||i)return;const{empty:s,from:o,to:a}=e.selection,l=le.atStart(e.doc).from,u=le.atEnd(e.doc).to;if(s||!(o===l&&a===u)||!Fs(t.doc))return;const f=t.tr,h=Ns({state:t,transaction:f}),{commands:m}=new Ds({editor:this.editor,state:h});if(m.clearNodes(),!!f.steps.length)return f}})]}}),zh=xe.create({name:"paste",addProseMirrorPlugins(){return[new Be({key:new Ve("tiptapPaste"),props:{handlePaste:(r,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Lh=xe.create({name:"tabindex",addProseMirrorPlugins(){return[new Be({key:new Ve("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Bh=xe.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:r}=Bn(this.extensions);return[{types:r.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const 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 Be({key:new Ve("textDirection"),props:{attributes:()=>{const r=this.options.direction;return r?{dir:r}:{}}}})]}}),E3=class Zn{constructor(e,t,n=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=i}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(){var e;return(e=this.actualDepth)!=null?e: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’t 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?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Zn(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Zn(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Zn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,n)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+n+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const l=new Zn(a,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new Zn(a,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,i=this.parent;for(;i&&!n;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else n=i;i=i.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{n&&i.length>0||(o.node.type.name===e&&s.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(n&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,n))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},A3=`.ProseMirror {
509
509
  position: relative;
510
510
  }
511
511
 
@@ -575,9 +575,9 @@ img.ProseMirror-separator {
575
575
 
576
576
  .ProseMirror-focused .ProseMirror-gapcursor {
577
577
  display: block;
578
- }`;function O3(r,e,t){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=r,document.getElementsByTagName("head")[0].appendChild(i),i}var N3=class extends g3{constructor(r={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!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:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Gy,createMappablePosition:Ky},this.setOptions(r),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:n,slice:i,moved:s})=>this.options.onDrop(n,i,s)),this.on("paste",({event:n,slice:i})=>this.options.onPaste(n,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=oh(e,this.options.autofocus);this.editorState=On.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(r){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(r),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){const r=this.editorView.dom;r?.editor&&delete r.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(r){console.warn("Failed to remove CSS element:",r)}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=O3(A3,this.options.injectNonce))}setOptions(r={}){this.options={...this.options,...r},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(r,e=!0){this.setOptions({editable:r}),e&&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:r=>{this.editorState=r},dispatch:r=>{this.dispatchTransaction(r)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(r,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in r)return Reflect.get(r,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(r,e){const t=hh(e)?e(r,[...this.state.plugins]):[...this.state.plugins,r],n=this.state.reconfigure({plugins:t});return this.view.updateState(n),n}unregisterPlugin(r){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(r).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;t=t.filter(o=>!o.key.startsWith(s))}),e.length===t.length)return;const n=this.state.reconfigure({plugins:t});return this.view.updateState(n),n}createExtensionManager(){var r,e;const n=[...this.options.enableCoreExtensions?[Dh,Eh.configure({blockSeparator:(e=(r=this.options.coreExtensionOptions)==null?void 0:r.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Ah,Rh,Ph,Lh,Nh,zh,Oh,Bh.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new js(n,this)}createCommandManager(){this.commandManager=new Ds({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let r;try{r=Ja(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,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(t=>t.name!=="collaboration"),this.createExtensionManager()}}),r=Ja(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return r}createView(r){var e;this.editorView=new Xd(r,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.prependClass(),this.injectCSS();const n=this.view.dom;n.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(r){this.isCapturingTransaction=!0,r(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(r){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=r;return}r.steps.forEach(u=>{var c;return(c=this.capturedTransaction)==null?void 0:c.step(u)});return}const{state:e,transactions:t}=this.state.applyTransaction(r),n=!this.state.selection.eq(e.selection),i=t.includes(r),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:r,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:r,appendedTransactions:t.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:r});const o=t.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(r.getMeta("preventUpdate")||!t.some(u=>u.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:r,appendedTransactions:t.slice(1)})}getAttributes(r){return By(this.state,r)}isActive(r,e){const t=typeof r=="string"?r:null,n=typeof r=="string"?e:r;return qy(this.state,t,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Za(this.state.doc.content,this.schema)}getText(r){const{blockSeparator:e=`
578
+ }`;function O3(r,e,t){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=r,document.getElementsByTagName("head")[0].appendChild(i),i}var N3=class extends g3{constructor(r={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!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:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Gy,createMappablePosition:Ky},this.setOptions(r),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:n,slice:i,moved:s})=>this.options.onDrop(n,i,s)),this.on("paste",({event:n,slice:i})=>this.options.onPaste(n,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=oh(e,this.options.autofocus);this.editorState=On.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(r){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(r),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){const r=this.editorView.dom;r?.editor&&delete r.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(r){console.warn("Failed to remove CSS element:",r)}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=O3(A3,this.options.injectNonce))}setOptions(r={}){this.options={...this.options,...r},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(r,e=!0){this.setOptions({editable:r}),e&&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:r=>{this.editorState=r},dispatch:r=>{this.dispatchTransaction(r)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(r,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in r)return Reflect.get(r,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(r,e){const t=hh(e)?e(r,[...this.state.plugins]):[...this.state.plugins,r],n=this.state.reconfigure({plugins:t});return this.view.updateState(n),n}unregisterPlugin(r){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(r).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;t=t.filter(o=>!o.key.startsWith(s))}),e.length===t.length)return;const n=this.state.reconfigure({plugins:t});return this.view.updateState(n),n}createExtensionManager(){var r,e;const n=[...this.options.enableCoreExtensions?[Dh,Eh.configure({blockSeparator:(e=(r=this.options.coreExtensionOptions)==null?void 0:r.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Ah,Rh,Ph,Lh,Nh,zh,Oh,Bh.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new _s(n,this)}createCommandManager(){this.commandManager=new Ds({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let r;try{r=Ja(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,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(t=>t.name!=="collaboration"),this.createExtensionManager()}}),r=Ja(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return r}createView(r){var e;this.editorView=new Xd(r,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.prependClass(),this.injectCSS();const n=this.view.dom;n.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(r){this.isCapturingTransaction=!0,r(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(r){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=r;return}r.steps.forEach(u=>{var c;return(c=this.capturedTransaction)==null?void 0:c.step(u)});return}const{state:e,transactions:t}=this.state.applyTransaction(r),n=!this.state.selection.eq(e.selection),i=t.includes(r),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:r,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:r,appendedTransactions:t.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:r});const o=t.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(r.getMeta("preventUpdate")||!t.some(u=>u.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:r,appendedTransactions:t.slice(1)})}getAttributes(r){return By(this.state,r)}isActive(r,e){const t=typeof r=="string"?r:null,n=typeof r=="string"?e:r;return jy(this.state,t,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Za(this.state.doc.content,this.schema)}getText(r){const{blockSeparator:e=`
579
579
 
580
- `,textSerializers:t={}}=r||{};return bh(this.state.doc,{blockSeparator:e,textSerializers:{...el(this.schema),...t}})}get isEmpty(){return Fs(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var r,e;return(e=(r=this.editorView)==null?void 0:r.isDestroyed)!=null?e:!0}$node(r,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(r,e))||null}$nodes(r,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(r,e))||null}$pos(r){const e=this.state.doc.resolve(r);return new E3(e,this)}get $doc(){return this.$pos(0)}};function qr(r){return new sl({find:r.find,handler:({state:e,range:t,match:n})=>{const i=Me(r.getAttributes,void 0,n);if(i===!1||i===null)return null;const{tr:s}=e,o=n[n.length-1],a=n[0];if(o){const l=a.search(/\S/),u=t.from+a.indexOf(o),c=u+o.length;if(wh(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(v=>v===r.type&&v!==h.mark.type)).filter(h=>h.to>u).length)return null;c<t.to&&s.delete(c,t.to),u>t.from&&s.delete(t.from+l,u);const f=t.from+l+o.length;s.addMark(t.from+l,f,r.type.create(i||{})),s.removeStoredMark(r.type)}},undoable:r.undoable})}function al(r){return new sl({find:r.find,handler:({state:e,range:t,match:n})=>{const i=e.doc.resolve(t.from),s=Me(r.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),r.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,r.type,s)},undoable:r.undoable})}function mt(r){return new sl({find:r.find,handler:({state:e,range:t,match:n,chain:i})=>{const s=Me(r.getAttributes,void 0,n)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),u=l&&aa(l,r.type,s);if(!u)return null;if(o.wrap(l,u),r.keepMarks&&r.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=r.editor.extensionManager,m=f||d.$to.parentOffset&&d.$from.marks();if(m){const v=m.filter(y=>h.includes(y.type.name));o.ensureMarks(v)}}if(r.keepAttributes){const d=r.type.name==="bulletList"||r.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const c=o.doc.resolve(t.from-1).nodeBefore;c&&c.type===r.type&&Ir(o.doc,t.from-1)&&(!r.joinPredicate||r.joinPredicate(n,c))&&o.join(t.from-1)},undoable:r.undoable})}var D3={};Ua(D3,{createAtomBlockMarkdownSpec:()=>I3,createBlockMarkdownSpec:()=>R3,createInlineMarkdownSpec:()=>L3,parseAttributes:()=>ll,parseIndentedBlocks:()=>cl,renderNestedMarkdownContent:()=>dl,serializeAttributes:()=>ul});function ll(r){if(!r?.trim())return{};const e={},t=[],n=r.replace(/["']([^"']*)["']/g,u=>(t.push(u),`__QUOTED_${t.length-1}__`)),i=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const u=i.map(c=>c.trim().slice(1));e.class=u.join(" ")}const s=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(o)).forEach(([,u,c])=>{var d;const f=parseInt(((d=c.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=t[f];h&&(e[u]=h.slice(1,-1))});const l=n.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 l&&l.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(e[c]=!0)}),e}function ul(r){if(!r||Object.keys(r).length===0)return"";const e=[];return r.class&&String(r.class).split(/\s+/).filter(Boolean).forEach(n=>e.push(`.${n}`)),r.id&&e.push(`#${r.id}`),Object.entries(r).forEach(([t,n])=>{t==="class"||t==="id"||(n===!0?e.push(t):n!==!1&&n!=null&&e.push(`${t}="${String(n)}"`))}),e.join(" ")}function I3(r){const{nodeName:e,name:t,parseAttributes:n=ll,serializeAttributes:i=ul,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=r,l=t||e,u=c=>{if(!a)return c;const d={};return a.forEach(f=>{f in c&&(d[f]=c[f])}),d};return{parseMarkdown:(c,d)=>{const f={...s,...c.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(c){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(d=c.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(c,d,f){const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=c.match(h);if(!m)return;const v=m[1]||"",y=n(v);if(!o.find(k=>!(k in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:c=>{const d=u(c.attrs||{}),f=i(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function R3(r){const{nodeName:e,name:t,getContent:n,parseAttributes:i=ll,serializeAttributes:s=ul,defaultAttributes:o={},content:a="block",allowedAttributes:l}=r,u=t||e,c=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(n){const v=n(d);h=typeof v=="string"?[{type:"text",text:v}]:v}else a==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const m={...o,...d.attributes};return f.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${u}`,"m"),m=(f=d.match(h))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(d,f,h){var m;const v=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=d.match(v);if(!y)return;const[w,k=""]=y,E=i(k);let R=1;const O=w.length;let N="";const D=/^:::([\w-]*)(\s.*)?/gm,B=d.slice(O);for(D.lastIndex=0;;){const L=D.exec(B);if(L===null)break;const V=L.index,te=L[1];if(!((m=L[2])!=null&&m.endsWith(":::"))){if(te)R+=1;else if(R-=1,R===0){const ne=B.slice(0,V);N=ne.trim();const he=d.slice(0,O+V+L[0].length);let re=[];if(N)if(a==="block")for(re=h.blockTokens(ne),re.forEach(G=>{G.text&&(!G.tokens||G.tokens.length===0)&&(G.tokens=h.inlineTokens(G.text))});re.length>0;){const G=re[re.length-1];if(G.type==="paragraph"&&(!G.text||G.text.trim()===""))re.pop();else break}else re=h.inlineTokens(N);return{type:e,raw:he,attributes:E,content:N,tokens:re}}}}}},renderMarkdown:(d,f)=>{const h=c(d.attrs||{}),m=s(h),v=m?` {${m}}`:"",y=f.renderChildren(d.content||[],`
580
+ `,textSerializers:t={}}=r||{};return bh(this.state.doc,{blockSeparator:e,textSerializers:{...el(this.schema),...t}})}get isEmpty(){return Fs(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var r,e;return(e=(r=this.editorView)==null?void 0:r.isDestroyed)!=null?e:!0}$node(r,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(r,e))||null}$nodes(r,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(r,e))||null}$pos(r){const e=this.state.doc.resolve(r);return new E3(e,this)}get $doc(){return this.$pos(0)}};function jr(r){return new sl({find:r.find,handler:({state:e,range:t,match:n})=>{const i=Me(r.getAttributes,void 0,n);if(i===!1||i===null)return null;const{tr:s}=e,o=n[n.length-1],a=n[0];if(o){const l=a.search(/\S/),u=t.from+a.indexOf(o),c=u+o.length;if(wh(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(v=>v===r.type&&v!==h.mark.type)).filter(h=>h.to>u).length)return null;c<t.to&&s.delete(c,t.to),u>t.from&&s.delete(t.from+l,u);const f=t.from+l+o.length;s.addMark(t.from+l,f,r.type.create(i||{})),s.removeStoredMark(r.type)}},undoable:r.undoable})}function al(r){return new sl({find:r.find,handler:({state:e,range:t,match:n})=>{const i=e.doc.resolve(t.from),s=Me(r.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),r.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,r.type,s)},undoable:r.undoable})}function mt(r){return new sl({find:r.find,handler:({state:e,range:t,match:n,chain:i})=>{const s=Me(r.getAttributes,void 0,n)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),u=l&&aa(l,r.type,s);if(!u)return null;if(o.wrap(l,u),r.keepMarks&&r.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=r.editor.extensionManager,m=f||d.$to.parentOffset&&d.$from.marks();if(m){const v=m.filter(y=>h.includes(y.type.name));o.ensureMarks(v)}}if(r.keepAttributes){const d=r.type.name==="bulletList"||r.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const c=o.doc.resolve(t.from-1).nodeBefore;c&&c.type===r.type&&Ir(o.doc,t.from-1)&&(!r.joinPredicate||r.joinPredicate(n,c))&&o.join(t.from-1)},undoable:r.undoable})}var D3={};Ua(D3,{createAtomBlockMarkdownSpec:()=>I3,createBlockMarkdownSpec:()=>R3,createInlineMarkdownSpec:()=>L3,parseAttributes:()=>ll,parseIndentedBlocks:()=>cl,renderNestedMarkdownContent:()=>dl,serializeAttributes:()=>ul});function ll(r){if(!r?.trim())return{};const e={},t=[],n=r.replace(/["']([^"']*)["']/g,u=>(t.push(u),`__QUOTED_${t.length-1}__`)),i=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const u=i.map(c=>c.trim().slice(1));e.class=u.join(" ")}const s=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(o)).forEach(([,u,c])=>{var d;const f=parseInt(((d=c.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=t[f];h&&(e[u]=h.slice(1,-1))});const l=n.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 l&&l.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(e[c]=!0)}),e}function ul(r){if(!r||Object.keys(r).length===0)return"";const e=[];return r.class&&String(r.class).split(/\s+/).filter(Boolean).forEach(n=>e.push(`.${n}`)),r.id&&e.push(`#${r.id}`),Object.entries(r).forEach(([t,n])=>{t==="class"||t==="id"||(n===!0?e.push(t):n!==!1&&n!=null&&e.push(`${t}="${String(n)}"`))}),e.join(" ")}function I3(r){const{nodeName:e,name:t,parseAttributes:n=ll,serializeAttributes:i=ul,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=r,l=t||e,u=c=>{if(!a)return c;const d={};return a.forEach(f=>{f in c&&(d[f]=c[f])}),d};return{parseMarkdown:(c,d)=>{const f={...s,...c.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(c){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(d=c.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(c,d,f){const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=c.match(h);if(!m)return;const v=m[1]||"",y=n(v);if(!o.find(k=>!(k in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:c=>{const d=u(c.attrs||{}),f=i(d),h=f?` {${f}}`:"";return`:::${l}${h} :::`}}}function R3(r){const{nodeName:e,name:t,getContent:n,parseAttributes:i=ll,serializeAttributes:s=ul,defaultAttributes:o={},content:a="block",allowedAttributes:l}=r,u=t||e,c=d=>{if(!l)return d;const f={};return l.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(n){const v=n(d);h=typeof v=="string"?[{type:"text",text:v}]:v}else a==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const m={...o,...d.attributes};return f.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${u}`,"m"),m=(f=d.match(h))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(d,f,h){var m;const v=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=d.match(v);if(!y)return;const[w,k=""]=y,E=i(k);let R=1;const O=w.length;let N="";const D=/^:::([\w-]*)(\s.*)?/gm,B=d.slice(O);for(D.lastIndex=0;;){const L=D.exec(B);if(L===null)break;const V=L.index,te=L[1];if(!((m=L[2])!=null&&m.endsWith(":::"))){if(te)R+=1;else if(R-=1,R===0){const ne=B.slice(0,V);N=ne.trim();const he=d.slice(0,O+V+L[0].length);let re=[];if(N)if(a==="block")for(re=h.blockTokens(ne),re.forEach(G=>{G.text&&(!G.tokens||G.tokens.length===0)&&(G.tokens=h.inlineTokens(G.text))});re.length>0;){const G=re[re.length-1];if(G.type==="paragraph"&&(!G.text||G.text.trim()===""))re.pop();else break}else re=h.inlineTokens(N);return{type:e,raw:he,attributes:E,content:N,tokens:re}}}}}},renderMarkdown:(d,f)=>{const h=c(d.attrs||{}),m=s(h),v=m?` {${m}}`:"",y=f.renderChildren(d.content||[],`
581
581
 
582
582
  `);return`:::${u}${v}
583
583
 
@@ -592,8 +592,8 @@ ${y}
592
592
  `);O.trim()&&(e.customNestedParser?k=e.customNestedParser(O):k=t.blockTokens(O))}const R=e.createToken(m,k);l.push(R)}if(l.length!==0)return{items:l,raw:u}}function dl(r,e,t,n){if(!r||!Array.isArray(r.content))return"";const i=typeof t=="function"?t(n):t,[s,...o]=r.content,a=e.renderChildren([s]),l=[`${i}${a}`];return o&&o.length>0&&o.forEach(u=>{const c=e.renderChildren([u]);if(c){const d=c.split(`
593
593
  `).map(f=>f?e.indent(f):"").join(`
594
594
  `);l.push(d)}}),l.join(`
595
- `)}function B3(r,e,t={}){const{state:n}=e,{doc:i,tr:s}=n,o=r;i.descendants((a,l)=>{const u=s.mapping.map(l),c=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(t).forEach(h=>{t[h]!==d.attrs[h]&&(f=!0)}),f){const h=r.type.create({...r.attrs,...t});s.removeMark(u,c,r.type),s.addMark(u,c,h)}}),s.docChanged&&e.view.dispatch(s)}var Ce=class k1 extends ol{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new k1(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},F3=class{constructor(r,e,t){this.isDragging=!1,this.component=r,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(r){var e,t,n,i,s,o,a;const{view:l}=this.editor,u=r.target,c=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(u)||!c)return;let d=0,f=0;if(this.dom!==c){const k=this.dom.getBoundingClientRect(),E=c.getBoundingClientRect(),R=(i=r.offsetX)!=null?i:(n=r.nativeEvent)==null?void 0:n.offsetX,O=(o=r.offsetY)!=null?o:(s=r.nativeEvent)==null?void 0:s.offsetY;d=E.x-k.x+R,f=E.y-k.y+O}const h=this.dom.cloneNode(!0);try{const k=this.dom.getBoundingClientRect();h.style.width=`${Math.round(k.width)}px`,h.style.height=`${Math.round(k.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(h),document.body.appendChild(m),(a=r.dataTransfer)==null||a.setDragImage(h,d,f)}finally{m&&setTimeout(()=>{try{m?.remove()}catch{}},0)}const v=this.getPos();if(typeof v!="number")return;const y=ie.create(l.state.doc,v),w=l.state.tr.setSelection(y);l.dispatch(w)}stopEvent(r){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:r});const t=r.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const i=r.type.startsWith("drag"),s=r.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!s&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,u=!!this.node.type.spec.draggable,c=ie.isSelectable(this.node),d=r.type==="copy",f=r.type==="paste",h=r.type==="cut",m=r.type==="mousedown";if(!u&&c&&i&&r.target===this.dom&&r.preventDefault(),u&&i&&!l&&r.target===this.dom)return r.preventDefault(),!1;if(u&&a&&!l&&m){const v=t.closest("[data-drag-handle]");v&&(this.dom===v||this.dom.contains(v))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||d||f||h||m&&c)}ignoreMutation(r){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:r}):this.node.isLeaf||this.node.isAtom?!0:r.type==="selection"||this.dom.contains(r.target)&&r.type==="childList"&&(Rs()||ah())&&this.editor.isFocused&&[...Array.from(r.addedNodes),...Array.from(r.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===r.target&&r.type==="attributes"?!0:!this.contentDOM.contains(r.target)}updateAttributes(r){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...r}),!0)})}deleteNode(){const r=this.getPos();if(typeof r!="number")return;const e=r+this.node.nodeSize;this.editor.commands.deleteRange({from:r,to:e})}};function qs(r){return new x3({find:r.find,handler:({state:e,range:t,match:n,pasteEvent:i})=>{const s=Me(r.getAttributes,void 0,n,i);if(s===!1||s===null)return null;const{tr:o}=e,a=n[n.length-1],l=n[0];let u=t.to;if(a){const c=l.search(/\S/),d=t.from+l.indexOf(a),f=d+a.length;if(wh(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===r.type&&y!==m.mark.type)).filter(m=>m.to>d).length)return null;f<t.to&&o.delete(f,t.to),d>t.from&&o.delete(t.from+c,d),u=t.from+c+a.length,o.addMark(t.from+c,u,r.type.create(s||{})),o.removeStoredMark(r.type)}}})}function $3(r={}){return new Be({view(e){return new H3(e,r)}})}class H3{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}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,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let m=h.getBoundingClientRect(),v=d?m.bottom:m.top;d&&f&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;n={left:m.left,right:m.right,top:v-y,bottom:v+y}}}}if(!n){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;n={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 u,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;u=d.left-l.scrollLeft*f,c=d.top-l.scrollTop*h}this.element.style.left=(n.left-u)/o+"px",this.element.style.top=(n.top-c)/a+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/a+"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),i=n&&n.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=mc(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Fe extends le{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Fe.valid(n)?new Fe(n):le.near(n)}content(){return U.empty}eq(e){return e instanceof Fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Fe(e.resolve(t.pos))}getBookmark(){return new hl(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!V3(e)||!j3(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&Fe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(Fe.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!ie.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),n=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(Fe.valid(a))return a}return null}}}Fe.prototype.visible=!1,Fe.findFrom=Fe.findGapCursorFrom,le.jsonID("gapcursor",Fe);class hl{constructor(e){this.pos=e}map(e){return new hl(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Fe.valid(t)?new Fe(t):le.near(t)}}function Fh(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function V3(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Fh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function j3(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Fh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function q3(){return new Be({props:{decorations:G3,createSelectionBetween(r,e,t){return e.pos==t.pos&&Fe.valid(t)?new Fe(t):null},handleClick:W3,handleKeyDown:_3,handleDOMEvents:{beforeinput:U3}}})}const _3=Wa({ArrowLeft:_s("horiz",-1),ArrowRight:_s("horiz",1),ArrowUp:_s("vert",-1),ArrowDown:_s("vert",1)});function _s(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,s){let o=n.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof de){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=n.doc.resolve(e>0?a.after():a.before())}let u=Fe.findGapCursorFrom(a,e,l);return u?(i&&i(n.tr.setSelection(new Fe(u))),!0):!1}}function W3(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!Fe.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&ie.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new Fe(n))),!0)}function U3(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof Fe))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=F.empty;for(let o=n.length-1;o>=0;o--)i=F.from(n[o].createAndFill(null,i));let s=r.state.tr.replace(t.pos,t.pos,new U(i,0,0));return s.setSelection(de.near(s.doc.resolve(t.pos+1))),r.dispatch(s),!1}function G3(r){if(!(r.selection instanceof Fe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Re.create(r.doc,[lt.widget(r.selection.head,e,{key:"gapcursor"})])}var Ws=200,Ze=function(){};Ze.prototype.append=function(e){return e.length?(e=Ze.from(e),!this.length&&e||e.length<Ws&&this.leafAppend(e)||this.length<Ws&&e.leafPrepend(this)||this.appendInner(e)):this},Ze.prototype.prepend=function(e){return e.length?Ze.from(e).append(this):this},Ze.prototype.appendInner=function(e){return new K3(this,e)},Ze.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ze.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ze.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ze.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)},Ze.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i},Ze.from=function(e){return e instanceof Ze?e:e&&e.length?new $h(e):Ze.empty};var $h=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ws)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ws)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ze);Ze.empty=new $h([]);var K3=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(n,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(n,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(n,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(n,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(Ze);const Y3=500;class $t{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,a,l,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(n,f+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new Kt(d.map));let h=d.step.map(i.slice(s)),m;h&&o.maybeStep(h).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new Kt(m,void 0,void 0,u.length+c.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new $t(this.items.slice(0,n).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,n,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new Kt(e.mapping.maps[c],d,t),h;(h=l&&l.merge(f))&&(f=h,c?s.pop():a=a.slice(0,a.length-1)),s.push(f),t&&(o++,t=void 0),i||(l=f)}let u=o-n.depth;return u>X3&&(a=J3(a,u),o-=u),new $t(a.append(s),o)}remapping(e,t){let n=new fi;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new $t(this.items.append(e.map(t=>new Kt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=t;this.items.forEach(f=>{let h=s.getMirror(--l);if(h==null)return;o=Math.min(o,h);let m=s.maps[h];if(f.step){let v=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(s.slice(l+1,h));y&&a++,n.push(new Kt(m,v,y))}else n.push(new Kt(m))},i);let u=[];for(let f=t;f<o;f++)u.push(new Kt(s.maps[f]));let c=this.items.slice(0,i).append(u).append(n),d=new $t(c,a);return d.emptyItemCount()>Y3&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(n)),u=l&&l.getMap();if(n--,u&&t.appendMap(u,n),l){let c=o.selection&&o.selection.map(t.slice(n));c&&s++;let d=new Kt(u.invert(),l,c),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&n--},this.items.length,0),new $t(Ze.from(i.reverse()),s)}}$t.empty=new $t(Ze.empty,0);function J3(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class Kt{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Kt(t.getMap().invert(),t,this.selection)}}}class _r{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const X3=20;function Z3(r,e,t,n){let i=t.getMeta(vn),s;if(i)return i.historyState;t.getMeta(t6)&&(r=new _r(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(vn))return o.getMeta(vn).redo?new _r(r.done.addTransform(t,void 0,n,Us(e)),r.undone,Hh(t.mapping.maps),r.prevTime,r.prevComposition):new _r(r.done,r.undone.addTransform(t,void 0,n,Us(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=r.prevTime==0||!o&&r.prevComposition!=a&&(r.prevTime<(t.time||0)-n.newGroupDelay||!Q3(t,r.prevRanges)),u=o?fl(r.prevRanges,t.mapping):Hh(t.mapping.maps);return new _r(r.done.addTransform(t,l?e.selection.getBookmark():void 0,n,Us(e)),$t.empty,u,t.time,a??r.prevComposition)}else return(s=t.getMeta("rebased"))?new _r(r.done.rebased(t,s),r.undone.rebased(t,s),fl(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new _r(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),fl(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function Q3(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Hh(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function fl(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function e6(r,e,t){let n=Us(e),i=vn.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),l=new _r(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(vn,{redo:t,historyState:l})}let pl=!1,Vh=null;function Us(r){let e=r.plugins;if(Vh!=e){pl=!1,Vh=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){pl=!0;break}}return pl}const vn=new Ve("history"),t6=new Ve("closeHistory");function r6(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new Be({key:vn,state:{init(){return new _r($t.empty,$t.empty,null,0,-1)},apply(e,t,n){return Z3(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?qh:n=="historyRedo"?_h:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function jh(r,e){return(t,n)=>{let i=vn.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=e6(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const qh=jh(!1,!0),_h=jh(!0,!0);xe.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=r?.node||this.editor.state.doc;if((r?.mode||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=r=>{const e=r?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new Be({key:new Ve("characterCount"),appendTransaction:(e,t,n)=>{if(r)return;const i=this.options.limit;if(i==null||i===0){r=!0;return}const s=this.storage.characters({node:n.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=n.tr.deleteRange(a,l);return r=!0,u}r=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=n||i>n&&s>n&&s<=i)return!0;if(i>n&&s>n&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-n,u=a-l,c=a;return e.deleteRange(u,c),!(this.storage.characters({node:e.doc})>n)}})]}}),xe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[$3(this.options)]}});var n6=xe.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Be({key:new Ve("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,s=[];if(!t||!n)return Re.create(r,[]);let o=0;this.options.mode==="deepest"&&r.descendants((l,u)=>{if(l.isText)return;if(!(i>=u&&i<=u+l.nodeSize-1))return!1;o+=1});let a=0;return r.descendants((l,u)=>{if(l.isText||!(i>=u&&i<=u+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(lt.node(u,u+l.nodeSize,{class:this.options.className}))}),Re.create(r,s)}}})]}}),i6=xe.create({name:"gapCursor",addProseMirrorPlugins(){return[q3()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=Me(se(r,"allowGapCursor",t)))!=null?e:null}}});xe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Be({key:new Ve("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return r.descendants((o,a)=>{const l=n>=a&&n<=a+o.nodeSize,u=!o.isLeaf&&Fs(o);if((l||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];s&&c.push(this.options.emptyEditorClass);const d=lt.node(a,a+o.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),Re.create(r,i)}}})]}}),xe.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return[new Be({key:new Ve("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||Uy(t.selection)||r.view.dragging?null:Re.create(t.doc,[lt.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Wh({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||e?.type===r}xe.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new Ve(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new Be({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:u}=o,c=e.getState(o),d=a.content.size,f=u.nodes[t];if(c)return l.insert(d,f.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!Wh({node:o,types:n})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!Wh({node:o,types:n})}}})]}});var s6=xe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>qh(r,e),redo:()=>({state:r,dispatch:e})=>_h(r,e)}},addProseMirrorPlugins(){return[r6(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()}}}),Gs={exports:{}},ml={};var Uh;function o6(){if(Uh)return ml;Uh=1;var r=z;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var t=typeof Object.is=="function"?Object.is:e,n=r.useState,i=r.useEffect,s=r.useLayoutEffect,o=r.useDebugValue;function a(d,f){var h=f(),m=n({inst:{value:h,getSnapshot:f}}),v=m[0].inst,y=m[1];return s(function(){v.value=h,v.getSnapshot=f,l(v)&&y({inst:v})},[d,h,f]),i(function(){return l(v)&&y({inst:v}),d(function(){l(v)&&y({inst:v})})},[d]),o(h),h}function l(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!t(d,h)}catch{return!0}}function u(d,f){return f()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return ml.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:c,ml}var gl={};var Gh;function a6(){return Gh||(Gh=1,process.env.NODE_ENV!=="production"&&(function(){function r(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}function e(h,m){c||i.startTransition===void 0||(c=!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 v=m();if(!d){var y=m();s(v,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}y=o({inst:{value:v,getSnapshot:m}});var w=y[0].inst,k=y[1];return l(function(){w.value=v,w.getSnapshot=m,t(w)&&k({inst:w})},[h,v,m]),a(function(){return t(w)&&k({inst:w}),h(function(){t(w)&&k({inst:w})})},[h]),u(v),v}function t(h){var m=h.getSnapshot;h=h.value;try{var v=m();return!s(h,v)}catch{return!0}}function n(h,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=z,s=typeof Object.is=="function"?Object.is:r,o=i.useState,a=i.useEffect,l=i.useLayoutEffect,u=i.useDebugValue,c=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:e;gl.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),gl}var Kh;function vl(){return Kh||(Kh=1,process.env.NODE_ENV==="production"?Gs.exports=o6():Gs.exports=a6()),Gs.exports}var Yh=vl();const{getOwnPropertyNames:l6,getOwnPropertySymbols:u6}=Object,{hasOwnProperty:c6}=Object.prototype;function yl(r,e){return function(n,i,s){return r(n,i,s)&&e(n,i,s)}}function Ks(r){return function(t,n,i){if(!t||!n||typeof t!="object"||typeof n!="object")return r(t,n,i);const{cache:s}=i,o=s.get(t),a=s.get(n);if(o&&a)return o===n&&a===t;s.set(t,n),s.set(n,t);const l=r(t,n,i);return s.delete(t),s.delete(n),l}}function d6(r){return r?.[Symbol.toStringTag]}function Jh(r){return l6(r).concat(u6(r))}const h6=Object.hasOwn||((r,e)=>c6.call(r,e));function yn(r,e){return r===e||!r&&!e&&r!==r&&e!==e}const f6="__v",p6="__o",m6="_owner",{getOwnPropertyDescriptor:Xh,keys:Zh}=Object;function g6(r,e){return r.byteLength===e.byteLength&&Ys(new Uint8Array(r),new Uint8Array(e))}function v6(r,e,t){let n=r.length;if(e.length!==n)return!1;for(;n-- >0;)if(!t.equals(r[n],e[n],n,n,r,e,t))return!1;return!0}function y6(r,e){return r.byteLength===e.byteLength&&Ys(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function b6(r,e){return yn(r.getTime(),e.getTime())}function w6(r,e){return r.name===e.name&&r.message===e.message&&r.cause===e.cause&&r.stack===e.stack}function x6(r,e){return r===e}function Qh(r,e,t){const n=r.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),s=r.entries();let o,a,l=0;for(;(o=s.next())&&!o.done;){const u=e.entries();let c=!1,d=0;for(;(a=u.next())&&!a.done;){if(i[d]){d++;continue}const f=o.value,h=a.value;if(t.equals(f[0],h[0],l,d,r,e,t)&&t.equals(f[1],h[1],f[0],h[0],r,e,t)){c=i[d]=!0;break}d++}if(!c)return!1;l++}return!0}const S6=yn;function k6(r,e,t){const n=Zh(r);let i=n.length;if(Zh(e).length!==i)return!1;for(;i-- >0;)if(!tf(r,e,t,n[i]))return!1;return!0}function Ni(r,e,t){const n=Jh(r);let i=n.length;if(Jh(e).length!==i)return!1;let s,o,a;for(;i-- >0;)if(s=n[i],!tf(r,e,t,s)||(o=Xh(r,s),a=Xh(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function T6(r,e){return yn(r.valueOf(),e.valueOf())}function M6(r,e){return r.source===e.source&&r.flags===e.flags}function ef(r,e,t){const n=r.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),s=r.values();let o,a;for(;(o=s.next())&&!o.done;){const l=e.values();let u=!1,c=0;for(;(a=l.next())&&!a.done;){if(!i[c]&&t.equals(o.value,a.value,o.value,a.value,r,e,t)){u=i[c]=!0;break}c++}if(!u)return!1}return!0}function Ys(r,e){let t=r.byteLength;if(e.byteLength!==t||r.byteOffset!==e.byteOffset)return!1;for(;t-- >0;)if(r[t]!==e[t])return!1;return!0}function C6(r,e){return r.hostname===e.hostname&&r.pathname===e.pathname&&r.protocol===e.protocol&&r.port===e.port&&r.hash===e.hash&&r.username===e.username&&r.password===e.password}function tf(r,e,t,n){return(n===m6||n===p6||n===f6)&&(r.$$typeof||e.$$typeof)?!0:h6(e,n)&&t.equals(r[n],e[n],n,n,r,e,t)}const E6="[object ArrayBuffer]",A6="[object Arguments]",O6="[object Boolean]",N6="[object DataView]",D6="[object Date]",I6="[object Error]",R6="[object Map]",P6="[object Number]",z6="[object Object]",L6="[object RegExp]",B6="[object Set]",F6="[object String]",$6={"[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},H6="[object URL]",V6=Object.prototype.toString;function j6({areArrayBuffersEqual:r,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:m}){return function(y,w,k){if(y===w)return!0;if(y==null||w==null)return!1;const E=typeof y;if(E!==typeof w)return!1;if(E!=="object")return E==="number"?a(y,w,k):E==="function"?s(y,w,k):!1;const R=y.constructor;if(R!==w.constructor)return!1;if(R===Object)return l(y,w,k);if(Array.isArray(y))return e(y,w,k);if(R===Date)return n(y,w,k);if(R===RegExp)return c(y,w,k);if(R===Map)return o(y,w,k);if(R===Set)return d(y,w,k);const O=V6.call(y);if(O===D6)return n(y,w,k);if(O===L6)return c(y,w,k);if(O===R6)return o(y,w,k);if(O===B6)return d(y,w,k);if(O===z6)return typeof y.then!="function"&&typeof w.then!="function"&&l(y,w,k);if(O===H6)return h(y,w,k);if(O===I6)return i(y,w,k);if(O===A6)return l(y,w,k);if($6[O])return f(y,w,k);if(O===E6)return r(y,w,k);if(O===N6)return t(y,w,k);if(O===O6||O===P6||O===F6)return u(y,w,k);if(m){let N=m[O];if(!N){const D=d6(y);D&&(N=m[D])}if(N)return N(y,w,k)}return!1}}function q6({circular:r,createCustomConfig:e,strict:t}){let n={areArrayBuffersEqual:g6,areArraysEqual:t?Ni:v6,areDataViewsEqual:y6,areDatesEqual:b6,areErrorsEqual:w6,areFunctionsEqual:x6,areMapsEqual:t?yl(Qh,Ni):Qh,areNumbersEqual:S6,areObjectsEqual:t?Ni:k6,arePrimitiveWrappersEqual:T6,areRegExpsEqual:M6,areSetsEqual:t?yl(ef,Ni):ef,areTypedArraysEqual:t?yl(Ys,Ni):Ys,areUrlsEqual:C6,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),r){const i=Ks(n.areArraysEqual),s=Ks(n.areMapsEqual),o=Ks(n.areObjectsEqual),a=Ks(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:a})}return n}function _6(r){return function(e,t,n,i,s,o,a){return r(e,t,a)}}function W6({circular:r,comparator:e,createState:t,equals:n,strict:i}){if(t)return function(a,l){const{cache:u=r?new WeakMap:void 0,meta:c}=t();return e(a,l,{cache:u,equals:n,meta:c,strict:i})};if(r)return function(a,l){return e(a,l,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};const s={cache:void 0,equals:n,meta:void 0,strict:i};return function(a,l){return e(a,l,s)}}const U6=Wr();Wr({strict:!0}),Wr({circular:!0}),Wr({circular:!0,strict:!0}),Wr({createInternalComparator:()=>yn}),Wr({strict:!0,createInternalComparator:()=>yn}),Wr({circular:!0,createInternalComparator:()=>yn}),Wr({circular:!0,createInternalComparator:()=>yn,strict:!0});function Wr(r={}){const{circular:e=!1,createInternalComparator:t,createState:n,strict:i=!1}=r,s=q6(r),o=j6(s),a=t?t(o):_6(o);return W6({circular:e,comparator:o,createState:n,equals:a,strict:i})}var Js={exports:{}},bl={};var rf;function G6(){if(rf)return bl;rf=1;var r=z,e=vl();function t(u,c){return u===c&&(u!==0||1/u===1/c)||u!==u&&c!==c}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,s=r.useRef,o=r.useEffect,a=r.useMemo,l=r.useDebugValue;return bl.useSyncExternalStoreWithSelector=function(u,c,d,f,h){var m=s(null);if(m.current===null){var v={hasValue:!1,value:null};m.current=v}else v=m.current;m=a(function(){function w(N){if(!k){if(k=!0,E=N,N=f(N),h!==void 0&&v.hasValue){var D=v.value;if(h(D,N))return R=D}return R=N}if(D=R,n(E,N))return D;var B=f(N);return h!==void 0&&h(D,B)?(E=N,D):(E=N,R=B)}var k=!1,E,R,O=d===void 0?null:d;return[function(){return w(c())},O===null?void 0:function(){return w(O())}]},[c,d,f,h]);var y=i(u,m[0],m[1]);return o(function(){v.hasValue=!0,v.value=y},[y]),l(y),y},bl}var wl={};var nf;function K6(){return nf||(nf=1,process.env.NODE_ENV!=="production"&&(function(){function r(u,c){return u===c&&(u!==0||1/u===1/c)||u!==u&&c!==c}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=z,t=vl(),n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,s=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;wl.useSyncExternalStoreWithSelector=function(u,c,d,f,h){var m=s(null);if(m.current===null){var v={hasValue:!1,value:null};m.current=v}else v=m.current;m=a(function(){function w(N){if(!k){if(k=!0,E=N,N=f(N),h!==void 0&&v.hasValue){var D=v.value;if(h(D,N))return R=D}return R=N}if(D=R,n(E,N))return D;var B=f(N);return h!==void 0&&h(D,B)?(E=N,D):(E=N,R=B)}var k=!1,E,R,O=d===void 0?null:d;return[function(){return w(c())},O===null?void 0:function(){return w(O())}]},[c,d,f,h]);var y=i(u,m[0],m[1]);return o(function(){v.hasValue=!0,v.value=y},[y]),l(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),wl}var sf;function Y6(){return sf||(sf=1,process.env.NODE_ENV==="production"?Js.exports=G6():Js.exports=K6()),Js.exports}var J6=Y6(),X6=(...r)=>e=>{r.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},Z6=({contentComponent:r})=>{const e=Yh.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getServerSnapshot);return Z.jsx(Z.Fragment,{children:Object.values(e)})};function Q6(){const r=new Set;let e={};return{subscribe(t){return r.add(t),()=>{r.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,n){e={...e,[t]:Ui.createPortal(n.reactElement,n.element,t)},r.forEach(i=>i())},removeRenderer(t){const n={...e};delete n[t],e=n,r.forEach(i=>i())}}}var e7=class extends z.Component{constructor(r){var e;super(r),this.editorContentRef=z.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=r.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var r;const e=this.props.editor;if(e&&!e.isDestroyed&&((r=e.view.dom)!=null&&r.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Q6(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var r;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((r=e.view.dom)!=null&&r.parentNode))return;const t=document.createElement("div");t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){const{editor:r,innerRef:e,...t}=this.props;return Z.jsxs(Z.Fragment,{children:[Z.jsx("div",{ref:X6(e,this.editorContentRef),...t}),r?.contentComponent&&Z.jsx(Z6,{contentComponent:r.contentComponent})]})}},t7=z.forwardRef((r,e)=>{const t=z.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[r.editor]);return z.createElement(e7,{key:t,innerRef:e,...r})}),r7=z.memo(t7),n7=typeof window<"u"?z.useLayoutEffect:z.useEffect,i7=class{constructor(r){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=r,this.lastSnapshot={editor:r,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(r){return this.subscribers.add(r),()=>{this.subscribers.delete(r)}}watch(r){if(this.editor=r,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(n=>n())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function of(r){var e;const[t]=z.useState(()=>new i7(r.editor)),n=J6.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,r.selector,(e=r.equalityFn)!=null?e:U6);return n7(()=>t.watch(r.editor),[r.editor,t]),z.useDebugValue(n),n}var af=process.env.NODE_ENV!=="production",xl=typeof window>"u",s7=xl||!!(typeof window<"u"&&window.next),o7=class T1{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(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(xl||s7){if(af)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&xl&&af)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...n)},onBlur:(...n)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...n)},onCreate:(...n)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...n)},onDestroy:(...n)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...n)},onFocus:(...n)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...n)},onSelectionUpdate:(...n)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...n)},onTransaction:(...n)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...n)},onUpdate:(...n)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...n)},onContentError:(...n)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...n)},onDrop:(...n)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...n)},onPaste:(...n)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...n)},onDelete:(...n)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...n)}};return new N3(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?!1:e.extensions.every((i,s)=>{var o;return i===((o=t.extensions)==null?void 0:o[s])}):e[n]===t[n])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?T1.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{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((n,i)=>n===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const 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 a7(r={},e=[]){const t=z.useRef(r);t.current=r;const[n]=z.useState(()=>new o7(t)),i=Yh.useSyncExternalStore(n.subscribe,n.getEditor,n.getServerSnapshot);return z.useDebugValue(i),z.useEffect(n.onRender(e)),of({editor:i,selector:({transactionNumber:s})=>r.shouldRerenderOnTransaction===!1||r.shouldRerenderOnTransaction===void 0?null:r.immediatelyRender&&s===0?0:s+1}),i}var lf=z.createContext({editor:null});lf.Consumer;var uf=()=>z.useContext(lf),cf=z.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),df=()=>z.useContext(cf);function hf({as:r="div",...e}){const{nodeViewContentRef:t,nodeViewContentChildren:n}=df();return Z.jsx(r,{...e,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style},children:n})}var ff=z.forwardRef((r,e)=>{const{onDragStart:t}=df(),n=r.as||"div";return Z.jsx(n,{...r,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...r.style}})});function pf(r){return!!(typeof r=="function"&&r.prototype&&r.prototype.isReactComponent)}function mf(r){return!!(typeof r=="object"&&r.$$typeof&&(r.$$typeof.toString()==="Symbol(react.forward_ref)"||r.$$typeof.description==="react.forward_ref"))}function l7(r){return!!(typeof r=="object"&&r.$$typeof&&(r.$$typeof.toString()==="Symbol(react.memo)"||r.$$typeof.description==="react.memo"))}function u7(r){if(pf(r)||mf(r))return!0;if(l7(r)){const e=r.type;if(e)return pf(e)||mf(e)}return!1}function c7(){try{if(z.version)return parseInt(z.version.split(".")[0],10)>=19}catch{}return!1}var d7=class{constructor(r,{editor:e,props:t={},as:n="div",className:i=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=r,this.editor=e,this.props=t,this.element=document.createElement(n),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?Ui.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var r;const e=this.component,t=this.props,n=this.editor,i=c7(),s=u7(e),o={...t};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=a=>{this.ref=a}),this.reactElement=Z.jsx(e,{...o}),(r=n?.contentComponent)==null||r.setRenderer(this.id,this)}updateProps(r={}){this.props={...this.props,...r},this.render()}destroy(){var r;const e=this.editor;(r=e?.contentComponent)==null||r.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(r){Object.keys(r).forEach(e=>{this.element.setAttribute(e,r[e])})}};z.createContext({markViewContentRef:()=>{}});var h7=class extends F3{constructor(r,e,t){if(super(r,e,t),this.selectionRafId=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const n=this.dom.querySelector("[data-node-view-content]");if(!n)return;n.appendChild(this.contentDOMElement)}}mount(){const r={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:z.createRef()};if(!this.component.displayName){const l=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=l(this.extension.name)}const n={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},i=this.component,s=z.memo(l=>Z.jsx(cf.Provider,{value:n,children:z.createElement(i,l)}));s.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new d7(s,{editor:this.editor,props:r,as:o,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var r;if(this.renderer.element.firstElementChild&&!((r=this.renderer.element.firstElementChild)!=null&&r.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:r,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(r<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(r,e,t){const n=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(r.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=r,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:i,oldDecorations:s,newNode:r,newDecorations:e,oldInnerDecorations:o,innerDecorations:t,updateProps:()=>n({node:r,decorations:e,innerDecorations:t})})}return r===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=r,this.decorations=e,this.innerDecorations=t,n({node:r,decorations:e,innerDecorations:t})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let r={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,t=Ai(this.node,e);r=this.options.attrs({node:this.node,HTMLAttributes:t})}else r=this.options.attrs;this.renderer.updateAttributes(r)}}};function bn(r,e){return t=>t.editor.contentComponent?new h7(r,t,e):{}}var f7=Object.defineProperty,p7=(r,e)=>{for(var t in e)f7(r,t,{get:e[t],enumerable:!0})},m7="listItem",gf="textStyle",vf=/^\s*([-+*])\s$/,yf=Ce.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:r}){return["ul",be(this.options.HTMLAttributes,r),0]},markdownTokenName:"list",parseMarkdown:(r,e)=>r.type!=="list"||r.ordered?[]:{type:"bulletList",content:r.items?e.parseChildren(r.items):[]},renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
596
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(m7,this.editor.getAttributes(gf)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let r=mt({find:vf,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(r=mt({find:vf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(gf),editor:this.editor})),[r]}}),bf=Ce.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",be(this.options.HTMLAttributes,r),0]},markdownTokenName:"list_item",parseMarkdown:(r,e)=>{if(r.type!=="list_item")return[];let t=[];if(r.tokens&&r.tokens.length>0)if(r.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(r.tokens);else{const i=r.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],r.tokens.length>1){const o=r.tokens.slice(1),a=e.parseChildren(o);t.push(...a)}}else t=e.parseChildren(r.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(r,e,t)=>dl(r,e,n=>n.parentType==="bulletList"?"- ":n.parentType==="orderedList"?`${n.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),g7={};p7(g7,{findListItemPos:()=>Di,getNextListDepth:()=>Sl,handleBackspace:()=>kl,handleDelete:()=>Tl,hasListBefore:()=>wf,hasListItemAfter:()=>v7,hasListItemBefore:()=>xf,listItemHasSubList:()=>Sf,nextListIsDeeper:()=>kf,nextListIsHigher:()=>Tf});var Di=(r,e)=>{const{$from:t}=e.selection,n=_e(r,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===n?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Sl=(r,e)=>{const t=Di(r,e);if(!t)return!1;const[,n]=Vy(e,r,t.$pos.pos+4);return n},wf=(r,e,t)=>{const{$anchor:n}=r.selection,i=Math.max(0,n.pos-2),s=r.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},xf=(r,e)=>{var t;const{$anchor:n}=e.selection,i=e.doc.resolve(n.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==r)},Sf=(r,e,t)=>{if(!t)return!1;const n=_e(r,e.schema);let i=!1;return t.descendants(s=>{s.type===n&&(i=!0)}),i},kl=(r,e,t)=>{if(r.commands.undoInputRule())return!0;if(r.state.selection.from!==r.state.selection.to)return!1;if(!jr(r.state,e)&&wf(r.state,e,t)){const{$anchor:a}=r.state.selection,l=r.state.doc.resolve(a.before()-1),u=[];l.node().descendants((f,h)=>{f.type.name===e&&u.push({node:f,pos:h})});const c=u.at(-1);if(!c)return!1;const d=r.state.doc.resolve(l.start()+c.pos+1);return r.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!jr(r.state,e)||!Wy(r.state))return!1;const n=Di(e,r.state);if(!n)return!1;const s=r.state.doc.resolve(n.$pos.pos-2).node(n.depth),o=Sf(e,r.state,s);return xf(e,r.state)&&!o?r.commands.joinItemBackward():r.chain().liftListItem(e).run()},kf=(r,e)=>{const t=Sl(r,e),n=Di(r,e);return!n||!t?!1:t>n.depth},Tf=(r,e)=>{const t=Sl(r,e),n=Di(r,e);return!n||!t?!1:t<n.depth},Tl=(r,e)=>{if(!jr(r.state,e)||!_y(r.state,e))return!1;const{selection:t}=r.state,{$from:n,$to:i}=t;return!t.empty&&n.sameParent(i)?!1:kf(e,r.state)?r.chain().focus(r.state.selection.from+4).lift(e).joinBackward().run():Tf(e,r.state)?r.chain().joinForward().joinBackward().run():r.commands.joinItemForward()},v7=(r,e)=>{var t;const{$anchor:n}=e.selection,i=e.doc.resolve(n.pos-n.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==r)},y7=xe.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&Tl(r,t)&&(e=!0)}),e},"Mod-Delete":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&Tl(r,t)&&(e=!0)}),e},Backspace:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:n})=>{r.state.schema.nodes[t]!==void 0&&kl(r,t,n)&&(e=!0)}),e},"Mod-Backspace":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:n})=>{r.state.schema.nodes[t]!==void 0&&kl(r,t,n)&&(e=!0)}),e}}}}),Mf=/^(\s*)(\d+)\.\s+(.*)$/,b7=/^\s/;function w7(r){const e=[];let t=0,n=0;for(;t<r.length;){const i=r[t],s=i.match(Mf);if(!s)break;const[,o,a,l]=s,u=o.length;let c=l,d=t+1;const f=[i];for(;d<r.length;){const h=r[d];if(h.match(Mf))break;if(h.trim()==="")f.push(h),c+=`
595
+ `)}function B3(r,e,t={}){const{state:n}=e,{doc:i,tr:s}=n,o=r;i.descendants((a,l)=>{const u=s.mapping.map(l),c=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(t).forEach(h=>{t[h]!==d.attrs[h]&&(f=!0)}),f){const h=r.type.create({...r.attrs,...t});s.removeMark(u,c,r.type),s.addMark(u,c,h)}}),s.docChanged&&e.view.dispatch(s)}var Ce=class k1 extends ol{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new k1(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},F3=class{constructor(r,e,t){this.isDragging=!1,this.component=r,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(r){var e,t,n,i,s,o,a;const{view:l}=this.editor,u=r.target,c=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(u)||!c)return;let d=0,f=0;if(this.dom!==c){const k=this.dom.getBoundingClientRect(),E=c.getBoundingClientRect(),R=(i=r.offsetX)!=null?i:(n=r.nativeEvent)==null?void 0:n.offsetX,O=(o=r.offsetY)!=null?o:(s=r.nativeEvent)==null?void 0:s.offsetY;d=E.x-k.x+R,f=E.y-k.y+O}const h=this.dom.cloneNode(!0);try{const k=this.dom.getBoundingClientRect();h.style.width=`${Math.round(k.width)}px`,h.style.height=`${Math.round(k.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(h),document.body.appendChild(m),(a=r.dataTransfer)==null||a.setDragImage(h,d,f)}finally{m&&setTimeout(()=>{try{m?.remove()}catch{}},0)}const v=this.getPos();if(typeof v!="number")return;const y=ie.create(l.state.doc,v),w=l.state.tr.setSelection(y);l.dispatch(w)}stopEvent(r){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:r});const t=r.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const i=r.type.startsWith("drag"),s=r.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!s&&!i)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,u=!!this.node.type.spec.draggable,c=ie.isSelectable(this.node),d=r.type==="copy",f=r.type==="paste",h=r.type==="cut",m=r.type==="mousedown";if(!u&&c&&i&&r.target===this.dom&&r.preventDefault(),u&&i&&!l&&r.target===this.dom)return r.preventDefault(),!1;if(u&&a&&!l&&m){const v=t.closest("[data-drag-handle]");v&&(this.dom===v||this.dom.contains(v))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||s||d||f||h||m&&c)}ignoreMutation(r){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:r}):this.node.isLeaf||this.node.isAtom?!0:r.type==="selection"||this.dom.contains(r.target)&&r.type==="childList"&&(Rs()||ah())&&this.editor.isFocused&&[...Array.from(r.addedNodes),...Array.from(r.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===r.target&&r.type==="attributes"?!0:!this.contentDOM.contains(r.target)}updateAttributes(r){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...r}),!0)})}deleteNode(){const r=this.getPos();if(typeof r!="number")return;const e=r+this.node.nodeSize;this.editor.commands.deleteRange({from:r,to:e})}};function js(r){return new x3({find:r.find,handler:({state:e,range:t,match:n,pasteEvent:i})=>{const s=Me(r.getAttributes,void 0,n,i);if(s===!1||s===null)return null;const{tr:o}=e,a=n[n.length-1],l=n[0];let u=t.to;if(a){const c=l.search(/\S/),d=t.from+l.indexOf(a),f=d+a.length;if(wh(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===r.type&&y!==m.mark.type)).filter(m=>m.to>d).length)return null;f<t.to&&o.delete(f,t.to),d>t.from&&o.delete(t.from+c,d),u=t.from+c+a.length,o.addMark(t.from+c,u,r.type.create(s||{})),o.removeStoredMark(r.type)}}})}function $3(r={}){return new Be({view(e){return new H3(e,r)}})}class H3{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}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,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let m=h.getBoundingClientRect(),v=d?m.bottom:m.top;d&&f&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;n={left:m.left,right:m.right,top:v-y,bottom:v+y}}}}if(!n){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;n={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 u,c;if(!l||l==document.body&&getComputedStyle(l).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,h=d.height/l.offsetHeight;u=d.left-l.scrollLeft*f,c=d.top-l.scrollTop*h}this.element.style.left=(n.left-u)/o+"px",this.element.style.top=(n.top-c)/a+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/a+"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),i=n&&n.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=mc(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Fe extends le{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Fe.valid(n)?new Fe(n):le.near(n)}content(){return U.empty}eq(e){return e instanceof Fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Fe(e.resolve(t.pos))}getBookmark(){return new hl(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!V3(e)||!_3(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&Fe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(Fe.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!ie.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),n=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(Fe.valid(a))return a}return null}}}Fe.prototype.visible=!1,Fe.findFrom=Fe.findGapCursorFrom,le.jsonID("gapcursor",Fe);class hl{constructor(e){this.pos=e}map(e){return new hl(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Fe.valid(t)?new Fe(t):le.near(t)}}function Fh(r){return r.isAtom||r.spec.isolating||r.spec.createGapCursor}function V3(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||Fh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function _3(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||Fh(i.type))return!0;if(i.inlineContent)return!1}}return!0}function j3(){return new Be({props:{decorations:G3,createSelectionBetween(r,e,t){return e.pos==t.pos&&Fe.valid(t)?new Fe(t):null},handleClick:W3,handleKeyDown:q3,handleDOMEvents:{beforeinput:U3}}})}const q3=Wa({ArrowLeft:qs("horiz",-1),ArrowRight:qs("horiz",1),ArrowUp:qs("vert",-1),ArrowDown:qs("vert",1)});function qs(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,s){let o=n.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof de){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=n.doc.resolve(e>0?a.after():a.before())}let u=Fe.findGapCursorFrom(a,e,l);return u?(i&&i(n.tr.setSelection(new Fe(u))),!0):!1}}function W3(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!Fe.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&ie.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new Fe(n))),!0)}function U3(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof Fe))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=F.empty;for(let o=n.length-1;o>=0;o--)i=F.from(n[o].createAndFill(null,i));let s=r.state.tr.replace(t.pos,t.pos,new U(i,0,0));return s.setSelection(de.near(s.doc.resolve(t.pos+1))),r.dispatch(s),!1}function G3(r){if(!(r.selection instanceof Fe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Re.create(r.doc,[lt.widget(r.selection.head,e,{key:"gapcursor"})])}var Ws=200,Ze=function(){};Ze.prototype.append=function(e){return e.length?(e=Ze.from(e),!this.length&&e||e.length<Ws&&this.leafAppend(e)||this.length<Ws&&e.leafPrepend(this)||this.appendInner(e)):this},Ze.prototype.prepend=function(e){return e.length?Ze.from(e).append(this):this},Ze.prototype.appendInner=function(e){return new K3(this,e)},Ze.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ze.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ze.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ze.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)},Ze.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i},Ze.from=function(e){return e instanceof Ze?e:e&&e.length?new $h(e):Ze.empty};var $h=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ws)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ws)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ze);Ze.empty=new $h([]);var K3=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(n,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(n,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(n,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(n,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(Ze);const Y3=500;class $t{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,a,l,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(n,f+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new Kt(d.map));let h=d.step.map(i.slice(s)),m;h&&o.maybeStep(h).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new Kt(m,void 0,void 0,u.length+c.length))),s--,m&&i.appendMap(m,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new $t(this.items.slice(0,n).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,n,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new Kt(e.mapping.maps[c],d,t),h;(h=l&&l.merge(f))&&(f=h,c?s.pop():a=a.slice(0,a.length-1)),s.push(f),t&&(o++,t=void 0),i||(l=f)}let u=o-n.depth;return u>X3&&(a=J3(a,u),o-=u),new $t(a.append(s),o)}remapping(e,t){let n=new fi;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new $t(this.items.append(e.map(t=>new Kt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=t;this.items.forEach(f=>{let h=s.getMirror(--l);if(h==null)return;o=Math.min(o,h);let m=s.maps[h];if(f.step){let v=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(s.slice(l+1,h));y&&a++,n.push(new Kt(m,v,y))}else n.push(new Kt(m))},i);let u=[];for(let f=t;f<o;f++)u.push(new Kt(s.maps[f]));let c=this.items.slice(0,i).append(u).append(n),d=new $t(c,a);return d.emptyItemCount()>Y3&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(n)),u=l&&l.getMap();if(n--,u&&t.appendMap(u,n),l){let c=o.selection&&o.selection.map(t.slice(n));c&&s++;let d=new Kt(u.invert(),l,c),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&n--},this.items.length,0),new $t(Ze.from(i.reverse()),s)}}$t.empty=new $t(Ze.empty,0);function J3(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class Kt{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Kt(t.getMap().invert(),t,this.selection)}}}class qr{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const X3=20;function Z3(r,e,t,n){let i=t.getMeta(vn),s;if(i)return i.historyState;t.getMeta(t6)&&(r=new qr(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(vn))return o.getMeta(vn).redo?new qr(r.done.addTransform(t,void 0,n,Us(e)),r.undone,Hh(t.mapping.maps),r.prevTime,r.prevComposition):new qr(r.done,r.undone.addTransform(t,void 0,n,Us(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=r.prevTime==0||!o&&r.prevComposition!=a&&(r.prevTime<(t.time||0)-n.newGroupDelay||!Q3(t,r.prevRanges)),u=o?fl(r.prevRanges,t.mapping):Hh(t.mapping.maps);return new qr(r.done.addTransform(t,l?e.selection.getBookmark():void 0,n,Us(e)),$t.empty,u,t.time,a??r.prevComposition)}else return(s=t.getMeta("rebased"))?new qr(r.done.rebased(t,s),r.undone.rebased(t,s),fl(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new qr(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),fl(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function Q3(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Hh(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function fl(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function e6(r,e,t){let n=Us(e),i=vn.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),l=new qr(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(vn,{redo:t,historyState:l})}let pl=!1,Vh=null;function Us(r){let e=r.plugins;if(Vh!=e){pl=!1,Vh=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){pl=!0;break}}return pl}const vn=new Ve("history"),t6=new Ve("closeHistory");function r6(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new Be({key:vn,state:{init(){return new qr($t.empty,$t.empty,null,0,-1)},apply(e,t,n){return Z3(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?jh:n=="historyRedo"?qh:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function _h(r,e){return(t,n)=>{let i=vn.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=e6(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const jh=_h(!1,!0),qh=_h(!0,!0);xe.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:r=>r.length,wordCounter:r=>r.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=r=>{const e=r?.node||this.editor.state.doc;if((r?.mode||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=r=>{const e=r?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let r=!1;return[new Be({key:new Ve("characterCount"),appendTransaction:(e,t,n)=>{if(r)return;const i=this.options.limit;if(i==null||i===0){r=!0;return}const s=this.storage.characters({node:n.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const u=n.tr.deleteRange(a,l);return r=!0,u}r=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=n||i>n&&s>n&&s<=i)return!0;if(i>n&&s>n&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-n,u=a-l,c=a;return e.deleteRange(u,c),!(this.storage.characters({node:e.doc})>n)}})]}}),xe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[$3(this.options)]}});var n6=xe.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Be({key:new Ve("focus"),props:{decorations:({doc:r,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:i}=e,s=[];if(!t||!n)return Re.create(r,[]);let o=0;this.options.mode==="deepest"&&r.descendants((l,u)=>{if(l.isText)return;if(!(i>=u&&i<=u+l.nodeSize-1))return!1;o+=1});let a=0;return r.descendants((l,u)=>{if(l.isText||!(i>=u&&i<=u+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(lt.node(u,u+l.nodeSize,{class:this.options.className}))}),Re.create(r,s)}}})]}}),i6=xe.create({name:"gapCursor",addProseMirrorPlugins(){return[j3()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=Me(se(r,"allowGapCursor",t)))!=null?e:null}}});xe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Be({key:new Ve("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return r.descendants((o,a)=>{const l=n>=a&&n<=a+o.nodeSize,u=!o.isLeaf&&Fs(o);if((l||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];s&&c.push(this.options.emptyEditorClass);const d=lt.node(a,a+o.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),Re.create(r,i)}}})]}}),xe.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:r,options:e}=this;return[new Be({key:new Ve("selection"),props:{decorations(t){return t.selection.empty||r.isFocused||!r.isEditable||Uy(t.selection)||r.view.dragging?null:Re.create(t.doc,[lt.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Wh({types:r,node:e}){return e&&Array.isArray(r)&&r.includes(e.type)||e?.type===r}xe.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var r;const e=new Ve(this.name),t=this.options.node||((r=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:r.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new Be({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:u}=o,c=e.getState(o),d=a.content.size,f=u.nodes[t];if(c)return l.insert(d,f.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!Wh({node:o,types:n})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!Wh({node:o,types:n})}}})]}});var s6=xe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>jh(r,e),redo:()=>({state:r,dispatch:e})=>qh(r,e)}},addProseMirrorPlugins(){return[r6(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()}}}),Gs={exports:{}},ml={};var Uh;function o6(){if(Uh)return ml;Uh=1;var r=z;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var t=typeof Object.is=="function"?Object.is:e,n=r.useState,i=r.useEffect,s=r.useLayoutEffect,o=r.useDebugValue;function a(d,f){var h=f(),m=n({inst:{value:h,getSnapshot:f}}),v=m[0].inst,y=m[1];return s(function(){v.value=h,v.getSnapshot=f,l(v)&&y({inst:v})},[d,h,f]),i(function(){return l(v)&&y({inst:v}),d(function(){l(v)&&y({inst:v})})},[d]),o(h),h}function l(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!t(d,h)}catch{return!0}}function u(d,f){return f()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return ml.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:c,ml}var gl={};var Gh;function a6(){return Gh||(Gh=1,process.env.NODE_ENV!=="production"&&(function(){function r(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}function e(h,m){c||i.startTransition===void 0||(c=!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 v=m();if(!d){var y=m();s(v,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}y=o({inst:{value:v,getSnapshot:m}});var w=y[0].inst,k=y[1];return l(function(){w.value=v,w.getSnapshot=m,t(w)&&k({inst:w})},[h,v,m]),a(function(){return t(w)&&k({inst:w}),h(function(){t(w)&&k({inst:w})})},[h]),u(v),v}function t(h){var m=h.getSnapshot;h=h.value;try{var v=m();return!s(h,v)}catch{return!0}}function n(h,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=z,s=typeof Object.is=="function"?Object.is:r,o=i.useState,a=i.useEffect,l=i.useLayoutEffect,u=i.useDebugValue,c=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n:e;gl.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),gl}var Kh;function vl(){return Kh||(Kh=1,process.env.NODE_ENV==="production"?Gs.exports=o6():Gs.exports=a6()),Gs.exports}var Yh=vl();const{getOwnPropertyNames:l6,getOwnPropertySymbols:u6}=Object,{hasOwnProperty:c6}=Object.prototype;function yl(r,e){return function(n,i,s){return r(n,i,s)&&e(n,i,s)}}function Ks(r){return function(t,n,i){if(!t||!n||typeof t!="object"||typeof n!="object")return r(t,n,i);const{cache:s}=i,o=s.get(t),a=s.get(n);if(o&&a)return o===n&&a===t;s.set(t,n),s.set(n,t);const l=r(t,n,i);return s.delete(t),s.delete(n),l}}function d6(r){return r?.[Symbol.toStringTag]}function Jh(r){return l6(r).concat(u6(r))}const h6=Object.hasOwn||((r,e)=>c6.call(r,e));function yn(r,e){return r===e||!r&&!e&&r!==r&&e!==e}const f6="__v",p6="__o",m6="_owner",{getOwnPropertyDescriptor:Xh,keys:Zh}=Object;function g6(r,e){return r.byteLength===e.byteLength&&Ys(new Uint8Array(r),new Uint8Array(e))}function v6(r,e,t){let n=r.length;if(e.length!==n)return!1;for(;n-- >0;)if(!t.equals(r[n],e[n],n,n,r,e,t))return!1;return!0}function y6(r,e){return r.byteLength===e.byteLength&&Ys(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function b6(r,e){return yn(r.getTime(),e.getTime())}function w6(r,e){return r.name===e.name&&r.message===e.message&&r.cause===e.cause&&r.stack===e.stack}function x6(r,e){return r===e}function Qh(r,e,t){const n=r.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),s=r.entries();let o,a,l=0;for(;(o=s.next())&&!o.done;){const u=e.entries();let c=!1,d=0;for(;(a=u.next())&&!a.done;){if(i[d]){d++;continue}const f=o.value,h=a.value;if(t.equals(f[0],h[0],l,d,r,e,t)&&t.equals(f[1],h[1],f[0],h[0],r,e,t)){c=i[d]=!0;break}d++}if(!c)return!1;l++}return!0}const S6=yn;function k6(r,e,t){const n=Zh(r);let i=n.length;if(Zh(e).length!==i)return!1;for(;i-- >0;)if(!tf(r,e,t,n[i]))return!1;return!0}function Ni(r,e,t){const n=Jh(r);let i=n.length;if(Jh(e).length!==i)return!1;let s,o,a;for(;i-- >0;)if(s=n[i],!tf(r,e,t,s)||(o=Xh(r,s),a=Xh(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function T6(r,e){return yn(r.valueOf(),e.valueOf())}function M6(r,e){return r.source===e.source&&r.flags===e.flags}function ef(r,e,t){const n=r.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),s=r.values();let o,a;for(;(o=s.next())&&!o.done;){const l=e.values();let u=!1,c=0;for(;(a=l.next())&&!a.done;){if(!i[c]&&t.equals(o.value,a.value,o.value,a.value,r,e,t)){u=i[c]=!0;break}c++}if(!u)return!1}return!0}function Ys(r,e){let t=r.byteLength;if(e.byteLength!==t||r.byteOffset!==e.byteOffset)return!1;for(;t-- >0;)if(r[t]!==e[t])return!1;return!0}function C6(r,e){return r.hostname===e.hostname&&r.pathname===e.pathname&&r.protocol===e.protocol&&r.port===e.port&&r.hash===e.hash&&r.username===e.username&&r.password===e.password}function tf(r,e,t,n){return(n===m6||n===p6||n===f6)&&(r.$$typeof||e.$$typeof)?!0:h6(e,n)&&t.equals(r[n],e[n],n,n,r,e,t)}const E6="[object ArrayBuffer]",A6="[object Arguments]",O6="[object Boolean]",N6="[object DataView]",D6="[object Date]",I6="[object Error]",R6="[object Map]",P6="[object Number]",z6="[object Object]",L6="[object RegExp]",B6="[object Set]",F6="[object String]",$6={"[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},H6="[object URL]",V6=Object.prototype.toString;function _6({areArrayBuffersEqual:r,areArraysEqual:e,areDataViewsEqual:t,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:m}){return function(y,w,k){if(y===w)return!0;if(y==null||w==null)return!1;const E=typeof y;if(E!==typeof w)return!1;if(E!=="object")return E==="number"?a(y,w,k):E==="function"?s(y,w,k):!1;const R=y.constructor;if(R!==w.constructor)return!1;if(R===Object)return l(y,w,k);if(Array.isArray(y))return e(y,w,k);if(R===Date)return n(y,w,k);if(R===RegExp)return c(y,w,k);if(R===Map)return o(y,w,k);if(R===Set)return d(y,w,k);const O=V6.call(y);if(O===D6)return n(y,w,k);if(O===L6)return c(y,w,k);if(O===R6)return o(y,w,k);if(O===B6)return d(y,w,k);if(O===z6)return typeof y.then!="function"&&typeof w.then!="function"&&l(y,w,k);if(O===H6)return h(y,w,k);if(O===I6)return i(y,w,k);if(O===A6)return l(y,w,k);if($6[O])return f(y,w,k);if(O===E6)return r(y,w,k);if(O===N6)return t(y,w,k);if(O===O6||O===P6||O===F6)return u(y,w,k);if(m){let N=m[O];if(!N){const D=d6(y);D&&(N=m[D])}if(N)return N(y,w,k)}return!1}}function j6({circular:r,createCustomConfig:e,strict:t}){let n={areArrayBuffersEqual:g6,areArraysEqual:t?Ni:v6,areDataViewsEqual:y6,areDatesEqual:b6,areErrorsEqual:w6,areFunctionsEqual:x6,areMapsEqual:t?yl(Qh,Ni):Qh,areNumbersEqual:S6,areObjectsEqual:t?Ni:k6,arePrimitiveWrappersEqual:T6,areRegExpsEqual:M6,areSetsEqual:t?yl(ef,Ni):ef,areTypedArraysEqual:t?yl(Ys,Ni):Ys,areUrlsEqual:C6,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),r){const i=Ks(n.areArraysEqual),s=Ks(n.areMapsEqual),o=Ks(n.areObjectsEqual),a=Ks(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:a})}return n}function q6(r){return function(e,t,n,i,s,o,a){return r(e,t,a)}}function W6({circular:r,comparator:e,createState:t,equals:n,strict:i}){if(t)return function(a,l){const{cache:u=r?new WeakMap:void 0,meta:c}=t();return e(a,l,{cache:u,equals:n,meta:c,strict:i})};if(r)return function(a,l){return e(a,l,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};const s={cache:void 0,equals:n,meta:void 0,strict:i};return function(a,l){return e(a,l,s)}}const U6=Wr();Wr({strict:!0}),Wr({circular:!0}),Wr({circular:!0,strict:!0}),Wr({createInternalComparator:()=>yn}),Wr({strict:!0,createInternalComparator:()=>yn}),Wr({circular:!0,createInternalComparator:()=>yn}),Wr({circular:!0,createInternalComparator:()=>yn,strict:!0});function Wr(r={}){const{circular:e=!1,createInternalComparator:t,createState:n,strict:i=!1}=r,s=j6(r),o=_6(s),a=t?t(o):q6(o);return W6({circular:e,comparator:o,createState:n,equals:a,strict:i})}var Js={exports:{}},bl={};var rf;function G6(){if(rf)return bl;rf=1;var r=z,e=vl();function t(u,c){return u===c&&(u!==0||1/u===1/c)||u!==u&&c!==c}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,s=r.useRef,o=r.useEffect,a=r.useMemo,l=r.useDebugValue;return bl.useSyncExternalStoreWithSelector=function(u,c,d,f,h){var m=s(null);if(m.current===null){var v={hasValue:!1,value:null};m.current=v}else v=m.current;m=a(function(){function w(N){if(!k){if(k=!0,E=N,N=f(N),h!==void 0&&v.hasValue){var D=v.value;if(h(D,N))return R=D}return R=N}if(D=R,n(E,N))return D;var B=f(N);return h!==void 0&&h(D,B)?(E=N,D):(E=N,R=B)}var k=!1,E,R,O=d===void 0?null:d;return[function(){return w(c())},O===null?void 0:function(){return w(O())}]},[c,d,f,h]);var y=i(u,m[0],m[1]);return o(function(){v.hasValue=!0,v.value=y},[y]),l(y),y},bl}var wl={};var nf;function K6(){return nf||(nf=1,process.env.NODE_ENV!=="production"&&(function(){function r(u,c){return u===c&&(u!==0||1/u===1/c)||u!==u&&c!==c}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=z,t=vl(),n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,s=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;wl.useSyncExternalStoreWithSelector=function(u,c,d,f,h){var m=s(null);if(m.current===null){var v={hasValue:!1,value:null};m.current=v}else v=m.current;m=a(function(){function w(N){if(!k){if(k=!0,E=N,N=f(N),h!==void 0&&v.hasValue){var D=v.value;if(h(D,N))return R=D}return R=N}if(D=R,n(E,N))return D;var B=f(N);return h!==void 0&&h(D,B)?(E=N,D):(E=N,R=B)}var k=!1,E,R,O=d===void 0?null:d;return[function(){return w(c())},O===null?void 0:function(){return w(O())}]},[c,d,f,h]);var y=i(u,m[0],m[1]);return o(function(){v.hasValue=!0,v.value=y},[y]),l(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),wl}var sf;function Y6(){return sf||(sf=1,process.env.NODE_ENV==="production"?Js.exports=G6():Js.exports=K6()),Js.exports}var J6=Y6(),X6=(...r)=>e=>{r.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},Z6=({contentComponent:r})=>{const e=Yh.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getServerSnapshot);return J.jsx(J.Fragment,{children:Object.values(e)})};function Q6(){const r=new Set;let e={};return{subscribe(t){return r.add(t),()=>{r.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,n){e={...e,[t]:Ui.createPortal(n.reactElement,n.element,t)},r.forEach(i=>i())},removeRenderer(t){const n={...e};delete n[t],e=n,r.forEach(i=>i())}}}var e7=class extends z.Component{constructor(r){var e;super(r),this.editorContentRef=z.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=r.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var r;const e=this.props.editor;if(e&&!e.isDestroyed&&((r=e.view.dom)!=null&&r.parentNode)){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Q6(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var r;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((r=e.view.dom)!=null&&r.parentNode))return;const t=document.createElement("div");t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){const{editor:r,innerRef:e,...t}=this.props;return J.jsxs(J.Fragment,{children:[J.jsx("div",{ref:X6(e,this.editorContentRef),...t}),r?.contentComponent&&J.jsx(Z6,{contentComponent:r.contentComponent})]})}},t7=z.forwardRef((r,e)=>{const t=z.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[r.editor]);return z.createElement(e7,{key:t,innerRef:e,...r})}),r7=z.memo(t7),n7=typeof window<"u"?z.useLayoutEffect:z.useEffect,i7=class{constructor(r){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=r,this.lastSnapshot={editor:r,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(r){return this.subscribers.add(r),()=>{this.subscribers.delete(r)}}watch(r){if(this.editor=r,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(n=>n())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};function of(r){var e;const[t]=z.useState(()=>new i7(r.editor)),n=J6.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,r.selector,(e=r.equalityFn)!=null?e:U6);return n7(()=>t.watch(r.editor),[r.editor,t]),z.useDebugValue(n),n}var af=process.env.NODE_ENV!=="production",xl=typeof window>"u",s7=xl||!!(typeof window<"u"&&window.next),o7=class T1{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(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0){if(xl||s7){if(af)throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");return null}return this.createEditor()}if(this.options.current.immediatelyRender&&xl&&af)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)==null?void 0:s.call(i,...n)},onBlur:(...n)=>{var i,s;return(s=(i=this.options.current).onBlur)==null?void 0:s.call(i,...n)},onCreate:(...n)=>{var i,s;return(s=(i=this.options.current).onCreate)==null?void 0:s.call(i,...n)},onDestroy:(...n)=>{var i,s;return(s=(i=this.options.current).onDestroy)==null?void 0:s.call(i,...n)},onFocus:(...n)=>{var i,s;return(s=(i=this.options.current).onFocus)==null?void 0:s.call(i,...n)},onSelectionUpdate:(...n)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)==null?void 0:s.call(i,...n)},onTransaction:(...n)=>{var i,s;return(s=(i=this.options.current).onTransaction)==null?void 0:s.call(i,...n)},onUpdate:(...n)=>{var i,s;return(s=(i=this.options.current).onUpdate)==null?void 0:s.call(i,...n)},onContentError:(...n)=>{var i,s;return(s=(i=this.options.current).onContentError)==null?void 0:s.call(i,...n)},onDrop:(...n)=>{var i,s;return(s=(i=this.options.current).onDrop)==null?void 0:s.call(i,...n)},onPaste:(...n)=>{var i,s;return(s=(i=this.options.current).onPaste)==null?void 0:s.call(i,...n)},onDelete:(...n)=>{var i,s;return(s=(i=this.options.current).onDelete)==null?void 0:s.call(i,...n)}};return new N3(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?!1:e.extensions.every((i,s)=>{var o;return i===((o=t.extensions)==null?void 0:o[s])}):e[n]===t[n])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?T1.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{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((n,i)=>n===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const 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 a7(r={},e=[]){const t=z.useRef(r);t.current=r;const[n]=z.useState(()=>new o7(t)),i=Yh.useSyncExternalStore(n.subscribe,n.getEditor,n.getServerSnapshot);return z.useDebugValue(i),z.useEffect(n.onRender(e)),of({editor:i,selector:({transactionNumber:s})=>r.shouldRerenderOnTransaction===!1||r.shouldRerenderOnTransaction===void 0?null:r.immediatelyRender&&s===0?0:s+1}),i}var lf=z.createContext({editor:null});lf.Consumer;var uf=()=>z.useContext(lf),cf=z.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),df=()=>z.useContext(cf);function hf({as:r="div",...e}){const{nodeViewContentRef:t,nodeViewContentChildren:n}=df();return J.jsx(r,{...e,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style},children:n})}var ff=z.forwardRef((r,e)=>{const{onDragStart:t}=df(),n=r.as||"div";return J.jsx(n,{...r,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...r.style}})});function pf(r){return!!(typeof r=="function"&&r.prototype&&r.prototype.isReactComponent)}function mf(r){return!!(typeof r=="object"&&r.$$typeof&&(r.$$typeof.toString()==="Symbol(react.forward_ref)"||r.$$typeof.description==="react.forward_ref"))}function l7(r){return!!(typeof r=="object"&&r.$$typeof&&(r.$$typeof.toString()==="Symbol(react.memo)"||r.$$typeof.description==="react.memo"))}function u7(r){if(pf(r)||mf(r))return!0;if(l7(r)){const e=r.type;if(e)return pf(e)||mf(e)}return!1}function c7(){try{if(z.version)return parseInt(z.version.split(".")[0],10)>=19}catch{}return!1}var d7=class{constructor(r,{editor:e,props:t={},as:n="div",className:i=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=r,this.editor=e,this.props=t,this.element=document.createElement(n),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?Ui.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var r;const e=this.component,t=this.props,n=this.editor,i=c7(),s=u7(e),o={...t};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=a=>{this.ref=a}),this.reactElement=J.jsx(e,{...o}),(r=n?.contentComponent)==null||r.setRenderer(this.id,this)}updateProps(r={}){this.props={...this.props,...r},this.render()}destroy(){var r;const e=this.editor;(r=e?.contentComponent)==null||r.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(r){Object.keys(r).forEach(e=>{this.element.setAttribute(e,r[e])})}};z.createContext({markViewContentRef:()=>{}});var h7=class extends F3{constructor(r,e,t){if(super(r,e,t),this.selectionRafId=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const n=this.dom.querySelector("[data-node-view-content]");if(!n)return;n.appendChild(this.contentDOMElement)}}mount(){const r={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:z.createRef()};if(!this.component.displayName){const l=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=l(this.extension.name)}const n={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},i=this.component,s=z.memo(l=>J.jsx(cf.Provider,{value:n,children:z.createElement(i,l)}));s.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new d7(s,{editor:this.editor,props:r,as:o,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var r;if(this.renderer.element.firstElementChild&&!((r=this.renderer.element.firstElementChild)!=null&&r.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:r,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(r<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(r,e,t){const n=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(r.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,o=this.innerDecorations;return this.node=r,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:i,oldDecorations:s,newNode:r,newDecorations:e,oldInnerDecorations:o,innerDecorations:t,updateProps:()=>n({node:r,decorations:e,innerDecorations:t})})}return r===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=r,this.decorations=e,this.innerDecorations=t,n({node:r,decorations:e,innerDecorations:t})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let r={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,t=Ai(this.node,e);r=this.options.attrs({node:this.node,HTMLAttributes:t})}else r=this.options.attrs;this.renderer.updateAttributes(r)}}};function bn(r,e){return t=>t.editor.contentComponent?new h7(r,t,e):{}}var f7=Object.defineProperty,p7=(r,e)=>{for(var t in e)f7(r,t,{get:e[t],enumerable:!0})},m7="listItem",gf="textStyle",vf=/^\s*([-+*])\s$/,yf=Ce.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:r}){return["ul",be(this.options.HTMLAttributes,r),0]},markdownTokenName:"list",parseMarkdown:(r,e)=>r.type!=="list"||r.ordered?[]:{type:"bulletList",content:r.items?e.parseChildren(r.items):[]},renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
596
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(m7,this.editor.getAttributes(gf)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let r=mt({find:vf,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(r=mt({find:vf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(gf),editor:this.editor})),[r]}}),bf=Ce.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",be(this.options.HTMLAttributes,r),0]},markdownTokenName:"list_item",parseMarkdown:(r,e)=>{if(r.type!=="list_item")return[];let t=[];if(r.tokens&&r.tokens.length>0)if(r.tokens.some(i=>i.type==="paragraph"))t=e.parseChildren(r.tokens);else{const i=r.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(i.tokens)}],r.tokens.length>1){const o=r.tokens.slice(1),a=e.parseChildren(o);t.push(...a)}}else t=e.parseChildren(r.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(r,e,t)=>dl(r,e,n=>n.parentType==="bulletList"?"- ":n.parentType==="orderedList"?`${n.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),g7={};p7(g7,{findListItemPos:()=>Di,getNextListDepth:()=>Sl,handleBackspace:()=>kl,handleDelete:()=>Tl,hasListBefore:()=>wf,hasListItemAfter:()=>v7,hasListItemBefore:()=>xf,listItemHasSubList:()=>Sf,nextListIsDeeper:()=>kf,nextListIsHigher:()=>Tf});var Di=(r,e)=>{const{$from:t}=e.selection,n=qe(r,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===n?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Sl=(r,e)=>{const t=Di(r,e);if(!t)return!1;const[,n]=Vy(e,r,t.$pos.pos+4);return n},wf=(r,e,t)=>{const{$anchor:n}=r.selection,i=Math.max(0,n.pos-2),s=r.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},xf=(r,e)=>{var t;const{$anchor:n}=e.selection,i=e.doc.resolve(n.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==r)},Sf=(r,e,t)=>{if(!t)return!1;const n=qe(r,e.schema);let i=!1;return t.descendants(s=>{s.type===n&&(i=!0)}),i},kl=(r,e,t)=>{if(r.commands.undoInputRule())return!0;if(r.state.selection.from!==r.state.selection.to)return!1;if(!_r(r.state,e)&&wf(r.state,e,t)){const{$anchor:a}=r.state.selection,l=r.state.doc.resolve(a.before()-1),u=[];l.node().descendants((f,h)=>{f.type.name===e&&u.push({node:f,pos:h})});const c=u.at(-1);if(!c)return!1;const d=r.state.doc.resolve(l.start()+c.pos+1);return r.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!_r(r.state,e)||!Wy(r.state))return!1;const n=Di(e,r.state);if(!n)return!1;const s=r.state.doc.resolve(n.$pos.pos-2).node(n.depth),o=Sf(e,r.state,s);return xf(e,r.state)&&!o?r.commands.joinItemBackward():r.chain().liftListItem(e).run()},kf=(r,e)=>{const t=Sl(r,e),n=Di(r,e);return!n||!t?!1:t>n.depth},Tf=(r,e)=>{const t=Sl(r,e),n=Di(r,e);return!n||!t?!1:t<n.depth},Tl=(r,e)=>{if(!_r(r.state,e)||!qy(r.state,e))return!1;const{selection:t}=r.state,{$from:n,$to:i}=t;return!t.empty&&n.sameParent(i)?!1:kf(e,r.state)?r.chain().focus(r.state.selection.from+4).lift(e).joinBackward().run():Tf(e,r.state)?r.chain().joinForward().joinBackward().run():r.commands.joinItemForward()},v7=(r,e)=>{var t;const{$anchor:n}=e.selection,i=e.doc.resolve(n.pos-n.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==r)},y7=xe.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&Tl(r,t)&&(e=!0)}),e},"Mod-Delete":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{r.state.schema.nodes[t]!==void 0&&Tl(r,t)&&(e=!0)}),e},Backspace:({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:n})=>{r.state.schema.nodes[t]!==void 0&&kl(r,t,n)&&(e=!0)}),e},"Mod-Backspace":({editor:r})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:n})=>{r.state.schema.nodes[t]!==void 0&&kl(r,t,n)&&(e=!0)}),e}}}}),Mf=/^(\s*)(\d+)\.\s+(.*)$/,b7=/^\s/;function w7(r){const e=[];let t=0,n=0;for(;t<r.length;){const i=r[t],s=i.match(Mf);if(!s)break;const[,o,a,l]=s,u=o.length;let c=l,d=t+1;const f=[i];for(;d<r.length;){const h=r[d];if(h.match(Mf))break;if(h.trim()==="")f.push(h),c+=`
597
597
  `,d+=1;else if(h.match(b7))f.push(h),c+=`
598
598
  ${h.slice(u+2)}`,d+=1;else break}e.push({indent:u,number:parseInt(a,10),content:c.trim(),raw:f.join(`
599
599
  `)}),n=d,t=d}return[e,n]}function Cf(r,e,t){var n;const i=[];let s=0;for(;s<r.length;){const o=r[s];if(o.indent===e){const a=o.content.split(`
@@ -603,7 +603,7 @@ ${h.slice(u+2)}`,d+=1;else break}e.push({indent:u,number:parseInt(a,10),content:
603
603
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:r=>{const e=r.match(/^(\s*)(\d+)\.\s+/),t=e?.index;return t!==void 0?t:-1},tokenize:(r,e,t)=>{var n;const i=r.split(`
604
604
  `),[s,o]=w7(i);if(s.length===0)return;const a=Cf(s,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((n=s[0])==null?void 0:n.number)||1,items:a,raw:i.slice(0,o).join(`
605
605
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(S7,this.editor.getAttributes(Ef)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let r=mt({find:Af,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)&&(r=mt({find:Af,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ef)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[r]}}),k7=/^\s*(\[([( |x])?\])\s$/,T7=Ce.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:r=>{const e=r.getAttribute("data-checked");return e===""||e==="true"},renderHTML:r=>({"data-checked":r.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:r,HTMLAttributes:e}){return["li",be(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:r.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(r,e)=>{const t=[];if(r.tokens&&r.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(r.tokens))):r.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:r.text})])):t.push(e.createNode("paragraph",{},[])),r.nestedTokens&&r.nestedTokens.length>0){const n=e.parseChildren(r.nestedTokens);t.push(...n)}return e.createNode("taskItem",{checked:r.checked||!1},t)},renderMarkdown:(r,e)=>{var t;const i=`- [${(t=r.attrs)!=null&&t.checked?"x":" "}] `;return dl(r,e,i)},addKeyboardShortcuts(){const r={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...r,Tab:()=>this.editor.commands.sinkListItem(this.name)}:r},addNodeView(){return({node:r,HTMLAttributes:e,getPos:t,editor:n})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=c=>{var d,f;a.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,c,a.checked))||`Task item checkbox for ${c.textContent||"empty task item"}`};return u(r),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",c=>c.preventDefault()),a.addEventListener("change",c=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:d}=c.target;n.isEditable&&typeof t=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=t();if(typeof h!="number")return!1;const m=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...m?.attrs,checked:d}),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(r,d)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,d])=>{i.setAttribute(c,d)}),i.dataset.checked=r.attrs.checked,a.checked=r.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([c,d])=>{i.setAttribute(c,d)}),{dom:i,contentDOM:l,update:c=>c.type!==this.type?!1:(i.dataset.checked=c.attrs.checked,a.checked=c.attrs.checked,u(c),!0)}}},addInputRules(){return[mt({find:k7,type:this.type,getAttributes:r=>({checked:r[r.length-1]==="x"})})]}}),M7=Ce.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:r}){return["ul",be(this.options.HTMLAttributes,r,{"data-type":this.name}),0]},parseMarkdown:(r,e)=>e.createNode("taskList",{},e.parseChildren(r.items||[])),renderMarkdown:(r,e)=>r.content?e.renderChildren(r.content,`
606
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(r){var e;const t=(e=r.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(r,e,t){const n=s=>{const o=cl(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:n},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},i=cl(r,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:n},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:r})=>r.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});xe.create({name:"listKit",addExtensions(){const r=[];return this.options.bulletList!==!1&&r.push(yf.configure(this.options.bulletList)),this.options.listItem!==!1&&r.push(bf.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(y7.configure(this.options.listKeymap)),this.options.orderedList!==!1&&r.push(Of.configure(this.options.orderedList)),this.options.taskItem!==!1&&r.push(T7.configure(this.options.taskItem)),this.options.taskList!==!1&&r.push(M7.configure(this.options.taskList)),r}});class gt{constructor(e,t,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=n}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new gt(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class Tt{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new Tt(t,gt.range(this,e))}}class j{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n="KaTeX parse error: "+e,i,s,o=t&&t.loc;if(o&&o.start<=o.end){var a=o.lexer.input;i=o.start,s=o.end,i===a.length?n+=" at end of input: ":n+=" at position "+(i+1)+": ";var l=a.slice(i,s).replace(/[^]/g,"$&̲"),u;i>15?u="…"+a.slice(i-15,i):u=a.slice(0,i);var c;s+15<a.length?c=a.slice(s,s+15)+"…":c=a.slice(s),n+=u+l+c}var d=new Error(n);return d.name="ParseError",d.__proto__=j.prototype,d.position=i,i!=null&&s!=null&&(d.length=s-i),d.rawMessage=e,d}}j.prototype.__proto__=Error.prototype;var C7=function(e,t){return e===void 0?t:e},E7=/([A-Z])/g,A7=function(e){return e.replace(E7,"-$1").toLowerCase()},O7={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},N7=/[&><"']/g;function D7(r){return String(r).replace(N7,e=>O7[e])}var Nf=function r(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?r(e.body[0]):e:e.type==="font"?r(e.body):e},I7=function(e){var t=Nf(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},R7=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},P7=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},ye={deflt:C7,escape:D7,hyphenate:A7,getBaseElem:Nf,isCharacterBox:I7,protocolFromUrl:P7},Xs={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function z7(r){if(r.default)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class Ml{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var t in Xs)if(Xs.hasOwnProperty(t)){var n=Xs[t];this[t]=e[t]!==void 0?n.processor?n.processor(e[t]):e[t]:z7(n)}}reportNonstrict(e,t,n){var i=this.strict;if(typeof i=="function"&&(i=i(e,t,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new j("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,n){var i=this.strict;if(typeof i=="function")try{i=i(e,t,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var t=ye.protocolFromUrl(e.url);if(t==null)return!1;e.protocol=t}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class Ur{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return Yt[L7[this.id]]}sub(){return Yt[B7[this.id]]}fracNum(){return Yt[F7[this.id]]}fracDen(){return Yt[$7[this.id]]}cramp(){return Yt[H7[this.id]]}text(){return Yt[V7[this.id]]}isTight(){return this.size>=2}}var Cl=0,Zs=1,Fn=2,pr=3,Ii=4,Pt=5,$n=6,ut=7,Yt=[new Ur(Cl,0,!1),new Ur(Zs,0,!0),new Ur(Fn,1,!1),new Ur(pr,1,!0),new Ur(Ii,2,!1),new Ur(Pt,2,!0),new Ur($n,3,!1),new Ur(ut,3,!0)],L7=[Ii,Pt,Ii,Pt,$n,ut,$n,ut],B7=[Pt,Pt,Pt,Pt,ut,ut,ut,ut],F7=[Fn,pr,Ii,Pt,$n,ut,$n,ut],$7=[pr,pr,Pt,Pt,ut,ut,ut,ut],H7=[Zs,Zs,pr,pr,Pt,Pt,ut,ut],V7=[Cl,Zs,Fn,pr,Fn,pr,Fn,pr],oe={DISPLAY:Yt[Cl],TEXT:Yt[Fn],SCRIPT:Yt[Ii],SCRIPTSCRIPT:Yt[$n]},El=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function j7(r){for(var e=0;e<El.length;e++)for(var t=El[e],n=0;n<t.blocks.length;n++){var i=t.blocks[n];if(r>=i[0]&&r<=i[1])return t.name}return null}var Qs=[];El.forEach(r=>r.blocks.forEach(e=>Qs.push(...e)));function Df(r){for(var e=0;e<Qs.length;e+=2)if(r>=Qs[e]&&r<=Qs[e+1])return!0;return!1}var Hn=80,q7=function(e,t){return"M95,"+(622+e+t)+`
606
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(r){var e;const t=(e=r.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(r,e,t){const n=s=>{const o=cl(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:n},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},i=cl(r,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:n},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:r})=>r.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});xe.create({name:"listKit",addExtensions(){const r=[];return this.options.bulletList!==!1&&r.push(yf.configure(this.options.bulletList)),this.options.listItem!==!1&&r.push(bf.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(y7.configure(this.options.listKeymap)),this.options.orderedList!==!1&&r.push(Of.configure(this.options.orderedList)),this.options.taskItem!==!1&&r.push(T7.configure(this.options.taskItem)),this.options.taskList!==!1&&r.push(M7.configure(this.options.taskList)),r}});class gt{constructor(e,t,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=n}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new gt(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class Tt{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new Tt(t,gt.range(this,e))}}class _{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n="KaTeX parse error: "+e,i,s,o=t&&t.loc;if(o&&o.start<=o.end){var a=o.lexer.input;i=o.start,s=o.end,i===a.length?n+=" at end of input: ":n+=" at position "+(i+1)+": ";var l=a.slice(i,s).replace(/[^]/g,"$&̲"),u;i>15?u="…"+a.slice(i-15,i):u=a.slice(0,i);var c;s+15<a.length?c=a.slice(s,s+15)+"…":c=a.slice(s),n+=u+l+c}var d=new Error(n);return d.name="ParseError",d.__proto__=_.prototype,d.position=i,i!=null&&s!=null&&(d.length=s-i),d.rawMessage=e,d}}_.prototype.__proto__=Error.prototype;var C7=function(e,t){return e===void 0?t:e},E7=/([A-Z])/g,A7=function(e){return e.replace(E7,"-$1").toLowerCase()},O7={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},N7=/[&><"']/g;function D7(r){return String(r).replace(N7,e=>O7[e])}var Nf=function r(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?r(e.body[0]):e:e.type==="font"?r(e.body):e},I7=function(e){var t=Nf(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},R7=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},P7=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},ye={deflt:C7,escape:D7,hyphenate:A7,getBaseElem:Nf,isCharacterBox:I7,protocolFromUrl:P7},Xs={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function z7(r){if(r.default)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class Ml{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var t in Xs)if(Xs.hasOwnProperty(t)){var n=Xs[t];this[t]=e[t]!==void 0?n.processor?n.processor(e[t]):e[t]:z7(n)}}reportNonstrict(e,t,n){var i=this.strict;if(typeof i=="function"&&(i=i(e,t,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new _("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,n){var i=this.strict;if(typeof i=="function")try{i=i(e,t,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var t=ye.protocolFromUrl(e.url);if(t==null)return!1;e.protocol=t}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}}class Ur{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return Yt[L7[this.id]]}sub(){return Yt[B7[this.id]]}fracNum(){return Yt[F7[this.id]]}fracDen(){return Yt[$7[this.id]]}cramp(){return Yt[H7[this.id]]}text(){return Yt[V7[this.id]]}isTight(){return this.size>=2}}var Cl=0,Zs=1,Fn=2,pr=3,Ii=4,Pt=5,$n=6,ut=7,Yt=[new Ur(Cl,0,!1),new Ur(Zs,0,!0),new Ur(Fn,1,!1),new Ur(pr,1,!0),new Ur(Ii,2,!1),new Ur(Pt,2,!0),new Ur($n,3,!1),new Ur(ut,3,!0)],L7=[Ii,Pt,Ii,Pt,$n,ut,$n,ut],B7=[Pt,Pt,Pt,Pt,ut,ut,ut,ut],F7=[Fn,pr,Ii,Pt,$n,ut,$n,ut],$7=[pr,pr,Pt,Pt,ut,ut,ut,ut],H7=[Zs,Zs,pr,pr,Pt,Pt,ut,ut],V7=[Cl,Zs,Fn,pr,Fn,pr,Fn,pr],oe={DISPLAY:Yt[Cl],TEXT:Yt[Fn],SCRIPT:Yt[Ii],SCRIPTSCRIPT:Yt[$n]},El=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function _7(r){for(var e=0;e<El.length;e++)for(var t=El[e],n=0;n<t.blocks.length;n++){var i=t.blocks[n];if(r>=i[0]&&r<=i[1])return t.name}return null}var Qs=[];El.forEach(r=>r.blocks.forEach(e=>Qs.push(...e)));function Df(r){for(var e=0;e<Qs.length;e+=2)if(r>=Qs[e]&&r<=Qs[e+1])return!0;return!1}var Hn=80,j7=function(e,t){return"M95,"+(622+e+t)+`
607
607
  c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
608
608
  c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
609
609
  c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
@@ -614,7 +614,7 @@ c5.3,-9.3,12,-14,20,-14
614
614
  H400000v`+(40+e)+`H845.2724
615
615
  s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
616
616
  c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
617
- M`+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},_7=function(e,t){return"M263,"+(601+e+t)+`c0.7,0,18,39.7,52,119
617
+ M`+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},q7=function(e,t){return"M263,"+(601+e+t)+`c0.7,0,18,39.7,52,119
618
618
  c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
619
619
  c340,-704.7,510.7,-1060.3,512,-1067
620
620
  l`+e/2.084+" -"+e+`
@@ -654,7 +654,7 @@ s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,1
654
654
  H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
655
655
  h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
656
656
  c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
657
- 219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},J7=function(e,t,n){t=1e3*t;var i="";switch(e){case"sqrtMain":i=q7(t,Hn);break;case"sqrtSize1":i=_7(t,Hn);break;case"sqrtSize2":i=W7(t,Hn);break;case"sqrtSize3":i=U7(t,Hn);break;case"sqrtSize4":i=G7(t,Hn);break;case"sqrtTall":i=Y7(t,Hn,n)}return i},X7=function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"∣":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z"+("M367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z");case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257z"+("M478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z");default:return""}},If={doubleleftarrow:`M262 157
657
+ 219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},J7=function(e,t,n){t=1e3*t;var i="";switch(e){case"sqrtMain":i=j7(t,Hn);break;case"sqrtSize1":i=q7(t,Hn);break;case"sqrtSize2":i=W7(t,Hn);break;case"sqrtSize3":i=U7(t,Hn);break;case"sqrtSize4":i=G7(t,Hn);break;case"sqrtTall":i=Y7(t,Hn,n)}return i},X7=function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"∣":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z"+("M367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z");case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257z"+("M478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z");default:return""}},If={doubleleftarrow:`M262 157
658
658
  l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
659
659
  0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
660
660
  14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
@@ -857,24 +857,24 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6
857
857
  c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
858
858
  c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
859
859
  l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
860
- -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Ri{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){var e=t=>t.toText();return this.children.map(e).join("")}}var Jt={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},eo={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Rf={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Q7(r,e){Jt[r]=e}function Al(r,e,t){if(!Jt[e])throw new Error("Font metrics not found for font: "+e+".");var n=r.charCodeAt(0),i=Jt[e][n];if(!i&&r[0]in Rf&&(n=Rf[r[0]].charCodeAt(0),i=Jt[e][n]),!i&&t==="text"&&Df(n)&&(i=Jt[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var Ol={};function eb(r){var e;if(r>=5?e=0:r>=3?e=1:e=2,!Ol[e]){var t=Ol[e]={cssEmPerMu:eo.quad[e]/18};for(var n in eo)eo.hasOwnProperty(n)&&(t[n]=eo[n][e])}return Ol[e]}var tb=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Pf=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],zf=function(e,t){return t.size<2?e:tb[e-1][t.size-1]};class mr{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||mr.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Pf[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return new mr(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:zf(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Pf[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=zf(mr.BASESIZE,e);return this.size===t&&this.textSize===mr.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==mr.BASESIZE?["sizing","reset-size"+this.size,"size"+mr.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=eb(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}mr.BASESIZE=6;var Nl={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},rb={ex:!0,em:!0,mu:!0},Lf=function(e){return typeof e!="string"&&(e=e.unit),e in Nl||e in rb||e==="ex"},Pe=function(e,t){var n;if(e.unit in Nl)n=Nl[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit==="mu")n=t.fontMetrics().cssEmPerMu;else{var i;if(t.style.isTight()?i=t.havingStyle(t.style.text()):i=t,e.unit==="ex")n=i.fontMetrics().xHeight;else if(e.unit==="em")n=i.fontMetrics().quad;else throw new j("Invalid unit: '"+e.unit+"'");i!==t&&(n*=i.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},_=function(e){return+e.toFixed(4)+"em"},Gr=function(e){return e.filter(t=>t).join(" ")},Bf=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var i=t.getColor();i&&(this.style.color=i)}},Ff=function(e){var t=document.createElement(e);t.className=Gr(this.classes);for(var n in this.style)this.style.hasOwnProperty(n)&&(t.style[n]=this.style[n]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&t.setAttribute(i,this.attributes[i]);for(var s=0;s<this.children.length;s++)t.appendChild(this.children[s].toNode());return t},nb=/[\s"'>/=\x00-\x1f]/,$f=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+ye.escape(Gr(this.classes))+'"');var n="";for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=ye.hyphenate(i)+":"+this.style[i]+";");n&&(t+=' style="'+ye.escape(n)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(nb.test(s))throw new j("Invalid attribute name '"+s+"'");t+=" "+s+'="'+ye.escape(this.attributes[s])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">",t};class Pi{constructor(e,t,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,Bf.call(this,e,n,i),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Ff.call(this,"span")}toMarkup(){return $f.call(this,"span")}}class Dl{constructor(e,t,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Bf.call(this,t,i),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Ff.call(this,"a")}toMarkup(){return $f.call(this,"a")}}class ib{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var t in this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e='<img src="'+ye.escape(this.src)+'"'+(' alt="'+ye.escape(this.alt)+'"'),t="";for(var n in this.style)this.style.hasOwnProperty(n)&&(t+=ye.hyphenate(n)+":"+this.style[n]+";");return t&&(e+=' style="'+ye.escape(t)+'"'),e+="'/>",e}}var sb={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class zt{constructor(e,t,n,i,s,o,a,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=i||0,this.skew=s||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var u=j7(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=sb[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;this.italic>0&&(t=document.createElement("span"),t.style.marginRight=_(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=Gr(this.classes));for(var n in this.style)this.style.hasOwnProperty(n)&&(t=t||document.createElement("span"),t.style[n]=this.style[n]);return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=ye.escape(Gr(this.classes)),t+='"');var n="";this.italic>0&&(n+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=ye.hyphenate(i)+":"+this.style[i]+";");n&&(e=!0,t+=' style="'+ye.escape(n)+'"');var s=ye.escape(this.text);return e?(t+=">",t+=s,t+="</span>",t):s}}class gr{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);for(var i=0;i<this.children.length;i++)t.appendChild(this.children[i].toNode());return t}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+ye.escape(this.attributes[t])+'"');e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>",e}}class Kr{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"path");return this.alternate?t.setAttribute("d",this.alternate):t.setAttribute("d",If[this.pathName]),t}toMarkup(){return this.alternate?'<path d="'+ye.escape(this.alternate)+'"/>':'<path d="'+ye.escape(If[this.pathName])+'"/>'}}class Il{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"line");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);return t}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+ye.escape(this.attributes[t])+'"');return e+="/>",e}}function Hf(r){if(r instanceof zt)return r;throw new Error("Expected symbolNode but got "+String(r)+".")}function ob(r){if(r instanceof Pi)return r;throw new Error("Expected span<HtmlDomNode> but got "+String(r)+".")}var ab={bin:1,close:1,inner:1,open:1,punct:1,rel:1},lb={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ne={math:{},text:{}};function p(r,e,t,n,i,s){Ne[r][i]={font:e,group:t,replace:n},s&&n&&(Ne[r][n]=Ne[r][i])}var g="math",$="text",b="main",T="ams",Ie="accent-token",J="bin",ct="close",Vn="inner",ae="mathord",We="op-token",Mt="open",to="punct",M="rel",vr="spacing",A="textord";p(g,b,M,"≡","\\equiv",!0),p(g,b,M,"≺","\\prec",!0),p(g,b,M,"≻","\\succ",!0),p(g,b,M,"∼","\\sim",!0),p(g,b,M,"⊥","\\perp"),p(g,b,M,"⪯","\\preceq",!0),p(g,b,M,"⪰","\\succeq",!0),p(g,b,M,"≃","\\simeq",!0),p(g,b,M,"∣","\\mid",!0),p(g,b,M,"≪","\\ll",!0),p(g,b,M,"≫","\\gg",!0),p(g,b,M,"≍","\\asymp",!0),p(g,b,M,"∥","\\parallel"),p(g,b,M,"⋈","\\bowtie",!0),p(g,b,M,"⌣","\\smile",!0),p(g,b,M,"⊑","\\sqsubseteq",!0),p(g,b,M,"⊒","\\sqsupseteq",!0),p(g,b,M,"≐","\\doteq",!0),p(g,b,M,"⌢","\\frown",!0),p(g,b,M,"∋","\\ni",!0),p(g,b,M,"∝","\\propto",!0),p(g,b,M,"⊢","\\vdash",!0),p(g,b,M,"⊣","\\dashv",!0),p(g,b,M,"∋","\\owns"),p(g,b,to,".","\\ldotp"),p(g,b,to,"⋅","\\cdotp"),p(g,b,A,"#","\\#"),p($,b,A,"#","\\#"),p(g,b,A,"&","\\&"),p($,b,A,"&","\\&"),p(g,b,A,"ℵ","\\aleph",!0),p(g,b,A,"∀","\\forall",!0),p(g,b,A,"ℏ","\\hbar",!0),p(g,b,A,"∃","\\exists",!0),p(g,b,A,"∇","\\nabla",!0),p(g,b,A,"♭","\\flat",!0),p(g,b,A,"ℓ","\\ell",!0),p(g,b,A,"♮","\\natural",!0),p(g,b,A,"♣","\\clubsuit",!0),p(g,b,A,"℘","\\wp",!0),p(g,b,A,"♯","\\sharp",!0),p(g,b,A,"♢","\\diamondsuit",!0),p(g,b,A,"ℜ","\\Re",!0),p(g,b,A,"♡","\\heartsuit",!0),p(g,b,A,"ℑ","\\Im",!0),p(g,b,A,"♠","\\spadesuit",!0),p(g,b,A,"§","\\S",!0),p($,b,A,"§","\\S"),p(g,b,A,"¶","\\P",!0),p($,b,A,"¶","\\P"),p(g,b,A,"†","\\dag"),p($,b,A,"†","\\dag"),p($,b,A,"†","\\textdagger"),p(g,b,A,"‡","\\ddag"),p($,b,A,"‡","\\ddag"),p($,b,A,"‡","\\textdaggerdbl"),p(g,b,ct,"⎱","\\rmoustache",!0),p(g,b,Mt,"⎰","\\lmoustache",!0),p(g,b,ct,"⟯","\\rgroup",!0),p(g,b,Mt,"⟮","\\lgroup",!0),p(g,b,J,"∓","\\mp",!0),p(g,b,J,"⊖","\\ominus",!0),p(g,b,J,"⊎","\\uplus",!0),p(g,b,J,"⊓","\\sqcap",!0),p(g,b,J,"∗","\\ast"),p(g,b,J,"⊔","\\sqcup",!0),p(g,b,J,"◯","\\bigcirc",!0),p(g,b,J,"∙","\\bullet",!0),p(g,b,J,"‡","\\ddagger"),p(g,b,J,"≀","\\wr",!0),p(g,b,J,"⨿","\\amalg"),p(g,b,J,"&","\\And"),p(g,b,M,"⟵","\\longleftarrow",!0),p(g,b,M,"⇐","\\Leftarrow",!0),p(g,b,M,"⟸","\\Longleftarrow",!0),p(g,b,M,"⟶","\\longrightarrow",!0),p(g,b,M,"⇒","\\Rightarrow",!0),p(g,b,M,"⟹","\\Longrightarrow",!0),p(g,b,M,"↔","\\leftrightarrow",!0),p(g,b,M,"⟷","\\longleftrightarrow",!0),p(g,b,M,"⇔","\\Leftrightarrow",!0),p(g,b,M,"⟺","\\Longleftrightarrow",!0),p(g,b,M,"↦","\\mapsto",!0),p(g,b,M,"⟼","\\longmapsto",!0),p(g,b,M,"↗","\\nearrow",!0),p(g,b,M,"↩","\\hookleftarrow",!0),p(g,b,M,"↪","\\hookrightarrow",!0),p(g,b,M,"↘","\\searrow",!0),p(g,b,M,"↼","\\leftharpoonup",!0),p(g,b,M,"⇀","\\rightharpoonup",!0),p(g,b,M,"↙","\\swarrow",!0),p(g,b,M,"↽","\\leftharpoondown",!0),p(g,b,M,"⇁","\\rightharpoondown",!0),p(g,b,M,"↖","\\nwarrow",!0),p(g,b,M,"⇌","\\rightleftharpoons",!0),p(g,T,M,"≮","\\nless",!0),p(g,T,M,"","\\@nleqslant"),p(g,T,M,"","\\@nleqq"),p(g,T,M,"⪇","\\lneq",!0),p(g,T,M,"≨","\\lneqq",!0),p(g,T,M,"","\\@lvertneqq"),p(g,T,M,"⋦","\\lnsim",!0),p(g,T,M,"⪉","\\lnapprox",!0),p(g,T,M,"⊀","\\nprec",!0),p(g,T,M,"⋠","\\npreceq",!0),p(g,T,M,"⋨","\\precnsim",!0),p(g,T,M,"⪹","\\precnapprox",!0),p(g,T,M,"≁","\\nsim",!0),p(g,T,M,"","\\@nshortmid"),p(g,T,M,"∤","\\nmid",!0),p(g,T,M,"⊬","\\nvdash",!0),p(g,T,M,"⊭","\\nvDash",!0),p(g,T,M,"⋪","\\ntriangleleft"),p(g,T,M,"⋬","\\ntrianglelefteq",!0),p(g,T,M,"⊊","\\subsetneq",!0),p(g,T,M,"","\\@varsubsetneq"),p(g,T,M,"⫋","\\subsetneqq",!0),p(g,T,M,"","\\@varsubsetneqq"),p(g,T,M,"≯","\\ngtr",!0),p(g,T,M,"","\\@ngeqslant"),p(g,T,M,"","\\@ngeqq"),p(g,T,M,"⪈","\\gneq",!0),p(g,T,M,"≩","\\gneqq",!0),p(g,T,M,"","\\@gvertneqq"),p(g,T,M,"⋧","\\gnsim",!0),p(g,T,M,"⪊","\\gnapprox",!0),p(g,T,M,"⊁","\\nsucc",!0),p(g,T,M,"⋡","\\nsucceq",!0),p(g,T,M,"⋩","\\succnsim",!0),p(g,T,M,"⪺","\\succnapprox",!0),p(g,T,M,"≆","\\ncong",!0),p(g,T,M,"","\\@nshortparallel"),p(g,T,M,"∦","\\nparallel",!0),p(g,T,M,"⊯","\\nVDash",!0),p(g,T,M,"⋫","\\ntriangleright"),p(g,T,M,"⋭","\\ntrianglerighteq",!0),p(g,T,M,"","\\@nsupseteqq"),p(g,T,M,"⊋","\\supsetneq",!0),p(g,T,M,"","\\@varsupsetneq"),p(g,T,M,"⫌","\\supsetneqq",!0),p(g,T,M,"","\\@varsupsetneqq"),p(g,T,M,"⊮","\\nVdash",!0),p(g,T,M,"⪵","\\precneqq",!0),p(g,T,M,"⪶","\\succneqq",!0),p(g,T,M,"","\\@nsubseteqq"),p(g,T,J,"⊴","\\unlhd"),p(g,T,J,"⊵","\\unrhd"),p(g,T,M,"↚","\\nleftarrow",!0),p(g,T,M,"↛","\\nrightarrow",!0),p(g,T,M,"⇍","\\nLeftarrow",!0),p(g,T,M,"⇏","\\nRightarrow",!0),p(g,T,M,"↮","\\nleftrightarrow",!0),p(g,T,M,"⇎","\\nLeftrightarrow",!0),p(g,T,M,"△","\\vartriangle"),p(g,T,A,"ℏ","\\hslash"),p(g,T,A,"▽","\\triangledown"),p(g,T,A,"◊","\\lozenge"),p(g,T,A,"Ⓢ","\\circledS"),p(g,T,A,"®","\\circledR"),p($,T,A,"®","\\circledR"),p(g,T,A,"∡","\\measuredangle",!0),p(g,T,A,"∄","\\nexists"),p(g,T,A,"℧","\\mho"),p(g,T,A,"Ⅎ","\\Finv",!0),p(g,T,A,"⅁","\\Game",!0),p(g,T,A,"‵","\\backprime"),p(g,T,A,"▲","\\blacktriangle"),p(g,T,A,"▼","\\blacktriangledown"),p(g,T,A,"■","\\blacksquare"),p(g,T,A,"⧫","\\blacklozenge"),p(g,T,A,"★","\\bigstar"),p(g,T,A,"∢","\\sphericalangle",!0),p(g,T,A,"∁","\\complement",!0),p(g,T,A,"ð","\\eth",!0),p($,b,A,"ð","ð"),p(g,T,A,"╱","\\diagup"),p(g,T,A,"╲","\\diagdown"),p(g,T,A,"□","\\square"),p(g,T,A,"□","\\Box"),p(g,T,A,"◊","\\Diamond"),p(g,T,A,"¥","\\yen",!0),p($,T,A,"¥","\\yen",!0),p(g,T,A,"✓","\\checkmark",!0),p($,T,A,"✓","\\checkmark"),p(g,T,A,"ℶ","\\beth",!0),p(g,T,A,"ℸ","\\daleth",!0),p(g,T,A,"ℷ","\\gimel",!0),p(g,T,A,"ϝ","\\digamma",!0),p(g,T,A,"ϰ","\\varkappa"),p(g,T,Mt,"┌","\\@ulcorner",!0),p(g,T,ct,"┐","\\@urcorner",!0),p(g,T,Mt,"└","\\@llcorner",!0),p(g,T,ct,"┘","\\@lrcorner",!0),p(g,T,M,"≦","\\leqq",!0),p(g,T,M,"⩽","\\leqslant",!0),p(g,T,M,"⪕","\\eqslantless",!0),p(g,T,M,"≲","\\lesssim",!0),p(g,T,M,"⪅","\\lessapprox",!0),p(g,T,M,"≊","\\approxeq",!0),p(g,T,J,"⋖","\\lessdot"),p(g,T,M,"⋘","\\lll",!0),p(g,T,M,"≶","\\lessgtr",!0),p(g,T,M,"⋚","\\lesseqgtr",!0),p(g,T,M,"⪋","\\lesseqqgtr",!0),p(g,T,M,"≑","\\doteqdot"),p(g,T,M,"≓","\\risingdotseq",!0),p(g,T,M,"≒","\\fallingdotseq",!0),p(g,T,M,"∽","\\backsim",!0),p(g,T,M,"⋍","\\backsimeq",!0),p(g,T,M,"⫅","\\subseteqq",!0),p(g,T,M,"⋐","\\Subset",!0),p(g,T,M,"⊏","\\sqsubset",!0),p(g,T,M,"≼","\\preccurlyeq",!0),p(g,T,M,"⋞","\\curlyeqprec",!0),p(g,T,M,"≾","\\precsim",!0),p(g,T,M,"⪷","\\precapprox",!0),p(g,T,M,"⊲","\\vartriangleleft"),p(g,T,M,"⊴","\\trianglelefteq"),p(g,T,M,"⊨","\\vDash",!0),p(g,T,M,"⊪","\\Vvdash",!0),p(g,T,M,"⌣","\\smallsmile"),p(g,T,M,"⌢","\\smallfrown"),p(g,T,M,"≏","\\bumpeq",!0),p(g,T,M,"≎","\\Bumpeq",!0),p(g,T,M,"≧","\\geqq",!0),p(g,T,M,"⩾","\\geqslant",!0),p(g,T,M,"⪖","\\eqslantgtr",!0),p(g,T,M,"≳","\\gtrsim",!0),p(g,T,M,"⪆","\\gtrapprox",!0),p(g,T,J,"⋗","\\gtrdot"),p(g,T,M,"⋙","\\ggg",!0),p(g,T,M,"≷","\\gtrless",!0),p(g,T,M,"⋛","\\gtreqless",!0),p(g,T,M,"⪌","\\gtreqqless",!0),p(g,T,M,"≖","\\eqcirc",!0),p(g,T,M,"≗","\\circeq",!0),p(g,T,M,"≜","\\triangleq",!0),p(g,T,M,"∼","\\thicksim"),p(g,T,M,"≈","\\thickapprox"),p(g,T,M,"⫆","\\supseteqq",!0),p(g,T,M,"⋑","\\Supset",!0),p(g,T,M,"⊐","\\sqsupset",!0),p(g,T,M,"≽","\\succcurlyeq",!0),p(g,T,M,"⋟","\\curlyeqsucc",!0),p(g,T,M,"≿","\\succsim",!0),p(g,T,M,"⪸","\\succapprox",!0),p(g,T,M,"⊳","\\vartriangleright"),p(g,T,M,"⊵","\\trianglerighteq"),p(g,T,M,"⊩","\\Vdash",!0),p(g,T,M,"∣","\\shortmid"),p(g,T,M,"∥","\\shortparallel"),p(g,T,M,"≬","\\between",!0),p(g,T,M,"⋔","\\pitchfork",!0),p(g,T,M,"∝","\\varpropto"),p(g,T,M,"◀","\\blacktriangleleft"),p(g,T,M,"∴","\\therefore",!0),p(g,T,M,"∍","\\backepsilon"),p(g,T,M,"▶","\\blacktriangleright"),p(g,T,M,"∵","\\because",!0),p(g,T,M,"⋘","\\llless"),p(g,T,M,"⋙","\\gggtr"),p(g,T,J,"⊲","\\lhd"),p(g,T,J,"⊳","\\rhd"),p(g,T,M,"≂","\\eqsim",!0),p(g,b,M,"⋈","\\Join"),p(g,T,M,"≑","\\Doteq",!0),p(g,T,J,"∔","\\dotplus",!0),p(g,T,J,"∖","\\smallsetminus"),p(g,T,J,"⋒","\\Cap",!0),p(g,T,J,"⋓","\\Cup",!0),p(g,T,J,"⩞","\\doublebarwedge",!0),p(g,T,J,"⊟","\\boxminus",!0),p(g,T,J,"⊞","\\boxplus",!0),p(g,T,J,"⋇","\\divideontimes",!0),p(g,T,J,"⋉","\\ltimes",!0),p(g,T,J,"⋊","\\rtimes",!0),p(g,T,J,"⋋","\\leftthreetimes",!0),p(g,T,J,"⋌","\\rightthreetimes",!0),p(g,T,J,"⋏","\\curlywedge",!0),p(g,T,J,"⋎","\\curlyvee",!0),p(g,T,J,"⊝","\\circleddash",!0),p(g,T,J,"⊛","\\circledast",!0),p(g,T,J,"⋅","\\centerdot"),p(g,T,J,"⊺","\\intercal",!0),p(g,T,J,"⋒","\\doublecap"),p(g,T,J,"⋓","\\doublecup"),p(g,T,J,"⊠","\\boxtimes",!0),p(g,T,M,"⇢","\\dashrightarrow",!0),p(g,T,M,"⇠","\\dashleftarrow",!0),p(g,T,M,"⇇","\\leftleftarrows",!0),p(g,T,M,"⇆","\\leftrightarrows",!0),p(g,T,M,"⇚","\\Lleftarrow",!0),p(g,T,M,"↞","\\twoheadleftarrow",!0),p(g,T,M,"↢","\\leftarrowtail",!0),p(g,T,M,"↫","\\looparrowleft",!0),p(g,T,M,"⇋","\\leftrightharpoons",!0),p(g,T,M,"↶","\\curvearrowleft",!0),p(g,T,M,"↺","\\circlearrowleft",!0),p(g,T,M,"↰","\\Lsh",!0),p(g,T,M,"⇈","\\upuparrows",!0),p(g,T,M,"↿","\\upharpoonleft",!0),p(g,T,M,"⇃","\\downharpoonleft",!0),p(g,b,M,"⊶","\\origof",!0),p(g,b,M,"⊷","\\imageof",!0),p(g,T,M,"⊸","\\multimap",!0),p(g,T,M,"↭","\\leftrightsquigarrow",!0),p(g,T,M,"⇉","\\rightrightarrows",!0),p(g,T,M,"⇄","\\rightleftarrows",!0),p(g,T,M,"↠","\\twoheadrightarrow",!0),p(g,T,M,"↣","\\rightarrowtail",!0),p(g,T,M,"↬","\\looparrowright",!0),p(g,T,M,"↷","\\curvearrowright",!0),p(g,T,M,"↻","\\circlearrowright",!0),p(g,T,M,"↱","\\Rsh",!0),p(g,T,M,"⇊","\\downdownarrows",!0),p(g,T,M,"↾","\\upharpoonright",!0),p(g,T,M,"⇂","\\downharpoonright",!0),p(g,T,M,"⇝","\\rightsquigarrow",!0),p(g,T,M,"⇝","\\leadsto"),p(g,T,M,"⇛","\\Rrightarrow",!0),p(g,T,M,"↾","\\restriction"),p(g,b,A,"‘","`"),p(g,b,A,"$","\\$"),p($,b,A,"$","\\$"),p($,b,A,"$","\\textdollar"),p(g,b,A,"%","\\%"),p($,b,A,"%","\\%"),p(g,b,A,"_","\\_"),p($,b,A,"_","\\_"),p($,b,A,"_","\\textunderscore"),p(g,b,A,"∠","\\angle",!0),p(g,b,A,"∞","\\infty",!0),p(g,b,A,"′","\\prime"),p(g,b,A,"△","\\triangle"),p(g,b,A,"Γ","\\Gamma",!0),p(g,b,A,"Δ","\\Delta",!0),p(g,b,A,"Θ","\\Theta",!0),p(g,b,A,"Λ","\\Lambda",!0),p(g,b,A,"Ξ","\\Xi",!0),p(g,b,A,"Π","\\Pi",!0),p(g,b,A,"Σ","\\Sigma",!0),p(g,b,A,"Υ","\\Upsilon",!0),p(g,b,A,"Φ","\\Phi",!0),p(g,b,A,"Ψ","\\Psi",!0),p(g,b,A,"Ω","\\Omega",!0),p(g,b,A,"A","Α"),p(g,b,A,"B","Β"),p(g,b,A,"E","Ε"),p(g,b,A,"Z","Ζ"),p(g,b,A,"H","Η"),p(g,b,A,"I","Ι"),p(g,b,A,"K","Κ"),p(g,b,A,"M","Μ"),p(g,b,A,"N","Ν"),p(g,b,A,"O","Ο"),p(g,b,A,"P","Ρ"),p(g,b,A,"T","Τ"),p(g,b,A,"X","Χ"),p(g,b,A,"¬","\\neg",!0),p(g,b,A,"¬","\\lnot"),p(g,b,A,"⊤","\\top"),p(g,b,A,"⊥","\\bot"),p(g,b,A,"∅","\\emptyset"),p(g,T,A,"∅","\\varnothing"),p(g,b,ae,"α","\\alpha",!0),p(g,b,ae,"β","\\beta",!0),p(g,b,ae,"γ","\\gamma",!0),p(g,b,ae,"δ","\\delta",!0),p(g,b,ae,"ϵ","\\epsilon",!0),p(g,b,ae,"ζ","\\zeta",!0),p(g,b,ae,"η","\\eta",!0),p(g,b,ae,"θ","\\theta",!0),p(g,b,ae,"ι","\\iota",!0),p(g,b,ae,"κ","\\kappa",!0),p(g,b,ae,"λ","\\lambda",!0),p(g,b,ae,"μ","\\mu",!0),p(g,b,ae,"ν","\\nu",!0),p(g,b,ae,"ξ","\\xi",!0),p(g,b,ae,"ο","\\omicron",!0),p(g,b,ae,"π","\\pi",!0),p(g,b,ae,"ρ","\\rho",!0),p(g,b,ae,"σ","\\sigma",!0),p(g,b,ae,"τ","\\tau",!0),p(g,b,ae,"υ","\\upsilon",!0),p(g,b,ae,"ϕ","\\phi",!0),p(g,b,ae,"χ","\\chi",!0),p(g,b,ae,"ψ","\\psi",!0),p(g,b,ae,"ω","\\omega",!0),p(g,b,ae,"ε","\\varepsilon",!0),p(g,b,ae,"ϑ","\\vartheta",!0),p(g,b,ae,"ϖ","\\varpi",!0),p(g,b,ae,"ϱ","\\varrho",!0),p(g,b,ae,"ς","\\varsigma",!0),p(g,b,ae,"φ","\\varphi",!0),p(g,b,J,"∗","*",!0),p(g,b,J,"+","+"),p(g,b,J,"−","-",!0),p(g,b,J,"⋅","\\cdot",!0),p(g,b,J,"∘","\\circ",!0),p(g,b,J,"÷","\\div",!0),p(g,b,J,"±","\\pm",!0),p(g,b,J,"×","\\times",!0),p(g,b,J,"∩","\\cap",!0),p(g,b,J,"∪","\\cup",!0),p(g,b,J,"∖","\\setminus",!0),p(g,b,J,"∧","\\land"),p(g,b,J,"∨","\\lor"),p(g,b,J,"∧","\\wedge",!0),p(g,b,J,"∨","\\vee",!0),p(g,b,A,"√","\\surd"),p(g,b,Mt,"⟨","\\langle",!0),p(g,b,Mt,"∣","\\lvert"),p(g,b,Mt,"∥","\\lVert"),p(g,b,ct,"?","?"),p(g,b,ct,"!","!"),p(g,b,ct,"⟩","\\rangle",!0),p(g,b,ct,"∣","\\rvert"),p(g,b,ct,"∥","\\rVert"),p(g,b,M,"=","="),p(g,b,M,":",":"),p(g,b,M,"≈","\\approx",!0),p(g,b,M,"≅","\\cong",!0),p(g,b,M,"≥","\\ge"),p(g,b,M,"≥","\\geq",!0),p(g,b,M,"←","\\gets"),p(g,b,M,">","\\gt",!0),p(g,b,M,"∈","\\in",!0),p(g,b,M,"","\\@not"),p(g,b,M,"⊂","\\subset",!0),p(g,b,M,"⊃","\\supset",!0),p(g,b,M,"⊆","\\subseteq",!0),p(g,b,M,"⊇","\\supseteq",!0),p(g,T,M,"⊈","\\nsubseteq",!0),p(g,T,M,"⊉","\\nsupseteq",!0),p(g,b,M,"⊨","\\models"),p(g,b,M,"←","\\leftarrow",!0),p(g,b,M,"≤","\\le"),p(g,b,M,"≤","\\leq",!0),p(g,b,M,"<","\\lt",!0),p(g,b,M,"→","\\rightarrow",!0),p(g,b,M,"→","\\to"),p(g,T,M,"≱","\\ngeq",!0),p(g,T,M,"≰","\\nleq",!0),p(g,b,vr," ","\\ "),p(g,b,vr," ","\\space"),p(g,b,vr," ","\\nobreakspace"),p($,b,vr," ","\\ "),p($,b,vr," "," "),p($,b,vr," ","\\space"),p($,b,vr," ","\\nobreakspace"),p(g,b,vr,null,"\\nobreak"),p(g,b,vr,null,"\\allowbreak"),p(g,b,to,",",","),p(g,b,to,";",";"),p(g,T,J,"⊼","\\barwedge",!0),p(g,T,J,"⊻","\\veebar",!0),p(g,b,J,"⊙","\\odot",!0),p(g,b,J,"⊕","\\oplus",!0),p(g,b,J,"⊗","\\otimes",!0),p(g,b,A,"∂","\\partial",!0),p(g,b,J,"⊘","\\oslash",!0),p(g,T,J,"⊚","\\circledcirc",!0),p(g,T,J,"⊡","\\boxdot",!0),p(g,b,J,"△","\\bigtriangleup"),p(g,b,J,"▽","\\bigtriangledown"),p(g,b,J,"†","\\dagger"),p(g,b,J,"⋄","\\diamond"),p(g,b,J,"⋆","\\star"),p(g,b,J,"◃","\\triangleleft"),p(g,b,J,"▹","\\triangleright"),p(g,b,Mt,"{","\\{"),p($,b,A,"{","\\{"),p($,b,A,"{","\\textbraceleft"),p(g,b,ct,"}","\\}"),p($,b,A,"}","\\}"),p($,b,A,"}","\\textbraceright"),p(g,b,Mt,"{","\\lbrace"),p(g,b,ct,"}","\\rbrace"),p(g,b,Mt,"[","\\lbrack",!0),p($,b,A,"[","\\lbrack",!0),p(g,b,ct,"]","\\rbrack",!0),p($,b,A,"]","\\rbrack",!0),p(g,b,Mt,"(","\\lparen",!0),p(g,b,ct,")","\\rparen",!0),p($,b,A,"<","\\textless",!0),p($,b,A,">","\\textgreater",!0),p(g,b,Mt,"⌊","\\lfloor",!0),p(g,b,ct,"⌋","\\rfloor",!0),p(g,b,Mt,"⌈","\\lceil",!0),p(g,b,ct,"⌉","\\rceil",!0),p(g,b,A,"\\","\\backslash"),p(g,b,A,"∣","|"),p(g,b,A,"∣","\\vert"),p($,b,A,"|","\\textbar",!0),p(g,b,A,"∥","\\|"),p(g,b,A,"∥","\\Vert"),p($,b,A,"∥","\\textbardbl"),p($,b,A,"~","\\textasciitilde"),p($,b,A,"\\","\\textbackslash"),p($,b,A,"^","\\textasciicircum"),p(g,b,M,"↑","\\uparrow",!0),p(g,b,M,"⇑","\\Uparrow",!0),p(g,b,M,"↓","\\downarrow",!0),p(g,b,M,"⇓","\\Downarrow",!0),p(g,b,M,"↕","\\updownarrow",!0),p(g,b,M,"⇕","\\Updownarrow",!0),p(g,b,We,"∐","\\coprod"),p(g,b,We,"⋁","\\bigvee"),p(g,b,We,"⋀","\\bigwedge"),p(g,b,We,"⨄","\\biguplus"),p(g,b,We,"⋂","\\bigcap"),p(g,b,We,"⋃","\\bigcup"),p(g,b,We,"∫","\\int"),p(g,b,We,"∫","\\intop"),p(g,b,We,"∬","\\iint"),p(g,b,We,"∭","\\iiint"),p(g,b,We,"∏","\\prod"),p(g,b,We,"∑","\\sum"),p(g,b,We,"⨂","\\bigotimes"),p(g,b,We,"⨁","\\bigoplus"),p(g,b,We,"⨀","\\bigodot"),p(g,b,We,"∮","\\oint"),p(g,b,We,"∯","\\oiint"),p(g,b,We,"∰","\\oiiint"),p(g,b,We,"⨆","\\bigsqcup"),p(g,b,We,"∫","\\smallint"),p($,b,Vn,"…","\\textellipsis"),p(g,b,Vn,"…","\\mathellipsis"),p($,b,Vn,"…","\\ldots",!0),p(g,b,Vn,"…","\\ldots",!0),p(g,b,Vn,"⋯","\\@cdots",!0),p(g,b,Vn,"⋱","\\ddots",!0),p(g,b,A,"⋮","\\varvdots"),p($,b,A,"⋮","\\varvdots"),p(g,b,Ie,"ˊ","\\acute"),p(g,b,Ie,"ˋ","\\grave"),p(g,b,Ie,"¨","\\ddot"),p(g,b,Ie,"~","\\tilde"),p(g,b,Ie,"ˉ","\\bar"),p(g,b,Ie,"˘","\\breve"),p(g,b,Ie,"ˇ","\\check"),p(g,b,Ie,"^","\\hat"),p(g,b,Ie,"⃗","\\vec"),p(g,b,Ie,"˙","\\dot"),p(g,b,Ie,"˚","\\mathring"),p(g,b,ae,"","\\@imath"),p(g,b,ae,"","\\@jmath"),p(g,b,A,"ı","ı"),p(g,b,A,"ȷ","ȷ"),p($,b,A,"ı","\\i",!0),p($,b,A,"ȷ","\\j",!0),p($,b,A,"ß","\\ss",!0),p($,b,A,"æ","\\ae",!0),p($,b,A,"œ","\\oe",!0),p($,b,A,"ø","\\o",!0),p($,b,A,"Æ","\\AE",!0),p($,b,A,"Œ","\\OE",!0),p($,b,A,"Ø","\\O",!0),p($,b,Ie,"ˊ","\\'"),p($,b,Ie,"ˋ","\\`"),p($,b,Ie,"ˆ","\\^"),p($,b,Ie,"˜","\\~"),p($,b,Ie,"ˉ","\\="),p($,b,Ie,"˘","\\u"),p($,b,Ie,"˙","\\."),p($,b,Ie,"¸","\\c"),p($,b,Ie,"˚","\\r"),p($,b,Ie,"ˇ","\\v"),p($,b,Ie,"¨",'\\"'),p($,b,Ie,"˝","\\H"),p($,b,Ie,"◯","\\textcircled");var Vf={"--":!0,"---":!0,"``":!0,"''":!0};p($,b,A,"–","--",!0),p($,b,A,"–","\\textendash"),p($,b,A,"—","---",!0),p($,b,A,"—","\\textemdash"),p($,b,A,"‘","`",!0),p($,b,A,"‘","\\textquoteleft"),p($,b,A,"’","'",!0),p($,b,A,"’","\\textquoteright"),p($,b,A,"“","``",!0),p($,b,A,"“","\\textquotedblleft"),p($,b,A,"”","''",!0),p($,b,A,"”","\\textquotedblright"),p(g,b,A,"°","\\degree",!0),p($,b,A,"°","\\degree"),p($,b,A,"°","\\textdegree",!0),p(g,b,A,"£","\\pounds"),p(g,b,A,"£","\\mathsterling",!0),p($,b,A,"£","\\pounds"),p($,b,A,"£","\\textsterling",!0),p(g,T,A,"✠","\\maltese"),p($,T,A,"✠","\\maltese");for(var jf='0123456789/@."',Rl=0;Rl<jf.length;Rl++){var qf=jf.charAt(Rl);p(g,b,A,qf,qf)}for(var _f='0123456789!@*()-=+";:?/.,',Pl=0;Pl<_f.length;Pl++){var Wf=_f.charAt(Pl);p($,b,A,Wf,Wf)}for(var ro="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",zl=0;zl<ro.length;zl++){var no=ro.charAt(zl);p(g,b,ae,no,no),p($,b,A,no,no)}p(g,T,A,"C","ℂ"),p($,T,A,"C","ℂ"),p(g,T,A,"H","ℍ"),p($,T,A,"H","ℍ"),p(g,T,A,"N","ℕ"),p($,T,A,"N","ℕ"),p(g,T,A,"P","ℙ"),p($,T,A,"P","ℙ"),p(g,T,A,"Q","ℚ"),p($,T,A,"Q","ℚ"),p(g,T,A,"R","ℝ"),p($,T,A,"R","ℝ"),p(g,T,A,"Z","ℤ"),p($,T,A,"Z","ℤ"),p(g,b,ae,"h","ℎ"),p($,b,ae,"h","ℎ");for(var ue="",dt=0;dt<ro.length;dt++){var $e=ro.charAt(dt);ue=String.fromCharCode(55349,56320+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56372+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56424+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56580+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56684+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56736+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56788+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56840+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56944+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),dt<26&&(ue=String.fromCharCode(55349,56632+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56476+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue))}ue="𝕜",p(g,b,ae,"k",ue),p($,b,A,"k",ue);for(var wn=0;wn<10;wn++){var Yr=wn.toString();ue=String.fromCharCode(55349,57294+wn),p(g,b,ae,Yr,ue),p($,b,A,Yr,ue),ue=String.fromCharCode(55349,57314+wn),p(g,b,ae,Yr,ue),p($,b,A,Yr,ue),ue=String.fromCharCode(55349,57324+wn),p(g,b,ae,Yr,ue),p($,b,A,Yr,ue),ue=String.fromCharCode(55349,57334+wn),p(g,b,ae,Yr,ue),p($,b,A,Yr,ue)}for(var Ll="ÐÞþ",Bl=0;Bl<Ll.length;Bl++){var io=Ll.charAt(Bl);p(g,b,ae,io,io),p($,b,A,io,io)}var so=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Uf=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],ub=function(e,t){var n=e.charCodeAt(0),i=e.charCodeAt(1),s=(n-55296)*1024+(i-56320)+65536,o=t==="math"?0:1;if(119808<=s&&s<120484){var a=Math.floor((s-119808)/26);return[so[a][2],so[a][o]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[Uf[l][2],Uf[l][o]]}else{if(s===120485||s===120486)return[so[0][2],so[0][o]];if(120486<s&&s<120782)return["",""];throw new j("Unsupported character: "+e)}},oo=function(e,t,n){return Ne[n][e]&&Ne[n][e].replace&&(e=Ne[n][e].replace),{value:e,metrics:Al(e,t,n)}},Ht=function(e,t,n,i,s){var o=oo(e,t,n),a=o.metrics;e=o.value;var l;if(a){var u=a.italic;(n==="text"||i&&i.font==="mathit")&&(u=0),l=new zt(e,a.height,a.depth,u,a.skew,a.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+t+"' and mode '"+n+"'")),l=new zt(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var c=i.getColor();c&&(l.style.color=c)}return l},cb=function(e,t,n,i){return i===void 0&&(i=[]),n.font==="boldsymbol"&&oo(e,"Main-Bold",t).metrics?Ht(e,"Main-Bold",t,n,i.concat(["mathbf"])):e==="\\"||Ne[t][e].font==="main"?Ht(e,"Main-Regular",t,n,i):Ht(e,"AMS-Regular",t,n,i.concat(["amsrm"]))},db=function(e,t,n,i,s){return s!=="textord"&&oo(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},hb=function(e,t,n){var i=e.mode,s=e.text,o=["mord"],a=i==="math"||i==="text"&&t.font,l=a?t.font:t.fontFamily,u="",c="";if(s.charCodeAt(0)===55349&&([u,c]=ub(s,i)),u.length>0)return Ht(s,u,i,t,o.concat(c));if(l){var d,f;if(l==="boldsymbol"){var h=db(s,i,t,o,n);d=h.fontName,f=[h.fontClass]}else a?(d=Yf[l].fontName,f=[l]):(d=ao(l,t.fontWeight,t.fontShape),f=[l,t.fontWeight,t.fontShape]);if(oo(s,d,i).metrics)return Ht(s,d,i,t,o.concat(f));if(Vf.hasOwnProperty(s)&&d.slice(0,10)==="Typewriter"){for(var m=[],v=0;v<s.length;v++)m.push(Ht(s[v],d,i,t,o.concat(f)));return Kf(m)}}if(n==="mathord")return Ht(s,"Math-Italic",i,t,o.concat(["mathnormal"]));if(n==="textord"){var y=Ne[i][s]&&Ne[i][s].font;if(y==="ams"){var w=ao("amsrm",t.fontWeight,t.fontShape);return Ht(s,w,i,t,o.concat("amsrm",t.fontWeight,t.fontShape))}else if(y==="main"||!y){var k=ao("textrm",t.fontWeight,t.fontShape);return Ht(s,k,i,t,o.concat(t.fontWeight,t.fontShape))}else{var E=ao(y,t.fontWeight,t.fontShape);return Ht(s,E,i,t,o.concat(E,t.fontWeight,t.fontShape))}}else throw new Error("unexpected type: "+n+" in makeOrd")},fb=(r,e)=>{if(Gr(r.classes)!==Gr(e.classes)||r.skew!==e.skew||r.maxFontSize!==e.maxFontSize)return!1;if(r.classes.length===1){var t=r.classes[0];if(t==="mbin"||t==="mord")return!1}for(var n in r.style)if(r.style.hasOwnProperty(n)&&r.style[n]!==e.style[n])return!1;for(var i in e.style)if(e.style.hasOwnProperty(i)&&r.style[i]!==e.style[i])return!1;return!0},pb=r=>{for(var e=0;e<r.length-1;e++){var t=r[e],n=r[e+1];t instanceof zt&&n instanceof zt&&fb(t,n)&&(t.text+=n.text,t.height=Math.max(t.height,n.height),t.depth=Math.max(t.depth,n.depth),t.italic=n.italic,r.splice(e+1,1),e--)}return r},Fl=function(e){for(var t=0,n=0,i=0,s=0;s<e.children.length;s++){var o=e.children[s];o.height>t&&(t=o.height),o.depth>n&&(n=o.depth),o.maxFontSize>i&&(i=o.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=i},vt=function(e,t,n,i){var s=new Pi(e,t,n,i);return Fl(s),s},Gf=(r,e,t,n)=>new Pi(r,e,t,n),mb=function(e,t,n){var i=vt([e],[],t);return i.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),i.style.borderBottomWidth=_(i.height),i.maxFontSize=1,i},gb=function(e,t,n,i){var s=new Dl(e,t,n,i);return Fl(s),s},Kf=function(e){var t=new Ri(e);return Fl(t),t},vb=function(e,t){return e instanceof Ri?vt([],[e],t):e},yb=function(e){if(e.positionType==="individualShift"){for(var t=e.children,n=[t[0]],i=-t[0].shift-t[0].elem.depth,s=i,o=1;o<t.length;o++){var a=-t[o].shift-s-t[o].elem.depth,l=a-(t[o-1].elem.height+t[o-1].elem.depth);s=s+a,n.push({type:"kern",size:l}),n.push(t[o])}return{children:n,depth:i}}var u;if(e.positionType==="top"){for(var c=e.positionData,d=0;d<e.children.length;d++){var f=e.children[d];c-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}u=c}else if(e.positionType==="bottom")u=-e.positionData;else{var h=e.children[0];if(h.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")u=-h.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")u=-h.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:u}},bb=function(e,t){for(var{children:n,depth:i}=yb(e),s=0,o=0;o<n.length;o++){var a=n[o];if(a.type==="elem"){var l=a.elem;s=Math.max(s,l.maxFontSize,l.height)}}s+=2;var u=vt(["pstrut"],[]);u.style.height=_(s);for(var c=[],d=i,f=i,h=i,m=0;m<n.length;m++){var v=n[m];if(v.type==="kern")h+=v.size;else{var y=v.elem,w=v.wrapperClasses||[],k=v.wrapperStyle||{},E=vt(w,[u,y],void 0,k);E.style.top=_(-s-h-y.depth),v.marginLeft&&(E.style.marginLeft=v.marginLeft),v.marginRight&&(E.style.marginRight=v.marginRight),c.push(E),h+=y.height+y.depth}d=Math.min(d,h),f=Math.max(f,h)}var R=vt(["vlist"],c);R.style.height=_(f);var O;if(d<0){var N=vt([],[]),D=vt(["vlist"],[N]);D.style.height=_(-d);var B=vt(["vlist-s"],[new zt("​")]);O=[vt(["vlist-r"],[R,B]),vt(["vlist-r"],[D])]}else O=[vt(["vlist-r"],[R])];var L=vt(["vlist-t"],O);return O.length===2&&L.classes.push("vlist-t2"),L.height=f,L.depth=-d,L},wb=(r,e)=>{var t=vt(["mspace"],[],e),n=Pe(r,e);return t.style.marginRight=_(n),t},ao=function(e,t,n){var i="";switch(e){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=e}var s;return t==="textbf"&&n==="textit"?s="BoldItalic":t==="textbf"?s="Bold":t==="textit"?s="Italic":s="Regular",i+"-"+s},Yf={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Jf={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},xb=function(e,t){var[n,i,s]=Jf[e],o=new Kr(n),a=new gr([o],{width:_(i),height:_(s),style:"width:"+_(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=Gf(["overlay"],[a],t);return l.height=s,l.style.height=_(s),l.style.width=_(i),l},P={fontMap:Yf,makeSymbol:Ht,mathsym:cb,makeSpan:vt,makeSvgSpan:Gf,makeLineSpan:mb,makeAnchor:gb,makeFragment:Kf,wrapFragment:vb,makeVList:bb,makeOrd:hb,makeGlue:wb,staticSvg:xb,svgData:Jf,tryCombineChars:pb},ze={number:3,unit:"mu"},xn={number:4,unit:"mu"},yr={number:5,unit:"mu"},Sb={mord:{mop:ze,mbin:xn,mrel:yr,minner:ze},mop:{mord:ze,mop:ze,mrel:yr,minner:ze},mbin:{mord:xn,mop:xn,mopen:xn,minner:xn},mrel:{mord:yr,mop:yr,mopen:yr,minner:yr},mopen:{},mclose:{mop:ze,mbin:xn,mrel:yr,minner:ze},mpunct:{mord:ze,mop:ze,mrel:yr,mopen:ze,mclose:ze,mpunct:ze,minner:ze},minner:{mord:ze,mop:ze,mbin:xn,mrel:yr,mopen:ze,mpunct:ze,minner:ze}},kb={mord:{mop:ze},mop:{mord:ze,mop:ze},mbin:{},mrel:{},mopen:{},mclose:{mop:ze},mpunct:{},minner:{mop:ze}},Xf={},lo={},uo={};function Y(r){for(var{type:e,names:t,props:n,handler:i,htmlBuilder:s,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},l=0;l<t.length;++l)Xf[t[l]]=a;e&&(s&&(lo[e]=s),o&&(uo[e]=o))}function Sn(r){var{type:e,htmlBuilder:t,mathmlBuilder:n}=r;Y({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:t,mathmlBuilder:n})}var co=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},je=function(e){return e.type==="ordgroup"?e.body:[e]},br=P.makeSpan,Tb=["leftmost","mbin","mopen","mrel","mop","mpunct"],Mb=["rightmost","mrel","mclose","mpunct"],Cb={display:oe.DISPLAY,text:oe.TEXT,script:oe.SCRIPT,scriptscript:oe.SCRIPTSCRIPT},Eb={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Ge=function(e,t,n,i){i===void 0&&(i=[null,null]);for(var s=[],o=0;o<e.length;o++){var a=ge(e[o],t);if(a instanceof Ri){var l=a.children;s.push(...l)}else s.push(a)}if(P.tryCombineChars(s),!n)return s;var u=t;if(e.length===1){var c=e[0];c.type==="sizing"?u=t.havingSize(c.size):c.type==="styling"&&(u=t.havingStyle(Cb[c.style]))}var d=br([i[0]||"leftmost"],[],t),f=br([i[1]||"rightmost"],[],t),h=n==="root";return Zf(s,(m,v)=>{var y=v.classes[0],w=m.classes[0];y==="mbin"&&Mb.includes(w)?v.classes[0]="mord":w==="mbin"&&Tb.includes(y)&&(m.classes[0]="mord")},{node:d},f,h),Zf(s,(m,v)=>{var y=$l(v),w=$l(m),k=y&&w?m.hasClass("mtight")?kb[y][w]:Sb[y][w]:null;if(k)return P.makeGlue(k,u)},{node:d},f,h),s},Zf=function r(e,t,n,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var a=e[o],l=Qf(a);if(l){r(l.children,t,n,null,s);continue}var u=!a.hasClass("mspace");if(u){var c=t(a,n.node);c&&(n.insertAfter?n.insertAfter(c):(e.unshift(c),o++))}u?n.node=a:s&&a.hasClass("newline")&&(n.node=br(["leftmost"])),n.insertAfter=(d=>f=>{e.splice(d+1,0,f),o++})(o)}i&&e.pop()},Qf=function(e){return e instanceof Ri||e instanceof Dl||e instanceof Pi&&e.hasClass("enclosing")?e:null},Ab=function r(e,t){var n=Qf(e);if(n){var i=n.children;if(i.length){if(t==="right")return r(i[i.length-1],"right");if(t==="left")return r(i[0],"left")}}return e},$l=function(e,t){return e?(t&&(e=Ab(e,t)),Eb[e.classes[0]]||null):null},zi=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return br(t.concat(n))},ge=function(e,t,n){if(!e)return br();if(lo[e.type]){var i=lo[e.type](e,t);if(n&&t.size!==n.size){i=br(t.sizingClasses(n),[i],t);var s=t.sizeMultiplier/n.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new j("Got group of unknown type: '"+e.type+"'")};function ho(r,e){var t=br(["base"],r,e),n=br(["strut"]);return n.style.height=_(t.height+t.depth),t.depth&&(n.style.verticalAlign=_(-t.depth)),t.children.unshift(n),t}function Hl(r,e){var t=null;r.length===1&&r[0].type==="tag"&&(t=r[0].tag,r=r[0].body);var n=Ge(r,e,"root"),i;n.length===2&&n[1].hasClass("tag")&&(i=n.pop());for(var s=[],o=[],a=0;a<n.length;a++)if(o.push(n[a]),n[a].hasClass("mbin")||n[a].hasClass("mrel")||n[a].hasClass("allowbreak")){for(var l=!1;a<n.length-1&&n[a+1].hasClass("mspace")&&!n[a+1].hasClass("newline");)a++,o.push(n[a]),n[a].hasClass("nobreak")&&(l=!0);l||(s.push(ho(o,e)),o=[])}else n[a].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(ho(o,e)),o=[]),s.push(n[a]));o.length>0&&s.push(ho(o,e));var u;t?(u=ho(Ge(t,e,!0)),u.classes=["tag"],s.push(u)):i&&s.push(i);var c=br(["katex-html"],s);if(c.setAttribute("aria-hidden","true"),u){var d=u.children[0];d.style.height=_(c.height+c.depth),c.depth&&(d.style.verticalAlign=_(-c.depth))}return c}function ep(r){return new Ri(r)}class Ct{constructor(e,t,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=Gr(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof Xt&&this.children[n+1]instanceof Xt){for(var i=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof Xt;)i+=this.children[++n].toText();e.appendChild(new Xt(i).toNode())}else e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=ye.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+ye.escape(Gr(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Xt{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return ye.escape(this.toText())}toText(){return this.text}}class Ob{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",_(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+_(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var H={MathNode:Ct,TextNode:Xt,SpaceNode:Ob,newDocumentFragment:ep},Lt=function(e,t,n){return Ne[t][e]&&Ne[t][e].replace&&e.charCodeAt(0)!==55349&&!(Vf.hasOwnProperty(e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(e=Ne[t][e].replace),new H.TextNode(e)},Vl=function(e){return e.length===1?e[0]:new H.MathNode("mrow",e)},jl=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";var n=t.font;if(!n||n==="mathnormal")return null;var i=e.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var s=e.text;if(["\\imath","\\jmath"].includes(s))return null;Ne[i][s]&&Ne[i][s].replace&&(s=Ne[i][s].replace);var o=P.fontMap[n].fontName;return Al(s,o,i)?P.fontMap[n].variant:null};function ql(r){if(!r)return!1;if(r.type==="mi"&&r.children.length===1){var e=r.children[0];return e instanceof Xt&&e.text==="."}else if(r.type==="mo"&&r.children.length===1&&r.getAttribute("separator")==="true"&&r.getAttribute("lspace")==="0em"&&r.getAttribute("rspace")==="0em"){var t=r.children[0];return t instanceof Xt&&t.text===","}else return!1}var yt=function(e,t,n){if(e.length===1){var i=Oe(e[0],t);return n&&i instanceof Ct&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,a=0;a<e.length;a++){var l=Oe(e[a],t);if(l instanceof Ct&&o instanceof Ct){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(ql(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&ql(o))l.children=[...o.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||ql(o))){var u=l.children[0];u instanceof Ct&&u.type==="mn"&&(u.children=[...o.children,...u.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var c=o.children[0];if(c instanceof Xt&&c.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof Xt&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),s.pop())}}}s.push(l),o=l}return s},Jr=function(e,t,n){return Vl(yt(e,t,n))},Oe=function(e,t){if(!e)return new H.MathNode("mrow");if(uo[e.type]){var n=uo[e.type](e,t);return n}else throw new j("Got group of unknown type: '"+e.type+"'")};function tp(r,e,t,n,i){var s=yt(r,t),o;s.length===1&&s[0]instanceof Ct&&["mrow","mtable"].includes(s[0].type)?o=s[0]:o=new H.MathNode("mrow",s);var a=new H.MathNode("annotation",[new H.TextNode(e)]);a.setAttribute("encoding","application/x-tex");var l=new H.MathNode("semantics",[o,a]),u=new H.MathNode("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&u.setAttribute("display","block");var c=i?"katex":"katex-mathml";return P.makeSpan([c],[u])}var rp=function(e){return new mr({style:e.displayMode?oe.DISPLAY:oe.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},np=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=P.makeSpan(n,[e])}return e},Nb=function(e,t,n){var i=rp(n),s;if(n.output==="mathml")return tp(e,t,i,n.displayMode,!0);if(n.output==="html"){var o=Hl(e,i);s=P.makeSpan(["katex"],[o])}else{var a=tp(e,t,i,n.displayMode,!1),l=Hl(e,i);s=P.makeSpan(["katex"],[a,l])}return np(s,n)},Db=function(e,t,n){var i=rp(n),s=Hl(e,i),o=P.makeSpan(["katex"],[s]);return np(o,n)},Ib={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Rb=function(e){var t=new H.MathNode("mo",[new H.TextNode(Ib[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},Pb={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},zb=function(e){return e.type==="ordgroup"?e.body.length:1},Lb=function(e,t){function n(){var a=4e5,l=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(l)){var u=e,c=zb(u.base),d,f,h;if(c>5)l==="widehat"||l==="widecheck"?(d=420,a=2364,h=.42,f=l+"4"):(d=312,a=2340,h=.34,f="tilde4");else{var m=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][m],d=[0,239,300,360,420][m],h=[0,.24,.3,.3,.36,.42][m],f=l+m):(a=[0,600,1033,2339,2340][m],d=[0,260,286,306,312][m],h=[0,.26,.286,.3,.306,.34][m],f="tilde"+m)}var v=new Kr(f),y=new gr([v],{width:"100%",height:_(h),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:P.makeSvgSpan([],[y],t),minWidth:0,height:h}}else{var w=[],k=Pb[l],[E,R,O]=k,N=O/1e3,D=E.length,B,L;if(D===1){var V=k[3];B=["hide-tail"],L=[V]}else if(D===2)B=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(D===3)B=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
861
- `+D+" children.");for(var te=0;te<D;te++){var ne=new Kr(E[te]),he=new gr([ne],{width:"400em",height:_(N),viewBox:"0 0 "+a+" "+O,preserveAspectRatio:L[te]+" slice"}),re=P.makeSvgSpan([B[te]],[he],t);if(D===1)return{span:re,minWidth:R,height:N};re.style.height=_(N),w.push(re)}return{span:P.makeSpan(["stretchy"],w,t),minWidth:R,height:N}}}var{span:i,minWidth:s,height:o}=n();return i.height=o,i.style.height=_(o),s>0&&(i.style.minWidth=_(s)),i},Bb=function(e,t,n,i,s){var o,a=e.height+e.depth+n+i;if(/fbox|color|angl/.test(t)){if(o=P.makeSpan(["stretchy",t],[],s),t==="fbox"){var l=s.color&&s.getColor();l&&(o.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(t)&&u.push(new Il({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&u.push(new Il({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new gr(u,{width:"100%",height:_(a)});o=P.makeSvgSpan([],[c],s)}return o.height=a,o.style.height=_(a),o},wr={encloseSpan:Bb,mathMLnode:Rb,svgSpan:Lb};function pe(r,e){if(!r||r.type!==e)throw new Error("Expected node of type "+e+", but got "+(r?"node of type "+r.type:String(r)));return r}function _l(r){var e=fo(r);if(!e)throw new Error("Expected node of symbol group type, but got "+(r?"node of type "+r.type:String(r)));return e}function fo(r){return r&&(r.type==="atom"||lb.hasOwnProperty(r.type))?r:null}var Wl=(r,e)=>{var t,n,i;r&&r.type==="supsub"?(n=pe(r.base,"accent"),t=n.base,r.base=t,i=ob(ge(r,e)),r.base=n):(n=pe(r,"accent"),t=n.base);var s=ge(t,e.havingCrampedStyle()),o=n.isShifty&&ye.isCharacterBox(t),a=0;if(o){var l=ye.getBaseElem(t),u=ge(l,e.havingCrampedStyle());a=Hf(u).skew}var c=n.label==="\\c",d=c?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),f;if(n.isStretchy)f=wr.svgSpan(n,e),f=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+_(2*a)+")",marginLeft:_(2*a)}:void 0}]},e);else{var h,m;n.label==="\\vec"?(h=P.staticSvg("vec",e),m=P.svgData.vec[1]):(h=P.makeOrd({mode:n.mode,text:n.label},e,"textord"),h=Hf(h),h.italic=0,m=h.width,c&&(d+=h.depth)),f=P.makeSpan(["accent-body"],[h]);var v=n.label==="\\textcircled";v&&(f.classes.push("accent-full"),d=s.height);var y=a;v||(y-=m/2),f.style.left=_(y),n.label==="\\textcircled"&&(f.style.top=".2em"),f=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-d},{type:"elem",elem:f}]},e)}var w=P.makeSpan(["mord","accent"],[f],e);return i?(i.children[0]=w,i.height=Math.max(w.height,i.height),i.classes[0]="mord",i):w},ip=(r,e)=>{var t=r.isStretchy?wr.mathMLnode(r.label):new H.MathNode("mo",[Lt(r.label,r.mode)]),n=new H.MathNode("mover",[Oe(r.base,e),t]);return n.setAttribute("accent","true"),n},Fb=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(r=>"\\"+r).join("|"));Y({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(r,e)=>{var t=co(e[0]),n=!Fb.test(r.funcName),i=!n||r.funcName==="\\widehat"||r.funcName==="\\widetilde"||r.funcName==="\\widecheck";return{type:"accent",mode:r.parser.mode,label:r.funcName,isStretchy:n,isShifty:i,base:t}},htmlBuilder:Wl,mathmlBuilder:ip}),Y({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(r,e)=>{var t=e[0],n=r.parser.mode;return n==="math"&&(r.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+r.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:r.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:Wl,mathmlBuilder:ip}),Y({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"accentUnder",mode:t.mode,label:n,base:i}},htmlBuilder:(r,e)=>{var t=ge(r.base,e),n=wr.svgSpan(r,e),i=r.label==="\\utilde"?.12:0,s=P.makeVList({positionType:"top",positionData:t.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:t}]},e);return P.makeSpan(["mord","accentunder"],[s],e)},mathmlBuilder:(r,e)=>{var t=wr.mathMLnode(r.label),n=new H.MathNode("munder",[Oe(r.base,e),t]);return n.setAttribute("accentunder","true"),n}});var po=r=>{var e=new H.MathNode("mpadded",r?[r]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Y({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n,funcName:i}=r;return{type:"xArrow",mode:n.mode,label:i,body:e[0],below:t[0]}},htmlBuilder(r,e){var t=e.style,n=e.havingStyle(t.sup()),i=P.wrapFragment(ge(r.body,n,e),e),s=r.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var o;r.below&&(n=e.havingStyle(t.sub()),o=P.wrapFragment(ge(r.below,n,e),e),o.classes.push(s+"-arrow-pad"));var a=wr.svgSpan(r,e),l=-e.fontMetrics().axisHeight+.5*a.height,u=-e.fontMetrics().axisHeight-.5*a.height-.111;(i.depth>.25||r.label==="\\xleftequilibrium")&&(u-=i.depth);var c;if(o){var d=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;c=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:a,shift:l},{type:"elem",elem:o,shift:d}]},e)}else c=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:a,shift:l}]},e);return c.children[0].children[0].children[1].classes.push("svg-align"),P.makeSpan(["mrel","x-arrow"],[c],e)},mathmlBuilder(r,e){var t=wr.mathMLnode(r.label);t.setAttribute("minsize",r.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(r.body){var i=po(Oe(r.body,e));if(r.below){var s=po(Oe(r.below,e));n=new H.MathNode("munderover",[t,s,i])}else n=new H.MathNode("mover",[t,i])}else if(r.below){var o=po(Oe(r.below,e));n=new H.MathNode("munder",[t,o])}else n=po(),n=new H.MathNode("mover",[t,n]);return n}});var $b=P.makeSpan;function sp(r,e){var t=Ge(r.body,e,!0);return $b([r.mclass],t,e)}function op(r,e){var t,n=yt(r.body,e);return r.mclass==="minner"?t=new H.MathNode("mpadded",n):r.mclass==="mord"?r.isCharacterBox?(t=n[0],t.type="mi"):t=new H.MathNode("mi",n):(r.isCharacterBox?(t=n[0],t.type="mo"):t=new H.MathNode("mo",n),r.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):r.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):r.mclass==="mopen"||r.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):r.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}Y({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"mclass",mode:t.mode,mclass:"m"+n.slice(5),body:je(i),isCharacterBox:ye.isCharacterBox(i)}},htmlBuilder:sp,mathmlBuilder:op});var mo=r=>{var e=r.type==="ordgroup"&&r.body.length?r.body[0]:r;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Y({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(r,e){var{parser:t}=r;return{type:"mclass",mode:t.mode,mclass:mo(e[0]),body:je(e[1]),isCharacterBox:ye.isCharacterBox(e[1])}}}),Y({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(r,e){var{parser:t,funcName:n}=r,i=e[1],s=e[0],o;n!=="\\stackrel"?o=mo(i):o="mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:je(i)},l={type:"supsub",mode:s.mode,base:a,sup:n==="\\underset"?null:s,sub:n==="\\underset"?s:null};return{type:"mclass",mode:t.mode,mclass:o,body:[l],isCharacterBox:ye.isCharacterBox(l)}},htmlBuilder:sp,mathmlBuilder:op}),Y({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"pmb",mode:t.mode,mclass:mo(e[0]),body:je(e[0])}},htmlBuilder(r,e){var t=Ge(r.body,e,!0),n=P.makeSpan([r.mclass],t,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(r,e){var t=yt(r.body,e),n=new H.MathNode("mstyle",t);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var Hb={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},ap=()=>({type:"styling",body:[],mode:"math",style:"display"}),lp=r=>r.type==="textord"&&r.text==="@",Vb=(r,e)=>(r.type==="mathord"||r.type==="atom")&&r.text===e;function jb(r,e,t){var n=Hb[r];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=t.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:n,mode:"math",family:"rel"},o=t.callFunction("\\Big",[s],[]),a=t.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,o,a]};return t.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function qb(r){var e=[];for(r.gullet.beginGroup(),r.gullet.macros.set("\\cr","\\\\\\relax"),r.gullet.beginGroup();;){e.push(r.parseExpression(!1,"\\\\")),r.gullet.endGroup(),r.gullet.beginGroup();var t=r.fetch().text;if(t==="&"||t==="\\\\")r.consume();else if(t==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new j("Expected \\\\ or \\cr or \\end",r.nextToken)}for(var n=[],i=[n],s=0;s<e.length;s++){for(var o=e[s],a=ap(),l=0;l<o.length;l++)if(!lp(o[l]))a.body.push(o[l]);else{n.push(a),l+=1;var u=_l(o[l]).text,c=new Array(2);if(c[0]={type:"ordgroup",mode:"math",body:[]},c[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(u)>-1))if("<>AV".indexOf(u)>-1)for(var d=0;d<2;d++){for(var f=!0,h=l+1;h<o.length;h++){if(Vb(o[h],u)){f=!1,l=h;break}if(lp(o[h]))throw new j("Missing a "+u+" character to complete a CD arrow.",o[h]);c[d].body.push(o[h])}if(f)throw new j("Missing a "+u+" character to complete a CD arrow.",o[l])}else throw new j('Expected one of "<>AV=|." after @',o[l]);var m=jb(u,c,r),v={type:"styling",body:[m],mode:"math",style:"display"};n.push(v),a=ap()}s%2===0?n.push(a):n.shift(),n=[],i.push(n)}r.gullet.endGroup(),r.gullet.endGroup();var y=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:y,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}Y({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"cdlabel",mode:t.mode,side:n.slice(4),label:e[0]}},htmlBuilder(r,e){var t=e.havingStyle(e.style.sup()),n=P.wrapFragment(ge(r.label,t,e),e);return n.classes.push("cd-label-"+r.side),n.style.bottom=_(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(r,e){var t=new H.MathNode("mrow",[Oe(r.label,e)]);return t=new H.MathNode("mpadded",[t]),t.setAttribute("width","0"),r.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new H.MathNode("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}}),Y({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(r,e){var{parser:t}=r;return{type:"cdlabelparent",mode:t.mode,fragment:e[0]}},htmlBuilder(r,e){var t=P.wrapFragment(ge(r.fragment,e),e);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(r,e){return new H.MathNode("mrow",[Oe(r.fragment,e)])}}),Y({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(r,e){for(var{parser:t}=r,n=pe(e[0],"ordgroup"),i=n.body,s="",o=0;o<i.length;o++){var a=pe(i[o],"textord");s+=a.text}var l=parseInt(s),u;if(isNaN(l))throw new j("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new j("\\@char with invalid code point "+s);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:t.mode,text:u}}});var up=(r,e)=>{var t=Ge(r.body,e.withColor(r.color),!1);return P.makeFragment(t)},cp=(r,e)=>{var t=yt(r.body,e.withColor(r.color)),n=new H.MathNode("mstyle",t);return n.setAttribute("mathcolor",r.color),n};Y({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(r,e){var{parser:t}=r,n=pe(e[0],"color-token").color,i=e[1];return{type:"color",mode:t.mode,color:n,body:je(i)}},htmlBuilder:up,mathmlBuilder:cp}),Y({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(r,e){var{parser:t,breakOnTokenText:n}=r,i=pe(e[0],"color-token").color;t.gullet.macros.set("\\current@color",i);var s=t.parseExpression(!0,n);return{type:"color",mode:t.mode,color:i,body:s}},htmlBuilder:up,mathmlBuilder:cp}),Y({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(r,e,t){var{parser:n}=r,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,s=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:s,size:i&&pe(i,"size").value}},htmlBuilder(r,e){var t=P.makeSpan(["mspace"],[],e);return r.newLine&&(t.classes.push("newline"),r.size&&(t.style.marginTop=_(Pe(r.size,e)))),t},mathmlBuilder(r,e){var t=new H.MathNode("mspace");return r.newLine&&(t.setAttribute("linebreak","newline"),r.size&&t.setAttribute("height",_(Pe(r.size,e)))),t}});var Ul={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},dp=r=>{var e=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new j("Expected a control sequence",r);return e},_b=r=>{var e=r.gullet.popToken();return e.text==="="&&(e=r.gullet.popToken(),e.text===" "&&(e=r.gullet.popToken())),e},hp=(r,e,t,n)=>{var i=r.gullet.macros.get(t.text);i==null&&(t.noexpand=!0,i={tokens:[t],numArgs:0,unexpandable:!r.gullet.isExpandable(t.text)}),r.gullet.macros.set(e,i,n)};Y({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(r){var{parser:e,funcName:t}=r;e.consumeSpaces();var n=e.fetch();if(Ul[n.text])return(t==="\\global"||t==="\\\\globallong")&&(n.text=Ul[n.text]),pe(e.parseFunction(),"internal");throw new j("Invalid token after macro prefix",n)}}),Y({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=e.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new j("Expected a control sequence",n);for(var s=0,o,a=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),a[s].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new j('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==s+1)throw new j('Argument number "'+n.text+'" out of order');s++,a.push([])}else{if(n.text==="EOF")throw new j("Expected a macro definition");a[s].push(n.text)}var{tokens:l}=e.gullet.consumeArg();return o&&l.unshift(o),(t==="\\edef"||t==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:a},t===Ul[t]),{type:"internal",mode:e.mode}}}),Y({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=dp(e.gullet.popToken());e.gullet.consumeSpaces();var i=_b(e);return hp(e,n,i,t==="\\\\globallet"),{type:"internal",mode:e.mode}}}),Y({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=dp(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return hp(e,n,s,t==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var Li=function(e,t,n){var i=Ne.math[e]&&Ne.math[e].replace,s=Al(i||e,t,n);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return s},Gl=function(e,t,n,i){var s=n.havingBaseStyle(t),o=P.makeSpan(i.concat(s.sizingClasses(n)),[e],n),a=s.sizeMultiplier/n.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=s.sizeMultiplier,o},fp=function(e,t,n){var i=t.havingBaseStyle(n),s=(1-t.sizeMultiplier/i.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=_(s),e.height-=s,e.depth+=s},Wb=function(e,t,n,i,s,o){var a=P.makeSymbol(e,"Main-Regular",s,i),l=Gl(a,t,i,o);return n&&fp(l,i,t),l},Ub=function(e,t,n,i){return P.makeSymbol(e,"Size"+t+"-Regular",n,i)},pp=function(e,t,n,i,s,o){var a=Ub(e,t,s,i),l=Gl(P.makeSpan(["delimsizing","size"+t],[a],i),oe.TEXT,i,o);return n&&fp(l,i,oe.TEXT),l},Kl=function(e,t,n){var i;t==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=P.makeSpan(["delimsizinginner",i],[P.makeSpan([],[P.makeSymbol(e,t,n)])]);return{type:"elem",elem:s}},Yl=function(e,t,n){var i=Jt["Size4-Regular"][e.charCodeAt(0)]?Jt["Size4-Regular"][e.charCodeAt(0)][4]:Jt["Size1-Regular"][e.charCodeAt(0)][4],s=new Kr("inner",X7(e,Math.round(1e3*t))),o=new gr([s],{width:_(i),height:_(t),style:"width:"+_(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),a=P.makeSvgSpan([],[o],n);return a.height=t,a.style.height=_(t),a.style.width=_(i),{type:"elem",elem:a}},Jl=.008,go={type:"kern",size:-1*Jl},Gb=["|","\\lvert","\\rvert","\\vert"],Kb=["\\|","\\lVert","\\rVert","\\Vert"],mp=function(e,t,n,i,s,o){var a,l,u,c,d="",f=0;a=u=c=e,l=null;var h="Size1-Regular";e==="\\uparrow"?u=c="⏐":e==="\\Uparrow"?u=c="‖":e==="\\downarrow"?a=u="⏐":e==="\\Downarrow"?a=u="‖":e==="\\updownarrow"?(a="\\uparrow",u="⏐",c="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",u="‖",c="\\Downarrow"):Gb.includes(e)?(u="∣",d="vert",f=333):Kb.includes(e)?(u="∥",d="doublevert",f=556):e==="["||e==="\\lbrack"?(a="⎡",u="⎢",c="⎣",h="Size4-Regular",d="lbrack",f=667):e==="]"||e==="\\rbrack"?(a="⎤",u="⎥",c="⎦",h="Size4-Regular",d="rbrack",f=667):e==="\\lfloor"||e==="⌊"?(u=a="⎢",c="⎣",h="Size4-Regular",d="lfloor",f=667):e==="\\lceil"||e==="⌈"?(a="⎡",u=c="⎢",h="Size4-Regular",d="lceil",f=667):e==="\\rfloor"||e==="⌋"?(u=a="⎥",c="⎦",h="Size4-Regular",d="rfloor",f=667):e==="\\rceil"||e==="⌉"?(a="⎤",u=c="⎥",h="Size4-Regular",d="rceil",f=667):e==="("||e==="\\lparen"?(a="⎛",u="⎜",c="⎝",h="Size4-Regular",d="lparen",f=875):e===")"||e==="\\rparen"?(a="⎞",u="⎟",c="⎠",h="Size4-Regular",d="rparen",f=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",c="⎩",u="⎪",h="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",c="⎭",u="⎪",h="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",c="⎩",u="⎪",h="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",c="⎭",u="⎪",h="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",c="⎭",u="⎪",h="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",c="⎩",u="⎪",h="Size4-Regular");var m=Li(a,h,s),v=m.height+m.depth,y=Li(u,h,s),w=y.height+y.depth,k=Li(c,h,s),E=k.height+k.depth,R=0,O=1;if(l!==null){var N=Li(l,h,s);R=N.height+N.depth,O=2}var D=v+E+R,B=Math.max(0,Math.ceil((t-D)/(O*w))),L=D+B*O*w,V=i.fontMetrics().axisHeight;n&&(V*=i.sizeMultiplier);var te=L/2-V,ne=[];if(d.length>0){var he=L-v-E,re=Math.round(L*1e3),G=Z7(d,Math.round(he*1e3)),X=new Kr(d,G),ve=(f/1e3).toFixed(3)+"em",ee=(re/1e3).toFixed(3)+"em",Se=new gr([X],{width:ve,height:ee,viewBox:"0 0 "+f+" "+re}),C=P.makeSvgSpan([],[Se],i);C.height=re/1e3,C.style.width=ve,C.style.height=ee,ne.push({type:"elem",elem:C})}else{if(ne.push(Kl(c,h,s)),ne.push(go),l===null){var x=L-v-E+2*Jl;ne.push(Yl(u,x,i))}else{var I=(L-v-E-R)/2+2*Jl;ne.push(Yl(u,I,i)),ne.push(go),ne.push(Kl(l,h,s)),ne.push(go),ne.push(Yl(u,I,i))}ne.push(go),ne.push(Kl(a,h,s))}var q=i.havingBaseStyle(oe.TEXT),W=P.makeVList({positionType:"bottom",positionData:te,children:ne},q);return Gl(P.makeSpan(["delimsizing","mult"],[W],q),oe.TEXT,i,o)},Xl=80,Zl=.08,Ql=function(e,t,n,i,s){var o=J7(e,i,n),a=new Kr(e,o),l=new gr([a],{width:"400em",height:_(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return P.makeSvgSpan(["hide-tail"],[l],s)},Yb=function(e,t){var n=t.havingBaseSizing(),i=bp("\\surd",e*n.sizeMultiplier,yp,n),s=n.sizeMultiplier,o=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),a,l=0,u=0,c=0,d;return i.type==="small"?(c=1e3+1e3*o+Xl,e<1?s=1:e<1.4&&(s=.7),l=(1+o+Zl)/s,u=(1+o)/s,a=Ql("sqrtMain",l,c,o,t),a.style.minWidth="0.853em",d=.833/s):i.type==="large"?(c=(1e3+Xl)*Bi[i.size],u=(Bi[i.size]+o)/s,l=(Bi[i.size]+o+Zl)/s,a=Ql("sqrtSize"+i.size,l,c,o,t),a.style.minWidth="1.02em",d=1/s):(l=e+o+Zl,u=e+o,c=Math.floor(1e3*e+o)+Xl,a=Ql("sqrtTall",l,c,o,t),a.style.minWidth="0.742em",d=1.056),a.height=u,a.style.height=_(l),{span:a,advanceWidth:d,ruleWidth:(t.fontMetrics().sqrtRuleThickness+o)*s}},gp=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Jb=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],vp=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Bi=[0,1.2,1.8,2.4,3],Xb=function(e,t,n,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),gp.includes(e)||vp.includes(e))return pp(e,t,!1,n,i,s);if(Jb.includes(e))return mp(e,Bi[t],!1,n,i,s);throw new j("Illegal delimiter: '"+e+"'")},Zb=[{type:"small",style:oe.SCRIPTSCRIPT},{type:"small",style:oe.SCRIPT},{type:"small",style:oe.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Qb=[{type:"small",style:oe.SCRIPTSCRIPT},{type:"small",style:oe.SCRIPT},{type:"small",style:oe.TEXT},{type:"stack"}],yp=[{type:"small",style:oe.SCRIPTSCRIPT},{type:"small",style:oe.SCRIPT},{type:"small",style:oe.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],e8=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},bp=function(e,t,n,i){for(var s=Math.min(2,3-i.style.size),o=s;o<n.length&&n[o].type!=="stack";o++){var a=Li(e,e8(n[o]),"math"),l=a.height+a.depth;if(n[o].type==="small"){var u=i.havingBaseStyle(n[o].style);l*=u.sizeMultiplier}if(l>t)return n[o]}return n[n.length-1]},wp=function(e,t,n,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;vp.includes(e)?a=Zb:gp.includes(e)?a=yp:a=Qb;var l=bp(e,t,a,i);return l.type==="small"?Wb(e,l.style,n,i,s,o):l.type==="large"?pp(e,l.size,n,i,s,o):mp(e,t,n,i,s,o)},t8=function(e,t,n,i,s,o){var a=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,u=5/i.fontMetrics().ptPerEm,c=Math.max(t-a,n+a),d=Math.max(c/500*l,2*c-u);return wp(e,d,!0,i,s,o)},xr={sqrtImage:Yb,sizedDelim:Xb,sizeToMaxHeight:Bi,customSizedDelim:wp,leftRightDelim:t8},xp={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},r8=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function vo(r,e){var t=fo(r);if(t&&r8.includes(t.text))return t;throw t?new j("Invalid delimiter '"+t.text+"' after '"+e.funcName+"'",r):new j("Invalid delimiter type '"+r.type+"'",r)}Y({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(r,e)=>{var t=vo(e[0],r);return{type:"delimsizing",mode:r.parser.mode,size:xp[r.funcName].size,mclass:xp[r.funcName].mclass,delim:t.text}},htmlBuilder:(r,e)=>r.delim==="."?P.makeSpan([r.mclass]):xr.sizedDelim(r.delim,r.size,e,r.mode,[r.mclass]),mathmlBuilder:r=>{var e=[];r.delim!=="."&&e.push(Lt(r.delim,r.mode));var t=new H.MathNode("mo",e);r.mclass==="mopen"||r.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var n=_(xr.sizeToMaxHeight[r.size]);return t.setAttribute("minsize",n),t.setAttribute("maxsize",n),t}});function Sp(r){if(!r.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Y({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=r.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new j("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:r.parser.mode,delim:vo(e[0],r).text,color:t}}}),Y({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=vo(e[0],r),n=r.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var s=pe(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:t.text,right:s.delim,rightColor:s.color}},htmlBuilder:(r,e)=>{Sp(r);for(var t=Ge(r.body,e,!0,["mopen","mclose"]),n=0,i=0,s=!1,o=0;o<t.length;o++)t[o].isMiddle?s=!0:(n=Math.max(t[o].height,n),i=Math.max(t[o].depth,i));n*=e.sizeMultiplier,i*=e.sizeMultiplier;var a;if(r.left==="."?a=zi(e,["mopen"]):a=xr.leftRightDelim(r.left,n,i,e,r.mode,["mopen"]),t.unshift(a),s)for(var l=1;l<t.length;l++){var u=t[l],c=u.isMiddle;c&&(t[l]=xr.leftRightDelim(c.delim,n,i,c.options,r.mode,[]))}var d;if(r.right===".")d=zi(e,["mclose"]);else{var f=r.rightColor?e.withColor(r.rightColor):e;d=xr.leftRightDelim(r.right,n,i,f,r.mode,["mclose"])}return t.push(d),P.makeSpan(["minner"],t,e)},mathmlBuilder:(r,e)=>{Sp(r);var t=yt(r.body,e);if(r.left!=="."){var n=new H.MathNode("mo",[Lt(r.left,r.mode)]);n.setAttribute("fence","true"),t.unshift(n)}if(r.right!=="."){var i=new H.MathNode("mo",[Lt(r.right,r.mode)]);i.setAttribute("fence","true"),r.rightColor&&i.setAttribute("mathcolor",r.rightColor),t.push(i)}return Vl(t)}}),Y({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=vo(e[0],r);if(!r.parser.leftrightDepth)throw new j("\\middle without preceding \\left",t);return{type:"middle",mode:r.parser.mode,delim:t.text}},htmlBuilder:(r,e)=>{var t;if(r.delim===".")t=zi(e,[]);else{t=xr.sizedDelim(r.delim,1,e,r.mode,[]);var n={delim:r.delim,options:e};t.isMiddle=n}return t},mathmlBuilder:(r,e)=>{var t=r.delim==="\\vert"||r.delim==="|"?Lt("|","text"):Lt(r.delim,r.mode),n=new H.MathNode("mo",[t]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var e0=(r,e)=>{var t=P.wrapFragment(ge(r.body,e),e),n=r.label.slice(1),i=e.sizeMultiplier,s,o=0,a=ye.isCharacterBox(r.body);if(n==="sout")s=P.makeSpan(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var l=Pe({number:.6,unit:"pt"},e),u=Pe({number:.35,unit:"ex"},e),c=e.havingBaseSizing();i=i/c.sizeMultiplier;var d=t.height+t.depth+l+u;t.style.paddingLeft=_(d/2+l);var f=Math.floor(1e3*d*i),h=K7(f),m=new gr([new Kr("phase",h)],{width:"400em",height:_(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});s=P.makeSvgSpan(["hide-tail"],[m],e),s.style.height=_(d),o=t.depth+l+u}else{/cancel/.test(n)?a||t.classes.push("cancel-pad"):n==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var v=0,y=0,w=0;/box/.test(n)?(w=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),v=e.fontMetrics().fboxsep+(n==="colorbox"?0:w),y=v):n==="angl"?(w=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),v=4*w,y=Math.max(0,.25-t.depth)):(v=a?.2:0,y=v),s=wr.encloseSpan(t,n,v,y,e),/fbox|boxed|fcolorbox/.test(n)?(s.style.borderStyle="solid",s.style.borderWidth=_(w)):n==="angl"&&w!==.049&&(s.style.borderTopWidth=_(w),s.style.borderRightWidth=_(w)),o=t.depth+y,r.backgroundColor&&(s.style.backgroundColor=r.backgroundColor,r.borderColor&&(s.style.borderColor=r.borderColor))}var k;if(r.backgroundColor)k=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:o},{type:"elem",elem:t,shift:0}]},e);else{var E=/cancel|phase/.test(n)?["svg-align"]:[];k=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:s,shift:o,wrapperClasses:E}]},e)}return/cancel/.test(n)&&(k.height=t.height,k.depth=t.depth),/cancel/.test(n)&&!a?P.makeSpan(["mord","cancel-lap"],[k],e):P.makeSpan(["mord"],[k],e)},t0=(r,e)=>{var t=0,n=new H.MathNode(r.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Oe(r.body,e)]);switch(r.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*t+"pt"),n.setAttribute("height","+"+2*t+"pt"),n.setAttribute("lspace",t+"pt"),n.setAttribute("voffset",t+"pt"),r.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+i+"em solid "+String(r.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return r.backgroundColor&&n.setAttribute("mathbackground",r.backgroundColor),n};Y({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(r,e,t){var{parser:n,funcName:i}=r,s=pe(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:e0,mathmlBuilder:t0}),Y({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(r,e,t){var{parser:n,funcName:i}=r,s=pe(e[0],"color-token").color,o=pe(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:o,borderColor:s,body:a}},htmlBuilder:e0,mathmlBuilder:t0}),Y({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\fbox",body:e[0]}}}),Y({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"enclose",mode:t.mode,label:n,body:i}},htmlBuilder:e0,mathmlBuilder:t0}),Y({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\angl",body:e[0]}}});var kp={};function Zt(r){for(var{type:e,names:t,props:n,handler:i,htmlBuilder:s,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<t.length;++l)kp[t[l]]=a;s&&(lo[e]=s),o&&(uo[e]=o)}var Tp={};function S(r,e){Tp[r]=e}function Mp(r){var e=[];r.consumeSpaces();var t=r.fetch().text;for(t==="\\relax"&&(r.consume(),r.consumeSpaces(),t=r.fetch().text);t==="\\hline"||t==="\\hdashline";)r.consume(),e.push(t==="\\hdashline"),r.consumeSpaces(),t=r.fetch().text;return e}var yo=r=>{var e=r.parser.settings;if(!e.displayMode)throw new j("{"+r.envName+"} can be used only in display mode.")};function r0(r){if(r.indexOf("ed")===-1)return r.indexOf("*")===-1}function Xr(r,e,t){var{hskipBeforeAndAfter:n,addJot:i,cols:s,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:u,emptySingleRow:c,maxNumCols:d,leqno:f}=e;if(r.gullet.beginGroup(),u||r.gullet.macros.set("\\cr","\\\\\\relax"),!o){var h=r.gullet.expandMacroAsText("\\arraystretch");if(h==null)o=1;else if(o=parseFloat(h),!o||o<0)throw new j("Invalid \\arraystretch: "+h)}r.gullet.beginGroup();var m=[],v=[m],y=[],w=[],k=l!=null?[]:void 0;function E(){l&&r.gullet.macros.set("\\@eqnsw","1",!0)}function R(){k&&(r.gullet.macros.get("\\df@tag")?(k.push(r.subparse([new Tt("\\df@tag")])),r.gullet.macros.set("\\df@tag",void 0,!0)):k.push(!!l&&r.gullet.macros.get("\\@eqnsw")==="1"))}for(E(),w.push(Mp(r));;){var O=r.parseExpression(!1,u?"\\end":"\\\\");r.gullet.endGroup(),r.gullet.beginGroup(),O={type:"ordgroup",mode:r.mode,body:O},t&&(O={type:"styling",mode:r.mode,style:t,body:[O]}),m.push(O);var N=r.fetch().text;if(N==="&"){if(d&&m.length===d){if(u||a)throw new j("Too many tab characters: &",r.nextToken);r.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}r.consume()}else if(N==="\\end"){R(),m.length===1&&O.type==="styling"&&O.body[0].body.length===0&&(v.length>1||!c)&&v.pop(),w.length<v.length+1&&w.push([]);break}else if(N==="\\\\"){r.consume();var D=void 0;r.gullet.future().text!==" "&&(D=r.parseSizeGroup(!0)),y.push(D?D.value:null),R(),w.push(Mp(r)),m=[],v.push(m),E()}else throw new j("Expected & or \\\\ or \\cr or \\end",r.nextToken)}return r.gullet.endGroup(),r.gullet.endGroup(),{type:"array",mode:r.mode,addJot:i,arraystretch:o,body:v,cols:s,rowGaps:y,hskipBeforeAndAfter:n,hLinesBeforeRow:w,colSeparationType:a,tags:k,leqno:f}}function n0(r){return r.slice(0,1)==="d"?"display":"text"}var Qt=function(e,t){var n,i,s=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(s),u=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),d=1/t.fontMetrics().ptPerEm,f=5*d;if(e.colSeparationType&&e.colSeparationType==="small"){var h=t.havingStyle(oe.SCRIPT).sizeMultiplier;f=.2778*(h/t.sizeMultiplier)}var m=e.colSeparationType==="CD"?Pe({number:3,unit:"ex"},t):12*d,v=3*d,y=e.arraystretch*m,w=.7*y,k=.3*y,E=0;function R(kn){for(var tn=0;tn<kn.length;++tn)tn>0&&(E+=.25),u.push({pos:E,isDashed:kn[tn]})}for(R(o[0]),n=0;n<e.body.length;++n){var O=e.body[n],N=w,D=k;a<O.length&&(a=O.length);var B=new Array(O.length);for(i=0;i<O.length;++i){var L=ge(O[i],t);D<L.depth&&(D=L.depth),N<L.height&&(N=L.height),B[i]=L}var V=e.rowGaps[n],te=0;V&&(te=Pe(V,t),te>0&&(te+=k,D<te&&(D=te),te=0)),e.addJot&&(D+=v),B.height=N,B.depth=D,E+=N,B.pos=E,E+=D+te,l[n]=B,R(o[n+1])}var ne=E/2+t.fontMetrics().axisHeight,he=e.cols||[],re=[],G,X,ve=[];if(e.tags&&e.tags.some(kn=>kn))for(n=0;n<s;++n){var ee=l[n],Se=ee.pos-ne,C=e.tags[n],x=void 0;C===!0?x=P.makeSpan(["eqn-num"],[],t):C===!1?x=P.makeSpan([],[],t):x=P.makeSpan([],Ge(C,t,!0),t),x.depth=ee.depth,x.height=ee.height,ve.push({type:"elem",elem:x,shift:Se})}for(i=0,X=0;i<a||X<he.length;++i,++X){for(var I=he[X]||{},q=!0;I.type==="separator";){if(q||(G=P.makeSpan(["arraycolsep"],[]),G.style.width=_(t.fontMetrics().doubleRuleSep),re.push(G)),I.separator==="|"||I.separator===":"){var W=I.separator==="|"?"solid":"dashed",fe=P.makeSpan(["vertical-separator"],[],t);fe.style.height=_(E),fe.style.borderRightWidth=_(c),fe.style.borderRightStyle=W,fe.style.margin="0 "+_(-c/2);var Le=E-ne;Le&&(fe.style.verticalAlign=_(-Le)),re.push(fe)}else throw new j("Invalid separator type: "+I.separator);X++,I=he[X]||{},q=!1}if(!(i>=a)){var me=void 0;(i>0||e.hskipBeforeAndAfter)&&(me=ye.deflt(I.pregap,f),me!==0&&(G=P.makeSpan(["arraycolsep"],[]),G.style.width=_(me),re.push(G)));var Ue=[];for(n=0;n<s;++n){var At=l[n],en=At[i];if(en){var R0=At.pos-ne;en.depth=At.depth,en.height=At.height,Ue.push({type:"elem",elem:en,shift:R0})}}Ue=P.makeVList({positionType:"individualShift",children:Ue},t),Ue=P.makeSpan(["col-align-"+(I.align||"c")],[Ue]),re.push(Ue),(i<a-1||e.hskipBeforeAndAfter)&&(me=ye.deflt(I.postgap,f),me!==0&&(G=P.makeSpan(["arraycolsep"],[]),G.style.width=_(me),re.push(G)))}}if(l=P.makeSpan(["mtable"],re),u.length>0){for(var P0=P.makeLineSpan("hline",t,c),_t=P.makeLineSpan("hdashline",t,c),ji=[{type:"elem",elem:l,shift:0}];u.length>0;){var Lo=u.pop(),Jn=Lo.pos-ne;Lo.isDashed?ji.push({type:"elem",elem:_t,shift:Jn}):ji.push({type:"elem",elem:P0,shift:Jn})}l=P.makeVList({positionType:"individualShift",children:ji},t)}if(ve.length===0)return P.makeSpan(["mord"],[l],t);var qi=P.makeVList({positionType:"individualShift",children:ve},t);return qi=P.makeSpan(["tag"],[qi],t),P.makeFragment([l,qi])},n8={c:"center ",l:"left ",r:"right "},er=function(e,t){for(var n=[],i=new H.MathNode("mtd",[],["mtr-glue"]),s=new H.MathNode("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var a=e.body[o],l=[],u=0;u<a.length;u++)l.push(new H.MathNode("mtd",[Oe(a[u],t)]));e.tags&&e.tags[o]&&(l.unshift(i),l.push(i),e.leqno?l.unshift(s):l.push(s)),n.push(new H.MathNode("mtr",l))}var c=new H.MathNode("mtable",n),d=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",_(d));var f="",h="";if(e.cols&&e.cols.length>0){var m=e.cols,v="",y=!1,w=0,k=m.length;m[0].type==="separator"&&(f+="top ",w=1),m[m.length-1].type==="separator"&&(f+="bottom ",k-=1);for(var E=w;E<k;E++)m[E].type==="align"?(h+=n8[m[E].align],y&&(v+="none "),y=!0):m[E].type==="separator"&&y&&(v+=m[E].separator==="|"?"solid ":"dashed ",y=!1);c.setAttribute("columnalign",h.trim()),/[sd]/.test(v)&&c.setAttribute("columnlines",v.trim())}if(e.colSeparationType==="align"){for(var R=e.cols||[],O="",N=1;N<R.length;N++)O+=N%2?"0em ":"1em ";c.setAttribute("columnspacing",O.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?c.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?c.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var D="",B=e.hLinesBeforeRow;f+=B[0].length>0?"left ":"",f+=B[B.length-1].length>0?"right ":"";for(var L=1;L<B.length-1;L++)D+=B[L].length===0?"none ":B[L][0]?"dashed ":"solid ";return/[sd]/.test(D)&&c.setAttribute("rowlines",D.trim()),f!==""&&(c=new H.MathNode("menclose",[c]),c.setAttribute("notation",f.trim())),e.arraystretch&&e.arraystretch<1&&(c=new H.MathNode("mstyle",[c]),c.setAttribute("scriptlevel","1")),c},Cp=function(e,t){e.envName.indexOf("ed")===-1&&yo(e);var n=[],i=e.envName.indexOf("at")>-1?"alignat":"align",s=e.envName==="split",o=Xr(e.parser,{cols:n,addJot:!0,autoTag:s?void 0:r0(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),a,l=0,u={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&t[0].type==="ordgroup"){for(var c="",d=0;d<t[0].body.length;d++){var f=pe(t[0].body[d],"textord");c+=f.text}a=Number(c),l=a*2}var h=!l;o.body.forEach(function(w){for(var k=1;k<w.length;k+=2){var E=pe(w[k],"styling"),R=pe(E.body[0],"ordgroup");R.body.unshift(u)}if(h)l<w.length&&(l=w.length);else{var O=w.length/2;if(a<O)throw new j("Too many math in a row: "+("expected "+a+", but got "+O),w[0])}});for(var m=0;m<l;++m){var v="r",y=0;m%2===1?v="l":m>0&&h&&(y=1),n[m]={type:"align",align:v,pregap:y,postgap:0}}return o.colSeparationType=h?"align":"alignat",o};Zt({type:"array",names:["array","darray"],props:{numArgs:1},handler(r,e){var t=fo(e[0]),n=t?[e[0]]:pe(e[0],"ordgroup").body,i=n.map(function(o){var a=_l(o),l=a.text;if("lcr".indexOf(l)!==-1)return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new j("Unknown column alignment: "+l,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Xr(r.parser,s,n0(r.envName))},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(r){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[r.envName.replace("*","")],t="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(r.envName.charAt(r.envName.length-1)==="*"){var i=r.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),t=i.fetch().text,"lcr".indexOf(t)===-1)throw new j("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:t}]}}var s=Xr(r.parser,n,n0(r.envName)),o=Math.max(0,...s.body.map(a=>a.length));return s.cols=new Array(o).fill({type:"align",align:t}),e?{type:"leftright",mode:r.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(r){var e={arraystretch:.5},t=Xr(r.parser,e,"script");return t.colSeparationType="small",t},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["subarray"],props:{numArgs:1},handler(r,e){var t=fo(e[0]),n=t?[e[0]]:pe(e[0],"ordgroup").body,i=n.map(function(o){var a=_l(o),l=a.text;if("lc".indexOf(l)!==-1)return{type:"align",align:l};throw new j("Unknown column alignment: "+l,o)});if(i.length>1)throw new j("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=Xr(r.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new j("{subarray} can contain only one column");return s},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(r){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=Xr(r.parser,e,n0(r.envName));return{type:"leftright",mode:r.mode,body:[t],left:r.envName.indexOf("r")>-1?".":"\\{",right:r.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Cp,htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(r){["gather","gather*"].includes(r.envName)&&yo(r);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:r0(r.envName),emptySingleRow:!0,leqno:r.parser.settings.leqno};return Xr(r.parser,e,"display")},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Cp,htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(r){yo(r);var e={autoTag:r0(r.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:r.parser.settings.leqno};return Xr(r.parser,e,"display")},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["CD"],props:{numArgs:0},handler(r){return yo(r),qb(r.parser)},htmlBuilder:Qt,mathmlBuilder:er}),S("\\nonumber","\\gdef\\@eqnsw{0}"),S("\\notag","\\nonumber"),Y({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(r,e){throw new j(r.funcName+" valid only within array environment")}});var Ep=kp;Y({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];if(i.type!=="ordgroup")throw new j("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=pe(i.body[o],"textord").text;if(n==="\\begin"){if(!Ep.hasOwnProperty(s))throw new j("No such environment: "+s,i);var a=Ep[s],{args:l,optArgs:u}=t.parseArguments("\\begin{"+s+"}",a),c={mode:t.mode,envName:s,parser:t},d=a.handler(c,l,u);t.expect("\\end",!1);var f=t.nextToken,h=pe(t.parseFunction(),"environment");if(h.name!==s)throw new j("Mismatch: \\begin{"+s+"} matched by \\end{"+h.name+"}",f);return d}return{type:"environment",mode:t.mode,name:s,nameGroup:i}}});var Ap=(r,e)=>{var t=r.font,n=e.withFont(t);return ge(r.body,n)},Op=(r,e)=>{var t=r.font,n=e.withFont(t);return Oe(r.body,n)},Np={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Y({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=co(e[0]),s=n;return s in Np&&(s=Np[s]),{type:"font",mode:t.mode,font:s.slice(1),body:i}},htmlBuilder:Ap,mathmlBuilder:Op}),Y({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(r,e)=>{var{parser:t}=r,n=e[0],i=ye.isCharacterBox(n);return{type:"mclass",mode:t.mode,mclass:mo(n),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:n}],isCharacterBox:i}}}),Y({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,breakOnTokenText:i}=r,{mode:s}=t,o=t.parseExpression(!0,i),a="math"+n.slice(1);return{type:"font",mode:s,font:a,body:{type:"ordgroup",mode:t.mode,body:o}}},htmlBuilder:Ap,mathmlBuilder:Op});var Dp=(r,e)=>{var t=e;return r==="display"?t=t.id>=oe.SCRIPT.id?t.text():oe.DISPLAY:r==="text"&&t.size===oe.DISPLAY.size?t=oe.TEXT:r==="script"?t=oe.SCRIPT:r==="scriptscript"&&(t=oe.SCRIPTSCRIPT),t},i0=(r,e)=>{var t=Dp(r.size,e.style),n=t.fracNum(),i=t.fracDen(),s;s=e.havingStyle(n);var o=ge(r.numer,s,e);if(r.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}s=e.havingStyle(i);var u=ge(r.denom,s,e),c,d,f;r.hasBarLine?(r.barSize?(d=Pe(r.barSize,e),c=P.makeLineSpan("frac-line",e,d)):c=P.makeLineSpan("frac-line",e),d=c.height,f=c.height):(c=null,d=0,f=e.fontMetrics().defaultRuleThickness);var h,m,v;t.size===oe.DISPLAY.size||r.size==="display"?(h=e.fontMetrics().num1,d>0?m=3*f:m=7*f,v=e.fontMetrics().denom1):(d>0?(h=e.fontMetrics().num2,m=f):(h=e.fontMetrics().num3,m=3*f),v=e.fontMetrics().denom2);var y;if(c){var k=e.fontMetrics().axisHeight;h-o.depth-(k+.5*d)<m&&(h+=m-(h-o.depth-(k+.5*d))),k-.5*d-(u.height-v)<m&&(v+=m-(k-.5*d-(u.height-v)));var E=-(k-.5*d);y=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:u,shift:v},{type:"elem",elem:c,shift:E},{type:"elem",elem:o,shift:-h}]},e)}else{var w=h-o.depth-(u.height-v);w<m&&(h+=.5*(m-w),v+=.5*(m-w)),y=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:u,shift:v},{type:"elem",elem:o,shift:-h}]},e)}s=e.havingStyle(t),y.height*=s.sizeMultiplier/e.sizeMultiplier,y.depth*=s.sizeMultiplier/e.sizeMultiplier;var R;t.size===oe.DISPLAY.size?R=e.fontMetrics().delim1:t.size===oe.SCRIPTSCRIPT.size?R=e.havingStyle(oe.SCRIPT).fontMetrics().delim2:R=e.fontMetrics().delim2;var O,N;return r.leftDelim==null?O=zi(e,["mopen"]):O=xr.customSizedDelim(r.leftDelim,R,!0,e.havingStyle(t),r.mode,["mopen"]),r.continued?N=P.makeSpan([]):r.rightDelim==null?N=zi(e,["mclose"]):N=xr.customSizedDelim(r.rightDelim,R,!0,e.havingStyle(t),r.mode,["mclose"]),P.makeSpan(["mord"].concat(s.sizingClasses(e)),[O,P.makeSpan(["mfrac"],[y]),N],e)},s0=(r,e)=>{var t=new H.MathNode("mfrac",[Oe(r.numer,e),Oe(r.denom,e)]);if(!r.hasBarLine)t.setAttribute("linethickness","0px");else if(r.barSize){var n=Pe(r.barSize,e);t.setAttribute("linethickness",_(n))}var i=Dp(r.size,e.style);if(i.size!==e.style.size){t=new H.MathNode("mstyle",[t]);var s=i.size===oe.DISPLAY.size?"true":"false";t.setAttribute("displaystyle",s),t.setAttribute("scriptlevel","0")}if(r.leftDelim!=null||r.rightDelim!=null){var o=[];if(r.leftDelim!=null){var a=new H.MathNode("mo",[new H.TextNode(r.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),o.push(a)}if(o.push(t),r.rightDelim!=null){var l=new H.MathNode("mo",[new H.TextNode(r.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),o.push(l)}return Vl(o)}return t};Y({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=e[1],o,a=null,l=null,u="auto";switch(n){case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(n){case"\\dfrac":case"\\dbinom":u="display";break;case"\\tfrac":case"\\tbinom":u="text";break}return{type:"genfrac",mode:t.mode,continued:!1,numer:i,denom:s,hasBarLine:o,leftDelim:a,rightDelim:l,size:u,barSize:null}},htmlBuilder:i0,mathmlBuilder:s0}),Y({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=e[1];return{type:"genfrac",mode:t.mode,continued:!0,numer:i,denom:s,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}}),Y({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(r){var{parser:e,funcName:t,token:n}=r,i;switch(t){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:n}}});var Ip=["display","text","script","scriptscript"],Rp=function(e){var t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};Y({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(r,e){var{parser:t}=r,n=e[4],i=e[5],s=co(e[0]),o=s.type==="atom"&&s.family==="open"?Rp(s.text):null,a=co(e[1]),l=a.type==="atom"&&a.family==="close"?Rp(a.text):null,u=pe(e[2],"size"),c,d=null;u.isBlank?c=!0:(d=u.value,c=d.number>0);var f="auto",h=e[3];if(h.type==="ordgroup"){if(h.body.length>0){var m=pe(h.body[0],"textord");f=Ip[Number(m.text)]}}else h=pe(h,"textord"),f=Ip[Number(h.text)];return{type:"genfrac",mode:t.mode,numer:n,denom:i,continued:!1,hasBarLine:c,barSize:d,leftDelim:o,rightDelim:l,size:f}},htmlBuilder:i0,mathmlBuilder:s0}),Y({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(r,e){var{parser:t,funcName:n,token:i}=r;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:pe(e[0],"size").value,token:i}}}),Y({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=R7(pe(e[1],"infix").size),o=e[2],a=s.number>0;return{type:"genfrac",mode:t.mode,numer:i,denom:o,continued:!1,hasBarLine:a,barSize:s,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:i0,mathmlBuilder:s0});var Pp=(r,e)=>{var t=e.style,n,i;r.type==="supsub"?(n=r.sup?ge(r.sup,e.havingStyle(t.sup()),e):ge(r.sub,e.havingStyle(t.sub()),e),i=pe(r.base,"horizBrace")):i=pe(r,"horizBrace");var s=ge(i.base,e.havingBaseStyle(oe.DISPLAY)),o=wr.svgSpan(i,e),a;if(i.isOver?(a=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]},e),a.children[0].children[0].children[1].classes.push("svg-align")):(a=P.makeVList({positionType:"bottom",positionData:s.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]},e),a.children[0].children[0].children[0].classes.push("svg-align")),n){var l=P.makeSpan(["mord",i.isOver?"mover":"munder"],[a],e);i.isOver?a=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]},e):a=P.makeVList({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]},e)}return P.makeSpan(["mord",i.isOver?"mover":"munder"],[a],e)},i8=(r,e)=>{var t=wr.mathMLnode(r.label);return new H.MathNode(r.isOver?"mover":"munder",[Oe(r.base,e),t])};Y({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"horizBrace",mode:t.mode,label:n,isOver:/^\\over/.test(n),base:e[0]}},htmlBuilder:Pp,mathmlBuilder:i8}),Y({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[1],i=pe(e[0],"url").url;return t.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:t.mode,href:i,body:je(n)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(r,e)=>{var t=Ge(r.body,e,!1);return P.makeAnchor(r.href,[],t,e)},mathmlBuilder:(r,e)=>{var t=Jr(r.body,e);return t instanceof Ct||(t=new Ct("mrow",[t])),t.setAttribute("href",r.href),t}}),Y({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=pe(e[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:n}))return t.formatUnsupportedCmd("\\url");for(var i=[],s=0;s<n.length;s++){var o=n[s];o==="~"&&(o="\\textasciitilde"),i.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:t.mode,font:"\\texttt",body:i};return{type:"href",mode:t.mode,href:n,body:je(a)}}}),Y({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(r,e){var{parser:t}=r;return{type:"hbox",mode:t.mode,body:je(e[0])}},htmlBuilder(r,e){var t=Ge(r.body,e,!1);return P.makeFragment(t)},mathmlBuilder(r,e){return new H.MathNode("mrow",yt(r.body,e))}}),Y({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,token:i}=r,s=pe(e[0],"raw").string,o=e[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(n){case"\\htmlClass":l.class=s,a={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,a={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,a={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var u=s.split(","),c=0;c<u.length;c++){var d=u[c],f=d.indexOf("=");if(f<0)throw new j("\\htmlData key/value '"+d+"' missing equals sign");var h=d.slice(0,f),m=d.slice(f+1);l["data-"+h.trim()]=m}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return t.settings.isTrusted(a)?{type:"html",mode:t.mode,attributes:l,body:je(o)}:t.formatUnsupportedCmd(n)},htmlBuilder:(r,e)=>{var t=Ge(r.body,e,!1),n=["enclosing"];r.attributes.class&&n.push(...r.attributes.class.trim().split(/\s+/));var i=P.makeSpan(n,t,e);for(var s in r.attributes)s!=="class"&&r.attributes.hasOwnProperty(s)&&i.setAttribute(s,r.attributes[s]);return i},mathmlBuilder:(r,e)=>Jr(r.body,e)}),Y({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"htmlmathml",mode:t.mode,html:je(e[0]),mathml:je(e[1])}},htmlBuilder:(r,e)=>{var t=Ge(r.html,e,!1);return P.makeFragment(t)},mathmlBuilder:(r,e)=>Jr(r.mathml,e)});var o0=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new j("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!Lf(n))throw new j("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};Y({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(r,e,t)=>{var{parser:n}=r,i={number:0,unit:"em"},s={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(t[0])for(var l=pe(t[0],"raw").string,u=l.split(","),c=0;c<u.length;c++){var d=u[c].split("=");if(d.length===2){var f=d[1].trim();switch(d[0].trim()){case"alt":a=f;break;case"width":i=o0(f);break;case"height":s=o0(f);break;case"totalheight":o=o0(f);break;default:throw new j("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var h=pe(e[0],"url").url;return a===""&&(a=h,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:h})?{type:"includegraphics",mode:n.mode,alt:a,width:i,height:s,totalheight:o,src:h}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(r,e)=>{var t=Pe(r.height,e),n=0;r.totalheight.number>0&&(n=Pe(r.totalheight,e)-t);var i=0;r.width.number>0&&(i=Pe(r.width,e));var s={height:_(t+n)};i>0&&(s.width=_(i)),n>0&&(s.verticalAlign=_(-n));var o=new ib(r.src,r.alt,s);return o.height=t,o.depth=n,o},mathmlBuilder:(r,e)=>{var t=new H.MathNode("mglyph",[]);t.setAttribute("alt",r.alt);var n=Pe(r.height,e),i=0;if(r.totalheight.number>0&&(i=Pe(r.totalheight,e)-n,t.setAttribute("valign",_(-i))),t.setAttribute("height",_(n+i)),r.width.number>0){var s=Pe(r.width,e);t.setAttribute("width",_(s))}return t.setAttribute("src",r.src),t}}),Y({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,i=pe(e[0],"size");if(t.settings.strict){var s=n[1]==="m",o=i.value.unit==="mu";s?(o||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):o&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:i.value}},htmlBuilder(r,e){return P.makeGlue(r.dimension,e)},mathmlBuilder(r,e){var t=Pe(r.dimension,e);return new H.SpaceNode(t)}}),Y({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"lap",mode:t.mode,alignment:n.slice(5),body:i}},htmlBuilder:(r,e)=>{var t;r.alignment==="clap"?(t=P.makeSpan([],[ge(r.body,e)]),t=P.makeSpan(["inner"],[t],e)):t=P.makeSpan(["inner"],[ge(r.body,e)]);var n=P.makeSpan(["fix"],[]),i=P.makeSpan([r.alignment],[t,n],e),s=P.makeSpan(["strut"]);return s.style.height=_(i.height+i.depth),i.depth&&(s.style.verticalAlign=_(-i.depth)),i.children.unshift(s),i=P.makeSpan(["thinbox"],[i],e),P.makeSpan(["mord","vbox"],[i],e)},mathmlBuilder:(r,e)=>{var t=new H.MathNode("mpadded",[Oe(r.body,e)]);if(r.alignment!=="rlap"){var n=r.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",n+"width")}return t.setAttribute("width","0px"),t}}),Y({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){var{funcName:t,parser:n}=r,i=n.mode;n.switchMode("math");var s=t==="\\("?"\\)":"$",o=n.parseExpression(!1,s);return n.expect(s),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",body:o}}}),Y({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){throw new j("Mismatched "+r.funcName)}});var zp=(r,e)=>{switch(e.style.size){case oe.DISPLAY.size:return r.display;case oe.TEXT.size:return r.text;case oe.SCRIPT.size:return r.script;case oe.SCRIPTSCRIPT.size:return r.scriptscript;default:return r.text}};Y({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"mathchoice",mode:t.mode,display:je(e[0]),text:je(e[1]),script:je(e[2]),scriptscript:je(e[3])}},htmlBuilder:(r,e)=>{var t=zp(r,e),n=Ge(t,e,!1);return P.makeFragment(n)},mathmlBuilder:(r,e)=>{var t=zp(r,e);return Jr(t,e)}});var Lp=(r,e,t,n,i,s,o)=>{r=P.makeSpan([],[r]);var a=t&&ye.isCharacterBox(t),l,u;if(e){var c=ge(e,n.havingStyle(i.sup()),n);u={elem:c,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-c.depth)}}if(t){var d=ge(t,n.havingStyle(i.sub()),n);l={elem:d,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-d.height)}}var f;if(u&&l){var h=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+r.depth+o;f=P.makeVList({positionType:"bottom",positionData:h,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:_(-s)},{type:"kern",size:l.kern},{type:"elem",elem:r},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:_(s)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(l){var m=r.height-o;f=P.makeVList({positionType:"top",positionData:m,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:_(-s)},{type:"kern",size:l.kern},{type:"elem",elem:r}]},n)}else if(u){var v=r.depth+o;f=P.makeVList({positionType:"bottom",positionData:v,children:[{type:"elem",elem:r},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:_(s)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else return r;var y=[f];if(l&&s!==0&&!a){var w=P.makeSpan(["mspace"],[],n);w.style.marginRight=_(s),y.unshift(w)}return P.makeSpan(["mop","op-limits"],y,n)},Bp=["\\smallint"],jn=(r,e)=>{var t,n,i=!1,s;r.type==="supsub"?(t=r.sup,n=r.sub,s=pe(r.base,"op"),i=!0):s=pe(r,"op");var o=e.style,a=!1;o.size===oe.DISPLAY.size&&s.symbol&&!Bp.includes(s.name)&&(a=!0);var l;if(s.symbol){var u=a?"Size2-Regular":"Size1-Regular",c="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(c=s.name.slice(1),s.name=c==="oiint"?"\\iint":"\\iiint"),l=P.makeSymbol(s.name,u,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),c.length>0){var d=l.italic,f=P.staticSvg(c+"Size"+(a?"2":"1"),e);l=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:a?.08:0}]},e),s.name="\\"+c,l.classes.unshift("mop"),l.italic=d}}else if(s.body){var h=Ge(s.body,e,!0);h.length===1&&h[0]instanceof zt?(l=h[0],l.classes[0]="mop"):l=P.makeSpan(["mop"],h,e)}else{for(var m=[],v=1;v<s.name.length;v++)m.push(P.mathsym(s.name[v],s.mode,e));l=P.makeSpan(["mop"],m,e)}var y=0,w=0;return(l instanceof zt||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(y=(l.height-l.depth)/2-e.fontMetrics().axisHeight,w=l.italic),i?Lp(l,t,n,e,o,w,y):(y&&(l.style.position="relative",l.style.top=_(y)),l)},Fi=(r,e)=>{var t;if(r.symbol)t=new Ct("mo",[Lt(r.name,r.mode)]),Bp.includes(r.name)&&t.setAttribute("largeop","false");else if(r.body)t=new Ct("mo",yt(r.body,e));else{t=new Ct("mi",[new Xt(r.name.slice(1))]);var n=new Ct("mo",[Lt("⁡","text")]);r.parentIsSupSub?t=new Ct("mrow",[t,n]):t=ep([t,n])}return t},s8={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Y({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=n;return i.length===1&&(i=s8[i]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:jn,mathmlBuilder:Fi}),Y({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:je(n)}},htmlBuilder:jn,mathmlBuilder:Fi});var o8={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Y({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:jn,mathmlBuilder:Fi}),Y({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:jn,mathmlBuilder:Fi}),Y({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(r){var{parser:e,funcName:t}=r,n=t;return n.length===1&&(n=o8[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:jn,mathmlBuilder:Fi});var Fp=(r,e)=>{var t,n,i=!1,s;r.type==="supsub"?(t=r.sup,n=r.sub,s=pe(r.base,"operatorname"),i=!0):s=pe(r,"operatorname");var o;if(s.body.length>0){for(var a=s.body.map(d=>{var f=d.text;return typeof f=="string"?{type:"textord",mode:d.mode,text:f}:d}),l=Ge(a,e.withFont("mathrm"),!0),u=0;u<l.length;u++){var c=l[u];c instanceof zt&&(c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=P.makeSpan(["mop"],l,e)}else o=P.makeSpan(["mop"],[],e);return i?Lp(o,t,n,e,e.style,0,0):o},a8=(r,e)=>{for(var t=yt(r.body,e.withFont("mathrm")),n=!0,i=0;i<t.length;i++){var s=t[i];if(!(s instanceof H.SpaceNode))if(s instanceof H.MathNode)switch(s.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var o=s.children[0];s.children.length===1&&o instanceof H.TextNode?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var a=t.map(c=>c.toText()).join("");t=[new H.TextNode(a)]}var l=new H.MathNode("mi",t);l.setAttribute("mathvariant","normal");var u=new H.MathNode("mo",[Lt("⁡","text")]);return r.parentIsSupSub?new H.MathNode("mrow",[l,u]):H.newDocumentFragment([l,u])};Y({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"operatorname",mode:t.mode,body:je(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Fp,mathmlBuilder:a8}),S("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),Sn({type:"ordgroup",htmlBuilder(r,e){return r.semisimple?P.makeFragment(Ge(r.body,e,!1)):P.makeSpan(["mord"],Ge(r.body,e,!0),e)},mathmlBuilder(r,e){return Jr(r.body,e,!0)}}),Y({type:"overline",names:["\\overline"],props:{numArgs:1},handler(r,e){var{parser:t}=r,n=e[0];return{type:"overline",mode:t.mode,body:n}},htmlBuilder(r,e){var t=ge(r.body,e.havingCrampedStyle()),n=P.makeLineSpan("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]},e);return P.makeSpan(["mord","overline"],[s],e)},mathmlBuilder(r,e){var t=new H.MathNode("mo",[new H.TextNode("‾")]);t.setAttribute("stretchy","true");var n=new H.MathNode("mover",[Oe(r.body,e),t]);return n.setAttribute("accent","true"),n}}),Y({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"phantom",mode:t.mode,body:je(n)}},htmlBuilder:(r,e)=>{var t=Ge(r.body,e.withPhantom(),!1);return P.makeFragment(t)},mathmlBuilder:(r,e)=>{var t=yt(r.body,e);return new H.MathNode("mphantom",t)}}),Y({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"hphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=P.makeSpan([],[ge(r.body,e.withPhantom())]);if(t.height=0,t.depth=0,t.children)for(var n=0;n<t.children.length;n++)t.children[n].height=0,t.children[n].depth=0;return t=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e),P.makeSpan(["mord"],[t],e)},mathmlBuilder:(r,e)=>{var t=yt(je(r.body),e),n=new H.MathNode("mphantom",t),i=new H.MathNode("mpadded",[n]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}}),Y({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"vphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=P.makeSpan(["inner"],[ge(r.body,e.withPhantom())]),n=P.makeSpan(["fix"],[]);return P.makeSpan(["mord","rlap"],[t,n],e)},mathmlBuilder:(r,e)=>{var t=yt(je(r.body),e),n=new H.MathNode("mphantom",t),i=new H.MathNode("mpadded",[n]);return i.setAttribute("width","0px"),i}}),Y({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r,n=pe(e[0],"size").value,i=e[1];return{type:"raisebox",mode:t.mode,dy:n,body:i}},htmlBuilder(r,e){var t=ge(r.body,e),n=Pe(r.dy,e);return P.makeVList({positionType:"shift",positionData:-n,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(r,e){var t=new H.MathNode("mpadded",[Oe(r.body,e)]),n=r.dy.number+r.dy.unit;return t.setAttribute("voffset",n),t}}),Y({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(r){var{parser:e}=r;return{type:"internal",mode:e.mode}}}),Y({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(r,e,t){var{parser:n}=r,i=t[0],s=pe(e[0],"size"),o=pe(e[1],"size");return{type:"rule",mode:n.mode,shift:i&&pe(i,"size").value,width:s.value,height:o.value}},htmlBuilder(r,e){var t=P.makeSpan(["mord","rule"],[],e),n=Pe(r.width,e),i=Pe(r.height,e),s=r.shift?Pe(r.shift,e):0;return t.style.borderRightWidth=_(n),t.style.borderTopWidth=_(i),t.style.bottom=_(s),t.width=n,t.height=i+s,t.depth=-s,t.maxFontSize=i*1.125*e.sizeMultiplier,t},mathmlBuilder(r,e){var t=Pe(r.width,e),n=Pe(r.height,e),i=r.shift?Pe(r.shift,e):0,s=e.color&&e.getColor()||"black",o=new H.MathNode("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",_(t)),o.setAttribute("height",_(n));var a=new H.MathNode("mpadded",[o]);return i>=0?a.setAttribute("height",_(i)):(a.setAttribute("height",_(i)),a.setAttribute("depth",_(-i))),a.setAttribute("voffset",_(i)),a}});function $p(r,e,t){for(var n=Ge(r,e,!1),i=e.sizeMultiplier/t.sizeMultiplier,s=0;s<n.length;s++){var o=n[s].classes.indexOf("sizing");o<0?Array.prototype.push.apply(n[s].classes,e.sizingClasses(t)):n[s].classes[o+1]==="reset-size"+e.size&&(n[s].classes[o+1]="reset-size"+t.size),n[s].height*=i,n[s].depth*=i}return P.makeFragment(n)}var Hp=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],l8=(r,e)=>{var t=e.havingSize(r.size);return $p(r.body,t,e)};Y({type:"sizing",names:Hp,props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{breakOnTokenText:t,funcName:n,parser:i}=r,s=i.parseExpression(!1,t);return{type:"sizing",mode:i.mode,size:Hp.indexOf(n)+1,body:s}},htmlBuilder:l8,mathmlBuilder:(r,e)=>{var t=e.havingSize(r.size),n=yt(r.body,t),i=new H.MathNode("mstyle",n);return i.setAttribute("mathsize",_(t.sizeMultiplier)),i}}),Y({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(r,e,t)=>{var{parser:n}=r,i=!1,s=!1,o=t[0]&&pe(t[0],"ordgroup");if(o)for(var a="",l=0;l<o.body.length;++l){var u=o.body[l];if(a=u.text,a==="t")i=!0;else if(a==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var c=e[0];return{type:"smash",mode:n.mode,body:c,smashHeight:i,smashDepth:s}},htmlBuilder:(r,e)=>{var t=P.makeSpan([],[ge(r.body,e)]);if(!r.smashHeight&&!r.smashDepth)return t;if(r.smashHeight&&(t.height=0,t.children))for(var n=0;n<t.children.length;n++)t.children[n].height=0;if(r.smashDepth&&(t.depth=0,t.children))for(var i=0;i<t.children.length;i++)t.children[i].depth=0;var s=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e);return P.makeSpan(["mord"],[s],e)},mathmlBuilder:(r,e)=>{var t=new H.MathNode("mpadded",[Oe(r.body,e)]);return r.smashHeight&&t.setAttribute("height","0px"),r.smashDepth&&t.setAttribute("depth","0px"),t}}),Y({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n}=r,i=t[0],s=e[0];return{type:"sqrt",mode:n.mode,body:s,index:i}},htmlBuilder(r,e){var t=ge(r.body,e.havingCrampedStyle());t.height===0&&(t.height=e.fontMetrics().xHeight),t=P.wrapFragment(t,e);var n=e.fontMetrics(),i=n.defaultRuleThickness,s=i;e.style.id<oe.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,a=t.height+t.depth+o+i,{span:l,ruleWidth:u,advanceWidth:c}=xr.sqrtImage(a,e),d=l.height-u;d>t.height+t.depth+o&&(o=(o+d-t.height-t.depth)/2);var f=l.height-t.height-o-u;t.style.paddingLeft=_(c);var h=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+f)},{type:"elem",elem:l},{type:"kern",size:u}]},e);if(r.index){var m=e.havingStyle(oe.SCRIPTSCRIPT),v=ge(r.index,m,e),y=.6*(h.height-h.depth),w=P.makeVList({positionType:"shift",positionData:-y,children:[{type:"elem",elem:v}]},e),k=P.makeSpan(["root"],[w]);return P.makeSpan(["mord","sqrt"],[k,h],e)}else return P.makeSpan(["mord","sqrt"],[h],e)},mathmlBuilder(r,e){var{body:t,index:n}=r;return n?new H.MathNode("mroot",[Oe(t,e),Oe(n,e)]):new H.MathNode("msqrt",[Oe(t,e)])}});var Vp={display:oe.DISPLAY,text:oe.TEXT,script:oe.SCRIPT,scriptscript:oe.SCRIPTSCRIPT};Y({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r,e){var{breakOnTokenText:t,funcName:n,parser:i}=r,s=i.parseExpression(!0,t),o=n.slice(1,n.length-5);return{type:"styling",mode:i.mode,style:o,body:s}},htmlBuilder(r,e){var t=Vp[r.style],n=e.havingStyle(t).withFont("");return $p(r.body,n,e)},mathmlBuilder(r,e){var t=Vp[r.style],n=e.havingStyle(t),i=yt(r.body,n),s=new H.MathNode("mstyle",i),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[r.style];return s.setAttribute("scriptlevel",a[0]),s.setAttribute("displaystyle",a[1]),s}});var u8=function(e,t){var n=e.base;if(n)if(n.type==="op"){var i=n.limits&&(t.style.size===oe.DISPLAY.size||n.alwaysHandleSupSub);return i?jn:null}else if(n.type==="operatorname"){var s=n.alwaysHandleSupSub&&(t.style.size===oe.DISPLAY.size||n.limits);return s?Fp:null}else{if(n.type==="accent")return ye.isCharacterBox(n.base)?Wl:null;if(n.type==="horizBrace"){var o=!e.sub;return o===n.isOver?Pp:null}else return null}else return null};Sn({type:"supsub",htmlBuilder(r,e){var t=u8(r,e);if(t)return t(r,e);var{base:n,sup:i,sub:s}=r,o=ge(n,e),a,l,u=e.fontMetrics(),c=0,d=0,f=n&&ye.isCharacterBox(n);if(i){var h=e.havingStyle(e.style.sup());a=ge(i,h,e),f||(c=o.height-h.fontMetrics().supDrop*h.sizeMultiplier/e.sizeMultiplier)}if(s){var m=e.havingStyle(e.style.sub());l=ge(s,m,e),f||(d=o.depth+m.fontMetrics().subDrop*m.sizeMultiplier/e.sizeMultiplier)}var v;e.style===oe.DISPLAY?v=u.sup1:e.style.cramped?v=u.sup3:v=u.sup2;var y=e.sizeMultiplier,w=_(.5/u.ptPerEm/y),k=null;if(l){var E=r.base&&r.base.type==="op"&&r.base.name&&(r.base.name==="\\oiint"||r.base.name==="\\oiiint");(o instanceof zt||E)&&(k=_(-o.italic))}var R;if(a&&l){c=Math.max(c,v,a.depth+.25*u.xHeight),d=Math.max(d,u.sub2);var O=u.defaultRuleThickness,N=4*O;if(c-a.depth-(l.height-d)<N){d=N-(c-a.depth)+l.height;var D=.8*u.xHeight-(c-a.depth);D>0&&(c+=D,d-=D)}var B=[{type:"elem",elem:l,shift:d,marginRight:w,marginLeft:k},{type:"elem",elem:a,shift:-c,marginRight:w}];R=P.makeVList({positionType:"individualShift",children:B},e)}else if(l){d=Math.max(d,u.sub1,l.height-.8*u.xHeight);var L=[{type:"elem",elem:l,marginLeft:k,marginRight:w}];R=P.makeVList({positionType:"shift",positionData:d,children:L},e)}else if(a)c=Math.max(c,v,a.depth+.25*u.xHeight),R=P.makeVList({positionType:"shift",positionData:-c,children:[{type:"elem",elem:a,marginRight:w}]},e);else throw new Error("supsub must have either sup or sub.");var V=$l(o,"right")||"mord";return P.makeSpan([V],[o,P.makeSpan(["msupsub"],[R])],e)},mathmlBuilder(r,e){var t=!1,n,i;r.base&&r.base.type==="horizBrace"&&(i=!!r.sup,i===r.base.isOver&&(t=!0,n=r.base.isOver)),r.base&&(r.base.type==="op"||r.base.type==="operatorname")&&(r.base.parentIsSupSub=!0);var s=[Oe(r.base,e)];r.sub&&s.push(Oe(r.sub,e)),r.sup&&s.push(Oe(r.sup,e));var o;if(t)o=n?"mover":"munder";else if(r.sub)if(r.sup){var u=r.base;u&&u.type==="op"&&u.limits&&e.style===oe.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(e.style===oe.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var l=r.base;l&&l.type==="op"&&l.limits&&(e.style===oe.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===oe.DISPLAY)?o="munder":o="msub"}else{var a=r.base;a&&a.type==="op"&&a.limits&&(e.style===oe.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===oe.DISPLAY)?o="mover":o="msup"}return new H.MathNode(o,s)}}),Sn({type:"atom",htmlBuilder(r,e){return P.mathsym(r.text,r.mode,e,["m"+r.family])},mathmlBuilder(r,e){var t=new H.MathNode("mo",[Lt(r.text,r.mode)]);if(r.family==="bin"){var n=jl(r,e);n==="bold-italic"&&t.setAttribute("mathvariant",n)}else r.family==="punct"?t.setAttribute("separator","true"):(r.family==="open"||r.family==="close")&&t.setAttribute("stretchy","false");return t}});var jp={mi:"italic",mn:"normal",mtext:"normal"};Sn({type:"mathord",htmlBuilder(r,e){return P.makeOrd(r,e,"mathord")},mathmlBuilder(r,e){var t=new H.MathNode("mi",[Lt(r.text,r.mode,e)]),n=jl(r,e)||"italic";return n!==jp[t.type]&&t.setAttribute("mathvariant",n),t}}),Sn({type:"textord",htmlBuilder(r,e){return P.makeOrd(r,e,"textord")},mathmlBuilder(r,e){var t=Lt(r.text,r.mode,e),n=jl(r,e)||"normal",i;return r.mode==="text"?i=new H.MathNode("mtext",[t]):/[0-9]/.test(r.text)?i=new H.MathNode("mn",[t]):r.text==="\\prime"?i=new H.MathNode("mo",[t]):i=new H.MathNode("mi",[t]),n!==jp[i.type]&&i.setAttribute("mathvariant",n),i}});var a0={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},l0={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Sn({type:"spacing",htmlBuilder(r,e){if(l0.hasOwnProperty(r.text)){var t=l0[r.text].className||"";if(r.mode==="text"){var n=P.makeOrd(r,e,"textord");return n.classes.push(t),n}else return P.makeSpan(["mspace",t],[P.mathsym(r.text,r.mode,e)],e)}else{if(a0.hasOwnProperty(r.text))return P.makeSpan(["mspace",a0[r.text]],[],e);throw new j('Unknown type of space "'+r.text+'"')}},mathmlBuilder(r,e){var t;if(l0.hasOwnProperty(r.text))t=new H.MathNode("mtext",[new H.TextNode(" ")]);else{if(a0.hasOwnProperty(r.text))return new H.MathNode("mspace");throw new j('Unknown type of space "'+r.text+'"')}return t}});var qp=()=>{var r=new H.MathNode("mtd",[]);return r.setAttribute("width","50%"),r};Sn({type:"tag",mathmlBuilder(r,e){var t=new H.MathNode("mtable",[new H.MathNode("mtr",[qp(),new H.MathNode("mtd",[Jr(r.body,e)]),qp(),new H.MathNode("mtd",[Jr(r.tag,e)])])]);return t.setAttribute("width","100%"),t}});var _p={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Wp={"\\textbf":"textbf","\\textmd":"textmd"},c8={"\\textit":"textit","\\textup":"textup"},Up=(r,e)=>{var t=r.font;if(t){if(_p[t])return e.withTextFontFamily(_p[t]);if(Wp[t])return e.withTextFontWeight(Wp[t]);if(t==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(c8[t])};Y({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"text",mode:t.mode,body:je(i),font:n}},htmlBuilder(r,e){var t=Up(r,e),n=Ge(r.body,t,!0);return P.makeSpan(["mord","text"],n,t)},mathmlBuilder(r,e){var t=Up(r,e);return Jr(r.body,t)}}),Y({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"underline",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=ge(r.body,e),n=P.makeLineSpan("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=P.makeVList({positionType:"top",positionData:t.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:t}]},e);return P.makeSpan(["mord","underline"],[s],e)},mathmlBuilder(r,e){var t=new H.MathNode("mo",[new H.TextNode("‾")]);t.setAttribute("stretchy","true");var n=new H.MathNode("munder",[Oe(r.body,e),t]);return n.setAttribute("accentunder","true"),n}}),Y({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"vcenter",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=ge(r.body,e),n=e.fontMetrics().axisHeight,i=.5*(t.height-n-(t.depth+n));return P.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(r,e){return new H.MathNode("mpadded",[Oe(r.body,e)],["vcenter"])}}),Y({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(r,e,t){throw new j("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(r,e){for(var t=Gp(r),n=[],i=e.havingStyle(e.style.text()),s=0;s<t.length;s++){var o=t[s];o==="~"&&(o="\\textasciitilde"),n.push(P.makeSymbol(o,"Typewriter-Regular",r.mode,i,["mord","texttt"]))}return P.makeSpan(["mord","text"].concat(i.sizingClasses(e)),P.tryCombineChars(n),i)},mathmlBuilder(r,e){var t=new H.TextNode(Gp(r)),n=new H.MathNode("mtext",[t]);return n.setAttribute("mathvariant","monospace"),n}});var Gp=r=>r.body.replace(/ /g,r.star?"␣":" "),Zr=Xf,Kp=`[ \r
860
+ -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class Ri{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){var e=t=>t.toText();return this.children.map(e).join("")}}var Jt={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},eo={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},Rf={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function Q7(r,e){Jt[r]=e}function Al(r,e,t){if(!Jt[e])throw new Error("Font metrics not found for font: "+e+".");var n=r.charCodeAt(0),i=Jt[e][n];if(!i&&r[0]in Rf&&(n=Rf[r[0]].charCodeAt(0),i=Jt[e][n]),!i&&t==="text"&&Df(n)&&(i=Jt[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var Ol={};function eb(r){var e;if(r>=5?e=0:r>=3?e=1:e=2,!Ol[e]){var t=Ol[e]={cssEmPerMu:eo.quad[e]/18};for(var n in eo)eo.hasOwnProperty(n)&&(t[n]=eo[n][e])}return Ol[e]}var tb=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Pf=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],zf=function(e,t){return t.size<2?e:tb[e-1][t.size-1]};class mr{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||mr.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Pf[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return new mr(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:zf(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Pf[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=zf(mr.BASESIZE,e);return this.size===t&&this.textSize===mr.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==mr.BASESIZE?["sizing","reset-size"+this.size,"size"+mr.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=eb(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}mr.BASESIZE=6;var Nl={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},rb={ex:!0,em:!0,mu:!0},Lf=function(e){return typeof e!="string"&&(e=e.unit),e in Nl||e in rb||e==="ex"},Pe=function(e,t){var n;if(e.unit in Nl)n=Nl[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit==="mu")n=t.fontMetrics().cssEmPerMu;else{var i;if(t.style.isTight()?i=t.havingStyle(t.style.text()):i=t,e.unit==="ex")n=i.fontMetrics().xHeight;else if(e.unit==="em")n=i.fontMetrics().quad;else throw new _("Invalid unit: '"+e.unit+"'");i!==t&&(n*=i.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},q=function(e){return+e.toFixed(4)+"em"},Gr=function(e){return e.filter(t=>t).join(" ")},Bf=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push("mtight");var i=t.getColor();i&&(this.style.color=i)}},Ff=function(e){var t=document.createElement(e);t.className=Gr(this.classes);for(var n in this.style)this.style.hasOwnProperty(n)&&(t.style[n]=this.style[n]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&t.setAttribute(i,this.attributes[i]);for(var s=0;s<this.children.length;s++)t.appendChild(this.children[s].toNode());return t},nb=/[\s"'>/=\x00-\x1f]/,$f=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+ye.escape(Gr(this.classes))+'"');var n="";for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=ye.hyphenate(i)+":"+this.style[i]+";");n&&(t+=' style="'+ye.escape(n)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(nb.test(s))throw new _("Invalid attribute name '"+s+"'");t+=" "+s+'="'+ye.escape(this.attributes[s])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">",t};class Pi{constructor(e,t,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,Bf.call(this,e,n,i),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Ff.call(this,"span")}toMarkup(){return $f.call(this,"span")}}class Dl{constructor(e,t,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,Bf.call(this,t,i),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return Ff.call(this,"a")}toMarkup(){return $f.call(this,"a")}}class ib{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var t in this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e='<img src="'+ye.escape(this.src)+'"'+(' alt="'+ye.escape(this.alt)+'"'),t="";for(var n in this.style)this.style.hasOwnProperty(n)&&(t+=ye.hyphenate(n)+":"+this.style[n]+";");return t&&(e+=' style="'+ye.escape(t)+'"'),e+="'/>",e}}var sb={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class zt{constructor(e,t,n,i,s,o,a,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=i||0,this.skew=s||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var u=_7(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=sb[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;this.italic>0&&(t=document.createElement("span"),t.style.marginRight=q(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=Gr(this.classes));for(var n in this.style)this.style.hasOwnProperty(n)&&(t=t||document.createElement("span"),t.style[n]=this.style[n]);return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=ye.escape(Gr(this.classes)),t+='"');var n="";this.italic>0&&(n+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=ye.hyphenate(i)+":"+this.style[i]+";");n&&(e=!0,t+=' style="'+ye.escape(n)+'"');var s=ye.escape(this.text);return e?(t+=">",t+=s,t+="</span>",t):s}}class gr{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);for(var i=0;i<this.children.length;i++)t.appendChild(this.children[i].toNode());return t}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+ye.escape(this.attributes[t])+'"');e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</svg>",e}}class Kr{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"path");return this.alternate?t.setAttribute("d",this.alternate):t.setAttribute("d",If[this.pathName]),t}toMarkup(){return this.alternate?'<path d="'+ye.escape(this.alternate)+'"/>':'<path d="'+ye.escape(If[this.pathName])+'"/>'}}class Il{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"line");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);return t}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+ye.escape(this.attributes[t])+'"');return e+="/>",e}}function Hf(r){if(r instanceof zt)return r;throw new Error("Expected symbolNode but got "+String(r)+".")}function ob(r){if(r instanceof Pi)return r;throw new Error("Expected span<HtmlDomNode> but got "+String(r)+".")}var ab={bin:1,close:1,inner:1,open:1,punct:1,rel:1},lb={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Ne={math:{},text:{}};function p(r,e,t,n,i,s){Ne[r][i]={font:e,group:t,replace:n},s&&n&&(Ne[r][n]=Ne[r][i])}var g="math",$="text",b="main",T="ams",Ie="accent-token",X="bin",ct="close",Vn="inner",ae="mathord",We="op-token",Mt="open",to="punct",M="rel",vr="spacing",A="textord";p(g,b,M,"≡","\\equiv",!0),p(g,b,M,"≺","\\prec",!0),p(g,b,M,"≻","\\succ",!0),p(g,b,M,"∼","\\sim",!0),p(g,b,M,"⊥","\\perp"),p(g,b,M,"⪯","\\preceq",!0),p(g,b,M,"⪰","\\succeq",!0),p(g,b,M,"≃","\\simeq",!0),p(g,b,M,"∣","\\mid",!0),p(g,b,M,"≪","\\ll",!0),p(g,b,M,"≫","\\gg",!0),p(g,b,M,"≍","\\asymp",!0),p(g,b,M,"∥","\\parallel"),p(g,b,M,"⋈","\\bowtie",!0),p(g,b,M,"⌣","\\smile",!0),p(g,b,M,"⊑","\\sqsubseteq",!0),p(g,b,M,"⊒","\\sqsupseteq",!0),p(g,b,M,"≐","\\doteq",!0),p(g,b,M,"⌢","\\frown",!0),p(g,b,M,"∋","\\ni",!0),p(g,b,M,"∝","\\propto",!0),p(g,b,M,"⊢","\\vdash",!0),p(g,b,M,"⊣","\\dashv",!0),p(g,b,M,"∋","\\owns"),p(g,b,to,".","\\ldotp"),p(g,b,to,"⋅","\\cdotp"),p(g,b,A,"#","\\#"),p($,b,A,"#","\\#"),p(g,b,A,"&","\\&"),p($,b,A,"&","\\&"),p(g,b,A,"ℵ","\\aleph",!0),p(g,b,A,"∀","\\forall",!0),p(g,b,A,"ℏ","\\hbar",!0),p(g,b,A,"∃","\\exists",!0),p(g,b,A,"∇","\\nabla",!0),p(g,b,A,"♭","\\flat",!0),p(g,b,A,"ℓ","\\ell",!0),p(g,b,A,"♮","\\natural",!0),p(g,b,A,"♣","\\clubsuit",!0),p(g,b,A,"℘","\\wp",!0),p(g,b,A,"♯","\\sharp",!0),p(g,b,A,"♢","\\diamondsuit",!0),p(g,b,A,"ℜ","\\Re",!0),p(g,b,A,"♡","\\heartsuit",!0),p(g,b,A,"ℑ","\\Im",!0),p(g,b,A,"♠","\\spadesuit",!0),p(g,b,A,"§","\\S",!0),p($,b,A,"§","\\S"),p(g,b,A,"¶","\\P",!0),p($,b,A,"¶","\\P"),p(g,b,A,"†","\\dag"),p($,b,A,"†","\\dag"),p($,b,A,"†","\\textdagger"),p(g,b,A,"‡","\\ddag"),p($,b,A,"‡","\\ddag"),p($,b,A,"‡","\\textdaggerdbl"),p(g,b,ct,"⎱","\\rmoustache",!0),p(g,b,Mt,"⎰","\\lmoustache",!0),p(g,b,ct,"⟯","\\rgroup",!0),p(g,b,Mt,"⟮","\\lgroup",!0),p(g,b,X,"∓","\\mp",!0),p(g,b,X,"⊖","\\ominus",!0),p(g,b,X,"⊎","\\uplus",!0),p(g,b,X,"⊓","\\sqcap",!0),p(g,b,X,"∗","\\ast"),p(g,b,X,"⊔","\\sqcup",!0),p(g,b,X,"◯","\\bigcirc",!0),p(g,b,X,"∙","\\bullet",!0),p(g,b,X,"‡","\\ddagger"),p(g,b,X,"≀","\\wr",!0),p(g,b,X,"⨿","\\amalg"),p(g,b,X,"&","\\And"),p(g,b,M,"⟵","\\longleftarrow",!0),p(g,b,M,"⇐","\\Leftarrow",!0),p(g,b,M,"⟸","\\Longleftarrow",!0),p(g,b,M,"⟶","\\longrightarrow",!0),p(g,b,M,"⇒","\\Rightarrow",!0),p(g,b,M,"⟹","\\Longrightarrow",!0),p(g,b,M,"↔","\\leftrightarrow",!0),p(g,b,M,"⟷","\\longleftrightarrow",!0),p(g,b,M,"⇔","\\Leftrightarrow",!0),p(g,b,M,"⟺","\\Longleftrightarrow",!0),p(g,b,M,"↦","\\mapsto",!0),p(g,b,M,"⟼","\\longmapsto",!0),p(g,b,M,"↗","\\nearrow",!0),p(g,b,M,"↩","\\hookleftarrow",!0),p(g,b,M,"↪","\\hookrightarrow",!0),p(g,b,M,"↘","\\searrow",!0),p(g,b,M,"↼","\\leftharpoonup",!0),p(g,b,M,"⇀","\\rightharpoonup",!0),p(g,b,M,"↙","\\swarrow",!0),p(g,b,M,"↽","\\leftharpoondown",!0),p(g,b,M,"⇁","\\rightharpoondown",!0),p(g,b,M,"↖","\\nwarrow",!0),p(g,b,M,"⇌","\\rightleftharpoons",!0),p(g,T,M,"≮","\\nless",!0),p(g,T,M,"","\\@nleqslant"),p(g,T,M,"","\\@nleqq"),p(g,T,M,"⪇","\\lneq",!0),p(g,T,M,"≨","\\lneqq",!0),p(g,T,M,"","\\@lvertneqq"),p(g,T,M,"⋦","\\lnsim",!0),p(g,T,M,"⪉","\\lnapprox",!0),p(g,T,M,"⊀","\\nprec",!0),p(g,T,M,"⋠","\\npreceq",!0),p(g,T,M,"⋨","\\precnsim",!0),p(g,T,M,"⪹","\\precnapprox",!0),p(g,T,M,"≁","\\nsim",!0),p(g,T,M,"","\\@nshortmid"),p(g,T,M,"∤","\\nmid",!0),p(g,T,M,"⊬","\\nvdash",!0),p(g,T,M,"⊭","\\nvDash",!0),p(g,T,M,"⋪","\\ntriangleleft"),p(g,T,M,"⋬","\\ntrianglelefteq",!0),p(g,T,M,"⊊","\\subsetneq",!0),p(g,T,M,"","\\@varsubsetneq"),p(g,T,M,"⫋","\\subsetneqq",!0),p(g,T,M,"","\\@varsubsetneqq"),p(g,T,M,"≯","\\ngtr",!0),p(g,T,M,"","\\@ngeqslant"),p(g,T,M,"","\\@ngeqq"),p(g,T,M,"⪈","\\gneq",!0),p(g,T,M,"≩","\\gneqq",!0),p(g,T,M,"","\\@gvertneqq"),p(g,T,M,"⋧","\\gnsim",!0),p(g,T,M,"⪊","\\gnapprox",!0),p(g,T,M,"⊁","\\nsucc",!0),p(g,T,M,"⋡","\\nsucceq",!0),p(g,T,M,"⋩","\\succnsim",!0),p(g,T,M,"⪺","\\succnapprox",!0),p(g,T,M,"≆","\\ncong",!0),p(g,T,M,"","\\@nshortparallel"),p(g,T,M,"∦","\\nparallel",!0),p(g,T,M,"⊯","\\nVDash",!0),p(g,T,M,"⋫","\\ntriangleright"),p(g,T,M,"⋭","\\ntrianglerighteq",!0),p(g,T,M,"","\\@nsupseteqq"),p(g,T,M,"⊋","\\supsetneq",!0),p(g,T,M,"","\\@varsupsetneq"),p(g,T,M,"⫌","\\supsetneqq",!0),p(g,T,M,"","\\@varsupsetneqq"),p(g,T,M,"⊮","\\nVdash",!0),p(g,T,M,"⪵","\\precneqq",!0),p(g,T,M,"⪶","\\succneqq",!0),p(g,T,M,"","\\@nsubseteqq"),p(g,T,X,"⊴","\\unlhd"),p(g,T,X,"⊵","\\unrhd"),p(g,T,M,"↚","\\nleftarrow",!0),p(g,T,M,"↛","\\nrightarrow",!0),p(g,T,M,"⇍","\\nLeftarrow",!0),p(g,T,M,"⇏","\\nRightarrow",!0),p(g,T,M,"↮","\\nleftrightarrow",!0),p(g,T,M,"⇎","\\nLeftrightarrow",!0),p(g,T,M,"△","\\vartriangle"),p(g,T,A,"ℏ","\\hslash"),p(g,T,A,"▽","\\triangledown"),p(g,T,A,"◊","\\lozenge"),p(g,T,A,"Ⓢ","\\circledS"),p(g,T,A,"®","\\circledR"),p($,T,A,"®","\\circledR"),p(g,T,A,"∡","\\measuredangle",!0),p(g,T,A,"∄","\\nexists"),p(g,T,A,"℧","\\mho"),p(g,T,A,"Ⅎ","\\Finv",!0),p(g,T,A,"⅁","\\Game",!0),p(g,T,A,"‵","\\backprime"),p(g,T,A,"▲","\\blacktriangle"),p(g,T,A,"▼","\\blacktriangledown"),p(g,T,A,"■","\\blacksquare"),p(g,T,A,"⧫","\\blacklozenge"),p(g,T,A,"★","\\bigstar"),p(g,T,A,"∢","\\sphericalangle",!0),p(g,T,A,"∁","\\complement",!0),p(g,T,A,"ð","\\eth",!0),p($,b,A,"ð","ð"),p(g,T,A,"╱","\\diagup"),p(g,T,A,"╲","\\diagdown"),p(g,T,A,"□","\\square"),p(g,T,A,"□","\\Box"),p(g,T,A,"◊","\\Diamond"),p(g,T,A,"¥","\\yen",!0),p($,T,A,"¥","\\yen",!0),p(g,T,A,"✓","\\checkmark",!0),p($,T,A,"✓","\\checkmark"),p(g,T,A,"ℶ","\\beth",!0),p(g,T,A,"ℸ","\\daleth",!0),p(g,T,A,"ℷ","\\gimel",!0),p(g,T,A,"ϝ","\\digamma",!0),p(g,T,A,"ϰ","\\varkappa"),p(g,T,Mt,"┌","\\@ulcorner",!0),p(g,T,ct,"┐","\\@urcorner",!0),p(g,T,Mt,"└","\\@llcorner",!0),p(g,T,ct,"┘","\\@lrcorner",!0),p(g,T,M,"≦","\\leqq",!0),p(g,T,M,"⩽","\\leqslant",!0),p(g,T,M,"⪕","\\eqslantless",!0),p(g,T,M,"≲","\\lesssim",!0),p(g,T,M,"⪅","\\lessapprox",!0),p(g,T,M,"≊","\\approxeq",!0),p(g,T,X,"⋖","\\lessdot"),p(g,T,M,"⋘","\\lll",!0),p(g,T,M,"≶","\\lessgtr",!0),p(g,T,M,"⋚","\\lesseqgtr",!0),p(g,T,M,"⪋","\\lesseqqgtr",!0),p(g,T,M,"≑","\\doteqdot"),p(g,T,M,"≓","\\risingdotseq",!0),p(g,T,M,"≒","\\fallingdotseq",!0),p(g,T,M,"∽","\\backsim",!0),p(g,T,M,"⋍","\\backsimeq",!0),p(g,T,M,"⫅","\\subseteqq",!0),p(g,T,M,"⋐","\\Subset",!0),p(g,T,M,"⊏","\\sqsubset",!0),p(g,T,M,"≼","\\preccurlyeq",!0),p(g,T,M,"⋞","\\curlyeqprec",!0),p(g,T,M,"≾","\\precsim",!0),p(g,T,M,"⪷","\\precapprox",!0),p(g,T,M,"⊲","\\vartriangleleft"),p(g,T,M,"⊴","\\trianglelefteq"),p(g,T,M,"⊨","\\vDash",!0),p(g,T,M,"⊪","\\Vvdash",!0),p(g,T,M,"⌣","\\smallsmile"),p(g,T,M,"⌢","\\smallfrown"),p(g,T,M,"≏","\\bumpeq",!0),p(g,T,M,"≎","\\Bumpeq",!0),p(g,T,M,"≧","\\geqq",!0),p(g,T,M,"⩾","\\geqslant",!0),p(g,T,M,"⪖","\\eqslantgtr",!0),p(g,T,M,"≳","\\gtrsim",!0),p(g,T,M,"⪆","\\gtrapprox",!0),p(g,T,X,"⋗","\\gtrdot"),p(g,T,M,"⋙","\\ggg",!0),p(g,T,M,"≷","\\gtrless",!0),p(g,T,M,"⋛","\\gtreqless",!0),p(g,T,M,"⪌","\\gtreqqless",!0),p(g,T,M,"≖","\\eqcirc",!0),p(g,T,M,"≗","\\circeq",!0),p(g,T,M,"≜","\\triangleq",!0),p(g,T,M,"∼","\\thicksim"),p(g,T,M,"≈","\\thickapprox"),p(g,T,M,"⫆","\\supseteqq",!0),p(g,T,M,"⋑","\\Supset",!0),p(g,T,M,"⊐","\\sqsupset",!0),p(g,T,M,"≽","\\succcurlyeq",!0),p(g,T,M,"⋟","\\curlyeqsucc",!0),p(g,T,M,"≿","\\succsim",!0),p(g,T,M,"⪸","\\succapprox",!0),p(g,T,M,"⊳","\\vartriangleright"),p(g,T,M,"⊵","\\trianglerighteq"),p(g,T,M,"⊩","\\Vdash",!0),p(g,T,M,"∣","\\shortmid"),p(g,T,M,"∥","\\shortparallel"),p(g,T,M,"≬","\\between",!0),p(g,T,M,"⋔","\\pitchfork",!0),p(g,T,M,"∝","\\varpropto"),p(g,T,M,"◀","\\blacktriangleleft"),p(g,T,M,"∴","\\therefore",!0),p(g,T,M,"∍","\\backepsilon"),p(g,T,M,"▶","\\blacktriangleright"),p(g,T,M,"∵","\\because",!0),p(g,T,M,"⋘","\\llless"),p(g,T,M,"⋙","\\gggtr"),p(g,T,X,"⊲","\\lhd"),p(g,T,X,"⊳","\\rhd"),p(g,T,M,"≂","\\eqsim",!0),p(g,b,M,"⋈","\\Join"),p(g,T,M,"≑","\\Doteq",!0),p(g,T,X,"∔","\\dotplus",!0),p(g,T,X,"∖","\\smallsetminus"),p(g,T,X,"⋒","\\Cap",!0),p(g,T,X,"⋓","\\Cup",!0),p(g,T,X,"⩞","\\doublebarwedge",!0),p(g,T,X,"⊟","\\boxminus",!0),p(g,T,X,"⊞","\\boxplus",!0),p(g,T,X,"⋇","\\divideontimes",!0),p(g,T,X,"⋉","\\ltimes",!0),p(g,T,X,"⋊","\\rtimes",!0),p(g,T,X,"⋋","\\leftthreetimes",!0),p(g,T,X,"⋌","\\rightthreetimes",!0),p(g,T,X,"⋏","\\curlywedge",!0),p(g,T,X,"⋎","\\curlyvee",!0),p(g,T,X,"⊝","\\circleddash",!0),p(g,T,X,"⊛","\\circledast",!0),p(g,T,X,"⋅","\\centerdot"),p(g,T,X,"⊺","\\intercal",!0),p(g,T,X,"⋒","\\doublecap"),p(g,T,X,"⋓","\\doublecup"),p(g,T,X,"⊠","\\boxtimes",!0),p(g,T,M,"⇢","\\dashrightarrow",!0),p(g,T,M,"⇠","\\dashleftarrow",!0),p(g,T,M,"⇇","\\leftleftarrows",!0),p(g,T,M,"⇆","\\leftrightarrows",!0),p(g,T,M,"⇚","\\Lleftarrow",!0),p(g,T,M,"↞","\\twoheadleftarrow",!0),p(g,T,M,"↢","\\leftarrowtail",!0),p(g,T,M,"↫","\\looparrowleft",!0),p(g,T,M,"⇋","\\leftrightharpoons",!0),p(g,T,M,"↶","\\curvearrowleft",!0),p(g,T,M,"↺","\\circlearrowleft",!0),p(g,T,M,"↰","\\Lsh",!0),p(g,T,M,"⇈","\\upuparrows",!0),p(g,T,M,"↿","\\upharpoonleft",!0),p(g,T,M,"⇃","\\downharpoonleft",!0),p(g,b,M,"⊶","\\origof",!0),p(g,b,M,"⊷","\\imageof",!0),p(g,T,M,"⊸","\\multimap",!0),p(g,T,M,"↭","\\leftrightsquigarrow",!0),p(g,T,M,"⇉","\\rightrightarrows",!0),p(g,T,M,"⇄","\\rightleftarrows",!0),p(g,T,M,"↠","\\twoheadrightarrow",!0),p(g,T,M,"↣","\\rightarrowtail",!0),p(g,T,M,"↬","\\looparrowright",!0),p(g,T,M,"↷","\\curvearrowright",!0),p(g,T,M,"↻","\\circlearrowright",!0),p(g,T,M,"↱","\\Rsh",!0),p(g,T,M,"⇊","\\downdownarrows",!0),p(g,T,M,"↾","\\upharpoonright",!0),p(g,T,M,"⇂","\\downharpoonright",!0),p(g,T,M,"⇝","\\rightsquigarrow",!0),p(g,T,M,"⇝","\\leadsto"),p(g,T,M,"⇛","\\Rrightarrow",!0),p(g,T,M,"↾","\\restriction"),p(g,b,A,"‘","`"),p(g,b,A,"$","\\$"),p($,b,A,"$","\\$"),p($,b,A,"$","\\textdollar"),p(g,b,A,"%","\\%"),p($,b,A,"%","\\%"),p(g,b,A,"_","\\_"),p($,b,A,"_","\\_"),p($,b,A,"_","\\textunderscore"),p(g,b,A,"∠","\\angle",!0),p(g,b,A,"∞","\\infty",!0),p(g,b,A,"′","\\prime"),p(g,b,A,"△","\\triangle"),p(g,b,A,"Γ","\\Gamma",!0),p(g,b,A,"Δ","\\Delta",!0),p(g,b,A,"Θ","\\Theta",!0),p(g,b,A,"Λ","\\Lambda",!0),p(g,b,A,"Ξ","\\Xi",!0),p(g,b,A,"Π","\\Pi",!0),p(g,b,A,"Σ","\\Sigma",!0),p(g,b,A,"Υ","\\Upsilon",!0),p(g,b,A,"Φ","\\Phi",!0),p(g,b,A,"Ψ","\\Psi",!0),p(g,b,A,"Ω","\\Omega",!0),p(g,b,A,"A","Α"),p(g,b,A,"B","Β"),p(g,b,A,"E","Ε"),p(g,b,A,"Z","Ζ"),p(g,b,A,"H","Η"),p(g,b,A,"I","Ι"),p(g,b,A,"K","Κ"),p(g,b,A,"M","Μ"),p(g,b,A,"N","Ν"),p(g,b,A,"O","Ο"),p(g,b,A,"P","Ρ"),p(g,b,A,"T","Τ"),p(g,b,A,"X","Χ"),p(g,b,A,"¬","\\neg",!0),p(g,b,A,"¬","\\lnot"),p(g,b,A,"⊤","\\top"),p(g,b,A,"⊥","\\bot"),p(g,b,A,"∅","\\emptyset"),p(g,T,A,"∅","\\varnothing"),p(g,b,ae,"α","\\alpha",!0),p(g,b,ae,"β","\\beta",!0),p(g,b,ae,"γ","\\gamma",!0),p(g,b,ae,"δ","\\delta",!0),p(g,b,ae,"ϵ","\\epsilon",!0),p(g,b,ae,"ζ","\\zeta",!0),p(g,b,ae,"η","\\eta",!0),p(g,b,ae,"θ","\\theta",!0),p(g,b,ae,"ι","\\iota",!0),p(g,b,ae,"κ","\\kappa",!0),p(g,b,ae,"λ","\\lambda",!0),p(g,b,ae,"μ","\\mu",!0),p(g,b,ae,"ν","\\nu",!0),p(g,b,ae,"ξ","\\xi",!0),p(g,b,ae,"ο","\\omicron",!0),p(g,b,ae,"π","\\pi",!0),p(g,b,ae,"ρ","\\rho",!0),p(g,b,ae,"σ","\\sigma",!0),p(g,b,ae,"τ","\\tau",!0),p(g,b,ae,"υ","\\upsilon",!0),p(g,b,ae,"ϕ","\\phi",!0),p(g,b,ae,"χ","\\chi",!0),p(g,b,ae,"ψ","\\psi",!0),p(g,b,ae,"ω","\\omega",!0),p(g,b,ae,"ε","\\varepsilon",!0),p(g,b,ae,"ϑ","\\vartheta",!0),p(g,b,ae,"ϖ","\\varpi",!0),p(g,b,ae,"ϱ","\\varrho",!0),p(g,b,ae,"ς","\\varsigma",!0),p(g,b,ae,"φ","\\varphi",!0),p(g,b,X,"∗","*",!0),p(g,b,X,"+","+"),p(g,b,X,"−","-",!0),p(g,b,X,"⋅","\\cdot",!0),p(g,b,X,"∘","\\circ",!0),p(g,b,X,"÷","\\div",!0),p(g,b,X,"±","\\pm",!0),p(g,b,X,"×","\\times",!0),p(g,b,X,"∩","\\cap",!0),p(g,b,X,"∪","\\cup",!0),p(g,b,X,"∖","\\setminus",!0),p(g,b,X,"∧","\\land"),p(g,b,X,"∨","\\lor"),p(g,b,X,"∧","\\wedge",!0),p(g,b,X,"∨","\\vee",!0),p(g,b,A,"√","\\surd"),p(g,b,Mt,"⟨","\\langle",!0),p(g,b,Mt,"∣","\\lvert"),p(g,b,Mt,"∥","\\lVert"),p(g,b,ct,"?","?"),p(g,b,ct,"!","!"),p(g,b,ct,"⟩","\\rangle",!0),p(g,b,ct,"∣","\\rvert"),p(g,b,ct,"∥","\\rVert"),p(g,b,M,"=","="),p(g,b,M,":",":"),p(g,b,M,"≈","\\approx",!0),p(g,b,M,"≅","\\cong",!0),p(g,b,M,"≥","\\ge"),p(g,b,M,"≥","\\geq",!0),p(g,b,M,"←","\\gets"),p(g,b,M,">","\\gt",!0),p(g,b,M,"∈","\\in",!0),p(g,b,M,"","\\@not"),p(g,b,M,"⊂","\\subset",!0),p(g,b,M,"⊃","\\supset",!0),p(g,b,M,"⊆","\\subseteq",!0),p(g,b,M,"⊇","\\supseteq",!0),p(g,T,M,"⊈","\\nsubseteq",!0),p(g,T,M,"⊉","\\nsupseteq",!0),p(g,b,M,"⊨","\\models"),p(g,b,M,"←","\\leftarrow",!0),p(g,b,M,"≤","\\le"),p(g,b,M,"≤","\\leq",!0),p(g,b,M,"<","\\lt",!0),p(g,b,M,"→","\\rightarrow",!0),p(g,b,M,"→","\\to"),p(g,T,M,"≱","\\ngeq",!0),p(g,T,M,"≰","\\nleq",!0),p(g,b,vr," ","\\ "),p(g,b,vr," ","\\space"),p(g,b,vr," ","\\nobreakspace"),p($,b,vr," ","\\ "),p($,b,vr," "," "),p($,b,vr," ","\\space"),p($,b,vr," ","\\nobreakspace"),p(g,b,vr,null,"\\nobreak"),p(g,b,vr,null,"\\allowbreak"),p(g,b,to,",",","),p(g,b,to,";",";"),p(g,T,X,"⊼","\\barwedge",!0),p(g,T,X,"⊻","\\veebar",!0),p(g,b,X,"⊙","\\odot",!0),p(g,b,X,"⊕","\\oplus",!0),p(g,b,X,"⊗","\\otimes",!0),p(g,b,A,"∂","\\partial",!0),p(g,b,X,"⊘","\\oslash",!0),p(g,T,X,"⊚","\\circledcirc",!0),p(g,T,X,"⊡","\\boxdot",!0),p(g,b,X,"△","\\bigtriangleup"),p(g,b,X,"▽","\\bigtriangledown"),p(g,b,X,"†","\\dagger"),p(g,b,X,"⋄","\\diamond"),p(g,b,X,"⋆","\\star"),p(g,b,X,"◃","\\triangleleft"),p(g,b,X,"▹","\\triangleright"),p(g,b,Mt,"{","\\{"),p($,b,A,"{","\\{"),p($,b,A,"{","\\textbraceleft"),p(g,b,ct,"}","\\}"),p($,b,A,"}","\\}"),p($,b,A,"}","\\textbraceright"),p(g,b,Mt,"{","\\lbrace"),p(g,b,ct,"}","\\rbrace"),p(g,b,Mt,"[","\\lbrack",!0),p($,b,A,"[","\\lbrack",!0),p(g,b,ct,"]","\\rbrack",!0),p($,b,A,"]","\\rbrack",!0),p(g,b,Mt,"(","\\lparen",!0),p(g,b,ct,")","\\rparen",!0),p($,b,A,"<","\\textless",!0),p($,b,A,">","\\textgreater",!0),p(g,b,Mt,"⌊","\\lfloor",!0),p(g,b,ct,"⌋","\\rfloor",!0),p(g,b,Mt,"⌈","\\lceil",!0),p(g,b,ct,"⌉","\\rceil",!0),p(g,b,A,"\\","\\backslash"),p(g,b,A,"∣","|"),p(g,b,A,"∣","\\vert"),p($,b,A,"|","\\textbar",!0),p(g,b,A,"∥","\\|"),p(g,b,A,"∥","\\Vert"),p($,b,A,"∥","\\textbardbl"),p($,b,A,"~","\\textasciitilde"),p($,b,A,"\\","\\textbackslash"),p($,b,A,"^","\\textasciicircum"),p(g,b,M,"↑","\\uparrow",!0),p(g,b,M,"⇑","\\Uparrow",!0),p(g,b,M,"↓","\\downarrow",!0),p(g,b,M,"⇓","\\Downarrow",!0),p(g,b,M,"↕","\\updownarrow",!0),p(g,b,M,"⇕","\\Updownarrow",!0),p(g,b,We,"∐","\\coprod"),p(g,b,We,"⋁","\\bigvee"),p(g,b,We,"⋀","\\bigwedge"),p(g,b,We,"⨄","\\biguplus"),p(g,b,We,"⋂","\\bigcap"),p(g,b,We,"⋃","\\bigcup"),p(g,b,We,"∫","\\int"),p(g,b,We,"∫","\\intop"),p(g,b,We,"∬","\\iint"),p(g,b,We,"∭","\\iiint"),p(g,b,We,"∏","\\prod"),p(g,b,We,"∑","\\sum"),p(g,b,We,"⨂","\\bigotimes"),p(g,b,We,"⨁","\\bigoplus"),p(g,b,We,"⨀","\\bigodot"),p(g,b,We,"∮","\\oint"),p(g,b,We,"∯","\\oiint"),p(g,b,We,"∰","\\oiiint"),p(g,b,We,"⨆","\\bigsqcup"),p(g,b,We,"∫","\\smallint"),p($,b,Vn,"…","\\textellipsis"),p(g,b,Vn,"…","\\mathellipsis"),p($,b,Vn,"…","\\ldots",!0),p(g,b,Vn,"…","\\ldots",!0),p(g,b,Vn,"⋯","\\@cdots",!0),p(g,b,Vn,"⋱","\\ddots",!0),p(g,b,A,"⋮","\\varvdots"),p($,b,A,"⋮","\\varvdots"),p(g,b,Ie,"ˊ","\\acute"),p(g,b,Ie,"ˋ","\\grave"),p(g,b,Ie,"¨","\\ddot"),p(g,b,Ie,"~","\\tilde"),p(g,b,Ie,"ˉ","\\bar"),p(g,b,Ie,"˘","\\breve"),p(g,b,Ie,"ˇ","\\check"),p(g,b,Ie,"^","\\hat"),p(g,b,Ie,"⃗","\\vec"),p(g,b,Ie,"˙","\\dot"),p(g,b,Ie,"˚","\\mathring"),p(g,b,ae,"","\\@imath"),p(g,b,ae,"","\\@jmath"),p(g,b,A,"ı","ı"),p(g,b,A,"ȷ","ȷ"),p($,b,A,"ı","\\i",!0),p($,b,A,"ȷ","\\j",!0),p($,b,A,"ß","\\ss",!0),p($,b,A,"æ","\\ae",!0),p($,b,A,"œ","\\oe",!0),p($,b,A,"ø","\\o",!0),p($,b,A,"Æ","\\AE",!0),p($,b,A,"Œ","\\OE",!0),p($,b,A,"Ø","\\O",!0),p($,b,Ie,"ˊ","\\'"),p($,b,Ie,"ˋ","\\`"),p($,b,Ie,"ˆ","\\^"),p($,b,Ie,"˜","\\~"),p($,b,Ie,"ˉ","\\="),p($,b,Ie,"˘","\\u"),p($,b,Ie,"˙","\\."),p($,b,Ie,"¸","\\c"),p($,b,Ie,"˚","\\r"),p($,b,Ie,"ˇ","\\v"),p($,b,Ie,"¨",'\\"'),p($,b,Ie,"˝","\\H"),p($,b,Ie,"◯","\\textcircled");var Vf={"--":!0,"---":!0,"``":!0,"''":!0};p($,b,A,"–","--",!0),p($,b,A,"–","\\textendash"),p($,b,A,"—","---",!0),p($,b,A,"—","\\textemdash"),p($,b,A,"‘","`",!0),p($,b,A,"‘","\\textquoteleft"),p($,b,A,"’","'",!0),p($,b,A,"’","\\textquoteright"),p($,b,A,"“","``",!0),p($,b,A,"“","\\textquotedblleft"),p($,b,A,"”","''",!0),p($,b,A,"”","\\textquotedblright"),p(g,b,A,"°","\\degree",!0),p($,b,A,"°","\\degree"),p($,b,A,"°","\\textdegree",!0),p(g,b,A,"£","\\pounds"),p(g,b,A,"£","\\mathsterling",!0),p($,b,A,"£","\\pounds"),p($,b,A,"£","\\textsterling",!0),p(g,T,A,"✠","\\maltese"),p($,T,A,"✠","\\maltese");for(var _f='0123456789/@."',Rl=0;Rl<_f.length;Rl++){var jf=_f.charAt(Rl);p(g,b,A,jf,jf)}for(var qf='0123456789!@*()-=+";:?/.,',Pl=0;Pl<qf.length;Pl++){var Wf=qf.charAt(Pl);p($,b,A,Wf,Wf)}for(var ro="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",zl=0;zl<ro.length;zl++){var no=ro.charAt(zl);p(g,b,ae,no,no),p($,b,A,no,no)}p(g,T,A,"C","ℂ"),p($,T,A,"C","ℂ"),p(g,T,A,"H","ℍ"),p($,T,A,"H","ℍ"),p(g,T,A,"N","ℕ"),p($,T,A,"N","ℕ"),p(g,T,A,"P","ℙ"),p($,T,A,"P","ℙ"),p(g,T,A,"Q","ℚ"),p($,T,A,"Q","ℚ"),p(g,T,A,"R","ℝ"),p($,T,A,"R","ℝ"),p(g,T,A,"Z","ℤ"),p($,T,A,"Z","ℤ"),p(g,b,ae,"h","ℎ"),p($,b,ae,"h","ℎ");for(var ue="",dt=0;dt<ro.length;dt++){var $e=ro.charAt(dt);ue=String.fromCharCode(55349,56320+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56372+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56424+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56580+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56684+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56736+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56788+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56840+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56944+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),dt<26&&(ue=String.fromCharCode(55349,56632+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue),ue=String.fromCharCode(55349,56476+dt),p(g,b,ae,$e,ue),p($,b,A,$e,ue))}ue="𝕜",p(g,b,ae,"k",ue),p($,b,A,"k",ue);for(var wn=0;wn<10;wn++){var Yr=wn.toString();ue=String.fromCharCode(55349,57294+wn),p(g,b,ae,Yr,ue),p($,b,A,Yr,ue),ue=String.fromCharCode(55349,57314+wn),p(g,b,ae,Yr,ue),p($,b,A,Yr,ue),ue=String.fromCharCode(55349,57324+wn),p(g,b,ae,Yr,ue),p($,b,A,Yr,ue),ue=String.fromCharCode(55349,57334+wn),p(g,b,ae,Yr,ue),p($,b,A,Yr,ue)}for(var Ll="ÐÞþ",Bl=0;Bl<Ll.length;Bl++){var io=Ll.charAt(Bl);p(g,b,ae,io,io),p($,b,A,io,io)}var so=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],Uf=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],ub=function(e,t){var n=e.charCodeAt(0),i=e.charCodeAt(1),s=(n-55296)*1024+(i-56320)+65536,o=t==="math"?0:1;if(119808<=s&&s<120484){var a=Math.floor((s-119808)/26);return[so[a][2],so[a][o]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[Uf[l][2],Uf[l][o]]}else{if(s===120485||s===120486)return[so[0][2],so[0][o]];if(120486<s&&s<120782)return["",""];throw new _("Unsupported character: "+e)}},oo=function(e,t,n){return Ne[n][e]&&Ne[n][e].replace&&(e=Ne[n][e].replace),{value:e,metrics:Al(e,t,n)}},Ht=function(e,t,n,i,s){var o=oo(e,t,n),a=o.metrics;e=o.value;var l;if(a){var u=a.italic;(n==="text"||i&&i.font==="mathit")&&(u=0),l=new zt(e,a.height,a.depth,u,a.skew,a.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+t+"' and mode '"+n+"'")),l=new zt(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var c=i.getColor();c&&(l.style.color=c)}return l},cb=function(e,t,n,i){return i===void 0&&(i=[]),n.font==="boldsymbol"&&oo(e,"Main-Bold",t).metrics?Ht(e,"Main-Bold",t,n,i.concat(["mathbf"])):e==="\\"||Ne[t][e].font==="main"?Ht(e,"Main-Regular",t,n,i):Ht(e,"AMS-Regular",t,n,i.concat(["amsrm"]))},db=function(e,t,n,i,s){return s!=="textord"&&oo(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},hb=function(e,t,n){var i=e.mode,s=e.text,o=["mord"],a=i==="math"||i==="text"&&t.font,l=a?t.font:t.fontFamily,u="",c="";if(s.charCodeAt(0)===55349&&([u,c]=ub(s,i)),u.length>0)return Ht(s,u,i,t,o.concat(c));if(l){var d,f;if(l==="boldsymbol"){var h=db(s,i,t,o,n);d=h.fontName,f=[h.fontClass]}else a?(d=Yf[l].fontName,f=[l]):(d=ao(l,t.fontWeight,t.fontShape),f=[l,t.fontWeight,t.fontShape]);if(oo(s,d,i).metrics)return Ht(s,d,i,t,o.concat(f));if(Vf.hasOwnProperty(s)&&d.slice(0,10)==="Typewriter"){for(var m=[],v=0;v<s.length;v++)m.push(Ht(s[v],d,i,t,o.concat(f)));return Kf(m)}}if(n==="mathord")return Ht(s,"Math-Italic",i,t,o.concat(["mathnormal"]));if(n==="textord"){var y=Ne[i][s]&&Ne[i][s].font;if(y==="ams"){var w=ao("amsrm",t.fontWeight,t.fontShape);return Ht(s,w,i,t,o.concat("amsrm",t.fontWeight,t.fontShape))}else if(y==="main"||!y){var k=ao("textrm",t.fontWeight,t.fontShape);return Ht(s,k,i,t,o.concat(t.fontWeight,t.fontShape))}else{var E=ao(y,t.fontWeight,t.fontShape);return Ht(s,E,i,t,o.concat(E,t.fontWeight,t.fontShape))}}else throw new Error("unexpected type: "+n+" in makeOrd")},fb=(r,e)=>{if(Gr(r.classes)!==Gr(e.classes)||r.skew!==e.skew||r.maxFontSize!==e.maxFontSize)return!1;if(r.classes.length===1){var t=r.classes[0];if(t==="mbin"||t==="mord")return!1}for(var n in r.style)if(r.style.hasOwnProperty(n)&&r.style[n]!==e.style[n])return!1;for(var i in e.style)if(e.style.hasOwnProperty(i)&&r.style[i]!==e.style[i])return!1;return!0},pb=r=>{for(var e=0;e<r.length-1;e++){var t=r[e],n=r[e+1];t instanceof zt&&n instanceof zt&&fb(t,n)&&(t.text+=n.text,t.height=Math.max(t.height,n.height),t.depth=Math.max(t.depth,n.depth),t.italic=n.italic,r.splice(e+1,1),e--)}return r},Fl=function(e){for(var t=0,n=0,i=0,s=0;s<e.children.length;s++){var o=e.children[s];o.height>t&&(t=o.height),o.depth>n&&(n=o.depth),o.maxFontSize>i&&(i=o.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=i},vt=function(e,t,n,i){var s=new Pi(e,t,n,i);return Fl(s),s},Gf=(r,e,t,n)=>new Pi(r,e,t,n),mb=function(e,t,n){var i=vt([e],[],t);return i.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),i.style.borderBottomWidth=q(i.height),i.maxFontSize=1,i},gb=function(e,t,n,i){var s=new Dl(e,t,n,i);return Fl(s),s},Kf=function(e){var t=new Ri(e);return Fl(t),t},vb=function(e,t){return e instanceof Ri?vt([],[e],t):e},yb=function(e){if(e.positionType==="individualShift"){for(var t=e.children,n=[t[0]],i=-t[0].shift-t[0].elem.depth,s=i,o=1;o<t.length;o++){var a=-t[o].shift-s-t[o].elem.depth,l=a-(t[o-1].elem.height+t[o-1].elem.depth);s=s+a,n.push({type:"kern",size:l}),n.push(t[o])}return{children:n,depth:i}}var u;if(e.positionType==="top"){for(var c=e.positionData,d=0;d<e.children.length;d++){var f=e.children[d];c-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}u=c}else if(e.positionType==="bottom")u=-e.positionData;else{var h=e.children[0];if(h.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")u=-h.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")u=-h.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:u}},bb=function(e,t){for(var{children:n,depth:i}=yb(e),s=0,o=0;o<n.length;o++){var a=n[o];if(a.type==="elem"){var l=a.elem;s=Math.max(s,l.maxFontSize,l.height)}}s+=2;var u=vt(["pstrut"],[]);u.style.height=q(s);for(var c=[],d=i,f=i,h=i,m=0;m<n.length;m++){var v=n[m];if(v.type==="kern")h+=v.size;else{var y=v.elem,w=v.wrapperClasses||[],k=v.wrapperStyle||{},E=vt(w,[u,y],void 0,k);E.style.top=q(-s-h-y.depth),v.marginLeft&&(E.style.marginLeft=v.marginLeft),v.marginRight&&(E.style.marginRight=v.marginRight),c.push(E),h+=y.height+y.depth}d=Math.min(d,h),f=Math.max(f,h)}var R=vt(["vlist"],c);R.style.height=q(f);var O;if(d<0){var N=vt([],[]),D=vt(["vlist"],[N]);D.style.height=q(-d);var B=vt(["vlist-s"],[new zt("​")]);O=[vt(["vlist-r"],[R,B]),vt(["vlist-r"],[D])]}else O=[vt(["vlist-r"],[R])];var L=vt(["vlist-t"],O);return O.length===2&&L.classes.push("vlist-t2"),L.height=f,L.depth=-d,L},wb=(r,e)=>{var t=vt(["mspace"],[],e),n=Pe(r,e);return t.style.marginRight=q(n),t},ao=function(e,t,n){var i="";switch(e){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=e}var s;return t==="textbf"&&n==="textit"?s="BoldItalic":t==="textbf"?s="Bold":t==="textit"?s="Italic":s="Regular",i+"-"+s},Yf={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Jf={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},xb=function(e,t){var[n,i,s]=Jf[e],o=new Kr(n),a=new gr([o],{width:q(i),height:q(s),style:"width:"+q(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=Gf(["overlay"],[a],t);return l.height=s,l.style.height=q(s),l.style.width=q(i),l},P={fontMap:Yf,makeSymbol:Ht,mathsym:cb,makeSpan:vt,makeSvgSpan:Gf,makeLineSpan:mb,makeAnchor:gb,makeFragment:Kf,wrapFragment:vb,makeVList:bb,makeOrd:hb,makeGlue:wb,staticSvg:xb,svgData:Jf,tryCombineChars:pb},ze={number:3,unit:"mu"},xn={number:4,unit:"mu"},yr={number:5,unit:"mu"},Sb={mord:{mop:ze,mbin:xn,mrel:yr,minner:ze},mop:{mord:ze,mop:ze,mrel:yr,minner:ze},mbin:{mord:xn,mop:xn,mopen:xn,minner:xn},mrel:{mord:yr,mop:yr,mopen:yr,minner:yr},mopen:{},mclose:{mop:ze,mbin:xn,mrel:yr,minner:ze},mpunct:{mord:ze,mop:ze,mrel:yr,mopen:ze,mclose:ze,mpunct:ze,minner:ze},minner:{mord:ze,mop:ze,mbin:xn,mrel:yr,mopen:ze,mpunct:ze,minner:ze}},kb={mord:{mop:ze},mop:{mord:ze,mop:ze},mbin:{},mrel:{},mopen:{},mclose:{mop:ze},mpunct:{},minner:{mop:ze}},Xf={},lo={},uo={};function Y(r){for(var{type:e,names:t,props:n,handler:i,htmlBuilder:s,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},l=0;l<t.length;++l)Xf[t[l]]=a;e&&(s&&(lo[e]=s),o&&(uo[e]=o))}function Sn(r){var{type:e,htmlBuilder:t,mathmlBuilder:n}=r;Y({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:t,mathmlBuilder:n})}var co=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},_e=function(e){return e.type==="ordgroup"?e.body:[e]},br=P.makeSpan,Tb=["leftmost","mbin","mopen","mrel","mop","mpunct"],Mb=["rightmost","mrel","mclose","mpunct"],Cb={display:oe.DISPLAY,text:oe.TEXT,script:oe.SCRIPT,scriptscript:oe.SCRIPTSCRIPT},Eb={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Ge=function(e,t,n,i){i===void 0&&(i=[null,null]);for(var s=[],o=0;o<e.length;o++){var a=ge(e[o],t);if(a instanceof Ri){var l=a.children;s.push(...l)}else s.push(a)}if(P.tryCombineChars(s),!n)return s;var u=t;if(e.length===1){var c=e[0];c.type==="sizing"?u=t.havingSize(c.size):c.type==="styling"&&(u=t.havingStyle(Cb[c.style]))}var d=br([i[0]||"leftmost"],[],t),f=br([i[1]||"rightmost"],[],t),h=n==="root";return Zf(s,(m,v)=>{var y=v.classes[0],w=m.classes[0];y==="mbin"&&Mb.includes(w)?v.classes[0]="mord":w==="mbin"&&Tb.includes(y)&&(m.classes[0]="mord")},{node:d},f,h),Zf(s,(m,v)=>{var y=$l(v),w=$l(m),k=y&&w?m.hasClass("mtight")?kb[y][w]:Sb[y][w]:null;if(k)return P.makeGlue(k,u)},{node:d},f,h),s},Zf=function r(e,t,n,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var a=e[o],l=Qf(a);if(l){r(l.children,t,n,null,s);continue}var u=!a.hasClass("mspace");if(u){var c=t(a,n.node);c&&(n.insertAfter?n.insertAfter(c):(e.unshift(c),o++))}u?n.node=a:s&&a.hasClass("newline")&&(n.node=br(["leftmost"])),n.insertAfter=(d=>f=>{e.splice(d+1,0,f),o++})(o)}i&&e.pop()},Qf=function(e){return e instanceof Ri||e instanceof Dl||e instanceof Pi&&e.hasClass("enclosing")?e:null},Ab=function r(e,t){var n=Qf(e);if(n){var i=n.children;if(i.length){if(t==="right")return r(i[i.length-1],"right");if(t==="left")return r(i[0],"left")}}return e},$l=function(e,t){return e?(t&&(e=Ab(e,t)),Eb[e.classes[0]]||null):null},zi=function(e,t){var n=["nulldelimiter"].concat(e.baseSizingClasses());return br(t.concat(n))},ge=function(e,t,n){if(!e)return br();if(lo[e.type]){var i=lo[e.type](e,t);if(n&&t.size!==n.size){i=br(t.sizingClasses(n),[i],t);var s=t.sizeMultiplier/n.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new _("Got group of unknown type: '"+e.type+"'")};function ho(r,e){var t=br(["base"],r,e),n=br(["strut"]);return n.style.height=q(t.height+t.depth),t.depth&&(n.style.verticalAlign=q(-t.depth)),t.children.unshift(n),t}function Hl(r,e){var t=null;r.length===1&&r[0].type==="tag"&&(t=r[0].tag,r=r[0].body);var n=Ge(r,e,"root"),i;n.length===2&&n[1].hasClass("tag")&&(i=n.pop());for(var s=[],o=[],a=0;a<n.length;a++)if(o.push(n[a]),n[a].hasClass("mbin")||n[a].hasClass("mrel")||n[a].hasClass("allowbreak")){for(var l=!1;a<n.length-1&&n[a+1].hasClass("mspace")&&!n[a+1].hasClass("newline");)a++,o.push(n[a]),n[a].hasClass("nobreak")&&(l=!0);l||(s.push(ho(o,e)),o=[])}else n[a].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(ho(o,e)),o=[]),s.push(n[a]));o.length>0&&s.push(ho(o,e));var u;t?(u=ho(Ge(t,e,!0)),u.classes=["tag"],s.push(u)):i&&s.push(i);var c=br(["katex-html"],s);if(c.setAttribute("aria-hidden","true"),u){var d=u.children[0];d.style.height=q(c.height+c.depth),c.depth&&(d.style.verticalAlign=q(-c.depth))}return c}function ep(r){return new Ri(r)}class Ct{constructor(e,t,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=Gr(this.classes));for(var n=0;n<this.children.length;n++)if(this.children[n]instanceof Xt&&this.children[n+1]instanceof Xt){for(var i=this.children[n].toText()+this.children[++n].toText();this.children[n+1]instanceof Xt;)i+=this.children[++n].toText();e.appendChild(new Xt(i).toNode())}else e.appendChild(this.children[n].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=ye.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+ye.escape(Gr(this.classes))+'"'),e+=">";for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Xt{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return ye.escape(this.toText())}toText(){return this.text}}class Ob{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",q(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+q(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var H={MathNode:Ct,TextNode:Xt,SpaceNode:Ob,newDocumentFragment:ep},Lt=function(e,t,n){return Ne[t][e]&&Ne[t][e].replace&&e.charCodeAt(0)!==55349&&!(Vf.hasOwnProperty(e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(e=Ne[t][e].replace),new H.TextNode(e)},Vl=function(e){return e.length===1?e[0]:new H.MathNode("mrow",e)},_l=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";var n=t.font;if(!n||n==="mathnormal")return null;var i=e.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathsfit")return"sans-serif-italic";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var s=e.text;if(["\\imath","\\jmath"].includes(s))return null;Ne[i][s]&&Ne[i][s].replace&&(s=Ne[i][s].replace);var o=P.fontMap[n].fontName;return Al(s,o,i)?P.fontMap[n].variant:null};function jl(r){if(!r)return!1;if(r.type==="mi"&&r.children.length===1){var e=r.children[0];return e instanceof Xt&&e.text==="."}else if(r.type==="mo"&&r.children.length===1&&r.getAttribute("separator")==="true"&&r.getAttribute("lspace")==="0em"&&r.getAttribute("rspace")==="0em"){var t=r.children[0];return t instanceof Xt&&t.text===","}else return!1}var yt=function(e,t,n){if(e.length===1){var i=Oe(e[0],t);return n&&i instanceof Ct&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,a=0;a<e.length;a++){var l=Oe(e[a],t);if(l instanceof Ct&&o instanceof Ct){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(jl(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&jl(o))l.children=[...o.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||jl(o))){var u=l.children[0];u instanceof Ct&&u.type==="mn"&&(u.children=[...o.children,...u.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var c=o.children[0];if(c instanceof Xt&&c.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof Xt&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),s.pop())}}}s.push(l),o=l}return s},Jr=function(e,t,n){return Vl(yt(e,t,n))},Oe=function(e,t){if(!e)return new H.MathNode("mrow");if(uo[e.type]){var n=uo[e.type](e,t);return n}else throw new _("Got group of unknown type: '"+e.type+"'")};function tp(r,e,t,n,i){var s=yt(r,t),o;s.length===1&&s[0]instanceof Ct&&["mrow","mtable"].includes(s[0].type)?o=s[0]:o=new H.MathNode("mrow",s);var a=new H.MathNode("annotation",[new H.TextNode(e)]);a.setAttribute("encoding","application/x-tex");var l=new H.MathNode("semantics",[o,a]),u=new H.MathNode("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&u.setAttribute("display","block");var c=i?"katex":"katex-mathml";return P.makeSpan([c],[u])}var rp=function(e){return new mr({style:e.displayMode?oe.DISPLAY:oe.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},np=function(e,t){if(t.displayMode){var n=["katex-display"];t.leqno&&n.push("leqno"),t.fleqn&&n.push("fleqn"),e=P.makeSpan(n,[e])}return e},Nb=function(e,t,n){var i=rp(n),s;if(n.output==="mathml")return tp(e,t,i,n.displayMode,!0);if(n.output==="html"){var o=Hl(e,i);s=P.makeSpan(["katex"],[o])}else{var a=tp(e,t,i,n.displayMode,!1),l=Hl(e,i);s=P.makeSpan(["katex"],[a,l])}return np(s,n)},Db=function(e,t,n){var i=rp(n),s=Hl(e,i),o=P.makeSpan(["katex"],[s]);return np(o,n)},Ib={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Rb=function(e){var t=new H.MathNode("mo",[new H.TextNode(Ib[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},Pb={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},zb=function(e){return e.type==="ordgroup"?e.body.length:1},Lb=function(e,t){function n(){var a=4e5,l=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(l)){var u=e,c=zb(u.base),d,f,h;if(c>5)l==="widehat"||l==="widecheck"?(d=420,a=2364,h=.42,f=l+"4"):(d=312,a=2340,h=.34,f="tilde4");else{var m=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][m],d=[0,239,300,360,420][m],h=[0,.24,.3,.3,.36,.42][m],f=l+m):(a=[0,600,1033,2339,2340][m],d=[0,260,286,306,312][m],h=[0,.26,.286,.3,.306,.34][m],f="tilde"+m)}var v=new Kr(f),y=new gr([v],{width:"100%",height:q(h),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:P.makeSvgSpan([],[y],t),minWidth:0,height:h}}else{var w=[],k=Pb[l],[E,R,O]=k,N=O/1e3,D=E.length,B,L;if(D===1){var V=k[3];B=["hide-tail"],L=[V]}else if(D===2)B=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(D===3)B=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
861
+ `+D+" children.");for(var te=0;te<D;te++){var ne=new Kr(E[te]),he=new gr([ne],{width:"400em",height:q(N),viewBox:"0 0 "+a+" "+O,preserveAspectRatio:L[te]+" slice"}),re=P.makeSvgSpan([B[te]],[he],t);if(D===1)return{span:re,minWidth:R,height:N};re.style.height=q(N),w.push(re)}return{span:P.makeSpan(["stretchy"],w,t),minWidth:R,height:N}}}var{span:i,minWidth:s,height:o}=n();return i.height=o,i.style.height=q(o),s>0&&(i.style.minWidth=q(s)),i},Bb=function(e,t,n,i,s){var o,a=e.height+e.depth+n+i;if(/fbox|color|angl/.test(t)){if(o=P.makeSpan(["stretchy",t],[],s),t==="fbox"){var l=s.color&&s.getColor();l&&(o.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(t)&&u.push(new Il({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&u.push(new Il({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new gr(u,{width:"100%",height:q(a)});o=P.makeSvgSpan([],[c],s)}return o.height=a,o.style.height=q(a),o},wr={encloseSpan:Bb,mathMLnode:Rb,svgSpan:Lb};function pe(r,e){if(!r||r.type!==e)throw new Error("Expected node of type "+e+", but got "+(r?"node of type "+r.type:String(r)));return r}function ql(r){var e=fo(r);if(!e)throw new Error("Expected node of symbol group type, but got "+(r?"node of type "+r.type:String(r)));return e}function fo(r){return r&&(r.type==="atom"||lb.hasOwnProperty(r.type))?r:null}var Wl=(r,e)=>{var t,n,i;r&&r.type==="supsub"?(n=pe(r.base,"accent"),t=n.base,r.base=t,i=ob(ge(r,e)),r.base=n):(n=pe(r,"accent"),t=n.base);var s=ge(t,e.havingCrampedStyle()),o=n.isShifty&&ye.isCharacterBox(t),a=0;if(o){var l=ye.getBaseElem(t),u=ge(l,e.havingCrampedStyle());a=Hf(u).skew}var c=n.label==="\\c",d=c?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),f;if(n.isStretchy)f=wr.svgSpan(n,e),f=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+q(2*a)+")",marginLeft:q(2*a)}:void 0}]},e);else{var h,m;n.label==="\\vec"?(h=P.staticSvg("vec",e),m=P.svgData.vec[1]):(h=P.makeOrd({mode:n.mode,text:n.label},e,"textord"),h=Hf(h),h.italic=0,m=h.width,c&&(d+=h.depth)),f=P.makeSpan(["accent-body"],[h]);var v=n.label==="\\textcircled";v&&(f.classes.push("accent-full"),d=s.height);var y=a;v||(y-=m/2),f.style.left=q(y),n.label==="\\textcircled"&&(f.style.top=".2em"),f=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-d},{type:"elem",elem:f}]},e)}var w=P.makeSpan(["mord","accent"],[f],e);return i?(i.children[0]=w,i.height=Math.max(w.height,i.height),i.classes[0]="mord",i):w},ip=(r,e)=>{var t=r.isStretchy?wr.mathMLnode(r.label):new H.MathNode("mo",[Lt(r.label,r.mode)]),n=new H.MathNode("mover",[Oe(r.base,e),t]);return n.setAttribute("accent","true"),n},Fb=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(r=>"\\"+r).join("|"));Y({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(r,e)=>{var t=co(e[0]),n=!Fb.test(r.funcName),i=!n||r.funcName==="\\widehat"||r.funcName==="\\widetilde"||r.funcName==="\\widecheck";return{type:"accent",mode:r.parser.mode,label:r.funcName,isStretchy:n,isShifty:i,base:t}},htmlBuilder:Wl,mathmlBuilder:ip}),Y({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(r,e)=>{var t=e[0],n=r.parser.mode;return n==="math"&&(r.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+r.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:r.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:Wl,mathmlBuilder:ip}),Y({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"accentUnder",mode:t.mode,label:n,base:i}},htmlBuilder:(r,e)=>{var t=ge(r.base,e),n=wr.svgSpan(r,e),i=r.label==="\\utilde"?.12:0,s=P.makeVList({positionType:"top",positionData:t.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:t}]},e);return P.makeSpan(["mord","accentunder"],[s],e)},mathmlBuilder:(r,e)=>{var t=wr.mathMLnode(r.label),n=new H.MathNode("munder",[Oe(r.base,e),t]);return n.setAttribute("accentunder","true"),n}});var po=r=>{var e=new H.MathNode("mpadded",r?[r]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Y({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n,funcName:i}=r;return{type:"xArrow",mode:n.mode,label:i,body:e[0],below:t[0]}},htmlBuilder(r,e){var t=e.style,n=e.havingStyle(t.sup()),i=P.wrapFragment(ge(r.body,n,e),e),s=r.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var o;r.below&&(n=e.havingStyle(t.sub()),o=P.wrapFragment(ge(r.below,n,e),e),o.classes.push(s+"-arrow-pad"));var a=wr.svgSpan(r,e),l=-e.fontMetrics().axisHeight+.5*a.height,u=-e.fontMetrics().axisHeight-.5*a.height-.111;(i.depth>.25||r.label==="\\xleftequilibrium")&&(u-=i.depth);var c;if(o){var d=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;c=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:a,shift:l},{type:"elem",elem:o,shift:d}]},e)}else c=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:a,shift:l}]},e);return c.children[0].children[0].children[1].classes.push("svg-align"),P.makeSpan(["mrel","x-arrow"],[c],e)},mathmlBuilder(r,e){var t=wr.mathMLnode(r.label);t.setAttribute("minsize",r.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(r.body){var i=po(Oe(r.body,e));if(r.below){var s=po(Oe(r.below,e));n=new H.MathNode("munderover",[t,s,i])}else n=new H.MathNode("mover",[t,i])}else if(r.below){var o=po(Oe(r.below,e));n=new H.MathNode("munder",[t,o])}else n=po(),n=new H.MathNode("mover",[t,n]);return n}});var $b=P.makeSpan;function sp(r,e){var t=Ge(r.body,e,!0);return $b([r.mclass],t,e)}function op(r,e){var t,n=yt(r.body,e);return r.mclass==="minner"?t=new H.MathNode("mpadded",n):r.mclass==="mord"?r.isCharacterBox?(t=n[0],t.type="mi"):t=new H.MathNode("mi",n):(r.isCharacterBox?(t=n[0],t.type="mo"):t=new H.MathNode("mo",n),r.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):r.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):r.mclass==="mopen"||r.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):r.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}Y({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"mclass",mode:t.mode,mclass:"m"+n.slice(5),body:_e(i),isCharacterBox:ye.isCharacterBox(i)}},htmlBuilder:sp,mathmlBuilder:op});var mo=r=>{var e=r.type==="ordgroup"&&r.body.length?r.body[0]:r;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Y({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(r,e){var{parser:t}=r;return{type:"mclass",mode:t.mode,mclass:mo(e[0]),body:_e(e[1]),isCharacterBox:ye.isCharacterBox(e[1])}}}),Y({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(r,e){var{parser:t,funcName:n}=r,i=e[1],s=e[0],o;n!=="\\stackrel"?o=mo(i):o="mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:_e(i)},l={type:"supsub",mode:s.mode,base:a,sup:n==="\\underset"?null:s,sub:n==="\\underset"?s:null};return{type:"mclass",mode:t.mode,mclass:o,body:[l],isCharacterBox:ye.isCharacterBox(l)}},htmlBuilder:sp,mathmlBuilder:op}),Y({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"pmb",mode:t.mode,mclass:mo(e[0]),body:_e(e[0])}},htmlBuilder(r,e){var t=Ge(r.body,e,!0),n=P.makeSpan([r.mclass],t,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(r,e){var t=yt(r.body,e),n=new H.MathNode("mstyle",t);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});var Hb={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},ap=()=>({type:"styling",body:[],mode:"math",style:"display"}),lp=r=>r.type==="textord"&&r.text==="@",Vb=(r,e)=>(r.type==="mathord"||r.type==="atom")&&r.text===e;function _b(r,e,t){var n=Hb[r];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=t.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:n,mode:"math",family:"rel"},o=t.callFunction("\\Big",[s],[]),a=t.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,o,a]};return t.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function jb(r){var e=[];for(r.gullet.beginGroup(),r.gullet.macros.set("\\cr","\\\\\\relax"),r.gullet.beginGroup();;){e.push(r.parseExpression(!1,"\\\\")),r.gullet.endGroup(),r.gullet.beginGroup();var t=r.fetch().text;if(t==="&"||t==="\\\\")r.consume();else if(t==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new _("Expected \\\\ or \\cr or \\end",r.nextToken)}for(var n=[],i=[n],s=0;s<e.length;s++){for(var o=e[s],a=ap(),l=0;l<o.length;l++)if(!lp(o[l]))a.body.push(o[l]);else{n.push(a),l+=1;var u=ql(o[l]).text,c=new Array(2);if(c[0]={type:"ordgroup",mode:"math",body:[]},c[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(u)>-1))if("<>AV".indexOf(u)>-1)for(var d=0;d<2;d++){for(var f=!0,h=l+1;h<o.length;h++){if(Vb(o[h],u)){f=!1,l=h;break}if(lp(o[h]))throw new _("Missing a "+u+" character to complete a CD arrow.",o[h]);c[d].body.push(o[h])}if(f)throw new _("Missing a "+u+" character to complete a CD arrow.",o[l])}else throw new _('Expected one of "<>AV=|." after @',o[l]);var m=_b(u,c,r),v={type:"styling",body:[m],mode:"math",style:"display"};n.push(v),a=ap()}s%2===0?n.push(a):n.shift(),n=[],i.push(n)}r.gullet.endGroup(),r.gullet.endGroup();var y=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:y,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}Y({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"cdlabel",mode:t.mode,side:n.slice(4),label:e[0]}},htmlBuilder(r,e){var t=e.havingStyle(e.style.sup()),n=P.wrapFragment(ge(r.label,t,e),e);return n.classes.push("cd-label-"+r.side),n.style.bottom=q(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(r,e){var t=new H.MathNode("mrow",[Oe(r.label,e)]);return t=new H.MathNode("mpadded",[t]),t.setAttribute("width","0"),r.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new H.MathNode("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}}),Y({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(r,e){var{parser:t}=r;return{type:"cdlabelparent",mode:t.mode,fragment:e[0]}},htmlBuilder(r,e){var t=P.wrapFragment(ge(r.fragment,e),e);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(r,e){return new H.MathNode("mrow",[Oe(r.fragment,e)])}}),Y({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(r,e){for(var{parser:t}=r,n=pe(e[0],"ordgroup"),i=n.body,s="",o=0;o<i.length;o++){var a=pe(i[o],"textord");s+=a.text}var l=parseInt(s),u;if(isNaN(l))throw new _("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new _("\\@char with invalid code point "+s);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:t.mode,text:u}}});var up=(r,e)=>{var t=Ge(r.body,e.withColor(r.color),!1);return P.makeFragment(t)},cp=(r,e)=>{var t=yt(r.body,e.withColor(r.color)),n=new H.MathNode("mstyle",t);return n.setAttribute("mathcolor",r.color),n};Y({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(r,e){var{parser:t}=r,n=pe(e[0],"color-token").color,i=e[1];return{type:"color",mode:t.mode,color:n,body:_e(i)}},htmlBuilder:up,mathmlBuilder:cp}),Y({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(r,e){var{parser:t,breakOnTokenText:n}=r,i=pe(e[0],"color-token").color;t.gullet.macros.set("\\current@color",i);var s=t.parseExpression(!0,n);return{type:"color",mode:t.mode,color:i,body:s}},htmlBuilder:up,mathmlBuilder:cp}),Y({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(r,e,t){var{parser:n}=r,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,s=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:s,size:i&&pe(i,"size").value}},htmlBuilder(r,e){var t=P.makeSpan(["mspace"],[],e);return r.newLine&&(t.classes.push("newline"),r.size&&(t.style.marginTop=q(Pe(r.size,e)))),t},mathmlBuilder(r,e){var t=new H.MathNode("mspace");return r.newLine&&(t.setAttribute("linebreak","newline"),r.size&&t.setAttribute("height",q(Pe(r.size,e)))),t}});var Ul={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},dp=r=>{var e=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new _("Expected a control sequence",r);return e},qb=r=>{var e=r.gullet.popToken();return e.text==="="&&(e=r.gullet.popToken(),e.text===" "&&(e=r.gullet.popToken())),e},hp=(r,e,t,n)=>{var i=r.gullet.macros.get(t.text);i==null&&(t.noexpand=!0,i={tokens:[t],numArgs:0,unexpandable:!r.gullet.isExpandable(t.text)}),r.gullet.macros.set(e,i,n)};Y({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(r){var{parser:e,funcName:t}=r;e.consumeSpaces();var n=e.fetch();if(Ul[n.text])return(t==="\\global"||t==="\\\\globallong")&&(n.text=Ul[n.text]),pe(e.parseFunction(),"internal");throw new _("Invalid token after macro prefix",n)}}),Y({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=e.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new _("Expected a control sequence",n);for(var s=0,o,a=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),a[s].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new _('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==s+1)throw new _('Argument number "'+n.text+'" out of order');s++,a.push([])}else{if(n.text==="EOF")throw new _("Expected a macro definition");a[s].push(n.text)}var{tokens:l}=e.gullet.consumeArg();return o&&l.unshift(o),(t==="\\edef"||t==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:a},t===Ul[t]),{type:"internal",mode:e.mode}}}),Y({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=dp(e.gullet.popToken());e.gullet.consumeSpaces();var i=qb(e);return hp(e,n,i,t==="\\\\globallet"),{type:"internal",mode:e.mode}}}),Y({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r){var{parser:e,funcName:t}=r,n=dp(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return hp(e,n,s,t==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var Li=function(e,t,n){var i=Ne.math[e]&&Ne.math[e].replace,s=Al(i||e,t,n);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return s},Gl=function(e,t,n,i){var s=n.havingBaseStyle(t),o=P.makeSpan(i.concat(s.sizingClasses(n)),[e],n),a=s.sizeMultiplier/n.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=s.sizeMultiplier,o},fp=function(e,t,n){var i=t.havingBaseStyle(n),s=(1-t.sizeMultiplier/i.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=q(s),e.height-=s,e.depth+=s},Wb=function(e,t,n,i,s,o){var a=P.makeSymbol(e,"Main-Regular",s,i),l=Gl(a,t,i,o);return n&&fp(l,i,t),l},Ub=function(e,t,n,i){return P.makeSymbol(e,"Size"+t+"-Regular",n,i)},pp=function(e,t,n,i,s,o){var a=Ub(e,t,s,i),l=Gl(P.makeSpan(["delimsizing","size"+t],[a],i),oe.TEXT,i,o);return n&&fp(l,i,oe.TEXT),l},Kl=function(e,t,n){var i;t==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=P.makeSpan(["delimsizinginner",i],[P.makeSpan([],[P.makeSymbol(e,t,n)])]);return{type:"elem",elem:s}},Yl=function(e,t,n){var i=Jt["Size4-Regular"][e.charCodeAt(0)]?Jt["Size4-Regular"][e.charCodeAt(0)][4]:Jt["Size1-Regular"][e.charCodeAt(0)][4],s=new Kr("inner",X7(e,Math.round(1e3*t))),o=new gr([s],{width:q(i),height:q(t),style:"width:"+q(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),a=P.makeSvgSpan([],[o],n);return a.height=t,a.style.height=q(t),a.style.width=q(i),{type:"elem",elem:a}},Jl=.008,go={type:"kern",size:-1*Jl},Gb=["|","\\lvert","\\rvert","\\vert"],Kb=["\\|","\\lVert","\\rVert","\\Vert"],mp=function(e,t,n,i,s,o){var a,l,u,c,d="",f=0;a=u=c=e,l=null;var h="Size1-Regular";e==="\\uparrow"?u=c="⏐":e==="\\Uparrow"?u=c="‖":e==="\\downarrow"?a=u="⏐":e==="\\Downarrow"?a=u="‖":e==="\\updownarrow"?(a="\\uparrow",u="⏐",c="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",u="‖",c="\\Downarrow"):Gb.includes(e)?(u="∣",d="vert",f=333):Kb.includes(e)?(u="∥",d="doublevert",f=556):e==="["||e==="\\lbrack"?(a="⎡",u="⎢",c="⎣",h="Size4-Regular",d="lbrack",f=667):e==="]"||e==="\\rbrack"?(a="⎤",u="⎥",c="⎦",h="Size4-Regular",d="rbrack",f=667):e==="\\lfloor"||e==="⌊"?(u=a="⎢",c="⎣",h="Size4-Regular",d="lfloor",f=667):e==="\\lceil"||e==="⌈"?(a="⎡",u=c="⎢",h="Size4-Regular",d="lceil",f=667):e==="\\rfloor"||e==="⌋"?(u=a="⎥",c="⎦",h="Size4-Regular",d="rfloor",f=667):e==="\\rceil"||e==="⌉"?(a="⎤",u=c="⎥",h="Size4-Regular",d="rceil",f=667):e==="("||e==="\\lparen"?(a="⎛",u="⎜",c="⎝",h="Size4-Regular",d="lparen",f=875):e===")"||e==="\\rparen"?(a="⎞",u="⎟",c="⎠",h="Size4-Regular",d="rparen",f=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",c="⎩",u="⎪",h="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",c="⎭",u="⎪",h="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",c="⎩",u="⎪",h="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",c="⎭",u="⎪",h="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",c="⎭",u="⎪",h="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",c="⎩",u="⎪",h="Size4-Regular");var m=Li(a,h,s),v=m.height+m.depth,y=Li(u,h,s),w=y.height+y.depth,k=Li(c,h,s),E=k.height+k.depth,R=0,O=1;if(l!==null){var N=Li(l,h,s);R=N.height+N.depth,O=2}var D=v+E+R,B=Math.max(0,Math.ceil((t-D)/(O*w))),L=D+B*O*w,V=i.fontMetrics().axisHeight;n&&(V*=i.sizeMultiplier);var te=L/2-V,ne=[];if(d.length>0){var he=L-v-E,re=Math.round(L*1e3),G=Z7(d,Math.round(he*1e3)),Z=new Kr(d,G),ve=(f/1e3).toFixed(3)+"em",ee=(re/1e3).toFixed(3)+"em",Se=new gr([Z],{width:ve,height:ee,viewBox:"0 0 "+f+" "+re}),C=P.makeSvgSpan([],[Se],i);C.height=re/1e3,C.style.width=ve,C.style.height=ee,ne.push({type:"elem",elem:C})}else{if(ne.push(Kl(c,h,s)),ne.push(go),l===null){var x=L-v-E+2*Jl;ne.push(Yl(u,x,i))}else{var I=(L-v-E-R)/2+2*Jl;ne.push(Yl(u,I,i)),ne.push(go),ne.push(Kl(l,h,s)),ne.push(go),ne.push(Yl(u,I,i))}ne.push(go),ne.push(Kl(a,h,s))}var j=i.havingBaseStyle(oe.TEXT),W=P.makeVList({positionType:"bottom",positionData:te,children:ne},j);return Gl(P.makeSpan(["delimsizing","mult"],[W],j),oe.TEXT,i,o)},Xl=80,Zl=.08,Ql=function(e,t,n,i,s){var o=J7(e,i,n),a=new Kr(e,o),l=new gr([a],{width:"400em",height:q(t),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return P.makeSvgSpan(["hide-tail"],[l],s)},Yb=function(e,t){var n=t.havingBaseSizing(),i=bp("\\surd",e*n.sizeMultiplier,yp,n),s=n.sizeMultiplier,o=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),a,l=0,u=0,c=0,d;return i.type==="small"?(c=1e3+1e3*o+Xl,e<1?s=1:e<1.4&&(s=.7),l=(1+o+Zl)/s,u=(1+o)/s,a=Ql("sqrtMain",l,c,o,t),a.style.minWidth="0.853em",d=.833/s):i.type==="large"?(c=(1e3+Xl)*Bi[i.size],u=(Bi[i.size]+o)/s,l=(Bi[i.size]+o+Zl)/s,a=Ql("sqrtSize"+i.size,l,c,o,t),a.style.minWidth="1.02em",d=1/s):(l=e+o+Zl,u=e+o,c=Math.floor(1e3*e+o)+Xl,a=Ql("sqrtTall",l,c,o,t),a.style.minWidth="0.742em",d=1.056),a.height=u,a.style.height=q(l),{span:a,advanceWidth:d,ruleWidth:(t.fontMetrics().sqrtRuleThickness+o)*s}},gp=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Jb=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],vp=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Bi=[0,1.2,1.8,2.4,3],Xb=function(e,t,n,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),gp.includes(e)||vp.includes(e))return pp(e,t,!1,n,i,s);if(Jb.includes(e))return mp(e,Bi[t],!1,n,i,s);throw new _("Illegal delimiter: '"+e+"'")},Zb=[{type:"small",style:oe.SCRIPTSCRIPT},{type:"small",style:oe.SCRIPT},{type:"small",style:oe.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Qb=[{type:"small",style:oe.SCRIPTSCRIPT},{type:"small",style:oe.SCRIPT},{type:"small",style:oe.TEXT},{type:"stack"}],yp=[{type:"small",style:oe.SCRIPTSCRIPT},{type:"small",style:oe.SCRIPT},{type:"small",style:oe.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],e8=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},bp=function(e,t,n,i){for(var s=Math.min(2,3-i.style.size),o=s;o<n.length&&n[o].type!=="stack";o++){var a=Li(e,e8(n[o]),"math"),l=a.height+a.depth;if(n[o].type==="small"){var u=i.havingBaseStyle(n[o].style);l*=u.sizeMultiplier}if(l>t)return n[o]}return n[n.length-1]},wp=function(e,t,n,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;vp.includes(e)?a=Zb:gp.includes(e)?a=yp:a=Qb;var l=bp(e,t,a,i);return l.type==="small"?Wb(e,l.style,n,i,s,o):l.type==="large"?pp(e,l.size,n,i,s,o):mp(e,t,n,i,s,o)},t8=function(e,t,n,i,s,o){var a=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,u=5/i.fontMetrics().ptPerEm,c=Math.max(t-a,n+a),d=Math.max(c/500*l,2*c-u);return wp(e,d,!0,i,s,o)},xr={sqrtImage:Yb,sizedDelim:Xb,sizeToMaxHeight:Bi,customSizedDelim:wp,leftRightDelim:t8},xp={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},r8=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function vo(r,e){var t=fo(r);if(t&&r8.includes(t.text))return t;throw t?new _("Invalid delimiter '"+t.text+"' after '"+e.funcName+"'",r):new _("Invalid delimiter type '"+r.type+"'",r)}Y({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(r,e)=>{var t=vo(e[0],r);return{type:"delimsizing",mode:r.parser.mode,size:xp[r.funcName].size,mclass:xp[r.funcName].mclass,delim:t.text}},htmlBuilder:(r,e)=>r.delim==="."?P.makeSpan([r.mclass]):xr.sizedDelim(r.delim,r.size,e,r.mode,[r.mclass]),mathmlBuilder:r=>{var e=[];r.delim!=="."&&e.push(Lt(r.delim,r.mode));var t=new H.MathNode("mo",e);r.mclass==="mopen"||r.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var n=q(xr.sizeToMaxHeight[r.size]);return t.setAttribute("minsize",n),t.setAttribute("maxsize",n),t}});function Sp(r){if(!r.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Y({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=r.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new _("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:r.parser.mode,delim:vo(e[0],r).text,color:t}}}),Y({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=vo(e[0],r),n=r.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var s=pe(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:t.text,right:s.delim,rightColor:s.color}},htmlBuilder:(r,e)=>{Sp(r);for(var t=Ge(r.body,e,!0,["mopen","mclose"]),n=0,i=0,s=!1,o=0;o<t.length;o++)t[o].isMiddle?s=!0:(n=Math.max(t[o].height,n),i=Math.max(t[o].depth,i));n*=e.sizeMultiplier,i*=e.sizeMultiplier;var a;if(r.left==="."?a=zi(e,["mopen"]):a=xr.leftRightDelim(r.left,n,i,e,r.mode,["mopen"]),t.unshift(a),s)for(var l=1;l<t.length;l++){var u=t[l],c=u.isMiddle;c&&(t[l]=xr.leftRightDelim(c.delim,n,i,c.options,r.mode,[]))}var d;if(r.right===".")d=zi(e,["mclose"]);else{var f=r.rightColor?e.withColor(r.rightColor):e;d=xr.leftRightDelim(r.right,n,i,f,r.mode,["mclose"])}return t.push(d),P.makeSpan(["minner"],t,e)},mathmlBuilder:(r,e)=>{Sp(r);var t=yt(r.body,e);if(r.left!=="."){var n=new H.MathNode("mo",[Lt(r.left,r.mode)]);n.setAttribute("fence","true"),t.unshift(n)}if(r.right!=="."){var i=new H.MathNode("mo",[Lt(r.right,r.mode)]);i.setAttribute("fence","true"),r.rightColor&&i.setAttribute("mathcolor",r.rightColor),t.push(i)}return Vl(t)}}),Y({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var t=vo(e[0],r);if(!r.parser.leftrightDepth)throw new _("\\middle without preceding \\left",t);return{type:"middle",mode:r.parser.mode,delim:t.text}},htmlBuilder:(r,e)=>{var t;if(r.delim===".")t=zi(e,[]);else{t=xr.sizedDelim(r.delim,1,e,r.mode,[]);var n={delim:r.delim,options:e};t.isMiddle=n}return t},mathmlBuilder:(r,e)=>{var t=r.delim==="\\vert"||r.delim==="|"?Lt("|","text"):Lt(r.delim,r.mode),n=new H.MathNode("mo",[t]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var e0=(r,e)=>{var t=P.wrapFragment(ge(r.body,e),e),n=r.label.slice(1),i=e.sizeMultiplier,s,o=0,a=ye.isCharacterBox(r.body);if(n==="sout")s=P.makeSpan(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var l=Pe({number:.6,unit:"pt"},e),u=Pe({number:.35,unit:"ex"},e),c=e.havingBaseSizing();i=i/c.sizeMultiplier;var d=t.height+t.depth+l+u;t.style.paddingLeft=q(d/2+l);var f=Math.floor(1e3*d*i),h=K7(f),m=new gr([new Kr("phase",h)],{width:"400em",height:q(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});s=P.makeSvgSpan(["hide-tail"],[m],e),s.style.height=q(d),o=t.depth+l+u}else{/cancel/.test(n)?a||t.classes.push("cancel-pad"):n==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var v=0,y=0,w=0;/box/.test(n)?(w=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),v=e.fontMetrics().fboxsep+(n==="colorbox"?0:w),y=v):n==="angl"?(w=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),v=4*w,y=Math.max(0,.25-t.depth)):(v=a?.2:0,y=v),s=wr.encloseSpan(t,n,v,y,e),/fbox|boxed|fcolorbox/.test(n)?(s.style.borderStyle="solid",s.style.borderWidth=q(w)):n==="angl"&&w!==.049&&(s.style.borderTopWidth=q(w),s.style.borderRightWidth=q(w)),o=t.depth+y,r.backgroundColor&&(s.style.backgroundColor=r.backgroundColor,r.borderColor&&(s.style.borderColor=r.borderColor))}var k;if(r.backgroundColor)k=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:o},{type:"elem",elem:t,shift:0}]},e);else{var E=/cancel|phase/.test(n)?["svg-align"]:[];k=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:s,shift:o,wrapperClasses:E}]},e)}return/cancel/.test(n)&&(k.height=t.height,k.depth=t.depth),/cancel/.test(n)&&!a?P.makeSpan(["mord","cancel-lap"],[k],e):P.makeSpan(["mord"],[k],e)},t0=(r,e)=>{var t=0,n=new H.MathNode(r.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Oe(r.body,e)]);switch(r.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*t+"pt"),n.setAttribute("height","+"+2*t+"pt"),n.setAttribute("lspace",t+"pt"),n.setAttribute("voffset",t+"pt"),r.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+i+"em solid "+String(r.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return r.backgroundColor&&n.setAttribute("mathbackground",r.backgroundColor),n};Y({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(r,e,t){var{parser:n,funcName:i}=r,s=pe(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:e0,mathmlBuilder:t0}),Y({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(r,e,t){var{parser:n,funcName:i}=r,s=pe(e[0],"color-token").color,o=pe(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:o,borderColor:s,body:a}},htmlBuilder:e0,mathmlBuilder:t0}),Y({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\fbox",body:e[0]}}}),Y({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"enclose",mode:t.mode,label:n,body:i}},htmlBuilder:e0,mathmlBuilder:t0}),Y({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"enclose",mode:t.mode,label:"\\angl",body:e[0]}}});var kp={};function Zt(r){for(var{type:e,names:t,props:n,handler:i,htmlBuilder:s,mathmlBuilder:o}=r,a={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<t.length;++l)kp[t[l]]=a;s&&(lo[e]=s),o&&(uo[e]=o)}var Tp={};function S(r,e){Tp[r]=e}function Mp(r){var e=[];r.consumeSpaces();var t=r.fetch().text;for(t==="\\relax"&&(r.consume(),r.consumeSpaces(),t=r.fetch().text);t==="\\hline"||t==="\\hdashline";)r.consume(),e.push(t==="\\hdashline"),r.consumeSpaces(),t=r.fetch().text;return e}var yo=r=>{var e=r.parser.settings;if(!e.displayMode)throw new _("{"+r.envName+"} can be used only in display mode.")};function r0(r){if(r.indexOf("ed")===-1)return r.indexOf("*")===-1}function Xr(r,e,t){var{hskipBeforeAndAfter:n,addJot:i,cols:s,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:u,emptySingleRow:c,maxNumCols:d,leqno:f}=e;if(r.gullet.beginGroup(),u||r.gullet.macros.set("\\cr","\\\\\\relax"),!o){var h=r.gullet.expandMacroAsText("\\arraystretch");if(h==null)o=1;else if(o=parseFloat(h),!o||o<0)throw new _("Invalid \\arraystretch: "+h)}r.gullet.beginGroup();var m=[],v=[m],y=[],w=[],k=l!=null?[]:void 0;function E(){l&&r.gullet.macros.set("\\@eqnsw","1",!0)}function R(){k&&(r.gullet.macros.get("\\df@tag")?(k.push(r.subparse([new Tt("\\df@tag")])),r.gullet.macros.set("\\df@tag",void 0,!0)):k.push(!!l&&r.gullet.macros.get("\\@eqnsw")==="1"))}for(E(),w.push(Mp(r));;){var O=r.parseExpression(!1,u?"\\end":"\\\\");r.gullet.endGroup(),r.gullet.beginGroup(),O={type:"ordgroup",mode:r.mode,body:O},t&&(O={type:"styling",mode:r.mode,style:t,body:[O]}),m.push(O);var N=r.fetch().text;if(N==="&"){if(d&&m.length===d){if(u||a)throw new _("Too many tab characters: &",r.nextToken);r.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}r.consume()}else if(N==="\\end"){R(),m.length===1&&O.type==="styling"&&O.body[0].body.length===0&&(v.length>1||!c)&&v.pop(),w.length<v.length+1&&w.push([]);break}else if(N==="\\\\"){r.consume();var D=void 0;r.gullet.future().text!==" "&&(D=r.parseSizeGroup(!0)),y.push(D?D.value:null),R(),w.push(Mp(r)),m=[],v.push(m),E()}else throw new _("Expected & or \\\\ or \\cr or \\end",r.nextToken)}return r.gullet.endGroup(),r.gullet.endGroup(),{type:"array",mode:r.mode,addJot:i,arraystretch:o,body:v,cols:s,rowGaps:y,hskipBeforeAndAfter:n,hLinesBeforeRow:w,colSeparationType:a,tags:k,leqno:f}}function n0(r){return r.slice(0,1)==="d"?"display":"text"}var Qt=function(e,t){var n,i,s=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(s),u=[],c=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),d=1/t.fontMetrics().ptPerEm,f=5*d;if(e.colSeparationType&&e.colSeparationType==="small"){var h=t.havingStyle(oe.SCRIPT).sizeMultiplier;f=.2778*(h/t.sizeMultiplier)}var m=e.colSeparationType==="CD"?Pe({number:3,unit:"ex"},t):12*d,v=3*d,y=e.arraystretch*m,w=.7*y,k=.3*y,E=0;function R(kn){for(var tn=0;tn<kn.length;++tn)tn>0&&(E+=.25),u.push({pos:E,isDashed:kn[tn]})}for(R(o[0]),n=0;n<e.body.length;++n){var O=e.body[n],N=w,D=k;a<O.length&&(a=O.length);var B=new Array(O.length);for(i=0;i<O.length;++i){var L=ge(O[i],t);D<L.depth&&(D=L.depth),N<L.height&&(N=L.height),B[i]=L}var V=e.rowGaps[n],te=0;V&&(te=Pe(V,t),te>0&&(te+=k,D<te&&(D=te),te=0)),e.addJot&&(D+=v),B.height=N,B.depth=D,E+=N,B.pos=E,E+=D+te,l[n]=B,R(o[n+1])}var ne=E/2+t.fontMetrics().axisHeight,he=e.cols||[],re=[],G,Z,ve=[];if(e.tags&&e.tags.some(kn=>kn))for(n=0;n<s;++n){var ee=l[n],Se=ee.pos-ne,C=e.tags[n],x=void 0;C===!0?x=P.makeSpan(["eqn-num"],[],t):C===!1?x=P.makeSpan([],[],t):x=P.makeSpan([],Ge(C,t,!0),t),x.depth=ee.depth,x.height=ee.height,ve.push({type:"elem",elem:x,shift:Se})}for(i=0,Z=0;i<a||Z<he.length;++i,++Z){for(var I=he[Z]||{},j=!0;I.type==="separator";){if(j||(G=P.makeSpan(["arraycolsep"],[]),G.style.width=q(t.fontMetrics().doubleRuleSep),re.push(G)),I.separator==="|"||I.separator===":"){var W=I.separator==="|"?"solid":"dashed",fe=P.makeSpan(["vertical-separator"],[],t);fe.style.height=q(E),fe.style.borderRightWidth=q(c),fe.style.borderRightStyle=W,fe.style.margin="0 "+q(-c/2);var Le=E-ne;Le&&(fe.style.verticalAlign=q(-Le)),re.push(fe)}else throw new _("Invalid separator type: "+I.separator);Z++,I=he[Z]||{},j=!1}if(!(i>=a)){var me=void 0;(i>0||e.hskipBeforeAndAfter)&&(me=ye.deflt(I.pregap,f),me!==0&&(G=P.makeSpan(["arraycolsep"],[]),G.style.width=q(me),re.push(G)));var Ue=[];for(n=0;n<s;++n){var At=l[n],en=At[i];if(en){var R0=At.pos-ne;en.depth=At.depth,en.height=At.height,Ue.push({type:"elem",elem:en,shift:R0})}}Ue=P.makeVList({positionType:"individualShift",children:Ue},t),Ue=P.makeSpan(["col-align-"+(I.align||"c")],[Ue]),re.push(Ue),(i<a-1||e.hskipBeforeAndAfter)&&(me=ye.deflt(I.postgap,f),me!==0&&(G=P.makeSpan(["arraycolsep"],[]),G.style.width=q(me),re.push(G)))}}if(l=P.makeSpan(["mtable"],re),u.length>0){for(var P0=P.makeLineSpan("hline",t,c),qt=P.makeLineSpan("hdashline",t,c),_i=[{type:"elem",elem:l,shift:0}];u.length>0;){var Lo=u.pop(),Jn=Lo.pos-ne;Lo.isDashed?_i.push({type:"elem",elem:qt,shift:Jn}):_i.push({type:"elem",elem:P0,shift:Jn})}l=P.makeVList({positionType:"individualShift",children:_i},t)}if(ve.length===0)return P.makeSpan(["mord"],[l],t);var ji=P.makeVList({positionType:"individualShift",children:ve},t);return ji=P.makeSpan(["tag"],[ji],t),P.makeFragment([l,ji])},n8={c:"center ",l:"left ",r:"right "},er=function(e,t){for(var n=[],i=new H.MathNode("mtd",[],["mtr-glue"]),s=new H.MathNode("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var a=e.body[o],l=[],u=0;u<a.length;u++)l.push(new H.MathNode("mtd",[Oe(a[u],t)]));e.tags&&e.tags[o]&&(l.unshift(i),l.push(i),e.leqno?l.unshift(s):l.push(s)),n.push(new H.MathNode("mtr",l))}var c=new H.MathNode("mtable",n),d=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",q(d));var f="",h="";if(e.cols&&e.cols.length>0){var m=e.cols,v="",y=!1,w=0,k=m.length;m[0].type==="separator"&&(f+="top ",w=1),m[m.length-1].type==="separator"&&(f+="bottom ",k-=1);for(var E=w;E<k;E++)m[E].type==="align"?(h+=n8[m[E].align],y&&(v+="none "),y=!0):m[E].type==="separator"&&y&&(v+=m[E].separator==="|"?"solid ":"dashed ",y=!1);c.setAttribute("columnalign",h.trim()),/[sd]/.test(v)&&c.setAttribute("columnlines",v.trim())}if(e.colSeparationType==="align"){for(var R=e.cols||[],O="",N=1;N<R.length;N++)O+=N%2?"0em ":"1em ";c.setAttribute("columnspacing",O.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?c.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?c.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var D="",B=e.hLinesBeforeRow;f+=B[0].length>0?"left ":"",f+=B[B.length-1].length>0?"right ":"";for(var L=1;L<B.length-1;L++)D+=B[L].length===0?"none ":B[L][0]?"dashed ":"solid ";return/[sd]/.test(D)&&c.setAttribute("rowlines",D.trim()),f!==""&&(c=new H.MathNode("menclose",[c]),c.setAttribute("notation",f.trim())),e.arraystretch&&e.arraystretch<1&&(c=new H.MathNode("mstyle",[c]),c.setAttribute("scriptlevel","1")),c},Cp=function(e,t){e.envName.indexOf("ed")===-1&&yo(e);var n=[],i=e.envName.indexOf("at")>-1?"alignat":"align",s=e.envName==="split",o=Xr(e.parser,{cols:n,addJot:!0,autoTag:s?void 0:r0(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),a,l=0,u={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&t[0].type==="ordgroup"){for(var c="",d=0;d<t[0].body.length;d++){var f=pe(t[0].body[d],"textord");c+=f.text}a=Number(c),l=a*2}var h=!l;o.body.forEach(function(w){for(var k=1;k<w.length;k+=2){var E=pe(w[k],"styling"),R=pe(E.body[0],"ordgroup");R.body.unshift(u)}if(h)l<w.length&&(l=w.length);else{var O=w.length/2;if(a<O)throw new _("Too many math in a row: "+("expected "+a+", but got "+O),w[0])}});for(var m=0;m<l;++m){var v="r",y=0;m%2===1?v="l":m>0&&h&&(y=1),n[m]={type:"align",align:v,pregap:y,postgap:0}}return o.colSeparationType=h?"align":"alignat",o};Zt({type:"array",names:["array","darray"],props:{numArgs:1},handler(r,e){var t=fo(e[0]),n=t?[e[0]]:pe(e[0],"ordgroup").body,i=n.map(function(o){var a=ql(o),l=a.text;if("lcr".indexOf(l)!==-1)return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new _("Unknown column alignment: "+l,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Xr(r.parser,s,n0(r.envName))},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(r){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[r.envName.replace("*","")],t="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(r.envName.charAt(r.envName.length-1)==="*"){var i=r.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),t=i.fetch().text,"lcr".indexOf(t)===-1)throw new _("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:t}]}}var s=Xr(r.parser,n,n0(r.envName)),o=Math.max(0,...s.body.map(a=>a.length));return s.cols=new Array(o).fill({type:"align",align:t}),e?{type:"leftright",mode:r.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(r){var e={arraystretch:.5},t=Xr(r.parser,e,"script");return t.colSeparationType="small",t},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["subarray"],props:{numArgs:1},handler(r,e){var t=fo(e[0]),n=t?[e[0]]:pe(e[0],"ordgroup").body,i=n.map(function(o){var a=ql(o),l=a.text;if("lc".indexOf(l)!==-1)return{type:"align",align:l};throw new _("Unknown column alignment: "+l,o)});if(i.length>1)throw new _("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=Xr(r.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new _("{subarray} can contain only one column");return s},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(r){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=Xr(r.parser,e,n0(r.envName));return{type:"leftright",mode:r.mode,body:[t],left:r.envName.indexOf("r")>-1?".":"\\{",right:r.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Cp,htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(r){["gather","gather*"].includes(r.envName)&&yo(r);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:r0(r.envName),emptySingleRow:!0,leqno:r.parser.settings.leqno};return Xr(r.parser,e,"display")},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Cp,htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(r){yo(r);var e={autoTag:r0(r.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:r.parser.settings.leqno};return Xr(r.parser,e,"display")},htmlBuilder:Qt,mathmlBuilder:er}),Zt({type:"array",names:["CD"],props:{numArgs:0},handler(r){return yo(r),jb(r.parser)},htmlBuilder:Qt,mathmlBuilder:er}),S("\\nonumber","\\gdef\\@eqnsw{0}"),S("\\notag","\\nonumber"),Y({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(r,e){throw new _(r.funcName+" valid only within array environment")}});var Ep=kp;Y({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];if(i.type!=="ordgroup")throw new _("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=pe(i.body[o],"textord").text;if(n==="\\begin"){if(!Ep.hasOwnProperty(s))throw new _("No such environment: "+s,i);var a=Ep[s],{args:l,optArgs:u}=t.parseArguments("\\begin{"+s+"}",a),c={mode:t.mode,envName:s,parser:t},d=a.handler(c,l,u);t.expect("\\end",!1);var f=t.nextToken,h=pe(t.parseFunction(),"environment");if(h.name!==s)throw new _("Mismatch: \\begin{"+s+"} matched by \\end{"+h.name+"}",f);return d}return{type:"environment",mode:t.mode,name:s,nameGroup:i}}});var Ap=(r,e)=>{var t=r.font,n=e.withFont(t);return ge(r.body,n)},Op=(r,e)=>{var t=r.font,n=e.withFont(t);return Oe(r.body,n)},Np={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Y({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=co(e[0]),s=n;return s in Np&&(s=Np[s]),{type:"font",mode:t.mode,font:s.slice(1),body:i}},htmlBuilder:Ap,mathmlBuilder:Op}),Y({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(r,e)=>{var{parser:t}=r,n=e[0],i=ye.isCharacterBox(n);return{type:"mclass",mode:t.mode,mclass:mo(n),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:n}],isCharacterBox:i}}}),Y({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,breakOnTokenText:i}=r,{mode:s}=t,o=t.parseExpression(!0,i),a="math"+n.slice(1);return{type:"font",mode:s,font:a,body:{type:"ordgroup",mode:t.mode,body:o}}},htmlBuilder:Ap,mathmlBuilder:Op});var Dp=(r,e)=>{var t=e;return r==="display"?t=t.id>=oe.SCRIPT.id?t.text():oe.DISPLAY:r==="text"&&t.size===oe.DISPLAY.size?t=oe.TEXT:r==="script"?t=oe.SCRIPT:r==="scriptscript"&&(t=oe.SCRIPTSCRIPT),t},i0=(r,e)=>{var t=Dp(r.size,e.style),n=t.fracNum(),i=t.fracDen(),s;s=e.havingStyle(n);var o=ge(r.numer,s,e);if(r.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}s=e.havingStyle(i);var u=ge(r.denom,s,e),c,d,f;r.hasBarLine?(r.barSize?(d=Pe(r.barSize,e),c=P.makeLineSpan("frac-line",e,d)):c=P.makeLineSpan("frac-line",e),d=c.height,f=c.height):(c=null,d=0,f=e.fontMetrics().defaultRuleThickness);var h,m,v;t.size===oe.DISPLAY.size||r.size==="display"?(h=e.fontMetrics().num1,d>0?m=3*f:m=7*f,v=e.fontMetrics().denom1):(d>0?(h=e.fontMetrics().num2,m=f):(h=e.fontMetrics().num3,m=3*f),v=e.fontMetrics().denom2);var y;if(c){var k=e.fontMetrics().axisHeight;h-o.depth-(k+.5*d)<m&&(h+=m-(h-o.depth-(k+.5*d))),k-.5*d-(u.height-v)<m&&(v+=m-(k-.5*d-(u.height-v)));var E=-(k-.5*d);y=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:u,shift:v},{type:"elem",elem:c,shift:E},{type:"elem",elem:o,shift:-h}]},e)}else{var w=h-o.depth-(u.height-v);w<m&&(h+=.5*(m-w),v+=.5*(m-w)),y=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:u,shift:v},{type:"elem",elem:o,shift:-h}]},e)}s=e.havingStyle(t),y.height*=s.sizeMultiplier/e.sizeMultiplier,y.depth*=s.sizeMultiplier/e.sizeMultiplier;var R;t.size===oe.DISPLAY.size?R=e.fontMetrics().delim1:t.size===oe.SCRIPTSCRIPT.size?R=e.havingStyle(oe.SCRIPT).fontMetrics().delim2:R=e.fontMetrics().delim2;var O,N;return r.leftDelim==null?O=zi(e,["mopen"]):O=xr.customSizedDelim(r.leftDelim,R,!0,e.havingStyle(t),r.mode,["mopen"]),r.continued?N=P.makeSpan([]):r.rightDelim==null?N=zi(e,["mclose"]):N=xr.customSizedDelim(r.rightDelim,R,!0,e.havingStyle(t),r.mode,["mclose"]),P.makeSpan(["mord"].concat(s.sizingClasses(e)),[O,P.makeSpan(["mfrac"],[y]),N],e)},s0=(r,e)=>{var t=new H.MathNode("mfrac",[Oe(r.numer,e),Oe(r.denom,e)]);if(!r.hasBarLine)t.setAttribute("linethickness","0px");else if(r.barSize){var n=Pe(r.barSize,e);t.setAttribute("linethickness",q(n))}var i=Dp(r.size,e.style);if(i.size!==e.style.size){t=new H.MathNode("mstyle",[t]);var s=i.size===oe.DISPLAY.size?"true":"false";t.setAttribute("displaystyle",s),t.setAttribute("scriptlevel","0")}if(r.leftDelim!=null||r.rightDelim!=null){var o=[];if(r.leftDelim!=null){var a=new H.MathNode("mo",[new H.TextNode(r.leftDelim.replace("\\",""))]);a.setAttribute("fence","true"),o.push(a)}if(o.push(t),r.rightDelim!=null){var l=new H.MathNode("mo",[new H.TextNode(r.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),o.push(l)}return Vl(o)}return t};Y({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=e[1],o,a=null,l=null,u="auto";switch(n){case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(n){case"\\dfrac":case"\\dbinom":u="display";break;case"\\tfrac":case"\\tbinom":u="text";break}return{type:"genfrac",mode:t.mode,continued:!1,numer:i,denom:s,hasBarLine:o,leftDelim:a,rightDelim:l,size:u,barSize:null}},htmlBuilder:i0,mathmlBuilder:s0}),Y({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=e[1];return{type:"genfrac",mode:t.mode,continued:!0,numer:i,denom:s,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}}),Y({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(r){var{parser:e,funcName:t,token:n}=r,i;switch(t){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:n}}});var Ip=["display","text","script","scriptscript"],Rp=function(e){var t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};Y({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(r,e){var{parser:t}=r,n=e[4],i=e[5],s=co(e[0]),o=s.type==="atom"&&s.family==="open"?Rp(s.text):null,a=co(e[1]),l=a.type==="atom"&&a.family==="close"?Rp(a.text):null,u=pe(e[2],"size"),c,d=null;u.isBlank?c=!0:(d=u.value,c=d.number>0);var f="auto",h=e[3];if(h.type==="ordgroup"){if(h.body.length>0){var m=pe(h.body[0],"textord");f=Ip[Number(m.text)]}}else h=pe(h,"textord"),f=Ip[Number(h.text)];return{type:"genfrac",mode:t.mode,numer:n,denom:i,continued:!1,hasBarLine:c,barSize:d,leftDelim:o,rightDelim:l,size:f}},htmlBuilder:i0,mathmlBuilder:s0}),Y({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(r,e){var{parser:t,funcName:n,token:i}=r;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:pe(e[0],"size").value,token:i}}}),Y({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0],s=R7(pe(e[1],"infix").size),o=e[2],a=s.number>0;return{type:"genfrac",mode:t.mode,numer:i,denom:o,continued:!1,hasBarLine:a,barSize:s,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:i0,mathmlBuilder:s0});var Pp=(r,e)=>{var t=e.style,n,i;r.type==="supsub"?(n=r.sup?ge(r.sup,e.havingStyle(t.sup()),e):ge(r.sub,e.havingStyle(t.sub()),e),i=pe(r.base,"horizBrace")):i=pe(r,"horizBrace");var s=ge(i.base,e.havingBaseStyle(oe.DISPLAY)),o=wr.svgSpan(i,e),a;if(i.isOver?(a=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]},e),a.children[0].children[0].children[1].classes.push("svg-align")):(a=P.makeVList({positionType:"bottom",positionData:s.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]},e),a.children[0].children[0].children[0].classes.push("svg-align")),n){var l=P.makeSpan(["mord",i.isOver?"mover":"munder"],[a],e);i.isOver?a=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]},e):a=P.makeVList({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]},e)}return P.makeSpan(["mord",i.isOver?"mover":"munder"],[a],e)},i8=(r,e)=>{var t=wr.mathMLnode(r.label);return new H.MathNode(r.isOver?"mover":"munder",[Oe(r.base,e),t])};Y({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(r,e){var{parser:t,funcName:n}=r;return{type:"horizBrace",mode:t.mode,label:n,isOver:/^\\over/.test(n),base:e[0]}},htmlBuilder:Pp,mathmlBuilder:i8}),Y({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[1],i=pe(e[0],"url").url;return t.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:t.mode,href:i,body:_e(n)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(r,e)=>{var t=Ge(r.body,e,!1);return P.makeAnchor(r.href,[],t,e)},mathmlBuilder:(r,e)=>{var t=Jr(r.body,e);return t instanceof Ct||(t=new Ct("mrow",[t])),t.setAttribute("href",r.href),t}}),Y({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=pe(e[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:n}))return t.formatUnsupportedCmd("\\url");for(var i=[],s=0;s<n.length;s++){var o=n[s];o==="~"&&(o="\\textasciitilde"),i.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:t.mode,font:"\\texttt",body:i};return{type:"href",mode:t.mode,href:n,body:_e(a)}}}),Y({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(r,e){var{parser:t}=r;return{type:"hbox",mode:t.mode,body:_e(e[0])}},htmlBuilder(r,e){var t=Ge(r.body,e,!1);return P.makeFragment(t)},mathmlBuilder(r,e){return new H.MathNode("mrow",yt(r.body,e))}}),Y({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n,token:i}=r,s=pe(e[0],"raw").string,o=e[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(n){case"\\htmlClass":l.class=s,a={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,a={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,a={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var u=s.split(","),c=0;c<u.length;c++){var d=u[c],f=d.indexOf("=");if(f<0)throw new _("\\htmlData key/value '"+d+"' missing equals sign");var h=d.slice(0,f),m=d.slice(f+1);l["data-"+h.trim()]=m}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return t.settings.isTrusted(a)?{type:"html",mode:t.mode,attributes:l,body:_e(o)}:t.formatUnsupportedCmd(n)},htmlBuilder:(r,e)=>{var t=Ge(r.body,e,!1),n=["enclosing"];r.attributes.class&&n.push(...r.attributes.class.trim().split(/\s+/));var i=P.makeSpan(n,t,e);for(var s in r.attributes)s!=="class"&&r.attributes.hasOwnProperty(s)&&i.setAttribute(s,r.attributes[s]);return i},mathmlBuilder:(r,e)=>Jr(r.body,e)}),Y({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"htmlmathml",mode:t.mode,html:_e(e[0]),mathml:_e(e[1])}},htmlBuilder:(r,e)=>{var t=Ge(r.html,e,!1);return P.makeFragment(t)},mathmlBuilder:(r,e)=>Jr(r.mathml,e)});var o0=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new _("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(t[1]+t[2]),unit:t[3]};if(!Lf(n))throw new _("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};Y({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(r,e,t)=>{var{parser:n}=r,i={number:0,unit:"em"},s={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(t[0])for(var l=pe(t[0],"raw").string,u=l.split(","),c=0;c<u.length;c++){var d=u[c].split("=");if(d.length===2){var f=d[1].trim();switch(d[0].trim()){case"alt":a=f;break;case"width":i=o0(f);break;case"height":s=o0(f);break;case"totalheight":o=o0(f);break;default:throw new _("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var h=pe(e[0],"url").url;return a===""&&(a=h,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),n.settings.isTrusted({command:"\\includegraphics",url:h})?{type:"includegraphics",mode:n.mode,alt:a,width:i,height:s,totalheight:o,src:h}:n.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(r,e)=>{var t=Pe(r.height,e),n=0;r.totalheight.number>0&&(n=Pe(r.totalheight,e)-t);var i=0;r.width.number>0&&(i=Pe(r.width,e));var s={height:q(t+n)};i>0&&(s.width=q(i)),n>0&&(s.verticalAlign=q(-n));var o=new ib(r.src,r.alt,s);return o.height=t,o.depth=n,o},mathmlBuilder:(r,e)=>{var t=new H.MathNode("mglyph",[]);t.setAttribute("alt",r.alt);var n=Pe(r.height,e),i=0;if(r.totalheight.number>0&&(i=Pe(r.totalheight,e)-n,t.setAttribute("valign",q(-i))),t.setAttribute("height",q(n+i)),r.width.number>0){var s=Pe(r.width,e);t.setAttribute("width",q(s))}return t.setAttribute("src",r.src),t}}),Y({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,i=pe(e[0],"size");if(t.settings.strict){var s=n[1]==="m",o=i.value.unit==="mu";s?(o||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):o&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:i.value}},htmlBuilder(r,e){return P.makeGlue(r.dimension,e)},mathmlBuilder(r,e){var t=Pe(r.dimension,e);return new H.SpaceNode(t)}}),Y({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"lap",mode:t.mode,alignment:n.slice(5),body:i}},htmlBuilder:(r,e)=>{var t;r.alignment==="clap"?(t=P.makeSpan([],[ge(r.body,e)]),t=P.makeSpan(["inner"],[t],e)):t=P.makeSpan(["inner"],[ge(r.body,e)]);var n=P.makeSpan(["fix"],[]),i=P.makeSpan([r.alignment],[t,n],e),s=P.makeSpan(["strut"]);return s.style.height=q(i.height+i.depth),i.depth&&(s.style.verticalAlign=q(-i.depth)),i.children.unshift(s),i=P.makeSpan(["thinbox"],[i],e),P.makeSpan(["mord","vbox"],[i],e)},mathmlBuilder:(r,e)=>{var t=new H.MathNode("mpadded",[Oe(r.body,e)]);if(r.alignment!=="rlap"){var n=r.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",n+"width")}return t.setAttribute("width","0px"),t}}),Y({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){var{funcName:t,parser:n}=r,i=n.mode;n.switchMode("math");var s=t==="\\("?"\\)":"$",o=n.parseExpression(!1,s);return n.expect(s),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",body:o}}}),Y({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(r,e){throw new _("Mismatched "+r.funcName)}});var zp=(r,e)=>{switch(e.style.size){case oe.DISPLAY.size:return r.display;case oe.TEXT.size:return r.text;case oe.SCRIPT.size:return r.script;case oe.SCRIPTSCRIPT.size:return r.scriptscript;default:return r.text}};Y({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(r,e)=>{var{parser:t}=r;return{type:"mathchoice",mode:t.mode,display:_e(e[0]),text:_e(e[1]),script:_e(e[2]),scriptscript:_e(e[3])}},htmlBuilder:(r,e)=>{var t=zp(r,e),n=Ge(t,e,!1);return P.makeFragment(n)},mathmlBuilder:(r,e)=>{var t=zp(r,e);return Jr(t,e)}});var Lp=(r,e,t,n,i,s,o)=>{r=P.makeSpan([],[r]);var a=t&&ye.isCharacterBox(t),l,u;if(e){var c=ge(e,n.havingStyle(i.sup()),n);u={elem:c,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-c.depth)}}if(t){var d=ge(t,n.havingStyle(i.sub()),n);l={elem:d,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-d.height)}}var f;if(u&&l){var h=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+r.depth+o;f=P.makeVList({positionType:"bottom",positionData:h,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:q(-s)},{type:"kern",size:l.kern},{type:"elem",elem:r},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:q(s)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(l){var m=r.height-o;f=P.makeVList({positionType:"top",positionData:m,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:q(-s)},{type:"kern",size:l.kern},{type:"elem",elem:r}]},n)}else if(u){var v=r.depth+o;f=P.makeVList({positionType:"bottom",positionData:v,children:[{type:"elem",elem:r},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:q(s)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else return r;var y=[f];if(l&&s!==0&&!a){var w=P.makeSpan(["mspace"],[],n);w.style.marginRight=q(s),y.unshift(w)}return P.makeSpan(["mop","op-limits"],y,n)},Bp=["\\smallint"],_n=(r,e)=>{var t,n,i=!1,s;r.type==="supsub"?(t=r.sup,n=r.sub,s=pe(r.base,"op"),i=!0):s=pe(r,"op");var o=e.style,a=!1;o.size===oe.DISPLAY.size&&s.symbol&&!Bp.includes(s.name)&&(a=!0);var l;if(s.symbol){var u=a?"Size2-Regular":"Size1-Regular",c="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(c=s.name.slice(1),s.name=c==="oiint"?"\\iint":"\\iiint"),l=P.makeSymbol(s.name,u,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),c.length>0){var d=l.italic,f=P.staticSvg(c+"Size"+(a?"2":"1"),e);l=P.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:a?.08:0}]},e),s.name="\\"+c,l.classes.unshift("mop"),l.italic=d}}else if(s.body){var h=Ge(s.body,e,!0);h.length===1&&h[0]instanceof zt?(l=h[0],l.classes[0]="mop"):l=P.makeSpan(["mop"],h,e)}else{for(var m=[],v=1;v<s.name.length;v++)m.push(P.mathsym(s.name[v],s.mode,e));l=P.makeSpan(["mop"],m,e)}var y=0,w=0;return(l instanceof zt||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(y=(l.height-l.depth)/2-e.fontMetrics().axisHeight,w=l.italic),i?Lp(l,t,n,e,o,w,y):(y&&(l.style.position="relative",l.style.top=q(y)),l)},Fi=(r,e)=>{var t;if(r.symbol)t=new Ct("mo",[Lt(r.name,r.mode)]),Bp.includes(r.name)&&t.setAttribute("largeop","false");else if(r.body)t=new Ct("mo",yt(r.body,e));else{t=new Ct("mi",[new Xt(r.name.slice(1))]);var n=new Ct("mo",[Lt("⁡","text")]);r.parentIsSupSub?t=new Ct("mrow",[t,n]):t=ep([t,n])}return t},s8={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Y({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=n;return i.length===1&&(i=s8[i]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:_n,mathmlBuilder:Fi}),Y({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:_e(n)}},htmlBuilder:_n,mathmlBuilder:Fi});var o8={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Y({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:_n,mathmlBuilder:Fi}),Y({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(r){var{parser:e,funcName:t}=r;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:_n,mathmlBuilder:Fi}),Y({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(r){var{parser:e,funcName:t}=r,n=t;return n.length===1&&(n=o8[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:_n,mathmlBuilder:Fi});var Fp=(r,e)=>{var t,n,i=!1,s;r.type==="supsub"?(t=r.sup,n=r.sub,s=pe(r.base,"operatorname"),i=!0):s=pe(r,"operatorname");var o;if(s.body.length>0){for(var a=s.body.map(d=>{var f=d.text;return typeof f=="string"?{type:"textord",mode:d.mode,text:f}:d}),l=Ge(a,e.withFont("mathrm"),!0),u=0;u<l.length;u++){var c=l[u];c instanceof zt&&(c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=P.makeSpan(["mop"],l,e)}else o=P.makeSpan(["mop"],[],e);return i?Lp(o,t,n,e,e.style,0,0):o},a8=(r,e)=>{for(var t=yt(r.body,e.withFont("mathrm")),n=!0,i=0;i<t.length;i++){var s=t[i];if(!(s instanceof H.SpaceNode))if(s instanceof H.MathNode)switch(s.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var o=s.children[0];s.children.length===1&&o instanceof H.TextNode?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):n=!1;break}default:n=!1}else n=!1}if(n){var a=t.map(c=>c.toText()).join("");t=[new H.TextNode(a)]}var l=new H.MathNode("mi",t);l.setAttribute("mathvariant","normal");var u=new H.MathNode("mo",[Lt("⁡","text")]);return r.parentIsSupSub?new H.MathNode("mrow",[l,u]):H.newDocumentFragment([l,u])};Y({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(r,e)=>{var{parser:t,funcName:n}=r,i=e[0];return{type:"operatorname",mode:t.mode,body:_e(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Fp,mathmlBuilder:a8}),S("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),Sn({type:"ordgroup",htmlBuilder(r,e){return r.semisimple?P.makeFragment(Ge(r.body,e,!1)):P.makeSpan(["mord"],Ge(r.body,e,!0),e)},mathmlBuilder(r,e){return Jr(r.body,e,!0)}}),Y({type:"overline",names:["\\overline"],props:{numArgs:1},handler(r,e){var{parser:t}=r,n=e[0];return{type:"overline",mode:t.mode,body:n}},htmlBuilder(r,e){var t=ge(r.body,e.havingCrampedStyle()),n=P.makeLineSpan("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]},e);return P.makeSpan(["mord","overline"],[s],e)},mathmlBuilder(r,e){var t=new H.MathNode("mo",[new H.TextNode("‾")]);t.setAttribute("stretchy","true");var n=new H.MathNode("mover",[Oe(r.body,e),t]);return n.setAttribute("accent","true"),n}}),Y({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"phantom",mode:t.mode,body:_e(n)}},htmlBuilder:(r,e)=>{var t=Ge(r.body,e.withPhantom(),!1);return P.makeFragment(t)},mathmlBuilder:(r,e)=>{var t=yt(r.body,e);return new H.MathNode("mphantom",t)}}),Y({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"hphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=P.makeSpan([],[ge(r.body,e.withPhantom())]);if(t.height=0,t.depth=0,t.children)for(var n=0;n<t.children.length;n++)t.children[n].height=0,t.children[n].depth=0;return t=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e),P.makeSpan(["mord"],[t],e)},mathmlBuilder:(r,e)=>{var t=yt(_e(r.body),e),n=new H.MathNode("mphantom",t),i=new H.MathNode("mpadded",[n]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}}),Y({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(r,e)=>{var{parser:t}=r,n=e[0];return{type:"vphantom",mode:t.mode,body:n}},htmlBuilder:(r,e)=>{var t=P.makeSpan(["inner"],[ge(r.body,e.withPhantom())]),n=P.makeSpan(["fix"],[]);return P.makeSpan(["mord","rlap"],[t,n],e)},mathmlBuilder:(r,e)=>{var t=yt(_e(r.body),e),n=new H.MathNode("mphantom",t),i=new H.MathNode("mpadded",[n]);return i.setAttribute("width","0px"),i}}),Y({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(r,e){var{parser:t}=r,n=pe(e[0],"size").value,i=e[1];return{type:"raisebox",mode:t.mode,dy:n,body:i}},htmlBuilder(r,e){var t=ge(r.body,e),n=Pe(r.dy,e);return P.makeVList({positionType:"shift",positionData:-n,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(r,e){var t=new H.MathNode("mpadded",[Oe(r.body,e)]),n=r.dy.number+r.dy.unit;return t.setAttribute("voffset",n),t}}),Y({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(r){var{parser:e}=r;return{type:"internal",mode:e.mode}}}),Y({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(r,e,t){var{parser:n}=r,i=t[0],s=pe(e[0],"size"),o=pe(e[1],"size");return{type:"rule",mode:n.mode,shift:i&&pe(i,"size").value,width:s.value,height:o.value}},htmlBuilder(r,e){var t=P.makeSpan(["mord","rule"],[],e),n=Pe(r.width,e),i=Pe(r.height,e),s=r.shift?Pe(r.shift,e):0;return t.style.borderRightWidth=q(n),t.style.borderTopWidth=q(i),t.style.bottom=q(s),t.width=n,t.height=i+s,t.depth=-s,t.maxFontSize=i*1.125*e.sizeMultiplier,t},mathmlBuilder(r,e){var t=Pe(r.width,e),n=Pe(r.height,e),i=r.shift?Pe(r.shift,e):0,s=e.color&&e.getColor()||"black",o=new H.MathNode("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",q(t)),o.setAttribute("height",q(n));var a=new H.MathNode("mpadded",[o]);return i>=0?a.setAttribute("height",q(i)):(a.setAttribute("height",q(i)),a.setAttribute("depth",q(-i))),a.setAttribute("voffset",q(i)),a}});function $p(r,e,t){for(var n=Ge(r,e,!1),i=e.sizeMultiplier/t.sizeMultiplier,s=0;s<n.length;s++){var o=n[s].classes.indexOf("sizing");o<0?Array.prototype.push.apply(n[s].classes,e.sizingClasses(t)):n[s].classes[o+1]==="reset-size"+e.size&&(n[s].classes[o+1]="reset-size"+t.size),n[s].height*=i,n[s].depth*=i}return P.makeFragment(n)}var Hp=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],l8=(r,e)=>{var t=e.havingSize(r.size);return $p(r.body,t,e)};Y({type:"sizing",names:Hp,props:{numArgs:0,allowedInText:!0},handler:(r,e)=>{var{breakOnTokenText:t,funcName:n,parser:i}=r,s=i.parseExpression(!1,t);return{type:"sizing",mode:i.mode,size:Hp.indexOf(n)+1,body:s}},htmlBuilder:l8,mathmlBuilder:(r,e)=>{var t=e.havingSize(r.size),n=yt(r.body,t),i=new H.MathNode("mstyle",n);return i.setAttribute("mathsize",q(t.sizeMultiplier)),i}}),Y({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(r,e,t)=>{var{parser:n}=r,i=!1,s=!1,o=t[0]&&pe(t[0],"ordgroup");if(o)for(var a="",l=0;l<o.body.length;++l){var u=o.body[l];if(a=u.text,a==="t")i=!0;else if(a==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var c=e[0];return{type:"smash",mode:n.mode,body:c,smashHeight:i,smashDepth:s}},htmlBuilder:(r,e)=>{var t=P.makeSpan([],[ge(r.body,e)]);if(!r.smashHeight&&!r.smashDepth)return t;if(r.smashHeight&&(t.height=0,t.children))for(var n=0;n<t.children.length;n++)t.children[n].height=0;if(r.smashDepth&&(t.depth=0,t.children))for(var i=0;i<t.children.length;i++)t.children[i].depth=0;var s=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e);return P.makeSpan(["mord"],[s],e)},mathmlBuilder:(r,e)=>{var t=new H.MathNode("mpadded",[Oe(r.body,e)]);return r.smashHeight&&t.setAttribute("height","0px"),r.smashDepth&&t.setAttribute("depth","0px"),t}}),Y({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(r,e,t){var{parser:n}=r,i=t[0],s=e[0];return{type:"sqrt",mode:n.mode,body:s,index:i}},htmlBuilder(r,e){var t=ge(r.body,e.havingCrampedStyle());t.height===0&&(t.height=e.fontMetrics().xHeight),t=P.wrapFragment(t,e);var n=e.fontMetrics(),i=n.defaultRuleThickness,s=i;e.style.id<oe.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,a=t.height+t.depth+o+i,{span:l,ruleWidth:u,advanceWidth:c}=xr.sqrtImage(a,e),d=l.height-u;d>t.height+t.depth+o&&(o=(o+d-t.height-t.depth)/2);var f=l.height-t.height-o-u;t.style.paddingLeft=q(c);var h=P.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+f)},{type:"elem",elem:l},{type:"kern",size:u}]},e);if(r.index){var m=e.havingStyle(oe.SCRIPTSCRIPT),v=ge(r.index,m,e),y=.6*(h.height-h.depth),w=P.makeVList({positionType:"shift",positionData:-y,children:[{type:"elem",elem:v}]},e),k=P.makeSpan(["root"],[w]);return P.makeSpan(["mord","sqrt"],[k,h],e)}else return P.makeSpan(["mord","sqrt"],[h],e)},mathmlBuilder(r,e){var{body:t,index:n}=r;return n?new H.MathNode("mroot",[Oe(t,e),Oe(n,e)]):new H.MathNode("msqrt",[Oe(t,e)])}});var Vp={display:oe.DISPLAY,text:oe.TEXT,script:oe.SCRIPT,scriptscript:oe.SCRIPTSCRIPT};Y({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(r,e){var{breakOnTokenText:t,funcName:n,parser:i}=r,s=i.parseExpression(!0,t),o=n.slice(1,n.length-5);return{type:"styling",mode:i.mode,style:o,body:s}},htmlBuilder(r,e){var t=Vp[r.style],n=e.havingStyle(t).withFont("");return $p(r.body,n,e)},mathmlBuilder(r,e){var t=Vp[r.style],n=e.havingStyle(t),i=yt(r.body,n),s=new H.MathNode("mstyle",i),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[r.style];return s.setAttribute("scriptlevel",a[0]),s.setAttribute("displaystyle",a[1]),s}});var u8=function(e,t){var n=e.base;if(n)if(n.type==="op"){var i=n.limits&&(t.style.size===oe.DISPLAY.size||n.alwaysHandleSupSub);return i?_n:null}else if(n.type==="operatorname"){var s=n.alwaysHandleSupSub&&(t.style.size===oe.DISPLAY.size||n.limits);return s?Fp:null}else{if(n.type==="accent")return ye.isCharacterBox(n.base)?Wl:null;if(n.type==="horizBrace"){var o=!e.sub;return o===n.isOver?Pp:null}else return null}else return null};Sn({type:"supsub",htmlBuilder(r,e){var t=u8(r,e);if(t)return t(r,e);var{base:n,sup:i,sub:s}=r,o=ge(n,e),a,l,u=e.fontMetrics(),c=0,d=0,f=n&&ye.isCharacterBox(n);if(i){var h=e.havingStyle(e.style.sup());a=ge(i,h,e),f||(c=o.height-h.fontMetrics().supDrop*h.sizeMultiplier/e.sizeMultiplier)}if(s){var m=e.havingStyle(e.style.sub());l=ge(s,m,e),f||(d=o.depth+m.fontMetrics().subDrop*m.sizeMultiplier/e.sizeMultiplier)}var v;e.style===oe.DISPLAY?v=u.sup1:e.style.cramped?v=u.sup3:v=u.sup2;var y=e.sizeMultiplier,w=q(.5/u.ptPerEm/y),k=null;if(l){var E=r.base&&r.base.type==="op"&&r.base.name&&(r.base.name==="\\oiint"||r.base.name==="\\oiiint");(o instanceof zt||E)&&(k=q(-o.italic))}var R;if(a&&l){c=Math.max(c,v,a.depth+.25*u.xHeight),d=Math.max(d,u.sub2);var O=u.defaultRuleThickness,N=4*O;if(c-a.depth-(l.height-d)<N){d=N-(c-a.depth)+l.height;var D=.8*u.xHeight-(c-a.depth);D>0&&(c+=D,d-=D)}var B=[{type:"elem",elem:l,shift:d,marginRight:w,marginLeft:k},{type:"elem",elem:a,shift:-c,marginRight:w}];R=P.makeVList({positionType:"individualShift",children:B},e)}else if(l){d=Math.max(d,u.sub1,l.height-.8*u.xHeight);var L=[{type:"elem",elem:l,marginLeft:k,marginRight:w}];R=P.makeVList({positionType:"shift",positionData:d,children:L},e)}else if(a)c=Math.max(c,v,a.depth+.25*u.xHeight),R=P.makeVList({positionType:"shift",positionData:-c,children:[{type:"elem",elem:a,marginRight:w}]},e);else throw new Error("supsub must have either sup or sub.");var V=$l(o,"right")||"mord";return P.makeSpan([V],[o,P.makeSpan(["msupsub"],[R])],e)},mathmlBuilder(r,e){var t=!1,n,i;r.base&&r.base.type==="horizBrace"&&(i=!!r.sup,i===r.base.isOver&&(t=!0,n=r.base.isOver)),r.base&&(r.base.type==="op"||r.base.type==="operatorname")&&(r.base.parentIsSupSub=!0);var s=[Oe(r.base,e)];r.sub&&s.push(Oe(r.sub,e)),r.sup&&s.push(Oe(r.sup,e));var o;if(t)o=n?"mover":"munder";else if(r.sub)if(r.sup){var u=r.base;u&&u.type==="op"&&u.limits&&e.style===oe.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(e.style===oe.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var l=r.base;l&&l.type==="op"&&l.limits&&(e.style===oe.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===oe.DISPLAY)?o="munder":o="msub"}else{var a=r.base;a&&a.type==="op"&&a.limits&&(e.style===oe.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===oe.DISPLAY)?o="mover":o="msup"}return new H.MathNode(o,s)}}),Sn({type:"atom",htmlBuilder(r,e){return P.mathsym(r.text,r.mode,e,["m"+r.family])},mathmlBuilder(r,e){var t=new H.MathNode("mo",[Lt(r.text,r.mode)]);if(r.family==="bin"){var n=_l(r,e);n==="bold-italic"&&t.setAttribute("mathvariant",n)}else r.family==="punct"?t.setAttribute("separator","true"):(r.family==="open"||r.family==="close")&&t.setAttribute("stretchy","false");return t}});var _p={mi:"italic",mn:"normal",mtext:"normal"};Sn({type:"mathord",htmlBuilder(r,e){return P.makeOrd(r,e,"mathord")},mathmlBuilder(r,e){var t=new H.MathNode("mi",[Lt(r.text,r.mode,e)]),n=_l(r,e)||"italic";return n!==_p[t.type]&&t.setAttribute("mathvariant",n),t}}),Sn({type:"textord",htmlBuilder(r,e){return P.makeOrd(r,e,"textord")},mathmlBuilder(r,e){var t=Lt(r.text,r.mode,e),n=_l(r,e)||"normal",i;return r.mode==="text"?i=new H.MathNode("mtext",[t]):/[0-9]/.test(r.text)?i=new H.MathNode("mn",[t]):r.text==="\\prime"?i=new H.MathNode("mo",[t]):i=new H.MathNode("mi",[t]),n!==_p[i.type]&&i.setAttribute("mathvariant",n),i}});var a0={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},l0={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Sn({type:"spacing",htmlBuilder(r,e){if(l0.hasOwnProperty(r.text)){var t=l0[r.text].className||"";if(r.mode==="text"){var n=P.makeOrd(r,e,"textord");return n.classes.push(t),n}else return P.makeSpan(["mspace",t],[P.mathsym(r.text,r.mode,e)],e)}else{if(a0.hasOwnProperty(r.text))return P.makeSpan(["mspace",a0[r.text]],[],e);throw new _('Unknown type of space "'+r.text+'"')}},mathmlBuilder(r,e){var t;if(l0.hasOwnProperty(r.text))t=new H.MathNode("mtext",[new H.TextNode(" ")]);else{if(a0.hasOwnProperty(r.text))return new H.MathNode("mspace");throw new _('Unknown type of space "'+r.text+'"')}return t}});var jp=()=>{var r=new H.MathNode("mtd",[]);return r.setAttribute("width","50%"),r};Sn({type:"tag",mathmlBuilder(r,e){var t=new H.MathNode("mtable",[new H.MathNode("mtr",[jp(),new H.MathNode("mtd",[Jr(r.body,e)]),jp(),new H.MathNode("mtd",[Jr(r.tag,e)])])]);return t.setAttribute("width","100%"),t}});var qp={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Wp={"\\textbf":"textbf","\\textmd":"textmd"},c8={"\\textit":"textit","\\textup":"textup"},Up=(r,e)=>{var t=r.font;if(t){if(qp[t])return e.withTextFontFamily(qp[t]);if(Wp[t])return e.withTextFontWeight(Wp[t]);if(t==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(c8[t])};Y({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(r,e){var{parser:t,funcName:n}=r,i=e[0];return{type:"text",mode:t.mode,body:_e(i),font:n}},htmlBuilder(r,e){var t=Up(r,e),n=Ge(r.body,t,!0);return P.makeSpan(["mord","text"],n,t)},mathmlBuilder(r,e){var t=Up(r,e);return Jr(r.body,t)}}),Y({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(r,e){var{parser:t}=r;return{type:"underline",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=ge(r.body,e),n=P.makeLineSpan("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=P.makeVList({positionType:"top",positionData:t.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:t}]},e);return P.makeSpan(["mord","underline"],[s],e)},mathmlBuilder(r,e){var t=new H.MathNode("mo",[new H.TextNode("‾")]);t.setAttribute("stretchy","true");var n=new H.MathNode("munder",[Oe(r.body,e),t]);return n.setAttribute("accentunder","true"),n}}),Y({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(r,e){var{parser:t}=r;return{type:"vcenter",mode:t.mode,body:e[0]}},htmlBuilder(r,e){var t=ge(r.body,e),n=e.fontMetrics().axisHeight,i=.5*(t.height-n-(t.depth+n));return P.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(r,e){return new H.MathNode("mpadded",[Oe(r.body,e)],["vcenter"])}}),Y({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(r,e,t){throw new _("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(r,e){for(var t=Gp(r),n=[],i=e.havingStyle(e.style.text()),s=0;s<t.length;s++){var o=t[s];o==="~"&&(o="\\textasciitilde"),n.push(P.makeSymbol(o,"Typewriter-Regular",r.mode,i,["mord","texttt"]))}return P.makeSpan(["mord","text"].concat(i.sizingClasses(e)),P.tryCombineChars(n),i)},mathmlBuilder(r,e){var t=new H.TextNode(Gp(r)),n=new H.MathNode("mtext",[t]);return n.setAttribute("mathvariant","monospace"),n}});var Gp=r=>r.body.replace(/ /g,r.star?"␣":" "),Zr=Xf,Kp=`[ \r
862
862
  ]`,d8="\\\\[a-zA-Z@]+",h8="\\\\[^\uD800-\uDFFF]",f8="("+d8+")"+Kp+"*",p8=`\\\\(
863
863
  |[ \r ]+
864
- ?)[ \r ]*`,u0="[̀-ͯ]",m8=new RegExp(u0+"+$"),g8="("+Kp+"+)|"+(p8+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(u0+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(u0+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+f8)+("|"+h8+")");class Yp{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(g8,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new Tt("EOF",new gt(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new j("Unexpected character: '"+e[t]+"'",new Tt(e[t],new gt(this,t,t+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
865
- `,this.tokenRegex.lastIndex);return s===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=s+1,this.lex()}return new Tt(i,new gt(this,t,this.tokenRegex.lastIndex))}}class v8{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new j("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var y8=Tp;S("\\noexpand",function(r){var e=r.popToken();return r.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}}),S("\\expandafter",function(r){var e=r.popToken();return r.expandOnce(!0),{tokens:[e],numArgs:0}}),S("\\@firstoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[0],numArgs:0}}),S("\\@secondoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[1],numArgs:0}}),S("\\@ifnextchar",function(r){var e=r.consumeArgs(3);r.consumeSpaces();var t=r.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}}),S("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),S("\\TextOrMath",function(r){var e=r.consumeArgs(2);return r.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var Jp={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};S("\\char",function(r){var e=r.popToken(),t,n="";if(e.text==="'")t=8,e=r.popToken();else if(e.text==='"')t=16,e=r.popToken();else if(e.text==="`")if(e=r.popToken(),e.text[0]==="\\")n=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new j("\\char` missing argument");n=e.text.charCodeAt(0)}else t=10;if(t){if(n=Jp[e.text],n==null||n>=t)throw new j("Invalid base-"+t+" digit "+e.text);for(var i;(i=Jp[r.future().text])!=null&&i<t;)n*=t,n+=i,r.popToken()}return"\\@char{"+n+"}"});var c0=(r,e,t,n)=>{var i=r.consumeArg().tokens;if(i.length!==1)throw new j("\\newcommand's first argument must be a macro name");var s=i[0].text,o=r.isDefined(s);if(o&&!e)throw new j("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!t)throw new j("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var a=0;if(i=r.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",u=r.expandNextToken();u.text!=="]"&&u.text!=="EOF";)l+=u.text,u=r.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new j("Invalid number of arguments: "+l);a=parseInt(l),i=r.consumeArg().tokens}return o&&n||r.macros.set(s,{tokens:i,numArgs:a}),""};S("\\newcommand",r=>c0(r,!1,!0,!1)),S("\\renewcommand",r=>c0(r,!0,!1,!1)),S("\\providecommand",r=>c0(r,!0,!0,!0)),S("\\message",r=>{var e=r.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""}),S("\\errmessage",r=>{var e=r.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""}),S("\\show",r=>{var e=r.popToken(),t=e.text;return console.log(e,r.macros.get(t),Zr[t],Ne.math[t],Ne.text[t]),""}),S("\\bgroup","{"),S("\\egroup","}"),S("~","\\nobreakspace"),S("\\lq","`"),S("\\rq","'"),S("\\aa","\\r a"),S("\\AA","\\r A"),S("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),S("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),S("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),S("ℬ","\\mathscr{B}"),S("ℰ","\\mathscr{E}"),S("ℱ","\\mathscr{F}"),S("ℋ","\\mathscr{H}"),S("ℐ","\\mathscr{I}"),S("ℒ","\\mathscr{L}"),S("ℳ","\\mathscr{M}"),S("ℛ","\\mathscr{R}"),S("ℭ","\\mathfrak{C}"),S("ℌ","\\mathfrak{H}"),S("ℨ","\\mathfrak{Z}"),S("\\Bbbk","\\Bbb{k}"),S("·","\\cdotp"),S("\\llap","\\mathllap{\\textrm{#1}}"),S("\\rlap","\\mathrlap{\\textrm{#1}}"),S("\\clap","\\mathclap{\\textrm{#1}}"),S("\\mathstrut","\\vphantom{(}"),S("\\underbar","\\underline{\\text{#1}}"),S("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'),S("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),S("\\ne","\\neq"),S("≠","\\neq"),S("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),S("∉","\\notin"),S("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),S("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),S("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),S("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),S("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),S("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),S("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),S("⟂","\\perp"),S("‼","\\mathclose{!\\mkern-0.8mu!}"),S("∌","\\notni"),S("⌜","\\ulcorner"),S("⌝","\\urcorner"),S("⌞","\\llcorner"),S("⌟","\\lrcorner"),S("©","\\copyright"),S("®","\\textregistered"),S("️","\\textregistered"),S("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),S("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),S("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),S("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),S("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),S("⋮","\\vdots"),S("\\varGamma","\\mathit{\\Gamma}"),S("\\varDelta","\\mathit{\\Delta}"),S("\\varTheta","\\mathit{\\Theta}"),S("\\varLambda","\\mathit{\\Lambda}"),S("\\varXi","\\mathit{\\Xi}"),S("\\varPi","\\mathit{\\Pi}"),S("\\varSigma","\\mathit{\\Sigma}"),S("\\varUpsilon","\\mathit{\\Upsilon}"),S("\\varPhi","\\mathit{\\Phi}"),S("\\varPsi","\\mathit{\\Psi}"),S("\\varOmega","\\mathit{\\Omega}"),S("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),S("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),S("\\boxed","\\fbox{$\\displaystyle{#1}$}"),S("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),S("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),S("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;"),S("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"),S("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Xp={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};S("\\dots",function(r){var e="\\dotso",t=r.expandAfterFuture().text;return t in Xp?e=Xp[t]:(t.slice(0,4)==="\\not"||t in Ne.math&&["bin","rel"].includes(Ne.math[t].group))&&(e="\\dotsb"),e});var d0={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};S("\\dotso",function(r){var e=r.future().text;return e in d0?"\\ldots\\,":"\\ldots"}),S("\\dotsc",function(r){var e=r.future().text;return e in d0&&e!==","?"\\ldots\\,":"\\ldots"}),S("\\cdots",function(r){var e=r.future().text;return e in d0?"\\@cdots\\,":"\\@cdots"}),S("\\dotsb","\\cdots"),S("\\dotsm","\\cdots"),S("\\dotsi","\\!\\cdots"),S("\\dotsx","\\ldots\\,"),S("\\DOTSI","\\relax"),S("\\DOTSB","\\relax"),S("\\DOTSX","\\relax"),S("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),S("\\,","\\tmspace+{3mu}{.1667em}"),S("\\thinspace","\\,"),S("\\>","\\mskip{4mu}"),S("\\:","\\tmspace+{4mu}{.2222em}"),S("\\medspace","\\:"),S("\\;","\\tmspace+{5mu}{.2777em}"),S("\\thickspace","\\;"),S("\\!","\\tmspace-{3mu}{.1667em}"),S("\\negthinspace","\\!"),S("\\negmedspace","\\tmspace-{4mu}{.2222em}"),S("\\negthickspace","\\tmspace-{5mu}{.277em}"),S("\\enspace","\\kern.5em "),S("\\enskip","\\hskip.5em\\relax"),S("\\quad","\\hskip1em\\relax"),S("\\qquad","\\hskip2em\\relax"),S("\\tag","\\@ifstar\\tag@literal\\tag@paren"),S("\\tag@paren","\\tag@literal{({#1})}"),S("\\tag@literal",r=>{if(r.macros.get("\\df@tag"))throw new j("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),S("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),S("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),S("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),S("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),S("\\newline","\\\\\\relax"),S("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Zp=_(Jt["Main-Regular"][84][1]-.7*Jt["Main-Regular"][65][1]);S("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Zp+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}"),S("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Zp+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}"),S("\\hspace","\\@ifstar\\@hspacer\\@hspace"),S("\\@hspace","\\hskip #1\\relax"),S("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),S("\\ordinarycolon",":"),S("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),S("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),S("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),S("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),S("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),S("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),S("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),S("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),S("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),S("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),S("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),S("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),S("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),S("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),S("∷","\\dblcolon"),S("∹","\\eqcolon"),S("≔","\\coloneqq"),S("≕","\\eqqcolon"),S("⩴","\\Coloneqq"),S("\\ratio","\\vcentcolon"),S("\\coloncolon","\\dblcolon"),S("\\colonequals","\\coloneqq"),S("\\coloncolonequals","\\Coloneqq"),S("\\equalscolon","\\eqqcolon"),S("\\equalscoloncolon","\\Eqqcolon"),S("\\colonminus","\\coloneq"),S("\\coloncolonminus","\\Coloneq"),S("\\minuscolon","\\eqcolon"),S("\\minuscoloncolon","\\Eqcolon"),S("\\coloncolonapprox","\\Colonapprox"),S("\\coloncolonsim","\\Colonsim"),S("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),S("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),S("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),S("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),S("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),S("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),S("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),S("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),S("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),S("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),S("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),S("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),S("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),S("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),S("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),S("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),S("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),S("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),S("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),S("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),S("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),S("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),S("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),S("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),S("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),S("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),S("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),S("\\imath","\\html@mathml{\\@imath}{ı}"),S("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),S("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),S("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),S("⟦","\\llbracket"),S("⟧","\\rrbracket"),S("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),S("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),S("⦃","\\lBrace"),S("⦄","\\rBrace"),S("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),S("⦵","\\minuso"),S("\\darr","\\downarrow"),S("\\dArr","\\Downarrow"),S("\\Darr","\\Downarrow"),S("\\lang","\\langle"),S("\\rang","\\rangle"),S("\\uarr","\\uparrow"),S("\\uArr","\\Uparrow"),S("\\Uarr","\\Uparrow"),S("\\N","\\mathbb{N}"),S("\\R","\\mathbb{R}"),S("\\Z","\\mathbb{Z}"),S("\\alef","\\aleph"),S("\\alefsym","\\aleph"),S("\\Alpha","\\mathrm{A}"),S("\\Beta","\\mathrm{B}"),S("\\bull","\\bullet"),S("\\Chi","\\mathrm{X}"),S("\\clubs","\\clubsuit"),S("\\cnums","\\mathbb{C}"),S("\\Complex","\\mathbb{C}"),S("\\Dagger","\\ddagger"),S("\\diamonds","\\diamondsuit"),S("\\empty","\\emptyset"),S("\\Epsilon","\\mathrm{E}"),S("\\Eta","\\mathrm{H}"),S("\\exist","\\exists"),S("\\harr","\\leftrightarrow"),S("\\hArr","\\Leftrightarrow"),S("\\Harr","\\Leftrightarrow"),S("\\hearts","\\heartsuit"),S("\\image","\\Im"),S("\\infin","\\infty"),S("\\Iota","\\mathrm{I}"),S("\\isin","\\in"),S("\\Kappa","\\mathrm{K}"),S("\\larr","\\leftarrow"),S("\\lArr","\\Leftarrow"),S("\\Larr","\\Leftarrow"),S("\\lrarr","\\leftrightarrow"),S("\\lrArr","\\Leftrightarrow"),S("\\Lrarr","\\Leftrightarrow"),S("\\Mu","\\mathrm{M}"),S("\\natnums","\\mathbb{N}"),S("\\Nu","\\mathrm{N}"),S("\\Omicron","\\mathrm{O}"),S("\\plusmn","\\pm"),S("\\rarr","\\rightarrow"),S("\\rArr","\\Rightarrow"),S("\\Rarr","\\Rightarrow"),S("\\real","\\Re"),S("\\reals","\\mathbb{R}"),S("\\Reals","\\mathbb{R}"),S("\\Rho","\\mathrm{P}"),S("\\sdot","\\cdot"),S("\\sect","\\S"),S("\\spades","\\spadesuit"),S("\\sub","\\subset"),S("\\sube","\\subseteq"),S("\\supe","\\supseteq"),S("\\Tau","\\mathrm{T}"),S("\\thetasym","\\vartheta"),S("\\weierp","\\wp"),S("\\Zeta","\\mathrm{Z}"),S("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),S("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),S("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),S("\\bra","\\mathinner{\\langle{#1}|}"),S("\\ket","\\mathinner{|{#1}\\rangle}"),S("\\braket","\\mathinner{\\langle{#1}\\rangle}"),S("\\Bra","\\left\\langle#1\\right|"),S("\\Ket","\\left|#1\\right\\rangle");var Qp=r=>e=>{var t=e.consumeArg().tokens,n=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,o=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=d=>f=>{r&&(f.macros.set("|",o),i.length&&f.macros.set("\\|",a));var h=d;if(!d&&i.length){var m=f.future();m.text==="|"&&(f.popToken(),h=!0)}return{tokens:h?i:n,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var u=e.consumeArg().tokens,c=e.expandTokens([...s,...u,...t]);return e.macros.endGroup(),{tokens:c.reverse(),numArgs:0}};S("\\bra@ket",Qp(!1)),S("\\bra@set",Qp(!0)),S("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),S("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),S("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),S("\\angln","{\\angl n}"),S("\\blue","\\textcolor{##6495ed}{#1}"),S("\\orange","\\textcolor{##ffa500}{#1}"),S("\\pink","\\textcolor{##ff00af}{#1}"),S("\\red","\\textcolor{##df0030}{#1}"),S("\\green","\\textcolor{##28ae7b}{#1}"),S("\\gray","\\textcolor{gray}{#1}"),S("\\purple","\\textcolor{##9d38bd}{#1}"),S("\\blueA","\\textcolor{##ccfaff}{#1}"),S("\\blueB","\\textcolor{##80f6ff}{#1}"),S("\\blueC","\\textcolor{##63d9ea}{#1}"),S("\\blueD","\\textcolor{##11accd}{#1}"),S("\\blueE","\\textcolor{##0c7f99}{#1}"),S("\\tealA","\\textcolor{##94fff5}{#1}"),S("\\tealB","\\textcolor{##26edd5}{#1}"),S("\\tealC","\\textcolor{##01d1c1}{#1}"),S("\\tealD","\\textcolor{##01a995}{#1}"),S("\\tealE","\\textcolor{##208170}{#1}"),S("\\greenA","\\textcolor{##b6ffb0}{#1}"),S("\\greenB","\\textcolor{##8af281}{#1}"),S("\\greenC","\\textcolor{##74cf70}{#1}"),S("\\greenD","\\textcolor{##1fab54}{#1}"),S("\\greenE","\\textcolor{##0d923f}{#1}"),S("\\goldA","\\textcolor{##ffd0a9}{#1}"),S("\\goldB","\\textcolor{##ffbb71}{#1}"),S("\\goldC","\\textcolor{##ff9c39}{#1}"),S("\\goldD","\\textcolor{##e07d10}{#1}"),S("\\goldE","\\textcolor{##a75a05}{#1}"),S("\\redA","\\textcolor{##fca9a9}{#1}"),S("\\redB","\\textcolor{##ff8482}{#1}"),S("\\redC","\\textcolor{##f9685d}{#1}"),S("\\redD","\\textcolor{##e84d39}{#1}"),S("\\redE","\\textcolor{##bc2612}{#1}"),S("\\maroonA","\\textcolor{##ffbde0}{#1}"),S("\\maroonB","\\textcolor{##ff92c6}{#1}"),S("\\maroonC","\\textcolor{##ed5fa6}{#1}"),S("\\maroonD","\\textcolor{##ca337c}{#1}"),S("\\maroonE","\\textcolor{##9e034e}{#1}"),S("\\purpleA","\\textcolor{##ddd7ff}{#1}"),S("\\purpleB","\\textcolor{##c6b9fc}{#1}"),S("\\purpleC","\\textcolor{##aa87ff}{#1}"),S("\\purpleD","\\textcolor{##7854ab}{#1}"),S("\\purpleE","\\textcolor{##543b78}{#1}"),S("\\mintA","\\textcolor{##f5f9e8}{#1}"),S("\\mintB","\\textcolor{##edf2df}{#1}"),S("\\mintC","\\textcolor{##e0e5cc}{#1}"),S("\\grayA","\\textcolor{##f6f7f7}{#1}"),S("\\grayB","\\textcolor{##f0f1f2}{#1}"),S("\\grayC","\\textcolor{##e3e5e6}{#1}"),S("\\grayD","\\textcolor{##d6d8da}{#1}"),S("\\grayE","\\textcolor{##babec2}{#1}"),S("\\grayF","\\textcolor{##888d93}{#1}"),S("\\grayG","\\textcolor{##626569}{#1}"),S("\\grayH","\\textcolor{##3b3e40}{#1}"),S("\\grayI","\\textcolor{##21242c}{#1}"),S("\\kaBlue","\\textcolor{##314453}{#1}"),S("\\kaGreen","\\textcolor{##71B307}{#1}");var em={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class b8{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new v8(y8,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new Yp(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:t,end:n}=this.consumeArg());return this.pushToken(new Tt("EOF",n.loc)),this.pushTokens(i),new Tt("",gt.range(t,n))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var i=this.future(),s,o=0,a=0;do{if(s=this.popToken(),t.push(s),s.text==="{")++o;else if(s.text==="}"){if(--o,o===-1)throw new j("Extra }",s)}else if(s.text==="EOF")throw new j("Unexpected end of input in a macro argument, expected '"+(e&&n?e[a]:"}")+"'",s);if(e&&n)if((o===0||o===1&&e[a]==="{")&&s.text===e[a]){if(++a,a===e.length){t.splice(-a,a);break}}else a=0}while(o!==0||n);return i.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:s}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new j("The length of delimiters doesn't match the number of args!");for(var n=t[0],i=0;i<n.length;i++){var s=this.popToken();if(n[i]!==s.text)throw new j("Use of the macro doesn't match its definition",s)}}for(var o=[],a=0;a<e;a++)o.push(this.consumeArg(t&&t[a+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new j("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,i=t.noexpand?null:this._getExpansion(n);if(i==null||e&&i.unexpandable){if(e&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new j("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var s=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var a=s.length-1;a>=0;--a){var l=s[a];if(l.text==="#"){if(a===0)throw new j("Incomplete placeholder at end of macro body",l);if(l=s[--a],l.text==="#")s.splice(a+1,1);else if(/^[1-9]$/.test(l.text))s.splice(a,2,...o[+l.text-1]);else throw new j("Not a valid argument number",l)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Tt(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),t.push(i)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(n=>n.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var i=typeof t=="function"?t(this):t;if(typeof i=="string"){var s=0;if(i.indexOf("#")!==-1)for(var o=i.replace(/##/g,"");o.indexOf("#"+(s+1))!==-1;)++s;for(var a=new Yp(i,this.settings),l=[],u=a.lex();u.text!=="EOF";)l.push(u),u=a.lex();l.reverse();var c={tokens:l,numArgs:s};return c}return i}isDefined(e){return this.macros.has(e)||Zr.hasOwnProperty(e)||Ne.math.hasOwnProperty(e)||Ne.text.hasOwnProperty(e)||em.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:Zr.hasOwnProperty(e)&&!Zr[e].primitive}}var tm=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,bo=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),h0={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},rm={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class wo{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new b8(e,t,this.mode),this.settings=t,this.leftrightDepth=0}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new j("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Tt("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(wo.endOfExpression.indexOf(i.text)!==-1||t&&i.text===t||e&&Zr[i.text]&&Zr[i.text].infix)break;var s=this.parseAtom(t);if(s){if(s.type==="internal")continue}else break;n.push(s)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t=-1,n,i=0;i<e.length;i++)if(e[i].type==="infix"){if(t!==-1)throw new j("only one infix operator per group",e[i].token);t=i,n=e[i].replaceWith}if(t!==-1&&n){var s,o,a=e.slice(0,t),l=e.slice(t+1);a.length===1&&a[0].type==="ordgroup"?s=a[0]:s={type:"ordgroup",mode:this.mode,body:a},l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l};var u;return n==="\\\\abovefrac"?u=this.callFunction(n,[s,e[t],o],[]):u=this.callFunction(n,[s,o],[]),[u]}else return e}handleSupSubscript(e){var t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();var i;do{var s;i=this.parseGroup(e)}while(((s=i)==null?void 0:s.type)==="internal");if(!i)throw new j("Expected group after '"+n+"'",t);return i}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var i={type:"text",mode:this.mode,body:t},s={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return s}parseAtom(e){var t=this.parseGroup("atom",e);if(t?.type==="internal"||this.mode==="text")return t;for(var n,i;;){this.consumeSpaces();var s=this.fetch();if(s.text==="\\limits"||s.text==="\\nolimits"){if(t&&t.type==="op"){var o=s.text==="\\limits";t.limits=o,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=s.text==="\\limits");else throw new j("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(n)throw new j("Double superscript",s);n=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new j("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(n)throw new j("Double superscript",s);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:l}}else if(bo[s.text]){var u=tm.test(s.text),c=[];for(c.push(new Tt(bo[s.text])),this.consume();;){var d=this.fetch().text;if(!bo[d]||tm.test(d)!==u)break;c.unshift(new Tt(bo[d])),this.consume()}var f=this.subparse(c);u?i={type:"ordgroup",mode:"math",body:f}:n={type:"ordgroup",mode:"math",body:f}}else break}return n||i?{type:"supsub",mode:this.mode,base:t,sup:n,sub:i}:t}parseFunction(e,t){var n=this.fetch(),i=n.text,s=Zr[i];if(!s)return null;if(this.consume(),t&&t!=="atom"&&!s.allowedInArgument)throw new j("Got function '"+i+"' with no arguments"+(t?" as "+t:""),n);if(this.mode==="text"&&!s.allowedInText)throw new j("Can't use function '"+i+"' in text mode",n);if(this.mode==="math"&&s.allowedInMath===!1)throw new j("Can't use function '"+i+"' in math mode",n);var{args:o,optArgs:a}=this.parseArguments(i,s);return this.callFunction(i,o,a,n,e)}callFunction(e,t,n,i,s){var o={funcName:e,parser:this,token:i,breakOnTokenText:s},a=Zr[e];if(a&&a.handler)return a.handler(o,t,n);throw new j("No function handler for "+e)}parseArguments(e,t){var n=t.numArgs+t.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var i=[],s=[],o=0;o<n;o++){var a=t.argTypes&&t.argTypes[o],l=o<t.numOptionalArgs;(t.primitive&&a==null||t.type==="sqrt"&&o===1&&s[0]==null)&&(a="primitive");var u=this.parseGroupOfType("argument to '"+e+"'",a,l);if(l)s.push(u);else if(u!=null)i.push(u);else throw new j("Null argument, please report this as a bug")}return{args:i,optArgs:s}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":{var i=this.parseArgumentGroup(n,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text"}:null}case"raw":{var s=this.parseStringGroup("raw",n);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(n)throw new j("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new j("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new j("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var n=this.gullet.scanArgument(t);if(n==null)return null;for(var i="",s;(s=this.fetch()).text!=="EOF";)i+=s.text,this.consume();return this.consume(),n.text=i,n}parseRegexGroup(e,t){for(var n=this.fetch(),i=n,s="",o;(o=this.fetch()).text!=="EOF"&&e.test(s+o.text);)i=o,s+=i.text,this.consume();if(s==="")throw new j("Invalid "+t+": '"+n.text+"'",n);return n.range(i,s)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new j("Invalid color: '"+t.text+"'",t);var i=n[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",n=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!i)throw new j("Invalid size: '"+t.text+"'",t);var s={number:+(i[1]+i[2]),unit:i[3]};if(!Lf(s))throw new j("Invalid unit: '"+s.unit+"'",t);return{type:"size",mode:this.mode,value:s,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(n==null)return null;var i=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:n.loc,body:s};return t&&this.switchMode(i),o}parseGroup(e,t){var n=this.fetch(),i=n.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:gt.range(n,l),body:a,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(t,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!em.hasOwnProperty(i)){if(this.settings.throwOnError)throw new j("Undefined control sequence: "+i,n);s=this.formatUnsupportedCmd(i),this.consume()}return s}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var i=e[n],s=i.text;s==="-"&&e[n+1].text==="-"&&(n+1<t&&e[n+2].text==="-"?(e.splice(n,3,{type:"textord",mode:"text",loc:gt.range(i,e[n+2]),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:gt.range(i,e[n+1]),text:"--"}),t-=1)),(s==="'"||s==="`")&&e[n+1].text===s&&(e.splice(n,2,{type:"textord",mode:"text",loc:gt.range(i,e[n+1]),text:s+s}),t-=1)}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),i=n.charAt(0)==="*";if(i&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new j(`\\verb assertion failed --
866
- please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:i}}rm.hasOwnProperty(t[0])&&!Ne[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=rm[t[0]]+t.slice(1));var s=m8.exec(t);s&&(t=t.substring(0,s.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var o;if(Ne[this.mode][t]){this.settings.strict&&this.mode==="math"&&Ll.indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var a=Ne[this.mode][t].group,l=gt.range(e),u;if(ab.hasOwnProperty(a)){var c=a;u={type:"atom",mode:this.mode,family:c,loc:l,text:t}}else u={type:a,mode:this.mode,loc:l,text:t};o=u}else if(t.charCodeAt(0)>=128)this.settings.strict&&(Df(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),o={type:"textord",mode:"text",loc:gt.range(e),text:t};else return null;if(this.consume(),s)for(var d=0;d<s[0].length;d++){var f=s[0][d];if(!h0[f])throw new j("Unknown accent ' "+f+"'",e);var h=h0[f][this.mode]||h0[f].text;if(!h)throw new j("Accent "+f+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:gt.range(e),label:h,isStretchy:!1,isShifty:!0,base:o}}return o}}wo.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var f0=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new wo(e,t);delete n.gullet.macros.current["\\df@tag"];var i=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new j("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:n.subparse([new Tt("\\df@tag")])}]}return i},nm=function(e,t,n){t.textContent="";var i=p0(e,n).toNode();t.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),nm=function(){throw new j("KaTeX doesn't work in quirks mode.")});var w8=function(e,t){var n=p0(e,t).toMarkup();return n},x8=function(e,t){var n=new Ml(t);return f0(e,n)},im=function(e,t,n){if(n.throwOnError||!(e instanceof j))throw e;var i=P.makeSpan(["katex-error"],[new zt(t)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+n.errorColor),i},p0=function(e,t){var n=new Ml(t);try{var i=f0(e,n);return Nb(i,e,n)}catch(s){return im(s,e,n)}},S8=function(e,t){var n=new Ml(t);try{var i=f0(e,n);return Db(i,e,n)}catch(s){return im(s,e,n)}},k8="0.16.27",T8={Span:Pi,Anchor:Dl,SymbolNode:zt,SvgNode:gr,PathNode:Kr,LineNode:Il},qn={version:k8,render:nm,renderToString:w8,ParseError:j,SETTINGS_SCHEMA:Xs,__parse:x8,__renderToDomTree:p0,__renderToHTMLTree:S8,__setFontMetrics:Q7,__defineSymbol:p,__defineFunction:Y,__defineMacro:S,__domTree:T8};const M8=Ce.create({name:"m",content:"text*",group:"inline math",inline:!0,atom:!1,parseHTML(){return[{tag:"m"}]},renderHTML({HTMLAttributes:r}){return["span",be({class:"inlineMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("span");t.classList.add("node-view"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.innerHTML=qn.renderToString(s,{throwOnError:!1}),n.contentEditable="true",i.classList.add("edit-math"),i.classList.add("is-editable"),i.innerHTML="<m>"+r.textContent+"</m>",new MutationObserver(()=>{console.log("mutation observer"),n.innerHTML=qn.renderToString(r.textContent,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),t.append(n,i),{dom:t,contentDOM:i}}}}),C8=Ce.create({name:"me",content:"text*",group:"inline math",inline:!0,parseHTML(){return[{tag:"me"}]},renderHTML({HTMLAttributes:r}){return["div",be({class:"displayMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("div");t.classList.add("node-view"),t.classList.add("display"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.innerHTML=qn.renderToString(s,{throwOnError:!1}),n.contentEditable="false",i.classList.add("edit-math"),i.classList.add("is-editable"),i.innerHTML="<md>"+r.textContent+"</md>",new MutationObserver(()=>{console.log("mutation observer"),n.innerHTML=qn.renderToString(r.textContent,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),t.append(n,i),{dom:t,contentDOM:i}}}}),E8=Ce.create({name:"md",content:"text*",group:"inline math",inline:!0,parseHTML(){return[{tag:"md"}]},renderHTML({HTMLAttributes:r}){return["div",be({class:"displayMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("div");t.classList.add("node-view"),t.classList.add("display"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.innerHTML=qn.renderToString(s,{throwOnError:!1}),n.contentEditable="false",i.classList.add("edit-math"),i.classList.add("is-editable"),i.innerHTML="<md>"+r.textContent+"</md>",new MutationObserver(()=>{console.log("mutation observer"),n.innerHTML=qn.renderToString(r.textContent,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),t.append(n,i),{dom:t,contentDOM:i}}}}),A8=Ce.create({name:"introduction",content:"(BasicBlock|block|rawptx)*",group:"division introduction",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"introduction"}]},renderHTML({HTMLAttributes:r}){return["article",be({class:"introduction",label:"introduction"},r),0]},addInputRules(){return[mt({find:new RegExp("^#intro\\s$"),type:this.type})]}}),O8=Ce.create({name:"chapter",content:"title ((introduction?|section+)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"chapter"}]},renderHTML({HTMLAttributes:r}){return["section",be({class:"chapter",ptxtag:"chapter"},r),0]},addInputRules(){return[mt({find:new RegExp("^#ch\\s$"),type:this.type})]}}),N8=Ce.create({name:"section",content:"title ((introduction?|subsection+)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"section"}]},renderHTML({HTMLAttributes:r}){return["section",be({class:"section",ptxtag:"section"},r),0]},addInputRules(){return[mt({find:new RegExp("^#sec\\s$"),type:this.type})]}}),D8=Ce.create({name:"subsection",content:"title (BasicBlock|block|rawptx)+",group:"division",selectable:!1,draggable:!0,defining:!1,parseHTML(){return[{tag:"subsection"}]},addAttributes(){return{label:{default:null,parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")}}},renderHTML({HTMLAttributes:r}){return["section",be({class:"subsection",ptxtag:"subsection"},r),0]},addInputRules(){return[mt({find:new RegExp("^#subsec\\s$"),type:this.type})]}}),I8=Ce.create({name:"worksheet",content:"title? ((introduction?)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!1,draggable:!0,defining:!1,parseHTML(){return[{tag:"worksheet"}]},addAttributes(){return{label:{default:null,parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")}}},renderHTML({HTMLAttributes:r}){return["section",be({class:"worksheet",ptxtag:"worksheet"},r),0]},addInputRules(){return[mt({find:new RegExp("^#ws\\s$"),type:this.type})]}}),R8=xe.create({name:"divisions",addExtensions(){return[A8,O8,N8,D8,I8]}});var P8=Ce.create({name:"text",group:"inline",parseMarkdown:r=>({type:"text",text:r.text||""}),renderMarkdown:r=>r.text||""}),z8=Ce.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:r}){return["br",be(this.options.HTMLAttributes,r)]},renderText(){return`
864
+ ?)[ \r ]*`,u0="[̀-ͯ]",m8=new RegExp(u0+"+$"),g8="("+Kp+"+)|"+(p8+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(u0+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(u0+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+f8)+("|"+h8+")");class Yp{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(g8,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new Tt("EOF",new gt(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new _("Unexpected character: '"+e[t]+"'",new Tt(e[t],new gt(this,t,t+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
865
+ `,this.tokenRegex.lastIndex);return s===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=s+1,this.lex()}return new Tt(i,new gt(this,t,this.tokenRegex.lastIndex))}}class v8{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new _("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var y8=Tp;S("\\noexpand",function(r){var e=r.popToken();return r.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}}),S("\\expandafter",function(r){var e=r.popToken();return r.expandOnce(!0),{tokens:[e],numArgs:0}}),S("\\@firstoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[0],numArgs:0}}),S("\\@secondoftwo",function(r){var e=r.consumeArgs(2);return{tokens:e[1],numArgs:0}}),S("\\@ifnextchar",function(r){var e=r.consumeArgs(3);r.consumeSpaces();var t=r.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}}),S("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),S("\\TextOrMath",function(r){var e=r.consumeArgs(2);return r.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var Jp={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};S("\\char",function(r){var e=r.popToken(),t,n="";if(e.text==="'")t=8,e=r.popToken();else if(e.text==='"')t=16,e=r.popToken();else if(e.text==="`")if(e=r.popToken(),e.text[0]==="\\")n=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new _("\\char` missing argument");n=e.text.charCodeAt(0)}else t=10;if(t){if(n=Jp[e.text],n==null||n>=t)throw new _("Invalid base-"+t+" digit "+e.text);for(var i;(i=Jp[r.future().text])!=null&&i<t;)n*=t,n+=i,r.popToken()}return"\\@char{"+n+"}"});var c0=(r,e,t,n)=>{var i=r.consumeArg().tokens;if(i.length!==1)throw new _("\\newcommand's first argument must be a macro name");var s=i[0].text,o=r.isDefined(s);if(o&&!e)throw new _("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!t)throw new _("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var a=0;if(i=r.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",u=r.expandNextToken();u.text!=="]"&&u.text!=="EOF";)l+=u.text,u=r.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new _("Invalid number of arguments: "+l);a=parseInt(l),i=r.consumeArg().tokens}return o&&n||r.macros.set(s,{tokens:i,numArgs:a}),""};S("\\newcommand",r=>c0(r,!1,!0,!1)),S("\\renewcommand",r=>c0(r,!0,!1,!1)),S("\\providecommand",r=>c0(r,!0,!0,!0)),S("\\message",r=>{var e=r.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""}),S("\\errmessage",r=>{var e=r.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""}),S("\\show",r=>{var e=r.popToken(),t=e.text;return console.log(e,r.macros.get(t),Zr[t],Ne.math[t],Ne.text[t]),""}),S("\\bgroup","{"),S("\\egroup","}"),S("~","\\nobreakspace"),S("\\lq","`"),S("\\rq","'"),S("\\aa","\\r a"),S("\\AA","\\r A"),S("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}"),S("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"),S("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),S("ℬ","\\mathscr{B}"),S("ℰ","\\mathscr{E}"),S("ℱ","\\mathscr{F}"),S("ℋ","\\mathscr{H}"),S("ℐ","\\mathscr{I}"),S("ℒ","\\mathscr{L}"),S("ℳ","\\mathscr{M}"),S("ℛ","\\mathscr{R}"),S("ℭ","\\mathfrak{C}"),S("ℌ","\\mathfrak{H}"),S("ℨ","\\mathfrak{Z}"),S("\\Bbbk","\\Bbb{k}"),S("·","\\cdotp"),S("\\llap","\\mathllap{\\textrm{#1}}"),S("\\rlap","\\mathrlap{\\textrm{#1}}"),S("\\clap","\\mathclap{\\textrm{#1}}"),S("\\mathstrut","\\vphantom{(}"),S("\\underbar","\\underline{\\text{#1}}"),S("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'),S("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),S("\\ne","\\neq"),S("≠","\\neq"),S("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),S("∉","\\notin"),S("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),S("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),S("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),S("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),S("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),S("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),S("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),S("⟂","\\perp"),S("‼","\\mathclose{!\\mkern-0.8mu!}"),S("∌","\\notni"),S("⌜","\\ulcorner"),S("⌝","\\urcorner"),S("⌞","\\llcorner"),S("⌟","\\lrcorner"),S("©","\\copyright"),S("®","\\textregistered"),S("️","\\textregistered"),S("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'),S("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'),S("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'),S("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'),S("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),S("⋮","\\vdots"),S("\\varGamma","\\mathit{\\Gamma}"),S("\\varDelta","\\mathit{\\Delta}"),S("\\varTheta","\\mathit{\\Theta}"),S("\\varLambda","\\mathit{\\Lambda}"),S("\\varXi","\\mathit{\\Xi}"),S("\\varPi","\\mathit{\\Pi}"),S("\\varSigma","\\mathit{\\Sigma}"),S("\\varUpsilon","\\mathit{\\Upsilon}"),S("\\varPhi","\\mathit{\\Phi}"),S("\\varPsi","\\mathit{\\Psi}"),S("\\varOmega","\\mathit{\\Omega}"),S("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),S("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"),S("\\boxed","\\fbox{$\\displaystyle{#1}$}"),S("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),S("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),S("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;"),S("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"),S("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Xp={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};S("\\dots",function(r){var e="\\dotso",t=r.expandAfterFuture().text;return t in Xp?e=Xp[t]:(t.slice(0,4)==="\\not"||t in Ne.math&&["bin","rel"].includes(Ne.math[t].group))&&(e="\\dotsb"),e});var d0={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};S("\\dotso",function(r){var e=r.future().text;return e in d0?"\\ldots\\,":"\\ldots"}),S("\\dotsc",function(r){var e=r.future().text;return e in d0&&e!==","?"\\ldots\\,":"\\ldots"}),S("\\cdots",function(r){var e=r.future().text;return e in d0?"\\@cdots\\,":"\\@cdots"}),S("\\dotsb","\\cdots"),S("\\dotsm","\\cdots"),S("\\dotsi","\\!\\cdots"),S("\\dotsx","\\ldots\\,"),S("\\DOTSI","\\relax"),S("\\DOTSB","\\relax"),S("\\DOTSX","\\relax"),S("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),S("\\,","\\tmspace+{3mu}{.1667em}"),S("\\thinspace","\\,"),S("\\>","\\mskip{4mu}"),S("\\:","\\tmspace+{4mu}{.2222em}"),S("\\medspace","\\:"),S("\\;","\\tmspace+{5mu}{.2777em}"),S("\\thickspace","\\;"),S("\\!","\\tmspace-{3mu}{.1667em}"),S("\\negthinspace","\\!"),S("\\negmedspace","\\tmspace-{4mu}{.2222em}"),S("\\negthickspace","\\tmspace-{5mu}{.277em}"),S("\\enspace","\\kern.5em "),S("\\enskip","\\hskip.5em\\relax"),S("\\quad","\\hskip1em\\relax"),S("\\qquad","\\hskip2em\\relax"),S("\\tag","\\@ifstar\\tag@literal\\tag@paren"),S("\\tag@paren","\\tag@literal{({#1})}"),S("\\tag@literal",r=>{if(r.macros.get("\\df@tag"))throw new _("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),S("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),S("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),S("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),S("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),S("\\newline","\\\\\\relax"),S("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Zp=q(Jt["Main-Regular"][84][1]-.7*Jt["Main-Regular"][65][1]);S("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Zp+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}"),S("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Zp+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}"),S("\\hspace","\\@ifstar\\@hspacer\\@hspace"),S("\\@hspace","\\hskip #1\\relax"),S("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),S("\\ordinarycolon",":"),S("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),S("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),S("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),S("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),S("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),S("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),S("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),S("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),S("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),S("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),S("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),S("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),S("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),S("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),S("∷","\\dblcolon"),S("∹","\\eqcolon"),S("≔","\\coloneqq"),S("≕","\\eqqcolon"),S("⩴","\\Coloneqq"),S("\\ratio","\\vcentcolon"),S("\\coloncolon","\\dblcolon"),S("\\colonequals","\\coloneqq"),S("\\coloncolonequals","\\Coloneqq"),S("\\equalscolon","\\eqqcolon"),S("\\equalscoloncolon","\\Eqqcolon"),S("\\colonminus","\\coloneq"),S("\\coloncolonminus","\\Coloneq"),S("\\minuscolon","\\eqcolon"),S("\\minuscoloncolon","\\Eqcolon"),S("\\coloncolonapprox","\\Colonapprox"),S("\\coloncolonsim","\\Colonsim"),S("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),S("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),S("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),S("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),S("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),S("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),S("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),S("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),S("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),S("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}"),S("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}"),S("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}"),S("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}"),S("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}"),S("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}"),S("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}"),S("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}"),S("\\nleqq","\\html@mathml{\\@nleqq}{≰}"),S("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}"),S("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}"),S("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}"),S("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}"),S("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}"),S("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}"),S("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}"),S("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}"),S("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}"),S("\\imath","\\html@mathml{\\@imath}{ı}"),S("\\jmath","\\html@mathml{\\@jmath}{ȷ}"),S("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),S("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),S("⟦","\\llbracket"),S("⟧","\\rrbracket"),S("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),S("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),S("⦃","\\lBrace"),S("⦄","\\rBrace"),S("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),S("⦵","\\minuso"),S("\\darr","\\downarrow"),S("\\dArr","\\Downarrow"),S("\\Darr","\\Downarrow"),S("\\lang","\\langle"),S("\\rang","\\rangle"),S("\\uarr","\\uparrow"),S("\\uArr","\\Uparrow"),S("\\Uarr","\\Uparrow"),S("\\N","\\mathbb{N}"),S("\\R","\\mathbb{R}"),S("\\Z","\\mathbb{Z}"),S("\\alef","\\aleph"),S("\\alefsym","\\aleph"),S("\\Alpha","\\mathrm{A}"),S("\\Beta","\\mathrm{B}"),S("\\bull","\\bullet"),S("\\Chi","\\mathrm{X}"),S("\\clubs","\\clubsuit"),S("\\cnums","\\mathbb{C}"),S("\\Complex","\\mathbb{C}"),S("\\Dagger","\\ddagger"),S("\\diamonds","\\diamondsuit"),S("\\empty","\\emptyset"),S("\\Epsilon","\\mathrm{E}"),S("\\Eta","\\mathrm{H}"),S("\\exist","\\exists"),S("\\harr","\\leftrightarrow"),S("\\hArr","\\Leftrightarrow"),S("\\Harr","\\Leftrightarrow"),S("\\hearts","\\heartsuit"),S("\\image","\\Im"),S("\\infin","\\infty"),S("\\Iota","\\mathrm{I}"),S("\\isin","\\in"),S("\\Kappa","\\mathrm{K}"),S("\\larr","\\leftarrow"),S("\\lArr","\\Leftarrow"),S("\\Larr","\\Leftarrow"),S("\\lrarr","\\leftrightarrow"),S("\\lrArr","\\Leftrightarrow"),S("\\Lrarr","\\Leftrightarrow"),S("\\Mu","\\mathrm{M}"),S("\\natnums","\\mathbb{N}"),S("\\Nu","\\mathrm{N}"),S("\\Omicron","\\mathrm{O}"),S("\\plusmn","\\pm"),S("\\rarr","\\rightarrow"),S("\\rArr","\\Rightarrow"),S("\\Rarr","\\Rightarrow"),S("\\real","\\Re"),S("\\reals","\\mathbb{R}"),S("\\Reals","\\mathbb{R}"),S("\\Rho","\\mathrm{P}"),S("\\sdot","\\cdot"),S("\\sect","\\S"),S("\\spades","\\spadesuit"),S("\\sub","\\subset"),S("\\sube","\\subseteq"),S("\\supe","\\supseteq"),S("\\Tau","\\mathrm{T}"),S("\\thetasym","\\vartheta"),S("\\weierp","\\wp"),S("\\Zeta","\\mathrm{Z}"),S("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),S("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),S("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),S("\\bra","\\mathinner{\\langle{#1}|}"),S("\\ket","\\mathinner{|{#1}\\rangle}"),S("\\braket","\\mathinner{\\langle{#1}\\rangle}"),S("\\Bra","\\left\\langle#1\\right|"),S("\\Ket","\\left|#1\\right\\rangle");var Qp=r=>e=>{var t=e.consumeArg().tokens,n=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,o=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=d=>f=>{r&&(f.macros.set("|",o),i.length&&f.macros.set("\\|",a));var h=d;if(!d&&i.length){var m=f.future();m.text==="|"&&(f.popToken(),h=!0)}return{tokens:h?i:n,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var u=e.consumeArg().tokens,c=e.expandTokens([...s,...u,...t]);return e.macros.endGroup(),{tokens:c.reverse(),numArgs:0}};S("\\bra@ket",Qp(!1)),S("\\bra@set",Qp(!0)),S("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"),S("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"),S("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"),S("\\angln","{\\angl n}"),S("\\blue","\\textcolor{##6495ed}{#1}"),S("\\orange","\\textcolor{##ffa500}{#1}"),S("\\pink","\\textcolor{##ff00af}{#1}"),S("\\red","\\textcolor{##df0030}{#1}"),S("\\green","\\textcolor{##28ae7b}{#1}"),S("\\gray","\\textcolor{gray}{#1}"),S("\\purple","\\textcolor{##9d38bd}{#1}"),S("\\blueA","\\textcolor{##ccfaff}{#1}"),S("\\blueB","\\textcolor{##80f6ff}{#1}"),S("\\blueC","\\textcolor{##63d9ea}{#1}"),S("\\blueD","\\textcolor{##11accd}{#1}"),S("\\blueE","\\textcolor{##0c7f99}{#1}"),S("\\tealA","\\textcolor{##94fff5}{#1}"),S("\\tealB","\\textcolor{##26edd5}{#1}"),S("\\tealC","\\textcolor{##01d1c1}{#1}"),S("\\tealD","\\textcolor{##01a995}{#1}"),S("\\tealE","\\textcolor{##208170}{#1}"),S("\\greenA","\\textcolor{##b6ffb0}{#1}"),S("\\greenB","\\textcolor{##8af281}{#1}"),S("\\greenC","\\textcolor{##74cf70}{#1}"),S("\\greenD","\\textcolor{##1fab54}{#1}"),S("\\greenE","\\textcolor{##0d923f}{#1}"),S("\\goldA","\\textcolor{##ffd0a9}{#1}"),S("\\goldB","\\textcolor{##ffbb71}{#1}"),S("\\goldC","\\textcolor{##ff9c39}{#1}"),S("\\goldD","\\textcolor{##e07d10}{#1}"),S("\\goldE","\\textcolor{##a75a05}{#1}"),S("\\redA","\\textcolor{##fca9a9}{#1}"),S("\\redB","\\textcolor{##ff8482}{#1}"),S("\\redC","\\textcolor{##f9685d}{#1}"),S("\\redD","\\textcolor{##e84d39}{#1}"),S("\\redE","\\textcolor{##bc2612}{#1}"),S("\\maroonA","\\textcolor{##ffbde0}{#1}"),S("\\maroonB","\\textcolor{##ff92c6}{#1}"),S("\\maroonC","\\textcolor{##ed5fa6}{#1}"),S("\\maroonD","\\textcolor{##ca337c}{#1}"),S("\\maroonE","\\textcolor{##9e034e}{#1}"),S("\\purpleA","\\textcolor{##ddd7ff}{#1}"),S("\\purpleB","\\textcolor{##c6b9fc}{#1}"),S("\\purpleC","\\textcolor{##aa87ff}{#1}"),S("\\purpleD","\\textcolor{##7854ab}{#1}"),S("\\purpleE","\\textcolor{##543b78}{#1}"),S("\\mintA","\\textcolor{##f5f9e8}{#1}"),S("\\mintB","\\textcolor{##edf2df}{#1}"),S("\\mintC","\\textcolor{##e0e5cc}{#1}"),S("\\grayA","\\textcolor{##f6f7f7}{#1}"),S("\\grayB","\\textcolor{##f0f1f2}{#1}"),S("\\grayC","\\textcolor{##e3e5e6}{#1}"),S("\\grayD","\\textcolor{##d6d8da}{#1}"),S("\\grayE","\\textcolor{##babec2}{#1}"),S("\\grayF","\\textcolor{##888d93}{#1}"),S("\\grayG","\\textcolor{##626569}{#1}"),S("\\grayH","\\textcolor{##3b3e40}{#1}"),S("\\grayI","\\textcolor{##21242c}{#1}"),S("\\kaBlue","\\textcolor{##314453}{#1}"),S("\\kaGreen","\\textcolor{##71B307}{#1}");var em={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class b8{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new v8(y8,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new Yp(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:t,end:n}=this.consumeArg());return this.pushToken(new Tt("EOF",n.loc)),this.pushTokens(i),new Tt("",gt.range(t,n))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var i=this.future(),s,o=0,a=0;do{if(s=this.popToken(),t.push(s),s.text==="{")++o;else if(s.text==="}"){if(--o,o===-1)throw new _("Extra }",s)}else if(s.text==="EOF")throw new _("Unexpected end of input in a macro argument, expected '"+(e&&n?e[a]:"}")+"'",s);if(e&&n)if((o===0||o===1&&e[a]==="{")&&s.text===e[a]){if(++a,a===e.length){t.splice(-a,a);break}}else a=0}while(o!==0||n);return i.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:s}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new _("The length of delimiters doesn't match the number of args!");for(var n=t[0],i=0;i<n.length;i++){var s=this.popToken();if(n[i]!==s.text)throw new _("Use of the macro doesn't match its definition",s)}}for(var o=[],a=0;a<e;a++)o.push(this.consumeArg(t&&t[a+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new _("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),n=t.text,i=t.noexpand?null:this._getExpansion(n);if(i==null||e&&i.unexpandable){if(e&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new _("Undefined control sequence: "+n);return this.pushToken(t),!1}this.countExpansion(1);var s=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var a=s.length-1;a>=0;--a){var l=s[a];if(l.text==="#"){if(a===0)throw new _("Incomplete placeholder at end of macro body",l);if(l=s[--a],l.text==="#")s.splice(a+1,1);else if(/^[1-9]$/.test(l.text))s.splice(a,2,...o[+l.text-1]);else throw new _("Not a valid argument number",l)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Tt(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),t.push(i)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(n=>n.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var i=typeof t=="function"?t(this):t;if(typeof i=="string"){var s=0;if(i.indexOf("#")!==-1)for(var o=i.replace(/##/g,"");o.indexOf("#"+(s+1))!==-1;)++s;for(var a=new Yp(i,this.settings),l=[],u=a.lex();u.text!=="EOF";)l.push(u),u=a.lex();l.reverse();var c={tokens:l,numArgs:s};return c}return i}isDefined(e){return this.macros.has(e)||Zr.hasOwnProperty(e)||Ne.math.hasOwnProperty(e)||Ne.text.hasOwnProperty(e)||em.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:Zr.hasOwnProperty(e)&&!Zr[e].primitive}}var tm=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,bo=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),h0={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},rm={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class wo{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new b8(e,t,this.mode),this.settings=t,this.leftrightDepth=0}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new _("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Tt("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,n}parseExpression(e,t){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(wo.endOfExpression.indexOf(i.text)!==-1||t&&i.text===t||e&&Zr[i.text]&&Zr[i.text].infix)break;var s=this.parseAtom(t);if(s){if(s.type==="internal")continue}else break;n.push(s)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var t=-1,n,i=0;i<e.length;i++)if(e[i].type==="infix"){if(t!==-1)throw new _("only one infix operator per group",e[i].token);t=i,n=e[i].replaceWith}if(t!==-1&&n){var s,o,a=e.slice(0,t),l=e.slice(t+1);a.length===1&&a[0].type==="ordgroup"?s=a[0]:s={type:"ordgroup",mode:this.mode,body:a},l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l};var u;return n==="\\\\abovefrac"?u=this.callFunction(n,[s,e[t],o],[]):u=this.callFunction(n,[s,o],[]),[u]}else return e}handleSupSubscript(e){var t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();var i;do{var s;i=this.parseGroup(e)}while(((s=i)==null?void 0:s.type)==="internal");if(!i)throw new _("Expected group after '"+n+"'",t);return i}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});var i={type:"text",mode:this.mode,body:t},s={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return s}parseAtom(e){var t=this.parseGroup("atom",e);if(t?.type==="internal"||this.mode==="text")return t;for(var n,i;;){this.consumeSpaces();var s=this.fetch();if(s.text==="\\limits"||s.text==="\\nolimits"){if(t&&t.type==="op"){var o=s.text==="\\limits";t.limits=o,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=s.text==="\\limits");else throw new _("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(n)throw new _("Double superscript",s);n=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new _("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(n)throw new _("Double superscript",s);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:l}}else if(bo[s.text]){var u=tm.test(s.text),c=[];for(c.push(new Tt(bo[s.text])),this.consume();;){var d=this.fetch().text;if(!bo[d]||tm.test(d)!==u)break;c.unshift(new Tt(bo[d])),this.consume()}var f=this.subparse(c);u?i={type:"ordgroup",mode:"math",body:f}:n={type:"ordgroup",mode:"math",body:f}}else break}return n||i?{type:"supsub",mode:this.mode,base:t,sup:n,sub:i}:t}parseFunction(e,t){var n=this.fetch(),i=n.text,s=Zr[i];if(!s)return null;if(this.consume(),t&&t!=="atom"&&!s.allowedInArgument)throw new _("Got function '"+i+"' with no arguments"+(t?" as "+t:""),n);if(this.mode==="text"&&!s.allowedInText)throw new _("Can't use function '"+i+"' in text mode",n);if(this.mode==="math"&&s.allowedInMath===!1)throw new _("Can't use function '"+i+"' in math mode",n);var{args:o,optArgs:a}=this.parseArguments(i,s);return this.callFunction(i,o,a,n,e)}callFunction(e,t,n,i,s){var o={funcName:e,parser:this,token:i,breakOnTokenText:s},a=Zr[e];if(a&&a.handler)return a.handler(o,t,n);throw new _("No function handler for "+e)}parseArguments(e,t){var n=t.numArgs+t.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var i=[],s=[],o=0;o<n;o++){var a=t.argTypes&&t.argTypes[o],l=o<t.numOptionalArgs;(t.primitive&&a==null||t.type==="sqrt"&&o===1&&s[0]==null)&&(a="primitive");var u=this.parseGroupOfType("argument to '"+e+"'",a,l);if(l)s.push(u);else if(u!=null)i.push(u);else throw new _("Null argument, please report this as a bug")}return{args:i,optArgs:s}}parseGroupOfType(e,t,n){switch(t){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,t);case"hbox":{var i=this.parseArgumentGroup(n,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text"}:null}case"raw":{var s=this.parseStringGroup("raw",n);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(n)throw new _("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new _("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new _("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var n=this.gullet.scanArgument(t);if(n==null)return null;for(var i="",s;(s=this.fetch()).text!=="EOF";)i+=s.text,this.consume();return this.consume(),n.text=i,n}parseRegexGroup(e,t){for(var n=this.fetch(),i=n,s="",o;(o=this.fetch()).text!=="EOF"&&e.test(s+o.text);)i=o,s+=i.text,this.consume();if(s==="")throw new _("Invalid "+t+": '"+n.text+"'",n);return n.range(i,s)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new _("Invalid color: '"+t.text+"'",t);var i=n[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",n=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!i)throw new _("Invalid size: '"+t.text+"'",t);var s={number:+(i[1]+i[2]),unit:i[3]};if(!Lf(s))throw new _("Invalid unit: '"+s.unit+"'",t);return{type:"size",mode:this.mode,value:s,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(n==null)return null;var i=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:n.loc,body:s};return t&&this.switchMode(i),o}parseGroup(e,t){var n=this.fetch(),i=n.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:gt.range(n,l),body:a,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(t,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!em.hasOwnProperty(i)){if(this.settings.throwOnError)throw new _("Undefined control sequence: "+i,n);s=this.formatUnsupportedCmd(i),this.consume()}return s}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var i=e[n],s=i.text;s==="-"&&e[n+1].text==="-"&&(n+1<t&&e[n+2].text==="-"?(e.splice(n,3,{type:"textord",mode:"text",loc:gt.range(i,e[n+2]),text:"---"}),t-=2):(e.splice(n,2,{type:"textord",mode:"text",loc:gt.range(i,e[n+1]),text:"--"}),t-=1)),(s==="'"||s==="`")&&e[n+1].text===s&&(e.splice(n,2,{type:"textord",mode:"text",loc:gt.range(i,e[n+1]),text:s+s}),t-=1)}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),i=n.charAt(0)==="*";if(i&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new _(`\\verb assertion failed --
866
+ please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:i}}rm.hasOwnProperty(t[0])&&!Ne[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=rm[t[0]]+t.slice(1));var s=m8.exec(t);s&&(t=t.substring(0,s.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var o;if(Ne[this.mode][t]){this.settings.strict&&this.mode==="math"&&Ll.indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var a=Ne[this.mode][t].group,l=gt.range(e),u;if(ab.hasOwnProperty(a)){var c=a;u={type:"atom",mode:this.mode,family:c,loc:l,text:t}}else u={type:a,mode:this.mode,loc:l,text:t};o=u}else if(t.charCodeAt(0)>=128)this.settings.strict&&(Df(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),o={type:"textord",mode:"text",loc:gt.range(e),text:t};else return null;if(this.consume(),s)for(var d=0;d<s[0].length;d++){var f=s[0][d];if(!h0[f])throw new _("Unknown accent ' "+f+"'",e);var h=h0[f][this.mode]||h0[f].text;if(!h)throw new _("Accent "+f+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:gt.range(e),label:h,isStretchy:!1,isShifty:!0,base:o}}return o}}wo.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var f0=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new wo(e,t);delete n.gullet.macros.current["\\df@tag"];var i=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new _("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:n.subparse([new Tt("\\df@tag")])}]}return i},nm=function(e,t,n){t.textContent="";var i=p0(e,n).toNode();t.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),nm=function(){throw new _("KaTeX doesn't work in quirks mode.")});var w8=function(e,t){var n=p0(e,t).toMarkup();return n},x8=function(e,t){var n=new Ml(t);return f0(e,n)},im=function(e,t,n){if(n.throwOnError||!(e instanceof _))throw e;var i=P.makeSpan(["katex-error"],[new zt(t)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+n.errorColor),i},p0=function(e,t){var n=new Ml(t);try{var i=f0(e,n);return Nb(i,e,n)}catch(s){return im(s,e,n)}},S8=function(e,t){var n=new Ml(t);try{var i=f0(e,n);return Db(i,e,n)}catch(s){return im(s,e,n)}},k8="0.16.27",T8={Span:Pi,Anchor:Dl,SymbolNode:zt,SvgNode:gr,PathNode:Kr,LineNode:Il},jn={version:k8,render:nm,renderToString:w8,ParseError:_,SETTINGS_SCHEMA:Xs,__parse:x8,__renderToDomTree:p0,__renderToHTMLTree:S8,__setFontMetrics:Q7,__defineSymbol:p,__defineFunction:Y,__defineMacro:S,__domTree:T8};const M8=Ce.create({name:"m",content:"text*",group:"inline math",inline:!0,atom:!1,parseHTML(){return[{tag:"m"}]},renderHTML({HTMLAttributes:r}){return["span",be({class:"inlineMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("span");t.classList.add("node-view"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.innerHTML=jn.renderToString(s,{throwOnError:!1}),n.contentEditable="true",i.classList.add("edit-math"),i.classList.add("is-editable"),i.innerHTML="<m>"+r.textContent+"</m>",new MutationObserver(()=>{console.log("mutation observer"),n.innerHTML=jn.renderToString(r.textContent,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),t.append(n,i),{dom:t,contentDOM:i}}}}),C8=Ce.create({name:"me",content:"text*",group:"inline math",inline:!0,parseHTML(){return[{tag:"me"}]},renderHTML({HTMLAttributes:r}){return["div",be({class:"displayMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("div");t.classList.add("node-view"),t.classList.add("display"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.innerHTML=jn.renderToString(s,{throwOnError:!1}),n.contentEditable="false",i.classList.add("edit-math"),i.classList.add("is-editable"),i.innerHTML="<md>"+r.textContent+"</md>",new MutationObserver(()=>{console.log("mutation observer"),n.innerHTML=jn.renderToString(r.textContent,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),t.append(n,i),{dom:t,contentDOM:i}}}}),E8=Ce.create({name:"md",content:"text*",group:"inline math",inline:!0,parseHTML(){return[{tag:"md"}]},renderHTML({HTMLAttributes:r}){return["div",be({class:"displayMath"},r)]},addNodeView(){return({node:r,HTMLAttributes:e})=>{const t=document.createElement("div");t.classList.add("node-view"),t.classList.add("display"),Object.entries(e).forEach(([a,l])=>{t.setAttribute(a,l)});const n=document.createElement("span"),i=document.createElement("span"),s=r.textContent.trim();return n.innerHTML=jn.renderToString(s,{throwOnError:!1}),n.contentEditable="false",i.classList.add("edit-math"),i.classList.add("is-editable"),i.innerHTML="<md>"+r.textContent+"</md>",new MutationObserver(()=>{console.log("mutation observer"),n.innerHTML=jn.renderToString(r.textContent,{throwOnError:!1})}).observe(i,{characterData:!0,subtree:!0}),t.append(n,i),{dom:t,contentDOM:i}}}}),A8=Ce.create({name:"introduction",content:"(BasicBlock|block|rawptx)*",group:"division introduction",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"introduction"}]},renderHTML({HTMLAttributes:r}){return["article",be({class:"introduction",label:"introduction"},r),0]},addInputRules(){return[mt({find:new RegExp("^#intro\\s$"),type:this.type})]}}),O8=Ce.create({name:"chapter",content:"title ((introduction?|section+)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"chapter"}]},renderHTML({HTMLAttributes:r}){return["section",be({class:"chapter",ptxtag:"chapter"},r),0]},addInputRules(){return[mt({find:new RegExp("^#ch\\s$"),type:this.type})]}}),N8=Ce.create({name:"section",content:"title ((introduction?|subsection+)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:"section"}]},renderHTML({HTMLAttributes:r}){return["section",be({class:"section",ptxtag:"section"},r),0]},addInputRules(){return[mt({find:new RegExp("^#sec\\s$"),type:this.type})]}}),D8=Ce.create({name:"subsection",content:"title (BasicBlock|block|rawptx)+",group:"division",selectable:!1,draggable:!0,defining:!1,parseHTML(){return[{tag:"subsection"}]},addAttributes(){return{label:{default:null,parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")}}},renderHTML({HTMLAttributes:r}){return["section",be({class:"subsection",ptxtag:"subsection"},r),0]},addInputRules(){return[mt({find:new RegExp("^#subsec\\s$"),type:this.type})]}}),I8=Ce.create({name:"worksheet",content:"title? ((introduction?)|(BasicBlock|block|rawptx)+)",group:"division",selectable:!1,draggable:!0,defining:!1,parseHTML(){return[{tag:"worksheet"}]},addAttributes(){return{label:{default:null,parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")}}},renderHTML({HTMLAttributes:r}){return["section",be({class:"worksheet",ptxtag:"worksheet"},r),0]},addInputRules(){return[mt({find:new RegExp("^#ws\\s$"),type:this.type})]}}),R8=xe.create({name:"divisions",addExtensions(){return[A8,O8,N8,D8,I8]}});var P8=Ce.create({name:"text",group:"inline",parseMarkdown:r=>({type:"text",text:r.text||""}),renderMarkdown:r=>r.text||""}),z8=Ce.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:r}){return["br",be(this.options.HTMLAttributes,r)]},renderText(){return`
867
867
  `},renderMarkdown:()=>`
868
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:n})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=n.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&o){const d=l.filter(f=>a.includes(f.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});const L8=P8.extend({}),B8=z8.extend({}),F8=Oi.create({name:"term",group:"inline",parseHTML(){return[{tag:"term"}]},renderHTML({HTMLAttributes:r}){return["span",be({class:"term"},r),0]},addInputRules(){return[qr({find:/(?:^|\s)(<term>(.*?)<\/term>)$/,type:this.type}),qr({find:/(?:^|\s)(_(.*?)_)$/,type:this.type})]},addPasteRules(){return[qs({find:/(?:^|\s)(<term>(.*?)<\/term>)/g,type:this.type})]}}),$8=Oi.create({name:"em",group:"inline",parseHTML(){return[{tag:"em"}]},renderHTML({HTMLAttributes:r}){return["span",be({class:"em"},r),0]},addInputRules(){return[qr({find:/(?:^|\s)(<em>(.*?)<\/em>)$/,type:this.type}),qr({find:/(?:^|\s)(\*(.*?)\*)$/,type:this.type})]},addPasteRules(){return[qs({find:/(?:^|\s)(<em>(.*?)<\/em>)/g,type:this.type})]}}),H8=Oi.create({name:"alert",group:"inline",parseHTML(){return[{tag:"alert"}]},renderHTML({HTMLAttributes:r}){return["span",be({class:"alert"},r),0]},addInputRules(){return[qr({find:/(?:^|\s)(<alert>(.*?)<\/alert>)$/,type:this.type}),qr({find:/(?:^|\s)(\*\*(.*?)\*\*)$/,type:this.type})]},addPasteRules(){return[qs({find:/(?:^|\s)(<alert>(.*?)<\/alert>)/g,type:this.type})]}}),V8=Oi.create({name:"c",group:"inline",parseHTML(){return[{tag:"c"}]},renderHTML({HTMLAttributes:r}){return["span",be({class:"c"},r),0]},addInputRules(){return[qr({find:/(?:^|\s)(<c>(.*?)<\/c>)$/,type:this.type}),qr({find:/(?:^|\s)(\*\*(.*?)\*\*)$/,type:this.type})]},addPasteRules(){return[qs({find:/(?:^|\s)(<c>(.*?)<\/c>)/g,type:this.type})]}}),j8=xe.create({name:"myinline",addExtensions(){return[L8,B8,F8,$8,H8,V8]}}),$i=r=>{const e=r.node.type.name.charAt(0).toUpperCase()+r.node.type.name.slice(1);return Z.jsxs(ff,{className:"block-component",ptxtag:r.node.type.name,children:[Z.jsxs("div",{className:"block-title",children:[e,"."]}),Z.jsx(hf,{className:"thm-component-content"})]})},sm=()=>Z.jsxs(ff,{className:"proof",ptxtag:"proof",children:[Z.jsx("div",{className:"block-title",children:"Proof."}),Z.jsx(hf,{className:"thm-component-content"})]});var m0,om;function q8(){if(om)return m0;om=1;var r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,i=(C,x)=>{for(var I in x)r(C,I,{get:x[I],enumerable:!0})},s=(C,x,I,q)=>{if(x&&typeof x=="object"||typeof x=="function")for(let W of t(x))!n.call(C,W)&&W!==I&&r(C,W,{get:()=>x[W],enumerable:!(q=e(x,W))||q.enumerable});return C},o=C=>s(r({},"__esModule",{value:!0}),C),a={};i(a,{XmlCdata:()=>B,XmlComment:()=>L,XmlDeclaration:()=>V,XmlDocument:()=>ne,XmlDocumentType:()=>he,XmlElement:()=>te,XmlError:()=>re,XmlNode:()=>N,XmlProcessingInstruction:()=>G,XmlText:()=>D,parseXml:()=>Se}),m0=o(a);var l="",u=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,c=class{constructor(C){if(this.k=this.u(C,!0),this.d=0,this.length=C.length,this.l=this.k!==this.length,this.h=C,this.l){let x=[];for(let I=0,q=0;q<this.k;++q)x[q]=I,I+=C.codePointAt(I)>65535?2:1;this.A=x}}get B(){return this.d>=this.k}u(C,x=this.l){return x?C.replace(u,"_").length:C.length}p(C=1){this.d=Math.min(this.k,this.d+C)}f(C=this.d){var x;return this.l?(x=this.A[C])!=null?x:1/0:C}G(C=1){let x=this.m(C);return this.p(C),x}v(C){let x=this.f(),I=this.h.slice(x,x+C);return this.p(this.u(I)),I}w(C){let{length:x,l:I,h:q}=this,W=this.f(),fe=W;if(I)for(;fe<x;){let Le=q[fe],me=Le>="\uD800"&&Le<="\uDBFF";if(me&&(Le+=q[fe+1]),!C(Le))break;fe+=me?2:1}else for(;fe<x&&C(q[fe]);)++fe;return this.v(fe-W)}b(C){let{length:x}=C,I=this.f();return C===this.h.slice(I,I+x)?(this.p(x===1?1:this.u(C)),C):l}x(C){let x=this.h.slice(this.f()).search(C);return x>0?this.v(x):l}s(C){let x=this.f(),I=this.h.indexOf(C,x);return I>0?this.v(I-x):l}m(C=1){let{d:x,h:I}=this;return this.l?I.slice(this.f(x),this.f(x+C)):I.slice(x,x+C)}n(C=0){this.d=C>=0?Math.min(this.k,C):Math.max(0,this.d+C)}},d=/["&<]/,f=/['&<]/,h=/\r\n|[\n\r\t]/g,m=/<|&|]]>/,v=Object.freeze(Object.assign(Object.create(null),{amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}));function y(C){let x=C.codePointAt(0);return x>=97&&x<=122||x>=65&&x<=90||x>=48&&x<=57||x===45||x===46||x===183||x>=768&&x<=879||x===8255||x===8256||w(C,x)}function w(C,x=C.codePointAt(0)){return x>=97&&x<=122||x>=65&&x<=90||x===58||x===95||x>=192&&x<=214||x>=216&&x<=246||x>=248&&x<=767||x>=880&&x<=893||x>=895&&x<=8191||x===8204||x===8205||x>=8304&&x<=8591||x>=11264&&x<=12271||x>=12289&&x<=55295||x>=63744&&x<=64975||x>=65008&&x<=65533||x>=65536&&x<=983039}function k(C){return C==="#"||y(C)}function E(C){let x=C.codePointAt(0);return x===32||x===9||x===10||x===13}function R(C){return C>=32&&C<=55295||C===10||C===9||C===13||C>=57344&&C<=65533||C>=65536&&C<=1114111}var O=class M1{constructor(){this.parent=null,this.start=-1,this.end=-1}get document(){var x,I;return(I=(x=this.parent)==null?void 0:x.document)!=null?I:null}get isRootNode(){return this.parent!==null&&this.parent===this.document&&this.type===M1.TYPE_ELEMENT}get preserveWhitespace(){var x;return!!((x=this.parent)!=null&&x.preserveWhitespace)}get type(){return""}toJSON(){let x={type:this.type};return this.isRootNode&&(x.isRootNode=!0),this.preserveWhitespace&&(x.preserveWhitespace=!0),this.start!==-1&&(x.start=this.start,x.end=this.end),x}};O.TYPE_CDATA="cdata",O.TYPE_COMMENT="comment",O.TYPE_DOCUMENT="document",O.TYPE_DOCUMENT_TYPE="doctype",O.TYPE_ELEMENT="element",O.TYPE_PROCESSING_INSTRUCTION="pi",O.TYPE_TEXT="text",O.TYPE_XML_DECLARATION="xmldecl";var N=O,D=class extends N{constructor(C=""){super(),this.text=C}get type(){return N.TYPE_TEXT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{text:this.text})}},B=class extends D{get type(){return N.TYPE_CDATA}},L=class extends N{constructor(C=""){super(),this.content=C}get type(){return N.TYPE_COMMENT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{content:this.content})}},V=class extends N{constructor(C,x,I){super(),this.version=C,this.encoding=x??null,this.standalone=I??null}get type(){return N.TYPE_XML_DECLARATION}toJSON(){let C=N.prototype.toJSON.call(this);C.version=this.version;for(let x of["encoding","standalone"])this[x]!==null&&(C[x]=this[x]);return C}},te=class C1 extends N{constructor(x,I=Object.create(null),q=[]){super(),this.name=x,this.attributes=I,this.children=q}get isEmpty(){return this.children.length===0}get preserveWhitespace(){let x=this;for(;x instanceof C1;){if("xml:space"in x.attributes)return x.attributes["xml:space"]==="preserve";x=x.parent}return!1}get text(){return this.children.map(x=>"text"in x?x.text:"").join("")}get type(){return N.TYPE_ELEMENT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{name:this.name,attributes:this.attributes,children:this.children.map(x=>x.toJSON())})}},ne=class extends N{constructor(C=[]){super(),this.children=C}get document(){return this}get root(){for(let C of this.children)if(C instanceof te)return C;return null}get text(){return this.children.map(C=>"text"in C?C.text:"").join("")}get type(){return N.TYPE_DOCUMENT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{children:this.children.map(C=>C.toJSON())})}},he=class extends N{constructor(C,x,I,q){super(),this.name=C,this.publicId=x??null,this.systemId=I??null,this.internalSubset=q??null}get type(){return N.TYPE_DOCUMENT_TYPE}toJSON(){let C=N.prototype.toJSON.call(this);C.name=this.name;for(let x of["publicId","systemId","internalSubset"])this[x]!==null&&(C[x]=this[x]);return C}},re=class extends Error{constructor(C,x,I){let q=1,W="",fe=1;for(let Ue=0;Ue<x;++Ue){let At=I[Ue];At===`
869
- `?(q=1,W="",fe+=1):(q+=1,W+=At)}let Le=I.indexOf(`
870
- `,x);W+=Le===-1?I.slice(x):I.slice(x,Le);let me=0;W.length>50&&(q<40?W=W.slice(0,50):(me=q-20,W=W.slice(me,q+30))),super(`${C} (line ${fe}, column ${q})
868
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:n})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=n.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&o){const d=l.filter(f=>a.includes(f.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});const L8=P8.extend({}),B8=z8.extend({}),F8=Oi.create({name:"term",group:"inline",parseHTML(){return[{tag:"term"}]},renderHTML({HTMLAttributes:r}){return["span",be({class:"term"},r),0]},addInputRules(){return[jr({find:/(?:^|\s)(<term>(.*?)<\/term>)$/,type:this.type}),jr({find:/(?:^|\s)(_(.*?)_)$/,type:this.type})]},addPasteRules(){return[js({find:/(?:^|\s)(<term>(.*?)<\/term>)/g,type:this.type})]}}),$8=Oi.create({name:"em",group:"inline",parseHTML(){return[{tag:"em"}]},renderHTML({HTMLAttributes:r}){return["span",be({class:"em"},r),0]},addInputRules(){return[jr({find:/(?:^|\s)(<em>(.*?)<\/em>)$/,type:this.type}),jr({find:/(?:^|\s)(\*(.*?)\*)$/,type:this.type})]},addPasteRules(){return[js({find:/(?:^|\s)(<em>(.*?)<\/em>)/g,type:this.type})]}}),H8=Oi.create({name:"alert",group:"inline",parseHTML(){return[{tag:"alert"}]},renderHTML({HTMLAttributes:r}){return["span",be({class:"alert"},r),0]},addInputRules(){return[jr({find:/(?:^|\s)(<alert>(.*?)<\/alert>)$/,type:this.type}),jr({find:/(?:^|\s)(\*\*(.*?)\*\*)$/,type:this.type})]},addPasteRules(){return[js({find:/(?:^|\s)(<alert>(.*?)<\/alert>)/g,type:this.type})]}}),V8=Oi.create({name:"c",group:"inline",parseHTML(){return[{tag:"c"}]},renderHTML({HTMLAttributes:r}){return["span",be({class:"c"},r),0]},addInputRules(){return[jr({find:/(?:^|\s)(<c>(.*?)<\/c>)$/,type:this.type}),jr({find:/(?:^|\s)(\*\*(.*?)\*\*)$/,type:this.type})]},addPasteRules(){return[js({find:/(?:^|\s)(<c>(.*?)<\/c>)/g,type:this.type})]}}),_8=xe.create({name:"myinline",addExtensions(){return[L8,B8,F8,$8,H8,V8]}}),$i=r=>{const e=r.node.type.name.charAt(0).toUpperCase()+r.node.type.name.slice(1);return J.jsxs(ff,{className:"block-component",ptxtag:r.node.type.name,children:[J.jsxs("div",{className:"block-title",children:[e,"."]}),J.jsx(hf,{className:"thm-component-content"})]})},sm=()=>J.jsxs(ff,{className:"proof",ptxtag:"proof",children:[J.jsx("div",{className:"block-title",children:"Proof."}),J.jsx(hf,{className:"thm-component-content"})]});var m0,om;function j8(){if(om)return m0;om=1;var r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,i=(C,x)=>{for(var I in x)r(C,I,{get:x[I],enumerable:!0})},s=(C,x,I,j)=>{if(x&&typeof x=="object"||typeof x=="function")for(let W of t(x))!n.call(C,W)&&W!==I&&r(C,W,{get:()=>x[W],enumerable:!(j=e(x,W))||j.enumerable});return C},o=C=>s(r({},"__esModule",{value:!0}),C),a={};i(a,{XmlCdata:()=>B,XmlComment:()=>L,XmlDeclaration:()=>V,XmlDocument:()=>ne,XmlDocumentType:()=>he,XmlElement:()=>te,XmlError:()=>re,XmlNode:()=>N,XmlProcessingInstruction:()=>G,XmlText:()=>D,parseXml:()=>Se}),m0=o(a);var l="",u=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,c=class{constructor(C){if(this.k=this.u(C,!0),this.d=0,this.length=C.length,this.l=this.k!==this.length,this.h=C,this.l){let x=[];for(let I=0,j=0;j<this.k;++j)x[j]=I,I+=C.codePointAt(I)>65535?2:1;this.A=x}}get B(){return this.d>=this.k}u(C,x=this.l){return x?C.replace(u,"_").length:C.length}p(C=1){this.d=Math.min(this.k,this.d+C)}f(C=this.d){var x;return this.l?(x=this.A[C])!=null?x:1/0:C}G(C=1){let x=this.m(C);return this.p(C),x}v(C){let x=this.f(),I=this.h.slice(x,x+C);return this.p(this.u(I)),I}w(C){let{length:x,l:I,h:j}=this,W=this.f(),fe=W;if(I)for(;fe<x;){let Le=j[fe],me=Le>="\uD800"&&Le<="\uDBFF";if(me&&(Le+=j[fe+1]),!C(Le))break;fe+=me?2:1}else for(;fe<x&&C(j[fe]);)++fe;return this.v(fe-W)}b(C){let{length:x}=C,I=this.f();return C===this.h.slice(I,I+x)?(this.p(x===1?1:this.u(C)),C):l}x(C){let x=this.h.slice(this.f()).search(C);return x>0?this.v(x):l}s(C){let x=this.f(),I=this.h.indexOf(C,x);return I>0?this.v(I-x):l}m(C=1){let{d:x,h:I}=this;return this.l?I.slice(this.f(x),this.f(x+C)):I.slice(x,x+C)}n(C=0){this.d=C>=0?Math.min(this.k,C):Math.max(0,this.d+C)}},d=/["&<]/,f=/['&<]/,h=/\r\n|[\n\r\t]/g,m=/<|&|]]>/,v=Object.freeze(Object.assign(Object.create(null),{amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}));function y(C){let x=C.codePointAt(0);return x>=97&&x<=122||x>=65&&x<=90||x>=48&&x<=57||x===45||x===46||x===183||x>=768&&x<=879||x===8255||x===8256||w(C,x)}function w(C,x=C.codePointAt(0)){return x>=97&&x<=122||x>=65&&x<=90||x===58||x===95||x>=192&&x<=214||x>=216&&x<=246||x>=248&&x<=767||x>=880&&x<=893||x>=895&&x<=8191||x===8204||x===8205||x>=8304&&x<=8591||x>=11264&&x<=12271||x>=12289&&x<=55295||x>=63744&&x<=64975||x>=65008&&x<=65533||x>=65536&&x<=983039}function k(C){return C==="#"||y(C)}function E(C){let x=C.codePointAt(0);return x===32||x===9||x===10||x===13}function R(C){return C>=32&&C<=55295||C===10||C===9||C===13||C>=57344&&C<=65533||C>=65536&&C<=1114111}var O=class M1{constructor(){this.parent=null,this.start=-1,this.end=-1}get document(){var x,I;return(I=(x=this.parent)==null?void 0:x.document)!=null?I:null}get isRootNode(){return this.parent!==null&&this.parent===this.document&&this.type===M1.TYPE_ELEMENT}get preserveWhitespace(){var x;return!!((x=this.parent)!=null&&x.preserveWhitespace)}get type(){return""}toJSON(){let x={type:this.type};return this.isRootNode&&(x.isRootNode=!0),this.preserveWhitespace&&(x.preserveWhitespace=!0),this.start!==-1&&(x.start=this.start,x.end=this.end),x}};O.TYPE_CDATA="cdata",O.TYPE_COMMENT="comment",O.TYPE_DOCUMENT="document",O.TYPE_DOCUMENT_TYPE="doctype",O.TYPE_ELEMENT="element",O.TYPE_PROCESSING_INSTRUCTION="pi",O.TYPE_TEXT="text",O.TYPE_XML_DECLARATION="xmldecl";var N=O,D=class extends N{constructor(C=""){super(),this.text=C}get type(){return N.TYPE_TEXT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{text:this.text})}},B=class extends D{get type(){return N.TYPE_CDATA}},L=class extends N{constructor(C=""){super(),this.content=C}get type(){return N.TYPE_COMMENT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{content:this.content})}},V=class extends N{constructor(C,x,I){super(),this.version=C,this.encoding=x??null,this.standalone=I??null}get type(){return N.TYPE_XML_DECLARATION}toJSON(){let C=N.prototype.toJSON.call(this);C.version=this.version;for(let x of["encoding","standalone"])this[x]!==null&&(C[x]=this[x]);return C}},te=class C1 extends N{constructor(x,I=Object.create(null),j=[]){super(),this.name=x,this.attributes=I,this.children=j}get isEmpty(){return this.children.length===0}get preserveWhitespace(){let x=this;for(;x instanceof C1;){if("xml:space"in x.attributes)return x.attributes["xml:space"]==="preserve";x=x.parent}return!1}get text(){return this.children.map(x=>"text"in x?x.text:"").join("")}get type(){return N.TYPE_ELEMENT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{name:this.name,attributes:this.attributes,children:this.children.map(x=>x.toJSON())})}},ne=class extends N{constructor(C=[]){super(),this.children=C}get document(){return this}get root(){for(let C of this.children)if(C instanceof te)return C;return null}get text(){return this.children.map(C=>"text"in C?C.text:"").join("")}get type(){return N.TYPE_DOCUMENT}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{children:this.children.map(C=>C.toJSON())})}},he=class extends N{constructor(C,x,I,j){super(),this.name=C,this.publicId=x??null,this.systemId=I??null,this.internalSubset=j??null}get type(){return N.TYPE_DOCUMENT_TYPE}toJSON(){let C=N.prototype.toJSON.call(this);C.name=this.name;for(let x of["publicId","systemId","internalSubset"])this[x]!==null&&(C[x]=this[x]);return C}},re=class extends Error{constructor(C,x,I){let j=1,W="",fe=1;for(let Ue=0;Ue<x;++Ue){let At=I[Ue];At===`
869
+ `?(j=1,W="",fe+=1):(j+=1,W+=At)}let Le=I.indexOf(`
870
+ `,x);W+=Le===-1?I.slice(x):I.slice(x,Le);let me=0;W.length>50&&(j<40?W=W.slice(0,50):(me=j-20,W=W.slice(me,j+30))),super(`${C} (line ${fe}, column ${j})
871
871
  ${W}
872
- `+" ".repeat(q-me+1)+`^
873
- `),this.column=q,this.excerpt=W,this.line=fe,this.name="XmlError",this.pos=x}},G=class extends N{constructor(C,x=""){super(),this.name=C,this.content=x}get type(){return N.TYPE_PROCESSING_INSTRUCTION}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{name:this.name,content:this.content})}},X="",ve=class{constructor(C,x={}){let I=this.document=new ne;this.j=I,this.g=x,this.c=new c(C),this.g.includeOffsets&&(I.start=0,I.end=C.length),this.parse()}i(C,x){return C.parent=this.j,this.g.includeOffsets&&(C.start=this.c.f(x),C.end=this.c.f()),this.j.children.push(C),!0}y(C,x){let{children:I}=this.j,{length:q}=I;if(C=ee(C),q>0){let W=I[q-1];if(W?.type===N.TYPE_TEXT){let fe=W;return fe.text+=C,this.g.includeOffsets&&(fe.end=this.c.f()),!0}}return this.i(new D(C),x)}H(){let C=Object.create(null);for(;this.e();){let x=this.q();if(!x)break;let I=this.t()&&this.I();if(I===!1)throw this.a("Attribute value expected");if(x in C)throw this.a(`Duplicate attribute: ${x}`);if(x==="xml:space"&&I!=="default"&&I!=="preserve")throw this.a('Value of the `xml:space` attribute must be "default" or "preserve"');C[x]=I}if(this.g.sortAttributes){let x=Object.keys(C).sort(),I=Object.create(null);for(let q=0;q<x.length;++q){let W=x[q];I[W]=C[W]}C=I}return C}I(){let{c:C}=this,x=C.m();if(x!=='"'&&x!=="'")return!1;C.p();let I,q=!1,W=X,fe=x==='"'?d:f;e:for(;!C.B;)switch(I=C.x(fe),I&&(this.o(I),W+=I.replace(h," ")),C.m()){case x:q=!0;break e;case"&":W+=this.C();continue;case"<":throw this.a("Unescaped `<` is not allowed in an attribute value");default:break e}if(!q)throw this.a("Unclosed attribute");return C.p(),W}J(){let{c:C}=this,x=C.d;if(!C.b("<![CDATA["))return!1;let I=C.s("]]>");if(this.o(I),!C.b("]]>"))throw this.a("Unclosed CDATA section");return this.g.preserveCdata?this.i(new B(ee(I)),x):this.y(I,x)}K(){let{c:C}=this,x=C.d,I=C.x(m);if(!I)return!1;if(this.o(I),C.m(3)==="]]>")throw this.a("Element content may not contain the CDATA section close delimiter `]]>`");return this.y(I,x)}D(){let{c:C}=this,x=C.d;if(!C.b("<!--"))return!1;let I=C.s("--");if(this.o(I),!C.b("-->"))throw C.m(2)==="--"?this.a("The string `--` isn't allowed inside a comment"):this.a("Unclosed comment");return this.g.preserveComments?this.i(new L(ee(I)),x):!0}L(){let C=this.c.d,x=this.C();return x?this.y(x,C):!1}M(){let{c:C}=this,x=C.d;if(!C.b("<!DOCTYPE"))return!1;let I=this.e()&&this.q();if(!I)throw this.a("Expected a name");let q,W;if(this.e()){if(C.b("PUBLIC")){if(q=this.e()&&this.N(),q===!1)throw this.a("Expected a public identifier");this.e()}if(q!==void 0||C.b("SYSTEM")){if(this.e(),W=this.r(),W===!1)throw this.a("Expected a system identifier");this.e()}}let fe;if(C.b("[")){if(fe=C.x(/\][\x20\t\r\n]*>/),!C.b("]"))throw this.a("Unclosed internal subset");this.e()}if(!C.b(">"))throw this.a("Unclosed doctype declaration");return this.g.preserveDocumentType?this.i(new he(I,q,W,fe),x):!0}E(){let{c:C}=this,x=C.d;if(!C.b("<"))return!1;let I=this.q();if(!I)return C.n(x),!1;let q=this.H(),W=!!C.b("/>"),fe=new te(I,q);if(fe.parent=this.j,!W){if(!C.b(">"))throw this.a(`Unclosed start tag for element \`${I}\``);this.j=fe;do this.K();while(this.E()||this.L()||this.J()||this.F()||this.D());let Le=C.d,me;if(!C.b("</")||!(me=this.q())||me!==I)throw C.n(Le),this.a(`Missing end tag for element ${I}`);if(this.e(),!C.b(">"))throw this.a(`Unclosed end tag for element ${I}`);this.j=fe.parent}return this.i(fe,x)}t(){return this.e(),this.c.b("=")?(this.e(),!0):!1}z(){return this.D()||this.F()||this.e()}q(){return w(this.c.m())?this.c.w(y):X}F(){let{c:C}=this,x=C.d;if(!C.b("<?"))return!1;let I=this.q();if(I){if(I.toLowerCase()==="xml")throw C.n(x),this.a("XML declaration isn't allowed here")}else throw this.a("Invalid processing instruction");if(!this.e()){if(C.b("?>"))return this.i(new G(I),x);throw this.a("Whitespace is required after a processing instruction name")}let q=C.s("?>");if(this.o(q),!C.b("?>"))throw this.a("Unterminated processing instruction");return this.i(new G(I,ee(q)),x)}O(){let{c:C}=this,x=C.d;for(this.P();this.z(););if(this.M())for(;this.z(););return x<C.d}N(){let C=this.c.d,x=this.r();if(x!==!1&&!/^[-\x20\r\na-zA-Z0-9'()+,./:=?;!*#@$_%]*$/.test(x))throw this.c.n(C),this.a("Invalid character in public identifier");return x}C(){let{c:C}=this;if(!C.b("&"))return!1;let x=C.w(k);if(C.G()!==";")throw this.a("Unterminated reference (a reference must end with `;`)");let I;if(x[0]==="#"){let q=x[1]==="x"?parseInt(x.slice(2),16):parseInt(x.slice(1),10);if(isNaN(q))throw this.a("Invalid character reference");if(!R(q))throw this.a("Character reference resolves to an invalid character");I=String.fromCodePoint(q)}else if(I=v[x],I===void 0){let{ignoreUndefinedEntities:q,resolveUndefinedEntity:W}=this.g,fe=`&${x};`;if(W){let Le=W(fe);if(Le!=null){let me=typeof Le;if(me!=="string")throw new TypeError(`\`resolveUndefinedEntity()\` must return a string, \`null\`, or \`undefined\`, but returned a value of type ${me}`);return Le}}if(q)return fe;throw C.n(-fe.length),this.a(`Named entity isn't defined: ${fe}`)}return I}r(){let{c:C}=this,x=C.b('"')||C.b("'");if(!x)return!1;let I=C.s(x);if(this.o(I),!C.b(x))throw this.a("Missing end quote");return I}e(){return!!this.c.w(E)}P(){let{c:C}=this,x=C.d;if(!C.b("<?xml"))return!1;if(!this.e())throw this.a("Invalid XML declaration");let I=!!C.b("version")&&this.t()&&this.r();if(I===!1)throw this.a("XML version is missing or invalid");if(!/^1\.[0-9]+$/.test(I))throw this.a("Invalid character in version number");let q,W;if(this.e()){if(q=!!C.b("encoding")&&this.t()&&this.r(),q){if(!/^[A-Za-z][\w.-]*$/.test(q))throw this.a("Invalid character in encoding name");this.e()}if(W=!!C.b("standalone")&&this.t()&&this.r(),W){if(W!=="yes"&&W!=="no")throw this.a('Only "yes" and "no" are permitted as values of `standalone`');this.e()}}if(!C.b("?>"))throw this.a("Invalid or unclosed XML declaration");return this.g.preserveXmlDeclaration?this.i(new V(I,q||void 0,W||void 0),x):!0}a(C){let{c:x}=this;return new re(C,x.d,x.h)}parse(){if(this.c.b("\uFEFF"),this.O(),!this.E())throw this.a("Root element is missing or invalid");for(;this.z(););if(!this.c.B)throw this.a("Extra content at the end of the document")}o(C){let{length:x}=C;for(let I=0;I<x;++I){let q=C.codePointAt(I);if(!R(q))throw this.c.n(-([...C].length-I)),this.a("Invalid character");q>65535&&(I+=1)}}};function ee(C){let x=0;for(;(x=C.indexOf("\r",x))!==-1;)C=C[x+1]===`
872
+ `+" ".repeat(j-me+1)+`^
873
+ `),this.column=j,this.excerpt=W,this.line=fe,this.name="XmlError",this.pos=x}},G=class extends N{constructor(C,x=""){super(),this.name=C,this.content=x}get type(){return N.TYPE_PROCESSING_INSTRUCTION}toJSON(){return Object.assign(N.prototype.toJSON.call(this),{name:this.name,content:this.content})}},Z="",ve=class{constructor(C,x={}){let I=this.document=new ne;this.j=I,this.g=x,this.c=new c(C),this.g.includeOffsets&&(I.start=0,I.end=C.length),this.parse()}i(C,x){return C.parent=this.j,this.g.includeOffsets&&(C.start=this.c.f(x),C.end=this.c.f()),this.j.children.push(C),!0}y(C,x){let{children:I}=this.j,{length:j}=I;if(C=ee(C),j>0){let W=I[j-1];if(W?.type===N.TYPE_TEXT){let fe=W;return fe.text+=C,this.g.includeOffsets&&(fe.end=this.c.f()),!0}}return this.i(new D(C),x)}H(){let C=Object.create(null);for(;this.e();){let x=this.q();if(!x)break;let I=this.t()&&this.I();if(I===!1)throw this.a("Attribute value expected");if(x in C)throw this.a(`Duplicate attribute: ${x}`);if(x==="xml:space"&&I!=="default"&&I!=="preserve")throw this.a('Value of the `xml:space` attribute must be "default" or "preserve"');C[x]=I}if(this.g.sortAttributes){let x=Object.keys(C).sort(),I=Object.create(null);for(let j=0;j<x.length;++j){let W=x[j];I[W]=C[W]}C=I}return C}I(){let{c:C}=this,x=C.m();if(x!=='"'&&x!=="'")return!1;C.p();let I,j=!1,W=Z,fe=x==='"'?d:f;e:for(;!C.B;)switch(I=C.x(fe),I&&(this.o(I),W+=I.replace(h," ")),C.m()){case x:j=!0;break e;case"&":W+=this.C();continue;case"<":throw this.a("Unescaped `<` is not allowed in an attribute value");default:break e}if(!j)throw this.a("Unclosed attribute");return C.p(),W}J(){let{c:C}=this,x=C.d;if(!C.b("<![CDATA["))return!1;let I=C.s("]]>");if(this.o(I),!C.b("]]>"))throw this.a("Unclosed CDATA section");return this.g.preserveCdata?this.i(new B(ee(I)),x):this.y(I,x)}K(){let{c:C}=this,x=C.d,I=C.x(m);if(!I)return!1;if(this.o(I),C.m(3)==="]]>")throw this.a("Element content may not contain the CDATA section close delimiter `]]>`");return this.y(I,x)}D(){let{c:C}=this,x=C.d;if(!C.b("<!--"))return!1;let I=C.s("--");if(this.o(I),!C.b("-->"))throw C.m(2)==="--"?this.a("The string `--` isn't allowed inside a comment"):this.a("Unclosed comment");return this.g.preserveComments?this.i(new L(ee(I)),x):!0}L(){let C=this.c.d,x=this.C();return x?this.y(x,C):!1}M(){let{c:C}=this,x=C.d;if(!C.b("<!DOCTYPE"))return!1;let I=this.e()&&this.q();if(!I)throw this.a("Expected a name");let j,W;if(this.e()){if(C.b("PUBLIC")){if(j=this.e()&&this.N(),j===!1)throw this.a("Expected a public identifier");this.e()}if(j!==void 0||C.b("SYSTEM")){if(this.e(),W=this.r(),W===!1)throw this.a("Expected a system identifier");this.e()}}let fe;if(C.b("[")){if(fe=C.x(/\][\x20\t\r\n]*>/),!C.b("]"))throw this.a("Unclosed internal subset");this.e()}if(!C.b(">"))throw this.a("Unclosed doctype declaration");return this.g.preserveDocumentType?this.i(new he(I,j,W,fe),x):!0}E(){let{c:C}=this,x=C.d;if(!C.b("<"))return!1;let I=this.q();if(!I)return C.n(x),!1;let j=this.H(),W=!!C.b("/>"),fe=new te(I,j);if(fe.parent=this.j,!W){if(!C.b(">"))throw this.a(`Unclosed start tag for element \`${I}\``);this.j=fe;do this.K();while(this.E()||this.L()||this.J()||this.F()||this.D());let Le=C.d,me;if(!C.b("</")||!(me=this.q())||me!==I)throw C.n(Le),this.a(`Missing end tag for element ${I}`);if(this.e(),!C.b(">"))throw this.a(`Unclosed end tag for element ${I}`);this.j=fe.parent}return this.i(fe,x)}t(){return this.e(),this.c.b("=")?(this.e(),!0):!1}z(){return this.D()||this.F()||this.e()}q(){return w(this.c.m())?this.c.w(y):Z}F(){let{c:C}=this,x=C.d;if(!C.b("<?"))return!1;let I=this.q();if(I){if(I.toLowerCase()==="xml")throw C.n(x),this.a("XML declaration isn't allowed here")}else throw this.a("Invalid processing instruction");if(!this.e()){if(C.b("?>"))return this.i(new G(I),x);throw this.a("Whitespace is required after a processing instruction name")}let j=C.s("?>");if(this.o(j),!C.b("?>"))throw this.a("Unterminated processing instruction");return this.i(new G(I,ee(j)),x)}O(){let{c:C}=this,x=C.d;for(this.P();this.z(););if(this.M())for(;this.z(););return x<C.d}N(){let C=this.c.d,x=this.r();if(x!==!1&&!/^[-\x20\r\na-zA-Z0-9'()+,./:=?;!*#@$_%]*$/.test(x))throw this.c.n(C),this.a("Invalid character in public identifier");return x}C(){let{c:C}=this;if(!C.b("&"))return!1;let x=C.w(k);if(C.G()!==";")throw this.a("Unterminated reference (a reference must end with `;`)");let I;if(x[0]==="#"){let j=x[1]==="x"?parseInt(x.slice(2),16):parseInt(x.slice(1),10);if(isNaN(j))throw this.a("Invalid character reference");if(!R(j))throw this.a("Character reference resolves to an invalid character");I=String.fromCodePoint(j)}else if(I=v[x],I===void 0){let{ignoreUndefinedEntities:j,resolveUndefinedEntity:W}=this.g,fe=`&${x};`;if(W){let Le=W(fe);if(Le!=null){let me=typeof Le;if(me!=="string")throw new TypeError(`\`resolveUndefinedEntity()\` must return a string, \`null\`, or \`undefined\`, but returned a value of type ${me}`);return Le}}if(j)return fe;throw C.n(-fe.length),this.a(`Named entity isn't defined: ${fe}`)}return I}r(){let{c:C}=this,x=C.b('"')||C.b("'");if(!x)return!1;let I=C.s(x);if(this.o(I),!C.b(x))throw this.a("Missing end quote");return I}e(){return!!this.c.w(E)}P(){let{c:C}=this,x=C.d;if(!C.b("<?xml"))return!1;if(!this.e())throw this.a("Invalid XML declaration");let I=!!C.b("version")&&this.t()&&this.r();if(I===!1)throw this.a("XML version is missing or invalid");if(!/^1\.[0-9]+$/.test(I))throw this.a("Invalid character in version number");let j,W;if(this.e()){if(j=!!C.b("encoding")&&this.t()&&this.r(),j){if(!/^[A-Za-z][\w.-]*$/.test(j))throw this.a("Invalid character in encoding name");this.e()}if(W=!!C.b("standalone")&&this.t()&&this.r(),W){if(W!=="yes"&&W!=="no")throw this.a('Only "yes" and "no" are permitted as values of `standalone`');this.e()}}if(!C.b("?>"))throw this.a("Invalid or unclosed XML declaration");return this.g.preserveXmlDeclaration?this.i(new V(I,j||void 0,W||void 0),x):!0}a(C){let{c:x}=this;return new re(C,x.d,x.h)}parse(){if(this.c.b("\uFEFF"),this.O(),!this.E())throw this.a("Root element is missing or invalid");for(;this.z(););if(!this.c.B)throw this.a("Extra content at the end of the document")}o(C){let{length:x}=C;for(let I=0;I<x;++I){let j=C.codePointAt(I);if(!R(j))throw this.c.n(-([...C].length-I)),this.a("Invalid character");j>65535&&(I+=1)}}};function ee(C){let x=0;for(;(x=C.indexOf("\r",x))!==-1;)C=C[x+1]===`
874
874
  `?C.slice(0,x)+C.slice(x+1):C.slice(0,x)+`
875
- `+C.slice(x+1);return C}function Se(C,x){return new ve(C,x).document}return m0}var _8=q8();function W8(r){const e=String(r),t=[];return{toOffset:i,toPoint:n};function n(s){if(typeof s=="number"&&s>-1&&s<=e.length){let o=0;for(;;){let a=t[o];if(a===void 0){const l=am(e,t[o-1]);a=l===-1?e.length+1:l+1,t[o]=a}if(a>s)return{line:o+1,column:s-(o>0?t[o-1]:0)+1,offset:s};o++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;t.length<s.line;){const a=t[t.length-1],l=am(e,a),u=l===-1?e.length+1:l+1;if(a===u)break;t.push(u)}const o=(s.line>1?t[s.line-2]:0)+s.column-1;if(o<t[s.line-1])return o}}}function am(r,e){const t=r.indexOf("\r",e),n=r.indexOf(`
876
- `,e);return n===-1?t:t===-1||t+1===n?n:t<n?t:n}function U8(r){return!r||typeof r!="object"?"":"position"in r||"type"in r?lm(r.position):"start"in r||"end"in r?lm(r):"line"in r||"column"in r?g0(r):""}function g0(r){return um(r&&r.line)+":"+um(r&&r.column)}function lm(r){return g0(r&&r.start)+"-"+g0(r&&r.end)}function um(r){return r&&typeof r=="number"?r:1}class bt extends Error{constructor(e,t,n){super(),typeof t=="string"&&(n=t,t=void 0);let i="",s={},o=!1;if(t&&("line"in t&&"column"in t?s={place:t}:"start"in t&&"end"in t?s={place:t}:"type"in t?s={ancestors:[t],place:t.position}:s={...t}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?s.ruleId=n:(s.source=n.slice(0,l),s.ruleId=n.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=U8(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}bt.prototype.file="",bt.prototype.name="",bt.prototype.reason="",bt.prototype.message="",bt.prototype.stack="",bt.prototype.column=void 0,bt.prototype.line=void 0,bt.prototype.ancestors=void 0,bt.prototype.cause=void 0,bt.prototype.fatal=void 0,bt.prototype.place=void 0,bt.prototype.ruleId=void 0,bt.prototype.source=void 0;function G8(r){const e=W8(r);let t;try{t=_8.parseXml(String(r),{includeOffsets:!0,preserveCdata:!0,preserveComments:!0,preserveDocumentType:!0,preserveXmlDeclaration:!0})}catch(s){const o=s,a=e.toPoint(o.pos),l=new bt("Could not parse XML with `@rgrove/parse-xml`",{cause:o,place:a,ruleId:"error",source:"xast-util-from-xml"});throw l.fatal=!0,l.url="https://github.com/syntax-tree/xast-util-from-xml#throws",l}const n={location:e},i=J8(t,n);return dm(t,i,n),i}function K8(r){return{type:"cdata",value:r.text}}function Y8(r){return{type:"comment",value:r.content}}function J8(r,e){return{type:"root",children:cm(r.children,e)}}function X8(r){return{type:"doctype",name:r.name,public:r.publicId||void 0,system:r.systemId||void 0}}function Z8(r,e){const t=cm(r.children,e);return{type:"element",name:r.name,attributes:{...r.attributes},children:t}}function Q8(r){return{type:"instruction",name:r.name,value:r.content}}function e9(r){return{type:"text",value:r.text}}function t9(r){const e=[];return r.version&&e.push('version="'+r.version+'"'),r.encoding&&e.push('encoding="'+r.encoding+'"'),r.standalone&&e.push('standalone="'+r.standalone+'"'),{type:"instruction",name:"xml",value:e.join(" ")}}function cm(r,e){const t=[];let n=-1;for(;++n<r.length;){const i=r[n];let s;i.type==="cdata"?s=K8(i):i.type==="comment"?s=Y8(i):i.type==="doctype"?s=X8(i):i.type==="element"?s=Z8(i,e):i.type==="pi"?s=Q8(i):i.type==="text"?s=e9(i):i.type==="xmldecl"&&(s=t9(i)),s&&(dm(i,s,e),t.push(s))}return t}function dm(r,e,t){const n=r.start===-1?void 0:t.location.toPoint(r.start),i=r.end===-1?void 0:t.location.toPoint(r.end);n&&i&&(e.position={start:n,end:i})}const r9=/["&'<>`]/g,n9=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,i9=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,s9=/[|\\{}()[\]^$+*?.]/g,hm=new WeakMap;function o9(r,e){if(r=r.replace(e.subset?a9(e.subset):r9,n),e.subset||e.escapeOnly)return r;return r.replace(n9,t).replace(i9,n);function t(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function n(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function a9(r){let e=hm.get(r);return e||(e=l9(r),hm.set(r,e)),e}function l9(r){const e=[];let t=-1;for(;++t<r.length;)e.push(r[t].replace(s9,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function u9(r){return"&#x"+r.toString(16).toUpperCase()+";"}function c9(r,e){return o9(r,Object.assign({format:u9},e))}const d9=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function _n(r,e,t){const n=h9(r);return t?n.replace(t,i):i(n);function i(s){return c9(s,{subset:e})}}function h9(r){return String(r||"").replace(d9,"")}const f9=/]]>/g,p9=[">"];function m9(r){return"<![CDATA["+_n(r.value,p9,f9)+"]]>"}function g9(r){return"<!--"+_n(r.value,["-"])+"-->"}const v9=[" ",`
877
- `," ",'"',"&","'","/","<","=",">"];function xo(r){return _n(r,v9)}function fm(r,e){const t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=t.indexOf(e);for(;i!==-1;)n++,i=t.indexOf(e,i+e.length);return n}function v0(r,e){const t=String(r);let n=e.options.quote||'"';if(e.options.quoteSmart){const i=n==='"'?"'":'"';fm(t,n)>fm(t,i)&&(n=i)}return n+_n(t,["<","&",n])+n}function y9(r,e){const t=xo(r.name),n=r.public,i=r.system;let s="<!DOCTYPE";return t!==""&&(s+=" "+t),n?s+=" PUBLIC "+v0(n,e):i&&(s+=" SYSTEM"),i&&(s+=" "+v0(i,e)),s+">"}const b9={}.hasOwnProperty;function w9(r,e){const t=xo(r.name),n=vm(r,e),i=r.attributes||{},s=n?!1:e.options.closeEmptyElements,o=[];let a;for(a in i)if(b9.call(i,a)){const l=i[a];l!=null&&o.push(xo(a)+"="+v0(l,e))}return"<"+t+(o.length===0?"":" "+o.join(" "))+(s?(e.options.tightClose?"":" ")+"/":"")+">"+n+(s?"":"</"+t+">")}const x9=/\?>/g,S9=[">"];function k9(r){const e=xo(r.name)||"x",t=_n(r.value,S9,x9);return"<?"+e+(t?" "+t:"")+"?>"}const T9=["&","<"];function pm(r){return _n(r.value,T9)}function M9(r,e){return e.options.allowDangerousXml?r.value:pm(r)}const C9={}.hasOwnProperty,mm={cdata:m9,comment:g9,doctype:y9,element:w9,instruction:k9,raw:M9,root:vm,text:pm};function gm(r,e){const t=r&&r.type;if(!t)throw new Error("Expected node, not `"+r+"`");if(!C9.call(mm,t))throw new Error("Cannot compile unknown node `"+t+"`");const n=mm[t];return n(r,e)}function vm(r,e){const t=r&&r.children||[];let n=-1;const i=[];for(;++n<t.length;)i[n]=gm(t[n],e);return i.join("")}function ym(r,e){const t={options:{}};if(typeof t.options.quote=="string"&&t.options.quote!=='"'&&t.options.quote!=="'")throw new Error("Invalid quote `"+t.options.quote+"`, expected `'` or `\"`");const n=Array.isArray(r)?{type:"root",children:r}:r;return gm(n,t)}const bm=(function(r){if(r==null)return N9;if(typeof r=="function")return So(r);if(typeof r=="object")return Array.isArray(r)?E9(r):A9(r);if(typeof r=="string")return O9(r);throw new Error("Expected function, string, or object as test")});function E9(r){const e=[];let t=-1;for(;++t<r.length;)e[t]=bm(r[t]);return So(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function A9(r){const e=r;return So(t);function t(n){const i=n;let s;for(s in r)if(i[s]!==e[s])return!1;return!0}}function O9(r){return So(e);function e(t){return t&&t.type===r}}function So(r){return e;function e(t,n,i){return!!(D9(t)&&r.call(this,t,typeof n=="number"?n:void 0,i||void 0))}}function N9(){return!0}function D9(r){return r!==null&&typeof r=="object"&&"type"in r}function Bx(r){return r}const wm=[],I9=!0,xm=!1,Sm="skip";function R9(r,e,t,n){let i;typeof e=="function"&&typeof t!="function"?(n=t,t=e):i=e;const s=bm(i),o=n?-1:1;a(r,void 0,[])();function a(l,u,c){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const h=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(h?"<"+h+">":""))+")"})}return f;function f(){let h=wm,m,v,y;if((!e||s(l,u,c[c.length-1]||void 0))&&(h=P9(t(l,c)),h[0]===xm))return h;if("children"in l&&l.children){const w=l;if(w.children&&h[0]!==Sm)for(v=(n?w.children.length:-1)+o,y=c.concat(w);v>-1&&v<w.children.length;){const k=w.children[v];if(m=a(k,v,y)(),m[0]===xm)return m;v=typeof m[1]=="number"?m[1]:v+o}}return h}}}function P9(r){return Array.isArray(r)?r:typeof r=="number"?[I9,r]:r==null?wm:[r]}function z9(r,e,t,n){let i,s,o;typeof e=="function"&&typeof t!="function"?(s=void 0,o=e,i=t):(s=e,o=t,i=n),R9(r,s,a,i);function a(l,u){const c=u[u.length-1],d=c?c.children.indexOf(l):void 0;return o(l,d,c)}}const L9=["theorem","lemma","corollary","proposition","claim","fact","proof"],B9=["convention","insight","note","observation","remark","warning"],F9=["assumption","axiom","conjecture","heuristic","hypothesis","principle"],$9=["introduction","chapter","section","subsection","worksheet"],H9=["example","question","problem"],V9=["solution","answer","hint"],j9=["p","m","me","md","ol","ul","li",...$9,"title","definition","statement",...L9,...F9,...B9,...H9,...V9,"term","em","alert","c","pre"];function q9(r){const e=G8(r);return console.log("xast before: ",e),z9(e,(n,i,s)=>{if(n.type==="element"&&!j9.includes(n.name)){const o={type:"element",name:"rawptx",attributes:{},children:[{type:"text",value:ym(n)}]};return typeof i!="number"||!s?void 0:(s.children.splice(i,1,o),Sm)}}),console.log("xast after: ",e),ym(e)}function _9(){return{label:{parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")},component:{parseHTML:r=>r.getAttribute("component")}}}function Sr(r,e){return[mt({find:new RegExp(`^#${r}\\s$`,"i"),type:e}),mt({find:new RegExp(`(?:^)(<${r}>(\\s))$`,"i"),type:e}),mt({find:new RegExp(`(?:^)(${r}:(\\s))$`,"i"),type:e})]}const W9=["theorem","lemma","corollary","proposition","claim","fact"],U9=xe.create({name:"theoremLike",addExtensions(){const r=[];for(const e of W9)r.push(Ce.create({name:e,content:"title? statement proof*",group:"block theoremLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return _9()},renderHTML({HTMLAttributes:t}){return["article",be({class:`${e} theorem-like`,ptxtag:e},t)]},addNodeView(){return bn($i)},addInputRules(){return Sr(e,this.type)}}));return r.push(Ce.create({name:"proof",content:"title? BasicBlock+",group:"block",selectable:!0,draggable:!0,parseHTML(){return[{tag:"proof"}]},renderHTML({HTMLAttributes:e}){return["article",be({class:"proof",ptxtag:"proof"},e),0]},addNodeView(){return bn(sm)},addInputRules(){return Sr("proof",this.type)}})),r}}),G9=["assumption","axiom","conjecture","heuristic","hypothesis","principle"],K9=xe.create({name:"axiomLike",addExtensions(){const r=[];for(const e of G9)r.push(Ce.create({name:e,content:"title? statement",group:"block axiomLike",selectable:!0,draggable:!0,parseHTML(){return[{tag:e}]},renderHTML({HTMLAttributes:t}){return["article",be({class:`${e} axiom-like`,label:e},t),0]},addNodeView(){return bn($i)},addInputRules(){return Sr(e,this.type)}}));return r}}),Y9=Ce.create({name:"statement",content:"BasicBlock+",group:"blockContent",parseHTML(){return[{tag:"statement"}]},renderHTML(){return["div",{class:"statement",ptxtag:"statement"},0]},addInputRules(){return Sr("statement",this.type)}}),J9=["example","question","problem"],X9=xe.create({name:"exampleLike",addExtensions(){const r=[];for(const e of J9)r.push(Ce.create({name:e,content:"title? (BasicBlock*|(statement hint* answer* solution*))",group:"block exampleLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return{label:{parseHTML:t=>t.getAttribute("label")},"xml:id":{parseHTML:t=>t.getAttribute("xml:id")},component:{parseHTML:t=>t.getAttribute("component")}}},renderHTML({HTMLAttributes:t}){return["article",be({class:`${e} theorem-like`,ptxtag:e},t)]},addNodeView(){return bn($i)},addInputRules(){return Sr(e,this.type)}}));for(const e of["hint","answer","solution"])r.push(Ce.create({name:e,content:"title? BasicBlock+",group:"block solutionLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return{label:{parseHTML:t=>t.getAttribute("label")},"xml:id":{parseHTML:t=>t.getAttribute("xml:id")},component:{parseHTML:t=>t.getAttribute("component")}}},renderHTML({HTMLAttributes:t}){return["article",be({class:"proof",ptxtag:"proof"},t),0]},addNodeView(){return bn(sm)},addInputRules(){return Sr("proof",this.type)}}));return r}}),Z9=["convention","insight","note","observation","remark","warning"],Q9=xe.create({name:"remarkLike",addExtensions(){return Z9.map(r=>Ce.create({name:r,content:"title? BasicBlock+",group:"block remarkLike",selectable:!0,draggable:!0,parseHTML(){return[{tag:r}]},renderHTML({HTMLAttributes:e}){return["article",be({class:`${r} remark-like`,label:r},e),0]},addNodeView(){return bn($i)},addInputRules(){return Sr(r,this.type)}}))}}),ew=Ce.create({name:"p",content:"inline*",group:"BasicBlock paragraph",draggable:!0,defining:!1,priority:1e3,parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["div",be({class:"p",ptxtag:"p"},r),0]},addInputRules(){return[mt({find:new RegExp("^#p\\s$"),type:this.type})]}}),tw=xe.create({name:"blocks",addExtensions(){return[ew,U9,X9,K9,Q9,Y9]}});var y0=4,rw=/^```([a-z]+)?[\s\n]$/,nw=/^~~~([a-z]+)?[\s\n]$/,iw=Ce.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:y0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:r=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=r.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:r,HTMLAttributes:e}){return["pre",be(this.options.HTMLAttributes,e),["code",{class:r.attrs.language?this.options.languageClassPrefix+r.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(r,e)=>{var t;return((t=r.raw)==null?void 0:t.startsWith("```"))===!1&&r.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:r.lang||null},r.text?[e.createTextNode(r.text)]:[])},renderMarkdown:(r,e)=>{var t;let n="";const i=((t=r.attrs)==null?void 0:t.language)||"";return r.content?n=[`\`\`\`${i}`,e.renderChildren(r.content),"```"].join(`
875
+ `+C.slice(x+1);return C}function Se(C,x){return new ve(C,x).document}return m0}var q8=j8();function W8(r){const e=String(r),t=[];return{toOffset:i,toPoint:n};function n(s){if(typeof s=="number"&&s>-1&&s<=e.length){let o=0;for(;;){let a=t[o];if(a===void 0){const l=am(e,t[o-1]);a=l===-1?e.length+1:l+1,t[o]=a}if(a>s)return{line:o+1,column:s-(o>0?t[o-1]:0)+1,offset:s};o++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;t.length<s.line;){const a=t[t.length-1],l=am(e,a),u=l===-1?e.length+1:l+1;if(a===u)break;t.push(u)}const o=(s.line>1?t[s.line-2]:0)+s.column-1;if(o<t[s.line-1])return o}}}function am(r,e){const t=r.indexOf("\r",e),n=r.indexOf(`
876
+ `,e);return n===-1?t:t===-1||t+1===n?n:t<n?t:n}function U8(r){return!r||typeof r!="object"?"":"position"in r||"type"in r?lm(r.position):"start"in r||"end"in r?lm(r):"line"in r||"column"in r?g0(r):""}function g0(r){return um(r&&r.line)+":"+um(r&&r.column)}function lm(r){return g0(r&&r.start)+"-"+g0(r&&r.end)}function um(r){return r&&typeof r=="number"?r:1}class bt extends Error{constructor(e,t,n){super(),typeof t=="string"&&(n=t,t=void 0);let i="",s={},o=!1;if(t&&("line"in t&&"column"in t?s={place:t}:"start"in t&&"end"in t?s={place:t}:"type"in t?s={ancestors:[t],place:t.position}:s={...t}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?s.ruleId=n:(s.source=n.slice(0,l),s.ruleId=n.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=U8(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}bt.prototype.file="",bt.prototype.name="",bt.prototype.reason="",bt.prototype.message="",bt.prototype.stack="",bt.prototype.column=void 0,bt.prototype.line=void 0,bt.prototype.ancestors=void 0,bt.prototype.cause=void 0,bt.prototype.fatal=void 0,bt.prototype.place=void 0,bt.prototype.ruleId=void 0,bt.prototype.source=void 0;function G8(r){const e=W8(r);let t;try{t=q8.parseXml(String(r),{includeOffsets:!0,preserveCdata:!0,preserveComments:!0,preserveDocumentType:!0,preserveXmlDeclaration:!0})}catch(s){const o=s,a=e.toPoint(o.pos),l=new bt("Could not parse XML with `@rgrove/parse-xml`",{cause:o,place:a,ruleId:"error",source:"xast-util-from-xml"});throw l.fatal=!0,l.url="https://github.com/syntax-tree/xast-util-from-xml#throws",l}const n={location:e},i=J8(t,n);return dm(t,i,n),i}function K8(r){return{type:"cdata",value:r.text}}function Y8(r){return{type:"comment",value:r.content}}function J8(r,e){return{type:"root",children:cm(r.children,e)}}function X8(r){return{type:"doctype",name:r.name,public:r.publicId||void 0,system:r.systemId||void 0}}function Z8(r,e){const t=cm(r.children,e);return{type:"element",name:r.name,attributes:{...r.attributes},children:t}}function Q8(r){return{type:"instruction",name:r.name,value:r.content}}function e9(r){return{type:"text",value:r.text}}function t9(r){const e=[];return r.version&&e.push('version="'+r.version+'"'),r.encoding&&e.push('encoding="'+r.encoding+'"'),r.standalone&&e.push('standalone="'+r.standalone+'"'),{type:"instruction",name:"xml",value:e.join(" ")}}function cm(r,e){const t=[];let n=-1;for(;++n<r.length;){const i=r[n];let s;i.type==="cdata"?s=K8(i):i.type==="comment"?s=Y8(i):i.type==="doctype"?s=X8(i):i.type==="element"?s=Z8(i,e):i.type==="pi"?s=Q8(i):i.type==="text"?s=e9(i):i.type==="xmldecl"&&(s=t9(i)),s&&(dm(i,s,e),t.push(s))}return t}function dm(r,e,t){const n=r.start===-1?void 0:t.location.toPoint(r.start),i=r.end===-1?void 0:t.location.toPoint(r.end);n&&i&&(e.position={start:n,end:i})}const r9=/["&'<>`]/g,n9=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,i9=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,s9=/[|\\{}()[\]^$+*?.]/g,hm=new WeakMap;function o9(r,e){if(r=r.replace(e.subset?a9(e.subset):r9,n),e.subset||e.escapeOnly)return r;return r.replace(n9,t).replace(i9,n);function t(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function n(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function a9(r){let e=hm.get(r);return e||(e=l9(r),hm.set(r,e)),e}function l9(r){const e=[];let t=-1;for(;++t<r.length;)e.push(r[t].replace(s9,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}function u9(r){return"&#x"+r.toString(16).toUpperCase()+";"}function c9(r,e){return o9(r,Object.assign({format:u9},e))}const d9=/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;function qn(r,e,t){const n=h9(r);return t?n.replace(t,i):i(n);function i(s){return c9(s,{subset:e})}}function h9(r){return String(r||"").replace(d9,"")}const f9=/]]>/g,p9=[">"];function m9(r){return"<![CDATA["+qn(r.value,p9,f9)+"]]>"}function g9(r){return"<!--"+qn(r.value,["-"])+"-->"}const v9=[" ",`
877
+ `," ",'"',"&","'","/","<","=",">"];function xo(r){return qn(r,v9)}function fm(r,e){const t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=t.indexOf(e);for(;i!==-1;)n++,i=t.indexOf(e,i+e.length);return n}function v0(r,e){const t=String(r);let n=e.options.quote||'"';if(e.options.quoteSmart){const i=n==='"'?"'":'"';fm(t,n)>fm(t,i)&&(n=i)}return n+qn(t,["<","&",n])+n}function y9(r,e){const t=xo(r.name),n=r.public,i=r.system;let s="<!DOCTYPE";return t!==""&&(s+=" "+t),n?s+=" PUBLIC "+v0(n,e):i&&(s+=" SYSTEM"),i&&(s+=" "+v0(i,e)),s+">"}const b9={}.hasOwnProperty;function w9(r,e){const t=xo(r.name),n=vm(r,e),i=r.attributes||{},s=n?!1:e.options.closeEmptyElements,o=[];let a;for(a in i)if(b9.call(i,a)){const l=i[a];l!=null&&o.push(xo(a)+"="+v0(l,e))}return"<"+t+(o.length===0?"":" "+o.join(" "))+(s?(e.options.tightClose?"":" ")+"/":"")+">"+n+(s?"":"</"+t+">")}const x9=/\?>/g,S9=[">"];function k9(r){const e=xo(r.name)||"x",t=qn(r.value,S9,x9);return"<?"+e+(t?" "+t:"")+"?>"}const T9=["&","<"];function pm(r){return qn(r.value,T9)}function M9(r,e){return e.options.allowDangerousXml?r.value:pm(r)}const C9={}.hasOwnProperty,mm={cdata:m9,comment:g9,doctype:y9,element:w9,instruction:k9,raw:M9,root:vm,text:pm};function gm(r,e){const t=r&&r.type;if(!t)throw new Error("Expected node, not `"+r+"`");if(!C9.call(mm,t))throw new Error("Cannot compile unknown node `"+t+"`");const n=mm[t];return n(r,e)}function vm(r,e){const t=r&&r.children||[];let n=-1;const i=[];for(;++n<t.length;)i[n]=gm(t[n],e);return i.join("")}function ym(r,e){const t={options:{}};if(typeof t.options.quote=="string"&&t.options.quote!=='"'&&t.options.quote!=="'")throw new Error("Invalid quote `"+t.options.quote+"`, expected `'` or `\"`");const n=Array.isArray(r)?{type:"root",children:r}:r;return gm(n,t)}const bm=(function(r){if(r==null)return N9;if(typeof r=="function")return So(r);if(typeof r=="object")return Array.isArray(r)?E9(r):A9(r);if(typeof r=="string")return O9(r);throw new Error("Expected function, string, or object as test")});function E9(r){const e=[];let t=-1;for(;++t<r.length;)e[t]=bm(r[t]);return So(n);function n(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function A9(r){const e=r;return So(t);function t(n){const i=n;let s;for(s in r)if(i[s]!==e[s])return!1;return!0}}function O9(r){return So(e);function e(t){return t&&t.type===r}}function So(r){return e;function e(t,n,i){return!!(D9(t)&&r.call(this,t,typeof n=="number"?n:void 0,i||void 0))}}function N9(){return!0}function D9(r){return r!==null&&typeof r=="object"&&"type"in r}function Bx(r){return r}const wm=[],I9=!0,xm=!1,Sm="skip";function R9(r,e,t,n){let i;typeof e=="function"&&typeof t!="function"?(n=t,t=e):i=e;const s=bm(i),o=n?-1:1;a(r,void 0,[])();function a(l,u,c){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const h=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(h?"<"+h+">":""))+")"})}return f;function f(){let h=wm,m,v,y;if((!e||s(l,u,c[c.length-1]||void 0))&&(h=P9(t(l,c)),h[0]===xm))return h;if("children"in l&&l.children){const w=l;if(w.children&&h[0]!==Sm)for(v=(n?w.children.length:-1)+o,y=c.concat(w);v>-1&&v<w.children.length;){const k=w.children[v];if(m=a(k,v,y)(),m[0]===xm)return m;v=typeof m[1]=="number"?m[1]:v+o}}return h}}}function P9(r){return Array.isArray(r)?r:typeof r=="number"?[I9,r]:r==null?wm:[r]}function z9(r,e,t,n){let i,s,o;typeof e=="function"&&typeof t!="function"?(s=void 0,o=e,i=t):(s=e,o=t,i=n),R9(r,s,a,i);function a(l,u){const c=u[u.length-1],d=c?c.children.indexOf(l):void 0;return o(l,d,c)}}const L9=["theorem","lemma","corollary","proposition","claim","fact","proof"],B9=["convention","insight","note","observation","remark","warning"],F9=["assumption","axiom","conjecture","heuristic","hypothesis","principle"],$9=["introduction","chapter","section","subsection","worksheet"],H9=["example","question","problem"],V9=["solution","answer","hint"],_9=["p","m","me","md","ol","ul","li",...$9,"title","definition","statement",...L9,...F9,...B9,...H9,...V9,"term","em","alert","c","pre"];function j9(r){const e=G8(r);return console.log("xast before: ",e),z9(e,(n,i,s)=>{if(n.type==="element"&&!_9.includes(n.name)){const o={type:"element",name:"rawptx",attributes:{},children:[{type:"text",value:ym(n)}]};return typeof i!="number"||!s?void 0:(s.children.splice(i,1,o),Sm)}}),console.log("xast after: ",e),ym(e)}function q9(){return{label:{parseHTML:r=>r.getAttribute("label")},"xml:id":{parseHTML:r=>r.getAttribute("xml:id")},component:{parseHTML:r=>r.getAttribute("component")}}}function Sr(r,e){return[mt({find:new RegExp(`^#${r}\\s$`,"i"),type:e}),mt({find:new RegExp(`(?:^)(<${r}>(\\s))$`,"i"),type:e}),mt({find:new RegExp(`(?:^)(${r}:(\\s))$`,"i"),type:e})]}const W9=["theorem","lemma","corollary","proposition","claim","fact"],U9=xe.create({name:"theoremLike",addExtensions(){const r=[];for(const e of W9)r.push(Ce.create({name:e,content:"title? statement proof*",group:"block theoremLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return q9()},renderHTML({HTMLAttributes:t}){return["article",be({class:`${e} theorem-like`,ptxtag:e},t)]},addNodeView(){return bn($i)},addInputRules(){return Sr(e,this.type)}}));return r.push(Ce.create({name:"proof",content:"title? BasicBlock+",group:"block",selectable:!0,draggable:!0,parseHTML(){return[{tag:"proof"}]},renderHTML({HTMLAttributes:e}){return["article",be({class:"proof",ptxtag:"proof"},e),0]},addNodeView(){return bn(sm)},addInputRules(){return Sr("proof",this.type)}})),r}}),G9=["assumption","axiom","conjecture","heuristic","hypothesis","principle"],K9=xe.create({name:"axiomLike",addExtensions(){const r=[];for(const e of G9)r.push(Ce.create({name:e,content:"title? statement",group:"block axiomLike",selectable:!0,draggable:!0,parseHTML(){return[{tag:e}]},renderHTML({HTMLAttributes:t}){return["article",be({class:`${e} axiom-like`,label:e},t),0]},addNodeView(){return bn($i)},addInputRules(){return Sr(e,this.type)}}));return r}}),Y9=Ce.create({name:"statement",content:"BasicBlock+",group:"blockContent",parseHTML(){return[{tag:"statement"}]},renderHTML(){return["div",{class:"statement",ptxtag:"statement"},0]},addInputRules(){return Sr("statement",this.type)}}),J9=["example","question","problem"],X9=xe.create({name:"exampleLike",addExtensions(){const r=[];for(const e of J9)r.push(Ce.create({name:e,content:"title? (BasicBlock*|(statement hint* answer* solution*))",group:"block exampleLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return{label:{parseHTML:t=>t.getAttribute("label")},"xml:id":{parseHTML:t=>t.getAttribute("xml:id")},component:{parseHTML:t=>t.getAttribute("component")}}},renderHTML({HTMLAttributes:t}){return["article",be({class:`${e} theorem-like`,ptxtag:e},t)]},addNodeView(){return bn($i)},addInputRules(){return Sr(e,this.type)}}));for(const e of["hint","answer","solution"])r.push(Ce.create({name:e,content:"title? BasicBlock+",group:"block solutionLike",selectable:!0,draggable:!0,defining:!1,parseHTML(){return[{tag:e}]},addAttributes(){return{label:{parseHTML:t=>t.getAttribute("label")},"xml:id":{parseHTML:t=>t.getAttribute("xml:id")},component:{parseHTML:t=>t.getAttribute("component")}}},renderHTML({HTMLAttributes:t}){return["article",be({class:"proof",ptxtag:"proof"},t),0]},addNodeView(){return bn(sm)},addInputRules(){return Sr("proof",this.type)}}));return r}}),Z9=["convention","insight","note","observation","remark","warning"],Q9=xe.create({name:"remarkLike",addExtensions(){return Z9.map(r=>Ce.create({name:r,content:"title? BasicBlock+",group:"block remarkLike",selectable:!0,draggable:!0,parseHTML(){return[{tag:r}]},renderHTML({HTMLAttributes:e}){return["article",be({class:`${r} remark-like`,label:r},e),0]},addNodeView(){return bn($i)},addInputRules(){return Sr(r,this.type)}}))}}),ew=Ce.create({name:"p",content:"inline*",group:"BasicBlock paragraph",draggable:!0,defining:!1,priority:1e3,parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["div",be({class:"p",ptxtag:"p"},r),0]},addInputRules(){return[mt({find:new RegExp("^#p\\s$"),type:this.type})]}}),tw=xe.create({name:"blocks",addExtensions(){return[ew,U9,X9,K9,Q9,Y9]}});var y0=4,rw=/^```([a-z]+)?[\s\n]$/,nw=/^~~~([a-z]+)?[\s\n]$/,iw=Ce.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:y0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:r=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=r.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:r,HTMLAttributes:e}){return["pre",be(this.options.HTMLAttributes,e),["code",{class:r.attrs.language?this.options.languageClassPrefix+r.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(r,e)=>{var t;return((t=r.raw)==null?void 0:t.startsWith("```"))===!1&&r.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:r.lang||null},r.text?[e.createTextNode(r.text)]:[])},renderMarkdown:(r,e)=>{var t;let n="";const i=((t=r.attrs)==null?void 0:t.language)||"";return r.content?n=[`\`\`\`${i}`,e.renderChildren(r.content),"```"].join(`
878
878
  `):n=`\`\`\`${i}
879
879
 
880
880
  \`\`\``,n},addCommands(){return{setCodeBlock:r=>({commands:e})=>e.setNode(this.name,r),toggleCodeBlock:r=>({commands:e})=>e.toggleNode(this.name,"paragraph",r)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:r,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!r||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:r})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:y0,{state:n}=r,{selection:i}=n,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?r.commands.insertContent(a):r.commands.command(({tr:l})=>{const{from:u,to:c}=i,h=n.doc.textBetween(u,c,`
@@ -897,7 +897,7 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
897
897
  `;for(const i of r.content)e=e+b0(i);e=e+`
898
898
  </`+t+`>
899
899
  `}}else if(r.type==="text")if(r.marks){const t=r.marks[0].type in ko?ko[r.marks[0].type]:r.marks[0].type;e=e+"<"+t+">"+r.text+"</"+t+">"}else e=e+r.text;else r.type==="hardBreak"?e=e+`
900
- `:e=e+"<!-- Something is missing; got "+JSON.stringify(r)+" -->";return e}const km=["top","right","bottom","left"],Tm=["start","end"],Mm=km.reduce((r,e)=>r.concat(e,e+"-"+Tm[0],e+"-"+Tm[1]),[]),tr=Math.min,ht=Math.max,To=Math.round,rr=r=>({x:r,y:r}),cw={left:"right",right:"left",bottom:"top",top:"bottom"},dw={start:"end",end:"start"};function w0(r,e,t){return ht(r,tr(e,t))}function kr(r,e){return typeof r=="function"?r(e):r}function Bt(r){return r.split("-")[0]}function Vt(r){return r.split("-")[1]}function Cm(r){return r==="x"?"y":"x"}function x0(r){return r==="y"?"height":"width"}const hw=new Set(["top","bottom"]);function nr(r){return hw.has(Bt(r))?"y":"x"}function S0(r){return Cm(nr(r))}function Em(r,e,t){t===void 0&&(t=!1);const n=Vt(r),i=S0(r),s=x0(i);let o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Co(o)),[o,Co(o)]}function fw(r){const e=Co(r);return[Mo(r),e,Mo(e)]}function Mo(r){return r.replace(/start|end/g,e=>dw[e])}const Am=["left","right"],Om=["right","left"],pw=["top","bottom"],mw=["bottom","top"];function gw(r,e,t){switch(r){case"top":case"bottom":return t?e?Om:Am:e?Am:Om;case"left":case"right":return e?pw:mw;default:return[]}}function vw(r,e,t,n){const i=Vt(r);let s=gw(Bt(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Mo)))),s}function Co(r){return r.replace(/left|right|bottom|top/g,e=>cw[e])}function yw(r){return{top:0,right:0,bottom:0,left:0,...r}}function k0(r){return typeof r!="number"?yw(r):{top:r,right:r,bottom:r,left:r}}function Wn(r){const{x:e,y:t,width:n,height:i}=r;return{width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function Nm(r,e,t){let{reference:n,floating:i}=r;const s=nr(e),o=S0(e),a=x0(o),l=Bt(e),u=s==="y",c=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,f=n[a]/2-i[a]/2;let h;switch(l){case"top":h={x:c,y:n.y-i.height};break;case"bottom":h={x:c,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:d};break;case"left":h={x:n.x-i.width,y:d};break;default:h={x:n.x,y:n.y}}switch(Vt(e)){case"start":h[o]-=f*(t&&u?-1:1);break;case"end":h[o]+=f*(t&&u?-1:1);break}return h}const bw=async(r,e,t)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:r,floating:e,strategy:i}),{x:c,y:d}=Nm(u,n,l),f=n,h={},m=0;for(let v=0;v<a.length;v++){const{name:y,fn:w}=a[v],{x:k,y:E,data:R,reset:O}=await w({x:c,y:d,initialPlacement:n,placement:f,strategy:i,middlewareData:h,rects:u,platform:o,elements:{reference:r,floating:e}});c=k??c,d=E??d,h={...h,[y]:{...h[y],...R}},O&&m<=50&&(m++,typeof O=="object"&&(O.placement&&(f=O.placement),O.rects&&(u=O.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):O.rects),{x:c,y:d}=Nm(u,f,l)),v=-1)}return{x:c,y:d,placement:f,strategy:i,middlewareData:h}};async function Un(r,e){var t;e===void 0&&(e={});const{x:n,y:i,platform:s,rects:o,elements:a,strategy:l}=r,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=kr(e,r),m=k0(h),y=a[f?d==="floating"?"reference":"floating":d],w=Wn(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(y)))==null||t?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),k=d==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),R=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},O=Wn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:k,offsetParent:E,strategy:l}):k);return{top:(w.top-O.top+m.top)/R.y,bottom:(O.bottom-w.bottom+m.bottom)/R.y,left:(w.left-O.left+m.left)/R.x,right:(O.right-w.right+m.right)/R.x}}const ww=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:u,padding:c=0}=kr(r,e)||{};if(u==null)return{};const d=k0(c),f={x:t,y:n},h=S0(i),m=x0(h),v=await o.getDimensions(u),y=h==="y",w=y?"top":"left",k=y?"bottom":"right",E=y?"clientHeight":"clientWidth",R=s.reference[m]+s.reference[h]-f[h]-s.floating[m],O=f[h]-s.reference[h],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let D=N?N[E]:0;(!D||!await(o.isElement==null?void 0:o.isElement(N)))&&(D=a.floating[E]||s.floating[m]);const B=R/2-O/2,L=D/2-v[m]/2-1,V=tr(d[w],L),te=tr(d[k],L),ne=V,he=D-v[m]-te,re=D/2-v[m]/2+B,G=w0(ne,re,he),X=!l.arrow&&Vt(i)!=null&&re!==G&&s.reference[m]/2-(re<ne?V:te)-v[m]/2<0,ve=X?re<ne?re-ne:re-he:0;return{[h]:f[h]+ve,data:{[h]:G,centerOffset:re-G-ve,...X&&{alignmentOffset:ve}},reset:X}}});function xw(r,e,t){return(r?[...t.filter(i=>Vt(i)===r),...t.filter(i=>Vt(i)!==r)]:t.filter(i=>Bt(i)===i)).filter(i=>r?Vt(i)===r||(e?Mo(i)!==i:!1):!0)}const Sw=function(r){return r===void 0&&(r={}),{name:"autoPlacement",options:r,async fn(e){var t,n,i;const{rects:s,middlewareData:o,placement:a,platform:l,elements:u}=e,{crossAxis:c=!1,alignment:d,allowedPlacements:f=Mm,autoAlignment:h=!0,...m}=kr(r,e),v=d!==void 0||f===Mm?xw(d||null,h,f):f,y=await Un(e,m),w=((t=o.autoPlacement)==null?void 0:t.index)||0,k=v[w];if(k==null)return{};const E=Em(k,s,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(a!==k)return{reset:{placement:v[0]}};const R=[y[Bt(k)],y[E[0]],y[E[1]]],O=[...((n=o.autoPlacement)==null?void 0:n.overflows)||[],{placement:k,overflows:R}],N=v[w+1];if(N)return{data:{index:w+1,overflows:O},reset:{placement:N}};const D=O.map(V=>{const te=Vt(V.placement);return[V.placement,te&&c?V.overflows.slice(0,2).reduce((ne,he)=>ne+he,0):V.overflows[0],V.overflows]}).sort((V,te)=>V[1]-te[1]),L=((i=D.filter(V=>V[2].slice(0,Vt(V[0])?2:3).every(te=>te<=0))[0])==null?void 0:i[0])||D[0][0];return L!==a?{data:{index:w+1,overflows:O},reset:{placement:L}}:{}}}},kw=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,n;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:u}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...y}=kr(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const w=Bt(i),k=nr(a),E=Bt(a)===a,R=await(l.isRTL==null?void 0:l.isRTL(u.floating)),O=f||(E||!v?[Co(a)]:fw(a)),N=m!=="none";!f&&N&&O.push(...vw(a,v,m,R));const D=[a,...O],B=await Un(e,y),L=[];let V=((n=s.flip)==null?void 0:n.overflows)||[];if(c&&L.push(B[w]),d){const re=Em(i,o,R);L.push(B[re[0]],B[re[1]])}if(V=[...V,{placement:i,overflows:L}],!L.every(re=>re<=0)){var te,ne;const re=(((te=s.flip)==null?void 0:te.index)||0)+1,G=D[re];if(G&&(!(d==="alignment"?k!==nr(G):!1)||V.every(ee=>nr(ee.placement)===k?ee.overflows[0]>0:!0)))return{data:{index:re,overflows:V},reset:{placement:G}};let X=(ne=V.filter(ve=>ve.overflows[0]<=0).sort((ve,ee)=>ve.overflows[1]-ee.overflows[1])[0])==null?void 0:ne.placement;if(!X)switch(h){case"bestFit":{var he;const ve=(he=V.filter(ee=>{if(N){const Se=nr(ee.placement);return Se===k||Se==="y"}return!0}).map(ee=>[ee.placement,ee.overflows.filter(Se=>Se>0).reduce((Se,C)=>Se+C,0)]).sort((ee,Se)=>ee[1]-Se[1])[0])==null?void 0:he[0];ve&&(X=ve);break}case"initialPlacement":X=a;break}if(i!==X)return{reset:{placement:X}}}return{}}}};function Dm(r,e){return{top:r.top-e.height,right:r.right-e.width,bottom:r.bottom-e.height,left:r.left-e.width}}function Im(r){return km.some(e=>r[e]>=0)}const Tw=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(e){const{rects:t}=e,{strategy:n="referenceHidden",...i}=kr(r,e);switch(n){case"referenceHidden":{const s=await Un(e,{...i,elementContext:"reference"}),o=Dm(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Im(o)}}}case"escaped":{const s=await Un(e,{...i,altBoundary:!0}),o=Dm(s,t.floating);return{data:{escapedOffsets:o,escaped:Im(o)}}}default:return{}}}}};function Rm(r){const e=tr(...r.map(s=>s.left)),t=tr(...r.map(s=>s.top)),n=ht(...r.map(s=>s.right)),i=ht(...r.map(s=>s.bottom));return{x:e,y:t,width:n-e,height:i-t}}function Mw(r){const e=r.slice().sort((i,s)=>i.y-s.y),t=[];let n=null;for(let i=0;i<e.length;i++){const s=e[i];!n||s.y-n.y>n.height/2?t.push([s]):t[t.length-1].push(s),n=s}return t.map(i=>Wn(Rm(i)))}const Cw=function(r){return r===void 0&&(r={}),{name:"inline",options:r,async fn(e){const{placement:t,elements:n,rects:i,platform:s,strategy:o}=e,{padding:a=2,x:l,y:u}=kr(r,e),c=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),d=Mw(c),f=Wn(Rm(c)),h=k0(a);function m(){if(d.length===2&&d[0].left>d[1].right&&l!=null&&u!=null)return d.find(y=>l>y.left-h.left&&l<y.right+h.right&&u>y.top-h.top&&u<y.bottom+h.bottom)||f;if(d.length>=2){if(nr(t)==="y"){const V=d[0],te=d[d.length-1],ne=Bt(t)==="top",he=V.top,re=te.bottom,G=ne?V.left:te.left,X=ne?V.right:te.right,ve=X-G,ee=re-he;return{top:he,bottom:re,left:G,right:X,width:ve,height:ee,x:G,y:he}}const y=Bt(t)==="left",w=ht(...d.map(V=>V.right)),k=tr(...d.map(V=>V.left)),E=d.filter(V=>y?V.left===k:V.right===w),R=E[0].top,O=E[E.length-1].bottom,N=k,D=w,B=D-N,L=O-R;return{top:R,bottom:O,left:N,right:D,width:B,height:L,x:N,y:R}}return f}const v=await s.getElementRects({reference:{getBoundingClientRect:m},floating:n.floating,strategy:o});return i.reference.x!==v.reference.x||i.reference.y!==v.reference.y||i.reference.width!==v.reference.width||i.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}},Ew=new Set(["left","top"]);async function Aw(r,e){const{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Bt(t),a=Vt(t),l=nr(t)==="y",u=Ew.has(o)?-1:1,c=s&&l?-1:1,d=kr(e,r);let{mainAxis:f,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),l?{x:h*c,y:f*u}:{x:f*u,y:h*c}}const Ow=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,n;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await Aw(e,r);return o===((t=a.offset)==null?void 0:t.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},Nw=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:y=>{let{x:w,y:k}=y;return{x:w,y:k}}},...l}=kr(r,e),u={x:t,y:n},c=await Un(e,l),d=nr(Bt(i)),f=Cm(d);let h=u[f],m=u[d];if(s){const y=f==="y"?"top":"left",w=f==="y"?"bottom":"right",k=h+c[y],E=h-c[w];h=w0(k,h,E)}if(o){const y=d==="y"?"top":"left",w=d==="y"?"bottom":"right",k=m+c[y],E=m-c[w];m=w0(k,m,E)}const v=a.fn({...e,[f]:h,[d]:m});return{...v,data:{x:v.x-t,y:v.y-n,enabled:{[f]:s,[d]:o}}}}}},Dw=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(e){var t,n;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...u}=kr(r,e),c=await Un(e,u),d=Bt(i),f=Vt(i),h=nr(i)==="y",{width:m,height:v}=s.floating;let y,w;d==="top"||d==="bottom"?(y=d,w=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(w=d,y=f==="end"?"top":"bottom");const k=v-c.top-c.bottom,E=m-c.left-c.right,R=tr(v-c[y],k),O=tr(m-c[w],E),N=!e.middlewareData.shift;let D=R,B=O;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(B=E),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(D=k),N&&!f){const V=ht(c.left,0),te=ht(c.right,0),ne=ht(c.top,0),he=ht(c.bottom,0);h?B=m-2*(V!==0||te!==0?V+te:ht(c.left,c.right)):D=v-2*(ne!==0||he!==0?ne+he:ht(c.top,c.bottom))}await l({...e,availableWidth:B,availableHeight:D});const L=await o.getDimensions(a.floating);return m!==L.width||v!==L.height?{reset:{rects:!0}}:{}}}};function Eo(){return typeof window<"u"}function Gn(r){return Pm(r)?(r.nodeName||"").toLowerCase():"#document"}function Et(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Tr(r){var e;return(e=(Pm(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Pm(r){return Eo()?r instanceof Node||r instanceof Et(r).Node:!1}function jt(r){return Eo()?r instanceof Element||r instanceof Et(r).Element:!1}function ir(r){return Eo()?r instanceof HTMLElement||r instanceof Et(r).HTMLElement:!1}function zm(r){return!Eo()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof Et(r).ShadowRoot}const Iw=new Set(["inline","contents"]);function Hi(r){const{overflow:e,overflowX:t,overflowY:n,display:i}=qt(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!Iw.has(i)}const Rw=new Set(["table","td","th"]);function Pw(r){return Rw.has(Gn(r))}const zw=[":popover-open",":modal"];function Ao(r){return zw.some(e=>{try{return r.matches(e)}catch{return!1}})}const Lw=["transform","translate","scale","rotate","perspective"],Bw=["transform","translate","scale","rotate","perspective","filter"],Fw=["paint","layout","strict","content"];function T0(r){const e=M0(),t=jt(r)?qt(r):r;return Lw.some(n=>t[n]?t[n]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Bw.some(n=>(t.willChange||"").includes(n))||Fw.some(n=>(t.contain||"").includes(n))}function $w(r){let e=Qr(r);for(;ir(e)&&!Kn(e);){if(T0(e))return e;if(Ao(e))return null;e=Qr(e)}return null}function M0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Hw=new Set(["html","body","#document"]);function Kn(r){return Hw.has(Gn(r))}function qt(r){return Et(r).getComputedStyle(r)}function Oo(r){return jt(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Qr(r){if(Gn(r)==="html")return r;const e=r.assignedSlot||r.parentNode||zm(r)&&r.host||Tr(r);return zm(e)?e.host:e}function Lm(r){const e=Qr(r);return Kn(e)?r.ownerDocument?r.ownerDocument.body:r.body:ir(e)&&Hi(e)?e:Lm(e)}function Bm(r,e,t){var n;e===void 0&&(e=[]);const i=Lm(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=Et(i);return s?(C0(o),e.concat(o,o.visualViewport||[],Hi(i)?i:[],[])):e.concat(i,Bm(i,[]))}function C0(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Fm(r){const e=qt(r);let t=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=ir(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=To(t)!==s||To(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function $m(r){return jt(r)?r:r.contextElement}function Yn(r){const e=$m(r);if(!ir(e))return rr(1);const t=e.getBoundingClientRect(),{width:n,height:i,$:s}=Fm(e);let o=(s?To(t.width):t.width)/n,a=(s?To(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Vw=rr(0);function Hm(r){const e=Et(r);return!M0()||!e.visualViewport?Vw:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function jw(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==Et(r)?!1:e}function Vi(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=$m(r);let o=rr(1);e&&(n?jt(n)&&(o=Yn(n)):o=Yn(r));const a=jw(s,t,n)?Hm(s):rr(0);let l=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,c=i.width/o.x,d=i.height/o.y;if(s){const f=Et(s),h=n&&jt(n)?Et(n):n;let m=f,v=C0(m);for(;v&&n&&h!==m;){const y=Yn(v),w=v.getBoundingClientRect(),k=qt(v),E=w.left+(v.clientLeft+parseFloat(k.paddingLeft))*y.x,R=w.top+(v.clientTop+parseFloat(k.paddingTop))*y.y;l*=y.x,u*=y.y,c*=y.x,d*=y.y,l+=E,u+=R,m=Et(v),v=C0(m)}}return Wn({width:c,height:d,x:l,y:u})}function No(r,e){const t=Oo(r).scrollLeft;return e?e.left+t:Vi(Tr(r)).left+t}function Vm(r,e){const t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-No(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function qw(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r;const s=i==="fixed",o=Tr(n),a=e?Ao(e.floating):!1;if(n===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},u=rr(1);const c=rr(0),d=ir(n);if((d||!d&&!s)&&((Gn(n)!=="body"||Hi(o))&&(l=Oo(n)),ir(n))){const h=Vi(n);u=Yn(n),c.x=h.x+n.clientLeft,c.y=h.y+n.clientTop}const f=o&&!d&&!s?Vm(o,l):rr(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-l.scrollLeft*u.x+c.x+f.x,y:t.y*u.y-l.scrollTop*u.y+c.y+f.y}}function _w(r){return Array.from(r.getClientRects())}function Ww(r){const e=Tr(r),t=Oo(r),n=r.ownerDocument.body,i=ht(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=ht(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+No(r);const a=-t.scrollTop;return qt(n).direction==="rtl"&&(o+=ht(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}const jm=25;function Uw(r,e){const t=Et(r),n=Tr(r),i=t.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=M0();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const u=No(n);if(u<=0){const c=n.ownerDocument,d=c.body,f=getComputedStyle(d),h=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(n.clientWidth-d.clientWidth-h);m<=jm&&(s-=m)}else u<=jm&&(s+=u);return{width:s,height:o,x:a,y:l}}const Gw=new Set(["absolute","fixed"]);function Kw(r,e){const t=Vi(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=ir(r)?Yn(r):rr(1),o=r.clientWidth*s.x,a=r.clientHeight*s.y,l=i*s.x,u=n*s.y;return{width:o,height:a,x:l,y:u}}function qm(r,e,t){let n;if(e==="viewport")n=Uw(r,t);else if(e==="document")n=Ww(Tr(r));else if(jt(e))n=Kw(e,t);else{const i=Hm(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Wn(n)}function _m(r,e){const t=Qr(r);return t===e||!jt(t)||Kn(t)?!1:qt(t).position==="fixed"||_m(t,e)}function Yw(r,e){const t=e.get(r);if(t)return t;let n=Bm(r,[]).filter(a=>jt(a)&&Gn(a)!=="body"),i=null;const s=qt(r).position==="fixed";let o=s?Qr(r):r;for(;jt(o)&&!Kn(o);){const a=qt(o),l=T0(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&Gw.has(i.position)||Hi(o)&&!l&&_m(r,o))?n=n.filter(c=>c!==o):i=a,o=Qr(o)}return e.set(r,n),n}function Jw(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r;const o=[...t==="clippingAncestors"?Ao(e)?[]:Yw(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((u,c)=>{const d=qm(e,c,i);return u.top=ht(d.top,u.top),u.right=tr(d.right,u.right),u.bottom=tr(d.bottom,u.bottom),u.left=ht(d.left,u.left),u},qm(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Xw(r){const{width:e,height:t}=Fm(r);return{width:e,height:t}}function Zw(r,e,t){const n=ir(e),i=Tr(e),s=t==="fixed",o=Vi(r,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=rr(0);function u(){l.x=No(i)}if(n||!n&&!s)if((Gn(e)!=="body"||Hi(i))&&(a=Oo(e)),n){const h=Vi(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&u();s&&!n&&i&&u();const c=i&&!n&&!s?Vm(i,a):rr(0),d=o.left+a.scrollLeft-l.x-c.x,f=o.top+a.scrollTop-l.y-c.y;return{x:d,y:f,width:o.width,height:o.height}}function E0(r){return qt(r).position==="static"}function Wm(r,e){if(!ir(r)||qt(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return Tr(r)===t&&(t=t.ownerDocument.body),t}function Um(r,e){const t=Et(r);if(Ao(r))return t;if(!ir(r)){let i=Qr(r);for(;i&&!Kn(i);){if(jt(i)&&!E0(i))return i;i=Qr(i)}return t}let n=Wm(r,e);for(;n&&Pw(n)&&E0(n);)n=Wm(n,e);return n&&Kn(n)&&E0(n)&&!T0(n)?t:n||$w(r)||t}const Qw=async function(r){const e=this.getOffsetParent||Um,t=this.getDimensions,n=await t(r.floating);return{reference:Zw(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ex(r){return qt(r).direction==="rtl"}const tx={convertOffsetParentRelativeRectToViewportRelativeRect:qw,getDocumentElement:Tr,getClippingRect:Jw,getOffsetParent:Um,getElementRects:Qw,getClientRects:_w,getDimensions:Xw,getScale:Yn,isElement:jt,isRTL:ex},Gm=Ow,Km=Sw,Ym=Nw,Jm=kw,Xm=Dw,Zm=Tw,Qm=ww,e1=Cw,t1=(r,e,t)=>{const n=new Map,i={platform:tx,...t},s={...i.platform,_c:n};return bw(r,e,{...i,platform:s})};let A0,O0;if(typeof WeakMap<"u"){let r=new WeakMap;A0=e=>r.get(e),O0=(e,t)=>(r.set(e,t),t)}else{const r=[];let t=0;A0=n=>{for(let i=0;i<r.length;i+=2)if(r[i]==n)return r[i+1]},O0=(n,i)=>(t==10&&(t=0),r[t++]=n,r[t++]=i)}var Mr=class{constructor(r,e,t,n){this.width=r,this.height=e,this.map=t,this.problems=n}findCell(r){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=r)continue;const n=e%this.width,i=e/this.width|0;let s=n+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==t;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==t;a++)o++;return{left:n,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${r} found`)}colCount(r){for(let e=0;e<this.map.length;e++)if(this.map[e]==r)return e%this.width;throw new RangeError(`No cell with offset ${r} found`)}nextCell(r,e,t){const{left:n,right:i,top:s,bottom:o}=this.findCell(r);return e=="horiz"?(t<0?n==0:i==this.width)?null:this.map[s*this.width+(t<0?n-1:i)]:(t<0?s==0:o==this.height)?null:this.map[n+this.width*(t<0?s-1:o)]}rectBetween(r,e){const{left:t,right:n,top:i,bottom:s}=this.findCell(r),{left:o,right:a,top:l,bottom:u}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,l),right:Math.max(n,a),bottom:Math.max(s,u)}}cellsInRect(r){const e=[],t={};for(let n=r.top;n<r.bottom;n++)for(let i=r.left;i<r.right;i++){const s=n*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==r.left&&i&&this.map[s-1]==o||n==r.top&&n&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(r,e,t){for(let n=0,i=0;;n++){const s=i+t.child(n).nodeSize;if(n==r){let o=e+r*this.width;const a=(r+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(r){return A0(r)||O0(r,rx(r))}};function rx(r){if(r.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+r.type.name);const e=nx(r),t=r.childCount,n=[];let i=0,s=null;const o=[];for(let u=0,c=e*t;u<c;u++)n[u]=0;for(let u=0,c=0;u<t;u++){const d=r.child(u);c++;for(let m=0;;m++){for(;i<n.length&&n[i]!=0;)i++;if(m==d.childCount)break;const v=d.child(m),{colspan:y,rowspan:w,colwidth:k}=v.attrs;for(let E=0;E<w;E++){if(E+u>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:w-E});break}const R=i+E*e;for(let O=0;O<y;O++){n[R+O]==0?n[R+O]=c:(s||(s=[])).push({type:"collision",row:u,pos:c,n:y-O});const N=k&&k[O];if(N){const D=(R+O)%e*2,B=o[D];B==null||B!=N&&o[D+1]==1?(o[D]=N,o[D+1]=1):B==N&&o[D+1]++}}}i+=y,c+=v.nodeSize}const f=(u+1)*e;let h=0;for(;i<f;)n[i++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:u,n:h}),c++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new Mr(e,t,n,s);let l=!1;for(let u=0;!l&&u<o.length;u+=2)o[u]!=null&&o[u+1]<t&&(l=!0);return l&&ix(a,o,r),a}function nx(r){let e=-1,t=!1;for(let n=0;n<r.childCount;n++){const i=r.child(n);let s=0;if(t)for(let o=0;o<n;o++){const a=r.child(o);for(let l=0;l<a.childCount;l++){const u=a.child(l);o+u.attrs.rowspan>n&&(s+=u.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function ix(r,e,t){r.problems||(r.problems=[]);const n={};for(let i=0;i<r.map.length;i++){const s=r.map[i];if(n[s])continue;n[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const l=o.attrs;for(let u=0;u<l.colspan;u++){const c=e[(i+u)%r.width*2];c!=null&&(!l.colwidth||l.colwidth[u]!=c)&&((a||(a=sx(l)))[u]=c)}a&&r.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function sx(r){if(r.colwidth)return r.colwidth.slice();const e=[];for(let t=0;t<r.colspan;t++)e.push(0);return e}function N0(r){let e=r.cached.tableNodeTypes;if(!e){e=r.cached.tableNodeTypes={};for(const t in r.nodes){const n=r.nodes[t],i=n.spec.tableRole;i&&(e[i]=n)}}return e}new Ve("selectingCells");function ox(r){for(let e=r.depth-1;e>0;e--)if(r.node(e).type.spec.tableRole=="row")return r.node(0).resolve(r.before(e+1));return null}function r1(r){const e=r.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function ax(r){const e=r.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=ox(e.$head)||lx(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function lx(r){for(let e=r.nodeAfter,t=r.pos;e;e=e.firstChild,t++){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t)}for(let e=r.nodeBefore,t=r.pos;e;e=e.lastChild,t--){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t-e.nodeSize)}}function n1(r){return r.parent.type.spec.tableRole=="row"&&!!r.nodeAfter}function i1(r,e){return r.depth==e.depth&&r.pos>=e.start(-1)&&r.pos<=e.end(-1)}function s1(r,e,t){const n=r.node(-1),i=Mr.get(n),s=r.start(-1),o=i.nextCell(r.pos-s,e,t);return o==null?null:r.node(0).resolve(s+o)}function o1(r,e,t=1){const n={...r,colspan:r.colspan-t};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,t),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}var sr=class Cr extends le{constructor(e,t=e){const n=e.node(-1),i=Mr.get(n),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(c=>c!=t.pos-s);l.unshift(t.pos-s);const u=l.map(c=>{const d=n.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const f=s+c+1;return new xc(a.resolve(f),a.resolve(f+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=t}map(e,t){const n=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(n1(n)&&n1(i)&&i1(n,i)){const s=this.$anchorCell.node(-1)!=n.node(-1);return s&&this.isRowSelection()?Cr.rowSelection(n,i):s&&this.isColSelection()?Cr.colSelection(n,i):new Cr(n,i)}return de.between(n,i)}content(){const e=this.$anchorCell.node(-1),t=Mr.get(e),n=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),s={},o=[];for(let l=i.top;l<i.bottom;l++){const u=[];for(let c=l*t.width+i.left,d=i.left;d<i.right;d++,c++){const f=t.map[c];if(s[f])continue;s[f]=!0;const h=t.findCell(f);let m=e.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const v=i.left-h.left,y=h.right-i.right;if(v>0||y>0){let w=m.attrs;if(v>0&&(w=o1(w,0,v)),y>0&&(w=o1(w,w.colspan-y,y)),h.left<i.left){if(m=m.type.createAndFill(w),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else m=m.type.create(w,m.content)}if(h.top<i.top||h.bottom>i.bottom){const w={...m.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?m=m.type.createAndFill(w):m=m.type.create(w,m.content)}u.push(m)}o.push(e.child(l).copy(F.from(u)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new U(F.from(a),1,1)}replace(e,t=U.empty){const n=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:l}=i[o],u=e.mapping.slice(n);e.replace(u.map(a.pos),u.map(l.pos),o?U.empty:t)}const s=le.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new U(F.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=Mr.get(t),i=this.$anchorCell.start(-1),s=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const n=e.node(-1),i=Mr.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(t=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(t=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Cr(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Mr.get(e),n=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-n),s=t.colCount(this.$headCell.pos-n);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==t.width}eq(e){return e instanceof Cr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const n=e.node(-1),i=Mr.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(t=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(t=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new Cr(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Cr(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){return new Cr(e.resolve(t),e.resolve(n))}getBookmark(){return new ux(this.$anchorCell.pos,this.$headCell.pos)}};sr.prototype.visible=!1,le.jsonID("cell",sr);var ux=class E1{constructor(e,t){this.anchor=e,this.head=t}map(e){return new E1(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&i1(t,n)?new sr(t,n):le.near(n,1)}};new Ve("fix-tables");function a1(r){const e=r.selection,t=ax(r),n=t.node(-1),i=t.start(-1),s=Mr.get(n);return{...e instanceof sr?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:n}}function cx(r){return function(e,t){if(!r1(e))return!1;if(t){const n=N0(e.schema),i=a1(e),s=e.tr,o=i.map.cellsInRect(r=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:r=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==n.header_cell&&s.setNodeMarkup(i.tableStart+o[l],n.cell,a[l].attrs);if(s.steps.length===0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],n.header_cell,a[l].attrs);t(s)}return!0}}function l1(r,e,t){const n=e.map.cellsInRect({left:0,top:0,right:r=="row"?e.map.width:1,bottom:r=="column"?e.map.height:1});for(let i=0;i<n.length;i++){const s=e.table.nodeAt(n[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function D0(r,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?cx(r):function(t,n){if(!r1(t))return!1;if(n){const i=N0(t.schema),s=a1(t),o=t.tr,a=l1("row",s,i),l=l1("column",s,i),u=(r==="column"?a:r==="row"&&l)?1:0,c=r=="column"?{left:0,top:u,right:1,bottom:s.map.height}:r=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,d=r=="column"?l?i.cell:i.header_cell:r=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(c).forEach(f=>{const h=f+s.tableStart,m=o.doc.nodeAt(h);m&&o.setNodeMarkup(h,d,m.attrs)}),n(o)}return!0}}D0("row",{useDeprecatedLogic:!0}),D0("column",{useDeprecatedLogic:!0}),D0("cell",{useDeprecatedLogic:!0});function Do(r,e){const t=r.selection;if(!(t instanceof sr))return!1;if(e){const n=r.tr,i=N0(r.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||n.replace(n.mapping.map(o+1),n.mapping.map(o+s.nodeSize-1),new U(i,0,0))}),n.docChanged&&e(n)}return!0}Wa({ArrowLeft:Ro("horiz",-1),ArrowRight:Ro("horiz",1),ArrowUp:Ro("vert",-1),ArrowDown:Ro("vert",1),"Shift-ArrowLeft":Po("horiz",-1),"Shift-ArrowRight":Po("horiz",1),"Shift-ArrowUp":Po("vert",-1),"Shift-ArrowDown":Po("vert",1),Backspace:Do,"Mod-Backspace":Do,Delete:Do,"Mod-Delete":Do});function Io(r,e,t){return t.eq(r.selection)?!1:(e&&e(r.tr.setSelection(t).scrollIntoView()),!0)}function Ro(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof sr)return Io(t,n,le.near(s.$headCell,e));if(r!="horiz"&&!s.empty)return!1;const o=u1(i,r,e);if(o==null)return!1;if(r=="horiz")return Io(t,n,le.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(o),l=s1(a,r,e);let u;return l?u=le.near(l,1):e<0?u=le.near(t.doc.resolve(a.before(-1)),-1):u=le.near(t.doc.resolve(a.after(-1)),1),Io(t,n,u)}}}function Po(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof sr)o=s;else{const l=u1(i,r,e);if(l==null)return!1;o=new sr(t.doc.resolve(l))}const a=s1(o.$headCell,r,e);return a?Io(t,n,new sr(o.$anchorCell,a)):!1}}function u1(r,e,t){if(!(r.state.selection instanceof de))return null;const{$head:n}=r.state.selection;for(let i=n.depth-1;i>=0;i--){const s=n.node(i);if((t<0?n.index(i):n.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=n.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return r.endOfTextblock(a)?o:null}}return null}new Ve("tableColumnResizing");function dx(r,e){const t=Math.min(r.top,e.top),n=Math.max(r.bottom,e.bottom),i=Math.min(r.left,e.left),o=Math.max(r.right,e.right)-i,a=n-t,l=i,u=t;return new DOMRect(l,u,o,a)}var hx=class{constructor({editor:r,element:e,view:t,updateDelay:n=250,resizeDelay:i=60,shouldShow:s,appendTo:o,getReferencedVirtualElement:a,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:c,state:d,from:f,to:h})=>{const{doc:m,selection:v}=d,{empty:y}=v,w=!m.textBetween(f,h).length&&Ya(d.selection),k=this.element.contains(document.activeElement);return!(!(c.hasFocus()||k)||y||w||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:c})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}c?.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(c.relatedTarget))||c?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(c,d)=>{const f=!d?.selection.eq(c.state.selection),h=!d?.doc.eq(c.state.doc);!f&&!h||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(c,f,h,d)},this.updateDelay))},this.updateHandler=(c,d,f,h)=>{const{composing:m}=c;if(m||!d&&!f)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:c})=>{c.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var u;this.editor=r,this.element=e,this.view=t,this.updateDelay=n,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=(u=l?.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const r=[];return this.floatingUIOptions.flip&&r.push(Jm(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&r.push(Ym(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&r.push(Gm(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&r.push(Qm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&r.push(Xm(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&r.push(Km(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&r.push(Zm(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&r.push(e1(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),r}get virtualElement(){var r;const{selection:e}=this.editor.state,t=(r=this.getReferencedVirtualElement)==null?void 0:r.call(this);if(t)return t;const n=Th(this.view,e.from,e.to);let i={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof ie){let s=this.view.nodeDOM(e.from);const o=s.dataset.nodeViewWrapper?s:s.querySelector("[data-node-view-wrapper]");o&&(s=o),s&&(i={getBoundingClientRect:()=>s.getBoundingClientRect(),getClientRects:()=>[s.getBoundingClientRect()]})}if(e instanceof sr){const{$anchorCell:s,$headCell:o}=e,a=s?s.pos:o.pos,l=o?o.pos:s.pos,u=this.view.nodeDOM(a),c=this.view.nodeDOM(l);if(!u||!c)return;const d=u===c?u.getBoundingClientRect():dx(u.getBoundingClientRect(),c.getBoundingClientRect());i={getBoundingClientRect:()=>d,getClientRects:()=>[d]}}return i}updatePosition(){const r=this.virtualElement;r&&t1(r,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n})=>{this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(r,e){const{state:t}=r,n=t.selection.from!==t.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(r,e);return}const i=!e?.selection.eq(r.state.selection),s=!e?.doc.eq(r.state.doc);this.updateHandler(r,i,s,e)}getShouldShow(r){var e;const{state:t}=this.view,{selection:n}=t,{ranges:i}=n,s=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:r,from:s,to:o}))||!1}show(){var r;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(r=e??this.view.dom.parentElement)==null||r.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},c1=r=>new Be({key:typeof r.pluginKey=="string"?new Ve(r.pluginKey):r.pluginKey,view:e=>new hx({view:e,...r})});xe.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[c1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var fx=class{constructor({editor:r,element:e,view:t,options:n,appendTo:i,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:a})=>{const{selection:l}=a,{$anchor:u,empty:c}=l,d=u.depth===1,f=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!o.hasFocus()||!c||!d||!f||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,a,l,u)=>{const{composing:c}=o;if(c||!a&&!l)return;if(!this.getShouldShow(u)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var a;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((a=this.element.parentNode)!=null&&a.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=r,this.element=e,this.view=t,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...n},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(r){return bh(r,{textSerializers:el(this.editor.schema)})}get middlewares(){const r=[];return this.floatingUIOptions.flip&&r.push(Jm(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&r.push(Ym(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&r.push(Gm(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&r.push(Qm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&r.push(Xm(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&r.push(Km(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&r.push(Zm(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&r.push(e1(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),r}getShouldShow(r){var e;const{state:t}=this.view,{selection:n}=t,{ranges:i}=n,s=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:r,from:s,to:o})}updatePosition(){const{selection:r}=this.editor.state,e=Th(this.view,r.from,r.to);t1({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:i,strategy:s})=>{this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${n}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(r,e){const t=!e?.selection.eq(r.state.selection),n=!e?.doc.eq(r.state.doc);this.updateHandler(r,t,n,e)}show(){var r;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(r=e??this.view.dom.parentElement)==null||r.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},d1=r=>new Be({key:typeof r.pluginKey=="string"?new Ve(r.pluginKey):r.pluginKey,view:e=>new fx({view:e,...r})});xe.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[d1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var px=z.forwardRef(({pluginKey:r="bubbleMenu",editor:e,updateDelay:t,resizeDelay:n,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:o,options:a,children:l,...u},c)=>{const d=z.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:f}=uf(),h=e||f,m={updateDelay:t,resizeDelay:n,appendTo:i,pluginKey:r,shouldShow:s,getReferencedVirtualElement:o,options:a},v=z.useRef(m);return v.current=m,z.useEffect(()=>{if(h?.isDestroyed)return;if(!h){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const y=d.current;y.style.visibility="hidden",y.style.position="absolute";const w=c1({...v.current,editor:h,element:y});h.registerPlugin(w);const k=v.current.pluginKey;return()=>{h.unregisterPlugin(k),window.requestAnimationFrame(()=>{y.parentNode&&y.parentNode.removeChild(y)})}},[h]),Ui.createPortal(Z.jsx("div",{...u,children:l}),d.current)});z.forwardRef(({pluginKey:r="floatingMenu",editor:e,appendTo:t,shouldShow:n=null,options:i,children:s,...o},a)=>{const l=z.useRef(document.createElement("div"));typeof a=="function"?a(l.current):a&&(a.current=l.current);const{editor:u}=uf();return z.useEffect(()=>{const c=l.current;if(c.style.visibility="hidden",c.style.position="absolute",e?.isDestroyed||u?.isDestroyed)return;const d=e||u;if(!d){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const f=d1({editor:d,element:c,pluginKey:r,appendTo:t,shouldShow:n,options:i});return d.registerPlugin(f),()=>{d.unregisterPlugin(r),window.requestAnimationFrame(()=>{c.parentNode&&c.parentNode.removeChild(c)})}},[e,u,t,r,n,i]),Ui.createPortal(Z.jsx("div",{...o,children:s}),l.current)});const mx=({editor:r})=>{if(!r)return null;const[e]=z.useState(!0),[t]=z.useState(!0);z.useEffect(()=>{r&&r.setEditable(t)},[t,r]);const n=of({editor:r,selector:i=>({isTerm:i.editor.isActive("term"),canTerm:i.editor.can().chain().focus().toggleMark("term").run(),isEm:i.editor.isActive("em"),canEm:i.editor.can().chain().focus().toggleMark("em").run(),isAlert:i.editor.isActive("alert"),canAlert:i.editor.can().chain().focus().toggleMark("alert").run()})});return Z.jsx(Z.Fragment,{children:r&&e&&Z.jsx(px,{shouldShow:null,editor:r,options:{placement:"bottom",autoPlacement:!0,offset:8},children:Z.jsxs("div",{className:"button-group",children:[Z.jsx("button",{onClick:()=>r.chain().focus().toggleMark("em").run(),disabled:!n.canEm,className:n.isEm?"is-active":"",children:"<em>"}),Z.jsx("button",{onClick:()=>r.chain().focus().toggleMark("term").run(),disabled:!n.canTerm,className:n.isTerm?"is-active":"",children:"<term>"}),Z.jsx("button",{onClick:()=>r.chain().focus().toggleMark("alert").run(),disabled:!n.canAlert,className:n.isAlert?"is-active":"",children:"<alert>"})]})})})},h1=["abstract","acknowledgement","affiliation","appendix","article","author","backmatter","biography","book","chapter","colophon","contributor","contributors","copyright","credit","dedication","docinfo","editor","feedback","frontmatter","google","html","index","macros","mathbook","preface","pretext","references","search","shortlicense","solutions","subsection","titlepage","website"],f1=["assemblage","chapter","conclusion","introduction","objectives","outcomes","paragraphs","part","postlude","prelude","reading-questions","sbsgroup","section","stack","subsection","subsubsection","task","technology","worksheet"],p1=["activity","algorithm","answer","axiom","biblio","blockquote","case","choice","choices","claim","conjecture","console","corollary","definition","demonstration","description","example","exercise","exploration","fact","hint","image","images","insight","investigation","lemma","list","listing","note","openconjecture","openproblem","openquestion","page","poem","principle","problem","program","project","proof","proposition","question","remark","shortdescription","solution","stanza","statement","subtask","table","tabular","theorem","warning","webwork"],gx=["address","attribution","caption","cd","cell","cline","date","department","description","edition","entity","holder","idx","institution","journal","line","location","minilicense","mrow","personname","pg-macros","pubtitle","row","subtitle","support","title","usage","volume","year","xi:include"],vx=["me","men","md","mdn"],m1=["ul","ol","li","p","task","figure","sidebyside","notation","row"],zo=["latex-image-preamble","latex-image","latex-preamble","slate","sage","sageplot","asymptote","macros","prefigure","program","input","output","prompt","pre","pg-code","tikzpicture","tikz","code","c"],yx=[...h1,...f1,...p1,...m1,"xi:include"],I0=[...h1,...f1,...p1,...m1,...vx];function bx(r){let e=!1,t=r.split(/\r\n|\r|\n/g),n=[t[0].trim()];t.length>1&&n.push(t[1].trim());for(let i=2;i<t.length;i++){let s=/^<(\w\S*?)(\s.*?|>)$/.exec(t[i].trim()),o=/^<\/(\w\S*?)(\s.*?|>)(.?)$/.exec(t[i].trim());if(s&&zo.includes(s[1]))n.push(t[i]),e=!0;else if(o&&zo.includes(o[1]))n.push(t[i]),e=!1;else if(e)n.push(t[i]);else{t[i]=t[i].trim();let a=n.pop();a?n.push(a.trim()+" "+t[i]):n.push(t[i])}}return n.join(`
900
+ `:e=e+"<!-- Something is missing; got "+JSON.stringify(r)+" -->";return e}const km=["top","right","bottom","left"],Tm=["start","end"],Mm=km.reduce((r,e)=>r.concat(e,e+"-"+Tm[0],e+"-"+Tm[1]),[]),tr=Math.min,ht=Math.max,To=Math.round,rr=r=>({x:r,y:r}),cw={left:"right",right:"left",bottom:"top",top:"bottom"},dw={start:"end",end:"start"};function w0(r,e,t){return ht(r,tr(e,t))}function kr(r,e){return typeof r=="function"?r(e):r}function Bt(r){return r.split("-")[0]}function Vt(r){return r.split("-")[1]}function Cm(r){return r==="x"?"y":"x"}function x0(r){return r==="y"?"height":"width"}const hw=new Set(["top","bottom"]);function nr(r){return hw.has(Bt(r))?"y":"x"}function S0(r){return Cm(nr(r))}function Em(r,e,t){t===void 0&&(t=!1);const n=Vt(r),i=S0(r),s=x0(i);let o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Co(o)),[o,Co(o)]}function fw(r){const e=Co(r);return[Mo(r),e,Mo(e)]}function Mo(r){return r.replace(/start|end/g,e=>dw[e])}const Am=["left","right"],Om=["right","left"],pw=["top","bottom"],mw=["bottom","top"];function gw(r,e,t){switch(r){case"top":case"bottom":return t?e?Om:Am:e?Am:Om;case"left":case"right":return e?pw:mw;default:return[]}}function vw(r,e,t,n){const i=Vt(r);let s=gw(Bt(r),t==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Mo)))),s}function Co(r){return r.replace(/left|right|bottom|top/g,e=>cw[e])}function yw(r){return{top:0,right:0,bottom:0,left:0,...r}}function k0(r){return typeof r!="number"?yw(r):{top:r,right:r,bottom:r,left:r}}function Wn(r){const{x:e,y:t,width:n,height:i}=r;return{width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function Nm(r,e,t){let{reference:n,floating:i}=r;const s=nr(e),o=S0(e),a=x0(o),l=Bt(e),u=s==="y",c=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,f=n[a]/2-i[a]/2;let h;switch(l){case"top":h={x:c,y:n.y-i.height};break;case"bottom":h={x:c,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:d};break;case"left":h={x:n.x-i.width,y:d};break;default:h={x:n.x,y:n.y}}switch(Vt(e)){case"start":h[o]-=f*(t&&u?-1:1);break;case"end":h[o]+=f*(t&&u?-1:1);break}return h}const bw=async(r,e,t)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:r,floating:e,strategy:i}),{x:c,y:d}=Nm(u,n,l),f=n,h={},m=0;for(let v=0;v<a.length;v++){const{name:y,fn:w}=a[v],{x:k,y:E,data:R,reset:O}=await w({x:c,y:d,initialPlacement:n,placement:f,strategy:i,middlewareData:h,rects:u,platform:o,elements:{reference:r,floating:e}});c=k??c,d=E??d,h={...h,[y]:{...h[y],...R}},O&&m<=50&&(m++,typeof O=="object"&&(O.placement&&(f=O.placement),O.rects&&(u=O.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:i}):O.rects),{x:c,y:d}=Nm(u,f,l)),v=-1)}return{x:c,y:d,placement:f,strategy:i,middlewareData:h}};async function Un(r,e){var t;e===void 0&&(e={});const{x:n,y:i,platform:s,rects:o,elements:a,strategy:l}=r,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=kr(e,r),m=k0(h),y=a[f?d==="floating"?"reference":"floating":d],w=Wn(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(y)))==null||t?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),k=d==="floating"?{x:n,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),R=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},O=Wn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:k,offsetParent:E,strategy:l}):k);return{top:(w.top-O.top+m.top)/R.y,bottom:(O.bottom-w.bottom+m.bottom)/R.y,left:(w.left-O.left+m.left)/R.x,right:(O.right-w.right+m.right)/R.x}}const ww=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:u,padding:c=0}=kr(r,e)||{};if(u==null)return{};const d=k0(c),f={x:t,y:n},h=S0(i),m=x0(h),v=await o.getDimensions(u),y=h==="y",w=y?"top":"left",k=y?"bottom":"right",E=y?"clientHeight":"clientWidth",R=s.reference[m]+s.reference[h]-f[h]-s.floating[m],O=f[h]-s.reference[h],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let D=N?N[E]:0;(!D||!await(o.isElement==null?void 0:o.isElement(N)))&&(D=a.floating[E]||s.floating[m]);const B=R/2-O/2,L=D/2-v[m]/2-1,V=tr(d[w],L),te=tr(d[k],L),ne=V,he=D-v[m]-te,re=D/2-v[m]/2+B,G=w0(ne,re,he),Z=!l.arrow&&Vt(i)!=null&&re!==G&&s.reference[m]/2-(re<ne?V:te)-v[m]/2<0,ve=Z?re<ne?re-ne:re-he:0;return{[h]:f[h]+ve,data:{[h]:G,centerOffset:re-G-ve,...Z&&{alignmentOffset:ve}},reset:Z}}});function xw(r,e,t){return(r?[...t.filter(i=>Vt(i)===r),...t.filter(i=>Vt(i)!==r)]:t.filter(i=>Bt(i)===i)).filter(i=>r?Vt(i)===r||(e?Mo(i)!==i:!1):!0)}const Sw=function(r){return r===void 0&&(r={}),{name:"autoPlacement",options:r,async fn(e){var t,n,i;const{rects:s,middlewareData:o,placement:a,platform:l,elements:u}=e,{crossAxis:c=!1,alignment:d,allowedPlacements:f=Mm,autoAlignment:h=!0,...m}=kr(r,e),v=d!==void 0||f===Mm?xw(d||null,h,f):f,y=await Un(e,m),w=((t=o.autoPlacement)==null?void 0:t.index)||0,k=v[w];if(k==null)return{};const E=Em(k,s,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(a!==k)return{reset:{placement:v[0]}};const R=[y[Bt(k)],y[E[0]],y[E[1]]],O=[...((n=o.autoPlacement)==null?void 0:n.overflows)||[],{placement:k,overflows:R}],N=v[w+1];if(N)return{data:{index:w+1,overflows:O},reset:{placement:N}};const D=O.map(V=>{const te=Vt(V.placement);return[V.placement,te&&c?V.overflows.slice(0,2).reduce((ne,he)=>ne+he,0):V.overflows[0],V.overflows]}).sort((V,te)=>V[1]-te[1]),L=((i=D.filter(V=>V[2].slice(0,Vt(V[0])?2:3).every(te=>te<=0))[0])==null?void 0:i[0])||D[0][0];return L!==a?{data:{index:w+1,overflows:O},reset:{placement:L}}:{}}}},kw=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,n;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:u}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...y}=kr(r,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const w=Bt(i),k=nr(a),E=Bt(a)===a,R=await(l.isRTL==null?void 0:l.isRTL(u.floating)),O=f||(E||!v?[Co(a)]:fw(a)),N=m!=="none";!f&&N&&O.push(...vw(a,v,m,R));const D=[a,...O],B=await Un(e,y),L=[];let V=((n=s.flip)==null?void 0:n.overflows)||[];if(c&&L.push(B[w]),d){const re=Em(i,o,R);L.push(B[re[0]],B[re[1]])}if(V=[...V,{placement:i,overflows:L}],!L.every(re=>re<=0)){var te,ne;const re=(((te=s.flip)==null?void 0:te.index)||0)+1,G=D[re];if(G&&(!(d==="alignment"?k!==nr(G):!1)||V.every(ee=>nr(ee.placement)===k?ee.overflows[0]>0:!0)))return{data:{index:re,overflows:V},reset:{placement:G}};let Z=(ne=V.filter(ve=>ve.overflows[0]<=0).sort((ve,ee)=>ve.overflows[1]-ee.overflows[1])[0])==null?void 0:ne.placement;if(!Z)switch(h){case"bestFit":{var he;const ve=(he=V.filter(ee=>{if(N){const Se=nr(ee.placement);return Se===k||Se==="y"}return!0}).map(ee=>[ee.placement,ee.overflows.filter(Se=>Se>0).reduce((Se,C)=>Se+C,0)]).sort((ee,Se)=>ee[1]-Se[1])[0])==null?void 0:he[0];ve&&(Z=ve);break}case"initialPlacement":Z=a;break}if(i!==Z)return{reset:{placement:Z}}}return{}}}};function Dm(r,e){return{top:r.top-e.height,right:r.right-e.width,bottom:r.bottom-e.height,left:r.left-e.width}}function Im(r){return km.some(e=>r[e]>=0)}const Tw=function(r){return r===void 0&&(r={}),{name:"hide",options:r,async fn(e){const{rects:t}=e,{strategy:n="referenceHidden",...i}=kr(r,e);switch(n){case"referenceHidden":{const s=await Un(e,{...i,elementContext:"reference"}),o=Dm(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Im(o)}}}case"escaped":{const s=await Un(e,{...i,altBoundary:!0}),o=Dm(s,t.floating);return{data:{escapedOffsets:o,escaped:Im(o)}}}default:return{}}}}};function Rm(r){const e=tr(...r.map(s=>s.left)),t=tr(...r.map(s=>s.top)),n=ht(...r.map(s=>s.right)),i=ht(...r.map(s=>s.bottom));return{x:e,y:t,width:n-e,height:i-t}}function Mw(r){const e=r.slice().sort((i,s)=>i.y-s.y),t=[];let n=null;for(let i=0;i<e.length;i++){const s=e[i];!n||s.y-n.y>n.height/2?t.push([s]):t[t.length-1].push(s),n=s}return t.map(i=>Wn(Rm(i)))}const Cw=function(r){return r===void 0&&(r={}),{name:"inline",options:r,async fn(e){const{placement:t,elements:n,rects:i,platform:s,strategy:o}=e,{padding:a=2,x:l,y:u}=kr(r,e),c=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(n.reference))||[]),d=Mw(c),f=Wn(Rm(c)),h=k0(a);function m(){if(d.length===2&&d[0].left>d[1].right&&l!=null&&u!=null)return d.find(y=>l>y.left-h.left&&l<y.right+h.right&&u>y.top-h.top&&u<y.bottom+h.bottom)||f;if(d.length>=2){if(nr(t)==="y"){const V=d[0],te=d[d.length-1],ne=Bt(t)==="top",he=V.top,re=te.bottom,G=ne?V.left:te.left,Z=ne?V.right:te.right,ve=Z-G,ee=re-he;return{top:he,bottom:re,left:G,right:Z,width:ve,height:ee,x:G,y:he}}const y=Bt(t)==="left",w=ht(...d.map(V=>V.right)),k=tr(...d.map(V=>V.left)),E=d.filter(V=>y?V.left===k:V.right===w),R=E[0].top,O=E[E.length-1].bottom,N=k,D=w,B=D-N,L=O-R;return{top:R,bottom:O,left:N,right:D,width:B,height:L,x:N,y:R}}return f}const v=await s.getElementRects({reference:{getBoundingClientRect:m},floating:n.floating,strategy:o});return i.reference.x!==v.reference.x||i.reference.y!==v.reference.y||i.reference.width!==v.reference.width||i.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}},Ew=new Set(["left","top"]);async function Aw(r,e){const{placement:t,platform:n,elements:i}=r,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Bt(t),a=Vt(t),l=nr(t)==="y",u=Ew.has(o)?-1:1,c=s&&l?-1:1,d=kr(e,r);let{mainAxis:f,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),l?{x:h*c,y:f*u}:{x:f*u,y:h*c}}const Ow=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,n;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await Aw(e,r);return o===((t=a.offset)==null?void 0:t.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},Nw=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:y=>{let{x:w,y:k}=y;return{x:w,y:k}}},...l}=kr(r,e),u={x:t,y:n},c=await Un(e,l),d=nr(Bt(i)),f=Cm(d);let h=u[f],m=u[d];if(s){const y=f==="y"?"top":"left",w=f==="y"?"bottom":"right",k=h+c[y],E=h-c[w];h=w0(k,h,E)}if(o){const y=d==="y"?"top":"left",w=d==="y"?"bottom":"right",k=m+c[y],E=m-c[w];m=w0(k,m,E)}const v=a.fn({...e,[f]:h,[d]:m});return{...v,data:{x:v.x-t,y:v.y-n,enabled:{[f]:s,[d]:o}}}}}},Dw=function(r){return r===void 0&&(r={}),{name:"size",options:r,async fn(e){var t,n;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...u}=kr(r,e),c=await Un(e,u),d=Bt(i),f=Vt(i),h=nr(i)==="y",{width:m,height:v}=s.floating;let y,w;d==="top"||d==="bottom"?(y=d,w=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(w=d,y=f==="end"?"top":"bottom");const k=v-c.top-c.bottom,E=m-c.left-c.right,R=tr(v-c[y],k),O=tr(m-c[w],E),N=!e.middlewareData.shift;let D=R,B=O;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(B=E),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(D=k),N&&!f){const V=ht(c.left,0),te=ht(c.right,0),ne=ht(c.top,0),he=ht(c.bottom,0);h?B=m-2*(V!==0||te!==0?V+te:ht(c.left,c.right)):D=v-2*(ne!==0||he!==0?ne+he:ht(c.top,c.bottom))}await l({...e,availableWidth:B,availableHeight:D});const L=await o.getDimensions(a.floating);return m!==L.width||v!==L.height?{reset:{rects:!0}}:{}}}};function Eo(){return typeof window<"u"}function Gn(r){return Pm(r)?(r.nodeName||"").toLowerCase():"#document"}function Et(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Tr(r){var e;return(e=(Pm(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function Pm(r){return Eo()?r instanceof Node||r instanceof Et(r).Node:!1}function _t(r){return Eo()?r instanceof Element||r instanceof Et(r).Element:!1}function ir(r){return Eo()?r instanceof HTMLElement||r instanceof Et(r).HTMLElement:!1}function zm(r){return!Eo()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof Et(r).ShadowRoot}const Iw=new Set(["inline","contents"]);function Hi(r){const{overflow:e,overflowX:t,overflowY:n,display:i}=jt(r);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!Iw.has(i)}const Rw=new Set(["table","td","th"]);function Pw(r){return Rw.has(Gn(r))}const zw=[":popover-open",":modal"];function Ao(r){return zw.some(e=>{try{return r.matches(e)}catch{return!1}})}const Lw=["transform","translate","scale","rotate","perspective"],Bw=["transform","translate","scale","rotate","perspective","filter"],Fw=["paint","layout","strict","content"];function T0(r){const e=M0(),t=_t(r)?jt(r):r;return Lw.some(n=>t[n]?t[n]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Bw.some(n=>(t.willChange||"").includes(n))||Fw.some(n=>(t.contain||"").includes(n))}function $w(r){let e=Qr(r);for(;ir(e)&&!Kn(e);){if(T0(e))return e;if(Ao(e))return null;e=Qr(e)}return null}function M0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Hw=new Set(["html","body","#document"]);function Kn(r){return Hw.has(Gn(r))}function jt(r){return Et(r).getComputedStyle(r)}function Oo(r){return _t(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Qr(r){if(Gn(r)==="html")return r;const e=r.assignedSlot||r.parentNode||zm(r)&&r.host||Tr(r);return zm(e)?e.host:e}function Lm(r){const e=Qr(r);return Kn(e)?r.ownerDocument?r.ownerDocument.body:r.body:ir(e)&&Hi(e)?e:Lm(e)}function Bm(r,e,t){var n;e===void 0&&(e=[]);const i=Lm(r),s=i===((n=r.ownerDocument)==null?void 0:n.body),o=Et(i);return s?(C0(o),e.concat(o,o.visualViewport||[],Hi(i)?i:[],[])):e.concat(i,Bm(i,[]))}function C0(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function Fm(r){const e=jt(r);let t=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=ir(r),s=i?r.offsetWidth:t,o=i?r.offsetHeight:n,a=To(t)!==s||To(n)!==o;return a&&(t=s,n=o),{width:t,height:n,$:a}}function $m(r){return _t(r)?r:r.contextElement}function Yn(r){const e=$m(r);if(!ir(e))return rr(1);const t=e.getBoundingClientRect(),{width:n,height:i,$:s}=Fm(e);let o=(s?To(t.width):t.width)/n,a=(s?To(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Vw=rr(0);function Hm(r){const e=Et(r);return!M0()||!e.visualViewport?Vw:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _w(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==Et(r)?!1:e}function Vi(r,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=$m(r);let o=rr(1);e&&(n?_t(n)&&(o=Yn(n)):o=Yn(r));const a=_w(s,t,n)?Hm(s):rr(0);let l=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,c=i.width/o.x,d=i.height/o.y;if(s){const f=Et(s),h=n&&_t(n)?Et(n):n;let m=f,v=C0(m);for(;v&&n&&h!==m;){const y=Yn(v),w=v.getBoundingClientRect(),k=jt(v),E=w.left+(v.clientLeft+parseFloat(k.paddingLeft))*y.x,R=w.top+(v.clientTop+parseFloat(k.paddingTop))*y.y;l*=y.x,u*=y.y,c*=y.x,d*=y.y,l+=E,u+=R,m=Et(v),v=C0(m)}}return Wn({width:c,height:d,x:l,y:u})}function No(r,e){const t=Oo(r).scrollLeft;return e?e.left+t:Vi(Tr(r)).left+t}function Vm(r,e){const t=r.getBoundingClientRect(),n=t.left+e.scrollLeft-No(r,t),i=t.top+e.scrollTop;return{x:n,y:i}}function jw(r){let{elements:e,rect:t,offsetParent:n,strategy:i}=r;const s=i==="fixed",o=Tr(n),a=e?Ao(e.floating):!1;if(n===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},u=rr(1);const c=rr(0),d=ir(n);if((d||!d&&!s)&&((Gn(n)!=="body"||Hi(o))&&(l=Oo(n)),ir(n))){const h=Vi(n);u=Yn(n),c.x=h.x+n.clientLeft,c.y=h.y+n.clientTop}const f=o&&!d&&!s?Vm(o,l):rr(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-l.scrollLeft*u.x+c.x+f.x,y:t.y*u.y-l.scrollTop*u.y+c.y+f.y}}function qw(r){return Array.from(r.getClientRects())}function Ww(r){const e=Tr(r),t=Oo(r),n=r.ownerDocument.body,i=ht(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=ht(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+No(r);const a=-t.scrollTop;return jt(n).direction==="rtl"&&(o+=ht(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}const _m=25;function Uw(r,e){const t=Et(r),n=Tr(r),i=t.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=M0();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const u=No(n);if(u<=0){const c=n.ownerDocument,d=c.body,f=getComputedStyle(d),h=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(n.clientWidth-d.clientWidth-h);m<=_m&&(s-=m)}else u<=_m&&(s+=u);return{width:s,height:o,x:a,y:l}}const Gw=new Set(["absolute","fixed"]);function Kw(r,e){const t=Vi(r,!0,e==="fixed"),n=t.top+r.clientTop,i=t.left+r.clientLeft,s=ir(r)?Yn(r):rr(1),o=r.clientWidth*s.x,a=r.clientHeight*s.y,l=i*s.x,u=n*s.y;return{width:o,height:a,x:l,y:u}}function jm(r,e,t){let n;if(e==="viewport")n=Uw(r,t);else if(e==="document")n=Ww(Tr(r));else if(_t(e))n=Kw(e,t);else{const i=Hm(r);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Wn(n)}function qm(r,e){const t=Qr(r);return t===e||!_t(t)||Kn(t)?!1:jt(t).position==="fixed"||qm(t,e)}function Yw(r,e){const t=e.get(r);if(t)return t;let n=Bm(r,[]).filter(a=>_t(a)&&Gn(a)!=="body"),i=null;const s=jt(r).position==="fixed";let o=s?Qr(r):r;for(;_t(o)&&!Kn(o);){const a=jt(o),l=T0(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&Gw.has(i.position)||Hi(o)&&!l&&qm(r,o))?n=n.filter(c=>c!==o):i=a,o=Qr(o)}return e.set(r,n),n}function Jw(r){let{element:e,boundary:t,rootBoundary:n,strategy:i}=r;const o=[...t==="clippingAncestors"?Ao(e)?[]:Yw(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((u,c)=>{const d=jm(e,c,i);return u.top=ht(d.top,u.top),u.right=tr(d.right,u.right),u.bottom=tr(d.bottom,u.bottom),u.left=ht(d.left,u.left),u},jm(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Xw(r){const{width:e,height:t}=Fm(r);return{width:e,height:t}}function Zw(r,e,t){const n=ir(e),i=Tr(e),s=t==="fixed",o=Vi(r,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=rr(0);function u(){l.x=No(i)}if(n||!n&&!s)if((Gn(e)!=="body"||Hi(i))&&(a=Oo(e)),n){const h=Vi(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&u();s&&!n&&i&&u();const c=i&&!n&&!s?Vm(i,a):rr(0),d=o.left+a.scrollLeft-l.x-c.x,f=o.top+a.scrollTop-l.y-c.y;return{x:d,y:f,width:o.width,height:o.height}}function E0(r){return jt(r).position==="static"}function Wm(r,e){if(!ir(r)||jt(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return Tr(r)===t&&(t=t.ownerDocument.body),t}function Um(r,e){const t=Et(r);if(Ao(r))return t;if(!ir(r)){let i=Qr(r);for(;i&&!Kn(i);){if(_t(i)&&!E0(i))return i;i=Qr(i)}return t}let n=Wm(r,e);for(;n&&Pw(n)&&E0(n);)n=Wm(n,e);return n&&Kn(n)&&E0(n)&&!T0(n)?t:n||$w(r)||t}const Qw=async function(r){const e=this.getOffsetParent||Um,t=this.getDimensions,n=await t(r.floating);return{reference:Zw(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ex(r){return jt(r).direction==="rtl"}const tx={convertOffsetParentRelativeRectToViewportRelativeRect:jw,getDocumentElement:Tr,getClippingRect:Jw,getOffsetParent:Um,getElementRects:Qw,getClientRects:qw,getDimensions:Xw,getScale:Yn,isElement:_t,isRTL:ex},Gm=Ow,Km=Sw,Ym=Nw,Jm=kw,Xm=Dw,Zm=Tw,Qm=ww,e1=Cw,t1=(r,e,t)=>{const n=new Map,i={platform:tx,...t},s={...i.platform,_c:n};return bw(r,e,{...i,platform:s})};let A0,O0;if(typeof WeakMap<"u"){let r=new WeakMap;A0=e=>r.get(e),O0=(e,t)=>(r.set(e,t),t)}else{const r=[];let t=0;A0=n=>{for(let i=0;i<r.length;i+=2)if(r[i]==n)return r[i+1]},O0=(n,i)=>(t==10&&(t=0),r[t++]=n,r[t++]=i)}var Mr=class{constructor(r,e,t,n){this.width=r,this.height=e,this.map=t,this.problems=n}findCell(r){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=r)continue;const n=e%this.width,i=e/this.width|0;let s=n+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==t;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==t;a++)o++;return{left:n,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${r} found`)}colCount(r){for(let e=0;e<this.map.length;e++)if(this.map[e]==r)return e%this.width;throw new RangeError(`No cell with offset ${r} found`)}nextCell(r,e,t){const{left:n,right:i,top:s,bottom:o}=this.findCell(r);return e=="horiz"?(t<0?n==0:i==this.width)?null:this.map[s*this.width+(t<0?n-1:i)]:(t<0?s==0:o==this.height)?null:this.map[n+this.width*(t<0?s-1:o)]}rectBetween(r,e){const{left:t,right:n,top:i,bottom:s}=this.findCell(r),{left:o,right:a,top:l,bottom:u}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,l),right:Math.max(n,a),bottom:Math.max(s,u)}}cellsInRect(r){const e=[],t={};for(let n=r.top;n<r.bottom;n++)for(let i=r.left;i<r.right;i++){const s=n*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==r.left&&i&&this.map[s-1]==o||n==r.top&&n&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(r,e,t){for(let n=0,i=0;;n++){const s=i+t.child(n).nodeSize;if(n==r){let o=e+r*this.width;const a=(r+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(r){return A0(r)||O0(r,rx(r))}};function rx(r){if(r.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+r.type.name);const e=nx(r),t=r.childCount,n=[];let i=0,s=null;const o=[];for(let u=0,c=e*t;u<c;u++)n[u]=0;for(let u=0,c=0;u<t;u++){const d=r.child(u);c++;for(let m=0;;m++){for(;i<n.length&&n[i]!=0;)i++;if(m==d.childCount)break;const v=d.child(m),{colspan:y,rowspan:w,colwidth:k}=v.attrs;for(let E=0;E<w;E++){if(E+u>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:w-E});break}const R=i+E*e;for(let O=0;O<y;O++){n[R+O]==0?n[R+O]=c:(s||(s=[])).push({type:"collision",row:u,pos:c,n:y-O});const N=k&&k[O];if(N){const D=(R+O)%e*2,B=o[D];B==null||B!=N&&o[D+1]==1?(o[D]=N,o[D+1]=1):B==N&&o[D+1]++}}}i+=y,c+=v.nodeSize}const f=(u+1)*e;let h=0;for(;i<f;)n[i++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:u,n:h}),c++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new Mr(e,t,n,s);let l=!1;for(let u=0;!l&&u<o.length;u+=2)o[u]!=null&&o[u+1]<t&&(l=!0);return l&&ix(a,o,r),a}function nx(r){let e=-1,t=!1;for(let n=0;n<r.childCount;n++){const i=r.child(n);let s=0;if(t)for(let o=0;o<n;o++){const a=r.child(o);for(let l=0;l<a.childCount;l++){const u=a.child(l);o+u.attrs.rowspan>n&&(s+=u.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function ix(r,e,t){r.problems||(r.problems=[]);const n={};for(let i=0;i<r.map.length;i++){const s=r.map[i];if(n[s])continue;n[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const l=o.attrs;for(let u=0;u<l.colspan;u++){const c=e[(i+u)%r.width*2];c!=null&&(!l.colwidth||l.colwidth[u]!=c)&&((a||(a=sx(l)))[u]=c)}a&&r.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function sx(r){if(r.colwidth)return r.colwidth.slice();const e=[];for(let t=0;t<r.colspan;t++)e.push(0);return e}function N0(r){let e=r.cached.tableNodeTypes;if(!e){e=r.cached.tableNodeTypes={};for(const t in r.nodes){const n=r.nodes[t],i=n.spec.tableRole;i&&(e[i]=n)}}return e}new Ve("selectingCells");function ox(r){for(let e=r.depth-1;e>0;e--)if(r.node(e).type.spec.tableRole=="row")return r.node(0).resolve(r.before(e+1));return null}function r1(r){const e=r.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function ax(r){const e=r.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=ox(e.$head)||lx(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function lx(r){for(let e=r.nodeAfter,t=r.pos;e;e=e.firstChild,t++){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t)}for(let e=r.nodeBefore,t=r.pos;e;e=e.lastChild,t--){const n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return r.doc.resolve(t-e.nodeSize)}}function n1(r){return r.parent.type.spec.tableRole=="row"&&!!r.nodeAfter}function i1(r,e){return r.depth==e.depth&&r.pos>=e.start(-1)&&r.pos<=e.end(-1)}function s1(r,e,t){const n=r.node(-1),i=Mr.get(n),s=r.start(-1),o=i.nextCell(r.pos-s,e,t);return o==null?null:r.node(0).resolve(s+o)}function o1(r,e,t=1){const n={...r,colspan:r.colspan-t};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,t),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}var sr=class Cr extends le{constructor(e,t=e){const n=e.node(-1),i=Mr.get(n),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(c=>c!=t.pos-s);l.unshift(t.pos-s);const u=l.map(c=>{const d=n.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const f=s+c+1;return new xc(a.resolve(f),a.resolve(f+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=t}map(e,t){const n=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(n1(n)&&n1(i)&&i1(n,i)){const s=this.$anchorCell.node(-1)!=n.node(-1);return s&&this.isRowSelection()?Cr.rowSelection(n,i):s&&this.isColSelection()?Cr.colSelection(n,i):new Cr(n,i)}return de.between(n,i)}content(){const e=this.$anchorCell.node(-1),t=Mr.get(e),n=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),s={},o=[];for(let l=i.top;l<i.bottom;l++){const u=[];for(let c=l*t.width+i.left,d=i.left;d<i.right;d++,c++){const f=t.map[c];if(s[f])continue;s[f]=!0;const h=t.findCell(f);let m=e.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const v=i.left-h.left,y=h.right-i.right;if(v>0||y>0){let w=m.attrs;if(v>0&&(w=o1(w,0,v)),y>0&&(w=o1(w,w.colspan-y,y)),h.left<i.left){if(m=m.type.createAndFill(w),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else m=m.type.create(w,m.content)}if(h.top<i.top||h.bottom>i.bottom){const w={...m.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?m=m.type.createAndFill(w):m=m.type.create(w,m.content)}u.push(m)}o.push(e.child(l).copy(F.from(u)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new U(F.from(a),1,1)}replace(e,t=U.empty){const n=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:l}=i[o],u=e.mapping.slice(n);e.replace(u.map(a.pos),u.map(l.pos),o?U.empty:t)}const s=le.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new U(F.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=Mr.get(t),i=this.$anchorCell.start(-1),s=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const n=e.node(-1),i=Mr.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(t=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(t=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Cr(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Mr.get(e),n=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-n),s=t.colCount(this.$headCell.pos-n);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==t.width}eq(e){return e instanceof Cr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const n=e.node(-1),i=Mr.get(n),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(t.pos-s),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(t=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(t=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new Cr(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Cr(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){return new Cr(e.resolve(t),e.resolve(n))}getBookmark(){return new ux(this.$anchorCell.pos,this.$headCell.pos)}};sr.prototype.visible=!1,le.jsonID("cell",sr);var ux=class E1{constructor(e,t){this.anchor=e,this.head=t}map(e){return new E1(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&i1(t,n)?new sr(t,n):le.near(n,1)}};new Ve("fix-tables");function a1(r){const e=r.selection,t=ax(r),n=t.node(-1),i=t.start(-1),s=Mr.get(n);return{...e instanceof sr?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:n}}function cx(r){return function(e,t){if(!r1(e))return!1;if(t){const n=N0(e.schema),i=a1(e),s=e.tr,o=i.map.cellsInRect(r=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:r=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==n.header_cell&&s.setNodeMarkup(i.tableStart+o[l],n.cell,a[l].attrs);if(s.steps.length===0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],n.header_cell,a[l].attrs);t(s)}return!0}}function l1(r,e,t){const n=e.map.cellsInRect({left:0,top:0,right:r=="row"?e.map.width:1,bottom:r=="column"?e.map.height:1});for(let i=0;i<n.length;i++){const s=e.table.nodeAt(n[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function D0(r,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?cx(r):function(t,n){if(!r1(t))return!1;if(n){const i=N0(t.schema),s=a1(t),o=t.tr,a=l1("row",s,i),l=l1("column",s,i),u=(r==="column"?a:r==="row"&&l)?1:0,c=r=="column"?{left:0,top:u,right:1,bottom:s.map.height}:r=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,d=r=="column"?l?i.cell:i.header_cell:r=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(c).forEach(f=>{const h=f+s.tableStart,m=o.doc.nodeAt(h);m&&o.setNodeMarkup(h,d,m.attrs)}),n(o)}return!0}}D0("row",{useDeprecatedLogic:!0}),D0("column",{useDeprecatedLogic:!0}),D0("cell",{useDeprecatedLogic:!0});function Do(r,e){const t=r.selection;if(!(t instanceof sr))return!1;if(e){const n=r.tr,i=N0(r.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||n.replace(n.mapping.map(o+1),n.mapping.map(o+s.nodeSize-1),new U(i,0,0))}),n.docChanged&&e(n)}return!0}Wa({ArrowLeft:Ro("horiz",-1),ArrowRight:Ro("horiz",1),ArrowUp:Ro("vert",-1),ArrowDown:Ro("vert",1),"Shift-ArrowLeft":Po("horiz",-1),"Shift-ArrowRight":Po("horiz",1),"Shift-ArrowUp":Po("vert",-1),"Shift-ArrowDown":Po("vert",1),Backspace:Do,"Mod-Backspace":Do,Delete:Do,"Mod-Delete":Do});function Io(r,e,t){return t.eq(r.selection)?!1:(e&&e(r.tr.setSelection(t).scrollIntoView()),!0)}function Ro(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof sr)return Io(t,n,le.near(s.$headCell,e));if(r!="horiz"&&!s.empty)return!1;const o=u1(i,r,e);if(o==null)return!1;if(r=="horiz")return Io(t,n,le.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(o),l=s1(a,r,e);let u;return l?u=le.near(l,1):e<0?u=le.near(t.doc.resolve(a.before(-1)),-1):u=le.near(t.doc.resolve(a.after(-1)),1),Io(t,n,u)}}}function Po(r,e){return(t,n,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof sr)o=s;else{const l=u1(i,r,e);if(l==null)return!1;o=new sr(t.doc.resolve(l))}const a=s1(o.$headCell,r,e);return a?Io(t,n,new sr(o.$anchorCell,a)):!1}}function u1(r,e,t){if(!(r.state.selection instanceof de))return null;const{$head:n}=r.state.selection;for(let i=n.depth-1;i>=0;i--){const s=n.node(i);if((t<0?n.index(i):n.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=n.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return r.endOfTextblock(a)?o:null}}return null}new Ve("tableColumnResizing");function dx(r,e){const t=Math.min(r.top,e.top),n=Math.max(r.bottom,e.bottom),i=Math.min(r.left,e.left),o=Math.max(r.right,e.right)-i,a=n-t,l=i,u=t;return new DOMRect(l,u,o,a)}var hx=class{constructor({editor:r,element:e,view:t,updateDelay:n=250,resizeDelay:i=60,shouldShow:s,appendTo:o,getReferencedVirtualElement:a,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:c,state:d,from:f,to:h})=>{const{doc:m,selection:v}=d,{empty:y}=v,w=!m.textBetween(f,h).length&&Ya(d.selection),k=this.element.contains(document.activeElement);return!(!(c.hasFocus()||k)||y||w||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:c})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}c?.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(c.relatedTarget))||c?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(c,d)=>{const f=!d?.selection.eq(c.state.selection),h=!d?.doc.eq(c.state.doc);!f&&!h||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(c,f,h,d)},this.updateDelay))},this.updateHandler=(c,d,f,h)=>{const{composing:m}=c;if(m||!d&&!f)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:c})=>{c.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var u;this.editor=r,this.element=e,this.view=t,this.updateDelay=n,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=(u=l?.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const r=[];return this.floatingUIOptions.flip&&r.push(Jm(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&r.push(Ym(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&r.push(Gm(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&r.push(Qm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&r.push(Xm(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&r.push(Km(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&r.push(Zm(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&r.push(e1(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),r}get virtualElement(){var r;const{selection:e}=this.editor.state,t=(r=this.getReferencedVirtualElement)==null?void 0:r.call(this);if(t)return t;const n=Th(this.view,e.from,e.to);let i={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof ie){let s=this.view.nodeDOM(e.from);const o=s.dataset.nodeViewWrapper?s:s.querySelector("[data-node-view-wrapper]");o&&(s=o),s&&(i={getBoundingClientRect:()=>s.getBoundingClientRect(),getClientRects:()=>[s.getBoundingClientRect()]})}if(e instanceof sr){const{$anchorCell:s,$headCell:o}=e,a=s?s.pos:o.pos,l=o?o.pos:s.pos,u=this.view.nodeDOM(a),c=this.view.nodeDOM(l);if(!u||!c)return;const d=u===c?u.getBoundingClientRect():dx(u.getBoundingClientRect(),c.getBoundingClientRect());i={getBoundingClientRect:()=>d,getClientRects:()=>[d]}}return i}updatePosition(){const r=this.virtualElement;r&&t1(r,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n})=>{this.element.style.width="max-content",this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(r,e){const{state:t}=r,n=t.selection.from!==t.selection.to;if(this.updateDelay>0&&n){this.handleDebouncedUpdate(r,e);return}const i=!e?.selection.eq(r.state.selection),s=!e?.doc.eq(r.state.doc);this.updateHandler(r,i,s,e)}getShouldShow(r){var e;const{state:t}=this.view,{selection:n}=t,{ranges:i}=n,s=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:r,from:s,to:o}))||!1}show(){var r;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(r=e??this.view.dom.parentElement)==null||r.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},c1=r=>new Be({key:typeof r.pluginKey=="string"?new Ve(r.pluginKey):r.pluginKey,view:e=>new hx({view:e,...r})});xe.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[c1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var fx=class{constructor({editor:r,element:e,view:t,options:n,appendTo:i,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:a})=>{const{selection:l}=a,{$anchor:u,empty:c}=l,d=u.depth===1,f=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!o.hasFocus()||!c||!d||!f||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,a,l,u)=>{const{composing:c}=o;if(c||!a&&!l)return;if(!this.getShouldShow(u)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var a;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((a=this.element.parentNode)!=null&&a.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=r,this.element=e,this.view=t,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...n},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(r){return bh(r,{textSerializers:el(this.editor.schema)})}get middlewares(){const r=[];return this.floatingUIOptions.flip&&r.push(Jm(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&r.push(Ym(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&r.push(Gm(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&r.push(Qm(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&r.push(Xm(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&r.push(Km(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&r.push(Zm(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&r.push(e1(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),r}getShouldShow(r){var e;const{state:t}=this.view,{selection:n}=t,{ranges:i}=n,s=Math.min(...i.map(l=>l.$from.pos)),o=Math.max(...i.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:r,from:s,to:o})}updatePosition(){const{selection:r}=this.editor.state,e=Th(this.view,r.from,r.to);t1({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:n,y:i,strategy:s})=>{this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${n}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(r,e){const t=!e?.selection.eq(r.state.selection),n=!e?.doc.eq(r.state.doc);this.updateHandler(r,t,n,e)}show(){var r;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(r=e??this.view.dom.parentElement)==null||r.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},d1=r=>new Be({key:typeof r.pluginKey=="string"?new Ve(r.pluginKey):r.pluginKey,view:e=>new fx({view:e,...r})});xe.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[d1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var px=z.forwardRef(({pluginKey:r="bubbleMenu",editor:e,updateDelay:t,resizeDelay:n,appendTo:i,shouldShow:s=null,getReferencedVirtualElement:o,options:a,children:l,...u},c)=>{const d=z.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:f}=uf(),h=e||f,m={updateDelay:t,resizeDelay:n,appendTo:i,pluginKey:r,shouldShow:s,getReferencedVirtualElement:o,options:a},v=z.useRef(m);return v.current=m,z.useEffect(()=>{if(h?.isDestroyed)return;if(!h){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const y=d.current;y.style.visibility="hidden",y.style.position="absolute";const w=c1({...v.current,editor:h,element:y});h.registerPlugin(w);const k=v.current.pluginKey;return()=>{h.unregisterPlugin(k),window.requestAnimationFrame(()=>{y.parentNode&&y.parentNode.removeChild(y)})}},[h]),Ui.createPortal(J.jsx("div",{...u,children:l}),d.current)});z.forwardRef(({pluginKey:r="floatingMenu",editor:e,appendTo:t,shouldShow:n=null,options:i,children:s,...o},a)=>{const l=z.useRef(document.createElement("div"));typeof a=="function"?a(l.current):a&&(a.current=l.current);const{editor:u}=uf();return z.useEffect(()=>{const c=l.current;if(c.style.visibility="hidden",c.style.position="absolute",e?.isDestroyed||u?.isDestroyed)return;const d=e||u;if(!d){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const f=d1({editor:d,element:c,pluginKey:r,appendTo:t,shouldShow:n,options:i});return d.registerPlugin(f),()=>{d.unregisterPlugin(r),window.requestAnimationFrame(()=>{c.parentNode&&c.parentNode.removeChild(c)})}},[e,u,t,r,n,i]),Ui.createPortal(J.jsx("div",{...o,children:s}),l.current)});const mx=({editor:r})=>{if(!r)return null;const[e]=z.useState(!0),[t]=z.useState(!0);z.useEffect(()=>{r&&r.setEditable(t)},[t,r]);const n=of({editor:r,selector:i=>({isTerm:i.editor.isActive("term"),canTerm:i.editor.can().chain().focus().toggleMark("term").run(),isEm:i.editor.isActive("em"),canEm:i.editor.can().chain().focus().toggleMark("em").run(),isAlert:i.editor.isActive("alert"),canAlert:i.editor.can().chain().focus().toggleMark("alert").run()})});return J.jsx(J.Fragment,{children:r&&e&&J.jsx(px,{shouldShow:null,editor:r,options:{placement:"bottom",autoPlacement:!0,offset:8},children:J.jsxs("div",{className:"button-group",children:[J.jsx("button",{onClick:()=>r.chain().focus().toggleMark("em").run(),disabled:!n.canEm,className:n.isEm?"is-active":"",children:"<em>"}),J.jsx("button",{onClick:()=>r.chain().focus().toggleMark("term").run(),disabled:!n.canTerm,className:n.isTerm?"is-active":"",children:"<term>"}),J.jsx("button",{onClick:()=>r.chain().focus().toggleMark("alert").run(),disabled:!n.canAlert,className:n.isAlert?"is-active":"",children:"<alert>"})]})})})},h1=["abstract","acknowledgement","affiliation","appendix","article","author","backmatter","biography","book","chapter","colophon","contributor","contributors","copyright","credit","dedication","docinfo","editor","feedback","frontmatter","google","html","index","macros","mathbook","preface","pretext","references","search","shortlicense","solutions","subsection","titlepage","website"],f1=["assemblage","chapter","conclusion","introduction","objectives","outcomes","paragraphs","part","postlude","prelude","reading-questions","sbsgroup","section","stack","subsection","subsubsection","task","technology","worksheet"],p1=["activity","algorithm","answer","axiom","biblio","blockquote","case","choice","choices","claim","conjecture","console","corollary","definition","demonstration","description","example","exercise","exploration","fact","hint","image","images","insight","investigation","lemma","list","listing","note","openconjecture","openproblem","openquestion","page","poem","principle","problem","program","project","proof","proposition","question","remark","shortdescription","solution","stanza","statement","subtask","table","tabular","theorem","warning","webwork"],gx=["address","attribution","caption","cd","cell","cline","date","department","description","edition","entity","holder","idx","institution","journal","line","location","minilicense","mrow","personname","pg-macros","pubtitle","row","subtitle","support","title","usage","volume","year","xi:include"],vx=["me","men","md","mdn"],m1=["ul","ol","li","p","task","figure","sidebyside","notation","row"],zo=["latex-image-preamble","latex-image","latex-preamble","slate","sage","sageplot","asymptote","macros","prefigure","program","input","output","prompt","pre","pg-code","tikzpicture","tikz","code","c"],yx=[...h1,...f1,...p1,...m1,"xi:include"],I0=[...h1,...f1,...p1,...m1,...vx];function bx(r){let e=!1,t=r.split(/\r\n|\r|\n/g),n=[t[0].trim()];t.length>1&&n.push(t[1].trim());for(let i=2;i<t.length;i++){let s=/^<(\w\S*?)(\s.*?|>)$/.exec(t[i].trim()),o=/^<\/(\w\S*?)(\s.*?|>)(.?)$/.exec(t[i].trim());if(s&&zo.includes(s[1]))n.push(t[i]),e=!0;else if(o&&zo.includes(o[1]))n.push(t[i]),e=!1;else if(e)n.push(t[i]);else{t[i]=t[i].trim();let a=n.pop();a?n.push(a.trim()+" "+t[i]):n.push(t[i])}}return n.join(`
901
901
  `)}function wx(r,e){const n="some";let i=bx(r);console.log("Getting ready to start formatting.");for(let c of I0)if(i.includes("<"+c)){let d=new RegExp("<"+c+"(>|(\\s[^\\/]*?)>|(.*xmlns.*?)>)","g"),f=new RegExp("<\\/"+c+">([\\s\\S]*?[.,!?;:]?)","g");i=i.replace(d,`
902
902
  $&
903
903
  `),i=i.replace(f,`
@@ -910,7 +910,7 @@ $&`),i=i.replace(f,`$&
910
910
  `);else u[c].trim().startsWith("<title>")&&(u[c]+=`
911
911
  `);break;case"many":for(let c=0;c<u.length-1;c++)(u[c].trim().startsWith("</")||u[c].trim().startsWith("<")&&u[c+1].trim().startsWith("<"))&&(u[c]+=`
912
912
  `);break}return i=u.join(`
913
- `),i}const xx=Ce.create({name:"ptxFragment",topNode:!0,content:"title? introduction? chapter* section* subsection* worksheet*"}),Sx=[sw.configure({defaultLanguage:"xml"}),xx,j8,yf,Of,bf,tw,R8,ow,aw,lw,M8,C8,E8,n6.configure({mode:"deepest"}),s6,i6],g1=({content:r,onChange:e})=>{const t=z.useRef(null),n=a7({extensions:Sx,content:"",onContentError(a){console.log("Content error: ",a.error),a.disableCollaboration(),a.editor.setEditable(!1,!1)},enableContentCheck:!0,onUpdate:({editor:a})=>{t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{e(wx(uw(a.getJSON())))},500)}});z.useEffect(()=>()=>{t.current&&clearTimeout(t.current)},[]);const i=z.useRef(!0);z.useEffect(()=>{if(n&&r!==n.getHTML()&&i.current){const a=r;if(n)try{n.commands.setContent(q9(a),{emitUpdate:!1})}catch(l){console.error("Error setting content: ",l)}}},[r,n]),z.useEffect(()=>{if(!n)return;const a=()=>{i.current=!1};return n.on("update",a),()=>{n.off("update",a)}},[n]),z.useEffect(()=>{i.current=!0},[r]);const[s,o]=z.useState(!1);return z.useEffect(()=>{n&&n.setEditable(s,!1)},[n,s]),Z.jsxs("div",{className:"editor-panel",children:[Z.jsxs("div",{className:"relative mb-2 flex items-center justify-center pt-2",children:[Z.jsx("p",{className:"text-base font-medium m-0 text-center",children:"Simple Preview"}),Z.jsxs("label",{className:"absolute right-0 font-semibold",children:[Z.jsx("input",{className:"mr-2",type:"checkbox",checked:s,onChange:()=>o(!s)}),"Edit"]})]}),Z.jsx("div",{className:(s?"editable":"read-only")+" ptx-page",children:Z.jsx(r7,{editor:n})}),Z.jsx(mx,{editor:n})]})},v1=(r,e,t)=>{const n=document.createElement("form");n.method="POST",n.action=r,n.target=t,n.style.display="none";for(const i in e)if(Object.hasOwnProperty.call(e,i)){const s=document.createElement("input");s.type="hidden",s.name=i,s.value=e[i],n.appendChild(s)}document.body.appendChild(n),n.submit(),n.remove()},y1=({content:r,title:e,onRebuild:t})=>{z.useEffect(()=>{n()},[]);const n=()=>{const i=r,s=e||"Document Title";if(t){t(i,s,(a,l)=>{v1(a,l,"fullPreview")});return}};return Z.jsxs("div",{className:"pretext-plus-editor__full-preview",children:[Z.jsxs("div",{className:"pretext-plus-editor__preview-header",children:[Z.jsx("p",{className:"pretext-plus-editor__preview-title",children:"Full Preview"}),Z.jsx("button",{className:"pretext-plus-editor__rebuild-button",onClick:()=>n(),children:"Rebuild"})]}),Z.jsx("div",{className:"pretext-plus-editor__preview-container",children:Z.jsx("iframe",{className:"pretext-plus-editor__preview-iframe",name:"fullPreview"})})]})},kx=r=>{let e;return r.showPreviewModeToggle===!1?e=null:e=Z.jsxs("label",{className:"pretext-plus-editor__preview-toggle",children:[Z.jsx("input",{type:"checkbox",checked:!r.isChecked,onChange:r.onChange,className:"pretext-plus-editor__preview-toggle-input"}),Z.jsxs("div",{className:"pretext-plus-editor__preview-toggle-container",children:[Z.jsx("span",{className:"pretext-plus-editor__preview-toggle-label",children:"Simple"}),Z.jsx("span",{className:`pretext-plus-editor__preview-toggle-slider ${r.isChecked?"pretext-plus-editor__preview-toggle-slider--active":""}`,children:Z.jsx("span",{className:`pretext-plus-editor__preview-toggle-dot ${r.isChecked?"pretext-plus-editor__preview-toggle-dot--active":""}`})}),Z.jsx("span",{className:"pretext-plus-editor__preview-toggle-label",children:"Full"})]}),Z.jsx("span",{className:"pretext-plus-editor__preview-toggle-caption",children:"Preview Mode"}),Z.jsx("input",{type:"checkbox",checked:r.isChecked,onChange:r.onChange,className:"pretext-plus-editor__preview-toggle-input"})]}),Z.jsxs("div",{className:"pretext-plus-editor__menu-bar",children:[Z.jsx("div",{className:"pretext-plus-editor__menu-left",children:r.title!==void 0&&r.onTitleChange&&Z.jsxs("label",{className:"pretext-plus-editor__title-label",children:["Title"," ",Z.jsx("input",{className:"pretext-plus-editor__title-input",type:"text",value:r.title,onChange:t=>r.onTitleChange?.(t.target.value)})]})}),Z.jsxs("div",{className:"pretext-plus-editor__menu-right",children:[r.onSaveButton&&Z.jsx("button",{className:"pretext-plus-editor__button pretext-plus-editor__button--save",onClick:r.onSaveButton,children:r.saveButtonLabel||"Save"}),r.onCancelButton&&Z.jsx("button",{className:"pretext-plus-editor__button pretext-plus-editor__button--cancel",onClick:r.onCancelButton,children:r.cancelButtonLabel||"Cancel"}),e]})]})},Tx=`
913
+ `),i}const xx=Ce.create({name:"ptxFragment",topNode:!0,content:"title? introduction? chapter* section* subsection* worksheet*"}),Sx=[sw.configure({defaultLanguage:"xml"}),xx,_8,yf,Of,bf,tw,R8,ow,aw,lw,M8,C8,E8,n6.configure({mode:"deepest"}),s6,i6],g1=({content:r,onChange:e})=>{const t=z.useRef(null),n=a7({extensions:Sx,content:"",onContentError(a){console.log("Content error: ",a.error),a.disableCollaboration(),a.editor.setEditable(!1,!1)},enableContentCheck:!0,onUpdate:({editor:a})=>{t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{e(wx(uw(a.getJSON())))},500)}});z.useEffect(()=>()=>{t.current&&clearTimeout(t.current)},[]);const i=z.useRef(!0);z.useEffect(()=>{if(n&&r!==n.getHTML()&&i.current){const a=r;if(n)try{n.commands.setContent(j9(a),{emitUpdate:!1})}catch(l){console.error("Error setting content: ",l)}}},[r,n]),z.useEffect(()=>{if(!n)return;const a=()=>{i.current=!1};return n.on("update",a),()=>{n.off("update",a)}},[n]),z.useEffect(()=>{i.current=!0},[r]);const[s,o]=z.useState(!1);return z.useEffect(()=>{n&&n.setEditable(s,!1)},[n,s]),J.jsxs("div",{className:"pretext-plus-editor__visual-editor",children:[J.jsxs("div",{className:"pretext-plus-editor__visual-editor-header",children:[J.jsx("p",{className:"pretext-plus-editor__visual-editor-title",children:"Simple Preview"}),J.jsxs("label",{className:"pretext-plus-editor__edit-toggle",children:[J.jsx("input",{className:"pretext-plus-editor__edit-checkbox",type:"checkbox",checked:s,onChange:()=>o(!s)}),"Edit"]})]}),J.jsx("div",{className:(s?"editable":"read-only")+" ptx-page",children:J.jsx(r7,{editor:n})}),J.jsx(mx,{editor:n})]})},v1=(r,e,t)=>{const n=document.createElement("form");n.method="POST",n.action=r,n.target=t,n.style.display="none";for(const i in e)if(Object.hasOwnProperty.call(e,i)){const s=document.createElement("input");s.type="hidden",s.name=i,s.value=e[i],n.appendChild(s)}document.body.appendChild(n),n.submit(),n.remove()},y1=({content:r,title:e,onRebuild:t})=>{const[n,i]=z.useState(!1),s=z.useRef(null);z.useEffect(()=>{o()},[]);const o=()=>{const l=r,u=e||"Document Title";if(i(!0),t){t(l,u,(d,f)=>{v1(d,f,"fullPreview")});return}},a=()=>{i(!1)};return J.jsxs("div",{className:"pretext-plus-editor__full-preview",children:[J.jsxs("div",{className:"pretext-plus-editor__preview-header",children:[J.jsx("p",{className:"pretext-plus-editor__preview-title",children:"Full Preview"}),J.jsx("button",{className:"pretext-plus-editor__rebuild-button",onClick:()=>o(),children:"Rebuild"})]}),J.jsxs("div",{className:"pretext-plus-editor__preview-container",children:[n&&J.jsx("div",{className:"pretext-plus-editor__rebuilding-overlay",children:J.jsxs("div",{className:"pretext-plus-editor__rebuilding-popup",children:[J.jsx("div",{className:"pretext-plus-editor__spinner"}),J.jsx("p",{className:"pretext-plus-editor__rebuilding-text",children:"Rebuilding..."})]})}),J.jsx("iframe",{ref:s,className:"pretext-plus-editor__preview-iframe",name:"fullPreview",onLoad:a})]})]})},kx=r=>{let e;return r.showPreviewModeToggle===!1?e=null:e=J.jsxs("label",{className:"pretext-plus-editor__preview-toggle",children:[J.jsx("input",{type:"checkbox",checked:!r.isChecked,onChange:r.onChange,className:"pretext-plus-editor__preview-toggle-input"}),J.jsxs("div",{className:"pretext-plus-editor__preview-toggle-container",children:[J.jsx("span",{className:"pretext-plus-editor__preview-toggle-label",children:"Simple"}),J.jsx("span",{className:`pretext-plus-editor__preview-toggle-slider ${r.isChecked?"pretext-plus-editor__preview-toggle-slider--active":""}`,children:J.jsx("span",{className:`pretext-plus-editor__preview-toggle-dot ${r.isChecked?"pretext-plus-editor__preview-toggle-dot--active":""}`})}),J.jsx("span",{className:"pretext-plus-editor__preview-toggle-label",children:"Full"})]}),J.jsx("span",{className:"pretext-plus-editor__preview-toggle-caption",children:"Preview Mode"}),J.jsx("input",{type:"checkbox",checked:r.isChecked,onChange:r.onChange,className:"pretext-plus-editor__preview-toggle-input"})]}),J.jsxs("div",{className:"pretext-plus-editor__menu-bar",children:[J.jsx("div",{className:"pretext-plus-editor__menu-left",children:r.title!==void 0&&r.onTitleChange&&J.jsxs("label",{className:"pretext-plus-editor__title-label",children:["Title"," ",J.jsx("input",{className:"pretext-plus-editor__title-input",type:"text",value:r.title,onChange:t=>r.onTitleChange?.(t.target.value)})]})}),J.jsxs("div",{className:"pretext-plus-editor__menu-right",children:[r.onSaveButton&&J.jsx("button",{className:"pretext-plus-editor__button pretext-plus-editor__button--save",onClick:r.onSaveButton,children:r.saveButtonLabel||"Save"}),r.onCancelButton&&J.jsx("button",{className:"pretext-plus-editor__button pretext-plus-editor__button--cancel",onClick:r.onCancelButton,children:r.cancelButtonLabel||"Cancel"}),e]})]})},Tx=`
914
914
  <section>
915
915
  <title>My Section</title>
916
916
  <p>
@@ -989,5 +989,5 @@ $&`),i=i.replace(f,`$&
989
989
 
990
990
  <p> And that's the end of the demo. Thanks for coming!</p>
991
991
  </section>
992
- `,Mx=r=>{const[e,t]=z.useState(r.content||Tx),[n,i]=z.useState(r.title||"Document Title"),[s,o]=z.useState(!1);let a;return s&&r.onPreviewRebuild?a=Z.jsx(y1,{content:e,title:n,onRebuild:r.onPreviewRebuild}):a=Z.jsx(g1,{content:e,onChange:l=>{t(l||""),r.onContentChange(l)}}),Z.jsxs("div",{className:"pretext-plus-editor",children:[Z.jsx(kx,{isChecked:s,onChange:()=>o(!s),title:n,onTitleChange:l=>{i(l),r.onTitleChange?.(l)},onSaveButton:r.onSaveButton,saveButtonLabel:r.saveButtonLabel,onCancelButton:r.onCancelButton,cancelButtonLabel:r.cancelButtonLabel,showPreviewModeToggle:r.onPreviewRebuild!==void 0}),Z.jsxs(mu,{className:"pretext-plus-editor__splitter",children:[Z.jsx(Ko,{className:"pretext-plus-editor__editor-panel",children:Z.jsx(Nu,{content:e,onChange:l=>{t(l||""),r.onContentChange(l)}})}),Z.jsx(Ko,{className:"pretext-plus-editor__preview-panel",children:a})]})]})};Ot.CodeEditor=Nu,Ot.Editors=Mx,Ot.FullPreview=y1,Ot.VisualEditor=g1,Ot.postToIframe=v1,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})}));
992
+ `,Mx=r=>{const[e,t]=z.useState(r.content||Tx),[n,i]=z.useState(r.title||"Document Title"),[s,o]=z.useState(!1);let a;return s&&r.onPreviewRebuild?a=J.jsx(y1,{content:e,title:n,onRebuild:r.onPreviewRebuild}):a=J.jsx(g1,{content:e,onChange:l=>{t(l||""),r.onContentChange(l)}}),J.jsxs("div",{className:"pretext-plus-editor",children:[J.jsx(kx,{isChecked:s,onChange:()=>o(!s),title:n,onTitleChange:l=>{i(l),r.onTitleChange?.(l)},onSaveButton:r.onSaveButton,saveButtonLabel:r.saveButtonLabel,onCancelButton:r.onCancelButton,cancelButtonLabel:r.cancelButtonLabel,showPreviewModeToggle:r.onPreviewRebuild!==void 0}),J.jsxs(mu,{className:"pretext-plus-editor__splitter",children:[J.jsx(Ko,{className:"pretext-plus-editor__editor-panel",children:J.jsx(Nu,{content:e,onChange:l=>{t(l||""),r.onContentChange(l)}})}),J.jsx(Ko,{className:"pretext-plus-editor__preview-panel",children:a})]})]})};Ot.CodeEditor=Nu,Ot.Editors=Mx,Ot.FullPreview=y1,Ot.VisualEditor=g1,Ot.postToIframe=v1,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})}));
993
993
  //# sourceMappingURL=index.js.map