Files
phanpy-cz/assets/temml-BQUKR1fw.js

98 lines
199 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
class v{constructor(t,r){let o=" "+t,s;const i=r&&r.loc;if(i&&i.start<=i.end){const c=i.lexer.input;s=i.start;const h=i.end;s===c.length?o+=" at end of input: ":o+=" at position "+(s+1)+`:
`;const f=c.slice(s,h).replace(/[^]/g,"$&̲");let k;s>15?k="…"+c.slice(s-15,s):k=c.slice(0,s);let x;h+15<c.length?x=c.slice(h,h+15)+"…":x=c.slice(h),o+=k+f+x}const l=new Error(o);return l.name="ParseError",l.__proto__=v.prototype,l.position=s,l}}v.prototype.__proto__=Error.prototype;const K=function(e,t){return e===void 0?t:e},_r=/([A-Z])/g,Ye=function(e){return e.replace(_r,"-$1").toLowerCase()},Tr={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},Cr=/[&><"']/g;function te(e){return String(e).replace(Cr,t=>Tr[t])}const _e=function(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?_e(e.body[0]):e:e.type==="font"?_e(e.body):e},Be=function(e){const t=_e(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},Dr=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Br=function(e){const t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},Fe=function(e){return+e.toFixed(4)},Vt="acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳";class Ke{constructor(t){t=t||{},this.displayMode=K(t.displayMode,!1),this.annotate=K(t.annotate,!1),this.leqno=K(t.leqno,!1),this.throwOnError=K(t.throwOnError,!1),this.errorColor=K(t.errorColor,"#b22222"),this.macros=t.macros||{},this.wrap=K(t.wrap,"none"),this.xml=K(t.xml,!1),this.colorIsTextColor=K(t.colorIsTextColor,!1),this.strict=K(t.strict,!1),this.trust=K(t.trust,!1),this.maxSize=t.maxSize===void 0?[1/0,1/0]:Array.isArray(t.maxSize)?t.maxSize:[1/0,1/0],this.maxExpand=Math.max(0,K(t.maxExpand,1e3))}isTrusted(t){if(t.url&&!t.protocol){const o=Br(t.url);if(o==null)return!1;t.protocol=o}return!!(typeof this.trust=="function"?this.trust(t):this.trust)}}const Wt={},Te={};function S({type:e,names:t,props:r,handler:o,mathmlBuilder:s}){const i={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:o};for(let l=0;l<t.length;++l)Wt[t[l]]=i;e&&s&&(Te[e]=s)}function se({type:e,mathmlBuilder:t}){S({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},mathmlBuilder:t})}const pe=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},R=function(e){return e.type==="ordgroup"?e.body:[e]};class Je{constructor(t){this.children=t,this.classes=[],this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){const t=document.createDocumentFragment();for(let r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t}toMarkup(){let t="";for(let r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t}toText(){const t=r=>r.toText();return this.children.map(t).join("")}}const de=function(e){return e.filter(t=>t).join(" ")},$r=function(e,t){this.classes=e||[],this.attributes={},this.style=t||{}},Or=function(e){const t=document.createElement(e);t.className=de(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},Er=function(e){let t=`<${e}`;this.classes.length&&(t+=` class="${te(de(this.classes))}"`);let r="";for(const o in this.style)Object.prototype.hasOwnProperty.call(this.style,o)&&(r+=`${Ye(o)}:${this.style[o]};`);r&&(t+=` style="${r}"`);for(const o in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,o)&&(t+=` ${o}="${te(this.attributes[o])}"`);t+=">";for(let o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+=`</${e}>`,t};class Ht{constructor(t,r,o){$r.call(this,t,o),this.children=r||[]}setAttribute(t,r){this.attributes[t]=r}toNode(){return Or.call(this,"span")}toMarkup(){return Er.call(this,"span")}}let zr=class{constructor(t){this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return te(this.text)}};class Zt{constructor(t,r,o){this.href=t,this.classes=r,this.children=o||[]}toNode(){const t=document.createElement("a");t.setAttribute("href",this.href),this.classes.length>0&&(t.className=de(this.classes));for(let r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t}toMarkup(){let t=`<a href='${te(this.href)}'`;this.classes.length>0&&(t+=` class="${te(de(this.classes))}"`),t+=">";for(let r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</a>",t}}class Lr{constructor(t,r,o){this.alt=r,this.src=t,this.classes=["mord"],this.style=o}hasClass(t){return this.classes.includes(t)}toNode(){const t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(const r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(t.style[r]=this.style[r]);return t}toMarkup(){let t=`<img src='${this.src}' alt='${this.alt}'`,r="";for(const o in this.style)Object.prototype.hasOwnProperty.call(this.style,o)&&(r+=`${Ye(o)}:${this.style[o]};`);return r&&(t+=` style="${te(r)}"`),t+=">",t}}function ae(e){return new Je(e)}class p{constructor(t,r,o,s){this.type=t,this.attributes={},this.children=r||[],this.classes=o||[],this.style=s||{},this.label=""}setAttribute(t,r){this.attributes[t]=r}getAttribute(t){return this.attributes[t]}setLabel(t){this.label=t}toNode(){const t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(const r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);this.classes.length>0&&(t.className=de(this.classes));for(const r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(t.style[r]=this.style[r]);for(let r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t}toMarkup(){let t="<"+this.type;for(const o in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,o)&&(t+=" "+o+'="',t+=te(this.attributes[o]),t+='"');this.classes.length>0&&(t+=` class="${te(de(this.classes))}"`);let r="";for(const o in this.style)Object.prototype.hasOwnProperty.call(this.style,o)&&(r+=`${Ye(o)}:${this.style[o]};`);r&&(t+=` style="${r}"`),t+=">";for(let o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}class j{constructor(t){this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return te(this.toText())}toText(){return this.text}}const Qe=e=>{let t;return e.length===1&&e[0].type==="mrow"?(t=e.pop(),t.type="mstyle"):t=new p("mstyle",e),t},ce=e=>{let t=0;if(e.body&&Array.isArray(e.body))for(const r of e.body)t+=ce(r);else if(e.body)t+=ce(e.body);else if(e.type==="supsub")t+=ce(e.base),e.sub&&(t+=.7*ce(e.sub)),e.sup&&(t+=.7*ce(e.sup));else if(e.type==="mathord"||e.type==="textord")for(const r of e.text.split("")){const o=r.codePointAt(0);96<o&&o<123||944<o&&o<970?t+=.56:47<o&&o<58?t+=.5:t+=.92}else t+=1;return t},Fr={widehat:"^",widecheck:"ˇ",widetilde:"~",wideparen:"⏜",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overbracket:"⎴",underbracket:"⎵",overgroup:"⏠",overparen:"⏜",undergroup:"⏡",underparen:"⏝",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xrightleftarrows:"⇄",xtofrom:"⇄",xleftrightharpoons:"⇋",xrightleftharpoons:"⇌",yields:"→",yieldsLeft:"←",mesomerism:"↔",longrightharpoonup:"⇀",longleftharpoondown:"↽",eqrightharpoonup:"⇀",eqleftharpoondown:"↽","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"=",yieldsLeftRight:"⇄",chemequilibrium:"⇌"},et=function(e){const t=new j(Fr[e.slice(1)]),r=new p("mo",[t]);return r.setAttribute("stretchy","true"),r},Ir=["\\widetilde","\\widehat","\\widecheck","\\utilde"],Xt=e=>{const t=et(e.label);if(Ir.includes(e.label)){const r=ce(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},Nr={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Mr={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},P={math:{},text:{}};function n(e,t,r,o,s){P[e][o]={group:t,replace:r},s&&r&&(P[e][r]=P[e][o])}const a="math",g="text",O="accent-token",b="bin",I="close",ie="inner",A="mathord",B="op-token",G="open",be="punct",m="rel",re="spacing",d="textord";n(a,m,"≡","\\equiv",!0);n(a,m,"≺","\\prec",!0);n(a,m,"≻","\\succ",!0);n(a,m,"","\\sim",!0);n(a,m,"⟂","\\perp",!0);n(a,m,"⪯","\\preceq",!0);n(a,m,"⪰","\\succeq",!0);n(a,m,"≃","\\simeq",!0);n(a,m,"≌","\\backcong",!0);n(a,m,"|","\\mid",!0);n(a,m,"≪","\\ll",!0);n(a,m,"≫","\\gg",!0);n(a,m,"≍","\\asymp",!0);n(a,m,"∥","\\parallel");n(a,m,"⌣","\\smile",!0);n(a,m,"⊑","\\sqsubseteq",!0);n(a,m,"⊒","\\sqsupseteq",!0);n(a,m,"≐","\\doteq",!0);n(a,m,"⌢","\\frown",!0);n(a,m,"∋","\\ni",!0);n(a,m,"∌","\\notni",!0);n(a,m,"∝","\\propto",!0);n(a,m,"⊢","\\vdash",!0);n(a,m,"⊣","\\dashv",!0);n(a,m,"∋","\\owns");n(a,m,"≘","\\arceq",!0);n(a,m,"≙","\\wedgeq",!0);n(a,m,"≚","\\veeeq",!0);n(a,m,"≛","\\stareq",!0);n(a,m,"≝","\\eqdef",!0);n(a,m,"≞","\\measeq",!0);n(a,m,"≟","\\questeq",!0);n(a,m,"≠","\\ne",!0);n(a,m,"≠","\\neq");n(a,m,"⩵","\\eqeq",!0);n(a,m,"⩶","\\eqeqeq",!0);n(a,m,"∷","\\dblcolon",!0);n(a,m,"≔","\\coloneqq",!0);n(a,m,"≕","\\eqqcolon",!0);n(a,m,"∹","\\eqcolon",!0);n(a,m,"⩴","\\Coloneqq",!0);n(a,be,".","\\ldotp");n(a,be,"·","\\cdotp");n(a,d,"#","\\#");n(g,d,"#","\\#");n(a,d,"&","\\&");n(g,d,"&","\\&");n(a,d,"ℵ","\\aleph",!0);n(a,d,"∀","\\forall",!0);n(a,d,"ℏ","\\hbar",!0);n(a,d,"∃","\\exists",!0);n(a,b,"∇","\\nabla",!0);n(a,d,"♭","\\flat",!0);n(a,d,"","\\ell",!0);n(a,d,"♮","\\natural",!0);n(a,d,"Å","\\Angstrom",!0);n(g,d,"Å","\\Angstrom",!0);n(a,d,"♣","\\clubsuit",!0);n(a,d,"♧","\\varclubsuit",!0);n(a,d,"℘","\\wp",!0);n(a,d,"♯","\\sharp",!0);n(a,d,"♢","\\diamondsuit",!0);n(a,d,"♦","\\vardiamondsuit",!0);n(a,d,"","\\Re",!0);n(a,d,"♡","\\heartsuit",!0);n(a,d,"♥","\\varheartsuit",!0);n(a,d,"","\\Im",!0);n(a,d,"♠","\\spadesuit",!0);n(a,d,"♤","\\varspadesuit",!0);n(a,d,"♀","\\female",!0);n(a,d,"♂","\\male",!0);n(a,d,"§","\\S",!0);n(g,d,"§","\\S");n(a,d,"¶","\\P",!0);n(g,d,"¶","\\P");n(g,d,"☺","\\smiley",!0);n(a,d,"☺","\\smiley",!0);n(a,d,"†","\\dag");n(g,d,"†","\\dag");n(g,d,"†","\\textdagger");n(a,d,"‡","\\ddag");n(g,d,"‡","\\ddag");n(g,d,"‡","\\textdaggerdbl");n(a,I,"⎱","\\rmoustache",!0);n(a,G,"⎰","\\lmoustache",!0);n(a,I,"⟯","\\rgroup",!0);n(a,G,"⟮","\\lgroup",!0);n(a,b,"∓","\\mp",!0);n(a,b,"⊖","\\ominus",!0);n(a,b,"⊎","\\uplus",!0);n(a,b,"⊓","\\sqcap",!0);n(a,b,"","\\ast");n(a,b,"⊔","\\sqcup",!0);n(a,b,"◯","\\bigcirc",!0);n(a,b,"∙","\\bullet",!0);n(a,b,"‡","\\ddagger");n(a,b,"≀","\\wr",!0);n(a,b,"⨿","\\amalg");n(a,b,"&","\\And");n(a,b,"⫽","\\sslash",!0);n(a,m,"⟵","\\longleftarrow",!0);n(a,m,"⇐","\\Leftarrow",!0);n(a,m,"⟸","\\Longleftarrow",!0);n(a,m,"⟶","\\longrightarrow",!0);n(a,m,"⇒","\\Rightarrow",!0);n(a,m,"⟹","\\Longrightarrow",!0);n(a,m,"↔","\\leftrightarrow",!0);n(a,m,"⟷","\\longleftrightarrow",!0);n(a,m,"⇔","\\Leftrightarrow",!0);n(a,m,"⟺","\\Longleftrightarrow",!0);n(a,m,"↤","\\mapsfrom",!0);n(a,m,"↦","\\mapsto",!0);n(a,m,"⟼","\\longmapsto",!0);n(a,m,"↗","\\nearrow",!0);n(a,m,"↩","\\hookleftarrow",!0);n(a,m,"↪","\\hookrightarrow",!0);n(a,m,"↘","\\searrow",!0);n(a,m,"↼","\\leftharpoonup",!0);n(a,m,"⇀","\\rightharpoonup",!0);n(a,m,"↙","\\swarrow",!0);n(a,m,"↽","\\leftharpoondown",!0);n(a,m,"⇁","\\rightharpoondown",!0);n(a,m,"↖","\\nwarrow",!0);n(a,m,"⇌","\\rightleftharpoons",!0);n(a,A,"↯","\\lightning",!0);n(a,A,"∎","\\QED",!0);n(a,A,"‰","\\permil",!0);n(g,d,"‰","\\permil");n(a,A,"☉","\\astrosun",!0);n(a,A,"☼","\\sun",!0);n(a,A,"☾","\\leftmoon",!0);n(a,A,"☽","\\rightmoon",!0);n(a,A,"⊕","\\Earth");n(a,m,"≮","\\nless",!0);n(a,m,"⪇","\\lneq",!0);n(a,m,"≨","\\lneqq",!0);n(a,m,"≨︀","\\lvertneqq");n(a,m,"⋦","\\lnsim",!0);n(a,m,"⪉","\\lnapprox",!0);n(a,m,"⊀","\\nprec",!0);n(a,m,"⋠","\\npreceq",!0);n(a,m,"⋨","\\precnsim",!0);n(a,m,"⪹","\\precnapprox",!0);n(a,m,"≁","\\nsim",!0);n(a,m,"∤","\\nmid",!0);n(a,m,"∤","\\nshortmid");n(a,m,"⊬","\\nvdash",!0);n(a,m,"⊭","\\nvDash",!0);n(a,m,"⋪","\\ntriangleleft");n(a,m,"⋬","\\ntrianglelefteq",!0);n(a,m,"⊄","\\nsubset",!0);n(a,m,"⊅","\\nsupset",!0);n(a,m,"⊊","\\subsetneq",!0);n(a,m,"⊊︀","\\varsubsetneq");n(a,m,"⫋","\\subsetneqq",!0);n(a,m,"⫋︀","\\varsubsetneqq");n(a,m,"≯","\\ngtr",!0);n(a,m,"⪈","\\gneq",!0);n(a,m,"≩","\\gneqq",!0);n(a,m,"≩︀","\\gvertneqq");n(a,m,"⋧","\\gnsim",!0);n(a,m,"⪊","\\gnapprox",!0);n(a,m,"⊁","\\nsucc",!0);n(a,m,"⋡","\\nsucceq",!0);n(a,m,"⋩","\\succnsim",!0);n(a,m,"⪺","\\succnapprox",!0);n(a,m,"≆","\\ncong",!0);n(a,m,"∦","\\nparallel",!0);n(a,m,"∦","\\nshortparallel");n(a,m,"⊯","\\nVDash",!0);n(a,m,"⋫","\\ntriangleright");n(a,m,"⋭","\\ntrianglerighteq",!0);n(a,m,"⊋","\\supsetneq",!0);n(a,m,"⊋","\\varsupsetneq");n(a,m,"⫌","\\supsetneqq",!0);n(a,m,"⫌︀","\\varsupsetneqq");n(a,m,"⊮","\\nVdash",!0);n(a,m,"⪵","\\precneqq",!0);n(a,m,"⪶","\\succneqq",!0);n(a,b,"⊴","\\unlhd");n(a,b,"⊵","\\unrhd");n(a,m,"↚","\\nleftarrow",!0);n(a,m,"↛","\\nrightarrow",!0);n(a,m,"⇍","\\nLeftarrow",!0);n(a,m,"⇏","\\nRightarrow",!0);n(a,m,"↮","\\nleftrightarrow",!0);n(a,m,"⇎","\\nLeftrightarrow",!0);n(a,m,"△","\\vartriangle");n(a,d,"ℏ","\\hslash");n(a,d,"▽","\\triangledown");n(a,d,"◊","\\lozenge");n(a,d,"Ⓢ","\\circledS");n(a,d,"®","\\circledR",!0);n(g,d,"®","\\circledR");n(g,d,"®","\\textregistered");n(a,d,"∡","\\measuredangle",!0);n(a,d,"∄","\\nexists");n(a,d,"℧","\\mho");n(a,d,"Ⅎ","\\Finv",!0);n(a,d,"⅁","\\Game",!0);n(a,d,"","\\backprime");n(a,d,"‶","\\backdprime");n(a,d,"‷","\\backtrprime");n(a,d,"▲","\\blacktriangle");n(a,d,"▼","\\blacktriangledown");n(a,d,"■","\\blacksquare");n(a,d,"⧫","\\blacklozenge");n(a,d,"★","\\bigstar");n(a,d,"∢","\\sphericalangle",!0);n(a,d,"∁","\\complement",!0);n(a,d,"","\\diagup");n(a,d,"╲","\\diagdown");n(a,d,"□","\\square");n(a,d,"□","\\Box");n(a,d,"◊","\\Diamond");n(a,d,"¥","\\yen",!0);n(g,d,"¥","\\yen",!0);n(a,d,"✓","\\checkmark",!0);n(g,d,"✓","\\checkmark");n(a,d,"✗","\\ballotx",!0);n(g,d,"✗","\\ballotx");n(g,d,"•","\\textbullet");n(a,d,"ℶ","\\beth",!0);n(a,d,"ℸ","\\daleth",!0);n(a,d,"ℷ","\\gimel",!0);n(a,d,"ϝ","\\digamma",!0);n(a,d,"ϰ","\\varkappa");n(a,G,"⌜","\\ulcorner",!0);n(a,I,"⌝","\\urcorner",!0);n(a,G,"⌞","\\llcorner",!0);n(a,I,"⌟","\\lrcorner",!0);n(a,m,"≦","\\leqq",!0);n(a,m,"⩽","\\leqslant",!0);n(a,m,"⪕","\\eqslantless",!0);n(a,m,"≲","\\lesssim",!0);n(a,m,"⪅","\\lessapprox",!0);n(a,m,"≊","\\approxeq",!0);n(a,b,"⋖","\\lessdot");n(a,m,"⋘","\\lll",!0);n(a,m,"≶","\\lessgtr",!0);n(a,m,"⋚","\\lesseqgtr",!0);n(a,m,"⪋","\\lesseqqgtr",!0);n(a,m,"≑","\\doteqdot");n(a,m,"≓","\\risingdotseq",!0);n(a,m,"≒","\\fallingdotseq",!0);n(a,m,"∽","\\backsim",!0);n(a,m,"⋍","\\backsimeq",!0);n(a,m,"⫅","\\subseteqq",!0);n(a,m,"⋐","\\Subset",!0);n(a,m,"⊏","\\sqsubset",!0);n(a,m,"≼","\\preccurlyeq",!0);n(a,m,"⋞","\\curlyeqprec",!0);n(a,m,"≾","\\precsim",!0);n(a,m,"⪷","\\precapprox",!0);n(a,m,"⊲","\\vartriangleleft");n(a,m,"⊴","\\trianglelefteq");n(a,m,"⊨","\\vDash",!0);n(a,m,"⊫","\\VDash",!0);n(a,m,"⊪","\\Vvdash",!0);n(a,m,"⌣","\\smallsmile");n(a,m,"⌢","\\smallfrown");n(a,m,"≏","\\bumpeq",!0);n(a,m,"≎","\\Bumpeq",!0);n(a,m,"≧","\\geqq",!0);n(a,m,"⩾","\\geqslant",!0);n(a,m,"⪖","\\eqslantgtr",!0);n(a,m,"≳","\\gtrsim",!0);n(a,m,"⪆","\\gtrapprox",!0);n(a,b,"⋗","\\gtrdot");n(a,m,"⋙","\\ggg",!0);n(a,m,"≷","\\gtrless",!0);n(a,m,"⋛","\\gtreqless",!0);n(a,m,"⪌","\\gtreqqless",!0);n(a,m,"≖","\\eqcirc",!0);n(a,m,"≗","\\circeq",!0);n(a,m,"≜","\\triangleq",!0);n(a,m,"","\\thicksim");n(a,m,"≈","\\thickapprox");n(a,m,"⫆","\\supseteqq",!0);n(a,m,"⋑","\\Supset",!0);n(a,m,"⊐","\\sqsupset",!0);n(a,m,"≽","\\succcurlyeq",!0);n(a,m,"⋟","\\curlyeqsucc",!0);n(a,m,"≿","\\succsim",!0);n(a,m,"⪸","\\succapprox",!0);n(a,m,"⊳","\\vartriangleright");n(a,m,"⊵","\\trianglerighteq");n(a,m,"⊩","\\Vdash",!0);n(a,m,"","\\shortmid");n(a,m,"∥","\\shortparallel");n(a,m,"≬","\\between",!0);n(a,m,"⋔","\\pitchfork",!0);n(a,m,"∝","\\varpropto");n(a,m,"◀","\\blacktriangleleft");n(a,m,"∴","\\therefore",!0);n(a,m,"∍","\\backepsilon");n(a,m,"▶","\\blacktriangleright");n(a,m,"∵","\\because",!0);n(a,m,"⋘","\\llless");n(a,m,"⋙","\\gggtr");n(a,b,"⊲","\\lhd");n(a,b,"⊳","\\rhd");n(a,m,"≂","\\eqsim",!0);n(a,m,"≑","\\Doteq",!0);n(a,m,"⥽","\\strictif",!0);n(a,m,"⥼","\\strictfi",!0);n(a,b,"∔","\\dotplus",!0);n(a,b,"","\\smallsetminus");n(a,b,"⋒","\\Cap",!0);n(a,b,"⋓","\\Cup",!0);n(a,b,"⩞","\\doublebarwedge",!0);n(a,b,"⊟","\\boxminus",!0);n(a,b,"⊞","\\boxplus",!0);n(a,b,"⧄","\\boxslash",!0);n(a,b,"⋇","\\divideontimes",!0);n(a,b,"⋉","\\ltimes",!0);n(a,b,"⋊","\\rtimes",!0);n(a,b,"⋋","\\leftthreetimes",!0);n(a,b,"⋌","\\rightthreetimes",!0);n(a,b,"⋏","\\curlywedge",!0);n(a,b,"⋎","\\curlyvee",!0);n(a,b,"⊝","\\circleddash",!0);n(a,b,"⊛","\\circledast",!0);n(a,b,"⊺","\\intercal",!0);n(a,b,"⋒","\\doublecap");n(a,b,"⋓","\\doublecup");n(a,b,"⊠","\\boxtimes",!0);n(a,b,"⋈","\\bowtie",!0);n(a,b,"⋈","\\Join");n(a,b,"⟕","\\leftouterjoin",!0);n(a,b,"⟖","\\rightouterjoin",!0);n(a,b,"⟗","\\fullouterjoin",!0);n(a,b,"∸","\\dotminus",!0);n(a,b,"⟑","\\wedgedot",!0);n(a,b,"⟇","\\veedot",!0);n(a,b,"⩢","\\doublebarvee",!0);n(a,b,"⩣","\\veedoublebar",!0);n(a,b,"⩟","\\wedgebar",!0);n(a,b,"⩠","\\wedgedoublebar",!0);n(a,b,"⩔","\\Vee",!0);n(a,b,"⩓","\\Wedge",!0);n(a,b,"⩃","\\barcap",!0);n(a,b,"⩂","\\barcup",!0);n(a,b,"⩈","\\capbarcup",!0);n(a,b,"⩀","\\capdot",!0);n(a,b,"⩇","\\capovercup",!0);n(a,b,"⩆","\\cupovercap",!0);n(a,b,"⩍","\\closedvarcap",!0);n(a,b,"⩌","\\closedvarcup",!0);n(a,b,"⨪","\\minusdot",!0);n(a,b,"⨫","\\minusfdots",!0);n(a,b,"⨬","\\minusrdots",!0);n(a,b,"⊻","\\Xor",!0);n(a,b,"⊼","\\Nand",!0);n(a,b,"⊽","\\Nor",!0);n(a,b,"⊽","\\barvee");n(a,b,"⫴","\\interleave",!0);n(a,b,"⧢","\\shuffle",!0);n(a,b,"⫶","\\threedotcolon",!0);n(a,b,"⦂","\\typecolon",!0);n(a,b,"∾","\\invlazys",!0);n(a,b,"⩋","\\twocaps",!0);n(a,b,"⩊","\\twocups",!0);n(a,b,"⩎","\\Sqcap",!0);n(a,b,"⩏","\\Sqcup",!0);n(a,b,"⩖","\\veeonvee",!0);n(a,b,"⩕","\\wedgeonwedge",!0);n(a,b,"⧗","\\blackhourglass",!0);n(a,b,"⧆","\\boxast",!0);n(a,b,"⧈","\\boxbox",!0);n(a,b,"⧇","\\boxcircle",!0);n(a,b,"⊜","\\circledequal",!0);n(a,b,"⦷","\\circledparallel",!0);n(a,b,"⦶","\\circledvert",!0);n(a,b,"⦵","\\circlehbar",!0);n(a,b,"⟡","\\concavediamond",!0);n(a,b,"⟢","\\concavediamondtickleft",!0);n(a,b,"⟣","\\concavediamondtickright",!0);n(a,b,"⋄","\\diamond",!0);n(a,b,"⧖","\\hourglass",!0);n(a,b,"⟠","\\lozengeminus",!0);n(a,b,"⌽","\\obar",!0);n(a,b,"⦸","\\obslash",!0);n(a,b,"⨸","\\odiv",!0);n(a,b,"⧁","\\ogreaterthan",!0);n(a,b,"⧀","\\olessthan",!0);n(a,b,"⦹","\\operp",!0);n(a,b,"⨷","\\Otimes",!0);n(a,b,"⨶","\\otimeshat",!0);n(a,b,"⋆","\\star",!0);n(a,b,"△","\\triangle",!0);n(a,b,"⨺","\\triangleminus",!0);n(a,b,"⨹","\\triangleplus",!0);n(a,b,"⨻","\\triangletimes",!0);n(a,b,"⟤","\\whitesquaretickleft",!0);n(a,b,"⟥","\\whitesquaretickright",!0);n(a,b,"⨳","\\smashtimes",!0);n(a,m,"⇢","\\dashrightarrow",!0);n(a,m,"⇠","\\dashleftarrow",!0);n(a,m,"⇇","\\leftleftarrows",!0);n(a,m,"⇆","\\leftrightarrows",!0);n(a,m,"⇚","\\Lleftarrow",!0);n(a,m,"↞","\\twoheadleftarrow",!0);n(a,m,"↢","\\leftarrowtail",!0);n(a,m,"↫","\\looparrowleft",!0);n(a,m,"⇋","\\leftrightharpoons",!0);n(a,m,"↶","\\curvearrowleft",!0);n(a,m,"↺","\\circlearrowleft",!0);n(a,m,"↰","\\Lsh",!0);n(a,m,"⇈","\\upuparrows",!0);n(a,m,"↿","\\upharpoonleft",!0);n(a,m,"⇃","\\downharpoonleft",!0);n(a,m,"⊶","\\origof",!0);n(a,m,"⊷","\\imageof",!0);n(a,m,"⊸","\\multimap",!0);n(a,m,"↭","\\leftrightsquigarrow",!0);n(a,m,"⇉","\\rightrightarrows",!0);n(a,m,"⇄","\\rightleftarrows",!0);n(a,m,"↠","\\twoheadrightarrow",!0);n(a,m,"↣","\\rightarrowtail",!0);n(a,m,"↬","\\looparrowright",!0);n(a,m,"↷","\\curvearrowright",!0);n(a,m,"↻","\\circlearrowright",!0);n(a,m,"↱","\\Rsh",!0);n(a,m,"⇊","\\downdownarrows",!0);n(a,m,"↾","\\upharpoonright",!0);n(a,m,"⇂","\\downharpoonright",!0);n(a,m,"⇝","\\rightsquigarrow",!0);n(a,m,"⇝","\\leadsto");n(a,m,"⇛","\\Rrightarrow",!0);n(a,m,"↾","\\restriction");n(a,d,"","`");n(a,d,"$","\\$");n(g,d,"$","\\$");n(g,d,"$","\\textdollar");n(a,d,"¢","\\cent");n(g,d,"¢","\\cent");n(a,d,"%","\\%");n(g,d,"%","\\%");n(a,d,"_","\\_");n(g,d,"_","\\_");n(g,d,"_","\\textunderscore");n(g,d,"␣","\\textvisiblespace",!0);n(a,d,"∠","\\angle",!0);n(a,d,"∞","\\infty",!0);n(a,d,"","\\prime");n(a,d,"″","\\dprime");n(a,d,"‴","\\trprime");n(a,d,"⁗","\\qprime");n(a,d,"△","\\triangle");n(g,d,"Α","\\Alpha",!0);n(g,d,"Β","\\Beta",!0);n(g,d,"Γ","\\Gamma",!0);n(g,d,"Δ","\\Delta",!0);n(g,d,"Ε","\\Epsilon",!0);n(g,d,"Ζ","\\Zeta",!0);n(g,d,"Η","\\Eta",!0);n(g,d,"Θ","\\Theta",!0);n(g,d,"Ι","\\Iota",!0);n(g,d,"Κ","\\Kappa",!0);n(g,d,"Λ","\\Lambda",!0);n(g,d,"Μ","\\Mu",!0);n(g,d,"Ν","\\Nu",!0);n(g,d,"Ξ","\\Xi",!0);n(g,d,"Ο","\\Omicron",!0);n(g,d,"Π","\\Pi",!0);n(g,d,"Ρ","\\Rho",!0);n(g,d,"Σ","\\Sigma",!0);n(g,d,"Τ","\\Tau",!0);n(g,d,"Υ","\\Upsilon",!0);n(g,d,"Φ","\\Phi",!0);n(g,d,"Χ","\\Chi",!0);n(g,d,"Ψ","\\Psi",!0);n(g,d,"Ω","\\Omega",!0);n(a,A,"Α","\\Alpha",!0);n(a,A,"Β","\\Beta",!0);n(a,A,"Γ","\\Gamma",!0);n(a,A,"Δ","\\Delta",!0);n(a,A,"Ε","\\Epsilon",!0);n(a,A,"Ζ","\\Zeta",!0);n(a,A,"Η","\\Eta",!0);n(a,A,"Θ","\\Theta",!0);n(a,A,"Ι","\\Iota",!0);n(a,A,"Κ","\\Kappa",!0);n(a,A,"Λ","\\Lambda",!0);n(a,A,"Μ","\\Mu",!0);n(a,A,"Ν","\\Nu",!0);n(a,A,"Ξ","\\Xi",!0);n(a,A,"Ο","\\Omicron",!0);n(a,A,"Π","\\Pi",!0);n(a,A,"Ρ","\\Rho",!0);n(a,A,"Σ","\\Sigma",!0);n(a,A,"Τ","\\Tau",!0);n(a,A,"Υ","\\Upsilon",!0);n(a,A,"Φ","\\Phi",!0);n(a,A,"Χ","\\Chi",!0);n(a,A,"Ψ","\\Psi",!0);n(a,A,"Ω","\\Omega",!0);n(a,G,"¬","\\neg",!0);n(a,G,"¬","\\lnot");n(a,d,"","\\top");n(a,d,"⊥","\\bot");n(a,d,"∅","\\emptyset");n(a,d,"⌀","\\varnothing");n(a,A,"α","\\alpha",!0);n(a,A,"β","\\beta",!0);n(a,A,"γ","\\gamma",!0);n(a,A,"δ","\\delta",!0);n(a,A,"ϵ","\\epsilon",!0);n(a,A,"ζ","\\zeta",!0);n(a,A,"η","\\eta",!0);n(a,A,"θ","\\theta",!0);n(a,A,"ι","\\iota",!0);n(a,A,"κ","\\kappa",!0);n(a,A,"λ","\\lambda",!0);n(a,A,"μ","\\mu",!0);n(a,A,"ν","\\nu",!0);n(a,A,"ξ","\\xi",!0);n(a,A,"ο","\\omicron",!0);n(a,A,"π","\\pi",!0);n(a,A,"ρ","\\rho",!0);n(a,A,"σ","\\sigma",!0);n(a,A,"τ","\\tau",!0);n(a,A,"υ","\\upsilon",!0);n(a,A,"ϕ","\\phi",!0);n(a,A,"χ","\\chi",!0);n(a,A,"ψ","\\psi",!0);n(a,A,"ω","\\omega",!0);n(a,A,"ε","\\varepsilon",!0);n(a,A,"ϑ","\\vartheta",!0);n(a,A,"ϖ","\\varpi",!0);n(a,A,"ϱ","\\varrho",!0);n(a,A,"ς","\\varsigma",!0);n(a,A,"φ","\\varphi",!0);n(a,A,"Ϙ","\\Coppa",!0);n(a,A,"ϙ","\\coppa",!0);n(a,A,"ϙ","\\varcoppa",!0);n(a,A,"Ϟ","\\Koppa",!0);n(a,A,"ϟ","\\koppa",!0);n(a,A,"Ϡ","\\Sampi",!0);n(a,A,"ϡ","\\sampi",!0);n(a,A,"Ϛ","\\Stigma",!0);n(a,A,"ϛ","\\stigma",!0);n(a,A,"⫫","\\Bot");n(a,d,"ð","\\eth",!0);n(g,d,"ð","ð");n(a,d,"Å","\\AA");n(g,d,"Å","\\AA",!0);n(a,d,"Æ","\\AE",!0);n(g,d,"Æ","\\AE",!0);n(a,d,"Ð","\\DH",!0);n(g,d,"Ð","\\DH",!0);n(a,d,"Þ","\\TH",!0);n(g,d,"Þ","\\TH",!0);n(a,d,"ß","\\ss",!0);n(g,d,"ß","\\ss",!0);n(a,d,"å","\\aa");n(g,d,"å","\\aa",!0);n(a,d,"æ","\\ae",!0);n(g,d,"æ","\\ae",!0);n(a,d,"ð","\\dh");n(g,d,"ð","\\dh",!0);n(a,d,"þ","\\th",!0);n(g,d,"þ","\\th",!0);n(a,d,"Đ","\\DJ",!0);n(g,d,"Đ","\\DJ",!0);n(a,d,"đ","\\dj",!0);n(g,d,"đ","\\dj",!0);n(a,d,"Ł","\\L",!0);n(g,d,"Ł","\\L",!0);n(a,d,"Ł","\\l",!0);n(g,d,"Ł","\\l",!0);n(a,d,"Ŋ","\\NG",!0);n(g,d,"Ŋ","\\NG",!0);n(a,d,"ŋ","\\ng",!0);n(g,d,"ŋ","\\ng",!0);n(a,d,"Œ","\\OE",!0);n(g,d,"Œ","\\OE",!0);n(a,d,"œ","\\oe",!0);n(g,d,"œ","\\oe",!0);n(a,b,"","",!0);n(a,b,"+","+");n(a,b,"","*");n(a,b,"","/",!0);n(a,b,"","");n(a,b,"","-",!0);n(a,b,"⋅","\\cdot",!0);n(a,b,"∘","\\circ",!0);n(a,b,"÷","\\div",!0);n(a,b,"±","\\pm",!0);n(a,b,"×","\\times",!0);n(a,b,"∩","\\cap",!0);n(a,b,"","\\cup",!0);n(a,b,"","\\setminus",!0);n(a,b,"∧","\\land");n(a,b,"","\\lor");n(a,b,"∧","\\wedge",!0);n(a,b,"","\\vee",!0);n(a,G,"⟦","\\llbracket",!0);n(a,I,"⟧","\\rrbracket",!0);n(a,G,"⟨","\\langle",!0);n(a,G,"⟪","\\lAngle",!0);n(a,G,"⦉","\\llangle",!0);n(a,G,"|","\\lvert");n(a,G,"‖","\\lVert",!0);n(a,d,"!","\\oc");n(a,d,"?","\\wn");n(a,d,"↓","\\shpos");n(a,d,"↕","\\shift");n(a,d,"↑","\\shneg");n(a,I,"?","?");n(a,I,"!","!");n(a,I,"‼","‼");n(a,I,"⟩","\\rangle",!0);n(a,I,"⟫","\\rAngle",!0);n(a,I,"⦊","\\rrangle",!0);n(a,I,"|","\\rvert");n(a,I,"‖","\\rVert");n(a,G,"⦃","\\lBrace",!0);n(a,I,"⦄","\\rBrace",!0);n(a,m,"=","\\equal",!0);n(a,m,":",":");n(a,m,"≈","\\approx",!0);n(a,m,"≅","\\cong",!0);n(a,m,"≥","\\ge");n(a,m,"≥","\\geq",!0);n(a,m,"←","\\gets");n(a,m,">","\\gt",!0);n(a,m,"∈","\\in",!0);n(a,m,"∉","\\notin",!0);n(a,m,"","\\@not");n(a,m,"⊂","\\subset",!0);n(a,m,"⊃","\\supset",!0);n(a,m,"⊆","\\subseteq",!0);n(a,m,"⊇","\\supseteq",!0);n(a,m,"⊈","\\nsubseteq",!0);n(a,m,"⊈","\\nsubseteqq");n(a,m,"⊉","\\nsupseteq",!0);n(a,m,"⊉","\\nsupseteqq");n(a,m,"⊨","\\models");n(a,m,"←","\\leftarrow",!0);n(a,m,"≤","\\le");n(a,m,"≤","\\leq",!0);n(a,m,"<","\\lt",!0);n(a,m,"→","\\rightarrow",!0);n(a,m,"→","\\to");n(a,m,"≱","\\ngeq",!0);n(a,m,"≱","\\ngeqq");n(a,m,"≱","\\ngeqslant");n(a,m,"≰","\\nleq",!0);n(a,m,"≰","\\nleqq");n(a,m,"≰","\\nleqslant");n(a,m,"⫫","\\Perp",!0);n(a,re," ","\\ ");n(a,re," ","\\space");n(a,re," ","\\nobreakspace");n(g,re," ","\\ ");n(g,re," "," ");n(g,re," ","\\space");n(g,re," ","\\nobreakspace");n(a,re,null,"\\nobreak");n(a,re,null,"\\allowbreak");n(a,be,",",",");n(g,be,":",":");n(a,be,";",";");n(a,b,"⊼","\\barwedge");n(a,b,"⊻","\\veebar");n(a,b,"⊙","\\odot",!0);n(a,b,"⊕︎","\\oplus");n(a,b,"⊗","\\otimes",!0);n(a,d,"∂","\\partial",!0);n(a,b,"⊘","\\oslash",!0);n(a,b,"⊚","\\circledcirc",!0);n(a,b,"⊡","\\boxdot",!0);n(a,b,"△","\\bigtriangleup");n(a,b,"▽","\\bigtriangledown");n(a,b,"†","\\dagger");n(a,b,"⋄","\\diamond");n(a,b,"◃","\\triangleleft");n(a,b,"▹","\\triangleright");n(a,G,"{","\\{");n(g,d,"{","\\{");n(g,d,"{","\\textbraceleft");n(a,I,"}","\\}");n(g,d,"}","\\}");n(g,d,"}","\\textbraceright");n(a,G,"{","\\lbrace");n(a,I,"}","\\rbrace");n(a,G,"[","\\lbrack",!0);n(g,d,"[","\\lbrack",!0);n(a,I,"]","\\rbrack",!0);n(g,d,"]","\\rbrack",!0);n(a,G,"(","\\lparen",!0);n(a,I,")","\\rparen",!0);n(a,G,"⦇","\\llparenthesis",!0);n(a,I,"⦈","\\rrparenthesis",!0);n(g,d,"<","\\textless",!0);n(g,d,">","\\textgreater",!0);n(a,G,"⌊","\\lfloor",!0);n(a,I,"⌋","\\rfloor",!0);n(a,G,"⌈","\\lceil",!0);n(a,I,"⌉","\\rceil",!0);n(a,d,"\\","\\backslash");n(a,d,"|","|");n(a,d,"|","\\vert");n(g,d,"|","\\textbar",!0);n(a,d,"‖","\\|");n(a,d,"‖","\\Vert");n(g,d,"‖","\\textbardbl");n(g,d,"~","\\textasciitilde");n(g,d,"\\","\\textbackslash");n(g,d,"^","\\textasciicircum");n(a,m,"↑","\\uparrow",!0);n(a,m,"⇑","\\Uparrow",!0);n(a,m,"↓","\\downarrow",!0);n(a,m,"⇓","\\Downarrow",!0);n(a,m,"↕","\\updownarrow",!0);n(a,m,"⇕","\\Updownarrow",!0);n(a,B,"∐","\\coprod");n(a,B,"","\\bigvee");n(a,B,"⋀","\\bigwedge");n(a,B,"⨄","\\biguplus");n(a,B,"⨄","\\bigcupplus");n(a,B,"⨃","\\bigcupdot");n(a,B,"⨇","\\bigdoublevee");n(a,B,"⨈","\\bigdoublewedge");n(a,B,"⋂","\\bigcap");n(a,B,"","\\bigcup");n(a,B,"∫","\\int");n(a,B,"∫","\\intop");n(a,B,"∬","\\iint");n(a,B,"∭","\\iiint");n(a,B,"∏","\\prod");n(a,B,"∑","\\sum");n(a,B,"⨂","\\bigotimes");n(a,B,"⨁","\\bigoplus");n(a,B,"⨀","\\bigodot");n(a,B,"⨉","\\bigtimes");n(a,B,"∮","\\oint");n(a,B,"∯","\\oiint");n(a,B,"∰","\\oiiint");n(a,B,"∱","\\intclockwise");n(a,B,"∲","\\varointclockwise");n(a,B,"⨌","\\iiiint");n(a,B,"⨍","\\intbar");n(a,B,"⨎","\\intBar");n(a,B,"⨏","\\fint");n(a,B,"⨒","\\rppolint");n(a,B,"⨓","\\scpolint");n(a,B,"⨕","\\pointint");n(a,B,"⨖","\\sqint");n(a,B,"⨗","\\intlarhk");n(a,B,"⨘","\\intx");n(a,B,"⨙","\\intcap");n(a,B,"⨚","\\intcup");n(a,B,"⨅","\\bigsqcap");n(a,B,"⨆","\\bigsqcup");n(a,B,"∫","\\smallint");n(g,ie,"…","\\textellipsis");n(a,ie,"…","\\mathellipsis");n(g,ie,"…","\\ldots",!0);n(a,ie,"…","\\ldots",!0);n(a,ie,"⋰","\\iddots",!0);n(a,ie,"⋯","\\@cdots",!0);n(a,ie,"⋱","\\ddots",!0);n(a,d,"⋮","\\varvdots");n(g,d,"⋮","\\varvdots");n(a,O,"´","\\acute");n(a,O,"`","\\grave");n(a,O,"¨","\\ddot");n(a,O,"…","\\dddot");n(a,O,"….","\\ddddot");n(a,O,"~","\\tilde");n(a,O,"‾","\\bar");n(a,O,"˘","\\breve");n(a,O,"ˇ","\\check");n(a,O,"^","\\hat");n(a,O,"→","\\vec");n(a,O,"˙","\\dot");n(a,O,"˚","\\mathring");n(a,A,"ı","\\imath",!0);n(a,A,"ȷ","\\jmath",!0);n(a,d,"ı","ı");n(a,d,"ȷ","ȷ");n(g,d,"ı","\\i",!0);n(g,d,"ȷ","\\j",!0);n(g,d,"ø","\\o",!0);n(a,A,"ø","\\o",!0);n(g,d,"Ø","\\O",!0);n(a,A,"Ø","\\O",!0);n(g,O,"ˊ","\\'");n(g,O,"ˋ","\\`");n(g,O,"ˆ","\\^");n(g,O,"~","\\~");n(g,O,"ˉ","\\=");n(g,O,"˘","\\u");n(g,O,"˙","\\.");n(g,O,"¸","\\c");n(g,O,"˚","\\r");n(g,O,"ˇ","\\v");n(g,O,"¨",'\\"');n(g,O,"˝","\\H");n(a,O,"ˊ","\\'");n(a,O,"ˋ","\\`");n(a,O,"ˆ","\\^");n(a,O,"~","\\~");n(a,O,"ˉ","\\=");n(a,O,"˘","\\u");n(a,O,"˙","\\.");n(a,O,"¸","\\c");n(a,O,"˚","\\r");n(a,O,"ˇ","\\v");n(a,O,"¨",'\\"');n(a,O,"˝","\\H");const Pr={"--":!0,"---":!0,"``":!0,"''":!0};n(g,d,"","--",!0);n(g,d,"","\\textendash");n(g,d,"—","---",!0);n(g,d,"—","\\textemdash");n(g,d,"","`",!0);n(g,d,"","\\textquoteleft");n(g,d,"","'",!0);n(g,d,"","\\textquoteright");n(g,d,"“","``",!0);n(g,d,"“","\\textquotedblleft");n(g,d,"”","''",!0);n(g,d,"”","\\textquotedblright");n(a,d,"°","\\degree",!0);n(g,d,"°","\\degree");n(g,d,"°","\\textdegree",!0);n(a,d,"£","\\pounds");n(a,d,"£","\\mathsterling",!0);n(g,d,"£","\\pounds");n(g,d,"£","\\textsterling",!0);n(a,d,"✠","\\maltese");n(g,d,"✠","\\maltese");n(a,d,"€","\\euro",!0);n(g,d,"€","\\euro",!0);n(g,d,"€","\\texteuro");n(a,d,"©","\\copyright",!0);n(g,d,"©","\\textcopyright");n(a,d,"⌀","\\diameter",!0);n(g,d,"⌀","\\diameter");n(a,d,"𝛤","\\varGamma");n(a,d,"𝛥","\\varDelta");n(a,d,"𝛩","\\varTheta");n(a,d,"𝛬","\\varLambda");n(a,d,"𝛯","\\varXi");n(a,d,"𝛱","\\varPi");n(a,d,"𝛴","\\varSigma");n(a,d,"𝛶","\\varUpsilon");n(a,d,"𝛷","\\varPhi");n(a,d,"𝛹","\\varPsi");n(a,d,"𝛺","\\varOmega");n(g,d,"𝛤","\\varGamma");n(g,d,"𝛥","\\varDelta");n(g,d,"𝛩","\\varTheta");n(g,d,"𝛬","\\varLambda");n(g,d,"𝛯","\\varXi");n(g,d,"𝛱","\\varPi");n(g,d,"𝛴","\\varSigma");n(g,d,"𝛶","\\varUpsilon");n(g,d,"𝛷","\\varPhi");n(g,d,"𝛹","\\varPsi");n(g,d,"𝛺","\\varOmega");const ct='0123456789/@."';for(let e=0;e<ct.length;e++){const t=ct.charAt(e);n(a,d,t,t)}const dt='0123456789!@*()-=+";:?/.,';for(let e=0;e<dt.length;e++){const t=dt.charAt(e);n(g,d,t,t)}const Ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e<Ce.length;e++){const t=Ce.charAt(e);n(a,A,t,t),n(g,d,t,t)}const mt="ÇÐÞçþℂℍℕℙℚℝℤℎℏℊℋℌℐℑℒℓ℘ℛℜℬℰℱℳℭℨ";for(let e=0;e<mt.length;e++){const t=mt.charAt(e);n(a,A,t,t),n(g,d,t,t)}let q="";for(let e=0;e<Ce.length;e++){q=String.fromCharCode(55349,56320+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,56372+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,56424+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,56580+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,56736+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,56788+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,56840+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,56944+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,56632+e),n(a,A,q,q),n(g,d,q,q);const t=Ce.charAt(e);q=String.fromCharCode(55349,56476+e),n(a,A,t,q),n(g,d,t,q)}for(let e=0;e<10;e++)q=String.fromCharCode(55349,57294+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,57314+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,57324+e),n(a,A,q,q),n(g,d,q,q),q=String.fromCharCode(55349,57334+e),n(a,A,q,q),n(g,d,q,q);const Gr="([{⌊⌈⟨⟮⎰⟦⦃",Rr=")]}⌋⌉⟩⟯⎱⟦⦄";function jr(e,t,r){const o=[];let s=[],i=[],l=0,c=0,h=0;for(;c<e.length;){for(;e[c]instanceof Je;)e.splice(c,1,...e[c].children);const f=e[c];if(f.attributes&&f.attributes.linebreak&&f.attributes.linebreak==="newline"){i.length>0&&s.push(new p("mrow",i)),s.push(f),i=[];const k=new p("mtd",s);k.style.textAlign="left",o.push(new p("mtr",[k])),s=[],c+=1;continue}if(i.push(f),f.type&&f.type==="mo"&&f.children.length===1&&!Object.prototype.hasOwnProperty.call(f.attributes,"movablelimits")){const k=f.children[0].text;if(Gr.indexOf(k)>-1)h+=1;else if(Rr.indexOf(k)>-1)h-=1;else if(h===0&&t==="="&&k==="="){if(l+=1,l>1){i.pop();const x=new p("mrow",i);s.push(x),i=[f]}}else if(h===0&&t==="tex"&&k!=="∇"){const x=c<e.length-1?e[c+1]:null;let y=!0;if(!(x&&x.type==="mtext"&&x.attributes.linebreak&&x.attributes.linebreak==="nobreak"))for(let _=c+1;_<e.length;_++){const C=e[_];if(C.type&&C.type==="mspace"&&!(C.attributes.linebreak&&C.attributes.linebreak==="newline"))i.push(C),c+=1,C.attributes&&C.attributes.linebreak&&C.attributes.linebreak==="nobreak"&&(y=!1);else break}if(y){const _=new p("mrow",i);s.push(_),i=[]}}}c+=1}if(i.length>0){const f=new p("mrow",i);s.push(f)}if(o.length>0){const f=new p("mtd",s);f.style.textAlign="left";const k=new p("mtr",[f]);o.push(k);const x=new p("mtable",o);return r||(x.setAttribute("columnalign","left"),x.setAttribute("rowspacing","0em")),x}return ae(s)}const W=function(e,t,r){return P[t][e]&&P[t][e].replace&&e.charCodeAt(0)!==55349&&!(Object.prototype.hasOwnProperty.call(Pr,e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=P[t][e].replace),new j(e)},ht=(e,t)=>{if(e.children.length===0||e.children[e.children.length-1].type!=="mtext"){const r=new p("mtext",[new j(t.children[0].text)]);e.children.push(r)}else e.children[e.children.length-1].children[0].text+=t.children[0].text},$e=e=>{if(e.type!=="mrow"&&e.type!=="mstyle"||e.children.length===0)return e;const t=new p("mrow");for(let r=0;r<e.children.length;r++){const o=e.children[r];if(o.type==="mtext"&&Object.keys(o.attributes).length===0)ht(t,o);else if(o.type==="mrow"){let s=!0;for(let i=0;i<o.children.length;i++)if(o.children[i].type!=="mtext"||Object.keys(o.attributes).length!==0){s=!1;break}if(s)for(let i=0;i<o.children.length;i++){const l=o.children[i];ht(t,l)}else t.children.push(o)}else t.children.push(o)}for(let r=0;r<t.children.length;r++)if(t.children[r].type==="mtext"){const o=t.children[r];o.children[0].text.charAt(0)===" "&&(o.children[0].text=" "+o.children[0].text.slice(1));const s=o.children[0].text.length;s>0&&o.children[0].text.charAt(s-1)===" "&&(o.children[0].text=o.children[0].text.slice(0,-1)+" ");for(const[i,l]of Object.entries(e.attributes))o.attributes[i]=l}return t.children.length===1&&t.children[0].type==="mtext"?t.children[0]:t},Oe=function(e,t=!1){if(e.length===1&&!(e[0]instanceof Je))return e[0];if(!t){e[0]instanceof p&&e[0].type==="mo"&&!e[0].attributes.fence&&(e[0].attributes.lspace="0em",e[0].attributes.rspace="0em");const r=e.length-1;e[r]instanceof p&&e[r].type==="mo"&&!e[r].attributes.fence&&(e[r].attributes.lspace="0em",e[r].attributes.rspace="0em")}return new p("mrow",e)};function Ie(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){const t=e.children[0];return t instanceof j&&t.text==="."}else if(e.type==="mtext"&&e.children.length===1){const t=e.children[0];return t instanceof j&&t.text===""}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){const t=e.children[0];return t instanceof j&&t.text===","}else return!1}const Ur=(e,t)=>{const r=e[t],o=e[t+1];return r.type==="atom"&&r.text===","&&r.loc&&o.loc&&r.loc.end===o.loc.start},ve=e=>e.type==="atom"&&e.family==="rel"||e.type==="mclass"&&e.mclass==="mrel",U=function(e,t,r=!1){if(!r&&e.length===1){const l=E(e[0],t);return l instanceof p&&l.type==="mo"&&(l.setAttribute("lspace","0em"),l.setAttribute("rspace","0em")),[l]}const o=[],s=[];let i;for(let l=0;l<e.length;l++)s.push(E(e[l],t));for(let l=0;l<s.length;l++){const c=s[l];if(l<e.length-1&&ve(e[l])&&ve(e[l+1])&&c.setAttribute("rspace","0em"),l>0&&ve(e[l])&&ve(e[l-1])&&c.setAttribute("lspace","0em"),c.type==="mn"&&i&&i.type==="mn"){i.children.push(...c.children);continue}else if(Ie(c)&&i&&i.type==="mn"){i.children.push(...c.children);continue}else if(i&&i.type==="mn"&&l<s.length-1&&s[l+1].type==="mn"&&Ur(e,l)){i.children.push(...c.children);continue}else if(c.type==="mn"&&Ie(i))c.children=[...i.children,...c.children],o.pop();else if((c.type==="msup"||c.type==="msub")&&c.children.length>=1&&i&&(i.type==="mn"||Ie(i))){const h=c.children[0];h instanceof p&&h.type==="mn"&&i&&(h.children=[...i.children,...h.children],o.pop())}o.push(c),i=c}return o},ne=function(e,t,r=!1){return Oe(U(e,t,r),r)},E=function(e,t){if(!e)return new p("mrow");if(Te[e.type])return Te[e.type](e,t);throw new v("Got group of unknown type: '"+e.type+"'")},pt=e=>new p("mtd",[],[],{padding:"0",width:"50%"}),Vr=["mrow","mtd","mtable","mtr"],je=e=>{for(const t of e.children)if(t.type&&Vr.includes(t.type)){if(t.classes&&t.classes[0]==="tml-label")return t.label;{const r=je(t);if(r)return r}}else if(!t.type){const r=je(t);if(r)return r}},Wr=(e,t,r,o)=>{t=ne(t[0].body,r),t=$e(t),t.classes.push("tml-tag");const s=je(e);e=new p("mtd",[e]);const i=[pt(),e,pt()];i[o?0:2].children.push(t);const l=new p("mtr",i,["tml-tageqn"]);s&&l.setAttribute("id",s);const c=new p("mtable",[l]);return c.style.width="100%",c.setAttribute("displaystyle","true"),c};function Hr(e,t,r,o){let s=null;e.length===1&&e[0].type==="tag"&&(s=e[0].tag,e=e[0].body);const i=U(e,r);if(i.length===1&&i[0]instanceof Zt)return i[0];const l=o.displayMode||o.annotate?"none":o.wrap,c=i.length===0?null:i[0];let h=i.length===1&&s===null&&c instanceof p?i[0]:jr(i,l,o.displayMode);if(s&&(h=Wr(h,s,r,o.leqno)),o.annotate){const k=new p("annotation",[new j(t)]);k.setAttribute("encoding","application/x-tex"),h=new p("semantics",[h,k])}const f=new p("math",[h]);return o.xml&&f.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),o.displayMode&&(f.setAttribute("display","block"),f.style.display="block math",f.classes=["tml-display"]),f}const Zr="DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ",Xr="BCEGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ",Yr="AFJdfΔΛ",Yt=(e,t)=>{const r=e.isStretchy?Xt(e):new p("mo",[W(e.label,e.mode)]);e.isStretchy||r.setAttribute("stretchy","false"),e.label!=="\\vec"&&(r.style.mathDepth="0");const o=e.label==="\\c"?"munder":"mover",s=Jr.has(e.label);if(o==="mover"&&e.mode==="math"&&!e.isStretchy&&e.base.text&&e.base.text.length===1){const l=e.base.text,c=e.label==="\\vec",h=c==="\\vec"?"-vec":"";c&&r.classes.push("tml-vec");const f=c?"-vec":s?"-acc":"";Zr.indexOf(l)>-1?(r.classes.push(`chr-sml${h}`),r.classes.push(`wbk-sml${f}`)):Xr.indexOf(l)>-1?(r.classes.push(`chr-med${h}`),r.classes.push(`wbk-med${f}`)):Yr.indexOf(l)>-1?(r.classes.push(`chr-lrg${h}`),r.classes.push(`wbk-lrg${f}`)):c?r.classes.push("wbk-vec"):s&&r.classes.push("wbk-acc")}else s&&r.classes.push("wbk-acc");return new p(o,[E(e.base,t),r])},Kr=new Set(["\\acute","\\check","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"]),Jr=new Set(["\\acute","\\bar","\\breve","\\check","\\dot","\\ddot","\\grave","\\hat","\\mathring","\\`","\\'","\\^","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v"]),ft={"\\`":"̀","\\'":"́","\\^":"̂","\\~":"̃","\\=":"̄","\\u":"̆","\\.":"̇",'\\"':"̈","\\r":"̊","\\H":"̋","\\v":"̌","\\c":"̧"};S({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=pe(t[0]),o=!Kr.has(e.funcName);return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:o,base:r}},mathmlBuilder:Yt});S({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\c","\\u","\\.",'\\"',"\\r","\\H","\\v"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{const r=pe(t[0]),o=e.parser.mode;return o==="math"&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),o==="text"&&r.text&&r.text.length===1&&e.funcName in ft&&Vt.indexOf(r.text)>-1?{type:"textord",mode:"text",text:r.text+ft[e.funcName]}:e.funcName==="\\c"&&o==="text"&&r.text&&r.text.length===1?{type:"textord",mode:"text",text:r.text+"̧"}:{type:"accent",mode:o,label:e.funcName,isStretchy:!1,base:r}},mathmlBuilder:Yt});S({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underparen","\\utilde"],props:{numArgs:1},handler:({parser:e,funcName:t},r)=>{const o=r[0];return{type:"accentUnder",mode:e.mode,label:t,base:o}},mathmlBuilder:(e,t)=>{const r=Xt(e);return r.style["math-depth"]=0,new p("munder",[E(e.base,t),r])}});const gt={pt:800/803,pc:12*800/803,dd:1238/1157*800/803,cc:14856/1157*800/803,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},Qr=["em","ex","mu","pt","mm","cm","in","px","bp","pc","dd","cc","nd","nc","sp"],Kt=function(e){return typeof e!="string"&&(e=e.unit),Qr.indexOf(e)>-1},Jt=e=>{const t=Math.max(e-1,0);return[1,.7,.5][t]},Q=function(e,t){let r=e.number;if(t.maxSize[0]<0&&r>0)return{number:0,unit:"em"};const o=e.unit;switch(o){case"mm":case"cm":case"in":case"px":return r*gt[o]>t.maxSize[1]?{number:t.maxSize[1],unit:"pt"}:{number:r,unit:o};case"em":case"ex":return o==="ex"&&(r*=.431),r=Math.min(r/Jt(t.level),t.maxSize[0]),{number:Fe(r),unit:"em"};case"bp":return r>t.maxSize[1]&&(r=t.maxSize[1]),{number:r,unit:"pt"};case"pt":case"pc":case"dd":case"cc":case"nd":case"nc":case"sp":return r=Math.min(r*gt[o],t.maxSize[1]),{number:Fe(r),unit:"pt"};case"mu":return r=Math.min(r/18,t.maxSize[0]),{number:Fe(r),unit:"em"};default:throw new v("Invalid unit: '"+o+"'")}},N=e=>{const t=new p("mspace");return t.setAttribute("width",e+"em"),t},ke=(e,t=.3,r=0,o=!1)=>{if(e==null&&r===0)return N(t);const s=e?[e]:[];if(t!==0&&s.unshift(N(t)),r>0&&s.push(N(r)),o){const i=new p("mpadded",s);return i.setAttribute("height","0.1px"),i}else return new p("mrow",s)},Ne=(e,t)=>Number(e)/Jt(t),Ue=(e,t,r,o)=>{const s=et(e),i=e.slice(1,3)==="eq",l=e.charAt(1)==="x"?"1.75":e.slice(2,4)==="cd"?"3.0":i?"1.0":"2.0";s.setAttribute("lspace","0"),s.setAttribute("rspace",i?"0.5em":"0");const c=o.withLevel(o.level<2?2:3),h=Ne(l,c.level),f=Ne(l,3),k=ke(null,h.toFixed(4),0),x=ke(null,f.toFixed(4),0),y=Ne(i?0:.3,c.level).toFixed(4);let _,C;const z=t&&t.body&&(t.body.body||t.body.length>0);if(z){let $=E(t,c);$=ke($,y,y,e==="\\\\cdrightarrow"||e==="\\\\cdleftarrow"),_=new p("mover",[$,x])}const F=r&&r.body&&(r.body.body||r.body.length>0);if(F){let $=E(r,c);$=ke($,y,y),C=new p("munder",[$,x])}let T;return!z&&!F?T=new p("mover",[s,k]):z&&F?T=new p("munderover",[s,C,_]):z?T=new p("mover",[s,_]):T=new p("munder",[s,C]),l==="3.0"&&(T.style.height="1em"),T.setAttribute("accent","false"),T};S({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xleftrightharpoons","\\xrightleftharpoons","\\yields","\\yieldsLeft","\\mesomerism","\\longrightharpoonup","\\longleftharpoondown","\\yieldsLeftRight","\\chemequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},r,o){return{type:"xArrow",mode:e.mode,name:t,body:r[0],below:o[0]}},mathmlBuilder(e,t){const o=[Ue(e.name,e.body,e.below,t)];return o.unshift(N(.2778)),o.push(N(.2778)),new p("mrow",o)}});const bt={"\\equilibriumRight":["\\longrightharpoonup","\\eqleftharpoondown"],"\\equilibriumLeft":["\\eqrightharpoonup","\\longleftharpoondown"]};S({type:"stackedArrow",names:["\\equilibriumRight","\\equilibriumLeft"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},r,o){const s=r[0]?{type:"hphantom",mode:e.mode,body:r[0]}:null,i=o[0]?{type:"hphantom",mode:e.mode,body:o[0]}:null;return{type:"stackedArrow",mode:e.mode,name:t,body:r[0],upperArrowBelow:i,lowerArrowBody:s,below:o[0]}},mathmlBuilder(e,t){const r=bt[e.name][0],o=bt[e.name][1],s=Ue(r,e.body,e.upperArrowBelow,t),i=Ue(o,e.lowerArrowBody,e.below,t);let l;const c=new p("mpadded",[s]);if(c.setAttribute("voffset","0.3em"),c.setAttribute("height","+0.3em"),c.setAttribute("depth","-0.3em"),e.name==="\\equilibriumLeft"){const h=new p("mpadded",[i]);h.setAttribute("width","0.5em"),l=new p("mpadded",[N(.2778),h,c,N(.2778)])}else c.setAttribute("width",e.name==="\\equilibriumRight"?"0.5em":"0"),l=new p("mpadded",[N(.2778),c,i,N(.2778)]);return l.setAttribute("voffset","-0.18em"),l.setAttribute("height","-0.18em"),l.setAttribute("depth","+0.18em"),l}});const Qt={};function Z({type:e,names:t,props:r,handler:o,mathmlBuilder:s}){const i={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:o};for(let l=0;l<t.length;++l)Qt[t[l]]=i;s&&(Te[e]=s)}function D(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 tt(e){const t=Ee(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 Ee(e){return e&&(e.type==="atom"||Object.prototype.hasOwnProperty.call(Mr,e.type))?e:null}const en={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},xt=()=>({type:"styling",body:[],mode:"math",scriptLevel:"display"}),yt=e=>e.type==="textord"&&e.text==="@",tn=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function rn(e,t,r){const o=en[e];switch(o){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(o,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{const s=r.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:o,mode:"math",family:"rel"},l=r.callFunction("\\Big",[i],[]),c=r.callFunction("\\\\cdright",[t[1]],[]),h={type:"ordgroup",mode:"math",body:[s,l,c],semisimple:!0};return r.callFunction("\\\\cdparent",[h],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{const s={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[s],[])}default:return{type:"textord",text:" ",mode:"math"}}}function nn(e){const t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();const s=e.fetch().text;if(s==="&"||s==="\\\\")e.consume();else if(s==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new v("Expected \\\\ or \\cr or \\end",e.nextToken)}let r=[];const o=[r];for(let s=0;s<t.length;s++){const i=t[s];let l=xt();for(let c=0;c<i.length;c++)if(!yt(i[c]))l.body.push(i[c]);else{r.push(l),c+=1;const h=tt(i[c]).text,f=new Array(2);if(f[0]={type:"ordgroup",mode:"math",body:[]},f[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(h)>-1))if("<>AV".indexOf(h)>-1)for(let x=0;x<2;x++){let y=!0;for(let _=c+1;_<i.length;_++){if(tn(i[_],h)){y=!1,c=_;break}if(yt(i[_]))throw new v("Missing a "+h+" character to complete a CD arrow.",i[_]);f[x].body.push(i[_])}if(y)throw new v("Missing a "+h+" character to complete a CD arrow.",i[c])}else throw new v('Expected one of "<>AV=|." after @.');const k=rn(h,f,e);r.push(k),l=xt()}s%2===0?r.push(l):r.shift(),r=[],o.push(r)}return o.pop(),e.gullet.endGroup(),e.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([])}}S({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler({parser:e,funcName:t},r){return{type:"cdlabel",mode:e.mode,side:t.slice(4),label:r[0]}},mathmlBuilder(e,t){if(e.label.body.length===0)return new p("mrow",t);const r=E(e.label,t);e.side==="left"&&r.classes.push("tml-shift-left");const o=new p("mtd",[r]);o.style.padding="0";const s=new p("mtr",[o]),i=new p("mtable",[s]),l=new p("mpadded",[i]);return l.setAttribute("width","0.1px"),l.setAttribute("displaystyle","false"),l.setAttribute("scriptlevel","1"),l}});S({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler({parser:e},t){return{type:"cdlabelparent",mode:e.mode,fragment:t[0]}},mathmlBuilder(e,t){return new p("mrow",[E(e.fragment,t)])}});const er=e=>({type:"ordgroup",mode:"math",body:e,semisimple:!0}),Me=(e,t)=>({type:t,mode:"math",body:er(e)}),on=(e,t)=>{const r=e.body;r[0].shift();const o=new Array(r.length-1).fill().map(()=>[]);for(let x=1;x<r.length;x++){o[x-1].push(r[x].shift());const y=[];for(let _=0;_<r[x].length;_++)y.push(r[x][_]);o[x-1].push(Me(y,"vphantom"))}const s=new Array(r.length).fill().map(()=>[]);for(let x=0;x<r[0].length;x++)s[0].push(r[0][x]);for(let x=1;x<r.length;x++)for(let y=0;y<r[0].length;y++)s[x].push(Me(r[x][y].body,"hphantom"));for(let x=0;x<r[0].length;x++)r[0][x]=Me(r[0][x].body,"hphantom");const i={type:"array",mode:"math",body:o,cols:[{type:"align",align:"c"}],rowGaps:new Array(o.length-1).fill(null),hLinesBeforeRow:new Array(o.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(o.length).fill(""),arraycolsep:{number:.04,unit:"em"}},c={type:"styling",mode:"math",scriptLevel:"text",body:[{type:"array",mode:"math",body:s,cols:new Array(s.length).fill({type:"align",align:"c"}),rowGaps:new Array(s.length-1).fill(null),hLinesBeforeRow:new Array(s.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(s.length).fill(""),arraycolsep:null}]},k={type:"supsub",mode:"math",stack:!0,base:{type:"op",mode:"math",limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!0,symbol:!1,suppressBaseShift:!0,body:[{type:"leftright",mode:"math",body:[e],left:t?t[0]:"(",right:t?t[1]:")",rightColor:void 0}]},sup:c,sub:null};return er([i,k])};class V{constructor(t,r,o){this.lexer=t,this.start=r,this.end=o}static range(t,r){return r?!t||!t.loc||!r.loc||t.loc.lexer!==r.loc.lexer?null:new V(t.loc.lexer,t.loc.start,r.loc.end):t&&t.loc}}class J{constructor(t,r){this.text=t,this.loc=r}range(t,r){return new J(r,V.range(this,t))}}const M={DISPLAY:0,TEXT:1,SCRIPT:2,SCRIPTSCRIPT:3},tr={};function u(e,t){tr[e]=t}const an=tr;u("\\noexpand",function(e){const t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});u("\\expandafter",function(e){const t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});u("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}});u("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}});u("\\@ifnextchar",function(e){const t=e.consumeArgs(3);e.consumeSpaces();const r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});u("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");u("\\TextOrMath",function(e){const t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});const Ve=e=>{let t="";for(let r=e.length-1;r>-1;r--)t+=e[r].text;return t},rt={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},wt=e=>{const t=e.future().text;return t==="EOF"?[null,""]:[rt[t.charAt(0)],t]},vt=(e,t,r)=>{for(let o=1;o<t.length;o++){const s=rt[t.charAt(o)];e*=r,e+=s}return e};u("\\char",function(e){let t=e.popToken(),r,o="";if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")o=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new v("\\char` missing argument");o=t.text.charCodeAt(0)}else r=10;if(r){let s=t.text;if(o=rt[s.charAt(0)],o==null||o>=r)throw new v(`Invalid base-${r} digit ${t.text}`);o=vt(o,s,r);let i;for([i,s]=wt(e);i!=null&&i<r;)o*=r,o+=i,o=vt(o,s,r),e.popToken(),[i,s]=wt(e)}return`\\@char{${o}}`});function nt(e){const t=e.consumeArgs(1)[0];let r="",o=t[t.length-1].loc.start;for(let s=t.length-1;s>=0;s--){const i=t[s].loc.start;i>o&&(r+=" ",o=i),r+=t[s].text,o+=t[s].text.length}return r}u("\\surd","\\sqrt{\\vphantom{|}}");u("⊕","\\oplus");u("\\long","");u("\\bgroup","{");u("\\egroup","}");u("~","\\nobreakspace");u("\\lq","`");u("\\rq","'");u("\\aa","\\r a");u("\\Bbbk","\\Bbb{k}");u("\\mathstrut","\\vphantom{(}");u("\\underbar","\\underline{\\text{#1}}");u("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");u("⋮","\\vdots");u("\\arraystretch","1");u("\\arraycolsep","6pt");u("\\substack","\\begin{subarray}{c}#1\\end{subarray}");u("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");u("\\implies","\\DOTSB\\;\\Longrightarrow\\;");u("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");const kt={",":"\\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","\\DOTSX":"\\dotsx"};u("\\dots",function(e){let t="\\dotso";const r=e.expandAfterFuture().text;return r in kt?t=kt[r]:(r.slice(0,4)==="\\not"||r in P.math&&["bin","rel"].includes(P.math[r].group))&&(t="\\dotsb"),t});const ot={")":!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};u("\\dotso",function(e){return e.future().text in ot?"\\ldots\\,":"\\ldots"});u("\\dotsc",function(e){const t=e.future().text;return t in ot&&t!==","?"\\ldots\\,":"\\ldots"});u("\\cdots",function(e){return e.future().text in ot?"\\@cdots\\,":"\\@cdots"});u("\\dotsb","\\cdots");u("\\dotsm","\\cdots");u("\\dotsi","\\!\\cdots");u("\\idotsint","\\int\\!\\cdots\\!\\int");u("\\dotsx","\\ldots\\,");u("\\DOTSI","\\relax");u("\\DOTSB","\\relax");u("\\DOTSX","\\relax");u("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");u("\\,","{\\tmspace+{3mu}{.1667em}}");u("\\thinspace","\\,");u("\\>","\\mskip{4mu}");u("\\:","{\\tmspace+{4mu}{.2222em}}");u("\\medspace","\\:");u("\\;","{\\tmspace+{5mu}{.2777em}}");u("\\thickspace","\\;");u("\\!","{\\tmspace-{3mu}{.1667em}}");u("\\negthinspace","\\!");u("\\negmedspace","{\\tmspace-{4mu}{.2222em}}");u("\\negthickspace","{\\tmspace-{5mu}{.277em}}");u("\\enspace","\\kern.5em ");u("\\enskip","\\hskip.5em\\relax");u("\\quad","\\hskip1em\\relax");u("\\qquad","\\hskip2em\\relax");u("\\AA","\\TextOrMath{\\Angstrom}{\\mathring{A}}\\relax");u("\\tag","\\@ifstar\\tag@literal\\tag@paren");u("\\tag@paren","\\tag@literal{({#1})}");u("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new v("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});u("\\notag","\\nonumber");u("\\nonumber","\\gdef\\@eqnsw{0}");u("\\bmod","\\mathbin{\\text{mod}}");u("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");u("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");u("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");u("\\newline","\\\\\\relax");u("\\TeX","\\textrm{T}\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125em\\textrm{X}");u("\\LaTeX","\\textrm{L}\\kern-.35em\\raisebox{0.2em}{\\scriptstyle A}\\kern-.15em\\TeX");u("\\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}}");u("\\hspace","\\@ifstar\\@hspacer\\@hspace");u("\\@hspace","\\hskip #1\\relax");u("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");u("\\colon",'\\mathpunct{\\char"3a}');u("\\prescript","\\pres@cript{_{#1}^{#2}}{}{#3}");u("\\ordinarycolon",'\\char"3a');u("\\vcentcolon","\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}}");u("\\coloneq",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2212}');u("\\Coloneq",'\\mathrel{\\char"2237\\char"2212}');u("\\Eqqcolon",'\\mathrel{\\char"3d\\char"2237}');u("\\Eqcolon",'\\mathrel{\\char"2212\\char"2237}');u("\\colonapprox",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2248}');u("\\Colonapprox",'\\mathrel{\\char"2237\\char"2248}');u("\\colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}');u("\\Colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}');u("\\ratio","\\vcentcolon");u("\\coloncolon","\\dblcolon");u("\\colonequals","\\coloneqq");u("\\coloncolonequals","\\Coloneqq");u("\\equalscolon","\\eqqcolon");u("\\equalscoloncolon","\\Eqqcolon");u("\\colonminus","\\coloneq");u("\\coloncolonminus","\\Coloneq");u("\\minuscolon","\\eqcolon");u("\\minuscoloncolon","\\Eqcolon");u("\\coloncolonapprox","\\Colonapprox");u("\\coloncolonsim","\\Colonsim");u("\\notni","\\mathrel{\\char`∌}");u("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");u("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");u("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");u("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");u("\\varlimsup","\\DOTSB\\operatorname*{\\overline{\\text{lim}}}");u("\\varliminf","\\DOTSB\\operatorname*{\\underline{\\text{lim}}}");u("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{\\text{lim}}}");u("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{\\text{lim}}}");u("\\centerdot","{\\medspace\\rule{0.167em}{0.189em}\\medspace}");u("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");u("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");u("\\plim","\\DOTSB\\operatorname*{plim}");u("\\leftmodels","\\mathop{\\reflectbox{$\\models$}}");u("\\bra","\\mathinner{\\langle{#1}|}");u("\\ket","\\mathinner{|{#1}\\rangle}");u("\\braket","\\mathinner{\\langle{#1}\\rangle}");u("\\Bra","\\left\\langle#1\\right|");u("\\Ket","\\left|#1\\right\\rangle");const rr=(e,t)=>{const o=`}\\,\\middle${t[0]==="|"?"\\vert":"\\Vert"}\\,{`;return e.slice(0,t.index)+o+e.slice(t.index+t[0].length)};u("\\Braket",function(e){let t=nt(e);const r=/\|\||\||\\\|/g;let o;for(;(o=r.exec(t))!==null;)t=rr(t,o);return"\\left\\langle{"+t+"}\\right\\rangle"});u("\\Set",function(e){let t=nt(e);const r=/\|\||\||\\\|/.exec(t);return r&&(t=rr(t,r)),"\\left\\{\\:{"+t+"}\\:\\right\\}"});u("\\set",function(e){return"\\{{"+nt(e).replace(/\|/,"}\\mid{")+"}\\}"});u("\\angln","{\\angl n}");u("\\odv","\\@ifstar\\odv@next\\odv@numerator");u("\\odv@numerator","\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}");u("\\odv@next","\\frac{\\mathrm{d}}{\\mathrm{d}#2}#1");u("\\pdv","\\@ifstar\\pdv@next\\pdv@numerator");const nr=e=>{const t=e[0][0].text,r=Ve(e[1]).split(","),o=String(r.length),s=o==="1"?"\\partial":`\\partial^${o}`;let i="";return r.map(l=>{i+="\\partial "+l.trim()+"\\,"}),[t,s,i.replace(/\\,$/,"")]};u("\\pdv@numerator",function(e){const[t,r,o]=nr(e.consumeArgs(2));return`\\frac{${r} ${t}}{${o}}`});u("\\pdv@next",function(e){const[t,r,o]=nr(e.consumeArgs(2));return`\\frac{${r}}{${o}} ${t}`});u("\\upalpha","\\up@greek{\\alpha}");u("\\upbeta","\\up@greek{\\beta}");u("\\upgamma","\\up@greek{\\gamma}");u("\\updelta","\\up@greek{\\delta}");u("\\upepsilon","\\up@greek{\\epsilon}");u("\\upzeta","\\up@greek{\\zeta}");u("\\upeta","\\up@greek{\\eta}");u("\\uptheta","\\up@greek{\\theta}");u("\\upiota","\\up@greek{\\iota}");u("\\upkappa","\\up@greek{\\kappa}");u("\\uplambda","\\up@greek{\\lambda}");u("\\upmu","\\up@greek{\\mu}");u("\\upnu","\\up@greek{\\nu}");u("\\upxi","\\up@greek{\\xi}");u("\\upomicron","\\up@greek{\\omicron}");u("\\uppi","\\up@greek{\\pi}");u("\\upalpha","\\up@greek{\\alpha}");u("\\uprho","\\up@greek{\\rho}");u("\\upsigma","\\up@greek{\\sigma}");u("\\uptau","\\up@greek{\\tau}");u("\\upupsilon","\\up@greek{\\upsilon}");u("\\upphi","\\up@greek{\\phi}");u("\\upchi","\\up@greek{\\chi}");u("\\uppsi","\\up@greek{\\psi}");u("\\upomega","\\up@greek{\\omega}");u("\\invamp",'\\mathbin{\\char"214b}');u("\\parr",'\\mathbin{\\char"214b}');u("\\with",'\\mathbin{\\char"26}');u("\\multimapinv",'\\mathrel{\\char"27dc}');u("\\multimapboth",'\\mathrel{\\char"29df}');u("\\scoh",'{\\mkern5mu\\char"2322\\mkern5mu}');u("\\sincoh",'{\\mkern5mu\\char"2323\\mkern5mu}');u("\\coh",`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2322}}}
{\\smash{\\lower4mu{\\char"2323}}}\\mkern5mu}`);u("\\incoh",`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2323}}}
{\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}`);u("\\standardstate","\\text{\\tiny\\char`⦵}");u("\\ce",function(e){return or(e.consumeArgs(1)[0],"ce")});u("\\pu",function(e){return or(e.consumeArgs(1)[0],"pu")});u("\\uniDash","{\\rule{0.672em}{0.06em}}");u("\\triDash","{\\rule{0.15em}{0.06em}\\kern2mu\\rule{0.15em}{0.06em}\\kern2mu\\rule{0.15em}{0.06em}}");u("\\tripleDash","\\kern0.075em\\raise0.25em{\\triDash}\\kern0.075em");u("\\tripleDashOverLine","\\kern0.075em\\mathrlap{\\raise0.125em{\\uniDash}}\\raise0.34em{\\triDash}\\kern0.075em");u("\\tripleDashOverDoubleLine","\\kern0.075em\\mathrlap{\\mathrlap{\\raise0.48em{\\triDash}}\\raise0.27em{\\uniDash}}{\\raise0.05em{\\uniDash}}\\kern0.075em");u("\\tripleDashBetweenDoubleLine","\\kern0.075em\\mathrlap{\\mathrlap{\\raise0.48em{\\uniDash}}\\raise0.27em{\\triDash}}{\\raise0.05em{\\uniDash}}\\kern0.075em");var or=function(e,t){for(var r="",o=e.length&&e[e.length-1].loc.start,s=e.length-1;s>=0;s--)e[s].loc.start>o&&(r+=" ",o=e[s].loc.start),r+=e[s].text,o+=e[s].text.length;var i=L.go(w.go(r,t));return i},w={go:function(e,t){if(!e)return[];t===void 0&&(t="ce");var r="0",o={};o.parenthesisLevel=0,e=e.replace(/\n/g," "),e=e.replace(/[\u2212\u2013\u2014\u2010]/g,"-"),e=e.replace(/[\u2026]/g,"...");for(var s,i=10,l=[];;){s!==e?(i=10,s=e):i--;var c=w.stateMachines[t],h=c.transitions[r]||c.transitions["*"];e:for(var f=0;f<h.length;f++){var k=w.patterns.match_(h[f].pattern,e);if(k){for(var x=h[f].task,y=0;y<x.action_.length;y++){var _;if(c.actions[x.action_[y].type_])_=c.actions[x.action_[y].type_](o,k.match_,x.action_[y].option);else if(w.actions[x.action_[y].type_])_=w.actions[x.action_[y].type_](o,k.match_,x.action_[y].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+x.action_[y].type_+")"];w.concatArray(l,_)}if(r=x.nextState||r,e.length>0){if(x.revisit||(e=k.remainder),!x.toContinue)break e}else return l}}if(i<=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=w.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 w.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return w.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return w.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return w.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return w.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return w.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return w.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return w.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return w.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return w.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return w.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return w.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return w.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 w.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return w.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return w.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return w.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 w.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return w.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return w.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return w.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return w.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return w.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return w.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return w.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))/),t)return{match_:t[0],remainder:e.substr(t[0].length)};var r=w.patterns.findObserveGroups(e,"","$","$","");return r&&(t=r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),t)?{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,o,s,i,l,c,h,f){var k=function(T,$){if(typeof $=="string")return T.indexOf($)!==0?null:$;var Y=T.match($);return Y?Y[0]:null},x=function(T,$,Y){for(var H=0;$<T.length;){var le=T.charAt($),ue=k(T.substr($),Y);if(ue!==null&&H===0)return{endMatchBegin:$,endMatchEnd:$+ue.length};if(le==="{")H++;else if(le==="}"){if(H===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];H--}$++}return H>0,null},y=k(e,t);if(y===null||(e=e.substr(y.length),y=k(e,r),y===null))return null;var _=x(e,y.length,o||s);if(_===null)return null;var C=e.substring(0,o?_.endMatchEnd:_.endMatchBegin);if(i||l){var z=this.findObserveGroups(e.substr(_.endMatchEnd),i,l,c,h);if(z===null)return null;var F=[C,z.match_];return{match_:f?F.join(""):F,remainder:z.remainder}}else return{match_:C,remainder:e.substr(_.endMatchEnd)}},match_:function(e,t){var r=w.patterns.patterns[e];if(r===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if(typeof r=="function")return w.patterns.patterns[e](t);var o=t.match(r);if(o){var s;return o[2]?s=[o[1],o[2]]:o[1]?s=o[1]:s=o[0],{match_:s,remainder:t.substr(o[0].length)}}return 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 w.go(t,"text")},"{text}":function(e,t){var r=["{"];return w.concatArray(r,w.go(t,"text")),r.push("}"),r},"tex-math":function(e,t){return w.go(t,"tex-math")},"tex-math tight":function(e,t){return w.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 w.go(t)},"1/2":function(e,t){var r=[];t.match(/^[+\-]/)&&(r.push(t.substr(0,1)),t=t.substr(1));var o=t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return o[1]=o[1].replace(/\$/g,""),r.push({type_:"frac",p1:o[1],p2:o[2]}),o[3]&&(o[3]=o[3].replace(/\$/g,""),r.push({type_:"tex-math",p1:o[3]})),r},"9,9":function(e,t){return w.go(t,"9,9")}},createTransitions:function(e){var t,r,o,s,i={};for(t in e)for(r in e[t])for(o=r.split("|"),e[t][r].stateArray=o,s=0;s<o.length;s++)i[o[s]]=[];for(t in e)for(r in e[t])for(o=e[t][r].stateArray||[],s=0;s<o.length;s++){var l=e[t][r];if(l.action_){l.action_=[].concat(l.action_);for(var c=0;c<l.action_.length;c++)typeof l.action_[c]=="string"&&(l.action_[c]={type_:l.action_[c]})}else l.action_=[];for(var h=t.split("|"),f=0;f<h.length;f++)if(o[s]==="*")for(var k in i)i[k].push({pattern:h[f],task:l});else i[o[s]].push({pattern:h[f],task:l})}return i},stateMachines:{}};w.stateMachines={ce:{transitions:w.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 o=e.d;e.d=void 0,r=this.output(e),e.b=o}else r=this.output(e);return w.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 w.concatArray(r,this.output(e)),w.concatArray(r,w.actions.bond(e,t,"-")),r}else e.d=t},"- after o/d":function(e,t,r){var o=w.patterns.match_("orbital",e.o||""),s=w.patterns.match_("one lowercase greek letter $",e.o||""),i=w.patterns.match_("one lowercase latin letter $",e.o||""),l=w.patterns.match_("$one lowercase latin letter$ $",e.o||""),c=t==="-"&&(o&&o.remainder===""||s||i||l);c&&!e.a&&!e.b&&!e.p&&!e.d&&!e.q&&!o&&i&&(e.o="$"+e.o+"$");var h=[];return c?(w.concatArray(h,this.output(e)),h.push({type_:"hyphen"})):(o=w.patterns.match_("digits",e.d||""),r&&o&&o.remainder===""?(w.concatArray(h,w.actions["d="](e,t)),w.concatArray(h,this.output(e))):(w.concatArray(h,this.output(e)),w.concatArray(h,w.actions.bond(e,t,"-")))),h},"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:w.go(t,"o")}},comma:function(e,t){var r=t.replace(/\s*$/,""),o=r!==t;return o&&e.parenthesisLevel===0?{type_:"comma enumeration L",p1:r}:{type_:"comma enumeration M",p1:r}},output:function(e,t,r){var o;if(!e.r)o=[],!e.a&&!e.b&&!e.p&&!e.o&&!e.q&&!e.d&&!r||(e.sb&&o.push({type_:"entitySkip"}),!e.o&&!e.q&&!e.d&&!e.b&&!e.p&&r!==2?(e.o=e.a,e.a=void 0):!e.o&&!e.q&&!e.d&&(e.b||e.p)?(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):e.o&&e.dType==="kv"&&w.patterns.match_("d-oxidation$",e.d||"")?e.dType="oxidation":e.o&&e.dType==="kv"&&!e.q&&(e.dType=void 0),o.push({type_:"chemfive",a:w.go(e.a,"a"),b:w.go(e.b,"bd"),p:w.go(e.p,"pq"),o:w.go(e.o,"o"),q:w.go(e.q,"pq"),d:w.go(e.d,e.dType==="oxidation"?"oxidation":"bd"),dType:e.dType}));else{var s;e.rdt==="M"?s=w.go(e.rd,"tex-math"):e.rdt==="T"?s=[{type_:"text",p1:e.rd||""}]:s=w.go(e.rd);var i;e.rqt==="M"?i=w.go(e.rq,"tex-math"):e.rqt==="T"?i=[{type_:"text",p1:e.rq||""}]:i=w.go(e.rq),o={type_:"arrow",r:e.r,rd:s,rq:i}}for(var l in e)l!=="parenthesisLevel"&&l!=="beginsWithBond"&&delete e[l];return o},"oxidation-output":function(e,t){var r=["{"];return w.concatArray(r,w.go(t,"oxidation")),r.push("}"),r},"frac-output":function(e,t){return{type_:"frac-ce",p1:w.go(t[0]),p2:w.go(t[1])}},"overset-output":function(e,t){return{type_:"overset",p1:w.go(t[0]),p2:w.go(t[1])}},"underset-output":function(e,t){return{type_:"underset",p1:w.go(t[0]),p2:w.go(t[1])}},"underbrace-output":function(e,t){return{type_:"underbrace",p1:w.go(t[0]),p2:w.go(t[1])}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:w.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:w.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:w.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:w.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:w.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:w.go(t,"o")}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:w.go(t[1],"pq")}}}},bd:{transitions:w.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:w.go(t[1],"bd")}}}},oxidation:{transitions:w.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:w.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:w.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:w.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:w.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]&&(w.concatArray(r,w.go(t[1],"pu-9,9")),t[2]&&(t[2].match(/[,.]/)?w.concatArray(r,w.go(t[2],"pu-9,9")):r.push(t[2])),t[3]=t[4]||t[3],t[3]&&(t[3]=t[3].trim(),t[3]==="e"||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]),w.concatArray(r,w.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=w.patterns.match_("{(...)}",e.d||"");r&&r.remainder===""&&(e.d=r.match_);var o=w.patterns.match_("{(...)}",e.q||"");if(o&&o.remainder===""&&(e.q=o.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 s={d:w.go(e.d,"pu"),q:w.go(e.q,"pu")};e.o==="//"?t={type_:"pu-frac",p1:s.d,p2:s.q}:(t=s.d,s.d.length>1||s.q.length>1?t.push({type_:" / "}):t.push({type_:"/"}),w.concatArray(t,s.q))}else t=w.go(e.d,"pu-2");for(var i in e)delete e[i];return t}}},"pu-2":{transitions:w.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=w.patterns.match_("{(...)}",e.rm||"");r&&r.remainder===""?t=w.go(r.match_,"pu"):t={type_:"rm",p1:e.rm}}for(var o in e)delete e[o];return t}}},"pu-9,9":{transitions:w.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;r===0&&(r=3);for(var o=e.text_.length-3;o>0;o-=3)t.push(e.text_.substr(o,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(0,r)),t.reverse()}else t.push(e.text_);for(var s in e)delete e[s];return t},"output-o":function(e){var t=[];if(e.text_=e.text_||"",e.text_.length>4){for(var r=e.text_.length-3,o=0;o<r;o+=3)t.push(e.text_.substr(o,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(o))}else t.push(e.text_);for(var s in e)delete e[s];return t}}}};var L={go:function(e,t){if(!e)return"";for(var r="",o=!1,s=0;s<e.length;s++){var i=e[s];typeof i=="string"?r+=i:(r+=L._go2(i),i.type_==="1st-level escape"&&(o=!0))}return!t&&!o&&r&&(r="{"+r+"}"),r},_goInner:function(e){return e&&L.go(e,!0)},_go2:function(e){var t;switch(e.type_){case"chemfive":t="";var r={a:L._goInner(e.a),b:L._goInner(e.b),p:L._goInner(e.p),o:L._goInner(e.o),q:L._goInner(e.q),d:L._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),e.dType==="kv"?((r.d||r.q)&&(t+="{\\vphantom{X}}"),r.d&&(t+="^{"+r.d+"}"),r.q&&(t+="_{"+r.q+"}")):e.dType==="oxidation"?(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":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"roman numeral":t="\\mathrm{"+e.p1+"}";break;case"state of aggregation":t="\\mskip2mu "+L._goInner(e.p1);break;case"state of aggregation subscript":t="\\mskip1mu "+L._goInner(e.p1);break;case"bond":if(t=L._getBond(e.kind_),!t)throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+e.kind_+")"];break;case"frac":var o="\\frac{"+e.p1+"}{"+e.p2+"}";t="\\mathchoice{\\textstyle"+o+"}{"+o+"}{"+o+"}{"+o+"}";break;case"pu-frac":var s="\\frac{"+L._goInner(e.p1)+"}{"+L._goInner(e.p2)+"}";t="\\mathchoice{\\textstyle"+s+"}{"+s+"}{"+s+"}{"+s+"}";break;case"tex-math":t=e.p1+" ";break;case"frac-ce":t="\\frac{"+L._goInner(e.p1)+"}{"+L._goInner(e.p2)+"}";break;case"overset":t="\\overset{"+L._goInner(e.p1)+"}{"+L._goInner(e.p2)+"}";break;case"underset":t="\\underset{"+L._goInner(e.p1)+"}{"+L._goInner(e.p2)+"}";break;case"underbrace":t="\\underbrace{"+L._goInner(e.p1)+"}_{"+L._goInner(e.p2)+"}";break;case"color":t="{\\color{"+e.color1+"}{"+L._goInner(e.color2)+"}}";break;case"color0":t="\\color{"+e.color+"}";break;case"arrow":var i={rd:L._goInner(e.rd),rq:L._goInner(e.rq)},l=L._getArrow(e.r);i.rq&&(l+="[{\\rm "+i.rq+"}]"),i.rd?l+="{\\rm "+i.rd+"}":l+="{}",t=l;break;case"operator":t=L._getOperator(e.kind_);break;case"1st-level escape":t=e.p1+" ";break;case"space":t=" ";break;case"entitySkip":t="~";break;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"->":return"\\yields";case"→":return"\\yields";case"⟶":return"\\yields";case"<-":return"\\yieldsLeft";case"<->":return"\\mesomerism";case"<-->":return"\\yieldsLeftRight";case"<=>":return"\\chemequilibrium";case"⇌":return"\\chemequilibrium";case"<=>>":return"\\equilibriumRight";case"<<=>":return"\\equilibriumLeft";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(e){switch(e){case"-":return"{-}";case"1":return"{-}";case"=":return"{=}";case"2":return"{=}";case"#":return"{\\equiv}";case"3":return"{\\equiv}";case"~":return"{\\tripleDash}";case"~-":return"{\\tripleDashOverLine}";case"~=":return"{\\tripleDashOverDoubleLine}";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":return" {}\\approx{} ";case"$\\approx$":return" {}\\approx{} ";case"v":return" \\downarrow{} ";case"(v)":return" \\downarrow{} ";case"^":return" \\uparrow{} ";case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};u("\\darr","\\downarrow");u("\\dArr","\\Downarrow");u("\\Darr","\\Downarrow");u("\\lang","\\langle");u("\\rang","\\rangle");u("\\uarr","\\uparrow");u("\\uArr","\\Uparrow");u("\\Uarr","\\Uparrow");u("\\N","\\mathbb{N}");u("\\R","\\mathbb{R}");u("\\Z","\\mathbb{Z}");u("\\alef","\\aleph");u("\\alefsym","\\aleph");u("\\bull","\\bullet");u("\\clubs","\\clubsuit");u("\\cnums","\\mathbb{C}");u("\\Complex","\\mathbb{C}");u("\\Dagger","\\ddagger");u("\\diamonds","\\diamondsuit");u("\\empty","\\emptyset");u("\\exist","\\exists");u("\\harr","\\leftrightarrow");u("\\hArr","\\Leftrightarrow");u("\\Harr","\\Leftrightarrow");u("\\hearts","\\heartsuit");u("\\image","\\Im");u("\\infin","\\infty");u("\\isin","\\in");u("\\larr","\\leftarrow");u("\\lArr","\\Leftarrow");u("\\Larr","\\Leftarrow");u("\\lrarr","\\leftrightarrow");u("\\lrArr","\\Leftrightarrow");u("\\Lrarr","\\Leftrightarrow");u("\\natnums","\\mathbb{N}");u("\\plusmn","\\pm");u("\\rarr","\\rightarrow");u("\\rArr","\\Rightarrow");u("\\Rarr","\\Rightarrow");u("\\real","\\Re");u("\\reals","\\mathbb{R}");u("\\Reals","\\mathbb{R}");u("\\sdot","\\cdot");u("\\sect","\\S");u("\\spades","\\spadesuit");u("\\sub","\\subset");u("\\sube","\\subseteq");u("\\supe","\\supseteq");u("\\thetasym","\\vartheta");u("\\weierp","\\wp");u("\\quantity","{\\left\\{ #1 \\right\\}}");u("\\qty","{\\left\\{ #1 \\right\\}}");u("\\pqty","{\\left( #1 \\right)}");u("\\bqty","{\\left[ #1 \\right]}");u("\\vqty","{\\left\\vert #1 \\right\\vert}");u("\\Bqty","{\\left\\{ #1 \\right\\}}");u("\\absolutevalue","{\\left\\vert #1 \\right\\vert}");u("\\abs","{\\left\\vert #1 \\right\\vert}");u("\\norm","{\\left\\Vert #1 \\right\\Vert}");u("\\evaluated","{\\left.#1 \\right\\vert}");u("\\eval","{\\left.#1 \\right\\vert}");u("\\order","{\\mathcal{O} \\left( #1 \\right)}");u("\\commutator","{\\left[ #1 , #2 \\right]}");u("\\comm","{\\left[ #1 , #2 \\right]}");u("\\anticommutator","{\\left\\{ #1 , #2 \\right\\}}");u("\\acomm","{\\left\\{ #1 , #2 \\right\\}}");u("\\poissonbracket","{\\left\\{ #1 , #2 \\right\\}}");u("\\pb","{\\left\\{ #1 , #2 \\right\\}}");u("\\vectorbold","{\\boldsymbol{ #1 }}");u("\\vb","{\\boldsymbol{ #1 }}");u("\\vectorarrow","{\\vec{\\boldsymbol{ #1 }}}");u("\\va","{\\vec{\\boldsymbol{ #1 }}}");u("\\vectorunit","{{\\boldsymbol{\\hat{ #1 }}}}");u("\\vu","{{\\boldsymbol{\\hat{ #1 }}}}");u("\\dotproduct","\\mathbin{\\boldsymbol\\cdot}");u("\\vdot","{\\boldsymbol\\cdot}");u("\\crossproduct","\\mathbin{\\boldsymbol\\times}");u("\\cross","\\mathbin{\\boldsymbol\\times}");u("\\cp","\\mathbin{\\boldsymbol\\times}");u("\\gradient","{\\boldsymbol\\nabla}");u("\\grad","{\\boldsymbol\\nabla}");u("\\divergence","{\\grad\\vdot}");u("\\curl","{\\grad\\cross}");u("\\laplacian","\\nabla^2");u("\\tr","{\\operatorname{tr}}");u("\\Tr","{\\operatorname{Tr}}");u("\\rank","{\\operatorname{rank}}");u("\\erf","{\\operatorname{erf}}");u("\\Res","{\\operatorname{Res}}");u("\\principalvalue","{\\mathcal{P}}");u("\\pv","{\\mathcal{P}}");u("\\PV","{\\operatorname{P.V.}}");u("\\qqtext","{\\quad\\text{ #1 }\\quad}");u("\\qq","{\\quad\\text{ #1 }\\quad}");u("\\qcomma","{\\text{,}\\quad}");u("\\qc","{\\text{,}\\quad}");u("\\qcc","{\\quad\\text{c.c.}\\quad}");u("\\qif","{\\quad\\text{if}\\quad}");u("\\qthen","{\\quad\\text{then}\\quad}");u("\\qelse","{\\quad\\text{else}\\quad}");u("\\qotherwise","{\\quad\\text{otherwise}\\quad}");u("\\qunless","{\\quad\\text{unless}\\quad}");u("\\qgiven","{\\quad\\text{given}\\quad}");u("\\qusing","{\\quad\\text{using}\\quad}");u("\\qassume","{\\quad\\text{assume}\\quad}");u("\\qsince","{\\quad\\text{since}\\quad}");u("\\qlet","{\\quad\\text{let}\\quad}");u("\\qfor","{\\quad\\text{for}\\quad}");u("\\qall","{\\quad\\text{all}\\quad}");u("\\qeven","{\\quad\\text{even}\\quad}");u("\\qodd","{\\quad\\text{odd}\\quad}");u("\\qinteger","{\\quad\\text{integer}\\quad}");u("\\qand","{\\quad\\text{and}\\quad}");u("\\qor","{\\quad\\text{or}\\quad}");u("\\qas","{\\quad\\text{as}\\quad}");u("\\qin","{\\quad\\text{in}\\quad}");u("\\differential","{\\text{d}}");u("\\dd","{\\text{d}}");u("\\derivative","{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}");u("\\dv","{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}");u("\\partialderivative","{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}");u("\\variation","{\\delta}");u("\\var","{\\delta}");u("\\functionalderivative","{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}");u("\\fdv","{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}");u("\\innerproduct","{\\left\\langle {#1} \\mid { #2} \\right\\rangle}");u("\\outerproduct","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}");u("\\dyad","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}");u("\\ketbra","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}");u("\\op","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}");u("\\expectationvalue","{\\left\\langle {#1 } \\right\\rangle}");u("\\expval","{\\left\\langle {#1 } \\right\\rangle}");u("\\ev","{\\left\\langle {#1 } \\right\\rangle}");u("\\matrixelement","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}");u("\\matrixel","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}");u("\\mel","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}");function At(e){const t=[];e.consumeSpaces();let r=e.fetch().text;for(r==="\\relax"&&(e.consume(),e.consumeSpaces(),r=e.fetch().text);r==="\\hline"||r==="\\hdashline";)e.consume(),t.push(r==="\\hdashline"),e.consumeSpaces(),r=e.fetch().text;return t}const xe=e=>{if(!e.parser.settings.displayMode)throw new v(`{${e.envName}} can be used only in display mode.`)},sn=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,ar=e=>{let t=e.get("\\arraystretch");typeof t!="string"&&(t=Ve(t.tokens)),t=isNaN(t)?null:Number(t);let r=e.get("\\arraycolsep");typeof r!="string"&&(r=Ve(r.tokens));const o=sn.exec(r),s=o?{number:+(o[1]+o[2]),unit:o[3]}:null;return[t,s]},St=e=>{let t="";for(let r=0;r<e.length;r++)if(e[r].type==="label"){if(t)throw new v("Multiple \\labels in one row");t=e[r].string}return t};function at(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function ee(e,{cols:t,envClasses:r,autoTag:o,singleRow:s,emptySingleRow:i,maxNumCols:l,leqno:c,arraystretch:h,arraycolsep:f},k){const x=r&&r.includes("bordermatrix")?"}":"\\end";e.gullet.beginGroup(),s||e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();let y=[];const _=[y],C=[],z=[],F=[],T=o!=null?[]:void 0;function $(){o&&e.gullet.macros.set("\\@eqnsw","1",!0)}function Y(){T&&(e.gullet.macros.get("\\df@tag")?(T.push(e.subparse([new J("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!o&&e.gullet.macros.get("\\@eqnsw")==="1"))}for($(),F.push(At(e));;){let H=e.parseExpression(!1,s?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),H={type:"ordgroup",mode:e.mode,body:H,semisimple:!0},y.push(H);const le=e.fetch().text;if(le==="&"){if(l&&y.length===l)if(r.includes("array")){if(e.settings.strict)throw new v("Too few columns specified in the {array} column argument.",e.nextToken)}else throw l===2?new v("The split environment accepts no more than two columns",e.nextToken):new v("The equation environment accepts only one column",e.nextToken);e.consume()}else if(le===x){Y(),y.length===1&&H.body.length===0&&(_.length>1||!i)&&_.pop(),z.push(St(H.body)),F.length<_.length+1&&F.push([]);break}else if(le==="\\\\"){e.consume();let ue;e.gullet.future().text!==" "&&(ue=e.parseSizeGroup(!0)),C.push(ue?ue.value:null),Y(),z.push(St(H.body)),F.push(At(e)),y=[],_.push(y),$()}else throw new v("Expected & or \\\\ or \\cr or "+x,e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,body:_,cols:t,rowGaps:C,hLinesBeforeRow:F,envClasses:r,autoTag:o,scriptLevel:k,tags:T,labels:z,leqno:c,arraystretch:h,arraycolsep:f}}function sr(e){return e.slice(0,1)==="d"?"display":"text"}const ln={c:"center ",l:"left ",r:"right "},qt=e=>{const t=new p("mtd",[]);return t.style={padding:"0",width:"50%"},e.envClasses.includes("multline")&&(t.style.width="7.5%"),t},X=function(e,t){const r=[],o=e.body.length,s=e.hLinesBeforeRow,i=e.tags&&e.tags.some(f=>f);for(let f=0;f<o;f++){const k=e.body[f],x=[],y=e.scriptLevel==="text"?M.TEXT:e.scriptLevel==="script"?M.SCRIPT:M.DISPLAY;for(let T=0;T<k.length;T++){const $=new p("mtd",[E(k[T],t.withLevel(y))]);if(e.envClasses.includes("multline")){const Y=f===0?"left":f===o-1?"right":"center";Y!=="center"&&$.classes.push("tml-"+Y)}x.push($)}const _=e.body[0].length;for(let T=0;T<_-k.length;T++)x.push(new p("mtd",[],[],t));if(i){const T=e.tags[f];let $;T===!0?$=new p("mtext",[new Ht(["tml-eqn"])]):T===!1?$=new p("mtext",[],[]):($=ne(T[0].body,t.withLevel(y),!0),$=$e($),$.classes=["tml-tag"]),$&&(x.unshift(qt(e)),x.push(qt(e)),e.leqno?x[0].children.push($):x[x.length-1].children.push($))}const C=new p("mtr",x,[]),z=e.labels.shift();z&&e.tags&&e.tags[f]&&(C.setAttribute("id",z),Array.isArray(e.tags[f])&&C.classes.push("tml-tageqn")),f===0&&s[0].length>0&&(s[0].length===2?C.children.forEach(T=>{T.style.borderTop="0.15em double"}):C.children.forEach(T=>{T.style.borderTop=s[0][0]?"0.06em dashed":"0.06em solid"})),s[f+1].length>0&&(s[f+1].length===2?C.children.forEach(T=>{T.style.borderBottom="0.15em double"}):C.children.forEach(T=>{T.style.borderBottom=s[f+1][0]?"0.06em dashed":"0.06em solid"}));let F=!0;for(let T=0;T<C.children.length;T++){const $=C.children[T].children[0];if(!($&&$.type==="mpadded"&&$.attributes.height==="0px")){F=!1;break}}if(F)for(let T=0;T<C.children.length;T++)C.children[T].style.display="block",C.children[T].style.height="0",C.children[T].style.paddingTop="0",C.children[T].style.paddingBottom="0";r.push(C)}if(e.arraystretch&&e.arraystretch!==1){const f=String(1.4*e.arraystretch-.8)+"ex";for(let k=0;k<r.length;k++)for(let x=0;x<r[k].children.length;x++)r[k].children[x].style.paddingTop=f,r[k].children[x].style.paddingBottom=f}let l,c;if(e.envClasses.length>0&&(l=e.envClasses.includes("abut")||e.envClasses.includes("cases")?"0":e.envClasses.includes("small")?"0.1389":e.envClasses.includes("cd")?"0.25":"0.4",c="em"),e.arraycolsep){const f=Q(e.arraycolsep,t);l=f.number.toFixed(4),c=f.unit}if(l){const f=r.length===0?0:r[0].children.length,k=(x,y)=>x===0&&y===0||x===f-1&&y===1?"0":e.envClasses[0]!=="align"?l:y===1?"0":i?x%2?"1":"0":x%2?"0":"1";for(let x=0;x<r.length;x++)for(let y=0;y<r[x].children.length;y++)r[x].children[y].style.paddingLeft=`${k(y,0)}${c}`,r[x].children[y].style.paddingRight=`${k(y,1)}${c}`}if(e.envClasses.length===0)for(let f=0;f<r.length;f++)r[f].children[0].style.paddingLeft="0em",r[f].children.length===r[0].children.length&&(r[f].children[r[f].children.length-1].style.paddingRight="0em");if(e.envClasses.length>0){const f=e.envClasses.includes("align")||e.envClasses.includes("alignat");for(let k=0;k<r.length;k++){const x=r[k];if(f){for(let y=0;y<x.children.length;y++)x.children[y].classes=["tml-"+(y%2?"left":"right")];if(i){const y=e.leqno?0:x.children.length-1;x.children[y].classes=[]}}if(x.children.length>1&&e.envClasses.includes("cases")&&(x.children[1].style.paddingLeft="1em"),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(const y of x.children)y.classes.push("tml-left")}}let h=new p("mtable",r);if(e.envClasses.length>0&&(e.envClasses.includes("jot")?h.classes.push("tml-jot"):e.envClasses.includes("small")&&h.classes.push("tml-small")),e.scriptLevel==="display"&&h.setAttribute("displaystyle","true"),(e.autoTag||e.envClasses.includes("multline"))&&(h.style.width="100%"),e.cols&&e.cols.length>0){const f=e.cols;let k=!1,x=0,y=f.length;for(;f[x].type==="separator";)x+=1;for(;f[y-1].type==="separator";)y-=1;if(f[0].type==="separator"){const C=f[1].type==="separator"?"0.15em double":f[0].separator==="|"?"0.06em solid ":"0.06em dashed ";for(const z of h.children)z.children[0].style.borderLeft=C}let _=i?0:-1;for(let C=x;C<y;C++)if(f[C].type==="align"){const z=ln[f[C].align];_+=1;for(const F of h.children)z.trim()!=="center"&&_<F.children.length&&(F.children[_].classes=["tml-"+z.trim()]);k=!0}else if(f[C].type==="separator"){if(k){const z=f[C+1].type==="separator"?"0.15em double":f[C].separator==="|"?"0.06em solid":"0.06em dashed";for(const F of h.children)_<F.children.length&&(F.children[_].style.borderRight=z)}k=!1}if(f[f.length-1].type==="separator"){const C=f[f.length-2].type==="separator"?"0.15em double":f[f.length-1].separator==="|"?"0.06em solid":"0.06em dashed";for(const z of h.children)z.children[z.children.length-1].style.borderRight=C,z.children[z.children.length-1].style.paddingRight="0.4em"}}return e.envClasses.includes("small")&&(h=new p("mstyle",[h]),h.setAttribute("scriptlevel","1")),h},ir=function(e,t){e.envName.indexOf("ed")===-1&&xe(e);const r=e.envName==="split",o=[],s=ee(e.parser,{cols:o,emptySingleRow:!0,autoTag:r?void 0:at(e.envName),envClasses:["abut","jot"],maxNumCols:e.envName==="split"?2:void 0,leqno:e.parser.settings.leqno},"display");let i,l=0;const c=e.envName.indexOf("at")>-1;if(t[0]&&c){let h="";for(let f=0;f<t[0].body.length;f++){const k=D(t[0].body[f],"textord");h+=k.text}if(isNaN(h))throw new v("The alignat enviroment requires a numeric first argument.");i=Number(h),l=i*2}s.body.forEach(function(h){if(c){const f=h.length/2;if(i<f)throw new v(`Too many math in a row: expected ${i}, but got ${f}`,h[0])}else l<h.length&&(l=h.length)});for(let h=0;h<l;++h){let f="r";h%2===1&&(f="l"),o[h]={type:"align",align:f}}return e.envName==="split"||(c?s.envClasses.push("alignat"):s.envClasses[0]="align"),s};Z({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){const s=(Ee(t[0])?[t[0]]:D(t[0],"ordgroup").body).map(function(h){const k=tt(h).text;if("lcr".indexOf(k)!==-1)return{type:"align",align:k};if(k==="|")return{type:"separator",separator:"|"};if(k===":")return{type:"separator",separator:":"};throw new v("Unknown column alignment: "+k,h)}),[i,l]=ar(e.parser.gullet.macros),c={cols:s,envClasses:["array"],maxNumCols:s.length,arraystretch:i,arraycolsep:l};return ee(e.parser,c,sr(e.envName))},mathmlBuilder:X});Z({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){const t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")];let r="c";const o={envClasses:[],cols:[]};if(e.envName.charAt(e.envName.length-1)==="*"){const c=e.parser;if(c.consumeSpaces(),c.fetch().text==="["){if(c.consume(),c.consumeSpaces(),r=c.fetch().text,"lcr".indexOf(r)===-1)throw new v("Expected l or c or r",c.nextToken);c.consume(),c.consumeSpaces(),c.expect("]"),c.consume(),o.cols=[]}}const s=ee(e.parser,o,"text");s.cols=s.body.length>0?new Array(s.body[0].length).fill({type:"align",align:r}):[];const[i,l]=ar(e.parser.gullet.macros);return s.arraystretch=i,l&&!(l===6&&l==="pt")&&(s.arraycolsep=l),t?{type:"leftright",mode:e.mode,body:[s],left:t[0],right:t[1],rightColor:void 0}:s},mathmlBuilder:X});Z({type:"array",names:["bordermatrix"],props:{numArgs:0},handler(e){const t={cols:[],envClasses:["bordermatrix"]},r=ee(e.parser,t,"text");return r.cols=r.body.length>0?new Array(r.body[0].length).fill({type:"align",align:"c"}):[],r.envClasses=[],r.arraystretch=1,e.envName==="matrix"?r:on(r,e.delimiters)},mathmlBuilder:X});Z({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){const t={envClasses:["small"]};return ee(e.parser,t,"script")},mathmlBuilder:X});Z({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){const s=(Ee(t[0])?[t[0]]:D(t[0],"ordgroup").body).map(function(l){const h=tt(l).text;if("lc".indexOf(h)!==-1)return{type:"align",align:h};throw new v("Unknown column alignment: "+h,l)});if(s.length>1)throw new v("{subarray} can contain only one column");let i={cols:s,envClasses:["small"]};if(i=ee(e.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new v("{subarray} can contain only one column");return i},mathmlBuilder:X});Z({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){const t={cols:[],envClasses:["cases"]},r=ee(e.parser,t,sr(e.envName));return{type:"leftright",mode:e.mode,body:[r],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},mathmlBuilder:X});Z({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:ir,mathmlBuilder:X});Z({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:ir,mathmlBuilder:X});Z({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){e.envName!=="gathered"&&xe(e);const t={cols:[],envClasses:["abut","jot"],autoTag:at(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return ee(e.parser,t,"display")},mathmlBuilder:X});Z({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){xe(e);const t={autoTag:at(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:["align"],leqno:e.parser.settings.leqno};return ee(e.parser,t,"display")},mathmlBuilder:X});Z({type:"array",names:["multline","multline*"],props:{numArgs:0},handler(e){xe(e);const t={autoTag:e.envName==="multline",maxNumCols:1,envClasses:["jot","multline"],leqno:e.parser.settings.leqno};return ee(e.parser,t,"display")},mathmlBuilder:X});Z({type:"array",names:["CD"],props:{numArgs:0},handler(e){return xe(e),nn(e.parser)},mathmlBuilder:X});S({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new v(`${e.funcName} valid only within array environment`)}});const We=Qt;S({type:"bordermatrix",names:["\\bordermatrix","\\matrix"],props:{numArgs:0,numOptionalArgs:1},handler:({parser:e,funcName:t},r,o)=>{let s=["(",")"];if(t==="\\bordermatrix"&&o[0]&&o[0].body){const h=o[0].body;h.length===2&&h[0].type==="atom"&&h[1].type==="atom"&&h[0].family==="open"&&h[1].family==="close"&&(s=[h[0].text,h[1].text])}e.consumeSpaces(),e.consume();const i=We.bordermatrix,l={mode:e.mode,envName:t.slice(1),delimiters:s,parser:e},c=i.handler(l);return e.expect("}",!0),c}});S({type:"cancelto",names:["\\cancelto"],props:{numArgs:2},handler({parser:e},t){const r=t[0],o=t[1];return{type:"cancelto",mode:e.mode,body:o,to:r,isCharacterBox:Be(o)}},mathmlBuilder(e,t){const r=new p("mrow",[E(e.body,t)],["ff-narrow"]),o=new p("mphantom",[E(e.body,t)]),s=new p("mrow",[o],["tml-cancelto"]);e.isCharacterBox&&Vt.indexOf(e.body.body[0].text)>-1&&(s.style.left="0.1em",s.style.width="90%");const i=new p("mrow",[r,s],["menclose"]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text))o.style.paddingRight="0.2em";else{o.style.padding="0.5ex 0.1em 0 0";const x=new p("mspace",[]);x.setAttribute("height","0.85em"),r.children.push(x)}let l;if(e.isCharacterBox)l=new p("mspace",[]),l.setAttribute("height","1em");else{const x=E(e.body,t),y=new p("mpadded",[x]);y.setAttribute("width","0.1px"),l=new p("mphantom",[y])}const c=E(e.to,t),h=new p("mpadded",[c]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text)){const x=new p("mspace",[]);x.setAttribute("width","0.2em"),h.children.unshift(x)}h.setAttribute("width","0.1px");const f=new p("mover",[l,h]),k=new p("mrow",[],["ff-nudge-left"]);return ae([Oe([i,f]),k])}});S({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler({parser:e,token:t},r){const s=D(r[0],"ordgroup").body;let i="";for(let c=0;c<s.length;c++){const h=D(s[c],"textord");i+=h.text}const l=parseInt(i);if(isNaN(l))throw new v(`\\@char has non-numeric argument ${i}`,t);return{type:"textord",mode:e.mode,text:String.fromCodePoint(l)}}});const un=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,cn=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,dn=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,mn=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,hn=/^[a-f0-9]{6}$/i,_t=e=>{let t=e.toString(16);return t.length===1&&(t="0"+t),t},Tt=JSON.parse(`{
"Apricot": "#ffb484",
"Aquamarine": "#08b4bc",
"Bittersweet": "#c84c14",
"blue": "#0000FF",
"Blue": "#303494",
"BlueGreen": "#08b4bc",
"BlueViolet": "#503c94",
"BrickRed": "#b8341c",
"brown": "#BF8040",
"Brown": "#802404",
"BurntOrange": "#f8941c",
"CadetBlue": "#78749c",
"CarnationPink": "#f884b4",
"Cerulean": "#08a4e4",
"CornflowerBlue": "#40ace4",
"cyan": "#00FFFF",
"Cyan": "#08acec",
"Dandelion": "#ffbc44",
"darkgray": "#404040",
"DarkOrchid": "#a8548c",
"Emerald": "#08ac9c",
"ForestGreen": "#089c54",
"Fuchsia": "#90348c",
"Goldenrod": "#ffdc44",
"gray": "#808080",
"Gray": "#98949c",
"green": "#00FF00",
"Green": "#08a44c",
"GreenYellow": "#e0e474",
"JungleGreen": "#08ac9c",
"Lavender": "#f89cc4",
"lightgray": "#c0c0c0",
"lime": "#BFFF00",
"LimeGreen": "#90c43c",
"magenta": "#FF00FF",
"Magenta": "#f0048c",
"Mahogany": "#b0341c",
"Maroon": "#b03434",
"Melon": "#f89c7c",
"MidnightBlue": "#086494",
"Mulberry": "#b03c94",
"NavyBlue": "#086cbc",
"olive": "#7F7F00",
"OliveGreen": "#407c34",
"orange": "#FF8000",
"Orange": "#f8843c",
"OrangeRed": "#f0145c",
"Orchid": "#b074ac",
"Peach": "#f8945c",
"Periwinkle": "#8074bc",
"PineGreen": "#088c74",
"pink": "#ff7f7f",
"Plum": "#98248c",
"ProcessBlue": "#08b4ec",
"purple": "#BF0040",
"Purple": "#a0449c",
"RawSienna": "#983c04",
"red": "#ff0000",
"Red": "#f01c24",
"RedOrange": "#f86434",
"RedViolet": "#a0246c",
"Rhodamine": "#f0549c",
"Royallue": "#0874bc",
"RoyalPurple": "#683c9c",
"RubineRed": "#f0047c",
"Salmon": "#f8948c",
"SeaGreen": "#30bc9c",
"Sepia": "#701404",
"SkyBlue": "#48c4dc",
"SpringGreen": "#c8dc64",
"Tan": "#e09c74",
"teal": "#007F7F",
"TealBlue": "#08acb4",
"Thistle": "#d884b4",
"Turquoise": "#08b4cc",
"violet": "#800080",
"Violet": "#60449c",
"VioletRed": "#f054a4",
"WildStrawberry": "#f0246c",
"yellow": "#FFFF00",
"Yellow": "#fff404",
"YellowGreen": "#98cc6c",
"YellowOrange": "#ffa41c"
}`),me=(e,t)=>{let r="";if(e==="HTML"){if(!un.test(t))throw new v("Invalid HTML input.");r=t}else if(e==="RGB"){if(!dn.test(t))throw new v("Invalid RGB input.");t.split(",").map(o=>{r+=_t(Number(o.trim()))})}else{if(!mn.test(t))throw new v("Invalid rbg input.");t.split(",").map(o=>{const s=Number(o.trim());if(s>1)throw new v("Color rgb input must be < 1.");r+=_t(Number((s*255).toFixed(0)))})}return r.charAt(0)!=="#"&&(r="#"+r),r},fe=(e,t,r)=>{const o=`\\\\color@${e}`;if(!cn.exec(e))throw new v("Invalid color: '"+e+"'",r);return hn.test(e)?"#"+e:(e.charAt(0)==="#"||(t.has(o)?e=t.get(o).tokens[0].text:Tt[e]&&(e=Tt[e])),e)},lr=(e,t)=>{let r=U(e.body,t.withColor(e.color));return r.length===0&&r.push(new p("mrow")),r=r.map(o=>(o.style.color=e.color,o)),ae(r)};S({type:"color",names:["\\textcolor"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","original"]},handler({parser:e,token:t},r,o){const s=o[0]&&D(o[0],"raw").string;let i="";if(s){const c=D(r[0],"raw").string;i=me(s,c)}else i=fe(D(r[0],"raw").string,e.gullet.macros,t);const l=r[1];return{type:"color",mode:e.mode,color:i,isTextColor:!0,body:R(l)}},mathmlBuilder:lr});S({type:"color",names:["\\color"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw"]},handler({parser:e,breakOnTokenText:t,token:r},o,s){const i=s[0]&&D(s[0],"raw").string;let l="";if(i){const h=D(o[0],"raw").string;l=me(i,h)}else l=fe(D(o[0],"raw").string,e.gullet.macros,r);const c=e.parseExpression(!0,t,!0);return{type:"color",mode:e.mode,color:l,isTextColor:!1,body:c}},mathmlBuilder:lr});S({type:"color",names:["\\definecolor"],props:{numArgs:3,allowedInText:!0,argTypes:["raw","raw","raw"]},handler({parser:e,funcName:t,token:r},o){const s=D(o[0],"raw").string;if(!/^[A-Za-z]+$/.test(s))throw new v("Color name must be latin letters.",r);const i=D(o[1],"raw").string;if(!["HTML","RGB","rgb"].includes(i))throw new v("Color model must be HTML, RGB, or rgb.",r);const l=D(o[2],"raw").string,c=me(i,l);return e.gullet.macros.set(`\\\\color@${s}`,{tokens:[{text:c}],numArgs:0}),{type:"internal",mode:e.mode}}});S({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},t,r){const o=e.gullet.future().text==="["?e.parseSizeGroup(!0):null,s=!e.settings.displayMode;return{type:"cr",mode:e.mode,newLine:s,size:o&&D(o,"size").value}},mathmlBuilder(e,t){const r=new p("mo");if(e.newLine&&(r.setAttribute("linebreak","newline"),e.size)){const o=Q(e.size,t);r.setAttribute("height",o.number+o.unit)}return r}});const He={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},De=e=>{const t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new v("Expected a control sequence",e);return t},pn=e=>{let t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},ur=(e,t,r,o)=>{let s=e.gullet.macros.get(r.text);s==null&&(r.noexpand=!0,s={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,s,o)};S({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler({parser:e,funcName:t}){e.consumeSpaces();const r=e.fetch();if(He[r.text])return(t==="\\global"||t==="\\\\globallong")&&(r.text=He[r.text]),D(e.parseFunction(),"internal");throw new v("Invalid token after macro prefix",r)}});S({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let r=e.gullet.popToken();const o=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(o))throw new v("Expected a control sequence",r);let s=0,i;const l=[[]];for(;e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){i=e.gullet.future(),l[s].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new v(`Invalid argument number "${r.text}"`);if(parseInt(r.text)!==s+1)throw new v(`Argument number "${r.text}" out of order`);s++,l.push([])}else{if(r.text==="EOF")throw new v("Expected a macro definition");l[s].push(r.text)}let{tokens:c}=e.gullet.consumeArg();if(i&&c.unshift(i),t==="\\edef"||t==="\\xdef"){if(c=e.gullet.expandTokens(c),c.length>e.gullet.settings.maxExpand)throw new v("Too many expansions in an "+t);c.reverse()}return e.gullet.macros.set(o,{tokens:c,numArgs:s,delimiters:l},t===He[t]),{type:"internal",mode:e.mode}}});S({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){const r=De(e.gullet.popToken());e.gullet.consumeSpaces();const o=pn(e);return ur(e,r,o,t==="\\\\globallet"),{type:"internal",mode:e.mode}}});S({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){const r=De(e.gullet.popToken()),o=e.gullet.popToken(),s=e.gullet.popToken();return ur(e,r,s,t==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(o),{type:"internal",mode:e.mode}}});S({type:"internal",names:["\\newcommand","\\renewcommand","\\providecommand"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let r="";const o=e.gullet.popToken();o.text==="{"?(r=De(e.gullet.popToken()),e.gullet.popToken()):r=De(o);const s=e.gullet.isDefined(r);if(s&&t==="\\newcommand")throw new v(`\\newcommand{${r}} attempting to redefine ${r}; use \\renewcommand`);if(!s&&t==="\\renewcommand")throw new v(`\\renewcommand{${r}} when command ${r} does not yet exist; use \\newcommand`);let i=0;if(e.gullet.future().text==="["){let c=e.gullet.popToken();if(c=e.gullet.popToken(),!/^[0-9]$/.test(c.text))throw new v(`Invalid number of arguments: "${c.text}"`);if(i=parseInt(c.text),c=e.gullet.popToken(),c.text!=="]")throw new v(`Invalid argument "${c.text}"`)}const{tokens:l}=e.gullet.consumeArg();return t==="\\providecommand"&&e.gullet.macros.has(r)||e.gullet.macros.set(r,{tokens:l,numArgs:i}),{type:"internal",mode:e.mode}}});const Ze={"\\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}},cr=["(","\\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","."],fn=["}","\\left","\\middle","\\right"],ze=e=>e.length>0&&(cr.includes(e)||Ze[e]||fn.includes(e)),Ct=[0,1.2,1.8,2.4,3];function ge(e,t){e.type==="ordgroup"&&e.body.length===1&&(e=e.body[0]);const r=Ee(e);if(r&&cr.includes(r.text))return["<","\\lt"].includes(r.text)&&(r.text="⟨"),[">","\\gt"].includes(r.text)&&(r.text="⟩"),r;throw r?new v(`Invalid delimiter '${r.text}' after '${t.funcName}'`,e):new v(`Invalid delimiter type '${e.type}'`,e)}const gn=["/","\\","\\backslash","\\vert","|"];S({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=ge(t[0],e),o={type:"delimsizing",mode:e.parser.mode,size:Ze[e.funcName].size,mclass:Ze[e.funcName].mclass,delim:r.text},s=e.parser.fetch().text;return s!=="^"&&s!=="_"?o:{type:"ordgroup",mode:"math",body:[o,{type:"ordgroup",mode:"math",body:[]}]}},mathmlBuilder:e=>{const t=[];e.delim==="."&&(e.delim=""),t.push(W(e.delim,e.mode));const r=new p("mo",t);return e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),(gn.includes(e.delim)||e.delim.indexOf("arrow")>-1)&&r.setAttribute("stretchy","true"),r.setAttribute("symmetric","true"),r.setAttribute("minsize",Ct[e.size]+"em"),r.setAttribute("maxsize",Ct[e.size]+"em"),r}});function bn(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}S({type:"leftright-right",names:["\\right"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>({type:"leftright-right",mode:e.parser.mode,delim:ge(t[0],e).text})});S({type:"leftright",names:["\\left"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{const r=ge(t[0],e),o=e.parser;++o.leftrightDepth;let s=o.parseExpression(!1,null,!0),i=o.fetch();for(;i.text==="\\middle";){o.consume();const c=o.fetch().text;if(!P.math[c])throw new v(`Invalid delimiter '${c}' after '\\middle'`);ge({type:"atom",mode:"math",text:c},{funcName:"\\middle"}),s.push({type:"middle",mode:"math",delim:c}),o.consume(),s=s.concat(o.parseExpression(!1,null,!0)),i=o.fetch()}--o.leftrightDepth,o.expect("\\right",!1);const l=D(o.parseFunction(),"leftright-right");return{type:"leftright",mode:o.mode,body:s,left:r.text,right:l.delim}},mathmlBuilder:(e,t)=>{bn(e);const r=U(e.body,t);e.left==="."&&(e.left="");const o=new p("mo",[W(e.left,e.mode)]);o.setAttribute("fence","true"),o.setAttribute("form","prefix"),(e.left==="/"||e.left==="\\"||e.left.indexOf("arrow")>-1)&&o.setAttribute("stretchy","true"),r.unshift(o),e.right==="."&&(e.right="");const s=new p("mo",[W(e.right,e.mode)]);if(s.setAttribute("fence","true"),s.setAttribute("form","postfix"),(e.right===""||e.right.indexOf("arrow")>-1)&&s.setAttribute("stretchy","true"),e.body.length>0){const i=e.body[e.body.length-1];i.type==="color"&&!i.isTextColor&&s.setAttribute("mathcolor",i.color)}return r.push(s),Oe(r)}});S({type:"middle",names:["\\middle"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{const r=ge(t[0],e);if(!e.parser.leftrightDepth)throw new v("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},mathmlBuilder:(e,t)=>{const r=W(e.delim,e.mode),o=new p("mo",[r]);return o.setAttribute("fence","true"),e.delim.indexOf("arrow")>-1&&o.setAttribute("stretchy","true"),o.setAttribute("form","prefix"),o.setAttribute("lspace","0.05em"),o.setAttribute("rspace","0.05em"),o}});const xn=["\\boxed","\\fcolorbox","\\colorbox"],ye=(e,t)=>{const r=xn.includes(e.label)?"mrow":"menclose",o=new p(r,[E(e.body,t)]);switch(e.label){case"\\overline":o.setAttribute("notation","top"),o.classes.push("tml-overline");break;case"\\underline":o.setAttribute("notation","bottom"),o.classes.push("tml-underline");break;case"\\cancel":o.setAttribute("notation","updiagonalstrike"),o.children.push(new p("mrow",[],["tml-cancel","upstrike"]));break;case"\\bcancel":o.setAttribute("notation","downdiagonalstrike"),o.children.push(new p("mrow",[],["tml-cancel","downstrike"]));break;case"\\sout":o.setAttribute("notation","horizontalstrike"),o.children.push(new p("mrow",[],["tml-cancel","sout"]));break;case"\\xcancel":o.setAttribute("notation","updiagonalstrike downdiagonalstrike"),o.classes.push("tml-xcancel");break;case"\\longdiv":o.setAttribute("notation","longdiv"),o.classes.push("longdiv-top"),o.children.push(new p("mrow",[],["longdiv-arc"]));break;case"\\phase":o.setAttribute("notation","phasorangle"),o.classes.push("phasor-bottom"),o.children.push(new p("mrow",[],["phasor-angle"]));break;case"\\textcircled":o.setAttribute("notation","circle"),o.classes.push("circle-pad"),o.children.push(new p("mrow",[],["textcircle"]));break;case"\\angl":o.setAttribute("notation","actuarial"),o.classes.push("actuarial");break;case"\\boxed":o.style.padding="3pt",o.style.border="1px solid",o.setAttribute("scriptlevel","0"),o.setAttribute("displaystyle","true");break;case"\\fbox":o.setAttribute("notation","box"),o.classes.push("tml-fbox");break;case"\\fcolorbox":case"\\colorbox":{o.style.padding="0.3em",e.label==="\\fcolorbox"&&(o.style.border="0.0667em solid "+String(e.borderColor));break}}return e.backgroundColor&&o.setAttribute("mathbackground",e.backgroundColor),o};S({type:"enclose",names:["\\colorbox"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","text"]},handler({parser:e,funcName:t},r,o){const s=o[0]&&D(o[0],"raw").string;let i="";if(s){const c=D(r[0],"raw").string;i=me(s,c)}else i=fe(D(r[0],"raw").string,e.gullet.macros);const l=r[1];return{type:"enclose",mode:e.mode,label:t,backgroundColor:i,body:l}},mathmlBuilder:ye});S({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","raw","text"]},handler({parser:e,funcName:t},r,o){const s=o[0]&&D(o[0],"raw").string;let i="",l;if(s){const h=D(r[0],"raw").string,f=D(r[0],"raw").string;i=me(s,h),l=me(s,f)}else i=fe(D(r[0],"raw").string,e.gullet.macros),l=fe(D(r[1],"raw").string,e.gullet.macros);const c=r[2];return{type:"enclose",mode:e.mode,label:t,backgroundColor:l,borderColor:i,body:c}},mathmlBuilder:ye});S({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler({parser:e},t){return{type:"enclose",mode:e.mode,label:"\\fbox",body:t[0]}}});S({type:"enclose",names:["\\angl","\\cancel","\\bcancel","\\xcancel","\\sout","\\overline","\\boxed","\\longdiv","\\phase"],props:{numArgs:1},handler({parser:e,funcName:t},r){const o=r[0];return{type:"enclose",mode:e.mode,label:t,body:o}},mathmlBuilder:ye});S({type:"enclose",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},r){const o=r[0];return{type:"enclose",mode:e.mode,label:t,body:o}},mathmlBuilder:ye});S({type:"enclose",names:["\\textcircled"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},r){const o=r[0];return{type:"enclose",mode:e.mode,label:t,body:o}},mathmlBuilder:ye});S({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler({parser:e,funcName:t},r){const o=r[0];if(o.type!=="ordgroup")throw new v("Invalid environment name",o);let s="";for(let i=0;i<o.body.length;++i)s+=D(o.body[i],"textord").text;if(t==="\\begin"){if(!Object.prototype.hasOwnProperty.call(We,s))throw new v("No such environment: "+s,o);const i=We[s],{args:l,optArgs:c}=e.parseArguments("\\begin{"+s+"}",i),h={mode:e.mode,envName:s,parser:e},f=i.handler(h,l,c);e.expect("\\end",!1);const k=e.nextToken,x=D(e.parseFunction(),"environment");if(x.name!==s)throw new v(`Mismatch: \\begin{${s}} matched by \\end{${x.name}}`,k);return f}return{type:"environment",mode:e.mode,name:s,nameGroup:o}}});S({type:"envTag",names:["\\env@tag"],props:{numArgs:1,argTypes:["math"]},handler({parser:e},t){return{type:"envTag",mode:e.mode,body:t[0]}},mathmlBuilder(e,t){return new p("mrow")}});S({type:"noTag",names:["\\env@notag"],props:{numArgs:0},handler({parser:e}){return{type:"noTag",mode:e.mode}},mathmlBuilder(e,t){return new p("mrow")}});const yn=(e,t)=>{if(t!=="mathrm"||e.body.type!=="ordgroup"||e.body.body.length===1||e.body.body[0].type!=="mathord")return!1;for(let r=1;r<e.body.body.length;r++){const o=e.body.body[r].type;if(!(o==="mathord"||o==="textord"&&!isNaN(e.body.body[r].text)))return!1}return!0},dr=(e,t)=>{const r=e.font,o=t.withFont(r),s=E(e.body,o);if(s.children.length===0)return s;if(r==="boldsymbol"&&["mo","mpadded","mrow"].includes(s.type))return s.style.fontWeight="bold",s;if(yn(e,r)){const c=s.children[0].children[0].children?s.children[0].children[0]:s.children[0];delete c.attributes.mathvariant;for(let f=1;f<s.children.length;f++)c.children[0].text+=s.children[f].children[0].children?s.children[f].children[0].children[0].text:s.children[f].children[0].text;const h=new p("mpadded",[c]);return h.setAttribute("lspace","0"),h}let i=s.children[0].type==="mo";for(let c=1;c<s.children.length;c++)s.children[c].type==="mo"&&r==="boldsymbol"&&(s.children[c].style.fontWeight="bold"),s.children[c].type!=="mi"&&(i=!1),(s.children[c].attributes&&s.children[c].attributes.mathvariant||"")!=="normal"&&(i=!1);if(!i)return s;const l=s.children[0];for(let c=1;c<s.children.length;c++)l.children.push(s.children[c].children[0]);if(l.attributes.mathvariant&&l.attributes.mathvariant==="normal"){const c=new p("mtext",new j(""));return new p("mrow",[c,l])}return l},Dt={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};S({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 o=pe(r[0]);let s=t;return s in Dt&&(s=Dt[s]),{type:"font",mode:e.mode,font:s.slice(1),body:o}},mathmlBuilder:dr});S({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:t,breakOnTokenText:r},o)=>{const{mode:s}=e,i=e.parseExpression(!0,r,!0),l=`math${t.slice(1)}`;return{type:"font",mode:s,font:l,body:{type:"ordgroup",mode:e.mode,body:i}}},mathmlBuilder:dr});const Bt=["display","text","script","scriptscript"],wn={auto:-1,display:0,text:0,script:1,scriptscript:2},st=(e,t)=>{const r=e.scriptLevel==="auto"?t.incrementLevel():e.scriptLevel==="display"?t.withLevel(M.TEXT):e.scriptLevel==="text"?t.withLevel(M.SCRIPT):t.withLevel(M.SCRIPTSCRIPT),o=E(e.numer,r),s=E(e.denom,r);t.level===3&&(o.style.mathDepth="2",o.setAttribute("scriptlevel","2"),s.style.mathDepth="2",s.setAttribute("scriptlevel","2"));let i=new p("mfrac",[o,s]);if(!e.hasBarLine)i.setAttribute("linethickness","0px");else if(e.barSize){const l=Q(e.barSize,t);i.setAttribute("linethickness",l.number+l.unit)}if(e.leftDelim!=null||e.rightDelim!=null){const l=[];if(e.leftDelim!=null){const c=new p("mo",[new j(e.leftDelim.replace("\\",""))]);c.setAttribute("fence","true"),l.push(c)}if(l.push(i),e.rightDelim!=null){const c=new p("mo",[new j(e.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),l.push(c)}i=Oe(l)}return e.scriptLevel!=="auto"&&(i=new p("mstyle",[i]),i.setAttribute("displaystyle",String(e.scriptLevel==="display")),i.setAttribute("scriptlevel",wn[e.scriptLevel])),i};S({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const o=r[0],s=r[1];let i=!1,l=null,c=null,h="auto";switch(t){case"\\dfrac":case"\\frac":case"\\tfrac":i=!0;break;case"\\\\atopfrac":i=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l="(",c=")";break;case"\\\\bracefrac":l="\\{",c="\\}";break;case"\\\\brackfrac":l="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}switch(t){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:e.mode,continued:!1,numer:o,denom:s,hasBarLine:i,leftDelim:l,rightDelim:c,scriptLevel:h,barSize:null}},mathmlBuilder:st});S({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:({parser:e,funcName:t},r)=>{const o=r[0],s=r[1];return{type:"genfrac",mode:e.mode,continued:!0,numer:o,denom:s,hasBarLine:!0,leftDelim:null,rightDelim:null,scriptLevel:"display",barSize:null}}});S({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler({parser:e,funcName:t,token:r}){let o;switch(t){case"\\over":o="\\frac";break;case"\\choose":o="\\binom";break;case"\\atop":o="\\\\atopfrac";break;case"\\brace":o="\\\\bracefrac";break;case"\\brack":o="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:o,token:r}}});const $t=function(e){let t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};S({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler({parser:e},t){const r=t[4],o=t[5],s=pe(t[0]),i=s.type==="atom"&&s.family==="open"?$t(s.text):null,l=pe(t[1]),c=l.type==="atom"&&l.family==="close"?$t(l.text):null,h=D(t[2],"size");let f,k=null;h.isBlank?f=!0:(k=h.value,f=k.number>0);let x="auto",y=t[3];if(y.type==="ordgroup"){if(y.body.length>0){const _=D(y.body[0],"textord");x=Bt[Number(_.text)]}}else y=D(y,"textord"),x=Bt[Number(y.text)];return{type:"genfrac",mode:e.mode,numer:r,denom:o,continued:!1,hasBarLine:f,barSize:k,leftDelim:i,rightDelim:c,scriptLevel:x}},mathmlBuilder:st});S({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler({parser:e,funcName:t,token:r},o){return{type:"infix",mode:e.mode,replaceWith:"\\\\abovefrac",barSize:D(o[0],"size").value,token:r}}});S({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:({parser:e,funcName:t},r)=>{const o=r[0],s=Dr(D(r[1],"infix").barSize),i=r[2],l=s.number>0;return{type:"genfrac",mode:e.mode,numer:o,denom:i,continued:!1,hasBarLine:l,barSize:s,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:st});S({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler({parser:e},t){return{type:"hbox",mode:e.mode,body:R(t[0])}},mathmlBuilder(e,t){const r=t.withLevel(M.TEXT),o=ne(e.body,r);return $e(o)}});const vn=(e,t)=>{const r=et(e.label);return r.style["math-depth"]=0,new p(e.isOver?"mover":"munder",[E(e.base,t),r])};S({type:"horizBracket",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler({parser:e,funcName:t},r){return{type:"horizBracket",mode:e.mode,label:t,isOver:/^\\over/.test(t),base:r[0]}},mathmlBuilder:vn});S({type:"html",names:["\\class","\\id","\\style","\\data"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:({parser:e,funcName:t,token:r},o)=>{const s=D(o[0],"raw").string,i=o[1];if(e.settings.strict)throw new v(`Function "${t}" is disabled in strict mode`,r);let l;const c={};switch(t){case"\\class":c.class=s,l={command:"\\class",class:s};break;case"\\id":c.id=s,l={command:"\\id",id:s};break;case"\\style":c.style=s,l={command:"\\style",style:s};break;case"\\data":{const h=s.split(",");for(let f=0;f<h.length;f++){const k=h[f].split("=");if(k.length!==2)throw new v("Error parsing key-value for \\data");c["data-"+k[0].trim()]=k[1].trim()}l={command:"\\data",attributes:c};break}default:throw new Error("Unrecognized html command")}if(!e.settings.isTrusted(l))throw new v(`Function "${t}" is not trusted`,r);return{type:"html",mode:e.mode,attributes:c,body:R(i)}},mathmlBuilder:(e,t)=>{const r=ne(e.body,t),o=[];e.attributes.class&&o.push(...e.attributes.class.trim().split(/\s+/)),r.classes=o;for(const s in e.attributes)s!=="class"&&Object.prototype.hasOwnProperty.call(e.attributes,s)&&r.setAttribute(s,e.attributes[s]);return r}});const Pe=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};{const t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new v("Invalid size: '"+e+"' in \\includegraphics");const r={number:+(t[1]+t[2]),unit:t[3]};if(!Kt(r))throw new v("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r}};S({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:({parser:e,token:t},r,o)=>{let s={number:0,unit:"em"},i={number:.9,unit:"em"},l={number:0,unit:"em"},c="";if(o[0]){const k=D(o[0],"raw").string.split(",");for(let x=0;x<k.length;x++){const y=k[x].split("=");if(y.length===2){const _=y[1].trim();switch(y[0].trim()){case"alt":c=_;break;case"width":s=Pe(_);break;case"height":i=Pe(_);break;case"totalheight":l=Pe(_);break;default:throw new v("Invalid key: '"+y[0]+"' in \\includegraphics.")}}}}const h=D(r[0],"url").url;if(c===""&&(c=h,c=c.replace(/^.*[\\/]/,""),c=c.substring(0,c.lastIndexOf("."))),!e.settings.isTrusted({command:"\\includegraphics",url:h}))throw new v('Function "\\includegraphics" is not trusted',t);return{type:"includegraphics",mode:e.mode,alt:c,width:s,height:i,totalheight:l,src:h}},mathmlBuilder:(e,t)=>{const r=Q(e.height,t),o={number:0,unit:"em"};e.totalheight.number>0&&e.totalheight.unit===r.unit&&e.totalheight.number>r.number&&(o.number=e.totalheight.number-r.number,o.unit=r.unit);let s=0;e.width.number>0&&(s=Q(e.width,t));const i={height:r.number+o.number+"em"};s.number>0&&(i.width=s.number+s.unit),o.number>0&&(i.verticalAlign=-o.number+o.unit);const l=new Lr(e.src,e.alt,i);return l.height=r,l.depth=o,new p("mtext",[l])}});S({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler({parser:e,funcName:t,token:r},o){const s=D(o[0],"size");if(e.settings.strict){const i=t[1]==="m",l=s.value.unit==="mu";if(i){if(!l)throw new v(`LaTeX's ${t} supports only mu units, not ${s.value.unit} units`,r);if(e.mode!=="math")throw new v(`LaTeX's ${t} works only in math mode`,r)}else if(l)throw new v(`LaTeX's ${t} doesn't support mu units`,r)}return{type:"kern",mode:e.mode,dimension:s.value}},mathmlBuilder(e,t){const r=Q(e.dimension,t),o=r.number>0&&r.unit==="em"?mr(r.number):"";if(e.mode==="text"&&o.length>0){const s=new j(o);return new p("mtext",[s])}else if(r.number>=0){const s=new p("mspace");return s.setAttribute("width",r.number+r.unit),s}else{const s=new p("mrow");return s.style.marginLeft=r.number+r.unit,s}}});const mr=function(e){return e>=.05555&&e<=.05556?"":e>=.1666&&e<=.1667?"":e>=.2222&&e<=.2223?"":e>=.2777&&e<=.2778?"":""},hr=/[^A-Za-z_0-9-]/g;S({type:"label",names:["\\label"],props:{numArgs:1,argTypes:["raw"]},handler({parser:e},t){return{type:"label",mode:e.mode,string:t[0].string.replace(hr,"")}},mathmlBuilder(e,t){const r=new p("mrow",[],["tml-label"]);return e.string.length>0&&r.setLabel(e.string),r}});const kn=["\\clap","\\llap","\\rlap"];S({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap","\\clap","\\llap","\\rlap"],props:{numArgs:1,allowedInText:!0},handler:({parser:e,funcName:t,token:r},o)=>{if(kn.includes(t)){if(e.settings.strict&&e.mode!=="text")throw new v(`{${t}} can be used only in text mode.
Try \\math${t.slice(1)}`,r);t=t.slice(1)}else t=t.slice(5);const s=o[0];return{type:"lap",mode:e.mode,alignment:t,body:s}},mathmlBuilder:(e,t)=>{let r;if(e.alignment==="llap"){const i=U(R(e.body),t),l=new p("mphantom",i);r=new p("mpadded",[l]),r.setAttribute("width","0.1px")}const o=E(e.body,t);let s;if(e.alignment==="llap"?(o.style.position="absolute",o.style.right="0",o.style.bottom="0",s=new p("mpadded",[r,o])):s=new p("mpadded",[o]),e.alignment==="rlap")e.body.body.length>0&&e.body.body[0].type==="genfrac"&&s.setAttribute("lspace","0.16667em");else{const i=e.alignment==="llap"?"-1":"-0.5";s.setAttribute("lspace",i+"width"),e.alignment==="llap"?s.style.position="relative":(s.style.display="flex",s.style.justifyContent="center")}return s.setAttribute("width","0.1px"),s}});S({type:"ordgroup",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:t},r){const o=t.mode;t.switchMode("math");const s=e==="\\("?"\\)":"$",i=t.parseExpression(!1,s);return t.expect(s),t.switchMode(o),{type:"ordgroup",mode:t.mode,body:i}}});S({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new v(`Mismatched ${e.funcName}`,t)}});const An=(e,t)=>{switch(t.level){case M.DISPLAY:return e.display;case M.TEXT:return e.text;case M.SCRIPT:return e.script;case M.SCRIPTSCRIPT:return e.scriptscript;default:return e.text}};S({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:({parser:e},t)=>({type:"mathchoice",mode:e.mode,display:R(t[0]),text:R(t[1]),script:R(t[2]),scriptscript:R(t[3])}),mathmlBuilder:(e,t)=>{const r=An(e,t);return ne(r,t)}});const Sn=["text","textord","mathord","atom"];function pr(e,t){let r;const o=U(e.body,t);if(e.mclass==="minner")r=new p("mpadded",o);else if(e.mclass==="mord")e.isCharacterBox||o[0].type==="mathord"?(r=o[0],r.type="mi",r.children.length===1&&r.children[0].text&&r.children[0].text==="∇"&&r.setAttribute("mathvariant","normal")):r=new p("mi",o);else{r=new p("mrow",o),e.mustPromote?(r=o[0],r.type="mo",e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&r.setAttribute("mathvariant","italic")):r=new p("mrow",o);const s=t.level<2;r.type==="mrow"?s&&(e.mclass==="mbin"?(r.children.unshift(N(.2222)),r.children.push(N(.2222))):e.mclass==="mrel"?(r.children.unshift(N(.2778)),r.children.push(N(.2778))):e.mclass==="mpunct"?r.children.push(N(.1667)):e.mclass==="minner"&&(r.children.unshift(N(.0556)),r.children.push(N(.0556)))):e.mclass==="mbin"?(r.attributes.lspace=s?"0.2222em":"0",r.attributes.rspace=s?"0.2222em":"0"):e.mclass==="mrel"?(r.attributes.lspace=s?"0.2778em":"0",r.attributes.rspace=s?"0.2778em":"0"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace=s?"0.1667em":"0"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&s&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em"),e.mclass==="mopen"||e.mclass==="mclose"||(delete r.attributes.stretchy,delete r.attributes.form)}return r}S({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:t},r){const o=r[0],s=Be(o);let i=!0;const l={type:"mathord",text:"",mode:e.mode},c=o.body?o.body:[o];for(const h of c)if(Sn.includes(h.type))P[e.mode][h.text]?l.text+=P[e.mode][h.text].replace:h.text?l.text+=h.text:h.body&&h.body.map(f=>{l.text+=f.text});else{i=!1;break}return i&&t==="\\mathord"&&l.type==="mathord"&&l.text.length>1?l:{type:"mclass",mode:e.mode,mclass:"m"+t.slice(5),body:R(i?l:o),isCharacterBox:s,mustPromote:i}},mathmlBuilder:pr});const fr=e=>{const t=e.type==="ordgroup"&&e.body.length&&e.body.length===1?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};S({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler({parser:e},t){return{type:"mclass",mode:e.mode,mclass:fr(t[0]),body:R(t[1]),isCharacterBox:Be(t[1])}}});S({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler({parser:e,funcName:t},r){const o=r[1],s=r[0];let i;t!=="\\stackrel"?i=fr(o):i="mrel";const c={type:i==="mrel"||i==="mbin"?"op":"ordgroup",mode:o.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:t!=="\\stackrel",body:R(o)};return{type:"supsub",mode:s.mode,stack:!0,base:c,sup:t==="\\underset"?null:s,sub:t==="\\underset"?s:null}},mathmlBuilder:pr});const Ae=(e,t,r)=>{if(!e)return r;const o=E(e,t);return o.type==="mrow"&&o.children.length===0?r:o};S({type:"multiscript",names:["\\sideset","\\pres@cript"],props:{numArgs:3},handler({parser:e,funcName:t,token:r},o){if(o[2].body.length===0)throw new v(t+"cannot parse an empty base.");const s=o[2].body[0];if(e.settings.strict&&t==="\\sideset"&&!s.symbol)throw new v("The base of \\sideset must be a big operator. Try \\prescript.");if(o[0].body.length>0&&o[0].body[0].type!=="supsub"||o[1].body.length>0&&o[1].body[0].type!=="supsub")throw new v("\\sideset can parse only subscripts and superscripts in its first two arguments",r);const i=o[0].body.length>0?o[0].body[0]:null,l=o[1].body.length>0?o[1].body[0]:null;return!i&&!l?s:i?{type:"multiscript",mode:e.mode,isSideset:t==="\\sideset",prescripts:i,postscripts:l,base:s}:{type:"styling",mode:e.mode,scriptLevel:"text",body:[{type:"supsub",mode:e.mode,base:s,sup:l.sup,sub:l.sub}]}},mathmlBuilder(e,t){const r=E(e.base,t),o=new p("mprescripts"),s=new p("none");let i=[];const l=Ae(e.prescripts.sub,t,s),c=Ae(e.prescripts.sup,t,s);if(e.isSideset&&(l.setAttribute("style","text-align: left;"),c.setAttribute("style","text-align: left;")),e.postscripts){const h=Ae(e.postscripts.sub,t,s),f=Ae(e.postscripts.sup,t,s);i=[r,h,f,o,l,c]}else i=[r,o,l,c];return new p("mmultiscripts",i)}});S({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){const r=Be(t[0]);let o;return r?(o=R(t[0]),o[0].text.charAt(0)==="\\"&&(o[0].text=P.math[o[0].text].replace),o[0].text=o[0].text.slice(0,1)+"̸"+o[0].text.slice(1)):o=[{type:"textord",mode:"math",text:"̸"},{type:"kern",mode:"math",dimension:{number:-.6,unit:"em"}},t[0]],{type:"not",mode:e.mode,body:o,isCharacterBox:r}},mathmlBuilder(e,t){return e.isCharacterBox?U(e.body,t,!0)[0]:ne(e.body,t)}});const qn=["textord","mathord","atom"],_n=["\\smallint"],it=["textord","mathord","ordgroup","close","leftright","font"],Ot=e=>{e.attributes.lspace="0.1667em",e.attributes.rspace="0.1667em"},we=(e,t)=>{let r;if(e.symbol)r=new p("mo",[W(e.name,e.mode)]),_n.includes(e.name)?r.setAttribute("largeop","false"):r.setAttribute("movablelimits","false"),e.fromMathOp&&Ot(r);else if(e.body)r=new p("mo",U(e.body,t)),e.fromMathOp&&Ot(r);else if(r=new p("mi",[new j(e.name.slice(1))]),!e.parentIsSupSub){const o=new p("mo",[W("","text")]),s=[r,o];if(e.needsLeadingSpace){const i=new p("mspace");i.setAttribute("width","0.1667em"),s.unshift(i)}if(!e.isFollowedByDelimiter){const i=new p("mspace");i.setAttribute("width","0.1667em"),s.push(i)}r=new p("mrow",s)}return r},Tn={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","":"\\bigvee","⋂":"\\bigcap","":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨅":"\\bigsqcap","⨆":"\\bigsqcup","⨃":"\\bigcupdot","⨇":"\\bigdoublevee","⨈":"\\bigdoublewedge","⨉":"\\bigtimes"};S({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 o=t;return o.length===1&&(o=Tn[o]),{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:o}},mathmlBuilder:we});S({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:({parser:e},t)=>{const r=t[0],o=r.body?r.body:[r],s=o.length===1&&qn.includes(o[0].type);return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:s,fromMathOp:!0,stack:!1,name:s?o[0].text:null,body:s?null:R(r)}},mathmlBuilder:we});const Cn={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint","∱":"\\intclockwise","∲":"\\varointclockwise","⨌":"\\iiiint","⨍":"\\intbar","⨎":"\\intBar","⨏":"\\fint","⨒":"\\rppolint","⨓":"\\scpolint","⨕":"\\pointint","⨖":"\\sqint","⨗":"\\intlarhk","⨘":"\\intx","⨙":"\\intcap","⨚":"\\intcup"};S({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,o=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:ze(o),needsLeadingSpace:r.length>0&&it.includes(r),name:t}},mathmlBuilder:we});S({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler({parser:e,funcName:t}){const r=e.prevAtomType,o=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:ze(o),needsLeadingSpace:r.length>0&&it.includes(r),name:t}},mathmlBuilder:we});S({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,allowedInArgument:!0},handler({parser:e,funcName:t}){let r=t;return r.length===1&&(r=Cn[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:r}},mathmlBuilder:we});const Dn=(e,t)=>{let r=U(e.body,t.withFont("mathrm")),o=!0;for(let i=0;i<r.length;i++){let l=r[i];if(l instanceof p)switch((l.type==="mrow"||l.type==="mpadded")&&l.children.length===1&&l.children[0]instanceof p&&(l=l.children[0]),l.type){case"mi":case"mn":case"ms":case"mtext":break;case"mspace":if(l.attributes.width){const c=l.attributes.width.replace("em",""),h=mr(Number(c));h===""?o=!1:r[i]=new p("mtext",[new j(h)])}break;case"mo":{const c=l.children[0];l.children.length===1&&c instanceof j?c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):o=!1;break}default:o=!1}else o=!1}if(o){const i=r.map(l=>l.toText()).join("");r=[new j(i)]}else if(r.length===1&&["mover","munder"].includes(r[0].type)&&(r[0].children[0].type==="mi"||r[0].children[0].type==="mtext")){if(r[0].children[0].type="mi",e.parentIsSupSub)return new p("mrow",r);{const i=new p("mo",[W("","text")]);return ae([r[0],i])}}let s;if(o?(s=new p("mi",r),r[0].text.length===1&&s.setAttribute("mathvariant","normal")):s=new p("mrow",r),!e.parentIsSupSub){const i=new p("mo",[W("","text")]),l=[s,i];if(e.needsLeadingSpace){const c=new p("mspace");c.setAttribute("width","0.1667em"),l.unshift(c)}if(!e.isFollowedByDelimiter){const c=new p("mspace");c.setAttribute("width","0.1667em"),l.push(c)}return ae(l)}return s};S({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const o=r[0],s=e.prevAtomType,i=e.gullet.future().text;return{type:"operatorname",mode:e.mode,body:R(o),alwaysHandleSupSub:t==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:ze(i),needsLeadingSpace:s.length>0&&it.includes(s)}},mathmlBuilder:Dn});u("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");se({type:"ordgroup",mathmlBuilder(e,t){return ne(e.body,t,e.semisimple)}});S({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{const r=t[0];return{type:"phantom",mode:e.mode,body:R(r)}},mathmlBuilder:(e,t)=>{const r=U(e.body,t);return new p("mphantom",r)}});S({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=U(R(e.body),t),o=new p("mphantom",r),s=new p("mpadded",[o]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});S({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=U(R(e.body),t),o=new p("mphantom",r),s=new p("mpadded",[o]);return s.setAttribute("width","0px"),s}});S({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler({parser:e},t){return{type:"pmb",mode:e.mode,body:R(t[0])}},mathmlBuilder(e,t){const r=U(e.body,t),o=Qe(r);return o.setAttribute("style","font-weight:bold"),o}});const gr=(e,t)=>{const r=t.withLevel(M.TEXT),o=new p("mpadded",[E(e.body,r)]),s=Q(e.dy,t);return o.setAttribute("voffset",s.number+s.unit),s.number>0?o.style.padding=s.number+s.unit+" 0 0 0":o.style.padding="0 0 "+Math.abs(s.number)+s.unit+" 0",o};S({type:"raise",names:["\\raise","\\lower"],props:{numArgs:2,argTypes:["size","primitive"],primitive:!0},handler({parser:e,funcName:t},r){const o=D(r[0],"size").value;t==="\\lower"&&(o.number*=-1);const s=r[1];return{type:"raise",mode:e.mode,dy:o,body:s}},mathmlBuilder:gr});S({type:"raise",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler({parser:e,funcName:t},r){const o=D(r[0],"size").value,s=r[1];return{type:"raise",mode:e.mode,dy:o,body:s}},mathmlBuilder:gr});S({type:"ref",names:["\\ref","\\eqref"],props:{numArgs:1,argTypes:["raw"]},handler({parser:e,funcName:t},r){return{type:"ref",mode:e.mode,funcName:t,string:r[0].string.replace(hr,"")}},mathmlBuilder(e,t){const r=e.funcName==="\\ref"?["tml-ref"]:["tml-ref","tml-eqref"];return new Zt("#"+e.string,r,null)}});S({type:"reflect",names:["\\reflectbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler({parser:e},t){return{type:"reflect",mode:e.mode,body:t[0]}},mathmlBuilder(e,t){const r=E(e.body,t);return r.style.transform="scaleX(-1)",r}});S({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler({parser:e}){return{type:"internal",mode:e.mode}}});S({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler({parser:e},t,r){const o=r[0],s=D(t[0],"size"),i=D(t[1],"size");return{type:"rule",mode:e.mode,shift:o&&D(o,"size").value,width:s.value,height:i.value}},mathmlBuilder(e,t){const r=Q(e.width,t),o=Q(e.height,t),s=e.shift?Q(e.shift,t):{number:0,unit:"em"},i=t.color&&t.getColor()||"black",l=new p("mspace");if(r.number>0&&o.number>0&&l.setAttribute("mathbackground",i),l.setAttribute("width",r.number+r.unit),l.setAttribute("height",o.number+o.unit),s.number===0)return l;const c=new p("mpadded",[l]);return s.number>=0?c.setAttribute("height","+"+s.number+s.unit):(c.setAttribute("height",s.number+s.unit),c.setAttribute("depth","+"+-s.number+s.unit)),c.setAttribute("voffset",s.number+s.unit),c}});const Et=/^[0-9]$/,Bn={0:"₀",1:"₁",2:"₂",3:"₃",4:"₄",5:"₅",6:"₆",7:"₇",8:"₈",9:"₉"},$n={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹"};S({type:"sfrac",names:["\\sfrac"],props:{numArgs:2,allowedInText:!0,allowedInMath:!0},handler({parser:e},t){let r="";for(const s of t[0].body){if(s.type!=="textord"||!Et.test(s.text))throw new v("Numerator must be an integer.",s);r+=s.text}let o="";for(const s of t[1].body){if(s.type!=="textord"||!Et.test(s.text))throw new v("Denominator must be an integer.",s);o+=s.text}return{type:"sfrac",mode:e.mode,numerator:r,denominator:o}},mathmlBuilder(e,t){const r=e.numerator.split("").map(i=>$n[i]).join(""),o=e.denominator.split("").map(i=>Bn[i]).join(""),s=new j(r+""+o,e.mode,t);return new p("mn",[s],["special-fraction"])}});const zt={"\\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};S({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},o)=>{r.settings.strict&&r.mode==="math"&&console.log(`Temml strict-mode warning: Command ${t} is invalid in math mode.`);const s=r.parseExpression(!1,e,!0);return{type:"sizing",mode:r.mode,funcName:t,body:s}},mathmlBuilder:(e,t)=>{const r=t.withFontSize(zt[e.funcName]),o=U(e.body,r),s=Qe(o),i=(zt[e.funcName]/t.fontSize).toFixed(4);return s.setAttribute("mathsize",i+"em"),s}});S({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},t,r)=>{let o=!1,s=!1;const i=r[0]&&D(r[0],"ordgroup");if(i){let c="";for(let h=0;h<i.body.length;++h)if(c=i.body[h].text,c==="t")o=!0;else if(c==="b")s=!0;else{o=!1,s=!1;break}}else o=!0,s=!0;const l=t[0];return{type:"smash",mode:e.mode,body:l,smashHeight:o,smashDepth:s}},mathmlBuilder:(e,t)=>{const r=new p("mpadded",[E(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}});const On=["a","c","e","ı","m","n","o","r","s","u","v","w","x","z","α","ε","ι","κ","ν","ο","π","σ","τ","υ","ω","\\alpha","\\epsilon","\\iota","\\kappa","\\nu","\\omega","\\pi","\\tau","\\omega"];S({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},t,r){const o=r[0],s=t[0];return s.body&&s.body.length===1&&s.body[0].text&&On.includes(s.body[0].text)&&s.body.push({type:"rule",mode:"math",shift:null,width:{number:0,unit:"pt"},height:{number:.5,unit:"em"}}),{type:"sqrt",mode:e.mode,body:s,index:o}},mathmlBuilder(e,t){const{body:r,index:o}=e;return o?new p("mroot",[E(r,t),E(o,t.incrementLevel())]):new p("msqrt",[E(r,t)])}});const En={display:0,text:1,script:2,scriptscript:3},zn={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};S({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:t,parser:r},o){const s=r.parseExpression(!0,e,!0),i=t.slice(1,t.length-5);return{type:"styling",mode:r.mode,scriptLevel:i,body:s}},mathmlBuilder(e,t){const r=t.withLevel(En[e.scriptLevel]),o=U(e.body,r),s=Qe(o),i=zn[e.scriptLevel];return s.setAttribute("scriptlevel",i[0]),s.setAttribute("displaystyle",i[1]),s}});const Ln=/^m(over|under|underover)$/,Fn="DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ",In="BCEFGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ",Nn="AJdfΔΛ";se({type:"supsub",mathmlBuilder(e,t){let r=!1,o,s,i=!1,l=!1,c=!1;e.base&&e.base.type==="horizBracket"&&(s=!!e.sup,s===e.base.isOver&&(r=!0,o=e.base.isOver)),e.base&&!e.stack&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0,i=!e.base.symbol,l=i&&!e.isFollowedByDelimiter,c=e.base.needsLeadingSpace);const h=e.stack&&e.base.body.length===1?[E(e.base.body[0],t)]:[E(e.base,t)],f=t.inSubOrSup();if(e.sub){const y=E(e.sub,f);t.level===3&&y.setAttribute("scriptlevel","2"),h.push(y)}if(e.sup){const y=E(e.sup,f);if(t.level===3&&y.setAttribute("scriptlevel","2"),e.base&&e.base.text&&e.base.text.length===1){const _=e.base.text;Fn.indexOf(_)>-1?y.classes.push("tml-sml-pad"):In.indexOf(_)>-1?y.classes.push("tml-med-pad"):Nn.indexOf(_)>-1&&y.classes.push("tml-lrg-pad")}h.push(y)}let k;if(r)k=o?"mover":"munder";else if(e.sub)if(e.sup){const y=e.base;y&&(y.type==="op"&&y.limits||y.type==="multiscript")&&(t.level===M.DISPLAY||y.alwaysHandleSupSub)||y&&y.type==="operatorname"&&y.alwaysHandleSupSub&&(t.level===M.DISPLAY||y.limits)?k="munderover":k="msubsup"}else{const y=e.base;e.stack||y&&y.type==="op"&&y.limits&&(t.level===M.DISPLAY||y.alwaysHandleSupSub)||y&&y.type==="operatorname"&&y.alwaysHandleSupSub&&(y.limits||t.level===M.DISPLAY)?k="munder":k="msub"}else{const y=e.base;y&&y.type==="op"&&y.limits&&(t.level===M.DISPLAY||y.alwaysHandleSupSub)||y&&y.type==="operatorname"&&y.alwaysHandleSupSub&&(y.limits||t.level===M.DISPLAY)?k="mover":k="msup"}let x=new p(k,h);if(i){const y=new p("mo",[W("","text")]);if(c){const _=new p("mspace");_.setAttribute("width","0.1667em"),x=ae([_,x,y])}else x=ae([x,y]);if(l){const _=new p("mspace");_.setAttribute("width","0.1667em"),x.children.push(_)}}else Ln.test(k)&&(x=new p("mrow",[x]));return x}});const Mn=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],Pn=["\\Rsh","\\Lsh","\\restriction"],Gn=e=>{if(e.length===1){const t=e.codePointAt(0);return 8591<t&&t<8704}return e.indexOf("arrow")>-1||e.indexOf("harpoon")>-1||Pn.includes(e)};se({type:"atom",mathmlBuilder(e,t){const r=new p("mo",[W(e.text,e.mode)]);if(e.family==="punct")r.setAttribute("separator","true");else if(e.family==="open"||e.family==="close")e.family==="open"?(r.setAttribute("form","prefix"),r.setAttribute("stretchy","false")):e.family==="close"&&(r.setAttribute("form","postfix"),r.setAttribute("stretchy","false"));else if(e.text==="\\mid")r.setAttribute("lspace","0.22em"),r.setAttribute("rspace","0.22em"),r.setAttribute("stretchy","false");else if(e.family==="rel"&&Gn(e.text))r.setAttribute("stretchy","false");else if(Mn.includes(e.text))r.setAttribute("mathsize","70%");else if(e.text===":")r.attributes.lspace="0.2222em",r.attributes.rspace="0.2222em";else if(e.needsSpacing)return e.family==="bin"?new p("mrow",[N(.222),r,N(.222)]):new p("mrow",[N(.2778),r,N(.2778)]);return r}});const Lt={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},br=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsc")return"normal";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"sans-serif-bold":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";const r=t.font;if(!r||r==="mathnormal")return null;const o=e.mode;switch(r){case"mathit":return"italic";case"mathrm":{const i=e.text.codePointAt(0);return 939<i&&i<975?"italic":"normal"}case"greekItalic":return"italic";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 s=e.text;return P[o][s]&&P[o][s].replace&&(s=P[o][s].replace),Object.prototype.hasOwnProperty.call(Lt,r)?Lt[r]:null},Ft=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),Rn=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),jn=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),xr=Object.freeze({"ϵ":119527,ϑ:119564,ϰ:119534,φ:119577,ϱ:119535,ϖ:119563}),Un=Object.freeze({"ϵ":119643,ϑ:119680,ϰ:119650,φ:119693,ϱ:119651,ϖ:119679}),It=Object.freeze({"ϵ":119701,ϑ:119738,ϰ:119708,φ:119751,ϱ:119709,ϖ:119737}),Vn=Object.freeze({"ϵ":119759,ϑ:119796,ϰ:119766,φ:119809,ϱ:119767,ϖ:119795}),Wn=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>Ft[e]||119899,"script-bold":e=>119951,fraktur:e=>Rn[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>jn[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=>e==="h"?8358:119789,"bold-italic":e=>119841,script:e=>Ft[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=>xr[e]||-51,italic:e=>0,"bold-italic":e=>Un[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>It[e]||116,"sans-serif-bold":e=>It[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>Vn[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}}),he=(e,t)=>{const r=e.codePointAt(0),o=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||xr[e]?"varGreek":47<r&&r<58?"numeral":"other";return o==="other"?e:String.fromCodePoint(r+Wn[o][t](e))},Hn=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:""}),Zn=/^\d(?:[\d,.]*\d)?$/,Xn=/[A-Ba-z]/,Yn=new Set(["\\prime","\\dprime","\\trprime","\\qprime","\\backprime","\\backdprime","\\backtrprime"]),Kn=(e,t,r)=>{const o=new p(r,[e]),s=new p("mstyle",[o]);return s.style["font-style"]="italic",s.style["font-family"]="Cambria, 'Times New Roman', serif",t==="bold-italic"&&(s.style["font-weight"]="bold"),s};se({type:"mathord",mathmlBuilder(e,t){const r=W(e.text,e.mode,t),o=r.text.codePointAt(0),s=912<o&&o<938?"normal":"italic",i=br(e,t)||s;if(i==="script")return r.text=he(r.text,i),new p("mi",[r],[t.font]);i!=="italic"&&(r.text=he(r.text,i));let l=new p("mi",[r]);return i==="normal"&&(l.setAttribute("mathvariant","normal"),r.text.length===1&&(l=new p("mpadded",[l]),l.setAttribute("lspace","0"))),l}});se({type:"textord",mathmlBuilder(e,t){let r=e.text;const o=r.codePointAt(0);t.fontFamily==="textsc"&&96<o&&o<123&&(r=Hn[r]);const s=W(r,e.mode,t),i=br(e,t)||"normal";let l;if(Zn.test(e.text)){const c=e.mode==="text"?"mtext":"mn";if(i==="italic"||i==="bold-italic")return Kn(s,i,c);i!=="normal"&&(s.text=s.text.split("").map(h=>he(h,i)).join("")),l=new p(c,[s])}else if(e.mode==="text")i!=="normal"&&(s.text=he(s.text,i)),l=new p("mtext",[s]);else if(Yn.has(e.text))l=new p("mo",[s]),l.classes.push("tml-prime");else{const c=s.text;i!=="italic"&&(s.text=he(s.text,i)),l=new p("mi",[s]),s.text===c&&Xn.test(c)&&l.setAttribute("mathvariant","italic")}return l}});const Jn={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Qn={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};se({type:"spacing",mathmlBuilder(e,t){let r;if(Object.prototype.hasOwnProperty.call(Qn,e.text))r=new p("mtext",[new j(" ")]);else if(Object.prototype.hasOwnProperty.call(Jn,e.text))r=new p("mo"),e.text==="\\nobreak"&&r.setAttribute("linebreak","nobreak");else throw new v(`Unknown type of space "${e.text}"`);return r}});se({type:"tag"});const Nt={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},Mt={"\\textbf":"textbf","\\textmd":"textmd"},eo={"\\textit":"textit","\\textup":"textup"},to=(e,t)=>{const r=e.font;if(r){if(Nt[r])return t.withTextFontFamily(Nt[r]);if(Mt[r])return t.withTextFontWeight(Mt[r]);if(r==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(eo[r])};S({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 o=r[0];return{type:"text",mode:e.mode,body:R(o),font:t}},mathmlBuilder(e,t){const r=to(e,t),o=ne(e.body,r);return $e(o)}});S({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler({parser:e},t){return{type:"vcenter",mode:e.mode,body:t[0]}},mathmlBuilder(e,t){const r=new p("mtd",[E(e.body,t)]);r.style.padding="0";const o=new p("mtr",[r]);return new p("mtable",[o])}});S({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,r){throw new v("\\verb ended by end of line instead of matching delimiter")},mathmlBuilder(e,t){const r=new j(ro(e)),o=new p("mtext",[r]);return o.setAttribute("mathvariant","monospace"),o}});const ro=e=>e.body.replace(/ /g,e.star?"␣":" "),oe=Wt,yr=`[ \r
]`,no="\\\\[a-zA-Z@]+",oo="\\\\[^\uD800-\uDFFF]",ao=`(${no})${yr}*`,so=`\\\\(
|[ \r ]+
?)[ \r ]*`,Xe="[̀-ͯ]",Pt=new RegExp(`${Xe}+$`),io=`(${yr}+)|${so}|([!-\\[\\]-‧‪-퟿豈-￿]${Xe}*|[\uD800-\uDBFF][\uDC00-\uDFFF]${Xe}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${ao}|${oo})`;class Gt{constructor(t,r){this.input=t,this.settings=r,this.tokenRegex=new RegExp(io,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){const t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new J("EOF",new V(this,r,r));const o=this.tokenRegex.exec(t);if(o===null||o.index!==r)throw new v(`Unexpected character: '${t[r]}'`,new J(t[r],new V(this,r,r+1)));const s=o[6]||o[3]||(o[2]?"\\ ":" ");if(this.catcodes[s]===14){const i=t.indexOf(`
`,this.tokenRegex.lastIndex);if(i===-1){if(this.tokenRegex.lastIndex=t.length,this.settings.strict)throw new v("% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode")}else this.tokenRegex.lastIndex=i+1;return this.lex()}return new J(s,new V(this,r,this.tokenRegex.lastIndex))}}class lo{constructor(t={},r={}){this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new v("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");const t=this.undefStack.pop();for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]===void 0?delete this.current[r]:this.current[r]=t[r])}has(t){return Object.prototype.hasOwnProperty.call(this.current,t)||Object.prototype.hasOwnProperty.call(this.builtins,t)}get(t){return Object.prototype.hasOwnProperty.call(this.current,t)?this.current[t]:this.builtins[t]}set(t,r,o=!1){if(o){for(let s=0;s<this.undefStack.length;s++)delete this.undefStack[s][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{const s=this.undefStack[this.undefStack.length-1];s&&!Object.prototype.hasOwnProperty.call(s,t)&&(s[t]=this.current[t])}this.current[t]=r}}const wr={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class uo{constructor(t,r,o){this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new lo(an,r.macros),this.mode=o,this.stack=[]}feed(t){this.lexer=new Gt(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){let r,o,s;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:s,end:o}=this.consumeArg(["]"])}else({tokens:s,start:r,end:o}=this.consumeArg());return this.pushToken(new J("EOF",o.loc)),this.pushTokens(s),r.range(o,"")}consumeSpaces(){for(;this.future().text===" ";)this.stack.pop()}consumeArg(t){const r=[],o=t&&t.length>0;o||this.consumeSpaces();const s=this.future();let i,l=0,c=0;do{if(i=this.popToken(),r.push(i),i.text==="{")++l;else if(i.text==="}"){if(--l,l===-1)throw new v("Extra }",i)}else if(i.text==="EOF")throw new v("Unexpected end of input in a macro argument, expected '"+(t&&o?t[c]:"}")+"'",i);if(t&&o)if((l===0||l===1&&t[c]==="{")&&i.text===t[c]){if(++c,c===t.length){r.splice(-c,c);break}}else c=0}while(l!==0||o);return s.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:s,end:i}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new v("The length of delimiters doesn't match the number of args!");const s=r[0];for(let i=0;i<s.length;i++){const l=this.popToken();if(s[i]!==l.text)throw new v("Use of the macro doesn't match its definition",l)}}const o=[];for(let s=0;s<t;s++)o.push(this.consumeArg(r&&r[s+1]).tokens);return o}expandOnce(t){const r=this.popToken(),o=r.text,s=r.noexpand?null:this._getExpansion(o);if(s==null||t&&s.unexpandable){if(t&&s==null&&o[0]==="\\"&&!this.isDefined(o))throw new v("Undefined control sequence: "+o);return this.pushToken(r),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new v("Too many expansions: infinite loop or need to increase maxExpand setting");let i=s.tokens;const l=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(let c=i.length-1;c>=0;--c){let h=i[c];if(h.text==="#"){if(c===0)throw new v("Incomplete placeholder at end of macro body",h);if(h=i[--c],h.text==="#")i.splice(c+1,1);else if(/^[1-9]$/.test(h.text))i.splice(c,2,...l[+h.text-1]);else throw new v("Not a valid argument number",h)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){const t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new J(t)]):void 0}expandTokens(t){const r=[],o=this.stack.length;for(this.pushTokens(t);this.stack.length>o;)if(this.expandOnce(!0)===!1){const s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),r.push(s)}return r}expandMacroAsText(t){const r=this.expandMacro(t);return r&&r.map(o=>o.text).join("")}_getExpansion(t){const r=this.macros.get(t);if(r==null)return r;if(t.length===1){const s=this.lexer.catcodes[t];if(s!=null&&s!==13)return}const o=typeof r=="function"?r(this):r;if(typeof o=="string"){let s=0;if(o.indexOf("#")!==-1){const f=o.replace(/##/g,"");for(;f.indexOf("#"+(s+1))!==-1;)++s}const i=new Gt(o,this.settings),l=[];let c=i.lex();for(;c.text!=="EOF";)l.push(c),c=i.lex();return l.reverse(),{tokens:l,numArgs:s}}return o}isDefined(t){return this.macros.has(t)||Object.prototype.hasOwnProperty.call(oe,t)||Object.prototype.hasOwnProperty.call(P.math,t)||Object.prototype.hasOwnProperty.call(P.text,t)||Object.prototype.hasOwnProperty.call(wr,t)}isExpandable(t){const r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Object.prototype.hasOwnProperty.call(oe,t)&&!oe[t].primitive}}const Rt=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Se=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),jt=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 Ge={"́":{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"}},Ut={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",:"ắ",:"ằ",:"ẵ",ǎ:"ǎ",â:"â",:"ấ",:"ầ",:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",:"ḃ",ć:"ć",č:"č",ĉ:"ĉ",ċ:"ċ",ď:"ď",:"ḋ",é:"é",è:"è",ë:"ë",:"ẽ",ē:"ē",:"ḗ",:"ḕ",ĕ:"ĕ",ě:"ě",ê:"ê",ế:"ế",:"ề",:"ễ",ė:"ė",:"ḟ",ǵ:"ǵ",:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",:"ḧ",ȟ:"ȟ",ĥ:"ĥ",:"ḣ",í:"í",ì:"ì",ï:"ï",:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",:"ḱ",ǩ:"ǩ",ĺ:"ĺ",ľ:"ľ",ḿ:"ḿ",:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",:"ṅ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",:"ṍ",:"ṏ",ȭ:"ȭ",ō:"ō",:"ṓ",:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",:"ố",:"ồ",:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",:"ṕ",:"ṗ",ŕ:"ŕ",ř:"ř",:"ṙ",ś:"ś",:"ṥ",š:"š",:"ṧ",ŝ:"ŝ",:"ṡ",:"ẗ",ť:"ť",:"ṫ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",:"ṹ",ū:"ū",:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",:"ṽ",:"ẃ",:"ẁ",:"ẅ",ŵ:"ŵ",:"ẇ",:"ẘ",:"ẍ",:"ẋ",ý:"ý",:"ỳ",ÿ:"ÿ",:"ỹ",ȳ:"ȳ",ŷ:"ŷ",:"ẏ",:"ẙ",ź:"ź",ž:"ž",:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",:"Ắ",:"Ằ",:"Ẵ",Ǎ:"Ǎ",Â:"Â",:"Ấ",:"Ầ",:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",:"Ḃ",Ć:"Ć",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ď:"Ď",:"Ḋ",É:"É",È:"È",Ë:"Ë",:"Ẽ",Ē:"Ē",:"Ḗ",:"Ḕ",Ĕ:"Ĕ",Ě:"Ě",Ê:"Ê",:"Ế",:"Ề",:"Ễ",Ė:"Ė",:"Ḟ",Ǵ:"Ǵ",:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",:"Ḣ",Í:"Í",Ì:"Ì",Ï:"Ï",:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",:"Ḱ",Ǩ:"Ǩ",Ĺ:"Ĺ",Ľ:"Ľ",:"Ḿ",:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",:"Ṅ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",:"Ṍ",:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",:"Ṓ",:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",:"Ố",:"Ồ",:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",:"Ṕ",:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",:"Ṙ",Ś:"Ś",:"Ṥ",Š:"Š",:"Ṧ",Ŝ:"Ŝ",:"Ṡ",Ť:"Ť",:"Ṫ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",:"Ṹ",Ū:"Ū",:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",:"Ṽ",:"Ẃ",:"Ẁ",:"Ẅ",Ŵ:"Ŵ",:"Ẇ",:"Ẍ",:"Ẋ",Ý:"Ý",:"Ỳ",Ÿ:"Ÿ",:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",:"Ẏ",Ź:"Ź",Ž:"Ž",:"Ẑ",Ż:"Ż",ά:"ά",:"ὰ",:"ᾱ",:"ᾰ",έ:"έ",:"ὲ",ή:"ή",:"ὴ",ί:"ί",:"ὶ",ϊ:"ϊ",ΐ:"ΐ",:"ῒ",:"ῑ",:"ῐ",ό:"ό",:"ὸ",ύ:"ύ",:"ὺ",ϋ:"ϋ",ΰ:"ΰ",:"ῢ",:"ῡ",:"ῠ",ώ:"ώ",:"ὼ",Ύ:"Ύ",:"Ὺ",Ϋ:"Ϋ",:"Ῡ",:"Ῠ",Ώ:"Ώ",:"Ὼ"};const co=["bin","op","open","punct","rel"],mo=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,ho=/^ *\\text/;class Le{constructor(t,r,o=!1){this.mode="math",this.gullet=new uo(t,r,this.mode),this.settings=r,this.isPreamble=o,this.leftrightDepth=0,this.prevAtomType=""}expect(t,r=!0){if(this.fetch().text!==t)throw new v(`Expected '${t}', got '${this.fetch().text}'`,this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");const t=this.parseExpression(!1);if(this.expect("EOF"),this.isPreamble){const o=Object.create(null);return Object.entries(this.gullet.macros.current).forEach(([s,i])=>{o[s]=i}),this.gullet.endGroup(),o}const r=this.gullet.macros.get("\\df@tag");return this.gullet.endGroup(),r&&(this.gullet.macros.current["\\df@tag"]=r),t}static get endOfExpression(){return["}","\\endgroup","\\end","\\right","\\endtoggle","&"]}subparse(t){const r=this.nextToken;this.consume(),this.gullet.pushToken(new J("}")),this.gullet.pushTokens(t);const o=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,o}parseExpression(t,r,o){const s=[];for(this.prevAtomType="";;){this.mode==="math"&&this.consumeSpaces();const i=this.fetch();if(Le.endOfExpression.indexOf(i.text)!==-1||r&&i.text===r||o&&i.text==="\\middle"||t&&oe[i.text]&&oe[i.text].infix)break;const l=this.parseAtom(r);if(l){if(l.type==="internal")continue}else break;s.push(l),this.prevAtomType=l.type==="atom"?l.family:l.type}return this.mode==="text"&&this.formLigatures(s),this.handleInfixNodes(s)}handleInfixNodes(t){let r=-1,o;for(let s=0;s<t.length;s++)if(t[s].type==="infix"){if(r!==-1)throw new v("only one infix operator per group",t[s].token);r=s,o=t[s].replaceWith}if(r!==-1&&o){let s,i;const l=t.slice(0,r),c=t.slice(r+1);l.length===1&&l[0].type==="ordgroup"?s=l[0]:s={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?i=c[0]:i={type:"ordgroup",mode:this.mode,body:c};let h;return o==="\\\\abovefrac"?h=this.callFunction(o,[s,t[r],i],[]):h=this.callFunction(o,[s,i],[]),[h]}else return t}handleSupSubscript(t){const r=this.fetch(),o=r.text;this.consume(),this.consumeSpaces();let s;do s=this.parseGroup(t);while(s.type&&s.type==="internal");if(!s)throw new v("Expected group after '"+o+"'",r);return s}formatUnsupportedCmd(t){const r=[];for(let i=0;i<t.length;i++)r.push({type:"textord",mode:"text",text:t[i]});const o={type:"text",mode:this.mode,body:r};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[o]}}parseAtom(t){const r=this.parseGroup("atom",t);if(r&&r.type==="internal"||this.mode==="text")return r;let o,s;for(;;){this.consumeSpaces();const i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(r&&r.type==="op"){const l=i.text==="\\limits";r.limits=l,r.alwaysHandleSupSub=!0}else if(r&&r.type==="operatorname")r.alwaysHandleSupSub&&(r.limits=i.text==="\\limits");else throw new v("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(o)throw new v("Double superscript",i);o=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new v("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(o)throw new v("Double superscript",i);const l={type:"textord",mode:this.mode,text:"\\prime"},c=[l];for(this.consume();this.fetch().text==="'";)c.push(l),this.consume();this.fetch().text==="^"&&c.push(this.handleSupSubscript("superscript")),o={type:"ordgroup",mode:this.mode,body:c}}else if(Se[i.text]){const l=Rt.test(i.text),c=[];for(c.push(new J(Se[i.text])),this.consume();;){const f=this.fetch().text;if(!Se[f]||Rt.test(f)!==l)break;c.unshift(new J(Se[f])),this.consume()}const h=this.subparse(c);l?s={type:"ordgroup",mode:"math",body:h}:o={type:"ordgroup",mode:"math",body:h}}else break}if(o||s){if(r&&r.type==="multiscript"&&!r.postscripts)return r.postscripts={sup:o,sub:s},r;{const i=!r||r.type!=="op"&&r.type!=="operatorname"?void 0:ze(this.nextToken.text);return{type:"supsub",mode:this.mode,base:r,sup:o,sub:s,isFollowedByDelimiter:i}}}else return r}parseFunction(t,r){const o=this.fetch(),s=o.text,i=oe[s];if(!i)return null;if(this.consume(),r&&r!=="atom"&&!i.allowedInArgument)throw new v("Got function '"+s+"' with no arguments"+(r?" as "+r:""),o);if(this.mode==="text"&&!i.allowedInText)throw new v("Can't use function '"+s+"' in text mode",o);if(this.mode==="math"&&i.allowedInMath===!1)throw new v("Can't use function '"+s+"' in math mode",o);const l=this.prevAtomType,{args:c,optArgs:h}=this.parseArguments(s,i);return this.prevAtomType=l,this.callFunction(s,c,h,o,t)}callFunction(t,r,o,s,i){const l={funcName:t,parser:this,token:s,breakOnTokenText:i},c=oe[t];if(c&&c.handler)return c.handler(l,r,o);throw new v(`No function handler for ${t}`)}parseArguments(t,r){const o=r.numArgs+r.numOptionalArgs;if(o===0)return{args:[],optArgs:[]};const s=[],i=[];for(let l=0;l<o;l++){let c=r.argTypes&&r.argTypes[l];const h=l<r.numOptionalArgs;(r.primitive&&c==null||r.type==="sqrt"&&l===1&&i[0]==null)&&(c="primitive");const f=this.parseGroupOfType(`argument to '${t}'`,c,h);if(h)i.push(f);else if(f!=null)s.push(f);else throw new v("Null argument, please report this as a bug")}return{args:s,optArgs:i}}parseGroupOfType(t,r,o){switch(r){case"size":return this.parseSizeGroup(o);case"url":return this.parseUrlGroup(o);case"math":case"text":return this.parseArgumentGroup(o,r);case"hbox":{const s=this.parseArgumentGroup(o,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],scriptLevel:"text"}:null}case"raw":{const s=this.parseStringGroup("raw",o);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(o)throw new v("A primitive argument cannot be optional");const s=this.parseGroup(t);if(s==null)throw new v("Expected group as "+t,this.fetch());return s}case"original":case null:case void 0:return this.parseArgumentGroup(o);default:throw new v("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;;){const t=this.fetch().text;if(t===" "||t===" "||t==="")this.consume();else break}}parseStringGroup(t,r){const o=this.gullet.scanArgument(r);if(o==null)return null;let s="",i;for(;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),o.text=s,o}parseRegexGroup(t,r){const o=this.fetch();let s=o,i="",l;for(;(l=this.fetch()).text!=="EOF"&&t.test(i+l.text);)s=l,i+=s.text,this.consume();if(i==="")throw new v("Invalid "+r+": '"+o.text+"'",o);return o.range(s,i)}parseSizeGroup(t){let r,o=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?r=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):r=this.parseStringGroup("size",t),!r)return null;!t&&r.text.length===0&&(r.text="0pt",o=!0);const s=mo.exec(r.text);if(!s)throw new v("Invalid size: '"+r.text+"'",r);const i={number:+(s[1]+s[2]),unit:s[3]};if(!Kt(i))throw new v("Invalid unit: '"+i.unit+"'",r);return{type:"size",mode:this.mode,value:i,isBlank:o}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);const r=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),r==null)return null;let o=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return o=r.text.replace(/{\u2044}/g,"/"),{type:"url",mode:this.mode,url:o}}parseArgumentGroup(t,r){const o=this.gullet.scanArgument(t);if(o==null)return null;const s=this.mode;r&&this.switchMode(r),this.gullet.beginGroup();const i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();const l={type:"ordgroup",mode:this.mode,loc:o.loc,body:i};return r&&this.switchMode(s),l}parseGroup(t,r){const o=this.fetch(),s=o.text;let i;if(s==="{"||s==="\\begingroup"||s==="\\toggle"){this.consume();const l=s==="{"?"}":s==="\\begingroup"?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();const c=this.parseExpression(!1,l),h=this.fetch();this.expect(l),this.gullet.endGroup(),i={type:h.text==="\\endtoggle"?"toggle":"ordgroup",mode:this.mode,loc:V.range(o,h),body:c,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(r,t)||this.parseSymbol(),i==null&&s[0]==="\\"&&!Object.prototype.hasOwnProperty.call(wr,s)){if(this.settings.throwOnError)throw new v("Unsupported function name: "+s,o);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(t){let r=t.length-1;for(let o=0;o<r;++o){const s=t[o],i=s.text;i==="-"&&t[o+1].text==="-"&&(o+1<r&&t[o+2].text==="-"?(t.splice(o,3,{type:"textord",mode:"text",loc:V.range(s,t[o+2]),text:"---"}),r-=2):(t.splice(o,2,{type:"textord",mode:"text",loc:V.range(s,t[o+1]),text:"--"}),r-=1)),(i==="'"||i==="`")&&t[o+1].text===i&&(t.splice(o,2,{type:"textord",mode:"text",loc:V.range(s,t[o+1]),text:i+i}),r-=1)}}parseSymbol(){const t=this.fetch();let r=t.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();let i=r.slice(5);const l=i.charAt(0)==="*";if(l&&(i=i.slice(1)),i.length<2||i.charAt(0)!==i.slice(-1))throw new v(`\\verb assertion failed --
please report what input caused this bug`);return i=i.slice(1,-1),{type:"verb",mode:"text",body:i,star:l}}if(Object.prototype.hasOwnProperty.call(Ut,r[0])&&this.mode==="math"&&!P[this.mode][r[0]]){if(this.settings.strict&&this.mode==="math")throw new v(`Accented Unicode text character "${r[0]}" used in math mode`,t);r=Ut[r[0]]+r.slice(1)}const o=this.mode==="math"?Pt.exec(r):null;o&&(r=r.substring(0,o.index),r==="i"?r="ı":r==="j"&&(r="ȷ"));let s;if(P[this.mode][r]){let i=P[this.mode][r].group;i==="bin"&&co.includes(this.prevAtomType)&&(i="open");const l=V.range(t);let c;if(Object.prototype.hasOwnProperty.call(Nr,i)){const h=i;c={type:"atom",mode:this.mode,family:h,loc:l,text:r},(h==="rel"||h==="bin")&&this.prevAtomType==="text"&&ho.test(l.lexer.input.slice(l.end))&&(c.needsSpacing=!0)}else{if(jt[r]){this.consume();const h=this.fetch().text.charCodeAt(0),f=h===65025?"mathscr":"mathcal";return(h===65024||h===65025)&&this.consume(),{type:"font",mode:"math",font:f,body:{type:"mathord",mode:"math",loc:l,text:jt[r]}}}c={type:i,mode:this.mode,loc:l,text:r}}s=c}else if(r.charCodeAt(0)>=128||Pt.exec(r)){if(this.settings.strict&&this.mode==="math")throw new v(`Unicode text character "${r[0]}" used in math mode`,t);s={type:"textord",mode:"text",loc:V.range(t),text:r}}else return null;if(this.consume(),o)for(let i=0;i<o[0].length;i++){const l=o[0][i];if(!Ge[l])throw new v(`Unknown accent ' ${l}'`,t);const c=Ge[l][this.mode]||Ge[l].text;if(!c)throw new v(`Accent ${l} unsupported in ${this.mode} mode`,t);s={type:"accent",mode:this.mode,loc:V.range(t),label:c,isStretchy:!1,base:s}}return s}}const vr=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");const r=new Le(e,t);delete r.gullet.macros.current["\\df@tag"];let o=r.parse();if(!(o.length>0&&o[0].type&&o[0].type==="array"&&o[0].addEqnNum)&&r.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new v("\\tag works only in display mode");r.gullet.feed("\\df@tag"),o=[{type:"tag",mode:"text",body:o,tag:r.parse()}]}return o},po=[2,2,3,3];class lt{constructor(t){this.level=t.level,this.color=t.color,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontSize=t.fontSize||1,this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.maxSize=t.maxSize}extend(t){const r={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 o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o]);return new lt(r)}withLevel(t){return this.extend({level:t})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:po[this.level]})}withColor(t){return this.extend({color:t})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withFontSize(t){return this.extend({fontSize:t})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}getColor(){return this.color}}const fo="0.13.01";function kr(e){const t={};let r=0;const o=document.getElementsByClassName("tml-eqn");for(let l of o)for(r+=1,l.setAttribute("id","tml-eqn-"+String(r));l.tagName!=="mtable";)if(l.getElementsByClassName("tml-label").length>0){const h=l.attributes.id.value;t[h]=String(r);break}else l=l.parentElement;const s=document.getElementsByClassName("tml-tageqn");for(const l of s)if(l.getElementsByClassName("tml-label").length>0){const h=l.getElementsByClassName("tml-tag");if(h.length>0){const f=l.attributes.id.value;t[f]=h[0].textContent}}[...e.getElementsByClassName("tml-ref")].forEach(l=>{const c=l.getAttribute("href");let h=t[c.slice(1)];l.className.indexOf("tml-eqref")===-1?(h=h.replace(/^\(/,""),h=h.replace(/\)$/,"")):(h.charAt(0)!=="("&&(h="("+h),h.slice(-1)!==")"&&(h=h+")"));const f=document.createElementNS("http://www.w3.org/1998/Math/MathML","mtext");f.appendChild(document.createTextNode(h));const k=document.createElementNS("http://www.w3.org/1998/Math/MathML","math");k.appendChild(f),l.textContent="",l.appendChild(k)})}const go=function(e,t,r){let o=r,s=0;const i=e.length;for(;o<t.length;){const l=t[o];if(s<=0&&t.slice(o,o+i)===e)return o;l==="\\"?o++:l==="{"?s++:l==="}"&&s--,o++}return-1},bo=function(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},xo=/^\\(?:begin|(?:eq)?ref){/,yo=function(e,t){let r;const o=[],s=new RegExp("("+t.map(i=>bo(i.left)).join("|")+")");for(;r=e.search(s),r!==-1;){r>0&&(o.push({type:"text",data:e.slice(0,r)}),e=e.slice(r));const i=t.findIndex(h=>e.startsWith(h.left));if(r=go(t[i].right,e,t[i].left.length),r===-1)break;const l=e.slice(0,r+t[i].right.length),c=xo.test(l)?l:e.slice(t[i].left.length,r);o.push({type:"math",data:c,rawData:l,display:t[i].display}),e=e.slice(r+t[i].right.length)}return e!==""&&o.push({type:"text",data:e}),o},Ar=[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{equation*}",right:"\\end{equation*}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{align*}",right:"\\end{align*}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{alignat*}",right:"\\end{alignat*}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{gather*}",right:"\\end{gather*}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\ref{",right:"}",display:!1},{left:"\\eqref{",right:"}",display:!1},{left:"\\[",right:"\\]",display:!0}],qe={$:[{left:"$$",right:"$$",display:!0},{left:"$`",right:"`$",display:!1},{left:"$",right:"$",display:!1}],"(":[{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]},Re=[{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{equation*}",right:"\\end{equation*}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{align*}",right:"\\end{align*}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{alignat*}",right:"\\end{alignat*}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{gather*}",right:"\\end{gather*}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\ref{",right:"}",display:!1},{left:"\\eqref{",right:"}",display:!1}],wo=e=>e==="$"||e==="("?qe[e]:e==="$+"||e==="(+"?qe[e.slice(0,1)].concat(Re):e==="ams"?Re:e==="all"?qe["("].concat(qe.$).concat(Re):Ar,vo=function(e,t){const r=yo(e,t.delimiters);if(r.length===1&&r[0].type==="text")return null;const o=document.createDocumentFragment();for(let s=0;s<r.length;s++)if(r[s].type==="text")o.appendChild(document.createTextNode(r[s].data));else{const i=document.createElement("span");let l=r[s].data;t.displayMode=r[s].display;try{t.preProcess&&(l=t.preProcess(l)),temml.render(l,i,t)}catch(c){if(!(c instanceof v))throw c;t.errorCallback("Temml auto-render: Failed to parse `"+r[s].data+"` with ",c),o.appendChild(document.createTextNode(r[s].rawData));continue}o.appendChild(i)}return o},Sr=function(e,t){for(let r=0;r<e.childNodes.length;r++){const o=e.childNodes[r];if(o.nodeType===3){const s=vo(o.textContent,t);s&&(r+=s.childNodes.length-1,e.replaceChild(s,o))}else if(o.nodeType===1){const s=" "+o.className+" ";t.ignoredTags.indexOf(o.nodeName.toLowerCase())===-1&&t.ignoredClasses.every(l=>s.indexOf(" "+l+" ")===-1)&&Sr(o,t)}}},ko=function(e,t){if(!e)throw new Error("No element provided to render");const r={};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o]);r.fences?r.delimiters=wo(r.fences):r.delimiters=r.delimiters||Ar,r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},Sr(e,r),kr(e)};let qr=function(e,t,r={}){t.textContent="";const o=t.tagName.toLowerCase()==="math";o&&(r.wrap="none");const s=ut(e,r);o?(t.textContent="",s.children.forEach(i=>{t.appendChild(i.toNode())})):s.children.length>1?(t.textContent="",s.children.forEach(i=>{t.appendChild(i.toNode())})):t.appendChild(s.toNode())};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: Temml doesn't work in quirks mode. Make sure your website has a suitable doctype."),qr=function(){throw new v("Temml doesn't work in quirks mode.")});const Ao=function(e,t){return ut(e,t).toMarkup()},So=function(e,t){const r=new Ke(t);return vr(e,r)},qo=function(e,t){const r=new Ke(t);if(r.macros={},!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");const o=new Le(e,r,!0);return delete o.gullet.macros.current["\\df@tag"],o.parse()},_o=function(e,t,r){if(r.throwOnError||!(e instanceof v))throw e;const o=new Ht(["temml-error"],[new zr(t+`
`+e.toString())]);return o.style.color=r.errorColor,o.style.whiteSpace="pre-line",o},ut=function(e,t){const r=new Ke(t);try{const o=vr(e,r),s=new lt({level:r.displayMode?M.DISPLAY:M.TEXT,maxSize:r.maxSize});return Hr(o,e,s,r)}catch(o){return _o(o,e,r)}};var Co={version:fo,render:qr,renderToString:Ao,renderMathInElement:ko,postProcess:kr,ParseError:v,definePreamble:qo,__parse:So,__renderToMathMLTree:ut,__defineSymbol:n,__defineMacro:u};export{Co as default};
//# sourceMappingURL=temml-BQUKR1fw.js.map