/** MathLive 0.109.0 */ (function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MathLive = {}));})(this, (function (exports) { 'use strict'; var MathLive=(()=>{var Vo=Object.defineProperty,Hh=Object.defineProperties,Wh=Object.getOwnPropertyDescriptor,Uh=Object.getOwnPropertyDescriptors,jh=Object.getOwnPropertyNames,$o=Object.getOwnPropertySymbols;var Ys=Object.prototype.hasOwnProperty,su=Object.prototype.propertyIsEnumerable;var au=(t,e,r)=>e in t?Vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,p=(t,e)=>{for(var r in e||(e={}))Ys.call(e,r)&&au(t,r,e[r]);if($o)for(var r of $o(e))su.call(e,r)&&au(t,r,e[r]);return t},g=(t,e)=>Hh(t,Uh(e));var Qs=t=>typeof t=="symbol"?t:t+"",Ai=(t,e)=>{var r={};for(var i in t)Ys.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&$o)for(var i of $o(t))e.indexOf(i)<0&&su.call(t,i)&&(r[i]=t[i]);return r};var Jh=(t,e)=>{for(var r in e)Vo(t,r,{get:e[r],enumerable:!0})},Gh=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of jh(e))!Ys.call(t,n)&&n!==r&&Vo(t,n,{get:()=>e[n],enumerable:!(i=Wh(e,n))||i.enumerable});return t};var Xh=t=>Gh(Vo({},"__esModule",{value:!0}),t);var Oy={};Jh(Oy,{MathDivElement:()=>No,MathSpanElement:()=>zo,MathfieldElement:()=>at,_renderMathInElement:()=>iu,convertAsciiMathToLatex:()=>Hc,convertLatexToAsciiMath:()=>Jb,convertLatexToMarkup:()=>he,convertLatexToMathMl:()=>Do,convertLatexToSpeakableText:()=>Oo,convertMathJsonToLatex:()=>Bo,globalMathLive:()=>Lt,initVirtualKeyboardInCurrentBrowsingContext:()=>bo,renderMathInDocument:()=>Ey,renderMathInElement:()=>Gs,setKeyboardLayout:()=>ku,setKeyboardLayoutLocale:()=>Lu,validateLatex:()=>jb,version:()=>Dy});function ke(){return"window"in globalThis&&"document"in globalThis}function qo(){return"matchMedia"in window?window.matchMedia("(pointer: coarse)").matches:"ontouchstart"in window||navigator.maxTouchPoints>0}function lu(){try{return window.self!==window.top}catch(t){return!0}}function Ho(){return typeof navigator.vibrate=="function"}function Ct(){var e,r;if(!ke())return"other";let t=(r=(e=navigator.userAgentData)==null?void 0:e.platform)!=null?r:navigator.platform;return/^mac/i.test(t)?navigator.maxTouchPoints===5?"ios":"macos":/^win/i.test(t)?"windows":/android/i.test(navigator.userAgent)?"android":/iphone|ipod|ipad/i.test(navigator.userAgent)?"ios":/\bcros\b/i.test(navigator.userAgent)?"chromeos":"other"}function cu(){if(!ke())return!0;if(/firefox/i.test(navigator.userAgent)){let t=navigator.userAgent.match(/firefox\/(\d+)/i);return t?parseInt(t[1])>=78:!1}if(/trident/i.test(navigator.userAgent))return!1;if(/edge/i.test(navigator.userAgent)){let t=navigator.userAgent.match(/edg\/(\d+)/i);return t?parseInt(t[1])>=79:!1}return!0}function el(){return HTMLElement.prototype.hasOwnProperty("popover")}var uu={id:"dvorak",locale:"en",displayName:"Dvorak",virtualLayout:"dvorak",platform:"",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["x","X","\u2248","\u02DB"],KeyC:["j","J","\u2206","\xD4"],KeyD:["e","E","\xB4","\xB4"],KeyE:[".",">","\u2265","\u02D8"],KeyF:["u","U","\xA8","\xA8"],KeyG:["i","I","\u02C6","\u02C6"],KeyH:["d","D","\u2202","\xCE"],KeyI:["c","C","\xE7","\xC7"],KeyJ:["h","H","\u02D9","\xD3"],KeyK:["t","T","\u2020","\u02C7"],KeyL:["n","N","\u02DC","\u02DC"],KeyM:["m","M","\xB5","\xC2"],KeyN:["b","B","\u222B","\u0131"],KeyO:["r","R","\xAE","\u2030"],KeyP:["l","L","\xAC","\xD2"],KeyQ:["'",'"',"\xE6","\xC6"],KeyR:["p","P","\u03C0","\u220F"],KeyS:["o","O","\xF8","\xD8"],KeyT:["y","Y","\xA5","\xC1"],KeyU:["g","G","\xA9","\u02DD"],KeyV:["k","K","\u02DA","\uF8FF"],KeyW:[",","<","\u2264","\xAF"],KeyX:["q","Q","\u0153","\u0152"],KeyY:["f","F","\u0192","\xCF"],KeyZ:[";",":","\u2026","\xDA"],Digit1:["1","!","\xA1","\u2044"],Digit2:["2","@","\u2122","\u20AC"],Digit3:["3","#","\xA3","\u2039"],Digit4:["4","$","\xA2","\u203A"],Digit5:["5","%","\u221E","\uFB01"],Digit6:["6","^","\xA7","\uFB02"],Digit7:["7","&","\xB6","\u2021"],Digit8:["8","*","\u2022","\xB0"],Digit9:["9","(","\xAA","\xB7"],Digit0:["0",")","\xBA","\u201A"],Space:[" "," "," "," "],Minus:["[","{","\u201C","\u201D"],Equal:["]","}","\u2018","\u2019"],BracketLeft:["/","?","\xF7","\xBF"],BracketRight:["=","+","\u2260","\xB1"],Backslash:["\\","|","\xAB","\xBB"],Semicolon:["s","S","\xDF","\xCD"],Quote:["-","_","\u2013","\u2014"],Backquote:["`","~","`","`"],Comma:["w","W","\u2211","\u201E"],Period:["v","V","\u221A","\u25CA"],Slash:["z","Z","\u03A9","\xB8"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[".",".",".","."],IntlBackslash:["\xA7","\xB1","\xA7","\xB1"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}};var Wo={id:"apple.en-intl",displayName:"English (international)",virtualLayout:"qwerty",platform:"apple",locale:"en",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\u222B","\u0131"],KeyC:["c","C","\xE7","\xC7"],KeyD:["d","D","\u2202","\xCE"],KeyE:["e","E","\xB4","\xB4"],KeyF:["f","F","\u0192","\xCF"],KeyG:["g","G","\xA9","\u02DD"],KeyH:["h","H","\u02D9","\xD3"],KeyI:["i","I","\u02C6","\u02C6"],KeyJ:["j","J","\u2206","\xD4"],KeyK:["k","K","\u02DA","\uF8FF"],KeyL:["l","L","\xAC","\xD2"],KeyM:["m","M","\xB5","\xC2"],KeyN:["n","N","\u02DC","\u02DC"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\u0153","\u0152"],KeyR:["r","R","\xAE","\u2030"],KeyS:["s","S","\xDF","\xCD"],KeyT:["t","T","\u2020","\u02C7"],KeyU:["u","U","\xA8","\xA8"],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\u2211","\u201E"],KeyX:["x","X","\u2248","\u02DB"],KeyY:["y","Y","\xA5","\xC1"],KeyZ:["z","Z","\u03A9","\xB8"],Digit1:["1","!","\xA1","\u2044"],Digit2:["2","@","\u2122","\u20AC"],Digit3:["3","#","\xA3","\u2039"],Digit4:["4","$","\xA2","\u203A"],Digit5:["5","%","\u221E","\uFB01"],Digit6:["6","^","\xA7","\uFB02"],Digit7:["7","&","\xB6","\u2021"],Digit8:["8","*","\u2022","\xB0"],Digit9:["9","(","\xAA","\xB7"],Digit0:["0",")","\xBA","\u201A"],Space:[" "," "," "," "],Minus:["-","_","\u2013","\u2014"],Equal:["=","+","\u2260","\xB1"],BracketLeft:["[","{","\u201C","\u201D"],BracketRight:["]","}","\u2018","\u2019"],Backslash:["\\","|","\xAB","\xBB"],Semicolon:[";",":","\u2026","\xDA"],Quote:["'",'"',"\xE6","\xC6"],Backquote:["`","\u02DC","`","`"],Comma:[",","<","\u2264","\xAF"],Period:[".",">","\u2265","\u02D8"],Slash:["/","?","\xF7","\xBF"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[".",".",".","."],IntlBackslash:["\xA7","\xB1","\xA7","\xB1"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}},tl={id:"windows.en-intl",displayName:"English (international)",platform:"windows",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","\xE1","\xC1"],KeyB:["b","B","",""],KeyC:["c","C","\xA9","\xA2"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\xE9","\xC9"],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","\xED","\xCD"],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","\xF8","\xD8"],KeyM:["m","M","\xB5",""],KeyN:["n","N","\xF1","\xD1"],KeyO:["o","O","\xF3","\xD3"],KeyP:["p","P","\xF6","\xD6"],KeyQ:["q","Q","\xE4","\xC4"],KeyR:["r","R","\xAE",""],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\xFE","\xDE"],KeyU:["u","U","\xFA","\xDA"],KeyV:["v","V","",""],KeyW:["w","W","\xE5","\xC5"],KeyX:["x","X","",""],KeyY:["y","Y","\xFC","\xDC"],KeyZ:["z","Z","\xE6","\xC6"],Digit1:["1","!","\xA1","\xB9"],Digit2:["2","@","\xB2",""],Digit3:["3","#","\xB3",""],Digit4:["4","$","\xA4","\xA3"],Digit5:["5","%","\u20AC",""],Digit6:["6","^","\xBC",""],Digit7:["7","&","\xBD",""],Digit8:["8","*","\xBE",""],Digit9:["9","(","\u2018",""],Digit0:["0",")","\u2019",""],Space:[" "," ","",""],Minus:["-","_","\xA5",""],Equal:["=","+","\xD7","\xF7"],BracketLeft:["[","{","\xAB",""],BracketRight:["]","}","\xBB",""],Backslash:["\\","|","\xAC","\xA6"],Semicolon:[";",":","\xB6","\xB0"],Quote:["'",'"',"\xB4","\xA8"],Backquote:["`","~","",""],Comma:[",","<","\xE7","\xC7"],Period:[".",">","",""],Slash:["/","?","\xBF",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["\\","|","",""]}},rl={id:"linux.en",displayName:"English",platform:"linux",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","a","A"],KeyB:["b","B","b","B"],KeyC:["c","C","c","C"],KeyD:["d","D","d","D"],KeyE:["e","E","e","E"],KeyF:["f","F","f","F"],KeyG:["g","G","g","G"],KeyH:["h","H","h","H"],KeyI:["i","I","i","I"],KeyJ:["j","J","j","J"],KeyK:["k","K","k","K"],KeyL:["l","L","l","L"],KeyM:["m","M","m","M"],KeyN:["n","N","n","N"],KeyO:["o","O","o","O"],KeyP:["p","P","p","P"],KeyQ:["q","Q","q","Q"],KeyR:["r","R","r","R"],KeyS:["s","S","s","S"],KeyT:["t","T","t","T"],KeyU:["u","U","u","U"],KeyV:["v","V","v","V"],KeyW:["w","W","w","W"],KeyX:["x","X","x","X"],KeyY:["y","Y","y","Y"],KeyZ:["z","Z","z","Z"],Digit1:["1","!","1","!"],Digit2:["2","@","2","@"],Digit3:["3","#","3","#"],Digit4:["4","$","4","$"],Digit5:["5","%","5","%"],Digit6:["6","^","6","^"],Digit7:["7","&","7","&"],Digit8:["8","*","8","*"],Digit9:["9","(","9","("],Digit0:["0",")","0",")"],Space:[" "," "," "," "],Minus:["-","_","-","_"],Equal:["=","+","=","+"],BracketLeft:["[","{","[","{"],BracketRight:["]","}","]","}"],Backslash:["\\","|","\\","|"],Semicolon:[";",":",";",":"],Quote:["'",'"',"'",'"'],Backquote:["`","~","`","~"],Comma:[",","<",",","<"],Period:[".",">",".",">"],Slash:["/","?","/","?"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}};var du={id:"apple.french",locale:"fr",displayName:"French",platform:"apple",virtualLayout:"azerty",score:0,mapping:{KeyA:["q","Q","\u2021","\u03A9"],KeyB:["b","B","\xDF","\u222B"],KeyC:["c","C","\xA9","\xA2"],KeyD:["d","D","\u2202","\u2206"],KeyE:["e","E","\xEA","\xCA"],KeyF:["f","F","\u0192","\xB7"],KeyG:["g","G","\uFB01","\uFB02"],KeyH:["h","H","\xCC","\xCE"],KeyI:["i","I","\xEE","\xEF"],KeyJ:["j","J","\xCF","\xCD"],KeyK:["k","K","\xC8","\xCB"],KeyL:["l","L","\xAC","|"],KeyM:[",","?","\u221E","\xBF"],KeyN:["n","N","~","\u0131"],KeyO:["o","O","\u0153","\u0152"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["a","A","\xE6","\xC6"],KeyR:["r","R","\xAE","\u201A"],KeyS:["s","S","\xD2","\u2211"],KeyT:["t","T","\u2020","\u2122"],KeyU:["u","U","\xBA","\xAA"],KeyV:["v","V","\u25CA","\u221A"],KeyW:["z","Z","\xC2","\xC5"],KeyX:["x","X","\u2248","\u2044"],KeyY:["y","Y","\xDA","\u0178"],KeyZ:["w","W","\u2039","\u203A"],Digit1:["&","1","\uF8FF","\xB4"],Digit2:["\xE9","2","\xEB","\u201E"],Digit3:['"',"3","\u201C","\u201D"],Digit4:["'","4","\u2018","\u2019"],Digit5:["(","5","{","["],Digit6:["\xA7","6","\xB6","\xE5"],Digit7:["\xE8","7","\xAB","\xBB"],Digit8:["!","8","\xA1","\xDB"],Digit9:["\xE7","9","\xC7","\xC1"],Digit0:["\xE0","0","\xF8","\xD8"],Space:[" "," "," "," "],Minus:[")","\xB0","}","]"],Equal:["-","_","\u2014","\u2013"],BracketLeft:["^","\xA8","\xF4","\xD4"],BracketRight:["$","*","\u20AC","\xA5"],Backslash:["`","\xA3","@","#"],Semicolon:["m","M","\xB5","\xD3"],Quote:["\xF9","%","\xD9","\u2030"],Backquote:["<",">","\u2264","\u2265"],Comma:[";",".","\u2026","\u2022"],Period:[":","/","\xF7","\\"],Slash:["=","+","\u2260","\xB1"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",".",",","."],IntlBackslash:["@","#","\u2022","\u0178"],NumpadEqual:["=","=","=","="]}},mu={id:"windows.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"windows",score:0,mapping:{KeyA:["q","Q","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:[",","?","",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["a","A","",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["z","Z","",""],KeyX:["x","X","",""],KeyY:["y","Y","",""],KeyZ:["w","W","",""],Digit1:["&","1","",""],Digit2:["\xE9","2","~",""],Digit3:['"',"3","#",""],Digit4:["'","4","{",""],Digit5:["(","5","[",""],Digit6:["-","6","|",""],Digit7:["\xE8","7","`",""],Digit8:["_","8","\\",""],Digit9:["\xE7","9","^",""],Digit0:["\xE0","0","@",""],Space:[" "," ","",""],Minus:[")","\xB0","]",""],Equal:["=","+","}",""],BracketLeft:["^","\xA8","",""],BracketRight:["$","\xA3","\xA4",""],Backslash:["*","\xB5","",""],Semicolon:["m","M","",""],Quote:["\xF9","%","",""],Backquote:["\xB2","","",""],Comma:[";",".","",""],Period:[":","/","",""],Slash:["!","\xA7","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}},pu={id:"linux.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"linux",score:0,mapping:{KeyA:["q","Q","@","\u03A9"],KeyB:["b","B","\u201D","\u2019"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\xA2"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0309","\u031B"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:[",","?","\u0301","\u030B"],KeyN:["n","N","n","N"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["a","A","\xE6","\xC6"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201C","\u2018"],KeyW:["z","Z","\xAB","<"],KeyX:["x","X","\xBB",">"],KeyY:["y","Y","\u2190","\xA5"],KeyZ:["w","W","\u0142","\u0141"],Digit1:["&","1","\xB9","\xA1"],Digit2:["\xE9","2","~","\u215B"],Digit3:['"',"3","#","\xA3"],Digit4:["'","4","{","$"],Digit5:["(","5","[","\u215C"],Digit6:["-","6","|","\u215D"],Digit7:["\xE8","7","`","\u215E"],Digit8:["_","8","\\","\u2122"],Digit9:["\xE7","9","^","\xB1"],Digit0:["\xE0","0","@","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:[")","\xB0","]","\xBF"],Equal:["=","+","}","\u0328"],BracketLeft:["\u0302","\u0308","\u0308","\u030A"],BracketRight:["$","\xA3","\xA4","\u0304"],Backslash:["*","\xB5","\u0300","\u0306"],Semicolon:["m","M","\xB5","\xBA"],Quote:["\xF9","%","\u0302","\u030C"],Backquote:["\xB2","~","\xAC","\xAC"],Comma:[";",".","\u2500","\xD7"],Period:[":","/","\xB7","\xF7"],Slash:["!","\xA7","\u0323","\u0307"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"]}};var hu={id:"apple.german",locale:"de",displayName:"German",virtualLayout:"qwertz",platform:"apple",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\u222B","\u2039"],KeyC:["c","C","\xE7","\xC7"],KeyD:["d","D","\u2202","\u2122"],KeyE:["e","E","\u20AC","\u2030"],KeyF:["f","F","\u0192","\xCF"],KeyG:["g","G","\xA9","\xCC"],KeyH:["h","H","\xAA","\xD3"],KeyI:["i","I","\u2044","\xDB"],KeyJ:["j","J","\xBA","\u0131"],KeyK:["k","K","\u2206","\u02C6"],KeyL:["l","L","@","\uFB02"],KeyM:["m","M","\xB5","\u02D8"],KeyN:["n","N","~","\u203A"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\xAB","\xBB"],KeyR:["r","R","\xAE","\xB8"],KeyS:["s","S","\u201A","\xCD"],KeyT:["t","T","\u2020","\u02DD"],KeyU:["u","U","\xA8","\xC1"],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\u2211","\u201E"],KeyX:["x","X","\u2248","\xD9"],KeyY:["z","Z","\u03A9","\u02C7"],KeyZ:["y","Y","\xA5","\u2021"],Digit1:["1","!","\xA1","\xAC"],Digit2:["2",'"',"\u201C","\u201D"],Digit3:["3","\xA7","\xB6","#"],Digit4:["4","$","\xA2","\xA3"],Digit5:["5","%","[","\uFB01"],Digit6:["6","&","]","^"],Digit7:["7","/","|","\\"],Digit8:["8","(","{","\u02DC"],Digit9:["9",")","}","\xB7"],Digit0:["0","=","\u2260","\xAF"],Space:[" "," "," "," "],Minus:["\xDF","?","\xBF","\u02D9"],Equal:["\xB4","`","'","\u02DA"],BracketLeft:["\xFC","\xDC","\u2022","\xB0"],BracketRight:["+","*","\xB1","\uF8FF"],Backslash:["#","'","\u2018","\u2019"],Semicolon:["\xF6","\xD6","\u0153","\u0152"],Quote:["\xE4","\xC4","\xE6","\xC6"],Backquote:["<",">","\u2264","\u2265"],Comma:[",",";","\u221E","\u02DB"],Period:[".",":","\u2026","\xF7"],Slash:["-","_","\u2013","\u2014"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",",",".","."],IntlBackslash:["^","\xB0","\u201E","\u201C"],NumpadEqual:["=","=","=","="]}},fu={id:"windows.german",locale:"de",displayName:"German",platform:"windows",virtualLayout:"qwertz",score:0,mapping:{KeyA:["a","A","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:["m","M","\xB5",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["q","Q","@",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["w","W","",""],KeyX:["x","X","",""],KeyY:["z","Z","",""],KeyZ:["y","Y","",""],Digit1:["1","!","",""],Digit2:["2",'"',"\xB2",""],Digit3:["3","\xA7","\xB3",""],Digit4:["4","$","",""],Digit5:["5","%","",""],Digit6:["6","&","",""],Digit7:["7","/","{",""],Digit8:["8","(","[",""],Digit9:["9",")","]",""],Digit0:["0","=","}",""],Space:[" "," ","",""],Minus:["\xDF","?","\\","\u1E9E"],Equal:["\xB4","`","",""],BracketLeft:["\xFC","\xDC","",""],BracketRight:["+","*","~",""],Backslash:["#","'","",""],Semicolon:["\xF6","\xD6","",""],Quote:["\xE4","\xC4","",""],Backquote:["^","\xB0","",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","|",""]}},gu={id:"linux.german",locale:"de",displayName:"German",platform:"windows",virtualLayout:"qwertz",score:0,mapping:{KeyA:["a","A","\xE6","\xC6"],KeyB:["b","B","\u201C","\u2018"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\u20AC"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0323","\u0307"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:["m","M","\xB5","\xBA"],KeyN:["n","N","\u201D","\u2019"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["q","Q","@","\u03A9"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\u017F","\u1E9E"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201E","\u201A"],KeyW:["w","W","\u0142","\u0141"],KeyX:["x","X","\xAB","\u2039"],KeyY:["z","Z","\u2190","\xA5"],KeyZ:["y","Y","\xBB","\u203A"],Digit1:["1","!","\xB9","\xA1"],Digit2:["2",'"',"\xB2","\u215B"],Digit3:["3","\xA7","\xB3","\xA3"],Digit4:["4","$","\xBC","\xA4"],Digit5:["5","%","\xBD","\u215C"],Digit6:["6","&","\xAC","\u215D"],Digit7:["7","/","{","\u215E"],Digit8:["8","(","[","\u2122"],Digit9:["9",")","]","\xB1"],Digit0:["0","=","}","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["\xDF","?","\\","\xBF"],Equal:["\u0301","\u0300","\u0327","\u0328"],BracketLeft:["\xFC","\xDC","\u0308","\u030A"],BracketRight:["+","*","~","\xAF"],Backslash:["#","'","\u2019","\u0306"],Semicolon:["\xF6","\xD6","\u030B","\u0323"],Quote:["\xE4","\xC4","\u0302","\u030C"],Backquote:["\u0302","\xB0","\u2032","\u2033"],Comma:[",",";","\xB7","\xD7"],Period:[".",":","\u2026","\xF7"],Slash:["-","_","\u2013","\u2014"],PrintScreen:["","","",""],PageUp:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["","1","","1"],Numpad2:["","2","","2"],Numpad3:["","3","","3"],Numpad4:["","4","","4"],Numpad5:["","5","","5"],Numpad6:["","6","","6"],Numpad7:["","7","","7"],Numpad8:["","8","","8"],Numpad9:["","9","","9"],Numpad0:["","0","","0"],NumpadDecimal:["",",","",","],IntlBackslash:["<",">","|","\u0331"],AltRight:["\r","\r","\r","\r"],MetaRight:[".",".",".","."]}};var bu={id:"apple.spanish",locale:"es",displayName:"Spanish ISO",platform:"apple",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\xDF",""],KeyC:["c","C","\xA9"," "],KeyD:["d","D","\u2202","\u2206"],KeyE:["e","E","\u20AC","\u20AC"],KeyF:["f","F","\u0192","\uFB01"],KeyG:["g","G","\uF8FF","\uFB02"],KeyH:["h","H","\u2122"," "],KeyI:["i","I"," "," "],KeyJ:["j","J","\xB6","\xAF"],KeyK:["k","K","\xA7","\u02C7"],KeyL:["l","L"," ","\u02D8"],KeyM:["m","M","\xB5","\u02DA"],KeyN:["n","N"," ","\u02D9"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\u0153","\u0152"],KeyR:["r","R","\xAE"," "],KeyS:["s","S","\u222B"," "],KeyT:["t","T","\u2020","\u2021"],KeyU:["u","U"," "," "],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\xE6","\xC6"],KeyX:["x","X","\u2211","\u203A"],KeyY:["y","Y","\xA5"," "],KeyZ:["z","Z","\u03A9","\u2039"],Digit1:["1","!","|","\u0131"],Digit2:["2",'"',"@","\u02DD"],Digit3:["3","\xB7","#","\u2022"],Digit4:["4","$","\xA2","\xA3"],Digit5:["5","%","\u221E","\u2030"],Digit6:["6","&","\xAC"," "],Digit7:["7","/","\xF7","\u2044"],Digit8:["8","(","\u201C","\u2018"],Digit9:["9",")","\u201D","\u2019"],Digit0:["0","=","\u2260","\u2248"],Space:[" "," "," "," "],Minus:["'","?","\xB4","\xB8"],Equal:["\xA1","\xBF","\u201A","\u02DB"],BracketLeft:["`","^","[","\u02C6"],BracketRight:["+","*","]","\xB1"],Backslash:["\xE7","\xC7","}","\xBB"],Semicolon:["\xF1","\xD1","~","\u02DC"],Quote:["\xB4","\xA8","{","\xAB"],Backquote:["<",">","\u2264","\u2265"],Comma:[",",";","\u201E",""],Period:[".",":","\u2026","\u2026"],Slash:["-","_","\u2013","\u2014"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[",",",",",",","],IntlBackslash:["\xBA","\xAA","\\","\xB0"]}},yu={id:"windows.spanish",locale:"es",displayName:"Spanish",platform:"windows",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:["m","M","",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["q","Q","",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["w","W","",""],KeyX:["x","X","",""],KeyY:["y","Y","",""],KeyZ:["z","Z","",""],Digit1:["1","!","|",""],Digit2:["2",'"',"@",""],Digit3:["3","\xB7","#",""],Digit4:["4","$","~",""],Digit5:["5","%","\u20AC",""],Digit6:["6","&","\xAC",""],Digit7:["7","/","",""],Digit8:["8","(","",""],Digit9:["9",")","",""],Digit0:["0","=","",""],Space:[" "," ","",""],Minus:["'","?","",""],Equal:["\xA1","\xBF","",""],BracketLeft:["`","^","[",""],BracketRight:["+","*","]",""],Backslash:["\xE7","\xC7","}",""],Semicolon:["\xF1","\xD1","",""],Quote:["\xB4","\xA8","{",""],Backquote:["\xBA","\xAA","\\",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}},xu={id:"linux.spanish",locale:"es",displayName:"Spanish",platform:"linux",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","\xE6","\xC6"],KeyB:["b","B","\u201D","\u2019"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\xA2"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0309","\u031B"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:["m","M","\xB5","\xBA"],KeyN:["n","N","n","N"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["q","Q","@","\u03A9"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201C","\u2018"],KeyW:["w","W","\u0142","\u0141"],KeyX:["x","X","\xBB",">"],KeyY:["y","Y","\u2190","\xA5"],KeyZ:["z","Z","\xAB","<"],Digit1:["1","!","|","\xA1"],Digit2:["2",'"',"@","\u215B"],Digit3:["3","\xB7","#","\xA3"],Digit4:["4","$","~","$"],Digit5:["5","%","\xBD","\u215C"],Digit6:["6","&","\xAC","\u215D"],Digit7:["7","/","{","\u215E"],Digit8:["8","(","[","\u2122"],Digit9:["9",")","]","\xB1"],Digit0:["0","=","}","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["'","?","\\","\xBF"],Equal:["\xA1","\xBF","\u0303","~"],BracketLeft:["\u0300","\u0302","[","\u030A"],BracketRight:["+","*","]","\u0304"],Backslash:["\xE7","\xC7","}","\u0306"],Semicolon:["\xF1","\xD1","~","\u030B"],Quote:["\u0301","\u0308","{","{"],Backquote:["\xBA","\xAA","\\","\\"],Comma:[",",";","\u2500","\xD7"],Period:[".",":","\xB7","\xF7"],Slash:["-","_","\u0323","\u0307"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadEnter:["\r","\r","\r","\r"],Numpad1:["","1","","1"],Numpad2:["","2","","2"],Numpad3:["","3","","3"],Numpad4:["","4","","4"],Numpad5:["","5","","5"],Numpad6:["","6","","6"],Numpad7:["","7","","7"],Numpad8:["","8","","8"],Numpad9:["","9","","9"],Numpad0:["","0","","0"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}};function il(t){let e=t.split("+"),r={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:e.pop()};return e.includes("shift")&&(r.shift=!0),e.includes("alt")&&(r.alt=!0),e.includes("ctrl")&&(r.ctrl=!0),e.includes("cmd")&&(r.cmd=!0),e.includes("win")&&(r.win=!0),e.includes("meta")&&(r.meta=!0),r}function Gr(t){let e="";return t.shift&&(e+="shift+"),t.alt&&(e+="alt+"),t.ctrl&&(e+="ctrl+"),t.cmd&&(e+="cmd+"),t.win&&(e+="win+"),t.meta&&(e+="meta+"),e+t.key}var Zh={enter:"[Enter]",escape:"[Escape]",backspace:"[Backspace]",tab:"[Tab]",space:"[Space]",pausebreak:"[Pause]",insert:"[Insert]",home:"[Home]",pageup:"[PageUp]",delete:"[Delete]",end:"[End]",pagedown:"[PageDown]",right:"[ArrowRight]",left:"[ArrowLeft]",down:"[ArrowDown]",up:"[ArrowUp]",numpad0:"[Numpad0]",numpad1:"[Numpad1]",numpad2:"[Numpad2]",numpad3:"[Numpad3]",numpad4:"[Numpad4]",numpad5:"[Numpad5]",numpad6:"[Numpad6]",numpad7:"[Numpad7]",numpad8:"[Numpad8]",numpad9:"[Numpad9]",numpad_divide:"[NumpadDivide]",numpad_multiply:"[NumpadMultiply]",numpad_subtract:"[NumpadSubtract]",numpad_add:"[NumpadAdd]",numpad_decimal:"[NumpadDecimal]",numpad_separator:"[NumpadComma]",capslock:"[Capslock]",f1:"[F1]",f2:"[F2]",f3:"[F3]",f4:"[F4]",f5:"[F5]",f6:"[F6]",f7:"[F7]",f8:"[F8]",f9:"[F9]",f10:"[F10]",f11:"[F11]",f12:"[F12]",f13:"[F13]",f14:"[F14]",f15:"[F15]",f16:"[F16]",f17:"[F17]",f18:"[F18]",f19:"[F19]"},Ci=[],Xt;function nl(){switch(Ct()){case"macos":case"ios":return"apple";case"windows":return"windows"}return"linux"}function je(t){(!t.platform||t.platform===nl())&&Ci.push(t)}function vu(t,e){var i;let r={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:""};if(!t)return r;for(let[n,o]of Object.entries(e.mapping)){if(o[0]===t)return r.key=`[${n}]`,r;if(o[1]===t)return r.shift=!0,r.key=`[${n}]`,r;if(o[2]===t)return r.alt=!0,r.key=`[${n}]`,r;if(o[3]===t)return r.shift=!0,r.alt=!0,r.key=`[${n}]`,r}return r.key=(i=Zh[t])!=null?i:"",r}function _u(t){if(t.code)return t;let e=Object.entries(gr().mapping),r=!1,i=!1,n="";for(let o=0;o<4;o++){for(let[a,s]of e)if(s[o]===t.key){n=a,o===3?(r=!0,i=!0):o===2?r=!0:o===1&&(i=!0);break}if(n)break}return new KeyboardEvent(t.type,g(p({},t),{altKey:r,shiftKey:i,code:n}))}function Mu(t){var r,i;if(!t||t.key==="Unidentified"||t.key==="Dead")return;let e=t.shiftKey&&t.altKey?3:t.altKey?2:t.shiftKey?1:0;for(let n of Ci)((r=n.mapping[t.code])==null?void 0:r[e])===t.key?n.score+=1:(i=n.mapping[t.code])!=null&&i[e]&&(n.score=0);Ci.sort((n,o)=>o.score-n.score)}function Uo(t){Xt=Ci.find(e=>t.startsWith(e.locale))}function wu(t){return Xt=Ci.find(e=>e.id===t),Xt}function gr(){return Xt!=null?Xt:Ci[0]}function Su(){switch(nl()){case"apple":return Wo;case"windows":return tl;case"linux":return rl}return Wo}switch(nl()){case"apple":je(Wo),je(du),je(bu),je(hu);break;case"windows":je(tl),je(mu),je(yu),je(fu);break;case"linux":je(rl),je(pu),je(xu),je(gu);break}je(uu);function ku(t){wu(t)}function Lu(t){Uo(t)}function ee(t){return Array.isArray(t)}var Au={en:{"keyboard.tooltip.symbols":"Symbols","keyboard.tooltip.greek":"Greek Letters","keyboard.tooltip.numeric":"Numeric","keyboard.tooltip.alphabetic":"Roman Letters","tooltip.copy to clipboard":"Copy to Clipboard","tooltip.cut to clipboard":"Cut to Clipboard","tooltip.paste from clipboard":"Paste from Clipboard","tooltip.redo":"Redo","tooltip.toggle virtual keyboard":"Toggle Virtual Keyboard","tooltip.menu":"Menu","tooltip.undo":"Undo","menu.borders":"Borders","menu.insert matrix":"Insert Matrix","menu.array.add row above":"Add Row Before","menu.array.add row below":"Add Row After","menu.array.add column after":"Add Column After","menu.array.add column before":"Add Column Before","menu.array.delete row":"Delete Row","menu.array.delete rows":"Delete Selected Rows","menu.array.delete column":"Delete Column","menu.array.delete columns":"Delete Selected Columns","menu.mode":"Mode","menu.mode-math":"Math","menu.mode-text":"Text","menu.mode-latex":"LaTeX","menu.insert":"Insert","menu.insert.abs":"Absolute Value","menu.insert.abs-template":"\\left|x\\right|","menu.insert.nth-root":"nth Root","menu.insert.nth-root-template":"\\sqrt[n]{x}","menu.insert.log-base":"Logarithm base a","menu.insert.log-base-template":"\\log_a(x)","menu.insert.heading-calculus":"Calculus","menu.insert.derivative":"Derivative","menu.insert.derivative-template":"\\dfrac{\\mathrm{d}}{\\mathrm{d}x}f(x)\\bigm|_{x=a}","menu.insert.nth-derivative":"nth derivative","menu.insert.nth-derivative-template":"\\dfrac{\\mathrm{d}^n}{\\mathrm{d}x^n}f(x)\\bigm|_{x=a}","menu.insert.integral":"Integral","menu.insert.integral-template":"$\\int_a^b f(x)\\,\\mathrm{d}x$","menu.insert.sum":"Sum","menu.insert.sum-template":"$\\sum_{i=1}^n x_i$","menu.insert.product":"Product","menu.insert.product-template":"\\prod_{i=1}^n x_i","menu.insert.heading-complex-numbers":"Complex Numbers","menu.insert.modulus":"Modulus","menu.insert.modulus-template":"\\lvert z \\rvert","menu.insert.argument":"Argument","menu.insert.argument-template":"\\arg(z)","menu.insert.real-part":"Real Part","menu.insert.real-part-template":"\\Re(z)","menu.insert.imaginary-part":"Imaginary Part","menu.insert.imaginary-part-template":"\\Im(z)","menu.insert.conjugate":"Conjugate","menu.insert.conjugate-template":"\\overline{z}","tooltip.blackboard":"Blackboard","tooltip.bold":"Bold","tooltip.italic":"Italic","tooltip.fraktur":"Fraktur","tooltip.script":"Script","tooltip.caligraphic":"Caligraphic","tooltip.typewriter":"Typewriter","tooltip.roman-upright":"Roman Upright","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"Font Style","menu.accent":"Accent","menu.decoration":"Decoration","menu.color":"Color","menu.background-color":"Background","menu.evaluate":"Evaluate","menu.simplify":"Simplify","menu.solve":"Solve","menu.solve-for":"Solve for %@","menu.cut":"Cut","menu.copy":"Copy","menu.copy-as-latex":"Copy as LaTeX","menu.copy-as-typst":"Copy as Typst","menu.copy-as-ascii-math":"Copy as ASCII Math","menu.copy-as-mathml":"Copy as MathML","menu.paste":"Paste","menu.select-all":"Select All","color.red":"Red","color.orange":"Orange","color.yellow":"Yellow","color.lime":"Lime","color.green":"Green","color.teal":"Teal","color.cyan":"Cyan","color.blue":"Blue","color.indigo":"Indigo","color.purple":"Purple","color.magenta":"Magenta","color.black":"Black","color.dark-grey":"Dark Grey","color.grey":"Grey","color.light-grey":"Light Grey","color.white":"White"},ar:{"keyboard.tooltip.symbols":"\u062D\u0631\u0641 \u0627\u0648 \u0631\u0645\u0632","keyboard.tooltip.greek":"\u062D\u0631\u0648\u0641 \u064A\u0648\u0646\u0627\u0646\u064A\u0629","keyboard.tooltip.numeric":"\u0627\u0644\u0631\u0642\u0645\u064A\u0629","keyboard.tooltip.alphabetic":"\u0631\u0645\u0648\u0632 \u0627\u0644\u0627\u062D\u0631\u0641 \u0627\u0644\u0631\u0648\u0645\u0627\u0646\u064A\u0629","tooltip.copy to clipboard":"\u0646\u0633\u062E \u0625\u0644\u0649 \u0627\u0644\u062D\u0627\u0641\u0638\u0629","tooltip.cut to clipboard":"\u0642\u0635 \u0625\u0644\u0649 \u0627\u0644\u062D\u0627\u0641\u0638\u0629","tooltip.paste from clipboard":"\u0644\u0635\u0642 \u0645\u0646 \u0627\u0644\u062D\u0627\u0641\u0638\u0629","tooltip.redo":"\u0627\u0644\u0625\u0639\u0627\u062F\u0629","tooltip.toggle virtual keyboard":"\u062A\u0628\u062F\u064A\u0644 \u0644\u0648\u062D\u0629 \u0627\u0644\u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0625\u0641\u062A\u0631\u0627\u0636\u064A\u0629","tooltip.undo":"\u0625\u0644\u063A\u0627\u0621","menu.insert matrix":"\u0623\u062F\u062E\u0644 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629","menu.borders":"\u0645\u062D\u062F\u062F\u0627\u062A \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629","menu.array.add row above":"\u0623\u0636\u0641 \u0635\u0641\u064B\u0627 \u0628\u0639\u062F \u0630\u0644\u0643","menu.array.add row below":"\u0623\u0636\u0641 \u0627\u0644\u0635\u0641 \u0642\u0628\u0644","menu.array.add column after":"\u0623\u0636\u0641 \u0627\u0644\u0639\u0645\u0648\u062F \u0628\u0639\u062F \u0630\u0644\u0643","menu.array.add column before":"\u0623\u0636\u0641 \u0627\u0644\u0639\u0645\u0648\u062F \u0642\u0628\u0644","menu.array.delete row":"\u0627\u062D\u0630\u0641 \u0635\u0641","menu.array.delete rows":"\u062D\u0630\u0641 \u0627\u0644\u0635\u0641\u0648\u0641 \u0627\u0644\u0645\u062D\u062F\u062F\u0629","menu.array.delete column":"\u062D\u0630\u0641 \u0627\u0644\u0639\u0645\u0648\u062F","menu.array.delete columns":"\u062D\u0630\u0641 \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629","menu.mode":"\u0648\u0636\u0639","menu.mode-math":"\u0631\u064A\u0627\u0636\u064A\u0627\u062A","menu.mode-text":"\u0646\u0635","menu.mode-latex":"\u0644\u0627\u062A\u0643\u0633","tooltip.blackboard":"\u0633\u0628\u0648\u0631\u0629","tooltip.bold":"\u0639\u0631\u064A\u0636","tooltip.italic":"\u0645\u0627\u0626\u0644","tooltip.fraktur":"\u0641\u0631\u0627\u0643\u062A\u0648\u0631","tooltip.script":"\u0633\u0643\u0631\u064A\u0628\u062A","tooltip.caligraphic":"\u0643\u0627\u0644\u064A\u062C\u0631\u0627\u0641\u064A\u0643","tooltip.typewriter":"\u0622\u0644\u0629 \u0643\u0627\u062A\u0628\u0629","tooltip.roman-upright":"\u0631\u0648\u0645\u0627\u0646\u064A \u0645\u0633\u062A\u0642\u064A\u0645","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\u0646\u0645\u0637 \u0627\u0644\u062E\u0637","menu.accent":"\u062A\u0634\u0643\u064A\u0644","menu.decoration":"\u0632\u062E\u0631\u0641\u0629","menu.color":"\u0644\u0648\u0646","menu.background-color":"\u0627\u0644\u062E\u0644\u0641\u064A\u0629","menu.evaluate":"\u062A\u0642\u064A\u064A\u0645","menu.simplify":"\u062A\u0628\u0633\u064A\u0637","menu.solve":"\u062D\u0644","menu.solve-for":"\u062D\u0644 \u0644\u0640 %@","menu.cut":"\u0642\u0635","menu.copy":"\u0646\u0633\u062E","menu.copy-as-latex":"\u0646\u0633\u062E \u0643\u0640 LaTeX","menu.copy-as-ascii-math":"\u0646\u0633\u062E \u0643\u0640 ASCII Math","menu.copy-as-mathml":"\u0646\u0633\u062E \u0643\u0640 MathML","menu.paste":"\u0644\u0635\u0642","menu.select-all":"\u062A\u062D\u062F\u064A\u062F \u0627\u0644\u0643\u0644","color.red":"\u0623\u062D\u0645\u0631","color.orange":"\u0628\u0631\u062A\u0642\u0627\u0644\u064A","color.yellow":"\u0623\u0635\u0641\u0631","color.lime":"\u0644\u064A\u0645\u0648\u0646\u064A","color.green":"\u0623\u062E\u0636\u0631","color.teal":"\u0633\u0645\u0627\u0648\u064A","color.cyan":"\u0633\u0645\u0627\u0648\u064A \u0641\u0627\u062A\u062D","color.blue":"\u0623\u0632\u0631\u0642","color.indigo":"\u0646\u064A\u0644\u064A","color.purple":"\u0628\u0646\u0641\u0633\u062C\u064A","color.magenta":"\u0623\u0631\u062C\u0648\u0627\u0646\u064A","color.black":"\u0623\u0633\u0648\u062F","color.dark-grey":"\u0631\u0645\u0627\u062F\u064A \u063A\u0627\u0645\u0642","color.grey":"\u0631\u0645\u0627\u062F\u064A","color.light-grey":"\u0631\u0645\u0627\u062F\u064A \u0641\u0627\u062A\u062D","color.white":"\u0623\u0628\u064A\u0636"},de:{"keyboard.tooltip.symbols":"Symbole","keyboard.tooltip.greek":"Griechische Buchstaben","keyboard.tooltip.numeric":"Numerisch","keyboard.tooltip.alphabetic":"R\xF6mische Buchstaben","tooltip.copy to clipboard":"In die Zwischenablage kopieren","tooltip.redo":"Wiederholen","tooltip.toggle virtual keyboard":"Virtuelle Tastatur umschalten","tooltip.undo":"Widerrufen","menu.insert matrix":"Matrix einf\xFCgen","menu.borders":"Matrixtrennzeichen","menu.array.add row above":"Zeile hinzuf\xFCgen nach","menu.array.add row below":"Zeile hinzuf\xFCgen vor","menu.array.add column after":"Spalte hinzuf\xFCgen nach","menu.array.add column before":"Spalte hinzuf\xFCgen vor","menu.array.delete row":"Zeile l\xF6schen","menu.array.delete rows":"Ausgew\xE4hlte Zeilen l\xF6schen","menu.array.delete column":"Spalte l\xF6schen","menu.array.delete columns":"Ausgew\xE4hlte Spalten l\xF6schen","menu.mode":"Modus","menu.mode-math":"Mathematik","menu.mode-text":"Text","menu.mode-latex":"LaTeX","tooltip.blackboard":"Tafel","tooltip.bold":"Fett","tooltip.italic":"Kursiv","tooltip.fraktur":"Fraktur","tooltip.script":"Skript","tooltip.caligraphic":"Kalligraphie","tooltip.typewriter":"Schreibmaschine","tooltip.roman-upright":"R\xF6misch aufrecht","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"Schriftstil","menu.accent":"Akzent","menu.decoration":"Dekoration","menu.color":"Farbe","menu.background-color":"Hintergrund","menu.evaluate":"Auswerten","menu.simplify":"Vereinfachen","menu.solve":"L\xF6sen","menu.solve-for":"L\xF6sen f\xFCr %@","menu.cut":"Ausschneiden","menu.copy":"Kopieren","menu.copy-as-latex":"Als LaTeX kopieren","menu.copy-as-ascii-math":"Als ASCII Math kopieren","menu.copy-as-mathml":"Als MathML kopieren","menu.paste":"Einf\xFCgen","menu.select-all":"Alles ausw\xE4hlen","color.red":"Rot","color.orange":"Orange","color.yellow":"Gelb","color.lime":"Limette","color.green":"Gr\xFCn","color.teal":"Blaugr\xFCn","color.cyan":"Cyan","color.blue":"Blau","color.indigo":"Indigo","color.purple":"Lila","color.magenta":"Magenta","color.black":"Schwarz","color.dark-grey":"Dunkelgrau","color.grey":"Grau","color.light-grey":"Hellgrau","color.white":"Wei\xDF"},el:{"keyboard.tooltip.symbols":"\u03C3\u03CD\u03BC\u03B2\u03BF\u03BB\u03B1","keyboard.tooltip.greek":"\u03B5\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC \u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03B1","keyboard.tooltip.numeric":"\u0391\u03C1\u03B9\u03B8\u03BC\u03B7\u03C4\u03B9\u03BA\u03CC\u03C2","keyboard.tooltip.alphabetic":"\u03A1\u03C9\u03BC\u03B1\u03CA\u03BA\u03AC \u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03B1","tooltip.copy to clipboard":"\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03C3\u03C4\u03BF \u03C0\u03C1\u03CC\u03C7\u03B5\u03B9\u03C1\u03BF","tooltip.redo":"\u039E\u03B1\u03BD\u03B1\u03BA\u03AC\u03BD\u03C9","tooltip.toggle virtual keyboard":"\u0395\u03BD\u03B1\u03BB\u03BB\u03B1\u03B3\u03AE \u03B5\u03B9\u03BA\u03BF\u03BD\u03B9\u03BA\u03BF\u03CD \u03C0\u03BB\u03B7\u03BA\u03C4\u03C1\u03BF\u03BB\u03BF\u03B3\u03AF\u03BF\u03C5","tooltip.undo":"\u039E\u03B5\u03BA\u03AC\u03BD\u03C9","menu.insert matrix":"\u0395\u03B9\u03C3\u03B1\u03B3\u03C9\u03B3\u03AE \u03BC\u03AE\u03C4\u03C1\u03B1","menu.borders":"\u039F\u03C1\u03B9\u03BF\u03B8\u03AD\u03C4\u03B5\u03C2 \u03BC\u03AE\u03C4\u03C1\u03B1","menu.array.add row above":"\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03B5\u03B9\u03C1\u03AC\u03C2 \u03BC\u03B5\u03C4\u03AC","menu.array.add row below":"\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03B5\u03B9\u03C1\u03AC\u03C2 \u03C0\u03C1\u03B9\u03BD","menu.array.add column after":"\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03C4\u03AE\u03BB\u03B7\u03C2 \u03BC\u03B5\u03C4\u03AC","menu.array.add column before":"\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03C4\u03AE\u03BB\u03B7\u03C2 \u03C0\u03C1\u03B9\u03BD","menu.array.delete row":"\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE \u03C3\u03B5\u03B9\u03C1\u03AC\u03C2","menu.array.delete rows":"\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE \u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03C9\u03BD \u03C3\u03B5\u03B9\u03C1\u03CE\u03BD","menu.array.delete column":"\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE \u03C3\u03C4\u03AE\u03BB\u03B7\u03C2","menu.array.delete columns":"\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE \u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03C9\u03BD \u03C3\u03C4\u03B7\u03BB\u03CE\u03BD","menu.mode":"\u039B\u03B5\u03B9\u03C4\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1","menu.mode-math":"\u039C\u03B1\u03B8\u03B7\u03BC\u03B1\u03C4\u03B9\u03BA\u03AC","menu.mode-text":"\u039A\u03B5\u03AF\u03BC\u03B5\u03BD\u03BF","menu.mode-latex":"LaTeX","tooltip.blackboard":"\u03A0\u03AF\u03BD\u03B1\u03BA\u03B1\u03C2","tooltip.bold":"\u0388\u03BD\u03C4\u03BF\u03BD\u03B7","tooltip.italic":"\u03A0\u03BB\u03AC\u03B3\u03B9\u03B1","tooltip.fraktur":"\u03A6\u03C1\u03AC\u03BA\u03C4\u03BF\u03C5\u03C1","tooltip.script":"\u03A3\u03B5\u03BD\u03AC\u03C1\u03B9\u03BF","tooltip.caligraphic":"\u039A\u03B1\u03BB\u03BB\u03B9\u03B3\u03C1\u03B1\u03C6\u03B9\u03BA\u03AE","tooltip.typewriter":"\u039C\u03B7\u03C7\u03B1\u03BD\u03AE \u03B3\u03C1\u03B1\u03C6\u03AE\u03C2","tooltip.roman-upright":"\u03A1\u03C9\u03BC\u03B1\u03CA\u03BA\u03CC \u039A\u03B1\u03C4\u03B1\u03BA\u03CC\u03C1\u03C5\u03C6\u03BF","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\u03A3\u03C4\u03C5\u03BB \u03B3\u03C1\u03B1\u03BC\u03BC\u03B1\u03C4\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC\u03C2","menu.accent":"\u03A4\u03CC\u03BD\u03BF\u03C2","menu.decoration":"\u0394\u03B9\u03B1\u03BA\u03CC\u03C3\u03BC\u03B7\u03C3\u03B7","menu.color":"\u03A7\u03C1\u03CE\u03BC\u03B1","menu.background-color":"\u03A7\u03C1\u03CE\u03BC\u03B1 \u03C6\u03CC\u03BD\u03C4\u03BF\u03C5","menu.evaluate":"\u0391\u03BE\u03B9\u03BF\u03BB\u03CC\u03B3\u03B7\u03C3\u03B7","menu.simplify":"\u0391\u03C0\u03BB\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7","menu.solve":"\u039B\u03CD\u03C3\u03B7","menu.solve-for":"\u039B\u03CD\u03C3\u03B7 \u03B3\u03B9\u03B1 %@","menu.cut":"\u0391\u03C0\u03BF\u03BA\u03BF\u03C0\u03AE","menu.copy":"\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE","menu.copy-as-latex":"\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03C9\u03C2 LaTeX","menu.copy-as-ascii-math":"\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03C9\u03C2 ASCII Math","menu.copy-as-mathml":"\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03C9\u03C2 MathML","menu.paste":"\u0395\u03C0\u03B9\u03BA\u03CC\u03BB\u03BB\u03B7\u03C3\u03B7","menu.select-all":"\u0395\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE \u03CC\u03BB\u03C9\u03BD","color.red":"\u039A\u03CC\u03BA\u03BA\u03B9\u03BD\u03BF","color.orange":"\u03A0\u03BF\u03C1\u03C4\u03BF\u03BA\u03B1\u03BB\u03AF","color.yellow":"\u039A\u03AF\u03C4\u03C1\u03B9\u03BD\u03BF","color.lime":"\u039B\u03B1\u03C7\u03B1\u03BD\u03AF","color.green":"\u03A0\u03C1\u03AC\u03C3\u03B9\u03BD\u03BF","color.teal":"\u039A\u03C5\u03B1\u03BD\u03CC","color.cyan":"\u0393\u03B1\u03BB\u03AC\u03B6\u03B9\u03BF","color.blue":"\u039C\u03C0\u03BB\u03B5","color.indigo":"\u0399\u03BD\u03B4\u03B9\u03BA\u03CC","color.purple":"\u039C\u03C9\u03B2","color.magenta":"\u039C\u03B1\u03C4\u03B6\u03AD\u03BD\u03C4\u03B1","color.black":"\u039C\u03B1\u03CD\u03C1\u03BF","color.dark-grey":"\u03A3\u03BA\u03BF\u03CD\u03C1\u03BF \u0393\u03BA\u03C1\u03B9","color.grey":"\u0393\u03BA\u03C1\u03B9","color.light-grey":"\u0391\u03BD\u03BF\u03B9\u03C7\u03C4\u03CC \u0393\u03BA\u03C1\u03B9","color.white":"\u039B\u03B5\u03C5\u03BA\u03CC"},es:{"keyboard.tooltip.symbols":"S\xEDmbolos","keyboard.tooltip.greek":"Letras griegas","keyboard.tooltip.numeric":"Num\xE9rico","keyboard.tooltip.alphabetic":"Letras romanas","tooltip.copy to clipboard":"Copiar al portapapeles","tooltip.redo":"Rehacer","tooltip.toggle virtual keyboard":"Alternar teclado virtual","tooltip.undo":"Deshacer","menu.insert matrix":"A\xF1adir Matriz","menu.borders":"Delimitadores de Matriz","menu.array.add row above":"A\xF1adir L\xEDnea Antes","menu.array.add row below":"A\xF1adir L\xEDnea Despues","menu.array.add column after":"A\xF1adir Columna Despues","menu.array.add column before":"A\xF1adir Columna Antes","menu.array.delete row":"Borrar L\xEDnea","menu.array.delete rows":"Borrar L\xEDneas Seleccionadas","menu.array.delete column":"Borrar Columna","menu.array.delete columns":"Borrar Columnas Seleccionadas","menu.mode":"Modo","menu.mode-math":"Matem\xE1ticas","menu.mode-text":"Texto","menu.mode-latex":"LaTeX","tooltip.blackboard":"Pizarra","tooltip.bold":"Negrita","tooltip.italic":"Cursiva","tooltip.fraktur":"Fraktur","tooltip.script":"Script","tooltip.caligraphic":"Caligr\xE1fico","tooltip.typewriter":"M\xE1quina de escribir","tooltip.roman-upright":"Romano Vertical","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"Estilo de fuente","menu.accent":"Acento","menu.decoration":"Decoraci\xF3n","menu.color":"Color","menu.background-color":"Fondo","menu.evaluate":"Evaluar","menu.simplify":"Simplificar","menu.solve":"Resolver","menu.solve-for":"Resolver para %@","menu.cut":"Cortar","menu.copy":"Copiar","menu.copy-as-latex":"Copiar como LaTeX","menu.copy-as-ascii-math":"Copiar como ASCII Math","menu.copy-as-mathml":"Copiar como MathML","menu.paste":"Pegar","menu.select-all":"Seleccionar todo","color.red":"Rojo","color.orange":"Naranja","color.yellow":"Amarillo","color.lime":"Lima","color.green":"Verde","color.teal":"Verde azulado","color.cyan":"Cian","color.blue":"Azul","color.indigo":"\xCDndigo","color.purple":"Morado","color.magenta":"Magenta","color.black":"Negro","color.dark-grey":"Gris oscuro","color.grey":"Gris","color.light-grey":"Gris claro","color.white":"Blanco"},fr:{"keyboard.tooltip.symbols":"Symboles","keyboard.tooltip.greek":"Lettres grecques","keyboard.tooltip.numeric":"Num\xE9rique","keyboard.tooltip.alphabetic":"Lettres romaines","tooltip.menu":"Menu","tooltip.copy to clipboard":"Copier dans le presse-papiers","tooltip.redo":"R\xE9tablir","tooltip.toggle virtual keyboard":"Afficher/Masquer le clavier virtuel","tooltip.undo":"Annuler","menu.insert matrix":"Ins\xE9rer une Matrice","menu.borders":"Bords","menu.array.add row above":"Ajouter une Ligne Avant","menu.array.add row below":"Ajouter une Ligne Apr\xE8s","menu.array.add column before":"Ajouter une Colonne Avant","menu.array.add column after":"Ajouter une Colonne Apr\xE8s","menu.array.delete row":"Enlever une Ligne","menu.array.delete rows":"Enlever les Lignes S\xE9lection\xE9es","menu.array.delete column":"Enlever une Colone","menu.array.delete columns":"Enlever les Colonnes S\xE9lection\xE9es","menu.mode":"Mode","menu.mode-math":"Math","menu.mode-text":"Text","menu.mode-latex":"LaTeX","tooltip.blackboard":"Tableau noir","tooltip.bold":"Gras","tooltip.italic":"Italique","tooltip.fraktur":"Fraktur","tooltip.script":"Script","tooltip.caligraphic":"Calligraphique","tooltip.typewriter":"Machine \xE0 \xE9crire","tooltip.roman-upright":"Romain droit","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"Style de police","menu.accent":"Accent","menu.decoration":"D\xE9coration","menu.color":"Couleur","menu.background-color":"Arri\xE8re-plan","menu.evaluate":"\xC9valuer","menu.simplify":"Simplifier","menu.solve":"R\xE9soudre","menu.solve-for":"R\xE9soudre pour %@","menu.cut":"Couper","menu.copy":"Copier","menu.copy-as-latex":"Copier en LaTeX","menu.copy-as-ascii-math":"Copier en ASCII Math","menu.copy-as-mathml":"Copier en MathML","menu.paste":"Coller","menu.select-all":"S\xE9lectionner tout","color.red":"Rouge","color.orange":"Orange","color.yellow":"Jaune","color.lime":"Citron vert","color.green":"Vert","color.teal":"Turquoise","color.cyan":"Cyan","color.blue":"Bleu","color.indigo":"Indigo","color.purple":"Violet","color.magenta":"Magenta","color.black":"Noir","color.dark-grey":"Gris fonc\xE9","color.grey":"Gris","color.light-grey":"Gris clair","color.white":"Blanc"},he:{"keyboard.tooltip.symbols":"\u05E1\u05DE\u05DC\u05D9\u05DD","keyboard.tooltip.greek":"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA \u05D9\u05D5\u05D5\u05E0\u05D9\u05D5\u05EA","keyboard.tooltip.numeric":"\u05DE\u05E1\u05E4\u05E8\u05D9","keyboard.tooltip.alphabetic":"\u05DE\u05DB\u05EA\u05D1\u05D9\u05DD \u05E8\u05D5\u05DE\u05D9\u05D9\u05DD","tooltip.copy to clipboard":"\u05D4\u05E2\u05EA\u05E7 \u05DC\u05DC\u05D5\u05D7","tooltip.redo":"\u05DC\u05B7\u05E2\u05B2\u05E9\u05C2\u05D5\u05B9\u05EA \u05E9\u05C1\u05D5\u05BC\u05D1","tooltip.toggle virtual keyboard":"\u05D4\u05D7\u05DC\u05E3 \u05D0\u05EA \u05D4\u05DE\u05E7\u05DC\u05D3\u05EA \u05D4\u05D5\u05D5\u05D9\u05E8\u05D8\u05D5\u05D0\u05DC\u05D9\u05EA","tooltip.undo":"\u05DC\u05D1\u05D8\u05DC","menu.insert matrix":"\u05D4\u05DB\u05E0\u05E1 \u05DE\u05D8\u05E8\u05D9\u05E7\u05E1","menu.borders":"\u05DE\u05E4\u05E8\u05D9\u05D3\u05D9 \u05DE\u05D8\u05E8\u05D9\u05E7\u05E1","menu.array.add row above":"\u05D4\u05D5\u05E1\u05E3 \u05E9\u05D5\u05E8\u05D4 \u05D0\u05D7\u05E8\u05D9","menu.array.add row below":"\u05D4\u05D5\u05E1\u05E3 \u05E9\u05D5\u05E8\u05D4 \u05DC\u05E4\u05E0\u05D9","menu.array.add column after":"\u05D4\u05D5\u05E1\u05E3 \u05E2\u05DE\u05D5\u05D3\u05D4 \u05D0\u05D7\u05E8\u05D9","menu.array.add column before":"\u05D4\u05D5\u05E1\u05E3 \u05E2\u05DE\u05D5\u05D3\u05D4 \u05DC\u05E4\u05E0\u05D9","menu.array.delete row":"\u05DE\u05D7\u05E7 \u05E9\u05D5\u05E8\u05D4","menu.array.delete rows":"\u05DE\u05D7\u05E7 \u05E9\u05D5\u05E8\u05D5\u05EA \u05E9\u05E0\u05D1\u05D7\u05E8\u05D5","menu.array.delete column":"\u05DE\u05D7\u05E7 \u05E2\u05DE\u05D5\u05D3\u05D4","menu.array.delete columns":"\u05DE\u05D7\u05E7 \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05E9\u05E0\u05D1\u05D7\u05E8\u05D5","menu.mode":"\u05DE\u05E6\u05D1","menu.mode-math":"\u05DE\u05EA\u05DE\u05D8\u05D9\u05E7\u05D4","menu.mode-text":"\u05D8\u05E7\u05E1\u05D8","menu.mode-latex":"LaTeX","tooltip.blackboard":"\u05DC\u05D5\u05D7 \u05E9\u05D7\u05D5\u05E8","tooltip.bold":"\u05DE\u05D5\u05D3\u05D2\u05E9","tooltip.italic":"\u05E0\u05D8\u05D5\u05D9","tooltip.fraktur":"\u05E4\u05E8\u05E7\u05D8\u05D5\u05E8","tooltip.script":"\u05DB\u05EA\u05D1","tooltip.caligraphic":"\u05E7\u05DC\u05D9\u05D2\u05E8\u05E4\u05D9","tooltip.typewriter":"\u05DE\u05DB\u05D5\u05E0\u05EA \u05DB\u05EA\u05D9\u05D1\u05D4","tooltip.roman-upright":"\u05E8\u05D5\u05DE\u05D9 \u05D9\u05E9\u05E8","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\u05E1\u05D2\u05E0\u05D5\u05DF \u05D2\u05D5\u05E4\u05DF","menu.accent":"\u05E6\u05DC\u05D9\u05DC","menu.decoration":"\u05E7\u05D9\u05E9\u05D5\u05D8","menu.color":"\u05E6\u05D1\u05E2","menu.background-color":"\u05E8\u05E7\u05E2","menu.evaluate":"\u05D7\u05E9\u05D1","menu.simplify":"\u05E4\u05E9\u05D8","menu.solve":"\u05E4\u05EA\u05D5\u05E8","menu.solve-for":"\u05E4\u05EA\u05D5\u05E8 \u05E2\u05D1\u05D5\u05E8 %@","menu.cut":"\u05D2\u05D6\u05D5\u05E8","menu.copy":"\u05D4\u05E2\u05EA\u05E7","menu.copy-as-latex":"\u05D4\u05E2\u05EA\u05E7 \u05DB\u05BELaTeX","menu.copy-as-ascii-math":"\u05D4\u05E2\u05EA\u05E7 \u05DB\u05BEASCII Math","menu.copy-as-mathml":"\u05D4\u05E2\u05EA\u05E7 \u05DB\u05BEMathML","menu.paste":"\u05D4\u05D3\u05D1\u05E7","menu.select-all":"\u05D1\u05D7\u05E8 \u05D4\u05DB\u05DC","color.red":"\u05D0\u05D3\u05D5\u05DD","color.orange":"\u05DB\u05EA\u05D5\u05DD","color.yellow":"\u05E6\u05D4\u05D5\u05D1","color.lime":"\u05D9\u05E8\u05D5\u05E7 \u05DC\u05D9\u05D9\u05DD","color.green":"\u05D9\u05E8\u05D5\u05E7","color.teal":"\u05D8\u05D9\u05DC","color.cyan":"\u05E6\u05D9\u05D0\u05DF","color.blue":"\u05DB\u05D7\u05D5\u05DC","color.indigo":"\u05D0\u05D9\u05E0\u05D3\u05D9\u05D2\u05D5","color.purple":"\u05E1\u05D2\u05D5\u05DC","color.magenta":"\u05DE\u05D2\u05E0\u05D8\u05D4","color.black":"\u05E9\u05D7\u05D5\u05E8","color.dark-grey":"\u05D0\u05E4\u05D5\u05E8 \u05DB\u05D4\u05D4","color.grey":"\u05D0\u05E4\u05D5\u05E8","color.light-grey":"\u05D0\u05E4\u05D5\u05E8 \u05D1\u05D4\u05D9\u05E8","color.white":"\u05DC\u05D1\u05DF"},it:{"keyboard.tooltip.symbols":"Simboli","keyboard.tooltip.greek":"Lettere greche","keyboard.tooltip.numeric":"Numerico","keyboard.tooltip.alphabetic":"Lettere romane","tooltip.copy to clipboard":"Copia negli appunti","tooltip.cut to clipboard":"Taglia negli appunti","tooltip.paste from clipboard":"Incolla dagli appunti","tooltip.redo":"Ripeti","tooltip.toggle virtual keyboard":"Attiva/disattiva tastiera virtuale","tooltip.menu":"Menu","tooltip.undo":"Annulla","menu.borders":"Delimitatori","menu.insert matrix":"Inserisci matrice","menu.array.add row above":"Aggiungi riga sopra","menu.array.add row below":"Aggiungi riga sotto","menu.array.add column after":"Aggiungi colonna dopo","menu.array.add column before":"Aggiungi colonna prima","menu.array.delete row":"Elimina riga","menu.array.delete rows":"Elimina righe selezionate","menu.array.delete column":"Elimina colonna","menu.array.delete columns":"Elimina colonne selezionate","menu.mode":"Modalit\xE0","menu.mode-math":"Matematica","menu.mode-text":"Testo","menu.mode-latex":"LaTeX","menu.insert":"Inserisci","menu.insert.abs":"Valore assoluto","menu.insert.abs-template":"\\left|x\\right|","menu.insert.nth-root":"Radice n-esima","menu.insert.nth-root-template":"\\sqrt[n]{x}","menu.insert.log-base":"Logaritmo in base a","menu.insert.log-base-template":"\\log_a(x)","menu.insert.heading-calculus":"Calcolo","menu.insert.derivative":"Derivata","menu.insert.derivative-template":"\\dfrac{\\mathrm{d}}{\\mathrm{d}x}f(x)\\bigm|_{x=a}","menu.insert.nth-derivative":"Derivata n-esima","menu.insert.nth-derivative-template":"\\dfrac{\\mathrm{d}^n}{\\mathrm{d}x^n}f(x)\\bigm|_{x=a}","menu.insert.integral":"Integrale","menu.insert.integral-template":"$\\int_a^b f(x)\\,\\mathrm{d}x$","menu.insert.sum":"Somma","menu.insert.sum-template":"$\\sum_{i=1}^n x_i$","menu.insert.product":"Prodotto","menu.insert.product-template":"\\prod_{i=1}^n x_i","menu.insert.heading-complex-numbers":"Numeri complessi","menu.insert.modulus":"Modulo","menu.insert.modulus-template":"\\lvert z \\rvert","menu.insert.argument":"Argomento","menu.insert.argument-template":"\\arg(z)","menu.insert.real-part":"Parte reale","menu.insert.real-part-template":"\\Re(z)","menu.insert.imaginary-part":"Parte immaginaria","menu.insert.imaginary-part-template":"\\Im(z)","menu.insert.conjugate":"Coniugato","menu.insert.conjugate-template":"\\overline{z}","tooltip.blackboard":"Lavagna","tooltip.bold":"Grassetto","tooltip.italic":"Corsivo","tooltip.fraktur":"Fraktur","tooltip.script":"Script","tooltip.caligraphic":"Calligrafico","tooltip.typewriter":"Macchina da scrivere","tooltip.roman-upright":"Romano diritto","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"Stile carattere","menu.accent":"Accento","menu.decoration":"Decorazione","menu.color":"Colore","menu.background-color":"Sfondo","menu.evaluate":"Valuta","menu.simplify":"Semplifica","menu.solve":"Risolvi","menu.solve-for":"Risolvi per %@","menu.cut":"Taglia","menu.copy":"Copia","menu.copy-as-latex":"Copia come LaTeX","menu.copy-as-ascii-math":"Copia come ASCII Math","menu.copy-as-mathml":"Copia come MathML","menu.paste":"Incolla","menu.select-all":"Seleziona tutto","color.red":"Rosso","color.orange":"Arancione","color.yellow":"Giallo","color.lime":"Lime","color.green":"Verde","color.teal":"Verde acqua","color.cyan":"Ciano","color.blue":"Blu","color.indigo":"Indaco","color.purple":"Viola","color.magenta":"Magenta","color.black":"Nero","color.dark-grey":"Grigio scuro","color.grey":"Grigio","color.light-grey":"Grigio chiaro","color.white":"Bianco"},ja:{"keyboard.tooltip.symbols":"\u30B7\u30F3\u30DC\u30EB","keyboard.tooltip.greek":"\u30AE\u30EA\u30B7\u30E3\u6587\u5B57","keyboard.tooltip.numeric":"\u6570\u5024","keyboard.tooltip.alphabetic":"\u30ED\u30FC\u30DE\u5B57","tooltip.menu":"\u30E1\u30CB\u30E5\u30FC","tooltip.copy to clipboard":"\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u306B\u30B3\u30D4\u30FC","tooltip.redo":"\u3084\u308A\u76F4\u3057","tooltip.toggle virtual keyboard":"\u4EEE\u60F3\u30AD\u30FC\u30DC\u30FC\u30C9\u306E\u5207\u308A\u66FF\u3048","tooltip.undo":"\u5143\u306B\u623B\u3059","menu.insert matrix":"\u30DE\u30C8\u30EA\u30C3\u30AF\u30B9\u3092\u633F\u5165","menu.borders":"\u884C\u5217\u533A\u5207\u308A\u6587\u5B57","menu.array.add row above":"\u5F8C\u306B\u884C\u3092\u8FFD\u52A0","menu.array.add row below":"\u524D\u306B\u884C\u3092\u8FFD\u52A0","menu.array.add column after":"\u5F8C\u306B\u5217\u3092\u8FFD\u52A0","menu.array.add column before":"\u524D\u306B\u5217\u3092\u8FFD\u52A0","menu.array.delete row":"\u884C\u3092\u524A\u9664","menu.array.delete rows":"\u9078\u629E\u3057\u305F\u884C\u3092\u524A\u9664\u3059\u308B","menu.array.delete column":"\u5217\u3092\u524A\u9664","menu.array.delete columns":"\u9078\u629E\u3057\u305F\u5217\u3092\u524A\u9664\u3059\u308B","menu.mode":"\u30E2\u30FC\u30C9","menu.mode-math":"\u6570\u5F0F","menu.mode-text":"\u30C6\u30AD\u30B9\u30C8","menu.mode-latex":"LaTeX","tooltip.blackboard":"\u9ED2\u677F","tooltip.bold":"\u592A\u5B57","tooltip.italic":"\u30A4\u30BF\u30EA\u30C3\u30AF","tooltip.fraktur":"\u30D5\u30E9\u30AF\u30C8\u30A5\u30FC\u30EB","tooltip.script":"\u30B9\u30AF\u30EA\u30D7\u30C8","tooltip.caligraphic":"\u30AB\u30EA\u30B0\u30E9\u30D5\u30A3\u30C3\u30AF","tooltip.typewriter":"\u30BF\u30A4\u30D7\u30E9\u30A4\u30BF\u30FC","tooltip.roman-upright":"\u30ED\u30FC\u30DE\u76F4\u7ACB","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\u30D5\u30A9\u30F3\u30C8\u30B9\u30BF\u30A4\u30EB","menu.accent":"\u30A2\u30AF\u30BB\u30F3\u30C8","menu.decoration":"\u88C5\u98FE","menu.color":"\u8272","menu.background-color":"\u80CC\u666F","menu.evaluate":"\u8A55\u4FA1","menu.simplify":"\u7C21\u7565\u5316","menu.solve":"\u89E3\u304F","menu.solve-for":"%@ \u3092\u89E3\u304F","menu.cut":"\u5207\u308A\u53D6\u308A","menu.copy":"\u30B3\u30D4\u30FC","menu.copy-as-latex":"LaTeX\u3068\u3057\u3066\u30B3\u30D4\u30FC","menu.copy-as-ascii-math":"ASCII Math\u3068\u3057\u3066\u30B3\u30D4\u30FC","menu.copy-as-mathml":"MathML\u3068\u3057\u3066\u30B3\u30D4\u30FC","menu.paste":"\u8CBC\u308A\u4ED8\u3051","menu.select-all":"\u3059\u3079\u3066\u9078\u629E","color.red":"\u8D64","color.orange":"\u30AA\u30EC\u30F3\u30B8","color.yellow":"\u9EC4\u8272","color.lime":"\u30E9\u30A4\u30E0","color.green":"\u7DD1","color.teal":"\u30C6\u30A3\u30FC\u30EB","color.cyan":"\u30B7\u30A2\u30F3","color.blue":"\u9752","color.indigo":"\u30A4\u30F3\u30C7\u30A3\u30B4","color.purple":"\u7D2B","color.magenta":"\u30DE\u30BC\u30F3\u30BF","color.black":"\u9ED2","color.dark-grey":"\u6FC3\u3044\u30B0\u30EC\u30FC","color.grey":"\u30B0\u30EC\u30FC","color.light-grey":"\u8584\u3044\u30B0\u30EC\u30FC","color.white":"\u767D"},ko:{"keyboard.tooltip.symbols":"\uAE30\uD638","keyboard.tooltip.greek":"\uADF8\uB9AC\uC2A4 \uBB38\uC790","keyboard.tooltip.numeric":"\uC22B\uC790","keyboard.tooltip.alphabetic":"\uB85C\uB9C8 \uBB38\uC790","tooltip.copy to clipboard":"\uD074\uB9BD \uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC","tooltip.redo":"\uB2E4\uC2DC \uC2E4\uD589","tooltip.toggle virtual keyboard":"\uAC00\uC0C1 \uD0A4\uBCF4\uB4DC \uC804\uD658","tooltip.undo":"\uC2E4\uD589 \uCDE8\uC18C","menu.insert matrix":"\uD589\uB82C \uC0BD\uC785","menu.borders":"\uD589\uB82C \uAD6C\uBD84 \uAE30\uD638","menu.array.add row above":"\uB4A4\uC5D0 \uD589 \uCD94\uAC00","menu.array.add row below":"\uC55E\uC5D0 \uD589 \uCD94\uAC00","menu.array.add column after":"\uB4A4\uC5D0 \uC5F4 \uCD94\uAC00","menu.array.add column before":"\uC55E\uC5D0 \uC5F4 \uCD94\uAC00","menu.array.delete row":"\uD589 \uC0AD\uC81C","menu.array.delete rows":"\uC120\uD0DD\uD55C \uD589 \uC0AD\uC81C","menu.array.delete column":"\uC5F4 \uC0AD\uC81C","menu.array.delete columns":"\uC120\uD0DD\uD55C \uC5F4 \uC0AD\uC81C","menu.mode":"\uBAA8\uB4DC","menu.mode-math":"\uC218\uC2DD","menu.mode-text":"\uD14D\uC2A4\uD2B8","menu.mode-latex":"LaTeX","tooltip.blackboard":"\uCE60\uD310","tooltip.bold":"\uAD75\uAC8C","tooltip.italic":"\uC774\uD0E4\uB9AD","tooltip.fraktur":"\uD504\uB799\uD22C\uC5B4","tooltip.script":"\uCCA8\uC790","tooltip.caligraphic":"\uD544\uAE30\uCCB4","tooltip.typewriter":"\uD0C0\uC790\uAE30","tooltip.roman-upright":"\uC77C\uBC18 \uB85C\uB9C8\uC790","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\uAE00\uAF34 \uC2A4\uD0C0\uC77C","menu.accent":"\uBC1C\uC74C \uAE30\uD638","menu.decoration":"\uC7A5\uC2DD","menu.color":"\uC0C9\uC0C1","menu.background-color":"\uBC30\uACBD","menu.evaluate":"\uD3C9\uAC00","menu.simplify":"\uAC04\uC18C\uD654","menu.solve":"\uD574\uACB0","menu.solve-for":"%@\uC5D0 \uB300\uD574 \uD574\uACB0","menu.cut":"\uC798\uB77C\uB0B4\uAE30","menu.copy":"\uBCF5\uC0AC","menu.copy-as-latex":"LaTeX\uB85C \uBCF5\uC0AC","menu.copy-as-ascii-math":"ASCIIMath\uB85C \uBCF5\uC0AC","menu.copy-as-mathml":"MathML\uB85C \uBCF5\uC0AC","menu.paste":"\uBD99\uC5EC\uB123\uAE30","menu.select-all":"\uBAA8\uB450 \uC120\uD0DD","color.red":"\uBE68\uAC15","color.orange":"\uC8FC\uD669","color.yellow":"\uB178\uB791","color.lime":"\uB77C\uC784","color.green":"\uCD08\uB85D","color.teal":"\uCCAD\uB85D","color.cyan":"\uCCAD\uC0C9","color.blue":"\uD30C\uB791","color.indigo":"\uB0A8\uC0C9","color.purple":"\uBCF4\uB77C","color.magenta":"\uC790\uD64D","color.black":"\uAC80\uC815","color.dark-grey":"\uC9C4\uD55C \uD68C\uC0C9","color.grey":"\uD68C\uC0C9","color.light-grey":"\uC5F0\uD55C \uD68C\uC0C9","color.white":"\uD770\uC0C9"},pl:{"keyboard.tooltip.symbols":"Symbolika","keyboard.tooltip.greek":"Litery greckie","keyboard.tooltip.numeric":"Numeryczne","keyboard.tooltip.alphabetic":"Litery rzymskie","tooltip.copy to clipboard":"Kopiuj do Schowka","tooltip.cut to clipboard":"Wytnij ze Schowka","tooltip.paste from clipboard":"Wklej ze Schowka","tooltip.redo":"Przywr\xF3\u0107","tooltip.toggle virtual keyboard":"Prze\u0142\u0105cz klawiatur\u0119 wirtualn\u0105","tooltip.menu":"Menu","tooltip.undo":"Cofnij","menu.borders":"Ograniczniki macierzy","menu.insert matrix":"Wstaw macierz","menu.array.add row above":"Dodaj wiersz przed","menu.array.add row below":"Dodaj wiersz po","menu.array.add column after":"Dodaj kolumn\u0119 po","menu.array.add column before":"Dodaj kolumn\u0119 przed","menu.array.delete row":"Usu\u0144 wiersz","menu.array.delete rows":"Usu\u0144 wybrane wiersze","menu.array.delete column":"Usu\u0144 kolumn\u0119","menu.array.delete columns":"Usu\u0144 wybrane kolumny","menu.mode":"Tryb","menu.mode-math":"Formu\u0142a","menu.mode-text":"Tekst","menu.mode-latex":"LaTeX","menu.insert":"Wstaw","menu.insert.abs":"Warto\u015B\u0107 bezwzgl\u0119dna","menu.insert.abs-template":"\\left|x\\right|","menu.insert.nth-root":"Pierwiastek n-tego stopnia","menu.insert.nth-root-template":"\\sqrt[n]{x}","menu.insert.log-base":"Logarytm o podstawie a","menu.insert.log-base-template":"\\log_a(x)","menu.insert.heading-calculus":"Rachunek r\xF3\u017Cniczkowy i ca\u0142kowy","menu.insert.derivative":"Pochodna","menu.insert.derivative-template":"\\dfrac{\\mathrm{d}}{\\mathrm{d}x}f(x)\\bigm|_{x=a}","menu.insert.nth-derivative":"Pochodna n-tego rz\u0119du","menu.insert.nth-derivative-template":"\\dfrac{\\mathrm{d}^n}{\\mathrm{d}x^n}f(x)\\bigm|_{x=a}","menu.insert.integral":"Ca\u0142ka","menu.insert.integral-template":"$\\int_a^b f(x)\\,\\mathrm{d}x$","menu.insert.sum":"Suma","menu.insert.sum-template":"$\\sum_{i=1}^n x_i$","menu.insert.product":"Iloczyn","menu.insert.product-template":"\\prod_{i=1}^n x_i","menu.insert.heading-complex-numbers":"Liczby zespolone","menu.insert.modulus":"Modu\u0142","menu.insert.modulus-template":"\\lvert z \\rvert","menu.insert.argument":"Argument","menu.insert.argument-template":"\\arg(z)","menu.insert.real-part":"Cz\u0119\u015B\u0107 rzeczywista","menu.insert.real-part-template":"\\Re(z)","menu.insert.imaginary-part":"Cz\u0119\u015B\u0107 urojona","menu.insert.imaginary-part-template":"\\Im(z)","menu.insert.conjugate":"Sprz\u0119\u017Cenie","menu.insert.conjugate-template":"\\overline{z}","tooltip.blackboard":"Tablica","tooltip.bold":"Pogrubienie","tooltip.italic":"Kursywa","tooltip.fraktur":"Fraktura","tooltip.script":"Skrypt","tooltip.caligraphic":"Kaligraficzny","tooltip.typewriter":"Maszynowy","tooltip.roman-upright":"Rzymski prosto","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"Styl czcionki","menu.accent":"Akcent","menu.decoration":"Dekoracja","menu.color":"Kolor","menu.background-color":"T\u0142o","menu.evaluate":"Oblicz","menu.simplify":"Upro\u015B\u0107","menu.solve":"Rozwi\u0105\u017C","menu.solve-for":"Rozwi\u0105\u017C dla %@","menu.cut":"Wytnij","menu.copy":"Kopiuj","menu.copy-as-latex":"Kopiuj jako LaTeX","menu.copy-as-ascii-math":"Kopiuj jako ASCII Math","menu.copy-as-mathml":"Kopiuj jako MathML","menu.paste":"Wklej","menu.select-all":"Zaznacz wszystko","color.red":"Czerwony","color.orange":"Pomara\u0144czowy","color.yellow":"\u017B\xF3\u0142ty","color.lime":"Limetkowy","color.green":"Zielony","color.teal":"Turkusowy","color.cyan":"Cyjan","color.blue":"Niebieski","color.indigo":"Indygo","color.purple":"Fioletowy","color.magenta":"Magenta","color.black":"Czarny","color.dark-grey":"Ciemnoszary","color.grey":"Szary","color.light-grey":"Jasnoszary","color.white":"Bia\u0142y"},pt:{"keyboard.tooltip.symbols":"S\xEDmbolos","keyboard.tooltip.greek":"Letras gregas","keyboard.tooltip.numeric":"Num\xE9rico","keyboard.tooltip.alphabetic":"Letras romanas","tooltip.copy to clipboard":"Copiar para \xE1rea de transfer\xEAncia","tooltip.redo":"Refazer","tooltip.toggle virtual keyboard":"Alternar teclado virtual","tooltip.undo":"Desfazer","menu.insert matrix":"Inserir Matriz","menu.borders":"Delimitadores de matriz","menu.array.add row above":"Adicionar linha depois","menu.array.add row below":"Adicionar linha antes","menu.array.add column after":"Adicionar coluna depois","menu.array.add column before":"Adicionar coluna antes","menu.array.delete row":"Excluir linha","menu.array.delete rows":"Excluir linhas selecionadas","menu.array.delete column":"Apagar Coluna","menu.array.delete columns":"Excluir Colunas Selecionadas","menu.mode":"Modo","menu.mode-math":"F\xF3rmula","menu.mode-text":"Texto","menu.mode-latex":"LaTeX","tooltip.blackboard":"Quadro Negro","tooltip.bold":"Negrito","tooltip.italic":"It\xE1lico","tooltip.fraktur":"Fraktur","tooltip.script":"Script","tooltip.caligraphic":"Caligr\xE1fico","tooltip.typewriter":"M\xE1quina de Escrever","tooltip.roman-upright":"Romano Vertical","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"Estilo da Fonte","menu.accent":"Acento","menu.decoration":"Decora\xE7\xE3o","menu.color":"Cor","menu.background-color":"Cor de Fundo","menu.evaluate":"Avaliar","menu.simplify":"Simplificar","menu.solve":"Resolver","menu.solve-for":"Resolver para %@","menu.cut":"Recortar","menu.copy":"Copiar","menu.copy-as-latex":"Copiar como LaTeX","menu.copy-as-ascii-math":"Copiar como ASCII Math","menu.copy-as-mathml":"Copiar como MathML","menu.paste":"Colar","menu.select-all":"Selecionar Tudo","color.red":"Vermelho","color.orange":"Laranja","color.yellow":"Amarelo","color.lime":"Verde Lima","color.green":"Verde","color.teal":"Verde-azulado","color.cyan":"Ciano","color.blue":"Azul","color.indigo":"\xCDndigo","color.purple":"Roxo","color.magenta":"Magenta","color.black":"Preto","color.dark-grey":"Cinza Escuro","color.grey":"Cinza","color.light-grey":"Cinza Claro","color.white":"Branco"},uk:{"keyboard.tooltip.symbols":"\u0421\u0438\u043C\u0432\u043E\u043B\u0438","keyboard.tooltip.greek":"\u0413\u0440\u0435\u0446\u044C\u043A\u0456 \u043B\u0456\u0442\u0435\u0440\u0438","keyboard.tooltip.numeric":"\u0427\u0438\u0441\u043B\u043E\u0432\u0438\u0439","keyboard.tooltip.alphabetic":"\u0420\u0438\u043C\u0441\u044C\u043A\u0456 \u043B\u0456\u0442\u0435\u0440\u0438","tooltip.copy to clipboard":"\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438 \u0432 \u0431\u0443\u0444\u0435\u0440 \u043E\u0431\u043C\u0456\u043D\u0443","tooltip.cut to clipboard":"\u0412\u0438\u0440\u0456\u0437\u0430\u0442\u0438 \u0432 \u0431\u0443\u0444\u0435\u0440 \u043E\u0431\u043C\u0456\u043D\u0443","tooltip.paste from clipboard":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043E\u0431\u043C\u0456\u043D\u0443","tooltip.redo":"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438","tooltip.toggle virtual keyboard":"\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u0438 \u0432\u0456\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u0443 \u043A\u043B\u0430\u0432\u0456\u0430\u0442\u0443\u0440\u0443","tooltip.menu":"\u041C\u0435\u043D\u044E","tooltip.undo":"\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438","menu.borders":"\u041C\u0435\u0436\u0456","menu.insert matrix":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u043C\u0430\u0442\u0440\u0438\u0446\u044E","menu.array.add row above":"\u0414\u043E\u0434\u0430\u0442\u0438 \u0440\u044F\u0434\u043E\u043A \u043F\u0435\u0440\u0435\u0434","menu.array.add row below":"\u0414\u043E\u0434\u0430\u0442\u0438 \u0440\u044F\u0434\u043E\u043A \u043F\u0456\u0441\u043B\u044F","menu.array.add column after":"\u0414\u043E\u0434\u0430\u0442\u0438 \u0441\u0442\u043E\u0432\u043F\u0435\u0446\u044C \u043F\u0456\u0441\u043B\u044F","menu.array.add column before":"\u0414\u043E\u0434\u0430\u0442\u0438 \u0441\u0442\u043E\u0432\u043F\u0435\u0446\u044C \u043F\u0435\u0440\u0435\u0434","menu.array.delete row":"\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0440\u044F\u0434\u043E\u043A","menu.array.delete rows":"\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0432\u0438\u0431\u0440\u0430\u043D\u0456 \u0440\u044F\u0434\u043A\u0438","menu.array.delete column":"\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0441\u0442\u043E\u0432\u043F\u0435\u0446\u044C","menu.array.delete columns":"\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0432\u0438\u0431\u0440\u0430\u043D\u0456 \u0441\u0442\u043E\u0432\u043F\u0446\u0456","menu.mode":"\u0420\u0435\u0436\u0438\u043C","menu.mode-math":"\u041C\u0430\u0442\u0435\u043C\u0430\u0442\u0438\u043A\u0430","menu.mode-text":"\u0422\u0435\u043A\u0441\u0442","menu.mode-latex":"LaTeX","menu.insert":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438","menu.insert.abs":"\u0410\u0431\u0441\u043E\u043B\u044E\u0442\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F","menu.insert.abs-template":"\\left|x\\right|","menu.insert.nth-root":"\u041A\u043E\u0440\u0456\u043D\u044C n-\u0433\u043E \u0441\u0442\u0435\u043F\u0435\u043D\u044F","menu.insert.nth-root-template":"\\sqrt[n]{x}","menu.insert.log-base":"\u041B\u043E\u0433\u0430\u0440\u0438\u0444\u043C \u0437\u0430 \u043E\u0441\u043D\u043E\u0432\u043E\u044E a","menu.insert.log-base-template":"\\log_a(x)","menu.insert.heading-calculus":"\u041E\u0431\u0447\u0438\u0441\u043B\u0435\u043D\u043D\u044F","menu.insert.derivative":"\u041F\u043E\u0445\u0456\u0434\u043D\u0430","menu.insert.derivative-template":"\\dfrac{\\mathrm{d}}{\\mathrm{d}x}f(x)\\bigm|_{x=a}","menu.insert.nth-derivative":"\u041F\u043E\u0445\u0456\u0434\u043D\u0430 n-\u0433\u043E \u043F\u043E\u0440\u044F\u0434\u043A\u0443","menu.insert.nth-derivative-template":"\\dfrac{\\mathrm{d}^n}{\\mathrm{d}x^n}f(x)\\bigm|_{x=a}","menu.insert.integral":"\u0406\u043D\u0442\u0435\u0433\u0440\u0430\u043B","menu.insert.integral-template":"$\\int_a^b f(x)\\,\\mathrm{d}x$","menu.insert.sum":"\u0421\u0443\u043C\u0430","menu.insert.sum-template":"$\\sum_{i=1}^n x_i$","menu.insert.product":"\u0414\u043E\u0431\u0443\u0442\u043E\u043A","menu.insert.product-template":"\\prod_{i=1}^n x_i","menu.insert.heading-complex-numbers":"\u041A\u043E\u043C\u043F\u043B\u0435\u043A\u0441\u043D\u0456 \u0447\u0438\u0441\u043B\u0430","menu.insert.modulus":"\u041C\u043E\u0434\u0443\u043B\u044C","menu.insert.modulus-template":"\\lvert z \\rvert","menu.insert.argument":"\u0410\u0440\u0433\u0443\u043C\u0435\u043D\u0442","menu.insert.argument-template":"\\arg(z)","menu.insert.real-part":"\u0414\u0456\u0439\u0441\u043D\u0430 \u0447\u0430\u0441\u0442\u0438\u043D\u0430","menu.insert.real-part-template":"\\Re(z)","menu.insert.imaginary-part":"\u0423\u044F\u0432\u043D\u0430 \u0447\u0430\u0441\u0442\u0438\u043D\u0430","menu.insert.imaginary-part-template":"\\Im(z)","menu.insert.conjugate":"\u0421\u043F\u0440\u044F\u0436\u0435\u043D\u0435 \u0447\u0438\u0441\u043B\u043E","menu.insert.conjugate-template":"\\overline{z}","tooltip.blackboard":"\u0414\u043E\u0448\u043A\u0430","tooltip.bold":"\u0416\u0438\u0440\u043D\u0438\u0439","tooltip.italic":"\u041A\u0443\u0440\u0441\u0438\u0432","tooltip.fraktur":"\u0424\u0440\u0430\u043A\u0442\u0443\u0440\u043D\u0438\u0439","tooltip.script":"\u0420\u0443\u043A\u043E\u043F\u0438\u0441\u043D\u0438\u0439","tooltip.caligraphic":"\u041A\u0430\u043B\u0456\u0433\u0440\u0430\u0444\u0456\u0447\u043D\u0438\u0439","tooltip.typewriter":"\u0414\u0440\u0443\u043A\u0430\u0440\u0441\u044C\u043A\u0438\u0439","tooltip.roman-upright":"\u041F\u0440\u044F\u043C\u0438\u0439 \u0440\u0438\u043C\u0441\u044C\u043A\u0438\u0439","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\u0421\u0442\u0438\u043B\u044C \u0448\u0440\u0438\u0444\u0442\u0443","menu.accent":"\u0410\u043A\u0446\u0435\u043D\u0442","menu.decoration":"\u041E\u0444\u043E\u0440\u043C\u043B\u0435\u043D\u043D\u044F","menu.color":"\u041A\u043E\u043B\u0456\u0440","menu.background-color":"\u0424\u043E\u043D","menu.evaluate":"\u041E\u0431\u0447\u0438\u0441\u043B\u0438\u0442\u0438","menu.simplify":"\u0421\u043F\u0440\u043E\u0441\u0442\u0438\u0442\u0438","menu.solve":"\u0420\u043E\u0437\u0432\u2019\u044F\u0437\u0430\u0442\u0438","menu.solve-for":"\u0420\u043E\u0437\u0432\u2019\u044F\u0437\u0430\u0442\u0438 \u0434\u043B\u044F %@","menu.cut":"\u0412\u0438\u0440\u0456\u0437\u0430\u0442\u0438","menu.copy":"\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438","menu.copy-as-latex":"\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438 \u044F\u043A LaTeX","menu.copy-as-ascii-math":"\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438 \u044F\u043A ASCII Math","menu.copy-as-mathml":"\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438 \u044F\u043A MathML","menu.paste":"\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438","menu.select-all":"\u0412\u0438\u0431\u0440\u0430\u0442\u0438 \u0432\u0441\u0435","color.red":"\u0427\u0435\u0440\u0432\u043E\u043D\u0438\u0439","color.orange":"\u041F\u043E\u043C\u0430\u0440\u0430\u043D\u0447\u0435\u0432\u0438\u0439","color.yellow":"\u0416\u043E\u0432\u0442\u0438\u0439","color.lime":"\u041B\u0430\u0439\u043C\u043E\u0432\u0438\u0439","color.green":"\u0417\u0435\u043B\u0435\u043D\u0438\u0439","color.teal":"\u0411\u0456\u0440\u044E\u0437\u043E\u0432\u0438\u0439","color.cyan":"\u0421\u0438\u043D\u044C\u043E-\u0437\u0435\u043B\u0435\u043D\u0438\u0439","color.blue":"\u0421\u0438\u043D\u0456\u0439","color.indigo":"\u0406\u043D\u0434\u0438\u0433\u043E","color.purple":"\u0424\u0456\u043E\u043B\u0435\u0442\u043E\u0432\u0438\u0439","color.magenta":"\u041F\u0443\u0440\u043F\u0443\u0440\u043D\u0438\u0439","color.black":"\u0427\u043E\u0440\u043D\u0438\u0439","color.dark-grey":"\u0422\u0435\u043C\u043D\u043E-\u0441\u0456\u0440\u0438\u0439","color.grey":"\u0421\u0456\u0440\u0438\u0439","color.light-grey":"\u0421\u0432\u0456\u0442\u043B\u043E-\u0441\u0456\u0440\u0438\u0439","color.white":"\u0411\u0456\u043B\u0438\u0439"},"zh-cn":{"keyboard.tooltip.symbols":"\u7B26\u53F7","keyboard.tooltip.greek":"\u5E0C\u814A\u5B57\u6BCD","keyboard.tooltip.numeric":"\u6570\u5B57","keyboard.tooltip.alphabetic":"\u7F57\u9A6C\u5B57\u6BCD","tooltip.copy to clipboard":"\u590D\u5236\u5230\u526A\u8D34\u677F","tooltip.redo":"\u91CD\u505A","tooltip.toggle virtual keyboard":"\u5207\u6362\u865A\u62DF\u952E\u76D8","tooltip.undo":"\u64A4\u6D88","menu.insert matrix":"\u63D2\u5165\u77E9\u9635","menu.borders":"\u77E9\u9635\u5206\u9694\u7B26","menu.array.add row above":"\u5728\u540E\u9762\u6DFB\u52A0\u884C","menu.array.add row below":"\u5728\u524D\u9762\u6DFB\u52A0\u884C","menu.array.add column after":"\u5728\u540E\u9762\u6DFB\u52A0\u5217r","menu.array.add column before":"\u5728\u524D\u9762\u6DFB\u52A0\u5217","menu.array.delete row":"\u5220\u9664\u884C","menu.array.delete rows":"\u5220\u9664\u9009\u5B9A\u884C","menu.array.delete column":"\u5220\u9664\u5217","menu.array.delete columns":"\u5220\u9664\u9009\u5B9A\u7684\u5217","menu.mode":"\u6A21\u5F0F","menu.mode-math":"\u6570\u5B66","menu.mode-text":"\u6587\u672C","menu.mode-latex":"LaTeX","tooltip.blackboard":"\u9ED1\u677F","tooltip.bold":"\u7C97\u4F53","tooltip.italic":"\u659C\u4F53","tooltip.fraktur":"Fraktur","tooltip.script":"\u811A\u672C","tooltip.caligraphic":"\u8349\u4E66","tooltip.typewriter":"\u6253\u5B57\u673A","tooltip.roman-upright":"\u7F57\u9A6C\u76F4\u7ACB","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\u5B57\u4F53\u6837\u5F0F","menu.accent":"\u91CD\u97F3","menu.decoration":"\u88C5\u9970","menu.color":"\u989C\u8272","menu.background-color":"\u80CC\u666F","menu.evaluate":"\u8BA1\u7B97","menu.simplify":"\u7B80\u5316","menu.solve":"\u6C42\u89E3","menu.solve-for":"\u6C42\u89E3 %@","menu.cut":"\u526A\u5207","menu.copy":"\u590D\u5236","menu.copy-as-latex":"\u590D\u5236\u4E3A LaTeX","menu.copy-as-ascii-math":"\u590D\u5236\u4E3A ASCII Math","menu.copy-as-mathml":"\u590D\u5236\u4E3A MathML","menu.paste":"\u7C98\u8D34","menu.select-all":"\u5168\u9009","color.red":"\u7EA2\u8272","color.orange":"\u6A59\u8272","color.yellow":"\u9EC4\u8272","color.lime":"\u7EFF\u9EC4\u8272","color.green":"\u7EFF\u8272","color.teal":"\u9752\u8272","color.cyan":"\u84DD\u7EFF\u8272","color.blue":"\u84DD\u8272","color.indigo":"\u975B\u84DD\u8272","color.purple":"\u7D2B\u8272","color.magenta":"\u6D0B\u7EA2\u8272","color.black":"\u9ED1\u8272","color.dark-grey":"\u6DF1\u7070\u8272","color.grey":"\u7070\u8272","color.light-grey":"\u6D45\u7070\u8272","color.white":"\u767D\u8272"},"zh-tw":{"keyboard.tooltip.symbols":"\u7B26\u865F","keyboard.tooltip.greek":"\u5E0C\u81D8\u5B57\u6BCD","keyboard.tooltip.numeric":"\u6578\u5B57","keyboard.tooltip.alphabetic":"\u7F85\u99AC\u5B57\u6BCD","tooltip.copy to clipboard":"\u8907\u88FD\u5230\u526A\u8CBC\u677F","tooltip.redo":"\u91CD\u505A","tooltip.toggle virtual keyboard":"\u5207\u63DB\u865B\u64EC\u9375\u76E4","tooltip.undo":"\u64A4\u6D88","menu.insert matrix":"\u63D2\u5165\u77E9\u9663","menu.borders":"\u77E9\u9663\u5206\u9694\u7B26","menu.array.add row above":"\u5728\u5F8C\u9762\u6DFB\u52A0\u884C","menu.array.add row below":"\u5728\u524D\u9762\u6DFB\u52A0\u884C","menu.array.add column after":"\u5728\u5F8C\u9762\u6DFB\u52A0\u5217","menu.array.add column before":"\u5728\u524D\u9762\u6DFB\u52A0\u5217","menu.array.delete row":"\u522A\u9664\u884C","menu.array.delete rows":"\u522A\u9664\u9078\u5B9A\u884C","menu.array.delete column":"\u522A\u9664\u5217","menu.array.delete columns":"\u522A\u9664\u9078\u5B9A\u7684\u5217","menu.mode":"\u6A21\u5F0F","menu.mode-math":"\u6578\u5B78","menu.mode-text":"\u6587\u672C","menu.mode-latex":"LaTeX","tooltip.blackboard":"\u9ED1\u677F","tooltip.bold":"\u7C97\u9AD4","tooltip.italic":"\u659C\u9AD4","tooltip.fraktur":"Fraktur","tooltip.script":"\u8173\u672C","tooltip.caligraphic":"\u8349\u66F8","tooltip.typewriter":"\u6253\u5B57\u6A5F","tooltip.roman-upright":"\u7F85\u99AC\u76F4\u7ACB","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\u5B57\u9AD4\u6A23\u5F0F","menu.accent":"\u91CD\u97F3","menu.decoration":"\u88DD\u98FE","menu.color":"\u984F\u8272","menu.background-color":"\u80CC\u666F","menu.evaluate":"\u8A08\u7B97","menu.simplify":"\u7C21\u5316","menu.solve":"\u6C42\u89E3","menu.solve-for":"\u6C42\u89E3 %@","menu.cut":"\u526A\u4E0B","menu.copy":"\u8907\u88FD","menu.copy-as-latex":"\u8907\u88FD\u70BA LaTeX","menu.copy-as-ascii-math":"\u8907\u88FD\u70BA ASCII Math","menu.copy-as-mathml":"\u8907\u88FD\u70BA MathML","menu.paste":"\u8CBC\u4E0A","menu.select-all":"\u5168\u9078","color.red":"\u7D05\u8272","color.orange":"\u6A59\u8272","color.yellow":"\u9EC3\u8272","color.lime":"\u7DA0\u9EC3\u8272","color.green":"\u7DA0\u8272","color.teal":"\u9752\u8272","color.cyan":"\u85CD\u7DA0\u8272","color.blue":"\u85CD\u8272","color.indigo":"\u975B\u85CD\u8272","color.purple":"\u7D2B\u8272","color.magenta":"\u6D0B\u7D05\u8272","color.black":"\u9ED1\u8272","color.dark-grey":"\u6DF1\u7070\u8272","color.grey":"\u7070\u8272","color.light-grey":"\u6DFA\u7070\u8272","color.white":"\u767D\u8272"}};var F={strings:Au,_locale:"",_dirty:!1,_subscribers:[],_numberFormatter:void 0,get locale(){return F._locale||(F._locale=ke()?navigator.language.slice(0,5):"en-US"),F._locale},set locale(t){F._locale=t,F._numberFormatter=void 0,F.dirty=!0},get numberFormatter(){if(!F._numberFormatter)try{F._numberFormatter=new Intl.NumberFormat(F.locale)}catch(t){try{F._numberFormatter=new Intl.NumberFormat(F.locale.slice(0,2))}catch(e){F._numberFormatter=new Intl.NumberFormat("en-US")}}return F._numberFormatter},merge(t,e){if(typeof t=="string"&&e)F.strings[t]=p(p({},F.strings[t]),e),F.dirty=!0;else for(let r of Object.keys(t))F.merge(r,t[r])},get dirty(){return F._dirty},set dirty(t){F._dirty||F._dirty===t||(F._dirty=!0,setTimeout(()=>{F._dirty=!1,this._subscribers.forEach(e=>e==null?void 0:e())},0))},subscribe(t){return F._subscribers.push(t),F._subscribers.length-1},unsubscribe(t){t<0||t>=F._subscribers.length||(F._subscribers[t]=void 0)},update(t){let e=t.querySelectorAll("[data-l10n-tooltip]");for(let r of e){let i=r.getAttribute("data-l10n-tooltip");if(i){let n=I(i);n&&r.setAttribute("data-tooltip",n)}}e=t.querySelectorAll("[data-l10n-arial-label]");for(let r of e){let i=r.getAttribute("data-l10n-arial-label");if(i){let n=I(i);n&&r.setAttribute("aria-label",n)}}}};function I(t,...e){if(t===void 0)return;let r="",i=F.locale;F.strings[i]&&(r=F.strings[i][t]);let n=i.slice(0,2);if(!r&&F.strings[n]&&(r=F.strings[n][t]),r||(r=F.strings.en[t]),!r)return;let o=/(%@|%([0-9]+)\$@)/g,a=o.exec(r),s=0;for(;a;){if(e[s++]){let c=a[2]?parseInt(a[2],10)-1:s-1,u=e[c];typeof u=="number"&&(u=F.numberFormatter.format(u)),r=r.replace(a[1],u)}a=o.exec(r)}return r=r.replace(/%%/g,"%"),r}var Yh={m0:"#3F3D99",m1:"#993D71",m2:"#998B3D",m3:"#3D9956",m4:"#3D5A99",m5:"#993D90",m6:"#996D3D",m7:"#43993D",m8:"#3D7999",m9:"#843D99"},Qh={blue:"#0072BD",orange:"#D95319",yellow:"#EDB120",purple:"#7E2F8E",green:"#77AC30",cyan:"#4DBEEE",red:"#A2142F"},Zt={red:"#fbbbb6",orange:"#ffe0c2",yellow:"#fff1c2",lime:"#d0e8b9",green:"#bceac4",teal:"#b9f1f1",cyan:"#b8e5c9",blue:"#b6d9fb",indigo:"#d1c2f0",purple:"#e3baf8",magenta:"#f9c8e0",black:"#353535","dark-grey":"#8C8C8C",grey:"#D0D0D0","light-grey":"#F0F0F0",white:"#ffffff"},Yt={red:"#d7170b",orange:"#fe8a2b",yellow:"#ffc02b",lime:"#63b215",green:"#21ba3a",teal:"#17cfcf",cyan:"#13a7ec",blue:"#0d80f2",indigo:"#63c",purple:"#a219e6",magenta:"#eb4799",black:"#000","dark-grey":"#666",grey:"#A6A6A6","light-grey":"#d4d5d2",white:"#ffffff"},Cu={Red:"red",Orange:"orange",Yellow:"yellow",LimeGreen:"lime",Green:"green",TealBlue:"teal",Blue:"blue",Violet:"indigo",Purple:"purple",Magenta:"magenta",Black:"black",Gray:"grey",White:"white"},ef={Apricot:"#FBB982",Aquamarine:"#00B5BE",Bittersweet:"#C04F17",Black:"#221E1F",Blue:"#2D2F92",BlueGreen:"#00B3B8",BlueViolet:"#473992",BrickRed:"#B6321C",Brown:"#792500",BurntOrange:"#F7921D",CadetBlue:"#74729A",CarnationPink:"#F282B4",Cerulean:"#00A2E3",CornflowerBlue:"#41B0E4",Cyan:"#00AEEF",Dandelion:"#FDBC42",DarkOrchid:"#A4538A",Emerald:"#00A99D",ForestGreen:"#009B55",Fuchsia:"#8C368C",Goldenrod:"#FFDF42",Gray:"#949698",Green:"#00A64F",GreenYellow:"#DFE674",JungleGreen:"#00A99A",Lavender:"#F49EC4",Limegreen:"#8DC73E",Magenta:"#EC008C",Mahogany:"#A9341F",Maroon:"#AF3235",Melon:"#F89E7B",MidnightBlue:"#006795",Mulberry:"#A93C93",NavyBlue:"#006EB8",OliveGreen:"#3C8031",Orange:"#F58137",OrangeRed:"#ED135A",Orchid:"#AF72B0",Peach:"#F7965A",Periwinkle:"#7977B8",PineGreen:"#008B72",Plum:"#92268F",ProcessBlue:"#00B0F0",Purple:"#99479B",RawSienna:"#974006",Red:"#ED1B23",RedOrange:"#F26035",RedViolet:"#A1246B",Rhodamine:"#EF559F",RoyalBlue:"#0071BC",RoyalPurple:"#613F99",RubineRed:"#ED017D",Salmon:"#F69289",SeaGreen:"#3FBC9D",Sepia:"#671800",SkyBlue:"#46C5DD",SpringGreen:"#C6DC67",Tan:"#DA9D76",TealBlue:"#00AEB3",Thistle:"#D883B7",Turquoise:"#00B4CE",Violet:"#58429B",VioletRed:"#EF58A0",White:"#FFFFFF",WildStrawberry:"#EE2967",Yellow:"#FFF200",YellowGreen:"#98CC70",YellowOrange:"#FAA21A"};function Xr(t){var u,m,d,h,f,x;let e=t.split("!"),r,i,n,o=255,a=255,s=255,l=-1,c=e.length>0&&e[0].startsWith("-");c&&(e[0]=e[0].slice(1));for(let _=0;_=0&&(o=(1-l)*o+l*r,a=(1-l)*a+l*i,s=(1-l)*s+l*n,l=-1),_+1=0&&(o=l*o+(1-l)*r,a=l*a+(1-l)*i,s=l*s+(1-l)*n),c&&(o=255-o,a=255-a,s=255-s),"#"+("00"+Math.round(o).toString(16)).slice(-2)+("00"+Math.round(a).toString(16)).slice(-2)+("00"+Math.round(s).toString(16)).slice(-2)}function Ei(t){var e,r;return t=t.trim(),(r=(e=Zt[t.toLowerCase()])!=null?e:Zt[Cu[t]])!=null?r:Xr(t)}function tf(t){if(!t||t[0]!=="#")return;t=t.slice(1);let e;return t.length<=4?(e={r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)},t.length===4&&(e.a=parseInt(t[3]+t[3],16)/255)):(e={r:parseInt(t[0]+t[1],16),g:parseInt(t[2]+t[3],16),b:parseInt(t[4]+t[5],16)},t.length===8&&(e.a=parseInt(t[6]+t[7],16)/255)),e&&e.a===void 0&&(e.a=1),e}function ol(t,e,r){return r<0&&(r+=6),r>=6&&(r-=6),r<1?(e-t)*r+t:r<3?e:r<4?(e-t)*(4-r)+t:t}function rf(t){let[e,r,i]=[t.h,t.s,t.l];e=(e+360)%360/60,i=Math.max(0,Math.min(i,1)),r=Math.max(0,Math.min(r,1));let n=i<=.5?i*(r+1):i+r-i*r,o=i*2-n;return{r:Math.round(255*ol(o,n,e+2)),g:Math.round(255*ol(o,n,e)),b:Math.round(255*ol(o,n,e-2))}}function al(t){return t<0?0:t>255?255:Math.round(t)}function nf(t){let{r:e,g:r,b:i}=t,n=((1<<24)+(al(e)<<16)+(al(r)<<8)+al(i)).toString(16).slice(1);return n[0]===n[1]&&n[2]===n[3]&&n[4]===n[5]&&n[6]===n[7]&&(n=n[0]+n[2]+n[4]),"#"+n}function of(t){let{r:e,g:r,b:i}=t;e=e/255,r=r/255,i=i/255;let n=Math.min(e,r,i),o=Math.max(e,r,i),a=o-n,s,l;o===n?s=0:e===o?s=(r-i)/a:r===o?s=2+(i-e)/a:i===o&&(s=4+(e-r)/a),s=Math.min(s*60,360),s<0&&(s+=360);let c=(n+o)/2;return o===n?l=0:c<=.5?l=a/(o+n):l=a/(2-o-n),{h:s,s:l,l:c}}function Eu(t){let e=tf(t);if(!e)return t;let{h:r,s:i,l:n}=of(e);return i+=.1,n-=.1,nf(rf({h:r,s:i,l:n}))}var ll={60:"\\lt",62:"\\gt",111:"o",38:"\\&",123:"\\lbrace",125:"\\rbrace",91:"\\lbrack",93:"\\rbrack",58:"\\colon",160:"~",172:"\\neg",183:"\\cdot",188:"\\frac{1}{4}",189:"\\frac{1}{2}",190:"\\frac{3}{4}",8304:"^{0}",8305:"^{i}",185:"^{1}",178:"^{2}",179:"^{3}",8224:"\\dagger",8225:"\\ddagger",8230:"\\ldots",8308:"^{4}",8309:"^{5}",8310:"^{6}",8311:"^{7}",8312:"^{8}",8313:"^{9}",8314:"^{+}",8315:"^{-}",8316:"^{=}",8319:"^{n}",8320:"_{0}",8321:"_{1}",8322:"_{2}",8323:"_{3}",8324:"_{4}",8325:"_{5}",8326:"_{6}",8327:"_{7}",8328:"_{8}",8329:"_{9}",8330:"_{+}",8331:"_{-}",8332:"_{=}",8336:"_{a}",8337:"_{e}",8338:"_{o}",8339:"_{x}",8242:"\\prime",39:"\\prime",8592:"\\gets",8594:"\\to",9651:"\\triangle",9661:"\\triangledown",8715:"\\owns",8727:"\\ast",8739:"\\vert",8741:"\\Vert",8743:"\\land",8744:"\\lor",8901:"\\cdot",8904:"\\bowtie",8800:"\\ne",8804:"\\le",8805:"\\ge",8869:"\\bot",10178:"\\perp",10231:"\\biconditional",10232:"\\impliedby",10233:"\\implies",10234:"\\iff",8450:"\\mathbb{C}",8469:"\\mathbb{N}",8473:"\\mathbb{P}",8474:"\\mathbb{Q}",8477:"\\mathbb{R}",8484:"\\mathbb{Z}",8461:"\\mathbb{H}",8476:"\\Re",8465:"\\Im",42:"\\ast",11036:"\\square",9633:"\\square",8720:"\\coprod",8716:"\\not\\ni",9671:"\\diamond",8846:"\\uplus",8851:"\\sqcap",8852:"\\sqcup",8768:"\\wr",8750:"\\oint",8226:"\\textbullet",8722:"-",978:"\\Upsilon"},sl={119893:8462,119965:8492,119968:8496,119969:8497,119971:8459,119972:8464,119975:8466,119976:8499,119981:8475,119994:8495,119996:8458,120004:8500,120070:8493,120075:8460,120076:8465,120085:8476,120093:8488,120122:8450,120127:8461,120133:8469,120135:8473,120136:8474,120137:8477,120145:8484},Tu=[{start:119808,len:26,offset:65,style:"bold"},{start:119834,len:26,offset:97,style:"bold"},{start:120488,len:25,offset:913,style:"bold"},{start:120514,len:25,offset:945,style:"bold"},{start:119860,len:26,offset:65,style:"italic"},{start:119886,len:26,offset:97,style:"italic"},{start:120546,len:25,offset:913,style:"italic"},{start:120572,len:25,offset:945,style:"italic"},{start:119912,len:26,offset:65,style:"bolditalic"},{start:119938,len:26,offset:97,style:"bolditalic"},{start:120604,len:25,offset:913,style:"bolditalic"},{start:120630,len:25,offset:945,style:"bolditalic"},{start:120782,len:10,offset:48,variant:"main",style:"bold"},{start:119964,len:26,offset:65,variant:"script"},{start:119990,len:26,offset:97,variant:"script"},{start:120016,len:26,offset:65,variant:"script",style:"bold"},{start:120042,len:26,offset:97,variant:"script",style:"bold"},{start:120068,len:26,offset:65,variant:"fraktur"},{start:120094,len:26,offset:97,variant:"fraktur"},{start:120172,len:26,offset:65,variant:"fraktur",style:"bold"},{start:120198,len:26,offset:97,variant:"fraktur",style:"bold"},{start:120120,len:26,offset:65,variant:"double-struck"},{start:120146,len:26,offset:97,variant:"double-struck"},{start:120792,len:10,offset:48,variant:"double-struck"},{start:120432,len:26,offset:65,variant:"monospace"},{start:120458,len:26,offset:97,variant:"monospace"},{start:120822,len:10,offset:48,variant:"monospace"},{start:120224,len:26,offset:65,variant:"sans-serif"},{start:120250,len:26,offset:97,variant:"sans-serif"},{start:120276,len:26,offset:65,variant:"sans-serif",style:"bold"},{start:120302,len:26,offset:97,variant:"sans-serif",style:"bold"},{start:120328,len:26,offset:65,variant:"sans-serif",style:"italic"},{start:120354,len:26,offset:97,variant:"sans-serif",style:"italic"},{start:120380,len:26,offset:65,variant:"sans-serif",style:"bolditalic"},{start:120406,len:26,offset:97,variant:"sans-serif",style:"bolditalic"},{start:120662,len:25,offset:913,variant:"sans-serif",style:"bold"},{start:120688,len:25,offset:945,variant:"sans-serif",style:"bold"},{start:120720,len:25,offset:913,variant:"sans-serif",style:"bolditalic"},{start:120746,len:25,offset:945,variant:"sans-serif",style:"bolditalic"},{start:120803,len:10,offset:48,variant:"sans-serif"},{start:120812,len:10,offset:48,variant:"sans-serif",style:"bold"}];function On(t,e,r){if(!/[A-Za-z\d]/.test(t)||(r==="up"&&(r=void 0),!e&&!r))return;let i=t.codePointAt(0);if(i===void 0)return t;for(let n of Tu)if((!e||n.variant===e)&&(!r||n.style===r)&&i>=n.offset&&i120831)&&(t<8448||t>8527))return{char:String.fromCodePoint(t)};for(let r in sl)if(sl[r]===t){t=(e=r.codePointAt(0))!=null?e:0;break}for(let r of Tu)if(t>=r.start&&t[]$&*#^_%:'\u02DC".includes(t)||t.length>1)return;let e=(a=t.codePointAt(0))!=null?a:0,r=ll[e];if(r)return r;let{char:i,variant:n,style:o}=af(e);if(!(!n&&!o)){switch(r=i,n){case"double-struck":r=`\\mathbb{${r}}`;break;case"fraktur":r=`\\mathfrak{${r}}`;break;case"script":r=`\\mathscr{${r}}`;break;case"sans-serif":r=`\\mathsf{${r}}`;break;case"monospace":r=`\\mathtt{${r}}`;break;case"calligraphic":r=`\\mathcal{${r}}`;break}switch(o){case"bold":r=`\\mathbf{${r}}`;break;case"italic":r=`\\mathit{${r}}`;break;case"bolditalic":r=`\\mathbfit{${r}}`;break}return r}}function E(t){return t?Array.isArray(t)?t:typeof t=="object"&&"group"in t?t.group:[]:[]}var Bn={},Jo=p({},ll),Di={},ul={},sf={darr:"\\downarrow",dArr:"\\Downarrow",Darr:"\\Downarrow",lang:"\\langle",rang:"\\rangle",uarr:"\\uparrow",uArr:"\\Uparrow",Uarr:"\\Uparrow",C:"\\mathbb{C}",H:"\\mathbb{H}",N:"\\mathbb{N}",Q:"\\mathbb{Q}",R:"\\mathbb{R}",Z:"\\mathbb{Z}",alef:"\\aleph",alefsym:"\\aleph",Alpha:"\\mathrm{A}",Beta:"\\mathrm{B}",bull:"\\bullet",Chi:"\\mathrm{X}",clubs:"\\clubsuit",cnums:"\\mathbb{C}",Complex:"\\mathbb{C}",Dagger:"\\ddagger",diamonds:"\\diamondsuit",doublecap:"\\Cap",doublecup:"\\Cup",empty:"\\emptyset",Epsilon:"\\mathrm{E}",Eta:"\\mathrm{H}",exist:"\\exists",hArr:"\\Leftrightarrow",harr:"\\leftrightarrow",Harr:"\\Leftrightarrow",hearts:"\\heartsuit",image:"\\Im",infin:"\\infty",Iota:"\\mathrm{I}",isin:"\\in",Kappa:"\\mathrm{K}",larr:"\\leftarrow",Larr:"\\Leftarrow",lArr:"\\Leftarrow",lrarr:"\\leftrightarrow",Lrarr:"\\Leftrightarrow",lrArr:"\\Leftrightarrow",Mu:"\\mathrm{M}",natnums:"\\mathbb{N}",Nu:"\\mathrm{N}",Omicron:"\\mathrm{O}",part:"\\partial",plusmn:"\\pm",rarr:"\\rightarrow",Rarr:"\\Rightarrow",rArr:"\\Rightarrow",real:"\\Re",reals:"\\mathbb{R}",Reals:"\\mathbb{R}",restriction:"\\upharpoonright",Rho:"\\mathrm{P}",sdot:"\\cdot",sect:"\\S",spades:"\\spadesuit",sub:"\\subset",sube:"\\subseteq",supe:"\\supseteq",Tau:"\\mathrm{T}",thetasym:"\\vartheta",varcoppa:"\\coppa",weierp:"\\wp",Zeta:"\\mathrm{Z}"},lf={varGamma:"\\mathit{\\Gamma}",varDelta:"\\mathit{\\Delta}",varTheta:"\\mathit{\\Theta}",varLambda:"\\mathit{\\Lambda}",varXi:"\\mathit{\\Xi}",varPi:"\\mathit{\\Pi}",varSigma:"\\mathit{\\Sigma}",varUpsilon:"\\mathit{\\Upsilon}",varPhi:"\\mathit{\\Phi}",varPsi:"\\mathit{\\Psi}",varOmega:"\\mathit{\\Omega}",pmod:{def:"\\quad(\\operatorname{mod}\\ #1)",args:1,expand:!1,captureSelection:!1},mod:{def:"\\quad\\operatorname{mod}\\,\\,#1",args:1,expand:!1},bmod:{def:"\\;\\mathbin{\\operatorname{mod }}",expand:!1}},cf={bra:{def:"\\mathinner{\\langle{#1}|}",args:1,captureSelection:!1},ket:{def:"\\mathinner{|{#1}\\rangle}",args:1,captureSelection:!1},braket:{def:"\\mathinner{\\langle{#1}\\rangle}",args:1,captureSelection:!1},set:{def:"\\mathinner{\\lbrace #1 \\rbrace}",args:1,captureSelection:!1},Bra:{def:"\\left\\langle #1\\right|",args:1,captureSelection:!1},Ket:{def:"\\left|#1\\right\\rangle",args:1,captureSelection:!1},Braket:{def:"\\left\\langle{#1}\\right\\rangle",args:1,captureSelection:!1},Set:{def:"\\left\\lbrace #1 \\right\\rbrace",args:1,captureSelection:!1}},uf={strut:{primitive:!0,def:"\\phantom{\\rule[0.3\\baselineskip]{0}{0.7\\baselineskip}}",args:0,captureSelection:!0},iff:{primitive:!0,captureSelection:!0,def:"\\;\\Longleftrightarrow\\;"},nicefrac:"^{#1}\\!\\!/\\!_{#2}",phase:{def:"\\enclose{phasorangle}{#1}",args:1,captureSelection:!1},rd:"\\mathrm{d}",rD:"\\mathrm{D}",odif:"\\mathrm{d}",doubleStruckCapitalN:"\\mathbb{N}",doubleStruckCapitalR:"\\mathbb{R}",doubleStruckCapitalQ:"\\mathbb{Q}",doubleStruckCapitalZ:"\\mathbb{Z}",doubleStruckCapitalP:"\\mathbb{P}",scriptCapitalE:"\\mathscr{E}",scriptCapitalH:"\\mathscr{H}",scriptCapitalL:"\\mathscr{L}",gothicCapitalC:"\\mathfrak{C}",gothicCapitalH:"\\mathfrak{H}",gothicCapitalI:"\\mathfrak{I}",gothicCapitalR:"\\mathfrak{R}",imaginaryI:"\\mathrm{i}",imaginaryJ:"\\mathrm{j}",exponentialE:"\\mathrm{e}",differentialD:"\\mathrm{d}",capitalDifferentialD:"\\mathrm{D}",mathstrut:{def:"\\vphantom{(}",primitive:!0},angl:"\\enclose{actuarial}{#1}",angln:"\\enclose{actuarial}{n}",anglr:"\\enclose{actuarial}{r}",anglk:"\\enclose{actuarial}{k}",mathtools:{primitive:!0,package:{ordinarycolon:":",vcentcolon:"\\mathrel{\\mathop\\ordinarycolon}",dblcolon:'{\\mathop{\\char"2237}}',coloneqq:'{\\mathop{\\char"2254}}',Coloneqq:'{\\mathop{\\char"2A74}}',coloneq:'{\\mathop{\\char"2254}}',Coloneq:'{\\mathop{\\char"2A74}}',eqqcolon:'{\\mathop{\\char"2255}}',Eqqcolon:'{\\mathop{\\char"3D\\char"2237}}',eqcolon:'{\\mathop{\\char"2255}}',Eqcolon:'{\\mathop{\\char"3D\\char"2237}}',colonapprox:'{\\mathop{\\char"003A\\char"2248}}',Colonapprox:'{\\mathop{\\char"2237\\char"2248}}',colonsim:'{\\mathop{\\char"3A\\char"223C}}',Colonsim:'{\\mathop{\\char"2237\\char"223C}}',colondash:"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}",Colondash:"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}",dashcolon:"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Dashcolon:"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}"}},ratio:"\\vcentcolon",coloncolon:"\\dblcolon",colonequals:"\\coloneq",coloncolonequals:"\\Coloneq",equalscolon:"\\eqcolon",equalscoloncolon:"\\Eqcolon",colonminus:"\\colondash",coloncolonminus:"\\Colondash",minuscolon:"\\dashcolon",minuscoloncolon:"\\Dashcolon",coloncolonapprox:"\\Colonapprox",coloncolonsim:"\\Colonsim",simcolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Simcolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}",simcoloncolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}",approxcolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Approxcolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}",approxcoloncolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}",notni:"\\mathrel{\\char`\u220C}",limsup:"\\operatorname*{lim\\,sup}",liminf:"\\operatorname*{lim\\,inf}",injlim:"\\operatorname*{inj\\,lim}",projlim:"\\operatorname*{proj\\,lim}",varlimsup:"\\operatorname*{\\overline{lim}}",varliminf:"\\operatorname*{\\underline{lim}}",varinjlim:"\\operatorname*{\\underrightarrow{lim}}",varprojlim:"\\operatorname*{\\underleftarrow{lim}}",argmin:"\\operatorname*{arg\\,min}",argmax:"\\operatorname*{arg\\,max}",plim:"\\mathop{\\operatorname{plim}}\\limits",tripledash:{def:"\\vphantom{-}\\raise{4mu}{\\mkern1.5mu\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2mu}}",expand:!0},"braket.sty":{package:cf},"amsmath.sty":{package:lf,primitive:!0},"texvc.sty":{package:sf,primitive:!1}},Ti={" ":32,"\\!":33,"\\#":35,"\\$":36,"\\%":37,"\\&":38,"\\_":95,"-":45,"\\textunderscore":95,"\\euro":8364,"\\maltese":10016,"\\{":123,"\\}":125,"\\textbraceleft":123,"\\textbraceright":125,"\\lbrace":123,"\\rbrace":125,"\\lbrack":91,"\\rbrack":93,"\\nobreakspace":160,"\\ldots":8230,"\\textellipsis":8230,"\\backslash":92,"`":8216,"'":8217,"``":8220,"''":8221,"\\degree":176,"\\textasciicircum":94,"\\textasciitilde":126,"\\textasteriskcentered":42,"\\textbackslash":92,"\\textbullet":8226,"\\textdollar":36,"\\textsterling":163,"\\textdagger":8224,"\\textdaggerdbl":8225,"\u2013":8211,"\u2014":8212,"\u2018":8216,"\u2019":8217,"\u201C":8220,"\u201D":8221,'"':8221,"\\ss":223,"\\ae":230,"\\oe":339,"\\AE":198,"\\OE":338,"\\O":216,"\\i":305,"\\j":567,"\\aa":229,"\\AA":197},Ku=/[\w!@*()-=+{}\[\]\\';:?/.,~<>`|$%#&^" ]/,Go,Zr;cu()?(Go=new RegExp("\\p{Letter}","u"),Zr=new RegExp("[0-9\\p{Letter}]","u")):(Go=/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/,Zr=/[\da-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/);function cl(t,e,r="mord",i){e!==void 0&&(Bn[t]={definitionType:"symbol",type:r,variant:i,codepoint:e},Jo[e]||(Jo[e]=t))}function Me(t,e,r){if(typeof t=="string"){for(let i=0;i{var l,c;return a.frequency===s.frequency?a.match.length===s.match.length?a.matcha.match)}function Ou(t){let e="auto",r=t.match(/:([^=]+)/);return r&&(e=r[1].trim()),e}function Xo(t){if(!t)return[];let e=[],r=t.split("]");if(r[0].startsWith("[")){e.push({isOptional:!0,type:Ou(r[0].slice(1))});for(let i=1;i<=r.length;i++)e.push(...Xo(r[i]))}else if(r=t.split("}"),r[0].startsWith("{")){e.push({isOptional:!1,type:Ou(r[0].slice(1))});for(let i=1;i<=r.length;i++)e.push(...Xo(r[i]))}return e}function ml(t){if(!t)return"";let e="",r=!0;for(let i of t)typeof i.value=="string"?e+=i.value:r=!1;return r?e:""}function Et(t,e,r){typeof t=="string"&&(t=[t]);let n={tabular:!0,rootOnly:!1,params:Xo(e),createAtom:r};for(let o of t)ul[o]=n}function Zo(t,e,r){var n;typeof t=="string"&&(t=[t]);let i={tabular:(n=r==null?void 0:r.tabular)!=null?n:!1,rootOnly:!0,params:[],createAtom:e};for(let o of t)ul[o]=i}function M(t,e,r){var n,o;r||(r={});let i={definitionType:"function",params:Xo(e),ifMode:r.ifMode,isFunction:(n=r.isFunction)!=null?n:!1,applyMode:r.applyMode,infix:(o=r.infix)!=null?o:!1,parse:r.parse,createAtom:r.createAtom,applyStyle:r.applyStyle,serialize:r.serialize,render:r.render};if(typeof t=="string")Di["\\"+t]=i;else for(let a of t)Di["\\"+a]=i}var jo;function Bi(t){return jo||(jo=Oi(uf)),t?Oi(p(p({},jo),t)):jo}function Bu(t,e){var r,i,n,o;if(typeof t=="string"){let a=0,s=t;return/(^|[^\\])#1/.test(s)&&(a=1),/(^|[^\\])#2/.test(s)&&(a=2),/(^|[^\\])#3/.test(s)&&(a=3),/(^|[^\\])#4/.test(s)&&(a=4),/(^|[^\\])#5/.test(s)&&(a=5),/(^|[^\\])#6/.test(s)&&(a=6),/(^|[^\\])#7/.test(s)&&(a=7),/(^|[^\\])#8/.test(s)&&(a=8),/(^|[^\\])#9/.test(s)&&(a=9),{expand:(r=e==null?void 0:e.expand)!=null?r:!0,captureSelection:(i=e==null?void 0:e.captureSelection)!=null?i:!0,args:a,def:s}}return p({expand:(n=e==null?void 0:e.expand)!=null?n:!0,captureSelection:(o=e==null?void 0:e.captureSelection)!=null?o:!0,args:0},t)}function Oi(t){if(!t)return{};let e={};for(let r of Object.keys(t)){let i=t[r];if(i==null)delete e[r];else if(typeof i=="object"&&"package"in i)for(let n of Object.keys(i.package))e[n]=Bu(i.package[n],{expand:!i.primitive,captureSelection:i.captureSelection});else e[r]=Bu(i)}return e}function ne(t,e="math"){if(!t||t.length===0)return null;let r=null;if(t.startsWith("\\")){if(r=Di[t],r)return!r.ifMode||r.ifMode===e?r:null;e==="math"?r=Bn[t]:Ti[t]&&(r={definitionType:"symbol",type:"mord",codepoint:Ti[t]})}else if(e==="math"){if(r=Bn[t],!r&&t.length===1){let i=pl("math",t.codePointAt(0));return i.startsWith("\\")?g(p({},ne(i,"math")),{command:i}):null}}else Ti[t]?r={definitionType:"symbol",type:"mord",codepoint:Ti[t]}:e==="text"&&(r={definitionType:"symbol",type:"mord",codepoint:t.codePointAt(0)});return r!=null?r:null}function Ki(t,e){if(!t.startsWith("\\"))return null;let r=t.slice(1);return e[r]}function pl(t,e){if(e===void 0)return"";if(t==="math"&&Jo[e])return Jo[e];if(t==="text"){let r=Object.keys(Ti).find(i=>Ti[i]===e);return r||String.fromCodePoint(e)}return String.fromCodePoint(e)}var Qe=[0,.68889,0,0,.72222],Yr=[0,.68889,0,0,.66667],hl=[0,.68889,0,0,.77778],Yo=[0,.68889,0,0,.61111],Iu=[.16667,.68889,0,0,.77778],Kn=[0,.68889,0,0,.55556],Z=[0,0,0,0,.25],zu=[0,.825,0,0,2.33334],Nu=[0,.9,0,0,2.33334],Qo=[0,.68889,0,0,.54028],fl=[-.03598,.46402,0,0,.5],De=[-.13313,.36687,0,0,1],ea=[.01354,.52239,0,0,1],Fu=[.01354,.52239,0,0,1.11111],$u=[0,.54986,0,0,1],ta=[0,.69224,0,0,.5],gl=[0,.43056,0,0,1],br=[.08198,.58198,0,0,.77778],ra=[.19444,.69224,0,0,.41667],ia=[.1808,.675,0,0,1],Vu=[.19444,.69224,0,0,.83334],qu=[.13667,.63667,0,0,1],Hu=[-.064,.437,0,0,1.334],yr=[.08167,.58167,0,0,.77778],Pn=[0,.69224,0,0,.72222],bl=[0,.69224,0,0,.66667],na=[-.13313,.36687,0,0,.77778],Wu=[.06062,.54986,0,0,.77778],oa=[0,.69224,0,0,.77778],Pi=[.25583,.75583,0,0,.77778],Tt=[.25142,.75726,0,0,.77778],Ri=[.20576,.70576,0,0,.77778],ct=[.30274,.79383,0,0,.77778],Rn=[.22958,.72958,0,0,.77778],Uu=[.1808,.675,0,0,.77778],Dt=[.13667,.63667,0,0,.77778],$e=[.13597,.63597,0,0,.77778],xr=[.03517,.54986,0,0,.77778],Ii=[0,.675,0,0,.77778],ju=[.19444,.69224,0,0,.61111],Ju=[0,.54986,0,0,.76042],Gu=[0,.54986,0,0,.66667],vr=[.0391,.5391,0,0,.77778],Xu=[.03517,.54986,0,0,1.33334],Zu=[.38569,.88569,0,0,.77778],aa=[.23222,.74111,0,0,.77778],Yu=[.19444,.69224,0,0,.77778],Qu=[0,.37788,0,0,.5],sa=[0,.54986,0,0,.72222],ed=[0,.69224,0,0,.83334],td=[.11111,.69224,0,0,.66667],zi=[.26167,.75726,0,0,.77778],rd=[.48256,.98256,0,0,.77778],id=[.28481,.79383,0,0,.77778],nd=[.08167,.58167,0,0,.22222],od=[.08167,.58167,0,0,.38889],ad=[0,.43056,.04028,0,.66667],sd=[.41951,.91951,0,0,.77778],ld=[.24982,.74947,0,0,.38865],cd=[.08319,.58283,0,0,.75623],ud=[0,.10803,0,0,.27764],yl=[0,.47534,0,0,.50181],In=[.18906,.47534,0,0,.50181],dd=[0,.69141,0,0,.50181],md=[.24982,.74947,0,0,.27764],xl=[0,.69141,0,0,.21471],la=[.25,.75,0,0,.44722],et=[0,.64444,0,0,.575],Ni=[.08556,.58556,0,0,.89444],ca=[0,.69444,0,0,.89444],ua=[0,.68611,0,0,.9],vl=[0,.68611,0,0,.86944],_r=[.25,.75,0,0,.575],da=[.25,.75,0,0,.31944],Qr=[0,.69444,0,0,.63889],Fi=[0,.69444,0,0,.31944],pd=[0,.44444,0,0,.63889],hd=[0,.44444,0,0,.51111],Mr=[0,.69444,0,0,.575],ut=[.13333,.63333,0,0,.89444],fd=[0,.44444,0,0,.31944],gd=[0,.69444,0,0,.86944],bd=[0,.68611,0,0,.69166],ma=[0,.68611,0,0,.83055],_l=[0,.68611,0,0,.89444],Ml=[0,.69444,0,0,.60278],yd=[.19444,.69444,0,0,.51111],xd=[0,.69444,0,0,.83055],Ot=[-.10889,.39111,0,0,1.14999],vd=[.19444,.69444,0,0,.575],zn=[.19444,.69444,0,0,1.14999],_d=[.19444,.69444,0,0,.70277],Md=[.05556,.75,0,0,.575],wl=[0,.68611,0,0,.95833],wd=[.08556,.58556,0,0,.76666],Sl=[-.02639,.47361,0,0,.575],Sd=[0,.44444,0,0,.89444],ei=[0,.55556,0,0,.76666],kd=[-.10889,.39111,0,0,.89444],kl=[.00222,.50222,0,0,.89444],wr=[.19667,.69667,0,0,.89444],Ld=[.08556,.58556,0,0,1.14999],Ll=[0,.69444,0,0,.70277],pa=[-.02778,.47222,0,0,.575],ha=[.25,.75,0,0,.51111],Ad=[-.13889,.36111,0,0,1.14999],Cd=[.19444,.69444,0,0,1.02222],fa=[.12963,.69444,0,0,.89444],Ed=[.19444,.69444,0,0,.44722],Sr=[0,.64444,.13167,0,.59111],Td=[.19444,.64444,.13167,0,.59111],Al=[0,.68611,.17208,0,.8961],Dd=[.19444,.44444,.105,0,.53222],Od=[0,.44444,.085,0,.82666],Bd=[0,.69444,.06709,0,.59111],ga=[0,.69444,.12945,0,.35555],Kd=[0,.69444,0,0,.94888],Cl=[0,.69444,.11472,0,.59111],Pd=[0,.68611,.10778,0,.88555],Rd=[0,.69444,.07939,0,.62055],ba=[0,.69444,.12417,0,.30667],kr=[0,.64444,.13556,0,.51111],Id=[.19444,.64444,.13556,0,.51111],ya=[0,.68333,.16389,0,.74333],zd=[.19444,.43056,.08847,0,.46],Nd=[0,.43056,.07514,0,.71555],Fd=[0,.69444,.06646,0,.51111],$d=[0,.69444,0,0,.83129],Vd=[0,.69444,.1225,0,.51111],qd=[0,.68333,.09403,0,.76666],Hd=[0,.68333,.11111,0,.76666],Wd=[0,.69444,.06961,0,.51444],Qt=[0,.69444,0,0,.27778],$i=[.25,.75,0,0,.38889],tt=[0,.64444,0,0,.5],ti=[0,.69444,0,0,.77778],ri=[0,.68333,0,0,.75],Nn=[0,.68333,0,0,.77778],Ud=[0,.68333,0,0,.68056],Fn=[0,.68333,0,0,.72222],er=[.25,.75,0,0,.5],xa=[.25,.75,0,0,.27778],we=[0,.69444,0,0,.5],Vi=[0,.69444,0,0,.55556],El=[0,.43056,0,0,.44445],$n=[0,.43056,0,0,.5],jd=[.19444,.43056,0,0,.55556],Jd=[0,.43056,0,0,.55556],rt=[.08333,.58333,0,0,.77778],Gd=[0,.43056,0,0,.27778],Xd=[0,.66786,0,0,.27778],Zd=[0,.69444,0,0,.75],Yd=[0,.66786,0,0,.5],Qd=[0,.68333,0,0,.625],Tl=[.19444,.69444,0,0,.44445],Vn=[0,.69444,0,0,.72222],em=[.19444,.69444,0,0,.5],qn=[.19444,.69444,0,0,1],tm=[.011,.511,0,0,1.126],Dl=[.19444,.69444,0,0,.61111],Ol=[.05556,.75,0,0,.5],rm=[0,.68333,0,0,.83334],im=[.0391,.5391,0,0,.66667],Bl=[-.05555,.44445,0,0,.5],nm=[0,.43056,0,0,.77778],ii=[0,.55556,0,0,.66667],va=[-.03625,.46375,0,0,.77778],om=[-.01688,.48312,0,0,.77778],am=[.0391,.5391,0,0,1],Lr=[0,.69444,0,0,.61111],_a=[-.03472,.46528,0,0,.5],Ma=[.25,.75,0,0,.44445],sm=[-.14236,.35764,0,0,1],wa=[.244,.744,0,0,.412],lm=[.19444,.69444,0,0,.88889],Sa=[.12963,.69444,0,0,.77778],cm=[.19444,.69444,0,0,.38889],um=[.011,.511,0,0,1.638],dm=[.19444,.69444,0,0,0],ka=[0,.44444,0,0,.575],Hn=[.19444,.44444,0,0,.575],mm=[0,.68611,0,0,.75555],pm=[0,.69444,0,0,.66759],hm=[0,.68611,0,0,.80555],fm=[0,.68611,.08229,0,.98229],gm=[0,.68611,0,0,.76666],bm=[0,.44444,0,0,.58472],ym=[.19444,.44444,0,0,.6118],Wn=[.19444,.43056,0,0,.5],xm=[0,.68333,.02778,.08334,.76278],vm=[0,.68333,.08125,.05556,.83125],_m=[0,.43056,0,.05556,.48472],Mm=[.19444,.43056,0,.08334,.51702],wm=[.25,.75,0,0,.42778],Ce=[0,.69444,0,0,.55],tr=[0,.69444,0,0,.73334],Ar=[0,.69444,0,0,.79445],Sm=[0,.69444,0,0,.51945],Kl=[0,.69444,0,0,.70278],km=[0,.69444,0,0,.76389],Lm=[.25,.75,0,0,.34306],Pl=[0,.69444,0,0,.56111],Am=[0,.69444,0,0,.25556],Cm=[.19444,.45833,0,0,.56111],Em=[0,.45833,0,0,.56111],La=[0,.69444,0,0,.30556],Tm=[0,.69444,0,0,.58056],Dm=[0,.69444,0,0,.67223],Rl=[0,.69444,0,0,.85556],Il=[0,.69444,0,0,.55834],Bt=[0,.65556,.11156,0,.5],zl=[0,.69444,.08094,0,.70834],Nl=[.17014,0,0,0,.44445],Om=[0,.69444,.0799,0,.5],Bm=[0,.69444,0,0,.73752],Km=[0,.69444,.09205,0,.5],Pm=[0,.69444,.09031,0,.77778],Fl=[0,.69444,.07816,0,.27778],Rm=[0,.69444,.00316,0,.5],Im=[.19444,.69444,0,0,.83334],zm=[.05556,.75,0,0,.83334],Nm=[0,.75,0,0,.5],Fm=[.125,.08333,0,0,.27778],$m=[0,.08333,0,0,.27778],Kt=[0,.65556,0,0,.5],$l=[0,.69444,0,0,.47222],rr=[0,.69444,0,0,.66667],Vm=[0,.69444,0,0,.59722],Vl=[0,.69444,0,0,.54167],ql=[0,.69444,0,0,.70834],qm=[.25,.75,0,0,.28889],Hl=[0,.69444,0,0,.51667],Hm=[0,.44444,0,0,.44445],Wm=[.19444,.44444,0,0,.51667],Um=[0,.44444,0,0,.38333],jm=[0,.44444,0,0,.51667],Jm=[0,.69444,0,0,.83334],Gm=[.35001,.85,0,0,.45834],Xm=[.35001,.85,0,0,.57778],Zm=[.35001,.85,0,0,.41667],Ym=[.35001,.85,0,0,.58334],Aa=[0,.72222,0,0,.55556],Qm=[1e-5,.6,0,0,.66667],e0=[1e-5,.6,0,0,.77778],t0=[.25001,.75,0,0,.94445],r0=[.306,.805,.19445,0,.47222],i0=[.30612,.805,.19445,0,.47222],qi=[.25001,.75,0,0,.83334],Hi=[.35001,.85,0,0,.47222],Wl=[.25001,.75,0,0,1.11111],n0=[.65002,1.15,0,0,.59722],o0=[.65002,1.15,0,0,.81111],a0=[.65002,1.15,0,0,.47222],s0=[.65002,1.15,0,0,.66667],Ca=[0,.75,0,0,1],l0=[.55001,1.05,0,0,1.27778],c0=[.862,1.36,.44445,0,.55556],u0=[.86225,1.36,.44445,0,.55556],Wi=[.55001,1.05,0,0,1.11111],Ea=[.65002,1.15,0,0,.52778],d0=[.65002,1.15,0,0,.61111],Ul=[.55001,1.05,0,0,1.51112],m0=[.95003,1.45,0,0,.73611],p0=[.95003,1.45,0,0,1.04445],h0=[.95003,1.45,0,0,.52778],Ta=[.95003,1.45,0,0,.75],Da=[0,.75,0,0,1.44445],Oa=[.95003,1.45,0,0,.58334],f0=[1.25003,1.75,0,0,.79167],g0=[1.25003,1.75,0,0,1.27778],b0=[1.25003,1.75,0,0,.58334],Ba=[1.25003,1.75,0,0,.80556],Ka=[0,.825,0,0,1.8889],Pa=[1.25003,1.75,0,0,.63889],Ra=[.64502,1.155,0,0,.875],y0=[1e-5,.6,0,0,.875],jl=[-99e-5,.601,0,0,.66667],Ia=[.64502,1.155,0,0,.66667],x0=[1e-5,.9,0,0,.88889],v0=[.65002,1.15,0,0,.88889],_0=[.90001,0,0,0,.88889],M0=[-.00499,.605,0,0,1.05556],za=[0,.12,0,0,.45],O=[0,.61111,0,0,.525],dt=[.08333,.69444,0,0,.525],w0=[-.08056,.53055,0,0,.525],S0=[-.05556,.55556,0,0,.525],Ke=[0,.43056,0,0,.525],Un=[.22222,.43056,0,0,.525],k0=[0,0,0,0,.525],L0={"AMS-Regular":{32:Z,65:Qe,66:Yr,67:Qe,68:Qe,69:Yr,70:Yo,71:hl,72:hl,73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:hl,76:Yr,77:[0,.68889,0,0,.94445],78:Qe,79:Iu,80:Yo,81:Iu,82:Qe,83:Kn,84:Yr,85:Qe,86:Qe,87:[0,.68889,0,0,1],88:Qe,89:Qe,90:Yr,107:Kn,160:Z,165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:Kn,295:Qo,710:zu,732:Nu,770:zu,771:Nu,989:yr,1008:ad,8245:[0,.54986,0,0,.275],8463:Qo,8487:Qe,8498:Kn,8502:Yr,8503:[0,.68889,0,0,.44445],8504:Yr,8513:[0,.68889,0,0,.63889],8592:fl,8594:fl,8602:De,8603:De,8606:ea,8608:ea,8610:Fu,8611:Fu,8619:$u,8620:$u,8621:[-.13313,.37788,0,0,1.38889],8622:De,8624:ta,8625:ta,8630:gl,8631:gl,8634:br,8635:br,8638:ra,8639:ra,8642:ra,8643:ra,8644:ia,8646:ia,8647:ia,8648:Vu,8649:ia,8650:Vu,8651:ea,8652:ea,8653:De,8654:De,8655:De,8666:qu,8667:qu,8669:[-.13313,.37788,0,0,1],8672:Hu,8674:Hu,8705:[0,.825,0,0,.5],8708:Kn,8709:yr,8717:[0,.43056,0,0,.42917],8722:fl,8724:[.08198,.69224,0,0,.77778],8726:yr,8733:oa,8736:Pn,8737:Pn,8738:[.03517,.52239,0,0,.72222],8739:nd,8740:[.25142,.74111,0,0,.27778],8741:od,8742:[.25142,.74111,0,0,.5],8756:bl,8757:bl,8764:na,8765:[-.13313,.37788,0,0,.77778],8769:na,8770:va,8774:ct,8776:om,8778:yr,8782:Wu,8783:Wu,8785:br,8786:br,8787:br,8790:oa,8791:Rn,8796:[.08198,.91667,0,0,.77778],8806:Pi,8807:Pi,8808:Tt,8809:Tt,8812:[.25583,.75583,0,0,.5],8814:Ri,8815:Ri,8816:ct,8817:ct,8818:Rn,8819:Rn,8822:Uu,8823:Uu,8828:Dt,8829:Dt,8830:Rn,8831:Rn,8832:Ri,8833:Ri,8840:ct,8841:ct,8842:$e,8843:$e,8847:xr,8848:xr,8858:br,8859:br,8861:br,8862:Ii,8863:Ii,8864:Ii,8865:Ii,8872:[0,.69224,0,0,.61111],8873:Pn,8874:[0,.69224,0,0,.88889],8876:Yo,8877:Yo,8878:Qe,8879:Qe,8882:xr,8883:xr,8884:Dt,8885:Dt,8888:[0,.54986,0,0,1.11111],8890:jd,8891:ju,8892:ju,8901:[0,.54986,0,0,.27778],8903:yr,8905:yr,8906:yr,8907:oa,8908:oa,8909:[-.03598,.46402,0,0,.77778],8910:Ju,8911:Ju,8912:xr,8913:xr,8914:Gu,8915:Gu,8916:bl,8918:vr,8919:vr,8920:Xu,8921:Xu,8922:Zu,8923:Zu,8926:Dt,8927:Dt,8928:ct,8929:ct,8934:aa,8935:aa,8936:aa,8937:aa,8938:Ri,8939:Ri,8940:ct,8941:ct,8994:Yu,8995:Yu,9416:[.15559,.69224,0,0,.90222],9484:ta,9488:ta,9492:Qu,9496:Qu,9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:Ii,9633:Ii,9650:sa,9651:sa,9654:xr,9660:sa,9661:sa,9664:xr,9674:td,9733:[.19444,.69224,0,0,.94445],10003:ed,10016:ed,10731:td,10846:[.19444,.75583,0,0,.61111],10877:Dt,10878:Dt,10885:Pi,10886:Pi,10887:$e,10888:$e,10889:zi,10890:zi,10891:rd,10892:rd,10901:Dt,10902:Dt,10933:Tt,10934:Tt,10935:zi,10936:zi,10937:zi,10938:zi,10949:Pi,10950:Pi,10955:id,10956:id,57350:nd,57351:od,57352:yr,57353:ad,57356:Tt,57357:Tt,57358:sd,57359:ct,57360:ct,57361:sd,57366:Tt,57367:Tt,57368:Tt,57369:Tt,57370:$e,57371:$e},"Caligraphic-Regular":{32:Z,65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:Z},"Fraktur-Regular":{32:Z,33:[0,.69141,0,0,.29574],34:xl,38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:ld,41:ld,42:[0,.62119,0,0,.27764],43:cd,44:ud,45:cd,46:ud,47:[.24982,.74947,0,0,.50181],48:yl,49:yl,50:yl,51:In,52:In,53:In,54:dd,55:In,56:dd,57:In,58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:md,93:md,94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:Z,8216:xl,8217:xl,58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:Z,33:[0,.69444,0,0,.35],34:Ml,35:[.19444,.69444,0,0,.95833],36:Md,37:[.05556,.75,0,0,.95833],38:ca,39:Fi,40:la,41:la,42:[0,.75,0,0,.575],43:ut,44:[.19444,.15556,0,0,.31944],45:Um,46:[0,.15556,0,0,.31944],47:_r,48:et,49:et,50:et,51:et,52:et,53:et,54:et,55:et,56:et,57:et,58:fd,59:[.19444,.44444,0,0,.31944],60:Ni,61:kd,62:Ni,63:[0,.69444,0,0,.54305],64:ca,65:vl,66:[0,.68611,0,0,.81805],67:ma,68:[0,.68611,0,0,.88194],69:mm,70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:ua,73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:bd,77:[0,.68611,0,0,1.09166],78:ua,79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:vl,89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:da,92:_r,93:da,94:Mr,95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:Qr,99:hd,100:Qr,101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:Qr,105:Fi,106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:Fi,109:[0,.44444,0,0,.95833],110:pd,111:ka,112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:pd,118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:hd,123:_r,124:da,125:_r,126:[.35,.34444,0,0,.575],160:Z,163:[0,.69444,0,0,.86853],168:Mr,172:[0,.44444,0,0,.76666],176:gd,177:ut,184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:ut,216:[.04861,.73472,0,0,.89444],223:Vm,230:[0,.44444,0,0,.83055],247:ut,248:[.09722,.54167,0,0,.575],305:fd,338:[0,.68611,0,0,1.16944],339:Sd,567:[.19444,.44444,0,0,.35139],710:Mr,711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:Mr,715:Mr,728:Mr,729:Fi,730:gd,732:Mr,733:Mr,915:bd,916:wl,920:_l,923:hm,926:gm,928:ua,931:ma,933:_l,934:ma,936:_l,937:ma,8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:Fi,8217:Fi,8220:Ml,8221:Ml,8224:yd,8225:yd,8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:pm,8465:xd,8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:xd,8501:Ll,8592:Ot,8593:vd,8594:Ot,8595:vd,8596:Ot,8597:_r,8598:zn,8599:zn,8600:zn,8601:zn,8636:Ot,8637:Ot,8640:Ot,8641:Ot,8656:Ot,8657:_d,8658:Ot,8659:_d,8660:Ot,8661:[.25,.75,0,0,.70277],8704:Qr,8706:[0,.69444,.06389,0,.62847],8707:Qr,8709:Md,8711:wl,8712:wd,8715:wd,8722:ut,8723:ut,8725:_r,8726:_r,8727:pa,8728:Sl,8729:Sl,8730:[.18,.82,0,0,.95833],8733:Sd,8734:[0,.44444,0,0,1.14999],8736:Pn,8739:da,8741:_r,8743:ei,8744:ei,8745:ei,8746:ei,8747:[.19444,.69444,.12778,0,.56875],8764:kd,8768:[.19444,.69444,0,0,.31944],8771:kl,8776:[.02444,.52444,0,0,.89444],8781:kl,8801:kl,8804:wr,8805:wr,8810:Ld,8811:Ld,8826:Ni,8827:Ni,8834:Ni,8835:Ni,8838:wr,8839:wr,8846:ei,8849:wr,8850:wr,8851:ei,8852:ei,8853:ut,8854:ut,8855:ut,8856:ut,8857:ut,8866:Ll,8867:Ll,8868:ca,8869:ca,8900:Sl,8901:[-.02639,.47361,0,0,.31944],8902:pa,8968:ha,8969:ha,8970:ha,8971:ha,8994:Ad,8995:Ad,9651:Cd,9657:pa,9661:Cd,9667:pa,9711:zn,9824:fa,9825:fa,9826:fa,9827:fa,9837:[0,.75,0,0,.44722],9838:Ed,9839:Ed,10216:la,10217:la,10815:ua,10927:wr,10928:wr,57376:dm},"Main-BoldItalic":{32:Z,33:[0,.69444,.11417,0,.38611],34:Rd,35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:ga,40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:Sr,49:Sr,50:Sr,51:Sr,52:Td,53:Sr,54:Sr,55:Td,56:Sr,57:Sr,58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:Cl,64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:Al,73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:Al,79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:Bd,95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:Dd,104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:Dd,114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:Z,168:[0,.69444,.11473,0,.59111],176:Kd,184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:Od,248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:Od,567:[.19444,.44444,.04611,0,.385],710:Bd,711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:ga,730:Kd,732:Cl,733:Cl,915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:Al,931:[0,.68611,.11431,0,.82666],933:Pd,934:[0,.68611,.05632,0,.82666],936:Pd,937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:ga,8217:ga,8220:[0,.69444,.16772,0,.62055],8221:Rd},"Main-Italic":{32:Z,33:ba,34:Wd,35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:ba,40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:kr,49:kr,50:kr,51:kr,52:Id,53:kr,54:kr,55:Id,56:kr,57:kr,58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:Vd,64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:ya,73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:ya,79:qd,80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:ya,86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:Fd,95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:zd,104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:zd,114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:Z,168:[0,.66786,.10474,0,.51111],176:$d,184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:Nd,248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:Nd,710:Fd,711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:$d,732:[0,.66786,.11585,0,.51111],733:Vd,915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:qd,923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:ya,931:[0,.68333,.12028,0,.71555],933:Hd,934:[0,.68333,.05986,0,.71555],936:Hd,937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:ba,8217:ba,8220:[0,.69444,.1685,0,.51444],8221:Wd,8463:Qo},"Main-Regular":{32:Z,33:Qt,34:we,35:Im,36:Ol,37:zm,38:ti,39:Qt,40:$i,41:$i,42:Nm,43:rt,44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:er,48:tt,49:tt,50:tt,51:tt,52:tt,53:tt,54:tt,55:tt,56:tt,57:tt,58:Gd,59:[.19444,.43056,0,0,.27778],60:vr,61:na,62:vr,63:$l,64:ti,65:ri,66:[0,.68333,0,0,.70834],67:Fn,68:[0,.68333,0,0,.76389],69:Ud,70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:ri,73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:Nn,76:Qd,77:[0,.68333,0,0,.91667],78:ri,79:Nn,80:Ud,81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:Fn,85:ri,86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:ri,89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:xa,92:er,93:xa,94:we,95:[.31,.12056,.02778,0,.5],97:$n,98:Vi,99:El,100:Vi,101:El,102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:Vi,105:Xd,106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:Qt,109:[0,.43056,0,0,.83334],110:Jd,111:$n,112:jd,113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:Jd,118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:El,123:er,124:xa,125:er,126:[.35,.31786,0,0,.5],160:Z,163:[0,.69444,0,0,.76909],167:Tl,168:Yd,172:[0,.43056,0,0,.66667],176:Zd,177:rt,182:Dl,184:Nl,198:[0,.68333,0,0,.90278],215:rt,216:[.04861,.73194,0,0,.77778],223:we,230:[0,.43056,0,0,.72222],247:rt,248:[.09722,.52778,0,0,.5],305:Gd,338:[0,.68333,0,0,1.01389],339:nm,567:[.19444,.43056,0,0,.30556],710:we,711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:we,715:we,728:we,729:Xd,730:Zd,732:Yd,733:we,915:Qd,916:rm,920:Nn,923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:ri,931:Fn,933:Nn,934:Fn,936:Nn,937:Fn,8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:Qt,8217:Qt,8220:we,8221:we,8224:Tl,8225:Tl,8230:[0,.12,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:Qo,8465:Vn,8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:Vn,8501:Lr,8592:De,8593:em,8594:De,8595:em,8596:De,8597:er,8598:qn,8599:qn,8600:qn,8601:qn,8614:[.011,.511,0,0,1],8617:tm,8618:tm,8636:De,8637:De,8640:De,8641:De,8652:[.011,.671,0,0,1],8656:De,8657:Dl,8658:De,8659:Dl,8660:De,8661:[.25,.75,0,0,.61111],8704:Vi,8706:[0,.69444,.05556,.08334,.5309],8707:Vi,8709:Ol,8711:rm,8712:im,8715:im,8722:rt,8723:rt,8725:er,8726:er,8727:_a,8728:Bl,8729:Bl,8730:[.2,.8,0,0,.83334],8733:nm,8734:gl,8736:Pn,8739:xa,8741:er,8743:ii,8744:ii,8745:ii,8746:ii,8747:[.19444,.69444,.11111,0,.41667],8764:na,8768:[.19444,.69444,0,0,.27778],8771:va,8773:[-.022,.589,0,0,1],8776:om,8781:va,8784:[-.133,.67,0,0,.778],8801:va,8804:$e,8805:$e,8810:am,8811:am,8826:vr,8827:vr,8834:vr,8835:vr,8838:$e,8839:$e,8846:ii,8849:$e,8850:$e,8851:ii,8852:ii,8853:rt,8854:rt,8855:rt,8856:rt,8857:rt,8866:Lr,8867:Lr,8868:ti,8869:ti,8872:[.249,.75,0,0,.867],8900:Bl,8901:[-.05555,.44445,0,0,.27778],8902:_a,8904:[.005,.505,0,0,.9],8942:[.03,.9,0,0,.278],8943:[-.19,.31,0,0,1.172],8945:[-.1,.82,0,0,1.282],8968:Ma,8969:Ma,8970:Ma,8971:Ma,8994:sm,8995:sm,9136:wa,9137:wa,9651:lm,9657:_a,9661:lm,9667:_a,9711:qn,9824:Sa,9825:Sa,9826:Sa,9827:Sa,9837:[0,.75,0,0,.38889],9838:cm,9839:cm,10216:$i,10217:$i,10222:wa,10223:wa,10229:[.011,.511,0,0,1.609],10230:um,10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:um,10815:ri,10927:$e,10928:$e,57376:dm},"Math-BoldItalic":{32:Z,48:ka,49:ka,50:ka,51:Hn,52:Hn,53:Hn,54:et,55:Hn,56:et,57:Hn,65:vl,66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:fm,73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:mm,77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:pm,105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:bm,112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:Z,915:[0,.68611,.15972,0,.65694],916:wl,920:[0,.68611,.03194,0,.86722],923:hm,926:[0,.68611,.07458,0,.84125],928:fm,931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:gm,936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:bm,960:[0,.44444,.03704,0,.68241],961:ym,962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:ym,1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:Z,48:$n,49:$n,50:$n,51:Wn,52:Wn,53:Wn,54:tt,55:Wn,56:tt,57:Wn,65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:vm,73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:xm,80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:_m,112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:Z,915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:xm,923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:vm,931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:_m,960:[0,.43056,.03588,0,.57003],961:Mm,962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:Mm,1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:Z,33:[0,.69444,0,0,.36667],34:Il,35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:La,40:wm,41:wm,42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:Ce,49:Ce,50:Ce,51:Ce,52:Ce,53:Ce,54:Ce,55:Ce,56:Ce,57:Ce,58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:Sm,64:tr,65:tr,66:tr,67:Kl,68:Ar,69:[0,.69444,0,0,.64167],70:Lr,71:tr,72:Ar,73:[0,.69444,0,0,.33056],74:Sm,75:km,76:Tm,77:[0,.69444,0,0,.97778],78:Ar,79:Ar,80:Kl,81:[.10556,.69444,0,0,.79445],82:Kl,83:Lr,84:tr,85:km,86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:tr,89:[0,.69444,.0275,0,.73334],90:Dm,91:Lm,93:Lm,94:Ce,95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:Pl,99:[0,.45833,0,0,.48889],100:Pl,101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:Pl,105:Am,106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:Am,109:[0,.45833,0,0,.86667],110:Em,111:[0,.45833,0,0,.55],112:Cm,113:Cm,114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:Em,118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:Z,168:Ce,176:tr,180:Ce,184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:Ce,711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:Ce,729:La,730:tr,732:Ce,733:Ce,915:Tm,916:[0,.69444,0,0,.91667],920:Rl,923:Dm,926:tr,928:Ar,931:Ar,933:Rl,934:Ar,936:Rl,937:Ar,8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:La,8217:La,8220:Il,8221:Il},"SansSerif-Italic":{32:Z,33:[0,.69444,.05733,0,.31945],34:Rm,35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:Fl,40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:Fm,45:[0,.44444,.01946,0,.33333],46:$m,47:[.25,.75,.13164,0,.5],48:Bt,49:Bt,50:Bt,51:Bt,52:Bt,53:Bt,54:Bt,55:Bt,56:Bt,57:Bt,58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:rr,66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:zl,73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:Vl,77:[0,.69444,.08094,0,.875],78:zl,79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:Om,95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:Z,168:[0,.67937,.06385,0,.5],176:Bm,184:Nl,305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:Om,711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:Km,715:we,728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:Bm,732:[0,.67659,.08826,0,.5],733:Km,915:[0,.69444,.13372,0,.54167],916:Jm,920:[0,.69444,.07555,0,.77778],923:Lr,926:[0,.69444,.12816,0,.66667],928:zl,931:[0,.69444,.11983,0,.72222],933:Pm,934:[0,.69444,.04603,0,.72222],936:Pm,937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:Fl,8217:Fl,8220:[0,.69444,.14205,0,.5],8221:Rm},"SansSerif-Regular":{32:Z,33:[0,.69444,0,0,.31945],34:we,35:Im,36:Ol,37:zm,38:[0,.69444,0,0,.75834],39:Qt,40:$i,41:$i,42:Nm,43:rt,44:Fm,45:[0,.44444,0,0,.33333],46:$m,47:er,48:Kt,49:Kt,50:Kt,51:Kt,52:Kt,53:Kt,54:Kt,55:Kt,56:Kt,57:Kt,58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:$l,64:rr,65:rr,66:rr,67:Qr,68:[0,.69444,0,0,.72223],69:Vm,70:[0,.69444,0,0,.56945],71:rr,72:ql,73:Qt,74:$l,75:[0,.69444,0,0,.69445],76:Vl,77:[0,.69444,0,0,.875],78:ql,79:[0,.69444,0,0,.73611],80:Qr,81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:Vi,84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:rr,89:[0,.69444,.025,0,.66667],90:Lr,91:qm,93:qm,94:we,95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:Hl,99:Hm,100:Hl,101:Hm,102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:Hl,105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:jm,111:[0,.44444,0,0,.5],112:Wm,113:Wm,114:[0,.44444,.01389,0,.34167],115:Um,116:[0,.57143,0,0,.36111],117:jm,118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:Z,168:[0,.67937,0,0,.5],176:rr,184:Nl,305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:we,711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:we,715:we,728:we,729:[0,.67937,0,0,.27778],730:rr,732:[0,.67659,0,0,.5],733:we,915:Vl,916:Jm,920:ti,923:Lr,926:rr,928:ql,931:Vn,933:ti,934:Vn,936:ti,937:Vn,8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:Qt,8217:Qt,8220:we,8221:we},"Script-Regular":{32:Z,65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:Z},"Size1-Regular":{32:Z,40:Gm,41:Gm,47:Xm,91:Zm,92:Xm,93:Zm,123:Ym,125:Ym,160:Z,710:Aa,732:Aa,770:Aa,771:Aa,8214:[-99e-5,.601,0,0,.77778],8593:Qm,8595:Qm,8657:e0,8659:e0,8719:t0,8720:t0,8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:i0,8748:r0,8749:r0,8750:i0,8896:qi,8897:qi,8898:qi,8899:qi,8968:Hi,8969:Hi,8970:Hi,8971:Hi,9168:jl,10216:Hi,10217:Hi,10752:Wl,10753:Wl,10754:Wl,10756:qi,10758:qi},"Size2-Regular":{32:Z,40:n0,41:n0,47:o0,91:a0,92:o0,93:a0,123:s0,125:s0,160:Z,710:Ca,732:Ca,770:Ca,771:Ca,8719:l0,8720:l0,8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:u0,8748:c0,8749:c0,8750:u0,8896:Wi,8897:Wi,8898:Wi,8899:Wi,8968:Ea,8969:Ea,8970:Ea,8971:Ea,10216:d0,10217:d0,10752:Ul,10753:Ul,10754:Ul,10756:Wi,10758:Wi},"Size3-Regular":{32:Z,40:m0,41:m0,47:p0,91:h0,92:p0,93:h0,123:Ta,125:Ta,160:Z,710:Da,732:Da,770:Da,771:Da,8730:[.95003,1.45,0,0,1],8968:Oa,8969:Oa,8970:Oa,8971:Oa,10216:Ta,10217:Ta},"Size4-Regular":{32:Z,40:f0,41:f0,47:g0,91:b0,92:g0,93:b0,123:Ba,125:Ba,160:Z,710:Ka,732:Ka,770:Ka,771:Ka,8730:[1.25003,1.75,0,0,1],8968:Pa,8969:Pa,8970:Pa,8971:Pa,9115:Ra,9116:y0,9117:Ra,9118:Ra,9119:y0,9120:Ra,9121:Ia,9122:jl,9123:Ia,9124:Ia,9125:jl,9126:Ia,9127:x0,9128:v0,9129:_0,9130:[0,.3,0,0,.88889],9131:x0,9132:v0,9133:_0,9143:[.88502,.915,0,0,1.05556],10216:Ba,10217:Ba,57344:M0,57345:M0,57680:za,57681:za,57682:za,57683:za},"Typewriter-Regular":{32:k0,33:O,34:O,35:O,36:dt,37:dt,38:O,39:O,40:dt,41:dt,42:[0,.52083,0,0,.525],43:w0,44:[.13889,.125,0,0,.525],45:w0,46:[0,.125,0,0,.525],47:dt,48:O,49:O,50:O,51:O,52:O,53:O,54:O,55:O,56:O,57:O,58:Ke,59:[.13889,.43056,0,0,.525],60:S0,61:[-.19549,.41562,0,0,.525],62:S0,63:O,64:O,65:O,66:O,67:O,68:O,69:O,70:O,71:O,72:O,73:O,74:O,75:O,76:O,77:O,78:O,79:O,80:O,81:[.13889,.61111,0,0,.525],82:O,83:O,84:O,85:O,86:O,87:O,88:O,89:O,90:O,91:dt,92:dt,93:dt,94:O,95:[.09514,0,0,0,.525],96:O,97:Ke,98:O,99:Ke,100:O,101:Ke,102:O,103:Un,104:O,105:O,106:[.22222,.61111,0,0,.525],107:O,108:O,109:Ke,110:Ke,111:Ke,112:Un,113:Un,114:Ke,115:Ke,116:[0,.55358,0,0,.525],117:Ke,118:Ke,119:Ke,120:Ke,121:Un,122:Ke,123:dt,124:dt,125:dt,126:O,127:O,160:k0,176:O,184:[.19445,0,0,0,.525],305:Ke,567:Un,711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:O,715:O,728:O,730:O,770:O,771:O,776:O,915:O,916:O,920:O,923:O,926:O,928:O,931:O,933:O,934:O,936:O,937:O,8216:O,8217:O,8242:O,9251:[.11111,.21944,0,0,.525]}};var df=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,Pt=10,Pe=.25,C0=1.2,Je=.431,Jl={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[Je,Je,Je],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.5,.732,.925],num2:[.394,.384,.5],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[Pe,Pe,Pe],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04]},jn=[0,.5,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Ui=5,A0={"\xA0":" ","\u200B":" ",\u00C5:"A",\u00C7:"C",\u00D0:"D",\u00DE:"o",\u00E5:"a",\u00E7:"c",\u00F0:"d",\u00FE:"o",\u0410:"A",\u0411:"B",\u0412:"B",\u0413:"F",\u0414:"A",\u0415:"E",\u0416:"K",\u0417:"3",\u0418:"N",\u0419:"N",\u041A:"K",\u041B:"N",\u041C:"M",\u041D:"H",\u041E:"O",\u041F:"N",\u0420:"P",\u0421:"C",\u0422:"T",\u0423:"y",\u0424:"O",\u0425:"X",\u0426:"U",\u0427:"h",\u0428:"W",\u0429:"W",\u042A:"B",\u042B:"X",\u042C:"B",\u042D:"3",\u042E:"X",\u042F:"R",\u0430:"a",\u0431:"b",\u0432:"a",\u0433:"r",\u0434:"y",\u0435:"e",\u0436:"m",\u0437:"e",\u0438:"n",\u0439:"n",\u043A:"n",\u043B:"n",\u043C:"m",\u043D:"n",\u043E:"o",\u043F:"n",\u0440:"p",\u0441:"c",\u0442:"o",\u0443:"y",\u0444:"b",\u0445:"x",\u0446:"n",\u0447:"n",\u0448:"w",\u0449:"w",\u044A:"a",\u044B:"m",\u044C:"a",\u044D:"e",\u044E:"m",\u044F:"r"};function Cr(t,e){t===void 0&&(t=77);let r=L0[e][t];if(r)return{defaultMetrics:!1,depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]};if(t===11034)return{defaultMetrics:!0,depth:.2,height:.8,italic:0,skew:0,width:.8};let i=String.fromCodePoint(t);if(i in A0)t=A0[i].codePointAt(0);else if(df.test(i))return t=77,{defaultMetrics:!0,depth:.2,height:.9,italic:0,skew:0,width:1};return{defaultMetrics:!0,depth:.2,height:.7,italic:0,skew:0,width:.8}}var Gl={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],longrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],longleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],longleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],longrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],longleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xleftrightarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],longleftrightarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xRightleftharpoons:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],longRightleftharpoons:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xLeftrightharpoons:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716],longLeftrightharpoons:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Xl={widehat1:[1062,239,.24],widehat2:[2364,300,.3],widehat3:[2364,360,.36],widehat4:[2364,420,.42],widecheck1:[1062,239,.24],widecheck2:[2364,300,.3],widecheck3:[2364,360,.36],widecheck4:[2364,420,.42],widetilde1:[600,260,.26],widetilde2:[1033,286,.286],widetilde3:[2339,306,.306],widetilde4:[2340,312,.34],overarc:[1061,159,.3],underarc:[1061,159,.3]},E0={doubleleftarrow:`M262 157 l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 -86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 -2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l -10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 -33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 -17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 -13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 -107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 -5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 -45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 -331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,overarc:"M529 0c179 0 524 115 524 115 5 1 9 5 9 10 0 1-1 2-1 3l-4 22c-1 5-5 9-11 9h-2s-338-93-512-92c-174 0-513 92-513 92h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13 0 0 342-115 520-115z",underarc:`m 529 160 c -179 0 -524 -115 -524 -115 c -5 -1 -9 -5 -9 -10 c 0 -1 1 -2 1 -3 l 4 -22 c 1 -5 5 -9 11 -9 h 2 s 338 93 512 92 c 174 0 513 -92 513 -92 h 2 c 5 0 9 4 11 9 l 5 22 c 1 6 -2 12 -8 13 c 0 0 -342 115 -520 115 z `,leftgroup:`M400000 80 H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 435 0h399565z`,leftgroupunder:`M400000 262 H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 -3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 -18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 -196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 -4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 -10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 -152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 -2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 -83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 -68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 -.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334 c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 -53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 -5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 -320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 -451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 -480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 -707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 -16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 -40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l -6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 -174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 -3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 -10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 -18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 -7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 -27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 -64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 -13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 -52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 -167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 -70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 -40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 -37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 -19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,widetilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 -2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 -68.267.847-113-73.952-191-73.952z`,widetilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 -8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,widetilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 -11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 -338 0-409-156.573-744-156.573z`,widetilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 -11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 -1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 -7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 -11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 -11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 -11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, -5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, -11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, -11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, -11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 -27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 -84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 -119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, 1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, -152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`};function T0(t){if(Xl[t]){let[c,u,m]=Xl[t],d=``;return`${d}`}let[e,r,i,n]=Gl[t],o,a,s=i/1e3;e.length===3?(o=["slice-1-of-3","slice-2-of-3","slice-3-of-3"],a=["xMinYMin","xMidYMin","xMaxYMin"]):e.length===2?(o=["slice-1-of-2","slice-2-of-2"],a=["xMinYMin","xMaxYMin"]):(o=["slice-1-of-1"],a=[n]);let l=e.map((c,u)=>``).join("");return`${l}`}function D0(t){return Gl[t]?Gl[t][2]/1e3:Xl[t][2]}function mf(t){let e=[];for(let r=0;r=55296&&i<=56319){let n=t.charCodeAt(r+1);if(n>=56320&&n<=57343){let o=i-55296,a=n-56320;i=2**16+o*2**10+a,r++}}e.push(i)}return e}var Fa=8205,pf=[[Fa,1],[65038,2],[127995,5],[129456,4],[917536,96]],Na,O0=[127462,127487];function B0(t){var e;if(Na===void 0){Na={};for(let r of pf)for(let i=r[0];i<=r[0]+r[1]-1;i++)Na[i]=!0}return(e=Na[t])!=null?e:!1}function hf(t){return t>=O0[0]&&t<=O0[1]}function $a(t){if(/^[\u0020-\u00FF]*$/.test(t))return t;let e=[],r=mf(t),i=0;for(;i=this.s.length}get(){return this.pos";let e=this.get();if(e==="\\"){if(!this.end()){let r=this.match(/^[a-zA-Z\*]+/);return r?this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]*/):r=this.get(),"\\"+r}}else{if(e==="{")return"<{>";if(e==="}")return"<}>";if(e==="^"){if(this.peek()==="^"){this.get();let r=this.match(/^(\^(\^(\^(\^[\da-f])?[\da-f])?[\da-f])?[\da-f])?[\da-f]{2}/);if(r)return String.fromCodePoint(Number.parseInt(r.slice(r.lastIndexOf("^")+1),16))}return e}else if(e==="#"){if(!this.end()){let r=!1;if(/[\d?@]/.test(this.peek())&&(r=!0,this.pos+1"):"<$>"}return e}};function ff(t,e){var n,o,a,s;let r=[],i=t.next();if(i&&i!=="\\relax"){if(i==="\\noexpand")i=t.next(),i&&r.push(i);else if(i==="\\obeyspaces")t.obeyspaces=!0;else if(i==="\\bgroup")r.push("<{>");else if(i==="\\egroup")r.push("<}>");else if(i==="\\string"){if(i=t.next(),i)if(i.startsWith("\\"))for(let l of i)r.push(l==="\\"?"\\backslash":l);else i==="<{>"?r.push("\\{"):i===""?r.push("~"):i==="<}>"&&r.push("\\}")}else if(i==="\\csname"){for(;t.peek()==="";)t.next();let l="",c=!1,u=[];do{if(u.length===0)if(/^#[\d?@]$/.test(t.peek())){let m=t.get().slice(1);u=ji((o=(n=e==null?void 0:e(m))!=null?n:e==null?void 0:e("?"))!=null?o:"\\placeholder{}",e),i=u[0]}else i=t.next(),u=i?[i]:[];c=u.length===0,!c&&i==="\\endcsname"&&(c=!0,u.shift()),c||(c=i==="<$>"||i==="<$$>"||i==="<{>"||i==="<}>"||typeof i=="string"&&i.length>1&&i.startsWith("\\")),c||(l+=u.shift())}while(!c);l&&r.push("\\"+l),r.push(...u)}else if(i!=="\\endcsname")if(i.length>1&&i.startsWith("#")){let l=i.slice(1);r.push(...ji((s=(a=e==null?void 0:e(l))!=null?a:e==null?void 0:e("?"))!=null?s:"\\placeholder{}",e))}else r.push(i)}return r}function ji(t,e=null){if(!t)return[];let r=[],i="";for(let a of t.toString().split(/\r?\n/)){i&&r.push(i),i=" ";let s=a.match(/((?:\\%)|[^%])*/);s!==null&&r.push(s[0])}let n=new Zl(r.join("")),o=[];do o.push(...ff(n,e));while(!n.end());return o}function P(t){let e="",r=[];for(let i of t)i&&(e&&/^[a-zA-Z\*]/.test(i)&&r.push(e),r.push(i),/^\\[a-zA-Z]+\*?[\"\'][^\ ]+$/.test(i)&&r.push(" "),e=/\\[a-zA-Z]+\*?$/.test(i)?" ":"");return r.join("")}function W(t,...e){return t.startsWith("\\"),e.length===0?t:P([t,...e.map(r=>`{${r}}`)])}function Er(t){return P(t.map(e=>{var r;return(r={"":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"}[e])!=null?r:e}))}var ni=class ni{constructor(e){ni._registry[e]=this}static createAtom(e,r,i){return ni._registry[e].createAtom(r,ne(r,e),i)}static serialize(e,r){var i;if(!e||e.length===0)return"";if((i=r.skipStyles)!=null&&i){let n=[];for(let o of P0(e)){let a=ni._registry[o[0].mode];n.push(...a.serialize(o,r))}return P(n)}return P(bf(e,r))}static getFont(e,r,i){return ni._registry[e].getFont(r,i)}};ni._registry={};var ve=ni;function P0(t){let e=[],r=[],i="NONE";for(let n of t)n.type!=="first"&&(n.mode!==i?(r.length>0&&e.push(r),r=[n],i=n.mode):r.push(n));return r.length>0&&e.push(r),e}function Va(t){if((t==null?void 0:t.mode)!=="math")return"";let{style:e}=t;return!e||!e.variantStyle?"":e.variantStyle==="bold"||e.variantStyle==="bolditalic"?"bold":""}function qa(t){if(!t)return"";let{style:e}=t;if(!e)return"";let r=e.variant;return r===void 0?"normal":(!["calligraphic","fraktur","double-struck","script","monospace","sans-serif"].includes(r)&&e.variantStyle&&(r+="-"+e.variantStyle),r)}function mt(t,e){let r=[],i=[],n;for(let o of t){if(o.type==="first")continue;let a;e==="variant"?a=qa(o):e==="bold"?a=Va(o):a=o.style[e],a===n?i.push(o):(i.length>0&&r.push(i),i=[o],n=a)}return i.length>0&&r.push(i),r}function K0(t,e){var o;let{parent:r}=t[0],i=r==null?void 0:r.style.color,n=[];for(let a of P0(t)){let s=e.defaultMode;for(let l of mt(a,"color")){let c=l[0].style,u=ve._registry[l[0].mode].serialize(l,g(p({},e),{defaultMode:s==="text"?"text":"math"}));!e.skipStyles&&c.color&&c.color!=="none"&&(!r||i!==c.color)?n.push(W("\\textcolor",(o=c.verbatimColor)!=null?o:c.color,P(u))):n.push(P(u))}}return n}function gf(t,e){let{parent:r}=t[0],i=r==null?void 0:r.style.backgroundColor;return mt(t,"backgroundColor").map(n=>{var o;if(n.length>0||n[0].type!=="box"){let a=n[0].style;if(a.backgroundColor&&a.backgroundColor!=="none"&&(!r||i!==a.backgroundColor))return W("\\colorbox",(o=a.verbatimBackgroundColor)!=null?o:a.backgroundColor,P(K0(n,g(p({},e),{defaultMode:"text"}))))}return P(K0(n,e))})}function bf(t,e){if(t.length===0)return[];let{parent:r}=t[0],i=r==null?void 0:r.style.fontSize,n=[];for(let o of mt(t,"fontSize")){let a=o[0].style.fontSize,s=gf(o,e);s&&(a&&a!=="auto"&&(!r||i!==a)?n.push(["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][a],...s):n.push(...s))}return n}function Ha(t){return t?{mord:"ord",mbin:"bin",mop:"op",mrel:"rel",mopen:"open",mclose:"close",mpunct:"punct",minner:"inner",spacing:"ignore",latex:"latex",composition:"inner",error:"inner",placeholder:"ord",supsub:"ignore"}[t]:void 0}function oi(t){if(t.length===0)return"ord";let e=Ha(t[0].type),r=Ha(t[t.length-1].type);return e&&e===r?e:"ord"}function Jn(t,e){if(typeof t=="string")return t;if(typeof t=="number"){Number.isFinite(t);let r=Math.ceil(100*t)/100;return r===0?"0":r.toString()+(e!=null?e:"")}return""}var w=class t{constructor(e,r){var n,o,a,s,l;if(typeof e=="number"?this.value=String.fromCodePoint(e):typeof e=="string"?this.value=e:ee(e)?this.children=e.filter(c=>c!==null):e&&e instanceof t&&(this.children=[e]),this.children)for(let c of this.children)c.parent=this;this.type=(n=r==null?void 0:r.type)!=null?n:"ignore",this.isSelected=(r==null?void 0:r.isSelected)===!0,r!=null&&r.caret&&(this.caret=r.caret),this.classes=(o=r==null?void 0:r.classes)!=null?o:"",this.isTight=(a=r==null?void 0:r.isTight)!=null?a:!1,r!=null&&r.attributes&&(this.attributes=r.attributes);let i=r==null?void 0:r.fontFamily;r!=null&&r.style&&this.value&&(i=(l=ve.getFont((s=r.mode)!=null?s:"math",this,g(p({variant:"normal"},r.style),{letterShapeStyle:r.letterShapeStyle})))!=null?l:void 0),i||(i="Main-Regular"),this._height=0,this._depth=0,this._width=0,this.hasExplicitWidth=!1,this.skew=0,this.italic=0,this.maxFontSize=0,this.scale=1,(r==null?void 0:r.maxFontSize)!==void 0&&(this.maxFontSize=r.maxFontSize),yf(this,i)}set atomID(e){e===void 0||e.length===0||(this.id=e)}selected(e){if(this.isSelected!==e&&(this.isSelected=e,this.children))for(let r of this.children)r.selected(e)}setStyle(e,r,i){if(r===void 0)return;let n=Jn(r,i);n.length>0&&(this.cssProperties||(this.cssProperties={}),this.cssProperties[e]=n)}setTop(e){Number.isFinite(e)&&Math.abs(e)>.01&&(this.cssProperties||(this.cssProperties={}),this.cssProperties.top=Jn(e,"em"),this.height-=e,this.depth+=e)}get left(){var e;return(e=this.cssProperties)!=null&&e["margin-left"]?Number.parseFloat(this.cssProperties["margin-left"]):0}set left(e){Number.isFinite(e)&&(e===0?this.cssProperties&&delete this.cssProperties["margin-left"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-left"]=Jn(e,"em")))}set right(e){Number.isFinite(e)&&(e===0?this.cssProperties&&delete this.cssProperties["margin-right"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-right"]=Jn(e,"em")))}set bottom(e){Number.isFinite(e)&&(e===0?this.cssProperties&&delete this.cssProperties["margin-bottom"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-bottom"]=Jn(e,"em")))}get width(){return this._width*this.scale}set width(e){this._width=e,this.hasExplicitWidth=!0}set softWidth(e){}get height(){return this._height*this.scale}set height(e){this._height=e}get depth(){return this._depth*this.scale}set depth(e){this._depth=e}wrap(e){let r=e.parent;if(!r)return this;e.isPhantom&&this.setStyle("opacity",0);let i=e.color;i&&i!==r.color&&this.setStyle("color",i);let o=e.backgroundColor;this.isSelected&&(o=Eu(o)),o&&o!==r.backgroundColor&&(this.setStyle("background-color",o),this.setStyle("--bg-color",o),this.setStyle("display","inline-block"),this.setStyle("position","relative"),this.classes=this.classes?`${this.classes} ML__bg`:"ML__bg");let a=e.scalingFactor;return this.scale=a,this.skew*=a,this.italic*=a,this}toMarkup(){var c,u,m,d;let e=(c=this.value)!=null?c:"";if(this.children)for(let h of this.children)e+=h.toMarkup();let r="";if(this.svgBody)r=T0(this.svgBody);else if(this.svgOverlay){r='',r+=e,r+="",r+='${this.svgOverlay}`}let i=[],n=this.classes.split(" ");n.push((m={latex:"ML__raw-latex",placeholder:"ML__placeholder",error:"ML__error"}[this.type])!=null?m:""),this.caret==="latex"&&n.push("ML__latex-caret"),this.isSelected&&n.push("ML__selected");let o=n.length===1?n[0]:n.filter((h,f,x)=>h.length>0&&x.indexOf(h)===f).join(" ");if(o.length>0&&i.push(`class=${Ji(`"${o}"`)}`),this.id&&i.push(` data-atom-id=${Ji(this.id)}`),this.cssId&&i.push(` id=${Ji(`"${this.cssId.replace(/ /g,"-")}"`)}`),this.attributes&&i.push(...Object.keys(this.attributes).map(h=>`${Yl(h)}=${Ji(this.attributes[h])}`)),this.htmlData){let h=this.htmlData.split(",");for(let f of h){let x=f.match(/([^=]+)=(.+$)/);if(x){let _=Yl(x[1]);if(_)if(_==="href"){let b=new URL(x[2]);if(b.protocol!=="http:"&&b.protocol!=="https:")throw new Error(`Invalid URL: ${x[2]}`);i.push(`href="proxy.php?url=${x[2].replace(/"/g,""")}"`)}else i.push(`data-${_}=${Ji(x[2])}`)}else{let _=Yl(f);_&&i.push(`data-${_} `)}}}let a=(d=this.cssProperties)!=null?d:{};this.hasExplicitWidth&&a.width===void 0&&(a.width=`${Math.ceil(this._width*100)/100}em`);let s=Object.keys(a).map(h=>`${h}:${a[h]}`);if(this.scale!==void 0&&this.scale!==1&&(e.length>0||r.length>0)&&s.push(`font-size: ${Math.ceil(this.scale*1e4)/100}%`),this.htmlStyle)for(let h of this.htmlStyle.split(";")){let f=h.match(/([^:]+):(.+$)/);if(f){let x=f[1].trim().replace(/ /g,"-");x&&s.push(`${x}:${f[2]}`)}}s.length>0&&i.push(`style=${Ji(s.join(";"))}`);let l="";return i.length>0||r.length>0?l=`${e}${r}`:l=e,this.caret==="text"?l+='':this.caret==="math"&&(l+=''),l}tryCoalesceWith(e){if(this.svgBody||!this.value||e.svgBody||!e.value)return!1;let r=this.children&&this.children.length>0,i=e.children&&e.children.length>0;if(r||i)return!1;if(e.cssProperties||this.cssProperties){for(let l of["border","border-left","border-right","border-right-width","left","margin","margin-left","margin-right","padding","position","width"])if(e.cssProperties&&l in e.cssProperties||this.cssProperties&&l in this.cssProperties)return!1}let n=this.cssProperties?Object.keys(this.cssProperties).length:0,o=e.cssProperties?Object.keys(e.cssProperties).length:0;if(n!==o)return!1;if(n>0){for(let l of Object.keys(this.cssProperties))if(this.cssProperties[l]!==e.cssProperties[l])return!1}let a=this.classes.trim().replace(/\s+/g," ").split(" "),s=e.classes.trim().replace(/\s+/g," ").split(" ");if(a.length!==s.length)return!1;a.sort(),s.sort();for(let[l,c]of a.entries())if(c==="ML__vertical-separator"||c!==s[l])return!1;return this.value+=e.value,this.height=Math.max(this.height,e.height),this.depth=Math.max(this.depth,e.depth),this._width=this._width+e._width,this.maxFontSize=Math.max(this.maxFontSize,e.maxFontSize),this.italic=e.italic,!0}};function Ql(t){if(!t||t.length===0)return[];t[0].children=Ql(t[0].children);let e=[t[0]];for(let r=1;r0){let i=-1/0,n=-1/0,o=0;for(let a of t.children)a.height>i&&(i=a.height),a.depth>n&&(n=a.depth),o=Math.max(o,(r=a.maxFontSize)!=null?r:0);t.height=i,t.depth=n,t._width=t.children.reduce((a,s)=>a+s.width,0),t.maxFontSize=o}}function Yl(t){if(t=t.trim().replace(/ /g,"-"),t.length===0)throw new Error("Invalid empty attribute name");if(/[\x20\x09\x0a\x0c\x0d"'>/=\x00-\x1f]/.test(t))throw new Error(`Invalid attribute name "${t}"`);return t}function Ji(t){if(t=t.trim(),t.startsWith('"')&&t.endsWith('"')){if(/"/.test(t.slice(1,-1)))throw new Error(`Invalid attribute value: ${t}`);return t}if(t.startsWith("'")&&t.endsWith("'")){if(/'/.test(t.slice(1,-1)))throw new Error(`Invalid attribute value: ${t}`);return t}if(t.length===0)throw new Error("Invalid empty attribute value");return`"${t.replace(/"/g,""")}"`}function xf(t){if("individualShift"in t){let e=t.individualShift,r=e[0];if(r==null)return[null,0];let i=[r],n=-r.shift-r.box.depth,o=n;for(let a=1;a{f.softWidth=c});let u=new w(o,{classes:"ML__vlist"});if(u.softWidth=c,u.height=s,u.setStyle("height",s,"em"),a>=0)return[[new w(u,{classes:"ML__vlist-r"})],s,-a];let m=new w(new w(null),{classes:"ML__vlist"});m.height=-a,m.setStyle("height",-a,"em");let d=new w(8203,{classes:"ML__vlist-s",maxFontSize:0});return d.softWidth=0,d.height=0,d.depth=0,[[new w([u,d],{classes:"ML__vlist-r"}),new w(m,{classes:"ML__vlist-r"})],s,-a]}var te=class extends w{constructor(e,r){var a;let[i,n,o]=vf(e);super(i.length===1?i[0]:i,{type:r==null?void 0:r.type,classes:((a=r==null?void 0:r.classes)!=null?a:"")+" ML__vlist-t"+(i.length===2?" ML__vlist-t2":"")}),this.height=n,this.depth=o,this.softWidth=i.reduce((s,l)=>Math.max(s,l.width),0)}};function R0(t,e){var c,u,m,d,h;let r=t.metrics,i=new w(e.base),n=(c=e.baseShift)!=null?c:0,o=(u=e.slant)!=null?u:0,a=0,s=0;e.above&&(a=(m=e.aboveShift)!=null?m:Math.max(r.bigOpSpacing1,r.bigOpSpacing3-e.above.depth)),e.below&&(s=(d=e.belowShift)!=null?d:Math.max(r.bigOpSpacing2,r.bigOpSpacing4-e.below.height));let l=null;if(e.below&&e.above){let f=r.bigOpSpacing5+e.below.height+e.below.depth+s+i.depth+n;l=new te({bottom:f,children:[r.bigOpSpacing5,{box:e.below,marginLeft:-o,classes:["ML__center"]},s,{box:i,classes:["ML__center"]},a,{box:e.above,marginLeft:o,classes:["ML__center"]},r.bigOpSpacing5]}).wrap(t)}else if(e.below&&!e.above)l=new te({top:i.height-n,children:[r.bigOpSpacing5,{box:e.below,marginLeft:-o,classes:["ML__center"]},s,{box:i,classes:["ML__center"]}]}).wrap(t);else if(!e.below&&e.above){let f=i.depth+n;l=new te({bottom:f,children:[{box:i,classes:["ML__center"]},a,{box:e.above,marginLeft:o,classes:["ML__center"]},r.bigOpSpacing5]}).wrap(t)}else{let f=i.depth+n;l=new te({bottom:f,children:[{box:i},r.bigOpSpacing5]}).wrap(t)}return new w(l,{type:(h=e.type)!=null?h:"op"})}var Wa=7,Xn=6,Zn=5,Or=4,ai=3,Ve=2,Br=1,Ee=0,Rt=class{constructor(e,r,i){this.id=e,this.sizeDelta=r,this.cramped=i;let n={"-4":2,"-3":1,0:0}[r];this.metrics=Object.keys(Jl).reduce((o,a)=>g(p({},o),{[a]:Jl[a][n]}),{})}getFontSize(e){return Math.max(1,e+this.sizeDelta)}get sup(){return pt[[Ee,Br,Ee,Br,Ve,ai,Ve,ai][this.id]]}get sub(){return pt[[Ee,Ee,Ee,Ee,Ve,Ve,Ve,Ve][this.id]]}get fracNum(){return pt[[Ee,Br,Ee,Br,Ve,ai,Or,Zn][this.id]]}get fracDen(){return pt[[Ee,Ee,Ee,Ee,Ve,Ve,Or,Or][this.id]]}get cramp(){return pt[[Ee,Ee,Ve,Ve,Or,Or,Xn,Xn][this.id]]}get isTight(){return this.sizeDelta<0}},Gn={7:new Rt(Wa,0,!1),6:new Rt(Xn,0,!0),5:new Rt(Zn,0,!1),4:new Rt(Or,0,!0),3:new Rt(ai,-3,!1),2:new Rt(Ve,-3,!0),1:new Rt(Br,-4,!1),0:new Rt(Ee,-4,!0)},pt=g(p({},Gn),{displaystyle:Gn[Wa],textstyle:Gn[Zn],scriptstyle:Gn[ai],scriptscriptstyle:Gn[Br]});function tc(t,e){var i;if(!t)return 0;let r={pt:1,mm:7227/2540,cm:7227/254,ex:35271/8192,px:3/4,em:Pt,bp:803/800,dd:1238/1157,pc:12,in:72.27,mu:10/18}[(i=t.unit)!=null?i:"pt"];if(Number.isFinite(e)){let n=10**e;return Math.round(t.dimension/Pt*r*n)/n}return t.dimension*r}function Ua(t,e){if(t===null)return 0;let r=tc(t)/Pt;if(Number.isFinite(e)){let i=10**e;return Math.round(r*i)/i}return r}function ec(t){var e;return`${t.dimension}${(e=t.unit)!=null?e:"pt"}`}function _f(t){let e=ec(t.glue);return t.grow&&t.grow.dimension!==0&&(e+=` plus ${ec(t.grow)}`),t.shrink&&t.shrink.dimension!==0&&(e+=` minus ${ec(t.shrink)}`),e}function _e(t){var r,i;if(t==null)return null;let e="";if("dimension"in t&&(e=`${t.dimension}${(r=t.unit)!=null?r:"pt"}`),"glue"in t&&(e=_f(t)),"number"in t)if(!("base"in t)||t.base==="decimal")e=Number(t.number).toString();else if(t.base==="alpha")e=`\`${String.fromCodePoint(t.number)}`;else{let n=Math.round(t.number)>>>0;t.base==="hexadecimal"?(e=Number(n).toString(16).toUpperCase(),n<=255?e=e.padStart(2,"0"):n<=65535?e=e.padStart(4,"0"):n<=16777215?e=e.padStart(6,"0"):e=e.padStart(8,"0"),e=`"${e}`):t.base==="octal"&&(e=Number(n).toString(8),n<=63?e=e.padStart(2,"0"):n<=30583?e=e.padStart(4,"0"):e=e.padStart(8,"0"),e=`'${e}`)}return"register"in t&&("factor"in t&&(t.factor===-1?e="-":t.factor!==1&&(e=Number(t.factor).toString())),"global"in t&&t.global&&(e+="\\global"),e+=`\\${t.register}`),"string"in t&&(e=t.string),(i=t.relax)!=null&&i&&(e+="\\relax"),e}function ht(t,e){return t==null?null:"number"in t?g(p({},t),{number:t.number*e}):"register"in t?"factor"in t&&t.factor?g(p({},t),{factor:t.factor*e}):g(p({},t),{factor:e}):"dimension"in t?g(p({},t),{dimension:t.dimension*e}):"glue"in t?t.shrink&&t.grow?{glue:ht(t.glue,e),shrink:ht(t.shrink,e),grow:ht(t.grow,e)}:t.shrink?{glue:ht(t.glue,e),shrink:ht(t.shrink,e)}:t.grow?{glue:ht(t.glue,e),grow:ht(t.grow,e)}:{glue:ht(t.glue,e)}:null}var Mf={"p@":{dimension:1},"z@":{dimension:0},maxdimen:{dimension:16383.99999},hfuzz:{dimension:.1},vfuzz:{dimension:.1},overfullrule:{dimension:5},hsize:{dimension:6.5,unit:"in"},vsize:{dimension:8.9,unit:"in"},parindent:{dimension:20},maxdepth:{dimension:4},splitmaxdepth:{register:"maxdimen"},boxmaxdepth:{register:"maxdimen"},delimitershortfall:{dimension:5},nulldelimiterspace:{dimension:1.2,unit:"pt"},scriptspace:{dimension:.5},topskip:{dimension:10},splittopskip:{dimension:10},normalbaselineskip:{dimension:12},normallineskip:{dimension:1},normallineskiplimit:{dimension:0},jot:{dimension:3},doublerulesep:{dimension:2},arrayrulewidth:{dimension:.4},arraycolsep:{dimension:5},fboxsep:{dimension:3},fboxrule:{dimension:.4},"z@skip":{glue:{dimension:0},shrink:{dimension:0},grow:{dimension:0}},hideskip:{glue:{dimension:-1e3},grow:{dimension:1,unit:"fill"}},"@flushglue":{glue:{dimension:0},grow:{dimension:1,unit:"fill"}},parskip:{glue:{dimension:0},grow:{dimension:1}},abovedisplayskip:{glue:{dimension:12},grow:{dimension:3},shrink:{dimension:9}},abovedisplayshortskip:{glue:{dimension:0},grow:{dimension:3}},belowdisplayskip:{glue:{dimension:12},grow:{dimension:3},shrink:{dimension:9}},belowdisplayshortskip:{glue:{dimension:7},grow:{dimension:3},shrink:{dimension:4}},parfillskip:{glue:{dimension:0},grow:{dimension:1,unit:"fil"}},thinmuskip:{glue:{dimension:3,unit:"mu"}},medmuskip:{glue:{dimension:4,unit:"mu"},grow:{dimension:2,unit:"mu"},shrink:{dimension:4,unit:"mu"}},thickmuskip:{glue:{dimension:5,unit:"mu"},grow:{dimension:5,unit:"mu"}},smallskipamount:{glue:{dimension:3},grow:{dimension:1},shrink:{dimension:1}},medskipamount:{glue:{dimension:6},grow:{dimension:2},shrink:{dimension:3}},bigskipamount:{glue:{dimension:12},grow:{dimension:2},shrink:{dimension:4}},pretolerance:100,tolerance:200,hbadness:1e3,vbadness:1e3,linepenalty:10,hyphenpenalty:50,exhyphenpenalty:50,binoppenalty:700,relpenalty:500,clubpenalty:150,widowpenalty:150,displaywidowpenalty:50,brokenpenalty:100,predisplaypenalty:1e4,doublehyphendemerits:1e4,finalhyphendemerits:5e3,adjdemerits:1e4,tracinglostchars:1,uchyph:1,delimiterfactor:901,defaulthyphenchar:"\\-",defaultskewchar:-1,newlinechar:-1,showboxbreadth:5,showboxdepth:3,errorcontextlines:5,interdisplaylinepenalty:100,interfootnotelinepenalty:100,baselineSkip:1.2,arraystretch:1,month:new Date().getMonth()+1,day:new Date().getDate(),year:new Date().getFullYear()};function ja(){return p({},Mf)}function Yn(){return{registers:ja(),smartFence:!1,renderPlaceholder:void 0,placeholderSymbol:"\u25A2",letterShapeStyle:F.locale.startsWith("fr")?"french":"tex",minFontScale:0,maxMatrixCols:10,colorMap:Xr,backgroundColorMap:Ei,getMacro:t=>Ki(t,Bi())}}var K=class t{constructor(e,r){var o,a,s,l,c,u,m,d,h,f,x,_,b,v,k;let i;e!=null&&e.parent?(this.parent=e.parent,i=e.parent,this.registers={}):(i=p(p({},Yn()),(o=e==null?void 0:e.from)!=null?o:{}),this.registers=i.registers),i.atomIdsSettings&&(this.atomIdsSettings=p({},i.atomIdsSettings)),this.renderPlaceholder=i.renderPlaceholder,this.isPhantom=(l=(s=e==null?void 0:e.isPhantom)!=null?s:(a=this.parent)==null?void 0:a.isPhantom)!=null?l:!1,this.letterShapeStyle=i.letterShapeStyle,this.minFontScale=i.minFontScale,this.maxMatrixCols=i.maxMatrixCols,r!=null&&r.color&&r.color!=="none"?this.color=r.color:this.color=(u=(c=this.parent)==null?void 0:c.color)!=null?u:"",r!=null&&r.backgroundColor&&r.backgroundColor!=="none"?this.backgroundColor=r.backgroundColor:this.backgroundColor=(d=(m=this.parent)==null?void 0:m.backgroundColor)!=null?d:"",r!=null&&r.fontSize&&r.fontSize!=="auto"&&r.fontSize!==((h=this.parent)==null?void 0:h.size)?this.size=r.fontSize:this.size=(x=(f=this.parent)==null?void 0:f.size)!=null?x:Ui;let n=(b=(_=this.parent)==null?void 0:_.mathstyle)!=null?b:pt.displaystyle;if(typeof(e==null?void 0:e.mathstyle)=="string"){if(i instanceof t)switch(e.mathstyle){case"cramp":n=n.cramp;break;case"superscript":n=n.sup;break;case"subscript":n=n.sub;break;case"numerator":n=n.fracNum;break;case"denominator":n=n.fracDen;break}switch(e.mathstyle){case"textstyle":n=pt.textstyle;break;case"displaystyle":n=pt.displaystyle;break;case"scriptstyle":n=pt.scriptstyle;break;case"scriptscriptstyle":n=pt.scriptscriptstyle;break;case"":case"auto":break}}this.mathstyle=n,this.smartFence=i.smartFence,this.placeholderSymbol=i.placeholderSymbol,this.colorMap=(v=i.colorMap)!=null?v:(A=>A),this.backgroundColorMap=(k=i.backgroundColorMap)!=null?k:(A=>A),this.getMacro=i.getMacro,this.parent!==void 0||this.registers}makeID(){if(!this.atomIdsSettings)return;if(this.atomIdsSettings.overrideID)return this.atomIdsSettings.overrideID;if(typeof this.atomIdsSettings.seed!="number")return`${Date.now().toString(36).slice(-2)}${Math.floor(Math.random()*1e5).toString(36)}`;let e=this.atomIdsSettings.seed.toString(36);return this.atomIdsSettings.seed+=1,e}scale(e){return e*this.effectiveFontSize}get scalingFactor(){return this.parent?this.effectiveFontSize/this.parent.effectiveFontSize:1}get isDisplayStyle(){return this.mathstyle.id===Wa||this.mathstyle.id===Xn}get isCramped(){return this.mathstyle.cramped}get isTight(){return this.mathstyle.isTight}get metrics(){return this.mathstyle.metrics}get effectiveFontSize(){return Math.max(jn[Math.max(1,this.size+this.mathstyle.sizeDelta)],this.minFontScale)}getRegister(e){if(this.registers&&e in this.registers)return this.registers[e];if(this.parent)return this.parent.getRegister(e)}getRegisterAsNumber(e){let r=this.getRegister(e);if(typeof r=="number")return r;if(typeof r=="string")return Number(r)}getRegisterAsGlue(e){if(this.registers&&e in this.registers){let r=this.registers[e];return typeof r=="object"&&"glue"in r?r:typeof r=="object"&&"dimension"in r?{glue:{dimension:r.dimension}}:typeof r=="number"?{glue:{dimension:r}}:void 0}if(this.parent)return this.parent.getRegisterAsGlue(e)}getRegisterAsEm(e,r){return Ua(this.getRegisterAsDimension(e),r)}getRegisterAsDimension(e){if(this.registers&&e in this.registers){let r=this.registers[e];return typeof r=="object"&&"glue"in r?r.glue:typeof r=="object"&&"dimension"in r?r:typeof r=="number"?{dimension:r}:void 0}if(this.parent)return this.parent.getRegisterAsDimension(e)}setRegister(e,r){if(r===void 0){delete this.registers[e];return}this.registers[e]=r}evaluate(e){if(!e||!("register"in e))return e;let r=this;if("global"in e&&e.global)for(;r.parent;)r=r.parent;let i=1;"factor"in e&&e.factor!==1&&e.factor!==void 0&&(i=e.factor);let n=r.getRegister(e.register);if(n===void 0)return;if(typeof n=="string")return{string:Number(n).toString()+n};if(typeof n=="number")return{number:i*n};let o=r.evaluate(n);if(o!==void 0)return"string"in o?{string:Number(n).toString()+o.string}:"number"in o?{number:i*o.number}:"dimension"in o?g(p({},o),{dimension:i*o.dimension}):"glue"in o?g(p({},o),{glue:g(p({},o.glue),{dimension:i*o.glue.dimension}),shrink:o.shrink?g(p({},o.shrink),{dimension:i*o.shrink.dimension}):void 0,grow:o.grow?g(p({},o.grow),{dimension:i*o.grow.dimension}):void 0}):e}toDimension(e){let r=this.evaluate(e);if(r===void 0)return null;if("dimension"in r)return r;if("glue"in r)return r.glue;if("number"in r)return{dimension:r.number};if("string"in r){let i=parseFloat(r.string),n=r.string.match(/(mm|cm|ex|px|em|bp|dd|pc|in|mu)$/);return n?{dimension:i,unit:n[0]}:{dimension:i}}return null}toEm(e,r){if(e===null)return 0;let i=this.toDimension(e);return i===null?0:tc(i,r)/Pt}toNumber(e){if(e===null)return null;let r=this.evaluate(e);return r===void 0?null:"number"in r?r.number:"dimension"in r?r.dimension:"glue"in r?r.glue.dimension:"string"in r?Number(r.string):null}toColor(e){var i,n;if(e===null)return null;let r=this.evaluate(e);return r===void 0?null:"string"in r?(n=(i=this.colorMap)==null?void 0:i.call(this,r.string))!=null?n:r.string:null}toBackgroundColor(e){var i,n;if(e===null)return null;let r=this.evaluate(e);return r===void 0?null:"string"in r?(n=(i=this.backgroundColorMap)==null?void 0:i.call(this,r.string))!=null?n:r.string:null}};var Pr=["body","above","below","superscript","subscript"];function Kr(t){return typeof t=="string"&&Pr.includes(t)}function Ge(t){return t!==void 0&&Array.isArray(t)&&t.length===2}var y=class t{constructor(e){this.isRoot=!1;var r,i,n,o,a,s,l;this.type=e.type,typeof e.value=="string"&&(this.value=e.value),this.command=(i=(r=e.command)!=null?r:this.value)!=null?i:"",this.mode=(n=e.mode)!=null?n:"math",e.isFunction&&(this.isFunction=!0),(e.isRoot||this.type==="root")&&(this.isRoot=!0),e.limits&&(this.subsupPlacement=e.limits),this.style=p({},(o=e.style)!=null?o:{}),this.displayContainsHighlight=(a=e.displayContainsHighlight)!=null?a:!1,this.captureSelection=(s=e.captureSelection)!=null?s:!1,this.skipBoundary=(l=e.skipBoundary)!=null?l:!1,e.verbatimLatex!==void 0&&e.verbatimLatex!==null&&(this.verbatimLatex=e.verbatimLatex),e.args&&(this.args=e.args),e.body&&(this.body=e.body),this._changeCounter=0}static createBox(e,r,i){var s;if(!r)return null;let n=wf(r),o=[];for(let l of n){let c=l[0].style,u=Sf(e,l,{style:{color:c.color,backgroundColor:c.backgroundColor,fontSize:c.fontSize}});u&&o.push(u)}if(o.length===0)return null;let a=((s=i==null?void 0:i.classes)!=null?s:"").trim();return o.length===1&&!a&&!(i!=null&&i.type)?o[0].wrap(e):new w(o,{classes:a,type:i==null?void 0:i.type}).wrap(e)}static serialize(e,r){return ve.serialize(e,r)}static commonAncestor(e,r){if(e===r||e.parent===r.parent)return e.parent;let i=new WeakSet,{parent:n}=e;for(;n;)i.add(n),n=n.parent;for(n=r.parent;n;){if(i.has(n))return n;n=n.parent}}static fromJson(e){return typeof e=="string"?new t({type:"mord",value:e,mode:"math"}):new t(e)}toJson(){if(this._json)return this._json;let e={};if(this.type&&(e.type=this.type),this.mode!=="math"&&(e.mode=this.mode),this.command&&this.command!==this.value&&(e.command=this.command),this.value!==void 0&&(e.value=this.value),this.style&&Object.keys(this.style).length>0&&(e.style=p({},this.style)),this.verbatimLatex!==void 0&&(e.verbatimLatex=this.verbatimLatex),this.subsupPlacement&&(e.subsupPlacement=this.subsupPlacement),this.explicitSubsupPlacement&&(e.explicitSubsupPlacement=!0),this.isFunction&&(e.isFunction=!0),this.displayContainsHighlight&&(e.displayContainsHighlight=!0),this.skipBoundary&&(e.skipBoundary=!0),this.captureSelection&&(e.captureSelection=!0),this.args&&(e.args=kf(this.args)),this._branches)for(let r of Object.keys(this._branches))this._branches[r]&&(e[r]=this._branches[r].filter(i=>i.type!=="first").map(i=>i.toJson()));return e.type==="mord"&&Object.keys(e).length===2&&"value"in e?e.value:(this._json=e,e)}get changeCounter(){return this.parent?this.parent.changeCounter:this._changeCounter}set isDirty(e){e&&(this._json=void 0,this.parent||this._changeCounter++,"verbatimLatex"in this&&(this.verbatimLatex=void 0),this._children=void 0,this.parent&&(this.parent.isDirty=!0))}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;let r=ne(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,e):this.body&&this.command?P([W(this.command,this.bodyToLatex(e)),this.supsubToLatex(e)]):this.body?P([this.bodyToLatex(e),this.supsubToLatex(e)]):!this.value||this.value==="\u200B"?"":this.command}bodyToLatex(e){var i;let r=(i=e.defaultMode)!=null?i:this.mode==="math"?"math":"text";return ve.serialize(this.body,g(p({},e),{defaultMode:r}))}aboveToLatex(e){return ve.serialize(this.above,e)}belowToLatex(e){return ve.serialize(this.below,e)}supsubToLatex(e){let r="";if(e=g(p({},e),{defaultMode:"math"}),this.branch("subscript")!==void 0){let i=ve.serialize(this.subscript,e);i.length===0?r+="_{}":i.length===1?/^[0-9]$/.test(i)?r+=`_${i}`:r+=`_{${i}}`:r+=`_{${i}}`}if(this.branch("superscript")!==void 0){let i=ve.serialize(this.superscript,e);i.length===0?r+="^{}":i.length===1?i==="\u2032"?r+="^\\prime ":i==="\u2033"?r+="^\\doubleprime ":/^[0-9]$/.test(i)?r+=`^${i}`:r+=`^{${i}}`:r+=`^{${i}}`}return r}get treeDepth(){let e=1,r=this.parent;for(;r;)r=r.parent,e+=1;return e}get inCaptureSelection(){let e=this;for(;e;){if(e.captureSelection)return!0;e=e.parent}return!1}get parentPrompt(){let e=this.parent;for(;e;){if(e.type==="prompt"&&!e.captureSelection)return e;e=e.parent}return null}branch(e){if(Kr(e)&&this._branches)return this._branches[e]}get branches(){if(!this._branches)return[];let e=[];for(let r of Pr)this._branches[r]&&e.push(r);return e}createBranch(e){return Kr(e),Kr(e)?(this._branches?this._branches[e]||(this._branches[e]=[this.makeFirstAtom(e)]):this._branches={[e]:[this.makeFirstAtom(e)]},this.isDirty=!0,this._branches[e]):[]}get row(){return Ge(this.parentBranch)?this.parentBranch[0]:-1}get col(){return Ge(this.parentBranch)?this.parentBranch[1]:-1}get body(){var e;return(e=this._branches)==null?void 0:e.body}set body(e){this.setChildren(e,"body")}get superscript(){var e;return(e=this._branches)==null?void 0:e.superscript}set superscript(e){this.setChildren(e,"superscript")}get subscript(){var e;return(e=this._branches)==null?void 0:e.subscript}set subscript(e){this.setChildren(e,"subscript")}get above(){var e;return(e=this._branches)==null?void 0:e.above}set above(e){this.setChildren(e,"above")}get below(){var e;return(e=this._branches)==null?void 0:e.below}set below(e){this.setChildren(e,"below")}applyStyle(e,r){this.isDirty=!0,r!=null&&r.unstyledOnly?(e.color&&!this.style.color&&(this.style.color=e.color),e.backgroundColor&&!this.style.backgroundColor&&(this.style.backgroundColor=e.backgroundColor),e.fontFamily&&!this.style.fontFamily&&(this.style.fontFamily=e.fontFamily),e.fontShape&&!this.style.fontShape&&(this.style.fontShape=e.fontShape),e.fontSeries&&!this.style.fontSeries&&(this.style.fontSeries=e.fontSeries),e.fontSize&&!this.style.fontSize&&(this.style.fontSize=e.fontSize),e.variant&&!this.style.variant&&(this.style.variant=e.variant),e.variantStyle&&!this.style.variantStyle&&(this.style.variantStyle=e.variantStyle)):this.style=p(p({},this.style),e),this.style.fontFamily==="none"&&delete this.style.fontFamily,this.style.fontShape==="auto"&&delete this.style.fontShape,this.style.fontSeries==="auto"&&delete this.style.fontSeries,this.style.color==="none"&&(delete this.style.color,delete this.style.verbatimColor),this.style.backgroundColor==="none"&&(delete this.style.backgroundColor,delete this.style.verbatimBackgroundColor),this.style.fontSize==="auto"&&delete this.style.fontSize;for(let i of this.children)i.applyStyle(e,r)}getInitialBaseElement(){var e,r,i;return this.hasEmptyBranch("body")?this:((e=this.body)==null||e[0].type,(i=(r=this.body[1])==null?void 0:r.getInitialBaseElement())!=null?i:this)}getFinalBaseElement(){return this.hasEmptyBranch("body")?this:this.body[this.body.length-1].getFinalBaseElement()}isCharacterBox(){return this.type==="leftright"||this.type==="genfrac"||this.type==="subsup"||this.type==="delim"||this.type==="array"||this.type==="surd"?!1:this.getFinalBaseElement().type==="mord"}hasEmptyBranch(e){let r=this.branch(e);return r?(r.length>0,r[0].type,r.length===1):!0}setChildren(e,r){var n;if(!e||(Kr(r),!Kr(r)))return;let i=((n=e[0])==null?void 0:n.type)==="first"?[...e]:[this.makeFirstAtom(r),...e];this._branches?this._branches[r]=i:this._branches={[r]:i};for(let o of e)o.parent=this,o.parentBranch=r;this.isDirty=!0}makeFirstAtom(e){let r=new t({type:"first",mode:this.mode});return r.parent=this,r.parentBranch=e,r}addChild(e,r){e.type,this.createBranch(r).push(e),this.isDirty=!0,e.parent=this,e.parentBranch=r}addChildBefore(e,r){r.parentBranch;let i=this.createBranch(r.parentBranch);i.splice(i.indexOf(r),0,e),this.isDirty=!0,e.parent=this,e.parentBranch=r.parentBranch}addChildAfter(e,r){r.parentBranch;let i=this.createBranch(r.parentBranch);i.splice(i.indexOf(r)+1,0,e),this.isDirty=!0,e.parent=this,e.parentBranch=r.parentBranch}addChildren(e,r){let i=this.createBranch(r);for(let n of e)n.parent=this,n.parentBranch=r,i.push(n);this.isDirty=!0}addChildrenAfter(e,r){e.length===0||e[0].type,r.parentBranch;let i=this.createBranch(r.parentBranch);i.splice(i.indexOf(r)+1,0,...e),this.isDirty=!0;for(let n of e)n.parent=this,n.parentBranch=r.parentBranch;return e[e.length-1]}removeBranch(e){let r=this.branch(e);if(Kr(e)&&(this._branches[e]=void 0),!r)return[];for(let o of r)o.parent=void 0,o.parentBranch=void 0;r[0].type;let[i,...n]=r;return this.isDirty=!0,n}removeChild(e){if(e.parent,e.type==="first")return;let r=this.branch(e.parentBranch),i=r.indexOf(e);i>=0,r.splice(i,1),this.isDirty=!0,e.parent=void 0,e.parentBranch=void 0}get siblings(){return this.parent?this.parent.branch(this.parentBranch):[]}get firstSibling(){return this.siblings[0]}get lastSibling(){let{siblings:e}=this;return e[e.length-1]}get isFirstSibling(){return this===this.firstSibling}get isLastSibling(){return this===this.lastSibling}get hasNoSiblings(){return this.siblings.length===1}get leftSibling(){this.parent;let e=this.parent.branch(this.parentBranch);return e[e.indexOf(this)-1]}get rightSibling(){this.parent;let e=this.parent.branch(this.parentBranch);return e[e.indexOf(this)+1]}get hasChildren(){return!!(this._branches&&this.children.length>0)}get firstChild(){return this.hasChildren,this.children[0]}get lastChild(){this.hasChildren;let{children:e}=this;return e[e.length-1]}get children(){if(this._children)return this._children;if(!this._branches)return[];let e=[];for(let r of Pr)if(this._branches[r])for(let i of this._branches[r])e.push(...i.children),e.push(i);return this._children=e,e}render(e){if(this.type==="first"&&!e.atomIdsSettings)return null;let r=ne(this.command,this.mode);if(r!=null&&r.render)return r.render(this,e);let i=new K({parent:e},this.style),n=this.createBox(i,{classes:this.parent?"":"ML__base"});return n?(!this.subsupPlacement&&(this.superscript||this.subscript)&&(n=this.attachSupsub(i,{base:n})),n.wrap(i)):null}attachSupsub(e,r){var f;let i=r.base,n=this.superscript,o=this.subscript;if(!n&&!o)return i;let a=null,s=null,l=(f=r.isCharacterBox)!=null?f:this.isCharacterBox(),c=0;if(n){let x=new K({parent:e,mathstyle:"superscript"});a=t.createBox(x,n),l||(c=i.height-e.metrics.supDrop*x.scalingFactor)}let u=0;if(o){let x=new K({parent:e,mathstyle:"subscript"});s=t.createBox(x,o),l||(u=i.depth+e.metrics.subDrop*x.scalingFactor)}let m;e.isDisplayStyle?m=e.metrics.sup1:e.isCramped?m=e.metrics.sup3:m=e.metrics.sup2;let d=.5/Pt/e.scalingFactor,h=null;if(s&&a){c=Math.max(c,m,a.depth+.25*e.metrics.xHeight),u=Math.max(u,e.metrics.sub2);let x=e.metrics.defaultRuleThickness;if(c-a.depth-(s.height-u)<4*x){u=4*x-(c-a.depth)+s.height;let b=.8*e.metrics.xHeight-(c-a.depth);b>0&&(c+=b,u-=b)}let _=this.type==="extensible-symbol"&&i.italic?-i.italic:0;h=new te({individualShift:[{box:s,shift:u,marginLeft:_},{box:a,shift:-c}]})}else s&&!a?(u=Math.max(u,e.metrics.sub1,s.height-.8*Je),h=new te({shift:u,children:[{box:s,marginRight:d,marginLeft:this.isCharacterBox()?-i.italic:0}]})):!s&&a&&(c=Math.max(c,m,a.depth+.25*Je),h=new te({shift:-c,children:[{box:a,marginRight:d}]}));return new w([i,new w(h,{caret:this.caret,isSelected:this.isSelected,classes:"ML__msubsup"})],{type:r.type})}attachLimits(e,r){let i=this.superscript?t.createBox(new K({parent:e,mathstyle:"superscript"},this.style),this.superscript):null,n=this.subscript?t.createBox(new K({parent:e,mathstyle:"subscript"},this.style),this.subscript):null;return!i&&!n?r.base.wrap(e):R0(e,g(p({},r),{above:i,below:n}))}bind(e,r){if(!r||e.isPhantom||this.value==="\u200B")return r;let i=this.parent;for(;i&&!i.captureSelection;)i=i.parent;return i!=null&&i.captureSelection||(this.id||(this.id=e.makeID()),r.atomID=this.id),r}createBox(e,r){var s,l,c,u;let i=(s=this.value)!=null?s:this.body,n=(l=r==null?void 0:r.boxType)!=null?l:Ha(this.type),o=(c=r==null?void 0:r.classes)!=null?c:"";this.mode==="text"&&(o+=" ML__text");let a=typeof i=="string"||i===void 0?new w(i!=null?i:null,{type:n,isSelected:this.isSelected,mode:this.mode,maxFontSize:e.scalingFactor,style:g(p({variant:"normal"},this.style),{fontSize:Math.max(1,e.size+e.mathstyle.sizeDelta)}),letterShapeStyle:e.letterShapeStyle,classes:o}):(u=t.createBox(e,i,{type:n,classes:o}))!=null?u:new w(null);return e.isTight&&(a.isTight=!0),(this.mode!=="math"||this.style.variant==="main")&&(a.italic=0),a.right=a.italic,this.bind(e,a),this.caret&&!this.superscript&&!this.subscript&&(a.caret=this.caret),a}isDigit(){var e;return this.type==="mord"&&this.value?/^[\d,\.]$/.test(this.value):this.type==="group"&&((e=this.body)==null?void 0:e.length)===2?this.body[0].type==="first"&&this.body[1].value===",":!1}asDigit(){var e;return this.type==="mord"&&this.value&&/^[\d,\.]$/.test(this.value)?this.value:this.type==="group"&&((e=this.body)==null?void 0:e.length)===2&&this.body[0].type==="first"&&this.body[1].value===","?".":""}};function wf(t){let e,r=[],i=[];for(let n of t)if(n.type==="first"&&i.push(n),!e&&!n.style)i.push(n);else{let o=n.style;e&&o.color===e.color&&o.backgroundColor===e.backgroundColor&&o.fontSize===e.fontSize?i.push(n):(i.length>0&&r.push(i),i=[n],e=o)}return i.length>0&&r.push(i),r}function Sf(t,e,r){var s,l,c,u,m;if(!e||e.length===0)return null;let i=new K({parent:t},r.style),n=!((s=i.atomIdsSettings)!=null&&s.groupNumbers),o=[];if(e.length===1){let d=e[0],h=d.render(i);h&&(n&&d.isSelected&&h.selected(!0),o=[h])}else{let d="",h=!0;for(let f of e){(l=i.atomIdsSettings)!=null&&l.groupNumbers&&d&&(h&&f.isDigit()||!h&&rc(f))&&(i.atomIdsSettings.overrideID=d);let x=f.render(i);i.atomIdsSettings&&(i.atomIdsSettings.overrideID=void 0),x&&((c=i.atomIdsSettings)!=null&&c.groupNumbers&&((f.isDigit()||rc(f))&&(!d||h!==f.isDigit())&&(h=f.isDigit(),d=(u=f.id)!=null?u:""),d&&(!(f.isDigit()||rc(f))||!f.hasEmptyBranch("superscript")||!f.hasEmptyBranch("subscript"))&&(d="")),n&&f.isSelected&&x.selected(!0),o.push(x))}}if(o.length===0)return null;let a=new w(o,g(p({isTight:i.isTight},r),{type:(m=r.type)!=null?m:"lift"}));return a.isSelected=o.every(d=>d.isSelected),a.wrap(i)}function rc(t){return t.mode==="text"}function kf(t){return t.map(e=>e===null?"":Array.isArray(e)&&e[0]instanceof y?{atoms:e.map(r=>r.toJson())}:typeof e=="object"&&"group"in e?{group:e.group.map(r=>r.toJson())}:e)}var qe=class t extends y{constructor(e,r,i){super({type:"text",command:e,mode:"text",displayContainsHighlight:!0}),this.value=r,this.verbatimLatex=r,this.applyStyle(i)}static fromJson(e){return new t(e.command,e.value,e.style)}render(e){let r=this.createBox(e);return this.caret&&(r.caret=this.caret),r}_serialize(e){var r;return(r=this.verbatimLatex)!=null?r:pl("text",this.value.codePointAt(0))}};function I0(t,e){if(t.direction===e.direction){let r=t.ranges.length;if(e.ranges.length===r){let i=0;for(;i=":"\\ge","\u2264":"\\le","<=":"\\le","<<":"\\ll",">>":"\\gg","~~":"\\approx","\u2248":"\\approx","?=":"\\questeq","\xF7":"\\div","\xAC":"\\neg",":=":"\\coloneq","::":"\\Colon","(:":"\\langle",":)":"\\rangle",beta:"\\beta",chi:"\\chi",epsilon:"\\epsilon",varepsilon:"\\varepsilon",eta:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\eta"},gamma:"\\gamma",Gamma:"\\Gamma",iota:"\\iota",kappa:"\\kappa",lambda:"\\lambda",Lambda:"\\Lambda",mu:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\mu"},nu:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\nu"},\u00B5:"\\mu",phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\phi"},Phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Phi"},varphi:"\\varphi",psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\psi"},Psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Psi"},rho:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\rho"},sigma:"\\sigma",Sigma:"\\Sigma",tau:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\tau"},vartheta:"\\vartheta",upsilon:"\\upsilon",xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\xi"},Xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Xi"},zeta:"\\zeta",omega:"\\omega",Omega:"\\Omega",\u03A9:"\\omega",forall:"\\forall",exists:"\\exists","!exists":"\\nexists",":.":"\\therefore",liminf:"\\liminf_{#?}",limsup:"\\limsup_{#?}",argmin:"\\operatorname*{arg~min}_{#?}",argmax:"\\operatorname*{arg~max}_{#?}",det:"\\det",mod:"\\bmod{#?}","(mod":"\\pmod{#?}",max:"\\max",min:"\\min",erf:"\\operatorname{erf}",erfc:"\\operatorname{erfc}",bessel:"\\operatorname{bessel}",mean:"\\operatorname{mean}",median:"\\operatorname{median}",fft:"\\operatorname{fft}",lcm:"\\operatorname{lcm}",gcd:"\\gcd",randomReal:"\\operatorname{randomReal}",randomInteger:"\\operatorname{randomInteger}",Re:"\\operatorname{Re}",Im:"\\operatorname{Im}",mm:{after:"nothing+digit+operator",value:"\\operatorname{mm}"},cm:{after:"nothing+digit+operator",value:"\\operatorname{cm}"},km:{after:"nothing+digit+operator",value:"\\operatorname{km}"},kg:{after:"nothing+digit+operator",value:"\\operatorname{kg}"},ft:{after:"nothing+digit+operator",value:"\\operatorname{ft}"},inch:{after:"nothing+digit+operator",value:"\\operatorname{inch}"},mi:{after:"nothing+digit+operator",value:"\\operatorname{mi}"},"...":"\\ldots","+...":"+\\cdots","-...":"-\\cdots","->...":"\\to\\cdots","-->...":"\\longrightarrow\\cdots","->":"\\to","|->":"\\mapsto","-->":"\\longrightarrow","<--":"\\longleftarrow","=>":"\\Rightarrow","==>":"\\Longrightarrow","<=>":"\\iff","<->":"\\leftrightarrow","(.)":"\\odot","(+)":"\\oplus","(/)":"\\oslash","(*)":"\\otimes","(-)":"\\ominus","||":"\\Vert","*":"\\cdot","**":"\\star","***":"\\ast","//":"\\slash","\\\\":"\\backslash",setminus:"\\backslash","|><":"\\ltimes","><|":"\\rtimes","|><|":"\\bowtie","-:":"\\div",divide:"\\div","@":"\\circ","^^":"\\wedge","^^^":"\\bigwedge",vv:"\\vee",vvv:"\\bigvee",nn:"\\cap",nnn:"\\bigcap",uu:"\\cup",uuu:"\\bigcup","-=":"\\equiv","~=":"\\cong",lt:"<","lt=":"\\leq",gt:">","gt=":"\\geq","-<":"\\prec","-lt":"\\prec","-<=":"\\preceq",">-=":"\\succeq",prop:"\\propto",diamond:"\\diamond",square:"\\square",iff:"\\iff",sub:"\\subset",sup:"\\supset",sube:"\\subseteq",supe:"\\supseteq",uarr:"\\uparrow",darr:"\\downarrow",rarr:"\\rightarrow",rArr:"\\Rightarrow",larr:"\\leftarrow",lArr:"\\Leftarrow",harr:"\\leftrightarrow",hArr:"\\Leftrightarrow",aleph:"\\aleph",and:"\\land",or:"\\lor",not:"\\neg","_|_":"\\bot",TT:"\\top","|--":"\\vdash","|==":"\\models","|__":"\\lfloor","__|":"\\rfloor","|~":"\\lceil","~|":"\\rceil",">->":"\\rightarrowtail","->>":"\\twoheadrightarrow",">->>":"\\twoheadrightarrowtail",times:"\\times",of:"\\circ",infinity:"\\infty",defint:"\\int_{#?}^{#?}",approaches:"\\to",ceil:"\\left\\lceil#?\\right\\rceil",floor:"\\left\\lfloor#?\\right\\rfloor",union:"\\cup",asterisk:"\\ast",frac:"\\frac{#?}{#?}",cbrt:"\\sqrt[3]{#?}",nthroot:"\\sqrt[#?]{#?}"};function ir(t,e){var i;let r=(i=e==null?void 0:e.format)!=null?i:"auto";return r==="auto"&&([r,t]=Cf(t)),r==="ascii-math"?(t=t.replace(/\u2061/gu,""),t=t.replace(/\u3016/gu,"{"),t=t.replace(/\u3017/gu,"}"),t=t.replace(/([^\\])sinx/g,"$1\\sin x"),t=t.replace(/([^\\])cosx/g,"$1\\cos x "),t=t.replace(/\u2013/g,"-"),["ascii-math",He(t,{inlineShortcuts:e==null?void 0:e.inlineShortcuts})]):["latex",t]}function He(t,e){var a;if(t=t.trim(),!t)return"";let r=(a=e.inlineShortcuts)!=null?a:Ja;if(t.startsWith("^")||t.startsWith("_")){let{match:s,rest:l}=li(t.slice(1),{inlineShortcuts:r,noWrap:!0});return`${t[0]}{${s}}${He(l,e)}`}let i=t.match(/^(sqrt|\u221A)(.*)/);if(i){let{match:s,rest:l}=li(i[2],{inlineShortcuts:r,noWrap:!0});return`\\sqrt{${s!=null?s:"\\placeholder{}"}}${He(l,e)}`}if(i=t.match(/^(\\cbrt|\u221B)(.*)/),i){let{match:s,rest:l}=li(i[2],{inlineShortcuts:r,noWrap:!0});return`\\sqrt[3]{${s!=null?s:"\\placeholder{}"}}${He(l,e)}`}if(i=t.match(/^abs(.*)/),i){let{match:s,rest:l}=li(i[1],{inlineShortcuts:r,noWrap:!0});return`\\left|${s!=null?s:"\\placeholder{}"}\\right|${He(l,e)}`}if(i=t.match(/^["”“](.*?)["”“](.*)/),i)return`\\text{${i[1]}}${He(i[2],e)}`;if(i=t.match(/^([^a-zA-Z0-9\(\{\[\_\^\\\s"]+)(.*)/),i)return`${F0(i[1],r)}${He(i[2],e)}`;if(/^([fgh])[^a-zA-Z]/.test(t)){let{rest:s,match:l}=li(t.slice(1),{inlineShortcuts:r,noWrap:!0}),c="";return t[1]==="("?c=`${t[0]}\\left(${l}\\right)`:c=t[0]+l,c+He(s,e)}if(i=t.match(/^([a-zA-Z]+)(.*)/),i)return F0(i[1],r)+He(i[2],e);let{match:n,rest:o}=li(t,{inlineShortcuts:r,noWrap:!0});if(n&&o[0]==="/"){let s=li(o.slice(1),{inlineShortcuts:r,noWrap:!0});if(s.match)return`\\frac{${n}}{${s.match}}${He(s.rest,e)}`}else return t.startsWith("(")?"\\left("+n+"\\right)"+He(o,e):n+He(o,e);return i=t.match(/^(\s+)(.*)$/),i?" "+He(i[2],e):t}var N0={"[":"\\lbrack","]":"\\rbrack","{":"\\lbrace","}":"\\rbrace"};function li(t,e){var a,s;let r="";t=t.trim();let i=t,n=t.charAt(0),o={"(":")","{":"}","[":"]"}[n];if(o){let l=1,c=1;for(;c0;)t[c]===n&&l++,t[c]===o&&l--,c++;if(l===0){let u=He(t.substring(1,c-1),e);e.noWrap&&n==="("?r=u:r=`\\left${(a=N0[n])!=null?a:n}${u}\\right${(s=N0[o])!=null?s:o}`,i=t.slice(Math.max(0,c))}else r=t.substring(1,c),i=""}else{let l=t.match(/^([a-zA-Z]+)/);if(l){let c=Qn(null,t,e.inlineShortcuts);if(c)return c=c.replace("_{#?}",""),c=c.replace("^{#?}",""),{match:c,rest:t.slice(c.length)}}if(l=t.match(/^([a-zA-Z])/),l)return{match:l[1],rest:t.slice(1)};if(l=t.match(/^(-)?\d+(\.\d*)?/),l)return{match:l[0],rest:t.slice(l[0].length)};/^\\(left|right)/.test(t)||(l=t.match(/^(\\[a-zA-Z]+)/),l&&(i=t.slice(l[1].length),r=l[1]))}return{match:r,rest:i}}function F0(t,e){let r=Qn(null,t,e);return r?(r=r.replace("_{#?}",""),r=r.replace("^{#?}",""),r+=" "):r=t,r}var ic=[["\\[","\\]"],["\\(","\\)"],["$$","$$"],["$","$"],["\\begin{math}","\\end{math}"],["\\begin{displaymath}","\\end{displaymath}"],["\\begin{equation}","\\end{equation}"],["\\begin{equation*}","\\end{equation*}"]];function Ga(t){let e=t.trim();for(let r of ic)if(e.startsWith(r[0])&&e.endsWith(r[1]))return[!0,e.substring(r[0].length,e.length-r[1].length)];return[!1,t]}function Cf(t){if(t=t.trim(),t.length<=1)return["latex",t];let e;return[e,t]=Ga(t),e?["latex",t]:t.startsWith("`")&&t.endsWith("`")?(t=t.substring(1,t.length-1),["ascii-math",t]):t.includes("\\")?["latex",t]:/\$.+\$/.test(t)?["latex",`\\text{${t}}`]:[void 0,t]}var Ef="$$",Tf="$$",$0=(t,e,r)=>(ic.some(i=>e.startsWith(i[0])&&e.endsWith(i[1]))||(e=`${Ef} ${e} ${Tf}`),e),Zi=class Zi{constructor(e){Zi._modes[e]=this}static onPaste(e,r,i){var o;if(!r.contentEditable&&r.userSelect==="none")return r.model.announce("plonk"),!1;if(typeof i=="string"){let a=new DataTransfer;a.setData("text/plain",i),i=a}let n=new ClipboardEvent("paste",{clipboardData:i,cancelable:!0});return(o=r.host)!=null&&o.dispatchEvent(n)?Zi._modes[e].onPaste(r,i):!1}static copyToClipboard(e,r){if(!e.contentEditable&&e.userSelect==="none"){e.model.announce("plonk");return}let i=e.model,n=i.selectionIsCollapsed?[0,i.lastOffset]:de(i.selection),o=i.getValue(n,r);navigator.clipboard.writeText(o).then(()=>{},()=>e.model.announce("plonk"))}static onCopy(e,r){var a;if(!r.clipboardData)return;if(!e.contentEditable&&e.userSelect==="none"){e.model.announce("plonk");return}let i=e.model,n=i.selectionIsCollapsed?[0,i.lastOffset]:de(i.selection),o=i.getAtoms(n);if(o.every(s=>s.mode==="text"||!s.mode))r.clipboardData.setData("text/plain",o.filter(s=>s instanceof qe).map(s=>s.value).join(""));else if(o.every(s=>s.mode==="latex"))r.clipboardData.setData("text/plain",i.getAtoms(n,{includeChildren:!0}).map(s=>{var l;return(l=s.value)!=null?l:""}).join(""));else{let s;o.length===1&&o[0].verbatimLatex!==void 0?s=o[0].verbatimLatex:s=i.getValue(n,"latex-expanded"),r.clipboardData.setData("application/x-latex",s);try{r.clipboardData.setData("text/plain",e.options.onExport(e,s,n))}catch(l){}if(o.length===1){let l=o[0];(l.type==="root"||l.type==="group")&&(o=l.body.filter(c=>c.type!=="first"))}try{r.clipboardData.setData("application/json+mathlive",JSON.stringify(o.map(l=>l.toJson())))}catch(l){}if((a=window[Symbol.for("io.cortexjs.compute-engine")])!=null&&a.ComputeEngine){let l=globalThis.MathfieldElement.computeEngine;if(l)try{let c=l.jsonSerializationOptions;l.jsonSerializationOptions={metadata:["latex"]};let u=l.parse(i.getValue(n,"latex-unstyled"));l.jsonSerializationOptions=c;let m=JSON.stringify(u.json);m&&r.clipboardData.setData("application/json",m)}catch(c){}}}r.preventDefault()}static insert(e,r,i={}){var o;let n=i.mode==="auto"?e.mode:(o=i.mode)!=null?o:e.mode;return Zi._modes[n].insert(e,r,i)}onPaste(e,r){return!1}insert(e,r,i){return!1}};Zi._modes={};var q=Zi;var V0=[{key:"left",command:"moveToPreviousChar"},{key:"right",command:"moveToNextChar"},{key:"up",command:"moveUp"},{key:"down",command:"moveDown"},{key:"shift+[ArrowLeft]",command:"extendSelectionBackward"},{key:"shift+[ArrowRight]",command:"extendSelectionForward"},{key:"shift+[ArrowUp]",command:"extendSelectionUpward"},{key:"shift+[ArrowDown]",command:"extendSelectionDownward"},{key:"[Backspace]",command:"deleteBackward"},{key:"[Delete]",command:"deleteForward"},{key:"shift+[Backspace]",command:"deleteForward"},{key:"alt+[Backspace]",command:"deletePreviousWord"},{key:"alt+[Delete]",command:"deleteNextWord"},{key:"ctrl+[Backspace]",command:"deleteToGroupStart"},{key:"ctrl+[Delete]",command:"deleteToGroupEnd"},{key:"ctrl+shift+[Backspace]",command:"deleteToGroupEnd"},{key:"alt+[ArrowLeft]",command:"moveToPreviousWord"},{key:"alt+[ArrowRight]",command:"moveToNextWord"},{key:"shift+alt+[ArrowLeft]",command:"extendToPreviousWord"},{key:"shift+alt+[ArrowRight]",command:"extendToNextWord"},{key:"ctrl+[ArrowLeft]",command:"moveToGroupStart"},{key:"ctrl+[ArrowRight]",command:"moveToGroupEnd"},{key:"shift+ctrl+[ArrowLeft]",command:"extendToGroupStart"},{key:"shift+ctrl+[ArrowRight]",command:"extendToGroupEnd"},{key:"[Home]",command:"moveToMathfieldStart"},{key:"cmd+[ArrowLeft]",command:"moveToMathfieldStart"},{key:"shift+[Home]",command:"extendToMathFieldStart"},{key:"shift+cmd+[ArrowLeft]",command:"extendToMathFieldStart"},{key:"[End]",command:"moveToMathfieldEnd"},{key:"cmd+[ArrowRight]",command:"moveToMathfieldEnd"},{key:"shift+[End]",command:"extendToMathFieldEnd"},{key:"shift+cmd+[ArrowRight]",command:"extendToMathFieldEnd"},{key:"[Pageup]",command:"moveToGroupStart"},{key:"[Pagedown]",command:"moveToGroupEnd"},{key:"[Tab]",command:"moveToNextGroup"},{key:"shift+[Tab]",command:"moveToPreviousGroup"},{key:"[Escape]",ifMode:"math",command:["switchMode","latex"]},{key:"[Escape]",ifMode:"text",command:["switchMode","latex"]},{key:"[Escape]",ifMode:"latex",command:["complete","complete",{selectItem:"true"}]},{key:"\\",ifMode:"math",command:["switchMode","latex","","\\"]},{key:"[IntlBackslash]",ifMode:"math",command:["switchMode","latex","","\\"]},{key:"[Tab]",ifMode:"latex",command:["complete","accept-suggestion"]},{key:"[Return]",ifMode:"latex",command:["complete","accept-all"]},{key:"[Enter]",ifMode:"latex",command:["complete","accept-all"]},{key:"shift+[Escape]",ifMode:"latex",command:["complete","reject"]},{key:"[ArrowDown]",ifMode:"latex",command:"nextSuggestion"},{key:"[ArrowUp]",ifMode:"latex",command:"previousSuggestion"},{key:"ctrl+a",ifPlatform:"!macos",command:"selectAll"},{key:"cmd+a",command:"selectAll"},{key:"[Cut]",command:"cutToClipboard"},{key:"[Copy]",command:"copyToClipboard"},{key:"[Paste]",command:"pasteFromClipboard"},{key:"[Clear]",command:"deleteBackward"},{key:"[Undo]",command:"undo"},{key:"[Redo]",command:"redo"},{key:"[EraseEof]",command:"deleteToGroupEnd"},{key:"ctrl+x",ifPlatform:"ios",command:"cutToClipboard"},{key:"cmd+x",ifPlatform:"ios",command:"cutToClipboard"},{key:"ctrl+c",ifPlatform:"ios",command:"copyToClipboard"},{key:"cmd+c",ifPlatform:"ios",command:"copyToClipboard"},{key:"ctrl+v",ifPlatform:"ios",command:"pasteFromClipboard"},{key:"cmd+v",ifPlatform:"ios",command:"pasteFromClipboard"},{key:"ctrl+z",ifPlatform:"!macos",command:"undo"},{key:"cmd+z",command:"undo"},{key:"ctrl+y",ifPlatform:"!macos",command:"redo"},{key:"shift+cmd+y",command:"redo"},{key:"shift+ctrl+z",ifPlatform:"!macos",command:"redo"},{key:"shift+cmd+z",command:"redo"},{key:"ctrl+b",ifPlatform:"macos",command:"moveToPreviousChar"},{key:"ctrl+f",ifPlatform:"macos",command:"moveToNextChar"},{key:"ctrl+p",ifPlatform:"macos",command:"moveUp"},{key:"ctrl+n",ifPlatform:"macos",command:"moveDown"},{key:"ctrl+a",ifPlatform:"macos",command:"moveToMathfieldStart"},{key:"ctrl+e",ifPlatform:"macos",command:"moveToMathfieldEnd"},{key:"shift+ctrl+b",ifPlatform:"macos",command:"extendSelectionBackward"},{key:"shift+ctrl+f",ifPlatform:"macos",command:"extendSelectionForward"},{key:"shift+ctrl+p",ifPlatform:"macos",command:"extendSelectionUpward"},{key:"shift+ctrl+n",ifPlatform:"macos",command:"extendSelectionDownward"},{key:"shift+ctrl+a",ifPlatform:"macos",command:"extendToMathFieldStart"},{key:"shift+ctrl+e",ifPlatform:"macos",command:"extendToMathFieldEnd"},{key:"alt+ctrl+b",ifPlatform:"macos",command:"moveToPreviousWord"},{key:"alt+ctrl+f",ifPlatform:"macos",command:"moveToNextWord"},{key:"shift+alt+ctrl+b",ifPlatform:"macos",command:"extendToPreviousWord"},{key:"shift+alt+ctrl+f",ifPlatform:"macos",command:"extendToNextWord"},{key:"ctrl+h",ifPlatform:"macos",command:"deleteBackward"},{key:"ctrl+d",ifPlatform:"macos",command:"deleteForward"},{key:"ctrl+l",ifPlatform:"macos",command:"scrollIntoView"},{key:"ctrl+[Digit2]",ifMode:"math",command:["insert","\\sqrt{#0}"]},{key:"ctrl+[Digit5]",ifMode:"math",command:"moveToOpposite"},{key:"ctrl+[Digit6]",ifMode:"math",command:"moveToSuperscript"},{key:"ctrl+[Return]",ifMode:"math",command:"addRowAfter"},{key:"ctrl+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"cmd+[Return]",ifMode:"math",command:"addRowAfter"},{key:"cmd+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"alt+p",ifMode:"math",command:["insert","\\pi"]},{key:"alt+v",ifMode:"math",command:["insert","\\sqrt{#0}"]},{key:"alt+shift+v",ifMode:"math",command:["insert","\\sqrt[#0]{#1}"]},{key:"alt+o",ifMode:"math",command:["insert","\\emptyset"]},{key:"alt+d",ifMode:"math",command:["insert","\\differentialD"]},{key:"shift+alt+o",ifMode:"math",command:["insert","\\varnothing"]},{key:"shift+alt+d",ifMode:"math",command:["insert","\\partial"]},{key:"alt+[Backslash]",ifMode:"math",command:["insert","\\backslash"]},{key:"[NumpadDivide]",ifMode:"math",command:["insert","\\frac{#@}{#?}"]},{key:"alt+[NumpadDivide]",ifMode:"math",command:["insert","\\frac{#?}{#@}"]},{key:"shift+alt+k",command:"toggleKeystrokeCaption"},{key:"alt+[Space]",command:"toggleContextMenu"},{key:"alt+shift+[Space]",command:"toggleVirtualKeyboard"},{key:"alt+ctrl+[ArrowUp]",command:["speak","all",{withHighlighting:!1}]},{key:"alt+ctrl+[ArrowDown]",command:["speak","selection",{withHighlighting:!1}]},{key:"shift+[Quote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["switchMode","text","",""]},{key:"shift+[Quote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"text",command:["switchMode","math","",""]},{key:"shift+alt+[KeyT]",ifMode:"math",command:["switchMode","text"]},{key:"shift+alt+[KeyT]",ifMode:"text",command:["switchMode","math"]},{key:"/",ifMode:"math",command:["insert","\\frac{#@}{#?}"]},{key:"alt+/",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","/"]},{key:"alt+shift+/",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","/"]},{key:"alt+[BracketLeft]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\left\\lbrack #0 \\right\\rbrack"]},{key:"ctrl+[Minus]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"moveToSubscript"},{key:"shift+alt+[BracketLeft]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\left\\lbrace #0 \\right\\rbrace"]},{key:"ctrl+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowAfter"},{key:"cmd+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowAfter"},{key:"shift+ctrl+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowBefore"},{key:"shift+cmd+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowBefore"},{key:"alt+[Tab]",ifMode:"math",command:"addColumnAfter"},{key:"shift+alt+[Tab]",ifMode:"math",command:"addColumnBefore"},{key:"alt+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"shift+alt+[Enter]",ifMode:"math",command:"addRowBefore"},{key:"alt+[Return]",ifMode:"math",command:"addRowAfter"},{key:"shift+alt+[Return]",ifMode:"math",command:"addRowBefore"},{key:"shift+[Backspace]",ifMode:"math",command:"removeColumn"},{key:"shift+[Delete]",ifMode:"math",command:"removeRow"},{key:"shift+alt+[Backspace]",ifMode:"math",command:"removeRow"},{key:"alt+[Digit5]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","$\\infty"]},{key:"alt+[Digit9]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","("]},{key:"alt+[Digit0]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert",")"]},{key:"alt+|",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","|"]},{key:"shift+[Backquote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\~"]},{key:"[Backquote]",ifLayout:["windows.french","linux.french"],ifMode:"math",command:["insert","^2"]},{key:"[Backquote]",ifLayout:["windows.german","linux.german"],ifMode:"math",command:["insert","^"]},{key:"[IntlBackslash]",ifLayout:["apple.german"],ifMode:"math",command:["insert","^"]}],q0={"\\sqrt":["alt+v","ctrl+[Digit2]"],"\\pi":"alt+p","\\infty":"alt+[Digit5]","\\differentialD":"alt+d","\\partial":"shift+alt+d","\\frac":"Slash","\\emptyset":"alt+o","\\varnothing":"shift+alt+o","\\~":"~"};function it(t){var e;return((e=t.element)==null?void 0:e.mathfield)===t}function Df(t){var e,r;return(r=(e=t.querySelector(".ML__caret"))!=null?e:t.querySelector(".ML__text-caret"))!=null?r:t.querySelector(".ML__latex-caret")}function Yi(t){let e=Df(t);if(!e)return null;let r=e.getBoundingClientRect();return{x:r.right,y:r.bottom,height:r.height}}function Of(t){var r;if(!t.parent)return"root";let e=(r=t.parent.id)!=null?r:"";return e+=typeof t.parentBranch=="string"?"-"+t.parentBranch:`-${t.parentBranch[0]}/${t.parentBranch[0]}`,e}function oc(t,e,r){if(!e)return null;let i=t.field.getBoundingClientRect(),n=e.right-e.left,o=e.bottom-e.top,a=Math.ceil(e.left-i.left+t.field.scrollLeft*r),s=Math.ceil(e.top-i.top);return{left:a,right:a+n,top:s,bottom:s+o}}function nc(t){let e=t,r=e.getBoundingClientRect();for(;r.bottom===r.top&&e.parentElement instanceof Element&&(e=e.parentElement,r=e.getBoundingClientRect(),r.bottom===r.top););let i=getComputedStyle(e),n=parseInt(i.marginRight),o=r.right-r.left,a=r.bottom-r.top;if(o===0||!Number.isFinite(o)){let l=parseFloat(i.width);Number.isFinite(l)&&l>0?o=l:e instanceof HTMLElement&&e.offsetWidth>0&&(o=e.offsetWidth)}if(a===0||!Number.isFinite(a)){let l=parseFloat(i.height);Number.isFinite(l)&&l>0?a=l:e instanceof HTMLElement&&e.offsetHeight>0&&(a=e.offsetHeight)}let s={top:r.top-1,bottom:r.top-1+a,left:r.left,right:r.left+o-1+n};if(t.children.length===0||t.tagName.toUpperCase()==="SVG")return s;for(let l of t.children)if(l.nodeType===1&&"atomId"in l.dataset&&!l.classList.contains("ML__pstrut")){let c=nc(l);s.left=Math.min(s.left,c.left),s.right=Math.max(s.right,c.right),s.top=Math.min(s.top,c.top),s.bottom=Math.max(s.bottom,c.bottom)}return s}function nr(t,e){var o,a;if(!e.id)return null;let r=(a=(o=t.atomBoundsCache)==null?void 0:o.get(e.id))!=null?a:null;if(r!==null)return r;let i=t.field.querySelectorAll(`[data-atom-id="${e.id}"]`),n=Array.from(i);if(e.type==="prompt"){for(let s of n)if(s.classList.contains("ML__prompt-atom")){let l=s.querySelector(".ML__prompt");if(l){let c=nc(l);r?(r.left=Math.min(r.left,c.left),r.right=Math.max(r.right,c.right),r.top=Math.min(r.top,c.top),r.bottom=Math.max(r.bottom,c.bottom)):r=c}}}for(let s of n){let l=nc(s);r?(r.left=Math.min(r.left,l.left),r.right=Math.max(r.right,l.right),r.top=Math.min(r.top,l.top),r.bottom=Math.max(r.bottom,l.bottom)):r=l}return t.atomBoundsCache&&(r?t.atomBoundsCache.set(e.id,r):t.atomBoundsCache.delete(e.id)),r!=null?r:null}function H0(t,e){let[r,i]=e,n=null;for(let o=r;o<=i;o++){let a=nr(t,t.model.at(o));a&&(n?(n.top=Math.min(n.top,a.top),n.bottom=Math.max(n.bottom,a.bottom),n.left=Math.min(n.left,a.left),n.right=Math.max(n.right,a.right)):n=a)}return n!=null?n:{top:0,bottom:0,left:0,right:0}}function Bf(t,e,r){let i=new Map,n=t.field,o=n.offsetWidth,s=Math.floor(n.getBoundingClientRect().width)/o;s=isNaN(s)?1:s;for(let l of t.model.getAtoms(e,{includeChildren:!0})){if(r!=null&&r.excludeAtomsWithBackground&&l.style.backgroundColor)continue;let c=oc(t,nr(t,l),s);if(c){let u=Of(l);if(i.has(u)){let m=i.get(u);i.set(u,{left:Math.min(m.left,c.left),right:Math.max(m.right,c.right),top:Math.min(m.top,c.top),bottom:Math.max(m.bottom,c.bottom)})}else i.set(u,c)}}return[...i.values()]}function Xa(t,e){return t.model.selection.ranges.reduce((r,i)=>r.concat(...Bf(t,i,e)),[])}function Qi(t,e){return t==="*"||e==="none"?!0:e==="same-origin"?!window.origin||t===window.origin:typeof e=="function"?e(t):!1}function ac(t){let e=0,r=0,i=t.offsetWidth,n=t.offsetHeight;for(;t instanceof HTMLElement;)e+=t.offsetTop,r+=t.offsetLeft,t=t.offsetParent;return new DOMRect(r,e,i,n)}function Za(t,e){if(!t)return;let r=t.model.at(e);if(!r)return;let i={},n=nr(t,r);n&&(i.bounds=new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)),i.depth=r.treeDepth-2,i.style=r.style;let o=r;for(;o;){if(o.command==="\\htmlData"&&o.args&&typeof o.args[0]=="string"){let a=o.args[0].split(",");for(let s of a){let l=s.match(/([^=]+)=(.+$)/);if(l){let c=l[1].trim().replace(/ /g,"-");c&&(i.data||(i.data={}),i.data[c]=l[2])}else{let c=s.trim().replace(/ /g,"-");c&&(i.data||(i.data={}),i.data[c]=void 0)}}}(o.command==="\\htmlId"||o.command==="\\cssId")&&!i.id&&o.args&&typeof o.args[0]=="string"&&(i.id=o.args[0]),o=o.parent}return(r.mode==="math"||r.mode==="text")&&(i.latex=y.serialize([r],{defaultMode:"math"})),i}function W0(t,e){let r=t.model.at(e);for(;r;){if(r.command==="\\href"){let i=r.args[0];if(typeof i=="string")return i}r=r.parent}return""}var U0=`@keyframes ML__caret-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } } :host { display: block; } .ML__container { display: inline-flex; flex-flow: row; justify-content: space-between; align-items: flex-end; min-height: 39px; /* Need some room for the virtual keyboard toggle */ width: 100%; padding: 4px; box-sizing: border-box; /* This attribute is necessary to work around a Firefox issue where where clicking multiple times on the border leads to a focused mathfield that cannot be edited until focus is lost and regained (also fixes the multiple cursor issue on firefox that can occur with the same sequence of events). */ pointer-events: auto; /* Prevent the browser from trying to interpret touch gestures in the field */ /* "Disabling double-tap to zoom removes the need for browsers to delay the generation of click events when the user taps the screen." */ touch-action: none; --_caret-color: var(--caret-color, hsl(var(--_hue), 40%, 49%)); --_selection-color: var(--selection-color, #000); --_selection-background-color: var(--selection-background-color, hsl(var(--_hue), 70%, 85%)); --_text-highlight-background-color: var(--highlight-text, hsla(var(--_hue), 40%, 50%, 0.1)); --_contains-highlight-background-color: var(--contains-highlight-background-color, hsl(var(--_hue), 40%, 95%)); --_smart-fence-color: var(--smart-fence-color, currentColor); --_smart-fence-opacity: var(--smart-fence-opacity, 0.5); --_contains-highlight-color: var(--contains-highlight-color, var(--_caret-color)); --_latex-color: var(--latex-color, hsl(var(--_hue), 80%, 40%)); --_correct-color: var(--correct-color, #10a000); --_incorrect-color: var(--incorrect-color, #a01b00); --_composition-background-color: var(--composition-background-color, #fff1c2); --_composition-text-color: var(--composition-text-color, black); --_composition-underline-color: var(--composition-underline-color, transparent); --_tooltip-border: var(--tooltip-border, 1px solid transparent); --_tooltip-border-radius: var(--tooltip-border-radius, 8px); --_tooltip-background-color: var(--tooltip-background-color, #616161); --_tooltip-color: var(--tooltip-color, #fff); --_tooltip-box-shadow: var(--tooltip-box-shadow, 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2)); } @media (prefers-color-scheme: dark) { .ML__container { --_contains-highlight-color: var(--contains-highlight-color, hsl(var(--_hue), 85%, 75%)); --_caret-color: var(--caret-color, hsl(var(--_hue), 65%, 55%)); --_selection-color: var(--selection-color, #fff); --_selection-background-color: var(--selection-background-color, hsl(var(--_hue), 65%, 55%)); --_text-highlight-background-color: var(--text-highlight-background-color, hsla(var(--_hue), 40%, 50%, 0.6)); --_contains-highlight-background-color: var(--contains-highlight-background-color, hsl(var(--_hue), 5%, 34%)); --_latex-color: var(--primary, hsl(var(--_hue), 40%, 50%)); --_composition-background-color: #69571c; --_composition-text-color: white; --_placeholder-color: hsl(var(--_hue), 60%, 69%); --_smart-fence-color: var(--smart-fence-color, #fff); --_smart-fence-opacity: var(--smart-fence-opacity, 0.7); } } @media (forced-colors: active) { .ML__container { --_caret-color: white; --_selection-color: white; --_smart-fence-color: white; --_latex-color: white; --_correct-color: white; --_incorrect-color: white; --_composition-text-color: white; } } @media (hover: none) and (pointer: coarse) { :host(:not(:focus)) .ML__container { pointer-events: none; } } /* This is the actual field content (formula) */ .ML__content { display: flex; align-items: center; align-self: center; position: relative; overflow: hidden; padding: 2px 3px 2px 1px; width: 100%; /* Encourage the browser to use the GPU to render the field. Weirdly, this is required for prompts to be rendered correctly. */ isolation: isolate; text-shadow: var(--text-shadow); } .ML__content .ML__latex { text-shadow: var(--text-shadow); } .ML__content .ML__sqrt-line { box-shadow: var(--text-shadow); } .ML__content .ML__frac-line { box-shadow: var(--text-shadow); } /* Container for the virtual keyboard toggle and menu toggle buttons */ .ML__toggles { display: flex; flex-direction: row; align-items: flex-start; gap: 0; align-self: flex-start; } /* Vertical layout modifier */ .ML__toggles--vertical { flex-direction: column; align-items: center; gap: 4px; } .ML__toggles--vertical .ML__virtual-keyboard-toggle, .ML__toggles--vertical .ML__menu-toggle { margin-right: 0; } .ML__virtual-keyboard-toggle, .ML__menu-toggle { box-sizing: border-box; display: flex; align-self: center; align-items: center; flex-shrink: 0; flex-direction: column; justify-content: center; width: 34px; height: 34px; padding: 0; margin-right: 4px; cursor: pointer; /* Avoid some weird blinking with :hover */ border-radius: 8px; border: 1px solid transparent; transition: background 0.2s cubic-bezier(0.64, 0.09, 0.08, 1); color: hsl(var(--_hue), 40%, 50%); fill: currentColor; background: transparent; } .ML__virtual-keyboard-toggle:hover, .ML__menu-toggle:hover { background: hsla(0, 0%, 70%, 0.3); color: #333; fill: currentColor; } .ML__virtual-keyboard-toggle > span, .ML__menu-toggle > span { display: flex; align-self: center; align-items: center; } @media (pointer: coarse) { .ML__virtual-keyboard-toggle, .ML__menu-toggle { min-width: 60px; min-height: 60px; } } /* The invisible element used to capture keyboard events. We're just trying really hard to make sure it doesn't show. */ .ML__keyboard-sink { display: inline-block; resize: none; outline: none; border: none; pointer-events: none; /* Need these for Microsoft Edge */ position: fixed; clip: rect(0 0 0 0); /* Need this to prevent iOS Safari from auto-zooming */ font-size: 1em; font-family: KaTeX_Main; line-height: 0.5; /* On Chromium, if this is 0, no keyboard events are received */ /* Preferred over clip */ clip-path: inset(50%); } [part='placeholder'] { color: var(--neutral-400); } .ML__composition { background: var(--_composition-background-color); color: var(--_composition-text-color); text-decoration: underline var(--_composition-underline-color); } .ML__caret { display: inline-block; } .ML__caret::after { content: ''; visibility: hidden; width: 0; display: inline-block; height: 0.76em; --_caret-width: clamp(2px, 0.08em, 10px); border: none; border-radius: calc(var(--_caret-width) / 2); border-right: var(--_caret-width) solid var(--_caret-color); margin-right: calc(-1 * var(--_caret-width)); position: relative; left: -0.045em; bottom: -0.05em; animation: ML__caret-blink 1.05s step-end forwards infinite; } .ML__text-caret::after { content: ''; visibility: hidden; width: 0; display: inline-block; height: 0.76em; --_caret-width: clamp(2px, 0.08em, 10px); border: none; border-radius: calc(var(--_caret-width) / 2); border-right: var(--_caret-width) solid var(--_caret-color); margin-right: calc(-1 * var(--_caret-width)); position: relative; left: -0.045em; bottom: -0.05em; animation: ML__caret-blink 1.05s step-end forwards infinite; } .ML__latex-caret::after { content: ''; visibility: hidden; --_caret-width: clamp(2px, 0.08em, 10px); border: none; border-radius: calc(var(--_caret-width) / 2); border-right: var(--_caret-width) solid var(--_latex-color); margin-right: calc(-1 * var(--_caret-width)); position: relative; left: -0.019em; animation: ML__caret-blink 1.05s step-end forwards infinite; } .ML__focused .ML__latex-caret::after, .ML__focused .ML__text-caret::after, .ML__focused .ML__caret::after { visibility: visible; } .ML__focused .ML__text { background: var(--_text-highlight-background-color); } /* When using smartFence, the anticipated closing fence is displayed with this style */ .ML__smart-fence__close { opacity: var(--_smart-fence-opacity); color: var(--_smart-fence-color); } .ML__focused .ML__selected, .ML__focused .ML__selected .ML__contains-caret, .ML__focused .ML__selected .ML__smart-fence__close, .ML__focused .ML__selected .ML__placeholder { color: var(--_selection-color); opacity: 1; } .ML__empty-line-anchor::after { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 8px; height: 20px; border-radius: 2px; background: transparent; opacity: 0; pointer-events: none; } .ML__focused .ML__empty-line-anchor.ML__selected::after { background: var(--_selection-background-color); opacity: 1; } .ML__selection { box-sizing: border-box; background: transparent; } :host(:focus) .ML__selection { background: var(--_selection-background-color) !important; } .ML__contains-caret.ML__close, .ML__contains-caret.ML__open, .ML__contains-caret > .ML__close, .ML__contains-caret > .ML__open, .ML__contains-caret .ML__sqrt-sign, .ML__contains-caret .ML__sqrt-line { color: var(--_contains-highlight-color); } .ML__contains-highlight { box-sizing: border-box; background: transparent; } .ML__focused .ML__contains-highlight { background: var(--_contains-highlight-background-color); } .ML__raw-latex { font-family: 'Berkeley Mono', 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace; font-weight: 400; font-size: 0.8em; letter-spacing: -0.05em; color: var(--_latex-color); } .ML__suggestion { color: var(--neutral-500); } .ML__virtual-keyboard-toggle.is-visible.is-pressed:hover { background: hsl(var(--_hue), 25%, 35%); color: #fafafa; fill: currentColor; } .ML__virtual-keyboard-toggle.is-pressed, .ML__virtual-keyboard-toggle.is-active:hover, .ML__virtual-keyboard-toggle.is-active { background: hsl(var(--_hue), 25%, 35%); color: #fafafa; fill: currentColor; } /* Add an attribute 'data-tooltip' to automatically show a tooltip over a element on hover. */ [data-tooltip] { position: relative; } [data-tooltip]::after { content: attr(data-tooltip); position: absolute; display: block; z-index: 2; pointer-events: none; right: auto; top: calc(-100% - 4px); width: max-content; max-width: 200px; padding: 8px 8px; border-radius: 4px; background: #616161; color: #fff; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2); text-align: center; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-style: normal; font-weight: 400; font-size: 13px; /* Phone */ opacity: 0; transform: scale(0.5); } @media only screen and (max-width: 767px) { [data-tooltip]::after { padding: 8px 16px; font-size: 16px; } } menu [data-tooltip]::after { left: 100%; top: 0%; } menu .ML__base { cursor: default; } /** Don't display if we're tracking, i.e. have the pointer down */ .tracking [data-tooltip]:hover::after { /* Use visibility, not display. Display will remove the after from the DOM, and the override below will not work */ visibility: hidden; } /** But do display if tracking and inside a menu */ .tracking menu li[data-tooltip]:hover::after, [data-tooltip]:hover::after { visibility: visible; opacity: 1; transform: scale(1); transition-property: opacity, scale; transition-duration: 0.15s; transition-delay: 1s; transition-timing-function: cubic-bezier(0.4, 0, 1, 1); } .ML__prompt { border-radius: 2px; } .ML__editablePromptBox { outline: 1px solid #acacac; border-radius: 2px; z-index: -1; } .ML__focused .ML__focusedPromptBox { outline: highlight auto 1px; } .ML__lockedPromptBox { background-color: rgba(142, 142, 141, 0.4); z-index: -1; } .ML__correctPromptBox { outline: 1px solid var(--_correct-color); box-shadow: 0 0 5px var(--_correct-color); } .ML__incorrectPromptBox { outline: 1px solid var(--_incorrect-color); box-shadow: 0 0 5px var(--_incorrect-color); } .variant-submenu { display: flex; flex-direction: column; padding: 8px; } .variant-submenu [part='menu-item'].ML__xl { font-size: 2rem; text-align: center; margin: 0; } .ML__center-menu .label { text-align: center; } .insert-matrix-submenu { /* Grid doesn't work on Safari */ --_menu-item-size: 25px; width: calc(5 * var(--_menu-item-size)); display: flex; flex-wrap: wrap; padding: 8px; align-content: center; justify-content: center; } .insert-matrix-submenu [part='menu-item'] { width: var(--_menu-item-size); height: var(--_menu-item-size); font-size: 21px; border: none; border-radius: 0; line-height: 21px; text-align: center; padding: 0; margin: 0; } .border-submenu [part='menu-item'] { font-size: 2rem; line-height: 1.2; text-align: center; } .swatches-submenu { --_swatch-size: 2rem; --_columns: 4; display: flex; flex-flow: wrap; padding: 8px; max-width: calc(var(--_columns) * (var(--_swatch-size) + 18px) + 16px); box-sizing: border-box; } .menu-swatch { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: fit-content; height: fit-content; margin: 2px; padding: 0; background: var(--neutral-200); } .menu-swatch > .label { padding: 0; margin: 0; line-height: 0; } .menu-swatch > .label > span { display: inline-block; margin: 6px; min-width: var(--_swatch-size); min-height: var(--_swatch-size); border-radius: 50%; } .menu-swatch.active { background: var(--neutral-100); scale: 1.4; } .menu-swatch.active > .label > span { border-radius: 2px; } .menu-swatch .ui-checkmark, .menu-swatch .ui-mixedmark { position: absolute; margin: 0; padding: 0; color: white; } .menu-swatch.dark-contrast .ui-checkmark, .menu-swatch.dark-contrast .ui-mixedmark { color: #000; } .ML__insert-template { font-size: 1em; } .ML__insert-label { opacity: 0.5; margin-left: 2ex; } `;var j0=`.ML__container { min-height: auto !important; --_hue: var(--hue, 212); --_placeholder-color: var(--placeholder-color, hsl(var(--_hue), 40%, 49%)); --_placeholder-opacity: var(--placeholder-opacity, 0.4); --_text-font-family: var(--text-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif); } .ML__sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; } .ML__is-inline { display: inline-block; } .ML__base { visibility: inherit; display: inline-block; position: relative; cursor: text; padding: 0; margin: 0; box-sizing: content-box; border: 0; outline: 0; vertical-align: baseline; font-weight: inherit; font-family: inherit; font-style: inherit; text-decoration: none; width: min-content; } .ML__strut, .ML__strut--bottom { display: inline-block; min-height: 0.5em; } .ML__small-delim { font-family: KaTeX_Main; } /* Text mode */ .ML__text { font-family: var(--_text-font-family); white-space: pre; } /* Use cmr for 'math upright' */ .ML__cmr { font-family: KaTeX_Main; font-style: normal; } .ML__mathit { font-family: KaTeX_Math; /* The KaTeX_Math font is italic by default, so the font-style below is only useful when a fallback font is used */ font-style: italic; } .ML__mathbf { font-family: KaTeX_Main; font-weight: bold; } /* Lowercase greek symbols should stick to math font when \\mathbf is applied to match TeX idiosyncratic behavior */ .lcGreek.ML__mathbf { font-family: KaTeX_Math; } .ML__mathbfit { font-family: KaTeX_Math; font-weight: bold; font-style: italic; } .ML__ams { font-family: KaTeX_AMS; } /* Blackboard */ .ML__bb { font-family: KaTeX_AMS; } .ML__cal { font-family: KaTeX_Caligraphic; } .ML__frak { font-family: KaTeX_Fraktur; } .ML__tt { font-family: KaTeX_Typewriter; } .ML__script { font-family: KaTeX_Script; } .ML__sans { font-family: KaTeX_SansSerif; } .ML__series_ul { font-weight: 100; } .ML__series_el { font-weight: 100; } .ML__series_l { font-weight: 200; } .ML__series_sl { font-weight: 300; } .ML__series_sb { font-weight: 500; } .ML__bold { font-weight: 700; } .ML__series_eb { font-weight: 800; } .ML__series_ub { font-weight: 900; } .ML__series_uc { font-stretch: ultra-condensed; } .ML__series_ec { font-stretch: extra-condensed; } .ML__series_c { font-stretch: condensed; } .ML__series_sc { font-stretch: semi-condensed; } .ML__series_sx { font-stretch: semi-expanded; } .ML__series_x { font-stretch: expanded; } .ML__series_ex { font-stretch: extra-expanded; } .ML__series_ux { font-stretch: ultra-expanded; } .ML__it { font-style: italic; } .ML__shape_ol { -webkit-text-stroke: 1px black; text-stroke: 1px black; color: transparent; } .ML__shape_sc { font-variant: small-caps; } .ML__shape_sl { font-style: oblique; } /* First level emphasis */ .ML__emph { color: #bc2612; } /* Second level emphasis */ .ML__emph .ML__emph { color: #0c7f99; } .ML__highlight { color: #007cb2; background: #edd1b0; } .ML__center { text-align: center; } .ML__left { text-align: left; } .ML__right { text-align: right; } .ML__label_padding { padding: 0 0.5em; } .ML__frac-line { width: 100%; min-height: 1px; } .ML__frac-line:after { content: ''; display: block; margin-top: max(-1px, -0.04em); min-height: max(1px, 0.04em); /* Ensure the line is visible when printing even if "turn off background images" is on*/ -webkit-print-color-adjust: exact; print-color-adjust: exact; /* There's a bug since Chrome 62 where sub-pixel border lines don't draw at some zoom levels (110%, 90%). Setting the min-height used to work around it, but that workaround broke in Chrome 84 or so. Setting the background (and the min-height) seems to work for now. */ background: currentColor; box-sizing: content-box; /* Vuetify sets the box-sizing to inherit causes the fraction line to not draw at all sizes (see #26) */ /* On some versions of Firefox on Windows, the line fails to draw at some zoom levels, but setting the transform triggers the hardware accelerated path, which works */ transform: translate(0, 0); forced-color-adjust: preserve-parent-color; } @media (forced-colors: active) { .ML__frac-line { min-height: 0px; } } .ML__sqrt { display: inline-block; } .ML__sqrt-sign { display: inline-block; position: relative; } .ML__sqrt-line { display: inline-block; height: max(1px, 0.04em); width: 100%; } .ML__sqrt-line:before { content: ''; display: block; margin-top: min(-1px, -0.04em); min-height: max(1px, 0.04em); /* Ensure the line is visible when printing even if "turn off background images" is on*/ -webkit-print-color-adjust: exact; print-color-adjust: exact; background: currentColor; /* On some versions of Firefox on Windows, the line fails to draw at some zoom levels, but setting the transform triggers the hardware accelerated path, which works */ transform: translate(0, 0); forced-color-adjust: preserve-parent-color; } @media (forced-colors: active) { .ML__sqrt-line:after { background: white !important; } } .ML__sqrt-line:after { border-bottom-width: 1px; content: ' '; display: block; margin-top: -0.1em; } .ML__sqrt-index { margin-left: 0.27777778em; margin-right: -0.55555556em; } .ML__delim-size1 { font-family: KaTeX_Size1; } .ML__delim-size2 { font-family: KaTeX_Size2; } .ML__delim-size3 { font-family: KaTeX_Size3; } .ML__delim-size4 { font-family: KaTeX_Size4; } .ML__delim-mult .delim-size1 > span { font-family: KaTeX_Size1; } .ML__delim-mult .delim-size4 > span { font-family: KaTeX_Size4; } .ML__accent-body { font-family: KaTeX_Main; } .ML__accent-combining-char { position: relative; left: 0.24em; } /** The markup for a LaTeX formula, either in an editable mathfield or in a static display. */ .ML__latex { display: inline-block; direction: ltr; text-align: left; text-indent: 0; text-rendering: auto; font-family: inherit; font-style: normal; font-size-adjust: none; font-stretch: normal; font-variant-caps: normal; letter-spacing: normal; line-height: 1.2; word-wrap: normal; word-spacing: normal; white-space: nowrap; text-shadow: none; -webkit-user-select: none; user-select: none; width: min-content; forced-color-adjust: preserve-parent-color; } .ML__latex .style-wrap { position: relative; } .ML__latex .ML__mfrac { display: inline-block; } .ML__latex .ML__left-right { display: inline-block; } .ML__latex .ML__vlist-t { display: inline-table; table-layout: fixed; border-collapse: collapse; } .ML__latex .ML__vlist-r { display: table-row; } .ML__latex .ML__vlist { display: table-cell; vertical-align: bottom; position: relative; } .ML__latex .ML__vlist > span { display: block; height: 0; position: relative; } .ML__latex .ML__vlist > span > span { display: inline-block; } .ML__latex .ML__vlist > span > .ML__pstrut { overflow: hidden; width: 0; } .ML__latex .ML__vlist-t2 { margin-right: -2px; } .ML__latex .ML__vlist-s { display: table-cell; vertical-align: bottom; font-size: 1px; width: 2px; min-width: 2px; } .ML__latex .ML__msubsup { text-align: left; } .ML__latex .ML__negativethinspace { display: inline-block; margin-left: -0.16667em; height: 0.71em; } .ML__latex .ML__thinspace { display: inline-block; width: 0.16667em; height: 0.71em; } .ML__latex .ML__mediumspace { display: inline-block; width: 0.22222em; height: 0.71em; } .ML__latex .ML__thickspace { display: inline-block; width: 0.27778em; height: 0.71em; } .ML__latex .ML__enspace { display: inline-block; width: 0.5em; height: 0.71em; } .ML__latex .ML__quad { display: inline-block; width: 1em; height: 0.71em; } .ML__latex .ML__qquad { display: inline-block; width: 2em; height: 0.71em; } .ML__latex .ML__llap, .ML__latex .ML__rlap { width: 0; position: relative; display: inline-block; } .ML__latex .ML__llap > .ML__inner, .ML__latex .ML__rlap > .ML__inner { position: absolute; } .ML__latex .ML__llap > .ML__fix, .ML__latex .ML__rlap > .ML__fix { display: inline-block; } .ML__latex .ML__llap > .ML__inner { right: 0; } .ML__latex .ML__rlap > .ML__inner { left: 0; } .ML__latex .ML__rule { display: inline-block; border: solid 0; position: relative; box-sizing: border-box; } .ML__latex .overline .overline-line, .ML__latex .underline .underline-line { width: 100%; } .ML__latex .overline .overline-line:before, .ML__latex .underline .underline-line:before { content: ''; border-bottom-style: solid; border-bottom-width: max(1px, 0.04em); -webkit-print-color-adjust: exact; print-color-adjust: exact; display: block; } .ML__latex .overline .overline-line:after, .ML__latex .underline .underline-line:after { border-bottom-style: solid; border-bottom-width: max(1px, 0.04em); -webkit-print-color-adjust: exact; print-color-adjust: exact; content: ''; display: block; margin-top: -1px; } .ML__latex .ML__stretchy { display: block; position: absolute; width: 100%; left: 0; overflow: hidden; } .ML__latex .ML__stretchy:before, .ML__latex .ML__stretchy:after { content: ''; } .ML__latex .ML__stretchy svg { display: block; position: absolute; width: 100%; height: inherit; fill: currentColor; stroke: currentColor; fill-rule: nonzero; fill-opacity: 1; stroke-width: 1; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0; stroke-opacity: 1; } .ML__latex .slice-1-of-2 { display: inline-flex; position: absolute; left: 0; width: 50.2%; overflow: hidden; } .ML__latex .slice-2-of-2 { display: inline-flex; position: absolute; right: 0; width: 50.2%; overflow: hidden; } .ML__latex .slice-1-of-3 { display: inline-flex; position: absolute; left: 0; width: 25.1%; overflow: hidden; } .ML__latex .slice-2-of-3 { display: inline-flex; position: absolute; left: 25%; width: 50%; overflow: hidden; } .ML__latex .slice-3-of-3 { display: inline-flex; position: absolute; right: 0; width: 25.1%; overflow: hidden; } .ML__latex .slice-1-of-1 { display: inline-flex; position: absolute; width: 100%; left: 0; overflow: hidden; } .ML__latex .ML__nulldelimiter { display: inline-block; } .ML__latex .ML__op-group { display: inline-block; } .ML__latex .ML__op-symbol { position: relative; } .ML__latex .ML__op-symbol.ML__small-op { font-family: KaTeX_Size1; } .ML__latex .ML__op-symbol.ML__large-op { font-family: KaTeX_Size2; } .ML__latex:has(.ML__center_environment), .ML__latex:has(.ML__multiline_environment), .ML__latex:has(.ML__align_environment), .ML__latex:has(.ML__eqnarray_environment), .ML__latex:has(.ML__gather_environment) { width: 100%; } .ML__latex .ML__multiline_environment { display: inline-flex; width: 100%; } .ML__latex .ML__center_environment { display: inline-flex; width: 100%; justify-content: center; } .ML__latex .ML__align_environment, .ML__latex .ML__eqnarray_environment, .ML__latex .ML__gather_environment { display: inline-block; } .ML__latex .ML__mtable .ML__vertical-separator { display: inline-block; min-width: 1px; box-sizing: border-box; } .ML__latex .ML__mtable .ML__arraycolsep { display: inline-block; } .ML__latex .ML__mtable .col-align-m > .ML__vlist-t { text-align: center; } .ML__latex .ML__mtable .col-align-c > .ML__vlist-t { text-align: center; } .ML__latex .ML__mtable .col-align-l > .ML__vlist-t { text-align: left; } .ML__latex .ML__mtable .col-align-r > .ML__vlist-t { text-align: right; } [data-href] { cursor: pointer; } .ML__error { display: inline-block; background-image: radial-gradient(ellipse at center, hsl(341, 100%, 40%), rgba(0, 0, 0, 0) 70%); background-color: hsla(341, 100%, 40%, 0.1); background-repeat: repeat-x; background-size: 3px 3px; padding-bottom: 3px; background-position: 0 100%; } .ML__error > .ML__error { background: transparent; padding: 0; } .ML__placeholder { color: var(--_placeholder-color); opacity: var(--_placeholder-opacity); padding-left: 0.4ex; padding-right: 0.4ex; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; } .ML__notation { position: absolute; box-sizing: border-box; line-height: 0; } /* This class is used to implement the \`\\mathtip\` and \`\\texttip\` commands For UI elements, see \`[data-ML__tooltip]\` */ .ML__tooltip-container { position: relative; transform: scale(0); } .ML__tooltip-container .ML__tooltip-content { position: fixed; display: inline-table; visibility: hidden; z-index: 2; width: max-content; max-width: 400px; padding: 12px 12px; border: var(--_tooltip-border); border-radius: var(--_tooltip-border-radius); background: var(--_tooltip-background-color); --_selection-color: var(--_tooltip-color); color: var(--_tooltip-color); box-shadow: var(--_tooltip-box-shadow); opacity: 0; transition: opacity 0.15s cubic-bezier(0.4, 0, 1, 1); } .ML__tooltip-container .ML__tooltip-content .ML__text { white-space: normal; } .ML__tooltip-container .ML__tooltip-content .ML__base { display: contents; } .ML__tooltip-container:hover .ML__tooltip-content { visibility: visible; opacity: 1; font-size: 0.75em; transform: scale(1) translate(0, 3em); } .ML__bg { background-color: transparent !important; } .ML__bg::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--bg-color); z-index: -1; box-sizing: border-box; } `;var J0=`#mathlive-environment-popover.is-visible { visibility: visible; } #mathlive-environment-popover { --_environment-panel-height: var(--environment-panel-height, 70px); --_accent-color: var(--accent-color, #aaa); --_background: var(--environment-panel-background, #fff); --_button-background: var(--environment-panel-button-background, white); --_button-background-hover: var(--environment-panel-button-background-hover, #f5f5f7); --_button-background-active: var(--environment-panel-button-background-active, #f5f5f7); --_button-text: var(--environment-panel-button-text, #e3e4e8); position: absolute; width: calc(var(--_environment-panel-height) * 2); height: var(--_environment-panel-height); border-radius: 4px; border: 1.5px solid var(--_accent-color); background-color: var(--_background); box-shadow: 0 0 30px 0 var(--environment-shadow, rgba(0, 0, 0, 0.4)); pointer-events: all; visibility: hidden; } #mathlive-environment-popover .MLEP__array-buttons { height: calc(var(--_environment-panel-height) * 5/4); width: calc(var(--_environment-panel-height) * 5/4); margin-left: calc(0px - var(--_environment-panel-height) * 0.16); margin-top: calc(0px - var(--_environment-panel-height) * 0.19); } #mathlive-environment-popover .MLEP__array-buttons .font { fill: white; } #mathlive-environment-popover .MLEP__array-buttons circle { fill: #7f7f7f; transition: fill 300ms; } #mathlive-environment-popover .MLEP__array-buttons .MLEP__array-insert-background { fill-opacity: 1; fill: var(--_background); stroke: var(--_accent-color); stroke-width: 3px; } #mathlive-environment-popover .MLEP__array-buttons line { stroke: var(--_accent-color); stroke-opacity: 0; stroke-width: 40; pointer-events: none; transition: stroke-opacity 300ms; stroke-linecap: round; } #mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover circle { fill: var(--_accent-color); } #mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover line { stroke-opacity: 1; } #mathlive-environment-popover .MLEP__environment-delimiter-controls { height: 100%; width: 50%; } #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options { width: var(--_environment-panel-height); height: var(--_environment-panel-height); display: flex; flex-wrap: wrap; flex-direction: row; justify-content: space-around; } #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg { pointer-events: all; margin-top: 2px; width: calc(var(--_environment-panel-height) / 3 * 28 / 24); height: calc(var(--_environment-panel-height) / 3 - 2px); border-radius: calc(var(--_environment-panel-height) / 25); background-color: var(--_button-background); } #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg:hover { background-color: var(--_button-background-hover); } #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path, #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg line { stroke: var(--_button-text); stroke-width: 2; stroke-linecap: round; } #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg rect, #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path { fill-opacity: 0; } #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active { pointer-events: none; background-color: var(--_button-background-active); } #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active path, #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active line { stroke: var(--_accent-color); } #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active circle { fill: var(--_accent-color); } `;var G0=`/* The element that display info while in latex mode */ #mathlive-suggestion-popover { --_suggestion-zindex: var(--suggestion-zindex, 100); background-color: rgba(97, 97, 97); color: #fff; text-align: center; border-radius: 8px; position: fixed; z-index: var(--_suggestion-zindex); display: none; flex-direction: column; justify-content: center; box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); } #mathlive-suggestion-popover.top-tip::after { content: ''; position: absolute; top: -15px; left: calc(50% - 15px); width: 0; height: 0; border-left: 15px solid transparent; border-right: 15px solid transparent; border-bottom: 15px solid rgba(97, 97, 97); font-size: 1rem; } #mathlive-suggestion-popover.bottom-tip::after { content: ''; position: absolute; bottom: -15px; left: calc(50% - 15px); width: 0; height: 0; border-left: 15px solid transparent; border-right: 15px solid transparent; border-top: 15px solid rgba(97, 97, 97); font-size: 1rem; } #mathlive-suggestion-popover.is-animated { transition: all 0.2s cubic-bezier(0.64, 0.09, 0.08, 1); animation: ML__fade-in cubic-bezier(0, 0, 0.2, 1) 0.15s; } #mathlive-suggestion-popover.is-visible { display: flex; } @keyframes ML__fade-in { from { opacity: 0; } to { opacity: 1; } } /* The wrapper class for the entire content of the popover panel */ #mathlive-suggestion-popover ul { display: flex; flex-flow: column; list-style: none; margin: 0; padding: 0; align-items: flex-start; max-height: 400px; overflow-y: auto; } #mathlive-suggestion-popover li { display: flex; flex-direction: row; justify-content: space-between; margin: 8px; padding: 8px; width: calc(100% - 16px - 16px); column-gap: 1em; border-radius: 8px; cursor: pointer; /* Since the content can be clicked on, provide feedback on hover */ } #mathlive-suggestion-popover li a { color: #5ea6fd; padding-top: 0.3em; margin-top: 0.4em; display: block; } #mathlive-suggestion-popover li a:hover { color: #5ea6fd; text-decoration: underline; } #mathlive-suggestion-popover li:hover, #mathlive-suggestion-popover li.is-pressed, #mathlive-suggestion-popover li.is-active { background: rgba(255, 255, 255, 0.1); } /* The command inside a popover (inside a #mathlive-suggestion-popover) */ .ML__popover__command { font-size: 1.6rem; font-family: KaTeX_Main; } .ML__popover__current { background: #5ea6fd; color: #fff; } .ML__popover__latex { font-family: 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace; align-self: center; } /* The keyboard shortcuts for a symbol as displayed in the popover */ .ML__popover__keybinding { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-size: 0.8em; opacity: 0.7; } /* Style for the character that joins the modifiers of a keyboard shortcut (usually a "+" sign)*/ .ML__shortcut-join { opacity: 0.5; } `;var X0=`/* The element that displays the keys as the user type them */ #mathlive-keystroke-caption-panel { visibility: hidden; /*min-width: 160px;*/ /*background-color: rgba(97, 97, 200, .95);*/ background: var(--secondary, hsl(var(--_hue), 19%, 26%)); border-color: var(--secondary-border, hsl(0, 0%, 91%)); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23); text-align: center; border-radius: 6px; padding: 16px; position: absolute; z-index: 1; display: flex; flex-direction: row-reverse; justify-content: center; --keystroke: white; --on-keystroke: #555; --keystroke-border: #f7f7f7; } @media (prefers-color-scheme: dark) { body:not([theme='light']) #mathlive-keystroke-caption-panel { --keystroke: hsl(var(--_hue), 50%, 30%); --on-keystroke: hsl(0, 0%, 98%); --keystroke-border: hsl(var(--_hue), 50%, 25%); } } body[theme='dark'] #mathlive-keystroke-caption-panel { --keystroke: hsl(var(--_hue), 50%, 30%); --on-keystroke: hsl(0, 0%, 98%); --keystroke-border: hsl(var(--_hue), 50%, 25%); } #mathlive-keystroke-caption-panel > span { min-width: 14px; /*height: 8px;*/ margin: 0 8px 0 0; padding: 4px; background-color: var(--keystroke); color: var(--on-keystroke); fill: currentColor; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-size: 1em; border-radius: 6px; border: 2px solid var(--keystroke-border); /*box-shadow: 0 7px 14px rgba(0,0,0,0.25), 0 5px 5px rgba(0,0,0,0.22);*/ } `;var Z0=`.ML__keyboard { --_keyboard-height: 0; --_keyboard-zindex: var(--keyboard-zindex, 105); --_accent-color: var(--keyboard-accent-color, #0c75d8); --_background: var(--keyboard-background, #cacfd7); --_border: var(--keyboard-border, #ddd); --_padding-horizontal: var(--keyboard-padding-horizontal, 0px); --_padding-top: var(--keyboard-padding-top, 5px); --_padding-bottom: var(--keyboard-padding-bottom, 0px); --_row-padding-left: var(--keyboard-row-padding-left, 0px); --_row-padding-right: var(--keyboard-row-padding-right, 0px); --_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f); --_toolbar-text-active: var(--keyboard-toolbar-text-active, var(--_accent-color)); --_toolbar-background: var(--keyboard-toolbar-background, transparent); --_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee); --_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent); --_toolbar-font-size: var(--keyboard-toolbar-font-size, '135%'); --_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff); --_keycap-background: var(--keycap-background, #f0f0f0); --_keycap-background-hover: var(--keycap-background-hover, #f5f5f7); --_keycap-background-active: var(--keycap-background-active, var(--_accent-color)); --_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color)); --_keycap-border: var(--keycap-border, #e5e6e9); --_keycap-border-bottom: var(--keycap-border-bottom, #8d8f92); --_keycap-text: var(--keycap-text, #000); --_keycap-text-active: var(--keycap-text-active, #fff); --_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text)); --_keycap-text-pressed: var(--keycap-text-pressed, #fff); --_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color)); --_keycap-primary-background: var(--keycap-primary-background, var(--_accent-color)); --_keycap-primary-text: var(--keycap-primary-text, #ddd); --_keycap-primary-background-hover: var(--keycap-primary-background-hover, #0d80f2); --_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8); --_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795); --_keycap-secondary-text: var(--keycap-secondary-text, #060707); --_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0); --_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6); --_keycap-height: var(--keycap-height, 60px); /* Keycap width (incl. margin) */ --_keycap-max-width: var(--keycap-max-width, 100px); --_keycap-gap: var(--keycap-gap, 8px); --_keycap-font-size: var(--keycap-font-size, clamp(16px, 4cqw, 24px)); --_keycap-small-font-size: var(--keycap-small-font-size, calc(var(--keycap-font-size) * 0.8)); --_keycap-extra-small-font-size: var(--keycap-extra-small-font-size, calc(var(--keycap-font-size) / 1.42)); --_variant-panel-background: var(--variant-panel-background, #f0f0f0); --_variant-keycap-text: var(--variant-keycap-text, var(--_keycap-text)); --_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active)); --_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color)); --_variant-keycap-length: var(--variant-keycap-length, 70px); --_variant-keycap-font-size: var(--variant-keycap-font-size, 30px); --_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 12px); --_keycap-shift-font-size: var(--keycap-shift-font-size, 16px); --_keycap-shift-color: var(--keycap-shift-color, var(--_accent-color)); --_box-placeholder-color: var(--box-placeholder-color, var(--_accent-color)); --_box-placeholder-pressed-color: var(--box-placeholder-pressed-color, var(--keycap-text-pressed)); --_keycap-glyph-size: var(--keycap-glyph-size, 20px); --_keycap-glyph-size-lg: var(--keycap-glyph-size-lg, 24px); --_keycap-glyph-size-xl: var(--keycap-glyph-size-xl, 50px); } .is-math-mode .MLK__rows .if-text-mode, .is-text-mode .MLK__rows .if-math-mode { display: none; } .if-can-undo, .if-can-redo, .if-can-copy, .if-can-cut, .if-can-paste { opacity: 0.4; pointer-events: none; } .can-undo .if-can-undo, .can-redo .if-can-redo, .can-copy .if-can-copy, .can-cut .if-can-cut, .can-paste .if-can-paste { opacity: 1; pointer-events: all; } body > .ML__keyboard { position: fixed; --_padding-bottom: calc(var(--keyboard-padding-bottom, 0px) + env(safe-area-inset-bottom, 0)); } body > .ML__keyboard.is-visible > .MLK__backdrop { box-shadow: 0 -5px 6px rgba(0, 0, 0, 0.08); border-top: 1px solid var(--_border); } body > .ML__keyboard.backdrop-is-transparent.is-visible > .MLK__backdrop { box-shadow: none; border: none; } body > .ML__keyboard.is-visible.animate > .MLK__backdrop { transition: 0.28s cubic-bezier(0, 0, 0.2, 1); transition-property: transform, opacity; transition-timing-function: cubic-bezier(0.4, 0, 1, 1); } .ML__keyboard { position: relative; overflow: hidden; top: 0; left: 0; height: 100%; width: 100%; z-index: var(--_keyboard-zindex); box-sizing: border-box; outline: none; border: none; margin: 0; padding: 0; line-height: 1; overflow-wrap: unset; text-align: left; vertical-align: baseline; cursor: auto; white-space: pre; box-shadow: none; opacity: 1; transform: none; pointer-events: none; } .ML__keyboard :where(div) { box-sizing: border-box; outline: none; border: none; margin: 0; padding: 0; line-height: 1; overflow-wrap: unset; text-align: left; vertical-align: baseline; cursor: auto; white-space: pre; box-shadow: none; transform: none; } .MLK__backdrop { position: absolute; bottom: calc(-1 * var(--_keyboard-height)); width: 100%; height: var(--_keyboard-height); box-sizing: border-box; padding-top: var(--_padding-top); padding-bottom: var(--_padding-bottom); padding-left: var(--_padding-horizontal); padding-right: var(--_padding-horizontal); opacity: 0; visibility: hidden; transform: translate(0, 0); background: var(--_background); } .backdrop-is-transparent .MLK__backdrop { background: transparent; } /* If a custom layout has a custom container/backdrop (backdrop-is-transparent), make sure to let pointer event go through. */ .backdrop-is-transparent .MLK__plate { background: transparent; pointer-events: none; } /* If a custom layout has a custom container/backdrop, make sure to allow pointer events on it. */ .backdrop-is-transparent .MLK__layer > div > div { pointer-events: all; } .ML__keyboard.is-visible > .MLK__backdrop { transform: translate(0, calc(-1 * var(--_keyboard-height))); opacity: 1; visibility: visible; } .caps-lock-indicator { display: none; width: 8px; height: 8px; background: #0cbc0c; box-shadow: inset 0 0 4px 0 #13ca13, 0 0 4px 0 #a9ef48; border-radius: 8px; right: 8px; top: 8px; position: absolute; } .ML__keyboard.is-caps-lock .caps-lock-indicator { display: block; } .ML__keyboard.is-caps-lock .shift { background: var(--_keycap-background-active); color: var(--_keycap-text-active); } .MLK__plate { position: absolute; top: var(--_padding-top); left: var(--_padding-horizontal); width: calc(100% - 2 * var(--_padding-horizontal)); margin: 0; padding: 0; box-sizing: border-box; container-type: inline-size; touch-action: none; -webkit-user-select: none; user-select: none; pointer-events: all; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-size: 16px; /* Size of toolbar labels */ font-weight: 400; text-shadow: none; } .ML__box-placeholder { color: var(--_box-placeholder-color); } .MLK__tex { font-family: KaTeX_Main, KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important; } .MLK__tex-math { font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important; font-style: italic; } .MLK__layer { display: none; outline: none; } .MLK__layer.is-visible { display: flex; flex-flow: column; } /* Keyboard layouts are made or rows of keys... */ .MLK__rows { --_keycap-width: var(--keycap-width, min(var(--_keycap-max-width), 10cqw)); display: flex; flex-flow: column; align-items: center; border-collapse: separate; clear: both; border: 0; margin: 0; margin-bottom: var(--_keycap-gap); gap: var(--_keycap-gap); /* If the styling include, e.g., some shadows, they will be cut off by the overflow. In that case, set the padding to compensate. */ padding-left: var(--_row-padding-left); padding-right: var(--_row-padding-right); overflow: visible; touch-action: none; } .MLK__rows > .MLK__row { display: flex; flex-flow: row; justify-content: center; width: 100%; gap: var(--_keycap-gap); margin: 0; padding: 0; /* For the alignment of the text on some modifiers (e.g. shift) */ /* Extra spacing between two adjacent keys */ } .MLK__rows > .MLK__row .tex { font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important; } .MLK__rows > .MLK__row .tex-math { font-family: KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important; } .MLK__rows > .MLK__row .big-op { font-size: calc(1.25 * var(--_keycap-font-size)); } .MLK__rows > .MLK__row .small { font-size: var(--_keycap-small-font-size); } .MLK__rows > .MLK__row .bottom { justify-content: flex-end; } .MLK__rows > .MLK__row .left { align-items: flex-start; padding-left: 12px; } .MLK__rows > .MLK__row .right { align-items: flex-end; padding-right: 12px; } .MLK__rows > .MLK__row .w0 { width: 0; } .MLK__rows > .MLK__row .w5 { width: calc(0.5 * var(--_keycap-width) - var(--_keycap-gap)); } .MLK__rows > .MLK__row .w15 { width: calc(1.5 * var(--_keycap-width) - var(--_keycap-gap)); } .MLK__rows > .MLK__row .w20 { width: calc(2 * var(--_keycap-width) - var(--_keycap-gap)); } .MLK__rows > .MLK__row .w40 { width: calc(4 * var(--_keycap-width) - var(--_keycap-gap)); } .MLK__rows > .MLK__row .w50 { width: calc(5 * var(--_keycap-width) - var(--_keycap-gap)); } .MLK__rows > .MLK__row .MLK__keycap.w50 { font-size: 80%; padding-top: 10px; font-weight: 100; } .MLK__rows > .MLK__row .separator { background: transparent; border: none; pointer-events: none; } .MLK__rows > .MLK__row .horizontal-rule { height: 6px; margin-top: 3px; margin-bottom: 0; width: 100%; border-radius: 0; border-top: var(--_horizontal-rule); } .MLK__rows > .MLK__row .ghost { background: var(--_toolbar-background); border: none; color: var(--_toolbar-text); } .MLK__rows > .MLK__row .ghost:hover { background: var(--_toolbar-background-hover); } .MLK__rows > .MLK__row .bigfnbutton { font-size: var(--_keycap-extra-small-font-size); } .MLK__rows > .MLK__row .shift, .MLK__rows > .MLK__row .action { color: var(--_keycap-secondary-text); background: var(--_keycap-secondary-background); border-color: var(--_keycap-secondary-border); border-bottom-color: var(--_keycap-secondary-border-bottom); line-height: 0.8; font-size: min(1rem, var(--_keycap-small-font-size)); font-weight: 600; padding: 8px 12px 8px 12px; } .MLK__rows > .MLK__row .shift:hover, .MLK__rows > .MLK__row .action:hover { background: var(--_keycap-secondary-background-hover); } .MLK__rows > .MLK__row .action.primary { background: var(--_keycap-primary-background); color: var(--_keycap-primary-text); } .MLK__rows > .MLK__row .action.primary:hover { background: var(--_keycap-primary-background-hover); color: var(--_keycap-primary-text); } .MLK__rows > .MLK__row .shift.selected, .MLK__rows > .MLK__row .action.selected { color: var(--_toolbar-text-active); } .MLK__rows > .MLK__row .shift.selected.is-pressed, .MLK__rows > .MLK__row .action.selected.is-pressed, .MLK__rows > .MLK__row .shift.selected.is-active, .MLK__rows > .MLK__row .action.selected.is-active { color: white; } .MLK__rows > .MLK__row .warning { background: #cd0030; color: white; } .MLK__rows > .MLK__row .warning svg.svg-glyph { width: var(--_keycap-glyph-size-lg); height: var(--_keycap-glyph-size-lg); min-height: var(--_keycap-glyph-size-lg); } /** A regular keycap * Use the :where() pseudo-class to give it a very low specifity, * so that it can be overriden by custom style. */ :where(.MLK__rows > .MLK__row div) { display: flex; flex-flow: column; align-items: center; justify-content: space-evenly; width: calc(var(--_keycap-width) - var(--_keycap-gap)); height: var(--_keycap-height); box-sizing: border-box; padding: 0; vertical-align: top; text-align: center; float: left; color: var(--_keycap-text); fill: currentColor; font-size: var(--_keycap-font-size); background: var(--_keycap-background); border: 1px solid var(--_keycap-border); border-bottom-color: var(--_keycap-border-bottom); border-radius: 6px; cursor: pointer; touch-action: none; /* Keys with a variants panel */ position: relative; overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; } :where(.MLK__rows > .MLK__row div):hover { overflow: visible; background: var(--_keycap-background-hover); color: var(--_keycap-text-hover); } :where(.MLK__rows > .MLK__row div) .ML__latex { pointer-events: none; touch-action: none; } :where(.MLK__rows > .MLK__row div) svg.svg-glyph { margin: 8px 0; width: var(--_keycap-glyph-size); height: var(--_keycap-glyph-size); min-height: var(--_keycap-glyph-size); } :where(.MLK__rows > .MLK__row div) svg.svg-glyph-lg { margin: 8px 0; width: var(--_keycap-glyph-size-lg); height: var(--_keycap-glyph-size-lg); min-height: var(--_keycap-glyph-size-lg); } :where(.MLK__rows > .MLK__row div).MLK__tex-math { font-size: 25px; } :where(.MLK__rows > .MLK__row div).is-pressed { background: var(--_keycap-background-pressed); color: var(--_keycap-text-pressed); --_box-placeholder-color: var(--_box-placeholder-pressed-color); } :where(.MLK__rows > .MLK__row div).MLK__keycap.is-active, :where(.MLK__rows > .MLK__row div).action.is-active, :where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed, :where(.MLK__rows > .MLK__row div).action.is-pressed { z-index: calc(var(--_keyboard-zindex) - 5); } :where(.MLK__rows > .MLK__row div).MLK__keycap.is-active aside, :where(.MLK__rows > .MLK__row div).action.is-active aside, :where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed aside, :where(.MLK__rows > .MLK__row div).action.is-pressed aside { display: none; } :where(.MLK__rows > .MLK__row div).MLK__keycap.is-active .MLK__shift, :where(.MLK__rows > .MLK__row div).action.is-active .MLK__shift, :where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed .MLK__shift, :where(.MLK__rows > .MLK__row div).action.is-pressed .MLK__shift { display: none; } :where(.MLK__rows > .MLK__row div).shift.is-pressed, :where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed, :where(.MLK__rows > .MLK__row div).action.is-pressed { background: var(--_keycap-background-pressed); color: var(--_keycap-text-pressed); } :where(.MLK__rows > .MLK__row div).shift.is-active, :where(.MLK__rows > .MLK__row div).MLK__keycap.is-active, :where(.MLK__rows > .MLK__row div).action.is-active { background: var(--_keycap-background-active); color: var(--_keycap-text-active); --_box-placeholder-color: var(--_box-placeholder-pressed-color); } :where(.MLK__rows > .MLK__row div) small { color: var(--_keycap-secondary-text); } :where(.MLK__rows > .MLK__row div) aside { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-size: 10px; line-height: 10px; color: var(--_keycap-secondary-text); } /* Add an attribute 'data-tooltip' to display a tooltip on hover. Note there are a different set of tooltip rules for the keyboard toggle (it's in a different CSS tree) */ .ML__keyboard [data-tooltip] { position: relative; } .ML__keyboard [data-tooltip]::after { position: absolute; display: inline-table; content: attr(data-tooltip); top: inherit; bottom: 100%; width: max-content; max-width: 200px; padding: 8px 8px; background: #616161; color: #fff; text-align: center; z-index: 2; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2); border-radius: 2px; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-weight: 400; font-size: 12px; transition: all 0.15s cubic-bezier(0.4, 0, 1, 1) 1s; opacity: 0; transform: scale(0.5); } .ML__keyboard [data-tooltip]:hover { position: relative; } .ML__keyboard [data-tooltip]:hover::after { opacity: 1; transform: scale(1); } .MLK__toolbar { align-self: center; display: flex; flex-flow: row; justify-content: space-between; width: 100%; max-width: 996px; min-height: 32px; /* Icons for undo/redo, etc. */ } .MLK__toolbar svg { height: 20px; width: 20px; } .MLK__toolbar > .left { position: relative; display: flex; justify-content: flex-start; flex-flow: row; } .MLK__toolbar > .right { display: flex; justify-content: flex-end; flex-flow: row; } .MLK__toolbar > div > div { /* "button" in the toolbar */ display: flex; align-items: center; justify-content: center; color: var(--_toolbar-text); fill: currentColor; background: var(--_toolbar-background); font-size: var(--_toolbar-font-size); padding: 4px 15px; cursor: pointer; width: max-content; min-width: 42px; min-height: 34px; border: none; padding-left: 10px; padding-right: 10px; padding-bottom: 8px; padding-top: 8px; margin-top: 0; margin-bottom: 4px; margin-left: 4px; margin-right: 4px; border-radius: 8px; box-shadow: none; border-bottom: 2px solid transparent; } .MLK__toolbar > div > div:not(.disabled):not(.selected):hover { background: var(--_toolbar-background-hover); } .MLK__toolbar > div > div.disabled svg, .MLK__toolbar > div > div.disabled:hover svg, .MLK__toolbar > div > div.disabled.is-pressed svg { color: var(--_toolbar-text); opacity: 0.2; } .MLK__toolbar > div > div:hover, .MLK__toolbar > div > div:active, .MLK__toolbar > div > div.is-pressed, .MLK__toolbar > div > div.is-active { color: var(--_toolbar-text-active); } .MLK__toolbar > div > div.selected { color: var(--_toolbar-text-active); background: var(--_toolbar-background-selected); border-radius: 0; border-bottom-color: var(--_toolbar-text-active); padding-bottom: 4px; margin-bottom: 8px; } /* This is the element that displays variants on press+hold */ .MLK__variant-panel { visibility: hidden; position: fixed; display: flex; flex-flow: row wrap-reverse; justify-content: center; align-content: center; margin: 0; padding: 0; bottom: auto; top: 0; box-sizing: content-box; transform: none; z-index: calc(var(--_keyboard-zindex) + 1); touch-action: none; max-width: 350px; background: var(--_variant-panel-background); text-align: center; border-radius: 6px; padding: 6px; box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); transition: none; } .MLK__variant-panel.is-visible { visibility: visible; } .MLK__variant-panel.compact { --_variant-keycap-length: var(--variant-keycap-length, 50px); --_variant-keycap-font-size: var(--variant-keycap-font-size, 24px); --_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 10px); } .MLK__variant-panel .item { display: flex; flex-flow: column; align-items: center; justify-content: center; font-size: var(--_variant-keycap-font-size); height: var(--_variant-keycap-length); width: var(--_variant-keycap-length); margin: 0; box-sizing: border-box; border-radius: 5px; border: 1px solid transparent; background: transparent; pointer-events: all; cursor: pointer; color: var(--_variant-keycap-text); fill: currentColor; } @media (max-height: 412px) { .MLK__variant-panel .item { --_variant-keycap-font-size: var(--variant-keycap-font-size, 24px); --_variant-keycap-length: var(--variant-keycap-length, 50px); } } .MLK__variant-panel .item .ML__latex { pointer-events: none; } .MLK__variant-panel .item:hover { color: var(--_keycap-text-hover); } .MLK__variant-panel .item.is-active { background: var(--_variant-keycap-background-active); color: var(--_variant-keycap-text-active); --_box-placeholder-color: var(--_box-placeholder-pressed-color); } .MLK__variant-panel .item.is-pressed { background: var(--_variant-keycap-background-pressed); color: var(--_variant-keycap-text-pressed); --_box-placeholder-color: var(--_box-placeholder-pressed-color); } .MLK__variant-panel .item.small { font-size: var(--_keycap-small-font-size); } .MLK__variant-panel .item.swatch-button { box-sizing: border-box; background: #fbfbfb; } .MLK__variant-panel .item.swatch-button > span { display: inline-block; margin: 6px; width: calc(100% - 12px); height: calc(100% - 12px); border-radius: 50%; } .MLK__variant-panel .item.swatch-button:hover { background: #f0f0f0; } .MLK__variant-panel .item.swatch-button:hover > span { border-radius: 2px; } .MLK__variant-panel .item.box > div, .MLK__variant-panel .item.box > span { border: 1px dashed rgba(0, 0, 0, 0.24); } .MLK__variant-panel .item .warning { min-height: 60px; min-width: 60px; background: #cd0030; color: white; padding: 5px; display: flex; align-items: center; justify-content: center; border-radius: 5px; } .MLK__variant-panel .item .warning.is-pressed, .MLK__variant-panel .item .warning.is-active { background: red; } .MLK__variant-panel .item .warning svg.svg-glyph { width: var(--_keycap-glyph-size-xl); height: var(--_keycap-glyph-size-xl); } .MLK__variant-panel .item aside { font-size: var(--_variant-keycap-aside-font-size); line-height: 12px; opacity: 0.78; padding-top: 2px; width: 100%; text-align: center; text-wrap: wrap; } .MLK__keycap { position: relative; } .MLK__shift { display: block; position: absolute; right: 4px; top: 4px; font-size: var(--_keycap-shift-font-size); color: var(--_keycap-shift-color); } .hide-shift .MLK__shift { display: none; } @media (max-width: 414px) { .MLK__variant-panel { max-width: 350px; --_variant-keycap-font-size: var(--variant-keycap-font-size, 24px); --_variant-keycap-length: var(--variant-keycap-length, 50px); } } /* @xs breakpoint: iPhone 5 */ @container (max-width: 414px) { .MLK__rows { --_keycap-gap: max(var(--_keycap-gap, 2px), 2px); --_keycap-height: var(--keycap-height, 42px); --_keycap-width: var(--keycap-width, min(min(var(--_keycap-max-width)), 10cqw), 62px)); } .MLK__toolbar > div > div { font-size: 100%; margin-left: 2px; margin-right: 2px; } .MLK__rows .shift, .MLK__rows .action { font-size: 65%; } .MLK__rows .warning svg.svg-glyph { width: 14px; height: 14px; min-height: 14px; } } @container (max-width: 744px) { .MLK__rows { --_keycap-gap: max(var(--keycap-gap, 2px), 2px); --_keycap-height: var(--keycap-height, 52px); --_keycap-width: var(--keycap-width, min(min(var(--_keycap-max-width), 10cqw), 62px)); } .MLK__toolbar > div > div { padding-left: 0; padding-right: 0; } .MLK__tooltip::after { padding: 8px 16px; font-size: 16px; } .MLK__rows > .MLK__row > div.fnbutton { font-size: 16px; } .MLK__rows > .MLK__row > div.bigfnbutton { font-size: calc(var(--_keycap-extra-small-font-size) / 1.55); } .MLK__rows > .MLK__row > div.small { font-size: 13px; } .MLK__rows > .MLK__row > div > aside { display: none; } .MLK__shift { display: none; } } /* Medium breakpoint: larger phones */ @container (max-width: 768px) { .MLK__rows { --_keycap-height: var(--keycap-height, 42px); } .MLK__rows > .MLK__row > div > small { font-size: 14px; } } @media (max-height: 768px) { .MLK__rows { --_keycap-height: var(--keycap-height, 42px); } .MLK__rows > .MLK__row > div > small { font-size: 14px; } } @container (max-width: 1444px) { .MLK__rows .if-wide { display: none; } } @media (prefers-color-scheme: dark) { .ML__keyboard { --_accent-color: var(--keyboard-accent-color, #0b5c9c); --_background: var(--keyboard-background, #151515); --_border: var(--keyboard-border, transparent); --_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8); --_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030); --keyboard-toolbar-background-hover: #303030; --_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030); --_keycap-background: var(--keycap-background, #1f2022); --_keycap-background-hover: var(--keycap-background-hover, #2f3032); --_keycap-border: var(--_keycap-border, transparent); --_keycap-border-bottom: var(--_keycap-border-bottom, transparent); --_keycap-text: var(--keycap-text, #e3e4e8); --_keycap-secondary-background: var(--keycap-secondary-background, #3d4144); --_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154); --_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee); --keycap-secondary-border: transparent; --keycap-secondary-border-bottom: transparent; --_keycap-secondary-border: var(--keycap-secondary-border, transparent); --_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent); --_variant-panel-background: var(--variant-panel-background, #303030); --_variant-keycap-text-active: var(--variant-keycap-text-active, #fff); } } /* Same as the media query, but with a class */ [theme='dark'] .ML__keyboard { --_accent-color: var(--keyboard-accent-color, #0b5c9c); --_background: var(--keyboard-background, #151515); --_border: var(--keyboard-border, transparent); --_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8); --_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030); --keyboard-toolbar-background-hover: #303030; --_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030); --_keycap-background: var(--keycap-background, #1f2022); --_keycap-background-hover: var(--keycap-background-hover, #2f3032); --_keycap-border: var(--_keycap-border, transparent); --_keycap-border-bottom: var(--_keycap-border-bottom, transparent); --_keycap-text: var(--keycap-text, #e3e4e8); --_keycap-secondary-background: var(--keycap-secondary-background, #3d4144); --_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154); --_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee); --keycap-secondary-border: transparent; --keycap-secondary-border-bottom: transparent; --_keycap-secondary-border: var(--keycap-secondary-border, transparent); --_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent); --_variant-panel-background: var(--variant-panel-background, #303030); --_variant-keycap-text-active: var(--variant-keycap-text-active, #fff); } [theme='light'] .ML__keyboard { --_accent-color: var(--keyboard-accent-color, #0c75d8); --_background: var(--keyboard-background, #cacfd7); --_border: var(--keyboard-border, #ddd); --_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f); --_toolbar-background: var(--keyboard-toolbar-background, transparent); --_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee); --_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent); --_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff); --_keycap-background: var(--keycap-background, white); --_keycap-background-hover: var(--keycap-background-hover, #f5f5f7); --_keycap-background-active: var(--keycap-background-active, var(--_accent-color)); --_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color)); --_keycap-border: var(--_keycap-border, #e5e6e9); --_keycap-border-bottom: var(--_keycap-border-bottom, #8d8f92); --_keycap-text: var(--keycap-text, #000); --_keycap-text-active: var(--keycap-text-active, #fff); --_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text)); --_keycap-text-pressed: var(--keycap-text-pressed, #fff); --_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color)); --_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8); --_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795); --_keycap-secondary-text: var(--keycap-secondary-text, #060707); --_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0); --_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6); --_variant-panel-background: var(--variant-panel-background, #f0f0f0); --_variant-keycap-text: var(--variant-keycap-textvar, var(--_keycap-text)); --_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active)); --_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color)); } `;var Y0=`:host { --primary-color: #5898ff; --primary-color-dimmed: #c0c0f0; --primary-color-dark: var(--blue-500); --primary-color-light: var(--blue-100); --primary-color-reverse: #ffffff; --secondary-color: #ff8a65; --secondary-color-dimmed: #f0d5c5; --secondary-color-dark: var(--orange-500); --secondary-color-light: var(--orange-100); --secondary-color-reverse: #ffffff; --link-color: #5898ff; --link-color-dimmed: #c5c5c5; --link-color-dark: #121212; --link-color-light: #e2e2e2; --link-color-reverse: #ffffff; --semantic-blue: var(--blue-700); --semantic-red: var(--red-400); --semantic-orange: var(--orange-400); --semantic-green: var(--green-700); --neutral-100: #f5f5f5; --neutral-200: #eeeeee; --neutral-300: #e0e0e0; --neutral-400: #bdbdbd; --neutral-500: #9e9e9e; --neutral-600: #757575; --neutral-700: #616161; --neutral-800: #424242; --neutral-900: #212121; --red-25: #fff8f7; --red-50: #fff1ef; --red-100: #ffeae6; --red-200: #ffcac1; --red-300: #ffa495; --red-400: #ff7865; --red-500: #f21c0d; --red-600: #e50018; --red-700: #d30024; --red-800: #bd002c; --red-900: #a1002f; --orange-25: #fffbf8; --orange-50: #fff7f1; --orange-100: #fff3ea; --orange-200: #ffe1c9; --orange-300: #ffcca2; --orange-400: #ffb677; --orange-500: #fe9310; --orange-600: #f58700; --orange-700: #ea7c00; --orange-800: #dc6d00; --orange-900: #ca5b00; --brown-25: #fff8ef; --brown-50: #fff1df; --brown-100: #ffe9ce; --brown-200: #ebcca6; --brown-300: #cdaf8a; --brown-400: #af936f; --brown-500: #856a47; --brown-600: #7f5e34; --brown-700: #78511f; --brown-800: #6e4200; --brown-900: #593200; --yellow-25: #fffdf9; --yellow-50: #fffcf2; --yellow-100: #fffaec; --yellow-200: #fff2ce; --yellow-300: #ffe8ab; --yellow-400: #ffdf85; --yellow-500: #ffcf33; --yellow-600: #f1c000; --yellow-700: #dfb200; --yellow-800: #c9a000; --yellow-900: #ad8a00; --lime-25: #f4ffee; --lime-50: #e9ffdd; --lime-100: #ddffca; --lime-200: #a8fb6f; --lime-300: #94e659; --lime-400: #80d142; --lime-500: #63b215; --lime-600: #45a000; --lime-700: #268e00; --lime-800: #007417; --lime-900: #005321; --green-25: #f5fff5; --green-50: #ebffea; --green-100: #e0ffdf; --green-200: #a7ffa7; --green-300: #5afa65; --green-400: #45e953; --green-500: #17cf36; --green-600: #00b944; --green-700: #00a34a; --green-800: #008749; --green-900: #00653e; --teal-25: #f3ffff; --teal-50: #e6fffe; --teal-100: #d9fffe; --teal-200: #8dfffe; --teal-300: #57f4f4; --teal-400: #43e5e5; --teal-500: #17cfcf; --teal-600: #00c2c0; --teal-700: #00b5b1; --teal-800: #00a49e; --teal-900: #009087; --cyan-25: #f7fcff; --cyan-50: #eff8ff; --cyan-100: #e7f5ff; --cyan-200: #c2e6ff; --cyan-300: #95d5ff; --cyan-400: #61c4ff; --cyan-500: #13a7ec; --cyan-600: #069eda; --cyan-700: #0095c9; --cyan-800: #0088b2; --cyan-900: #0a7897; --blue-25: #f7faff; --blue-50: #eef5ff; --blue-100: #e5f1ff; --blue-200: #bfdbff; --blue-300: #92c2ff; --blue-400: #63a8ff; --blue-500: #0d80f2; --blue-600: #0077db; --blue-700: #006dc4; --blue-800: #0060a7; --blue-900: #005086; --indigo-25: #f8f7ff; --indigo-50: #f1efff; --indigo-100: #eae7ff; --indigo-200: #ccc3ff; --indigo-300: #ac99ff; --indigo-400: #916aff; --indigo-500: #63c; --indigo-600: #5a21b2; --indigo-700: #4e0b99; --indigo-800: #3b0071; --indigo-900: #220040; --purple-25: #fbf7ff; --purple-50: #f8f0ff; --purple-100: #f4e8ff; --purple-200: #e4c4ff; --purple-300: #d49aff; --purple-400: #c36aff; --purple-500: #a219e6; --purple-600: #9000c4; --purple-700: #7c009f; --purple-800: #600073; --purple-900: #3d0043; --magenta-25: #fff8fb; --magenta-50: #fff2f6; --magenta-100: #ffebf2; --magenta-200: #ffcddf; --magenta-300: #ffa8cb; --magenta-400: #ff7fb7; --magenta-500: #eb4799; --magenta-600: #da3689; --magenta-700: #c82179; --magenta-800: #b00065; --magenta-900: #8a004c; } @media (prefers-color-scheme: dark) { :host { --semantic-blue: var(--blue-700); --semantic-red: var(--red-400); --semantic-orange: var(--orange-400); --semantic-green: var(--green-700); --semantic-bg-blue: var(--blue-25); --semantic-bg-red: var(--red-25); --semantic-bg-orange: var(--orange-25); --semantic-bg-green: var(--green-25); --neutral-100: #121212; --neutral-200: #424242; --neutral-300: #616161; --neutral-400: #757575; --neutral-500: #9e9e9e; --neutral-600: #bdbdbd; --neutral-700: #e0e0e0; --neutral-800: #eeeeee; --neutral-900: #f5f5f5; } } :host([theme='dark']) { --semantic-blue: var(--blue-700); --semantic-red: var(--red-400); --semantic-orange: var(--orange-400); --semantic-green: var(--green-700); --semantic-bg-blue: var(--blue-25); --semantic-bg-red: var(--red-25); --semantic-bg-orange: var(--orange-25); --semantic-bg-green: var(--green-25); --neutral-100: #121212; --neutral-200: #424242; --neutral-300: #616161; --neutral-400: #757575; --neutral-500: #9e9e9e; --neutral-600: #bdbdbd; --neutral-700: #e0e0e0; --neutral-800: #eeeeee; --neutral-900: #f5f5f5; } /* @media (prefers-color-scheme: dark) { :host { --label-color: #fff; --active-label-color: #000; --menu-bg: #525252; --active-bg: #5898ff; --active-bg-dimmed: #5c5c5c; } } */ :host { --ui-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; --ui-font-size: 14px; --ui-line-height: 1.5; --ui-letter-spacing: 0.007em; --mono-font-family: 'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono', 'Source Code Pro', Menlo, Monaco, 'Courier New', monospace; --ui-layer-1: var(--neutral-100); --ui-layer-2: var(--neutral-200); --ui-layer-3: var(--neutral-300); --ui-layer-4: var(--neutral-400); --ui-layer-5: var(--neutral-500); --ui-layer-6: var(--neutral-600); --ui-border-color: var(--primary-color); --ui-border-radius: 4px; --ui-text: var(--neutral-900); --ui-text-secondary: var(--neutral-700); --ui-text-placeholder: var(--neutral-500); --ui-text-muted: var(--neutral-300); /** A field is a UI element in which a user can type data, for * example an input or textarea element. */ --ui-field-bg: var(--neutral-100); --ui-field-bg-hover: var(--neutral-100); --ui-field-bg-disabled: var(--neutral-300); --ui-field-bg-invalid: var(--red-100); --ui-field-bg-focus: var(--neutral-100); --ui-field-border: 0.5px solid var(--border-color); --ui-field-border-hover: 0.5px solid var(--border-color); --ui-field-border-disabled: 0.5px solid var(--border-color); --ui-field-border-invalid: 0.5px solid var(--border-color); --ui-field-border-focus: 0.5px solid var(--border-color); --ui-menu-bg: var(--neutral-100); --ui-menu-text: var(--neutral-900); --ui-menu-bg-hover: var(--neutral-200); --ui-menu-text-hover: var(--neutral-900); /** The \`active\` state is used for the state of menu items * when they are selected. */ --ui-menu-bg-active: var(--primary-color); --ui-menu-text-active: var(--primary-color-reverse); /** The \`active-muted\` set is used for the state of * submenus when they are open. */ --ui-menu-bg-active-muted: var(--neutral-300); --ui-menu-text-active-muted: var(--neutral-900); /* --ui-menu-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.302), 0 2px 6px 2px rgba(60, 64, 67, 0.149); */ --ui-menu-shadow: 0 0 2px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.2); --ui-menu-divider: 0.5px solid #c7c7c7; /* var(--neutral-300); */ --ui-menu-z-index: 10000; --page-bg: var(--neutral-100); --content-bg: var(--neutral-200); } @media (prefers-color-scheme: dark) { :host { --ui-menu-bg: var(--neutral-200); } } :host([theme='dark']) { --ui-menu-bg: var(--neutral-200); } /* PingFang SC is a macOS font. Microsoft Yahei is a Windows font. Noto is a Linux/Android font. */ :lang(zh-cn), :lang(zh-sg), :lang(zh-my), :lang(zh) { --ui-font-family: -apple-system, system-ui, 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans CJK SC', 'Noto Sans SC', 'Noto Sans', 'Microsoft Yahei UI', 'Microsoft YaHei New', 'Microsoft Yahei', '\u5FAE\u8F6F\u96C5\u9ED1', SimSun, '\u5B8B\u4F53', STXihei, '\u534E\u6587\u7EC6\u9ED1', sans-serif; } :lang(zh-tw), :lang(zh-hk), :lang(zh-mo) { --ui-font-family: -apple-system, system-ui, 'Noto Sans', 'Microsoft JhengHei UI', 'Microsoft JhengHei', '\u5FAE\u8EDF\u6B63\u9ED1\u9AD4', '\u65B0\u7D30\u660E\u9AD4', 'PMingLiU', '\u7D30\u660E\u9AD4', 'MingLiU', sans-serif; } :lang(ja), :lang(ja-jp), :lang(ja-jp-mac) { --ui-font-family: -apple-system, system-ui, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans CJK JP', 'Noto Sans JP', 'Noto Sans', '\u6E38\u30B4\u30B7\u30C3\u30AF', '\u6E38\u30B4\u30B7\u30C3\u30AF\u4F53', YuGothic, 'Yu Gothic', '\u30E1\u30A4\u30EA\u30AA', Meiryo, '\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF', 'MS PGothic', sans-serif; } :lang(ko), :lang(ko-kr), :lang(ko-kr-std) { --ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR', 'Noto Sans', 'Malgun Gothic', '\uB9D1\uC740 \uACE0\uB515', 'Apple SD Gothic Neo', '\uC560\uD50C SD \uC0B0\uB3CC\uACE0\uB515 Neo', 'Apple SD \uC0B0\uB3CC\uACE0\uB515 Neo', '\uB3CB\uC6C0', Dotum, sans-serif; } :lang(ko-kr-apple) { --ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR', 'Noto Sans', 'Apple SD Gothic Neo', '\uC560\uD50C SD \uC0B0\uB3CC\uACE0\uB515 Neo', 'Apple SD \uC0B0\uB3CC\uACE0\uB515 Neo', '\uB3CB\uC6C0', Dotum, sans-serif; } :lang(zh-cn), :lang(zh-sg), :lang(zh-my), :lang(zh), :lang(zh-tw), :lang(zh-hk), :lang(zh-mo), :lang(ja), :lang(ja-jp), :lang(ja-jp-mac), :lang(ko), :lang(ko-kr), :lang(ko-kr-std), :lang(ko-kr-apple) { --ui-font-size: 1rem; --ui-line-height: 1.7; --ui-letter-spacing: 0; } :dir(rtl) { --ui-line-height: auto; --ui-letter-spacing: 0; } `;var Q0=`.ui-menu *, .ui-menu ::before, .ui-menu ::after { box-sizing: border-box; } .ui-menu { display: none; color-scheme: light dark; -webkit-user-select: none; /* Important: Safari iOS doesn't respect user-select */ user-select: none; cursor: default; -webkit-touch-callout: none; -webkit-tap-highlight-color: rgba(0 0 0 0); --active-label-color: #fff; /* ui-menu-text-active */ --label-color: #121212; /* ui-menu-text */ --menu-bg: #e2e2e2; /* ui-menu-background */ --active-bg: #5898ff; /* ui-menu-background-active */ --active-bg-dimmed: #c5c5c5; /* ui-menu-background-active-muted */ } /** Use the :where pseudo selector to make the specificity of the * selector 0, so that it can be overridden by the user. */ :where(.ui-menu-container) { position: absolute; overflow: visible; width: auto; height: auto; z-index: 10000; border-radius: 8px; background: var(--ui-menu-bg); box-shadow: var(--ui-menu-shadow); list-style: none; padding: 6px 0 6px 0; margin: 0; user-select: none; cursor: default; color: var(--ui-menu-text); font-weight: normal; font-style: normal; text-shadow: none; text-transform: none; letter-spacing: 0; outline: none; opacity: 1; /* The [popover] elements have a 1px solid black border. Ugh. */ border: none; width: fit-content; height: fit-content; } :where(.ui-menu-container > li) { display: flex; flex-flow: row; align-items: center; padding: 1px 7px 1px 7px; margin-top: 0; margin-left: 6px; margin-right: 6px; border-radius: 4px; white-space: nowrap; position: relative; outline: none; fill: currentColor; user-select: none; cursor: default; text-align: left; color: inherit; font-family: var(--ui-font-family); font-size: var(--ui-font-size); line-height: var(--ui-line-height); letter-spacing: var(--ui-letter-spacing); } :where(.ui-menu-container > li > .label) { display: flex; align-items: center; justify-content: space-between; appearance: none; background: none; outline: none; width: 100%; margin: 0; padding: 1px 2px 1px 1px; overflow: visible; border: 1px solid transparent; white-space: nowrap; text-align: start; align-content: center; } :where(.ui-menu-container > li:has(.heading)) { margin-top: 0.5em; } :where(.ui-menu-container > li > .label.heading) { font-weight: bold; opacity: 0.4; } :where(.ui-menu-container > li.indent > .label) { margin-inline-start: 12px; } :where(.ui-menu-container > li > .label.indent) { margin-inline-start: 12px; } :where(.ui-menu-container > li[role='divider']) { border-bottom: 1px solid var(--ui-menu-divider); border-radius: 0; padding: 0; margin-left: 15px; margin-right: 15px; padding-top: 5px; margin-bottom: 5px; width: calc(100% - 30px); /** 100% - (margin-left + margin-right) */ } :where(.ui-menu-container > li[aria-disabled='true']) { opacity: 0.5; } :where(.ui-menu-container > li.active) { background: var(--ui-menu-bg-active); background: -apple-system-control-accent; color: var(--ui-menu-text-active); } :where(.ui-menu-container > li.active.is-submenu-open) { background: var(--ui-menu-bg-active-muted); color: inherit; } :where(.ui-menu-container > li[aria-haspopup='true'] > .label) { padding-inline-end: 0; } :where(.ui-menu-container > li[aria-haspopup='true'].active::after) { color: var(--ui-menu-text-active); } /** Keyboard shortcut */ :where(.ui-menu-container > li > kbd) { font-family: var(--ui-font-family); margin-inline-start: 12px; opacity: 0.4; } :where(.ui-menu-container > li.active > kbd) { opacity: 0.85; } .ui-trailing-chevron { display: flex; margin-inline-start: 24px; width: 10px; height: 10px; margin-bottom: 4px; } .ui-trailing-chevron:dir(rtl) { transform: scaleX(-1); } .ui-checkmark { display: flex; margin-inline-end: -11px; margin-inline-start: -4px; margin-top: 2px; width: 16px; height: 16px; } .ui-mixedmark { display: flex; margin-inline-end: -11px; margin-inline-start: -4px; margin-top: 2px; width: 16px; height: 16px; } `;var Rr;function Nt(t){let e="";switch(t){case"mathfield-element":e=` :host { display: inline-block; background-color: field; color: fieldtext; border-width: 1px; border-style: solid; border-color: #acacac; border-radius: 2px;} :host([hidden]) { display: none; } :host([disabled]), :host([disabled]:focus), :host([disabled]:focus-within) { outline: none; opacity: .5; } :host(:focus), :host(:focus-within) { outline: Highlight auto 1px; /* For Firefox */ outline: -webkit-focus-ring-color auto 1px; } :host([readonly]:focus), :host([readonly]:focus-within), :host([read-only]:focus), :host([read-only]:focus-within) { outline: none; }`;break;case"core":e=j0;break;case"mathfield":e=U0;break;case"environment-popover":e=J0;break;case"suggestion-popover":e=G0;break;case"keystroke-caption":e=X0;break;case"virtual-keyboard":e=Z0;break;case"ui":e=Y0;break;case"menu":e=Q0;break;default:}return e}function or(t){return Rr||(Rr={}),Rr[t]||(Rr[t]=new CSSStyleSheet,Rr[t].replaceSync(Nt(t))),Rr[t]}var zt;function We(t){var e;try{if(!("adoptedStyleSheets"in document)){if(window.document.getElementById(`mathlive-style-${t}`))return;let r=window.document.createElement("style");r.id=`mathlive-style-${t}`,r.append(window.document.createTextNode(Nt(t))),window.document.head.appendChild(r);return}if(zt||(zt={}),((e=zt[t])!=null?e:0)!==0)zt[t]+=1;else{let r=or(t);document.adoptedStyleSheets=[...document.adoptedStyleSheets,r],zt[t]=1}}catch(r){console.error("Error injecting stylesheet",t,r)}}function nt(t){if("adoptedStyleSheets"in document&&zt!=null&&zt[t]&&(zt[t]-=1,zt[t]<=0)){let e=Rr[t];document.adoptedStyleSheets=document.adoptedStyleSheets.filter(r=>r!==e)}}var Ir=class t extends y{constructor(e){var r;super(g(p({},e),{type:"accent",body:(r=e.body)!=null?r:void 0})),e.accentChar?this.accent=e.accentChar:this.svgAccent=e==null?void 0:e.svgAccent,this.skipBoundary=!0,this.captureSelection=!0}static fromJson(e){return new t(e)}toJson(){return g(p({},super.toJson()),{accentChar:this.accent,svgAccent:this.svgAccent})}render(e){var c;let r=new K({parent:e,mathstyle:"cramp"},this.style),i=(c=y.createBox(r,this.body))!=null?c:new w("\u25A1",{style:this.style}),n=0;!this.hasEmptyBranch("body")&&this.body.length===2&&this.body[1].isCharacterBox()&&(n=i.skew);let o=Math.min(i.height,Je),a;if(this.svgAccent)a=Gi(this.svgAccent),o=r.metrics.bigOpSpacing1-o;else if(this.accent){let u=new w(this.accent,{fontFamily:"Main-Regular"});u.italic=0;let m=this.accent===8407||this.accent===8411||this.accent===8412?" ML__accent-combining-char":"";a=new w(u,{classes:"ML__accent-body"+m})}let s=(i.width-a.width)/2+i.left+2*n;a=new te({shift:0,children:[{box:new w(i)},-o,{box:a,marginLeft:s,classes:["ML__center"]}]});let l=new w(a,{type:"ord"});return this.caret&&(l.caret=this.caret),this.bind(r,l.wrap(r)),this.attachSupsub(r,{base:l})}};var en={"(":")","{":"}","[":"]","|":"|","\\lbrace":"\\rbrace","\\lparen":"\\rparen","\\{":"\\}","\\langle":"\\rangle","\\lfloor":"\\rfloor","\\lceil":"\\rceil","\\vert":"\\vert","\\lvert":"\\rvert","\\Vert":"\\Vert","\\lVert":"\\rVert","\\lbrack":"\\rbrack","\\ulcorner":"\\urcorner","\\llcorner":"\\lrcorner","\\lgroup":"\\rgroup","\\lmoustache":"\\rmoustache"},tn=Object.fromEntries(Object.entries(en).map(([t,e])=>[e,t]));function Ya(t){var e;return(e={"[":91,"]":93,"(":40,")":41,"\\mid":8739,"|":8739,"\u2223":8739,"\u2225":8741,"\\|":8739,"\\{":123,"\\}":125,"\\lbrace":123,"\\rbrace":125,"\\lparen":40,"\\rparen":41,"\\lbrack":91,"\\rbrack":93,"\\vert":8739,"\\lvert":8739,"\\mvert":8739,"\\rvert":8739,"\\Vert":8741,"\\lVert":8741,"\\mVert":8741,"\\rVert":8741,"\\parallel":8741,"\\shortparallel":8741,"\\langle":10216,"\\rangle":10217,"\\lfloor":8970,"\\rfloor":8971,"\\lceil":8968,"\\rceil":8969,"\\ulcorner":9484,"\\urcorner":9488,"\\llcorner":9492,"\\lrcorner":9496,"\\lgroup":10222,"\\rgroup":10223,"\\lmoustache":9136,"\\rmoustache":9137,"\\surd":8730}[t])!=null?e:t.codePointAt(0)}function Vf(t,e,r,i){var a;let o=new w(Ya(t),{fontFamily:"Main-Regular",isSelected:i.isSelected,classes:"ML__small-delim "+((a=i.classes)!=null?a:"")}).wrap(e);return r&&o.setTop((1-e.scalingFactor)*Pe),o}function ep(t,e,r,i,n){var s,l;let o=new K({parent:i,mathstyle:"textstyle"},n==null?void 0:n.style),a=new w(Ya(t),{fontFamily:`Size${e}-Regular`,isSelected:n.isSelected,classes:((s=n.classes)!=null?s:"")+` ML__delim-size${e}`,type:(l=n.type)!=null?l:"ignore"}).wrap(o);return r&&a.setTop((1-o.scalingFactor)*Pe),a}function tp(t,e,r,i,n){var j;let o,a,s,l;o=s=l=Ya(t),a=null;let c="Size1-Regular";t==="\\vert"||t==="\\lvert"||t==="\\rvert"||t==="\\mvert"||t==="\\mid"?s=o=l=8739:t==="\\Vert"||t==="\\lVert"||t==="\\rVert"||t==="\\mVert"||t==="\\|"?s=o=l=8741:t==="\\uparrow"?s=l=9168:t==="\\Uparrow"?s=l=8214:t==="\\downarrow"?o=s=9168:t==="\\Downarrow"?o=s=8214:t==="\\updownarrow"?(o=8593,s=9168,l=8595):t==="\\Updownarrow"?(o=8657,s=8214,l=8659):t==="["||t==="\\lbrack"?(o=9121,s=9122,l=9123,c="Size4-Regular"):t==="]"||t==="\\rbrack"?(o=9124,s=9125,l=9126,c="Size4-Regular"):t==="\\lfloor"||t==="\u230A"?(s=o=9122,l=9123,c="Size4-Regular"):t==="\\lceil"||t==="\u2308"?(o=9121,s=l=9122,c="Size4-Regular"):t==="\\rfloor"||t==="\u230B"?(s=o=9125,l=9126,c="Size4-Regular"):t==="\\rceil"||t==="\u2309"?(o=9124,s=l=9125,c="Size4-Regular"):t==="("||t==="\\lparen"?(o=9115,s=9116,l=9117,c="Size4-Regular"):t===")"||t==="\\rparen"?(o=9118,s=9119,l=9120,c="Size4-Regular"):t==="\\{"||t==="\\lbrace"?(o=9127,a=9128,l=9129,s=9130,c="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(o=9131,a=9132,l=9133,s=9130,c="Size4-Regular"):t==="\\lgroup"||t==="\u27EE"?(o=9127,l=9129,s=9130,c="Size4-Regular"):t==="\\rgroup"||t==="\u27EF"?(o=9131,l=9133,s=9130,c="Size4-Regular"):t==="\\lmoustache"||t==="\u23B0"?(o=9127,l=9133,s=9130,c="Size4-Regular"):t==="\\rmoustache"||t==="\u23B1"?(o=9131,l=9129,s=9130,c="Size4-Regular"):t==="\\surd"?(o=57345,l=9143,s=57344,c="Size4-Regular"):t==="\\ulcorner"?(o=9484,s=l=32):t==="\\urcorner"?(o=9488,s=l=32):t==="\\llcorner"?(l=9492,s=o=32):t==="\\lrcorner"&&(o=9496,s=o=32);let u=Cr(o,c),m=u.height+u.depth,d=Cr(s,c),h=d.height+d.depth,f=Cr(l,c),x=f.height+f.depth,_=0,b=1;if(a!==null){let D=Cr(a,c);_=D.height+D.depth,b=2}let v=m+x+_,k=Math.max(0,Math.ceil((e-v)/(b*h))),A=v+k*b*h,C=Pe;r&&(C=C*i.scalingFactor);let T=A/2-C,S=.008,B=[];B.push({box:new w(l,{fontFamily:c})}),B.push(-S);let $=new w(s,{fontFamily:c});if(a===null)for(let D=0;D","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Hf=[0,1.2,1.8,2.4,3];function np(t,e,r,i){return t===void 0||t==="."?ar(r,i.classes):(t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle"),rp.has(t)||ip.has(t)?ep(t,e,!1,r,i):qf.has(t)?tp(t,Hf[e],!1,r,i):(""+t,null))}var Wf=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Uf=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"stack"}],jf=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];function Jf(t){return t.type==="small"?"Main-Regular":t.type==="large"?"Size"+t.size+"-Regular":(t.type,"Size4-Regular")}function Gf(t,e,r,i){let n={"-4":0,"-3":1,0:2}[i.mathstyle.sizeDelta];for(let o=n;oe)return r[o]}return r[r.length-1]}function rn(t,e,r,i,n,o){if(!e||e.length===0||e===".")return ar(n);e==="<"||e==="\\lt"?e="\\langle":(e===">"||e==="\\gt")&&(e="\\rangle");let a;ip.has(e)?a=Wf:rp.has(e)?a=jf:a=Uf;let s=Gf(Ya(e),r,a,n),l=new K({parent:n,mathstyle:s.mathstyle},o==null?void 0:o.style);return s.type==="small"?Vf(e,l,i,g(p({},o),{type:t})):s.type==="large"?ep(e,s.size,i,l,g(p({},o),{type:t})):(s.type,tp(e,r,i,l,g(p({},o),{type:t})))}function ci(t,e,r,i,n,o){if(e===".")return ar(n,o==null?void 0:o.classes);let a=Pe*n.scalingFactor,s=901,l=5/Pt,c=Math.max(r-a,i+a),u=Math.max(c/500*s,2*c-l);return rn(t,e,u,!0,n,o)}function ar(t,e){let r=new w(null,{classes:" ML__nulldelimiter "+(e!=null?e:""),type:"ignore"});return r.width=t.getRegisterAsEm("nulldelimiterspace"),r.wrap(new K({parent:t,mathstyle:"textstyle"}))}var Le=class t extends y{constructor(e){var r;super({type:"placeholder",command:"\\placeholder",mode:(r=e==null?void 0:e.mode)!=null?r:"math",style:e==null?void 0:e.style}),this.captureSelection=!0}static fromJson(e){return new t(e)}toJson(){return super.toJson()}render(e){let r;return this.value=e.placeholderSymbol,typeof e.renderPlaceholder=="function"?r=e.renderPlaceholder(e):r=this.createBox(e),this.caret&&(r.classes+=" ML__placeholder-selected"),r}_serialize(e){return e.skipPlaceholders?"":"\\placeholder{}"}};var op=["matrix","matrix*","pmatrix","pmatrix*","bmatrix","bmatrix*","Bmatrix","Bmatrix*","vmatrix","vmatrix*","Vmatrix","Vmatrix*"],sc=["cases","dcases","rcases"],ap=["align","align*","aligned","gather","gather*","gathered","split"],Xf=["array","subequations","eqnarray"];function sp(t){return ap.includes(t)||sc.includes(t)||sc.includes(t)||op.includes(t)||Xf.includes(t)}function Qa(t){return op.includes(t)}function lp(t){return sc.includes(t)}function cp(t){return ap.includes(t)}function Zf(t,e,r){let i=0;for(let c of r.columns)"align"in c&&(i+=1);i=Math.max(i,r.minColumns);let n=0,o=[];for(let c of e){n=Math.max(n,Math.min(c.length,i));let u=0;for(;u0&&o[o.length-1].length===1&&tg(o[o.length-1][0])&&o.pop();let a=[];for(let c of o){if(c.length!==n)for(let u=c.length;u0&&t.every(e=>e.type==="first")}function Qf(t,e,r){let i=new w(null,{classes:"ML__empty-line-anchor"}),n=t[0];n&&(n.id||(n.id=e.makeID()),i.atomID=n.id),i.setStyle("display","inline-block"),i.setStyle("width",0),i.setStyle("position","relative"),i.setStyle("height",Math.max(0,r.height+r.depth),"em"),i.setStyle("vertical-align",-r.depth,"em"),i.height=r.height,i.depth=r.depth;let o=t.find(a=>a.caret);return o!=null&&o.caret&&(i.caret=o.caret),t.some(a=>a.isSelected)&&i.selected(!0),i}function eg(t,e){return t.length===0?[new y({type:"first",mode:e})]:t[0].type!=="first"?[new y({type:"first",mode:e}),...t]:(t.slice(1).some(r=>r.type==="first"),t)}function tg(t){return t.length===1&&t[0].type==="first"}var z=class t extends y{get isMultiline(){let e=this.environmentName;return["lines","multline","multline*","align","split","gather","gathered"].includes(e)}constructor(e,r,i,n={}){var o,a,s,l;if(super({type:"array",isRoot:n.isRoot}),this.environmentName=e,n.columns)n.columns.length===0?this.colFormat=[{align:"l"}]:this.colFormat=[...n.columns];else if(n.minColumns){let c=[];for(let u=0;ur.map(i=>i.map(n=>n.toJson()))),rowGaps:this.rowGaps,columns:this.colFormat,colSeparationType:this.colSeparationType,minColumns:this.minColumns,minRows:this.minRows,maxRows:this.maxRows});return this.arraystretch!==void 0&&(e.arraystretch=this.arraystretch),this.arraycolsep!==void 0&&(e.arraycolsep=this.arraycolsep),this.leftDelim&&(e.leftDelim=this.leftDelim),this.rightDelim&&(e.rightDelim=this.rightDelim),this.isRoot&&(e.isRoot=!0),e.minColumns=this.minColumns,e.minRows=this.minRows,e.maxRows=this.maxRows,this.mathstyleName&&(e.mathstyleName=this.mathstyleName),this.classes.length>0&&(e.classes=this.classes),e}branch(e){var r;if(Ge(e))return(r=this._rows[e[0]][e[1]])!=null?r:void 0}createBranch(e){var r;return Ge(e)?(this.isDirty=!0,(r=this.branch(e))!=null?r:[]):[]}get rowCount(){return this._rows.length}get colCount(){return this._rows[0].length}get maxColumns(){return this.colFormat.filter(e=>!!e.align).length}removeBranch(e){if(Kr(e))return super.removeBranch(e);let[r,...i]=this.branch(e);return r.type,this._rows[e[0]][e[1]]=void 0,i.forEach(n=>{n.parent=void 0,n.parentBranch=void 0}),this.isDirty=!0,i}get hasChildren(){return this.children.length>0}get children(){let e=[];for(let r of this._rows)for(let i of r)if(i)for(let n of i)e.push(...n.children),e.push(n);return[...e,...super.children]}render(e){var R,N,j,D,H,ie;let r=new K({parent:e,mathstyle:this.mathstyleName},this.style),i=r.getRegisterAsEm("arrayrulewidth"),n=r.getRegisterAsEm("arraycolsep"),o=r.getRegisterAsEm("doublerulesep"),a=(N=(R=this.arraystretch)!=null?R:r.getRegisterAsNumber("arraystretch"))!=null?N:1,s=typeof this.arraycolsep=="number"?this.arraycolsep:n;this.colSeparationType==="small"&&(s=.2778*(new K({parent:e,mathstyle:"scriptstyle"}).scalingFactor/e.scalingFactor));let l=a*C0,c=.7*l,u=.3*l,m=0,d=[],h=0,f=this._rows.length;for(let X=0;X0&&(Se+=u,At=Math.max(At,Se),Se=0),X0&&_.push(new te({individualShift:be}))}let b=[],v=!1,k=!1,A=0,C=!this.leftDelim,{colFormat:T}=this;for(let X of T){if("align"in X&&A>=_.length)break;if("align"in X)v?b.push(ts(2*s)):(k||C)&&b.push(ts(s)),b.push(new w(_[A],{classes:"col-align-"+X.align})),A++,v=!0,k=!1,C=!1;else if("gap"in X){if(typeof X.gap=="number")b.push(ts(X.gap));else{let be=rg(e,d,x,X.gap);be&&b.push(be)}v=!1,k=!1,C=!1}else if("separator"in X){let be=new w(null,{classes:"ML__vertical-separator"});be.height=m,be.setStyle("height",m,"em"),be.setStyle("border-right",`${i}em ${X.separator} currentColor`),be.setStyle("vertical-align",-(m-x),"em");let ye=0;k?ye=o-i:v&&(ye=s-i),be.left=ye,b.push(be),v=!1,k=!0,C=!1}}v&&!this.rightDelim&&b.push(ts(s));let S=new w(b,{classes:["ML__mtable",...this.classes].join(" ")});if(this.environmentName==="array"&&!this.isMultiline&&(S.height=d[0].height,S.depth=m-d[0].height),(!this.leftDelim||this.leftDelim===".")&&(!this.rightDelim||this.rightDelim==="."))return this.caret&&(S.caret=this.caret),this.bind(e,S);let B=S.height,$=S.depth,G=this.bind(e,new w([this.bind(e,ci("open",(H=this.leftDelim)!=null?H:".",B,$,r,{isSelected:this.isSelected})),S,this.bind(e,ci("close",(ie=this.rightDelim)!=null?ie:".",B,$,r,{isSelected:this.isSelected}))],{type:"ord"}));return G?(G.setStyle("display","inline-block"),this.caret&&(G.caret=this.caret),this.bind(e,this.attachSupsub(e,{base:G}))):null}_serialize(e){var i;let r=[];if(this.environmentName==="lines"&&this._rows.length>1?r.push("\\displaylines{"):this.environmentName!=="lines"&&r.push(`\\begin{${this.environmentName}}`),this.environmentName==="array"){if(r.push("{"),this.colFormat!==void 0)for(let n of this.colFormat)"align"in n&&typeof n.align=="string"?r.push(n.align):"separator"in n&&n.separator==="solid"?r.push("|"):"separator"in n&&n.separator==="dashed"&&r.push(":");r.push("}")}for(let n=0;n0&&r.push(" & "),r.push(y.serialize(this._rows[n][o],e));if(n1?r.push("}"):this.environmentName!=="lines"&&r.push(`\\end{${this.environmentName}}`),P(r)}forEachCell(e){for(let r=0;ro.type!=="first")];this._rows[e][r]=n,ui(this),this.isDirty=!0}addRowBefore(e){this.type==="array"&&Array.isArray(this._rows),this._rows.splice(e,0,Array.from({length:this.colCount},()=>es(this,!this.isMultiline))),ui(this),this.isDirty=!0}addRowAfter(e){this.type==="array"&&Array.isArray(this._rows),this._rows.splice(e+1,0,Array.from({length:this.colCount},()=>es(this,!this.isMultiline))),ui(this),this.isDirty=!0}removeRow(e){this.type==="array"&&Array.isArray(this._rows)&&this.rowCount>e;let r=this._rows.splice(e,1);for(let i of r)for(let n of i)if(n)for(let o of n)o.parent=void 0,o.parentBranch=void 0;ui(this),this.isDirty=!0}addColumnBefore(e){this.type==="array"&&Array.isArray(this._rows);for(let r of this._rows)r.splice(e,0,es(this));ui(this),this.isDirty=!0}addColumnAfter(e){this.type==="array"&&Array.isArray(this._rows);for(let r of this._rows)r.splice(e+1,0,es(this));ui(this),this.isDirty=!0}addColumn(){this.addColumnAfter(this.colCount-1)}removeColumn(e){this.type==="array"&&Array.isArray(this._rows)&&this.colCount>e;for(let r of this._rows){let i=r.splice(e,1);for(let n of i)if(n)for(let o of n)o.parent=void 0,o.parentBranch=void 0}ui(this),this.isDirty=!0}get cells(){let e=[];for(let r of this._rows)for(let i of r)i&&e.push(i.filter(n=>n.type!=="first"));return e}get rows(){return this._rows}};function es(t,e=!1){let r=new y({type:"first",mode:t.mode});r.parent=t;let i=[r];if(e){let n=new Le;n.parent=t,i.push(n)}return i}function ui(t){for(let e=0;e0?i:0),s.depth=r.depth+o+(i<0?-i:0),s.setStyle("padding-left",o,"em"),s.setStyle("padding-right",o,"em"),s.setStyle("height",Math.floor(100*(r.height+r.depth+2*o+Math.abs(i)))/100,"em"),s.setStyle("margin-top",-o,"em"),s.setStyle("top",Math.floor(100*(r.depth-r.height+2*o-i))/100,"em"),s.setStyle("vertical-align",Math.floor(100*(r.depth+2*o))/100,"em"),this.caret&&(s.caret=this.caret),this.attachSupsub(e,{base:s})}_serialize(e){return e.skipStyles?P([this.bodyToLatex(e),this.supsubToLatex(e)]):super._serialize(e)}};var nn=class t extends y{constructor(e,r){var i;super({type:"composition",mode:(i=r==null?void 0:r.mode)!=null?i:"math",value:e})}static fromJson(e){return new t(e.value,e)}toJson(){return super.toJson()}render(e){let r=new w(this.value,{classes:"ML__composition",type:"composition"});return this.bind(e,r),this.caret&&(r.caret=this.caret),r}_serialize(e){return""}};var ft=class t extends y{constructor(e){super({type:"error",value:e,command:e,mode:"math"}),this.verbatimLatex=e}static fromJson(e){return new t(e.command)}toJson(){return super.toJson()}render(e){let r=this.createBox(e,{classes:"ML__error"});return this.caret&&(r.caret=this.caret),r}};var on=class t extends y{constructor(e,r){super({type:"group",mode:r}),this.body=e,this.boxType=e.length>1?"ord":"ignore",this.skipBoundary=!0,this.displayContainsHighlight=!1,(e==null?void 0:e.length)===1&&e[0].command===","&&(this.captureSelection=!0)}static fromJson(e){return new t(e.body,e.mode)}render(e){let r=y.createBox(e,this.body,{type:this.boxType});return r?(this.caret&&(r.caret=this.caret),this.bind(e,r)):null}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;let r=ne(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,e):`{${this.bodyToLatex(e)}}`}};var J=class t extends y{constructor(e,r,i){super({type:"leftright",style:i.style,displayContainsHighlight:!0}),this.variant=e,this.body=r,this.leftDelim=i.leftDelim,this.rightDelim=i.rightDelim}static fromJson(e){var r;return new t((r=e.variant)!=null?r:"",e.body,e)}toJson(){let e=super.toJson();return this.variant&&(e.variant=this.variant),this.leftDelim&&(e.leftDelim=this.leftDelim),this.rightDelim&&(e.rightDelim=this.rightDelim),e}_serialize(e){var i,n;let r=this.matchingRightDelim();return this.variant==="left...right"?P(["\\left",(i=this.leftDelim)!=null?i:".",this.bodyToLatex(e),"\\right",r]):this.variant==="mleft...mright"?P(["\\mleft",(n=this.leftDelim)!=null?n:".",this.bodyToLatex(e),"\\mright",r]):P([!this.leftDelim||this.leftDelim==="."?"":this.leftDelim,this.bodyToLatex(e),r])}matchingRightDelim(){var r,i;if(this.rightDelim&&this.rightDelim!=="?")return this.rightDelim;let e=(r=this.leftDelim)!=null?r:".";return(i=en[e])!=null?i:e}render(e){var m,d;let r=new K({parent:e},this.style);this.body;let i=new K({parent:e,mathstyle:"textstyle"},this.style),n=(m=y.createBox(r,this.body,{type:"inner"}))!=null?m:new w(null,{type:"inner"}),o=n.height/i.scalingFactor,a=n.depth/i.scalingFactor,s=[];if(this.leftDelim&&s.push(this.bind(i,ci("open",this.leftDelim,o,a,i,{isSelected:this.isSelected,classes:"ML__open"+(this.containsCaret?" ML__contains-caret":""),mode:this.mode,style:this.style}))),n&&(up(n.children,this,r,o,a),s.push(n)),this.rightDelim){let h=this.containsCaret?" ML__contains-caret":"",f=this.rightDelim;f==="?"&&(r.smartFence?(f=this.matchingRightDelim(),h+=" ML__smart-fence__close"):f="."),s.push(this.bind(i,ci("close",f,o,a,i,{isSelected:this.isSelected,classes:h+" ML__close",mode:this.mode,style:this.style})))}let l=this.variant==="mleft...mright",c=this.leftSibling;c&&(!l&&c.isFunction&&(l=!0),!l&&c.type==="subsup"&&((d=c.leftSibling)!=null&&d.isFunction)&&(l=!0));let u=new w(s,{type:l?"close":"inner",classes:"ML__left-right"});return u.setStyle("margin-top",`${-n.depth}em`),u.setStyle("height",`${n.height+n.depth}em`),this.caret&&(u.caret=this.caret),this.bind(r,u.wrap(r))}};function up(t,e,r,i,n){if(t)for(let o=0;or.type!=="first").map(r=>r.toJson())),this.correctness&&(e.correctness=this.correctness),e.locked=this.locked,e}render(e){var C,T;let r=new K({parent:e}),i=r.getRegisterAsEm("fboxsep"),n=i,o=i,a=y.createBox(e,this.body);if(!a)return null;let s=!this.body||this.body.length===0||this.body.every(S=>S.type==="first"),l=s?new Le({mode:this.mode,style:this.style}).render(new K({parent:e,isPhantom:!0})):null,c=(C=l==null?void 0:l.height)!=null?C:r.metrics.xHeight,u=(T=l==null?void 0:l.depth)!=null?T:c/2;a.height||(a.height=s?c:r.metrics.xHeight),a.depth||(a.depth=s?u:r.metrics.defaultRuleThickness);let m=s?u-c:a.depth-a.height;a.setStyle("vertical-align",m,"em"),this.correctness==="correct"?a.setStyle("color","var(--correct-color, var(--ML__correct-color))"):this.correctness==="incorrect"&&a.setStyle("color","var(--incorrect-color, var(--ML__incorrect-color))");let d=new w(a,{type:"ord"});d.height=a.height,d.depth=a.depth,d.setStyle("display","inline-block"),d.setStyle("height",a.height+a.depth,"em"),d.setStyle("vertical-align",-o,"em"),d.setStyle("position","relative"),d.setStyle("z-index",1);let h="ML__prompt ";this.locked?h+=" ML__lockedPromptBox ":h+=" ML__editablePromptBox ",this.correctness==="correct"?h+=" ML__correctPromptBox ":this.correctness==="incorrect"&&(h+=" ML__incorrectPromptBox "),this.containsCaret&&(h+=" ML__focusedPromptBox ");let f=new w(null,{classes:h,attributes:{part:"prompt"}});f.height=d.height+o,f.depth=d.depth+o,f.width=d.width+2*n,f.setStyle("position","absolute"),f.setStyle("z-index",0),f.setStyle("display","block"),f.setStyle("pointer-events","auto");let x=d.height+d.depth+2*o;f.setStyle("height",Math.max(x,.6),"em");let _=d.width+2*n;s&&(_=Math.max(_,3*n||.8)),f.setStyle("width",Math.max(_,.6),"em"),f.setStyle("top",i+o,"em"),s?f.setStyle("left",-1.5*n,"em"):n!==0&&f.setStyle("left",-n,"em");let b="";this.correctness==="incorrect"&&(b+=''),b&&(f.svgOverlay=b);let v=new w([f,d],{classes:"ML__prompt-atom"});d.setStyle("line-height",1),v.setStyle("position","relative"),v.setStyle("display","inline-block"),v.setStyle("line-height",0),v.height=d.height+o+.2,v.depth=d.depth+o,v.left=n,v.right=n,v.setStyle("height",d.height+2*o,"em"),v.setStyle("top",d.depth-d.height-o/2,"em"),v.setStyle("vertical-align",d.depth+o/2,"em"),v.setStyle("margin-left",.5,"em"),v.setStyle("margin-right",.5,"em"),this.caret&&(v.caret=this.caret);let k=this.attachSupsub(e,{base:v}),A=this.bind(r,k);return A&&this.id&&(f.atomID=this.id,d.atomID=this.id,v.atomID=this.id),A}_serialize(e){var n;let r=(n=this.bodyToLatex(e))!=null?n:"";if(e.skipPlaceholders)return r;let i="\\placeholder";return this.placeholderId&&(i+=`[${this.placeholderId}]`),this.correctness==="correct"?i+="[correct]":this.correctness==="incorrect"&&(i+="[incorrect]"),this.locked&&(i+="[locked]"),W(i,r)}};var sr=class t extends y{constructor(e){super({type:"subsup",style:e==null?void 0:e.style}),this.subsupPlacement="auto"}get children(){if(!this._children){let e=[],r=this.branch("subscript");if(r)for(let n of r)e.push(...n.children),e.push(n);let i=this.branch("superscript");if(i)for(let n of i)e.push(...n.children),e.push(n);this._children=e}return this._children}static fromJson(e){let r=new t(e);for(let i of Pr)e[i]&&r.setChildren(e[i],i);return r}render(e){var a;let r=new K({parent:e,isPhantom:!0}),i=this.leftSibling,n=(a=i.render(r))!=null?a:new w(null),o=new w(null);return o.height=n.height,o.depth=n.depth,this.attachSupsub(e,{base:o,isCharacterBox:i.isCharacterBox(),type:"ignore"})}_serialize(e){return this.supsubToLatex(e)}};function ln(t){return t?!/^(<$$>|<$>||<{>|<}>|#[0-9\?]|\\.+)$/.test(t):!1}var is=class{constructor(e,r,i){this.errors=[];this.index=0;this.endCount=0;var n,o,a,s;i!=null||(i={}),this.tokens=e,this.context=r instanceof K&&!(i!=null&&i.parseMode)&&!i.mathstyle?r:new K({from:r,mathstyle:i.mathstyle},i.style),this.args=(n=i.args)!=null?n:void 0,this.smartFence=this.context.smartFence,this.parsingContext={parent:void 0,mathlist:[],style:(o=i.style)!=null?o:{},parseMode:(a=i.parseMode)!=null?a:"math",mathstyle:(s=i.mathstyle)!=null?s:"displaystyle",tabular:!1}}beginContext(e){var n,o,a,s,l,c;if(e!=null&&e.root){this.parsingContext={parent:this.parsingContext.parent,mathlist:[],style:{},parseMode:(n=e==null?void 0:e.mode)!=null?n:"math",mathstyle:(o=e==null?void 0:e.mathstyle)!=null?o:"displaystyle",tabular:(a=e==null?void 0:e.tabular)!=null?a:!1};return}let r=this.parsingContext,i={parent:r,mathlist:[],style:p({},r.style),parseMode:(s=e==null?void 0:e.mode)!=null?s:r.parseMode,mathstyle:(l=e==null?void 0:e.mathstyle)!=null?l:r.mathstyle,tabular:(c=e==null?void 0:e.tabular)!=null?c:!1};this.parsingContext=i}endContext(){this.parsingContext=this.parsingContext.parent}onError(e){this.errors.push(p({before:Er(this.tokens.slice(this.index,this.index+10)),after:Er(this.tokens.slice(Math.max(0,this.index-10),this.index))},e))}get mathlist(){return this.parsingContext.mathlist}set mathlist(e){this.parsingContext.mathlist=e}get parseMode(){return this.parsingContext.parseMode}set parseMode(e){this.parsingContext.parseMode=e}get tabularMode(){return this.parsingContext.tabular}get style(){let e=this.parsingContext;for(;e;){if(e.style)return p({},e.style);e=e.parent}return{}}set style(e){this.parsingContext.style=e}end(){return this.endCount++,this.index>=this.tokens.length||this.endCount>1e3}next(){this.index+=1}get(){return this.endCount=0,this.index0&&(e=this.mathlist[this.mathlist.length-1],e.type==="subsup"||e.subsupPlacement!==void 0)||(e=new sr({style:this.style}),this.mathlist.push(e)),e}hasPattern(e){return e.test(this.tokens[this.index])}hasInfixCommand(){var r;let{index:e}=this;if(e"););}skipUntilToken(e){let r=this.tokens[this.index];for(;r&&r!==e;)r=this.tokens[++this.index];r===e&&this.index++}skipFiller(){for(;this.match("\\relax")||this.match(""););}matchKeyword(e){let r=this.index,i=this.end(),n="";for(;!i;){let a=this.get();ln(a)?(n+=a,i=this.end()||n.length>=e.length):i=!0}let o=e.toUpperCase()===n.toUpperCase();return o||(this.index=r),o}scanString(){let e="";for(;!this.end();){let r=this.peek();if(r==="]")return e;if(r==="")e+=" ";else if(r.startsWith("\\"))this.onError({code:"unexpected-command-in-string"}),e+=r.substring(1);else if(ln(r))e+=r;else return e;this.next()}return e}scanBalancedString(){let e="",r=this.end(),i=1;for(;!r;){let n=this.get();n===""?e+=" ":n==="<{>"?(e+="{",i+=1):n==="<}>"?(i-=1,i>0?e+="}":this.index-=1):n==="<$>"?e+="$":n==="<$$>"?e+="$$":e+=n,r=i===0||this.end()}return e}scanLiteralGroup(){var i;if(!this.match("<{>"))return"";let e="",r=1;for(;r>0&&!this.end();){let n=this.get();n==="<}>"?(r-=1,r>0&&(e+="}")):n==="<{>"?(r+=1,e+="{"):(/\\[a-zA-Z]+$/.test(e)&&/^[a-zA-Z]/.test(n)&&(e+=" "),e+=(i={"":" ","<$$>":"$$","<$>":"$"}[n])!=null?i:n)}return e}scanNumber(e=!0){var l,c;let r=!1,i=this.peek();for(;i===""||i==="+"||i==="-";)this.get(),i==="-"&&(r=!r),i=this.peek();e=!!e;let n=10,o=/\d/;if(this.match("'"))n=8,o=/[0-7]/,e=!0;else if(this.match('"'))n=16,o=/[\dA-F]/,e=!0;else if(this.match("x"))n=16,o=/[\dA-Fa-f]/,e=!0;else if(this.match("`"))return i=this.get(),i?i.length===2&&i.startsWith("\\")?{number:(r?-1:1)*((l=i.codePointAt(1))!=null?l:0),base:"alpha"}:{number:(r?-1:1)*((c=i.codePointAt(0))!=null?c:0),base:"alpha"}:null;let a="";for(;this.hasPattern(o);)a+=this.get();if(!e&&(this.match(".")||this.match(",")))for(a+=".";this.hasPattern(o);)a+=this.get();let s=e?Number.parseInt(a,n):Number.parseFloat(a);return Number.isNaN(s)?null:{number:r?-s:s,base:n===16?"hexadecimal":n===8?"octal":"decimal"}}scanRegister(){var o;let e=this.index,r=this.scanNumber(!1);if(this.skipWhitespace(),this.match("\\relax"))return r;let i=!1;if(r===null)for(;;){let a=this.peek();if(a==="-")i=!i;else if(a!=="+")break;this.next(),this.skipWhitespace()}if(this.match("\\global")){this.skipWhitespace();let a=this.get();return a.startsWith("\\")?r?{register:a,global:!0,factor:(i?-1:1)*r.number}:i?{register:a,global:!0,factor:-1}:{register:a,global:!0}:(this.index=e,null)}let n=this.get();return n!=null&&n.startsWith("\\")?(n=n.substring(1),this.context.registers[n]?!i||r!==null?{register:n,factor:(i?-1:1)*((o=r==null?void 0:r.number)!=null?o:1)}:{register:n}:(this.index=e,null)):(this.index=e,null)}scanValue(){let e=this.scanRegister();if(e)return e;let r=this.index,i=this.scanGlueOrDimen();if(i&&("unit"in i||"glue"in i&&"unit"in i.glue))return i;this.index=r;let n=this.scanNumber();if(n)return n;if(this.end()||!ln(this.peek()))return null;let o=this.scanString();return o.length>0?{string:o}:null}scanDimen(){let e=this.scanNumber(!1);if(e===null)return null;let r=e.number;this.skipWhitespace(),this.matchKeyword("true"),this.skipWhitespace();let i;return this.matchKeyword("pt")?i="pt":this.matchKeyword("mm")?i="mm":this.matchKeyword("cm")?i="cm":this.matchKeyword("ex")?i="ex":this.matchKeyword("px")?i="px":this.matchKeyword("em")?i="em":this.matchKeyword("bp")?i="bp":this.matchKeyword("dd")?i="dd":this.matchKeyword("pc")?i="pc":this.matchKeyword("in")?i="in":this.matchKeyword("mu")&&(i="mu"),i?{dimension:r,unit:i}:{dimension:r}}scanGlueOrDimen(){let e=this.scanDimen();if(e===null)return null;if(this.skipWhitespace(),this.match("\\relax"))return e;let r={glue:e};if(this.matchKeyword("plus")){let i=this.scanDimen();if(i)r.grow=i;else return r}if(this.skipWhitespace(),this.match("\\relax"))return r;if(this.skipWhitespace(),this.matchKeyword("minus")){let i=this.scanDimen();if(i)r.shrink=i;else return r}return!r.grow&&!r.shrink?e:r}scanColspec(){this.skipWhitespace();let e=[];for(;!this.end()&&!(this.peek()==="<}>"||this.peek()==="]");){let r=this.get();r==="c"||r==="r"||r==="l"?e.push({align:r}):r==="|"?e.push({separator:"solid"}):r===":"?e.push({separator:"dashed"}):r==="@"&&(this.match("<{>")&&(this.beginContext({mode:"math"}),e.push({gap:this.scan(i=>i==="<}>")}),this.endContext()),this.match("<}>")||this.onError({code:"unbalanced-braces"}))}return e}scanModeSet(){let e;if(this.match("\\(")&&(e="textstyle"),!e&&this.match("\\[")&&(e="displaystyle"),!e)return null;this.beginContext({mode:"math",mathstyle:e});let r=this.scan(i=>i===(e==="displaystyle"?"\\]":"\\)"));return this.match(e==="displaystyle"?"\\]":"\\)")||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),r}scanModeShift(){let e="";if(this.match("<$>")&&(e="<$>"),!e&&this.match("<$$>")&&(e="<$$>"),!e)return null;this.beginContext({mode:"math",mathstyle:e==="<$>"?"textstyle":"displaystyle"});let r=this.scan(i=>i===e);return this.match(e)||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),r}scanEnvironment(){if(!this.match("\\begin"))return null;let e=this.scanArgument("string");if(!e)return null;let r=Pu(e);if(!r)return this.onError({code:"unknown-environment",arg:e}),null;let i=[];if(r.params)for(let l of r.params)if(l.isOptional)i.push(this.scanOptionalArgument(l.type));else{let c=this.scanArgument(l.type);c||this.onError({code:"missing-argument",arg:e}),i.push(c)}this.beginContext({tabular:r.tabular,root:r.rootOnly});let n=[],o=[],a=[],s=!1;do if(this.end()&&(this.onError({code:"unbalanced-environment",arg:e}),s=!0),!s&&this.match("\\end")&&(this.scanArgument("string")!==e&&this.onError({code:"unbalanced-environment",arg:e}),s=!0),!s)if(this.matchColumnSeparator())a.push(this.mathlist),this.mathlist=[];else if(this.matchRowSeparator()){a.push(this.mathlist),this.mathlist=[];let l=null;this.skipWhitespace(),this.match("[")&&(l=this.scanDimen(),this.skipWhitespace(),this.match("]")),o.push(l!=null?l:{dimension:0}),n.push(a),a=[]}else this.mathlist.push(...this.scan(l=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline"].includes(l)));while(!s);return a.push(this.mathlist),a.length>0&&n.push(a),this.endContext(),r.rootOnly&&(this.index=this.tokens.length),r.createAtom(e,n,o,i,this.context.maxMatrixCols)}scanExpression(){let e=this.mathlist;if(this.mathlist=[],this.parseExpression()){let r=this.mathlist;return this.mathlist=e,r}return this.mathlist=e,null}scan(e){this.beginContext(),e||(e=s=>s==="<}>");let r="",i=null,n=[],o=null;for(;!this.end()&&!e(this.peek());)this.hasInfixCommand()&&!r?(r=this.get(),i=ne(r,"math"),i&&(n=this.scanArguments(i)[1]),o=this.mathlist,this.mathlist=[]):this.parseExpression();let a;return r?(n.unshift(this.mathlist),o&&n.unshift(o),a=[i.createAtom({command:r,args:n,style:this.style,mode:this.parseMode})]):a=this.mathlist,this.endContext(),a}scanGroup(){let e=this.index;if(!this.match("<{>"))return null;let r=this.scan(n=>n==="<}>");if(this.match("<}>")||this.onError({code:"unbalanced-braces"}),r.length===1&&r[0].type==="placeholder")return r[0];let i=new on(r,this.parseMode);return i.verbatimLatex=Er(this.tokens.slice(e,this.index)),i}scanSmartFence(){if(this.skipWhitespace(),!this.match("("))return null;this.beginContext();let e=1;for(;!this.end()&&e!==0;)this.match("(")&&(e+=1),this.match(")")&&(e-=1),e!==0&&this.parseExpression();let r=new J("",this.mathlist,{leftDelim:"(",rightDelim:e===0?")":"?"});return this.endContext(),r}scanDelim(){this.skipWhitespace();let e=this.peek();if(!e)return this.onError({code:"unexpected-end-of-string"}),null;if(!ln(e)&&!e.startsWith("\\"))return null;this.next();let r=ne(e,"math");return r?r.definitionType==="function"&&r.ifMode&&!r.ifMode.includes(this.parseMode)?(this.onError({code:"unexpected-delimiter",arg:e}),null):r.definitionType==="symbol"&&(r.type==="mopen"||r.type==="mclose")||/^(\.|\?|\||<|>|\\vert|\\Vert|\\\||\\surd|\\uparrow|\\downarrow|\\Uparrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\mid|\\mvert|\\mVert)$/.test(e)?e:(this.onError({code:"unexpected-delimiter",arg:e}),null):(this.onError({code:"unknown-command",arg:e}),null)}scanLeftRight(){var o;if(this.match("\\right"))return this.onError({code:"unbalanced-braces"}),new ft("\\right");if(this.match("\\mright"))return this.onError({code:"unbalanced-braces"}),new ft("\\mright");let e="\\right";if(!this.match("\\left")){if(!this.match("\\mleft"))return null;e="\\mright"}let r=this.scanDelim();if(!r)return this.onError({code:"unexpected-delimiter"}),new ft(e==="\\right"?"\\left":"\\mleft");for(this.beginContext();!this.end()&&!this.match(e);)this.parseExpression();let i=this.mathlist;this.endContext();let n=(o=this.scanDelim())!=null?o:".";return new J(e==="\\right"?"left...right":"mleft...mright",i,{leftDelim:r,rightDelim:n,style:this.style})}parseSupSub(){if(this.parseMode!=="math")return!1;let e=this.peek();if(e!=="^"&&e!=="_"&&e!=="'")return!1;let r=this.lastSubsupAtom();for(;e==="^"||e==="_"||e==="'";)this.match("'")?this.match("'")?r.addChild(new y({type:"mord",command:"\\doubleprime",mode:"math",value:"\u2032\u2032"}),"superscript"):r.addChild(new y({type:"mord",command:"\\prime",mode:"math",value:"\u2032"}),"superscript"):(this.match("^")||this.match("_"))&&r.addChildren(E(this.scanArgument("expression")),e==="_"?"subscript":"superscript"),e=this.peek();return!0}parseLimits(){if(this.parseMode!=="math")return!1;let e=this.match("\\limits"),r=!e&&this.match("\\nolimits"),i=!r&&!e&&this.match("\\displaylimits");if(!e&&!r&&!i)return!1;let n=this.mathlist.length>0?this.mathlist[this.mathlist.length-1]:null;return n===null?!1:(n.explicitSubsupPlacement=!0,e&&(n.subsupPlacement="over-under"),r&&(n.subsupPlacement="adjacent"),i&&(n.subsupPlacement="auto"),!0)}scanArguments(e){if(!(e!=null&&e.params))return[void 0,[]];let r,i=[],n=e.infix?2:0;for(;n["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(a))):o.isOptional?i.push(this.scanOptionalArgument(o.type)):o.type.endsWith("*")?r=o.type.slice(0,-1):i.push(this.scanArgument(o.type)),n+=1}return[r,i]}scanSymbolOrLiteral(){let e=this.peek();if(!e)return null;this.next();let r;if(ln(e)){let i=ve.createAtom(this.parseMode,e,p({},this.style));return i?[i]:null}if(r=this.scanMacro(e),r)return[r];if(e.startsWith("\\")){let i=ne(e,this.parseMode);if(!i)return this.onError({code:"unknown-command",arg:e}),[new ft(e)];if(i.definitionType==="symbol"){let n=p({},this.style);i.variant&&(n.variant=i.variant),r=new y({type:i.type,command:e,style:n,value:String.fromCodePoint(i.codepoint),mode:this.parseMode,verbatimLatex:e})}else{if(i.applyMode||i.applyStyle||i.infix)return this.onError({code:"invalid-command",arg:e}),[new ft(e)];i.createAtom&&(r=i.createAtom({command:e,args:[],style:this.style,mode:this.parseMode}))}}return r?[r]:null}scanArgument(e){var n;this.skipFiller();let r=this.parseMode;if(e==="auto"&&(e=r),!this.match("<{>")){if(e==="string")return this.scanString();if(e==="value")return this.scanValue();if(e==="delim")return(n=this.scanDelim())!=null?n:".";if(e==="expression")return this.scanExpression();if(e==="math"){e!==r&&this.beginContext({mode:"math"});let o=this.scanSymbolOrLiteral();return e!==r&&this.endContext(),o}if(e==="text"){e!==r&&this.beginContext({mode:"text"});let o=this.scanSymbolOrLiteral();return e!==r&&this.endContext(),o}return e==="balanced-string"?null:e==="rest"?this.scan(o=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(o)):null}if(e==="text"){this.beginContext({mode:"text"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());let o=this.mathlist;return this.endContext(),{group:o}}if(e==="math"){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());let o=this.mathlist;return this.endContext(),{group:o}}if(e==="rest"){let o=this.scan();return this.match("<}>")||this.onError({code:"unbalanced-braces"}),{group:o}}let i=null;if(e==="expression"){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());let o=this.mathlist;return this.endContext(),{group:o}}return e==="string"?i=this.scanString():e==="balanced-string"?i=this.scanBalancedString():e==="colspec"?i=this.scanColspec():e==="value"&&(i=this.scanValue()),this.skipUntilToken("<}>"),i}scanOptionalArgument(e){if(e=e==="auto"?this.parseMode:e,this.skipFiller(),!this.match("["))return null;let r=null;for(;!this.end()&&!this.match("]");)if(e==="string")r=this.scanString();else if(e==="value")r=this.scanValue();else if(e==="colspec")r=this.scanColspec();else if(e==="bbox"){let i={},n=this.scanString().toLowerCase().trim().split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(let o of n){let a=o.match(/^\s*([\d.]+)\s*([a-z]{2})/);if(a)i.padding={dimension:Number.parseFloat(a[1]),unit:a[2]};else{let s=o.match(/^\s*border\s*:\s*(.*)/);s?i.border=s[1]:i.backgroundcolor={string:o}}}r=i}else e==="math"&&(this.beginContext({mode:"math"}),r=this.mathlist.concat(this.scan(i=>i==="]")),this.endContext());return r}scanSymbolOrCommand(e){var o,a,s;if(e==="\\placeholder"){let l=this.scanOptionalArgument("string"),c=this.scanOptionalArgument("math"),u=y.serialize(c,{defaultMode:"math"}),m=[],d;!d&&u==="correct"?d="correct":!d&&u==="incorrect"?d="incorrect":u!==""&&(m=c);let h=this.scanOptionalArgument("string")==="locked",f=this.scanArgument("auto"),x;return f&&Array.isArray(f)&&f.length>0?x=f:f&&typeof f=="object"&&"group"in f?x=f.group:x=m,l?[new sn(l,d,h,x!=null?x:m,{mode:this.parseMode,style:this.style})]:[new Le({mode:this.parseMode,style:this.style})]}if(e==="\\renewcommand"||e==="\\newcommand"||e==="\\providecommand"||e==="\\def"){let l=this.index,c=this.scanLiteralGroup()||this.next();if(!c)return null;if(this.context.registers[c.substring(1)]){let u=this.scanArgument("string");u!==null&&(this.context.registers[c.substring(1)]=u);let m=P([e,Er(this.tokens.slice(l,this.index))]);return[new y({type:"text",value:"",verbatimLatex:m})]}}let r=this.scanMacro(e);if(r)return[r];let i=ne(e,this.parseMode);if(!i)return this.parseMode==="text"?(/[a-zA-Z]/.test((o=this.peek())!=null?o:"")&&(e+=" "),[...e].map(l=>new y({type:"text",value:l,mode:"text",style:this.style}))):(this.onError({code:"unknown-command",arg:e}),[new ft(e)]);let n=this.index;if(i.definitionType==="symbol"){let l=p({},this.style);i.variant&&(l.variant=i.variant),r=new y({type:i.type,command:e,style:l,value:String.fromCodePoint(i.codepoint),mode:this.parseMode})}else{if(i.ifMode&&!i.ifMode.includes(this.parseMode))return[];let l=this.parseMode;i.applyMode&&(this.parseMode=i.applyMode);let c,u=[];if(i.parse?u=i.parse(this):[c,u]=this.scanArguments(i),this.parseMode=l,i.applyMode&&!i.applyStyle&&!i.createAtom)return E(u[0]);if(i.infix)return this.onError({code:"too-many-infix-commands",arg:e}),null;if(typeof i.createAtom=="function")r=i.createAtom({command:e,args:u,style:this.style,mode:this.parseMode}),c&&(r.body=E(this.scanArgument(c)));else if(typeof i.applyStyle=="function"){let m=i.applyStyle(this.style,e,u,this.context),d=this.parseMode;if(i.applyMode&&(this.parseMode=i.applyMode),c){let h=this.style;this.style=m;let f=this.scanArgument(c);return this.style=h,this.parseMode=d,E(f)}this.style=m}else r=new y({type:"mord",command:(a=i.command)!=null?a:e,style:p({},this.style),value:e,mode:(s=i.applyMode)!=null?s:this.parseMode})}if(!r)return null;if(r instanceof y&&r.verbatimLatex===void 0&&!/^\\(llap|rlap|class|cssId|htmlData)$/.test(e)){let l=P([e,Er(this.tokens.slice(n,this.index))]);l&&(r.verbatimLatex=l)}if(r.verbatimLatex===null&&(r.verbatimLatex=void 0),r.isFunction&&this.smartFence){let l=this.scanSmartFence();if(l)return[r,l]}return[r]}scanSymbolCommandOrLiteral(){this.expandUnicode();let e=this.get();if(!e)return null;if(ln(e)){let r=ve.createAtom(this.parseMode,e,p({},this.style));if(!r)return null;if(r.isFunction&&this.smartFence){let i=this.scanSmartFence();if(i)return[r,i]}return[r]}return e.startsWith("\\")?this.scanSymbolOrCommand(e):e===""?this.parseMode==="text"?[new qe(" "," ",this.style)]:null:(e==="<}>"?this.onError({latex:"",code:"unbalanced-braces"}):this.onError({latex:"",code:"unexpected-token",arg:e}),null)}scanMacro(e){var a;let r=this.context.getMacro(e);if(!r)return null;let i=this.index,n=r.args,o={"?":(a=this.args)==null?void 0:a.call(this,"?")};for(let s=1;s<=n;s++){let l=this.scanLiteralGroup();if(!l){let c=this.index;this.scanExpression(),l=Er(this.tokens.slice(c,this.index))}o[s]=l}return new an(e,{expand:r.expand,captureSelection:r.captureSelection,args:i===this.index?null:Er(this.tokens.slice(i,this.index)),style:this.parsingContext.style,body:ge(r.def,{context:this.context,parseMode:this.parseMode,args:s=>o[s],mathstyle:this.parsingContext.mathstyle,style:this.parsingContext.style})})}parseExpression(){var r,i,n,o;let e=(o=(n=(i=(r=this.scanEnvironment())!=null?r:this.scanModeShift())!=null?i:this.scanModeSet())!=null?n:this.scanGroup())!=null?o:this.scanLeftRight();if(e===null){if(this.parseSupSub()||this.parseLimits())return!0;e=this.scanSymbolCommandOrLiteral()}return e?(ee(e)?this.mathlist.push(...e):this.mathlist.push(e),!0):!1}};function ge(t,e){var o,a,s,l;let r=(o=e==null?void 0:e.args)!=null?o:void 0,i=new is(ji(t,r),e==null?void 0:e.context,{args:r,mathstyle:(a=e==null?void 0:e.mathstyle)!=null?a:"displaystyle",parseMode:(s=e==null?void 0:e.parseMode)!=null?s:"math",style:(l=e==null?void 0:e.style)!=null?l:{}}),n=[];for(;!i.end();)n.push(...i.scan(()=>!1));return n}function ns(t,e){var i;let r=new is(ji(t,null),e==null?void 0:e.context,{mathstyle:"displaystyle",parseMode:(i=e==null?void 0:e.parseMode)!=null?i:"math"});for(;!r.end();)r.scan();return r.errors}var eo=class t extends y{constructor(e,r){super({type:"chem"},{command:e,mode:"math"});let i=me.go(L.go(r,e==="\\pu"?"pu":"ce"),!1);this.body=ge(i),this._verbatimLatex=e+"{"+r+"}",this.arg=r,this.captureSelection=!0}static fromJson(e){return new t(e.command,e.arg)}set verbatimLatex(e){}get verbatimLatex(){return this._verbatimLatex}toJson(){return g(p({},super.toJson()),{arg:this.arg})}render(e){let r=y.createBox(e,this.body,{type:"inner"});return this.caret&&(r.caret=this.caret),this.bind(e,r)}_serialize(e){return this.verbatimLatex,this.verbatimLatex}};M(["ce","pu"],"{chemformula:balanced-string}",{createAtom:t=>{var e;return new eo(t.command,(e=t.args[0])!=null?e:"")}});var L={go:function(t,e){if(!t)return[];e===void 0&&(e="ce");var r="0",i={};i.parenthesisLevel=0,t=t.replace(/\n/g," "),t=t.replace(/[\u2212\u2013\u2014\u2010]/g,"-"),t=t.replace(/[\u2026]/g,"...");for(var n,o=10,a=[];;){n!==t?(o=10,n=t):o--;var s=L.stateMachines[e],l=s.transitions[r]||s.transitions["*"];e:for(var c=0;c0){if(m.revisit||(t=u.remainder),!m.toContinue)break e}else return a}}if(o<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(t,e){if(e)if(Object.prototype.toString.call(e)==="[object Array]")for(var r=0;r":/^[=<>]/,"#":/^[#\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(t){return L.patterns.findObserveGroups(t,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(t){return L.patterns.findObserveGroups(t,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(t){return L.patterns.findObserveGroups(t,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(t){return L.patterns.findObserveGroups(t,"",/^\\[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(t){return L.patterns.findObserveGroups(t,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(t){return L.patterns.findObserveGroups(t,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(t){return L.patterns.findObserveGroups(t,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(t){return L.patterns.findObserveGroups(t,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(t){return L.patterns.findObserveGroups(t,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(t){return L.patterns.findObserveGroups(t,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(t){return L.patterns.findObserveGroups(t,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(t){return L.patterns.findObserveGroups(t,"\\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(t){var e;if(e=t.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))/),e)return{match_:e[0],remainder:t.substr(e[0].length)};var r=L.patterns.findObserveGroups(t,"","$","$","");return r&&(e=r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),e)?{match_:e[0],remainder:t.substr(e[0].length)}:null},amount2:function(t){return this.amount(t)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(t){if(t.match(/^\([a-z]+\)$/))return null;var e=t.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return e?{match_:e[0],remainder:t.substr(e[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(t,e,r,i,n,o,a,s,l,c){var u=function(b,v){if(typeof v=="string")return b.indexOf(v)!==0?null:v;var k=b.match(v);return k?k[0]:null},m=function(b,v,k){for(var A=0;v0,null},d=u(t,e);if(d===null||(t=t.substr(d.length),d=u(t,r),d===null))return null;var h=m(t,d.length,i||n);if(h===null)return null;var f=t.substring(0,i?h.endMatchEnd:h.endMatchBegin);if(o||a){var x=this.findObserveGroups(t.substr(h.endMatchEnd),o,a,s,l);if(x===null)return null;var _=[f,x.match_];return{match_:c?_.join(""):_,remainder:x.remainder}}else return{match_:f,remainder:t.substr(h.endMatchEnd)}},match_:function(t,e){var r=L.patterns.patterns[t];if(r===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+t+")"];if(typeof r=="function")return L.patterns.patterns[t](e);var i=e.match(r);if(i){var n;return i[2]?n=[i[1],i[2]]:i[1]?n=i[1]:n=i[0],{match_:n,remainder:e.substr(i[0].length)}}return null}},actions:{"a=":function(t,e){t.a=(t.a||"")+e},"b=":function(t,e){t.b=(t.b||"")+e},"p=":function(t,e){t.p=(t.p||"")+e},"o=":function(t,e){t.o=(t.o||"")+e},"q=":function(t,e){t.q=(t.q||"")+e},"d=":function(t,e){t.d=(t.d||"")+e},"rm=":function(t,e){t.rm=(t.rm||"")+e},"text=":function(t,e){t.text_=(t.text_||"")+e},insert:function(t,e,r){return{type_:r}},"insert+p1":function(t,e,r){return{type_:r,p1:e}},"insert+p1+p2":function(t,e,r){return{type_:r,p1:e[0],p2:e[1]}},copy:function(t,e){return e},rm:function(t,e){return{type_:"rm",p1:e||""}},text:function(t,e){return L.go(e,"text")},"{text}":function(t,e){var r=["{"];return L.concatArray(r,L.go(e,"text")),r.push("}"),r},"tex-math":function(t,e){return L.go(e,"tex-math")},"tex-math tight":function(t,e){return L.go(e,"tex-math tight")},bond:function(t,e,r){return{type_:"bond",kind_:r||e}},"color0-output":function(t,e){return{type_:"color0",color:e[0]}},ce:function(t,e){return L.go(e)},"1/2":function(t,e){var r=[];e.match(/^[+\-]/)&&(r.push(e.substr(0,1)),e=e.substr(1));var i=e.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return i[1]=i[1].replace(/\$/g,""),r.push({type_:"frac",p1:i[1],p2:i[2]}),i[3]&&(i[3]=i[3].replace(/\$/g,""),r.push({type_:"tex-math",p1:i[3]})),r},"9,9":function(t,e){return L.go(e,"9,9")}},createTransitions:function(t){var e,r,i,n,o={};for(e in t)for(r in t[e])for(i=r.split("|"),t[e][r].stateArray=i,n=0;n":{"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(t,e){var r;if((t.d||"").match(/^[0-9]+$/)){var i=t.d;t.d=void 0,r=this.output(t),t.b=i}else r=this.output(t);return L.actions["o="](t,e),r},"d= kv":function(t,e){t.d=e,t.dType="kv"},"charge or bond":function(t,e){if(t.beginsWithBond){var r=[];return L.concatArray(r,this.output(t)),L.concatArray(r,L.actions.bond(t,e,"-")),r}else t.d=e},"- after o/d":function(t,e,r){var i=L.patterns.match_("orbital",t.o||""),n=L.patterns.match_("one lowercase greek letter $",t.o||""),o=L.patterns.match_("one lowercase latin letter $",t.o||""),a=L.patterns.match_("$one lowercase latin letter$ $",t.o||""),s=e==="-"&&(i&&i.remainder===""||n||o||a);s&&!t.a&&!t.b&&!t.p&&!t.d&&!t.q&&!i&&o&&(t.o="$"+t.o+"$");var l=[];return s?(L.concatArray(l,this.output(t)),l.push({type_:"hyphen"})):(i=L.patterns.match_("digits",t.d||""),r&&i&&i.remainder===""?(L.concatArray(l,L.actions["d="](t,e)),L.concatArray(l,this.output(t))):(L.concatArray(l,this.output(t)),L.concatArray(l,L.actions.bond(t,e,"-")))),l},"a to o":function(t){t.o=t.a,t.a=void 0},"sb=true":function(t){t.sb=!0},"sb=false":function(t){t.sb=!1},"beginsWithBond=true":function(t){t.beginsWithBond=!0},"beginsWithBond=false":function(t){t.beginsWithBond=!1},"parenthesisLevel++":function(t){t.parenthesisLevel++},"parenthesisLevel--":function(t){t.parenthesisLevel--},"state of aggregation":function(t,e){return{type_:"state of aggregation",p1:L.go(e,"o")}},comma:function(t,e){var r=e.replace(/\s*$/,""),i=r!==e;return i&&t.parenthesisLevel===0?{type_:"comma enumeration L",p1:r}:{type_:"comma enumeration M",p1:r}},output:function(t,e,r){var i;if(!t.r)i=[],!t.a&&!t.b&&!t.p&&!t.o&&!t.q&&!t.d&&!r||(t.sb&&i.push({type_:"entitySkip"}),!t.o&&!t.q&&!t.d&&!t.b&&!t.p&&r!==2?(t.o=t.a,t.a=void 0):!t.o&&!t.q&&!t.d&&(t.b||t.p)?(t.o=t.a,t.d=t.b,t.q=t.p,t.a=t.b=t.p=void 0):t.o&&t.dType==="kv"&&L.patterns.match_("d-oxidation$",t.d||"")?t.dType="oxidation":t.o&&t.dType==="kv"&&!t.q&&(t.dType=void 0),i.push({type_:"chemfive",a:L.go(t.a,"a"),b:L.go(t.b,"bd"),p:L.go(t.p,"pq"),o:L.go(t.o,"o"),q:L.go(t.q,"pq"),d:L.go(t.d,t.dType==="oxidation"?"oxidation":"bd"),dType:t.dType}));else{var n;t.rdt==="M"?n=L.go(t.rd,"tex-math"):t.rdt==="T"?n=[{type_:"text",p1:t.rd||""}]:n=L.go(t.rd);var o;t.rqt==="M"?o=L.go(t.rq,"tex-math"):t.rqt==="T"?o=[{type_:"text",p1:t.rq||""}]:o=L.go(t.rq),i={type_:"arrow",r:t.r,rd:n,rq:o}}for(var a in t)a!=="parenthesisLevel"&&a!=="beginsWithBond"&&delete t[a];return i},"oxidation-output":function(t,e){var r=["{"];return L.concatArray(r,L.go(e,"oxidation")),r.push("}"),r},"frac-output":function(t,e){return{type_:"frac-ce",p1:L.go(e[0]),p2:L.go(e[1])}},"overset-output":function(t,e){return{type_:"overset",p1:L.go(e[0]),p2:L.go(e[1])}},"underset-output":function(t,e){return{type_:"underset",p1:L.go(e[0]),p2:L.go(e[1])}},"underbrace-output":function(t,e){return{type_:"underbrace",p1:L.go(e[0]),p2:L.go(e[1])}},"color-output":function(t,e){return{type_:"color",color1:e[0],color2:L.go(e[1])}},"r=":function(t,e){t.r=e},"rdt=":function(t,e){t.rdt=e},"rd=":function(t,e){t.rd=e},"rqt=":function(t,e){t.rqt=e},"rq=":function(t,e){t.rq=e},operator:function(t,e,r){return{type_:"operator",kind_:r||e}}}},a:{transitions:L.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:L.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:L.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(t){if(t.text_){var e={type_:"text",p1:t.text_};for(var r in t)delete t[r];return e}}}},pq:{transitions:L.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(t,e){return{type_:"state of aggregation subscript",p1:L.go(e,"o")}},"color-output":function(t,e){return{type_:"color",color1:e[0],color2:L.go(e[1],"pq")}}}},bd:{transitions:L.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(t,e){return{type_:"color",color1:e[0],color2:L.go(e[1],"bd")}}}},oxidation:{transitions:L.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(t,e){return{type_:"roman numeral",p1:e||""}}}},"tex-math":{transitions:L.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(t){if(t.o){var e={type_:"tex-math",p1:t.o};for(var r in t)delete t[r];return e}}}},"tex-math tight":{transitions:L.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(t,e){t.o=(t.o||"")+"{"+e+"}"},output:function(t){if(t.o){var e={type_:"tex-math",p1:t.o};for(var r in t)delete t[r];return e}}}},"9,9":{transitions:L.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:L.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(t,e){var r=[];return e[0]==="+-"||e[0]==="+/-"?r.push("\\pm "):e[0]&&r.push(e[0]),e[1]&&(L.concatArray(r,L.go(e[1],"pu-9,9")),e[2]&&(e[2].match(/[,.]/)?L.concatArray(r,L.go(e[2],"pu-9,9")):r.push(e[2])),(e[3]||e[4])&&(e[3]==="e"||e[4]==="*"?r.push({type_:"cdot"}):r.push({type_:"times"}))),e[5]&&r.push("10^{"+e[5]+"}"),r},"number^":function(t,e){var r=[];return e[0]==="+-"||e[0]==="+/-"?r.push("\\pm "):e[0]&&r.push(e[0]),L.concatArray(r,L.go(e[1],"pu-9,9")),r.push("^{"+e[2]+"}"),r},operator:function(t,e,r){return{type_:"operator",kind_:r||e}},space:function(){return{type_:"pu-space-1"}},output:function(t){var e,r=L.patterns.match_("{(...)}",t.d||"");r&&r.remainder===""&&(t.d=r.match_);var i=L.patterns.match_("{(...)}",t.q||"");if(i&&i.remainder===""&&(t.q=i.match_),t.d&&(t.d=t.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),t.d=t.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),t.q){t.q=t.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),t.q=t.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var n={d:L.go(t.d,"pu"),q:L.go(t.q,"pu")};t.o==="//"?e={type_:"pu-frac",p1:n.d,p2:n.q}:(e=n.d,n.d.length>1||n.q.length>1?e.push({type_:" / "}):e.push({type_:"/"}),L.concatArray(e,n.q))}else e=L.go(t.d,"pu-2");for(var o in t)delete t[o];return e}}},"pu-2":{transitions:L.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(t,e){t.rm+="^{"+e+"}"},space:function(){return{type_:"pu-space-2"}},output:function(t){var e=[];if(t.rm){var r=L.patterns.match_("{(...)}",t.rm||"");r&&r.remainder===""?e=L.go(r.match_,"pu"):e={type_:"rm",p1:t.rm}}for(var i in t)delete t[i];return e}}},"pu-9,9":{transitions:L.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(t){var e=[];if(t.text_=t.text_||"",t.text_.length>4){var r=t.text_.length%3;r===0&&(r=3);for(var i=t.text_.length-3;i>0;i-=3)e.push(t.text_.substr(i,3)),e.push({type_:"1000 separator"});e.push(t.text_.substr(0,r)),e.reverse()}else e.push(t.text_);for(var n in t)delete t[n];return e},"output-o":function(t){var e=[];if(t.text_=t.text_||"",t.text_.length>4){for(var r=t.text_.length-3,i=0;i"||t.r==="<=>>"||t.r==="<<=>"||t.r==="<-->"?(a="\\long"+a,o.rd&&(a="\\overset{"+o.rd+"}{"+a+"}"),o.rq&&(t.r==="<-->"?a="\\underset{\\lower2mu{"+o.rq+"}}{"+a+"}":a="\\underset{\\lower6mu{"+o.rq+"}}{"+a+"}"),a=" {}\\mathrel{"+a+"}{} "):(o.rq&&(a+="[{"+o.rq+"}]"),a+="{"+o.rd+"}",a=" {}\\mathrel{\\x"+a+"}{} "):a=" {}\\mathrel{\\long"+a+"}{} ",e=a;break;case"operator":e=me._getOperator(t.kind_);break;case"1st-level escape":e=t.p1+" ";break;case"space":e=" ";break;case"entitySkip":e="~";break;case"pu-space-1":e="~";break;case"pu-space-2":e="\\mkern3mu ";break;case"1000 separator":e="\\mkern2mu ";break;case"commaDecimal":e="{,}";break;case"comma enumeration L":e="{"+t.p1+"}\\mkern6mu ";break;case"comma enumeration M":e="{"+t.p1+"}\\mkern3mu ";break;case"comma enumeration S":e="{"+t.p1+"}\\mkern1mu ";break;case"hyphen":e="\\text{-}";break;case"addition compound":e="\\,{\\cdot}\\,";break;case"electron dot":e="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":e="{\\times}";break;case"prime":e="\\prime ";break;case"cdot":e="\\cdot ";break;case"tight cdot":e="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":e="\\times ";break;case"circa":e="{\\sim}";break;case"^":e="uparrow";break;case"v":e="downarrow";break;case"ellipsis":e="\\ldots ";break;case"/":e="/";break;case" / ":e="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return e},_getArrow:function(t){switch(t){case"->":return"rightarrow";case"\u2192":return"rightarrow";case"\u27F6":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<-->":return"leftrightarrows";case"<=>":return"rightleftharpoons";case"\u21CC":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(t){switch(t){case"-":return"{-}";case"1":return"{-}";case"=":return"{=}";case"2":return"{=}";case"#":return"{\\equiv}";case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"~--":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"-~-":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";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(t){switch(t){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."]}}};var cn=class t extends y{constructor(e){super(g(p({},e),{type:"delim"})),this.value=e.delim,this.size=e.size}static fromJson(e){return new t(e)}toJson(){return g(p({},super.toJson()),{delim:this.value,size:this.size})}render(e){return new w(this.value,{type:"middle"})}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;let r=ne(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,e):W(this.command,this.value)}},un=class t extends y{constructor(e){super(g(p({},e),{type:"sizeddelim",value:e.delim})),this.delimType=e.delimType,this.size=e.size}static fromJson(e){return new t(e)}toJson(){return g(p({},super.toJson()),{delim:this.value,size:this.size,delimType:this.delimType})}render(e){let r=np(this.value,this.size,e,{classes:{open:"ML__open",close:"ML__close"}[this.delimType],type:this.delimType,isSelected:this.isSelected});return r?(r=this.bind(e,r),this.caret&&(r.caret=this.caret),r):null}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;let r=ne(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,e):W(this.command,this.value)}};function dn(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}var lr=class t extends y{constructor(e,r,i,n){var o,a;super({type:"enclose",command:e,style:n.style}),this.body=r,this.backgroundcolor=n.backgroundcolor,i.updiagonalarrow&&(i.updiagonalstrike=!1),i.box&&(i.left=!1,i.right=!1,i.bottom=!1,i.top=!1),this.notation=i,this.shadow=(o=n.shadow)!=null?o:"none",this.strokeWidth=(a=n.strokeWidth)!=null?a:"0.06em",this.strokeWidth||(this.strokeWidth="0.06em"),this.strokeStyle=n.strokeStyle,this.svgStrokeStyle=n.svgStrokeStyle,this.strokeColor=n.strokeColor,this.borderStyle=n.borderStyle,this.padding=n.padding,this.captureSelection=!1}static fromJson(e){return new t(e.command,e.body,e.notation,e)}toJson(){return g(p({},super.toJson()),{notation:this.notation,shadow:this.shadow,strokeWidth:this.strokeWidth,strokeStyle:this.strokeStyle,svgStrokeStyle:this.svgStrokeStyle,strokeColor:this.strokeColor,borderStyle:this.borderStyle,padding:this.padding})}_serialize(e){var n;if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;let r=ne(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,e);let i=(n=this.command)!=null?n:"";if(this.command==="\\enclose"){i+="{"+Object.keys(this.notation).join(" ")+"}";let o="",a="";this.backgroundcolor&&this.backgroundcolor!=="transparent"&&(o+=a+'mathbackground="'+this.backgroundcolor+'"',a=","),this.shadow&&this.shadow!=="auto"&&(o+=a+'shadow="'+this.shadow+'"',a=","),this.strokeWidth||this.strokeStyle!=="solid"?(o+=a+this.borderStyle,a=","):this.strokeColor&&this.strokeColor!=="currentColor"&&(o+=a+'mathcolor="'+this.strokeColor+'"',a=","),o&&(i+=`[${o}]`)}return W(i,this.bodyToLatex(e))}render(e){var h,f,x,_,b;let r=new K({parent:e},this.style),i=y.createBox(r,this.body);if(!i)return null;let n=ig(this.borderStyle),o=r.toEm(!this.padding||this.padding==="auto"?{register:"fboxsep"}:{string:this.padding});i.setStyle("position","relative"),i.setStyle("display","inline-block"),i.setStyle("height",i.height+i.depth,"em"),i.setStyle("width",i.width,"em");let a=new w(null,{classes:"ML__notation"}),s=i.height+i.depth+2*o,l=i.width+2*o,c="",u=Math.min(o*.2,.05);if(this.notation.horizontalstrike){let v=2*o+i.height-Je/2;c+=this.line((o+u).toString(),v.toString(),(o+i.width-u).toString(),v.toString())}if(this.notation.verticalstrike){let v=o+i.width/2;c+=this.line(v.toString(),(o+u).toString(),v.toString(),(s-o-u).toString())}if(this.notation.updiagonalstrike&&(c+=this.line((o+u).toString(),(s-o-u).toString(),(o+i.width-u).toString(),(o+u).toString())),this.notation.downdiagonalstrike&&(c+=this.line((o+u).toString(),(o+u).toString(),(o+i.width-u).toString(),(s-o-u).toString())),this.notation.updiagonalarrow){c+=this.line(o.toString(),(2*o+i.depth+i.height).toString(),(o+i.width).toString(),o.toString());let A=.03*Math.sqrt(l*l+s*s)*1,C=i.width*A,T=(i.depth+i.height)*A,S=o+i.width,B=o;B+T-.4*C<0&&(B=.4*C-T),c+='`}};function os(t){return typeof t=="number"?`${Math.floor(100*t)/100}%`:t}function ig(t){if(!t)return"1px";let e=t.match(/([0-9][a-zA-Z\%]+)/);return e===null?"1px":e[1]}function ng(t){return(Math.floor(100*t.metrics.sqrtRuleThickness/t.scalingFactor)/100/10).toString()+"em"}function dp(t){let e=t.isDisplayStyle?Je:t.metrics.defaultRuleThickness;return t.metrics.defaultRuleThickness+t.scalingFactor*e/4}var mn={fractionNavigationOrder:"numerator-denominator"};var gt=class t extends y{constructor(e,r,i){var n,o,a;super(g(p({},i),{type:"genfrac",displayContainsHighlight:!0})),this.above=e,this.below=r,this.hasBarLine=(n=i==null?void 0:i.hasBarLine)!=null?n:!0,this.continuousFraction=(o=i==null?void 0:i.continuousFraction)!=null?o:!1,this.align=(a=i==null?void 0:i.align)!=null?a:"center",this.numerPrefix=i==null?void 0:i.numerPrefix,this.denomPrefix=i==null?void 0:i.denomPrefix,this.mathstyleName=i==null?void 0:i.mathstyleName,this.leftDelim=i==null?void 0:i.leftDelim,this.rightDelim=i==null?void 0:i.rightDelim}static fromJson(e){return new t(e.above,e.below,e)}toJson(){let e={};return this.continuousFraction&&(e.continuousFraction=!0),this.align!=="center"&&(e.align=this.align),this.numerPrefix&&(e.numerPrefix=this.numerPrefix),this.denomPrefix&&(e.denomPrefix=this.denomPrefix),this.leftDelim&&(e.leftDelim=this.leftDelim),this.rightDelim&&(e.rightDelim=this.rightDelim),this.hasBarLine||(e.hasBarLine=!1),this.mathstyleName&&(e.mathstyleName=this.mathstyleName),p(p({},super.toJson()),e)}get children(){if(this._children)return this._children;let e=[];if(mn.fractionNavigationOrder==="denominator-numerator"){for(let r of this.below)e.push(...r.children),e.push(r);for(let r of this.above)e.push(...r.children),e.push(r)}else{for(let r of this.above)e.push(...r.children),e.push(r);for(let r of this.below)e.push(...r.children),e.push(r)}return this._children=e,e}render(e){var C,T;let r=new K({parent:e,mathstyle:this.mathstyleName},this.style),i=r.metrics,n=new K({parent:r,mathstyle:this.continuousFraction?"":"numerator"},this.style),o=this.numerPrefix?new w([new w(this.numerPrefix),y.createBox(n,this.above)],{isTight:n.isTight,type:"ignore"}):(C=y.createBox(n,this.above,{type:"ignore"}))!=null?C:new w(null,{type:"ignore"}),a=new K({parent:r,mathstyle:this.continuousFraction?"":"denominator"},this.style),s=this.denomPrefix?new w([new w(this.denomPrefix),y.createBox(a,this.below,{type:"ignore"})]):(T=y.createBox(a,this.below,{type:"ignore"}))!=null?T:new w(null,{type:"ignore"}),l=this.hasBarLine?i.defaultRuleThickness:0,c,u=0,m;r.isDisplayStyle?(c=n.metrics.num1,u=l>0?3*l:7*l,m=a.metrics.denom1):(l>0?(c=n.metrics.num2,u=l):(c=n.metrics.num3,u=3*i.defaultRuleThickness),m=a.metrics.denom2);let d=[];this.isSelected&&d.push("ML__selected");let h=o.depth,f=s.height,x;if(l<=0){let S=c-h-(f-m);Snew pe(r)),this.skipBoundary=!0}static fromJson(e){return new t}toJson(){return super.toJson()}render(e){let r=y.createBox(e,this.body);return r?(this.caret&&(r.caret=this.caret),this.bind(e,r)):null}_serialize(e){var r,i;return(i=(r=this.body)==null?void 0:r.map(n=>n.value).join(""))!=null?i:""}};var di=class t extends y{constructor(e,r){super(g(p({},r),{type:"extensible-symbol",isFunction:r==null?void 0:r.isFunction})),this.value=e,this.variant=r==null?void 0:r.variant,this.subsupPlacement=r==null?void 0:r.limits}static fromJson(e){return new t(e.symbol,e)}toJson(){let e=super.toJson();return this.variant&&(e.variant=this.variant),this.subsupPlacement&&(e.limits=this.subsupPlacement),this.value&&(e.symbol=this.value),e}render(e){var s;let r=e.isDisplayStyle&&this.value!=="\\smallint",i=new w(this.value,{fontFamily:r?"Size2-Regular":"Size1-Regular",classes:"ML__op-symbol "+(r?"ML__large-op":"ML__small-op"),type:"op",maxFontSize:e.scalingFactor,isSelected:this.isSelected});if(!i)return null;i.right=i.italic;let n=(i.height-i.depth)/2-Pe*e.scalingFactor,o=i.italic;i.setTop(n);let a=i;if(this.superscript||this.subscript){let l=(s=this.subsupPlacement)!=null?s:"auto";l==="auto"&&e.isDisplayStyle&&(l="over-under"),a=l==="over-under"?this.attachLimits(e,{base:i,baseShift:n,slant:o}):this.attachSupsub(e,{base:i})}return new w(this.bind(e,a),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"ML__op-group"}).wrap(e)}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;let r=ne(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,e);let i=[];return i.push(this.command),this.explicitSubsupPlacement&&(this.subsupPlacement==="over-under"&&i.push("\\limits"),this.subsupPlacement==="adjacent"&&i.push("\\nolimits"),this.subsupPlacement==="auto"&&i.push("\\displaylimits")),i.push(this.supsubToLatex(e)),P(i)}};var bt=class t extends y{constructor(e){let r=e.body;super(g(p({},e),{type:"overlap",body:typeof r=="string"?[new y({value:r})]:r,style:e==null?void 0:e.style})),this.skipBoundary=!0,this.align=e==null?void 0:e.align,this.boxType=e==null?void 0:e.boxType}static fromJson(e){return new t(e)}toJson(){let e={};return this.align&&(e.align=this.align),this.boxType&&(e.boxType=this.boxType),p(p({},super.toJson()),e)}render(e){let r=y.createBox(e,this.body,{classes:"ML__inner"});return r?(this.caret&&(r.caret=this.caret),this.bind(e,new w([r,new w(null,{classes:"ML__fix"})],{classes:this.align==="right"?"ML__rlap":"ML__llap",type:this.boxType}))):null}};var Ae=class t extends y{constructor(e){var r,i,n,o;super({type:"overunder",command:e.command,style:e.style,mode:e.mode,body:e.body,skipBoundary:(r=e.skipBoundary)!=null?r:!0}),this.subsupPlacement=e.supsubPlacement,this.svgAbove=e.svgAbove,this.svgBelow=e.svgBelow,this.svgBody=e.svgBody,this.above=e.above,this.below=e.below,this.boxType=(i=e.boxType)!=null?i:"ord",this.paddedBody=(n=e.paddedBody)!=null?n:!1,this.paddedLabels=(o=e.paddedLabels)!=null?o:!1}static fromJson(e){return new t(e)}toJson(){let e=super.toJson();return this.skipBoundary||(e.skipBoundary=!1),this.subsupPlacement&&(e.subsupPlacement=this.subsupPlacement),this.svgAbove&&(e.svgAbove=this.svgAbove),this.svgBelow&&(e.svgBelow=this.svgBelow),this.svgBody&&(e.svgBody=this.svgBody),this.boxType!=="ord"&&(e.boxType=this.boxType),this.paddedBody&&(e.paddedBody=!0),this.paddedLabels&&(e.paddedLabels=!0),e}render(e){let r=this.svgBody?Gi(this.svgBody):y.createBox(e,this.body,{type:"ignore"}),i=new K({parent:e,mathstyle:"scriptstyle"},this.style),n=null;this.svgAbove?n=Gi(this.svgAbove):this.above&&(n=y.createBox(i,this.above,{type:"ignore"}));let o=null;this.svgBelow?o=Gi(this.svgBelow):this.below&&(o=y.createBox(i,this.below,{type:"ignore"})),this.paddedBody&&(r=new w([ar(e,"ML__open"),r,ar(e,"ML__close")],{type:"ignore"}));let a=og(e,{base:r,above:n,below:o,type:this.boxType==="bin"||this.boxType==="rel"?this.boxType:"ord",paddedAboveBelow:this.paddedLabels});return a?(this.subsupPlacement==="over-under"?a=this.attachLimits(e,{base:a,type:a.type}):a=this.attachSupsub(e,{base:a}),this.caret&&(a.caret=this.caret),this.bind(e,a)):null}};function og(t,e){if(!e.base)return null;if(!e.above&&!e.below){let s=new w(e.base,{type:e.type});return s.setStyle("position","relative"),s}let r=0;e.above&&(r=t.metrics.bigOpSpacing5);let i=null,n=e.base,o=0,a=["ML__center"];if(e.paddedAboveBelow&&a.push("ML__label_padding"),e.below&&e.above){let s=t.metrics.bigOpSpacing5+e.below.height+e.below.depth+n.depth+o;i=new te({bottom:s,children:[t.metrics.bigOpSpacing5,{box:e.below,classes:a},{box:n,classes:["ML__center"]},r,{box:e.above,classes:a},t.metrics.bigOpSpacing5]})}else e.below?i=new te({top:n.height-o,children:[t.metrics.bigOpSpacing5,{box:e.below,classes:a},{box:n,classes:["ML__center"]}]}):e.above&&(i=new te({bottom:n.depth+o,children:[{box:n,classes:["ML__center"]},r,{box:e.above,classes:a},t.metrics.bigOpSpacing5]}));return new w(i,{type:e.type})}var $t=class t extends y{constructor(e){var r,i,n,o;super(g(p({},e),{type:"phantom"})),this.captureSelection=!0,this.isInvisible=(r=e.isInvisible)!=null?r:!1,this.smashDepth=(i=e.smashDepth)!=null?i:!1,this.smashHeight=(n=e.smashHeight)!=null?n:!1,this.smashWidth=(o=e.smashWidth)!=null?o:!1}static fromJson(e){return new t(e)}toJson(){let e={};return this.isInvisible&&(e.isInvisible=!0),this.smashDepth&&(e.smashDepth=!0),this.smashHeight&&(e.smashHeight=!0),this.smashWidth&&(e.smashWidth=!0),p(p({},super.toJson()),e)}render(e){let r=new K({parent:e,isPhantom:!0});if(!this.smashDepth&&!this.smashHeight&&!this.smashWidth)return this.isInvisible,y.createBox(r,this.body,{classes:"ML__inner"});let i=y.createBox(this.isInvisible?r:e,this.body);if(!i)return null;if(this.smashWidth){let n=new w(null,{classes:"ML__fix"});return new w([i,n],{classes:"ML__rlap"}).wrap(e)}if(!this.smashHeight&&!this.smashDepth)return i;if(this.smashHeight&&(i.height=0),this.smashDepth&&(i.depth=0),i.children)for(let n of i.children)this.smashHeight&&(n.height=0),this.smashDepth&&(n.depth=0);return new te({firstBaseline:[{box:i}]},{type:i.type}).wrap(e)}};var Vt=class t extends y{constructor(e){var r;super(p({type:"spacing"},e)),this.width=e==null?void 0:e.width,this._braced=(r=e==null?void 0:e.braced)!=null?r:!1}static fromJson(e){return new t(e)}toJson(){let e=super.toJson();return this.width!==void 0&&(e.width=this.width),this._braced&&(e.braced=!0),e}render(e){var i;if(this.command==="space")return new w(this.mode==="math"?null:" ");let r;if(this.width!==void 0)r=new w(null,{classes:"ML__mspace"}),r.left=e.toEm(this.width);else{let n=(i={"\\qquad":"ML__qquad","\\quad":"ML__quad","\\enspace":"ML__enspace","\\;":"ML__thickspace","\\:":"ML__mediumspace","\\>":"ML__mediumspace","\\,":"ML__thinspace","\\!":"ML__negativethinspace"}[this.command])!=null?i:"ML__mediumspace";r=new w(null,{classes:n})}return r=this.bind(e,r),this.caret&&(r.caret=this.caret),r}_serialize(e){var n;if(!e.expandMacro&&typeof this.verbatimLatex=="string")return this.verbatimLatex;let r=ne(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,e);let i=(n=this.command)!=null?n:"";return this.width===void 0?i:this._braced&&!("register"in this.width)?`${i}{${_e(this.width)}}`:`${i}${_e(this.width)}`}};var pn=class t extends y{constructor(e){var r;super(g(p({},e),{type:"surd",mode:(r=e.mode)!=null?r:"math",style:e.style,displayContainsHighlight:!0,body:e.body})),this.above=e.index}static fromJson(e){return new t(g(p({},e),{index:e.above}))}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;let r=ne(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,e);let i=this.command,n=this.bodyToLatex(e);return this.above&&!this.hasEmptyBranch("above")?W(`${i}[${this.aboveToLatex(e)}]`,n):/^[0-9]$/.test(n)?`${i}${n}`:W(i,n)}get children(){if(this._children)return this._children;let e=[];if(this.above)for(let r of this.above)e.push(...r.children),e.push(r);if(this.body)for(let r of this.body)e.push(...r.children),e.push(r);return this._children=e,e}render(e){var v;let r=new K({parent:e,mathstyle:"cramp"},this.style),i=(v=y.createBox(r,this.body,{type:"inner"}))!=null?v:new w(null),n=r.scalingFactor,o=r.metrics.defaultRuleThickness/n,a=e.isDisplayStyle?Je:o,s=new w(null,{classes:"ML__sqrt-line",style:this.style});s.height=o,s.softWidth=i.width;let l=n*(o+a/4),u=Math.max(n*2*a,i.height+i.depth)+l+o,m=new K({parent:e},this.style),d=this.bind(m,new w(rn("inner","\\surd",u,!1,m,{isSelected:this.isSelected}),{isSelected:this.isSelected,classes:"ML__sqrt-sign",style:this.style}));if(!d)return null;let h=d.height+d.depth-o;h>i.height+i.depth+l&&(l=(l+h-(i.height+i.depth))/2),d.setTop(d.height-i.height-l);let f=this.bind(e,new te({firstBaseline:[{box:new w(i)},l-2*o,{box:s},o]})),x=y.createBox(new K({parent:e,mathstyle:"scriptscriptstyle"}),this.above,{type:"ignore"});if(!x){let k=new w([d,f],{classes:this.containsCaret?"ML__contains-caret":"",type:"inner"});return k.setStyle("display","inline-block"),k.setStyle("height",k.height+k.depth,"em"),this.caret&&(k.caret=this.caret),this.bind(e,k)}let _=new te({shift:-.6*(Math.max(d.height,f.height)-Math.max(d.depth,f.depth)),children:[{box:x}]}),b=new w([new w(_,{classes:"ML__sqrt-index",type:"ignore"}),d,f],{type:"inner",classes:this.containsCaret?"ML__contains-caret":""});return b.height=d.height,b.depth=d.depth,this.caret&&(b.caret=this.caret),this.bind(e,b)}};var lc=class extends w{constructor(e){super(null,{type:"skip"}),this._width=e}toMarkup(){return``}};function to(t,e){if(!t.parent)return;let r=t.parent.children,i=r.indexOf(t),n=i-1;for(;n>=0&&r[n].type==="ignore";)n-=1;if(n<0&&t.parent.parent&&t.parent.type==="lift"){to(t.parent,e);return}i>0&&r[i-1].type==="skip"?r[i-1].width+=e:r.splice(i,0,new lc(e))}var ag={ord:{op:3,bin:4,rel:5,inner:3},op:{ord:3,op:3,rel:5,inner:3},bin:{ord:4,op:4,open:4,inner:4},rel:{ord:5,op:5,open:5,inner:5},close:{op:3,bin:4,rel:5,inner:3},punct:{ord:3,op:3,rel:3,open:3,punct:3,inner:3},inner:{ord:3,op:3,bin:4,rel:5,open:3,punct:3,inner:3}},sg={ord:{op:3},op:{ord:3,op:3},close:{op:3},inner:{op:3}};function lg(t){ro(t,(e,r)=>{r.type==="bin"&&(!e||/^(middle|bin|op|rel|open|punct)$/.test(e.type))&&(r.type="ord"),(e==null?void 0:e.type)==="bin"&&/^(rel|close|punct)$/.test(r.type)&&(e.type="ord"),r.type!=="ignore"&&(e=r)})}function qt(t,e){if(!t.children)return t;let r=t.children;lg(r);let i=e.getRegisterAsEm("thinmuskip"),n=e.getRegisterAsEm("medmuskip"),o=e.getRegisterAsEm("thickmuskip");return ro(r,(a,s)=>{var m,d,h;if(!a)return;let l=a.type,c=s.isTight?(m=sg[l])!=null?m:null:(d=ag[l])!=null?d:null,u=(h=c==null?void 0:c[s.type])!=null?h:null;u===3&&to(s,i),u===4&&to(s,n),u===5&&to(s,o)}),t}function ro(t,e,r=void 0){if(!t)return r;t=[...t];for(let i of t)i.type==="lift"?r=ro(i.children,e,r):i.type==="ignore"?ro(i.children,e):(e(r,i),ro(i.children,e),r=i);return r}var mi=class t extends y{constructor(e){super({type:"tooltip",command:e.command,mode:e.mode,style:e.style,body:e.body,displayContainsHighlight:!0}),this.tooltip=new y({type:"root",mode:e.content,body:e.tooltip,style:{}}),this.skipBoundary=!0,this.captureSelection=!1}static fromJson(e){return new t(g(p({},e),{tooltip:yt(e.tooltip)}))}toJson(){var r;let e=(r=this.tooltip.body)==null?void 0:r.filter(i=>i.type!=="first").map(i=>i.toJson());return g(p({},super.toJson()),{tooltip:e})}render(e){let r=y.createBox(e,this.body);if(!r)return null;let i=new K({parent:e,mathstyle:"displaystyle"},{fontSize:Ui}),n=Tr(qt(new w(this.tooltip.render(i),{classes:"ML__tooltip-content"}),i)),o=new w([n,r],{classes:"ML__tooltip-container"});return this.caret&&(o.caret=this.caret),this.bind(e,o)}};var xt=class t extends y{constructor(e,r){super(g(p({},r),{type:"operator",isFunction:r==null?void 0:r.isFunction})),this.value=e,this.variant=r==null?void 0:r.variant,this.variantStyle=r==null?void 0:r.variantStyle,this.subsupPlacement=r==null?void 0:r.limits}static fromJson(e){return new t(e.symbol,e)}toJson(){let e=super.toJson();return this.variant&&(e.variant=this.variant),this.variantStyle&&(e.variantStyle=this.variantStyle),this.subsupPlacement&&(e.limits=this.subsupPlacement),this.value&&(e.symbol=this.value),e}render(e){var n;let r=new w(this.value,{type:"op",mode:"math",maxFontSize:e.scalingFactor,style:{variant:this.variant,variantStyle:this.variantStyle},isSelected:this.isSelected,letterShapeStyle:e.letterShapeStyle}),i=r;if(this.superscript||this.subscript){let o=(n=this.subsupPlacement)!=null?n:"auto";i=o==="over-under"||o==="auto"&&e.isDisplayStyle?this.attachLimits(e,{base:r}):this.attachSupsub(e,{base:r})}return new w(this.bind(e,i),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"ML__op-group"}).wrap(e)}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;let r=ne(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,e);let i=[this.command];return this.explicitSubsupPlacement&&(this.subsupPlacement==="over-under"&&i.push("\\limits"),this.subsupPlacement==="adjacent"&&i.push("\\nolimits"),this.subsupPlacement==="auto"&&i.push("\\displaylimits")),i.push(this.supsubToLatex(e)),P(i)}};function yt(t){if(ee(t))return t.map(i=>yt(i));if(typeof t=="string")return y.fromJson(t);t=p({},t);for(let i of Pr)t[i]&&(t[i]=yt(t[i]));t.args&&(t.args=cg(t.args)),t.array&&(t.array=yt(t.array));let e=t.type,r;e==="accent"&&(r=Ir.fromJson(t)),e==="array"&&(r=z.fromJson(t)),e==="box"&&(r=ot.fromJson(t)),e==="chem"&&(r=eo.fromJson(t)),e==="composition"&&(r=nn.fromJson(t)),e==="delim"&&(r=cn.fromJson(t)),e==="enclose"&&(r=lr.fromJson(t)),e==="error"&&(r=ft.fromJson(t)),e==="extensible-symbol"&&(r=di.fromJson(t)),e==="genfrac"&&(r=gt.fromJson(t)),e==="group"&&(r=on.fromJson(t)),e==="latex"&&(r=pe.fromJson(t)),e==="latexgroup"&&(r=Ft.fromJson(t)),e==="leftright"&&(r=J.fromJson(t)),e==="macro"&&(r=an.fromJson(t)),e==="macro-argument"&&(r=rs.fromJson(t)),e==="operator"&&(r=xt.fromJson(t)),e==="overlap"&&(r=bt.fromJson(t)),e==="overunder"&&(r=Ae.fromJson(t)),e==="placeholder"&&(r=Le.fromJson(t)),e==="prompt"&&(r=sn.fromJson(t)),e==="phantom"&&(r=$t.fromJson(t)),e==="sizeddelim"&&(r=un.fromJson(t)),e==="spacing"&&(r=Vt.fromJson(t)),e==="subsup"&&(r=sr.fromJson(t)),e==="surd"&&(r=pn.fromJson(t)),e==="text"&&(r=qe.fromJson(t)),e==="tooltip"&&(r=mi.fromJson(t)),r||(!e||["first","mbin","mrel","mclose","minner","mop","mopen","mord","mpunct","root","space"].includes(e),`${e}`,r=y.fromJson(t));for(let i of Pr)t[i]&&r.setChildren(t[i],i);return t.verbatimLatex!==void 0&&(r.verbatimLatex=t.verbatimLatex),t.subsupPlacement&&(r.subsupPlacement=t.subsupPlacement),t.explicitSubsupPlacement&&(r.explicitSubsupPlacement=!0),t.isFunction&&(r.isFunction=!0),t.skipBoundary&&(r.skipBoundary=!0),t.captureSelection&&(r.captureSelection=!0),r}function cg(t){if(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(e=>e===""?null:typeof e=="object"&&"group"in e?{group:e.group.map(r=>yt(r))}:typeof e=="object"&&"atoms"in e?e.atoms.map(r=>yt(r)):e)}}function io(t,e){!t||!e||(ee(t)?t.forEach(r=>io(r,e)):typeof t=="object"&&t.applyStyle(e,{unstyledOnly:!0}))}function no(t,e,r,i){function n(a,s){for(let l of o)if(l.style[a]!==s)return!1;return!0}if(e=t.normalizeRange(e),e[0]===e[1])return!1;let o=t.getAtoms(e,{includeChildren:!0});i.operation==="toggle"&&(r.color&&n("color",r.color)&&(r.color="none",delete r.verbatimColor),r.backgroundColor&&n("backgroundColor",r.backgroundColor)&&(r.backgroundColor="none",delete r.verbatimBackgroundColor),r.fontFamily&&n("fontFamily",r.fontFamily)&&(r.fontFamily="none"),r.fontSeries&&n("fontSeries",r.fontSeries)&&(r.fontSeries="auto"),r.fontShape&&n("fontShape",r.fontShape)&&(r.fontShape="auto"),r.fontSize&&n("fontSize",r.fontSize)&&(r.fontSize=Ui),r.variant&&n("variant",r.variant)&&(r.variant="normal"),r.variantStyle&&n("variantStyle",r.variantStyle)&&(r.variantStyle=""));for(let a of o)a.applyStyle(r);return!0}function mp(t){return{up:"italic",bold:"bolditalic",italic:"italic",bolditalic:"bolditalic","":"italic"}[t!=null?t:""]}function oo(t){return{up:"up",bold:"bold",italic:void 0,bolditalic:"bold","":void 0}[t!=null?t:""]}var pp={acute:714,grave:715,dot:729,ddot:168,dddot:8411,ddddot:8412,mathring:730,tilde:126,bar:713,breve:728,check:711,hat:94,vec:8407};M(Object.keys(pp),"{body:auto}",{createAtom:t=>new Ir(g(p({},t),{body:E(t.args[0]),accentChar:pp[t.command.slice(1)]}))});M(["widehat","widecheck","widetilde"],"{body:auto}",{createAtom:t=>{let e=ml(E(t.args[0]));return new Ir(g(p({},t),{body:E(t.args[0]),svgAccent:t.command.slice(1)+(e.length>5?"4":["1","1","2","2","3","3"][e.length])}))}});M(["overarc","overparen","wideparen"],"{body:auto}",{createAtom:t=>new Ir(g(p({},t),{body:E(t.args[0]),svgAccent:"overarc"}))});M(["underarc","underparen"],"{body:auto}",{createAtom:t=>new Ae(g(p({},t),{body:E(t.args[0]),svgBelow:"underarc"}))});M("utilde","{body:auto}",{createAtom:t=>{let e=E(t.args[0]),r=ml(e),i="widetilde"+(r.length>5?"4":["1","1","2","2","3","3"][r.length]);return new Ae(g(p({},t),{body:e,svgBelow:i,boxType:oi(e)}))}});M("^","{:string}",{createAtom:t=>{var e;return new y(g(p({},t),{type:"mord",isFunction:!1,limits:"adjacent",value:t.args[0]&&(e={a:"\xE2",e:"\xEA",i:"\xEE",o:"\xF4",u:"\xFB",A:"\xC2",E:"\xCA",I:"\xCE",O:"\xD4",U:"\xDB"}[t.args[0]])!=null?e:"^"}))}});M("`","{:string}",{createAtom:t=>{var e;return new y(g(p({},t),{type:"mord",isFunction:!1,limits:"adjacent",value:t.args[0]&&(e={a:"\xE0",e:"\xE8",i:"\xEC",o:"\xF2",u:"\xF9",A:"\xC0",E:"\xC8",I:"\xCC",O:"\xD2",U:"\xD9"}[t.args[0]])!=null?e:"`"}))}});M("'","{:string}",{createAtom:t=>{var e;return new y(g(p({},t),{type:"mord",isFunction:!1,limits:"adjacent",value:t.args[0]&&(e={a:"\xE1",e:"\xE9",i:"\xED",o:"\xF3",u:"\xFA",A:"\xC1",E:"\xC9",I:"\xCD",O:"\xD3",U:"\xDA"}[t.args[0]])!=null?e:"'"}))}});M('"',"{:string}",{createAtom:t=>{var e,r;return new y(g(p({},t),{type:"mord",isFunction:!1,limits:"adjacent",value:(e=t.args)!=null&&e[0]?(r={a:"\xE4",e:"\xEB",i:"\xEF",o:"\xF6",u:"\xFC",A:"\xC4",E:"\xCB",I:"\xCB",O:"\xD6",U:"\xDC"}[t.args[0]])!=null?r:'"'+t.args[0]:'"'}))}});M(".","{:string}",{createAtom:t=>{var e,r;return new y(g(p({},t),{type:"mord",isFunction:!1,limits:"adjacent",value:(e=t.args)!=null&&e[0]?(r={a:"\u0227",e:"\u0117",i:"\u0307i",o:"\u022F",u:"\u0307u",A:"\u0226",E:"\u0116",I:"\u0130",O:"\u022E",U:"\u0307U"}[t.args[0]])!=null?r:"."+t.args[0]:"."}))}});M("=","{:string}",{createAtom:t=>{var e,r;return new y(g(p({},t),{type:"mord",isFunction:!1,limits:"adjacent",value:(e=t.args)!=null&&e[0]?(r={a:"\u0101",e:"\u0113",i:"\u012B",o:"\u014D",u:"\u016B",A:"\u0100",E:"\u0112",I:"\u012A",O:"\u014C",U:"\u016A"}[t.args[0]])!=null?r:"="+t.args[0]:"="}))}});M("~","{:string}",{createAtom:t=>{var e;return new y(g(p({type:"mord"},t),{isFunction:!1,limits:"adjacent",value:t.args[0]&&(e={n:"\xF1",N:"\xD1",a:"\xE3",o:"\xF5",A:"\xC3",O:"\xD5"}[t.args[0]])!=null?e:"\xB4"}))}});M("c","{:string}",{createAtom:t=>{var e;return new y(g(p({},t),{type:"mord",isFunction:!1,limits:"adjacent",value:t.args[0]&&(e={c:"\xE7",C:"\xC7"}[t.args[0]])!=null?e:""}))}});M("enclose","{notation:string}[style:string]{body:auto}",{createAtom:t=>{var n,o;let e=t.args,r={strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",backgroundcolor:"transparent",padding:"auto",shadow:"none",svgStrokeStyle:void 0,borderStyle:void 0,style:(n=t.style)!=null?n:{}};if(e[1]){let a=e[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(let s of a){let l=s.match(/\s*(\S+)\s+(\S+)\s+(.*)/);if(l)r.strokeWidth=l[1],r.strokeStyle=l[2],r.strokeColor=l[3];else{let c=s.match(/\s*([a-z]*)\s*=\s*"(.*)"/);c&&(c[1]==="mathbackground"?r.backgroundcolor=c[2]:c[1]==="mathcolor"?r.strokeColor=c[2]:c[1]==="padding"?r.padding=c[2]:c[1]==="shadow"&&(r.shadow=c[2]))}}r.strokeStyle==="dashed"?r.svgStrokeStyle="5,5":r.strokeStyle==="dotted"&&(r.svgStrokeStyle="1,5")}r.borderStyle=`${r.strokeWidth} ${r.strokeStyle} ${r.strokeColor}`;let i={};return((o=e[0])!=null?o:"").split(/[, ]/).filter(a=>a.length>0).forEach(a=>{i[a.toLowerCase()]=!0}),new lr(t.command,E(e[2]),i,r)}});M("cancel","{body:auto}",{createAtom:t=>{var e;return new lr(t.command,E(t.args[0]),{updiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(e=t.style)!=null?e:{}})}});M("bcancel","{body:auto}",{createAtom:t=>{var e;return new lr(t.command,E(t.args[0]),{downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(e=t.style)!=null?e:{}})}});M("xcancel","{body:auto}",{createAtom:t=>{var e;return new lr(t.command,E(t.args[0]),{updiagonalstrike:!0,downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(e=t.style)!=null?e:{}})}});Zo(["math","displaymath"],Re);Zo("center",Re);Et(["multline","multline*"],"",Re);M("displaylines","",{parse:t=>{if(t.skipWhitespace(),!t.match("<{>"))return[];let e=[],r=[];t.mathlist.length>0&&e.push([t.mathlist]),t.beginContext({tabular:!0,root:!0});do{if(t.end()||t.match("<}>"))break;t.matchColumnSeparator()||t.matchRowSeparator()?(e.push([r]),r=[]):r.push(...t.scan(n=>["<}>","&","\\cr","\\\\","\\tabularnewline"].includes(n)))}while(!0);t.endContext(),e.push([r]);let i=t.scan();return i.length>0&&e.push([i]),e},createAtom:t=>new z("lines",t.args,[],{leftDelim:".",rightDelim:".",columns:[{align:"l"}],classes:["ML__multiline_environment"],isRoot:!0,minColumns:1,maxColumns:1,minRows:1})});Et("split","",Re);Et(["gather","gather*","gathered"],"",Re);Et(["equation","equation*","subequations"],"",Re);Zo(["align","align*","eqnarray"],Re,{tabular:!0});Et(["aligned"],"",Re);Et("array","{columns:colspec}",(t,e,r,i)=>new z(t,e,r,{columns:i[0],mathstyleName:"textstyle"}));Et(["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],"[columns:colspec]",Re);Et(["smallmatrix","smallmatrix*"],"[columns:colspec]",Re);Et(["cases","dcases","rcases"],"",Re);function Re(t,e=[[[]]],r=[],i=[],n){switch(t){case"math":return new z(t,e,r,{mathstyleName:"textstyle",isRoot:!0,minColumns:1,maxColumns:1,minRows:1,maxRows:1});case"displaymath":return new z(t,e,r,{mathstyleName:"textstyle",isRoot:!0,minColumns:1,maxColumns:1,minRows:1,maxRows:1});case"center":return new z(t,e,r,{columns:[{align:"c"}],classes:["ML__center_environment"],isRoot:!0,minColumns:1,maxColumns:1,minRows:1,maxRows:1});case"multline":case"multline*":return new z(t,e,r,{columns:[{align:"m"}],leftDelim:".",rightDelim:".",isRoot:!0,minColumns:1,maxColumns:1,minRows:1});case"split":return new z(t,e,r,{columns:[{align:"r"},{align:"l"}],minColumns:2,minRows:1,isRoot:!1});case"gather":case"gather*":return new z(t,e,r,{columns:[{gap:.25},{align:"c"},{gap:0}],minColumns:1,maxColumns:1,minRows:1,isRoot:!0,classes:["ML__gather_environment"]});case"gathered":return new z(t,e,r,{columns:[{gap:.25},{align:"c"},{gap:0}],minColumns:1,maxColumns:1,minRows:1});case"equation":case"equation*":case"subequations":return new z(t,e,r,{columns:[{align:"c"}],isRoot:!0,minColumns:1,maxColumns:1,minRows:1});case"aligned":{let o=0;for(let l of e)o=Math.max(o,l.length);let a=[{gap:0},{align:"r"},{gap:.25},{align:"l"}],s=2;for(;s0&&e.push({gap:1}),e.push({align:"l"});return e}M(["overrightarrow","overleftarrow","Overrightarrow","overleftharpoon","overrightharpoon","overleftrightarrow","overlinesegment","overgroup"],"{:auto}",{createAtom:t=>{var e;return new Ae(g(p({},t),{body:E((e=t.args)==null?void 0:e[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgAbove:t.command.slice(1)}))}});M("overbrace","{:auto}",{createAtom:t=>new Ae(g(p({},t),{body:E(t.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgAbove:t.command.slice(1)}))});M(["underrightarrow","underleftarrow","underleftrightarrow","underlinesegment","undergroup"],"{:auto}",{createAtom:t=>new Ae(g(p({},t),{body:E(t.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgBelow:t.command.slice(1)}))});M(["underbrace"],"{:auto}",{createAtom:t=>new Ae(g(p({},t),{body:E(t.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgBelow:t.command.slice(1)}))});M(["xrightarrow","longrightarrow","xleftarrow","longleftarrow","xRightarrow","xLeftarrow","xleftharpoonup","xleftharpoondown","xrightharpoonup","xrightharpoondown","xlongequal","xtwoheadleftarrow","xtwoheadrightarrow","xleftrightarrow","longleftrightarrow","xLeftrightarrow","xrightleftharpoons","longrightleftharpoons","xleftrightharpoons","xhookleftarrow","xhookrightarrow","xmapsto","xtofrom","xleftrightarrows","longleftrightarrows","xRightleftharpoons","longRightleftharpoons","xLeftrightharpoons","longLeftrightharpoons"],"[:auto]{:auto}",{createAtom:t=>{var e,r,i,n,o;return new Ae(g(p({},t),{svgBody:t.command.slice(1),above:((r=E((e=t.args)==null?void 0:e[1]))==null?void 0:r.length)===0?void 0:E((i=t.args)==null?void 0:i[1]),below:(o=E((n=t.args)==null?void 0:n[0]))!=null?o:null,skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,paddedLabels:!0,boxType:"rel"}))},serialize:(t,e)=>t.command+(t.hasEmptyBranch("below")?"":`[${t.belowToLatex(e)}]`)+`{${t.aboveToLatex(e)}}${t.supsubToLatex(e)}`});M(["arccos","arcsin","arctan","arctg","arcctg","arg","ch","cos","cosh","cot","cotg","coth","ctg","cth","csc","cosec","deg","dim","exp","gcd","hom","inf","ker","lb","lg","ln","log","Pr","sec","sh","sin","sinh","sup","tan","tanh","tg","th","arcsec","arccsc","arsinh","arcosh","artanh","arcsech","arccsch"],"",{isFunction:!0,ifMode:"math",createAtom:t=>new xt(t.command.slice(1),g(p({},t),{limits:"adjacent",isFunction:!0,variant:"main",variantStyle:"up"}))});M(["liminf","limsup"],"",{ifMode:"math",createAtom:t=>new xt({"\\liminf":"lim inf","\\limsup":"lim sup"}[t.command],g(p({},t),{limits:"over-under",variant:"main"}))});M(["lim","mod"],"",{ifMode:"math",createAtom:t=>new xt(t.command.slice(1),g(p({},t),{limits:"over-under",variant:"main"}))});M(["det","max","min"],"",{ifMode:"math",isFunction:!0,createAtom:t=>new xt(t.command.slice(1),g(p({},t),{limits:"over-under",isFunction:!0,variant:"main"}))});M("ang","{:math}",{ifMode:"math",createAtom:t=>new y(g(p({},t),{body:E(t.args[0])})),serialize:(t,e)=>`\\ang{${t.bodyToLatex(e)}}`,render:(t,e)=>{let r=t.createBox(e),i=r.caret;r.caret=void 0;let n=new w("\xB0",{style:g(p({},t.style),{variant:"normal",variantStyle:"up"})});return new w([r,n],{type:"inner",isSelected:t.isSelected,caret:i})}});M("sqrt","[index:auto]{radicand:expression}",{ifMode:"math",createAtom:t=>new pn(g(p({},t),{body:E(t.args[1]),index:t.args[0]?E(t.args[0]):void 0}))});M(["frac","dfrac","tfrac","binom","dbinom","tbinom"],"{:expression}{:expression}",{ifMode:"math",createAtom:t=>{let e=p({},t),r=t.command,i=t.args;switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":e.hasBarLine=!0;break;case"\\atopfrac":e.hasBarLine=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":e.hasBarLine=!1,e.leftDelim="(",e.rightDelim=")";break;case"\\cfrac":e.hasBarLine=!0,e.continuousFraction=!0;break;default:}switch(r){case"\\dfrac":case"\\dbinom":e.mathstyleName="displaystyle";break;case"\\tfrac":case"\\tbinom":e.mathstyleName="textstyle";break;default:}return new gt(i[0]?E(i[0]):[new Le],i[1]?E(i[1]):[new Le],e)},serialize:(t,e)=>{let r=t.aboveToLatex(e),i=t.belowToLatex(e);return/^[0-9]$/.test(r)&&/^[0-9]$/.test(i)?`${t.command}${r}${i}`:W(t.command,r,i)}});M(["cfrac"],"[:string]{:expression}{:expression}",{ifMode:"math",createAtom:t=>{let e=p({},t),r=t.args;return e.hasBarLine=!0,e.continuousFraction=!0,r[0]==="r"&&(e.align="right"),r[0]==="l"&&(e.align="left"),new gt(r[1]?E(r[1]):[new Le],r[2]?E(r[2]):[new Le],e)},serialize:(t,e)=>{let r=t.aboveToLatex(e),i=t.belowToLatex(e);return W(t.command,r,i)}});M(["brace","brack"],"",{infix:!0,createAtom:t=>new gt(E(t.args[0]),E(t.args[1]),g(p({},t),{hasBarLine:!1,leftDelim:t.command==="\\brace"?"\\lbrace":"\\lbrack",rightDelim:t.command==="\\brace"?"\\rbrace":"\\rbrack"})),serialize:(t,e)=>P([t.aboveToLatex(e),t.command,t.belowToLatex(e)])});M(["over","atop","choose"],"",{infix:!0,createAtom:t=>{let e,r,i=t.args;return t.command==="\\choose"&&(e="(",r=")"),new gt(E(i[0]),E(i[1]),g(p({},t),{hasBarLine:t.command==="\\over",leftDelim:e,rightDelim:r}))},serialize:(t,e)=>P([t.aboveToLatex(e),t.command,t.belowToLatex(e)])});M(["overwithdelims","atopwithdelims"],"{numer:auto}{denom:auto}{left-delim:delim}{right-delim:delim}",{infix:!0,createAtom:t=>{var r,i;let e=t.args;return new gt(E(e[0]),E(e[1]),g(p({},t),{leftDelim:(r=e[2])!=null?r:".",rightDelim:(i=e[3])!=null?i:".",hasBarLine:!1}))},serialize:(t,e)=>`${t.aboveToLatex(e)} ${t.command}${t.leftDelim}${t.rightDelim}${t.belowToLatex(e)}`});M("pdiff","{numerator}{denominator}",{ifMode:"math",createAtom:t=>new gt(E(t.args[0]),E(t.args[1]),g(p({},t),{hasBarLine:!0,numerPrefix:"\u2202",denomPrefix:"\u2202"})),serialize:(t,e)=>P([t.aboveToLatex(e),t.command,t.belowToLatex(e)])});M(["sum","prod","bigcup","bigcap","coprod","bigvee","bigwedge","biguplus","bigotimes","bigoplus","bigodot","bigsqcup","intop"],"",{ifMode:"math",createAtom:t=>new di({coprod:"\u2210",bigvee:"\u22C1",bigwedge:"\u22C0",biguplus:"\u2A04",bigcap:"\u22C2",bigcup:"\u22C3",intop:"\u222B",prod:"\u220F",sum:"\u2211",bigotimes:"\u2A02",bigoplus:"\u2A01",bigodot:"\u2A00",bigsqcup:"\u2A06",smallint:"\u222B"}[t.command.slice(1)],g(p({},t),{limits:"auto",variant:"main"}))});M("smallint","",{ifMode:"math",createAtom:t=>new xt("\u222B",g(p({},t),{limits:"adjacent",variant:"main"}))});var fp={int:"\u222B",iint:"\u222C",iiint:"\u222D",oint:"\u222E",oiint:"\u222F",oiiint:"\u2230",intclockwise:"\u2231",varointclockwise:"\u2232",ointctrclockwise:"\u2233",intctrclockwise:"\u2A11",sqcup:"\u2294",sqcap:"\u2293",uplus:"\u228E",wr:"\u2240",amalg:"\u2A3F",Cap:"\u22D2",Cup:"\u22D3",doublecap:"\u22D2",doublecup:"\u22D3"};M(Object.keys(fp),"",{ifMode:"math",createAtom:t=>{let e=t.command,r=fp[e.slice(1)];return new di(r,g(p({},t),{limits:"adjacent",variant:{"\u22D2":"ams","\u22D3":"ams"}[r]}))}});M(["Re","Im"],"",{ifMode:"math",createAtom:t=>new xt({"\\Re":"\u211C","\\Im":"\u2111"}[t.command],g(p({},t),{limits:"adjacent",isFunction:!0,variant:"fraktur"}))});M("middle","{:delim}",{ifMode:"math",createAtom:t=>{var e;return new cn(g(p({},t),{delim:(e=t.args[0])!=null?e:"|",size:1}))}});M("the","{:value}",{createAtom:t=>new y(g(p({},t),{captureSelection:!0,verbatimLatex:null})),render:(t,e)=>{var o;let r=new K({parent:e},t.style),i="";t.isSelected&&(i+=" ML__selected");let n=r.evaluate(t.args[0]);return new w(((o=_e(n))!=null?o:"").split("").map(a=>new w(a,{type:"ord",classes:i,mode:t.mode,isSelected:t.isSelected,style:p({variant:"main"},t.style)})),{type:"lift",style:t.style,caret:t.caret,isSelected:t.isSelected,classes:i}).wrap(r)},serialize:t=>{var e;return`\\the${(e=_e(t.args[0]))!=null?e:"\\relax"}`}});M("mathtip","{:auto}{:math}",{createAtom:t=>new mi(g(p({},t),{body:E(t.args[0]),tooltip:E(t.args[1]),content:"math"})),serialize:(t,e)=>e.skipStyles?t.bodyToLatex(e):`\\mathtip{${t.bodyToLatex(e)}}{${y.serialize([t.tooltip],g(p({},e),{defaultMode:"math"}))}}`});M("texttip","{:auto}{:text}",{createAtom:t=>new mi(g(p({},t),{body:E(t.args[0]),tooltip:E(t.args[1]),content:"text"})),serialize:(t,e)=>e.skipStyles?t.bodyToLatex(e):`\\texttip{${t.bodyToLatex(e)}}{${y.serialize([t.tooltip],g(p({},e),{defaultMode:"text"}))}}`});M("error","{:math}",{createAtom:t=>new y(g(p({},t),{body:E(t.args[0])})),serialize:(t,e)=>`\\error{${t.bodyToLatex(e)}}`,render:(t,e)=>t.createBox(e,{classes:"ML__error"})});M("ensuremath","{:math}",{createAtom:t=>new y(g(p({},t),{body:E(t.args[0])})),serialize:(t,e)=>`${t.command}{${t.bodyToLatex(g(p({},e),{defaultMode:"math"}))}}`});M("color","{:value}",{applyStyle:(t,e,r,i)=>{var n,o;return g(p({},t),{verbatimColor:(n=_e(r[0]))!=null?n:void 0,color:i.toColor((o=r[0])!=null?o:{string:"red"})})}});M("textcolor","{:value}{content:auto*}",{applyStyle:(t,e,r,i)=>{var n,o;return g(p({},t),{verbatimColor:(n=_e(r[0]))!=null?n:void 0,color:i.toColor((o=r[0])!=null?o:{string:"red"})})}});M("boxed","{content:math}",{createAtom:t=>new ot(g(p({},t),{body:E(t.args[0]),framecolor:{string:"black"}}))});M("colorbox","{:value}{:text*}",{applyStyle:(t,e,r,i)=>{var n,o;return g(p({},t),{verbatimBackgroundColor:(n=_e(r[0]))!=null?n:void 0,backgroundColor:i.toBackgroundColor((o=r[0])!=null?o:{string:"yellow"})})}});M("fcolorbox","{frame-color:value}{background-color:value}{content:text}",{applyMode:"text",createAtom:t=>{var e,r;return new ot(g(p({},t),{body:E(t.args[2]),framecolor:(e=t.args[0])!=null?e:{string:"blue"},backgroundcolor:(r=t.args[1])!=null?r:{string:"yellow"}}))},serialize:(t,e)=>{var r,i;return e.skipStyles?t.bodyToLatex(g(p({},e),{defaultMode:"text"})):W(t.command,(r=_e(t.framecolor))!=null?r:"",(i=_e(t.backgroundcolor))!=null?i:"",t.bodyToLatex(g(p({},e),{defaultMode:"text"})))}});M("bbox","[:bbox]{body:auto}",{createAtom:t=>{var i;let e=t.args[0],r=E(t.args[1]);return e?new ot(g(p({},t),{body:r,padding:e.padding,border:e.border,backgroundcolor:(i=e.backgroundcolor)!=null?i:void 0})):new ot(g(p({},t),{body:r}))},serialize:(t,e)=>{var i,n;if(e.skipStyles)return t.bodyToLatex(e);let r=t.command;if(Number.isFinite(t.padding)||t.border!==void 0||t.backgroundcolor!==void 0){let o=[];t.padding&&o.push((i=_e(t.padding))!=null?i:""),t.border&&o.push(`border: ${t.border}`),t.backgroundcolor&&o.push((n=_e(t.backgroundcolor))!=null?n:""),r+=`[${o.join(",")}]`}return W(r,t.bodyToLatex(e))}});M(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"],"{:rest}",{createAtom:t=>new y(g(p({},t),{body:E(t.args[0])})),render:(t,e)=>{let r=new K({parent:e,mathstyle:t.command.slice(1)},t.style),i=y.createBox(r,t.body,{type:"lift"});return t.caret&&(i.caret=t.caret),t.bind(e,i)},serialize:(t,e)=>e.skipStyles?t.bodyToLatex(e):`{${P([t.command,t.bodyToLatex(e)])}}`});M(["tiny","scriptsize","footnotesize","small","normalsize","large","Large","LARGE","huge","Huge"],"",{applyStyle:(t,e)=>g(p({},t),{fontSize:{"\\tiny":1,"\\scriptsize":2,"\\footnotesize":3,"\\small":4,"\\normalsize":5,"\\large":6,"\\Large":7,"\\LARGE":8,"\\huge":9,"\\Huge":10}[e]})});M("fontseries","{:string}",{ifMode:"text",applyStyle:(t,e,r)=>{var i;return g(p({},t),{fontSeries:(i=r[0])!=null?i:"auto"})}});M("fontshape","{:string}",{ifMode:"text",applyStyle:(t,e,r)=>{var i;return g(p({},t),{fontShape:(i=r[0])!=null?i:"auto"})}});M("fontfamily","{:string}",{ifMode:"text",applyStyle:(t,e,r)=>{var i;return g(p({},t),{fontFamily:(i=r[0])!=null?i:"roman"})}});M("selectfont","",{ifMode:"text",applyStyle:t=>t});M("bf","{:rest*}",{applyStyle:t=>g(p({},t),{fontSeries:"b",fontShape:"n",fontFamily:"roman"})});M(["boldsymbol","bm","bold"],"{:math*}",{applyMode:"math",applyStyle:t=>g(p({},t),{variantStyle:"bold"})});M("bfseries","{:rest*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontSeries:"b"})});M("mdseries","{:rest*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontSeries:"m"})});M("upshape","{:rest*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontShape:"n"})});M("slshape","{:rest*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontShape:"sl"})});M("scshape","{:rest*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontShape:"sc"})});M("textbf","{:text*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontSeries:"b"})});M("textmd","{:text*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontSeries:"m"})});M("textup","{:text*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontShape:"n"})});M("textnormal","{:text*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontShape:"n",fontSeries:"m"})});M("textsl","{:text*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontShape:"sl"})});M("textit","{:text*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontShape:"it"})});M("textsc","{:text*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontShape:"sc"})});M("textrm","{:text*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontFamily:"roman"})});M("textsf","{:text*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontFamily:"sans-serif"})});M("texttt","{:text*}",{applyMode:"text",applyStyle:t=>g(p({},t),{fontFamily:"monospace"})});M("mathbf","{:math*}",{applyMode:"math",applyStyle:t=>g(p({},t),{variant:"normal",variantStyle:"bold"})});M("mathit","{:math*}",{applyMode:"math",applyStyle:t=>g(p({},t),{variant:"main",variantStyle:"italic"})});M("mathnormal","{:math*}",{applyMode:"math",applyStyle:t=>g(p({},t),{variant:"normal",variantStyle:"italic"})});M("mathbfit","{:math*}",{applyMode:"math",applyStyle:t=>g(p({},t),{variant:"main",variantStyle:"bolditalic"})});M("mathrm","{:math*}",{applyMode:"math",applyStyle:t=>g(p({},t),{variant:"normal",variantStyle:"up"})});M("mathsf","{:math*}",{applyMode:"math",applyStyle:t=>g(p({},t),{variant:"sans-serif",variantStyle:"up"})});M("mathtt","{:math*}",{applyMode:"math",applyStyle:t=>g(p({},t),{variant:"monospace",variantStyle:"up"})});M("it","{:rest*}",{applyStyle:t=>g(p({},t),{fontSeries:"m",fontShape:"it",fontFamily:"roman",variantStyle:"italic"})});M("rmfamily","{:rest*}",{applyStyle:t=>g(p({},t),{fontFamily:"roman"})});M("sffamily","{:rest*}",{applyStyle:t=>g(p({},t),{fontFamily:"sans-serif"})});M("ttfamily","{:rest*}",{applyStyle:t=>g(p({},t),{fontFamily:"monospace"})});M(["Bbb","mathbb"],"{:math*}",{applyStyle:t=>g(p({},t),{variant:"double-struck",variantStyle:oo(t.variantStyle)})});M(["frak","mathfrak"],"{:math*}",{applyStyle:t=>g(p({},t),{variant:"fraktur",variantStyle:oo(t.variantStyle)})});M("mathcal","{:math*}",{applyStyle:t=>g(p({},t),{variant:"calligraphic",variantStyle:oo(t.variantStyle)})});M("mathscr","{:math*}",{applyStyle:t=>g(p({},t),{variant:"script",variantStyle:oo(t.variantStyle)})});M("mbox","{:text}",{ifMode:"math",createAtom:t=>new y(g(p({},t),{type:"mord",body:E(t.args[0]),mode:"math"})),serialize:(t,e)=>W("\\mbox",t.bodyToLatex(g(p({},e),{defaultMode:"text"})))});M("text","{:text}",{ifMode:"math",applyMode:"text"});M(["class","htmlClass"],"{name:string}{content:auto*}",{createAtom:t=>new y(g(p({},t),{type:"mord",body:E(t.args[1])})),serialize:(t,e)=>!t.args[0]||e.skipStyles?t.bodyToLatex(e):`${t.command}{${t.args[0]}}{${t.bodyToLatex(e)}}`,render:(t,e)=>{var r;return t.createBox(e,{classes:(r=t.args[0])!=null?r:"",boxType:"lift"})}});M(["cssId","htmlId"],"{id:string}{content:auto*}",{createAtom:t=>new y(g(p({},t),{type:"mord",body:E(t.args[1])})),serialize:(t,e)=>{var r;return!((r=t.args)!=null&&r[0])||e.skipStyles?t.bodyToLatex(e):`${t.command}{${t.args[0]}}{${t.bodyToLatex(e)}}`},render:(t,e)=>{var i;let r=t.createBox(e);return r.cssId=(i=t.args[0])!=null?i:"",r}});M("htmlData","{data:string}{content:auto*}",{createAtom:t=>new y(g(p({},t),{type:"mord",body:E(t.args[1])})),serialize:(t,e)=>{var r;return!((r=t.args)!=null&&r[0])||e.skipStyles?t.bodyToLatex(e):`\\htmlData{${t.args[0]}}{${t.bodyToLatex(e)}}`},render:(t,e)=>{var i;let r=t.createBox(e);return r.htmlData=(i=t.args[0])!=null?i:"",r}});M(["style","htmlStyle"],"{data:string}{content:auto*}",{createAtom:t=>new y(g(p({},t),{type:"mord",body:E(t.args[1])})),serialize:(t,e)=>{var r;return!((r=t.args)!=null&&r[0])||e.skipStyles?t.bodyToLatex(e):`${t.command}{${t.args[0]}}{${t.bodyToLatex(e)}}`},render:(t,e)=>{var i;let r=t.createBox(e);return r.htmlStyle=(i=t.args[0])!=null?i:"",r}});M("href","{url:string}{content:auto*}",{createAtom:t=>new y(g(p({},t),{type:"mord",body:E(t.args[1])})),render:(t,e)=>{var n;let r=t.createBox(e),i=(n=t.args[0])!=null?n:"";return i&&(r.htmlData=`href=${i}`),r}});M("em","{:rest}",{createAtom:t=>new y(g(p({},t),{body:E(t.args[0])})),serialize:(t,e)=>e.skipStyles?t.bodyToLatex(e):`{\\em ${t.bodyToLatex(e)}}`,render:(t,e)=>t.createBox(e,{classes:"ML__emph",boxType:"lift"})});M("emph","{:auto}",{createAtom:t=>new y(g(p({},t),{body:E(t.args[1])})),serialize:(t,e)=>e.skipStyles?t.bodyToLatex(e):`\\emph{${t.bodyToLatex(e)}}`,render:(t,e)=>t.createBox(e,{classes:"ML__emph",boxType:"lift"})});var gp={"\\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}};M(["bigl","Bigl","biggl","Biggl","bigr","Bigr","biggr","Biggr","bigm","Bigm","biggm","Biggm","big","Big","bigg","Bigg"],"{:delim}",{createAtom:t=>{var e;return new un(g(p({},t),{delim:(e=t.args[0])!=null?e:".",size:gp[t.command].size,delimType:gp[t.command].mclass}))},serialize:(t,e)=>P([t.command,/^[a-zA-Z]/.test(t.value)?`{${t.value}}`:t.value])});M(["hspace","hspace*"],"{width:value}",{createAtom:t=>{var e;return new Vt(g(p({},t),{width:(e=t.args[0])!=null?e:{dimension:0}}))}});M(["mkern","kern","mskip","hskip","mspace"],"{width:value}",{createAtom:t=>{var e;return new Vt(g(p({},t),{width:(e=t.args[0])!=null?e:{dimension:0}}))}});M("mathchoice","{:math}{:math}{:math}{:math}",{createAtom:t=>new y(t),render:(t,e)=>{let r=0,i=e.mathstyle.id;(i===Zn||i===Or)&&(r=1),(i===ai||i===Ve)&&(r=2),(i===Br||i===Ee)&&(r=3);let n=E(t.args[r]);return y.createBox(e,n)},serialize:(t,e)=>`\\mathchoice{${y.serialize(t.args[0],e)}}{${y.serialize(t.args[1],e)}}{${y.serialize(t.args[2],e)}}{${y.serialize(t.args[3],e)}}`});M("mathop","{:auto}",{createAtom:t=>new y(g(p({},t),{type:"mop",body:E(t.args[0]),limits:"over-under",isFunction:!0,captureSelection:!0})),render:(t,e)=>{var i;let r=y.createBox(e,t.body);if(t.superscript||t.subscript){let n=(i=t.subsupPlacement)!=null?i:"auto";r=n==="over-under"||n==="auto"&&e.isDisplayStyle?t.attachLimits(e,{base:r}):t.attachSupsub(e,{base:r})}return t.caret&&(r.caret=t.caret),new w(t.bind(e,r),{type:"op",isSelected:t.isSelected,classes:"ML__op-group"})},serialize:(t,e)=>{let r=[W(t.command,t.bodyToLatex(e))];return t.explicitSubsupPlacement&&(t.subsupPlacement==="over-under"&&r.push("\\limits"),t.subsupPlacement==="adjacent"&&r.push("\\nolimits"),t.subsupPlacement==="auto"&&r.push("\\displaylimits")),r.push(t.supsubToLatex(e)),P(r)}});M(["mathbin","mathrel","mathopen","mathclose","mathpunct","mathord","mathinner"],"{:auto}",{createAtom:t=>new y(g(p({},t),{type:{"\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[t.command],body:E(t.args[0])}))});M(["operatorname","operatorname*"],"{operator:math}",{createAtom:t=>{let e=E(t.args[0]).map(r=>{var i;return r.type!=="first"&&(r.type="mord",r.value=(i={"\u2217":"*","\u2212":"-"}[r.value])!=null?i:r.value,r.isFunction=!1,!r.style.variant&&!r.style.variantStyle&&(r.style.variant="main",r.style.variantStyle="up")),r});return new y(g(p({},t),{type:"mop",body:e,isFunction:!0,limits:t.command==="\\operatorname"?"adjacent":"over-under"}))},render:(t,e)=>{var i;let r=y.createBox(e,t.body);if(t.superscript||t.subscript){let n=(i=t.subsupPlacement)!=null?i:"auto";r=n==="over-under"||n==="auto"&&e.isDisplayStyle?t.attachLimits(e,{base:r}):t.attachSupsub(e,{base:r})}return t.caret&&(r.caret=t.caret),new w(t.bind(e,r),{type:"op",isSelected:t.isSelected,classes:"ML__op-group"})},serialize:(t,e)=>{let r=[W(t.command,t.bodyToLatex(e))];return t.explicitSubsupPlacement&&(t.subsupPlacement==="over-under"&&r.push("\\limits"),t.subsupPlacement==="adjacent"&&r.push("\\nolimits"),t.subsupPlacement==="auto"&&r.push("\\displaylimits")),r.push(t.supsubToLatex(e)),P(r)}});M(["char","unicode"],"{charcode:value}",{createAtom:t=>new y(g(p({},t),{type:t.mode==="text"?"text":"mord"})),serialize:t=>{var e;return`${t.command}${_e((e=t.args[0])!=null?e:{number:10067,base:"hexadecimal"})}`},render:(t,e)=>{let r=e.evaluate(t.args[0]);return(!r||!("number"in r))&&(r={number:10067,base:"hexadecimal"}),t.value=String.fromCodePoint(r.number),t.createBox(e)}});M("rule","[raise:value]{width:value}{thickness:value}",{createAtom:t=>new y(t),render:(t,e)=>{var s,l,c;let r=new K({parent:e,mathstyle:"textstyle"},t.style),i=r.toEm((s=t.args[0])!=null?s:{dimension:0}),n=r.toEm((l=t.args[1])!=null?l:{dimension:10}),o=r.toEm((c=t.args[2])!=null?c:{dimension:10}),a=new w(null,{classes:"ML__rule",type:"ord"});return a.width=n,a.height=o+i,a.depth=-i,a.setStyle("border-right-width",n,"em"),a.setStyle("border-top-width",o,"em"),a.setStyle("border-color",t.style.color),a.setStyle("vertical-align",i,"em"),t.isSelected&&a.setStyle("opacity","50%"),t.bind(r,a),t.caret&&(a.caret=t.caret),a.wrap(e)},serialize:t=>`\\rule${t.args[0]?`[${_e(t.args[0])}]`:""}{${_e(t.args[1])}}{${_e(t.args[2])}}`});M(["overline","underline"],"{:auto}",{createAtom:t=>new y(g(p({},t),{body:E(t.args[0])})),render:(t,e)=>{let r=t.command.substring(1),i=new K({parent:e,mathstyle:"cramp"},t.style),n=y.createBox(i,t.body);if(!n)return null;let o=i.metrics.defaultRuleThickness/i.scalingFactor,a=new w(null,{classes:r+"-line"});a.height=o,a.maxFontSize=o*1.125*i.scalingFactor;let s;return r==="overline"?s=new te({shift:0,children:[{box:n},3*o,{box:a},o]}):s=new te({top:n.height,children:[o,{box:a},3*o,{box:n}]}),t.caret&&(s.caret=t.caret),new w(s,{classes:r,type:"ignore"})}});M("overset","{:auto}{base:auto}",{createAtom:t=>{let e=E(t.args[1]);return new Ae(g(p({},t),{above:E(t.args[0]),body:e,skipBoundary:!1,boxType:oi(e)}))},serialize:(t,e)=>W(t.command,t.aboveToLatex(e),t.bodyToLatex(e))});M("underset","{:auto}{base:auto}",{createAtom:t=>{let e=E(t.args[1]);return new Ae(g(p({},t),{below:E(t.args[0]),body:e,skipBoundary:!1,boxType:oi(e)}))},serialize:(t,e)=>W(t.command,t.belowToLatex(e),t.bodyToLatex(e))});M("overunderset","{above:auto}{below:auto}{base:auto}",{createAtom:t=>{let e=E(t.args[2]);return new Ae(g(p({},t),{above:E(t.args[0]),below:E(t.args[1]),body:e,skipBoundary:!1,boxType:oi(e)}))},serialize:(t,e)=>W(t.command,t.belowToLatex(e),t.bodyToLatex(e))});M(["stackrel","stackbin"],"[below:auto]{above:auto}{base:auto}",{createAtom:t=>new Ae(g(p({},t),{body:E(t.args[2]),above:E(t.args[1]),below:E(t.args[0]),skipBoundary:!1,boxType:t.command==="\\stackrel"?"rel":"bin"})),serialize:(t,e)=>W(t.command,t.aboveToLatex(e),t.bodyToLatex(e))});M("smash","[:string]{:auto}",{createAtom:t=>{var e,r,i,n;return new $t(g(p({},t),{body:E(t.args[1]),smashHeight:(r=(e=t.args[0])==null?void 0:e.includes("t"))!=null?r:!0,smashDepth:(n=(i=t.args[0])==null?void 0:i.includes("b"))!=null?n:!0}))}});M("vphantom","{:auto}",{createAtom:t=>new $t(g(p({},t),{body:E(t.args[0]),isInvisible:!0,smashWidth:!0}))});M("hphantom","{:auto}",{createAtom:t=>new $t(g(p({},t),{body:E(t.args[0]),isInvisible:!0,smashHeight:!0,smashDepth:!0}))});M("phantom","{:auto}",{createAtom:t=>new $t(g(p({},t),{body:E(t.args[0]),isInvisible:!0}))});M("mathstrut","",{createAtom:t=>new $t(g(p({},t),{body:[new y({value:"("})],isInvisible:!0}))});M("not","{:math}",{createAtom:t=>{let e=E(t.args[0]);return e.length===0?new y(g(p({},t),{type:"mrel",value:"\uE020"})):new y(g(p({},t),{body:[new bt(g(p({},t),{body:"\uE020",align:"right"})),...e],captureSelection:!0}))},serialize:(t,e)=>{let r=t.args[0],i=r&&typeof r=="object"&&"group"in r;return t.value!=="\uE020"?i?`\\not{${y.serialize(r.group,e)}}`:`\\not${y.serialize(r,e)}`:i?"\\not{}":"\\not"},render:(t,e)=>{if(t.value)return t.createBox(e);let i=t.args[0]&&typeof t.args[0]=="object"&&"group"in t.args[0]?"ord":oi(E(t.args[0])),n=y.createBox(e,t.body,{type:i});return t.caret&&(n.caret=t.caret),t.bind(e,n)}});M(["ne","neq"],"",{createAtom:t=>new y(g(p({},t),{type:"mrel",body:[new bt(g(p({},t),{body:"\uE020",align:"right",boxType:"rel"})),new y(g(p({},t),{value:"="}))],captureSelection:!0})),serialize:t=>t.command});M("rlap","{:auto}",{createAtom:t=>new bt(g(p({},t),{body:E(t.args[0]),align:"right"}))});M("llap","{:auto}",{createAtom:t=>new bt(g(p({},t),{body:E(t.args[0]),align:"left"}))});M("mathrlap","{:math}",{createAtom:t=>new bt(g(p({},t),{body:E(t.args[0]),align:"right"}))});M("mathllap","{:math}",{createAtom:t=>new bt(g(p({},t),{body:E(t.args[0]),align:"left"}))});M("raisebox","{:value}{:text}",{createAtom:t=>{var e;return new ot(g(p({},t),{body:E(t.args[1]),padding:{dimension:0},offset:(e=t.args[0])!=null?e:{dimension:0}}))},serialize:(t,e)=>{var r;return W("\\raisebox",(r=_e(t.offset))!=null?r:"0pt",t.bodyToLatex(e))}});M("raise","{:value}{:auto}",{createAtom:t=>{var e;return new ot(g(p({},t),{body:E(t.args[1]),padding:{dimension:0},offset:(e=t.args[0])!=null?e:{dimension:0}}))},serialize:(t,e)=>{var r;return W("\\raise",(r=_e(t.offset))!=null?r:"0pt",t.bodyToLatex(e))}});M("lower","{:value}{:auto}",{createAtom:t=>{var e;return new ot(g(p({},t),{body:E(t.args[1]),padding:{dimension:0},offset:(e=ht(t.args[0],-1))!=null?e:{dimension:0}}))},serialize:(t,e)=>{var r,i;return W("\\lower",(i=_e(ht((r=t.offset)!=null?r:{dimension:0},-1)))!=null?i:"0pt",t.bodyToLatex(e))}});Me("0123456789/@.?!");dl(65,90);dl(97,122);Me([["\\forall",8704],["\\exists",8707],["\\nexists",8708,"mord","ams"],["\\mid",8739,"mrel"],["\\top",8868],["\\bot",8869]]);Me([["\\#",35],["\\&",38],["\\parallelogram",9649],["\\spadesuit",9824],["\\heartsuit",9825],["\\diamondsuit",9826],["\\clubsuit",9827],["\\flat",9837],["\\natural",9838],["\\sharp",9839]]);Me([["\\backslash",92],["\\nabla",8711],["\\partial",8706],["\\ell",8467],["\\hbar",8463],["\\pounds",163],["\\euro",8364]]);Me([["\\rightarrow",8594],["\\to",8594],["\\leftarrow",8592],["\\gets",8592],["\\Rightarrow",8658],["\\Leftarrow",8656],["\\longrightarrow",10230],["\\longleftarrow",10229],["\\Longrightarrow",10233],["\\implies",10233],["\\Longleftarrow",10232],["\\impliedby",10232],["\\longleftrightarrow",10231],["\\biconditional",10231],["\\Longleftrightarrow",10234],["\\mapsto",8614],["\\longmapsto",10236],["\\uparrow",8593],["\\downarrow",8595],["\\Uparrow",8657],["\\Downarrow",8659],["\\updownarrow",8597],["\\Updownarrow",8661],["\\hookrightarrow",8618],["\\hookleftarrow",8617],["\\rightharpoonup",8640],["\\leftharpoonup",8636],["\\rightharpoondown",8641],["\\leftharpoondown",8637],["\\searrow",8600],["\\nearrow",8599],["\\swarrow",8601],["\\nwarrow",8598],["\\originalof",8886],["\\laplace",8886],["\\imageof",8887],["\\Laplace",8887]],"mrel");Me([["\\mapsfrom",8612,"mrel"],["\\Mapsfrom",10502,"mrel"],["\\MapsTo",10503,"mrel"],["\\Yup",8516,"mord"],["\\lightning",8623,"mrel"],["\\leftarrowtriangle",8701,"mrel"],["\\rightarrowtriangle",8702,"mrel"],["\\leftrightarrowtriangle",8703,"mrel"],["\\boxdot",8865,"mbin"],["\\bigtriangleup",9651,"mbin"],["\\bigtriangledown",9661,"mbin"],["\\boxbar",9707,"mbin"],["\\Lbag",10181,"mopen"],["\\Rbag",10182,"mclose"],["\\llbracket",10214,"mopen"],["\\rrbracket",10215,"mclose"],["\\longmapsfrom",10235,"mrel"],["\\Longmapsfrom",10237,"mrel"],["\\Longmapsto",10238,"mrel"],["\\boxslash",10692,"mbin"],["\\boxbslash",10693,"mbin"],["\\boxast",10694,"mbin"],["\\boxcircle",10695,"mbin"],["\\boxbox",10696,"mbin"],["\\fatsemi",10783,"mop"],["\\leftslice",10918,"mrel"],["\\rightslice",10919,"mrel"],["\\interleave",10996,"mbin"],["\\biginterleave",11004,"mop"],["\\sslash",11005,"mbin"],["\\talloblong",11006,"mbin"]]);Me([["\\lbrace",123,"mopen"],["\\rbrace",125,"mclose"],["\\lparen",40,"mopen"],["\\rparen",41,"mclose"],["\\langle",10216,"mopen"],["\\rangle",10217,"mclose"],["\\lfloor",8970,"mopen"],["\\rfloor",8971,"mclose"],["\\lceil",8968,"mopen"],["\\rceil",8969,"mclose"],["\\vert",8739],["\\lvert",8739,"mopen"],["\\rvert",8739,"mclose"],["\\|",8741],["\\Vert",8741],["\\mVert",8741],["\\lVert",8741,"mopen"],["\\rVert",8741,"mclose"],["\\lbrack",91,"mopen"],["\\rbrack",93,"mclose"],["\\{",123,"mopen"],["\\}",125,"mclose"],["(",40,"mopen"],[")",41,"mclose"],["[",91,"mopen"],["]",93,"mclose"],["\\ulcorner",9484,"mopen","ams"],["\\urcorner",9488,"mclose","ams"],["\\llcorner",9492,"mopen","ams"],["\\lrcorner",9496,"mclose","ams"],["\\lgroup",10222,"mopen"],["\\rgroup",10223,"mclose"],["\\lmoustache",9136,"mopen"],["\\rmoustache",9137,"mclose"]]);Me([["\\dashrightarrow",8674],["\\dashleftarrow",8672],["\\Rrightarrow",8667],["\\Lleftarrow",8666],["\\leftrightarrows",8646],["\\rightleftarrows",8644],["\\curvearrowright",8631],["\\curvearrowleft",8630],["\\rightrightarrows",8649],["\\leftleftarrows",8647],["\\upuparrows",8648],["\\downdownarrows",8650],["\\vartriangle",9651],["\\triangleq",8796],["\\vartriangleleft",8882],["\\trianglelefteq",8884],["\\ntriangleleft",8938],["\\ntrianglelefteq",8940],["\\vartriangleright",8883],["\\trianglerighteq",8885],["\\ntriangleright",8939],["\\ntrianglerighteq",8941],["\\blacktriangleleft",9664],["\\blacktriangleright",9654],["\\leftarrowtail",8610],["\\rightarrowtail",8611],["\\looparrowright",8620],["\\looparrowleft",8619],["\\twoheadleftarrow",8606],["\\twoheadrightarrow",8608],["\\twoheadrightarrowtail",10518],["\\rightleftharpoons",8652],["\\leftrightharpoons",8651],["\\Rsh",8625],["\\Lsh",8624],["\\circlearrowright",8635],["\\circlearrowleft",8634],["\\restriction",8638],["\\upharpoonright",8638],["\\upharpoonleft",8639],["\\downharpoonright",8642],["\\downharpoonleft",8643],["\\rightsquigarrow",8669],["\\leadsto",8669],["\\leftrightsquigarrow",8621],["\\multimap",8888],["\\nleftarrow",8602],["\\nrightarrow",8603],["\\nRightarrow",8655],["\\nLeftarrow",8653],["\\nleftrightarrow",8622],["\\nLeftrightarrow",8654],["\\nvrightarrow",8696],["\\nvtwoheadrightarrow",10496],["\\nvrightarrowtail",10516],["\\nvtwoheadrightarrowtail",10519],["\\shortparallel",8741],["\\nless",8814],["\\nleqslant",57360],["\\lneq",10887],["\\lneqq",8808],["\\nleqq",57361],["\\lvertneqq",57356],["\\lnsim",8934],["\\lnapprox",10889],["\\nprec",8832],["\\npreceq",8928],["\\precnsim",8936],["\\precnapprox",10937],["\\nsim",8769],["\\nshortmid",57350],["\\nmid",8740],["\\nvdash",8876],["\\nvDash",8877],["\\ngtr",8815],["\\ngeqslant",57359],["\\ngeqq",57358],["\\gneq",10888],["\\gneqq",8809],["\\gvertneqq",57357],["\\gnsim",8935],["\\gnapprox",10890],["\\nsucc",8833],["\\nsucceq",8929],["\\succnsim",8937],["\\succnapprox",10938],["\\ncong",8774],["\\nshortparallel",57351],["\\nparallel",8742],["\\nVDash",8879],["\\nsupseteqq",57368],["\\supsetneq",8843],["\\varsupsetneq",57371],["\\supsetneqq",10956],["\\varsupsetneqq",57369],["\\nVdash",8878],["\\precneqq",10933],["\\succneqq",10934],["\\nsubseteqq",57366],["\\leqslant",10877],["\\geqslant",10878],["\\gtrsim",8819],["\\approxeq",8778],["\\thickapprox",8776],["\\lessapprox",10885],["\\gtrapprox",10886],["\\precapprox",10935],["\\succapprox",10936],["\\thicksim",8764],["\\succsim",8831],["\\precsim",8830],["\\backsim",8765],["\\eqsim",8770],["\\backsimeq",8909],["\\lesssim",8818],["\\nleq",8816],["\\ngeq",8817],["\\smallsmile",8995],["\\smallfrown",8994],["\\leqq",8806],["\\eqslantless",10901],["\\lll",8920],["\\lessgtr",8822],["\\lesseqgtr",8922],["\\lesseqqgtr",10891],["\\risingdotseq",8787],["\\fallingdotseq",8786],["\\subseteqq",10949],["\\Subset",8912],["\\sqsubset",8847],["\\preccurlyeq",8828],["\\curlyeqprec",8926],["\\vDash",8872],["\\Vvdash",8874],["\\bumpeq",8783],["\\Bumpeq",8782],["\\geqq",8807],["\\eqslantgtr",10902],["\\ggg",8921],["\\gtrless",8823],["\\gtreqless",8923],["\\gtreqqless",10892],["\\supseteqq",10950],["\\Supset",8913],["\\sqsupset",8848],["\\succcurlyeq",8829],["\\curlyeqsucc",8927],["\\Vdash",8873],["\\shortmid",8739],["\\between",8812],["\\pitchfork",8916],["\\varpropto",8733],["\\backepsilon",8717],["\\llless",8920],["\\gggtr",8921],["\\doteqdot",8785],["\\Doteq",8785],["\\eqcirc",8790],["\\circeq",8791],["\\therefore",8756],["\\because",8757]],"mrel","ams");Me([["+",43],["-",8722],["\u2212",8722],["\\pm",177],["\\mp",8723],["*",8727],["\\times",215],["\\div",247],["\\divides",8739],["\\cdot",8901],["\\cap",8745],["\\cup",8746],["\\setminus",8726],["\\land",8743],["\\wedge",8743],["\\lor",8744],["\\vee",8744],["\\circ",8728],["\\bigcirc",9711],["\\bullet",8729],["\\oplus",8853],["\\ominus",8854],["\\otimes",8855],["\\odot",8857],["\\oslash",8856],["\\bigtriangleup",9651],["\\bigtriangledown",9661],["\\triangleleft",9667],["\\triangleright",9657],["\\And",38],["\\dagger",8224],["\\dag",8224],["\\ddag",8225],["\\ddagger",8225],["\\ast",8727],["\\star",8902],["\\bigstar",9733],["\\diamond",8900]],"mbin");Me([["\\lhd",8882],["\\rhd",8883],["\\lessdot",8918],["\\gtrdot",8919],["\\ltimes",8905],["\\rtimes",8906],["\\leftthreetimes",8907],["\\rightthreetimes",8908],["\\intercal",8890],["\\dotplus",8724],["\\doublebarwedge",10846],["\\divideontimes",8903],["\\centerdot",8901],["\\smallsetminus",8726],["\\barwedge",8892],["\\veebar",8891],["\\nor",8891],["\\curlywedge",8911],["\\curlyvee",8910],["\\boxminus",8863],["\\boxplus",8862],["\\boxtimes",8864],["\\boxdot",8865],["\\circleddash",8861],["\\circledast",8859],["\\circledcirc",8858],["\\unlhd",8884],["\\unrhd",8885]],"mbin","ams");Me([["\\surd",8730],["\\S",167],["\\infty",8734],["\\prime",8242],["\\doubleprime",8243],["\\angle",8736],["`",8216],["\\$",36],["\\%",37],["\\_",95],["\\alpha",945],["\\beta",946],["\\gamma",947],["\\delta",948],["\\epsilon",1013],["\\varepsilon",949],["\\zeta",950],["\\eta",951],["\\theta",952],["\\vartheta",977],["\\iota",953],["\\kappa",954],["\\varkappa",1008,"mord","ams"],["\\lambda",955],["\\mu",956],["\\nu",957],["\\xi",958],["\\omicron",111],["\\pi",960],["\\varpi",982],["\\rho",961],["\\varrho",1009],["\\sigma",963],["\\varsigma",962],["\\tau",964],["\\phi",981],["\\varphi",966],["\\upsilon",965],["\\chi",967],["\\psi",968],["\\omega",969],["\\Gamma",915],["\\Delta",916],["\\Theta",920],["\\Lambda",923],["\\Xi",926],["\\Pi",928],["\\Sigma",931],["\\Upsilon",933],["\\Phi",934],["\\Psi",936],["\\Omega",937],["\\digamma",989,"mord","ams"],["\\varkappa",1008,"mord","ams"],["\\coppa",985,"mord","ams"],["\\koppa",985,"mord","ams"],["\\Coppa",984,"mord","ams"],["\\Koppa",984,"mord","ams"],["\\sampi",993,"mord","ams"],["\\Sampi",992,"mord","ams"],["\\emptyset",8709]]);Me([["=",61],["<",60],["\\lt",60],[">",62],["\\gt",62],["\\le",8804],["\\leq",8804],["\\ge",8805],["\\geq",8805],["\\ll",8810],["\\gg",8811],["\\coloneq",8788],["\\coloneqq",8788],["\\colonequals",8788],["\\measeq",8797],["\\eqdef",8798],["\\questeq",8799],[":",58],["\\cong",8773],["\\equiv",8801],["\\prec",8826],["\\preceq",10927],["\\succ",8827],["\\succeq",10928],["\\perp",10178],["\\propto",8733],["\\Colon",8759],["\\smile",8995],["\\frown",8994],["\\sim",8764],["\\doteq",8784],["\\bowtie",8904],["\\Join",8904],["\\asymp",8781],["\\sqsubseteq",8849],["\\sqsupseteq",8850],["\\approx",8776],["\\~",126],["\\leftrightarrow",8596],["\\Leftrightarrow",8660],["\\models",8872],["\\vdash",8866],["\\dashv",8867],["\\roundimplies",10608],["\\in",8712],["\\notin",8713],["\\ni",8715],["\\owns",8715],["\\subset",8834],["\\supset",8835],["\\subseteq",8838],["\\supseteq",8839],["\\differencedelta",8710],["\\mvert",8739],["\\parallel",8741],["\\simeq",8771]],"mrel");Me([["\\lnot",172],["\\neg",172],["\\triangle",9651],["\\subsetneq",8842],["\\varsubsetneq",57370],["\\subsetneqq",10955],["\\varsubsetneqq",57367],["\\nsubset",8836],["\\nsupset",8837],["\\nsubseteq",8840],["\\nsupseteq",8841]],"mrel","ams");Me([["\\wp",8472],["\\aleph",8501]]);Me([["\\blacktriangle",9650],["\\hslash",8463],["\\Finv",8498],["\\Game",8513],["\\eth",240],["\\mho",8487],["\\Bbbk",107],["\\yen",165],["\\square",9633],["\\Box",9633],["\\blacksquare",9632],["\\circledS",9416],["\\circledR",174],["\\triangledown",9661],["\\blacktriangledown",9660],["\\checkmark",10003],["\\diagup",9585],["\\measuredangle",8737],["\\sphericalangle",8738],["\\backprime",8245],["\\backdoubleprime",8246],["\\Diamond",9674],["\\lozenge",9674],["\\blacklozenge",10731],["\\varnothing",8709],["\\complement",8705],["\\maltese",10016],["\\beth",8502],["\\daleth",8504],["\\gimel",8503]],"mord","ams");Me([["\\ ",160],["~",160]],"space");M(["!",",",":",";",">","enskip","enspace","quad","qquad"],"",{createAtom:t=>new Vt(t)});M("space","",{createAtom:t=>new Vt(t)});Me([["\\colon",58],["\\cdotp",8901],["\\vdots",8942,"mord"],["\\ldotp",46],[",",44],[";",59]],"mpunct");Me([["\\cdots",8943],["\\ddots",8945],["\\ldots",8230],["\\mathellipsis",8230]],"minner");Me([["\\/",47],["|",8739,"mord"],["\\imath",305],["\\jmath",567],["\\degree",176],["'",8242],['"',8221]]);var ss={main:["Main-Regular","ML__cmr"],"main-italic":["Main-Italic","ML__cmr ML__it"],"main-bold":["Main-Bold","ML__cmr ML__bold"],"main-bolditalic":["Main-BoldItalic","ML__cmr ML__bold ML__it"],normal:["Main-Regular","ML__cmr"],"normal-bold":["Main-Bold","ML__mathbf"],"normal-italic":["Math-Italic","ML__mathit"],"normal-bolditalic":["Math-BoldItalic","ML__mathbfit"],roman:["Main-Regular","ML__cmr"],"roman-bold":["Main-Bold","ML__mathbf"],"roman-italic":["Math-Italic","ML__mathit"],"roman-bolditalic":["Math-BoldItalic","ML__mathbfit"],ams:["AMS-Regular","ML__ams"],"ams-bold":["AMS-Regular","ML__ams ML__bold"],"ams-italic":["AMS-Regular","ML__ams ML__it"],"ams-bolditalic":["AMS-Regular","ML__ams ML__bold ML__it"],"sans-serif":["SansSerif-Regular","ML__sans"],"sans-serif-bold":["SansSerif-Regular","ML__sans ML__bold"],"sans-serif-italic":["SansSerif-Regular","ML__sans ML__it"],"sans-serif-bolditalic":["SansSerif-Regular","ML__sans ML__bold ML__it"],calligraphic:["Caligraphic-Regular","ML__cal"],"calligraphic-bold":["Caligraphic-Regular","ML__cal ML__bold"],"calligraphic-italic":["Caligraphic-Regular","ML__cal ML__it"],"calligraphic-bolditalic":["Caligraphic-Regular","ML__cal ML__bold ML__it"],script:["Script-Regular","ML__script"],"script-bold":["Script-Regular","ML__script ML__bold"],"script-italic":["Script-Regular","ML__script ML__it"],"script-bolditalic":["Script-Regular","ML__script ML__bold ML__it"],fraktur:["Fraktur-Regular","ML__frak"],"fraktur-bold":["Fraktur-Regular","ML__frak ML__bold"],"fraktur-italic":["Fraktur-Regular","ML__frak ML__it"],"fraktur-bolditalic":["Fraktur-Regular","ML__frak ML__bold ML__it"],monospace:["Typewriter-Regular","ML__tt"],"monospace-bold":["Typewriter-Regular","ML__tt ML__bold"],"monospace-italic":["Typewriter-Regular","ML__tt ML__it"],"monospace-bolditalic":["Typewriter-Regular","ML__tt ML__bold ML__it"],"double-struck":["AMS-Regular","ML__bb"],"double-struck-bold":["AMS-Regular","ML__bb ML__bold"],"double-struck-italic":["AMS-Regular","ML__bb ML_italic"],"double-struck-bolditalic":["AMS-Regular","ML__bb ML_bolditalic"]},cs={"double-struck":/^[A-Z ]$/,script:/^[A-Z ]$/,calligraphic:/^[\dA-Z ]$/,fraktur:/^[\dA-Za-z ]$|^[!"#$%&'()*+,\-./:;=?[]^’‘]$/,monospace:/^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/,"sans-serif":/^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/},bp=/^[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5]$/,ug=/^[\u0393|\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A6\u03A8\u03A9]$/,dg=[/^[a-z]$/,/^[A-Z]$/,bp,ug],mg={iso:["it","it","it","it"],tex:["it","it","it","up"],french:["it","up","up","up"],upright:["up","up","up","up"]},cc=class extends ve{constructor(){super("math")}createAtom(e,r,i){var a,s,l,c,u,m;if(r===null)return new y({type:"mord",mode:"math",command:e,value:e,style:i});let n;try{n=(l=(s=globalThis.MathfieldElement)==null?void 0:s.isFunction((a=r.command)!=null?a:e))!=null?l:!1}catch(d){n=!1}if(r.definitionType==="symbol"){let d=new y({type:(c=r.type)!=null?c:"mord",mode:"math",command:(u=r.command)!=null?u:e,value:String.fromCodePoint(r.codepoint),isFunction:n,style:i});return e.startsWith("\\")&&(d.verbatimLatex=e),d}let o=new y({type:"mord",mode:"math",command:(m=r.command)!=null?m:e,value:e,isFunction:n,style:i});return e.startsWith("\\")&&(o.verbatimLatex=e),o}serialize(e,r){let i=pg(e,g(p({},r),{defaultMode:"math"}));return i.length===0||r.defaultMode!=="text"?i:["$ ",...i," $"]}getFont(e,r){var l,c,u;if(r.variant,r.fontFamily){let m=r.fontFamily;r.fontSeries==="b"&&r.fontShape==="it"?m+="-bolditalic":r.fontSeries==="b"?m+="-bold":r.fontShape==="it"&&(m+="-italic");let d=(l=ss[m])!=null?l:ss[r.fontFamily];if(!d)return console.error(`Unknown font family variant: ${m}`),null;let[h,f]=d;return f&&(e.classes+=" "+f),h}let{variant:i}=r,{variantStyle:n}=r;if(i==="normal"&&!n&&/[\u00A3\u0131\u0237]/.test(e.value)&&(i="main",n="italic"),i==="normal"&&!n&&e.value.length===1){let m=!1;dg.forEach((d,h)=>{var f;d.test(e.value)&&mg[(f=r.letterShapeStyle)!=null?f:"tex"][h]==="it"&&(m=!0)}),m&&(n=mp(n))}n==="up"&&(n=void 0);let o=n?i+"-"+n:i;ss[o];let[a,s]=ss[o];if(cs[i]&&!cs[i].test(e.value)){let m=On(e.value,i,n);return m||(m=(c=On(e.value,i))!=null?c:e.value,e.classes+=(u={bold:" ML__bold",italic:" ML__it","bold-italic":" ML__bold ML__it"}[n!=null?n:""])!=null?u:""),e.value=m,null}return bp.test(e.value)&&(e.classes+=" lcGreek"),s&&(e.classes+=" "+s),a}};function pg(t,e){return mt(t,"bold").map(r=>{if(Va(r[0])!=="bold")return P(ls(r,e));if(Va(r[0].parent)==="bold")return P(ls(r,e));let n=P(r.map(o=>{var a;return(a=o.value)!=null?a:""}));return/^[a-zA-Z0-9]+$/.test(n)?W("\\mathbf",P(ls(r,e))):W("\\bm",P(ls(r,e)))})}function ls(t,e){let{parent:r}=t[0],i=qa(r);return mt(t,"variant").map(n=>{let o=qa(n[0]),a="";o&&o!==i&&(a={calligraphic:"\\mathcal","calligraphic-uo":"\\mathcal",fraktur:"\\mathfrak","fraktur-uo":"\\mathfrak","double-struck":"\\mathbb","double-struck-uo":"\\mathbb",script:"\\mathscr","script-uo":"\\mathscr",monospace:"\\mathtt","monospace-uo":"\\mathtt","sans-serif":"\\mathsf","sans-serif-uo":"\\mathsf",normal:"","normal-up":"\\mathrm","normal-italic":"\\mathnormal","normal-bold":"","normal-bolditalic":"\\mathbfit",ams:"","ams-up":"\\mathrm","ams-italic":"\\mathit","ams-bold":"","ams-bolditalic":"\\mathbfit",main:"","main-up":"\\mathrm","main-italic":"\\mathit","main-bold":"","main-bolditalic":"\\mathbfit"}[o]);let s="",l=n[n.length-1],c=a&&n.length>0&&(l.branch("subscript")!==void 0||l.branch("superscript")!==void 0);c&&(s=l.supsubToLatex(e));let u=P(n.map((m,d)=>{if(c&&d===n.length-1){let h=ne(m.command,m.mode);return h!=null&&h.serialize?h.serialize(m,e):m.body&&m.command?W(m.command,m.bodyToLatex(e)):m.body?m.bodyToLatex(e):!m.value||m.value==="\u200B"?"":m.command||m.value}return m._serialize(e)}));return a?W(a,u)+s:u})}new cc;function hg(t,e){return t.map(r=>r._serialize(e))}function fg(t,e){return mt(t,"fontShape").map(r=>{let i=hg(r,e),{fontShape:n}=r[0].style,o="";return n==="it"&&(o="\\textit"),n==="sl"&&(o="\\textsl"),n==="sc"&&(o="\\textsc"),n==="n"&&(o="\\textup"),!o&&n?`{${W("\\fontshape",n)}${P(i)}}`:o?W(o,P(i)):P(i)})}function gg(t,e){return mt(t,"fontSeries").map(r=>{let i=fg(r,e),{fontSeries:n}=r[0].style,o="";return n==="b"&&(o="\\textbf"),n==="l"&&(o="\\textlf"),n==="m"&&(o="\\textmd"),n&&!o?`{${W("\\fontseries",n)}${P(i)}}`:o?W(o,P(i)):P(i)})}function bg(t,e){return mt(t,"fontSize").map(r=>{var o,a;let i=gg(r,e),n=(a=["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][(o=r[0].style.fontSize)!=null?o:""])!=null?a:"";return n?`${n} ${P(i)}`:P(i)})}function yg(t,e,r){return mt(t,"fontFamily").map(i=>{var s;r=r&&!i.every(l=>l.style.fontFamily||l.style.fontShape||l.style.fontSeries||l.style.fontSize);let n=bg(i,e),{fontFamily:o}=i[0].style,a=(s={roman:"textrm",monospace:"texttt","sans-serif":"textsf"}[o!=null?o:""])!=null?s:"";return a?`\\${a}{${P(n)}}`:o?`{\\fontfamily{${i[0].style.fontFamily}} ${P(n)}}`:r?`\\text{${P(n)}}`:P(n)})}var yp={roman:"","sans-serif":"ML__sans",monospace:"ML__tt"},uc=class extends ve{constructor(){super("text")}createAtom(e,r,i){return r&&r.definitionType==="symbol"?new qe(e,String.fromCodePoint(r.codepoint),i!=null?i:{}):null}serialize(e,r){return yg(e,g(p({},r),{defaultMode:"text"}),r.defaultMode!=="text")}getFont(e,r){var n,o,a,s,l;let{fontFamily:i}=r;if(yp[i]?e.classes+=" "+yp[i]:i&&e.setStyle("font-family",i),r.fontShape&&(e.classes+=" ",e.classes+=(n={it:"ML__it",sl:"ML__shape_sl",sc:"ML__shape_sc",ol:"ML__shape_ol"}[r.fontShape])!=null?n:""),r.fontSeries){let c=r.fontSeries.match(/(.?[lbm])?(.?[cx])?/);c&&(e.classes+=" ",e.classes+=(a={ul:"ML__series_ul",el:"ML__series_el",l:"ML__series_l",sl:"ML__series_sl",m:"",sb:"ML__series_sb",b:"ML__bold",eb:"ML__series_eb",ub:"ML__series_ub"}[(o=c[1])!=null?o:""])!=null?a:"",e.classes+=" ",e.classes+=(l={uc:"ML__series_uc",ec:"ML__series_ec",c:"ML__series_c",sc:"ML__series_sc",n:"",sx:"ML__series_sx",x:"ML__series_x",ex:"ML__series_ex",ux:"ML__series_ux"}[(s=c[2])!=null?s:""])!=null?l:"")}return"Main-Regular"}};new uc;var dc=class extends ve{constructor(){super("latex")}createAtom(e){return new pe(e)}serialize(e,r){return e.filter(i=>i instanceof pe&&!i.isSuggestion).map(i=>i.value)}getFont(){return null}};new dc;function hn(t){var n;let e=/macos|ios/.test(Ct()),r=t.split("+"),i="";for(let o of r)i&&(i+=e?"\u2009":'+'),o.startsWith("[Key")?i+=o.slice(4,5):o.startsWith("Key")?i+=o.slice(3,4):o.startsWith("[Digit")?i+=o.slice(6,7):o.startsWith("Digit")?i+=o.slice(5,6):i+=(n={cmd:"\u2318",meta:e?"\u2318":"Ctrl",shift:e?"\u21E7":"Shift",alt:e?"\u2325":"Alt",ctrl:e?"\u2303":"Ctrl","\n":e?"\u23CE":"Return","[return]":e?"\u23CE":"Return","[enter]":e?"\u2324":"Enter","[tab]":e?"\u21E5":"Tab","[escape]":"Esc","[backspace]":e?"\u232B":"Backspace","[delete]":e?"\u2326":"Del","[pageup]":e?"\u21DE":"Page Up","[pagedown]":e?"\u21DF":"Page Down","[home]":e?"\u2912":"Home","[end]":e?"\u2913":"End","[space]":"Space","[equal]":"=","[minus]":"-","[comma]":",","[slash]":"/","[backslash]":"\\","[bracketleft]":"[","[bracketright]":"]",semicolon:";",period:".",comma:",",minus:"-",equal:"=",quote:"'",backslash:"\\",intlbackslash:"\\",backquote:"`",slash:"/",numpadmultiply:"* 🔢",numpaddivide:"/ 🔢",numpadsubtract:"- 🔢",numpadadd:"+ 🔢",numpaddecimal:". 🔢",numpadcomma:", 🔢",help:"help",left:"\u21E0",up:"\u21E1",right:"\u21E2",down:"\u21E3","[arrowleft]":"\u21E0","[arrowup]":"\u21E1","[arrowright]":"\u21E2","[arrowdown]":"\u21E3"}[o.toLowerCase()])!=null?n:o.toUpperCase();return i}function fn(t){if(t instanceof MouseEvent||t instanceof PointerEvent)return{x:t.clientX,y:t.clientY};if(typeof TouchEvent!="undefined"&&t instanceof TouchEvent){let e=[...t.touches].reduce((i,n)=>({x:i.x+n.clientX,y:i.y+n.clientY}),{x:0,y:0}),r=t.touches.length;return{x:e.x/r,y:e.y/r}}}function Ht(t){let e={alt:!1,control:!1,shift:!1,meta:!1};return(t instanceof MouseEvent||t instanceof PointerEvent||typeof TouchEvent!="undefined"&&t instanceof TouchEvent||t instanceof KeyboardEvent)&&(t.altKey&&(e.alt=!0),t.ctrlKey&&(e.control=!0),t.metaKey&&(e.meta=!0),t.shiftKey&&(e.shift=!0)),e}function xp(t,e){return!t&&e||t&&!e?!1:!t||!e?!0:t.alt===e.alt&&t.control===e.control&&t.shift===e.shift&&t.meta===e.meta}var xg=new Set(["Backquote","Digit0","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","Minus","Equal","IntlYen","KeyQ","KeyW","KeyE","KeyR","KeyT","KeyY","KeyU","KeyI","KeyO","KeyP","BracketLeft","BracketRight","Backslash","KeyA","KeyS","KeyD","KeyF","KeyG","KeyH","KeyJ","KeyK","KeyL","Semicolon","Quote","IntlBackslash","KeyZ","KeyX","KeyC","KeyV","KeyB","KeyN","KeyM","Comma","Period","Slash","IntlRo","Space","Numpad0","Numpad1","Numpad2","Numpad3","Numpad4","Numpad5","Numpad6","Numpad7","Numpad8","Numpad9","NumpadAdd","NumpadComma","NumpadDecimal","NumpadDivide","NumpadEqual","NumpadHash","NumpadMultiply","NumpadParenLeft","NumpadParenRight","NumpadStar","NumpadSubstract"]);function cr(t){return t.ctrlKey||t.metaKey||["Dead","Process"].includes(t.key)?!1:t.code===""?!0:xg.has(t.code)}function hi(){var e;let t=document.activeElement;for(;(e=t==null?void 0:t.shadowRoot)!=null&&e.activeElement;)t=t.shadowRoot.activeElement;return t}var Te=class t{static get scrim(){return t._scrim||(t._scrim=new t),t._scrim}static open(e){t.scrim.open(e)}static close(){t.scrim.close()}static get state(){return t.scrim.state}static get element(){return t.scrim.element}constructor(e){var r,i;this.lightDismiss=(r=e==null?void 0:e.lightDismiss)!=null?r:!0,this.translucent=(i=e==null?void 0:e.translucent)!=null?i:!1,this.state="closed"}get element(){if(this._element)return this._element;let e=document.createElement("div");return e.setAttribute("role","presentation"),e.style.position="fixed",e.style.contain="content",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0",e.style.zIndex="var(--scrim-zindex, 10099)",e.style.outline="none",this.translucent?(e.style.background="rgba(255, 255, 255, .2)",e.style.backdropFilter="contrast(40%)"):e.style.background="transparent",this._element=e,e}open(e){var a;if(this.state!=="closed")return;this.state="opening",this.onDismiss=e==null?void 0:e.onDismiss,this.savedActiveElement=hi();let{element:r}=this;((a=e==null?void 0:e.root)!=null?a:document.body).appendChild(r),r.addEventListener("click",this),document.addEventListener("touchmove",this,!1),document.addEventListener("scroll",this,!1);let i=window.innerWidth-document.documentElement.clientWidth;this.savedMarginRight=document.body.style.marginRight,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden";let n=Number.parseFloat(getComputedStyle(document.body).marginRight);document.body.style.marginRight=`${n+i}px`;let o=document.querySelector(".MLK__plate");if(o instanceof HTMLElement){this.savedMlkPaddingRight=o.style.paddingRight;let s=Number.parseFloat(getComputedStyle(o).paddingRight);o.style.paddingRight=`${s+i}px`}e!=null&&e.child&&r.append(e.child),this.state="open"}close(){var i,n,o,a,s;if(this.state!=="open"){this.element.parentElement;return}this.state="closing",typeof this.onDismiss=="function"&&this.onDismiss(),this.onDismiss=void 0;let{element:e}=this;e.removeEventListener("click",this),document.removeEventListener("touchmove",this,!1),document.removeEventListener("scroll",this,!1),e.remove(),document.body.style.overflow=(i=this.savedOverflow)!=null?i:"",document.body.style.marginRight=(n=this.savedMarginRight)!=null?n:"";let r=document.querySelector(".MLK__plate");r instanceof HTMLElement&&(r.style.paddingRight=(o=this.savedMlkPaddingRight)!=null?o:""),hi()!==this.savedActiveElement&&((s=(a=this.savedActiveElement)==null?void 0:a.focus)==null||s.call(a)),e.innerHTML="",this.state="closed"}handleEvent(e){this.lightDismiss&&(e.target===this._element&&e.type==="click"?(this.close(),e.preventDefault(),e.stopPropagation()):e.target===document&&(e.type==="touchmove"||e.type==="scroll")&&(this.close(),e.preventDefault(),e.stopPropagation()))}};function vp(t,e,r){let i=null,n=null,o=!1,a=!1,s=!1,l=new AbortController,c=l.signal;return t.addEventListener("keydown",u=>{if(o||u.key==="Process"||u.code==="CapsLock"||/(Control|Meta|Alt|Shift)(Left|Right)/.test(u.code)){i=null;return}i=u,n=null,r.onKeystroke(u)?t.textContent="":i=null},{capture:!0,signal:c}),t.addEventListener("keypress",u=>{o||(i&&n&&r.onKeystroke(i),n=u)},{capture:!0,signal:c}),t.addEventListener("compositionstart",u=>{t.textContent="",o=!0,r.onCompositionStart(u.data)},{capture:!0,signal:c}),t.addEventListener("compositionupdate",u=>{o&&r.onCompositionUpdate(u.data)},{capture:!0,signal:c}),t.addEventListener("compositionend",u=>{t.textContent="",o&&(o=!1,r.onCompositionEnd(u.data))},{capture:!0,signal:c}),t.addEventListener("beforeinput",u=>u.stopImmediatePropagation(),{signal:c}),t.addEventListener("input",u=>{var m;if(!o&&(t.textContent="",u.inputType!=="insertCompositionText")){if(u.inputType==="insertFromPaste"){u.preventDefault(),u.stopPropagation();return}r.onInput((m=u.data)!=null?m:""),u.preventDefault(),u.stopPropagation()}},{signal:c}),t.addEventListener("paste",u=>{t.focus({preventScroll:!0}),t.textContent="",r.onPaste(u)||u.preventDefault(),u.stopImmediatePropagation()},{signal:c}),t.addEventListener("cut",u=>r.onCut(u),{capture:!0,signal:c}),t.addEventListener("copy",u=>r.onCopy(u),{capture:!0,signal:c}),t.addEventListener("blur",u=>{var f,x;if(((x=(f=u.relatedTarget)==null?void 0:f._mathfield)==null?void 0:x.element)===e){t.focus({preventScroll:!0}),u.preventDefault(),u.stopPropagation();return}let m=!1,d=u.relatedTarget;for(;d;){if(d.classList.contains("ML__keyboard")){m=!0;break}d=d.parentElement}if(m){t.focus({preventScroll:!0}),u.preventDefault(),u.stopPropagation();return}let h=Te.state;if(h==="open"||h==="opening"){u.preventDefault(),u.stopPropagation();return}if(u.relatedTarget===u.target.getRootNode().host){u.preventDefault(),u.stopPropagation();return}s||a||(s=!0,i=null,n=null,r.onBlur(),s=!1)},{capture:!0,signal:c}),t.addEventListener("focus",u=>{s||a||(a=!0,r.onFocus(),a=!1)},{capture:!0,signal:c}),{dispose:()=>l.abort(),cancelComposition:()=>{o&&(typeof t.blur=="function"&&t.blur(),requestAnimationFrame(()=>t.focus({preventScroll:!0})))},blur:()=>{typeof t.blur=="function"&&(s=!0,t.blur(),s=!1)},focus:()=>{!a&&typeof t.focus=="function"&&(a=!0,t.focus({preventScroll:!0}),a=!1)},hasFocus:()=>hi()===t,setAriaLabel:u=>t.setAttribute("aria-label",u),setValue:u=>{var m;t.textContent!==u&&(t.textContent=u,t.style.left="-1000px",(m=window.getSelection())==null||m.selectAllChildren(t))},moveTo:(u,m)=>{t.style.top=`${m}px`,t.style.left=`${u}px`}}}function zr(t){var r;if(!t||!cr(t))return"";let e;return t.key==="Unidentified"&&t.target&&(e=t.target.value),e=(r=e!=null?e:t.key)!=null?r:t.code,/^(Dead|Return|Enter|Tab|Escape|Delete|PageUp|PageDown|Home|End|Help|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)$/.test(e)&&(e=""),e}function us(t){t=_u(t);let e=[];return t.ctrlKey&&e.push("ctrl"),t.metaKey&&e.push("meta"),t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),e.length===0?`[${t.code}]`:(e.push(`[${t.code}]`),e.join("+"))}function vg(t){if(ke()){let e=Ct(),r=t.startsWith("!"),i=t.endsWith(e);if(r&&!i||!r&&i)return!0}return t==="!other"?!1:t==="other"}function Mp(t,e,r){if(t.length===0)return"";let i=Gr(il(us(r))),n=Gr({key:r.key,shift:r.shiftKey,alt:r.altKey,ctrl:r.ctrlKey,meta:r.metaKey||r.ctrlKey&&/macos|ios/.test(Ct()),cmd:!1,win:!1});for(let o=t.length-1;o>=0;o--)if((t[o].key===i||t[o].key===n)&&(!t[o].ifMode||t[o].ifMode===e))return t[o].command;return""}function _p(t){let e=t;return ee(e)&&(e=e.length>0?e[0]+"("+e.slice(1).join("")+")":""),e}function wp(t,e){let r=[];if(typeof e=="string"){let o=q0[e];ee(o)?r=o.slice():o&&r.push(o)}let i=_p(e),n=new RegExp("^"+i.replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");for(let o of t)n.test(_p(o.command))&&r.push(o.key);return r.map(hn)}function _g(t,e){if(t.ifPlatform&&!/^!?(macos|windows|android|ios|chromeos|other)$/.test(t.ifPlatform))throw new Error(`Unexpected platform "${t.ifPlatform}" for keybinding ${t.key}`);if(t.ifLayout!==void 0&&(e.score===0||!t.ifLayout.includes(e.id)))return;let r=il(t.key),i=t.ifPlatform;if(r.cmd){if(i&&i!=="macos"&&i!=="ios")throw new Error('Unexpected "cmd" modifier with platform "'+i+`" "cmd" modifier can only be used with macOS or iOS platform.`);i||(i=Ct()==="ios"?"ios":"macos"),r.win=!1,r.cmd=!1,r.meta=!0}if(r.win){if(i&&i!=="windows")throw new Error('Unexpected "win" modifier with platform "'+i+`" "win" modifier can only be used with Windows platform.`);i="windows",r.win=!1,r.cmd=!1,r.meta=!0}if(i&&!vg(i))return;if(/^\[.+\]$/.test(r.key))return g(p({},t),{key:Gr(r)});let n=vu(r.key,e);if(!n)return g(p({},t),{key:Gr(r)});if(n.shift&&r.shift||n.alt&&r.alt)throw new Error(`The keybinding ${t.key} (${mc(t.command)}) is conflicting with the key combination ${Gr(n)} using the ${e.displayName} keyboard layout`);return n.shift=n.shift||r.shift,n.alt=n.alt||r.alt,n.meta=r.meta,n.ctrl=r.ctrl,g(p({},t),{key:Gr(n)})}function mc(t){if(Array.isArray(t)){let e=[...t];return e.shift()+"("+e.map(r=>typeof r=="string"?`"${r}"`:r.toString()).join(", ")+")"}return t}function Sp(t,e){let r=[],i=[];for(let n of t)try{let o=_g(n,e);if(!o)continue;let a=i.find(s=>s.key===o.key&&s.ifMode===o.ifMode);if(a)throw new Error(`Ambiguous key binding ${n.key} (${mc(n.command)}) matches ${a.key} (${mc(a.command)}) with the ${e.displayName} keyboard layout`);i.push(o)}catch(o){o instanceof Error&&r.push(o.message)}return[i,r]}var pc=class extends q{constructor(){super("latex")}createAtom(e){return new pe(e)}onPaste(e,r){if(!r)return!1;let i=typeof r=="string"?r:r.getData("application/x-latex")||r.getData("text/plain");return i&&e.model.contentWillChange({inputType:"insertFromPaste",data:i})?(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,i)&&(e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),Y(e)),e.startRecording(),!0):!1}insert(e,r,i){if(!e.contentWillChange({data:r,inputType:"insertText"}))return!1;i||(i={}),i.insertionMode||(i.insertionMode="replaceSelection"),i.selectionMode||(i.selectionMode="placeholder");let{silenceNotifications:n}=e;i.silenceNotifications&&(e.silenceNotifications=!0);let o=e.silenceNotifications;e.silenceNotifications=!0,i.insertionMode==="replaceSelection"&&!e.selectionIsCollapsed?e.deleteAtoms(de(e.selection)):i.insertionMode==="replaceAll"?(e.root.setChildren([],"body"),e.position=0):i.insertionMode==="insertBefore"?e.collapseSelection("backward"):i.insertionMode==="insertAfter"&&e.collapseSelection("forward");let a=[];for(let c of r)Ku.test(c)&&a.push(new pe(c));let s=e.at(e.position);if(s instanceof Ft&&(s=s.lastChild),!(s.parent instanceof Ft)){let c=new Ft;s.parent.addChildAfter(c,s),s=c.firstChild}let l=s.parent.addChildrenAfter(a,s);return e.silenceNotifications=o,i.selectionMode==="before"||(i.selectionMode==="item"?e.setSelection(e.anchor,e.offsetOf(l)):l&&(e.position=e.offsetOf(l))),e.contentDidChange({data:r,inputType:"insertText"}),e.silenceNotifications=n,!0}};function ao(t){return t.atoms.find(e=>e.type==="latexgroup")}function fi(t){var r,i;let e=ao(t);return(i=(r=e==null?void 0:e.body)==null?void 0:r.filter(n=>n.type==="latex"))!=null?i:[]}function ds(t,e){var s;let r=0,i=!1,n=Number.isFinite(e==null?void 0:e.before)?(s=e==null?void 0:e.before)!=null?s:0:t.lastOffset;for(;r<=n&&!i;){let l=t.at(r);i=l instanceof pe&&l.isSuggestion,i||r++}if(!i)return[void 0,void 0];let o=r,a=!1;for(;o<=n&&!a;){let l=t.at(o);a=!(l instanceof pe&&l.isSuggestion),a||o++}return[r-1,o-1]}new pc;function Mg(t,e){t.flushInlineShortcutBuffer(),t.stopCoalescingUndo();let r=ms(t,e),{model:i}=t;return i.selectionIsCollapsed?(t.defaultStyle.fontSeries&&r.fontSeries===t.defaultStyle.fontSeries&&(r.fontSeries="auto"),r.fontShape&&r.fontShape===t.defaultStyle.fontShape&&(r.fontShape="auto"),r.color&&r.color===t.defaultStyle.color&&(r.color="none"),r.backgroundColor&&r.backgroundColor===t.defaultStyle.backgroundColor&&(r.backgroundColor="none"),r.fontSize&&r.fontSize===t.defaultStyle.fontSize&&(r.fontSize="auto"),t.defaultStyle=p(p({},t.defaultStyle),r)):t.model.deferNotifications({content:!0,type:"insertText"},()=>{i.selection.ranges.forEach(n=>no(i,n,r,{operation:"toggle"})),t.snapshot("style-change")}),!0}fe({applyStyle:Mg},{target:"mathfield",canUndo:!0,changeContent:!0});function ms(t,e){var n,o,a,s,l,c,u,m,d,h;let r={};if(typeof e.color=="string"){let f=(o=t.colorMap((n=e.color)!=null?n:e.verbatimColor))!=null?o:"none";f!==e.color&&(r.verbatimColor=(a=e.verbatimColor)!=null?a:e.color),r.color=f}if(typeof e.backgroundColor=="string"){let f=(l=t.backgroundColorMap((s=e.backgroundColor)!=null?s:e.verbatimBackgroundColor))!=null?l:"none";f!==e.backgroundColor&&(r.verbatimBackgroundColor=(c=e.verbatimBackgroundColor)!=null?c:e.backgroundColor),r.backgroundColor=f}typeof e.fontFamily=="string"&&(r.fontFamily=e.fontFamily),typeof e.series=="string"&&(r.fontSeries=e.series),typeof e.fontSeries=="string"&&(r.fontSeries=e.fontSeries.toLowerCase()),r.fontSeries&&(r.fontSeries=(u={bold:"b",medium:"m",normal:"m"}[r.fontSeries])!=null?u:r.fontSeries),typeof e.shape=="string"&&(r.fontShape=e.shape),typeof e.fontShape=="string"&&(r.fontShape=e.fontShape.toLowerCase()),r.fontShape&&(r.fontShape=(m={italic:"it",up:"n",upright:"n",normal:"n"}[r.fontShape])!=null?m:r.fontShape),e.variant&&(r.variant=e.variant.toLowerCase()),e.variantStyle!==void 0&&(r.variantStyle=typeof e.variantStyle=="string"&&e.variantStyle!==""?e.variantStyle.toLowerCase():e.variantStyle);let i=(d=e.size)!=null?d:e.fontSize;return typeof i=="number"?r.fontSize=Math.max(1,Math.min(10,i)):typeof i=="string"&&(r.fontSize=(h={size1:1,size2:2,size3:3,size4:4,size5:5,size6:6,size7:7,size8:8,size9:9,size10:10}[i.toLowerCase()])!=null?h:{tiny:1,scriptsize:2,footnotesize:3,small:4,normal:5,normalsize:5,large:6,Large:7,LARGE:8,huge:9,Huge:10}[i]),r}function so(t,e,r){var o,a;let i=t.model;if(i.mode==="latex")return{};let n=t.styleBias;if(n==="none")return t.defaultStyle;if(i.mode==="text")return(a=(o=i.at(n==="right"?r.after:r.before))==null?void 0:o.style)!=null?a:t.defaultStyle;if(i.mode==="math"){let s=i.at(n==="right"?r.after:r.before);return s?p(g(p({},s.style),{variant:"normal"}),t.defaultStyle):t.defaultStyle}return{}}function Wt(t){let e=t.options.onInsertStyle;if(e===null)return{};e===void 0&&(e=so);let r=t.model,i=t.styleBias,n=r.at(r.position),o=kp(r,n,i),a=kp(r,n.rightSibling,i);return e(t,r.position,{before:o,after:a})}function kp(t,e,r){var i;return!e||e.type==="first"&&r!=="right"?-1:e.type!=="group"?t.offsetOf(e):!e.body||e.body.length<2?-1:((i=e.body)==null?void 0:i.length)===1||r!=="right"?t.offsetOf(e.body[0]):t.offsetOf(e.body[e.body.length-1])}function gi(t){let e=fi(t.model).filter(r=>r.isSuggestion);if(e.length!==0){t.model.position=t.model.offsetOf(e[0].leftSibling);for(let r of e)r.parent.removeChild(r)}}function Fr(t,e){var c;let{model:r}=t;gi(t);for(let u of fi(r))u.isError=!1;if(!r.selectionIsCollapsed||t.options.popoverPolicy==="off"){Nr(t);return}let i=[],n=r.at(r.position);for(;n&&n instanceof pe&&/^[a-zA-Z\*]$/.test(n.value);)n=n.leftSibling;if(n&&n instanceof pe&&n.value==="\\")for(i.push(n),n=n.rightSibling;n&&n instanceof pe&&/^[a-zA-Z\*]$/.test(n.value);)i.push(n),n=n.rightSibling;let o=i.map(u=>u.value).join(""),a=Ru(t,o);if(a.length===0){if(/^\\[a-zA-Z\*]+$/.test(o))for(let u of i)u.isError=!0;Nr(t);return}let s=(c=e==null?void 0:e.atIndex)!=null?c:0;t.suggestionIndex=s<0?a.length-1:s%a.length;let l=a[t.suggestionIndex];if(l!==o){let u=i[i.length-1];u.parent.addChildrenAfter([...l.slice(o.length-l.length)].map(m=>new pe(m,{isSuggestion:!0})),u),vt(t,{interactive:!0})}Lp(t,a)}function ps(t){let[e,r]=ds(t,{before:t.position});if(e===void 0||r===void 0)return!1;let i=!1;return t.getAtoms([e,r]).forEach(n=>{n.isSuggestion&&(n.isSuggestion=!1,i=!0)}),i}function Xe(t,e="accept",r){var l,c;Nr(t);let i=ao(t.model);if(!i)return!1;if(e==="accept-suggestion"||e==="accept-all"){let u=fi(t.model).filter(m=>m.isSuggestion);if(u.length!==0){for(let m of u)m.isSuggestion=!1;t.model.position=t.model.offsetOf(u[u.length-1])}if(e==="accept-suggestion")return u.length!==0}let o=fi(t.model).filter(u=>!u.isSuggestion).map(u=>u.value).join(""),a=i.leftSibling;if(i.parent.removeChild(i),t.model.position=t.model.offsetOf(a),t.switchMode((l=r==null?void 0:r.mode)!=null?l:"math"),e==="reject")return!0;let s=p({},Wt(t));return!/^[a-zA-Z0-9]$/.test(o)&&t.styleBias!=="none"&&(s.variant="normal",s.variantStyle=void 0),q.insert(t.model,o,{selectionMode:(c=r==null?void 0:r.selectItem)!=null&&c?"item":"placeholder",format:"latex",mode:"math",style:s}),t.snapshot(),t.model.announce("replacement"),t.switchMode("math"),!0}function bi(t){var r;let e=document.getElementById(t);return e?e.dataset.refcount=Number(Number.parseInt((r=e.dataset.refcount)!=null?r:"0")+1).toString():(e=document.createElement("div"),e.setAttribute("aria-hidden","true"),e.dataset.refcount="1",e.id=t,document.body.append(e)),e}function $r(t){var i;let e=document.getElementById(t);if(!e)return;let r=Number.parseInt((i=e.getAttribute("data-refcount"))!=null?i:"0");r<=1?e.remove():e.dataset.refcount=Number(r-1).toString()}function Ap(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}function wg(t,e){let r=new K({from:t.context}),i=new y({mode:"math",type:"root",body:ge(e,{context:r})}),n=Tr(qt(new w(i.render(r),{classes:"ML__base"}),r));return Dr(n,{classes:"ML__latex"}).toMarkup()}function Lp(t,e){var n;if(e.length===0){Nr(t);return}let r="";for(let[o,a]of e.entries()){let s=a,l=wg(t,a),c=wp(t.keybindings,s).join("
");r+=`
  • ${Ap(s)}${l}`,c&&(r+=`${c}`),r+="
  • "}let i=Sg(t,`
      ${r}
    `);hc()&&((n=i.querySelector(".ML__popover__current"))==null||n.scrollIntoView({block:"nearest",inline:"nearest"})),setTimeout(()=>{var o;i&&!hc()&&(i.classList.add("is-visible"),gn(t),(o=i.querySelector(".ML__popover__current"))==null||o.scrollIntoView({block:"nearest",inline:"nearest"}))},32)}function hc(){let t=document.getElementById("mathlive-suggestion-popover");return t?t.classList.contains("is-visible"):!1}function gn(t,e){var m,d,h;if(!t.element||t.element.mathfield!==t||!hc())return;if(((m=t.model.at(t.model.position))==null?void 0:m.type)!=="latex"){Nr(t);return}if(e!=null&&e.deferred){setTimeout(()=>gn(t),32);return}let r=Yi(t.field);if(!r)return;let i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,n=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,o=window.innerWidth-document.documentElement.clientWidth,a=window.innerHeight-document.documentElement.clientHeight,s=(h=(d=window.mathVirtualKeyboard)==null?void 0:d.boundingRect.height)!=null?h:0,l=document.getElementById("mathlive-suggestion-popover");r.x+l.offsetWidth/2>n-o?l.style.left=`${n-l.offsetWidth-o}px`:r.x-l.offsetWidth/2<0?l.style.left="0":l.style.left=`${r.x-l.offsetWidth/2}px`;let c=r.y-r.height;i-a-s-r.yi.preventDefault()),r.addEventListener("click",i=>{let n=i.target;for(;n&&!n.dataset.command;)n=n.parentElement;n&&(Xe(t,"reject"),q.insert(t.model,n.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),t.dirty=!0,t.focus())}),r.innerHTML=globalThis.MathfieldElement.createHTML(e),r}function Cp(){document.getElementById("mathlive-suggestion-popover")&&($r("mathlive-suggestion-popover"),nt("suggestion-popover"),nt("core"))}function kg(){let t=String(new Error().stack).replace(/^Error.*\n/,"").split(` `);if(t.length===0)return console.error(`Can't use relative paths to specify assets location because the sourcefile location could not be determined (unexpected stack trace format "${new Error().stack}").`),"";let e=t[1],r=e.match(/http.*\.ts[\?:]/);return r&&(e=t[2]),r=e.match(/(https?:.*):[0-9]+:[0-9]+/),r||(r=e.match(/at (.*(\.ts))[\?:]/),r||(r=e.match(/at (.*(\.mjs|\.js))[\?:]/))),r?r[1]:(console.error(t),console.error(`Can't use relative paths to specify assets location because the source file location could not be determined (unexpected location "${e}").`),"")}var ur=null,Ep,Tp,fc=((Tp=(Ep=globalThis==null?void 0:globalThis.document)==null?void 0:Ep.currentScript)==null?void 0:Tp.src)||kg();async function hs(t){if(/^(?:[a-z+]+:)?\/\//i.test(t)){try{return new URL(t).href}catch(e){}if(t.startsWith("//"))try{return new URL(`${window.location.protocol}${t}`).href}catch(e){}return t}if(ur===null)try{let e=await fetch(fc,{method:"HEAD"});e.status===200&&(ur=e.url,ur=ur.replace(/\/\+esm$/,"/"),ur.includes("jsdelivr.net/")&&(ur+="/"))}catch(e){console.error(`Invalid URL "${t}" (relative to "${fc}")`)}return new URL(t,ur!=null?ur:fc).href}function Lg(t,e,r={}){return new FontFace(t,`url(${e}.woff2) format('woff2')`,r)}var Ie="not-loaded";async function Dp(){return Ie="not-loaded",dr()}async function dr(){var e;if(Ie!=="not-loaded")return;if(Ie="loading",(e=getComputedStyle(document.documentElement).getPropertyValue("--ML__static-fonts"))!=null?e:!1){Ie="ready";return}if(document.body.classList.remove("ML__fonts-did-not-load"),"fonts"in document){let r=["KaTeX_Main","KaTeX_Math","KaTeX_AMS","KaTeX_Caligraphic","KaTeX_Fraktur","KaTeX_SansSerif","KaTeX_Script","KaTeX_Typewriter","KaTeX_Size1","KaTeX_Size2","KaTeX_Size3","KaTeX_Size4"],i=Array.from(document.fonts).map(a=>a.family);if(r.every(a=>i.includes(a))){Ie="ready";return}if(!globalThis.MathfieldElement.fontsDirectory){Ie="not-loaded";return}let n=await hs(globalThis.MathfieldElement.fontsDirectory);if(!n){document.body.classList.add("ML__fonts-did-not-load"),Ie="error";return}n.endsWith("/")&&(n=n.slice(0,-1));let o=[["KaTeX_Main-Regular"],["KaTeX_Main-BoldItalic",{style:"italic",weight:"bold"}],["KaTeX_Main-Bold",{weight:"bold"}],["KaTeX_Main-Italic",{style:"italic"}],["KaTeX_Math-Italic",{style:"italic"}],["KaTeX_Math-BoldItalic",{style:"italic",weight:"bold"}],["KaTeX_AMS-Regular"],["KaTeX_Caligraphic-Regular"],["KaTeX_Caligraphic-Bold",{weight:"bold"}],["KaTeX_Fraktur-Regular"],["KaTeX_Fraktur-Bold",{weight:"bold"}],["KaTeX_SansSerif-Regular"],["KaTeX_SansSerif-Bold",{weight:"bold"}],["KaTeX_SansSerif-Italic",{style:"italic"}],["KaTeX_Script-Regular"],["KaTeX_Typewriter-Regular"],["KaTeX_Size1-Regular"],["KaTeX_Size2-Regular"],["KaTeX_Size3-Regular"],["KaTeX_Size4-Regular"]].map(a=>Lg(a[0].replace(/-[a-zA-Z]+$/,""),`${n}/${a[0]}`,a[1]));try{(await Promise.all(o.map(s=>{try{return s.load()}catch(l){}}))).forEach(s=>document.fonts.add(s)),Ie="ready";return}catch(a){console.error(`MathLive 0.109.0: The math fonts could not be loaded from "${n}"`,{cause:a}),document.body.classList.add("ML__fonts-did-not-load")}Ie="error"}}function Op(t,e=0){let r=3735928559^e,i=1103547991^e;for(let n=0;n>>16,2246822507),r^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&i)+(r>>>0)}function Y(t,e){!t||t.dirty||!t.field||(t.resizeObserver.unobserve(t.field),t.dirty=!0,requestAnimationFrame(()=>{it(t)&&t.dirty&&(t.atomBoundsCache=new Map,vt(t,e),t.resizeObserver.observe(t.field),t.resizeObserverStarted=!0)}))}function Ag(t,e){var o;e=e!=null?e:{};let r=new K({from:g(p({},t.context),{atomIdsSettings:{seed:e.forHighlighting?Op(y.serialize([t.model.root],{expandMacro:!1,defaultMode:t.options.defaultMode})):"random",groupNumbers:(o=e.forHighlighting)!=null?o:!1},letterShapeStyle:t.options.letterShapeStyle}),mathstyle:t.options.defaultMode==="inline-math"?"textstyle":"displaystyle"}),i=t.model.root.render(r);return Dr(qt(i,r),{classes:t.hasEditablePrompts?"ML__latex ML__prompting":"ML__latex",attributes:{translate:"no","aria-hidden":"true"}})}function gc(t,e){try{let{model:r}=t;r.root.caret=void 0,r.root.isSelected=!1,r.root.containsCaret=!0;for(let n of r.atoms)n.caret=void 0,n.isSelected=!1,n.containsCaret=!1;if(r.selectionIsCollapsed){let n=r.at(r.position);n.caret=t.model.mode;let o=n.parent;for(;o;)o.containsCaret=!0,o=o.parent}else{let n=r.getAtoms(r.selection,{includeChildren:!0,includeFirstAtoms:!0});for(let o of n)o.isSelected=!0}return Ag(t,e).toMarkup()}catch(r){return console.error(r),''}}function vt(t,e){if(!it(t))return;e!=null||(e={});let r=t.element.querySelector("[part=virtual-keyboard-toggle]");r&&(r.style.display=t.hasEditableContent?"":"none");let i=t.field;if(!i)return;let n=t.isSelectionEditable&&t.hasFocus(),o=i.classList.contains("ML__focused");o&&!n?i.classList.remove("ML__focused"):!o&&n&&i.classList.add("ML__focused");let a=gc(t,e),s=t.element.querySelector("[part=menu-toggle]");if(s){let l=!1;(t.disabled||t.readOnly&&!t.hasEditableContent||t.userSelect==="none")&&(l=!0),!l&&t.element.offsetWidth<50&&(l=!0),s.style.display=l?"none":""}if(t.model.atoms.length<=1){let l=t.options.contentPlaceholder;l&&(a+=`${he(l)}`)}i.innerHTML=globalThis.MathfieldElement.createHTML(a),lo(t,e.interactive),t.updateToggleLayout(),t.dirty=!1}function lo(t,e){var l;let r=t.field;if(!r)return;for(let c of r.querySelectorAll(".ML__selection, .ML__contains-highlight"))c.remove();if(!(e!=null&&e)&&Ie!=="error"&&Ie!=="ready"){setTimeout(()=>{Ie==="ready"?lo(t):setTimeout(()=>lo(t),128)},32);return}let i=t.model;(l=t.atomBoundsCache)==null||l.clear();let n,o=()=>{if(n!==void 0)return n;let c=r.offsetWidth,u=r.getBoundingClientRect().width;return n=Math.floor(u)/c,isNaN(n)&&(n=1),n};if(i.selectionIsCollapsed){gn(t,{deferred:!0});let c=i.at(i.position);for(;c&&c.type!=="prompt"&&!(c.containsCaret&&c.displayContainsHighlight);)c=c.parent;if(c!=null&&c.containsCaret&&c.displayContainsHighlight){let u=o(),m=oc(t,nr(t,c),u);if(m){m.left/=u,m.right/=u,m.top/=u,m.bottom/=u;let d=document.createElement("div");d.classList.add("ML__contains-highlight"),d.style.position="absolute",d.style.left=`${m.left+1}px`,d.style.top=`${Math.ceil(m.top)}px`,d.style.width=`${Math.ceil(m.right-m.left)}px`,d.style.height=`${Math.ceil(m.bottom-m.top)}px`,r.insertBefore(d,r.childNodes[0])}}return}let a=o(),s=Cg(Xa(t,{excludeAtomsWithBackground:!0}));for(let c of s){c.left/=a,c.right/=a,c.top/=a,c.bottom/=a;let u=document.createElement("div");u.classList.add("ML__selection"),u.style.position="absolute",u.style.left=`${c.left}px`,u.style.top=`${c.top}px`,u.style.width=`${Math.ceil(c.right-c.left)}px`,u.style.height=`${Math.max(1,Math.ceil(c.bottom-c.top-1))}px`,r.insertBefore(u,r.childNodes[0])}}function Cg(t){let e=[];for(let r of t){let i=!1;for(let n of e)if(r.left===n.left&&r.right===n.right&&r.top===n.top&&r.bottom===n.bottom){i=!0;break}i||e.push(r)}t=e,e=[];for(let r of t){let i=0;for(let n of t)if(r.left>=n.left&&r.right<=n.right&&r.top>=n.top&&r.bottom<=n.bottom&&(i+=1,i>1))break;i===1&&e.push(r)}return e}function bc(t){if(!t)return;let e=t.model,r=e.selection,i=y.serialize([e.root],{expandMacro:!1,defaultMode:t.options.defaultMode});q.insert(e,i,{insertionMode:"replaceAll",selectionMode:"after",format:"latex",silenceNotifications:!0,mode:"math"});let n=e.silenceNotifications;e.silenceNotifications=!0,e.selection=r,e.silenceNotifications=n,Y(t)}function yc(){for(let t of document.querySelectorAll(".ML__mathfield"))"_mathfield"in t&&bc(t._mathfield)}var xc=3,_t;function fe(t,e){e=p({target:"mathfield",canUndo:!1,audioFeedback:void 0,changeContent:!1,changeSelection:!1},e!=null?e:{}),_t||(_t={});for(let r of Object.keys(t))_t[r],_t[r]=g(p({},e),{fn:t[r]})}function vc(t){let e;if(Array.isArray(t)){if(t[0]==="performWithFeedback")return vc(t[1]);e=t[0]}else e=t;return _t[e]}function mr(t){var e;return(e=vc(t))==null?void 0:e.target}function Bp(t,e){var l,c;if(e=yi(e),!e)return!1;let r,i=[],n=!1,o=!1;ee(e)?(r=e[0],i=e.slice(1)):r=e;let a=_t[r],s=a==null?void 0:a.target;if(s==="model"){if(!t.isSelectionEditable&&(a!=null&&a.changeContent))return t.model.announce("plonk"),!1;/^(delete|add)/.test(r)&&(r!=="deleteBackward"&&t.flushInlineShortcutBuffer(),t.snapshot(r)),/^complete/.test(r)||gi(t),_t[r].fn(t.model,...i),Fr(t),o=!0,n=!0}else if(s==="virtual-keyboard")o=(c=(l=window.mathVirtualKeyboard)==null?void 0:l.executeCommand(e))!=null?c:!1,n=!0;else if(_t[r]){if(!t.isSelectionEditable&&(a!=null&&a.changeContent))return t.model.announce("plonk"),!1;/^(undo|redo)/.test(r)&&t.flushInlineShortcutBuffer(),o=_t[r].fn(t,...i),n=!0}else throw new Error(`Unknown command "${r}"`);return s!=="virtual-keyboard"&&(!t.model.selectionIsCollapsed||a!=null&&a.changeSelection&&r!=="deleteBackward")&&(t.flushInlineShortcutBuffer(),a!=null&&a.changeContent||t.stopCoalescingUndo(),t.defaultStyle={}),o&&(a!=null&&a.changeSelection&&n?(t.dirty=!0,t.scrollIntoView()):Y(t)),n}function Eg(t,e){var n;if(!t)return!1;t.focus(),bn.keypressVibration&&Ho()&&navigator.vibrate(xc);let r=vc(e);globalThis.MathfieldElement.playSound((n=r==null?void 0:r.audioFeedback)!=null?n:"keypress");let i=t.executeCommand(e);return t.scrollIntoView(),i}fe({performWithFeedback:(t,e)=>Eg(t,e)});function Tg(t){return Fr(t,{atIndex:t.suggestionIndex+1}),!1}function Dg(t){return Fr(t,{atIndex:t.suggestionIndex-1}),!1}fe({complete:Xe},{target:"mathfield",audioFeedback:"return",canUndo:!0,changeContent:!0,changeSelection:!0});fe({dispatchEvent:(t,e,r)=>{var i,n;return(n=(i=t.host)==null?void 0:i.dispatchEvent(new CustomEvent(e,{detail:r})))!=null?n:!1}},{target:"mathfield"});fe({nextSuggestion:Tg,previousSuggestion:Dg},{target:"mathfield",audioFeedback:"keypress",changeSelection:!0});function yi(t){if(!t)return;if(ee(t)&&t.length>0){let i=t[0];return i=i.replace(/-\w/g,n=>n[1].toUpperCase()),i==="performWithFeedback"&&t.length===2?[i,yi(t[1])]:[i,...t.slice(1)]}if(typeof t!="string")return;let e=t.trim().match(/^([a-zA-Z0-9-]+)\((.*)\)$/);if(e){let i=e[1].replace(/-\w/g,o=>o[1].toUpperCase()),n=e[2].split(",").map(o=>o.trim());return[i,...n.map(o=>{if(/"[^"]*"/.test(o)||/'[^']*'/.test(o))return o.slice(1,-1);if(/^true$/.test(o))return!0;if(/^false$/.test(o))return!1;if(/^[-]?\d+$/.test(o))return parseInt(o,10);if(/^\{.*\}$/.test(o))try{return JSON.parse(o)}catch(a){return console.error("Invalid argument:",o),o}return yi(o)})]}return t.replace(/-\w/g,i=>i[1].toUpperCase())}var uo="mathlive#virtual-keyboard-message";function mo(t){var r;return t.type!=="message"?!1:((r=t.data)==null?void 0:r.type)===uo}var co=class t{constructor(){this.targetOrigin=window.origin;this.originValidator="none";this.targetWindow=window.top;this._boundingRect=new DOMRect(0,0,0,0);this._isShifted=!1;window.addEventListener("message",this),this.sendMessage("proxy-created"),this.listeners={}}static get singleton(){return this._singleton||(this._singleton=new t),this._singleton}getKeycap(e){}setKeycap(e,r){this.sendMessage("update-setting",{setKeycap:{keycap:e,value:r}})}set alphabeticLayout(e){this.sendMessage("update-setting",{alphabeticLayout:e})}set layouts(e){this.sendMessage("update-setting",{layouts:e})}get normalizedLayouts(){return[]}set editToolbar(e){this.sendMessage("update-setting",{editToolbar:e})}set container(e){throw new Error("Container inside an iframe cannot be changed")}show(e){this.dispatchEvent(new CustomEvent("before-virtual-keyboard-toggle",{detail:{visible:!0},bubbles:!0,cancelable:!0,composed:!0}))&&(this.sendMessage("show",e),this.dispatchEvent(new Event("virtual-keyboard-toggle")))}hide(e){this.dispatchEvent(new CustomEvent("before-virtual-keyboard-toggle",{detail:{visible:!1},bubbles:!0,cancelable:!0,composed:!0}))&&(this.sendMessage("hide",e),this.dispatchEvent(new Event("virtual-keyboard-toggle")))}get isShifted(){return this._isShifted}get visible(){return this._boundingRect.height>0}set visible(e){e?this.show():this.hide()}get boundingRect(){return this._boundingRect}executeCommand(e){return this.sendMessage("execute-command",{command:e}),!0}updateToolbar(e){this.sendMessage("update-toolbar",e)}update(e){this.sendMessage("update-setting",e)}connect(){this.sendMessage("connect")}disconnect(){this.sendMessage("disconnect")}addEventListener(e,r,i){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].has(r)||this.listeners[e].add(r)}dispatchEvent(e){return!this.listeners[e.type]||this.listeners[e.type].size===0?!0:(this.listeners[e.type].forEach(r=>{typeof r=="function"?r(e):r==null||r.handleEvent(e)}),!e.defaultPrevented)}removeEventListener(e,r,i){this.listeners[e]&&this.listeners[e].delete(r)}handleEvent(e){if(mo(e)){if(!Qi(e.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");this.handleMessage(e.data)}}handleMessage(e){let{action:r}=e;if(r==="execute-command"){let{command:i}=e;mr(i)==="virtual-keyboard"&&this.executeCommand(i);return}if(r==="synchronize-proxy"){this._boundingRect=e.boundingRect,this._isShifted=e.isShifted;return}if(r==="geometry-changed"){this._boundingRect=e.boundingRect,this.dispatchEvent(new Event("geometrychange"));return}}sendMessage(e,r={}){if(!this.targetWindow)throw new DOMException("A frame does not have access to the top window and can't communicate with the keyboard.","SecurityError");this.targetWindow.postMessage(p({type:uo,action:e},r),this.targetOrigin)}};var _c={numeric:{label:"123",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.numeric",rows:[[{latex:"x",shift:"y",variants:["y","z","t","r","x^2","x^n","x^{#?}","x_n","x_i","x_{#?}",{latex:"f(#?)",class:"small"},{latex:"g(#?)",class:"small"}]},{latex:"n",shift:"a",variants:["i","j","p","k","a","u"]},"[separator-5]","[7]","[8]","[9]","[/]","[separator-5]",{latex:"\\exponentialE",shift:"\\ln",variants:["\\exp","\\times 10^{#?}","\\ln","\\log_{10}","\\log","\\lg","\\operatorname{lb}"]},{latex:"\\imaginaryI",variants:["\\Re","\\Im","\\imaginaryJ","\\Vert #0 \\Vert"]},{latex:"\\pi",shift:"\\sin",variants:["\\prod",{latex:"\\theta",aside:"theta"},{latex:"\\rho",aside:"rho"},{latex:"\\tau",aside:"tau"},"\\sin","\\cos","\\tan"]}],[{label:"<",latex:"<",class:"hide-shift",shift:{latex:"\\le",label:"\u2264"}},{label:">",latex:">",class:"hide-shift",shift:{latex:"\\ge",label:"\u2265"}},"[separator-5]","[4]","[5]","[6]","[*]","[separator-5]",{class:"hide-shift",latex:"#@^2}",shift:"#@^{\\prime}}"},{latex:"#@^{#0}}",class:"hide-shift",shift:"#@_{#?}"},{class:"hide-shift",latex:"\\sqrt{#0}",shift:{latex:"\\sqrt[#0]{#?}}"}}],["[(]","[)]","[separator-5]","[1]","[2]","[3]","[-]","[separator-5]",{latex:"\\int^{\\infty}_{0}\\!#?\\,\\mathrm{d}x",class:"small hide-shift",shift:"\\int",variants:[{latex:"\\int_{#?}^{#?}",class:"small"},{latex:"\\int",class:"small"},{latex:"\\iint",class:"small"},{latex:"\\iiint",class:"small"},{latex:"\\oint",class:"small"},"\\mathrm{d}x",{latex:"\\dfrac{\\mathrm{d}}{\\mathrm{d} x}",class:"small"},{latex:"\\frac{\\partial}{\\partial x}",class:"small"},"\\partial"]},{class:"hide-shift",latex:"\\forall",shift:"\\exists"},{label:"[backspace]",width:1}],[{label:"[shift]",width:2},"[separator-5]","[0]","[.]","[=]","[+]","[separator-5]","[left]","[right]",{label:"[action]",width:1}]]},greek:{label:"αβγ",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.greek",rows:[[{label:"φ",class:"MLK__tex hide-shift",insert:"\\varphi",aside:"phi var.",shift:"\\Phi"},{label:"ς",class:"MLK__tex hide-shift",insert:"\\varsigma",aside:"sigma var.",shift:"\\Sigma"},{label:"ϵ",class:"MLK__tex hide-shift",insert:"\\epsilon",aside:"epsilon",shift:'\\char"0190'},{label:"ρ",class:"MLK__tex hide-shift",insert:"\\rho",aside:"rho",shift:'\\char"3A1'},{label:"τ",class:"MLK__tex hide-shift",insert:"\\tau",aside:"tau",shift:'\\char"3A4'},{label:"υ",class:"MLK__tex hide-shift",insert:"\\upsilon",aside:"upsilon",shift:"\\Upsilon"},{label:"θ",class:"MLK__tex hide-shift",insert:"\\theta",aside:"theta",shift:"\\Theta"},{label:"ι",class:"MLK__tex hide-shift",insert:"\\iota",aside:"iota",shift:'\\char"399'},{label:"ο",class:"MLK__tex hide-shift",insert:"\\omicron",aside:"omicron",shift:'\\char"39F'},{label:"π",class:"MLK__tex hide-shift",insert:"\\pi",aside:"pi",shift:"\\Pi"}],["[separator-5]",{label:"α",class:"MLK__tex hide-shift",insert:"\\alpha",aside:"alpha",shift:'\\char"391'},{label:"σ",class:"MLK__tex hide-shift",insert:"\\sigma",aside:"sigma",shift:"\\Sigma"},{label:"δ",class:"MLK__tex hide-shift",insert:"\\delta",aside:"delta",shift:"\\Delta"},{latex:"\\phi",class:"MLK__tex hide-shift",insert:"\\phi",aside:"phi",shift:"\\Phi"},{label:"γ",class:"MLK__tex hide-shift",insert:"\\gamma",aside:"gamma",shift:"\\Gamma"},{label:"η",class:"MLK__tex hide-shift",insert:"\\eta",aside:"eta",shift:'\\char"397'},{label:"ξ",class:"MLK__tex hide-shift",insert:"\\xi",aside:"xi",shift:"\\Xi"},{label:"κ",class:"MLK__tex hide-shift",insert:"\\kappa",aside:"kappa",shift:"\\Kappa"},{label:"λ",class:"MLK__tex hide-shift",insert:"\\lambda",aside:"lambda",shift:"\\Lambda"},"[separator-5]"],["[shift]",{label:"ζ",class:"MLK__tex hide-shift",insert:"\\zeta",aside:"zeta",shift:'\\char"396'},{label:"χ",class:"MLK__tex hide-shift",insert:"\\chi",aside:"chi",shift:'\\char"3A7'},{label:"ψ",class:"MLK__tex hide-shift",insert:"\\psi",aside:"psi",shift:"\\Psi"},{label:"ω",class:"MLK__tex hide-shift",insert:"\\omega",aside:"omega",shift:"\\Omega"},{label:"β",class:"MLK__tex hide-shift",insert:"\\beta",aside:"beta",shift:'\\char"392'},{label:"ν",class:"MLK__tex hide-shift",insert:"\\nu",aside:"nu",shift:'\\char"39D'},{label:"μ",class:"MLK__tex hide-shift",insert:"\\mu",aside:"mu",shift:'\\char"39C'},"[backspace]"],["[separator]",{label:"ε",class:"MLK__tex",insert:"\\varepsilon",aside:"epsilon var."},{label:"ϑ",class:"MLK__tex",insert:"\\vartheta",aside:"theta var."},{label:"ϰ",class:"MLK__tex",insert:"\\varkappa",aside:"kappa var."},{label:"ϖ",class:"MLK__tex",insert:"\\varpi",aside:"pi var."},{label:"ϱ",class:"MLK__tex",insert:"\\varrho",aside:"rho var."},"[left]","[right]","[action]"]]},symbols:{label:"∞\u2260\u2208",labelClass:"MLK__tex",tooltip:"keyboard.tooltip.symbols",rows:[[{latex:"\\sin",shift:"\\sin^{-1}",variants:[{class:"small",latex:"\\sinh"},{class:"small",latex:"\\sin^{-1}"},{class:"small",latex:"\\operatorname{arsinh}"}]},"\\ln",{latex:"\\mathrm{abs}",insert:"\\mathrm{abs}\\left(#0\\right)"},{latex:"\\rightarrow",shift:"\\Rightarrow",variants:[{latex:"\\implies",aside:"implies"},{latex:"\\to",aside:"to"},"\\dashv",{latex:"\\roundimplies",aside:"round implies"}]},{latex:"\\exists",variants:["\\nexists"],shift:"\\nexists"},{latex:"\\in",shift:"\\notin",variants:["\\notin","\\owns"]},"\\cup",{latex:"\\overrightarrow{#@}",shift:"\\overleftarrow{#@}",variants:["\\overleftarrow{#@}","\\bar{#@}","\\vec{#@}","\\hat{#@}","\\check{#@}","\\dot{#@}","\\ddot{#@}","\\mathring{#@}","\\breve{#@}","\\acute{#@}","\\tilde{#@}","\\grave{#@}"]},{class:"small hide-shift",latex:"\\lim_{#?}",shift:"\\lim_{x\\to\\infty}",variants:[{class:"small",latex:"\\liminf_{#?}"},{class:"small",latex:"\\limsup_{#?}"}]},"\\exponentialE"],[{latex:"\\cos",shift:"\\cos^{-1}",variants:[{class:"small",latex:"\\cosh"},{class:"small",latex:"\\cos^{-1}"},{class:"small",latex:"\\operatorname{arcosh}"}]},{latex:"\\log",shift:"\\log_{10}",variants:["\\log_{#0}","\\log_{10}"]},"\\left\\vert#0\\right\\vert",{latex:"\\larr",shift:"\\lArr",variants:[{latex:"\\impliedby",aside:"implied by"},{latex:"\\gets",aside:"gets"},"\\lArr","\\vdash",{latex:"\\models",aside:"models"}]},{latex:"\\forall",shift:"\\lnot",variants:[{latex:"\\land",aside:"and"},{latex:"\\lor",aside:"or"},{latex:"\\oplus",aside:"xor"},{latex:"\\lnot",aside:"not"},{latex:"\\downarrow",aside:"nor"},{latex:"\\uparrow",aside:"nand"},{latex:"\\curlywedge",aside:"nor"},{latex:"\\bar\\curlywedge",aside:"nand"}]},{latex:"\\ni",shift:"\\not\\owns"},"\\cap",{latex:"\\overline{#@}",shift:"\\underline{#@}",variants:["\\overbrace{#@}","\\overlinesegment{#@}","\\overleftrightarrow{#@}","\\overrightarrow{#@}","\\overleftarrow{#@}","\\overgroup{#@}","\\underbrace{#@}","\\underlinesegment{#@}","\\underleftrightarrow{#@}","\\underrightarrow{#@}","\\underleftarrow{#@}","\\undergroup{#@}"]},{class:"hide-shift small",latex:"\\int",shift:"\\iint",variants:[{latex:"\\int_{#?}^{#?}",class:"small"},{latex:"\\int",class:"small"},{latex:"\\smallint",class:"small"},{latex:"\\iint",class:"small"},{latex:"\\iiint",class:"small"},{latex:"\\oint",class:"small"},"\\intop","\\iiint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\ointctrclockwise","\\intctrclockwise"]},{latex:"\\pi",shift:"\\tau",variants:["\\tau"]}],[{latex:"\\tan",shift:"\\tan^{-1}",variants:[{class:"small",latex:"\\tanh"},{class:"small",latex:"\\tan^{-1}"},{class:"small",latex:"\\operatorname{artanh}"},{class:"small",latex:"\\arctan"},{class:"small",latex:"\\operatorname{arctg}"},{class:"small",latex:"\\operatorname{tg}"}]},{latex:"\\exp",insert:"\\exp\\left(#0\\right)",variants:["\\exponentialE^{#0}"]},"\\left\\Vert#0\\right\\Vert",{latex:"\\lrArr",shift:"\\leftrightarrow",variants:[{latex:"\\iff",aside:"if and only if"},"\\leftrightarrow","\\leftrightarrows","\\Leftrightarrow",{latex:"^\\biconditional",aside:"biconditional"}]},{latex:"\\vert",shift:"!"},{latex:"#@^{\\complement}",aside:"complement",variants:[{latex:"\\setminus",aside:"set minus"},{latex:"\\smallsetminus",aside:"small set minus"}]},{latex:"\\subset",shift:"\\subseteq",variants:["\\subset","\\subseteq","\\subsetneq","\\varsubsetneq","\\subsetneqq","\\nsubset","\\nsubseteq","\\supset","\\supseteq","\\supsetneq","\\supsetneqq","\\nsupset","\\nsupseteq"]},{latex:"#@^{\\prime}",shift:"#@^{\\doubleprime}",variants:["#@^{\\doubleprime}","#@\\degree"]},{latex:"\\mathrm{d}",shift:"\\partial",variants:["\\mathrm{d}x",{latex:"\\dfrac{\\mathrm{d}}{\\mathrm{d} x}",class:"small"},{latex:"\\frac{\\partial}{\\partial x}",class:"small"},"\\partial"]},{latex:"\\infty",variants:["\\aleph_0","\\aleph_1","\\omega","\\mathfrak{m}"]}],[{label:"[shift]",width:2},{class:"box",latex:",",shift:";",variants:[";","?"]},{class:"box",latex:"\\colon",shift:"\\Colon",variants:[{latex:"\\Colon",aside:"such that",class:"box"},{latex:":",aside:"ratio",class:"box"},{latex:"\\vdots",aside:"",class:"box"},{latex:"\\ddots",aside:"",class:"box"},{latex:"\\ldotp",aside:"low dot",class:"box"},{latex:"\\cdotp",aside:"center dot",class:"box"},{latex:"\\ldots",aside:"low ellipsis",class:"box"},{latex:"\\cdots",aside:"center ellipsis",class:"box"},{latex:"\\therefore",aside:"therefore",class:"box"},{latex:"\\because",aside:"because",class:"box"}]},{class:"box",latex:"\\cdot",aside:"centered dot",shift:"\\ast",variants:["\\circ","\\bigcirc","\\bullet","\\odot","\\oslash","\\circledcirc","\\ast","\\star","\\times","\\doteq","\\doteqdot"]},"[separator]","[left]","[right]",{label:"[backspace]",width:1,class:"action hide-shift"},{label:"[action]",width:1}]]},compact:{label:"compact",rows:[["[+]","[-]","[*]","[/]","[=]","[.]","[(]","[)]","\\sqrt{#0}","#@^{#?}"],["[1]","[2]","[3]","[4]","[5]","[6]","[7]","[8]","[9]","[0]"],["[hr]"],["[undo]","[redo]","[separator]","[separator]","[separator]","[left]","[right]",{label:"[backspace]",class:"action hide-shift"},"[hide-keyboard]"]]},minimalist:{label:"minimalist",layers:[{style:` div.minimalist-backdrop { display: flex; justify-content: center; } div.minimalist-container { --keycap-height: 40px; --keycap-max-width: 53px; --keycap-small-font-size: 12px; background: var(--keyboard-background); padding: 20px 20px 0px 20px; border-top-left-radius: 8px; border-top-right-radius: 8px; border: 1px solid var(--keyboard-border); box-shadow: 0 0 32px rgb(0 0 0 / 30%); } `,backdrop:"minimalist-backdrop",container:"minimalist-container",rows:[["+","-","\\times",{latex:"\\frac{#@}{#0}",class:"small"},"=","[.]","(",")",{latex:"\\sqrt{#0}",class:"small"},{latex:"#@^{#?}",class:"small"}],["1","2","3","4","5","6","7","8","9","0"],["[hr]"],["[undo]","[redo]","[separator]","[separator]","[separator]","[left]","[right]",{label:"[backspace]",class:"action hide-shift"},"[hide-keyboard]"]]}]},"numeric-only":{label:"123",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.numeric",id:"numeric-only",rows:[["7","8","9","[separator]",{label:"[backspace]",width:2}],["4","5","6","[separator]","[separator]","[separator]"],["1","2","3","[separator]","[separator]","[separator]"],["0",{label:"[.]",variants:[]},"-","[separator]","[left]","[right]"]]}};var fs={0:["\\varnothing","\\infty"],1:["\\frac{1}{#@}","#@^{-1}","\\times 10^{#?}","\\phi","\\imaginaryI"],2:["\\frac{1}{2}","#@^2","\\sqrt2","\\exponentialE"],3:["\\frac{1}{3}","#@^3","\\sqrt3","\\pi"],4:["\\frac{1}{4}","#@^4"],5:["\\frac{1}{5}","#@^5","\\sqrt5"],6:["\\frac{1}{6}","#@^6"],7:["\\frac{1}{7}","#@^7"],8:["\\frac{1}{8}","#@^8"],9:["\\frac{1}{9}","#@^9"],".":[".",",",";","\\colon"],",":["{,}",".",";","\\colon"],a:[{latex:"\\aleph",aside:"aleph"},{latex:"\\forall",aside:"for all"},"\xE5","\xE0","\xE1","\xE2","\xE4","\xE6"],A:[{latex:"\\aleph",aside:"aleph"},{latex:"\\forall",aside:"for all"},"\xC5","\xC0","\xC1","\xC2","\xC4","\xC6"],b:[{latex:"\\beth",aside:"beth"}],c:[{latex:"\\C",aside:"set of complex numbers"},"\xE7"],d:[{latex:"\\daleth",aside:"daleth"}],e:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn\u2019t"},"\xE8","\xE9","\xEA","\xEB"],E:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn\u2019t"},"\xC8","\xC9","\xCA","\xCB"],g:[{latex:"\\gimel",aside:"gimel"}],h:[{latex:"\\hbar",aside:"h bar"},{latex:"\\hslash",aside:"h slash"}],i:[{latex:"\\imaginaryI",aside:"imaginary i"},"\xEC","\xED","\xEE","\xEF"],I:[{latex:"\\imaginaryI",aside:"imaginary i"},"\xCC","\xCD","\xCE","\xCF"],j:[{latex:"\\imaginaryJ",aside:"imaginary j"}],l:[{latex:"\\ell",aside:"ell"}],n:[{latex:"\\mathbb{N}",aside:"set of natural numbers"},"\xF1"],o:["\xF8","\u0153","\xF2","\xF3","\xF4","\xF6"],O:["\xF8","\u0152","\xD2","\xD3","\xD4","\xD6"],p:[{latex:"\\mathbb{P}",aside:"set of primes"}],q:[{latex:"\\mathbb{Q}",aside:"set of rational numbers"}],r:[{latex:"\\mathbb{R}",aside:"set of real numbers"}],u:["\xF9","\xFA","\xFB","\xFC"],U:["\xD9","\xDA","\xDB","\xDC"],z:[{latex:"\\mathbb{Z}",aside:"set of integers"}],y:["\xFD","\xFF"],Y:["\u0178"],space:[{latex:'\\char"203A\\!\\char"2039',insert:"\\!",aside:"negative thin space
    \u207B\xB3\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\,\\char"2039',insert:"\\,",aside:"thin space
    \xB3\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\:\\char"2039',insert:"\\:",aside:"medium space
    \u2074\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\;\\char"2039',insert:"\\;",aside:"thick space
    \u2075\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\ \\char"2039',insert:"\\ ",aside:"\u2153 em"},{latex:'\\char"203A\\enspace\\char"2039',insert:"\\enspace",aside:"\xBD em"},{latex:'\\char"203A\\quad\\char"2039',insert:"\\quad",aside:"1 em"},{latex:'\\char"203A\\qquad\\char"2039',insert:"\\qquad",aside:"2 em"}]},yn;function gs(t,e){var d,h,f,x,_;let r=ze.singleton;if(!r)return;let i=xi(t),n="";if(window.mathVirtualKeyboard.isShifted){let b=(d=r.getKeycap(i==null?void 0:i.id))==null?void 0:d.shift;typeof b=="object"&&"variants"in b&&(n=(h=b.variants)!=null?h:"")}else n=(x=(f=r.getKeycap(i==null?void 0:i.id))==null?void 0:f.variants)!=null?x:"";if(typeof n=="string"&&!bs(n)||Array.isArray(n)&&n.length===0){e==null||e();return}let o={},a="";for(let b of Bg(n)){let v=po(b),k=Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36);o[k]=v;let[A,C]=xn(v);a+=`
    ${A}
    `}let s=document.createElement("div");s.setAttribute("aria-hidden","true"),s.className="MLK__variant-panel",s.style.height="auto";let l=Object.keys(o).length,c=5;l===1?c=1:l===2||l===4?c=2:l===3||l===5||l===6?c=3:l>=7&&l<14&&(c=4),s.style.width=`calc(var(--variant-keycap-length) * ${c} + 12px)`,s.innerHTML=bn.createHTML(a),Te.open({root:(_=r==null?void 0:r.container)==null?void 0:_.querySelector(".ML__keyboard"),child:s}),yn=new AbortController;let{signal:u}=yn,m=t==null?void 0:t.getBoundingClientRect();if(m){m.top-s.clientHeight<0&&(s.style.width="auto",l<=6?s.style.height="56px":l<=12?s.style.height="108px":l<=18?s.style.height="205px":s.classList.add("compact"));let b=Math.max(0,Math.min(window.innerWidth-s.offsetWidth,(m.left+m.right-s.offsetWidth)/2)),v=m.top-s.clientHeight+5;s.style.left=`${b}px`,s.style.top=`${v}px`,s.classList.add("is-visible"),requestAnimationFrame(()=>{var k;s.addEventListener("pointerup",A=>{let C=xi(A.target);!(C!=null&&C.id)||!o[C.id]||(ys(o[C.id]),Vr(),e==null||e(),A.preventDefault())},{capture:!0,passive:!1,signal:u}),s.addEventListener("pointerenter",A=>{let C=xi(A.target);!(C!=null&&C.id)||!o[C.id]||C.classList.add("is-active")},{capture:!0,signal:u}),s.addEventListener("pointerleave",A=>{let C=xi(A.target);A.target&&"tagName"in A.target&&typeof A.target.tagName=="string"&&A.target.tagName.toUpperCase()==="ASIDE"||!(C!=null&&C.id)||!o[C.id]||C.classList.remove("is-active")},{capture:!0,signal:u}),(k=r.getKeycap(i==null?void 0:i.id))!=null&&k.stickyVariantPanel?window.addEventListener("pointerdown",A=>{if(!(A.target instanceof Node))return;let C=s.contains(A.target);A.target===s||C||(Vr(),e==null||e())},{signal:u}):(window.addEventListener("pointercancel",()=>{Vr(),e==null||e()},{signal:u}),window.addEventListener("pointerup",()=>{Vr(),e==null||e()},{signal:u}))})}}function Vr(){yn==null||yn.abort(),yn=null,Te.state==="open"&&Te.close()}function Og(t){if(t==="foreground-color"){let e=[];for(let r of Object.keys(Yt))e.push({class:"swatch-button",label:'',command:["applyStyle",{color:r}]});return e}if(t==="background-color"){let e=[];for(let r of Object.keys(Zt))e.push({class:"swatch-button",label:'',command:["applyStyle",{backgroundColor:r}]});return e}}function bs(t){return fs[t]!==void 0}function Bg(t){var e;return typeof t!="string"?t:(fs[t]||(fs[t]=(e=Og(t))!=null?e:[]),fs[t])}function Kg(t){return typeof t=="string"?t:Object.entries(t).map(([e,r])=>`${e}:${r} !important`).join(";")}function Pg(t){return Object.keys(t).map(e=>`${e} {${Kg(t[e])}}`).join("")}function ho(t){if(!t)return"";let e=new K,r=new y({mode:"math",type:"root",body:ge(t,{context:e,args:n=>n==="@"?"{\\class{ML__box-placeholder}{\\blacksquare}}":"\\placeholder{}"})}),i=Tr(qt(new w(r.render(e),{classes:"ML__base"}),e));return Dr(i,{classes:"ML__latex"}).toMarkup()}function xs(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}function Rg(t){return t.replace(/<\/?[^>]+(>|$)/g," ")}function Ig(t){var i,n,o,a;let e=(a=(o=(n=(i=t.tooltip)!=null?i:typeof t.label=="string"?Rg(t.label):void 0)!=null?n:t.insert)!=null?o:t.latex)!=null?a:t.key;return e&&e.replace(/\s+/g," ").trim()||null}function zg(t){if(typeof t=="undefined"||t===null)return null;try{return JSON.stringify(t)}catch(e){return null}}function Ng(t){var r,i;let e=(i=(r=t.insert)!=null?r:t.latex)!=null?i:t.key;return e!=null?e:null}function fo(t){var r;if(Array.isArray(t))return t.map(i=>fo(i)).flat();let e=typeof t=="string"?{markup:t}:t;return"rows"in e&&Array.isArray(e.rows)&&(e.rows=e.rows.map(i=>i.map(n=>po(n)))),(r=e.id)!=null||(e.id="ML__layer_"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36)),[e]}function Fg(){var o,a;let e=window.mathVirtualKeyboard.alphabeticLayout;if(e==="auto"){let s=gr();s&&(e=s.virtualLayout),(!e||e==="auto")&&(e=(o={fr:"azerty",be:"azerty",al:"qwertz",ba:"qwertz",cz:"qwertz",de:"qwertz",hu:"qwertz",sk:"qwertz",ch:"qwertz"}[F.locale.slice(0,2)])!=null?o:"qwerty")}let r={qwerty:["qwertyuiop"," asdfghjkl ","^zxcvbnm~"],azerty:["azertyuiop","qsdfghjklm","^ wxcvbn ~"],qwertz:["qwertzuiop"," asdfghjkl ","^yxcvbnm~"],dvorak:["^ pyfgcrl ","aoeuidhtns","qjkxbmwvz~"],colemak:[" qwfpgjluy ","arstdhneio","^zxcvbkm~"]},i=(a=r[e])!=null?a:r.qwerty,n=e==="azerty"?[[{label:"1",variants:"1"},{label:"2",shift:{latex:"\xE9"},variants:"2"},{label:"3",shift:{latex:"\xF9"},variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{label:"(",latex:"("},variants:"5"},{label:"6",shift:{label:")",latex:")"},variants:"6"},{label:"7",shift:{latex:"\xE8"},variants:"7"},{label:"8",shift:{latex:"\xEA"},variants:"8"},{label:"9",shift:{latex:"\xE7"},variants:"9"},{label:"0",shift:{latex:"\xE0"},variants:"0"}]]:[[{label:"1",variants:"1"},{label:"2",variants:"2"},{label:"3",variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{latex:"\\frac{#@}{#?}"},variants:"5"},{label:"6",shift:{latex:"#@^#?"},variants:"6"},{label:"7",variants:"7"},{label:"8",shift:{latex:"\\times"},variants:"8"},{label:"9",shift:{label:"(",latex:"("},variants:"9"},{label:"0",shift:{label:")",latex:")"},variants:"0"}]];for(let s of i){let l=[];for(let c of s)/[a-z]/.test(c)?l.push({label:c,class:"hide-shift",shift:{label:c.toUpperCase(),variants:bs(c.toUpperCase())?c.toUpperCase():void 0},variants:bs(c)?c:void 0}):c==="~"?e!=="dvorak"?l.push("[backspace]"):l.push({label:"[backspace]",width:1}):c==="^"?l.push("[shift]"):c===" "&&l.push("[separator-5]");n.push(l)}return n.push(["[-]","[+]","[=]",{label:" ",width:1.5},{label:",",shift:";",variants:".",class:"hide-shift"},"[.]","[left]","[right]",{label:"[action]",width:1.5}]),{label:"abc",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.alphabetic",layers:fo({rows:n})}}function Mc(t){if(t==="alphabetic")return Fg();if(typeof t=="string")return _c[t],`${t}`,Mc(_c[t]);let e;if("rows"in t&&Array.isArray(t.rows)){"layers"in t||"markup"in t;let n=t,{rows:a}=n,s=Ai(n,["rows"]);e=g(p({},s),{layers:fo({rows:t.rows})})}else if("markup"in t&&typeof t.markup=="string"){let o=t,{markup:a}=o,s=Ai(o,["markup"]);e=g(p({},s),{layers:fo(t.markup)})}else e=p({},t),"layers"in t?e.layers=fo(t.layers):console.error('MathLive 0.109.0: provide either a "rows", "markup" or "layers" property');let r=!1,i=!1;for(let a of e.layers)if(a.rows)for(let s of a.rows.flat()){vn(s)&&(r=!0);let l=s.command;typeof l=="string"&&["undo","redo","cut","copy","paste"].includes(l)&&(i=!0)}return(!("displayShiftedKeycaps"in t)||t.displayShiftedKeycaps===void 0)&&(e.displayShiftedKeycaps=r),(!("displayEditToolbar"in t)||t.displayEditToolbar===void 0)&&(e.displayEditToolbar=!i),e}function $g(t,e){var i,n;let r='
    ';if(t.normalizedLayouts.length>1)for(let[o,a]of t.normalizedLayouts.entries()){let s=a,l=[o===e?"selected":"layer-switch"];s.tooltip&&l.push("MLK__tooltip"),s.labelClass&&l.push(...s.labelClass.split(" ")),r+=`
    ${(n=s.label)!=null?n:"untitled"}
    `}return r+="
    ",r}function Kp(t,e){let r="";if(t.editToolbar==="none")return"";let n=[];e.selectionIsCollapsed?n.push("undo","redo","pasteFromClipboard"):n.push("cutToClipboard","copyToClipboard","pasteFromClipboard");let o={undo:`
    `,redo:`
    `,cutToClipboard:`
    `,copyToClipboard:`
    `,pasteFromClipboard:`
    `};return r+=n.map(a=>o[a]).join(""),r}function Vg(t){for(let e of t)qg(e)}function qg(t){let e=ze.singleton;if(!e)return;let r={};if(!t.id){if(t.hasAttribute("data-label")&&(r.label=t.dataset.label),t.hasAttribute("data-latex")&&(r.latex=t.dataset.latex),t.hasAttribute("data-key")&&(r.key=t.dataset.key),t.hasAttribute("data-insert")&&(r.insert=t.dataset.insert),t.hasAttribute("data-variants")&&(r.variants=t.dataset.variants),t.hasAttribute("data-aside")&&(r.aside=t.dataset.aside),t.className&&(r.class=t.className),!r.label&&!r.latex&&!r.key&&!r.insert&&(r.latex=t.innerText,r.label=t.innerHTML),t.hasAttribute("data-command"))try{r.command=JSON.parse(t.dataset.command)}catch(i){console.warn("Invalid JSON in data-command attribute",i)}t.id=e.registerKeycap(r)}if(!t.innerHTML){let[i,n]=xn(r);t.innerHTML=globalThis.MathfieldElement.createHTML(i)}}function Hg(){We("virtual-keyboard"),We("core"),dr()}function Pp(){nt("core"),nt("virtual-keyboard")}var Wg=` `;function Rp(t){t.resetKeycapRegistry(),Hg();let e=document.createElement("div");e.className="ML__keyboard";let r=document.createElement("div");r.className="MLK__plate",r.innerHTML=globalThis.MathfieldElement.createHTML(Wg+t.normalizedLayouts.map((a,s)=>Ug(t,a,s)).join(""));let i=document.createElement("div");i.className="MLK__backdrop",i.appendChild(r),e.appendChild(i),e.addEventListener("pointerdown",Jg,{passive:!1});let n=e.querySelectorAll(".ML__edit-toolbar");if(n)for(let a of n)a.addEventListener("click",s=>{var u,m;let l=s.target,c="";for(;l&&!c;)c=(u=l==null?void 0:l.getAttribute("data-command"))!=null?u:"",l=(m=l==null?void 0:l.parentElement)!=null?m:null;c&&t.executeCommand(JSON.parse(c))});Vg(e.querySelectorAll(".MLK__keycap, .action, .fnbutton, .bigfnbutton"));let o=e.querySelectorAll(".MLK__layer");o.length>0;for(let a of o)a.addEventListener("pointerdown",s=>s.preventDefault());return t.currentLayer=t.latentLayer,e}function Ug(t,e,r){var n;let i=[];if(!("layers"in e))return"";for(let o of e.layers)i.push(`
    `),(t.normalizedLayouts.length>1||e.displayEditToolbar)&&(i.push("")),i.push(jg(t,o)),i.push("
    ");return i.join("")}function jg(t,e){if(typeof e=="string")return e;let r="";if(typeof e.style=="string"?r+=``:typeof e.style=="object"&&(r+=``),e.backdrop&&(r+=`
    `),e.container&&(r+=`
    `),e.rows){r+="
    ";for(let i of e.rows){r+='
    ';for(let n of i)if(n){let o=t.registerKeycap(n),[a,s]=xn(n);/(^|\s)separator/.test(s)?r+=`
    ${a}
    `}r+="
    "}r+="
    "}else e.markup&&(r+=e.markup);return e.container&&(r+="
    "),e.backdrop&&(r+="
    "),r}function xn(t,e={shifted:!1}){var n,o,a,s,l,c,u;let r="",i=(n=t.class)!=null?n:"";if(e.shifted&&vn(t)&&(i+=" is-active"),e.shifted&&"shift"in t)typeof t.shift=="string"?r=ho(t.shift):typeof t.shift=="object"&&(r=t.shift.label?t.shift.label:(o=ho(t.shift.latex||t.shift.insert||"")||t.shift.key)!=null?o:""),typeof t.shift=="object"&&(i=(s=(a=t.shift.class)!=null?a:t.class)!=null?s:"");else{if(r=t.label?t.label:(l=ho(t.latex||t.insert||"")||t.key)!=null?l:"",t.shift){let m;typeof t.shift=="string"?m=ho(t.shift):t.shift.label?m=t.shift.label:m=(c=ho(t.shift.latex||t.shift.insert||"")||t.shift.key)!=null?c:"",r+=`${m}`}t.aside&&(r+=``)}return t.layer&&!/layer-switch/.test(i)&&(i+=" layer-switch"),/(^|\s)(separator|action|shift|fnbutton|bigfnbutton)($|\s)/.test(i)||(i+=" MLK__keycap"),!/\bw[0-9]+\b/.test(i)&&t.width&&(i+=(u={0:" w0",.5:" w5",1.5:" w15",2:" w20",5:" w50"}[t.width])!=null?u:""),[r,i||"MLK__keycap"]}var Ut={"[left]":{class:"action hide-shift",label:"",command:"performWithFeedback(moveToPreviousChar)",shift:{label:"",command:"performWithFeedback(extendSelectionBackward)"}},"[right]":{class:"action hide-shift",label:"",command:"performWithFeedback(moveToNextChar)",shift:{label:"",command:"performWithFeedback(extendSelectionForward)"}},"[up]":{class:"action hide-shift",label:"\u2191",command:"performWithFeedback(moveUp)",shift:{label:"\u219F",command:"performWithFeedback(extendSelectionUpward)"}},"[down]":{class:"action hide-shift",label:"\u2193",command:"performWithFeedback(moveDown)",shift:{label:"\u21A1",command:"performWithFeedback(extendSelectionDownward)"}},"[return]":{class:"action hide-shift",command:"performWithFeedback(commit)",shift:{command:"performWithFeedback(addRowAfter)"},width:1.5,label:""},"[action]":{class:"action hide-shift",command:"performWithFeedback(commit)",shift:{label:"",command:"performWithFeedback(addRowAfter)"},width:1.5,label:""},"[hr]":{class:"separator horizontal-rule"},"[hide-keyboard]":{class:"action",command:["hideVirtualKeyboard"],width:1.5,label:""},"[.]":{variants:".",command:"performWithFeedback(insertDecimalSeparator)",shift:",",class:"big-op hide-shift",label:"."},"[,]":{variants:",",command:"performWithFeedback(insertDecimalSeparator)",shift:".",class:"big-op hide-shift",label:","},"[+]":{variants:[{latex:"\\sum_{#0}^{#0}",class:"small"},"\\oplus"],latex:"+",label:"+",class:"big-op hide-shift",shift:{latex:"\\sum",insert:"\\sum",class:"small"}},"[-]":{variants:["\\pm","\\ominus"],latex:"-",label:"−",shift:"\\pm",class:"big-op hide-shift"},"[/]":{class:"big-op hide-shift",shift:{class:"",latex:"\\frac{1}{#@}"},variants:["/","\\div","\\%","\\oslash"],latex:"\\frac{#@}{#?}",label:"÷"},"[*]":{variants:[{latex:"\\prod_{#0}^{#0}",class:"small"},"\\otimes","\\cdot"],latex:"\\cdot",label:"×",shift:{latex:"\\times"},class:"big-op hide-shift"},"[=]":{variants:["\\neq","\\equiv","\\varpropto","\\thickapprox","\\lt","\\gt","\\le","\\ge"],latex:"=",label:"=",shift:{label:"\u2260",latex:"\\ne"},class:"big-op hide-shift"},"[backspace]":{class:"action bottom right hide-shift",width:1.5,command:"performWithFeedback(deleteBackward)",label:"",shift:{class:"action warning",label:"",command:"deleteAll"}},"[undo]":{class:"ghost if-can-undo",command:"undo",label:"",tooltip:"tooltip.undo"},"[redo]":{class:"ghost if-can-redo",command:"redo",label:"",tooltip:"tooltip.redo"},"[(]":{variants:[{latex:"\\lbrack",key:"["},"\\langle","\\lfloor","\\lceil",{latex:"\\lbrace",key:"{"}],key:"(",label:"(",shift:{label:"[",key:"["},class:"hide-shift"},"[)]":{variants:[{latex:"\\rbrack",key:"]"},"\\rangle","\\rfloor","\\rceil",{latex:"\\rbrace",key:"}"}],key:")",label:")",shift:{label:"]",latex:"\\rbrack"},class:"hide-shift"},"[0]":{variants:"0",latex:"0",label:"0",shift:"\\infty",class:"hide-shift"},"[1]":{variants:"1",latex:"1",label:"1",shift:"#@^{-1}",class:"hide-shift"},"[2]":{variants:"2",latex:"2",label:"2",shift:"#@^2",class:"hide-shift"},"[3]":{variants:"3",latex:"3",label:"3",shift:"#@^3",class:"hide-shift"},"[4]":{variants:"4",latex:"4",label:"4",shift:"#@^4",class:"hide-shift"},"[5]":{variants:"5",latex:"5",label:"5",shift:"#@^5",class:"hide-shift"},"[6]":{variants:"6",latex:"6",label:"6",shift:"#@^6",class:"hide-shift"},"[7]":{variants:"7",latex:"7",label:"7",shift:"#@^7",class:"hide-shift"},"[8]":{variants:"8",latex:"8",label:"8",shift:"#@^8",class:"hide-shift"},"[9]":{variants:"9",latex:"9",label:"9",shift:"#@^9",class:"hide-shift"},"[separator-5]":{class:"separator",width:.5},"[separator]":{class:"separator"},"[separator-10]":{class:"separator"},"[separator-15]":{class:"separator",width:1.5},"[separator-20]":{class:"separator",width:2},"[separator-50]":{class:"separator",width:5},"[shift]":{class:"shift bottom left",width:1.5,label:""},"[foreground-color]":{variants:"foreground-color",command:["applyStyle",{color:"red"}],label:""},"[background-color]":{variants:"background-color",command:["applyStyle",{backgroundColor:"yellow"}],label:""}};function po(t){var r;if(typeof t=="string"){if(t==="[.]"&&globalThis.MathfieldElement.decimalSeparator===","&&(t="[,]"),!Ut[t])return{latex:t};t={label:t}}let e;return"label"in t&&t.label&&Ut[t.label]&&(e=g(p(p({},Ut[t.label]),t),{label:Ut[t.label].label})),"key"in t&&t.key&&Ut[t.key]&&(e=g(p(p({},Ut[t.key]),t),{key:Ut[t.key].key})),e?(e.command==="insertDecimalSeparator"&&(e.label=(r=globalThis.MathfieldElement.decimalSeparator)!=null?r:"."),(e.tooltip===void 0||e.tooltip===null||e.tooltip===!1)&&delete e.tooltip,(e.tooltip===void 0||e.tooltip===null||e.tooltip===!1)&&delete e.tooltip,(e.aside===void 0||e.aside===null||e.aside===!1)&&delete e.aside,(e.variants===void 0||e.variants===null||e.variants===!1)&&delete e.variants,(e.shift===void 0||e.shift===null||e.shift===!1)&&delete e.shift,e):t}var go;function Jg(t){var l,c,u,m;if(t.button!==0)return;let e=ze.singleton;if(!e)return;let r=t.target;for(;r&&!r.getAttribute("data-layer");)r=r.parentElement;if(r){e.currentLayer=(l=r.getAttribute("data-layer"))!=null?l:"",t.preventDefault();return}let i=xi(t.target);if(!(i!=null&&i.id))return;let n=e.getKeycap(i.id);if(!n)return;t.type;let o=e;if(!o.connectedMathfieldWindow){let d=(c=window.focusedMathfield)==null?void 0:c.call(window);if(d){let h=(m=(u=d.element)==null?void 0:u.ownerDocument)==null?void 0:m.defaultView;h&&h!==window&&(o.connectedMathfieldWindow=h)}}let a=new AbortController,s=a.signal;i.classList.add("is-pressed"),i.addEventListener("pointerenter",vs(a),{capture:!0,signal:s}),i.addEventListener("pointerleave",vs(a),{capture:!0,signal:s}),i.addEventListener("pointercancel",vs(a),{signal:s}),i.addEventListener("pointerup",vs(a),{signal:s}),vn(n)&&(i.classList.add("is-active"),e.shiftPressCount++),n.variants&&(go&&clearTimeout(go),go=setTimeout(()=>{i.classList.contains("is-pressed")&&(i.classList.remove("is-pressed"),i.classList.add("is-active"),t.target&&"releasePointerCapture"in t.target&&t.target.releasePointerCapture(t.pointerId),gs(i,()=>{a.abort(),i==null||i.classList.remove("is-active")}))},n.stickyVariantPanel?0:300)),t.preventDefault()}function vs(t){return e=>{let r=xi(e.target);if(!(r!=null&&r.id))return;let i=ze.singleton;if(!i)return;let n=i.getKeycap(r.id);if(n){if(e.type==="pointerenter"&&e.target===r&&e.isPrimary&&r.classList.add("is-pressed"),e.type==="pointercancel"){r.classList.remove("is-pressed"),vn(n)&&(i.shiftPressCount--,r.classList.toggle("is-active",i.isShifted)),t.abort();return}if(e.type==="pointerleave"&&e.target===r){r.classList.remove("is-pressed"),vn(n)&&(i.shiftPressCount--,r.classList.toggle("is-active",i.isShifted));return}if(e.type==="pointerup"){go&&clearTimeout(go),vn(n)?r.classList.toggle("is-active",i.isShifted):r.classList.contains("is-pressed")&&(r.classList.remove("is-pressed"),i.isShifted&&n.shift?typeof n.shift=="string"?i.executeCommand(["insert",n.shift,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]):ys(n.shift):ys(n),i.shiftPressCount===1&&!e.shiftKey&&(i.shiftPressCount=0)),t.abort(),e.preventDefault();return}}}}function ys(t){let e=t.command;!e&&t.insert&&(e=["insert",t.insert,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),!e&&t.key&&(e=["typedText",t.key,{focus:!0,feedback:!0,simulateKeystroke:!0}]),!e&&t.latex&&(e=["insert",t.latex,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),e||(e=["typedText",t.label,{focus:!0,feedback:!0,simulateKeystroke:!0}]),ze.singleton&&ze.singleton.executeCommand(e)}function Gg(t){if(t.nodeType!==1)return!1;let e=t.classList;return e.contains("MLK__keycap")||e.contains("shift")||e.contains("action")||e.contains("fnbutton")||e.contains("bigfnbutton")}function xi(t){if(!t)return;let e=t;for(;e&&!Gg(e);)e=e.parentElement;return e!=null?e:void 0}function vn(t){return!!t.class&&/(^|\s)shift($|\s)/.test(t.class)}var ze=class t{constructor(){this.originalContainerBottomPadding=null;this.keycapRegistry={};this._shiftPressCount=0;this.isSandbox=!1;var e;this.targetOrigin=window.origin,this.originValidator="none",this._alphabeticLayout="auto",this._layouts=Object.freeze(["default"]),this._editToolbar="default",this._container=void 0,this._visible=!1,this._rebuilding=!1,this.observer=new ResizeObserver(r=>{this.adjustBoundingRect(),this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect})}),this.listeners={};try{(e=window.top)==null||e.addEventListener("message",this)}catch(r){window.addEventListener("message",this)}qo()&&document.addEventListener("focusin",r=>{let i=r.target;i!=null&&i.isConnected&&setTimeout(()=>{let n=Ip();n&&n.mathVirtualKeyboardPolicy==="auto"&&n.hasEditableContent&&this.show({animate:!0})},300)}),document.addEventListener("focusout",r=>{r.target instanceof at&&r.target.mathVirtualKeyboardPolicy!=="manual"&&setTimeout(()=>{Ip()||this.hide()},300)})}get currentLayer(){var e,r,i;return(i=(r=(e=this._element)==null?void 0:e.querySelector(".MLK__layer.is-visible"))==null?void 0:r.id)!=null?i:""}set currentLayer(e){var i;if(!this._element){this.latentLayer=e;return}let r=e?this._element.querySelector(`#${e}.MLK__layer`):null;r||(r=this._element.querySelector(".MLK__layer")),r&&((i=this._element.querySelector(".MLK__layer.is-visible"))==null||i.classList.remove("is-visible"),r.classList.add("is-visible")),this.render()}get shiftPressCount(){return this._shiftPressCount}set shiftPressCount(e){var r;this._shiftPressCount=e>2||e<0?0:e,(r=this._element)==null||r.classList.toggle("is-caps-lock",this.shiftPressCount===2),this.render()}get isShifted(){return this._shiftPressCount>0}resetKeycapRegistry(){this.keycapRegistry={}}registerKeycap(e){let r="ML__k"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36);return this.keycapRegistry[r]=e,r}setKeycap(e,r){Ut[e]=po(r),this.rebuild()}getKeycap(e){var r;return e?(r=Ut[e])!=null?r:this.keycapRegistry[e]:void 0}getLayer(e){let r=this.normalizedLayouts;for(let i of r)for(let n of i.layers)if(n.id===e)return n}get alphabeticLayout(){return this._alphabeticLayout}set alphabeticLayout(e){this._alphabeticLayout=e,this._normalizedLayouts=void 0,this.rebuild()}get layouts(){return this._layouts}set layouts(e){this.updateNormalizedLayouts(e),this.rebuild()}updateNormalizedLayouts(e){let r=Array.isArray(e)?[...e]:[e],i=r.findIndex(n=>n==="default");i>=0&&r.splice(i,1,"numeric","symbols","alphabetic","greek"),this._layouts=Object.freeze(r),this._normalizedLayouts=r.map(n=>Mc(n))}get normalizedLayouts(){return this._normalizedLayouts||this.updateNormalizedLayouts(this._layouts),this._normalizedLayouts}get editToolbar(){return this._editToolbar}set editToolbar(e){this._editToolbar=e,this.rebuild()}get container(){return this._container===void 0?window.document.body:this._container}set container(e){this._container=e,this.rebuild()}static get singleton(){if(this._singleton===void 0)try{this._singleton=new t}catch(e){this._singleton=null}return this._singleton}get style(){return this._style}addEventListener(e,r,i){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].has(r)||this.listeners[e].add(r)}dispatchEvent(e){return!this.listeners[e.type]||this.listeners[e.type].size===0?!0:(this.listeners[e.type].forEach(r=>{typeof r=="function"?r(e):r==null||r.handleEvent(e)}),!e.defaultPrevented)}removeEventListener(e,r,i){this.listeners[e]&&this.listeners[e].delete(r)}get element(){return this._element}set element(e){var r;this._element!==e&&((r=this._element)==null||r.remove(),this._element=e)}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get boundingRect(){var r;if(!this._visible)return new DOMRect;let e=(r=this._element)==null?void 0:r.getElementsByClassName("MLK__plate")[0];return e?e.getBoundingClientRect():new DOMRect}adjustBoundingRect(){if(!this._element)return;let e=this.boundingRect.height;if(this.container===document.body){this._element.style.setProperty("--_keyboard-height",`calc(${e}px + var(--_padding-top) + var(--_padding-bottom) + env(safe-area-inset-bottom, 0))`);let r=e-1;this.container.style.paddingBottom=this.originalContainerBottomPadding?`calc(${this.originalContainerBottomPadding} + ${r}px)`:`${r}px`}else this._element.style.setProperty("--_keyboard-height",`${e}px`)}rebuild(){if(this._rebuilding||!this._element)return;this._rebuilding=!0;let e=this.currentLayer;requestAnimationFrame(()=>{this._rebuilding=!1,this._element&&(this._element.remove(),this._element=void 0),this.visible&&(this.buildAndAttachElement(),this.currentLayer=e,this.render(),this.adjustBoundingRect(),this._element.classList.add("is-visible"))})}render(){var n;if(!this._element)return;let e=this.getLayer(this.currentLayer);this._element.classList.toggle("backdrop-is-transparent",!!(e&&(e.backdrop||e.container)));let r=this._element.querySelectorAll(".MLK__layer.is-visible .MLK__keycap, .MLK__layer.is-visible .action, .fnbutton, .MLK__layer.is-visible .bigfnbutton, .MLK__layer.is-visible .shift");if(!r)return;let i=this.isShifted;for(let o of r){let a=this.getKeycap(o.id);if(a){let[s,l]=xn(a,{shifted:i});o.innerHTML=globalThis.MathfieldElement.createHTML(s),o.className=l,i&&typeof a.shift=="object"&&((n=a.shift)!=null&&n.tooltip)?o.dataset.tooltip=a.shift.tooltip:!i&&a.tooltip&&(o.dataset.tooltip=a.tooltip)}}}show(e){var i;if(this._visible)return;let r=this.container;if(r&&window.mathVirtualKeyboard&&this.stateWillChange(!0)){if(this._element||(this.buildAndAttachElement(),this.adjustBoundingRect()),!this._visible){let n=this._element.getElementsByClassName("MLK__plate")[0];if(n&&this.observer.observe(n),r===window.document.body){let o=r.style.paddingBottom;this.originalContainerBottomPadding=o;let a=n.offsetHeight-1;r.style.paddingBottom=o?`calc(${o} + ${a}px)`:`${a}px`}window.addEventListener("mouseup",this),window.addEventListener("blur",this),window.addEventListener("keydown",this,{capture:!0}),window.addEventListener("keyup",this,{capture:!0}),(i=this._element)==null||i.classList.toggle("is-caps-lock",this.shiftPressCount===2),this.currentLayer=this.latentLayer}this._visible=!0,e!=null&&e.animate?requestAnimationFrame(()=>{this._element&&(this._element.classList.add("animate"),this._element.addEventListener("transitionend",()=>{var n;return(n=this._element)==null?void 0:n.classList.remove("animate")},{once:!0}),this._element.classList.add("is-visible"),this.stateChanged())}):(this._element.classList.add("is-visible"),this.stateChanged())}}hide(e){var i;let r=this.container;if(r&&this._visible&&this.stateWillChange(!1)){if(this._visible=!1,this._element){this.latentLayer=this.currentLayer;let n=this._element.getElementsByClassName("MLK__plate")[0];n&&this.observer.unobserve(n),window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("keydown",this,{capture:!0}),window.removeEventListener("keyup",this,{capture:!0}),window.removeEventListener("contextmenu",this,{capture:!0}),Vr(),Pp(),(i=this._element)==null||i.remove(),this._element=void 0,this.originalContainerBottomPadding!==null&&(r.style.paddingBottom=this.originalContainerBottomPadding)}this.stateChanged()}}get height(){var e,r;return(r=(e=this.element)==null?void 0:e.offsetHeight)!=null?r:0}buildAndAttachElement(){var e;this.element,this.element=Rp(this),window.addEventListener("contextmenu",this,{capture:!0}),this.element.addEventListener("contextmenu",r=>{r.shiftKey||((r.ctrlKey||r.button===2)&&gs(r.target),r.preventDefault(),r.stopPropagation())},{capture:!0}),(e=this.container)==null||e.appendChild(this.element)}handleEvent(e){if(mo(e)){if(!Qi(e.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");if(e.data.action==="disconnect"){if(this._visible)return;this.connectedMathfieldWindow=void 0}else e.data.action!=="update-setting"&&e.data.action!=="proxy-created"&&e.data.action!=="execute-command"&&(e.source,this.connectedMathfieldWindow=e.source);this.handleMessage(e.data,e.source)}if(this._element)switch(e.type){case"mouseup":case"blur":document.body.style.userSelect="",this.shiftPressCount=0;break;case"contextmenu":e.button!==2&&e.preventDefault();break;case"keydown":{e.key==="Shift"&&!e.repeat&&(this.shiftPressCount=1);break}case"keyup":{(e.key==="Shift"||!e.getModifierState("Shift")&&this.shiftPressCount!==2)&&(this.shiftPressCount=0);break}}}handleMessage(e,r){let{action:i}=e;if(i==="execute-command"){let{command:n}=e,o=mr(n);if(window===window.top&&r!==window||window===window.top&&o!=="virtual-keyboard")return;this.executeCommand(n);return}if((i==="connect"||i==="show")&&this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},r),i!=="disconnect"&&!this.isSandbox){if(i==="show"){typeof e.animate!="undefined"?this.show({animate:e.animate}):this.show();return}if(i==="hide"){typeof e.animate!="undefined"?this.hide({animate:e.animate}):this.hide();return}if(i==="update-setting"){if(e.alphabeticLayout&&(this.alphabeticLayout=e.alphabeticLayout),e.layouts&&(this.layouts=e.layouts),e.editToolbar&&(this.editToolbar=e.editToolbar),e.setKeycap){let{keycap:n,value:o}=e.setKeycap;this.setKeycap(n,o),this.render()}return}if(i==="proxy-created"){this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},r);return}}}sendMessage(e,r,i){if(r.command&&this.dispatchEvent(new CustomEvent("math-virtual-keyboard-command",{detail:r.command})),i||(i=this.connectedMathfieldWindow),this.targetOrigin===null||this.targetOrigin==="null"||i===window){window.dispatchEvent(new MessageEvent("message",{source:window,origin:window.origin,data:p({type:uo,action:e},r)}));return}if(i)i.postMessage(p({type:uo,action:e},r),{targetOrigin:this.targetOrigin});else if(e==="execute-command"&&Array.isArray(r.command)&&r.command[0]==="insert"){let n=r.command[1].split("");for(let o of n)this.dispatchEvent(new KeyboardEvent("keydown",{key:o,bubbles:!0})),this.dispatchEvent(new KeyboardEvent("keyup",{key:o,bubbles:!0}))}}stateWillChange(e){return this.dispatchEvent(new CustomEvent("before-virtual-keyboard-toggle",{detail:{visible:e},bubbles:!0,cancelable:!0,composed:!0}))}stateChanged(){this.dispatchEvent(new Event("virtual-keyboard-toggle")),this._visible||(this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect}))}focus(){this.sendMessage("focus",{})}blur(){this.sendMessage("blur",{})}updateToolbar(e){let r=this._element;if(!r)return;r.classList.toggle("is-math-mode",e.mode==="math"),r.classList.toggle("is-text-mode",e.mode==="text"),r.classList.toggle("can-undo",e.canUndo),r.classList.toggle("can-redo",e.canRedo),r.classList.toggle("can-copy",!e.selectionIsCollapsed),r.classList.toggle("can-cut",!e.selectionIsCollapsed),r.classList.toggle("can-paste",!0);let i=r.querySelectorAll(".ML__edit-toolbar");if(i)for(let n of i)n.innerHTML=Kp(this,e)}update(e){this._style=e.style,this.updateToolbar(e)}connect(){this.connectedMathfieldWindow=window}disconnect(){this._visible||(this.connectedMathfieldWindow=void 0)}executeCommand(e){if(e=yi(e),!e)return!1;let r,i=[],n=mr(e);return ee(e)?(r=e[0],r==="performWithFeedback"&&(n=mr(e.slice(1))),i=e.slice(1)):r=e,n==="virtual-keyboard"?_t[r].fn(void 0,...i):(this.sendMessage("execute-command",{command:e}),!1)}dispose(){window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("message",this)}};function Ip(){let t=hi(),e=null;for(;t;){if("host"in t&&t.host instanceof at){e=t.host;break}t=t.parentNode}return e}ke()&&!("mathVirtualKeyboard"in window)&&(window===window.top?bo():Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>co.singleton,configurable:!0}));function bo(){let t=ze.singleton;return window.mathVirtualKeyboard!==t&&Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>t}),t}function _n(t){let e={};for(let r of Object.keys(t))switch(r){case"scriptDepth":let i=t.scriptDepth;if(ee(i))e.scriptDepth=[i[0],i[1]];else if(typeof i=="number")e.scriptDepth=[i,i];else if(typeof i=="string"){let[o,a]=i.split(",").map(s=>parseInt(s.trim()));e.scriptDepth=[o,a]}else throw new TypeError("Unexpected value for scriptDepth");break;case"mathVirtualKeyboardPolicy":let n=t.mathVirtualKeyboardPolicy.toLowerCase();if(n==="sandboxed"){let o=bo();o&&(o.isSandbox=!0),n="manual"}e.mathVirtualKeyboardPolicy=n;break;case"letterShapeStyle":t.letterShapeStyle==="auto"?F.locale.startsWith("fr")?e.letterShapeStyle="french":e.letterShapeStyle="tex":e.letterShapeStyle=t.letterShapeStyle;break;case"defaultMode":["text","math","inline-math"].includes(t.defaultMode)?e.defaultMode=t.defaultMode:(console.error('MathLive 0.109.0: valid values for defaultMode are "text", "math" or "inline-math"'),e.defaultMode="math");break;case"macros":e.macros=Oi(t.macros);break;default:ee(t[r])?e[r]=[...t[r]]:typeof t[r]=="object"&&!(t[r]instanceof Element)&&r!=="computeEngine"?e[r]=p({},t[r]):e[r]=t[r]}return e}function pr(t,e){let r;typeof e=="string"?r=[e]:e===void 0?r=Object.keys(t):r=e;let i={};for(let n of r)t[n]===null?i[n]=null:ee(t[n])?i[n]=[...t[n]]:typeof t[n]=="object"&&!(t[n]instanceof Element)&&n!=="computeEngine"?i[n]=p({},t[n]):i[n]=t[n];return typeof e=="string"?i[e]:i}function Mn(){return{readOnly:!1,defaultMode:"math",macros:{},registers:{},colorMap:Xr,backgroundColorMap:Ei,letterShapeStyle:F.locale.startsWith("fr")?"french":"tex",minFontScale:0,maxMatrixCols:10,smartMode:!1,smartFence:!0,smartSuperscript:!0,scriptDepth:[1/0,1/0],removeExtraneousParentheses:!0,isImplicitFunction:t=>["\\sin","\\cos","\\tan","\\arcsin","\\arccos","\\arctan","\\arcsec","\\arccsc","\\arsinh","\\arcosh","\\artanh","\\arcsech","\\arccsch","\\arg","\\ch","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\sec","\\sinh","\\sh","\\tanh","\\tg","\\th","\\lg","\\lb","\\log","\\ln"].includes(t),mathModeSpace:"",placeholderSymbol:"\u25A2",contentPlaceholder:"",popoverPolicy:"auto",environmentPopoverPolicy:"off",keybindings:V0,inlineShortcuts:Ja,inlineShortcutTimeout:0,mathVirtualKeyboardPolicy:"auto",originValidator:"none",onInsertStyle:so,onInlineShortcut:()=>"",onScrollIntoView:null,onExport:$0,value:""}}function wc(t){return t.defaultMode==="inline-math"?"math":t.defaultMode}function zp(t,e){let r=t.at(t.position);if(r.type==="composition")r.value=e;else{let{caret:i}=r;r.caret=void 0;let n=new nn(e,{mode:r.mode});n.caret=i,r.parent.addChildAfter(n,r),t.position+=1}}function Np(t){let e=t.at(t.position);e.type==="composition"&&(e.parent.removeChild(e),t.position-=1)}function Xg(t){let e=t.at(t.position);for(;e&&!Ge(e.parentBranch);)e=e.parent;return[e.firstSibling,e.lastSibling]}function Zg(t,e){let r=t.at(t.position);for(;r&&!(r.parent instanceof z);)r=r.parent;if((r==null?void 0:r.type)==="array"&&r.environmentName,!r||!(r.parent instanceof z)){let i=t.at(t.position);if(r=i,!r.parent.parent){let n=t.extractAtoms([t.position,t.lastOffset]),o=t.extractAtoms([0,t.position]),a;return e.endsWith("column")?(o.length===0&&(o=Ms()),n.length===0&&(n=Ms()),a=Re("split",[[o,n]]),t.root=a,yo(a,0,0)?wn(t,a,0,0):yo(a,0,1)?wn(t,a,0,1):t.position=t.offsetOf(i)):(a=Re("lines",[[o],[n]]),t.root=a,wn(t,a,1,0)),[void 0,[0,0]]}if(r.parent instanceof J){let n=r.parent,o=t.extractAtoms([t.position,t.offsetOf(n.lastChild)]),a=t.extractAtoms([t.offsetOf(n.firstChild),t.position]);a.length===0&&(a=Ms()),o.length===0&&(o=Ms());let s="pmatrix",l=n.leftDelim,c=n.rightDelim;l==="("&&(c===")"||c==="?")?s="pmatrix":(l==="["||l==="\\lbrack")&&(c==="]"||c==="\\rbrack"||c==="?")?s="bmatrix":l==="\\vert"&&c==="\\vert"?s="vmatrix":l==="\\Vert"&&c==="\\Vert"?s="Vmatrix":(l==="{"||l==="\\lbrace")&&(c==="."||c==="?")&&(s="cases");let u=Re(s,e.endsWith("column")?[[a,o]]:[[a],[o]]);return n.parent.addChildBefore(u,n),n.parent.removeChild(n),yo(u,0,0)?wn(t,u,0,0):e.endsWith("column")?yo(u,0,1)?wn(t,u,0,1):t.position=t.offsetOf(r):yo(u,1,0)?wn(t,u,1,0):t.position=t.offsetOf(r),[void 0,[0,0]]}}return r&&r.parent instanceof z?[r.parent,r.parentBranch]:[void 0,[0,0]]}function yo(t,e,r){let i=t.getCell(e,r);return(i==null?void 0:i.length)!==2?!1:i[1].type==="placeholder"}function Yg(t,e,r,i){let n=e.getCell(r,i);return n?[t.offsetOf(n[0]),t.offsetOf(n[n.length-1])]:-1}function wn(t,e,r,i){let n=Yg(t,e,r,i);typeof n!="number"&&t.setSelection(n)}function _s(t,e,r,i,n){let o=e.getCell(r,i);o&&t.setPositionHandlingPlaceholder(t.offsetOf(o[n==="start"?0:o.length-1]))}function xo(t,e){let[r,[i,n]]=Zg(t,e);if(r)switch(e){case"after row":r.addRowAfter(i),_s(t,r,i+1,0,"end");break;case"after column":if(r.maxColumns<=r.colCount){t.announce("plonk");return}r.addColumnAfter(n),_s(t,r,i,n+1,"end");break;case"before row":r.addRowBefore(i),_s(t,r,i,0,"start");break;case"before column":if(r.maxColumns<=r.colCount){t.announce("plonk");return}r.addColumnBefore(n),_s(t,r,i,n,"start");break}}function Sc(t){var r;let e=t.at(t.position);if(!Ge(e.parentBranch)&&e.parent!==t.root&&t.root.type!=="root")return t.announce("plonk"),!1;if(!t.contentWillChange({inputType:"insertText"}))return!1;if((r=t.parentEnvironment)!=null&&r.isMultiline){t.selectionIsCollapsed||t.deleteAtoms(de(t.selection));let[i,n]=Xg(t),o=t.extractAtoms([t.position,t.offsetOf(n)]),a=t.extractAtoms([t.offsetOf(i),t.position]),s=i.parent,[l,c]=i.parentBranch;return s.setCell(l,c,a),xo(t,"after row"),s.setCell(l+1,c,o),t.position=t.offsetOf(s.getCell(l+1,c)[0]),t.contentDidChange({inputType:"insertText"}),!0}return xo(t,"after row"),t.contentDidChange({inputType:"insertText"}),!0}function Qg(t){return t.contentWillChange({inputType:"insertText"})?(xo(t,"before row"),t.contentDidChange({inputType:"insertText"}),!0):!1}function kc(t){return t.contentWillChange({inputType:"insertText"})?(xo(t,"after column"),t.contentDidChange({inputType:"insertText"}),!0):!1}function eb(t){return t.contentWillChange({inputType:"insertText"})?(xo(t,"before column"),t.contentDidChange({inputType:"insertText"}),!0):!1}function Lc(t,e){if(!t.contentWillChange({}))return!1;t.mathfield.snapshot();let r=".",i=".";switch(e){case"pmatrix":case"pmatrix*":r="(",i=")";break;case"bmatrix":case"bmatrix*":r="[",i="]";break;case"Bmatrix":case"Bmatrix*":r="\\lbrace",i="\\rbrace";break;case"vmatrix":case"vmatrix*":r="\\vert",i="\\vert";break;case"Vmatrix":case"Vmatrix*":r="\\Vert",i="\\Vert";break;case"matrix":case"matrix*":r=".",i=".";break;case"cases":case"dcases":r="\\lbrace";break;case"rcases":i="\\rbrace";break}let n=t.at(t.position),o=n.type==="array"?n:t.parentEnvironment;return o.environmentName=e,o.leftDelim=r,o.rightDelim=i,t.contentDidChange({}),!0}function Fp(t,e){let r=t.at(t.position);for(;r&&!(Array.isArray(r.parentBranch)&&r.parent instanceof z);)r=r.parent;if(Array.isArray(r==null?void 0:r.parentBranch)&&(r==null?void 0:r.parent)instanceof z){let i=r.parent,n=r.parentBranch,o;switch(e){case"row":if(i.rowCount>1){i.removeRow(n[0]);let a=i.getCell(Math.max(0,n[0]-1),n[1]);o=t.offsetOf(a[a.length-1])}break;case"column":if(i.colCount>i.minColumns){i.removeColumn(n[1]);let a=i.getCell(n[0],Math.max(0,n[1]-1));o=t.offsetOf(a[a.length-1])}break}o!==void 0&&t.setPositionHandlingPlaceholder(o)}}function tb(t){return t.contentWillChange({inputType:"deleteContent"})?(Fp(t,"row"),t.contentDidChange({inputType:"deleteContent"}),!0):!1}function rb(t){return t.contentWillChange({inputType:"deleteContent"})?(Fp(t,"column"),t.contentDidChange({inputType:"deleteContent"}),!0):!1}fe({addRowAfter:Sc,addColumnAfter:kc,addRowBefore:Qg,addColumnBefore:eb,removeRow:tb,removeColumn:rb,setEnvironment:Lc},{target:"model",canUndo:!0,changeContent:!0,changeSelection:!0});function Ms(){return[new Le]}var Ss=class Ss{constructor(e){this.recording=!1;this.model=e,this.reset()}reset(){this.stack=[],this.index=-1,this.lastOp=""}startRecording(){this.recording=!0}stopRecording(){this.recording=!1}canUndo(){return this.index-1>=0}canRedo(){return this.stack.length-1>this.index}stopCoalescing(e){e&&this.index>=0&&(this.stack[this.index].selection=e),this.lastOp=""}undo(){if(!this.canUndo())return!1;let e=this.stack[this.index-1];return this.index-=1,this.lastOp="",this.model.setState(e,{silenceNotifications:!1,type:"undo"}),!0}redo(){if(!this.canRedo())return!1;let e=this.stack[this.index+1];return this.index+=1,this.lastOp="",this.model.setState(e,{silenceNotifications:!1,type:"redo"}),!0}pop(){this.canUndo()&&(this.stack.splice(this.index,this.stack.length-this.index),this.index-=1)}snapshot(e){return this.recording?(e&&e===this.lastOp&&this.pop(),this.stack.splice(this.index+1,this.stack.length-this.index-1),this.stack.push(this.model.getState()),this.index+=1,this.stack.length>Ss.maximumDepth&&(this.stack.shift(),this.index-=1),this.lastOp=e!=null?e:"",!0):!1}};Ss.maximumDepth=1e3;var ws=Ss;function vo(t,e,r,i){var o,a,s,l,c,u;let n=r.parent;if(Ge(i)&&r instanceof z&&r.isMultiline&&ib(t,r,i[0],e))return!0;if(n&&r instanceof J){let m=!i&&e==="forward"||i==="body"&&e==="backward",d=m?t.offsetOf(r.firstChild):t.offsetOf(r.lastChild);return m?r.rightDelim!=="?"&&r.rightDelim!=="."?(r.leftDelim=".",r.isDirty=!0):(n.addChildrenAfter(r.removeBranch("body"),r),n.removeChild(r),d--):r.leftDelim!=="?"&&r.leftDelim!=="."?(r.rightDelim=".",r.isDirty=!0):(n.addChildrenAfter(r.removeBranch("body"),r),n.removeChild(r),d--),t.position=d,!0}if(n&&r.type==="surd"){if(e==="forward"&&!i||e==="backward"&&i==="body"){let m=r.leftSibling;r.hasChildren&&n.addChildrenAfter(r.removeBranch("body"),r),n.removeChild(r),t.position=t.offsetOf(m)}else e==="forward"&&i==="body"?t.position=t.offsetOf(r):!i&&e==="backward"?r.hasChildren?t.position=t.offsetOf(r.lastChild):(t.position=Math.max(0,t.offsetOf(r)-1),n.removeChild(r)):i==="above"&&(r.hasEmptyBranch("above")&&r.removeBranch("above"),e==="backward"?t.position=t.offsetOf(r.leftSibling):t.position=t.offsetOf(r.body[0]));return!0}if(n&&(r.type==="box"||r.type==="enclose")){let m=i&&e==="backward"||!i&&e==="forward"?r.leftSibling:r.lastChild;return n.addChildrenAfter(r.removeBranch("body"),r),n.removeChild(r),t.position=t.offsetOf(m),!0}if(r.type==="genfrac"||r.type==="overunder"){if(!i)return r.type==="overunder"&&r.hasEmptyBranch("body")||r.type==="genfrac"&&r.hasEmptyBranch("below")&&r.hasEmptyBranch("above")?!1:(t.position=t.offsetOf(e==="forward"?r.firstChild:r.lastChild),!0);let m=at.fractionNavigationOrder==="numerator-denominator"?"above":"below",d=m==="above"?"below":"above";if(n&&(e==="forward"&&i===m||e==="backward"&&i===d)){let h=r.removeBranch(m),f=r.removeBranch(d);return n.addChildrenAfter([...h,...f],r),n.removeChild(r),t.position=t.offsetOf(h.length>0?h[h.length-1]:f[0]),!0}return e==="backward"?t.position=t.offsetOf(r.leftSibling):t.position=t.offsetOf(r),!0}if(r.type==="extensible-symbol"||r.type==="subsup"||r.type==="operator"){if(!i&&e==="forward")return!1;if(!i){if(r.subscript||r.superscript){let m=e==="forward"?(s=(o=r.superscript)==null?void 0:o[0])!=null?s:(a=r.subscript)==null?void 0:a[0]:(u=(l=r.subscript)==null?void 0:l[0].lastSibling)!=null?u:(c=r.superscript)==null?void 0:c[0].lastSibling;return m&&(t.position=t.offsetOf(m)),!0}return!1}if(!r.hasChildren&&r.type==="subsup"){let m=e==="forward"?t.offsetOf(r):Math.max(0,t.offsetOf(r)-1);return r.parent.removeChild(r),t.position=m,!0}if(i&&r.hasEmptyBranch(i)){if(r.removeBranch(i),r.type==="subsup"&&!r.subscript&&!r.superscript){let m=e==="forward"?t.offsetOf(r):Math.max(0,t.offsetOf(r)-1);return r.parent.removeChild(r),t.position=m,!0}return i==="superscript"&&e==="backward"?t.position=t.offsetOf(r.firstChild)-1:i==="subscript"&&e==="backward"?r.superscript?t.position=t.offsetOf(r.superscript[0].lastSibling):t.position=t.offsetOf(r.firstChild)-1:t.position=t.offsetOf(r),!0}if(i==="superscript")if(e==="backward"){let m=t.offsetOf(r.firstChild)-1;m>=0,t.position=m}else r.subscript?t.position=t.offsetOf(r.subscript[0]):t.position=t.offsetOf(r);else i==="subscript"&&(e==="backward"&&r.superscript?t.position=t.offsetOf(r.superscript[0].lastSibling):e==="backward"?t.position=t.offsetOf(r.firstChild)-1:t.position=t.offsetOf(r));return!0}if((n==null?void 0:n.type)==="genfrac"&&!i&&r.type!=="first"){let m=t.offsetOf(r.leftSibling);return n.removeChild(r),n.hasEmptyBranch("above")&&n.hasEmptyBranch("below")?(m=t.offsetOf(n.leftSibling),n.parent.removeChild(n),t.announce("delete",void 0,[n]),t.position=m,!0):(t.announce("delete",void 0,[r]),t.position=m,!0)}if(e==="backward"&&((n==null?void 0:n.command)==="\\ln"||(n==null?void 0:n.command)==="\\log")&&r.parentBranch!=="body"){let m=t.offsetOf(n.leftSibling);return n.parent.removeChild(n),t.announce("delete",void 0,[n]),t.position=m,!0}return!1}function $p(t){return!t.mathfield.isSelectionEditable||!t.contentWillChange({inputType:"deleteContentBackward"})?!1:t.selectionIsCollapsed?t.deferNotifications({content:!0,selection:!0,type:"deleteContentBackward"},()=>{var i;let e=t.at(t.position);if(e&&vo(t,"backward",e))return;if(e!=null&&e.isFirstSibling){if(vo(t,"backward",e.parent,e.parentBranch))return;e=null}if(!e){t.announce("plonk");return}let r=e.parent;if(t.position=t.offsetOf(e.leftSibling),r.removeChild(e),t.announce("delete",void 0,[e]),r.type==="latexgroup"&&r.hasEmptyBranch("body")){let n=t.offsetOf(r.leftSibling);(i=r.parent)==null||i.removeChild(r),t.position=Math.max(0,n)}t.root.hasEmptyBranch("body")&&t.mathfield.flushInlineShortcutBuffer()}):st(t,de(t.selection),"deleteContentBackward")}function Vp(t){return!t.mathfield.isSelectionEditable||!t.contentWillChange({inputType:"deleteContentForward"})?!1:t.selectionIsCollapsed?t.deferNotifications({content:!0,selection:!0,type:"deleteContentForward"},()=>{var n,o,a;let e=t.at(t.position).rightSibling;if(e&&vo(t,"forward",e))return;if(e){if(t.at(t.position).isLastSibling&&vo(t,"forward",e.parent,e.parentBranch))return}else{if(e=t.at(t.position),e.isLastSibling&&vo(t,"forward",e.parent,e.parentBranch))return;e=void 0}if(t.position===t.lastOffset||!e){t.announce("plonk");return}let r=e.parent;r.removeChild(e);let i=(n=t.at(t.position))==null?void 0:n.rightSibling;for(;(i==null?void 0:i.type)==="subsup";)i.parent.removeChild(i),i=(o=t.at(t.position))==null?void 0:o.rightSibling;if(t.announce("delete",void 0,[e]),r.type==="latexgroup"&&r.hasEmptyBranch("body")){let s=t.offsetOf(r.leftSibling);(a=r.parent)==null||a.removeChild(r),t.position=Math.max(0,s)}t.root.hasEmptyBranch("body")&&t.mathfield.flushInlineShortcutBuffer()}):st(t,de(t.selection),"deleteContentForward")}function st(t,e,r){let i=t.getAtoms(e);if(i.length>0&&i[0].parent){let n=i[0];for(;n&&!(n instanceof z);)n=n.parent;let o=i[i.length-1];for(;o&&!(o instanceof z);)o=o.parent;if(n&&n instanceof z){let u=n;if(u&&o===u&&u.isMultiline){let[m,d]=[Math.min(t.position,t.anchor),Math.max(t.position,t.anchor)],[h,f]=t.at(m).parentBranch,[x,_]=t.at(d).parentBranch;if(x-h+1>=2)return t.deferNotifications({content:!0,selection:!0,type:r},()=>{var S;let v=u.getCell(h,f),k=u.getCell(x,_);if(!v||!k)return;t.extractAtoms([m,d]);let A=u.getCell(h,f),C=u.getCell(x,_);for(let B=x-1;B>h;B--)u.removeRow(B);if(h!==x){let B=u.getCell(h+1,f);if(A&&B){let $=[...A.filter(G=>G.type!=="first"),...B.filter(G=>G.type!=="first")];u.setCell(h,f,$),u.removeRow(h+1)}}let T=u.getCell(h,f);if(T){let B=A?A.filter($=>$.type!=="first").length:0;t.position=t.offsetOf((S=T[B])!=null?S:T[0])}else t.position=m;u.isDirty=!0})}}let a=i[0].parent.firstChild;a.type==="first"&&(a=a.rightSibling);let s=i[i.length-1].parent.lastChild,l=i[0];l.type==="first"&&(l=l.rightSibling);let c=i[i.length-1];if(l===a&&c===s){let u=i[0].parent;u.parent&&u.type!=="prompt"&&(e=[t.offsetOf(u.leftSibling),t.offsetOf(u)])}if(i.length===1&&i[0].type==="placeholder"&&i[0].parent.type==="genfrac"){let u=i[0].parent,m=i[0].parentBranch==="below"?"above":"below",d=t.offsetOf(u.leftSibling);return t.deferNotifications({content:!0,selection:!0,type:r},()=>{var f,x;let h=u.removeBranch(m);if(h.length===1&&h[0].type==="placeholder")(x=u.parent)==null||x.removeChild(u),t.position=Math.max(0,d);else{let _=u.parent.addChildrenAfter(h,u);(f=u.parent)==null||f.removeChild(u),t.position=t.offsetOf(_)}})}}return t.deferNotifications({content:!0,selection:!0,type:r},()=>{let n=new Map;if(i.length>0){let a=i[0],s=i[i.length-1],l=new Set,c=a.parent;for(;c;)(c.type==="surd"||c.type==="box"||c.type==="enclose"||c.type==="leftright"||c.type==="genfrac"||c.type==="overunder")&&c.parent&&l.add(c),c=c.parent;let u=new Set;for(c=s.parent;c;)(c.type==="surd"||c.type==="box"||c.type==="enclose"||c.type==="leftright"||c.type==="genfrac"||c.type==="overunder")&&c.parent&&u.add(c),c=c.parent;for(let m of i)for(c=m.parent;c;){if((c.type==="surd"||c.type==="box"||c.type==="enclose"||c.type==="leftright"||c.type==="genfrac"||c.type==="overunder")&&c.parent){n.has(c)||n.set(c,{containsStart:l.has(c),containsEnd:u.has(c)});break}c=c.parent}}let o=Math.min(...e);t.deleteAtoms(e);for(let[a,s]of n){if(!a.parent)continue;let l=s.containsStart!==s.containsEnd;if(a.type==="surd"||a.type==="box"||a.type==="enclose"||a.type==="leftright"){let c=a.branch("body");if(!c||c.length===0||c.length===1&&c[0].type==="placeholder"){let m=t.offsetOf(a.leftSibling);a.parent.removeChild(a),t.position=Math.max(0,m)}else if(l&&!s.containsStart&&s.containsEnd){let m=t.offsetOf(a.leftSibling),d=a.removeBranch("body");d&&d.length>0&&a.parent.addChildrenAfter(d,a),a.parent.removeChild(a),t.position=Math.max(0,m)}}if(a.type==="genfrac"){let c=a.branch("above"),u=a.branch("below"),m=!c||c.length===0||c.length===1&&c[0].type==="placeholder",d=!u||u.length===0||u.length===1&&u[0].type==="placeholder";if(m&&d){let h=t.offsetOf(a.leftSibling);a.parent.removeChild(a),t.position=Math.max(0,h)}else if(m&&!d){let h=t.offsetOf(a.leftSibling),f=a.removeBranch("below");f&&f.length>0&&a.parent.addChildrenAfter(f,a),a.parent.removeChild(a),t.position=Math.max(0,h)}else if(!m&&d){let h=t.offsetOf(a.leftSibling),f=a.removeBranch("above");f&&f.length>0&&a.parent.addChildrenAfter(f,a),a.parent.removeChild(a),t.position=Math.max(0,h)}else if(l&&!s.containsStart&&s.containsEnd&&!m&&!d){let h=t.offsetOf(a.leftSibling),f=a.removeBranch("above");f&&f.length>0&&a.parent.addChildrenAfter(f,a),a.parent.removeChild(a),t.position=Math.max(0,h)}}}n.size===0&&(t.position=o),t.root.hasEmptyBranch("body")&&t.mathfield.flushInlineShortcutBuffer()})}function ib(t,e,r,i){if(!(e instanceof z)||!e.isMultiline||e.rows.length===1||e.rows[r].length>1)return!1;let n=e.getCell(r,0);if(!n)return!1;if(e.removeRow(r),i==="backward"){let o=e.getCell(r-1,0);if(!o)return t.position=t.offsetOf(e),!0;o.length>0?t.position=t.offsetOf(o[o.length-1]):t.position=t.offsetOf(e),e.setCell(r-1,0,[...o,...n])}else{let o=e.getCell(r,0);if(!o)return t.position=t.offsetOf(e),!0;o.length>0?t.position=t.offsetOf(o[0]):t.position=t.offsetOf(e),e.setCell(r,0,[...n,...o])}return!0}function nb(t,e,r){var o,a;if(t.at(e).mode!=="text")return e;let i=r==="backward"?-1:1,n;if(Zr.test(t.at(e).value)){let s=e,l;do l=t.at(s).mode==="text"&&Zr.test(t.at(s).value),s+=i;while(t.at(s)&&l);n=t.at(s)?s-2*i:s-i}else if(/\s/.test(t.at(e).value)){let s=e;for(;((o=t.at(s))==null?void 0:o.mode)==="text"&&/\s/.test(t.at(s).value);)s+=i;if(!t.at(s))n=s-i;else{let l=!0;do l=t.at(s).mode==="text"&&!/\s/.test(t.at(s).value),s+=i;while(t.at(s)&&l);n=t.at(s)?s-2*i:s-i}}else{let s=e;for(;((a=t.at(s))==null?void 0:a.mode)==="text"&&!/\s/.test(t.at(s).value);)s+=i;n=t.at(s)?s:s-i;let l=!0;for(;t.at(s)&&l;)l=t.at(s).mode==="text"&&/\s/.test(t.at(s).value),l&&(n=s),s+=i;n=t.at(s)?s-2*i:s-i}return n-(i>0?0:1)}function Mt(t,e,r){var a,s,l,c,u,m,d,h;let i=t.position;(a=r==null?void 0:r.extend)!=null&&a||t.collapseSelection(e);let n=t.at(t.position);if(e==="forward"&&(n.type==="subsup"?(n=n.rightSibling,n||(n=t.at(t.position+1))):n=t.at(t.position+1)),!n)return t.announce("plonk"),!1;let o=t.offsetOf(n);if(n instanceof qe)o=nb(t,o,e);else if(n instanceof pe)if(n.isSuggestion)for(;n&&n instanceof pe;)n.isSuggestion=!1,o=t.offsetOf(n),n=n.rightSibling;else if(e==="forward"){if(n=n.rightSibling,!n||!(n instanceof pe))return t.announce("plonk"),!1;for(;n&&n instanceof pe&&/[a-zA-Z\*]/.test(n.value);)o=t.offsetOf(n),n=n.rightSibling}else{if(n=n.leftSibling,!n||!(n instanceof pe))return t.announce("plonk"),!1;for(;n&&n instanceof pe&&/[a-zA-Z\*]/.test(n.value);)o=t.offsetOf(n),n=n.leftSibling}else if(e==="forward"&&n.type==="mopen"){let f=0;do n.type==="mopen"?f+=1:n.type==="mclose"&&(f-=1),n=n.rightSibling;while(!n.isLastSibling&&f!==0);o=t.offsetOf(n.leftSibling)}else if(e==="backward"&&n.type==="mclose"){let f=0;do n.type==="mopen"?f+=1:n.type==="mclose"&&(f-=1),n=n.leftSibling;while(!n.isFirstSibling&&f!==0);o=t.offsetOf(n)}else if(e==="backward")if(n.type==="first")for(;o>0&&n.type==="first";)o-=1,n=t.at(o);else{let f=n.type;n.type==="subsup"&&(o=t.offsetOf(t.at(o).leftSibling)),o-=1;let x=(s=t.at(o))==null?void 0:s.type;for(;o>=0&&x===f;)((l=t.at(o))==null?void 0:l.type)==="subsup"?o=t.offsetOf(t.at(o).leftSibling):o-=1,x=t.at(o).type}else{let{type:f}=n,x=(c=t.at(o))==null?void 0:c.type,{lastOffset:_}=t;for(;o<=_&&(x===f||x==="subsup");){for(;((u=t.at(o).rightSibling)==null?void 0:u.type)==="subsup";)o=t.offsetOf(t.at(o).rightSibling);o+=1,x=(m=t.at(o))==null?void 0:m.type}o-=1}if((d=r==null?void 0:r.extend)!=null&&d){if(!t.setSelection(t.anchor,o))return t.announce("plonk"),!1;t.announce("move",i)}else{if(o===t.position)return t.announce("plonk"),!1;(h=r==null?void 0:r.delete)!=null&&h?e==="forward"?st(t,[i,o],"deleteWordForward"):(st(t,[i,o],"deleteWordBackward"),t.position=o):(t.position=o,t.announce("move",i))}return t.mathfield.stopCoalescingUndo(),!0}function lt(t,e,r){var o,a;if(r=r!=null?r:{extend:!1},t.mathfield.styleBias=e==="backward"?"right":"left",e!=="forward"){let[s,l]=ds(t);s!==void 0&&l!==void 0&&t.deleteAtoms([s,l])}if(e==="upward")return ab(t,r);if(e==="downward")return sb(t,r);if(r.extend){let s=ks(t,t.position,e);s<0&&(s=0),s>t.lastOffset&&(s=t.lastOffset);let l=t.setSelection(t.anchor,s);return t.mathfield.stopCoalescingUndo(),l}if(t.selectionIsPlaceholder){t.collapseSelection(e);let s=lt(t,e);return t.mathfield.stopCoalescingUndo(),s}let i=t.position,n=i;if(t.collapseSelection(e)?(i=t.position,qp(t,i)||(i=ks(t,i,e))):i=ks(t,i,e),i<0||i>t.lastOffset){let s=!0;return t.silenceNotifications||(s=(a=(o=t.mathfield.host)==null?void 0:o.dispatchEvent(new CustomEvent("move-out",{detail:{direction:e},cancelable:!0,bubbles:!0,composed:!0})))!=null?a:!0),s&&t.announce("plonk"),s}return t.setPositionHandlingPlaceholder(i),t.mathfield.stopCoalescingUndo(),t.announce("move",n),!0}function ks(t,e,r){return e=e+(r==="forward"?1:-1),e<0||e>t.lastOffset||qp(t,e)?e:ks(t,e,r)}function qp(t,e){var n;let r=t.at(e),i=r.parent;for(;i&&!i.inCaptureSelection;)i=i.parent;return!(i!=null&&i.inCaptureSelection||(n=r.parent)!=null&&n.skipBoundary&&(!r.isFirstSibling&&r.isLastSibling||r.type==="first")||t.mathfield.hasEditablePrompts&&!r.parentPrompt)}function ob(t,e,r){let i=1/0,n=0;for(;nc.type==="prompt"&&!c.captureSelection):r,s=ac(t.mathfield.getHTMLElement(e)).right,l=t.offsetOf(ob(t.mathfield,a,s))-(o?1:0);if(i){let[c,u]=t.selection.ranges[0],m;l<(n==="up"?c:u)?m={ranges:[[l,u]],direction:"backward"}:m={ranges:[[c,l]],direction:"forward"},t.setSelection(m)}else t.setPositionHandlingPlaceholder(l);t.announce(`move ${n}`)}function ab(t,e){var a,s;let r=(a=e==null?void 0:e.extend)!=null?a:!1;r||t.collapseSelection("backward");let i=()=>{var c,u;let l=!0;return t.silenceNotifications||(l=(u=(c=t.mathfield.host)==null?void 0:c.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"upward"},cancelable:!0,bubbles:!0,composed:!0})))!=null?u:!0),t.announce(l?"line":"plonk"),l},n=t.at(t.position),o=n;for(;o&&o.parentBranch!=="below"&&!(Array.isArray(o.parentBranch)&&o.parent instanceof z);)o=o.parent;if(Array.isArray(o==null?void 0:o.parentBranch)&&o.parent instanceof z){let l=o.parent;if(o.parentBranch[0]<1)return i();let c=o.parentBranch[0]-1,u=l.getCell(c,o.parentBranch[1]);if(!u.some(d=>d.type==="prompt"&&!d.captureSelection)&&t.mathfield.hasEditablePrompts)return i();Ls(t,n,u,r,"up")}else if(o){let l=(s=o.parent.branch("above"))!=null?s:o.parent.createBranch("above");if(!l.some(u=>u.type==="prompt"&&u.placeholderId)&&t.mathfield.hasEditablePrompts)return i();Ls(t,n,l,r,"up")}else return i();return t.mathfield.stopCoalescingUndo(),!0}function sb(t,e){var a,s;let r=(a=e==null?void 0:e.extend)!=null?a:!1;r||t.collapseSelection("forward");let i=()=>{var c,u;let l=!0;return t.silenceNotifications||(l=(u=(c=t.mathfield.host)==null?void 0:c.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"downward"},cancelable:!0,bubbles:!0,composed:!0})))!=null?u:!0),t.announce(l?"line":"plonk"),l},n=t.at(t.position),o=n;for(;o&&o.parentBranch!=="above"&&!(Ge(o.parentBranch)&&o.parent instanceof z);)o=o.parent;if(Ge(o==null?void 0:o.parentBranch)&&o.parent instanceof z){let l=o.parent;if(o.parentBranch[0]+1>l.rows.length-1)return i();let c=o.parentBranch[0]+1,u=l.getCell(c,o.parentBranch[1]);if(!u.some(d=>d.type==="prompt"&&!d.captureSelection)&&t.mathfield.hasEditablePrompts)return i();Ls(t,n,u,r,"down")}else if(o){let l=(s=o.parent.branch("below"))!=null?s:o.parent.createBranch("below");if(!l.some(u=>u.type==="prompt")&&t.mathfield.hasEditablePrompts)return i();Ls(t,n,l,r,"down")}else return i();return!0}function Cc(t){let e=t.position,r=t.at(e).parent;return r!=null&&r.parent?(t.position=t.offsetOf(r),t.mathfield.stopCoalescingUndo(),t.announce("move",e),!0):(t.announce("plonk"),!1)}function lb(t){let e=0,r=t.at(t.position),i=!1;for(;r;)r.hasEmptyBranch("superscript")?r.hasEmptyBranch("subscript")||(i=!1):(e+=1,i=!0),r=r.parent;return i?e:0}function cb(t){let e=0,r=t.at(t.position),i=!1;for(;r;)r.hasEmptyBranch("subscript")?r.hasEmptyBranch("superscript")||(i=!1):(e+=1,i=!0),r=r.parent;return i?e:0}function Hp(t){if(t.collapseSelection(),lb(t)>=t.mathfield.options.scriptDepth[1])return t.announce("plonk"),!1;let e=t.at(t.position);if(e.subsupPlacement===void 0){let r=e.rightSibling;(r==null?void 0:r.type)!=="subsup"&&(r=new sr({style:e.style}),e.parent.addChildAfter(r,e)),e=r}return e.createBranch("superscript"),t.setSelection(t.getSiblingsRange(t.offsetOf(e.superscript[0]))),!0}function Wp(t){if(t.collapseSelection(),cb(t)>=t.mathfield.options.scriptDepth[0])return t.announce("plonk"),!1;let e=t.at(t.position);if(e.subsupPlacement===void 0){let r=e.rightSibling;(r==null?void 0:r.type)!=="subsup"&&(r=new sr({style:e.style}),e.parent.addChildAfter(r,e)),e=r}return e.createBranch("subscript"),t.setSelection(t.getSiblingsRange(t.offsetOf(e.subscript[0]))),!0}function ub(){function t(l){let c=[],u=[];return[...l.querySelectorAll(`input, select, textarea, a[href], button, [tabindex], audio[controls], video[controls], [contenteditable]:not([contenteditable="false"]), details>summary`)].filter(e).forEach((d,h)=>{let f=i(d);f===0?c.push(d):u.push({documentOrder:h,tabIndex:f,node:d})}),u.sort((d,h)=>d.tabIndex===h.tabIndex?d.documentOrder-h.documentOrder:d.tabIndex-h.tabIndex).map(d=>d.node).concat(c)}function e(l){return!(!r(l)||n(l)||i(l)<0)}function r(l){return!(l.disabled||l.type==="hidden"&&l.tagName.toUpperCase()==="INPUT"||s(l))}function i(l){var u;let c=Number.parseInt((u=l.getAttribute("tabindex"))!=null?u:"NaN",10);return Number.isNaN(c)?l.contentEditable==="true"||(l.nodeName==="AUDIO"||l.nodeName==="VIDEO")&&l.getAttribute("tabindex")===null?0:l.tabIndex:c}function n(l){return l.tagName.toUpperCase()==="INPUT"&&l.type==="radio"&&!a(l)}function o(l,c){for(let u of l)if(u.checked&&u.form===c)return u;return null}function a(l){var d;if(!l.name)return!0;let u=((d=l.form)!=null?d:l.ownerDocument).querySelectorAll('input[type="radio"][name="'+l.name+'"]'),m=o(u,l.form);return!m||m===l}function s(l){if(!ke()||l===document.activeElement||l.contains(document.activeElement))return!1;if(getComputedStyle(l).visibility==="hidden")return!0;let c=l.getBoundingClientRect();if(c.width===0||c.height===0)return!0;for(;l;){if(getComputedStyle(l).display==="none")return!0;l=l.parentElement}return!1}return ke()?t(document.body):[]}function Oe(t,e,r="forward"){let i=t.position;if(ee(e)){let n=t.offsetOf(e[0]),o=t.offsetOf(e[e.length-1]);return r==="forward"?t.setSelection(n,o):t.setSelection(o,n),t.announce("move",i),t.mathfield.stopCoalescingUndo(),!0}return r==="forward"?Oe(t,[e.leftSibling,e]):Oe(t,[e,e.leftSibling])}function wt(t,e){let r=t.position;if(typeof e=="number"&&(e=t.at(e)),e.type==="prompt")t.setSelection(t.offsetOf(e.firstChild),t.offsetOf(e.lastChild));else{let i=t.offsetOf(e);e.type==="placeholder"?t.setSelection(i-1,i):t.position=i}return t.announce("move",r),t.mathfield.stopCoalescingUndo(),!0}function Sn(t,e){var a,s;let r=e==="forward"?1:-1;t.at(t.anchor).type==="placeholder"&<(t,e);let i,n=t.at(t.anchor).parentPrompt;n?e==="forward"?i=t.offsetOf(n)+1:i=t.offsetOf(n.leftSibling):i=Math.max(t.position+r,0);let o=Ac(t,i,e);if(!o||e==="forward"&&t.offsetOf(o)i){if(!((s=(a=t.mathfield.host)==null?void 0:a.dispatchEvent(new CustomEvent("move-out",{detail:{direction:e},cancelable:!0,bubbles:!0,composed:!0})))!=null?s:!0))return t.announce("plonk"),!1;let c=ub();if(!document.activeElement||c.length<=1)return t.announce("plonk"),!1;let u=c.indexOf(document.activeElement)+r;return u<0&&(u=c.length-1),u>=c.length&&(u=0),c[u].focus(),t.mathfield.stopCoalescingUndo(),!0}return wt(t,o),!0}function Ac(t,e=0,r="forward"){return t.findAtom(i=>i.type==="placeholder"||i.type==="prompt"||!t.mathfield.readOnly&&i.treeDepth>2&&i.isFirstSibling&&i.isLastSibling,e,r)}fe({moveToOpposite:t=>{let e={superscript:"subscript",subscript:"superscript",above:"below",below:"above"},r=t.at(t.position),{parent:i}=r;if(!i)return t.announce("plonk"),!1;let n=r.parentBranch,o;if(typeof n=="string"&&(o=e[n]),!o){let s=r.subsupPlacement?Wp(t):Hp(t);return t.mathfield.stopCoalescingUndo(),s}i.branch(o)||i.createBranch(o);let a=t.setSelection(t.getBranchRange(t.offsetOf(i),o));return t.mathfield.stopCoalescingUndo(),a},moveBeforeParent:t=>{let{parent:e}=t.at(t.position);return e?(t.position=t.offsetOf(e),t.mathfield.stopCoalescingUndo(),!0):(t.announce("plonk"),!1)},moveAfterParent:t=>Cc(t),moveToNextChar:t=>lt(t,"forward"),moveToPreviousChar:t=>lt(t,"backward"),moveUp:t=>lt(t,"upward"),moveDown:t=>lt(t,"downward"),moveToNextWord:t=>Mt(t,"forward"),moveToPreviousWord:t=>Mt(t,"backward"),moveToGroupStart:t=>{let e=t.offsetOf(t.at(t.position).firstSibling);return e===t.position?(t.announce("plonk"),!1):(t.position=e,t.mathfield.stopCoalescingUndo(),!0)},moveToGroupEnd:t=>{let e=t.offsetOf(t.at(t.position).lastSibling);return e===t.position?(t.announce("plonk"),!1):(t.position=e,t.mathfield.stopCoalescingUndo(),!0)},moveToNextGroup:t=>{var l,c,u,m;if(t.position===t.lastOffset&&t.anchor===t.lastOffset)return Sn(t,"forward");let e=t.at(t.position);if(e.mode==="text"){if(t.selectionIsCollapsed){let d=e;for(;(d==null?void 0:d.mode)==="text";)d=d.leftSibling;let h=e;for(;((l=h.rightSibling)==null?void 0:l.mode)==="text";)h=h.rightSibling;if(d&&h)return Oe(t,[d,h])}if(e.rightSibling.mode==="text"){let d=e;for(;(d==null?void 0:d.mode)==="text";)d=d.rightSibling;return d?(wt(t,(c=d.leftSibling)!=null?c:d),t.mathfield.switchMode("math"),!0):wt(t,t.lastOffset)}}let i=t.at(t.anchor).parentPrompt,n=i?t.offsetOf(i)+1:Math.max(t.position+1,0),o=Ac(t,n,"forward");if(o&&t.offsetOf(o)d.type==="leftright"||d.type==="text","forward");if(a){if(a.mode==="text"){let d=a;for(;(d==null?void 0:d.mode)==="text";)d=d.rightSibling;return Oe(t,[(u=a.leftSibling)!=null?u:a,(m=d.leftSibling)!=null?m:d])}return Oe(t,a)}let s=e.parent;if(s){if(s.type==="leftright"||s.type==="surd")return Oe(t,s);if(e.parentBranch==="superscript"&&s.subscript)return Oe(t,s.subscript);if(e.parentBranch==="above"&&s.below)return Oe(t,s.below);if(e.parentBranch==="superscript"||e.parentBranch==="subscript")return wt(t,s);if(e.parentBranch==="above"||e.parentBranch==="below")return Oe(t,s)}return wt(t,t.lastOffset)},moveToPreviousGroup:t=>{var a;if(t.position===0&&t.anchor===0)return Sn(t,"backward");let e=t.at(t.position),r=e.mode;if(r==="text"){if(t.selectionIsCollapsed){let s=e;for(;(s==null?void 0:s.mode)==="text";)s=s.leftSibling;let l=e;for(;((a=l.rightSibling)==null?void 0:a.mode)==="text";)l=l.rightSibling;if(s&&l)return Oe(t,[s,l])}for(;(e==null?void 0:e.mode)==="text";)e=e.leftSibling;return e?wt(t,e):wt(t,0)}let i=t.at(t.anchor).parentPrompt,n=i?t.offsetOf(i.leftSibling):Math.max(t.position-1,0),o=Ac(t,n,"backward");if(o&&t.offsetOf(o)>n)return Sn(t,"backward");if(o)return wt(t,o);if(r==="math"){let s=Up(t,e,c=>c.type==="leftright"||c.type==="text","backward");if(s){if(s.mode==="text"){let c=s;for(;(c==null?void 0:c.mode)==="text";)c=c.leftSibling;return Oe(t,[s,c])}return Oe(t,s)}let l=e.parent;if(l){if(l.type==="leftright"||l.type==="surd")return Oe(t,l);if(e.parentBranch==="subscript"&&l.superscript)return Oe(t,l.superscript);if(e.parentBranch==="below"&&l.above)return Oe(t,l.above);if(e.parentBranch==="superscript"||e.parentBranch==="subscript")return wt(t,l);if(e.parentBranch==="above"||e.parentBranch==="below")return Oe(t,l)}return wt(t,0)}return!1},moveToMathfieldStart:t=>t.selectionIsCollapsed&&t.position===0?(t.announce("plonk"),!1):(t.position=0,t.mathfield.stopCoalescingUndo(),!0),moveToMathfieldEnd:t=>t.selectionIsCollapsed&&t.position===t.lastOffset?(t.announce("plonk"),!1):(t.position=t.lastOffset,t.mathfield.stopCoalescingUndo(),!0),moveToSuperscript:Hp,moveToSubscript:Wp},{target:"model",changeSelection:!0});fe({moveToNextPlaceholder:t=>Sn(t,"forward"),moveToPreviousPlaceholder:t=>Sn(t,"backward")},{target:"model",changeSelection:!0,audioFeedback:"return"});function Up(t,e,r,i){if(i==="forward"){let o=e.rightSibling;for(;o&&!r(o);)o=o.rightSibling;return o}let n=e.leftSibling;for(;n&&!r(n);)n=n.leftSibling;return n}function As(t,e,r){typeof e=="function"&&(r=e,e=1/0),e===void 0&&(e=1/0);let i=t.position,n=!1,o="";for(;!n;){let a=t.at(i);n=e===0||a===void 0||a.type==="first"||a.mode!=="math"||!(a.type&&/mord|mpunct|operator/.test(a.type)||a.type==="mop"&&/[a-zA-Z ]+/.test(a.value))||!a.hasEmptyBranch("superscript")||!a.hasEmptyBranch("subscript")||typeof r=="function"&&!r(a),n||(a.mode="text",a.command=a.value,a.verbatimLatex=void 0,o+=a.value),i-=1,e-=1}t.contentDidChange({data:o,inputType:"insertText"})}function vi(t,e,r){typeof e=="function"&&(r=e,e=1/0),e===void 0&&(e=1/0);let i=t.position,n=!1,o=[];for(;!n;){let a=t.at(i);n=e===0||!a||a.type==="first"||a.isFirstSibling||a.mode!=="text"||a.value===" "||typeof r=="function"&&!r(a),n||(o.push(y.serialize([a],{defaultMode:"math"})),a.mode="math"),i-=1,e-=1}Cs(t),t.contentDidChange({data:P(o),inputType:"insertText"})}function Cs(t){var r;let e=t.position-1;for(;e>=0&&((r=t.at(e))==null?void 0:r.mode)==="math";)e-=1;if(!(e<0)&&t.at(e).mode==="text"&&t.at(e).value===" "&&t.at(e-1).mode==="math"){t.at(e-1).parent.removeChild(t.at(e-1));let i=t.silenceNotifications;t.silenceNotifications=!0,t.position-=1,t.silenceNotifications=i,t.contentDidChange({inputType:"deleteContent"})}}function db(t){let e="",r=t.position,i=!1;for(;!i;){let n=t.at(r);i=!(n&&(n.mode==="text"||n.mode==="math"&&n.type&&/mord|mpunct/.test(n.type))),i||(e=n.value+e),r-=1}return e}function jp(t,e,r){let{model:i}=t;if(i.mode==="latex"||!i.at(i.position).isLastSibling||!r||!cr(r))return!1;let n=zr(r);if(!i.selectionIsCollapsed)return!!(t.model.mode==="text"&&/[/_^]/.test(n));let o=db(i)+n;if(t.model.mode==="text"){if(e==="Esc"||/[/\\]/.test(n))return!0;if(/[\^_]/.test(n))return/(^|\s)[a-zA-Z][^_]$/.test(o)&&vi(i,1),!0;let a={")":"(","}":"{","]":"["}[n],{parent:s}=i.at(i.position);if(a&&s instanceof J&&s.leftDelim===a)return!0;if(/(^|[^a-zA-Z])(a|I) $/.test(o))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(n))return!0;if(/(^|[^a-zA-Z'’])[a-zA-Z] $/.test(o))return vi(i,1),!1;if(/\D\.[^\d\s]$/.test(o)){vi(i,1);let l=i.at(i.position);return l.value="\u22C5",l.style.variant="normal",l.command="\\cdot",l.verbatimLatex=void 0,i.contentDidChange({data:"\\cdot",inputType:"insertText"}),!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(o)||/\.\d$/.test(o)||/\([\d+\-.]$/.test(o))return vi(i,1),!0;if(/\([a-z][,;]$/.test(o))return vi(i,2),!0;if(/[\d+\-=><*|]$/.test(n))return Cs(i),!0}else{if(e==="[Space]")return As(i,void 0,a=>/[a-z][:,;.]$/.test(a.value)),!0;if(/[a-zA-Z]{3,}$/.test(o)&&!/(dxd|abc|xyz|uvw)$/.test(o))return As(i,void 0,a=>/[a-zA-Z]/.test(a.value)),!0;if(/(^|\W)(if)$/i.test(o))return As(i,1),!0;if(/(\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5){3,}$/u.test(o)&&!/(αβγ)$/.test(o))return As(i,void 0,a=>/(:|,|;|.|\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5)/u.test(a.value)),!0;if(n==="?"||n==="."&&!/[\d-+]\.$/.test(o))return!0}return!1}function Jp(t,e){if(!t.isSelectionEditable||!t.keystrokeCaptionVisible)return;let r=Xp(),i=t.element.getBoundingClientRect();r.style.left=`${i.left}px`,r.style.top=`${i.top-64}px`,r.innerHTML=globalThis.MathfieldElement.createHTML(""+(hn(e)||e)+""+r.innerHTML),r.style.visibility="visible",setTimeout(()=>{r.childNodes.length>0&&r.childNodes[r.childNodes.length-1].remove(),r.childNodes.length===0&&(r.style.visibility="hidden")},3e3)}function Gp(t){if(t.keystrokeCaptionVisible=!t.keystrokeCaptionVisible,t.keystrokeCaptionVisible){let e=Xp();e.innerHTML=""}else{let e=bi("mathlive-keystroke-caption-panel");e.style.visibility="hidden"}return!1}function Xp(){let t=document.getElementById("mathlive-keystroke-caption-panel");return t||(We("keystroke-caption"),We("core"),bi("mathlive-keystroke-caption-panel"))}function Zp(){document.getElementById("mathlive-keystroke-caption-panel")&&($r("mathlive-keystroke-caption-panel"),nt("core"),nt("keystroke-caption"))}function Tc(t,e){var d,h,f,x;let{model:r}=t,i=us(e);if(e.isTrusted){Mu(e);let _=gr();t.keyboardLayout!==_.id&&(t.keyboardLayout=_.id,t._keybindings=void 0)}if(clearTimeout(t.inlineShortcutBufferFlushTimer),t.inlineShortcutBufferFlushTimer=0,Jp(t,i),e.isTrusted&&e.defaultPrevented)return t.flushInlineShortcutBuffer(),!1;let n,o=0,a="",s=0,l=t.inlineShortcutBuffer,c=!1;if(t.isSelectionEditable&&r.selectionIsPlaceholder&&cr(e)&&(t.flushInlineShortcutBuffer(),r.deleteAtoms(de(r.selection)),t.snapshot("delete"),c=!0),t.isSelectionEditable){if(r.mode==="math"&&(!r.selectionIsPlaceholder||c))if(i==="[Backspace]")t.undoManager.lastOp==="insert-shortcut"?a="undo":l.pop();else if(!cr(e))t.flushInlineShortcutBuffer();else{let _=zr(e),b=[...(h=(d=l[l.length-1])==null?void 0:d.keystrokes)!=null?h:[],_];l.push({state:r.getState(),keystrokes:b,leftSiblings:hb(t)}),o=0;let v="";for(;!n&&o(q.insert(r,n,{format:"latex",style:_}),Cs(t.model),n.endsWith(" ")&&(t.switchMode("text"),q.insert(r," ",{style:_,mode:"text"})),t.snapshot(),r.selectionIsCollapsed||t.flushInlineShortcutBuffer(),!0)),t.dirty=!0,r.announce("replacement")}return t.scrollIntoView(),e.preventDefault&&e.preventDefault(),!1}function mb(t){var h,f;let{position:e}=t,r=e,i=[];for(;r>0;){let x=t.at(r),_=x.value;if(x.type==="mord"||x.type==="mbin"&&(_==="+"||_==="-"||_==="\u2212"))i.unshift(x),r--;else break}if(i.length===0)return null;let n=i.map(x=>x.value).join(""),a=((f=(h=globalThis.MathfieldElement)==null?void 0:h.decimalSeparator)!=null?f:".")==="."?"\\.":",",s=new RegExp(`^(\\d+(?:${a}\\d*)?)[eE]([+\\-\u2212]?)(\\d+)$`),l=n.match(s);if(!l)return null;let c=l[1],u=l[2],m=l[3],d=u+m;return{startOffset:r,endOffset:e,significand:c,exponent:d}}function pb(t,e){var n;let r=(n=globalThis.MathfieldElement)==null?void 0:n.scientificNotationTemplate;if(!r||r===""||!r.includes("#1")||!r.includes("#2"))return null;let i=r.replace("#1",t);return i=i.replace("#2",e),i}function Yp(t){let{model:e}=t;if(e.mode!=="math")return!1;let r=mb(e);if(!r)return!1;let i=pb(r.significand,r.exponent);return i?(e.deferNotifications({content:!0,selection:!0,type:"insertText"},()=>{e.selection={ranges:[[r.startOffset,r.endOffset]],direction:"forward"},q.insert(e,i,{insertionMode:"replaceSelection",selectionMode:"after"})}),t.snapshot("format-scientific-notation"),t.dirty=!0,t.scrollIntoView(),!0):!1}function _o(t,e,r){let{model:i}=t;if(!t.isSelectionEditable){i.announce("plonk");return}r!=null||(r={}),r.focus&&t.focus(),r.feedback&&globalThis.MathfieldElement.playSound("keypress"),typeof r.mode=="string"&&(t.switchMode(r.mode),t.snapshot());let n=$a(e),o=window.mathVirtualKeyboard;if(o!=null&&o.isShifted&&(n=typeof n=="string"?n.toUpperCase():n.map(a=>a.toUpperCase())),r.simulateKeystroke){let a=!0;for(let s of n)Tc(t,new KeyboardEvent("keypress",{key:s}))&&(a=!1);if(a)return}if(i.mode==="latex"){if(i.deferNotifications({content:!0,selection:!0,data:e,type:"insertText"},()=>{gi(t);for(let a of n)q.insert(i,a,{insertionMode:"replaceSelection"});t.snapshot("insert-latex"),Fr(t)}),e==="}"){let s=fi(i).map(c=>c.value).join(""),l=s.match(/^\\([a-zA-Z]+)/);if(l){let c="\\"+l[1],u=ne(c,"math");if((u==null?void 0:u.definitionType)==="function"){let m=u.params.filter(d=>!d.isOptional).length;if(m>0){let d=0,h=0,f=!0;for(let x=0;x0?t.options.inlineShortcutTimeout:1e3;clearTimeout(t.scientificNotationTimer),t.scientificNotationTimer=setTimeout(()=>{Yp(t)},l)}}function gb(t){var r,i,n,o;if(t.selectionIsCollapsed)return(i=(r=t.at(t.position))==null?void 0:r.style)!=null?i:{};let e=de(t.selection)[0];return(o=(n=t.at(e+1))==null?void 0:n.style)!=null?o:{}}function eh(t,e,r){var l;if(!e||t.mode!=="math")return!1;let i=t.at(t.position),{parent:n}=i,o={"(":"(",")":")","{":"\\lbrace","}":"\\rbrace","[":"\\lbrack","]":"\\rbrack","|":"|"}[e];if(!o)return!1;let a=tn[o],s=en[o];if(!t.selectionIsCollapsed){t.mathfield.snapshot();let[c,u]=de(t.selection),m=t.extractAtoms([c,u]),d=n.addChildrenAfter([new J("left...right",m,{leftDelim:o,rightDelim:s})],t.at(c));return t.setSelection(t.offsetOf(d.firstChild),t.offsetOf(d.lastChild)),t.mathfield.snapshot("insert-fence"),t.contentDidChange({data:o,inputType:"insertText"}),!0}if(o==="|"){let c=n instanceof J?n.leftDelim+n.rightDelim:"";if(c==="\\lbrace\\rbrace"||c==="\\{\\}"||c==="\\lbrace?")return t.mathfield.snapshot(),q.insert(t,"\\,\\middle\\vert\\,",{format:"latex",style:r}),t.mathfield.snapshot("insert-fence"),t.contentDidChange({data:o,inputType:"insertText"}),!0}if(s){if(n instanceof J&&n.firstChild===i&&(n.leftDelim==="?"||n.leftDelim==="."))return n.leftDelim=o,n.isDirty=!0,t.mathfield.snapshot(),t.contentDidChange({data:o,inputType:"insertText"}),t.mathfield.snapshot("insert-fence"),!0;if(!(n instanceof J)){let d=i;for(;d&&!(d.type==="mclose"&&d.value===s);)d=d.rightSibling;if(d){t.mathfield.snapshot();let h=t.extractAtoms([t.offsetOf(i),t.offsetOf(d)]);h.pop();let f=new J("left...right",h,{leftDelim:o,rightDelim:s});return n.addChildrenAfter([f],i),t.position=t.offsetOf(f.firstChild),t.contentDidChange({data:o,inputType:"insertText"}),t.mathfield.snapshot("insert-fence"),!0}}let c=t.offsetOf(i.lastSibling),u;for(u=t.position;u<=c;u++){let d=t.at(u);if(d instanceof J&&(d.leftDelim==="?"||d.leftDelim===".")&&Qp(o,d.rightDelim))break}let m=t.at(u);if(u<=c&&m instanceof J){m.leftDelim=o,t.mathfield.snapshot();let d=t.extractAtoms([t.position,u-1]);return d=d.filter(h=>h.type!=="first"),m.addChildren(d,m.parentBranch),t.position+=1,t.contentDidChange({data:o,inputType:"insertText"}),t.mathfield.snapshot("insert-fence"),!0}if(n instanceof J&&(n.leftDelim==="?"||n.leftDelim===".")&&Qp(o,n.rightDelim)){n.isDirty=!0,n.leftDelim=o,t.mathfield.snapshot();let d=t.extractAtoms([t.offsetOf(i.firstSibling),t.position]);for(let h of d)n.parent.addChildBefore(h,n);return t.contentDidChange({data:o,inputType:"insertText"}),t.mathfield.snapshot("insert-fence"),!0}if(!(n instanceof J&&n.leftDelim==="|")){if(o==="("){let d=t.position-1,h=!1;for(;d>=0;){let f=t.at(d);if(f.type==="first")break;if(f.type==="mord"&&f.value&&/^[\d]$/.test(f.value)){d-=1;continue}if(f.type==="group"&&((l=f.body)==null?void 0:l.length)===2&&f.body[0].type==="first"&&f.body[1].value===","){h=!0;break}if(f.type==="mord"&&(f.value===","||f.value===".")){h=!0;break}break}if(h)return!1}if(t.mathfield.snapshot(),q.insert(t,`\\left${o}\\right?`,{format:"latex",style:r}),i.lastSibling.type!=="first"){let d=t.offsetOf(i.lastSibling),h=t.extractAtoms([t.position,d]);t.at(t.position).body=h,t.position-=1}return t.mathfield.snapshot("insert-fence"),!0}}if(a){if(o===")"){let f=t.position-1,x=!1;for(;f>=0;){let _=t.at(f);if(_.type==="first")break;if(_.type==="mord"&&_.value&&/^[\d]$/.test(_.value)){x=!0,f-=1;continue}break}if(x&&t.at(f).type==="mopen"&&t.at(f).value==="(")return!1}let c=i;for(;c;){if(c.type==="mopen"&&c.value===a){t.mathfield.snapshot();let f=c.leftSibling,x=t.extractAtoms([t.offsetOf(c.leftSibling),t.offsetOf(i)]);[,...x]=x;let _=new J("left...right",x,{leftDelim:a,rightDelim:o});return n.addChildrenAfter([_],f),t.position=t.offsetOf(_),t.contentDidChange({data:o,inputType:"insertText"}),t.mathfield.snapshot("insert-fence"),!0}c=c.leftSibling}if(n instanceof J&&i.isLastSibling&&Ec(n.leftDelim,o))return t.mathfield.snapshot(),n.isDirty=!0,n.rightDelim=o,t.position+=1,t.contentDidChange({data:o,inputType:"insertText"}),t.mathfield.snapshot("insert-fence"),!0;let u=t.offsetOf(i.firstSibling),m;for(m=t.position;m>=u;m--){let f=t.at(m);if(f instanceof J&&(f.rightDelim==="?"||f.rightDelim===".")&&Ec(f.leftDelim,o))break}let d=t.at(m);if(m>=u&&d instanceof J)return t.mathfield.snapshot(),d.rightDelim=o,d.addChildren(t.extractAtoms([m,t.position]),d.parentBranch),t.contentDidChange({data:o,inputType:"insertText"}),t.mathfield.snapshot("insert-fence"),!0;if(n instanceof J&&(n.rightDelim==="?"||n.rightDelim===".")&&Ec(n.leftDelim,o))return t.mathfield.snapshot(),n.isDirty=!0,n.rightDelim=o,n.parent.addChildren(t.extractAtoms([t.position,t.offsetOf(i.lastSibling)]),n.parentBranch),t.position=t.offsetOf(n),t.contentDidChange({data:o,inputType:"insertText"}),t.mathfield.snapshot("insert-fence"),!0;let h=n.parent;return h instanceof J&&(h.rightDelim==="?"||h.rightDelim===".")&&t.at(t.position).isLastSibling?(t.position=t.offsetOf(h),eh(t,o,r)):!1}return!1}function Ec(t,e){return t?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(t)?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(e):en[t]===e:!0}function Qp(t,e){return e?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(e)?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(t):tn[e]===t:!0}fe({scrollIntoView:t=>(t.scrollIntoView(),!0),scrollToStart:t=>(t.field.scroll(0,0),!0),scrollToEnd:t=>{let e=t.field.getBoundingClientRect();return t.field.scroll(e.left-window.scrollX,0),!0},toggleKeystrokeCaption:Gp,toggleContextMenu:t=>{let e=t.toggleContextMenu();return e||t.model.announce("plonk"),e},plonk:t=>(t.model.announce("plonk"),!0),switchMode:(t,e,r,i)=>(t.switchMode(e,r,i),!0)});fe({undo:t=>(t.undo(),!0),redo:t=>(t.redo(),!0)},{target:"mathfield",changeContent:!0});fe({insert:(t,e,r)=>t.insert(e,r),typedText:(t,e,r)=>(_o(t,e,r),!0),insertDecimalSeparator:t=>{let e=t.model;return e.mode==="math"&&globalThis.MathfieldElement.decimalSeparator===","&&e.at(Math.max(e.position,e.anchor)).isDigit()?(t.insert("{,}",{format:"latex"}),t.snapshot("insert-mord"),!0):(t.insert("."),!0)},commit:t=>{var r,i;let e=t.model;return e.contentWillChange({inputType:"insertLineBreak"})&&((r=t.host)==null||r.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),(i=e.parentEnvironment)!=null&&i.isMultiline&&t.executeCommand("addRowAfter"),e.contentDidChange({inputType:"insertLineBreak"})),!0},insertPrompt:(t,e,r)=>{let i=t.getPrompts(),n="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36),o=0;for(;i.includes(n)&&o<100;){if(o===99)return console.error("could not find a unique ID after 100 tries"),!1;n="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36),o++}return t.insert(`\\placeholder[${e!=null?e:n}]{}`,r),!0}},{target:"mathfield",canUndo:!0,changeContent:!0,changeSelection:!0});fe({copyToClipboard:t=>(t.focus(),t.model.selectionIsCollapsed&&t.select(),"queryCommandSupported"in document&&document.queryCommandSupported("copy")&&document.execCommand("copy")||t.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("copy",{bubbles:!0,composed:!0})),!1)},{target:"mathfield"});fe({cutToClipboard:t=>(t.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("cut")&&document.execCommand("cut")||t.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("cut",{bubbles:!0,composed:!0})),!0),pasteFromClipboard:t=>(t.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("paste")?(document.execCommand("paste"),!0):(navigator.clipboard.readText().then(e=>{e&&t.model.contentWillChange({inputType:"insertFromPaste",data:e})?(t.stopCoalescingUndo(),t.stopRecording(),t.insert(e,{mode:t.model.mode})&&(Fr(t),t.startRecording(),t.snapshot("paste"),t.model.contentDidChange({inputType:"insertFromPaste"}),Y(t))):t.model.announce("plonk"),t.startRecording()}).catch(()=>{t.model.announce("plonk"),t.startRecording()}),!0))},{target:"mathfield",canUndo:!0,changeContent:!0,changeSelection:!0});function Es(t){let[e,r]=de(t.selection);if(e=th(t,e,"backward"),r=th(t,r,"forward"),e===r){let i=t.at(e);if(i.type==="leftright")return t.setSelection(t.offsetOf(i.firstChild)-1,r);if(i.type==="first"&&(i.parent.type==="leftright"||i.parent.type==="surd"))return t.setSelection(e-1,t.offsetOf(i.parent.lastChild)+1);t.setSelection(e-1,r)}else t.setSelection(e,r);return!0}function th(t,e,r){var o;let i=t.at(e);if(!i)return e;let n=r==="forward"?1:-1;if(i.mode==="text"){for(;i&&!(i.mode!=="text"||!Zr.test(i.value));)e+=n,i=t.at(e);return r==="backward"?e-1:e}if(i.mode==="latex"){if(/[a-zA-Z\\*]/.test(i.value))if(r==="backward")for(;(i==null?void 0:i.mode)==="latex"&&i.value!=="\\"&&/[a-zA-Z]/.test(i.value);)e+=n,i=t.at(e);else for(;(i==null?void 0:i.mode)==="latex"&&/[a-zA-Z\\*]/.test(i.value);)e+=n,i=t.at(e);else if(i.value==="{"){if(r==="forward"){for(;(i==null?void 0:i.mode)==="latex"&&i.value!=="}";)e+=n,i=t.at(e);return e}return e-1}else if(i.value==="}"){if(r==="backward"){for(;(i==null?void 0:i.mode)==="latex"&&i.value!=="{";)e+=n,i=t.at(e);return e-1}return e}return e-1}if(i.mode==="math"){if(i.isDigit()){for(;(o=t.at(e+n))!=null&&o.isDigit();)e+=n;return r==="backward"?e-1:e}if(i.style.variant||i.style.variantStyle){let a=i.style.variant,s=i.style.variantStyle;for(;;){let l=t.at(e+n);if(!l||l.style.variant!==a||l.style.variantStyle!==s)break;e+=n}return r==="backward"?e-1:e}return e}return e}fe({selectGroup:t=>{let e=Es(t);return e||t.announce("plonk"),e},selectAll:t=>t.setSelection(0,t.lastOffset),extendSelectionForward:t=>lt(t,"forward",{extend:!0}),extendSelectionBackward:t=>lt(t,"backward",{extend:!0}),extendToNextWord:t=>Mt(t,"forward",{extend:!0}),extendToPreviousWord:t=>Mt(t,"backward",{extend:!0}),extendSelectionUpward:t=>lt(t,"upward",{extend:!0}),extendSelectionDownward:t=>lt(t,"downward",{extend:!0}),extendToNextBoundary:t=>Mt(t,"forward",{extend:!0}),extendToPreviousBoundary:t=>Mt(t,"backward",{extend:!0}),extendToGroupStart:t=>{let e=t.setSelection(t.anchor,t.offsetOf(t.at(t.position).firstSibling));return e||t.announce("plonk"),e},extendToGroupEnd:t=>{let e=t.setSelection(t.anchor,t.offsetOf(t.at(t.position).lastSibling));return e||t.announce("plonk"),e},extendToMathFieldStart:t=>{let e=t.setSelection(t.anchor,0);return e||t.announce("plonk"),e},extendToMathFieldEnd:t=>{let e=t.setSelection(t.anchor,t.lastOffset);return e||t.announce("plonk"),e}},{target:"model",changeSelection:!0});var _i=null,Mo=0,Mi=class t{static start(e,r,i,n){var a;t.element=e,(a=t.controller)==null||a.abort(),t.controller=new AbortController;let o={signal:t.controller.signal};"PointerEvent"in window?(e.addEventListener("pointermove",i,o),e.addEventListener("pointerup",n,o),e.addEventListener("pointercancel",n,o),Oc(r)&&(t.pointerId=r.pointerId,e.setPointerCapture(r.pointerId))):(window.addEventListener("mousemove",i,o),window.addEventListener("blur",n,o),window.addEventListener("mouseup",n,o))}static stop(){var e;(e=t.controller)==null||e.abort(),t.controller=void 0,typeof t.pointerId=="number"&&(t.element.releasePointerCapture(t.pointerId),t.pointerId=void 0)}};function Oc(t){return t!==null&&globalThis.PointerEvent!==void 0&&t instanceof PointerEvent}function Dc(t,e,r){return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function rh(t,e,r){return tr?r:t}function Bc(t,e){var B,$,G,R,N,j;if(e.buttons>1)return;t.atomBoundsCache?t.atomBoundsCache.clear():t.atomBoundsCache=new Map;let r=t,i,n=!1,o=!1,a="none",s=!1,l=!1,c=e.clientX,u=e.clientY,m=Date.now(),d=r.field,h=setInterval(()=>{s?d.scroll({top:0,left:d.scrollLeft-16}):l&&d.scroll({top:0,left:d.scrollLeft+16})},32);function f(){Mi.stop(),n=!1,clearInterval(h),t.element.classList.remove("tracking"),e&&e.preventDefault()}function x(D){if(!r.hasFocus()){f();return}let H=D.clientX,ie=D.clientY,X=Oc(D)&&D.pointerType==="touch"?20:5;if(Date.now()be.right,s=H=0&&Be>=0&&(r.model.extendSelectionTo(ye,Be),Y(t)),o&&Es(r.model)}_i&&Math.abs(_i.x-c)<5&&Math.abs(_i.y-u)<5&&Date.now()<_i.time+500?(Mo+=1,_i.time=m):(_i={x:c,y:u,time:m},Mo=1);let _=d.getBoundingClientRect(),b=($=(B=t.container)==null?void 0:B.getBoundingClientRect())!=null?$:t.element.getBoundingClientRect(),v=(R=(G=t.element)==null?void 0:G.getBoundingClientRect())!=null?R:b,k=Dc(c,u,_),A=!k&&b?Dc(c,u,b):!1,C=!k&&!A&&v?Dc(c,u,v):!1,T=k?c:A||C?rh(c,_.left,_.right):c,S=k?u:A||C?rh(u,_.top,_.bottom):u;if(k||A||C){if(t.flushInlineShortcutBuffer(),i=So(t,T,S,{bias:0}),i!==t.model.anchor){let D=t.defaultStyle.variantStyle;t.defaultStyle=D!==void 0?{variantStyle:D}:{},t.styleBias="left"}if(i>=0){if(t.element.classList.add("tracking"),e.shiftKey){let D=t.model.selectionIsCollapsed;t.model.extendSelectionTo(t.model.anchor,i),ps(t.model)||D?a="all":a="selection"}else if(t.model.at(i).type==="placeholder"||t.model.at(i).type==="prompt"){let D=t.model.at(i);D.hasChildren&&D.firstChild?t.model.position=t.model.offsetOf(D.firstChild):t.model.setSelection(i-1,i),a="selection"}else if(((N=t.model.at(i).rightSibling)==null?void 0:N.type)==="placeholder"||((j=t.model.at(i).rightSibling)==null?void 0:j.type)==="prompt"){let D=t.model.at(i).rightSibling;D.hasChildren&&D.firstChild?t.model.position=t.model.offsetOf(D.firstChild):t.model.setSelection(i,i+1),a="selection"}else{let D=t.model.at(i);if(D.captureSelection&&D.hasChildren&&D.body&&D.body.length>0){let H=D.body.find(ie=>ie.type!=="first");H&&(H.type==="placeholder"||H.type==="prompt")&&H.hasChildren&&H.firstChild?(t.model.position=t.model.offsetOf(H.firstChild),a="selection"):(t.model.position=i,ps(t.model)?a="all":a="selection")}else t.model.position=i,ps(t.model)?a="all":a="selection"}e.detail===3||Mo>2?(f(),(e.detail===3||Mo===3)&&(t.model.selection={ranges:[[0,t.model.lastOffset]]},a="all")):n||(n=!0,Mi.start(d,e,x,f),(e.detail===2||Mo===2)&&(o=!0,Es(t.model),a="all"))}t.hasFocus()||(a="none",t.onFocus(),t.model.announce("line"))}else _i=null;t.stopCoalescingUndo(),a!=="none"&&(t.model.selectionIsCollapsed&&(a="all"),Y(t)),e.preventDefault()}function bb(t,e,r){if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)return 0;let i=t-(r.left+r.right)/2,n=e-(r.top+r.bottom)/2;return i*i+n*n}function wo(t,e,r,i,n){if(!r.id)return[1/0,null];if(e.has(r.id))return e.get(r.id);let o=nr(t,r);if(!o)return[1/0,null];let a=[1/0,null],s=t.model;if(r instanceof z){let l=-1,c=1/0;for(let m=0;mf?x=n-f:x=0,x=0?[r.rows[l]]:r.rows;for(let m of u)for(let d of m)if(d)for(let h of d){let f=wo(t,e,h,i,n);f[0]<=a[0]&&(a=f)}if(!r.isMultiline)for(let m of r.children){let d=wo(t,e,m,i,n);d[0]<=a[0]&&(a=d)}}else if(r.hasChildren&&!r.captureSelection&&i>=o.left&&i<=o.right){let l=r.children;for(let c of l){let u=wo(t,e,c,i,n);u[0]<=a[0]&&(a=u)}for(let c of r.branches){let u=r.branch(c);if(!u||u.length===0)continue;let m=[s.offsetOf(u[0]),s.offsetOf(u[u.length-1])],d=H0(t,m);if(n>=d.top&&n<=d.bottom)for(let h of u){let f=wo(t,e,h,i,n);f[0]<=a[0]&&(a=f)}}}return a[1]||(a=[bb(i,n,o),r]),e.set(r.id,a),a}function yb(t,e,r){let[,i]=wo(t,new Map,t.model.root,e,r);return i}function So(t,e,r,i){var c;let n=t.field.querySelector(".ML__latex").getBoundingClientRect();if(!n)return 0;if(e>n.right||r>n.bottom+8)return t.model.lastOffset;if(e0?(u.push(m),m=[x]):m.push(x);m.length>0&&u.push(m);let d=Number(c.parentBranch[0]),h=Number(c.parentBranch[1]),f=c.parent.maxColumns;for(;c.parent.colCount-h=f&&(h=0,c.parent.addRowAfter(d),d++),c.parent.setCell(d,h,u[x])}else c.parent.addChildrenAfter(s.filter(u=>u.type!=="first"),c);return l.position=l.offsetOf(s[s.length-1]),l.contentDidChange({inputType:"insertFromPaste"}),Y(e),!0}}catch(a){}if(o=typeof r!="string"?r.getData("application/json"):"",o&&globalThis.MathfieldElement.computeEngine)try{let a=JSON.parse(o);if(typeof a=="object"&&"latex"in a&&a.latex&&(i=a.latex),!i){let s=globalThis.MathfieldElement.computeEngine.box(a);s&&!s.has("Error")&&(i=s.latex)}i||(n="latex")}catch(a){}if(!i&&typeof r!="string"&&(i=r.getData("application/x-latex"),i&&(n="latex")),i||(i=typeof r=="string"?r:r.getData("text/plain")),i){let a;return[a,i]=Ga(i),n==="auto"&&a&&(n="latex"),e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,i,{format:n})&&(e.startRecording(),e.snapshot("paste"),Y(e)),e.startRecording(),!0}return!1}insert(e,r,i){var x,_;let n=typeof r=="string"?r:(_=(x=globalThis.MathfieldElement.computeEngine)==null?void 0:x.box(r).latex)!=null?_:"";if(!i.silenceNotifications&&!e.contentWillChange({data:n,inputType:"insertText"}))return!1;i.insertionMode||(i.insertionMode="replaceSelection"),i.selectionMode||(i.selectionMode="placeholder"),i.format||(i.format="auto");let{silenceNotifications:o}=e;i.silenceNotifications&&(e.silenceNotifications=!0);let a=e.silenceNotifications;e.silenceNotifications=!0;let s={"?":"\\placeholder{}","@":"\\placeholder{}"};s[0]=i.insertionMode==="replaceAll"?"":e.getValue(e.selection,"latex-unstyled"),i.insertionMode==="replaceSelection"?e.deleteAtoms(de(e.selection)):i.insertionMode==="replaceAll"?e.deleteAtoms():i.insertionMode==="insertBefore"?e.collapseSelection("backward"):i.insertionMode==="insertAfter"&&e.collapseSelection("forward"),!e.at(e.position).isLastSibling&&e.at(e.position+1).type==="placeholder"?e.deleteAtoms([e.position,e.position+1]):e.at(e.position).type==="placeholder"&&e.deleteAtoms([e.position-1,e.position]);let l=-1;s[0]?s["@"]=s[0]:typeof r=="string"&&/(^|[^\\])#@/.test(r)&&(l=xb(e),l>=0&&(s["@"]=e.getValue(l,e.position,"latex"))),s[0]||(s[0]=s["?"]);let c=!1,u=b=>(c=!0,s[b]),[m,d]=ih(e,r,u,i);if(!d)return!1;let h=d.length===1&&d[0].type==="genfrac";if(h&&l>=0&&typeof e.mathfield.options.isImplicitFunction=="function"&&e.mathfield.options.isImplicitFunction(e.at(e.position).command)?(s["@"]=s["?"],c=!1,[m,d]=ih(e,r,u,i)):l>=0&&e.deleteAtoms([l,e.position]),d.length===1&&d[0].isRoot)e.root=d[0];else{let{parent:b}=e.at(e.position),v=b.hasEmptyBranch("body");if(h&&m!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&b instanceof J&&b.leftDelim==="("&&v){let A=b.parent,C=b.parentBranch;A.removeChild(b),A.setChildren(d,C)}let k=e.at(e.position);k.parent.addChildrenAfter(d,k),m==="latex"&&typeof r=="string"&&(b==null?void 0:b.type)==="root"&&v&&!c&&(b.verbatimLatex=r)}e.silenceNotifications=a;let f=d[d.length-1];if(i.selectionMode==="placeholder"){let b;if(d.length===1&&d[0].type==="genfrac"){let v=d[0].branch("above");if(b=v==null?void 0:v.find(k=>k.type==="placeholder"),!b){let k=d[0].branch("below");b=k==null?void 0:k.find(A=>A.type==="placeholder")}}if(b||(b=d.flatMap(v=>[v,...v.children]).find(v=>v.type==="placeholder")),b){let v=e.offsetOf(b);e.setSelection(v-1,v),e.announce("move")}else if(f){let v=f.body,k=f.hasEmptyBranch("body");v&&k?e.setSelection(e.offsetOf(v[0]),e.offsetOf(v[v.length-1])+1):e.position=e.offsetOf(f)}}else i.selectionMode==="before"||(i.selectionMode==="after"?f&&(e.position=e.offsetOf(f)):i.selectionMode==="item"&&e.setSelection(e.anchor,e.offsetOf(f)));return e.contentDidChange({data:n,inputType:"insertText"}),e.silenceNotifications=o,!0}};function ih(t,e,r,i){var a;let n,o=[];if(typeof e!="string"||i.format==="math-json"){let s=globalThis.MathfieldElement.computeEngine;if(!s)return["math-json",[]];[n,e]=["latex",s.box(e).latex],o=ge(e,{context:t.mathfield.context})}else typeof e=="string"&&i.format==="ascii-math"?([n,e]=ir(e,{format:"ascii-math",inlineShortcuts:t.mathfield.options.inlineShortcuts}),o=ge(e,{context:t.mathfield.context}),n!=="latex"&&t.mathfield.options.removeExtraneousParentheses&&(o=o.map(s=>Ts(s)))):(i.format==="auto"||(a=i.format)!=null&&a.startsWith("latex"))&&(i.format==="auto"&&([n,e]=ir(e,{format:"auto",inlineShortcuts:t.mathfield.options.inlineShortcuts})),i.format==="latex"&&([,e]=Ga(e)),o=ge(e,{context:t.mathfield.context,args:r}),i.format!=="latex"&&t.mathfield.options.removeExtraneousParentheses&&(o=o.map(s=>Ts(s))));return io(o,i.style),[n!=null?n:"latex",o]}function Ts(t){var e;if(t instanceof J&&t.leftDelim!=="("&&t.rightDelim===")"){let r=(e=t.body)==null?void 0:e.filter(i=>i.type!=="first");if((r==null?void 0:r.length)===1&&r[0].type==="genfrac")return r[0]}for(let r of t.branches)t.hasEmptyBranch(r)||t.setChildren(t.branch(r).map(i=>Ts(i)),r);return t instanceof z&&t.forEachCell((r,i,n)=>{t.setCell(i,n,r.map(o=>Ts(o)))}),t}function xb(t){let e=t.at(t.position);if(e.mode==="text"){for(;!e.isFirstSibling&&e.mode==="text";)e=e.leftSibling;return t.offsetOf(e)}let r=e,i=!1;if(e.type==="mclose"){let n=tn[e.value];for(;!e.isFirstSibling&&!(e.type==="mopen"&&e.value===n);)e=e.leftSibling;e.isFirstSibling||(e=e.leftSibling),i=!0}else e.type==="leftright"&&(e=e.leftSibling,i=!0);if(i)for(;!e.isFirstSibling&&(e.isFunction||nh(e));)e=e.leftSibling;else{let n=[];for(;!e.isFirstSibling&&(nh(e)||n.length>0);)e.type==="mclose"&&n.unshift(e.value),e.type==="mopen"&&n.length>0&&e.value===tn[n[0]]&&n.shift(),e=e.leftSibling}return r===e?-1:t.offsetOf(e)}function vb(t){if(t.type==="mord"&&t.value==="e"){let e=t.leftSibling;if(e&&e.isDigit())return!0}if(t.type==="mbin"&&(t.value==="+"||t.value==="-"||t.value==="\u2212")){let e=t.leftSibling,r=t.rightSibling;if((e==null?void 0:e.type)==="mord"&&e.value==="e"&&r&&r.isDigit()){let i=e.leftSibling;if(i&&i.isDigit())return!0}}if(t.type==="subsup"){let e=t.leftSibling;if(e&&e.isDigit()&&e.value==="0"){let r=e.leftSibling;if(r&&r.isDigit()&&r.value==="1"){let i=r.leftSibling;if((i==null?void 0:i.type)==="mbin"&&(i.value==="\xD7"||i.value==="\\times")){let n=i.leftSibling;if(n&&n.isDigit())return!0}}}}if(t.isDigit()&&t.value==="0"){let e=t.leftSibling,r=t.rightSibling;if(e&&e.isDigit()&&e.value==="1"&&(r==null?void 0:r.type)==="subsup"){let i=e.leftSibling;if((i==null?void 0:i.type)==="mbin"&&(i.value==="\xD7"||i.value==="\\times")){let n=i.leftSibling;if(n&&n.isDigit())return!0}}}if(t.isDigit()&&t.value==="1"){let e=t.rightSibling;if(e&&e.isDigit()&&e.value==="0"){let r=e.rightSibling;if((r==null?void 0:r.type)==="subsup"){let i=t.leftSibling;if((i==null?void 0:i.type)==="mbin"&&(i.value==="\xD7"||i.value==="\\times")){let n=i.leftSibling;if(n&&n.isDigit())return!0}}}}if(t.type==="mbin"&&(t.value==="\xD7"||t.value==="\\times")){let e=t.leftSibling,r=t.rightSibling;if(e&&e.isDigit()&&r&&r.isDigit()&&r.value==="1"){let i=r.rightSibling;if(i&&i.isDigit()&&i.value==="0"){let n=i.rightSibling;if((n==null?void 0:n.type)==="subsup")return!0}}}return!1}function nh(t){return t.isDigit()||vb(t)?!0:t.type&&/^(mord|surd|subsup|leftright|mop|mclose)$/.test(t.type)?t.type!=="extensible-symbol":!1}new Kc;var Pc=class extends q{constructor(){super("text")}onPaste(e,r){if(!r)return!1;let i=typeof r=="string"?r:r.getData("text/plain");return i&&e.model.contentWillChange({inputType:"insertFromPaste",data:i})?(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,i)&&(e.model.contentDidChange({inputType:"insertFromPaste"}),e.startRecording(),e.snapshot("paste"),Y(e)),e.startRecording(),!0):!1}insert(e,r,i={}){if(!e.contentWillChange({data:r,inputType:"insertText"}))return!1;i.insertionMode||(i.insertionMode="replaceSelection"),i.selectionMode||(i.selectionMode="placeholder"),i.format||(i.format="auto");let{silenceNotifications:n}=e;i.silenceNotifications&&(e.silenceNotifications=!0);let o=e.silenceNotifications;e.silenceNotifications=!0,i.insertionMode==="replaceSelection"&&!e.selectionIsCollapsed?e.deleteAtoms(de(e.selection)):i.insertionMode==="replaceAll"?(e.root.setChildren([],"body"),e.position=0):i.insertionMode==="insertBefore"?e.collapseSelection("backward"):i.insertionMode==="insertAfter"&&e.collapseSelection("forward");let a=_b(r,e.mathfield.context);if(io(a,i.style),!a)return!1;let s=e.at(e.position),l=s.parent.addChildrenAfter(a,s);return e.silenceNotifications=o,i.selectionMode==="before"||(i.selectionMode==="item"?e.setSelection(e.anchor,e.offsetOf(l)):l&&(e.position=e.offsetOf(l))),e.contentDidChange({data:r,inputType:"insertText"}),e.silenceNotifications=n,!0}};function _b(t,e){if(t.includes("$")){let r=[],i=0,n=!1,o="";for(;i` `,oh=(t,e)=>` `,Bs=(t,e,r)=>` `,wb=` ${Bs(2*(le+xe),2*le+3*xe,0)} ${Bs(2*(le+xe),2*le+xe,180)} ${Bs(2*le+3*xe,2*(le+xe),-90)} ${Bs(2*le+xe,2*(le+xe),90)} ${Os(2*le+xe,le)} ${oh(2*le+2*xe,le)} ${Os(2*le+3*xe,le)} ${Os(le,2*le+xe)} ${oh(le,2*le+2*xe)} ${Os(le,2*le+3*xe)} `,Sb=t=>` `,kb=t=>` `,ah=t=>` `,Lb=t=>` `,Ab=t=>` `,Cb=t=>` `,Eb=t=>` `,Tb=t=>` `,Rc={matrix:Sb,pmatrix:kb,bmatrix:Lb,Bmatrix:ah,vmatrix:Ab,Vmatrix:Cb},Ic={cases:Eb,rcases:Tb,Bmatrix:ah};function Db(t){var d,x;let e=(d=t.model.parentEnvironment)==null?void 0:d.rows;if(!e)return;let r=0;e.forEach(_=>{(!r||_.length>r)&&(r=_.length)});let i=document.getElementById("mathlive-environment-popover");i||(i=bi("mathlive-environment-popover"),We("environment-popover"),We("core"),i.setAttribute("aria-hidden","true"));let n,o=i.querySelector(".MLEP__environment-controls");o?n=o:(n=document.createElement("div"),i.innerHTML="",i.appendChild(n)),n.className="MLEP__environment-controls",n.style.display="flex",n.style.width="100%",n.style.height="100%",n.style.boxSizing="border-box",n.innerHTML=wb;let a=[],s="",l=t.model.parentEnvironment.environmentName;if(Qa(l)){let _=Ob(l);s=Rc[_]("active");let h=Rc,{[_]:b}=h,v=Ai(h,[Qs(_)]);a=Object.values(v).map(k=>k("inactive"))}else if(lp(l)){let _=Bb(l);s=Ic[_]("active");let f=Ic,{[_]:b}=f,v=Ai(f,[Qs(_)]);a=Object.values(v).map(k=>k("inactive"))}else cp(l)&&(s=Rc.matrix("active"),a=Object.values(Ic).map(_=>_("inactive")));let c=document.createElement("div");c.className="MLEP__environment-delimiter-controls",c.style.display="flex",c.style.flexDirection="column",c.innerHTML=`
    ${s} ${a.join("")}
    `,s&&n.appendChild(c),n.querySelectorAll("[data-command]").forEach(_=>{let b=_.dataset.command,v=b;try{v=JSON.parse(b)}catch(k){}_.addEventListener("mousedown",k=>k.preventDefault()),v&&_.addEventListener("click",()=>t.executeCommand(v))});let m=(x=t.field)==null?void 0:x.getBoundingClientRect();m&&(i.style.top=`${window.scrollY+(m.top-i.clientHeight-15)}px`,i.style.left=`${m.left+20}px`,i.classList.add("is-visible"))}function Ks(){let t=document.getElementById("mathlive-environment-popover");t==null||t.classList.remove("is-visible")}function sh(){document.getElementById("mathlive-environment-popover")&&($r("mathlive-environment-popover"),nt("environment-popover"),nt("core"))}function ko(t){if(!t.hasFocus())return;let e=!1;if(t.model.mode==="math"){let r=t.model.parentEnvironment;if(r!=null&&r.rows&&sp(r.environmentName)){let i=t.options.environmentPopoverPolicy;e=i==="auto"||i==="on"}}e?Db(t):Ks()}function Ob(t){return t.replace("*","")}function Bb(t){return t==="dcases"?"cases":t}function Ps(t){let e=getComputedStyle(t).direction;return e==="ltr"||e==="rtl"?e:"ltr"}function Nc(t,e,r){return e==="left"||e==="leading"&&r==="ltr"||e==="trailing"&&r==="rtl"?t.left:t.right}function zc(t,e,r,i){return r==="middle"?t-e/2:r==="start"&&i==="rtl"||r==="end"&&i==="ltr"||r==="top"||r==="right"?Math.max(0,t-e):t}function Kb(t,e,r,i){return r==="middle"?t-e/2:r==="start"&&i==="ltr"||r==="end"&&i==="rtl"||r==="top"||r==="right"?t:t-e}function lh(t,e){var u,m,d;let r=(u=Ps(t))!=null?u:"ltr";t.style.position="fixed",t.style.left="",t.style.top="",t.style.right="",t.style.bottom="",t.style.height="",t.style.width="";let i=t.getBoundingClientRect(),n=Number.isFinite(e.maxHeight)?Math.min(e.maxHeight,window.innerHeight):window.innerHeight,o=Math.min(n,(m=e.height)!=null?m:i.height),a=zc(e.location.y,o,e.verticalPos,r);a+o>window.innerHeight-8&&(e.alternateLocation?(a=zc(e.alternateLocation.y,o,e.verticalPos,r),a+o>window.innerHeight-8&&(a=void 0)):a=void 0),Number.isFinite(a)||(a=Math.max(8,window.innerHeight-8-o),8+o>window.innerHeight-8&&(t.style.bottom="8px")),o=Math.min(a+o,window.innerHeight-8)-a;let s=Number.isFinite(e.maxWidth)?Math.min(e.maxWidth,window.innerWidth):window.innerWidth,l=Math.min(s,(d=e.width)!=null?d:i.width),c=zc(e.location.x,l,e.horizontalPos,r);c+l>window.innerWidth-8&&(e.alternateLocation?(c=Kb(e.alternateLocation.x,l,e.verticalPos,r),c+l>window.innerWidth-8&&(c=void 0)):c=void 0),Number.isFinite(c)||(c=Math.max(8,window.innerWidth-8-l),8+l>window.innerWidth-8&&(t.style.right="8px")),l=Math.min(c+l,window.innerWidth-8)-c,r==="rtl"?t.style.right=`${Math.ceil(window.innerWidth-c-l).toString()}px`:t.style.left=`${Math.ceil(c).toString()}px`,t.style.top=`${Math.ceil(a).toString()}px`,o!==i.height&&(t.style.height=`${Math.ceil(o).toString()}px`),l!==i.width&&(t.style.width=`${Math.ceil(l).toString()}px`)}function ch(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}function qr(t){return"submenu"in t}function St(t){return"type"in t&&t.type==="command"||"onMenuSelect"in t||"id"in t}function Lo(t){return"type"in t&&t.type==="divider"}function Rs(t){return"type"in t&&t.type==="heading"}var uh={};function Is(t){let e=uh[t];if(!e){let r;switch(t){case"checkmark":r=``;break;case"trailing-chevron":r='';break;case"mixedmark":r=''}if(r){let i=document.createElement("template");i.innerHTML=r,uh[t]=i,e=i}}if(e){if("content"in e)return e.content.cloneNode(!0);let r=document.createElement("svg");return r.innerHTML=e.innerHTML,r}}var dh=80,kn=class{constructor(e,r){this._className="";this._element=null;var i;this.parentMenu=r,this._declaration=e,Object.freeze(this._declaration),qr(e)?(this.type="submenu",this.submenu=new Ln(e.submenu,{parentMenu:r,submenuClass:e.submenuClass,columnCount:e.columnCount})):this.type=(i=e.type)!=null?i:"command",this.hasCheck=St(e)&&e.checked!==void 0}get rootMenu(){return this.parentMenu.rootMenu}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}dispose(){var e,r;(e=this._abortController)==null||e.abort(),this._abortController=void 0,(r=this._element)==null||r.remove(),this._element=null,this.submenu&&this.submenu.dispose(),this.submenu=void 0}get menuItem(){return this._declaration}get label(){var e;return(e=this._label)!=null?e:""}set label(e){e===void 0&&(e=""),e!==this._label&&(this._label=e,this.dirty=!0)}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.dirty=!0)}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.element&&(e?this.element.removeAttribute("aria-disabled"):this.element.setAttribute("aria-disabled","true")),this.dirty=!0}get checked(){return this._checked}set checked(e){this._checked=e,this.dirty=!0}get tooltip(){return this._tooltip}set tooltip(e){e!==this._tooltip&&(this._tooltip=e,this.dirty=!0)}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){e!==this._ariaLabel&&(this._ariaLabel=e,this.dirty=!0)}get active(){var e,r;return(r=(e=this.element)==null?void 0:e.classList.contains("active"))!=null?r:!1}set active(e){this.element&&this.element.classList.toggle("active",e)}updateState(e){var i,n,o;let r=this._declaration;if(Lo(r)){this.enabled=!1,this.checked=!1;return}Rs(r)&&(this.enabled=!1,this.checked=!1,this.visible=!0),St(r)&&(this.checked=(i=wi(r.checked,e))!=null?i:!1),(St(r)||qr(r))&&(this.enabled=(n=wi(r.enabled,e))!=null?n:!0,this.visible=(o=wi(r.visible,e))!=null?o:!0,this.visible&&this.enabled&&this.submenu&&(this.submenu.updateState(e),this.submenu.visible||(this.visible=!1))),(St(r)||Rs(r)||qr(r))&&(this.label=wi(r.label,e),this._className=wi(r.class,e),this.tooltip=wi(r.tooltip,e),this.ariaLabel=wi(r.ariaLabel,e)),this._element&&this.updateElement()}set dirty(e){e&&this.parentMenu&&(this.parentMenu.dirty=!0)}updateElement(){var i;if(!this.visible||!this.element)return;let e=this.element;e.textContent="",e.className="",e.className=(i=this._className)!=null?i:"",this.enabled?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true"),this.checked===!0?(e.setAttribute("aria-checked","true"),e.append(Is("checkmark"))):this.checked==="mixed"?(e.setAttribute("aria-checked","mixed"),e.append(Is("mixedmark"))):e.removeAttribute("aria-checked"),this.ariaLabel&&e.setAttribute("aria-label",this.ariaLabel);let r=document.createElement("span");if(r.className=this.parentMenu.hasCheck?"label indent":"label",this.type==="heading"&&r.classList.add("heading"),r.innerHTML=this.label,e.append(r),this._tooltip&&e.setAttribute("data-tooltip",this._tooltip),St(this._declaration)&&this._declaration.keyboardShortcut){let n=document.createElement("kbd");n.innerHTML=hn(this._declaration.keyboardShortcut),e.append(n)}this.type==="submenu"&&e.append(Is("trailing-chevron"))}get element(){if(this._element)return this._element;if(Lo(this._declaration)){let i=document.createElement("li");return i.setAttribute("part","menu-divider"),i.setAttribute("role","divider"),this._element=i,i}let e=document.createElement("li");this._element=e,(St(this._declaration)||Rs(this._declaration)||qr(this._declaration))&&e.setAttribute("part","menu-item"),e.setAttribute("tabindex","-1"),this.hasCheck?e.setAttribute("role","menuitemcheckbox"):e.setAttribute("role","menuitem"),this.type==="submenu"&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"));let r=this.abortController.signal;return e.addEventListener("pointerenter",this,{signal:r}),e.addEventListener("pointerleave",this,{signal:r}),e.addEventListener("pointerup",this,{signal:r}),e.addEventListener("click",this,{signal:r}),this._element}dispatchSelect(){var i;if(!St(this._declaration))return;let e=new CustomEvent("menu-select",{cancelable:!0,bubbles:!0,detail:{modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data}});this.parentMenu.dispatchEvent(e)&&typeof this._declaration.onMenuSelect=="function"&&this._declaration.onMenuSelect({target:(i=this.parentMenu.host)!=null?i:void 0,modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data})}handleEvent(e){var r;if(!(!this.visible||!this.enabled)){if(e.type==="click"){this.rootMenu.state==="modal"&&this.select(),e.stopPropagation(),e.preventDefault();return}if(e.type==="pointerenter"){let i=e;this.rootMenu.cancelDelayedOperation(),this.parentMenu.isSubmenuOpen&&((r=this.parentMenu.activeMenuItem)!=null&&r.movingTowardSubmenu(i))?this.rootMenu.scheduleOperation(()=>{this.parentMenu.activeMenuItem=this,this.openSubmenu()}):(this.parentMenu.activeMenuItem=this,this.openSubmenu({withDelay:!0}));return}if(e.type==="pointerleave"){this.rootMenu.activeSubmenu===this.parentMenu&&(this.parentMenu.activeMenuItem=null);return}if(e.type==="pointerup"){this.rootMenu.state!=="modal"&&this.select(),e.stopPropagation(),e.preventDefault();return}}}select(){if(this.rootMenu.cancelDelayedOperation(),this.type==="submenu"){this.openSubmenu();return}this.active=!1,setTimeout(()=>{this.active=!0,setTimeout(()=>{this.active=!1,this.rootMenu.hide(),this.dispatchSelect()},dh)},dh)}openSubmenu(e){var n;if(this.type!=="submenu"||!this.element)return;if((n=e==null?void 0:e.withDelay)!=null&&n){this.rootMenu.scheduleOperation(()=>this.openSubmenu());return}let r=this.element.getBoundingClientRect(),i=Ps(this.element);this.submenu.show({container:this.rootMenu.element.parentNode,location:{x:Nc(r,"trailing",i),y:r.top-4},alternateLocation:{x:Nc(r,"leading",i),y:r.top-4}})}movingTowardSubmenu(e){if(!this.element||this.type!=="submenu")return!1;let r=this.rootMenu.lastMoveEvent;if(!r)return!1;let i=e.timeStamp-r.timeStamp;if(i>500)return!1;let n=e.clientX-r.clientX;if(Pb(n,r.clientY-e.clientY,i)<=.2)return!1;let a="right";if(this.submenu.element){let s=this.submenu.element.getBoundingClientRect(),l=this.element.getBoundingClientRect();s.left0:n<0}};function Pb(t,e,r){return Math.hypot(t,e)/r}function wi(t,e){return t===void 0||typeof t!="function"?t:(e!=null||(e={alt:!1,control:!1,shift:!1,meta:!1}),t(e))}var Ln=class t{constructor(e,r){this._element=null;this._activeMenuItem=null;this._dirty=!0;var i,n;this.parentMenu=(i=r==null?void 0:r.parentMenu)!=null?i:null,this._submenuClass=r==null?void 0:r.submenuClass,this.columnCount=(n=r==null?void 0:r.columnCount)!=null?n:1,this.isSubmenuOpen=!1,this.menuItems=e}get children(){return Object.freeze([...this._menuItems])}set menuItems(e){let r=this.parentMenu;this.dispose(),this.parentMenu=r,e=[...e],this._menuItems=e.map(i=>i.onCreate?i.onCreate(i,this):new kn(i,this)),this.hasCheck=void 0,this.dirty=!0}dispose(){var e;this.hide(),this._element&&this._element.remove(),this._abortController&&this._abortController.abort(),(e=this._menuItems)==null||e.forEach(r=>r.dispose()),this._menuItems=[],this._activeMenuItem=null,this.parentMenu=null}handleEvent(e){if(e.type==="wheel"&&this._element){let r=e;this._element.scrollBy(0,r.deltaY),e.stopPropagation()}}dispatchEvent(e){return this.rootMenu.dispatchEvent(e)}get host(){return this.rootMenu.host}get rootMenu(){return this.parentMenu.rootMenu}updateState(e){var a,s,l;this._menuItems.forEach(c=>c.updateState(e));let r=this.hasCheck;this.hasCheck=this._menuItems.some(c=>c.visible&&c.hasCheck),this.hasCheck!==r&&this._menuItems.forEach(c=>c.updateState(e));let i,n=0;for(let c of this._menuItems)c.type==="heading"?(i&&n===0&&(i.visible=!1),i=c,n=0):c.type==="divider"&&i?(i.visible=n>0,i=void 0,n=0):i&&c.visible&&(n+=1);i&&(i.visible=n>0);let o=!0;for(let c of this._menuItems)c.type==="divider"?(c.visible=!o,o=!0):c.visible&&(o=!1);(a=this.activeMenuItem)!=null&&a.visible||(this.activeMenuItem=null),!((s=this.activeMenuItem)!=null&&s.enabled)&&((l=this.activeMenuItem)==null?void 0:l.type)==="submenu"&&this._activeMenuItem.submenu.hide(),this._dirty=!1}get enabled(){return this.updateIfDirty(),this._menuItems.some(e=>e.type!=="divider"&&e.visible&&e.enabled)}get visible(){return this.updateIfDirty(),this._menuItems.some(e=>e.type!=="divider"&&e.visible)}set dirty(e){this._dirty!==e&&e&&this.parentMenu&&(this._dirty=!0,this.parentMenu.dirty=!0)}updateIfDirty(){this._dirty&&this.updateState(this.rootMenu.modifiers)}updateElement(){var e;if(this._element){this._element.textContent="";for(let{element:r,visible:i}of this._menuItems)r&&i&&this._element.append(r);(e=this._element.querySelector("li:first-of-type"))==null||e.setAttribute("tabindex","0")}}get element(){if(this._element)return this._element;let e=document.createElement("menu");e.setAttribute("role","menu"),e.setAttribute("tabindex","-1"),e.setAttribute("aria-orientation","vertical"),e.setAttribute("part","ui-menu-container"),this._submenuClass&&e.classList.add(this._submenuClass),e.classList.add("ui-menu-container"),this._abortController||(this._abortController=new AbortController);let r=this._abortController.signal;return e.addEventListener("focus",this,{signal:r}),e.addEventListener("wheel",this,{passive:!0,signal:r}),this._element=e,this.updateElement(),e}get activeMenuItem(){return this._activeMenuItem}set activeMenuItem(e){var r,i,n,o;if(this.rootMenu.cancelDelayedOperation(),e!==this._activeMenuItem){if(this.activeMenuItem){let a=this.activeMenuItem;a.active=!1,(r=a.submenu)==null||r.hide()}if(!((i=e==null?void 0:e.visible)==null||i)){this._activeMenuItem=null;return}this._activeMenuItem=e,e&&(e.active=!0)}e?(n=e.element)==null||n.focus({preventScroll:!0}):(o=this._element)==null||o.focus({preventScroll:!0})}get firstMenuItem(){this.updateIfDirty();let e=0,r=!1,i=this._menuItems;for(;!r&&e<=i.length-1;){let n=i[e];r=n.type!=="divider"&&n.visible&&n.enabled,e+=1}return r?i[e-1]:null}get lastMenuItem(){this.updateIfDirty();let e=this._menuItems,r=e.length-1,i=!1;for(;!i&&r>=0;){let n=e[r];i=n.type!=="divider"&&n.visible&&n.enabled,r-=1}return i?e[r+1]:null}nextMenuItem(e){if(e===0)return this._activeMenuItem;if(!this._activeMenuItem)return e>0?this.firstMenuItem:this.lastMenuItem;if(!this.firstMenuItem||!this.lastMenuItem||!this._activeMenuItem)return null;this.updateIfDirty();let r=this._menuItems.indexOf(this.firstMenuItem),i=this._menuItems.indexOf(this.lastMenuItem),n=this._menuItems.indexOf(this._activeMenuItem),o=1;for(;n>=r&&n<=i;){n+=e>0?1:-1;let a=this._menuItems[n];if(!a)break;if(a.visible&&a.enabled){if(o===Math.abs(e))return this._menuItems[n];o+=1}}return e>0?this.lastMenuItem:this.firstMenuItem}getMenuItemColumn(e){this.updateIfDirty();let i=this._menuItems.filter(n=>n.visible&&n.enabled).indexOf(e);return i<0?-1:i%this.columnCount}static get collator(){return t._collator||(t._collator=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),t._collator}findMenuItem(e){var a;this.updateIfDirty();let r=this._menuItems.filter(s=>s.type!=="divider"&&s.visible&&s.enabled);if(r.length===0)return null;let i=Math.max(...r.map(s=>s.label.length))-e.length;if(i<0)return null;let n=null,o=0;for(;ot.collator.compare(e,s.label.substring(o,e.length))===0))!=null?a:null,o++;return n}show(e){return!this.visible||!e.container?!1:(this.updateElement(),e.container.appendChild(this.element),el()&&(this.element.popover="manual",this.element.showPopover()),e.location&&lh(this.element,{location:e.location,alternateLocation:e.alternateLocation,verticalPos:"bottom",horizontalPos:"start"}),mh(),this.element.focus({preventScroll:!0}),ph(),this.parentMenu&&(this.parentMenu.openSubmenu=this),!0)}hide(){var e,r,i,n,o,a;this.openSubmenu=null,this.activeMenuItem=null,this.parentMenu&&(this.parentMenu.openSubmenu=null),!(!((e=this._element)!=null&&e.isConnected)||!this._element.parentElement)&&(el()&&((r=this._element)!=null&&r.popover)&&this._element.hidePopover(),mh(),(n=(i=this.parentMenu)==null?void 0:i.element)==null||n.focus(),(a=(o=this._element)==null?void 0:o.parentNode)==null||a.removeChild(this._element),ph())}set openSubmenu(e){var i,n,o,a;let r=e!==null;((i=this.activeMenuItem)==null?void 0:i.type)==="submenu"&&((n=this.activeMenuItem.element)==null||n.setAttribute("aria-expanded",r.toString())),(a=(o=this.activeMenuItem)==null?void 0:o.element)==null||a.classList.toggle("is-submenu-open",r),this.isSubmenuOpen=r}};function mh(){document.addEventListener("focusin",Hr,!0),document.addEventListener("focusout",Hr,!0),document.addEventListener("focus",Hr,!0),document.addEventListener("blur",Hr,!0)}function Hr(t){t.stopImmediatePropagation(),t.preventDefault()}function ph(){document.removeEventListener("focusin",Hr,!0),document.removeEventListener("focusout",Hr,!0),document.removeEventListener("focus",Hr,!0),document.removeEventListener("blur",Hr,!0)}var zs=class zs extends Ln{constructor(r,i){var n;super(r);this.state="closed";this.typingBufferResetTimer=0;this.hysteresisTimer=0;this._updating=!1;this._host=(n=i==null?void 0:i.host)!=null?n:null,this.isDynamic=r.some(hh),this._modifiers={shift:!1,control:!1,alt:!1,meta:!1},this.typingBuffer="",this.state="closed"}get modifiers(){return this._modifiers}set modifiers(r){xp(this._modifiers,r)||(this._modifiers=r,this.dirty=!0)}get activeSubmenu(){let r=this;for(;r.isSubmenuOpen;)r=r.activeMenuItem.submenu;return r}set dirty(r){this._updating||this._dirty!==r&&(this._dirty=!0,r&&setTimeout(()=>{this.updateState(this.modifiers),this.updateElement()}))}updateState(r){this._updating=!0,this.modifiers=r!=null?r:this.modifiers,super.updateState(this.modifiers),this._updating=!1}handleKeyupEvent(r){this.isDynamic&&(this.modifiers=Ht(r)),r.stopImmediatePropagation()}handleKeydownEvent(r){var a,s,l;if(r.key==="Tab"||r.key==="Escape"){this.hide();return}this.isDynamic&&(this.modifiers=Ht(r));let i=!0,n=this.activeSubmenu,o=n.activeMenuItem;switch(r.key){case" ":case"Space":case"Return":case"Enter":o==null||o.select(Ht(r));break;case"ArrowRight":if((o==null?void 0:o.type)==="submenu")o.select(Ht(r)),this.activeSubmenu.activeMenuItem=this.activeSubmenu.firstMenuItem;else if(!o)n.activeMenuItem=n.firstMenuItem;else{let c=(a=n.getMenuItemColumn(o))!=null?a:-1;if(c>=0&&c<((s=n.columnCount)!=null?s:1)-1){let u=n.nextMenuItem(1);u&&(n.activeMenuItem=u)}}break;case"ArrowLeft":if(n===this.rootMenu)o||(n.activeMenuItem=n.firstMenuItem);else if((o&&(l=n.getMenuItemColumn(o))!=null?l:-1)<=0||!o){n.hide();let u=n.parentMenu.activeMenuItem;if(u){let{element:m}=u;m==null||m.focus(),m==null||m.classList.remove("is-submenu-open")}}else{let u=n.nextMenuItem(-1);u&&(n.activeMenuItem=u)}break;case"ArrowDown":n.activeMenuItem=n.nextMenuItem(n.columnCount);break;case"ArrowUp":n.activeMenuItem=n.nextMenuItem(-n.columnCount);break;case"Home":case"PageUp":n.activeMenuItem=n.firstMenuItem;break;case"End":case"PageDown":n.activeMenuItem=n.lastMenuItem;break;case"Backspace":if(this.typingBuffer&&(this.typingBuffer=this.typingBuffer.slice(0,-1),this.typingBuffer)){clearTimeout(this.typingBufferResetTimer);let c=n.findMenuItem(this.typingBuffer);c&&(n.activeMenuItem=c),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}break;default:if(cr(r)){isFinite(this.typingBufferResetTimer)&&clearTimeout(this.typingBufferResetTimer),this.typingBuffer+=r.key;let c=n.findMenuItem(this.typingBuffer);c&&(n.activeMenuItem=c),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}else i=!1}i&&(r.preventDefault(),r.stopPropagation())}handleEvent(r){if(r.type==="keydown")this.handleKeydownEvent(r);else if(r.type==="keyup")this.handleKeyupEvent(r);else if(r.type==="pointermove")this.lastMoveEvent=r;else if(r.type==="pointerup")Number.isFinite(this.rootMenu._openTimestamp)&&Date.now()-this.rootMenu._openTimestamp<120?this.state="modal":this.state==="modal"&&r.target===this.scrim&&this.hide();else if(r.type==="contextmenu"){r.preventDefault(),r.stopPropagation();return}super.handleEvent(r)}dispatchEvent(r){return this._host?this._host.dispatchEvent(r):!0}get host(){return this._host}get scrim(){return Te.element}connectScrim(r){let i=this.scrim;i.addEventListener("pointerup",this,!0),i.addEventListener("contextmenu",this),i.addEventListener("keydown",this),i.addEventListener("keyup",this),i.addEventListener("pointermove",this),Te.open({root:r,onDismiss:()=>this.hide()})}disconnectScrim(){let r=this.scrim;r.removeEventListener("pointerup",this,!0),r.removeEventListener("contextmenu",this),r.removeEventListener("keydown",this),r.removeEventListener("keyup",this),r.removeEventListener("pointermove",this),Te.state==="open"&&Te.scrim.close()}get rootMenu(){return this}show(r){return this._onDismiss=r==null?void 0:r.onDismiss,r!=null&&r.modifiers&&(this.modifiers=r.modifiers),this.updateState(),this.connectScrim(r==null?void 0:r.target),super.show(g(p({},r),{container:this.scrim}))?(this._openTimestamp=Date.now(),this.state="open",!0):(this.disconnectScrim(),!1)}hide(){this.cancelDelayedOperation(),this.state!==void 0&&(this.state!=="closed"&&(this.activeMenuItem=null,Te.element.parentElement.focus(),super.hide(),this.state="closed",this.disconnectScrim()),this._onDismiss&&(this._onDismiss(),this._onDismiss=void 0))}scheduleOperation(r){this.cancelDelayedOperation();let i=zs.SUBMENU_DELAY;if(i<=0){r();return}this.hysteresisTimer=setTimeout(()=>{this.hysteresisTimer=0,r()},i)}cancelDelayedOperation(){this.hysteresisTimer&&(clearTimeout(this.hysteresisTimer),this.hysteresisTimer=0)}};zs.SUBMENU_DELAY=120;var Ao=zs;function hh(t){return Lo(t)?!1:typeof t.label=="function"||typeof t.ariaLabel=="function"||typeof t.tooltip=="function"||(St(t)||qr(t))&&(typeof t.enabled=="function"||typeof t.visible=="function")||St(t)&&typeof t.checked=="function"?!0:qr(t)?t.submenu.some(hh):!1}var An=class{};An.DELAY=300,An.MAX_DISTANCE=10;function fh(t){return new Promise((e,r)=>{let i=fn(t);i||e(!1);let n=i,o=setTimeout(()=>{a.abort(),e(ch(n,i){if(c.type==="pointerup"||c.type==="pointercancel")clearTimeout(o),a.abort(),e(!1);else if(c.type==="pointermove"){let u=fn(c);u&&(n=u)}},{passive:!0,signal:s})})}async function Fc(t,e,r){if(t.defaultPrevented)return!1;if(t.type==="contextmenu"){let i=t;if(t.preventDefault(),t.stopPropagation(),r.show({target:e,location:fn(i),modifiers:Ht(i)}))return!0}if(t.type==="keydown"){let i=t;if(i.code==="ContextMenu"||i.code==="F10"&&i.shiftKey){let n=e==null?void 0:e.getBoundingClientRect();if(gh(e)&&n&&r.show({target:e,location:{x:Math.ceil(n.left+n.width/2),y:Math.ceil(n.top+n.height/2)},modifiers:Ht(i)}))return t.preventDefault(),t.stopPropagation(),!0}}if(t.type==="pointerdown"&&t.pointerType!=="mouse"&&t.button===0){let i=t.target;for(;i&&e!==i;)i=i.parentNode;if(!i||!r.visible)return!1;let n=fn(t);if(await fh(t))return r.state!=="closed"||!gh(e)?!1:(r.show({target:e,location:n}),!0)}return!1}function gh(t){return t.dispatchEvent(new Event("contextmenu",{cancelable:!0}))}var bh="",Fs="";function Ns(t){return t.replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function re(t,e){return!t||!e.generateID?"":` extid="${t}"`}function Rb(t,e,r){var m,d,h,f,x,_,b,v;let i=!1;e=e!=null?e:t.atoms.length;let n="",o="",a=t.atoms[t.index],s=(m=a.style)==null?void 0:m.variant,l=(d=a.style)==null?void 0:d.variantStyle,c="";if(a.value&&(s||l)){let k=(h=On(a.value,s,l))!=null?h:a.value;if(k!==a.value)return t.index+=1,n=`${k}`,Jt(n,t,r)||(t.mathML+=n,t.lastType="mi"),!0;c=(f={upnormal:"normal",boldnormal:"bold",italicmain:"italic",bolditalicmain:"bold-italic","updouble-struck":"double-struck","double-struck":"double-struck",boldfraktur:"bold-fraktur",calligraphic:"script",upcalligraphic:"script",script:"script",boldscript:"bold-script",boldcalligraphic:"bold-script",fraktur:"fraktur","upsans-serif":"sans-serif","boldsans-serif":"bold-sans-serif","italicsans-serif":"sans-serif-italic","bolditalicsans-serif":"sans-serif-bold-italic",monospace:"monospace"}[(l!=null?l:"")+(s!=null?s:"")])!=null?f:"",c&&(c=` mathvariant="${c}"`)}let u={"\\exponentialE":"ⅇ","\\imaginaryI":"ⅈ","\\differentialD":"ⅆ","\\capitalDifferentialD":"ⅅ","\\alpha":"α","\\pi":"π","\\infty":"∞","\\forall":"∀","\\nexists":"∄","\\exists":"∃","\\hbar":"\u210F","\\cdotp":"\u22C5","\\ldots":"\u2026","\\cdots":"\u22EF","\\ddots":"\u22F1","\\vdots":"\u22EE","\\ldotp":"."};if(a.command==="!")return t.index+=1,n="!",Jt(n,t,r)||(t.mathML+=n,t.lastType="mo"),!0;if(u[a.command]){t.index+=1;let k=`${u[a.command]}`;return(t.lastType==="mi"||t.lastType==="mn"||t.lastType==="mtext"||t.lastType==="fence")&&(k=Fs+k),Jt(k,t,r)||(t.mathML+=k,t.lastType="mi"),!0}if(a.command==="\\operatorname")o=Cn(a.body),t.index+=1;else if(s||l)for(;t.index0){i=!0,n=`${o}`;let k=t.lastType;n.endsWith(">f")||n.endsWith(">g")?(n+=bh,t.lastType="applyfunction"):t.lastType=/^(.*)<\/mo>$/.test(n)?"mo":"mi",Jt(n,t,r)||((k==="mi"||k==="mn"||k==="mtext"||k==="fence")&&(n=Fs+n),t.mathML+=n)}return i}function yh(t){return t.index${t}${a}${o}`:o?s=`${t}${o}`:a&&(s=`${t}${a}`),e.mathML+=s,e.lastType="",!0}function Ib(t,e,r){e=e!=null?e:t.atoms.length;let i=t.index,n="",o=xh(t);for(o>=0&&o0?(n=`${n}`,o<0&&yh(t)&&(o=t.index,t.index+=1),Jt(n,t,r)||(t.mathML+=n,t.lastType="mtext"),!0):!1}function zb(t,e,r){e=e!=null?e:t.atoms.length;let i=t.index,n="",o=xh(t);for(o>=0&&o"+n+"",o<0&&yh(t)&&(o=t.index,t.index+=1),Jt(n,t,r)||(t.mathML+=n,t.lastType="mn"),!0)}function Nb(t,e,r){let i=!1;e=e!=null?e:t.atoms.length;let n="",o="";if(t.index",n+=Si(t.atoms[l],r),n+=U(t.atoms,r,l+1,c),n+=Si(t.atoms[c],r),n+="",t.index=c+1,(t.lastType==="mi"||t.lastType==="mn"||t.lastType==="mfrac"||t.lastType==="fence")&&(t.mathML+=Fs),Jt(n,t,r)&&(i=!0,t.lastType="",n=""),o="fence")}return n.length>0&&(i=!0,t.mathML+=n,t.lastType=o),i}function Fb(t,e,r){let i=!1;e=e!=null?e:t.atoms.length;let n="",o="",a=t.atoms[t.index];if(!a)return!1;let s={"\\ne":"≠","\\neq":"≠","\\pm":"±","\\times":"×","\\colon":":","\\vert":"|","\\Vert":"\u2225","\\mid":"\u2223","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lbrack":"[","\\rbrack":"]","\\lparen":"(","\\rparen":")","\\langle":"\u27E8","\\rangle":"\u27E9","\\lfloor":"\u230A","\\rfloor":"\u230B","\\lceil":"\u2308","\\rceil":"\u2309"};if(s[a.command]){t.index+=1;let l=`${s[a.command]}`;return Jt(l,t,r)||(t.mathML+=l,t.lastType="mo"),!0}if(t.index"):a.superscript?(n+=""+l,n+=U(a.superscript,r),n+=""):a.subscript&&(n+=""+l,n+=U(a.subscript,r),n+=""),t.mathML+=n,t.lastType="mo",t.index+=1,!0}{let l=t.atoms[t.index],c=l.value==="\\operatorname",u=c?'"+Cn(l.value)+"":Si(l,r);n+=u,!c&&!/^(.*)<\/mo>$/.test(u)?(n+=bh,o="applyfunction"):o=c?"mi":"mo"}(t.lastType==="mi"||t.lastType==="mn")&&!/^(.*)<\/mo>$/.test(n)&&(n=Fs+n),t.index+=1}return n.length>0&&(i=!0,Jt(n,t,r)||(t.mathML+=n,t.lastType=o)),i}function U(t,e,r,i){e!=null||(e={});let n={atoms:[],index:r!=null?r:0,mathML:"",lastType:""};if(typeof t=="number"||typeof t=="boolean")n.mathML=t.toString();else if(typeof t=="string")n.mathML=t;else if(t instanceof y)n.mathML=$c(t,e);else if(Array.isArray(t)){n.atoms=t;let o=0;for(i=i||(t?t.length:0);n.index0&&n.atoms[n.index].type==="genfrac"&&(a=""+a),n.atoms[n.index].type==="genfrac"?n.lastType="mfrac":n.lastType="",n.index+=1,Jt(a,n,e)?o+=1:a.length>0&&(n.mathML+=a,o+=1)}o>1&&(n.mathML=""+n.mathML+"")}return n.mathML}function Si(t,e){let r="",i=Cn(t.value);return i&&(r=""+i+""),r}function Cn(t){if(!t)return"";if(typeof t=="string")return Ns(t);if(!Array.isArray(t)&&typeof t.body=="string")return Ns(t.body);let e="";for(let r of t)typeof r.value=="string"&&(e+=r.value);return Ns(e)}function $c(t,e){var x,_,b,v,k,A,C,T,S,B,$,G,R,N,j,D,H,ie,X,be,ye,Be,At;if(t.mode==="text")return`${t.value}`;let r={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",longleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",longrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",overgroup:"\u23E0",undergroup:"\u23E1",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",xrightleftharpoons:"\u21CC",longrightleftharpoons:"\u21CC",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xleftrightarrows:"\u21C4",xRightleftharpoons:"\u21CC",longRightleftharpoons:"\u21CC",xLeftrightharpoons:"\u21CB",longLeftrightharpoons:"\u21CB"},i={"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\>":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5},n="",o="",a,s,l,c,u,m,{command:d}=t;if(t.command==="\\error")return`${U(t.body,e)}`;let h={"\\vert":"|","\\Vert":"\u2225","\\mid":"\u2223","\\lbrack":"[","\\rbrack":"]","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"\u27E8","\\rangle":"\u27E9","\\lfloor":"\u230A","\\rfloor":"\u230B","\\lceil":"\u2308","\\rceil":"\u2309"},f={"\\vec":"⃗","\\acute":"´","\\grave":"`","\\dot":"˙","\\ddot":"¨","\\tilde":"~","\\bar":"¯","\\breve":"˘","\\check":"ˇ","\\hat":"^"};switch(t.type){case"first":break;case"error":if(t.command==="\\\\")break;n=`${U(t.body,e)}`;break;case"group":case"root":n=U(t.body,e);break;case"array":let ue=t;if((ue.leftDelim&&ue.leftDelim!=="."||ue.rightDelim&&ue.rightDelim!==".")&&(n+="",ue.leftDelim&&ue.leftDelim!=="."&&(n+=`${h[ue.leftDelim]||ue.leftDelim}`)),n+="",a=0;a"+U(ue.rows[s][a],e)+"";n+=""}n+="",(ue.leftDelim&&ue.leftDelim!=="."||ue.rightDelim&&ue.rightDelim!==".")&&(ue.rightDelim&&ue.rightDelim!=="."&&(n+=`${h[ue.rightDelim]||ue.rightDelim}`),n+="");break;case"genfrac":let Se=t;(Se.leftDelim||Se.rightDelim)&&(n+=""),Se.leftDelim&&Se.leftDelim!=="."&&(n+=""+(h[Se.leftDelim]||Se.leftDelim)+""),Se.hasBarLine?(n+="",n+=U(t.above,e)||" ",n+=U(t.below,e)||" ",n+=""):(n+="",n+=""+U(t.above,e)+"",n+=""+U(t.below,e)+"",n+=""),Se.rightDelim&&Se.rightDelim!=="."&&(n+=""+(h[Se.rightDelim]||Se.rightDelim)+""),(Se.leftDelim||Se.rightDelim)&&(n+="");break;case"surd":t.hasEmptyBranch("above")?(n+="",n+=U(t.body,e),n+=""):(n+="",n+=U(t.body,e),n+=U(t.above,e),n+="");break;case"leftright":let Jr=t,fr=Jr.leftDelim;n="",fr&&fr!=="."&&(n+=`${(x=h[fr])!=null?x:fr}`),t.body&&(n+=U(t.body,e));let Fo=Jr.matchingRightDelim();Fo&&Fo!=="."&&(n+=`${(_=h[Fo])!=null?_:Fo}`),n+="";break;case"sizeddelim":case"delim":n+=`${h[t.value]||t.value}`;break;case"accent":let qh=t;n+='",n+=U(t.body,e),n+=""+(f[d]||qh.accent)+"",n+="";break;case"line":case"overlap":break;case"overunder":let Ue=t;u=t.above,c=t.below,(Ue.svgAbove||u)&&(Ue.svgBelow||c)?m=t.body:u&&u.length>0?(m=t.body,(v=(b=t.body)==null?void 0:b[0])!=null&&v.below?(c=t.body[0].below,m=t.body[0].body):((A=(k=t.body)==null?void 0:k[0])==null?void 0:A.type)==="first"&&((T=(C=t.body)==null?void 0:C[1])!=null&&T.below)&&(c=t.body[1].below,m=t.body[1].body)):c&&c.length>0&&(m=t.body,(B=(S=t.body)==null?void 0:S[0])!=null&&B.above?(u=t.body[0].above,m=t.body[0].body):((G=($=t.body)==null?void 0:$[0])==null?void 0:G.type)==="first"&&((N=(R=t.body)==null?void 0:R[1])!=null&&N.above)&&(u=t.body[1].above,m=t.body[1].body)),(Ue.svgAbove||u)&&(Ue.svgBelow||c)?(n+=``,n+=(j=r[Ue.svgBody])!=null?j:U(m,e),n+=(D=r[Ue.svgBelow])!=null?D:U(c,e),n+=(H=r[Ue.svgAbove])!=null?H:U(u,e),n+=""):Ue.svgAbove||u?(n+=``+((ie=r[Ue.svgBody])!=null?ie:U(m,e)),n+=(X=r[Ue.svgAbove])!=null?X:U(u,e),n+=""):(Ue.svgBelow||c)&&(n+=``+((be=r[Ue.svgBody])!=null?be:U(m,e)),n+=(ye=r[Ue.svgBelow])!=null?ye:U(c,e),n+="");break;case"placeholder":n+="?";break;case"mord":{if(n=typeof t.value=="string"?t.value:d,n.length>0&&n.startsWith("\\"))typeof t.value=="string"&&t.value.charCodeAt(0)>255?n="&#x"+("000000"+t.value.charCodeAt(0).toString(16)).slice(-4)+";":typeof t.value=="string"&&(n=t.value.charAt(0));else if(t.command==="\\char"){let Zs=(Be=t.args)==null?void 0:Be[0];if(Zs!==void 0&&"number"in Zs){let ou=Zs.number;typeof ou=="number"&&(n="&#x"+("000000"+ou.toString(16)).slice(-4)+";")}}else typeof t.value=="string"?n=t.value:(console.error("Did not expect this"),n="");let Ye=/\d/.test(n)?"mn":"mi";n=`<${Ye}${re(t.id,e)}>${Ns(n)}`;break}case"mbin":case"mrel":case"minner":n=Si(t,e);break;case"mpunct":n='"+d+"";break;case"mop":case"operator":case"extensible-symbol":t.value!=="\u200B"&&(n="",n+=d==="\\operatorname"?t.body:d||t.body,n+="");break;case"box":let nu=t;n='"+U(t.body,e)+"";break;case"spacing":n+='';break;case"enclose":let Xs=t;n=''+U(t.body,e)+"";break;case"prompt":n=''+U(t.body,e)+"";break;case"space":n+=" ";break;case"subsup":break;case"phantom":break;case"composition":break;case"rule":break;case"chem":break;case"mopen":n+=Si(t,e);break;case"mclose":n+=Si(t,e);break;case"macro":{let Ye=t.command+Cn(t.macroArgs);Ye&&(n+=`${Ye}`)}break;case"latexgroup":n+=U(t.body,e);break;case"latex":n+=""+t.value+"";break;case"tooltip":n+=U(t.body,e);break;case"text":n+=`${t.value}`;break;default:if(t.command==="\\displaystyle")return`${U(t.body,e)}`;if(t.command==="\\textstyle")return`${U(t.body,e)}`;console.info("Unexpected element in conversion to MathML:",t)}return n}var En={"\\alpha":"alpha ","\\mu":"mew ","\\sigma":"sigma ","\\pi":"pie ","\\imaginaryI":"imaginary eye ","\\imaginaryJ":"imaginary jay ","\\sum":"Summation ","\\prod":"Product ","+":"plus ","-":"minus ",";":' semi-colon ',",":' comma ',"|":'Vertical bar',"(":'Open paren. ',")":' Close paren. ',"=":"equals ","<":"is less than ","\\lt":"is less than ","<=":"is less than or equal to ","\\le":"is less than or equal to ","\\gt":"is greater than ",">":"is greater than ","\\pm":"plus or minus","\\mp":"minus or plus","\\ge":"is greater than or equal to ","\\geq":"is greater than or equal to ","\\leq":"is less than or equal to ","\\ne":"is not equal to ","\\neq":"is not equal to ","!":"factorial ","\\sin":"sine ","\\cos":"cosine ","\u200B":"","\u2212":"minus ",":":' such that ',"\\colon":' such that ',"\\hbar":"etch bar ","\\iff":'if, and only if, ',"\\Longleftrightarrow":'if, and only if, ',"\\land":"and ","\\lor":"or ","\\neg":"not ","\\div":"divided by ","\\forall":"for all ","\\exists":"there exists ","\\nexists":"there does not exists ","\\in":"element of ","\\N":'the set n',"\\C":'the set c',"\\Z":'the set z',"\\Q":'the set q',"\\infty":"infinity ","\\nabla":"nabla ","\\partial":"partial derivative of ","\\cdot":"times ","\\cdots":"dot dot dot ","\\Rightarrow":"implies ","\\lparen":'open paren',"\\rparen":'close paren',"\\lbrace":'open brace',"\\{":'open brace',"\\rbrace":'close brace',"\\}":'close brace',"\\langle":'left angle bracket',"\\rangle":'right angle bracket',"\\lfloor":'open floor',"\\rfloor":'close floor',"\\lceil":'open ceiling',"\\rceil":'close ceiling',"\\vert":'vertical bar',"\\mvert":'divides',"\\lvert":'left vertical bar',"\\rvert":'right vertical bar',"\\lbrack":' open square bracket ',"\\rbrack":' close square bracket ',mm:"millimeters",cm:"centimeters",km:"kilometers",kg:"kilograms"},Vc={array:"array",matrix:"matrix",pmatrix:"parenthesis matrix",bmatrix:"square brackets matrix",Bmatrix:"braces matrix",vmatrix:"bars matrix",Vmatrix:"double bars matrix","matrix*":"matrix",smallmatrix:"small matrix"};function $b(t){let e="";return t.startsWith("\\")&&(e=" "+t.replace("\\","")+" "),e}function Co(t){let e=0;if(ee(t))for(let r of t)r.type!=="first"&&(e+=1);return e===1}function Vb(t){if(ee(t)){for(let e of t)if(e.type!=="first"&&e.id)return e.id.toString()}return""}function vh(t){let e="";if(ee(t))for(let r of t)r.type!=="first"&&typeof r.value=="string"&&(e+=r.value);return e}function qb(t){return t?t.map(e=>e.value).join(""):""}function $s(t){if(t&&!t.some(e=>e.type!=="first"&&e.value===void 0))return t.map(e=>e.value).join("")}function qc(t){return`${t}`}function Hb(t,e){var o;let r="",i=!1,n=!1;for(let a=0;a${b}`:/[A-Z]/.test(b)?`capital ${b.toLowerCase()}`:b:/[a-z]/.test(b)?" '"+b.toUpperCase()+"'":/[A-Z]/.test(b)?" 'capital "+b.toUpperCase()+"'":b}if(!e)return"";if(ee(e))return Hb(t,e);let i="";if(e.id&&t==="math"&&(i+=''),e.mode==="text")return i+e.value;let n="",o="",a="",s=!1,{command:l}=e;switch(l){case"\\vec":return"vector "+V(t,e.body);case"\\acute":return V(t,e.body)+" acute";case"\\grave":return V(t,e.body)+" grave";case"\\dot":return"dot over"+V(t,e.body);case"\\ddot":return"double dot over"+V(t,e.body);case"\\mathring":return"ring over"+V(t,e.body);case"\\tilde":case"\\widetilde":return"tilde over"+V(t,e.body);case"\\bar":return V(t,e.body)+" bar";case"\\breve":return V(t,e.body)+" breve";case"\\check":case"\\widecheck":return"check over "+V(t,e.body);case"\\hat":case"\\widehat":return"hat over"+V(t,e.body);case"\\overarc":case"\\overparen":case"\\wideparen":return"arc over "+V(t,e.body);case"\\underarc":case"\\underparen":return"arc under "+V(t,e.body);case"\\mathop":return(c=$s(e.body))!=null?c:V(t,e.body);case"\\mathit":return(u=$s(e.body))!=null?u:V(t,e.body);case"\\mathrm":return(m=$s(e.body))!=null?m:V(t,e.body);case"\\mathbb":return"blackboard"+((d=$s(e.body))!=null?d:V(t,e.body))}switch(e.type){case"prompt":let b=e.body.length>1?'start input . '+V(t,e.body)+'. end input':"blank";i+=' '+b+'. '+((h=e.correctness)!=null?h:"")+' . ';break;case"array":let v=e.rows,k=e.environmentName;if(Object.keys(Vc).includes(k)){i+=` begin ${Vc[k]} `;for(let T=0;T0&&(i+=","),i+=` row ${T+1} `;for(let S=0;S0&&(i+=","),i+=` column ${S+1}: `,i+=V("math",v[T][S])}i+=` end ${Vc[k]} `}break;case"group":l==="\\ne"?i+=" not equal ":(l==="\\not"&&(i+=" not "),i+=V("math",e.body));break;case"root":i+=V("math",e.body);break;case"genfrac":if(n=V("math",e.above),o=V("math",e.below),Co(e.above)&&Co(e.below)){let S={"1/2":" half ","1/3":" one third ","2/3":" two third","1/4":" one quarter ","3/4":" three quarter ","1/5":" one fifth ","2/5":" two fifths ","3/5":" three fifths ","4/5":" four fifths ","1/6":" one sixth ","5/6":" five sixths ","1/8":" one eight ","3/8":" three eights ","5/8":" five eights ","7/8":" seven eights ","1/9":" one ninth ","2/9":" two ninths ","4/9":" four ninths ","5/9":" five ninths ","7/9":" seven ninths ","8/9":" eight ninths "}[vh(e.above)+"/"+vh(e.below)];S?i=S:i+=n+" over "+o}else i+=' the fraction '+n+' over '+o+'. End fraction.';break;case"surd":if(a=V("math",e.body),e.hasEmptyBranch("above"))i+=Co(e.body)?" the square root of "+a+" , ":' the square root of '+a+'. End square root';else{let T=V("math",e.above);T=T.trim();let S=T.replace(//g,"");S==="3"?i+=' the cube root of '+a+'. End cube root':S==="n"?i+=' the nth root of '+a+'. End root':i+=' the root with index: '+T+', of '+a+'. End root'}break;case"leftright":{let T=e;i+=(f=T.leftDelim?En[T.leftDelim]:void 0)!=null?f:T.leftDelim,i+=V("math",e.body),i+=(x=T.rightDelim?En[T.rightDelim]:void 0)!=null?x:T.rightDelim}break;case"rule":break;case"overunder":break;case"overlap":break;case"macro":let A=l.replace(/^\\/g,""),C=Bi()[A];C!=null&&C.expand?i+=V("math",e.body):i+=`${A} `;break;case"placeholder":i+="placeholder ";break;case"delim":case"sizeddelim":case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":{if(l==="\\mathbin"||l==="\\mathrel"||l==="\\mathopen"||l==="\\mathclose"||l==="\\mathpunct"||l==="\\mathord"||l==="\\mathinner"){i=V(t,e.body);break}let T=e.isDigit()?e.asDigit():e.value,S=e.command;if((e.type==="delim"||e.type==="sizeddelim")&&(S=e.value,T=S),t==="text")i+=T;else{if(e.type==="mbin"&&(i+=''),T){let B=En[T]||(S?En[S.trim()]:"");if(B)i+=" "+B;else{let $=S?$b(S.trim()):"";i+=$||r(T)}}else i+=V("math",e.body);e.type==="mbin"&&(i+='')}break}case"mop":case"operator":case"extensible-symbol":if(e.value!=="\u200B"){let T=e.command;if(T==="\\sum")if(!e.hasEmptyBranch("superscript")&&!e.hasEmptyBranch("subscript")){let S=V("math",e.superscript);S=S.trim();let B=V("math",e.subscript);B=B.trim(),i+=' the summation from '+B+' to '+S+' of ',s=!0}else if(e.hasEmptyBranch("subscript"))i+=" the summation of";else{let S=V("math",e.subscript);S=S.trim(),i+=' the summation from '+S+' of ',s=!0}else if(T==="\\prod")if(!e.hasEmptyBranch("superscript")&&!e.hasEmptyBranch("subscript")){let S=V("math",e.superscript);S=S.trim();let B=V("math",e.subscript);B=B.trim(),i+=' the product from '+B+' to '+S+' of ',s=!0}else if(e.hasEmptyBranch("subscript"))i+=" the product of ";else{let S=V("math",e.subscript);S=S.trim(),i+=' the product from '+S+' of ',s=!0}else if(T==="\\int")if(!e.hasEmptyBranch("superscript")&&!e.hasEmptyBranch("subscript")){let S=V("math",e.superscript);S=S.trim();let B=V("math",e.subscript);B=B.trim(),i+=' the integral from '+qc(B)+' to '+qc(S)+' of ',s=!0}else i+=' the integral of ';else if(T==="\\operatorname"||T==="\\operatorname*")i+=qb(e.body)+" ";else if(typeof e.value=="string"){let S=(_=En[e.value])!=null?_:e.command?En[e.command]:void 0;i+=S||" "+e.value}else e.command&&(e.command==="\\mathop"?i+=V("math",e.body):i+=e.command.startsWith("\\")?" "+e.command.slice(1):" "+e.command)}break;case"enclose":a=V("math",e.body),i+=" crossed out "+a+". End crossed out.";break;case"space":case"spacing":break}if(!s&&!e.hasEmptyBranch("superscript")){let b=V(t,e.superscript);b=b.trim();let v=b.replace(/<[^>]*>/g,"");if(Co(e.superscript)){if(t==="math"){let k=Vb(e.superscript);k&&(i+='')}v==="\u2032"?i+=" prime ":v==="2"?i+=" squared ":v==="3"?i+=" cubed ":Number.isNaN(Number.parseInt(v))?i+=" to the "+b+"; ":i+=' to the '+v+" power; "}else Number.isNaN(Number.parseInt(v))?i+=" raised to the "+b+"; ":i+=' raised to the '+v+" power; "}if(!s&&!e.hasEmptyBranch("subscript")){let b=V("math",e.subscript);b=b.trim(),i+=Co(e.subscript)?" sub "+b:" subscript "+b+". End subscript. "}return i}function kt(t){var i,n;let e=globalThis.MathfieldElement;if(e.textToSpeechRules==="sre"&&("sre"in window||"SRE"in window)){let o=U(t);if(o){e.textToSpeechMarkup&&(e.textToSpeechRulesOptions=(i=e.textToSpeechRulesOptions)!=null?i:{},e.textToSpeechRulesOptions=g(p({},e.textToSpeechRulesOptions),{markup:e.textToSpeechMarkup}),e.textToSpeechRulesOptions.markup==="ssml"&&(e.textToSpeechRulesOptions=g(p({},e.textToSpeechRulesOptions),{markup:"ssml_step"})),e.textToSpeechRulesOptions=g(p({},e.textToSpeechRulesOptions),{rate:e.speechEngineRate}));let a=(n=window.SRE)!=null?n:globalThis.sre.System.getInstance();e.textToSpeechRulesOptions&&a.setupEngine(e.textToSpeechRulesOptions);let s="";try{s=a.toSpeech(o)}catch(l){console.error("MathLive 0.109.0: `SRE.toSpeech()` runtime error",l)}return s}return""}let r=V("math",t);if(e.textToSpeechMarkup==="ssml"){let o="";e.speechEngineRate&&(o=''),r=''+o+"

    "+r+"

    "+(o?"
    ":"")+""}else e.textToSpeechMarkup==="mac"&&Ct()==="macos"?r=r.replace(//g,"").replace(//g,"[[emph+]]").replace(/<\/emphasis>/g,"").replace(//g,"[[slc $1]]").replace(/]*>/g,"").replace(/<\/say-as>/g,""):r=r.replace(/<[^>]*>/g,"").replace(/\s{2,}/g," ");return r}var Gt={"\\ne":"\u2260","\\neq":"\u2260","\u2212":"-","-":"-","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\delta":"delta","\\epsilon":"epsilon","\\varepsilon":"varepsilon","\\zeta":"zeta","\\eta":"eta","\\theta":"theta","\\vartheta":"vartheta","\\iota":"iota","\\kappa":"kappa","\\lambda":"lambda","\\mu":"mu","\\nu":"nu","\\xi":"xi","\\pi":"pi","\\rho":"rho","\\sigma":"sigma","\\tau":"tau","\\upsilon":"upsilon","\\phi":"phi","\\varphi":"varphi","\\chi":"chi","\\psi":"psi","\\omega":"omega","\\Gamma":"Gamma","\\Delta":"Delta","\\Theta":"Theta","\\Lambda":"Lambda","\\Xi":"Xi","\\Pi":"Pi","\\Sigma":"Sigma","\\Phi":"Phi","\\Psi":"Psi","\\Omega":"Omega","\\exponentialE":"e","\\imaginaryI":"i","\\imaginaryJ":"j","\\!":" ","\\,":" ","\\:":" ","\\>":" ","\\;":" ","\\enskip":" ","\\enspace":" ","\\qquad":" ","\\quad":" ","\\infty":"oo","\\R":"RR","\\mathbb{R}":"RR","\\N":"NN","\\mathbb{N}":"NN","\\Z":"ZZ","\\mathbb{Z}":"ZZ","\\Q":"QQ","\\mathbb{Q}":"QQ","\\C":"CC","\\mathbb{C}":"CC","\\emptyset":"O/","\\varnothing":"O/","\\varDelta":"Delta","\\varTheta":"Theta","\\varLambda":"Lambda","\\varXi":"Xi","\\varPi":"Pi","\\varSigma":"Sigma","\\varUpsilon":"Upsilon","\\varPhi":"Phi","\\varPsi":"Psi","\\varOmega":"Omega"},Eo={"\\pm":"+-","\\colon":" : ","\\sum":" sum ","\\prod":" prod ","\\bigcap":" nnn ","\\bigcup":" uuu ","\\int":" int ","\\oint":" oint ","\\ge":">=","\\le":"<=","\\ne":"!=","\\neq":"!=","\\lt":"<","\\gt":">","\\gets":"<-","\\to":"->","\\land":" and ","\\lor":" or ","\\lnot":" not ","\\forall":" AA ","\\exists":" EE ","\\in":" in ","\\notin":" !in ","\\mapsto":"|->","\\implies":"=>","\\iff":"<=>","\\cdot":" * ","\\ast":" ** ","\\star":" *** ","\\times":" * ","\\div":" -: ","\\ltimes":" |>< ","\\rtimes":" ><| ","\\bowtie":" |><| ","\\circ":"@"},Vs={"\\vert":"|","\\Vert":"||","\\mid":"|","\\lbrack":"[","\\rbrack":"]","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"(:","\\rangle":":)"};function Wb(t){let e="";for(let r of t){let i=e[e.length-1];i!==void 0&&(/\d$/.test(i)&&/^\d/.test(r)||/[a-zA-Z]$/.test(i)&&/^[a-zA-Z]/.test(r))&&(e+=" "),e+=r}return e}function ce(t,e){var a,s,l,c,u,m,d,h,f,x,_,b,v,k,A,C,T,S,B;if(!t)return"";if(ee(t)){if(t.length===0)return"";if(t[0].mode==="latex")return t.map(R=>ce(R)).join("");if(t[0].mode==="text"){let R=0,N="";for(;((a=t[R])==null?void 0:a.mode)==="text";)N+=t[R].body?ce(t[R].body,e):t[R].value,R++;return e!=null&&e.plain?N+ce(t.slice(R),e):`"${N}" ${ce(t.slice(R))}`}let $=0,G=[];for(;((s=t[$])==null?void 0:s.mode)==="math";){let R="";for(;((l=t[$])==null?void 0:l.type)==="mord"&&/\d/.test(t[$].value);)R+=t[$++].value;R?G.push(R):G.push(ce(t[$++],e))}return G.push(ce(t.slice($),e)),Wb(G)}if(t.mode==="text")return e!=null&&e.plain?t.value:`"${t.value}"`;let r="",{command:i}=t,n;if(i==="\\placeholder")return`(${ce(t.body,e)})`;let o=y.serialize([t],{expandMacro:!1,defaultMode:"math"});switch(t.type){case"accent":let $={"\\vec":"vec","\\dot":"dot","\\ddot":"ddot","\\bar":"bar","\\hat":"hat","\\acute":"acute;","\\grave":"grave","\\tilde":"tilde","\\breve":"breave","\\check":"check"}[i];r=`${$!=null?$:""} ${ce(t.body,e)} `;break;case"first":return"";case"latexgroup":return t.body.map(R=>R.value).join("");case"group":case"root":r=(c=Gt[i])!=null?c:ce(t.body,e);break;case"genfrac":{let R=t;(R.leftDelim||R.rightDelim)&&(r=R.leftDelim==="."||!R.leftDelim?"{:":R.leftDelim),R.hasBarLine?(r+="(",r+=ce(R.above,e),r+=")/(",r+=ce(R.below,e),r+=")"):(r+="((",r+=ce(R.above,e),r+=") choose (",r+=ce(R.below,e),r+="))"),(R.leftDelim||R.rightDelim)&&(r+=R.rightDelim==="."||!R.rightDelim?"{:":R.rightDelim)}break;case"surd":t.hasEmptyBranch("above")?r+=`sqrt(${ce(t.body,e)})`:r+=`root(${ce(t.above,e)})(${ce(t.body,e)})`;break;case"latex":r=t.value;break;case"leftright":{let R=t,N=R.leftDelim;N&&Vs[N]&&(N=Vs[N]),r+=N==="."||!N?"{:":N,r+=ce(R.body,e);let j=R.matchingRightDelim();j&&Vs[j]&&(j=Vs[j]),r+=j==="."||!j?":}":j}break;case"sizeddelim":case"delim":r=t.value;break;case"overlap":break;case"overunder":break;case"mord":if(Gt[o])return Gt[o];r=(d=(m=(u=Gt[i])!=null?u:i)!=null?m:i)!=null?d:typeof t.value=="string"?t.value:"",r.startsWith("\\")&&(r+=" "),n=i?i.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null,n?r=String.fromCodePoint(Number.parseInt("0x"+n[1])):r.length>0&&r.startsWith("\\")&&(r=typeof t.value=="string"?t.value.charAt(0):t.command),r=Ub(r,t.style);break;case"mbin":case"mrel":case"minner":r=(x=(f=(h=Gt[o])!=null?h:Gt[i])!=null?f:Eo[i])!=null?x:t.value;break;case"mopen":case"mclose":r=t.value;break;case"mpunct":r=(_=Eo[i])!=null?_:i;break;case"mop":case"operator":case"extensible-symbol":t.value!=="\u200B"&&(Eo[i]?r=Eo[i]:r=i==="\\operatorname"?ce(t.body,e):(b=t.value)!=null?b:i,r+=" ");break;case"array":let G=t.environmentName;if(t.isMultiline)r=t.rows.map(N=>N.map(j=>ce(j,e)).join("")).join(` `);else{let R=(v={bmatrix:["[","]"],"bmatrix*":["[","]"]}[G])!=null?v:["(",")"],N=[],j=t.rows;for(let H of j){let ie=[];for(let X of H)ie.push(ce(X,e));N.push(R[0]+ie.join(",")+R[1])}let D=(k={bmatrix:["[","]"],"bmatrix*":["[","]"],cases:["{",":}"]}[G])!=null?k:["(",")"];r=D[0]+N.join(",")+D[1]}break;case"box":break;case"spacing":r=(C=(A=Gt[o])!=null?A:Gt[i])!=null?C:" ";break;case"enclose":r="("+ce(t.body,e)+")";break;case"space":r=" ";break;case"subsup":r="";break;case"macro":r=(B=(S=(T=Gt[o])!=null?T:Gt[i])!=null?S:Eo[i])!=null?B:ce(t.body,e);break}if(!t.hasEmptyBranch("subscript")){r+="_";let $=ce(t.subscript,e);r+=$.length!==1?`(${$})`:$}if(!t.hasEmptyBranch("superscript")){r+="^";let $=ce(t.superscript,e);r+=$.length!==1?`(${$})`:$}return r}function Ub(t,e){if(!e)return t;let r=t;return e.variant==="double-struck"&&(r=`bbb "${r}"`),e.variant==="script"&&(r=`cc "${r}"`),e.variant==="fraktur"&&(r=`fr "${r}"`),e.variant==="sans-serif"&&(r=`sf "${r}"`),e.variant==="monospace"&&(r=`tt "${r}"`),e.variantStyle==="bold"&&(r=`bb "${r}"`),e.color?`color({${e.color}})(${r})`:r}function he(t,e){var u;let r=g(p({},Yn()),{renderPlaceholder:()=>new w(160,{maxFontSize:1})});if(e!=null&&e.letterShapeStyle&&(e==null?void 0:e.letterShapeStyle)!=="auto"&&(r.letterShapeStyle=e.letterShapeStyle),e!=null&&e.macros){let m=Oi(e==null?void 0:e.macros);r.getMacro=d=>Ki(d,m)}e!=null&&e.registers&&(r.registers=p(p({},r.registers),e.registers));let i=(u=e==null?void 0:e.defaultMode)!=null?u:"math",n="math",o="displaystyle";i==="inline-math"?o="textstyle":i==="math"?o="displaystyle":i==="text"&&(o="textstyle",n="text");let a=new K({from:r}),l=new y({type:"root",mode:n,body:ge(t,{context:a,parseMode:n,mathstyle:o})}).render(a);return l?(Tr(qt(l,a)),Dr(l,{classes:"ML__latex"}).toMarkup()):""}function jb(t){return ns(t,{context:Yn()})}function Do(t,e={}){return U(ge(t,{parseMode:"math",args:()=>"",mathstyle:"displaystyle"}),e)}function Oo(t){let e=ge(t,{parseMode:"math",mathstyle:"displaystyle"});return kt(e)}var To;function Bo(t){var e,r;if(!To){let i=(e=globalThis[Symbol.for("io.cortexjs.compute-engine")])==null?void 0:e.ComputeEngine;i?To=new i:console.error(`MathLive 0.109.0: The CortexJS Compute Engine library is not available. Load the library, for example with: import "https://esm.run/@cortex-js/compute-engine"`)}return(r=To==null?void 0:To.box(t).latex)!=null?r:""}function Jb(t,e="math"){return ce(new y({type:"root",body:ge(t,{parseMode:e})}))}function Hc(t){return ir(t,{format:"ascii-math"})[1]}function Ko(t){if(typeof t=="string"){let e=Gb(t);if(!e)throw new Error(`Invalid color: ${t}`);return e}return"C"in t?Zb(t):"a"in t?_h(t):t}function ki(t){return t<0?0:t>255?255:Math.round(t)}function Gb(t){if(!t||t[0]!=="#")return;t=t.slice(1);let e;return t.length<=4?(e={r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)},t.length===4&&(e.a=parseInt(t[3]+t[3],16)/255)):(e={r:parseInt(t[0]+t[1],16),g:parseInt(t[2]+t[3],16),b:parseInt(t[4]+t[5],16)},t.length===8&&(e.a=parseInt(t[6]+t[7],16)/255)),typeof(e==null?void 0:e.a)=="undefined"&&(e.a=1),e}function Jc(t){let[e,r,i]=[t.L,t.C,t.H],n=i*Math.PI/180,o={L:e,a:r*Math.cos(n),b:r*Math.sin(n)};return t.alpha!==void 0&&(o.alpha=t.alpha),o}function Xb(t){let[e,r,i]=[t.L,t.a,t.b],n=Math.sqrt(r*r+i*i),a=Math.atan2(i,r)*180/Math.PI,s={L:e,C:n,H:a};return t.alpha!==void 0&&(s.alpha=t.alpha),s}function Wc(t){let[e,r,i]=[t.L,t.a,t.b],n=Math.pow(.9999999984505198*e+.39633779217376786*r+.2158037580607588*i,3),o=Math.pow(1.00000000888176*e-.10556134232365635*r-.0638541747717059*i,3),a=Math.pow(e*1.000000054672411-.0894841820949657*r-1.2914855378640917*i,3),s=4.076741661347994*n-3.307711590408193*o+.230969928729428*a,l=-1.2684380040921763*n+2.6097574006633715*o-.3413193963102197*a,c=-.004196086541837188*n-.7034186144594493*o+1.7076147009309444*a,u=m=>{let d=Math.abs(m);return d<=.0031308?m*12.92:(Math.sign(m)||1)*(1.055*Math.pow(d,1/2.4)-.055)};return[u(s),u(l),u(c)]}function Uc(t){let[e,r,i]=t;return e>=0&&e<=1&&r>=0&&r<=1&&i>=0&&i<=1}function jc(t,e){let[r,i,n]=t;return r=ki(r*255),i=ki(i*255),n=ki(n*255),e!==void 0?{r,g:i,b:n,alpha:e}:{r,g:i,b:n}}function _h(t){let[e,r,i]=Wc(t);if(Uc([e,r,i]))return jc([e,r,i],t.alpha);let n=Xb(t);if(n.C=0,[e,r,i]=Wc(Jc(n)),!Uc([e,r,i]))return jc([e,r,i],t.alpha);let o=0,a=t.L,s=(o+a)/2;n.C=s;let l=.36/Math.pow(2,12);for(;a-o>l;)s=(o+a)/2,n.C=s,[e,r,i]=Wc(Jc(n)),Uc([e,r,i])?o=s:a=s;return jc([e,r,i],t.alpha)}function Zb(t){return _h(Jc(t))}function Mh(t,e){let r=Ko(t),i=Ko(e),n=.56,o=.57,a=.62,s=.65,l=.022,c=1.414,u=.1,m=5e-4,d=1.14,h=.027,f=1.14,x=.027;function _(S){return S>=l?S:S+(l-S)**c}function b(S){return(S<0?-1:1)*Math.pow(Math.abs(S),2.4)}let v=_(b(i.r/255)*.2126729+b(i.g/255)*.7151522+b(i.b/255)*.072175),k=_(b(r.r/255)*.2126729+b(r.g/255)*.7151522+b(r.b/255)*.072175),A,C,T;return Math.abs(k-v)v?(A=k**n-v**o,C=A*d):(A=k**s-v**a,C=A*f),Math.abs(C)0?T=C-x:T=C+h,T*100}function Gc(t,e,r){r!=null||(r="#fff"),e!=null||(e="#000");let i=Mh(t,r),n=Mh(t,e);return Math.abs(i)>Math.abs(n)?r:e}function wh(t){let e=Ko(t),r=((1<<24)+(ki(e.r)<<16)+(ki(e.g)<<8)+ki(e.b)).toString(16).slice(1);return e.alpha!==void 0&&e.alpha<1&&(r+=("00"+Math.round(e.alpha*255).toString(16)).slice(-2)),r[0]===r[1]&&r[2]===r[3]&&r[4]===r[5]&&r[6]===r[7]&&(r=r[0]+r[2]+r[4]+(e.alpha!==void 0&&e.alpha<1?r[6]:"")),"#"+r}function oe(t){let e=Sh(t),r="";for(let i of e){if(typeof i.value!="string")return"";r+=i.value}return r}function Sh(t){let r=t.model.selection.ranges;if(r.length!==1)return[];let i=t.model.getAtoms(r[0]);return i.length===1&&i[0].isRoot&&(i=i[0].children),i.filter(n=>n.type!=="first")}function Yb(t,e){let r=Sh(t);if(r.length!==1)return!1;let i=cs[e];return i?!!i.test(r[0].value):!1}function Qb(t){return[Zc(t,"double-struck","mathbb","tooltip.blackboard"),Zc(t,"fraktur","mathfrak","tooltip.fraktur"),Zc(t,"calligraphic","mathcal","tooltip.caligraphic"),Yc(t,"up","mathrm","tooltip.roman-upright"),Yc(t,"bold","bm","tooltip.bold"),Yc(t,"italic","mathit","tooltip.italic")]}function ey(t){return[{id:"accent-vec",class:"ML__center-menu",label:()=>he(`\\vec{${oe(t)}}`),visible:()=>oe(t).length===1,onMenuSelect:()=>t.insert("\\vec{#@}",{selectionMode:"item"})},{id:"accent-overrightarrow",class:"ML__center-menu",label:()=>he(`\\overrightarrow{${oe(t)}}`),visible:()=>oe(t).length>0,onMenuSelect:()=>t.insert("\\overrightarrow{#@}",{selectionMode:"item"})},{id:"accent-overleftarrow",class:"ML__center-menu",label:()=>he(`\\overleftarrow{${oe(t)}}`),visible:()=>oe(t).length>0,onMenuSelect:()=>t.insert("\\overleftarrow{#@}",{selectionMode:"item"})},{id:"accent-dot",class:"ML__center-menu",label:()=>he(`\\dot{${oe(t)}}`),visible:()=>oe(t).length===1,onMenuSelect:()=>t.insert("\\dot{#@}",{selectionMode:"item"})},{id:"accent-ddot",class:"ML__center-menu",label:()=>he(`\\ddot{${oe(t)}}`),visible:()=>oe(t).length===1,onMenuSelect:()=>t.insert("\\ddot{#@}",{selectionMode:"item"})},{id:"accent-bar",class:"ML__center-menu",label:()=>he(`\\bar{${oe(t)}}`),visible:()=>oe(t).length===1,onMenuSelect:()=>t.insert("\\bar{#@}",{selectionMode:"item"})},{id:"accent-overline",class:"ML__center-menu",label:()=>he(`\\overline{${oe(t)}}`),visible:()=>oe(t).length>0,onMenuSelect:()=>t.insert("\\overline{#@}",{selectionMode:"item"})},{id:"accent-overgroup",class:"ML__center-menu",label:()=>he(`\\overgroup{${oe(t)}}`),visible:()=>oe(t).length>0,onMenuSelect:()=>t.insert("\\overgroup{#@}",{selectionMode:"item"})},{id:"accent-overbrace",class:"ML__center-menu",label:()=>he(`\\overbrace{${oe(t)}}`),visible:()=>oe(t).length>0,onMenuSelect:()=>t.insert("\\overbrace{#@}",{selectionMode:"item"})},{id:"accent-underline",class:"ML__center-menu",label:()=>he(`\\underline{${oe(t)}}`),visible:()=>oe(t).length>0,onMenuSelect:()=>t.insert("\\underline{#@}",{selectionMode:"item"})},{id:"accent-undergroup",class:"ML__center-menu",label:()=>he(`\\undergroup{${oe(t)}}`),visible:()=>oe(t).length>0,onMenuSelect:()=>t.insert("\\undergroup{#@}",{selectionMode:"item"})},{id:"accent-underbrace",class:"ML__center-menu",label:()=>he(`\\underbrace{${oe(t)}}`),visible:()=>oe(t).length>0,onMenuSelect:()=>t.insert("\\underbrace{#@}",{selectionMode:"item"})}]}function ty(t){return[{id:"decoration-boxed",label:()=>he(`\\boxed{${t.getValue(t.model.selection)}}}`),onMenuSelect:()=>t.insert("\\boxed{#@}",{selectionMode:"item"})},{id:"decoration-red-box",label:()=>he(`\\bbox[5px, border: 2px solid red]{${t.getValue(t.model.selection)}}`),onMenuSelect:()=>t.insert("\\bbox[5px, border: 2px solid red]{#@}",{selectionMode:"item"})},{id:"decoration-dashed-black-box",label:()=>he(`\\bbox[5px, border: 2px dashed black]{${t.getValue(t.model.selection)}}`),onMenuSelect:()=>t.insert("\\bbox[5px, border: 2px dashed black]{#@}",{selectionMode:"item"})}]}function ry(t){let e=[];for(let r of Object.keys(Zt))e.push({id:`background-color-${r}`,class:(wh(Gc(Zt[r]))==="#000"?"dark-contrast":"light-contrast")+" menu-swatch",label:``,ariaLabel:()=>{var i;return(i=I(r))!=null?i:r},checked:()=>{var i;return(i={some:"mixed",all:!0}[t.queryStyle({backgroundColor:r})])!=null?i:!1},onMenuSelect:()=>t.applyStyle({backgroundColor:r},{operation:"toggle"})});return e}function iy(t){let e=[];for(let r of Object.keys(Yt))e.push({id:`color-${r}`,class:(Gc(Yt[r])==="#000"?"dark-contrast":"light-contrast")+" menu-swatch",label:``,ariaLabel:()=>{var i;return(i=I(r))!=null?i:r},checked:()=>{var i;return(i={some:"mixed",all:!0}[t.queryStyle({color:r})])!=null?i:!1},onMenuSelect:()=>t.applyStyle({color:r},{operation:"toggle"})});return e}var Qc=class extends kn{constructor(e,r,i,n){super(e,r),this.row=i,this.col=n}set active(e){let r=this.parentMenu.children;if(e)for(let i of r)i.element.classList.toggle("active",i.row<=this.row&&i.col<=this.col);else for(let i of r)i.element.classList.remove("active")}};function ny(t){let e=[];for(let r=1;r<=5;r++)for(let i=1;i<=5;i++)e.push({id:`insert-matrix-${r}x${i}`,onCreate:(n,o)=>new Qc(n,o,r,i),label:"\u2610",tooltip:()=>I("tooltip.row-by-col",r,i),data:{row:r,col:i},onMenuSelect:()=>{t.insert(`\\begin{pmatrix}${Array(r).fill(Array(i).fill("#?").join(" & ")).join("\\\\")}\\end{pmatrix}`,{selectionMode:"item"})}});return e}function kh(t){return[{label:()=>I("menu.array.add row above"),id:"add-row-above",onMenuSelect:()=>t.executeCommand("addRowBefore"),keyboardShortcut:"shift+alt+[Return]",visible:()=>{if(!t.isSelectionEditable||!Li(t))return!1;let[e,r]=Wr(t),[i,n]=Tn(t);return e!==i}},{label:()=>I("menu.array.add row below"),id:"add-row-below",onMenuSelect:()=>t.executeCommand("addRowAfter"),keyboardShortcut:"alt+[Return]",visible:()=>{if(!t.isSelectionEditable||!Li(t))return!1;let[e,r]=Wr(t),[i,n]=Tn(t);return e!==i}},{label:()=>I("menu.array.add column before"),id:"add-column-before",onMenuSelect:()=>t.executeCommand("addColumnBefore"),visible:()=>{if(!t.isSelectionEditable||!Li(t))return!1;let[e,r]=Wr(t),[i,n]=Tn(t);return r!==n},keyboardShortcut:"shift+alt+[Tab]",enabled:()=>{let e=t.model.parentEnvironment;if(!e)return!1;let[r,i]=Xc(t);return rI("menu.array.add column after"),id:"add-column-after",onMenuSelect:()=>t.executeCommand("addColumnAfter"),keyboardShortcut:"alt+[Tab]",visible:()=>{if(!t.isSelectionEditable||!Li(t))return!1;let[e,r]=Wr(t),[i,n]=Tn(t);return r!==n}},{type:"divider"},{label:()=>I("menu.array.delete row"),id:"delete-row",onMenuSelect:()=>t.executeCommand("removeRow"),enabled:()=>{let[e,r]=Wr(t),[i,n]=Xc(t);return i>e},visible:()=>{if(!t.isSelectionEditable||!Li(t))return!1;let[e,r]=Wr(t),[i,n]=Tn(t);return e!==i}},{label:()=>I("menu.array.delete column"),id:"delete-column",onMenuSelect:()=>t.executeCommand("removeColumn"),enabled:()=>{let[e,r]=Wr(t),[i,n]=Xc(t);return n>r},visible:()=>{if(!t.isSelectionEditable||!Li(t))return!1;let[e,r]=Wr(t),[i,n]=Tn(t);return r!==n}},{type:"divider"},{label:()=>I("menu.borders"),visible:()=>(oy(t)||Li(t))&&t.isSelectionEditable,submenu:[{label:" \u22F1 ",id:"environment-no-border",onMenuSelect:()=>Po(t,"matrix")},{label:"(\u22F1)",id:"environment-parentheses",onMenuSelect:()=>Po(t,"pmatrix")},{label:"[\u22F1]",id:"environment-brackets",onMenuSelect:()=>Po(t,"bmatrix")},{label:"|\u22F1|",id:"environment-bar",onMenuSelect:()=>Po(t,"vmatrix")},{label:"{\u22F1}",id:"environment-braces",onMenuSelect:()=>Po(t,"Bmatrix")}],submenuClass:"border-submenu"},{type:"divider"},{label:()=>I("menu.insert matrix"),id:"insert-matrix",visible:()=>t.isSelectionEditable,submenu:ny(t),submenuClass:"insert-matrix-submenu",columnCount:5},{type:"divider"},{label:()=>I("menu.insert"),id:"insert",submenu:sy(t)},{type:"divider"},{label:()=>I("menu.mode"),id:"mode",visible:()=>t.isSelectionEditable&&t.model.selectionIsCollapsed,submenu:[{label:()=>I("menu.mode-math"),id:"mode-math",onMenuSelect:()=>{Xe(t,"accept-all"),t.executeCommand(["switchMode","math"])},checked:()=>t.model.mode==="math"},{label:()=>I("menu.mode-text"),id:"mode-text",onMenuSelect:()=>{Xe(t,"accept-all"),t.executeCommand(["switchMode","text"])},checked:()=>t.model.mode==="text"},{label:()=>I("menu.mode-latex"),id:"mode-latex",onMenuSelect:()=>t.executeCommand(["switchMode","latex"]),checked:()=>t.model.mode==="latex"}]},{type:"divider"},{label:()=>I("menu.font-style"),id:"variant",visible:()=>t.isSelectionEditable,submenu:Qb(t),submenuClass:"variant-submenu"},{label:()=>I("menu.color"),id:"color",visible:()=>t.isSelectionEditable,submenu:iy(t),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>I("menu.background-color"),id:"background-color",visible:()=>t.isSelectionEditable,submenu:ry(t),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>I("menu.accent"),id:"accent",visible:()=>t.isSelectionEditable,submenu:ey(t),submenuClass:"variant-submenu"},{label:()=>I("menu.decoration"),id:"decoration",visible:()=>t.isSelectionEditable&&oe(t).length>0,submenu:ty(t),submenuClass:"variant-submenu"},{type:"divider"},{label:()=>I("menu.evaluate"),id:"ce-evaluate",visible:()=>t.isSelectionEditable&&globalThis.MathfieldElement.computeEngine!==null,onMenuSelect:()=>{let e=ay(t);if(!e){t.model.announce("plonk");return}t.model.selectionIsCollapsed?(t.model.position=t.model.lastOffset,t.insert(`=${e}`,{insertionMode:"insertAfter",selectionMode:"item"})):t.insert(e,{insertionMode:"replaceSelection",selectionMode:"item"})}},{label:()=>I("menu.simplify"),id:"ce-simplify",visible:()=>t.isSelectionEditable&&globalThis.MathfieldElement.computeEngine!==null,onMenuSelect:()=>{var e,r;if(t.model.selectionIsCollapsed){let i=(e=t.expression)==null?void 0:e.simplify();if(t.model.position=t.model.lastOffset,!i){t.model.announce("plonk");return}t.insert(`=${i.latex}`,{insertionMode:"insertAfter",selectionMode:"item"})}else{let i=(r=globalThis.MathfieldElement.computeEngine)==null?void 0:r.parse(t.getValue(t.model.selection)).simplify();if(!i){t.model.announce("plonk");return}t.insert(i.latex,{insertionMode:"replaceSelection",selectionMode:"item"})}}},{label:()=>{var i;let e=globalThis.MathfieldElement.computeEngine;if(e===null)return"";let r=(i=t.expression)==null?void 0:i.unknowns[0];if(r){let n=e.box(r).latex;return I("menu.solve-for",he(n))}return I("menu.solve")},id:"ce-solve",visible:()=>{var e;return t.isSelectionEditable&&globalThis.MathfieldElement.computeEngine!==null&&((e=t.expression)==null?void 0:e.unknowns.length)===1&&t.expression.unknowns[0]!=="Nothing"},onMenuSelect:()=>{var n;let e=t.expression,r=e==null?void 0:e.unknowns[0],i=(n=e.solve(r))==null?void 0:n.map(o=>{var a;return(a=o.simplify().latex)!=null?a:""});if(!i){t.model.announce("plonk");return}t.insert(`${r}=${i.length===1?i[0]:"\\left\\lbrace"+(i==null?void 0:i.join(", "))+"\\right\\rbrace"}`,{insertionMode:"replaceAll",selectionMode:"item"})}},{type:"divider"},{label:()=>I("menu.cut"),id:"cut",onMenuSelect:()=>t.executeCommand("cutToClipboard"),visible:()=>!t.options.readOnly&&t.isSelectionEditable,keyboardShortcut:"meta+X"},{label:()=>I("menu.copy"),id:"copy",submenu:[{label:()=>I("menu.copy-as-latex"),id:"copy-latex",onMenuSelect:()=>q.copyToClipboard(t,"latex"),keyboardShortcut:"meta+C"},{label:()=>I("menu.copy-as-typst"),id:"copy-latex",onMenuSelect:()=>q.copyToClipboard(t,"typst")},{label:()=>I("menu.copy-as-ascii-math"),id:"copy-ascii-math",onMenuSelect:()=>q.copyToClipboard(t,"ascii-math")},{label:()=>I("menu.copy-as-mathml"),id:"copy-math-ml",onMenuSelect:()=>q.copyToClipboard(t,"math-ml")}]},{label:()=>I("menu.paste"),id:"paste",onMenuSelect:()=>t.executeCommand("pasteFromClipboard"),visible:()=>t.hasEditableContent,keyboardShortcut:"meta+V"},{label:()=>I("menu.select-all"),id:"select-all",keyboardShortcut:"meta+A",onMenuSelect:()=>t.executeCommand("selectAll")}]}function Li(t){var r,i;let e=(i=(r=t.model.parentEnvironment)==null?void 0:r.environmentName)!=null?i:"";return["array","matrix","pmatrix","bmatrix","vmatrix","Bmatrix","cases","dcases","rcases"].includes(e)}function oy(t){let e=t.model.at(t.model.position);if(e.type!=="array")return!1;let r=e.environmentName;return["matrix","pmatrix","bmatrix","vmatrix","Bmatrix"].includes(r)}function Xc(t){var r;let e=(r=t.model.parentEnvironment)==null?void 0:r.rows;return e?[e.length,e.reduce((i,n)=>Math.max(i,n.length),0)]:[0,0]}function Wr(t){let e=t.model.parentEnvironment;return e?[e.minRows,e.minColumns]:[0,0]}function Tn(t){let e=t.model.parentEnvironment;return e?[e.maxRows,e.maxColumns]:[0,0]}function Po(t,e){gi(t),t.flushInlineShortcutBuffer(),Lc(t.model,e),Y(t)}function ay(t){var i,n;let e;if(t.model.selectionIsCollapsed?e=(i=globalThis.MathfieldElement.computeEngine)==null?void 0:i.parse(t.getValue(),{canonical:!1}):e=(n=globalThis.MathfieldElement.computeEngine)==null?void 0:n.parse(t.getValue(t.model.selection),{canonical:!1}),!e)return"";let r=e.evaluate();return r.isSame(e)&&(r=e.N()),r.latex}function Zc(t,e,r,i){return{id:`variant-${e}`,label:()=>{var o;return oe(t).length<12?he(`\\${r}{${oe(t)}}`):(o=I(i))!=null?o:i},class:"ML__xl",tooltip:()=>{var n;return(n=I(i))!=null?n:i},visible:()=>Yb(t,e),checked:()=>{var n;return(n={some:"mixed",all:!0}[t.queryStyle({variant:e})])!=null?n:!1},onMenuSelect:()=>t.applyStyle({variant:e},{operation:"toggle"})}}function Yc(t,e,r,i){return{id:`variant-style-${e}`,label:()=>{var o;let n=oe(t);return n.length>0&&n.length<12?he(`\\${r}{${oe(t)}}`):(o=I(i))!=null?o:i},class:()=>{let n=oe(t);return n.length>0&&n.length<12?"ML__xl":""},tooltip:()=>{var n;return(n=I(i))!=null?n:i},visible:!0,checked:()=>{var n;return(n={some:"mixed",all:!0}[t.queryStyle({variantStyle:e})])!=null?n:!1},onMenuSelect:()=>t.applyStyle({variantStyle:e},{operation:"toggle"})}}function sy(t){return[{label:()=>Ze("abs"),id:"insert-abs",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("|#?|")},{label:()=>Ze("nth-root"),id:"insert-nth-root",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\sqrt[#?]{#?}")},{label:()=>Ze("log-base"),id:"insert-log-base",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\log_{#?}{#?}")},{type:"heading",label:()=>I("menu.insert.heading-calculus")},{label:()=>Ze("derivative"),id:"insert-derivative",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\dfrac{\\mathrm{d}}{\\mathrm{d}x}#?\\bigm|_{x=#?}")},{label:()=>Ze("nth-derivative"),id:"insert-nth-derivative",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\dfrac{\\mathrm{d}^#?}{\\mathrm{d}x^#?}#?\\bigm|_{x=#?}")},{label:()=>Ze("integral"),id:"insert-integral",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\int_#?^#?#?\\,\\mathrm{d}#?")},{label:()=>Ze("sum"),id:"insert-sum",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\sum_#?^#?#?")},{label:()=>Ze("product"),id:"insert-product",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\prod_#?^#?#?")},{type:"heading",label:()=>I("menu.insert.heading-complex-numbers")},{label:()=>Ze("modulus"),id:"insert-modulus",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\lvert#?\\rvert")},{label:()=>Ze("argument"),id:"insert-argument",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\arg(#?)")},{label:()=>Ze("real-part"),id:"insert-real-part",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\Re(#?)")},{label:()=>Ze("imaginary-part"),id:"insert-imaginary-part",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\Im(#?)")},{label:()=>Ze("conjugate"),id:"insert-conjugate",visible:()=>t.isSelectionEditable,onMenuSelect:()=>t.insert("\\overline{#?}")}]}function Ze(t){return` ${he(I(`menu.insert.${t}-template`))}${I(`menu.insert.${t}`)}`}var Fe={"\\ne":"!=","\\neq":"!=","\u2212":"-","-":"-","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\delta":"delta","\\epsilon":"epsilon.alt","\\varepsilon":"epsilon","\\zeta":"zeta","\\eta":"eta","\\theta":"theta.alt","\\vartheta":"theta","\\iota":"iota","\\kappa":"kappa","\\lambda":"lambda","\\mu":"mu","\\nu":"nu","\\xi":"xi","\\pi":"pi","\\rho":"rho","\\sigma":"sigma","\\tau":"tau","\\upsilon":"upsilon","\\phi":"phi.alt","\\varphi":"phi","\\chi":"chi","\\psi":"psi","\\omega":"omega","\\Gamma":"Gamma","\\Delta":"Delta","\\Theta":"Theta","\\Lambda":"Lambda","\\Xi":"Xi","\\Pi":"Pi","\\Sigma":"Sigma","\\Phi":"Phi","\\Psi":"Psi","\\Omega":"Omega","\\exponentialE":"e","\\imaginaryI":"i","\\imaginaryJ":"j","\\!":" #h(-1em/6) ","\\,":" thin ","\\:":" med ","\\>":" med ","\\;":" thick ","\\enskip":"space.en","\\enspace":"space.en","\\qquad":"space.quad space.quad","\\quad":"space.quad","\\infty":"infinity","\\R":"RR","\\mathbb{R}":"RR","\\N":"NN","\\mathbb{N}":"NN","\\Z":"ZZ","\\mathbb{Z}":"ZZ","\\Q":"QQ","\\mathbb{Q}":"QQ","\\C":"CC","\\mathbb{C}":"CC","\\emptyset":"emptyset","\\varnothing":"nothing","\\varDelta":"Delta","\\varTheta":"Theta","\\varLambda":"Lambda","\\varXi":"Xi","\\varPi":"Pi","\\varSigma":"Sigma","\\varUpsilon":"Upsilon","\\varPhi":"Phi","\\varPsi":"Psi","\\varOmega":"Omega","\\vert":" | ","\\Vert":" || ","\\mid":" divides ","\\lbrack":" bracket.l ","\\rbrack":" bracket.r ","\\lbrace":" brace.l ","\\rbrace":" brace.r ","\\lparen":" paren.l ","\\rparen":" paren.r ","\\langle":" angle.l ","\\rangle":" angle.r ","\\differentialD":" dif ","\\diamond":" diamond.stroked.small ","\\square":" square.stroked.small ","\\lceil":" ceil.l ","\\rceil":" ceil.r ","\\lfloor":" floor.l ","\\rfloor":" floor.r ","\\aleph":" aleph ","\\bet":" bet ","\\gimel":" gimel ","\\dalet":" dalet ","\\mod":" mod ","\\equiv":" equiv ","\\subset":" subset ","\\supset":" supset ","\\subseteq":" subset.eq ","\\supseteq":" supset.eq ","\\subsetneq":" subset.neq ","\\supsetneq":" supset.neq ","\\supsetneqq":" supset.neq ","\\nsubset":" subset.not ","\\nsupset":" supset.not ","\\nsubseteq":" subset.eq.not ","\\nsupseteq":" supset.eq.not ","\\approx":" approx ","\\uparrow":" arrow.t ","\\downarrow":" arrow.b ","\\rightarrow":" arrow.r ","\\leftarrow":" arrow.l ","\\longmapsto":" mapsto.long ","\\longmapsfrom":" arrow.l.bar.long ","/":"\\/","&":"&"},Lh={"[":" bracket.l ","]":" bracket.r ","{":" brace.l ","}":" brace.r ","(":" paren.l ",")":" paren.r ","<":" angle.l ",">":" angle.r ",".":""},Ah={" bracket.l ":"["," bracket.r ":"]"," brace.l ":"{"," brace.r ":"}"," paren.l ":"("," paren.r ":")"," angle.l ":" angle.l "," angle.r ":" angle.r "},Ro={"\\pm":"plus.minus","\\colon":" : ","\\sum":" sum ","\\prod":" product ","\\bigcap":" inter.big ","\\bigcup":" union.big ","\\int":" integral ","\\iint":" integral.double ","\\iiint":" integral.triple ","\\intop":" integral ","\\oint":" integral.cont ","\\oiint":" integral.surf ","\\oiiint":" integral.vol ","\\setminus":" without ","\\vdots":" without ","\\ddots":" dots.down ","\\ge":">=","\\le":"<=","\\ne":"!=","\\neq":"!=","\\lt":"<","\\gt":">","\\gets":"<-","\\to":"->","\\land":" and ","\\lor":" or ","\\lnot":" not ","\\forall":" forall ","\\exists":" exists ","\\in":" in ","\\notin":" in.not ","\\mapsto":"|->","\\implies":"==>","\\iff":"<==>","\\cdot":" dot.op ","\\ast":" * ","\\star":" star.op ","\\times":" times ","\\div":" div ","\\ltimes":" times.l ","\\rtimes":" times.r ","\\bowtie":" \u22C8 ","\\circ":" circle.stroked.small "},ly={underarc:"underparen",underparen:"underparen",underbrace:"underbrace",underline:"underline",overarc:"overparen",overparen:"overparen",overbrace:"overbrace",overline:"overline",cancel:"cancel",displaystyle:"display",textstyle:"inline"},cy={longrightarrow:t=>`arrow.r.long^(${ae(t.above)})`,longleftarrow:t=>`arrow.l.long^(${ae(t.above)})`};function uy(t){let e="";for(let r of t){let i=e[e.length-1];i!==void 0&&(/\d$/.test(i)&&/^\d/.test(r)||/[a-zA-Z]$/.test(i)&&/^[a-zA-Z]/.test(r))&&(e+=" "),e+=r}return e}function ae(t){var o,a,s,l,c,u,m,d,h,f,x,_,b,v,k,A,C,T,S,B,$,G,R;if(!t)return"";if(ee(t)){if(t.length===0)return"";if(t[0].mode==="latex")return t.map(D=>ae(D)).join("");if(t[0].mode==="text"){let D=0,H="";for(;((o=t[D])==null?void 0:o.mode)==="text";)H+=t[D].body?ae(t[D].body):t[D].value,D++;return` "${H}" ${ae(t.slice(D))}`}let N=0,j=[];for(;((a=t[N])==null?void 0:a.mode)==="math";){let D="";for(;((s=t[N])==null?void 0:s.type)==="mord"&&/\d/.test(t[N].value);)D+=t[N++].value;D?j.push(D):j.push(ae(t[N++]))}return j.push(ae(t.slice(N))),uy(j)}if(t.mode==="text")return`"${t.value}"`;let e="",{command:r}=t,i;if(r==="\\placeholder")return`"${ae(t.body)}"`;let n=y.serialize([t],{expandMacro:!0,defaultMode:"math"});switch(t.type){case"accent":let N={"\\vec":"arrow","\\dot":"dot","\\ddot":"dot.double","\\bar":"overline","\\hat":"hat","\\acute":"acute","\\grave":"grave","\\tilde":"tilde","\\breve":"breve","\\check":"caron"}[r];e=`${N!=null?N:""}(${ae(t.body)}) `;break;case"first":return"";case"latexgroup":return t.body.map(D=>D.value).join("");case"group":case"root":e=(l=Fe[r])!=null?l:ae(t.body);break;case"genfrac":{let D=t;D.hasBarLine?(e+="(",e+=ae(D.above),e+=")/(",e+=ae(D.below),e+=")"):e+=`binom(${ae(D.above)}, ${ae(D.below)})`}break;case"surd":t.hasEmptyBranch("above")?e+=`sqrt(${ae(t.body)})`:e+=`root(${ae(t.above)}, ${ae(t.body)})`;break;case"latex":e=t.value;break;case"leftright":{let D=t,H=D.leftDelim;H&&Fe[H]&&(H=Fe[H]);let ie=D.matchingRightDelim();ie&&Fe[ie]&&(ie=Fe[ie]),H&&(H=(c=Lh[H])!=null?c:H),ie&&(ie=(u=Lh[ie])!=null?u:ie),H&&ie?e=`lr(${(m=Ah[H])!=null?m:H}${ae(D.body)}${(d=Ah[ie])!=null?d:ie})`:e=`lr(${H}${ae(D.body)}${ie})`}break;case"sizeddelim":case"delim":e=t.value;break;case"overlap":break;case"mord":if(Fe[n])return Fe[n];e=(x=(f=(h=Fe[r])!=null?h:r)!=null?f:r)!=null?x:typeof t.value=="string"?t.value:"",e.startsWith("\\")&&(e+=" "),i=r?r.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null,i?e=String.fromCodePoint(Number.parseInt("0x"+i[1])):e.length>0&&e.startsWith("\\")&&(e=typeof t.value=="string"?t.value.charAt(0):t.command),e=dy(e,t.style),e=` ${e} `;break;case"mbin":case"mrel":case"minner":e=(v=(b=(_=Fe[n])!=null?_:Fe[r])!=null?b:Ro[r])!=null?v:t.value;break;case"mopen":case"mclose":e=(k=Fe[n])!=null?k:t.value;break;case"mpunct":e=(A=Ro[r])!=null?A:r;break;case"mop":case"operator":case"extensible-symbol":t.value!=="\u200B"&&(Ro[r]?e=Ro[r]:e=r==="\\operatorname"?ae(t.body):(C=t.value)!=null?C:r,e+=" ");break;case"array":let j=t.environmentName;if(t.isMultiline)e=t.rows.map(H=>H.map(ie=>ae(ie)).join("")).join(` `);else{let D=t.rows,H=D.map(X=>X.map(ae).join(", ")),ie={pmatrix:'"("',bmatrix:'"["',"bmatrix*":'"["',Bmatrix:'"{"',vmatrix:'"|"',matrix:"#none"}[j];ie?e=`mat(delim: ${ie}, ${H.join(" ; ")})`:j==="cases"||j==="rcases"?e=`cases(reverse: #${j==="rcases"}, ${H.join(", ")})`:j==="aligned"?e=D.map(X=>X.map(ae).join(" & ")).join(" \\ "):e=D.map(X=>X.map(ae).join("")).join("")}break;case"box":break;case"spacing":e=(S=(T=Fe[n])!=null?T:Fe[r])!=null?S:" ";break;case"space":e=" ";break;case"subsup":e=(B=t.leftSibling)!=null&&B.value?"":'""';break;case"macro":e=(R=(G=($=Fe[n])!=null?$:Fe[r])!=null?G:Ro[r])!=null?R:ae(t.body);break;case"overunder":break}if(!e){let N=ly[t.command.slice(1)];N&&(e=`${N}(${ae(t.body)})`)}if(!e){let N=cy[t.command.slice(1)];N&&(e=N(t))}if(!t.hasEmptyBranch("subscript")){e+="_";let N=ae(t.subscript);e+=N.length!==1?`(${N})`:N}if(!t.hasEmptyBranch("superscript")){e+="^";let N=ae(t.superscript);e+=N.length!==1?`(${N})`:N}return e}function dy(t,e){if(!e)return t;let r=t;return e.variant==="double-struck"&&(r=`bb(${r})`),e.variant==="script"&&(r=`cal(${r})`),e.variant==="fraktur"&&(r=`frak(${r})`),e.variant==="sans-serif"&&(r=`sans(${r})`),e.variant==="monospace"&&(r=`mono(${r})`),e.variantStyle==="bold"&&(r=`bold(${r})`),r}function Ur(t,e){return typeof t=="string"?t+kt(e):kt(t)}function eu(t){var r;let e;if(t.parent.type==="prompt")t.parentBranch==="body"&&(e="prompt");else if(t.parentBranch==="body"){if(t.type==="first"&&(t.parent.type==="root"?e="mathfield":t.parent.type==="surd"?e="radicand":t.parent.type==="genfrac"?e="fraction":t.parent.type==="sizeddelim"&&(e="delimiter"),e))return e;t.type==="subsup"?t.superscript&&t.subscript?e="superscript and subscript":t.superscript?e="superscript":t.subscript&&(e="subscript"):t.type&&(e=(r={accent:"accented",array:"array",box:"box",chem:"chemical formula",delim:"delimiter",enclose:"cross out","extensible-symbol":"extensible symbol",error:"error",first:"first",genfrac:"fraction",group:"group",latex:"LaTeX",leftright:"delimiter",line:"line",subsup:"subscript-superscript",operator:"operator",overunder:"over-under",placeholder:"placeholder",rule:"rule",sizeddelim:"delimiter",space:"space",spacing:"spacing",surd:"square root",text:"text",prompt:"prompt",root:"math field",mop:"operator"}[t.type])!=null?r:"parent")}else if(t.parent.type==="genfrac"){if(t.parentBranch==="above")return"numerator";if(t.parentBranch==="below")return"denominator"}else t.parent.type==="surd"?t.parentBranch==="above"&&(e="index"):t.parentBranch==="superscript"?e="superscript":t.parentBranch==="subscript"&&(e="subscript");return e!=null?e:"parent"}function Ch(t,e,r,i){let n="";if(e==="plonk"){globalThis.MathfieldElement.playSound("plonk"),t.flushInlineShortcutBuffer();return}if(e==="delete")n=Ur("deleted: ",i);else if(e==="focus"||e.includes("move"))n=my(t.model,r),n+=py(t.model);else if(e==="replacement")n=Ur(t.model.at(t.model.position));else if(e==="line"){let o=Ur(t.model.root);t.keyboardDelegate.setAriaLabel(o)}else n=i?Ur(e+" ",i):e;if(n&&t.ariaLiveText){let o=t.ariaLiveText.textContent.includes("\xA0")?" \u202F ":" \xA0 ";t.ariaLiveText.textContent=n+o}}function my(t,e){if(Number.isNaN(e))return"";let r=t.at(e);if(!r||r.treeDepth<=t.at(t.position).treeDepth)return"";let i="",n=r.parent,o=t.at(t.position).parent;for(;n!==t.root&&n!==o;)i+=`out of ${eu(n)};`,n=n.parent;return i}function py(t){if(!t.selectionIsCollapsed)return`selected: ${Ur(t.getAtoms(t.selection))}`;let e="",r=t.at(t.position);if(r.isFirstSibling&&(e=`start of ${eu(r)}: `),r.isLastSibling){if(!r.isFirstSibling){if(!r.parent.parent)return`${Ur(r)}; end of mathfield`;e=`${Ur(r)}; end of ${eu(r)}`}}else e+=Ur(r);return e}var Hs=class{constructor(e,r,i){this.mathfield=e,this.mode=r,this.silenceNotifications=!1,this._selection={ranges:[[0,0]],direction:"none"},this._anchor=0,this._position=0,this.root=i}dispose(){this.mathfield=void 0}getState(){let e={ranges:[...this._selection.ranges]};return this.selection.direction&&this.selection.direction!=="none"&&(e.direction=this.selection.direction),{content:this.root.toJson(),selection:e,mode:this.mode}}setState(e,r){var o;let i=this.silenceNotifications;this.silenceNotifications=(o=r==null?void 0:r.silenceNotifications)!=null?o:!0;let n={};if((r==null?void 0:r.type)==="undo"&&(n={inputType:"historyUndo"}),(r==null?void 0:r.type)==="redo"&&(n={inputType:"historyRedo"}),this.contentWillChange(n)){let a=this.silenceNotifications;this.silenceNotifications=!0,this.mode=e.mode,this.root=yt(e.content),this.selection=e.selection,this.silenceNotifications=a,this.contentDidChange(n),this.selectionDidChange()}this.silenceNotifications=i}get atoms(){return this.root.children}get selection(){return this._selection}set selection(e){this.setSelection(e)}setSelection(e,r){return!this.mathfield.contentEditable&&this.mathfield.userSelect==="none"?!1:this.deferNotifications({selection:!0,content:!0},()=>{var c,u,m,d;let i=this.normalizeSelection(e,r);if(i===void 0)throw new TypeError("Invalid selection");if(i.ranges.length===1&&i.ranges[0][0]===i.ranges[0][1]){let h=i.ranges[0][0];if(!this.mathfield.dirty&&!((c=this.at(h))!=null&&c.parentPrompt)&&this.mathfield.hasEditablePrompts){if((u=this.at(h-1))!=null&&u.parentPrompt){this._anchor=this.normalizeOffset(h-1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}if((m=this.at(h+1))!=null&&m.parentPrompt){this._anchor=this.normalizeOffset(h+1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}this._anchor=0,this._position=0,this._selection={ranges:[[0,0]]};return}this._anchor=h,this._position=h,this._selection=i;return}let n=de(i);n=hy(this,n),i.direction==="backward"?[this._position,this._anchor]=n:[this._anchor,this._position]=n;let o=n[0]+1;for(;o<=this.lastOffset&&((d=this.at(o))==null?void 0:d.type)==="first"&&o=0&&this._position<=this.lastOffset})}setPositionHandlingPlaceholder(e){var i;let r=this.at(e);(r==null?void 0:r.type)==="placeholder"?this.setSelection(e-1,e):((i=r==null?void 0:r.rightSibling)==null?void 0:i.type)==="placeholder"?this.setSelection(e,e+1):this.position=e,r instanceof pe&&r.isSuggestion&&(r.isSuggestion=!1),this.mathfield.stopCoalescingUndo()}get position(){return this._position}set position(e){this.setSelection(e,e)}get anchor(){return this._anchor}get selectionIsCollapsed(){return this._anchor===this._position}get selectionIsPlaceholder(){return Math.abs(this._anchor-this._position)===1?this.at(Math.max(this._anchor,this._position)).type==="placeholder":!1}collapseSelection(e="forward"){return this._anchor===this._position?!1:(e==="backward"?this.position=Math.min(this._anchor,this._position):this.position=Math.max(this._anchor,this._position),!0)}get lastOffset(){return this.atoms.length-1}at(e){return this.atoms[e]}offsetOf(e){return this.atoms.indexOf(e)}getSiblingsRange(e){let r=this.at(e),{parent:i}=r;if(!i)return[0,this.lastOffset];let n=r.parent.branch(r.parentBranch);return[this.offsetOf(n[0]),this.offsetOf(n[n.length-1])]}getBranchRange(e,r){let i=this.at(e).branch(r);return[this.offsetOf(i[0]),this.offsetOf(i[i.length-1])]}getCellRange(e){var n,o;let r=this.getParentCell(e),i=this.at(e);if(i){for(;i&&((n=i.parent)==null?void 0:n.type)!=="array";)i=i.parent;if(((o=i==null?void 0:i.parent)==null?void 0:o.type)==="array")return[this.offsetOf(i.firstSibling),this.offsetOf(i.lastSibling)]}}getAtoms(e,r,i){let n=i!=null?i:{};if(Xi(e)){if(n=r!=null?r:{},e.ranges.length>1)return e.ranges.reduce((d,h)=>[...d,...this.getAtoms(h,n)],[]);e=e.ranges[0]}let o,a;if(It(e)){if(o=e,!It(r))return[];a=r}else[o,a]=e,Object.keys(n).length===0&&(n=r!=null?r:{});if(!Number.isFinite(o))return[];n.includeChildren===void 0&&(n.includeChildren=!1),o<0&&(o=this.lastOffset-o+1),a<0&&(a=this.lastOffset+a+1);let s=Math.min(o,a),l=Math.max(o,a),c=s===0?0:s+1,u=l;if(!n.includeChildren&&c===1&&u===this.lastOffset)return[this.root];let m=[];for(let d=c;d<=u;d++){let h=this.atoms[d];Eh(this,h,c,u,n.includeFirstAtoms)&&m.push(h)}return n.includeChildren||(m=m.filter(d=>{let h=!1,{parent:f}=d;for(;f&&!h;)h=Eh(this,f,c,u,n.includeFirstAtoms),f=f.parent;return!h})),m}findAtom(e,r=0,i="forward"){let n,o=this.lastOffset;if(i==="forward"){for(let a=r;a<=o;a++)if(n=this.atoms[a],e(n))return n;for(let a=0;a=0;a--)if(n=this.atoms[a],e(n))return n;for(let a=o;a>r;a--)if(n=this.atoms[a],e(n))return n}extractAtoms(e){var i;let r=this.getAtoms(e);r.length===1&&!r[0].parent&&r[0].isRoot&&(r[0]instanceof z?r=r[0].rows.flatMap(n=>n.flatMap(o=>o)):r=[...(i=r[0].body)!=null?i:r[0].children],r=r.filter(n=>n.type!=="first"));for(let n of r)n.parent.removeChild(n);return r}deleteAtoms(e){if(e!=null||(e=[0,-1]),this.extractAtoms(e),e[0]===0&&e[1]===-1&&this.root instanceof z)for(;this.root.rowCount>1;)this.root.removeRow(1);this.position=e[0]}atomToString(e,r){let i=r!=null?r:"latex";if(i.startsWith("latex"))return y.serialize([e],{expandMacro:i==="latex-expanded",skipStyles:i==="latex-unstyled",skipPlaceholders:i==="latex-without-placeholders",defaultMode:this.mathfield.options.defaultMode});if(i==="math-ml")return U(e);if(i==="spoken")return kt(e);if(i==="spoken-text"){let n=globalThis.MathfieldElement.textToSpeechMarkup;globalThis.MathfieldElement.textToSpeechMarkup="";let o=kt(e);return globalThis.MathfieldElement.textToSpeechMarkup=n,o}if(i==="spoken-ssml"||i==="spoken-ssml-with-highlighting"){let n=globalThis.MathfieldElement.textToSpeechMarkup;globalThis.MathfieldElement.textToSpeechMarkup="ssml";let o=kt(e);return globalThis.MathfieldElement.textToSpeechMarkup=n,o}return i==="typst"?ae(e):i==="plain-text"?ce(e,{plain:!0}):i==="ascii-math"?ce(e):(console.error(`MathLive 0.109.0: Unexpected format "${i}`),"")}getValue(e,r,i){if(e===void 0)return this.atomToString(this.root,"latex");if(typeof e=="string"&&e!=="math-json")return this.atomToString(this.root,e);let n,o;if(It(e)&&It(r)?(n=[this.normalizeRange([e,r])],o=i):si(e)?(n=[this.normalizeRange(e)],o=r):Xi(e)?(n=e.ranges,o=r):(n=[this.normalizeRange([0,-1])],o=e),o!=null||(o="latex"),o==="math-json"){if(!globalThis.MathfieldElement.computeEngine)return window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`The CortexJS Compute Engine library is not available. Load the library, for example with: import "https://esm.run/@cortex-js/compute-engine"`),'["Error", "compute-engine-not-available"]';let a=this.getValue({ranges:n},"latex-unstyled");try{let s=globalThis.MathfieldElement.computeEngine.parse(a);return JSON.stringify(s.json)}catch(s){return JSON.stringify(["Error",`'${s.toString()}'`])}}if(o.startsWith("latex")){let a={expandMacro:o==="latex-expanded",skipStyles:o==="latex-unstyled",skipPlaceholders:o==="latex-without-placeholders",defaultMode:this.mathfield.options.defaultMode};return P(n.map(s=>y.serialize(this.getAtoms(s),a)))}return n.map(a=>this.getAtoms(a).map(s=>this.atomToString(s,o)).join("")).join("")}extendSelectionTo(e,r){return!this.mathfield.contentEditable&&this.mathfield.userSelect==="none"?!1:this.deferNotifications({selection:!0},()=>{let i=this.normalizeRange([e,r]),[n,o]=i,a=new Set(["genfrac","subsup","accent","box","overlap","overunder"]),{parent:s}=this.at(o);if(s!=null&&s.type&&a.has(s.type))for(;s!=null&&s.type&&a.has(s.type)&&qs(this,s,[n,o]);)o=this.offsetOf(s),s=s.parent;for(s=this.at(n).parent;s!=null&&s.type&&a.has(s.type)&&qs(this,s,[n,o]);)n=this.offsetOf(s.leftSibling),s=s.parent;if(s=this.at(o).parent,s!=null&&s.type&&a.has(s.type))for(;s!=null&&s.type&&a.has(s.type)&&qs(this,s,[n,o]);)o=this.offsetOf(s),o>=0,s=s.parent;this._position=this.normalizeOffset(r),this._selection={ranges:[[n,o]],direction:"none"}})}announce(e,r,i=[]){var o,a;((a=(o=this.mathfield.host)==null?void 0:o.dispatchEvent(new CustomEvent("announce",{detail:{command:e,previousPosition:r,atoms:i},cancelable:!0,bubbles:!0,composed:!0})))!=null?a:!0)&&Ch(this.mathfield,e,r,i)}deferNotifications(e,r){let i=this._selection,n=this._anchor,o=this._position,a=this.silenceNotifications;this.silenceNotifications=!0;let s=this.root.changeCounter;r(),this.silenceNotifications=a;let l=n!==this._anchor||o!==this._position||I0(this._selection,i)==="different";e.selection&&l&&this.selectionDidChange();let c=this.root.changeCounter!==s;return e.content&&c&&this.contentDidChange({inputType:e.type}),c||l}normalizeOffset(e){return e>0?e=Math.min(e,this.lastOffset):e<0&&(e=this.lastOffset+e+1),e}normalizeRange(e){let[r,i]=e;return r=this.normalizeOffset(r),i=this.normalizeOffset(i),rthis.normalizeRange(o)),direction:(n=e.direction)!=null?n:"none"});return i}get parentEnvironment(){let e=this.at(this.position).parent;if(e){for(;e.parent&&e.type!=="array";)e=e.parent;if(e.type==="array")return e}}get parentCell(){return this.getParentCell(this.position)}getParentCell(e){var i,n;let r=this.at(e);if(r){for(;r&&((i=r.parent)==null?void 0:i.type)!=="array";)r=r.parent;if(((n=r==null?void 0:r.parent)==null?void 0:n.type)==="array")return r.parentBranch}}contentWillChange(e={}){if(this.silenceNotifications||!this.mathfield)return!0;let r=this.silenceNotifications;this.silenceNotifications=!0;let i=this.mathfield.onContentWillChange(e);return this.silenceNotifications=r,i}contentDidChange(e){var i;if(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(jt(this.mathfield)),this.silenceNotifications||!((i=this.mathfield)!=null&&i.host))return;let r=this.silenceNotifications;this.silenceNotifications=!0,setTimeout(()=>{var n;!this.mathfield||!it(this.mathfield)||!this.mathfield.host||this.mathfield.host.dispatchEvent(new InputEvent("input",g(p({},e),{data:e.data?e.data:(n=e.inputType)!=null?n:"",bubbles:!0,composed:!0})))},0),this.silenceNotifications=r}selectionDidChange(){if(!this.mathfield)return;let e=this.silenceNotifications;e||(this.silenceNotifications=!0,this.mathfield.onSelectionDidChange()),this.silenceNotifications=e}};function Eh(t,e,r,i,n){let o=t.offsetOf(e);if(oi)return!1;if(!e.hasChildren)return!0;let a=n?e.firstChild:Th(e);if(!a)return!1;let s=n?e.lastChild:Dh(e);if(!s)return!1;let l=t.offsetOf(a);if(l>=r&&l<=i){let c=t.offsetOf(s);if(c>=r&&c<=i)return!0}return!1}function qs(t,e,r){if(!(e!=null&&e.hasChildren))return!1;let[i,n]=r,o=Th(e);if(!o)return!1;let a=Dh(e);if(!a)return!1;let s=t.offsetOf(o),l=t.offsetOf(a);return s>=i&&s<=n&&l>=s&&l<=n}function hy(t,e){let[r,i]=e,n=i+1;if(n>t.lastOffset)return e;let o=t.at(n);return fy(t,o,r,i)&&(i=t.offsetOf(o)),[r,i]}function fy(t,e,r,i){if((e==null?void 0:e.type)!=="subsup"||!qs(t,e,[r,i]))return!1;let n=e.leftSibling;if(!n)return!1;let o=t.offsetOf(n);return o>r&&o<=i}function Th(t){for(let e of t.children)if(e.type!=="first")return e}function Dh(t){let{children:e}=t;for(let r=e.length-1;r>=0;r--)if(e[r].type!=="first")return e[r]}fe({deleteAll:t=>t.contentWillChange({inputType:"deleteContent"})&&st(t,[0,-1],"deleteContent"),deleteForward:t=>Vp(t),deleteBackward:t=>$p(t),deleteNextWord:t=>t.contentWillChange({inputType:"deleteWordForward"})&&Mt(t,"forward",{delete:!0}),deletePreviousWord:t=>t.contentWillChange({inputType:"deleteWordBackward"})&&Mt(t,"backward",{delete:!0}),deleteToGroupStart:t=>{if(!t.contentWillChange({inputType:"deleteSoftLineBackward"}))return!1;let e=t.offsetOf(t.at(t.position).firstSibling);return e===t.position?(t.announce("plonk"),!1):(t.deferNotifications({content:!0,selection:!0,type:"deleteSoftLineBackward"},()=>t.deleteAtoms([t.anchor,e])),t.position=e,!0)},deleteToGroupEnd:t=>{if(!t.contentWillChange({inputType:"deleteSoftLineForward"}))return!1;let e=t.offsetOf(t.at(t.position).lastSibling);return e===t.position?(t.announce("plonk"),!1):(t.deferNotifications({content:!0,selection:!0,type:"deleteSoftLineForward"},()=>t.deleteAtoms([t.anchor,e])),!0)},deleteToMathFieldStart:t=>t.contentWillChange({inputType:"deleteHardLineBackward"})&&st(t,[t.anchor,0],"deleteHardLineBackward"),deleteToMathFieldEnd:t=>t.contentWillChange({inputType:"deleteHardLineForward"})&&st(t,[t.anchor,-1],"deleteHardLineForward")},{target:"model",audioFeedback:"delete",canUndo:!0,changeContent:!0,changeSelection:!0});var gy=``,by=``,Ws=class t{constructor(e,r){this.focusBlurInProgress=!1;this.programmaticFocusInProgress=!1;this.connectedToVirtualKeyboard=!1;var d,h,f;this.options=p(g(p({},Mn()),{macros:Bi(),registers:ja()}),_n(r)),this.eventController=new AbortController;let i=this.eventController.signal;r.eventSink&&(this.host=r.eventSink),this.element=e,e.mathfield=this,this.blurred=!0,this.keystrokeCaptionVisible=!1,this.suggestionIndex=0,this.inlineShortcutBuffer=[],this.inlineShortcutBufferFlushTimer=0,this.scientificNotationTimer=0,this.defaultStyle={},this.styleBias="left",this.options.defaultMode==="inline-math"?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline"),this.dirty=!1;let n=(h=(d=r.value)!=null?d:this.element.textContent)!=null?h:"";n=n.trim();let o=wc(this.options),a=ge(n,{context:this.context}),s;a.length===1&&a[0].isRoot?s=a[0]:s=new y({type:"root",mode:o,body:a}),this.model=new Hs(this,o,s),this.undoManager=new ws(this.model);let l=[];if(l.push(""),l.push('"),l.push(""),l.push(""),l.push(""),this.element.innerHTML=globalThis.MathfieldElement.createHTML(l.join("")),!this.element.children){console.error("%cMathLive 0.109.0: Something went wrong and the mathfield could not be created.%c\nIf you are using Vue, this may be because you are using the runtime-only build of Vue. Make sure to include `runtimeCompiler: true` in your Vue configuration. There may a warning from Vue in the log above.","color:red;font-family:system-ui;font-size:1.2rem;font-weight:bold","color:inherit;font-family:system-ui;font-size:inherit;font-weight:inherit");return}this._l10Subscription=F.subscribe(()=>F.update(this.element)),F.update(this.element),this.container=this.element.querySelector("[part=container]"),this.field=this.container.querySelector("[part=content]"),this.field.addEventListener("click",x=>x.stopImmediatePropagation(),{capture:!1,signal:i}),this.field.addEventListener("wheel",this,{passive:!1,signal:i});let c=this.element;if("PointerEvent"in window?c.addEventListener("pointerdown",this,{signal:i}):c.addEventListener("mousedown",this,{signal:i}),this.host){let x=_=>{_.target===this.host&&this.handleEvent(_)};"PointerEvent"in window?this.host.addEventListener("pointerdown",x,{signal:i}):this.host.addEventListener("mousedown",x,{signal:i})}let u=this.element.querySelector("[part=virtual-keyboard-toggle]");u==null||u.addEventListener("pointerdown",x=>{x.currentTarget===u&&(window.mathVirtualKeyboard.visible?window.mathVirtualKeyboard.hide():(window.mathVirtualKeyboard.show({animate:!0}),window.mathVirtualKeyboard.update(jt(this)),setTimeout(()=>this.scrollIntoView(),300)),x.preventDefault(),x.stopPropagation(),this.hasFocus()||this.focus({preventScroll:!0}))},{signal:i}),this.field.addEventListener("contextmenu",this,{signal:i});let m=this.element.querySelector("[part=menu-toggle]");m==null||m.addEventListener("pointerdown",x=>{if(x.currentTarget!==m)return;let _=this.menu;if(_.state!=="closed")return;this.element.classList.add("tracking");let b=m.getBoundingClientRect();_.modifiers=Ht(x),_.show({target:m,location:{x:b.left,y:b.bottom},onDismiss:()=>this.element.classList.remove("tracking")}),x.preventDefault(),x.stopPropagation()},{signal:i}),(this.disabled||this.readOnly&&!this.hasEditableContent||this.userSelect==="none")&&(m.style.display="none"),this.ariaLiveText=(f=this.element.querySelector("[role=status]"))!=null?f:void 0,this.keyboardDelegate=vp(this.element.querySelector(".ML__keyboard-sink"),this.element,this),window.addEventListener("resize",this,{signal:i}),document.addEventListener("scroll",this,{signal:i}),this.resizeObserver=new ResizeObserver(x=>{if(this.resizeObserverStarted){this.resizeObserverStarted=!1;return}this.updateToggleLayout(),Y(this)}),this.resizeObserverStarted=!0,this.resizeObserver.observe(this.field),this.resizeObserver.observe(this.container),setTimeout(()=>this.updateToggleLayout(),100),window.mathVirtualKeyboard.addEventListener("virtual-keyboard-toggle",this,{signal:i}),Xt&&!F.locale.startsWith(Xt.locale)&&Uo(F.locale),Ie!=="ready"&&document.fonts.ready.then(()=>lo(this)),e.querySelector("[part=container]").style.removeProperty("visibility"),this.undoManager.startRecording(),this.undoManager.snapshot("set-value"),Y(this)}connectToVirtualKeyboard(){this.connectedToVirtualKeyboard||(this.connectedToVirtualKeyboard=!0,window.addEventListener("message",this,{signal:this.eventController.signal}),window.mathVirtualKeyboard.connect(),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(jt(this)),ko(this))}disconnectFromVirtualKeyboard(){this.connectedToVirtualKeyboard&&(window.removeEventListener("message",this),window.mathVirtualKeyboard.disconnect(),this.connectedToVirtualKeyboard=!1,Ks())}showMenu(e){var o,a;let r=(a=(o=e==null?void 0:e.location)!=null?o:Yi(this.field))!=null?a:void 0,i=e==null?void 0:e.modifiers,n=this.element.querySelector("[part=container]");return this._menu.show({target:n,location:r,modifiers:i})}get colorMap(){return e=>{var r,i,n;return(n=(i=(r=this.options).colorMap)==null?void 0:i.call(r,e))!=null?n:Xr(e)}}get backgroundColorMap(){return e=>{var r,i,n,o,a,s;return(s=(a=(i=(r=this.options).backgroundColorMap)==null?void 0:i.call(r,e))!=null?a:(o=(n=this.options).colorMap)==null?void 0:o.call(n,e))!=null?s:Ei(e)}}get smartFence(){var e;return(e=this.options.smartFence)!=null?e:!1}get readOnly(){var e;return(e=this.options.readOnly)!=null?e:!1}get disabled(){var e,r;return(r=(e=this.host)==null?void 0:e.disabled)!=null?r:!1}get contentEditable(){return this.host?this.host.getAttribute("contenteditable")!=="false":!1}get userSelect(){if(!this.host)return"";let e=getComputedStyle(this.host);return e.getPropertyValue("user-select")||e.getPropertyValue("-webkit-user-select")}get hasEditableContent(){return this.disabled||!this.contentEditable?!1:!this.readOnly||this.hasEditablePrompts}get hasEditablePrompts(){return this.readOnly&&!this.disabled&&this.contentEditable&&this.model.findAtom(e=>e.type==="prompt"&&!e.locked)!==void 0}get isSelectionEditable(){if(this.disabled||!this.contentEditable)return!1;if(!this.readOnly)return!0;let e=this.model.at(this.model.anchor),r=this.model.at(this.model.position),i=y.commonAncestor(e,r);return!!((i==null?void 0:i.type)==="prompt"||i!=null&&i.parentPrompt)}get letterShapeStyle(){var e;return(e=this.options.letterShapeStyle)!=null?e:"tex"}get minFontScale(){return this.options.minFontScale}get maxMatrixCols(){return this.options.maxMatrixCols}queryStyle(e){let r=ms(this,e);"verbatimColor"in r&&delete r.verbatimColor,"verbatimBackgroundColor"in r&&delete r.verbatimBackgroundColor;let i=Object.keys(r).length;if(i===0)return"all";if(i>1){for(let c of Object.keys(r)){let u=this.queryStyle({[c]:r[c]});if(u==="none")return"none";if(u==="some")return"some"}return"all"}let n=Object.keys(r)[0],o=r[n];if(this.model.selectionIsCollapsed)return Wt(this)[n]===o?"all":"none";let a=this.model.getAtoms(this.model.selection,{includeChildren:!0}),s=a.length;if(s===0)return"none";let l=0;for(let c of a){if(c.type==="first"){s-=1;continue}c.style[n]===o&&(l+=1)}return l===0?"none":l===s?"all":"some"}get keybindings(){var i,n;if(this._keybindings)return this._keybindings;let[e,r]=Sp(this.options.keybindings,(i=gr())!=null?i:Su());return((n=gr())==null?void 0:n.score)>0&&(this._keybindings=e,r.length>0&&console.error("MathLive 0.109.0: Invalid keybindings for current keyboard layout",r)),e}get menu(){var e;return(e=this._menu)!=null||(this._menu=new Ao(kh(this),{host:this.host})),this._menu}set menuItems(e){this._menu?this._menu.menuItems=e:this._menu=new Ao(e,{host:this.host})}setOptions(e){var n;this.options=p(p({},this.options),_n(e)),this._keybindings=void 0,this.options.defaultMode==="inline-math"?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline");let r=this.options.defaultMode;r==="inline-math"&&(r="math"),((n=this.model.root.firstChild)==null?void 0:n.mode)!==r&&(this.model.root.firstChild.mode=r),this.options.readOnly&&this.hasFocus()&&window.mathVirtualKeyboard.visible&&this.executeCommand("hideVirtualKeyboard");let i=y.serialize([this.model.root],{expandMacro:!1,defaultMode:this.options.defaultMode});("macros"in e||this.model.getValue()!==i)&&bc(this),("value"in e||"registers"in e||"colorMap"in e||"backgroundColorMap"in e||"letterShapeStyle"in e||"minFontScale"in e||"maxMatrixCols"in e||"readOnly"in e||"contentPlaceholder"in e||"placeholderSymbol"in e)&&Y(this)}getOptions(e){return pr(this.options,e)}getOption(e){return pr(this.options,e)}async handleEvent(e){var r,i,n;if(it(this)){if(mo(e)){if(!Qi(e.origin,(r=this.options.originValidator)!=null?r:"none"))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");let{action:o}=e.data;if(o==="execute-command"){let a=yi(e.data.command);if(!a||mr(a)==="virtual-keyboard")return;this.executeCommand(a)}else o==="update-state"||(o==="focus"?this.focus({preventScroll:!0}):o==="blur"&&this.blur());return}switch(e.type){case"focus":this.programmaticFocusInProgress||this.onFocus({suppressEvents:!0});break;case"blur":this.onBlur({dispatchEvents:!1});break;case"mousedown":this.userSelect!=="none"&&!((i=e.target)!=null&&i.closest("[part=virtual-keyboard-toggle],[part=menu-toggle]"))&&Bc(this,e);break;case"pointerdown":!e.defaultPrevented&&this.userSelect!=="none"&&!((n=e.target)!=null&&n.closest("[part=virtual-keyboard-toggle],[part=menu-toggle]"))&&(Bc(this,e),e.shiftKey===!1&&await Fc(e,this.container,this.menu)&&Mi.stop());break;case"contextmenu":this.userSelect!=="none"&&e.shiftKey===!1&&await Fc(e,this.container,this.menu)&&Mi.stop();break;case"virtual-keyboard-toggle":this.hasFocus()&&ko(this),this.hasFocus()&&this.options.mathVirtualKeyboardPolicy!=="manual"&&(this.focusBlurInProgress=!0,this.keyboardDelegate.blur(),this.keyboardDelegate.focus(),this.focusBlurInProgress=!1);break;case"resize":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>it(this)&&this.onGeometryChange());break;case"scroll":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>it(this)&&this.onGeometryChange());break;case"wheel":this.onWheel(e);break;case"message":break;default:console.warn("Unexpected event type",e.type)}}}updateToggleLayout(){if(!this.element||!this.host)return;let e=this.element.querySelector(".ML__toggles");if(!e)return;let r=this.host.offsetHeight,i=e.classList.contains("ML__toggles--vertical");r>=100&&!i?e.classList.add("ML__toggles--vertical"):r<100&&i&&e.classList.remove("ML__toggles--vertical")}dispose(){if(!it(this))return;F.unsubscribe(this._l10Subscription),this.keyboardDelegate.dispose(),this.keyboardDelegate=void 0,this.eventController.abort(),this.eventController=void 0,this.resizeObserver.disconnect(),window.mathVirtualKeyboard.removeEventListener("virtual-keyboard-toggle",this),this.disconnectFromVirtualKeyboard(),this.model.dispose();let e=this.element;delete e.mathfield,this.element=void 0,this.host=void 0,this.field=void 0,this.ariaLiveText=void 0,Zp(),Cp(),sh()}flushInlineShortcutBuffer(e){if(e!=null||(e={defer:!1}),!e.defer){this.inlineShortcutBuffer.length=0,clearTimeout(this.inlineShortcutBufferFlushTimer),this.inlineShortcutBufferFlushTimer=0;return}this.options.inlineShortcutTimeout>0&&(clearTimeout(this.inlineShortcutBufferFlushTimer),this.inlineShortcutBufferFlushTimer=setTimeout(()=>this.flushInlineShortcutBuffer(),this.options.inlineShortcutTimeout))}executeCommand(e){return mr(e)==="virtual-keyboard"?(this.focus({preventScroll:!0}),window.mathVirtualKeyboard.executeCommand(e),requestAnimationFrame(()=>window.mathVirtualKeyboard.update(jt(this))),!1):Bp(this,e)}get errors(){return ns(this.model.getValue(),{context:this.context})}getValue(e,r,i){return this.model.getValue(e,r,i)}setValue(e,r){var n;r=r!=null?r:{mode:"math"},r.insertionMode===void 0&&(r.insertionMode="replaceAll"),(r.format===void 0||r.format==="auto")&&(r.format="latex"),(r.mode===void 0||r.mode==="auto")&&(r.mode=(n=z0(this.model,this.model.position))!=null?n:"math");let i=this.undoManager.canUndo();q.insert(this.model,e,r)&&(Y(this),i||this.undoManager.reset(),this.undoManager.snapshot("set-value"))}get expression(){let e=globalThis.MathfieldElement.computeEngine;return e?e.box(e.parse(this.model.getValue("latex-unstyled"))):(console.error("MathLive 0.109.0: no compute engine available. Make sure the Compute Engine library is loaded."),null)}scrollIntoView(){var i;if(!this.element)return;if(this.host){if(this.options.onScrollIntoView)this.options.onScrollIntoView(this);else if(this.host.scrollIntoView({block:"nearest",inline:"nearest"}),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.container===window.document.body){let n=window.mathVirtualKeyboard.boundingRect,o=this.host.getBoundingClientRect();o.bottom>n.top&&((i=window.document.scrollingElement)==null||i.scrollBy(0,o.bottom-n.top+8))}}this.dirty&&vt(this,{interactive:!0});let e=this.field.getBoundingClientRect(),r=null;if(this.model.selectionIsCollapsed)r=Yi(this.field);else{let n=Xa(this);if(n.length>0){let o=-1/0,a=1/0,s=-1/0;for(let c of n)c.right>o&&(o=c.right),c.tops&&(s=c.bottom);let l=s-a;r={x:o+e.left-this.field.scrollLeft,y:a+e.top-this.field.scrollTop,height:l}}}if(this.host&&r){let n=this.host.getBoundingClientRect(),o=20,a=r.y,s=r.y+r.height,l=this.host.scrollTop;an.bottom-o&&(l=s-n.bottom+this.host.scrollTop+o),l!==this.host.scrollTop&&this.host.scroll({top:l,behavior:"auto"})}if(r){let n=r.x-window.scrollX,o=this.field.scrollLeft;ne.right&&(o=n-e.right+this.field.scrollLeft+20),this.field.scroll({top:this.field.scrollTop,left:o})}}insert(e,r){if(typeof e!="string"||e.length===0&&((r==null?void 0:r.insertionMode)==="insertBefore"||(r==null?void 0:r.insertionMode)==="insertAfter")||e.length===0&&this.model.selectionIsCollapsed)return!1;if(this.flushInlineShortcutBuffer(),r=r!=null?r:{mode:"math"},r.focus&&this.focus(),r.feedback&&(globalThis.MathfieldElement.keypressVibration&&Ho()&&navigator.vibrate(xc),globalThis.MathfieldElement.playSound("keypress")),e==="\\\\")Sc(this.model);else if(e==="&")kc(this.model);else if(this.model.selectionIsCollapsed){let i=p({},Wt(this));!/^[a-zA-Z0-9]$/.test(e)&&this.styleBias!=="none"&&(i.variant="normal",i.variantStyle=void 0),q.insert(this.model,e,p({style:i},r))}else q.insert(this.model,e,r);return this.snapshot(`insert-${this.model.at(this.model.position).type}`),Y(this),r.scrollIntoView&&this.scrollIntoView(),!0}switchMode(e,r="",i=""){if(this.model.mode===e||!this.hasEditableContent||!this.contentEditable||this.disabled)return;let{model:n}=this,o=n.mode;if(n.mode=e,this.host&&!this.host.dispatchEvent(new Event("mode-change",{bubbles:!0,composed:!0,cancelable:!0}))){n.mode=o;return}n.mode=o,n.deferNotifications({content:!!i||!!r,selection:!0,type:"insertText"},()=>{let a=n.at(n.position),s=(m,d)=>{if(!m)return;let h=n.mode==="math"?ge(ir(m,{format:"ascii-math"})[1],{context:this.context}):[...m].map(f=>new qe(f,f,{}));if(d.select){let f=a.parent.addChildrenAfter(h,a);n.setSelection(n.offsetOf(h[0].leftSibling),n.offsetOf(f))}else n.position=n.offsetOf(a.parent.addChildrenAfter(h,a));u=!0},l=(m,d)=>{let h=new Ft(m);a.parent.addChildAfter(h,a),d.select?n.setSelection(n.offsetOf(h.firstChild),n.offsetOf(h.lastChild)):n.position=n.offsetOf(h.lastChild),u=!0},c=()=>{let m=e==="latex"?"latex":e==="math"?"plain-text":"ascii-math",d=de(n.selection),h=this.model.getValue(d,m),f=this.model.extractAtoms(d);return f.length===1&&f[0].type==="placeholder"&&(h=i),a=n.at(d[0]),h},u=!1;if(this.flushInlineShortcutBuffer(),this.stopCoalescingUndo(),Xe(this,"accept"),n.selectionIsCollapsed)s(r,{select:!1}),n.mode=e,e==="latex"?l(i,{select:!1}):s(i,{select:!1});else{let m=c();n.mode=e,e==="latex"?l(m,{select:!0}):s(m,{select:!0})}return Y(this),this.undoManager.snapshot(e==="latex"?"insert-latex":"insert"),u}),n.mode=e,window.mathVirtualKeyboard.update(jt(this))}hasFocus(){return!this.blurred}focus(e){var r;this.disabled||this.focusBlurInProgress||(this.hasFocus()||(this.programmaticFocusInProgress=!0,this.onFocus(),this.model.announce("line")),(r=e==null?void 0:e.preventScroll)!=null&&r||this.scrollIntoView())}blur(){this.disconnectFromVirtualKeyboard(),this.hasFocus()&&this.keyboardDelegate.blur()}select(){this.model.selection={ranges:[[0,this.model.lastOffset]]},this.focus()}applyStyle(e,r={}){var s;let i,n="set",o=!1;si(r)?i=r:(r.operation==="toggle"&&(n="toggle"),i=r.range,o=(s=r.silenceNotifications)!=null?s:!1),i&&(i=this.model.normalizeRange(i)),i&&i[0]===i[1]&&(i=void 0);let a=ms(this,e);if(i===void 0&&this.model.selectionIsCollapsed){if(n==="set"){let u=p({},this.defaultStyle);"color"in a&&delete u.verbatimColor,"backgroundColor"in a&&delete u.verbatimBackgroundColor,this.defaultStyle=p(p({},u),a),this.styleBias="none";return}let l=Wt(this),c=p({},this.defaultStyle);for(let u of Object.keys(a))l[u]===a[u]?(u==="color"&&delete c.verbatimColor,u==="backgroundColor"&&delete c.verbatimBackgroundColor,delete c[u]):c[u]=a[u];this.defaultStyle=c,this.styleBias="none";return}this.model.deferNotifications({content:!o,type:"insertText"},()=>{if(i===void 0)for(let l of this.model.selection.ranges)no(this.model,l,a,{operation:n});else no(this.model,i,a,{operation:n})}),Y(this)}toggleContextMenu(){var n;let e=this.menu;if(!e.visible)return!1;if(e.state==="open")return e.hide(),!0;let r=(n=Za(this,this.model.position))==null?void 0:n.bounds;if(!r)return!1;let i={x:r.right,y:r.bottom};return e.show({target:this.element.querySelector("[part=container]"),location:i,onDismiss:()=>{var o;return(o=this.element)==null?void 0:o.focus()}}),!0}getPrompt(e){let r=this.model.findAtom(i=>i.type==="prompt"&&i.placeholderId===e);return r}getPromptValue(e,r){let i=this.getPrompt(e);if(!i)return"";let n=this.model.offsetOf(i.firstChild),o=this.model.offsetOf(i.lastChild);return this.model.getValue(n,o,r)}getPrompts(e){return this.model.atoms.filter(r=>r.type!=="prompt"?!1:e?!(e.id&&r.placeholderId!==e.id||e.locked&&r.locked!==e.locked||e.correctness==="undefined"&&r.correctness||e.correctness&&r.correctness!==e.correctness):!0).map(r=>r.placeholderId)}setPromptValue(e,r,i){if(r!==void 0){let n=this.getPrompt(e);if(!n){console.error(`MathLive 0.109.0: unknown prompt ${e}`);return}let o=this.model.getBranchRange(this.model.offsetOf(n),"body");this.model.setSelection(o),this.insert(r,g(p({},i),{insertionMode:"replaceSelection"}))}i!=null&&i.silenceNotifications&&(this.valueOnFocus=this.getValue()),Y(this)}setPromptState(e,r,i){let n=this.getPrompt(e);if(!n){console.error(`MathLive 0.109.0: unknown prompt ${e}`);return}r==="undefined"?n.correctness=void 0:typeof r=="string"&&(n.correctness=r),typeof i=="boolean"&&(n.locked=i,n.captureSelection=i),Y(this)}getPromptState(e){let r=this.getPrompt(e);return r?[r.correctness,r.locked]:(console.error(`MathLive 0.109.0: unknown prompt ${e}`),[void 0,!0])}getPromptRange(e){let r=this.getPrompt(e);return r?this.model.getBranchRange(this.model.offsetOf(r),"body"):(console.error(`MathLive 0.109.0: unknown prompt ${e}`),[0,0])}canUndo(){return this.undoManager.canUndo()}canRedo(){return this.undoManager.canRedo()}popUndoStack(){this.undoManager.pop(),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(jt(this))}snapshot(e){var r;this.undoManager.snapshot(e)&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(jt(this)),(r=this.host)==null||r.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"snapshot"}})))}stopCoalescingUndo(){this.undoManager.stopCoalescing(this.model.selection)}stopRecording(){this.undoManager.stopRecording()}startRecording(){this.undoManager.startRecording()}undo(){var e;this.undoManager.undo()&&((e=this.host)==null||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}redo(){var e;this.undoManager.redo()&&((e=this.host)==null||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"redo"}})))}resetUndo(){var e;(e=this.undoManager)==null||e.reset()}onSelectionDidChange(){var r,i;let e=this.model;if(e.mathfield.hasFocus()&&this.keyboardDelegate.setValue(e.getValue(e.selection,"latex-expanded")),e.selectionIsCollapsed){let n=ao(e),o=e.position,a=e.at(o),s=(r=a.mode)!=null?r:wc(this.options);if(n&&(oe.offsetOf(n.lastChild))){Xe(this,"accept",{mode:s});let l=e.offsetOf(a);l>=0&&(e.position=l)}else{let l=e.at(o+1);(l==null?void 0:l.type)==="first"&&l.mode==="latex"?e.position=o+1:n&&(l==null?void 0:l.mode)!=="latex"?e.position=o-1:this.switchMode(s)}}(i=this.host)==null||i.dispatchEvent(new Event("selection-change",{bubbles:!0,composed:!0})),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(jt(this)),ko(this)}onContentWillChange(e){var r,i,n;return(n=(i=this.host)==null?void 0:i.dispatchEvent(new InputEvent("beforeinput",g(p({},e),{data:e.data?e.data:(r=e.inputType)!=null?r:"",cancelable:!0,bubbles:!0,composed:!0}))))!=null?n:!0}onFocus(e){if(this.disabled||this.focusBlurInProgress||!this.blurred)return;let r=t._globallyFocusedMathfield;r&&r!==this&&!r.disabled&&r.hasFocus()&&r.onBlur({dispatchEvents:!0}),this.focusBlurInProgress=!0,this.blurred=!1,t._globallyFocusedMathfield=this,this.stopCoalescingUndo(),this.valueOnFocus=this.model.getValue(),this.hasEditablePrompts&&!this.model.at(this.model.anchor).parentPrompt&&this.executeCommand("moveToNextPlaceholder"),vt(this,{interactive:!0}),setTimeout(()=>{var n,o;if(!it(this))return;if((n=e==null?void 0:e.suppressEvents)!=null?n:!1){let a=new AbortController,s=a.signal,l=c=>{c.preventDefault(),c.stopPropagation()};for(let c of["focus","focusin"])(o=this.host)==null||o.addEventListener(c,l,{capture:!0,signal:s});this.focusBlurInProgress=!1,this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),setTimeout(()=>a.abort(),0)}else this.focusBlurInProgress=!1,this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),setTimeout(()=>{this.programmaticFocusInProgress=!1},0)},60)}onBlur(e){var i,n,o,a;if(this.focusBlurInProgress||this.blurred)return;if(this.focusBlurInProgress=!0,this.stopCoalescingUndo(),this.blurred=!0,t._globallyFocusedMathfield===this&&(t._globallyFocusedMathfield=void 0),this.ariaLiveText&&(this.ariaLiveText.textContent=""),Nr(this),this.model.getValue()!==this.valueOnFocus&&((i=this.host)==null||i.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),this.disconnectFromVirtualKeyboard(),((n=e==null?void 0:e.dispatchEvents)!=null?n:!0)&&((o=this.host)==null||o.dispatchEvent(new Event("blur",{bubbles:!1,composed:!0})),(a=this.host)==null||a.dispatchEvent(new UIEvent("focusout",{bubbles:!0,composed:!0}))),Y(this),this.focusBlurInProgress=!1,Ks(),bn.restoreFocusWhenDocumentFocused){let s=new AbortController,l=s.signal;window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{it(this)&&this.focus({preventScroll:!0})},{once:!0,signal:l})},{once:!0,signal:l}),document.addEventListener("focusin",()=>s.abort(),{once:!0}),document.addEventListener("click",()=>s.abort(),{once:!0})}}onInput(e){_o(this,e)}onKeystroke(e){return Tc(this,e)}onCompositionStart(e){st(this.model,de(this.model.selection),"insertText");let r=Yi(this.field);r&&requestAnimationFrame(()=>{vt(this),this.keyboardDelegate.moveTo(r.x,r.y-r.height)})}onCompositionUpdate(e){zp(this.model,e),Y(this)}onCompositionEnd(e){Np(this.model),_o(this,e,{simulateKeystroke:!0})}onCut(e){if(!this.isSelectionEditable){this.model.announce("plonk");return}this.model.contentWillChange({inputType:"deleteByCut"})&&(this.stopCoalescingUndo(),e.clipboardData?q.onCopy(this,e):q.copyToClipboard(this,"latex"),st(this.model,de(this.model.selection),"deleteByCut"),this.snapshot("cut"),Y(this))}onCopy(e){e.clipboardData?q.onCopy(this,e):q.copyToClipboard(this,"latex")}onPaste(e){let r=this.isSelectionEditable;return r&&(r=q.onPaste(this.model.at(this.model.position).mode,this,e.clipboardData)),r||this.model.announce("plonk"),e.preventDefault(),e.stopPropagation(),r}onGeometryChange(){var e;(e=this._menu)==null||e.hide(),gn(this),ko(this)}onWheel(e){let r=5*e.deltaX;if(!Number.isFinite(r)||r===0)return;let i=this.field;r<0&&i.scrollLeft===0||r>0&&i.offsetWidth+i.scrollLeft>=i.scrollWidth||(i.scrollBy({top:0,left:r}),e.preventDefault(),e.stopPropagation())}getHTMLElement(e){let r=e;for(;!r.id&&r.hasChildren;)r=e.children[0];return this.field.querySelector(`[data-atom-id="${r.id}"]`)}get context(){var e,r;return{registers:(e=this.options.registers)!=null?e:{},smartFence:this.smartFence,letterShapeStyle:this.letterShapeStyle,minFontScale:this.minFontScale,maxMatrixCols:this.maxMatrixCols,placeholderSymbol:(r=this.options.placeholderSymbol)!=null?r:"\u25A2",colorMap:i=>this.colorMap(i),backgroundColorMap:i=>this.backgroundColorMap(i),getMacro:i=>Ki(i,this.options.macros),atomIdsSettings:{seed:"random",groupNumbers:!1}}}};fe({speak:(t,e,r)=>yy(t,e,r)},{target:"mathfield"});function yy(t,e,r){var c;r=r!=null?r:{withHighlighting:!1};let{model:i}=t;function n(u){let m=null;switch(u){case"all":m=i.root;break;case"selection":m=i.getAtoms(i.selection);break;case"left":{m=i.getAtoms(i.offsetOf(i.at(i.position).leftSibling),i.position);break}case"right":{m=i.getAtoms(i.position,i.offsetOf(i.at(i.position).rightSibling));break}case"group":m=i.getAtoms(i.getSiblingsRange(i.position));break;case"parent":{let{parent:d}=i.at(i.position);d!=null&&d.parent?m=d:m=i.root;break}default:m=i.root}return m}function o(u){let m="";switch(u){case"all":console.error("Internal failure: speak all failed");break;case"selection":m="no selection";break;case"left":m="at start";break;case"right":m="at end";break;case"group":console.error("Internal failure: speak group failed");break;case"parent":m="no parent";break;default:console.error('unknown speak_ param value: "'+u+'"');break}return m}let a=globalThis.MathfieldElement,s=n(e);if(s===null)return(c=a.speakHook)==null||c.call(a,o(e)),!1;(r.withHighlighting||a.speechEngine==="amazon")&&(a.textToSpeechMarkup=globalThis.sre&&a.textToSpeechRules==="sre"?"ssml_step":"ssml");let l=kt(s);return ke()&&r.withHighlighting?(Lt().readAloudMathfield=t,vt(t,{forHighlighting:!0}),a.readAloudHook&&a.readAloudHook(t.field,l)):a.speakHook&&a.speakHook(l),!1}function Oh(t){var r,i;if(!ke())return;let e=globalThis.MathfieldElement;if(!e.speechEngine||e.speechEngine==="local"){let n=new SpeechSynthesisUtterance(t);globalThis.speechSynthesis.speak(n)}else if(e.speechEngine==="amazon")if(!("AWS"in window))console.error("MathLive 0.109.0: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");else{let n=new globalThis.AWS.Polly({apiVersion:"2016-06-10"}),o={OutputFormat:"mp3",VoiceId:(r=e.speechEngineVoice)!=null?r:"Joanna",Engine:["Amy","Emma","Brian","Ivy","Joanna","Kendra","Kimberly","Salli","Joey","Justin","Matthew"].includes((i=e.speechEngineVoice)!=null?i:"Joanna")?"neural":"standard",Text:t,TextType:"ssml"};n.synthesizeSpeech(o,(a,s)=>{if(a)console.trace(`MathLive 0.109.0: \`polly.synthesizeSpeech()\` error: ${a}`);else if(s!=null&&s.AudioStream){let l=new Uint8Array(s.AudioStream),c=new Blob([l.buffer],{type:"audio/mpeg"}),u=URL.createObjectURL(c);new Audio(u).play().catch(d=>console.error(d))}})}else e.speechEngine==="google"&&console.error("MathLive 0.109.0: The Google speech engine is not supported yet. Please come again.")}function Bh(t){if(t&&(t.classList.remove("ML__highlight"),t.children))for(let e of t.children)Bh(e)}function tu(t,e){var r;t&&(!e||((r=t.dataset)==null?void 0:r.atomId)===e?(t.classList.add("ML__highlight"),t.children&&t.children.length>0&&[...t.children].forEach(i=>{i instanceof HTMLElement&&tu(i)})):(t.classList.remove("ML__highlight"),t.children&&t.children.length>0&&[...t.children].forEach(i=>{i instanceof HTMLElement&&tu(i,e)})))}function Kh(t,e){var n;if(!ke())return;if(globalThis.MathfieldElement.speechEngine!=="amazon"){console.error("MathLive 0.109.0: Use Amazon TTS Engine for synchronized highlighting"),typeof globalThis.MathfieldElement.speakHook=="function"&&globalThis.MathfieldElement.speakHook(e);return}if(!globalThis.AWS){console.error("MathLive 0.109.0: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");return}let r=new globalThis.AWS.Polly({apiVersion:"2016-06-10"}),i={OutputFormat:"json",VoiceId:(n=globalThis.MathfieldElement.speechEngineVoice)!=null?n:"Joanna",Engine:"standard",Text:e,TextType:"ssml",SpeechMarkTypes:["ssml"]};Lt().readAloudElement=t,r.synthesizeSpeech(i,(o,a)=>{if(o){console.trace(`MathLive 0.109.0: \`polly.synthesizeSpeech()\` error: ${o}`);return}if(!(a!=null&&a.AudioStream))return;let s=new TextDecoder("utf-8").decode(new Uint8Array(a.AudioStream));Lt().readAloudMarks=s.split(` `).map(l=>l?JSON.parse(l):{}),Lt().readAloudTokens=[];for(let l of Lt().readAloudMarks)l.value&&Lt().readAloudTokens.push(l.value);Lt().readAloudCurrentMark="",i.OutputFormat="mp3",i.SpeechMarkTypes=[],r.synthesizeSpeech(i,(l,c)=>{if(l){console.trace(`MathLive 0.109.0: \`polly.synthesizeSpeech("${e}") error:${l}`);return}if(!(c!=null&&c.AudioStream))return;let u=new Uint8Array(c.AudioStream),m=new Blob([u.buffer],{type:"audio/mpeg"}),d=URL.createObjectURL(m),h=Lt();h.readAloudAudio?h.readAloudAudio.pause():(h.readAloudAudio=new Audio,h.readAloudAudio.addEventListener("ended",()=>{let f=h.readAloudMathfield;h.readAloudStatus="ended",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),f?(vt(f),h.readAloudElement=null,h.readAloudMathfield=null,h.readAloudTokens=[],h.readAloudMarks=[],h.readAloudCurrentMark=""):Bh(h.readAloudElement)}),h.readAloudAudio.addEventListener("timeupdate",()=>{let f="",x=h.readAloudAudio.currentTime*1e3+100;for(let _ of h.readAloudMarks)_.time0){console.group("%cMathLive 0.109.0: %cInvalid Options","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),console.warn("Some of the options passed to `new MathfieldElement(...)` are invalid. \n See mathfield/changelog/ for details.");for(let n of i)console.warn(n);console.groupEnd()}}if(Dn()&&(this._internals=this.attachInternals(),this._internals.role="math",this._internals.ariaLabel="math input field",this._internals.ariaMultiLine="false"),this.attachShadow({mode:"open",delegatesFocus:!0}),this.shadowRoot&&"adoptedStyleSheets"in this.shadowRoot){this.shadowRoot.adoptedStyleSheets=[or("core"),or("mathfield"),or("mathfield-element"),or("ui"),or("menu")],this.shadowRoot.appendChild(document.createElement("span"));let i=document.createElement("slot");i.style.display="none",this.shadowRoot.appendChild(i)}else this.shadowRoot.innerHTML="';r&&this._setOptions(r)}static get formAssociated(){return Dn()}static get optionsAttributes(){return{"default-mode":"string","letter-shape-style":"string","min-font-scale":"number","max-matrix-cols":"number","popover-policy":"string","math-mode-space":"string","read-only":"boolean","remove-extraneous-parentheses":"on/off","smart-fence":"on/off","smart-mode":"on/off","smart-superscript":"on/off","inline-shortcut-timeout":"string","script-depth":"string",placeholder:"string","virtual-keyboard-target-origin":"string","math-virtual-keyboard-policy":"string"}}static get observedAttributes(){return[...Object.keys(this.optionsAttributes),"contenteditable","disabled","readonly","read-only"]}static get fontsDirectory(){return this._fontsDirectory}static set fontsDirectory(r){r!==this._fontsDirectory&&(this._fontsDirectory=r,Dp())}get fontsDirectory(){throw new Error("Use MathfieldElement.fontsDirectory instead")}set fontsDirectory(r){throw new Error("Use MathfieldElement.fontsDirectory instead")}static get soundsDirectory(){return this._soundsDirectory}static set soundsDirectory(r){this._soundsDirectory=r,this.audioBuffers={}}get soundsDirectory(){throw new Error("Use MathfieldElement.soundsDirectory instead")}set soundsDirectory(r){throw new Error("Use MathfieldElement.soundsDirectory instead")}static get keypressSound(){return this._keypressSound}static set keypressSound(r){var i,n,o;this.audioBuffers={},r===null?this._keypressSound={spacebar:null,return:null,delete:null,default:null}:typeof r=="string"?this._keypressSound={spacebar:r,return:r,delete:r,default:r}:typeof r=="object"&&"default"in r&&(this._keypressSound={spacebar:(i=r.spacebar)!=null?i:r.default,return:(n=r.return)!=null?n:r.default,delete:(o=r.delete)!=null?o:r.default,default:r.default})}static get plonkSound(){return this._plonkSound}static set plonkSound(r){this.audioBuffers={},this._plonkSound=r}static get audioContext(){return this._audioContext||(this._audioContext=new AudioContext),this._audioContext}static get speechEngine(){return this._speechEngine}static set speechEngine(r){this._speechEngine=r}static get speechEngineRate(){return this._speechEngineRate}static set speechEngineRate(r){this._speechEngineRate=r}static get speechEngineVoice(){return this._speechEngineVoice}static set speechEngineVoice(r){this._speechEngineVoice=r}static get textToSpeechMarkup(){return this._textToSpeechMarkup}static set textToSpeechMarkup(r){this._textToSpeechMarkup=r}static get textToSpeechRules(){return this._textToSpeechRules}static set textToSpeechRules(r){this._textToSpeechRules=r}static get textToSpeechRulesOptions(){return this._textToSpeechRulesOptions}static set textToSpeechRulesOptions(r){this._textToSpeechRulesOptions=r}static get locale(){return F.locale}static set locale(r){r==="auto"&&(r=navigator.language.slice(0,5)),F.locale=r}get locale(){throw new Error("Use MathfieldElement.locale instead")}set locale(r){throw new Error("Use MathfieldElement.locale instead")}static get strings(){return F.strings}static set strings(r){F.merge(r)}get strings(){throw new Error("Use MathfieldElement.strings instead")}set strings(r){throw new Error("Use MathfieldElement.strings instead")}static get decimalSeparator(){return this._decimalSeparator}static set decimalSeparator(r){this._decimalSeparator=r,this._computeEngine&&(this._computeEngine.decimalSeparator=this.decimalSeparator===","?"{,}":".")}get decimalSeparator(){throw new Error("Use MathfieldElement.decimalSeparator instead")}set decimalSeparator(r){throw new Error("Use MathfieldElement.decimalSeparator instead")}static set scientificNotationTemplate(r){this._scientificNotationTemplate=r}static get scientificNotationTemplate(){return this._scientificNotationTemplate}static get fractionNavigationOrder(){return mn.fractionNavigationOrder}static set fractionNavigationOrder(r){if(r!=="numerator-denominator"&&r!=="denominator-numerator")throw new Error("Invalid value");mn.fractionNavigationOrder!==r&&(mn.fractionNavigationOrder=r,yc())}static get computeEngine(){var r,i;if(this._computeEngine===void 0){let n=(r=window[Symbol.for("io.cortexjs.compute-engine")])==null?void 0:r.ComputeEngine;if(!n)return null;this._computeEngine=new n,this._computeEngine&&this.decimalSeparator===","&&(this._computeEngine.decimalSeparator="{,}")}return(i=this._computeEngine)!=null?i:null}static set computeEngine(r){this._computeEngine=r}get computeEngine(){throw new Error("Use MathfieldElement.computeEngine instead")}set computeEngine(r){throw new Error("Use MathfieldElement.computeEngine instead")}static get isFunction(){return typeof this._isFunction!="function"?()=>!1:this._isFunction}static set isFunction(r){this._isFunction=r,yc()}static async loadSound(r){delete this.audioBuffers[r];let i="";switch(r){case"keypress":i=this._keypressSound.default;break;case"return":i=this._keypressSound.return;break;case"spacebar":i=this._keypressSound.spacebar;break;case"delete":i=this._keypressSound.delete;break;case"plonk":i=this.plonkSound;break}if(typeof i!="string")return;i=i.trim();let n=this.soundsDirectory;if(!(n==null||n==="null"||i==="none"||i==="null"))try{let a=await(await fetch(await hs(`${n}/${i}`))).arrayBuffer(),s=await this.audioContext.decodeAudioData(a);this.audioBuffers[r]=s}catch(o){}}static async playSound(r){if((this.audioContext.state==="suspended"||this.audioContext.state==="interrupted")&&await this.audioContext.resume(),this.audioBuffers[r]||await this.loadSound(r),!this.audioBuffers[r])return;let i=this.audioContext.createBufferSource();i.buffer=this.audioBuffers[r];let n=this.audioContext.createGain();n.gain.value=xy,i.connect(n).connect(this.audioContext.destination),i.start()}showMenu(r){var i,n;return(n=(i=this._mathfield)==null?void 0:i.showMenu(r))!=null?n:!1}get mathVirtualKeyboard(){throw new Error("The `mathVirtualKeyboard` property is not available on the MathfieldElement. Use `window.mathVirtualKeyboard` instead.")}onPointerDown(){window.addEventListener("pointerup",r=>{let i=this._mathfield;if(i&&r.target===this&&!i.disabled){this.dispatchEvent(new MouseEvent("click",{altKey:r.altKey,button:r.button,buttons:r.buttons,clientX:r.clientX,clientY:r.clientY,ctrlKey:r.ctrlKey,metaKey:r.metaKey,movementX:r.movementX,movementY:r.movementY,relatedTarget:r.relatedTarget,screenX:r.screenX,screenY:r.screenY,shiftKey:r.shiftKey}));let n=this.getOffsetFromPoint(r.clientX,r.clientY);n>=0&&se.openUrl(W0(i,n)),r.pointerType==="touch"&&this.selectionIsCollapsed&&(this.position=n)}},{once:!0})}getPromptValue(r,i){var n,o;return(o=(n=this._mathfield)==null?void 0:n.getPromptValue(r,i))!=null?o:""}setPromptValue(r,i,n){var o;(o=this._mathfield)==null||o.setPromptValue(r,i,n)}getPromptRange(r){var i,n;return(n=(i=this._mathfield)==null?void 0:i.getPromptRange(r))!=null?n:null}getPrompts(r){var i,n;return(n=(i=this._mathfield)==null?void 0:i.getPrompts(r))!=null?n:[]}get hasEditableContent(){var r,i;return(i=(r=this._mathfield)==null?void 0:r.hasEditableContent)!=null?i:!1}get form(){var r;return(r=this._internals)==null?void 0:r.form}get name(){var r;return(r=this.getAttribute("name"))!=null?r:""}get type(){return this.localName}get mode(){var r,i;return(i=(r=this._mathfield)==null?void 0:r.model.mode)!=null?i:this.defaultMode==="text"?"text":"math"}set mode(r){var i;(i=this._mathfield)==null||i.switchMode(r)}get expression(){if(this._mathfield)return window[Symbol.for("io.cortexjs.compute-engine")]?this._mathfield.expression:(console.error(`MathLive 0.109.0: The CortexJS Compute Engine library is not available. Load the library, for example with: import "https://esm.run/@cortex-js/compute-engine"`),null)}set expression(r){var n,o;if(!this._mathfield)return;let i=(o=(n=se.computeEngine)==null?void 0:n.box(r).latex)!=null?o:null;i!==null&&this._mathfield.setValue(i),window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`MathLive 0.109.0: The Compute Engine library is not available. Load the library, for example with: import "https://esm.run/@cortex-js/compute-engine"`)}get errors(){var r,i;return(i=(r=this._mathfield)==null?void 0:r.errors)!=null?i:[]}_getOptions(r){return this._mathfield?pr(this._mathfield.options,r):Q.has(this)?p({},pr(p(p({},Mn()),_n(Q.get(this).options)),r)):null}getOptions(r){return console.warn("%cMathLive 0.109.0: %cDeprecated Usage%c\n `mf.getOptions()` is deprecated. Read the property directly on the mathfield instead.\n See mathfield/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem","color: inherit, font-size: 1rem"),this._mathfield?pr(this._mathfield.options,r):Q.has(this)?pr(p(p({},Mn()),_n(Q.get(this).options)),r):null}reflectAttributes(){let r=Mn(),i=this._getOptions();Object.keys(se.optionsAttributes).forEach(n=>{let o=n==="placeholder"?"contentPlaceholder":hr(n);se.optionsAttributes[n]==="on/off"?r[o]!==i[o]?this.setAttribute(n,i[o]?"on":"off"):this.removeAttribute(n):r[o]!==i[o]&&(se.optionsAttributes[n]==="boolean"?i[o]?this.setAttribute(n,""):this.removeAttribute(n):(typeof i[o]=="string"||typeof i[o]=="number")&&this.setAttribute(n,i[o].toString()))})}getOption(r){return console.warn("%cMathLive 0.109.0: %cDeprecated Usage%c\n `mf.getOption()` is deprecated. Read the property directly on the mathfield instead.\n See mathfield/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem","color: inherit, font-size: 1rem"),this._getOptions([r])[r]}_getOption(r){return this._getOptions([r])[r]}_setOptions(r){if(this._mathfield)this._mathfield.setOptions(r);else if(Q.has(this)){let i=p(p({},Q.get(this).options),r);Q.set(this,g(p({},Q.get(this)),{selection:{ranges:i.readOnly?[[0,0]]:[[0,-1]]},options:i}))}else Q.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:r,menuItems:void 0});this.reflectAttributes()}setOptions(r){console.group("%cMathLive 0.109.0: %cDeprecated Usage","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),console.warn(" `mf.setOptions()` is deprecated. Set the property directly on the mathfield instead.\n See mathfield/changelog/ for details.");for(let i of Object.keys(r))jr[i]&&console.warn(`\`mf.setOptions({${i}:...})\` -> ${jr[i]}`);console.groupEnd(),this._setOptions(r)}executeCommand(...r){var n,o;let i;if(r.length===1?i=r[0]:i=[r[0],...r.slice(1)],i)return(o=(n=this._mathfield)==null?void 0:n.executeCommand(i))!=null?o:!1;throw new Error("Invalid selector")}getValue(r,i,n){var o,a;if(this._mathfield)return this._mathfield.model.getValue(r,i,n);if(Q.has(this)){let s,l,c;if(Xi(r)?([s,l]=r.ranges[0],c=i):si(r)?([s,l]=r,c=i):It(r)&&It(i)?(s=r,l=i,c=n):(s=0,l=-1,c=r),(c===void 0||c==="latex")&&s===0&&l===-1)return(a=(o=Q.get(this).value)!=null?o:this.textContent)!=null?a:""}return""}setValue(r,i){if(this._mathfield&&r!==void 0){if(this._mathfield.model.getValue()===r)return;i!=null||(i={silenceNotifications:!0,mode:"math"}),this._mathfield.setValue(r,i);return}if(Q.has(this)){let o=Q.get(this).options;Q.set(this,{value:r,selection:{ranges:[[-1,-1]],direction:"forward"},options:o,menuItems:void 0});return}let n=Us(this);Q.set(this,{value:r,selection:{ranges:[[-1,-1]],direction:"forward"},options:n,menuItems:void 0})}hasFocus(){var r,i;return(i=(r=this._mathfield)==null?void 0:r.hasFocus())!=null?i:!1}focus(){var r;this.disabled||(r=this._mathfield)==null||r.focus()}blur(){var r;(r=this._mathfield)==null||r.blur()}select(){var r;(r=this._mathfield)==null||r.select()}insert(r,i){var n,o;return(o=(n=this._mathfield)==null?void 0:n.insert(r,i))!=null?o:!1}applyStyle(r,i){var n;return(n=this._mathfield)==null?void 0:n.applyStyle(r,i)}queryStyle(r){var i,n;return(n=(i=this._mathfield)==null?void 0:i.queryStyle(r))!=null?n:"none"}getOffsetFromPoint(r,i,n){return this._mathfield?So(this._mathfield,r,i,n):-1}getElementInfo(r){return Za(this._mathfield,r)}resetUndo(){var r;(r=this._mathfield)==null||r.resetUndo()}canUndo(){return this._mathfield?this._mathfield.canUndo():!1}canRedo(){return this._mathfield?this._mathfield.canRedo():!1}handleEvent(r){var n,o,a,s,l;if(Te.state!=="closed"||((o=(n=this._mathfield)==null?void 0:n.menu)==null?void 0:o.state)!=="closed"||(r.type==="pointerdown"&&this.onPointerDown(),r.type==="focus")||r.type!=="blur")return;let i=qo();i&&((a=window==null?void 0:window.mathVirtualKeyboard)!=null&&a.visible)||((s=Te.scrim)==null?void 0:s.state)!=="closed"||i&&lu()||(l=this._mathfield)==null||l.onBlur({dispatchEvents:!1})}connectedCallback(){var l,c,u,m;let r=this.shadowRoot,i=r.host,o=window.getComputedStyle(this).userSelect!=="none";if(o)i.addEventListener("pointerdown",this,!0);else{let d=r.querySelector("span");d.style.pointerEvents="none"}i.addEventListener("focus",this,!0),i.addEventListener("blur",this,!0),this._observer=new MutationObserver(()=>{var d;this.value=(d=this.textContent)!=null?d:""}),this._observer.observe(this,{childList:!0,characterData:!0,subtree:!0}),Dn()||(this.hasAttribute("role")||this.setAttribute("role","math"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","math input field"),this.setAttribute("aria-multiline","false")),o&&!this.hasAttribute("contenteditable")&&this.setAttribute("contenteditable","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");let a=r.querySelector("slot:not([name])");if(a)try{this._style=a.assignedElements().filter(d=>d.tagName.toLowerCase()==="style").map(d=>d.textContent).join("")}catch(d){console.error(d)}if(this._style){let d=document.createElement("style");d.textContent=this._style,r.appendChild(d)}let s="";if(this.hasAttribute("value")?s=this.getAttribute("value"):s=(l=a==null?void 0:a.assignedNodes().map(d=>d.nodeType===3?d.textContent:"").join("").trim())!=null?l:"",this._mathfield=new Ws(r.querySelector(":host > span"),g(p({},(u=(c=Q.get(this))==null?void 0:c.options)!=null?u:Us(this)),{eventSink:this,value:s})),!Q.has(this)){this.upgradeProperty("disabled"),this.upgradeProperty("readonly");for(let d of Object.keys(se.optionsAttributes))this.upgradeProperty(hr(d))}if(!((m=this._mathfield)!=null&&m.model)){this._mathfield=null;return}if(Q.has(this)){let d=this._mathfield,h=Q.get(this),f=h.menuItems;d.model.deferNotifications({content:!1,selection:!1},()=>{let x=h.value;x!==void 0&&d.setValue(x),d.model.selection=h.selection,Q.delete(this)}),f&&(this.menuItems=f)}window.queueMicrotask(()=>{this.isConnected&&this.dispatchEvent(new Event("mount",{cancelable:!1,bubbles:!0,composed:!0}))}),dr()}disconnectedCallback(){var i,n,o;if(this.shadowRoot.host.removeEventListener("pointerdown",this,!0),!this._mathfield)return;(i=this._observer)==null||i.disconnect(),this._observer=null,window.queueMicrotask(()=>this.dispatchEvent(new Event("unmount",{cancelable:!1,bubbles:!0,composed:!0})));let r=pr(this._mathfield.options,Object.keys(se.optionsAttributes).map(a=>hr(a)));Q.set(this,{value:this._mathfield.getValue(),selection:this._mathfield.model.selection,menuItems:(o=(n=this._mathfield.menu)==null?void 0:n.menuItems)!=null?o:void 0,options:r}),this._mathfield.dispose(),this._mathfield=null}upgradeProperty(r){if(this.hasOwnProperty(r)){let i=this[r];delete this[r],(r==="readonly"||r==="read-only")&&(r="readOnly"),this[r]=i}}attributeChangedCallback(r,i,n){if(i===n)return;let o=n!==null;switch(r){case"contenteditable":Y(this._mathfield);break;case"placeholder":n===!1&&(n=""),this.placeholder=n;break;case"disabled":this.disabled=o;break;case"read-only":case"readonly":this.readOnly=o;break;default:}}get readonly(){return this.hasAttribute("readonly")||this.hasAttribute("read-only")}set readonly(r){let i=!!r;i?(this.setAttribute("readonly",""),Dn()?this._internals.ariaReadOnly="true":this.setAttribute("aria-readonly","true"),this.setAttribute("aria-readonly","true")):(Dn()?this._internals.ariaReadOnly="false":this.removeAttribute("aria-readonly"),this.removeAttribute("readonly"),this.removeAttribute("read-only")),this._setOptions({readOnly:i})}get disabled(){return this.hasAttribute("disabled")}set disabled(r){var n;let i=!!r;i?this.setAttribute("disabled",""):this.removeAttribute("disabled"),Dn()?this._internals.ariaDisabled=i?"true":"false":this.setAttribute("aria-disabled",i?"true":"false"),i&&((n=this._mathfield)!=null&&n.hasFocus)&&window.mathVirtualKeyboard.visible&&this._mathfield.executeCommand("hideVirtualKeyboard")}get value(){return this.getValue()}set value(r){this.setValue(r)}get defaultMode(){return this._getOption("defaultMode")}set defaultMode(r){this._setOptions({defaultMode:r})}get macros(){if(!this._mathfield)throw new Error("Mathfield not mounted");return this._getOption("macros")}set macros(r){this._setOptions({macros:r})}get registers(){if(!this._mathfield)throw new Error("Mathfield not mounted");let r=this;return new Proxy({},{get:(i,n)=>{if(typeof n=="string")return r._getOption("registers")[n]},set(i,n,o){return typeof n!="string"?!1:(r._setOptions({registers:g(p({},r._getOption("registers")),{[n]:o})}),!0)},ownKeys:()=>Reflect.ownKeys(r._getOption("registers")),getOwnPropertyDescriptor:(i,n)=>{let o=r._getOption("registers")[n];if(o!==void 0)return{configurable:!0,enumerable:!0,value:o,writable:!0}}})}set registers(r){this._setOptions({registers:r})}get colorMap(){return this._getOption("colorMap")}set colorMap(r){this._setOptions({colorMap:r})}get backgroundColorMap(){return this._getOption("backgroundColorMap")}set backgroundColorMap(r){this._setOptions({backgroundColorMap:r})}get letterShapeStyle(){return this._getOption("letterShapeStyle")}set letterShapeStyle(r){this._setOptions({letterShapeStyle:r})}get minFontScale(){return this._getOption("minFontScale")}set minFontScale(r){this._setOptions({minFontScale:r})}get maxMatrixCols(){return this._getOption("maxMatrixCols")}set maxMatrixCols(r){this._setOptions({maxMatrixCols:r})}get smartMode(){return this._getOption("smartMode")}set smartMode(r){this._setOptions({smartMode:r})}get smartFence(){return this._getOption("smartFence")}set smartFence(r){this._setOptions({smartFence:r})}get smartSuperscript(){return this._getOption("smartSuperscript")}set smartSuperscript(r){this._setOptions({smartSuperscript:r})}get scriptDepth(){return this._getOption("scriptDepth")}set scriptDepth(r){this._setOptions({scriptDepth:r})}get removeExtraneousParentheses(){return this._getOption("removeExtraneousParentheses")}set removeExtraneousParentheses(r){this._setOptions({removeExtraneousParentheses:r})}get mathModeSpace(){return this._getOption("mathModeSpace")}set mathModeSpace(r){this._setOptions({mathModeSpace:r})}get placeholderSymbol(){return this._getOption("placeholderSymbol")}set placeholderSymbol(r){this._setOptions({placeholderSymbol:r})}get placeholder(){return this._getOption("contentPlaceholder")}set placeholder(r){this._setOptions({contentPlaceholder:r})}get popoverPolicy(){return this._getOption("popoverPolicy")}set popoverPolicy(r){this._setOptions({popoverPolicy:r})}get environmentPopoverPolicy(){return this._getOption("environmentPopoverPolicy")}set environmentPopoverPolicy(r){this._setOptions({environmentPopoverPolicy:r})}get menuItems(){var r;if(!this._mathfield)throw new Error("Mathfield not mounted");return(r=this._mathfield.menu._menuItems.map(i=>i.menuItem))!=null?r:[]}set menuItems(r){var i;if(!this._mathfield)throw new Error("Mathfield not mounted");if(this._mathfield){let n=(i=this._mathfield.element)==null?void 0:i.querySelector("[part=menu-toggle]");n&&(n.style.display=r.length===0?"none":""),this._mathfield.menu.menuItems=r}}get mathVirtualKeyboardPolicy(){return this._getOption("mathVirtualKeyboardPolicy")}set mathVirtualKeyboardPolicy(r){this._setOptions({mathVirtualKeyboardPolicy:r})}get inlineShortcuts(){if(!this._mathfield)throw new Error("Mathfield not mounted");return this._getOption("inlineShortcuts")}set inlineShortcuts(r){if(!this._mathfield)throw new Error("Mathfield not mounted");this._setOptions({inlineShortcuts:r})}get inlineShortcutTimeout(){return this._getOption("inlineShortcutTimeout")}set inlineShortcutTimeout(r){this._setOptions({inlineShortcutTimeout:r})}get keybindings(){if(!this._mathfield)throw new Error("Mathfield not mounted");return this._getOption("keybindings")}set keybindings(r){if(!this._mathfield)throw new Error("Mathfield not mounted");this._setOptions({keybindings:r})}get onInsertStyle(){let r=this._getOption("onInsertStyle");return r===void 0?so:r}set onInsertStyle(r){this._setOptions({onInsertStyle:r})}get onInlineShortcut(){return this._getOption("onInlineShortcut")}set onInlineShortcut(r){this._setOptions({onInlineShortcut:r})}get onScrollIntoView(){return this._getOption("onScrollIntoView")}set onScrollIntoView(r){this._setOptions({onScrollIntoView:r})}get onExport(){return this._getOption("onExport")}set onExport(r){this._setOptions({onExport:r})}get readOnly(){return this._getOption("readOnly")}set readOnly(r){this._setOptions({readOnly:r})}get isSelectionEditable(){var r,i;return(i=(r=this._mathfield)==null?void 0:r.isSelectionEditable)!=null?i:!1}setPromptState(r,i,n){var o;(o=this._mathfield)==null||o.setPromptState(r,i,n)}getPromptState(r){var i,n;return(n=(i=this._mathfield)==null?void 0:i.getPromptState(r))!=null?n:[void 0,!0]}get selection(){return this._mathfield?this._mathfield.model.selection:Q.has(this)?Q.get(this).selection:{ranges:[[0,0]],direction:"forward"}}set selection(r){if(typeof r=="number"&&(r={ranges:[[r,r]]}),this._mathfield){this._mathfield.model.selection=r,Y(this._mathfield);return}if(Q.has(this)){Q.set(this,g(p({},Q.get(this)),{selection:r}));return}Q.set(this,{value:void 0,selection:r,options:Us(this),menuItems:void 0})}get selectionIsCollapsed(){let r=this.selection;return r.ranges.length===1&&r.ranges[0][0]===r.ranges[0][1]}get position(){return this._mathfield?this._mathfield.model.position:Q.has(this)?Q.get(this).selection.ranges[0][0]:0}set position(r){if(this._mathfield&&(this._mathfield.model.position=r,Y(this._mathfield)),Q.has(this)){Q.set(this,g(p({},Q.get(this)),{selection:{ranges:[[r,r]]}}));return}Q.set(this,{value:void 0,selection:{ranges:[[r,r]]},options:Us(this),menuItems:void 0})}get lastOffset(){var r,i;return(i=(r=this._mathfield)==null?void 0:r.model.lastOffset)!=null?i:-1}};se.version="0.109.0",se.openUrl=r=>{if(!r)return;let i=new URL(r);if(!["http:","https:","file:"].includes(i.protocol.toLowerCase())){se.playSound("plonk");return}window.open(i,"_blank")},se._fontsDirectory="./fonts/",se._soundsDirectory="./sounds",se.keypressVibration=!0,se._keypressSound={spacebar:"keypress-spacebar.wav",return:"keypress-return.wav",delete:"keypress-delete.wav",default:"keypress-standard.wav"},se._plonkSound="plonk.wav",se.audioBuffers={},se.createHTML=r=>r,se._speechEngineRate="100%",se._speechEngineVoice="Joanna",se._textToSpeechMarkup="",se._textToSpeechRules="mathlive",se._textToSpeechRulesOptions={},se.speakHook=Oh,se.readAloudHook=Kh,se.restoreFocusWhenDocumentFocused=!0,se._decimalSeparator=".",se._scientificNotationTemplate="#1\\times10^{#2}",se._isFunction=r=>{var n,o;let i=globalThis.MathfieldElement.computeEngine;return(o=(n=i==null?void 0:i.parse(r).domain)==null?void 0:n.isFunction)!=null?o:!1};var at=se;function hr(t){return t.replace(/[^a-zA-Z\d]+(.)/g,(e,r)=>r.toUpperCase())}function Us(t){let e={readOnly:!1},r=at.optionsAttributes;return Object.keys(r).forEach(i=>{var n;if(t.hasAttribute(i)){let o=t.getAttribute(i);i==="placeholder"?e.contentPlaceholder=o!=null?o:"":r[i]==="boolean"?e[hr(i)]=!0:r[i]==="on/off"?(o=(n=o==null?void 0:o.toLowerCase())!=null?n:"",o==="on"||o==="true"?e[hr(i)]=!0:o==="off"||o==="false"?e[hr(i)]=!1:e[hr(i)]=void 0):r[i]==="number"?e[hr(i)]=Number.parseFloat(o!=null?o:"0"):e[hr(i)]=o}}),e}function Dn(){return!(!("ElementInternals"in window)||!HTMLElement.prototype.attachInternals||!("role"in window.ElementInternals.prototype))}var bn=at,Ph,Rh,Ih,zh;if(ke()&&!((Ph=window.customElements)!=null&&Ph.get("math-field"))){(Ih=window[Rh=Symbol.for("io.cortexjs.mathlive")])!=null||(window[Rh]={});let t=window[Symbol.for("io.cortexjs.mathlive")];t.version="0.109.0",globalThis.MathfieldElement=at,(zh=window.customElements)==null||zh.define("math-field",at)}function vy(t,e,r){let i=r,n=0,o=t.length;for(;i0&&o.push({type:"text",data:s.slice(0,c)}),l=!1);let m=!1;for(;!m;){if(l){if(u=s.indexOf(e,c),u===-1){m=!0;break}c!==u&&o.push({type:"text",data:s.slice(c,u)}),c=u}else{if(u=vy(r,s,c+e.length),u===-1){m=!0;break}let d=s.slice(c+e.length,u);n==="ascii-math"&&([,d]=ir(d,{format:"ascii-math"})),o.push({type:"math",data:d,mathstyle:i}),c=u+r.length}l=!l}c{r=js(r,m,d,"displaystyle")}),(a=(o=e.TeX)==null?void 0:o.delimiters)!=null&&a.inline&&e.TeX.delimiters.inline.forEach(([m,d])=>{r=js(r,m,d,"textstyle")}),(l=(s=e.asciiMath)==null?void 0:s.delimiters)!=null&&l.inline&&e.asciiMath.delimiters.inline.forEach(([m,d])=>{r=js(r,m,d,"textstyle","ascii-math")}),(u=(c=e.asciiMath)==null?void 0:c.delimiters)!=null&&u.display&&e.asciiMath.delimiters.display.forEach(([m,d])=>{r=js(r,m,d,"displaystyle","ascii-math")}),r}function _y(t,e){let r=document.createElement("span");r.setAttribute("translate","no");try{let i=""+e.renderToMathML(t)+"";r.innerHTML=globalThis.MathfieldElement.createHTML(i)}catch(i){console.error(`MathLive 0.109.0: Could not convert "${t}"' to MathML with ${i}`),r.textContent=t}return r.className="ML__sr-only",r}function My(t,e,r){try{let i=e.renderToMarkup(t,g(p({},e),{defaultMode:r==="displaystyle"?"math":"inline-math"})),n=document.createElement("span");return n.dataset.latex=t,n.style.display=r==="displaystyle"?"flex":"inline-flex",n.setAttribute("aria-hidden","true"),n.setAttribute("translate","no"),n.innerHTML=globalThis.MathfieldElement.createHTML(i),n}catch(i){return console.error("Could not parse'"+t+"' with ",i),document.createTextNode(t)}}function Io(t,e,r){var o;let i=My(t,r,e||"textstyle"),n=(o=r.renderAccessibleContent)!=null?o:"";if(/\b(mathml|speakable-text)\b/i.test(n)){let a=document.createElement("span");if(/\bmathml\b/i.test(n)&&r.renderToMathML&&a.append(_y(t,r)),/\bspeakable-text\b/i.test(n)&&r.renderToSpeakableText){let s=document.createElement("span");s.setAttribute("translate","no");let l=r.renderToSpeakableText(t);s.innerHTML=globalThis.MathfieldElement.createHTML(l),s.className="ML__sr-only",a.append(s)}return a.append(i),a}return i}function wy(t,e){var n;if(/^\s*$/.test(t))return null;if((n=e.TeX)!=null&&n.processEnvironments&&/^\s*\\begin/.test(t))return[Io(t,"",e)];let r=Nh(t,e);if(r.length===1&&r[0].type==="text")return null;let i=[];for(let o of r)o.type==="text"?i.push(o.data):i.push(Io(o.data,o.mathstyle==="textstyle"?"textstyle":"displaystyle",e));return i}function Fh(t,e){var i,n,o,a,s,l,c,u,m,d,h,f,x,_,b,v,k,A;if(t.childNodes.length===1&&t.childNodes[0].nodeType===3){let C=(i=t.childNodes[0].textContent)!=null?i:"";if((n=e.TeX)!=null&&n.processEnvironments&&/^\s*\\begin/.test(C)){t.textContent="",t.append(Io(C,"",e));return}let T=Nh(C,e);if(T.length===1){let S=T[0];if(S.type==="text")return;t.textContent="",t.append(Io(S.data,S.mathstyle==="textstyle"?"textstyle":"displaystyle",e));return}}let r=[...t.childNodes];for(let C of r)if(C.nodeType===3){let T=wy((o=C.textContent)!=null?o:"",e);T&&C.replaceWith(...T)}else if(C.nodeType===1){let T=C.nodeName.toLowerCase();if(T==="script"){let S=C,B=S.type.toLowerCase();if(B==="module"||B==="javascript")continue;let $;if((a=e.processScriptTypePattern)!=null&&a.test(B))$=(s=S.textContent)!=null?s:"";else if((l=e.processMathJSONScriptTypePattern)!=null&&l.test(B))try{$=(u=e.serializeToLatex)==null?void 0:u.call(e,JSON.parse((c=S.textContent)!=null?c:""))}catch(G){console.error(G)}if($){let G="textstyle";for(let R of B.split(";")){let[N,j]=R.split("=");N.trim()==="mode"&&(G=j.trim()==="display"?"displaystyle":"textstyle")}ru(S,$,G,e)}}else{let S=C;if((m=e.texClassDisplayPattern)!=null&&m.test(S.className)){ru(S,(d=S.textContent)!=null?d:"","displaystyle",e);continue}if((h=e.texClassInlinePattern)!=null&&h.test(S.className)){ru(S,(f=S.textContent)!=null?f:"","textstyle",e);continue}(((_=(x=e.processClassPattern)==null?void 0:x.test(S.className))!=null?_:!1)||!((v=(b=e.skipTags)==null?void 0:b.includes(T))!=null&&v||(A=(k=e.ignoreClassPattern)==null?void 0:k.test(S.className))!=null&&A))&&Fh(S,e)}}}var Sy={skipTags:["math-field","noscript","style","textarea","pre","code","annotation","annotation-xml"],processScriptType:"math/tex",processMathJSONScriptType:"math/json",ignoreClass:"^(tex2jax_ignore|ML__latex)$",processClass:"tex2jax_process",renderAccessibleContent:"mathml",asciiMath:{delimiters:{inline:[["`","`"]]}},TeX:{processEnvironments:!0,delimiters:{inline:[["\\(","\\)"]],display:[["$$","$$"],["\\[","\\]"]]}}};function iu(t,e){var r,i,n,o,a,s,l,c;try{let u=p(p({},Sy),e);u.ignoreClassPattern=new RegExp((r=u.ignoreClass)!=null?r:""),u.processClassPattern=new RegExp((i=u.processClass)!=null?i:""),u.processScriptTypePattern=new RegExp((n=u.processScriptType)!=null?n:""),u.processMathJSONScriptTypePattern=new RegExp((o=u.processMathJSONScriptType)!=null?o:""),(s=(a=u.TeX)==null?void 0:a.className)!=null&&s.display&&(u.texClassDisplayPattern=new RegExp(u.TeX.className.display)),(c=(l=u.TeX)==null?void 0:l.className)!=null&&c.inline&&(u.texClassInlinePattern=new RegExp(u.TeX.className.inline)),dr(),We("core"),Fh(t,u)}catch(u){u instanceof Error?console.error("renderMathInElement(): "+u.message):console.error("renderMathInElement(): Could not render math for element",t)}}function ru(t,e,r,i){t.parentNode.replaceChild(Io(e,r,i),t)}function ky(t,e){let r=ze.singleton;return r?(r.show(),Vr(),r.currentLayer=e,r.render(),r.focus(),!0):!1}function Ly(){let t=window.mathVirtualKeyboard;return t.visible?t.hide({animate:!0}):t.show({animate:!0}),!1}fe({switchKeyboardLayer:ky,toggleVirtualKeyboard:Ly,hideVirtualKeyboard:()=>(window.mathVirtualKeyboard.hide({animate:!0}),!1),showVirtualKeyboard:()=>(window.mathVirtualKeyboard.show({animate:!0}),!1)},{target:"virtual-keyboard"});var $h=!1,Vh=null;function Ay(){$h||Vh||(Vh=dr().then(()=>{$h=!0}))}var Js=class extends HTMLElement{constructor(){super();this._hasRendered=!1;if(this._shadowRoot=this.attachShadow({mode:"open"}),"adoptedStyleSheets"in this._shadowRoot)this._shadowRoot.adoptedStyleSheets=[or("core")];else{let r=document.createElement("style");r.textContent=Nt("core"),this._shadowRoot.appendChild(r)}this._contentSlot=document.createElement("div"),this._contentSlot.style.display="none",this._contentSlot.setAttribute("part","content"),this._renderContainer=document.createElement("div"),this._renderContainer.setAttribute("part","render"),this._renderContainer.setAttribute("aria-hidden","true"),this._errorFallback=document.createElement("div"),this._errorFallback.style.display="none",this._errorFallback.setAttribute("part","error"),this._shadowRoot.appendChild(this._contentSlot),this._shadowRoot.appendChild(this._renderContainer),this._shadowRoot.appendChild(this._errorFallback),this.addEventListener("keydown",this._handleKeydown.bind(this))}static get observedAttributes(){return["mode","format","macros","letter-shape-style","min-font-scale","max-matrix-cols"]}connectedCallback(){Ay(),"IntersectionObserver"in window&&!this._hasRendered?(this._observer=new IntersectionObserver(r=>{var i;r[0].isIntersecting&&!this._hasRendered&&(this.render(),(i=this._observer)==null||i.disconnect())},{rootMargin:"50px"}),this._observer.observe(this)):this.render()}disconnectedCallback(){var r;(r=this._observer)==null||r.disconnect()}attributeChangedCallback(r,i,n){i!==n&&this._hasRendered&&this.render()}_handleKeydown(r){if(this.getAttribute("tabindex")!==null&&(r.key===" "||r.key==="Enter")){r.preventDefault();let n=this.getAttribute("aria-label");if(n&&"speechSynthesis"in window){let o=new SpeechSynthesisUtterance(n);speechSynthesis.speak(o)}}}get mode(){let r=this.getAttribute("mode");return r==="textstyle"||r==="displaystyle"?r:this.getDefaultMathstyle()}set mode(r){this.setAttribute("mode",r)}get format(){let r=this.getAttribute("format");return r==="latex"||r==="ascii-math"||r==="math-json"?r:"latex"}set format(r){this.setAttribute("format",r)}get letterShapeStyle(){let r=this.getAttribute("letter-shape-style");if(r==="auto"||r==="tex"||r==="iso"||r==="french"||r==="upright")return r}set letterShapeStyle(r){r===void 0?this.removeAttribute("letter-shape-style"):this.setAttribute("letter-shape-style",r)}get macros(){var r;return(r=this.getAttribute("macros"))!=null?r:void 0}set macros(r){r===void 0?this.removeAttribute("macros"):this.setAttribute("macros",r)}get minFontScale(){let r=this.getAttribute("min-font-scale");return r?parseFloat(r):void 0}set minFontScale(r){r===void 0?this.removeAttribute("min-font-scale"):this.setAttribute("min-font-scale",String(r))}get maxMatrixCols(){let r=this.getAttribute("max-matrix-cols");return r?parseInt(r,10):void 0}set maxMatrixCols(r){r===void 0?this.removeAttribute("max-matrix-cols"):this.setAttribute("max-matrix-cols",String(r))}render(){var r,i,n;try{let o=(i=(r=this.textContent)==null?void 0:r.trim())!=null?i:"";if(!o){this._renderContainer.innerHTML="",this._errorFallback.style.display="none",this._renderContainer.style.display="none",this._removeMathML();return}this._contentSlot.textContent=o;let a,s=this.format;if(s==="ascii-math")a=Hc(o);else if(s==="math-json"){let u=JSON.parse(o);a=Bo(u)}else a=o;let l={defaultMode:this.mode==="displaystyle"?"math":"inline-math"};if(this.letterShapeStyle&&(l.letterShapeStyle=this.letterShapeStyle),this.macros)try{l.macros=JSON.parse(this.macros)}catch(u){console.warn("Invalid macros JSON:",u)}this.minFontScale!==void 0&&(l.minFontScale=this.minFontScale),this.maxMatrixCols!==void 0&&(l.maxMatrixCols=this.maxMatrixCols);let c=he(a,l);this._renderContainer.innerHTML=c,this._renderContainer.style.display=this.getDefaultDisplay(),this._errorFallback.style.display="none",this._updateAccessibility(a),this._hasRendered=!0,this.dispatchEvent(new CustomEvent("render",{bubbles:!0,composed:!0,detail:{format:s,content:a}}))}catch(o){console.error("MathLive static element render error:",o),this._renderContainer.style.display="none",this._errorFallback.textContent=(n=this.textContent)!=null?n:"",this._errorFallback.style.display="block",this._removeMathML(),this.dispatchEvent(new CustomEvent("render-error",{bubbles:!0,composed:!0,detail:{error:o,content:this.textContent}}))}}_updateAccessibility(r){if(!this.hasAttribute("aria-label"))try{let i=Oo(r);this.setAttribute("aria-label",i)}catch(i){console.warn("Could not generate speakable text:",i)}this.hasAttribute("role")||this.setAttribute("role","img"),this._addMathML(r)}_addMathML(r){try{let i=Do(r);this._mathMLContainer||(this._mathMLContainer=document.createElement("div"),this._mathMLContainer.style.position="absolute",this._mathMLContainer.style.width="1px",this._mathMLContainer.style.height="1px",this._mathMLContainer.style.overflow="hidden",this._mathMLContainer.style.clip="rect(0, 0, 0, 0)",this._mathMLContainer.setAttribute("aria-hidden","false"),this._shadowRoot.appendChild(this._mathMLContainer)),this._mathMLContainer.innerHTML=i}catch(i){console.warn("Could not generate MathML:",i)}}_removeMathML(){this._mathMLContainer&&(this._mathMLContainer.remove(),this._mathMLContainer=void 0)}},zo=class extends Js{getDefaultMathstyle(){return"textstyle"}getDefaultDisplay(){return"inline-flex"}},No=class extends Js{getDefaultMathstyle(){return"displaystyle"}getDefaultDisplay(){return"flex"}};function Cy(){var t,e,r,i;typeof window!="undefined"&&((t=window.customElements)!=null&&t.get("math-span")||(e=window.customElements)==null||e.define("math-span",zo),(r=window.customElements)!=null&&r.get("math-div")||(i=window.customElements)==null||i.define("math-div",No))}Cy();function Lt(){var t,e;return(e=globalThis[t=Symbol.for("io.cortexjs.mathlive")])!=null||(globalThis[t]={}),globalThis[Symbol.for("io.cortexjs.mathlive")]}function Ey(t){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>Gs(document.body,t)):Gs(document.body,t)}function Ty(t){if(typeof t=="string"){let e=document.getElementById(t);if(e===null)throw new Error(`The element with ID "${t}" could not be found.`);return e}return t}function Gs(t,e){var n,o,a,s;if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",()=>Gs(t,e));return}let r=Ty(t);if(!r)return;let i=e!=null?e:{};(n=i.renderToMarkup)!=null||(i.renderToMarkup=he),(o=i.renderToMathML)!=null||(i.renderToMathML=Do),(a=i.renderToSpeakableText)!=null||(i.renderToSpeakableText=Oo),(s=i.serializeToLatex)!=null||(i.serializeToLatex=Bo),iu(r,i)}var Dy={mathlive:"0.109.0"};return Xh(Oy);})(); Object.assign(exports, MathLive); Object.defineProperty(exports, '__esModule', { value: true });}));