@skaldapp/runtime 3.1.13 → 3.1.15
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/.vite/manifest.json +1 -1
- package/dist/assets/esprima-BR6CEG77.js +8 -0
- package/dist/assets/index-CTx_YmlW.js +117 -0
- package/dist/assets/index-bYpYaqOv.css +1 -0
- package/dist/assets/markdown-DYNJ6Ntg.js +16 -0
- package/dist/assets/ofetch-XPJe_o5P.js +1 -0
- package/dist/assets/rolldown-runtime-Bhmf7a9N.js +1 -0
- package/dist/assets/sucrase-D9elb1_L.js +135 -0
- package/dist/assets/temml-Cn806M5Y.css +1 -0
- package/dist/assets/temml-gzcK8DTU.js +94 -0
- package/dist/assets/unocss-TrzabPxA.js +423 -0
- package/dist/assets/vue-BFE4yC8G.js +173 -0
- package/dist/index.html +11 -8
- package/package.json +7 -9
- package/dist/assets/index-W5ZzOxGj.js +0 -7
- package/dist/assets/index-X9Kt6xMm.css +0 -1
- package/dist/assets/markdown-yGb7k3A8.js +0 -1
- package/dist/assets/ofetch-xbea4qKc.js +0 -1
- package/dist/assets/sucrase-D8pz8hBV.js +0 -1
- package/dist/assets/traeblain-B2MaFYm5.js +0 -1
- package/dist/assets/unocss-ermFjJsI.js +0 -1
- package/dist/assets/vue-B2aV9V09.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class e{constructor(t,r){let n,o=" "+t;const a=r&&r.loc;if(a&&a.start<=a.end){const e=a.lexer.input;n=a.start;const t=a.end;n===e.length?o+=" at end of input: ":o+=" at position "+(n+1)+": ";const r=e.slice(n,t).replace(/[^]/g,"$&̲");let s,i;s=n>15?"…"+e.slice(n-15,n):e.slice(0,n),i=t+15<e.length?e.slice(t,t+15)+"…":e.slice(t),o+=s+r+i}const s=new Error(o);return s.name="ParseError",s.__proto__=e.prototype,s.position=n,s}}e.prototype.__proto__=Error.prototype;const t=/([A-Z])/g,r={"&":"&",">":">","<":"<",'"':""","'":"'"},n=/[&><"']/g;const o=function(e){return"ordgroup"===e.type||"color"===e.type?1===e.body.length?o(e.body[0]):e:"font"===e.type?o(e.body):e};var a={deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(n,e=>r[e])},hyphenate:function(e){return e.replace(t,"-$1").toLowerCase()},getBaseElem:o,isCharacterBox:function(e){const t=o(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){const t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"},round:function(e){return+e.toFixed(4)}};class s{constructor(e){e=e||{},this.displayMode=a.deflt(e.displayMode,!1),this.annotate=a.deflt(e.annotate,!1),this.leqno=a.deflt(e.leqno,!1),this.throwOnError=a.deflt(e.throwOnError,!1),this.errorColor=a.deflt(e.errorColor,"#b22222"),this.macros=e.macros||{},this.wrap=a.deflt(e.wrap,"tex"),this.xml=a.deflt(e.xml,!1),this.colorIsTextColor=a.deflt(e.colorIsTextColor,!1),this.strict=a.deflt(e.strict,!1),this.trust=a.deflt(e.trust,!1),this.maxSize=void 0===e.maxSize?[1/0,1/0]:Array.isArray(e.maxSize)?e.maxSize:[1/0,1/0],this.maxExpand=Math.max(0,a.deflt(e.maxExpand,1e3))}isTrusted(e){if(e.url&&!e.protocol){const t=a.protocolFromUrl(e.url);if(null==t)return!1;e.protocol=t}const t="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(t)}}const i={},l={};function c({type:e,names:t,props:r,handler:n,mathmlBuilder:o}){const a={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:void 0===r.allowedInMath||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:n};for(let s=0;s<t.length;++s)i[t[s]]=a;e&&o&&(l[e]=o)}function u({type:e,mathmlBuilder:t}){c({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},mathmlBuilder:t})}const p=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e},m=function(e){return"ordgroup"===e.type?e.body:[e]};class d{constructor(e){this.children=e,this.classes=[],this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){const e=document.createDocumentFragment();for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e="";for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>e.toText()).join("")}}const h=function(e){return e.filter(e=>e).join(" ")},g=function(e,t){this.classes=e||[],this.attributes={},this.style=t||{}},f=function(e){const t=document.createElement(e);t.className=h(this.classes);for(const r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(t.style[r]=this.style[r]);for(const r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);for(let r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t},b=function(e){let t=`<${e}`;this.classes.length&&(t+=` class="${a.escape(h(this.classes))}"`);let r="";for(const n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(r+=`${a.hyphenate(n)}:${this.style[n]};`);r&&(t+=` style="${r}"`);for(const n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(t+=` ${n}="${a.escape(this.attributes[n])}"`);t+=">";for(let n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t+=`</${e}>`,t};class x{constructor(e,t,r){g.call(this,e,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}toNode(){return f.call(this,"span")}toMarkup(){return b.call(this,"span")}}let y=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return a.escape(this.text)}};class w{constructor(e,t,r){this.href=e,this.classes=t,this.children=r||[]}toNode(){const e=document.createElement("a");e.setAttribute("href",this.href),this.classes.length>0&&(e.className=h(this.classes));for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e=`<a href='${a.escape(this.href)}'`;this.classes.length>0&&(e+=` class="${a.escape(h(this.classes))}"`),e+=">";for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e+="</a>",e}}class v{constructor(e,t,r){this.alt=t,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){const e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(const t in this.style)Object.prototype.hasOwnProperty.call(this.style,t)&&(e.style[t]=this.style[t]);return e}toMarkup(){let e=`<img src='${this.src}' alt='${this.alt}'`,t="";for(const r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(t+=`${a.hyphenate(r)}:${this.style[r]};`);return t&&(e+=` style="${a.escape(t)}"`),e+=">",e}}class k{constructor(e,t,r,n){this.type=e,this.attributes={},this.children=t||[],this.classes=r||[],this.style=n||{},this.label=""}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}setLabel(e){this.label=e}toNode(){const e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(const t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=h(this.classes));for(const t in this.style)Object.prototype.hasOwnProperty.call(this.style,t)&&(e.style[t]=this.style[t]);for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e="<"+this.type;for(const r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&(e+=" "+r+'="',e+=a.escape(this.attributes[r]),e+='"');this.classes.length>0&&(e+=` class="${a.escape(h(this.classes))}"`);let t="";for(const r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(t+=`${a.hyphenate(r)}:${this.style[r]};`);t&&(e+=` style="${t}"`),e+=">";for(let r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class A{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return a.escape(this.toText())}toText(){return this.text}}const q=e=>{let t;return 1===e.length&&"mrow"===e[0].type?(t=e.pop(),t.type="mstyle"):t=new k("mstyle",e),t};var _={MathNode:k,TextNode:A,newDocumentFragment:function(e){return new d(e)}};const S=e=>{let t=0;if(e.body)for(const r of e.body)t+=S(r);else if("supsub"===e.type)t+=S(e.base),e.sub&&(t+=.7*S(e.sub)),e.sup&&(t+=.7*S(e.sup));else if("mathord"===e.type||"textord"===e.type)for(const r of e.text.split("")){const e=r.codePointAt(0);t+=96<e&&e<123||944<e&&e<970?.56:47<e&&e<58?.5:.92}else t+=1;return t},T={widehat:"^",widecheck:"ˇ",widetilde:"~",wideparen:"⏜",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",overparen:"⏜",undergroup:"⏡",underparen:"⏝",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xrightleftarrows:"⇄",yields:"→",yieldsLeft:"←",mesomerism:"↔",longrightharpoonup:"⇀",longleftharpoondown:"↽",eqrightharpoonup:"⇀",eqleftharpoondown:"↽","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},N=function(e){const t=new _.TextNode(T[e.slice(1)]),r=new _.MathNode("mo",[t]);return r.setAttribute("stretchy","true"),r},$=["\\widetilde","\\widehat","\\widecheck","\\utilde"];var O=N,M=e=>{const t=N(e.label);if($.includes(e.label)){const r=S(e.base);1<r&&r<1.6?t.classes.push("tml-crooked-2"):1.6<=r&&r<2.5?t.classes.push("tml-crooked-3"):2.5<=r&&t.classes.push("tml-crooked-4")}return t};const B={bin:1,close:1,inner:1,open:1,punct:1,rel:1},C={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},z={math:{},text:{}};function I(e,t,r,n,o){z[e][n]={group:t,replace:r},o&&r&&(z[e][r]=z[e][n])}const L="math",D="text",E="accent-token",F="bin",G="close",P="inner",R="mathord",j="op-token",U="open",V="punct",Z="rel",H="spacing",W="textord";I(L,Z,"≡","\\equiv",!0),I(L,Z,"≺","\\prec",!0),I(L,Z,"≻","\\succ",!0),I(L,Z,"∼","\\sim",!0),I(L,Z,"⟂","\\perp",!0),I(L,Z,"⪯","\\preceq",!0),I(L,Z,"⪰","\\succeq",!0),I(L,Z,"≃","\\simeq",!0),I(L,Z,"≌","\\backcong",!0),I(L,Z,"|","\\mid",!0),I(L,Z,"≪","\\ll",!0),I(L,Z,"≫","\\gg",!0),I(L,Z,"≍","\\asymp",!0),I(L,Z,"∥","\\parallel"),I(L,Z,"⌣","\\smile",!0),I(L,Z,"⊑","\\sqsubseteq",!0),I(L,Z,"⊒","\\sqsupseteq",!0),I(L,Z,"≐","\\doteq",!0),I(L,Z,"⌢","\\frown",!0),I(L,Z,"∋","\\ni",!0),I(L,Z,"∌","\\notni",!0),I(L,Z,"∝","\\propto",!0),I(L,Z,"⊢","\\vdash",!0),I(L,Z,"⊣","\\dashv",!0),I(L,Z,"∋","\\owns"),I(L,Z,"≘","\\arceq",!0),I(L,Z,"≙","\\wedgeq",!0),I(L,Z,"≚","\\veeeq",!0),I(L,Z,"≛","\\stareq",!0),I(L,Z,"≝","\\eqdef",!0),I(L,Z,"≞","\\measeq",!0),I(L,Z,"≟","\\questeq",!0),I(L,Z,"≠","\\ne",!0),I(L,Z,"≠","\\neq"),I(L,Z,"⩵","\\eqeq",!0),I(L,Z,"⩶","\\eqeqeq",!0),I(L,Z,"∷","\\dblcolon",!0),I(L,Z,"≔","\\coloneqq",!0),I(L,Z,"≕","\\eqqcolon",!0),I(L,Z,"∹","\\eqcolon",!0),I(L,Z,"⩴","\\Coloneqq",!0),I(L,V,".","\\ldotp"),I(L,V,"·","\\cdotp"),I(L,W,"#","\\#"),I(D,W,"#","\\#"),I(L,W,"&","\\&"),I(D,W,"&","\\&"),I(L,W,"ℵ","\\aleph",!0),I(L,W,"∀","\\forall",!0),I(L,W,"ℏ","\\hbar",!0),I(L,W,"∃","\\exists",!0),I(L,F,"∇","\\nabla",!0),I(L,W,"♭","\\flat",!0),I(L,W,"ℓ","\\ell",!0),I(L,W,"♮","\\natural",!0),I(L,W,"Å","\\Angstrom",!0),I(D,W,"Å","\\Angstrom",!0),I(L,W,"♣","\\clubsuit",!0),I(L,W,"♧","\\varclubsuit",!0),I(L,W,"℘","\\wp",!0),I(L,W,"♯","\\sharp",!0),I(L,W,"♢","\\diamondsuit",!0),I(L,W,"♦","\\vardiamondsuit",!0),I(L,W,"ℜ","\\Re",!0),I(L,W,"♡","\\heartsuit",!0),I(L,W,"♥","\\varheartsuit",!0),I(L,W,"ℑ","\\Im",!0),I(L,W,"♠","\\spadesuit",!0),I(L,W,"♤","\\varspadesuit",!0),I(L,W,"♀","\\female",!0),I(L,W,"♂","\\male",!0),I(L,W,"§","\\S",!0),I(D,W,"§","\\S"),I(L,W,"¶","\\P",!0),I(D,W,"¶","\\P"),I(D,W,"☺","\\smiley",!0),I(L,W,"☺","\\smiley",!0),I(L,W,"†","\\dag"),I(D,W,"†","\\dag"),I(D,W,"†","\\textdagger"),I(L,W,"‡","\\ddag"),I(D,W,"‡","\\ddag"),I(D,W,"‡","\\textdaggerdbl"),I(L,G,"⎱","\\rmoustache",!0),I(L,U,"⎰","\\lmoustache",!0),I(L,G,"⟯","\\rgroup",!0),I(L,U,"⟮","\\lgroup",!0),I(L,F,"∓","\\mp",!0),I(L,F,"⊖","\\ominus",!0),I(L,F,"⊎","\\uplus",!0),I(L,F,"⊓","\\sqcap",!0),I(L,F,"∗","\\ast"),I(L,F,"⊔","\\sqcup",!0),I(L,F,"◯","\\bigcirc",!0),I(L,F,"∙","\\bullet",!0),I(L,F,"‡","\\ddagger"),I(L,F,"≀","\\wr",!0),I(L,F,"⨿","\\amalg"),I(L,F,"&","\\And"),I(L,F,"⫽","\\sslash",!0),I(L,Z,"⟵","\\longleftarrow",!0),I(L,Z,"⇐","\\Leftarrow",!0),I(L,Z,"⟸","\\Longleftarrow",!0),I(L,Z,"⟶","\\longrightarrow",!0),I(L,Z,"⇒","\\Rightarrow",!0),I(L,Z,"⟹","\\Longrightarrow",!0),I(L,Z,"↔","\\leftrightarrow",!0),I(L,Z,"⟷","\\longleftrightarrow",!0),I(L,Z,"⇔","\\Leftrightarrow",!0),I(L,Z,"⟺","\\Longleftrightarrow",!0),I(L,Z,"↤","\\mapsfrom",!0),I(L,Z,"↦","\\mapsto",!0),I(L,Z,"⟼","\\longmapsto",!0),I(L,Z,"↗","\\nearrow",!0),I(L,Z,"↩","\\hookleftarrow",!0),I(L,Z,"↪","\\hookrightarrow",!0),I(L,Z,"↘","\\searrow",!0),I(L,Z,"↼","\\leftharpoonup",!0),I(L,Z,"⇀","\\rightharpoonup",!0),I(L,Z,"↙","\\swarrow",!0),I(L,Z,"↽","\\leftharpoondown",!0),I(L,Z,"⇁","\\rightharpoondown",!0),I(L,Z,"↖","\\nwarrow",!0),I(L,Z,"⇌","\\rightleftharpoons",!0),I(L,R,"↯","\\lightning",!0),I(L,R,"∎","\\QED",!0),I(L,R,"‰","\\permil",!0),I(D,W,"‰","\\permil"),I(L,R,"☉","\\astrosun",!0),I(L,R,"☼","\\sun",!0),I(L,R,"☾","\\leftmoon",!0),I(L,R,"☽","\\rightmoon",!0),I(L,R,"⊕","\\Earth"),I(L,Z,"≮","\\nless",!0),I(L,Z,"⪇","\\lneq",!0),I(L,Z,"≨","\\lneqq",!0),I(L,Z,"≨︀","\\lvertneqq"),I(L,Z,"⋦","\\lnsim",!0),I(L,Z,"⪉","\\lnapprox",!0),I(L,Z,"⊀","\\nprec",!0),I(L,Z,"⋠","\\npreceq",!0),I(L,Z,"⋨","\\precnsim",!0),I(L,Z,"⪹","\\precnapprox",!0),I(L,Z,"≁","\\nsim",!0),I(L,Z,"∤","\\nmid",!0),I(L,Z,"∤","\\nshortmid"),I(L,Z,"⊬","\\nvdash",!0),I(L,Z,"⊭","\\nvDash",!0),I(L,Z,"⋪","\\ntriangleleft"),I(L,Z,"⋬","\\ntrianglelefteq",!0),I(L,Z,"⊄","\\nsubset",!0),I(L,Z,"⊅","\\nsupset",!0),I(L,Z,"⊊","\\subsetneq",!0),I(L,Z,"⊊︀","\\varsubsetneq"),I(L,Z,"⫋","\\subsetneqq",!0),I(L,Z,"⫋︀","\\varsubsetneqq"),I(L,Z,"≯","\\ngtr",!0),I(L,Z,"⪈","\\gneq",!0),I(L,Z,"≩","\\gneqq",!0),I(L,Z,"≩︀","\\gvertneqq"),I(L,Z,"⋧","\\gnsim",!0),I(L,Z,"⪊","\\gnapprox",!0),I(L,Z,"⊁","\\nsucc",!0),I(L,Z,"⋡","\\nsucceq",!0),I(L,Z,"⋩","\\succnsim",!0),I(L,Z,"⪺","\\succnapprox",!0),I(L,Z,"≆","\\ncong",!0),I(L,Z,"∦","\\nparallel",!0),I(L,Z,"∦","\\nshortparallel"),I(L,Z,"⊯","\\nVDash",!0),I(L,Z,"⋫","\\ntriangleright"),I(L,Z,"⋭","\\ntrianglerighteq",!0),I(L,Z,"⊋","\\supsetneq",!0),I(L,Z,"⊋","\\varsupsetneq"),I(L,Z,"⫌","\\supsetneqq",!0),I(L,Z,"⫌︀","\\varsupsetneqq"),I(L,Z,"⊮","\\nVdash",!0),I(L,Z,"⪵","\\precneqq",!0),I(L,Z,"⪶","\\succneqq",!0),I(L,F,"⊴","\\unlhd"),I(L,F,"⊵","\\unrhd"),I(L,Z,"↚","\\nleftarrow",!0),I(L,Z,"↛","\\nrightarrow",!0),I(L,Z,"⇍","\\nLeftarrow",!0),I(L,Z,"⇏","\\nRightarrow",!0),I(L,Z,"↮","\\nleftrightarrow",!0),I(L,Z,"⇎","\\nLeftrightarrow",!0),I(L,Z,"△","\\vartriangle"),I(L,W,"ℏ","\\hslash"),I(L,W,"▽","\\triangledown"),I(L,W,"◊","\\lozenge"),I(L,W,"Ⓢ","\\circledS"),I(L,W,"®","\\circledR",!0),I(D,W,"®","\\circledR"),I(D,W,"®","\\textregistered"),I(L,W,"∡","\\measuredangle",!0),I(L,W,"∄","\\nexists"),I(L,W,"℧","\\mho"),I(L,W,"Ⅎ","\\Finv",!0),I(L,W,"⅁","\\Game",!0),I(L,W,"‵","\\backprime"),I(L,W,"‶","\\backdprime"),I(L,W,"‷","\\backtrprime"),I(L,W,"▲","\\blacktriangle"),I(L,W,"▼","\\blacktriangledown"),I(L,W,"■","\\blacksquare"),I(L,W,"⧫","\\blacklozenge"),I(L,W,"★","\\bigstar"),I(L,W,"∢","\\sphericalangle",!0),I(L,W,"∁","\\complement",!0),I(L,W,"ð","\\eth",!0),I(D,W,"ð","ð"),I(L,W,"╱","\\diagup"),I(L,W,"╲","\\diagdown"),I(L,W,"□","\\square"),I(L,W,"□","\\Box"),I(L,W,"◊","\\Diamond"),I(L,W,"¥","\\yen",!0),I(D,W,"¥","\\yen",!0),I(L,W,"✓","\\checkmark",!0),I(D,W,"✓","\\checkmark"),I(L,W,"✗","\\ballotx",!0),I(D,W,"✗","\\ballotx"),I(D,W,"•","\\textbullet"),I(L,W,"ℶ","\\beth",!0),I(L,W,"ℸ","\\daleth",!0),I(L,W,"ℷ","\\gimel",!0),I(L,W,"ϝ","\\digamma",!0),I(L,W,"ϰ","\\varkappa"),I(L,U,"⌜","\\ulcorner",!0),I(L,G,"⌝","\\urcorner",!0),I(L,U,"⌞","\\llcorner",!0),I(L,G,"⌟","\\lrcorner",!0),I(L,Z,"≦","\\leqq",!0),I(L,Z,"⩽","\\leqslant",!0),I(L,Z,"⪕","\\eqslantless",!0),I(L,Z,"≲","\\lesssim",!0),I(L,Z,"⪅","\\lessapprox",!0),I(L,Z,"≊","\\approxeq",!0),I(L,F,"⋖","\\lessdot"),I(L,Z,"⋘","\\lll",!0),I(L,Z,"≶","\\lessgtr",!0),I(L,Z,"⋚","\\lesseqgtr",!0),I(L,Z,"⪋","\\lesseqqgtr",!0),I(L,Z,"≑","\\doteqdot"),I(L,Z,"≓","\\risingdotseq",!0),I(L,Z,"≒","\\fallingdotseq",!0),I(L,Z,"∽","\\backsim",!0),I(L,Z,"⋍","\\backsimeq",!0),I(L,Z,"⫅","\\subseteqq",!0),I(L,Z,"⋐","\\Subset",!0),I(L,Z,"⊏","\\sqsubset",!0),I(L,Z,"≼","\\preccurlyeq",!0),I(L,Z,"⋞","\\curlyeqprec",!0),I(L,Z,"≾","\\precsim",!0),I(L,Z,"⪷","\\precapprox",!0),I(L,Z,"⊲","\\vartriangleleft"),I(L,Z,"⊴","\\trianglelefteq"),I(L,Z,"⊨","\\vDash",!0),I(L,Z,"⊫","\\VDash",!0),I(L,Z,"⊪","\\Vvdash",!0),I(L,Z,"⌣","\\smallsmile"),I(L,Z,"⌢","\\smallfrown"),I(L,Z,"≏","\\bumpeq",!0),I(L,Z,"≎","\\Bumpeq",!0),I(L,Z,"≧","\\geqq",!0),I(L,Z,"⩾","\\geqslant",!0),I(L,Z,"⪖","\\eqslantgtr",!0),I(L,Z,"≳","\\gtrsim",!0),I(L,Z,"⪆","\\gtrapprox",!0),I(L,F,"⋗","\\gtrdot"),I(L,Z,"⋙","\\ggg",!0),I(L,Z,"≷","\\gtrless",!0),I(L,Z,"⋛","\\gtreqless",!0),I(L,Z,"⪌","\\gtreqqless",!0),I(L,Z,"≖","\\eqcirc",!0),I(L,Z,"≗","\\circeq",!0),I(L,Z,"≜","\\triangleq",!0),I(L,Z,"∼","\\thicksim"),I(L,Z,"≈","\\thickapprox"),I(L,Z,"⫆","\\supseteqq",!0),I(L,Z,"⋑","\\Supset",!0),I(L,Z,"⊐","\\sqsupset",!0),I(L,Z,"≽","\\succcurlyeq",!0),I(L,Z,"⋟","\\curlyeqsucc",!0),I(L,Z,"≿","\\succsim",!0),I(L,Z,"⪸","\\succapprox",!0),I(L,Z,"⊳","\\vartriangleright"),I(L,Z,"⊵","\\trianglerighteq"),I(L,Z,"⊩","\\Vdash",!0),I(L,Z,"∣","\\shortmid"),I(L,Z,"∥","\\shortparallel"),I(L,Z,"≬","\\between",!0),I(L,Z,"⋔","\\pitchfork",!0),I(L,Z,"∝","\\varpropto"),I(L,Z,"◀","\\blacktriangleleft"),I(L,Z,"∴","\\therefore",!0),I(L,Z,"∍","\\backepsilon"),I(L,Z,"▶","\\blacktriangleright"),I(L,Z,"∵","\\because",!0),I(L,Z,"⋘","\\llless"),I(L,Z,"⋙","\\gggtr"),I(L,F,"⊲","\\lhd"),I(L,F,"⊳","\\rhd"),I(L,Z,"≂","\\eqsim",!0),I(L,Z,"≑","\\Doteq",!0),I(L,Z,"⥽","\\strictif",!0),I(L,Z,"⥼","\\strictfi",!0),I(L,F,"∔","\\dotplus",!0),I(L,F,"∖","\\smallsetminus"),I(L,F,"⋒","\\Cap",!0),I(L,F,"⋓","\\Cup",!0),I(L,F,"⩞","\\doublebarwedge",!0),I(L,F,"⊟","\\boxminus",!0),I(L,F,"⊞","\\boxplus",!0),I(L,F,"⧄","\\boxslash",!0),I(L,F,"⋇","\\divideontimes",!0),I(L,F,"⋉","\\ltimes",!0),I(L,F,"⋊","\\rtimes",!0),I(L,F,"⋋","\\leftthreetimes",!0),I(L,F,"⋌","\\rightthreetimes",!0),I(L,F,"⋏","\\curlywedge",!0),I(L,F,"⋎","\\curlyvee",!0),I(L,F,"⊝","\\circleddash",!0),I(L,F,"⊛","\\circledast",!0),I(L,F,"⊺","\\intercal",!0),I(L,F,"⋒","\\doublecap"),I(L,F,"⋓","\\doublecup"),I(L,F,"⊠","\\boxtimes",!0),I(L,F,"⋈","\\bowtie",!0),I(L,F,"⋈","\\Join"),I(L,F,"⟕","\\leftouterjoin",!0),I(L,F,"⟖","\\rightouterjoin",!0),I(L,F,"⟗","\\fullouterjoin",!0),I(L,F,"∸","\\dotminus",!0),I(L,F,"⟑","\\wedgedot",!0),I(L,F,"⟇","\\veedot",!0),I(L,F,"⩢","\\doublebarvee",!0),I(L,F,"⩣","\\veedoublebar",!0),I(L,F,"⩟","\\wedgebar",!0),I(L,F,"⩠","\\wedgedoublebar",!0),I(L,F,"⩔","\\Vee",!0),I(L,F,"⩓","\\Wedge",!0),I(L,F,"⩃","\\barcap",!0),I(L,F,"⩂","\\barcup",!0),I(L,F,"⩈","\\capbarcup",!0),I(L,F,"⩀","\\capdot",!0),I(L,F,"⩇","\\capovercup",!0),I(L,F,"⩆","\\cupovercap",!0),I(L,F,"⩍","\\closedvarcap",!0),I(L,F,"⩌","\\closedvarcup",!0),I(L,F,"⨪","\\minusdot",!0),I(L,F,"⨫","\\minusfdots",!0),I(L,F,"⨬","\\minusrdots",!0),I(L,F,"⊻","\\Xor",!0),I(L,F,"⊼","\\Nand",!0),I(L,F,"⊽","\\Nor",!0),I(L,F,"⊽","\\barvee"),I(L,F,"⫴","\\interleave",!0),I(L,F,"⧢","\\shuffle",!0),I(L,F,"⫶","\\threedotcolon",!0),I(L,F,"⦂","\\typecolon",!0),I(L,F,"∾","\\invlazys",!0),I(L,F,"⩋","\\twocaps",!0),I(L,F,"⩊","\\twocups",!0),I(L,F,"⩎","\\Sqcap",!0),I(L,F,"⩏","\\Sqcup",!0),I(L,F,"⩖","\\veeonvee",!0),I(L,F,"⩕","\\wedgeonwedge",!0),I(L,F,"⧗","\\blackhourglass",!0),I(L,F,"⧆","\\boxast",!0),I(L,F,"⧈","\\boxbox",!0),I(L,F,"⧇","\\boxcircle",!0),I(L,F,"⊜","\\circledequal",!0),I(L,F,"⦷","\\circledparallel",!0),I(L,F,"⦶","\\circledvert",!0),I(L,F,"⦵","\\circlehbar",!0),I(L,F,"⟡","\\concavediamond",!0),I(L,F,"⟢","\\concavediamondtickleft",!0),I(L,F,"⟣","\\concavediamondtickright",!0),I(L,F,"⋄","\\diamond",!0),I(L,F,"⧖","\\hourglass",!0),I(L,F,"⟠","\\lozengeminus",!0),I(L,F,"⌽","\\obar",!0),I(L,F,"⦸","\\obslash",!0),I(L,F,"⨸","\\odiv",!0),I(L,F,"⧁","\\ogreaterthan",!0),I(L,F,"⧀","\\olessthan",!0),I(L,F,"⦹","\\operp",!0),I(L,F,"⨷","\\Otimes",!0),I(L,F,"⨶","\\otimeshat",!0),I(L,F,"⋆","\\star",!0),I(L,F,"△","\\triangle",!0),I(L,F,"⨺","\\triangleminus",!0),I(L,F,"⨹","\\triangleplus",!0),I(L,F,"⨻","\\triangletimes",!0),I(L,F,"⟤","\\whitesquaretickleft",!0),I(L,F,"⟥","\\whitesquaretickright",!0),I(L,F,"⨳","\\smashtimes",!0),I(L,Z,"⇢","\\dashrightarrow",!0),I(L,Z,"⇠","\\dashleftarrow",!0),I(L,Z,"⇇","\\leftleftarrows",!0),I(L,Z,"⇆","\\leftrightarrows",!0),I(L,Z,"⇚","\\Lleftarrow",!0),I(L,Z,"↞","\\twoheadleftarrow",!0),I(L,Z,"↢","\\leftarrowtail",!0),I(L,Z,"↫","\\looparrowleft",!0),I(L,Z,"⇋","\\leftrightharpoons",!0),I(L,Z,"↶","\\curvearrowleft",!0),I(L,Z,"↺","\\circlearrowleft",!0),I(L,Z,"↰","\\Lsh",!0),I(L,Z,"⇈","\\upuparrows",!0),I(L,Z,"↿","\\upharpoonleft",!0),I(L,Z,"⇃","\\downharpoonleft",!0),I(L,Z,"⊶","\\origof",!0),I(L,Z,"⊷","\\imageof",!0),I(L,Z,"⊸","\\multimap",!0),I(L,Z,"↭","\\leftrightsquigarrow",!0),I(L,Z,"⇉","\\rightrightarrows",!0),I(L,Z,"⇄","\\rightleftarrows",!0),I(L,Z,"↠","\\twoheadrightarrow",!0),I(L,Z,"↣","\\rightarrowtail",!0),I(L,Z,"↬","\\looparrowright",!0),I(L,Z,"↷","\\curvearrowright",!0),I(L,Z,"↻","\\circlearrowright",!0),I(L,Z,"↱","\\Rsh",!0),I(L,Z,"⇊","\\downdownarrows",!0),I(L,Z,"↾","\\upharpoonright",!0),I(L,Z,"⇂","\\downharpoonright",!0),I(L,Z,"⇝","\\rightsquigarrow",!0),I(L,Z,"⇝","\\leadsto"),I(L,Z,"⇛","\\Rrightarrow",!0),I(L,Z,"↾","\\restriction"),I(L,W,"‘","`"),I(L,W,"$","\\$"),I(D,W,"$","\\$"),I(D,W,"$","\\textdollar"),I(L,W,"¢","\\cent"),I(D,W,"¢","\\cent"),I(L,W,"%","\\%"),I(D,W,"%","\\%"),I(L,W,"_","\\_"),I(D,W,"_","\\_"),I(D,W,"_","\\textunderscore"),I(D,W,"␣","\\textvisiblespace",!0),I(L,W,"∠","\\angle",!0),I(L,W,"∞","\\infty",!0),I(L,W,"′","\\prime"),I(L,W,"″","\\dprime"),I(L,W,"‴","\\trprime"),I(L,W,"⁗","\\qprime"),I(L,W,"△","\\triangle"),I(D,W,"Α","\\Alpha",!0),I(D,W,"Β","\\Beta",!0),I(D,W,"Γ","\\Gamma",!0),I(D,W,"Δ","\\Delta",!0),I(D,W,"Ε","\\Epsilon",!0),I(D,W,"Ζ","\\Zeta",!0),I(D,W,"Η","\\Eta",!0),I(D,W,"Θ","\\Theta",!0),I(D,W,"Ι","\\Iota",!0),I(D,W,"Κ","\\Kappa",!0),I(D,W,"Λ","\\Lambda",!0),I(D,W,"Μ","\\Mu",!0),I(D,W,"Ν","\\Nu",!0),I(D,W,"Ξ","\\Xi",!0),I(D,W,"Ο","\\Omicron",!0),I(D,W,"Π","\\Pi",!0),I(D,W,"Ρ","\\Rho",!0),I(D,W,"Σ","\\Sigma",!0),I(D,W,"Τ","\\Tau",!0),I(D,W,"Υ","\\Upsilon",!0),I(D,W,"Φ","\\Phi",!0),I(D,W,"Χ","\\Chi",!0),I(D,W,"Ψ","\\Psi",!0),I(D,W,"Ω","\\Omega",!0),I(L,R,"Α","\\Alpha",!0),I(L,R,"Β","\\Beta",!0),I(L,R,"Γ","\\Gamma",!0),I(L,R,"Δ","\\Delta",!0),I(L,R,"Ε","\\Epsilon",!0),I(L,R,"Ζ","\\Zeta",!0),I(L,R,"Η","\\Eta",!0),I(L,R,"Θ","\\Theta",!0),I(L,R,"Ι","\\Iota",!0),I(L,R,"Κ","\\Kappa",!0),I(L,R,"Λ","\\Lambda",!0),I(L,R,"Μ","\\Mu",!0),I(L,R,"Ν","\\Nu",!0),I(L,R,"Ξ","\\Xi",!0),I(L,R,"Ο","\\Omicron",!0),I(L,R,"Π","\\Pi",!0),I(L,R,"Ρ","\\Rho",!0),I(L,R,"Σ","\\Sigma",!0),I(L,R,"Τ","\\Tau",!0),I(L,R,"Υ","\\Upsilon",!0),I(L,R,"Φ","\\Phi",!0),I(L,R,"Χ","\\Chi",!0),I(L,R,"Ψ","\\Psi",!0),I(L,R,"Ω","\\Omega",!0),I(L,U,"¬","\\neg",!0),I(L,U,"¬","\\lnot"),I(L,W,"⊤","\\top"),I(L,W,"⊥","\\bot"),I(L,W,"∅","\\emptyset"),I(L,W,"⌀","\\varnothing"),I(L,R,"α","\\alpha",!0),I(L,R,"β","\\beta",!0),I(L,R,"γ","\\gamma",!0),I(L,R,"δ","\\delta",!0),I(L,R,"ϵ","\\epsilon",!0),I(L,R,"ζ","\\zeta",!0),I(L,R,"η","\\eta",!0),I(L,R,"θ","\\theta",!0),I(L,R,"ι","\\iota",!0),I(L,R,"κ","\\kappa",!0),I(L,R,"λ","\\lambda",!0),I(L,R,"μ","\\mu",!0),I(L,R,"ν","\\nu",!0),I(L,R,"ξ","\\xi",!0),I(L,R,"ο","\\omicron",!0),I(L,R,"π","\\pi",!0),I(L,R,"ρ","\\rho",!0),I(L,R,"σ","\\sigma",!0),I(L,R,"τ","\\tau",!0),I(L,R,"υ","\\upsilon",!0),I(L,R,"ϕ","\\phi",!0),I(L,R,"χ","\\chi",!0),I(L,R,"ψ","\\psi",!0),I(L,R,"ω","\\omega",!0),I(L,R,"ε","\\varepsilon",!0),I(L,R,"ϑ","\\vartheta",!0),I(L,R,"ϖ","\\varpi",!0),I(L,R,"ϱ","\\varrho",!0),I(L,R,"ς","\\varsigma",!0),I(L,R,"φ","\\varphi",!0),I(L,R,"Ϙ","\\Coppa",!0),I(L,R,"ϙ","\\coppa",!0),I(L,R,"ϙ","\\varcoppa",!0),I(L,R,"Ϟ","\\Koppa",!0),I(L,R,"ϟ","\\koppa",!0),I(L,R,"Ϡ","\\Sampi",!0),I(L,R,"ϡ","\\sampi",!0),I(L,R,"Ϛ","\\Stigma",!0),I(L,R,"ϛ","\\stigma",!0),I(L,R,"⫫","\\Bot"),I(L,F,"∗","∗",!0),I(L,F,"+","+"),I(L,F,"∗","*"),I(L,F,"⁄","/",!0),I(L,F,"⁄","⁄"),I(L,F,"−","-",!0),I(L,F,"⋅","\\cdot",!0),I(L,F,"∘","\\circ",!0),I(L,F,"÷","\\div",!0),I(L,F,"±","\\pm",!0),I(L,F,"×","\\times",!0),I(L,F,"∩","\\cap",!0),I(L,F,"∪","\\cup",!0),I(L,F,"∖","\\setminus",!0),I(L,F,"∧","\\land"),I(L,F,"∨","\\lor"),I(L,F,"∧","\\wedge",!0),I(L,F,"∨","\\vee",!0),I(L,U,"⟦","\\llbracket",!0),I(L,G,"⟧","\\rrbracket",!0),I(L,U,"⟨","\\langle",!0),I(L,U,"⟪","\\lAngle",!0),I(L,U,"⦉","\\llangle",!0),I(L,U,"|","\\lvert"),I(L,U,"‖","\\lVert",!0),I(L,W,"!","\\oc"),I(L,W,"?","\\wn"),I(L,W,"↓","\\shpos"),I(L,W,"↕","\\shift"),I(L,W,"↑","\\shneg"),I(L,G,"?","?"),I(L,G,"!","!"),I(L,G,"‼","‼"),I(L,G,"⟩","\\rangle",!0),I(L,G,"⟫","\\rAngle",!0),I(L,G,"⦊","\\rrangle",!0),I(L,G,"|","\\rvert"),I(L,G,"‖","\\rVert"),I(L,U,"⦃","\\lBrace",!0),I(L,G,"⦄","\\rBrace",!0),I(L,Z,"=","\\equal",!0),I(L,Z,":",":"),I(L,Z,"≈","\\approx",!0),I(L,Z,"≅","\\cong",!0),I(L,Z,"≥","\\ge"),I(L,Z,"≥","\\geq",!0),I(L,Z,"←","\\gets"),I(L,Z,">","\\gt",!0),I(L,Z,"∈","\\in",!0),I(L,Z,"∉","\\notin",!0),I(L,Z,"","\\@not"),I(L,Z,"⊂","\\subset",!0),I(L,Z,"⊃","\\supset",!0),I(L,Z,"⊆","\\subseteq",!0),I(L,Z,"⊇","\\supseteq",!0),I(L,Z,"⊈","\\nsubseteq",!0),I(L,Z,"⊈","\\nsubseteqq"),I(L,Z,"⊉","\\nsupseteq",!0),I(L,Z,"⊉","\\nsupseteqq"),I(L,Z,"⊨","\\models"),I(L,Z,"←","\\leftarrow",!0),I(L,Z,"≤","\\le"),I(L,Z,"≤","\\leq",!0),I(L,Z,"<","\\lt",!0),I(L,Z,"→","\\rightarrow",!0),I(L,Z,"→","\\to"),I(L,Z,"≱","\\ngeq",!0),I(L,Z,"≱","\\ngeqq"),I(L,Z,"≱","\\ngeqslant"),I(L,Z,"≰","\\nleq",!0),I(L,Z,"≰","\\nleqq"),I(L,Z,"≰","\\nleqslant"),I(L,Z,"⫫","\\Perp",!0),I(L,H," ","\\ "),I(L,H," ","\\space"),I(L,H," ","\\nobreakspace"),I(D,H," ","\\ "),I(D,H," "," "),I(D,H," ","\\space"),I(D,H," ","\\nobreakspace"),I(L,H,null,"\\nobreak"),I(L,H,null,"\\allowbreak"),I(L,V,",",","),I(D,V,":",":"),I(L,V,";",";"),I(L,F,"⊼","\\barwedge"),I(L,F,"⊻","\\veebar"),I(L,F,"⊙","\\odot",!0),I(L,F,"⊕︎","\\oplus"),I(L,F,"⊗","\\otimes",!0),I(L,W,"∂","\\partial",!0),I(L,F,"⊘","\\oslash",!0),I(L,F,"⊚","\\circledcirc",!0),I(L,F,"⊡","\\boxdot",!0),I(L,F,"△","\\bigtriangleup"),I(L,F,"▽","\\bigtriangledown"),I(L,F,"†","\\dagger"),I(L,F,"⋄","\\diamond"),I(L,F,"◃","\\triangleleft"),I(L,F,"▹","\\triangleright"),I(L,U,"{","\\{"),I(D,W,"{","\\{"),I(D,W,"{","\\textbraceleft"),I(L,G,"}","\\}"),I(D,W,"}","\\}"),I(D,W,"}","\\textbraceright"),I(L,U,"{","\\lbrace"),I(L,G,"}","\\rbrace"),I(L,U,"[","\\lbrack",!0),I(D,W,"[","\\lbrack",!0),I(L,G,"]","\\rbrack",!0),I(D,W,"]","\\rbrack",!0),I(L,U,"(","\\lparen",!0),I(L,G,")","\\rparen",!0),I(L,U,"⦇","\\llparenthesis",!0),I(L,G,"⦈","\\rrparenthesis",!0),I(D,W,"<","\\textless",!0),I(D,W,">","\\textgreater",!0),I(L,U,"⌊","\\lfloor",!0),I(L,G,"⌋","\\rfloor",!0),I(L,U,"⌈","\\lceil",!0),I(L,G,"⌉","\\rceil",!0),I(L,W,"\\","\\backslash"),I(L,W,"|","|"),I(L,W,"|","\\vert"),I(D,W,"|","\\textbar",!0),I(L,W,"‖","\\|"),I(L,W,"‖","\\Vert"),I(D,W,"‖","\\textbardbl"),I(D,W,"~","\\textasciitilde"),I(D,W,"\\","\\textbackslash"),I(D,W,"^","\\textasciicircum"),I(L,Z,"↑","\\uparrow",!0),I(L,Z,"⇑","\\Uparrow",!0),I(L,Z,"↓","\\downarrow",!0),I(L,Z,"⇓","\\Downarrow",!0),I(L,Z,"↕","\\updownarrow",!0),I(L,Z,"⇕","\\Updownarrow",!0),I(L,j,"∐","\\coprod"),I(L,j,"⋁","\\bigvee"),I(L,j,"⋀","\\bigwedge"),I(L,j,"⨄","\\biguplus"),I(L,j,"⨄","\\bigcupplus"),I(L,j,"⨃","\\bigcupdot"),I(L,j,"⨇","\\bigdoublevee"),I(L,j,"⨈","\\bigdoublewedge"),I(L,j,"⋂","\\bigcap"),I(L,j,"⋃","\\bigcup"),I(L,j,"∫","\\int"),I(L,j,"∫","\\intop"),I(L,j,"∬","\\iint"),I(L,j,"∭","\\iiint"),I(L,j,"∏","\\prod"),I(L,j,"∑","\\sum"),I(L,j,"⨂","\\bigotimes"),I(L,j,"⨁","\\bigoplus"),I(L,j,"⨀","\\bigodot"),I(L,j,"⨉","\\bigtimes"),I(L,j,"∮","\\oint"),I(L,j,"∯","\\oiint"),I(L,j,"∰","\\oiiint"),I(L,j,"∱","\\intclockwise"),I(L,j,"∲","\\varointclockwise"),I(L,j,"⨌","\\iiiint"),I(L,j,"⨍","\\intbar"),I(L,j,"⨎","\\intBar"),I(L,j,"⨏","\\fint"),I(L,j,"⨒","\\rppolint"),I(L,j,"⨓","\\scpolint"),I(L,j,"⨕","\\pointint"),I(L,j,"⨖","\\sqint"),I(L,j,"⨗","\\intlarhk"),I(L,j,"⨘","\\intx"),I(L,j,"⨙","\\intcap"),I(L,j,"⨚","\\intcup"),I(L,j,"⨅","\\bigsqcap"),I(L,j,"⨆","\\bigsqcup"),I(L,j,"∫","\\smallint"),I(D,P,"…","\\textellipsis"),I(L,P,"…","\\mathellipsis"),I(D,P,"…","\\ldots",!0),I(L,P,"…","\\ldots",!0),I(L,P,"⋰","\\iddots",!0),I(L,P,"⋯","\\@cdots",!0),I(L,P,"⋱","\\ddots",!0),I(L,W,"⋮","\\varvdots"),I(D,W,"⋮","\\varvdots"),I(L,E,"ˊ","\\acute"),I(L,E,"`","\\grave"),I(L,E,"¨","\\ddot"),I(L,E,"…","\\dddot"),I(L,E,"….","\\ddddot"),I(L,E,"~","\\tilde"),I(L,E,"‾","\\bar"),I(L,E,"˘","\\breve"),I(L,E,"ˇ","\\check"),I(L,E,"^","\\hat"),I(L,E,"→","\\vec"),I(L,E,"˙","\\dot"),I(L,E,"˚","\\mathring"),I(L,R,"ı","\\imath",!0),I(L,R,"ȷ","\\jmath",!0),I(L,W,"ı","ı"),I(L,W,"ȷ","ȷ"),I(D,W,"ı","\\i",!0),I(D,W,"ȷ","\\j",!0),I(D,W,"ß","\\ss",!0),I(D,W,"æ","\\ae",!0),I(D,W,"œ","\\oe",!0),I(D,W,"ø","\\o",!0),I(L,R,"ø","\\o",!0),I(D,W,"Æ","\\AE",!0),I(D,W,"Œ","\\OE",!0),I(D,W,"Ø","\\O",!0),I(L,R,"Ø","\\O",!0),I(D,E,"ˊ","\\'"),I(D,E,"ˋ","\\`"),I(D,E,"ˆ","\\^"),I(D,E,"˜","\\~"),I(D,E,"ˉ","\\="),I(D,E,"˘","\\u"),I(D,E,"˙","\\."),I(D,E,"¸","\\c"),I(D,E,"˚","\\r"),I(D,E,"ˇ","\\v"),I(D,E,"¨",'\\"'),I(D,E,"˝","\\H"),I(L,E,"ˊ","\\'"),I(L,E,"ˋ","\\`"),I(L,E,"ˆ","\\^"),I(L,E,"˜","\\~"),I(L,E,"ˉ","\\="),I(L,E,"˘","\\u"),I(L,E,"˙","\\."),I(L,E,"¸","\\c"),I(L,E,"˚","\\r"),I(L,E,"ˇ","\\v"),I(L,E,"¨",'\\"'),I(L,E,"˝","\\H");const X={"--":!0,"---":!0,"``":!0,"''":!0};I(D,W,"–","--",!0),I(D,W,"–","\\textendash"),I(D,W,"—","---",!0),I(D,W,"—","\\textemdash"),I(D,W,"‘","`",!0),I(D,W,"‘","\\textquoteleft"),I(D,W,"’","'",!0),I(D,W,"’","\\textquoteright"),I(D,W,"“","``",!0),I(D,W,"“","\\textquotedblleft"),I(D,W,"”","''",!0),I(D,W,"”","\\textquotedblright"),I(L,W,"°","\\degree",!0),I(D,W,"°","\\degree"),I(D,W,"°","\\textdegree",!0),I(L,W,"£","\\pounds"),I(L,W,"£","\\mathsterling",!0),I(D,W,"£","\\pounds"),I(D,W,"£","\\textsterling",!0),I(L,W,"✠","\\maltese"),I(D,W,"✠","\\maltese"),I(L,W,"€","\\euro",!0),I(D,W,"€","\\euro",!0),I(D,W,"€","\\texteuro"),I(L,W,"©","\\copyright",!0),I(D,W,"©","\\textcopyright"),I(L,W,"⌀","\\diameter",!0),I(D,W,"⌀","\\diameter"),I(L,W,"𝛤","\\varGamma"),I(L,W,"𝛥","\\varDelta"),I(L,W,"𝛩","\\varTheta"),I(L,W,"𝛬","\\varLambda"),I(L,W,"𝛯","\\varXi"),I(L,W,"𝛱","\\varPi"),I(L,W,"𝛴","\\varSigma"),I(L,W,"𝛶","\\varUpsilon"),I(L,W,"𝛷","\\varPhi"),I(L,W,"𝛹","\\varPsi"),I(L,W,"𝛺","\\varOmega"),I(D,W,"𝛤","\\varGamma"),I(D,W,"𝛥","\\varDelta"),I(D,W,"𝛩","\\varTheta"),I(D,W,"𝛬","\\varLambda"),I(D,W,"𝛯","\\varXi"),I(D,W,"𝛱","\\varPi"),I(D,W,"𝛴","\\varSigma"),I(D,W,"𝛶","\\varUpsilon"),I(D,W,"𝛷","\\varPhi"),I(D,W,"𝛹","\\varPsi"),I(D,W,"𝛺","\\varOmega");const K='0123456789/@."';for(let fn=0;fn<14;fn++){const e=K.charAt(fn);I(L,W,e,e)}const Y='0123456789!@*()-=+";:?/.,';for(let fn=0;fn<25;fn++){const e=Y.charAt(fn);I(D,W,e,e)}const J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let fn=0;fn<52;fn++){const e=J.charAt(fn);I(L,R,e,e),I(D,W,e,e)}const Q="ÇÐÞçþℂℍℕℙℚℝℤℎℏℊℋℌℐℑℒℓ℘ℛℜℬℰℱℳℭℨ";for(let fn=0;fn<30;fn++){const e=Q.charAt(fn);I(L,R,e,e),I(D,W,e,e)}let ee="";for(let fn=0;fn<52;fn++){ee=String.fromCharCode(55349,56320+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,56372+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,56424+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,56580+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,56736+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,56788+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,56840+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,56944+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,56632+fn),I(L,R,ee,ee),I(D,W,ee,ee);const e=J.charAt(fn);ee=String.fromCharCode(55349,56476+fn),I(L,R,e,ee),I(D,W,e,ee)}for(let fn=0;fn<10;fn++)ee=String.fromCharCode(55349,57294+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,57314+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,57324+fn),I(L,R,ee,ee),I(D,W,ee,ee),ee=String.fromCharCode(55349,57334+fn),I(L,R,ee,ee),I(D,W,ee,ee);const te=function(e,t,r){return!z[t][e]||!z[t][e].replace||55349===e.charCodeAt(0)||Object.prototype.hasOwnProperty.call(X,e)&&r&&(r.fontFamily&&"tt"===r.fontFamily.slice(4,6)||r.font&&"tt"===r.font.slice(4,6))||(e=z[t][e].replace),new _.TextNode(e)},re=(e,t)=>{if(0===e.children.length||"mtext"!==e.children[e.children.length-1].type){const r=new _.MathNode("mtext",[new _.TextNode(t.children[0].text)]);e.children.push(r)}else e.children[e.children.length-1].children[0].text+=t.children[0].text},ne=e=>{if("mrow"!==e.type&&"mstyle"!==e.type)return e;if(0===e.children.length)return e;const t=new _.MathNode("mrow");for(let r=0;r<e.children.length;r++){const n=e.children[r];if("mtext"===n.type&&0===Object.keys(n.attributes).length)re(t,n);else if("mrow"===n.type){let e=!0;for(let t=0;t<n.children.length;t++){if("mtext"!==n.children[t].type||0!==Object.keys(n.attributes).length){e=!1;break}}if(e)for(let r=0;r<n.children.length;r++){const e=n.children[r];re(t,e)}else t.children.push(n)}else t.children.push(n)}for(let r=0;r<t.children.length;r++)if("mtext"===t.children[r].type){const n=t.children[r];" "===n.children[0].text.charAt(0)&&(n.children[0].text=" "+n.children[0].text.slice(1));const o=n.children[0].text.length;o>0&&" "===n.children[0].text.charAt(o-1)&&(n.children[0].text=n.children[0].text.slice(0,-1)+" ");for(const[t,r]of Object.entries(e.attributes))n.attributes[t]=r}return 1===t.children.length&&"mtext"===t.children[0].type?t.children[0]:t},oe=function(e,t=!1){if(!(1!==e.length||e[0]instanceof d))return e[0];if(!t){e[0]instanceof k&&"mo"===e[0].type&&!e[0].attributes.fence&&(e[0].attributes.lspace="0em",e[0].attributes.rspace="0em");const t=e.length-1;e[t]instanceof k&&"mo"===e[t].type&&!e[t].attributes.fence&&(e[t].attributes.lspace="0em",e[t].attributes.rspace="0em")}return new _.MathNode("mrow",e)};function ae(e){if(!e)return!1;if("mi"===e.type&&1===e.children.length){const t=e.children[0];return t instanceof A&&"."===t.text}if("mtext"===e.type&&1===e.children.length){const t=e.children[0];return t instanceof A&&" "===t.text}if("mo"===e.type&&1===e.children.length&&"true"===e.getAttribute("separator")&&"0em"===e.getAttribute("lspace")&&"0em"===e.getAttribute("rspace")){const t=e.children[0];return t instanceof A&&","===t.text}return!1}const se=(e,t)=>{const r=e[t],n=e[t+1];return"atom"===r.type&&","===r.text&&r.loc&&n.loc&&r.loc.end===n.loc.start},ie=e=>"atom"===e.type&&"rel"===e.family||"mclass"===e.type&&"mrel"===e.mclass,le=function(e,t,r=!1){if(!r&&1===e.length){const r=ue(e[0],t);return r instanceof k&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}const n=[],o=[];let a;for(let s=0;s<e.length;s++)o.push(ue(e[s],t));for(let s=0;s<o.length;s++){const t=o[s];if(s<e.length-1&&ie(e[s])&&ie(e[s+1])&&t.setAttribute("rspace","0em"),s>0&&ie(e[s])&&ie(e[s-1])&&t.setAttribute("lspace","0em"),"mn"===t.type&&a&&"mn"===a.type)a.children.push(...t.children);else if(ae(t)&&a&&"mn"===a.type)a.children.push(...t.children);else if(a&&"mn"===a.type&&s<o.length-1&&"mn"===o[s+1].type&&se(e,s))a.children.push(...t.children);else{if("mn"===t.type&&ae(a))t.children=[...a.children,...t.children],n.pop();else if(("msup"===t.type||"msub"===t.type)&&t.children.length>=1&&a&&("mn"===a.type||ae(a))){const e=t.children[0];e instanceof k&&"mn"===e.type&&a&&(e.children=[...a.children,...e.children],n.pop())}n.push(t),a=t}}return n},ce=function(e,t,r=!1){return oe(le(e,t,r),r)},ue=function(t,r){if(!t)return new _.MathNode("mrow");if(l[t.type]){return l[t.type](t,r)}throw new e("Got group of unknown type: '"+t.type+"'")},pe=e=>new _.MathNode("mtd",[],[],{padding:"0",width:"50%"}),me=["mrow","mtd","mtable","mtr"],de=e=>{for(const t of e.children)if(t.type&&me.includes(t.type)){if(t.classes&&"tml-label"===t.classes[0]){return t.label}{const e=de(t);if(e)return e}}else if(!t.type){const e=de(t);if(e)return e}};function he(e,t,r,n){let o=null;1===e.length&&"tag"===e[0].type&&(o=e[0].tag,e=e[0].body);const a=le(e,r);if(1===a.length&&a[0]instanceof w)return a[0];const s=n.displayMode||n.annotate?"none":n.wrap,i=0===a.length?null:a[0];let l=1===a.length&&null===o&&i instanceof k?a[0]:function(e,t,r){const n=[];let o=[],a=[],s=0,i=0,l=0;for(;i<e.length;){for(;e[i]instanceof d;)e.splice(i,1,...e[i].children);const r=e[i];if(r.attributes&&r.attributes.linebreak&&"newline"===r.attributes.linebreak){a.length>0&&o.push(new _.MathNode("mrow",a)),o.push(r),a=[];const e=new _.MathNode("mtd",o);e.style.textAlign="left",n.push(new _.MathNode("mtr",[e])),o=[],i+=1;continue}if(a.push(r),r.type&&"mo"===r.type&&1===r.children.length&&!Object.hasOwn(r.attributes,"movablelimits")){const n=r.children[0].text;if("([{⌊⌈⟨⟮⎰⟦⦃".indexOf(n)>-1)l+=1;else if(")]}⌋⌉⟩⟯⎱⟦⦄".indexOf(n)>-1)l-=1;else if(0===l&&"="===t&&"="===n){if(s+=1,s>1){a.pop();const e=new _.MathNode("mrow",a);o.push(e),a=[r]}}else if(0===l&&"tex"===t&&"∇"!==n){const t=i<e.length-1?e[i+1]:null;let r=!0;if(!t||"mtext"!==t.type||!t.attributes.linebreak||"nobreak"!==t.attributes.linebreak)for(let n=i+1;n<e.length;n++){const t=e[n];if(!t.type||"mspace"!==t.type||t.attributes.linebreak&&"newline"===t.attributes.linebreak)break;a.push(t),i+=1,t.attributes&&t.attributes.linebreak&&"nobreak"===t.attributes.linebreak&&(r=!1)}if(r){const e=new _.MathNode("mrow",a);o.push(e),a=[]}}}i+=1}if(a.length>0){const e=new _.MathNode("mrow",a);o.push(e)}if(n.length>0){const e=new _.MathNode("mtd",o);e.style.textAlign="left";const t=new _.MathNode("mtr",[e]);n.push(t);const a=new _.MathNode("mtable",n);return r||(a.setAttribute("columnalign","left"),a.setAttribute("rowspacing","0em")),a}return _.newDocumentFragment(o)}(a,s,n.displayMode);if(o&&(l=((e,t,r,n)=>{t=ce(t[0].body,r),(t=ne(t)).classes.push("tml-tag");const o=de(e);e=new _.MathNode("mtd",[e]);const a=[pe(),e,pe()];a[n?0:2].classes.push(n?"tml-left":"tml-right"),a[n?0:2].children.push(t);const s=new _.MathNode("mtr",a,["tml-tageqn"]);o&&s.setAttribute("id",o);const i=new _.MathNode("mtable",[s]);return i.style.width="100%",i.setAttribute("displaystyle","true"),i})(l,o,r,n.leqno)),n.annotate){const e=new _.MathNode("annotation",[new _.TextNode(t)]);e.setAttribute("encoding","application/x-tex"),l=new _.MathNode("semantics",[l,e])}const c=new _.MathNode("math",[l]);return n.xml&&c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),l.style.width&&(c.style.width="100%"),n.displayMode&&(c.setAttribute("display","block"),c.style.display="block math",c.classes=["tml-display"]),c}const ge="acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳",fe=new Set(["\\alpha","\\gamma","\\delta","\\epsilon","\\eta","\\iota","\\kappa","\\mu","\\nu","\\pi","\\rho","\\sigma","\\tau","\\upsilon","\\chi","\\psi","\\omega","\\imath","\\jmath"]),be=new Set(["\\Gamma","\\Delta","\\Sigma","\\Omega","\\beta","\\delta","\\lambda","\\theta","\\psi"]),xe=(e,t)=>{const r=e.isStretchy?M(e):new _.MathNode("mo",[te(e.label,e.mode)]);if("\\vec"===e.label)r.style.transform="scale(0.75) translate(10%, 30%)";else if(r.style.mathStyle="normal",r.style.mathDepth="0",we.has(e.label)&&a.isCharacterBox(e.base)){let t="";const n=e.base.text;(ge.indexOf(n)>-1||fe.has(n))&&(t="tml-xshift"),("ABCDEFGHIJKLMNOPQRSTUVWXYZbdfhkltΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩβδλζφθψ𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐛𝐝𝐟𝐡𝐤𝐥𝐭".indexOf(n)>-1||be.has(n))&&(t="tml-capshift"),t&&r.classes.push(t)}e.isStretchy||r.setAttribute("stretchy","false");return new _.MathNode("\\c"===e.label?"munder":"mover",[ue(e.base,t),r])},ye=new Set(["\\acute","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"]),we=new Set(["\\acute","\\bar","\\breve","\\check","\\dot","\\ddot","\\grave","\\hat","\\mathring","\\'","\\^","\\~","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v"]),ve={"\\`":"̀","\\'":"́","\\^":"̂","\\~":"̃","\\=":"̄","\\u":"̆","\\.":"̇",'\\"':"̈","\\r":"̊","\\H":"̋","\\v":"̌"};c({type:"accent",names:["\\acute","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\overparen","\\widecheck","\\widehat","\\wideparen","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{const r=p(t[0]),n=!ye.has(e.funcName);return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,base:r}},mathmlBuilder:xe}),c({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\c","\\u","\\.",'\\"',"\\r","\\H","\\v"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{const r=p(t[0]),n=e.parser.mode;return"math"===n&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),"text"===n&&r.text&&1===r.text.length&&e.funcName in ve&&ge.indexOf(r.text)>-1?{type:"textord",mode:"text",text:r.text+ve[e.funcName]}:{type:"accent",mode:n,label:e.funcName,isStretchy:!1,base:r}},mathmlBuilder:xe}),c({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underparen","\\utilde"],props:{numArgs:1},handler:({parser:e,funcName:t},r)=>{const n=r[0];return{type:"accentUnder",mode:e.mode,label:t,base:n}},mathmlBuilder:(e,t)=>{const r=M(e);r.style["math-depth"]=0;return new _.MathNode("munder",[ue(e.base,t),r])}});const ke={pt:800/803,pc:9600/803,dd:1238/1157*800/803,cc:12.792133216944668,nd:685/642*800/803,nc:1370/107*800/803,sp:1/65536*800/803,mm:25.4/72,cm:2.54/72,in:1/72,px:96/72},Ae=["em","ex","mu","pt","mm","cm","in","px","bp","pc","dd","cc","nd","nc","sp"],qe=function(e){return"string"!=typeof e&&(e=e.unit),Ae.indexOf(e)>-1},_e=e=>[1,.7,.5][Math.max(e-1,0)],Se=function(t,r){let n=t.number;if(r.maxSize[0]<0&&n>0)return{number:0,unit:"em"};const o=t.unit;switch(o){case"mm":case"cm":case"in":case"px":return n*ke[o]>r.maxSize[1]?{number:r.maxSize[1],unit:"pt"}:{number:n,unit:o};case"em":case"ex":return"ex"===o&&(n*=.431),n=Math.min(n/_e(r.level),r.maxSize[0]),{number:a.round(n),unit:"em"};case"bp":return n>r.maxSize[1]&&(n=r.maxSize[1]),{number:n,unit:"pt"};case"pt":case"pc":case"dd":case"cc":case"nd":case"nc":case"sp":return n=Math.min(n*ke[o],r.maxSize[1]),{number:a.round(n),unit:"pt"};case"mu":return n=Math.min(n/18,r.maxSize[0]),{number:a.round(n),unit:"em"};default:throw new e("Invalid unit: '"+o+"'")}},Te=e=>{const t=new _.MathNode("mspace");return t.setAttribute("width",e+"em"),t},Ne=(e,t=.3,r=0,n=!1)=>{if(null==e&&0===r)return Te(t);const o=e?[e]:[];if(0!==t&&o.unshift(Te(t)),r>0&&o.push(Te(r)),n){const e=new _.MathNode("mpadded",o);return e.setAttribute("height","0"),e}return new _.MathNode("mrow",o)},$e=(e,t)=>Number(e)/_e(t),Oe=(e,t,r,n)=>{const o=O(e),a="eq"===e.slice(1,3),s="x"===e.charAt(1)?"1.75":"cd"===e.slice(2,4)?"3.0":a?"1.0":"2.0";o.setAttribute("lspace","0"),o.setAttribute("rspace",a?"0.5em":"0");const i=n.withLevel(n.level<2?2:3),l=$e(s,i.level),c=$e(s,3),u=Ne(null,l.toFixed(4),0),p=Ne(null,c.toFixed(4),0),m=$e(a?0:.3,i.level).toFixed(4);let d,h;const g=t&&t.body&&(t.body.body||t.body.length>0);if(g){let r=ue(t,i);r=Ne(r,m,m,"\\\\cdrightarrow"===e||"\\\\cdleftarrow"===e),d=new _.MathNode("mover",[r,p])}const f=r&&r.body&&(r.body.body||r.body.length>0);if(f){let e=ue(r,i);e=Ne(e,m,m),h=new _.MathNode("munder",[e,p])}let b;return b=g||f?g&&f?new _.MathNode("munderover",[o,h,d]):g?new _.MathNode("mover",[o,d]):new _.MathNode("munder",[o,h]):new _.MathNode("mover",[o,u]),"3.0"===s&&(b.style.height="1em"),b.setAttribute("accent","false"),b};c({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\yields","\\yieldsLeft","\\mesomerism","\\longrightharpoonup","\\longleftharpoondown","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler:({parser:e,funcName:t},r,n)=>({type:"xArrow",mode:e.mode,name:t,body:r[0],below:n[0]}),mathmlBuilder(e,t){const r=[Oe(e.name,e.body,e.below,t)];return r.unshift(Te(.2778)),r.push(Te(.2778)),new _.MathNode("mrow",r)}});const Me={"\\xtofrom":["\\xrightarrow","\\xleftarrow"],"\\xleftrightharpoons":["\\xleftharpoonup","\\xrightharpoondown"],"\\xrightleftharpoons":["\\xrightharpoonup","\\xleftharpoondown"],"\\yieldsLeftRight":["\\yields","\\yieldsLeft"],"\\equilibrium":["\\longrightharpoonup","\\longleftharpoondown"],"\\equilibriumRight":["\\longrightharpoonup","\\eqleftharpoondown"],"\\equilibriumLeft":["\\eqrightharpoonup","\\longleftharpoondown"]};function Be(e,t){if(!e||e.type!==t)throw new Error(`Expected node of type ${t}, but got `+(e?`node of type ${e.type}`:String(e)));return e}function Ce(e){const t=ze(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?`node of type ${e.type}`:String(e)));return t}function ze(e){return e&&("atom"===e.type||Object.prototype.hasOwnProperty.call(C,e.type))?e:null}c({type:"stackedArrow",names:["\\xtofrom","\\xleftrightharpoons","\\xrightleftharpoons","\\yieldsLeftRight","\\equilibrium","\\equilibriumRight","\\equilibriumLeft"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},r,n){const o=r[0]?{type:"hphantom",mode:e.mode,body:r[0]}:null,a=n[0]?{type:"hphantom",mode:e.mode,body:n[0]}:null;return{type:"stackedArrow",mode:e.mode,name:t,body:r[0],upperArrowBelow:a,lowerArrowBody:o,below:n[0]}},mathmlBuilder(e,t){const r=Me[e.name][0],n=Me[e.name][1],o=Oe(r,e.body,e.upperArrowBelow,t),a=Oe(n,e.lowerArrowBody,e.below,t);let s;const i=new _.MathNode("mpadded",[o]);if(i.setAttribute("voffset","0.3em"),i.setAttribute("height","+0.3em"),i.setAttribute("depth","-0.3em"),"\\equilibriumLeft"===e.name){const e=new _.MathNode("mpadded",[a]);e.setAttribute("width","0.5em"),s=new _.MathNode("mpadded",[Te(.2778),e,i,Te(.2778)])}else i.setAttribute("width","\\equilibriumRight"===e.name?"0.5em":"0"),s=new _.MathNode("mpadded",[Te(.2778),i,a,Te(.2778)]);return s.setAttribute("voffset","-0.18em"),s.setAttribute("height","-0.18em"),s.setAttribute("depth","+0.18em"),s}});const Ie={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Le=()=>({type:"styling",body:[],mode:"math",scriptLevel:"display"}),De=e=>"textord"===e.type&&"@"===e.text,Ee=(e,t)=>("mathord"===e.type||"atom"===e.type)&&e.text===t;function Fe(e,t,r){const n=Ie[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{const e={type:"atom",text:n,mode:"math",family:"rel"},o={type:"ordgroup",mode:"math",body:[r.callFunction("\\\\cdleft",[t[0]],[]),r.callFunction("\\Big",[e],[]),r.callFunction("\\\\cdright",[t[1]],[])],semisimple:!0};return r.callFunction("\\\\cdparent",[o],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{const e={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[e],[])}default:return{type:"textord",text:" ",mode:"math"}}}c({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:({parser:e,funcName:t},r)=>({type:"cdlabel",mode:e.mode,side:t.slice(4),label:r[0]}),mathmlBuilder(e,t){if(0===e.label.body.length)return new _.MathNode("mrow",t);const r=new _.MathNode("mtd",[ue(e.label,t)]);r.style.padding="0";const n=new _.MathNode("mtr",[r]),o=new _.MathNode("mtable",[n]),a=new _.MathNode("mpadded",[o]);return a.setAttribute("width","0"),a.setAttribute("displaystyle","false"),a.setAttribute("scriptlevel","1"),"left"===e.side&&(a.style.display="flex",a.style.justifyContent="flex-end"),a}}),c({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:({parser:e},t)=>({type:"cdlabelparent",mode:e.mode,fragment:t[0]}),mathmlBuilder:(e,t)=>new _.MathNode("mrow",[ue(e.fragment,t)])}),c({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler({parser:t,token:r},n){const o=Be(n[0],"ordgroup").body;let a="";for(let e=0;e<o.length;e++){a+=Be(o[e],"textord").text}const s=parseInt(a);if(isNaN(s))throw new e(`\\@char has non-numeric argument ${a}`,r);return{type:"textord",mode:t.mode,text:String.fromCodePoint(s)}}});const Ge=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,Pe=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,Re=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,je=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,Ue=/^[a-f0-9]{6}$/i,Ve=e=>{let t=e.toString(16);return 1===t.length&&(t="0"+t),t},Ze=JSON.parse('{\n "Apricot": "#ffb484",\n "Aquamarine": "#08b4bc",\n "Bittersweet": "#c84c14",\n "blue": "#0000FF",\n "Blue": "#303494",\n "BlueGreen": "#08b4bc",\n "BlueViolet": "#503c94",\n "BrickRed": "#b8341c",\n "brown": "#BF8040",\n "Brown": "#802404",\n "BurntOrange": "#f8941c",\n "CadetBlue": "#78749c",\n "CarnationPink": "#f884b4",\n "Cerulean": "#08a4e4",\n "CornflowerBlue": "#40ace4",\n "cyan": "#00FFFF",\n "Cyan": "#08acec",\n "Dandelion": "#ffbc44",\n "darkgray": "#404040",\n "DarkOrchid": "#a8548c",\n "Emerald": "#08ac9c",\n "ForestGreen": "#089c54",\n "Fuchsia": "#90348c",\n "Goldenrod": "#ffdc44",\n "gray": "#808080",\n "Gray": "#98949c",\n "green": "#00FF00",\n "Green": "#08a44c",\n "GreenYellow": "#e0e474",\n "JungleGreen": "#08ac9c",\n "Lavender": "#f89cc4",\n "lightgray": "#c0c0c0",\n "lime": "#BFFF00",\n "LimeGreen": "#90c43c",\n "magenta": "#FF00FF",\n "Magenta": "#f0048c",\n "Mahogany": "#b0341c",\n "Maroon": "#b03434",\n "Melon": "#f89c7c",\n "MidnightBlue": "#086494",\n "Mulberry": "#b03c94",\n "NavyBlue": "#086cbc",\n "olive": "#7F7F00",\n "OliveGreen": "#407c34",\n "orange": "#FF8000",\n "Orange": "#f8843c",\n "OrangeRed": "#f0145c",\n "Orchid": "#b074ac",\n "Peach": "#f8945c",\n "Periwinkle": "#8074bc",\n "PineGreen": "#088c74",\n "pink": "#ff7f7f",\n "Plum": "#98248c",\n "ProcessBlue": "#08b4ec",\n "purple": "#BF0040",\n "Purple": "#a0449c",\n "RawSienna": "#983c04",\n "red": "#ff0000",\n "Red": "#f01c24",\n "RedOrange": "#f86434",\n "RedViolet": "#a0246c",\n "Rhodamine": "#f0549c",\n "Royallue": "#0874bc",\n "RoyalPurple": "#683c9c",\n "RubineRed": "#f0047c",\n "Salmon": "#f8948c",\n "SeaGreen": "#30bc9c",\n "Sepia": "#701404",\n "SkyBlue": "#48c4dc",\n "SpringGreen": "#c8dc64",\n "Tan": "#e09c74",\n "teal": "#007F7F",\n "TealBlue": "#08acb4",\n "Thistle": "#d884b4",\n "Turquoise": "#08b4cc",\n "violet": "#800080",\n "Violet": "#60449c",\n "VioletRed": "#f054a4",\n "WildStrawberry": "#f0246c",\n "yellow": "#FFFF00",\n "Yellow": "#fff404",\n "YellowGreen": "#98cc6c",\n "YellowOrange": "#ffa41c"\n}'),He=(t,r)=>{let n="";if("HTML"===t){if(!Ge.test(r))throw new e("Invalid HTML input.");n=r}else if("RGB"===t){if(!Re.test(r))throw new e("Invalid RGB input.");r.split(",").map(e=>{n+=Ve(Number(e.trim()))})}else{if(!je.test(r))throw new e("Invalid rbg input.");r.split(",").map(t=>{const r=Number(t.trim());if(r>1)throw new e("Color rgb input must be < 1.");n+=Ve(Number((255*r).toFixed(0)))})}return"#"!==n.charAt(0)&&(n="#"+n),n},We=(t,r,n)=>{const o=`\\\\color@${t}`;if(!Pe.exec(t))throw new e("Invalid color: '"+t+"'",n);return Ue.test(t)?"#"+t:("#"===t.charAt(0)||(r.has(o)?t=r.get(o).tokens[0].text:Ze[t]&&(t=Ze[t])),t)},Xe=(e,t)=>{let r=le(e.body,t.withColor(e.color));return r=r.map(t=>(t.style.color=e.color,t)),_.newDocumentFragment(r)};c({type:"color",names:["\\textcolor"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","original"]},handler({parser:e,token:t},r,n){const o=n[0]&&Be(n[0],"raw").string;let a="";if(o){const e=Be(r[0],"raw").string;a=He(o,e)}else a=We(Be(r[0],"raw").string,e.gullet.macros,t);const s=r[1];return{type:"color",mode:e.mode,color:a,isTextColor:!0,body:m(s)}},mathmlBuilder:Xe}),c({type:"color",names:["\\color"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw"]},handler({parser:e,breakOnTokenText:t,token:r},n,o){const a=o[0]&&Be(o[0],"raw").string;let s="";if(a){const e=Be(n[0],"raw").string;s=He(a,e)}else s=We(Be(n[0],"raw").string,e.gullet.macros,r);const i=e.parseExpression(!0,t,!0);return{type:"color",mode:e.mode,color:s,isTextColor:!1,body:i}},mathmlBuilder:Xe}),c({type:"color",names:["\\definecolor"],props:{numArgs:3,allowedInText:!0,argTypes:["raw","raw","raw"]},handler({parser:t,funcName:r,token:n},o){const a=Be(o[0],"raw").string;if(!/^[A-Za-z]+$/.test(a))throw new e("Color name must be latin letters.",n);const s=Be(o[1],"raw").string;if(!["HTML","RGB","rgb"].includes(s))throw new e("Color model must be HTML, RGB, or rgb.",n);const i=Be(o[2],"raw").string,l=He(s,i);return t.gullet.macros.set(`\\\\color@${a}`,{tokens:[{text:l}],numArgs:0}),{type:"internal",mode:t.mode}}}),c({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},t,r){const n="["===e.gullet.future().text?e.parseSizeGroup(!0):null,o=!e.settings.displayMode;return{type:"cr",mode:e.mode,newLine:o,size:n&&Be(n,"size").value}},mathmlBuilder(e,t){const r=new _.MathNode("mo");if(e.newLine&&(r.setAttribute("linebreak","newline"),e.size)){const n=Se(e.size,t);r.setAttribute("height",n.number+n.unit)}return r}});const Ke={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Ye=t=>{const r=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(r))throw new e("Expected a control sequence",t);return r},Je=(e,t,r,n)=>{let o=e.gullet.macros.get(r.text);null==o&&(r.noexpand=!0,o={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,o,n)};c({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler({parser:t,funcName:r}){t.consumeSpaces();const n=t.fetch();if(Ke[n.text])return"\\global"!==r&&"\\\\globallong"!==r||(n.text=Ke[n.text]),Be(t.parseFunction(),"internal");throw new e("Invalid token after macro prefix",n)}}),c({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:t,funcName:r}){let n=t.gullet.popToken();const o=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(o))throw new e("Expected a control sequence",n);let a,s=0;const i=[[]];for(;"{"!==t.gullet.future().text;)if(n=t.gullet.popToken(),"#"===n.text){if("{"===t.gullet.future().text){a=t.gullet.future(),i[s].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new e(`Invalid argument number "${n.text}"`);if(parseInt(n.text)!==s+1)throw new e(`Argument number "${n.text}" out of order`);s++,i.push([])}else{if("EOF"===n.text)throw new e("Expected a macro definition");i[s].push(n.text)}let{tokens:l}=t.gullet.consumeArg();if(a&&l.unshift(a),"\\edef"===r||"\\xdef"===r){if(l=t.gullet.expandTokens(l),l.length>t.gullet.settings.maxExpand)throw new e("Too many expansions in an "+r);l.reverse()}return t.gullet.macros.set(o,{tokens:l,numArgs:s,delimiters:i},r===Ke[r]),{type:"internal",mode:t.mode}}}),c({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){const r=Ye(e.gullet.popToken());e.gullet.consumeSpaces();const n=(e=>{let t=e.gullet.popToken();return"="===t.text&&(t=e.gullet.popToken()," "===t.text&&(t=e.gullet.popToken())),t})(e);return Je(e,r,n,"\\\\globallet"===t),{type:"internal",mode:e.mode}}}),c({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){const r=Ye(e.gullet.popToken()),n=e.gullet.popToken(),o=e.gullet.popToken();return Je(e,r,o,"\\\\globalfuture"===t),e.gullet.pushToken(o),e.gullet.pushToken(n),{type:"internal",mode:e.mode}}}),c({type:"internal",names:["\\newcommand","\\renewcommand","\\providecommand"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:t,funcName:r}){let n="";const o=t.gullet.popToken();"{"===o.text?(n=Ye(t.gullet.popToken()),t.gullet.popToken()):n=Ye(o);const a=t.gullet.isDefined(n);if(a&&"\\newcommand"===r)throw new e(`\\newcommand{${n}} attempting to redefine ${n}; use \\renewcommand`);if(!a&&"\\renewcommand"===r)throw new e(`\\renewcommand{${n}} when command ${n} does not yet exist; use \\newcommand`);let s=0;if("["===t.gullet.future().text){let r=t.gullet.popToken();if(r=t.gullet.popToken(),!/^[0-9]$/.test(r.text))throw new e(`Invalid number of arguments: "${r.text}"`);if(s=parseInt(r.text),r=t.gullet.popToken(),"]"!==r.text)throw new e(`Invalid argument "${r.text}"`)}const{tokens:i}=t.gullet.consumeArg();return"\\providecommand"===r&&t.gullet.macros.has(n)||t.gullet.macros.set(n,{tokens:i,numArgs:s}),{type:"internal",mode:t.mode}}});const Qe={"\\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}},et=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","⦇","\\llparenthesis","⦈","\\rrparenthesis","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lAngle","⟪","\\rAngle","⟫","\\llangle","⦉","\\rrangle","⦊","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","\\llbracket","\\rrbracket","⟦","⟦","\\lBrace","\\rBrace","⦃","⦄","/","\\backslash","|","\\vert","\\|","\\Vert","‖","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."],tt=["}","\\left","\\middle","\\right"],rt=e=>e.length>0&&(et.includes(e)||Qe[e]||tt.includes(e)),nt=[0,1.2,1.8,2.4,3];function ot(t,r){const n=ze(t);if(n&&et.includes(n.text))return["<","\\lt"].includes(n.text)&&(n.text="⟨"),[">","\\gt"].includes(n.text)&&(n.text="⟩"),n;throw new e(n?`Invalid delimiter '${n.text}' after '${r.funcName}'`:`Invalid delimiter type '${t.type}'`,t)}const at=["/","\\","\\backslash","\\vert","|"];c({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:(e,t)=>{const r=ot(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:Qe[e.funcName].size,mclass:Qe[e.funcName].mclass,delim:r.text}},mathmlBuilder:e=>{const t=[];"."===e.delim&&(e.delim=""),t.push(te(e.delim,e.mode));const r=new _.MathNode("mo",t);return"mopen"===e.mclass||"mclose"===e.mclass?r.setAttribute("fence","true"):r.setAttribute("fence","false"),(at.includes(e.delim)||e.delim.indexOf("arrow")>-1)&&r.setAttribute("stretchy","true"),r.setAttribute("symmetric","true"),r.setAttribute("minsize",nt[e.size]+"em"),r.setAttribute("maxsize",nt[e.size]+"em"),r}}),c({type:"leftright-right",names:["\\right"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>({type:"leftright-right",mode:e.parser.mode,delim:ot(t[0],e).text})}),c({type:"leftright",names:["\\left"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,r)=>{const n=ot(r[0],t),o=t.parser;++o.leftrightDepth;let a=o.parseExpression(!1,null,!0),s=o.fetch();for(;"\\middle"===s.text;){o.consume();const t=o.fetch().text;if(!z.math[t])throw new e(`Invalid delimiter '${t}' after '\\middle'`);ot({type:"atom",mode:"math",text:t},{funcName:"\\middle"}),a.push({type:"middle",mode:"math",delim:t}),o.consume(),a=a.concat(o.parseExpression(!1,null,!0)),s=o.fetch()}--o.leftrightDepth,o.expect("\\right",!1);const i=Be(o.parseFunction(),"leftright-right");return{type:"leftright",mode:o.mode,body:a,left:n.text,right:i.delim}},mathmlBuilder:(e,t)=>{!function(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}(e);const r=le(e.body,t);"."===e.left&&(e.left="");const n=new _.MathNode("mo",[te(e.left,e.mode)]);n.setAttribute("fence","true"),n.setAttribute("form","prefix"),("/"===e.left||"\\"===e.left||e.left.indexOf("arrow")>-1)&&n.setAttribute("stretchy","true"),r.unshift(n),"."===e.right&&(e.right="");const o=new _.MathNode("mo",[te(e.right,e.mode)]);if(o.setAttribute("fence","true"),o.setAttribute("form","postfix"),("∖"===e.right||e.right.indexOf("arrow")>-1)&&o.setAttribute("stretchy","true"),e.body.length>0){const t=e.body[e.body.length-1];"color"!==t.type||t.isTextColor||o.setAttribute("mathcolor",t.color)}return r.push(o),oe(r)}}),c({type:"middle",names:["\\middle"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,r)=>{const n=ot(r[0],t);if(!t.parser.leftrightDepth)throw new e("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},mathmlBuilder:(e,t)=>{const r=te(e.delim,e.mode),n=new _.MathNode("mo",[r]);return n.setAttribute("fence","true"),e.delim.indexOf("arrow")>-1&&n.setAttribute("stretchy","true"),n.setAttribute("form","prefix"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});const st=e=>{const t=new _.MathNode("mspace");return t.setAttribute("width","3pt"),t},it=(e,t)=>{let r;switch(r=e.label.indexOf("colorbox")>-1||"\\boxed"===e.label?new _.MathNode("mrow",[st(),ue(e.body,t),st()]):new _.MathNode("menclose",[ue(e.body,t)]),e.label){case"\\overline":r.setAttribute("notation","top"),r.classes.push("tml-overline");break;case"\\underline":r.setAttribute("notation","bottom"),r.classes.push("tml-underline");break;case"\\cancel":r.setAttribute("notation","updiagonalstrike"),r.children.push(new _.MathNode("mrow",[],["tml-cancel","upstrike"]));break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike"),r.children.push(new _.MathNode("mrow",[],["tml-cancel","downstrike"]));break;case"\\sout":r.setAttribute("notation","horizontalstrike"),r.children.push(new _.MathNode("mrow",[],["tml-cancel","sout"]));break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike"),r.classes.push("tml-xcancel");break;case"\\longdiv":r.setAttribute("notation","longdiv"),r.classes.push("longdiv-top"),r.children.push(new _.MathNode("mrow",[],["longdiv-arc"]));break;case"\\phase":r.setAttribute("notation","phasorangle"),r.classes.push("phasor-bottom"),r.children.push(new _.MathNode("mrow",[],["phasor-angle"]));break;case"\\textcircled":r.setAttribute("notation","circle"),r.classes.push("circle-pad"),r.children.push(new _.MathNode("mrow",[],["textcircle"]));break;case"\\angl":r.setAttribute("notation","actuarial"),r.classes.push("actuarial");break;case"\\boxed":r.setAttribute("notation","box"),r.classes.push("tml-box"),r.setAttribute("scriptlevel","0"),r.setAttribute("displaystyle","true");break;case"\\fbox":r.setAttribute("notation","box"),r.classes.push("tml-fbox");break;case"\\fcolorbox":case"\\colorbox":{const t={padding:"3pt 0 3pt 0"};"\\fcolorbox"===e.label&&(t.border="0.0667em solid "+String(e.borderColor)),r.style=t;break}}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};c({type:"enclose",names:["\\colorbox"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","text"]},handler({parser:e,funcName:t},r,n){const o=n[0]&&Be(n[0],"raw").string;let a="";if(o){const e=Be(r[0],"raw").string;a=He(o,e)}else a=We(Be(r[0],"raw").string,e.gullet.macros);const s=r[1];return{type:"enclose",mode:e.mode,label:t,backgroundColor:a,body:s}},mathmlBuilder:it}),c({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","raw","text"]},handler({parser:e,funcName:t},r,n){const o=n[0]&&Be(n[0],"raw").string;let a,s="";if(o){const e=Be(r[0],"raw").string,t=Be(r[0],"raw").string;s=He(o,e),a=He(o,t)}else s=We(Be(r[0],"raw").string,e.gullet.macros),a=We(Be(r[1],"raw").string,e.gullet.macros);const i=r[2];return{type:"enclose",mode:e.mode,label:t,backgroundColor:a,borderColor:s,body:i}},mathmlBuilder:it}),c({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"enclose",mode:e.mode,label:"\\fbox",body:t[0]})}),c({type:"enclose",names:["\\angl","\\cancel","\\bcancel","\\xcancel","\\sout","\\overline","\\boxed","\\longdiv","\\phase"],props:{numArgs:1},handler({parser:e,funcName:t},r){const n=r[0];return{type:"enclose",mode:e.mode,label:t,body:n}},mathmlBuilder:it}),c({type:"enclose",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},r){const n=r[0];return{type:"enclose",mode:e.mode,label:t,body:n}},mathmlBuilder:it}),c({type:"enclose",names:["\\textcircled"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},r){const n=r[0];return{type:"enclose",mode:e.mode,label:t,body:n}},mathmlBuilder:it});const lt={};function ct({type:e,names:t,props:r,handler:n,mathmlBuilder:o}){const a={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:n};for(let s=0;s<t.length;++s)lt[t[s]]=a;o&&(l[e]=o)}class ut{constructor(e,t,r){this.lexer=e,this.start=t,this.end=r}static range(e,t){return t?e&&e.loc&&t.loc&&e.loc.lexer===t.loc.lexer?new ut(e.loc.lexer,e.loc.start,t.loc.end):null:e&&e.loc}}class pt{constructor(e,t){this.text=e,this.loc=t}range(e,t){return new pt(t,ut.range(this,e))}}const mt=0,dt=1,ht=2,gt=3,ft={};function bt(e,t){ft[e]=t}const xt=ft;bt("\\noexpand",function(e){const t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),bt("\\expandafter",function(e){const t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),bt("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),bt("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),bt("\\@ifnextchar",function(e){const t=e.consumeArgs(3);e.consumeSpaces();const r=e.future();return 1===t[0].length&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),bt("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),bt("\\TextOrMath",function(e){const t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});const yt=e=>{let t="";for(let r=e.length-1;r>-1;r--)t+=e[r].text;return t},wt={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},vt=e=>{const t=e.future().text;return"EOF"===t?[null,""]:[wt[t.charAt(0)],t]},kt=(e,t,r)=>{for(let n=1;n<t.length;n++){e*=r,e+=wt[t.charAt(n)]}return e};function At(e){const t=e.consumeArgs(1)[0];let r="",n=t[t.length-1].loc.start;for(let o=t.length-1;o>=0;o--){const e=t[o].loc.start;e>n&&(r+=" ",n=e),r+=t[o].text,n+=t[o].text.length}return r}bt("\\char",function(t){let r,n=t.popToken(),o="";if("'"===n.text)r=8,n=t.popToken();else if('"'===n.text)r=16,n=t.popToken();else if("`"===n.text)if(n=t.popToken(),"\\"===n.text[0])o=n.text.charCodeAt(1);else{if("EOF"===n.text)throw new e("\\char` missing argument");o=n.text.charCodeAt(0)}else r=10;if(r){let a,s=n.text;if(o=wt[s.charAt(0)],null==o||o>=r)throw new e(`Invalid base-${r} digit ${n.text}`);for(o=kt(o,s,r),[a,s]=vt(t);null!=a&&a<r;)o*=r,o+=a,o=kt(o,s,r),t.popToken(),[a,s]=vt(t)}return`\\@char{${o}}`}),bt("\\surd","\\sqrt{\\vphantom{|}}"),bt("⊕","\\oplus"),bt("\\long",""),bt("\\bgroup","{"),bt("\\egroup","}"),bt("~","\\nobreakspace"),bt("\\lq","`"),bt("\\rq","'"),bt("\\aa","\\r a"),bt("\\Bbbk","\\Bbb{k}"),bt("\\mathstrut","\\vphantom{(}"),bt("\\underbar","\\underline{\\text{#1}}"),bt("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),bt("⋮","\\vdots"),bt("\\arraystretch","1"),bt("\\arraycolsep","6pt"),bt("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),bt("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),bt("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),bt("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");const qt={",":"\\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","\\bigsqcap":"\\dotsb","\\bigsqcup":"\\dotsb","\\bigtimes":"\\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"};bt("\\dots",function(e){let t="\\dotso";const r=e.expandAfterFuture().text;return r in qt?t=qt[r]:("\\not"===r.slice(0,4)||r in z.math&&["bin","rel"].includes(z.math[r].group))&&(t="\\dotsb"),t});const _t={")":!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};bt("\\dotso",function(e){return e.future().text in _t?"\\ldots\\,":"\\ldots"}),bt("\\dotsc",function(e){const t=e.future().text;return t in _t&&","!==t?"\\ldots\\,":"\\ldots"}),bt("\\cdots",function(e){return e.future().text in _t?"\\@cdots\\,":"\\@cdots"}),bt("\\dotsb","\\cdots"),bt("\\dotsm","\\cdots"),bt("\\dotsi","\\!\\cdots"),bt("\\idotsint","\\dotsi"),bt("\\dotsx","\\ldots\\,"),bt("\\DOTSI","\\relax"),bt("\\DOTSB","\\relax"),bt("\\DOTSX","\\relax"),bt("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),bt("\\,","{\\tmspace+{3mu}{.1667em}}"),bt("\\thinspace","\\,"),bt("\\>","\\mskip{4mu}"),bt("\\:","{\\tmspace+{4mu}{.2222em}}"),bt("\\medspace","\\:"),bt("\\;","{\\tmspace+{5mu}{.2777em}}"),bt("\\thickspace","\\;"),bt("\\!","{\\tmspace-{3mu}{.1667em}}"),bt("\\negthinspace","\\!"),bt("\\negmedspace","{\\tmspace-{4mu}{.2222em}}"),bt("\\negthickspace","{\\tmspace-{5mu}{.277em}}"),bt("\\enspace","\\kern.5em "),bt("\\enskip","\\hskip.5em\\relax"),bt("\\quad","\\hskip1em\\relax"),bt("\\qquad","\\hskip2em\\relax"),bt("\\AA","\\TextOrMath{\\Angstrom}{\\mathring{A}}\\relax"),bt("\\tag","\\@ifstar\\tag@literal\\tag@paren"),bt("\\tag@paren","\\tag@literal{({#1})}"),bt("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new e("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),bt("\\notag","\\nonumber"),bt("\\nonumber","\\gdef\\@eqnsw{0}"),bt("\\bmod","\\mathbin{\\text{mod}}"),bt("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),bt("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),bt("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),bt("\\newline","\\\\\\relax"),bt("\\TeX","\\textrm{T}\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125em\\textrm{X}"),bt("\\LaTeX","\\textrm{L}\\kern-.35em\\raisebox{0.2em}{\\scriptstyle A}\\kern-.15em\\TeX"),bt("\\Temml","\\textrm{T}\\kern-0.2em\\lower{0.2em}{\\textrm{E}}\\kern-0.08em{\\textrm{M}\\kern-0.08em\\raise{0.2em}\\textrm{M}\\kern-0.08em\\textrm{L}}"),bt("\\hspace","\\@ifstar\\@hspacer\\@hspace"),bt("\\@hspace","\\hskip #1\\relax"),bt("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),bt("\\colon",'\\mathpunct{\\char"3a}'),bt("\\prescript","\\pres@cript{_{#1}^{#2}}{}{#3}"),bt("\\ordinarycolon",'\\char"3a'),bt("\\vcentcolon","\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}}"),bt("\\coloneq",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2212}'),bt("\\Coloneq",'\\mathrel{\\char"2237\\char"2212}'),bt("\\Eqqcolon",'\\mathrel{\\char"3d\\char"2237}'),bt("\\Eqcolon",'\\mathrel{\\char"2212\\char"2237}'),bt("\\colonapprox",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2248}'),bt("\\Colonapprox",'\\mathrel{\\char"2237\\char"2248}'),bt("\\colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),bt("\\Colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),bt("\\ratio","\\vcentcolon"),bt("\\coloncolon","\\dblcolon"),bt("\\colonequals","\\coloneqq"),bt("\\coloncolonequals","\\Coloneqq"),bt("\\equalscolon","\\eqqcolon"),bt("\\equalscoloncolon","\\Eqqcolon"),bt("\\colonminus","\\coloneq"),bt("\\coloncolonminus","\\Coloneq"),bt("\\minuscolon","\\eqcolon"),bt("\\minuscoloncolon","\\Eqcolon"),bt("\\coloncolonapprox","\\Colonapprox"),bt("\\coloncolonsim","\\Colonsim"),bt("\\notni","\\mathrel{\\char`∌}"),bt("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),bt("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),bt("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),bt("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),bt("\\varlimsup","\\DOTSB\\operatorname*{\\overline{\\text{lim}}}"),bt("\\varliminf","\\DOTSB\\operatorname*{\\underline{\\text{lim}}}"),bt("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{\\text{lim}}}"),bt("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{\\text{lim}}}"),bt("\\centerdot","{\\medspace\\rule{0.167em}{0.189em}\\medspace}"),bt("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),bt("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),bt("\\plim","\\DOTSB\\operatorname*{plim}"),bt("\\leftmodels","\\mathop{\\reflectbox{$\\models$}}"),bt("\\bra","\\mathinner{\\langle{#1}|}"),bt("\\ket","\\mathinner{|{#1}\\rangle}"),bt("\\braket","\\mathinner{\\langle{#1}\\rangle}"),bt("\\Bra","\\left\\langle#1\\right|"),bt("\\Ket","\\left|#1\\right\\rangle");const St=(e,t)=>{const r=`}\\,\\middle${"|"===t[0]?"\\vert":"\\Vert"}\\,{`;return e.slice(0,t.index)+r+e.slice(t.index+t[0].length)};bt("\\Braket",function(e){let t=At(e);const r=/\|\||\||\\\|/g;let n;for(;null!==(n=r.exec(t));)t=St(t,n);return"\\left\\langle{"+t+"}\\right\\rangle"}),bt("\\Set",function(e){let t=At(e);const r=/\|\||\||\\\|/.exec(t);return r&&(t=St(t,r)),"\\left\\{\\:{"+t+"}\\:\\right\\}"}),bt("\\set",function(e){return"\\{{"+At(e).replace(/\|/,"}\\mid{")+"}\\}"}),bt("\\angln","{\\angl n}"),bt("\\odv","\\@ifstar\\odv@next\\odv@numerator"),bt("\\odv@numerator","\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}"),bt("\\odv@next","\\frac{\\mathrm{d}}{\\mathrm{d}#2}#1"),bt("\\pdv","\\@ifstar\\pdv@next\\pdv@numerator");const Tt=e=>{const t=e[0][0].text,r=yt(e[1]).split(","),n=String(r.length),o="1"===n?"\\partial":`\\partial^${n}`;let a="";return r.map(e=>{a+="\\partial "+e.trim()+"\\,"}),[t,o,a.replace(/\\,$/,"")]};bt("\\pdv@numerator",function(e){const[t,r,n]=Tt(e.consumeArgs(2));return`\\frac{${r} ${t}}{${n}}`}),bt("\\pdv@next",function(e){const[t,r,n]=Tt(e.consumeArgs(2));return`\\frac{${r}}{${n}} ${t}`}),bt("\\upalpha","\\up@greek{\\alpha}"),bt("\\upbeta","\\up@greek{\\beta}"),bt("\\upgamma","\\up@greek{\\gamma}"),bt("\\updelta","\\up@greek{\\delta}"),bt("\\upepsilon","\\up@greek{\\epsilon}"),bt("\\upzeta","\\up@greek{\\zeta}"),bt("\\upeta","\\up@greek{\\eta}"),bt("\\uptheta","\\up@greek{\\theta}"),bt("\\upiota","\\up@greek{\\iota}"),bt("\\upkappa","\\up@greek{\\kappa}"),bt("\\uplambda","\\up@greek{\\lambda}"),bt("\\upmu","\\up@greek{\\mu}"),bt("\\upnu","\\up@greek{\\nu}"),bt("\\upxi","\\up@greek{\\xi}"),bt("\\upomicron","\\up@greek{\\omicron}"),bt("\\uppi","\\up@greek{\\pi}"),bt("\\upalpha","\\up@greek{\\alpha}"),bt("\\uprho","\\up@greek{\\rho}"),bt("\\upsigma","\\up@greek{\\sigma}"),bt("\\uptau","\\up@greek{\\tau}"),bt("\\upupsilon","\\up@greek{\\upsilon}"),bt("\\upphi","\\up@greek{\\phi}"),bt("\\upchi","\\up@greek{\\chi}"),bt("\\uppsi","\\up@greek{\\psi}"),bt("\\upomega","\\up@greek{\\omega}"),bt("\\invamp",'\\mathbin{\\char"214b}'),bt("\\parr",'\\mathbin{\\char"214b}'),bt("\\with",'\\mathbin{\\char"26}'),bt("\\multimapinv",'\\mathrel{\\char"27dc}'),bt("\\multimapboth",'\\mathrel{\\char"29df}'),bt("\\scoh",'{\\mkern5mu\\char"2322\\mkern5mu}'),bt("\\sincoh",'{\\mkern5mu\\char"2323\\mkern5mu}'),bt("\\coh",'{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2322}}}\n{\\smash{\\lower4mu{\\char"2323}}}\\mkern5mu}'),bt("\\incoh",'{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2323}}}\n{\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}'),bt("\\standardstate","\\text{\\tiny\\char`⦵}"),bt("\\ce",function(e){return Nt(e.consumeArgs(1)[0],"ce")}),bt("\\pu",function(e){return Nt(e.consumeArgs(1)[0],"pu")}),bt("\\uniDash","{\\rule{0.672em}{0.06em}}"),bt("\\triDash","{\\rule{0.15em}{0.06em}\\kern2mu\\rule{0.15em}{0.06em}\\kern2mu\\rule{0.15em}{0.06em}}"),bt("\\tripleDash","\\kern0.075em\\raise0.25em{\\triDash}\\kern0.075em"),bt("\\tripleDashOverLine","\\kern0.075em\\mathrlap{\\raise0.125em{\\uniDash}}\\raise0.34em{\\triDash}\\kern0.075em"),bt("\\tripleDashOverDoubleLine","\\kern0.075em\\mathrlap{\\mathrlap{\\raise0.48em{\\triDash}}\\raise0.27em{\\uniDash}}{\\raise0.05em{\\uniDash}}\\kern0.075em"),bt("\\tripleDashBetweenDoubleLine","\\kern0.075em\\mathrlap{\\mathrlap{\\raise0.48em{\\uniDash}}\\raise0.27em{\\triDash}}{\\raise0.05em{\\uniDash}}\\kern0.075em");var Nt=function(e,t){for(var r="",n=e.length&&e[e.length-1].loc.start,o=e.length-1;o>=0;o--)e[o].loc.start>n&&(r+=" ",n=e[o].loc.start),r+=e[o].text,n+=e[o].text.length;return Ot.go($t.go(r,t))},$t={go:function(e,t){if(!e)return[];void 0===t&&(t="ce");var r,n="0",o={};o.parenthesisLevel=0,e=(e=(e=e.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var a=10,s=[];;){r!==e?(a=10,r=e):a--;var i=$t.stateMachines[t],l=i.transitions[n]||i.transitions["*"];e:for(var c=0;c<l.length;c++){var u=$t.patterns.match_(l[c].pattern,e);if(u){for(var p=l[c].task,m=0;m<p.action_.length;m++){var d;if(i.actions[p.action_[m].type_])d=i.actions[p.action_[m].type_](o,u.match_,p.action_[m].option);else{if(!$t.actions[p.action_[m].type_])throw["MhchemBugA","mhchem bug A. Please report. ("+p.action_[m].type_+")"];d=$t.actions[p.action_[m].type_](o,u.match_,p.action_[m].option)}$t.concatArray(s,d)}if(n=p.nextState||n,!(e.length>0))return s;if(p.revisit||(e=u.remainder),!p.toContinue)break e}}if(a<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(e,t){if(t)if(Array.isArray(t))for(var r=0;r<t.length;r++)e.push(t[r]);else e.push(t)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return t&&t[0]?{match_:t.splice(1),remainder:e.substr(t[0].length)}:null},"(-)(9)^(-9)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return t&&t[0]?{match_:t.splice(1),remainder:e.substr(t[0].length)}:null},"state of aggregation $":function(e){var t=$t.patterns.findObserveGroups(e,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(t&&t.remainder.match(/^($|[\s,;\)\]\}])/))return t;var r=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return r?{match_:r[0],remainder:e.substr(r[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return $t.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return $t.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return $t.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return $t.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return $t.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return $t.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return $t.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return $t.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return $t.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return $t.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return $t.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return $t.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return $t.patterns.findObserveGroups(e,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(e){return $t.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return $t.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return $t.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return $t.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(e){return $t.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return $t.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return $t.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return $t.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return $t.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return $t.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return $t.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return $t.patterns.findObserveGroups(e,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(e){var t;if(t=e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/))return{match_:t[0],remainder:e.substr(t[0].length)};var r=$t.patterns.findObserveGroups(e,"","$","$","");return r&&(t=r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/))?{match_:t[0],remainder:e.substr(t[0].length)}:null},amount2:function(e){return this.amount(e)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(e){if(e.match(/^\([a-z]+\)$/))return null;var t=e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return t?{match_:t[0],remainder:e.substr(t[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(e,t,r,n,o,a,s,i,l,c){var u=function(e,t){if("string"==typeof t)return 0!==e.indexOf(t)?null:t;var r=e.match(t);return r?r[0]:null},p=u(e,t);if(null===p)return null;if(e=e.substr(p.length),null===(p=u(e,r)))return null;var m=function(e,t,r){for(var n=0;t<e.length;){var o=e.charAt(t),a=u(e.substr(t),r);if(null!==a&&0===n)return{endMatchBegin:t,endMatchEnd:t+a.length};if("{"===o)n++;else if("}"===o){if(0===n)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];n--}t++}return null}(e,p.length,n||o);if(null===m)return null;var d=e.substring(0,n?m.endMatchEnd:m.endMatchBegin);if(a||s){var h=this.findObserveGroups(e.substr(m.endMatchEnd),a,s,i,l);if(null===h)return null;var g=[d,h.match_];return{match_:c?g.join(""):g,remainder:h.remainder}}return{match_:d,remainder:e.substr(m.endMatchEnd)}},match_:function(e,t){var r=$t.patterns.patterns[e];if(void 0===r)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if("function"==typeof r)return $t.patterns.patterns[e](t);var n=t.match(r);return n?{match_:n[2]?[n[1],n[2]]:n[1]?n[1]:n[0],remainder:t.substr(n[0].length)}:null}},actions:{"a=":function(e,t){e.a=(e.a||"")+t},"b=":function(e,t){e.b=(e.b||"")+t},"p=":function(e,t){e.p=(e.p||"")+t},"o=":function(e,t){e.o=(e.o||"")+t},"q=":function(e,t){e.q=(e.q||"")+t},"d=":function(e,t){e.d=(e.d||"")+t},"rm=":function(e,t){e.rm=(e.rm||"")+t},"text=":function(e,t){e.text_=(e.text_||"")+t},insert:function(e,t,r){return{type_:r}},"insert+p1":function(e,t,r){return{type_:r,p1:t}},"insert+p1+p2":function(e,t,r){return{type_:r,p1:t[0],p2:t[1]}},copy:function(e,t){return t},rm:function(e,t){return{type_:"rm",p1:t||""}},text:function(e,t){return $t.go(t,"text")},"{text}":function(e,t){var r=["{"];return $t.concatArray(r,$t.go(t,"text")),r.push("}"),r},"tex-math":function(e,t){return $t.go(t,"tex-math")},"tex-math tight":function(e,t){return $t.go(t,"tex-math tight")},bond:function(e,t,r){return{type_:"bond",kind_:r||t}},"color0-output":function(e,t){return{type_:"color0",color:t[0]}},ce:function(e,t){return $t.go(t)},"1/2":function(e,t){var r=[];t.match(/^[+\-]/)&&(r.push(t.substr(0,1)),t=t.substr(1));var n=t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return n[1]=n[1].replace(/\$/g,""),r.push({type_:"frac",p1:n[1],p2:n[2]}),n[3]&&(n[3]=n[3].replace(/\$/g,""),r.push({type_:"tex-math",p1:n[3]})),r},"9,9":function(e,t){return $t.go(t,"9,9")}},createTransitions:function(e){var t,r,n,o,a={};for(t in e)for(r in e[t])for(n=r.split("|"),e[t][r].stateArray=n,o=0;o<n.length;o++)a[n[o]]=[];for(t in e)for(r in e[t])for(n=e[t][r].stateArray||[],o=0;o<n.length;o++){var s=e[t][r];if(s.action_){s.action_=[].concat(s.action_);for(var i=0;i<s.action_.length;i++)"string"==typeof s.action_[i]&&(s.action_[i]={type_:s.action_[i]})}else s.action_=[];for(var l=t.split("|"),c=0;c<l.length;c++)if("*"===n[o])for(var u in a)a[u].push({pattern:l[c],task:s});else a[n[o]].push({pattern:l[c],task:s})}return a},stateMachines:{}};$t.stateMachines={ce:{transitions:$t.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(e,t){var r;if((e.d||"").match(/^[0-9]+$/)){var n=e.d;e.d=void 0,r=this.output(e),e.b=n}else r=this.output(e);return $t.actions["o="](e,t),r},"d= kv":function(e,t){e.d=t,e.dType="kv"},"charge or bond":function(e,t){if(e.beginsWithBond){var r=[];return $t.concatArray(r,this.output(e)),$t.concatArray(r,$t.actions.bond(e,t,"-")),r}e.d=t},"- after o/d":function(e,t,r){var n=$t.patterns.match_("orbital",e.o||""),o=$t.patterns.match_("one lowercase greek letter $",e.o||""),a=$t.patterns.match_("one lowercase latin letter $",e.o||""),s=$t.patterns.match_("$one lowercase latin letter$ $",e.o||""),i="-"===t&&(n&&""===n.remainder||o||a||s);!i||e.a||e.b||e.p||e.d||e.q||n||!a||(e.o="$"+e.o+"$");var l=[];return i?($t.concatArray(l,this.output(e)),l.push({type_:"hyphen"})):(n=$t.patterns.match_("digits",e.d||""),r&&n&&""===n.remainder?($t.concatArray(l,$t.actions["d="](e,t)),$t.concatArray(l,this.output(e))):($t.concatArray(l,this.output(e)),$t.concatArray(l,$t.actions.bond(e,t,"-")))),l},"a to o":function(e){e.o=e.a,e.a=void 0},"sb=true":function(e){e.sb=!0},"sb=false":function(e){e.sb=!1},"beginsWithBond=true":function(e){e.beginsWithBond=!0},"beginsWithBond=false":function(e){e.beginsWithBond=!1},"parenthesisLevel++":function(e){e.parenthesisLevel++},"parenthesisLevel--":function(e){e.parenthesisLevel--},"state of aggregation":function(e,t){return{type_:"state of aggregation",p1:$t.go(t,"o")}},comma:function(e,t){var r=t.replace(/\s*$/,"");return r!==t&&0===e.parenthesisLevel?{type_:"comma enumeration L",p1:r}:{type_:"comma enumeration M",p1:r}},output:function(e,t,r){var n,o,a;e.r?(o="M"===e.rdt?$t.go(e.rd,"tex-math"):"T"===e.rdt?[{type_:"text",p1:e.rd||""}]:$t.go(e.rd),a="M"===e.rqt?$t.go(e.rq,"tex-math"):"T"===e.rqt?[{type_:"text",p1:e.rq||""}]:$t.go(e.rq),n={type_:"arrow",r:e.r,rd:o,rq:a}):(n=[],(e.a||e.b||e.p||e.o||e.q||e.d||r)&&(e.sb&&n.push({type_:"entitySkip"}),e.o||e.q||e.d||e.b||e.p||2===r?e.o||e.q||e.d||!e.b&&!e.p?e.o&&"kv"===e.dType&&$t.patterns.match_("d-oxidation$",e.d||"")?e.dType="oxidation":e.o&&"kv"===e.dType&&!e.q&&(e.dType=void 0):(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):(e.o=e.a,e.a=void 0),n.push({type_:"chemfive",a:$t.go(e.a,"a"),b:$t.go(e.b,"bd"),p:$t.go(e.p,"pq"),o:$t.go(e.o,"o"),q:$t.go(e.q,"pq"),d:$t.go(e.d,"oxidation"===e.dType?"oxidation":"bd"),dType:e.dType})));for(var s in e)"parenthesisLevel"!==s&&"beginsWithBond"!==s&&delete e[s];return n},"oxidation-output":function(e,t){var r=["{"];return $t.concatArray(r,$t.go(t,"oxidation")),r.push("}"),r},"frac-output":function(e,t){return{type_:"frac-ce",p1:$t.go(t[0]),p2:$t.go(t[1])}},"overset-output":function(e,t){return{type_:"overset",p1:$t.go(t[0]),p2:$t.go(t[1])}},"underset-output":function(e,t){return{type_:"underset",p1:$t.go(t[0]),p2:$t.go(t[1])}},"underbrace-output":function(e,t){return{type_:"underbrace",p1:$t.go(t[0]),p2:$t.go(t[1])}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:$t.go(t[1])}},"r=":function(e,t){e.r=t},"rdt=":function(e,t){e.rdt=t},"rd=":function(e,t){e.rd=t},"rqt=":function(e,t){e.rqt=t},"rq=":function(e,t){e.rq=t},operator:function(e,t,r){return{type_:"operator",kind_:r||t}}}},a:{transitions:$t.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:$t.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:$t.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(e){if(e.text_){var t={type_:"text",p1:e.text_};for(var r in e)delete e[r];return t}}}},pq:{transitions:$t.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(e,t){return{type_:"state of aggregation subscript",p1:$t.go(t,"o")}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:$t.go(t[1],"pq")}}}},bd:{transitions:$t.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(e,t){return{type_:"color",color1:t[0],color2:$t.go(t[1],"bd")}}}},oxidation:{transitions:$t.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(e,t){return{type_:"roman numeral",p1:t||""}}}},"tex-math":{transitions:$t.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(e){if(e.o){var t={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return t}}}},"tex-math tight":{transitions:$t.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(e,t){e.o=(e.o||"")+"{"+t+"}"},output:function(e){if(e.o){var t={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return t}}}},"9,9":{transitions:$t.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:$t.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(e,t){var r=[];return"+-"===t[0]||"+/-"===t[0]?r.push("\\pm "):t[0]&&r.push(t[0]),t[1]&&($t.concatArray(r,$t.go(t[1],"pu-9,9")),t[2]&&(t[2].match(/[,.]/)?$t.concatArray(r,$t.go(t[2],"pu-9,9")):r.push(t[2])),t[3]=t[4]||t[3],t[3]&&(t[3]=t[3].trim(),"e"===t[3]||"*"===t[3].substr(0,1)?r.push({type_:"cdot"}):r.push({type_:"times"}))),t[3]&&r.push("10^{"+t[5]+"}"),r},"number^":function(e,t){var r=[];return"+-"===t[0]||"+/-"===t[0]?r.push("\\pm "):t[0]&&r.push(t[0]),$t.concatArray(r,$t.go(t[1],"pu-9,9")),r.push("^{"+t[2]+"}"),r},operator:function(e,t,r){return{type_:"operator",kind_:r||t}},space:function(){return{type_:"pu-space-1"}},output:function(e){var t,r=$t.patterns.match_("{(...)}",e.d||"");r&&""===r.remainder&&(e.d=r.match_);var n=$t.patterns.match_("{(...)}",e.q||"");if(n&&""===n.remainder&&(e.q=n.match_),e.d&&(e.d=e.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.d=e.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),e.q){e.q=e.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.q=e.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var o={d:$t.go(e.d,"pu"),q:$t.go(e.q,"pu")};"//"===e.o?t={type_:"pu-frac",p1:o.d,p2:o.q}:(t=o.d,o.d.length>1||o.q.length>1?t.push({type_:" / "}):t.push({type_:"/"}),$t.concatArray(t,o.q))}else t=$t.go(e.d,"pu-2");for(var a in e)delete e[a];return t}}},"pu-2":{transitions:$t.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(e,t){e.rm+="^{"+t+"}"},space:function(){return{type_:"pu-space-2"}},output:function(e){var t=[];if(e.rm){var r=$t.patterns.match_("{(...)}",e.rm||"");t=r&&""===r.remainder?$t.go(r.match_,"pu"):{type_:"rm",p1:e.rm}}for(var n in e)delete e[n];return t}}},"pu-9,9":{transitions:$t.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(e){var t=[];if(e.text_=e.text_||"",e.text_.length>4){var r=e.text_.length%3;0===r&&(r=3);for(var n=e.text_.length-3;n>0;n-=3)t.push(e.text_.substr(n,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(0,r)),t.reverse()}else t.push(e.text_);for(var o in e)delete e[o];return t},"output-o":function(e){var t=[];if(e.text_=e.text_||"",e.text_.length>4){for(var r=e.text_.length-3,n=0;n<r;n+=3)t.push(e.text_.substr(n,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(n))}else t.push(e.text_);for(var o in e)delete e[o];return t}}}};var Ot={go:function(e,t){if(!e)return"";for(var r="",n=!1,o=0;o<e.length;o++){var a=e[o];"string"==typeof a?r+=a:(r+=Ot._go2(a),"1st-level escape"===a.type_&&(n=!0))}return t||n||!r||(r="{"+r+"}"),r},_goInner:function(e){return e?Ot.go(e,!0):e},_go2:function(e){var t;switch(e.type_){case"chemfive":t="";var r={a:Ot._goInner(e.a),b:Ot._goInner(e.b),p:Ot._goInner(e.p),o:Ot._goInner(e.o),q:Ot._goInner(e.q),d:Ot._goInner(e.d)};r.a&&(r.a.match(/^[+\-]/)&&(r.a="{"+r.a+"}"),t+=r.a+"\\,"),(r.b||r.p)&&(t+="{\\vphantom{X}}",t+="^{\\hphantom{"+(r.b||"")+"}}_{\\hphantom{"+(r.p||"")+"}}",t+="{\\vphantom{X}}",t+="^{\\vphantom{2}\\mathllap{"+(r.b||"")+"}}",t+="_{\\vphantom{2}\\mathllap{"+(r.p||"")+"}}"),r.o&&(r.o.match(/^[+\-]/)&&(r.o="{"+r.o+"}"),t+=r.o),"kv"===e.dType?((r.d||r.q)&&(t+="{\\vphantom{X}}"),r.d&&(t+="^{"+r.d+"}"),r.q&&(t+="_{"+r.q+"}")):"oxidation"===e.dType?(r.d&&(t+="{\\vphantom{X}}",t+="^{"+r.d+"}"),r.q&&(t+="{{}}",t+="_{"+r.q+"}")):(r.q&&(t+="{{}}",t+="_{"+r.q+"}"),r.d&&(t+="{{}}",t+="^{"+r.d+"}"));break;case"rm":case"roman numeral":t="\\mathrm{"+e.p1+"}";break;case"text":e.p1.match(/[\^_]/)?(e.p1=e.p1.replace(" ","~").replace("-","\\text{-}"),t="\\mathrm{"+e.p1+"}"):t="\\text{"+e.p1+"}";break;case"state of aggregation":t="\\mskip2mu "+Ot._goInner(e.p1);break;case"state of aggregation subscript":t="\\mskip1mu "+Ot._goInner(e.p1);break;case"bond":if(!(t=Ot._getBond(e.kind_)))throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+e.kind_+")"];break;case"frac":var n="\\frac{"+e.p1+"}{"+e.p2+"}";t="\\mathchoice{\\textstyle"+n+"}{"+n+"}{"+n+"}{"+n+"}";break;case"pu-frac":var o="\\frac{"+Ot._goInner(e.p1)+"}{"+Ot._goInner(e.p2)+"}";t="\\mathchoice{\\textstyle"+o+"}{"+o+"}{"+o+"}{"+o+"}";break;case"tex-math":case"1st-level escape":t=e.p1+" ";break;case"frac-ce":t="\\frac{"+Ot._goInner(e.p1)+"}{"+Ot._goInner(e.p2)+"}";break;case"overset":t="\\overset{"+Ot._goInner(e.p1)+"}{"+Ot._goInner(e.p2)+"}";break;case"underset":t="\\underset{"+Ot._goInner(e.p1)+"}{"+Ot._goInner(e.p2)+"}";break;case"underbrace":t="\\underbrace{"+Ot._goInner(e.p1)+"}_{"+Ot._goInner(e.p2)+"}";break;case"color":t="{\\color{"+e.color1+"}{"+Ot._goInner(e.color2)+"}}";break;case"color0":t="\\color{"+e.color+"}";break;case"arrow":var a={rd:Ot._goInner(e.rd),rq:Ot._goInner(e.rq)},s=Ot._getArrow(e.r);a.rq&&(s+="[{\\rm "+a.rq+"}]"),t=s+=a.rd?"{\\rm "+a.rd+"}":"{}";break;case"operator":t=Ot._getOperator(e.kind_);break;case"space":t=" ";break;case"entitySkip":case"pu-space-1":t="~";break;case"pu-space-2":t="\\mkern3mu ";break;case"1000 separator":t="\\mkern2mu ";break;case"commaDecimal":t="{,}";break;case"comma enumeration L":t="{"+e.p1+"}\\mkern6mu ";break;case"comma enumeration M":t="{"+e.p1+"}\\mkern3mu ";break;case"comma enumeration S":t="{"+e.p1+"}\\mkern1mu ";break;case"hyphen":t="\\text{-}";break;case"addition compound":t="\\,{\\cdot}\\,";break;case"electron dot":t="\\mkern1mu \\text{\\textbullet}\\mkern1mu ";break;case"KV x":t="{\\times}";break;case"prime":t="\\prime ";break;case"cdot":t="\\cdot ";break;case"tight cdot":t="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":t="\\times ";break;case"circa":t="{\\sim}";break;case"^":t="uparrow";break;case"v":t="downarrow";break;case"ellipsis":t="\\ldots ";break;case"/":t="/";break;case" / ":t="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return t},_getArrow:function(e){switch(e){case"->":case"→":case"⟶":return"\\yields";case"<-":return"\\yieldsLeft";case"<->":return"\\mesomerism";case"<--\x3e":return"\\yieldsLeftRight";case"<=>":case"⇌":return"\\equilibrium";case"<=>>":return"\\equilibriumRight";case"<<=>":return"\\equilibriumLeft";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(e){switch(e){case"-":case"1":return"{-}";case"=":case"2":return"{=}";case"#":case"3":return"{\\equiv}";case"~":return"{\\tripleDash}";case"~-":return"{\\tripleDashOverLine}";case"~=":case"~--":return"{\\tripleDashOverDoubleLine}";case"-~-":return"{\\tripleDashBetweenDoubleLine}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(e){switch(e){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":case"$\\approx$":return" {}\\approx{} ";case"v":case"(v)":return" \\downarrow{} ";case"^":case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};function Mt(e){const t=[];e.consumeSpaces();let r=e.fetch().text;for("\\relax"===r&&(e.consume(),e.consumeSpaces(),r=e.fetch().text);"\\hline"===r||"\\hdashline"===r;)e.consume(),t.push("\\hdashline"===r),e.consumeSpaces(),r=e.fetch().text;return t}bt("\\darr","\\downarrow"),bt("\\dArr","\\Downarrow"),bt("\\Darr","\\Downarrow"),bt("\\lang","\\langle"),bt("\\rang","\\rangle"),bt("\\uarr","\\uparrow"),bt("\\uArr","\\Uparrow"),bt("\\Uarr","\\Uparrow"),bt("\\N","\\mathbb{N}"),bt("\\R","\\mathbb{R}"),bt("\\Z","\\mathbb{Z}"),bt("\\alef","\\aleph"),bt("\\alefsym","\\aleph"),bt("\\bull","\\bullet"),bt("\\clubs","\\clubsuit"),bt("\\cnums","\\mathbb{C}"),bt("\\Complex","\\mathbb{C}"),bt("\\Dagger","\\ddagger"),bt("\\diamonds","\\diamondsuit"),bt("\\empty","\\emptyset"),bt("\\exist","\\exists"),bt("\\harr","\\leftrightarrow"),bt("\\hArr","\\Leftrightarrow"),bt("\\Harr","\\Leftrightarrow"),bt("\\hearts","\\heartsuit"),bt("\\image","\\Im"),bt("\\infin","\\infty"),bt("\\isin","\\in"),bt("\\larr","\\leftarrow"),bt("\\lArr","\\Leftarrow"),bt("\\Larr","\\Leftarrow"),bt("\\lrarr","\\leftrightarrow"),bt("\\lrArr","\\Leftrightarrow"),bt("\\Lrarr","\\Leftrightarrow"),bt("\\natnums","\\mathbb{N}"),bt("\\plusmn","\\pm"),bt("\\rarr","\\rightarrow"),bt("\\rArr","\\Rightarrow"),bt("\\Rarr","\\Rightarrow"),bt("\\real","\\Re"),bt("\\reals","\\mathbb{R}"),bt("\\Reals","\\mathbb{R}"),bt("\\sdot","\\cdot"),bt("\\sect","\\S"),bt("\\spades","\\spadesuit"),bt("\\sub","\\subset"),bt("\\sube","\\subseteq"),bt("\\supe","\\supseteq"),bt("\\thetasym","\\vartheta"),bt("\\weierp","\\wp"),bt("\\quantity","{\\left\\{ #1 \\right\\}}"),bt("\\qty","{\\left\\{ #1 \\right\\}}"),bt("\\pqty","{\\left( #1 \\right)}"),bt("\\bqty","{\\left[ #1 \\right]}"),bt("\\vqty","{\\left\\vert #1 \\right\\vert}"),bt("\\Bqty","{\\left\\{ #1 \\right\\}}"),bt("\\absolutevalue","{\\left\\vert #1 \\right\\vert}"),bt("\\abs","{\\left\\vert #1 \\right\\vert}"),bt("\\norm","{\\left\\Vert #1 \\right\\Vert}"),bt("\\evaluated","{\\left.#1 \\right\\vert}"),bt("\\eval","{\\left.#1 \\right\\vert}"),bt("\\order","{\\mathcal{O} \\left( #1 \\right)}"),bt("\\commutator","{\\left[ #1 , #2 \\right]}"),bt("\\comm","{\\left[ #1 , #2 \\right]}"),bt("\\anticommutator","{\\left\\{ #1 , #2 \\right\\}}"),bt("\\acomm","{\\left\\{ #1 , #2 \\right\\}}"),bt("\\poissonbracket","{\\left\\{ #1 , #2 \\right\\}}"),bt("\\pb","{\\left\\{ #1 , #2 \\right\\}}"),bt("\\vectorbold","{\\boldsymbol{ #1 }}"),bt("\\vb","{\\boldsymbol{ #1 }}"),bt("\\vectorarrow","{\\vec{\\boldsymbol{ #1 }}}"),bt("\\va","{\\vec{\\boldsymbol{ #1 }}}"),bt("\\vectorunit","{{\\boldsymbol{\\hat{ #1 }}}}"),bt("\\vu","{{\\boldsymbol{\\hat{ #1 }}}}"),bt("\\dotproduct","\\mathbin{\\boldsymbol\\cdot}"),bt("\\vdot","{\\boldsymbol\\cdot}"),bt("\\crossproduct","\\mathbin{\\boldsymbol\\times}"),bt("\\cross","\\mathbin{\\boldsymbol\\times}"),bt("\\cp","\\mathbin{\\boldsymbol\\times}"),bt("\\gradient","{\\boldsymbol\\nabla}"),bt("\\grad","{\\boldsymbol\\nabla}"),bt("\\divergence","{\\grad\\vdot}"),bt("\\curl","{\\grad\\cross}"),bt("\\laplacian","\\nabla^2"),bt("\\tr","{\\operatorname{tr}}"),bt("\\Tr","{\\operatorname{Tr}}"),bt("\\rank","{\\operatorname{rank}}"),bt("\\erf","{\\operatorname{erf}}"),bt("\\Res","{\\operatorname{Res}}"),bt("\\principalvalue","{\\mathcal{P}}"),bt("\\pv","{\\mathcal{P}}"),bt("\\PV","{\\operatorname{P.V.}}"),bt("\\qqtext","{\\quad\\text{ #1 }\\quad}"),bt("\\qq","{\\quad\\text{ #1 }\\quad}"),bt("\\qcomma","{\\text{,}\\quad}"),bt("\\qc","{\\text{,}\\quad}"),bt("\\qcc","{\\quad\\text{c.c.}\\quad}"),bt("\\qif","{\\quad\\text{if}\\quad}"),bt("\\qthen","{\\quad\\text{then}\\quad}"),bt("\\qelse","{\\quad\\text{else}\\quad}"),bt("\\qotherwise","{\\quad\\text{otherwise}\\quad}"),bt("\\qunless","{\\quad\\text{unless}\\quad}"),bt("\\qgiven","{\\quad\\text{given}\\quad}"),bt("\\qusing","{\\quad\\text{using}\\quad}"),bt("\\qassume","{\\quad\\text{assume}\\quad}"),bt("\\qsince","{\\quad\\text{since}\\quad}"),bt("\\qlet","{\\quad\\text{let}\\quad}"),bt("\\qfor","{\\quad\\text{for}\\quad}"),bt("\\qall","{\\quad\\text{all}\\quad}"),bt("\\qeven","{\\quad\\text{even}\\quad}"),bt("\\qodd","{\\quad\\text{odd}\\quad}"),bt("\\qinteger","{\\quad\\text{integer}\\quad}"),bt("\\qand","{\\quad\\text{and}\\quad}"),bt("\\qor","{\\quad\\text{or}\\quad}"),bt("\\qas","{\\quad\\text{as}\\quad}"),bt("\\qin","{\\quad\\text{in}\\quad}"),bt("\\differential","{\\text{d}}"),bt("\\dd","{\\text{d}}"),bt("\\derivative","{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}"),bt("\\dv","{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}"),bt("\\partialderivative","{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}"),bt("\\variation","{\\delta}"),bt("\\var","{\\delta}"),bt("\\functionalderivative","{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}"),bt("\\fdv","{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}"),bt("\\innerproduct","{\\left\\langle {#1} \\mid { #2} \\right\\rangle}"),bt("\\outerproduct","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}"),bt("\\dyad","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}"),bt("\\ketbra","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}"),bt("\\op","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}"),bt("\\expectationvalue","{\\left\\langle {#1 } \\right\\rangle}"),bt("\\expval","{\\left\\langle {#1 } \\right\\rangle}"),bt("\\ev","{\\left\\langle {#1 } \\right\\rangle}"),bt("\\matrixelement","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}"),bt("\\matrixel","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}"),bt("\\mel","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}");const Bt=t=>{if(!t.parser.settings.displayMode)throw new e(`{${t.envName}} can be used only in display mode.`)},Ct=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,zt=e=>{let t=e.get("\\arraystretch");"string"!=typeof t&&(t=yt(t.tokens)),t=isNaN(t)?null:Number(t);let r=e.get("\\arraycolsep");"string"!=typeof r&&(r=yt(r.tokens));const n=Ct.exec(r);return[t,n?{number:+(n[1]+n[2]),unit:n[3]}:null]},It=t=>{let r="";for(let n=0;n<t.length;n++)if("label"===t[n].type){if(r)throw new e("Multiple \\labels in one row");r=t[n].string}return r};function Lt(e){if(-1===e.indexOf("ed"))return-1===e.indexOf("*")}function Dt(t,{cols:r,envClasses:n,autoTag:o,singleRow:a,emptySingleRow:s,maxNumCols:i,leqno:l,arraystretch:c,arraycolsep:u},p){t.gullet.beginGroup(),a||t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();let m=[];const d=[m],h=[],g=[],f=[],b=null!=o?[]:void 0;function x(){o&&t.gullet.macros.set("\\@eqnsw","1",!0)}function y(){b&&(t.gullet.macros.get("\\df@tag")?(b.push(t.subparse([new pt("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):b.push(Boolean(o)&&"1"===t.gullet.macros.get("\\@eqnsw")))}for(x(),f.push(Mt(t));;){let r=t.parseExpression(!1,a?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),r={type:"ordgroup",mode:t.mode,body:r,semisimple:!0},m.push(r);const o=t.fetch().text;if("&"===o){if(i&&m.length===i){if(!n.includes("array"))throw new e(2===i?"The split environment accepts no more than two columns":"The equation environment accepts only one column",t.nextToken);if(t.settings.strict)throw new e("Too few columns specified in the {array} column argument.",t.nextToken)}t.consume()}else{if("\\end"===o){y(),1===m.length&&0===r.body.length&&(d.length>1||!s)&&d.pop(),g.push(It(r.body)),f.length<d.length+1&&f.push([]);break}if("\\\\"!==o)throw new e("Expected & or \\\\ or \\cr or \\end",t.nextToken);{let e;t.consume()," "!==t.gullet.future().text&&(e=t.parseSizeGroup(!0)),h.push(e?e.value:null),y(),g.push(It(r.body)),f.push(Mt(t)),m=[],d.push(m),x()}}}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,body:d,cols:r,rowGaps:h,hLinesBeforeRow:f,envClasses:n,autoTag:o,scriptLevel:p,tags:b,labels:g,leqno:l,arraystretch:c,arraycolsep:u}}function Et(e){return"d"===e.slice(0,1)?"display":"text"}const Ft={c:"center ",l:"left ",r:"right "},Gt=e=>{const t=new _.MathNode("mtd",[]);return t.style={padding:"0",width:"50%"},e.envClasses.includes("multline")&&(t.style.width="7.5%"),t},Pt=function(e,t){const r=[],n=e.body.length,o=e.hLinesBeforeRow;for(let i=0;i<n;i++){const a=e.body[i],s=[],l="text"===e.scriptLevel?dt:"script"===e.scriptLevel?ht:mt;for(let r=0;r<a.length;r++){const o=new _.MathNode("mtd",[ue(a[r],t.withLevel(l))]);if(e.envClasses.includes("multline")){const e=0===i?"left":i===n-1?"right":"center";o.setAttribute("columnalign",e),"center"!==e&&o.classes.push("tml-"+e)}s.push(o)}const c=e.body[0].length;for(let e=0;e<c-a.length;e++)s.push(new _.MathNode("mtd",[],t));if(e.autoTag){const r=e.tags[i];let n;!0===r?n=new _.MathNode("mtext",[new x(["tml-eqn"])]):!1===r?n=new _.MathNode("mtext",[],[]):(n=ce(r[0].body,t.withLevel(l),!0),n=ne(n),n.classes=["tml-tag"]),n&&(s.unshift(Gt(e)),s.push(Gt(e)),e.leqno?(s[0].children.push(n),s[0].classes.push("tml-left")):(s[s.length-1].children.push(n),s[s.length-1].classes.push("tml-right")))}const u=new _.MathNode("mtr",s,[]),p=e.labels.shift();p&&e.tags&&e.tags[i]&&(u.setAttribute("id",p),Array.isArray(e.tags[i])&&u.classes.push("tml-tageqn")),0===i&&o[0].length>0&&(2===o[0].length?u.children.forEach(e=>{e.style.borderTop="0.15em double"}):u.children.forEach(e=>{e.style.borderTop=o[0][0]?"0.06em dashed":"0.06em solid"})),o[i+1].length>0&&(2===o[i+1].length?u.children.forEach(e=>{e.style.borderBottom="0.15em double"}):u.children.forEach(e=>{e.style.borderBottom=o[i+1][0]?"0.06em dashed":"0.06em solid"})),r.push(u)}if(e.envClasses.length>0){if(e.arraystretch&&1!==e.arraystretch){const t=String(1.4*e.arraystretch-.8)+"ex";for(let e=0;e<r.length;e++)for(let n=0;n<r[e].children.length;n++)r[e].children[n].style.paddingTop=t,r[e].children[n].style.paddingBottom=t}let n=e.envClasses.includes("abut")||e.envClasses.includes("cases")?"0":e.envClasses.includes("small")?"0.1389":e.envClasses.includes("cd")?"0.25":"0.4",o="em";if(e.arraycolsep){const r=Se(e.arraycolsep,t);n=r.number.toFixed(4),o=r.unit}const a=0===r.length?0:r[0].children.length,s=(t,r)=>0===t&&0===r||t===a-1&&1===r?"0":"align"!==e.envClasses[0]?n:1===r?"0":e.autoTag?t%2?"1":"0":t%2?"0":"1";for(let e=0;e<r.length;e++)for(let t=0;t<r[e].children.length;t++)r[e].children[t].style.paddingLeft=`${s(t,0)}${o}`,r[e].children[t].style.paddingRight=`${s(t,1)}${o}`;const i=e.envClasses.includes("align")||e.envClasses.includes("alignat");for(let t=0;t<r.length;t++){const n=r[t];if(i){for(let e=0;e<n.children.length;e++)n.children[e].classes=["tml-"+(e%2?"left":"right")];if(e.autoTag){const t=e.leqno?0:n.children.length-1;n.children[t].classes=["tml-"+(e.leqno?"left":"right")]}}if(n.children.length>1&&e.envClasses.includes("cases")&&(n.children[1].style.paddingLeft="1em"),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(const e of n.children)e.classes.push("tml-left")}}else for(let i=0;i<r.length;i++)r[i].children[0].style.paddingLeft="0em",r[i].children.length===r[0].children.length&&(r[i].children[r[i].children.length-1].style.paddingRight="0em");let a=new _.MathNode("mtable",r);e.envClasses.length>0&&(e.envClasses.includes("jot")?a.classes.push("tml-jot"):e.envClasses.includes("small")&&a.classes.push("tml-small")),"display"===e.scriptLevel&&a.setAttribute("displaystyle","true"),(e.autoTag||e.envClasses.includes("multline"))&&(a.style.width="100%");let s="";if(e.cols&&e.cols.length>0){const t=e.cols;let r=!1,n=0,o=t.length;for(;"separator"===t[n].type;)n+=1;for(;"separator"===t[o-1].type;)o-=1;if("separator"===t[0].type){const e="separator"===t[1].type?"0.15em double":"|"===t[0].separator?"0.06em solid ":"0.06em dashed ";for(const t of a.children)t.children[0].style.borderLeft=e}let i=e.autoTag?0:-1;for(let e=n;e<o;e++)if("align"===t[e].type){const n=Ft[t[e].align];s+=n,i+=1;for(const e of a.children)"center"!==n.trim()&&i<e.children.length&&(e.children[i].classes=["tml-"+n.trim()]);r=!0}else if("separator"===t[e].type){if(r){const r="separator"===t[e+1].type?"0.15em double":"|"===t[e].separator?"0.06em solid":"0.06em dashed";for(const e of a.children)i<e.children.length&&(e.children[i].style.borderRight=r)}r=!1}if("separator"===t[t.length-1].type){const e="separator"===t[t.length-2].type?"0.15em double":"|"===t[t.length-1].separator?"0.06em solid":"0.06em dashed";for(const t of a.children)t.children[t.children.length-1].style.borderRight=e,t.children[t.children.length-1].style.paddingRight="0.4em"}}return e.autoTag&&(s="left "+(s.length>0?s:"center ")+"right "),s&&a.setAttribute("columnalign",s.trim()),e.envClasses.includes("small")&&(a=new _.MathNode("mstyle",[a]),a.setAttribute("scriptlevel","1")),a},Rt=function(t,r){-1===t.envName.indexOf("ed")&&Bt(t);const n="split"===t.envName,o=[],a=Dt(t.parser,{cols:o,emptySingleRow:!0,autoTag:n?void 0:Lt(t.envName),envClasses:["abut","jot"],maxNumCols:"split"===t.envName?2:void 0,leqno:t.parser.settings.leqno},"display");let s,i=0;const l=t.envName.indexOf("at")>-1;if(r[0]&&l){let t="";for(let e=0;e<r[0].body.length;e++){t+=Be(r[0].body[e],"textord").text}if(isNaN(t))throw new e("The alignat enviroment requires a numeric first argument.");s=Number(t),i=2*s}a.body.forEach(function(t){if(l){const r=t.length/2;if(s<r)throw new e(`Too many math in a row: expected ${s}, but got ${r}`,t[0])}else i<t.length&&(i=t.length)});for(let e=0;e<i;++e){let t="r";e%2==1&&(t="l"),o[e]={type:"align",align:t}}return"split"===t.envName||(l?a.envClasses.push("alignat"):a.envClasses[0]="align"),a};ct({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,r){const n=(ze(r[0])?[r[0]]:Be(r[0],"ordgroup").body).map(function(t){const r=Ce(t).text;if(-1!=="lcr".indexOf(r))return{type:"align",align:r};if("|"===r)return{type:"separator",separator:"|"};if(":"===r)return{type:"separator",separator:":"};throw new e("Unknown column alignment: "+r,t)}),[o,a]=zt(t.parser.gullet.macros),s={cols:n,envClasses:["array"],maxNumCols:n.length,arraystretch:o,arraycolsep:a};return Dt(t.parser,s,Et(t.envName))},mathmlBuilder:Pt}),ct({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){const r={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")];let n="c";const o={envClasses:[],cols:[]};if("*"===t.envName.charAt(t.envName.length-1)){const r=t.parser;if(r.consumeSpaces(),"["===r.fetch().text){if(r.consume(),r.consumeSpaces(),n=r.fetch().text,-1==="lcr".indexOf(n))throw new e("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),o.cols=[]}}const a=Dt(t.parser,o,"text");a.cols=new Array(a.body[0].length).fill({type:"align",align:n});const[s,i]=zt(t.parser.gullet.macros);return r?{type:"leftright",mode:t.mode,body:[a],left:r[0],right:r[1],rightColor:void 0,arraystretch:s,arraycolsep:i}:a},mathmlBuilder:Pt}),ct({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){const t=Dt(e.parser,{},"script");return t.envClasses=["small"],t},mathmlBuilder:Pt}),ct({type:"array",names:["subarray"],props:{numArgs:1},handler(t,r){const n=(ze(r[0])?[r[0]]:Be(r[0],"ordgroup").body).map(function(t){const r=Ce(t).text;if(-1!=="lc".indexOf(r))return{type:"align",align:r};throw new e("Unknown column alignment: "+r,t)});if(n.length>1)throw new e("{subarray} can contain only one column");let o={cols:n,envClasses:["small"]};if(o=Dt(t.parser,o,"script"),o.body.length>0&&o.body[0].length>1)throw new e("{subarray} can contain only one column");return o},mathmlBuilder:Pt}),ct({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){const t=Dt(e.parser,{cols:[],envClasses:["cases"]},Et(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},mathmlBuilder:Pt}),ct({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Rt,mathmlBuilder:Pt}),ct({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Rt,mathmlBuilder:Pt}),ct({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){"gathered"!==e.envName&&Bt(e);const t={cols:[],envClasses:["abut","jot"],autoTag:Lt(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Dt(e.parser,t,"display")},mathmlBuilder:Pt}),ct({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Bt(e);const t={autoTag:Lt(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:["align"],leqno:e.parser.settings.leqno};return Dt(e.parser,t,"display")},mathmlBuilder:Pt}),ct({type:"array",names:["multline","multline*"],props:{numArgs:0},handler(e){Bt(e);const t={autoTag:"multline"===e.envName,maxNumCols:1,envClasses:["jot","multline"],leqno:e.parser.settings.leqno};return Dt(e.parser,t,"display")},mathmlBuilder:Pt}),ct({type:"array",names:["CD"],props:{numArgs:0},handler:t=>(Bt(t),function(t){const r=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){r.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();const n=t.fetch().text;if("&"!==n&&"\\\\"!==n){if("\\end"===n){0===r[r.length-1].length&&r.pop();break}throw new e("Expected \\\\ or \\cr or \\end",t.nextToken)}t.consume()}let n=[];const o=[n];for(let a=0;a<r.length;a++){const s=r[a];let i=Le();for(let r=0;r<s.length;r++)if(De(s[r])){n.push(i),r+=1;const o=Ce(s[r]).text,a=new Array(2);if(a[0]={type:"ordgroup",mode:"math",body:[]},a[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(o)>-1);else{if(!("<>AV".indexOf(o)>-1))throw new e('Expected one of "<>AV=|." after @.');for(let t=0;t<2;t++){let n=!0;for(let i=r+1;i<s.length;i++){if(Ee(s[i],o)){n=!1,r=i;break}if(De(s[i]))throw new e("Missing a "+o+" character to complete a CD arrow.",s[i]);a[t].body.push(s[i])}if(n)throw new e("Missing a "+o+" character to complete a CD arrow.",s[r])}}const l=Fe(o,a,t);n.push(l),i=Le()}else i.body.push(s[r]);a%2==0?n.push(i):n.shift(),n=[],o.push(n)}return o.pop(),t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:"math",body:o,tags:null,labels:new Array(o.length+1).fill(""),envClasses:["jot","cd"],cols:[],hLinesBeforeRow:new Array(o.length+1).fill([])}}(t.parser)),mathmlBuilder:Pt}),c({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,r){throw new e(`${t.funcName} valid only within array environment`)}});const jt=lt;c({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler({parser:t,funcName:r},n){const o=n[0];if("ordgroup"!==o.type)throw new e("Invalid environment name",o);let a="";for(let e=0;e<o.body.length;++e)a+=Be(o.body[e],"textord").text;if("\\begin"===r){if(!Object.prototype.hasOwnProperty.call(jt,a))throw new e("No such environment: "+a,o);const r=jt[a],{args:n,optArgs:s}=t.parseArguments("\\begin{"+a+"}",r),i={mode:t.mode,envName:a,parser:t},l=r.handler(i,n,s);t.expect("\\end",!1);const c=t.nextToken,u=Be(t.parseFunction(),"environment");if(u.name!==a)throw new e(`Mismatch: \\begin{${a}} matched by \\end{${u.name}}`,c);return l}return{type:"environment",mode:t.mode,name:a,nameGroup:o}}}),c({type:"envTag",names:["\\env@tag"],props:{numArgs:1,argTypes:["math"]},handler:({parser:e},t)=>({type:"envTag",mode:e.mode,body:t[0]}),mathmlBuilder:(e,t)=>new _.MathNode("mrow")}),c({type:"noTag",names:["\\env@notag"],props:{numArgs:0},handler:({parser:e})=>({type:"noTag",mode:e.mode}),mathmlBuilder:(e,t)=>new _.MathNode("mrow")});const Ut=(e,t)=>{const r=e.font,n=t.withFont(r),o=ue(e.body,n);if(0===o.children.length)return o;if("boldsymbol"===r&&["mo","mpadded","mrow"].includes(o.type))return o.style.fontWeight="bold",o;if(((e,t)=>{if("mathrm"!==t||"ordgroup"!==e.body.type||1===e.body.body.length)return!1;if("mathord"!==e.body.body[0].type)return!1;for(let r=1;r<e.body.body.length;r++){const t=e.body.body[r].type;if("mathord"!==t&&("textord"!==t||isNaN(e.body.body[r].text)))return!1}return!0})(e,r)){const e=o.children[0].children[0];delete e.attributes.mathvariant;for(let r=1;r<o.children.length;r++)e.children[0].text+="mn"===o.children[r].type?o.children[r].children[0].text:o.children[r].children[0].children[0].text;const t=new _.MathNode("mtext",new _.TextNode(""));return new _.MathNode("mrow",[t,e])}let a="mo"===o.children[0].type;for(let i=1;i<o.children.length;i++){"mo"===o.children[i].type&&"boldsymbol"===r&&(o.children[i].style.fontWeight="bold"),"mi"!==o.children[i].type&&(a=!1);"normal"!==(o.children[i].attributes&&o.children[i].attributes.mathvariant||"")&&(a=!1)}if(!a)return o;const s=o.children[0];for(let i=1;i<o.children.length;i++)s.children.push(o.children[i].children[0]);if(s.attributes.mathvariant&&"normal"===s.attributes.mathvariant){const e=new _.MathNode("mtext",new _.TextNode(""));return new _.MathNode("mrow",[e,s])}return s},Vt={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};c({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\up@greek","\\boldsymbol","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathsfit","\\mathtt","\\Bbb","\\bm","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const n=p(r[0]);let o=t;return o in Vt&&(o=Vt[o]),{type:"font",mode:e.mode,font:o.slice(1),body:n}},mathmlBuilder:Ut}),c({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:t,breakOnTokenText:r},n)=>{const{mode:o}=e,a=e.parseExpression(!0,r,!0);return{type:"font",mode:o,font:`math${t.slice(1)}`,body:{type:"ordgroup",mode:e.mode,body:a}}},mathmlBuilder:Ut});const Zt=["display","text","script","scriptscript"],Ht={auto:-1,display:0,text:0,script:1,scriptscript:2},Wt=(e,t)=>{const r="auto"===e.scriptLevel?t.incrementLevel():"display"===e.scriptLevel?t.withLevel(dt):"text"===e.scriptLevel?t.withLevel(ht):t.withLevel(gt),n=ue(e.numer,r),o=ue(e.denom,r);3===t.level&&(n.style.mathDepth="2",n.setAttribute("scriptlevel","2"),o.style.mathDepth="2",o.setAttribute("scriptlevel","2"));let a=new _.MathNode("mfrac",[n,o]);if(e.hasBarLine){if(e.barSize){const r=Se(e.barSize,t);a.setAttribute("linethickness",r.number+r.unit)}}else a.setAttribute("linethickness","0px");if(null!=e.leftDelim||null!=e.rightDelim){const t=[];if(null!=e.leftDelim){const r=new _.MathNode("mo",[new _.TextNode(e.leftDelim.replace("\\",""))]);r.setAttribute("fence","true"),t.push(r)}if(t.push(a),null!=e.rightDelim){const r=new _.MathNode("mo",[new _.TextNode(e.rightDelim.replace("\\",""))]);r.setAttribute("fence","true"),t.push(r)}a=oe(t)}return"auto"!==e.scriptLevel&&(a=new _.MathNode("mstyle",[a]),a.setAttribute("displaystyle",String("display"===e.scriptLevel)),a.setAttribute("scriptlevel",Ht[e.scriptLevel])),a};c({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const n=r[0],o=r[1];let a=!1,s=null,i=null,l="auto";switch(t){case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":s="(",i=")";break;case"\\\\bracefrac":s="\\{",i="\\}";break;case"\\\\brackfrac":s="[",i="]";break;default:throw new Error("Unrecognized genfrac command")}switch(t){case"\\dfrac":case"\\dbinom":l="display";break;case"\\tfrac":case"\\tbinom":l="text"}return{type:"genfrac",mode:e.mode,continued:!1,numer:n,denom:o,hasBarLine:a,leftDelim:s,rightDelim:i,scriptLevel:l,barSize:null}},mathmlBuilder:Wt}),c({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:({parser:e,funcName:t},r)=>{const n=r[0],o=r[1];return{type:"genfrac",mode:e.mode,continued:!0,numer:n,denom:o,hasBarLine:!0,leftDelim:null,rightDelim:null,scriptLevel:"display",barSize:null}}}),c({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler({parser:e,funcName:t,token:r}){let n;switch(t){case"\\over":n="\\frac";break;case"\\choose":n="\\binom";break;case"\\atop":n="\\\\atopfrac";break;case"\\brace":n="\\\\bracefrac";break;case"\\brack":n="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:n,token:r}}});const Xt=function(e){let t=null;return e.length>0&&(t=e,t="."===t?null:t),t};c({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler({parser:e},t){const r=t[4],n=t[5],o=p(t[0]),a="atom"===o.type&&"open"===o.family?Xt(o.text):null,s=p(t[1]),i="atom"===s.type&&"close"===s.family?Xt(s.text):null,l=Be(t[2],"size");let c,u=null;l.isBlank?c=!0:(u=l.value,c=u.number>0);let m="auto",d=t[3];if("ordgroup"===d.type){if(d.body.length>0){const e=Be(d.body[0],"textord");m=Zt[Number(e.text)]}}else d=Be(d,"textord"),m=Zt[Number(d.text)];return{type:"genfrac",mode:e.mode,numer:r,denom:n,continued:!1,hasBarLine:c,barSize:u,leftDelim:a,rightDelim:i,scriptLevel:m}},mathmlBuilder:Wt}),c({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:({parser:e,funcName:t,token:r},n)=>({type:"infix",mode:e.mode,replaceWith:"\\\\abovefrac",barSize:Be(n[0],"size").value,token:r})}),c({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:({parser:e,funcName:t},r)=>{const n=r[0],o=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}(Be(r[1],"infix").barSize),a=r[2],s=o.number>0;return{type:"genfrac",mode:e.mode,numer:n,denom:a,continued:!1,hasBarLine:s,barSize:o,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:Wt}),c({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler:({parser:e},t)=>({type:"hbox",mode:e.mode,body:m(t[0])}),mathmlBuilder(e,t){const r=t.withLevel(dt),n=ce(e.body,r);return ne(n)}});c({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler:({parser:e,funcName:t},r)=>({type:"horizBrace",mode:e.mode,label:t,isOver:/^\\over/.test(t),base:r[0]}),mathmlBuilder:(e,t)=>{const r=O(e.label);return r.style["math-depth"]=0,new _.MathNode(e.isOver?"mover":"munder",[ue(e.base,t),r])}}),c({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:({parser:t,token:r},n)=>{const o=n[1],a=Be(n[0],"url").url;if(!t.settings.isTrusted({command:"\\href",url:a}))throw new e('Function "\\href" is not trusted',r);return{type:"href",mode:t.mode,href:a,body:m(o)}},mathmlBuilder:(e,t)=>{const r=new k("math",[ce(e.body,t)]);return new w(e.href,[],[r])}}),c({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:({parser:t,token:r},n)=>{const o=Be(n[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:o}))throw new e('Function "\\url" is not trusted',r);const a=[];for(let e=0;e<o.length;e++){let t=o[e];"~"===t&&(t="\\textasciitilde"),a.push({type:"textord",mode:"text",text:t})}const s={type:"text",mode:t.mode,font:"\\texttt",body:a};return{type:"href",mode:t.mode,href:o,body:m(s)}}}),c({type:"html",names:["\\class","\\id","\\style","\\data"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:({parser:t,funcName:r,token:n},o)=>{const a=Be(o[0],"raw").string,s=o[1];if(t.settings.strict)throw new e(`Function "${r}" is disabled in strict mode`,n);let i;const l={};switch(r){case"\\class":l.class=a,i={command:"\\class",class:a};break;case"\\id":l.id=a,i={command:"\\id",id:a};break;case"\\style":l.style=a,i={command:"\\style",style:a};break;case"\\data":{const t=a.split(",");for(let r=0;r<t.length;r++){const n=t[r].split("=");if(2!==n.length)throw new e("Error parsing key-value for \\data");l["data-"+n[0].trim()]=n[1].trim()}i={command:"\\data",attributes:l};break}default:throw new Error("Unrecognized html command")}if(!t.settings.isTrusted(i))throw new e(`Function "${r}" is not trusted`,n);return{type:"html",mode:t.mode,attributes:l,body:m(s)}},mathmlBuilder:(e,t)=>{const r=ce(e.body,t),n=[];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/)),r.classes=n;for(const o in e.attributes)"class"!==o&&Object.prototype.hasOwnProperty.call(e.attributes,o)&&r.setAttribute(o,e.attributes[o]);return r}});const Kt=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};{const r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new e("Invalid size: '"+t+"' in \\includegraphics");const n={number:+(r[1]+r[2]),unit:r[3]};if(!qe(n))throw new e("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n}};c({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:({parser:t,token:r},n,o)=>{let a={number:0,unit:"em"},s={number:.9,unit:"em"},i={number:0,unit:"em"},l="";if(o[0]){const t=Be(o[0],"raw").string.split(",");for(let r=0;r<t.length;r++){const n=t[r].split("=");if(2===n.length){const t=n[1].trim();switch(n[0].trim()){case"alt":l=t;break;case"width":a=Kt(t);break;case"height":s=Kt(t);break;case"totalheight":i=Kt(t);break;default:throw new e("Invalid key: '"+n[0]+"' in \\includegraphics.")}}}}const c=Be(n[0],"url").url;if(""===l&&(l=c,l=l.replace(/^.*[\\/]/,""),l=l.substring(0,l.lastIndexOf("."))),!t.settings.isTrusted({command:"\\includegraphics",url:c}))throw new e('Function "\\includegraphics" is not trusted',r);return{type:"includegraphics",mode:t.mode,alt:l,width:a,height:s,totalheight:i,src:c}},mathmlBuilder:(e,t)=>{const r=Se(e.height,t),n={number:0,unit:"em"};e.totalheight.number>0&&e.totalheight.unit===r.unit&&e.totalheight.number>r.number&&(n.number=e.totalheight.number-r.number,n.unit=r.unit);let o=0;e.width.number>0&&(o=Se(e.width,t));const a={height:r.number+n.number+"em"};o.number>0&&(a.width=o.number+o.unit),n.number>0&&(a.verticalAlign=-n.number+n.unit);const s=new v(e.src,e.alt,a);return s.height=r,s.depth=n,new _.MathNode("mtext",[s])}}),c({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler({parser:t,funcName:r,token:n},o){const a=Be(o[0],"size");if(t.settings.strict){const o="m"===r[1],s="mu"===a.value.unit;if(o){if(!s)throw new e(`LaTeX's ${r} supports only mu units, not ${a.value.unit} units`,n);if("math"!==t.mode)throw new e(`LaTeX's ${r} works only in math mode`,n)}else if(s)throw new e(`LaTeX's ${r} doesn't support mu units`,n)}return{type:"kern",mode:t.mode,dimension:a.value}},mathmlBuilder(e,t){const r=Se(e.dimension,t),n="em"===r.unit?Yt(r.number):"";if("text"===e.mode&&n.length>0){const e=new _.TextNode(n);return new _.MathNode("mtext",[e])}{const e=new _.MathNode("mspace");return e.setAttribute("width",r.number+r.unit),r.number<0&&(e.style.marginLeft=r.number+r.unit),e}}});const Yt=function(e){return e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?" ":""},Jt=/[^A-Za-z_0-9-]/g;c({type:"label",names:["\\label"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e},t)=>({type:"label",mode:e.mode,string:t[0].string.replace(Jt,"")}),mathmlBuilder(e,t){const r=new _.MathNode("mrow",[],["tml-label"]);return e.string.length>0&&r.setLabel(e.string),r}});const Qt=["\\clap","\\llap","\\rlap"];c({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap","\\clap","\\llap","\\rlap"],props:{numArgs:1,allowedInText:!0},handler:({parser:t,funcName:r,token:n},o)=>{if(Qt.includes(r)){if(t.settings.strict&&"text"!==t.mode)throw new e(`{${r}} can be used only in text mode.\n Try \\math${r.slice(1)}`,n);r=r.slice(1)}else r=r.slice(5);const a=o[0];return{type:"lap",mode:t.mode,alignment:r,body:a}},mathmlBuilder:(e,t)=>{let r;if("llap"===e.alignment){const n=le(m(e.body),t),o=new _.MathNode("mphantom",n);r=new _.MathNode("mpadded",[o]),r.setAttribute("width","0px")}const n=ue(e.body,t);let o;if("llap"===e.alignment?(n.style.position="absolute",n.style.right="0",n.style.bottom="0",o=new _.MathNode("mpadded",[r,n])):o=new _.MathNode("mpadded",[n]),"rlap"===e.alignment)e.body.body.length>0&&"genfrac"===e.body.body[0].type&&o.setAttribute("lspace","0.16667em");else{const t="llap"===e.alignment?"-1":"-0.5";o.setAttribute("lspace",t+"width"),"llap"===e.alignment?o.style.position="relative":(o.style.display="flex",o.style.justifyContent="center")}return o.setAttribute("width","0px"),o}}),c({type:"ordgroup",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:t},r){const n=t.mode;t.switchMode("math");const o="\\("===e?"\\)":"$",a=t.parseExpression(!1,o);return t.expect(o),t.switchMode(n),{type:"ordgroup",mode:t.mode,body:a}}}),c({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,r){throw new e(`Mismatched ${t.funcName}`,r)}});c({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:({parser:e},t)=>({type:"mathchoice",mode:e.mode,display:m(t[0]),text:m(t[1]),script:m(t[2]),scriptscript:m(t[3])}),mathmlBuilder:(e,t)=>{const r=((e,t)=>{switch(t.level){case mt:return e.display;case dt:return e.text;case ht:return e.script;case gt:return e.scriptscript;default:return e.text}})(e,t);return ce(r,t)}});const er=["text","textord","mathord","atom"],tr=e=>{const t=new _.MathNode("mspace");return t.setAttribute("width",e+"em"),t};function rr(e,t){let r;const n=le(e.body,t);if("minner"===e.mclass)r=new _.MathNode("mpadded",n);else if("mord"===e.mclass)e.isCharacterBox||"mathord"===n[0].type?(r=n[0],r.type="mi",1===r.children.length&&r.children[0].text&&"∇"===r.children[0].text&&r.setAttribute("mathvariant","normal")):r=new _.MathNode("mi",n);else{r=new _.MathNode("mrow",n),e.mustPromote?(r=n[0],r.type="mo",e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&r.setAttribute("mathvariant","italic")):r=new _.MathNode("mrow",n);const o=t.level<2;"mrow"===r.type?o&&("mbin"===e.mclass?(r.children.unshift(tr(.2222)),r.children.push(tr(.2222))):"mrel"===e.mclass?(r.children.unshift(tr(.2778)),r.children.push(tr(.2778))):"mpunct"===e.mclass?r.children.push(tr(.1667)):"minner"===e.mclass&&(r.children.unshift(tr(.0556)),r.children.push(tr(.0556)))):"mbin"===e.mclass?(r.attributes.lspace=o?"0.2222em":"0",r.attributes.rspace=o?"0.2222em":"0"):"mrel"===e.mclass?(r.attributes.lspace=o?"0.2778em":"0",r.attributes.rspace=o?"0.2778em":"0"):"mpunct"===e.mclass?(r.attributes.lspace="0em",r.attributes.rspace=o?"0.1667em":"0"):"mopen"===e.mclass||"mclose"===e.mclass?(r.attributes.lspace="0em",r.attributes.rspace="0em"):"minner"===e.mclass&&o&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em"),"mopen"!==e.mclass&&"mclose"!==e.mclass&&(delete r.attributes.stretchy,delete r.attributes.form)}return r}c({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:t},r){const n=r[0],o=a.isCharacterBox(n);let s=!0;const i={type:"mathord",text:"",mode:e.mode},l=n.body?n.body:[n];for(const a of l){if(!er.includes(a.type)){s=!1;break}z[e.mode][a.text]?i.text+=z[e.mode][a.text].replace:a.text?i.text+=a.text:a.body&&a.body.map(e=>{i.text+=e.text})}return{type:"mclass",mode:e.mode,mclass:"m"+t.slice(5),body:m(s?i:n),isCharacterBox:o,mustPromote:s}},mathmlBuilder:rr});const nr=e=>{const t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};c({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler:({parser:e},t)=>({type:"mclass",mode:e.mode,mclass:nr(t[0]),body:m(t[1]),isCharacterBox:a.isCharacterBox(t[1])})}),c({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler({parser:e,funcName:t},r){const n=r[1],o=r[0],a={type:"op",mode:n.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,stack:!0,suppressBaseShift:"\\stackrel"!==t,body:m(n)};return{type:"supsub",mode:o.mode,base:a,sup:"\\underset"===t?null:o,sub:"\\underset"===t?o:null}},mathmlBuilder:rr});const or=(e,t,r)=>{if(!e)return r;const n=ue(e,t);return"mrow"===n.type&&0===n.children.length?r:n};c({type:"multiscript",names:["\\sideset","\\pres@cript"],props:{numArgs:3},handler({parser:t,funcName:r,token:n},o){if(0===o[2].body.length)throw new e(r+"cannot parse an empty base.");const a=o[2].body[0];if(t.settings.strict&&"\\sideset"===r&&!a.symbol)throw new e("The base of \\sideset must be a big operator. Try \\prescript.");if(o[0].body.length>0&&"supsub"!==o[0].body[0].type||o[1].body.length>0&&"supsub"!==o[1].body[0].type)throw new e("\\sideset can parse only subscripts and superscripts in its first two arguments",n);const s=o[0].body.length>0?o[0].body[0]:null,i=o[1].body.length>0?o[1].body[0]:null;return s||i?s?{type:"multiscript",mode:t.mode,isSideset:"\\sideset"===r,prescripts:s,postscripts:i,base:a}:{type:"styling",mode:t.mode,scriptLevel:"text",body:[{type:"supsub",mode:t.mode,base:a,sup:i.sup,sub:i.sub}]}:a},mathmlBuilder(e,t){const r=ue(e.base,t),n=new _.MathNode("mprescripts"),o=new _.MathNode("none");let a=[];const s=or(e.prescripts.sub,t,o),i=or(e.prescripts.sup,t,o);if(e.isSideset&&(s.setAttribute("style","text-align: left;"),i.setAttribute("style","text-align: left;")),e.postscripts){a=[r,or(e.postscripts.sub,t,o),or(e.postscripts.sup,t,o),n,s,i]}else a=[r,n,s,i];return new _.MathNode("mmultiscripts",a)}}),c({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){const r=a.isCharacterBox(t[0]);let n;if(r)n=m(t[0]),"\\"===n[0].text.charAt(0)&&(n[0].text=z.math[n[0].text].replace),n[0].text=n[0].text.slice(0,1)+"̸"+n[0].text.slice(1);else{n=[{type:"textord",mode:"math",text:"̸"},{type:"kern",mode:"math",dimension:{number:-.6,unit:"em"}},t[0]]}return{type:"not",mode:e.mode,body:n,isCharacterBox:r}},mathmlBuilder(e,t){if(e.isCharacterBox){return le(e.body,t,!0)[0]}return ce(e.body,t)}});const ar=["textord","mathord","atom"],sr=["\\smallint"],ir=["textord","mathord","ordgroup","close","leftright","font"],lr=e=>{e.attributes.lspace="0.1667em",e.attributes.rspace="0.1667em"},cr=(e,t)=>{let r;if(e.symbol)r=new k("mo",[te(e.name,e.mode)]),sr.includes(e.name)?r.setAttribute("largeop","false"):r.setAttribute("movablelimits","false"),e.fromMathOp&&lr(r);else if(e.body)r=new k("mo",le(e.body,t)),e.fromMathOp&&lr(r);else if(r=new k("mi",[new A(e.name.slice(1))]),!e.parentIsSupSub){const t=[r,new k("mo",[te("","text")])];if(e.needsLeadingSpace){const e=new k("mspace");e.setAttribute("width","0.1667em"),t.unshift(e)}if(!e.isFollowedByDelimiter){const e=new k("mspace");e.setAttribute("width","0.1667em"),t.push(e)}r=new k("mrow",t)}return r},ur={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨅":"\\bigsqcap","⨆":"\\bigsqcup","⨃":"\\bigcupdot","⨇":"\\bigdoublevee","⨈":"\\bigdoublewedge","⨉":"\\bigtimes"};c({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcupplus","\\bigcupdot","\\bigcap","\\bigcup","\\bigdoublevee","\\bigdoublewedge","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcap","\\bigsqcup","\\bigtimes","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:({parser:e,funcName:t},r)=>{let n=t;return 1===n.length&&(n=ur[n]),{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:n}},mathmlBuilder:cr}),c({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:({parser:e},t)=>{const r=t[0],n=r.body?r.body:[r],o=1===n.length&&ar.includes(n[0].type);return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:o,fromMathOp:!0,stack:!1,name:o?n[0].text:null,body:o?null:m(r)}},mathmlBuilder:cr});const pr={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint","∱":"\\intclockwise","∲":"\\varointclockwise","⨌":"\\iiiint","⨍":"\\intbar","⨎":"\\intBar","⨏":"\\fint","⨒":"\\rppolint","⨓":"\\scpolint","⨕":"\\pointint","⨖":"\\sqint","⨗":"\\intlarhk","⨘":"\\intx","⨙":"\\intcap","⨚":"\\intcup"};c({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","\\sgn","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler({parser:e,funcName:t}){const r=e.prevAtomType,n=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:rt(n),needsLeadingSpace:r.length>0&&ir.includes(r),name:t}},mathmlBuilder:cr}),c({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler({parser:e,funcName:t}){const r=e.prevAtomType,n=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:rt(n),needsLeadingSpace:r.length>0&&ir.includes(r),name:t}},mathmlBuilder:cr}),c({type:"op",names:["\\int","\\iint","\\iiint","\\iiiint","\\oint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\intbar","\\intBar","\\fint","\\rppolint","\\scpolint","\\pointint","\\sqint","\\intlarhk","\\intx","\\intcap","\\intcup","∫","∬","∭","∮","∯","∰","∱","∲","⨌","⨍","⨎","⨏","⨒","⨓","⨕","⨖","⨗","⨘","⨙","⨚"],props:{numArgs:0},handler({parser:e,funcName:t}){let r=t;return 1===r.length&&(r=pr[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:r}},mathmlBuilder:cr});c({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const n=r[0],o=e.prevAtomType,a=e.gullet.future().text;return{type:"operatorname",mode:e.mode,body:m(n),alwaysHandleSupSub:"\\operatornamewithlimits"===t,limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:rt(a),needsLeadingSpace:o.length>0&&ir.includes(o)}},mathmlBuilder:(e,t)=>{let r,n=le(e.body,t.withFont("mathrm")),o=!0;for(let a=0;a<n.length;a++){let e=n[a];if(e instanceof _.MathNode)switch("mrow"===e.type&&1===e.children.length&&e.children[0]instanceof _.MathNode&&(e=e.children[0]),e.type){case"mi":case"mn":case"ms":case"mtext":break;case"mspace":if(e.attributes.width){const t=e.attributes.width.replace("em",""),r=Yt(Number(t));""===r?o=!1:n[a]=new _.MathNode("mtext",[new _.TextNode(r)])}break;case"mo":{const t=e.children[0];1===e.children.length&&t instanceof _.TextNode?t.text=t.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):o=!1;break}default:o=!1}else o=!1}if(o){const e=n.map(e=>e.toText()).join("");n=[new _.TextNode(e)]}else if(1===n.length&&["mover","munder"].includes(n[0].type)&&("mi"===n[0].children[0].type||"mtext"===n[0].children[0].type)){if(n[0].children[0].type="mi",e.parentIsSupSub)return new _.MathNode("mrow",n);{const e=new _.MathNode("mo",[te("","text")]);return _.newDocumentFragment([n[0],e])}}if(o?(r=new _.MathNode("mi",n),1===n[0].text.length&&r.setAttribute("mathvariant","normal")):r=new _.MathNode("mrow",n),!e.parentIsSupSub){const t=[r,new _.MathNode("mo",[te("","text")])];if(e.needsLeadingSpace){const e=new _.MathNode("mspace");e.setAttribute("width","0.1667em"),t.unshift(e)}if(!e.isFollowedByDelimiter){const e=new _.MathNode("mspace");e.setAttribute("width","0.1667em"),t.push(e)}return _.newDocumentFragment(t)}return r}}),bt("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),u({type:"ordgroup",mathmlBuilder:(e,t)=>ce(e.body,t,e.semisimple)}),c({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{const r=t[0];return{type:"phantom",mode:e.mode,body:m(r)}},mathmlBuilder:(e,t)=>{const r=le(e.body,t);return new _.MathNode("mphantom",r)}}),c({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{const r=t[0];return{type:"hphantom",mode:e.mode,body:r}},mathmlBuilder:(e,t)=>{const r=le(m(e.body),t),n=new _.MathNode("mphantom",r),o=new _.MathNode("mpadded",[n]);return o.setAttribute("height","0px"),o.setAttribute("depth","0px"),o}}),c({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{const r=t[0];return{type:"vphantom",mode:e.mode,body:r}},mathmlBuilder:(e,t)=>{const r=le(m(e.body),t),n=new _.MathNode("mphantom",r),o=new _.MathNode("mpadded",[n]);return o.setAttribute("width","0px"),o}}),c({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>({type:"pmb",mode:e.mode,body:m(t[0])}),mathmlBuilder(e,t){const r=le(e.body,t),n=q(r);return n.setAttribute("style","font-weight:bold"),n}});const mr=(e,t)=>{const r=t.withLevel(dt),n=new _.MathNode("mpadded",[ue(e.body,r)]),o=Se(e.dy,t);return n.setAttribute("voffset",o.number+o.unit),o.number>0?n.style.padding=o.number+o.unit+" 0 0 0":n.style.padding="0 0 "+Math.abs(o.number)+o.unit+" 0",n};c({type:"raise",names:["\\raise","\\lower"],props:{numArgs:2,argTypes:["size","primitive"],primitive:!0},handler({parser:e,funcName:t},r){const n=Be(r[0],"size").value;"\\lower"===t&&(n.number*=-1);const o=r[1];return{type:"raise",mode:e.mode,dy:n,body:o}},mathmlBuilder:mr}),c({type:"raise",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler({parser:e,funcName:t},r){const n=Be(r[0],"size").value,o=r[1];return{type:"raise",mode:e.mode,dy:n,body:o}},mathmlBuilder:mr}),c({type:"ref",names:["\\ref","\\eqref"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e,funcName:t},r)=>({type:"ref",mode:e.mode,funcName:t,string:r[0].string.replace(Jt,"")}),mathmlBuilder(e,t){const r="\\ref"===e.funcName?["tml-ref"]:["tml-ref","tml-eqref"];return new w("#"+e.string,r,null)}}),c({type:"reflect",names:["\\reflectbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"reflect",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){const r=ue(e.body,t);return r.style.transform="scaleX(-1)",r}}),c({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0},handler:({parser:e})=>({type:"internal",mode:e.mode})}),c({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler({parser:e},t,r){const n=r[0],o=Be(t[0],"size"),a=Be(t[1],"size");return{type:"rule",mode:e.mode,shift:n&&Be(n,"size").value,width:o.value,height:a.value}},mathmlBuilder(e,t){const r=Se(e.width,t),n=Se(e.height,t),o=e.shift?Se(e.shift,t):{number:0,unit:"em"},a=t.color&&t.getColor()||"black",s=new _.MathNode("mspace");if(r.number>0&&n.number>0&&s.setAttribute("mathbackground",a),s.setAttribute("width",r.number+r.unit),s.setAttribute("height",n.number+n.unit),0===o.number)return s;const i=new _.MathNode("mpadded",[s]);return o.number>=0?i.setAttribute("height","+"+o.number+o.unit):(i.setAttribute("height",o.number+o.unit),i.setAttribute("depth","+"+-o.number+o.unit)),i.setAttribute("voffset",o.number+o.unit),i}});const dr={"\\tiny":.5,"\\sixptsize":.6,"\\Tiny":.6,"\\scriptsize":.7,"\\footnotesize":.8,"\\small":.9,"\\normalsize":1,"\\large":1.2,"\\Large":1.44,"\\LARGE":1.728,"\\huge":2.074,"\\Huge":2.488};c({type:"sizing",names:["\\tiny","\\sixptsize","\\Tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],props:{numArgs:0,allowedInText:!0},handler:({breakOnTokenText:e,funcName:t,parser:r},n)=>{r.settings.strict&&"math"===r.mode&&console.log(`Temml strict-mode warning: Command ${t} is invalid in math mode.`);const o=r.parseExpression(!1,e,!0);return{type:"sizing",mode:r.mode,funcName:t,body:o}},mathmlBuilder:(e,t)=>{const r=t.withFontSize(dr[e.funcName]),n=le(e.body,r),o=q(n),a=(dr[e.funcName]/t.fontSize).toFixed(4);return o.setAttribute("mathsize",a+"em"),o}}),c({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},t,r)=>{let n=!1,o=!1;const a=r[0]&&Be(r[0],"ordgroup");if(a){let e="";for(let t=0;t<a.body.length;++t){if(e=a.body[t].text,"t"===e)n=!0;else{if("b"!==e){n=!1,o=!1;break}o=!0}}}else n=!0,o=!0;const s=t[0];return{type:"smash",mode:e.mode,body:s,smashHeight:n,smashDepth:o}},mathmlBuilder:(e,t)=>{const r=new _.MathNode("mpadded",[ue(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}}),c({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},t,r){const n=r[0],o=t[0];return{type:"sqrt",mode:e.mode,body:o,index:n}},mathmlBuilder(e,t){const{body:r,index:n}=e;return n?new _.MathNode("mroot",[ue(r,t),ue(n,t.incrementLevel())]):new _.MathNode("msqrt",[ue(r,t)])}});const hr={display:0,text:1,script:2,scriptscript:3},gr={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};c({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:t,parser:r},n){const o=r.parseExpression(!0,e,!0),a=t.slice(1,t.length-5);return{type:"styling",mode:r.mode,scriptLevel:a,body:o}},mathmlBuilder(e,t){const r=t.withLevel(hr[e.scriptLevel]),n=le(e.body,r),o=q(n),a=gr[e.scriptLevel];return o.setAttribute("scriptlevel",a[0]),o.setAttribute("displaystyle",a[1]),o}});const fr=/^m(over|under|underover)$/;u({type:"supsub",mathmlBuilder(e,t){let r,n,o=!1,a=!1,s=!1,i=!1;e.base&&"horizBrace"===e.base.type&&(n=!!e.sup,n===e.base.isOver&&(o=!0,r=e.base.isOver)),!e.base||e.base.stack||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0,a=!e.base.symbol,s=a&&!e.isFollowedByDelimiter,i=e.base.needsLeadingSpace);const l=e.base&&e.base.stack?[ue(e.base.body[0],t)]:[ue(e.base,t)],c=t.inSubOrSup();if(e.sub){const r=ue(e.sub,c);3===t.level&&r.setAttribute("scriptlevel","2"),l.push(r)}if(e.sup){const r=ue(e.sup,c);3===t.level&&r.setAttribute("scriptlevel","2");const n="mrow"===r.type?r.children[0]:r;n&&"mo"===n.type&&n.classes.includes("tml-prime")&&e.base&&e.base.text&&"fF".indexOf(e.base.text)>-1&&n.classes.push("prime-pad"),l.push(r)}let u;if(o)u=r?"mover":"munder";else if(e.sub)if(e.sup){const r=e.base;u=r&&("op"===r.type&&r.limits||"multiscript"===r.type)&&(t.level===mt||r.alwaysHandleSupSub)||r&&"operatorname"===r.type&&r.alwaysHandleSupSub&&(t.level===mt||r.limits)?"munderover":"msubsup"}else{const r=e.base;u=r&&"op"===r.type&&r.limits&&(t.level===mt||r.alwaysHandleSupSub)||r&&"operatorname"===r.type&&r.alwaysHandleSupSub&&(r.limits||t.level===mt)?"munder":"msub"}else{const r=e.base;u=r&&"op"===r.type&&r.limits&&(t.level===mt||r.alwaysHandleSupSub)||r&&"operatorname"===r.type&&r.alwaysHandleSupSub&&(r.limits||t.level===mt)?"mover":"msup"}let p=new _.MathNode(u,l);if(a){const e=new _.MathNode("mo",[te("","text")]);if(i){const t=new _.MathNode("mspace");t.setAttribute("width","0.1667em"),p=_.newDocumentFragment([t,p,e])}else p=_.newDocumentFragment([p,e]);if(s){const e=new _.MathNode("mspace");e.setAttribute("width","0.1667em"),p.children.push(e)}}else fr.test(u)&&(p=new _.MathNode("mrow",[p]));return p}});const br=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],xr=["\\Rsh","\\Lsh","\\restriction"];u({type:"atom",mathmlBuilder(e,t){const r=new _.MathNode("mo",[te(e.text,e.mode)]);return"punct"===e.family?r.setAttribute("separator","true"):"open"===e.family||"close"===e.family?"open"===e.family?(r.setAttribute("form","prefix"),r.setAttribute("stretchy","false")):"close"===e.family&&(r.setAttribute("form","postfix"),r.setAttribute("stretchy","false")):"\\mid"===e.text?(r.setAttribute("lspace","0.22em"),r.setAttribute("rspace","0.22em"),r.setAttribute("stretchy","false")):"rel"===e.family&&(e=>{if(1===e.length){const t=e.codePointAt(0);return 8591<t&&t<8704}return e.indexOf("arrow")>-1||e.indexOf("harpoon")>-1||xr.includes(e)})(e.text)?r.setAttribute("stretchy","false"):br.includes(e.text)?r.setAttribute("mathsize","70%"):":"===e.text&&(r.attributes.lspace="0.2222em",r.attributes.rspace="0.2222em"),r}});const yr={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},wr=function(e,t){if("texttt"===t.fontFamily)return"monospace";if("textsc"===t.fontFamily)return"normal";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"sans-serif-bold":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";const r=t.font;if(!r||"mathnormal"===r)return null;const n=e.mode;switch(r){case"mathit":case"greekItalic":return"italic";case"mathrm":{const t=e.text.codePointAt(0);return 939<t&&t<975?"italic":"normal"}case"up@greek":return"normal";case"boldsymbol":case"mathboldsymbol":return"bold-italic";case"mathbf":return"bold";case"mathbb":return"double-struck";case"mathfrak":return"fraktur";case"mathscr":case"mathcal":return"script";case"mathsf":return"sans-serif";case"mathsfit":return"sans-serif-italic";case"mathtt":return"monospace"}let o=e.text;return z[n][o]&&z[n][o].replace&&(o=z[n][o].replace),Object.prototype.hasOwnProperty.call(yr,r)?yr[r]:null},vr=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),kr=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),Ar=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),qr=Object.freeze({"ϵ":119527,"ϑ":119564,"ϰ":119534,"φ":119577,"ϱ":119535,"ϖ":119563}),_r=Object.freeze({"ϵ":119643,"ϑ":119680,"ϰ":119650,"φ":119693,"ϱ":119651,"ϖ":119679}),Sr=Object.freeze({"ϵ":119701,"ϑ":119738,"ϰ":119708,"φ":119751,"ϱ":119709,"ϖ":119737}),Tr=Object.freeze({"ϵ":119759,"ϑ":119796,"ϰ":119766,"φ":119809,"ϱ":119767,"ϖ":119795}),Nr=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>vr[e]||119899,"script-bold":e=>119951,fraktur:e=>kr[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>Ar[e]||120055,"sans-serif":e=>120159,"sans-serif-bold":e=>120211,"sans-serif-italic":e=>120263,"sans-serif-bold-italic":e=>120380,monospace:e=>120367},lowerCaseLatin:{normal:e=>0,bold:e=>119737,italic:e=>"h"===e?8358:119789,"bold-italic":e=>119841,script:e=>vr[e]||119893,"script-bold":e=>119945,fraktur:e=>119997,"fraktur-bold":e=>120101,"double-struck":e=>120049,"sans-serif":e=>120153,"sans-serif-bold":e=>120205,"sans-serif-italic":e=>120257,"sans-serif-bold-italic":e=>120309,monospace:e=>120361},upperCaseGreek:{normal:e=>0,bold:e=>119575,italic:e=>119633,"bold-italic":e=>119575,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119749,"sans-serif-bold":e=>119749,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119807,monospace:e=>0},lowerCaseGreek:{normal:e=>0,bold:e=>119569,italic:e=>119627,"bold-italic":e=>"ϕ"===e?119678:119685,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119743,"sans-serif-bold":e=>119743,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119801,monospace:e=>0},varGreek:{normal:e=>0,bold:e=>qr[e]||-51,italic:e=>0,"bold-italic":e=>_r[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>Sr[e]||116,"sans-serif-bold":e=>Sr[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>Tr[e]||174,monospace:e=>0},numeral:{normal:e=>0,bold:e=>120734,italic:e=>0,"bold-italic":e=>0,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>120744,"sans-serif":e=>120754,"sans-serif-bold":e=>120764,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>0,monospace:e=>120774}}),$r=(e,t)=>{const r=e.codePointAt(0),n=64<r&&r<91?"upperCaseLatin":96<r&&r<123?"lowerCaseLatin":912<r&&r<938?"upperCaseGreek":944<r&&r<970||"ϕ"===e?"lowerCaseGreek":120545<r&&r<120572||qr[e]?"varGreek":47<r&&r<58?"numeral":"other";return"other"===n?e:String.fromCodePoint(r+Nr[n][t](e))},Or=Object.freeze({a:"ᴀ",b:"ʙ",c:"ᴄ",d:"ᴅ",e:"ᴇ",f:"ꜰ",g:"ɢ",h:"ʜ",i:"ɪ",j:"ᴊ",k:"ᴋ",l:"ʟ",m:"ᴍ",n:"ɴ",o:"ᴏ",p:"ᴘ",q:"ǫ",r:"ʀ",s:"s",t:"ᴛ",u:"ᴜ",v:"ᴠ",w:"ᴡ",x:"x",y:"ʏ",z:"ᴢ"}),Mr=/^\d(?:[\d,.]*\d)?$/,Br=/[A-Ba-z]/,Cr=new Set(["\\prime","\\dprime","\\trprime","\\qprime","\\backprime","\\backdprime","\\backtrprime"]);u({type:"mathord",mathmlBuilder(e,t){const r=te(e.text,e.mode,t),n=r.text.codePointAt(0),o=912<n&&n<938?"normal":"italic",a=wr(e,t)||o;if("script"===a)return r.text=$r(r.text,a),new _.MathNode("mi",[r],[t.font]);"italic"!==a&&(r.text=$r(r.text,a));let s=new _.MathNode("mi",[r]);return"normal"===a&&(s.setAttribute("mathvariant","normal"),1===r.text.length&&(s=new _.MathNode("mrow",[s]))),s}}),u({type:"textord",mathmlBuilder(e,t){let r=e.text;const n=r.codePointAt(0);"textsc"===t.fontFamily&&96<n&&n<123&&(r=Or[r]);const o=te(r,e.mode,t),a=wr(e,t)||"normal";let s;if(Mr.test(e.text)){const t="text"===e.mode?"mtext":"mn";if("italic"===a||"bold-italic"===a)return((e,t,r)=>{const n=new _.MathNode(r,[e]),o=new _.MathNode("mstyle",[n]);return o.style["font-style"]="italic",o.style["font-family"]="Cambria, 'Times New Roman', serif","bold-italic"===t&&(o.style["font-weight"]="bold"),o})(o,a,t);"normal"!==a&&(o.text=o.text.split("").map(e=>$r(e,a)).join("")),s=new _.MathNode(t,[o])}else if("text"===e.mode)"normal"!==a&&(o.text=$r(o.text,a)),s=new _.MathNode("mtext",[o]);else if(Cr.has(e.text))s=new _.MathNode("mo",[o]),s.classes.push("tml-prime");else{const e=o.text;"italic"!==a&&(o.text=$r(o.text,a)),s=new _.MathNode("mi",[o]),o.text===e&&Br.test(e)&&s.setAttribute("mathvariant","italic")}return s}});const zr={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Ir={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};u({type:"spacing",mathmlBuilder(t,r){let n;if(Object.prototype.hasOwnProperty.call(Ir,t.text))n=new _.MathNode("mtext",[new _.TextNode(" ")]);else{if(!Object.prototype.hasOwnProperty.call(zr,t.text))throw new e(`Unknown type of space "${t.text}"`);n=new _.MathNode("mo"),"\\nobreak"===t.text&&n.setAttribute("linebreak","nobreak")}return n}}),u({type:"tag"});const Lr={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},Dr={"\\textbf":"textbf","\\textmd":"textmd"},Er={"\\textit":"textit","\\textup":"textup"};c({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textsc","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},r){const n=r[0];return{type:"text",mode:e.mode,body:m(n),font:t}},mathmlBuilder(e,t){const r=((e,t)=>{const r=e.font;return r?Lr[r]?t.withTextFontFamily(Lr[r]):Dr[r]?t.withTextFontWeight(Dr[r]):"\\emph"===r?"textit"===t.fontShape?t.withTextFontShape("textup"):t.withTextFontShape("textit"):t.withTextFontShape(Er[r]):t})(e,t),n=ce(e.body,r);return ne(n)}}),c({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:({parser:e},t)=>({type:"vcenter",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){const r=new _.MathNode("mtd",[ue(e.body,t)]);r.style.padding="0";const n=new _.MathNode("mtr",[r]);return new _.MathNode("mtable",[n])}}),c({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,r,n){throw new e("\\verb ended by end of line instead of matching delimiter")},mathmlBuilder(e,t){const r=new _.TextNode(Fr(e)),n=new _.MathNode("mtext",[r]);return n.setAttribute("mathvariant","monospace"),n}});const Fr=e=>e.body.replace(/ /g,e.star?"␣":" "),Gr=i,Pr="[ \r\n\t]",Rr=`(\\\\[a-zA-Z@]+)${Pr}*`,jr="[̀-ͯ]",Ur=new RegExp(`${jr}+$`),Vr=`(${Pr}+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧-豈-]${jr}*|[\ud800-\udbff][\udc00-\udfff]${jr}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${Rr}|\\\\[^\ud800-\udfff])`;class Zr{constructor(e,t){this.input=e,this.settings=t,this.tokenRegex=new RegExp(Vr,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){const t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new pt("EOF",new ut(this,r,r));const n=this.tokenRegex.exec(t);if(null===n||n.index!==r)throw new e(`Unexpected character: '${t[r]}'`,new pt(t[r],new ut(this,r,r+1)));const o=n[6]||n[3]||(n[2]?"\\ ":" ");if(14===this.catcodes[o]){const r=t.indexOf("\n",this.tokenRegex.lastIndex);if(-1===r){if(this.tokenRegex.lastIndex=t.length,this.settings.strict)throw new e("% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode")}else this.tokenRegex.lastIndex=r+1;return this.lex()}return new pt(o,new ut(this,r,this.tokenRegex.lastIndex))}}class Hr{constructor(e={},t={}){this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(0===this.undefStack.length)throw new e("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");const t=this.undefStack.pop();for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(void 0===t[e]?delete this.current[e]:this.current[e]=t[e])}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){return Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:this.builtins[e]}set(e,t,r=!1){if(r){for(let t=0;t<this.undefStack.length;t++)delete this.undefStack[t][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{const t=this.undefStack[this.undefStack.length-1];t&&!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=this.current[e])}this.current[e]=t}}const Wr={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Xr{constructor(e,t,r){this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new Hr(xt,t.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new Zr(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}future(){return 0===this.stack.length&&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){let t,r,n;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken(),({tokens:n,end:r}=this.consumeArg(["]"]))}else({tokens:n,start:t,end:r}=this.consumeArg());return this.pushToken(new pt("EOF",r.loc)),this.pushTokens(n),t.range(r,"")}consumeSpaces(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}}consumeArg(t){const r=[],n=t&&t.length>0;n||this.consumeSpaces();const o=this.future();let a,s=0,i=0;do{if(a=this.popToken(),r.push(a),"{"===a.text)++s;else if("}"===a.text){if(--s,-1===s)throw new e("Extra }",a)}else if("EOF"===a.text)throw new e("Unexpected end of input in a macro argument, expected '"+(t&&n?t[i]:"}")+"'",a);if(t&&n)if((0===s||1===s&&"{"===t[i])&&a.text===t[i]){if(++i,i===t.length){r.splice(-i,i);break}}else i=0}while(0!==s||n);return"{"===o.text&&"}"===r[r.length-1].text&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:o,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new e("The length of delimiters doesn't match the number of args!");const n=r[0];for(let t=0;t<n.length;t++){const r=this.popToken();if(n[t]!==r.text)throw new e("Use of the macro doesn't match its definition",r)}}const n=[];for(let e=0;e<t;e++)n.push(this.consumeArg(r&&r[e+1]).tokens);return n}expandOnce(t){const r=this.popToken(),n=r.text,o=r.noexpand?null:this._getExpansion(n);if(null==o||t&&o.unexpandable){if(t&&null==o&&"\\"===n[0]&&!this.isDefined(n))throw new e("Undefined control sequence: "+n);return this.pushToken(r),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new e("Too many expansions: infinite loop or need to increase maxExpand setting");let a=o.tokens;const s=this.consumeArgs(o.numArgs,o.delimiters);if(o.numArgs){a=a.slice();for(let t=a.length-1;t>=0;--t){let r=a[t];if("#"===r.text){if(0===t)throw new e("Incomplete placeholder at end of macro body",r);if(r=a[--t],"#"===r.text)a.splice(t+1,1);else{if(!/^[1-9]$/.test(r.text))throw new e("Not a valid argument number",r);a.splice(t,2,...s[+r.text-1])}}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(!1===this.expandOnce()){const e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new pt(e)]):void 0}expandTokens(e){const t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(!1===this.expandOnce(!0)){const e=this.stack.pop();e.treatAsRelax&&(e.noexpand=!1,e.treatAsRelax=!1),t.push(e)}return t}expandMacroAsText(e){const t=this.expandMacro(e);return t?t.map(e=>e.text).join(""):t}_getExpansion(e){const t=this.macros.get(e);if(null==t)return t;if(1===e.length){const t=this.lexer.catcodes[e];if(null!=t&&13!==t)return}const r="function"==typeof t?t(this):t;if("string"==typeof r){let e=0;if(-1!==r.indexOf("#")){const t=r.replace(/##/g,"");for(;-1!==t.indexOf("#"+(e+1));)++e}const t=new Zr(r,this.settings),n=[];let o=t.lex();for(;"EOF"!==o.text;)n.push(o),o=t.lex();n.reverse();return{tokens:n,numArgs:e}}return r}isDefined(e){return this.macros.has(e)||Object.prototype.hasOwnProperty.call(Gr,e)||Object.prototype.hasOwnProperty.call(z.math,e)||Object.prototype.hasOwnProperty.call(z.text,e)||Object.prototype.hasOwnProperty.call(Wr,e)}isExpandable(e){const t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:Object.prototype.hasOwnProperty.call(Gr,e)&&!Gr[e].primitive}}const Kr=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Yr=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Jr=Object.freeze({"𝒜":"A","ℬ":"B","𝒞":"C","𝒟":"D","ℰ":"E","ℱ":"F","𝒢":"G","ℋ":"H","ℐ":"I","𝒥":"J","𝒦":"K","ℒ":"L","ℳ":"M","𝒩":"N","𝒪":"O","𝒫":"P","𝒬":"Q","ℛ":"R","𝒮":"S","𝒯":"T","𝒰":"U","𝒱":"V","𝒲":"W","𝒳":"X","𝒴":"Y","𝒵":"Z"});var Qr={"́":{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"}},en={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","č":"č","ĉ":"ĉ","ċ":"ċ","ď":"ď","ḋ":"ḋ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ĺ":"ĺ","ľ":"ľ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ď":"Ď","Ḋ":"Ḋ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ĺ":"Ĺ","Ľ":"Ľ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ť":"Ť","Ṫ":"Ṫ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};const tn=["bin","op","open","punct","rel"],rn=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/;class nn{constructor(e,t,r=!1){this.mode="math",this.gullet=new Xr(e,t,this.mode),this.settings=t,this.isPreamble=r,this.leftrightDepth=0,this.prevAtomType=""}expect(t,r=!0){if(this.fetch().text!==t)throw new e(`Expected '${t}', got '${this.fetch().text}'`,this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");const e=this.parseExpression(!1);if(this.expect("EOF"),this.isPreamble){const e=Object.create(null);return Object.entries(this.gullet.macros.current).forEach(([t,r])=>{e[t]=r}),this.gullet.endGroup(),e}const t=this.gullet.macros.get("\\df@tag");return this.gullet.endGroup(),t&&(this.gullet.macros.current["\\df@tag"]=t),e}static get endOfExpression(){return["}","\\endgroup","\\end","\\right","\\endtoggle","&"]}subparse(e){const t=this.nextToken;this.consume(),this.gullet.pushToken(new pt("}")),this.gullet.pushTokens(e);const r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r}parseExpression(e,t,r){const n=[];for(this.prevAtomType="";;){"math"===this.mode&&this.consumeSpaces();const o=this.fetch();if(-1!==nn.endOfExpression.indexOf(o.text))break;if(t&&o.text===t)break;if(r&&"\\middle"===o.text)break;if(e&&Gr[o.text]&&Gr[o.text].infix)break;const a=this.parseAtom(t);if(!a)break;"internal"!==a.type&&(n.push(a),this.prevAtomType="atom"===a.type?a.family:a.type)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){let r,n=-1;for(let o=0;o<t.length;o++)if("infix"===t[o].type){if(-1!==n)throw new e("only one infix operator per group",t[o].token);n=o,r=t[o].replaceWith}if(-1!==n&&r){let e,o;const a=t.slice(0,n),s=t.slice(n+1);let i;return e=1===a.length&&"ordgroup"===a[0].type?a[0]:{type:"ordgroup",mode:this.mode,body:a},o=1===s.length&&"ordgroup"===s[0].type?s[0]:{type:"ordgroup",mode:this.mode,body:s},i="\\\\abovefrac"===r?this.callFunction(r,[e,t[n],o],[]):this.callFunction(r,[e,o],[]),[i]}return t}handleSupSubscript(t){const r=this.fetch(),n=r.text;this.consume(),this.consumeSpaces();const o=this.parseGroup(t);if(!o)throw new e("Expected group after '"+n+"'",r);return o}formatUnsupportedCmd(e){const t=[];for(let n=0;n<e.length;n++)t.push({type:"textord",mode:"text",text:e[n]});const r={type:"text",mode:this.mode,body:t};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]}}parseAtom(t){const r=this.parseGroup("atom",t);if("text"===this.mode)return r;let n,o;for(;;){this.consumeSpaces();const t=this.fetch();if("\\limits"===t.text||"\\nolimits"===t.text){if(r&&"op"===r.type){const e="\\limits"===t.text;r.limits=e,r.alwaysHandleSupSub=!0}else{if(!r||"operatorname"!==r.type)throw new e("Limit controls must follow a math operator",t);r.alwaysHandleSupSub&&(r.limits="\\limits"===t.text)}this.consume()}else if("^"===t.text){if(n)throw new e("Double superscript",t);n=this.handleSupSubscript("superscript")}else if("_"===t.text){if(o)throw new e("Double subscript",t);o=this.handleSupSubscript("subscript")}else if("'"===t.text){if(n)throw new e("Double superscript",t);const r={type:"textord",mode:this.mode,text:"\\prime"},o=[r];for(this.consume();"'"===this.fetch().text;)o.push(r),this.consume();"^"===this.fetch().text&&o.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:o}}else{if(!Yr[t.text])break;{const e=Kr.test(t.text),r=[];for(r.push(new pt(Yr[t.text])),this.consume();;){const t=this.fetch().text;if(!Yr[t])break;if(Kr.test(t)!==e)break;r.unshift(new pt(Yr[t])),this.consume()}const a=this.subparse(r);e?o={type:"ordgroup",mode:"math",body:a}:n={type:"ordgroup",mode:"math",body:a}}}}if(n||o){if(r&&"multiscript"===r.type&&!r.postscripts)return r.postscripts={sup:n,sub:o},r;{const e=!r||"op"!==r.type&&"operatorname"!==r.type?void 0:rt(this.nextToken.text);return{type:"supsub",mode:this.mode,base:r,sup:n,sub:o,isFollowedByDelimiter:e}}}return r}parseFunction(t,r){const n=this.fetch(),o=n.text,a=Gr[o];if(!a)return null;if(this.consume(),r&&"atom"!==r&&!a.allowedInArgument)throw new e("Got function '"+o+"' with no arguments"+(r?" as "+r:""),n);if("text"===this.mode&&!a.allowedInText)throw new e("Can't use function '"+o+"' in text mode",n);if("math"===this.mode&&!1===a.allowedInMath)throw new e("Can't use function '"+o+"' in math mode",n);const s=this.prevAtomType,{args:i,optArgs:l}=this.parseArguments(o,a);return this.prevAtomType=s,this.callFunction(o,i,l,n,t)}callFunction(t,r,n,o,a){const s={funcName:t,parser:this,token:o,breakOnTokenText:a},i=Gr[t];if(i&&i.handler)return i.handler(s,r,n);throw new e(`No function handler for ${t}`)}parseArguments(t,r){const n=r.numArgs+r.numOptionalArgs;if(0===n)return{args:[],optArgs:[]};const o=[],a=[];for(let s=0;s<n;s++){let n=r.argTypes&&r.argTypes[s];const i=s<r.numOptionalArgs;(r.primitive&&null==n||"sqrt"===r.type&&1===s&&null==a[0])&&(n="primitive");const l=this.parseGroupOfType(`argument to '${t}'`,n,i);if(i)a.push(l);else{if(null==l)throw new e("Null argument, please report this as a bug");o.push(l)}}return{args:o,optArgs:a}}parseGroupOfType(t,r,n){switch(r){case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,r);case"hbox":{const e=this.parseArgumentGroup(n,"text");return null!=e?{type:"styling",mode:e.mode,body:[e],scriptLevel:"text"}:null}case"raw":{const e=this.parseStringGroup("raw",n);return null!=e?{type:"raw",mode:"text",string:e.text}:null}case"primitive":{if(n)throw new e("A primitive argument cannot be optional");const r=this.parseGroup(t);if(null==r)throw new e("Expected group as "+t,this.fetch());return r}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new e("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;;){const e=this.fetch().text;if(" "!==e&&" "!==e&&"︎"!==e)break;this.consume()}}parseStringGroup(e,t){const r=this.gullet.scanArgument(t);if(null==r)return null;let n,o="";for(;"EOF"!==(n=this.fetch()).text;)o+=n.text,this.consume();return this.consume(),r.text=o,r}parseRegexGroup(t,r){const n=this.fetch();let o,a=n,s="";for(;"EOF"!==(o=this.fetch()).text&&t.test(s+o.text);)a=o,s+=a.text,this.consume();if(""===s)throw new e("Invalid "+r+": '"+n.text+"'",n);return n.range(a,s)}parseSizeGroup(t){let r,n=!1;if(this.gullet.consumeSpaces(),r=t||"{"===this.gullet.future().text?this.parseStringGroup("size",t):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"),!r)return null;t||0!==r.text.length||(r.text="0pt",n=!0);const o=rn.exec(r.text);if(!o)throw new e("Invalid size: '"+r.text+"'",r);const a={number:+(o[1]+o[2]),unit:o[3]};if(!qe(a))throw new e("Invalid unit: '"+a.unit+"'",r);return{type:"size",mode:this.mode,value:a,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);const t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),null==t)return null;let r=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return r=t.text.replace(/{\u2044}/g,"/"),{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,t){const r=this.gullet.scanArgument(e);if(null==r)return null;const n=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();const o=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();const a={type:"ordgroup",mode:this.mode,loc:r.loc,body:o};return t&&this.switchMode(n),a}parseGroup(e,t){const r=this.fetch(),n=r.text;let o;if("{"===n||"\\begingroup"===n||"\\toggle"===n){this.consume();const e="{"===n?"}":"\\begingroup"===n?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();const t=this.parseExpression(!1,e),a=this.fetch();this.expect(e),this.gullet.endGroup(),o={type:"\\endtoggle"===a.text?"toggle":"ordgroup",mode:this.mode,loc:ut.range(r,a),body:t,semisimple:"\\begingroup"===n||void 0}}else o=this.parseFunction(t,e)||this.parseSymbol(),null!=o||"\\"!==n[0]||Object.prototype.hasOwnProperty.call(Wr,n)||(o=this.formatUnsupportedCmd(n),this.consume());return o}formLigatures(e){let t=e.length-1;for(let r=0;r<t;++r){const n=e[r],o=n.text;"-"===o&&"-"===e[r+1].text&&(r+1<t&&"-"===e[r+2].text?(e.splice(r,3,{type:"textord",mode:"text",loc:ut.range(n,e[r+2]),text:"---"}),t-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:ut.range(n,e[r+1]),text:"--"}),t-=1)),"'"!==o&&"`"!==o||e[r+1].text!==o||(e.splice(r,2,{type:"textord",mode:"text",loc:ut.range(n,e[r+1]),text:o+o}),t-=1)}}parseSymbol(){const t=this.fetch();let r=t.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();let t=r.slice(5);const n="*"===t.charAt(0);if(n&&(t=t.slice(1)),t.length<2||t.charAt(0)!==t.slice(-1))throw new e("\\verb assertion failed --\n please report what input caused this bug");return t=t.slice(1,-1),{type:"verb",mode:"text",body:t,star:n}}if(Object.prototype.hasOwnProperty.call(en,r[0])&&"math"===this.mode&&!z[this.mode][r[0]]){if(this.settings.strict&&"math"===this.mode)throw new e(`Accented Unicode text character "${r[0]}" used in math mode`,t);r=en[r[0]]+r.slice(1)}const n="math"===this.mode?Ur.exec(r):null;let o;if(n&&(r=r.substring(0,n.index),"i"===r?r="ı":"j"===r&&(r="ȷ")),z[this.mode][r]){let e=z[this.mode][r].group;"bin"===e&&tn.includes(this.prevAtomType)&&(e="open");const n=ut.range(t);let a;if(Object.prototype.hasOwnProperty.call(B,e)){const t=e;a={type:"atom",mode:this.mode,family:t,loc:n,text:r}}else{if(Jr[r]){this.consume();const e=this.fetch().text.charCodeAt(0),t=65025===e?"mathscr":"mathcal";return 65024!==e&&65025!==e||this.consume(),{type:"font",mode:"math",font:t,body:{type:"mathord",mode:"math",loc:n,text:Jr[r]}}}a={type:e,mode:this.mode,loc:n,text:r}}o=a}else{if(!(r.charCodeAt(0)>=128||Ur.exec(r)))return null;if(this.settings.strict&&"math"===this.mode)throw new e(`Unicode text character "${r[0]}" used in math mode`,t);o={type:"textord",mode:"text",loc:ut.range(t),text:r}}if(this.consume(),n)for(let a=0;a<n[0].length;a++){const r=n[0][a];if(!Qr[r])throw new e(`Unknown accent ' ${r}'`,t);const s=Qr[r][this.mode]||Qr[r].text;if(!s)throw new e(`Accent ${r} unsupported in ${this.mode} mode`,t);o={type:"accent",mode:this.mode,loc:ut.range(t),label:s,isStretchy:!1,base:o}}return o}}const on=function(t,r){if(!("string"==typeof t||t instanceof String))throw new TypeError("Temml can only parse string typed expression");const n=new nn(t,r);delete n.gullet.macros.current["\\df@tag"];let o=n.parse();if(!(o.length>0&&o[0].type&&"array"===o[0].type&&o[0].addEqnNum)&&n.gullet.macros.get("\\df@tag")){if(!r.displayMode)throw new e("\\tag works only in display mode");n.gullet.feed("\\df@tag"),o=[{type:"tag",mode:"text",body:o,tag:n.parse()}]}return o},an=[2,2,3,3];class sn{constructor(e){this.level=e.level,this.color=e.color,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontSize=e.fontSize||1,this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.maxSize=e.maxSize}extend(e){const t={level:this.level,color:this.color,font:this.font,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return new sn(t)}withLevel(e){return this.extend({level:e})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:an[this.level]})}withColor(e){return this.extend({color:e})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withFontSize(e){return this.extend({fontSize:e})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}getColor(){return this.color}}let ln=function(e,t,r={}){t.textContent="";const n="math"===t.tagName.toLowerCase();n&&(r.wrap="none");const o=cn(e,r);n||o.children.length>1?(t.textContent="",o.children.forEach(e=>{t.appendChild(e.toNode())})):t.appendChild(o.toNode())};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&("undefined"!=typeof console&&console.warn("Warning: Temml doesn't work in quirks mode. Make sure your website has a suitable doctype."),ln=function(){throw new e("Temml doesn't work in quirks mode.")});const cn=function(t,r){const n=new s(r);try{const e=on(t,n);return he(e,t,new sn({level:n.displayMode?mt:dt,maxSize:n.maxSize}),n)}catch(o){return function(t,r,n){if(n.throwOnError||!(t instanceof e))throw t;const o=new x(["temml-error"],[new y(r+"\n"+t.toString())]);return o.style.color=n.errorColor,o.style.whiteSpace="pre-line",o}(o,t,n)}};var un=function(e,t){return cn(e,t).toMarkup()};const pn=(e,t)=>{const r=e.posMax;let n=!0,o=!0;const a=t>0?e.src.charCodeAt(t-1):-1,s=t+1<=r?e.src.charCodeAt(t+1):-1;return(32===a||9===a||s>=48&&s<=57)&&(o=!1),32!==s&&9!==s||(n=!1),{can_open:n,can_close:o}},mn=(e,t)=>{let r,n,o,a;if("$"!==e.src[e.pos])return!1;if(o=pn(e,e.pos),!o.can_open)return t||(e.pending+="$"),e.pos+=1,!0;const s=e.pos+1;for(r=s;-1!==(r=e.src.indexOf("$",r));){for(a=r-1;"\\"===e.src[a];)a-=1;if((r-a)%2==1)break;r+=1}return-1===r?(t||(e.pending+="$"),e.pos=s,!0):r-s===0?(t||(e.pending+="$$"),e.pos=s+1,!0):(o=pn(e,r),o.can_close?(t||(n=e.push("math_inline","math",0),n.markup="$",n.content=e.src.slice(s,r)),e.pos=r+1,!0):(t||(e.pending+="$"),e.pos=s,!0))},dn=(e,t,r,n)=>{let o,a,s,i,l=!1,c=e.bMarks[t]+e.tShift[t],u=e.eMarks[t];if(c+2>u)return!1;if("$$"!==e.src.slice(c,c+2))return!1;if(c+=2,o=e.src.slice(c,u),n)return!0;for("$$"===o.trim().slice(-2)&&(o=o.trim().slice(0,-2),l=!0),s=t;!l&&(s++,!(s>=r))&&(c=e.bMarks[s]+e.tShift[s],u=e.eMarks[s],!(c<u&&e.tShift[s]<e.blkIndent));)"$$"===e.src.slice(c,u).trim().slice(-2)&&(i=e.src.slice(0,u).lastIndexOf("$$"),a=e.src.slice(c,i),l=!0);e.line=s+1;const p=e.push("math_block","math",0);return p.block=!0,p.content=(o&&o.trim()?o+"\n":"")+e.getLines(t+1,s,e.tShift[t],!0)+(a&&a.trim()?a:""),p.map=[t,e.line],p.markup="$$",!0},hn=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),gn=(e,t)=>{t=t||{};e.inline.ruler.after("escape","math_inline",mn),e.block.ruler.after("blockquote","math_block",dn,{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules.math_inline=function(e,r){return function(e){t.displayMode=!1;try{return un(e,t)}catch(r){return t.throwOnError&&console.log(r),`<span class='tml-error' title='${hn(r.toString())}'>${hn(e)}</span>`}}(e[r].content)},e.renderer.rules.math_block=function(e,r){return function(e){t.displayMode=!0;try{return"<p class='tml-block'>"+un(e,t)+"</p>"}catch(r){return t.throwOnError&&console.log(r),`<p class='tml-block tml-error' title='${hn(r.toString())}'>${hn(e)}</p>`}}(e[r].content)+"\n"}};export{gn as t};
|