@lelouchhe/webagent 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,173 +0,0 @@
1
- import{b as us}from"./chunk.UMQMOGWO.js";var Ui=null,ji=()=>Ui??=import("./chunk.VZXGXFNN.js").then(e=>e.default);async function Wi(e){let t=await ji();for(let n of e.querySelectorAll("pre code"))n.dataset.highlighted||t.highlightElement(n)}function Vi(e){let t=e.querySelectorAll("pre");for(let n of t){if(!n.querySelector("code")||n.parentElement?.classList.contains("code-block-wrapper"))continue;let s=document.createElement("div");s.className="code-block-wrapper";let i=document.createElement("div");i.className="code-toolbar";let l=document.createElement("button");l.className="copy-btn",l.textContent="cp",l.type="button",i.appendChild(l),n.replaceWith(s),s.appendChild(i),s.appendChild(n)}}var zn=new WeakMap;function Uc(e){let t=e.target.closest(".copy-btn");if(!t)return;let r=t.closest(".code-block-wrapper")?.querySelector("code");if(!r)return;let s=r.textContent||"";navigator.clipboard.writeText(s).then(()=>{let i=zn.get(t);i&&clearTimeout(i),t.textContent="\u2713",t.classList.add("copied");let l=setTimeout(()=>{t.textContent="cp",t.classList.remove("copied"),zn.delete(t)},1500);zn.set(t,l)}).catch(()=>{let i=document.createRange();i.selectNodeContents(r);let l=window.getSelection();l?.removeAllRanges(),l?.addRange(i)})}function jc(e){e.querySelector("pre code")&&(Vi(e),Wi(e))}function Wc(){}var cs={task_complete:"\u2714",read:"cat",edit:"edit",execute:"exec",search:"find",delete:"rm"},ds="run",xt={pending:"\u25CB",in_progress:"\u25C9",completed:"\u25CF"},ps={pending:"pending",in_progress:"in progress",completed:"completed"};function hs(e,t,n){let r=cs[e]||ds,s,i;return n&&typeof n=="object"&&(n.command?(s=n.command,i="$ "):n.path&&(s=n.path)),{icon:r,title:t,detail:s,detailPrefix:i,showDiff:e==="edit"}}function ms(e){return e.map(t=>t.type==="terminal"?`[terminal ${t.terminalId}]`:t.content&&!Array.isArray(t.content)&&t.content.text?t.content.text:Array.isArray(t.content)?t.content.map(n=>n.text??"").join(""):"").filter(Boolean).join(`
2
- `)}function fs(e){return{icon:e==="completed"?"\u2713":e==="failed"?"\u2717":"\u2026",className:`tool-call ${e}`}}function gs(e){let t=e||"",n=t.includes("allow")?"allow":"deny",r=t.includes("reject")||t.includes("deny")?"deny":"resolve";return{cssClass:n,apiAction:r}}function bs(e,t){return e??(t?"denied":"allowed")}function xs(e){return e.map(t=>({symbol:xt[t.status]||"?",content:t.content}))}function ys(e){let t=Object.keys(xt),n=new Map,r=0;for(let i of e)xt[i.status]?n.set(i.status,(n.get(i.status)??0)+1):r+=1;let s=t.flatMap(i=>{let l=n.get(i)??0;return l>0?[{symbol:xt[i],label:ps[i]??i,count:l}]:[]});return r>0&&s.push({symbol:"?",label:"unknown",count:r}),s}function ws(e){if(typeof e=="string"&&e.includes("*** Begin Patch")){let t=e.split(`
3
- `),n=[];for(let r of t)r.startsWith("*** Begin Patch")||r.startsWith("*** End Patch")||(r.startsWith("*** Update File:")||r.startsWith("*** Add File:")||r.startsWith("*** Delete File:")?n.push({kind:"file",text:r}):r.startsWith("@@")?n.push({kind:"hunk",text:r}):r.startsWith("-")?n.push({kind:"del",text:r}):r.startsWith("+")?n.push({kind:"add",text:r}):n.push({kind:"context",text:r}));return n}if(e&&typeof e=="object"){let t=[];if(e.path&&t.push({kind:"file",text:`*** ${e.path}`}),e.old_str!=null)for(let n of String(e.old_str).split(`
4
- `))t.push({kind:"del",text:`- ${n}`});if(e.new_str!=null)for(let n of String(e.new_str).split(`
5
- `))t.push({kind:"add",text:`+ ${n}`});if(e.file_text!=null)for(let n of String(e.file_text).split(`
6
- `))t.push({kind:"add",text:`+ ${n}`});return t.length>(e.path?1:0)?t:null}return null}function Yc(e){if(Array.isArray(e))return{events:e,streaming:{thinking:!1,assistant:!1}};let t=e;return{events:t.events??[],streaming:t.streaming??{thinking:!1,assistant:!1},total:typeof t.total=="number"?t.total:void 0,hasMore:typeof t.hasMore=="boolean"?t.hasMore:void 0}}function Kc(e,t,n){return e&&t===0&&n===0}function Un(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Qe=Un();function Cs(e){Qe=e}var Ye={exec:()=>null};function H(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(s,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(pe.caret,"$1"),n=n.replace(s,l),r},getRegex:()=>new RegExp(n,t)};return r}var Zi=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),pe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},Xi=/^(?:[ \t]*(?:\n|$))+/,Yi=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ki=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,kt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,jn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ds=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ls=H(Ds).replace(/bull/g,jn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ji=H(Ds).replace(/bull/g,jn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Wn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ea=/^[^\n]+/,Vn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ta=H(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Vn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),na=H(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,jn).getRegex(),tn="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Zn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ra=H("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Zn).replace("tag",tn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Rs=H(Wn).replace("hr",kt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",tn).getRegex(),sa=H(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Rs).getRegex(),Xn={blockquote:sa,code:Yi,def:ta,fences:Ki,heading:Qi,hr:kt,html:ra,lheading:Ls,list:na,newline:Xi,paragraph:Rs,table:Ye,text:ea},ks=H("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",kt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",tn).getRegex(),oa={...Xn,lheading:Ji,table:ks,paragraph:H(Wn).replace("hr",kt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ks).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",tn).getRegex()},ia={...Xn,html:H(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Zn).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ye,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:H(Wn).replace("hr",kt).replace("heading",` *#{1,6} *[^
7
- ]`).replace("lheading",Ls).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},aa=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,la=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qs=/^( {2,}|\\)\n(?!\s*$)/,ua=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,at=/[\p{P}\p{S}]/u,nn=/[\s\p{P}\p{S}]/u,Yn=/[^\s\p{P}\p{S}]/u,ca=H(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,nn).getRegex(),Os=/(?!~)[\p{P}\p{S}]/u,da=/(?!~)[\s\p{P}\p{S}]/u,pa=/(?:[^\s\p{P}\p{S}]|~)/u,ha=H(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Zi?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),$s=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ma=H($s,"u").replace(/punct/g,at).getRegex(),fa=H($s,"u").replace(/punct/g,Os).getRegex(),Ms="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ga=H(Ms,"gu").replace(/notPunctSpace/g,Yn).replace(/punctSpace/g,nn).replace(/punct/g,at).getRegex(),ba=H(Ms,"gu").replace(/notPunctSpace/g,pa).replace(/punctSpace/g,da).replace(/punct/g,Os).getRegex(),xa=H("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Yn).replace(/punctSpace/g,nn).replace(/punct/g,at).getRegex(),ya=H(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,at).getRegex(),wa="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ka=H(wa,"gu").replace(/notPunctSpace/g,Yn).replace(/punctSpace/g,nn).replace(/punct/g,at).getRegex(),Aa=H(/\\(punct)/,"gu").replace(/punct/g,at).getRegex(),Ta=H(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),va=H(Zn).replace("(?:-->|$)","-->").getRegex(),Sa=H("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",va).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Qt=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,_a=H(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Qt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Is=H(/^!?\[(label)\]\[(ref)\]/).replace("label",Qt).replace("ref",Vn).getRegex(),Bs=H(/^!?\[(ref)\](?:\[\])?/).replace("ref",Vn).getRegex(),Ea=H("reflink|nolink(?!\\()","g").replace("reflink",Is).replace("nolink",Bs).getRegex(),As=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Kn={_backpedal:Ye,anyPunctuation:Aa,autolink:Ta,blockSkip:ha,br:qs,code:la,del:Ye,delLDelim:Ye,delRDelim:Ye,emStrongLDelim:ma,emStrongRDelimAst:ga,emStrongRDelimUnd:xa,escape:aa,link:_a,nolink:Bs,punctuation:ca,reflink:Is,reflinkSearch:Ea,tag:Sa,text:ua,url:Ye},Ca={...Kn,link:H(/^!?\[(label)\]\((.*?)\)/).replace("label",Qt).getRegex(),reflink:H(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Qt).getRegex()},Fn={...Kn,emStrongRDelimAst:ba,emStrongLDelim:fa,delLDelim:ya,delRDelim:ka,url:H(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",As).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:H(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",As).getRegex()},Da={...Fn,br:H(qs).replace("{2,}","*").getRegex(),text:H(Fn.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Kt={normal:Xn,gfm:oa,pedantic:ia},yt={normal:Kn,gfm:Fn,breaks:Da,pedantic:Ca},La={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ts=e=>La[e];function Me(e,t){if(t){if(pe.escapeTest.test(e))return e.replace(pe.escapeReplace,Ts)}else if(pe.escapeTestNoEncode.test(e))return e.replace(pe.escapeReplaceNoEncode,Ts);return e}function vs(e){try{e=encodeURI(e).replace(pe.percentDecode,"%")}catch{return null}return e}function Ss(e,t){let n=e.replace(pe.findPipe,(i,l,u)=>{let c=!1,p=l;for(;--p>=0&&u[p]==="\\";)c=!c;return c?"|":" |"}),r=n.split(pe.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(pe.slashPipe,"|");return r}function Ue(e,t,n){let r=e.length;if(r===0)return"";let s=0;for(;s<r;){let i=e.charAt(r-s-1);if(i===t&&!n)s++;else if(i!==t&&n)s++;else break}return e.slice(0,r-s)}function _s(e){let t=e.split(`
8
- `),n=t.length-1;for(;n>=0&&pe.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
9
- `)}function Ra(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function qa(e,t=0){let n=t,r="";for(let s of e)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function Es(e,t,n,r,s){let i=t.href,l=t.title||null,u=e[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:l,text:u,tokens:r.inlineTokens(u)};return r.state.inLink=!1,c}function Oa(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let s=r[1];return t.split(`
10
- `).map(i=>{let l=i.match(n.other.beginningSpace);if(l===null)return i;let[u]=l;return u.length>=s.length?i.slice(s.length):i}).join(`
11
- `)}var Jt=class{options;rules;lexer;constructor(e){this.options=e||Qe}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:_s(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=Oa(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=Ue(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:Ue(t[0],`
12
- `),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Ue(t[0],`
13
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Ue(t[0],`
14
- `).split(`
15
- `),r="",s="",i=[];for(;n.length>0;){let l=!1,u=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))u.push(n[c]),l=!0;else if(!l)u.push(n[c]);else break;n=n.slice(c);let p=u.join(`
16
- `),x=p.replace(this.rules.other.blockquoteSetextReplace,`
17
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
18
- ${p}`:p,s=s?`${s}
19
- ${x}`:x;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(x,i,!0),this.lexer.state.top=g,n.length===0)break;let b=i.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let v=b,_=v.raw+`
20
- `+n.join(`
21
- `),O=this.blockquote(_);i[i.length-1]=O,r=r.substring(0,r.length-v.raw.length)+O.raw,s=s.substring(0,s.length-v.text.length)+O.text;break}else if(b?.type==="list"){let v=b,_=v.raw+`
22
- `+n.join(`
23
- `),O=this.list(_);i[i.length-1]=O,r=r.substring(0,r.length-b.raw.length)+O.raw,s=s.substring(0,s.length-v.raw.length)+O.raw,n=_.substring(i.at(-1).raw.length).split(`
24
- `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),l=!1;for(;e;){let c=!1,p="",x="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let g=qa(t[2].split(`
25
- `,1)[0],t[1].length),b=e.split(`
26
- `,1)[0],v=!g.trim(),_=0;if(this.options.pedantic?(_=2,x=g.trimStart()):v?_=t[1].length+1:(_=g.search(this.rules.other.nonSpaceChar),_=_>4?1:_,x=g.slice(_),_+=t[1].length),v&&this.rules.other.blankLine.test(b)&&(p+=b+`
27
- `,e=e.substring(b.length+1),c=!0),!c){let O=this.rules.other.nextBulletRegex(_),R=this.rules.other.hrRegex(_),C=this.rules.other.fencesBeginRegex(_),L=this.rules.other.headingBeginRegex(_),M=this.rules.other.htmlBeginRegex(_),B=this.rules.other.blockquoteBeginRegex(_);for(;e;){let j=e.split(`
28
- `,1)[0],W;if(b=j,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),W=b):W=b.replace(this.rules.other.tabCharGlobal," "),C.test(b)||L.test(b)||M.test(b)||B.test(b)||O.test(b)||R.test(b))break;if(W.search(this.rules.other.nonSpaceChar)>=_||!b.trim())x+=`
29
- `+W.slice(_);else{if(v||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||C.test(g)||L.test(g)||R.test(g))break;x+=`
30
- `+b}v=!b.trim(),p+=j+`
31
- `,e=e.substring(j.length+1),g=W.slice(_)}}s.loose||(l?s.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(l=!0)),s.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(x),loose:!1,text:x,tokens:[]}),s.raw+=p}let u=s.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c of s.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),c.tokens[0]?.type==="text"||c.tokens[0]?.type==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let x=this.lexer.inlineQueue.length-1;x>=0;x--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[x].src)){this.lexer.inlineQueue[x].src=this.lexer.inlineQueue[x].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let x={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=x.checked,s.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=x.raw+c.tokens[0].raw,c.tokens[0].text=x.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(x)):c.tokens.unshift({type:"paragraph",raw:x.raw,text:x.raw,tokens:[x]}):c.tokens.unshift(x)}}if(!s.loose){let p=c.tokens.filter(g=>g.type==="space"),x=p.length>0&&p.some(g=>this.rules.other.anyLine.test(g.raw));s.loose=x}}if(s.loose)for(let c of s.items){c.loose=!0;for(let p of c.tokens)p.type==="text"&&(p.type="paragraph")}return s}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=_s(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:Ue(t[0],`
32
- `),href:r,title:s}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ss(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
33
- `):[],i={type:"table",raw:Ue(t[0],`
34
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<n.length;l++)i.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:i.align[l]});for(let l of s)i.rows.push(Ss(l,i.header.length).map((u,c)=>({text:u,tokens:this.lexer.inline(u),header:!1,align:i.align[c]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:Ue(t[0],`
35
- `),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
36
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Ue(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=Ra(t[2],"()");if(i===-2)return;if(i>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let r=t[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Es(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Es(n,s,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,l,u=s,c=0,p=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+s);(r=p.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(l=[...i].length,r[3]||r[4]){u+=l;continue}else if((r[5]||r[6])&&s%3&&!((s+l)%3)){c+=l;continue}if(u-=l,u>0)continue;l=Math.min(l,l+u+c);let x=[...r[0]][0].length,g=e.slice(0,s+r.index+x+l);if(Math.min(s,l)%2){let v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}let b=g.slice(2,-2);return{type:"strong",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,l,u=s,c=this.rules.inline.delRDelim;for(c.lastIndex=0,t=t.slice(-1*e.length+s);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(l=[...i].length,l!==s))continue;if(r[3]||r[4]){u+=l;continue}if(u-=l,u>0)continue;l=Math.min(l,l+u);let p=[...r[0]][0].length,x=e.slice(0,s+r.index+p+l),g=x.slice(s,-s);return{type:"del",raw:x,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,r;if(t[2]==="@")n=t[0],r="mailto:"+n;else{let s;do s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(s!==t[0]);n=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},ye=class Gn{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Qe,this.options.tokenizer=this.options.tokenizer||new Jt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:pe,block:Kt.normal,inline:yt.normal};this.options.pedantic?(n.block=Kt.pedantic,n.inline=yt.pedantic):this.options.gfm&&(n.block=Kt.gfm,this.options.breaks?n.inline=yt.breaks:n.inline=yt.gfm),this.tokenizer.rules=n}static get rules(){return{block:Kt,inline:yt}}static lex(t,n){return new Gn(n).lex(t)}static lexInline(t,n){return new Gn(n).inlineTokens(t)}lex(t){t=t.replace(pe.carriageReturn,`
37
- `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(pe.tabCharGlobal," ").replace(pe.spaceLine,""));let s=1/0;for(;t;){if(t.length<s)s=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(u=>(i=u.call({lexer:this},t,n))?(t=t.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length);let u=n.at(-1);i.raw.length===1&&u!==void 0?u.raw+=`
38
- `:n.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length);let u=n.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
39
- `)?"":`
40
- `)+i.raw,u.text+=`
41
- `+i.text,this.inlineQueue.at(-1).src=u.text):n.push(i);continue}if(i=this.tokenizer.fences(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(t)){t=t.substring(i.raw.length);let u=n.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
42
- `)?"":`
43
- `)+i.raw,u.text+=`
44
- `+i.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(t)){t=t.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(t)){t=t.substring(i.raw.length),n.push(i);continue}let l=t;if(this.options.extensions?.startBlock){let u=1/0,c=t.slice(1),p;this.options.extensions.startBlock.forEach(x=>{p=x.call({lexer:this},c),typeof p=="number"&&p>=0&&(u=Math.min(u,p))}),u<1/0&&u>=0&&(l=t.substring(0,u+1))}if(this.state.top&&(i=this.tokenizer.paragraph(l))){let u=n.at(-1);r&&u?.type==="paragraph"?(u.raw+=(u.raw.endsWith(`
45
- `)?"":`
46
- `)+i.raw,u.text+=`
47
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(i),r=l.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length);let u=n.at(-1);u?.type==="text"?(u.raw+=(u.raw.endsWith(`
48
- `)?"":`
49
- `)+i.raw,u.text+=`
50
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(i);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){this.tokenizer.lexer=this;let r=t,s=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)p.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let l=!1,u="",c=1/0;for(;t;){if(t.length<c)c=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}l||(u=""),l=!1;let p;if(this.options.extensions?.inline?.some(g=>(p=g.call({lexer:this},t,n))?(t=t.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let g=n.at(-1);p.type==="text"&&g?.type==="text"?(g.raw+=p.raw,g.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(t,r,u)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(t,r,u)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),n.push(p);continue}let x=t;if(this.options.extensions?.startInline){let g=1/0,b=t.slice(1),v;this.options.extensions.startInline.forEach(_=>{v=_.call({lexer:this},b),typeof v=="number"&&v>=0&&(g=Math.min(g,v))}),g<1/0&&g>=0&&(x=t.substring(0,g+1))}if(p=this.tokenizer.inlineText(x)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(u=p.raw.slice(-1)),l=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=p.raw,g.text+=p.text):n.push(p);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},en=class{options;parser;constructor(e){this.options=e||Qe}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(pe.notSpaceStart)?.[0],s=e.replace(pe.endingNewline,"")+`
51
- `;return r?'<pre><code class="language-'+Me(r)+'">'+(n?s:Me(s,!0))+`</code></pre>
52
- `:"<pre><code>"+(n?s:Me(s,!0))+`</code></pre>
53
- `}blockquote({tokens:e}){return`<blockquote>
54
- ${this.parser.parse(e)}</blockquote>
55
- `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
56
- `}hr(e){return`<hr>
57
- `}list(e){let t=e.ordered,n=e.start,r="";for(let l=0;l<e.items.length;l++){let u=e.items[l];r+=this.listitem(u)}let s=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
58
- `+r+"</"+s+`>
59
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
60
- `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
61
- `}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let r="";for(let s=0;s<e.rows.length;s++){let i=e.rows[s];n="";for(let l=0;l<i.length;l++)n+=this.tablecell(i[l]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
62
- <thead>
63
- `+t+`</thead>
64
- `+r+`</table>
65
- `}tablerow({text:e}){return`<tr>
66
- ${e}</tr>
67
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
68
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Me(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),s=vs(e);if(s===null)return r;e=s;let i='<a href="'+e+'"';return t&&(i+=' title="'+Me(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=vs(e);if(s===null)return Me(n);e=s;let i=`<img src="${e}" alt="${Me(n)}"`;return t&&(i+=` title="${Me(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Me(e.text)}},Qn=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Le=class Hn{options;renderer;textRenderer;constructor(t){this.options=t||Qe,this.options.renderer=this.options.renderer||new en,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qn}static parse(t,n){return new Hn(n).parse(t)}static parseInline(t,n){return new Hn(n).parseInline(t)}parse(t){this.renderer.parser=this;let n="";for(let r=0;r<t.length;r++){let s=t[r];if(this.options.extensions?.renderers?.[s.type]){let l=s,u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){n+=u||"";continue}}let i=s;switch(i.type){case"space":{n+=this.renderer.space(i);break}case"hr":{n+=this.renderer.hr(i);break}case"heading":{n+=this.renderer.heading(i);break}case"code":{n+=this.renderer.code(i);break}case"table":{n+=this.renderer.table(i);break}case"blockquote":{n+=this.renderer.blockquote(i);break}case"list":{n+=this.renderer.list(i);break}case"checkbox":{n+=this.renderer.checkbox(i);break}case"html":{n+=this.renderer.html(i);break}case"def":{n+=this.renderer.def(i);break}case"paragraph":{n+=this.renderer.paragraph(i);break}case"text":{n+=this.renderer.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(t,n=this.renderer){this.renderer.parser=this;let r="";for(let s=0;s<t.length;s++){let i=t[s];if(this.options.extensions?.renderers?.[i.type]){let u=this.options.extensions.renderers[i.type].call({parser:this},i);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=u||"";continue}}let l=i;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},wt=class{options;block;constructor(e){this.options=e||Qe}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?ye.lex:ye.lexInline}provideParser(e=this.block){return e?Le.parse:Le.parseInline}},$a=class{defaults=Un();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Le;Renderer=en;TextRenderer=Qn;Lexer=ye;Tokenizer=Jt;Hooks=wt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{let s=r;for(let i of s.header)n=n.concat(this.walkTokens(i.tokens,t));for(let i of s.rows)for(let l of i)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{let s=r;n=n.concat(this.walkTokens(s.items,t));break}default:{let s=r;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(i=>{let l=s[i].flat(1/0);n=n.concat(this.walkTokens(l,t))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=t.renderers[s.name];i?t.renderers[s.name]=function(...l){let u=s.renderer.apply(this,l);return u===!1&&(u=i.apply(this,l)),u}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[s.level];i?i.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),r.extensions=t),n.renderer){let s=this.defaults.renderer||new en(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,u=n.renderer[l],c=s[l];s[l]=(...p)=>{let x=u.apply(s,p);return x===!1&&(x=c.apply(s,p)),x||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Jt(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,u=n.tokenizer[l],c=s[l];s[l]=(...p)=>{let x=u.apply(s,p);return x===!1&&(x=c.apply(s,p)),x}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new wt;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,u=n.hooks[l],c=s[l];wt.passThroughHooks.has(i)?s[l]=p=>{if(this.defaults.async&&wt.passThroughHooksRespectAsync.has(i))return(async()=>{let g=await u.call(s,p);return c.call(s,g)})();let x=u.call(s,p);return c.call(s,x)}:s[l]=(...p)=>{if(this.defaults.async)return(async()=>{let g=await u.apply(s,p);return g===!1&&(g=await c.apply(s,p)),g})();let x=u.apply(s,p);return x===!1&&(x=c.apply(s,p)),x}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(l){let u=[];return u.push(i.call(this,l)),s&&(u=u.concat(s.call(this,l))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ye.lex(e,t??this.defaults)}parser(e,t){return Le.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let l=s.hooks?await s.hooks.preprocess(t):t,u=await(s.hooks?await s.hooks.provideLexer(e):e?ye.lex:ye.lexInline)(l,s),c=s.hooks?await s.hooks.processAllTokens(u):u;s.walkTokens&&await Promise.all(this.walkTokens(c,s.walkTokens));let p=await(s.hooks?await s.hooks.provideParser(e):e?Le.parse:Le.parseInline)(c,s);return s.hooks?await s.hooks.postprocess(p):p})().catch(i);try{s.hooks&&(t=s.hooks.preprocess(t));let l=(s.hooks?s.hooks.provideLexer(e):e?ye.lex:ye.lexInline)(t,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let u=(s.hooks?s.hooks.provideParser(e):e?Le.parse:Le.parseInline)(l,s);return s.hooks&&(u=s.hooks.postprocess(u)),u}catch(l){return i(l)}}}onError(e,t){return n=>{if(n.message+=`
69
- Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Me(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Ke=new $a;function N(e,t){return Ke.parse(e,t)}N.options=N.setOptions=function(e){return Ke.setOptions(e),N.defaults=Ke.defaults,Cs(N.defaults),N};N.getDefaults=Un;N.defaults=Qe;N.use=function(...e){return Ke.use(...e),N.defaults=Ke.defaults,Cs(N.defaults),N};N.walkTokens=function(e,t){return Ke.walkTokens(e,t)};N.parseInline=Ke.parseInline;N.Parser=Le;N.parser=Le.parse;N.Renderer=en;N.TextRenderer=Qn;N.Lexer=ye;N.lexer=ye.lex;N.Tokenizer=Jt;N.Hooks=wt;N.parse=N;var Jc=N.options,ed=N.setOptions,td=N.use,nd=N.walkTokens,rd=N.parseInline;var sd=Le.parse,od=ye.lex;var{entries:Ys,setPrototypeOf:Ns,isFrozen:Ma,getPrototypeOf:Ia,getOwnPropertyDescriptor:Ba}=Object,{freeze:ge,seal:Te,create:ut}=Object,{apply:sr,construct:or}=typeof Reflect<"u"&&Reflect;ge||(ge=function(t){return t});Te||(Te=function(t){return t});sr||(sr=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];return t.apply(n,s)});or||(or=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new t(...r)});var At=ne(Array.prototype.forEach),Na=ne(Array.prototype.lastIndexOf),Ps=ne(Array.prototype.pop),Tt=ne(Array.prototype.push),Pa=ne(Array.prototype.splice),fe=Array.isArray,_t=ne(String.prototype.toLowerCase),Jn=ne(String.prototype.toString),zs=ne(String.prototype.match),lt=ne(String.prototype.replace),Fs=ne(String.prototype.indexOf),za=ne(String.prototype.trim),Fa=ne(Number.prototype.toString),Ga=ne(Boolean.prototype.toString),Gs=typeof BigInt>"u"?null:ne(BigInt.prototype.toString),Hs=typeof Symbol>"u"?null:ne(Symbol.prototype.toString),Y=ne(Object.prototype.hasOwnProperty),vt=ne(Object.prototype.toString),ce=ne(RegExp.prototype.test),rn=Ha(TypeError);function ne(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return sr(e,t,r)}}function Ha(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return or(e,n)}}function z(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_t;if(Ns&&Ns(e,null),!fe(t))return e;let r=t.length;for(;r--;){let s=t[r];if(typeof s=="string"){let i=n(s);i!==s&&(Ma(t)||(t[r]=i),s=i)}e[s]=!0}return e}function Ua(e){for(let t=0;t<e.length;t++)Y(e,t)||(e[t]=null);return e}function xe(e){let t=ut(null);for(let[n,r]of Ys(e))Y(e,n)&&(fe(r)?t[n]=Ua(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=xe(r):t[n]=r);return t}function ja(e){switch(typeof e){case"string":return e;case"number":return Fa(e);case"boolean":return Ga(e);case"bigint":return Gs?Gs(e):"0";case"symbol":return Hs?Hs(e):"Symbol()";case"undefined":return vt(e);case"function":case"object":{if(e===null)return vt(e);let t=e,n=ct(t,"toString");if(typeof n=="function"){let r=n(t);return typeof r=="string"?r:vt(r)}return vt(e)}default:return vt(e)}}function ct(e,t){for(;e!==null;){let r=Ba(e,t);if(r){if(r.get)return ne(r.get);if(typeof r.value=="function")return ne(r.value)}e=Ia(e)}function n(){return null}return n}function Wa(e){try{return ce(e,""),!0}catch{return!1}}var Us=ge(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),er=ge(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),tr=ge(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Va=ge(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),nr=ge(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Za=ge(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),js=ge(["#text"]),Ws=ge(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),rr=ge(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Vs=ge(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),sn=ge(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Xa=Te(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ya=Te(/<%[\w\W]*|[\w\W]*%>/gm),Ka=Te(/\$\{[\w\W]*/gm),Qa=Te(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ja=Te(/^aria-[\-\w]+$/),Ks=Te(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),el=Te(/^(?:\w+script|data):/i),tl=Te(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Qs=Te(/^html$/i),nl=Te(/^[a-z][.\w]*(-[.\w]+)+$/i),Zs=Object.freeze({__proto__:null,ARIA_ATTR:Ja,ATTR_WHITESPACE:tl,CUSTOM_ELEMENT:nl,DATA_ATTR:Qa,DOCTYPE_NAME:Qs,ERB_EXPR:Ya,IS_ALLOWED_URI:Ks,IS_SCRIPT_OR_DATA:el,MUSTACHE_EXPR:Xa,TMPLIT_EXPR:Ka}),St={element:1,text:3,progressingInstruction:7,comment:8,document:9},rl=function(){return typeof window>"u"?null:window},sl=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));let i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Xs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Js(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rl(),t=I=>Js(I);if(t.version="3.4.1",t.removed=[],!e||!e.document||e.document.nodeType!==St.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,s=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:l,Node:u,Element:c,NodeFilter:p,NamedNodeMap:x=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:b,trustedTypes:v}=e,_=c.prototype,O=ct(_,"cloneNode"),R=ct(_,"remove"),C=ct(_,"nextSibling"),L=ct(_,"childNodes"),M=ct(_,"parentNode");if(typeof l=="function"){let I=n.createElement("template");I.content&&I.content.ownerDocument&&(n=I.content.ownerDocument)}let B,j="",{implementation:W,createNodeIterator:Ne,createDocumentFragment:Ee,getElementsByTagName:We}=n,{importNode:Gt}=r,me=Xs();t.isSupported=typeof Ys=="function"&&typeof M=="function"&&W&&W.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Ht,ERB_EXPR:Ut,TMPLIT_EXPR:jt,DATA_ATTR:Oi,ARIA_ATTR:$i,IS_SCRIPT_OR_DATA:Mi,ATTR_WHITESPACE:Nr,CUSTOM_ELEMENT:Ii}=Zs,{IS_ALLOWED_URI:Pr}=Zs,ae=null,zr=z({},[...Us,...er,...tr,...nr,...js]),ue=null,Fr=z({},[...Ws,...rr,...Vs,...sn]),Q=Object.seal(ut(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),mt=null,Wt=null,He=Object.seal(ut(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Gr=!0,_n=!0,Hr=!1,Ur=!0,Ve=!1,ft=!0,Ze=!1,En=!1,Cn=!1,rt=!1,Vt=!1,Zt=!1,jr=!0,Wr=!1,Vr="user-content-",Dn=!0,gt=!1,st={},Oe=null,Ln=z({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Zr=null,Xr=z({},["audio","video","img","source","image","track"]),Rn=null,Yr=z({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xt="http://www.w3.org/1998/Math/MathML",Yt="http://www.w3.org/2000/svg",$e="http://www.w3.org/1999/xhtml",ot=$e,qn=!1,On=null,Bi=z({},[Xt,Yt,$e],Jn),$n=z({},["mi","mo","mn","ms","mtext"]),Mn=z({},["annotation-xml"]),Ni=z({},["title","style","font","a","script"]),bt=null,Pi=["application/xhtml+xml","text/html"],zi="text/html",oe=null,it=null,Fi=n.createElement("form"),Kr=function(f){return f instanceof RegExp||f instanceof Function},In=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(it&&it===f)return;(!f||typeof f!="object")&&(f={}),f=xe(f),bt=Pi.indexOf(f.PARSER_MEDIA_TYPE)===-1?zi:f.PARSER_MEDIA_TYPE,oe=bt==="application/xhtml+xml"?Jn:_t,ae=Y(f,"ALLOWED_TAGS")&&fe(f.ALLOWED_TAGS)?z({},f.ALLOWED_TAGS,oe):zr,ue=Y(f,"ALLOWED_ATTR")&&fe(f.ALLOWED_ATTR)?z({},f.ALLOWED_ATTR,oe):Fr,On=Y(f,"ALLOWED_NAMESPACES")&&fe(f.ALLOWED_NAMESPACES)?z({},f.ALLOWED_NAMESPACES,Jn):Bi,Rn=Y(f,"ADD_URI_SAFE_ATTR")&&fe(f.ADD_URI_SAFE_ATTR)?z(xe(Yr),f.ADD_URI_SAFE_ATTR,oe):Yr,Zr=Y(f,"ADD_DATA_URI_TAGS")&&fe(f.ADD_DATA_URI_TAGS)?z(xe(Xr),f.ADD_DATA_URI_TAGS,oe):Xr,Oe=Y(f,"FORBID_CONTENTS")&&fe(f.FORBID_CONTENTS)?z({},f.FORBID_CONTENTS,oe):Ln,mt=Y(f,"FORBID_TAGS")&&fe(f.FORBID_TAGS)?z({},f.FORBID_TAGS,oe):xe({}),Wt=Y(f,"FORBID_ATTR")&&fe(f.FORBID_ATTR)?z({},f.FORBID_ATTR,oe):xe({}),st=Y(f,"USE_PROFILES")?f.USE_PROFILES&&typeof f.USE_PROFILES=="object"?xe(f.USE_PROFILES):f.USE_PROFILES:!1,Gr=f.ALLOW_ARIA_ATTR!==!1,_n=f.ALLOW_DATA_ATTR!==!1,Hr=f.ALLOW_UNKNOWN_PROTOCOLS||!1,Ur=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ve=f.SAFE_FOR_TEMPLATES||!1,ft=f.SAFE_FOR_XML!==!1,Ze=f.WHOLE_DOCUMENT||!1,rt=f.RETURN_DOM||!1,Vt=f.RETURN_DOM_FRAGMENT||!1,Zt=f.RETURN_TRUSTED_TYPE||!1,Cn=f.FORCE_BODY||!1,jr=f.SANITIZE_DOM!==!1,Wr=f.SANITIZE_NAMED_PROPS||!1,Dn=f.KEEP_CONTENT!==!1,gt=f.IN_PLACE||!1,Pr=Wa(f.ALLOWED_URI_REGEXP)?f.ALLOWED_URI_REGEXP:Ks,ot=typeof f.NAMESPACE=="string"?f.NAMESPACE:$e,$n=Y(f,"MATHML_TEXT_INTEGRATION_POINTS")&&f.MATHML_TEXT_INTEGRATION_POINTS&&typeof f.MATHML_TEXT_INTEGRATION_POINTS=="object"?xe(f.MATHML_TEXT_INTEGRATION_POINTS):z({},["mi","mo","mn","ms","mtext"]),Mn=Y(f,"HTML_INTEGRATION_POINTS")&&f.HTML_INTEGRATION_POINTS&&typeof f.HTML_INTEGRATION_POINTS=="object"?xe(f.HTML_INTEGRATION_POINTS):z({},["annotation-xml"]);let S=Y(f,"CUSTOM_ELEMENT_HANDLING")&&f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING=="object"?xe(f.CUSTOM_ELEMENT_HANDLING):ut(null);if(Q=ut(null),Y(S,"tagNameCheck")&&Kr(S.tagNameCheck)&&(Q.tagNameCheck=S.tagNameCheck),Y(S,"attributeNameCheck")&&Kr(S.attributeNameCheck)&&(Q.attributeNameCheck=S.attributeNameCheck),Y(S,"allowCustomizedBuiltInElements")&&typeof S.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=S.allowCustomizedBuiltInElements),Ve&&(_n=!1),Vt&&(rt=!0),st&&(ae=z({},js),ue=ut(null),st.html===!0&&(z(ae,Us),z(ue,Ws)),st.svg===!0&&(z(ae,er),z(ue,rr),z(ue,sn)),st.svgFilters===!0&&(z(ae,tr),z(ue,rr),z(ue,sn)),st.mathMl===!0&&(z(ae,nr),z(ue,Vs),z(ue,sn))),He.tagCheck=null,He.attributeCheck=null,Y(f,"ADD_TAGS")&&(typeof f.ADD_TAGS=="function"?He.tagCheck=f.ADD_TAGS:fe(f.ADD_TAGS)&&(ae===zr&&(ae=xe(ae)),z(ae,f.ADD_TAGS,oe))),Y(f,"ADD_ATTR")&&(typeof f.ADD_ATTR=="function"?He.attributeCheck=f.ADD_ATTR:fe(f.ADD_ATTR)&&(ue===Fr&&(ue=xe(ue)),z(ue,f.ADD_ATTR,oe))),Y(f,"ADD_URI_SAFE_ATTR")&&fe(f.ADD_URI_SAFE_ATTR)&&z(Rn,f.ADD_URI_SAFE_ATTR,oe),Y(f,"FORBID_CONTENTS")&&fe(f.FORBID_CONTENTS)&&(Oe===Ln&&(Oe=xe(Oe)),z(Oe,f.FORBID_CONTENTS,oe)),Y(f,"ADD_FORBID_CONTENTS")&&fe(f.ADD_FORBID_CONTENTS)&&(Oe===Ln&&(Oe=xe(Oe)),z(Oe,f.ADD_FORBID_CONTENTS,oe)),Dn&&(ae["#text"]=!0),Ze&&z(ae,["html","head","body"]),ae.table&&(z(ae,["tbody"]),delete mt.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw rn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw rn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');B=f.TRUSTED_TYPES_POLICY,j=B.createHTML("")}else B===void 0&&(B=sl(v,s)),B!==null&&typeof j=="string"&&(j=B.createHTML(""));ge&&ge(f),it=f},Qr=z({},[...er,...tr,...Va]),Jr=z({},[...nr,...Za]),Gi=function(f){let S=M(f);(!S||!S.tagName)&&(S={namespaceURI:ot,tagName:"template"});let $=_t(f.tagName),Z=_t(S.tagName);return On[f.namespaceURI]?f.namespaceURI===Yt?S.namespaceURI===$e?$==="svg":S.namespaceURI===Xt?$==="svg"&&(Z==="annotation-xml"||$n[Z]):!!Qr[$]:f.namespaceURI===Xt?S.namespaceURI===$e?$==="math":S.namespaceURI===Yt?$==="math"&&Mn[Z]:!!Jr[$]:f.namespaceURI===$e?S.namespaceURI===Yt&&!Mn[Z]||S.namespaceURI===Xt&&!$n[Z]?!1:!Jr[$]&&(Ni[$]||!Qr[$]):!!(bt==="application/xhtml+xml"&&On[f.namespaceURI]):!1},Ce=function(f){Tt(t.removed,{element:f});try{M(f).removeChild(f)}catch{R(f)}},Xe=function(f,S){try{Tt(t.removed,{attribute:S.getAttributeNode(f),from:S})}catch{Tt(t.removed,{attribute:null,from:S})}if(S.removeAttribute(f),f==="is")if(rt||Vt)try{Ce(S)}catch{}else try{S.setAttribute(f,"")}catch{}},es=function(f){let S=null,$=null;if(Cn)f="<remove></remove>"+f;else{let te=zs(f,/^[\r\n\t ]+/);$=te&&te[0]}bt==="application/xhtml+xml"&&ot===$e&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");let Z=B?B.createHTML(f):f;if(ot===$e)try{S=new b().parseFromString(Z,bt)}catch{}if(!S||!S.documentElement){S=W.createDocument(ot,"template",null);try{S.documentElement.innerHTML=qn?j:Z}catch{}}let de=S.body||S.documentElement;return f&&$&&de.insertBefore(n.createTextNode($),de.childNodes[0]||null),ot===$e?We.call(S,Ze?"html":"body")[0]:Ze?S.documentElement:de},ts=function(f){return Ne.call(f.ownerDocument||f,f,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Bn=function(f){return f instanceof g&&(typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||!(f.attributes instanceof x)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function")},Nn=function(f){return typeof u=="function"&&f instanceof u};function Pe(I,f,S){At(I,$=>{$.call(t,f,S,it)})}let ns=function(f){let S=null;if(Pe(me.beforeSanitizeElements,f,null),Bn(f))return Ce(f),!0;let $=oe(f.nodeName);if(Pe(me.uponSanitizeElement,f,{tagName:$,allowedTags:ae}),ft&&f.hasChildNodes()&&!Nn(f.firstElementChild)&&ce(/<[/\w!]/g,f.innerHTML)&&ce(/<[/\w!]/g,f.textContent)||ft&&f.namespaceURI===$e&&$==="style"&&Nn(f.firstElementChild)||f.nodeType===St.progressingInstruction||ft&&f.nodeType===St.comment&&ce(/<[/\w]/g,f.data))return Ce(f),!0;if(mt[$]||!(He.tagCheck instanceof Function&&He.tagCheck($))&&!ae[$]){if(!mt[$]&&ss($)&&(Q.tagNameCheck instanceof RegExp&&ce(Q.tagNameCheck,$)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck($)))return!1;if(Dn&&!Oe[$]){let Z=M(f)||f.parentNode,de=L(f)||f.childNodes;if(de&&Z){let te=de.length;for(let be=te-1;be>=0;--be){let Ae=O(de[be],!0);Z.insertBefore(Ae,C(f))}}}return Ce(f),!0}return f instanceof c&&!Gi(f)||($==="noscript"||$==="noembed"||$==="noframes")&&ce(/<\/no(script|embed|frames)/i,f.innerHTML)?(Ce(f),!0):(Ve&&f.nodeType===St.text&&(S=f.textContent,At([Ht,Ut,jt],Z=>{S=lt(S,Z," ")}),f.textContent!==S&&(Tt(t.removed,{element:f.cloneNode()}),f.textContent=S)),Pe(me.afterSanitizeElements,f,null),!1)},rs=function(f,S,$){if(Wt[S]||jr&&(S==="id"||S==="name")&&($ in n||$ in Fi))return!1;if(!(_n&&!Wt[S]&&ce(Oi,S))){if(!(Gr&&ce($i,S))){if(!(He.attributeCheck instanceof Function&&He.attributeCheck(S,f))){if(!ue[S]||Wt[S]){if(!(ss(f)&&(Q.tagNameCheck instanceof RegExp&&ce(Q.tagNameCheck,f)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(f))&&(Q.attributeNameCheck instanceof RegExp&&ce(Q.attributeNameCheck,S)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(S,f))||S==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&ce(Q.tagNameCheck,$)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck($))))return!1}else if(!Rn[S]){if(!ce(Pr,lt($,Nr,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&f!=="script"&&Fs($,"data:")===0&&Zr[f])){if(!(Hr&&!ce(Mi,lt($,Nr,"")))){if($)return!1}}}}}}}return!0},Hi=z({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ss=function(f){return!Hi[_t(f)]&&ce(Ii,f)},os=function(f){Pe(me.beforeSanitizeAttributes,f,null);let{attributes:S}=f;if(!S||Bn(f))return;let $={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ue,forceKeepAttr:void 0},Z=S.length;for(;Z--;){let de=S[Z],{name:te,namespaceURI:be,value:Ae}=de,De=oe(te),Pn=Ae,le=te==="value"?Pn:za(Pn);if($.attrName=De,$.attrValue=le,$.keepAttr=!0,$.forceKeepAttr=void 0,Pe(me.uponSanitizeAttribute,f,$),le=$.attrValue,Wr&&(De==="id"||De==="name")&&Fs(le,Vr)!==0&&(Xe(te,f),le=Vr+le),ft&&ce(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,le)){Xe(te,f);continue}if(De==="attributename"&&zs(le,"href")){Xe(te,f);continue}if($.forceKeepAttr)continue;if(!$.keepAttr){Xe(te,f);continue}if(!Ur&&ce(/\/>/i,le)){Xe(te,f);continue}Ve&&At([Ht,Ut,jt],ls=>{le=lt(le,ls," ")});let as=oe(f.nodeName);if(!rs(as,De,le)){Xe(te,f);continue}if(B&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!be)switch(v.getAttributeType(as,De)){case"TrustedHTML":{le=B.createHTML(le);break}case"TrustedScriptURL":{le=B.createScriptURL(le);break}}if(le!==Pn)try{be?f.setAttributeNS(be,te,le):f.setAttribute(te,le),Bn(f)?Ce(f):Ps(t.removed)}catch{Xe(te,f)}}Pe(me.afterSanitizeAttributes,f,null)},is=function(f){let S=null,$=ts(f);for(Pe(me.beforeSanitizeShadowDOM,f,null);S=$.nextNode();)Pe(me.uponSanitizeShadowNode,S,null),ns(S),os(S),S.content instanceof i&&is(S.content);Pe(me.afterSanitizeShadowDOM,f,null)};return t.sanitize=function(I){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,$=null,Z=null,de=null;if(qn=!I,qn&&(I="<!-->"),typeof I!="string"&&!Nn(I)&&(I=ja(I),typeof I!="string"))throw rn("dirty is not a string, aborting");if(!t.isSupported)return I;if(En||In(f),t.removed=[],typeof I=="string"&&(gt=!1),gt){let Ae=I.nodeName;if(typeof Ae=="string"){let De=oe(Ae);if(!ae[De]||mt[De])throw rn("root node is forbidden and cannot be sanitized in-place")}}else if(I instanceof u)S=es("<!---->"),$=S.ownerDocument.importNode(I,!0),$.nodeType===St.element&&$.nodeName==="BODY"||$.nodeName==="HTML"?S=$:S.appendChild($);else{if(!rt&&!Ve&&!Ze&&I.indexOf("<")===-1)return B&&Zt?B.createHTML(I):I;if(S=es(I),!S)return rt?null:Zt?j:""}S&&Cn&&Ce(S.firstChild);let te=ts(gt?I:S);for(;Z=te.nextNode();)ns(Z),os(Z),Z.content instanceof i&&is(Z.content);if(gt)return I;if(rt){if(Ve){S.normalize();let Ae=S.innerHTML;At([Ht,Ut,jt],De=>{Ae=lt(Ae,De," ")}),S.innerHTML=Ae}if(Vt)for(de=Ee.call(S.ownerDocument);S.firstChild;)de.appendChild(S.firstChild);else de=S;return(ue.shadowroot||ue.shadowrootmode)&&(de=Gt.call(r,de,!0)),de}let be=Ze?S.outerHTML:S.innerHTML;return Ze&&ae["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&ce(Qs,S.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
70
- `+be),Ve&&At([Ht,Ut,jt],Ae=>{be=lt(be,Ae," ")}),B&&Zt?B.createHTML(be):be},t.setConfig=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};In(I),En=!0},t.clearConfig=function(){it=null,En=!1},t.isValidAttribute=function(I,f,S){it||In({});let $=oe(I),Z=oe(f);return rs($,Z,S)},t.addHook=function(I,f){typeof f=="function"&&Tt(me[I],f)},t.removeHook=function(I,f){if(f!==void 0){let S=Na(me[I],f);return S===-1?void 0:Pa(me[I],S,1)[0]}return Ps(me[I])},t.removeHooks=function(I){me[I]=[]},t.removeAllHooks=function(){me=Xs()},t}var eo=Js();var T=class e{constructor(t,n){let r=" "+t,s,i=n&&n.loc;if(i&&i.start<=i.end){let u=i.lexer.input;s=i.start;let c=i.end;s===u.length?r+=" at end of input: ":r+=" at position "+(s+1)+`:
71
- `;let p=u.slice(s,c).replace(/[^]/g,"$&\u0332"),x;s>15?x="\u2026"+u.slice(s-15,s):x=u.slice(0,s);let g;c+15<u.length?g=u.slice(c,c+15)+"\u2026":g=u.slice(c),r+=x+p+g}let l=new Error(r);return l.name="ParseError",l.__proto__=e.prototype,l.position=s,l}};T.prototype.__proto__=Error.prototype;var Re=function(e,t){return e===void 0?t:e},ol=/([A-Z])/g,vr=function(e){return e.replace(ol,"-$1").toLowerCase()},il={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},al=/[&><"']/g;function ze(e){return String(e).replace(al,t=>il[t])}var dn=function(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?dn(e.body[0]):e:e.type==="font"?dn(e.body):e},yn=function(e){let t=dn(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},ll=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},ul=function(e){let 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"},ir=function(e){return+e.toFixed(4)},Io="aceg\u0131\u0237mnopqrsuvwxyz\u03B1\u03B3\u03B5\u03B7\u03B9\u03BA\u03BC\u03BD\u03BF\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C7\u03C9\u03D5\u{1D41A}\u{1D41C}\u{1D41E}\u{1D420}\u{1D426}\u{1D427}\u{1D428}\u{1D429}\u{1D42A}\u{1D42B}\u{1D42C}\u{1D42E}\u{1D42F}\u{1D430}\u{1D431}\u{1D432}\u{1D433}",Ct=class{constructor(t){t=t||{},this.displayMode=Re(t.displayMode,!1),this.annotate=Re(t.annotate,!1),this.leqno=Re(t.leqno,!1),this.throwOnError=Re(t.throwOnError,!1),this.errorColor=Re(t.errorColor,"#b22222"),this.macros=t.macros||{},this.wrap=Re(t.wrap,"none"),this.xml=Re(t.xml,!1),this.colorIsTextColor=Re(t.colorIsTextColor,!1),this.strict=Re(t.strict,!1),this.trust=Re(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,Re(t.maxExpand,1e3)),this.wrapDelimiterPairs=!0}isTrusted(t){if(t.url&&!t.protocol){let r=ul(t.url);if(r==null)return!1;t.protocol=r}return!!(typeof this.trust=="function"?this.trust(t):this.trust)}},Bo={},pn={};function D({type:e,names:t,props:n,handler:r,mathmlBuilder:s}){let i={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:r};for(let l=0;l<t.length;++l)Bo[t[l]]=i;e&&s&&(pn[e]=s)}function tt({type:e,mathmlBuilder:t}){D({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},mathmlBuilder:t})}var Dt=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},ie=function(e){return e.type==="ordgroup"?e.body:[e]},Lt=class{constructor(t){this.children=t,this.classes=[],this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){let t=document.createDocumentFragment();for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t="";for(let n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t}toText(){let t=n=>n.toText();return this.children.map(t).join("")}},pt=function(e){return e.filter(t=>t).join(" ")},cl=function(e,t){this.classes=e||[],this.attributes={},this.style=t||{}},dl=function(e){let t=document.createElement(e);t.className=pt(this.classes);for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);for(let n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t},pl=function(e){let t=`<${e}`;this.classes.length&&(t+=` class="${ze(pt(this.classes))}"`);let n="";for(let r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(n+=`${vr(r)}:${this.style[r]};`);n&&(t+=` style="${n}"`);for(let r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&(t+=` ${r}="${ze(this.attributes[r])}"`);t+=">";for(let r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+=`</${e}>`,t},hn=class{constructor(t,n,r){cl.call(this,t,r),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}toNode(){return dl.call(this,"span")}toMarkup(){return pl.call(this,"span")}},hl=class{constructor(t){this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return ze(this.text)}},mn=class{constructor(t,n,r){this.href=t,this.classes=n,this.children=r||[]}toNode(){let t=document.createElement("a");t.setAttribute("href",this.href),this.classes.length>0&&(t.className=pt(this.classes));for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t=`<a href='${ze(this.href)}'`;this.classes.length>0&&(t+=` class="${ze(pt(this.classes))}"`),t+=">";for(let n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t+="</a>",t}},hr=class{constructor(t,n,r){this.alt=n,this.src=t,this.classes=["mord"],this.style=r}hasClass(t){return this.classes.includes(t)}toNode(){let t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);return t}toMarkup(){let t=`<img src='${this.src}' alt='${this.alt}'`,n="";for(let r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(n+=`${vr(r)}:${this.style[r]};`);return n&&(t+=` style="${ze(n)}"`),t+=">",t}};function et(e){return new Lt(e)}var y=class{constructor(t,n,r,s){this.type=t,this.attributes={},this.children=n||[],this.classes=r||[],this.style=s||{},this.label=""}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}setLabel(t){this.label=t}toNode(){let t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(let n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=pt(this.classes));for(let n in this.style)Object.prototype.hasOwnProperty.call(this.style,n)&&(t.style[n]=this.style[n]);for(let n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){let t="<"+this.type;for(let r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&(t+=" "+r+'="',t+=ze(this.attributes[r]),t+='"');this.classes.length>0&&(t+=` class="${ze(pt(this.classes))}"`);let n="";for(let r in this.style)Object.prototype.hasOwnProperty.call(this.style,r)&&(n+=`${vr(r)}:${this.style[r]};`);n&&(t+=` style="${n}"`),t+=">";for(let r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}},se=class{constructor(t){this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return ze(this.toText())}toText(){return this.text}},Sr=e=>{let t;return e.length===1&&e[0].type==="mrow"?(t=e.pop(),t.type="mstyle"):t=new y("mstyle",e),t},dt=e=>{let t=0;if(e.body&&Array.isArray(e.body))for(let n of e.body)t+=dt(n);else if(e.body)t+=dt(e.body);else if(e.type==="supsub")t+=dt(e.base),e.sub&&(t+=.7*dt(e.sub)),e.sup&&(t+=.7*dt(e.sup));else if(e.type==="mathord"||e.type==="textord")for(let n of e.text.split("")){let r=n.codePointAt(0);96<r&&r<123||944<r&&r<970?t+=.56:47<r&&r<58?t+=.5:t+=.92}else t+=1;return t},ml={widehat:"^",widecheck:"\u02C7",widetilde:"~",wideparen:"\u23DC",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",overbracket:"\u23B4",underbracket:"\u23B5",overgroup:"\u23E0",overparen:"\u23DC",undergroup:"\u23E1",underparen:"\u23DD",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21D2",xRightarrow:"\u21D2",overleftharpoon:"\u21BC",xleftharpoonup:"\u21BC",overrightharpoon:"\u21C0",xrightharpoonup:"\u21C0",xLeftarrow:"\u21D0",xLeftrightarrow:"\u21D4",xhookleftarrow:"\u21A9",xhookrightarrow:"\u21AA",xmapsto:"\u21A6",xrightharpoondown:"\u21C1",xleftharpoondown:"\u21BD",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xrightleftarrows:"\u21C4",xtofrom:"\u21C4",xleftrightharpoons:"\u21CB",xrightleftharpoons:"\u21CC",yields:"\u2192",yieldsLeft:"\u2190",mesomerism:"\u2194",longrightharpoonup:"\u21C0",longleftharpoondown:"\u21BD",eqrightharpoonup:"\u21C0",eqleftharpoondown:"\u21BD","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"=",yieldsLeftRight:"\u21C4",chemequilibrium:"\u21CC"},_r=function(e){let t=new se(ml[e.slice(1)]),n=new y("mo",[t]);return n.setAttribute("stretchy","true"),n},fl=["\\widetilde","\\widehat","\\widecheck","\\utilde"],No=e=>{let t=_r(e.label);if(fl.includes(e.label)){let n=dt(e.base);1<n&&n<1.6?t.classes.push("tml-crooked-2"):1.6<=n&&n<2.5?t.classes.push("tml-crooked-3"):2.5<=n&&t.classes.push("tml-crooked-4")}return t},gl={bin:1,close:1,inner:1,open:1,punct:1,rel:1},bl={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},K={math:{},text:{}};function o(e,t,n,r,s){K[e][r]={group:t,replace:n},s&&n&&(K[e][n]=K[e][r])}var a="math",w="text",G="accent-token",k="bin",J="close",nt="inner",E="mathord",F="op-token",ee="open",$t="punct",m="rel",Fe="spacing",h="textord";o(a,m,"\u2261","\\equiv",!0);o(a,m,"\u227A","\\prec",!0);o(a,m,"\u227B","\\succ",!0);o(a,m,"\u223C","\\sim",!0);o(a,m,"\u27C2","\\perp",!0);o(a,m,"\u2AAF","\\preceq",!0);o(a,m,"\u2AB0","\\succeq",!0);o(a,m,"\u2243","\\simeq",!0);o(a,m,"\u224C","\\backcong",!0);o(a,m,"|","\\mid",!0);o(a,m,"\u226A","\\ll",!0);o(a,m,"\u226B","\\gg",!0);o(a,m,"\u224D","\\asymp",!0);o(a,m,"\u2225","\\parallel");o(a,m,"\u2323","\\smile",!0);o(a,m,"\u2291","\\sqsubseteq",!0);o(a,m,"\u2292","\\sqsupseteq",!0);o(a,m,"\u2250","\\doteq",!0);o(a,m,"\u2322","\\frown",!0);o(a,m,"\u220B","\\ni",!0);o(a,m,"\u220C","\\notni",!0);o(a,m,"\u221D","\\propto",!0);o(a,m,"\u22A2","\\vdash",!0);o(a,m,"\u22A3","\\dashv",!0);o(a,m,"\u220B","\\owns");o(a,m,"\u2258","\\arceq",!0);o(a,m,"\u2259","\\wedgeq",!0);o(a,m,"\u225A","\\veeeq",!0);o(a,m,"\u225B","\\stareq",!0);o(a,m,"\u225D","\\eqdef",!0);o(a,m,"\u225E","\\measeq",!0);o(a,m,"\u225F","\\questeq",!0);o(a,m,"\u2260","\\ne",!0);o(a,m,"\u2260","\\neq");o(a,m,"\u2A75","\\eqeq",!0);o(a,m,"\u2A76","\\eqeqeq",!0);o(a,m,"\u2237","\\dblcolon",!0);o(a,m,"\u2254","\\coloneqq",!0);o(a,m,"\u2255","\\eqqcolon",!0);o(a,m,"\u2239","\\eqcolon",!0);o(a,m,"\u2A74","\\Coloneqq",!0);o(a,$t,".","\\ldotp");o(a,$t,"\xB7","\\cdotp");o(a,h,"#","\\#");o(w,h,"#","\\#");o(a,h,"&","\\&");o(w,h,"&","\\&");o(a,h,"\u2135","\\aleph",!0);o(a,h,"\u2200","\\forall",!0);o(a,h,"\u210F","\\hbar",!0);o(a,h,"\u2203","\\exists",!0);o(a,ee,"\u2207","\\nabla",!0);o(a,h,"\u266D","\\flat",!0);o(a,h,"\u2113","\\ell",!0);o(a,h,"\u266E","\\natural",!0);o(a,h,"\u212B","\\Angstrom",!0);o(w,h,"\u212B","\\Angstrom",!0);o(a,h,"\u2663","\\clubsuit",!0);o(a,h,"\u2667","\\varclubsuit",!0);o(a,h,"\u2118","\\wp",!0);o(a,h,"\u266F","\\sharp",!0);o(a,h,"\u2662","\\diamondsuit",!0);o(a,h,"\u2666","\\vardiamondsuit",!0);o(a,h,"\u211C","\\Re",!0);o(a,h,"\u2661","\\heartsuit",!0);o(a,h,"\u2665","\\varheartsuit",!0);o(a,h,"\u2111","\\Im",!0);o(a,h,"\u2660","\\spadesuit",!0);o(a,h,"\u2664","\\varspadesuit",!0);o(a,h,"\u2640","\\female",!0);o(a,h,"\u2642","\\male",!0);o(a,h,"\xA7","\\S",!0);o(w,h,"\xA7","\\S");o(a,h,"\xB6","\\P",!0);o(w,h,"\xB6","\\P");o(w,h,"\u263A","\\smiley",!0);o(a,h,"\u263A","\\smiley",!0);o(a,h,"\u2020","\\dag");o(w,h,"\u2020","\\dag");o(w,h,"\u2020","\\textdagger");o(a,h,"\u2021","\\ddag");o(w,h,"\u2021","\\ddag");o(w,h,"\u2021","\\textdaggerdbl");o(a,J,"\u23B1","\\rmoustache",!0);o(a,ee,"\u23B0","\\lmoustache",!0);o(a,J,"\u27EF","\\rgroup",!0);o(a,ee,"\u27EE","\\lgroup",!0);o(a,k,"\u2213","\\mp",!0);o(a,k,"\u2296","\\ominus",!0);o(a,k,"\u228E","\\uplus",!0);o(a,k,"\u2293","\\sqcap",!0);o(a,k,"\u2217","\\ast");o(a,k,"\u2294","\\sqcup",!0);o(a,k,"\u25EF","\\bigcirc",!0);o(a,k,"\u2219","\\bullet",!0);o(a,k,"\u2021","\\ddagger");o(a,k,"\u2240","\\wr",!0);o(a,k,"\u2A3F","\\amalg");o(a,k,"&","\\And");o(a,k,"\u2AFD","\\sslash",!0);o(a,m,"\u27F5","\\longleftarrow",!0);o(a,m,"\u21D0","\\Leftarrow",!0);o(a,m,"\u27F8","\\Longleftarrow",!0);o(a,m,"\u27F6","\\longrightarrow",!0);o(a,m,"\u21D2","\\Rightarrow",!0);o(a,m,"\u27F9","\\Longrightarrow",!0);o(a,m,"\u2194","\\leftrightarrow",!0);o(a,m,"\u27F7","\\longleftrightarrow",!0);o(a,m,"\u21D4","\\Leftrightarrow",!0);o(a,m,"\u27FA","\\Longleftrightarrow",!0);o(a,m,"\u21A4","\\mapsfrom",!0);o(a,m,"\u21A6","\\mapsto",!0);o(a,m,"\u27FC","\\longmapsto",!0);o(a,m,"\u2197","\\nearrow",!0);o(a,m,"\u21A9","\\hookleftarrow",!0);o(a,m,"\u21AA","\\hookrightarrow",!0);o(a,m,"\u2198","\\searrow",!0);o(a,m,"\u21BC","\\leftharpoonup",!0);o(a,m,"\u21C0","\\rightharpoonup",!0);o(a,m,"\u2199","\\swarrow",!0);o(a,m,"\u21BD","\\leftharpoondown",!0);o(a,m,"\u21C1","\\rightharpoondown",!0);o(a,m,"\u2196","\\nwarrow",!0);o(a,m,"\u21CC","\\rightleftharpoons",!0);o(a,E,"\u21AF","\\lightning",!0);o(a,E,"\u220E","\\QED",!0);o(a,E,"\u2030","\\permil",!0);o(w,h,"\u2030","\\permil");o(a,E,"\u2609","\\astrosun",!0);o(a,E,"\u263C","\\sun",!0);o(a,E,"\u263E","\\leftmoon",!0);o(a,E,"\u263D","\\rightmoon",!0);o(a,E,"\u2295","\\Earth");o(a,m,"\u226E","\\nless",!0);o(a,m,"\u2A87","\\lneq",!0);o(a,m,"\u2268","\\lneqq",!0);o(a,m,"\u2268\uFE00","\\lvertneqq");o(a,m,"\u22E6","\\lnsim",!0);o(a,m,"\u2A89","\\lnapprox",!0);o(a,m,"\u2280","\\nprec",!0);o(a,m,"\u22E0","\\npreceq",!0);o(a,m,"\u22E8","\\precnsim",!0);o(a,m,"\u2AB9","\\precnapprox",!0);o(a,m,"\u2241","\\nsim",!0);o(a,m,"\u2224","\\nmid",!0);o(a,m,"\u2224","\\nshortmid");o(a,m,"\u22AC","\\nvdash",!0);o(a,m,"\u22AD","\\nvDash",!0);o(a,m,"\u22EA","\\ntriangleleft");o(a,m,"\u22EC","\\ntrianglelefteq",!0);o(a,m,"\u2284","\\nsubset",!0);o(a,m,"\u2285","\\nsupset",!0);o(a,m,"\u228A","\\subsetneq",!0);o(a,m,"\u228A\uFE00","\\varsubsetneq");o(a,m,"\u2ACB","\\subsetneqq",!0);o(a,m,"\u2ACB\uFE00","\\varsubsetneqq");o(a,m,"\u226F","\\ngtr",!0);o(a,m,"\u2A88","\\gneq",!0);o(a,m,"\u2269","\\gneqq",!0);o(a,m,"\u2269\uFE00","\\gvertneqq");o(a,m,"\u22E7","\\gnsim",!0);o(a,m,"\u2A8A","\\gnapprox",!0);o(a,m,"\u2281","\\nsucc",!0);o(a,m,"\u22E1","\\nsucceq",!0);o(a,m,"\u22E9","\\succnsim",!0);o(a,m,"\u2ABA","\\succnapprox",!0);o(a,m,"\u2246","\\ncong",!0);o(a,m,"\u2226","\\nparallel",!0);o(a,m,"\u2226","\\nshortparallel");o(a,m,"\u22AF","\\nVDash",!0);o(a,m,"\u22EB","\\ntriangleright");o(a,m,"\u22ED","\\ntrianglerighteq",!0);o(a,m,"\u228B","\\supsetneq",!0);o(a,m,"\u228B","\\varsupsetneq");o(a,m,"\u2ACC","\\supsetneqq",!0);o(a,m,"\u2ACC\uFE00","\\varsupsetneqq");o(a,m,"\u22AE","\\nVdash",!0);o(a,m,"\u2AB5","\\precneqq",!0);o(a,m,"\u2AB6","\\succneqq",!0);o(a,k,"\u22B4","\\unlhd");o(a,k,"\u22B5","\\unrhd");o(a,m,"\u219A","\\nleftarrow",!0);o(a,m,"\u219B","\\nrightarrow",!0);o(a,m,"\u21CD","\\nLeftarrow",!0);o(a,m,"\u21CF","\\nRightarrow",!0);o(a,m,"\u21AE","\\nleftrightarrow",!0);o(a,m,"\u21CE","\\nLeftrightarrow",!0);o(a,m,"\u25B3","\\vartriangle");o(a,h,"\u210F","\\hslash");o(a,h,"\u25BD","\\triangledown");o(a,h,"\u25CA","\\lozenge");o(a,h,"\u24C8","\\circledS");o(a,h,"\xAE","\\circledR",!0);o(w,h,"\xAE","\\circledR");o(w,h,"\xAE","\\textregistered");o(a,h,"\u2221","\\measuredangle",!0);o(a,h,"\u2204","\\nexists");o(a,h,"\u2127","\\mho");o(a,h,"\u2132","\\Finv",!0);o(a,h,"\u2141","\\Game",!0);o(a,h,"\u2035","\\backprime");o(a,h,"\u2036","\\backdprime");o(a,h,"\u2037","\\backtrprime");o(a,h,"\u25B2","\\blacktriangle");o(a,h,"\u25BC","\\blacktriangledown");o(a,h,"\u25A0","\\blacksquare");o(a,h,"\u29EB","\\blacklozenge");o(a,h,"\u2605","\\bigstar");o(a,h,"\u2222","\\sphericalangle",!0);o(a,h,"\u2201","\\complement",!0);o(a,h,"\u2571","\\diagup");o(a,h,"\u2572","\\diagdown");o(a,h,"\u25A1","\\square");o(a,h,"\u25A1","\\Box");o(a,h,"\u25CA","\\Diamond");o(a,h,"\xA5","\\yen",!0);o(w,h,"\xA5","\\yen",!0);o(a,h,"\u2713","\\checkmark",!0);o(w,h,"\u2713","\\checkmark");o(a,h,"\u2717","\\ballotx",!0);o(w,h,"\u2717","\\ballotx");o(w,h,"\u2022","\\textbullet");o(a,h,"\u2136","\\beth",!0);o(a,h,"\u2138","\\daleth",!0);o(a,h,"\u2137","\\gimel",!0);o(a,h,"\u03DD","\\digamma",!0);o(a,h,"\u03F0","\\varkappa");o(a,ee,"\u231C","\\ulcorner",!0);o(a,J,"\u231D","\\urcorner",!0);o(a,ee,"\u231E","\\llcorner",!0);o(a,J,"\u231F","\\lrcorner",!0);o(a,m,"\u2266","\\leqq",!0);o(a,m,"\u2A7D","\\leqslant",!0);o(a,m,"\u2A95","\\eqslantless",!0);o(a,m,"\u2272","\\lesssim",!0);o(a,m,"\u2A85","\\lessapprox",!0);o(a,m,"\u224A","\\approxeq",!0);o(a,k,"\u22D6","\\lessdot");o(a,m,"\u22D8","\\lll",!0);o(a,m,"\u2276","\\lessgtr",!0);o(a,m,"\u22DA","\\lesseqgtr",!0);o(a,m,"\u2A8B","\\lesseqqgtr",!0);o(a,m,"\u2251","\\doteqdot");o(a,m,"\u2253","\\risingdotseq",!0);o(a,m,"\u2252","\\fallingdotseq",!0);o(a,m,"\u223D","\\backsim",!0);o(a,m,"\u22CD","\\backsimeq",!0);o(a,m,"\u2AC5","\\subseteqq",!0);o(a,m,"\u22D0","\\Subset",!0);o(a,m,"\u228F","\\sqsubset",!0);o(a,m,"\u227C","\\preccurlyeq",!0);o(a,m,"\u22DE","\\curlyeqprec",!0);o(a,m,"\u227E","\\precsim",!0);o(a,m,"\u2AB7","\\precapprox",!0);o(a,m,"\u22B2","\\vartriangleleft");o(a,m,"\u22B4","\\trianglelefteq");o(a,m,"\u22A8","\\vDash",!0);o(a,m,"\u22AB","\\VDash",!0);o(a,m,"\u22AA","\\Vvdash",!0);o(a,m,"\u2323","\\smallsmile");o(a,m,"\u2322","\\smallfrown");o(a,m,"\u224F","\\bumpeq",!0);o(a,m,"\u224E","\\Bumpeq",!0);o(a,m,"\u2267","\\geqq",!0);o(a,m,"\u2A7E","\\geqslant",!0);o(a,m,"\u2A96","\\eqslantgtr",!0);o(a,m,"\u2273","\\gtrsim",!0);o(a,m,"\u2A86","\\gtrapprox",!0);o(a,k,"\u22D7","\\gtrdot");o(a,m,"\u22D9","\\ggg",!0);o(a,m,"\u2277","\\gtrless",!0);o(a,m,"\u22DB","\\gtreqless",!0);o(a,m,"\u2A8C","\\gtreqqless",!0);o(a,m,"\u2256","\\eqcirc",!0);o(a,m,"\u2257","\\circeq",!0);o(a,m,"\u225C","\\triangleq",!0);o(a,m,"\u223C","\\thicksim");o(a,m,"\u2248","\\thickapprox");o(a,m,"\u2AC6","\\supseteqq",!0);o(a,m,"\u22D1","\\Supset",!0);o(a,m,"\u2290","\\sqsupset",!0);o(a,m,"\u227D","\\succcurlyeq",!0);o(a,m,"\u22DF","\\curlyeqsucc",!0);o(a,m,"\u227F","\\succsim",!0);o(a,m,"\u2AB8","\\succapprox",!0);o(a,m,"\u22B3","\\vartriangleright");o(a,m,"\u22B5","\\trianglerighteq");o(a,m,"\u22A9","\\Vdash",!0);o(a,m,"\u2223","\\shortmid");o(a,m,"\u2225","\\shortparallel");o(a,m,"\u226C","\\between",!0);o(a,m,"\u22D4","\\pitchfork",!0);o(a,m,"\u221D","\\varpropto");o(a,m,"\u25C0","\\blacktriangleleft");o(a,m,"\u2234","\\therefore",!0);o(a,m,"\u220D","\\backepsilon");o(a,m,"\u25B6","\\blacktriangleright");o(a,m,"\u2235","\\because",!0);o(a,m,"\u22D8","\\llless");o(a,m,"\u22D9","\\gggtr");o(a,k,"\u22B2","\\lhd");o(a,k,"\u22B3","\\rhd");o(a,m,"\u2242","\\eqsim",!0);o(a,m,"\u2251","\\Doteq",!0);o(a,m,"\u297D","\\strictif",!0);o(a,m,"\u297C","\\strictfi",!0);o(a,k,"\u2214","\\dotplus",!0);o(a,k,"\u2216","\\smallsetminus");o(a,k,"\u22D2","\\Cap",!0);o(a,k,"\u22D3","\\Cup",!0);o(a,k,"\u2A5E","\\doublebarwedge",!0);o(a,k,"\u229F","\\boxminus",!0);o(a,k,"\u229E","\\boxplus",!0);o(a,k,"\u29C4","\\boxslash",!0);o(a,k,"\u22C7","\\divideontimes",!0);o(a,k,"\u22C9","\\ltimes",!0);o(a,k,"\u22CA","\\rtimes",!0);o(a,k,"\u22CB","\\leftthreetimes",!0);o(a,k,"\u22CC","\\rightthreetimes",!0);o(a,k,"\u22CF","\\curlywedge",!0);o(a,k,"\u22CE","\\curlyvee",!0);o(a,k,"\u229D","\\circleddash",!0);o(a,k,"\u229B","\\circledast",!0);o(a,k,"\u22BA","\\intercal",!0);o(a,k,"\u22D2","\\doublecap");o(a,k,"\u22D3","\\doublecup");o(a,k,"\u22A0","\\boxtimes",!0);o(a,k,"\u22C8","\\bowtie",!0);o(a,k,"\u22C8","\\Join");o(a,k,"\u27D5","\\leftouterjoin",!0);o(a,k,"\u27D6","\\rightouterjoin",!0);o(a,k,"\u27D7","\\fullouterjoin",!0);o(a,k,"\u2238","\\dotminus",!0);o(a,k,"\u27D1","\\wedgedot",!0);o(a,k,"\u27C7","\\veedot",!0);o(a,k,"\u2A62","\\doublebarvee",!0);o(a,k,"\u2A63","\\veedoublebar",!0);o(a,k,"\u2A5F","\\wedgebar",!0);o(a,k,"\u2A60","\\wedgedoublebar",!0);o(a,k,"\u2A54","\\Vee",!0);o(a,k,"\u2A53","\\Wedge",!0);o(a,k,"\u2A43","\\barcap",!0);o(a,k,"\u2A42","\\barcup",!0);o(a,k,"\u2A48","\\capbarcup",!0);o(a,k,"\u2A40","\\capdot",!0);o(a,k,"\u2A47","\\capovercup",!0);o(a,k,"\u2A46","\\cupovercap",!0);o(a,k,"\u2A4D","\\closedvarcap",!0);o(a,k,"\u2A4C","\\closedvarcup",!0);o(a,k,"\u2A2A","\\minusdot",!0);o(a,k,"\u2A2B","\\minusfdots",!0);o(a,k,"\u2A2C","\\minusrdots",!0);o(a,k,"\u22BB","\\Xor",!0);o(a,k,"\u22BC","\\Nand",!0);o(a,k,"\u22BD","\\Nor",!0);o(a,k,"\u22BD","\\barvee");o(a,k,"\u2AF4","\\interleave",!0);o(a,k,"\u29E2","\\shuffle",!0);o(a,k,"\u2AF6","\\threedotcolon",!0);o(a,k,"\u2982","\\typecolon",!0);o(a,k,"\u223E","\\invlazys",!0);o(a,k,"\u2A4B","\\twocaps",!0);o(a,k,"\u2A4A","\\twocups",!0);o(a,k,"\u2A4E","\\Sqcap",!0);o(a,k,"\u2A4F","\\Sqcup",!0);o(a,k,"\u2A56","\\veeonvee",!0);o(a,k,"\u2A55","\\wedgeonwedge",!0);o(a,k,"\u29D7","\\blackhourglass",!0);o(a,k,"\u29C6","\\boxast",!0);o(a,k,"\u29C8","\\boxbox",!0);o(a,k,"\u29C7","\\boxcircle",!0);o(a,k,"\u229C","\\circledequal",!0);o(a,k,"\u29B7","\\circledparallel",!0);o(a,k,"\u29B6","\\circledvert",!0);o(a,k,"\u29B5","\\circlehbar",!0);o(a,k,"\u27E1","\\concavediamond",!0);o(a,k,"\u27E2","\\concavediamondtickleft",!0);o(a,k,"\u27E3","\\concavediamondtickright",!0);o(a,k,"\u22C4","\\diamond",!0);o(a,k,"\u29D6","\\hourglass",!0);o(a,k,"\u27E0","\\lozengeminus",!0);o(a,k,"\u233D","\\obar",!0);o(a,k,"\u29B8","\\obslash",!0);o(a,k,"\u2A38","\\odiv",!0);o(a,k,"\u29C1","\\ogreaterthan",!0);o(a,k,"\u29C0","\\olessthan",!0);o(a,k,"\u29B9","\\operp",!0);o(a,k,"\u2A37","\\Otimes",!0);o(a,k,"\u2A36","\\otimeshat",!0);o(a,k,"\u22C6","\\star",!0);o(a,k,"\u25B3","\\triangle",!0);o(a,k,"\u2A3A","\\triangleminus",!0);o(a,k,"\u2A39","\\triangleplus",!0);o(a,k,"\u2A3B","\\triangletimes",!0);o(a,k,"\u27E4","\\whitesquaretickleft",!0);o(a,k,"\u27E5","\\whitesquaretickright",!0);o(a,k,"\u2A33","\\smashtimes",!0);o(a,m,"\u21E2","\\dashrightarrow",!0);o(a,m,"\u21E0","\\dashleftarrow",!0);o(a,m,"\u21C7","\\leftleftarrows",!0);o(a,m,"\u21C6","\\leftrightarrows",!0);o(a,m,"\u21DA","\\Lleftarrow",!0);o(a,m,"\u219E","\\twoheadleftarrow",!0);o(a,m,"\u21A2","\\leftarrowtail",!0);o(a,m,"\u21AB","\\looparrowleft",!0);o(a,m,"\u21CB","\\leftrightharpoons",!0);o(a,m,"\u21B6","\\curvearrowleft",!0);o(a,m,"\u21BA","\\circlearrowleft",!0);o(a,m,"\u21B0","\\Lsh",!0);o(a,m,"\u21C8","\\upuparrows",!0);o(a,m,"\u21BF","\\upharpoonleft",!0);o(a,m,"\u21C3","\\downharpoonleft",!0);o(a,m,"\u22B6","\\origof",!0);o(a,m,"\u22B7","\\imageof",!0);o(a,m,"\u22B8","\\multimap",!0);o(a,m,"\u21AD","\\leftrightsquigarrow",!0);o(a,m,"\u21C9","\\rightrightarrows",!0);o(a,m,"\u21C4","\\rightleftarrows",!0);o(a,m,"\u21A0","\\twoheadrightarrow",!0);o(a,m,"\u21A3","\\rightarrowtail",!0);o(a,m,"\u21AC","\\looparrowright",!0);o(a,m,"\u21B7","\\curvearrowright",!0);o(a,m,"\u21BB","\\circlearrowright",!0);o(a,m,"\u21B1","\\Rsh",!0);o(a,m,"\u21CA","\\downdownarrows",!0);o(a,m,"\u21BE","\\upharpoonright",!0);o(a,m,"\u21C2","\\downharpoonright",!0);o(a,m,"\u21DD","\\rightsquigarrow",!0);o(a,m,"\u21DD","\\leadsto");o(a,m,"\u21DB","\\Rrightarrow",!0);o(a,m,"\u21BE","\\restriction");o(a,h,"\u2018","`");o(a,h,"$","\\$");o(w,h,"$","\\$");o(w,h,"$","\\textdollar");o(a,h,"\xA2","\\cent");o(w,h,"\xA2","\\cent");o(a,h,"%","\\%");o(w,h,"%","\\%");o(a,h,"_","\\_");o(w,h,"_","\\_");o(w,h,"_","\\textunderscore");o(w,h,"\u2423","\\textvisiblespace",!0);o(a,h,"\u2220","\\angle",!0);o(a,h,"\u221E","\\infty",!0);o(a,h,"\u2032","\\prime");o(a,h,"\u2033","\\dprime");o(a,h,"\u2034","\\trprime");o(a,h,"\u2057","\\qprime");o(a,h,"\u25B3","\\triangle");o(w,h,"\u0391","\\Alpha",!0);o(w,h,"\u0392","\\Beta",!0);o(w,h,"\u0393","\\Gamma",!0);o(w,h,"\u0394","\\Delta",!0);o(w,h,"\u0395","\\Epsilon",!0);o(w,h,"\u0396","\\Zeta",!0);o(w,h,"\u0397","\\Eta",!0);o(w,h,"\u0398","\\Theta",!0);o(w,h,"\u0399","\\Iota",!0);o(w,h,"\u039A","\\Kappa",!0);o(w,h,"\u039B","\\Lambda",!0);o(w,h,"\u039C","\\Mu",!0);o(w,h,"\u039D","\\Nu",!0);o(w,h,"\u039E","\\Xi",!0);o(w,h,"\u039F","\\Omicron",!0);o(w,h,"\u03A0","\\Pi",!0);o(w,h,"\u03A1","\\Rho",!0);o(w,h,"\u03A3","\\Sigma",!0);o(w,h,"\u03A4","\\Tau",!0);o(w,h,"\u03A5","\\Upsilon",!0);o(w,h,"\u03A6","\\Phi",!0);o(w,h,"\u03A7","\\Chi",!0);o(w,h,"\u03A8","\\Psi",!0);o(w,h,"\u03A9","\\Omega",!0);o(a,E,"\u0391","\\Alpha",!0);o(a,E,"\u0392","\\Beta",!0);o(a,E,"\u0393","\\Gamma",!0);o(a,E,"\u0394","\\Delta",!0);o(a,E,"\u0395","\\Epsilon",!0);o(a,E,"\u0396","\\Zeta",!0);o(a,E,"\u0397","\\Eta",!0);o(a,E,"\u0398","\\Theta",!0);o(a,E,"\u0399","\\Iota",!0);o(a,E,"\u039A","\\Kappa",!0);o(a,E,"\u039B","\\Lambda",!0);o(a,E,"\u039C","\\Mu",!0);o(a,E,"\u039D","\\Nu",!0);o(a,E,"\u039E","\\Xi",!0);o(a,E,"\u039F","\\Omicron",!0);o(a,E,"\u03A0","\\Pi",!0);o(a,E,"\u03A1","\\Rho",!0);o(a,E,"\u03A3","\\Sigma",!0);o(a,E,"\u03A4","\\Tau",!0);o(a,E,"\u03A5","\\Upsilon",!0);o(a,E,"\u03A6","\\Phi",!0);o(a,E,"\u03A7","\\Chi",!0);o(a,E,"\u03A8","\\Psi",!0);o(a,E,"\u03A9","\\Omega",!0);o(a,ee,"\xAC","\\neg",!0);o(a,ee,"\xAC","\\lnot");o(a,h,"\u22A4","\\top");o(a,h,"\u22A5","\\bot");o(a,h,"\u2205","\\emptyset");o(a,h,"\u2300","\\varnothing");o(a,E,"\u03B1","\\alpha",!0);o(a,E,"\u03B2","\\beta",!0);o(a,E,"\u03B3","\\gamma",!0);o(a,E,"\u03B4","\\delta",!0);o(a,E,"\u03F5","\\epsilon",!0);o(a,E,"\u03B6","\\zeta",!0);o(a,E,"\u03B7","\\eta",!0);o(a,E,"\u03B8","\\theta",!0);o(a,E,"\u03B9","\\iota",!0);o(a,E,"\u03BA","\\kappa",!0);o(a,E,"\u03BB","\\lambda",!0);o(a,E,"\u03BC","\\mu",!0);o(a,E,"\u03BD","\\nu",!0);o(a,E,"\u03BE","\\xi",!0);o(a,E,"\u03BF","\\omicron",!0);o(a,E,"\u03C0","\\pi",!0);o(a,E,"\u03C1","\\rho",!0);o(a,E,"\u03C3","\\sigma",!0);o(a,E,"\u03C4","\\tau",!0);o(a,E,"\u03C5","\\upsilon",!0);o(a,E,"\u03D5","\\phi",!0);o(a,E,"\u03C7","\\chi",!0);o(a,E,"\u03C8","\\psi",!0);o(a,E,"\u03C9","\\omega",!0);o(a,E,"\u03B5","\\varepsilon",!0);o(a,E,"\u03D1","\\vartheta",!0);o(a,E,"\u03D6","\\varpi",!0);o(a,E,"\u03F1","\\varrho",!0);o(a,E,"\u03C2","\\varsigma",!0);o(a,E,"\u03C6","\\varphi",!0);o(a,E,"\u03D8","\\Coppa",!0);o(a,E,"\u03D9","\\coppa",!0);o(a,E,"\u03D9","\\varcoppa",!0);o(a,E,"\u03DE","\\Koppa",!0);o(a,E,"\u03DF","\\koppa",!0);o(a,E,"\u03E0","\\Sampi",!0);o(a,E,"\u03E1","\\sampi",!0);o(a,E,"\u03DA","\\Stigma",!0);o(a,E,"\u03DB","\\stigma",!0);o(a,E,"\u2AEB","\\Bot");o(a,h,"\xF0","\\eth",!0);o(w,h,"\xF0","\xF0");o(a,h,"\xC5","\\AA");o(w,h,"\xC5","\\AA",!0);o(a,h,"\xC6","\\AE",!0);o(w,h,"\xC6","\\AE",!0);o(a,h,"\xD0","\\DH",!0);o(w,h,"\xD0","\\DH",!0);o(a,h,"\xDE","\\TH",!0);o(w,h,"\xDE","\\TH",!0);o(a,h,"\xDF","\\ss",!0);o(w,h,"\xDF","\\ss",!0);o(a,h,"\xE5","\\aa");o(w,h,"\xE5","\\aa",!0);o(a,h,"\xE6","\\ae",!0);o(w,h,"\xE6","\\ae",!0);o(a,h,"\xF0","\\dh");o(w,h,"\xF0","\\dh",!0);o(a,h,"\xFE","\\th",!0);o(w,h,"\xFE","\\th",!0);o(a,h,"\u0110","\\DJ",!0);o(w,h,"\u0110","\\DJ",!0);o(a,h,"\u0111","\\dj",!0);o(w,h,"\u0111","\\dj",!0);o(a,h,"\u0141","\\L",!0);o(w,h,"\u0141","\\L",!0);o(a,h,"\u0141","\\l",!0);o(w,h,"\u0141","\\l",!0);o(a,h,"\u014A","\\NG",!0);o(w,h,"\u014A","\\NG",!0);o(a,h,"\u014B","\\ng",!0);o(w,h,"\u014B","\\ng",!0);o(a,h,"\u0152","\\OE",!0);o(w,h,"\u0152","\\OE",!0);o(a,h,"\u0153","\\oe",!0);o(w,h,"\u0153","\\oe",!0);o(a,k,"\u2217","\u2217",!0);o(a,k,"+","+");o(a,k,"\u2217","*");o(a,k,"\u2044","/",!0);o(a,k,"\u2044","\u2044");o(a,k,"\u2212","-",!0);o(a,k,"\u22C5","\\cdot",!0);o(a,k,"\u2218","\\circ",!0);o(a,k,"\xF7","\\div",!0);o(a,k,"\xB1","\\pm",!0);o(a,k,"\xD7","\\times",!0);o(a,k,"\u2229","\\cap",!0);o(a,k,"\u222A","\\cup",!0);o(a,k,"\u2216","\\setminus",!0);o(a,k,"\u2227","\\land");o(a,k,"\u2228","\\lor");o(a,k,"\u2227","\\wedge",!0);o(a,k,"\u2228","\\vee",!0);o(a,ee,"\u27E6","\\llbracket",!0);o(a,J,"\u27E7","\\rrbracket",!0);o(a,ee,"\u27E8","\\langle",!0);o(a,ee,"\u27EA","\\lAngle",!0);o(a,ee,"\u2989","\\llangle",!0);o(a,ee,"|","\\lvert");o(a,ee,"\u2016","\\lVert",!0);o(a,h,"!","\\oc");o(a,h,"?","\\wn");o(a,h,"\u2193","\\shpos");o(a,h,"\u2195","\\shift");o(a,h,"\u2191","\\shneg");o(a,J,"?","?");o(a,J,"!","!");o(a,J,"\u203C","\u203C");o(a,J,"\u27E9","\\rangle",!0);o(a,J,"\u27EB","\\rAngle",!0);o(a,J,"\u298A","\\rrangle",!0);o(a,J,"|","\\rvert");o(a,J,"\u2016","\\rVert");o(a,ee,"\u2983","\\lBrace",!0);o(a,J,"\u2984","\\rBrace",!0);o(a,m,"=","\\equal",!0);o(a,m,":",":");o(a,m,"\u2248","\\approx",!0);o(a,m,"\u2245","\\cong",!0);o(a,m,"\u2265","\\ge");o(a,m,"\u2265","\\geq",!0);o(a,m,"\u2190","\\gets");o(a,m,">","\\gt",!0);o(a,m,"\u2208","\\in",!0);o(a,m,"\u2209","\\notin",!0);o(a,m,"\uE020","\\@not");o(a,m,"\u2282","\\subset",!0);o(a,m,"\u2283","\\supset",!0);o(a,m,"\u2286","\\subseteq",!0);o(a,m,"\u2287","\\supseteq",!0);o(a,m,"\u2288","\\nsubseteq",!0);o(a,m,"\u2288","\\nsubseteqq");o(a,m,"\u2289","\\nsupseteq",!0);o(a,m,"\u2289","\\nsupseteqq");o(a,m,"\u22A8","\\models");o(a,m,"\u2190","\\leftarrow",!0);o(a,m,"\u2264","\\le");o(a,m,"\u2264","\\leq",!0);o(a,m,"<","\\lt",!0);o(a,m,"\u2192","\\rightarrow",!0);o(a,m,"\u2192","\\to");o(a,m,"\u2271","\\ngeq",!0);o(a,m,"\u2271","\\ngeqq");o(a,m,"\u2271","\\ngeqslant");o(a,m,"\u2270","\\nleq",!0);o(a,m,"\u2270","\\nleqq");o(a,m,"\u2270","\\nleqslant");o(a,m,"\u2AEB","\\Perp",!0);o(a,Fe,"\xA0","\\ ");o(a,Fe,"\xA0","\\space");o(a,Fe,"\xA0","\\nobreakspace");o(w,Fe,"\xA0","\\ ");o(w,Fe,"\xA0"," ");o(w,Fe,"\xA0","\\space");o(w,Fe,"\xA0","\\nobreakspace");o(a,Fe,null,"\\nobreak");o(a,Fe,null,"\\allowbreak");o(a,$t,",",",");o(w,$t,":",":");o(a,$t,";",";");o(a,k,"\u22BC","\\barwedge");o(a,k,"\u22BB","\\veebar");o(a,k,"\u2299","\\odot",!0);o(a,k,"\u2295\uFE0E","\\oplus");o(a,k,"\u2297","\\otimes",!0);o(a,h,"\u2202","\\partial",!0);o(a,k,"\u2298","\\oslash",!0);o(a,k,"\u229A","\\circledcirc",!0);o(a,k,"\u22A1","\\boxdot",!0);o(a,k,"\u25B3","\\bigtriangleup");o(a,k,"\u25BD","\\bigtriangledown");o(a,k,"\u2020","\\dagger");o(a,k,"\u22C4","\\diamond");o(a,k,"\u25C3","\\triangleleft");o(a,k,"\u25B9","\\triangleright");o(a,ee,"{","\\{");o(w,h,"{","\\{");o(w,h,"{","\\textbraceleft");o(a,J,"}","\\}");o(w,h,"}","\\}");o(w,h,"}","\\textbraceright");o(a,ee,"{","\\lbrace");o(a,J,"}","\\rbrace");o(a,ee,"[","\\lbrack",!0);o(w,h,"[","\\lbrack",!0);o(a,J,"]","\\rbrack",!0);o(w,h,"]","\\rbrack",!0);o(a,ee,"(","\\lparen",!0);o(a,J,")","\\rparen",!0);o(a,ee,"\u2987","\\llparenthesis",!0);o(a,J,"\u2988","\\rrparenthesis",!0);o(w,h,"<","\\textless",!0);o(w,h,">","\\textgreater",!0);o(a,ee,"\u230A","\\lfloor",!0);o(a,J,"\u230B","\\rfloor",!0);o(a,ee,"\u2308","\\lceil",!0);o(a,J,"\u2309","\\rceil",!0);o(a,h,"\\","\\backslash");o(a,h,"|","|");o(a,h,"|","\\vert");o(w,h,"|","\\textbar",!0);o(a,h,"\u2016","\\|");o(a,h,"\u2016","\\Vert");o(w,h,"\u2016","\\textbardbl");o(w,h,"~","\\textasciitilde");o(w,h,"\\","\\textbackslash");o(w,h,"^","\\textasciicircum");o(a,m,"\u2191","\\uparrow",!0);o(a,m,"\u21D1","\\Uparrow",!0);o(a,m,"\u2193","\\downarrow",!0);o(a,m,"\u21D3","\\Downarrow",!0);o(a,m,"\u2195","\\updownarrow",!0);o(a,m,"\u21D5","\\Updownarrow",!0);o(a,F,"\u2210","\\coprod");o(a,F,"\u22C1","\\bigvee");o(a,F,"\u22C0","\\bigwedge");o(a,F,"\u2A04","\\biguplus");o(a,F,"\u2A04","\\bigcupplus");o(a,F,"\u2A03","\\bigcupdot");o(a,F,"\u2A07","\\bigdoublevee");o(a,F,"\u2A08","\\bigdoublewedge");o(a,F,"\u22C2","\\bigcap");o(a,F,"\u22C3","\\bigcup");o(a,F,"\u222B","\\int");o(a,F,"\u222B","\\intop");o(a,F,"\u222C","\\iint");o(a,F,"\u222D","\\iiint");o(a,F,"\u220F","\\prod");o(a,F,"\u2211","\\sum");o(a,F,"\u2A02","\\bigotimes");o(a,F,"\u2A01","\\bigoplus");o(a,F,"\u2A00","\\bigodot");o(a,F,"\u2A09","\\bigtimes");o(a,F,"\u222E","\\oint");o(a,F,"\u222F","\\oiint");o(a,F,"\u2230","\\oiiint");o(a,F,"\u2231","\\intclockwise");o(a,F,"\u2232","\\varointclockwise");o(a,F,"\u2A0C","\\iiiint");o(a,F,"\u2A0D","\\intbar");o(a,F,"\u2A0E","\\intBar");o(a,F,"\u2A0F","\\fint");o(a,F,"\u2A12","\\rppolint");o(a,F,"\u2A13","\\scpolint");o(a,F,"\u2A15","\\pointint");o(a,F,"\u2A16","\\sqint");o(a,F,"\u2A17","\\intlarhk");o(a,F,"\u2A18","\\intx");o(a,F,"\u2A19","\\intcap");o(a,F,"\u2A1A","\\intcup");o(a,F,"\u2A05","\\bigsqcap");o(a,F,"\u2A06","\\bigsqcup");o(a,F,"\u222B","\\smallint");o(w,nt,"\u2026","\\textellipsis");o(a,nt,"\u2026","\\mathellipsis");o(w,nt,"\u2026","\\ldots",!0);o(a,nt,"\u2026","\\ldots",!0);o(a,nt,"\u22F0","\\iddots",!0);o(a,nt,"\u22EF","\\@cdots",!0);o(a,nt,"\u22F1","\\ddots",!0);o(a,h,"\u22EE","\\varvdots");o(w,h,"\u22EE","\\varvdots");o(a,G,"\xB4","\\acute");o(a,G,"`","\\grave");o(a,G,"\xA8","\\ddot");o(a,G,"\u2026","\\dddot");o(a,G,"\u2026.","\\ddddot");o(a,G,"~","\\tilde");o(a,G,"\u203E","\\bar");o(a,G,"\u02D8","\\breve");o(a,G,"\u02C7","\\check");o(a,G,"^","\\hat");o(a,G,"\u2192","\\vec");o(a,G,"\u02D9","\\dot");o(a,G,"\u02DA","\\mathring");o(a,E,"\u0131","\\imath",!0);o(a,E,"\u0237","\\jmath",!0);o(a,h,"\u0131","\u0131");o(a,h,"\u0237","\u0237");o(w,h,"\u0131","\\i",!0);o(w,h,"\u0237","\\j",!0);o(w,h,"\xF8","\\o",!0);o(a,E,"\xF8","\\o",!0);o(w,h,"\xD8","\\O",!0);o(a,E,"\xD8","\\O",!0);o(w,G,"\u02CA","\\'");o(w,G,"\u02CB","\\`");o(w,G,"\u02C6","\\^");o(w,G,"~","\\~");o(w,G,"\u02C9","\\=");o(w,G,"\u02D8","\\u");o(w,G,"\u02D9","\\.");o(w,G,"\xB8","\\c");o(w,G,"\u02DA","\\r");o(w,G,"\u02C7","\\v");o(w,G,"\xA8",'\\"');o(w,G,"\u02DD","\\H");o(a,G,"\u02CA","\\'");o(a,G,"\u02CB","\\`");o(a,G,"\u02C6","\\^");o(a,G,"~","\\~");o(a,G,"\u02C9","\\=");o(a,G,"\u02D8","\\u");o(a,G,"\u02D9","\\.");o(a,G,"\xB8","\\c");o(a,G,"\u02DA","\\r");o(a,G,"\u02C7","\\v");o(a,G,"\xA8",'\\"');o(a,G,"\u02DD","\\H");var xl={"--":!0,"---":!0,"``":!0,"''":!0};o(w,h,"\u2013","--",!0);o(w,h,"\u2013","\\textendash");o(w,h,"\u2014","---",!0);o(w,h,"\u2014","\\textemdash");o(w,h,"\u2018","`",!0);o(w,h,"\u2018","\\textquoteleft");o(w,h,"\u2019","'",!0);o(w,h,"\u2019","\\textquoteright");o(w,h,"\u201C","``",!0);o(w,h,"\u201C","\\textquotedblleft");o(w,h,"\u201D","''",!0);o(w,h,"\u201D","\\textquotedblright");o(a,h,"\xB0","\\degree",!0);o(w,h,"\xB0","\\degree");o(w,h,"\xB0","\\textdegree",!0);o(a,h,"\xA3","\\pounds");o(a,h,"\xA3","\\mathsterling",!0);o(w,h,"\xA3","\\pounds");o(w,h,"\xA3","\\textsterling",!0);o(a,h,"\u2720","\\maltese");o(w,h,"\u2720","\\maltese");o(a,h,"\u20AC","\\euro",!0);o(w,h,"\u20AC","\\euro",!0);o(w,h,"\u20AC","\\texteuro");o(a,h,"\xA9","\\copyright",!0);o(w,h,"\xA9","\\textcopyright");o(a,h,"\u2300","\\diameter",!0);o(w,h,"\u2300","\\diameter");o(a,h,"\u{1D6E4}","\\varGamma");o(a,h,"\u{1D6E5}","\\varDelta");o(a,h,"\u{1D6E9}","\\varTheta");o(a,h,"\u{1D6EC}","\\varLambda");o(a,h,"\u{1D6EF}","\\varXi");o(a,h,"\u{1D6F1}","\\varPi");o(a,h,"\u{1D6F4}","\\varSigma");o(a,h,"\u{1D6F6}","\\varUpsilon");o(a,h,"\u{1D6F7}","\\varPhi");o(a,h,"\u{1D6F9}","\\varPsi");o(a,h,"\u{1D6FA}","\\varOmega");o(w,h,"\u{1D6E4}","\\varGamma");o(w,h,"\u{1D6E5}","\\varDelta");o(w,h,"\u{1D6E9}","\\varTheta");o(w,h,"\u{1D6EC}","\\varLambda");o(w,h,"\u{1D6EF}","\\varXi");o(w,h,"\u{1D6F1}","\\varPi");o(w,h,"\u{1D6F4}","\\varSigma");o(w,h,"\u{1D6F6}","\\varUpsilon");o(w,h,"\u{1D6F7}","\\varPhi");o(w,h,"\u{1D6F9}","\\varPsi");o(w,h,"\u{1D6FA}","\\varOmega");var to='0123456789/@."';for(let e=0;e<to.length;e++){let t=to.charAt(e);o(a,h,t,t)}var no='0123456789!@*()-=+";:?/.,';for(let e=0;e<no.length;e++){let t=no.charAt(e);o(w,h,t,t)}var fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e<fn.length;e++){let t=fn.charAt(e);o(a,E,t,t),o(w,h,t,t)}var ro="\xC7\xD0\xDE\xE7\xFE\u2102\u210D\u2115\u2119\u211A\u211D\u2124\u210E\u210F\u210A\u210B\u210C\u2110\u2111\u2112\u2113\u2118\u211B\u211C\u212C\u2130\u2131\u2133\u212D\u2128";for(let e=0;e<ro.length;e++){let t=ro.charAt(e);o(a,E,t,t),o(w,h,t,t)}var q="";for(let e=0;e<fn.length;e++){q=String.fromCharCode(55349,56320+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,56372+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,56424+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,56580+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,56736+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,56788+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,56840+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,56944+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,56632+e),o(a,E,q,q),o(w,h,q,q);let t=fn.charAt(e);q=String.fromCharCode(55349,56476+e),o(a,E,t,q),o(w,h,t,q)}for(let e=0;e<10;e++)q=String.fromCharCode(55349,57294+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,57314+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,57324+e),o(a,E,q,q),o(w,h,q,q),q=String.fromCharCode(55349,57334+e),o(a,E,q,q),o(w,h,q,q);function yl(e,t,n){let r=[],s=[],i=[],l=0,u=0;for(;u<e.length;){for(;e[u]instanceof Lt;)e.splice(u,1,...e[u].children);let c=e[u];if(c.attributes&&c.attributes.linebreak&&c.attributes.linebreak==="newline"){i.length>0&&s.push(new y("mrow",i)),s.push(c),i=[];let p=new y("mtd",s);p.style.textAlign="left",r.push(new y("mtr",[p])),s=[],u+=1;continue}if(i.push(c),c.type&&c.type==="mo"&&c.children.length===1&&!(c.attributes.form&&c.attributes.form==="prefix")&&!Object.prototype.hasOwnProperty.call(c.attributes,"movablelimits")){let p=c.children[0].text;if(t==="="&&p==="="){if(l+=1,l>1){i.pop();let x=new y("mrow",i);s.push(x),i=[c]}}else if(t==="tex"){let x=u<e.length-1?e[u+1]:null,g=!0;if(!(x&&x.type==="mtext"&&x.attributes.linebreak&&x.attributes.linebreak==="nobreak"))for(let b=u+1;b<e.length;b++){let v=e[b];if(v.type&&v.type==="mspace"&&!(v.attributes.linebreak&&v.attributes.linebreak==="newline"))i.push(v),u+=1,v.attributes&&v.attributes.linebreak&&v.attributes.linebreak==="nobreak"&&(g=!1);else break}if(g){let b=new y("mrow",i);s.push(b),i=[]}}}u+=1}if(i.length>0){let c=new y("mrow",i);s.push(c)}if(r.length>0){let c=new y("mtd",s);c.style.textAlign="left";let p=new y("mtr",[c]);r.push(p);let x=new y("mtable",r);return n||(x.setAttribute("columnalign","left"),x.setAttribute("rowspacing","0em")),x}return et(s)}var ve=function(e,t,n){return K[t][e]&&K[t][e].replace&&e.charCodeAt(0)!==55349&&!(Object.prototype.hasOwnProperty.call(xl,e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(e=K[t][e].replace),new se(e)},so=(e,t)=>{if(e.children.length===0||e.children[e.children.length-1].type!=="mtext"){let n=new y("mtext",[new se(t.children[0].text)]);e.children.push(n)}else e.children[e.children.length-1].children[0].text+=t.children[0].text},wn=e=>{if(e.type!=="mrow"&&e.type!=="mstyle"||e.children.length===0)return e;let t=new y("mrow");for(let n=0;n<e.children.length;n++){let r=e.children[n];if(r.type==="mtext"&&Object.keys(r.attributes).length===0)so(t,r);else if(r.type==="mrow"){let s=!0;for(let i=0;i<r.children.length;i++)if(r.children[i].type!=="mtext"||Object.keys(r.attributes).length!==0){s=!1;break}if(s)for(let i=0;i<r.children.length;i++){let l=r.children[i];so(t,l)}else t.children.push(r)}else t.children.push(r)}for(let n=0;n<t.children.length;n++)if(t.children[n].type==="mtext"){let r=t.children[n];r.children[0].text.charAt(0)===" "&&(r.children[0].text="\xA0"+r.children[0].text.slice(1));let s=r.children[0].text.length;s>0&&r.children[0].text.charAt(s-1)===" "&&(r.children[0].text=r.children[0].text.slice(0,-1)+"\xA0");for(let[i,l]of Object.entries(e.attributes))r.attributes[i]=l}return t.children.length===1&&t.children[0].type==="mtext"?t.children[0]:t},Mt=function(e,t=!1){if(e.length===1&&!(e[0]instanceof Lt))return e[0];if(!t){e[0]instanceof y&&e[0].type==="mo"&&!e[0].attributes.fence&&(e[0].attributes.lspace="0em",e[0].attributes.rspace="0em");let n=e.length-1;e[n]instanceof y&&e[n].type==="mo"&&!e[n].attributes.fence&&(e[n].attributes.lspace="0em",e[n].attributes.rspace="0em")}return new y("mrow",e)};function ar(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){let t=e.children[0];return t instanceof se&&t.text==="."}else if(e.type==="mtext"&&e.children.length===1){let t=e.children[0];return t instanceof se&&t.text==="\u2008"}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){let t=e.children[0];return t instanceof se&&t.text===","}else return!1}var wl=(e,t)=>{let n=e[t],r=e[t+1];return n.type==="atom"&&n.text===","&&n.loc&&r.loc&&n.loc.end===r.loc.start},on=e=>e.type==="atom"&&e.family==="rel"||e.type==="mclass"&&e.mclass==="mrel",he=function(e,t,n=!1){if(!n&&e.length===1){let l=U(e[0],t);return l instanceof y&&l.type==="mo"&&(l.setAttribute("lspace","0em"),l.setAttribute("rspace","0em")),[l]}let r=[],s=[],i;for(let l=0;l<e.length;l++)s.push(U(e[l],t));for(let l=0;l<s.length;l++){let u=s[l];if(l<e.length-1&&on(e[l])&&on(e[l+1])&&u.setAttribute("rspace","0em"),l>0&&on(e[l])&&on(e[l-1])&&u.setAttribute("lspace","0em"),u.type==="mn"&&i&&i.type==="mn"){i.children.push(...u.children);continue}else if(ar(u)&&i&&i.type==="mn"){i.children.push(...u.children);continue}else if(i&&i.type==="mn"&&l<s.length-1&&s[l+1].type==="mn"&&wl(e,l)){i.children.push(...u.children);continue}else if(u.type==="mn"&&ar(i))u.children=[...i.children,...u.children],r.pop();else if((u.type==="msup"||u.type==="msub")&&u.children.length>=1&&i&&(i.type==="mn"||ar(i))){let c=u.children[0];c instanceof y&&c.type==="mn"&&i&&(c.children=[...i.children,...c.children],r.pop())}r.push(u),i=u}return r},je=function(e,t,n=!1){return Mt(he(e,t,n),n)},U=function(e,t){if(!e)return new y("mrow");if(pn[e.type])return pn[e.type](e,t);throw new T("Got group of unknown type: '"+e.type+"'")},oo=e=>new y("mtd",[],[],{padding:"0",width:"50%"}),kl=["mrow","mtd","mtable","mtr"],mr=e=>{for(let t of e.children)if(t.type&&kl.includes(t.type)){if(t.classes&&t.classes[0]==="tml-label")return t.label;{let n=mr(t);if(n)return n}}else if(!t.type){let n=mr(t);if(n)return n}},Al=(e,t,n,r)=>{t=je(t[0].body,n),t=wn(t),t.classes.push("tml-tag");let s=mr(e);e=new y("mtd",[e]);let i=[oo(),e,oo()];i[r?0:2].children.push(t);let l=new y("mtr",i,["tml-tageqn"]);s&&l.setAttribute("id",s);let u=new y("mtable",[l]);return u.style.width="100%",u.setAttribute("displaystyle","true"),u};function Tl(e,t,n,r){let s=null;e.length===1&&e[0].type==="tag"&&(s=e[0].tag,e=e[0].body);let i=he(e,n);if(i.length===1&&i[0]instanceof mn)return i[0];let l=r.displayMode||r.annotate?"none":r.wrap,u=i.length===0?null:i[0],c=i.length===1&&s===null&&u instanceof y?i[0]:yl(i,l,r.displayMode);if(s&&(c=Al(c,s,n,r.leqno)),r.annotate){let x=new y("annotation",[new se(t)]);x.setAttribute("encoding","application/x-tex"),c=new y("semantics",[c,x])}let p=new y("math",[c]);return r.xml&&p.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r.displayMode&&(p.setAttribute("display","block"),p.style.display="block math",p.classes=["tml-display"]),p}var vl="DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5",Sl="BCEGIMNOPQRSTXZlpqtw\u0393\u0398\u039E\u03A3\u03A6\u03A9\u03B2\u03B5\u03B6\u03B8\u03BE\u03C1\u03C2\u03C6\u03C8\u03D1\u03D5\u03F1",_l="AFJdf\u0394\u039B",Po=(e,t)=>{let n=e.isStretchy?No(e):new y("mo",[ve(e.label,e.mode)]);e.isStretchy||n.setAttribute("stretchy","false"),e.label!=="\\vec"&&(n.style.mathDepth="0");let r=e.label==="\\c"?"munder":"mover",s=Cl.has(e.label);if(r==="mover"&&e.mode==="math"&&!e.isStretchy&&e.base.text&&e.base.text.length===1){let l=e.base.text,u=e.label==="\\vec",c=u==="\\vec"?"-vec":"";u&&n.classes.push("tml-vec");let p=u?"-vec":s?"-acc":"";vl.indexOf(l)>-1?(n.classes.push(`chr-sml${c}`),n.classes.push(`wbk-sml${p}`)):Sl.indexOf(l)>-1?(n.classes.push(`chr-med${c}`),n.classes.push(`wbk-med${p}`)):_l.indexOf(l)>-1?(n.classes.push(`chr-lrg${c}`),n.classes.push(`wbk-lrg${p}`)):u?n.classes.push("wbk-vec"):s&&n.classes.push("wbk-acc")}else s&&n.classes.push("wbk-acc");return new y(r,[U(e.base,t),n])},El=new Set(["\\acute","\\check","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"]),Cl=new Set(["\\acute","\\bar","\\breve","\\check","\\dot","\\ddot","\\grave","\\hat","\\mathring","\\`","\\'","\\^","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v"]),io={"\\`":"\u0300","\\'":"\u0301","\\^":"\u0302","\\~":"\u0303","\\=":"\u0304","\\u":"\u0306","\\.":"\u0307",'\\"':"\u0308","\\r":"\u030A","\\H":"\u030B","\\v":"\u030C","\\c":"\u0327"};D({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)=>{let n=Dt(t[0]),r=!El.has(e.funcName);return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,base:n}},mathmlBuilder:Po});D({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\c","\\u","\\.",'\\"',"\\r","\\H","\\v"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{let n=Dt(t[0]),r=e.parser.mode;return r==="math"&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),r==="text"&&n.text&&n.text.length===1&&e.funcName in io&&Io.indexOf(n.text)>-1?{type:"textord",mode:"text",text:n.text+io[e.funcName]}:e.funcName==="\\c"&&r==="text"&&n.text&&n.text.length===1?{type:"textord",mode:"text",text:n.text+"\u0327"}:{type:"accent",mode:r,label:e.funcName,isStretchy:!1,base:n}},mathmlBuilder:Po});D({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underparen","\\utilde"],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>{let r=n[0];return{type:"accentUnder",mode:e.mode,label:t,base:r}},mathmlBuilder:(e,t)=>{let n=No(e);return n.style["math-depth"]=0,new y("munder",[U(e.base,t),n])}});var ao={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},Dl=["em","ex","mu","pt","mm","cm","in","px","bp","pc","dd","cc","nd","nc","sp"],zo=function(e){return typeof e!="string"&&(e=e.unit),Dl.indexOf(e)>-1},Fo=e=>{let t=Math.max(e-1,0);return[1,.7,.5][t]},Ie=function(e,t){let n=e.number;if(t.maxSize[0]<0&&n>0)return{number:0,unit:"em"};let r=e.unit;switch(r){case"mm":case"cm":case"in":case"px":return n*ao[r]>t.maxSize[1]?{number:t.maxSize[1],unit:"pt"}:{number:n,unit:r};case"em":case"ex":return r==="ex"&&(n*=.431),n=Math.min(n/Fo(t.level),t.maxSize[0]),{number:ir(n),unit:"em"};case"bp":return n>t.maxSize[1]&&(n=t.maxSize[1]),{number:n,unit:"pt"};case"pt":case"pc":case"dd":case"cc":case"nd":case"nc":case"sp":return n=Math.min(n*ao[r],t.maxSize[1]),{number:ir(n),unit:"pt"};case"mu":return n=Math.min(n/18,t.maxSize[0]),{number:ir(n),unit:"em"};default:throw new T("Invalid unit: '"+r+"'")}},re=e=>{let t=new y("mspace");return t.setAttribute("width",e+"em"),t},an=(e,t=.3,n=0,r=!1)=>{if(e==null&&n===0)return re(t);let s=e?[e]:[];if(t!==0&&s.unshift(re(t)),n>0&&s.push(re(n)),r){let i=new y("mpadded",s);return i.setAttribute("height","0.1px"),i}else return new y("mrow",s)},lr=(e,t)=>Number(e)/Fo(t),fr=(e,t,n,r)=>{let s=_r(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");let u=r.withLevel(r.level<2?2:3),c=lr(l,u.level),p=lr(l,3),x=an(null,c.toFixed(4),0),g=an(null,p.toFixed(4),0),b=lr(i?0:.3,u.level).toFixed(4),v,_,O=t&&t.body&&(t.body.body||t.body.length>0);if(O){let L=U(t,u);L=an(L,b,b,e==="\\\\cdrightarrow"||e==="\\\\cdleftarrow"),v=new y("mover",[L,g])}let R=n&&n.body&&(n.body.body||n.body.length>0);if(R){let L=U(n,u);L=an(L,b,b),_=new y("munder",[L,g])}let C;return!O&&!R?C=new y("mover",[s,x]):O&&R?C=new y("munderover",[s,_,v]):O?C=new y("mover",[s,v]):C=new y("munder",[s,_]),l==="3.0"&&(C.style.height="1em"),C.setAttribute("accent","false"),C};D({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},n,r){return{type:"xArrow",mode:e.mode,name:t,body:n[0],below:r[0]}},mathmlBuilder(e,t){let r=[fr(e.name,e.body,e.below,t)];return r.unshift(re(.2778)),r.push(re(.2778)),new y("mrow",r)}});var lo={"\\equilibriumRight":["\\longrightharpoonup","\\eqleftharpoondown"],"\\equilibriumLeft":["\\eqrightharpoonup","\\longleftharpoondown"]};D({type:"stackedArrow",names:["\\equilibriumRight","\\equilibriumLeft"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},n,r){let s=n[0]?{type:"hphantom",mode:e.mode,body:n[0]}:null,i=r[0]?{type:"hphantom",mode:e.mode,body:r[0]}:null;return{type:"stackedArrow",mode:e.mode,name:t,body:n[0],upperArrowBelow:i,lowerArrowBody:s,below:r[0]}},mathmlBuilder(e,t){let n=lo[e.name][0],r=lo[e.name][1],s=fr(n,e.body,e.upperArrowBelow,t),i=fr(r,e.lowerArrowBody,e.below,t),l,u=new y("mpadded",[s]);if(u.setAttribute("voffset","0.3em"),u.setAttribute("height","+0.3em"),u.setAttribute("depth","-0.3em"),e.name==="\\equilibriumLeft"){let c=new y("mpadded",[i]);c.setAttribute("width","0.5em"),l=new y("mpadded",[re(.2778),c,u,re(.2778)])}else u.setAttribute("width",e.name==="\\equilibriumRight"?"0.5em":"0"),l=new y("mpadded",[re(.2778),u,i,re(.2778)]);return l.setAttribute("voffset","-0.18em"),l.setAttribute("height","-0.18em"),l.setAttribute("depth","+0.18em"),l}});var Go={};function Se({type:e,names:t,props:n,handler:r,mathmlBuilder:s}){let i={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:r};for(let l=0;l<t.length;++l)Go[t[l]]=i;s&&(pn[e]=s)}function P(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 Er(e){let t=kn(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 kn(e){return e&&(e.type==="atom"||e.type==="delimiter"||Object.prototype.hasOwnProperty.call(bl,e.type))?e:null}var Ll={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},uo=()=>({type:"styling",body:[],mode:"math",scriptLevel:"display"}),co=e=>e.type==="textord"&&e.text==="@",Rl=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function ql(e,t,n){let r=Ll[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{let s=n.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},l=n.callFunction("\\Big",[i],[]),u=n.callFunction("\\\\cdright",[t[1]],[]),c={type:"ordgroup",mode:"math",body:[s,l,u],semisimple:!0};return n.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{let s={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[s],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Ol(e){let 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();let 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 T("Expected \\\\ or \\cr or \\end",e.nextToken)}let n=[],r=[n];for(let s=0;s<t.length;s++){let i=t[s],l=uo();for(let u=0;u<i.length;u++)if(!co(i[u]))l.body.push(i[u]);else{n.push(l),u+=1;let c=Er(i[u]).text,p=new Array(2);if(p[0]={type:"ordgroup",mode:"math",body:[]},p[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(c)>-1))if("<>AV".indexOf(c)>-1)for(let g=0;g<2;g++){let b=!0;for(let v=u+1;v<i.length;v++){if(Rl(i[v],c)){b=!1,u=v;break}if(co(i[v]))throw new T("Missing a "+c+" character to complete a CD arrow.",i[v]);p[g].body.push(i[v])}if(b)throw new T("Missing a "+c+" character to complete a CD arrow.",i[u])}else throw new T('Expected one of "<>AV=|." after @.');let x=ql(c,p,e);n.push(x),l=uo()}s%2===0?n.push(l):n.shift(),n=[],r.push(n)}return r.pop(),e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:"math",body:r,tags:null,labels:new Array(r.length+1).fill(""),envClasses:["jot","cd"],cols:[],hLinesBeforeRow:new Array(r.length+1).fill([])}}D({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler({parser:e,funcName:t},n){return{type:"cdlabel",mode:e.mode,side:t.slice(4),label:n[0]}},mathmlBuilder(e,t){if(e.label.body.length===0)return new y("mrow",t);let n=U(e.label,t);e.side==="left"&&n.classes.push("tml-shift-left");let r=new y("mtd",[n]);r.style.padding="0";let s=new y("mtr",[r]),i=new y("mtable",[s]),l=new y("mpadded",[i]);return l.setAttribute("width","0.1px"),l.setAttribute("displaystyle","false"),l.setAttribute("scriptlevel","1"),l}});D({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 y("mrow",[U(e.fragment,t)])}});var Ho=e=>({type:"ordgroup",mode:"math",body:e,semisimple:!0}),ur=(e,t)=>({type:t,mode:"math",body:Ho(e)}),$l=(e,t)=>{let n=e.body;n[0].shift();let r=new Array(n.length-1).fill().map(()=>[]);for(let g=1;g<n.length;g++){r[g-1].push(n[g].shift());let b=[];for(let v=0;v<n[g].length;v++)b.push(n[g][v]);r[g-1].push(ur(b,"vphantom"))}let s=new Array(n.length).fill().map(()=>[]);for(let g=0;g<n[0].length;g++)s[0].push(n[0][g]);for(let g=1;g<n.length;g++)for(let b=0;b<n[0].length;b++)s[g].push(ur(n[g][b].body,"hphantom"));for(let g=0;g<n[0].length;g++)n[0][g]=ur(n[0][g].body,"hphantom");let i={type:"array",mode:"math",body:r,cols:[{type:"align",align:"c"}],rowGaps:new Array(r.length-1).fill(null),hLinesBeforeRow:new Array(r.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:"text",arraystretch:1,labels:new Array(r.length).fill(""),arraycolsep:{number:.04,unit:"em"}},u={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}]},x={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:u,sub:null};return Ho([i,x])},we=class e{constructor(t,n,r){this.lexer=t,this.start=n,this.end=r}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new e(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}},qe=class e{constructor(t,n){this.text=t,this.loc=n}range(t,n){return new e(n,we.range(this,t))}},X={DISPLAY:0,TEXT:1,SCRIPT:2,SCRIPTSCRIPT:3},Uo={};function d(e,t){Uo[e]=t}var Ml=Uo;d("\\noexpand",function(e){let t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});d("\\expandafter",function(e){let t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});d("\\@firstoftwo",function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}});d("\\@secondoftwo",function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}});d("\\@ifnextchar",function(e){let t=e.consumeArgs(3);e.consumeSpaces();let n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});d("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");d("\\TextOrMath",function(e){let t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var gr=e=>{let t="";for(let n=e.length-1;n>-1;n--)t+=e[n].text;return t},Cr={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},po=e=>{let t=e.future().text;return t==="EOF"?[null,""]:[Cr[t.charAt(0)],t]},ho=(e,t,n)=>{for(let r=1;r<t.length;r++){let s=Cr[t.charAt(r)];e*=n,e+=s}return e};d("\\char",function(e){let t=e.popToken(),n,r="";if(t.text==="'")n=8,t=e.popToken();else if(t.text==='"')n=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")r=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new T("\\char` missing argument");r=t.text.charCodeAt(0)}else n=10;if(n){let s=t.text;if(r=Cr[s.charAt(0)],r==null||r>=n)throw new T(`Invalid base-${n} digit ${t.text}`);r=ho(r,s,n);let i;for([i,s]=po(e);i!=null&&i<n;)r*=n,r+=i,r=ho(r,s,n),e.popToken(),[i,s]=po(e)}return`\\@char{${r}}`});function Dr(e){let t=e.consumeArgs(1)[0],n="",r=t[t.length-1].loc.start;for(let s=t.length-1;s>=0;s--){let i=t[s].loc.start;i>r&&(n+=" ",r=i),n+=t[s].text,r+=t[s].text.length}return n}d("\\surd","\\sqrt{\\vphantom{|}}");d("\u2295","\\oplus");d("\\long","");d("\\bgroup","{");d("\\egroup","}");d("~","\\nobreakspace");d("\\lq","`");d("\\rq","'");d("\\aa","\\r a");d("\\Bbbk","\\Bbb{k}");d("\\mathstrut","\\vphantom{(}");d("\\underbar","\\underline{\\text{#1}}");d("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");d("\u22EE","\\vdots");d("\\arraystretch","1");d("\\arraycolsep","6pt");d("\\substack","\\begin{subarray}{c}#1\\end{subarray}");d("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");d("\\implies","\\DOTSB\\;\\Longrightarrow\\;");d("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");var mo={",":"\\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"};d("\\dots",function(e){let t="\\dotso",n=e.expandAfterFuture().text;return n in mo?t=mo[n]:(n.slice(0,4)==="\\not"||n in K.math&&["bin","rel"].includes(K.math[n].group))&&(t="\\dotsb"),t});var Lr={")":!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};d("\\dotso",function(e){return e.future().text in Lr?"\\ldots\\,":"\\ldots"});d("\\dotsc",function(e){let t=e.future().text;return t in Lr&&t!==","?"\\ldots\\,":"\\ldots"});d("\\cdots",function(e){return e.future().text in Lr?"\\@cdots\\,":"\\@cdots"});d("\\dotsb","\\cdots");d("\\dotsm","\\cdots");d("\\dotsi","\\!\\cdots");d("\\idotsint","\\int\\!\\cdots\\!\\int");d("\\dotsx","\\ldots\\,");d("\\DOTSI","\\relax");d("\\DOTSB","\\relax");d("\\DOTSX","\\relax");d("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");d("\\,","{\\tmspace+{3mu}{.1667em}}");d("\\thinspace","\\,");d("\\>","\\mskip{4mu}");d("\\:","{\\tmspace+{4mu}{.2222em}}");d("\\medspace","\\:");d("\\;","{\\tmspace+{5mu}{.2777em}}");d("\\thickspace","\\;");d("\\!","{\\tmspace-{3mu}{.1667em}}");d("\\negthinspace","\\!");d("\\negmedspace","{\\tmspace-{4mu}{.2222em}}");d("\\negthickspace","{\\tmspace-{5mu}{.277em}}");d("\\enspace","\\kern.5em ");d("\\enskip","\\hskip.5em\\relax");d("\\quad","\\hskip1em\\relax");d("\\qquad","\\hskip2em\\relax");d("\\AA","\\TextOrMath{\\Angstrom}{\\mathring{A}}\\relax");d("\\tag","\\@ifstar\\tag@literal\\tag@paren");d("\\tag@paren","\\tag@literal{({#1})}");d("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new T("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});d("\\notag","\\nonumber");d("\\nonumber","\\gdef\\@eqnsw{0}");d("\\bmod","\\mathbin{\\text{mod}}");d("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");d("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");d("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");d("\\newline","\\\\\\relax");d("\\TeX","\\textrm{T}\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125em\\textrm{X}");d("\\LaTeX","\\textrm{L}\\kern-.35em\\raisebox{0.2em}{\\scriptstyle A}\\kern-.15em\\TeX");d("\\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}}");d("\\hspace","\\@ifstar\\@hspacer\\@hspace");d("\\@hspace","\\hskip #1\\relax");d("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");d("\\colon",'\\mathpunct{\\char"3a}');d("\\prescript","\\pres@cript{_{#1}^{#2}}{}{#3}");d("\\ordinarycolon",'\\char"3a');d("\\vcentcolon","\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}}");d("\\coloneq",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2212}');d("\\Coloneq",'\\mathrel{\\char"2237\\char"2212}');d("\\Eqqcolon",'\\mathrel{\\char"3d\\char"2237}');d("\\Eqcolon",'\\mathrel{\\char"2212\\char"2237}');d("\\colonapprox",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2248}');d("\\Colonapprox",'\\mathrel{\\char"2237\\char"2248}');d("\\colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}');d("\\Colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}');d("\\ratio","\\vcentcolon");d("\\coloncolon","\\dblcolon");d("\\colonequals","\\coloneqq");d("\\coloncolonequals","\\Coloneqq");d("\\equalscolon","\\eqqcolon");d("\\equalscoloncolon","\\Eqqcolon");d("\\colonminus","\\coloneq");d("\\coloncolonminus","\\Coloneq");d("\\minuscolon","\\eqcolon");d("\\minuscoloncolon","\\Eqcolon");d("\\coloncolonapprox","\\Colonapprox");d("\\coloncolonsim","\\Colonsim");d("\\notni","\\mathrel{\\char`\u220C}");d("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");d("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");d("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");d("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");d("\\varlimsup","\\DOTSB\\operatorname*{\\overline{\\text{lim}}}");d("\\varliminf","\\DOTSB\\operatorname*{\\underline{\\text{lim}}}");d("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{\\text{lim}}}");d("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{\\text{lim}}}");d("\\centerdot","{\\medspace\\rule{0.167em}{0.189em}\\medspace}");d("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");d("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");d("\\plim","\\DOTSB\\operatorname*{plim}");d("\\leftmodels","\\mathop{\\reflectbox{$\\models$}}");d("\\bra","\\mathinner{\\langle{#1}|}");d("\\ket","\\mathinner{|{#1}\\rangle}");d("\\braket","\\mathinner{\\langle{#1}\\rangle}");d("\\Bra","\\left\\langle#1\\right|");d("\\Ket","\\left|#1\\right\\rangle");var jo=(e,t)=>{let r=`}\\,\\middle${t[0]==="|"?"\\vert":"\\Vert"}\\,{`;return e.slice(0,t.index)+r+e.slice(t.index+t[0].length)};d("\\Braket",function(e){let t=Dr(e),n=/\|\||\||\\\|/g,r;for(;(r=n.exec(t))!==null;)t=jo(t,r);return"\\left\\langle{"+t+"}\\right\\rangle"});d("\\Set",function(e){let t=Dr(e),n=/\|\||\||\\\|/.exec(t);return n&&(t=jo(t,n)),"\\left\\{\\:{"+t+"}\\:\\right\\}"});d("\\set",function(e){return"\\{{"+Dr(e).replace(/\|/,"}\\mid{")+"}\\}"});d("\\angln","{\\angl n}");d("\\odv","\\@ifstar\\odv@next\\odv@numerator");d("\\odv@numerator","\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}");d("\\odv@next","\\frac{\\mathrm{d}}{\\mathrm{d}#2}#1");d("\\pdv","\\@ifstar\\pdv@next\\pdv@numerator");var Wo=e=>{let t=e[0][0].text,n=gr(e[1]).split(","),r=String(n.length),s=r==="1"?"\\partial":`\\partial^${r}`,i="";return n.map(l=>{i+="\\partial "+l.trim()+"\\,"}),[t,s,i.replace(/\\,$/,"")]};d("\\pdv@numerator",function(e){let[t,n,r]=Wo(e.consumeArgs(2));return`\\frac{${n} ${t}}{${r}}`});d("\\pdv@next",function(e){let[t,n,r]=Wo(e.consumeArgs(2));return`\\frac{${n}}{${r}} ${t}`});d("\\upalpha","\\up@greek{\\alpha}");d("\\upbeta","\\up@greek{\\beta}");d("\\upgamma","\\up@greek{\\gamma}");d("\\updelta","\\up@greek{\\delta}");d("\\upepsilon","\\up@greek{\\epsilon}");d("\\upzeta","\\up@greek{\\zeta}");d("\\upeta","\\up@greek{\\eta}");d("\\uptheta","\\up@greek{\\theta}");d("\\upiota","\\up@greek{\\iota}");d("\\upkappa","\\up@greek{\\kappa}");d("\\uplambda","\\up@greek{\\lambda}");d("\\upmu","\\up@greek{\\mu}");d("\\upnu","\\up@greek{\\nu}");d("\\upxi","\\up@greek{\\xi}");d("\\upomicron","\\up@greek{\\omicron}");d("\\uppi","\\up@greek{\\pi}");d("\\upalpha","\\up@greek{\\alpha}");d("\\uprho","\\up@greek{\\rho}");d("\\upsigma","\\up@greek{\\sigma}");d("\\uptau","\\up@greek{\\tau}");d("\\upupsilon","\\up@greek{\\upsilon}");d("\\upphi","\\up@greek{\\phi}");d("\\upchi","\\up@greek{\\chi}");d("\\uppsi","\\up@greek{\\psi}");d("\\upomega","\\up@greek{\\omega}");d("\\invamp",'\\mathbin{\\char"214b}');d("\\parr",'\\mathbin{\\char"214b}');d("\\upand",'\\mathbin{\\char"214b}');d("\\with",'\\mathbin{\\char"26}');d("\\multimapinv",'\\mathrel{\\char"27dc}');d("\\multimapboth",'\\mathrel{\\char"29df}');d("\\scoh",'{\\mkern5mu\\char"2322\\mkern5mu}');d("\\sincoh",'{\\mkern5mu\\char"2323\\mkern5mu}');d("\\coh",`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2322}}}
72
- {\\smash{\\lower4mu{\\char"2323}}}\\mkern5mu}`);d("\\incoh",`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2323}}}
73
- {\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}`);d("\\standardstate","\\text{\\tiny\\char`\u29B5}");d("\\ce",function(e){return Vo(e.consumeArgs(1)[0],"ce")});d("\\pu",function(e){return Vo(e.consumeArgs(1)[0],"pu")});d("\\uniDash","{\\rule{0.672em}{0.06em}}");d("\\triDash","{\\rule{0.15em}{0.06em}\\kern2mu\\rule{0.15em}{0.06em}\\kern2mu\\rule{0.15em}{0.06em}}");d("\\tripleDash","\\kern0.075em\\raise0.25em{\\triDash}\\kern0.075em");d("\\tripleDashOverLine","\\kern0.075em\\mathrlap{\\raise0.125em{\\uniDash}}\\raise0.34em{\\triDash}\\kern0.075em");d("\\tripleDashOverDoubleLine","\\kern0.075em\\mathrlap{\\mathrlap{\\raise0.48em{\\triDash}}\\raise0.27em{\\uniDash}}{\\raise0.05em{\\uniDash}}\\kern0.075em");d("\\tripleDashBetweenDoubleLine","\\kern0.075em\\mathrlap{\\mathrlap{\\raise0.48em{\\uniDash}}\\raise0.27em{\\triDash}}{\\raise0.05em{\\uniDash}}\\kern0.075em");var Vo=function(e,t){for(var n="",r=e.length&&e[e.length-1].loc.start,s=e.length-1;s>=0;s--)e[s].loc.start>r&&(n+=" ",r=e[s].loc.start),n+=e[s].text,r+=e[s].text.length;var i=V.go(A.go(n,t));return i},A={go:function(e,t){if(!e)return[];t===void 0&&(t="ce");var n="0",r={};r.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 u=A.stateMachines[t],c=u.transitions[n]||u.transitions["*"];e:for(var p=0;p<c.length;p++){var x=A.patterns.match_(c[p].pattern,e);if(x){for(var g=c[p].task,b=0;b<g.action_.length;b++){var v;if(u.actions[g.action_[b].type_])v=u.actions[g.action_[b].type_](r,x.match_,g.action_[b].option);else if(A.actions[g.action_[b].type_])v=A.actions[g.action_[b].type_](r,x.match_,g.action_[b].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+g.action_[b].type_+")"];A.concatArray(l,v)}if(n=g.nextState||n,e.length>0){if(g.revisit||(e=x.remainder),!g.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 n=0;n<t.length;n++)e.push(t[n]);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=A.patterns.findObserveGroups(e,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(t&&t.remainder.match(/^($|[\s,;\)\]\}])/))return t;var n=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return n?{match_:n[0],remainder:e.substr(n[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return A.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return A.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return A.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return A.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return A.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return A.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return A.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return A.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return A.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return A.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return A.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return A.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return A.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 A.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return A.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return A.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return A.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 A.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return A.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return A.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return A.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return A.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return A.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return A.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return A.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 n=A.patterns.findObserveGroups(e,"","$","$","");return n&&(t=n.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,n,r,s,i,l,u,c,p){var x=function(C,L){if(typeof L=="string")return C.indexOf(L)!==0?null:L;var M=C.match(L);return M?M[0]:null},g=function(C,L,M){for(var B=0;L<C.length;){var j=C.charAt(L),W=x(C.substr(L),M);if(W!==null&&B===0)return{endMatchBegin:L,endMatchEnd:L+W.length};if(j==="{")B++;else if(j==="}"){if(B===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];B--}L++}return B>0,null},b=x(e,t);if(b===null||(e=e.substr(b.length),b=x(e,n),b===null))return null;var v=g(e,b.length,r||s);if(v===null)return null;var _=e.substring(0,r?v.endMatchEnd:v.endMatchBegin);if(i||l){var O=this.findObserveGroups(e.substr(v.endMatchEnd),i,l,u,c);if(O===null)return null;var R=[_,O.match_];return{match_:p?R.join(""):R,remainder:O.remainder}}else return{match_:_,remainder:e.substr(v.endMatchEnd)}},match_:function(e,t){var n=A.patterns.patterns[e];if(n===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if(typeof n=="function")return A.patterns.patterns[e](t);var r=t.match(n);if(r){var s;return r[2]?s=[r[1],r[2]]:r[1]?s=r[1]:s=r[0],{match_:s,remainder:t.substr(r[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,n){return{type_:n}},"insert+p1":function(e,t,n){return{type_:n,p1:t}},"insert+p1+p2":function(e,t,n){return{type_:n,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 A.go(t,"text")},"{text}":function(e,t){var n=["{"];return A.concatArray(n,A.go(t,"text")),n.push("}"),n},"tex-math":function(e,t){return A.go(t,"tex-math")},"tex-math tight":function(e,t){return A.go(t,"tex-math tight")},bond:function(e,t,n){return{type_:"bond",kind_:n||t}},"color0-output":function(e,t){return{type_:"color0",color:t[0]}},ce:function(e,t){return A.go(t)},"1/2":function(e,t){var n=[];t.match(/^[+\-]/)&&(n.push(t.substr(0,1)),t=t.substr(1));var r=t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return r[1]=r[1].replace(/\$/g,""),n.push({type_:"frac",p1:r[1],p2:r[2]}),r[3]&&(r[3]=r[3].replace(/\$/g,""),n.push({type_:"tex-math",p1:r[3]})),n},"9,9":function(e,t){return A.go(t,"9,9")}},createTransitions:function(e){var t,n,r,s,i={};for(t in e)for(n in e[t])for(r=n.split("|"),e[t][n].stateArray=r,s=0;s<r.length;s++)i[r[s]]=[];for(t in e)for(n in e[t])for(r=e[t][n].stateArray||[],s=0;s<r.length;s++){var l=e[t][n];if(l.action_){l.action_=[].concat(l.action_);for(var u=0;u<l.action_.length;u++)typeof l.action_[u]=="string"&&(l.action_[u]={type_:l.action_[u]})}else l.action_=[];for(var c=t.split("|"),p=0;p<c.length;p++)if(r[s]==="*")for(var x in i)i[x].push({pattern:c[p],task:l});else i[r[s]].push({pattern:c[p],task:l})}return i},stateMachines:{}};A.stateMachines={ce:{transitions:A.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 n;if((e.d||"").match(/^[0-9]+$/)){var r=e.d;e.d=void 0,n=this.output(e),e.b=r}else n=this.output(e);return A.actions["o="](e,t),n},"d= kv":function(e,t){e.d=t,e.dType="kv"},"charge or bond":function(e,t){if(e.beginsWithBond){var n=[];return A.concatArray(n,this.output(e)),A.concatArray(n,A.actions.bond(e,t,"-")),n}else e.d=t},"- after o/d":function(e,t,n){var r=A.patterns.match_("orbital",e.o||""),s=A.patterns.match_("one lowercase greek letter $",e.o||""),i=A.patterns.match_("one lowercase latin letter $",e.o||""),l=A.patterns.match_("$one lowercase latin letter$ $",e.o||""),u=t==="-"&&(r&&r.remainder===""||s||i||l);u&&!e.a&&!e.b&&!e.p&&!e.d&&!e.q&&!r&&i&&(e.o="$"+e.o+"$");var c=[];return u?(A.concatArray(c,this.output(e)),c.push({type_:"hyphen"})):(r=A.patterns.match_("digits",e.d||""),n&&r&&r.remainder===""?(A.concatArray(c,A.actions["d="](e,t)),A.concatArray(c,this.output(e))):(A.concatArray(c,this.output(e)),A.concatArray(c,A.actions.bond(e,t,"-")))),c},"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:A.go(t,"o")}},comma:function(e,t){var n=t.replace(/\s*$/,""),r=n!==t;return r&&e.parenthesisLevel===0?{type_:"comma enumeration L",p1:n}:{type_:"comma enumeration M",p1:n}},output:function(e,t,n){var r;if(!e.r)r=[],!e.a&&!e.b&&!e.p&&!e.o&&!e.q&&!e.d&&!n||(e.sb&&r.push({type_:"entitySkip"}),!e.o&&!e.q&&!e.d&&!e.b&&!e.p&&n!==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"&&A.patterns.match_("d-oxidation$",e.d||"")?e.dType="oxidation":e.o&&e.dType==="kv"&&!e.q&&(e.dType=void 0),r.push({type_:"chemfive",a:A.go(e.a,"a"),b:A.go(e.b,"bd"),p:A.go(e.p,"pq"),o:A.go(e.o,"o"),q:A.go(e.q,"pq"),d:A.go(e.d,e.dType==="oxidation"?"oxidation":"bd"),dType:e.dType}));else{var s;e.rdt==="M"?s=A.go(e.rd,"tex-math"):e.rdt==="T"?s=[{type_:"text",p1:e.rd||""}]:s=A.go(e.rd);var i;e.rqt==="M"?i=A.go(e.rq,"tex-math"):e.rqt==="T"?i=[{type_:"text",p1:e.rq||""}]:i=A.go(e.rq),r={type_:"arrow",r:e.r,rd:s,rq:i}}for(var l in e)l!=="parenthesisLevel"&&l!=="beginsWithBond"&&delete e[l];return r},"oxidation-output":function(e,t){var n=["{"];return A.concatArray(n,A.go(t,"oxidation")),n.push("}"),n},"frac-output":function(e,t){return{type_:"frac-ce",p1:A.go(t[0]),p2:A.go(t[1])}},"overset-output":function(e,t){return{type_:"overset",p1:A.go(t[0]),p2:A.go(t[1])}},"underset-output":function(e,t){return{type_:"underset",p1:A.go(t[0]),p2:A.go(t[1])}},"underbrace-output":function(e,t){return{type_:"underbrace",p1:A.go(t[0]),p2:A.go(t[1])}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:A.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,n){return{type_:"operator",kind_:n||t}}}},a:{transitions:A.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:A.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:A.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 n in e)delete e[n];return t}}}},pq:{transitions:A.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:A.go(t,"o")}},"color-output":function(e,t){return{type_:"color",color1:t[0],color2:A.go(t[1],"pq")}}}},bd:{transitions:A.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:A.go(t[1],"bd")}}}},oxidation:{transitions:A.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:A.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 n in e)delete e[n];return t}}}},"tex-math tight":{transitions:A.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 n in e)delete e[n];return t}}}},"9,9":{transitions:A.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:A.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 n=[];return t[0]==="+-"||t[0]==="+/-"?n.push("\\pm "):t[0]&&n.push(t[0]),t[1]&&(A.concatArray(n,A.go(t[1],"pu-9,9")),t[2]&&(t[2].match(/[,.]/)?A.concatArray(n,A.go(t[2],"pu-9,9")):n.push(t[2])),t[3]=t[4]||t[3],t[3]&&(t[3]=t[3].trim(),t[3]==="e"||t[3].substr(0,1)==="*"?n.push({type_:"cdot"}):n.push({type_:"times"}))),t[3]&&n.push("10^{"+t[5]+"}"),n},"number^":function(e,t){var n=[];return t[0]==="+-"||t[0]==="+/-"?n.push("\\pm "):t[0]&&n.push(t[0]),A.concatArray(n,A.go(t[1],"pu-9,9")),n.push("^{"+t[2]+"}"),n},operator:function(e,t,n){return{type_:"operator",kind_:n||t}},space:function(){return{type_:"pu-space-1"}},output:function(e){var t,n=A.patterns.match_("{(...)}",e.d||"");n&&n.remainder===""&&(e.d=n.match_);var r=A.patterns.match_("{(...)}",e.q||"");if(r&&r.remainder===""&&(e.q=r.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:A.go(e.d,"pu"),q:A.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_:"/"}),A.concatArray(t,s.q))}else t=A.go(e.d,"pu-2");for(var i in e)delete e[i];return t}}},"pu-2":{transitions:A.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 n=A.patterns.match_("{(...)}",e.rm||"");n&&n.remainder===""?t=A.go(n.match_,"pu"):t={type_:"rm",p1:e.rm}}for(var r in e)delete e[r];return t}}},"pu-9,9":{transitions:A.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 n=e.text_.length%3;n===0&&(n=3);for(var r=e.text_.length-3;r>0;r-=3)t.push(e.text_.substr(r,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(0,n)),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 n=e.text_.length-3,r=0;r<n;r+=3)t.push(e.text_.substr(r,3)),t.push({type_:"1000 separator"});t.push(e.text_.substr(r))}else t.push(e.text_);for(var s in e)delete e[s];return t}}}};var V={go:function(e,t){if(!e)return"";for(var n="",r=!1,s=0;s<e.length;s++){var i=e[s];typeof i=="string"?n+=i:(n+=V._go2(i),i.type_==="1st-level escape"&&(r=!0))}return!t&&!r&&n&&(n="{"+n+"}"),n},_goInner:function(e){return e&&V.go(e,!0)},_go2:function(e){var t;switch(e.type_){case"chemfive":t="";var n={a:V._goInner(e.a),b:V._goInner(e.b),p:V._goInner(e.p),o:V._goInner(e.o),q:V._goInner(e.q),d:V._goInner(e.d)};n.a&&(n.a.match(/^[+\-]/)&&(n.a="{"+n.a+"}"),t+=n.a+"\\,"),(n.b||n.p)&&(t+="{\\vphantom{X}}",t+="^{\\hphantom{"+(n.b||"")+"}}_{\\hphantom{"+(n.p||"")+"}}",t+="{\\vphantom{X}}",t+="^{\\vphantom{2}\\mathllap{"+(n.b||"")+"}}",t+="_{\\vphantom{2}\\mathllap{"+(n.p||"")+"}}"),n.o&&(n.o.match(/^[+\-]/)&&(n.o="{"+n.o+"}"),t+=n.o),e.dType==="kv"?((n.d||n.q)&&(t+="{\\vphantom{X}}"),n.d&&(t+="^{"+n.d+"}"),n.q&&(t+="_{"+n.q+"}")):e.dType==="oxidation"?(n.d&&(t+="{\\vphantom{X}}",t+="^{"+n.d+"}"),n.q&&(t+="{{}}",t+="_{"+n.q+"}")):(n.q&&(t+="{{}}",t+="_{"+n.q+"}"),n.d&&(t+="{{}}",t+="^{"+n.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 "+V._goInner(e.p1);break;case"state of aggregation subscript":t="\\mskip1mu "+V._goInner(e.p1);break;case"bond":if(t=V._getBond(e.kind_),!t)throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+e.kind_+")"];break;case"frac":var r="\\frac{"+e.p1+"}{"+e.p2+"}";t="\\mathchoice{\\textstyle"+r+"}{"+r+"}{"+r+"}{"+r+"}";break;case"pu-frac":var s="\\frac{"+V._goInner(e.p1)+"}{"+V._goInner(e.p2)+"}";t="\\mathchoice{\\textstyle"+s+"}{"+s+"}{"+s+"}{"+s+"}";break;case"tex-math":t=e.p1+" ";break;case"frac-ce":t="\\frac{"+V._goInner(e.p1)+"}{"+V._goInner(e.p2)+"}";break;case"overset":t="\\overset{"+V._goInner(e.p1)+"}{"+V._goInner(e.p2)+"}";break;case"underset":t="\\underset{"+V._goInner(e.p1)+"}{"+V._goInner(e.p2)+"}";break;case"underbrace":t="\\underbrace{"+V._goInner(e.p1)+"}_{"+V._goInner(e.p2)+"}";break;case"color":t="{\\color{"+e.color1+"}{"+V._goInner(e.color2)+"}}";break;case"color0":t="\\color{"+e.color+"}";break;case"arrow":var i={rd:V._goInner(e.rd),rq:V._goInner(e.rq)},l=V._getArrow(e.r);i.rq&&(l+="[{\\rm "+i.rq+"}]"),i.rd?l+="{\\rm "+i.rd+"}":l+="{}",t=l;break;case"operator":t=V._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"\u2192":return"\\yields";case"\u27F6":return"\\yields";case"<-":return"\\yieldsLeft";case"<->":return"\\mesomerism";case"<-->":return"\\yieldsLeftRight";case"<=>":return"\\chemequilibrium";case"\u21CC":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."]}}};d("\\darr","\\downarrow");d("\\dArr","\\Downarrow");d("\\Darr","\\Downarrow");d("\\lang","\\langle");d("\\rang","\\rangle");d("\\uarr","\\uparrow");d("\\uArr","\\Uparrow");d("\\Uarr","\\Uparrow");d("\\N","\\mathbb{N}");d("\\R","\\mathbb{R}");d("\\Z","\\mathbb{Z}");d("\\alef","\\aleph");d("\\alefsym","\\aleph");d("\\bull","\\bullet");d("\\clubs","\\clubsuit");d("\\cnums","\\mathbb{C}");d("\\Complex","\\mathbb{C}");d("\\Dagger","\\ddagger");d("\\diamonds","\\diamondsuit");d("\\empty","\\emptyset");d("\\exist","\\exists");d("\\harr","\\leftrightarrow");d("\\hArr","\\Leftrightarrow");d("\\Harr","\\Leftrightarrow");d("\\hearts","\\heartsuit");d("\\image","\\Im");d("\\infin","\\infty");d("\\isin","\\in");d("\\larr","\\leftarrow");d("\\lArr","\\Leftarrow");d("\\Larr","\\Leftarrow");d("\\lrarr","\\leftrightarrow");d("\\lrArr","\\Leftrightarrow");d("\\Lrarr","\\Leftrightarrow");d("\\natnums","\\mathbb{N}");d("\\plusmn","\\pm");d("\\rarr","\\rightarrow");d("\\rArr","\\Rightarrow");d("\\Rarr","\\Rightarrow");d("\\real","\\Re");d("\\reals","\\mathbb{R}");d("\\Reals","\\mathbb{R}");d("\\sdot","\\cdot");d("\\sect","\\S");d("\\spades","\\spadesuit");d("\\sub","\\subset");d("\\sube","\\subseteq");d("\\supe","\\supseteq");d("\\thetasym","\\vartheta");d("\\weierp","\\wp");d("\\quantity","{\\left\\{ #1 \\right\\}}");d("\\qty","{\\left\\{ #1 \\right\\}}");d("\\pqty","{\\left( #1 \\right)}");d("\\bqty","{\\left[ #1 \\right]}");d("\\vqty","{\\left\\vert #1 \\right\\vert}");d("\\Bqty","{\\left\\{ #1 \\right\\}}");d("\\absolutevalue","{\\left\\vert #1 \\right\\vert}");d("\\abs","{\\left\\vert #1 \\right\\vert}");d("\\norm","{\\left\\Vert #1 \\right\\Vert}");d("\\evaluated","{\\left.#1 \\right\\vert}");d("\\eval","{\\left.#1 \\right\\vert}");d("\\order","{\\mathcal{O} \\left( #1 \\right)}");d("\\commutator","{\\left[ #1 , #2 \\right]}");d("\\comm","{\\left[ #1 , #2 \\right]}");d("\\anticommutator","{\\left\\{ #1 , #2 \\right\\}}");d("\\acomm","{\\left\\{ #1 , #2 \\right\\}}");d("\\poissonbracket","{\\left\\{ #1 , #2 \\right\\}}");d("\\pb","{\\left\\{ #1 , #2 \\right\\}}");d("\\vectorbold","{\\boldsymbol{ #1 }}");d("\\vb","{\\boldsymbol{ #1 }}");d("\\vectorarrow","{\\vec{\\boldsymbol{ #1 }}}");d("\\va","{\\vec{\\boldsymbol{ #1 }}}");d("\\vectorunit","{{\\boldsymbol{\\hat{ #1 }}}}");d("\\vu","{{\\boldsymbol{\\hat{ #1 }}}}");d("\\dotproduct","\\mathbin{\\boldsymbol\\cdot}");d("\\vdot","{\\boldsymbol\\cdot}");d("\\crossproduct","\\mathbin{\\boldsymbol\\times}");d("\\cross","\\mathbin{\\boldsymbol\\times}");d("\\cp","\\mathbin{\\boldsymbol\\times}");d("\\gradient","{\\boldsymbol\\nabla}");d("\\grad","{\\boldsymbol\\nabla}");d("\\divergence","{\\grad\\vdot}");d("\\curl","{\\grad\\cross}");d("\\laplacian","\\nabla^2");d("\\tr","{\\operatorname{tr}}");d("\\Tr","{\\operatorname{Tr}}");d("\\rank","{\\operatorname{rank}}");d("\\erf","{\\operatorname{erf}}");d("\\Res","{\\operatorname{Res}}");d("\\principalvalue","{\\mathcal{P}}");d("\\pv","{\\mathcal{P}}");d("\\PV","{\\operatorname{P.V.}}");d("\\qqtext","{\\quad\\text{ #1 }\\quad}");d("\\qq","{\\quad\\text{ #1 }\\quad}");d("\\qcomma","{\\text{,}\\quad}");d("\\qc","{\\text{,}\\quad}");d("\\qcc","{\\quad\\text{c.c.}\\quad}");d("\\qif","{\\quad\\text{if}\\quad}");d("\\qthen","{\\quad\\text{then}\\quad}");d("\\qelse","{\\quad\\text{else}\\quad}");d("\\qotherwise","{\\quad\\text{otherwise}\\quad}");d("\\qunless","{\\quad\\text{unless}\\quad}");d("\\qgiven","{\\quad\\text{given}\\quad}");d("\\qusing","{\\quad\\text{using}\\quad}");d("\\qassume","{\\quad\\text{assume}\\quad}");d("\\qsince","{\\quad\\text{since}\\quad}");d("\\qlet","{\\quad\\text{let}\\quad}");d("\\qfor","{\\quad\\text{for}\\quad}");d("\\qall","{\\quad\\text{all}\\quad}");d("\\qeven","{\\quad\\text{even}\\quad}");d("\\qodd","{\\quad\\text{odd}\\quad}");d("\\qinteger","{\\quad\\text{integer}\\quad}");d("\\qand","{\\quad\\text{and}\\quad}");d("\\qor","{\\quad\\text{or}\\quad}");d("\\qas","{\\quad\\text{as}\\quad}");d("\\qin","{\\quad\\text{in}\\quad}");d("\\differential","{\\text{d}}");d("\\dd","{\\text{d}}");d("\\derivative","{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}");d("\\dv","{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}");d("\\partialderivative","{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}");d("\\variation","{\\delta}");d("\\var","{\\delta}");d("\\functionalderivative","{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}");d("\\fdv","{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}");d("\\innerproduct","{\\left\\langle {#1} \\mid { #2} \\right\\rangle}");d("\\outerproduct","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}");d("\\dyad","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}");d("\\ketbra","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}");d("\\op","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}");d("\\expectationvalue","{\\left\\langle {#1 } \\right\\rangle}");d("\\expval","{\\left\\langle {#1 } \\right\\rangle}");d("\\ev","{\\left\\langle {#1 } \\right\\rangle}");d("\\matrixelement","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}");d("\\matrixel","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}");d("\\mel","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}");function fo(e){let t=[];e.consumeSpaces();let n=e.fetch().text;for(n==="\\relax"&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n==="\\hline"||n==="\\hdashline";)e.consume(),t.push(n==="\\hdashline"),e.consumeSpaces(),n=e.fetch().text;return t}var It=e=>{if(!e.parser.settings.displayMode)throw new T(`{${e.envName}} can be used only in display mode.`)},Il=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,Zo=e=>{let t=e.get("\\arraystretch");typeof t!="string"&&(t=gr(t.tokens)),t=isNaN(t)?null:Number(t);let n=e.get("\\arraycolsep");typeof n!="string"&&(n=gr(n.tokens));let r=Il.exec(n),s=r?{number:+(r[1]+r[2]),unit:r[3]}:null;return[t,s]},go=e=>{let t="";for(let n=0;n<e.length;n++)if(e[n].type==="label"){if(t)throw new T("Multiple \\labels in one row");t=e[n].string}return t};function Rr(e){if(e.indexOf("ed")===-1)return e.indexOf("*")===-1}function Be(e,{cols:t,envClasses:n,autoTag:r,singleRow:s,emptySingleRow:i,maxNumCols:l,leqno:u,arraystretch:c,arraycolsep:p},x){let g=n&&n.includes("bordermatrix")?"}":"\\end";e.gullet.beginGroup(),s||e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();let b=[],v=[b],_=[],O=[],R=[],C=r!=null?[]:void 0;function L(){r&&e.gullet.macros.set("\\@eqnsw","1",!0)}function M(){C&&(e.gullet.macros.get("\\df@tag")?(C.push(e.subparse([new qe("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):C.push(!!r&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(L(),R.push(fo(e));;){let B=e.parseExpression(!1,s?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup(),B={type:"ordgroup",mode:e.mode,body:B,semisimple:!0},b.push(B);let j=e.fetch().text;if(j==="&"){if(l&&b.length===l)if(n.includes("array")){if(e.settings.strict)throw new T("Too few columns specified in the {array} column argument.",e.nextToken)}else throw l===2?new T("The split environment accepts no more than two columns",e.nextToken):new T("The equation environment accepts only one column",e.nextToken);e.consume()}else if(j===g){M(),b.length===1&&B.body.length===0&&(v.length>1||!i)&&v.pop(),O.push(go(B.body)),R.length<v.length+1&&R.push([]);break}else if(j==="\\\\"){e.consume();let W;e.gullet.future().text!==" "&&(W=e.parseSizeGroup(!0)),_.push(W?W.value:null),M(),O.push(go(B.body)),R.push(fo(e)),b=[],v.push(b),L()}else throw new T("Expected & or \\\\ or \\cr or "+g,e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,body:v,cols:t,rowGaps:_,hLinesBeforeRow:R,envClasses:n,autoTag:r,scriptLevel:x,tags:C,labels:O,leqno:u,arraystretch:c,arraycolsep:p}}function Xo(e){return e.slice(0,1)==="d"?"display":"text"}var Bl={c:"center ",l:"left ",r:"right "},bo=e=>{let t=new y("mtd",[]);return t.style={padding:"0",width:"50%"},e.envClasses.includes("multline")&&(t.style.width="7.5%"),t},_e=function(e,t){let n=[],r=e.body.length,s=e.hLinesBeforeRow,i=e.tags&&e.tags.some(p=>p);for(let p=0;p<r;p++){let x=e.body[p],g=[],b=e.scriptLevel==="text"?X.TEXT:e.scriptLevel==="script"?X.SCRIPT:X.DISPLAY;for(let C=0;C<x.length;C++){let L=new y("mtd",[U(x[C],t.withLevel(b))]);if(e.envClasses.includes("multline")){let M=p===0?"left":p===r-1?"right":"center";M!=="center"&&L.classes.push("tml-"+M)}g.push(L)}let v=e.body[0].length;for(let C=0;C<v-x.length;C++)g.push(new y("mtd",[],[],t));if(i){let C=e.tags[p],L;C===!0?L=new y("mtext",[new hn(["tml-eqn"])]):C===!1?L=new y("mtext",[],[]):(L=je(C[0].body,t.withLevel(b),!0),L=wn(L),L.classes=["tml-tag"]),L&&(g.unshift(bo(e)),g.push(bo(e)),e.leqno?g[0].children.push(L):g[g.length-1].children.push(L))}let _=new y("mtr",g,[]),O=e.labels.shift();O&&e.tags&&e.tags[p]&&(_.setAttribute("id",O),Array.isArray(e.tags[p])&&_.classes.push("tml-tageqn")),p===0&&s[0].length>0&&(s[0].length===2?_.children.forEach(C=>{C.style.borderTop="0.15em double"}):_.children.forEach(C=>{C.style.borderTop=s[0][0]?"0.06em dashed":"0.06em solid"})),s[p+1].length>0&&(s[p+1].length===2?_.children.forEach(C=>{C.style.borderBottom="0.15em double"}):_.children.forEach(C=>{C.style.borderBottom=s[p+1][0]?"0.06em dashed":"0.06em solid"}));let R=!0;for(let C=0;C<_.children.length;C++){let L=_.children[C].children[0];if(!(L&&L.type==="mpadded"&&L.attributes.height==="0px")){R=!1;break}}if(R)for(let C=0;C<_.children.length;C++)_.children[C].style.display="block",_.children[C].style.height="0",_.children[C].style.paddingTop="0",_.children[C].style.paddingBottom="0";n.push(_)}if(e.arraystretch&&e.arraystretch!==1){let p=String(1.4*e.arraystretch-.8)+"ex";for(let x=0;x<n.length;x++)for(let g=0;g<n[x].children.length;g++)n[x].children[g].style.paddingTop=p,n[x].children[g].style.paddingBottom=p}let l,u;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",u="em"),e.arraycolsep){let p=Ie(e.arraycolsep,t);l=p.number.toFixed(4),u=p.unit}if(l){let p=n.length===0?0:n[0].children.length,x=(g,b)=>g===0&&b===0||g===p-1&&b===1?"0":e.envClasses[0]!=="align"?l:b===1?"0":i?g%2?"1":"0":g%2?"0":"1";for(let g=0;g<n.length;g++)for(let b=0;b<n[g].children.length;b++)n[g].children[b].style.paddingLeft=`${x(b,0)}${u}`,n[g].children[b].style.paddingRight=`${x(b,1)}${u}`}if(e.envClasses.length===0)for(let p=0;p<n.length;p++)n[p].children[0].style.paddingLeft="0em",n[p].children.length===n[0].children.length&&(n[p].children[n[p].children.length-1].style.paddingRight="0em");if(e.envClasses.length>0){let p=e.envClasses.includes("align")||e.envClasses.includes("alignat");for(let x=0;x<n.length;x++){let g=n[x];if(p){for(let b=0;b<g.children.length;b++)g.children[b].classes=["tml-"+(b%2?"left":"right")];if(i){let b=e.leqno?0:g.children.length-1;g.children[b].classes=[]}}if(g.children.length>1&&e.envClasses.includes("cases")&&(g.children[1].style.paddingLeft="1em"),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(let b of g.children)b.classes.push("tml-left")}}let c=new y("mtable",n);if(e.envClasses.length>0&&(e.envClasses.includes("jot")?c.classes.push("tml-jot"):e.envClasses.includes("small")&&c.classes.push("tml-small")),e.scriptLevel==="display"&&c.setAttribute("displaystyle","true"),(e.autoTag||e.envClasses.includes("multline"))&&(c.style.width="100%"),e.cols&&e.cols.length>0){let p=e.cols,x=!1,g=0,b=p.length;for(;p[g].type==="separator";)g+=1;for(;p[b-1].type==="separator";)b-=1;if(p[0].type==="separator"){let _=p[1].type==="separator"?"0.15em double":p[0].separator==="|"?"0.06em solid ":"0.06em dashed ";for(let O of c.children)O.children[0].style.borderLeft=_}let v=i?0:-1;for(let _=g;_<b;_++)if(p[_].type==="align"){let O=Bl[p[_].align];v+=1;for(let R of c.children)O.trim()!=="center"&&v<R.children.length&&(R.children[v].classes=["tml-"+O.trim()]);x=!0}else if(p[_].type==="separator"){if(x){let O=p[_+1].type==="separator"?"0.15em double":p[_].separator==="|"?"0.06em solid":"0.06em dashed";for(let R of c.children)v<R.children.length&&(R.children[v].style.borderRight=O)}x=!1}if(p[p.length-1].type==="separator"){let _=p[p.length-2].type==="separator"?"0.15em double":p[p.length-1].separator==="|"?"0.06em solid":"0.06em dashed";for(let O of c.children)O.children[O.children.length-1].style.borderRight=_,O.children[O.children.length-1].style.paddingRight="0.4em"}}return e.envClasses.includes("small")&&(c=new y("mstyle",[c]),c.setAttribute("scriptlevel","1")),c},Yo=function(e,t){e.envName.indexOf("ed")===-1&&It(e);let n=e.envName==="split",r=[],s=Be(e.parser,{cols:r,emptySingleRow:!0,autoTag:n?void 0:Rr(e.envName),envClasses:["abut","jot"],maxNumCols:e.envName==="split"?2:void 0,leqno:e.parser.settings.leqno},"display"),i,l=0,u=e.envName.indexOf("at")>-1;if(t[0]&&u){let c="";for(let p=0;p<t[0].body.length;p++){let x=P(t[0].body[p],"textord");c+=x.text}if(isNaN(c))throw new T("The alignat enviroment requires a numeric first argument.");i=Number(c),l=i*2}s.body.forEach(function(c){if(u){let p=c.length/2;if(i<p)throw new T(`Too many math in a row: expected ${i}, but got ${p}`,c[0])}else l<c.length&&(l=c.length)});for(let c=0;c<l;++c){let p="r";c%2===1&&(p="l"),r[c]={type:"align",align:p}}return e.envName==="split"||(u?s.envClasses.push("alignat"):s.envClasses[0]="align"),s};Se({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){let s=(kn(t[0])?[t[0]]:P(t[0],"ordgroup").body).map(function(c){let x=Er(c).text;if("lcr".indexOf(x)!==-1)return{type:"align",align:x};if(x==="|")return{type:"separator",separator:"|"};if(x===":")return{type:"separator",separator:":"};throw new T("Unknown column alignment: "+x,c)}),[i,l]=Zo(e.parser.gullet.macros),u={cols:s,envClasses:["array"],maxNumCols:s.length,arraystretch:i,arraycolsep:l};return Be(e.parser,u,Xo(e.envName))},mathmlBuilder:_e});Se({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){let t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",r={envClasses:[],cols:[]};if(e.envName.charAt(e.envName.length-1)==="*"){let u=e.parser;if(u.consumeSpaces(),u.fetch().text==="["){if(u.consume(),u.consumeSpaces(),n=u.fetch().text,"lcr".indexOf(n)===-1)throw new T("Expected l or c or r",u.nextToken);u.consume(),u.consumeSpaces(),u.expect("]"),u.consume(),r.cols=[]}}let s=Be(e.parser,r,"text");s.cols=s.body.length>0?new Array(s.body[0].length).fill({type:"align",align:n}):[];let[i,l]=Zo(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:_e});Se({type:"array",names:["bordermatrix"],props:{numArgs:0},handler(e){let t={cols:[],envClasses:["bordermatrix"]},n=Be(e.parser,t,"text");return n.cols=n.body.length>0?new Array(n.body[0].length).fill({type:"align",align:"c"}):[],n.envClasses=[],n.arraystretch=1,e.envName==="matrix"?n:$l(n,e.delimiters)},mathmlBuilder:_e});Se({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){let t={envClasses:["small"]};return Be(e.parser,t,"script")},mathmlBuilder:_e});Se({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){let s=(kn(t[0])?[t[0]]:P(t[0],"ordgroup").body).map(function(l){let c=Er(l).text;if("lc".indexOf(c)!==-1)return{type:"align",align:c};throw new T("Unknown column alignment: "+c,l)});if(s.length>1)throw new T("{subarray} can contain only one column");let i={cols:s,envClasses:["small"]};if(i=Be(e.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new T("{subarray} can contain only one column");return i},mathmlBuilder:_e});Se({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){let t={cols:[],envClasses:["cases"]},n=Be(e.parser,t,Xo(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},mathmlBuilder:_e});Se({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Yo,mathmlBuilder:_e});Se({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Yo,mathmlBuilder:_e});Se({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){e.envName!=="gathered"&&It(e);let t={cols:[],envClasses:["abut","jot"],autoTag:Rr(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Be(e.parser,t,"display")},mathmlBuilder:_e});Se({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){It(e);let t={autoTag:Rr(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:["align"],leqno:e.parser.settings.leqno};return Be(e.parser,t,"display")},mathmlBuilder:_e});Se({type:"array",names:["multline","multline*"],props:{numArgs:0},handler(e){It(e);let t={autoTag:e.envName==="multline",maxNumCols:1,envClasses:["jot","multline"],leqno:e.parser.settings.leqno};return Be(e.parser,t,"display")},mathmlBuilder:_e});Se({type:"array",names:["CD"],props:{numArgs:0},handler(e){return It(e),Ol(e.parser)},mathmlBuilder:_e});D({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new T(`${e.funcName} valid only within array environment`)}});var br=Go;D({type:"bordermatrix",names:["\\bordermatrix","\\matrix"],props:{numArgs:0,numOptionalArgs:1},handler:({parser:e,funcName:t},n,r)=>{let s=["(",")"];if(t==="\\bordermatrix"&&r[0]&&r[0].body){let c=r[0].body;c.length===2&&c[0].type==="atom"&&c[1].type==="atom"&&c[0].family==="open"&&c[1].family==="close"&&(s=[c[0].text,c[1].text])}e.consumeSpaces(),e.consume();let i=br.bordermatrix,l={mode:e.mode,envName:t.slice(1),delimiters:s,parser:e},u=i.handler(l);return e.expect("}",!0),u}});D({type:"cancelto",names:["\\cancelto"],props:{numArgs:2},handler({parser:e},t){let n=t[0],r=t[1];return{type:"cancelto",mode:e.mode,body:r,to:n,isCharacterBox:yn(r)}},mathmlBuilder(e,t){let n=new y("mrow",[U(e.body,t)],["ff-narrow"]),r=new y("mphantom",[U(e.body,t)]),s=new y("mrow",[r],["tml-cancelto"]);s.style.color=t.color,e.isCharacterBox&&Io.indexOf(e.body.body[0].text)>-1&&(s.style.left="0.1em",s.style.width="90%");let i=new y("mrow",[n,s],["menclose"]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text))r.style.paddingRight="0.2em";else{r.style.padding="0.5ex 0.1em 0 0";let g=new y("mspace",[]);g.setAttribute("height","0.85em"),n.children.push(g)}let l;if(e.isCharacterBox)l=new y("mspace",[]),l.setAttribute("height","1em");else{let g=U(e.body,t),b=new y("mpadded",[g]);b.setAttribute("width","0.1px"),l=new y("mphantom",[b])}let u=U(e.to,t);u.style.color=t.color;let c=new y("mpadded",[u]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text)){let g=new y("mspace",[]);g.setAttribute("width","0.2em"),c.children.unshift(g)}c.setAttribute("width","0.1px");let p=new y("mover",[l,c]),x=new y("mrow",[],["ff-nudge-left"]);return et([Mt([i,p]),x])}});D({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler({parser:e,token:t},n){let s=P(n[0],"ordgroup").body,i="";for(let u=0;u<s.length;u++){let c=P(s[u],"textord");i+=c.text}let l=parseInt(i);if(isNaN(l))throw new T(`\\@char has non-numeric argument ${i}`,t);return{type:"textord",mode:e.mode,text:String.fromCodePoint(l)}}});var Nl=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,Pl=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,zl=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,Fl=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,Gl=/^[a-f0-9]{6}$/i,xo=e=>{let t=e.toString(16);return t.length===1&&(t="0"+t),t},yo=JSON.parse(`{
74
- "Apricot": "#ffb484",
75
- "Aquamarine": "#08b4bc",
76
- "Bittersweet": "#c84c14",
77
- "blue": "#0000FF",
78
- "Blue": "#303494",
79
- "BlueGreen": "#08b4bc",
80
- "BlueViolet": "#503c94",
81
- "BrickRed": "#b8341c",
82
- "brown": "#BF8040",
83
- "Brown": "#802404",
84
- "BurntOrange": "#f8941c",
85
- "CadetBlue": "#78749c",
86
- "CarnationPink": "#f884b4",
87
- "Cerulean": "#08a4e4",
88
- "CornflowerBlue": "#40ace4",
89
- "cyan": "#00FFFF",
90
- "Cyan": "#08acec",
91
- "Dandelion": "#ffbc44",
92
- "darkgray": "#404040",
93
- "DarkOrchid": "#a8548c",
94
- "Emerald": "#08ac9c",
95
- "ForestGreen": "#089c54",
96
- "Fuchsia": "#90348c",
97
- "Goldenrod": "#ffdc44",
98
- "gray": "#808080",
99
- "Gray": "#98949c",
100
- "green": "#00FF00",
101
- "Green": "#08a44c",
102
- "GreenYellow": "#e0e474",
103
- "JungleGreen": "#08ac9c",
104
- "Lavender": "#f89cc4",
105
- "lightgray": "#c0c0c0",
106
- "lime": "#BFFF00",
107
- "LimeGreen": "#90c43c",
108
- "magenta": "#FF00FF",
109
- "Magenta": "#f0048c",
110
- "Mahogany": "#b0341c",
111
- "Maroon": "#b03434",
112
- "Melon": "#f89c7c",
113
- "MidnightBlue": "#086494",
114
- "Mulberry": "#b03c94",
115
- "NavyBlue": "#086cbc",
116
- "olive": "#7F7F00",
117
- "OliveGreen": "#407c34",
118
- "orange": "#FF8000",
119
- "Orange": "#f8843c",
120
- "OrangeRed": "#f0145c",
121
- "Orchid": "#b074ac",
122
- "Peach": "#f8945c",
123
- "Periwinkle": "#8074bc",
124
- "PineGreen": "#088c74",
125
- "pink": "#ff7f7f",
126
- "Plum": "#98248c",
127
- "ProcessBlue": "#08b4ec",
128
- "purple": "#BF0040",
129
- "Purple": "#a0449c",
130
- "RawSienna": "#983c04",
131
- "red": "#ff0000",
132
- "Red": "#f01c24",
133
- "RedOrange": "#f86434",
134
- "RedViolet": "#a0246c",
135
- "Rhodamine": "#f0549c",
136
- "Royallue": "#0874bc",
137
- "RoyalPurple": "#683c9c",
138
- "RubineRed": "#f0047c",
139
- "Salmon": "#f8948c",
140
- "SeaGreen": "#30bc9c",
141
- "Sepia": "#701404",
142
- "SkyBlue": "#48c4dc",
143
- "SpringGreen": "#c8dc64",
144
- "Tan": "#e09c74",
145
- "teal": "#007F7F",
146
- "TealBlue": "#08acb4",
147
- "Thistle": "#d884b4",
148
- "Turquoise": "#08b4cc",
149
- "violet": "#800080",
150
- "Violet": "#60449c",
151
- "VioletRed": "#f054a4",
152
- "WildStrawberry": "#f0246c",
153
- "yellow": "#FFFF00",
154
- "Yellow": "#fff404",
155
- "YellowGreen": "#98cc6c",
156
- "YellowOrange": "#ffa41c"
157
- }`),ht=(e,t)=>{let n="";if(e==="HTML"){if(!Nl.test(t))throw new T("Invalid HTML input.");n=t}else if(e==="RGB"){if(!zl.test(t))throw new T("Invalid RGB input.");t.split(",").map(r=>{n+=xo(Number(r.trim()))})}else{if(!Fl.test(t))throw new T("Invalid rbg input.");t.split(",").map(r=>{let s=Number(r.trim());if(s>1)throw new T("Color rgb input must be < 1.");n+=xo(Number((s*255).toFixed(0)))})}return n.charAt(0)!=="#"&&(n="#"+n),n},Rt=(e,t,n)=>{let r=`\\\\color@${e}`;if(!Pl.exec(e))throw new T("Invalid color: '"+e+"'",n);return Gl.test(e)?"#"+e:(e.charAt(0)==="#"||(t.has(r)?e=t.get(r).tokens[0].text:yo[e]&&(e=yo[e])),e)},Ko=(e,t)=>{let n=he(e.body,t.withColor(e.color));return n.length===0&&n.push(new y("mrow")),n=n.map(r=>(r.style.color=e.color,r)),et(n)};D({type:"color",names:["\\textcolor"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","original"]},handler({parser:e,token:t},n,r){let s=r[0]&&P(r[0],"raw").string,i="";if(s){let u=P(n[0],"raw").string;i=ht(s,u)}else i=Rt(P(n[0],"raw").string,e.gullet.macros,t);let l=n[1];return{type:"color",mode:e.mode,color:i,isTextColor:!0,body:ie(l)}},mathmlBuilder:Ko});D({type:"color",names:["\\color"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw"]},handler({parser:e,breakOnTokenText:t,token:n},r,s){let i=s[0]&&P(s[0],"raw").string,l="";if(i){let c=P(r[0],"raw").string;l=ht(i,c)}else l=Rt(P(r[0],"raw").string,e.gullet.macros,n);let u=e.parseExpression(!0,t,!0);return{type:"color",mode:e.mode,color:l,isTextColor:!1,body:u}},mathmlBuilder:Ko});D({type:"color",names:["\\definecolor"],props:{numArgs:3,allowedInText:!0,argTypes:["raw","raw","raw"]},handler({parser:e,funcName:t,token:n},r){let s=P(r[0],"raw").string;if(!/^[A-Za-z]+$/.test(s))throw new T("Color name must be latin letters.",n);let i=P(r[1],"raw").string;if(!["HTML","RGB","rgb"].includes(i))throw new T("Color model must be HTML, RGB, or rgb.",n);let l=P(r[2],"raw").string,u=ht(i,l);return e.gullet.macros.set(`\\\\color@${s}`,{tokens:[{text:u}],numArgs:0}),{type:"internal",mode:e.mode}}});D({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},t,n){let r=e.gullet.future().text==="["?e.parseSizeGroup(!0):null,s=!e.settings.displayMode;return{type:"cr",mode:e.mode,newLine:s,size:r&&P(r,"size").value}},mathmlBuilder(e,t){let n=new y("mo");if(e.newLine&&(n.setAttribute("linebreak","newline"),e.size)){let r=Ie(e.size,t);n.setAttribute("height",r.number+r.unit)}return n}});var xr={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},gn=e=>{let t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new T("Expected a control sequence",e);return t},Hl=e=>{let t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},Qo=(e,t,n,r)=>{let s=e.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,s,r)};D({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler({parser:e,funcName:t}){e.consumeSpaces();let n=e.fetch();if(xr[n.text])return(t==="\\global"||t==="\\\\globallong")&&(n.text=xr[n.text]),P(e.parseFunction(),"internal");throw new T("Invalid token after macro prefix",n)}});D({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=e.gullet.popToken(),r=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(r))throw new T("Expected a control sequence",n);let s=0,i,l=[[]];for(;e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){i=e.gullet.future(),l[s].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new T(`Invalid argument number "${n.text}"`);if(parseInt(n.text)!==s+1)throw new T(`Argument number "${n.text}" out of order`);s++,l.push([])}else{if(n.text==="EOF")throw new T("Expected a macro definition");l[s].push(n.text)}let{tokens:u}=e.gullet.consumeArg();if(i&&u.unshift(i),t==="\\edef"||t==="\\xdef"){if(u=e.gullet.expandTokens(u),u.length>e.gullet.settings.maxExpand)throw new T("Too many expansions in an "+t);u.reverse()}return e.gullet.macros.set(r,{tokens:u,numArgs:s,delimiters:l},t===xr[t]),{type:"internal",mode:e.mode}}});D({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=gn(e.gullet.popToken());e.gullet.consumeSpaces();let r=Hl(e);return Qo(e,n,r,t==="\\\\globallet"),{type:"internal",mode:e.mode}}});D({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=gn(e.gullet.popToken()),r=e.gullet.popToken(),s=e.gullet.popToken();return Qo(e,n,s,t==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(r),{type:"internal",mode:e.mode}}});D({type:"internal",names:["\\newcommand","\\renewcommand","\\providecommand"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n="",r=e.gullet.popToken();r.text==="{"?(n=gn(e.gullet.popToken()),e.gullet.popToken()):n=gn(r);let s=e.gullet.isDefined(n);if(s&&t==="\\newcommand")throw new T(`\\newcommand{${n}} attempting to redefine ${n}; use \\renewcommand`);if(!s&&t==="\\renewcommand")throw new T(`\\renewcommand{${n}} when command ${n} does not yet exist; use \\newcommand`);let i=0;if(e.gullet.future().text==="["){let u=e.gullet.popToken();if(u=e.gullet.popToken(),!/^[0-9]$/.test(u.text))throw new T(`Invalid number of arguments: "${u.text}"`);if(i=parseInt(u.text),u=e.gullet.popToken(),u.text!=="]")throw new T(`Invalid argument "${u.text}"`)}let{tokens:l}=e.gullet.consumeArg();return t==="\\providecommand"&&e.gullet.macros.has(n)||e.gullet.macros.set(n,{tokens:l,numArgs:i}),{type:"internal",mode:e.mode}}});var yr={"\\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}},qr={"(":")","\\lparen":"\\rparen","[":"]","\\lbrack":"\\rbrack","\\{":"\\}","\\lbrace":"\\rbrace","\u2987":"\u2988","\\llparenthesis":"\\rrparenthesis","\\lfloor":"\\rfloor","\u230A":"\u230B","\\lceil":"\\rceil","\u2308":"\u2309","\\langle":"\\rangle","\u27E8":"\u27E9","\\lAngle":"\\rAngle","\u27EA":"\u27EB","\\llangle":"\\rrangle","\u2989":"\u298A","\\lvert":"\\rvert","\\lVert":"\\rVert","\\lgroup":"\\rgroup","\u27EE":"\u27EF","\\lmoustache":"\\rmoustache","\u23B0":"\u23B1","\\llbracket":"\\rrbracket","\u27E6":"\u27E7","\\lBrace":"\\rBrace","\u2983":"\u2984"},Ul=new Set(Object.keys(qr));new Set(Object.values(qr));var Jo=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\u2987","\\llparenthesis","\u2988","\\rrparenthesis","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lAngle","\u27EA","\\rAngle","\u27EB","\\llangle","\u2989","\\rrangle","\u298A","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","\\llbracket","\\rrbracket","\u27E6","\u27E7","\\lBrace","\\rBrace","\u2983","\u2984","/","\\backslash","|","\\vert","\\|","\\Vert","\u2016","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]),jl=new Set(["}","\\left","\\middle","\\right"]),An=e=>e.length>0&&(Jo.has(e)||yr[e]||jl.has(e)),wo=[0,1.2,1.8,2.4,3];function qt(e,t){e.type==="ordgroup"&&e.body.length===1&&(e=e.body[0]);let n=kn(e);if(n&&Jo.has(n.text))return(n.text==="<"||n.text==="\\lt")&&(n.text="\u27E8"),(n.text===">"||n.text==="\\gt")&&(n.text="\u27E9"),n;throw n?new T(`Invalid delimiter '${n.text}' after '${t.funcName}'`,e):new T(`Invalid delimiter type '${e.type}'`,e)}var Wl=new Set(["/","\\","\\backslash","\u2216","\\vert","|"]),bn=(e,t,n,r)=>{let s=e==="."?"":e,i=new y("mo",[ve(s,t)]);return i.setAttribute("fence","true"),i.setAttribute("form",n),i.setAttribute("stretchy",r?"true":"false"),i};D({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)=>{let n=qt(t[0],e),r={type:"delimsizing",mode:e.parser.mode,size:yr[e.funcName].size,mclass:yr[e.funcName].mclass,delim:n.text},s=e.parser.fetch().text;return s!=="^"&&s!=="_"?r:{type:"ordgroup",mode:"math",body:[r,{type:"ordgroup",mode:"math",body:[]}]}},mathmlBuilder:e=>{let t=[],n=e.delim==="."?"":e.delim;t.push(ve(n,e.mode));let r=new y("mo",t);return e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),(Wl.has(n)||n.indexOf("arrow")>-1)&&r.setAttribute("stretchy","true"),r.setAttribute("symmetric","true"),r.setAttribute("minsize",wo[e.size]+"em"),r.setAttribute("maxsize",wo[e.size]+"em"),r}});function ei(e){if(!e.body)throw new Error("Bug: The delim ParseNode wasn't fully parsed.")}D({type:"leftright-right",names:["\\right"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>({type:"leftright-right",mode:e.parser.mode,delim:qt(t[0],e).text})});D({type:"leftright",names:["\\left"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=qt(t[0],e),r=e.parser;++r.leftrightDepth;let s=r.parseExpression(!1,"\\right",!0),i=r.fetch();for(;i.text==="\\middle";){r.consume();let u=r.fetch().text;if(!K.math[u])throw new T(`Invalid delimiter '${u}' after '\\middle'`);qt({type:"atom",mode:"math",text:u},{funcName:"\\middle"}),s.push({type:"middle",mode:"math",delim:u}),r.consume(),s=s.concat(r.parseExpression(!1,"\\right",!0)),i=r.fetch()}--r.leftrightDepth,r.expect("\\right",!1);let l=P(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:l.delim,isStretchy:!0}},mathmlBuilder:(e,t)=>{ei(e);let n=he(e.body,t),r=bn(e.left,e.mode,"prefix",!0);n.unshift(r);let s=bn(e.right,e.mode,"postfix",!0);if(e.body.length>0){let i=e.body[e.body.length-1];i.type==="color"&&!i.isTextColor&&s.setAttribute("mathcolor",i.color)}return n.push(s),Mt(n)}});D({type:"delimiter",names:Array.from(Ul),props:{numArgs:0,allowedInText:!0,allowedInMath:!0,allowedInArgument:!0},handler:({parser:e,funcName:t,token:n})=>{if(e.mode==="text")return{type:"textord",mode:"text",text:t,loc:n.loc};if(!e.settings.wrapDelimiterPairs)return{type:"atom",mode:"math",family:"open",loc:n.loc,text:t};let r=qr[t],s=e.parseExpression(!1,r,!1);if(e.fetch().text!==r)throw new T("Unmatched delimiter");return e.consume(),{type:"delimiter",mode:e.mode,body:s,left:t,right:r}},mathmlBuilder:(e,t)=>{ei(e);let n=he(e.body,t),r=bn(e.left,e.mode,"prefix",!1);n.unshift(r);let s=bn(e.right,e.mode,"postfix",!1);if(e.body.length>0){let i=e.body[e.body.length-1];i.type==="color"&&!i.isTextColor&&s.setAttribute("mathcolor",i.color)}return n.push(s),Mt(n)}});D({type:"middle",names:["\\middle"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{let n=qt(t[0],e);if(!e.parser.leftrightDepth)throw new T("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},mathmlBuilder:e=>{let t=ve(e.delim,e.mode),n=new y("mo",[t]);return n.setAttribute("fence","true"),e.delim.indexOf("arrow")>-1&&n.setAttribute("stretchy","true"),n.setAttribute("form","prefix"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});var Vl=["\\boxed","\\fcolorbox","\\colorbox"],Bt=(e,t)=>{let n=Vl.includes(e.label)?"mrow":"menclose",r=new y(n,[U(e.body,t)]);switch(e.label){case"\\overline":r.setAttribute("notation","top"),r.classes.push("tml-overline");break;case"\\underline":r.setAttribute("notation","bottom"),r.classes.push("tml-underline");break;case"\\cancel":r.setAttribute("notation","updiagonalstrike"),r.children.push(new y("mrow",[],["tml-cancel","upstrike"]));break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike"),r.children.push(new y("mrow",[],["tml-cancel","downstrike"]));break;case"\\sout":r.setAttribute("notation","horizontalstrike"),r.children.push(new y("mrow",[],["tml-cancel","sout"]));break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike"),r.children.push(new y("mrow",[],["tml-cancel","tml-xcancel"]));break;case"\\longdiv":r.setAttribute("notation","longdiv"),r.classes.push("longdiv-top"),r.children.push(new y("mrow",[],["longdiv-arc"]));break;case"\\phase":r.setAttribute("notation","phasorangle"),r.classes.push("phasor-bottom"),r.children.push(new y("mrow",[],["phasor-angle"]));break;case"\\textcircled":r.setAttribute("notation","circle"),r.classes.push("circle-pad"),r.children.push(new y("mrow",[],["textcircle"]));break;case"\\angl":r.setAttribute("notation","actuarial"),r.classes.push("actuarial");break;case"\\boxed":r.style.padding="3pt",r.style.border="1px solid",r.setAttribute("scriptlevel","0"),r.setAttribute("displaystyle","true");break;case"\\fbox":r.setAttribute("notation","box"),r.classes.push("tml-fbox");break;case"\\fcolorbox":case"\\colorbox":{r.style.padding="0.3em",e.label==="\\fcolorbox"&&(r.style.border="0.0667em solid "+String(e.borderColor));break}}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};D({type:"enclose",names:["\\colorbox"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","text"]},handler({parser:e,funcName:t},n,r){let s=r[0]&&P(r[0],"raw").string,i="";if(s){let u=P(n[0],"raw").string;i=ht(s,u)}else i=Rt(P(n[0],"raw").string,e.gullet.macros);let l=n[1];return{type:"enclose",mode:e.mode,label:t,backgroundColor:i,body:l}},mathmlBuilder:Bt});D({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","raw","text"]},handler({parser:e,funcName:t},n,r){let s=r[0]&&P(r[0],"raw").string,i="",l;if(s){let c=P(n[0],"raw").string,p=P(n[0],"raw").string;i=ht(s,c),l=ht(s,p)}else i=Rt(P(n[0],"raw").string,e.gullet.macros),l=Rt(P(n[1],"raw").string,e.gullet.macros);let u=n[2];return{type:"enclose",mode:e.mode,label:t,backgroundColor:l,borderColor:i,body:u}},mathmlBuilder:Bt});D({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]}}});D({type:"enclose",names:["\\angl","\\cancel","\\bcancel","\\xcancel","\\sout","\\overline","\\boxed","\\longdiv","\\phase"],props:{numArgs:1},handler({parser:e,funcName:t},n){let r=n[0];return{type:"enclose",mode:e.mode,label:t,body:r}},mathmlBuilder:Bt});D({type:"enclose",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let r=n[0];return{type:"enclose",mode:e.mode,label:t,body:r}},mathmlBuilder:Bt});D({type:"enclose",names:["\\textcircled"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let r=n[0];return{type:"enclose",mode:e.mode,label:t,body:r}},mathmlBuilder:Bt});D({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler({parser:e,funcName:t},n){let r=n[0];if(r.type!=="ordgroup")throw new T("Invalid environment name",r);let s="";for(let i=0;i<r.body.length;++i)s+=P(r.body[i],"textord").text;if(t==="\\begin"){if(!Object.prototype.hasOwnProperty.call(br,s))throw new T("No such environment: "+s,r);let i=br[s],{args:l,optArgs:u}=e.parseArguments("\\begin{"+s+"}",i),c={mode:e.mode,envName:s,parser:e},p=i.handler(c,l,u);e.expect("\\end",!1);let x=e.nextToken,g=P(e.parseFunction(),"environment");if(g.name!==s)throw new T(`Mismatch: \\begin{${s}} matched by \\end{${g.name}}`,x);return p}return{type:"environment",mode:e.mode,name:s,nameGroup:r}}});D({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 y("mrow")}});D({type:"noTag",names:["\\env@notag"],props:{numArgs:0},handler({parser:e}){return{type:"noTag",mode:e.mode}},mathmlBuilder(e,t){return new y("mrow")}});var Zl=(e,t)=>{if(t!=="mathrm"||e.body.type!=="ordgroup"||e.body.body.length===1||e.body.body[0].type!=="mathord")return!1;for(let n=1;n<e.body.body.length;n++){let r=e.body.body[n].type;if(!(r==="mathord"||r==="textord"&&!isNaN(e.body.body[n].text)))return!1}return!0},ti=(e,t)=>{let n=e.font,r=t.withFont(n),s=U(e.body,r);if(s.children.length===0)return s;if(n==="boldsymbol"&&["mo","mpadded","mrow"].includes(s.type))return s.style.fontWeight="bold",s;if(Zl(e,n)){let u=s.children[0].children[0].children?s.children[0].children[0]:s.children[0];delete u.attributes.mathvariant;for(let p=1;p<s.children.length;p++)u.children[0].text+=s.children[p].children[0].children?s.children[p].children[0].children[0].text:s.children[p].children[0].text;let c=new y("mpadded",[u]);return c.setAttribute("lspace","0"),c}let i=s.children[0].type==="mo";for(let u=1;u<s.children.length;u++)s.children[u].type==="mo"&&n==="boldsymbol"&&(s.children[u].style.fontWeight="bold"),s.children[u].type!=="mi"&&(i=!1),(s.children[u].attributes&&s.children[u].attributes.mathvariant||"")!=="normal"&&(i=!1);if(!i)return s;let l=s.children[0];for(let u=1;u<s.children.length;u++)l.children.push(s.children[u].children[0]);if(l.attributes.mathvariant&&l.attributes.mathvariant==="normal"){let u=new y("mtext",new se("\u200B"));return new y("mrow",[u,l])}return l},ko={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};D({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},n)=>{let r=Dt(n[0]),s=t;return s in ko&&(s=ko[s]),{type:"font",mode:e.mode,font:s.slice(1),body:r}},mathmlBuilder:ti});D({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:t,breakOnTokenText:n},r)=>{let{mode:s}=e,i=e.parseExpression(!0,n,!0),l=`math${t.slice(1)}`;return{type:"font",mode:s,font:l,body:{type:"ordgroup",mode:e.mode,body:i}}},mathmlBuilder:ti});var Ao=["display","text","script","scriptscript"],Xl={auto:-1,display:0,text:0,script:1,scriptscript:2},Yl=(e,t)=>{let n=t;if(e==="display"){let r=n.level>=X.SCRIPT?X.TEXT:X.DISPLAY;n=n.withLevel(r)}else e==="text"&&n.level===X.DISPLAY?n=n.withLevel(X.TEXT):e==="auto"?n=n.incrementLevel():e==="script"?n=n.withLevel(X.SCRIPT):e==="scriptscript"&&(n=n.withLevel(X.SCRIPTSCRIPT));return n},Or=(e,t)=>{t=Yl(e.scriptLevel,t);let n=U(e.numer,t),r=U(e.denom,t);t.level===3&&(n.style.mathDepth="2",n.setAttribute("scriptlevel","2"),r.style.mathDepth="2",r.setAttribute("scriptlevel","2"));let s=new y("mfrac",[n,r]);if(!e.hasBarLine)s.setAttribute("linethickness","0px");else if(e.barSize){let i=Ie(e.barSize,t);s.setAttribute("linethickness",i.number+i.unit)}if(e.leftDelim!=null||e.rightDelim!=null){let i=[];if(e.leftDelim!=null){let l=new y("mo",[new se(e.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),i.push(l)}if(i.push(s),e.rightDelim!=null){let l=new y("mo",[new se(e.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),i.push(l)}s=Mt(i)}return e.scriptLevel!=="auto"&&(s=new y("mstyle",[s]),s.setAttribute("displaystyle",String(e.scriptLevel==="display")),s.setAttribute("scriptlevel",Xl[e.scriptLevel])),s};D({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let r=n[0],s=n[1],i=!1,l=null,u=null,c="auto";switch(t){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":i=!0;break;case"\\\\atopfrac":i=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":l="(",u=")";break;case"\\\\bracefrac":l="\\{",u="\\}";break;case"\\\\brackfrac":l="[",u="]";break;default:throw new Error("Unrecognized genfrac command")}return t==="\\cfrac"||t.startsWith("\\d")?c="display":t.startsWith("\\t")&&(c="text"),{type:"genfrac",mode:e.mode,continued:!1,numer:r,denom:s,hasBarLine:i,leftDelim:l,rightDelim:u,scriptLevel:c,barSize:null}},mathmlBuilder:Or});D({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler({parser:e,funcName:t,token:n}){let r;switch(t){case"\\over":r="\\frac";break;case"\\choose":r="\\binom";break;case"\\atop":r="\\\\atopfrac";break;case"\\brace":r="\\\\bracefrac";break;case"\\brack":r="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:r,token:n}}});var To=function(e){let t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};D({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler({parser:e},t){let n=t[4],r=t[5],s=Dt(t[0]),i=s.type==="atom"&&s.family==="open"?To(s.text):null,l=Dt(t[1]),u=l.type==="atom"&&l.family==="close"?To(l.text):null,c=P(t[2],"size"),p,x=null;c.isBlank?p=!0:(x=c.value,p=x.number>0);let g="auto",b=t[3];if(b.type==="ordgroup"){if(b.body.length>0){let v=P(b.body[0],"textord");g=Ao[Number(v.text)]}}else b=P(b,"textord"),g=Ao[Number(b.text)];return{type:"genfrac",mode:e.mode,numer:n,denom:r,continued:!1,hasBarLine:p,barSize:x,leftDelim:i,rightDelim:u,scriptLevel:g}},mathmlBuilder:Or});D({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler({parser:e,funcName:t,token:n},r){return{type:"infix",mode:e.mode,replaceWith:"\\\\abovefrac",barSize:P(r[0],"size").value,token:n}}});D({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:({parser:e,funcName:t},n)=>{let r=n[0],s=ll(P(n[1],"infix").barSize),i=n[2],l=s.number>0;return{type:"genfrac",mode:e.mode,numer:r,denom:i,continued:!1,hasBarLine:l,barSize:s,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:Or});D({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler({parser:e},t){return{type:"hbox",mode:e.mode,body:ie(t[0])}},mathmlBuilder(e,t){let n=t.withLevel(X.TEXT),r=je(e.body,n);return wn(r)}});var Kl=(e,t)=>{let n=_r(e.label);return n.style["math-depth"]=0,new y(e.isOver?"mover":"munder",[U(e.base,t),n])};D({type:"horizBracket",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler({parser:e,funcName:t},n){return{type:"horizBracket",mode:e.mode,label:t,isOver:/^\\over/.test(t),base:n[0]}},mathmlBuilder:Kl});D({type:"html",names:["\\class","\\id","\\style","\\data"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:({parser:e,funcName:t,token:n},r)=>{let s=P(r[0],"raw").string,i=r[1];if(e.settings.strict)throw new T(`Function "${t}" is disabled in strict mode`,n);let l,u={};switch(t){case"\\class":u.class=s,l={command:"\\class",class:s};break;case"\\id":u.id=s,l={command:"\\id",id:s};break;case"\\style":u.style=s,l={command:"\\style",style:s};break;case"\\data":{let c=s.split(",");for(let p=0;p<c.length;p++){let x=c[p].split("=");if(x.length!==2)throw new T("Error parsing key-value for \\data");u["data-"+x[0].trim()]=x[1].trim()}l={command:"\\data",attributes:u};break}default:throw new Error("Unrecognized html command")}if(!e.settings.isTrusted(l))throw new T(`Function "${t}" is not trusted`,n);return{type:"html",mode:e.mode,attributes:u,body:ie(i)}},mathmlBuilder:(e,t)=>{let n=je(e.body,t),r=[];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/)),n.classes=r;for(let s in e.attributes)s!=="class"&&Object.prototype.hasOwnProperty.call(e.attributes,s)&&n.setAttribute(s,e.attributes[s]);return n}});var cr=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};{let t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new T("Invalid size: '"+e+"' in \\includegraphics");let n={number:+(t[1]+t[2]),unit:t[3]};if(!zo(n))throw new T("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n}};D({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:({parser:e,token:t},n,r)=>{let s={number:0,unit:"em"},i={number:.9,unit:"em"},l={number:0,unit:"em"},u="";if(r[0]){let x=P(r[0],"raw").string.split(",");for(let g=0;g<x.length;g++){let b=x[g].split("=");if(b.length===2){let v=b[1].trim();switch(b[0].trim()){case"alt":u=v;break;case"width":s=cr(v);break;case"height":i=cr(v);break;case"totalheight":l=cr(v);break;default:throw new T("Invalid key: '"+b[0]+"' in \\includegraphics.")}}}}let c=P(n[0],"url").url;if(u===""&&(u=c,u=u.replace(/^.*[\\/]/,""),u=u.substring(0,u.lastIndexOf("."))),!e.settings.isTrusted({command:"\\includegraphics",url:c}))throw new T('Function "\\includegraphics" is not trusted',t);return{type:"includegraphics",mode:e.mode,alt:u,width:s,height:i,totalheight:l,src:c}},mathmlBuilder:(e,t)=>{let n=Ie(e.height,t),r={number:0,unit:"em"};e.totalheight.number>0&&e.totalheight.unit===n.unit&&e.totalheight.number>n.number&&(r.number=e.totalheight.number-n.number,r.unit=n.unit);let s=0;e.width.number>0&&(s=Ie(e.width,t));let i={height:n.number+r.number+"em"};s.number>0&&(i.width=s.number+s.unit),r.number>0&&(i.verticalAlign=-r.number+r.unit);let l=new hr(e.src,e.alt,i);return l.height=n,l.depth=r,new y("mtext",[l])}});D({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler({parser:e,funcName:t,token:n},r){let s=P(r[0],"size");if(e.settings.strict){let i=t[1]==="m",l=s.value.unit==="mu";if(i){if(!l)throw new T(`LaTeX's ${t} supports only mu units, not ${s.value.unit} units`,n);if(e.mode!=="math")throw new T(`LaTeX's ${t} works only in math mode`,n)}else if(l)throw new T(`LaTeX's ${t} doesn't support mu units`,n)}return{type:"kern",mode:e.mode,dimension:s.value}},mathmlBuilder(e,t){let n=Ie(e.dimension,t),r=n.number>0&&n.unit==="em"?ni(n.number):"";if(e.mode==="text"&&r.length>0){let s=new se(r);return new y("mtext",[s])}else if(n.number>=0){let s=new y("mspace");return s.setAttribute("width",n.number+n.unit),s}else{let s=new y("mrow");return s.style.marginLeft=n.number+n.unit,s}}});var ni=function(e){return e>=.05555&&e<=.05556?"\u200A":e>=.1666&&e<=.1667?"\u2009":e>=.2222&&e<=.2223?"\u2005":e>=.2777&&e<=.2778?"\u2005\u200A":""},ri=/[^A-Za-z_0-9-]/g;D({type:"label",names:["\\label"],props:{numArgs:1,argTypes:["raw"]},handler({parser:e},t){return{type:"label",mode:e.mode,string:t[0].string.replace(ri,"")}},mathmlBuilder(e,t){let n=new y("mrow",[],["tml-label"]);return e.string.length>0&&n.setLabel(e.string),n}});var Ql=["\\clap","\\llap","\\rlap"];D({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap","\\clap","\\llap","\\rlap"],props:{numArgs:1,allowedInText:!0},handler:({parser:e,funcName:t,token:n},r)=>{if(Ql.includes(t)){if(e.settings.strict&&e.mode!=="text")throw new T(`{${t}} can be used only in text mode.
158
- Try \\math${t.slice(1)}`,n);t=t.slice(1)}else t=t.slice(5);let s=r[0];return{type:"lap",mode:e.mode,alignment:t,body:s}},mathmlBuilder:(e,t)=>{let n;if(e.alignment==="llap"){let i=he(ie(e.body),t),l=new y("mphantom",i);n=new y("mpadded",[l]),n.setAttribute("width","0.1px")}let r=U(e.body,t),s;if(e.alignment==="llap"?(r.style.position="absolute",r.style.right="0",r.style.bottom="0",s=new y("mpadded",[n,r])):s=new y("mpadded",[r]),e.alignment==="rlap")e.body.body.length>0&&e.body.body[0].type==="genfrac"&&s.setAttribute("lspace","0.16667em");else{let 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}});D({type:"ordgroup",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:t},n){let r=t.mode;t.switchMode("math");let s=e==="\\("?"\\)":"$",i=t.parseExpression(!1,s);return t.expect(s),t.switchMode(r),{type:"ordgroup",mode:t.mode,body:i}}});D({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new T(`Mismatched ${e.funcName}`,t)}});var Jl=(e,t)=>{switch(t.level){case X.DISPLAY:return e.display;case X.TEXT:return e.text;case X.SCRIPT:return e.script;case X.SCRIPTSCRIPT:return e.scriptscript;default:return e.text}};D({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:({parser:e},t)=>({type:"mathchoice",mode:e.mode,display:ie(t[0]),text:ie(t[1]),script:ie(t[2]),scriptscript:ie(t[3])}),mathmlBuilder:(e,t)=>{let n=Jl(e,t);return je(n,t)}});var eu=["text","textord","mathord","atom"];function si(e,t){let n,r=he(e.body,t);if(e.mclass==="minner")n=new y("mpadded",r);else if(e.mclass==="mord")e.isCharacterBox||r[0].type==="mathord"?(n=r[0],n.type="mi",n.children.length===1&&n.children[0].text&&n.children[0].text==="\u2207"&&n.setAttribute("mathvariant","normal")):n=new y("mi",r);else{n=new y("mrow",r),e.mustPromote?(n=r[0],n.type="mo",e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&n.setAttribute("mathvariant","italic")):n=new y("mrow",r);let s=t.level<2;n.type==="mrow"?s&&(e.mclass==="mbin"?(n.children.unshift(re(.2222)),n.children.push(re(.2222))):e.mclass==="mrel"?(n.children.unshift(re(.2778)),n.children.push(re(.2778))):e.mclass==="mpunct"?n.children.push(re(.1667)):e.mclass==="minner"&&(n.children.unshift(re(.0556)),n.children.push(re(.0556)))):e.mclass==="mbin"?(n.attributes.lspace=s?"0.2222em":"0",n.attributes.rspace=s?"0.2222em":"0"):e.mclass==="mrel"?(n.attributes.lspace=s?"0.2778em":"0",n.attributes.rspace=s?"0.2778em":"0"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace=s?"0.1667em":"0"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&s&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em"),e.mclass==="mopen"||e.mclass==="mclose"||(delete n.attributes.stretchy,delete n.attributes.form)}return n}D({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:t},n){let r=n[0],s=yn(r),i=!0,l={type:"mathord",text:"",mode:e.mode},u=r.body?r.body:[r];for(let c of u)if(eu.includes(c.type))K[e.mode][c.text]?l.text+=K[e.mode][c.text].replace:c.text?l.text+=c.text:c.body&&c.body.map(p=>{l.text+=p.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:ie(i?l:r),isCharacterBox:s,mustPromote:i}},mathmlBuilder:si});var oi=e=>{let t=e.type==="ordgroup"&&e.body.length&&e.body.length===1?e.body[0]:e;if(t.type==="atom"){let n=e.body.length>0&&e.body[0].text&&K.math[e.body[0].text]?K.math[e.body[0].text].group:t.family;return n==="bin"||n==="rel"?"m"+n:"mord"}else return"mord"};D({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler({parser:e},t){return{type:"mclass",mode:e.mode,mclass:oi(t[0]),body:ie(t[1]),isCharacterBox:yn(t[1])}}});D({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler({parser:e,funcName:t},n){let r=n[1],s=n[0],i;t!=="\\stackrel"?i=oi(r):i="mrel";let u={type:i==="mrel"||i==="mbin"?"op":"ordgroup",mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:t!=="\\stackrel",body:ie(r)};return{type:"supsub",mode:s.mode,stack:!0,base:u,sup:t==="\\underset"?null:s,sub:t==="\\underset"?s:null}},mathmlBuilder:si});var ln=(e,t,n)=>{if(!e)return n;let r=U(e,t);return r.type==="mrow"&&r.children.length===0?n:r};D({type:"multiscript",names:["\\sideset","\\pres@cript"],props:{numArgs:3},handler({parser:e,funcName:t,token:n},r){if(r[2].body.length===0)throw new T(t+"cannot parse an empty base.");let s=r[2].body[0];if(e.settings.strict&&t==="\\sideset"&&!s.symbol)throw new T("The base of \\sideset must be a big operator. Try \\prescript.");if(r[0].body.length>0&&r[0].body[0].type!=="supsub"||r[1].body.length>0&&r[1].body[0].type!=="supsub")throw new T("\\sideset can parse only subscripts and superscripts in its first two arguments",n);let i=r[0].body.length>0?r[0].body[0]:null,l=r[1].body.length>0?r[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){let n=U(e.base,t),r=new y("mprescripts"),s=new y("none"),i=[],l=ln(e.prescripts.sub,t,s),u=ln(e.prescripts.sup,t,s);if(e.isSideset&&(l.setAttribute("style","text-align: left;"),u.setAttribute("style","text-align: left;")),e.postscripts){let c=ln(e.postscripts.sub,t,s),p=ln(e.postscripts.sup,t,s);i=[n,c,p,r,l,u]}else i=[n,r,l,u];return new y("mmultiscripts",i)}});D({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){let n=yn(t[0]),r;return n?(r=ie(t[0]),r[0].text.charAt(0)==="\\"&&(r[0].text=K.math[r[0].text].replace),r[0].text=r[0].text.slice(0,1)+"\u0338"+r[0].text.slice(1)):r=[{type:"textord",mode:"math",text:"\u0338"},{type:"kern",mode:"math",dimension:{number:-.6,unit:"em"}},t[0]],{type:"not",mode:e.mode,body:r,isCharacterBox:n}},mathmlBuilder(e,t){return e.isCharacterBox?he(e.body,t,!0)[0]:je(e.body,t)}});var tu=["textord","mathord","atom"],nu=["\\smallint"],$r=["textord","mathord","ordgroup","close","leftright","font"],vo=e=>{e.attributes.lspace="0.1667em",e.attributes.rspace="0.1667em"},Nt=(e,t)=>{let n;if(e.symbol)n=new y("mo",[ve(e.name,e.mode)]),nu.includes(e.name)?n.setAttribute("largeop","false"):n.setAttribute("movablelimits","false"),e.fromMathOp&&vo(n);else if(e.body)n=new y("mo",he(e.body,t)),e.fromMathOp&&vo(n);else if(n=new y("mi",[new se(e.name.slice(1))]),!e.parentIsSupSub){let r=new y("mo",[ve("\u2061","text")]),s=[n,r];if(e.needsLeadingSpace){let i=new y("mspace");i.setAttribute("width","0.1667em"),s.unshift(i)}if(!e.isFollowedByDelimiter){let i=new y("mspace");i.setAttribute("width","0.1667em"),s.push(i)}n=new y("mrow",s)}return n},ru={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A05":"\\bigsqcap","\u2A06":"\\bigsqcup","\u2A03":"\\bigcupdot","\u2A07":"\\bigdoublevee","\u2A08":"\\bigdoublewedge","\u2A09":"\\bigtimes"};D({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcupplus","\\bigcupdot","\\bigcap","\\bigcup","\\bigdoublevee","\\bigdoublewedge","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcap","\\bigsqcup","\\bigtimes","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A03","\u2A04","\u2A05","\u2A06","\u2A07","\u2A08","\u2A09"],props:{numArgs:0},handler:({parser:e,funcName:t},n)=>{let r=t;return r.length===1&&(r=ru[r]),{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:r}},mathmlBuilder:Nt});D({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:({parser:e},t)=>{let n=t[0],r=n.body?n.body:[n],s=r.length===1&&tu.includes(r[0].type);return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:s,fromMathOp:!0,stack:!1,name:s?r[0].text:null,body:s?null:ie(n)}},mathmlBuilder:Nt});var su={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint","\u2231":"\\intclockwise","\u2232":"\\varointclockwise","\u2A0C":"\\iiiint","\u2A0D":"\\intbar","\u2A0E":"\\intBar","\u2A0F":"\\fint","\u2A12":"\\rppolint","\u2A13":"\\scpolint","\u2A15":"\\pointint","\u2A16":"\\sqint","\u2A17":"\\intlarhk","\u2A18":"\\intx","\u2A19":"\\intcap","\u2A1A":"\\intcup"};D({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}){let n=e.prevAtomType,r=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:An(r),needsLeadingSpace:n.length>0&&$r.includes(n),name:t}},mathmlBuilder:Nt});D({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,r=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:An(r),needsLeadingSpace:n.length>0&&$r.includes(n),name:t}},mathmlBuilder:Nt});D({type:"op",names:["\\int","\\iint","\\iiint","\\iiiint","\\oint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\intbar","\\intBar","\\fint","\\rppolint","\\scpolint","\\pointint","\\sqint","\\intlarhk","\\intx","\\intcap","\\intcup","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230","\u2231","\u2232","\u2A0C","\u2A0D","\u2A0E","\u2A0F","\u2A12","\u2A13","\u2A15","\u2A16","\u2A17","\u2A18","\u2A19","\u2A1A"],props:{numArgs:0,allowedInArgument:!0},handler({parser:e,funcName:t}){let n=t;return n.length===1&&(n=su[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:n}},mathmlBuilder:Nt});var ou=(e,t)=>{let n=he(e.body,t.withFont("mathrm")),r=!0;for(let i=0;i<n.length;i++){let l=n[i];if(l instanceof y)switch(((l.type==="mrow"||l.type==="mpadded")&&l.children.length===1&&l.children[0]instanceof y||l.type==="mrow"&&l.children.length===2&&l.children[0]instanceof y&&l.children[1]instanceof y&&l.children[1].type==="mspace"&&!l.children[1].attributes.width&&l.children[1].children.length===0)&&(l=l.children[0]),l.type){case"mi":case"mn":case"ms":case"mtext":break;case"mspace":if(l.attributes.width){let u=l.attributes.width.replace("em",""),c=ni(Number(u));c===""?r=!1:n[i]=new y("mtext",[new se(c)])}break;case"mo":{let u=l.children[0];l.children.length===1&&u instanceof se?u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){let i=n.map(l=>l.toText()).join("");n=[new se(i)]}else if(n.length===1&&["mover","munder"].includes(n[0].type)&&(n[0].children[0].type==="mi"||n[0].children[0].type==="mtext")){if(n[0].children[0].type="mi",e.parentIsSupSub)return new y("mrow",n);{let i=new y("mo",[ve("\u2061","text")]);return et([n[0],i])}}let s;if(r?(s=new y("mi",n),n[0].text.length===1&&s.setAttribute("mathvariant","normal")):s=new y("mrow",n),!e.parentIsSupSub){let i=new y("mo",[ve("\u2061","text")]),l=[s,i];if(e.needsLeadingSpace){let u=new y("mspace");u.setAttribute("width","0.1667em"),l.unshift(u)}if(!e.isFollowedByDelimiter){let u=new y("mspace");u.setAttribute("width","0.1667em"),l.push(u)}return et(l)}return s};D({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let r=n[0],s=e.prevAtomType,i=e.gullet.future().text;return{type:"operatorname",mode:e.mode,body:ie(r),alwaysHandleSupSub:t==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:An(i),needsLeadingSpace:s.length>0&&$r.includes(s)}},mathmlBuilder:ou});d("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");tt({type:"ordgroup",mathmlBuilder(e,t){return je(e.body,t,e.semisimple)}});D({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"phantom",mode:e.mode,body:ie(n)}},mathmlBuilder:(e,t)=>{let n=he(e.body,t);return new y("mphantom",n)}});D({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"hphantom",mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=he(ie(e.body),t),r=new y("mphantom",n),s=new y("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});D({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:"vphantom",mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=he(ie(e.body),t),r=new y("mphantom",n),s=new y("mpadded",[r]);return s.setAttribute("width","0px"),s}});D({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler({parser:e},t){return{type:"pmb",mode:e.mode,body:ie(t[0])}},mathmlBuilder(e,t){let n=he(e.body,t),r=Sr(n);return r.setAttribute("style","font-weight:bold"),r}});var ii=(e,t)=>{let n=t.withLevel(X.TEXT),r=new y("mpadded",[U(e.body,n)]),s=Ie(e.dy,t);return r.setAttribute("voffset",s.number+s.unit),s.number>0?r.style.padding=s.number+s.unit+" 0 0 0":r.style.padding="0 0 "+Math.abs(s.number)+s.unit+" 0",r};D({type:"raise",names:["\\raise","\\lower"],props:{numArgs:2,argTypes:["size","primitive"],primitive:!0},handler({parser:e,funcName:t},n){let r=P(n[0],"size").value;t==="\\lower"&&(r.number*=-1);let s=n[1];return{type:"raise",mode:e.mode,dy:r,body:s}},mathmlBuilder:ii});D({type:"raise",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler({parser:e,funcName:t},n){let r=P(n[0],"size").value,s=n[1];return{type:"raise",mode:e.mode,dy:r,body:s}},mathmlBuilder:ii});D({type:"ref",names:["\\ref","\\eqref"],props:{numArgs:1,argTypes:["raw"]},handler({parser:e,funcName:t},n){return{type:"ref",mode:e.mode,funcName:t,string:n[0].string.replace(ri,"")}},mathmlBuilder(e,t){let n=e.funcName==="\\ref"?["tml-ref"]:["tml-ref","tml-eqref"];return new mn("#"+e.string,n,null)}});D({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){let n=U(e.body,t);return n.style.transform="scaleX(-1)",n}});D({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler({parser:e}){return{type:"internal",mode:e.mode}}});D({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler({parser:e},t,n){let r=n[0],s=P(t[0],"size"),i=P(t[1],"size");return{type:"rule",mode:e.mode,shift:r&&P(r,"size").value,width:s.value,height:i.value}},mathmlBuilder(e,t){let n=Ie(e.width,t),r=Ie(e.height,t),s=e.shift?Ie(e.shift,t):{number:0,unit:"em"},i=t.color&&t.getColor()||"black",l=new y("mspace");if(n.number>0&&r.number>0&&l.setAttribute("mathbackground",i),l.setAttribute("width",n.number+n.unit),l.setAttribute("height",r.number+r.unit),s.number===0)return l;let u=new y("mpadded",[l]);return s.number>=0?u.setAttribute("height","+"+s.number+s.unit):(u.setAttribute("height",s.number+s.unit),u.setAttribute("depth","+"+-s.number+s.unit)),u.setAttribute("voffset",s.number+s.unit),u}});var So=/^[0-9]$/,iu={0:"\u2080",1:"\u2081",2:"\u2082",3:"\u2083",4:"\u2084",5:"\u2085",6:"\u2086",7:"\u2087",8:"\u2088",9:"\u2089"},au={0:"\u2070",1:"\xB9",2:"\xB2",3:"\xB3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079"};D({type:"sfrac",names:["\\sfrac"],props:{numArgs:2,allowedInText:!0,allowedInMath:!0},handler({parser:e},t){let n="";for(let s of t[0].body){if(s.type!=="textord"||!So.test(s.text))throw new T("Numerator must be an integer.",s);n+=s.text}let r="";for(let s of t[1].body){if(s.type!=="textord"||!So.test(s.text))throw new T("Denominator must be an integer.",s);r+=s.text}return{type:"sfrac",mode:e.mode,numerator:n,denominator:r}},mathmlBuilder(e,t){let n=e.numerator.split("").map(i=>au[i]).join(""),r=e.denominator.split("").map(i=>iu[i]).join(""),s=new se(n+"\u2044"+r,e.mode,t);return new y("mn",[s],["special-fraction"])}});var _o={"\\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};D({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:n},r)=>{n.settings.strict&&n.mode==="math"&&console.log(`Temml strict-mode warning: Command ${t} is invalid in math mode.`);let s=n.parseExpression(!1,e,!0);return{type:"sizing",mode:n.mode,funcName:t,body:s}},mathmlBuilder:(e,t)=>{let n=t.withFontSize(_o[e.funcName]),r=he(e.body,n),s=Sr(r),i=(_o[e.funcName]/t.fontSize).toFixed(4);return s.setAttribute("mathsize",i+"em"),s}});D({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},t,n)=>{let r=!1,s=!1,i=n[0]&&P(n[0],"ordgroup");if(i){let u="";for(let c=0;c<i.body.length;++c)if(u=i.body[c].text,u==="t")r=!0;else if(u==="b")s=!0;else{r=!1,s=!1;break}}else r=!0,s=!0;let l=t[0];return{type:"smash",mode:e.mode,body:l,smashHeight:r,smashDepth:s}},mathmlBuilder:(e,t)=>{let n=new y("mpadded",[U(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});var lu=["a","c","e","\u0131","m","n","o","r","s","u","v","w","x","z","\u03B1","\u03B5","\u03B9","\u03BA","\u03BD","\u03BF","\u03C0","\u03C3","\u03C4","\u03C5","\u03C9","\\alpha","\\epsilon","\\iota","\\kappa","\\nu","\\omega","\\pi","\\tau","\\omega"];D({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},t,n){let r=n[0],s=t[0];return s.body&&s.body.length===1&&s.body[0].text&&lu.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:r}},mathmlBuilder(e,t){let{body:n,index:r}=e;return r?new y("mroot",[U(n,t),U(r,t.incrementLevel())]):new y("msqrt",[U(n,t)])}});var uu={display:0,text:1,script:2,scriptscript:3},cu={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};D({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:t,parser:n},r){let s=n.parseExpression(!0,e,!0),i=t.slice(1,t.length-5);return{type:"styling",mode:n.mode,scriptLevel:i,body:s}},mathmlBuilder(e,t){let n=t.withLevel(uu[e.scriptLevel]),r=he(e.body,n),s=Sr(r),i=cu[e.scriptLevel];return s.setAttribute("scriptlevel",i[0]),s.setAttribute("displaystyle",i[1]),s}});var du=/^m(over|under|underover)$/,pu="DHKLUcegorsuvxyz\u03A0\u03A5\u03A8\u03B1\u03B4\u03B7\u03B9\u03BC\u03BD\u03BF\u03C4\u03C5\u03C7\u03F5",hu="BCEFGIMNOPQRSTXZlpqtw\u0393\u0398\u039E\u03A3\u03A6\u03A9\u03B2\u03B5\u03B6\u03B8\u03BE\u03C1\u03C2\u03C6\u03C8\u03D1\u03D5\u03F1",mu="AJdf\u0394\u039B";tt({type:"supsub",mathmlBuilder(e,t){let n=!1,r,s,i=!1,l=!1,u=!1;e.base&&e.base.type==="horizBracket"&&(s=!!e.sup,s===e.base.isOver&&(n=!0,r=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,u=e.base.needsLeadingSpace);let c=e.stack&&e.base.body.length===1?[U(e.base.body[0],t)]:[U(e.base,t)],p=t.inSubOrSup();if(e.sub){let b=U(e.sub,p);t.level===3&&b.setAttribute("scriptlevel","2"),c.push(b)}if(e.sup){let b=U(e.sup,p);if(t.level===3&&b.setAttribute("scriptlevel","2"),e.base&&e.base.text&&e.base.text.length===1){let v=e.base.text;pu.indexOf(v)>-1?b.classes.push("tml-sml-pad"):hu.indexOf(v)>-1?b.classes.push("tml-med-pad"):mu.indexOf(v)>-1&&b.classes.push("tml-lrg-pad")}c.push(b)}let x;if(n)x=r?"mover":"munder";else if(e.sub)if(e.sup){let b=e.base;b&&(b.type==="op"&&b.limits||b.type==="multiscript")&&(t.level===X.DISPLAY||b.alwaysHandleSupSub)||b&&b.type==="operatorname"&&b.alwaysHandleSupSub&&(t.level===X.DISPLAY||b.limits)?x="munderover":x="msubsup"}else{let b=e.base;e.stack||b&&b.type==="op"&&b.limits&&(t.level===X.DISPLAY||b.alwaysHandleSupSub)||b&&b.type==="operatorname"&&b.alwaysHandleSupSub&&(b.limits||t.level===X.DISPLAY)?x="munder":x="msub"}else{let b=e.base;b&&b.type==="op"&&b.limits&&(t.level===X.DISPLAY||b.alwaysHandleSupSub)||b&&b.type==="operatorname"&&b.alwaysHandleSupSub&&(b.limits||t.level===X.DISPLAY)?x="mover":x="msup"}let g=new y(x,c);if(i){let b=new y("mo",[ve("\u2061","text")]);if(u){let v=new y("mspace");v.setAttribute("width","0.1667em"),g=et([v,g,b])}else g=et([g,b]);if(l){let v=new y("mspace");v.setAttribute("width","0.1667em"),g.children.push(v)}}else du.test(x)&&(g=new y("mrow",[g]));return g}});var fu=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],gu=["\\Rsh","\\Lsh","\\restriction"],bu=e=>{if(e.length===1){let t=e.codePointAt(0);return 8591<t&&t<8704}return e.indexOf("arrow")>-1||e.indexOf("harpoon")>-1||gu.includes(e)};tt({type:"atom",mathmlBuilder(e,t){let n=new y("mo",[ve(e.text,e.mode)]);if(e.family==="punct")n.setAttribute("separator","true");else if(e.family==="open"||e.family==="close")e.family==="open"?(n.setAttribute("form","prefix"),n.setAttribute("stretchy","false")):e.family==="close"&&(n.setAttribute("form","postfix"),n.setAttribute("stretchy","false"));else if(e.text==="\\mid")n.setAttribute("lspace","0.22em"),n.setAttribute("rspace","0.22em"),n.setAttribute("stretchy","false");else if(e.family==="rel"&&bu(e.text))n.setAttribute("stretchy","false");else if(fu.includes(e.text))n.setAttribute("mathsize","70%");else if(e.text===":")n.attributes.lspace="0.2222em",n.attributes.rspace="0.2222em";else if(e.needsSpacing)return e.family==="bin"?new y("mrow",[re(.222),n,re(.222)]):new y("mrow",[re(.2778),n,re(.2778)]);return n}});var Eo={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},ai=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";let n=t.font;if(!n||n==="mathnormal")return null;let r=e.mode;switch(n){case"mathit":return"italic";case"mathrm":{let 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 K[r][s]&&K[r][s].replace&&(s=K[r][s].replace),Object.prototype.hasOwnProperty.call(Eo,n)?Eo[n]:null},Co=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),xu=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),yu=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),li=Object.freeze({"\u03F5":119527,\u03D1:119564,\u03F0:119534,\u03C6:119577,\u03F1:119535,\u03D6:119563}),wu=Object.freeze({"\u03F5":119643,\u03D1:119680,\u03F0:119650,\u03C6:119693,\u03F1:119651,\u03D6:119679}),Do=Object.freeze({"\u03F5":119701,\u03D1:119738,\u03F0:119708,\u03C6:119751,\u03F1:119709,\u03D6:119737}),ku=Object.freeze({"\u03F5":119759,\u03D1:119796,\u03F0:119766,\u03C6:119809,\u03F1:119767,\u03D6:119795}),Au=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>Co[e]||119899,"script-bold":e=>119951,fraktur:e=>xu[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>yu[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=>Co[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==="\u03D5"?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=>li[e]||-51,italic:e=>0,"bold-italic":e=>wu[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>Do[e]||116,"sans-serif-bold":e=>Do[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>ku[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}}),Et=(e,t)=>{let n=e.codePointAt(0),r=64<n&&n<91?"upperCaseLatin":96<n&&n<123?"lowerCaseLatin":912<n&&n<938?"upperCaseGreek":944<n&&n<970||e==="\u03D5"?"lowerCaseGreek":120545<n&&n<120572||li[e]?"varGreek":47<n&&n<58?"numeral":"other";return r==="other"?e:String.fromCodePoint(n+Au[r][t](e))},Tu=Object.freeze({a:"\u1D00",b:"\u0299",c:"\u1D04",d:"\u1D05",e:"\u1D07",f:"\uA730",g:"\u0262",h:"\u029C",i:"\u026A",j:"\u1D0A",k:"\u1D0B",l:"\u029F",m:"\u1D0D",n:"\u0274",o:"\u1D0F",p:"\u1D18",q:"\u01EB",r:"\u0280",s:"s",t:"\u1D1B",u:"\u1D1C",v:"\u1D20",w:"\u1D21",x:"x",y:"\u028F",z:"\u1D22"}),vu=/^\d(?:[\d,.]*\d)?$/,Su=/[A-Ba-z]/,_u=new Set(["\\prime","\\dprime","\\trprime","\\qprime","\\backprime","\\backdprime","\\backtrprime"]),Eu=(e,t,n)=>{let r=new y(n,[e]),s=new y("mstyle",[r]);return s.style["font-style"]="italic",s.style["font-family"]="Cambria, 'Times New Roman', serif",t==="bold-italic"&&(s.style["font-weight"]="bold"),s};tt({type:"mathord",mathmlBuilder(e,t){let n=ve(e.text,e.mode,t),r=n.text.codePointAt(0),s=912<r&&r<938?"normal":"italic",i=ai(e,t)||s;if(i==="script")return n.text=Et(n.text,i),new y("mi",[n],[t.font]);i!=="italic"&&(n.text=Et(n.text,i));let l=new y("mi",[n]);if(i==="normal"&&(l.setAttribute("mathvariant","normal"),n.text.length===1)){let u=new y("mspace",[]);l=new y("mrow",[l,u])}return l}});tt({type:"textord",mathmlBuilder(e,t){let n=e.text,r=n.codePointAt(0);t.fontFamily==="textsc"&&96<r&&r<123&&(n=Tu[n]);let s=ve(n,e.mode,t),i=ai(e,t)||"normal",l;if(vu.test(e.text)){let u=e.mode==="text"?"mtext":"mn";if(i==="italic"||i==="bold-italic")return Eu(s,i,u);i!=="normal"&&(s.text=s.text.split("").map(c=>Et(c,i)).join("")),l=new y(u,[s])}else if(e.mode==="text")i!=="normal"&&(s.text=Et(s.text,i)),l=new y("mtext",[s]);else if(_u.has(e.text))l=new y("mo",[s]),l.classes.push("tml-prime");else{let u=s.text;i!=="italic"&&(s.text=Et(s.text,i)),l=new y("mi",[s]),s.text===u&&Su.test(u)&&l.setAttribute("mathvariant","italic")}return l}});var Cu={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Du={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};tt({type:"spacing",mathmlBuilder(e,t){let n;if(Object.prototype.hasOwnProperty.call(Du,e.text))n=new y("mtext",[new se("\xA0")]);else if(Object.prototype.hasOwnProperty.call(Cu,e.text))n=new y("mo"),e.text==="\\nobreak"&&n.setAttribute("linebreak","nobreak");else throw new T(`Unknown type of space "${e.text}"`);return n}});tt({type:"tag"});var Lo={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},Ro={"\\textbf":"textbf","\\textmd":"textmd"},Lu={"\\textit":"textit","\\textup":"textup"},Ru=(e,t)=>{let n=e.font;if(n){if(Lo[n])return t.withTextFontFamily(Lo[n]);if(Ro[n])return t.withTextFontWeight(Ro[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(Lu[n])};D({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},n){let r=n[0];return{type:"text",mode:e.mode,body:ie(r),font:t}},mathmlBuilder(e,t){let n=Ru(e,t),r=je(e.body,n);return wn(r)}});D({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){let n=new y("mtd",[U(e.body,t)]);n.style.padding="0";let r=new y("mtr",[n]);return new y("mtable",[r])}});D({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new T("\\verb ended by end of line instead of matching delimiter")},mathmlBuilder(e,t){let n=new se(qu(e)),r=new y("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var qu=e=>e.body.replace(/ /g,e.star?"\u2423":"\xA0"),Je=Bo,ui=`[ \r
159
- ]`,Ou="\\\\[a-zA-Z@]+",$u="\\\\[^\uD800-\uDFFF]",Mu=`(${Ou})${ui}*`,Iu=`\\\\(
160
- |[ \r ]+
161
- ?)[ \r ]*`,wr="[\u0300-\u036F]",qo=new RegExp(`${wr}+$`),Bu=`(${ui}+)|${Iu}|([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]${wr}*|[\uD800-\uDBFF][\uDC00-\uDFFF]${wr}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${Mu}|${$u})`,xn=class{constructor(t,n){this.input=t,this.settings=n,this.tokenRegex=new RegExp(Bu,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){let t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new qe("EOF",new we(this,n,n));let r=this.tokenRegex.exec(t);if(r===null||r.index!==n)throw new T(`Unexpected character: '${t[n]}'`,new qe(t[n],new we(this,n,n+1)));let s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){let i=t.indexOf(`
162
- `,this.tokenRegex.lastIndex);if(i===-1){if(this.tokenRegex.lastIndex=t.length,this.settings.strict)throw new T("% 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 qe(s,new we(this,n,this.tokenRegex.lastIndex))}},kr=class{constructor(t={},n={}){this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new T("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");let t=this.undefStack.pop();for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]===void 0?delete this.current[n]:this.current[n]=t[n])}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,n,r=!1){if(r){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]=n)}else{let s=this.undefStack[this.undefStack.length-1];s&&!Object.prototype.hasOwnProperty.call(s,t)&&(s[t]=this.current[t])}this.current[t]=n}},ci={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},Ar=class{constructor(t,n,r){this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new kr(Ml,n.macros),this.mode=r,this.stack=[]}feed(t){this.lexer=new xn(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 n,r,s;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new qe("EOF",r.loc)),this.pushTokens(s),n.range(r,"")}consumeSpaces(){for(;this.future().text===" ";)this.stack.pop()}consumeArg(t){let n=[],r=t&&t.length>0;r||this.consumeSpaces();let s=this.future(),i,l=0,u=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++l;else if(i.text==="}"){if(--l,l===-1)throw new T("Extra }",i)}else if(i.text==="EOF")throw new T("Unexpected end of input in a macro argument, expected '"+(t&&r?t[u]:"}")+"'",i);if(t&&r)if((l===0||l===1&&t[u]==="{")&&i.text===t[u]){if(++u,u===t.length){n.splice(-u,u);break}}else u=0}while(l!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new T("The length of delimiters doesn't match the number of args!");let s=n[0];for(let i=0;i<s.length;i++){let l=this.popToken();if(s[i]!==l.text)throw new T("Use of the macro doesn't match its definition",l)}}let r=[];for(let s=0;s<t;s++)r.push(this.consumeArg(n&&n[s+1]).tokens);return r}expandOnce(t){let n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||t&&s.unexpandable){if(t&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new T("Undefined control sequence: "+r);return this.pushToken(n),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new T("Too many expansions: infinite loop or need to increase maxExpand setting");let i=s.tokens,l=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(let u=i.length-1;u>=0;--u){let c=i[u];if(c.text==="#"){if(u===0)throw new T("Incomplete placeholder at end of macro body",c);if(c=i[--u],c.text==="#")i.splice(u+1,1);else if(/^[1-9]$/.test(c.text))i.splice(u,2,...l[+c.text-1]);else throw new T("Not a valid argument number",c)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){let t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new qe(t)]):void 0}expandTokens(t){let n=[],r=this.stack.length;for(this.pushTokens(t);this.stack.length>r;)if(this.expandOnce(!0)===!1){let s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return n}expandMacroAsText(t){let n=this.expandMacro(t);return n&&n.map(r=>r.text).join("")}_getExpansion(t){let n=this.macros.get(t);if(n==null)return n;if(t.length===1){let s=this.lexer.catcodes[t];if(s!=null&&s!==13)return}let r=typeof n=="function"?n(this):n;if(typeof r=="string"){let s=0;if(r.indexOf("#")!==-1){let p=r.replace(/##/g,"");for(;p.indexOf("#"+(s+1))!==-1;)++s}let i=new xn(r,this.settings),l=[],u=i.lex();for(;u.text!=="EOF";)l.push(u),u=i.lex();return l.reverse(),{tokens:l,numArgs:s}}return r}isDefined(t){return this.macros.has(t)||Object.prototype.hasOwnProperty.call(Je,t)||Object.prototype.hasOwnProperty.call(K.math,t)||Object.prototype.hasOwnProperty.call(K.text,t)||Object.prototype.hasOwnProperty.call(ci,t)}isExpandable(t){let n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Object.prototype.hasOwnProperty.call(Je,t)&&!Je[t].primitive}},Oo=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,un=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),$o=Object.freeze({"\u{1D49C}":"A",\u212C:"B","\u{1D49E}":"C","\u{1D49F}":"D",\u2130:"E",\u2131:"F","\u{1D4A2}":"G",\u210B:"H",\u2110:"I","\u{1D4A5}":"J","\u{1D4A6}":"K",\u2112:"L",\u2133:"M","\u{1D4A9}":"N","\u{1D4AA}":"O","\u{1D4AB}":"P","\u{1D4AC}":"Q",\u211B:"R","\u{1D4AE}":"S","\u{1D4AF}":"T","\u{1D4B0}":"U","\u{1D4B1}":"V","\u{1D4B2}":"W","\u{1D4B3}":"X","\u{1D4B4}":"Y","\u{1D4B5}":"Z"}),dr={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},Mo={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u010F:"d\u030C",\u1E0B:"d\u0307",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u013A:"l\u0301",\u013E:"l\u030C",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u010E:"D\u030C",\u1E0A:"D\u0307",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0139:"L\u0301",\u013D:"L\u030C",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u0164:"T\u030C",\u1E6A:"T\u0307",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},Nu=["bin","op","open","punct","rel"],Pu=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,zu=/^ *\\text/,Ot=class e{constructor(t,n,r=!1){this.mode="math",this.gullet=new Ar(t,n,this.mode),this.settings=n,this.isPreamble=r,this.leftrightDepth=0,this.prevAtomType=""}expect(t,n=!0){if(this.fetch().text!==t)throw new T(`Expected '${t}', got '${this.fetch().text}'`,this.fetch());n&&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");let t=this.parseExpression(!1);if(this.expect("EOF"),this.isPreamble){let r=Object.create(null);return Object.entries(this.gullet.macros.current).forEach(([s,i])=>{r[s]=i}),this.gullet.endGroup(),r}let n=this.gullet.macros.get("\\df@tag");return this.gullet.endGroup(),n&&(this.gullet.macros.current["\\df@tag"]=n),t}static get endOfExpression(){return["}","\\endgroup","\\end","\\right","\\endtoggle","&"]}subparse(t){let n=this.nextToken;this.consume(),this.gullet.pushToken(new qe("}")),this.gullet.pushTokens(t);let r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(t,n,r){let s=[];for(this.prevAtomType="";;){this.mode==="math"&&this.consumeSpaces();let i=this.fetch();if(e.endOfExpression.indexOf(i.text)!==-1||n&&i.text===n||r&&i.text==="\\middle"||t&&Je[i.text]&&Je[i.text].infix)break;let l=this.parseAtom(n);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 n=-1,r;for(let s=0;s<t.length;s++)if(t[s].type==="infix"){if(n!==-1)throw new T("only one infix operator per group",t[s].token);n=s,r=t[s].replaceWith}if(n!==-1&&r){let s,i,l=t.slice(0,n),u=t.slice(n+1);l.length===1&&l[0].type==="ordgroup"?s=l[0]:s={type:"ordgroup",mode:this.mode,body:l},u.length===1&&u[0].type==="ordgroup"?i=u[0]:i={type:"ordgroup",mode:this.mode,body:u};let c;return r==="\\\\abovefrac"?c=this.callFunction(r,[s,t[n],i],[]):c=this.callFunction(r,[s,i],[]),[c]}else return t}handleSupSubscript(t){let n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();let s;do s=this.parseGroup(t);while(s.type&&s.type==="internal");if(!s)throw new T("Expected group after '"+r+"'",n);return s}formatUnsupportedCmd(t){let n=[];for(let i=0;i<t.length;i++)n.push({type:"textord",mode:"text",text:t[i]});let r={type:"text",mode:this.mode,body:n};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]}}parseAtom(t){let n=this.parseGroup("atom",t);if(n&&n.type==="internal"||this.mode==="text")return n;let r,s;for(;;){this.consumeSpaces();let i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(n&&n.type==="op"){let l=i.text==="\\limits";n.limits=l,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=i.text==="\\limits");else throw new T("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new T("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new T("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new T("Double superscript",i);let l={type:"textord",mode:this.mode,text:"\\prime"},u=[l];for(this.consume();this.fetch().text==="'";)u.push(l),this.consume();this.fetch().text==="^"&&u.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:u}}else if(un[i.text]){let l=Oo.test(i.text),u=[];for(u.push(new qe(un[i.text])),this.consume();;){let p=this.fetch().text;if(!un[p]||Oo.test(p)!==l)break;u.unshift(new qe(un[p])),this.consume()}let c=this.subparse(u);l?s={type:"ordgroup",mode:"math",body:c}:r={type:"ordgroup",mode:"math",body:c}}else break}if(r||s){if(n&&n.type==="multiscript"&&!n.postscripts)return n.postscripts={sup:r,sub:s},n;{let i=!n||n.type!=="op"&&n.type!=="operatorname"?void 0:An(this.nextToken.text);return{type:"supsub",mode:this.mode,base:n,sup:r,sub:s,isFollowedByDelimiter:i}}}else return n}parseFunction(t,n){let r=this.fetch(),s=r.text,i=Je[s];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new T("Got function '"+s+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!i.allowedInText)throw new T("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new T("Can't use function '"+s+"' in math mode",r);let l=this.prevAtomType,{args:u,optArgs:c}=this.parseArguments(s,i);return this.prevAtomType=l,this.callFunction(s,u,c,r,t)}callFunction(t,n,r,s,i){let l={funcName:t,parser:this,token:s,breakOnTokenText:i},u=Je[t];if(u&&u.handler)return u.handler(l,n,r);throw new T(`No function handler for ${t}`)}parseArguments(t,n){let r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};let s=[],i=[];for(let l=0;l<r;l++){let u=n.argTypes&&n.argTypes[l],c=l<n.numOptionalArgs;(n.primitive&&u==null||n.type==="sqrt"&&l===1&&i[0]==null)&&(u="primitive");let p=this.parseGroupOfType(`argument to '${t}'`,u,c);if(c)i.push(p);else if(p!=null)s.push(p);else throw new T("Null argument, please report this as a bug")}return{args:s,optArgs:i}}parseGroupOfType(t,n,r){switch(n){case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,n);case"hbox":{let s=this.parseArgumentGroup(r,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],scriptLevel:"text"}:null}case"raw":{let s=this.parseStringGroup("raw",r);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(r)throw new T("A primitive argument cannot be optional");let s=this.parseGroup(t);if(s==null)throw new T("Expected group as "+t,this.fetch());return s}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new T("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;;){let t=this.fetch().text;if(t===" "||t==="\xA0"||t==="\uFE0E")this.consume();else break}}parseStringGroup(t,n){let r=this.gullet.scanArgument(n);if(r==null)return null;let s="",i;for(;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),r.text=s,r}parseRegexGroup(t,n){let r=this.fetch(),s=r,i="",l;for(;(l=this.fetch()).text!=="EOF"&&t.test(i+l.text);)s=l,i+=s.text,this.consume();if(i==="")throw new T("Invalid "+n+": '"+r.text+"'",r);return r.range(s,i)}parseSizeGroup(t){let n,r=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",t),!n)return null;!t&&n.text.length===0&&(n.text="0pt",r=!0);let s=Pu.exec(n.text);if(!s)throw new T("Invalid size: '"+n.text+"'",n);let i={number:+(s[1]+s[2]),unit:s[3]};if(!zo(i))throw new T("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:r}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);let n=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;let r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return r=n.text.replace(/{\u2044}/g,"/"),{type:"url",mode:this.mode,url:r}}parseArgumentGroup(t,n){let r=this.gullet.scanArgument(t);if(r==null)return null;let s=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();let i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();let l={type:"ordgroup",mode:this.mode,loc:r.loc,body:i};return n&&this.switchMode(s),l}parseGroup(t,n){let r=this.fetch(),s=r.text;if(t==="argument to '\\left'")return this.parseSymbol();let i;if(s==="{"||s==="\\begingroup"||s==="\\toggle"){this.consume();let l=s==="{"?"}":s==="\\begingroup"?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();let u=this.parseExpression(!1,l),c=this.fetch();this.expect(l),this.gullet.endGroup(),i={type:c.text==="\\endtoggle"?"toggle":"ordgroup",mode:this.mode,loc:we.range(r,c),body:u,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&s[0]==="\\"&&!Object.prototype.hasOwnProperty.call(ci,s)){if(this.settings.throwOnError)throw new T("Unsupported function name: "+s,r);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(t){let n=t.length-1;for(let r=0;r<n;++r){let s=t[r],i=s.text;i==="-"&&t[r+1].text==="-"&&(r+1<n&&t[r+2].text==="-"?(t.splice(r,3,{type:"textord",mode:"text",loc:we.range(s,t[r+2]),text:"---"}),n-=2):(t.splice(r,2,{type:"textord",mode:"text",loc:we.range(s,t[r+1]),text:"--"}),n-=1)),(i==="'"||i==="`")&&t[r+1].text===i&&(t.splice(r,2,{type:"textord",mode:"text",loc:we.range(s,t[r+1]),text:i+i}),n-=1)}}parseSymbol(){let t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();let i=n.slice(5),l=i.charAt(0)==="*";if(l&&(i=i.slice(1)),i.length<2||i.charAt(0)!==i.slice(-1))throw new T(`\\verb assertion failed --
163
- 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(Mo,n[0])&&this.mode==="math"&&!K[this.mode][n[0]]){if(this.settings.strict&&this.mode==="math")throw new T(`Accented Unicode text character "${n[0]}" used in math mode`,t);n=Mo[n[0]]+n.slice(1)}let r=this.mode==="math"?qo.exec(n):null;r&&(n=n.substring(0,r.index),n==="i"?n="\u0131":n==="j"&&(n="\u0237"));let s;if(K[this.mode][n]){let i=K[this.mode][n].group;i==="bin"&&(Nu.includes(this.prevAtomType)||this.prevAtomType==="")&&(i="open");let l=we.range(t),u;if(Object.prototype.hasOwnProperty.call(gl,i)){let c=i;u={type:"atom",mode:this.mode,family:c,loc:l,text:n},(c==="rel"||c==="bin")&&this.prevAtomType==="text"&&zu.test(l.lexer.input.slice(l.end))&&(u.needsSpacing=!0)}else{if($o[n]){this.consume();let c=this.fetch().text.charCodeAt(0),p=c===65025?"mathscr":"mathcal";return(c===65024||c===65025)&&this.consume(),{type:"font",mode:"math",font:p,body:{type:"mathord",mode:"math",loc:l,text:$o[n]}}}u={type:i,mode:this.mode,loc:l,text:n}}s=u}else if(n.charCodeAt(0)>=128||qo.exec(n)){if(this.settings.strict&&this.mode==="math")throw new T(`Unicode text character "${n[0]}" used in math mode`,t);s={type:"textord",mode:"text",loc:we.range(t),text:n}}else return null;if(this.consume(),r)for(let i=0;i<r[0].length;i++){let l=r[0][i];if(!dr[l])throw new T(`Unknown accent ' ${l}'`,t);let u=dr[l][this.mode]||dr[l].text;if(!u)throw new T(`Accent ${l} unsupported in ${this.mode} mode`,t);s={type:"accent",mode:this.mode,loc:we.range(t),label:u,isStretchy:!1,base:s}}return s}},di=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let n,r;try{r=new Ot(e,t),delete r.gullet.macros.current["\\df@tag"],n=r.parse()}catch(s){if(s.toString()==="ParseError: Unmatched delimiter")t.wrapDelimiterPairs=!1,r=new Ot(e,t),delete r.gullet.macros.current["\\df@tag"],n=r.parse();else throw s}if(!(n.length>0&&n[0].type&&n[0].type==="array"&&n[0].addEqnNum)&&r.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new T("\\tag works only in display mode");r.gullet.feed("\\df@tag"),n=[{type:"tag",mode:"text",body:n,tag:r.parse()}]}return n},Fu=[2,2,3,3],Tr=class e{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){let n={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(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return new e(n)}withLevel(t){return this.extend({level:t})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:Fu[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}},Gu="0.13.02";function pi(e){let t={},n=0,r=document.getElementsByClassName("tml-eqn");for(let l of r)for(n+=1,l.setAttribute("id","tml-eqn-"+String(n));l.tagName!=="mtable";)if(l.getElementsByClassName("tml-label").length>0){let c=l.attributes.id.value;t[c]=String(n);break}else l=l.parentElement;let s=document.getElementsByClassName("tml-tageqn");for(let l of s)if(l.getElementsByClassName("tml-label").length>0){let c=l.getElementsByClassName("tml-tag");if(c.length>0){let p=l.attributes.id.value;t[p]=c[0].textContent}}[...e.getElementsByClassName("tml-ref")].forEach(l=>{let u=l.getAttribute("href"),c=t[u.slice(1)];l.className.indexOf("tml-eqref")===-1?(c=c.replace(/^\(/,""),c=c.replace(/\)$/,"")):(c.charAt(0)!=="("&&(c="("+c),c.slice(-1)!==")"&&(c=c+")"));let p=document.createElementNS("http://www.w3.org/1998/Math/MathML","mtext");p.appendChild(document.createTextNode(c));let x=document.createElementNS("http://www.w3.org/1998/Math/MathML","math");x.appendChild(p),l.textContent="",l.appendChild(x)})}var Hu=function(e,t,n){let r=n,s=0,i=e.length;for(;r<t.length;){let l=t[r];if(s<=0&&t.slice(r,r+i)===e)return r;l==="\\"?r++:l==="{"?s++:l==="}"&&s--,r++}return-1},Uu=function(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},ju=/^\\(?:begin|(?:eq)?ref){/,Wu=function(e,t){let n,r=[],s=new RegExp("("+t.map(i=>Uu(i.left)).join("|")+")");for(;n=e.search(s),n!==-1;){n>0&&(r.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));let i=t.findIndex(c=>e.startsWith(c.left));if(n=Hu(t[i].right,e,t[i].left.length),n===-1)break;let l=e.slice(0,n+t[i].right.length),u=ju.test(l)?l:e.slice(t[i].left.length,n);r.push({type:"math",data:u,rawData:l,display:t[i].display}),e=e.slice(n+t[i].right.length)}return e!==""&&r.push({type:"text",data:e}),r},hi=[{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}],cn={$:[{left:"$$",right:"$$",display:!0},{left:"$`",right:"`$",display:!1},{left:"$",right:"$",display:!1}],"(":[{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]},pr=[{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}],Vu=e=>e==="$"||e==="("?cn[e]:e==="$+"||e==="(+"?cn[e.slice(0,1)].concat(pr):e==="ams"?pr:e==="all"?cn["("].concat(cn.$).concat(pr):hi,Zu=function(e,t){let n=Wu(e,t.delimiters);if(n.length===1&&n[0].type==="text")return null;let r=document.createDocumentFragment();for(let s=0;s<n.length;s++)if(n[s].type==="text")r.appendChild(document.createTextNode(n[s].data));else{let i=document.createElement("span"),l=n[s].data;t.displayMode=n[s].display;try{t.preProcess&&(l=t.preProcess(l)),temml.render(l,i,t)}catch(u){if(!(u instanceof T))throw u;t.errorCallback("Temml auto-render: Failed to parse `"+n[s].data+"` with ",u),r.appendChild(document.createTextNode(n[s].rawData));continue}r.appendChild(i)}return r},mi=function(e,t){for(let n=0;n<e.childNodes.length;n++){let r=e.childNodes[n];if(r.nodeType===3){let s=Zu(r.textContent,t);s&&(n+=s.childNodes.length-1,e.replaceChild(s,r))}else if(r.nodeType===1){let s=" "+r.className+" ";t.ignoredTags.indexOf(r.nodeName.toLowerCase())===-1&&t.ignoredClasses.every(l=>s.indexOf(" "+l+" ")===-1)&&mi(r,t)}}},Xu=function(e,t){if(!e)throw new Error("No element provided to render");let n={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);n.fences?n.delimiters=Vu(n.fences):n.delimiters=n.delimiters||hi,n.ignoredTags=n.ignoredTags||["script","noscript","style","textarea","pre","code","option"],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},mi(e,n),pi(e)},fi=function(e,t,n={}){t.textContent="";let r=t.tagName.toLowerCase()==="math";r&&(n.wrap="none");let s=Mr(e,n);r?(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."),fi=function(){throw new T("Temml doesn't work in quirks mode.")});var Yu=function(e,t){return Mr(e,t).toMarkup()},Ku=function(e,t){let n=new Ct(t);return di(e,n)},Qu=function(e,t){let n=new Ct(t);if(n.macros={},!(typeof e=="string"||e instanceof String))throw new TypeError("Temml can only parse string typed expression");let r=new Ot(e,n,!0);return delete r.gullet.macros.current["\\df@tag"],r.parse()},Ju=function(e,t,n){if(n.throwOnError||!(e instanceof T))throw e;let r=new hn(["temml-error"],[new hl(t+`
164
-
165
- `+e.toString())]);return r.style.color=n.errorColor,r.style.whiteSpace="pre-line",r},Mr=function(e,t){let n=new Ct(t);try{let r=di(e,n),s=new Tr({level:n.displayMode?X.DISPLAY:X.TEXT,maxSize:n.maxSize});return Tl(r,e,s,n)}catch(r){return Ju(r,e,n)}},gi={version:Gu,render:fi,renderToString:Yu,renderMathInElement:Xu,postProcess:pi,ParseError:T,definePreamble:Qu,__parse:Ku,__renderToMathMLTree:Mr,__defineSymbol:o,__defineMacro:d};var bi=/^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n$]))\1(?=[\s?!.,:?!。,:]|$)/,ec=/^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;function tc(e){let t=/^( {0,3})(`{3,}|~{3,})/.exec(e);return t?{char:t[2][0],len:t[2].length}:null}function nc(e,t){let n=t.char==="`"?"`":"~",r=new RegExp(`^ {0,3}(${n}{3,})\\s*$`).exec(e);return r?r[1].length>=t.len:!1}function yi(e){let t=null,n=null,r=0;for(;r<=e.length;){let s=e.indexOf(`
166
- `,r),i=s!==-1,l=i?s:e.length,u=e.slice(r,l);if(n)nc(u,n)&&(n=null);else{let c=tc(u);c?n=c:u==="$$"&&(t===null?t=r:t=null)}if(!i)break;r=s+1}return t}function xi(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function wi(e){let t;try{t=gi.renderToString(e.text,{displayMode:e.displayMode,throwOnError:!0})}catch(n){let r=n instanceof Error?n.message:String(n),s=xi(e.raw),l=`<span class="math-error" title="${xi(`LaTeX parse error: ${r}`)}">${s}</span>`;return e.displayMode?`<div class="math-block">${l}</div>`:l}return e.displayMode?`<div class="math-block">${t}</div>`:`<span class="math-inline">${t}</span>`}var rc={name:"inlineMath",level:"inline",start(e){let r=0,s=e.length;for(;r<s;){let i=e.indexOf("$",r);if(i===-1)return;if((i===0||e.charCodeAt(i-1)===32)&&bi.test(e.slice(i,Math.min(s,i+256))))return i;let u=i+1;for(;u<s&&e.charCodeAt(u)===36;)u++;r=u}},tokenizer(e){let t=bi.exec(e);if(t)return{type:"inlineMath",raw:t[0],text:t[2].trim(),displayMode:t[1].length===2}},renderer:wi},sc={name:"blockMath",level:"block",tokenizer(e){let t=ec.exec(e);if(t)return{type:"blockMath",raw:t[0],text:t[2].trim(),displayMode:t[1].length===2}},renderer:e=>wi(e)+`
167
- `};N.use({extensions:[rc,sc]});N.setOptions({breaks:!0,gfm:!0});function ke(e){let t=document.createElement("div");return t.textContent=e,t.innerHTML}var Ir=new WeakMap;function Ai(){return{lex:0,parse:0,sanitize:0,dom:0,blocks:0,hits:0,misses:0,lexPrefix:0,lexTail:0,prefixBlocks:0,prefixLen:0,tailLen:0,mathRelex:!1,mathRelexLen:0,tailBlocks:0,tailRawBlocks:0,fastPath:0,defsAbsorbed:0,linkMemoSize:0,seq:0,missDetails:[],subList:{hits:0,misses:0},subTable:{hits:0,misses:0}}}var Ti=Ai();function oc(){return Ti}function ki(e,t,n){if(!(typeof performance>"u"||typeof performance.measure!="function"))try{performance.measure(e,{start:t,end:n})}catch{}}var ic=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Pt(e){for(let t of Array.from(e.childNodes))t.nodeType===3&&/^\s*$/.test(t.nodeValue??"")&&t.parentNode?.removeChild(t)}function zt(e){return eo.sanitize(e,{USE_PROFILES:{html:!0,mathMl:!0},RETURN_DOM_FRAGMENT:!0})}function ac(e,t){let n=new ye(N.defaults);for(let b of Object.keys(t))n.tokens.links[b]=t[b];let r=n.lex(e),s=n.tokens.links,i=[],l="",u=null,c=[],p=[],x=/<([a-zA-Z][\w-]*)(?:\s[^>]*)?>/g,g=/<\/([a-zA-Z][\w-]*)\s*>/g;for(let b of r){let v=b.raw??"",_=b.type??"?";if(u??=_,l+=v,c.push(b),_==="paragraph"||_==="html"){x.lastIndex=0;let O;for(;O=x.exec(v);){let R=O[1].toLowerCase();ic.has(R)||p.push(R)}for(g.lastIndex=0;O=g.exec(v);){let R=O[1].toLowerCase(),C=p.lastIndexOf(R);C>=0&&p.splice(C,1)}}p.length===0&&(c.links=s,i.push({raw:l,type:u,tokens:c}),l="",u=null,c=[])}return l&&(c.links=s,i.push({raw:l,type:u??"?",tokens:c})),{blocks:i,rawCount:r.length}}function lc(e,t,n,r,s){let i=s(),l=0,u=0;for(let M of e)if(n.startsWith(M,l))l+=M.length,u++;else break;u>0&&(u--,l-=e[u].length),u>0&&t[u-1]==="list"&&(u--,l-=e[u].length);let c=yi(n.slice(0,l)),p=!1,x=0;if(c!==null){l=0,u=0;for(let M of e){if(l+M.length>c)break;l+=M.length,u++}p=!0,x=n.length-l}let g=s(),b=l===0?n:n.slice(l),v=s(),_=b?ac(b,r):{blocks:[],rawCount:0},O=_.blocks,R=s(),C=0;for(let M=0;M<O.length-1;M++){let B=O[M];if(B.type!=="def")continue;let j=B.tokens[0];j.tag in r||(r[j.tag]={href:j.href,title:j.title},C++)}let L=[];for(let M=0;M<u;M++)L.push({raw:e[M],type:null,tokens:null});for(let M of O)L.push({raw:M.raw,type:M.type,tokens:M.tokens});return{blocks:L,prefixMs:g-i,tailMs:R-v,prefixBlockCount:u,prefixLen:l,tailLen:b.length,mathRelex:p,mathRelexLen:x,tailBlockCount:O.length,tailRawBlockCount:_.rawCount,defsAbsorbed:C}}function Tn(e,t,n,r,s,i,l,u){let{raw:c,type:p,tokens:x}=t;if(!u&&x?.length===1){let Ee=x[0];if(Ee.type==="list")return dc(e,Ee,n,r,s,i,l);if(Ee.type==="table")return mc(e,Ee,n,r,s,i,l)}let g=l(),b;!u&&x?.length===1?(i.fastPath++,b=N.parser(x,{...N.defaults,async:!1})):b=N.parse(c,{async:!1});let _=l()-g;if(i.parse+=_,typeof b!="string")throw new Error("updateMarkdownStream requires sync marked (>= 5.0); marked.parse returned a non-string (likely a Promise)");let O=l(),R=zt(b),L=l()-O;i.sanitize+=L;let M=l();Pt(R);let B=R.children.length;for(let Ee=0;Ee<r;Ee++){let We=e.children.item(n);We&&e.removeChild(We)}let j=e.children.item(n);e.insertBefore(R,j);let Ne=l()-M;return i.dom+=Ne,i.missDetails.push({type:p??"?",len:c.length,snip:c.slice(0,40).replace(/\n/g,"\u21B5"),parseMs:_,sanMs:L,domMs:Ne,path:u??"general"}),{newCount:B,newSubMemo:null}}function uc(e){return e.replace(/[\r\n]+$/,"")}function cc(e,t,n){let r={...e,items:[t]},s=n(),i=N.parser([r],{...N.defaults,async:!1}),l=n();if(typeof i!="string")throw new Error("renderOneListItem: marked.parser returned non-string (async mode leaked?)");let u=n(),c=zt(i),p=n(),x=n();Pt(c);let b=c.firstElementChild?.firstElementChild??null,v=n();return{newLi:b,parseMs:l-s,sanMs:p-u,domMs:v-x}}function dc(e,t,n,r,s,i,l){let u=t.items,c=t.start===""?1:t.start,p=t.loose?"1":"0",x=t.ordered?`ol:start=${c}:loose=${p}`:`ul:loose=${p}`,g,b;if(s!==null&&s.type==="list"&&s.variant===x&&s.containerEl.parentNode===e)g=s.containerEl,b=s.subCache;else{let C=N.parser([{...t,items:[]}],{...N.defaults,async:!1}),L=zt(C);Pt(L);let M=L.firstElementChild;if(!M)return Tn(e,{raw:t.raw,type:t.type,tokens:null},n,r,null,i,l,"slowFallback");for(let j=0;j<r;j++){let W=e.children.item(n);W&&e.removeChild(W)}let B=e.children.item(n);e.insertBefore(M,B),g=M,b=[]}let _=0,O=0,R=0;for(let C=0;C<u.length;C++){let L=uc(u[C].raw);if(b[C]===L&&g.children.item(C)){i.subList.hits++;continue}i.subList.misses++;let M=cc(t,u[C],l);if(_+=M.parseMs,O+=M.sanMs,R+=M.domMs,!M.newLi)continue;let B=g.children.item(C);B?g.replaceChild(M.newLi,B):g.appendChild(M.newLi),b[C]=L}for(;g.children.length>u.length;)g.lastElementChild&&g.removeChild(g.lastElementChild);for(;b.length>u.length;)b.pop();return i.parse+=_,i.sanitize+=O,i.dom+=R,i.missDetails.push({type:"list",len:t.raw.length,snip:t.raw.slice(0,40).replace(/\n/g,"\u21B5"),parseMs:_,sanMs:O,domMs:R,path:"list",items:u.length}),{newCount:1,newSubMemo:{type:"list",variant:x,containerEl:g,subCache:b}}}function vi(e){return e.map(t=>t.text).join("")}function pc(e){let t=vi(e.header),n=e.align.map(r=>r??"").join(",");return`table:h=${t}|a=${n}`}function hc(e,t,n){let r={...e,rows:[t]},s=n(),i=N.parser([r],{...N.defaults,async:!1}),l=n();if(typeof i!="string")throw new Error("renderOneTableRow: marked.parser returned non-string (async mode leaked?)");let u=n(),c=zt(i),p=n(),x=n();Pt(c);let v=c.firstElementChild?.querySelector("tbody")?.firstElementChild??null,_=n();return{newTr:v,parseMs:l-s,sanMs:p-u,domMs:_-x}}function mc(e,t,n,r,s,i,l){let u=t.rows,c=pc(t),p,x,g;if(s!==null&&s.type==="table"&&s.variant===c&&s.containerEl.parentNode===e){p=s.containerEl;let R=p.querySelector("tbody");if(!R)return Tn(e,{raw:t.raw,type:t.type,tokens:null},n,r,null,i,l,"slowFallback");x=R,g=s.subCache}else{let R=l(),C=N.parser([{...t,rows:[]}],{...N.defaults,async:!1}),L=l();i.parse+=L-R;let M=l(),B=zt(C),j=l();i.sanitize+=j-M,Pt(B);let W=B.firstElementChild;if(!W)return Tn(e,{raw:t.raw,type:t.type,tokens:null},n,r,null,i,l,"slowFallback");let Ne=W.querySelector("tbody");Ne||(Ne=W.ownerDocument.createElement("tbody"),W.appendChild(Ne));for(let We=0;We<r;We++){let Gt=e.children.item(n);Gt&&e.removeChild(Gt)}let Ee=e.children.item(n);e.insertBefore(W,Ee),p=W,x=Ne,g=[]}let v=0,_=0,O=0;for(let R=0;R<u.length;R++){let C=vi(u[R]);if(g[R]===C&&x.children.item(R)){i.subTable.hits++;continue}i.subTable.misses++;let L=hc(t,u[R],l);if(v+=L.parseMs,_+=L.sanMs,O+=L.domMs,!L.newTr)continue;let M=x.children.item(R);M?x.replaceChild(L.newTr,M):x.appendChild(L.newTr),g[R]=C}for(;x.children.length>u.length;)x.lastElementChild&&x.removeChild(x.lastElementChild);for(;g.length>u.length;)g.pop();return i.parse+=v,i.sanitize+=_,i.dom+=O,i.missDetails.push({type:"table",len:t.raw.length,snip:t.raw.slice(0,40).replace(/\n/g,"\u21B5"),parseMs:v,sanMs:_,domMs:O,path:"table",items:u.length}),{newCount:1,newSubMemo:{type:"table",variant:c,containerEl:p,subCache:g}}}function Si(e,t){let r=Ir.get(e),s=Ai(),i=typeof performance<"u"&&typeof performance.now=="function"?()=>performance.now():()=>Date.now(),l=i();r||(r={cache:[],cacheTypes:[],rootCounts:[],subMemos:[],links:{},callCount:0},Ir.set(e,r)),r.callCount++,s.seq=r.callCount;let{cache:u,cacheTypes:c,rootCounts:p,subMemos:x}=r,g=i(),b=lc(u,c,t,r.links,i),v=i();s.lex=v-g,s.lexPrefix=b.prefixMs,s.lexTail=b.tailMs,s.prefixBlocks=b.prefixBlockCount,s.prefixLen=b.prefixLen,s.tailLen=b.tailLen,s.mathRelex=b.mathRelex,s.mathRelexLen=b.mathRelexLen,s.tailBlocks=b.tailBlockCount,s.tailRawBlocks=b.tailRawBlockCount,s.defsAbsorbed=b.defsAbsorbed;let _=b.blocks;s.blocks=_.length,ki("mdstream.lex",g,v);let O=0;for(let R=0;R<_.length;R++){let C=_[R],L=C.raw,M=p[R]??0;if(u[R]===L){O+=M,s.hits++;continue}s.misses++;let{newCount:B,newSubMemo:j}=Tn(e,C,O,M,x[R]??null,s,i);u[R]=L,c[R]=C.type,p[R]=B,x[R]=j,O+=B}for(;u.length>_.length;){let R=p.pop()??0;u.pop(),c.pop(),x.pop();for(let C=0;C<R;C++)e.lastElementChild&&e.removeChild(e.lastElementChild)}s.linkMemoSize=Object.keys(r.links).length,Ti=s,ki("mdstream.total",l,i())}function fc(e){Ir.delete(e)}var gc={file:"diff-file",hunk:"diff-hunk",add:"diff-add",del:"diff-del",context:null};function bc(e){let t=ws(e);return t?t.map(n=>{let r=gc[n.kind];return r?`<span class="${r}">${ke(n.text)}</span>`:ke(n.text)}).join(`
168
- `):null}var xc=["user_message","assistant_message","thinking","tool_call","tool_call_update","plan","permission_request","permission_response","bash_command","bash_result"];function vd(e){return xc.includes(e)}function Sd(e,t,n){switch(e){case"user_message":return yc(t,n);case"assistant_message":return Ac(t,n);case"thinking":return Tc(t);case"tool_call":return vc(t);case"tool_call_update":return Sc(t,n),null;case"plan":return _c(t);case"permission_request":return Ec(t,n);case"permission_response":return Cc(t,n),null;case"bash_command":return Dc(t);case"bash_result":return Lc(t,n),null;default:return e}}function yc(e,t){let n=typeof e.text=="string"?e.text:"",r=document.createElement("div");r.className="msg user",r.innerHTML=ke(n).replace(/\n/g,"<br>");let s=Array.isArray(e.attachments)?e.attachments:[];for(let i of s){if(!i||typeof i!="object")continue;let l=i,u=typeof l.displayName=="string"?l.displayName:"file",c=l.kind==="image"?"image":"file",p=typeof l.path=="string"?l.path:"",x=p?t.rewriteAttachmentSrc?t.rewriteAttachmentSrc(p):p:"";if(c==="image"&&x){let g=document.createElement("img");g.className="user-image",g.src=x,g.alt=u;let b=wc(l.width,l.height);b&&(g.width=b.width,g.height=b.height),r.appendChild(g)}else if(c==="file"&&x){let g=document.createElement("a");g.className="user-file",g.href=x,g.target="_blank",g.rel="noopener",g.download=u,g.textContent=u,r.appendChild(g)}else{let g=document.createElement("div");g.className="user-attachment",g.textContent=`[${c}: ${u}]`,r.appendChild(g)}}return r}function wc(e,t){if(typeof e!="number"||typeof t!="number"||!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)return null;let n=kc(),r=Math.min(n.width/e,n.height/t,1);return{width:Math.max(1,Math.round(e*r)),height:Math.max(1,Math.round(t*r))}}function kc(){let e=document.defaultView?.getComputedStyle(document.documentElement);return e?{width:_i(e,"--user-image-max-width",200),height:_i(e,"--user-image-max-height",150)}:{width:200,height:150}}function _i(e,t,n){let r=e.getPropertyValue(t).trim();if(!r.endsWith("px"))return n;let s=Number(r.slice(0,-2));return Number.isFinite(s)&&s>0?s:n}function Ac(e,t){let n=typeof e.text=="string"?e.text:"",r=document.createElement("div");return r.className="msg assistant",r.setAttribute("data-raw",n),Si(r,n),t.enhanceMarkdown?.(r),r}function Tc(e){let t=typeof e.text=="string"?e.text:"",n=document.createElement("details");return n.className="thinking",n.setAttribute("data-raw",t),n.innerHTML=`<summary>\u283F thought</summary><div class="thinking-content">${ke(t)}</div>`,n}function vc(e){let t=typeof e.id=="string"?e.id:"",n=typeof e.kind=="string"?e.kind:"",r=typeof e.title=="string"?e.title:"",s=e.rawInput,i=hs(n,r,s),l=document.createElement("div");l.className="tool-call",l.id=`tc-${t}`,l.dataset.kind=n;let u=`<span class="icon">${i.icon}</span> ${ke(i.title)}`;if(i.detail&&(u+=`<span class="tc-detail">${i.detailPrefix??""}${ke(i.detail)}</span>`),l.innerHTML=u,i.showDiff){let p=bc(s);if(p){let x=document.createElement("details");x.innerHTML=`<summary>diff</summary><div class="diff-view">${p}</div>`,l.appendChild(x)}}let c=l.querySelector(".tc-detail");return c&&l.addEventListener("click",p=>{p.target.closest("details")||c.classList.toggle("expanded")}),l}function Sc(e,t){let n=typeof e.id=="string"?e.id:"",r=t.findToolCallEl(n);if(!r)return;let s=typeof e.status=="string"?e.status:"pending",i=fs(s);r.className=i.className;let l=r.querySelector(".icon");l&&(l.textContent=i.icon);let u=Array.isArray(e.content)?e.content:[];if(!u.length)return;let c=ms(u);if(c)if(r.dataset.kind==="task_complete"){let p=r.querySelector(".tc-summary");p||(p=document.createElement("div"),p.className="tc-summary",r.appendChild(p)),p.textContent=c}else{let p=r.querySelector(".tc-output .tc-content");if(!p){let x=document.createElement("details");x.className="tc-output",x.innerHTML='<summary>output</summary><div class="tc-content"></div>',r.appendChild(x),p=x.querySelector(".tc-content")}p&&(p.textContent=c)}}function _c(e){let t=Array.isArray(e.entries)?e.entries:[],n=xs(t),r=ys(t),s=r.map(u=>`${u.symbol} ${u.count}`).join(" "),i=r.map(u=>`${u.count} ${u.label}`).join(", "),l=document.createElement("details");return l.className="plan",l.open=!0,l.innerHTML=`<summary class="plan-summary"><span class="plan-label">plan</span><span class="plan-counts">${ke(s)}</span></summary><div class="plan-entries">${n.map(u=>`<div class="plan-entry">${u.symbol} ${ke(u.content)}</div>`).join("")}</div>`,l.querySelector(".plan-summary")?.setAttribute("aria-label",i?`plan: ${i}`:"plan"),l}function Ec(e,t){let n=typeof e.requestId=="string"?e.requestId:"",r=typeof e.title=="string"?e.title:"",s=document.createElement("div");s.className="permission",s.dataset.requestId=n,s.dataset.title=r;let i=t.isPermissionResolved?.(n)??!1,l=i?"title dim":"title";if(s.innerHTML=`<span class="${l}">\u26BF ${ke(r)}</span> `,!i){let u=Array.isArray(e.options)?e.options:[];for(let c of u){let p=document.createElement("button"),x=gs(c.kind??"");p.className=x.cssClass,p.textContent=c.name,p.dataset.optionId=c.optionId,p.dataset.optionKind=c.kind??"",s.appendChild(p)}}return s}function Cc(e,t){let n=typeof e.requestId=="string"?e.requestId:"",r=t.findPermissionEl(n);if(!r)return;let s=r.dataset.title,i=s?`\u26BF ${s}`:"\u26BF",l=bs(typeof e.optionName=="string"?e.optionName:void 0,typeof e.denied=="boolean"?e.denied:void 0);r.innerHTML=`<span class="dim">${ke(i)} \u2014 ${ke(l)}</span>`}function Dc(e){let t=typeof e.command=="string"?e.command:"",n=document.createElement("div");return n.className="bash-block",n.innerHTML=`<span class="bash-cmd">${ke(t)}</span><div class="bash-output"></div>`,n.querySelector(".bash-cmd").addEventListener("click",()=>{let r=n.querySelector(".bash-output");r.style.display==="none"?r.style.display="block":r.classList.contains("has-content")&&(r.style.display="none")}),n}function Lc(e,t){let n=t.findBashEl();if(!n)return;let r=typeof e.output=="string"?e.output:"";if(r){let c=n.querySelector(".bash-output");c&&(c.textContent=r,c.classList.add("has-content"))}let s=n.querySelector(".bash-cmd");s&&s.classList.remove("running");let i=typeof e.code=="number"?e.code:null,l=typeof e.signal=="string"?e.signal:null,u="";if(l?u=`[signal: ${l}]`:i!==0&&i!=null&&(u=`[exit: ${i}]`),u&&s){let c=document.createElement("span");c.className=`bash-exit ${i===0?"ok":"fail"}`,c.textContent=u,s.after(c)}}var vn="theme",Rc="wa_log_level",qc="webagent_notify_tip_shown",Oc="webagent_notify_tip_denied_shown",$c=new Set([vn,Rc,qc,Oc]);function Mc(e){return e===us?!1:$c.has(e)?!0:e.startsWith("wa_")||e.startsWith("webagent_")}function Ic(){let e=[];for(let t=localStorage.length-1;t>=0;t--){let n=localStorage.key(t);!n||!Mc(n)||(localStorage.removeItem(n),e.push(n))}return e}async function Bc(){if(typeof navigator>"u"||!("serviceWorker"in navigator)||typeof navigator.serviceWorker.getRegistrations!="function")return 0;let e=await navigator.serviceWorker.getRegistrations();return await Promise.all(e.map(t=>t.unregister())),e.length}async function Nc(){if(typeof caches>"u")return[];let e=await caches.keys();return await Promise.all(e.map(t=>caches.delete(t))),e}async function Cd(){let e={localStorageKeys:[],serviceWorkers:0,caches:[],errors:[]};try{e.localStorageKeys=Ic()}catch(t){e.errors.push(`localStorage: ${Br(t)}`)}try{e.serviceWorkers=await Bc()}catch(t){e.errors.push(`serviceWorker: ${Br(t)}`)}try{e.caches=await Nc()}catch(t){e.errors.push(`cache: ${Br(t)}`)}return e}function Br(e){return e instanceof Error?e.message:String(e)}var Pc={auto:"\u25D1",light:"\u2600",dark:"\u263E"},Ei=["auto","light","dark"];function Di(){return localStorage.getItem(vn)??"auto"}var Li=[];function Rd(e){Li.push(e)}function Ri(e){document.documentElement.setAttribute("data-theme",e);let t=document.getElementById("theme-btn");t&&(t.textContent=Pc[e],t.title=`Theme: ${e}`),localStorage.setItem(vn,e);for(let n of Li)n()}var Ci=document.getElementById("theme-btn");Ci&&Ci.addEventListener("click",()=>{let e=Di(),t=Ei[(Ei.indexOf(e)+1)%3];Ri(t)});Ri(Di());var Ge=document.createElement("div");Ge.id="lightbox-overlay";var Ft=document.createElement("img");Ge.appendChild(Ft);document.body.appendChild(Ge);var Sn=1,zc=.5,Fc=5;function Gc(){return Ge.classList.contains("active")}function Hc(e){Ft.src=e,Sn=1,Ft.style.transform="",Ge.classList.add("active")}function qi(){Ge.classList.remove("active"),Ft.src=""}document.getElementById("messages").addEventListener("click",e=>{let t=e.target;t.tagName==="IMG"&&t.classList.contains("user-image")&&Hc(t.src)});Ge.addEventListener("click",e=>{e.target===Ge&&qi()});document.addEventListener("keydown",e=>{e.key==="Escape"&&Gc()&&qi()});Ge.addEventListener("wheel",e=>{e.preventDefault();let t=e.deltaY>0?-.15:.15;Sn=Math.min(Fc,Math.max(zc,Sn+t)),Ft.style.transform=`scale(${Sn})`},{passive:!1});export{Uc as a,jc as b,Wc as c,gs as d,Yc as e,Kc as f,ke as g,oc as h,Si as i,fc as j,vd as k,Sd as l,Rc as m,qc as n,Oc as o,Cd as p,Rd as q};
169
- /*! Bundled license information:
170
-
171
- dompurify/dist/purify.es.mjs:
172
- (*! @license DOMPurify 3.4.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.1/LICENSE *)
173
- */