UNPKG

mathpix-markdown-it

Version:

Mathpix-markdown-it is an open source implementation of the mathpix-markdown spec written in Typescript. It relies on the following open source libraries: MathJax v3 (to render math with SVGs), markdown-it (for standard Markdown parsing)

1 lines 2.72 MB
(()=>{var __webpack_modules__={4855:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},o.apply(this,arguments)},a=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},s=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},l=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AssistiveMmlHandler=e.AssistiveMmlMathDocumentMixin=e.AssistiveMmlMathItemMixin=e.LimitedMmlVisitor=void 0;var T=n(4971),Q=n(4347),c=n(4981),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.getAttributes=function(e){return t.prototype.getAttributes.call(this,e).replace(/ ?id=".*?"/,"")},e}(Q.SerializedMmlVisitor);function d(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.assistiveMml=function(t,e){if(void 0===e&&(e=!1),!(this.state()>=T.STATE.ASSISTIVEMML)){if(!this.isEscaped&&(t.options.enableAssistiveMml||e)){var n=t.adaptor,r=t.toMML(this.root).replace(/\n */g,"").replace(/<!--.*?-->/g,""),i=n.firstChild(n.body(n.parse(r,"text/html"))),o=n.node("mjx-assistive-mml",{unselectable:"on",display:this.display?"block":"inline"},[i]);n.setAttribute(n.firstChild(this.typesetRoot),"aria-hidden","true"),n.setStyle(this.typesetRoot,"position","relative"),n.append(this.typesetRoot,o)}this.state(T.STATE.ASSISTIVEMML)}},e}(t)}function h(t){var e;return e=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=t.apply(this,s([],a(e),!1))||this,i=r.constructor,o=i.ProcessBits;return o.has("assistive-mml")||o.allocate("assistive-mml"),r.visitor=new u(r.mmlFactory),r.options.MathItem=d(r.options.MathItem),"addStyles"in r&&r.addStyles(i.assistiveStyles),r}return i(e,t),e.prototype.toMML=function(t){return this.visitor.visitTree(t)},e.prototype.assistiveMml=function(){var t,e;if(!this.processed.isSet("assistive-mml")){try{for(var n=l(this.math),r=n.next();!r.done;r=n.next()){r.value.assistiveMml(this)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.processed.set("assistive-mml")}return this},e.prototype.state=function(e,n){return void 0===n&&(n=!1),t.prototype.state.call(this,e,n),e<T.STATE.ASSISTIVEMML&&this.processed.clear("assistive-mml"),this},e}(t),e.OPTIONS=o(o({},t.OPTIONS),{enableAssistiveMml:!0,renderActions:(0,c.expandable)(o(o({},t.OPTIONS.renderActions),{assistiveMml:[T.STATE.ASSISTIVEMML]}))}),e.assistiveStyles={"mjx-assistive-mml":{position:"absolute !important",top:"0px",left:"0px",clip:"rect(1px, 1px, 1px, 1px)",padding:"1px 0px 0px 0px !important",border:"0px !important",display:"block !important",width:"auto !important",overflow:"hidden !important","-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},'mjx-assistive-mml[display="block"]':{width:"100% !important"}},e}e.LimitedMmlVisitor=u,(0,T.newState)("ASSISTIVEMML",153),e.AssistiveMmlMathItemMixin=d,e.AssistiveMmlMathDocumentMixin=h,e.AssistiveMmlHandler=function(t){return t.documentClass=h(t.documentClass),t}},2519:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLAdaptor=void 0;var a=function(t){function e(e){var n=t.call(this,e.document)||this;return n.window=e,n.parser=new e.DOMParser,n}return i(e,t),e.prototype.parse=function(t,e){return void 0===e&&(e="text/html"),this.parser.parseFromString(t,e)},e.prototype.create=function(t,e){return e?this.document.createElementNS(e,t):this.document.createElement(t)},e.prototype.text=function(t){return this.document.createTextNode(t)},e.prototype.head=function(t){return t.head||t},e.prototype.body=function(t){return t.body||t},e.prototype.root=function(t){return t.documentElement||t},e.prototype.doctype=function(t){return t.doctype?"<!DOCTYPE ".concat(t.doctype.name,">"):""},e.prototype.tags=function(t,e,n){void 0===n&&(n=null);var r=n?t.getElementsByTagNameNS(n,e):t.getElementsByTagName(e);return Array.from(r)},e.prototype.getElements=function(t,e){var n,r,i=[];try{for(var a=o(t),s=a.next();!s.done;s=a.next()){var l=s.value;"string"==typeof l?i=i.concat(Array.from(this.document.querySelectorAll(l))):Array.isArray(l)||l instanceof this.window.NodeList||l instanceof this.window.HTMLCollection?i=i.concat(Array.from(l)):i.push(l)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},e.prototype.contains=function(t,e){return t.contains(e)},e.prototype.parent=function(t){return t.parentNode},e.prototype.append=function(t,e){return t.appendChild(e)},e.prototype.insert=function(t,e){return this.parent(e).insertBefore(t,e)},e.prototype.remove=function(t){return this.parent(t).removeChild(t)},e.prototype.replace=function(t,e){return this.parent(e).replaceChild(t,e)},e.prototype.clone=function(t){return t.cloneNode(!0)},e.prototype.split=function(t,e){return t.splitText(e)},e.prototype.next=function(t){return t.nextSibling},e.prototype.previous=function(t){return t.previousSibling},e.prototype.firstChild=function(t){return t.firstChild},e.prototype.lastChild=function(t){return t.lastChild},e.prototype.childNodes=function(t){return Array.from(t.childNodes)},e.prototype.childNode=function(t,e){return t.childNodes[e]},e.prototype.kind=function(t){var e=t.nodeType;return 1===e||3===e||8===e?t.nodeName.toLowerCase():""},e.prototype.value=function(t){return t.nodeValue||""},e.prototype.textContent=function(t){return t.textContent},e.prototype.innerHTML=function(t){return t.innerHTML},e.prototype.outerHTML=function(t){return t.outerHTML},e.prototype.serializeXML=function(t){return(new this.window.XMLSerializer).serializeToString(t)},e.prototype.setAttribute=function(t,e,n,r){return void 0===r&&(r=null),r?(e=r.replace(/.*\//,"")+":"+e.replace(/^.*:/,""),t.setAttributeNS(r,e,n)):t.setAttribute(e,n)},e.prototype.getAttribute=function(t,e){return t.getAttribute(e)},e.prototype.removeAttribute=function(t,e){return t.removeAttribute(e)},e.prototype.hasAttribute=function(t,e){return t.hasAttribute(e)},e.prototype.allAttributes=function(t){return Array.from(t.attributes).map((function(t){return{name:t.name,value:t.value}}))},e.prototype.addClass=function(t,e){t.classList?t.classList.add(e):t.className=(t.className+" "+e).trim()},e.prototype.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.split(/ /).filter((function(t){return t!==e})).join(" ")},e.prototype.hasClass=function(t,e){return t.classList?t.classList.contains(e):t.className.split(/ /).indexOf(e)>=0},e.prototype.setStyle=function(t,e,n){t.style[e]=n},e.prototype.getStyle=function(t,e){return t.style[e]},e.prototype.allStyles=function(t){return t.style.cssText},e.prototype.insertRules=function(t,e){var n,r;try{for(var i=o(e.reverse()),a=i.next();!a.done;a=i.next()){var s=a.value;try{t.sheet.insertRule(s,0)}catch(t){console.warn("MathJax: can't insert css rule '".concat(s,"': ").concat(t.message))}}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},e.prototype.fontSize=function(t){var e=this.window.getComputedStyle(t);return parseFloat(e.fontSize)},e.prototype.fontFamily=function(t){return this.window.getComputedStyle(t).fontFamily||""},e.prototype.nodeSize=function(t,e,n){if(void 0===e&&(e=1),void 0===n&&(n=!1),n&&t.getBBox){var r=t.getBBox();return[r.width/e,r.height/e]}return[t.offsetWidth/e,t.offsetHeight/e]},e.prototype.nodeBBox=function(t){var e=t.getBoundingClientRect();return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},e}(n(1747).AbstractDOMAdaptor);e.HTMLAdaptor=a},7936:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},o.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.NodeMixin=e.NodeMixinOptions=void 0;var a=n(4981);e.NodeMixinOptions={badCSS:!0,badSizes:!0},e.NodeMixin=function(t,n){var r;return void 0===n&&(n={}),n=(0,a.userOptions)((0,a.defaultOptions)({},e.NodeMixinOptions),n),r=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=t.call(this,e[0])||this,i=r.constructor;return r.options=(0,a.userOptions)((0,a.defaultOptions)({},i.OPTIONS),e[1]),r}return i(e,t),e.prototype.fontSize=function(e){return n.badCSS?this.options.fontSize:t.prototype.fontSize.call(this,e)},e.prototype.fontFamily=function(e){return n.badCSS?this.options.fontFamily:t.prototype.fontFamily.call(this,e)},e.prototype.nodeSize=function(r,i,o){if(void 0===i&&(i=1),void 0===o&&(o=null),!n.badSizes)return t.prototype.nodeSize.call(this,r,i,o);var a=this.textContent(r),s=Array.from(a.replace(e.cjkPattern,"")).length;return[(Array.from(a).length-s)*this.options.cjkCharWidth+s*this.options.unknownCharWidth,this.options.unknownCharHeight]},e.prototype.nodeBBox=function(e){return n.badSizes?{left:0,right:0,top:0,bottom:0}:t.prototype.nodeBBox.call(this,e)},e}(t),r.OPTIONS=o(o({},n.badCSS?{fontSize:16,fontFamily:"Times"}:{}),n.badSizes?{cjkCharWidth:1,unknownCharWidth:.6,unknownCharHeight:.8}:{}),r.cjkPattern=new RegExp(["[","ᄀ-ᅟ","〈〉","⺀-〾","぀-㉇","㉐-䶿","一-꓆","ꥠ-ꥼ","가-힣","豈-﫿","︐-︙","︰-﹫","!-⦆¢-₩","𛀀-𛀁","🈀-🉑","𠀀-𿿽","]"].join(""),"gu"),r}},9400:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.browserAdaptor=void 0;var r=n(2519);e.browserAdaptor=function(){return new r.HTMLAdaptor(window)}},4933:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LiteDocument=void 0;var r=n(5450),i=function(){function t(){this.root=new r.LiteElement("html",{},[this.head=new r.LiteElement("head"),this.body=new r.LiteElement("body")]),this.type=""}return Object.defineProperty(t.prototype,"kind",{get:function(){return"#document"},enumerable:!1,configurable:!0}),t}();e.LiteDocument=i},5450:function(t,e){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)},r=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.LiteElement=void 0;var a=function(t,e,a){var s,l;void 0===e&&(e={}),void 0===a&&(a=[]),this.kind=t,this.attributes=n({},e),this.children=i([],r(a),!1);try{for(var T=o(this.children),Q=T.next();!Q.done;Q=T.next())Q.value.parent=this}catch(t){s={error:t}}finally{try{Q&&!Q.done&&(l=T.return)&&l.call(T)}finally{if(s)throw s.error}}this.styles=null};e.LiteElement=a},3764:function(t,e){"use strict";var n=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},r=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.LiteList=void 0;var i=function(){function t(t){this.nodes=[],this.nodes=r([],n(t),!1)}return t.prototype.append=function(t){this.nodes.push(t)},t.prototype[Symbol.iterator]=function(){var t=0;return{next:function(){return t===this.nodes.length?{value:null,done:!0}:{value:this.nodes[t++],done:!1}}}},t}();e.LiteList=i},4263:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},a=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.LiteParser=e.PATTERNS=void 0;var l,T=o(n(8316)),Q=n(5450),c=n(8863);!function(t){t.TAGNAME="[a-z][^\\s\\n>]*",t.ATTNAME="[a-z][^\\s\\n>=]*",t.VALUE="(?:'[^']*'|\"[^\"]*\"|[^\\s\\n]+)",t.VALUESPLIT="(?:'([^']*)'|\"([^\"]*)\"|([^\\s\\n]+))",t.SPACE="(?:\\s|\\n)+",t.OPTIONALSPACE="(?:\\s|\\n)*",t.ATTRIBUTE=t.ATTNAME+"(?:"+t.OPTIONALSPACE+"="+t.OPTIONALSPACE+t.VALUE+")?",t.ATTRIBUTESPLIT="("+t.ATTNAME+")(?:"+t.OPTIONALSPACE+"="+t.OPTIONALSPACE+t.VALUESPLIT+")?",t.TAG="(<(?:"+t.TAGNAME+"(?:"+t.SPACE+t.ATTRIBUTE+")*"+t.OPTIONALSPACE+"/?|/"+t.TAGNAME+"|!--[^]*?--|![^]*?)(?:>|$))",t.tag=new RegExp(t.TAG,"i"),t.attr=new RegExp(t.ATTRIBUTE,"i"),t.attrsplit=new RegExp(t.ATTRIBUTESPLIT,"i")}(l=e.PATTERNS||(e.PATTERNS={}));var u=function(){function t(){}return t.prototype.parseFromString=function(t,e,n){void 0===e&&(e="text/html"),void 0===n&&(n=null);for(var r=n.createDocument(),i=n.body(r),o=t.replace(/<\?.*?\?>/g,"").split(l.tag);o.length;){var a=o.shift(),s=o.shift();a&&this.addText(n,i,a),s&&">"===s.charAt(s.length-1)&&("!"===s.charAt(1)?this.addComment(n,i,s):i="/"===s.charAt(1)?this.closeTag(n,i,s):this.openTag(n,i,s,o))}return this.checkDocument(n,r),r},t.prototype.addText=function(t,e,n){return n=T.translate(n),t.append(e,t.text(n))},t.prototype.addComment=function(t,e,n){return t.append(e,new c.LiteComment(n))},t.prototype.closeTag=function(t,e,n){for(var r=n.slice(2,n.length-1).toLowerCase();t.parent(e)&&t.kind(e)!==r;)e=t.parent(e);return t.parent(e)},t.prototype.openTag=function(t,e,n,r){var i=this.constructor.PCDATA,o=this.constructor.SELF_CLOSING,a=n.match(/<(.*?)[\s\n>\/]/)[1].toLowerCase(),s=t.node(a),T=n.replace(/^<.*?[\s\n>]/,"").split(l.attrsplit);return(T.pop().match(/>$/)||T.length<5)&&(this.addAttributes(t,s,T),t.append(e,s),o[a]||n.match(/\/>$/)||(i[a]?this.handlePCDATA(t,s,a,r):e=s)),e},t.prototype.addAttributes=function(t,e,n){for(var r=this.constructor.CDATA_ATTR;n.length;){var i=a(n.splice(0,5),5),o=i[1],s=i[2],l=i[3],Q=i[4],c=s||l||Q||"";r[o]||(c=T.translate(c)),t.setAttribute(e,o,c)}},t.prototype.handlePCDATA=function(t,e,n,r){for(var i=[],o="</"+n+">",a="";r.length&&a!==o;)i.push(a),i.push(r.shift()),a=r.shift();t.append(e,t.text(i.join("")))},t.prototype.checkDocument=function(t,e){var n,r,i,o,a=this.getOnlyChild(t,t.body(e));if(a){try{for(var l=s(t.childNodes(t.body(e))),T=l.next();!T.done;T=l.next()){if((d=T.value)===a)break;d instanceof c.LiteComment&&d.value.match(/^<!DOCTYPE/)&&(e.type=d.value)}}catch(t){n={error:t}}finally{try{T&&!T.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}switch(t.kind(a)){case"html":try{for(var Q=s(a.children),u=Q.next();!u.done;u=Q.next()){var d=u.value;switch(t.kind(d)){case"head":e.head=d;break;case"body":e.body=d}}}catch(t){i={error:t}}finally{try{u&&!u.done&&(o=Q.return)&&o.call(Q)}finally{if(i)throw i.error}}e.root=a,t.remove(a),t.parent(e.body)!==a&&t.append(a,e.body),t.parent(e.head)!==a&&t.insert(e.head,e.body);break;case"head":e.head=t.replace(a,e.head);break;case"body":e.body=t.replace(a,e.body)}}},t.prototype.getOnlyChild=function(t,e){var n,r,i=null;try{for(var o=s(t.childNodes(e)),a=o.next();!a.done;a=o.next()){var l=a.value;if(l instanceof Q.LiteElement){if(i)return null;i=l}}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},t.prototype.serialize=function(t,e,n){var r=this;void 0===n&&(n=!1);var i=this.constructor.SELF_CLOSING,o=this.constructor.CDATA_ATTR,a=t.kind(e),s=t.allAttributes(e).map((function(t){return t.name+'="'+(o[t.name]?t.value:r.protectAttribute(t.value))+'"'})).join(" "),l=this.serializeInner(t,e,n);return"<"+a+(s?" "+s:"")+(n&&!l||i[a]?n?"/>":">":">".concat(l,"</").concat(a,">"))},t.prototype.serializeInner=function(t,e,n){var r=this;return void 0===n&&(n=!1),this.constructor.PCDATA.hasOwnProperty(e.kind)?t.childNodes(e).map((function(e){return t.value(e)})).join(""):t.childNodes(e).map((function(e){var i=t.kind(e);return"#text"===i?r.protectHTML(t.value(e)):"#comment"===i?e.value:r.serialize(t,e,n)})).join("")},t.prototype.protectAttribute=function(t){return"string"!=typeof t&&(t=String(t)),t.replace(/"/g,"&quot;")},t.prototype.protectHTML=function(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},t.SELF_CLOSING={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},t.PCDATA={option:!0,textarea:!0,fieldset:!0,title:!0,style:!0,script:!0},t.CDATA_ATTR={style:!0,datafld:!0,datasrc:!0,href:!0,src:!0,longdesc:!0,usemap:!0,cite:!0,datetime:!0,action:!0,axis:!0,profile:!0,content:!0,scheme:!0},t}();e.LiteParser=u},8863:function(t,e){"use strict";var n,r=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.LiteComment=e.LiteText=void 0;var i=function(){function t(t){void 0===t&&(t=""),this.value=t}return Object.defineProperty(t.prototype,"kind",{get:function(){return"#text"},enumerable:!1,configurable:!0}),t}();e.LiteText=i;var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"#comment"},enumerable:!1,configurable:!0}),e}(i);e.LiteComment=o},7191:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LiteWindow=void 0;var r=n(5450),i=n(4933),o=n(3764),a=n(4263),s=function(){this.DOMParser=a.LiteParser,this.NodeList=o.LiteList,this.HTMLCollection=o.LiteList,this.HTMLElement=r.LiteElement,this.DocumentFragment=o.LiteList,this.Document=i.LiteDocument,this.document=new i.LiteDocument};e.LiteWindow=s},984:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},o.apply(this,arguments)},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},l=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.liteAdaptor=e.LiteAdaptor=e.LiteBase=void 0;var T=n(1747),Q=n(7936),c=n(4933),u=n(5450),d=n(8863),h=n(7191),p=n(4263),m=n(4161),f=function(t){function e(){var e=t.call(this)||this;return e.parser=new p.LiteParser,e.window=new h.LiteWindow,e}return i(e,t),e.prototype.parse=function(t,e){return this.parser.parseFromString(t,e,this)},e.prototype.create=function(t,e){return void 0===e&&(e=null),new u.LiteElement(t)},e.prototype.text=function(t){return new d.LiteText(t)},e.prototype.comment=function(t){return new d.LiteComment(t)},e.prototype.createDocument=function(){return new c.LiteDocument},e.prototype.head=function(t){return t.head},e.prototype.body=function(t){return t.body},e.prototype.root=function(t){return t.root},e.prototype.doctype=function(t){return t.type},e.prototype.tags=function(t,e,n){void 0===n&&(n=null);var r=[],i=[];if(n)return i;for(var o=t;o;){var a=o.kind;"#text"!==a&&"#comment"!==a&&(a===e&&i.push(o),o.children.length&&(r=o.children.concat(r))),o=r.shift()}return i},e.prototype.elementById=function(t,e){for(var n=[],r=t;r;){if("#text"!==r.kind&&"#comment"!==r.kind){if(r.attributes.id===e)return r;r.children.length&&(n=r.children.concat(n))}r=n.shift()}return null},e.prototype.elementsByClass=function(t,e){for(var n=[],r=[],i=t;i;){if("#text"!==i.kind&&"#comment"!==i.kind)(i.attributes.class||"").trim().split(/ +/).includes(e)&&r.push(i),i.children.length&&(n=i.children.concat(n));i=n.shift()}return r},e.prototype.getElements=function(t,e){var n,r,i=[],o=this.body(e);try{for(var s=a(t),l=s.next();!l.done;l=s.next()){var T=l.value;if("string"==typeof T)if("#"===T.charAt(0)){var Q=this.elementById(o,T.slice(1));Q&&i.push(Q)}else"."===T.charAt(0)?i=i.concat(this.elementsByClass(o,T.slice(1))):T.match(/^[-a-z][-a-z0-9]*$/i)&&(i=i.concat(this.tags(o,T)));else Array.isArray(T)?i=i.concat(T):T instanceof this.window.NodeList||T instanceof this.window.HTMLCollection?i=i.concat(T.nodes):i.push(T)}}catch(t){n={error:t}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i},e.prototype.contains=function(t,e){for(;e&&e!==t;)e=this.parent(e);return!!e},e.prototype.parent=function(t){return t.parent},e.prototype.childIndex=function(t){return t.parent?t.parent.children.findIndex((function(e){return e===t})):-1},e.prototype.append=function(t,e){return e.parent&&this.remove(e),t.children.push(e),e.parent=t,e},e.prototype.insert=function(t,e){if(t.parent&&this.remove(t),e&&e.parent){var n=this.childIndex(e);e.parent.children.splice(n,0,t),t.parent=e.parent}},e.prototype.remove=function(t){var e=this.childIndex(t);return e>=0&&t.parent.children.splice(e,1),t.parent=null,t},e.prototype.replace=function(t,e){var n=this.childIndex(e);return n>=0&&(e.parent.children[n]=t,t.parent=e.parent,e.parent=null),e},e.prototype.clone=function(t){var e=this,n=new u.LiteElement(t.kind);return n.attributes=o({},t.attributes),n.children=t.children.map((function(t){if("#text"===t.kind)return new d.LiteText(t.value);if("#comment"===t.kind)return new d.LiteComment(t.value);var r=e.clone(t);return r.parent=n,r})),n},e.prototype.split=function(t,e){var n=new d.LiteText(t.value.slice(e));return t.value=t.value.slice(0,e),t.parent.children.splice(this.childIndex(t)+1,0,n),n.parent=t.parent,n},e.prototype.next=function(t){var e=t.parent;if(!e)return null;var n=this.childIndex(t)+1;return n>=0&&n<e.children.length?e.children[n]:null},e.prototype.previous=function(t){var e=t.parent;if(!e)return null;var n=this.childIndex(t)-1;return n>=0?e.children[n]:null},e.prototype.firstChild=function(t){return t.children[0]},e.prototype.lastChild=function(t){return t.children[t.children.length-1]},e.prototype.childNodes=function(t){return l([],s(t.children),!1)},e.prototype.childNode=function(t,e){return t.children[e]},e.prototype.kind=function(t){return t.kind},e.prototype.value=function(t){return"#text"===t.kind?t.value:"#comment"===t.kind?t.value.replace(/^<!(--)?((?:.|\n)*)\1>$/,"$2"):""},e.prototype.textContent=function(t){var e=this;return t.children.reduce((function(t,n){return t+("#text"===n.kind?n.value:"#comment"===n.kind?"":e.textContent(n))}),"")},e.prototype.innerHTML=function(t){return this.parser.serializeInner(this,t)},e.prototype.outerHTML=function(t){return this.parser.serialize(this,t)},e.prototype.serializeXML=function(t){return this.parser.serialize(this,t,!0)},e.prototype.setAttribute=function(t,e,n,r){void 0===r&&(r=null),"string"!=typeof n&&(n=String(n)),r&&(e=r.replace(/.*\//,"")+":"+e.replace(/^.*:/,"")),t.attributes[e]=n,"style"===e&&(t.styles=null)},e.prototype.getAttribute=function(t,e){return t.attributes[e]},e.prototype.removeAttribute=function(t,e){delete t.attributes[e]},e.prototype.hasAttribute=function(t,e){return t.attributes.hasOwnProperty(e)},e.prototype.allAttributes=function(t){var e,n,r=t.attributes,i=[];try{for(var o=a(Object.keys(r)),s=o.next();!s.done;s=o.next()){var l=s.value;i.push({name:l,value:r[l]})}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return i},e.prototype.addClass=function(t,e){var n=(t.attributes.class||"").split(/ /);n.find((function(t){return t===e}))||(n.push(e),t.attributes.class=n.join(" "))},e.prototype.removeClass=function(t,e){var n=(t.attributes.class||"").split(/ /),r=n.findIndex((function(t){return t===e}));r>=0&&(n.splice(r,1),t.attributes.class=n.join(" "))},e.prototype.hasClass=function(t,e){return!!(t.attributes.class||"").split(/ /).find((function(t){return t===e}))},e.prototype.setStyle=function(t,e,n){t.styles||(t.styles=new m.Styles(this.getAttribute(t,"style"))),t.styles.set(e,n),t.attributes.style=t.styles.cssText},e.prototype.getStyle=function(t,e){if(!t.styles){var n=this.getAttribute(t,"style");if(!n)return"";t.styles=new m.Styles(n)}return t.styles.get(e)},e.prototype.allStyles=function(t){return this.getAttribute(t,"style")},e.prototype.insertRules=function(t,e){t.children=[this.text(e.join("\n\n")+"\n\n"+this.textContent(t))]},e.prototype.fontSize=function(t){return 0},e.prototype.fontFamily=function(t){return""},e.prototype.nodeSize=function(t,e,n){return void 0===e&&(e=1),void 0===n&&(n=null),[0,0]},e.prototype.nodeBBox=function(t){return{left:0,right:0,top:0,bottom:0}},e}(T.AbstractDOMAdaptor);e.LiteBase=f;var y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}((0,Q.NodeMixin)(f));e.LiteAdaptor=y,e.liteAdaptor=function(t){return void 0===t&&(t=null),new y(null,t)}},1471:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION="3.2.2"},1747:function(t,e){"use strict";var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractDOMAdaptor=void 0;var r=function(){function t(t){void 0===t&&(t=null),this.document=t}return t.prototype.node=function(t,e,r,i){var o,a;void 0===e&&(e={}),void 0===r&&(r=[]);var s=this.create(t,i);this.setAttributes(s,e);try{for(var l=n(r),T=l.next();!T.done;T=l.next()){var Q=T.value;this.append(s,Q)}}catch(t){o={error:t}}finally{try{T&&!T.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}return s},t.prototype.setAttributes=function(t,e){var r,i,o,a,s,l;if(e.style&&"string"!=typeof e.style)try{for(var T=n(Object.keys(e.style)),Q=T.next();!Q.done;Q=T.next()){var c=Q.value;this.setStyle(t,c.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()})),e.style[c])}}catch(t){r={error:t}}finally{try{Q&&!Q.done&&(i=T.return)&&i.call(T)}finally{if(r)throw r.error}}if(e.properties)try{for(var u=n(Object.keys(e.properties)),d=u.next();!d.done;d=u.next()){t[c=d.value]=e.properties[c]}}catch(t){o={error:t}}finally{try{d&&!d.done&&(a=u.return)&&a.call(u)}finally{if(o)throw o.error}}try{for(var h=n(Object.keys(e)),p=h.next();!p.done;p=h.next()){"style"===(c=p.value)&&"string"!=typeof e.style||"properties"===c||this.setAttribute(t,c,e[c])}}catch(t){s={error:t}}finally{try{p&&!p.done&&(l=h.return)&&l.call(h)}finally{if(s)throw s.error}}},t.prototype.replace=function(t,e){return this.insert(t,e),this.remove(e),e},t.prototype.childNode=function(t,e){return this.childNodes(t)[e]},t.prototype.allClasses=function(t){var e=this.getAttribute(t,"class");return e?e.replace(/ +/g," ").replace(/^ /,"").replace(/ $/,"").split(/ /):[]},t}();e.AbstractDOMAdaptor=r},8499:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractFindMath=void 0;var r=n(4981),i=function(){function t(t){var e=this.constructor;this.options=(0,r.userOptions)((0,r.defaultOptions)({},e.OPTIONS),t)}return t.OPTIONS={},t}();e.AbstractFindMath=i},780:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractHandler=void 0;var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(n(2878).AbstractMathDocument),a=function(){function t(t,e){void 0===e&&(e=5),this.documentClass=o,this.adaptor=t,this.priority=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),t.prototype.handlesDocument=function(t){return!1},t.prototype.create=function(t,e){return new this.documentClass(t,this.adaptor,e)},t.NAME="generic",t}();e.AbstractHandler=a},9796:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.HandlerList=void 0;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.register=function(t){return this.add(t,t.priority)},e.prototype.unregister=function(t){this.remove(t)},e.prototype.handlesDocument=function(t){var e,n;try{for(var r=o(this),i=r.next();!i.done;i=r.next()){var a=i.value.item;if(a.handlesDocument(t))return a}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}throw new Error("Can't find handler for document")},e.prototype.document=function(t,e){return void 0===e&&(e=null),this.handlesDocument(t).create(t,e)},e}(n(2776).PrioritizedList);e.HandlerList=a},7137:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractInputJax=void 0;var r=n(4981),i=n(3899),o=function(){function t(t){void 0===t&&(t={}),this.adaptor=null,this.mmlFactory=null;var e=this.constructor;this.options=(0,r.userOptions)((0,r.defaultOptions)({},e.OPTIONS),t),this.preFilters=new i.FunctionList,this.postFilters=new i.FunctionList}return Object.defineProperty(t.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),t.prototype.setAdaptor=function(t){this.adaptor=t},t.prototype.setMmlFactory=function(t){this.mmlFactory=t},t.prototype.initialize=function(){},t.prototype.reset=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},Object.defineProperty(t.prototype,"processStrings",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.findMath=function(t,e){return[]},t.prototype.executeFilters=function(t,e,n,r){var i={math:e,document:n,data:r};return t.execute(i),i.data},t.NAME="generic",t.OPTIONS={},t}();e.AbstractInputJax=o},2878:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},s=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMathDocument=e.resetAllOptions=e.resetOptions=e.RenderList=void 0;var l=n(4981),T=n(7137),Q=n(3380),c=n(6808),u=n(4971),d=n(4001),h=n(8578),p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.create=function(t){var e,n,r=new this;try{for(var i=o(Object.keys(t)),s=i.next();!s.done;s=i.next()){var l=s.value,T=a(this.action(l,t[l]),2),Q=T[0],c=T[1];c&&r.add(Q,c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},e.action=function(t,e){var n,r,i,o,s,l,T=!0,Q=e[0];if(1===e.length||"boolean"==typeof e[1])2===e.length&&(T=e[1]),s=(n=a(this.methodActions(t),2))[0],l=n[1];else if("string"==typeof e[1])if("string"==typeof e[2]){4===e.length&&(T=e[3]);var c=a(e.slice(1),2),u=c[0],d=c[1];s=(r=a(this.methodActions(u,d),2))[0],l=r[1]}else 3===e.length&&(T=e[2]),s=(i=a(this.methodActions(e[1]),2))[0],l=i[1];else 4===e.length&&(T=e[3]),s=(o=a(e.slice(1),2))[0],l=o[1];return[{id:t,renderDoc:s,renderMath:l,convert:T},Q]},e.methodActions=function(t,e){return void 0===e&&(e=t),[function(e){return t&&e[t](),!1},function(t,n){return e&&t[e](n),!1}]},e.prototype.renderDoc=function(t,e){var n,r;void 0===e&&(e=u.STATE.UNPROCESSED);try{for(var i=o(this.items),a=i.next();!a.done;a=i.next()){var s=a.value;if(s.priority>=e&&s.item.renderDoc(t))return}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},e.prototype.renderMath=function(t,e,n){var r,i;void 0===n&&(n=u.STATE.UNPROCESSED);try{for(var a=o(this.items),s=a.next();!s.done;s=a.next()){var l=s.value;if(l.priority>=n&&l.item.renderMath(t,e))return}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},e.prototype.renderConvert=function(t,e,n){var r,i;void 0===n&&(n=u.STATE.LAST);try{for(var a=o(this.items),s=a.next();!s.done;s=a.next()){var l=s.value;if(l.priority>n)return;if(l.item.convert&&l.item.renderMath(t,e))return}}catch(t){r={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}},e.prototype.findID=function(t){var e,n;try{for(var r=o(this.items),i=r.next();!i.done;i=r.next()){var a=i.value;if(a.item.id===t)return a.item}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return null},e}(n(2776).PrioritizedList);e.RenderList=p,e.resetOptions={all:!1,processed:!1,inputJax:null,outputJax:null},e.resetAllOptions={all:!0,processed:!0,inputJax:[],outputJax:[]};var m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.compile=function(t){return null},e}(T.AbstractInputJax),f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.typeset=function(t,e){return void 0===e&&(e=null),null},e.prototype.escaped=function(t,e){return null},e}(Q.AbstractOutputJax),y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(c.AbstractMathList),g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(u.AbstractMathItem),L=function(){function t(e,n,r){var i=this,o=this.constructor;this.document=e,this.options=(0,l.userOptions)((0,l.defaultOptions)({},o.OPTIONS),r),this.math=new(this.options.MathList||y),this.renderActions=p.create(this.options.renderActions),this.processed=new t.ProcessBits,this.outputJax=this.options.OutputJax||new f;var a=this.options.InputJax||[new m];Array.isArray(a)||(a=[a]),this.inputJax=a,this.adaptor=n,this.outputJax.setAdaptor(n),this.inputJax.map((function(t){return t.setAdaptor(n)})),this.mmlFactory=this.options.MmlFactory||new d.MmlFactory,this.inputJax.map((function(t){return t.setMmlFactory(i.mmlFactory)})),this.outputJax.initialize(),this.inputJax.map((function(t){return t.initialize()}))}return Object.defineProperty(t.prototype,"kind",{get:function(){return this.constructor.KIND},enumerable:!1,configurable:!0}),t.prototype.addRenderAction=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=a(p.action(t,e),2),i=r[0],o=r[1];this.renderActions.add(i,o)},t.prototype.removeRenderAction=function(t){var e=this.renderActions.findID(t);e&&this.renderActions.remove(e)},t.prototype.render=function(){return this.renderActions.renderDoc(this),this},t.prototype.rerender=function(t){return void 0===t&&(t=u.STATE.RERENDER),this.state(t-1),this.render(),this},t.prototype.convert=function(t,e){void 0===e&&(e={});var n=(0,l.userOptions)({format:this.inputJax[0].name,display:!0,end:u.STATE.LAST,em:16,ex:8,containerWidth:null,lineWidth:1e6,scale:1,family:""},e),r=n.format,i=n.display,o=n.end,a=n.ex,s=n.em,T=n.containerWidth,Q=n.lineWidth,c=n.scale,d=n.family;null===T&&(T=80*a);var h=this.inputJax.reduce((function(t,e){return e.name===r?e:t}),null),p=new this.options.MathItem(t,h,i);return p.start.node=this.adaptor.body(this.document),p.setMetrics(s,a,T,Q,c),this.outputJax.options.mtextInheritFont&&(p.outputData.mtextFamily=d),this.outputJax.options.merrorInheritFont&&(p.outputData.merrorFamily=d),p.convert(this,o),p.typesetRoot||p.root},t.prototype.findMath=function(t){return void 0===t&&(t=null),this.processed.set("findMath"),this},t.prototype.compile=function(){var t,e,n,r;if(!this.processed.isSet("compile")){var i=[];try{for(var a=o(this.math),s=a.next();!s.done;s=a.next()){var l=s.value;this.compileMath(l),void 0!==l.inputData.recompile&&i.push(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}try{for(var T=o(i),Q=T.next();!Q.done;Q=T.next()){var c=(l=Q.value).inputData.recompile;l.state(c.state),l.inputData.recompile=c,this.compileMath(l)}}catch(t){n={error:t}}finally{try{Q&&!Q.done&&(r=T.return)&&r.call(T)}finally{if(n)throw n.error}}this.processed.set("compile")}return this},t.prototype.compileMath=function(t){try{t.compile(this)}catch(e){if(e.retry||e.restart)throw e;this.options.compileError(this,t,e),t.inputData.error=e}},t.prototype.compileError=function(t,e){t.root=this.mmlFactory.create("math",null,[this.mmlFactory.create("merror",{"data-mjx-error":e.message,title:e.message},[this.mmlFactory.create("mtext",null,[this.mmlFactory.create("text").setText("Math input error")])])]),t.display&&t.root.attributes.set("display","block"),t.inputData.error=e.message},t.prototype.typeset=function(){var t,e;if(!this.processed.isSet("typeset")){try{for(var n=o(this.math),r=n.next();!r.done;r=n.next()){var i=r.value;try{i.typeset(this)}catch(t){if(t.retry||t.restart)throw t;this.options.typesetError(this,i,t),i.outputData.error=t}}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.processed.set("typeset")}return this},t.prototype.typesetError=function(t,e){t.typesetRoot=this.adaptor.node("mjx-container",{class:"MathJax mjx-output-error",jax:this.outputJax.name},[this.adaptor.node("span",{"data-mjx-error":e.message,title:e.message,style:{color:"red","background-color":"yellow","line-height":"normal"}},[this.adaptor.text("Math output error")])]),t.display&&this.adaptor.setAttributes(t.typesetRoot,{style:{display:"block",margin:"1em 0","text-align":"center"}}),t.outputData.error=e.message},t.prototype.getMetrics=function(){return this.processed.isSet("getMetrics")||(this.outputJax.getMetrics(this),this.processed.set("getMetrics")),this},t.prototype.updateDocument=function(){var t,e;if(!this.processed.isSet("updateDocument")){try{for(var n=o(this.math.reversed()),r=n.next();!r.done;r=n.next()){r.value.updateDocument(this)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.processed.set("updateDocument")}return this},t.prototype.removeFromDocument=function(t){return void 0===t&&(t=!1),this},t.prototype.state=function(t,e){var n,r;void 0===e&&(e=!1);try{for(var i=o(this.math),a=i.next();!a.done;a=i.next()){a.value.state(t,e)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return t<u.STATE.INSERTED&&this.processed.clear("updateDocument"),t<u.STATE.TYPESET&&(this.processed.clear("typeset"),this.processed.clear("getMetrics")),t<u.STATE.COMPILED&&this.processed.clear("compile"),this},t.prototype.reset=function(t){var n;return void 0===t&&(t={processed:!0}),(t=(0,l.userOptions)(Object.assign({},e.resetOptions),t)).all&&Object.assign(t,e.resetAllOptions),t.processed&&this.processed.reset(),t.inputJax&&this.inputJax.forEach((function(e){return e.reset.apply(e,s([],a(t.inputJax),!1))})),t.outputJax&&(n=this.outputJax).reset.apply(n,s([],a(t.outputJax),!1)),this},t.prototype.clear=function(){return this.reset(),this.math.clear(),this},t.prototype.concat=function(t){return this.math.merge(t),this},t.prototype.clearMathItemsWithin=function(t){var e,n=this.getMathItemsWithin(t);return(e=this.math).remove.apply(e,s([],a(n),!1)),n},t.prototype.getMathItemsWithin=function(t){var e,n,r,i;Array.isArray(t)||(t=[t]);var a=this.adaptor,s=[],l=a.getElements(t,this.document);try{t:for(var T=o(this.math),Q=T.next();!Q.done;Q=T.next()){var c=Q.value;try{for(var u=(r=void 0,o(l)),d=u.next();!d.done;d=u.next()){var h=d.value;if(c.start.node&&a.contains(h,c.start.node)){s.push(c);continue t}}}catch(t){r={error:t}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{Q&&!Q.done&&(n=T.return)&&n.call(T)}finally{if(e)throw e.error}}return s},t.KIND="MathDocument",t.OPTIONS={OutputJax:null,InputJax:null,MmlFactory:null,MathList:y,MathItem:g,compileError:function(t,e,n){t.compileError(e,n)},typesetError:function(t,e,n){t.typesetError(e,n)},renderActions:(0,l.expandable)({find:[u.STATE.FINDMATH,"findMath","",!1],compile:[u.STATE.COMPILED],metrics:[u.STATE.METRICS,"getMetrics","",!1],typeset:[u.STATE.TYPESET],update:[u.STATE.INSERTED,"updateDocument",!1]})},t.ProcessBits=(0,h.BitFieldClass)("findMath","compile","getMetrics","typeset","updateDocument"),t}();e.AbstractMathDocument=L},4971:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.newState=e.STATE=e.AbstractMathItem=e.protoItem=void 0,e.protoItem=function(t,e,n,r,i,o,a){return void 0===a&&(a=null),{open:t,math:e,close:n,n:r,start:{n:i},end:{n:o},display:a}};var n=function(){function t(t,n,r,i,o){void 0===r&&(r=!0),void 0===i&&(i={i:0,n:0,delim:""}),void 0===o&&(o={i:0,n:0,delim:""}),this.root=null,this.typesetRoot=null,this.metrics={},this.inputData={},this.outputData={},this._state=e.STATE.UNPROCESSED,this.math=t,this.inputJax=n,this.display=r,this.start=i,this.end=o,this.root=null,this.typesetRoot=null,this.metrics={},this.inputData={},this.outputData={}}return Object.defineProperty(t.prototype,"isEscaped",{get:function(){return null===this.display},enumerable:!1,configurable:!0}),t.prototype.render=function(t){t.renderActions.renderMath(this,t)},t.prototype.rerender=function(t,n){void 0===n&&(n=e.STATE.RERENDER),this.state()>=n&&this.state(n-1),t.renderActions.renderMath(this,t,n)},t.prototype.convert=function(t,n){void 0===n&&(n=e.STATE.LAST),t.renderActions.renderConvert(this,t,n)},t.prototype.compile=function(t){this.state()<e.STATE.COMPILED&&(this.root=this.inputJax.compile(this,t),this.state(e.STATE.COMPILED))},t.prototype.typeset=function(t){this.state()<e.STATE.TYPESET&&(this.typesetRoot=t.outputJax[this.isEscaped?"escaped":"typeset"](this,t),this.state(e.STATE.TYPESET))},t.prototype.updateDocument=function(t){},t.prototype.removeFromDocument=function(t){void 0===t&&(t=!1)},t.prototype.setMetrics=function(t,e,n,r,i){this.metrics={em:t,ex:e,containerWidth:n,lineWidth:r,scale:i}},t.prototype.state=function(t,n){return void 0===t&&(t=null),void 0===n&&(n=!1),null!=t&&(t<e.STATE.INSERTED&&this._state>=e.STATE.INSERTED&&this.removeFromDocument(n),t<e.STATE.TYPESET&&this._state>=e.STATE.TYPESET&&(this.outputData={}),t<e.STATE.COMPILED&&this._state>=e.STATE.COMPILED&&(this.inputData={}),this._state=t),this._state},t.prototype.reset=function(t){void 0===t&&(t=!1),this.state(e.STATE.UNPROCESSED,t