fika-editor 3.0.25 → 3.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/embed/{482.js → 6311.js} +59 -59
  2. package/dist/embed/agentic-manifest.json +202 -12
  3. package/dist/embed/chunks/2020.js +75 -49
  4. package/dist/embed/fika-embed.css +2 -2
  5. package/dist/embed/fika-embed.js +3 -3
  6. package/dist/types/embed/agentic/layouts.d.ts +10 -0
  7. package/dist/types/embed/agentic/types.d.ts +7 -1
  8. package/dist/types/paint/rasterResources.d.ts +7 -0
  9. package/dist/types/paint/textPainter.d.ts +1 -0
  10. package/dist/types/utils/inlineMathBox.d.ts +10 -0
  11. package/dist/types/utils/markdown.d.ts +20 -0
  12. package/dist/types/utils/math.d.ts +15 -2
  13. package/dist/types/utils/portal.d.ts +7 -0
  14. package/dist/types/utils/textFit.d.ts +31 -0
  15. package/package.json +2 -2
  16. /package/dist/embed/{static/font/fonts → fonts}/Inter.woff2 +0 -0
  17. /package/dist/embed/{static/font/fonts → fonts}/JetBrainsMono.woff2 +0 -0
  18. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_AMS-Regular.woff2 +0 -0
  19. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Caligraphic-Bold.woff2 +0 -0
  20. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Caligraphic-Regular.woff2 +0 -0
  21. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Fraktur-Bold.woff2 +0 -0
  22. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Fraktur-Regular.woff2 +0 -0
  23. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Main-Bold.woff2 +0 -0
  24. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Main-BoldItalic.woff2 +0 -0
  25. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Main-Italic.woff2 +0 -0
  26. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Main-Regular.woff2 +0 -0
  27. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Math-BoldItalic.woff2 +0 -0
  28. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Math-Italic.woff2 +0 -0
  29. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_SansSerif-Bold.woff2 +0 -0
  30. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_SansSerif-Italic.woff2 +0 -0
  31. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_SansSerif-Regular.woff2 +0 -0
  32. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Script-Regular.woff2 +0 -0
  33. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Size1-Regular.woff2 +0 -0
  34. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Size2-Regular.woff2 +0 -0
  35. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Size3-Regular.woff2 +0 -0
  36. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Size4-Regular.woff2 +0 -0
  37. /package/dist/embed/{static/font/fonts → fonts}/KaTeX_Typewriter-Regular.woff2 +0 -0
  38. /package/dist/embed/{static/font/fonts → fonts}/Lato.woff2 +0 -0
  39. /package/dist/embed/{static/font/fonts → fonts}/Literata.woff2 +0 -0
  40. /package/dist/embed/{static/font/fonts → fonts}/Merriweather.woff2 +0 -0
  41. /package/dist/embed/{static/font/fonts → fonts}/Montserrat.woff2 +0 -0
  42. /package/dist/embed/{static/font/fonts → fonts}/OpenSans.woff2 +0 -0
  43. /package/dist/embed/{static/font/fonts → fonts}/Roboto.woff2 +0 -0
  44. /package/dist/embed/{static/font/fonts → fonts}/SourceSansPro.woff2 +0 -0
  45. /package/dist/embed/{static/font/fonts → fonts}/SourceSerif4.woff2 +0 -0
@@ -1,4 +1,4 @@
1
- export const __rspack_esm_id=2020;export const __rspack_esm_ids=[2020];export const __webpack_modules__={48623(e,i,r){r.r(i);var a,o,n,l,s=Object.defineProperty,c=Object.defineProperties,d=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,m=(e,i,r)=>i in e?s(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,f=(e,i)=>{for(var r in i||(i={}))h.call(i,r)&&m(e,r,i[r]);if(u)for(var r of u(i))p.call(i,r)&&m(e,r,i[r]);return e},g=(e,i)=>c(e,d(i)),b=e=>"symbol"==typeof e?e:e+"",y=(e,i)=>{var r={};for(var a in e)h.call(e,a)&&0>i.indexOf(a)&&(r[a]=e[a]);if(null!=e&&u)for(var a of u(e))0>i.indexOf(a)&&p.call(e,a)&&(r[a]=e[a]);return r};function v(){return"window"in globalThis&&"document"in globalThis}function x(){return"matchMedia"in window?window.matchMedia("(pointer: coarse)").matches:"ontouchstart"in window||navigator.maxTouchPoints>0}function _(){return"function"==typeof navigator.vibrate}function w(){var e,i;if(!v())return"other";let r=null!=(i=null==(e=navigator.userAgentData)?void 0:e.platform)?i:navigator.platform;return/^mac/i.test(r)?5===navigator.maxTouchPoints?"ios":"macos":/^win/i.test(r)?"windows":/android/i.test(navigator.userAgent)?"android":/iphone|ipod|ipad/i.test(navigator.userAgent)?"ios":/\bcros\b/i.test(navigator.userAgent)?"chromeos":"other"}function k(){return HTMLElement.prototype.hasOwnProperty("popover")}var M={id:"apple.en-intl",displayName:"English (international)",virtualLayout:"qwerty",platform:"apple",locale:"en",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["b","B","∫","ı"],KeyC:["c","C","ç","Ç"],KeyD:["d","D","∂","Î"],KeyE:["e","E","´","´"],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","#","£","‹"],Digit4:["4","$","¢","›"],Digit5:["5","%","∞","fi"],Digit6:["6","^","§","fl"],Digit7:["7","&","¶","‡"],Digit8:["8","*","•","°"],Digit9:["9","(","ª","·"],Digit0:["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:["§","±","§","±"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}},S={id:"windows.en-intl",displayName:"English (international)",platform:"windows",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","á","Á"],KeyB:["b","B","",""],KeyC:["c","C","©","¢"],KeyD:["d","D","ð","Ð"],KeyE:["e","E","é","É"],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","#","³",""],Digit4:["4","$","¤","£"],Digit5:["5","%","€",""],Digit6:["6","^","¼",""],Digit7:["7","&","½",""],Digit8:["8","*","¾",""],Digit9:["9","(","‘",""],Digit0:["0",")","’",""],Space:[" "," ","",""],Minus:["-","_","¥",""],Equal:["=","+","×","÷"],BracketLeft:["[","{","«",""],BracketRight:["]","}","»",""],Backslash:["\\","|","¬","¦"],Semicolon:[";",":","¶","°"],Quote:["'",'"',"´","¨"],Backquote:["`","~","",""],Comma:[",","<","ç","Ç"],Period:[".",">","",""],Slash:["/","?","¿",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["\\","|","",""]}},L={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:["<",">","|","¦"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}};function C(e){let i=e.split("+"),r={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:i.pop()};return i.includes("shift")&&(r.shift=!0),i.includes("alt")&&(r.alt=!0),i.includes("ctrl")&&(r.ctrl=!0),i.includes("cmd")&&(r.cmd=!0),i.includes("win")&&(r.win=!0),i.includes("meta")&&(r.meta=!0),r}function E(e){let i="";return e.shift&&(i+="shift+"),e.alt&&(i+="alt+"),e.ctrl&&(i+="ctrl+"),e.cmd&&(i+="cmd+"),e.win&&(i+="win+"),e.meta&&(i+="meta+"),i+e.key}var A,z={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]"},T=[];function D(){switch(w()){case"macos":case"ios":return"apple";case"windows":return"windows"}return"linux"}function K(e){e.platform&&e.platform!==D()||T.push(e)}function B(e){A=T.find(i=>e.startsWith(i.locale))}function $(){return null!=A?A:T[0]}switch(D()){case"apple":K(M),K({id:"apple.french",locale:"fr",displayName:"French",platform:"apple",virtualLayout:"azerty",score:0,mapping:{KeyA:["q","Q","‡","Ω"],KeyB:["b","B","ß","∫"],KeyC:["c","C","©","¢"],KeyD:["d","D","∂","∆"],KeyE:["e","E","ê","Ê"],KeyF:["f","F","ƒ","·"],KeyG:["g","G","fi","fl"],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:["é","2","ë","„"],Digit3:['"',"3","“","”"],Digit4:["'","4","‘","’"],Digit5:["(","5","{","["],Digit6:["§","6","¶","å"],Digit7:["è","7","«","»"],Digit8:["!","8","¡","Û"],Digit9:["ç","9","Ç","Á"],Digit0:["à","0","ø","Ø"],Space:[" "," "," "," "],Minus:[")","°","}","]"],Equal:["-","_","—","–"],BracketLeft:["^","¨","ô","Ô"],BracketRight:["$","*","€","¥"],Backslash:["`","£","@","#"],Semicolon:["m","M","µ","Ó"],Quote:["ù","%","Ù","‰"],Backquote:["<",">","≤","≥"],Comma:[";",".","…","•"],Period:[":","/","÷","\\"],Slash:["=","+","≠","±"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",".",",","."],IntlBackslash:["@","#","•","Ÿ"],NumpadEqual:["=","=","=","="]}}),K({id:"apple.spanish",locale:"es",displayName:"Spanish ISO",platform:"apple",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["b","B","ß",""],KeyC:["c","C","©"," "],KeyD:["d","D","∂","∆"],KeyE:["e","E","€","€"],KeyF:["f","F","ƒ","fi"],KeyG:["g","G","","fl"],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","·","#","•"],Digit4:["4","$","¢","£"],Digit5:["5","%","∞","‰"],Digit6:["6","&","¬"," "],Digit7:["7","/","÷","⁄"],Digit8:["8","(","“","‘"],Digit9:["9",")","”","’"],Digit0:["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:["º","ª","\\","°"]}}),K({id:"apple.german",locale:"de",displayName:"German",virtualLayout:"qwertz",platform:"apple",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["b","B","∫","‹"],KeyC:["c","C","ç","Ç"],KeyD:["d","D","∂","™"],KeyE:["e","E","€","‰"],KeyF:["f","F","ƒ","Ï"],KeyG:["g","G","©","Ì"],KeyH:["h","H","ª","Ó"],KeyI:["i","I","⁄","Û"],KeyJ:["j","J","º","ı"],KeyK:["k","K","∆","ˆ"],KeyL:["l","L","@","fl"],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:["z","Z","Ω","ˇ"],KeyZ:["y","Y","¥","‡"],Digit1:["1","!","¡","¬"],Digit2:["2",'"',"“","”"],Digit3:["3","§","¶","#"],Digit4:["4","$","¢","£"],Digit5:["5","%","[","fi"],Digit6:["6","&","]","^"],Digit7:["7","/","|","\\"],Digit8:["8","(","{","˜"],Digit9:["9",")","}","·"],Digit0:["0","=","≠","¯"],Space:[" "," "," "," "],Minus:["ß","?","¿","˙"],Equal:["´","`","'","˚"],BracketLeft:["ü","Ü","•","°"],BracketRight:["+","*","±",""],Backslash:["#","'","‘","’"],Semicolon:["ö","Ö","œ","Œ"],Quote:["ä","Ä","æ","Æ"],Backquote:["<",">","≤","≥"],Comma:[",",";","∞","˛"],Period:[".",":","…","÷"],Slash:["-","_","–","—"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",",",".","."],IntlBackslash:["^","°","„","“"],NumpadEqual:["=","=","=","="]}});break;case"windows":K(S),K({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","€",""],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:["é","2","~",""],Digit3:['"',"3","#",""],Digit4:["'","4","{",""],Digit5:["(","5","[",""],Digit6:["-","6","|",""],Digit7:["è","7","`",""],Digit8:["_","8","\\",""],Digit9:["ç","9","^",""],Digit0:["à","0","@",""],Space:[" "," ","",""],Minus:[")","°","]",""],Equal:["=","+","}",""],BracketLeft:["^","¨","",""],BracketRight:["$","£","¤",""],Backslash:["*","µ","",""],Semicolon:["m","M","",""],Quote:["ù","%","",""],Backquote:["²","","",""],Comma:[";",".","",""],Period:[":","/","",""],Slash:["!","§","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}}),K({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","€",""],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","·","#",""],Digit4:["4","$","~",""],Digit5:["5","%","€",""],Digit6:["6","&","¬",""],Digit7:["7","/","",""],Digit8:["8","(","",""],Digit9:["9",")","",""],Digit0:["0","=","",""],Space:[" "," ","",""],Minus:["'","?","",""],Equal:["¡","¿","",""],BracketLeft:["`","^","[",""],BracketRight:["+","*","]",""],Backslash:["ç","Ç","}",""],Semicolon:["ñ","Ñ","",""],Quote:["´","¨","{",""],Backquote:["º","ª","\\",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}}),K({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","€",""],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:["z","Z","",""],KeyZ:["y","Y","",""],Digit1:["1","!","",""],Digit2:["2",'"',"²",""],Digit3:["3","§","³",""],Digit4:["4","$","",""],Digit5:["5","%","",""],Digit6:["6","&","",""],Digit7:["7","/","{",""],Digit8:["8","(","[",""],Digit9:["9",")","]",""],Digit0:["0","=","}",""],Space:[" "," ","",""],Minus:["ß","?","\\","ẞ"],Equal:["´","`","",""],BracketLeft:["ü","Ü","",""],BracketRight:["+","*","~",""],Backslash:["#","'","",""],Semicolon:["ö","Ö","",""],Quote:["ä","Ä","",""],Backquote:["^","°","",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","|",""]}});break;case"linux":K(L),K({id:"linux.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"linux",score:0,mapping:{KeyA:["q","Q","@","Ω"],KeyB:["b","B","”","’"],KeyC:["c","C","¢","©"],KeyD:["d","D","ð","Ð"],KeyE:["e","E","€","¢"],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","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:["é","2","~","⅛"],Digit3:['"',"3","#","£"],Digit4:["'","4","{","$"],Digit5:["(","5","[","⅜"],Digit6:["-","6","|","⅝"],Digit7:["è","7","`","⅞"],Digit8:["_","8","\\","™"],Digit9:["ç","9","^","±"],Digit0:["à","0","@","°"],Enter:["\r","\r","\r","\r"],Escape:["\x1b","\x1b","\x1b","\x1b"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:[")","°","]","¿"],Equal:["=","+","}","̨"],BracketLeft:["̂","̈","̈","̊"],BracketRight:["$","£","¤","̄"],Backslash:["*","µ","̀","̆"],Semicolon:["m","M","µ","º"],Quote:["ù","%","̂","̌"],Backquote:["²","~","¬","¬"],Comma:[";",".","─","×"],Period:[":","/","·","÷"],Slash:["!","§","̣","̇"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","¦"]}}),K({id:"linux.spanish",locale:"es",displayName:"Spanish",platform:"linux",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","æ","Æ"],KeyB:["b","B","”","’"],KeyC:["c","C","¢","©"],KeyD:["d","D","ð","Ð"],KeyE:["e","E","€","¢"],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","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","·","#","£"],Digit4:["4","$","~","$"],Digit5:["5","%","½","⅜"],Digit6:["6","&","¬","⅝"],Digit7:["7","/","{","⅞"],Digit8:["8","(","[","™"],Digit9:["9",")","]","±"],Digit0:["0","=","}","°"],Enter:["\r","\r","\r","\r"],Escape:["\x1b","\x1b","\x1b","\x1b"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["'","?","\\","¿"],Equal:["¡","¿","̃","~"],BracketLeft:["̀","̂","[","̊"],BracketRight:["+","*","]","̄"],Backslash:["ç","Ç","}","̆"],Semicolon:["ñ","Ñ","~","̋"],Quote:["́","̈","{","{"],Backquote:["º","ª","\\","\\"],Comma:[",",";","─","×"],Period:[".",":","·","÷"],Slash:["-","_","̣","̇"],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:["<",">","|","¦"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}}),K({id:"linux.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","€","€"],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:["z","Z","←","¥"],KeyZ:["y","Y","»","›"],Digit1:["1","!","¹","¡"],Digit2:["2",'"',"²","⅛"],Digit3:["3","§","³","£"],Digit4:["4","$","¼","¤"],Digit5:["5","%","½","⅜"],Digit6:["6","&","¬","⅝"],Digit7:["7","/","{","⅞"],Digit8:["8","(","[","™"],Digit9:["9",")","]","±"],Digit0:["0","=","}","°"],Enter:["\r","\r","\r","\r"],Escape:["\x1b","\x1b","\x1b","\x1b"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["ß","?","\\","¿"],Equal:["́","̀","̧","̨"],BracketLeft:["ü","Ü","̈","̊"],BracketRight:["+","*","~","¯"],Backslash:["#","'","’","̆"],Semicolon:["ö","Ö","̋","̣"],Quote:["ä","Ä","̂","̌"],Backquote:["̂","°","′","″"],Comma:[",",";","·","×"],Period:[".",":","…","÷"],Slash:["-","_","–","—"],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:["<",">","|","̱"],AltRight:["\r","\r","\r","\r"],MetaRight:[".",".",".","."]}})}function P(e){A=T.find(i=>i.id===e)}function O(e){B(e)}function I(e){return Array.isArray(e)}K({id:"dvorak",locale:"en",displayName:"Dvorak",virtualLayout:"dvorak",platform:"",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["x","X","≈","˛"],KeyC:["j","J","∆","Ô"],KeyD:["e","E","´","´"],KeyE:[".",">","≥","˘"],KeyF:["u","U","¨","¨"],KeyG:["i","I","ˆ","ˆ"],KeyH:["d","D","∂","Î"],KeyI:["c","C","ç","Ç"],KeyJ:["h","H","˙","Ó"],KeyK:["t","T","†","ˇ"],KeyL:["n","N","˜","˜"],KeyM:["m","M","µ","Â"],KeyN:["b","B","∫","ı"],KeyO:["r","R","®","‰"],KeyP:["l","L","¬","Ò"],KeyQ:["'",'"',"æ","Æ"],KeyR:["p","P","π","∏"],KeyS:["o","O","ø","Ø"],KeyT:["y","Y","¥","Á"],KeyU:["g","G","©","˝"],KeyV:["k","K","˚",""],KeyW:[",","<","≤","¯"],KeyX:["q","Q","œ","Œ"],KeyY:["f","F","ƒ","Ï"],KeyZ:[";",":","…","Ú"],Digit1:["1","!","¡","⁄"],Digit2:["2","@","™","€"],Digit3:["3","#","£","‹"],Digit4:["4","$","¢","›"],Digit5:["5","%","∞","fi"],Digit6:["6","^","§","fl"],Digit7:["7","&","¶","‡"],Digit8:["8","*","•","°"],Digit9:["9","(","ª","·"],Digit0:["0",")","º","‚"],Space:[" "," "," "," "],Minus:["[","{","“","”"],Equal:["]","}","‘","’"],BracketLeft:["/","?","÷","¿"],BracketRight:["=","+","≠","±"],Backslash:["\\","|","«","»"],Semicolon:["s","S","ß","Í"],Quote:["-","_","–","—"],Backquote:["`","~","`","`"],Comma:["w","W","∑","„"],Period:["v","V","√","◊"],Slash:["z","Z","Ω","¸"],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:["§","±","§","±"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}});var R={strings:{en:{"keyboard.tooltip.symbols":"Symbols","keyboard.tooltip.greek":"Greek Letters","keyboard.tooltip.numeric":"Numeric","keyboard.tooltip.alphabetic":"Roman Letters","keyboard.tooltip.previous rows":"Previous rows","keyboard.tooltip.next rows":"Next rows","keyboard.tooltip.resize":"Resize virtual keyboard","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":"n<sup>th</sup> 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":"n<sup>th</sup> 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":"%@ × %@","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":"حرف او رمز","keyboard.tooltip.greek":"حروف يونانية","keyboard.tooltip.numeric":"الرقمية","keyboard.tooltip.alphabetic":"رموز الاحرف الرومانية","tooltip.copy to clipboard":"نسخ إلى الحافظة","tooltip.cut to clipboard":"قص إلى الحافظة","tooltip.paste from clipboard":"لصق من الحافظة","tooltip.redo":"الإعادة","tooltip.toggle virtual keyboard":"تبديل لوحة المفاتيح الإفتراضية","tooltip.undo":"إلغاء","menu.insert matrix":"أدخل المصفوفة","menu.borders":"محددات المصفوفة","menu.array.add row above":"أضف صفًا بعد ذلك","menu.array.add row below":"أضف الصف قبل","menu.array.add column after":"أضف العمود بعد ذلك","menu.array.add column before":"أضف العمود قبل","menu.array.delete row":"احذف صف","menu.array.delete rows":"حذف الصفوف المحددة","menu.array.delete column":"حذف العمود","menu.array.delete columns":"حذف الأعمدة المحددة","menu.mode":"وضع","menu.mode-math":"رياضيات","menu.mode-text":"نص","menu.mode-latex":"لاتكس","tooltip.blackboard":"سبورة","tooltip.bold":"عريض","tooltip.italic":"مائل","tooltip.fraktur":"فراكتور","tooltip.script":"سكريبت","tooltip.caligraphic":"كاليجرافيك","tooltip.typewriter":"آلة كاتبة","tooltip.roman-upright":"روماني مستقيم","tooltip.row-by-col":"%@ × %@","menu.font-style":"نمط الخط","menu.accent":"تشكيل","menu.decoration":"زخرفة","menu.color":"لون","menu.background-color":"الخلفية","menu.evaluate":"تقييم","menu.simplify":"تبسيط","menu.solve":"حل","menu.solve-for":"حل لـ %@","menu.cut":"قص","menu.copy":"نسخ","menu.copy-as-latex":"نسخ كـ LaTeX","menu.copy-as-ascii-math":"نسخ كـ ASCII Math","menu.copy-as-mathml":"نسخ كـ MathML","menu.paste":"لصق","menu.select-all":"تحديد الكل","color.red":"أحمر","color.orange":"برتقالي","color.yellow":"أصفر","color.lime":"ليموني","color.green":"أخضر","color.teal":"سماوي","color.cyan":"سماوي فاتح","color.blue":"أزرق","color.indigo":"نيلي","color.purple":"بنفسجي","color.magenta":"أرجواني","color.black":"أسود","color.dark-grey":"رمادي غامق","color.grey":"رمادي","color.light-grey":"رمادي فاتح","color.white":"أبيض"},de:{"keyboard.tooltip.symbols":"Symbole","keyboard.tooltip.greek":"Griechische Buchstaben","keyboard.tooltip.numeric":"Numerisch","keyboard.tooltip.alphabetic":"Römische 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ügen","menu.borders":"Matrixtrennzeichen","menu.array.add row above":"Zeile hinzufügen nach","menu.array.add row below":"Zeile hinzufügen vor","menu.array.add column after":"Spalte hinzufügen nach","menu.array.add column before":"Spalte hinzufügen vor","menu.array.delete row":"Zeile löschen","menu.array.delete rows":"Ausgewählte Zeilen löschen","menu.array.delete column":"Spalte löschen","menu.array.delete columns":"Ausgewählte Spalten löschen","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ömisch aufrecht","tooltip.row-by-col":"%@ × %@","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ösen","menu.solve-for":"Lösen für %@","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ügen","menu.select-all":"Alles auswählen","color.red":"Rot","color.orange":"Orange","color.yellow":"Gelb","color.lime":"Limette","color.green":"Grün","color.teal":"Blaugrün","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ß"},el:{"keyboard.tooltip.symbols":"σύμβολα","keyboard.tooltip.greek":"ελληνικά γράμματα","keyboard.tooltip.numeric":"Αριθμητικός","keyboard.tooltip.alphabetic":"Ρωμαϊκά γράμματα","tooltip.copy to clipboard":"Αντιγραφή στο πρόχειρο","tooltip.redo":"Ξανακάνω","tooltip.toggle virtual keyboard":"Εναλλαγή εικονικού πληκτρολογίου","tooltip.undo":"Ξεκάνω","menu.insert matrix":"Εισαγωγή μήτρα","menu.borders":"Οριοθέτες μήτρα","menu.array.add row above":"Προσθήκη σειράς μετά","menu.array.add row below":"Προσθήκη σειράς πριν","menu.array.add column after":"Προσθήκη στήλης μετά","menu.array.add column before":"Προσθήκη στήλης πριν","menu.array.delete row":"Διαγραφή σειράς","menu.array.delete rows":"Διαγραφή επιλεγμένων σειρών","menu.array.delete column":"Διαγραφή στήλης","menu.array.delete columns":"Διαγραφή επιλεγμένων στηλών","menu.mode":"Λειτουργία","menu.mode-math":"Μαθηματικά","menu.mode-text":"Κείμενο","menu.mode-latex":"LaTeX","tooltip.blackboard":"Πίνακας","tooltip.bold":"Έντονη","tooltip.italic":"Πλάγια","tooltip.fraktur":"Φράκτουρ","tooltip.script":"Σενάριο","tooltip.caligraphic":"Καλλιγραφική","tooltip.typewriter":"Μηχανή γραφής","tooltip.roman-upright":"Ρωμαϊκό Κατακόρυφο","tooltip.row-by-col":"%@ × %@","menu.font-style":"Στυλ γραμματοσειράς","menu.accent":"Τόνος","menu.decoration":"Διακόσμηση","menu.color":"Χρώμα","menu.background-color":"Χρώμα φόντου","menu.evaluate":"Αξιολόγηση","menu.simplify":"Απλοποίηση","menu.solve":"Λύση","menu.solve-for":"Λύση για %@","menu.cut":"Αποκοπή","menu.copy":"Αντιγραφή","menu.copy-as-latex":"Αντιγραφή ως LaTeX","menu.copy-as-ascii-math":"Αντιγραφή ως ASCII Math","menu.copy-as-mathml":"Αντιγραφή ως MathML","menu.paste":"Επικόλληση","menu.select-all":"Επιλογή όλων","color.red":"Κόκκινο","color.orange":"Πορτοκαλί","color.yellow":"Κίτρινο","color.lime":"Λαχανί","color.green":"Πράσινο","color.teal":"Κυανό","color.cyan":"Γαλάζιο","color.blue":"Μπλε","color.indigo":"Ινδικό","color.purple":"Μωβ","color.magenta":"Ματζέντα","color.black":"Μαύρο","color.dark-grey":"Σκούρο Γκρι","color.grey":"Γκρι","color.light-grey":"Ανοιχτό Γκρι","color.white":"Λευκό"},es:{"keyboard.tooltip.symbols":"Símbolos","keyboard.tooltip.greek":"Letras griegas","keyboard.tooltip.numeric":"Numérico","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ñadir Matriz","menu.borders":"Delimitadores de Matriz","menu.array.add row above":"Añadir Línea Antes","menu.array.add row below":"Añadir Línea Despues","menu.array.add column after":"Añadir Columna Despues","menu.array.add column before":"Añadir Columna Antes","menu.array.delete row":"Borrar Línea","menu.array.delete rows":"Borrar Líneas Seleccionadas","menu.array.delete column":"Borrar Columna","menu.array.delete columns":"Borrar Columnas Seleccionadas","menu.mode":"Modo","menu.mode-math":"Matemáticas","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áfico","tooltip.typewriter":"Máquina de escribir","tooltip.roman-upright":"Romano Vertical","tooltip.row-by-col":"%@ × %@","menu.font-style":"Estilo de fuente","menu.accent":"Acento","menu.decoration":"Decoración","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":"Índigo","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érique","keyboard.tooltip.alphabetic":"Lettres romaines","tooltip.menu":"Menu","tooltip.copy to clipboard":"Copier dans le presse-papiers","tooltip.redo":"Rétablir","tooltip.toggle virtual keyboard":"Afficher/Masquer le clavier virtuel","tooltip.undo":"Annuler","menu.insert matrix":"Insérer une Matrice","menu.borders":"Bords","menu.array.add row above":"Ajouter une Ligne Avant","menu.array.add row below":"Ajouter une Ligne Après","menu.array.add column before":"Ajouter une Colonne Avant","menu.array.add column after":"Ajouter une Colonne Après","menu.array.delete row":"Enlever une Ligne","menu.array.delete rows":"Enlever les Lignes Sélectionées","menu.array.delete column":"Enlever une Colone","menu.array.delete columns":"Enlever les Colonnes Sélectionées","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 à écrire","tooltip.roman-upright":"Romain droit","tooltip.row-by-col":"%@ × %@","menu.font-style":"Style de police","menu.accent":"Accent","menu.decoration":"Décoration","menu.color":"Couleur","menu.background-color":"Arrière-plan","menu.evaluate":"Évaluer","menu.simplify":"Simplifier","menu.solve":"Résoudre","menu.solve-for":"Résoudre 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électionner 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é","color.grey":"Gris","color.light-grey":"Gris clair","color.white":"Blanc"},he:{"keyboard.tooltip.symbols":"סמלים","keyboard.tooltip.greek":"אותיות יווניות","keyboard.tooltip.numeric":"מספרי","keyboard.tooltip.alphabetic":"מכתבים רומיים","tooltip.copy to clipboard":"העתק ללוח","tooltip.redo":"לַעֲשׂוֹת שׁוּב","tooltip.toggle virtual keyboard":"החלף את המקלדת הווירטואלית","tooltip.undo":"לבטל","menu.insert matrix":"הכנס מטריקס","menu.borders":"מפרידי מטריקס","menu.array.add row above":"הוסף שורה אחרי","menu.array.add row below":"הוסף שורה לפני","menu.array.add column after":"הוסף עמודה אחרי","menu.array.add column before":"הוסף עמודה לפני","menu.array.delete row":"מחק שורה","menu.array.delete rows":"מחק שורות שנבחרו","menu.array.delete column":"מחק עמודה","menu.array.delete columns":"מחק עמודות שנבחרו","menu.mode":"מצב","menu.mode-math":"מתמטיקה","menu.mode-text":"טקסט","menu.mode-latex":"LaTeX","tooltip.blackboard":"לוח שחור","tooltip.bold":"מודגש","tooltip.italic":"נטוי","tooltip.fraktur":"פרקטור","tooltip.script":"כתב","tooltip.caligraphic":"קליגרפי","tooltip.typewriter":"מכונת כתיבה","tooltip.roman-upright":"רומי ישר","tooltip.row-by-col":"%@ × %@","menu.font-style":"סגנון גופן","menu.accent":"צליל","menu.decoration":"קישוט","menu.color":"צבע","menu.background-color":"רקע","menu.evaluate":"חשב","menu.simplify":"פשט","menu.solve":"פתור","menu.solve-for":"פתור עבור %@","menu.cut":"גזור","menu.copy":"העתק","menu.copy-as-latex":"העתק כ־LaTeX","menu.copy-as-ascii-math":"העתק כ־ASCII Math","menu.copy-as-mathml":"העתק כ־MathML","menu.paste":"הדבק","menu.select-all":"בחר הכל","color.red":"אדום","color.orange":"כתום","color.yellow":"צהוב","color.lime":"ירוק ליים","color.green":"ירוק","color.teal":"טיל","color.cyan":"ציאן","color.blue":"כחול","color.indigo":"אינדיגו","color.purple":"סגול","color.magenta":"מגנטה","color.black":"שחור","color.dark-grey":"אפור כהה","color.grey":"אפור","color.light-grey":"אפור בהיר","color.white":"לבן"},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à","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":"%@ × %@","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":"シンボル","keyboard.tooltip.greek":"ギリシャ文字","keyboard.tooltip.numeric":"数値","keyboard.tooltip.alphabetic":"ローマ字","tooltip.menu":"メニュー","tooltip.copy to clipboard":"クリップボードにコピー","tooltip.redo":"やり直し","tooltip.toggle virtual keyboard":"仮想キーボードの切り替え","tooltip.undo":"元に戻す","menu.insert matrix":"マトリックスを挿入","menu.borders":"行列区切り文字","menu.array.add row above":"後に行を追加","menu.array.add row below":"前に行を追加","menu.array.add column after":"後に列を追加","menu.array.add column before":"前に列を追加","menu.array.delete row":"行を削除","menu.array.delete rows":"選択した行を削除する","menu.array.delete column":"列を削除","menu.array.delete columns":"選択した列を削除する","menu.mode":"モード","menu.mode-math":"数式","menu.mode-text":"テキスト","menu.mode-latex":"LaTeX","tooltip.blackboard":"黒板","tooltip.bold":"太字","tooltip.italic":"イタリック","tooltip.fraktur":"フラクトゥール","tooltip.script":"スクリプト","tooltip.caligraphic":"カリグラフィック","tooltip.typewriter":"タイプライター","tooltip.roman-upright":"ローマ直立","tooltip.row-by-col":"%@ × %@","menu.font-style":"フォントスタイル","menu.accent":"アクセント","menu.decoration":"装飾","menu.color":"色","menu.background-color":"背景","menu.evaluate":"評価","menu.simplify":"簡略化","menu.solve":"解く","menu.solve-for":"%@ を解く","menu.cut":"切り取り","menu.copy":"コピー","menu.copy-as-latex":"LaTeXとしてコピー","menu.copy-as-ascii-math":"ASCII Mathとしてコピー","menu.copy-as-mathml":"MathMLとしてコピー","menu.paste":"貼り付け","menu.select-all":"すべて選択","color.red":"赤","color.orange":"オレンジ","color.yellow":"黄色","color.lime":"ライム","color.green":"緑","color.teal":"ティール","color.cyan":"シアン","color.blue":"青","color.indigo":"インディゴ","color.purple":"紫","color.magenta":"マゼンタ","color.black":"黒","color.dark-grey":"濃いグレー","color.grey":"グレー","color.light-grey":"薄いグレー","color.white":"白"},ko:{"keyboard.tooltip.symbols":"기호","keyboard.tooltip.greek":"그리스 문자","keyboard.tooltip.numeric":"숫자","keyboard.tooltip.alphabetic":"로마 문자","tooltip.copy to clipboard":"클립 보드에 복사","tooltip.redo":"다시 실행","tooltip.toggle virtual keyboard":"가상 키보드 전환","tooltip.undo":"실행 취소","menu.insert matrix":"행렬 삽입","menu.borders":"행렬 구분 기호","menu.array.add row above":"뒤에 행 추가","menu.array.add row below":"앞에 행 추가","menu.array.add column after":"뒤에 열 추가","menu.array.add column before":"앞에 열 추가","menu.array.delete row":"행 삭제","menu.array.delete rows":"선택한 행 삭제","menu.array.delete column":"열 삭제","menu.array.delete columns":"선택한 열 삭제","menu.mode":"모드","menu.mode-math":"수식","menu.mode-text":"텍스트","menu.mode-latex":"LaTeX","tooltip.blackboard":"칠판","tooltip.bold":"굵게","tooltip.italic":"이탤릭","tooltip.fraktur":"프랙투어","tooltip.script":"첨자","tooltip.caligraphic":"필기체","tooltip.typewriter":"타자기","tooltip.roman-upright":"일반 로마자","tooltip.row-by-col":"%@ × %@","menu.font-style":"글꼴 스타일","menu.accent":"발음 기호","menu.decoration":"장식","menu.color":"색상","menu.background-color":"배경","menu.evaluate":"평가","menu.simplify":"간소화","menu.solve":"해결","menu.solve-for":"%@에 대해 해결","menu.cut":"잘라내기","menu.copy":"복사","menu.copy-as-latex":"LaTeX로 복사","menu.copy-as-ascii-math":"ASCIIMath로 복사","menu.copy-as-mathml":"MathML로 복사","menu.paste":"붙여넣기","menu.select-all":"모두 선택","color.red":"빨강","color.orange":"주황","color.yellow":"노랑","color.lime":"라임","color.green":"초록","color.teal":"청록","color.cyan":"청색","color.blue":"파랑","color.indigo":"남색","color.purple":"보라","color.magenta":"자홍","color.black":"검정","color.dark-grey":"진한 회색","color.grey":"회색","color.light-grey":"연한 회색","color.white":"흰색"},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óć","tooltip.toggle virtual keyboard":"Przełącz klawiaturę wirtualną","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ę po","menu.array.add column before":"Dodaj kolumnę przed","menu.array.delete row":"Usuń wiersz","menu.array.delete rows":"Usuń wybrane wiersze","menu.array.delete column":"Usuń kolumnę","menu.array.delete columns":"Usuń wybrane kolumny","menu.mode":"Tryb","menu.mode-math":"Formuła","menu.mode-text":"Tekst","menu.mode-latex":"LaTeX","menu.insert":"Wstaw","menu.insert.abs":"Wartość bezwzględna","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óżniczkowy i całkowy","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ędu","menu.insert.nth-derivative-template":"\\dfrac{\\mathrm{d}^n}{\\mathrm{d}x^n}f(x)\\bigm|_{x=a}","menu.insert.integral":"Całka","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ł","menu.insert.modulus-template":"\\lvert z \\rvert","menu.insert.argument":"Argument","menu.insert.argument-template":"\\arg(z)","menu.insert.real-part":"Część rzeczywista","menu.insert.real-part-template":"\\Re(z)","menu.insert.imaginary-part":"Część urojona","menu.insert.imaginary-part-template":"\\Im(z)","menu.insert.conjugate":"Sprzężenie","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":"%@ × %@","menu.font-style":"Styl czcionki","menu.accent":"Akcent","menu.decoration":"Dekoracja","menu.color":"Kolor","menu.background-color":"Tło","menu.evaluate":"Oblicz","menu.simplify":"Uprość","menu.solve":"Rozwiąż","menu.solve-for":"Rozwiąż 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ńczowy","color.yellow":"Żółty","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ły"},pt:{"keyboard.tooltip.symbols":"Símbolos","keyboard.tooltip.greek":"Letras gregas","keyboard.tooltip.numeric":"Numérico","keyboard.tooltip.alphabetic":"Letras romanas","tooltip.copy to clipboard":"Copiar para área de transferência","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órmula","menu.mode-text":"Texto","menu.mode-latex":"LaTeX","tooltip.blackboard":"Quadro Negro","tooltip.bold":"Negrito","tooltip.italic":"Itálico","tooltip.fraktur":"Fraktur","tooltip.script":"Script","tooltip.caligraphic":"Caligráfico","tooltip.typewriter":"Máquina de Escrever","tooltip.roman-upright":"Romano Vertical","tooltip.row-by-col":"%@ × %@","menu.font-style":"Estilo da Fonte","menu.accent":"Acento","menu.decoration":"Decoração","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":"Índigo","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":"Символи","keyboard.tooltip.greek":"Грецькі літери","keyboard.tooltip.numeric":"Числовий","keyboard.tooltip.alphabetic":"Римські літери","tooltip.copy to clipboard":"Копіювати в буфер обміну","tooltip.cut to clipboard":"Вирізати в буфер обміну","tooltip.paste from clipboard":"Вставити з буфера обміну","tooltip.redo":"Повторити","tooltip.toggle virtual keyboard":"Переключити віртуальну клавіатуру","tooltip.menu":"Меню","tooltip.undo":"Скасувати","menu.borders":"Межі","menu.insert matrix":"Вставити матрицю","menu.array.add row above":"Додати рядок перед","menu.array.add row below":"Додати рядок після","menu.array.add column after":"Додати стовпець після","menu.array.add column before":"Додати стовпець перед","menu.array.delete row":"Видалити рядок","menu.array.delete rows":"Видалити вибрані рядки","menu.array.delete column":"Видалити стовпець","menu.array.delete columns":"Видалити вибрані стовпці","menu.mode":"Режим","menu.mode-math":"Математика","menu.mode-text":"Текст","menu.mode-latex":"LaTeX","menu.insert":"Вставити","menu.insert.abs":"Абсолютне значення","menu.insert.abs-template":"\\left|x\\right|","menu.insert.nth-root":"Корінь n-го степеня","menu.insert.nth-root-template":"\\sqrt[n]{x}","menu.insert.log-base":"Логарифм за основою a","menu.insert.log-base-template":"\\log_a(x)","menu.insert.heading-calculus":"Обчислення","menu.insert.derivative":"Похідна","menu.insert.derivative-template":"\\dfrac{\\mathrm{d}}{\\mathrm{d}x}f(x)\\bigm|_{x=a}","menu.insert.nth-derivative":"Похідна n-го порядку","menu.insert.nth-derivative-template":"\\dfrac{\\mathrm{d}^n}{\\mathrm{d}x^n}f(x)\\bigm|_{x=a}","menu.insert.integral":"Інтеграл","menu.insert.integral-template":"$\\int_a^b f(x)\\,\\mathrm{d}x$","menu.insert.sum":"Сума","menu.insert.sum-template":"$\\sum_{i=1}^n x_i$","menu.insert.product":"Добуток","menu.insert.product-template":"\\prod_{i=1}^n x_i","menu.insert.heading-complex-numbers":"Комплексні числа","menu.insert.modulus":"Модуль","menu.insert.modulus-template":"\\lvert z \\rvert","menu.insert.argument":"Аргумент","menu.insert.argument-template":"\\arg(z)","menu.insert.real-part":"Дійсна частина","menu.insert.real-part-template":"\\Re(z)","menu.insert.imaginary-part":"Уявна частина","menu.insert.imaginary-part-template":"\\Im(z)","menu.insert.conjugate":"Спряжене число","menu.insert.conjugate-template":"\\overline{z}","tooltip.blackboard":"Дошка","tooltip.bold":"Жирний","tooltip.italic":"Курсив","tooltip.fraktur":"Фрактурний","tooltip.script":"Рукописний","tooltip.caligraphic":"Каліграфічний","tooltip.typewriter":"Друкарський","tooltip.roman-upright":"Прямий римський","tooltip.row-by-col":"%@ × %@","menu.font-style":"Стиль шрифту","menu.accent":"Акцент","menu.decoration":"Оформлення","menu.color":"Колір","menu.background-color":"Фон","menu.evaluate":"Обчислити","menu.simplify":"Спростити","menu.solve":"Розв’язати","menu.solve-for":"Розв’язати для %@","menu.cut":"Вирізати","menu.copy":"Копіювати","menu.copy-as-latex":"Копіювати як LaTeX","menu.copy-as-ascii-math":"Копіювати як ASCII Math","menu.copy-as-mathml":"Копіювати як MathML","menu.paste":"Вставити","menu.select-all":"Вибрати все","color.red":"Червоний","color.orange":"Помаранчевий","color.yellow":"Жовтий","color.lime":"Лаймовий","color.green":"Зелений","color.teal":"Бірюзовий","color.cyan":"Синьо-зелений","color.blue":"Синій","color.indigo":"Індиго","color.purple":"Фіолетовий","color.magenta":"Пурпурний","color.black":"Чорний","color.dark-grey":"Темно-сірий","color.grey":"Сірий","color.light-grey":"Світло-сірий","color.white":"Білий"},"zh-cn":{"keyboard.tooltip.symbols":"符号","keyboard.tooltip.greek":"希腊字母","keyboard.tooltip.numeric":"数字","keyboard.tooltip.alphabetic":"罗马字母","tooltip.copy to clipboard":"复制到剪贴板","tooltip.redo":"重做","tooltip.toggle virtual keyboard":"切换虚拟键盘","tooltip.undo":"撤消","menu.insert matrix":"插入矩阵","menu.borders":"矩阵分隔符","menu.array.add row above":"在后面添加行","menu.array.add row below":"在前面添加行","menu.array.add column after":"在后面添加列r","menu.array.add column before":"在前面添加列","menu.array.delete row":"删除行","menu.array.delete rows":"删除选定行","menu.array.delete column":"删除列","menu.array.delete columns":"删除选定的列","menu.mode":"模式","menu.mode-math":"数学","menu.mode-text":"文本","menu.mode-latex":"LaTeX","tooltip.blackboard":"黑板","tooltip.bold":"粗体","tooltip.italic":"斜体","tooltip.fraktur":"Fraktur","tooltip.script":"脚本","tooltip.caligraphic":"草书","tooltip.typewriter":"打字机","tooltip.roman-upright":"罗马直立","tooltip.row-by-col":"%@ × %@","menu.font-style":"字体样式","menu.accent":"重音","menu.decoration":"装饰","menu.color":"颜色","menu.background-color":"背景","menu.evaluate":"计算","menu.simplify":"简化","menu.solve":"求解","menu.solve-for":"求解 %@","menu.cut":"剪切","menu.copy":"复制","menu.copy-as-latex":"复制为 LaTeX","menu.copy-as-ascii-math":"复制为 ASCII Math","menu.copy-as-mathml":"复制为 MathML","menu.paste":"粘贴","menu.select-all":"全选","color.red":"红色","color.orange":"橙色","color.yellow":"黄色","color.lime":"绿黄色","color.green":"绿色","color.teal":"青色","color.cyan":"蓝绿色","color.blue":"蓝色","color.indigo":"靛蓝色","color.purple":"紫色","color.magenta":"洋红色","color.black":"黑色","color.dark-grey":"深灰色","color.grey":"灰色","color.light-grey":"浅灰色","color.white":"白色"},"zh-tw":{"keyboard.tooltip.symbols":"符號","keyboard.tooltip.greek":"希臘字母","keyboard.tooltip.numeric":"數字","keyboard.tooltip.alphabetic":"羅馬字母","tooltip.copy to clipboard":"複製到剪貼板","tooltip.redo":"重做","tooltip.toggle virtual keyboard":"切換虛擬鍵盤","tooltip.undo":"撤消","menu.insert matrix":"插入矩陣","menu.borders":"矩陣分隔符","menu.array.add row above":"在後面添加行","menu.array.add row below":"在前面添加行","menu.array.add column after":"在後面添加列","menu.array.add column before":"在前面添加列","menu.array.delete row":"刪除行","menu.array.delete rows":"刪除選定行","menu.array.delete column":"刪除列","menu.array.delete columns":"刪除選定的列","menu.mode":"模式","menu.mode-math":"數學","menu.mode-text":"文本","menu.mode-latex":"LaTeX","tooltip.blackboard":"黑板","tooltip.bold":"粗體","tooltip.italic":"斜體","tooltip.fraktur":"Fraktur","tooltip.script":"腳本","tooltip.caligraphic":"草書","tooltip.typewriter":"打字機","tooltip.roman-upright":"羅馬直立","tooltip.row-by-col":"%@ × %@","menu.font-style":"字體樣式","menu.accent":"重音","menu.decoration":"裝飾","menu.color":"顏色","menu.background-color":"背景","menu.evaluate":"計算","menu.simplify":"簡化","menu.solve":"求解","menu.solve-for":"求解 %@","menu.cut":"剪下","menu.copy":"複製","menu.copy-as-latex":"複製為 LaTeX","menu.copy-as-ascii-math":"複製為 ASCII Math","menu.copy-as-mathml":"複製為 MathML","menu.paste":"貼上","menu.select-all":"全選","color.red":"紅色","color.orange":"橙色","color.yellow":"黃色","color.lime":"綠黃色","color.green":"綠色","color.teal":"青色","color.cyan":"藍綠色","color.blue":"藍色","color.indigo":"靛藍色","color.purple":"紫色","color.magenta":"洋紅色","color.black":"黑色","color.dark-grey":"深灰色","color.grey":"灰色","color.light-grey":"淺灰色","color.white":"白色"}},_locale:"",_dirty:!1,_subscribers:[],_numberFormatter:void 0,get locale(){return R._locale||(R._locale=v()?navigator.language.slice(0,5):"en-US"),R._locale},set locale(t){R._locale=t,R._numberFormatter=void 0,R.dirty=!0},get numberFormatter(){if(!R._numberFormatter)try{R._numberFormatter=new Intl.NumberFormat(R.locale)}catch(e){try{R._numberFormatter=new Intl.NumberFormat(R.locale.slice(0,2))}catch(e){R._numberFormatter=new Intl.NumberFormat("en-US")}}return R._numberFormatter},merge(e,i){if("string"==typeof e&&i)R.strings[e]=f(f({},R.strings[e]),i),R.dirty=!0;else for(let i of Object.keys(e))R.merge(i,e[i])},get dirty(){return R._dirty},set dirty(t){R._dirty||R._dirty===t||(R._dirty=!0,setTimeout(()=>{R._dirty=!1,this._subscribers.forEach(e=>null==e?void 0:e())},0))},subscribe:e=>(R._subscribers.push(e),R._subscribers.length-1),unsubscribe(e){e<0||e>=R._subscribers.length||(R._subscribers[e]=void 0)},update(e){let i=e.querySelectorAll("[data-l10n-tooltip]");for(let e of i){let i=e.getAttribute("data-l10n-tooltip");if(i){let r=N(i);r&&e.setAttribute("data-tooltip",r)}}for(let r of i=e.querySelectorAll("[data-l10n-arial-label]")){let e=r.getAttribute("data-l10n-arial-label");if(e){let i=N(e);i&&r.setAttribute("aria-label",i)}}}};function N(e,...i){if(void 0===e)return;let r="",a=R.locale;R.strings[a]&&(r=R.strings[a][e]);let o=a.slice(0,2);if(!r&&R.strings[o]&&(r=R.strings[o][e]),r||(r=R.strings.en[e]),!r)return;let n=/(%@|%([0-9]+)\$@)/g,l=n.exec(r),s=0;for(;l;){if(i[s++]){let e=i[l[2]?parseInt(l[2],10)-1:s-1];"number"==typeof e&&(e=R.numberFormatter.format(e)),r=r.replace(l[1],e)}l=n.exec(r)}return r.replace(/%%/g,"%")}var q={m0:"#3F3D99",m1:"#993D71",m2:"#998B3D",m3:"#3D9956",m4:"#3D5A99",m5:"#993D90",m6:"#996D3D",m7:"#43993D",m8:"#3D7999",m9:"#843D99"},F={blue:"#0072BD",orange:"#D95319",yellow:"#EDB120",purple:"#7E2F8E",green:"#77AC30",cyan:"#4DBEEE",red:"#A2142F"},V={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"},j={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"},H={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"},W={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 U(e){var i,r,a,o,n,l;let s=e.split("!"),c,d,u,h=255,p=255,m=255,f=-1,g=s.length>0&&s[0].startsWith("-");g&&(s[0]=s[0].slice(1));for(let e=0;e<s.length;e++){c=h,d=p,u=m;let g=null==(i=s[e].trim().match(/^([A-Za-z\d-]+)/))?void 0:i[1],b=null==g?void 0:g.toLowerCase(),y=g&&null!=(l=null!=(n=null!=(o=null!=(a=null!=(r=j[b])?r:j[H[g]])?a:F[g])?o:W[g])?n:q[g])?l:s[e].trim(),v=y.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);if(null!=v&&v[1]&&v[2]&&v[3])h=Math.max(0,Math.min(255,Number.parseInt(v[1],16))),p=Math.max(0,Math.min(255,Number.parseInt(v[2],16))),m=Math.max(0,Math.min(255,Number.parseInt(v[3],16)));else if(null!=(v=y.match(/^#([\da-f]{3})$/i))&&v[1]){let e=Number.parseInt(v[1][0],16),i=Number.parseInt(v[1][1],16),r=Number.parseInt(v[1][2],16);h=Math.max(0,Math.min(255,16*e+e)),p=Math.max(0,Math.min(255,16*i+i)),m=Math.max(0,Math.min(255,16*r+r))}else{if(null==(v=y.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i))||!v[1]||!v[2]||!v[3])return;h=Math.max(0,Math.min(255,Number.parseInt(v[1]))),p=Math.max(0,Math.min(255,Number.parseInt(v[2]))),m=Math.max(0,Math.min(255,Number.parseInt(v[3])))}f>=0&&(h=(1-f)*h+f*c,p=(1-f)*p+f*d,m=(1-f)*m+f*u,f=-1),e+1<s.length&&(f=Math.max(0,Math.min(100,Number.parseInt(s[++e])))/100)}return f>=0&&(h=f*h+(1-f)*c,p=f*p+(1-f)*d,m=f*m+(1-f)*u),g&&(h=255-h,p=255-p,m=255-m),"#"+("00"+Math.round(h).toString(16)).slice(-2)+("00"+Math.round(p).toString(16)).slice(-2)+("00"+Math.round(m).toString(16)).slice(-2)}function J(e){var i,r;return null!=(r=null!=(i=V[(e=e.trim()).toLowerCase()])?i:V[H[e]])?r:U(e)}function X(e,i,r){return r<0&&(r+=6),r>=6&&(r-=6),r<1?(i-e)*r+e:r<3?i:r<4?(i-e)*(4-r)+e:e}function G(e){return e<0?0:e>255?255:Math.round(e)}var Z={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"},Y={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},Q=[{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 ee(e,i,r){if(!/[A-Za-z\d]/.test(e)||("up"===r&&(r=void 0),!i&&!r))return;let a=e.codePointAt(0);if(void 0===a)return e;for(let e of Q)if((!i||e.variant===i)&&(!r||e.style===r)&&a>=e.offset&&a<e.offset+e.len){let i=e.start+a-e.offset;return String.fromCodePoint(Y[i]||i)}}function et(e){return e?Array.isArray(e)?e:"object"==typeof e&&"group"in e?e.group:[]:[]}var ei,er,ea={},eo=f({},Z),en={},el={},es={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`∌}",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",tr:"\\operatorname{tr}",trace:"\\operatorname{tr}",rank:"\\operatorname{rank}",diag:"\\operatorname{diag}",span:"\\operatorname{span}",proj:"\\operatorname{proj}",centernot:{def:"\\not{#1}",args:1,captureSelection:!1},fbox:{def:"\\boxed{#1}",args:1,captureSelection:!1},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:{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}}},"amsmath.sty":{package:{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}",dotso:"\\ldots",dotsc:"\\ldots",dotsb:"\\cdots",dotsm:"\\cdots",dotsi:"\\cdots",idotsint:"\\int\\!\\cdots\\!\\int",substack:{def:"\\begin{smallmatrix}#1\\end{smallmatrix}",args:1,captureSelection:!1},tag:{def:"",args:1},notag:"",label:{def:"",args:1},numberthis:"",intertext:{def:"\\text{#1}",args:1,captureSelection:!1},shoveleft:"",shoveright:"",moveright:"",leftroot:{def:"",args:1},uproot:{def:"",args:1},Hat:{def:"\\hat{#1}",args:1,captureSelection:!1},Check:{def:"\\check{#1}",args:1,captureSelection:!1},Tilde:{def:"\\tilde{#1}",args:1,captureSelection:!1},Acute:{def:"\\acute{#1}",args:1,captureSelection:!1},Grave:{def:"\\grave{#1}",args:1,captureSelection:!1},Dot:{def:"\\dot{#1}",args:1,captureSelection:!1},Ddot:{def:"\\ddot{#1}",args:1,captureSelection:!1},Breve:{def:"\\breve{#1}",args:1,captureSelection:!1},Bar:{def:"\\bar{#1}",args:1,captureSelection:!1},Vec:{def:"\\vec{#1}",args:1,captureSelection:!1},pod:{def:"\\quad(#1)",args:1,expand:!1,captureSelection:!1},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}},primitive:!0},"mathtools-extra.sty":{package:{abs:{def:"\\left\\lvert #1\\right\\rvert",args:1,captureSelection:!1},norm:{def:"\\left\\lVert #1\\right\\rVert",args:1,captureSelection:!1},floor:{def:"\\left\\lfloor #1\\right\\rfloor",args:1,captureSelection:!1},ceil:{def:"\\left\\lceil #1\\right\\rceil",args:1,captureSelection:!1},"floor*":{def:"\\left\\lfloor #1\\right\\rfloor",args:1,captureSelection:!1},"ceil*":{def:"\\left\\lceil #1\\right\\rceil",args:1,captureSelection:!1},"abs*":{def:"\\left\\lvert #1\\right\\rvert",args:1,captureSelection:!1},"norm*":{def:"\\left\\lVert #1\\right\\rVert",args:1,captureSelection:!1}},primitive:!0},"physics.sty":{package:{dd:{def:"\\mathrm{d}#1",args:1,captureSelection:!1},dv:{def:"\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}",args:2,captureSelection:!1},pdv:{def:"\\frac{\\partial #1}{\\partial #2}",args:2,captureSelection:!1},diff:{def:"\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}",args:2,captureSelection:!1},derivative:{def:"\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}",args:2,captureSelection:!1},qty:{def:"\\left(#1\\right)",args:1,captureSelection:!1}},primitive:!0},"siunitx.sty":{package:{SI:{def:"#1\\,\\mathrm{#2}",args:2,captureSelection:!1},unit:{def:"\\mathrm{#1}",args:1,captureSelection:!1}},primitive:!0},"plain-tex-compat.sty":{package:{matrix:{def:"\\begin{matrix}#1\\end{matrix}",args:1,captureSelection:!1},pmatrix:{def:"\\begin{pmatrix}#1\\end{pmatrix}",args:1,captureSelection:!1},bmatrix:{def:"\\begin{bmatrix}#1\\end{bmatrix}",args:1,captureSelection:!1},Bmatrix:{def:"\\begin{Bmatrix}#1\\end{Bmatrix}",args:1,captureSelection:!1},vmatrix:{def:"\\begin{vmatrix}#1\\end{vmatrix}",args:1,captureSelection:!1},Vmatrix:{def:"\\begin{Vmatrix}#1\\end{Vmatrix}",args:1,captureSelection:!1},cases:{def:"\\begin{cases}#1\\end{cases}",args:1,captureSelection:!1},cr:"\\\\"},primitive:!0},"texvc.sty":{package:{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}"},primitive:!1}},ec={" ":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,"\\dots":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,"–":8211,"—":8212,"‘":8216,"’":8217,"“":8220,"”":8221,'"':8221,"\\ss":223,"\\ae":230,"\\oe":339,"\\AE":198,"\\OE":338,"\\O":216,"\\i":305,"\\j":567,"\\aa":229,"\\AA":197},ed=/[\w!@*()-=+{}\[\]\\';:?/.,~<>`|$%#&^" ]/;function eu(e,i,r="mord",a){void 0!==i&&(ea[e]={definitionType:"symbol",type:r,variant:a,codepoint:i},eo[i]||(eo[i]=e))}function eh(e,i,r){if("string"==typeof e){for(let i=0;i<e.length;i++){let r=e.charAt(i);eu(r,r.codePointAt(0))}return}for(let[a,o,n,l]of e)eu(a,o,null!=n?n:i,null!=l?l:r)}function ep(e,i){for(let r=e;r<=i;r++)eu(String.fromCodePoint(r),r)}!function(){if(!v())return!0;if(/firefox/i.test(navigator.userAgent)){let e=navigator.userAgent.match(/firefox\/(\d+)/i);return!!e&&parseInt(e[1])>=78}if(/trident/i.test(navigator.userAgent))return!1;if(/edge/i.test(navigator.userAgent)){let e=navigator.userAgent.match(/edg\/(\d+)/i);return!!e&&parseInt(e[1])>=79}return!0}()?(ei=/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/,er=/[\da-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/):(ei=RegExp("\\p{Letter}","u"),er=RegExp("[0-9\\p{Letter}]","u"));var em={cross:["\\times"],multiply:["\\times","\\cdot"],dot:["\\cdot"],times:["\\times"],divide:["\\div","\\frac"],fraction:["\\frac"],integral:["\\int","\\iint","\\iiint","\\iiiint","\\idotsint"],sum:["\\sum"],product:["\\prod"],infinity:["\\infty"],inf:["\\infty"],approximately:["\\approx"],approx:["\\approx"],less:["\\lt","\\leq"],greater:["\\gt","\\geq"],equal:["\\eq","\\equiv"],not:["\\neg","\\lnot"],and:["\\land","\\wedge"],or:["\\lor","\\vee"],arrow:["\\rightarrow","\\leftarrow"]};function ef(e){let i="auto",r=e.match(/:([^=]+)/);return r&&(i=r[1].trim()),i}function eg(e){if(!e)return[];let i=[],r=e.split("]");if(r[0].startsWith("[")){i.push({isOptional:!0,type:ef(r[0].slice(1))});for(let e=1;e<=r.length;e++)i.push(...eg(r[e]))}else if((r=e.split("}"))[0].startsWith("{")){i.push({isOptional:!1,type:ef(r[0].slice(1))});for(let e=1;e<=r.length;e++)i.push(...eg(r[e]))}return i}function eb(e){if(!e)return"";let i="",r=!0;for(let a of e)"string"==typeof a.value?i+=a.value:r=!1;return r?i:""}function ey(e,i,r){"string"==typeof e&&(e=[e]);let a={tabular:!0,rootOnly:!1,params:eg(i),createAtom:r};for(let i of e)el[i]=a}function ev(e,i,r){var a;"string"==typeof e&&(e=[e]);let o={tabular:null!=(a=null==r?void 0:r.tabular)&&a,rootOnly:!0,params:[],createAtom:i};for(let i of e)el[i]=o}function ex(e,i,r){var a,o;r||(r={});let n={definitionType:"function",params:eg(i),ifMode:r.ifMode,isFunction:null!=(a=r.isFunction)&&a,applyMode:r.applyMode,infix:null!=(o=r.infix)&&o,parse:r.parse,createAtom:r.createAtom,applyStyle:r.applyStyle,serialize:r.serialize,render:r.render};if("string"==typeof e)en["\\"+e]=n;else for(let i of e)en["\\"+i]=n}function e_(e){return oo||(oo=ek(es)),e?ek(f(f({},oo),e)):oo}function ew(e,i){var r,a,o,n;if("string"==typeof e){let o=0;return/(^|[^\\])#1/.test(e)&&(o=1),/(^|[^\\])#2/.test(e)&&(o=2),/(^|[^\\])#3/.test(e)&&(o=3),/(^|[^\\])#4/.test(e)&&(o=4),/(^|[^\\])#5/.test(e)&&(o=5),/(^|[^\\])#6/.test(e)&&(o=6),/(^|[^\\])#7/.test(e)&&(o=7),/(^|[^\\])#8/.test(e)&&(o=8),/(^|[^\\])#9/.test(e)&&(o=9),{expand:null==(r=null==i?void 0:i.expand)||r,captureSelection:null==(a=null==i?void 0:i.captureSelection)||a,args:o,def:e}}return f({expand:null==(o=null==i?void 0:i.expand)||o,captureSelection:null==(n=null==i?void 0:i.captureSelection)||n,args:0},e)}function ek(e){if(!e)return{};let i={};for(let r of Object.keys(e)){let a=e[r];if(null==a)delete i[r];else if("object"==typeof a&&"package"in a)for(let e of Object.keys(a.package))i[e]=ew(a.package[e],{expand:!a.primitive,captureSelection:a.captureSelection});else i[r]=ew(a)}return i}function eM(e,i="math"){if(!e||0===e.length)return null;let r=null;if(e.startsWith("\\")){if(r=en[e])return r.ifMode&&r.ifMode!==i?null:r;"math"===i?r=ea[e]:ec[e]&&(r={definitionType:"symbol",type:"mord",codepoint:ec[e]})}else if("math"===i){if(!(r=ea[e])&&1===e.length){let i=eL("math",e.codePointAt(0));return i.startsWith("\\")?g(f({},eM(i,"math")),{command:i}):null}}else ec[e]?r={definitionType:"symbol",type:"mord",codepoint:ec[e]}:"text"===i&&(r={definitionType:"symbol",type:"mord",codepoint:e.codePointAt(0)});return null!=r?r:null}function eS(e,i){return e.startsWith("\\")?i[e.slice(1)]:null}function eL(e,i){return void 0===i?"":"math"===e&&eo[i]?eo[i]:"text"===e&&Object.keys(ec).find(e=>ec[e]===i)||String.fromCodePoint(i)}var eC=[0,.68889,0,0,.72222],eE=[0,.68889,0,0,.66667],eA=[0,.68889,0,0,.77778],ez=[0,.68889,0,0,.61111],eT=[.16667,.68889,0,0,.77778],eD=[0,.68889,0,0,.55556],eK=[0,0,0,0,.25],eB=[0,.825,0,0,2.33334],e$=[0,.9,0,0,2.33334],eP=[0,.68889,0,0,.54028],eO=[-.03598,.46402,0,0,.5],eI=[-.13313,.36687,0,0,1],eR=[.01354,.52239,0,0,1],eN=[.01354,.52239,0,0,1.11111],eq=[0,.54986,0,0,1],eF=[0,.69224,0,0,.5],eV=[0,.43056,0,0,1],ej=[.08198,.58198,0,0,.77778],eH=[.19444,.69224,0,0,.41667],eW=[.1808,.675,0,0,1],eU=[.19444,.69224,0,0,.83334],eJ=[.13667,.63667,0,0,1],eX=[-.064,.437,0,0,1.334],eG=[.08167,.58167,0,0,.77778],eZ=[0,.69224,0,0,.72222],eY=[0,.69224,0,0,.66667],eQ=[-.13313,.36687,0,0,.77778],e0=[.06062,.54986,0,0,.77778],e1=[0,.69224,0,0,.77778],e4=[.25583,.75583,0,0,.77778],e2=[.25142,.75726,0,0,.77778],e3=[.20576,.70576,0,0,.77778],e6=[.30274,.79383,0,0,.77778],e8=[.22958,.72958,0,0,.77778],e5=[.1808,.675,0,0,.77778],e7=[.13667,.63667,0,0,.77778],e9=[.13597,.63597,0,0,.77778],te=[.03517,.54986,0,0,.77778],tt=[0,.675,0,0,.77778],ti=[.19444,.69224,0,0,.61111],tr=[0,.54986,0,0,.76042],ta=[0,.54986,0,0,.66667],to=[.0391,.5391,0,0,.77778],tn=[.03517,.54986,0,0,1.33334],tl=[.38569,.88569,0,0,.77778],ts=[.23222,.74111,0,0,.77778],tc=[.19444,.69224,0,0,.77778],td=[0,.37788,0,0,.5],tu=[0,.54986,0,0,.72222],th=[0,.69224,0,0,.83334],tp=[.11111,.69224,0,0,.66667],tm=[.26167,.75726,0,0,.77778],tf=[.48256,.98256,0,0,.77778],tg=[.28481,.79383,0,0,.77778],tb=[.08167,.58167,0,0,.22222],ty=[.08167,.58167,0,0,.38889],tv=[0,.43056,.04028,0,.66667],tx=[.41951,.91951,0,0,.77778],t_=[.24982,.74947,0,0,.38865],tw=[.08319,.58283,0,0,.75623],tk=[0,.10803,0,0,.27764],tM=[0,.47534,0,0,.50181],tS=[.18906,.47534,0,0,.50181],tL=[0,.69141,0,0,.50181],tC=[.24982,.74947,0,0,.27764],tE=[0,.69141,0,0,.21471],tA=[.25,.75,0,0,.44722],tz=[0,.64444,0,0,.575],tT=[.08556,.58556,0,0,.89444],tD=[0,.69444,0,0,.89444],tK=[0,.68611,0,0,.9],tB=[0,.68611,0,0,.86944],t$=[.25,.75,0,0,.575],tP=[.25,.75,0,0,.31944],tO=[0,.69444,0,0,.63889],tI=[0,.69444,0,0,.31944],tR=[0,.44444,0,0,.63889],tN=[0,.44444,0,0,.51111],tq=[0,.69444,0,0,.575],tF=[.13333,.63333,0,0,.89444],tV=[0,.44444,0,0,.31944],tj=[0,.69444,0,0,.86944],tH=[0,.68611,0,0,.69166],tW=[0,.68611,0,0,.83055],tU=[0,.68611,0,0,.89444],tJ=[0,.69444,0,0,.60278],tX=[.19444,.69444,0,0,.51111],tG=[0,.69444,0,0,.83055],tZ=[-.10889,.39111,0,0,1.14999],tY=[.19444,.69444,0,0,.575],tQ=[.19444,.69444,0,0,1.14999],t0=[.19444,.69444,0,0,.70277],t1=[.05556,.75,0,0,.575],t4=[0,.68611,0,0,.95833],t2=[.08556,.58556,0,0,.76666],t3=[-.02639,.47361,0,0,.575],t6=[0,.44444,0,0,.89444],t8=[0,.55556,0,0,.76666],t5=[-.10889,.39111,0,0,.89444],t7=[.00222,.50222,0,0,.89444],t9=[.19667,.69667,0,0,.89444],ie=[.08556,.58556,0,0,1.14999],it=[0,.69444,0,0,.70277],ii=[-.02778,.47222,0,0,.575],ir=[.25,.75,0,0,.51111],ia=[-.13889,.36111,0,0,1.14999],io=[.19444,.69444,0,0,1.02222],il=[.12963,.69444,0,0,.89444],is=[.19444,.69444,0,0,.44722],ic=[0,.64444,.13167,0,.59111],id=[.19444,.64444,.13167,0,.59111],iu=[0,.68611,.17208,0,.8961],ih=[.19444,.44444,.105,0,.53222],ip=[0,.44444,.085,0,.82666],im=[0,.69444,.06709,0,.59111],ig=[0,.69444,.12945,0,.35555],ib=[0,.69444,0,0,.94888],iy=[0,.69444,.11472,0,.59111],iv=[0,.68611,.10778,0,.88555],ix=[0,.69444,.07939,0,.62055],i_=[0,.69444,.12417,0,.30667],iw=[0,.64444,.13556,0,.51111],ik=[.19444,.64444,.13556,0,.51111],iM=[0,.68333,.16389,0,.74333],iS=[.19444,.43056,.08847,0,.46],iL=[0,.43056,.07514,0,.71555],iC=[0,.69444,.06646,0,.51111],iE=[0,.69444,0,0,.83129],iA=[0,.69444,.1225,0,.51111],iz=[0,.68333,.09403,0,.76666],iT=[0,.68333,.11111,0,.76666],iD=[0,.69444,.06961,0,.51444],iK=[0,.69444,0,0,.27778],iB=[.25,.75,0,0,.38889],i$=[0,.64444,0,0,.5],iP=[0,.69444,0,0,.77778],iO=[0,.68333,0,0,.75],iI=[0,.68333,0,0,.77778],iR=[0,.68333,0,0,.68056],iN=[0,.68333,0,0,.72222],iq=[.25,.75,0,0,.5],iF=[.25,.75,0,0,.27778],iV=[0,.69444,0,0,.5],ij=[0,.69444,0,0,.55556],iH=[0,.43056,0,0,.44445],iW=[0,.43056,0,0,.5],iU=[.19444,.43056,0,0,.55556],iJ=[0,.43056,0,0,.55556],iX=[.08333,.58333,0,0,.77778],iG=[0,.43056,0,0,.27778],iZ=[0,.66786,0,0,.27778],iY=[0,.69444,0,0,.75],iQ=[0,.66786,0,0,.5],i0=[0,.68333,0,0,.625],i1=[.19444,.69444,0,0,.44445],i4=[0,.69444,0,0,.72222],i2=[.19444,.69444,0,0,.5],i3=[.19444,.69444,0,0,1],i6=[.011,.511,0,0,1.126],i8=[.19444,.69444,0,0,.61111],i5=[.05556,.75,0,0,.5],i7=[0,.68333,0,0,.83334],i9=[.0391,.5391,0,0,.66667],re=[-.05555,.44445,0,0,.5],rt=[0,.43056,0,0,.77778],ri=[0,.55556,0,0,.66667],rr=[-.03625,.46375,0,0,.77778],ra=[-.01688,.48312,0,0,.77778],ro=[.0391,.5391,0,0,1],rn=[0,.69444,0,0,.61111],rl=[-.03472,.46528,0,0,.5],rs=[.25,.75,0,0,.44445],rc=[-.14236,.35764,0,0,1],rd=[.244,.744,0,0,.412],ru=[.19444,.69444,0,0,.88889],rh=[.12963,.69444,0,0,.77778],rp=[.19444,.69444,0,0,.38889],rm=[.011,.511,0,0,1.638],rf=[.19444,.69444,0,0,0],rg=[0,.44444,0,0,.575],rb=[.19444,.44444,0,0,.575],ry=[0,.68611,0,0,.75555],rv=[0,.69444,0,0,.66759],rx=[0,.68611,0,0,.80555],r_=[0,.68611,.08229,0,.98229],rw=[0,.68611,0,0,.76666],rk=[0,.44444,0,0,.58472],rM=[.19444,.44444,0,0,.6118],rS=[.19444,.43056,0,0,.5],rL=[0,.68333,.02778,.08334,.76278],rC=[0,.68333,.08125,.05556,.83125],rE=[0,.43056,0,.05556,.48472],rA=[.19444,.43056,0,.08334,.51702],rz=[.25,.75,0,0,.42778],rT=[0,.69444,0,0,.55],rD=[0,.69444,0,0,.73334],rK=[0,.69444,0,0,.79445],rB=[0,.69444,0,0,.51945],r$=[0,.69444,0,0,.70278],rP=[0,.69444,0,0,.76389],rO=[.25,.75,0,0,.34306],rI=[0,.69444,0,0,.56111],rR=[0,.69444,0,0,.25556],rN=[.19444,.45833,0,0,.56111],rq=[0,.45833,0,0,.56111],rF=[0,.69444,0,0,.30556],rV=[0,.69444,0,0,.58056],rj=[0,.69444,0,0,.67223],rH=[0,.69444,0,0,.85556],rW=[0,.69444,0,0,.55834],rU=[0,.65556,.11156,0,.5],rJ=[0,.69444,.08094,0,.70834],rX=[.17014,0,0,0,.44445],rG=[0,.69444,.0799,0,.5],rZ=[0,.69444,0,0,.73752],rY=[0,.69444,.09205,0,.5],rQ=[0,.69444,.09031,0,.77778],r0=[0,.69444,.07816,0,.27778],r1=[0,.69444,.00316,0,.5],r4=[.19444,.69444,0,0,.83334],r2=[.05556,.75,0,0,.83334],r3=[0,.75,0,0,.5],r6=[.125,.08333,0,0,.27778],r8=[0,.08333,0,0,.27778],r5=[0,.65556,0,0,.5],r7=[0,.69444,0,0,.47222],r9=[0,.69444,0,0,.66667],ae=[0,.69444,0,0,.59722],at=[0,.69444,0,0,.54167],ai=[0,.69444,0,0,.70834],ar=[.25,.75,0,0,.28889],aa=[0,.69444,0,0,.51667],ao=[0,.44444,0,0,.44445],an=[.19444,.44444,0,0,.51667],al=[0,.44444,0,0,.38333],as=[0,.44444,0,0,.51667],ac=[0,.69444,0,0,.83334],ad=[.35001,.85,0,0,.45834],au=[.35001,.85,0,0,.57778],ah=[.35001,.85,0,0,.41667],ap=[.35001,.85,0,0,.58334],am=[0,.72222,0,0,.55556],af=[1e-5,.6,0,0,.66667],ag=[1e-5,.6,0,0,.77778],ab=[.25001,.75,0,0,.94445],ay=[.306,.805,.19445,0,.47222],av=[.30612,.805,.19445,0,.47222],ax=[.25001,.75,0,0,.83334],a_=[.35001,.85,0,0,.47222],aw=[.25001,.75,0,0,1.11111],ak=[.65002,1.15,0,0,.59722],aM=[.65002,1.15,0,0,.81111],aS=[.65002,1.15,0,0,.47222],aL=[.65002,1.15,0,0,.66667],aC=[0,.75,0,0,1],aE=[.55001,1.05,0,0,1.27778],aA=[.862,1.36,.44445,0,.55556],az=[.86225,1.36,.44445,0,.55556],aT=[.55001,1.05,0,0,1.11111],aD=[.65002,1.15,0,0,.52778],aK=[.65002,1.15,0,0,.61111],aB=[.55001,1.05,0,0,1.51112],a$=[.95003,1.45,0,0,.73611],aP=[.95003,1.45,0,0,1.04445],aO=[.95003,1.45,0,0,.52778],aI=[.95003,1.45,0,0,.75],aR=[0,.75,0,0,1.44445],aN=[.95003,1.45,0,0,.58334],aq=[1.25003,1.75,0,0,.79167],aF=[1.25003,1.75,0,0,1.27778],aV=[1.25003,1.75,0,0,.58334],aj=[1.25003,1.75,0,0,.80556],aH=[0,.825,0,0,1.8889],aW=[1.25003,1.75,0,0,.63889],aU=[.64502,1.155,0,0,.875],aJ=[1e-5,.6,0,0,.875],aX=[-99e-5,.601,0,0,.66667],aG=[.64502,1.155,0,0,.66667],aZ=[1e-5,.9,0,0,.88889],aY=[.65002,1.15,0,0,.88889],aQ=[.90001,0,0,0,.88889],a0=[-.00499,.605,0,0,1.05556],a1=[0,.12,0,0,.45],a4=[0,.61111,0,0,.525],a2=[.08333,.69444,0,0,.525],a3=[-.08056,.53055,0,0,.525],a6=[-.05556,.55556,0,0,.525],a8=[0,.43056,0,0,.525],a5=[.22222,.43056,0,0,.525],a7=[0,0,0,0,.525],a9={"AMS-Regular":{32:eK,65:eC,66:eE,67:eC,68:eC,69:eE,70:ez,71:eA,72:eA,73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:eA,76:eE,77:[0,.68889,0,0,.94445],78:eC,79:eT,80:ez,81:eT,82:eC,83:eD,84:eE,85:eC,86:eC,87:[0,.68889,0,0,1],88:eC,89:eC,90:eE,107:eD,160:eK,165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:eD,295:eP,710:eB,732:e$,770:eB,771:e$,989:eG,1008:tv,8245:[0,.54986,0,0,.275],8463:eP,8487:eC,8498:eD,8502:eE,8503:[0,.68889,0,0,.44445],8504:eE,8513:[0,.68889,0,0,.63889],8592:eO,8594:eO,8602:eI,8603:eI,8606:eR,8608:eR,8610:eN,8611:eN,8619:eq,8620:eq,8621:[-.13313,.37788,0,0,1.38889],8622:eI,8624:eF,8625:eF,8630:eV,8631:eV,8634:ej,8635:ej,8638:eH,8639:eH,8642:eH,8643:eH,8644:eW,8646:eW,8647:eW,8648:eU,8649:eW,8650:eU,8651:eR,8652:eR,8653:eI,8654:eI,8655:eI,8666:eJ,8667:eJ,8669:[-.13313,.37788,0,0,1],8672:eX,8674:eX,8705:[0,.825,0,0,.5],8708:eD,8709:eG,8717:[0,.43056,0,0,.42917],8722:eO,8724:[.08198,.69224,0,0,.77778],8726:eG,8733:e1,8736:eZ,8737:eZ,8738:[.03517,.52239,0,0,.72222],8739:tb,8740:[.25142,.74111,0,0,.27778],8741:ty,8742:[.25142,.74111,0,0,.5],8756:eY,8757:eY,8764:eQ,8765:[-.13313,.37788,0,0,.77778],8769:eQ,8770:rr,8774:e6,8776:ra,8778:eG,8782:e0,8783:e0,8785:ej,8786:ej,8787:ej,8790:e1,8791:e8,8796:[.08198,.91667,0,0,.77778],8806:e4,8807:e4,8808:e2,8809:e2,8812:[.25583,.75583,0,0,.5],8814:e3,8815:e3,8816:e6,8817:e6,8818:e8,8819:e8,8822:e5,8823:e5,8828:e7,8829:e7,8830:e8,8831:e8,8832:e3,8833:e3,8840:e6,8841:e6,8842:e9,8843:e9,8847:te,8848:te,8858:ej,8859:ej,8861:ej,8862:tt,8863:tt,8864:tt,8865:tt,8872:[0,.69224,0,0,.61111],8873:eZ,8874:[0,.69224,0,0,.88889],8876:ez,8877:ez,8878:eC,8879:eC,8882:te,8883:te,8884:e7,8885:e7,8888:[0,.54986,0,0,1.11111],8890:iU,8891:ti,8892:ti,8901:[0,.54986,0,0,.27778],8903:eG,8905:eG,8906:eG,8907:e1,8908:e1,8909:[-.03598,.46402,0,0,.77778],8910:tr,8911:tr,8912:te,8913:te,8914:ta,8915:ta,8916:eY,8918:to,8919:to,8920:tn,8921:tn,8922:tl,8923:tl,8926:e7,8927:e7,8928:e6,8929:e6,8934:ts,8935:ts,8936:ts,8937:ts,8938:e3,8939:e3,8940:e6,8941:e6,8994:tc,8995:tc,9416:[.15559,.69224,0,0,.90222],9484:eF,9488:eF,9492:td,9496:td,9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:tt,9633:tt,9650:tu,9651:tu,9654:te,9660:tu,9661:tu,9664:te,9674:tp,9733:[.19444,.69224,0,0,.94445],10003:th,10016:th,10731:tp,10846:[.19444,.75583,0,0,.61111],10877:e7,10878:e7,10885:e4,10886:e4,10887:e9,10888:e9,10889:tm,10890:tm,10891:tf,10892:tf,10901:e7,10902:e7,10933:e2,10934:e2,10935:tm,10936:tm,10937:tm,10938:tm,10949:e4,10950:e4,10955:tg,10956:tg,57350:tb,57351:ty,57352:eG,57353:tv,57356:e2,57357:e2,57358:tx,57359:e6,57360:e6,57361:tx,57366:e2,57367:e2,57368:e2,57369:e2,57370:e9,57371:e9},"Caligraphic-Regular":{32:eK,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:eK},"Fraktur-Regular":{32:eK,33:[0,.69141,0,0,.29574],34:tE,38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:t_,41:t_,42:[0,.62119,0,0,.27764],43:tw,44:tk,45:tw,46:tk,47:[.24982,.74947,0,0,.50181],48:tM,49:tM,50:tM,51:tS,52:tS,53:tS,54:tL,55:tS,56:tL,57:tS,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:tC,93:tC,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:eK,8216:tE,8217:tE,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:eK,33:[0,.69444,0,0,.35],34:tJ,35:[.19444,.69444,0,0,.95833],36:t1,37:[.05556,.75,0,0,.95833],38:tD,39:tI,40:tA,41:tA,42:[0,.75,0,0,.575],43:tF,44:[.19444,.15556,0,0,.31944],45:al,46:[0,.15556,0,0,.31944],47:t$,48:tz,49:tz,50:tz,51:tz,52:tz,53:tz,54:tz,55:tz,56:tz,57:tz,58:tV,59:[.19444,.44444,0,0,.31944],60:tT,61:t5,62:tT,63:[0,.69444,0,0,.54305],64:tD,65:tB,66:[0,.68611,0,0,.81805],67:tW,68:[0,.68611,0,0,.88194],69:ry,70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:tK,73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:tH,77:[0,.68611,0,0,1.09166],78:tK,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:tB,89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:tP,92:t$,93:tP,94:tq,95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:tO,99:tN,100:tO,101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:tO,105:tI,106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:tI,109:[0,.44444,0,0,.95833],110:tR,111:rg,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:tR,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:tN,123:t$,124:tP,125:t$,126:[.35,.34444,0,0,.575],160:eK,163:[0,.69444,0,0,.86853],168:tq,172:[0,.44444,0,0,.76666],176:tj,177:tF,184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:tF,216:[.04861,.73472,0,0,.89444],223:ae,230:[0,.44444,0,0,.83055],247:tF,248:[.09722,.54167,0,0,.575],305:tV,338:[0,.68611,0,0,1.16944],339:t6,567:[.19444,.44444,0,0,.35139],710:tq,711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:tq,715:tq,728:tq,729:tI,730:tj,732:tq,733:tq,915:tH,916:t4,920:tU,923:rx,926:rw,928:tK,931:tW,933:tU,934:tW,936:tU,937:tW,8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:tI,8217:tI,8220:tJ,8221:tJ,8224:tX,8225:tX,8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:rv,8465:tG,8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:tG,8501:it,8592:tZ,8593:tY,8594:tZ,8595:tY,8596:tZ,8597:t$,8598:tQ,8599:tQ,8600:tQ,8601:tQ,8636:tZ,8637:tZ,8640:tZ,8641:tZ,8656:tZ,8657:t0,8658:tZ,8659:t0,8660:tZ,8661:[.25,.75,0,0,.70277],8704:tO,8706:[0,.69444,.06389,0,.62847],8707:tO,8709:t1,8711:t4,8712:t2,8715:t2,8722:tF,8723:tF,8725:t$,8726:t$,8727:ii,8728:t3,8729:t3,8730:[.18,.82,0,0,.95833],8733:t6,8734:[0,.44444,0,0,1.14999],8736:eZ,8739:tP,8741:t$,8743:t8,8744:t8,8745:t8,8746:t8,8747:[.19444,.69444,.12778,0,.56875],8764:t5,8768:[.19444,.69444,0,0,.31944],8771:t7,8776:[.02444,.52444,0,0,.89444],8781:t7,8801:t7,8804:t9,8805:t9,8810:ie,8811:ie,8826:tT,8827:tT,8834:tT,8835:tT,8838:t9,8839:t9,8846:t8,8849:t9,8850:t9,8851:t8,8852:t8,8853:tF,8854:tF,8855:tF,8856:tF,8857:tF,8866:it,8867:it,8868:tD,8869:tD,8900:t3,8901:[-.02639,.47361,0,0,.31944],8902:ii,8968:ir,8969:ir,8970:ir,8971:ir,8994:ia,8995:ia,9651:io,9657:ii,9661:io,9667:ii,9711:tQ,9824:il,9825:il,9826:il,9827:il,9837:[0,.75,0,0,.44722],9838:is,9839:is,10216:tA,10217:tA,10815:tK,10927:t9,10928:t9,57376:rf},"Main-BoldItalic":{32:eK,33:[0,.69444,.11417,0,.38611],34:ix,35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:ig,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:ic,49:ic,50:ic,51:ic,52:id,53:ic,54:ic,55:id,56:ic,57:ic,58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:iy,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:iu,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:iu,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:im,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:ih,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:ih,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:eK,168:[0,.69444,.11473,0,.59111],176:ib,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:ip,248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:ip,567:[.19444,.44444,.04611,0,.385],710:im,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:ig,730:ib,732:iy,733:iy,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:iu,931:[0,.68611,.11431,0,.82666],933:iv,934:[0,.68611,.05632,0,.82666],936:iv,937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:ig,8217:ig,8220:[0,.69444,.16772,0,.62055],8221:ix},"Main-Italic":{32:eK,33:i_,34:iD,35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:i_,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:iw,49:iw,50:iw,51:iw,52:ik,53:iw,54:iw,55:ik,56:iw,57:iw,58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:iA,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:iM,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:iM,79:iz,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:iM,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:iC,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:iS,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:iS,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:eK,168:[0,.66786,.10474,0,.51111],176:iE,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:iL,248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:iL,710:iC,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:iE,732:[0,.66786,.11585,0,.51111],733:iA,915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:iz,923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:iM,931:[0,.68333,.12028,0,.71555],933:iT,934:[0,.68333,.05986,0,.71555],936:iT,937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:i_,8217:i_,8220:[0,.69444,.1685,0,.51444],8221:iD,8463:eP},"Main-Regular":{32:eK,33:iK,34:iV,35:r4,36:i5,37:r2,38:iP,39:iK,40:iB,41:iB,42:r3,43:iX,44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:iq,48:i$,49:i$,50:i$,51:i$,52:i$,53:i$,54:i$,55:i$,56:i$,57:i$,58:iG,59:[.19444,.43056,0,0,.27778],60:to,61:eQ,62:to,63:r7,64:iP,65:iO,66:[0,.68333,0,0,.70834],67:iN,68:[0,.68333,0,0,.76389],69:iR,70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:iO,73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:iI,76:i0,77:[0,.68333,0,0,.91667],78:iO,79:iI,80:iR,81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:iN,85:iO,86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:iO,89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:iF,92:iq,93:iF,94:iV,95:[.31,.12056,.02778,0,.5],97:iW,98:ij,99:iH,100:ij,101:iH,102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:ij,105:iZ,106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:iK,109:[0,.43056,0,0,.83334],110:iJ,111:iW,112:iU,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:iJ,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:iH,123:iq,124:iF,125:iq,126:[.35,.31786,0,0,.5],160:eK,163:[0,.69444,0,0,.76909],167:i1,168:iQ,172:[0,.43056,0,0,.66667],176:iY,177:iX,182:i8,184:rX,198:[0,.68333,0,0,.90278],215:iX,216:[.04861,.73194,0,0,.77778],223:iV,230:[0,.43056,0,0,.72222],247:iX,248:[.09722,.52778,0,0,.5],305:iG,338:[0,.68333,0,0,1.01389],339:rt,567:[.19444,.43056,0,0,.30556],710:iV,711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:iV,715:iV,728:iV,729:iZ,730:iY,732:iQ,733:iV,915:i0,916:i7,920:iI,923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:iO,931:iN,933:iI,934:iN,936:iI,937:iN,8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:iK,8217:iK,8220:iV,8221:iV,8224:i1,8225:i1,8230:[0,.12,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:eP,8465:i4,8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:i4,8501:rn,8592:eI,8593:i2,8594:eI,8595:i2,8596:eI,8597:iq,8598:i3,8599:i3,8600:i3,8601:i3,8614:[.011,.511,0,0,1],8617:i6,8618:i6,8636:eI,8637:eI,8640:eI,8641:eI,8652:[.011,.671,0,0,1],8656:eI,8657:i8,8658:eI,8659:i8,8660:eI,8661:[.25,.75,0,0,.61111],8704:ij,8706:[0,.69444,.05556,.08334,.5309],8707:ij,8709:i5,8711:i7,8712:i9,8715:i9,8722:iX,8723:iX,8725:iq,8726:iq,8727:rl,8728:re,8729:re,8730:[.2,.8,0,0,.83334],8733:rt,8734:eV,8736:eZ,8739:iF,8741:iq,8743:ri,8744:ri,8745:ri,8746:ri,8747:[.19444,.69444,.11111,0,.41667],8764:eQ,8768:[.19444,.69444,0,0,.27778],8771:rr,8773:[-.022,.589,0,0,1],8776:ra,8781:rr,8784:[-.133,.67,0,0,.778],8801:rr,8804:e9,8805:e9,8810:ro,8811:ro,8826:to,8827:to,8834:to,8835:to,8838:e9,8839:e9,8846:ri,8849:e9,8850:e9,8851:ri,8852:ri,8853:iX,8854:iX,8855:iX,8856:iX,8857:iX,8866:rn,8867:rn,8868:iP,8869:iP,8872:[.249,.75,0,0,.867],8900:re,8901:[-.05555,.44445,0,0,.27778],8902:rl,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:rs,8969:rs,8970:rs,8971:rs,8994:rc,8995:rc,9136:rd,9137:rd,9651:ru,9657:rl,9661:ru,9667:rl,9711:i3,9824:rh,9825:rh,9826:rh,9827:rh,9837:[0,.75,0,0,.38889],9838:rp,9839:rp,10216:iB,10217:iB,10222:rd,10223:rd,10229:[.011,.511,0,0,1.609],10230:rm,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:rm,10815:iO,10927:e9,10928:e9,57376:rf},"Math-BoldItalic":{32:eK,48:rg,49:rg,50:rg,51:rb,52:rb,53:rb,54:tz,55:rb,56:tz,57:rb,65:tB,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:r_,73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:ry,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:rv,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:rk,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:eK,915:[0,.68611,.15972,0,.65694],916:t4,920:[0,.68611,.03194,0,.86722],923:rx,926:[0,.68611,.07458,0,.84125],928:r_,931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:rw,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:rk,960:[0,.44444,.03704,0,.68241],961:rM,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:rM,1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:eK,48:iW,49:iW,50:iW,51:rS,52:rS,53:rS,54:i$,55:rS,56:i$,57:rS,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:rC,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:rL,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:rE,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:eK,915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:rL,923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:rC,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:rE,960:[0,.43056,.03588,0,.57003],961:rA,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:rA,1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:eK,33:[0,.69444,0,0,.36667],34:rW,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:rF,40:rz,41:rz,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:rT,49:rT,50:rT,51:rT,52:rT,53:rT,54:rT,55:rT,56:rT,57:rT,58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:rB,64:rD,65:rD,66:rD,67:r$,68:rK,69:[0,.69444,0,0,.64167],70:rn,71:rD,72:rK,73:[0,.69444,0,0,.33056],74:rB,75:rP,76:rV,77:[0,.69444,0,0,.97778],78:rK,79:rK,80:r$,81:[.10556,.69444,0,0,.79445],82:r$,83:rn,84:rD,85:rP,86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:rD,89:[0,.69444,.0275,0,.73334],90:rj,91:rO,93:rO,94:rT,95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:rI,99:[0,.45833,0,0,.48889],100:rI,101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:rI,105:rR,106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:rR,109:[0,.45833,0,0,.86667],110:rq,111:[0,.45833,0,0,.55],112:rN,113:rN,114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:rq,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:eK,168:rT,176:rD,180:rT,184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:rT,711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:rT,729:rF,730:rD,732:rT,733:rT,915:rV,916:[0,.69444,0,0,.91667],920:rH,923:rj,926:rD,928:rK,931:rK,933:rH,934:rK,936:rH,937:rK,8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:rF,8217:rF,8220:rW,8221:rW},"SansSerif-Italic":{32:eK,33:[0,.69444,.05733,0,.31945],34:r1,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:r0,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:r6,45:[0,.44444,.01946,0,.33333],46:r8,47:[.25,.75,.13164,0,.5],48:rU,49:rU,50:rU,51:rU,52:rU,53:rU,54:rU,55:rU,56:rU,57:rU,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:r9,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:rJ,73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:at,77:[0,.69444,.08094,0,.875],78:rJ,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:rG,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:eK,168:[0,.67937,.06385,0,.5],176:rZ,184:rX,305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:rG,711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:rY,715:iV,728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:rZ,732:[0,.67659,.08826,0,.5],733:rY,915:[0,.69444,.13372,0,.54167],916:ac,920:[0,.69444,.07555,0,.77778],923:rn,926:[0,.69444,.12816,0,.66667],928:rJ,931:[0,.69444,.11983,0,.72222],933:rQ,934:[0,.69444,.04603,0,.72222],936:rQ,937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:r0,8217:r0,8220:[0,.69444,.14205,0,.5],8221:r1},"SansSerif-Regular":{32:eK,33:[0,.69444,0,0,.31945],34:iV,35:r4,36:i5,37:r2,38:[0,.69444,0,0,.75834],39:iK,40:iB,41:iB,42:r3,43:iX,44:r6,45:[0,.44444,0,0,.33333],46:r8,47:iq,48:r5,49:r5,50:r5,51:r5,52:r5,53:r5,54:r5,55:r5,56:r5,57:r5,58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:r7,64:r9,65:r9,66:r9,67:tO,68:[0,.69444,0,0,.72223],69:ae,70:[0,.69444,0,0,.56945],71:r9,72:ai,73:iK,74:r7,75:[0,.69444,0,0,.69445],76:at,77:[0,.69444,0,0,.875],78:ai,79:[0,.69444,0,0,.73611],80:tO,81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:ij,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:r9,89:[0,.69444,.025,0,.66667],90:rn,91:ar,93:ar,94:iV,95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:aa,99:ao,100:aa,101:ao,102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:aa,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:as,111:[0,.44444,0,0,.5],112:an,113:an,114:[0,.44444,.01389,0,.34167],115:al,116:[0,.57143,0,0,.36111],117:as,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:eK,168:[0,.67937,0,0,.5],176:r9,184:rX,305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:iV,711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:iV,715:iV,728:iV,729:[0,.67937,0,0,.27778],730:r9,732:[0,.67659,0,0,.5],733:iV,915:at,916:ac,920:iP,923:rn,926:r9,928:ai,931:i4,933:iP,934:i4,936:iP,937:i4,8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:iK,8217:iK,8220:iV,8221:iV},"Script-Regular":{32:eK,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:eK},"Size1-Regular":{32:eK,40:ad,41:ad,47:au,91:ah,92:au,93:ah,123:ap,125:ap,160:eK,710:am,732:am,770:am,771:am,8214:[-99e-5,.601,0,0,.77778],8593:af,8595:af,8657:ag,8659:ag,8719:ab,8720:ab,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:av,8748:ay,8749:ay,8750:av,8896:ax,8897:ax,8898:ax,8899:ax,8968:a_,8969:a_,8970:a_,8971:a_,9168:aX,10216:a_,10217:a_,10752:aw,10753:aw,10754:aw,10756:ax,10758:ax},"Size2-Regular":{32:eK,40:ak,41:ak,47:aM,91:aS,92:aM,93:aS,123:aL,125:aL,160:eK,710:aC,732:aC,770:aC,771:aC,8719:aE,8720:aE,8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:az,8748:aA,8749:aA,8750:az,8896:aT,8897:aT,8898:aT,8899:aT,8968:aD,8969:aD,8970:aD,8971:aD,10216:aK,10217:aK,10752:aB,10753:aB,10754:aB,10756:aT,10758:aT},"Size3-Regular":{32:eK,40:a$,41:a$,47:aP,91:aO,92:aP,93:aO,123:aI,125:aI,160:eK,710:aR,732:aR,770:aR,771:aR,8730:[.95003,1.45,0,0,1],8968:aN,8969:aN,8970:aN,8971:aN,10216:aI,10217:aI},"Size4-Regular":{32:eK,40:aq,41:aq,47:aF,91:aV,92:aF,93:aV,123:aj,125:aj,160:eK,710:aH,732:aH,770:aH,771:aH,8730:[1.25003,1.75,0,0,1],8968:aW,8969:aW,8970:aW,8971:aW,9115:aU,9116:aJ,9117:aU,9118:aU,9119:aJ,9120:aU,9121:aG,9122:aX,9123:aG,9124:aG,9125:aX,9126:aG,9127:aZ,9128:aY,9129:aQ,9130:[0,.3,0,0,.88889],9131:aZ,9132:aY,9133:aQ,9143:[.88502,.915,0,0,1.05556],10216:aj,10217:aj,57344:a0,57345:a0,57680:a1,57681:a1,57682:a1,57683:a1},"Typewriter-Regular":{32:a7,33:a4,34:a4,35:a4,36:a2,37:a2,38:a4,39:a4,40:a2,41:a2,42:[0,.52083,0,0,.525],43:a3,44:[.13889,.125,0,0,.525],45:a3,46:[0,.125,0,0,.525],47:a2,48:a4,49:a4,50:a4,51:a4,52:a4,53:a4,54:a4,55:a4,56:a4,57:a4,58:a8,59:[.13889,.43056,0,0,.525],60:a6,61:[-.19549,.41562,0,0,.525],62:a6,63:a4,64:a4,65:a4,66:a4,67:a4,68:a4,69:a4,70:a4,71:a4,72:a4,73:a4,74:a4,75:a4,76:a4,77:a4,78:a4,79:a4,80:a4,81:[.13889,.61111,0,0,.525],82:a4,83:a4,84:a4,85:a4,86:a4,87:a4,88:a4,89:a4,90:a4,91:a2,92:a2,93:a2,94:a4,95:[.09514,0,0,0,.525],96:a4,97:a8,98:a4,99:a8,100:a4,101:a8,102:a4,103:a5,104:a4,105:a4,106:[.22222,.61111,0,0,.525],107:a4,108:a4,109:a8,110:a8,111:a8,112:a5,113:a5,114:a8,115:a8,116:[0,.55358,0,0,.525],117:a8,118:a8,119:a8,120:a8,121:a5,122:a8,123:a2,124:a2,125:a2,126:a4,127:a4,160:a7,176:a4,184:[.19445,0,0,0,.525],305:a8,567:a5,711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:a4,715:a4,728:a4,730:a4,770:a4,771:a4,776:a4,915:a4,916:a4,920:a4,923:a4,926:a4,928:a4,931:a4,933:a4,934:a4,936:a4,937:a4,8216:a4,8217:a4,8242:a4,9251:[.11111,.21944,0,0,.525]}},oe=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,ot={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],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:[.25,.25,.25],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]},oi=[0,.5,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],or={" ":" ","​":" ",Å:"A",Ç:"C",Ð:"D",Þ:"o",å:"a",ç:"c",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function oa(e,i){void 0===e&&(e=77);let r=a9[i][e];if(r)return{defaultMetrics:!1,depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]};if(11034===e)return{defaultMetrics:!0,depth:.2,height:.8,italic:0,skew:0,width:.8};let a=String.fromCodePoint(e);if(a in or)e=or[a].codePointAt(0);else if(oe.test(a))return e=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 oo,on,ol={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]},os={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]},oc={doubleleftarrow:`M262 157
1
+ export const __rspack_esm_id=2020;export const __rspack_esm_ids=[2020];export const __webpack_modules__={48623(e,i,r){r.r(i);var a,o,n,l,s=Object.defineProperty,c=Object.defineProperties,d=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,m=(e,i,r)=>i in e?s(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,f=(e,i)=>{for(var r in i||(i={}))h.call(i,r)&&m(e,r,i[r]);if(u)for(var r of u(i))p.call(i,r)&&m(e,r,i[r]);return e},g=(e,i)=>c(e,d(i)),b=e=>"symbol"==typeof e?e:e+"",y=(e,i)=>{var r={};for(var a in e)h.call(e,a)&&0>i.indexOf(a)&&(r[a]=e[a]);if(null!=e&&u)for(var a of u(e))0>i.indexOf(a)&&p.call(e,a)&&(r[a]=e[a]);return r};function v(){return"window"in globalThis&&"document"in globalThis}function x(){return"matchMedia"in window?window.matchMedia("(pointer: coarse)").matches:"ontouchstart"in window||navigator.maxTouchPoints>0}function _(){return"function"==typeof navigator.vibrate}function w(){var e,i;if(!v())return"other";let r=null!=(i=null==(e=navigator.userAgentData)?void 0:e.platform)?i:navigator.platform;return/^mac/i.test(r)?5===navigator.maxTouchPoints?"ios":"macos":/^win/i.test(r)?"windows":/android/i.test(navigator.userAgent)?"android":/iphone|ipod|ipad/i.test(navigator.userAgent)?"ios":/\bcros\b/i.test(navigator.userAgent)?"chromeos":"other"}function k(){return HTMLElement.prototype.hasOwnProperty("popover")}var M={id:"apple.en-intl",displayName:"English (international)",virtualLayout:"qwerty",platform:"apple",locale:"en",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["b","B","∫","ı"],KeyC:["c","C","ç","Ç"],KeyD:["d","D","∂","Î"],KeyE:["e","E","´","´"],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","#","£","‹"],Digit4:["4","$","¢","›"],Digit5:["5","%","∞","fi"],Digit6:["6","^","§","fl"],Digit7:["7","&","¶","‡"],Digit8:["8","*","•","°"],Digit9:["9","(","ª","·"],Digit0:["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:["§","±","§","±"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}},S={id:"windows.en-intl",displayName:"English (international)",platform:"windows",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","á","Á"],KeyB:["b","B","",""],KeyC:["c","C","©","¢"],KeyD:["d","D","ð","Ð"],KeyE:["e","E","é","É"],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","#","³",""],Digit4:["4","$","¤","£"],Digit5:["5","%","€",""],Digit6:["6","^","¼",""],Digit7:["7","&","½",""],Digit8:["8","*","¾",""],Digit9:["9","(","‘",""],Digit0:["0",")","’",""],Space:[" "," ","",""],Minus:["-","_","¥",""],Equal:["=","+","×","÷"],BracketLeft:["[","{","«",""],BracketRight:["]","}","»",""],Backslash:["\\","|","¬","¦"],Semicolon:[";",":","¶","°"],Quote:["'",'"',"´","¨"],Backquote:["`","~","",""],Comma:[",","<","ç","Ç"],Period:[".",">","",""],Slash:["/","?","¿",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["\\","|","",""]}},L={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:["<",">","|","¦"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}};function C(e){let i=e.split("+"),r={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:i.pop()};return i.includes("shift")&&(r.shift=!0),i.includes("alt")&&(r.alt=!0),i.includes("ctrl")&&(r.ctrl=!0),i.includes("cmd")&&(r.cmd=!0),i.includes("win")&&(r.win=!0),i.includes("meta")&&(r.meta=!0),r}function E(e){let i="";return e.shift&&(i+="shift+"),e.alt&&(i+="alt+"),e.ctrl&&(i+="ctrl+"),e.cmd&&(i+="cmd+"),e.win&&(i+="win+"),e.meta&&(i+="meta+"),i+e.key}var A,z={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]"},T=[];function D(){switch(w()){case"macos":case"ios":return"apple";case"windows":return"windows"}return"linux"}function K(e){e.platform&&e.platform!==D()||T.push(e)}function B(e){A=T.find(i=>e.startsWith(i.locale))}function $(){return null!=A?A:T[0]}switch(D()){case"apple":K(M),K({id:"apple.french",locale:"fr",displayName:"French",platform:"apple",virtualLayout:"azerty",score:0,mapping:{KeyA:["q","Q","‡","Ω"],KeyB:["b","B","ß","∫"],KeyC:["c","C","©","¢"],KeyD:["d","D","∂","∆"],KeyE:["e","E","ê","Ê"],KeyF:["f","F","ƒ","·"],KeyG:["g","G","fi","fl"],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:["é","2","ë","„"],Digit3:['"',"3","“","”"],Digit4:["'","4","‘","’"],Digit5:["(","5","{","["],Digit6:["§","6","¶","å"],Digit7:["è","7","«","»"],Digit8:["!","8","¡","Û"],Digit9:["ç","9","Ç","Á"],Digit0:["à","0","ø","Ø"],Space:[" "," "," "," "],Minus:[")","°","}","]"],Equal:["-","_","—","–"],BracketLeft:["^","¨","ô","Ô"],BracketRight:["$","*","€","¥"],Backslash:["`","£","@","#"],Semicolon:["m","M","µ","Ó"],Quote:["ù","%","Ù","‰"],Backquote:["<",">","≤","≥"],Comma:[";",".","…","•"],Period:[":","/","÷","\\"],Slash:["=","+","≠","±"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",".",",","."],IntlBackslash:["@","#","•","Ÿ"],NumpadEqual:["=","=","=","="]}}),K({id:"apple.spanish",locale:"es",displayName:"Spanish ISO",platform:"apple",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["b","B","ß",""],KeyC:["c","C","©"," "],KeyD:["d","D","∂","∆"],KeyE:["e","E","€","€"],KeyF:["f","F","ƒ","fi"],KeyG:["g","G","","fl"],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","·","#","•"],Digit4:["4","$","¢","£"],Digit5:["5","%","∞","‰"],Digit6:["6","&","¬"," "],Digit7:["7","/","÷","⁄"],Digit8:["8","(","“","‘"],Digit9:["9",")","”","’"],Digit0:["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:["º","ª","\\","°"]}}),K({id:"apple.german",locale:"de",displayName:"German",virtualLayout:"qwertz",platform:"apple",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["b","B","∫","‹"],KeyC:["c","C","ç","Ç"],KeyD:["d","D","∂","™"],KeyE:["e","E","€","‰"],KeyF:["f","F","ƒ","Ï"],KeyG:["g","G","©","Ì"],KeyH:["h","H","ª","Ó"],KeyI:["i","I","⁄","Û"],KeyJ:["j","J","º","ı"],KeyK:["k","K","∆","ˆ"],KeyL:["l","L","@","fl"],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:["z","Z","Ω","ˇ"],KeyZ:["y","Y","¥","‡"],Digit1:["1","!","¡","¬"],Digit2:["2",'"',"“","”"],Digit3:["3","§","¶","#"],Digit4:["4","$","¢","£"],Digit5:["5","%","[","fi"],Digit6:["6","&","]","^"],Digit7:["7","/","|","\\"],Digit8:["8","(","{","˜"],Digit9:["9",")","}","·"],Digit0:["0","=","≠","¯"],Space:[" "," "," "," "],Minus:["ß","?","¿","˙"],Equal:["´","`","'","˚"],BracketLeft:["ü","Ü","•","°"],BracketRight:["+","*","±",""],Backslash:["#","'","‘","’"],Semicolon:["ö","Ö","œ","Œ"],Quote:["ä","Ä","æ","Æ"],Backquote:["<",">","≤","≥"],Comma:[",",";","∞","˛"],Period:[".",":","…","÷"],Slash:["-","_","–","—"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",",",".","."],IntlBackslash:["^","°","„","“"],NumpadEqual:["=","=","=","="]}});break;case"windows":K(S),K({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","€",""],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:["é","2","~",""],Digit3:['"',"3","#",""],Digit4:["'","4","{",""],Digit5:["(","5","[",""],Digit6:["-","6","|",""],Digit7:["è","7","`",""],Digit8:["_","8","\\",""],Digit9:["ç","9","^",""],Digit0:["à","0","@",""],Space:[" "," ","",""],Minus:[")","°","]",""],Equal:["=","+","}",""],BracketLeft:["^","¨","",""],BracketRight:["$","£","¤",""],Backslash:["*","µ","",""],Semicolon:["m","M","",""],Quote:["ù","%","",""],Backquote:["²","","",""],Comma:[";",".","",""],Period:[":","/","",""],Slash:["!","§","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}}),K({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","€",""],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","·","#",""],Digit4:["4","$","~",""],Digit5:["5","%","€",""],Digit6:["6","&","¬",""],Digit7:["7","/","",""],Digit8:["8","(","",""],Digit9:["9",")","",""],Digit0:["0","=","",""],Space:[" "," ","",""],Minus:["'","?","",""],Equal:["¡","¿","",""],BracketLeft:["`","^","[",""],BracketRight:["+","*","]",""],Backslash:["ç","Ç","}",""],Semicolon:["ñ","Ñ","",""],Quote:["´","¨","{",""],Backquote:["º","ª","\\",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}}),K({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","€",""],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:["z","Z","",""],KeyZ:["y","Y","",""],Digit1:["1","!","",""],Digit2:["2",'"',"²",""],Digit3:["3","§","³",""],Digit4:["4","$","",""],Digit5:["5","%","",""],Digit6:["6","&","",""],Digit7:["7","/","{",""],Digit8:["8","(","[",""],Digit9:["9",")","]",""],Digit0:["0","=","}",""],Space:[" "," ","",""],Minus:["ß","?","\\","ẞ"],Equal:["´","`","",""],BracketLeft:["ü","Ü","",""],BracketRight:["+","*","~",""],Backslash:["#","'","",""],Semicolon:["ö","Ö","",""],Quote:["ä","Ä","",""],Backquote:["^","°","",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","|",""]}});break;case"linux":K(L),K({id:"linux.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"linux",score:0,mapping:{KeyA:["q","Q","@","Ω"],KeyB:["b","B","”","’"],KeyC:["c","C","¢","©"],KeyD:["d","D","ð","Ð"],KeyE:["e","E","€","¢"],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","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:["é","2","~","⅛"],Digit3:['"',"3","#","£"],Digit4:["'","4","{","$"],Digit5:["(","5","[","⅜"],Digit6:["-","6","|","⅝"],Digit7:["è","7","`","⅞"],Digit8:["_","8","\\","™"],Digit9:["ç","9","^","±"],Digit0:["à","0","@","°"],Enter:["\r","\r","\r","\r"],Escape:["\x1b","\x1b","\x1b","\x1b"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:[")","°","]","¿"],Equal:["=","+","}","̨"],BracketLeft:["̂","̈","̈","̊"],BracketRight:["$","£","¤","̄"],Backslash:["*","µ","̀","̆"],Semicolon:["m","M","µ","º"],Quote:["ù","%","̂","̌"],Backquote:["²","~","¬","¬"],Comma:[";",".","─","×"],Period:[":","/","·","÷"],Slash:["!","§","̣","̇"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","¦"]}}),K({id:"linux.spanish",locale:"es",displayName:"Spanish",platform:"linux",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","æ","Æ"],KeyB:["b","B","”","’"],KeyC:["c","C","¢","©"],KeyD:["d","D","ð","Ð"],KeyE:["e","E","€","¢"],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","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","·","#","£"],Digit4:["4","$","~","$"],Digit5:["5","%","½","⅜"],Digit6:["6","&","¬","⅝"],Digit7:["7","/","{","⅞"],Digit8:["8","(","[","™"],Digit9:["9",")","]","±"],Digit0:["0","=","}","°"],Enter:["\r","\r","\r","\r"],Escape:["\x1b","\x1b","\x1b","\x1b"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["'","?","\\","¿"],Equal:["¡","¿","̃","~"],BracketLeft:["̀","̂","[","̊"],BracketRight:["+","*","]","̄"],Backslash:["ç","Ç","}","̆"],Semicolon:["ñ","Ñ","~","̋"],Quote:["́","̈","{","{"],Backquote:["º","ª","\\","\\"],Comma:[",",";","─","×"],Period:[".",":","·","÷"],Slash:["-","_","̣","̇"],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:["<",">","|","¦"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}}),K({id:"linux.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","€","€"],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:["z","Z","←","¥"],KeyZ:["y","Y","»","›"],Digit1:["1","!","¹","¡"],Digit2:["2",'"',"²","⅛"],Digit3:["3","§","³","£"],Digit4:["4","$","¼","¤"],Digit5:["5","%","½","⅜"],Digit6:["6","&","¬","⅝"],Digit7:["7","/","{","⅞"],Digit8:["8","(","[","™"],Digit9:["9",")","]","±"],Digit0:["0","=","}","°"],Enter:["\r","\r","\r","\r"],Escape:["\x1b","\x1b","\x1b","\x1b"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["ß","?","\\","¿"],Equal:["́","̀","̧","̨"],BracketLeft:["ü","Ü","̈","̊"],BracketRight:["+","*","~","¯"],Backslash:["#","'","’","̆"],Semicolon:["ö","Ö","̋","̣"],Quote:["ä","Ä","̂","̌"],Backquote:["̂","°","′","″"],Comma:[",",";","·","×"],Period:[".",":","…","÷"],Slash:["-","_","–","—"],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:["<",">","|","̱"],AltRight:["\r","\r","\r","\r"],MetaRight:[".",".",".","."]}})}function P(e){A=T.find(i=>i.id===e)}function O(e){B(e)}function R(e){return Array.isArray(e)}K({id:"dvorak",locale:"en",displayName:"Dvorak",virtualLayout:"dvorak",platform:"",score:0,mapping:{KeyA:["a","A","å","Å"],KeyB:["x","X","≈","˛"],KeyC:["j","J","∆","Ô"],KeyD:["e","E","´","´"],KeyE:[".",">","≥","˘"],KeyF:["u","U","¨","¨"],KeyG:["i","I","ˆ","ˆ"],KeyH:["d","D","∂","Î"],KeyI:["c","C","ç","Ç"],KeyJ:["h","H","˙","Ó"],KeyK:["t","T","†","ˇ"],KeyL:["n","N","˜","˜"],KeyM:["m","M","µ","Â"],KeyN:["b","B","∫","ı"],KeyO:["r","R","®","‰"],KeyP:["l","L","¬","Ò"],KeyQ:["'",'"',"æ","Æ"],KeyR:["p","P","π","∏"],KeyS:["o","O","ø","Ø"],KeyT:["y","Y","¥","Á"],KeyU:["g","G","©","˝"],KeyV:["k","K","˚",""],KeyW:[",","<","≤","¯"],KeyX:["q","Q","œ","Œ"],KeyY:["f","F","ƒ","Ï"],KeyZ:[";",":","…","Ú"],Digit1:["1","!","¡","⁄"],Digit2:["2","@","™","€"],Digit3:["3","#","£","‹"],Digit4:["4","$","¢","›"],Digit5:["5","%","∞","fi"],Digit6:["6","^","§","fl"],Digit7:["7","&","¶","‡"],Digit8:["8","*","•","°"],Digit9:["9","(","ª","·"],Digit0:["0",")","º","‚"],Space:[" "," "," "," "],Minus:["[","{","“","”"],Equal:["]","}","‘","’"],BracketLeft:["/","?","÷","¿"],BracketRight:["=","+","≠","±"],Backslash:["\\","|","«","»"],Semicolon:["s","S","ß","Í"],Quote:["-","_","–","—"],Backquote:["`","~","`","`"],Comma:["w","W","∑","„"],Period:["v","V","√","◊"],Slash:["z","Z","Ω","¸"],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:["§","±","§","±"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}});var I={strings:{en:{"keyboard.tooltip.symbols":"Symbols","keyboard.tooltip.greek":"Greek Letters","keyboard.tooltip.numeric":"Numeric","keyboard.tooltip.alphabetic":"Roman Letters","keyboard.tooltip.previous rows":"Previous rows","keyboard.tooltip.next rows":"Next rows","keyboard.tooltip.resize":"Resize virtual keyboard","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":"n<sup>th</sup> 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":"n<sup>th</sup> 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":"%@ × %@","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":"حرف او رمز","keyboard.tooltip.greek":"حروف يونانية","keyboard.tooltip.numeric":"الرقمية","keyboard.tooltip.alphabetic":"رموز الاحرف الرومانية","tooltip.copy to clipboard":"نسخ إلى الحافظة","tooltip.cut to clipboard":"قص إلى الحافظة","tooltip.paste from clipboard":"لصق من الحافظة","tooltip.redo":"الإعادة","tooltip.toggle virtual keyboard":"تبديل لوحة المفاتيح الإفتراضية","tooltip.undo":"إلغاء","menu.insert matrix":"أدخل المصفوفة","menu.borders":"محددات المصفوفة","menu.array.add row above":"أضف صفًا بعد ذلك","menu.array.add row below":"أضف الصف قبل","menu.array.add column after":"أضف العمود بعد ذلك","menu.array.add column before":"أضف العمود قبل","menu.array.delete row":"احذف صف","menu.array.delete rows":"حذف الصفوف المحددة","menu.array.delete column":"حذف العمود","menu.array.delete columns":"حذف الأعمدة المحددة","menu.mode":"وضع","menu.mode-math":"رياضيات","menu.mode-text":"نص","menu.mode-latex":"لاتكس","tooltip.blackboard":"سبورة","tooltip.bold":"عريض","tooltip.italic":"مائل","tooltip.fraktur":"فراكتور","tooltip.script":"سكريبت","tooltip.caligraphic":"كاليجرافيك","tooltip.typewriter":"آلة كاتبة","tooltip.roman-upright":"روماني مستقيم","tooltip.row-by-col":"%@ × %@","menu.font-style":"نمط الخط","menu.accent":"تشكيل","menu.decoration":"زخرفة","menu.color":"لون","menu.background-color":"الخلفية","menu.evaluate":"تقييم","menu.simplify":"تبسيط","menu.solve":"حل","menu.solve-for":"حل لـ %@","menu.cut":"قص","menu.copy":"نسخ","menu.copy-as-latex":"نسخ كـ LaTeX","menu.copy-as-ascii-math":"نسخ كـ ASCII Math","menu.copy-as-mathml":"نسخ كـ MathML","menu.paste":"لصق","menu.select-all":"تحديد الكل","color.red":"أحمر","color.orange":"برتقالي","color.yellow":"أصفر","color.lime":"ليموني","color.green":"أخضر","color.teal":"سماوي","color.cyan":"سماوي فاتح","color.blue":"أزرق","color.indigo":"نيلي","color.purple":"بنفسجي","color.magenta":"أرجواني","color.black":"أسود","color.dark-grey":"رمادي غامق","color.grey":"رمادي","color.light-grey":"رمادي فاتح","color.white":"أبيض"},de:{"keyboard.tooltip.symbols":"Symbole","keyboard.tooltip.greek":"Griechische Buchstaben","keyboard.tooltip.numeric":"Numerisch","keyboard.tooltip.alphabetic":"Römische 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ügen","menu.borders":"Matrixtrennzeichen","menu.array.add row above":"Zeile hinzufügen nach","menu.array.add row below":"Zeile hinzufügen vor","menu.array.add column after":"Spalte hinzufügen nach","menu.array.add column before":"Spalte hinzufügen vor","menu.array.delete row":"Zeile löschen","menu.array.delete rows":"Ausgewählte Zeilen löschen","menu.array.delete column":"Spalte löschen","menu.array.delete columns":"Ausgewählte Spalten löschen","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ömisch aufrecht","tooltip.row-by-col":"%@ × %@","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ösen","menu.solve-for":"Lösen für %@","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ügen","menu.select-all":"Alles auswählen","color.red":"Rot","color.orange":"Orange","color.yellow":"Gelb","color.lime":"Limette","color.green":"Grün","color.teal":"Blaugrün","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ß"},el:{"keyboard.tooltip.symbols":"σύμβολα","keyboard.tooltip.greek":"ελληνικά γράμματα","keyboard.tooltip.numeric":"Αριθμητικός","keyboard.tooltip.alphabetic":"Ρωμαϊκά γράμματα","tooltip.copy to clipboard":"Αντιγραφή στο πρόχειρο","tooltip.redo":"Ξανακάνω","tooltip.toggle virtual keyboard":"Εναλλαγή εικονικού πληκτρολογίου","tooltip.undo":"Ξεκάνω","menu.insert matrix":"Εισαγωγή μήτρα","menu.borders":"Οριοθέτες μήτρα","menu.array.add row above":"Προσθήκη σειράς μετά","menu.array.add row below":"Προσθήκη σειράς πριν","menu.array.add column after":"Προσθήκη στήλης μετά","menu.array.add column before":"Προσθήκη στήλης πριν","menu.array.delete row":"Διαγραφή σειράς","menu.array.delete rows":"Διαγραφή επιλεγμένων σειρών","menu.array.delete column":"Διαγραφή στήλης","menu.array.delete columns":"Διαγραφή επιλεγμένων στηλών","menu.mode":"Λειτουργία","menu.mode-math":"Μαθηματικά","menu.mode-text":"Κείμενο","menu.mode-latex":"LaTeX","tooltip.blackboard":"Πίνακας","tooltip.bold":"Έντονη","tooltip.italic":"Πλάγια","tooltip.fraktur":"Φράκτουρ","tooltip.script":"Σενάριο","tooltip.caligraphic":"Καλλιγραφική","tooltip.typewriter":"Μηχανή γραφής","tooltip.roman-upright":"Ρωμαϊκό Κατακόρυφο","tooltip.row-by-col":"%@ × %@","menu.font-style":"Στυλ γραμματοσειράς","menu.accent":"Τόνος","menu.decoration":"Διακόσμηση","menu.color":"Χρώμα","menu.background-color":"Χρώμα φόντου","menu.evaluate":"Αξιολόγηση","menu.simplify":"Απλοποίηση","menu.solve":"Λύση","menu.solve-for":"Λύση για %@","menu.cut":"Αποκοπή","menu.copy":"Αντιγραφή","menu.copy-as-latex":"Αντιγραφή ως LaTeX","menu.copy-as-ascii-math":"Αντιγραφή ως ASCII Math","menu.copy-as-mathml":"Αντιγραφή ως MathML","menu.paste":"Επικόλληση","menu.select-all":"Επιλογή όλων","color.red":"Κόκκινο","color.orange":"Πορτοκαλί","color.yellow":"Κίτρινο","color.lime":"Λαχανί","color.green":"Πράσινο","color.teal":"Κυανό","color.cyan":"Γαλάζιο","color.blue":"Μπλε","color.indigo":"Ινδικό","color.purple":"Μωβ","color.magenta":"Ματζέντα","color.black":"Μαύρο","color.dark-grey":"Σκούρο Γκρι","color.grey":"Γκρι","color.light-grey":"Ανοιχτό Γκρι","color.white":"Λευκό"},es:{"keyboard.tooltip.symbols":"Símbolos","keyboard.tooltip.greek":"Letras griegas","keyboard.tooltip.numeric":"Numérico","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ñadir Matriz","menu.borders":"Delimitadores de Matriz","menu.array.add row above":"Añadir Línea Antes","menu.array.add row below":"Añadir Línea Despues","menu.array.add column after":"Añadir Columna Despues","menu.array.add column before":"Añadir Columna Antes","menu.array.delete row":"Borrar Línea","menu.array.delete rows":"Borrar Líneas Seleccionadas","menu.array.delete column":"Borrar Columna","menu.array.delete columns":"Borrar Columnas Seleccionadas","menu.mode":"Modo","menu.mode-math":"Matemáticas","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áfico","tooltip.typewriter":"Máquina de escribir","tooltip.roman-upright":"Romano Vertical","tooltip.row-by-col":"%@ × %@","menu.font-style":"Estilo de fuente","menu.accent":"Acento","menu.decoration":"Decoración","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":"Índigo","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érique","keyboard.tooltip.alphabetic":"Lettres romaines","tooltip.menu":"Menu","tooltip.copy to clipboard":"Copier dans le presse-papiers","tooltip.redo":"Rétablir","tooltip.toggle virtual keyboard":"Afficher/Masquer le clavier virtuel","tooltip.undo":"Annuler","menu.insert matrix":"Insérer une Matrice","menu.borders":"Bords","menu.array.add row above":"Ajouter une Ligne Avant","menu.array.add row below":"Ajouter une Ligne Après","menu.array.add column before":"Ajouter une Colonne Avant","menu.array.add column after":"Ajouter une Colonne Après","menu.array.delete row":"Enlever une Ligne","menu.array.delete rows":"Enlever les Lignes Sélectionées","menu.array.delete column":"Enlever une Colone","menu.array.delete columns":"Enlever les Colonnes Sélectionées","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 à écrire","tooltip.roman-upright":"Romain droit","tooltip.row-by-col":"%@ × %@","menu.font-style":"Style de police","menu.accent":"Accent","menu.decoration":"Décoration","menu.color":"Couleur","menu.background-color":"Arrière-plan","menu.evaluate":"Évaluer","menu.simplify":"Simplifier","menu.solve":"Résoudre","menu.solve-for":"Résoudre 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électionner 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é","color.grey":"Gris","color.light-grey":"Gris clair","color.white":"Blanc"},he:{"keyboard.tooltip.symbols":"סמלים","keyboard.tooltip.greek":"אותיות יווניות","keyboard.tooltip.numeric":"מספרי","keyboard.tooltip.alphabetic":"מכתבים רומיים","tooltip.copy to clipboard":"העתק ללוח","tooltip.redo":"לַעֲשׂוֹת שׁוּב","tooltip.toggle virtual keyboard":"החלף את המקלדת הווירטואלית","tooltip.undo":"לבטל","menu.insert matrix":"הכנס מטריקס","menu.borders":"מפרידי מטריקס","menu.array.add row above":"הוסף שורה אחרי","menu.array.add row below":"הוסף שורה לפני","menu.array.add column after":"הוסף עמודה אחרי","menu.array.add column before":"הוסף עמודה לפני","menu.array.delete row":"מחק שורה","menu.array.delete rows":"מחק שורות שנבחרו","menu.array.delete column":"מחק עמודה","menu.array.delete columns":"מחק עמודות שנבחרו","menu.mode":"מצב","menu.mode-math":"מתמטיקה","menu.mode-text":"טקסט","menu.mode-latex":"LaTeX","tooltip.blackboard":"לוח שחור","tooltip.bold":"מודגש","tooltip.italic":"נטוי","tooltip.fraktur":"פרקטור","tooltip.script":"כתב","tooltip.caligraphic":"קליגרפי","tooltip.typewriter":"מכונת כתיבה","tooltip.roman-upright":"רומי ישר","tooltip.row-by-col":"%@ × %@","menu.font-style":"סגנון גופן","menu.accent":"צליל","menu.decoration":"קישוט","menu.color":"צבע","menu.background-color":"רקע","menu.evaluate":"חשב","menu.simplify":"פשט","menu.solve":"פתור","menu.solve-for":"פתור עבור %@","menu.cut":"גזור","menu.copy":"העתק","menu.copy-as-latex":"העתק כ־LaTeX","menu.copy-as-ascii-math":"העתק כ־ASCII Math","menu.copy-as-mathml":"העתק כ־MathML","menu.paste":"הדבק","menu.select-all":"בחר הכל","color.red":"אדום","color.orange":"כתום","color.yellow":"צהוב","color.lime":"ירוק ליים","color.green":"ירוק","color.teal":"טיל","color.cyan":"ציאן","color.blue":"כחול","color.indigo":"אינדיגו","color.purple":"סגול","color.magenta":"מגנטה","color.black":"שחור","color.dark-grey":"אפור כהה","color.grey":"אפור","color.light-grey":"אפור בהיר","color.white":"לבן"},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à","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":"%@ × %@","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":"シンボル","keyboard.tooltip.greek":"ギリシャ文字","keyboard.tooltip.numeric":"数値","keyboard.tooltip.alphabetic":"ローマ字","tooltip.menu":"メニュー","tooltip.copy to clipboard":"クリップボードにコピー","tooltip.redo":"やり直し","tooltip.toggle virtual keyboard":"仮想キーボードの切り替え","tooltip.undo":"元に戻す","menu.insert matrix":"マトリックスを挿入","menu.borders":"行列区切り文字","menu.array.add row above":"後に行を追加","menu.array.add row below":"前に行を追加","menu.array.add column after":"後に列を追加","menu.array.add column before":"前に列を追加","menu.array.delete row":"行を削除","menu.array.delete rows":"選択した行を削除する","menu.array.delete column":"列を削除","menu.array.delete columns":"選択した列を削除する","menu.mode":"モード","menu.mode-math":"数式","menu.mode-text":"テキスト","menu.mode-latex":"LaTeX","tooltip.blackboard":"黒板","tooltip.bold":"太字","tooltip.italic":"イタリック","tooltip.fraktur":"フラクトゥール","tooltip.script":"スクリプト","tooltip.caligraphic":"カリグラフィック","tooltip.typewriter":"タイプライター","tooltip.roman-upright":"ローマ直立","tooltip.row-by-col":"%@ × %@","menu.font-style":"フォントスタイル","menu.accent":"アクセント","menu.decoration":"装飾","menu.color":"色","menu.background-color":"背景","menu.evaluate":"評価","menu.simplify":"簡略化","menu.solve":"解く","menu.solve-for":"%@ を解く","menu.cut":"切り取り","menu.copy":"コピー","menu.copy-as-latex":"LaTeXとしてコピー","menu.copy-as-ascii-math":"ASCII Mathとしてコピー","menu.copy-as-mathml":"MathMLとしてコピー","menu.paste":"貼り付け","menu.select-all":"すべて選択","color.red":"赤","color.orange":"オレンジ","color.yellow":"黄色","color.lime":"ライム","color.green":"緑","color.teal":"ティール","color.cyan":"シアン","color.blue":"青","color.indigo":"インディゴ","color.purple":"紫","color.magenta":"マゼンタ","color.black":"黒","color.dark-grey":"濃いグレー","color.grey":"グレー","color.light-grey":"薄いグレー","color.white":"白"},ko:{"keyboard.tooltip.symbols":"기호","keyboard.tooltip.greek":"그리스 문자","keyboard.tooltip.numeric":"숫자","keyboard.tooltip.alphabetic":"로마 문자","tooltip.copy to clipboard":"클립 보드에 복사","tooltip.redo":"다시 실행","tooltip.toggle virtual keyboard":"가상 키보드 전환","tooltip.undo":"실행 취소","menu.insert matrix":"행렬 삽입","menu.borders":"행렬 구분 기호","menu.array.add row above":"뒤에 행 추가","menu.array.add row below":"앞에 행 추가","menu.array.add column after":"뒤에 열 추가","menu.array.add column before":"앞에 열 추가","menu.array.delete row":"행 삭제","menu.array.delete rows":"선택한 행 삭제","menu.array.delete column":"열 삭제","menu.array.delete columns":"선택한 열 삭제","menu.mode":"모드","menu.mode-math":"수식","menu.mode-text":"텍스트","menu.mode-latex":"LaTeX","tooltip.blackboard":"칠판","tooltip.bold":"굵게","tooltip.italic":"이탤릭","tooltip.fraktur":"프랙투어","tooltip.script":"첨자","tooltip.caligraphic":"필기체","tooltip.typewriter":"타자기","tooltip.roman-upright":"일반 로마자","tooltip.row-by-col":"%@ × %@","menu.font-style":"글꼴 스타일","menu.accent":"발음 기호","menu.decoration":"장식","menu.color":"색상","menu.background-color":"배경","menu.evaluate":"평가","menu.simplify":"간소화","menu.solve":"해결","menu.solve-for":"%@에 대해 해결","menu.cut":"잘라내기","menu.copy":"복사","menu.copy-as-latex":"LaTeX로 복사","menu.copy-as-ascii-math":"ASCIIMath로 복사","menu.copy-as-mathml":"MathML로 복사","menu.paste":"붙여넣기","menu.select-all":"모두 선택","color.red":"빨강","color.orange":"주황","color.yellow":"노랑","color.lime":"라임","color.green":"초록","color.teal":"청록","color.cyan":"청색","color.blue":"파랑","color.indigo":"남색","color.purple":"보라","color.magenta":"자홍","color.black":"검정","color.dark-grey":"진한 회색","color.grey":"회색","color.light-grey":"연한 회색","color.white":"흰색"},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óć","tooltip.toggle virtual keyboard":"Przełącz klawiaturę wirtualną","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ę po","menu.array.add column before":"Dodaj kolumnę przed","menu.array.delete row":"Usuń wiersz","menu.array.delete rows":"Usuń wybrane wiersze","menu.array.delete column":"Usuń kolumnę","menu.array.delete columns":"Usuń wybrane kolumny","menu.mode":"Tryb","menu.mode-math":"Formuła","menu.mode-text":"Tekst","menu.mode-latex":"LaTeX","menu.insert":"Wstaw","menu.insert.abs":"Wartość bezwzględna","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óżniczkowy i całkowy","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ędu","menu.insert.nth-derivative-template":"\\dfrac{\\mathrm{d}^n}{\\mathrm{d}x^n}f(x)\\bigm|_{x=a}","menu.insert.integral":"Całka","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ł","menu.insert.modulus-template":"\\lvert z \\rvert","menu.insert.argument":"Argument","menu.insert.argument-template":"\\arg(z)","menu.insert.real-part":"Część rzeczywista","menu.insert.real-part-template":"\\Re(z)","menu.insert.imaginary-part":"Część urojona","menu.insert.imaginary-part-template":"\\Im(z)","menu.insert.conjugate":"Sprzężenie","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":"%@ × %@","menu.font-style":"Styl czcionki","menu.accent":"Akcent","menu.decoration":"Dekoracja","menu.color":"Kolor","menu.background-color":"Tło","menu.evaluate":"Oblicz","menu.simplify":"Uprość","menu.solve":"Rozwiąż","menu.solve-for":"Rozwiąż 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ńczowy","color.yellow":"Żółty","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ły"},pt:{"keyboard.tooltip.symbols":"Símbolos","keyboard.tooltip.greek":"Letras gregas","keyboard.tooltip.numeric":"Numérico","keyboard.tooltip.alphabetic":"Letras romanas","tooltip.copy to clipboard":"Copiar para área de transferência","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órmula","menu.mode-text":"Texto","menu.mode-latex":"LaTeX","tooltip.blackboard":"Quadro Negro","tooltip.bold":"Negrito","tooltip.italic":"Itálico","tooltip.fraktur":"Fraktur","tooltip.script":"Script","tooltip.caligraphic":"Caligráfico","tooltip.typewriter":"Máquina de Escrever","tooltip.roman-upright":"Romano Vertical","tooltip.row-by-col":"%@ × %@","menu.font-style":"Estilo da Fonte","menu.accent":"Acento","menu.decoration":"Decoração","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":"Índigo","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":"Символи","keyboard.tooltip.greek":"Грецькі літери","keyboard.tooltip.numeric":"Числовий","keyboard.tooltip.alphabetic":"Римські літери","tooltip.copy to clipboard":"Копіювати в буфер обміну","tooltip.cut to clipboard":"Вирізати в буфер обміну","tooltip.paste from clipboard":"Вставити з буфера обміну","tooltip.redo":"Повторити","tooltip.toggle virtual keyboard":"Переключити віртуальну клавіатуру","tooltip.menu":"Меню","tooltip.undo":"Скасувати","menu.borders":"Межі","menu.insert matrix":"Вставити матрицю","menu.array.add row above":"Додати рядок перед","menu.array.add row below":"Додати рядок після","menu.array.add column after":"Додати стовпець після","menu.array.add column before":"Додати стовпець перед","menu.array.delete row":"Видалити рядок","menu.array.delete rows":"Видалити вибрані рядки","menu.array.delete column":"Видалити стовпець","menu.array.delete columns":"Видалити вибрані стовпці","menu.mode":"Режим","menu.mode-math":"Математика","menu.mode-text":"Текст","menu.mode-latex":"LaTeX","menu.insert":"Вставити","menu.insert.abs":"Абсолютне значення","menu.insert.abs-template":"\\left|x\\right|","menu.insert.nth-root":"Корінь n-го степеня","menu.insert.nth-root-template":"\\sqrt[n]{x}","menu.insert.log-base":"Логарифм за основою a","menu.insert.log-base-template":"\\log_a(x)","menu.insert.heading-calculus":"Обчислення","menu.insert.derivative":"Похідна","menu.insert.derivative-template":"\\dfrac{\\mathrm{d}}{\\mathrm{d}x}f(x)\\bigm|_{x=a}","menu.insert.nth-derivative":"Похідна n-го порядку","menu.insert.nth-derivative-template":"\\dfrac{\\mathrm{d}^n}{\\mathrm{d}x^n}f(x)\\bigm|_{x=a}","menu.insert.integral":"Інтеграл","menu.insert.integral-template":"$\\int_a^b f(x)\\,\\mathrm{d}x$","menu.insert.sum":"Сума","menu.insert.sum-template":"$\\sum_{i=1}^n x_i$","menu.insert.product":"Добуток","menu.insert.product-template":"\\prod_{i=1}^n x_i","menu.insert.heading-complex-numbers":"Комплексні числа","menu.insert.modulus":"Модуль","menu.insert.modulus-template":"\\lvert z \\rvert","menu.insert.argument":"Аргумент","menu.insert.argument-template":"\\arg(z)","menu.insert.real-part":"Дійсна частина","menu.insert.real-part-template":"\\Re(z)","menu.insert.imaginary-part":"Уявна частина","menu.insert.imaginary-part-template":"\\Im(z)","menu.insert.conjugate":"Спряжене число","menu.insert.conjugate-template":"\\overline{z}","tooltip.blackboard":"Дошка","tooltip.bold":"Жирний","tooltip.italic":"Курсив","tooltip.fraktur":"Фрактурний","tooltip.script":"Рукописний","tooltip.caligraphic":"Каліграфічний","tooltip.typewriter":"Друкарський","tooltip.roman-upright":"Прямий римський","tooltip.row-by-col":"%@ × %@","menu.font-style":"Стиль шрифту","menu.accent":"Акцент","menu.decoration":"Оформлення","menu.color":"Колір","menu.background-color":"Фон","menu.evaluate":"Обчислити","menu.simplify":"Спростити","menu.solve":"Розв’язати","menu.solve-for":"Розв’язати для %@","menu.cut":"Вирізати","menu.copy":"Копіювати","menu.copy-as-latex":"Копіювати як LaTeX","menu.copy-as-ascii-math":"Копіювати як ASCII Math","menu.copy-as-mathml":"Копіювати як MathML","menu.paste":"Вставити","menu.select-all":"Вибрати все","color.red":"Червоний","color.orange":"Помаранчевий","color.yellow":"Жовтий","color.lime":"Лаймовий","color.green":"Зелений","color.teal":"Бірюзовий","color.cyan":"Синьо-зелений","color.blue":"Синій","color.indigo":"Індиго","color.purple":"Фіолетовий","color.magenta":"Пурпурний","color.black":"Чорний","color.dark-grey":"Темно-сірий","color.grey":"Сірий","color.light-grey":"Світло-сірий","color.white":"Білий"},"zh-cn":{"keyboard.tooltip.symbols":"符号","keyboard.tooltip.greek":"希腊字母","keyboard.tooltip.numeric":"数字","keyboard.tooltip.alphabetic":"罗马字母","tooltip.copy to clipboard":"复制到剪贴板","tooltip.redo":"重做","tooltip.toggle virtual keyboard":"切换虚拟键盘","tooltip.undo":"撤消","menu.insert matrix":"插入矩阵","menu.borders":"矩阵分隔符","menu.array.add row above":"在后面添加行","menu.array.add row below":"在前面添加行","menu.array.add column after":"在后面添加列r","menu.array.add column before":"在前面添加列","menu.array.delete row":"删除行","menu.array.delete rows":"删除选定行","menu.array.delete column":"删除列","menu.array.delete columns":"删除选定的列","menu.mode":"模式","menu.mode-math":"数学","menu.mode-text":"文本","menu.mode-latex":"LaTeX","tooltip.blackboard":"黑板","tooltip.bold":"粗体","tooltip.italic":"斜体","tooltip.fraktur":"Fraktur","tooltip.script":"脚本","tooltip.caligraphic":"草书","tooltip.typewriter":"打字机","tooltip.roman-upright":"罗马直立","tooltip.row-by-col":"%@ × %@","menu.font-style":"字体样式","menu.accent":"重音","menu.decoration":"装饰","menu.color":"颜色","menu.background-color":"背景","menu.evaluate":"计算","menu.simplify":"简化","menu.solve":"求解","menu.solve-for":"求解 %@","menu.cut":"剪切","menu.copy":"复制","menu.copy-as-latex":"复制为 LaTeX","menu.copy-as-ascii-math":"复制为 ASCII Math","menu.copy-as-mathml":"复制为 MathML","menu.paste":"粘贴","menu.select-all":"全选","color.red":"红色","color.orange":"橙色","color.yellow":"黄色","color.lime":"绿黄色","color.green":"绿色","color.teal":"青色","color.cyan":"蓝绿色","color.blue":"蓝色","color.indigo":"靛蓝色","color.purple":"紫色","color.magenta":"洋红色","color.black":"黑色","color.dark-grey":"深灰色","color.grey":"灰色","color.light-grey":"浅灰色","color.white":"白色"},"zh-tw":{"keyboard.tooltip.symbols":"符號","keyboard.tooltip.greek":"希臘字母","keyboard.tooltip.numeric":"數字","keyboard.tooltip.alphabetic":"羅馬字母","tooltip.copy to clipboard":"複製到剪貼板","tooltip.redo":"重做","tooltip.toggle virtual keyboard":"切換虛擬鍵盤","tooltip.undo":"撤消","menu.insert matrix":"插入矩陣","menu.borders":"矩陣分隔符","menu.array.add row above":"在後面添加行","menu.array.add row below":"在前面添加行","menu.array.add column after":"在後面添加列","menu.array.add column before":"在前面添加列","menu.array.delete row":"刪除行","menu.array.delete rows":"刪除選定行","menu.array.delete column":"刪除列","menu.array.delete columns":"刪除選定的列","menu.mode":"模式","menu.mode-math":"數學","menu.mode-text":"文本","menu.mode-latex":"LaTeX","tooltip.blackboard":"黑板","tooltip.bold":"粗體","tooltip.italic":"斜體","tooltip.fraktur":"Fraktur","tooltip.script":"腳本","tooltip.caligraphic":"草書","tooltip.typewriter":"打字機","tooltip.roman-upright":"羅馬直立","tooltip.row-by-col":"%@ × %@","menu.font-style":"字體樣式","menu.accent":"重音","menu.decoration":"裝飾","menu.color":"顏色","menu.background-color":"背景","menu.evaluate":"計算","menu.simplify":"簡化","menu.solve":"求解","menu.solve-for":"求解 %@","menu.cut":"剪下","menu.copy":"複製","menu.copy-as-latex":"複製為 LaTeX","menu.copy-as-ascii-math":"複製為 ASCII Math","menu.copy-as-mathml":"複製為 MathML","menu.paste":"貼上","menu.select-all":"全選","color.red":"紅色","color.orange":"橙色","color.yellow":"黃色","color.lime":"綠黃色","color.green":"綠色","color.teal":"青色","color.cyan":"藍綠色","color.blue":"藍色","color.indigo":"靛藍色","color.purple":"紫色","color.magenta":"洋紅色","color.black":"黑色","color.dark-grey":"深灰色","color.grey":"灰色","color.light-grey":"淺灰色","color.white":"白色"}},_locale:"",_dirty:!1,_subscribers:[],_numberFormatter:void 0,get locale(){return I._locale||(I._locale=v()?navigator.language.slice(0,5):"en-US"),I._locale},set locale(t){I._locale=t,I._numberFormatter=void 0,I.dirty=!0},get numberFormatter(){if(!I._numberFormatter)try{I._numberFormatter=new Intl.NumberFormat(I.locale)}catch(e){try{I._numberFormatter=new Intl.NumberFormat(I.locale.slice(0,2))}catch(e){I._numberFormatter=new Intl.NumberFormat("en-US")}}return I._numberFormatter},merge(e,i){if("string"==typeof e&&i)I.strings[e]=f(f({},I.strings[e]),i),I.dirty=!0;else for(let i of Object.keys(e))I.merge(i,e[i])},get dirty(){return I._dirty},set dirty(t){I._dirty||I._dirty===t||(I._dirty=!0,setTimeout(()=>{I._dirty=!1,this._subscribers.forEach(e=>null==e?void 0:e())},0))},subscribe:e=>(I._subscribers.push(e),I._subscribers.length-1),unsubscribe(e){e<0||e>=I._subscribers.length||(I._subscribers[e]=void 0)},update(e){let i=e.querySelectorAll("[data-l10n-tooltip]");for(let e of i){let i=e.getAttribute("data-l10n-tooltip");if(i){let r=N(i);r&&e.setAttribute("data-tooltip",r)}}for(let r of i=e.querySelectorAll("[data-l10n-arial-label]")){let e=r.getAttribute("data-l10n-arial-label");if(e){let i=N(e);i&&r.setAttribute("aria-label",i)}}}};function N(e,...i){if(void 0===e)return;let r="",a=I.locale;I.strings[a]&&(r=I.strings[a][e]);let o=a.slice(0,2);if(!r&&I.strings[o]&&(r=I.strings[o][e]),r||(r=I.strings.en[e]),!r)return;let n=/(%@|%([0-9]+)\$@)/g,l=n.exec(r),s=0;for(;l;){if(i[s++]){let e=i[l[2]?parseInt(l[2],10)-1:s-1];"number"==typeof e&&(e=I.numberFormatter.format(e)),r=r.replace(l[1],e)}l=n.exec(r)}return r.replace(/%%/g,"%")}var q={m0:"#3F3D99",m1:"#993D71",m2:"#998B3D",m3:"#3D9956",m4:"#3D5A99",m5:"#993D90",m6:"#996D3D",m7:"#43993D",m8:"#3D7999",m9:"#843D99"},F={blue:"#0072BD",orange:"#D95319",yellow:"#EDB120",purple:"#7E2F8E",green:"#77AC30",cyan:"#4DBEEE",red:"#A2142F"},V={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"},j={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"},H={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"},W={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 U(e){var i,r,a,o,n,l;let s=e.split("!"),c,d,u,h=255,p=255,m=255,f=-1,g=s.length>0&&s[0].startsWith("-");g&&(s[0]=s[0].slice(1));for(let e=0;e<s.length;e++){c=h,d=p,u=m;let g=null==(i=s[e].trim().match(/^([A-Za-z\d-]+)/))?void 0:i[1],b=null==g?void 0:g.toLowerCase(),y=g&&null!=(l=null!=(n=null!=(o=null!=(a=null!=(r=j[b])?r:j[H[g]])?a:F[g])?o:W[g])?n:q[g])?l:s[e].trim(),v=y.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);if(null!=v&&v[1]&&v[2]&&v[3])h=Math.max(0,Math.min(255,Number.parseInt(v[1],16))),p=Math.max(0,Math.min(255,Number.parseInt(v[2],16))),m=Math.max(0,Math.min(255,Number.parseInt(v[3],16)));else if(null!=(v=y.match(/^#([\da-f]{3})$/i))&&v[1]){let e=Number.parseInt(v[1][0],16),i=Number.parseInt(v[1][1],16),r=Number.parseInt(v[1][2],16);h=Math.max(0,Math.min(255,16*e+e)),p=Math.max(0,Math.min(255,16*i+i)),m=Math.max(0,Math.min(255,16*r+r))}else{if(null==(v=y.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i))||!v[1]||!v[2]||!v[3])return;h=Math.max(0,Math.min(255,Number.parseInt(v[1]))),p=Math.max(0,Math.min(255,Number.parseInt(v[2]))),m=Math.max(0,Math.min(255,Number.parseInt(v[3])))}f>=0&&(h=(1-f)*h+f*c,p=(1-f)*p+f*d,m=(1-f)*m+f*u,f=-1),e+1<s.length&&(f=Math.max(0,Math.min(100,Number.parseInt(s[++e])))/100)}return f>=0&&(h=f*h+(1-f)*c,p=f*p+(1-f)*d,m=f*m+(1-f)*u),g&&(h=255-h,p=255-p,m=255-m),"#"+("00"+Math.round(h).toString(16)).slice(-2)+("00"+Math.round(p).toString(16)).slice(-2)+("00"+Math.round(m).toString(16)).slice(-2)}function J(e){var i,r;return null!=(r=null!=(i=V[(e=e.trim()).toLowerCase()])?i:V[H[e]])?r:U(e)}function X(e,i,r){return r<0&&(r+=6),r>=6&&(r-=6),r<1?(i-e)*r+e:r<3?i:r<4?(i-e)*(4-r)+e:e}function G(e){return e<0?0:e>255?255:Math.round(e)}var Z={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"},Y={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},Q=[{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 ee(e,i,r){if(!/[A-Za-z\d]/.test(e)||("up"===r&&(r=void 0),!i&&!r))return;let a=e.codePointAt(0);if(void 0===a)return e;for(let e of Q)if((!i||e.variant===i)&&(!r||e.style===r)&&a>=e.offset&&a<e.offset+e.len){let i=e.start+a-e.offset;return String.fromCodePoint(Y[i]||i)}}function et(e){return e?Array.isArray(e)?e:"object"==typeof e&&"group"in e?e.group:[]:[]}var ei,er,ea={},eo=f({},Z),en={},el={},es={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`∌}",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",tr:"\\operatorname{tr}",trace:"\\operatorname{tr}",rank:"\\operatorname{rank}",diag:"\\operatorname{diag}",span:"\\operatorname{span}",proj:"\\operatorname{proj}",centernot:{def:"\\not{#1}",args:1,captureSelection:!1},fbox:{def:"\\boxed{#1}",args:1,captureSelection:!1},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:{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}}},"amsmath.sty":{package:{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}",dotso:"\\ldots",dotsc:"\\ldots",dotsb:"\\cdots",dotsm:"\\cdots",dotsi:"\\cdots",idotsint:"\\int\\!\\cdots\\!\\int",substack:{def:"\\begin{smallmatrix}#1\\end{smallmatrix}",args:1,captureSelection:!1},tag:{def:"",args:1},notag:"",allowbreak:"",nobreak:"",label:{def:"",args:1},numberthis:"",intertext:{def:"\\text{#1}",args:1,captureSelection:!1},shoveleft:"",shoveright:"",moveright:"",leftroot:{def:"",args:1},uproot:{def:"",args:1},Hat:{def:"\\hat{#1}",args:1,captureSelection:!1},Check:{def:"\\check{#1}",args:1,captureSelection:!1},Tilde:{def:"\\tilde{#1}",args:1,captureSelection:!1},Acute:{def:"\\acute{#1}",args:1,captureSelection:!1},Grave:{def:"\\grave{#1}",args:1,captureSelection:!1},Dot:{def:"\\dot{#1}",args:1,captureSelection:!1},Ddot:{def:"\\ddot{#1}",args:1,captureSelection:!1},Breve:{def:"\\breve{#1}",args:1,captureSelection:!1},Bar:{def:"\\bar{#1}",args:1,captureSelection:!1},Vec:{def:"\\vec{#1}",args:1,captureSelection:!1},pod:{def:"\\quad(#1)",args:1,expand:!1,captureSelection:!1},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}},primitive:!0},"mathtools-extra.sty":{package:{abs:{def:"\\left\\lvert #1\\right\\rvert",args:1,captureSelection:!1},norm:{def:"\\left\\lVert #1\\right\\rVert",args:1,captureSelection:!1},floor:{def:"\\left\\lfloor #1\\right\\rfloor",args:1,captureSelection:!1},ceil:{def:"\\left\\lceil #1\\right\\rceil",args:1,captureSelection:!1},"floor*":{def:"\\left\\lfloor #1\\right\\rfloor",args:1,captureSelection:!1},"ceil*":{def:"\\left\\lceil #1\\right\\rceil",args:1,captureSelection:!1},"abs*":{def:"\\left\\lvert #1\\right\\rvert",args:1,captureSelection:!1},"norm*":{def:"\\left\\lVert #1\\right\\rVert",args:1,captureSelection:!1}},primitive:!0},"physics.sty":{package:{dd:{def:"\\mathrm{d}#1",args:1,captureSelection:!1},dv:{def:"\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}",args:2,captureSelection:!1},pdv:{def:"\\frac{\\partial #1}{\\partial #2}",args:2,captureSelection:!1},diff:{def:"\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}",args:2,captureSelection:!1},derivative:{def:"\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}",args:2,captureSelection:!1},qty:{def:"\\left(#1\\right)",args:1,captureSelection:!1}},primitive:!0},"siunitx.sty":{package:{SI:{def:"#1\\,\\mathrm{#2}",args:2,captureSelection:!1},unit:{def:"\\mathrm{#1}",args:1,captureSelection:!1}},primitive:!0},"plain-tex-compat.sty":{package:{matrix:{def:"\\begin{matrix}#1\\end{matrix}",args:1,captureSelection:!1},pmatrix:{def:"\\begin{pmatrix}#1\\end{pmatrix}",args:1,captureSelection:!1},bmatrix:{def:"\\begin{bmatrix}#1\\end{bmatrix}",args:1,captureSelection:!1},Bmatrix:{def:"\\begin{Bmatrix}#1\\end{Bmatrix}",args:1,captureSelection:!1},vmatrix:{def:"\\begin{vmatrix}#1\\end{vmatrix}",args:1,captureSelection:!1},Vmatrix:{def:"\\begin{Vmatrix}#1\\end{Vmatrix}",args:1,captureSelection:!1},cases:{def:"\\begin{cases}#1\\end{cases}",args:1,captureSelection:!1},cr:"\\\\"},primitive:!0},"texvc.sty":{package:{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}"},primitive:!1}},ec={" ":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,"\\dots":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,"–":8211,"—":8212,"‘":8216,"’":8217,"“":8220,"”":8221,'"':8221,"\\ss":223,"\\ae":230,"\\oe":339,"\\AE":198,"\\OE":338,"\\O":216,"\\i":305,"\\j":567,"\\aa":229,"\\AA":197},ed=/[\w!@*()-=+{}\[\]\\';:?/.,~<>`|$%#&^" ]/;function eu(e,i,r="mord",a){void 0!==i&&(ea[e]={definitionType:"symbol",type:r,variant:a,codepoint:i},eo[i]||(eo[i]=e))}function eh(e,i,r){if("string"==typeof e){for(let i=0;i<e.length;i++){let r=e.charAt(i);eu(r,r.codePointAt(0))}return}for(let[a,o,n,l]of e)eu(a,o,null!=n?n:i,null!=l?l:r)}function ep(e,i){for(let r=e;r<=i;r++)eu(String.fromCodePoint(r),r)}!function(){if(!v())return!0;if(/firefox/i.test(navigator.userAgent)){let e=navigator.userAgent.match(/firefox\/(\d+)/i);return!!e&&parseInt(e[1])>=78}if(/trident/i.test(navigator.userAgent))return!1;if(/edge/i.test(navigator.userAgent)){let e=navigator.userAgent.match(/edg\/(\d+)/i);return!!e&&parseInt(e[1])>=79}return!0}()?(ei=/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/,er=/[\da-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/):(ei=RegExp("\\p{Letter}","u"),er=RegExp("[0-9\\p{Letter}]","u"));var em={cross:["\\times"],multiply:["\\times","\\cdot"],dot:["\\cdot"],times:["\\times"],divide:["\\div","\\frac"],fraction:["\\frac"],integral:["\\int","\\iint","\\iiint","\\iiiint","\\idotsint"],sum:["\\sum"],product:["\\prod"],infinity:["\\infty"],inf:["\\infty"],approximately:["\\approx"],approx:["\\approx"],less:["\\lt","\\leq"],greater:["\\gt","\\geq"],equal:["\\eq","\\equiv"],not:["\\neg","\\lnot"],and:["\\land","\\wedge"],or:["\\lor","\\vee"],arrow:["\\rightarrow","\\leftarrow"]};function ef(e){let i="auto",r=e.match(/:([^=]+)/);return r&&(i=r[1].trim()),i}function eg(e){if(!e)return[];let i=[],r=e.split("]");if(r[0].startsWith("[")){i.push({isOptional:!0,type:ef(r[0].slice(1))});for(let e=1;e<=r.length;e++)i.push(...eg(r[e]))}else if((r=e.split("}"))[0].startsWith("{")){i.push({isOptional:!1,type:ef(r[0].slice(1))});for(let e=1;e<=r.length;e++)i.push(...eg(r[e]))}return i}function eb(e){if(!e)return"";let i="",r=!0;for(let a of e)"string"==typeof a.value?i+=a.value:r=!1;return r?i:""}function ey(e,i,r){"string"==typeof e&&(e=[e]);let a={tabular:!0,rootOnly:!1,params:eg(i),createAtom:r};for(let i of e)el[i]=a}function ev(e,i,r){var a;"string"==typeof e&&(e=[e]);let o={tabular:null!=(a=null==r?void 0:r.tabular)&&a,rootOnly:!0,params:[],createAtom:i};for(let i of e)el[i]=o}function ex(e,i,r){var a,o;r||(r={});let n={definitionType:"function",params:eg(i),ifMode:r.ifMode,isFunction:null!=(a=r.isFunction)&&a,applyMode:r.applyMode,infix:null!=(o=r.infix)&&o,parse:r.parse,createAtom:r.createAtom,applyStyle:r.applyStyle,serialize:r.serialize,render:r.render};if("string"==typeof e)en["\\"+e]=n;else for(let i of e)en["\\"+i]=n}function e_(e){return oo||(oo=ek(es)),e?ek(f(f({},oo),e)):oo}function ew(e,i){var r,a,o,n;if("string"==typeof e){let o=0;return/(^|[^\\])#1/.test(e)&&(o=1),/(^|[^\\])#2/.test(e)&&(o=2),/(^|[^\\])#3/.test(e)&&(o=3),/(^|[^\\])#4/.test(e)&&(o=4),/(^|[^\\])#5/.test(e)&&(o=5),/(^|[^\\])#6/.test(e)&&(o=6),/(^|[^\\])#7/.test(e)&&(o=7),/(^|[^\\])#8/.test(e)&&(o=8),/(^|[^\\])#9/.test(e)&&(o=9),{expand:null==(r=null==i?void 0:i.expand)||r,captureSelection:null==(a=null==i?void 0:i.captureSelection)||a,args:o,def:e}}return f({expand:null==(o=null==i?void 0:i.expand)||o,captureSelection:null==(n=null==i?void 0:i.captureSelection)||n,args:0},e)}function ek(e){if(!e)return{};let i={};for(let r of Object.keys(e)){let a=e[r];if(null==a)delete i[r];else if("object"==typeof a&&"package"in a)for(let e of Object.keys(a.package))i[e]=ew(a.package[e],{expand:!a.primitive,captureSelection:a.captureSelection});else i[r]=ew(a)}return i}function eM(e,i="math"){if(!e||0===e.length)return null;let r=null;if(e.startsWith("\\")){if(r=en[e])return r.ifMode&&r.ifMode!==i?null:r;"math"===i?r=ea[e]:ec[e]&&(r={definitionType:"symbol",type:"mord",codepoint:ec[e]})}else if("math"===i){if(!(r=ea[e])&&1===e.length){let i=eL("math",e.codePointAt(0));return i.startsWith("\\")?g(f({},eM(i,"math")),{command:i}):null}}else ec[e]?r={definitionType:"symbol",type:"mord",codepoint:ec[e]}:"text"===i&&(r={definitionType:"symbol",type:"mord",codepoint:e.codePointAt(0)});return null!=r?r:null}function eS(e,i){return e.startsWith("\\")?i[e.slice(1)]:null}function eL(e,i){return void 0===i?"":"math"===e&&eo[i]?eo[i]:"text"===e&&Object.keys(ec).find(e=>ec[e]===i)||String.fromCodePoint(i)}var eC=[0,.68889,0,0,.72222],eE=[0,.68889,0,0,.66667],eA=[0,.68889,0,0,.77778],ez=[0,.68889,0,0,.61111],eT=[.16667,.68889,0,0,.77778],eD=[0,.68889,0,0,.55556],eK=[0,0,0,0,.25],eB=[0,.825,0,0,2.33334],e$=[0,.9,0,0,2.33334],eP=[0,.68889,0,0,.54028],eO=[-.03598,.46402,0,0,.5],eR=[-.13313,.36687,0,0,1],eI=[.01354,.52239,0,0,1],eN=[.01354,.52239,0,0,1.11111],eq=[0,.54986,0,0,1],eF=[0,.69224,0,0,.5],eV=[0,.43056,0,0,1],ej=[.08198,.58198,0,0,.77778],eH=[.19444,.69224,0,0,.41667],eW=[.1808,.675,0,0,1],eU=[.19444,.69224,0,0,.83334],eJ=[.13667,.63667,0,0,1],eX=[-.064,.437,0,0,1.334],eG=[.08167,.58167,0,0,.77778],eZ=[0,.69224,0,0,.72222],eY=[0,.69224,0,0,.66667],eQ=[-.13313,.36687,0,0,.77778],e0=[.06062,.54986,0,0,.77778],e1=[0,.69224,0,0,.77778],e4=[.25583,.75583,0,0,.77778],e2=[.25142,.75726,0,0,.77778],e3=[.20576,.70576,0,0,.77778],e6=[.30274,.79383,0,0,.77778],e8=[.22958,.72958,0,0,.77778],e5=[.1808,.675,0,0,.77778],e7=[.13667,.63667,0,0,.77778],e9=[.13597,.63597,0,0,.77778],te=[.03517,.54986,0,0,.77778],tt=[0,.675,0,0,.77778],ti=[.19444,.69224,0,0,.61111],tr=[0,.54986,0,0,.76042],ta=[0,.54986,0,0,.66667],to=[.0391,.5391,0,0,.77778],tn=[.03517,.54986,0,0,1.33334],tl=[.38569,.88569,0,0,.77778],ts=[.23222,.74111,0,0,.77778],tc=[.19444,.69224,0,0,.77778],td=[0,.37788,0,0,.5],tu=[0,.54986,0,0,.72222],th=[0,.69224,0,0,.83334],tp=[.11111,.69224,0,0,.66667],tm=[.26167,.75726,0,0,.77778],tf=[.48256,.98256,0,0,.77778],tg=[.28481,.79383,0,0,.77778],tb=[.08167,.58167,0,0,.22222],ty=[.08167,.58167,0,0,.38889],tv=[0,.43056,.04028,0,.66667],tx=[.41951,.91951,0,0,.77778],t_=[.24982,.74947,0,0,.38865],tw=[.08319,.58283,0,0,.75623],tk=[0,.10803,0,0,.27764],tM=[0,.47534,0,0,.50181],tS=[.18906,.47534,0,0,.50181],tL=[0,.69141,0,0,.50181],tC=[.24982,.74947,0,0,.27764],tE=[0,.69141,0,0,.21471],tA=[.25,.75,0,0,.44722],tz=[0,.64444,0,0,.575],tT=[.08556,.58556,0,0,.89444],tD=[0,.69444,0,0,.89444],tK=[0,.68611,0,0,.9],tB=[0,.68611,0,0,.86944],t$=[.25,.75,0,0,.575],tP=[.25,.75,0,0,.31944],tO=[0,.69444,0,0,.63889],tR=[0,.69444,0,0,.31944],tI=[0,.44444,0,0,.63889],tN=[0,.44444,0,0,.51111],tq=[0,.69444,0,0,.575],tF=[.13333,.63333,0,0,.89444],tV=[0,.44444,0,0,.31944],tj=[0,.69444,0,0,.86944],tH=[0,.68611,0,0,.69166],tW=[0,.68611,0,0,.83055],tU=[0,.68611,0,0,.89444],tJ=[0,.69444,0,0,.60278],tX=[.19444,.69444,0,0,.51111],tG=[0,.69444,0,0,.83055],tZ=[-.10889,.39111,0,0,1.14999],tY=[.19444,.69444,0,0,.575],tQ=[.19444,.69444,0,0,1.14999],t0=[.19444,.69444,0,0,.70277],t1=[.05556,.75,0,0,.575],t4=[0,.68611,0,0,.95833],t2=[.08556,.58556,0,0,.76666],t3=[-.02639,.47361,0,0,.575],t6=[0,.44444,0,0,.89444],t8=[0,.55556,0,0,.76666],t5=[-.10889,.39111,0,0,.89444],t7=[.00222,.50222,0,0,.89444],t9=[.19667,.69667,0,0,.89444],ie=[.08556,.58556,0,0,1.14999],it=[0,.69444,0,0,.70277],ii=[-.02778,.47222,0,0,.575],ir=[.25,.75,0,0,.51111],ia=[-.13889,.36111,0,0,1.14999],io=[.19444,.69444,0,0,1.02222],il=[.12963,.69444,0,0,.89444],is=[.19444,.69444,0,0,.44722],ic=[0,.64444,.13167,0,.59111],id=[.19444,.64444,.13167,0,.59111],iu=[0,.68611,.17208,0,.8961],ih=[.19444,.44444,.105,0,.53222],ip=[0,.44444,.085,0,.82666],im=[0,.69444,.06709,0,.59111],ig=[0,.69444,.12945,0,.35555],ib=[0,.69444,0,0,.94888],iy=[0,.69444,.11472,0,.59111],iv=[0,.68611,.10778,0,.88555],ix=[0,.69444,.07939,0,.62055],i_=[0,.69444,.12417,0,.30667],iw=[0,.64444,.13556,0,.51111],ik=[.19444,.64444,.13556,0,.51111],iM=[0,.68333,.16389,0,.74333],iS=[.19444,.43056,.08847,0,.46],iL=[0,.43056,.07514,0,.71555],iC=[0,.69444,.06646,0,.51111],iE=[0,.69444,0,0,.83129],iA=[0,.69444,.1225,0,.51111],iz=[0,.68333,.09403,0,.76666],iT=[0,.68333,.11111,0,.76666],iD=[0,.69444,.06961,0,.51444],iK=[0,.69444,0,0,.27778],iB=[.25,.75,0,0,.38889],i$=[0,.64444,0,0,.5],iP=[0,.69444,0,0,.77778],iO=[0,.68333,0,0,.75],iR=[0,.68333,0,0,.77778],iI=[0,.68333,0,0,.68056],iN=[0,.68333,0,0,.72222],iq=[.25,.75,0,0,.5],iF=[.25,.75,0,0,.27778],iV=[0,.69444,0,0,.5],ij=[0,.69444,0,0,.55556],iH=[0,.43056,0,0,.44445],iW=[0,.43056,0,0,.5],iU=[.19444,.43056,0,0,.55556],iJ=[0,.43056,0,0,.55556],iX=[.08333,.58333,0,0,.77778],iG=[0,.43056,0,0,.27778],iZ=[0,.66786,0,0,.27778],iY=[0,.69444,0,0,.75],iQ=[0,.66786,0,0,.5],i0=[0,.68333,0,0,.625],i1=[.19444,.69444,0,0,.44445],i4=[0,.69444,0,0,.72222],i2=[.19444,.69444,0,0,.5],i3=[.19444,.69444,0,0,1],i6=[.011,.511,0,0,1.126],i8=[.19444,.69444,0,0,.61111],i5=[.05556,.75,0,0,.5],i7=[0,.68333,0,0,.83334],i9=[.0391,.5391,0,0,.66667],re=[-.05555,.44445,0,0,.5],rt=[0,.43056,0,0,.77778],ri=[0,.55556,0,0,.66667],rr=[-.03625,.46375,0,0,.77778],ra=[-.01688,.48312,0,0,.77778],ro=[.0391,.5391,0,0,1],rn=[0,.69444,0,0,.61111],rl=[-.03472,.46528,0,0,.5],rs=[.25,.75,0,0,.44445],rc=[-.14236,.35764,0,0,1],rd=[.244,.744,0,0,.412],ru=[.19444,.69444,0,0,.88889],rh=[.12963,.69444,0,0,.77778],rp=[.19444,.69444,0,0,.38889],rm=[.011,.511,0,0,1.638],rf=[.19444,.69444,0,0,0],rg=[0,.44444,0,0,.575],rb=[.19444,.44444,0,0,.575],ry=[0,.68611,0,0,.75555],rv=[0,.69444,0,0,.66759],rx=[0,.68611,0,0,.80555],r_=[0,.68611,.08229,0,.98229],rw=[0,.68611,0,0,.76666],rk=[0,.44444,0,0,.58472],rM=[.19444,.44444,0,0,.6118],rS=[.19444,.43056,0,0,.5],rL=[0,.68333,.02778,.08334,.76278],rC=[0,.68333,.08125,.05556,.83125],rE=[0,.43056,0,.05556,.48472],rA=[.19444,.43056,0,.08334,.51702],rz=[.25,.75,0,0,.42778],rT=[0,.69444,0,0,.55],rD=[0,.69444,0,0,.73334],rK=[0,.69444,0,0,.79445],rB=[0,.69444,0,0,.51945],r$=[0,.69444,0,0,.70278],rP=[0,.69444,0,0,.76389],rO=[.25,.75,0,0,.34306],rR=[0,.69444,0,0,.56111],rI=[0,.69444,0,0,.25556],rN=[.19444,.45833,0,0,.56111],rq=[0,.45833,0,0,.56111],rF=[0,.69444,0,0,.30556],rV=[0,.69444,0,0,.58056],rj=[0,.69444,0,0,.67223],rH=[0,.69444,0,0,.85556],rW=[0,.69444,0,0,.55834],rU=[0,.65556,.11156,0,.5],rJ=[0,.69444,.08094,0,.70834],rX=[.17014,0,0,0,.44445],rG=[0,.69444,.0799,0,.5],rZ=[0,.69444,0,0,.73752],rY=[0,.69444,.09205,0,.5],rQ=[0,.69444,.09031,0,.77778],r0=[0,.69444,.07816,0,.27778],r1=[0,.69444,.00316,0,.5],r4=[.19444,.69444,0,0,.83334],r2=[.05556,.75,0,0,.83334],r3=[0,.75,0,0,.5],r6=[.125,.08333,0,0,.27778],r8=[0,.08333,0,0,.27778],r5=[0,.65556,0,0,.5],r7=[0,.69444,0,0,.47222],r9=[0,.69444,0,0,.66667],ae=[0,.69444,0,0,.59722],at=[0,.69444,0,0,.54167],ai=[0,.69444,0,0,.70834],ar=[.25,.75,0,0,.28889],aa=[0,.69444,0,0,.51667],ao=[0,.44444,0,0,.44445],an=[.19444,.44444,0,0,.51667],al=[0,.44444,0,0,.38333],as=[0,.44444,0,0,.51667],ac=[0,.69444,0,0,.83334],ad=[.35001,.85,0,0,.45834],au=[.35001,.85,0,0,.57778],ah=[.35001,.85,0,0,.41667],ap=[.35001,.85,0,0,.58334],am=[0,.72222,0,0,.55556],af=[1e-5,.6,0,0,.66667],ag=[1e-5,.6,0,0,.77778],ab=[.25001,.75,0,0,.94445],ay=[.306,.805,.19445,0,.47222],av=[.30612,.805,.19445,0,.47222],ax=[.25001,.75,0,0,.83334],a_=[.35001,.85,0,0,.47222],aw=[.25001,.75,0,0,1.11111],ak=[.65002,1.15,0,0,.59722],aM=[.65002,1.15,0,0,.81111],aS=[.65002,1.15,0,0,.47222],aL=[.65002,1.15,0,0,.66667],aC=[0,.75,0,0,1],aE=[.55001,1.05,0,0,1.27778],aA=[.862,1.36,.44445,0,.55556],az=[.86225,1.36,.44445,0,.55556],aT=[.55001,1.05,0,0,1.11111],aD=[.65002,1.15,0,0,.52778],aK=[.65002,1.15,0,0,.61111],aB=[.55001,1.05,0,0,1.51112],a$=[.95003,1.45,0,0,.73611],aP=[.95003,1.45,0,0,1.04445],aO=[.95003,1.45,0,0,.52778],aR=[.95003,1.45,0,0,.75],aI=[0,.75,0,0,1.44445],aN=[.95003,1.45,0,0,.58334],aq=[1.25003,1.75,0,0,.79167],aF=[1.25003,1.75,0,0,1.27778],aV=[1.25003,1.75,0,0,.58334],aj=[1.25003,1.75,0,0,.80556],aH=[0,.825,0,0,1.8889],aW=[1.25003,1.75,0,0,.63889],aU=[.64502,1.155,0,0,.875],aJ=[1e-5,.6,0,0,.875],aX=[-99e-5,.601,0,0,.66667],aG=[.64502,1.155,0,0,.66667],aZ=[1e-5,.9,0,0,.88889],aY=[.65002,1.15,0,0,.88889],aQ=[.90001,0,0,0,.88889],a0=[-.00499,.605,0,0,1.05556],a1=[0,.12,0,0,.45],a4=[0,.61111,0,0,.525],a2=[.08333,.69444,0,0,.525],a3=[-.08056,.53055,0,0,.525],a6=[-.05556,.55556,0,0,.525],a8=[0,.43056,0,0,.525],a5=[.22222,.43056,0,0,.525],a7=[0,0,0,0,.525],a9={"AMS-Regular":{32:eK,65:eC,66:eE,67:eC,68:eC,69:eE,70:ez,71:eA,72:eA,73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:eA,76:eE,77:[0,.68889,0,0,.94445],78:eC,79:eT,80:ez,81:eT,82:eC,83:eD,84:eE,85:eC,86:eC,87:[0,.68889,0,0,1],88:eC,89:eC,90:eE,107:eD,160:eK,165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:eD,295:eP,710:eB,732:e$,770:eB,771:e$,989:eG,1008:tv,8245:[0,.54986,0,0,.275],8463:eP,8487:eC,8498:eD,8502:eE,8503:[0,.68889,0,0,.44445],8504:eE,8513:[0,.68889,0,0,.63889],8592:eO,8594:eO,8602:eR,8603:eR,8606:eI,8608:eI,8610:eN,8611:eN,8619:eq,8620:eq,8621:[-.13313,.37788,0,0,1.38889],8622:eR,8624:eF,8625:eF,8630:eV,8631:eV,8634:ej,8635:ej,8638:eH,8639:eH,8642:eH,8643:eH,8644:eW,8646:eW,8647:eW,8648:eU,8649:eW,8650:eU,8651:eI,8652:eI,8653:eR,8654:eR,8655:eR,8666:eJ,8667:eJ,8669:[-.13313,.37788,0,0,1],8672:eX,8674:eX,8705:[0,.825,0,0,.5],8708:eD,8709:eG,8717:[0,.43056,0,0,.42917],8722:eO,8724:[.08198,.69224,0,0,.77778],8726:eG,8733:e1,8736:eZ,8737:eZ,8738:[.03517,.52239,0,0,.72222],8739:tb,8740:[.25142,.74111,0,0,.27778],8741:ty,8742:[.25142,.74111,0,0,.5],8756:eY,8757:eY,8764:eQ,8765:[-.13313,.37788,0,0,.77778],8769:eQ,8770:rr,8774:e6,8776:ra,8778:eG,8782:e0,8783:e0,8785:ej,8786:ej,8787:ej,8790:e1,8791:e8,8796:[.08198,.91667,0,0,.77778],8806:e4,8807:e4,8808:e2,8809:e2,8812:[.25583,.75583,0,0,.5],8814:e3,8815:e3,8816:e6,8817:e6,8818:e8,8819:e8,8822:e5,8823:e5,8828:e7,8829:e7,8830:e8,8831:e8,8832:e3,8833:e3,8840:e6,8841:e6,8842:e9,8843:e9,8847:te,8848:te,8858:ej,8859:ej,8861:ej,8862:tt,8863:tt,8864:tt,8865:tt,8872:[0,.69224,0,0,.61111],8873:eZ,8874:[0,.69224,0,0,.88889],8876:ez,8877:ez,8878:eC,8879:eC,8882:te,8883:te,8884:e7,8885:e7,8888:[0,.54986,0,0,1.11111],8890:iU,8891:ti,8892:ti,8901:[0,.54986,0,0,.27778],8903:eG,8905:eG,8906:eG,8907:e1,8908:e1,8909:[-.03598,.46402,0,0,.77778],8910:tr,8911:tr,8912:te,8913:te,8914:ta,8915:ta,8916:eY,8918:to,8919:to,8920:tn,8921:tn,8922:tl,8923:tl,8926:e7,8927:e7,8928:e6,8929:e6,8934:ts,8935:ts,8936:ts,8937:ts,8938:e3,8939:e3,8940:e6,8941:e6,8994:tc,8995:tc,9416:[.15559,.69224,0,0,.90222],9484:eF,9488:eF,9492:td,9496:td,9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:tt,9633:tt,9650:tu,9651:tu,9654:te,9660:tu,9661:tu,9664:te,9674:tp,9733:[.19444,.69224,0,0,.94445],10003:th,10016:th,10731:tp,10846:[.19444,.75583,0,0,.61111],10877:e7,10878:e7,10885:e4,10886:e4,10887:e9,10888:e9,10889:tm,10890:tm,10891:tf,10892:tf,10901:e7,10902:e7,10933:e2,10934:e2,10935:tm,10936:tm,10937:tm,10938:tm,10949:e4,10950:e4,10955:tg,10956:tg,57350:tb,57351:ty,57352:eG,57353:tv,57356:e2,57357:e2,57358:tx,57359:e6,57360:e6,57361:tx,57366:e2,57367:e2,57368:e2,57369:e2,57370:e9,57371:e9},"Caligraphic-Regular":{32:eK,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:eK},"Fraktur-Regular":{32:eK,33:[0,.69141,0,0,.29574],34:tE,38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:t_,41:t_,42:[0,.62119,0,0,.27764],43:tw,44:tk,45:tw,46:tk,47:[.24982,.74947,0,0,.50181],48:tM,49:tM,50:tM,51:tS,52:tS,53:tS,54:tL,55:tS,56:tL,57:tS,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:tC,93:tC,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:eK,8216:tE,8217:tE,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:eK,33:[0,.69444,0,0,.35],34:tJ,35:[.19444,.69444,0,0,.95833],36:t1,37:[.05556,.75,0,0,.95833],38:tD,39:tR,40:tA,41:tA,42:[0,.75,0,0,.575],43:tF,44:[.19444,.15556,0,0,.31944],45:al,46:[0,.15556,0,0,.31944],47:t$,48:tz,49:tz,50:tz,51:tz,52:tz,53:tz,54:tz,55:tz,56:tz,57:tz,58:tV,59:[.19444,.44444,0,0,.31944],60:tT,61:t5,62:tT,63:[0,.69444,0,0,.54305],64:tD,65:tB,66:[0,.68611,0,0,.81805],67:tW,68:[0,.68611,0,0,.88194],69:ry,70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:tK,73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:tH,77:[0,.68611,0,0,1.09166],78:tK,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:tB,89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:tP,92:t$,93:tP,94:tq,95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:tO,99:tN,100:tO,101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:tO,105:tR,106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:tR,109:[0,.44444,0,0,.95833],110:tI,111:rg,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:tI,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:tN,123:t$,124:tP,125:t$,126:[.35,.34444,0,0,.575],160:eK,163:[0,.69444,0,0,.86853],168:tq,172:[0,.44444,0,0,.76666],176:tj,177:tF,184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:tF,216:[.04861,.73472,0,0,.89444],223:ae,230:[0,.44444,0,0,.83055],247:tF,248:[.09722,.54167,0,0,.575],305:tV,338:[0,.68611,0,0,1.16944],339:t6,567:[.19444,.44444,0,0,.35139],710:tq,711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:tq,715:tq,728:tq,729:tR,730:tj,732:tq,733:tq,915:tH,916:t4,920:tU,923:rx,926:rw,928:tK,931:tW,933:tU,934:tW,936:tU,937:tW,8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:tR,8217:tR,8220:tJ,8221:tJ,8224:tX,8225:tX,8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:rv,8465:tG,8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:tG,8501:it,8592:tZ,8593:tY,8594:tZ,8595:tY,8596:tZ,8597:t$,8598:tQ,8599:tQ,8600:tQ,8601:tQ,8636:tZ,8637:tZ,8640:tZ,8641:tZ,8656:tZ,8657:t0,8658:tZ,8659:t0,8660:tZ,8661:[.25,.75,0,0,.70277],8704:tO,8706:[0,.69444,.06389,0,.62847],8707:tO,8709:t1,8711:t4,8712:t2,8715:t2,8722:tF,8723:tF,8725:t$,8726:t$,8727:ii,8728:t3,8729:t3,8730:[.18,.82,0,0,.95833],8733:t6,8734:[0,.44444,0,0,1.14999],8736:eZ,8739:tP,8741:t$,8743:t8,8744:t8,8745:t8,8746:t8,8747:[.19444,.69444,.12778,0,.56875],8764:t5,8768:[.19444,.69444,0,0,.31944],8771:t7,8776:[.02444,.52444,0,0,.89444],8781:t7,8801:t7,8804:t9,8805:t9,8810:ie,8811:ie,8826:tT,8827:tT,8834:tT,8835:tT,8838:t9,8839:t9,8846:t8,8849:t9,8850:t9,8851:t8,8852:t8,8853:tF,8854:tF,8855:tF,8856:tF,8857:tF,8866:it,8867:it,8868:tD,8869:tD,8900:t3,8901:[-.02639,.47361,0,0,.31944],8902:ii,8968:ir,8969:ir,8970:ir,8971:ir,8994:ia,8995:ia,9651:io,9657:ii,9661:io,9667:ii,9711:tQ,9824:il,9825:il,9826:il,9827:il,9837:[0,.75,0,0,.44722],9838:is,9839:is,10216:tA,10217:tA,10815:tK,10927:t9,10928:t9,57376:rf},"Main-BoldItalic":{32:eK,33:[0,.69444,.11417,0,.38611],34:ix,35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:ig,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:ic,49:ic,50:ic,51:ic,52:id,53:ic,54:ic,55:id,56:ic,57:ic,58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:iy,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:iu,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:iu,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:im,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:ih,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:ih,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:eK,168:[0,.69444,.11473,0,.59111],176:ib,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:ip,248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:ip,567:[.19444,.44444,.04611,0,.385],710:im,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:ig,730:ib,732:iy,733:iy,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:iu,931:[0,.68611,.11431,0,.82666],933:iv,934:[0,.68611,.05632,0,.82666],936:iv,937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:ig,8217:ig,8220:[0,.69444,.16772,0,.62055],8221:ix},"Main-Italic":{32:eK,33:i_,34:iD,35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:i_,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:iw,49:iw,50:iw,51:iw,52:ik,53:iw,54:iw,55:ik,56:iw,57:iw,58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:iA,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:iM,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:iM,79:iz,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:iM,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:iC,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:iS,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:iS,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:eK,168:[0,.66786,.10474,0,.51111],176:iE,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:iL,248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:iL,710:iC,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:iE,732:[0,.66786,.11585,0,.51111],733:iA,915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:iz,923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:iM,931:[0,.68333,.12028,0,.71555],933:iT,934:[0,.68333,.05986,0,.71555],936:iT,937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:i_,8217:i_,8220:[0,.69444,.1685,0,.51444],8221:iD,8463:eP},"Main-Regular":{32:eK,33:iK,34:iV,35:r4,36:i5,37:r2,38:iP,39:iK,40:iB,41:iB,42:r3,43:iX,44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:iq,48:i$,49:i$,50:i$,51:i$,52:i$,53:i$,54:i$,55:i$,56:i$,57:i$,58:iG,59:[.19444,.43056,0,0,.27778],60:to,61:eQ,62:to,63:r7,64:iP,65:iO,66:[0,.68333,0,0,.70834],67:iN,68:[0,.68333,0,0,.76389],69:iI,70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:iO,73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:iR,76:i0,77:[0,.68333,0,0,.91667],78:iO,79:iR,80:iI,81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:iN,85:iO,86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:iO,89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:iF,92:iq,93:iF,94:iV,95:[.31,.12056,.02778,0,.5],97:iW,98:ij,99:iH,100:ij,101:iH,102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:ij,105:iZ,106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:iK,109:[0,.43056,0,0,.83334],110:iJ,111:iW,112:iU,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:iJ,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:iH,123:iq,124:iF,125:iq,126:[.35,.31786,0,0,.5],160:eK,163:[0,.69444,0,0,.76909],167:i1,168:iQ,172:[0,.43056,0,0,.66667],176:iY,177:iX,182:i8,184:rX,198:[0,.68333,0,0,.90278],215:iX,216:[.04861,.73194,0,0,.77778],223:iV,230:[0,.43056,0,0,.72222],247:iX,248:[.09722,.52778,0,0,.5],305:iG,338:[0,.68333,0,0,1.01389],339:rt,567:[.19444,.43056,0,0,.30556],710:iV,711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:iV,715:iV,728:iV,729:iZ,730:iY,732:iQ,733:iV,915:i0,916:i7,920:iR,923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:iO,931:iN,933:iR,934:iN,936:iR,937:iN,8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:iK,8217:iK,8220:iV,8221:iV,8224:i1,8225:i1,8230:[0,.12,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:eP,8465:i4,8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:i4,8501:rn,8592:eR,8593:i2,8594:eR,8595:i2,8596:eR,8597:iq,8598:i3,8599:i3,8600:i3,8601:i3,8614:[.011,.511,0,0,1],8617:i6,8618:i6,8636:eR,8637:eR,8640:eR,8641:eR,8652:[.011,.671,0,0,1],8656:eR,8657:i8,8658:eR,8659:i8,8660:eR,8661:[.25,.75,0,0,.61111],8704:ij,8706:[0,.69444,.05556,.08334,.5309],8707:ij,8709:i5,8711:i7,8712:i9,8715:i9,8722:iX,8723:iX,8725:iq,8726:iq,8727:rl,8728:re,8729:re,8730:[.2,.8,0,0,.83334],8733:rt,8734:eV,8736:eZ,8739:iF,8741:iq,8743:ri,8744:ri,8745:ri,8746:ri,8747:[.19444,.69444,.11111,0,.41667],8764:eQ,8768:[.19444,.69444,0,0,.27778],8771:rr,8773:[-.022,.589,0,0,1],8776:ra,8781:rr,8784:[-.133,.67,0,0,.778],8801:rr,8804:e9,8805:e9,8810:ro,8811:ro,8826:to,8827:to,8834:to,8835:to,8838:e9,8839:e9,8846:ri,8849:e9,8850:e9,8851:ri,8852:ri,8853:iX,8854:iX,8855:iX,8856:iX,8857:iX,8866:rn,8867:rn,8868:iP,8869:iP,8872:[.249,.75,0,0,.867],8900:re,8901:[-.05555,.44445,0,0,.27778],8902:rl,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:rs,8969:rs,8970:rs,8971:rs,8994:rc,8995:rc,9136:rd,9137:rd,9651:ru,9657:rl,9661:ru,9667:rl,9711:i3,9824:rh,9825:rh,9826:rh,9827:rh,9837:[0,.75,0,0,.38889],9838:rp,9839:rp,10216:iB,10217:iB,10222:rd,10223:rd,10229:[.011,.511,0,0,1.609],10230:rm,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:rm,10815:iO,10927:e9,10928:e9,57376:rf},"Math-BoldItalic":{32:eK,48:rg,49:rg,50:rg,51:rb,52:rb,53:rb,54:tz,55:rb,56:tz,57:rb,65:tB,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:r_,73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:ry,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:rv,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:rk,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:eK,915:[0,.68611,.15972,0,.65694],916:t4,920:[0,.68611,.03194,0,.86722],923:rx,926:[0,.68611,.07458,0,.84125],928:r_,931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:rw,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:rk,960:[0,.44444,.03704,0,.68241],961:rM,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:rM,1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:eK,48:iW,49:iW,50:iW,51:rS,52:rS,53:rS,54:i$,55:rS,56:i$,57:rS,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:rC,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:rL,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:rE,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:eK,915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:rL,923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:rC,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:rE,960:[0,.43056,.03588,0,.57003],961:rA,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:rA,1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:eK,33:[0,.69444,0,0,.36667],34:rW,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:rF,40:rz,41:rz,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:rT,49:rT,50:rT,51:rT,52:rT,53:rT,54:rT,55:rT,56:rT,57:rT,58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:rB,64:rD,65:rD,66:rD,67:r$,68:rK,69:[0,.69444,0,0,.64167],70:rn,71:rD,72:rK,73:[0,.69444,0,0,.33056],74:rB,75:rP,76:rV,77:[0,.69444,0,0,.97778],78:rK,79:rK,80:r$,81:[.10556,.69444,0,0,.79445],82:r$,83:rn,84:rD,85:rP,86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:rD,89:[0,.69444,.0275,0,.73334],90:rj,91:rO,93:rO,94:rT,95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:rR,99:[0,.45833,0,0,.48889],100:rR,101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:rR,105:rI,106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:rI,109:[0,.45833,0,0,.86667],110:rq,111:[0,.45833,0,0,.55],112:rN,113:rN,114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:rq,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:eK,168:rT,176:rD,180:rT,184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:rT,711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:rT,729:rF,730:rD,732:rT,733:rT,915:rV,916:[0,.69444,0,0,.91667],920:rH,923:rj,926:rD,928:rK,931:rK,933:rH,934:rK,936:rH,937:rK,8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:rF,8217:rF,8220:rW,8221:rW},"SansSerif-Italic":{32:eK,33:[0,.69444,.05733,0,.31945],34:r1,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:r0,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:r6,45:[0,.44444,.01946,0,.33333],46:r8,47:[.25,.75,.13164,0,.5],48:rU,49:rU,50:rU,51:rU,52:rU,53:rU,54:rU,55:rU,56:rU,57:rU,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:r9,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:rJ,73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:at,77:[0,.69444,.08094,0,.875],78:rJ,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:rG,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:eK,168:[0,.67937,.06385,0,.5],176:rZ,184:rX,305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:rG,711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:rY,715:iV,728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:rZ,732:[0,.67659,.08826,0,.5],733:rY,915:[0,.69444,.13372,0,.54167],916:ac,920:[0,.69444,.07555,0,.77778],923:rn,926:[0,.69444,.12816,0,.66667],928:rJ,931:[0,.69444,.11983,0,.72222],933:rQ,934:[0,.69444,.04603,0,.72222],936:rQ,937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:r0,8217:r0,8220:[0,.69444,.14205,0,.5],8221:r1},"SansSerif-Regular":{32:eK,33:[0,.69444,0,0,.31945],34:iV,35:r4,36:i5,37:r2,38:[0,.69444,0,0,.75834],39:iK,40:iB,41:iB,42:r3,43:iX,44:r6,45:[0,.44444,0,0,.33333],46:r8,47:iq,48:r5,49:r5,50:r5,51:r5,52:r5,53:r5,54:r5,55:r5,56:r5,57:r5,58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:r7,64:r9,65:r9,66:r9,67:tO,68:[0,.69444,0,0,.72223],69:ae,70:[0,.69444,0,0,.56945],71:r9,72:ai,73:iK,74:r7,75:[0,.69444,0,0,.69445],76:at,77:[0,.69444,0,0,.875],78:ai,79:[0,.69444,0,0,.73611],80:tO,81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:ij,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:r9,89:[0,.69444,.025,0,.66667],90:rn,91:ar,93:ar,94:iV,95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:aa,99:ao,100:aa,101:ao,102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:aa,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:as,111:[0,.44444,0,0,.5],112:an,113:an,114:[0,.44444,.01389,0,.34167],115:al,116:[0,.57143,0,0,.36111],117:as,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:eK,168:[0,.67937,0,0,.5],176:r9,184:rX,305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:iV,711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:iV,715:iV,728:iV,729:[0,.67937,0,0,.27778],730:r9,732:[0,.67659,0,0,.5],733:iV,915:at,916:ac,920:iP,923:rn,926:r9,928:ai,931:i4,933:iP,934:i4,936:iP,937:i4,8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:iK,8217:iK,8220:iV,8221:iV},"Script-Regular":{32:eK,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:eK},"Size1-Regular":{32:eK,40:ad,41:ad,47:au,91:ah,92:au,93:ah,123:ap,125:ap,160:eK,710:am,732:am,770:am,771:am,8214:[-99e-5,.601,0,0,.77778],8593:af,8595:af,8657:ag,8659:ag,8719:ab,8720:ab,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:av,8748:ay,8749:ay,8750:av,8896:ax,8897:ax,8898:ax,8899:ax,8968:a_,8969:a_,8970:a_,8971:a_,9168:aX,10216:a_,10217:a_,10752:aw,10753:aw,10754:aw,10756:ax,10758:ax},"Size2-Regular":{32:eK,40:ak,41:ak,47:aM,91:aS,92:aM,93:aS,123:aL,125:aL,160:eK,710:aC,732:aC,770:aC,771:aC,8719:aE,8720:aE,8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:az,8748:aA,8749:aA,8750:az,8896:aT,8897:aT,8898:aT,8899:aT,8968:aD,8969:aD,8970:aD,8971:aD,10216:aK,10217:aK,10752:aB,10753:aB,10754:aB,10756:aT,10758:aT},"Size3-Regular":{32:eK,40:a$,41:a$,47:aP,91:aO,92:aP,93:aO,123:aR,125:aR,160:eK,710:aI,732:aI,770:aI,771:aI,8730:[.95003,1.45,0,0,1],8968:aN,8969:aN,8970:aN,8971:aN,10216:aR,10217:aR},"Size4-Regular":{32:eK,40:aq,41:aq,47:aF,91:aV,92:aF,93:aV,123:aj,125:aj,160:eK,710:aH,732:aH,770:aH,771:aH,8730:[1.25003,1.75,0,0,1],8968:aW,8969:aW,8970:aW,8971:aW,9115:aU,9116:aJ,9117:aU,9118:aU,9119:aJ,9120:aU,9121:aG,9122:aX,9123:aG,9124:aG,9125:aX,9126:aG,9127:aZ,9128:aY,9129:aQ,9130:[0,.3,0,0,.88889],9131:aZ,9132:aY,9133:aQ,9143:[.88502,.915,0,0,1.05556],10216:aj,10217:aj,57344:a0,57345:a0,57680:a1,57681:a1,57682:a1,57683:a1},"Typewriter-Regular":{32:a7,33:a4,34:a4,35:a4,36:a2,37:a2,38:a4,39:a4,40:a2,41:a2,42:[0,.52083,0,0,.525],43:a3,44:[.13889,.125,0,0,.525],45:a3,46:[0,.125,0,0,.525],47:a2,48:a4,49:a4,50:a4,51:a4,52:a4,53:a4,54:a4,55:a4,56:a4,57:a4,58:a8,59:[.13889,.43056,0,0,.525],60:a6,61:[-.19549,.41562,0,0,.525],62:a6,63:a4,64:a4,65:a4,66:a4,67:a4,68:a4,69:a4,70:a4,71:a4,72:a4,73:a4,74:a4,75:a4,76:a4,77:a4,78:a4,79:a4,80:a4,81:[.13889,.61111,0,0,.525],82:a4,83:a4,84:a4,85:a4,86:a4,87:a4,88:a4,89:a4,90:a4,91:a2,92:a2,93:a2,94:a4,95:[.09514,0,0,0,.525],96:a4,97:a8,98:a4,99:a8,100:a4,101:a8,102:a4,103:a5,104:a4,105:a4,106:[.22222,.61111,0,0,.525],107:a4,108:a4,109:a8,110:a8,111:a8,112:a5,113:a5,114:a8,115:a8,116:[0,.55358,0,0,.525],117:a8,118:a8,119:a8,120:a8,121:a5,122:a8,123:a2,124:a2,125:a2,126:a4,127:a4,160:a7,176:a4,184:[.19445,0,0,0,.525],305:a8,567:a5,711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:a4,715:a4,728:a4,730:a4,770:a4,771:a4,776:a4,915:a4,916:a4,920:a4,923:a4,926:a4,928:a4,931:a4,933:a4,934:a4,936:a4,937:a4,8216:a4,8217:a4,8242:a4,9251:[.11111,.21944,0,0,.525]}},oe=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,ot={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],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:[.25,.25,.25],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]},oi=[0,.5,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],or={" ":" ","​":" ",Å:"A",Ç:"C",Ð:"D",Þ:"o",å:"a",ç:"c",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function oa(e,i){void 0===e&&(e=77);let r=a9[i][e];if(r)return{defaultMetrics:!1,depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]};if(11034===e)return{defaultMetrics:!0,depth:.2,height:.8,italic:0,skew:0,width:.8};let a=String.fromCodePoint(e);if(a in or)e=or[a].codePointAt(0);else if(oe.test(a))return e=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 oo,on,ol={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]},os={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]},oc={doubleleftarrow:`M262 157
2
2
  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
3
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
4
4
  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
@@ -188,7 +188,7 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`
188
188
  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,
189
189
  -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
190
190
  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
191
- M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},od=[[8205,1],[65038,2],[127995,5],[129456,4],[917536,96]];function ou(e){var i;if(void 0===on)for(let e of(on={},od))for(let i=e[0];i<=e[0]+e[1]-1;i++)on[i]=!0;return null!=(i=on[e])&&i}function oh(e){if(/^[\u0020-\u00FF]*$/.test(e))return e;let i=[],r=function(e){let i=[];for(let r=0;r<e.length;r++){let a=e.charCodeAt(r);if(13===a&&10===e.charCodeAt(r+1)&&(a=10,r++),(13===a||12===a)&&(a=10),0===a&&(a=65533),a>=55296&&a<=56319){let i=e.charCodeAt(r+1);i>=56320&&i<=57343&&(a=65536+1024*(a-55296)+(i-56320),r++)}i.push(a)}return i}(e),a=0;for(;a<r.length;){let e=r[a++],o=r[a];if(8205===o){let e=a-1;for(a+=2;8205===r[a];)a+=2;i.push(String.fromCodePoint(...r.slice(e,a-e+1)))}else if(ou(o)){let e=a-1;for(;ou(r[a]);)a+=8205===r[a]?2:1;i.push(String.fromCodePoint(...r.slice(e,2*a-e-1)))}else e>=127462&&e<=127487?(a+=1,i.push(String.fromCodePoint(...r.slice(a-2,2)))):i.push(String.fromCodePoint(e))}return i}var op=class{constructor(e){this.obeyspaces=!1,this.pos=0,this.s=oh(e)}end(){return this.pos>=this.s.length}get(){return this.pos<this.s.length?this.s[this.pos++]:""}peek(){return this.s[this.pos]}match(e){let i="string"==typeof this.s?e.exec(this.s.slice(this.pos)):e.exec(this.s.slice(this.pos).join(""));return null!=i&&i[0]?(this.pos+=i[0].length,i[0]):""}next(){if(this.end())return null;if(!this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]+/)||this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]/))return"<space>";let e=this.get();if("\\"===e){if(!this.end()){let e=this.match(/^[a-zA-Z\*]+/);return e?this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]*/):e=this.get(),"\\"+e}}else{if("{"===e)return"<{>";if("}"===e)return"<}>";if("^"===e){if("^"===this.peek()){this.get();let e=this.match(/^(\^(\^(\^(\^[\da-f])?[\da-f])?[\da-f])?[\da-f])?[\da-f]{2}/);if(e)return String.fromCodePoint(Number.parseInt(e.slice(e.lastIndexOf("^")+1),16))}}else if("#"===e){if(!this.end()){let e=!1;if(/[\d?@]/.test(this.peek())&&(e=!0,this.pos+1<this.s.length)){let i=this.s[this.pos+1];e=/[^\dA-Za-z]/.test(i)}return e?"#"+this.get():"#"}}else if("$"===e)return"$"===this.peek()?(this.get(),"<$$>"):"<$>"}return e}};function om(e,i=null){if(!e)return[];let r=[],a="";for(let i of e.toString().split(/\r?\n/)){a&&r.push(a),a=" ";let e=i.match(/((?:\\%)|[^%])*/);null!==e&&r.push(e[0])}let o=new op(r.join("")),n=[];do n.push(...function(e,i){var r,a,o,n;let l=[],s=e.next();if(s&&"\\relax"!==s){if("\\noexpand"===s)(s=e.next())&&l.push(s);else if("\\obeyspaces"===s)e.obeyspaces=!0;else if("\\bgroup"===s)l.push("<{>");else if("\\egroup"===s)l.push("<}>");else if("\\string"===s){if(s=e.next())if(s.startsWith("\\"))for(let e of s)l.push("\\"===e?"\\backslash":e);else"<{>"===s?l.push("\\{"):"<space>"===s?l.push("~"):"<}>"===s&&l.push("\\}")}else if("\\csname"===s){for(;"<space>"===e.peek();)e.next();let o="",n=!1,c=[];do{if(0===c.length)if(/^#[\d?@]$/.test(e.peek())){let o=e.get().slice(1);s=(c=om(null!=(a=null!=(r=null==i?void 0:i(o))?r:null==i?void 0:i("?"))?a:"\\placeholder{}",i))[0]}else c=(s=e.next())?[s]:[];(n=0===c.length)||"\\endcsname"!==s||(n=!0,c.shift()),n||(n="<$>"===s||"<$$>"===s||"<{>"===s||"<}>"===s||"string"==typeof s&&s.length>1&&s.startsWith("\\")),n||(o+=c.shift())}while(!n)o&&l.push("\\"+o),l.push(...c)}else if("\\endcsname"!==s)if(s.length>1&&s.startsWith("#")){let e=s.slice(1);l.push(...om(null!=(n=null!=(o=null==i?void 0:i(e))?o:null==i?void 0:i("?"))?n:"\\placeholder{}",i))}else l.push(s)}return l}(o,i));while(!o.end())return n}function of(e){let i="",r=[];for(let a of e)a&&(i&&/^[a-zA-Z\*]/.test(a)&&r.push(i),r.push(a),/^\\[a-zA-Z]+\*?[\"\'][^\ ]+$/.test(a)&&r.push(" "),i=/\\[a-zA-Z]+\*?$/.test(a)?" ":"");return r.join("")}function og(e,...i){return e.startsWith("\\"),0===i.length?e:of([e,...i.map(e=>`{${e}}`)])}function ob(e){return of(e.map(e=>{var i;return null!=(i=({"<space>":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"})[e])?i:e}))}var oy=class e{constructor(i){e._registry[i]=this}static createAtom(i,r,a){return e._registry[i].createAtom(r,eM(r,i),a)}static serialize(i,r){var a;if(!i||0===i.length)return"";if(null!=(a=r.skipStyles)&&a){let a=[];for(let o of ox(i)){let i=e._registry[o[0].mode];a.push(...i.serialize(o,r))}return of(a)}return of(function(e,i){if(0===e.length)return[];let{parent:r}=e[0],a=null==r?void 0:r.style.fontSize,o=[];for(let n of ok(e,"fontSize")){let e=n[0].style.fontSize,l=function(e,i){let{parent:r}=e[0],a=null==r?void 0:r.style.backgroundColor;return ok(e,"backgroundColor").map(e=>{var o;if(e.length>0||"box"!==e[0].type){let n=e[0].style;if(n.backgroundColor&&"none"!==n.backgroundColor&&(!r||a!==n.backgroundColor))return og("\\colorbox",null!=(o=n.verbatimBackgroundColor)?o:n.backgroundColor,of(oM(e,g(f({},i),{defaultMode:"text"}))))}return of(oM(e,i))})}(n,i);l&&(e&&"auto"!==e&&(!r||a!==e)?o.push(["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][e],...l):o.push(...l))}return o}(i,r))}static getFont(i,r,a){return e._registry[i].getFont(r,a)}};oy._registry={};var ov=oy;function ox(e){let i=[],r=[],a="NONE";for(let o of e)"first"!==o.type&&(o.mode!==a?(r.length>0&&i.push(r),r=[o],a=o.mode):r.push(o));return r.length>0&&i.push(r),i}function o_(e){if((null==e?void 0:e.mode)!=="math")return"";let{style:i}=e;return i&&i.variantStyle&&("bold"===i.variantStyle||"bolditalic"===i.variantStyle)?"bold":""}function ow(e){if(!e)return"";let{style:i}=e;if(!i)return"";let r=i.variant;return void 0===r&&(r="normal"),!["calligraphic","fraktur","double-struck","script","monospace","sans-serif"].includes(r)&&i.variantStyle&&(r+="-"+i.variantStyle),r}function ok(e,i){let r=[],a=[],o;for(let n of e){let e;"first"!==n.type&&((e="variant"===i?ow(n):"bold"===i?o_(n):n.style[i])===o?a.push(n):(a.length>0&&r.push(a),a=[n],o=e))}return a.length>0&&r.push(a),r}function oM(e,i){var r;let{parent:a}=e[0],o=null==a?void 0:a.style.color,n=[];for(let l of ox(e)){let e=i.defaultMode;for(let s of ok(l,"color")){let l=s[0].style,c=ov._registry[s[0].mode].serialize(s,g(f({},i),{defaultMode:"text"===e?"text":"math"}));i.skipStyles||!l.color||"none"===l.color||a&&o===l.color?n.push(of(c)):n.push(og("\\textcolor",null!=(r=l.verbatimColor)?r:l.color,of(c)))}}return n}function oS(e){return e?({mord:"ord",mbin:"bin",mop:"op",mrel:"rel",mopen:"open",mclose:"close",mpunct:"punct",minner:"inner",spacing:"ignore",newline:"newline",latex:"latex",composition:"inner",error:"inner",placeholder:"ord",supsub:"ignore"})[e]:void 0}function oL(e){if(0===e.length)return"ord";let i=oS(e[0].type),r=oS(e[e.length-1].type);return i&&i===r?i:"ord"}function oC(e,i){if("string"==typeof e)return e;if("number"==typeof e){Number.isFinite(e);let r=Math.ceil(100*e)/100;return 0===r?"0":r.toString()+(null!=i?i:"")}return""}var oE=class e{constructor(i,r){var a,o,n,l,s;if("number"==typeof i?this.value=String.fromCodePoint(i):"string"==typeof i?this.value=i:I(i)?this.children=i.filter(e=>null!==e):i&&i instanceof e&&(this.children=[i]),this.children)for(let e of this.children)e.parent=this;this.type=null!=(a=null==r?void 0:r.type)?a:"ignore",this.isSelected=(null==r?void 0:r.isSelected)===!0,null!=r&&r.caret&&(this.caret=r.caret),this.classes=null!=(o=null==r?void 0:r.classes)?o:"",this.isTight=null!=(n=null==r?void 0:r.isTight)&&n,null!=r&&r.attributes&&(this.attributes=r.attributes);let c=null==r?void 0:r.fontFamily;null!=r&&r.style&&this.value&&(c=null!=(s=ov.getFont(null!=(l=r.mode)?l:"math",this,g(f({variant:"normal"},r.style),{letterShapeStyle:r.letterShapeStyle})))?s:void 0),c||(c="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,(null==r?void 0:r.maxFontSize)!==void 0&&(this.maxFontSize=r.maxFontSize),function(e,i){var r;if("latex"===e.type){e.height=.9,e.depth=.2,e._width=1;return}if(e.value){e.height=-1/0,e.depth=-1/0,e._width=0,e.skew=-1/0,e.italic=-1/0;for(let r=0;r<e.value.length;r++){let a=oa(e.value.codePointAt(r),i);e.height=Math.max(e.height,a.height),e.depth=Math.max(e.depth,a.depth),e._width+=a.width,e.skew=a.skew,e.italic=a.italic}return}if(e.children&&e.children.length>0){let i=-1/0,a=-1/0,o=0;for(let n of e.children)n.height>i&&(i=n.height),n.depth>a&&(a=n.depth),o=Math.max(o,null!=(r=n.maxFontSize)?r:0);e.height=i,e.depth=a,e._width=e.children.reduce((e,i)=>e+i.width,0),e.maxFontSize=o}}(this,c)}set atomID(e){void 0===e||0===e.length||(this.id=e)}selected(e){if(this.isSelected!==e&&(this.isSelected=e,this.children))for(let i of this.children)i.selected(e)}setStyle(e,i,r){if(void 0===i)return;let a=oC(i,r);a.length>0&&(this.cssProperties||(this.cssProperties={}),this.cssProperties[e]=a)}setTop(e){Number.isFinite(e)&&Math.abs(e)>.01&&(this.cssProperties||(this.cssProperties={}),this.cssProperties.top=oC(e,"em"),this.height-=e,this.depth+=e)}get left(){var e;return null!=(e=this.cssProperties)&&e["margin-left"]?Number.parseFloat(this.cssProperties["margin-left"]):0}set left(e){Number.isFinite(e)&&(0===e?this.cssProperties&&delete this.cssProperties["margin-left"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-left"]=oC(e,"em")))}set right(e){Number.isFinite(e)&&(0===e?this.cssProperties&&delete this.cssProperties["margin-right"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-right"]=oC(e,"em")))}set bottom(e){Number.isFinite(e)&&(0===e?this.cssProperties&&delete this.cssProperties["margin-bottom"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-bottom"]=oC(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 i=e.parent;if(!i)return this;e.isPhantom&&this.setStyle("opacity",0);let r=e.color;r&&r!==i.color&&this.setStyle("color",r);let a=e.backgroundColor;this.isSelected&&(a=function(e){let i=function(e){let i;if(e&&"#"===e[0])return(e=e.slice(1)).length<=4?(i={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},4===e.length&&(i.a=parseInt(e[3]+e[3],16)/255)):(i={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},8===e.length&&(i.a=parseInt(e[6]+e[7],16)/255)),i&&void 0===i.a&&(i.a=1),i}(e);if(!i)return e;let{h:r,s:a,l:o}=function(e){let{r:i,g:r,b:a}=e;i/=255;let o=Math.min(i,r/=255,a/=255),n=Math.max(i,r,a),l=n-o,s;n===o?s=0:i===n?s=(r-a)/l:r===n?s=2+(a-i)/l:a===n&&(s=4+(i-r)/l),(s=Math.min(60*s,360))<0&&(s+=360);let c=(o+n)/2;return{h:s,s:n===o?0:c<=.5?l/(n+o):l/(2-n-o),l:c}}(i);return function(e){let{r:i,g:r,b:a}=e,o=(0x1000000+(G(i)<<16)+(G(r)<<8)+G(a)).toString(16).slice(1);return o[0]===o[1]&&o[2]===o[3]&&o[4]===o[5]&&o[6]===o[7]&&(o=o[0]+o[2]+o[4]),"#"+o}(function(e){let[i,r,a]=[e.h,e.s,e.l];i=(i+360)%360/60,a=Math.max(0,Math.min(a,1)),r=Math.max(0,Math.min(r,1));let o=a<=.5?a*(r+1):a+r-a*r,n=2*a-o;return{r:Math.round(255*X(n,o,i+2)),g:Math.round(255*X(n,o,i)),b:Math.round(255*X(n,o,i-2))}}({h:r,s:a+=.1,l:o-=.1}))}(a)),a&&a!==i.backgroundColor&&(this.setStyle("background-color",a),this.setStyle("--bg-color",a),this.setStyle("display","inline-block"),this.setStyle("position","relative"),this.classes=this.classes?`${this.classes} ML__bg`:"ML__bg");let o=e.scalingFactor;return this.scale=o,this.skew*=o,this.italic*=o,this}toMarkup(){var e,i,r;let a=this.value?this.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"";if(this.children)for(let e of this.children)a+=e.toMarkup();let o="";if(this.svgBody)o=function(e){if(os[e]){let[i,r,a]=os[e],o=`<span class="ML__stretchy" style="height:${a}em"><svg width="100%" height="${a}em" viewBox="0 0 ${i} ${r}" preserveAspectRatio="none" ><path fill="currentcolor" d="${oc[e]}"></path></svg></span>`;return`<span style="display:inline-block;height:${Math.floor(100*a/2)/100}em;min-width:0">${o}</span>`}let[i,r,a,o]=ol[e],n,l,s=a/1e3;3===i.length?(n=["slice-1-of-3","slice-2-of-3","slice-3-of-3"],l=["xMinYMin","xMidYMin","xMaxYMin"]):2===i.length?(n=["slice-1-of-2","slice-2-of-2"],l=["xMinYMin","xMaxYMin"]):(n=["slice-1-of-1"],l=[o]);let c=i.map((e,i)=>`<span class="${n[i]}" style=height:${s}em><svg width=400em height=${s}em viewBox="0 0 400000 ${a}" preserveAspectRatio="${l[i]} slice"><path fill="currentcolor" d="${oc[e]}"></path></svg></span>`).join("");return`<span style="display:inline-block;height:${s}em;min-width:${r}em;">${c}</span>`}(this.svgBody);else if(this.svgOverlay){o=`<span style="display: inline-block;height:${Math.floor(100*(this.height+this.depth))/100}em;vertical-align:${Math.floor(100*this.depth)/100}em;">`+a+'</span><svg style="position:absolute;overflow:visible;'+`height:${Math.floor(100*(this.height+this.depth))/100}em;`;let i=null==(e=this.cssProperties)?void 0:e.padding;i?(o+=`top:${i};`,o+=`left:${i};`,o+=`width:calc(100% - 2 * ${i} );`):o+="top:0;left:0;width:100%;",o+="z-index:2;",o+='"',this.svgStyle&&(o+=this.svgStyle),o+=` viewBox="0 0 ${Math.floor(100*this.width)/100} ${Math.floor(100*(this.height+this.depth))/100}"`,o+=`>${this.svgOverlay}</svg>`}let n=[],l=this.classes.split(" ");l.push(null!=(i=({latex:"ML__raw-latex",placeholder:"ML__placeholder",error:"ML__error"})[this.type])?i:""),"latex"===this.caret&&l.push("ML__latex-caret"),this.isSelected&&l.push("ML__selected");let s=1===l.length?l[0]:l.filter((e,i,r)=>e.length>0&&r.indexOf(e)===i).join(" ");if(s.length>0&&n.push(`class=${oK(`"${s}"`)}`),this.id&&n.push(` data-atom-id=${oK(this.id)}`),this.cssId&&n.push(` id=${oK(`"${this.cssId.replace(/ /g,"-")}"`)}`),this.attributes&&n.push(...Object.keys(this.attributes).map(e=>`${oD(e)}=${oK(this.attributes[e])}`)),this.htmlData)for(let e of this.htmlData.split(",")){let i=e.match(/([^=]+)=(.+$)/);if(i){let e=oD(i[1]);if(e)if("href"===e){let e=new URL(i[2]);if("http:"!==e.protocol&&"https:"!==e.protocol)throw Error(`Invalid URL: ${i[2]}`);n.push(`href="${i[2].replace(/"/g,"&quot;")}"`)}else n.push(`data-${e}=${oK(i[2])}`)}else{let i=oD(e);i&&n.push(`data-${i} `)}}let c=null!=(r=this.cssProperties)?r:{};this.hasExplicitWidth&&void 0===c.width&&(c.width=`${Math.ceil(100*this._width)/100}em`);let d=Object.keys(c).map(e=>`${e}:${c[e]}`);if(void 0!==this.scale&&1!==this.scale&&(a.length>0||o.length>0)&&d.push(`font-size: ${Math.ceil(1e4*this.scale)/100}%`),this.htmlStyle)for(let e of this.htmlStyle.split(";")){let i=e.match(/([^:]+):(.+$)/);if(i){let e=i[1].trim().replace(/ /g,"-");e&&d.push(`${e}:${i[2]}`)}}d.length>0&&n.push(`style=${oK(d.join(";"))}`);let u="";return u=n.length>0||o.length>0?`<span ${n.join(" ")}>${a}${o}</span>`:a,"text"===this.caret?u+='<span class="ML__text-caret"></span>':"math"===this.caret&&(u+='<span class="ML__caret"></span>'),u}tryCoalesceWith(e){if(this.svgBody||!this.value||e.svgBody||!e.value)return!1;let i=this.children&&this.children.length>0,r=e.children&&e.children.length>0;if(i||r)return!1;if(e.cssProperties||this.cssProperties){for(let i of["border","border-left","border-right","border-right-width","left","margin","margin-left","margin-right","padding","position","width"])if(e.cssProperties&&i in e.cssProperties||this.cssProperties&&i in this.cssProperties)return!1}let a=this.cssProperties?Object.keys(this.cssProperties).length:0;if(a!==(e.cssProperties?Object.keys(e.cssProperties).length:0))return!1;if(a>0){for(let i of Object.keys(this.cssProperties))if(this.cssProperties[i]!==e.cssProperties[i])return!1}let o=this.classes.trim().replace(/\s+/g," ").split(" "),n=e.classes.trim().replace(/\s+/g," ").split(" ");if(o.length!==n.length)return!1;for(let[e,i]of(o.sort(),n.sort(),o.entries()))if("ML__vertical-separator"===i||i!==n[e])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 oA(e){return e.children&&(e.children=function e(i){if(!i||0===i.length)return[];i[0].children=e(i[0].children);let r=[i[0]];for(let a=1;a<i.length;a++)r[r.length-1].tryCoalesceWith(i[a])||(i[a].children=e(i[a].children),r.push(i[a]));return r}(e.children)),e}function oz(e,i){if(!e)return new oE(null,i);let r=new oE(null,{classes:"ML__strut",type:"ignore"});r.setStyle("height",Math.max(0,e.height),"em");let a=[r];if(0!==e.depth){let i=new oE(null,{classes:"ML__strut--bottom",type:"ignore"});i.setStyle("height",e.height+e.depth,"em"),i.setStyle("vertical-align",-e.depth,"em"),a.push(i)}return a.push(e),new oE(a,g(f({},i),{type:"lift"}))}function oT(e){let i=(ol[e]?ol[e][2]/1e3:os[e][2])/2,r=new oE(null,{maxFontSize:0});return r.height=i+.166,r.depth=i-.166,r.svgBody=e,r}function oD(e){if(0===(e=e.trim().replace(/ /g,"-")).length)throw Error("Invalid empty attribute name");if(/[\x20\x09\x0a\x0c\x0d"'>/=\x00-\x1f]/.test(e))throw Error(`Invalid attribute name "${e}"`);return e}function oK(e){if((e=e.trim()).startsWith('"')&&e.endsWith('"')){if(/"/.test(e.slice(1,-1)))throw Error(`Invalid attribute value: ${e}`);return e}if(e.startsWith("'")&&e.endsWith("'")){if(/'/.test(e.slice(1,-1)))throw Error(`Invalid attribute value: ${e}`);return e}if(0===e.length)throw Error("Invalid empty attribute value");return`"${e.replace(/"/g,"&quot;")}"`}var oB=class extends oE{constructor(e,i){var r;let[a,o,n]=function(e){var i;let[r,a]=function(e){if("individualShift"in e){let i=e.individualShift,r=i[0];if(null==r)return[null,0];let a=[r],o=-r.shift-r.box.depth,n=o;for(let e=1;e<i.length;e++){let o=i[e],l=-o.shift-n-o.box.depth,s=l-(r.box.height+r.box.depth);n+=l,a.push(s),a.push(o),r=o}return[a,o]}if("top"in e){let i=e.top;for(let r of e.children)i-="number"==typeof r?r:r.box.height+r.box.depth;return[e.children,i]}if("bottom"in e)return[e.children,-e.bottom];if("firstBaseline"in e){let i=e.firstBaseline[0];if("number"==typeof i)throw Error("First child must be an element.");return[e.firstBaseline,-i.box.depth]}if("shift"in e){let i=e.children[0];if("number"==typeof i)throw Error("First child must be an element.");return[e.children,-i.box.depth-e.shift]}return[null,0]}(e);if(!r)return[[],0,0];let o=new oE(null,{classes:"ML__pstrut"}),n=0;for(let e of r)if("number"!=typeof e){let i=e.box;n=Math.max(n,i.maxFontSize,i.height)}o.height=n+=2,o.setStyle("height",n,"em");let l=[],s=a,c=a,d=a,u=0;for(let e of r){if("number"==typeof e)d+=e;else{let r=e.box,a=new oE([o,r],{classes:(null!=(i=e.classes)?i:[]).join(" "),style:e.style});r.setStyle("height",r.height+r.depth,"em"),r.setStyle("display","inline-block"),a.setStyle("top",-n-d-r.depth,"em"),e.marginLeft&&a.setStyle("margin-left",e.marginLeft,"em"),e.marginRight&&a.setStyle("margin-right",e.marginRight,"em"),l.push(a),d+=r.height+r.depth,u=Math.max(u,a.width)}s=Math.min(s,d),c=Math.max(c,d)}l.forEach(e=>{e.softWidth=u});let h=new oE(l,{classes:"ML__vlist"});if(h.softWidth=u,h.height=c,h.setStyle("height",c,"em"),s>=0)return[[new oE(h,{classes:"ML__vlist-r"})],c,-s];let p=new oE(new oE(null),{classes:"ML__vlist"});p.height=-s,p.setStyle("height",-s,"em");let m=new oE(8203,{classes:"ML__vlist-s",maxFontSize:0});return m.softWidth=0,m.height=0,m.depth=0,[[new oE([h,m],{classes:"ML__vlist-r"}),new oE(p,{classes:"ML__vlist-r"})],c,-s]}(e);super(1===a.length?a[0]:a,{type:null==i?void 0:i.type,classes:(null!=(r=null==i?void 0:i.classes)?r:"")+" ML__vlist-t"+(2===a.length?" ML__vlist-t2":"")}),this.height=o,this.depth=n,this.softWidth=a.reduce((e,i)=>Math.max(e,i.width),0)}},o$={fractionNavigationOrder:"numerator-denominator",compactSerialization:!0},oP=class{constructor(e,i,r){this.id=e,this.sizeDelta=i,this.cramped=r;let a={"-4":2,"-3":1,0:0}[i];this.metrics=Object.keys(ot).reduce((e,i)=>g(f({},e),{[i]:ot[i][a]}),{})}getFontSize(e){return Math.max(1,e+this.sizeDelta)}get sup(){return oI[[0,1,0,1,2,3,2,3][this.id]]}get sub(){return oI[[0,0,0,0,2,2,2,2][this.id]]}get fracNum(){return oI[[0,1,0,1,2,3,4,5][this.id]]}get fracDen(){return oI[[0,0,0,0,2,2,4,4][this.id]]}get cramp(){return oI[[0,0,2,2,4,4,6,6][this.id]]}get isTight(){return this.sizeDelta<0}},oO={7:new oP(7,0,!1),6:new oP(6,0,!0),5:new oP(5,0,!1),4:new oP(4,0,!0),3:new oP(3,-3,!1),2:new oP(2,-3,!0),1:new oP(1,-4,!1),0:new oP(0,-4,!0)},oI=g(f({},oO),{displaystyle:oO[7],textstyle:oO[5],scriptstyle:oO[3],scriptscriptstyle:oO[1]});function oR(e,i){var r;if(!e)return 0;let a={pt:1,mm:7227/2540,cm:7227/254,ex:35271/8192,px:.75,em:10,bp:1.00375,dd:1238/1157,pc:12,in:72.27,mu:10/18}[null!=(r=e.unit)?r:"pt"];if(Number.isFinite(i)){let r=10**i;return Math.round(e.dimension/10*a*r)/r}return e.dimension*a}function oN(e,i){if(null===e)return 0;let r=oR(e)/10;if(Number.isFinite(i)){let e=10**i;return Math.round(r*e)/e}return r}function oq(e){var i;return`${e.dimension}${null!=(i=e.unit)?i:"pt"}`}function oF(e){var i,r;let a;if(null==e)return null;let o="";if("dimension"in e&&(o=`${e.dimension}${null!=(i=e.unit)?i:"pt"}`),"glue"in e&&(a=oq(e.glue),e.grow&&0!==e.grow.dimension&&(a+=` plus ${oq(e.grow)}`),e.shrink&&0!==e.shrink.dimension&&(a+=` minus ${oq(e.shrink)}`),o=a),"number"in e)if("base"in e&&"decimal"!==e.base)if("alpha"===e.base)o=`\`${String.fromCodePoint(e.number)}`;else{let i=Math.round(e.number)>>>0;"hexadecimal"===e.base?(o=Number(i).toString(16).toUpperCase(),o=i<=255?o.padStart(2,"0"):i<=65535?o.padStart(4,"0"):i<=0xffffff?o.padStart(6,"0"):o.padStart(8,"0"),o=`"${o}`):"octal"===e.base&&(o=Number(i).toString(8),o=i<=63?o.padStart(2,"0"):i<=30583?o.padStart(4,"0"):o.padStart(8,"0"),o=`'${o}`)}else o=Number(e.number).toString();return"register"in e&&("factor"in e&&(-1===e.factor?o="-":1!==e.factor&&(o=Number(e.factor).toString())),"global"in e&&e.global&&(o+="\\global"),o+=`\\${e.register}`),"string"in e&&(o=e.string),null!=(r=e.relax)&&r&&(o+="\\relax"),o}function oV(e,i){return null==e?null:"number"in e?g(f({},e),{number:e.number*i}):"register"in e?"factor"in e&&e.factor?g(f({},e),{factor:e.factor*i}):g(f({},e),{factor:i}):"dimension"in e?g(f({},e),{dimension:e.dimension*i}):"glue"in e?e.shrink&&e.grow?{glue:oV(e.glue,i),shrink:oV(e.shrink,i),grow:oV(e.grow,i)}:e.shrink?{glue:oV(e.glue,i),shrink:oV(e.shrink,i)}:e.grow?{glue:oV(e.glue,i),grow:oV(e.grow,i)}:{glue:oV(e.glue,i)}:null}var oj={"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 oH(){return{registers:f({},oj),smartFence:!1,renderPlaceholder:void 0,placeholderSymbol:"▢",letterShapeStyle:R.locale.startsWith("fr")?"french":"tex",minFontScale:0,maxMatrixCols:10,colorMap:U,backgroundColorMap:J,getMacro:e=>eS(e,e_())}}var oW=class e{constructor(i,r){var a,o,n,l,s,c,d,u,h,p,m,g,b,y,v;let x;null!=i&&i.parent?(this.parent=i.parent,x=i.parent,this.registers={}):(x=f(f({},oH()),null!=(a=null==i?void 0:i.from)?a:{}),this.registers=x.registers),x.atomIdsSettings&&(this.atomIdsSettings=f({},x.atomIdsSettings)),this.renderPlaceholder=x.renderPlaceholder,this.isPhantom=null!=(l=null!=(n=null==i?void 0:i.isPhantom)?n:null==(o=this.parent)?void 0:o.isPhantom)&&l,this.letterShapeStyle=x.letterShapeStyle,this.minFontScale=x.minFontScale,this.maxMatrixCols=x.maxMatrixCols,null!=r&&r.color&&"none"!==r.color?this.color=r.color:this.color=null!=(c=null==(s=this.parent)?void 0:s.color)?c:"",null!=r&&r.backgroundColor&&"none"!==r.backgroundColor?this.backgroundColor=r.backgroundColor:this.backgroundColor=null!=(u=null==(d=this.parent)?void 0:d.backgroundColor)?u:"",null!=r&&r.fontSize&&"auto"!==r.fontSize&&r.fontSize!==(null==(h=this.parent)?void 0:h.size)?this.size=r.fontSize:this.size=null!=(m=null==(p=this.parent)?void 0:p.size)?m:5;let _=null!=(b=null==(g=this.parent)?void 0:g.mathstyle)?b:oI.displaystyle;if("string"==typeof(null==i?void 0:i.mathstyle)){if(x instanceof e)switch(i.mathstyle){case"cramp":_=_.cramp;break;case"superscript":_=_.sup;break;case"subscript":_=_.sub;break;case"numerator":_=_.fracNum;break;case"denominator":_=_.fracDen}switch(i.mathstyle){case"textstyle":_=oI.textstyle;break;case"displaystyle":_=oI.displaystyle;break;case"scriptstyle":_=oI.scriptstyle;break;case"scriptscriptstyle":_=oI.scriptscriptstyle}}this.mathstyle=_,this.smartFence=x.smartFence,this.placeholderSymbol=x.placeholderSymbol,this.colorMap=null!=(y=x.colorMap)?y:e=>e,this.backgroundColorMap=null!=(v=x.backgroundColorMap)?v:e=>e,this.getMacro=x.getMacro,void 0!==this.parent||this.registers}makeID(){if(!this.atomIdsSettings)return;if(this.atomIdsSettings.overrideID)return this.atomIdsSettings.overrideID;if("number"!=typeof this.atomIdsSettings.seed)return`${Date.now().toString(36).slice(-2)}${Math.floor(1e5*Math.random()).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 7===this.mathstyle.id||6===this.mathstyle.id}get isCramped(){return this.mathstyle.cramped}get isTight(){return this.mathstyle.isTight}get metrics(){return this.mathstyle.metrics}get effectiveFontSize(){return Math.max(oi[Math.max(1,this.size+this.mathstyle.sizeDelta)],this.minFontScale)}getRegister(e){return this.registers&&e in this.registers?this.registers[e]:this.parent?this.parent.getRegister(e):void 0}getRegisterAsNumber(e){let i=this.getRegister(e);return"number"==typeof i?i:"string"==typeof i?Number(i):void 0}getRegisterAsGlue(e){if(this.registers&&e in this.registers){let i=this.registers[e];return"object"==typeof i&&"glue"in i?i:"object"==typeof i&&"dimension"in i?{glue:{dimension:i.dimension}}:"number"==typeof i?{glue:{dimension:i}}:void 0}if(this.parent)return this.parent.getRegisterAsGlue(e)}getRegisterAsEm(e,i){return oN(this.getRegisterAsDimension(e),i)}getRegisterAsDimension(e){if(this.registers&&e in this.registers){let i=this.registers[e];return"object"==typeof i&&"glue"in i?i.glue:"object"==typeof i&&"dimension"in i?i:"number"==typeof i?{dimension:i}:void 0}if(this.parent)return this.parent.getRegisterAsDimension(e)}setRegister(e,i){void 0===i?delete this.registers[e]:this.registers[e]=i}evaluate(e){if(!e||!("register"in e))return e;let i=this;if("global"in e&&e.global)for(;i.parent;)i=i.parent;let r=1;"factor"in e&&1!==e.factor&&void 0!==e.factor&&(r=e.factor);let a=i.getRegister(e.register);if(void 0===a)return;if("string"==typeof a)return{string:Number(a).toString()+a};if("number"==typeof a)return{number:r*a};let o=i.evaluate(a);if(void 0!==o)return"string"in o?{string:Number(a).toString()+o.string}:"number"in o?{number:r*o.number}:"dimension"in o?g(f({},o),{dimension:r*o.dimension}):"glue"in o?g(f({},o),{glue:g(f({},o.glue),{dimension:r*o.glue.dimension}),shrink:o.shrink?g(f({},o.shrink),{dimension:r*o.shrink.dimension}):void 0,grow:o.grow?g(f({},o.grow),{dimension:r*o.grow.dimension}):void 0}):e}toDimension(e){let i=this.evaluate(e);if(void 0===i)return null;if("dimension"in i)return i;if("glue"in i)return i.glue;if("number"in i)return{dimension:i.number};if("string"in i){let e=parseFloat(i.string),r=i.string.match(/(mm|cm|ex|px|em|bp|dd|pc|in|mu)$/);return r?{dimension:e,unit:r[0]}:{dimension:e}}return null}toEm(e,i){if(null===e)return 0;let r=this.toDimension(e);return null===r?0:oR(r,i)/10}toNumber(e){if(null===e)return null;let i=this.evaluate(e);return void 0===i?null:"number"in i?i.number:"dimension"in i?i.dimension:"glue"in i?i.glue.dimension:"string"in i?Number(i.string):null}toColor(e){var i,r;if(null===e)return null;let a=this.evaluate(e);return void 0===a?null:"string"in a?null!=(r=null==(i=this.colorMap)?void 0:i.call(this,a.string))?r:a.string:null}toBackgroundColor(e){var i,r;if(null===e)return null;let a=this.evaluate(e);return void 0===a?null:"string"in a?null!=(r=null==(i=this.backgroundColorMap)?void 0:i.call(this,a.string))?r:a.string:null}},oU=["body","above","below","superscript","subscript"];function oJ(e){return"string"==typeof e&&oU.includes(e)}function oX(e){return void 0!==e&&Array.isArray(e)&&2===e.length}var oG=class e{constructor(e){var i,r,a,o,n,l,s;this.isRoot=!1,this.type=e.type,"string"==typeof e.value&&(this.value=e.value),this.command=null!=(r=null!=(i=e.command)?i:this.value)?r:"",this.mode=null!=(a=e.mode)?a:"math",e.isFunction&&(this.isFunction=!0),(e.isRoot||"root"===this.type)&&(this.isRoot=!0),e.limits&&(this.subsupPlacement=e.limits),this.style=f({},null!=(o=e.style)?o:{}),this.displayContainsHighlight=null!=(n=e.displayContainsHighlight)&&n,this.captureSelection=null!=(l=e.captureSelection)&&l,this.skipBoundary=null!=(s=e.skipBoundary)&&s,void 0!==e.verbatimLatex&&null!==e.verbatimLatex&&(this.verbatimLatex=e.verbatimLatex),e.args&&(this.args=e.args),e.body&&(this.body=e.body),this._changeCounter=0}static createBox(e,i,r){var a;if(!i)return null;let o=function(e){let i,r=[],a=[];for(let o of e){if("first"===o.type){a.push(o);continue}if(i||o.style){let e=o.style;i&&e.color===i.color&&e.backgroundColor===i.backgroundColor&&e.fontSize===i.fontSize?a.push(o):(a.length>0&&r.push(a),a=[o],i=e)}else a.push(o)}return a.length>0&&r.push(a),r}(i),n=[];for(let i of o){let r=i[0].style,a=function(e,i,r){var a,o,n,l,s;if(!i||0===i.length)return null;let c=new oW({parent:e},r.style),d=!(null!=(a=c.atomIdsSettings)&&a.groupNumbers),u=[];if(1===i.length){let e=i[0],r=e.render(c);r&&(d&&e.isSelected&&r.selected(!0),u=[r])}else{let e="",r=!0;for(let a of i){null!=(o=c.atomIdsSettings)&&o.groupNumbers&&e&&(r&&a.isDigit()||!r&&oZ(a))&&(c.atomIdsSettings.overrideID=e);let i=a.render(c);c.atomIdsSettings&&(c.atomIdsSettings.overrideID=void 0),i&&(null!=(n=c.atomIdsSettings)&&n.groupNumbers&&((a.isDigit()||oZ(a))&&(!e||r!==a.isDigit())&&(r=a.isDigit(),e=null!=(l=a.id)?l:""),!e||(a.isDigit()||oZ(a))&&a.hasEmptyBranch("superscript")&&a.hasEmptyBranch("subscript")||(e="")),d&&a.isSelected&&i.selected(!0),u.push(i))}}if(0===u.length)return null;let h=new oE(u,g(f({isTight:c.isTight},r),{type:null!=(s=r.type)?s:"lift"}));return h.isSelected=u.every(e=>e.isSelected),h.wrap(c)}(e,i,{style:{color:r.color,backgroundColor:r.backgroundColor,fontSize:r.fontSize}});a&&n.push(a)}if(0===n.length)return null;let l=(null!=(a=null==r?void 0:r.classes)?a:"").trim();return 1!==n.length||l||null!=r&&r.type?new oE(n,{classes:l,type:null==r?void 0:r.type}).wrap(e):n[0].wrap(e)}static serialize(e,i){return ov.serialize(e,i)}static commonAncestor(e,i){if(e===i||e.parent===i.parent)return e.parent;let r=new WeakSet,{parent:a}=e;for(;a;)r.add(a),a=a.parent;for(a=i.parent;a;){if(r.has(a))return a;a=a.parent}}static fromJson(i){return new e("string"==typeof i?{type:"mord",value:i,mode:"math"}:i)}toJson(){if(this._json)return this._json;let e={};if(this.type&&(e.type=this.type),"math"!==this.mode&&(e.mode=this.mode),this.command&&this.command!==this.value&&(e.command=this.command),void 0!==this.value&&(e.value=this.value),this.style&&Object.keys(this.style).length>0&&(e.style=f({},this.style)),void 0!==this.verbatimLatex&&(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=this.args.map(e=>null===e?"<null>":Array.isArray(e)&&e[0]instanceof oG?{atoms:e.map(e=>e.toJson())}:"object"==typeof e&&"group"in e?{group:e.group.map(e=>e.toJson())}:e)),this._branches)for(let i of Object.keys(this._branches))this._branches[i]&&(e[i]=this._branches[i].filter(e=>"first"!==e.type).map(e=>e.toJson()));return"mord"===e.type&&2===Object.keys(e).length&&"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)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);return null!=i&&i.serialize?i.serialize(this,e):this.body&&this.command?of([og(this.command,this.bodyToLatex(e)),this.supsubToLatex(e)]):this.body?of([this.bodyToLatex(e),this.supsubToLatex(e)]):this.value&&"​"!==this.value?this.command:""}bodyToLatex(e){var i;let r=null!=(i=e.defaultMode)?i:"math"===this.mode?"math":"text";return ov.serialize(this.body,g(f({},e),{defaultMode:r}))}aboveToLatex(e){return ov.serialize(this.above,e)}belowToLatex(e){return ov.serialize(this.below,e)}supsubToLatex(e){let i="";if(e=g(f({},e),{defaultMode:"math"}),void 0!==this.branch("subscript")){let r=ov.serialize(this.subscript,e);0===r.length?i+="_{}":1===r.length&&o$.compactSerialization&&/^[0-9]$/.test(r)?i+=`_${r}`:i+=`_{${r}}`}if(void 0!==this.branch("superscript")){let r=ov.serialize(this.superscript,e);0===r.length?i+="^{}":1===r.length?"′"===r?i+="^\\prime ":"″"===r?i+="^\\doubleprime ":o$.compactSerialization&&/^[0-9]$/.test(r)?i+=`^${r}`:i+=`^{${r}}`:i+=`^{${r}}`}return i}get treeDepth(){let e=1,i=this.parent;for(;i;)i=i.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("prompt"===e.type&&!e.captureSelection)return e;e=e.parent}return null}branch(e){if(oJ(e)&&this._branches)return this._branches[e]}get branches(){if(!this._branches)return[];let e=[];for(let i of oU)this._branches[i]&&e.push(i);return e}createBranch(e){return oJ(e),oJ(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 oX(this.parentBranch)?this.parentBranch[0]:-1}get col(){return oX(this.parentBranch)?this.parentBranch[1]:-1}get body(){var e;return null==(e=this._branches)?void 0:e.body}set body(e){this.setChildren(e,"body")}get superscript(){var e;return null==(e=this._branches)?void 0:e.superscript}set superscript(e){this.setChildren(e,"superscript")}get subscript(){var e;return null==(e=this._branches)?void 0:e.subscript}set subscript(e){this.setChildren(e,"subscript")}get above(){var e;return null==(e=this._branches)?void 0:e.above}set above(e){this.setChildren(e,"above")}get below(){var e;return null==(e=this._branches)?void 0:e.below}set below(e){this.setChildren(e,"below")}applyStyle(e,i){for(let r of(this.isDirty=!0,null!=i&&i.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=f(f({},this.style),e),"none"===this.style.fontFamily&&delete this.style.fontFamily,"auto"===this.style.fontShape&&delete this.style.fontShape,"auto"===this.style.fontSeries&&delete this.style.fontSeries,"none"===this.style.color&&(delete this.style.color,delete this.style.verbatimColor),"none"===this.style.backgroundColor&&(delete this.style.backgroundColor,delete this.style.verbatimBackgroundColor),"auto"===this.style.fontSize&&delete this.style.fontSize,this.children))r.applyStyle(e,i)}getInitialBaseElement(){var e,i,r;return this.hasEmptyBranch("body")?this:(null==(e=this.body)||e[0].type,null!=(r=null==(i=this.body[1])?void 0:i.getInitialBaseElement())?r:this)}getFinalBaseElement(){return this.hasEmptyBranch("body")?this:this.body[this.body.length-1].getFinalBaseElement()}isCharacterBox(){return"leftright"!==this.type&&"genfrac"!==this.type&&"subsup"!==this.type&&"delim"!==this.type&&"array"!==this.type&&"surd"!==this.type&&"mord"===this.getFinalBaseElement().type}hasEmptyBranch(e){let i=this.branch(e);return!i||(i.length,i[0].type,1===i.length)}setChildren(e,i){var r;if(!e||(oJ(i),!oJ(i)))return;let a=(null==(r=e[0])?void 0:r.type)==="first"?[...e]:[this.makeFirstAtom(i),...e];for(let r of(this._branches?this._branches[i]=a:this._branches={[i]:a},e))r.parent=this,r.parentBranch=i;this.isDirty=!0}makeFirstAtom(i){let r=new e({type:"first",mode:this.mode});return r.parent=this,r.parentBranch=i,r}addChild(e,i){e.type,this.createBranch(i).push(e),this.isDirty=!0,e.parent=this,e.parentBranch=i}addChildBefore(e,i){i.parentBranch;let r=this.createBranch(i.parentBranch);r.splice(r.indexOf(i),0,e),this.isDirty=!0,e.parent=this,e.parentBranch=i.parentBranch}addChildAfter(e,i){i.parentBranch;let r=this.createBranch(i.parentBranch);r.splice(r.indexOf(i)+1,0,e),this.isDirty=!0,e.parent=this,e.parentBranch=i.parentBranch}addChildren(e,i){let r=this.createBranch(i);for(let a of e)a.parent=this,a.parentBranch=i,r.push(a);this.isDirty=!0}addChildrenAfter(e,i){0===e.length||e[0].type,i.parentBranch;let r=this.createBranch(i.parentBranch);for(let a of(r.splice(r.indexOf(i)+1,0,...e),this.isDirty=!0,e))a.parent=this,a.parentBranch=i.parentBranch;return e[e.length-1]}removeBranch(e){let i=this.branch(e);if(oJ(e)&&(this._branches[e]=void 0),!i)return[];for(let e of i)e.parent=void 0,e.parentBranch=void 0;i[0].type;let[r,...a]=i;return this.isDirty=!0,a}removeChild(e){if(e.parent,"first"===e.type)return;let i=this.branch(e.parentBranch),r=i.indexOf(e);i.splice(r,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 1===this.siblings.length}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 i of oU)if(this._branches[i])for(let r of this._branches[i])e.push(...r.children),e.push(r);return this._children=e,e}render(e){if("first"===this.type&&!e.atomIdsSettings)return null;let i=eM(this.command,this.mode);if(null!=i&&i.render)return i.render(this,e);let r=new oW({parent:e},this.style),a=this.createBox(r,{classes:this.parent?"":"ML__base"});return a?(!this.subsupPlacement&&(this.superscript||this.subscript)&&(a=this.attachSupsub(r,{base:a})),a.wrap(r)):null}attachSupsub(i,r){var a;let o,n=r.base,l=this.superscript,s=this.subscript;if(!l&&!s)return n;let c=null,d=null,u=null!=(a=r.isCharacterBox)?a:this.isCharacterBox(),h=0;if(l){let r=new oW({parent:i,mathstyle:"superscript"});c=e.createBox(r,l),u||(h=n.height-i.metrics.supDrop*r.scalingFactor)}let p=0;if(s){let r=new oW({parent:i,mathstyle:"subscript"});d=e.createBox(r,s),u||(p=n.depth+i.metrics.subDrop*r.scalingFactor)}o=i.isDisplayStyle?i.metrics.sup1:i.isCramped?i.metrics.sup3:i.metrics.sup2;let m=.05/i.scalingFactor,f=null;if(d&&c){h=Math.max(h,o,c.depth+.25*i.metrics.xHeight),p=Math.max(p,i.metrics.sub2);let e=i.metrics.defaultRuleThickness;if(h-c.depth-(d.height-p)<4*e){p=4*e-(h-c.depth)+d.height;let r=.8*i.metrics.xHeight-(h-c.depth);r>0&&(h+=r,p-=r)}f=new oB({individualShift:[{box:d,shift:p,marginLeft:"extensible-symbol"===this.type&&n.italic?-n.italic:0},{box:c,shift:-h}]})}else d&&!c?f=new oB({shift:p=Math.max(p,i.metrics.sub1,d.height-.3448),children:[{box:d,marginRight:m,marginLeft:this.isCharacterBox()?-n.italic:0}]}):!d&&c&&(f=new oB({shift:-(h=Math.max(h,o,c.depth+.10775)),children:[{box:c,marginRight:m}]}));return new oE([n,new oE(f,{caret:this.caret,isSelected:this.isSelected,classes:"ML__msubsup"})],{type:r.type})}attachLimits(i,r){var a,o,n,l,s,c;let d,u,h,p,m,b,y=this.superscript?e.createBox(new oW({parent:i,mathstyle:"superscript"},this.style),this.superscript):null,v=this.subscript?e.createBox(new oW({parent:i,mathstyle:"subscript"},this.style),this.subscript):null;return y||v?(a=g(f({},r),{above:y,below:v}),d=i.metrics,u=new oE(a.base),h=null!=(o=a.baseShift)?o:0,p=null!=(n=a.slant)?n:0,m=0,b=0,a.above&&(m=null!=(l=a.aboveShift)?l:Math.max(d.bigOpSpacing1,d.bigOpSpacing3-a.above.depth)),a.below&&(b=null!=(s=a.belowShift)?s:Math.max(d.bigOpSpacing2,d.bigOpSpacing4-a.below.height)),new oE(a.below&&a.above?new oB({bottom:d.bigOpSpacing5+a.below.height+a.below.depth+b+u.depth+h,children:[d.bigOpSpacing5,{box:a.below,marginLeft:-p,classes:["ML__center"]},b,{box:u,classes:["ML__center"]},m,{box:a.above,marginLeft:p,classes:["ML__center"]},d.bigOpSpacing5]}).wrap(i):a.below&&!a.above?new oB({top:u.height-h,children:[d.bigOpSpacing5,{box:a.below,marginLeft:-p,classes:["ML__center"]},b,{box:u,classes:["ML__center"]}]}).wrap(i):!a.below&&a.above?new oB({bottom:u.depth+h,children:[{box:u,classes:["ML__center"]},m,{box:a.above,marginLeft:p,classes:["ML__center"]},d.bigOpSpacing5]}).wrap(i):new oB({bottom:u.depth+h,children:[{box:u},d.bigOpSpacing5]}).wrap(i),{type:null!=(c=a.type)?c:"op"})):r.base.wrap(i)}bind(e,i){if(!i||e.isPhantom||"​"===this.value)return i;let r=this.parent;for(;r&&!r.captureSelection;)r=r.parent;return null!=r&&r.captureSelection||(this.id||(this.id=e.makeID()),i.atomID=this.id),i}createBox(i,r){var a,o,n,l;let s=null!=(a=this.value)?a:this.body,c=null!=(o=null==r?void 0:r.boxType)?o:oS(this.type),d=null!=(n=null==r?void 0:r.classes)?n:"";"text"===this.mode&&(d+=" ML__text");let u="string"==typeof s||void 0===s?new oE(null!=s?s:null,{type:c,isSelected:this.isSelected,mode:this.mode,maxFontSize:i.scalingFactor,style:g(f({variant:"normal"},this.style),{fontSize:Math.max(1,i.size+i.mathstyle.sizeDelta)}),letterShapeStyle:i.letterShapeStyle,classes:d}):null!=(l=e.createBox(i,s,{type:c,classes:d}))?l:new oE(null);return i.isTight&&(u.isTight=!0),("math"!==this.mode||"main"===this.style.variant)&&(u.italic=0),u.right=u.italic,this.bind(i,u),!this.caret||this.superscript||this.subscript||(u.caret=this.caret),u}isDigit(){var e;return"mord"===this.type&&this.value?/^[\d,\.]$/.test(this.value):"group"===this.type&&(null==(e=this.body)?void 0:e.length)===2&&"first"===this.body[0].type&&","===this.body[1].value}asDigit(){var e;return"mord"===this.type&&this.value&&/^[\d,\.]$/.test(this.value)?this.value:"group"===this.type&&(null==(e=this.body)?void 0:e.length)===2&&"first"===this.body[0].type&&","===this.body[1].value?".":""}};function oZ(e){return"text"===e.mode}var oY=class e extends oG{constructor(e,i,r){super({type:"text",command:e,mode:"text",displayContainsHighlight:!0}),this.value=i,this.verbatimLatex=i,this.applyStyle(r)}static fromJson(i){return new e(i.command,i.value,i.style)}render(e){let i=this.createBox(e);return this.caret&&(i.caret=this.caret),i}_serialize(e){var i;return null!=(i=this.verbatimLatex)?i:eL("text",this.value.codePointAt(0))}};function oQ(e){let i=1/0,r=-1/0;for(let a of e.ranges)i=Math.min(i,a[0],a[1]),r=Math.max(r,a[0],a[1]);return[i,r]}function o0(e){return"number"==typeof e&&!Number.isNaN(e)}function o1(e){return Array.isArray(e)&&2===e.length}function o4(e){return null!=e&&"object"==typeof e&&"ranges"in e&&Array.isArray(e.ranges)}function o2(e,i,r){return r?function(e,i){if(!i)return"";if("string"==typeof i)return i;if(!e||void 0===i.after)return i.value;let r=!1,a=!1,o=!1,n=!1,l=!1,s=!1,c=!1,d=!1,u=!1,h=!1,p=!1,m=!1,f=!1,g=!1,b=!1,y=e[0],v=0;for(;null!=y&&y.type&&/^(subsup|placeholder)$/.test(y.type);)v+=1,y=e[v];return r=!y||"first"===y.type,y&&(a=!(g="text"===y.mode)&&"mord"===y.type&&ei.test(y.value),o=!g&&"mord"===y.type&&/\d+$/.test(y.value),n=!g&&y.isFunction,l="genfrac"===y.type,s="surd"===y.type,c="mbin"===y.type,d="mrel"===y.type,u="mop"===y.type||"operator"===y.type||"extensible-symbol"===y.type,h="mpunct"===y.type||"minner"===y.type,p="array"===y.type,m="mopen"===y.type,f="mclose"===y.type||"leftright"===y.type,b="space"===y.type),i.after.includes("nothing")&&r||i.after.includes("letter")&&a||i.after.includes("digit")&&o||i.after.includes("function")&&n||i.after.includes("frac")&&l||i.after.includes("surd")&&s||i.after.includes("binop")&&c||i.after.includes("relop")&&d||i.after.includes("operator")&&u||i.after.includes("punct")&&h||i.after.includes("array")&&p||i.after.includes("openfence")&&m||i.after.includes("closefence")&&f||i.after.includes("text")&&g||i.after.includes("space")&&b?i.value:""}(e,r[i]):""}var o3={"&":"\\&","%":"\\%",$:"\\$","''":"^{\\doubleprime}","'''":"^{\\prime\\prime\\prime}","''''":"^{\\prime\\prime\\prime\\prime}",alpha:"\\alpha",delta:"\\delta",Delta:"\\Delta",pi:"\\pi",Pi:"\\Pi",theta:"\\theta",Theta:"\\Theta",ii:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryI"},jj:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryJ"},ee:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\exponentialE"},nabla:"\\nabla",grad:"\\nabla",del:"\\partial",deg:{after:"digit+space",value:"\\degree"},infty:"\\infty","∞":"\\infty",oo:{after:"nothing+digit+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\infty"},"∑":"\\sum",sum:"\\sum_{#?}^{#?}",int:"\\int_{#?}^{#?}",prod:"\\prod_{#?}^{#?}",sqrt:"\\sqrt{#?}","∆":"\\differentialD","∂":"\\differentialD",sin:"\\sin",cos:"\\cos",tan:"\\tan",blank:"\\blank{#?}",arccos:"\\arccos",arcsin:"\\arcsin",arctan:"\\arctan",arctg:"\\operatorname{arctg}",arcsec:"\\operatorname{arcsec}",arccsc:"\\operatorname{arccsc}",arsinh:"\\operatorname{arsinh}",arccosh:"\\operatorname{arccosh}",arcosh:"\\operatorname{arcosh}",artanh:"\\operatorname{artanh}",arctanh:"\\operatorname{arctanh}",arcsech:"\\operatorname{arcsech}",arccsch:"\\operatorname{arccsch}",ch:"\\operatorname{ch}",cosec:"\\operatorname{cosec}",cosh:"\\cosh",cot:"\\cot",cotg:"\\operatorname{cotg}",coth:"\\coth",csc:"\\csc",ctg:"\\operatorname{ctg}",cth:"\\operatorname{cth}",sec:"\\sec",sech:"\\operatorname{sech}",sinh:"\\sinh",sh:"\\operatorname{sh}",tanh:"\\tanh",tg:"\\operatorname{tg}",th:"\\operatorname{th}",arg:"\\arg",lg:"\\lg",lb:"\\operatorname{lb}",log:"\\log_{#?}",ln:"\\ln",exp:"\\exp",lim:"\\lim_{#?\\to#?}",dx:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD x"},dy:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD y"},dt:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD t"},AA:"\\forall",EE:"\\exists","!EE":"\\nexists","&&":"\\land",xin:{after:"nothing+text+relop+punct+openfence+space",value:"x \\in"},sint:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\sin t"},in:{after:"nothing+letter+closefence",value:"\\in"},"!in":"\\notin",NN:"\\mathbb{N}",ZZ:"\\mathbb{Z}",QQ:"\\mathbb{Q}",RR:"\\mathbb{R}",CC:"\\mathbb{C}",xx:"\\times","+-":"\\pm","≠":"\\ne","!=":"\\ne","≥":"\\ge",">=":"\\ge","≤":"\\le","<=":"\\le","<<":"\\ll",">>":"\\gg","~~":"\\approx","≈":"\\approx","?=":"\\questeq","÷":"\\div","¬":"\\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"},µ:"\\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",Ω:"\\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","--\x3e...":"\\longrightarrow\\cdots","->":"\\to","|->":"\\mapsto","--\x3e":"\\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 o6(e,i){var r,a;let o,n=null!=(r=null==i?void 0:i.format)?r:"auto";return"auto"===n&&([n,e]=(a=(a=e).trim()).length<=1?["latex",a]:([o,a]=nt(a),o?["latex",a]:a.startsWith("`")&&a.endsWith("`")?["ascii-math",a=a.substring(1,a.length-1)]:a.includes("\\")?["latex",a]:/\$.+\$/.test(a)?["latex",`\\text{${a}}`]:[void 0,a])),"ascii-math"===n?["ascii-math",o8(e=(e=(e=(e=(e=(e=e.replace(/\u2061/gu,"")).replace(/\u3016/gu,"{")).replace(/\u3017/gu,"}")).replace(/([^\\])sinx/g,"$1\\sin x")).replace(/([^\\])cosx/g,"$1\\cos x ")).replace(/\u2013/g,"-"),{inlineShortcuts:null==i?void 0:i.inlineShortcuts})]:["latex",e]}function o8(e,i){var r;if(!(e=e.trim()))return"";let a=null!=(r=i.inlineShortcuts)?r:o3;if(e.startsWith("^")||e.startsWith("_")){let{match:r,rest:o}=o7(e.slice(1),{inlineShortcuts:a,noWrap:!0});return`${e[0]}{${r}}${o8(o,i)}`}let o=e.match(/^(sqrt|\u221A)(.*)/);if(o){let{match:e,rest:r}=o7(o[2],{inlineShortcuts:a,noWrap:!0});return`\\sqrt{${null!=e?e:"\\placeholder{}"}}${o8(r,i)}`}if(o=e.match(/^(\\cbrt|\u221B)(.*)/)){let{match:e,rest:r}=o7(o[2],{inlineShortcuts:a,noWrap:!0});return`\\sqrt[3]{${null!=e?e:"\\placeholder{}"}}${o8(r,i)}`}if(o=e.match(/^abs(.*)/)){let{match:e,rest:r}=o7(o[1],{inlineShortcuts:a,noWrap:!0});return`\\left|${null!=e?e:"\\placeholder{}"}\\right|${o8(r,i)}`}if(o=e.match(/^["”“](.*?)["”“](.*)/))return`\\text{${o[1]}}${o8(o[2],i)}`;if(o=e.match(/^([^a-zA-Z0-9\(\{\[\_\^\\\s"]+)(.*)/))return`${o9(o[1],a)}${o8(o[2],i)}`;if(/^([fgh])[^a-zA-Z]/.test(e)){let{rest:r,match:o}=o7(e.slice(1),{inlineShortcuts:a,noWrap:!0});return("("===e[1]?`${e[0]}\\left(${o}\\right)`:e[0]+o)+o8(r,i)}if(o=e.match(/^([a-zA-Z]+)(.*)/))return o9(o[1],a)+o8(o[2],i);let{match:n,rest:l}=o7(e,{inlineShortcuts:a,noWrap:!0});if(!n||"/"!==l[0])return e.startsWith("(")?"\\left("+n+"\\right)"+o8(l,i):n+o8(l,i);{let e=o7(l.slice(1),{inlineShortcuts:a,noWrap:!0});if(e.match)return`\\frac{${n}}{${e.match}}${o8(e.rest,i)}`}return(o=e.match(/^(\s+)(.*)$/))?" "+o8(o[2],i):e}var o5={"[":"\\lbrack","]":"\\rbrack","{":"\\lbrace","}":"\\rbrace"};function o7(e,i){var r,a;let o="",n=e=e.trim(),l=e.charAt(0),s={"(":")","{":"}","[":"]"}[l];if(s){let c=1,d=1;for(;d<e.length&&c>0;)e[d]===l&&c++,e[d]===s&&c--,d++;if(0===c){let c=o8(e.substring(1,d-1),i);o=i.noWrap&&"("===l?c:`\\left${null!=(r=o5[l])?r:l}${c}\\right${null!=(a=o5[s])?a:s}`,n=e.slice(Math.max(0,d))}else o=e.substring(1,d),n=""}else{let r=e.match(/^([a-zA-Z]+)/);if(r){let r=o2(null,e,i.inlineShortcuts);if(r)return{match:r=(r=r.replace("_{#?}","")).replace("^{#?}",""),rest:e.slice(r.length)}}if(r=e.match(/^([a-zA-Z])/))return{match:r[1],rest:e.slice(1)};if(r=e.match(/^(-)?\d+(\.\d*)?/))return{match:r[0],rest:e.slice(r[0].length)};/^\\(left|right)/.test(e)||(r=e.match(/^(\\[a-zA-Z]+)/))&&(n=e.slice(r[1].length),o=r[1])}return{match:o,rest:n}}function o9(e,i){let r=o2(null,e,i);return r?(r=r.replace("_{#?}","")).replace("^{#?}","")+" ":e}var ne=[["\\[","\\]"],["\\(","\\)"],["$$","$$"],["$","$"],["\\begin{math}","\\end{math}"],["\\begin{displaymath}","\\end{displaymath}"],["\\begin{equation}","\\end{equation}"],["\\begin{equation*}","\\end{equation*}"]];function nt(e){let i=e.trim();for(let e of ne)if(i.startsWith(e[0])&&i.endsWith(e[1]))return[!0,i.substring(e[0].length,i.length-e[1].length)];return[!1,e]}var ni=(e,i,r)=>(ne.some(e=>i.startsWith(e[0])&&i.endsWith(e[1]))||(i=`$$ ${i} $$`),i),nr=class e{constructor(i){e._modes[i]=this}static onPaste(i,r,a){var o;if(!r.contentEditable&&"none"===r.userSelect)return r.model.announce("plonk"),!1;if("string"==typeof a){let e=new DataTransfer;e.setData("text/plain",a),a=e}let n=new ClipboardEvent("paste",{clipboardData:a,cancelable:!0});return!!(null!=(o=r.host)&&o.dispatchEvent(n))&&e._modes[i].onPaste(r,a)}static copyToClipboard(e,i){if(!e.contentEditable&&"none"===e.userSelect)return void e.model.announce("plonk");let r=e.model,a=r.selectionIsCollapsed?[0,r.lastOffset]:oQ(r.selection),o=r.getValue(a,i);navigator.clipboard.writeText(o).then(()=>{},()=>e.model.announce("plonk"))}static onCopy(e,i){var r;if(!i.clipboardData)return;if(!e.contentEditable&&"none"===e.userSelect)return void e.model.announce("plonk");let a=e.model,o=a.selectionIsCollapsed?[0,a.lastOffset]:oQ(a.selection),n=a.getAtoms(o);if(n.every(e=>"text"===e.mode||!e.mode))i.clipboardData.setData("text/plain",n.filter(e=>e instanceof oY).map(e=>e.value).join(""));else if(n.every(e=>"latex"===e.mode))i.clipboardData.setData("text/plain",a.getAtoms(o,{includeChildren:!0}).map(e=>{var i;return null!=(i=e.value)?i:""}).join(""));else{let l;l=1===n.length&&void 0!==n[0].verbatimLatex?n[0].verbatimLatex:a.getValue(o,"latex-expanded"),i.clipboardData.setData("application/x-latex",l);try{i.clipboardData.setData("text/plain",e.options.onExport(e,l,o))}catch(e){}if(1===n.length){let e=n[0];("root"===e.type||"group"===e.type)&&(n=e.body.filter(e=>"first"!==e.type))}try{i.clipboardData.setData("application/json+mathlive",JSON.stringify(n.map(e=>e.toJson())))}catch(e){}if(null!=(r=window[Symbol.for("io.cortexjs.compute-engine")])&&r.ComputeEngine){let e=globalThis.MathfieldElement.computeEngine;if(e)try{let r=e.jsonSerializationOptions;e.jsonSerializationOptions={metadata:["latex"]};let n=e.parse(a.getValue(o,"latex-unstyled"));e.jsonSerializationOptions=r;let l=JSON.stringify(n.json);l&&i.clipboardData.setData("application/json",l)}catch(e){}}}i.preventDefault()}static insert(i,r,a={}){var o;let n="auto"===a.mode?i.mode:null!=(o=a.mode)?o:i.mode;return e._modes[n].insert(i,r,a)}onPaste(e,i){return!1}insert(e,i,r){return!1}};nr._modes={};var na=nr,no=[{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","^"]}],nn={"\\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 nl(e){var i;return(null==(i=e.element)?void 0:i.mathfield)===e}function ns(e){var i,r;let a=null!=(r=null!=(i=e.querySelector(".ML__caret"))?i:e.querySelector(".ML__text-caret"))?r:e.querySelector(".ML__latex-caret");if(!a)return null;let o=a.getBoundingClientRect();return{x:o.right,y:o.bottom,height:o.height}}function nc(e,i,r){if(!i)return null;let a=e.field.getBoundingClientRect(),o=i.right-i.left,n=i.bottom-i.top,l=Math.ceil(i.left-a.left+e.field.scrollLeft*r),s=Math.ceil(i.top-a.top);return{left:l,right:l+o,top:s,bottom:s+n}}function nd(e){let i=e,r=i.getBoundingClientRect();for(;r.bottom===r.top&&i.parentElement instanceof Element&&(r=(i=i.parentElement).getBoundingClientRect()).bottom===r.top;);let a=getComputedStyle(i),o=parseInt(a.marginRight),n=r.right-r.left,l=r.bottom-r.top;if(0===n||!Number.isFinite(n)){let e=parseFloat(a.width);Number.isFinite(e)&&e>0?n=e:i instanceof HTMLElement&&i.offsetWidth>0&&(n=i.offsetWidth)}if(0===l||!Number.isFinite(l)){let e=parseFloat(a.height);Number.isFinite(e)&&e>0?l=e:i instanceof HTMLElement&&i.offsetHeight>0&&(l=i.offsetHeight)}let s={top:r.top-1,bottom:r.top-1+l,left:r.left,right:r.left+n-1+o};if(0===e.children.length||"SVG"===e.tagName.toUpperCase())return s;for(let i of e.children)if(1===i.nodeType&&"atomId"in i.dataset&&!i.classList.contains("ML__pstrut")){let e=nd(i);s.left=Math.min(s.left,e.left),s.right=Math.max(s.right,e.right),s.top=Math.min(s.top,e.top),s.bottom=Math.max(s.bottom,e.bottom)}return s}function nu(e,i){var r,a;if(!i.id)return null;let o=null!=(a=null==(r=e.atomBoundsCache)?void 0:r.get(i.id))?a:null;if(null!==o)return o;let n=Array.from(e.field.querySelectorAll(`[data-atom-id="${i.id}"]`));if("prompt"===i.type){for(let e of n)if(e.classList.contains("ML__prompt-atom")){let i=e.querySelector(".ML__prompt");if(i){let e=nd(i);o?(o.left=Math.min(o.left,e.left),o.right=Math.max(o.right,e.right),o.top=Math.min(o.top,e.top),o.bottom=Math.max(o.bottom,e.bottom)):o=e}}}for(let e of n){let i=nd(e);o?(o.left=Math.min(o.left,i.left),o.right=Math.max(o.right,i.right),o.top=Math.min(o.top,i.top),o.bottom=Math.max(o.bottom,i.bottom)):o=i}return e.atomBoundsCache&&(o?e.atomBoundsCache.set(i.id,o):e.atomBoundsCache.delete(i.id)),null!=o?o:null}function nh(e,i){return e.model.selection.ranges.reduce((r,a)=>r.concat(...function(e,i,r){let a=new Map,o=e.field,n=o.offsetWidth,l=Math.floor(o.getBoundingClientRect().width)/n;for(let o of(l=isNaN(l)?1:l,e.model.getAtoms(i,{includeChildren:!0}))){if(null!=r&&r.excludeAtomsWithBackground&&o.style.backgroundColor)continue;let i=nc(e,nu(e,o),l);if(i){let e=function(e){var i;return e.parent?(null!=(i=e.parent.id)?i:"")+("string"==typeof e.parentBranch?"-"+e.parentBranch:`-${e.parentBranch[0]}/${e.parentBranch[0]}`):"root"}(o);if(a.has(e)){let r=a.get(e);a.set(e,{left:Math.min(r.left,i.left),right:Math.max(r.right,i.right),top:Math.min(r.top,i.top),bottom:Math.max(r.bottom,i.bottom)})}else a.set(e,i)}}return[...a.values()]}(e,a,i)),[])}function np(e,i){return"*"===e||"none"===i||("same-origin"===i?!window.origin||e===window.origin:"function"==typeof i&&i(e))}function nm(e){let i=0,r=0,a=e.offsetWidth,o=e.offsetHeight;for(;e instanceof HTMLElement;)i+=e.offsetTop,r+=e.offsetLeft,e=e.offsetParent;return new DOMRect(r,i,a,o)}function nf(e,i){if(!e)return;let r=e.model.at(i);if(!r)return;let a={},o=nu(e,r);o&&(a.bounds=new DOMRect(o.left,o.top,o.right-o.left,o.bottom-o.top)),a.depth=r.treeDepth-2,a.style=r.style;let n=r;for(;n;){if("\\htmlData"===n.command&&n.args&&"string"==typeof n.args[0])for(let e of n.args[0].split(",")){let i=e.match(/([^=]+)=(.+$)/);if(i){let e=i[1].trim().replace(/ /g,"-");e&&(a.data||(a.data={}),a.data[e]=i[2])}else{let i=e.trim().replace(/ /g,"-");i&&(a.data||(a.data={}),a.data[i]=void 0)}}("\\htmlId"===n.command||"\\cssId"===n.command)&&!a.id&&n.args&&"string"==typeof n.args[0]&&(a.id=n.args[0]),n=n.parent}return("math"===r.mode||"text"===r.mode)&&(a.latex=oG.serialize([r],{defaultMode:"math"})),a}var ng=`@keyframes ML__caret-blink {
191
+ M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},od=[[8205,1],[65038,2],[127995,5],[129456,4],[917536,96]];function ou(e){var i;if(void 0===on)for(let e of(on={},od))for(let i=e[0];i<=e[0]+e[1]-1;i++)on[i]=!0;return null!=(i=on[e])&&i}function oh(e){if(/^[\u0020-\u00FF]*$/.test(e))return e;let i=[],r=function(e){let i=[];for(let r=0;r<e.length;r++){let a=e.charCodeAt(r);if(13===a&&10===e.charCodeAt(r+1)&&(a=10,r++),(13===a||12===a)&&(a=10),0===a&&(a=65533),a>=55296&&a<=56319){let i=e.charCodeAt(r+1);i>=56320&&i<=57343&&(a=65536+1024*(a-55296)+(i-56320),r++)}i.push(a)}return i}(e),a=0;for(;a<r.length;){let e=r[a++],o=r[a];if(8205===o){let e=a-1;for(a+=2;8205===r[a];)a+=2;i.push(String.fromCodePoint(...r.slice(e,a-e+1)))}else if(ou(o)){let e=a-1;for(;ou(r[a]);)a+=8205===r[a]?2:1;i.push(String.fromCodePoint(...r.slice(e,2*a-e-1)))}else e>=127462&&e<=127487?(a+=1,i.push(String.fromCodePoint(...r.slice(a-2,2)))):i.push(String.fromCodePoint(e))}return i}var op=class{constructor(e){this.obeyspaces=!1,this.pos=0,this.s=oh(e)}end(){return this.pos>=this.s.length}get(){return this.pos<this.s.length?this.s[this.pos++]:""}peek(){return this.s[this.pos]}match(e){let i="string"==typeof this.s?e.exec(this.s.slice(this.pos)):e.exec(this.s.slice(this.pos).join(""));return null!=i&&i[0]?(this.pos+=i[0].length,i[0]):""}next(){if(this.end())return null;if(!this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]+/)||this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]/))return"<space>";let e=this.get();if("\\"===e){if(!this.end()){let e=this.match(/^[a-zA-Z\*]+/);return e?this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]*/):e=this.get(),"\\"+e}}else{if("{"===e)return"<{>";if("}"===e)return"<}>";if("^"===e){if("^"===this.peek()){this.get();let e=this.match(/^(\^(\^(\^(\^[\da-f])?[\da-f])?[\da-f])?[\da-f])?[\da-f]{2}/);if(e)return String.fromCodePoint(Number.parseInt(e.slice(e.lastIndexOf("^")+1),16))}}else if("#"===e){if(!this.end()){let e=!1;if(/[\d?@]/.test(this.peek())&&(e=!0,this.pos+1<this.s.length)){let i=this.s[this.pos+1];e=/[^\dA-Za-z]/.test(i)}return e?"#"+this.get():"#"}}else if("$"===e)return"$"===this.peek()?(this.get(),"<$$>"):"<$>"}return e}};function om(e,i=null){if(!e)return[];let r=[],a="";for(let i of e.toString().split(/\r?\n/)){a&&r.push(a),a=" ";let e=i.match(/((?:\\%)|[^%])*/);null!==e&&r.push(e[0])}let o=new op(r.join("")),n=[];do n.push(...function(e,i){var r,a,o,n;let l=[],s=e.next();if(s&&"\\relax"!==s){if("\\noexpand"===s)(s=e.next())&&l.push(s);else if("\\obeyspaces"===s)e.obeyspaces=!0;else if("\\bgroup"===s)l.push("<{>");else if("\\egroup"===s)l.push("<}>");else if("\\string"===s){if(s=e.next())if(s.startsWith("\\"))for(let e of s)l.push("\\"===e?"\\backslash":e);else"<{>"===s?l.push("\\{"):"<space>"===s?l.push("~"):"<}>"===s&&l.push("\\}")}else if("\\csname"===s){for(;"<space>"===e.peek();)e.next();let o="",n=!1,c=[];do{if(0===c.length)if(/^#[\d?@]$/.test(e.peek())){let o=e.get().slice(1);s=(c=om(null!=(a=null!=(r=null==i?void 0:i(o))?r:null==i?void 0:i("?"))?a:"\\placeholder{}",i))[0]}else c=(s=e.next())?[s]:[];(n=0===c.length)||"\\endcsname"!==s||(n=!0,c.shift()),n||(n="<$>"===s||"<$$>"===s||"<{>"===s||"<}>"===s||"string"==typeof s&&s.length>1&&s.startsWith("\\")),n||(o+=c.shift())}while(!n)o&&l.push("\\"+o),l.push(...c)}else if("\\endcsname"!==s)if(s.length>1&&s.startsWith("#")){let e=s.slice(1);l.push(...om(null!=(n=null!=(o=null==i?void 0:i(e))?o:null==i?void 0:i("?"))?n:"\\placeholder{}",i))}else l.push(s)}return l}(o,i));while(!o.end())return n}function of(e){let i="",r=[];for(let a of e)a&&(i&&/^[a-zA-Z\*]/.test(a)&&r.push(i),r.push(a),/^\\[a-zA-Z]+\*?[\"\'][^\ ]+$/.test(a)&&r.push(" "),i=/\\[a-zA-Z]+\*?$/.test(a)?" ":"");return r.join("")}function og(e,...i){return e.startsWith("\\"),0===i.length?e:of([e,...i.map(e=>`{${e}}`)])}function ob(e){return of(e.map(e=>{var i;return null!=(i=({"<space>":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"})[e])?i:e}))}var oy=class e{constructor(i){e._registry[i]=this}static createAtom(i,r,a){return e._registry[i].createAtom(r,eM(r,i),a)}static serialize(i,r){var a;if(!i||0===i.length)return"";if(null!=(a=r.skipStyles)&&a){let a=[];for(let o of ox(i)){let i=e._registry[o[0].mode];a.push(...i.serialize(o,r))}return of(a)}return of(function(e,i){if(0===e.length)return[];let{parent:r}=e[0],a=null==r?void 0:r.style.fontSize,o=[];for(let n of ok(e,"fontSize")){let e=n[0].style.fontSize,l=function(e,i){let{parent:r}=e[0],a=null==r?void 0:r.style.backgroundColor;return ok(e,"backgroundColor").map(e=>{var o;if(e.length>0||"box"!==e[0].type){let n=e[0].style;if(n.backgroundColor&&"none"!==n.backgroundColor&&(!r||a!==n.backgroundColor))return og("\\colorbox",null!=(o=n.verbatimBackgroundColor)?o:n.backgroundColor,of(oM(e,g(f({},i),{defaultMode:"text"}))))}return of(oM(e,i))})}(n,i);l&&(e&&"auto"!==e&&(!r||a!==e)?o.push(["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][e],...l):o.push(...l))}return o}(i,r))}static getFont(i,r,a){return e._registry[i].getFont(r,a)}};oy._registry={};var ov=oy;function ox(e){let i=[],r=[],a="NONE";for(let o of e)"first"!==o.type&&(o.mode!==a?(r.length>0&&i.push(r),r=[o],a=o.mode):r.push(o));return r.length>0&&i.push(r),i}function o_(e){if((null==e?void 0:e.mode)!=="math")return"";let{style:i}=e;return i&&i.variantStyle&&("bold"===i.variantStyle||"bolditalic"===i.variantStyle)?"bold":""}function ow(e){if(!e)return"";let{style:i}=e;if(!i)return"";let r=i.variant;return void 0===r&&(r="normal"),!["calligraphic","fraktur","double-struck","script","monospace","sans-serif"].includes(r)&&i.variantStyle&&(r+="-"+i.variantStyle),r}function ok(e,i){let r=[],a=[],o;for(let n of e){let e;"first"!==n.type&&((e="variant"===i?ow(n):"bold"===i?o_(n):n.style[i])===o?a.push(n):(a.length>0&&r.push(a),a=[n],o=e))}return a.length>0&&r.push(a),r}function oM(e,i){var r;let{parent:a}=e[0],o=null==a?void 0:a.style.color,n=[];for(let l of ox(e)){let e=i.defaultMode;for(let s of ok(l,"color")){let l=s[0].style,c=ov._registry[s[0].mode].serialize(s,g(f({},i),{defaultMode:"text"===e?"text":"math"}));i.skipStyles||!l.color||"none"===l.color||a&&o===l.color?n.push(of(c)):n.push(og("\\textcolor",null!=(r=l.verbatimColor)?r:l.color,of(c)))}}return n}function oS(e){return e?({mord:"ord",mbin:"bin",mop:"op",mrel:"rel",mopen:"open",mclose:"close",mpunct:"punct",minner:"inner",spacing:"ignore",newline:"newline",latex:"latex",composition:"inner",error:"inner",placeholder:"ord",supsub:"ignore"})[e]:void 0}function oL(e){if(0===e.length)return"ord";let i=oS(e[0].type),r=oS(e[e.length-1].type);return i&&i===r?i:"ord"}function oC(e,i){if("string"==typeof e)return e;if("number"==typeof e){Number.isFinite(e);let r=Math.ceil(100*e)/100;return 0===r?"0":r.toString()+(null!=i?i:"")}return""}var oE=class e{constructor(i,r){var a,o,n,l,s;if("number"==typeof i?this.value=String.fromCodePoint(i):"string"==typeof i?this.value=i:R(i)?this.children=i.filter(e=>null!==e):i&&i instanceof e&&(this.children=[i]),this.children)for(let e of this.children)e.parent=this;this.type=null!=(a=null==r?void 0:r.type)?a:"ignore",this.isSelected=(null==r?void 0:r.isSelected)===!0,null!=r&&r.caret&&(this.caret=r.caret),this.classes=null!=(o=null==r?void 0:r.classes)?o:"",this.isTight=null!=(n=null==r?void 0:r.isTight)&&n,null!=r&&r.attributes&&(this.attributes=r.attributes);let c=null==r?void 0:r.fontFamily;null!=r&&r.style&&this.value&&(c=null!=(s=ov.getFont(null!=(l=r.mode)?l:"math",this,g(f({variant:"normal"},r.style),{letterShapeStyle:r.letterShapeStyle})))?s:void 0),c||(c="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,(null==r?void 0:r.maxFontSize)!==void 0&&(this.maxFontSize=r.maxFontSize),function(e,i){var r;if("latex"===e.type){e.height=.9,e.depth=.2,e._width=1;return}if(e.value){e.height=-1/0,e.depth=-1/0,e._width=0,e.skew=-1/0,e.italic=-1/0;for(let r=0;r<e.value.length;r++){let a=oa(e.value.codePointAt(r),i);e.height=Math.max(e.height,a.height),e.depth=Math.max(e.depth,a.depth),e._width+=a.width,e.skew=a.skew,e.italic=a.italic}return}if(e.children&&e.children.length>0){let i=-1/0,a=-1/0,o=0;for(let n of e.children)n.height>i&&(i=n.height),n.depth>a&&(a=n.depth),o=Math.max(o,null!=(r=n.maxFontSize)?r:0);e.height=i,e.depth=a,e._width=e.children.reduce((e,i)=>e+i.width,0),e.maxFontSize=o}}(this,c)}set atomID(e){void 0===e||0===e.length||(this.id=e)}selected(e){if(this.isSelected!==e&&(this.isSelected=e,this.children))for(let i of this.children)i.selected(e)}setStyle(e,i,r){if(void 0===i)return;let a=oC(i,r);a.length>0&&(this.cssProperties||(this.cssProperties={}),this.cssProperties[e]=a)}setTop(e){Number.isFinite(e)&&Math.abs(e)>.01&&(this.cssProperties||(this.cssProperties={}),this.cssProperties.top=oC(e,"em"),this.height-=e,this.depth+=e)}get left(){var e;return null!=(e=this.cssProperties)&&e["margin-left"]?Number.parseFloat(this.cssProperties["margin-left"]):0}set left(e){Number.isFinite(e)&&(0===e?this.cssProperties&&delete this.cssProperties["margin-left"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-left"]=oC(e,"em")))}set right(e){Number.isFinite(e)&&(0===e?this.cssProperties&&delete this.cssProperties["margin-right"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-right"]=oC(e,"em")))}set bottom(e){Number.isFinite(e)&&(0===e?this.cssProperties&&delete this.cssProperties["margin-bottom"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-bottom"]=oC(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 i=e.parent;if(!i)return this;e.isPhantom&&this.setStyle("opacity",0);let r=e.color;r&&r!==i.color&&this.setStyle("color",r);let a=e.backgroundColor;this.isSelected&&(a=function(e){let i=function(e){let i;if(e&&"#"===e[0])return(e=e.slice(1)).length<=4?(i={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},4===e.length&&(i.a=parseInt(e[3]+e[3],16)/255)):(i={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},8===e.length&&(i.a=parseInt(e[6]+e[7],16)/255)),i&&void 0===i.a&&(i.a=1),i}(e);if(!i)return e;let{h:r,s:a,l:o}=function(e){let{r:i,g:r,b:a}=e;i/=255;let o=Math.min(i,r/=255,a/=255),n=Math.max(i,r,a),l=n-o,s;n===o?s=0:i===n?s=(r-a)/l:r===n?s=2+(a-i)/l:a===n&&(s=4+(i-r)/l),(s=Math.min(60*s,360))<0&&(s+=360);let c=(o+n)/2;return{h:s,s:n===o?0:c<=.5?l/(n+o):l/(2-n-o),l:c}}(i);return function(e){let{r:i,g:r,b:a}=e,o=(0x1000000+(G(i)<<16)+(G(r)<<8)+G(a)).toString(16).slice(1);return o[0]===o[1]&&o[2]===o[3]&&o[4]===o[5]&&o[6]===o[7]&&(o=o[0]+o[2]+o[4]),"#"+o}(function(e){let[i,r,a]=[e.h,e.s,e.l];i=(i+360)%360/60,a=Math.max(0,Math.min(a,1)),r=Math.max(0,Math.min(r,1));let o=a<=.5?a*(r+1):a+r-a*r,n=2*a-o;return{r:Math.round(255*X(n,o,i+2)),g:Math.round(255*X(n,o,i)),b:Math.round(255*X(n,o,i-2))}}({h:r,s:a+=.1,l:o-=.1}))}(a)),a&&a!==i.backgroundColor&&(this.setStyle("background-color",a),this.setStyle("--bg-color",a),this.setStyle("display","inline-block"),this.setStyle("position","relative"),this.classes=this.classes?`${this.classes} ML__bg`:"ML__bg");let o=e.scalingFactor;return this.scale=o,this.skew*=o,this.italic*=o,this}toMarkup(){var e,i,r;let a=this.value?this.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"";if(this.children)for(let e of this.children)a+=e.toMarkup();let o="";if(this.svgBody)o=function(e){if(os[e]){let[i,r,a]=os[e],o=`<span class="ML__stretchy" style="height:${a}em"><svg width="100%" height="${a}em" viewBox="0 0 ${i} ${r}" preserveAspectRatio="none" ><path fill="currentcolor" d="${oc[e]}"></path></svg></span>`;return`<span style="display:inline-block;height:${Math.floor(100*a/2)/100}em;min-width:0">${o}</span>`}let[i,r,a,o]=ol[e],n,l,s=a/1e3;3===i.length?(n=["slice-1-of-3","slice-2-of-3","slice-3-of-3"],l=["xMinYMin","xMidYMin","xMaxYMin"]):2===i.length?(n=["slice-1-of-2","slice-2-of-2"],l=["xMinYMin","xMaxYMin"]):(n=["slice-1-of-1"],l=[o]);let c=i.map((e,i)=>`<span class="${n[i]}" style=height:${s}em><svg width=400em height=${s}em viewBox="0 0 400000 ${a}" preserveAspectRatio="${l[i]} slice"><path fill="currentcolor" d="${oc[e]}"></path></svg></span>`).join("");return`<span style="display:inline-block;height:${s}em;min-width:${r}em;">${c}</span>`}(this.svgBody);else if(this.svgOverlay){o=`<span style="display: inline-block;height:${Math.floor(100*(this.height+this.depth))/100}em;vertical-align:${Math.floor(100*this.depth)/100}em;">`+a+'</span><svg style="position:absolute;overflow:visible;'+`height:${Math.floor(100*(this.height+this.depth))/100}em;`;let i=null==(e=this.cssProperties)?void 0:e.padding;i?(o+=`top:${i};`,o+=`left:${i};`,o+=`width:calc(100% - 2 * ${i} );`):o+="top:0;left:0;width:100%;",o+="z-index:2;",o+='"',this.svgStyle&&(o+=this.svgStyle),o+=` viewBox="0 0 ${Math.floor(100*this.width)/100} ${Math.floor(100*(this.height+this.depth))/100}"`,o+=`>${this.svgOverlay}</svg>`}let n=[],l=this.classes.split(" ");l.push(null!=(i=({latex:"ML__raw-latex",placeholder:"ML__placeholder",error:"ML__error"})[this.type])?i:""),"latex"===this.caret&&l.push("ML__latex-caret"),this.isSelected&&l.push("ML__selected");let s=1===l.length?l[0]:l.filter((e,i,r)=>e.length>0&&r.indexOf(e)===i).join(" ");if(s.length>0&&n.push(`class=${oK(`"${s}"`)}`),this.id&&n.push(` data-atom-id=${oK(this.id)}`),this.cssId&&n.push(` id=${oK(`"${this.cssId.replace(/ /g,"-")}"`)}`),this.attributes&&n.push(...Object.keys(this.attributes).map(e=>`${oD(e)}=${oK(this.attributes[e])}`)),this.htmlData)for(let e of this.htmlData.split(",")){let i=e.match(/([^=]+)=(.+$)/);if(i){let e=oD(i[1]);if(e)if("href"===e){let e=new URL(i[2]);if("http:"!==e.protocol&&"https:"!==e.protocol)throw Error(`Invalid URL: ${i[2]}`);n.push(`href="${i[2].replace(/"/g,"&quot;")}"`)}else n.push(`data-${e}=${oK(i[2])}`)}else{let i=oD(e);i&&n.push(`data-${i} `)}}let c=null!=(r=this.cssProperties)?r:{};this.hasExplicitWidth&&void 0===c.width&&(c.width=`${Math.ceil(100*this._width)/100}em`);let d=Object.keys(c).map(e=>`${e}:${c[e]}`);if(void 0!==this.scale&&1!==this.scale&&(a.length>0||o.length>0)&&d.push(`font-size: ${Math.ceil(1e4*this.scale)/100}%`),this.htmlStyle)for(let e of this.htmlStyle.split(";")){let i=e.match(/([^:]+):(.+$)/);if(i){let e=i[1].trim().replace(/ /g,"-");e&&d.push(`${e}:${i[2]}`)}}d.length>0&&n.push(`style=${oK(d.join(";"))}`);let u="";return u=n.length>0||o.length>0?`<span ${n.join(" ")}>${a}${o}</span>`:a,"text"===this.caret?u+='<span class="ML__text-caret"></span>':"math"===this.caret&&(u+='<span class="ML__caret"></span>'),u}tryCoalesceWith(e){if(this.svgBody||!this.value||e.svgBody||!e.value)return!1;let i=this.children&&this.children.length>0,r=e.children&&e.children.length>0;if(i||r)return!1;if(e.cssProperties||this.cssProperties){for(let i of["border","border-left","border-right","border-right-width","left","margin","margin-left","margin-right","padding","position","width"])if(e.cssProperties&&i in e.cssProperties||this.cssProperties&&i in this.cssProperties)return!1}let a=this.cssProperties?Object.keys(this.cssProperties).length:0;if(a!==(e.cssProperties?Object.keys(e.cssProperties).length:0))return!1;if(a>0){for(let i of Object.keys(this.cssProperties))if(this.cssProperties[i]!==e.cssProperties[i])return!1}let o=this.classes.trim().replace(/\s+/g," ").split(" "),n=e.classes.trim().replace(/\s+/g," ").split(" ");if(o.length!==n.length)return!1;for(let[e,i]of(o.sort(),n.sort(),o.entries()))if("ML__vertical-separator"===i||i!==n[e])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 oA(e){return e.children&&(e.children=function e(i){if(!i||0===i.length)return[];i[0].children=e(i[0].children);let r=[i[0]];for(let a=1;a<i.length;a++)r[r.length-1].tryCoalesceWith(i[a])||(i[a].children=e(i[a].children),r.push(i[a]));return r}(e.children)),e}function oz(e,i){if(!e)return new oE(null,i);let r=new oE(null,{classes:"ML__strut",type:"ignore"});r.setStyle("height",Math.max(0,e.height),"em");let a=[r];if(0!==e.depth){let i=new oE(null,{classes:"ML__strut--bottom",type:"ignore"});i.setStyle("height",e.height+e.depth,"em"),i.setStyle("vertical-align",-e.depth,"em"),a.push(i)}return a.push(e),new oE(a,g(f({},i),{type:"lift"}))}function oT(e){let i=(ol[e]?ol[e][2]/1e3:os[e][2])/2,r=new oE(null,{maxFontSize:0});return r.height=i+.166,r.depth=i-.166,r.svgBody=e,r}function oD(e){if(0===(e=e.trim().replace(/ /g,"-")).length)throw Error("Invalid empty attribute name");if(/[\x20\x09\x0a\x0c\x0d"'>/=\x00-\x1f]/.test(e))throw Error(`Invalid attribute name "${e}"`);return e}function oK(e){if((e=e.trim()).startsWith('"')&&e.endsWith('"')){if(/"/.test(e.slice(1,-1)))throw Error(`Invalid attribute value: ${e}`);return e}if(e.startsWith("'")&&e.endsWith("'")){if(/'/.test(e.slice(1,-1)))throw Error(`Invalid attribute value: ${e}`);return e}if(0===e.length)throw Error("Invalid empty attribute value");return`"${e.replace(/"/g,"&quot;")}"`}var oB=class extends oE{constructor(e,i){var r;let[a,o,n]=function(e){var i;let[r,a]=function(e){if("individualShift"in e){let i=e.individualShift,r=i[0];if(null==r)return[null,0];let a=[r],o=-r.shift-r.box.depth,n=o;for(let e=1;e<i.length;e++){let o=i[e],l=-o.shift-n-o.box.depth,s=l-(r.box.height+r.box.depth);n+=l,a.push(s),a.push(o),r=o}return[a,o]}if("top"in e){let i=e.top;for(let r of e.children)i-="number"==typeof r?r:r.box.height+r.box.depth;return[e.children,i]}if("bottom"in e)return[e.children,-e.bottom];if("firstBaseline"in e){let i=e.firstBaseline[0];if("number"==typeof i)throw Error("First child must be an element.");return[e.firstBaseline,-i.box.depth]}if("shift"in e){let i=e.children[0];if("number"==typeof i)throw Error("First child must be an element.");return[e.children,-i.box.depth-e.shift]}return[null,0]}(e);if(!r)return[[],0,0];let o=new oE(null,{classes:"ML__pstrut"}),n=0;for(let e of r)if("number"!=typeof e){let i=e.box;n=Math.max(n,i.maxFontSize,i.height)}o.height=n+=2,o.setStyle("height",n,"em");let l=[],s=a,c=a,d=a,u=0;for(let e of r){if("number"==typeof e)d+=e;else{let r=e.box,a=new oE([o,r],{classes:(null!=(i=e.classes)?i:[]).join(" "),style:e.style});r.setStyle("height",r.height+r.depth,"em"),r.setStyle("display","inline-block"),a.setStyle("top",-n-d-r.depth,"em"),e.marginLeft&&a.setStyle("margin-left",e.marginLeft,"em"),e.marginRight&&a.setStyle("margin-right",e.marginRight,"em"),l.push(a),d+=r.height+r.depth,u=Math.max(u,a.width)}s=Math.min(s,d),c=Math.max(c,d)}l.forEach(e=>{e.softWidth=u});let h=new oE(l,{classes:"ML__vlist"});if(h.softWidth=u,h.height=c,h.setStyle("height",c,"em"),s>=0)return[[new oE(h,{classes:"ML__vlist-r"})],c,-s];let p=new oE(new oE(null),{classes:"ML__vlist"});p.height=-s,p.setStyle("height",-s,"em");let m=new oE(8203,{classes:"ML__vlist-s",maxFontSize:0});return m.softWidth=0,m.height=0,m.depth=0,[[new oE([h,m],{classes:"ML__vlist-r"}),new oE(p,{classes:"ML__vlist-r"})],c,-s]}(e);super(1===a.length?a[0]:a,{type:null==i?void 0:i.type,classes:(null!=(r=null==i?void 0:i.classes)?r:"")+" ML__vlist-t"+(2===a.length?" ML__vlist-t2":"")}),this.height=o,this.depth=n,this.softWidth=a.reduce((e,i)=>Math.max(e,i.width),0)}},o$={fractionNavigationOrder:"numerator-denominator",compactSerialization:!0},oP=class{constructor(e,i,r){this.id=e,this.sizeDelta=i,this.cramped=r;let a={"-4":2,"-3":1,0:0}[i];this.metrics=Object.keys(ot).reduce((e,i)=>g(f({},e),{[i]:ot[i][a]}),{})}getFontSize(e){return Math.max(1,e+this.sizeDelta)}get sup(){return oR[[0,1,0,1,2,3,2,3][this.id]]}get sub(){return oR[[0,0,0,0,2,2,2,2][this.id]]}get fracNum(){return oR[[0,1,0,1,2,3,4,5][this.id]]}get fracDen(){return oR[[0,0,0,0,2,2,4,4][this.id]]}get cramp(){return oR[[0,0,2,2,4,4,6,6][this.id]]}get isTight(){return this.sizeDelta<0}},oO={7:new oP(7,0,!1),6:new oP(6,0,!0),5:new oP(5,0,!1),4:new oP(4,0,!0),3:new oP(3,-3,!1),2:new oP(2,-3,!0),1:new oP(1,-4,!1),0:new oP(0,-4,!0)},oR=g(f({},oO),{displaystyle:oO[7],textstyle:oO[5],scriptstyle:oO[3],scriptscriptstyle:oO[1]});function oI(e,i){var r;if(!e)return 0;let a={pt:1,mm:7227/2540,cm:7227/254,ex:35271/8192,px:.75,em:10,bp:1.00375,dd:1238/1157,pc:12,in:72.27,mu:10/18}[null!=(r=e.unit)?r:"pt"];if(Number.isFinite(i)){let r=10**i;return Math.round(e.dimension/10*a*r)/r}return e.dimension*a}function oN(e,i){if(null===e)return 0;let r=oI(e)/10;if(Number.isFinite(i)){let e=10**i;return Math.round(r*e)/e}return r}function oq(e){var i;return`${e.dimension}${null!=(i=e.unit)?i:"pt"}`}function oF(e){var i,r;let a;if(null==e)return null;let o="";if("dimension"in e&&(o=`${e.dimension}${null!=(i=e.unit)?i:"pt"}`),"glue"in e&&(a=oq(e.glue),e.grow&&0!==e.grow.dimension&&(a+=` plus ${oq(e.grow)}`),e.shrink&&0!==e.shrink.dimension&&(a+=` minus ${oq(e.shrink)}`),o=a),"number"in e)if("base"in e&&"decimal"!==e.base)if("alpha"===e.base)o=`\`${String.fromCodePoint(e.number)}`;else{let i=Math.round(e.number)>>>0;"hexadecimal"===e.base?(o=Number(i).toString(16).toUpperCase(),o=i<=255?o.padStart(2,"0"):i<=65535?o.padStart(4,"0"):i<=0xffffff?o.padStart(6,"0"):o.padStart(8,"0"),o=`"${o}`):"octal"===e.base&&(o=Number(i).toString(8),o=i<=63?o.padStart(2,"0"):i<=30583?o.padStart(4,"0"):o.padStart(8,"0"),o=`'${o}`)}else o=Number(e.number).toString();return"register"in e&&("factor"in e&&(-1===e.factor?o="-":1!==e.factor&&(o=Number(e.factor).toString())),"global"in e&&e.global&&(o+="\\global"),o+=`\\${e.register}`),"string"in e&&(o=e.string),null!=(r=e.relax)&&r&&(o+="\\relax"),o}function oV(e,i){return null==e?null:"number"in e?g(f({},e),{number:e.number*i}):"register"in e?"factor"in e&&e.factor?g(f({},e),{factor:e.factor*i}):g(f({},e),{factor:i}):"dimension"in e?g(f({},e),{dimension:e.dimension*i}):"glue"in e?e.shrink&&e.grow?{glue:oV(e.glue,i),shrink:oV(e.shrink,i),grow:oV(e.grow,i)}:e.shrink?{glue:oV(e.glue,i),shrink:oV(e.shrink,i)}:e.grow?{glue:oV(e.glue,i),grow:oV(e.grow,i)}:{glue:oV(e.glue,i)}:null}var oj={"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 oH(){return{registers:f({},oj),smartFence:!1,renderPlaceholder:void 0,placeholderSymbol:"▢",letterShapeStyle:I.locale.startsWith("fr")?"french":"tex",minFontScale:0,maxMatrixCols:10,colorMap:U,backgroundColorMap:J,getMacro:e=>eS(e,e_())}}var oW=class e{constructor(i,r){var a,o,n,l,s,c,d,u,h,p,m,g,b,y,v;let x;null!=i&&i.parent?(this.parent=i.parent,x=i.parent,this.registers={}):(x=f(f({},oH()),null!=(a=null==i?void 0:i.from)?a:{}),this.registers=x.registers),x.atomIdsSettings&&(this.atomIdsSettings=f({},x.atomIdsSettings)),this.renderPlaceholder=x.renderPlaceholder,this.isPhantom=null!=(l=null!=(n=null==i?void 0:i.isPhantom)?n:null==(o=this.parent)?void 0:o.isPhantom)&&l,this.letterShapeStyle=x.letterShapeStyle,this.minFontScale=x.minFontScale,this.maxMatrixCols=x.maxMatrixCols,null!=r&&r.color&&"none"!==r.color?this.color=r.color:this.color=null!=(c=null==(s=this.parent)?void 0:s.color)?c:"",null!=r&&r.backgroundColor&&"none"!==r.backgroundColor?this.backgroundColor=r.backgroundColor:this.backgroundColor=null!=(u=null==(d=this.parent)?void 0:d.backgroundColor)?u:"",null!=r&&r.fontSize&&"auto"!==r.fontSize&&r.fontSize!==(null==(h=this.parent)?void 0:h.size)?this.size=r.fontSize:this.size=null!=(m=null==(p=this.parent)?void 0:p.size)?m:5;let _=null!=(b=null==(g=this.parent)?void 0:g.mathstyle)?b:oR.displaystyle;if("string"==typeof(null==i?void 0:i.mathstyle)){if(x instanceof e)switch(i.mathstyle){case"cramp":_=_.cramp;break;case"superscript":_=_.sup;break;case"subscript":_=_.sub;break;case"numerator":_=_.fracNum;break;case"denominator":_=_.fracDen}switch(i.mathstyle){case"textstyle":_=oR.textstyle;break;case"displaystyle":_=oR.displaystyle;break;case"scriptstyle":_=oR.scriptstyle;break;case"scriptscriptstyle":_=oR.scriptscriptstyle}}this.mathstyle=_,this.smartFence=x.smartFence,this.placeholderSymbol=x.placeholderSymbol,this.colorMap=null!=(y=x.colorMap)?y:e=>e,this.backgroundColorMap=null!=(v=x.backgroundColorMap)?v:e=>e,this.getMacro=x.getMacro,void 0!==this.parent||this.registers}makeID(){if(!this.atomIdsSettings)return;if(this.atomIdsSettings.overrideID)return this.atomIdsSettings.overrideID;if("number"!=typeof this.atomIdsSettings.seed)return`${Date.now().toString(36).slice(-2)}${Math.floor(1e5*Math.random()).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 7===this.mathstyle.id||6===this.mathstyle.id}get isCramped(){return this.mathstyle.cramped}get isTight(){return this.mathstyle.isTight}get metrics(){return this.mathstyle.metrics}get effectiveFontSize(){return Math.max(oi[Math.max(1,this.size+this.mathstyle.sizeDelta)],this.minFontScale)}getRegister(e){return this.registers&&e in this.registers?this.registers[e]:this.parent?this.parent.getRegister(e):void 0}getRegisterAsNumber(e){let i=this.getRegister(e);return"number"==typeof i?i:"string"==typeof i?Number(i):void 0}getRegisterAsGlue(e){if(this.registers&&e in this.registers){let i=this.registers[e];return"object"==typeof i&&"glue"in i?i:"object"==typeof i&&"dimension"in i?{glue:{dimension:i.dimension}}:"number"==typeof i?{glue:{dimension:i}}:void 0}if(this.parent)return this.parent.getRegisterAsGlue(e)}getRegisterAsEm(e,i){return oN(this.getRegisterAsDimension(e),i)}getRegisterAsDimension(e){if(this.registers&&e in this.registers){let i=this.registers[e];return"object"==typeof i&&"glue"in i?i.glue:"object"==typeof i&&"dimension"in i?i:"number"==typeof i?{dimension:i}:void 0}if(this.parent)return this.parent.getRegisterAsDimension(e)}setRegister(e,i){void 0===i?delete this.registers[e]:this.registers[e]=i}evaluate(e){if(!e||!("register"in e))return e;let i=this;if("global"in e&&e.global)for(;i.parent;)i=i.parent;let r=1;"factor"in e&&1!==e.factor&&void 0!==e.factor&&(r=e.factor);let a=i.getRegister(e.register);if(void 0===a)return;if("string"==typeof a)return{string:Number(a).toString()+a};if("number"==typeof a)return{number:r*a};let o=i.evaluate(a);if(void 0!==o)return"string"in o?{string:Number(a).toString()+o.string}:"number"in o?{number:r*o.number}:"dimension"in o?g(f({},o),{dimension:r*o.dimension}):"glue"in o?g(f({},o),{glue:g(f({},o.glue),{dimension:r*o.glue.dimension}),shrink:o.shrink?g(f({},o.shrink),{dimension:r*o.shrink.dimension}):void 0,grow:o.grow?g(f({},o.grow),{dimension:r*o.grow.dimension}):void 0}):e}toDimension(e){let i=this.evaluate(e);if(void 0===i)return null;if("dimension"in i)return i;if("glue"in i)return i.glue;if("number"in i)return{dimension:i.number};if("string"in i){let e=parseFloat(i.string),r=i.string.match(/(mm|cm|ex|px|em|bp|dd|pc|in|mu)$/);return r?{dimension:e,unit:r[0]}:{dimension:e}}return null}toEm(e,i){if(null===e)return 0;let r=this.toDimension(e);return null===r?0:oI(r,i)/10}toNumber(e){if(null===e)return null;let i=this.evaluate(e);return void 0===i?null:"number"in i?i.number:"dimension"in i?i.dimension:"glue"in i?i.glue.dimension:"string"in i?Number(i.string):null}toColor(e){var i,r;if(null===e)return null;let a=this.evaluate(e);return void 0===a?null:"string"in a?null!=(r=null==(i=this.colorMap)?void 0:i.call(this,a.string))?r:a.string:null}toBackgroundColor(e){var i,r;if(null===e)return null;let a=this.evaluate(e);return void 0===a?null:"string"in a?null!=(r=null==(i=this.backgroundColorMap)?void 0:i.call(this,a.string))?r:a.string:null}},oU=["body","above","below","superscript","subscript"];function oJ(e){return"string"==typeof e&&oU.includes(e)}function oX(e){return void 0!==e&&Array.isArray(e)&&2===e.length}var oG=class e{constructor(e){var i,r,a,o,n,l,s;this.isRoot=!1,this.type=e.type,"string"==typeof e.value&&(this.value=e.value),this.command=null!=(r=null!=(i=e.command)?i:this.value)?r:"",this.mode=null!=(a=e.mode)?a:"math",e.isFunction&&(this.isFunction=!0),(e.isRoot||"root"===this.type)&&(this.isRoot=!0),e.limits&&(this.subsupPlacement=e.limits),this.style=f({},null!=(o=e.style)?o:{}),this.displayContainsHighlight=null!=(n=e.displayContainsHighlight)&&n,this.captureSelection=null!=(l=e.captureSelection)&&l,this.skipBoundary=null!=(s=e.skipBoundary)&&s,void 0!==e.verbatimLatex&&null!==e.verbatimLatex&&(this.verbatimLatex=e.verbatimLatex),e.args&&(this.args=e.args),e.body&&(this.body=e.body),this._changeCounter=0}static createBox(e,i,r){var a;if(!i)return null;let o=function(e){let i,r=[],a=[];for(let o of e){if("first"===o.type){a.push(o);continue}if(i||o.style){let e=o.style;i&&e.color===i.color&&e.backgroundColor===i.backgroundColor&&e.fontSize===i.fontSize?a.push(o):(a.length>0&&r.push(a),a=[o],i=e)}else a.push(o)}return a.length>0&&r.push(a),r}(i),n=[];for(let i of o){let r=i[0].style,a=function(e,i,r){var a,o,n,l,s;if(!i||0===i.length)return null;let c=new oW({parent:e},r.style),d=!(null!=(a=c.atomIdsSettings)&&a.groupNumbers),u=[];if(1===i.length){let e=i[0],r=e.render(c);r&&(d&&e.isSelected&&r.selected(!0),u=[r])}else{let e="",r=!0;for(let a of i){null!=(o=c.atomIdsSettings)&&o.groupNumbers&&e&&(r&&a.isDigit()||!r&&oZ(a))&&(c.atomIdsSettings.overrideID=e);let i=a.render(c);c.atomIdsSettings&&(c.atomIdsSettings.overrideID=void 0),i&&(null!=(n=c.atomIdsSettings)&&n.groupNumbers&&((a.isDigit()||oZ(a))&&(!e||r!==a.isDigit())&&(r=a.isDigit(),e=null!=(l=a.id)?l:""),!e||(a.isDigit()||oZ(a))&&a.hasEmptyBranch("superscript")&&a.hasEmptyBranch("subscript")||(e="")),d&&a.isSelected&&i.selected(!0),u.push(i))}}if(0===u.length)return null;let h=new oE(u,g(f({isTight:c.isTight},r),{type:null!=(s=r.type)?s:"lift"}));return h.isSelected=u.every(e=>e.isSelected),h.wrap(c)}(e,i,{style:{color:r.color,backgroundColor:r.backgroundColor,fontSize:r.fontSize}});a&&n.push(a)}if(0===n.length)return null;let l=(null!=(a=null==r?void 0:r.classes)?a:"").trim();return 1!==n.length||l||null!=r&&r.type?new oE(n,{classes:l,type:null==r?void 0:r.type}).wrap(e):n[0].wrap(e)}static serialize(e,i){return ov.serialize(e,i)}static commonAncestor(e,i){if(e===i||e.parent===i.parent)return e.parent;let r=new WeakSet,{parent:a}=e;for(;a;)r.add(a),a=a.parent;for(a=i.parent;a;){if(r.has(a))return a;a=a.parent}}static fromJson(i){return new e("string"==typeof i?{type:"mord",value:i,mode:"math"}:i)}toJson(){if(this._json)return this._json;let e={};if(this.type&&(e.type=this.type),"math"!==this.mode&&(e.mode=this.mode),this.command&&this.command!==this.value&&(e.command=this.command),void 0!==this.value&&(e.value=this.value),this.style&&Object.keys(this.style).length>0&&(e.style=f({},this.style)),void 0!==this.verbatimLatex&&(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=this.args.map(e=>null===e?"<null>":Array.isArray(e)&&e[0]instanceof oG?{atoms:e.map(e=>e.toJson())}:"object"==typeof e&&"group"in e?{group:e.group.map(e=>e.toJson())}:e)),this._branches)for(let i of Object.keys(this._branches))this._branches[i]&&(e[i]=this._branches[i].filter(e=>"first"!==e.type).map(e=>e.toJson()));return"mord"===e.type&&2===Object.keys(e).length&&"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)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);return null!=i&&i.serialize?i.serialize(this,e):this.body&&this.command?of([og(this.command,this.bodyToLatex(e)),this.supsubToLatex(e)]):this.body?of([this.bodyToLatex(e),this.supsubToLatex(e)]):this.value&&"​"!==this.value?this.command:""}bodyToLatex(e){var i;let r=null!=(i=e.defaultMode)?i:"math"===this.mode?"math":"text";return ov.serialize(this.body,g(f({},e),{defaultMode:r}))}aboveToLatex(e){return ov.serialize(this.above,e)}belowToLatex(e){return ov.serialize(this.below,e)}supsubToLatex(e){let i="";if(e=g(f({},e),{defaultMode:"math"}),void 0!==this.branch("subscript")){let r=ov.serialize(this.subscript,e);0===r.length?i+="_{}":1===r.length&&o$.compactSerialization&&/^[0-9]$/.test(r)?i+=`_${r}`:i+=`_{${r}}`}if(void 0!==this.branch("superscript")){let r=ov.serialize(this.superscript,e);0===r.length?i+="^{}":1===r.length?"′"===r?i+="^\\prime ":"″"===r?i+="^\\doubleprime ":o$.compactSerialization&&/^[0-9]$/.test(r)?i+=`^${r}`:i+=`^{${r}}`:i+=`^{${r}}`}return i}get treeDepth(){let e=1,i=this.parent;for(;i;)i=i.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("prompt"===e.type&&!e.captureSelection)return e;e=e.parent}return null}branch(e){if(oJ(e)&&this._branches)return this._branches[e]}get branches(){if(!this._branches)return[];let e=[];for(let i of oU)this._branches[i]&&e.push(i);return e}createBranch(e){return oJ(e),oJ(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 oX(this.parentBranch)?this.parentBranch[0]:-1}get col(){return oX(this.parentBranch)?this.parentBranch[1]:-1}get body(){var e;return null==(e=this._branches)?void 0:e.body}set body(e){this.setChildren(e,"body")}get superscript(){var e;return null==(e=this._branches)?void 0:e.superscript}set superscript(e){this.setChildren(e,"superscript")}get subscript(){var e;return null==(e=this._branches)?void 0:e.subscript}set subscript(e){this.setChildren(e,"subscript")}get above(){var e;return null==(e=this._branches)?void 0:e.above}set above(e){this.setChildren(e,"above")}get below(){var e;return null==(e=this._branches)?void 0:e.below}set below(e){this.setChildren(e,"below")}applyStyle(e,i){for(let r of(this.isDirty=!0,null!=i&&i.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=f(f({},this.style),e),"none"===this.style.fontFamily&&delete this.style.fontFamily,"auto"===this.style.fontShape&&delete this.style.fontShape,"auto"===this.style.fontSeries&&delete this.style.fontSeries,"none"===this.style.color&&(delete this.style.color,delete this.style.verbatimColor),"none"===this.style.backgroundColor&&(delete this.style.backgroundColor,delete this.style.verbatimBackgroundColor),"auto"===this.style.fontSize&&delete this.style.fontSize,this.children))r.applyStyle(e,i)}getInitialBaseElement(){var e,i,r;return this.hasEmptyBranch("body")?this:(null==(e=this.body)||e[0].type,null!=(r=null==(i=this.body[1])?void 0:i.getInitialBaseElement())?r:this)}getFinalBaseElement(){return this.hasEmptyBranch("body")?this:this.body[this.body.length-1].getFinalBaseElement()}isCharacterBox(){return"leftright"!==this.type&&"genfrac"!==this.type&&"subsup"!==this.type&&"delim"!==this.type&&"array"!==this.type&&"surd"!==this.type&&"mord"===this.getFinalBaseElement().type}hasEmptyBranch(e){let i=this.branch(e);return!i||(i.length,i[0].type,1===i.length)}setChildren(e,i){var r;if(!e||(oJ(i),!oJ(i)))return;let a=(null==(r=e[0])?void 0:r.type)==="first"?[...e]:[this.makeFirstAtom(i),...e];for(let r of(this._branches?this._branches[i]=a:this._branches={[i]:a},e))r.parent=this,r.parentBranch=i;this.isDirty=!0}makeFirstAtom(i){let r=new e({type:"first",mode:this.mode});return r.parent=this,r.parentBranch=i,r}addChild(e,i){e.type,this.createBranch(i).push(e),this.isDirty=!0,e.parent=this,e.parentBranch=i}addChildBefore(e,i){i.parentBranch;let r=this.createBranch(i.parentBranch);r.splice(r.indexOf(i),0,e),this.isDirty=!0,e.parent=this,e.parentBranch=i.parentBranch}addChildAfter(e,i){i.parentBranch;let r=this.createBranch(i.parentBranch);r.splice(r.indexOf(i)+1,0,e),this.isDirty=!0,e.parent=this,e.parentBranch=i.parentBranch}addChildren(e,i){let r=this.createBranch(i);for(let a of e)a.parent=this,a.parentBranch=i,r.push(a);this.isDirty=!0}addChildrenAfter(e,i){0===e.length||e[0].type,i.parentBranch;let r=this.createBranch(i.parentBranch);for(let a of(r.splice(r.indexOf(i)+1,0,...e),this.isDirty=!0,e))a.parent=this,a.parentBranch=i.parentBranch;return e[e.length-1]}removeBranch(e){let i=this.branch(e);if(oJ(e)&&(this._branches[e]=void 0),!i)return[];for(let e of i)e.parent=void 0,e.parentBranch=void 0;i[0].type;let[r,...a]=i;return this.isDirty=!0,a}removeChild(e){if(e.parent,"first"===e.type)return;let i=this.branch(e.parentBranch),r=i.indexOf(e);i.splice(r,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 1===this.siblings.length}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 i of oU)if(this._branches[i])for(let r of this._branches[i])e.push(...r.children),e.push(r);return this._children=e,e}render(e){if("first"===this.type&&!e.atomIdsSettings)return null;let i=eM(this.command,this.mode);if(null!=i&&i.render)return i.render(this,e);let r=new oW({parent:e},this.style),a=this.createBox(r,{classes:this.parent?"":"ML__base"});return a?(!this.subsupPlacement&&(this.superscript||this.subscript)&&(a=this.attachSupsub(r,{base:a})),a.wrap(r)):null}attachSupsub(i,r){var a;let o,n=r.base,l=this.superscript,s=this.subscript;if(!l&&!s)return n;let c=null,d=null,u=null!=(a=r.isCharacterBox)?a:this.isCharacterBox(),h=0;if(l){let r=new oW({parent:i,mathstyle:"superscript"});c=e.createBox(r,l),u||(h=n.height-i.metrics.supDrop*r.scalingFactor)}let p=0;if(s){let r=new oW({parent:i,mathstyle:"subscript"});d=e.createBox(r,s),u||(p=n.depth+i.metrics.subDrop*r.scalingFactor)}o=i.isDisplayStyle?i.metrics.sup1:i.isCramped?i.metrics.sup3:i.metrics.sup2;let m=.05/i.scalingFactor,f=null;if(d&&c){h=Math.max(h,o,c.depth+.25*i.metrics.xHeight),p=Math.max(p,i.metrics.sub2);let e=i.metrics.defaultRuleThickness;if(h-c.depth-(d.height-p)<4*e){p=4*e-(h-c.depth)+d.height;let r=.8*i.metrics.xHeight-(h-c.depth);r>0&&(h+=r,p-=r)}f=new oB({individualShift:[{box:d,shift:p,marginLeft:"extensible-symbol"===this.type&&n.italic?-n.italic:0},{box:c,shift:-h}]})}else d&&!c?f=new oB({shift:p=Math.max(p,i.metrics.sub1,d.height-.3448),children:[{box:d,marginRight:m,marginLeft:this.isCharacterBox()?-n.italic:0}]}):!d&&c&&(f=new oB({shift:-(h=Math.max(h,o,c.depth+.10775)),children:[{box:c,marginRight:m}]}));return new oE([n,new oE(f,{caret:this.caret,isSelected:this.isSelected,classes:"ML__msubsup"})],{type:r.type})}attachLimits(i,r){var a,o,n,l,s,c;let d,u,h,p,m,b,y=this.superscript?e.createBox(new oW({parent:i,mathstyle:"superscript"},this.style),this.superscript):null,v=this.subscript?e.createBox(new oW({parent:i,mathstyle:"subscript"},this.style),this.subscript):null;return y||v?(a=g(f({},r),{above:y,below:v}),d=i.metrics,u=new oE(a.base),h=null!=(o=a.baseShift)?o:0,p=null!=(n=a.slant)?n:0,m=0,b=0,a.above&&(m=null!=(l=a.aboveShift)?l:Math.max(d.bigOpSpacing1,d.bigOpSpacing3-a.above.depth)),a.below&&(b=null!=(s=a.belowShift)?s:Math.max(d.bigOpSpacing2,d.bigOpSpacing4-a.below.height)),new oE(a.below&&a.above?new oB({bottom:d.bigOpSpacing5+a.below.height+a.below.depth+b+u.depth+h,children:[d.bigOpSpacing5,{box:a.below,marginLeft:-p,classes:["ML__center"]},b,{box:u,classes:["ML__center"]},m,{box:a.above,marginLeft:p,classes:["ML__center"]},d.bigOpSpacing5]}).wrap(i):a.below&&!a.above?new oB({top:u.height-h,children:[d.bigOpSpacing5,{box:a.below,marginLeft:-p,classes:["ML__center"]},b,{box:u,classes:["ML__center"]}]}).wrap(i):!a.below&&a.above?new oB({bottom:u.depth+h,children:[{box:u,classes:["ML__center"]},m,{box:a.above,marginLeft:p,classes:["ML__center"]},d.bigOpSpacing5]}).wrap(i):new oB({bottom:u.depth+h,children:[{box:u},d.bigOpSpacing5]}).wrap(i),{type:null!=(c=a.type)?c:"op"})):r.base.wrap(i)}bind(e,i){if(!i||e.isPhantom||"​"===this.value)return i;let r=this.parent;for(;r&&!r.captureSelection;)r=r.parent;return null!=r&&r.captureSelection||(this.id||(this.id=e.makeID()),i.atomID=this.id),i}createBox(i,r){var a,o,n,l;let s=null!=(a=this.value)?a:this.body,c=null!=(o=null==r?void 0:r.boxType)?o:oS(this.type),d=null!=(n=null==r?void 0:r.classes)?n:"";"text"===this.mode&&(d+=" ML__text");let u="string"==typeof s||void 0===s?new oE(null!=s?s:null,{type:c,isSelected:this.isSelected,mode:this.mode,maxFontSize:i.scalingFactor,style:g(f({variant:"normal"},this.style),{fontSize:Math.max(1,i.size+i.mathstyle.sizeDelta)}),letterShapeStyle:i.letterShapeStyle,classes:d}):null!=(l=e.createBox(i,s,{type:c,classes:d}))?l:new oE(null);return i.isTight&&(u.isTight=!0),("math"!==this.mode||"main"===this.style.variant)&&(u.italic=0),u.right=u.italic,this.bind(i,u),!this.caret||this.superscript||this.subscript||(u.caret=this.caret),u}isDigit(){var e;return"mord"===this.type&&this.value?/^[\d,\.]$/.test(this.value):"group"===this.type&&(null==(e=this.body)?void 0:e.length)===2&&"first"===this.body[0].type&&","===this.body[1].value}asDigit(){var e;return"mord"===this.type&&this.value&&/^[\d,\.]$/.test(this.value)?this.value:"group"===this.type&&(null==(e=this.body)?void 0:e.length)===2&&"first"===this.body[0].type&&","===this.body[1].value?".":""}};function oZ(e){return"text"===e.mode}var oY=class e extends oG{constructor(e,i,r){super({type:"text",command:e,mode:"text",displayContainsHighlight:!0}),this.value=i,this.verbatimLatex=i,this.applyStyle(r)}static fromJson(i){return new e(i.command,i.value,i.style)}render(e){let i=this.createBox(e);return this.caret&&(i.caret=this.caret),i}_serialize(e){var i;return null!=(i=this.verbatimLatex)?i:eL("text",this.value.codePointAt(0))}};function oQ(e){let i=1/0,r=-1/0;for(let a of e.ranges)i=Math.min(i,a[0],a[1]),r=Math.max(r,a[0],a[1]);return[i,r]}function o0(e){return"number"==typeof e&&!Number.isNaN(e)}function o1(e){return Array.isArray(e)&&2===e.length}function o4(e){return null!=e&&"object"==typeof e&&"ranges"in e&&Array.isArray(e.ranges)}function o2(e,i,r){return r?function(e,i){if(!i)return"";if("string"==typeof i)return i;if(!e||void 0===i.after)return i.value;let r=!1,a=!1,o=!1,n=!1,l=!1,s=!1,c=!1,d=!1,u=!1,h=!1,p=!1,m=!1,f=!1,g=!1,b=!1,y=e[0],v=0;for(;null!=y&&y.type&&/^(subsup|placeholder)$/.test(y.type);)v+=1,y=e[v];return r=!y||"first"===y.type,y&&(a=!(g="text"===y.mode)&&"mord"===y.type&&ei.test(y.value),o=!g&&"mord"===y.type&&/\d+$/.test(y.value),n=!g&&y.isFunction,l="genfrac"===y.type,s="surd"===y.type,c="mbin"===y.type,d="mrel"===y.type,u="mop"===y.type||"operator"===y.type||"extensible-symbol"===y.type,h="mpunct"===y.type||"minner"===y.type,p="array"===y.type,m="mopen"===y.type,f="mclose"===y.type||"leftright"===y.type,b="space"===y.type),i.after.includes("nothing")&&r||i.after.includes("letter")&&a||i.after.includes("digit")&&o||i.after.includes("function")&&n||i.after.includes("frac")&&l||i.after.includes("surd")&&s||i.after.includes("binop")&&c||i.after.includes("relop")&&d||i.after.includes("operator")&&u||i.after.includes("punct")&&h||i.after.includes("array")&&p||i.after.includes("openfence")&&m||i.after.includes("closefence")&&f||i.after.includes("text")&&g||i.after.includes("space")&&b?i.value:""}(e,r[i]):""}var o3={"&":"\\&","%":"\\%",$:"\\$","''":"^{\\doubleprime}","'''":"^{\\prime\\prime\\prime}","''''":"^{\\prime\\prime\\prime\\prime}",alpha:"\\alpha",delta:"\\delta",Delta:"\\Delta",pi:"\\pi",Pi:"\\Pi",theta:"\\theta",Theta:"\\Theta",ii:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryI"},jj:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryJ"},ee:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\exponentialE"},nabla:"\\nabla",grad:"\\nabla",del:"\\partial",deg:{after:"digit+space",value:"\\degree"},infty:"\\infty","∞":"\\infty",oo:{after:"nothing+digit+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\infty"},"∑":"\\sum",sum:"\\sum_{#?}^{#?}",int:"\\int_{#?}^{#?}",prod:"\\prod_{#?}^{#?}",sqrt:"\\sqrt{#?}","∆":"\\differentialD","∂":"\\differentialD",sin:"\\sin",cos:"\\cos",tan:"\\tan",blank:"\\blank{#?}",arccos:"\\arccos",arcsin:"\\arcsin",arctan:"\\arctan",arctg:"\\operatorname{arctg}",arcsec:"\\operatorname{arcsec}",arccsc:"\\operatorname{arccsc}",arsinh:"\\operatorname{arsinh}",arccosh:"\\operatorname{arccosh}",arcosh:"\\operatorname{arcosh}",artanh:"\\operatorname{artanh}",arctanh:"\\operatorname{arctanh}",arcsech:"\\operatorname{arcsech}",arccsch:"\\operatorname{arccsch}",ch:"\\operatorname{ch}",cosec:"\\operatorname{cosec}",cosh:"\\cosh",cot:"\\cot",cotg:"\\operatorname{cotg}",coth:"\\coth",csc:"\\csc",ctg:"\\operatorname{ctg}",cth:"\\operatorname{cth}",sec:"\\sec",sech:"\\operatorname{sech}",sinh:"\\sinh",sh:"\\operatorname{sh}",tanh:"\\tanh",tg:"\\operatorname{tg}",th:"\\operatorname{th}",arg:"\\arg",lg:"\\lg",lb:"\\operatorname{lb}",log:"\\log_{#?}",ln:"\\ln",exp:"\\exp",lim:"\\lim_{#?\\to#?}",dx:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD x"},dy:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD y"},dt:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD t"},AA:"\\forall",EE:"\\exists","!EE":"\\nexists","&&":"\\land",xin:{after:"nothing+text+relop+punct+openfence+space",value:"x \\in"},sint:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\sin t"},in:{after:"nothing+letter+closefence",value:"\\in"},"!in":"\\notin",NN:"\\mathbb{N}",ZZ:"\\mathbb{Z}",QQ:"\\mathbb{Q}",RR:"\\mathbb{R}",CC:"\\mathbb{C}",xx:"\\times","+-":"\\pm","≠":"\\ne","!=":"\\ne","≥":"\\ge",">=":"\\ge","≤":"\\le","<=":"\\le","<<":"\\ll",">>":"\\gg","~~":"\\approx","≈":"\\approx","?=":"\\questeq","÷":"\\div","¬":"\\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"},µ:"\\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",Ω:"\\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","--\x3e...":"\\longrightarrow\\cdots","->":"\\to","|->":"\\mapsto","--\x3e":"\\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 o6(e,i){var r,a;let o,n=null!=(r=null==i?void 0:i.format)?r:"auto";return"auto"===n&&([n,e]=(a=(a=e).trim()).length<=1?["latex",a]:([o,a]=nt(a),o?["latex",a]:a.startsWith("`")&&a.endsWith("`")?["ascii-math",a=a.substring(1,a.length-1)]:a.includes("\\")?["latex",a]:/\$.+\$/.test(a)?["latex",`\\text{${a}}`]:[void 0,a])),"ascii-math"===n?["ascii-math",o8(e=(e=(e=(e=(e=(e=e.replace(/\u2061/gu,"")).replace(/\u3016/gu,"{")).replace(/\u3017/gu,"}")).replace(/([^\\])sinx/g,"$1\\sin x")).replace(/([^\\])cosx/g,"$1\\cos x ")).replace(/\u2013/g,"-"),{inlineShortcuts:null==i?void 0:i.inlineShortcuts})]:["latex",e]}function o8(e,i){var r;if(!(e=e.trim()))return"";let a=null!=(r=i.inlineShortcuts)?r:o3;if(e.startsWith("^")||e.startsWith("_")){let{match:r,rest:o}=o7(e.slice(1),{inlineShortcuts:a,noWrap:!0});return`${e[0]}{${r}}${o8(o,i)}`}let o=e.match(/^(sqrt|\u221A)(.*)/);if(o){let{match:e,rest:r}=o7(o[2],{inlineShortcuts:a,noWrap:!0});return`\\sqrt{${null!=e?e:"\\placeholder{}"}}${o8(r,i)}`}if(o=e.match(/^(\\cbrt|\u221B)(.*)/)){let{match:e,rest:r}=o7(o[2],{inlineShortcuts:a,noWrap:!0});return`\\sqrt[3]{${null!=e?e:"\\placeholder{}"}}${o8(r,i)}`}if(o=e.match(/^abs(.*)/)){let{match:e,rest:r}=o7(o[1],{inlineShortcuts:a,noWrap:!0});return`\\left|${null!=e?e:"\\placeholder{}"}\\right|${o8(r,i)}`}if(o=e.match(/^["”“](.*?)["”“](.*)/))return`\\text{${o[1]}}${o8(o[2],i)}`;if(o=e.match(/^([^a-zA-Z0-9\(\{\[\_\^\\\s"]+)(.*)/))return`${o9(o[1],a)}${o8(o[2],i)}`;if(/^([fgh])[^a-zA-Z]/.test(e)){let{rest:r,match:o}=o7(e.slice(1),{inlineShortcuts:a,noWrap:!0});return("("===e[1]?`${e[0]}\\left(${o}\\right)`:e[0]+o)+o8(r,i)}if(o=e.match(/^([a-zA-Z]+)(.*)/))return o9(o[1],a)+o8(o[2],i);let{match:n,rest:l}=o7(e,{inlineShortcuts:a,noWrap:!0});if(!n||"/"!==l[0])return e.startsWith("(")?"\\left("+n+"\\right)"+o8(l,i):n+o8(l,i);{let e=o7(l.slice(1),{inlineShortcuts:a,noWrap:!0});if(e.match)return`\\frac{${n}}{${e.match}}${o8(e.rest,i)}`}return(o=e.match(/^(\s+)(.*)$/))?" "+o8(o[2],i):e}var o5={"[":"\\lbrack","]":"\\rbrack","{":"\\lbrace","}":"\\rbrace"};function o7(e,i){var r,a;let o="",n=e=e.trim(),l=e.charAt(0),s={"(":")","{":"}","[":"]"}[l];if(s){let c=1,d=1;for(;d<e.length&&c>0;)e[d]===l&&c++,e[d]===s&&c--,d++;if(0===c){let c=o8(e.substring(1,d-1),i);o=i.noWrap&&"("===l?c:`\\left${null!=(r=o5[l])?r:l}${c}\\right${null!=(a=o5[s])?a:s}`,n=e.slice(Math.max(0,d))}else o=e.substring(1,d),n=""}else{let r=e.match(/^([a-zA-Z]+)/);if(r){let r=o2(null,e,i.inlineShortcuts);if(r)return{match:r=(r=r.replace("_{#?}","")).replace("^{#?}",""),rest:e.slice(r.length)}}if(r=e.match(/^([a-zA-Z])/))return{match:r[1],rest:e.slice(1)};if(r=e.match(/^(-)?\d+(\.\d*)?/))return{match:r[0],rest:e.slice(r[0].length)};/^\\(left|right)/.test(e)||(r=e.match(/^(\\[a-zA-Z]+)/))&&(n=e.slice(r[1].length),o=r[1])}return{match:o,rest:n}}function o9(e,i){let r=o2(null,e,i);return r?(r=r.replace("_{#?}","")).replace("^{#?}","")+" ":e}var ne=[["\\[","\\]"],["\\(","\\)"],["$$","$$"],["$","$"],["\\begin{math}","\\end{math}"],["\\begin{displaymath}","\\end{displaymath}"],["\\begin{equation}","\\end{equation}"],["\\begin{equation*}","\\end{equation*}"]];function nt(e){let i=e.trim();for(let e of ne)if(i.startsWith(e[0])&&i.endsWith(e[1]))return[!0,i.substring(e[0].length,i.length-e[1].length)];return[!1,e]}var ni=(e,i,r)=>(ne.some(e=>i.startsWith(e[0])&&i.endsWith(e[1]))||(i=`$$ ${i} $$`),i),nr=class e{constructor(i){e._modes[i]=this}static onPaste(i,r,a){var o;if(!r.contentEditable&&"none"===r.userSelect)return r.model.announce("plonk"),!1;if("string"==typeof a){let e=new DataTransfer;e.setData("text/plain",a),a=e}let n=new ClipboardEvent("paste",{clipboardData:a,cancelable:!0});return!!(null!=(o=r.host)&&o.dispatchEvent(n))&&e._modes[i].onPaste(r,a)}static copyToClipboard(e,i){if(!e.contentEditable&&"none"===e.userSelect)return void e.model.announce("plonk");let r=e.model,a=r.selectionIsCollapsed?[0,r.lastOffset]:oQ(r.selection),o=r.getValue(a,i);navigator.clipboard.writeText(o).then(()=>{},()=>e.model.announce("plonk"))}static onCopy(e,i){var r;if(!i.clipboardData)return;if(!e.contentEditable&&"none"===e.userSelect)return void e.model.announce("plonk");let a=e.model,o=a.selectionIsCollapsed?[0,a.lastOffset]:oQ(a.selection),n=a.getAtoms(o);if(n.every(e=>"text"===e.mode||!e.mode))i.clipboardData.setData("text/plain",n.filter(e=>e instanceof oY).map(e=>e.value).join(""));else if(n.every(e=>"latex"===e.mode))i.clipboardData.setData("text/plain",a.getAtoms(o,{includeChildren:!0}).map(e=>{var i;return null!=(i=e.value)?i:""}).join(""));else{let l;l=1===n.length&&void 0!==n[0].verbatimLatex?n[0].verbatimLatex:a.getValue(o,"latex-expanded"),i.clipboardData.setData("application/x-latex",l);try{i.clipboardData.setData("text/plain",e.options.onExport(e,l,o))}catch(e){}if(1===n.length){let e=n[0];("root"===e.type||"group"===e.type)&&(n=e.body.filter(e=>"first"!==e.type))}try{i.clipboardData.setData("application/json+mathlive",JSON.stringify(n.map(e=>e.toJson())))}catch(e){}if(null!=(r=window[Symbol.for("io.cortexjs.compute-engine")])&&r.ComputeEngine){let e=globalThis.MathfieldElement.computeEngine;if(e)try{let r=e.jsonSerializationOptions;e.jsonSerializationOptions={metadata:["latex"]};let n=e.parse(a.getValue(o,"latex-unstyled"));e.jsonSerializationOptions=r;let l=JSON.stringify(n.json);l&&i.clipboardData.setData("application/json",l)}catch(e){}}}i.preventDefault()}static insert(i,r,a={}){var o;let n="auto"===a.mode?i.mode:null!=(o=a.mode)?o:i.mode;return e._modes[n].insert(i,r,a)}onPaste(e,i){return!1}insert(e,i,r){return!1}};nr._modes={};var na=nr,no=[{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","^"]}],nn={"\\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 nl(e){var i;return(null==(i=e.element)?void 0:i.mathfield)===e}function ns(e){var i,r;let a=null!=(r=null!=(i=e.querySelector(".ML__caret"))?i:e.querySelector(".ML__text-caret"))?r:e.querySelector(".ML__latex-caret");if(!a)return null;let o=a.getBoundingClientRect();return{x:o.right,y:o.bottom,height:o.height}}function nc(e,i,r){if(!i)return null;let a=e.field.getBoundingClientRect(),o=i.right-i.left,n=i.bottom-i.top,l=Math.ceil(i.left-a.left+e.field.scrollLeft*r),s=Math.ceil(i.top-a.top);return{left:l,right:l+o,top:s,bottom:s+n}}function nd(e){let i=e,r=i.getBoundingClientRect();for(;r.bottom===r.top&&i.parentElement instanceof Element&&(r=(i=i.parentElement).getBoundingClientRect()).bottom===r.top;);let a=getComputedStyle(i),o=parseInt(a.marginRight),n=r.right-r.left,l=r.bottom-r.top;if(0===n||!Number.isFinite(n)){let e=parseFloat(a.width);Number.isFinite(e)&&e>0?n=e:i instanceof HTMLElement&&i.offsetWidth>0&&(n=i.offsetWidth)}if(0===l||!Number.isFinite(l)){let e=parseFloat(a.height);Number.isFinite(e)&&e>0?l=e:i instanceof HTMLElement&&i.offsetHeight>0&&(l=i.offsetHeight)}let s={top:r.top-1,bottom:r.top-1+l,left:r.left,right:r.left+n-1+o};if(0===e.children.length||"SVG"===e.tagName.toUpperCase())return s;for(let i of e.children)if(1===i.nodeType&&"atomId"in i.dataset&&!i.classList.contains("ML__pstrut")){let e=nd(i);s.left=Math.min(s.left,e.left),s.right=Math.max(s.right,e.right),s.top=Math.min(s.top,e.top),s.bottom=Math.max(s.bottom,e.bottom)}return s}function nu(e,i){var r,a;if(!i.id)return null;let o=null!=(a=null==(r=e.atomBoundsCache)?void 0:r.get(i.id))?a:null;if(null!==o)return o;let n=Array.from(e.field.querySelectorAll(`[data-atom-id="${i.id}"]`));if("prompt"===i.type){for(let e of n)if(e.classList.contains("ML__prompt-atom")){let i=e.querySelector(".ML__prompt");if(i){let e=nd(i);o?(o.left=Math.min(o.left,e.left),o.right=Math.max(o.right,e.right),o.top=Math.min(o.top,e.top),o.bottom=Math.max(o.bottom,e.bottom)):o=e}}}for(let e of n){let i=nd(e);o?(o.left=Math.min(o.left,i.left),o.right=Math.max(o.right,i.right),o.top=Math.min(o.top,i.top),o.bottom=Math.max(o.bottom,i.bottom)):o=i}return e.atomBoundsCache&&(o?e.atomBoundsCache.set(i.id,o):e.atomBoundsCache.delete(i.id)),null!=o?o:null}function nh(e,i){return e.model.selection.ranges.reduce((r,a)=>r.concat(...function(e,i,r){let a=new Map,o=e.field,n=o.offsetWidth,l=Math.floor(o.getBoundingClientRect().width)/n;for(let o of(l=isNaN(l)?1:l,e.model.getAtoms(i,{includeChildren:!0}))){if(null!=r&&r.excludeAtomsWithBackground&&o.style.backgroundColor)continue;let i=nc(e,nu(e,o),l);if(i){let e=function(e){var i;return e.parent?(null!=(i=e.parent.id)?i:"")+("string"==typeof e.parentBranch?"-"+e.parentBranch:`-${e.parentBranch[0]}/${e.parentBranch[0]}`):"root"}(o);if(a.has(e)){let r=a.get(e);a.set(e,{left:Math.min(r.left,i.left),right:Math.max(r.right,i.right),top:Math.min(r.top,i.top),bottom:Math.max(r.bottom,i.bottom)})}else a.set(e,i)}}return[...a.values()]}(e,a,i)),[])}function np(e,i){return"*"===e||"none"===i||("same-origin"===i?!window.origin||e===window.origin:"function"==typeof i&&i(e))}function nm(e){let i=0,r=0,a=e.offsetWidth,o=e.offsetHeight;for(;e instanceof HTMLElement;)i+=e.offsetTop,r+=e.offsetLeft,e=e.offsetParent;return new DOMRect(r,i,a,o)}function nf(e,i){if(!e)return;let r=e.model.at(i);if(!r)return;let a={},o=nu(e,r);o&&(a.bounds=new DOMRect(o.left,o.top,o.right-o.left,o.bottom-o.top)),a.depth=r.treeDepth-2,a.style=r.style;let n=r;for(;n;){if("\\htmlData"===n.command&&n.args&&"string"==typeof n.args[0])for(let e of n.args[0].split(",")){let i=e.match(/([^=]+)=(.+$)/);if(i){let e=i[1].trim().replace(/ /g,"-");e&&(a.data||(a.data={}),a.data[e]=i[2])}else{let i=e.trim().replace(/ /g,"-");i&&(a.data||(a.data={}),a.data[i]=void 0)}}("\\htmlId"===n.command||"\\cssId"===n.command)&&!a.id&&n.args&&"string"==typeof n.args[0]&&(a.id=n.args[0]),n=n.parent}return("math"===r.mode||"text"===r.mode)&&(a.latex=oG.serialize([r],{defaultMode:"math"})),a}var ng,nb=`@keyframes ML__caret-blink {
192
192
  0%,
193
193
  100% {
194
194
  opacity: 1;
@@ -694,7 +694,7 @@ menu .ML__base {
694
694
  opacity: 0.5;
695
695
  margin-left: 2ex;
696
696
  }
697
- `,nb=`.ML__container {
697
+ `,ny=`.ML__container {
698
698
  min-height: auto !important;
699
699
  --_hue: var(--hue, 212);
700
700
  --_placeholder-color: var(--placeholder-color, hsl(var(--_hue), 40%, 49%));
@@ -1061,6 +1061,16 @@ menu .ML__base {
1061
1061
  margin-left: -0.16667em;
1062
1062
  height: 0.71em;
1063
1063
  }
1064
+ .ML__latex .ML__negativemediumspace {
1065
+ display: inline-block;
1066
+ margin-left: -0.22222em;
1067
+ height: 0.71em;
1068
+ }
1069
+ .ML__latex .ML__negativethickspace {
1070
+ display: inline-block;
1071
+ margin-left: -0.27778em;
1072
+ height: 0.71em;
1073
+ }
1064
1074
  .ML__latex .ML__thinspace {
1065
1075
  display: inline-block;
1066
1076
  width: 0.16667em;
@@ -1092,17 +1102,20 @@ menu .ML__base {
1092
1102
  height: 0.71em;
1093
1103
  }
1094
1104
  .ML__latex .ML__llap,
1095
- .ML__latex .ML__rlap {
1105
+ .ML__latex .ML__rlap,
1106
+ .ML__latex .ML__clap {
1096
1107
  width: 0;
1097
1108
  position: relative;
1098
1109
  display: inline-block;
1099
1110
  }
1100
1111
  .ML__latex .ML__llap > .ML__inner,
1101
- .ML__latex .ML__rlap > .ML__inner {
1112
+ .ML__latex .ML__rlap > .ML__inner,
1113
+ .ML__latex .ML__clap > .ML__inner {
1102
1114
  position: absolute;
1103
1115
  }
1104
1116
  .ML__latex .ML__llap > .ML__fix,
1105
- .ML__latex .ML__rlap > .ML__fix {
1117
+ .ML__latex .ML__rlap > .ML__fix,
1118
+ .ML__latex .ML__clap > .ML__fix {
1106
1119
  display: inline-block;
1107
1120
  }
1108
1121
  .ML__latex .ML__llap > .ML__inner {
@@ -1111,6 +1124,10 @@ menu .ML__base {
1111
1124
  .ML__latex .ML__rlap > .ML__inner {
1112
1125
  left: 0;
1113
1126
  }
1127
+ .ML__latex .ML__clap > .ML__inner {
1128
+ left: 50%;
1129
+ transform: translateX(-50%);
1130
+ }
1114
1131
  .ML__latex .ML__rule {
1115
1132
  display: inline-block;
1116
1133
  border: solid 0;
@@ -1254,6 +1271,13 @@ menu .ML__base {
1254
1271
  .ML__latex .ML__mtable .ML__arraycolsep {
1255
1272
  display: inline-block;
1256
1273
  }
1274
+ .ML__latex .ML__hline,
1275
+ .ML__latex .ML__hdashline {
1276
+ display: inline-block;
1277
+ width: 100%;
1278
+ box-sizing: border-box;
1279
+ border-color: currentColor;
1280
+ }
1257
1281
  .ML__latex .ML__mtable .col-align-m > .ML__vlist-t {
1258
1282
  text-align: center;
1259
1283
  }
@@ -1344,7 +1368,7 @@ menu .ML__base {
1344
1368
  z-index: -1;
1345
1369
  box-sizing: border-box;
1346
1370
  }
1347
- `,ny=`#mathlive-environment-popover.is-visible {
1371
+ `,nv=`#mathlive-environment-popover.is-visible {
1348
1372
  visibility: visible;
1349
1373
  }
1350
1374
  #mathlive-environment-popover {
@@ -1442,7 +1466,7 @@ menu .ML__base {
1442
1466
  #mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active circle {
1443
1467
  fill: var(--_accent-color);
1444
1468
  }
1445
- `,nv=`/* Refined Subtle Design Tokens - \u4F4E\u8ABF (Low-key, Understated) with 3D Depth */
1469
+ `,nx=`/* Refined Subtle Design Tokens - \u4F4E\u8ABF (Low-key, Understated) with 3D Depth */
1446
1470
  #mathlive-suggestion-popover {
1447
1471
  --_suggestion-zindex: var(--suggestion-zindex, 100);
1448
1472
  background: #0f0f0f;
@@ -1701,7 +1725,7 @@ menu .ML__base {
1701
1725
  /* Subtle pressed keycap effect */
1702
1726
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);
1703
1727
  }
1704
- `,nx=`/* The element that displays the keys as the user type them */
1728
+ `,n_=`/* The element that displays the keys as the user type them */
1705
1729
  #mathlive-keystroke-caption-panel {
1706
1730
  visibility: hidden;
1707
1731
  /*min-width: 160px;*/
@@ -1747,7 +1771,7 @@ body[theme='dark'] #mathlive-keystroke-caption-panel {
1747
1771
  border: 2px solid var(--keystroke-border);
1748
1772
  /*box-shadow: 0 7px 14px rgba(0,0,0,0.25), 0 5px 5px rgba(0,0,0,0.22);*/
1749
1773
  }
1750
- `,n_=`.ML__keyboard {
1774
+ `,nw=`.ML__keyboard {
1751
1775
  --_keyboard-height: 0;
1752
1776
  --_keyboard-zindex: var(--keyboard-zindex, 105);
1753
1777
  --_accent-color: var(--keyboard-accent-color, #0c75d8);
@@ -2696,7 +2720,7 @@ Note there are a different set of tooltip rules for the keyboard toggle
2696
2720
  --_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));
2697
2721
  --_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));
2698
2722
  }
2699
- `,nw=`:host {
2723
+ `,nk=`:host {
2700
2724
  --primary-color: #5898ff;
2701
2725
  --primary-color-dimmed: #c0c0f0;
2702
2726
  --primary-color-dark: var(--blue-500);
@@ -3018,7 +3042,7 @@ Note there are a different set of tooltip rules for the keyboard toggle
3018
3042
  --ui-line-height: auto;
3019
3043
  --ui-letter-spacing: 0;
3020
3044
  }
3021
- `,nk=`.ui-menu *,
3045
+ `,nM=`.ui-menu *,
3022
3046
  .ui-menu ::before,
3023
3047
  .ui-menu ::after {
3024
3048
  box-sizing: border-box;
@@ -3188,7 +3212,9 @@ Note there are a different set of tooltip rules for the keyboard toggle
3188
3212
  width: 16px;
3189
3213
  height: 16px;
3190
3214
  }
3191
- `;function nM(e){let i="";switch(e){case"mathfield-element":i=`
3215
+ `,nS=null;function nL(e,i){return nS&&"mathfield-element"!==e?`@scope (${nS}) {
3216
+ ${i}
3217
+ }`:i}function nC(e){let i="";switch(e){case"mathfield-element":i=`
3192
3218
  :host { display: inline-block; background-color: field; color: fieldtext; border-width: 1px; border-style: solid; border-color: #acacac; border-radius: 2px;}
3193
3219
  :host([hidden]) { display: none; }
3194
3220
  :host([disabled]), :host([disabled]:focus), :host([disabled]:focus-within) { outline: none; opacity: .5; }
@@ -3199,8 +3225,8 @@ Note there are a different set of tooltip rules for the keyboard toggle
3199
3225
  :host([readonly]:focus), :host([readonly]:focus-within),
3200
3226
  :host([read-only]:focus), :host([read-only]:focus-within) {
3201
3227
  outline: none;
3202
- }`;break;case"core":i=nb;break;case"mathfield":i=ng;break;case"environment-popover":i=ny;break;case"suggestion-popover":i=nv;break;case"keystroke-caption":i=nx;break;case"virtual-keyboard":i=n_;break;case"ui":i=nw;break;case"menu":i=nk}return i}function nS(e){return sv||(sv={}),sv[e]||(sv[e]=new CSSStyleSheet,sv[e].replaceSync(nM(e))),sv[e]}function nL(e){var i;try{if(!("adoptedStyleSheets"in document)){if(window.document.getElementById(`mathlive-style-${e}`))return;let i=window.document.createElement("style");i.id=`mathlive-style-${e}`,i.append(window.document.createTextNode(nM(e))),window.document.head.appendChild(i);return}if(sx||(sx={}),(null!=(i=sx[e])?i:0)!==0)sx[e]+=1;else{let i=nS(e);document.adoptedStyleSheets=[...document.adoptedStyleSheets,i],sx[e]=1}}catch(i){console.error("Error injecting stylesheet",e,i)}}function nC(e){if("adoptedStyleSheets"in document&&null!=sx&&sx[e]&&(sx[e]-=1,sx[e]<=0)){let i=sv[e];document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==i)}}var nE=class e extends oG{constructor(e){var i;super(g(f({},e),{type:"accent",body:null!=(i=e.body)?i:void 0})),e.accentChar?this.accent=e.accentChar:this.svgAccent=null==e?void 0:e.svgAccent,this.skipBoundary=!0,this.captureSelection=!0}static fromJson(i){return new e(i)}toJson(){return g(f({},super.toJson()),{accentChar:this.accent,svgAccent:this.svgAccent})}render(e){var i;let r=new oW({parent:e,mathstyle:"cramp"},this.style),a=null!=(i=oG.createBox(r,this.body))?i:new oE("□",{style:this.style}),o=0;!this.hasEmptyBranch("body")&&2===this.body.length&&this.body[1].isCharacterBox()&&(o=a.skew);let n=Math.min(a.height,.431),l;if(this.svgAccent)l=oT(this.svgAccent),n=r.metrics.bigOpSpacing1-n;else if(this.accent){let e=new oE(this.accent,{fontFamily:"Main-Regular"});e.italic=0,l=new oE(e,{classes:"ML__accent-body"+(8407===this.accent||8411===this.accent||8412===this.accent?" ML__accent-combining-char":"")})}let s=(a.width-l.width)/2+a.left+2*o;l=new oB({shift:0,children:[{box:new oE(a)},-n,{box:l,marginLeft:s,classes:["ML__center"]}]});let c=new oE(l,{type:"ord"});return this.caret&&(c.caret=this.caret),this.bind(r,c.wrap(r)),this.attachSupsub(r,{base:c})}},nA={"(":")","{":"}","[":"]","|":"|","\\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"},nz=Object.fromEntries(Object.entries(nA).map(([e,i])=>[i,e]));function nT(e){var i;return null!=(i=({"[":91,"]":93,"(":40,")":41,"\\mid":8739,"|":8739,"∣":8739,"∥":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})[e])?i:e.codePointAt(0)}function nD(e,i,r,a,o){var n,l;let s=new oW({parent:a,mathstyle:"textstyle"},null==o?void 0:o.style),c=new oE(nT(e),{fontFamily:`Size${i}-Regular`,isSelected:o.isSelected,classes:(null!=(n=o.classes)?n:"")+` ML__delim-size${i}`,type:null!=(l=o.type)?l:"ignore"}).wrap(s);return r&&c.setTop((1-s.scalingFactor)*.25),c}function nK(e,i,r,a,o){var n;let l,s,c,d;l=c=d=nT(e),s=null;let u="Size1-Regular";"\\vert"===e||"\\lvert"===e||"\\rvert"===e||"\\mvert"===e||"\\mid"===e?c=l=d=8739:"\\Vert"===e||"\\lVert"===e||"\\rVert"===e||"\\mVert"===e||"\\|"===e?c=l=d=8741:"\\uparrow"===e?c=d=9168:"\\Uparrow"===e?c=d=8214:"\\downarrow"===e?l=c=9168:"\\Downarrow"===e?l=c=8214:"\\updownarrow"===e?(l=8593,c=9168,d=8595):"\\Updownarrow"===e?(l=8657,c=8214,d=8659):"["===e||"\\lbrack"===e?(l=9121,c=9122,d=9123,u="Size4-Regular"):"]"===e||"\\rbrack"===e?(l=9124,c=9125,d=9126,u="Size4-Regular"):"\\lfloor"===e||"⌊"===e?(c=l=9122,d=9123,u="Size4-Regular"):"\\lceil"===e||"⌈"===e?(l=9121,c=d=9122,u="Size4-Regular"):"\\rfloor"===e||"⌋"===e?(c=l=9125,d=9126,u="Size4-Regular"):"\\rceil"===e||"⌉"===e?(l=9124,c=d=9125,u="Size4-Regular"):"("===e||"\\lparen"===e?(l=9115,c=9116,d=9117,u="Size4-Regular"):")"===e||"\\rparen"===e?(l=9118,c=9119,d=9120,u="Size4-Regular"):"\\{"===e||"\\lbrace"===e?(l=9127,s=9128,d=9129,c=9130,u="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(l=9131,s=9132,d=9133,c=9130,u="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(l=9127,d=9129,c=9130,u="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(l=9131,d=9133,c=9130,u="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(l=9127,d=9133,c=9130,u="Size4-Regular"):"\\rmoustache"===e||"⎱"===e?(l=9131,d=9129,c=9130,u="Size4-Regular"):"\\surd"===e?(l=57345,d=9143,c=57344,u="Size4-Regular"):"\\ulcorner"===e?(l=9484,c=d=32):"\\urcorner"===e?(l=9488,c=d=32):"\\llcorner"===e?(d=9492,c=l=32):"\\lrcorner"===e&&(l=9496,c=l=32);let h=oa(l,u),p=h.height+h.depth,m=oa(c,u),b=m.height+m.depth,y=oa(d,u),v=y.height+y.depth,x=0,_=1;if(null!==s){let e=oa(s,u);x=e.height+e.depth,_=2}let w=p+v+x,k=Math.max(0,Math.ceil((i-w)/(_*b))),M=w+k*_*b,S=.25;r&&(S*=a.scalingFactor);let L=M/2-S,C=[];C.push({box:new oE(d,{fontFamily:u})}),C.push(-.008);let E=new oE(c,{fontFamily:u});if(null===s)for(let e=0;e<k;e++)C.push({box:E});else{for(let e=0;e<k;e++)C.push({box:E});C.push(-.008),C.push({box:new oE(s,{fontFamily:u})}),C.push(-.008);for(let e=0;e<k;e++)C.push({box:E})}C.push(-.008),C.push({box:new oE(l,{fontFamily:u})});let A="";return"Size1-Regular"===u?A=" delim-size1":"Size4-Regular"===u&&(A=" delim-size4"),new oE(new oB({bottom:L,children:C},{classes:A}),g(f({},null!=o?o:{}),{classes:(null!=(n=null==o?void 0:o.classes)?n:"")+" ML__delim-mult"}))}var nB=new Set(["(",")","\\lparen","\\rparen","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","\\surd","⌊","⌋","⌈","⌉"]),n$=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\mvert","\\mid","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","⟮","⟯","⎰","⎱"]),nP=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),nO=[0,1.2,1.8,2.4,3],nI=[{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}],nR=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"stack"}],nN=[{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 nq(e,i,r,a,o,n){var l,s,c;let d,u;if(!i||0===i.length||"."===i)return nV(o);"<"===i||"\\lt"===i?i="\\langle":(">"===i||"\\gt"===i)&&(i="\\rangle"),d=nP.has(i)?nI:nB.has(i)?nN:nR;let h=function(e,i,r,a){let o={"-4":0,"-3":1,0:2}[a.mathstyle.sizeDelta];for(let l=o;l<r.length&&"stack"!==r[l].type;l++){var n;let o=oa(e,"small"===(n=r[l]).type?"Main-Regular":"large"===n.type?"Size"+n.size+"-Regular":(n.type,"Size4-Regular"));if(o.defaultMetrics)return{type:"small",mathstyle:"scriptstyle"};let s=o.height+o.depth;if("small"===r[l].type&&("scriptscriptstyle"===r[l].mathstyle?s*=Math.max(oi[Math.max(1,a.size-2)],a.minFontScale):"scriptstyle"===r[l].mathstyle&&(s*=Math.max(oi[Math.max(1,a.size-1)],a.minFontScale))),s>i)return r[l]}return r[r.length-1]}(nT(i),r,d,o),p=new oW({parent:o,mathstyle:h.mathstyle},null==n?void 0:n.style);return"small"===h.type?(l=i,s=g(f({},n),{type:e}),u=new oE(nT(l),{fontFamily:"Main-Regular",isSelected:s.isSelected,classes:"ML__small-delim "+(null!=(c=s.classes)?c:"")}).wrap(p),a&&u.setTop((1-p.scalingFactor)*.25),u):"large"===h.type?nD(i,h.size,a,p,g(f({},n),{type:e})):(h.type,nK(i,r,a,p,g(f({},n),{type:e})))}function nF(e,i,r,a,o,n){if("."===i)return nV(o,null==n?void 0:n.classes);let l=.25*o.scalingFactor,s=Math.max(r-l,a+l);return nq(e,i,Math.max(s/500*901,2*s-.5),!0,o,n)}function nV(e,i){let r=new oE(null,{classes:" ML__nulldelimiter "+(null!=i?i:""),type:"ignore"});return r.width=e.getRegisterAsEm("nulldelimiterspace"),r.wrap(new oW({parent:e,mathstyle:"textstyle"}))}var nj=class e extends oG{constructor(e){var i;super({type:"placeholder",command:"\\placeholder",mode:null!=(i=null==e?void 0:e.mode)?i:"math",style:null==e?void 0:e.style}),this.captureSelection=!0}static fromJson(i){return new e(i)}toJson(){return super.toJson()}render(e){let i;return this.value=e.placeholderSymbol,i="function"==typeof e.renderPlaceholder?e.renderPlaceholder(e):this.createBox(e),this.caret&&(i.classes+=" ML__placeholder-selected"),i}_serialize(e){return e.skipPlaceholders?"":"\\placeholder{}"}},nH=["matrix","matrix*","pmatrix","pmatrix*","bmatrix","bmatrix*","Bmatrix","Bmatrix*","vmatrix","vmatrix*","Vmatrix","Vmatrix*"],nW=["cases","dcases","rcases"],nU=["align","align*","aligned","gather","gather*","gathered","split"],nJ=["array","subequations","eqnarray"];function nX(e){return nH.includes(e)}var nG=class e extends oG{get isMultiline(){return["lines","multline","multline*","align","split","gather","gathered"].includes(this.environmentName)}constructor(e,i,r,a={}){var o,n,l,s;if(super({type:"array",isRoot:a.isRoot}),this.environmentName=e,a.columns)0===a.columns.length?this.colFormat=[{align:"l"}]:this.colFormat=[...a.columns];else if(a.minColumns){let e=[];for(let i=0;i<a.minColumns;i++)e.push({align:"l"});this.colFormat=e}else this.colFormat=[{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"}];this.minColumns=null!=(o=a.minColumns)?o:1,this.minRows=null!=(n=a.minRows)?n:1,this.maxRows=null!=(l=a.maxRows)?l:1/0,this._rows=function(e,i,r){var a,o,n;let l=0;for(let e of r.columns)"align"in e&&(l+=1);l=Math.max(l,r.minColumns);let s=0,c=[];for(let n of i){s=Math.max(s,Math.min(n.length,l));let i=0;for(;i<n.length;){let s=[],d=Math.min(n.length,i+l);for(;i<d;){s.push((a=n[i],o=e.mode,0===a.length?[new oG({type:"first",mode:o})]:"first"!==a[0].type?[new oG({type:"first",mode:o}),...a]:(a.slice(1).some(e=>"first"===e.type),a))),i+=1}if(s.length<r.minColumns)for(;s.length<r.minColumns;)s.push([new oG({type:"first",mode:e.mode})]);c.push(s)}}!e.isMultiline&&c.length>0&&1===c[c.length-1].length&&1===(n=c[c.length-1][0]).length&&"first"===n[0].type&&c.pop();let d=[];for(let i of c){if(i.length!==s)for(let r=i.length;r<s;r++)e.isMultiline?i.push([new oG({type:"first",mode:e.mode})]):i.push([new oG({type:"first",mode:e.mode}),new nj]);d.push(i)}let u=0,h=0;for(let i of d){for(let r of(h=0,i)){for(let i of r)i.parent=e,i.parentBranch=[u,h];h+=1}u+=1}return e.isDirty=!0,d}(this,i,{columns:this.colFormat,minColumns:this.minColumns,minRows:this.minRows,maxRows:this.maxRows}),this.rowGaps=r,void 0!==a.arraycolsep&&(this.arraycolsep=a.arraycolsep),this.colSeparationType=a.colSeparationType,void 0!==a.arraystretch&&(this.arraystretch=a.arraystretch),a.mathstyleName&&(this.mathstyleName=a.mathstyleName),a.leftDelim&&(this.leftDelim=a.leftDelim),a.rightDelim&&(this.rightDelim=a.rightDelim),this.classes=null!=(s=a.classes)?s:[]}static fromJson(i){return new e(i.environmentName,i.array,i.rowGaps,i)}toJson(){let e=g(f({},super.toJson()),{environmentName:this.environmentName,array:this._rows.map(e=>e.map(e=>e.map(e=>e.toJson()))),rowGaps:this.rowGaps,columns:this.colFormat,colSeparationType:this.colSeparationType,minColumns:this.minColumns,minRows:this.minRows,maxRows:this.maxRows});return void 0!==this.arraystretch&&(e.arraystretch=this.arraystretch),void 0!==this.arraycolsep&&(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 i;if(oX(e))return null!=(i=this._rows[e[0]][e[1]])?i:void 0}createBranch(e){var i;return oX(e)?(this.isDirty=!0,null!=(i=this.branch(e))?i:[]):[]}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(oJ(e))return super.removeBranch(e);let[i,...r]=this.branch(e);return i.type,this._rows[e[0]][e[1]]=void 0,r.forEach(e=>{e.parent=void 0,e.parentBranch=void 0}),this.isDirty=!0,r}get hasChildren(){return this.children.length>0}get children(){let e=[];for(let i of this._rows)for(let r of i)if(r)for(let i of r)e.push(...i.children),e.push(i);return[...e,...super.children]}render(e){var i,r,a,o,n,l,s;let c=new oW({parent:e,mathstyle:this.mathstyleName},this.style),d=c.getRegisterAsEm("arrayrulewidth"),u=c.getRegisterAsEm("arraycolsep"),h=c.getRegisterAsEm("doublerulesep"),p=null!=(r=null!=(i=this.arraystretch)?i:c.getRegisterAsNumber("arraystretch"))?r:1,m="number"==typeof this.arraycolsep?this.arraycolsep:u;"small"===this.colSeparationType&&(m=.2778*(new oW({parent:e,mathstyle:"scriptstyle"}).scalingFactor/e.scalingFactor));let f=1.2*p,g=.7*f,b=.3*f,y=0,v=[],x=0,_=this._rows.length;for(let e=0;e<_;++e){let i=this._rows[e];x=Math.max(x,i.length);let r=new oW({parent:c,mathstyle:this.mathstyleName},this.style),n=g/r.scalingFactor,l=b/r.scalingFactor,d={cells:[],height:0,depth:0,pos:0};for(let e of i){let i=this.isMultiline&&e&&(s=e).length>0&&s.every(e=>"first"===e.type)?function(e,i,r){let a=new oE(null,{classes:"ML__empty-line-anchor"}),o=e[0];o&&(o.id||(o.id=i.makeID()),a.atomID=o.id),a.setStyle("display","inline-block"),a.setStyle("width",0),a.setStyle("position","relative"),a.setStyle("height",Math.max(0,r.height+r.depth),"em"),a.setStyle("vertical-align",-r.depth,"em"),a.height=r.height,a.depth=r.depth;let n=e.find(e=>e.caret);return null!=n&&n.caret&&(a.caret=n.caret),e.some(e=>e.isSelected)&&a.selected(!0),a}(e,r,{height:g/r.scalingFactor,depth:b/r.scalingFactor}):null!=(a=oG.createBox(r,e,{type:"ignore"}))?a:new oE(null,{type:"ignore"});l=Math.max(l,i.depth),n=Math.max(n,i.height),d.cells.push(i)}let u=null!=(o=oN(this.rowGaps[e]))?o:0;u>0&&(u+=b,l=Math.max(l,u),u=0),e<_-1&&!nX(this.environmentName)&&"cases"!==this.environmentName&&"array"!==this.environmentName&&(l+=c.getRegisterAsEm("jot")),d.height=n,d.depth=l,d.pos=y+=n,y+=l+u,v.push(d)}let w="array"!==this.environmentName||this.isMultiline?y/2+.25:v[0].height,k=[];for(let e=0;e<x;e++){let i=[];for(let r of v){let a=r.cells[e];a&&(a.depth=r.depth,a.height=r.height,i.push({box:a,shift:r.pos-w}))}i.length>0&&k.push(new oB({individualShift:i}))}let M=[],S=!1,L=!1,C=0,E=!this.leftDelim,{colFormat:A}=this;for(let i of A){if("align"in i&&C>=k.length)break;if("align"in i)S?M.push(nQ(2*m)):(L||E)&&M.push(nQ(m)),M.push(new oE(k[C],{classes:"col-align-"+i.align})),C++,S=!0,L=!1,E=!1;else if("gap"in i){if("number"==typeof i.gap)M.push(nQ(i.gap));else{let r=function(e,i,r,a){if(!a)return null;let o=[];for(let n of i){let i=oG.createBox(e,a,{type:"ignore"});i&&(i.depth=n.depth,i.height=n.height,o.push({box:i,shift:n.pos-r}))}return new oB({individualShift:o}).wrap(e)}(e,v,w,i.gap);r&&M.push(r)}S=!1,L=!1,E=!1}else if("separator"in i){let e=new oE(null,{classes:"ML__vertical-separator"});e.height=y,e.setStyle("height",y,"em"),e.setStyle("border-right",`${d}em ${i.separator} currentColor`),e.setStyle("vertical-align",-(y-w),"em");let r=0;L?r=h-d:S&&(r=m-d),e.left=r,M.push(e),S=!1,L=!0,E=!1}}S&&!this.rightDelim&&M.push(nQ(m));let z=new oE(M,{classes:["ML__mtable",...this.classes].join(" ")});if("array"!==this.environmentName||this.isMultiline||(z.height=v[0].height,z.depth=y-v[0].height),(!this.leftDelim||"."===this.leftDelim)&&(!this.rightDelim||"."===this.rightDelim))return this.caret&&(z.caret=this.caret),this.bind(e,z);let T=z.height,D=z.depth,K=this.bind(e,new oE([this.bind(e,nF("open",null!=(n=this.leftDelim)?n:".",T,D,c,{isSelected:this.isSelected})),z,this.bind(e,nF("close",null!=(l=this.rightDelim)?l:".",T,D,c,{isSelected:this.isSelected}))],{type:"ord"}));return K?(K.setStyle("display","inline-block"),this.caret&&(K.caret=this.caret),this.bind(e,this.attachSupsub(e,{base:K}))):null}_serialize(e){var i;let r=[];if("lines"===this.environmentName&&this._rows.length>1?r.push("\\displaylines{"):"lines"!==this.environmentName&&r.push(`\\begin{${this.environmentName}}`),"array"===this.environmentName){if(r.push("{"),void 0!==this.colFormat)for(let e of this.colFormat)"align"in e&&"string"==typeof e.align?r.push(e.align):"separator"in e&&"solid"===e.separator?r.push("|"):"separator"in e&&"dashed"===e.separator&&r.push(":");r.push("}")}for(let a=0;a<this._rows.length;a++){for(let i=0;i<this._rows[a].length;i++)i>0&&r.push(" & "),r.push(oG.serialize(this._rows[a][i],e));if(a<this._rows.length-1){let e=this.rowGaps[a];null!=e&&e.dimension?r.push(`\\\\[${e.dimension} ${null!=(i=e.unit)?i:"pt"}] `):r.push("\\\\ ")}}return"lines"===this.environmentName&&this._rows.length>1?r.push("}"):"lines"!==this.environmentName&&r.push(`\\end{${this.environmentName}}`),of(r)}forEachCell(e){for(let i=0;i<this.rowCount;i++)for(let r=0;r<this.colCount;r++)e(this._rows[i][r],i,r)}getCell(e,i){var r;return null==(r=this._rows[e])?void 0:r[i]}setCell(e,i,r){for(let r of("array"===this.type&&Array.isArray(this._rows)&&this._rows[e][i],this._rows[e][i]))r.parent=void 0,r.parentBranch=void 0;let a=[new oG({type:"first",mode:this.mode}),...r.filter(e=>"first"!==e.type)];this._rows[e][i]=a,nY(this),this.isDirty=!0}addRowBefore(e){"array"===this.type&&Array.isArray(this._rows),this._rows.splice(e,0,Array.from({length:this.colCount},()=>nZ(this,!this.isMultiline))),nY(this),this.isDirty=!0}addRowAfter(e){"array"===this.type&&Array.isArray(this._rows),this._rows.splice(e+1,0,Array.from({length:this.colCount},()=>nZ(this,!this.isMultiline))),nY(this),this.isDirty=!0}removeRow(e){for(let i of("array"===this.type&&Array.isArray(this._rows)&&this.rowCount,this._rows.splice(e,1)))for(let e of i)if(e)for(let i of e)i.parent=void 0,i.parentBranch=void 0;nY(this),this.isDirty=!0}addColumnBefore(e){for(let i of("array"===this.type&&Array.isArray(this._rows),this._rows))i.splice(e,0,nZ(this));nY(this),this.isDirty=!0}addColumnAfter(e){for(let i of("array"===this.type&&Array.isArray(this._rows),this._rows))i.splice(e+1,0,nZ(this));nY(this),this.isDirty=!0}addColumn(){this.addColumnAfter(this.colCount-1)}removeColumn(e){for(let i of("array"===this.type&&Array.isArray(this._rows)&&this.colCount,this._rows))for(let r of i.splice(e,1))if(r)for(let e of r)e.parent=void 0,e.parentBranch=void 0;nY(this),this.isDirty=!0}get cells(){let e=[];for(let i of this._rows)for(let r of i)r&&e.push(r.filter(e=>"first"!==e.type));return e}get rows(){return this._rows}};function nZ(e,i=!1){let r=new oG({type:"first",mode:e.mode});r.parent=e;let a=[r];if(i){let i=new nj;i.parent=e,a.push(i)}return a}function nY(e){for(let i=0;i<e.rowCount;i++)for(let r=0;r<e.colCount;r++){let a=e.getCell(i,r);if(a)for(let o of a)o&&(o.parent=e,o.parentBranch=[i,r])}}function nQ(e){let i=new oE(null,{classes:"ML__arraycolsep"});return i.width=e,i}var n0=class e extends oG{constructor(e){super({mode:e.mode,command:e.command,style:e.style,body:e.body,type:"box"}),this.framecolor=e.framecolor,this.backgroundcolor=e.backgroundcolor,this.padding=e.padding,this.offset=e.offset,this.border=e.border}static fromJson(i){return new e(i)}toJson(){return g(f({},super.toJson()),{framecolor:this.framecolor,backgroundcolor:this.backgroundcolor,padding:this.padding,offset:this.offset,border:this.border})}render(e){var i,r,a,o;let n=oG.createBox(e,this.body,{type:"lift"});if(!n)return null;let l=e.toEm(null!=(i=this.offset)?i:{dimension:0});n.depth+=l,n.setStyle("display","inline-block"),n.setStyle("position","relative"),n.setStyle("height",Math.floor(100*n.height+n.depth)/100,"em"),n.setStyle("vertical-align",-Math.floor(100*n.height)/100,"em");let s=new oW({parent:e},this.style),c=s.toEm(null!=(r=this.padding)?r:{register:"fboxsep"}),d=new oE(null,{classes:"ML__box"});d.height=n.height+c,d.depth=n.depth+c,d.setStyle("box-sizing","border-box"),d.setStyle("position","absolute"),d.setStyle("top",-c+.3,"em"),d.setStyle("left",0),d.setStyle("height",d.height+d.depth,"em"),d.setStyle("width","100%"),this.backgroundcolor&&d.setStyle("background-color",null!=(a=s.toBackgroundColor(this.backgroundcolor))?a:"transparent"),this.framecolor&&d.setStyle("border",`${s.getRegisterAsEm("fboxrule",2)}em solid ${null!=(o=s.toColor(this.framecolor))?o:"black"}`),this.border&&d.setStyle("border",this.border);let u=new oE([d,n],{type:"lift"});return u.setStyle("display","inline-block"),u.setStyle("position","relative"),u.setStyle("line-height",0),u.height=n.height+c+(l>0?l:0),u.depth=n.depth+c+(l<0?-l:0),u.setStyle("padding-left",c,"em"),u.setStyle("padding-right",c,"em"),u.setStyle("height",Math.floor(100*(n.height+n.depth+2*c+Math.abs(l)))/100,"em"),u.setStyle("margin-top",-c,"em"),u.setStyle("top",Math.floor(100*(n.depth-n.height+2*c-l))/100,"em"),u.setStyle("vertical-align",Math.floor(100*(n.depth+2*c))/100,"em"),this.caret&&(u.caret=this.caret),this.attachSupsub(e,{base:u})}_serialize(e){return e.skipStyles?of([this.bodyToLatex(e),this.supsubToLatex(e)]):super._serialize(e)}},n1=class e extends oG{constructor(e,i){var r;super({type:"composition",mode:null!=(r=null==i?void 0:i.mode)?r:"math",value:e})}static fromJson(i){return new e(i.value,i)}toJson(){return super.toJson()}render(e){let i=new oE(this.value,{classes:"ML__composition",type:"composition"});return this.bind(e,i),this.caret&&(i.caret=this.caret),i}_serialize(e){return""}},n4=class e extends oG{constructor(e){super({type:"error",value:e,command:e,mode:"math"}),this.verbatimLatex=e}static fromJson(i){return new e(i.command)}toJson(){return super.toJson()}render(e){let i=this.createBox(e,{classes:"ML__error"});return this.caret&&(i.caret=this.caret),i}},n2=class e extends oG{constructor(e,i){super({type:"group",mode:i}),this.body=e,this.boxType=e.length>1?"ord":"ignore",this.skipBoundary=!0,this.displayContainsHighlight=!1,(null==e?void 0:e.length)===1&&","===e[0].command&&(this.captureSelection=!0)}static fromJson(i){return new e(i.body,i.mode)}render(e){let i=oG.createBox(e,this.body,{type:this.boxType});return i?(this.caret&&(i.caret=this.caret),this.bind(e,i)):null}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);return null!=i&&i.serialize?i.serialize(this,e):`{${this.bodyToLatex(e)}}`}},n3=class e extends oG{constructor(e,i,r){super({type:"leftright",style:r.style,displayContainsHighlight:!0}),this.variant=e,this.body=i,this.leftDelim=r.leftDelim,this.rightDelim=r.rightDelim}static fromJson(i){var r;return new e(null!=(r=i.variant)?r:"",i.body,i)}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,r;let a=this.matchingRightDelim();return"left...right"===this.variant?of(["\\left",null!=(i=this.leftDelim)?i:".",this.bodyToLatex(e),"\\right",a]):"mleft...mright"===this.variant?of(["\\mleft",null!=(r=this.leftDelim)?r:".",this.bodyToLatex(e),"\\mright",a]):of([this.leftDelim&&"."!==this.leftDelim?this.leftDelim:"",this.bodyToLatex(e),a])}matchingRightDelim(){var e,i;if(this.rightDelim&&"?"!==this.rightDelim)return this.rightDelim;let r=null!=(e=this.leftDelim)?e:".";return null!=(i=nA[r])?i:r}render(e){var i,r;let a=new oW({parent:e},this.style);this.body;let o=new oW({parent:e,mathstyle:"textstyle"},this.style),n=null!=(i=oG.createBox(a,this.body,{type:"inner"}))?i:new oE(null,{type:"inner"}),l=n.height/o.scalingFactor,s=n.depth/o.scalingFactor,c=[];if(this.leftDelim&&c.push(this.bind(o,nF("open",this.leftDelim,l,s,o,{isSelected:this.isSelected,classes:"ML__open"+(this.containsCaret?" ML__contains-caret":""),mode:this.mode,style:this.style}))),n&&(function e(i,r,a,o,n){if(i)for(let l=0;l<i.length;l++){let s=i[l];"middle"===s.type?(i[l]=r.bind(a,nF("inner",s.value,o,n,a,{isSelected:r.isSelected})),i[l].caret=s.caret,i[l].isSelected=s.isSelected,i[l].cssId=s.cssId,i[l].htmlData=s.htmlData,i[l].htmlStyle=s.htmlStyle,i[l].attributes=s.attributes,i[l].cssProperties=s.cssProperties):s.children&&e(s.children,r,a,o,n)}}(n.children,this,a,l,s),c.push(n)),this.rightDelim){let e=this.containsCaret?" ML__contains-caret":"",i=this.rightDelim;"?"===i&&(a.smartFence?(i=this.matchingRightDelim(),e+=" ML__smart-fence__close"):i="."),c.push(this.bind(o,nF("close",i,l,s,o,{isSelected:this.isSelected,classes:e+" ML__close",mode:this.mode,style:this.style})))}let d="mleft...mright"===this.variant,u=this.leftSibling;u&&(!d&&u.isFunction&&(d=!0),!d&&"subsup"===u.type&&null!=(r=u.leftSibling)&&r.isFunction&&(d=!0));let h=new oE(c,{type:d?"close":"inner",classes:"ML__left-right"});return h.setStyle("margin-top",`${-n.depth}em`),h.setStyle("height",`${n.height+n.depth}em`),this.caret&&(h.caret=this.caret),this.bind(a,h.wrap(a))}},n6=class e extends oG{constructor(e,i){var r;super({type:"macro",command:e,style:i.style}),this.body=i.body,void 0===i.captureSelection?i.args?this.captureSelection=!1:this.captureSelection=!0:this.captureSelection=i.captureSelection,this.macroArgs=i.args,this.expand=null!=(r=i.expand)&&r}static fromJson(i){return new e(i.command,i)}toJson(){let e=super.toJson();return this.expand&&(e.expand=!0),void 0!==this.captureSelection&&(e.captureSelection=this.captureSelection),this.macroArgs&&(e.args=this.macroArgs),e}_serialize(e){var i;return e.expandMacro&&this.expand?this.bodyToLatex(e):this.command+(null!=(i=this.macroArgs)?i:"")}applyStyle(e,i){let r={};e.color&&(r.color=e.color),e.backgroundColor&&(r.backgroundColor=e.backgroundColor),super.applyStyle(r,i)}render(e){let i=oG.createBox(e,this.body,{type:"lift"});return i?(this.caret&&(i.caret=this.caret),this.bind(e,i)):null}},n8=class e extends oG{constructor(){super({type:"macro-argument"})}static fromJson(i){return new e}toJson(){return super.toJson()}_serialize(e){return""}render(e){return null}},n5=class e extends oG{constructor(e,i,r=!1,a,o){var n;super({type:"prompt",mode:null!=(n=null==o?void 0:o.mode)?n:"math",style:null==o?void 0:o.style,command:"\\placeholder"}),this.body=a,this.correctness=i,this.placeholderId=e,this.locked=r,this.captureSelection=this.locked}static fromJson(i){return new e(i.placeholderId,i.correctness,i.locked,i.body,i)}toJson(){let e=super.toJson();return this.placeholderId&&(e.placeholderId=this.placeholderId),this.body||delete e.body,this.body&&(e.body=this.body.filter(e=>"first"!==e.type).map(e=>e.toJson())),this.correctness&&(e.correctness=this.correctness),e.locked=this.locked,e}render(e){var i,r,a,o,n;let l=new oW({parent:e}),s=l.getRegisterAsEm("fboxsep"),c=oG.createBox(e,this.body);if(!c)return null;let d=!this.body||0===this.body.length||this.body.every(e=>"first"===e.type)?new nj({mode:this.mode,style:this.style}).render(new oW({parent:e,isPhantom:!0})):null,u=null!=(i=null==d?void 0:d.height)?i:l.metrics.xHeight,h=null!=(r=null==d?void 0:d.depth)?r:u/2,p=Math.max(null!=(a=c.height)?a:0,u),m=Math.max(null!=(o=c.depth)?o:0,h);c.setStyle("vertical-align",`calc(-${p}em + 2px)`),"correct"===this.correctness?c.setStyle("color","var(--correct-color, var(--ML__correct-color))"):"incorrect"===this.correctness&&c.setStyle("color","var(--incorrect-color, var(--ML__incorrect-color))");let f=p+m+2*s-2*s,g=new oE(c,{type:"ord"});g.setStyle("display","inline-block"),g.height=p,g.depth=m,g.setStyle("height",p+m,"em"),g.setStyle("vertical-align",-s,"em"),(null!=(n=c.width)?n:0)<f&&(g.width=f,g.setStyle("width",f,"em"));let b="ML__prompt ";this.locked?b+=" ML__lockedPromptBox ":b+=" ML__editablePromptBox ","correct"===this.correctness?b+=" ML__correctPromptBox ":"incorrect"===this.correctness&&(b+=" ML__incorrectPromptBox "),this.containsCaret&&(b+=" ML__focusedPromptBox ");let y=new oE(null,{classes:b,attributes:{part:"prompt"}});y.height=g.height+s,y.depth=g.depth+s,y.width=g.width+2*s,y.setStyle("position","absolute"),y.setStyle("height",g.height+g.depth+2*s,"em"),0===s&&y.setStyle("width","100%"),0!==s&&(y.setStyle("width",`calc(100% + ${2*s}em)`),y.setStyle("top",s,"em"),y.setStyle("left",-s,"em"));let v="";"incorrect"===this.correctness&&(v+='<line x1="3%" y1="97%" x2="97%" y2="3%" stroke-width="0.5" stroke="var(--incorrect-color, var(--ML__incorrect-color))" stroke-linecap="round" />'),v&&(y.svgOverlay=v);let x=new oE([y,g],{classes:"ML__prompt-atom"});g.setStyle("line-height",1),x.setStyle("position","relative"),x.setStyle("display","inline-block"),x.setStyle("line-height",0),x.height=p+s+.2,x.depth=m+s,x.left=s,x.right=s,x.setStyle("height",p+2*s,"em"),x.setStyle("top",m-p-s/2,"em"),x.setStyle("vertical-align",g.depth,"em"),x.setStyle("margin-left",.5,"em"),x.setStyle("margin-right",.5,"em"),this.caret&&(x.caret=this.caret);let _=this.attachSupsub(e,{base:x}),w=this.bind(l,_);return w&&this.id&&(y.atomID=this.id,g.atomID=this.id,x.atomID=this.id),w}_serialize(e){var i;let r=null!=(i=this.bodyToLatex(e))?i:"";if(e.skipPlaceholders)return r;let a="\\placeholder";return this.placeholderId&&(a+=`[${this.placeholderId}]`),"correct"===this.correctness?a+="[correct]":"incorrect"===this.correctness&&(a+="[incorrect]"),this.locked&&(a+="[locked]"),og(a,r)}},n7=class e extends oG{constructor(e){super({type:"subsup",style:null==e?void 0:e.style}),this.subsupPlacement="auto"}get children(){if(!this._children){let e=[],i=this.branch("subscript");if(i)for(let r of i)e.push(...r.children),e.push(r);let r=this.branch("superscript");if(r)for(let i of r)e.push(...i.children),e.push(i);this._children=e}return this._children}static fromJson(i){let r=new e(i);for(let e of oU)i[e]&&r.setChildren(i[e],e);return r}render(e){var i;let r=new oW({parent:e,isPhantom:!0}),a=this.leftSibling,o=null!=(i=a.render(r))?i:new oE(null),n=new oE(null);return n.height=o.height,n.depth=o.depth,this.attachSupsub(e,{base:n,isCharacterBox:a.isCharacterBox(),type:"ignore"})}_serialize(e){return this.supsubToLatex(e)}};function n9(e){return!!e&&!/^(<$$>|<$>|<space>|<{>|<}>|#[0-9\?]|\\.+)$/.test(e)}var le=class{constructor(e,i,r){var a,o,n,l;this.errors=[],this.index=0,this.endCount=0,this.localMacros={},null!=r||(r={}),this.tokens=e,this.context=i instanceof oW&&!(null!=r&&r.parseMode)&&!r.mathstyle?i:new oW({from:i,mathstyle:r.mathstyle},r.style),this.args=null!=(a=r.args)?a:void 0,this.smartFence=this.context.smartFence,this.parsingContext={parent:void 0,mathlist:[],style:null!=(o=r.style)?o:{},parseMode:null!=(n=r.parseMode)?n:"math",mathstyle:null!=(l=r.mathstyle)?l:"displaystyle",tabular:!1}}beginContext(e){var i,r,a,o,n,l;if(null!=e&&e.root){this.parsingContext={parent:this.parsingContext.parent,mathlist:[],style:{},parseMode:null!=(i=null==e?void 0:e.mode)?i:"math",mathstyle:null!=(r=null==e?void 0:e.mathstyle)?r:"displaystyle",tabular:null!=(a=null==e?void 0:e.tabular)&&a};return}let s=this.parsingContext,c={parent:s,mathlist:[],style:f({},s.style),parseMode:null!=(o=null==e?void 0:e.mode)?o:s.parseMode,mathstyle:null!=(n=null==e?void 0:e.mathstyle)?n:s.mathstyle,tabular:null!=(l=null==e?void 0:e.tabular)&&l};this.parsingContext=c}endContext(){this.parsingContext=this.parsingContext.parent}onError(e){this.errors.push(f({before:ob(this.tokens.slice(this.index,this.index+10)),after:ob(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 f({},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.index<this.tokens.length?this.tokens[this.index++]:""}peek(){return this.tokens[this.index]}expandUnicode(){if(!this.peek()||"math"!==this.parseMode)return;let e=function(e){var i;if("{}<>[]$&*#^_%:'˜".includes(e)||e.length>1)return;let r=null!=(i=e.codePointAt(0))?i:0,a=Z[r];if(a)return a;let{char:o,variant:n,style:l}=function(e){var i;if((e<119808||e>120831)&&(e<8448||e>8527))return{char:String.fromCodePoint(e)};for(let r in Y)if(Y[r]===e){e=null!=(i=r.codePointAt(0))?i:0;break}for(let i of Q)if(e>=i.start&&e<i.start+i.len)return{char:String.fromCodePoint(e-i.start+i.offset),variant:i.variant,style:i.style};return{char:String.fromCodePoint(e)}}(r);if(!(!n&&!l)){switch(a=o,n){case"double-struck":a=`\\mathbb{${a}}`;break;case"fraktur":a=`\\mathfrak{${a}}`;break;case"script":a=`\\mathscr{${a}}`;break;case"sans-serif":a=`\\mathsf{${a}}`;break;case"monospace":a=`\\mathtt{${a}}`;break;case"calligraphic":a=`\\mathcal{${a}}`}switch(l){case"bold":a=`\\mathbf{${a}}`;break;case"italic":a=`\\mathit{${a}}`;break;case"bolditalic":a=`\\mathbfit{${a}}`}return a}}(this.peek());e&&this.tokens.splice(this.index,1,...om(e))}match(e){return this.tokens[this.index]===e&&(this.index++,!0)}lastSubsupAtom(){let e;return this.mathlist.length>0&&("subsup"===(e=this.mathlist[this.mathlist.length-1]).type||void 0!==e.subsupPlacement)||(e=new n7({style:this.style}),this.mathlist.push(e)),e}hasPattern(e){return e.test(this.tokens[this.index])}hasInfixCommand(){var e;let{index:i}=this;if(i<this.tokens.length&&this.tokens[i].startsWith("\\")){let r=eM(this.tokens[i],this.parseMode);return!!r&&"symbol"!==r.definitionType&&(!r.ifMode||!!r.ifMode.includes(this.parseMode))&&null!=(e=r.infix)&&e}return!1}matchColumnSeparator(){return!!this.tabularMode&&"&"===this.peek()&&(this.index++,!0)}matchRowSeparator(){if(!this.tabularMode)return!1;let e=this.peek();return("\\\\"===e||"\\cr"===e||"\\tabularnewline"===e)&&(this.index++,!0)}placeholder(){var e;let i=null==(e=this.args)?void 0:e.call(this,"?");return i?lt(i,{parseMode:this.parseMode,mathstyle:"textstyle"}):[new nj({mode:this.parseMode,style:this.style})]}skipWhitespace(){for(;this.match("<space>"););}skipUntilToken(e){let i=this.tokens[this.index];for(;i&&i!==e;)i=this.tokens[++this.index];i===e&&this.index++}skipFiller(){for(;this.match("\\relax")||this.match("<space>"););}matchKeyword(e){let i=this.index,r=this.end(),a="";for(;!r;){let i=this.get();n9(i)?(a+=i,r=this.end()||a.length>=e.length):r=!0}let o=e.toUpperCase()===a.toUpperCase();return o||(this.index=i),o}scanString(){let e="";for(;!this.end();){let i=this.peek();if("]"===i)break;if("<space>"===i)e+=" ";else if(i.startsWith("\\"))this.onError({code:"unexpected-command-in-string"}),e+=i.substring(1);else if(n9(i))e+=i;else break;this.next()}return e}scanBalancedString(){let e="",i=this.end(),r=1;for(;!i;){let a=this.get();"<space>"===a?e+=" ":"<{>"===a?(e+="{",r+=1):"<}>"===a?(r-=1)>0?e+="}":this.index-=1:"<$>"===a?e+="$":"<$$>"===a?e+="$$":e+=a,i=0===r||this.end()}return e}scanLiteralGroup(){var e;if(!this.match("<{>"))return"";let i="",r=1;for(;r>0&&!this.end();){let a=this.get();"<}>"===a?(r-=1)>0&&(i+="}"):"<{>"===a?(r+=1,i+="{"):(/\\[a-zA-Z]+$/.test(i)&&/^[a-zA-Z]/.test(a)&&(i+=" "),i+=null!=(e=({"<space>":" ","<$$>":"$$","<$>":"$"})[a])?e:a)}return i}scanNumber(e=!0){var i,r;let a=!1,o=this.peek();for(;"<space>"===o||"+"===o||"-"===o;)this.get(),"-"===o&&(a=!a),o=this.peek();e=!!e;let n=10,l=/\d/;if(this.match("'"))n=8,l=/[0-7]/,e=!0;else if(this.match('"'))n=16,l=/[\dA-F]/,e=!0;else if(this.match("x"))n=16,l=/[\dA-Fa-f]/,e=!0;else if(this.match("`"))return(o=this.get())?2===o.length&&o.startsWith("\\")?{number:(a?-1:1)*(null!=(i=o.codePointAt(1))?i:0),base:"alpha"}:{number:(a?-1:1)*(null!=(r=o.codePointAt(0))?r:0),base:"alpha"}:null;let s="";for(;this.hasPattern(l);)s+=this.get();if(!e&&(this.match(".")||this.match(",")))for(s+=".";this.hasPattern(l);)s+=this.get();let c=e?Number.parseInt(s,n):Number.parseFloat(s);return Number.isNaN(c)?null:{number:a?-c:c,base:16===n?"hexadecimal":8===n?"octal":"decimal"}}scanRegister(){var e;let i=this.index,r=this.scanNumber(!1);if(this.skipWhitespace(),this.match("\\relax"))return r;let a=!1;if(null===r)for(;;){let e=this.peek();if("-"===e)a=!a;else if("+"!==e)break;this.next(),this.skipWhitespace()}if(this.match("\\global")){this.skipWhitespace();let e=this.get();return e.startsWith("\\")?r?{register:e,global:!0,factor:(a?-1:1)*r.number}:a?{register:e,global:!0,factor:-1}:{register:e,global:!0}:(this.index=i,null)}let o=this.get();return null!=o&&o.startsWith("\\")?(o=o.substring(1),this.context.registers[o]?a&&null===r?{register:o}:{register:o,factor:(a?-1:1)*(null!=(e=null==r?void 0:r.number)?e:1)}:(this.index=i,null)):(this.index=i,null)}scanValue(){let e=this.scanRegister();if(e)return e;let i=this.index,r=this.scanGlueOrDimen();if(r&&("unit"in r||"glue"in r&&"unit"in r.glue))return r;this.index=i;let a=this.scanNumber();if(a)return a;if(this.end()||!n9(this.peek()))return null;let o=this.scanString();return o.length>0?{string:o}:null}scanDimen(){let e,i=this.scanNumber(!1);if(null===i)return null;let r=i.number;return this.skipWhitespace(),this.matchKeyword("true"),this.skipWhitespace(),this.matchKeyword("pt")?e="pt":this.matchKeyword("mm")?e="mm":this.matchKeyword("cm")?e="cm":this.matchKeyword("ex")?e="ex":this.matchKeyword("px")?e="px":this.matchKeyword("em")?e="em":this.matchKeyword("bp")?e="bp":this.matchKeyword("dd")?e="dd":this.matchKeyword("pc")?e="pc":this.matchKeyword("in")?e="in":this.matchKeyword("mu")&&(e="mu"),e?{dimension:r,unit:e}:{dimension:r}}scanGlueOrDimen(){let e=this.scanDimen();if(null===e)return null;if(this.skipWhitespace(),this.match("\\relax"))return e;let i={glue:e};if(this.matchKeyword("plus")){let e=this.scanDimen();if(!e)return i;i.grow=e}if(this.skipWhitespace(),this.match("\\relax"))return i;if(this.skipWhitespace(),this.matchKeyword("minus")){let e=this.scanDimen();if(!e)return i;i.shrink=e}return i.grow||i.shrink?i:e}scanColspec(){this.skipWhitespace();let e=[];for(;!this.end()&&"<}>"!==this.peek()&&"]"!==this.peek();){let i=this.get();"c"===i||"r"===i||"l"===i?e.push({align:i}):"|"===i?e.push({separator:"solid"}):":"===i?e.push({separator:"dashed"}):"@"===i&&(this.match("<{>")&&(this.beginContext({mode:"math"}),e.push({gap:this.scan(e=>"<}>"===e)}),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 i=this.scan(i=>i===("displaystyle"===e?"\\]":"\\)"));return this.match("displaystyle"===e?"\\]":"\\)")||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),i}scanModeShift(){let e="";if(this.match("<$>")&&(e="<$>"),!e&&this.match("<$$>")&&(e="<$$>"),!e)return null;this.beginContext({mode:"math",mathstyle:"<$>"===e?"textstyle":"displaystyle"});let i=this.scan(i=>i===e);return this.match(e)||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),i}scanEnvironment(){var e;if(!this.match("\\begin"))return null;let i=this.scanArgument("string");if(!i)return null;let r=null!=(e=el[i])?e:null;if(!r)return this.onError({code:"unknown-environment",arg:i}),null;let a=[];if(r.params)for(let e of r.params)if(e.isOptional)a.push(this.scanOptionalArgument(e.type));else{let r=this.scanArgument(e.type);r||this.onError({code:"missing-argument",arg:i}),a.push(r)}this.beginContext({tabular:r.tabular,root:r.rootOnly});let o=[],n=[],l=[],s=!1;do if(this.end()&&(this.onError({code:"unbalanced-environment",arg:i}),s=!0),!s&&this.match("\\end")&&(this.scanArgument("string")!==i&&this.onError({code:"unbalanced-environment",arg:i}),s=!0),!s)if(this.matchColumnSeparator())l.push(this.mathlist),this.mathlist=[];else if(this.matchRowSeparator()){l.push(this.mathlist),this.mathlist=[];let e=null;this.skipWhitespace(),this.match("[")&&(e=this.scanDimen(),this.skipWhitespace(),this.match("]")),n.push(null!=e?e:{dimension:0}),o.push(l),l=[]}else this.mathlist.push(...this.scan(e=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline"].includes(e)));while(!s)return l.push(this.mathlist),l.length>0&&o.push(l),this.endContext(),r.rootOnly&&(this.index=this.tokens.length),r.createAtom(i,o,n,a,this.context.maxMatrixCols)}scanExpression(){let e=this.mathlist;if(this.mathlist=[],this.parseExpression()){let i=this.mathlist;return this.mathlist=e,i}return this.mathlist=e,null}scan(e){let i;this.beginContext(),e||(e=e=>"<}>"===e);let r="",a=null,o=[],n=null;for(;!this.end()&&!e(this.peek());)this.hasInfixCommand()&&!r?((a=eM(r=this.get(),"math"))&&(o=this.scanArguments(a)[1]),n=this.mathlist,this.mathlist=[]):this.parseExpression();return r?(o.unshift(this.mathlist),n&&o.unshift(n),i=[a.createAtom({command:r,args:o,style:this.style,mode:this.parseMode})]):i=this.mathlist,this.endContext(),i}scanGroup(){let e=this.index;if(!this.match("<{>"))return null;let i=this.scan(e=>"<}>"===e);if(this.match("<}>")||this.onError({code:"unbalanced-braces"}),1===i.length&&"placeholder"===i[0].type)return i[0];let r=new n2(i,this.parseMode);return r.verbatimLatex=ob(this.tokens.slice(e,this.index)),r}scanSmartFence(){if(this.skipWhitespace(),!this.match("("))return null;this.beginContext();let e=1;for(;!this.end()&&0!==e;)this.match("(")&&(e+=1),this.match(")")&&(e-=1),0!==e&&this.parseExpression();let i=new n3("",this.mathlist,{leftDelim:"(",rightDelim:0===e?")":"?"});return this.endContext(),i}scanDelim(){this.skipWhitespace();let e=this.peek();if(!e)return this.onError({code:"unexpected-end-of-string"}),null;if(!n9(e)&&!e.startsWith("\\"))return null;this.next();let i=eM(e,"math");return i?"function"===i.definitionType&&i.ifMode&&!i.ifMode.includes(this.parseMode)?(this.onError({code:"unexpected-delimiter",arg:e}),null):"symbol"===i.definitionType&&("mopen"===i.type||"mclose"===i.type)||/^(\.|\?|\||<|>|\\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 e;if(this.match("\\right"))return this.onError({code:"unbalanced-braces"}),new n4("\\right");if(this.match("\\mright"))return this.onError({code:"unbalanced-braces"}),new n4("\\mright");let i="\\right";if(!this.match("\\left")){if(!this.match("\\mleft"))return null;i="\\mright"}let r=this.scanDelim();if(!r)return this.onError({code:"unexpected-delimiter"}),new n4("\\right"===i?"\\left":"\\mleft");for(this.beginContext();!this.end()&&!this.match(i);)this.parseExpression();let a=this.mathlist;return this.endContext(),new n3("\\right"===i?"left...right":"mleft...mright",a,{leftDelim:r,rightDelim:null!=(e=this.scanDelim())?e:".",style:this.style})}parseSupSub(){if("math"!==this.parseMode)return!1;let e=this.peek();if("^"!==e&&"_"!==e&&"'"!==e)return!1;let i=this.lastSubsupAtom();for(;"^"===e||"_"===e||"'"===e;)this.match("'")?this.match("'")?i.addChild(new oG({type:"mord",command:"\\doubleprime",mode:"math",value:"′′"}),"superscript"):i.addChild(new oG({type:"mord",command:"\\prime",mode:"math",value:"′"}),"superscript"):(this.match("^")||this.match("_"))&&i.addChildren(et(this.scanArgument("expression")),"_"===e?"subscript":"superscript"),e=this.peek();return!0}parseLimits(){if("math"!==this.parseMode)return!1;let e=this.match("\\limits"),i=!e&&this.match("\\nolimits"),r=!i&&!e&&this.match("\\displaylimits");if(!e&&!i&&!r)return!1;let a=this.mathlist.length>0?this.mathlist[this.mathlist.length-1]:null;return null!==a&&(a.explicitSubsupPlacement=!0,e&&(a.subsupPlacement="over-under"),i&&(a.subsupPlacement="adjacent"),r&&(a.subsupPlacement="auto"),!0)}scanArguments(e){if(!(null!=e&&e.params))return[void 0,[]];let i,r=[],a=2*!!e.infix;for(;a<e.params.length;){let o=e.params[a];"rest"===o.type?r.push(this.scan(e=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(e))):o.isOptional?r.push(this.scanOptionalArgument(o.type)):o.type.endsWith("*")?i=o.type.slice(0,-1):r.push(this.scanArgument(o.type)),a+=1}return[i,r]}scanSymbolOrLiteral(){let e,i=this.peek();if(!i)return null;if(this.next(),n9(i)){let e=ov.createAtom(this.parseMode,i,f({},this.style));return e?[e]:null}if(e=this.scanMacro(i))return[e];if(i.startsWith("\\")){let r=eM(i,this.parseMode);if(!r)return this.onError({code:"unknown-command",arg:i}),[new n4(i)];if("symbol"===r.definitionType){let a=f({},this.style);r.variant&&(a.variant=r.variant),e=new oG({type:r.type,command:i,style:a,value:String.fromCodePoint(r.codepoint),mode:this.parseMode,verbatimLatex:i})}else{if(r.applyMode||r.applyStyle||r.infix)return this.onError({code:"invalid-command",arg:i}),[new n4(i)];r.createAtom&&(e=r.createAtom({command:i,args:[],style:this.style,mode:this.parseMode}))}}return e?[e]:null}scanArgument(e){var i;this.skipFiller();let r=this.parseMode;if("auto"===e&&(e=r),!this.match("<{>")){if("string"===e)return this.scanString();if("value"===e)return this.scanValue();if("delim"===e)return null!=(i=this.scanDelim())?i:".";if("expression"===e)return this.scanExpression();if("math"===e){e!==r&&this.beginContext({mode:"math"});let i=this.scanSymbolOrLiteral();return e!==r&&this.endContext(),i}if("text"===e){e!==r&&this.beginContext({mode:"text"});let i=this.scanSymbolOrLiteral();return e!==r&&this.endContext(),i}return"balanced-string"===e?null:"rest"===e?this.scan(e=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(e)):null}if("text"===e){this.beginContext({mode:"text"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end())let e=this.mathlist;return this.endContext(),{group:e}}if("math"===e){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end())let e=this.mathlist;return this.endContext(),{group:e}}if("rest"===e){let e=this.scan();return this.match("<}>")||this.onError({code:"unbalanced-braces"}),{group:e}}let a=null;if("expression"===e){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end())let e=this.mathlist;return this.endContext(),{group:e}}return"string"===e?a=this.scanString():"balanced-string"===e?a=this.scanBalancedString():"colspec"===e?a=this.scanColspec():"value"===e&&(a=this.scanValue()),this.skipUntilToken("<}>"),a}scanOptionalArgument(e){if(e="auto"===e?this.parseMode:e,this.skipFiller(),!this.match("["))return null;let i=null;for(;!this.end()&&!this.match("]");)if("string"===e)i=this.scanString();else if("value"===e)i=this.scanValue();else if("colspec"===e)i=this.scanColspec();else if("bbox"===e){let e={};for(let i of this.scanString().toLowerCase().trim().split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/)){let r=i.match(/^\s*([\d.]+)\s*([a-z]{2})/);if(r)e.padding={dimension:Number.parseFloat(r[1]),unit:r[2]};else{let r=i.match(/^\s*border\s*:\s*(.*)/);r?e.border=r[1]:e.backgroundcolor={string:i}}}i=e}else"math"===e&&(this.beginContext({mode:"math"}),i=this.mathlist.concat(this.scan(e=>"]"===e)),this.endContext());return i}scanSymbolOrCommand(e){var i,r,a;if("\\placeholder"===e){let e=this.scanOptionalArgument("string"),i=this.scanOptionalArgument("math"),r=oG.serialize(i,{defaultMode:"math"}),a=[],o;o||"correct"!==r?o||"incorrect"!==r?""!==r&&(a=i):o="incorrect":o="correct";let n="locked"===this.scanOptionalArgument("string"),l=this.scanArgument("auto"),s;return s=l&&Array.isArray(l)&&l.length>0?l:l&&"object"==typeof l&&"group"in l?l.group:a,e?[new n5(e,o,n,null!=s?s:a,{mode:this.parseMode,style:this.style})]:[new nj({mode:this.parseMode,style:this.style})]}if("\\renewcommand"===e||"\\newcommand"===e||"\\providecommand"===e||"\\def"===e){let i=this.index,r=this.scanLiteralGroup()||this.next();if(!r)return null;if(this.context.registers[r.substring(1)]){let a=this.scanArgument("string");return null!==a&&(this.context.registers[r.substring(1)]=a),[new oG({type:"text",value:"",verbatimLatex:of([e,ob(this.tokens.slice(i,this.index))])})]}}let o=this.scanMacro(e);if(o)return[o];let n=eM(e,this.parseMode);if(!n)return"text"===this.parseMode?(/[a-zA-Z]/.test(null!=(i=this.peek())?i:"")&&(e+=" "),[...e].map(e=>new oG({type:"text",value:e,mode:"text",style:this.style}))):(this.onError({code:"unknown-command",arg:e}),[new n4(e)]);let l=this.index;if("symbol"===n.definitionType){let i=f({},this.style);n.variant&&(i.variant=n.variant),o=new oG({type:n.type,command:e,style:i,value:String.fromCodePoint(n.codepoint),mode:this.parseMode})}else{if(n.ifMode&&!n.ifMode.includes(this.parseMode))return[];let i=this.parseMode;n.applyMode&&(this.parseMode=n.applyMode);let l,s=[];if(n.parse?s=n.parse(this):[l,s]=this.scanArguments(n),this.parseMode=i,n.applyMode&&!n.applyStyle&&!n.createAtom)return et(s[0]);if(n.infix)return this.onError({code:"too-many-infix-commands",arg:e}),null;if("function"==typeof n.createAtom)o=n.createAtom({command:e,args:s,style:this.style,mode:this.parseMode}),l&&(o.body=et(this.scanArgument(l)));else if("function"==typeof n.applyStyle){let i=n.applyStyle(this.style,e,s,this.context),r=this.parseMode;if(n.applyMode&&(this.parseMode=n.applyMode),l){let e=this.style;this.style=i;let a=this.scanArgument(l);return this.style=e,this.parseMode=r,et(a)}this.style=i}else o=new oG({type:"mord",command:null!=(r=n.command)?r:e,style:f({},this.style),value:e,mode:null!=(a=n.applyMode)?a:this.parseMode})}if(!o)return null;if(o instanceof oG&&void 0===o.verbatimLatex&&!/^\\(llap|rlap|class|cssId|htmlData)$/.test(e)){let i=of([e,ob(this.tokens.slice(l,this.index))]);i&&(o.verbatimLatex=i)}if(null===o.verbatimLatex&&(o.verbatimLatex=void 0),o.isFunction&&this.smartFence){let e=this.scanSmartFence();if(e)return[o,e]}return[o]}scanSymbolCommandOrLiteral(){this.expandUnicode();let e=this.get();if(!e)return null;if(n9(e)){let i=ov.createAtom(this.parseMode,e,f({},this.style));if(!i)return null;if(i.isFunction&&this.smartFence){let e=this.scanSmartFence();if(e)return[i,e]}return[i]}return e.startsWith("\\")?this.scanSymbolOrCommand(e):"<space>"===e?"text"===this.parseMode?[new oY(" "," ",this.style)]:null:("<}>"===e?this.onError({latex:"",code:"unbalanced-braces"}):this.onError({latex:"",code:"unexpected-token",arg:e}),null)}defineLocalMacro(e,i){let r=e.startsWith("\\")?e.slice(1):e;r&&(this.localMacros[r]=i)}scanMacro(e){var i;let r=e.startsWith("\\")?this.localMacros[e.slice(1)]:void 0,a=null!=r?r:this.context.getMacro(e);if(!a)return null;let o=this.index,n=a.args,l={"?":null==(i=this.args)?void 0:i.call(this,"?")};for(let e=1;e<=n;e++){let i=this.scanLiteralGroup();if(!i){let e=this.index;this.scanExpression(),i=ob(this.tokens.slice(e,this.index))}l[e]=i}return new n6(e,{expand:a.expand,captureSelection:a.captureSelection,args:o===this.index?null:ob(this.tokens.slice(o,this.index)),style:this.parsingContext.style,body:lt(a.def,{context:this.context,parseMode:this.parseMode,args:e=>l[e],mathstyle:this.parsingContext.mathstyle,style:this.parsingContext.style})})}parseExpression(){var e,i,r,a;let o=null!=(a=null!=(r=null!=(i=null!=(e=this.scanEnvironment())?e:this.scanModeShift())?i:this.scanModeSet())?r:this.scanGroup())?a:this.scanLeftRight();if(null===o){if(this.parseSupSub()||this.parseLimits())return!0;o=this.scanSymbolCommandOrLiteral()}return!!o&&(I(o)?this.mathlist.push(...o):this.mathlist.push(o),!0)}};function lt(e,i){var r,a,o,n;let l=null!=(r=null==i?void 0:i.args)?r:void 0,s=new le(om(e,l),null==i?void 0:i.context,{args:l,mathstyle:null!=(a=null==i?void 0:i.mathstyle)?a:"displaystyle",parseMode:null!=(o=null==i?void 0:i.parseMode)?o:"math",style:null!=(n=null==i?void 0:i.style)?n:{}}),c=[];for(;!s.end();)c.push(...s.scan(()=>!1));return c}function li(e,i){var r;let a=new le(om(e,null),null==i?void 0:i.context,{mathstyle:"displaystyle",parseMode:null!=(r=null==i?void 0:i.parseMode)?r:"math"});for(;!a.end();)a.scan();return a.errors}var lr=class e extends oG{constructor(e,i){super({type:"chem"},{command:e,mode:"math"});let r=lo.go(la.go(i,"\\pu"===e?"pu":"ce"),!1);this.body=lt(r),this._verbatimLatex=e+"{"+i+"}",this.arg=i,this.captureSelection=!0}static fromJson(i){return new e(i.command,i.arg)}set verbatimLatex(e){}get verbatimLatex(){return this._verbatimLatex}toJson(){return g(f({},super.toJson()),{arg:this.arg})}render(e){let i=oG.createBox(e,this.body,{type:"inner"});return this.caret&&(i.caret=this.caret),this.bind(e,i)}_serialize(e){return this.verbatimLatex,this.verbatimLatex}};ex(["ce","pu"],"{chemformula:balanced-string}",{createAtom:e=>{var i;return new lr(e.command,null!=(i=e.args[0])?i:"")}});var la={go:function(e,i){if(!e)return[];void 0===i&&(i="ce");var r="0",a={};a.parenthesisLevel=0,e=(e=(e=e.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var o,n=10,l=[];;){o!==e?(n=10,o=e):n--;for(var s=la.stateMachines[i],c=s.transitions[r]||s.transitions["*"],d=0;d<c.length;d++){var u=la.patterns.match_(c[d].pattern,e);if(u){for(var h,p=c[d].task,m=0;m<p.action_.length;m++){if(s.actions[p.action_[m].type_])h=s.actions[p.action_[m].type_](a,u.match_,p.action_[m].option);else if(la.actions[p.action_[m].type_])h=la.actions[p.action_[m].type_](a,u.match_,p.action_[m].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+p.action_[m].type_+")"];la.concatArray(l,h)}if(r=p.nextState||r,!(e.length>0))return l;if(p.revisit||(e=u.remainder),!p.toContinue)break}}if(n<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(e,i){if(i)if("[object Array]"===Object.prototype.toString.call(i))for(var r=0;r<i.length;r++)e.push(i[r]);else e.push(i)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(e){var i=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return i&&i[0]?{match_:i.slice(1),remainder:e.substr(i[0].length)}:null},"(-)(9)^(-9)":function(e){var i=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return i&&i[0]?{match_:i.slice(1),remainder:e.substr(i[0].length)}:null},"state of aggregation $":function(e){var i=la.patterns.findObserveGroups(e,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(i&&i.remainder.match(/^($|[\s,;\)\]\}])/))return i;var r=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return r?{match_:r[0],remainder:e.substr(r[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return la.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return la.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return la.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return la.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return la.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return la.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return la.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return la.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return la.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return la.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return la.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return la.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return la.patterns.findObserveGroups(e,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(e){return la.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return la.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return la.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return la.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(e){return la.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return la.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return la.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return la.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return la.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return la.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return la.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return la.patterns.findObserveGroups(e,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(e){if(i=e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/))return{match_:i[0],remainder:e.substr(i[0].length)};var i,r=la.patterns.findObserveGroups(e,"","$","$","");return r&&(i=r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/))?{match_:i[0],remainder:e.substr(i[0].length)}:null},amount2:function(e){return this.amount(e)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(e){if(e.match(/^\([a-z]+\)$/))return null;var i=e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return i?{match_:i[0],remainder:e.substr(i[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(e,i,r,a,o,n,l,s,c,d){var u=function(e,i){if("string"==typeof i)return 0!==e.indexOf(i)?null:i;var r=e.match(i);return r?r[0]:null},h=u(e,i);if(null===h||null===(h=u(e=e.substr(h.length),r)))return null;var p=function(e,i,r){for(var a=0;i<e.length;){var o=e.charAt(i),n=u(e.substr(i),r);if(null!==n&&0===a)return{endMatchBegin:i,endMatchEnd:i+n.length};if("{"===o)a++;else if("}"===o){if(0===a)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];a--}i++}return null}(e,h.length,a||o);if(null===p)return null;var m=e.substring(0,a?p.endMatchEnd:p.endMatchBegin);if(!n&&!l)return{match_:m,remainder:e.substr(p.endMatchEnd)};var f=this.findObserveGroups(e.substr(p.endMatchEnd),n,l,s,c);if(null===f)return null;var g=[m,f.match_];return{match_:d?g.join(""):g,remainder:f.remainder}},match_:function(e,i){var r=la.patterns.patterns[e];if(void 0===r)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if("function"==typeof r)return la.patterns.patterns[e](i);var a=i.match(r);return a?{match_:a[2]?[a[1],a[2]]:a[1]?a[1]:a[0],remainder:i.substr(a[0].length)}:null}},actions:{"a=":function(e,i){e.a=(e.a||"")+i},"b=":function(e,i){e.b=(e.b||"")+i},"p=":function(e,i){e.p=(e.p||"")+i},"o=":function(e,i){e.o=(e.o||"")+i},"q=":function(e,i){e.q=(e.q||"")+i},"d=":function(e,i){e.d=(e.d||"")+i},"rm=":function(e,i){e.rm=(e.rm||"")+i},"text=":function(e,i){e.text_=(e.text_||"")+i},insert:function(e,i,r){return{type_:r}},"insert+p1":function(e,i,r){return{type_:r,p1:i}},"insert+p1+p2":function(e,i,r){return{type_:r,p1:i[0],p2:i[1]}},copy:function(e,i){return i},rm:function(e,i){return{type_:"rm",p1:i||""}},text:function(e,i){return la.go(i,"text")},"{text}":function(e,i){var r=["{"];return la.concatArray(r,la.go(i,"text")),r.push("}"),r},"tex-math":function(e,i){return la.go(i,"tex-math")},"tex-math tight":function(e,i){return la.go(i,"tex-math tight")},bond:function(e,i,r){return{type_:"bond",kind_:r||i}},"color0-output":function(e,i){return{type_:"color0",color:i[0]}},ce:function(e,i){return la.go(i)},"1/2":function(e,i){var r=[];i.match(/^[+\-]/)&&(r.push(i.substr(0,1)),i=i.substr(1));var a=i.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return a[1]=a[1].replace(/\$/g,""),r.push({type_:"frac",p1:a[1],p2:a[2]}),a[3]&&(a[3]=a[3].replace(/\$/g,""),r.push({type_:"tex-math",p1:a[3]})),r},"9,9":function(e,i){return la.go(i,"9,9")}},createTransitions:function(e){var i,r,a,o,n={};for(i in e)for(r in e[i])for(a=r.split("|"),e[i][r].stateArray=a,o=0;o<a.length;o++)n[a[o]]=[];for(i in e)for(r in e[i])for(a=e[i][r].stateArray||[],o=0;o<a.length;o++){var l=e[i][r];if(l.action_){l.action_=[].concat(l.action_);for(var s=0;s<l.action_.length;s++)"string"==typeof l.action_[s]&&(l.action_[s]={type_:l.action_[s]})}else l.action_=[];for(var c=i.split("|"),d=0;d<c.length;d++)if("*"===a[o])for(var u in n)n[u].push({pattern:c[d],task:l});else n[a[o]].push({pattern:c[d],task:l})}return n},stateMachines:{}};la.stateMachines={ce:{transitions:la.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(e,i){var r;if((e.d||"").match(/^[0-9]+$/)){var a=e.d;e.d=void 0,r=this.output(e),e.b=a}else r=this.output(e);return la.actions["o="](e,i),r},"d= kv":function(e,i){e.d=i,e.dType="kv"},"charge or bond":function(e,i){if(e.beginsWithBond){var r=[];return la.concatArray(r,this.output(e)),la.concatArray(r,la.actions.bond(e,i,"-")),r}e.d=i},"- after o/d":function(e,i,r){var a=la.patterns.match_("orbital",e.o||""),o=la.patterns.match_("one lowercase greek letter $",e.o||""),n=la.patterns.match_("one lowercase latin letter $",e.o||""),l=la.patterns.match_("$one lowercase latin letter$ $",e.o||""),s="-"===i&&(a&&""===a.remainder||o||n||l);!s||e.a||e.b||e.p||e.d||e.q||a||!n||(e.o="$"+e.o+"$");var c=[];return s?(la.concatArray(c,this.output(e)),c.push({type_:"hyphen"})):(a=la.patterns.match_("digits",e.d||""),r&&a&&""===a.remainder?(la.concatArray(c,la.actions["d="](e,i)),la.concatArray(c,this.output(e))):(la.concatArray(c,this.output(e)),la.concatArray(c,la.actions.bond(e,i,"-")))),c},"a to o":function(e){e.o=e.a,e.a=void 0},"sb=true":function(e){e.sb=!0},"sb=false":function(e){e.sb=!1},"beginsWithBond=true":function(e){e.beginsWithBond=!0},"beginsWithBond=false":function(e){e.beginsWithBond=!1},"parenthesisLevel++":function(e){e.parenthesisLevel++},"parenthesisLevel--":function(e){e.parenthesisLevel--},"state of aggregation":function(e,i){return{type_:"state of aggregation",p1:la.go(i,"o")}},comma:function(e,i){var r=i.replace(/\s*$/,"");return r!==i&&0===e.parenthesisLevel?{type_:"comma enumeration L",p1:r}:{type_:"comma enumeration M",p1:r}},output:function(e,i,r){var a,o,n;for(var l in e.r?(o="M"===e.rdt?la.go(e.rd,"tex-math"):"T"===e.rdt?[{type_:"text",p1:e.rd||""}]:la.go(e.rd),n="M"===e.rqt?la.go(e.rq,"tex-math"):"T"===e.rqt?[{type_:"text",p1:e.rq||""}]:la.go(e.rq),a={type_:"arrow",r:e.r,rd:o,rq:n}):(a=[],(e.a||e.b||e.p||e.o||e.q||e.d||r)&&(e.sb&&a.push({type_:"entitySkip"}),e.o||e.q||e.d||e.b||e.p||2===r?e.o||e.q||e.d||!e.b&&!e.p?e.o&&"kv"===e.dType&&la.patterns.match_("d-oxidation$",e.d||"")?e.dType="oxidation":e.o&&"kv"===e.dType&&!e.q&&(e.dType=void 0):(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):(e.o=e.a,e.a=void 0),a.push({type_:"chemfive",a:la.go(e.a,"a"),b:la.go(e.b,"bd"),p:la.go(e.p,"pq"),o:la.go(e.o,"o"),q:la.go(e.q,"pq"),d:la.go(e.d,"oxidation"===e.dType?"oxidation":"bd"),dType:e.dType}))),e)"parenthesisLevel"!==l&&"beginsWithBond"!==l&&delete e[l];return a},"oxidation-output":function(e,i){var r=["{"];return la.concatArray(r,la.go(i,"oxidation")),r.push("}"),r},"frac-output":function(e,i){return{type_:"frac-ce",p1:la.go(i[0]),p2:la.go(i[1])}},"overset-output":function(e,i){return{type_:"overset",p1:la.go(i[0]),p2:la.go(i[1])}},"underset-output":function(e,i){return{type_:"underset",p1:la.go(i[0]),p2:la.go(i[1])}},"underbrace-output":function(e,i){return{type_:"underbrace",p1:la.go(i[0]),p2:la.go(i[1])}},"color-output":function(e,i){return{type_:"color",color1:i[0],color2:la.go(i[1])}},"r=":function(e,i){e.r=i},"rdt=":function(e,i){e.rdt=i},"rd=":function(e,i){e.rd=i},"rqt=":function(e,i){e.rqt=i},"rq=":function(e,i){e.rq=i},operator:function(e,i,r){return{type_:"operator",kind_:r||i}}}},a:{transitions:la.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:la.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:la.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(e){if(e.text_){var i={type_:"text",p1:e.text_};for(var r in e)delete e[r];return i}}}},pq:{transitions:la.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(e,i){return{type_:"state of aggregation subscript",p1:la.go(i,"o")}},"color-output":function(e,i){return{type_:"color",color1:i[0],color2:la.go(i[1],"pq")}}}},bd:{transitions:la.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(e,i){return{type_:"color",color1:i[0],color2:la.go(i[1],"bd")}}}},oxidation:{transitions:la.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(e,i){return{type_:"roman numeral",p1:i||""}}}},"tex-math":{transitions:la.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(e){if(e.o){var i={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return i}}}},"tex-math tight":{transitions:la.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(e,i){e.o=(e.o||"")+"{"+i+"}"},output:function(e){if(e.o){var i={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return i}}}},"9,9":{transitions:la.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:la.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(e,i){var r=[];return"+-"===i[0]||"+/-"===i[0]?r.push("\\pm "):i[0]&&r.push(i[0]),i[1]&&(la.concatArray(r,la.go(i[1],"pu-9,9")),i[2]&&(i[2].match(/[,.]/)?la.concatArray(r,la.go(i[2],"pu-9,9")):r.push(i[2])),(i[3]||i[4])&&("e"===i[3]||"*"===i[4]?r.push({type_:"cdot"}):r.push({type_:"times"}))),i[5]&&r.push("10^{"+i[5]+"}"),r},"number^":function(e,i){var r=[];return"+-"===i[0]||"+/-"===i[0]?r.push("\\pm "):i[0]&&r.push(i[0]),la.concatArray(r,la.go(i[1],"pu-9,9")),r.push("^{"+i[2]+"}"),r},operator:function(e,i,r){return{type_:"operator",kind_:r||i}},space:function(){return{type_:"pu-space-1"}},output:function(e){var i,r=la.patterns.match_("{(...)}",e.d||"");r&&""===r.remainder&&(e.d=r.match_);var a=la.patterns.match_("{(...)}",e.q||"");if(a&&""===a.remainder&&(e.q=a.match_),e.d&&(e.d=e.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.d=e.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),e.q){e.q=e.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.q=e.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var o={d:la.go(e.d,"pu"),q:la.go(e.q,"pu")};"//"===e.o?i={type_:"pu-frac",p1:o.d,p2:o.q}:(i=o.d,o.d.length>1||o.q.length>1?i.push({type_:" / "}):i.push({type_:"/"}),la.concatArray(i,o.q))}else i=la.go(e.d,"pu-2");for(var n in e)delete e[n];return i}}},"pu-2":{transitions:la.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(e,i){e.rm+="^{"+i+"}"},space:function(){return{type_:"pu-space-2"}},output:function(e){var i=[];if(e.rm){var r=la.patterns.match_("{(...)}",e.rm||"");i=r&&""===r.remainder?la.go(r.match_,"pu"):{type_:"rm",p1:e.rm}}for(var a in e)delete e[a];return i}}},"pu-9,9":{transitions:la.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(e){var i=[];if(e.text_=e.text_||"",e.text_.length>4){var r=e.text_.length%3;0===r&&(r=3);for(var a=e.text_.length-3;a>0;a-=3)i.push(e.text_.substr(a,3)),i.push({type_:"1000 separator"});i.push(e.text_.substr(0,r)),i.reverse()}else i.push(e.text_);for(var o in e)delete e[o];return i},"output-o":function(e){var i=[];if(e.text_=e.text_||"",e.text_.length>4){for(var r=e.text_.length-3,a=0;a<r;a+=3)i.push(e.text_.substr(a,3)),i.push({type_:"1000 separator"});i.push(e.text_.substr(a))}else i.push(e.text_);for(var o in e)delete e[o];return i}}}};var lo={go:function(e,i){if(!e)return"";for(var r="",a=!1,o=0;o<e.length;o++){var n=e[o];"string"==typeof n?r+=n:(r+=lo._go2(n),"1st-level escape"===n.type_&&(a=!0))}return i||a||!r||(r="{"+r+"}"),r},_goInner:function(e){return e&&lo.go(e,!0)},_go2:function(e){var i;switch(e.type_){case"chemfive":i="";var r={a:lo._goInner(e.a),b:lo._goInner(e.b),p:lo._goInner(e.p),o:lo._goInner(e.o),q:lo._goInner(e.q),d:lo._goInner(e.d)};r.a&&(r.a.match(/^[+\-]/)&&(r.a="{"+r.a+"}"),i+=r.a+"\\,"),(r.b||r.p)&&(i+="{\\vphantom{X}}",i+="^{\\hphantom{"+(r.b||"")+"}}_{\\hphantom{"+(r.p||"")+"}}",i+="{\\vphantom{X}}",i+="^{\\smash[t]{\\vphantom{2}}\\llap{"+(r.b||"")+"}}",i+="_{\\vphantom{2}\\llap{\\smash[t]{"+(r.p||"")+"}}}"),r.o&&(r.o.match(/^[+\-]/)&&(r.o="{"+r.o+"}"),i+=r.o),"kv"===e.dType?((r.d||r.q)&&(i+="{\\vphantom{X}}"),r.d&&(i+="^{"+r.d+"}"),r.q&&(i+="_{\\smash[t]{"+r.q+"}}")):"oxidation"===e.dType?(r.d&&(i+="{\\vphantom{X}}",i+="^{"+r.d+"}"),r.q&&(i+="{\\vphantom{X}}",i+="_{\\smash[t]{"+r.q+"}}")):(r.q&&(i+="{\\vphantom{X}}",i+="_{\\smash[t]{"+r.q+"}}"),r.d&&(i+="{\\vphantom{X}}",i+="^{"+r.d+"}"));break;case"rm":case"roman numeral":i="\\mathrm{"+e.p1+"}";break;case"text":e.p1.match(/[\^_]/)?(e.p1=e.p1.replace(" ","~").replace("-","\\text{-}"),i="\\mathrm{"+e.p1+"}"):i="\\text{"+e.p1+"}";break;case"state of aggregation":i="\\mskip2mu "+lo._goInner(e.p1);break;case"state of aggregation subscript":i="\\mskip1mu "+lo._goInner(e.p1);break;case"bond":if(!(i=lo._getBond(e.kind_)))throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+e.kind_+")"];break;case"frac":var a="\\frac{"+e.p1+"}{"+e.p2+"}";i="\\mathchoice{\\textstyle"+a+"}{"+a+"}{"+a+"}{"+a+"}";break;case"pu-frac":var o="\\frac{"+lo._goInner(e.p1)+"}{"+lo._goInner(e.p2)+"}";i="\\mathchoice{\\textstyle"+o+"}{"+o+"}{"+o+"}{"+o+"}";break;case"tex-math":case"1st-level escape":i=e.p1+" ";break;case"frac-ce":i="\\frac{"+lo._goInner(e.p1)+"}{"+lo._goInner(e.p2)+"}";break;case"overset":i="\\overset{"+lo._goInner(e.p1)+"}{"+lo._goInner(e.p2)+"}";break;case"underset":i="\\underset{"+lo._goInner(e.p1)+"}{"+lo._goInner(e.p2)+"}";break;case"underbrace":i="\\underbrace{"+lo._goInner(e.p1)+"}_{"+lo._goInner(e.p2)+"}";break;case"color":i="{\\color{"+e.color1+"}{"+lo._goInner(e.color2)+"}}";break;case"color0":i="\\color{"+e.color+"}";break;case"arrow":var n={rd:lo._goInner(e.rd),rq:lo._goInner(e.rq)},l=lo._getArrow(e.r);n.rd||n.rq?"<=>"===e.r||"<=>>"===e.r||"<<=>"===e.r||"<--\x3e"===e.r?(l="\\long"+l,n.rd&&(l="\\overset{"+n.rd+"}{"+l+"}"),n.rq&&(l="<--\x3e"===e.r?"\\underset{\\lower2mu{"+n.rq+"}}{"+l+"}":"\\underset{\\lower6mu{"+n.rq+"}}{"+l+"}"),l=" {}\\mathrel{"+l+"}{} "):(n.rq&&(l+="[{"+n.rq+"}]"),l+="{"+n.rd+"}",l=" {}\\mathrel{\\x"+l+"}{} "):l=" {}\\mathrel{\\long"+l+"}{} ",i=l;break;case"operator":i=lo._getOperator(e.kind_);break;case"space":i=" ";break;case"entitySkip":case"pu-space-1":i="~";break;case"pu-space-2":i="\\mkern3mu ";break;case"1000 separator":i="\\mkern2mu ";break;case"commaDecimal":i="{,}";break;case"comma enumeration L":i="{"+e.p1+"}\\mkern6mu ";break;case"comma enumeration M":i="{"+e.p1+"}\\mkern3mu ";break;case"comma enumeration S":i="{"+e.p1+"}\\mkern1mu ";break;case"hyphen":i="\\text{-}";break;case"addition compound":i="\\,{\\cdot}\\,";break;case"electron dot":i="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":i="{\\times}";break;case"prime":i="\\prime ";break;case"cdot":i="\\cdot ";break;case"tight cdot":i="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":i="\\times ";break;case"circa":i="{\\sim}";break;case"^":i="uparrow";break;case"v":i="downarrow";break;case"ellipsis":i="\\ldots ";break;case"/":i="/";break;case" / ":i="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return i},_getArrow:function(e){switch(e){case"->":case"→":case"⟶":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<--\x3e":return"leftrightarrows";case"<=>":case"⇌":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(e){switch(e){case"-":case"1":return"{-}";case"=":case"2":return"{=}";case"#":case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":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(e){switch(e){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":case"$\\approx$":return" {}\\approx{} ";case"v":case"(v)":return" \\downarrow{} ";case"^":case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}},ln=class e extends oG{constructor(e){super(g(f({},e),{type:"delim"})),this.value=e.delim,this.size=e.size}static fromJson(i){return new e(i)}toJson(){return g(f({},super.toJson()),{delim:this.value,size:this.size})}render(e){return new oE(this.value,{type:"middle"})}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);return null!=i&&i.serialize?i.serialize(this,e):og(this.command,this.value)}},ll=class e extends oG{constructor(e){super(g(f({},e),{type:"sizeddelim",value:e.delim})),this.delimType=e.delimType,this.size=e.size}static fromJson(i){return new e(i)}toJson(){return g(f({},super.toJson()),{delim:this.value,size:this.size,delimType:this.delimType})}render(e){var i,r,a;let o=(i=this.value,r=this.size,a={classes:({open:"ML__open",close:"ML__close"})[this.delimType],type:this.delimType,isSelected:this.isSelected},void 0===i||"."===i?nV(e,a.classes):("<"===i||"\\lt"===i||"⟨"===i?i="\\langle":(">"===i||"\\gt"===i||"⟩"===i)&&(i="\\rangle"),nB.has(i)||nP.has(i)?nD(i,r,!1,e,a):n$.has(i)?nK(i,nO[r],!1,e,a):null));return o?(o=this.bind(e,o),this.caret&&(o.caret=this.caret),o):null}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);return null!=i&&i.serialize?i.serialize(this,e):og(this.command,this.value)}};function ls(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var lc=class e extends oG{constructor(e,i,r,a){var o,n;super({type:"enclose",command:e,style:a.style}),this.body=i,this.backgroundcolor=a.backgroundcolor,r.updiagonalarrow&&(r.updiagonalstrike=!1),r.box&&(r.left=!1,r.right=!1,r.bottom=!1,r.top=!1),this.notation=r,this.shadow=null!=(o=a.shadow)?o:"none",this.strokeWidth=null!=(n=a.strokeWidth)?n:"0.06em",this.strokeWidth||(this.strokeWidth="0.06em"),this.strokeStyle=a.strokeStyle,this.svgStrokeStyle=a.svgStrokeStyle,this.strokeColor=a.strokeColor,this.borderStyle=a.borderStyle,this.padding=a.padding,this.captureSelection=!1}static fromJson(i){return new e(i.command,i.body,i.notation,i)}toJson(){return g(f({},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 i;if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let r=eM(this.command,this.mode);if(null!=r&&r.serialize)return r.serialize(this,e);let a=null!=(i=this.command)?i:"";if("\\enclose"===this.command){a+="{"+Object.keys(this.notation).join(" ")+"}";let e="",i="";this.backgroundcolor&&"transparent"!==this.backgroundcolor&&(e+=i+'mathbackground="'+this.backgroundcolor+'"',i=","),this.shadow&&"auto"!==this.shadow&&(e+=i+'shadow="'+this.shadow+'"',i=","),this.strokeWidth||"solid"!==this.strokeStyle?(e+=i+this.borderStyle,i=","):this.strokeColor&&"currentColor"!==this.strokeColor&&(e+=i+'mathcolor="'+this.strokeColor+'"',i=","),e&&(a+=`[${e}]`)}return og(a,this.bodyToLatex(e))}render(e){var i,r,a,o,n,l;let s=new oW({parent:e},this.style),c=oG.createBox(s,this.body);if(!c)return null;let d=function(e){if(!e)return"1px";let i=e.match(/([0-9][a-zA-Z\%]+)/);return null===i?"1px":i[1]}(this.borderStyle),u=s.toEm(this.padding&&"auto"!==this.padding?{string:this.padding}:{register:"fboxsep"});c.setStyle("position","relative"),c.setStyle("display","inline-block"),c.setStyle("height",c.height+c.depth,"em"),c.setStyle("width",c.width,"em");let h=new oE(null,{classes:"ML__notation"}),p=c.height+c.depth+2*u,m=c.width+2*u,f="",g=Math.min(.2*u,.05);if(this.notation.horizontalstrike){let e=2*u+c.height-.2155;f+=this.line((u+g).toString(),e.toString(),(u+c.width-g).toString(),e.toString())}if(this.notation.verticalstrike){let e=u+c.width/2;f+=this.line(e.toString(),(u+g).toString(),e.toString(),(p-u-g).toString())}if(this.notation.updiagonalstrike&&(f+=this.line((u+g).toString(),(p-u-g).toString(),(u+c.width-g).toString(),(u+g).toString())),this.notation.downdiagonalstrike&&(f+=this.line((u+g).toString(),(u+g).toString(),(u+c.width-g).toString(),(p-u-g).toString())),this.notation.updiagonalarrow){f+=this.line(u.toString(),(2*u+c.depth+c.height).toString(),(u+c.width).toString(),u.toString());let e=.03*Math.sqrt(m*m+p*p)*1,r=c.width*e,a=(c.depth+c.height)*e,o=u+c.width,n=u;n+a-.4*r<0&&(n=.4*r-a),f+='<polygon points="',f+=`${o},${n} ${o-r-.4*a},${n+a-.4*r} `,f+=`${o-.7*r},${n+.7*a} ${o-r+.4*a},${n+a+.4*r} `,f+=`${o},${n}`,f+=`" stroke='none' fill="${ls(null!=(i=this.strokeColor)?i:"")}"`,f+="/>"}let b=0;if(this.notation.phasorangle){let e=lu(s),i=(c.height+c.depth+2*e+2*u).toString(),r=(c.height+c.depth)/2;f+=this.line(u.toString(),i,(u+r+c.width).toString(),i),f+=this.line(u.toString(),i,(u+r).toString(),(u-e).toString()),p+=e,b=r,c.left+=p/2-u}if(this.notation.longdiv){let e=lu(s);p+=e,f+=this.line(u.toString(),u.toString(),(u+c.width).toString(),u.toString()),b=.3+e,c.left+=.3+e,c.setTop(u+e),f+='<path d="',f+=`M ${u} ${u} a0.3 ${(c.depth+c.height+2*e)/2}, 0, 1, 1, 0 ${c.depth+c.height+2*e} "`,f+=` stroke-width="${(Math.floor(100*(l=s).metrics.sqrtRuleThickness/l.scalingFactor)/100/10).toString()+"em"}" stroke="${ls(null!=(r=this.strokeColor)?r:"")}" fill="none"`,f+="/>"}if(h.width=c.width+2*u+b,h.height=c.height+2*u,h.depth=c.depth,h.setStyle("box-sizing","border-box"),h.setStyle("left",`calc(-1 * ${d} - ${u}em)`),h.setStyle("height",`calc( ${c.height+c.depth+2*u}em + ${d})`),h.setStyle("top","0em"),h.setStyle("width",`calc(${c.width+2*u}em + ${d})`),this.backgroundcolor&&h.setStyle("background-color",this.backgroundcolor),this.notation.box&&h.setStyle("border","1px solid red"),this.notation.actuarial&&(h.setStyle("border-top",this.borderStyle),h.setStyle("border-right",this.borderStyle)),this.notation.madruwb&&(h.setStyle("border-bottom",this.borderStyle),h.setStyle("border-right",this.borderStyle)),this.notation.roundedbox&&(h.setStyle("border-radius","8px"),h.setStyle("border",this.borderStyle)),this.notation.circle&&(h.setStyle("border-radius","50%"),h.setStyle("border",this.borderStyle)),this.notation.top&&h.setStyle("border-top",this.borderStyle),this.notation.left&&h.setStyle("border-left",this.borderStyle),this.notation.right&&h.setStyle("border-right",this.borderStyle),this.notation.bottom&&h.setStyle("border-bottom",this.borderStyle),f){let e="";"auto"===this.shadow&&(e+="filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .7)) drop-shadow(1px 1px 2px #333)"),"none"!==this.shadow&&(e+=`filter: drop-shadow(${ls(null!=(a=this.shadow)?a:"")})`),e+=` stroke-width="${ls(null!=(o=this.strokeWidth)?o:"")}" stroke="${ls(null!=(n=this.strokeColor)?n:"")}" stroke-linecap="round"`,this.svgStrokeStyle&&(e+=` stroke-dasharray="${ls(this.svgStrokeStyle)}"`),h.svgStyle=e,h.svgOverlay=f}let y=new oE([h,c]);return y.setStyle("position","relative"),y.setStyle("height",`${Math.floor(100*(h.depth+h.height))/100}em`),y.setStyle("display","inline-block"),y.height=h.height,y.depth=h.depth,y.width=h.width-2*u,y.left=u,y.right=u,this.caret&&(y.caret=this.caret),y.wrap(s)}line(e,i,r,a){return`<line x1="${ld(e)}" y1="${ld(i)}" x2="${ld(r)}" y2="${ld(a)}" vector-effect="non-scaling-stroke"></line>`}};function ld(e){return"number"==typeof e?`${Math.floor(100*e)/100}%`:e}function lu(e){let i=e.isDisplayStyle?.431:e.metrics.defaultRuleThickness;return e.metrics.defaultRuleThickness+e.scalingFactor*i/4}var lh=class e extends oG{constructor(e,i,r){var a,o,n;super(g(f({},r),{type:"genfrac",displayContainsHighlight:!0})),this.above=e,this.below=i,this.hasBarLine=null==(a=null==r?void 0:r.hasBarLine)||a,this.continuousFraction=null!=(o=null==r?void 0:r.continuousFraction)&&o,this.align=null!=(n=null==r?void 0:r.align)?n:"center",this.numerPrefix=null==r?void 0:r.numerPrefix,this.denomPrefix=null==r?void 0:r.denomPrefix,this.mathstyleName=null==r?void 0:r.mathstyleName,this.leftDelim=null==r?void 0:r.leftDelim,this.rightDelim=null==r?void 0:r.rightDelim}static fromJson(i){return new e(i.above,i.below,i)}toJson(){let e={};return this.continuousFraction&&(e.continuousFraction=!0),"center"!==this.align&&(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),f(f({},super.toJson()),e)}get children(){if(this._children)return this._children;let e=[];if("denominator-numerator"===o$.fractionNavigationOrder){for(let i of this.below)e.push(...i.children),e.push(i);for(let i of this.above)e.push(...i.children),e.push(i)}else{for(let i of this.above)e.push(...i.children),e.push(i);for(let i of this.below)e.push(...i.children),e.push(i)}return this._children=e,e}render(e){var i,r;let a=new oW({parent:e,mathstyle:this.mathstyleName},this.style),o=a.metrics,n=new oW({parent:a,mathstyle:this.continuousFraction?"":"numerator"},this.style),l=this.numerPrefix?new oE([new oE(this.numerPrefix),oG.createBox(n,this.above)],{isTight:n.isTight,type:"ignore"}):null!=(i=oG.createBox(n,this.above,{type:"ignore"}))?i:new oE(null,{type:"ignore"}),s=new oW({parent:a,mathstyle:this.continuousFraction?"":"denominator"},this.style),c=this.denomPrefix?new oE([new oE(this.denomPrefix),oG.createBox(s,this.below,{type:"ignore"})]):null!=(r=oG.createBox(s,this.below,{type:"ignore"}))?r:new oE(null,{type:"ignore"}),d=this.hasBarLine?o.defaultRuleThickness:0,u,h=0,p;a.isDisplayStyle?(u=n.metrics.num1,h=d>0?3*d:7*d,p=s.metrics.denom1):(d>0?(u=n.metrics.num2,h=d):(u=n.metrics.num3,h=3*o.defaultRuleThickness),p=s.metrics.denom2);let m=[];this.isSelected&&m.push("ML__selected");let f=l.depth,g=c.height,b;if(d<=0){let e=u-f-(g-p);e<h&&(u+=(h-e)/2,p+=(h-e)/2),b=new oB({individualShift:[{box:l,shift:-u,classes:[...m,lp(this.align)]},{box:c,shift:p,classes:[...m,lp(this.align)]}]}).wrap(a)}else{let e=new oE(null,{classes:"ML__frac-line",mode:this.mode,style:this.style});e.softWidth=Math.max(l.width,c.width),e.height=d/2,e.depth=d/2;let i=.25+d/2;u<h+f+i&&(u=h+f+i);let r=.25-d/2;p<h+g-r&&(p=h+g-r),b=new oB({individualShift:[{box:c,shift:p,classes:[...m,lp(this.align)]},{box:e,shift:-r,classes:m},{box:l,shift:-u,classes:[...m,lp(this.align)]}]}).wrap(a)}let y=a.isDisplayStyle?o.delim1:o.delim2,v=this.leftDelim?this.bind(e,nq("open",this.leftDelim,y,!0,e,{style:this.style,mode:this.mode,isSelected:this.isSelected})):nV(a,"ML__open"),x=null;x=this.continuousFraction?new oE(null,{type:"close"}):this.rightDelim?this.bind(e,nq("close",this.rightDelim,y,!0,e,{style:this.style,mode:this.mode,isSelected:this.isSelected})):nV(a,"ML__close");let _=new oE([v,b,x],{isTight:a.isTight,type:"inner",classes:"ML__mfrac"}),w=this.bind(e,_);return this.caret&&(w.caret=this.caret),this.attachSupsub(e,{base:w})}};function lp(e){var i;return null!=(i=({left:"ML__left",right:"ML__right",center:"ML__center"})[e])?i:"ML__center"}var lm=class e extends oG{constructor(e,i){var r;super({type:"latex",value:e,mode:"latex"}),this.isSuggestion=null!=(r=null==i?void 0:i.isSuggestion)&&r,this.isError=!1}static fromJson(i){let r=new e(i.value);return i.isSuggestion&&(r.isSuggestion=!0),i.isError&&(r.isError=!0),r}toJson(){let e={};return this.isSuggestion&&(e.isSuggestion=!0),this.isError&&(e.isError=!0),f({type:"latex",value:this.value},e)}render(e){let i=new oE(this.value,{classes:this.isSuggestion?"ML__suggestion":this.isError?"ML__error":"",type:"latex",maxFontSize:1});return i?(this.caret&&(i.caret=this.caret),this.bind(e,i)):null}},lf=class e extends oG{constructor(e=""){super({type:"latexgroup",mode:"latex"}),this.body=[...e].map(e=>new lm(e)),this.skipBoundary=!0}static fromJson(i){return new e}toJson(){return super.toJson()}render(e){let i=oG.createBox(e,this.body);return i?(this.caret&&(i.caret=this.caret),this.bind(e,i)):null}_serialize(e){var i,r;return null!=(r=null==(i=this.body)?void 0:i.map(e=>e.value).join(""))?r:""}},lg=class e extends oG{constructor(e,i){super(g(f({},i),{type:"extensible-symbol",isFunction:null==i?void 0:i.isFunction})),this.value=e,this.variant=null==i?void 0:i.variant,this.subsupPlacement=null==i?void 0:i.limits}static fromJson(i){return new e(i.symbol,i)}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 i;let r=e.isDisplayStyle&&"\\smallint"!==this.value,a=new oE(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(!a)return null;a.right=a.italic;let o=(a.height-a.depth)/2-.25*e.scalingFactor,n=a.italic;a.setTop(o);let l=a;if(this.superscript||this.subscript){let r=null!=(i=this.subsupPlacement)?i:"auto";"auto"===r&&e.isDisplayStyle&&(r="over-under"),l="over-under"===r?this.attachLimits(e,{base:a,baseShift:o,slant:n}):this.attachSupsub(e,{base:a})}return new oE(this.bind(e,l),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"ML__op-group"}).wrap(e)}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);if(null!=i&&i.serialize)return i.serialize(this,e);let r=[];return r.push(this.command),this.explicitSubsupPlacement&&("over-under"===this.subsupPlacement&&r.push("\\limits"),"adjacent"===this.subsupPlacement&&r.push("\\nolimits"),"auto"===this.subsupPlacement&&r.push("\\displaylimits")),r.push(this.supsubToLatex(e)),of(r)}},lb=class e extends oG{constructor(e){let i=e.body;super(g(f({},e),{type:"overlap",body:"string"==typeof i?[new oG({value:i})]:i,style:null==e?void 0:e.style})),this.skipBoundary=!0,this.align=null==e?void 0:e.align,this.boxType=null==e?void 0:e.boxType}static fromJson(i){return new e(i)}toJson(){let e={};return this.align&&(e.align=this.align),this.boxType&&(e.boxType=this.boxType),f(f({},super.toJson()),e)}render(e){let i=oG.createBox(e,this.body,{classes:"ML__inner"});return i?(this.caret&&(i.caret=this.caret),this.bind(e,new oE([i,new oE(null,{classes:"ML__fix"})],{classes:"right"===this.align?"ML__rlap":"ML__llap",type:this.boxType}))):null}},ly=class e extends oG{constructor(e){var i,r,a,o;super({type:"overunder",command:e.command,style:e.style,mode:e.mode,body:e.body,skipBoundary:null==(i=e.skipBoundary)||i}),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=null!=(r=e.boxType)?r:"ord",this.paddedBody=null!=(a=e.paddedBody)&&a,this.paddedLabels=null!=(o=e.paddedLabels)&&o}static fromJson(i){return new e(i)}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),"ord"!==this.boxType&&(e.boxType=this.boxType),this.paddedBody&&(e.paddedBody=!0),this.paddedLabels&&(e.paddedLabels=!0),e}render(e){let i=this.svgBody?oT(this.svgBody):oG.createBox(e,this.body,{type:"ignore"}),r=new oW({parent:e,mathstyle:"scriptstyle"},this.style),a=null;this.svgAbove?a=oT(this.svgAbove):this.above&&(a=oG.createBox(r,this.above,{type:"ignore"}));let o=null;this.svgBelow?o=oT(this.svgBelow):this.below&&(o=oG.createBox(r,this.below,{type:"ignore"})),this.paddedBody&&(i=new oE([nV(e,"ML__open"),i,nV(e,"ML__close")],{type:"ignore"}));let n=function(e,i){if(!i.base)return null;if(!i.above&&!i.below){let e=new oE(i.base,{type:i.type});return e.setStyle("position","relative"),e}let r=0;i.above&&(r=e.metrics.bigOpSpacing5);let a=null,o=i.base,n=["ML__center"];return(i.paddedAboveBelow&&n.push("ML__label_padding"),i.below&&i.above)?a=new oB({bottom:e.metrics.bigOpSpacing5+i.below.height+i.below.depth+o.depth+0,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:n},{box:o,classes:["ML__center"]},r,{box:i.above,classes:n},e.metrics.bigOpSpacing5]}):i.below?a=new oB({top:o.height-0,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:n},{box:o,classes:["ML__center"]}]}):i.above&&(a=new oB({bottom:o.depth+0,children:[{box:o,classes:["ML__center"]},r,{box:i.above,classes:n},e.metrics.bigOpSpacing5]})),new oE(a,{type:i.type})}(e,{base:i,above:a,below:o,type:"bin"===this.boxType||"rel"===this.boxType?this.boxType:"ord",paddedAboveBelow:this.paddedLabels});return n?(n="over-under"===this.subsupPlacement?this.attachLimits(e,{base:n,type:n.type}):this.attachSupsub(e,{base:n}),this.caret&&(n.caret=this.caret),this.bind(e,n)):null}},lv=class e extends oG{constructor(e){var i,r,a,o;super(g(f({},e),{type:"phantom"})),this.captureSelection=!0,this.isInvisible=null!=(i=e.isInvisible)&&i,this.smashDepth=null!=(r=e.smashDepth)&&r,this.smashHeight=null!=(a=e.smashHeight)&&a,this.smashWidth=null!=(o=e.smashWidth)&&o}static fromJson(i){return new e(i)}toJson(){let e={};return this.isInvisible&&(e.isInvisible=!0),this.smashDepth&&(e.smashDepth=!0),this.smashHeight&&(e.smashHeight=!0),this.smashWidth&&(e.smashWidth=!0),f(f({},super.toJson()),e)}render(e){let i=new oW({parent:e,isPhantom:!0});if(!this.smashDepth&&!this.smashHeight&&!this.smashWidth)return this.isInvisible,oG.createBox(i,this.body,{classes:"ML__inner"});let r=oG.createBox(this.isInvisible?i:e,this.body);if(!r)return null;if(this.smashWidth){let i=new oE(null,{classes:"ML__fix"});return new oE([r,i],{classes:"ML__rlap"}).wrap(e)}if(!this.smashHeight&&!this.smashDepth)return r;if(this.smashHeight&&(r.height=0),this.smashDepth&&(r.depth=0),r.children)for(let e of r.children)this.smashHeight&&(e.height=0),this.smashDepth&&(e.depth=0);return new oB({firstBaseline:[{box:r}]},{type:r.type}).wrap(e)}},lx=class e extends oG{constructor(e){var i;super(f({type:"spacing"},e)),this.width=null==e?void 0:e.width,this._braced=null!=(i=null==e?void 0:e.braced)&&i}static fromJson(i){return new e(i)}toJson(){let e=super.toJson();return void 0!==this.width&&(e.width=this.width),this._braced&&(e.braced=!0),e}render(e){var i;let r;return"space"===this.command?new oE("math"===this.mode?null:" "):(void 0!==this.width?(r=new oE(null,{classes:"ML__mspace"})).left=e.toEm(this.width):r=new oE(null,{classes:null!=(i=({"\\qquad":"ML__qquad","\\quad":"ML__quad","\\enspace":"ML__enspace","\\enskip":"ML__enspace","\\;":"ML__thickspace","\\thickspace":"ML__thickspace","\\:":"ML__mediumspace","\\>":"ML__mediumspace","\\medspace":"ML__mediumspace","\\,":"ML__thinspace","\\thinspace":"ML__thinspace","\\!":"ML__negativethinspace","\\negthinspace":"ML__negativethinspace"})[this.command])?i:"ML__mediumspace"}),r=this.bind(e,r),this.caret&&(r.caret=this.caret),r)}_serialize(e){var i;if(!e.expandMacro&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let r=eM(this.command,this.mode);if(null!=r&&r.serialize)return r.serialize(this,e);let a=null!=(i=this.command)?i:"";return void 0===this.width?a:!this._braced||"register"in this.width?`${a}${oF(this.width)}`:`${a}{${oF(this.width)}}`}},l_=class e extends oG{constructor(e){var i;super(g(f({},e),{type:"surd",mode:null!=(i=e.mode)?i:"math",style:e.style,displayContainsHighlight:!0,body:e.body})),this.above=e.index}static fromJson(i){return new e(g(f({},i),{index:i.above}))}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);if(null!=i&&i.serialize)return i.serialize(this,e);let r=this.command,a=this.bodyToLatex(e);return this.above&&!this.hasEmptyBranch("above")?og(`${r}[${this.aboveToLatex(e)}]`,a):o$.compactSerialization&&/^[0-9]$/.test(a)?`${r}${a}`:og(r,a)}get children(){if(this._children)return this._children;let e=[];if(this.above)for(let i of this.above)e.push(...i.children),e.push(i);if(this.body)for(let i of this.body)e.push(...i.children),e.push(i);return this._children=e,e}render(e){var i;let r=new oW({parent:e,mathstyle:"cramp"},this.style),a=null!=(i=oG.createBox(r,this.body,{type:"inner"}))?i:new oE(null),o=r.scalingFactor,n=r.metrics.defaultRuleThickness/o,l=e.isDisplayStyle?.431:n,s=new oE(null,{classes:"ML__sqrt-line",style:this.style});s.height=n,s.softWidth=a.width;let c=o*(n+l/4),d=Math.max(2*o*l,a.height+a.depth)+c+n,u=new oW({parent:e},this.style),h=this.bind(u,new oE(nq("inner","\\surd",d,!1,u,{isSelected:this.isSelected}),{isSelected:this.isSelected,classes:"ML__sqrt-sign",style:this.style}));if(!h)return null;let p=h.height+h.depth-n;p>a.height+a.depth+c&&(c=(c+p-(a.height+a.depth))/2),h.setTop(h.height-a.height-c);let m=this.bind(e,new oB({firstBaseline:[{box:new oE(a)},c-2*n,{box:s},n]})),f=oG.createBox(new oW({parent:e,mathstyle:"scriptscriptstyle"}),this.above,{type:"ignore"});if(!f){let i=new oE([h,m],{classes:this.containsCaret?"ML__contains-caret":"",type:"inner"});return i.setStyle("display","inline-block"),i.setStyle("height",i.height+i.depth,"em"),this.caret&&(i.caret=this.caret),this.bind(e,i)}let g=new oE([new oE(new oB({shift:-.6*(Math.max(h.height,m.height)-Math.max(h.depth,m.depth)),children:[{box:f}]}),{classes:"ML__sqrt-index",type:"ignore"}),h,m],{type:"inner",classes:this.containsCaret?"ML__contains-caret":""});return g.height=h.height,g.depth=h.depth,this.caret&&(g.caret=this.caret),this.bind(e,g)}},lw=class extends oE{constructor(e){super(null,{type:"skip"}),this._width=e}toMarkup(){return`<span style="display:inline-block;width:${Math.ceil(100*this.width)/100}em"></span>`}};function lk(e,i){if(!e.parent)return;let r=e.parent.children,a=r.indexOf(e),o=a-1;for(;o>=0&&"ignore"===r[o].type;)o-=1;o<0&&e.parent.parent&&"lift"===e.parent.type?lk(e.parent,i):a>0&&"skip"===r[a-1].type?r[a-1].width+=i:r.splice(a,0,new lw(i))}var lM={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}},lS={ord:{op:3},op:{ord:3,op:3},close:{op:3},inner:{op:3}};function lL(e,i){if(!e.children)return e;let r=e.children;lC(r,(e,i)=>{"bin"===i.type&&(!e||/^(middle|bin|op|rel|open|punct)$/.test(e.type))&&(i.type="ord"),(null==e?void 0:e.type)==="bin"&&/^(rel|close|punct)$/.test(i.type)&&(e.type="ord"),"ignore"!==i.type&&(e=i)});let a=i.getRegisterAsEm("thinmuskip"),o=i.getRegisterAsEm("medmuskip"),n=i.getRegisterAsEm("thickmuskip");return lC(r,(e,i)=>{var r,l,s;if(!e)return;let c=e.type;if("newline"===c)return;let d=i.isTight?null!=(r=lS[c])?r:null:null!=(l=lM[c])?l:null,u=null!=(s=null==d?void 0:d[i.type])?s:null;3===u&&lk(i,a),4===u&&lk(i,o),5===u&&lk(i,n)}),e}function lC(e,i,r){if(!e)return r;for(let a of e=[...e])"lift"===a.type?r=lC(a.children,i,r):"ignore"===a.type?lC(a.children,i):(i(r,a),lC(a.children,i),r=a);return r}var lE=class e extends oG{constructor(e){super({type:"tooltip",command:e.command,mode:e.mode,style:e.style,body:e.body,displayContainsHighlight:!0}),this.tooltip=new oG({type:"root",mode:e.content,body:e.tooltip,style:{}}),this.skipBoundary=!0,this.captureSelection=!1}static fromJson(i){return new e(g(f({},i),{tooltip:lD(i.tooltip)}))}toJson(){var e;let i=null==(e=this.tooltip.body)?void 0:e.filter(e=>"first"!==e.type).map(e=>e.toJson());return g(f({},super.toJson()),{tooltip:i})}render(e){let i=oG.createBox(e,this.body);if(!i)return null;let r=new oW({parent:e,mathstyle:"displaystyle"},{fontSize:5}),a=oA(lL(new oE(this.tooltip.render(r),{classes:"ML__tooltip-content"}),r)),o=new oE([a,i],{classes:"ML__tooltip-container"});return this.caret&&(o.caret=this.caret),this.bind(e,o)}},lA=class e extends oG{constructor(e,i){var r;super({type:"mop",mode:null!=(r=null==i?void 0:i.mode)?r:"math",style:null==i?void 0:i.style,command:"\\blank",isFunction:!0,captureSelection:!0,body:e})}static fromJson(i){return new e(i.body,i)}render(e){let i=new oW({parent:e}),r=!this.body||0===this.body.length||this.body.every(e=>"first"===e.type)?new nj({mode:this.mode,style:this.style}).render(e):oG.createBox(e,this.body),a=new oE("blank",{type:"op",mode:"math",maxFontSize:i.scalingFactor,style:{variant:"main",variantStyle:"up"},isSelected:this.isSelected,letterShapeStyle:i.letterShapeStyle}),o=new oE("(",{type:"open",isSelected:this.isSelected,maxFontSize:i.scalingFactor}),n=new oE(")",{type:"close",isSelected:this.isSelected,maxFontSize:i.scalingFactor}),l=new oE([a,o,r,n],{type:"ord",classes:"ML__blank",isSelected:this.isSelected});this.caret&&(l.caret=this.caret);let s=this.attachSupsub(e,{base:l});return this.bind(i,s)}_serialize(e){var i;let r=null!=(i=this.bodyToLatex(e))?i:"";return e.skipPlaceholders?r:og("\\blank",r)}},lz=class e extends oG{constructor(e,i){super(g(f({},i),{type:"operator",isFunction:null==i?void 0:i.isFunction})),this.value=e,this.variant=null==i?void 0:i.variant,this.variantStyle=null==i?void 0:i.variantStyle,this.subsupPlacement=null==i?void 0:i.limits}static fromJson(i){return new e(i.symbol,i)}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 i;let r=new oE(this.value,{type:"op",mode:"math",maxFontSize:e.scalingFactor,style:{variant:this.variant,variantStyle:this.variantStyle},isSelected:this.isSelected,letterShapeStyle:e.letterShapeStyle}),a=r;if(this.superscript||this.subscript){let o=null!=(i=this.subsupPlacement)?i:"auto";a="over-under"===o||"auto"===o&&e.isDisplayStyle?this.attachLimits(e,{base:r}):this.attachSupsub(e,{base:r})}return new oE(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)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);if(null!=i&&i.serialize)return i.serialize(this,e);let r=[this.command];return this.explicitSubsupPlacement&&("over-under"===this.subsupPlacement&&r.push("\\limits"),"adjacent"===this.subsupPlacement&&r.push("\\nolimits"),"auto"===this.subsupPlacement&&r.push("\\displaylimits")),r.push(this.supsubToLatex(e)),of(r)}},lT=class e extends oG{constructor(e){super(g(f({type:"newline"},e),{skipBoundary:!0}))}static fromJson(i){return new e(i)}toJson(){return super.toJson()}render(e){let i=new oE(null,{classes:"ML__newline",type:"newline"});return this.caret&&(i.caret=this.caret),this.bind(e,i)}_serialize(e){return"\\\\"}};function lD(e){if(I(e))return e.map(e=>lD(e));if("string"==typeof e)return oG.fromJson(e);for(let i of(e=f({},e),oU))e[i]&&(e[i]=lD(e[i]));e.args&&(e.args=function(e){if(e){if("string"==typeof e)return e;if(Array.isArray(e))return e.map(e=>"<null>"===e?null:"object"==typeof e&&"group"in e?{group:e.group.map(e=>lD(e))}:"object"==typeof e&&"atoms"in e?e.atoms.map(e=>lD(e)):e)}}(e.args)),e.array&&(e.array=lD(e.array));let i=e.type,r;for(let a of("accent"===i&&(r=nE.fromJson(e)),"array"===i&&(r=nG.fromJson(e)),"box"===i&&(r=n0.fromJson(e)),"chem"===i&&(r=lr.fromJson(e)),"composition"===i&&(r=n1.fromJson(e)),"delim"===i&&(r=ln.fromJson(e)),"enclose"===i&&(r=lc.fromJson(e)),"error"===i&&(r=n4.fromJson(e)),"extensible-symbol"===i&&(r=lg.fromJson(e)),"genfrac"===i&&(r=lh.fromJson(e)),"group"===i&&(r=n2.fromJson(e)),"latex"===i&&(r=lm.fromJson(e)),"latexgroup"===i&&(r=lf.fromJson(e)),"leftright"===i&&(r=n3.fromJson(e)),"macro"===i&&(r=n6.fromJson(e)),"macro-argument"===i&&(r=n8.fromJson(e)),"newline"===i&&(r=lT.fromJson(e)),"operator"===i&&(r=lz.fromJson(e)),"overlap"===i&&(r=lb.fromJson(e)),"overunder"===i&&(r=ly.fromJson(e)),"placeholder"===i&&(r=nj.fromJson(e)),"\\blank"===e.command?r=lA.fromJson(e):"prompt"===i&&(r=n5.fromJson(e)),"phantom"===i&&(r=lv.fromJson(e)),"sizeddelim"===i&&(r=ll.fromJson(e)),"spacing"===i&&(r=lx.fromJson(e)),"subsup"===i&&(r=n7.fromJson(e)),"surd"===i&&(r=l_.fromJson(e)),"text"===i&&(r=oY.fromJson(e)),"tooltip"===i&&(r=lE.fromJson(e)),r||(i&&["first","mbin","mrel","mclose","minner","mop","mopen","mord","mpunct","root","space"].includes(i),r=oG.fromJson(e)),oU))e[a]&&r.setChildren(e[a],a);return void 0!==e.verbatimLatex&&(r.verbatimLatex=e.verbatimLatex),e.subsupPlacement&&(r.subsupPlacement=e.subsupPlacement),e.explicitSubsupPlacement&&(r.explicitSubsupPlacement=!0),e.isFunction&&(r.isFunction=!0),e.skipBoundary&&(r.skipBoundary=!0),e.captureSelection&&(r.captureSelection=!0),r}function lK(e,i){e&&i&&(I(e)?e.forEach(e=>lK(e,i)):"object"==typeof e&&e.applyStyle(i,{unstyledOnly:!0}))}function lB(e,i,r,a){function o(e,i){for(let r of n)if(r.style[e]!==i)return!1;return!0}if((i=e.normalizeRange(i))[0]===i[1])return!1;let n=e.getAtoms(i,{includeChildren:!0});for(let e of("toggle"===a.operation&&(r.color&&o("color",r.color)&&(r.color="none",delete r.verbatimColor),r.backgroundColor&&o("backgroundColor",r.backgroundColor)&&(r.backgroundColor="none",delete r.verbatimBackgroundColor),r.fontFamily&&o("fontFamily",r.fontFamily)&&(r.fontFamily="none"),r.fontSeries&&o("fontSeries",r.fontSeries)&&(r.fontSeries="auto"),r.fontShape&&o("fontShape",r.fontShape)&&(r.fontShape="auto"),r.fontSize&&o("fontSize",r.fontSize)&&(r.fontSize=5),r.variant&&o("variant",r.variant)&&(r.variant="normal"),r.variantStyle&&o("variantStyle",r.variantStyle)&&(r.variantStyle="")),n))e.applyStyle(r);return!0}function l$(e){return({up:"up",bold:"bold",italic:void 0,bolditalic:"bold","":void 0})[null!=e?e:""]}var lP={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};function lO(e,i=[[[]]],r=[],a=[],o){switch(e){case"math":case"displaymath":return new nG(e,i,r,{mathstyleName:"textstyle",isRoot:!0,minColumns:1,maxColumns:1,minRows:1,maxRows:1});case"center":return new nG(e,i,r,{columns:[{align:"c"}],classes:["ML__center_environment"],isRoot:!0,minColumns:1,maxColumns:1,minRows:1,maxRows:1});case"multline":case"multline*":return new nG(e,i,r,{columns:[{align:"m"}],leftDelim:".",rightDelim:".",isRoot:!0,minColumns:1,maxColumns:1,minRows:1});case"split":return new nG(e,i,r,{columns:[{align:"r"},{align:"l"}],minColumns:2,minRows:1,isRoot:!1});case"gather":case"gather*":return new nG(e,i,r,{columns:[{gap:.25},{align:"c"},{gap:0}],minColumns:1,maxColumns:1,minRows:1,isRoot:!0,classes:["ML__gather_environment"]});case"gathered":return new nG(e,i,r,{columns:[{gap:.25},{align:"c"},{gap:0}],minColumns:1,maxColumns:1,minRows:1});case"equation":case"equation*":case"subequations":return new nG(e,i,r,{columns:[{align:"c"}],isRoot:!0,minColumns:1,maxColumns:1,minRows:1});case"aligned":{let a=0;for(let e of i)a=Math.max(a,e.length);let o=[{gap:0},{align:"r"},{gap:.25},{align:"l"}],n=2;for(;n<a;)o.push({gap:1},{align:"r"},{gap:.25},{align:"l"}),n+=2;return o.push({gap:0}),new nG(e,i,r,{arraycolsep:0,columns:o,minColumns:2,minRows:1,isRoot:"aligned"!==e})}case"eqnarray":return new nG(e,i,r,{arraycolsep:0,columns:[{gap:0},{align:"r"},{align:"c"},{align:"l"}],minColumns:3,maxColumns:3,minRows:1,isRoot:!0,classes:["ML__eqnarray_environment"]});case"align":case"align*":return new nG(e,i,r,{arraycolsep:0,columns:[{gap:0},{align:"r"},{gap:.25},{align:"l"}],minColumns:2,maxColumns:2,minRows:1,isRoot:!0,classes:["ML__align_environment"]});case"pmatrix":case"pmatrix*":return new nG(e,i,r,{mathstyleName:"textstyle",leftDelim:"(",rightDelim:")",columns:lI(a[0],o)});case"bmatrix":case"bmatrix*":return new nG(e,i,r,{mathstyleName:"textstyle",leftDelim:"[",rightDelim:"]",columns:lI(a[0],o)});case"Bmatrix":case"Bmatrix*":return new nG(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\lbrace",rightDelim:"\\rbrace",columns:lI(a[0],o)});case"vmatrix":case"vmatrix*":return new nG(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\vert",rightDelim:"\\vert",columns:lI(a[0],o)});case"Vmatrix":case"Vmatrix*":return new nG(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\Vert",rightDelim:"\\Vert",columns:lI(a[0],o)});case"matrix":case"matrix*":return new nG(e,i,r,{mathstyleName:"textstyle",leftDelim:".",rightDelim:".",columns:lI(null==a?void 0:a[0],o)});case"smallmatrix":case"smallmatrix*":return new nG(e,i,r,{mathstyleName:"scriptstyle",columns:lI(null==a?void 0:a[0],o),colSeparationType:"small",arraystretch:.5});case"cases":case"dcases":return new nG(e,i,r,{mathstyleName:"dcases"===e?"displaystyle":"textstyle",arraystretch:1.2,leftDelim:"\\lbrace",rightDelim:".",columns:lR()});case"rcases":return new nG(e,i,r,{arraystretch:1.2,leftDelim:".",rightDelim:"\\rbrace",columns:lR()});case"lines":return new nG(e,i,r,{leftDelim:".",rightDelim:".",columns:[{align:"l"}],isRoot:!0,minColumns:1,maxColumns:1,minRows:1})}return new nG(e,i,r,{mathstyleName:"textstyle"})}function lI(e,i=10){return null!=e?e:Array(i).fill({align:"c"})}function lR(e=10){let i=[];for(let r=0;r<e;r++)r>0&&i.push({gap:1}),i.push({align:"l"});return i}ex(Object.keys(lP),"{body:auto}",{createAtom:e=>new nE(g(f({},e),{body:et(e.args[0]),accentChar:lP[e.command.slice(1)]}))}),ex(["widehat","widecheck","widetilde"],"{body:auto}",{createAtom:e=>{let i=eb(et(e.args[0]));return new nE(g(f({},e),{body:et(e.args[0]),svgAccent:e.command.slice(1)+(i.length>5?"4":["1","1","2","2","3","3"][i.length])}))}}),ex(["overarc","overparen","wideparen"],"{body:auto}",{createAtom:e=>new nE(g(f({},e),{body:et(e.args[0]),svgAccent:"overarc"}))}),ex(["underarc","underparen"],"{body:auto}",{createAtom:e=>new ly(g(f({},e),{body:et(e.args[0]),svgBelow:"underarc"}))}),ex("utilde","{body:auto}",{createAtom:e=>{let i=et(e.args[0]),r=eb(i),a="widetilde"+(r.length>5?"4":["1","1","2","2","3","3"][r.length]);return new ly(g(f({},e),{body:i,svgBelow:a,boxType:oL(i)}))}}),ex("^","{:string}",{createAtom:e=>{var i;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(i=({a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"})[e.args[0]])?i:"^"}))}}),ex("`","{:string}",{createAtom:e=>{var i;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(i=({a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"})[e.args[0]])?i:"`"}))}}),ex("'","{:string}",{createAtom:e=>{var i;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(i=({a:"á",e:"é",i:"í",o:"ó",u:"ú",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú"})[e.args[0]])?i:"'"}))}}),ex('"',"{:string}",{createAtom:e=>{var i,r;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:null!=(i=e.args)&&i[0]?null!=(r=({a:"ä",e:"ë",i:"ï",o:"ö",u:"ü",A:"Ä",E:"Ë",I:"Ë",O:"Ö",U:"Ü"})[e.args[0]])?r:'"'+e.args[0]:'"'}))}}),ex(".","{:string}",{createAtom:e=>{var i,r;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:null!=(i=e.args)&&i[0]?null!=(r=({a:"ȧ",e:"ė",i:"̇i",o:"ȯ",u:"̇u",A:"Ȧ",E:"Ė",I:"İ",O:"Ȯ",U:"̇U"})[e.args[0]])?r:"."+e.args[0]:"."}))}}),ex("=","{:string}",{createAtom:e=>{var i,r;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:null!=(i=e.args)&&i[0]?null!=(r=({a:"ā",e:"ē",i:"ī",o:"ō",u:"ū",A:"Ā",E:"Ē",I:"Ī",O:"Ō",U:"Ū"})[e.args[0]])?r:"="+e.args[0]:"="}))}}),ex("~","{:string}",{createAtom:e=>{var i;return new oG(g(f({type:"mord"},e),{isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(i=({n:"ñ",N:"Ñ",a:"ã",o:"õ",A:"Ã",O:"Õ"})[e.args[0]])?i:"´"}))}}),ex("c","{:string}",{createAtom:e=>{var i;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(i=({c:"ç",C:"Ç"})[e.args[0]])?i:""}))}}),ex("enclose","{notation:string}[style:string]{body:auto}",{createAtom:e=>{var i,r;let a=e.args,o={strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",backgroundcolor:"transparent",padding:"auto",shadow:"none",svgStrokeStyle:void 0,borderStyle:void 0,style:null!=(i=e.style)?i:{}};if(a[1]){for(let e of a[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/)){let i=e.match(/\s*(\S+)\s+(\S+)\s+(.*)/);if(i)o.strokeWidth=i[1],o.strokeStyle=i[2],o.strokeColor=i[3];else{let i=e.match(/\s*([a-z]*)\s*=\s*"(.*)"/);i&&("mathbackground"===i[1]?o.backgroundcolor=i[2]:"mathcolor"===i[1]?o.strokeColor=i[2]:"padding"===i[1]?o.padding=i[2]:"shadow"===i[1]&&(o.shadow=i[2]))}}"dashed"===o.strokeStyle?o.svgStrokeStyle="5,5":"dotted"===o.strokeStyle&&(o.svgStrokeStyle="1,5")}o.borderStyle=`${o.strokeWidth} ${o.strokeStyle} ${o.strokeColor}`;let n={};return(null!=(r=a[0])?r:"").split(/[, ]/).filter(e=>e.length>0).forEach(e=>{n[e.toLowerCase()]=!0}),new lc(e.command,et(a[2]),n,o)}}),ex("cancel","{body:auto}",{createAtom:e=>{var i;return new lc(e.command,et(e.args[0]),{updiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(i=e.style)?i:{}})}}),ex("bcancel","{body:auto}",{createAtom:e=>{var i;return new lc(e.command,et(e.args[0]),{downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(i=e.style)?i:{}})}}),ex("xcancel","{body:auto}",{createAtom:e=>{var i;return new lc(e.command,et(e.args[0]),{updiagonalstrike:!0,downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(i=e.style)?i:{}})}}),ex("sout","{body:auto}",{createAtom:e=>{var i;return new lc(e.command,et(e.args[0]),{horizontalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(i=e.style)?i:{}})}}),ev(["math","displaymath"],lO),ev("center",lO),ey(["multline","multline*"],"",lO),ex("displaylines","",{parse:e=>{if(e.skipWhitespace(),!e.match("<{>"))return[];let i=[],r=[];for(e.mathlist.length>0&&i.push([e.mathlist]),e.beginContext({tabular:!0,root:!0});!(e.end()||e.match("<}>"));)e.matchColumnSeparator()||e.matchRowSeparator()?(i.push([r]),r=[]):r.push(...e.scan(e=>["<}>","&","\\cr","\\\\","\\tabularnewline"].includes(e)));e.endContext(),i.push([r]);let a=e.scan();return a.length>0&&i.push([a]),i},createAtom:e=>new nG("lines",e.args,[],{leftDelim:".",rightDelim:".",columns:[{align:"l"}],classes:["ML__multiline_environment"],isRoot:!0,minColumns:1,maxColumns:1,minRows:1})}),ey("split","",lO),ey(["gather","gather*","gathered"],"",lO),ey(["equation","equation*","subequations"],"",lO),ev(["align","align*","eqnarray"],lO,{tabular:!0}),ey(["aligned"],"",lO),ey("array","{columns:colspec}",(e,i,r,a)=>new nG(e,i,r,{columns:a[0],mathstyleName:"textstyle"})),ey(["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],"[columns:colspec]",lO),ey(["smallmatrix","smallmatrix*"],"[columns:colspec]",lO),ey(["cases","dcases","rcases"],"",lO),ex("piecewise","{count:string}",{parse:e=>{var i,r;let a=null!=(r=null==(i=e.scanArgument("string"))?void 0:i.trim())?r:"";return 0===a.length?(e.onError({code:"missing-argument",arg:"\\piecewise"}),["1"]):!/^[1-9]\d*$/.test(a)||Number(a)>100?(e.onError({code:"unexpected-token",arg:a}),["1"]):[a]},createAtom:e=>{var i;let r=Number.parseInt(null==(i=e.args)?void 0:i[0],10);return lO("cases",Array.from({length:Number.isInteger(r)&&r>0?Math.min(r,100):1},()=>[[new nj],[new nj]]))}}),ex(["overrightarrow","overleftarrow","Overrightarrow","overleftharpoon","overrightharpoon","overleftrightarrow","overlinesegment","overgroup"],"{:auto}",{createAtom:e=>{var i;return new ly(g(f({},e),{body:et(null==(i=e.args)?void 0:i[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgAbove:e.command.slice(1)}))}}),ex("overbrace","{:auto}",{createAtom:e=>new ly(g(f({},e),{body:et(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgAbove:e.command.slice(1)}))}),ex(["underrightarrow","underleftarrow","underleftrightarrow","underlinesegment","undergroup"],"{:auto}",{createAtom:e=>new ly(g(f({},e),{body:et(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgBelow:e.command.slice(1)}))}),ex(["underbrace"],"{:auto}",{createAtom:e=>new ly(g(f({},e),{body:et(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgBelow:e.command.slice(1)}))}),ex(["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:e=>{var i,r,a,o,n;return new ly(g(f({},e),{svgBody:e.command.slice(1),above:(null==(r=et(null==(i=e.args)?void 0:i[1]))?void 0:r.length)===0?void 0:et(null==(a=e.args)?void 0:a[1]),below:null!=(n=et(null==(o=e.args)?void 0:o[0]))?n:null,skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,paddedLabels:!0,boxType:"rel"}))},serialize:(e,i)=>e.command+(e.hasEmptyBranch("below")?"":`[${e.belowToLatex(i)}]`)+`{${e.aboveToLatex(i)}}${e.supsubToLatex(i)}`}),ex(["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:e=>new lz(e.command.slice(1),g(f({},e),{limits:"adjacent",isFunction:!0,variant:"main",variantStyle:"up"}))}),ex(["liminf","limsup"],"",{ifMode:"math",createAtom:e=>new lz({"\\liminf":"lim inf","\\limsup":"lim sup"}[e.command],g(f({},e),{limits:"over-under",variant:"main"}))}),ex(["lim","mod"],"",{ifMode:"math",createAtom:e=>new lz(e.command.slice(1),g(f({},e),{limits:"over-under",variant:"main"}))}),ex(["det","max","min"],"",{ifMode:"math",isFunction:!0,createAtom:e=>new lz(e.command.slice(1),g(f({},e),{limits:"over-under",isFunction:!0,variant:"main"}))}),ex("ang","{:math}",{ifMode:"math",createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),serialize:(e,i)=>`\\ang{${e.bodyToLatex(i)}}`,render:(e,i)=>{let r=e.createBox(i),a=r.caret;r.caret=void 0;let o=new oE("°",{style:g(f({},e.style),{variant:"normal",variantStyle:"up"})});return new oE([r,o],{type:"inner",isSelected:e.isSelected,caret:a})}}),ex("sqrt","[index:auto]{radicand:expression}",{ifMode:"math",createAtom:e=>new l_(g(f({},e),{body:et(e.args[1]),index:e.args[0]?et(e.args[0]):void 0}))}),ex(["frac","dfrac","tfrac","binom","dbinom","tbinom"],"{:expression}{:expression}",{ifMode:"math",createAtom:e=>{let i=f({},e),r=e.command,a=e.args;switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":i.hasBarLine=!0;break;case"\\atopfrac":i.hasBarLine=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":i.hasBarLine=!1,i.leftDelim="(",i.rightDelim=")";break;case"\\cfrac":i.hasBarLine=!0,i.continuousFraction=!0}switch(r){case"\\dfrac":case"\\dbinom":i.mathstyleName="displaystyle";break;case"\\tfrac":case"\\tbinom":i.mathstyleName="textstyle"}return new lh(a[0]?et(a[0]):[new nj],a[1]?et(a[1]):[new nj],i)},serialize:(e,i)=>{let r=e.aboveToLatex(i),a=e.belowToLatex(i);return o$.compactSerialization&&/^[0-9]$/.test(r)&&/^[0-9]$/.test(a)?`${e.command}${r}${a}`:og(e.command,r,a)}}),ex("genfrac","{:string}{:string}{:string}{:string}{:expression}{:expression}",{ifMode:"math",createAtom:e=>{var i,r,a,o,n;let l=e.args,s=(null!=(i=l[0])?i:"").trim(),c=(null!=(r=l[1])?r:"").trim(),d=(null!=(a=l[2])?a:"").trim(),u=null!=(n=({0:"displaystyle",1:"textstyle",2:"scriptstyle",3:"scriptscriptstyle"})[(null!=(o=l[3])?o:"").trim()])?n:void 0;return new lh(l[4]?et(l[4]):[new nj],l[5]?et(l[5]):[new nj],g(f({},e),{leftDelim:s&&"."!==s?s:void 0,rightDelim:c&&"."!==c?c:void 0,hasBarLine:"0pt"!==d&&"0"!==d,mathstyleName:u}))}}),ex(["cfrac"],"[:string]{:expression}{:expression}",{ifMode:"math",createAtom:e=>{let i=f({},e),r=e.args;return i.hasBarLine=!0,i.continuousFraction=!0,"r"===r[0]&&(i.align="right"),"l"===r[0]&&(i.align="left"),new lh(r[1]?et(r[1]):[new nj],r[2]?et(r[2]):[new nj],i)},serialize:(e,i)=>{let r=e.aboveToLatex(i),a=e.belowToLatex(i);return og(e.command,r,a)}}),ex(["brace","brack"],"",{infix:!0,createAtom:e=>new lh(et(e.args[0]),et(e.args[1]),g(f({},e),{hasBarLine:!1,leftDelim:"\\brace"===e.command?"\\lbrace":"\\lbrack",rightDelim:"\\brace"===e.command?"\\rbrace":"\\rbrack"})),serialize:(e,i)=>of([e.aboveToLatex(i),e.command,e.belowToLatex(i)])}),ex(["over","atop","choose"],"",{infix:!0,createAtom:e=>{let i,r,a=e.args;return"\\choose"===e.command&&(i="(",r=")"),new lh(et(a[0]),et(a[1]),g(f({},e),{hasBarLine:"\\over"===e.command,leftDelim:i,rightDelim:r}))},serialize:(e,i)=>of([e.aboveToLatex(i),e.command,e.belowToLatex(i)])}),ex(["overwithdelims","atopwithdelims"],"{numer:auto}{denom:auto}{left-delim:delim}{right-delim:delim}",{infix:!0,createAtom:e=>{var i,r;let a=e.args;return new lh(et(a[0]),et(a[1]),g(f({},e),{leftDelim:null!=(i=a[2])?i:".",rightDelim:null!=(r=a[3])?r:".",hasBarLine:!1}))},serialize:(e,i)=>`${e.aboveToLatex(i)} ${e.command}${e.leftDelim}${e.rightDelim}${e.belowToLatex(i)}`}),ex("pdiff","{numerator}{denominator}",{ifMode:"math",createAtom:e=>new lh(et(e.args[0]),et(e.args[1]),g(f({},e),{hasBarLine:!0,numerPrefix:"∂",denomPrefix:"∂"})),serialize:(e,i)=>of([e.aboveToLatex(i),e.command,e.belowToLatex(i)])}),ex(["sum","prod","bigcup","bigcap","coprod","bigvee","bigwedge","biguplus","bigotimes","bigoplus","bigodot","bigsqcup","intop"],"",{ifMode:"math",createAtom:e=>new lg({coprod:"∐",bigvee:"⋁",bigwedge:"⋀",biguplus:"⨄",bigcap:"⋂",bigcup:"⋃",intop:"∫",prod:"∏",sum:"∑",bigotimes:"⨂",bigoplus:"⨁",bigodot:"⨀",bigsqcup:"⨆",smallint:"∫"}[e.command.slice(1)],g(f({},e),{limits:"auto",variant:"main"}))}),ex("smallint","",{ifMode:"math",createAtom:e=>new lz("∫",g(f({},e),{limits:"adjacent",variant:"main"}))});var lN={int:"∫",iint:"∬",iiint:"∭",iiiint:"⨌",oint:"∮",oiint:"∯",oiiint:"∰",intclockwise:"∱",varointclockwise:"∲",ointctrclockwise:"∳",intctrclockwise:"⨑",sqcup:"⊔",sqcap:"⊓",uplus:"⊎",wr:"≀",amalg:"⨿",Cap:"⋒",Cup:"⋓",doublecap:"⋒",doublecup:"⋓"};function lq(e,i){var r,a;e.skipFiller();let o=e.scanLiteralGroup();if(!o){let i=e.peek();null!=i&&i.startsWith("\\")&&(o=i,e.next())}let n=null!=(a=null==(r=e.scanArgument("string"))?void 0:r.trim())?a:"",l=(o.startsWith("\\")?o.slice(1):o).trim();return l&&n&&e.defineLocalMacro(l,{def:i?`\\operatorname*{${n}}`:`\\operatorname{${n}}`,args:0,captureSelection:!1}),[o,n]}function lF(e){return new oG({type:"mord",mode:"math",command:e.command,value:"",args:e.args,style:e.style})}function lV(e,i){var r,a,o,n;let l=null!=(a=null==(r=e.args)?void 0:r[0])?a:"",s=null!=(n=null==(o=e.args)?void 0:o[1])?n:"",c=l.startsWith("\\")?l:`\\${l}`;return i?`\\DeclareMathOperator*{${c}}{${s}}`:`\\DeclareMathOperator{${c}}{${s}}`}ex(Object.keys(lN),"",{ifMode:"math",createAtom:e=>{let i=lN[e.command.slice(1)];return new lg(i,g(f({},e),{limits:"adjacent",variant:{"⋒":"ams","⋓":"ams"}[i]}))}}),ex(["Re","Im"],"",{ifMode:"math",createAtom:e=>new lz({"\\Re":"ℜ","\\Im":"ℑ"}[e.command],g(f({},e),{limits:"adjacent",isFunction:!0,variant:"fraktur"}))}),ex("middle","{:delim}",{ifMode:"math",createAtom:e=>{var i;return new ln(g(f({},e),{delim:null!=(i=e.args[0])?i:"|",size:1}))}}),ex("the","{:value}",{createAtom:e=>new oG(g(f({},e),{captureSelection:!0,verbatimLatex:null})),render:(e,i)=>{var r;let a=new oW({parent:i},e.style),o="";return e.isSelected&&(o+=" ML__selected"),new oE((null!=(r=oF(a.evaluate(e.args[0])))?r:"").split("").map(i=>new oE(i,{type:"ord",classes:o,mode:e.mode,isSelected:e.isSelected,style:f({variant:"main"},e.style)})),{type:"lift",style:e.style,caret:e.caret,isSelected:e.isSelected,classes:o}).wrap(a)},serialize:e=>{var i;return`\\the${null!=(i=oF(e.args[0]))?i:"\\relax"}`}}),ex("blank","{body:auto}",{ifMode:"math",isFunction:!0,createAtom:e=>new lA(et(e.args[0]),e)}),ex("DeclareMathOperator","",{ifMode:"math",parse:e=>lq(e,!1),createAtom:lF,render:()=>null,serialize:e=>lV(e,!1)}),ex("DeclareMathOperator*","",{ifMode:"math",parse:e=>lq(e,!0),createAtom:lF,render:()=>null,serialize:e=>lV(e,!0)}),ex("mathtip","{:auto}{:math}",{createAtom:e=>new lE(g(f({},e),{body:et(e.args[0]),tooltip:et(e.args[1]),content:"math"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\mathtip{${e.bodyToLatex(i)}}{${oG.serialize([e.tooltip],g(f({},i),{defaultMode:"math"}))}}`}),ex("texttip","{:auto}{:text}",{createAtom:e=>new lE(g(f({},e),{body:et(e.args[0]),tooltip:et(e.args[1]),content:"text"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\texttip{${e.bodyToLatex(i)}}{${oG.serialize([e.tooltip],g(f({},i),{defaultMode:"text"}))}}`}),ex("error","{:math}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),serialize:(e,i)=>`\\error{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__error"})}),ex("ensuremath","{:math}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),serialize:(e,i)=>`${e.command}{${e.bodyToLatex(g(f({},i),{defaultMode:"math"}))}}`}),ex("color","{:value}",{applyStyle:(e,i,r,a)=>{var o,n;return g(f({},e),{verbatimColor:null!=(o=oF(r[0]))?o:void 0,color:a.toColor(null!=(n=r[0])?n:{string:"red"})})}}),ex("textcolor","{:value}{content:auto*}",{applyStyle:(e,i,r,a)=>{var o,n;return g(f({},e),{verbatimColor:null!=(o=oF(r[0]))?o:void 0,color:a.toColor(null!=(n=r[0])?n:{string:"red"})})}}),ex("boxed","{content:math}",{createAtom:e=>new n0(g(f({},e),{body:et(e.args[0]),framecolor:{string:"black"}}))}),ex("colorbox","{:value}{:text*}",{applyStyle:(e,i,r,a)=>{var o,n;return g(f({},e),{verbatimBackgroundColor:null!=(o=oF(r[0]))?o:void 0,backgroundColor:a.toBackgroundColor(null!=(n=r[0])?n:{string:"yellow"})})}}),ex("fcolorbox","{frame-color:value}{background-color:value}{content:text}",{applyMode:"text",createAtom:e=>{var i,r;return new n0(g(f({},e),{body:et(e.args[2]),framecolor:null!=(i=e.args[0])?i:{string:"blue"},backgroundcolor:null!=(r=e.args[1])?r:{string:"yellow"}}))},serialize:(e,i)=>{var r,a;return i.skipStyles?e.bodyToLatex(g(f({},i),{defaultMode:"text"})):og(e.command,null!=(r=oF(e.framecolor))?r:"",null!=(a=oF(e.backgroundcolor))?a:"",e.bodyToLatex(g(f({},i),{defaultMode:"text"})))}}),ex("bbox","[:bbox]{body:auto}",{createAtom:e=>{var i;let r=e.args[0],a=et(e.args[1]);return new n0(r?g(f({},e),{body:a,padding:r.padding,border:r.border,backgroundcolor:null!=(i=r.backgroundcolor)?i:void 0}):g(f({},e),{body:a}))},serialize:(e,i)=>{var r,a;if(i.skipStyles)return e.bodyToLatex(i);let o=e.command;if(Number.isFinite(e.padding)||void 0!==e.border||void 0!==e.backgroundcolor){let i=[];e.padding&&i.push(null!=(r=oF(e.padding))?r:""),e.border&&i.push(`border: ${e.border}`),e.backgroundcolor&&i.push(null!=(a=oF(e.backgroundcolor))?a:""),o+=`[${i.join(",")}]`}return og(o,e.bodyToLatex(i))}}),ex(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"],"{:rest}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),render:(e,i)=>{let r=new oW({parent:i,mathstyle:e.command.slice(1)},e.style),a=oG.createBox(r,e.body,{type:"lift"});return e.caret&&(a.caret=e.caret),e.bind(i,a)},serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`{${of([e.command,e.bodyToLatex(i)])}}`}),ex(["tiny","scriptsize","footnotesize","small","normalsize","large","Large","LARGE","huge","Huge"],"",{applyStyle:(e,i)=>g(f({},e),{fontSize:{"\\tiny":1,"\\scriptsize":2,"\\footnotesize":3,"\\small":4,"\\normalsize":5,"\\large":6,"\\Large":7,"\\LARGE":8,"\\huge":9,"\\Huge":10}[i]})}),ex("selectfont","",{ifMode:"text",applyStyle:e=>e}),ex("bf","{:rest*}",{applyStyle:e=>g(f({},e),{fontSeries:"b",fontShape:"n",fontFamily:"roman"})}),ex(["boldsymbol","bm","bold"],"{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variantStyle:"bold"})}),ex("bfseries","{:rest*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontSeries:"b"})}),ex("mdseries","{:rest*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontSeries:"m"})}),ex("upshape","{:rest*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"n"})}),ex("slshape","{:rest*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"sl"})}),ex("scshape","{:rest*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"sc"})}),ex("textbf","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontSeries:"b"})}),ex("textmd","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontSeries:"m"})}),ex("textup","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"n"})}),ex("textnormal","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"n",fontSeries:"m"})}),ex("textsl","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"sl"})}),ex("textit","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"it"})}),ex("textsc","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"sc"})}),ex("textrm","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontFamily:"roman"})}),ex("textsf","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontFamily:"sans-serif"})}),ex("texttt","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontFamily:"monospace"})}),ex("mathbf","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"normal",variantStyle:"bold"})}),ex("mathit","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"main",variantStyle:"italic"})}),ex("mathnormal","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"normal",variantStyle:"italic"})}),ex("mathbfit","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"main",variantStyle:"bolditalic"})}),ex("mathrm","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"normal",variantStyle:"up"})}),ex("mathsf","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"sans-serif",variantStyle:"up"})}),ex("mathtt","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"monospace",variantStyle:"up"})}),ex("it","{:rest*}",{applyStyle:e=>g(f({},e),{fontSeries:"m",fontShape:"it",fontFamily:"roman",variantStyle:"italic"})}),ex("rmfamily","{:rest*}",{applyStyle:e=>g(f({},e),{fontFamily:"roman"})}),ex("sffamily","{:rest*}",{applyStyle:e=>g(f({},e),{fontFamily:"sans-serif"})}),ex("ttfamily","{:rest*}",{applyStyle:e=>g(f({},e),{fontFamily:"monospace"})}),ex(["Bbb","mathbb"],"{:math*}",{applyStyle:e=>g(f({},e),{variant:"double-struck",variantStyle:l$(e.variantStyle)})}),ex(["frak","mathfrak"],"{:math*}",{applyStyle:e=>g(f({},e),{variant:"fraktur",variantStyle:l$(e.variantStyle)})}),ex("mathcal","{:math*}",{applyStyle:e=>g(f({},e),{variant:"calligraphic",variantStyle:l$(e.variantStyle)})}),ex("mathscr","{:math*}",{applyStyle:e=>g(f({},e),{variant:"script",variantStyle:l$(e.variantStyle)})}),ex("mbox","{:text}",{ifMode:"math",createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[0]),mode:"math"})),serialize:(e,i)=>og("\\mbox",e.bodyToLatex(g(f({},i),{defaultMode:"text"})))}),ex("text","{:text}",{ifMode:"math",applyMode:"text"}),ex(["class","htmlClass"],"{name:string}{content:auto*}",{createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[1])})),serialize:(e,i)=>!e.args[0]||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`,render:(e,i)=>{var r;return e.createBox(i,{classes:null!=(r=e.args[0])?r:"",boxType:"lift"})}}),ex(["cssId","htmlId"],"{id:string}{content:auto*}",{createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[1])})),serialize:(e,i)=>{var r;return!(null!=(r=e.args)&&r[0])||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;let a=e.createBox(i);return a.cssId=null!=(r=e.args[0])?r:"",a}}),ex("htmlData","{data:string}{content:auto*}",{createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[1])})),serialize:(e,i)=>{var r;return!(null!=(r=e.args)&&r[0])||i.skipStyles?e.bodyToLatex(i):`\\htmlData{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;let a=e.createBox(i);return a.htmlData=null!=(r=e.args[0])?r:"",a}}),ex(["style","htmlStyle"],"{data:string}{content:auto*}",{createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[1])})),serialize:(e,i)=>{var r;return!(null!=(r=e.args)&&r[0])||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;let a=e.createBox(i);return a.htmlStyle=null!=(r=e.args[0])?r:"",a}}),ex("href","{url:string}{content:auto*}",{createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[1])})),render:(e,i)=>{var r;let a=e.createBox(i),o=null!=(r=e.args[0])?r:"";return o&&(a.htmlData=`href=${o}`),a}}),ex("em","{:rest}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`{\\em ${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__emph",boxType:"lift"})}),ex("emph","{:auto}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[1])})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\emph{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__emph",boxType:"lift"})});var lj={"\\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}};ex(["bigl","Bigl","biggl","Biggl","bigr","Bigr","biggr","Biggr","bigm","Bigm","biggm","Biggm","big","Big","bigg","Bigg"],"{:delim}",{createAtom:e=>{var i;return new ll(g(f({},e),{delim:null!=(i=e.args[0])?i:".",size:lj[e.command].size,delimType:lj[e.command].mclass}))},serialize:(e,i)=>of([e.command,/^[a-zA-Z]/.test(e.value)?`{${e.value}}`:e.value])}),ex(["hspace","hspace*"],"{width:value}",{createAtom:e=>{var i;return new lx(g(f({},e),{width:null!=(i=e.args[0])?i:{dimension:0}}))}}),ex(["mkern","kern","mskip","hskip","mspace"],"{width:value}",{createAtom:e=>{var i;return new lx(g(f({},e),{width:null!=(i=e.args[0])?i:{dimension:0}}))}}),ex("\\","",{createAtom:e=>new lT(e)}),ex("mathchoice","{:math}{:math}{:math}{:math}",{createAtom:e=>new oG(e),render:(e,i)=>{let r=0,a=i.mathstyle.id;(5===a||4===a)&&(r=1),(3===a||2===a)&&(r=2),(1===a||0===a)&&(r=3);let o=et(e.args[r]);return oG.createBox(i,o)},serialize:(e,i)=>`\\mathchoice{${oG.serialize(e.args[0],i)}}{${oG.serialize(e.args[1],i)}}{${oG.serialize(e.args[2],i)}}{${oG.serialize(e.args[3],i)}}`}),ex("mathop","{:auto}",{createAtom:e=>new oG(g(f({},e),{type:"mop",body:et(e.args[0]),limits:"over-under",isFunction:!0,captureSelection:!0})),render:(e,i)=>{var r;let a=oG.createBox(i,e.body);if(e.superscript||e.subscript){let o=null!=(r=e.subsupPlacement)?r:"auto";a="over-under"===o||"auto"===o&&i.isDisplayStyle?e.attachLimits(i,{base:a}):e.attachSupsub(i,{base:a})}return e.caret&&(a.caret=e.caret),new oE(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"ML__op-group"})},serialize:(e,i)=>{let r=[og(e.command,e.bodyToLatex(i))];return e.explicitSubsupPlacement&&("over-under"===e.subsupPlacement&&r.push("\\limits"),"adjacent"===e.subsupPlacement&&r.push("\\nolimits"),"auto"===e.subsupPlacement&&r.push("\\displaylimits")),r.push(e.supsubToLatex(i)),of(r)}}),ex(["mathbin","mathrel","mathopen","mathclose","mathpunct","mathord","mathinner"],"{:auto}",{createAtom:e=>new oG(g(f({},e),{type:{"\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[e.command],body:et(e.args[0])}))}),ex(["operatorname","operatorname*"],"{operator:math}",{createAtom:e=>{let i=et(e.args[0]).map(e=>{var i;return"first"!==e.type&&(e.type="mord",e.value=null!=(i=({"∗":"*","−":"-"})[e.value])?i:e.value,e.isFunction=!1,e.style.variant||e.style.variantStyle||(e.style.variant="main",e.style.variantStyle="up")),e});return new oG(g(f({},e),{type:"mop",body:i,isFunction:!0,limits:"\\operatorname"===e.command?"adjacent":"over-under"}))},render:(e,i)=>{var r;let a=oG.createBox(i,e.body);if(e.superscript||e.subscript){let o=null!=(r=e.subsupPlacement)?r:"auto";a="over-under"===o||"auto"===o&&i.isDisplayStyle?e.attachLimits(i,{base:a}):e.attachSupsub(i,{base:a})}return e.caret&&(a.caret=e.caret),new oE(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"ML__op-group"})},serialize:(e,i)=>{let r=[og(e.command,e.bodyToLatex(i))];return e.explicitSubsupPlacement&&("over-under"===e.subsupPlacement&&r.push("\\limits"),"adjacent"===e.subsupPlacement&&r.push("\\nolimits"),"auto"===e.subsupPlacement&&r.push("\\displaylimits")),r.push(e.supsubToLatex(i)),of(r)}}),ex(["char","unicode"],"{charcode:value}",{createAtom:e=>new oG(g(f({},e),{type:"text"===e.mode?"text":"mord"})),serialize:e=>{var i;return`${e.command}${oF(null!=(i=e.args[0])?i:{number:10067,base:"hexadecimal"})}`},render:(e,i)=>{let r=i.evaluate(e.args[0]);return r&&"number"in r||(r={number:10067,base:"hexadecimal"}),e.value=String.fromCodePoint(r.number),e.createBox(i)}}),ex("rule","[raise:value]{width:value}{thickness:value}",{createAtom:e=>new oG(e),render:(e,i)=>{var r,a,o;let n=new oW({parent:i,mathstyle:"textstyle"},e.style),l=n.toEm(null!=(r=e.args[0])?r:{dimension:0}),s=n.toEm(null!=(a=e.args[1])?a:{dimension:10}),c=n.toEm(null!=(o=e.args[2])?o:{dimension:10}),d=new oE(null,{classes:"ML__rule",type:"ord"});return d.width=s,d.height=c+l,d.depth=-l,d.setStyle("border-right-width",s,"em"),d.setStyle("border-top-width",c,"em"),d.setStyle("border-color",e.style.color),d.setStyle("vertical-align",l,"em"),e.isSelected&&d.setStyle("opacity","50%"),e.bind(n,d),e.caret&&(d.caret=e.caret),d.wrap(i)},serialize:e=>`\\rule${e.args[0]?`[${oF(e.args[0])}]`:""}{${oF(e.args[1])}}{${oF(e.args[2])}}`}),ex(["overline","underline"],"{:auto}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),render:(e,i)=>{let r,a=e.command.substring(1),o=new oW({parent:i,mathstyle:"cramp"},e.style),n=oG.createBox(o,e.body);if(!n)return null;let l=o.metrics.defaultRuleThickness/o.scalingFactor,s=new oE(null,{classes:a+"-line"});return s.height=l,s.maxFontSize=1.125*l*o.scalingFactor,r=new oB("overline"===a?{shift:0,children:[{box:n},3*l,{box:s},l]}:{top:n.height,children:[l,{box:s},3*l,{box:n}]}),e.caret&&(r.caret=e.caret),new oE(r,{classes:a,type:"ignore"})}}),ex("overset","{:auto}{base:auto}",{createAtom:e=>{let i=et(e.args[1]);return new ly(g(f({},e),{above:et(e.args[0]),body:i,skipBoundary:!1,boxType:oL(i)}))},serialize:(e,i)=>og(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),ex("underset","{:auto}{base:auto}",{createAtom:e=>{let i=et(e.args[1]);return new ly(g(f({},e),{below:et(e.args[0]),body:i,skipBoundary:!1,boxType:oL(i)}))},serialize:(e,i)=>og(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),ex("overunderset","{above:auto}{below:auto}{base:auto}",{createAtom:e=>{let i=et(e.args[2]);return new ly(g(f({},e),{above:et(e.args[0]),below:et(e.args[1]),body:i,skipBoundary:!1,boxType:oL(i)}))},serialize:(e,i)=>og(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),ex(["stackrel","stackbin"],"[below:auto]{above:auto}{base:auto}",{createAtom:e=>new ly(g(f({},e),{body:et(e.args[2]),above:et(e.args[1]),below:et(e.args[0]),skipBoundary:!1,boxType:"\\stackrel"===e.command?"rel":"bin"})),serialize:(e,i)=>og(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),ex("smash","[:string]{:auto}",{createAtom:e=>{var i,r,a,o;return new lv(g(f({},e),{body:et(e.args[1]),smashHeight:null==(r=null==(i=e.args[0])?void 0:i.includes("t"))||r,smashDepth:null==(o=null==(a=e.args[0])?void 0:a.includes("b"))||o}))}}),ex("vphantom","{:auto}",{createAtom:e=>new lv(g(f({},e),{body:et(e.args[0]),isInvisible:!0,smashWidth:!0}))}),ex("hphantom","{:auto}",{createAtom:e=>new lv(g(f({},e),{body:et(e.args[0]),isInvisible:!0,smashHeight:!0,smashDepth:!0}))}),ex("phantom","{:auto}",{createAtom:e=>new lv(g(f({},e),{body:et(e.args[0]),isInvisible:!0}))}),ex("mathstrut","",{createAtom:e=>new lv(g(f({},e),{body:[new oG({value:"("})],isInvisible:!0}))}),ex("not","{:math}",{createAtom:e=>{let i=et(e.args[0]);return new oG(0===i.length?g(f({},e),{type:"mrel",value:""}):g(f({},e),{body:[new lb(g(f({},e),{body:"",align:"right"})),...i],captureSelection:!0}))},serialize:(e,i)=>{let r=e.args[0],a=r&&"object"==typeof r&&"group"in r;return""!==e.value?a?`\\not{${oG.serialize(r.group,i)}}`:`\\not${oG.serialize(r,i)}`:a?"\\not{}":"\\not"},render:(e,i)=>{if(e.value)return e.createBox(i);let r=e.args[0]&&"object"==typeof e.args[0]&&"group"in e.args[0]?"ord":oL(et(e.args[0])),a=oG.createBox(i,e.body,{type:r});return e.caret&&(a.caret=e.caret),e.bind(i,a)}}),ex(["ne","neq"],"",{createAtom:e=>new oG(g(f({},e),{type:"mrel",body:[new lb(g(f({},e),{body:"",align:"right",boxType:"rel"})),new oG(g(f({},e),{value:"="}))],captureSelection:!0})),serialize:e=>e.command}),ex("rlap","{:auto}",{createAtom:e=>new lb(g(f({},e),{body:et(e.args[0]),align:"right"}))}),ex("llap","{:auto}",{createAtom:e=>new lb(g(f({},e),{body:et(e.args[0]),align:"left"}))}),ex("mathrlap","{:math}",{createAtom:e=>new lb(g(f({},e),{body:et(e.args[0]),align:"right"}))}),ex("mathllap","{:math}",{createAtom:e=>new lb(g(f({},e),{body:et(e.args[0]),align:"left"}))}),ex("raisebox","{:value}{:text}",{createAtom:e=>{var i;return new n0(g(f({},e),{body:et(e.args[1]),padding:{dimension:0},offset:null!=(i=e.args[0])?i:{dimension:0}}))},serialize:(e,i)=>{var r;return og("\\raisebox",null!=(r=oF(e.offset))?r:"0pt",e.bodyToLatex(i))}}),ex("raise","{:value}{:auto}",{createAtom:e=>{var i;return new n0(g(f({},e),{body:et(e.args[1]),padding:{dimension:0},offset:null!=(i=e.args[0])?i:{dimension:0}}))},serialize:(e,i)=>{var r;return og("\\raise",null!=(r=oF(e.offset))?r:"0pt",e.bodyToLatex(i))}}),ex("lower","{:value}{:auto}",{createAtom:e=>{var i;return new n0(g(f({},e),{body:et(e.args[1]),padding:{dimension:0},offset:null!=(i=oV(e.args[0],-1))?i:{dimension:0}}))},serialize:(e,i)=>{var r,a;return og("\\lower",null!=(a=oF(oV(null!=(r=e.offset)?r:{dimension:0},-1)))?a:"0pt",e.bodyToLatex(i))}}),eh("0123456789/@.?!"),ep(65,90),ep(97,122),eh([["\\forall",8704],["\\exists",8707],["\\nexists",8708,"mord","ams"],["\\mid",8739,"mrel"],["\\top",8868],["\\bot",8869]]),eh([["\\#",35],["\\&",38],["\\parallelogram",9649],["\\spadesuit",9824],["\\heartsuit",9825],["\\diamondsuit",9826],["\\clubsuit",9827],["\\flat",9837],["\\natural",9838],["\\sharp",9839]]),eh([["\\backslash",92],["\\nabla",8711],["\\partial",8706],["\\ell",8467],["\\hbar",8463],["\\pounds",163],["\\euro",8364]]),eh([["\\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"),eh([["\\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"]]),eh([["\\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"]]),eh([["\\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"),eh([["+",43],["-",8722],["−",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"),eh([["\\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"),eh([["\\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]]),eh([["=",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"),eh([["\\lnot",172],["\\neg",172],["\\triangle",9651],["\\subsetneq",8842],["\\varsubsetneq",57370],["\\subsetneqq",10955],["\\varsubsetneqq",57367],["\\nsubset",8836],["\\nsupset",8837],["\\nsubseteq",8840],["\\nsupseteq",8841]],"mrel","ams"),eh([["\\wp",8472],["\\aleph",8501]]),eh([["\\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"),eh([["\\ ",160],["~",160]],"space"),ex(["!",",",":",";",">","enskip","enspace","quad","qquad","thinspace","negthinspace","medspace","thickspace"],"",{createAtom:e=>new lx(e)}),ex("space","",{createAtom:e=>new lx(e)}),eh([["\\colon",58],["\\cdotp",8901],["\\vdots",8942,"mord"],["\\ldotp",46],[",",44],[";",59]],"mpunct"),eh([["\\cdots",8943],["\\ddots",8945],["\\ldots",8230],["\\dots",8230],["\\mathellipsis",8230]],"minner"),eh([["\\/",47],["|",8739,"mord"],["\\imath",305],["\\jmath",567],["\\degree",176],["'",8242],['"',8221]]);var lH={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"]},lW={"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]$/},lU=/^[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5]$/,lJ=[/^[a-z]$/,/^[A-Z]$/,lU,/^[\u0393|\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A6\u03A8\u03A9]$/],lX={iso:["it","it","it","it"],tex:["it","it","it","up"],french:["it","up","up","up"],upright:["up","up","up","up"]};function lG(e,i){let{parent:r}=e[0],a=ow(r);return ok(e,"variant").map(e=>{let r=ow(e[0]),o="";r&&r!==a&&(o=({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"})[r]);let n="",l=e[e.length-1],s=o&&e.length>0&&(void 0!==l.branch("subscript")||void 0!==l.branch("superscript"));s&&(n=l.supsubToLatex(i));let c=of(e.map((r,a)=>{if(s&&a===e.length-1){let e=eM(r.command,r.mode);return null!=e&&e.serialize?e.serialize(r,i):r.body&&r.command?og(r.command,r.bodyToLatex(i)):r.body?r.bodyToLatex(i):r.value&&"​"!==r.value?r.command||r.value:""}return r._serialize(i)}));return o?og(o,c)+n:c})}new class extends ov{constructor(){super("math")}createAtom(e,i,r){var a,o,n,l,s,c;let d;if(null===i)return new oG({type:"mord",mode:"math",command:e,value:e,style:r});try{d=null!=(n=null==(o=globalThis.MathfieldElement)?void 0:o.isFunction(null!=(a=i.command)?a:e))&&n}catch(e){d=!1}if("symbol"===i.definitionType){let a=new oG({type:null!=(l=i.type)?l:"mord",mode:"math",command:null!=(s=i.command)?s:e,value:String.fromCodePoint(i.codepoint),isFunction:d,style:r});return e.startsWith("\\")&&(a.verbatimLatex=e),a}let u=new oG({type:"mord",mode:"math",command:null!=(c=i.command)?c:e,value:e,isFunction:d,style:r});return e.startsWith("\\")&&(u.verbatimLatex=e),u}serialize(e,i){var r,a;let o=(r=e,a=g(f({},i),{defaultMode:"math"}),ok(r,"bold").map(e=>{if("bold"!==o_(e[0])||"bold"===o_(e[0].parent))return of(lG(e,a));let i=of(e.map(e=>{var i;return null!=(i=e.value)?i:""}));return/^[a-zA-Z0-9]+$/.test(i)?og("\\mathbf",of(lG(e,a))):og("\\bm",of(lG(e,a)))}));return 0===o.length||"text"!==i.defaultMode?o:["$ ",...o," $"]}getFont(e,i){var r,a,o,n;if(i.variant,i.fontFamily){let a=i.fontFamily;"b"===i.fontSeries&&"it"===i.fontShape?a+="-bolditalic":"b"===i.fontSeries?a+="-bold":"it"===i.fontShape&&(a+="-italic");let o=null!=(r=lH[a])?r:lH[i.fontFamily];if(!o)return console.error(`Unknown font family variant: ${a}`),null;let[n,l]=o;return l&&(e.classes+=" "+l),n}let{variant:l}=i,{variantStyle:s}=i;if("normal"===l&&!s&&/[\u00A3\u0131\u0237]/.test(e.value)&&(l="main",s="italic"),"normal"===l&&!s&&1===e.value.length){let r=!1;lJ.forEach((a,o)=>{var n;a.test(e.value)&&"it"===lX[null!=(n=i.letterShapeStyle)?n:"tex"][o]&&(r=!0)}),r&&(s=({up:"italic",bold:"bolditalic",italic:"italic",bolditalic:"bolditalic","":"italic"})[null!=(n=s)?n:""])}"up"===s&&(s=void 0);let c=s?l+"-"+s:l;lH[c];let[d,u]=lH[c];if(lW[l]&&!lW[l].test(e.value)){let i=ee(e.value,l,s);return i||(i=null!=(a=ee(e.value,l))?a:e.value,e.classes+=null!=(o=({bold:" ML__bold",italic:" ML__it","bold-italic":" ML__bold ML__it"})[null!=s?s:""])?o:""),e.value=i,null}return lU.test(e.value)&&(e.classes+=" lcGreek"),u&&(e.classes+=" "+u),d}};var lZ={roman:"","sans-serif":"ML__sans",monospace:"ML__tt"};function lY(e){var i;let r=/macos|ios/.test(w()),a=e.split("+"),o="";for(let e of a)o&&(o+=r?" ":'<span class="ML__shortcut-join">+</span>'),e.startsWith("[Key")?o+=e.slice(4,5):e.startsWith("Key")?o+=e.slice(3,4):e.startsWith("[Digit")?o+=e.slice(6,7):e.startsWith("Digit")?o+=e.slice(5,6):o+=null!=(i=({cmd:"⌘",meta:r?"⌘":"Ctrl",shift:r?"⇧":"Shift",alt:r?"⌥":"Alt",ctrl:r?"⌃":"Ctrl","\n":r?"⏎":"Return","[return]":r?"⏎":"Return","[enter]":r?"⌤":"Enter","[tab]":r?"⇥":"Tab","[escape]":"Esc","[backspace]":r?"⌫":"Backspace","[delete]":r?"⌦":"Del","[pageup]":r?"⇞":"Page Up","[pagedown]":r?"⇟":"Page Down","[home]":r?"⤒":"Home","[end]":r?"⤓":"End","[space]":"Space","[equal]":"=","[minus]":"-","[comma]":",","[slash]":"/","[backslash]":"\\","[bracketleft]":"[","[bracketright]":"]",semicolon:";",period:".",comma:",",minus:"-",equal:"=",quote:"'",backslash:"\\",intlbackslash:"\\",backquote:"`",slash:"/",numpadmultiply:"* &#128290;",numpaddivide:"/ &#128290;",numpadsubtract:"- &#128290;",numpadadd:"+ &#128290;",numpaddecimal:". &#128290;",numpadcomma:", &#128290;",help:"help",left:"⇠",up:"⇡",right:"⇢",down:"⇣","[arrowleft]":"⇠","[arrowup]":"⇡","[arrowright]":"⇢","[arrowdown]":"⇣"})[e.toLowerCase()])?i:e.toUpperCase();return o}function lQ(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return{x:e.clientX,y:e.clientY};if("u">typeof TouchEvent&&e instanceof TouchEvent){let i=[...e.touches].reduce((e,i)=>({x:e.x+i.clientX,y:e.y+i.clientY}),{x:0,y:0}),r=e.touches.length;return{x:i.x/r,y:i.y/r}}}function l0(e){let i={alt:!1,control:!1,shift:!1,meta:!1};return(e instanceof MouseEvent||e instanceof PointerEvent||"u">typeof TouchEvent&&e instanceof TouchEvent||e instanceof KeyboardEvent)&&(e.altKey&&(i.alt=!0),e.ctrlKey&&(i.control=!0),e.metaKey&&(i.meta=!0),e.shiftKey&&(i.shift=!0)),i}new class extends ov{constructor(){super("text")}createAtom(e,i,r){return i&&"symbol"===i.definitionType?new oY(e,String.fromCodePoint(i.codepoint),null!=r?r:{}):null}serialize(e,i){var r,a;return r=g(f({},i),{defaultMode:"text"}),a="text"!==i.defaultMode,ok(e,"fontFamily").map(e=>{var i;a=a&&!e.every(e=>e.style.fontFamily||e.style.fontShape||e.style.fontSeries||e.style.fontSize);let o=ok(e,"fontSize").map(e=>{var i,a;let o=ok(e,"fontSeries").map(e=>{let i=ok(e,"fontShape").map(e=>{let i=e.map(e=>e._serialize(r)),{fontShape:a}=e[0].style,o="";return"it"===a&&(o="\\textit"),"sl"===a&&(o="\\textsl"),"sc"===a&&(o="\\textsc"),"n"===a&&(o="\\textup"),!o&&a?`{${og("\\fontshape",a)}${of(i)}}`:o?og(o,of(i)):of(i)}),{fontSeries:a}=e[0].style,o="";return"b"===a&&(o="\\textbf"),"l"===a&&(o="\\textlf"),"m"===a&&(o="\\textmd"),a&&!o?`{${og("\\fontseries",a)}${of(i)}}`:o?og(o,of(i)):of(i)}),n=null!=(a=["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][null!=(i=e[0].style.fontSize)?i:""])?a:"";return n?`${n} ${of(o)}`:of(o)}),{fontFamily:n}=e[0].style,l=null!=(i=({roman:"textrm",monospace:"texttt","sans-serif":"textsf"})[null!=n?n:""])?i:"";return l?`\\${l}{${of(o)}}`:n?`{\\fontfamily{${e[0].style.fontFamily}} ${of(o)}}`:a?`\\text{${of(o)}}`:of(o)})}getFont(e,i){var r,a,o,n,l;let{fontFamily:s}=i;if(lZ[s]?e.classes+=" "+lZ[s]:s&&e.setStyle("font-family",s),i.fontShape&&(e.classes+=" ",e.classes+=null!=(r=({it:"ML__it",sl:"ML__shape_sl",sc:"ML__shape_sc",ol:"ML__shape_ol"})[i.fontShape])?r:""),i.fontSeries){let r=i.fontSeries.match(/(.?[lbm])?(.?[cx])?/);r&&(e.classes+=" ",e.classes+=null!=(o=({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"})[null!=(a=r[1])?a:""])?o:"",e.classes+=" ",e.classes+=null!=(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"})[null!=(n=r[2])?n:""])?l:"")}return"Main-Regular"}},new class extends ov{constructor(){super("latex")}createAtom(e){return new lm(e)}serialize(e,i){return e.filter(e=>e instanceof lm&&!e.isSuggestion).map(e=>e.value)}getFont(){return null}};var l1=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 l4(e){return!(e.ctrlKey||e.metaKey||["Dead","Process"].includes(e.key))&&(""===e.code||l1.has(e.code))}function l2(){var e;let i=document.activeElement;for(;null!=(e=null==i?void 0:i.shadowRoot)&&e.activeElement;)i=i.shadowRoot.activeElement;return i}var l3=class e{static get scrim(){return e._scrim||(e._scrim=new e),e._scrim}static open(i){e.scrim.open(i)}static close(){e.scrim.close()}static get state(){return e.scrim.state}static get element(){return e.scrim.element}constructor(e){var i,r;this.lightDismiss=null==(i=null==e?void 0:e.lightDismiss)||i,this.translucent=null!=(r=null==e?void 0:e.translucent)&&r,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 i;if("closed"!==this.state)return;this.state="opening",this.onDismiss=null==e?void 0:e.onDismiss,this.savedActiveElement=l2();let{element:r}=this;(null!=(i=null==e?void 0:e.root)?i:document.body).appendChild(r),r.addEventListener("click",this),document.addEventListener("touchmove",this,!1),document.addEventListener("scroll",this,!1);let a=window.innerWidth-document.documentElement.clientWidth;this.savedMarginRight=document.body.style.marginRight,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden";let o=Number.parseFloat(getComputedStyle(document.body).marginRight);document.body.style.marginRight=`${o+a}px`;let n=document.querySelector(".MLK__plate");if(n instanceof HTMLElement){this.savedMlkPaddingRight=n.style.paddingRight;let e=Number.parseFloat(getComputedStyle(n).paddingRight);n.style.paddingRight=`${e+a}px`}null!=e&&e.child&&r.append(e.child),this.state="open"}close(){var e,i,r,a,o;if("open"!==this.state)return void this.element.parentElement;this.state="closing","function"==typeof this.onDismiss&&this.onDismiss(),this.onDismiss=void 0;let{element:n}=this;n.removeEventListener("click",this),document.removeEventListener("touchmove",this,!1),document.removeEventListener("scroll",this,!1),n.remove(),document.body.style.overflow=null!=(e=this.savedOverflow)?e:"",document.body.style.marginRight=null!=(i=this.savedMarginRight)?i:"";let l=document.querySelector(".MLK__plate");l instanceof HTMLElement&&(l.style.paddingRight=null!=(r=this.savedMlkPaddingRight)?r:""),l2()!==this.savedActiveElement&&(null==(o=null==(a=this.savedActiveElement)?void 0:a.focus)||o.call(a)),n.innerHTML="",this.state="closed"}handleEvent(e){this.lightDismiss&&(e.target===this._element&&"click"===e.type?(this.close(),e.preventDefault(),e.stopPropagation()):e.target===document&&("touchmove"===e.type||"scroll"===e.type)&&(this.close(),e.preventDefault(),e.stopPropagation()))}};function l6(e){var i;let r;return e&&l4(e)?("Unidentified"===e.key&&e.target&&(r=e.target.value),r=null!=(i=null!=r?r:e.key)?i:e.code,/^(Dead|Return|Enter|Tab|Escape|Delete|PageUp|PageDown|Home|End|Help|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)$/.test(r)&&(r=""),r):""}function l8(e){e=function(e){if(e.code)return e;let i=Object.entries($().mapping),r=!1,a=!1,o="";for(let n=0;n<4;n++){for(let[l,s]of i)if(s[n]===e.key){o=l,3===n?(r=!0,a=!0):2===n?r=!0:1===n&&(a=!0);break}if(o)break}return new KeyboardEvent(e.type,g(f({},e),{altKey:r,shiftKey:a,code:o}))}(e);let i=[];return e.ctrlKey&&i.push("ctrl"),e.metaKey&&i.push("meta"),e.altKey&&i.push("alt"),e.shiftKey&&i.push("shift"),0===i.length?`[${e.code}]`:(i.push(`[${e.code}]`),i.join("+"))}function l5(e){let i=e;return I(i)&&(i=i.length>0?i[0]+"("+i.slice(1).join("")+")":""),i}function l7(e){if(Array.isArray(e)){let i=[...e];return i.shift()+"("+i.map(e=>"string"==typeof e?`"${e}"`:e.toString()).join(", ")+")"}return e}function l9(e){return e.atoms.find(e=>"latexgroup"===e.type)}function se(e){var i,r;let a=l9(e);return null!=(r=null==(i=null==a?void 0:a.body)?void 0:i.filter(e=>"latex"===e.type))?r:[]}function st(e,i){var r;let a=0,o=!1,n=Number.isFinite(null==i?void 0:i.before)?null!=(r=null==i?void 0:i.before)?r:0:e.lastOffset;for(;a<=n&&!o;){let i=e.at(a);(o=i instanceof lm&&i.isSuggestion)||a++}if(!o)return[void 0,void 0];let l=a,s=!1;for(;l<=n&&!s;){let i=e.at(l);(s=!(i instanceof lm&&i.isSuggestion))||l++}return[a-1,l-1]}function si(e,i){var r,a,o,n,l,s,c,d,u,h;let p={};if("string"==typeof i.color){let n=null!=(a=e.colorMap(null!=(r=i.color)?r:i.verbatimColor))?a:"none";n!==i.color&&(p.verbatimColor=null!=(o=i.verbatimColor)?o:i.color),p.color=n}if("string"==typeof i.backgroundColor){let r=null!=(l=e.backgroundColorMap(null!=(n=i.backgroundColor)?n:i.verbatimBackgroundColor))?l:"none";r!==i.backgroundColor&&(p.verbatimBackgroundColor=null!=(s=i.verbatimBackgroundColor)?s:i.backgroundColor),p.backgroundColor=r}"string"==typeof i.fontFamily&&(p.fontFamily=i.fontFamily),"string"==typeof i.series&&(p.fontSeries=i.series),"string"==typeof i.fontSeries&&(p.fontSeries=i.fontSeries.toLowerCase()),p.fontSeries&&(p.fontSeries=null!=(c=({bold:"b",medium:"m",normal:"m"})[p.fontSeries])?c:p.fontSeries),"string"==typeof i.shape&&(p.fontShape=i.shape),"string"==typeof i.fontShape&&(p.fontShape=i.fontShape.toLowerCase()),p.fontShape&&(p.fontShape=null!=(d=({italic:"it",up:"n",upright:"n",normal:"n"})[p.fontShape])?d:p.fontShape),i.variant&&(p.variant=i.variant.toLowerCase()),void 0!==i.variantStyle&&(p.variantStyle="string"==typeof i.variantStyle&&""!==i.variantStyle?i.variantStyle.toLowerCase():i.variantStyle);let m=null!=(u=i.size)?u:i.fontSize;return"number"==typeof m?p.fontSize=Math.max(1,Math.min(10,m)):"string"==typeof m&&(p.fontSize=null!=(h=({size1:1,size2:2,size3:3,size4:4,size5:5,size6:6,size7:7,size8:8,size9:9,size10:10})[m.toLowerCase()])?h:({tiny:1,scriptsize:2,footnotesize:3,small:4,normal:5,normalsize:5,large:6,Large:7,LARGE:8,huge:9,Huge:10})[m]),p}function sr(e,i,r){var a,o;let n=e.model;if("latex"===n.mode)return{};let l=e.styleBias;if("none"===l)return e.defaultStyle;if("text"===n.mode)return null!=(o=null==(a=n.at("right"===l?r.after:r.before))?void 0:a.style)?o:e.defaultStyle;if("math"===n.mode){let i=n.at("right"===l?r.after:r.before);return f(i?g(f({},i.style),{variant:"normal"}):{variant:"normal"},e.defaultStyle)}return{}}function sa(e){let i=e.options.onInsertStyle;if(null===i)return{};void 0===i&&(i=sr);let r=e.model,a=e.styleBias,o=r.at(r.position),n=so(r,o,a),l=so(r,o.rightSibling,a);return i(e,r.position,{before:n,after:l})}function so(e,i,r){var a;return i&&("first"!==i.type||"right"===r)?"group"!==i.type?e.offsetOf(i):!i.body||i.body.length<2?-1:(null==(a=i.body)?void 0:a.length)===1||"right"!==r?e.offsetOf(i.body[0]):e.offsetOf(i.body[i.body.length-1]):-1}function sn(e){let i=se(e.model).filter(e=>e.isSuggestion);if(0!==i.length)for(let r of(e.model.position=e.model.offsetOf(i[0].leftSibling),i))r.parent.removeChild(r)}function sl(e,i){var r,a;let{model:o}=e;for(let i of(sn(e),se(o)))i.isError=!1;if(!o.selectionIsCollapsed||"off"===e.options.popoverPolicy)return void sy(e);let n=[],l=o.at(o.position);for(;l&&l instanceof lm&&/^[a-zA-Z\*]$/.test(l.value);)l=l.leftSibling;let s="",c=!1;if(l&&l instanceof lm&&"\\"===l.value){for(c=!0,n.push(l),l=l.rightSibling;l&&l instanceof lm&&/^[a-zA-Z\*]$/.test(l.value);)n.push(l),l=l.rightSibling;s=n.map(e=>e.value).join("")}else{let e=[],i=null!=(r=o.at(o.position-1))?r:o.at(o.position);for(;i&&i instanceof lm&&/^[a-zA-Z]$/.test(i.value);)e.unshift(i),i=i.leftSibling;e.length>=1&&!(i&&i instanceof lm&&"\\"===i.value)&&(s="\\"+e.map(e=>e.value).join(""),n.push(...e))}let d=function(e,i){var r,a;if(0===i.length||"\\"===i||!i.startsWith("\\"))return[];let o=[],n=i.substring(1).toLowerCase();for(let[e,i]of Object.entries(em))if(e.startsWith(n))for(let e of i){let i=e.startsWith("\\")?e:"\\"+e;o.push({match:i,frequency:1e4})}for(let e in en)e.startsWith(i)&&!en[e].infix&&o.push({match:e,frequency:null!=(r=en[e].frequency)?r:0});for(let e in ea)e.startsWith(i)&&o.push({match:e,frequency:null!=(a=ea[e].frequency)?a:0});let l=i.substring(1);for(let i of Object.keys(e.options.macros))i.startsWith(l)&&o.push({match:"\\"+i,frequency:0});for(let[e,r]of Object.entries({alpha:["\\alpha","\\Alpha"],beta:["\\beta","\\Beta"],gamma:["\\gamma","\\Gamma"],delta:["\\delta","\\Delta"],epsilon:["\\epsilon","\\varepsilon","\\Epsilon"],theta:["\\theta","\\vartheta","\\Theta"],pi:["\\pi","\\varpi","\\Pi"],rho:["\\rho","\\varrho","\\Rho"],sigma:["\\sigma","\\varsigma","\\Sigma"],phi:["\\phi","\\varphi","\\Phi"],psi:["\\psi","\\Psi"],omega:["\\omega","\\Omega"]}))if(("\\"+e).startsWith(i))for(let e of r)o.some(i=>i.match===e)||o.push({match:e,frequency:5e3});let s=new Set,c=o.filter(e=>!s.has(e.match)&&(s.add(e.match),!0)),d=["\\alpha","\\beta","\\gamma","\\delta","\\epsilon","\\zeta","\\eta","\\theta","\\iota","\\kappa","\\lambda","\\mu","\\nu","\\xi","\\omicron","\\pi","\\rho","\\sigma","\\tau","\\upsilon","\\phi","\\chi","\\psi","\\omega","\\Gamma","\\Delta","\\Theta","\\Lambda","\\Xi","\\Pi","\\Sigma","\\Upsilon","\\Phi","\\Psi","\\Omega","\\varepsilon","\\vartheta","\\varpi","\\varrho","\\varsigma","\\varphi"];return c.sort((e,i)=>{var r,a;let o=d.includes(e.match),n=d.includes(i.match);return o&&!n?-1:!o&&n?1:e.frequency===i.frequency?e.match.length===i.match.length?e.match<i.match?-1:1:e.match.length-i.match.length:(null!=(r=i.frequency)?r:0)-(null!=(a=e.frequency)?a:0)}),c.map(e=>e.match)}(e,s);if(0===d.length){if(c&&/^\\[a-zA-Z\*]+$/.test(s))for(let e of n)e.isError=!0;sy(e);return}let u=null!=(a=null==i?void 0:i.atIndex)?a:0;e.suggestionIndex=u<0?d.length-1:u%d.length,d[e.suggestionIndex],function(e,i){var r,a,o,n,l,s;let c;if(0===i.length)return sy(e);let d=document.getElementById("mathlive-suggestion-popover"),u=null==d?void 0:d.classList.contains("is-visible"),h=sp.length!==i.length||sp.some((e,r)=>e!==i[r]);if(u&&!h){let i;o=d,n=e.suggestionIndex,(i=o.querySelectorAll("li")).forEach(e=>{e.classList.remove("ML__popover__current")}),n>=0&&n<i.length&&i[n].classList.add("ML__popover__current"),null==(r=d.querySelector(".ML__popover__current"))||r.scrollIntoView({block:"nearest",inline:"nearest"});return}sp=[...i];let p=["\\text","\\textbf","\\textit","\\textrm","\\textsf","\\texttt","\\textmd","\\textup","\\textnormal","\\textsl","\\textsc","\\mathbf","\\mathit","\\mathrm","\\mathsf","\\mathtt","\\mathbb","\\mathcal","\\mathscr","\\mathfrak","\\mathnormal","\\mathbfit","\\Bbb","\\frak","\\bf","\\it","\\rm","\\sf","\\tt","\\rmfamily","\\sffamily","\\ttfamily","\\bfseries","\\mdseries","\\upshape","\\slshape","\\scshape","\\boldsymbol","\\bm","\\bold","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge","\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle","\\color","\\textcolor","\\colorbox","\\fcolorbox","\\boxed","\\em","\\emph","\\the"],m=[],f=[],g=[];for(let r of i){let i=r;if(p.some(e=>i.startsWith(e)))continue;let a=function(e,i){let r=new oW({from:e.context});return oz(oA(lL(new oE(new oG({mode:"math",type:"root",body:lt(i,{context:r})}).render(r),{classes:"ML__base"}),r)),{classes:"ML__latex"}).toMarkup()}(e,r),o=(function(e,i){let r=[];if("string"==typeof i){let e=nn[i];I(e)?r=e.slice():e&&r.push(e)}let a=RegExp("^"+l5(i).replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");for(let i of e)a.test(l5(i.command))&&r.push(i.key);return r.map(lY)})(e.keybindings,i).join("<br>"),n={command:i,markup:a,keybinding:o},l=["\\alpha","\\beta","\\gamma","\\delta","\\epsilon","\\zeta","\\eta","\\theta","\\iota","\\kappa","\\lambda","\\mu","\\nu","\\xi","\\omicron","\\pi","\\rho","\\sigma","\\tau","\\upsilon","\\phi","\\chi","\\psi","\\omega","\\Gamma","\\Delta","\\Theta","\\Lambda","\\Xi","\\Pi","\\Sigma","\\Upsilon","\\Phi","\\Psi","\\Omega","\\varepsilon","\\vartheta","\\varpi","\\varrho","\\varsigma","\\varphi"];i.startsWith("\\mathbb")||i.startsWith("\\mathcal")||2===i.length||l.some(e=>i===e||i.startsWith(e+" "))?g.push(n):i.length>3&&!i.includes("{")?m.push(n):g.push(n)}let b=[],y=(i,r,a=!1)=>{let o=r===e.suggestionIndex?"ML__popover__current":"",n=r<9?`\u2318${r+1}`:"",l=`<li role="button" data-command="${sh(i.command)}" class="${o} ${a?"ML__popover__item--grid":"ML__popover__item--list"}" tabindex="0">`;return a?(l+=`<span class="ML__popover__command">${i.markup}</span>`,n&&(l+=`<span class="ML__popover__shortcut">${n}</span>`)):(l+=`<span class="ML__popover__icon">${i.markup}</span><div class="ML__popover__label-group"><span class="ML__popover__latex">${sh(i.command)}</span><span class="ML__popover__type">Function</span></div>`,n?l+=`<span class="ML__popover__shortcut">${n}</span>`:i.keybinding&&(l+=`<span class="ML__popover__keybinding">${i.keybinding}</span>`)),l+="</li>"},v=0;if(g.length>0){for(let e of(b.push('<div class="ML__popover__section-title">Symbols</div>'),b.push('<ul class="ML__popover__grid">'),g))b.push(y(e,v++,!0));b.push("</ul>")}if(m.length>0){for(let e of(b.push('<div class="ML__popover__section-title">Variable or Function</div>'),b.push("<ul>"),m))b.push(y(e,v++,!1));b.push("</ul>")}if(f.length>0){for(let e of(b.push('<div class="ML__popover__section-title">Constant</div>'),b.push("<ul>"),f))b.push(y(e,v++,!1));b.push("</ul>")}let x=(l=e,s=`<div class="ML__popover__container">${b.join("")}</div>`,(c=document.getElementById("mathlive-suggestion-popover"))?su("mathlive-suggestion-popover"):(nL("suggestion-popover"),nL("core")),(c=sd("mathlive-suggestion-popover")).addEventListener("pointerdown",e=>e.preventDefault()),c.addEventListener("click",e=>{let i=e.target;for(;i&&!i.dataset.command;)i=i.parentElement;i&&(sc(l,"reject"),na.insert(l.model,i.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),l.dirty=!0,l.focus())}),c.innerHTML=globalThis.MathfieldElement.createHTML(s),c);sg()&&(null==(a=x.querySelector(".ML__popover__current"))||a.scrollIntoView({block:"nearest",inline:"nearest"}),sf(e)),setTimeout(()=>{var i;x&&!sg()&&(x.classList.add("is-visible"),sb(e),null==(i=x.querySelector(".ML__popover__current"))||i.scrollIntoView({block:"nearest",inline:"nearest"}),sf(e))},32)}(e,d)}function ss(e){let[i,r]=st(e,{before:e.position});if(void 0===i||void 0===r)return!1;let a=!1;return e.getAtoms([i,r]).forEach(e=>{e.isSuggestion&&(e.isSuggestion=!1,a=!0)}),a}function sc(e,i="accept",r){var a,o;sy(e);let n=l9(e.model);if(!n)return!1;if("accept-suggestion"===i||"accept-all"===i){let r=se(e.model).filter(e=>e.isSuggestion);if(0!==r.length){for(let e of r)e.isSuggestion=!1;e.model.position=e.model.offsetOf(r[r.length-1])}if("accept-suggestion"===i)return 0!==r.length}let l=se(e.model).filter(e=>!e.isSuggestion).map(e=>e.value).join(""),s=n.leftSibling;if(n.parent.removeChild(n),e.model.position=e.model.offsetOf(s),e.switchMode(null!=(a=null==r?void 0:r.mode)?a:"math"),"reject"===i)return!0;let c=f({},sa(e));return/^[a-zA-Z0-9]$/.test(l)||"none"===e.styleBias||(c.variant="normal",c.variantStyle=void 0),na.insert(e.model,l,{selectionMode:null!=(o=null==r?void 0:r.selectItem)&&o?"item":"placeholder",format:"latex",mode:"math",style:c}),e.snapshot(),e.model.announce("replacement"),e.switchMode("math"),!0}function sd(e){var i;let r=document.getElementById(e);return r?r.dataset.refcount=Number(Number.parseInt(null!=(i=r.dataset.refcount)?i:"0")+1).toString():((r=document.createElement("div")).setAttribute("aria-hidden","true"),r.dataset.refcount="1",r.id=e,document.body.append(r)),r}function su(e){var i;let r=document.getElementById(e);if(!r)return;let a=Number.parseInt(null!=(i=r.getAttribute("data-refcount"))?i:"0");a<=1?r.remove():r.dataset.refcount=Number(a-1).toString()}function sh(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}new class extends na{constructor(){super("latex")}createAtom(e){return new lm(e)}onPaste(e,i){if(!i)return!1;let r="string"==typeof i?i:i.getData("application/x-latex")||i.getData("text/plain");return!!(r&&e.model.contentWillChange({inputType:"insertFromPaste",data:r}))&&(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r)&&(e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),sA(e)),e.startRecording(),!0)}insert(e,i,r){if(!e.contentWillChange({data:i,inputType:"insertText"}))return!1;r||(r={}),r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder");let{silenceNotifications:a}=e;r.silenceNotifications&&(e.silenceNotifications=!0);let o=e.silenceNotifications;e.silenceNotifications=!0,"replaceSelection"!==r.insertionMode||e.selectionIsCollapsed?"replaceAll"===r.insertionMode?(e.root.setChildren([],"body"),e.position=0):"insertBefore"===r.insertionMode?e.collapseSelection("backward"):"insertAfter"===r.insertionMode&&e.collapseSelection("forward"):e.deleteAtoms(oQ(e.selection));let n=[];for(let e of i)ed.test(e)&&n.push(new lm(e));let l=e.at(e.position);if(l instanceof lf&&(l=l.lastChild),!(l.parent instanceof lf)){let e=new lf;l.parent.addChildAfter(e,l),l=e.firstChild}let s=l.parent.addChildrenAfter(n,l);return e.silenceNotifications=o,"before"===r.selectionMode||("item"===r.selectionMode?e.setSelection(e.anchor,e.offsetOf(s)):s&&(e.position=e.offsetOf(s))),e.contentDidChange({data:i,inputType:"insertText"}),e.silenceNotifications=a,!0}},s$({applyStyle:function(e,i){e.flushInlineShortcutBuffer(),e.stopCoalescingUndo();let r=si(e,i),{model:a}=e;return a.selectionIsCollapsed?(e.defaultStyle.fontSeries&&r.fontSeries===e.defaultStyle.fontSeries&&(r.fontSeries="auto"),r.fontShape&&r.fontShape===e.defaultStyle.fontShape&&(r.fontShape="auto"),r.color&&r.color===e.defaultStyle.color&&(r.color="none"),r.backgroundColor&&r.backgroundColor===e.defaultStyle.backgroundColor&&(r.backgroundColor="none"),r.fontSize&&r.fontSize===e.defaultStyle.fontSize&&(r.fontSize="auto"),e.defaultStyle=f(f({},e.defaultStyle),r)):e.model.deferNotifications({content:!0,type:"insertText"},()=>{a.selection.ranges.forEach(e=>lB(a,e,r,{operation:"toggle"})),e.snapshot("style-change")}),!0}},{target:"mathfield",canUndo:!0,changeContent:!0});var sp=[],sm=null;function sf(e){sm||(sm=i=>{if(sg()){if("Enter"===i.key||"Return"===i.key){let r=document.getElementById("mathlive-suggestion-popover");if(!r)return;let a=r.querySelectorAll("li");if(e.suggestionIndex<a.length){i.preventDefault(),i.stopPropagation();let r=a[e.suggestionIndex];sc(e,"reject"),na.insert(e.model,r.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),e.dirty=!0,e.focus()}return}if((i.metaKey||i.ctrlKey)&&i.key>="1"&&i.key<="9"){let r=parseInt(i.key)-1,a=document.getElementById("mathlive-suggestion-popover");if(!a)return;let o=a.querySelectorAll("li");if(r<o.length){i.preventDefault(),i.stopPropagation();let a=o[r];sc(e,"reject"),na.insert(e.model,a.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),e.dirty=!0,e.focus()}}}},document.addEventListener("keydown",sm,{capture:!0}))}function sg(){let e=document.getElementById("mathlive-suggestion-popover");return!!e&&e.classList.contains("is-visible")}function sb(e,i){var r,a,o;if(!e.element||e.element.mathfield!==e||!sg())return;if((null==(r=e.model.at(e.model.position))?void 0:r.type)!=="latex")return void sy(e);if(null!=i&&i.deferred)return void setTimeout(()=>sb(e),32);let n=ns(e.field);if(!n)return;let l=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,c=window.innerWidth-document.documentElement.clientWidth,d=window.innerHeight-document.documentElement.clientHeight,u=null!=(o=null==(a=window.mathVirtualKeyboard)?void 0:a.boundingRect.height)?o:0,h=document.getElementById("mathlive-suggestion-popover");n.x+h.offsetWidth/2>s-c?h.style.left=`${s-h.offsetWidth-c}px`:n.x-h.offsetWidth/2<0?h.style.left="0":h.style.left=`${n.x-h.offsetWidth/2}px`;let p=n.y-n.height;l-d-u-n.y<p?(h.classList.add("ML__popover--reverse-direction"),h.classList.remove("top-tip"),h.classList.add("bottom-tip"),h.style.top=`${n.y-n.height-h.offsetHeight-15}px`):(h.classList.remove("ML__popover--reverse-direction"),h.classList.add("top-tip"),h.classList.remove("bottom-tip"),h.style.top=`${n.y+15}px`)}function sy(e){e.suggestionIndex=0,sp=[],document.getElementById("mathlive-suggestion-popover")&&su("mathlive-suggestion-popover"),sm&&(document.removeEventListener("keydown",sm,{capture:!0}),sm=null)}var sv,sx,s_,sw,sk=null,sM=(null==(sw=null==(s_=null==globalThis?void 0:globalThis.document)?void 0:s_.currentScript)?void 0:sw.src)||function(){let e=String(Error().stack).replace(/^Error.*\n/,"").split(`
3203
- `);if(0===e.length)return console.error(`Can't use relative paths to specify assets location because the sourcefile location could not be determined (unexpected stack trace format "${Error().stack}").`),"";let i=e[1],r=i.match(/http.*\.ts[\?:]/);return r&&(i=e[2]),(r=i.match(/(https?:.*):[0-9]+:[0-9]+/))||(r=i.match(/at (.*(\.ts))[\?:]/))||(r=i.match(/at (.*(\.mjs|\.js))[\?:]/)),r?r[1]:(console.error(e),console.error(`Can't use relative paths to specify assets location because the source file location could not be determined (unexpected location "${i}").`),"")}();async function sS(e){if(/^(?:[a-z+]+:)?\/\//i.test(e)){try{return new URL(e).href}catch(e){}if(e.startsWith("//"))try{return new URL(`${window.location.protocol}${e}`).href}catch(e){}return e}if(null===sk)try{let e=await fetch(sM,{method:"HEAD"});200===e.status&&(sk=(sk=e.url).replace(/\/\+esm$/,"/")).includes("jsdelivr.net/")&&(sk+="/")}catch(i){console.error(`Invalid URL "${e}" (relative to "${sM}")`)}return new URL(e,null!=sk?sk:sM).href}var sL="not-loaded";async function sC(){return sL="not-loaded",sE()}async function sE(){var e;if("not-loaded"===sL){if(sL="loading",null!=(e=getComputedStyle(document.documentElement).getPropertyValue("--ML__static-fonts"))&&e){sL="ready";return}if(document.body.classList.remove("ML__fonts-did-not-load"),"fonts"in document){let e=Array.from(document.fonts).map(e=>e.family);if(["KaTeX_Main","KaTeX_Math","KaTeX_AMS","KaTeX_Caligraphic","KaTeX_Fraktur","KaTeX_SansSerif","KaTeX_Script","KaTeX_Typewriter","KaTeX_Size1","KaTeX_Size2","KaTeX_Size3","KaTeX_Size4"].every(i=>e.includes(i))){sL="ready";return}if(!globalThis.MathfieldElement.fontsDirectory){sL="not-loaded";return}let i=await sS(globalThis.MathfieldElement.fontsDirectory);if(!i){document.body.classList.add("ML__fonts-did-not-load"),sL="error";return}i.endsWith("/")&&(i=i.slice(0,-1));let r=[["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(e=>(function(e,i,r={}){return new FontFace(e,`url(${i}.woff2) format('woff2')`,r)})(e[0].replace(/-[a-zA-Z]+$/,""),`${i}/${e[0]}`,e[1]));try{(await Promise.all(r.map(e=>{try{return e.load()}catch(e){}}))).forEach(e=>document.fonts.add(e)),sL="ready";return}catch(e){console.error(`MathLive 0.110.6: The math fonts could not be loaded from "${i}"`,{cause:e}),document.body.classList.add("ML__fonts-did-not-load")}sL="error"}}}function sA(e,i){e&&!e.dirty&&e.field&&(e.resizeObserver.unobserve(e.field),e.dirty=!0,requestAnimationFrame(()=>{nl(e)&&e.dirty&&(e.atomBoundsCache=new Map,sT(e,i),e.resizeObserver.observe(e.field),e.resizeObserverStarted=!0)}))}function sz(e,i){try{var r,a;let o,{model:n}=e;for(let e of(n.root.caret=void 0,n.root.isSelected=!1,n.root.containsCaret=!0,n.atoms))e.caret=void 0,e.isSelected=!1,e.containsCaret=!1;if(n.selectionIsCollapsed){let i=n.at(n.position);i.caret=e.model.mode;let r=i.parent;for(;r;)r.containsCaret=!0,r=r.parent}else for(let e of n.getAtoms(n.selection,{includeChildren:!0,includeFirstAtoms:!0}))e.isSelected=!0;return(r=i,r=null!=r?r:{},o=new oW({from:g(f({},e.context),{atomIdsSettings:{seed:r.forHighlighting?function(e,i=0){let r=0xdeadbeef^i,a=0x41c6ce57^i;for(let i=0;i<e.length;i++){let o=e.charCodeAt(i);r=Math.imul(r^o,0x9e3779b1),a=Math.imul(a^o,0x5f356495)}return r=Math.imul(r^r>>>16,0x85ebca6b)^Math.imul(a^a>>>13,0xc2b2ae35),0x100000000*(2097151&(a=Math.imul(a^a>>>16,0x85ebca6b)^Math.imul(r^r>>>13,0xc2b2ae35)))+(r>>>0)}(oG.serialize([e.model.root],{expandMacro:!1,defaultMode:e.options.defaultMode})):"random",groupNumbers:null!=(a=r.forHighlighting)&&a},letterShapeStyle:e.options.letterShapeStyle}),mathstyle:"inline-math"===e.options.defaultMode?"textstyle":"displaystyle"}),oz(lL(e.model.root.render(o),o),{classes:e.hasEditablePrompts?"ML__latex ML__prompting":"ML__latex",attributes:{translate:"no","aria-hidden":"true"}})).toMarkup()}catch(e){return console.error(e),'<span class="ML__latex" translate="no" aria-hidden="true">🚫</span>'}}function sT(e,i){if(!nl(e))return;null!=i||(i={});let r=e.element.querySelector("[part=virtual-keyboard-toggle]");r&&(r.style.display=e.hasEditableContent?"":"none");let a=e.field;if(!a)return;let o=e.isSelectionEditable&&e.hasFocus(),n=a.classList.contains("ML__focused");n&&!o?a.classList.remove("ML__focused"):!n&&o&&a.classList.add("ML__focused");let l=sz(e,i),s=e.element.querySelector("[part=menu-toggle]");if(s){let i=!1;(e.disabled||e.readOnly&&!e.hasEditableContent||"none"===e.userSelect)&&(i=!0),!i&&e.element.offsetWidth<50&&(i=!0),s.style.display=i?"none":""}if(e.model.atoms.length<=1){let i=e.options.contentPlaceholder;i&&(l+=`<span part=placeholder class="ML__content-placeholder">${dN(i)}</span>`)}a.innerHTML=globalThis.MathfieldElement.createHTML(l),sD(e,i.interactive),e.updateToggleLayout(),e.dirty=!1}function sD(e,i){var r;let a=e.field;if(!a)return;for(let e of a.querySelectorAll(".ML__selection, .ML__contains-highlight"))e.remove();if(!(null!=i&&i)&&"error"!==sL&&"ready"!==sL)return void setTimeout(()=>{"ready"===sL?sD(e):setTimeout(()=>sD(e),128)},32);let o=e.model;null==(r=e.atomBoundsCache)||r.clear();let n,l=()=>{if(void 0!==n)return n;let e=a.offsetWidth;return isNaN(n=Math.floor(a.getBoundingClientRect().width)/e)&&(n=1),n};if(o.selectionIsCollapsed){sb(e,{deferred:!0});let i=o.at(o.position);for(;i&&"prompt"!==i.type&&!(i.containsCaret&&i.displayContainsHighlight);)i=i.parent;if(null!=i&&i.containsCaret&&i.displayContainsHighlight){let r=l(),o=nc(e,nu(e,i),r);if(o){o.left/=r,o.right/=r,o.top/=r,o.bottom/=r;let e=document.createElement("div");e.classList.add("ML__contains-highlight"),e.style.position="absolute",e.style.left=`${o.left+1}px`,e.style.top=`${Math.ceil(o.top)}px`,e.style.width=`${Math.ceil(o.right-o.left)}px`,e.style.height=`${Math.ceil(o.bottom-o.top)}px`,a.insertBefore(e,a.childNodes[0])}}return}let s=l();for(let i of function(e){let i=[];for(let r of e){let e=!1;for(let a of i)if(r.left===a.left&&r.right===a.right&&r.top===a.top&&r.bottom===a.bottom){e=!0;break}e||i.push(r)}for(let r of(e=i,i=[],e)){let a=0;for(let i of e)if(r.left>=i.left&&r.right<=i.right&&r.top>=i.top&&r.bottom<=i.bottom&&(a+=1)>1)break;1===a&&i.push(r)}return i}(nh(e,{excludeAtomsWithBackground:!0}))){i.left/=s,i.right/=s,i.top/=s,i.bottom/=s;let e=document.createElement("div");e.classList.add("ML__selection"),e.style.position="absolute",e.style.left=`${i.left}px`,e.style.top=`${i.top}px`,e.style.width=`${Math.ceil(i.right-i.left)}px`,e.style.height=`${Math.max(1,Math.ceil(i.bottom-i.top-1))}px`,a.insertBefore(e,a.childNodes[0])}}function sK(e){if(!e)return;let i=e.model,r=i.selection,a=oG.serialize([i.root],{expandMacro:!1,defaultMode:e.options.defaultMode});na.insert(i,a,{insertionMode:"replaceAll",selectionMode:"after",format:"latex",silenceNotifications:!0,mode:"math"});let o=i.silenceNotifications;i.silenceNotifications=!0,i.selection=r,i.silenceNotifications=o,sA(e)}function sB(){for(let e of document.querySelectorAll(".ML__mathfield"))"_mathfield"in e&&sK(e._mathfield)}function s$(e,i){for(let r of(i=f({target:"mathfield",canUndo:!1,audioFeedback:void 0,changeContent:!1,changeSelection:!1},null!=i?i:{}),sq||(sq={}),Object.keys(e)))sq[r],sq[r]=g(f({},i),{fn:e[r]})}function sP(e){let i;if(Array.isArray(e)){if("performWithFeedback"===e[0])return sP(e[1]);i=e[0]}else i=e;return sq[i]}function sO(e){var i;return null==(i=sP(e))?void 0:i.target}function sI(e){if(!e)return;if(I(e)&&e.length>0){let i=e[0];return"performWithFeedback"===(i=i.replace(/-\w/g,e=>e[1].toUpperCase()))&&2===e.length?[i,sI(e[1])]:[i,...e.slice(1)]}if("string"!=typeof e)return;let i=e.trim().match(/^([a-zA-Z0-9-]+)\((.*)\)$/);return i?[i[1].replace(/-\w/g,e=>e[1].toUpperCase()),...i[2].split(",").map(e=>e.trim()).map(e=>{if(/"[^"]*"/.test(e)||/'[^']*'/.test(e))return e.slice(1,-1);if(/^true$/.test(e))return!0;if(/^false$/.test(e))return!1;if(/^[-]?\d+$/.test(e))return parseInt(e,10);if(/^\{.*\}$/.test(e))try{return JSON.parse(e)}catch(i){return console.error("Invalid argument:",e),e}return sI(e)})]:e.replace(/-\w/g,e=>e[1].toUpperCase())}s$({performWithFeedback:(e,i)=>(function(e,i){var r;if(!e)return!1;e.focus(),uD.keypressVibration&&_()&&navigator.vibrate(3);let a=sP(i);globalThis.MathfieldElement.playSound(null!=(r=null==a?void 0:a.audioFeedback)?r:"keypress");let o=e.executeCommand(i);return e.scrollIntoView(),o})(e,i)}),s$({complete:sc},{target:"mathfield",audioFeedback:"return",canUndo:!0,changeContent:!0,changeSelection:!0}),s$({dispatchEvent:(e,i,r)=>{var a,o;return null!=(o=null==(a=e.host)?void 0:a.dispatchEvent(new CustomEvent(i,{detail:r})))&&o}},{target:"mathfield"}),s$({nextSuggestion:function(e){return sl(e,{atIndex:e.suggestionIndex+1}),!1},previousSuggestion:function(e){return sl(e,{atIndex:e.suggestionIndex-1}),!1}},{target:"mathfield",audioFeedback:"keypress",changeSelection:!0});var sR="mathlive#virtual-keyboard-message";function sN(e){var i;return"message"===e.type&&(null==(i=e.data)?void 0:i.type)===sR}var sq,sF,sV=class e{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 e),this._singleton}getKeycap(e){}setKeycap(e,i){this.sendMessage("update-setting",{setKeycap:{keycap:e,value:i}})}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 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,i,r){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].has(i)||this.listeners[e].add(i)}dispatchEvent(e){return!this.listeners[e.type]||0===this.listeners[e.type].size||(this.listeners[e.type].forEach(i=>{"function"==typeof i?i(e):null==i||i.handleEvent(e)}),!e.defaultPrevented)}removeEventListener(e,i,r){this.listeners[e]&&this.listeners[e].delete(i)}handleEvent(e){if(sN(e)){if(!np(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:i}=e;if("execute-command"===i){let{command:i}=e;"virtual-keyboard"===sO(i)&&this.executeCommand(i);return}if("synchronize-proxy"===i){this._boundingRect=e.boundingRect,this._isShifted=e.isShifted;return}if("geometry-changed"===i){this._boundingRect=e.boundingRect,this.dispatchEvent(new Event("geometrychange"));return}}sendMessage(e,i={}){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(f({type:sR,action:e},i),this.targetOrigin)}},sj={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:"≤"}},{label:">",latex:">",class:"hide-shift",shift:{latex:"\\ge",label:"≥"}},"[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:"[return]",width:1}]]},greek:{label:"&alpha;&beta;&gamma;",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.greek",rows:[[{label:"<i>&#x03c6;</i>",class:"MLK__tex hide-shift",insert:"\\varphi",aside:"phi var.",shift:"\\Phi"},{label:"<i>&#x03c2;</i>",class:"MLK__tex hide-shift",insert:"\\varsigma",aside:"sigma var.",shift:"\\Sigma"},{label:"<i>&#x03f5;</i>",class:"MLK__tex hide-shift",insert:"\\epsilon",aside:"epsilon",shift:'\\char"0190'},{label:"<i>&rho;</i>",class:"MLK__tex hide-shift",insert:"\\rho",aside:"rho",shift:'\\char"3A1'},{label:"<i>&tau;</i>",class:"MLK__tex hide-shift",insert:"\\tau",aside:"tau",shift:'\\char"3A4'},{label:"<i>&upsilon;</i>",class:"MLK__tex hide-shift",insert:"\\upsilon",aside:"upsilon",shift:"\\Upsilon"},{label:"<i>&theta;</i>",class:"MLK__tex hide-shift",insert:"\\theta",aside:"theta",shift:"\\Theta"},{label:"<i>&iota;</i>",class:"MLK__tex hide-shift",insert:"\\iota",aside:"iota",shift:'\\char"399'},{label:"<i>&omicron;</i>",class:"MLK__tex hide-shift",insert:"\\omicron",aside:"omicron",shift:'\\char"39F'},{label:"<i>&pi;</i>",class:"MLK__tex hide-shift",insert:"\\pi",aside:"pi",shift:"\\Pi"}],["[separator-5]",{label:"<i>&alpha;</i>",class:"MLK__tex hide-shift",insert:"\\alpha",aside:"alpha",shift:'\\char"391'},{label:"<i>&sigma;</i>",class:"MLK__tex hide-shift",insert:"\\sigma",aside:"sigma",shift:"\\Sigma"},{label:"<i>&delta;</i>",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:"<i>&gamma;</i>",class:"MLK__tex hide-shift",insert:"\\gamma",aside:"gamma",shift:"\\Gamma"},{label:"<i>&eta;</i>",class:"MLK__tex hide-shift",insert:"\\eta",aside:"eta",shift:'\\char"397'},{label:"<i>&xi;</i>",class:"MLK__tex hide-shift",insert:"\\xi",aside:"xi",shift:"\\Xi"},{label:"<i>&kappa;</i>",class:"MLK__tex hide-shift",insert:"\\kappa",aside:"kappa",shift:"\\Kappa"},{label:"<i>&lambda;</i>",class:"MLK__tex hide-shift",insert:"\\lambda",aside:"lambda",shift:"\\Lambda"},"[separator-5]"],["[shift]",{label:"<i>&zeta;</i>",class:"MLK__tex hide-shift",insert:"\\zeta",aside:"zeta",shift:'\\char"396'},{label:"<i>&chi;</i>",class:"MLK__tex hide-shift",insert:"\\chi",aside:"chi",shift:'\\char"3A7'},{label:"<i>&psi;</i>",class:"MLK__tex hide-shift",insert:"\\psi",aside:"psi",shift:"\\Psi"},{label:"<i>&omega;</i>",class:"MLK__tex hide-shift",insert:"\\omega",aside:"omega",shift:"\\Omega"},{label:"<i>&beta;</i>",class:"MLK__tex hide-shift",insert:"\\beta",aside:"beta",shift:'\\char"392'},{label:"<i>&nu;</i>",class:"MLK__tex hide-shift",insert:"\\nu",aside:"nu",shift:'\\char"39D'},{label:"<i>&mu;</i>",class:"MLK__tex hide-shift",insert:"\\mu",aside:"mu",shift:'\\char"39C'},"[backspace]"],["[separator]",{label:"<i>&#x03b5;</i>",class:"MLK__tex",insert:"\\varepsilon",aside:"epsilon var."},{label:"<i>&#x03d1;</i>",class:"MLK__tex",insert:"\\vartheta",aside:"theta var."},{label:"<i>&#x3f0;</i>",class:"MLK__tex",insert:"\\varkappa",aside:"kappa var."},{label:"<i>&#x03d6;</i>",class:"MLK__tex",insert:"\\varpi",aside:"pi var."},{label:"<i>&#x03f1;</i>",class:"MLK__tex",insert:"\\varrho",aside:"rho var."},"[left]","[right]","[return]"]]},symbols:{label:"&infin;≠∈",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:"[return]",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:`
3228
+ }`;break;case"core":i=ny;break;case"mathfield":i=nb;break;case"environment-popover":i=nv;break;case"suggestion-popover":i=nx;break;case"keystroke-caption":i=n_;break;case"virtual-keyboard":i=nw;break;case"ui":i=nk;break;case"menu":i=nM}return i}function nE(e){return ng||(ng={}),ng[e]||(ng[e]=new CSSStyleSheet,ng[e].replaceSync(nL(e,nC(e)))),ng[e]}function nA(e){var i;try{if(!("adoptedStyleSheets"in document)){if(window.document.getElementById(`mathlive-style-${e}`))return;let i=window.document.createElement("style");i.id=`mathlive-style-${e}`,i.append(window.document.createTextNode(nL(e,nC(e)))),window.document.head.appendChild(i);return}if(sS||(sS={}),(null!=(i=sS[e])?i:0)!==0)sS[e]+=1;else{let i=nE(e);document.adoptedStyleSheets=[...document.adoptedStyleSheets,i],sS[e]=1}}catch(i){console.error("Error injecting stylesheet",e,i)}}function nz(e){if("adoptedStyleSheets"in document&&null!=sS&&sS[e]&&(sS[e]-=1,sS[e]<=0)){let i=ng[e];document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==i)}}var nT=class e extends oG{constructor(e){var i;super(g(f({},e),{type:"accent",body:null!=(i=e.body)?i:void 0})),e.accentChar?this.accent=e.accentChar:this.svgAccent=null==e?void 0:e.svgAccent,this.skipBoundary=!0,this.captureSelection=!0}static fromJson(i){return new e(i)}toJson(){return g(f({},super.toJson()),{accentChar:this.accent,svgAccent:this.svgAccent})}render(e){var i;let r=new oW({parent:e,mathstyle:"cramp"},this.style),a=null!=(i=oG.createBox(r,this.body))?i:new oE("□",{style:this.style}),o=0;!this.hasEmptyBranch("body")&&2===this.body.length&&this.body[1].isCharacterBox()&&(o=a.skew);let n=Math.min(a.height,.431),l;if(this.svgAccent)l=oT(this.svgAccent),n=r.metrics.bigOpSpacing1-n;else if(this.accent){let e=new oE(this.accent,{fontFamily:"Main-Regular"});e.italic=0,l=new oE(e,{classes:"ML__accent-body"+(8407===this.accent||8411===this.accent||8412===this.accent?" ML__accent-combining-char":"")})}let s=(a.width-l.width)/2+a.left+2*o;l=new oB({shift:0,children:[{box:new oE(a)},-n,{box:l,marginLeft:s,classes:["ML__center"]}]});let c=new oE(l,{type:"ord"});return this.caret&&(c.caret=this.caret),this.bind(r,c.wrap(r)),this.attachSupsub(r,{base:c})}},nD={"(":")","{":"}","[":"]","|":"|","\\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"},nK=Object.fromEntries(Object.entries(nD).map(([e,i])=>[i,e]));function nB(e){var i;return null!=(i=({"[":91,"]":93,"(":40,")":41,"\\mid":8739,"|":8739,"∣":8739,"∥":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})[e])?i:e.codePointAt(0)}function n$(e,i,r,a,o){var n,l;let s=new oW({parent:a,mathstyle:"textstyle"},null==o?void 0:o.style),c=new oE(nB(e),{fontFamily:`Size${i}-Regular`,isSelected:o.isSelected,classes:(null!=(n=o.classes)?n:"")+` ML__delim-size${i}`,type:null!=(l=o.type)?l:"ignore"}).wrap(s);return r&&c.setTop((1-s.scalingFactor)*.25),c}function nP(e,i,r,a,o){var n;let l,s,c,d;l=c=d=nB(e),s=null;let u="Size1-Regular";"\\vert"===e||"\\lvert"===e||"\\rvert"===e||"\\mvert"===e||"\\mid"===e?c=l=d=8739:"\\Vert"===e||"\\lVert"===e||"\\rVert"===e||"\\mVert"===e||"\\|"===e?c=l=d=8741:"\\uparrow"===e?c=d=9168:"\\Uparrow"===e?c=d=8214:"\\downarrow"===e?l=c=9168:"\\Downarrow"===e?l=c=8214:"\\updownarrow"===e?(l=8593,c=9168,d=8595):"\\Updownarrow"===e?(l=8657,c=8214,d=8659):"["===e||"\\lbrack"===e?(l=9121,c=9122,d=9123,u="Size4-Regular"):"]"===e||"\\rbrack"===e?(l=9124,c=9125,d=9126,u="Size4-Regular"):"\\lfloor"===e||"⌊"===e?(c=l=9122,d=9123,u="Size4-Regular"):"\\lceil"===e||"⌈"===e?(l=9121,c=d=9122,u="Size4-Regular"):"\\rfloor"===e||"⌋"===e?(c=l=9125,d=9126,u="Size4-Regular"):"\\rceil"===e||"⌉"===e?(l=9124,c=d=9125,u="Size4-Regular"):"("===e||"\\lparen"===e?(l=9115,c=9116,d=9117,u="Size4-Regular"):")"===e||"\\rparen"===e?(l=9118,c=9119,d=9120,u="Size4-Regular"):"\\{"===e||"\\lbrace"===e?(l=9127,s=9128,d=9129,c=9130,u="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(l=9131,s=9132,d=9133,c=9130,u="Size4-Regular"):"\\lgroup"===e||"⟮"===e?(l=9127,d=9129,c=9130,u="Size4-Regular"):"\\rgroup"===e||"⟯"===e?(l=9131,d=9133,c=9130,u="Size4-Regular"):"\\lmoustache"===e||"⎰"===e?(l=9127,d=9133,c=9130,u="Size4-Regular"):"\\rmoustache"===e||"⎱"===e?(l=9131,d=9129,c=9130,u="Size4-Regular"):"\\surd"===e?(l=57345,d=9143,c=57344,u="Size4-Regular"):"\\ulcorner"===e?(l=9484,c=d=32):"\\urcorner"===e?(l=9488,c=d=32):"\\llcorner"===e?(d=9492,c=l=32):"\\lrcorner"===e&&(l=9496,c=l=32);let h=oa(l,u),p=h.height+h.depth,m=oa(c,u),b=m.height+m.depth,y=oa(d,u),v=y.height+y.depth,x=0,_=1;if(null!==s){let e=oa(s,u);x=e.height+e.depth,_=2}let w=p+v+x,k=Math.max(0,Math.ceil((i-w)/(_*b))),M=w+k*_*b,S=.25;r&&(S*=a.scalingFactor);let L=M/2-S,C=[];C.push({box:new oE(d,{fontFamily:u})}),C.push(-.008);let E=new oE(c,{fontFamily:u});if(null===s)for(let e=0;e<k;e++)C.push({box:E});else{for(let e=0;e<k;e++)C.push({box:E});C.push(-.008),C.push({box:new oE(s,{fontFamily:u})}),C.push(-.008);for(let e=0;e<k;e++)C.push({box:E})}C.push(-.008),C.push({box:new oE(l,{fontFamily:u})});let A="";return"Size1-Regular"===u?A=" delim-size1":"Size4-Regular"===u&&(A=" delim-size4"),new oE(new oB({bottom:L,children:C},{classes:A}),g(f({},null!=o?o:{}),{classes:(null!=(n=null==o?void 0:o.classes)?n:"")+" ML__delim-mult"}))}var nO=new Set(["(",")","\\lparen","\\rparen","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","\\surd","⌊","⌋","⌈","⌉"]),nR=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\mvert","\\mid","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","⟮","⟯","⎰","⎱"]),nI=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),nN=[0,1.2,1.8,2.4,3],nq=[{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}],nF=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"stack"}],nV=[{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 nj(e,i,r,a,o,n){var l,s,c;let d,u;if(!i||0===i.length||"."===i)return nW(o);"<"===i||"\\lt"===i?i="\\langle":(">"===i||"\\gt"===i)&&(i="\\rangle"),d=nI.has(i)?nq:nO.has(i)?nV:nF;let h=function(e,i,r,a){let o={"-4":0,"-3":1,0:2}[a.mathstyle.sizeDelta];for(let l=o;l<r.length&&"stack"!==r[l].type;l++){var n;let o=oa(e,"small"===(n=r[l]).type?"Main-Regular":"large"===n.type?"Size"+n.size+"-Regular":(n.type,"Size4-Regular"));if(o.defaultMetrics)return{type:"small",mathstyle:"scriptstyle"};let s=o.height+o.depth;if("small"===r[l].type&&("scriptscriptstyle"===r[l].mathstyle?s*=Math.max(oi[Math.max(1,a.size-2)],a.minFontScale):"scriptstyle"===r[l].mathstyle&&(s*=Math.max(oi[Math.max(1,a.size-1)],a.minFontScale))),s>i)return r[l]}return r[r.length-1]}(nB(i),r,d,o),p=new oW({parent:o,mathstyle:h.mathstyle},null==n?void 0:n.style);return"small"===h.type?(l=i,s=g(f({},n),{type:e}),u=new oE(nB(l),{fontFamily:"Main-Regular",isSelected:s.isSelected,classes:"ML__small-delim "+(null!=(c=s.classes)?c:"")}).wrap(p),a&&u.setTop((1-p.scalingFactor)*.25),u):"large"===h.type?n$(i,h.size,a,p,g(f({},n),{type:e})):(h.type,nP(i,r,a,p,g(f({},n),{type:e})))}function nH(e,i,r,a,o,n){if("."===i)return nW(o,null==n?void 0:n.classes);let l=.25*o.scalingFactor,s=Math.max(r-l,a+l);return nj(e,i,Math.max(s/500*901,2*s-.5),!0,o,n)}function nW(e,i){let r=new oE(null,{classes:" ML__nulldelimiter "+(null!=i?i:""),type:"ignore"});return r.width=e.getRegisterAsEm("nulldelimiterspace"),r.wrap(new oW({parent:e,mathstyle:"textstyle"}))}var nU=class e extends oG{constructor(e){var i;super({type:"placeholder",command:"\\placeholder",mode:null!=(i=null==e?void 0:e.mode)?i:"math",style:null==e?void 0:e.style}),this.captureSelection=!0}static fromJson(i){return new e(i)}toJson(){return super.toJson()}render(e){let i;return this.value=e.placeholderSymbol,i="function"==typeof e.renderPlaceholder?e.renderPlaceholder(e):this.createBox(e),this.caret&&(i.classes+=" ML__placeholder-selected"),i}_serialize(e){return e.skipPlaceholders?"":"\\placeholder{}"}},nJ=["matrix","matrix*","pmatrix","pmatrix*","bmatrix","bmatrix*","Bmatrix","Bmatrix*","vmatrix","vmatrix*","Vmatrix","Vmatrix*"],nX=["cases","dcases","rcases"],nG=["align","align*","aligned","gather","gather*","gathered","split"],nZ=["array","subequations","eqnarray"];function nY(e){return nJ.includes(e)}var nQ=class e extends oG{get isMultiline(){return["lines","multline","multline*","align","split","gather","gathered"].includes(this.environmentName)}constructor(e,i,r,a={}){var o,n,l,s;if(super({type:"array",isRoot:a.isRoot}),this.environmentName=e,a.columns)0===a.columns.length?this.colFormat=[{align:"l"}]:this.colFormat=[...a.columns];else if(a.minColumns){let e=[];for(let i=0;i<a.minColumns;i++)e.push({align:"l"});this.colFormat=e}else this.colFormat=[{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"}];this.minColumns=null!=(o=a.minColumns)?o:1,this.minRows=null!=(n=a.minRows)?n:1,this.maxRows=null!=(l=a.maxRows)?l:1/0;let c=function(e,i,r){var a,o,n,l,s,c,d;let u=0;for(let e of r.columns)"align"in e&&(u+=1);u=Math.max(u,r.minColumns);let h=0,p=[],m=[];for(let n=0;n<i.length;n++){let l=i[n];h=Math.max(h,Math.min(l.length,u));let d=0,f=!0;for(;d<l.length;){let i=[],h=Math.min(l.length,d+u);for(;d<h;){i.push((s=l[d],c=e.mode,0===s.length?[new oG({type:"first",mode:c})]:"first"!==s[0].type?[new oG({type:"first",mode:c}),...s]:(s.slice(1).some(e=>"first"===e.type),s))),d+=1}if(i.length<r.minColumns)for(;i.length<r.minColumns;)i.push([new oG({type:"first",mode:e.mode})]);p.push(i),m.push(f?[...null!=(o=null==(a=r.rowRules)?void 0:a[n])?o:[]]:[]),f=!1}}if(m.push([...null!=(l=null==(n=r.rowRules)?void 0:n[i.length])?l:[]]),!e.isMultiline&&p.length>0&&1===p[p.length-1].length&&1===(d=p[p.length-1][0]).length&&"first"===d[0].type){p.pop();let e=m.pop();m[m.length-1].push(...e)}let f=[];for(let i of p){if(i.length!==h)for(let r=i.length;r<h;r++)e.isMultiline?i.push([new oG({type:"first",mode:e.mode})]):i.push([new oG({type:"first",mode:e.mode}),new nU]);f.push(i)}let g=0,b=0;for(let i of f){for(let r of(b=0,i)){for(let i of r)i.parent=e,i.parentBranch=[g,b];b+=1}g+=1}return e.isDirty=!0,{rows:f,rowRules:m}}(this,i,{columns:this.colFormat,minColumns:this.minColumns,minRows:this.minRows,maxRows:this.maxRows,rowRules:a.rowRules});this._rows=c.rows,this.rowRules=c.rowRules,this.rowGaps=r,void 0!==a.arraycolsep&&(this.arraycolsep=a.arraycolsep),this.colSeparationType=a.colSeparationType,void 0!==a.arraystretch&&(this.arraystretch=a.arraystretch),a.mathstyleName&&(this.mathstyleName=a.mathstyleName),a.leftDelim&&(this.leftDelim=a.leftDelim),a.rightDelim&&(this.rightDelim=a.rightDelim),this.classes=null!=(s=a.classes)?s:[]}static fromJson(i){return new e(i.environmentName,i.array,i.rowGaps,i)}toJson(){let e=g(f({},super.toJson()),{environmentName:this.environmentName,array:this._rows.map(e=>e.map(e=>e.map(e=>e.toJson()))),rowGaps:this.rowGaps,columns:this.colFormat,colSeparationType:this.colSeparationType,minColumns:this.minColumns,minRows:this.minRows,maxRows:this.maxRows});return void 0!==this.arraystretch&&(e.arraystretch=this.arraystretch),void 0!==this.arraycolsep&&(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),this.hasRowRules&&(e.rowRules=this.rowRules),e}get hasRowRules(){return this.rowRules.some(e=>e.length>0)}branch(e){var i;if(oX(e))return null!=(i=this._rows[e[0]][e[1]])?i:void 0}createBranch(e){var i;return oX(e)?(this.isDirty=!0,null!=(i=this.branch(e))?i:[]):[]}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(oJ(e))return super.removeBranch(e);let[i,...r]=this.branch(e);return i.type,this._rows[e[0]][e[1]]=void 0,r.forEach(e=>{e.parent=void 0,e.parentBranch=void 0}),this.isDirty=!0,r}get hasChildren(){return this.children.length>0}get children(){let e=[];for(let i of this._rows)for(let r of i)if(r)for(let i of r)e.push(...i.children),e.push(i);return[...e,...super.children]}render(e){var i,r,a,o,n,l,s;let c=new oW({parent:e,mathstyle:this.mathstyleName},this.style),d=c.getRegisterAsEm("arrayrulewidth"),u=c.getRegisterAsEm("arraycolsep"),h=c.getRegisterAsEm("doublerulesep"),p=null!=(r=null!=(i=this.arraystretch)?i:c.getRegisterAsNumber("arraystretch"))?r:1,m="number"==typeof this.arraycolsep?this.arraycolsep:u;"small"===this.colSeparationType&&(m=.2778*(new oW({parent:e,mathstyle:"scriptstyle"}).scalingFactor/e.scalingFactor));let f=1.2*p,g=.7*f,b=.3*f,y=0,v=[],x=0,_=this._rows.length,w=[],k=e=>{if(e)for(let i=0;i<e.length;i++)i>0&&(y+=h),w.push({rule:e[i],y:y})};k(this.rowRules[0]);for(let e=0;e<_;++e){let i=this._rows[e];x=Math.max(x,i.length);let r=new oW({parent:c,mathstyle:this.mathstyleName},this.style),n=g/r.scalingFactor,l=b/r.scalingFactor,d={cells:[],height:0,depth:0,pos:0};for(let e of i){let i=this.isMultiline&&e&&(s=e).length>0&&s.every(e=>"first"===e.type)?function(e,i,r){let a=new oE(null,{classes:"ML__empty-line-anchor"}),o=e[0];o&&(o.id||(o.id=i.makeID()),a.atomID=o.id),a.setStyle("display","inline-block"),a.setStyle("width",0),a.setStyle("position","relative"),a.setStyle("height",Math.max(0,r.height+r.depth),"em"),a.setStyle("vertical-align",-r.depth,"em"),a.height=r.height,a.depth=r.depth;let n=e.find(e=>e.caret);return null!=n&&n.caret&&(a.caret=n.caret),e.some(e=>e.isSelected)&&a.selected(!0),a}(e,r,{height:g/r.scalingFactor,depth:b/r.scalingFactor}):null!=(a=oG.createBox(r,e,{type:"ignore"}))?a:new oE(null,{type:"ignore"});l=Math.max(l,i.depth),n=Math.max(n,i.height),d.cells.push(i)}let u=null!=(o=oN(this.rowGaps[e]))?o:0;u>0&&(u+=b,l=Math.max(l,u),u=0),e<_-1&&!nY(this.environmentName)&&"cases"!==this.environmentName&&"array"!==this.environmentName&&(l+=c.getRegisterAsEm("jot")),d.height=n,d.depth=l,d.pos=y+=n,y+=l+u,v.push(d),k(this.rowRules[e+1])}let M="array"!==this.environmentName||this.isMultiline?y/2+.25:v[0].height,S=w.filter(e=>void 0===e.rule.from),L=w.filter(e=>void 0!==e.rule.from),C=(e,i)=>L.filter(({rule:r})=>{var a;return r.from<=e&&(null!=(a=r.to)?a:r.from)>=i}).map(({rule:e,y:i})=>({box:n2(e.style,d),shift:i-M})),E=[];for(let e=0;e<x;e++){let i=[];for(let r of v){let a=r.cells[e];a&&(a.depth=r.depth,a.height=r.height,i.push({box:a,shift:r.pos-M}))}i.push(...C(e,e)),i.length>0&&E.push(new oB({individualShift:i}))}let A=(e,i)=>{if(i<0||i+1>=E.length)return n4(e);let r=C(i,i+1);if(0===r.length)return n4(e);let a=new oB({individualShift:r});return a.width=e,a},z=[],T=!1,D=!1,K=0,B=!this.leftDelim,{colFormat:$}=this;for(let i of $){if("align"in i&&K>=E.length)break;if("align"in i)T?z.push(A(2*m,K-1)):(D||B)&&z.push(n4(m)),z.push(new oE(E[K],{classes:"col-align-"+i.align})),K++,T=!0,D=!1,B=!1;else if("gap"in i){if("number"==typeof i.gap)z.push(A(i.gap,T?K-1:-1));else{let r=function(e,i,r,a){if(!a)return null;let o=[];for(let n of i){let i=oG.createBox(e,a,{type:"ignore"});i&&(i.depth=n.depth,i.height=n.height,o.push({box:i,shift:n.pos-r}))}return new oB({individualShift:o}).wrap(e)}(e,v,M,i.gap);r&&z.push(r)}T=!1,D=!1,B=!1}else if("separator"in i){let e=new oE(null,{classes:"ML__vertical-separator"});e.height=y,e.setStyle("height",y,"em"),e.setStyle("border-right",`${d}em ${i.separator} currentColor`),e.setStyle("vertical-align",-(y-M),"em");let r=0;D?r=h-d:T&&(r=m-d),e.left=r,z.push(e),T=!1,D=!0,B=!1}}T&&!this.rightDelim&&z.push(n4(m));let P=new oE(z,{classes:["ML__mtable",...this.classes].join(" ")});if("array"!==this.environmentName||this.isMultiline||(P.height=v[0].height,P.depth=y-v[0].height),S.length>0&&(P=new oB({individualShift:[{box:P,shift:0},...S.map(({rule:e,y:i})=>({box:n2(e.style,d),shift:i-M}))]})),(!this.leftDelim||"."===this.leftDelim)&&(!this.rightDelim||"."===this.rightDelim))return this.caret&&(P.caret=this.caret),this.bind(e,P);let O=P.height,R=P.depth,I=this.bind(e,new oE([this.bind(e,nH("open",null!=(n=this.leftDelim)?n:".",O,R,c,{isSelected:this.isSelected})),P,this.bind(e,nH("close",null!=(l=this.rightDelim)?l:".",O,R,c,{isSelected:this.isSelected}))],{type:"ord"}));return I?(I.setStyle("display","inline-block"),this.caret&&(I.caret=this.caret),this.bind(e,this.attachSupsub(e,{base:I}))):null}_serialize(e){var i,r;let a=[];if("lines"===this.environmentName&&this._rows.length>1?a.push("\\displaylines{"):"lines"!==this.environmentName&&a.push(`\\begin{${this.environmentName}}`),"array"===this.environmentName){if(a.push("{"),void 0!==this.colFormat)for(let e of this.colFormat)"align"in e&&"string"==typeof e.align?a.push(e.align):"separator"in e&&"solid"===e.separator?a.push("|"):"separator"in e&&"dashed"===e.separator&&a.push(":");a.push("}")}a.push(...n3(this.rowRules[0]));for(let o=0;o<this._rows.length;o++){for(let i=0;i<this._rows[o].length;i++)i>0&&a.push(" & "),a.push(oG.serialize(this._rows[o][i],e));let n=null!=(i=this.rowRules[o+1])?i:[];if(o<this._rows.length-1||n.length>0){let e=this.rowGaps[o];null!=e&&e.dimension?a.push(`\\\\[${e.dimension} ${null!=(r=e.unit)?r:"pt"}] `):a.push("\\\\ ")}a.push(...n3(n))}return"lines"===this.environmentName&&this._rows.length>1?a.push("}"):"lines"!==this.environmentName&&a.push(`\\end{${this.environmentName}}`),of(a)}forEachCell(e){for(let i=0;i<this.rowCount;i++)for(let r=0;r<this.colCount;r++)e(this._rows[i][r],i,r)}getCell(e,i){var r;return null==(r=this._rows[e])?void 0:r[i]}setCell(e,i,r){for(let r of("array"===this.type&&Array.isArray(this._rows)&&this._rows[e][i],this._rows[e][i]))r.parent=void 0,r.parentBranch=void 0;let a=[new oG({type:"first",mode:this.mode}),...r.filter(e=>"first"!==e.type)];this._rows[e][i]=a,n1(this),this.isDirty=!0}addRowBefore(e){"array"===this.type&&Array.isArray(this._rows),this._rows.splice(e,0,Array.from({length:this.colCount},()=>n0(this,!this.isMultiline))),this.rowRules.splice(e,0,[]),n1(this),this.isDirty=!0}addRowAfter(e){"array"===this.type&&Array.isArray(this._rows),this._rows.splice(e+1,0,Array.from({length:this.colCount},()=>n0(this,!this.isMultiline))),this.rowRules.splice(e+1,0,[]),n1(this),this.isDirty=!0}removeRow(e){for(let i of("array"===this.type&&Array.isArray(this._rows)&&this.rowCount,this.rowRules.splice(e,1),this._rows.splice(e,1)))for(let e of i)if(e)for(let i of e)i.parent=void 0,i.parentBranch=void 0;n1(this),this.isDirty=!0}addColumnBefore(e){for(let i of("array"===this.type&&Array.isArray(this._rows),this._rows))i.splice(e,0,n0(this));n6(this.rowRules,e,1),n1(this),this.isDirty=!0}addColumnAfter(e){for(let i of("array"===this.type&&Array.isArray(this._rows),this._rows))i.splice(e+1,0,n0(this));n6(this.rowRules,e+1,1),n1(this),this.isDirty=!0}addColumn(){this.addColumnAfter(this.colCount-1)}removeColumn(e){for(let i of("array"===this.type&&Array.isArray(this._rows)&&this.colCount,this._rows))for(let r of i.splice(e,1))if(r)for(let e of r)e.parent=void 0,e.parentBranch=void 0;n6(this.rowRules,e,-1),n1(this),this.isDirty=!0}get cells(){let e=[];for(let i of this._rows)for(let r of i)r&&e.push(r.filter(e=>"first"!==e.type));return e}get rows(){return this._rows}};function n0(e,i=!1){let r=new oG({type:"first",mode:e.mode});r.parent=e;let a=[r];if(i){let i=new nU;i.parent=e,a.push(i)}return a}function n1(e){for(let i=0;i<e.rowCount;i++)for(let r=0;r<e.colCount;r++){let a=e.getCell(i,r);if(a)for(let o of a)o&&(o.parent=e,o.parentBranch=[i,r])}}function n4(e){let i=new oE(null,{classes:"ML__arraycolsep"});return i.width=e,i}function n2(e,i){let r=new oE(null,{classes:"dashed"===e?"ML__hdashline":"ML__hline"});return r.height=i,r.depth=0,r.maxFontSize=i,r.setStyle("border-bottom",`${i}em ${e} currentColor`),r}function n3(e){return e&&0!==e.length?e.map(e=>{var i;if(void 0===e.from)return"dashed"===e.style?"\\hdashline ":"\\hline ";let r=null!=(i=e.to)?i:e.from;return`\\cline{${e.from+1}-${r+1}} `}):[]}function n6(e,i,r){var a;for(let o=0;o<e.length;o++){let n=[];for(let l of e[o]){if(void 0===l.from){n.push(l);continue}let e=l.from,o=null!=(a=l.to)?a:l.from;if(r>0)e>=i&&(e+=1),o>=i&&(o+=1);else{if(e===i&&o===i)continue;e>i&&(e-=1),o>=i&&(o-=1)}n.push(g(f({},l),{from:e,to:o}))}e[o]=n}}var n8=class e extends oG{constructor(e){super({mode:e.mode,command:e.command,style:e.style,body:e.body,type:"box"}),this.framecolor=e.framecolor,this.backgroundcolor=e.backgroundcolor,this.padding=e.padding,this.offset=e.offset,this.border=e.border}static fromJson(i){return new e(i)}toJson(){return g(f({},super.toJson()),{framecolor:this.framecolor,backgroundcolor:this.backgroundcolor,padding:this.padding,offset:this.offset,border:this.border})}render(e){var i,r,a,o;let n=oG.createBox(e,this.body,{type:"lift"});if(!n)return null;let l=e.toEm(null!=(i=this.offset)?i:{dimension:0});n.depth+=l,n.setStyle("display","inline-block"),n.setStyle("position","relative"),n.setStyle("height",Math.floor(100*n.height+n.depth)/100,"em"),n.setStyle("vertical-align",-Math.floor(100*n.height)/100,"em");let s=new oW({parent:e},this.style),c=s.toEm(null!=(r=this.padding)?r:{register:"fboxsep"}),d=new oE(null,{classes:"ML__box"});d.height=n.height+c,d.depth=n.depth+c,d.setStyle("box-sizing","border-box"),d.setStyle("position","absolute"),d.setStyle("top",-c+.3,"em"),d.setStyle("left",0),d.setStyle("height",d.height+d.depth,"em"),d.setStyle("width","100%"),this.backgroundcolor&&d.setStyle("background-color",null!=(a=s.toBackgroundColor(this.backgroundcolor))?a:"transparent"),this.framecolor&&d.setStyle("border",`${s.getRegisterAsEm("fboxrule",2)}em solid ${null!=(o=s.toColor(this.framecolor))?o:"black"}`),this.border&&d.setStyle("border",this.border);let u=new oE([d,n],{type:"lift"});return u.setStyle("display","inline-block"),u.setStyle("position","relative"),u.setStyle("line-height",0),u.height=n.height+c+(l>0?l:0),u.depth=n.depth+c+(l<0?-l:0),u.setStyle("padding-left",c,"em"),u.setStyle("padding-right",c,"em"),u.setStyle("height",Math.floor(100*(n.height+n.depth+2*c+Math.abs(l)))/100,"em"),u.setStyle("margin-top",-c,"em"),u.setStyle("top",Math.floor(100*(n.depth-n.height+2*c-l))/100,"em"),u.setStyle("vertical-align",Math.floor(100*(n.depth+2*c))/100,"em"),this.caret&&(u.caret=this.caret),this.attachSupsub(e,{base:u})}_serialize(e){return e.skipStyles?of([this.bodyToLatex(e),this.supsubToLatex(e)]):super._serialize(e)}},n5=class e extends oG{constructor(e,i){var r;super({type:"composition",mode:null!=(r=null==i?void 0:i.mode)?r:"math",value:e})}static fromJson(i){return new e(i.value,i)}toJson(){return super.toJson()}render(e){let i=new oE(this.value,{classes:"ML__composition",type:"composition"});return this.bind(e,i),this.caret&&(i.caret=this.caret),i}_serialize(e){return""}},n7=class e extends oG{constructor(e){super({type:"error",value:e,command:e,mode:"math"}),this.verbatimLatex=e}static fromJson(i){return new e(i.command)}toJson(){return super.toJson()}render(e){let i=this.createBox(e,{classes:"ML__error"});return this.caret&&(i.caret=this.caret),i}},n9=class e extends oG{constructor(e,i){super({type:"group",mode:i}),this.body=e,this.boxType=e.length>1?"ord":"ignore",this.skipBoundary=!0,this.displayContainsHighlight=!1,(null==e?void 0:e.length)===1&&","===e[0].command&&(this.captureSelection=!0)}static fromJson(i){return new e(i.body,i.mode)}render(e){let i=oG.createBox(e,this.body,{type:this.boxType});return i?(this.caret&&(i.caret=this.caret),this.bind(e,i)):null}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);return null!=i&&i.serialize?i.serialize(this,e):`{${this.bodyToLatex(e)}}`}},le=class e extends oG{constructor(e,i,r){super({type:"leftright",style:r.style,displayContainsHighlight:!0}),this.variant=e,this.body=i,this.leftDelim=r.leftDelim,this.rightDelim=r.rightDelim}static fromJson(i){var r;return new e(null!=(r=i.variant)?r:"",i.body,i)}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,r;let a=this.matchingRightDelim();return"left...right"===this.variant?of(["\\left",null!=(i=this.leftDelim)?i:".",this.bodyToLatex(e),"\\right",a]):"mleft...mright"===this.variant?of(["\\mleft",null!=(r=this.leftDelim)?r:".",this.bodyToLatex(e),"\\mright",a]):of([this.leftDelim&&"."!==this.leftDelim?this.leftDelim:"",this.bodyToLatex(e),a])}matchingRightDelim(){var e,i;if(this.rightDelim&&"?"!==this.rightDelim)return this.rightDelim;let r=null!=(e=this.leftDelim)?e:".";return null!=(i=nD[r])?i:r}render(e){var i,r;let a=new oW({parent:e},this.style);this.body;let o=new oW({parent:e,mathstyle:"textstyle"},this.style),n=null!=(i=oG.createBox(a,this.body,{type:"inner"}))?i:new oE(null,{type:"inner"}),l=n.height/o.scalingFactor,s=n.depth/o.scalingFactor,c=[];if(this.leftDelim&&c.push(this.bind(o,nH("open",this.leftDelim,l,s,o,{isSelected:this.isSelected,classes:"ML__open"+(this.containsCaret?" ML__contains-caret":""),mode:this.mode,style:this.style}))),n&&(function e(i,r,a,o,n){if(i)for(let l=0;l<i.length;l++){let s=i[l];"middle"===s.type?(i[l]=r.bind(a,nH("inner",s.value,o,n,a,{isSelected:r.isSelected})),i[l].caret=s.caret,i[l].isSelected=s.isSelected,i[l].cssId=s.cssId,i[l].htmlData=s.htmlData,i[l].htmlStyle=s.htmlStyle,i[l].attributes=s.attributes,i[l].cssProperties=s.cssProperties):s.children&&e(s.children,r,a,o,n)}}(n.children,this,a,l,s),c.push(n)),this.rightDelim){let e=this.containsCaret?" ML__contains-caret":"",i=this.rightDelim;"?"===i&&(a.smartFence?(i=this.matchingRightDelim(),e+=" ML__smart-fence__close"):i="."),c.push(this.bind(o,nH("close",i,l,s,o,{isSelected:this.isSelected,classes:e+" ML__close",mode:this.mode,style:this.style})))}let d="mleft...mright"===this.variant,u=this.leftSibling;u&&(!d&&u.isFunction&&(d=!0),!d&&"subsup"===u.type&&null!=(r=u.leftSibling)&&r.isFunction&&(d=!0));let h=new oE(c,{type:d?"close":"inner",classes:"ML__left-right"});return h.setStyle("margin-top",`${-n.depth}em`),h.setStyle("height",`${n.height+n.depth}em`),this.caret&&(h.caret=this.caret),this.bind(a,h.wrap(a))}},lt=class e extends oG{constructor(e,i){var r;super({type:"macro",command:e,style:i.style}),this.body=i.body,void 0===i.captureSelection?i.args?this.captureSelection=!1:this.captureSelection=!0:this.captureSelection=i.captureSelection,this.macroArgs=i.args,this.expand=null!=(r=i.expand)&&r}static fromJson(i){return new e(i.command,i)}toJson(){let e=super.toJson();return this.expand&&(e.expand=!0),void 0!==this.captureSelection&&(e.captureSelection=this.captureSelection),this.macroArgs&&(e.args=this.macroArgs),e}_serialize(e){var i;return e.expandMacro&&this.expand?this.bodyToLatex(e):this.command+(null!=(i=this.macroArgs)?i:"")}applyStyle(e,i){let r={};e.color&&(r.color=e.color),e.backgroundColor&&(r.backgroundColor=e.backgroundColor),super.applyStyle(r,i)}render(e){let i=oG.createBox(e,this.body,{type:"lift"});return i?(this.caret&&(i.caret=this.caret),this.bind(e,i)):null}},li=class e extends oG{constructor(){super({type:"macro-argument"})}static fromJson(i){return new e}toJson(){return super.toJson()}_serialize(e){return""}render(e){return null}},lr=class e extends oG{constructor(e,i,r=!1,a,o){var n;super({type:"prompt",mode:null!=(n=null==o?void 0:o.mode)?n:"math",style:null==o?void 0:o.style,command:"\\placeholder"}),this.body=a,this.correctness=i,this.placeholderId=e,this.locked=r,this.captureSelection=this.locked}static fromJson(i){return new e(i.placeholderId,i.correctness,i.locked,i.body,i)}toJson(){let e=super.toJson();return this.placeholderId&&(e.placeholderId=this.placeholderId),this.body||delete e.body,this.body&&(e.body=this.body.filter(e=>"first"!==e.type).map(e=>e.toJson())),this.correctness&&(e.correctness=this.correctness),e.locked=this.locked,e}render(e){var i,r,a,o,n;let l=new oW({parent:e}),s=l.getRegisterAsEm("fboxsep"),c=oG.createBox(e,this.body);if(!c)return null;let d=!this.body||0===this.body.length||this.body.every(e=>"first"===e.type)?new nU({mode:this.mode,style:this.style}).render(new oW({parent:e,isPhantom:!0})):null,u=null!=(i=null==d?void 0:d.height)?i:l.metrics.xHeight,h=null!=(r=null==d?void 0:d.depth)?r:u/2,p=Math.max(null!=(a=c.height)?a:0,u),m=Math.max(null!=(o=c.depth)?o:0,h);c.setStyle("vertical-align",`calc(-${p}em + 2px)`),"correct"===this.correctness?c.setStyle("color","var(--correct-color, var(--ML__correct-color))"):"incorrect"===this.correctness&&c.setStyle("color","var(--incorrect-color, var(--ML__incorrect-color))");let f=p+m+2*s-2*s,g=new oE(c,{type:"ord"});g.setStyle("display","inline-block"),g.height=p,g.depth=m,g.setStyle("height",p+m,"em"),g.setStyle("vertical-align",-s,"em"),(null!=(n=c.width)?n:0)<f&&(g.width=f,g.setStyle("width",f,"em"));let b="ML__prompt ";this.locked?b+=" ML__lockedPromptBox ":b+=" ML__editablePromptBox ","correct"===this.correctness?b+=" ML__correctPromptBox ":"incorrect"===this.correctness&&(b+=" ML__incorrectPromptBox "),this.containsCaret&&(b+=" ML__focusedPromptBox ");let y=new oE(null,{classes:b,attributes:{part:"prompt"}});y.height=g.height+s,y.depth=g.depth+s,y.width=g.width+2*s,y.setStyle("position","absolute"),y.setStyle("height",g.height+g.depth+2*s,"em"),0===s&&y.setStyle("width","100%"),0!==s&&(y.setStyle("width",`calc(100% + ${2*s}em)`),y.setStyle("top",s,"em"),y.setStyle("left",-s,"em"));let v="";"incorrect"===this.correctness&&(v+='<line x1="3%" y1="97%" x2="97%" y2="3%" stroke-width="0.5" stroke="var(--incorrect-color, var(--ML__incorrect-color))" stroke-linecap="round" />'),v&&(y.svgOverlay=v);let x=new oE([y,g],{classes:"ML__prompt-atom"});g.setStyle("line-height",1),x.setStyle("position","relative"),x.setStyle("display","inline-block"),x.setStyle("line-height",0),x.height=p+s+.2,x.depth=m+s,x.left=s,x.right=s,x.setStyle("height",p+2*s,"em"),x.setStyle("top",m-p-s/2,"em"),x.setStyle("vertical-align",g.depth,"em"),x.setStyle("margin-left",.5,"em"),x.setStyle("margin-right",.5,"em"),this.caret&&(x.caret=this.caret);let _=this.attachSupsub(e,{base:x}),w=this.bind(l,_);return w&&this.id&&(y.atomID=this.id,g.atomID=this.id,x.atomID=this.id),w}_serialize(e){var i;let r=null!=(i=this.bodyToLatex(e))?i:"";if(e.skipPlaceholders)return r;let a="\\placeholder";return this.placeholderId&&(a+=`[${this.placeholderId}]`),"correct"===this.correctness?a+="[correct]":"incorrect"===this.correctness&&(a+="[incorrect]"),this.locked&&(a+="[locked]"),og(a,r)}},la=class e extends oG{constructor(e){super({type:"subsup",style:null==e?void 0:e.style}),this.subsupPlacement="auto"}get children(){if(!this._children){let e=[],i=this.branch("subscript");if(i)for(let r of i)e.push(...r.children),e.push(r);let r=this.branch("superscript");if(r)for(let i of r)e.push(...i.children),e.push(i);this._children=e}return this._children}static fromJson(i){let r=new e(i);for(let e of oU)i[e]&&r.setChildren(i[e],e);return r}render(e){var i;let r=new oW({parent:e,isPhantom:!0}),a=this.leftSibling,o=null!=(i=a.render(r))?i:new oE(null),n=new oE(null);return n.height=o.height,n.depth=o.depth,this.attachSupsub(e,{base:n,isCharacterBox:a.isCharacterBox(),type:"ignore"})}_serialize(e){return this.supsubToLatex(e)}};function lo(e){return!!e&&!/^(<$$>|<$>|<space>|<{>|<}>|#[0-9\?]|\\.+)$/.test(e)}var ln=class{constructor(e,i,r){var a,o,n,l;this.errors=[],this.index=0,this.endCount=0,this.localMacros={},null!=r||(r={}),this.tokens=e,this.context=i instanceof oW&&!(null!=r&&r.parseMode)&&!r.mathstyle?i:new oW({from:i,mathstyle:r.mathstyle},r.style),this.args=null!=(a=r.args)?a:void 0,this.smartFence=this.context.smartFence,this.parsingContext={parent:void 0,mathlist:[],style:null!=(o=r.style)?o:{},parseMode:null!=(n=r.parseMode)?n:"math",mathstyle:null!=(l=r.mathstyle)?l:"displaystyle",tabular:!1}}beginContext(e){var i,r,a,o,n,l;if(null!=e&&e.root){this.parsingContext={parent:this.parsingContext.parent,mathlist:[],style:{},parseMode:null!=(i=null==e?void 0:e.mode)?i:"math",mathstyle:null!=(r=null==e?void 0:e.mathstyle)?r:"displaystyle",tabular:null!=(a=null==e?void 0:e.tabular)&&a};return}let s=this.parsingContext,c={parent:s,mathlist:[],style:f({},s.style),parseMode:null!=(o=null==e?void 0:e.mode)?o:s.parseMode,mathstyle:null!=(n=null==e?void 0:e.mathstyle)?n:s.mathstyle,tabular:null!=(l=null==e?void 0:e.tabular)&&l};this.parsingContext=c}endContext(){this.parsingContext=this.parsingContext.parent}onError(e){this.errors.push(f({before:ob(this.tokens.slice(this.index,this.index+10)),after:ob(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 f({},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.index<this.tokens.length?this.tokens[this.index++]:""}peek(){return this.tokens[this.index]}expandUnicode(){if(!this.peek()||"math"!==this.parseMode)return;let e=function(e){var i;if("{}<>[]$&*#^_%:'˜".includes(e)||e.length>1)return;let r=null!=(i=e.codePointAt(0))?i:0,a=Z[r];if(a)return a;let{char:o,variant:n,style:l}=function(e){var i;if((e<119808||e>120831)&&(e<8448||e>8527))return{char:String.fromCodePoint(e)};for(let r in Y)if(Y[r]===e){e=null!=(i=r.codePointAt(0))?i:0;break}for(let i of Q)if(e>=i.start&&e<i.start+i.len)return{char:String.fromCodePoint(e-i.start+i.offset),variant:i.variant,style:i.style};return{char:String.fromCodePoint(e)}}(r);if(!(!n&&!l)){switch(a=o,n){case"double-struck":a=`\\mathbb{${a}}`;break;case"fraktur":a=`\\mathfrak{${a}}`;break;case"script":a=`\\mathscr{${a}}`;break;case"sans-serif":a=`\\mathsf{${a}}`;break;case"monospace":a=`\\mathtt{${a}}`;break;case"calligraphic":a=`\\mathcal{${a}}`}switch(l){case"bold":a=`\\mathbf{${a}}`;break;case"italic":a=`\\mathit{${a}}`;break;case"bolditalic":a=`\\mathbfit{${a}}`}return a}}(this.peek());e&&this.tokens.splice(this.index,1,...om(e))}match(e){return this.tokens[this.index]===e&&(this.index++,!0)}lastSubsupAtom(){let e;return this.mathlist.length>0&&("subsup"===(e=this.mathlist[this.mathlist.length-1]).type||void 0!==e.subsupPlacement)||(e=new la({style:this.style}),this.mathlist.push(e)),e}hasPattern(e){return e.test(this.tokens[this.index])}hasInfixCommand(){var e;let{index:i}=this;if(i<this.tokens.length&&this.tokens[i].startsWith("\\")){let r=eM(this.tokens[i],this.parseMode);return!!r&&"symbol"!==r.definitionType&&(!r.ifMode||!!r.ifMode.includes(this.parseMode))&&null!=(e=r.infix)&&e}return!1}matchColumnSeparator(){return!!this.tabularMode&&"&"===this.peek()&&(this.index++,!0)}matchRowSeparator(){if(!this.tabularMode)return!1;let e=this.peek();return("\\\\"===e||"\\cr"===e||"\\tabularnewline"===e)&&(this.index++,!0)}placeholder(){var e;let i=null==(e=this.args)?void 0:e.call(this,"?");return i?ll(i,{parseMode:this.parseMode,mathstyle:"textstyle"}):[new nU({mode:this.parseMode,style:this.style})]}skipWhitespace(){for(;this.match("<space>"););}skipUntilToken(e){let i=this.tokens[this.index];for(;i&&i!==e;)i=this.tokens[++this.index];i===e&&this.index++}skipFiller(){for(;this.match("\\relax")||this.match("<space>"););}matchKeyword(e){let i=this.index,r=this.end(),a="";for(;!r;){let i=this.get();lo(i)?(a+=i,r=this.end()||a.length>=e.length):r=!0}let o=e.toUpperCase()===a.toUpperCase();return o||(this.index=i),o}scanString(){let e="";for(;!this.end();){let i=this.peek();if("]"===i)break;if("<space>"===i)e+=" ";else if(i.startsWith("\\"))this.onError({code:"unexpected-command-in-string"}),e+=i.substring(1);else if(lo(i))e+=i;else break;this.next()}return e}scanBalancedString(){let e="",i=this.end(),r=1;for(;!i;){let a=this.get();"<space>"===a?e+=" ":"<{>"===a?(e+="{",r+=1):"<}>"===a?(r-=1)>0?e+="}":this.index-=1:"<$>"===a?e+="$":"<$$>"===a?e+="$$":e+=a,i=0===r||this.end()}return e}scanLiteralGroup(){var e;if(!this.match("<{>"))return"";let i="",r=1;for(;r>0&&!this.end();){let a=this.get();"<}>"===a?(r-=1)>0&&(i+="}"):"<{>"===a?(r+=1,i+="{"):(/\\[a-zA-Z]+$/.test(i)&&/^[a-zA-Z]/.test(a)&&(i+=" "),i+=null!=(e=({"<space>":" ","<$$>":"$$","<$>":"$"})[a])?e:a)}return i}scanNumber(e=!0){var i,r;let a=!1,o=this.peek();for(;"<space>"===o||"+"===o||"-"===o;)this.get(),"-"===o&&(a=!a),o=this.peek();e=!!e;let n=10,l=/\d/;if(this.match("'"))n=8,l=/[0-7]/,e=!0;else if(this.match('"'))n=16,l=/[\dA-F]/,e=!0;else if(this.match("x"))n=16,l=/[\dA-Fa-f]/,e=!0;else if(this.match("`"))return(o=this.get())?2===o.length&&o.startsWith("\\")?{number:(a?-1:1)*(null!=(i=o.codePointAt(1))?i:0),base:"alpha"}:{number:(a?-1:1)*(null!=(r=o.codePointAt(0))?r:0),base:"alpha"}:null;let s="";for(;this.hasPattern(l);)s+=this.get();if(!e&&(this.match(".")||this.match(",")))for(s+=".";this.hasPattern(l);)s+=this.get();let c=e?Number.parseInt(s,n):Number.parseFloat(s);return Number.isNaN(c)?null:{number:a?-c:c,base:16===n?"hexadecimal":8===n?"octal":"decimal"}}scanRegister(){var e;let i=this.index,r=this.scanNumber(!1);if(this.skipWhitespace(),this.match("\\relax"))return r;let a=!1;if(null===r)for(;;){let e=this.peek();if("-"===e)a=!a;else if("+"!==e)break;this.next(),this.skipWhitespace()}if(this.match("\\global")){this.skipWhitespace();let e=this.get();return e.startsWith("\\")?r?{register:e,global:!0,factor:(a?-1:1)*r.number}:a?{register:e,global:!0,factor:-1}:{register:e,global:!0}:(this.index=i,null)}let o=this.get();return null!=o&&o.startsWith("\\")?(o=o.substring(1),this.context.registers[o]?a&&null===r?{register:o}:{register:o,factor:(a?-1:1)*(null!=(e=null==r?void 0:r.number)?e:1)}:(this.index=i,null)):(this.index=i,null)}scanValue(){let e=this.scanRegister();if(e)return e;let i=this.index,r=this.scanGlueOrDimen();if(r&&("unit"in r||"glue"in r&&"unit"in r.glue))return r;this.index=i;let a=this.scanNumber();if(a)return a;if(this.end()||!lo(this.peek()))return null;let o=this.scanString();return o.length>0?{string:o}:null}scanDimen(){let e,i=this.scanNumber(!1);if(null===i)return null;let r=i.number;return this.skipWhitespace(),this.matchKeyword("true"),this.skipWhitespace(),this.matchKeyword("pt")?e="pt":this.matchKeyword("mm")?e="mm":this.matchKeyword("cm")?e="cm":this.matchKeyword("ex")?e="ex":this.matchKeyword("px")?e="px":this.matchKeyword("em")?e="em":this.matchKeyword("bp")?e="bp":this.matchKeyword("dd")?e="dd":this.matchKeyword("pc")?e="pc":this.matchKeyword("in")?e="in":this.matchKeyword("mu")&&(e="mu"),e?{dimension:r,unit:e}:{dimension:r}}scanGlueOrDimen(){let e=this.scanDimen();if(null===e)return null;if(this.skipWhitespace(),this.match("\\relax"))return e;let i={glue:e};if(this.matchKeyword("plus")){let e=this.scanDimen();if(!e)return i;i.grow=e}if(this.skipWhitespace(),this.match("\\relax"))return i;if(this.skipWhitespace(),this.matchKeyword("minus")){let e=this.scanDimen();if(!e)return i;i.shrink=e}return i.grow||i.shrink?i:e}scanColspec(){this.skipWhitespace();let e=[];for(;!this.end()&&"<}>"!==this.peek()&&"]"!==this.peek();){let i=this.get();"c"===i||"r"===i||"l"===i?e.push({align:i}):"|"===i?e.push({separator:"solid"}):":"===i?e.push({separator:"dashed"}):"@"===i&&(this.match("<{>")&&(this.beginContext({mode:"math"}),e.push({gap:this.scan(e=>"<}>"===e)}),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 i=this.scan(i=>i===("displaystyle"===e?"\\]":"\\)"));return this.match("displaystyle"===e?"\\]":"\\)")||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),i}scanModeShift(){let e="";if(this.match("<$>")&&(e="<$>"),!e&&this.match("<$$>")&&(e="<$$>"),!e)return null;this.beginContext({mode:"math",mathstyle:"<$>"===e?"textstyle":"displaystyle"});let i=this.scan(i=>i===e);return this.match(e)||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),i}scanEnvironment(){var e;if(!this.match("\\begin"))return null;let i=this.scanArgument("string");if(!i)return null;let r=null!=(e=el[i])?e:null;if(!r)return this.onError({code:"unknown-environment",arg:i}),null;let a=[];if(r.params)for(let e of r.params)if(e.isOptional)a.push(this.scanOptionalArgument(e.type));else{let r=this.scanArgument(e.type);r||this.onError({code:"missing-argument",arg:i}),a.push(r)}this.beginContext({tabular:r.tabular,root:r.rootOnly});let o=[],n=[],l=[this.scanRowRules()],s=[],c=!1;do if(this.end()&&(this.onError({code:"unbalanced-environment",arg:i}),c=!0),!c&&this.match("\\end")&&(this.scanArgument("string")!==i&&this.onError({code:"unbalanced-environment",arg:i}),c=!0),!c)if(this.matchColumnSeparator())s.push(this.mathlist),this.mathlist=[];else if(this.matchRowSeparator()){s.push(this.mathlist),this.mathlist=[];let e=null;this.skipWhitespace(),this.match("[")&&(e=this.scanDimen(),this.skipWhitespace(),this.match("]")),n.push(null!=e?e:{dimension:0}),o.push(s),s=[],l.push(this.scanRowRules())}else this.mathlist.push(...this.scan(e=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline"].includes(e)));while(!c)return s.push(this.mathlist),s.length>0&&o.push(s),this.endContext(),r.rootOnly&&(this.index=this.tokens.length),r.createAtom(i,o,n,a,this.context.maxMatrixCols,l.some(e=>e.length>0)?l:void 0)}scanRowRules(){var e;if(!this.tabularMode)return[];let i=[];for(this.skipWhitespace();!this.end();){if(this.match("\\hline"))i.push({style:"solid"});else if(this.match("\\hdashline"))i.push({style:"dashed"});else if(this.match("\\cline")){let r=(null!=(e=this.scanArgument("string"))?e:"").match(/^\s*(\d+)\s*(?:-\s*(\d+))?\s*$/);if(r){let e=Number.parseInt(r[1],10)-1,a=void 0===r[2]?e:Number.parseInt(r[2],10)-1;e>=0&&a>=e?i.push({style:"solid",from:e,to:a}):this.onError({code:"missing-argument",arg:"\\cline"})}else this.onError({code:"missing-argument",arg:"\\cline"})}else break;this.skipWhitespace()}return i}scanExpression(){let e=this.mathlist;if(this.mathlist=[],this.parseExpression()){let i=this.mathlist;return this.mathlist=e,i}return this.mathlist=e,null}scan(e){let i;this.beginContext(),e||(e=e=>"<}>"===e);let r="",a=null,o=[],n=null;for(;!this.end()&&!e(this.peek());)this.hasInfixCommand()&&!r?((a=eM(r=this.get(),"math"))&&(o=this.scanArguments(a)[1]),n=this.mathlist,this.mathlist=[]):this.parseExpression();return r?(o.unshift(this.mathlist),n&&o.unshift(n),i=[a.createAtom({command:r,args:o,style:this.style,mode:this.parseMode})]):i=this.mathlist,this.endContext(),i}scanGroup(){let e=this.index;if(!this.match("<{>"))return null;let i=this.scan(e=>"<}>"===e);if(this.match("<}>")||this.onError({code:"unbalanced-braces"}),1===i.length&&"placeholder"===i[0].type)return i[0];let r=new n9(i,this.parseMode);return r.verbatimLatex=ob(this.tokens.slice(e,this.index)),r}scanSmartFence(){if(this.skipWhitespace(),!this.match("("))return null;this.beginContext();let e=1;for(;!this.end()&&0!==e;)this.match("(")&&(e+=1),this.match(")")&&(e-=1),0!==e&&this.parseExpression();let i=new le("",this.mathlist,{leftDelim:"(",rightDelim:0===e?")":"?"});return this.endContext(),i}scanDelim(){this.skipWhitespace();let e=this.peek();if(!e)return this.onError({code:"unexpected-end-of-string"}),null;if(!lo(e)&&!e.startsWith("\\"))return null;this.next();let i=eM(e,"math");return i?"function"===i.definitionType&&i.ifMode&&!i.ifMode.includes(this.parseMode)?(this.onError({code:"unexpected-delimiter",arg:e}),null):"symbol"===i.definitionType&&("mopen"===i.type||"mclose"===i.type)||/^(\.|\?|\||<|>|\\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 e;if(this.match("\\right"))return this.onError({code:"unbalanced-braces"}),new n7("\\right");if(this.match("\\mright"))return this.onError({code:"unbalanced-braces"}),new n7("\\mright");let i="\\right";if(!this.match("\\left")){if(!this.match("\\mleft"))return null;i="\\mright"}let r=this.scanDelim();if(!r)return this.onError({code:"unexpected-delimiter"}),new n7("\\right"===i?"\\left":"\\mleft");for(this.beginContext();!this.end()&&!this.match(i);)this.parseExpression();let a=this.mathlist;return this.endContext(),new le("\\right"===i?"left...right":"mleft...mright",a,{leftDelim:r,rightDelim:null!=(e=this.scanDelim())?e:".",style:this.style})}parseSupSub(){if("math"!==this.parseMode)return!1;let e=this.peek();if("^"!==e&&"_"!==e&&"'"!==e)return!1;let i=this.lastSubsupAtom();for(;"^"===e||"_"===e||"'"===e;)this.match("'")?this.match("'")?i.addChild(new oG({type:"mord",command:"\\doubleprime",mode:"math",value:"′′"}),"superscript"):i.addChild(new oG({type:"mord",command:"\\prime",mode:"math",value:"′"}),"superscript"):(this.match("^")||this.match("_"))&&i.addChildren(et(this.scanArgument("expression")),"_"===e?"subscript":"superscript"),e=this.peek();return!0}parseLimits(){if("math"!==this.parseMode)return!1;let e=this.match("\\limits"),i=!e&&this.match("\\nolimits"),r=!i&&!e&&this.match("\\displaylimits");if(!e&&!i&&!r)return!1;let a=this.mathlist.length>0?this.mathlist[this.mathlist.length-1]:null;return null!==a&&(a.explicitSubsupPlacement=!0,e&&(a.subsupPlacement="over-under"),i&&(a.subsupPlacement="adjacent"),r&&(a.subsupPlacement="auto"),!0)}scanArguments(e){if(!(null!=e&&e.params))return[void 0,[]];let i,r=[],a=2*!!e.infix;for(;a<e.params.length;){let o=e.params[a];"rest"===o.type?r.push(this.scan(e=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(e))):o.isOptional?r.push(this.scanOptionalArgument(o.type)):o.type.endsWith("*")?i=o.type.slice(0,-1):r.push(this.scanArgument(o.type)),a+=1}return[i,r]}scanSymbolOrLiteral(){let e,i=this.peek();if(!i)return null;if(this.next(),lo(i)){let e=ov.createAtom(this.parseMode,i,f({},this.style));return e?[e]:null}if(e=this.scanMacro(i))return[e];if(i.startsWith("\\")){let r=eM(i,this.parseMode);if(!r)return this.onError({code:"unknown-command",arg:i}),[new n7(i)];if("symbol"===r.definitionType){let a=f({},this.style);r.variant&&(a.variant=r.variant),e=new oG({type:r.type,command:i,style:a,value:String.fromCodePoint(r.codepoint),mode:this.parseMode,verbatimLatex:i})}else{if(r.applyMode||r.applyStyle||r.infix)return this.onError({code:"invalid-command",arg:i}),[new n7(i)];r.createAtom&&(e=r.createAtom({command:i,args:[],style:this.style,mode:this.parseMode}))}}return e?[e]:null}scanArgument(e){var i;this.skipFiller();let r=this.parseMode;if("auto"===e&&(e=r),!this.match("<{>")){if("string"===e)return this.scanString();if("value"===e)return this.scanValue();if("delim"===e)return null!=(i=this.scanDelim())?i:".";if("expression"===e)return this.scanExpression();if("math"===e){e!==r&&this.beginContext({mode:"math"});let i=this.scanSymbolOrLiteral();return e!==r&&this.endContext(),i}if("text"===e){e!==r&&this.beginContext({mode:"text"});let i=this.scanSymbolOrLiteral();return e!==r&&this.endContext(),i}return"balanced-string"===e?null:"rest"===e?this.scan(e=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(e)):null}if("text"===e){this.beginContext({mode:"text"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end())let e=this.mathlist;return this.endContext(),{group:e}}if("math"===e){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end())let e=this.mathlist;return this.endContext(),{group:e}}if("rest"===e){let e=this.scan();return this.match("<}>")||this.onError({code:"unbalanced-braces"}),{group:e}}let a=null;if("expression"===e){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end())let e=this.mathlist;return this.endContext(),{group:e}}return"string"===e?a=this.scanString():"balanced-string"===e?a=this.scanBalancedString():"colspec"===e?a=this.scanColspec():"value"===e&&(a=this.scanValue()),this.skipUntilToken("<}>"),a}scanOptionalArgument(e){if(e="auto"===e?this.parseMode:e,this.skipFiller(),!this.match("["))return null;let i=null;for(;!this.end()&&!this.match("]");)if("string"===e)i=this.scanString();else if("value"===e)i=this.scanValue();else if("colspec"===e)i=this.scanColspec();else if("bbox"===e){let e={};for(let i of this.scanString().toLowerCase().trim().split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/)){let r=i.match(/^\s*([\d.]+)\s*([a-z]{2})/);if(r)e.padding={dimension:Number.parseFloat(r[1]),unit:r[2]};else{let r=i.match(/^\s*border\s*:\s*(.*)/);r?e.border=r[1]:e.backgroundcolor={string:i}}}i=e}else"math"===e&&(this.beginContext({mode:"math"}),i=this.mathlist.concat(this.scan(e=>"]"===e)),this.endContext());return i}scanSymbolOrCommand(e){var i,r,a;if("\\placeholder"===e){let e=this.scanOptionalArgument("string"),i=this.scanOptionalArgument("math"),r=oG.serialize(i,{defaultMode:"math"}),a=[],o;o||"correct"!==r?o||"incorrect"!==r?""!==r&&(a=i):o="incorrect":o="correct";let n="locked"===this.scanOptionalArgument("string"),l=this.scanArgument("auto"),s;return s=l&&Array.isArray(l)&&l.length>0?l:l&&"object"==typeof l&&"group"in l?l.group:a,e?[new lr(e,o,n,null!=s?s:a,{mode:this.parseMode,style:this.style})]:[new nU({mode:this.parseMode,style:this.style})]}if("\\renewcommand"===e||"\\newcommand"===e||"\\providecommand"===e||"\\def"===e){let i=this.index,r=this.scanLiteralGroup()||this.next();if(!r)return null;if(this.context.registers[r.substring(1)]){let a=this.scanArgument("string");return null!==a&&(this.context.registers[r.substring(1)]=a),[new oG({type:"text",value:"",verbatimLatex:of([e,ob(this.tokens.slice(i,this.index))])})]}}let o=this.scanMacro(e);if(o)return[o];let n=eM(e,this.parseMode);if(!n)return"text"===this.parseMode?(/[a-zA-Z]/.test(null!=(i=this.peek())?i:"")&&(e+=" "),[...e].map(e=>new oG({type:"text",value:e,mode:"text",style:this.style}))):(this.onError({code:"unknown-command",arg:e}),[new n7(e)]);let l=this.index;if("symbol"===n.definitionType){let i=f({},this.style);n.variant&&(i.variant=n.variant),o=new oG({type:n.type,command:e,style:i,value:String.fromCodePoint(n.codepoint),mode:this.parseMode})}else{if(n.ifMode&&!n.ifMode.includes(this.parseMode))return[];let i=this.parseMode;n.applyMode&&(this.parseMode=n.applyMode);let l,s=[];if(n.parse?s=n.parse(this):[l,s]=this.scanArguments(n),this.parseMode=i,n.applyMode&&!n.applyStyle&&!n.createAtom)return et(s[0]);if(n.infix)return this.onError({code:"too-many-infix-commands",arg:e}),null;if("function"==typeof n.createAtom)o=n.createAtom({command:e,args:s,style:this.style,mode:this.parseMode}),l&&(o.body=et(this.scanArgument(l)));else if("function"==typeof n.applyStyle){let i=n.applyStyle(this.style,e,s,this.context),r=this.parseMode;if(n.applyMode&&(this.parseMode=n.applyMode),l){let e=this.style;this.style=i;let a=this.scanArgument(l);return this.style=e,this.parseMode=r,et(a)}this.style=i}else o=new oG({type:"mord",command:null!=(r=n.command)?r:e,style:f({},this.style),value:e,mode:null!=(a=n.applyMode)?a:this.parseMode})}if(!o)return null;if(o instanceof oG&&void 0===o.verbatimLatex&&!/^\\(llap|rlap|class|cssId|htmlData)$/.test(e)){let i=of([e,ob(this.tokens.slice(l,this.index))]);i&&(o.verbatimLatex=i)}if(null===o.verbatimLatex&&(o.verbatimLatex=void 0),o.isFunction&&this.smartFence){let e=this.scanSmartFence();if(e)return[o,e]}return[o]}scanSymbolCommandOrLiteral(){this.expandUnicode();let e=this.get();if(!e)return null;if(lo(e)){let i=ov.createAtom(this.parseMode,e,f({},this.style));if(!i)return null;if(i.isFunction&&this.smartFence){let e=this.scanSmartFence();if(e)return[i,e]}return[i]}return e.startsWith("\\")?this.scanSymbolOrCommand(e):"<space>"===e?"text"===this.parseMode?[new oY(" "," ",this.style)]:null:("<}>"===e?this.onError({latex:"",code:"unbalanced-braces"}):this.onError({latex:"",code:"unexpected-token",arg:e}),null)}defineLocalMacro(e,i){let r=e.startsWith("\\")?e.slice(1):e;r&&(this.localMacros[r]=i)}scanMacro(e){var i;let r=e.startsWith("\\")?this.localMacros[e.slice(1)]:void 0,a=null!=r?r:this.context.getMacro(e);if(!a)return null;let o=this.index,n=a.args,l={"?":null==(i=this.args)?void 0:i.call(this,"?")};for(let e=1;e<=n;e++){let i=this.scanLiteralGroup();if(!i){let e=this.index;this.scanExpression(),i=ob(this.tokens.slice(e,this.index))}l[e]=i}return new lt(e,{expand:a.expand,captureSelection:a.captureSelection,args:o===this.index?null:ob(this.tokens.slice(o,this.index)),style:this.parsingContext.style,body:ll(a.def,{context:this.context,parseMode:this.parseMode,args:e=>l[e],mathstyle:this.parsingContext.mathstyle,style:this.parsingContext.style})})}parseExpression(){var e,i,r,a;let o=null!=(a=null!=(r=null!=(i=null!=(e=this.scanEnvironment())?e:this.scanModeShift())?i:this.scanModeSet())?r:this.scanGroup())?a:this.scanLeftRight();if(null===o){if(this.parseSupSub()||this.parseLimits())return!0;o=this.scanSymbolCommandOrLiteral()}return!!o&&(R(o)?this.mathlist.push(...o):this.mathlist.push(o),!0)}};function ll(e,i){var r,a,o,n;let l=null!=(r=null==i?void 0:i.args)?r:void 0,s=new ln(om(e,l),null==i?void 0:i.context,{args:l,mathstyle:null!=(a=null==i?void 0:i.mathstyle)?a:"displaystyle",parseMode:null!=(o=null==i?void 0:i.parseMode)?o:"math",style:null!=(n=null==i?void 0:i.style)?n:{}}),c=[];for(;!s.end();)c.push(...s.scan(()=>!1));return c}function ls(e,i){var r;let a=new ln(om(e,null),null==i?void 0:i.context,{mathstyle:"displaystyle",parseMode:null!=(r=null==i?void 0:i.parseMode)?r:"math"});for(;!a.end();)a.scan();return a.errors}var lc=class e extends oG{constructor(e,i){super({type:"chem"},{command:e,mode:"math"});let r=lu.go(ld.go(i,"\\pu"===e?"pu":"ce"),!1);this.body=ll(r),this._verbatimLatex=e+"{"+i+"}",this.arg=i,this.captureSelection=!0}static fromJson(i){return new e(i.command,i.arg)}set verbatimLatex(e){}get verbatimLatex(){return this._verbatimLatex}toJson(){return g(f({},super.toJson()),{arg:this.arg})}render(e){let i=oG.createBox(e,this.body,{type:"inner"});return this.caret&&(i.caret=this.caret),this.bind(e,i)}_serialize(e){return this.verbatimLatex,this.verbatimLatex}};ex(["ce","pu"],"{chemformula:balanced-string}",{createAtom:e=>{var i;return new lc(e.command,null!=(i=e.args[0])?i:"")}});var ld={go:function(e,i){if(!e)return[];void 0===i&&(i="ce");var r="0",a={};a.parenthesisLevel=0,e=(e=(e=e.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var o,n=10,l=[];;){o!==e?(n=10,o=e):n--;for(var s=ld.stateMachines[i],c=s.transitions[r]||s.transitions["*"],d=0;d<c.length;d++){var u=ld.patterns.match_(c[d].pattern,e);if(u){for(var h,p=c[d].task,m=0;m<p.action_.length;m++){if(s.actions[p.action_[m].type_])h=s.actions[p.action_[m].type_](a,u.match_,p.action_[m].option);else if(ld.actions[p.action_[m].type_])h=ld.actions[p.action_[m].type_](a,u.match_,p.action_[m].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+p.action_[m].type_+")"];ld.concatArray(l,h)}if(r=p.nextState||r,!(e.length>0))return l;if(p.revisit||(e=u.remainder),!p.toContinue)break}}if(n<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(e,i){if(i)if("[object Array]"===Object.prototype.toString.call(i))for(var r=0;r<i.length;r++)e.push(i[r]);else e.push(i)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(e){var i=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return i&&i[0]?{match_:i.slice(1),remainder:e.substr(i[0].length)}:null},"(-)(9)^(-9)":function(e){var i=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return i&&i[0]?{match_:i.slice(1),remainder:e.substr(i[0].length)}:null},"state of aggregation $":function(e){var i=ld.patterns.findObserveGroups(e,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(i&&i.remainder.match(/^($|[\s,;\)\]\}])/))return i;var r=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return r?{match_:r[0],remainder:e.substr(r[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return ld.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return ld.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return ld.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return ld.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return ld.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return ld.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return ld.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return ld.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return ld.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return ld.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return ld.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return ld.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return ld.patterns.findObserveGroups(e,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(e){return ld.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return ld.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return ld.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return ld.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(e){return ld.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return ld.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return ld.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return ld.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return ld.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return ld.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return ld.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return ld.patterns.findObserveGroups(e,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(e){if(i=e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/))return{match_:i[0],remainder:e.substr(i[0].length)};var i,r=ld.patterns.findObserveGroups(e,"","$","$","");return r&&(i=r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/))?{match_:i[0],remainder:e.substr(i[0].length)}:null},amount2:function(e){return this.amount(e)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(e){if(e.match(/^\([a-z]+\)$/))return null;var i=e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return i?{match_:i[0],remainder:e.substr(i[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(e,i,r,a,o,n,l,s,c,d){var u=function(e,i){if("string"==typeof i)return 0!==e.indexOf(i)?null:i;var r=e.match(i);return r?r[0]:null},h=u(e,i);if(null===h||null===(h=u(e=e.substr(h.length),r)))return null;var p=function(e,i,r){for(var a=0;i<e.length;){var o=e.charAt(i),n=u(e.substr(i),r);if(null!==n&&0===a)return{endMatchBegin:i,endMatchEnd:i+n.length};if("{"===o)a++;else if("}"===o){if(0===a)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];a--}i++}return null}(e,h.length,a||o);if(null===p)return null;var m=e.substring(0,a?p.endMatchEnd:p.endMatchBegin);if(!n&&!l)return{match_:m,remainder:e.substr(p.endMatchEnd)};var f=this.findObserveGroups(e.substr(p.endMatchEnd),n,l,s,c);if(null===f)return null;var g=[m,f.match_];return{match_:d?g.join(""):g,remainder:f.remainder}},match_:function(e,i){var r=ld.patterns.patterns[e];if(void 0===r)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if("function"==typeof r)return ld.patterns.patterns[e](i);var a=i.match(r);return a?{match_:a[2]?[a[1],a[2]]:a[1]?a[1]:a[0],remainder:i.substr(a[0].length)}:null}},actions:{"a=":function(e,i){e.a=(e.a||"")+i},"b=":function(e,i){e.b=(e.b||"")+i},"p=":function(e,i){e.p=(e.p||"")+i},"o=":function(e,i){e.o=(e.o||"")+i},"q=":function(e,i){e.q=(e.q||"")+i},"d=":function(e,i){e.d=(e.d||"")+i},"rm=":function(e,i){e.rm=(e.rm||"")+i},"text=":function(e,i){e.text_=(e.text_||"")+i},insert:function(e,i,r){return{type_:r}},"insert+p1":function(e,i,r){return{type_:r,p1:i}},"insert+p1+p2":function(e,i,r){return{type_:r,p1:i[0],p2:i[1]}},copy:function(e,i){return i},rm:function(e,i){return{type_:"rm",p1:i||""}},text:function(e,i){return ld.go(i,"text")},"{text}":function(e,i){var r=["{"];return ld.concatArray(r,ld.go(i,"text")),r.push("}"),r},"tex-math":function(e,i){return ld.go(i,"tex-math")},"tex-math tight":function(e,i){return ld.go(i,"tex-math tight")},bond:function(e,i,r){return{type_:"bond",kind_:r||i}},"color0-output":function(e,i){return{type_:"color0",color:i[0]}},ce:function(e,i){return ld.go(i)},"1/2":function(e,i){var r=[];i.match(/^[+\-]/)&&(r.push(i.substr(0,1)),i=i.substr(1));var a=i.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return a[1]=a[1].replace(/\$/g,""),r.push({type_:"frac",p1:a[1],p2:a[2]}),a[3]&&(a[3]=a[3].replace(/\$/g,""),r.push({type_:"tex-math",p1:a[3]})),r},"9,9":function(e,i){return ld.go(i,"9,9")}},createTransitions:function(e){var i,r,a,o,n={};for(i in e)for(r in e[i])for(a=r.split("|"),e[i][r].stateArray=a,o=0;o<a.length;o++)n[a[o]]=[];for(i in e)for(r in e[i])for(a=e[i][r].stateArray||[],o=0;o<a.length;o++){var l=e[i][r];if(l.action_){l.action_=[].concat(l.action_);for(var s=0;s<l.action_.length;s++)"string"==typeof l.action_[s]&&(l.action_[s]={type_:l.action_[s]})}else l.action_=[];for(var c=i.split("|"),d=0;d<c.length;d++)if("*"===a[o])for(var u in n)n[u].push({pattern:c[d],task:l});else n[a[o]].push({pattern:c[d],task:l})}return n},stateMachines:{}};ld.stateMachines={ce:{transitions:ld.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(e,i){var r;if((e.d||"").match(/^[0-9]+$/)){var a=e.d;e.d=void 0,r=this.output(e),e.b=a}else r=this.output(e);return ld.actions["o="](e,i),r},"d= kv":function(e,i){e.d=i,e.dType="kv"},"charge or bond":function(e,i){if(e.beginsWithBond){var r=[];return ld.concatArray(r,this.output(e)),ld.concatArray(r,ld.actions.bond(e,i,"-")),r}e.d=i},"- after o/d":function(e,i,r){var a=ld.patterns.match_("orbital",e.o||""),o=ld.patterns.match_("one lowercase greek letter $",e.o||""),n=ld.patterns.match_("one lowercase latin letter $",e.o||""),l=ld.patterns.match_("$one lowercase latin letter$ $",e.o||""),s="-"===i&&(a&&""===a.remainder||o||n||l);!s||e.a||e.b||e.p||e.d||e.q||a||!n||(e.o="$"+e.o+"$");var c=[];return s?(ld.concatArray(c,this.output(e)),c.push({type_:"hyphen"})):(a=ld.patterns.match_("digits",e.d||""),r&&a&&""===a.remainder?(ld.concatArray(c,ld.actions["d="](e,i)),ld.concatArray(c,this.output(e))):(ld.concatArray(c,this.output(e)),ld.concatArray(c,ld.actions.bond(e,i,"-")))),c},"a to o":function(e){e.o=e.a,e.a=void 0},"sb=true":function(e){e.sb=!0},"sb=false":function(e){e.sb=!1},"beginsWithBond=true":function(e){e.beginsWithBond=!0},"beginsWithBond=false":function(e){e.beginsWithBond=!1},"parenthesisLevel++":function(e){e.parenthesisLevel++},"parenthesisLevel--":function(e){e.parenthesisLevel--},"state of aggregation":function(e,i){return{type_:"state of aggregation",p1:ld.go(i,"o")}},comma:function(e,i){var r=i.replace(/\s*$/,"");return r!==i&&0===e.parenthesisLevel?{type_:"comma enumeration L",p1:r}:{type_:"comma enumeration M",p1:r}},output:function(e,i,r){var a,o,n;for(var l in e.r?(o="M"===e.rdt?ld.go(e.rd,"tex-math"):"T"===e.rdt?[{type_:"text",p1:e.rd||""}]:ld.go(e.rd),n="M"===e.rqt?ld.go(e.rq,"tex-math"):"T"===e.rqt?[{type_:"text",p1:e.rq||""}]:ld.go(e.rq),a={type_:"arrow",r:e.r,rd:o,rq:n}):(a=[],(e.a||e.b||e.p||e.o||e.q||e.d||r)&&(e.sb&&a.push({type_:"entitySkip"}),e.o||e.q||e.d||e.b||e.p||2===r?e.o||e.q||e.d||!e.b&&!e.p?e.o&&"kv"===e.dType&&ld.patterns.match_("d-oxidation$",e.d||"")?e.dType="oxidation":e.o&&"kv"===e.dType&&!e.q&&(e.dType=void 0):(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):(e.o=e.a,e.a=void 0),a.push({type_:"chemfive",a:ld.go(e.a,"a"),b:ld.go(e.b,"bd"),p:ld.go(e.p,"pq"),o:ld.go(e.o,"o"),q:ld.go(e.q,"pq"),d:ld.go(e.d,"oxidation"===e.dType?"oxidation":"bd"),dType:e.dType}))),e)"parenthesisLevel"!==l&&"beginsWithBond"!==l&&delete e[l];return a},"oxidation-output":function(e,i){var r=["{"];return ld.concatArray(r,ld.go(i,"oxidation")),r.push("}"),r},"frac-output":function(e,i){return{type_:"frac-ce",p1:ld.go(i[0]),p2:ld.go(i[1])}},"overset-output":function(e,i){return{type_:"overset",p1:ld.go(i[0]),p2:ld.go(i[1])}},"underset-output":function(e,i){return{type_:"underset",p1:ld.go(i[0]),p2:ld.go(i[1])}},"underbrace-output":function(e,i){return{type_:"underbrace",p1:ld.go(i[0]),p2:ld.go(i[1])}},"color-output":function(e,i){return{type_:"color",color1:i[0],color2:ld.go(i[1])}},"r=":function(e,i){e.r=i},"rdt=":function(e,i){e.rdt=i},"rd=":function(e,i){e.rd=i},"rqt=":function(e,i){e.rqt=i},"rq=":function(e,i){e.rq=i},operator:function(e,i,r){return{type_:"operator",kind_:r||i}}}},a:{transitions:ld.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:ld.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:ld.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(e){if(e.text_){var i={type_:"text",p1:e.text_};for(var r in e)delete e[r];return i}}}},pq:{transitions:ld.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(e,i){return{type_:"state of aggregation subscript",p1:ld.go(i,"o")}},"color-output":function(e,i){return{type_:"color",color1:i[0],color2:ld.go(i[1],"pq")}}}},bd:{transitions:ld.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(e,i){return{type_:"color",color1:i[0],color2:ld.go(i[1],"bd")}}}},oxidation:{transitions:ld.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(e,i){return{type_:"roman numeral",p1:i||""}}}},"tex-math":{transitions:ld.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(e){if(e.o){var i={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return i}}}},"tex-math tight":{transitions:ld.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(e,i){e.o=(e.o||"")+"{"+i+"}"},output:function(e){if(e.o){var i={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return i}}}},"9,9":{transitions:ld.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:ld.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(e,i){var r=[];return"+-"===i[0]||"+/-"===i[0]?r.push("\\pm "):i[0]&&r.push(i[0]),i[1]&&(ld.concatArray(r,ld.go(i[1],"pu-9,9")),i[2]&&(i[2].match(/[,.]/)?ld.concatArray(r,ld.go(i[2],"pu-9,9")):r.push(i[2])),(i[3]||i[4])&&("e"===i[3]||"*"===i[4]?r.push({type_:"cdot"}):r.push({type_:"times"}))),i[5]&&r.push("10^{"+i[5]+"}"),r},"number^":function(e,i){var r=[];return"+-"===i[0]||"+/-"===i[0]?r.push("\\pm "):i[0]&&r.push(i[0]),ld.concatArray(r,ld.go(i[1],"pu-9,9")),r.push("^{"+i[2]+"}"),r},operator:function(e,i,r){return{type_:"operator",kind_:r||i}},space:function(){return{type_:"pu-space-1"}},output:function(e){var i,r=ld.patterns.match_("{(...)}",e.d||"");r&&""===r.remainder&&(e.d=r.match_);var a=ld.patterns.match_("{(...)}",e.q||"");if(a&&""===a.remainder&&(e.q=a.match_),e.d&&(e.d=e.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.d=e.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),e.q){e.q=e.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.q=e.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var o={d:ld.go(e.d,"pu"),q:ld.go(e.q,"pu")};"//"===e.o?i={type_:"pu-frac",p1:o.d,p2:o.q}:(i=o.d,o.d.length>1||o.q.length>1?i.push({type_:" / "}):i.push({type_:"/"}),ld.concatArray(i,o.q))}else i=ld.go(e.d,"pu-2");for(var n in e)delete e[n];return i}}},"pu-2":{transitions:ld.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(e,i){e.rm+="^{"+i+"}"},space:function(){return{type_:"pu-space-2"}},output:function(e){var i=[];if(e.rm){var r=ld.patterns.match_("{(...)}",e.rm||"");i=r&&""===r.remainder?ld.go(r.match_,"pu"):{type_:"rm",p1:e.rm}}for(var a in e)delete e[a];return i}}},"pu-9,9":{transitions:ld.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(e){var i=[];if(e.text_=e.text_||"",e.text_.length>4){var r=e.text_.length%3;0===r&&(r=3);for(var a=e.text_.length-3;a>0;a-=3)i.push(e.text_.substr(a,3)),i.push({type_:"1000 separator"});i.push(e.text_.substr(0,r)),i.reverse()}else i.push(e.text_);for(var o in e)delete e[o];return i},"output-o":function(e){var i=[];if(e.text_=e.text_||"",e.text_.length>4){for(var r=e.text_.length-3,a=0;a<r;a+=3)i.push(e.text_.substr(a,3)),i.push({type_:"1000 separator"});i.push(e.text_.substr(a))}else i.push(e.text_);for(var o in e)delete e[o];return i}}}};var lu={go:function(e,i){if(!e)return"";for(var r="",a=!1,o=0;o<e.length;o++){var n=e[o];"string"==typeof n?r+=n:(r+=lu._go2(n),"1st-level escape"===n.type_&&(a=!0))}return i||a||!r||(r="{"+r+"}"),r},_goInner:function(e){return e&&lu.go(e,!0)},_go2:function(e){var i;switch(e.type_){case"chemfive":i="";var r={a:lu._goInner(e.a),b:lu._goInner(e.b),p:lu._goInner(e.p),o:lu._goInner(e.o),q:lu._goInner(e.q),d:lu._goInner(e.d)};r.a&&(r.a.match(/^[+\-]/)&&(r.a="{"+r.a+"}"),i+=r.a+"\\,"),(r.b||r.p)&&(i+="{\\vphantom{X}}",i+="^{\\hphantom{"+(r.b||"")+"}}_{\\hphantom{"+(r.p||"")+"}}",i+="{\\vphantom{X}}",i+="^{\\smash[t]{\\vphantom{2}}\\llap{"+(r.b||"")+"}}",i+="_{\\vphantom{2}\\llap{\\smash[t]{"+(r.p||"")+"}}}"),r.o&&(r.o.match(/^[+\-]/)&&(r.o="{"+r.o+"}"),i+=r.o),"kv"===e.dType?((r.d||r.q)&&(i+="{\\vphantom{X}}"),r.d&&(i+="^{"+r.d+"}"),r.q&&(i+="_{\\smash[t]{"+r.q+"}}")):"oxidation"===e.dType?(r.d&&(i+="{\\vphantom{X}}",i+="^{"+r.d+"}"),r.q&&(i+="{\\vphantom{X}}",i+="_{\\smash[t]{"+r.q+"}}")):(r.q&&(i+="{\\vphantom{X}}",i+="_{\\smash[t]{"+r.q+"}}"),r.d&&(i+="{\\vphantom{X}}",i+="^{"+r.d+"}"));break;case"rm":case"roman numeral":i="\\mathrm{"+e.p1+"}";break;case"text":e.p1.match(/[\^_]/)?(e.p1=e.p1.replace(" ","~").replace("-","\\text{-}"),i="\\mathrm{"+e.p1+"}"):i="\\text{"+e.p1+"}";break;case"state of aggregation":i="\\mskip2mu "+lu._goInner(e.p1);break;case"state of aggregation subscript":i="\\mskip1mu "+lu._goInner(e.p1);break;case"bond":if(!(i=lu._getBond(e.kind_)))throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+e.kind_+")"];break;case"frac":var a="\\frac{"+e.p1+"}{"+e.p2+"}";i="\\mathchoice{\\textstyle"+a+"}{"+a+"}{"+a+"}{"+a+"}";break;case"pu-frac":var o="\\frac{"+lu._goInner(e.p1)+"}{"+lu._goInner(e.p2)+"}";i="\\mathchoice{\\textstyle"+o+"}{"+o+"}{"+o+"}{"+o+"}";break;case"tex-math":case"1st-level escape":i=e.p1+" ";break;case"frac-ce":i="\\frac{"+lu._goInner(e.p1)+"}{"+lu._goInner(e.p2)+"}";break;case"overset":i="\\overset{"+lu._goInner(e.p1)+"}{"+lu._goInner(e.p2)+"}";break;case"underset":i="\\underset{"+lu._goInner(e.p1)+"}{"+lu._goInner(e.p2)+"}";break;case"underbrace":i="\\underbrace{"+lu._goInner(e.p1)+"}_{"+lu._goInner(e.p2)+"}";break;case"color":i="{\\color{"+e.color1+"}{"+lu._goInner(e.color2)+"}}";break;case"color0":i="\\color{"+e.color+"}";break;case"arrow":var n={rd:lu._goInner(e.rd),rq:lu._goInner(e.rq)},l=lu._getArrow(e.r);n.rd||n.rq?"<=>"===e.r||"<=>>"===e.r||"<<=>"===e.r||"<--\x3e"===e.r?(l="\\long"+l,n.rd&&(l="\\overset{"+n.rd+"}{"+l+"}"),n.rq&&(l="<--\x3e"===e.r?"\\underset{\\lower2mu{"+n.rq+"}}{"+l+"}":"\\underset{\\lower6mu{"+n.rq+"}}{"+l+"}"),l=" {}\\mathrel{"+l+"}{} "):(n.rq&&(l+="[{"+n.rq+"}]"),l+="{"+n.rd+"}",l=" {}\\mathrel{\\x"+l+"}{} "):l=" {}\\mathrel{\\long"+l+"}{} ",i=l;break;case"operator":i=lu._getOperator(e.kind_);break;case"space":i=" ";break;case"entitySkip":case"pu-space-1":i="~";break;case"pu-space-2":i="\\mkern3mu ";break;case"1000 separator":i="\\mkern2mu ";break;case"commaDecimal":i="{,}";break;case"comma enumeration L":i="{"+e.p1+"}\\mkern6mu ";break;case"comma enumeration M":i="{"+e.p1+"}\\mkern3mu ";break;case"comma enumeration S":i="{"+e.p1+"}\\mkern1mu ";break;case"hyphen":i="\\text{-}";break;case"addition compound":i="\\,{\\cdot}\\,";break;case"electron dot":i="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":i="{\\times}";break;case"prime":i="\\prime ";break;case"cdot":i="\\cdot ";break;case"tight cdot":i="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":i="\\times ";break;case"circa":i="{\\sim}";break;case"^":i="uparrow";break;case"v":i="downarrow";break;case"ellipsis":i="\\ldots ";break;case"/":i="/";break;case" / ":i="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return i},_getArrow:function(e){switch(e){case"->":case"→":case"⟶":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<--\x3e":return"leftrightarrows";case"<=>":case"⇌":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(e){switch(e){case"-":case"1":return"{-}";case"=":case"2":return"{=}";case"#":case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":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(e){switch(e){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":case"$\\approx$":return" {}\\approx{} ";case"v":case"(v)":return" \\downarrow{} ";case"^":case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}},lh=class e extends oG{constructor(e){super(g(f({},e),{type:"delim"})),this.value=e.delim,this.size=e.size}static fromJson(i){return new e(i)}toJson(){return g(f({},super.toJson()),{delim:this.value,size:this.size})}render(e){return new oE(this.value,{type:"middle"})}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);return null!=i&&i.serialize?i.serialize(this,e):og(this.command,this.value)}},lp=class e extends oG{constructor(e){super(g(f({},e),{type:"sizeddelim",value:e.delim})),this.delimType=e.delimType,this.size=e.size}static fromJson(i){return new e(i)}toJson(){return g(f({},super.toJson()),{delim:this.value,size:this.size,delimType:this.delimType})}render(e){var i,r,a;let o=(i=this.value,r=this.size,a={classes:({open:"ML__open",close:"ML__close"})[this.delimType],type:this.delimType,isSelected:this.isSelected},void 0===i||"."===i?nW(e,a.classes):("<"===i||"\\lt"===i||"⟨"===i?i="\\langle":(">"===i||"\\gt"===i||"⟩"===i)&&(i="\\rangle"),nO.has(i)||nI.has(i)?n$(i,r,!1,e,a):nR.has(i)?nP(i,nN[r],!1,e,a):null));return o?(o=this.bind(e,o),this.caret&&(o.caret=this.caret),o):null}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);return null!=i&&i.serialize?i.serialize(this,e):og(this.command,this.value)}};function lm(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var lf=class e extends oG{constructor(e,i,r,a){var o,n;super({type:"enclose",command:e,style:a.style}),this.body=i,this.backgroundcolor=a.backgroundcolor,r.updiagonalarrow&&(r.updiagonalstrike=!1),r.box&&(r.left=!1,r.right=!1,r.bottom=!1,r.top=!1),this.notation=r,this.shadow=null!=(o=a.shadow)?o:"none",this.strokeWidth=null!=(n=a.strokeWidth)?n:"0.06em",this.strokeWidth||(this.strokeWidth="0.06em"),this.strokeStyle=a.strokeStyle,this.svgStrokeStyle=a.svgStrokeStyle,this.strokeColor=a.strokeColor,this.borderStyle=a.borderStyle,this.padding=a.padding,this.captureSelection=!1}static fromJson(i){return new e(i.command,i.body,i.notation,i)}toJson(){return g(f({},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 i;if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let r=eM(this.command,this.mode);if(null!=r&&r.serialize)return r.serialize(this,e);let a=null!=(i=this.command)?i:"";if("\\enclose"===this.command){a+="{"+Object.keys(this.notation).join(" ")+"}";let e="",i="";this.backgroundcolor&&"transparent"!==this.backgroundcolor&&(e+=i+'mathbackground="'+this.backgroundcolor+'"',i=","),this.shadow&&"auto"!==this.shadow&&(e+=i+'shadow="'+this.shadow+'"',i=","),this.strokeWidth||"solid"!==this.strokeStyle?(e+=i+this.borderStyle,i=","):this.strokeColor&&"currentColor"!==this.strokeColor&&(e+=i+'mathcolor="'+this.strokeColor+'"',i=","),e&&(a+=`[${e}]`)}return og(a,this.bodyToLatex(e))}render(e){var i,r,a,o,n,l;let s=new oW({parent:e},this.style),c=oG.createBox(s,this.body);if(!c)return null;let d=function(e){if(!e)return"1px";let i=e.match(/([0-9][a-zA-Z\%]+)/);return null===i?"1px":i[1]}(this.borderStyle),u=s.toEm(this.padding&&"auto"!==this.padding?{string:this.padding}:{register:"fboxsep"});c.setStyle("position","relative"),c.setStyle("display","inline-block"),c.setStyle("height",c.height+c.depth,"em"),c.setStyle("width",c.width,"em");let h=new oE(null,{classes:"ML__notation"}),p=c.height+c.depth+2*u,m=c.width+2*u,f="",g=Math.min(.2*u,.05);if(this.notation.horizontalstrike){let e=2*u+c.height-.2155;f+=this.line((u+g).toString(),e.toString(),(u+c.width-g).toString(),e.toString())}if(this.notation.verticalstrike){let e=u+c.width/2;f+=this.line(e.toString(),(u+g).toString(),e.toString(),(p-u-g).toString())}if(this.notation.updiagonalstrike&&(f+=this.line((u+g).toString(),(p-u-g).toString(),(u+c.width-g).toString(),(u+g).toString())),this.notation.downdiagonalstrike&&(f+=this.line((u+g).toString(),(u+g).toString(),(u+c.width-g).toString(),(p-u-g).toString())),this.notation.updiagonalarrow){f+=this.line(u.toString(),(2*u+c.depth+c.height).toString(),(u+c.width).toString(),u.toString());let e=.03*Math.sqrt(m*m+p*p)*1,r=c.width*e,a=(c.depth+c.height)*e,o=u+c.width,n=u;n+a-.4*r<0&&(n=.4*r-a),f+='<polygon points="',f+=`${o},${n} ${o-r-.4*a},${n+a-.4*r} `,f+=`${o-.7*r},${n+.7*a} ${o-r+.4*a},${n+a+.4*r} `,f+=`${o},${n}`,f+=`" stroke='none' fill="${lm(null!=(i=this.strokeColor)?i:"")}"`,f+="/>"}let b=0;if(this.notation.phasorangle){let e=lb(s),i=(c.height+c.depth+2*e+2*u).toString(),r=(c.height+c.depth)/2;f+=this.line(u.toString(),i,(u+r+c.width).toString(),i),f+=this.line(u.toString(),i,(u+r).toString(),(u-e).toString()),p+=e,b=r,c.left+=p/2-u}if(this.notation.longdiv){let e=lb(s);p+=e,f+=this.line(u.toString(),u.toString(),(u+c.width).toString(),u.toString()),b=.3+e,c.left+=.3+e,c.setTop(u+e),f+='<path d="',f+=`M ${u} ${u} a0.3 ${(c.depth+c.height+2*e)/2}, 0, 1, 1, 0 ${c.depth+c.height+2*e} "`,f+=` stroke-width="${(Math.floor(100*(l=s).metrics.sqrtRuleThickness/l.scalingFactor)/100/10).toString()+"em"}" stroke="${lm(null!=(r=this.strokeColor)?r:"")}" fill="none"`,f+="/>"}if(h.width=c.width+2*u+b,h.height=c.height+2*u,h.depth=c.depth,h.setStyle("box-sizing","border-box"),h.setStyle("left",`calc(-1 * ${d} - ${u}em)`),h.setStyle("height",`calc( ${c.height+c.depth+2*u}em + ${d})`),h.setStyle("top","0em"),h.setStyle("width",`calc(${c.width+2*u}em + ${d})`),this.backgroundcolor&&h.setStyle("background-color",this.backgroundcolor),this.notation.box&&h.setStyle("border","1px solid red"),this.notation.actuarial&&(h.setStyle("border-top",this.borderStyle),h.setStyle("border-right",this.borderStyle)),this.notation.madruwb&&(h.setStyle("border-bottom",this.borderStyle),h.setStyle("border-right",this.borderStyle)),this.notation.roundedbox&&(h.setStyle("border-radius","8px"),h.setStyle("border",this.borderStyle)),this.notation.circle&&(h.setStyle("border-radius","50%"),h.setStyle("border",this.borderStyle)),this.notation.top&&h.setStyle("border-top",this.borderStyle),this.notation.left&&h.setStyle("border-left",this.borderStyle),this.notation.right&&h.setStyle("border-right",this.borderStyle),this.notation.bottom&&h.setStyle("border-bottom",this.borderStyle),f){let e="";"auto"===this.shadow&&(e+="filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .7)) drop-shadow(1px 1px 2px #333)"),"none"!==this.shadow&&(e+=`filter: drop-shadow(${lm(null!=(a=this.shadow)?a:"")})`),e+=` stroke-width="${lm(null!=(o=this.strokeWidth)?o:"")}" stroke="${lm(null!=(n=this.strokeColor)?n:"")}" stroke-linecap="round"`,this.svgStrokeStyle&&(e+=` stroke-dasharray="${lm(this.svgStrokeStyle)}"`),h.svgStyle=e,h.svgOverlay=f}let y=new oE([h,c]);return y.setStyle("position","relative"),y.setStyle("height",`${Math.floor(100*(h.depth+h.height))/100}em`),y.setStyle("display","inline-block"),y.height=h.height,y.depth=h.depth,y.width=h.width-2*u,y.left=u,y.right=u,this.caret&&(y.caret=this.caret),y.wrap(s)}line(e,i,r,a){return`<line x1="${lg(e)}" y1="${lg(i)}" x2="${lg(r)}" y2="${lg(a)}" vector-effect="non-scaling-stroke"></line>`}};function lg(e){return"number"==typeof e?`${Math.floor(100*e)/100}%`:e}function lb(e){let i=e.isDisplayStyle?.431:e.metrics.defaultRuleThickness;return e.metrics.defaultRuleThickness+e.scalingFactor*i/4}var ly=class e extends oG{constructor(e,i,r){var a,o,n;super(g(f({},r),{type:"genfrac",displayContainsHighlight:!0})),this.above=e,this.below=i,this.hasBarLine=null==(a=null==r?void 0:r.hasBarLine)||a,this.continuousFraction=null!=(o=null==r?void 0:r.continuousFraction)&&o,this.align=null!=(n=null==r?void 0:r.align)?n:"center",this.numerPrefix=null==r?void 0:r.numerPrefix,this.denomPrefix=null==r?void 0:r.denomPrefix,this.mathstyleName=null==r?void 0:r.mathstyleName,this.leftDelim=null==r?void 0:r.leftDelim,this.rightDelim=null==r?void 0:r.rightDelim}static fromJson(i){return new e(i.above,i.below,i)}toJson(){let e={};return this.continuousFraction&&(e.continuousFraction=!0),"center"!==this.align&&(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),f(f({},super.toJson()),e)}get children(){if(this._children)return this._children;let e=[];if("denominator-numerator"===o$.fractionNavigationOrder){for(let i of this.below)e.push(...i.children),e.push(i);for(let i of this.above)e.push(...i.children),e.push(i)}else{for(let i of this.above)e.push(...i.children),e.push(i);for(let i of this.below)e.push(...i.children),e.push(i)}return this._children=e,e}render(e){var i,r;let a=new oW({parent:e,mathstyle:this.mathstyleName},this.style),o=a.metrics,n=new oW({parent:a,mathstyle:this.continuousFraction?"":"numerator"},this.style),l=this.numerPrefix?new oE([new oE(this.numerPrefix),oG.createBox(n,this.above)],{isTight:n.isTight,type:"ignore"}):null!=(i=oG.createBox(n,this.above,{type:"ignore"}))?i:new oE(null,{type:"ignore"}),s=new oW({parent:a,mathstyle:this.continuousFraction?"":"denominator"},this.style),c=this.denomPrefix?new oE([new oE(this.denomPrefix),oG.createBox(s,this.below,{type:"ignore"})]):null!=(r=oG.createBox(s,this.below,{type:"ignore"}))?r:new oE(null,{type:"ignore"}),d=this.hasBarLine?o.defaultRuleThickness:0,u,h=0,p;a.isDisplayStyle?(u=n.metrics.num1,h=d>0?3*d:7*d,p=s.metrics.denom1):(d>0?(u=n.metrics.num2,h=d):(u=n.metrics.num3,h=3*o.defaultRuleThickness),p=s.metrics.denom2);let m=[];this.isSelected&&m.push("ML__selected");let f=l.depth,g=c.height,b;if(d<=0){let e=u-f-(g-p);e<h&&(u+=(h-e)/2,p+=(h-e)/2),b=new oB({individualShift:[{box:l,shift:-u,classes:[...m,lv(this.align)]},{box:c,shift:p,classes:[...m,lv(this.align)]}]}).wrap(a)}else{let e=new oE(null,{classes:"ML__frac-line",mode:this.mode,style:this.style});e.softWidth=Math.max(l.width,c.width),e.height=d/2,e.depth=d/2;let i=.25+d/2;u<h+f+i&&(u=h+f+i);let r=.25-d/2;p<h+g-r&&(p=h+g-r),b=new oB({individualShift:[{box:c,shift:p,classes:[...m,lv(this.align)]},{box:e,shift:-r,classes:m},{box:l,shift:-u,classes:[...m,lv(this.align)]}]}).wrap(a)}let y=a.isDisplayStyle?o.delim1:o.delim2,v=this.leftDelim?this.bind(e,nj("open",this.leftDelim,y,!0,e,{style:this.style,mode:this.mode,isSelected:this.isSelected})):nW(a,"ML__open"),x=null;x=this.continuousFraction?new oE(null,{type:"close"}):this.rightDelim?this.bind(e,nj("close",this.rightDelim,y,!0,e,{style:this.style,mode:this.mode,isSelected:this.isSelected})):nW(a,"ML__close");let _=new oE([v,b,x],{isTight:a.isTight,type:"inner",classes:"ML__mfrac"}),w=this.bind(e,_);return this.caret&&(w.caret=this.caret),this.attachSupsub(e,{base:w})}};function lv(e){var i;return null!=(i=({left:"ML__left",right:"ML__right",center:"ML__center"})[e])?i:"ML__center"}var lx=class e extends oG{constructor(e,i){var r;super({type:"latex",value:e,mode:"latex"}),this.isSuggestion=null!=(r=null==i?void 0:i.isSuggestion)&&r,this.isError=!1}static fromJson(i){let r=new e(i.value);return i.isSuggestion&&(r.isSuggestion=!0),i.isError&&(r.isError=!0),r}toJson(){let e={};return this.isSuggestion&&(e.isSuggestion=!0),this.isError&&(e.isError=!0),f({type:"latex",value:this.value},e)}render(e){let i=new oE(this.value,{classes:this.isSuggestion?"ML__suggestion":this.isError?"ML__error":"",type:"latex",maxFontSize:1});return i?(this.caret&&(i.caret=this.caret),this.bind(e,i)):null}},l_=class e extends oG{constructor(e=""){super({type:"latexgroup",mode:"latex"}),this.body=[...e].map(e=>new lx(e)),this.skipBoundary=!0}static fromJson(i){return new e}toJson(){return super.toJson()}render(e){let i=oG.createBox(e,this.body);return i?(this.caret&&(i.caret=this.caret),this.bind(e,i)):null}_serialize(e){var i,r;return null!=(r=null==(i=this.body)?void 0:i.map(e=>e.value).join(""))?r:""}},lw=class e extends oG{constructor(e,i){super(g(f({},i),{type:"extensible-symbol",isFunction:null==i?void 0:i.isFunction})),this.value=e,this.variant=null==i?void 0:i.variant,this.subsupPlacement=null==i?void 0:i.limits}static fromJson(i){return new e(i.symbol,i)}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 i;let r=e.isDisplayStyle&&"\\smallint"!==this.value,a=new oE(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(!a)return null;a.right=a.italic;let o=(a.height-a.depth)/2-.25*e.scalingFactor,n=a.italic;a.setTop(o);let l=a;if(this.superscript||this.subscript){let r=null!=(i=this.subsupPlacement)?i:"auto";"auto"===r&&e.isDisplayStyle&&(r="over-under"),l="over-under"===r?this.attachLimits(e,{base:a,baseShift:o,slant:n}):this.attachSupsub(e,{base:a})}return new oE(this.bind(e,l),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"ML__op-group"}).wrap(e)}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);if(null!=i&&i.serialize)return i.serialize(this,e);let r=[];return r.push(this.command),this.explicitSubsupPlacement&&("over-under"===this.subsupPlacement&&r.push("\\limits"),"adjacent"===this.subsupPlacement&&r.push("\\nolimits"),"auto"===this.subsupPlacement&&r.push("\\displaylimits")),r.push(this.supsubToLatex(e)),of(r)}},lk=class e extends oG{constructor(e){let i=e.body;super(g(f({},e),{type:"overlap",body:"string"==typeof i?[new oG({value:i})]:i,style:null==e?void 0:e.style})),this.skipBoundary=!0,this.align=null==e?void 0:e.align,this.boxType=null==e?void 0:e.boxType}static fromJson(i){return new e(i)}toJson(){let e={};return this.align&&(e.align=this.align),this.boxType&&(e.boxType=this.boxType),f(f({},super.toJson()),e)}render(e){let i=oG.createBox(e,this.body,{classes:"ML__inner"});if(!i)return null;this.caret&&(i.caret=this.caret);let r="right"===this.align?"ML__rlap":"center"===this.align?"ML__clap":"ML__llap";return this.bind(e,new oE([i,new oE(null,{classes:"ML__fix"})],{classes:r,type:this.boxType}))}},lM=class e extends oG{constructor(e){var i,r,a,o;super({type:"overunder",command:e.command,style:e.style,mode:e.mode,body:e.body,skipBoundary:null==(i=e.skipBoundary)||i}),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=null!=(r=e.boxType)?r:"ord",this.paddedBody=null!=(a=e.paddedBody)&&a,this.paddedLabels=null!=(o=e.paddedLabels)&&o}static fromJson(i){return new e(i)}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),"ord"!==this.boxType&&(e.boxType=this.boxType),this.paddedBody&&(e.paddedBody=!0),this.paddedLabels&&(e.paddedLabels=!0),e}render(e){let i=this.svgBody?oT(this.svgBody):oG.createBox(e,this.body,{type:"ignore"}),r=new oW({parent:e,mathstyle:"scriptstyle"},this.style),a=null;this.svgAbove?a=oT(this.svgAbove):this.above&&(a=oG.createBox(r,this.above,{type:"ignore"}));let o=null;this.svgBelow?o=oT(this.svgBelow):this.below&&(o=oG.createBox(r,this.below,{type:"ignore"})),this.paddedBody&&(i=new oE([nW(e,"ML__open"),i,nW(e,"ML__close")],{type:"ignore"}));let n=function(e,i){if(!i.base)return null;if(!i.above&&!i.below){let e=new oE(i.base,{type:i.type});return e.setStyle("position","relative"),e}let r=0;i.above&&(r=e.metrics.bigOpSpacing5);let a=null,o=i.base,n=["ML__center"];return(i.paddedAboveBelow&&n.push("ML__label_padding"),i.below&&i.above)?a=new oB({bottom:e.metrics.bigOpSpacing5+i.below.height+i.below.depth+o.depth+0,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:n},{box:o,classes:["ML__center"]},r,{box:i.above,classes:n},e.metrics.bigOpSpacing5]}):i.below?a=new oB({top:o.height-0,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:n},{box:o,classes:["ML__center"]}]}):i.above&&(a=new oB({bottom:o.depth+0,children:[{box:o,classes:["ML__center"]},r,{box:i.above,classes:n},e.metrics.bigOpSpacing5]})),new oE(a,{type:i.type})}(e,{base:i,above:a,below:o,type:"bin"===this.boxType||"rel"===this.boxType?this.boxType:"ord",paddedAboveBelow:this.paddedLabels});return n?(n="over-under"===this.subsupPlacement?this.attachLimits(e,{base:n,type:n.type}):this.attachSupsub(e,{base:n}),this.caret&&(n.caret=this.caret),this.bind(e,n)):null}},lS=class e extends oG{constructor(e){var i,r,a,o;super(g(f({},e),{type:"phantom"})),this.captureSelection=!0,this.isInvisible=null!=(i=e.isInvisible)&&i,this.smashDepth=null!=(r=e.smashDepth)&&r,this.smashHeight=null!=(a=e.smashHeight)&&a,this.smashWidth=null!=(o=e.smashWidth)&&o}static fromJson(i){return new e(i)}toJson(){let e={};return this.isInvisible&&(e.isInvisible=!0),this.smashDepth&&(e.smashDepth=!0),this.smashHeight&&(e.smashHeight=!0),this.smashWidth&&(e.smashWidth=!0),f(f({},super.toJson()),e)}render(e){let i=new oW({parent:e,isPhantom:!0});if(!this.smashDepth&&!this.smashHeight&&!this.smashWidth)return this.isInvisible,oG.createBox(i,this.body,{classes:"ML__inner"});let r=oG.createBox(this.isInvisible?i:e,this.body);if(!r)return null;if(this.smashWidth){let i=new oE(null,{classes:"ML__fix"});return new oE([r,i],{classes:"ML__rlap"}).wrap(e)}if(!this.smashHeight&&!this.smashDepth)return r;if(this.smashHeight&&(r.height=0),this.smashDepth&&(r.depth=0),r.children)for(let e of r.children)this.smashHeight&&(e.height=0),this.smashDepth&&(e.depth=0);return new oB({firstBaseline:[{box:r}]},{type:r.type}).wrap(e)}},lL=class e extends oG{constructor(e){var i;super(f({type:"spacing"},e)),this.width=null==e?void 0:e.width,this._braced=null!=(i=null==e?void 0:e.braced)&&i}static fromJson(i){return new e(i)}toJson(){let e=super.toJson();return void 0!==this.width&&(e.width=this.width),this._braced&&(e.braced=!0),e}render(e){var i;let r;return"space"===this.command?new oE("math"===this.mode?null:" "):(void 0!==this.width?(r=new oE(null,{classes:"ML__mspace"})).left=e.toEm(this.width):r=new oE(null,{classes:null!=(i=({"\\qquad":"ML__qquad","\\quad":"ML__quad","\\enspace":"ML__enspace","\\enskip":"ML__enspace","\\;":"ML__thickspace","\\thickspace":"ML__thickspace","\\:":"ML__mediumspace","\\>":"ML__mediumspace","\\medspace":"ML__mediumspace","\\,":"ML__thinspace","\\thinspace":"ML__thinspace","\\!":"ML__negativethinspace","\\negthinspace":"ML__negativethinspace","\\negmedspace":"ML__negativemediumspace","\\negthickspace":"ML__negativethickspace"})[this.command])?i:"ML__mediumspace"}),r=this.bind(e,r),this.caret&&(r.caret=this.caret),r)}_serialize(e){var i;if(!e.expandMacro&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let r=eM(this.command,this.mode);if(null!=r&&r.serialize)return r.serialize(this,e);let a=null!=(i=this.command)?i:"";return void 0===this.width?a:!this._braced||"register"in this.width?`${a}${oF(this.width)}`:`${a}{${oF(this.width)}}`}},lC=class e extends oG{constructor(e){var i;super(g(f({},e),{type:"surd",mode:null!=(i=e.mode)?i:"math",style:e.style,displayContainsHighlight:!0,body:e.body})),this.above=e.index}static fromJson(i){return new e(g(f({},i),{index:i.above}))}_serialize(e){if(!(e.expandMacro||e.skipStyles||e.skipPlaceholders)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);if(null!=i&&i.serialize)return i.serialize(this,e);let r=this.command,a=this.bodyToLatex(e);return this.above&&!this.hasEmptyBranch("above")?og(`${r}[${this.aboveToLatex(e)}]`,a):o$.compactSerialization&&/^[0-9]$/.test(a)?`${r}${a}`:og(r,a)}get children(){if(this._children)return this._children;let e=[];if(this.above)for(let i of this.above)e.push(...i.children),e.push(i);if(this.body)for(let i of this.body)e.push(...i.children),e.push(i);return this._children=e,e}render(e){var i;let r=new oW({parent:e,mathstyle:"cramp"},this.style),a=null!=(i=oG.createBox(r,this.body,{type:"inner"}))?i:new oE(null),o=r.scalingFactor,n=r.metrics.defaultRuleThickness/o,l=e.isDisplayStyle?.431:n,s=new oE(null,{classes:"ML__sqrt-line",style:this.style});s.height=n,s.softWidth=a.width;let c=o*(n+l/4),d=Math.max(2*o*l,a.height+a.depth)+c+n,u=new oW({parent:e},this.style),h=this.bind(u,new oE(nj("inner","\\surd",d,!1,u,{isSelected:this.isSelected}),{isSelected:this.isSelected,classes:"ML__sqrt-sign",style:this.style}));if(!h)return null;let p=h.height+h.depth-n;p>a.height+a.depth+c&&(c=(c+p-(a.height+a.depth))/2),h.setTop(h.height-a.height-c);let m=this.bind(e,new oB({firstBaseline:[{box:new oE(a)},c-2*n,{box:s},n]})),f=oG.createBox(new oW({parent:e,mathstyle:"scriptscriptstyle"}),this.above,{type:"ignore"});if(!f){let i=new oE([h,m],{classes:this.containsCaret?"ML__contains-caret":"",type:"inner"});return i.setStyle("display","inline-block"),i.setStyle("height",i.height+i.depth,"em"),this.caret&&(i.caret=this.caret),this.bind(e,i)}let g=new oE([new oE(new oB({shift:-.6*(Math.max(h.height,m.height)-Math.max(h.depth,m.depth)),children:[{box:f}]}),{classes:"ML__sqrt-index",type:"ignore"}),h,m],{type:"inner",classes:this.containsCaret?"ML__contains-caret":""});return g.height=h.height,g.depth=h.depth,this.caret&&(g.caret=this.caret),this.bind(e,g)}},lE=class extends oE{constructor(e){super(null,{type:"skip"}),this._width=e}toMarkup(){return`<span style="display:inline-block;width:${Math.ceil(100*this.width)/100}em"></span>`}};function lA(e,i){if(!e.parent)return;let r=e.parent.children,a=r.indexOf(e),o=a-1;for(;o>=0&&"ignore"===r[o].type;)o-=1;o<0&&e.parent.parent&&"lift"===e.parent.type?lA(e.parent,i):a>0&&"skip"===r[a-1].type?r[a-1].width+=i:r.splice(a,0,new lE(i))}var lz={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}},lT={ord:{op:3},op:{ord:3,op:3},close:{op:3},inner:{op:3}};function lD(e,i){if(!e.children)return e;let r=e.children;lK(r,(e,i)=>{"bin"===i.type&&(!e||/^(middle|bin|op|rel|open|punct)$/.test(e.type))&&(i.type="ord"),(null==e?void 0:e.type)==="bin"&&/^(rel|close|punct)$/.test(i.type)&&(e.type="ord"),"ignore"!==i.type&&(e=i)});let a=i.getRegisterAsEm("thinmuskip"),o=i.getRegisterAsEm("medmuskip"),n=i.getRegisterAsEm("thickmuskip");return lK(r,(e,i)=>{var r,l,s;if(!e)return;let c=e.type;if("newline"===c)return;let d=i.isTight?null!=(r=lT[c])?r:null:null!=(l=lz[c])?l:null,u=null!=(s=null==d?void 0:d[i.type])?s:null;3===u&&lA(i,a),4===u&&lA(i,o),5===u&&lA(i,n)}),e}function lK(e,i,r){if(!e)return r;for(let a of e=[...e])"lift"===a.type?r=lK(a.children,i,r):"ignore"===a.type?lK(a.children,i):(i(r,a),lK(a.children,i),r=a);return r}var lB=class e extends oG{constructor(e){super({type:"tooltip",command:e.command,mode:e.mode,style:e.style,body:e.body,displayContainsHighlight:!0}),this.tooltip=new oG({type:"root",mode:e.content,body:e.tooltip,style:{}}),this.skipBoundary=!0,this.captureSelection=!1}static fromJson(i){return new e(g(f({},i),{tooltip:lR(i.tooltip)}))}toJson(){var e;let i=null==(e=this.tooltip.body)?void 0:e.filter(e=>"first"!==e.type).map(e=>e.toJson());return g(f({},super.toJson()),{tooltip:i})}render(e){let i=oG.createBox(e,this.body);if(!i)return null;let r=new oW({parent:e,mathstyle:"displaystyle"},{fontSize:5}),a=oA(lD(new oE(this.tooltip.render(r),{classes:"ML__tooltip-content"}),r)),o=new oE([a,i],{classes:"ML__tooltip-container"});return this.caret&&(o.caret=this.caret),this.bind(e,o)}},l$=class e extends oG{constructor(e,i){var r;super({type:"mop",mode:null!=(r=null==i?void 0:i.mode)?r:"math",style:null==i?void 0:i.style,command:"\\blank",isFunction:!0,captureSelection:!0,body:e})}static fromJson(i){return new e(i.body,i)}render(e){let i=new oW({parent:e}),r=!this.body||0===this.body.length||this.body.every(e=>"first"===e.type)?new nU({mode:this.mode,style:this.style}).render(e):oG.createBox(e,this.body),a=new oE("blank",{type:"op",mode:"math",maxFontSize:i.scalingFactor,style:{variant:"main",variantStyle:"up"},isSelected:this.isSelected,letterShapeStyle:i.letterShapeStyle}),o=new oE("(",{type:"open",isSelected:this.isSelected,maxFontSize:i.scalingFactor}),n=new oE(")",{type:"close",isSelected:this.isSelected,maxFontSize:i.scalingFactor}),l=new oE([a,o,r,n],{type:"ord",classes:"ML__blank",isSelected:this.isSelected});this.caret&&(l.caret=this.caret);let s=this.attachSupsub(e,{base:l});return this.bind(i,s)}_serialize(e){var i;let r=null!=(i=this.bodyToLatex(e))?i:"";return e.skipPlaceholders?r:og("\\blank",r)}},lP=class e extends oG{constructor(e,i){super(g(f({},i),{type:"operator",isFunction:null==i?void 0:i.isFunction})),this.value=e,this.variant=null==i?void 0:i.variant,this.variantStyle=null==i?void 0:i.variantStyle,this.subsupPlacement=null==i?void 0:i.limits}static fromJson(i){return new e(i.symbol,i)}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 i;let r=new oE(this.value,{type:"op",mode:"math",maxFontSize:e.scalingFactor,style:{variant:this.variant,variantStyle:this.variantStyle},isSelected:this.isSelected,letterShapeStyle:e.letterShapeStyle}),a=r;if(this.superscript||this.subscript){let o=null!=(i=this.subsupPlacement)?i:"auto";a="over-under"===o||"auto"===o&&e.isDisplayStyle?this.attachLimits(e,{base:r}):this.attachSupsub(e,{base:r})}return new oE(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)&&"string"==typeof this.verbatimLatex)return this.verbatimLatex;let i=eM(this.command,this.mode);if(null!=i&&i.serialize)return i.serialize(this,e);let r=[this.command];return this.explicitSubsupPlacement&&("over-under"===this.subsupPlacement&&r.push("\\limits"),"adjacent"===this.subsupPlacement&&r.push("\\nolimits"),"auto"===this.subsupPlacement&&r.push("\\displaylimits")),r.push(this.supsubToLatex(e)),of(r)}},lO=class e extends oG{constructor(e){super(g(f({type:"newline"},e),{skipBoundary:!0}))}static fromJson(i){return new e(i)}toJson(){return super.toJson()}render(e){let i=new oE(null,{classes:"ML__newline",type:"newline"});return this.caret&&(i.caret=this.caret),this.bind(e,i)}_serialize(e){return"\\\\"}};function lR(e){if(R(e))return e.map(e=>lR(e));if("string"==typeof e)return oG.fromJson(e);for(let i of(e=f({},e),oU))e[i]&&(e[i]=lR(e[i]));e.args&&(e.args=function(e){if(e){if("string"==typeof e)return e;if(Array.isArray(e))return e.map(e=>"<null>"===e?null:"object"==typeof e&&"group"in e?{group:e.group.map(e=>lR(e))}:"object"==typeof e&&"atoms"in e?e.atoms.map(e=>lR(e)):e)}}(e.args)),e.array&&(e.array=lR(e.array));let i=e.type,r;for(let a of("accent"===i&&(r=nT.fromJson(e)),"array"===i&&(r=nQ.fromJson(e)),"box"===i&&(r=n8.fromJson(e)),"chem"===i&&(r=lc.fromJson(e)),"composition"===i&&(r=n5.fromJson(e)),"delim"===i&&(r=lh.fromJson(e)),"enclose"===i&&(r=lf.fromJson(e)),"error"===i&&(r=n7.fromJson(e)),"extensible-symbol"===i&&(r=lw.fromJson(e)),"genfrac"===i&&(r=ly.fromJson(e)),"group"===i&&(r=n9.fromJson(e)),"latex"===i&&(r=lx.fromJson(e)),"latexgroup"===i&&(r=l_.fromJson(e)),"leftright"===i&&(r=le.fromJson(e)),"macro"===i&&(r=lt.fromJson(e)),"macro-argument"===i&&(r=li.fromJson(e)),"newline"===i&&(r=lO.fromJson(e)),"operator"===i&&(r=lP.fromJson(e)),"overlap"===i&&(r=lk.fromJson(e)),"overunder"===i&&(r=lM.fromJson(e)),"placeholder"===i&&(r=nU.fromJson(e)),"\\blank"===e.command?r=l$.fromJson(e):"prompt"===i&&(r=lr.fromJson(e)),"phantom"===i&&(r=lS.fromJson(e)),"sizeddelim"===i&&(r=lp.fromJson(e)),"spacing"===i&&(r=lL.fromJson(e)),"subsup"===i&&(r=la.fromJson(e)),"surd"===i&&(r=lC.fromJson(e)),"text"===i&&(r=oY.fromJson(e)),"tooltip"===i&&(r=lB.fromJson(e)),r||(i&&["first","mbin","mrel","mclose","minner","mop","mopen","mord","mpunct","root","space"].includes(i),r=oG.fromJson(e)),oU))e[a]&&r.setChildren(e[a],a);return void 0!==e.verbatimLatex&&(r.verbatimLatex=e.verbatimLatex),e.subsupPlacement&&(r.subsupPlacement=e.subsupPlacement),e.explicitSubsupPlacement&&(r.explicitSubsupPlacement=!0),e.isFunction&&(r.isFunction=!0),e.skipBoundary&&(r.skipBoundary=!0),e.captureSelection&&(r.captureSelection=!0),r}function lI(e,i){e&&i&&(R(e)?e.forEach(e=>lI(e,i)):"object"==typeof e&&e.applyStyle(i,{unstyledOnly:!0}))}function lN(e,i,r,a){function o(e,i){for(let r of n)if(r.style[e]!==i)return!1;return!0}if((i=e.normalizeRange(i))[0]===i[1])return!1;let n=e.getAtoms(i,{includeChildren:!0});for(let e of("toggle"===a.operation&&(r.color&&o("color",r.color)&&(r.color="none",delete r.verbatimColor),r.backgroundColor&&o("backgroundColor",r.backgroundColor)&&(r.backgroundColor="none",delete r.verbatimBackgroundColor),r.fontFamily&&o("fontFamily",r.fontFamily)&&(r.fontFamily="none"),r.fontSeries&&o("fontSeries",r.fontSeries)&&(r.fontSeries="auto"),r.fontShape&&o("fontShape",r.fontShape)&&(r.fontShape="auto"),r.fontSize&&o("fontSize",r.fontSize)&&(r.fontSize=5),r.variant&&o("variant",r.variant)&&(r.variant="normal"),r.variantStyle&&o("variantStyle",r.variantStyle)&&(r.variantStyle="")),n))e.applyStyle(r);return!0}function lq(e){return({up:"up",bold:"bold",italic:void 0,bolditalic:"bold","":void 0})[null!=e?e:""]}var lF={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};function lV(e,i=[[[]]],r=[],a=[],o,n){return new nQ(e,i,r,g(f({},function(e,i,r,a){switch(e){case"math":case"displaymath":return{mathstyleName:"textstyle",isRoot:!0,minColumns:1,maxColumns:1,minRows:1,maxRows:1};case"center":return{columns:[{align:"c"}],classes:["ML__center_environment"],isRoot:!0,minColumns:1,maxColumns:1,minRows:1,maxRows:1};case"multline":case"multline*":return{columns:[{align:"m"}],leftDelim:".",rightDelim:".",isRoot:!0,minColumns:1,maxColumns:1,minRows:1};case"split":return{columns:[{align:"r"},{align:"l"}],minColumns:2,minRows:1,isRoot:!1};case"gather":case"gather*":return{columns:[{gap:.25},{align:"c"},{gap:0}],minColumns:1,maxColumns:1,minRows:1,isRoot:!0,classes:["ML__gather_environment"]};case"gathered":return{columns:[{gap:.25},{align:"c"},{gap:0}],minColumns:1,maxColumns:1,minRows:1};case"equation":case"equation*":case"subequations":return{columns:[{align:"c"}],isRoot:!0,minColumns:1,maxColumns:1,minRows:1};case"aligned":{let r=0;for(let e of i)r=Math.max(r,e.length);let a=[{gap:0},{align:"r"},{gap:.25},{align:"l"}],o=2;for(;o<r;)a.push({gap:1},{align:"r"},{gap:.25},{align:"l"}),o+=2;return a.push({gap:0}),{arraycolsep:0,columns:a,minColumns:2,minRows:1,isRoot:"aligned"!==e}}case"eqnarray":return{arraycolsep:0,columns:[{gap:0},{align:"r"},{align:"c"},{align:"l"}],minColumns:3,maxColumns:3,minRows:1,isRoot:!0,classes:["ML__eqnarray_environment"]};case"align":case"align*":return{arraycolsep:0,columns:[{gap:0},{align:"r"},{gap:.25},{align:"l"}],minColumns:2,maxColumns:2,minRows:1,isRoot:!0,classes:["ML__align_environment"]};case"pmatrix":case"pmatrix*":return{mathstyleName:"textstyle",leftDelim:"(",rightDelim:")",columns:lj(r[0],a)};case"bmatrix":case"bmatrix*":return{mathstyleName:"textstyle",leftDelim:"[",rightDelim:"]",columns:lj(r[0],a)};case"Bmatrix":case"Bmatrix*":return{mathstyleName:"textstyle",leftDelim:"\\lbrace",rightDelim:"\\rbrace",columns:lj(r[0],a)};case"vmatrix":case"vmatrix*":return{mathstyleName:"textstyle",leftDelim:"\\vert",rightDelim:"\\vert",columns:lj(r[0],a)};case"Vmatrix":case"Vmatrix*":return{mathstyleName:"textstyle",leftDelim:"\\Vert",rightDelim:"\\Vert",columns:lj(r[0],a)};case"matrix":case"matrix*":return{mathstyleName:"textstyle",leftDelim:".",rightDelim:".",columns:lj(null==r?void 0:r[0],a)};case"smallmatrix":case"smallmatrix*":return{mathstyleName:"scriptstyle",columns:lj(null==r?void 0:r[0],a),colSeparationType:"small",arraystretch:.5};case"cases":case"dcases":return{mathstyleName:"dcases"===e?"displaystyle":"textstyle",arraystretch:1.2,leftDelim:"\\lbrace",rightDelim:".",columns:lH()};case"rcases":return{arraystretch:1.2,leftDelim:".",rightDelim:"\\rbrace",columns:lH()};case"lines":return{leftDelim:".",rightDelim:".",columns:[{align:"l"}],isRoot:!0,minColumns:1,maxColumns:1,minRows:1}}return{mathstyleName:"textstyle"}}(e,i,a,o)),{rowRules:n}))}function lj(e,i=10){return null!=e?e:Array(i).fill({align:"c"})}function lH(e=10){let i=[];for(let r=0;r<e;r++)r>0&&i.push({gap:1}),i.push({align:"l"});return i}ex(Object.keys(lF),"{body:auto}",{createAtom:e=>new nT(g(f({},e),{body:et(e.args[0]),accentChar:lF[e.command.slice(1)]}))}),ex(["widehat","widecheck","widetilde"],"{body:auto}",{createAtom:e=>{let i=eb(et(e.args[0]));return new nT(g(f({},e),{body:et(e.args[0]),svgAccent:e.command.slice(1)+(i.length>5?"4":["1","1","2","2","3","3"][i.length])}))}}),ex(["overarc","overparen","wideparen"],"{body:auto}",{createAtom:e=>new nT(g(f({},e),{body:et(e.args[0]),svgAccent:"overarc"}))}),ex(["underarc","underparen"],"{body:auto}",{createAtom:e=>new lM(g(f({},e),{body:et(e.args[0]),svgBelow:"underarc"}))}),ex("utilde","{body:auto}",{createAtom:e=>{let i=et(e.args[0]),r=eb(i),a="widetilde"+(r.length>5?"4":["1","1","2","2","3","3"][r.length]);return new lM(g(f({},e),{body:i,svgBelow:a,boxType:oL(i)}))}}),ex("^","{:string}",{createAtom:e=>{var i;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(i=({a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"})[e.args[0]])?i:"^"}))}}),ex("`","{:string}",{createAtom:e=>{var i;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(i=({a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"})[e.args[0]])?i:"`"}))}}),ex("'","{:string}",{createAtom:e=>{var i;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(i=({a:"á",e:"é",i:"í",o:"ó",u:"ú",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú"})[e.args[0]])?i:"'"}))}}),ex('"',"{:string}",{createAtom:e=>{var i,r;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:null!=(i=e.args)&&i[0]?null!=(r=({a:"ä",e:"ë",i:"ï",o:"ö",u:"ü",A:"Ä",E:"Ë",I:"Ë",O:"Ö",U:"Ü"})[e.args[0]])?r:'"'+e.args[0]:'"'}))}}),ex(".","{:string}",{createAtom:e=>{var i,r;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:null!=(i=e.args)&&i[0]?null!=(r=({a:"ȧ",e:"ė",i:"̇i",o:"ȯ",u:"̇u",A:"Ȧ",E:"Ė",I:"İ",O:"Ȯ",U:"̇U"})[e.args[0]])?r:"."+e.args[0]:"."}))}}),ex("=","{:string}",{createAtom:e=>{var i,r;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:null!=(i=e.args)&&i[0]?null!=(r=({a:"ā",e:"ē",i:"ī",o:"ō",u:"ū",A:"Ā",E:"Ē",I:"Ī",O:"Ō",U:"Ū"})[e.args[0]])?r:"="+e.args[0]:"="}))}}),ex("~","{:string}",{createAtom:e=>{var i;return new oG(g(f({type:"mord"},e),{isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(i=({n:"ñ",N:"Ñ",a:"ã",o:"õ",A:"Ã",O:"Õ"})[e.args[0]])?i:"´"}))}}),ex("c","{:string}",{createAtom:e=>{var i;return new oG(g(f({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&null!=(i=({c:"ç",C:"Ç"})[e.args[0]])?i:""}))}}),ex("enclose","{notation:string}[style:string]{body:auto}",{createAtom:e=>{var i,r;let a=e.args,o={strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",backgroundcolor:"transparent",padding:"auto",shadow:"none",svgStrokeStyle:void 0,borderStyle:void 0,style:null!=(i=e.style)?i:{}};if(a[1]){for(let e of a[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/)){let i=e.match(/\s*(\S+)\s+(\S+)\s+(.*)/);if(i)o.strokeWidth=i[1],o.strokeStyle=i[2],o.strokeColor=i[3];else{let i=e.match(/\s*([a-z]*)\s*=\s*"(.*)"/);i&&("mathbackground"===i[1]?o.backgroundcolor=i[2]:"mathcolor"===i[1]?o.strokeColor=i[2]:"padding"===i[1]?o.padding=i[2]:"shadow"===i[1]&&(o.shadow=i[2]))}}"dashed"===o.strokeStyle?o.svgStrokeStyle="5,5":"dotted"===o.strokeStyle&&(o.svgStrokeStyle="1,5")}o.borderStyle=`${o.strokeWidth} ${o.strokeStyle} ${o.strokeColor}`;let n={};return(null!=(r=a[0])?r:"").split(/[, ]/).filter(e=>e.length>0).forEach(e=>{n[e.toLowerCase()]=!0}),new lf(e.command,et(a[2]),n,o)}}),ex("cancel","{body:auto}",{createAtom:e=>{var i;return new lf(e.command,et(e.args[0]),{updiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(i=e.style)?i:{}})}}),ex("bcancel","{body:auto}",{createAtom:e=>{var i;return new lf(e.command,et(e.args[0]),{downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(i=e.style)?i:{}})}}),ex("xcancel","{body:auto}",{createAtom:e=>{var i;return new lf(e.command,et(e.args[0]),{updiagonalstrike:!0,downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(i=e.style)?i:{}})}}),ex("sout","{body:auto}",{createAtom:e=>{var i;return new lf(e.command,et(e.args[0]),{horizontalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:null!=(i=e.style)?i:{}})}}),ev(["math","displaymath"],lV),ev("center",lV),ey(["multline","multline*"],"",lV),ex("displaylines","",{parse:e=>{if(e.skipWhitespace(),!e.match("<{>"))return[];let i=[],r=[];for(e.mathlist.length>0&&i.push([e.mathlist]),e.beginContext({tabular:!0,root:!0});!(e.end()||e.match("<}>"));)e.matchColumnSeparator()||e.matchRowSeparator()?(i.push([r]),r=[]):r.push(...e.scan(e=>["<}>","&","\\cr","\\\\","\\tabularnewline"].includes(e)));e.endContext(),i.push([r]);let a=e.scan();return a.length>0&&i.push([a]),i},createAtom:e=>new nQ("lines",e.args,[],{leftDelim:".",rightDelim:".",columns:[{align:"l"}],classes:["ML__multiline_environment"],isRoot:!0,minColumns:1,maxColumns:1,minRows:1})}),ey("split","",lV),ey(["gather","gather*","gathered"],"",lV),ey(["equation","equation*","subequations"],"",lV),ev(["align","align*","eqnarray"],lV,{tabular:!0}),ey(["aligned"],"",lV),ey("array","{columns:colspec}",(e,i,r,a,o,n)=>new nQ(e,i,r,{columns:a[0],mathstyleName:"textstyle",rowRules:n})),ey(["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],"[columns:colspec]",lV),ey(["smallmatrix","smallmatrix*"],"[columns:colspec]",lV),ey(["cases","dcases","rcases"],"",lV),ex("piecewise","{count:string}",{parse:e=>{var i,r;let a=null!=(r=null==(i=e.scanArgument("string"))?void 0:i.trim())?r:"";return 0===a.length?(e.onError({code:"missing-argument",arg:"\\piecewise"}),["1"]):!/^[1-9]\d*$/.test(a)||Number(a)>100?(e.onError({code:"unexpected-token",arg:a}),["1"]):[a]},createAtom:e=>{var i;let r=Number.parseInt(null==(i=e.args)?void 0:i[0],10);return lV("cases",Array.from({length:Number.isInteger(r)&&r>0?Math.min(r,100):1},()=>[[new nU],[new nU]]))}}),ex(["overrightarrow","overleftarrow","Overrightarrow","overleftharpoon","overrightharpoon","overleftrightarrow","overlinesegment","overgroup"],"{:auto}",{createAtom:e=>{var i;return new lM(g(f({},e),{body:et(null==(i=e.args)?void 0:i[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgAbove:e.command.slice(1)}))}}),ex("overbrace","{:auto}",{createAtom:e=>new lM(g(f({},e),{body:et(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgAbove:e.command.slice(1)}))}),ex(["underrightarrow","underleftarrow","underleftrightarrow","underlinesegment","undergroup"],"{:auto}",{createAtom:e=>new lM(g(f({},e),{body:et(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgBelow:e.command.slice(1)}))}),ex(["underbrace"],"{:auto}",{createAtom:e=>new lM(g(f({},e),{body:et(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgBelow:e.command.slice(1)}))}),ex(["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:e=>{var i,r,a,o,n;return new lM(g(f({},e),{svgBody:e.command.slice(1),above:(null==(r=et(null==(i=e.args)?void 0:i[1]))?void 0:r.length)===0?void 0:et(null==(a=e.args)?void 0:a[1]),below:null!=(n=et(null==(o=e.args)?void 0:o[0]))?n:null,skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,paddedLabels:!0,boxType:"rel"}))},serialize:(e,i)=>e.command+(e.hasEmptyBranch("below")?"":`[${e.belowToLatex(i)}]`)+`{${e.aboveToLatex(i)}}${e.supsubToLatex(i)}`}),ex(["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:e=>new lP(e.command.slice(1),g(f({},e),{limits:"adjacent",isFunction:!0,variant:"main",variantStyle:"up"}))}),ex(["liminf","limsup"],"",{ifMode:"math",createAtom:e=>new lP({"\\liminf":"lim inf","\\limsup":"lim sup"}[e.command],g(f({},e),{limits:"over-under",variant:"main"}))}),ex(["lim","mod"],"",{ifMode:"math",createAtom:e=>new lP(e.command.slice(1),g(f({},e),{limits:"over-under",variant:"main"}))}),ex(["det","max","min"],"",{ifMode:"math",isFunction:!0,createAtom:e=>new lP(e.command.slice(1),g(f({},e),{limits:"over-under",isFunction:!0,variant:"main"}))}),ex("ang","{:math}",{ifMode:"math",createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),serialize:(e,i)=>`\\ang{${e.bodyToLatex(i)}}`,render:(e,i)=>{let r=e.createBox(i),a=r.caret;r.caret=void 0;let o=new oE("°",{style:g(f({},e.style),{variant:"normal",variantStyle:"up"})});return new oE([r,o],{type:"inner",isSelected:e.isSelected,caret:a})}}),ex("sqrt","[index:auto]{radicand:expression}",{ifMode:"math",createAtom:e=>new lC(g(f({},e),{body:et(e.args[1]),index:e.args[0]?et(e.args[0]):void 0}))}),ex(["frac","dfrac","tfrac","binom","dbinom","tbinom"],"{:expression}{:expression}",{ifMode:"math",createAtom:e=>{let i=f({},e),r=e.command,a=e.args;switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":i.hasBarLine=!0;break;case"\\atopfrac":i.hasBarLine=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":i.hasBarLine=!1,i.leftDelim="(",i.rightDelim=")";break;case"\\cfrac":i.hasBarLine=!0,i.continuousFraction=!0}switch(r){case"\\dfrac":case"\\dbinom":i.mathstyleName="displaystyle";break;case"\\tfrac":case"\\tbinom":i.mathstyleName="textstyle"}return new ly(a[0]?et(a[0]):[new nU],a[1]?et(a[1]):[new nU],i)},serialize:(e,i)=>{let r=e.aboveToLatex(i),a=e.belowToLatex(i);return o$.compactSerialization&&/^[0-9]$/.test(r)&&/^[0-9]$/.test(a)?`${e.command}${r}${a}`:og(e.command,r,a)}}),ex("genfrac","{:string}{:string}{:string}{:string}{:expression}{:expression}",{ifMode:"math",createAtom:e=>{var i,r,a,o,n;let l=e.args,s=(null!=(i=l[0])?i:"").trim(),c=(null!=(r=l[1])?r:"").trim(),d=(null!=(a=l[2])?a:"").trim(),u=null!=(n=({0:"displaystyle",1:"textstyle",2:"scriptstyle",3:"scriptscriptstyle"})[(null!=(o=l[3])?o:"").trim()])?n:void 0;return new ly(l[4]?et(l[4]):[new nU],l[5]?et(l[5]):[new nU],g(f({},e),{leftDelim:s&&"."!==s?s:void 0,rightDelim:c&&"."!==c?c:void 0,hasBarLine:"0pt"!==d&&"0"!==d,mathstyleName:u}))}}),ex(["cfrac"],"[:string]{:expression}{:expression}",{ifMode:"math",createAtom:e=>{let i=f({},e),r=e.args;return i.hasBarLine=!0,i.continuousFraction=!0,"r"===r[0]&&(i.align="right"),"l"===r[0]&&(i.align="left"),new ly(r[1]?et(r[1]):[new nU],r[2]?et(r[2]):[new nU],i)},serialize:(e,i)=>{let r=e.aboveToLatex(i),a=e.belowToLatex(i);return og(e.command,r,a)}}),ex(["brace","brack"],"",{infix:!0,createAtom:e=>new ly(et(e.args[0]),et(e.args[1]),g(f({},e),{hasBarLine:!1,leftDelim:"\\brace"===e.command?"\\lbrace":"\\lbrack",rightDelim:"\\brace"===e.command?"\\rbrace":"\\rbrack"})),serialize:(e,i)=>of([e.aboveToLatex(i),e.command,e.belowToLatex(i)])}),ex(["over","atop","choose"],"",{infix:!0,createAtom:e=>{let i,r,a=e.args;return"\\choose"===e.command&&(i="(",r=")"),new ly(et(a[0]),et(a[1]),g(f({},e),{hasBarLine:"\\over"===e.command,leftDelim:i,rightDelim:r}))},serialize:(e,i)=>of([e.aboveToLatex(i),e.command,e.belowToLatex(i)])}),ex(["overwithdelims","atopwithdelims"],"{numer:auto}{denom:auto}{left-delim:delim}{right-delim:delim}",{infix:!0,createAtom:e=>{var i,r;let a=e.args;return new ly(et(a[0]),et(a[1]),g(f({},e),{leftDelim:null!=(i=a[2])?i:".",rightDelim:null!=(r=a[3])?r:".",hasBarLine:!1}))},serialize:(e,i)=>`${e.aboveToLatex(i)} ${e.command}${e.leftDelim}${e.rightDelim}${e.belowToLatex(i)}`}),ex("pdiff","{numerator}{denominator}",{ifMode:"math",createAtom:e=>new ly(et(e.args[0]),et(e.args[1]),g(f({},e),{hasBarLine:!0,numerPrefix:"∂",denomPrefix:"∂"})),serialize:(e,i)=>of([e.aboveToLatex(i),e.command,e.belowToLatex(i)])}),ex(["sum","prod","bigcup","bigcap","coprod","bigvee","bigwedge","biguplus","bigotimes","bigoplus","bigodot","bigsqcup","intop"],"",{ifMode:"math",createAtom:e=>new lw({coprod:"∐",bigvee:"⋁",bigwedge:"⋀",biguplus:"⨄",bigcap:"⋂",bigcup:"⋃",intop:"∫",prod:"∏",sum:"∑",bigotimes:"⨂",bigoplus:"⨁",bigodot:"⨀",bigsqcup:"⨆",smallint:"∫"}[e.command.slice(1)],g(f({},e),{limits:"auto",variant:"main"}))}),ex("smallint","",{ifMode:"math",createAtom:e=>new lP("∫",g(f({},e),{limits:"adjacent",variant:"main"}))});var lW={int:"∫",iint:"∬",iiint:"∭",iiiint:"⨌",oint:"∮",oiint:"∯",oiiint:"∰",intclockwise:"∱",varointclockwise:"∲",ointctrclockwise:"∳",intctrclockwise:"⨑",sqcup:"⊔",sqcap:"⊓",uplus:"⊎",wr:"≀",amalg:"⨿",Cap:"⋒",Cup:"⋓",doublecap:"⋒",doublecup:"⋓"};function lU(e,i){var r,a;e.skipFiller();let o=e.scanLiteralGroup();if(!o){let i=e.peek();null!=i&&i.startsWith("\\")&&(o=i,e.next())}let n=null!=(a=null==(r=e.scanArgument("string"))?void 0:r.trim())?a:"",l=(o.startsWith("\\")?o.slice(1):o).trim();return l&&n&&e.defineLocalMacro(l,{def:i?`\\operatorname*{${n}}`:`\\operatorname{${n}}`,args:0,captureSelection:!1}),[o,n]}function lJ(e){return new oG({type:"mord",mode:"math",command:e.command,value:"",args:e.args,style:e.style})}function lX(e,i){var r,a,o,n;let l=null!=(a=null==(r=e.args)?void 0:r[0])?a:"",s=null!=(n=null==(o=e.args)?void 0:o[1])?n:"",c=l.startsWith("\\")?l:`\\${l}`;return i?`\\DeclareMathOperator*{${c}}{${s}}`:`\\DeclareMathOperator{${c}}{${s}}`}ex(Object.keys(lW),"",{ifMode:"math",createAtom:e=>{let i=lW[e.command.slice(1)];return new lw(i,g(f({},e),{limits:"adjacent",variant:{"⋒":"ams","⋓":"ams"}[i]}))}}),ex(["Re","Im"],"",{ifMode:"math",createAtom:e=>new lP({"\\Re":"ℜ","\\Im":"ℑ"}[e.command],g(f({},e),{limits:"adjacent",isFunction:!0,variant:"fraktur"}))}),ex("middle","{:delim}",{ifMode:"math",createAtom:e=>{var i;return new lh(g(f({},e),{delim:null!=(i=e.args[0])?i:"|",size:1}))}}),ex("the","{:value}",{createAtom:e=>new oG(g(f({},e),{captureSelection:!0,verbatimLatex:null})),render:(e,i)=>{var r;let a=new oW({parent:i},e.style),o="";return e.isSelected&&(o+=" ML__selected"),new oE((null!=(r=oF(a.evaluate(e.args[0])))?r:"").split("").map(i=>new oE(i,{type:"ord",classes:o,mode:e.mode,isSelected:e.isSelected,style:f({variant:"main"},e.style)})),{type:"lift",style:e.style,caret:e.caret,isSelected:e.isSelected,classes:o}).wrap(a)},serialize:e=>{var i;return`\\the${null!=(i=oF(e.args[0]))?i:"\\relax"}`}}),ex("blank","{body:auto}",{ifMode:"math",isFunction:!0,createAtom:e=>new l$(et(e.args[0]),e)}),ex("DeclareMathOperator","",{ifMode:"math",parse:e=>lU(e,!1),createAtom:lJ,render:()=>null,serialize:e=>lX(e,!1)}),ex("DeclareMathOperator*","",{ifMode:"math",parse:e=>lU(e,!0),createAtom:lJ,render:()=>null,serialize:e=>lX(e,!0)}),ex("mathtip","{:auto}{:math}",{createAtom:e=>new lB(g(f({},e),{body:et(e.args[0]),tooltip:et(e.args[1]),content:"math"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\mathtip{${e.bodyToLatex(i)}}{${oG.serialize([e.tooltip],g(f({},i),{defaultMode:"math"}))}}`}),ex("texttip","{:auto}{:text}",{createAtom:e=>new lB(g(f({},e),{body:et(e.args[0]),tooltip:et(e.args[1]),content:"text"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\texttip{${e.bodyToLatex(i)}}{${oG.serialize([e.tooltip],g(f({},i),{defaultMode:"text"}))}}`}),ex("error","{:math}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),serialize:(e,i)=>`\\error{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__error"})}),ex("ensuremath","{:math}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),serialize:(e,i)=>`${e.command}{${e.bodyToLatex(g(f({},i),{defaultMode:"math"}))}}`}),ex("color","{:value}",{applyStyle:(e,i,r,a)=>{var o,n;return g(f({},e),{verbatimColor:null!=(o=oF(r[0]))?o:void 0,color:a.toColor(null!=(n=r[0])?n:{string:"red"})})}}),ex("textcolor","{:value}{content:auto*}",{applyStyle:(e,i,r,a)=>{var o,n;return g(f({},e),{verbatimColor:null!=(o=oF(r[0]))?o:void 0,color:a.toColor(null!=(n=r[0])?n:{string:"red"})})}}),ex("boxed","{content:math}",{createAtom:e=>new n8(g(f({},e),{body:et(e.args[0]),framecolor:{string:"black"}}))}),ex("colorbox","{:value}{:text*}",{applyStyle:(e,i,r,a)=>{var o,n;return g(f({},e),{verbatimBackgroundColor:null!=(o=oF(r[0]))?o:void 0,backgroundColor:a.toBackgroundColor(null!=(n=r[0])?n:{string:"yellow"})})}}),ex("fcolorbox","{frame-color:value}{background-color:value}{content:text}",{applyMode:"text",createAtom:e=>{var i,r;return new n8(g(f({},e),{body:et(e.args[2]),framecolor:null!=(i=e.args[0])?i:{string:"blue"},backgroundcolor:null!=(r=e.args[1])?r:{string:"yellow"}}))},serialize:(e,i)=>{var r,a;return i.skipStyles?e.bodyToLatex(g(f({},i),{defaultMode:"text"})):og(e.command,null!=(r=oF(e.framecolor))?r:"",null!=(a=oF(e.backgroundcolor))?a:"",e.bodyToLatex(g(f({},i),{defaultMode:"text"})))}}),ex("bbox","[:bbox]{body:auto}",{createAtom:e=>{var i;let r=e.args[0],a=et(e.args[1]);return new n8(r?g(f({},e),{body:a,padding:r.padding,border:r.border,backgroundcolor:null!=(i=r.backgroundcolor)?i:void 0}):g(f({},e),{body:a}))},serialize:(e,i)=>{var r,a;if(i.skipStyles)return e.bodyToLatex(i);let o=e.command;if(Number.isFinite(e.padding)||void 0!==e.border||void 0!==e.backgroundcolor){let i=[];e.padding&&i.push(null!=(r=oF(e.padding))?r:""),e.border&&i.push(`border: ${e.border}`),e.backgroundcolor&&i.push(null!=(a=oF(e.backgroundcolor))?a:""),o+=`[${i.join(",")}]`}return og(o,e.bodyToLatex(i))}}),ex(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"],"{:rest}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),render:(e,i)=>{let r=new oW({parent:i,mathstyle:e.command.slice(1)},e.style),a=oG.createBox(r,e.body,{type:"lift"});return e.caret&&(a.caret=e.caret),e.bind(i,a)},serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`{${of([e.command,e.bodyToLatex(i)])}}`}),ex(["tiny","scriptsize","footnotesize","small","normalsize","large","Large","LARGE","huge","Huge"],"",{applyStyle:(e,i)=>g(f({},e),{fontSize:{"\\tiny":1,"\\scriptsize":2,"\\footnotesize":3,"\\small":4,"\\normalsize":5,"\\large":6,"\\Large":7,"\\LARGE":8,"\\huge":9,"\\Huge":10}[i]})}),ex("selectfont","",{ifMode:"text",applyStyle:e=>e}),ex("bf","{:rest*}",{applyStyle:e=>g(f({},e),{fontSeries:"b",fontShape:"n",fontFamily:"roman"})}),ex(["boldsymbol","bm","bold"],"{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variantStyle:"bold"})}),ex("bfseries","{:rest*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontSeries:"b"})}),ex("mdseries","{:rest*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontSeries:"m"})}),ex("upshape","{:rest*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"n"})}),ex("slshape","{:rest*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"sl"})}),ex("scshape","{:rest*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"sc"})}),ex("textbf","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontSeries:"b"})}),ex("textmd","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontSeries:"m"})}),ex("textup","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"n"})}),ex("textnormal","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"n",fontSeries:"m"})}),ex("textsl","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"sl"})}),ex("textit","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"it"})}),ex("textsc","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontShape:"sc"})}),ex("textrm","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontFamily:"roman"})}),ex("textsf","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontFamily:"sans-serif"})}),ex("texttt","{:text*}",{applyMode:"text",applyStyle:e=>g(f({},e),{fontFamily:"monospace"})}),ex("mathbf","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"normal",variantStyle:"bold"})}),ex("mathit","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"main",variantStyle:"italic"})}),ex("mathnormal","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"normal",variantStyle:"italic"})}),ex("mathbfit","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"main",variantStyle:"bolditalic"})}),ex("mathrm","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"normal",variantStyle:"up"})}),ex("mathsf","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"sans-serif",variantStyle:"up"})}),ex("mathtt","{:math*}",{applyMode:"math",applyStyle:e=>g(f({},e),{variant:"monospace",variantStyle:"up"})}),ex("it","{:rest*}",{applyStyle:e=>g(f({},e),{fontSeries:"m",fontShape:"it",fontFamily:"roman",variantStyle:"italic"})}),ex("rmfamily","{:rest*}",{applyStyle:e=>g(f({},e),{fontFamily:"roman"})}),ex("sffamily","{:rest*}",{applyStyle:e=>g(f({},e),{fontFamily:"sans-serif"})}),ex("ttfamily","{:rest*}",{applyStyle:e=>g(f({},e),{fontFamily:"monospace"})}),ex(["Bbb","mathbb"],"{:math*}",{applyStyle:e=>g(f({},e),{variant:"double-struck",variantStyle:lq(e.variantStyle)})}),ex(["frak","mathfrak"],"{:math*}",{applyStyle:e=>g(f({},e),{variant:"fraktur",variantStyle:lq(e.variantStyle)})}),ex("mathcal","{:math*}",{applyStyle:e=>g(f({},e),{variant:"calligraphic",variantStyle:lq(e.variantStyle)})}),ex("mathscr","{:math*}",{applyStyle:e=>g(f({},e),{variant:"script",variantStyle:lq(e.variantStyle)})}),ex(["mbox","hbox"],"{:text}",{ifMode:"math",createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[0]),mode:"math"})),serialize:(e,i)=>{var r;return og(null!=(r=e.command)?r:"\\mbox",e.bodyToLatex(g(f({},i),{defaultMode:"text"})))}}),ex("text","{:text}",{ifMode:"math",applyMode:"text"}),ex(["class","htmlClass"],"{name:string}{content:auto*}",{createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[1])})),serialize:(e,i)=>!e.args[0]||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`,render:(e,i)=>{var r;return e.createBox(i,{classes:null!=(r=e.args[0])?r:"",boxType:"lift"})}}),ex(["cssId","htmlId"],"{id:string}{content:auto*}",{createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[1])})),serialize:(e,i)=>{var r;return!(null!=(r=e.args)&&r[0])||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;let a=e.createBox(i);return a.cssId=null!=(r=e.args[0])?r:"",a}}),ex("htmlData","{data:string}{content:auto*}",{createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[1])})),serialize:(e,i)=>{var r;return!(null!=(r=e.args)&&r[0])||i.skipStyles?e.bodyToLatex(i):`\\htmlData{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;let a=e.createBox(i);return a.htmlData=null!=(r=e.args[0])?r:"",a}}),ex(["style","htmlStyle"],"{data:string}{content:auto*}",{createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[1])})),serialize:(e,i)=>{var r;return!(null!=(r=e.args)&&r[0])||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;let a=e.createBox(i);return a.htmlStyle=null!=(r=e.args[0])?r:"",a}}),ex("href","{url:string}{content:auto*}",{createAtom:e=>new oG(g(f({},e),{type:"mord",body:et(e.args[1])})),render:(e,i)=>{var r;let a=e.createBox(i),o=null!=(r=e.args[0])?r:"";return o&&(a.htmlData=`href=${o}`),a}}),ex("em","{:rest}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`{\\em ${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__emph",boxType:"lift"})}),ex("emph","{:auto}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[1])})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\emph{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__emph",boxType:"lift"})});var lG={"\\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}};ex(["bigl","Bigl","biggl","Biggl","bigr","Bigr","biggr","Biggr","bigm","Bigm","biggm","Biggm","big","Big","bigg","Bigg"],"{:delim}",{createAtom:e=>{var i;return new lp(g(f({},e),{delim:null!=(i=e.args[0])?i:".",size:lG[e.command].size,delimType:lG[e.command].mclass}))},serialize:(e,i)=>of([e.command,/^[a-zA-Z]/.test(e.value)?`{${e.value}}`:e.value])}),ex(["hspace","hspace*"],"{width:value}",{createAtom:e=>{var i;return new lL(g(f({},e),{width:null!=(i=e.args[0])?i:{dimension:0}}))}}),ex(["mkern","kern","mskip","hskip","mspace"],"{width:value}",{createAtom:e=>{var i;return new lL(g(f({},e),{width:null!=(i=e.args[0])?i:{dimension:0}}))}}),ex("\\","",{createAtom:e=>new lO(e)}),ex("mathchoice","{:math}{:math}{:math}{:math}",{createAtom:e=>new oG(e),render:(e,i)=>{let r=0,a=i.mathstyle.id;(5===a||4===a)&&(r=1),(3===a||2===a)&&(r=2),(1===a||0===a)&&(r=3);let o=et(e.args[r]);return oG.createBox(i,o)},serialize:(e,i)=>`\\mathchoice{${oG.serialize(e.args[0],i)}}{${oG.serialize(e.args[1],i)}}{${oG.serialize(e.args[2],i)}}{${oG.serialize(e.args[3],i)}}`}),ex("mathop","{:auto}",{createAtom:e=>new oG(g(f({},e),{type:"mop",body:et(e.args[0]),limits:"over-under",isFunction:!0,captureSelection:!0})),render:(e,i)=>{var r;let a=oG.createBox(i,e.body);if(e.superscript||e.subscript){let o=null!=(r=e.subsupPlacement)?r:"auto";a="over-under"===o||"auto"===o&&i.isDisplayStyle?e.attachLimits(i,{base:a}):e.attachSupsub(i,{base:a})}return e.caret&&(a.caret=e.caret),new oE(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"ML__op-group"})},serialize:(e,i)=>{let r=[og(e.command,e.bodyToLatex(i))];return e.explicitSubsupPlacement&&("over-under"===e.subsupPlacement&&r.push("\\limits"),"adjacent"===e.subsupPlacement&&r.push("\\nolimits"),"auto"===e.subsupPlacement&&r.push("\\displaylimits")),r.push(e.supsubToLatex(i)),of(r)}}),ex(["mathbin","mathrel","mathopen","mathclose","mathpunct","mathord","mathinner"],"{:auto}",{createAtom:e=>new oG(g(f({},e),{type:{"\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[e.command],body:et(e.args[0])}))}),ex(["operatorname","operatorname*"],"{operator:math}",{createAtom:e=>{let i=et(e.args[0]).map(e=>{var i;return"first"!==e.type&&(e.type="mord",e.value=null!=(i=({"∗":"*","−":"-"})[e.value])?i:e.value,e.isFunction=!1,e.style.variant||e.style.variantStyle||(e.style.variant="main",e.style.variantStyle="up")),e});return new oG(g(f({},e),{type:"mop",body:i,isFunction:!0,limits:"\\operatorname"===e.command?"adjacent":"over-under"}))},render:(e,i)=>{var r;let a=oG.createBox(i,e.body);if(e.superscript||e.subscript){let o=null!=(r=e.subsupPlacement)?r:"auto";a="over-under"===o||"auto"===o&&i.isDisplayStyle?e.attachLimits(i,{base:a}):e.attachSupsub(i,{base:a})}return e.caret&&(a.caret=e.caret),new oE(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"ML__op-group"})},serialize:(e,i)=>{let r=[og(e.command,e.bodyToLatex(i))];return e.explicitSubsupPlacement&&("over-under"===e.subsupPlacement&&r.push("\\limits"),"adjacent"===e.subsupPlacement&&r.push("\\nolimits"),"auto"===e.subsupPlacement&&r.push("\\displaylimits")),r.push(e.supsubToLatex(i)),of(r)}}),ex(["char","unicode"],"{charcode:value}",{createAtom:e=>new oG(g(f({},e),{type:"text"===e.mode?"text":"mord"})),serialize:e=>{var i;return`${e.command}${oF(null!=(i=e.args[0])?i:{number:10067,base:"hexadecimal"})}`},render:(e,i)=>{let r=i.evaluate(e.args[0]);return r&&"number"in r||(r={number:10067,base:"hexadecimal"}),e.value=String.fromCodePoint(r.number),e.createBox(i)}}),ex("rule","[raise:value]{width:value}{thickness:value}",{createAtom:e=>new oG(e),render:(e,i)=>{var r,a,o;let n=new oW({parent:i,mathstyle:"textstyle"},e.style),l=n.toEm(null!=(r=e.args[0])?r:{dimension:0}),s=n.toEm(null!=(a=e.args[1])?a:{dimension:10}),c=n.toEm(null!=(o=e.args[2])?o:{dimension:10}),d=new oE(null,{classes:"ML__rule",type:"ord"});return d.width=s,d.height=c+l,d.depth=-l,d.setStyle("border-right-width",s,"em"),d.setStyle("border-top-width",c,"em"),d.setStyle("border-color",e.style.color),d.setStyle("vertical-align",l,"em"),e.isSelected&&d.setStyle("opacity","50%"),e.bind(n,d),e.caret&&(d.caret=e.caret),d.wrap(i)},serialize:e=>`\\rule${e.args[0]?`[${oF(e.args[0])}]`:""}{${oF(e.args[1])}}{${oF(e.args[2])}}`}),ex(["overline","underline"],"{:auto}",{createAtom:e=>new oG(g(f({},e),{body:et(e.args[0])})),render:(e,i)=>{let r,a=e.command.substring(1),o=new oW({parent:i,mathstyle:"cramp"},e.style),n=oG.createBox(o,e.body);if(!n)return null;let l=o.metrics.defaultRuleThickness/o.scalingFactor,s=new oE(null,{classes:a+"-line"});return s.height=l,s.maxFontSize=1.125*l*o.scalingFactor,r=new oB("overline"===a?{shift:0,children:[{box:n},3*l,{box:s},l]}:{top:n.height,children:[l,{box:s},3*l,{box:n}]}),e.caret&&(r.caret=e.caret),new oE(r,{classes:a,type:"ignore"})}}),ex("overset","{:auto}{base:auto}",{createAtom:e=>{let i=et(e.args[1]);return new lM(g(f({},e),{above:et(e.args[0]),body:i,skipBoundary:!1,boxType:oL(i)}))},serialize:(e,i)=>og(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),ex("underset","{:auto}{base:auto}",{createAtom:e=>{let i=et(e.args[1]);return new lM(g(f({},e),{below:et(e.args[0]),body:i,skipBoundary:!1,boxType:oL(i)}))},serialize:(e,i)=>og(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),ex("overunderset","{above:auto}{below:auto}{base:auto}",{createAtom:e=>{let i=et(e.args[2]);return new lM(g(f({},e),{above:et(e.args[0]),below:et(e.args[1]),body:i,skipBoundary:!1,boxType:oL(i)}))},serialize:(e,i)=>og(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),ex(["stackrel","stackbin"],"[below:auto]{above:auto}{base:auto}",{createAtom:e=>new lM(g(f({},e),{body:et(e.args[2]),above:et(e.args[1]),below:et(e.args[0]),skipBoundary:!1,boxType:"\\stackrel"===e.command?"rel":"bin"})),serialize:(e,i)=>og(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),ex("smash","[:string]{:auto}",{createAtom:e=>{var i,r,a,o;return new lS(g(f({},e),{body:et(e.args[1]),smashHeight:null==(r=null==(i=e.args[0])?void 0:i.includes("t"))||r,smashDepth:null==(o=null==(a=e.args[0])?void 0:a.includes("b"))||o}))}}),ex("vphantom","{:auto}",{createAtom:e=>new lS(g(f({},e),{body:et(e.args[0]),isInvisible:!0,smashWidth:!0}))}),ex("hphantom","{:auto}",{createAtom:e=>new lS(g(f({},e),{body:et(e.args[0]),isInvisible:!0,smashHeight:!0,smashDepth:!0}))}),ex("phantom","{:auto}",{createAtom:e=>new lS(g(f({},e),{body:et(e.args[0]),isInvisible:!0}))}),ex("mathstrut","",{createAtom:e=>new lS(g(f({},e),{body:[new oG({value:"("})],isInvisible:!0}))}),ex("not","{:math}",{createAtom:e=>{let i=et(e.args[0]);return new oG(0===i.length?g(f({},e),{type:"mrel",value:""}):g(f({},e),{body:[new lk(g(f({},e),{body:"",align:"right"})),...i],captureSelection:!0}))},serialize:(e,i)=>{let r=e.args[0],a=r&&"object"==typeof r&&"group"in r;return""!==e.value?a?`\\not{${oG.serialize(r.group,i)}}`:`\\not${oG.serialize(r,i)}`:a?"\\not{}":"\\not"},render:(e,i)=>{if(e.value)return e.createBox(i);let r=e.args[0]&&"object"==typeof e.args[0]&&"group"in e.args[0]?"ord":oL(et(e.args[0])),a=oG.createBox(i,e.body,{type:r});return e.caret&&(a.caret=e.caret),e.bind(i,a)}}),ex(["ne","neq"],"",{createAtom:e=>new oG(g(f({},e),{type:"mrel",body:[new lk(g(f({},e),{body:"",align:"right",boxType:"rel"})),new oG(g(f({},e),{value:"="}))],captureSelection:!0})),serialize:e=>e.command}),ex("rlap","{:auto}",{createAtom:e=>new lk(g(f({},e),{body:et(e.args[0]),align:"right"}))}),ex("llap","{:auto}",{createAtom:e=>new lk(g(f({},e),{body:et(e.args[0]),align:"left"}))}),ex("mathrlap","{:math}",{createAtom:e=>new lk(g(f({},e),{body:et(e.args[0]),align:"right"}))}),ex("mathllap","{:math}",{createAtom:e=>new lk(g(f({},e),{body:et(e.args[0]),align:"left"}))}),ex("clap","{:auto}",{createAtom:e=>new lk(g(f({},e),{body:et(e.args[0]),align:"center"}))}),ex("mathclap","{:math}",{createAtom:e=>new lk(g(f({},e),{body:et(e.args[0]),align:"center"}))}),ex("raisebox","{:value}{:text}",{createAtom:e=>{var i;return new n8(g(f({},e),{body:et(e.args[1]),padding:{dimension:0},offset:null!=(i=e.args[0])?i:{dimension:0}}))},serialize:(e,i)=>{var r;return og("\\raisebox",null!=(r=oF(e.offset))?r:"0pt",e.bodyToLatex(i))}}),ex("raise","{:value}{:auto}",{createAtom:e=>{var i;return new n8(g(f({},e),{body:et(e.args[1]),padding:{dimension:0},offset:null!=(i=e.args[0])?i:{dimension:0}}))},serialize:(e,i)=>{var r;return og("\\raise",null!=(r=oF(e.offset))?r:"0pt",e.bodyToLatex(i))}}),ex("lower","{:value}{:auto}",{createAtom:e=>{var i;return new n8(g(f({},e),{body:et(e.args[1]),padding:{dimension:0},offset:null!=(i=oV(e.args[0],-1))?i:{dimension:0}}))},serialize:(e,i)=>{var r,a;return og("\\lower",null!=(a=oF(oV(null!=(r=e.offset)?r:{dimension:0},-1)))?a:"0pt",e.bodyToLatex(i))}}),eh("0123456789/@.?!"),ep(65,90),ep(97,122),eh([["\\forall",8704],["\\exists",8707],["\\nexists",8708,"mord","ams"],["\\mid",8739,"mrel"],["\\top",8868],["\\bot",8869]]),eh([["\\#",35],["\\&",38],["\\parallelogram",9649],["\\spadesuit",9824],["\\heartsuit",9825],["\\diamondsuit",9826],["\\clubsuit",9827],["\\flat",9837],["\\natural",9838],["\\sharp",9839]]),eh([["\\backslash",92],["\\nabla",8711],["\\partial",8706],["\\ell",8467],["\\hbar",8463],["\\pounds",163],["\\euro",8364]]),eh([["\\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"),eh([["\\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"]]),eh([["\\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"]]),eh([["\\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"),eh([["+",43],["-",8722],["−",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"),eh([["\\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"),eh([["\\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]]),eh([["=",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"),eh([["\\lnot",172],["\\neg",172],["\\triangle",9651],["\\subsetneq",8842],["\\varsubsetneq",57370],["\\subsetneqq",10955],["\\varsubsetneqq",57367],["\\nsubset",8836],["\\nsupset",8837],["\\nsubseteq",8840],["\\nsupseteq",8841]],"mrel","ams"),eh([["\\wp",8472],["\\aleph",8501]]),eh([["\\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"),eh([["\\ ",160],["~",160]],"space"),ex(["!",",",":",";",">","enskip","enspace","quad","qquad","thinspace","negthinspace","medspace","negmedspace","thickspace","negthickspace"],"",{createAtom:e=>new lL(e)}),ex("space","",{createAtom:e=>new lL(e)}),eh([["\\colon",58],["\\cdotp",8901],["\\vdots",8942,"mord"],["\\ldotp",46],[",",44],[";",59]],"mpunct"),eh([["\\cdots",8943],["\\ddots",8945],["\\ldots",8230],["\\dots",8230],["\\mathellipsis",8230]],"minner"),eh([["\\/",47],["|",8739,"mord"],["\\imath",305],["\\jmath",567],["\\degree",176],["'",8242],['"',8221]]);var lZ={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"]},lY={"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]$/},lQ=/^[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5]$/,l0=[/^[a-z]$/,/^[A-Z]$/,lQ,/^[\u0393|\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A6\u03A8\u03A9]$/],l1={iso:["it","it","it","it"],tex:["it","it","it","up"],french:["it","up","up","up"],upright:["up","up","up","up"]};function l4(e,i){let{parent:r}=e[0],a=ow(r);return ok(e,"variant").map(e=>{let r=ow(e[0]),o="";r&&r!==a&&(o=({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"})[r]);let n="",l=e[e.length-1],s=o&&e.length>0&&(void 0!==l.branch("subscript")||void 0!==l.branch("superscript"));s&&(n=l.supsubToLatex(i));let c=of(e.map((r,a)=>{if(s&&a===e.length-1){let e=eM(r.command,r.mode);return null!=e&&e.serialize?e.serialize(r,i):r.body&&r.command?og(r.command,r.bodyToLatex(i)):r.body?r.bodyToLatex(i):r.value&&"​"!==r.value?r.command||r.value:""}return r._serialize(i)}));return o?og(o,c)+n:c})}new class extends ov{constructor(){super("math")}createAtom(e,i,r){var a,o,n,l,s,c;let d;if(null===i)return new oG({type:"mord",mode:"math",command:e,value:e,style:r});try{d=null!=(n=null==(o=globalThis.MathfieldElement)?void 0:o.isFunction(null!=(a=i.command)?a:e))&&n}catch(e){d=!1}if("symbol"===i.definitionType){let a=new oG({type:null!=(l=i.type)?l:"mord",mode:"math",command:null!=(s=i.command)?s:e,value:String.fromCodePoint(i.codepoint),isFunction:d,style:r});return e.startsWith("\\")&&(a.verbatimLatex=e),a}let u=new oG({type:"mord",mode:"math",command:null!=(c=i.command)?c:e,value:e,isFunction:d,style:r});return e.startsWith("\\")&&(u.verbatimLatex=e),u}serialize(e,i){var r,a;let o=(r=e,a=g(f({},i),{defaultMode:"math"}),ok(r,"bold").map(e=>{if("bold"!==o_(e[0])||"bold"===o_(e[0].parent))return of(l4(e,a));let i=of(e.map(e=>{var i;return null!=(i=e.value)?i:""}));return/^[a-zA-Z0-9]+$/.test(i)?og("\\mathbf",of(l4(e,a))):og("\\bm",of(l4(e,a)))}));return 0===o.length||"text"!==i.defaultMode?o:["$ ",...o," $"]}getFont(e,i){var r,a,o,n;if(i.variant,i.fontFamily){let a=i.fontFamily;"b"===i.fontSeries&&"it"===i.fontShape?a+="-bolditalic":"b"===i.fontSeries?a+="-bold":"it"===i.fontShape&&(a+="-italic");let o=null!=(r=lZ[a])?r:lZ[i.fontFamily];if(!o)return console.error(`Unknown font family variant: ${a}`),null;let[n,l]=o;return l&&(e.classes+=" "+l),n}let{variant:l}=i,{variantStyle:s}=i;if("normal"===l&&!s&&/[\u00A3\u0131\u0237]/.test(e.value)&&(l="main",s="italic"),"normal"===l&&!s&&1===e.value.length){let r=!1;l0.forEach((a,o)=>{var n;a.test(e.value)&&"it"===l1[null!=(n=i.letterShapeStyle)?n:"tex"][o]&&(r=!0)}),r&&(s=({up:"italic",bold:"bolditalic",italic:"italic",bolditalic:"bolditalic","":"italic"})[null!=(n=s)?n:""])}"up"===s&&(s=void 0);let c=s?l+"-"+s:l;lZ[c];let[d,u]=lZ[c];if(lY[l]&&!lY[l].test(e.value)){let i=ee(e.value,l,s);return i||(i=null!=(a=ee(e.value,l))?a:e.value,e.classes+=null!=(o=({bold:" ML__bold",italic:" ML__it","bold-italic":" ML__bold ML__it"})[null!=s?s:""])?o:""),e.value=i,null}return lQ.test(e.value)&&(e.classes+=" lcGreek"),u&&(e.classes+=" "+u),d}};var l2={roman:"","sans-serif":"ML__sans",monospace:"ML__tt"};function l3(e){var i;let r=/macos|ios/.test(w()),a=e.split("+"),o="";for(let e of a)o&&(o+=r?" ":'<span class="ML__shortcut-join">+</span>'),e.startsWith("[Key")?o+=e.slice(4,5):e.startsWith("Key")?o+=e.slice(3,4):e.startsWith("[Digit")?o+=e.slice(6,7):e.startsWith("Digit")?o+=e.slice(5,6):o+=null!=(i=({cmd:"⌘",meta:r?"⌘":"Ctrl",shift:r?"⇧":"Shift",alt:r?"⌥":"Alt",ctrl:r?"⌃":"Ctrl","\n":r?"⏎":"Return","[return]":r?"⏎":"Return","[enter]":r?"⌤":"Enter","[tab]":r?"⇥":"Tab","[escape]":"Esc","[backspace]":r?"⌫":"Backspace","[delete]":r?"⌦":"Del","[pageup]":r?"⇞":"Page Up","[pagedown]":r?"⇟":"Page Down","[home]":r?"⤒":"Home","[end]":r?"⤓":"End","[space]":"Space","[equal]":"=","[minus]":"-","[comma]":",","[slash]":"/","[backslash]":"\\","[bracketleft]":"[","[bracketright]":"]",semicolon:";",period:".",comma:",",minus:"-",equal:"=",quote:"'",backslash:"\\",intlbackslash:"\\",backquote:"`",slash:"/",numpadmultiply:"* &#128290;",numpaddivide:"/ &#128290;",numpadsubtract:"- &#128290;",numpadadd:"+ &#128290;",numpaddecimal:". &#128290;",numpadcomma:", &#128290;",help:"help",left:"⇠",up:"⇡",right:"⇢",down:"⇣","[arrowleft]":"⇠","[arrowup]":"⇡","[arrowright]":"⇢","[arrowdown]":"⇣"})[e.toLowerCase()])?i:e.toUpperCase();return o}function l6(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return{x:e.clientX,y:e.clientY};if("u">typeof TouchEvent&&e instanceof TouchEvent){let i=[...e.touches].reduce((e,i)=>({x:e.x+i.clientX,y:e.y+i.clientY}),{x:0,y:0}),r=e.touches.length;return{x:i.x/r,y:i.y/r}}}function l8(e){let i={alt:!1,control:!1,shift:!1,meta:!1};return(e instanceof MouseEvent||e instanceof PointerEvent||"u">typeof TouchEvent&&e instanceof TouchEvent||e instanceof KeyboardEvent)&&(e.altKey&&(i.alt=!0),e.ctrlKey&&(i.control=!0),e.metaKey&&(i.meta=!0),e.shiftKey&&(i.shift=!0)),i}new class extends ov{constructor(){super("text")}createAtom(e,i,r){return i&&"symbol"===i.definitionType?new oY(e,String.fromCodePoint(i.codepoint),null!=r?r:{}):null}serialize(e,i){var r,a;return r=g(f({},i),{defaultMode:"text"}),a="text"!==i.defaultMode,ok(e,"fontFamily").map(e=>{var i;a=a&&!e.every(e=>e.style.fontFamily||e.style.fontShape||e.style.fontSeries||e.style.fontSize);let o=ok(e,"fontSize").map(e=>{var i,a;let o=ok(e,"fontSeries").map(e=>{let i=ok(e,"fontShape").map(e=>{let i=e.map(e=>e._serialize(r)),{fontShape:a}=e[0].style,o="";return"it"===a&&(o="\\textit"),"sl"===a&&(o="\\textsl"),"sc"===a&&(o="\\textsc"),"n"===a&&(o="\\textup"),!o&&a?`{${og("\\fontshape",a)}${of(i)}}`:o?og(o,of(i)):of(i)}),{fontSeries:a}=e[0].style,o="";return"b"===a&&(o="\\textbf"),"l"===a&&(o="\\textlf"),"m"===a&&(o="\\textmd"),a&&!o?`{${og("\\fontseries",a)}${of(i)}}`:o?og(o,of(i)):of(i)}),n=null!=(a=["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][null!=(i=e[0].style.fontSize)?i:""])?a:"";return n?`${n} ${of(o)}`:of(o)}),{fontFamily:n}=e[0].style,l=null!=(i=({roman:"textrm",monospace:"texttt","sans-serif":"textsf"})[null!=n?n:""])?i:"";return l?`\\${l}{${of(o)}}`:n?`{\\fontfamily{${e[0].style.fontFamily}} ${of(o)}}`:a?`\\text{${of(o)}}`:of(o)})}getFont(e,i){var r,a,o,n,l;let{fontFamily:s}=i;if(l2[s]?e.classes+=" "+l2[s]:s&&e.setStyle("font-family",s),i.fontShape&&(e.classes+=" ",e.classes+=null!=(r=({it:"ML__it",sl:"ML__shape_sl",sc:"ML__shape_sc",ol:"ML__shape_ol"})[i.fontShape])?r:""),i.fontSeries){let r=i.fontSeries.match(/(.?[lbm])?(.?[cx])?/);r&&(e.classes+=" ",e.classes+=null!=(o=({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"})[null!=(a=r[1])?a:""])?o:"",e.classes+=" ",e.classes+=null!=(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"})[null!=(n=r[2])?n:""])?l:"")}return"Main-Regular"}},new class extends ov{constructor(){super("latex")}createAtom(e){return new lx(e)}serialize(e,i){return e.filter(e=>e instanceof lx&&!e.isSuggestion).map(e=>e.value)}getFont(){return null}};var l5=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 l7(e){return!(e.ctrlKey||e.metaKey||["Dead","Process"].includes(e.key))&&(""===e.code||l5.has(e.code))}function l9(){var e;let i=document.activeElement;for(;null!=(e=null==i?void 0:i.shadowRoot)&&e.activeElement;)i=i.shadowRoot.activeElement;return i}var se=class e{static get scrim(){return e._scrim||(e._scrim=new e),e._scrim}static open(i){e.scrim.open(i)}static close(){e.scrim.close()}static get state(){return e.scrim.state}static get element(){return e.scrim.element}constructor(e){var i,r;this.lightDismiss=null==(i=null==e?void 0:e.lightDismiss)||i,this.translucent=null!=(r=null==e?void 0:e.translucent)&&r,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 i;if("closed"!==this.state)return;this.state="opening",this.onDismiss=null==e?void 0:e.onDismiss,this.savedActiveElement=l9();let{element:r}=this;(null!=(i=null==e?void 0:e.root)?i:document.body).appendChild(r),r.addEventListener("click",this),document.addEventListener("touchmove",this,!1),document.addEventListener("scroll",this,!1);let a=window.innerWidth-document.documentElement.clientWidth;this.savedMarginRight=document.body.style.marginRight,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden";let o=Number.parseFloat(getComputedStyle(document.body).marginRight);document.body.style.marginRight=`${o+a}px`;let n=document.querySelector(".MLK__plate");if(n instanceof HTMLElement){this.savedMlkPaddingRight=n.style.paddingRight;let e=Number.parseFloat(getComputedStyle(n).paddingRight);n.style.paddingRight=`${e+a}px`}null!=e&&e.child&&r.append(e.child),this.state="open"}close(){var e,i,r,a,o;if("open"!==this.state)return void this.element.parentElement;this.state="closing","function"==typeof this.onDismiss&&this.onDismiss(),this.onDismiss=void 0;let{element:n}=this;n.removeEventListener("click",this),document.removeEventListener("touchmove",this,!1),document.removeEventListener("scroll",this,!1),n.remove(),document.body.style.overflow=null!=(e=this.savedOverflow)?e:"",document.body.style.marginRight=null!=(i=this.savedMarginRight)?i:"";let l=document.querySelector(".MLK__plate");l instanceof HTMLElement&&(l.style.paddingRight=null!=(r=this.savedMlkPaddingRight)?r:""),l9()!==this.savedActiveElement&&(null==(o=null==(a=this.savedActiveElement)?void 0:a.focus)||o.call(a)),n.innerHTML="",this.state="closed"}handleEvent(e){this.lightDismiss&&(e.target===this._element&&"click"===e.type?(this.close(),e.preventDefault(),e.stopPropagation()):e.target===document&&("touchmove"===e.type||"scroll"===e.type)&&(this.close(),e.preventDefault(),e.stopPropagation()))}};function st(e){var i;let r;return e&&l7(e)?("Unidentified"===e.key&&e.target&&(r=e.target.value),r=null!=(i=null!=r?r:e.key)?i:e.code,/^(Dead|Return|Enter|Tab|Escape|Delete|PageUp|PageDown|Home|End|Help|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)$/.test(r)&&(r=""),r):""}function si(e){e=function(e){if(e.code)return e;let i=Object.entries($().mapping),r=!1,a=!1,o="";for(let n=0;n<4;n++){for(let[l,s]of i)if(s[n]===e.key){o=l,3===n?(r=!0,a=!0):2===n?r=!0:1===n&&(a=!0);break}if(o)break}return new KeyboardEvent(e.type,g(f({},e),{altKey:r,shiftKey:a,code:o}))}(e);let i=[];return e.ctrlKey&&i.push("ctrl"),e.metaKey&&i.push("meta"),e.altKey&&i.push("alt"),e.shiftKey&&i.push("shift"),0===i.length?`[${e.code}]`:(i.push(`[${e.code}]`),i.join("+"))}function sr(e){let i=e;return R(i)&&(i=i.length>0?i[0]+"("+i.slice(1).join("")+")":""),i}function sa(e){if(Array.isArray(e)){let i=[...e];return i.shift()+"("+i.map(e=>"string"==typeof e?`"${e}"`:e.toString()).join(", ")+")"}return e}function so(e){return e.atoms.find(e=>"latexgroup"===e.type)}function sn(e){var i,r;let a=so(e);return null!=(r=null==(i=null==a?void 0:a.body)?void 0:i.filter(e=>"latex"===e.type))?r:[]}function sl(e,i){var r;let a=0,o=!1,n=Number.isFinite(null==i?void 0:i.before)?null!=(r=null==i?void 0:i.before)?r:0:e.lastOffset;for(;a<=n&&!o;){let i=e.at(a);(o=i instanceof lx&&i.isSuggestion)||a++}if(!o)return[void 0,void 0];let l=a,s=!1;for(;l<=n&&!s;){let i=e.at(l);(s=!(i instanceof lx&&i.isSuggestion))||l++}return[a-1,l-1]}function ss(e,i){var r,a,o,n,l,s,c,d,u,h;let p={};if("string"==typeof i.color){let n=null!=(a=e.colorMap(null!=(r=i.color)?r:i.verbatimColor))?a:"none";n!==i.color&&(p.verbatimColor=null!=(o=i.verbatimColor)?o:i.color),p.color=n}if("string"==typeof i.backgroundColor){let r=null!=(l=e.backgroundColorMap(null!=(n=i.backgroundColor)?n:i.verbatimBackgroundColor))?l:"none";r!==i.backgroundColor&&(p.verbatimBackgroundColor=null!=(s=i.verbatimBackgroundColor)?s:i.backgroundColor),p.backgroundColor=r}"string"==typeof i.fontFamily&&(p.fontFamily=i.fontFamily),"string"==typeof i.series&&(p.fontSeries=i.series),"string"==typeof i.fontSeries&&(p.fontSeries=i.fontSeries.toLowerCase()),p.fontSeries&&(p.fontSeries=null!=(c=({bold:"b",medium:"m",normal:"m"})[p.fontSeries])?c:p.fontSeries),"string"==typeof i.shape&&(p.fontShape=i.shape),"string"==typeof i.fontShape&&(p.fontShape=i.fontShape.toLowerCase()),p.fontShape&&(p.fontShape=null!=(d=({italic:"it",up:"n",upright:"n",normal:"n"})[p.fontShape])?d:p.fontShape),i.variant&&(p.variant=i.variant.toLowerCase()),void 0!==i.variantStyle&&(p.variantStyle="string"==typeof i.variantStyle&&""!==i.variantStyle?i.variantStyle.toLowerCase():i.variantStyle);let m=null!=(u=i.size)?u:i.fontSize;return"number"==typeof m?p.fontSize=Math.max(1,Math.min(10,m)):"string"==typeof m&&(p.fontSize=null!=(h=({size1:1,size2:2,size3:3,size4:4,size5:5,size6:6,size7:7,size8:8,size9:9,size10:10})[m.toLowerCase()])?h:({tiny:1,scriptsize:2,footnotesize:3,small:4,normal:5,normalsize:5,large:6,Large:7,LARGE:8,huge:9,Huge:10})[m]),p}function sc(e,i,r){var a,o;let n=e.model;if("latex"===n.mode)return{};let l=e.styleBias;if("none"===l)return e.defaultStyle;if("text"===n.mode)return null!=(o=null==(a=n.at("right"===l?r.after:r.before))?void 0:a.style)?o:e.defaultStyle;if("math"===n.mode){let i=n.at("right"===l?r.after:r.before);return f(i?g(f({},i.style),{variant:"normal"}):{variant:"normal"},e.defaultStyle)}return{}}function sd(e){let i=e.options.onInsertStyle;if(null===i)return{};void 0===i&&(i=sc);let r=e.model,a=e.styleBias,o=r.at(r.position),n=su(r,o,a),l=su(r,o.rightSibling,a);return i(e,r.position,{before:n,after:l})}function su(e,i,r){var a;return i&&("first"!==i.type||"right"===r)?"group"!==i.type?e.offsetOf(i):!i.body||i.body.length<2?-1:(null==(a=i.body)?void 0:a.length)===1||"right"!==r?e.offsetOf(i.body[0]):e.offsetOf(i.body[i.body.length-1]):-1}function sh(e){let i=sn(e.model).filter(e=>e.isSuggestion);if(0!==i.length)for(let r of(e.model.position=e.model.offsetOf(i[0].leftSibling),i))r.parent.removeChild(r)}function sp(e,i){var r,a;let{model:o}=e;for(let i of(sh(e),sn(o)))i.isError=!1;if(!o.selectionIsCollapsed||"off"===e.options.popoverPolicy)return void sM(e);let n=[],l=o.at(o.position);for(;l&&l instanceof lx&&/^[a-zA-Z\*]$/.test(l.value);)l=l.leftSibling;let s="",c=!1;if(l&&l instanceof lx&&"\\"===l.value){for(c=!0,n.push(l),l=l.rightSibling;l&&l instanceof lx&&/^[a-zA-Z\*]$/.test(l.value);)n.push(l),l=l.rightSibling;s=n.map(e=>e.value).join("")}else{let e=[],i=null!=(r=o.at(o.position-1))?r:o.at(o.position);for(;i&&i instanceof lx&&/^[a-zA-Z]$/.test(i.value);)e.unshift(i),i=i.leftSibling;e.length>=1&&!(i&&i instanceof lx&&"\\"===i.value)&&(s="\\"+e.map(e=>e.value).join(""),n.push(...e))}let d=function(e,i){var r,a;if(0===i.length||"\\"===i||!i.startsWith("\\"))return[];let o=[],n=i.substring(1).toLowerCase();for(let[e,i]of Object.entries(em))if(e.startsWith(n))for(let e of i){let i=e.startsWith("\\")?e:"\\"+e;o.push({match:i,frequency:1e4})}for(let e in en)e.startsWith(i)&&!en[e].infix&&o.push({match:e,frequency:null!=(r=en[e].frequency)?r:0});for(let e in ea)e.startsWith(i)&&o.push({match:e,frequency:null!=(a=ea[e].frequency)?a:0});let l=i.substring(1);for(let i of Object.keys(e.options.macros))i.startsWith(l)&&o.push({match:"\\"+i,frequency:0});for(let[e,r]of Object.entries({alpha:["\\alpha","\\Alpha"],beta:["\\beta","\\Beta"],gamma:["\\gamma","\\Gamma"],delta:["\\delta","\\Delta"],epsilon:["\\epsilon","\\varepsilon","\\Epsilon"],theta:["\\theta","\\vartheta","\\Theta"],pi:["\\pi","\\varpi","\\Pi"],rho:["\\rho","\\varrho","\\Rho"],sigma:["\\sigma","\\varsigma","\\Sigma"],phi:["\\phi","\\varphi","\\Phi"],psi:["\\psi","\\Psi"],omega:["\\omega","\\Omega"]}))if(("\\"+e).startsWith(i))for(let e of r)o.some(i=>i.match===e)||o.push({match:e,frequency:5e3});let s=new Set,c=o.filter(e=>!s.has(e.match)&&(s.add(e.match),!0)),d=["\\alpha","\\beta","\\gamma","\\delta","\\epsilon","\\zeta","\\eta","\\theta","\\iota","\\kappa","\\lambda","\\mu","\\nu","\\xi","\\omicron","\\pi","\\rho","\\sigma","\\tau","\\upsilon","\\phi","\\chi","\\psi","\\omega","\\Gamma","\\Delta","\\Theta","\\Lambda","\\Xi","\\Pi","\\Sigma","\\Upsilon","\\Phi","\\Psi","\\Omega","\\varepsilon","\\vartheta","\\varpi","\\varrho","\\varsigma","\\varphi"];return c.sort((e,i)=>{var r,a;let o=d.includes(e.match),n=d.includes(i.match);return o&&!n?-1:!o&&n?1:e.frequency===i.frequency?e.match.length===i.match.length?e.match<i.match?-1:1:e.match.length-i.match.length:(null!=(r=i.frequency)?r:0)-(null!=(a=e.frequency)?a:0)}),c.map(e=>e.match)}(e,s);if(0===d.length){if(c&&/^\\[a-zA-Z\*]+$/.test(s))for(let e of n)e.isError=!0;sM(e);return}let u=null!=(a=null==i?void 0:i.atIndex)?a:0;e.suggestionIndex=u<0?d.length-1:u%d.length,d[e.suggestionIndex],function(e,i){var r,a,o,n,l,s;let c;if(0===i.length)return sM(e);let d=document.getElementById("mathlive-suggestion-popover"),u=null==d?void 0:d.classList.contains("is-visible"),h=sv.length!==i.length||sv.some((e,r)=>e!==i[r]);if(u&&!h){let i;o=d,n=e.suggestionIndex,(i=o.querySelectorAll("li")).forEach(e=>{e.classList.remove("ML__popover__current")}),n>=0&&n<i.length&&i[n].classList.add("ML__popover__current"),null==(r=d.querySelector(".ML__popover__current"))||r.scrollIntoView({block:"nearest",inline:"nearest"});return}sv=[...i];let p=["\\text","\\textbf","\\textit","\\textrm","\\textsf","\\texttt","\\textmd","\\textup","\\textnormal","\\textsl","\\textsc","\\mathbf","\\mathit","\\mathrm","\\mathsf","\\mathtt","\\mathbb","\\mathcal","\\mathscr","\\mathfrak","\\mathnormal","\\mathbfit","\\Bbb","\\frak","\\bf","\\it","\\rm","\\sf","\\tt","\\rmfamily","\\sffamily","\\ttfamily","\\bfseries","\\mdseries","\\upshape","\\slshape","\\scshape","\\boldsymbol","\\bm","\\bold","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge","\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle","\\color","\\textcolor","\\colorbox","\\fcolorbox","\\boxed","\\em","\\emph","\\the"],m=[],f=[],g=[];for(let r of i){let i=r;if(p.some(e=>i.startsWith(e)))continue;let a=function(e,i){let r=new oW({from:e.context});return oz(oA(lD(new oE(new oG({mode:"math",type:"root",body:ll(i,{context:r})}).render(r),{classes:"ML__base"}),r)),{classes:"ML__latex"}).toMarkup()}(e,r),o=(function(e,i){let r=[];if("string"==typeof i){let e=nn[i];R(e)?r=e.slice():e&&r.push(e)}let a=RegExp("^"+sr(i).replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");for(let i of e)a.test(sr(i.command))&&r.push(i.key);return r.map(l3)})(e.keybindings,i).join("<br>"),n={command:i,markup:a,keybinding:o},l=["\\alpha","\\beta","\\gamma","\\delta","\\epsilon","\\zeta","\\eta","\\theta","\\iota","\\kappa","\\lambda","\\mu","\\nu","\\xi","\\omicron","\\pi","\\rho","\\sigma","\\tau","\\upsilon","\\phi","\\chi","\\psi","\\omega","\\Gamma","\\Delta","\\Theta","\\Lambda","\\Xi","\\Pi","\\Sigma","\\Upsilon","\\Phi","\\Psi","\\Omega","\\varepsilon","\\vartheta","\\varpi","\\varrho","\\varsigma","\\varphi"];i.startsWith("\\mathbb")||i.startsWith("\\mathcal")||2===i.length||l.some(e=>i===e||i.startsWith(e+" "))?g.push(n):i.length>3&&!i.includes("{")?m.push(n):g.push(n)}let b=[],y=(i,r,a=!1)=>{let o=r===e.suggestionIndex?"ML__popover__current":"",n=r<9?`\u2318${r+1}`:"",l=`<li role="button" data-command="${sy(i.command)}" class="${o} ${a?"ML__popover__item--grid":"ML__popover__item--list"}" tabindex="0">`;return a?(l+=`<span class="ML__popover__command">${i.markup}</span>`,n&&(l+=`<span class="ML__popover__shortcut">${n}</span>`)):(l+=`<span class="ML__popover__icon">${i.markup}</span><div class="ML__popover__label-group"><span class="ML__popover__latex">${sy(i.command)}</span><span class="ML__popover__type">Function</span></div>`,n?l+=`<span class="ML__popover__shortcut">${n}</span>`:i.keybinding&&(l+=`<span class="ML__popover__keybinding">${i.keybinding}</span>`)),l+="</li>"},v=0;if(g.length>0){for(let e of(b.push('<div class="ML__popover__section-title">Symbols</div>'),b.push('<ul class="ML__popover__grid">'),g))b.push(y(e,v++,!0));b.push("</ul>")}if(m.length>0){for(let e of(b.push('<div class="ML__popover__section-title">Variable or Function</div>'),b.push("<ul>"),m))b.push(y(e,v++,!1));b.push("</ul>")}if(f.length>0){for(let e of(b.push('<div class="ML__popover__section-title">Constant</div>'),b.push("<ul>"),f))b.push(y(e,v++,!1));b.push("</ul>")}let x=(l=e,s=`<div class="ML__popover__container">${b.join("")}</div>`,(c=document.getElementById("mathlive-suggestion-popover"))?sb("mathlive-suggestion-popover"):(nA("suggestion-popover"),nA("core")),(c=sg("mathlive-suggestion-popover")).addEventListener("pointerdown",e=>e.preventDefault()),c.addEventListener("click",e=>{let i=e.target;for(;i&&!i.dataset.command;)i=i.parentElement;i&&(sf(l,"reject"),na.insert(l.model,i.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),l.dirty=!0,l.focus())}),c.innerHTML=globalThis.MathfieldElement.createHTML(s),c);sw()&&(null==(a=x.querySelector(".ML__popover__current"))||a.scrollIntoView({block:"nearest",inline:"nearest"}),s_(e)),setTimeout(()=>{var i;x&&!sw()&&(x.classList.add("is-visible"),sk(e),null==(i=x.querySelector(".ML__popover__current"))||i.scrollIntoView({block:"nearest",inline:"nearest"}),s_(e))},32)}(e,d)}function sm(e){let[i,r]=sl(e,{before:e.position});if(void 0===i||void 0===r)return!1;let a=!1;return e.getAtoms([i,r]).forEach(e=>{e.isSuggestion&&(e.isSuggestion=!1,a=!0)}),a}function sf(e,i="accept",r){var a,o;sM(e);let n=so(e.model);if(!n)return!1;if("accept-suggestion"===i||"accept-all"===i){let r=sn(e.model).filter(e=>e.isSuggestion);if(0!==r.length){for(let e of r)e.isSuggestion=!1;e.model.position=e.model.offsetOf(r[r.length-1])}if("accept-suggestion"===i)return 0!==r.length}let l=sn(e.model).filter(e=>!e.isSuggestion).map(e=>e.value).join(""),s=n.leftSibling;if(n.parent.removeChild(n),e.model.position=e.model.offsetOf(s),e.switchMode(null!=(a=null==r?void 0:r.mode)?a:"math"),"reject"===i)return!0;let c=f({},sd(e));return/^[a-zA-Z0-9]$/.test(l)||"none"===e.styleBias||(c.variant="normal",c.variantStyle=void 0),na.insert(e.model,l,{selectionMode:null!=(o=null==r?void 0:r.selectItem)&&o?"item":"placeholder",format:"latex",mode:"math",style:c}),e.snapshot(),e.model.announce("replacement"),e.switchMode("math"),!0}function sg(e){var i;let r=document.getElementById(e);return r?r.dataset.refcount=Number(Number.parseInt(null!=(i=r.dataset.refcount)?i:"0")+1).toString():((r=document.createElement("div")).setAttribute("aria-hidden","true"),r.dataset.refcount="1",r.id=e,(function(){let e=nS;if(e){let i=document.querySelector(e);if(i)return i}return document.body})().append(r)),r}function sb(e){var i;let r=document.getElementById(e);if(!r)return;let a=Number.parseInt(null!=(i=r.getAttribute("data-refcount"))?i:"0");a<=1?r.remove():r.dataset.refcount=Number(a-1).toString()}function sy(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}new class extends na{constructor(){super("latex")}createAtom(e){return new lx(e)}onPaste(e,i){if(!i)return!1;let r="string"==typeof i?i:i.getData("application/x-latex")||i.getData("text/plain");return!!(r&&e.model.contentWillChange({inputType:"insertFromPaste",data:r}))&&(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r)&&(e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),sB(e)),e.startRecording(),!0)}insert(e,i,r){if(!e.contentWillChange({data:i,inputType:"insertText"}))return!1;r||(r={}),r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder");let{silenceNotifications:a}=e;r.silenceNotifications&&(e.silenceNotifications=!0);let o=e.silenceNotifications;e.silenceNotifications=!0,"replaceSelection"!==r.insertionMode||e.selectionIsCollapsed?"replaceAll"===r.insertionMode?(e.root.setChildren([],"body"),e.position=0):"insertBefore"===r.insertionMode?e.collapseSelection("backward"):"insertAfter"===r.insertionMode&&e.collapseSelection("forward"):e.deleteAtoms(oQ(e.selection));let n=[];for(let e of i)ed.test(e)&&n.push(new lx(e));let l=e.at(e.position);if(l instanceof l_&&(l=l.lastChild),!(l.parent instanceof l_)){let e=new l_;l.parent.addChildAfter(e,l),l=e.firstChild}let s=l.parent.addChildrenAfter(n,l);return e.silenceNotifications=o,"before"===r.selectionMode||("item"===r.selectionMode?e.setSelection(e.anchor,e.offsetOf(s)):s&&(e.position=e.offsetOf(s))),e.contentDidChange({data:i,inputType:"insertText"}),e.silenceNotifications=a,!0}},sN({applyStyle:function(e,i){e.flushInlineShortcutBuffer(),e.stopCoalescingUndo();let r=ss(e,i),{model:a}=e;return a.selectionIsCollapsed?(e.defaultStyle.fontSeries&&r.fontSeries===e.defaultStyle.fontSeries&&(r.fontSeries="auto"),r.fontShape&&r.fontShape===e.defaultStyle.fontShape&&(r.fontShape="auto"),r.color&&r.color===e.defaultStyle.color&&(r.color="none"),r.backgroundColor&&r.backgroundColor===e.defaultStyle.backgroundColor&&(r.backgroundColor="none"),r.fontSize&&r.fontSize===e.defaultStyle.fontSize&&(r.fontSize="auto"),e.defaultStyle=f(f({},e.defaultStyle),r)):e.model.deferNotifications({content:!0,type:"insertText"},()=>{a.selection.ranges.forEach(e=>lN(a,e,r,{operation:"toggle"})),e.snapshot("style-change")}),!0}},{target:"mathfield",canUndo:!0,changeContent:!0});var sv=[],sx=null;function s_(e){sx||(sx=i=>{if(sw()){if("Enter"===i.key||"Return"===i.key){let r=document.getElementById("mathlive-suggestion-popover");if(!r)return;let a=r.querySelectorAll("li");if(e.suggestionIndex<a.length){i.preventDefault(),i.stopPropagation();let r=a[e.suggestionIndex];sf(e,"reject"),na.insert(e.model,r.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),e.dirty=!0,e.focus()}return}if((i.metaKey||i.ctrlKey)&&i.key>="1"&&i.key<="9"){let r=parseInt(i.key)-1,a=document.getElementById("mathlive-suggestion-popover");if(!a)return;let o=a.querySelectorAll("li");if(r<o.length){i.preventDefault(),i.stopPropagation();let a=o[r];sf(e,"reject"),na.insert(e.model,a.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),e.dirty=!0,e.focus()}}}},document.addEventListener("keydown",sx,{capture:!0}))}function sw(){let e=document.getElementById("mathlive-suggestion-popover");return!!e&&e.classList.contains("is-visible")}function sk(e,i){var r,a,o;if(!e.element||e.element.mathfield!==e||!sw())return;if((null==(r=e.model.at(e.model.position))?void 0:r.type)!=="latex")return void sM(e);if(null!=i&&i.deferred)return void setTimeout(()=>sk(e),32);let n=ns(e.field);if(!n)return;let l=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,c=window.innerWidth-document.documentElement.clientWidth,d=window.innerHeight-document.documentElement.clientHeight,u=null!=(o=null==(a=window.mathVirtualKeyboard)?void 0:a.boundingRect.height)?o:0,h=document.getElementById("mathlive-suggestion-popover");n.x+h.offsetWidth/2>s-c?h.style.left=`${s-h.offsetWidth-c}px`:n.x-h.offsetWidth/2<0?h.style.left="0":h.style.left=`${n.x-h.offsetWidth/2}px`;let p=n.y-n.height;l-d-u-n.y<p?(h.classList.add("ML__popover--reverse-direction"),h.classList.remove("top-tip"),h.classList.add("bottom-tip"),h.style.top=`${n.y-n.height-h.offsetHeight-15}px`):(h.classList.remove("ML__popover--reverse-direction"),h.classList.add("top-tip"),h.classList.remove("bottom-tip"),h.style.top=`${n.y+15}px`)}function sM(e){e.suggestionIndex=0,sv=[],document.getElementById("mathlive-suggestion-popover")&&sb("mathlive-suggestion-popover"),sx&&(document.removeEventListener("keydown",sx,{capture:!0}),sx=null)}var sS,sL,sC,sE=null,sA=(null==(sC=null==(sL=null==globalThis?void 0:globalThis.document)?void 0:sL.currentScript)?void 0:sC.src)||function(){let e=String(Error().stack).replace(/^Error.*\n/,"").split(`
3229
+ `);if(0===e.length)return console.error(`Can't use relative paths to specify assets location because the sourcefile location could not be determined (unexpected stack trace format "${Error().stack}").`),"";let i=e[1],r=i.match(/http.*\.ts[\?:]/);return r&&(i=e[2]),(r=i.match(/(https?:.*):[0-9]+:[0-9]+/))||(r=i.match(/at (.*(\.ts))[\?:]/))||(r=i.match(/at (.*(\.mjs|\.js))[\?:]/)),r?r[1]:(console.error(e),console.error(`Can't use relative paths to specify assets location because the source file location could not be determined (unexpected location "${i}").`),"")}();async function sz(e){if(/^(?:[a-z+]+:)?\/\//i.test(e)){try{return new URL(e).href}catch(e){}if(e.startsWith("//"))try{return new URL(`${window.location.protocol}${e}`).href}catch(e){}return e}if(null===sE)try{let e=await fetch(sA,{method:"HEAD"});200===e.status&&(sE=(sE=e.url).replace(/\/\+esm$/,"/")).includes("jsdelivr.net/")&&(sE+="/")}catch(i){console.error(`Invalid URL "${e}" (relative to "${sA}")`)}return new URL(e,null!=sE?sE:sA).href}var sT="not-loaded";async function sD(){return sT="not-loaded",sK()}async function sK(){var e;if("not-loaded"===sT){if(sT="loading",null!=(e=getComputedStyle(document.documentElement).getPropertyValue("--ML__static-fonts"))&&e){sT="ready";return}if(document.body.classList.remove("ML__fonts-did-not-load"),"fonts"in document){let e=Array.from(document.fonts).map(e=>e.family);if(["KaTeX_Main","KaTeX_Math","KaTeX_AMS","KaTeX_Caligraphic","KaTeX_Fraktur","KaTeX_SansSerif","KaTeX_Script","KaTeX_Typewriter","KaTeX_Size1","KaTeX_Size2","KaTeX_Size3","KaTeX_Size4"].every(i=>e.includes(i))){sT="ready";return}if(!globalThis.MathfieldElement.fontsDirectory){sT="not-loaded";return}let i=await sz(globalThis.MathfieldElement.fontsDirectory);if(!i){document.body.classList.add("ML__fonts-did-not-load"),sT="error";return}i.endsWith("/")&&(i=i.slice(0,-1));let r=[["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(e=>(function(e,i,r={}){return new FontFace(e,`url(${i}.woff2) format('woff2')`,r)})(e[0].replace(/-[a-zA-Z]+$/,""),`${i}/${e[0]}`,e[1]));try{(await Promise.all(r.map(e=>{try{return e.load()}catch(e){}}))).forEach(e=>document.fonts.add(e)),sT="ready";return}catch(e){console.error(`MathLive 0.110.8: The math fonts could not be loaded from "${i}"`,{cause:e}),document.body.classList.add("ML__fonts-did-not-load")}sT="error"}}}function sB(e,i){e&&!e.dirty&&e.field&&(e.resizeObserver.unobserve(e.field),e.dirty=!0,requestAnimationFrame(()=>{nl(e)&&e.dirty&&(e.atomBoundsCache=new Map,sP(e,i),e.resizeObserver.observe(e.field),e.resizeObserverStarted=!0)}))}function s$(e,i){try{var r,a;let o,{model:n}=e;for(let e of(n.root.caret=void 0,n.root.isSelected=!1,n.root.containsCaret=!0,n.atoms))e.caret=void 0,e.isSelected=!1,e.containsCaret=!1;if(n.selectionIsCollapsed){let i=n.at(n.position);i.caret=e.model.mode;let r=i.parent;for(;r;)r.containsCaret=!0,r=r.parent}else for(let e of n.getAtoms(n.selection,{includeChildren:!0,includeFirstAtoms:!0}))e.isSelected=!0;return(r=i,r=null!=r?r:{},o=new oW({from:g(f({},e.context),{atomIdsSettings:{seed:r.forHighlighting?function(e,i=0){let r=0xdeadbeef^i,a=0x41c6ce57^i;for(let i=0;i<e.length;i++){let o=e.charCodeAt(i);r=Math.imul(r^o,0x9e3779b1),a=Math.imul(a^o,0x5f356495)}return r=Math.imul(r^r>>>16,0x85ebca6b)^Math.imul(a^a>>>13,0xc2b2ae35),0x100000000*(2097151&(a=Math.imul(a^a>>>16,0x85ebca6b)^Math.imul(r^r>>>13,0xc2b2ae35)))+(r>>>0)}(oG.serialize([e.model.root],{expandMacro:!1,defaultMode:e.options.defaultMode})):"random",groupNumbers:null!=(a=r.forHighlighting)&&a},letterShapeStyle:e.options.letterShapeStyle}),mathstyle:"inline-math"===e.options.defaultMode?"textstyle":"displaystyle"}),oz(lD(e.model.root.render(o),o),{classes:e.hasEditablePrompts?"ML__latex ML__prompting":"ML__latex",attributes:{translate:"no","aria-hidden":"true"}})).toMarkup()}catch(e){return console.error(e),'<span class="ML__latex" translate="no" aria-hidden="true">🚫</span>'}}function sP(e,i){if(!nl(e))return;null!=i||(i={});let r=e.element.querySelector("[part=virtual-keyboard-toggle]");r&&(r.style.display=e.hasEditableContent?"":"none");let a=e.field;if(!a)return;let o=e.isSelectionEditable&&e.hasFocus(),n=a.classList.contains("ML__focused");n&&!o?a.classList.remove("ML__focused"):!n&&o&&a.classList.add("ML__focused");let l=s$(e,i),s=e.element.querySelector("[part=menu-toggle]");if(s){let i=!1;(e.disabled||e.readOnly&&!e.hasEditableContent||"none"===e.userSelect)&&(i=!0),!i&&e.element.offsetWidth<50&&(i=!0),s.style.display=i?"none":""}if(e.model.atoms.length<=1){let i=e.options.contentPlaceholder;i&&(l+=`<span part=placeholder class="ML__content-placeholder">${dH(i)}</span>`)}a.innerHTML=globalThis.MathfieldElement.createHTML(l),sO(e,i.interactive),e.updateToggleLayout(),e.dirty=!1}function sO(e,i){var r;let a=e.field;if(!a)return;for(let e of a.querySelectorAll(".ML__selection, .ML__contains-highlight"))e.remove();if(!(null!=i&&i)&&"error"!==sT&&"ready"!==sT)return void setTimeout(()=>{"ready"===sT?sO(e):setTimeout(()=>sO(e),128)},32);let o=e.model;null==(r=e.atomBoundsCache)||r.clear();let n,l=()=>{if(void 0!==n)return n;let e=a.offsetWidth;return isNaN(n=Math.floor(a.getBoundingClientRect().width)/e)&&(n=1),n};if(o.selectionIsCollapsed){sk(e,{deferred:!0});let i=o.at(o.position);for(;i&&"prompt"!==i.type&&!(i.containsCaret&&i.displayContainsHighlight);)i=i.parent;if(null!=i&&i.containsCaret&&i.displayContainsHighlight){let r=l(),o=nc(e,nu(e,i),r);if(o){o.left/=r,o.right/=r,o.top/=r,o.bottom/=r;let e=document.createElement("div");e.classList.add("ML__contains-highlight"),e.style.position="absolute",e.style.left=`${o.left+1}px`,e.style.top=`${Math.ceil(o.top)}px`,e.style.width=`${Math.ceil(o.right-o.left)}px`,e.style.height=`${Math.ceil(o.bottom-o.top)}px`,a.insertBefore(e,a.childNodes[0])}}return}let s=l();for(let i of function(e){let i=[];for(let r of e){let e=!1;for(let a of i)if(r.left===a.left&&r.right===a.right&&r.top===a.top&&r.bottom===a.bottom){e=!0;break}e||i.push(r)}for(let r of(e=i,i=[],e)){let a=0;for(let i of e)if(r.left>=i.left&&r.right<=i.right&&r.top>=i.top&&r.bottom<=i.bottom&&(a+=1)>1)break;1===a&&i.push(r)}return i}(nh(e,{excludeAtomsWithBackground:!0}))){i.left/=s,i.right/=s,i.top/=s,i.bottom/=s;let e=document.createElement("div");e.classList.add("ML__selection"),e.style.position="absolute",e.style.left=`${i.left}px`,e.style.top=`${i.top}px`,e.style.width=`${Math.ceil(i.right-i.left)}px`,e.style.height=`${Math.max(1,Math.ceil(i.bottom-i.top-1))}px`,a.insertBefore(e,a.childNodes[0])}}function sR(e){if(!e)return;let i=e.model,r=i.selection,a=oG.serialize([i.root],{expandMacro:!1,defaultMode:e.options.defaultMode});na.insert(i,a,{insertionMode:"replaceAll",selectionMode:"after",format:"latex",silenceNotifications:!0,mode:"math"});let o=i.silenceNotifications;i.silenceNotifications=!0,i.selection=r,i.silenceNotifications=o,sB(e)}function sI(){for(let e of document.querySelectorAll(".ML__mathfield"))"_mathfield"in e&&sR(e._mathfield)}function sN(e,i){for(let r of(i=f({target:"mathfield",canUndo:!1,audioFeedback:void 0,changeContent:!1,changeSelection:!1},null!=i?i:{}),sW||(sW={}),Object.keys(e)))sW[r],sW[r]=g(f({},i),{fn:e[r]})}function sq(e){let i;if(Array.isArray(e)){if("performWithFeedback"===e[0])return sq(e[1]);i=e[0]}else i=e;return sW[i]}function sF(e){var i;return null==(i=sq(e))?void 0:i.target}function sV(e){if(!e)return;if(R(e)&&e.length>0){let i=e[0];return"performWithFeedback"===(i=i.replace(/-\w/g,e=>e[1].toUpperCase()))&&2===e.length?[i,sV(e[1])]:[i,...e.slice(1)]}if("string"!=typeof e)return;let i=e.trim().match(/^([a-zA-Z0-9-]+)\((.*)\)$/);return i?[i[1].replace(/-\w/g,e=>e[1].toUpperCase()),...i[2].split(",").map(e=>e.trim()).map(e=>{if(/"[^"]*"/.test(e)||/'[^']*'/.test(e))return e.slice(1,-1);if(/^true$/.test(e))return!0;if(/^false$/.test(e))return!1;if(/^[-]?\d+$/.test(e))return parseInt(e,10);if(/^\{.*\}$/.test(e))try{return JSON.parse(e)}catch(i){return console.error("Invalid argument:",e),e}return sV(e)})]:e.replace(/-\w/g,e=>e[1].toUpperCase())}sN({performWithFeedback:(e,i)=>(function(e,i){var r;if(!e)return!1;e.focus(),uO.keypressVibration&&_()&&navigator.vibrate(3);let a=sq(i);globalThis.MathfieldElement.playSound(null!=(r=null==a?void 0:a.audioFeedback)?r:"keypress");let o=e.executeCommand(i);return e.scrollIntoView(),o})(e,i)}),sN({complete:sf},{target:"mathfield",audioFeedback:"return",canUndo:!0,changeContent:!0,changeSelection:!0}),sN({dispatchEvent:(e,i,r)=>{var a,o;return null!=(o=null==(a=e.host)?void 0:a.dispatchEvent(new CustomEvent(i,{detail:r})))&&o}},{target:"mathfield"}),sN({nextSuggestion:function(e){return sp(e,{atIndex:e.suggestionIndex+1}),!1},previousSuggestion:function(e){return sp(e,{atIndex:e.suggestionIndex-1}),!1}},{target:"mathfield",audioFeedback:"keypress",changeSelection:!0});var sj="mathlive#virtual-keyboard-message";function sH(e){var i;return"message"===e.type&&(null==(i=e.data)?void 0:i.type)===sj}var sW,sU,sJ=class e{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 e),this._singleton}getKeycap(e){}setKeycap(e,i){this.sendMessage("update-setting",{setKeycap:{keycap:e,value:i}})}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 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,i,r){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].has(i)||this.listeners[e].add(i)}dispatchEvent(e){return!this.listeners[e.type]||0===this.listeners[e.type].size||(this.listeners[e.type].forEach(i=>{"function"==typeof i?i(e):null==i||i.handleEvent(e)}),!e.defaultPrevented)}removeEventListener(e,i,r){this.listeners[e]&&this.listeners[e].delete(i)}handleEvent(e){if(sH(e)){if(!np(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:i}=e;if("execute-command"===i){let{command:i}=e;"virtual-keyboard"===sF(i)&&this.executeCommand(i);return}if("synchronize-proxy"===i){this._boundingRect=e.boundingRect,this._isShifted=e.isShifted;return}if("geometry-changed"===i){this._boundingRect=e.boundingRect,this.dispatchEvent(new Event("geometrychange"));return}}sendMessage(e,i={}){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(f({type:sj,action:e},i),this.targetOrigin)}},sX={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:"≤"}},{label:">",latex:">",class:"hide-shift",shift:{latex:"\\ge",label:"≥"}},"[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:"[return]",width:1}]]},greek:{label:"&alpha;&beta;&gamma;",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.greek",rows:[[{label:"<i>&#x03c6;</i>",class:"MLK__tex hide-shift",insert:"\\varphi",aside:"phi var.",shift:"\\Phi"},{label:"<i>&#x03c2;</i>",class:"MLK__tex hide-shift",insert:"\\varsigma",aside:"sigma var.",shift:"\\Sigma"},{label:"<i>&#x03f5;</i>",class:"MLK__tex hide-shift",insert:"\\epsilon",aside:"epsilon",shift:'\\char"0190'},{label:"<i>&rho;</i>",class:"MLK__tex hide-shift",insert:"\\rho",aside:"rho",shift:'\\char"3A1'},{label:"<i>&tau;</i>",class:"MLK__tex hide-shift",insert:"\\tau",aside:"tau",shift:'\\char"3A4'},{label:"<i>&upsilon;</i>",class:"MLK__tex hide-shift",insert:"\\upsilon",aside:"upsilon",shift:"\\Upsilon"},{label:"<i>&theta;</i>",class:"MLK__tex hide-shift",insert:"\\theta",aside:"theta",shift:"\\Theta"},{label:"<i>&iota;</i>",class:"MLK__tex hide-shift",insert:"\\iota",aside:"iota",shift:'\\char"399'},{label:"<i>&omicron;</i>",class:"MLK__tex hide-shift",insert:"\\omicron",aside:"omicron",shift:'\\char"39F'},{label:"<i>&pi;</i>",class:"MLK__tex hide-shift",insert:"\\pi",aside:"pi",shift:"\\Pi"}],["[separator-5]",{label:"<i>&alpha;</i>",class:"MLK__tex hide-shift",insert:"\\alpha",aside:"alpha",shift:'\\char"391'},{label:"<i>&sigma;</i>",class:"MLK__tex hide-shift",insert:"\\sigma",aside:"sigma",shift:"\\Sigma"},{label:"<i>&delta;</i>",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:"<i>&gamma;</i>",class:"MLK__tex hide-shift",insert:"\\gamma",aside:"gamma",shift:"\\Gamma"},{label:"<i>&eta;</i>",class:"MLK__tex hide-shift",insert:"\\eta",aside:"eta",shift:'\\char"397'},{label:"<i>&xi;</i>",class:"MLK__tex hide-shift",insert:"\\xi",aside:"xi",shift:"\\Xi"},{label:"<i>&kappa;</i>",class:"MLK__tex hide-shift",insert:"\\kappa",aside:"kappa",shift:"\\Kappa"},{label:"<i>&lambda;</i>",class:"MLK__tex hide-shift",insert:"\\lambda",aside:"lambda",shift:"\\Lambda"},"[separator-5]"],["[shift]",{label:"<i>&zeta;</i>",class:"MLK__tex hide-shift",insert:"\\zeta",aside:"zeta",shift:'\\char"396'},{label:"<i>&chi;</i>",class:"MLK__tex hide-shift",insert:"\\chi",aside:"chi",shift:'\\char"3A7'},{label:"<i>&psi;</i>",class:"MLK__tex hide-shift",insert:"\\psi",aside:"psi",shift:"\\Psi"},{label:"<i>&omega;</i>",class:"MLK__tex hide-shift",insert:"\\omega",aside:"omega",shift:"\\Omega"},{label:"<i>&beta;</i>",class:"MLK__tex hide-shift",insert:"\\beta",aside:"beta",shift:'\\char"392'},{label:"<i>&nu;</i>",class:"MLK__tex hide-shift",insert:"\\nu",aside:"nu",shift:'\\char"39D'},{label:"<i>&mu;</i>",class:"MLK__tex hide-shift",insert:"\\mu",aside:"mu",shift:'\\char"39C'},"[backspace]"],["[separator]",{label:"<i>&#x03b5;</i>",class:"MLK__tex",insert:"\\varepsilon",aside:"epsilon var."},{label:"<i>&#x03d1;</i>",class:"MLK__tex",insert:"\\vartheta",aside:"theta var."},{label:"<i>&#x3f0;</i>",class:"MLK__tex",insert:"\\varkappa",aside:"kappa var."},{label:"<i>&#x03d6;</i>",class:"MLK__tex",insert:"\\varpi",aside:"pi var."},{label:"<i>&#x03f1;</i>",class:"MLK__tex",insert:"\\varrho",aside:"rho var."},"[left]","[right]","[return]"]]},symbols:{label:"&infin;≠∈",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:"[return]",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:`
3204
3230
  div.minimalist-backdrop {
3205
3231
  display: flex;
3206
3232
  justify-content: center;
@@ -3216,7 +3242,7 @@ Note there are a different set of tooltip rules for the keyboard toggle
3216
3242
  border: 1px solid var(--keyboard-border);
3217
3243
  box-shadow: 0 0 32px rgb(0 0 0 / 30%);
3218
3244
  }
3219
- `,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]"]]}},sH={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"},"å","à","á","â","ä","æ"],A:[{latex:"\\aleph",aside:"aleph"},{latex:"\\forall",aside:"for all"},"Å","À","Á","Â","Ä","Æ"],b:[{latex:"\\beth",aside:"beth"}],c:[{latex:"\\C",aside:"set of complex numbers"},"ç"],d:[{latex:"\\daleth",aside:"daleth"}],e:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn’t"},"è","é","ê","ë"],E:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn’t"},"È","É","Ê","Ë"],g:[{latex:"\\gimel",aside:"gimel"}],h:[{latex:"\\hbar",aside:"h bar"},{latex:"\\hslash",aside:"h slash"}],i:[{latex:"\\imaginaryI",aside:"imaginary i"},"ì","í","î","ï"],I:[{latex:"\\imaginaryI",aside:"imaginary i"},"Ì","Í","Î","Ï"],j:[{latex:"\\imaginaryJ",aside:"imaginary j"}],l:[{latex:"\\ell",aside:"ell"}],n:[{latex:"\\mathbb{N}",aside:"set of natural numbers"},"ñ"],o:["ø","œ","ò","ó","ô","ö"],O:["ø","Œ","Ò","Ó","Ô","Ö"],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:["ù","ú","û","ü"],U:["Ù","Ú","Û","Ü"],z:[{latex:"\\mathbb{Z}",aside:"set of integers"}],y:["ý","ÿ"],Y:["Ÿ"],space:[{latex:'\\char"203A\\!\\char"2039',insert:"\\!",aside:"negative thin space<br>⁻³⧸₁₈ em"},{latex:'\\char"203A\\,\\char"2039',insert:"\\,",aside:"thin space<br>³⧸₁₈ em"},{latex:'\\char"203A\\:\\char"2039',insert:"\\:",aside:"medium space<br>⁴⧸₁₈ em"},{latex:'\\char"203A\\;\\char"2039',insert:"\\;",aside:"thick space<br>⁵⧸₁₈ em"},{latex:'\\char"203A\\ \\char"2039',insert:"\\ ",aside:"⅓ em"},{latex:'\\char"203A\\enspace\\char"2039',insert:"\\enspace",aside:"½ em"},{latex:'\\char"203A\\quad\\char"2039',insert:"\\quad",aside:"1 em"},{latex:'\\char"203A\\qquad\\char"2039',insert:"\\qquad",aside:"2 em"}]};function sW(e,i){var r,a,o,n,l,s,c;let d=s5.singleton;if(!d)return;let u=s6(e),h="";if(window.mathVirtualKeyboard.isShifted){let e=null==(r=d.getKeycap(null==u?void 0:u.id))?void 0:r.shift;"object"==typeof e&&"variants"in e&&(h=null!=(a=e.variants)?a:"")}else h=null!=(n=null==(o=d.getKeycap(null==u?void 0:u.id))?void 0:o.variants)?n:"";if("string"==typeof h&&!sJ(h)||Array.isArray(h)&&0===h.length){null==i||i();return}let p={},m="";for(let e of"string"!=typeof(s=h)?s:(sH[s]||(sH[s]=null!=(c=function(e){if("foreground-color"===e){let e=[];for(let i of Object.keys(j))e.push({class:"swatch-button",label:'<span style="border: 3px solid '+j[i]+'"></span>',command:["applyStyle",{color:i}]});return e}if("background-color"===e){let e=[];for(let i of Object.keys(V))e.push({class:"swatch-button",label:'<span style="background:'+V[i]+'"></span>',command:["applyStyle",{backgroundColor:i}]});return e}}(s))?c:[]),sH[s])){let i=s1(e),r=Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36);p[r]=i;let[a,o]=sQ(i);m+=`<div id=${r} class="item ${o}">${a}</div>`}let f=document.createElement("div");f.setAttribute("aria-hidden","true"),f.className="MLK__variant-panel",f.style.height="auto";let g=Object.keys(p).length,b=5;1===g?b=1:2===g||4===g?b=2:3===g||5===g||6===g?b=3:g>=7&&g<14&&(b=4),f.style.width=`calc(var(--variant-keycap-length) * ${b} + 12px)`,f.innerHTML=uD.createHTML(m),l3.open({root:null==(l=null==d?void 0:d.container)?void 0:l.querySelector(".ML__keyboard"),child:f});let{signal:y}=sF=new AbortController,v=null==e?void 0:e.getBoundingClientRect();if(v){v.top-f.clientHeight<0&&(f.style.width="auto",g<=6?f.style.height="56px":g<=12?f.style.height="108px":g<=18?f.style.height="205px":f.classList.add("compact"));let e=Math.max(0,Math.min(window.innerWidth-f.offsetWidth,(v.left+v.right-f.offsetWidth)/2)),r=v.top-f.clientHeight+5;f.style.left=`${e}px`,f.style.top=`${r}px`,f.classList.add("is-visible"),requestAnimationFrame(()=>{var e;f.addEventListener("pointerup",e=>{let r=s6(e.target);null!=r&&r.id&&p[r.id]&&(s3(p[r.id]),sU(),null==i||i(),e.preventDefault())},{capture:!0,passive:!1,signal:y}),f.addEventListener("pointerenter",e=>{let i=s6(e.target);null!=i&&i.id&&p[i.id]&&i.classList.add("is-active")},{capture:!0,signal:y}),f.addEventListener("pointerleave",e=>{let i=s6(e.target);e.target&&"tagName"in e.target&&"string"==typeof e.target.tagName&&"ASIDE"===e.target.tagName.toUpperCase()||!(null!=i&&i.id)||!p[i.id]||i.classList.remove("is-active")},{capture:!0,signal:y}),null!=(e=d.getKeycap(null==u?void 0:u.id))&&e.stickyVariantPanel?window.addEventListener("pointerdown",e=>{if(!(e.target instanceof Node))return;let r=f.contains(e.target);e.target===f||r||(sU(),null==i||i())},{signal:y}):(window.addEventListener("pointercancel",()=>{sU(),null==i||i()},{signal:y}),window.addEventListener("pointerup",()=>{sU(),null==i||i()},{signal:y}))})}}function sU(){null==sF||sF.abort(),sF=null,"open"===l3.state&&l3.close()}function sJ(e){return void 0!==sH[e]}function sX(e){if(!e)return"";let i=new oW;return oz(oA(lL(new oE(new oG({mode:"math",type:"root",body:lt(e,{context:i,args:e=>"@"===e?"{\\class{ML__box-placeholder}{\\blacksquare}}":"\\placeholder{}"})}).render(i),{classes:"ML__base"}),i)),{classes:"ML__latex"}).toMarkup()}function sG(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sZ(e){if(Array.isArray(e))return e.map(e=>sZ(e)).flat();let i="string"==typeof e?{markup:e}:e;return"rows"in i&&Array.isArray(i.rows)&&(i.rows=i.rows.map(e=>e.map(e=>s1(e)))),null!=i.id||(i.id="ML__layer_"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36)),[i]}var sY=`<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
3245
+ `,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]"]]}},sG={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"},"å","à","á","â","ä","æ"],A:[{latex:"\\aleph",aside:"aleph"},{latex:"\\forall",aside:"for all"},"Å","À","Á","Â","Ä","Æ"],b:[{latex:"\\beth",aside:"beth"}],c:[{latex:"\\C",aside:"set of complex numbers"},"ç"],d:[{latex:"\\daleth",aside:"daleth"}],e:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn’t"},"è","é","ê","ë"],E:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn’t"},"È","É","Ê","Ë"],g:[{latex:"\\gimel",aside:"gimel"}],h:[{latex:"\\hbar",aside:"h bar"},{latex:"\\hslash",aside:"h slash"}],i:[{latex:"\\imaginaryI",aside:"imaginary i"},"ì","í","î","ï"],I:[{latex:"\\imaginaryI",aside:"imaginary i"},"Ì","Í","Î","Ï"],j:[{latex:"\\imaginaryJ",aside:"imaginary j"}],l:[{latex:"\\ell",aside:"ell"}],n:[{latex:"\\mathbb{N}",aside:"set of natural numbers"},"ñ"],o:["ø","œ","ò","ó","ô","ö"],O:["ø","Œ","Ò","Ó","Ô","Ö"],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:["ù","ú","û","ü"],U:["Ù","Ú","Û","Ü"],z:[{latex:"\\mathbb{Z}",aside:"set of integers"}],y:["ý","ÿ"],Y:["Ÿ"],space:[{latex:'\\char"203A\\!\\char"2039',insert:"\\!",aside:"negative thin space<br>⁻³⧸₁₈ em"},{latex:'\\char"203A\\,\\char"2039',insert:"\\,",aside:"thin space<br>³⧸₁₈ em"},{latex:'\\char"203A\\:\\char"2039',insert:"\\:",aside:"medium space<br>⁴⧸₁₈ em"},{latex:'\\char"203A\\;\\char"2039',insert:"\\;",aside:"thick space<br>⁵⧸₁₈ em"},{latex:'\\char"203A\\ \\char"2039',insert:"\\ ",aside:"⅓ em"},{latex:'\\char"203A\\enspace\\char"2039',insert:"\\enspace",aside:"½ em"},{latex:'\\char"203A\\quad\\char"2039',insert:"\\quad",aside:"1 em"},{latex:'\\char"203A\\qquad\\char"2039',insert:"\\qquad",aside:"2 em"}]};function sZ(e,i){var r,a,o,n,l,s,c;let d=ci.singleton;if(!d)return;let u=ce(e),h="";if(window.mathVirtualKeyboard.isShifted){let e=null==(r=d.getKeycap(null==u?void 0:u.id))?void 0:r.shift;"object"==typeof e&&"variants"in e&&(h=null!=(a=e.variants)?a:"")}else h=null!=(n=null==(o=d.getKeycap(null==u?void 0:u.id))?void 0:o.variants)?n:"";if("string"==typeof h&&!sQ(h)||Array.isArray(h)&&0===h.length){null==i||i();return}let p={},m="";for(let e of"string"!=typeof(s=h)?s:(sG[s]||(sG[s]=null!=(c=function(e){if("foreground-color"===e){let e=[];for(let i of Object.keys(j))e.push({class:"swatch-button",label:'<span style="border: 3px solid '+j[i]+'"></span>',command:["applyStyle",{color:i}]});return e}if("background-color"===e){let e=[];for(let i of Object.keys(V))e.push({class:"swatch-button",label:'<span style="background:'+V[i]+'"></span>',command:["applyStyle",{backgroundColor:i}]});return e}}(s))?c:[]),sG[s])){let i=s8(e),r=Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36);p[r]=i;let[a,o]=s3(i);m+=`<div id=${r} class="item ${o}">${a}</div>`}let f=document.createElement("div");f.setAttribute("aria-hidden","true"),f.className="MLK__variant-panel",f.style.height="auto";let g=Object.keys(p).length,b=5;1===g?b=1:2===g||4===g?b=2:3===g||5===g||6===g?b=3:g>=7&&g<14&&(b=4),f.style.width=`calc(var(--variant-keycap-length) * ${b} + 12px)`,f.innerHTML=uO.createHTML(m),se.open({root:null==(l=null==d?void 0:d.container)?void 0:l.querySelector(".ML__keyboard"),child:f});let{signal:y}=sU=new AbortController,v=null==e?void 0:e.getBoundingClientRect();if(v){v.top-f.clientHeight<0&&(f.style.width="auto",g<=6?f.style.height="56px":g<=12?f.style.height="108px":g<=18?f.style.height="205px":f.classList.add("compact"));let e=Math.max(0,Math.min(window.innerWidth-f.offsetWidth,(v.left+v.right-f.offsetWidth)/2)),r=v.top-f.clientHeight+5;f.style.left=`${e}px`,f.style.top=`${r}px`,f.classList.add("is-visible"),requestAnimationFrame(()=>{var e;f.addEventListener("pointerup",e=>{let r=ce(e.target);null!=r&&r.id&&p[r.id]&&(s9(p[r.id]),sY(),null==i||i(),e.preventDefault())},{capture:!0,passive:!1,signal:y}),f.addEventListener("pointerenter",e=>{let i=ce(e.target);null!=i&&i.id&&p[i.id]&&i.classList.add("is-active")},{capture:!0,signal:y}),f.addEventListener("pointerleave",e=>{let i=ce(e.target);e.target&&"tagName"in e.target&&"string"==typeof e.target.tagName&&"ASIDE"===e.target.tagName.toUpperCase()||!(null!=i&&i.id)||!p[i.id]||i.classList.remove("is-active")},{capture:!0,signal:y}),null!=(e=d.getKeycap(null==u?void 0:u.id))&&e.stickyVariantPanel?window.addEventListener("pointerdown",e=>{if(!(e.target instanceof Node))return;let r=f.contains(e.target);e.target===f||r||(sY(),null==i||i())},{signal:y}):(window.addEventListener("pointercancel",()=>{sY(),null==i||i()},{signal:y}),window.addEventListener("pointerup",()=>{sY(),null==i||i()},{signal:y}))})}}function sY(){null==sU||sU.abort(),sU=null,"open"===se.state&&se.close()}function sQ(e){return void 0!==sG[e]}function s0(e){if(!e)return"";let i=new oW;return oz(oA(lD(new oE(new oG({mode:"math",type:"root",body:ll(e,{context:i,args:e=>"@"===e?"{\\class{ML__box-placeholder}{\\blacksquare}}":"\\placeholder{}"})}).render(i),{classes:"ML__base"}),i)),{classes:"ML__latex"}).toMarkup()}function s1(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s4(e){if(Array.isArray(e))return e.map(e=>s4(e)).flat();let i="string"==typeof e?{markup:e}:e;return"rows"in i&&Array.isArray(i.rows)&&(i.rows=i.rows.map(e=>e.map(e=>s8(e)))),null!=i.id||(i.id="ML__layer_"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36)),[i]}var s2=`<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
3220
3246
 
3221
3247
  <symbol id="svg-delete-backward" viewBox="0 0 576 512">
3222
3248
  <path d="M432.1 208.1L385.9 256L432.1 303C442.3 312.4 442.3 327.6 432.1 336.1C423.6 346.3 408.4 346.3 399 336.1L352 289.9L304.1 336.1C295.6 346.3 280.4 346.3 271 336.1C261.7 327.6 261.7 312.4 271 303L318.1 256L271 208.1C261.7 199.6 261.7 184.4 271 175C280.4 165.7 295.6 165.7 304.1 175L352 222.1L399 175C408.4 165.7 423.6 165.7 432.1 175C442.3 184.4 442.3 199.6 432.1 208.1V208.1zM512 64C547.3 64 576 92.65 576 128V384C576 419.3 547.3 448 512 448H205.3C188.3 448 172 441.3 160 429.3L9.372 278.6C3.371 272.6 0 264.5 0 256C0 247.5 3.372 239.4 9.372 233.4L160 82.75C172 70.74 188.3 64 205.3 64L512 64zM528 128C528 119.2 520.8 112 512 112H205.3C201 112 196.9 113.7 193.9 116.7L54.63 256L193.9 395.3C196.9 398.3 201 400 205.3 400H512C520.8 400 528 392.8 528 384V128z"/>
@@ -3270,7 +3296,7 @@ Note there are a different set of tooltip rules for the keyboard toggle
3270
3296
  <path d="M336 64l-33.6-44.8C293.3 7.1 279.1 0 264 0h-80c-15.1 0-29.3 7.1-38.4 19.2L112 64H24C10.7 64 0 74.7 0 88v2c0 3.3 2.7 6 6 6h26v368c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V96h26c3.3 0 6-2.7 6-6v-2c0-13.3-10.7-24-24-24h-88zM184 32h80c5 0 9.8 2.4 12.8 6.4L296 64H152l19.2-25.6c3-4 7.8-6.4 12.8-6.4zm200 432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V96h320v368zm-176-44V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm-80 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm160 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12z"/>
3271
3297
  </symbol>
3272
3298
  <symbol id="svg-keyboard-down" viewBox="0 0 576 512"><path d="M64 48c-8.8 0-16 7.2-16 16V240c0 8.8 7.2 16 16 16H512c8.8 0 16-7.2 16-16V64c0-8.8-7.2-16-16-16H64zM0 64C0 28.7 28.7 0 64 0H512c35.3 0 64 28.7 64 64V240c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM159 359c9.4-9.4 24.6-9.4 33.9 0l95 95 95-95c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L305 505c-4.5 4.5-10.6 7-17 7s-12.5-2.5-17-7L159 393c-9.4-9.4-9.4-24.6 0-33.9zm1-167c0-8.8 7.2-16 16-16H400c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V192zM120 88h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H120c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H200c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H280c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H360c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H440c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16z"/></symbol>
3273
- </svg>`;function sQ(e,i={shifted:!1}){var r,a,o,n,l,s,c;let d="",u=null!=(r=e.class)?r:"";if(i.shifted&&s8(e)&&(u+=" is-active"),i.shifted&&"shift"in e)"string"==typeof e.shift?d=sX(e.shift):"object"==typeof e.shift&&(d=e.shift.label?e.shift.label:null!=(a=sX(e.shift.latex||e.shift.insert||"")||e.shift.key)?a:""),"object"==typeof e.shift&&(u=null!=(n=null!=(o=e.shift.class)?o:e.class)?n:"");else{if(d=e.label?e.label:null!=(l=sX(e.latex||e.insert||"")||e.key)?l:"",e.shift){let i;i="string"==typeof e.shift?sX(e.shift):e.shift.label?e.shift.label:null!=(s=sX(e.shift.latex||e.shift.insert||"")||e.shift.key)?s:"",d+=`<span class="MLK__shift">${i}</span>`}e.aside&&(d+=`<aside>${e.aside}</aside>`)}return e.layer&&!/layer-switch/.test(u)&&(u+=" layer-switch"),/(^|\s)(separator|action|shift|fnbutton|bigfnbutton)($|\s)/.test(u)||(u+=" MLK__keycap"),!/\bw[0-9]+\b/.test(u)&&e.width&&(u+=null!=(c=({0:" w0",.5:" w5",1.5:" w15",2:" w20",5:" w50"})[e.width])?c:""),[d,u||"MLK__keycap"]}var s0={"[left]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-left /></svg>",command:"performWithFeedback(moveToPreviousChar)",shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-left /></svg>",command:"performWithFeedback(extendSelectionBackward)"}},"[right]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-right /></svg>",command:"performWithFeedback(moveToNextChar)",shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-right /></svg>",command:"performWithFeedback(extendSelectionForward)"}},"[up]":{class:"action hide-shift",label:"↑",command:"performWithFeedback(moveUp)",shift:{label:"↟",command:"performWithFeedback(extendSelectionUpward)"}},"[down]":{class:"action hide-shift",label:"↓",command:"performWithFeedback(moveDown)",shift:{label:"↡",command:"performWithFeedback(extendSelectionDownward)"}},"[return]":{class:"action hide-shift",insert:"\\\\",shift:{command:"performWithFeedback(commit)"},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[action]":{class:"action hide-shift",command:"performWithFeedback(commit)",shift:{label:"<svg class=svg-glyph><use xlink:href=#circle-plus /></svg>",command:"performWithFeedback(addRowAfter)"},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[hr]":{class:"separator horizontal-rule"},"[hide-keyboard]":{class:"action",command:["hideVirtualKeyboard"],width:1.5,label:"<svg class=svg-glyph-lg><use xlink:href=#svg-keyboard-down /></svg>"},"[.]":{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:"&#x2212;",shift:"\\pm",class:"big-op hide-shift"},"[/]":{class:"big-op hide-shift",shift:{class:"",latex:"\\frac{1}{#@}"},variants:["/","\\div","\\%","\\oslash"],latex:"\\frac{#@}{#?}",label:"&divide;"},"[*]":{variants:[{latex:"\\prod_{#0}^{#0}",class:"small"},"\\otimes","\\cdot"],latex:"\\cdot",label:"&times;",shift:{latex:"\\times"},class:"big-op hide-shift"},"[=]":{variants:["\\neq","\\equiv","\\varpropto","\\thickapprox","\\lt","\\gt","\\le","\\ge"],latex:"=",label:"=",shift:{label:"≠",latex:"\\ne"},class:"big-op hide-shift"},"[backspace]":{class:"action bottom right hide-shift",width:1.5,command:"performWithFeedback(deleteBackward)",label:"<svg class=svg-glyph><use xlink:href=#svg-delete-backward /></svg>",shift:{class:"action warning",label:"<svg class=svg-glyph><use xlink:href=#svg-trash /></svg>",command:"deleteAll"}},"[undo]":{class:"ghost if-can-undo",command:"undo",label:"<svg class=svg-glyph><use xlink:href=#svg-undo /></svg>",tooltip:"tooltip.undo"},"[redo]":{class:"ghost if-can-redo",command:"redo",label:"<svg class=svg-glyph><use xlink:href=#svg-redo /></svg>",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:"<span class=caps-lock-indicator></span><svg class=svg-glyph><use xlink:href=#svg-shift /></svg>"},"[foreground-color]":{variants:"foreground-color",command:["applyStyle",{color:"red"}],label:"<span style='border-radius: 50%;width:22px;height:22px; border: 3px solid #cc2428; box-sizing: border-box'>"},"[background-color]":{variants:"background-color",command:["applyStyle",{backgroundColor:"yellow"}],label:"<span style='border-radius: 50%;width:22px;height:22px; background:#fff590; box-sizing: border-box'></span>"}};function s1(e){var i;let r;if("string"==typeof e){if("[.]"===e&&","===globalThis.MathfieldElement.decimalSeparator&&(e="[,]"),!s0[e])return{latex:e};e={label:e}}return"label"in e&&e.label&&s0[e.label]&&(r=g(f(f({},s0[e.label]),e),{label:s0[e.label].label})),"key"in e&&e.key&&s0[e.key]&&(r=g(f(f({},s0[e.key]),e),{key:s0[e.key].key})),r?("insertDecimalSeparator"===r.command&&(r.label=null!=(i=globalThis.MathfieldElement.decimalSeparator)?i:"."),(void 0===r.tooltip||null===r.tooltip||!1===r.tooltip)&&delete r.tooltip,(void 0===r.tooltip||null===r.tooltip||!1===r.tooltip)&&delete r.tooltip,(void 0===r.aside||null===r.aside||!1===r.aside)&&delete r.aside,(void 0===r.variants||null===r.variants||!1===r.variants)&&delete r.variants,(void 0===r.shift||null===r.shift||!1===r.shift)&&delete r.shift,r):e}function s4(e){var i,r,a,o;if(0!==e.button)return;let n=s5.singleton;if(!n)return;let l=e.target;for(;l&&!l.getAttribute("data-layer");)l=l.parentElement;if(l){n.currentLayer=null!=(i=l.getAttribute("data-layer"))?i:"",e.preventDefault();return}let s=s6(e.target);if(!(null!=s&&s.id))return;let c=n.getKeycap(s.id);if(!c)return;if(e.type,!n.connectedMathfieldWindow){let e=null==(r=window.focusedMathfield)?void 0:r.call(window);if(e){let i=null==(o=null==(a=e.element)?void 0:a.ownerDocument)?void 0:o.defaultView;i&&i!==window&&(n.connectedMathfieldWindow=i)}}let d=new AbortController,u=d.signal;s.classList.add("is-pressed"),s.addEventListener("pointerenter",s2(d),{capture:!0,signal:u}),s.addEventListener("pointerleave",s2(d),{capture:!0,signal:u}),s.addEventListener("pointercancel",s2(d),{signal:u}),s.addEventListener("pointerup",s2(d),{signal:u}),s8(c)&&(s.classList.add("is-active"),n.shiftPressCount++),c.variants&&(uC&&clearTimeout(uC),uC=setTimeout(()=>{s.classList.contains("is-pressed")&&(s.classList.remove("is-pressed"),s.classList.add("is-active"),e.target&&"releasePointerCapture"in e.target&&e.target.releasePointerCapture(e.pointerId),sW(s,()=>{d.abort(),null==s||s.classList.remove("is-active")}))},300*!c.stickyVariantPanel)),e.preventDefault()}function s2(e){return i=>{let r=s6(i.target);if(!(null!=r&&r.id))return;let a=s5.singleton;if(!a)return;let o=a.getKeycap(r.id);if(o){if("pointerenter"===i.type&&i.target===r&&i.isPrimary&&r.classList.add("is-pressed"),"pointercancel"===i.type){r.classList.remove("is-pressed"),s8(o)&&(a.shiftPressCount--,r.classList.toggle("is-active",a.isShifted)),e.abort();return}if("pointerleave"===i.type&&i.target===r){r.classList.remove("is-pressed"),s8(o)&&(a.shiftPressCount--,r.classList.toggle("is-active",a.isShifted));return}if("pointerup"===i.type){uC&&clearTimeout(uC),s8(o)?r.classList.toggle("is-active",a.isShifted):r.classList.contains("is-pressed")&&(r.classList.remove("is-pressed"),a.isShifted&&o.shift?"string"==typeof o.shift?a.executeCommand(["insert",o.shift,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]):s3(o.shift):s3(o),1!==a.shiftPressCount||i.shiftKey||(a.shiftPressCount=0)),e.abort(),i.preventDefault();return}}}}function s3(e){let i=e.command;!i&&e.insert&&(i=["insert",e.insert,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),!i&&e.key&&(i=["typedText",e.key,{focus:!0,feedback:!0,simulateKeystroke:!0}]),!i&&e.latex&&(i=["insert",e.latex,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),i||(i=["typedText",e.label,{focus:!0,feedback:!0,simulateKeystroke:!0}]),s5.singleton&&s5.singleton.executeCommand(i)}function s6(e){if(!e)return;let i=e;for(;i&&!function(e){if(1!==e.nodeType)return!1;let i=e.classList;return i.contains("MLK__keycap")||i.contains("shift")||i.contains("action")||i.contains("fnbutton")||i.contains("bigfnbutton")}(i);)i=i.parentElement;return null!=i?i:void 0}function s8(e){return!!e.class&&/(^|\s)shift($|\s)/.test(e.class)}var s5=class e{constructor(){var e;this.originalContainerBottomPadding=null,this.userHeight=null,this.userResizing=!1,this.rowMetricsCache=new WeakMap,this.keycapRegistry={},this._shiftPressCount=0,this.isSandbox=!1,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(e=>{this.adjustBoundingRect(),this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect})}),this.listeners={};try{null==(e=window.top)||e.addEventListener("message",this)}catch(e){window.addEventListener("message",this)}x()&&document.addEventListener("focusin",e=>{let i=e.target;null!=i&&i.isConnected&&setTimeout(()=>{let e=s7();e&&"auto"===e.mathVirtualKeyboardPolicy&&e.hasEditableContent&&this.show({animate:!0})},300)}),document.addEventListener("focusout",e=>{e.target instanceof uk&&"manual"!==e.target.mathVirtualKeyboardPolicy&&setTimeout(()=>{s7()||this.hide()},300)})}get currentLayer(){var e,i,r;return null!=(r=null==(i=null==(e=this._element)?void 0:e.querySelector(".MLK__layer.is-visible"))?void 0:i.id)?r:""}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&&(null==(i=this._element.querySelector(".MLK__layer.is-visible"))||i.classList.remove("is-visible"),r.classList.add("is-visible")),this.render(),this.adjustBoundingRect()}get shiftPressCount(){return this._shiftPressCount}set shiftPressCount(e){var i;this._shiftPressCount=e>2||e<0?0:e,null==(i=this._element)||i.classList.toggle("is-caps-lock",2===this.shiftPressCount),this.render()}get isShifted(){return this._shiftPressCount>0}resetKeycapRegistry(){this.keycapRegistry={}}registerKeycap(e){let i="ML__k"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36);return this.keycapRegistry[i]=e,i}setKeycap(e,i){s0[e]=s1(i),this.rebuild()}getKeycap(e){var i;return e?null!=(i=s0[e])?i:this.keycapRegistry[e]:void 0}getLayer(e){for(let i of this.normalizedLayouts)for(let r of i.layers)if(r.id===e)return r}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 i=Array.isArray(e)?[...e]:[e],r=i.findIndex(e=>"default"===e);r>=0&&i.splice(r,1,"numeric","symbols","alphabetic","greek"),this._layouts=Object.freeze(i),this._normalizedLayouts=i.map(e=>(function e(i){let r;if("alphabetic"===i)return function(){var e,i;let r=window.mathVirtualKeyboard.alphabeticLayout;if("auto"===r){let i=$();i&&(r=i.virtualLayout),r&&"auto"!==r||(r=null!=(e=({fr:"azerty",be:"azerty",al:"qwertz",ba:"qwertz",cz:"qwertz",de:"qwertz",hu:"qwertz",sk:"qwertz",ch:"qwertz"})[R.locale.slice(0,2)])?e:"qwerty")}let a={qwerty:["qwertyuiop"," asdfghjkl ","^zxcvbnm~"],azerty:["azertyuiop","qsdfghjklm","^ wxcvbn ~"],qwertz:["qwertzuiop"," asdfghjkl ","^yxcvbnm~"],dvorak:["^ pyfgcrl ","aoeuidhtns","qjkxbmwvz~"],colemak:[" qwfpgjluy ","arstdhneio","^zxcvbkm~"]},o=null!=(i=a[r])?i:a.qwerty,n="azerty"===r?[[{label:"1",variants:"1"},{label:"2",shift:{latex:"é"},variants:"2"},{label:"3",shift:{latex:"ù"},variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{label:"(",latex:"("},variants:"5"},{label:"6",shift:{label:")",latex:")"},variants:"6"},{label:"7",shift:{latex:"è"},variants:"7"},{label:"8",shift:{latex:"ê"},variants:"8"},{label:"9",shift:{latex:"ç"},variants:"9"},{label:"0",shift:{latex:"à"},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 e of o){let i=[];for(let a of e)/[a-z]/.test(a)?i.push({label:a,class:"hide-shift",shift:{label:a.toUpperCase(),variants:sJ(a.toUpperCase())?a.toUpperCase():void 0},variants:sJ(a)?a:void 0}):"~"===a?"dvorak"!==r?i.push("[backspace]"):i.push({label:"[backspace]",width:1}):"^"===a?i.push("[shift]"):" "===a&&i.push("[separator-5]");n.push(i)}return n.push(["[-]","[+]","[=]",{label:" ",width:1.5},{label:",",shift:";",variants:".",class:"hide-shift"},"[.]","[left]","[right]",{label:"[return]",width:1.5}]),{label:"abc",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.alphabetic",layers:sZ({rows:n})}}();if("string"==typeof i)return sj[i],e(sj[i]);if("rows"in i&&Array.isArray(i.rows)){let{rows:e}=i;r=g(f({},y(i,["rows"])),{layers:sZ({rows:i.rows})})}else if("markup"in i&&"string"==typeof i.markup){let{markup:e}=i;r=g(f({},y(i,["markup"])),{layers:sZ(i.markup)})}else r=f({},i),"layers"in i?r.layers=sZ(i.layers):console.error('MathLive 0.110.6: provide either a "rows", "markup" or "layers" property');let a=!1,o=!1;for(let e of r.layers)if(e.rows)for(let i of e.rows.flat()){s8(i)&&(a=!0);let e=i.command;"string"==typeof e&&["undo","redo","cut","copy","paste"].includes(e)&&(o=!0)}return"displayShiftedKeycaps"in i&&void 0!==i.displayShiftedKeycaps||(r.displayShiftedKeycaps=a),"displayEditToolbar"in i&&void 0!==i.displayEditToolbar||(r.displayEditToolbar=!o),r})(e))}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 void 0===this._container?window.document.body:this._container}set container(e){this._container=e,this.rebuild()}static get singleton(){if(void 0===this._singleton)try{this._singleton=new e}catch(e){this._singleton=null}return this._singleton}get style(){return this._style}addEventListener(e,i,r){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].has(i)||this.listeners[e].add(i)}dispatchEvent(e){return!this.listeners[e.type]||0===this.listeners[e.type].size||(this.listeners[e.type].forEach(i=>{"function"==typeof i?i(e):null==i||i.handleEvent(e)}),!e.defaultPrevented)}removeEventListener(e,i,r){this.listeners[e]&&this.listeners[e].delete(i)}get element(){return this._element}set element(e){var i;this._element!==e&&(null==(i=this._element)||i.remove(),this._element=e)}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get boundingRect(){var e;if(!this._visible)return new DOMRect;let i=null==(e=this._element)?void 0:e.getElementsByClassName("MLK__plate")[0];return i?i.getBoundingClientRect():new DOMRect}get plateHeight(){var e,i,r;return null!=(r=null==(i=null==(e=this._element)?void 0:e.querySelector(".MLK__plate"))?void 0:i.getBoundingClientRect().height)?r:0}setUserHeight(e){var i;let r=null==(i=this._element)?void 0:i.querySelector(".MLK__plate");if(!r)return;let a=Math.max(96,window.innerHeight-16);this.userHeight=Math.min(Math.max(e,96),a),r.style.height=`${this.userHeight}px`,this.adjustBoundingRect()}beginUserResize(){this.userResizing=!0}endUserResize(){this.userResizing=!1,this.adjustBoundingRect()}pageRows(e){var i,r,a;let o=null==(i=this._element)?void 0:i.querySelector(".MLK__layer.is-visible");if(!o)return;let n=Number(null!=(r=o.dataset.pageCount)?r:1),l=Math.min(Math.max(Number(null!=(a=o.dataset.page)?a:0)+e,0),n-1);o.dataset.page=String(l),this.updatePaging()}adjustBoundingRect(){if(!this._element)return;this.userResizing||this.updatePaging();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))`);let i=e-1;this.container.style.paddingBottom=this.originalContainerBottomPadding?`calc(${this.originalContainerBottomPadding} + ${i}px)`:`${i}px`}else this._element.style.setProperty("--_keyboard-height",`${e}px`)}updatePaging(){var e,i;if(this._element)for(let r of this._element.querySelectorAll(".MLK__layer")){let a=r.querySelector(".MLK__rows-viewport"),o=r.querySelectorAll(".MLK__rows > .MLK__row"),n=r.querySelector(".MLK__rows"),l=r.querySelector(".MLK__page-up"),s=r.querySelector(".MLK__page-down");if(!a||!n||!l||!s||0===o.length)continue;l.hidden=!1,s.hidden=!1,l.disabled=!0,s.disabled=!0;let c=parseFloat(getComputedStyle(n).rowGap)||0,d=n.clientWidth,u=this.rowMetricsCache.get(n);u&&u.width===d&&u.gap===c&&u.heights.length===o.length||(o.forEach(e=>e.classList.remove("is-paged-out")),u={width:d,gap:c,heights:Array.from(o,e=>e.offsetHeight)},this.rowMetricsCache.set(n,u));let h=e=>{let i=[],r=[],a=0;return u.heights.forEach((o,n)=>{let l=o||1,s=l+(r.length>0?c:0);r.length>0&&a+s>e&&(i.push(r),r=[],a=0),r.push(n),a+=l+(r.length>1?c:0)}),r.length>0&&i.push(r),i},p=h(Math.max(1,a.clientHeight));p.length>1&&(l.disabled=!1,s.disabled=!1,p=h(Math.max(1,a.clientHeight-l.offsetHeight-s.offsetHeight)));let m=Math.max(1,p.length),f=Math.min(Math.max(Number(null!=(e=r.dataset.page)?e:0),0),m-1);r.dataset.page=String(f),r.dataset.pageCount=String(m);let g=new Set(null!=(i=p[f])?i:[]);o.forEach((e,i)=>e.classList.toggle("is-paged-out",!g.has(i))),l.disabled=0===f,s.disabled=f===m-1}}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 e;if(!this._element)return;let i=this.getLayer(this.currentLayer);this._element.classList.toggle("backdrop-is-transparent",!!(i&&(i.backdrop||i.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 a=this.isShifted;for(let i of r){let r=this.getKeycap(i.id);if(r){let[o,n]=sQ(r,{shifted:a});i.innerHTML=globalThis.MathfieldElement.createHTML(o),i.className=n,a&&"object"==typeof r.shift&&null!=(e=r.shift)&&e.tooltip?i.dataset.tooltip=r.shift.tooltip:!a&&r.tooltip&&(i.dataset.tooltip=r.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 e=this._element.getElementsByClassName("MLK__plate")[0];if(e&&this.observer.observe(e),r===window.document.body){let i=r.style.paddingBottom;this.originalContainerBottomPadding=i;let a=e.offsetHeight-1;r.style.paddingBottom=i?`calc(${i} + ${a}px)`:`${a}px`}window.addEventListener("mouseup",this),window.addEventListener("blur",this),window.addEventListener("keydown",this,{capture:!0}),window.addEventListener("keyup",this,{capture:!0}),null==(i=this._element)||i.classList.toggle("is-caps-lock",2===this.shiftPressCount),this.currentLayer=this.latentLayer}this._visible=!0,null!=e&&e.animate?requestAnimationFrame(()=>{this._element&&(this._element.classList.add("animate"),this._element.addEventListener("transitionend",()=>{var e;return null==(e=this._element)?void 0:e.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 e=this._element.getElementsByClassName("MLK__plate")[0];e&&this.observer.unobserve(e),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}),sU(),nC("core"),nC("virtual-keyboard"),null==(i=this._element)||i.remove(),this._element=void 0,null!==this.originalContainerBottomPadding&&(r.style.paddingBottom=this.originalContainerBottomPadding)}this.stateChanged()}}get height(){var e,i;return null!=(i=null==(e=this.element)?void 0:e.offsetHeight)?i:0}buildAndAttachElement(){var e;if(this.element,this.element=function(e){var i;e.resetKeycapRegistry(),nL("virtual-keyboard"),nL("core"),sE();let r=document.createElement("div");r.className="ML__keyboard";let a=document.createElement("div");a.className="MLK__plate",a.innerHTML=globalThis.MathfieldElement.createHTML(sY+e.normalizedLayouts.map((i,r)=>(function(e,i,r){var a;let o=[];if(!("layers"in i))return"";for(let n of i.layers)o.push(`<div tabindex="-1" class="MLK__layer" id="${n.id}">`),(e.normalizedLayouts.length>1||i.displayEditToolbar)&&(o.push("<div class='MLK__toolbar' role='toolbar'>"),o.push(function(e,i){var r,a;let o='<div class="left">';if(e.normalizedLayouts.length>1)for(let[n,l]of e.normalizedLayouts.entries()){let e=[n===i?"selected":"layer-switch"];l.tooltip&&e.push("MLK__tooltip"),l.labelClass&&e.push(...l.labelClass.split(" ")),o+=`<div class="${e.join(" ")}"`,l.tooltip&&(o+=" data-tooltip='"+(null!=(r=N(l.tooltip))?r:l.tooltip)+"' "),n!==i&&(o+=`data-layer="${l.layers[0].id}"`),o+=`>${null!=(a=l.label)?a:"untitled"}</div>`}return o+"</div>"}(e,r)),(null==(a=i.displayEditToolbar)||a)&&o.push('<div class="ML__edit-toolbar right"></div>'),o.push("</div>")),o.push(function(e,i){var r;if("string"==typeof i)return i;let a="";if("string"==typeof i.style?a+=`<style>${i.style}</style>`:"object"==typeof i.style&&(a+=`<style>${Object.keys(r=i.style).map(e=>{var i;return`${e} {${"string"==typeof(i=r[e])?i:Object.entries(i).map(([e,i])=>`${e}:${i} !important`).join(";")}}`}).join("")}</style>`),i.backdrop&&(a+=`<div class='${i.backdrop}'>`),i.container&&(a+=`<div class='${i.container}'>`),i.rows){for(let r of(a+="<div class=MLK__rows-viewport>",a+='<button type="button" class="MLK__page-button MLK__page-up" data-page-delta="-1" data-l10n-tooltip="keyboard.tooltip.previous rows" data-l10n-arial-label="keyboard.tooltip.previous rows"><svg class=svg-glyph aria-hidden="true"><use xlink:href=#svg-angle-up /></svg></button>',a+="<div class=MLK__rows>",i.rows)){for(let i of(a+='<div dir="ltr" class=MLK__row>',r))if(i){let r=e.registerKeycap(i),[o,n]=sQ(i);/(^|\s)separator/.test(n)?a+=`<div class="${n}"`:a+=`<div tabindex="-1" id="${r}" class="${n}"`,i.tooltip&&(a+=` data-tooltip="${sG(i.tooltip)}"`);let l=function(e){var i,r,a,o;let n=null!=(o=null!=(a=null!=(r=null!=(i=e.tooltip)?i:"string"==typeof e.label?e.label.replace(/<\/?[^>]+(>|$)/g," "):void 0)?r:e.insert)?a:e.latex)?o:e.key;return n&&n.replace(/\s+/g," ").trim()||null}(i);l&&(a+=` aria-label="${sG(l)}"`);let s=function(e){if(null==e)return null;try{return JSON.stringify(e)}catch(e){return null}}(i.command);s&&(a+=` data-command="${sG(s)}"`);let c=function(e){var i,r;let a=null!=(r=null!=(i=e.insert)?i:e.latex)?r:e.key;return null!=a?a:null}(i);c&&(a+=` data-keycap-value="${sG(c)}"`),a+=`>${o}</div>`}a+="</div>"}a+="</div>",a+='<button type="button" class="MLK__page-button MLK__page-down" data-page-delta="1" data-l10n-tooltip="keyboard.tooltip.next rows" data-l10n-arial-label="keyboard.tooltip.next rows"><svg class=svg-glyph aria-hidden="true"><use xlink:href=#svg-angle-down /></svg></button>',a+="</div>"}else i.markup&&(a+=i.markup);return i.container&&(a+="</div>"),i.backdrop&&(a+="</div>"),a}(e,n)),o.push("</div>");return o.join("")})(e,i,r)).join("")),a.insertAdjacentHTML("afterbegin",'<div class="MLK__resize-handle" role="separator" tabindex="0" data-l10n-tooltip="keyboard.tooltip.resize" data-l10n-arial-label="keyboard.tooltip.resize"></div>'),null==(i=a.querySelector(".MLK__resize-handle"))||i.addEventListener("pointerdown",i=>{i.stopPropagation(),function(e,i){let r=e.clientY,a=i.plateHeight,o=e.pointerId,n=e.currentTarget instanceof HTMLElement?e.currentTarget:null;i.beginUserResize();try{null==n||n.setPointerCapture(o)}catch(e){}let l=e=>{e.pointerId===o&&(i.setUserHeight(a+r-e.clientY),e.preventDefault())},s=e=>{if(e.pointerId===o){window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s);try{null!=n&&n.hasPointerCapture(o)&&n.releasePointerCapture(o)}catch(e){}i.endUserResize()}};window.addEventListener("pointermove",l,{passive:!1}),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),e.preventDefault()}(i,e)}),a.querySelectorAll(".MLK__page-button").forEach(i=>i.addEventListener("pointerdown",r=>{var a;r.stopPropagation(),e.pageRows(Number(null!=(a=i.dataset.pageDelta)?a:0)),r.preventDefault()}));let o=document.createElement("div");o.className="MLK__backdrop",o.appendChild(a),r.appendChild(o),r.addEventListener("pointerdown",s4,{passive:!1});let n=r.querySelectorAll(".ML__edit-toolbar");if(n)for(let i of n)i.addEventListener("click",i=>{var r,a;let o=i.target,n="";for(;o&&!n;)n=null!=(r=null==o?void 0:o.getAttribute("data-command"))?r:"",o=null!=(a=null==o?void 0:o.parentElement)?a:null;n&&e.executeCommand(JSON.parse(n))});for(let e of r.querySelectorAll(".MLK__keycap, .action, .fnbutton, .bigfnbutton"))!function(e){let i=s5.singleton;if(!i)return;let r={};if(!e.id){if(e.hasAttribute("data-label")&&(r.label=e.dataset.label),e.hasAttribute("data-latex")&&(r.latex=e.dataset.latex),e.hasAttribute("data-key")&&(r.key=e.dataset.key),e.hasAttribute("data-insert")&&(r.insert=e.dataset.insert),e.hasAttribute("data-variants")&&(r.variants=e.dataset.variants),e.hasAttribute("data-aside")&&(r.aside=e.dataset.aside),e.className&&(r.class=e.className),r.label||r.latex||r.key||r.insert||(r.latex=e.innerText,r.label=e.innerHTML),e.hasAttribute("data-command"))try{r.command=JSON.parse(e.dataset.command)}catch(e){console.warn("Invalid JSON in data-command attribute",e)}e.id=i.registerKeycap(r)}if(!e.innerHTML){let[i,a]=sQ(r);e.innerHTML=globalThis.MathfieldElement.createHTML(i)}}(e);let l=r.querySelectorAll(".MLK__layer");for(let e of(l.length,l))e.addEventListener("pointerdown",e=>e.preventDefault());return e.currentLayer=e.latentLayer,R.update(r),r}(this),window.addEventListener("contextmenu",this,{capture:!0}),this.element.addEventListener("contextmenu",e=>{e.shiftKey||((e.ctrlKey||2===e.button)&&sW(e.target),e.preventDefault(),e.stopPropagation())},{capture:!0}),null==(e=this.container)||e.appendChild(this.element),null!==this.userHeight){let e=this.element.querySelector(".MLK__plate");e&&(e.style.height=`${this.userHeight}px`)}}handleEvent(e){if(sN(e)){if(!np(e.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");if("disconnect"===e.data.action){if(this._visible)return;this.connectedMathfieldWindow=void 0}else"update-setting"!==e.data.action&&"proxy-created"!==e.data.action&&"execute-command"!==e.data.action&&(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":2!==e.button&&e.preventDefault();break;case"keydown":"Shift"!==e.key||e.repeat||(this.shiftPressCount=1);break;case"keyup":"Shift"!==e.key&&(e.getModifierState("Shift")||2===this.shiftPressCount)||(this.shiftPressCount=0)}}handleMessage(e,i){let{action:r}=e;if("execute-command"===r){let{command:r}=e,a=sO(r);if(window===window.top&&i!==window||i===window&&"virtual-keyboard"!==a)return;this.executeCommand(r);return}if(("connect"===r||"show"===r)&&this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},i),"disconnect"!==r&&!this.isSandbox){if("show"===r)return void(void 0!==e.animate?this.show({animate:e.animate}):this.show());if("hide"===r)return void(void 0!==e.animate?this.hide({animate:e.animate}):this.hide());if("update-setting"===r){if(e.alphabeticLayout&&(this.alphabeticLayout=e.alphabeticLayout),e.layouts&&(this.layouts=e.layouts),e.editToolbar&&(this.editToolbar=e.editToolbar),e.setKeycap){let{keycap:i,value:r}=e.setKeycap;this.setKeycap(i,r),this.render()}return}if("proxy-created"===r)return void this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},i)}}sendMessage(e,i,r){if(i.command&&this.dispatchEvent(new CustomEvent("math-virtual-keyboard-command",{detail:i.command})),r||(r=this.connectedMathfieldWindow),null===this.targetOrigin||"null"===this.targetOrigin||r===window)return void window.dispatchEvent(new MessageEvent("message",{source:window,origin:window.origin,data:f({type:sR,action:e},i)}));if(r)r.postMessage(f({type:sR,action:e},i),{targetOrigin:this.targetOrigin});else if("execute-command"===e&&Array.isArray(i.command)&&"insert"===i.command[0])for(let e of i.command[1].split(""))this.dispatchEvent(new KeyboardEvent("keydown",{key:e,bubbles:!0})),this.dispatchEvent(new KeyboardEvent("keyup",{key:e,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 i=this._element;if(!i)return;i.classList.toggle("is-math-mode","math"===e.mode),i.classList.toggle("is-text-mode","text"===e.mode),i.classList.toggle("can-undo",e.canUndo),i.classList.toggle("can-redo",e.canRedo),i.classList.toggle("can-copy",!e.selectionIsCollapsed),i.classList.toggle("can-cut",!e.selectionIsCollapsed),i.classList.toggle("can-paste",!0);let r=i.querySelectorAll(".ML__edit-toolbar");if(r)for(let i of r)i.innerHTML=function(e,i){let r="";if("none"===e.editToolbar)return"";let a=[];i.selectionIsCollapsed?a.push("undo","redo","pasteFromClipboard"):a.push("cutToClipboard","copyToClipboard","pasteFromClipboard");let o={undo:`<div class='action ${!1===i.canUndo?"disabled":""}'
3299
+ </svg>`;function s3(e,i={shifted:!1}){var r,a,o,n,l,s,c;let d="",u=null!=(r=e.class)?r:"";if(i.shifted&&ct(e)&&(u+=" is-active"),i.shifted&&"shift"in e)"string"==typeof e.shift?d=s0(e.shift):"object"==typeof e.shift&&(d=e.shift.label?e.shift.label:null!=(a=s0(e.shift.latex||e.shift.insert||"")||e.shift.key)?a:""),"object"==typeof e.shift&&(u=null!=(n=null!=(o=e.shift.class)?o:e.class)?n:"");else{if(d=e.label?e.label:null!=(l=s0(e.latex||e.insert||"")||e.key)?l:"",e.shift){let i;i="string"==typeof e.shift?s0(e.shift):e.shift.label?e.shift.label:null!=(s=s0(e.shift.latex||e.shift.insert||"")||e.shift.key)?s:"",d+=`<span class="MLK__shift">${i}</span>`}e.aside&&(d+=`<aside>${e.aside}</aside>`)}return e.layer&&!/layer-switch/.test(u)&&(u+=" layer-switch"),/(^|\s)(separator|action|shift|fnbutton|bigfnbutton)($|\s)/.test(u)||(u+=" MLK__keycap"),!/\bw[0-9]+\b/.test(u)&&e.width&&(u+=null!=(c=({0:" w0",.5:" w5",1.5:" w15",2:" w20",5:" w50"})[e.width])?c:""),[d,u||"MLK__keycap"]}var s6={"[left]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-left /></svg>",command:"performWithFeedback(moveToPreviousChar)",shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-left /></svg>",command:"performWithFeedback(extendSelectionBackward)"}},"[right]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-right /></svg>",command:"performWithFeedback(moveToNextChar)",shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-right /></svg>",command:"performWithFeedback(extendSelectionForward)"}},"[up]":{class:"action hide-shift",label:"↑",command:"performWithFeedback(moveUp)",shift:{label:"↟",command:"performWithFeedback(extendSelectionUpward)"}},"[down]":{class:"action hide-shift",label:"↓",command:"performWithFeedback(moveDown)",shift:{label:"↡",command:"performWithFeedback(extendSelectionDownward)"}},"[return]":{class:"action hide-shift",insert:"\\\\",shift:{command:"performWithFeedback(commit)"},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[action]":{class:"action hide-shift",command:"performWithFeedback(commit)",shift:{label:"<svg class=svg-glyph><use xlink:href=#circle-plus /></svg>",command:"performWithFeedback(addRowAfter)"},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[hr]":{class:"separator horizontal-rule"},"[hide-keyboard]":{class:"action",command:["hideVirtualKeyboard"],width:1.5,label:"<svg class=svg-glyph-lg><use xlink:href=#svg-keyboard-down /></svg>"},"[.]":{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:"&#x2212;",shift:"\\pm",class:"big-op hide-shift"},"[/]":{class:"big-op hide-shift",shift:{class:"",latex:"\\frac{1}{#@}"},variants:["/","\\div","\\%","\\oslash"],latex:"\\frac{#@}{#?}",label:"&divide;"},"[*]":{variants:[{latex:"\\prod_{#0}^{#0}",class:"small"},"\\otimes","\\cdot"],latex:"\\cdot",label:"&times;",shift:{latex:"\\times"},class:"big-op hide-shift"},"[=]":{variants:["\\neq","\\equiv","\\varpropto","\\thickapprox","\\lt","\\gt","\\le","\\ge"],latex:"=",label:"=",shift:{label:"≠",latex:"\\ne"},class:"big-op hide-shift"},"[backspace]":{class:"action bottom right hide-shift",width:1.5,command:"performWithFeedback(deleteBackward)",label:"<svg class=svg-glyph><use xlink:href=#svg-delete-backward /></svg>",shift:{class:"action warning",label:"<svg class=svg-glyph><use xlink:href=#svg-trash /></svg>",command:"deleteAll"}},"[undo]":{class:"ghost if-can-undo",command:"undo",label:"<svg class=svg-glyph><use xlink:href=#svg-undo /></svg>",tooltip:"tooltip.undo"},"[redo]":{class:"ghost if-can-redo",command:"redo",label:"<svg class=svg-glyph><use xlink:href=#svg-redo /></svg>",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:"<span class=caps-lock-indicator></span><svg class=svg-glyph><use xlink:href=#svg-shift /></svg>"},"[foreground-color]":{variants:"foreground-color",command:["applyStyle",{color:"red"}],label:"<span style='border-radius: 50%;width:22px;height:22px; border: 3px solid #cc2428; box-sizing: border-box'>"},"[background-color]":{variants:"background-color",command:["applyStyle",{backgroundColor:"yellow"}],label:"<span style='border-radius: 50%;width:22px;height:22px; background:#fff590; box-sizing: border-box'></span>"}};function s8(e){var i;let r;if("string"==typeof e){if("[.]"===e&&","===globalThis.MathfieldElement.decimalSeparator&&(e="[,]"),!s6[e])return{latex:e};e={label:e}}return"label"in e&&e.label&&s6[e.label]&&(r=g(f(f({},s6[e.label]),e),{label:s6[e.label].label})),"key"in e&&e.key&&s6[e.key]&&(r=g(f(f({},s6[e.key]),e),{key:s6[e.key].key})),r?("insertDecimalSeparator"===r.command&&(r.label=null!=(i=globalThis.MathfieldElement.decimalSeparator)?i:"."),(void 0===r.tooltip||null===r.tooltip||!1===r.tooltip)&&delete r.tooltip,(void 0===r.tooltip||null===r.tooltip||!1===r.tooltip)&&delete r.tooltip,(void 0===r.aside||null===r.aside||!1===r.aside)&&delete r.aside,(void 0===r.variants||null===r.variants||!1===r.variants)&&delete r.variants,(void 0===r.shift||null===r.shift||!1===r.shift)&&delete r.shift,r):e}function s5(e){var i,r,a,o;if(0!==e.button)return;let n=ci.singleton;if(!n)return;let l=e.target;for(;l&&!l.getAttribute("data-layer");)l=l.parentElement;if(l){n.currentLayer=null!=(i=l.getAttribute("data-layer"))?i:"",e.preventDefault();return}let s=ce(e.target);if(!(null!=s&&s.id))return;let c=n.getKeycap(s.id);if(!c)return;if(e.type,!n.connectedMathfieldWindow){let e=null==(r=window.focusedMathfield)?void 0:r.call(window);if(e){let i=null==(o=null==(a=e.element)?void 0:a.ownerDocument)?void 0:o.defaultView;i&&i!==window&&(n.connectedMathfieldWindow=i)}}let d=new AbortController,u=d.signal;s.classList.add("is-pressed"),s.addEventListener("pointerenter",s7(d),{capture:!0,signal:u}),s.addEventListener("pointerleave",s7(d),{capture:!0,signal:u}),s.addEventListener("pointercancel",s7(d),{signal:u}),s.addEventListener("pointerup",s7(d),{signal:u}),ct(c)&&(s.classList.add("is-active"),n.shiftPressCount++),c.variants&&(uD&&clearTimeout(uD),uD=setTimeout(()=>{s.classList.contains("is-pressed")&&(s.classList.remove("is-pressed"),s.classList.add("is-active"),e.target&&"releasePointerCapture"in e.target&&e.target.releasePointerCapture(e.pointerId),sZ(s,()=>{d.abort(),null==s||s.classList.remove("is-active")}))},300*!c.stickyVariantPanel)),e.preventDefault()}function s7(e){return i=>{let r=ce(i.target);if(!(null!=r&&r.id))return;let a=ci.singleton;if(!a)return;let o=a.getKeycap(r.id);if(o){if("pointerenter"===i.type&&i.target===r&&i.isPrimary&&r.classList.add("is-pressed"),"pointercancel"===i.type){r.classList.remove("is-pressed"),ct(o)&&(a.shiftPressCount--,r.classList.toggle("is-active",a.isShifted)),e.abort();return}if("pointerleave"===i.type&&i.target===r){r.classList.remove("is-pressed"),ct(o)&&(a.shiftPressCount--,r.classList.toggle("is-active",a.isShifted));return}if("pointerup"===i.type){uD&&clearTimeout(uD),ct(o)?r.classList.toggle("is-active",a.isShifted):r.classList.contains("is-pressed")&&(r.classList.remove("is-pressed"),a.isShifted&&o.shift?"string"==typeof o.shift?a.executeCommand(["insert",o.shift,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]):s9(o.shift):s9(o),1!==a.shiftPressCount||i.shiftKey||(a.shiftPressCount=0)),e.abort(),i.preventDefault();return}}}}function s9(e){let i=e.command;!i&&e.insert&&(i=["insert",e.insert,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),!i&&e.key&&(i=["typedText",e.key,{focus:!0,feedback:!0,simulateKeystroke:!0}]),!i&&e.latex&&(i=["insert",e.latex,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),i||(i=["typedText",e.label,{focus:!0,feedback:!0,simulateKeystroke:!0}]),ci.singleton&&ci.singleton.executeCommand(i)}function ce(e){if(!e)return;let i=e;for(;i&&!function(e){if(1!==e.nodeType)return!1;let i=e.classList;return i.contains("MLK__keycap")||i.contains("shift")||i.contains("action")||i.contains("fnbutton")||i.contains("bigfnbutton")}(i);)i=i.parentElement;return null!=i?i:void 0}function ct(e){return!!e.class&&/(^|\s)shift($|\s)/.test(e.class)}var ci=class e{constructor(){var e;this.originalContainerBottomPadding=null,this.userHeight=null,this.userResizing=!1,this.rowMetricsCache=new WeakMap,this.keycapRegistry={},this._shiftPressCount=0,this.isSandbox=!1,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(e=>{this.adjustBoundingRect(),this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect})}),this.listeners={};try{null==(e=window.top)||e.addEventListener("message",this)}catch(e){window.addEventListener("message",this)}x()&&document.addEventListener("focusin",e=>{let i=e.target;null!=i&&i.isConnected&&setTimeout(()=>{let e=cr();e&&"auto"===e.mathVirtualKeyboardPolicy&&e.hasEditableContent&&this.show({animate:!0})},300)}),document.addEventListener("focusout",e=>{e.target instanceof uE&&"manual"!==e.target.mathVirtualKeyboardPolicy&&setTimeout(()=>{cr()||this.hide()},300)})}get currentLayer(){var e,i,r;return null!=(r=null==(i=null==(e=this._element)?void 0:e.querySelector(".MLK__layer.is-visible"))?void 0:i.id)?r:""}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&&(null==(i=this._element.querySelector(".MLK__layer.is-visible"))||i.classList.remove("is-visible"),r.classList.add("is-visible")),this.render(),this.adjustBoundingRect()}get shiftPressCount(){return this._shiftPressCount}set shiftPressCount(e){var i;this._shiftPressCount=e>2||e<0?0:e,null==(i=this._element)||i.classList.toggle("is-caps-lock",2===this.shiftPressCount),this.render()}get isShifted(){return this._shiftPressCount>0}resetKeycapRegistry(){this.keycapRegistry={}}registerKeycap(e){let i="ML__k"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36);return this.keycapRegistry[i]=e,i}setKeycap(e,i){s6[e]=s8(i),this.rebuild()}getKeycap(e){var i;return e?null!=(i=s6[e])?i:this.keycapRegistry[e]:void 0}getLayer(e){for(let i of this.normalizedLayouts)for(let r of i.layers)if(r.id===e)return r}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 i=Array.isArray(e)?[...e]:[e],r=i.findIndex(e=>"default"===e);r>=0&&i.splice(r,1,"numeric","symbols","alphabetic","greek"),this._layouts=Object.freeze(i),this._normalizedLayouts=i.map(e=>(function e(i){let r;if("alphabetic"===i)return function(){var e,i;let r=window.mathVirtualKeyboard.alphabeticLayout;if("auto"===r){let i=$();i&&(r=i.virtualLayout),r&&"auto"!==r||(r=null!=(e=({fr:"azerty",be:"azerty",al:"qwertz",ba:"qwertz",cz:"qwertz",de:"qwertz",hu:"qwertz",sk:"qwertz",ch:"qwertz"})[I.locale.slice(0,2)])?e:"qwerty")}let a={qwerty:["qwertyuiop"," asdfghjkl ","^zxcvbnm~"],azerty:["azertyuiop","qsdfghjklm","^ wxcvbn ~"],qwertz:["qwertzuiop"," asdfghjkl ","^yxcvbnm~"],dvorak:["^ pyfgcrl ","aoeuidhtns","qjkxbmwvz~"],colemak:[" qwfpgjluy ","arstdhneio","^zxcvbkm~"]},o=null!=(i=a[r])?i:a.qwerty,n="azerty"===r?[[{label:"1",variants:"1"},{label:"2",shift:{latex:"é"},variants:"2"},{label:"3",shift:{latex:"ù"},variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{label:"(",latex:"("},variants:"5"},{label:"6",shift:{label:")",latex:")"},variants:"6"},{label:"7",shift:{latex:"è"},variants:"7"},{label:"8",shift:{latex:"ê"},variants:"8"},{label:"9",shift:{latex:"ç"},variants:"9"},{label:"0",shift:{latex:"à"},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 e of o){let i=[];for(let a of e)/[a-z]/.test(a)?i.push({label:a,class:"hide-shift",shift:{label:a.toUpperCase(),variants:sQ(a.toUpperCase())?a.toUpperCase():void 0},variants:sQ(a)?a:void 0}):"~"===a?"dvorak"!==r?i.push("[backspace]"):i.push({label:"[backspace]",width:1}):"^"===a?i.push("[shift]"):" "===a&&i.push("[separator-5]");n.push(i)}return n.push(["[-]","[+]","[=]",{label:" ",width:1.5},{label:",",shift:";",variants:".",class:"hide-shift"},"[.]","[left]","[right]",{label:"[return]",width:1.5}]),{label:"abc",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.alphabetic",layers:s4({rows:n})}}();if("string"==typeof i)return sX[i],e(sX[i]);if("rows"in i&&Array.isArray(i.rows)){let{rows:e}=i;r=g(f({},y(i,["rows"])),{layers:s4({rows:i.rows})})}else if("markup"in i&&"string"==typeof i.markup){let{markup:e}=i;r=g(f({},y(i,["markup"])),{layers:s4(i.markup)})}else r=f({},i),"layers"in i?r.layers=s4(i.layers):console.error('MathLive 0.110.8: provide either a "rows", "markup" or "layers" property');let a=!1,o=!1;for(let e of r.layers)if(e.rows)for(let i of e.rows.flat()){ct(i)&&(a=!0);let e=i.command;"string"==typeof e&&["undo","redo","cut","copy","paste"].includes(e)&&(o=!0)}return"displayShiftedKeycaps"in i&&void 0!==i.displayShiftedKeycaps||(r.displayShiftedKeycaps=a),"displayEditToolbar"in i&&void 0!==i.displayEditToolbar||(r.displayEditToolbar=!o),r})(e))}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 void 0===this._container?window.document.body:this._container}set container(e){this._container=e,this.rebuild()}static get singleton(){if(void 0===this._singleton)try{this._singleton=new e}catch(e){this._singleton=null}return this._singleton}get style(){return this._style}addEventListener(e,i,r){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].has(i)||this.listeners[e].add(i)}dispatchEvent(e){return!this.listeners[e.type]||0===this.listeners[e.type].size||(this.listeners[e.type].forEach(i=>{"function"==typeof i?i(e):null==i||i.handleEvent(e)}),!e.defaultPrevented)}removeEventListener(e,i,r){this.listeners[e]&&this.listeners[e].delete(i)}get element(){return this._element}set element(e){var i;this._element!==e&&(null==(i=this._element)||i.remove(),this._element=e)}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get boundingRect(){var e;if(!this._visible)return new DOMRect;let i=null==(e=this._element)?void 0:e.getElementsByClassName("MLK__plate")[0];return i?i.getBoundingClientRect():new DOMRect}get plateHeight(){var e,i,r;return null!=(r=null==(i=null==(e=this._element)?void 0:e.querySelector(".MLK__plate"))?void 0:i.getBoundingClientRect().height)?r:0}setUserHeight(e){var i;let r=null==(i=this._element)?void 0:i.querySelector(".MLK__plate");if(!r)return;let a=Math.max(96,window.innerHeight-16);this.userHeight=Math.min(Math.max(e,96),a),r.style.height=`${this.userHeight}px`,this.adjustBoundingRect()}beginUserResize(){this.userResizing=!0}endUserResize(){this.userResizing=!1,this.adjustBoundingRect()}pageRows(e){var i,r,a;let o=null==(i=this._element)?void 0:i.querySelector(".MLK__layer.is-visible");if(!o)return;let n=Number(null!=(r=o.dataset.pageCount)?r:1),l=Math.min(Math.max(Number(null!=(a=o.dataset.page)?a:0)+e,0),n-1);o.dataset.page=String(l),this.updatePaging()}adjustBoundingRect(){if(!this._element)return;this.userResizing||this.updatePaging();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))`);let i=e-1;this.container.style.paddingBottom=this.originalContainerBottomPadding?`calc(${this.originalContainerBottomPadding} + ${i}px)`:`${i}px`}else this._element.style.setProperty("--_keyboard-height",`${e}px`)}updatePaging(){var e,i;if(this._element)for(let r of this._element.querySelectorAll(".MLK__layer")){let a=r.querySelector(".MLK__rows-viewport"),o=r.querySelectorAll(".MLK__rows > .MLK__row"),n=r.querySelector(".MLK__rows"),l=r.querySelector(".MLK__page-up"),s=r.querySelector(".MLK__page-down");if(!a||!n||!l||!s||0===o.length)continue;l.hidden=!1,s.hidden=!1,l.disabled=!0,s.disabled=!0;let c=parseFloat(getComputedStyle(n).rowGap)||0,d=n.clientWidth,u=this.rowMetricsCache.get(n);u&&u.width===d&&u.gap===c&&u.heights.length===o.length||(o.forEach(e=>e.classList.remove("is-paged-out")),u={width:d,gap:c,heights:Array.from(o,e=>e.offsetHeight)},this.rowMetricsCache.set(n,u));let h=e=>{let i=[],r=[],a=0;return u.heights.forEach((o,n)=>{let l=o||1,s=l+(r.length>0?c:0);r.length>0&&a+s>e&&(i.push(r),r=[],a=0),r.push(n),a+=l+(r.length>1?c:0)}),r.length>0&&i.push(r),i},p=h(Math.max(1,a.clientHeight));p.length>1&&(l.disabled=!1,s.disabled=!1,p=h(Math.max(1,a.clientHeight-l.offsetHeight-s.offsetHeight)));let m=Math.max(1,p.length),f=Math.min(Math.max(Number(null!=(e=r.dataset.page)?e:0),0),m-1);r.dataset.page=String(f),r.dataset.pageCount=String(m);let g=new Set(null!=(i=p[f])?i:[]);o.forEach((e,i)=>e.classList.toggle("is-paged-out",!g.has(i))),l.disabled=0===f,s.disabled=f===m-1}}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 e;if(!this._element)return;let i=this.getLayer(this.currentLayer);this._element.classList.toggle("backdrop-is-transparent",!!(i&&(i.backdrop||i.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 a=this.isShifted;for(let i of r){let r=this.getKeycap(i.id);if(r){let[o,n]=s3(r,{shifted:a});i.innerHTML=globalThis.MathfieldElement.createHTML(o),i.className=n,a&&"object"==typeof r.shift&&null!=(e=r.shift)&&e.tooltip?i.dataset.tooltip=r.shift.tooltip:!a&&r.tooltip&&(i.dataset.tooltip=r.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 e=this._element.getElementsByClassName("MLK__plate")[0];if(e&&this.observer.observe(e),r===window.document.body){let i=r.style.paddingBottom;this.originalContainerBottomPadding=i;let a=e.offsetHeight-1;r.style.paddingBottom=i?`calc(${i} + ${a}px)`:`${a}px`}window.addEventListener("mouseup",this),window.addEventListener("blur",this),window.addEventListener("keydown",this,{capture:!0}),window.addEventListener("keyup",this,{capture:!0}),null==(i=this._element)||i.classList.toggle("is-caps-lock",2===this.shiftPressCount),this.currentLayer=this.latentLayer}this._visible=!0,null!=e&&e.animate?requestAnimationFrame(()=>{this._element&&(this._element.classList.add("animate"),this._element.addEventListener("transitionend",()=>{var e;return null==(e=this._element)?void 0:e.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 e=this._element.getElementsByClassName("MLK__plate")[0];e&&this.observer.unobserve(e),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}),sY(),nz("core"),nz("virtual-keyboard"),null==(i=this._element)||i.remove(),this._element=void 0,null!==this.originalContainerBottomPadding&&(r.style.paddingBottom=this.originalContainerBottomPadding)}this.stateChanged()}}get height(){var e,i;return null!=(i=null==(e=this.element)?void 0:e.offsetHeight)?i:0}buildAndAttachElement(){var e;if(this.element,this.element=function(e){var i;e.resetKeycapRegistry(),nA("virtual-keyboard"),nA("core"),sK();let r=document.createElement("div");r.className="ML__keyboard";let a=document.createElement("div");a.className="MLK__plate",a.innerHTML=globalThis.MathfieldElement.createHTML(s2+e.normalizedLayouts.map((i,r)=>(function(e,i,r){var a;let o=[];if(!("layers"in i))return"";for(let n of i.layers)o.push(`<div tabindex="-1" class="MLK__layer" id="${n.id}">`),(e.normalizedLayouts.length>1||i.displayEditToolbar)&&(o.push("<div class='MLK__toolbar' role='toolbar'>"),o.push(function(e,i){var r,a;let o='<div class="left">';if(e.normalizedLayouts.length>1)for(let[n,l]of e.normalizedLayouts.entries()){let e=[n===i?"selected":"layer-switch"];l.tooltip&&e.push("MLK__tooltip"),l.labelClass&&e.push(...l.labelClass.split(" ")),o+=`<div class="${e.join(" ")}"`,l.tooltip&&(o+=" data-tooltip='"+(null!=(r=N(l.tooltip))?r:l.tooltip)+"' "),n!==i&&(o+=`data-layer="${l.layers[0].id}"`),o+=`>${null!=(a=l.label)?a:"untitled"}</div>`}return o+"</div>"}(e,r)),(null==(a=i.displayEditToolbar)||a)&&o.push('<div class="ML__edit-toolbar right"></div>'),o.push("</div>")),o.push(function(e,i){var r;if("string"==typeof i)return i;let a="";if("string"==typeof i.style?a+=`<style>${i.style}</style>`:"object"==typeof i.style&&(a+=`<style>${Object.keys(r=i.style).map(e=>{var i;return`${e} {${"string"==typeof(i=r[e])?i:Object.entries(i).map(([e,i])=>`${e}:${i} !important`).join(";")}}`}).join("")}</style>`),i.backdrop&&(a+=`<div class='${i.backdrop}'>`),i.container&&(a+=`<div class='${i.container}'>`),i.rows){for(let r of(a+="<div class=MLK__rows-viewport>",a+='<button type="button" class="MLK__page-button MLK__page-up" data-page-delta="-1" data-l10n-tooltip="keyboard.tooltip.previous rows" data-l10n-arial-label="keyboard.tooltip.previous rows"><svg class=svg-glyph aria-hidden="true"><use xlink:href=#svg-angle-up /></svg></button>',a+="<div class=MLK__rows>",i.rows)){for(let i of(a+='<div dir="ltr" class=MLK__row>',r))if(i){let r=e.registerKeycap(i),[o,n]=s3(i);/(^|\s)separator/.test(n)?a+=`<div class="${n}"`:a+=`<div tabindex="-1" id="${r}" class="${n}"`,i.tooltip&&(a+=` data-tooltip="${s1(i.tooltip)}"`);let l=function(e){var i,r,a,o;let n=null!=(o=null!=(a=null!=(r=null!=(i=e.tooltip)?i:"string"==typeof e.label?e.label.replace(/<\/?[^>]+(>|$)/g," "):void 0)?r:e.insert)?a:e.latex)?o:e.key;return n&&n.replace(/\s+/g," ").trim()||null}(i);l&&(a+=` aria-label="${s1(l)}"`);let s=function(e){if(null==e)return null;try{return JSON.stringify(e)}catch(e){return null}}(i.command);s&&(a+=` data-command="${s1(s)}"`);let c=function(e){var i,r;let a=null!=(r=null!=(i=e.insert)?i:e.latex)?r:e.key;return null!=a?a:null}(i);c&&(a+=` data-keycap-value="${s1(c)}"`),a+=`>${o}</div>`}a+="</div>"}a+="</div>",a+='<button type="button" class="MLK__page-button MLK__page-down" data-page-delta="1" data-l10n-tooltip="keyboard.tooltip.next rows" data-l10n-arial-label="keyboard.tooltip.next rows"><svg class=svg-glyph aria-hidden="true"><use xlink:href=#svg-angle-down /></svg></button>',a+="</div>"}else i.markup&&(a+=i.markup);return i.container&&(a+="</div>"),i.backdrop&&(a+="</div>"),a}(e,n)),o.push("</div>");return o.join("")})(e,i,r)).join("")),a.insertAdjacentHTML("afterbegin",'<div class="MLK__resize-handle" role="separator" tabindex="0" data-l10n-tooltip="keyboard.tooltip.resize" data-l10n-arial-label="keyboard.tooltip.resize"></div>'),null==(i=a.querySelector(".MLK__resize-handle"))||i.addEventListener("pointerdown",i=>{i.stopPropagation(),function(e,i){let r=e.clientY,a=i.plateHeight,o=e.pointerId,n=e.currentTarget instanceof HTMLElement?e.currentTarget:null;i.beginUserResize();try{null==n||n.setPointerCapture(o)}catch(e){}let l=e=>{e.pointerId===o&&(i.setUserHeight(a+r-e.clientY),e.preventDefault())},s=e=>{if(e.pointerId===o){window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s);try{null!=n&&n.hasPointerCapture(o)&&n.releasePointerCapture(o)}catch(e){}i.endUserResize()}};window.addEventListener("pointermove",l,{passive:!1}),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),e.preventDefault()}(i,e)}),a.querySelectorAll(".MLK__page-button").forEach(i=>i.addEventListener("pointerdown",r=>{var a;r.stopPropagation(),e.pageRows(Number(null!=(a=i.dataset.pageDelta)?a:0)),r.preventDefault()}));let o=document.createElement("div");o.className="MLK__backdrop",o.appendChild(a),r.appendChild(o),r.addEventListener("pointerdown",s5,{passive:!1});let n=r.querySelectorAll(".ML__edit-toolbar");if(n)for(let i of n)i.addEventListener("click",i=>{var r,a;let o=i.target,n="";for(;o&&!n;)n=null!=(r=null==o?void 0:o.getAttribute("data-command"))?r:"",o=null!=(a=null==o?void 0:o.parentElement)?a:null;n&&e.executeCommand(JSON.parse(n))});for(let e of r.querySelectorAll(".MLK__keycap, .action, .fnbutton, .bigfnbutton"))!function(e){let i=ci.singleton;if(!i)return;let r={};if(!e.id){if(e.hasAttribute("data-label")&&(r.label=e.dataset.label),e.hasAttribute("data-latex")&&(r.latex=e.dataset.latex),e.hasAttribute("data-key")&&(r.key=e.dataset.key),e.hasAttribute("data-insert")&&(r.insert=e.dataset.insert),e.hasAttribute("data-variants")&&(r.variants=e.dataset.variants),e.hasAttribute("data-aside")&&(r.aside=e.dataset.aside),e.className&&(r.class=e.className),r.label||r.latex||r.key||r.insert||(r.latex=e.innerText,r.label=e.innerHTML),e.hasAttribute("data-command"))try{r.command=JSON.parse(e.dataset.command)}catch(e){console.warn("Invalid JSON in data-command attribute",e)}e.id=i.registerKeycap(r)}if(!e.innerHTML){let[i,a]=s3(r);e.innerHTML=globalThis.MathfieldElement.createHTML(i)}}(e);let l=r.querySelectorAll(".MLK__layer");for(let e of(l.length,l))e.addEventListener("pointerdown",e=>e.preventDefault());return e.currentLayer=e.latentLayer,I.update(r),r}(this),window.addEventListener("contextmenu",this,{capture:!0}),this.element.addEventListener("contextmenu",e=>{e.shiftKey||((e.ctrlKey||2===e.button)&&sZ(e.target),e.preventDefault(),e.stopPropagation())},{capture:!0}),null==(e=this.container)||e.appendChild(this.element),null!==this.userHeight){let e=this.element.querySelector(".MLK__plate");e&&(e.style.height=`${this.userHeight}px`)}}handleEvent(e){if(sH(e)){if(!np(e.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");if("disconnect"===e.data.action){if(this._visible)return;this.connectedMathfieldWindow=void 0}else"update-setting"!==e.data.action&&"proxy-created"!==e.data.action&&"execute-command"!==e.data.action&&(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":2!==e.button&&e.preventDefault();break;case"keydown":"Shift"!==e.key||e.repeat||(this.shiftPressCount=1);break;case"keyup":"Shift"!==e.key&&(e.getModifierState("Shift")||2===this.shiftPressCount)||(this.shiftPressCount=0)}}handleMessage(e,i){let{action:r}=e;if("execute-command"===r){let{command:r}=e,a=sF(r);if(window===window.top&&i!==window||i===window&&"virtual-keyboard"!==a)return;this.executeCommand(r);return}if(("connect"===r||"show"===r)&&this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},i),"disconnect"!==r&&!this.isSandbox){if("show"===r)return void(void 0!==e.animate?this.show({animate:e.animate}):this.show());if("hide"===r)return void(void 0!==e.animate?this.hide({animate:e.animate}):this.hide());if("update-setting"===r){if(e.alphabeticLayout&&(this.alphabeticLayout=e.alphabeticLayout),e.layouts&&(this.layouts=e.layouts),e.editToolbar&&(this.editToolbar=e.editToolbar),e.setKeycap){let{keycap:i,value:r}=e.setKeycap;this.setKeycap(i,r),this.render()}return}if("proxy-created"===r)return void this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},i)}}sendMessage(e,i,r){if(i.command&&this.dispatchEvent(new CustomEvent("math-virtual-keyboard-command",{detail:i.command})),r||(r=this.connectedMathfieldWindow),null===this.targetOrigin||"null"===this.targetOrigin||r===window)return void window.dispatchEvent(new MessageEvent("message",{source:window,origin:window.origin,data:f({type:sj,action:e},i)}));if(r)r.postMessage(f({type:sj,action:e},i),{targetOrigin:this.targetOrigin});else if("execute-command"===e&&Array.isArray(i.command)&&"insert"===i.command[0])for(let e of i.command[1].split(""))this.dispatchEvent(new KeyboardEvent("keydown",{key:e,bubbles:!0})),this.dispatchEvent(new KeyboardEvent("keyup",{key:e,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 i=this._element;if(!i)return;i.classList.toggle("is-math-mode","math"===e.mode),i.classList.toggle("is-text-mode","text"===e.mode),i.classList.toggle("can-undo",e.canUndo),i.classList.toggle("can-redo",e.canRedo),i.classList.toggle("can-copy",!e.selectionIsCollapsed),i.classList.toggle("can-cut",!e.selectionIsCollapsed),i.classList.toggle("can-paste",!0);let r=i.querySelectorAll(".ML__edit-toolbar");if(r)for(let i of r)i.innerHTML=function(e,i){let r="";if("none"===e.editToolbar)return"";let a=[];i.selectionIsCollapsed?a.push("undo","redo","pasteFromClipboard"):a.push("cutToClipboard","copyToClipboard","pasteFromClipboard");let o={undo:`<div class='action ${!1===i.canUndo?"disabled":""}'
3274
3300
  data-command='"undo"'
3275
3301
  data-tooltip='${N("tooltip.undo")}'>
3276
3302
  <svg><use xlink:href='#svg-undo' /></svg>
@@ -3302,29 +3328,29 @@ Note there are a different set of tooltip rules for the keyboard toggle
3302
3328
  data-tooltip='${N("tooltip.toggle virtual keyboard")}'>
3303
3329
  <svg><use xlink:href='#svg-keyboard-down' /></svg>
3304
3330
  </div>
3305
- `};return a.push("hideVirtualKeyboard"),r+=a.map(e=>o[e]).join("")}(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=sI(e)))return!1;let i,r=[],a=sO(e);return I(e)?("performWithFeedback"===(i=e[0])&&(a=sO(e.slice(1))),r=e.slice(1)):i=e,"virtual-keyboard"===a?sq[i].fn(void 0,...r):(this.sendMessage("execute-command",{command:e}),!1)}dispose(){window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("message",this)}};function s7(){let e=l2(),i=null;for(;e;){if("host"in e&&e.host instanceof uk){i=e.host;break}e=e.parentNode}return i}function s9(){let e=s5.singleton;return window.mathVirtualKeyboard!==e&&Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>e}),e}function ce(e){let i={};for(let r of Object.keys(e))switch(r){case"scriptDepth":let a=e.scriptDepth;if(I(a))i.scriptDepth=[a[0],a[1]];else if("number"==typeof a)i.scriptDepth=[a,a];else if("string"==typeof a){let[e,r]=a.split(",").map(e=>parseInt(e.trim()));i.scriptDepth=[e,r]}else throw TypeError("Unexpected value for scriptDepth");break;case"mathVirtualKeyboardPolicy":let o=e.mathVirtualKeyboardPolicy.toLowerCase();if("sandboxed"===o){let e=s9();e&&(e.isSandbox=!0),o="manual"}i.mathVirtualKeyboardPolicy=o;break;case"letterShapeStyle":"auto"===e.letterShapeStyle?R.locale.startsWith("fr")?i.letterShapeStyle="french":i.letterShapeStyle="tex":i.letterShapeStyle=e.letterShapeStyle;break;case"defaultMode":["text","math","inline-math"].includes(e.defaultMode)?i.defaultMode=e.defaultMode:(console.error('MathLive 0.110.6: valid values for defaultMode are "text", "math" or "inline-math"'),i.defaultMode="math");break;case"macros":i.macros=ek(e.macros);break;default:I(e[r])?i[r]=[...e[r]]:"object"!=typeof e[r]||e[r]instanceof Element||"computeEngine"===r?i[r]=e[r]:i[r]=f({},e[r])}return i}function ct(e,i){let r;r="string"==typeof i?[i]:void 0===i?Object.keys(e):i;let a={};for(let i of r)null===e[i]?a[i]=null:I(e[i])?a[i]=[...e[i]]:"object"!=typeof e[i]||e[i]instanceof Element||"computeEngine"===i?a[i]=e[i]:a[i]=f({},e[i]);return"string"==typeof i?a[i]:a}function ci(){return{readOnly:!1,defaultMode:"math",macros:{},registers:{},colorMap:U,backgroundColorMap:J,letterShapeStyle:R.locale.startsWith("fr")?"french":"tex",minFontScale:0,maxMatrixCols:10,smartMode:!1,smartFence:!0,smartSuperscript:!0,scriptDepth:[1/0,1/0],removeExtraneousParentheses:!0,isImplicitFunction:e=>["\\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(e),mathModeSpace:"",placeholderSymbol:"▢",contentPlaceholder:"",popoverPolicy:"auto",environmentPopoverPolicy:"off",keybindings:no,inlineShortcuts:o3,inlineShortcutTimeout:0,mathVirtualKeyboardPolicy:"auto",originValidator:"none",onInsertStyle:sr,onInlineShortcut:()=>"",onScrollIntoView:null,onExport:ni,value:""}}function cr(e){return"inline-math"===e.defaultMode?"math":e.defaultMode}function ca(e,i,r){let a=e.getCell(i,r);return(null==a?void 0:a.length)===2&&"placeholder"===a[1].type}function co(e,i,r,a){let o,n=(o=i.getCell(r,a))?[e.offsetOf(o[0]),e.offsetOf(o[o.length-1])]:-1;"number"!=typeof n&&e.setSelection(n)}function cn(e,i,r,a,o){let n=i.getCell(r,a);n&&e.setPositionHandlingPlaceholder(e.offsetOf(n["start"===o?0:n.length-1]))}function cl(e,i){let[r,[a,o]]=function(e,i){let r=e.at(e.position);for(;r&&!(r.parent instanceof nG);)r=r.parent;if((null==r?void 0:r.type)==="array"&&r.environmentName,!r||!(r.parent instanceof nG)){let a=e.at(e.position);if(!(r=a).parent.parent){let r=e.extractAtoms([e.position,e.lastOffset]),o=e.extractAtoms([0,e.position]),n;return i.endsWith("column")?(0===o.length&&(o=ch()),0===r.length&&(r=ch()),e.root=n=lO("split",[[o,r]]),ca(n,0,0)?co(e,n,0,0):ca(n,0,1)?co(e,n,0,1):e.position=e.offsetOf(a)):(e.root=n=lO("lines",[[o],[r]]),co(e,n,1,0)),[void 0,[0,0]]}if(r.parent instanceof n3){let a=r.parent,o=e.extractAtoms([e.position,e.offsetOf(a.lastChild)]),n=e.extractAtoms([e.offsetOf(a.firstChild),e.position]);0===n.length&&(n=ch()),0===o.length&&(o=ch());let l="pmatrix",s=a.leftDelim,c=a.rightDelim;"("===s&&(")"===c||"?"===c)?l="pmatrix":("["===s||"\\lbrack"===s)&&("]"===c||"\\rbrack"===c||"?"===c)?l="bmatrix":"\\vert"===s&&"\\vert"===c?l="vmatrix":"\\Vert"===s&&"\\Vert"===c?l="Vmatrix":("{"===s||"\\lbrace"===s)&&("."===c||"?"===c)&&(l="cases");let d=lO(l,i.endsWith("column")?[[n,o]]:[[n],[o]]);return a.parent.addChildBefore(d,a),a.parent.removeChild(a),ca(d,0,0)?co(e,d,0,0):i.endsWith("column")?ca(d,0,1)?co(e,d,0,1):e.position=e.offsetOf(r):ca(d,1,0)?co(e,d,1,0):e.position=e.offsetOf(r),[void 0,[0,0]]}}return r&&r.parent instanceof nG?[r.parent,r.parentBranch]:[void 0,[0,0]]}(e,i);if(r)switch(i){case"after row":r.addRowAfter(a),cn(e,r,a+1,0,"end");break;case"after column":if(r.maxColumns<=r.colCount)return void e.announce("plonk");r.addColumnAfter(o),cn(e,r,a,o+1,"end");break;case"before row":r.addRowBefore(a),cn(e,r,a,0,"start");break;case"before column":if(r.maxColumns<=r.colCount)return void e.announce("plonk");r.addColumnBefore(o),cn(e,r,a,o,"start")}}function cs(e){var i;let r=e.at(e.position);if(!oX(r.parentBranch)&&r.parent!==e.root&&"root"!==e.root.type)return e.announce("plonk"),!1;if(!e.contentWillChange({inputType:"insertText"}))return!1;if(null!=(i=e.parentEnvironment)&&i.isMultiline){e.selectionIsCollapsed||e.deleteAtoms(oQ(e.selection));let[i,r]=function(e){let i=e.at(e.position);for(;i&&!oX(i.parentBranch);)i=i.parent;return[i.firstSibling,i.lastSibling]}(e),a=e.extractAtoms([e.position,e.offsetOf(r)]),o=e.extractAtoms([e.offsetOf(i),e.position]),n=i.parent,[l,s]=i.parentBranch;return n.setCell(l,s,o),cl(e,"after row"),n.setCell(l+1,s,a),e.position=e.offsetOf(n.getCell(l+1,s)[0]),e.contentDidChange({inputType:"insertText"}),!0}return cl(e,"after row"),e.contentDidChange({inputType:"insertText"}),!0}function cc(e){return!!e.contentWillChange({inputType:"insertText"})&&(cl(e,"after column"),e.contentDidChange({inputType:"insertText"}),!0)}function cd(e,i){if(!e.contentWillChange({}))return!1;e.mathfield.snapshot();let r=".",a=".";switch(i){case"pmatrix":case"pmatrix*":r="(",a=")";break;case"bmatrix":case"bmatrix*":r="[",a="]";break;case"Bmatrix":case"Bmatrix*":r="\\lbrace",a="\\rbrace";break;case"vmatrix":case"vmatrix*":r="\\vert",a="\\vert";break;case"Vmatrix":case"Vmatrix*":r="\\Vert",a="\\Vert";break;case"matrix":case"matrix*":r=".",a=".";break;case"cases":case"dcases":r="\\lbrace";break;case"rcases":a="\\rbrace"}let o=e.at(e.position),n="array"===o.type?o:e.parentEnvironment;return n.environmentName=i,n.leftDelim=r,n.rightDelim=a,e.contentDidChange({}),!0}function cu(e,i){let r=e.at(e.position);for(;r&&!(Array.isArray(r.parentBranch)&&r.parent instanceof nG);)r=r.parent;if(Array.isArray(null==r?void 0:r.parentBranch)&&(null==r?void 0:r.parent)instanceof nG){let a=r.parent,o=r.parentBranch,n;switch(i){case"row":if(a.rowCount>1){a.removeRow(o[0]);let i=a.getCell(Math.max(0,o[0]-1),o[1]);n=e.offsetOf(i[i.length-1])}break;case"column":if(a.colCount>a.minColumns){a.removeColumn(o[1]);let i=a.getCell(o[0],Math.max(0,o[1]-1));n=e.offsetOf(i[i.length-1])}}void 0!==n&&e.setPositionHandlingPlaceholder(n)}}function ch(){return[new nj]}!v()||"mathVirtualKeyboard"in window||(window===window.top?s9():Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>sV.singleton,configurable:!0})),s$({addRowAfter:cs,addColumnAfter:cc,addRowBefore:function(e){return!!e.contentWillChange({inputType:"insertText"})&&(cl(e,"before row"),e.contentDidChange({inputType:"insertText"}),!0)},addColumnBefore:function(e){return!!e.contentWillChange({inputType:"insertText"})&&(cl(e,"before column"),e.contentDidChange({inputType:"insertText"}),!0)},removeRow:function(e){return!!e.contentWillChange({inputType:"deleteContent"})&&(cu(e,"row"),e.contentDidChange({inputType:"deleteContent"}),!0)},removeColumn:function(e){return!!e.contentWillChange({inputType:"deleteContent"})&&(cu(e,"column"),e.contentDidChange({inputType:"deleteContent"}),!0)},setEnvironment:cd},{target:"model",canUndo:!0,changeContent:!0,changeSelection:!0});var cp=class e{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(i){return!!this.recording&&(i&&i===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>e.maximumDepth&&(this.stack.shift(),this.index-=1),this.lastOp=null!=i?i:"",!0)}};function cm(e,i,r,a){var o,n,l,s,c,d;let u=r.parent;if(oX(a)&&r instanceof nG&&r.isMultiline&&function(e,i,r,a){if(!(i instanceof nG)||!i.isMultiline||1===i.rows.length||i.rows[r].length>1)return!1;let o=i.getCell(r,0);if(!o)return!1;if(i.removeRow(r),"backward"===a){let a=i.getCell(r-1,0);if(!a)return e.position=e.offsetOf(i),!0;a.length>0?e.position=e.offsetOf(a[a.length-1]):e.position=e.offsetOf(i),i.setCell(r-1,0,[...a,...o])}else{let a=i.getCell(r,0);if(!a)return e.position=e.offsetOf(i),!0;a.length>0?e.position=e.offsetOf(a[0]):e.position=e.offsetOf(i),i.setCell(r,0,[...o,...a])}return!0}(e,r,a[0],i))return!0;if(u&&r instanceof n3){let o=!a&&"forward"===i||"body"===a&&"backward"===i,n=o?e.offsetOf(r.firstChild):e.offsetOf(r.lastChild);return o?"?"!==r.rightDelim&&"."!==r.rightDelim?(r.leftDelim=".",r.isDirty=!0):(u.addChildrenAfter(r.removeBranch("body"),r),u.removeChild(r),n--):"?"!==r.leftDelim&&"."!==r.leftDelim?(r.rightDelim=".",r.isDirty=!0):(u.addChildrenAfter(r.removeBranch("body"),r),u.removeChild(r),n--),e.position=n,!0}if(u&&"surd"===r.type){if(("forward"!==i||a)&&("backward"!==i||"body"!==a))"forward"===i&&"body"===a?e.position=e.offsetOf(r):a||"backward"!==i?"above"===a&&(r.hasEmptyBranch("above")&&r.removeBranch("above"),"backward"===i?e.position=e.offsetOf(r.leftSibling):e.position=e.offsetOf(r.body[0])):r.hasChildren?e.position=e.offsetOf(r.lastChild):(e.position=Math.max(0,e.offsetOf(r)-1),u.removeChild(r));else{let i=r.leftSibling;r.hasChildren&&u.addChildrenAfter(r.removeBranch("body"),r),u.removeChild(r),e.position=e.offsetOf(i)}return!0}if(u&&("box"===r.type||"enclose"===r.type)){let o=a&&"backward"===i||!a&&"forward"===i?r.leftSibling:r.lastChild;return u.addChildrenAfter(r.removeBranch("body"),r),u.removeChild(r),e.position=e.offsetOf(o),!0}if("genfrac"===r.type||"overunder"===r.type){if(!a)return!("overunder"===r.type&&r.hasEmptyBranch("body")||"genfrac"===r.type&&r.hasEmptyBranch("below")&&r.hasEmptyBranch("above"))&&(e.position=e.offsetOf("forward"===i?r.firstChild:r.lastChild),!0);let o="numerator-denominator"===uk.fractionNavigationOrder?"above":"below",n="above"===o?"below":"above";if(u&&("forward"===i&&a===o||"backward"===i&&a===n)){let i=r.removeBranch(o),a=r.removeBranch(n);return u.addChildrenAfter([...i,...a],r),u.removeChild(r),e.position=e.offsetOf(i.length>0?i[i.length-1]:a[0]),!0}return"backward"===i?e.position=e.offsetOf(r.leftSibling):e.position=e.offsetOf(r),!0}if("extensible-symbol"===r.type||"subsup"===r.type||"operator"===r.type){if(!a&&"forward"===i)return!1;if(!a){if(r.subscript||r.superscript){let a="forward"===i?null!=(l=null==(o=r.superscript)?void 0:o[0])?l:null==(n=r.subscript)?void 0:n[0]:null!=(d=null==(s=r.subscript)?void 0:s[0].lastSibling)?d:null==(c=r.superscript)?void 0:c[0].lastSibling;return a&&(e.position=e.offsetOf(a)),!0}return!1}if(!r.hasChildren&&"subsup"===r.type){let a="forward"===i?e.offsetOf(r):Math.max(0,e.offsetOf(r)-1);return r.parent.removeChild(r),e.position=a,!0}if(a&&r.hasEmptyBranch(a)){if(r.removeBranch(a),"subsup"===r.type&&!r.subscript&&!r.superscript){let a="forward"===i?e.offsetOf(r):Math.max(0,e.offsetOf(r)-1);return r.parent.removeChild(r),e.position=a,!0}return"superscript"===a&&"backward"===i?e.position=e.offsetOf(r.firstChild)-1:"subscript"===a&&"backward"===i?r.superscript?e.position=e.offsetOf(r.superscript[0].lastSibling):e.position=e.offsetOf(r.firstChild)-1:e.position=e.offsetOf(r),!0}if("superscript"===a)if("backward"===i){let i=e.offsetOf(r.firstChild)-1;e.position=i}else r.subscript?e.position=e.offsetOf(r.subscript[0]):e.position=e.offsetOf(r);else"subscript"===a&&("backward"===i&&r.superscript?e.position=e.offsetOf(r.superscript[0].lastSibling):"backward"===i?e.position=e.offsetOf(r.firstChild)-1:e.position=e.offsetOf(r));return!0}if((null==u?void 0:u.type)==="genfrac"&&!a&&"first"!==r.type){let i=e.offsetOf(r.leftSibling);return u.removeChild(r),u.hasEmptyBranch("above")&&u.hasEmptyBranch("below")?(i=e.offsetOf(u.leftSibling),u.parent.removeChild(u),e.announce("delete",void 0,[u])):e.announce("delete",void 0,[r]),e.position=i,!0}if("backward"===i&&((null==u?void 0:u.command)==="\\ln"||(null==u?void 0:u.command)==="\\log")&&"body"!==r.parentBranch){let i=e.offsetOf(u.leftSibling);return u.parent.removeChild(u),e.announce("delete",void 0,[u]),e.position=i,!0}return!1}function cf(e,i,r){let a=e.getAtoms(i);if(a.length>0&&a[0].parent){let o=a[0];for(;o&&!(o instanceof nG);)o=o.parent;let n=a[a.length-1];for(;n&&!(n instanceof nG);)n=n.parent;if(o&&o instanceof nG){let i=o;if(i&&n===i&&i.isMultiline){let[a,o]=[Math.min(e.position,e.anchor),Math.max(e.position,e.anchor)],[n,l]=e.at(a).parentBranch,[s,c]=e.at(o).parentBranch;if(s-n+1>=2)return e.deferNotifications({content:!0,selection:!0,type:r},()=>{var r;let d=i.getCell(n,l),u=i.getCell(s,c);if(!d||!u)return;e.extractAtoms([a,o]);let h=i.getCell(n,l);i.getCell(s,c);for(let e=s-1;e>n;e--)i.removeRow(e);if(n!==s){let e=i.getCell(n+1,l);if(h&&e){let r=[...h.filter(e=>"first"!==e.type),...e.filter(e=>"first"!==e.type)];i.setCell(n,l,r),i.removeRow(n+1)}}let p=i.getCell(n,l);if(p){let i=h?h.filter(e=>"first"!==e.type).length:0;e.position=e.offsetOf(null!=(r=p[i])?r:p[0])}else e.position=a;i.isDirty=!0})}}let l=a[0].parent.firstChild;"first"===l.type&&(l=l.rightSibling);let s=a[a.length-1].parent.lastChild,c=a[0];"first"===c.type&&(c=c.rightSibling);let d=a[a.length-1];if(c===l&&d===s){let r=a[0].parent;r.parent&&"prompt"!==r.type&&(i=[e.offsetOf(r.leftSibling),e.offsetOf(r)])}if(1===a.length&&"placeholder"===a[0].type&&"genfrac"===a[0].parent.type){let i=a[0].parent,o="below"===a[0].parentBranch?"above":"below",n=e.offsetOf(i.leftSibling);return e.deferNotifications({content:!0,selection:!0,type:r},()=>{var r,a;let l=i.removeBranch(o);if(1===l.length&&"placeholder"===l[0].type)null==(a=i.parent)||a.removeChild(i),e.position=Math.max(0,n);else{let a=i.parent.addChildrenAfter(l,i);null==(r=i.parent)||r.removeChild(i),e.position=e.offsetOf(a)}})}}return e.deferNotifications({content:!0,selection:!0,type:r},()=>{let r=new Map;if(a.length>0){let e=a[0],i=a[a.length-1],o=new Set,n=e.parent;for(;n;)("surd"===n.type||"box"===n.type||"enclose"===n.type||"leftright"===n.type||"genfrac"===n.type||"overunder"===n.type)&&n.parent&&o.add(n),n=n.parent;let l=new Set;for(n=i.parent;n;)("surd"===n.type||"box"===n.type||"enclose"===n.type||"leftright"===n.type||"genfrac"===n.type||"overunder"===n.type)&&n.parent&&l.add(n),n=n.parent;for(let e of a)for(n=e.parent;n;){if(("surd"===n.type||"box"===n.type||"enclose"===n.type||"leftright"===n.type||"genfrac"===n.type||"overunder"===n.type)&&n.parent){r.has(n)||r.set(n,{containsStart:o.has(n),containsEnd:l.has(n)});break}n=n.parent}}let o=Math.min(...i);for(let[a,o]of(e.deleteAtoms(i),r)){if(!a.parent)continue;let i=o.containsStart!==o.containsEnd;if("surd"===a.type||"box"===a.type||"enclose"===a.type||"leftright"===a.type){let r=a.branch("body");if(r&&0!==r.length&&(1!==r.length||"placeholder"!==r[0].type)){if(i&&!o.containsStart&&o.containsEnd){let i=e.offsetOf(a.leftSibling),r=a.removeBranch("body");r&&r.length>0&&a.parent.addChildrenAfter(r,a),a.parent.removeChild(a),e.position=Math.max(0,i)}}else{let i=e.offsetOf(a.leftSibling);a.parent.removeChild(a),e.position=Math.max(0,i)}}if("genfrac"===a.type){let r=a.branch("above"),n=a.branch("below"),l=!r||0===r.length||1===r.length&&"placeholder"===r[0].type,s=!n||0===n.length||1===n.length&&"placeholder"===n[0].type;if(l&&s){let i=e.offsetOf(a.leftSibling);a.parent.removeChild(a),e.position=Math.max(0,i)}else if(l&&!s){let i=e.offsetOf(a.leftSibling),r=a.removeBranch("below");r&&r.length>0&&a.parent.addChildrenAfter(r,a),a.parent.removeChild(a),e.position=Math.max(0,i)}else if(!l&&s){let i=e.offsetOf(a.leftSibling),r=a.removeBranch("above");r&&r.length>0&&a.parent.addChildrenAfter(r,a),a.parent.removeChild(a),e.position=Math.max(0,i)}else if(i&&!o.containsStart&&o.containsEnd&&!l&&!s){let i=e.offsetOf(a.leftSibling),r=a.removeBranch("above");r&&r.length>0&&a.parent.addChildrenAfter(r,a),a.parent.removeChild(a),e.position=Math.max(0,i)}}}0===r.size&&(e.position=o),e.root.hasEmptyBranch("body")&&e.mathfield.flushInlineShortcutBuffer()})}function cg(e,i,r){var a,o,n,l,s,c,d,u;let h=e.position;null!=(a=null==r?void 0:r.extend)&&a||e.collapseSelection(i);let p=e.at(e.position);if("forward"===i&&("subsup"===p.type&&(p=p.rightSibling)||(p=e.at(e.position+1))),!p)return e.announce("plonk"),!1;let m=e.offsetOf(p);if(p instanceof oY)m=function(e,i,r){var a,o;if("text"!==e.at(i).mode)return i;let n="backward"===r?-1:1,l;if(er.test(e.at(i).value)){let r=i,a;do a="text"===e.at(r).mode&&er.test(e.at(r).value),r+=n;while(e.at(r)&&a)l=e.at(r)?r-2*n:r-n}else if(/\s/.test(e.at(i).value)){let r=i;for(;(null==(a=e.at(r))?void 0:a.mode)==="text"&&/\s/.test(e.at(r).value);)r+=n;if(e.at(r)){let i=!0;do i="text"===e.at(r).mode&&!/\s/.test(e.at(r).value),r+=n;while(e.at(r)&&i)l=e.at(r)?r-2*n:r-n}else l=r-n}else{let r=i;for(;(null==(o=e.at(r))?void 0:o.mode)==="text"&&!/\s/.test(e.at(r).value);)r+=n;l=e.at(r)?r:r-n;let a=!0;for(;e.at(r)&&a;)(a="text"===e.at(r).mode&&/\s/.test(e.at(r).value))&&(l=r),r+=n;l=e.at(r)?r-2*n:r-n}return l-(n>0?0:1)}(e,m,i);else if(p instanceof lm)if(p.isSuggestion)for(;p&&p instanceof lm;)p.isSuggestion=!1,m=e.offsetOf(p),p=p.rightSibling;else if("forward"===i){if(!(p=p.rightSibling)||!(p instanceof lm))return e.announce("plonk"),!1;for(;p&&p instanceof lm&&/[a-zA-Z\*]/.test(p.value);)m=e.offsetOf(p),p=p.rightSibling}else{if(!(p=p.leftSibling)||!(p instanceof lm))return e.announce("plonk"),!1;for(;p&&p instanceof lm&&/[a-zA-Z\*]/.test(p.value);)m=e.offsetOf(p),p=p.leftSibling}else if("forward"===i&&"mopen"===p.type){let i=0;do"mopen"===p.type?i+=1:"mclose"===p.type&&(i-=1),p=p.rightSibling;while(!p.isLastSibling&&0!==i)m=e.offsetOf(p.leftSibling)}else if("backward"===i&&"mclose"===p.type){let i=0;do"mopen"===p.type?i+=1:"mclose"===p.type&&(i-=1),p=p.leftSibling;while(!p.isFirstSibling&&0!==i)m=e.offsetOf(p)}else if("backward"===i)if("first"===p.type)for(;m>0&&"first"===p.type;)m-=1,p=e.at(m);else{let i=p.type;"subsup"===p.type&&(m=e.offsetOf(e.at(m).leftSibling)),m-=1;let r=null==(o=e.at(m))?void 0:o.type;for(;m>=0&&r===i;)(null==(n=e.at(m))?void 0:n.type)==="subsup"?m=e.offsetOf(e.at(m).leftSibling):m-=1,r=e.at(m).type}else{let{type:i}=p,r=null==(l=e.at(m))?void 0:l.type,{lastOffset:a}=e;for(;m<=a&&(r===i||"subsup"===r);){for(;(null==(s=e.at(m).rightSibling)?void 0:s.type)==="subsup";)m=e.offsetOf(e.at(m).rightSibling);m+=1,r=null==(c=e.at(m))?void 0:c.type}m-=1}if(null!=(d=null==r?void 0:r.extend)&&d){if(!e.setSelection(e.anchor,m))return e.announce("plonk"),!1;e.announce("move",h)}else{if(m===e.position)return e.announce("plonk"),!1;null!=(u=null==r?void 0:r.delete)&&u?"forward"===i?cf(e,[h,m],"deleteWordForward"):(cf(e,[h,m],"deleteWordBackward"),e.position=m):(e.position=m,e.announce("move",h))}return e.mathfield.stopCoalescingUndo(),!0}function cb(e,i,r){var a,o;if(r=null!=r?r:{extend:!1},e.mathfield.styleBias="backward"===i?"right":"left","forward"!==i){let[i,r]=st(e);void 0!==i&&void 0!==r&&e.deleteAtoms([i,r])}if("upward"===i)return function(e,i){var r,a;let o=null!=(r=null==i?void 0:i.extend)&&r;o||e.collapseSelection("backward");let n=()=>{var i,r;let a=!0;return e.silenceNotifications||(a=null==(r=null==(i=e.mathfield.host)?void 0:i.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"upward"},cancelable:!0,bubbles:!0,composed:!0})))||r),e.announce(a?"line":"plonk"),a},l=e.at(e.position),s=l;for(;s&&"below"!==s.parentBranch&&!(Array.isArray(s.parentBranch)&&s.parent instanceof nG);)s=s.parent;if(Array.isArray(null==s?void 0:s.parentBranch)&&s.parent instanceof nG){let i=s.parent;if(s.parentBranch[0]<1)return n();let r=s.parentBranch[0]-1,a=i.getCell(r,s.parentBranch[1]);if(!a.some(e=>"prompt"===e.type&&!e.captureSelection)&&e.mathfield.hasEditablePrompts)return n();cx(e,l,a,o,"up")}else{if(!s)return n();let i=null!=(a=s.parent.branch("above"))?a:s.parent.createBranch("above");if(!i.some(e=>"prompt"===e.type&&e.placeholderId)&&e.mathfield.hasEditablePrompts)return n();cx(e,l,i,o,"up")}return e.mathfield.stopCoalescingUndo(),!0}(e,r);if("downward"===i)return function(e,i){var r,a;let o=null!=(r=null==i?void 0:i.extend)&&r;o||e.collapseSelection("forward");let n=()=>{var i,r;let a=!0;return e.silenceNotifications||(a=null==(r=null==(i=e.mathfield.host)?void 0:i.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"downward"},cancelable:!0,bubbles:!0,composed:!0})))||r),e.announce(a?"line":"plonk"),a},l=e.at(e.position),s=l;for(;s&&"above"!==s.parentBranch&&!(oX(s.parentBranch)&&s.parent instanceof nG);)s=s.parent;if(oX(null==s?void 0:s.parentBranch)&&s.parent instanceof nG){let i=s.parent;if(s.parentBranch[0]+1>i.rows.length-1)return n();let r=s.parentBranch[0]+1,a=i.getCell(r,s.parentBranch[1]);if(!a.some(e=>"prompt"===e.type&&!e.captureSelection)&&e.mathfield.hasEditablePrompts)return n();cx(e,l,a,o,"down")}else{if(!s)return n();let i=null!=(a=s.parent.branch("below"))?a:s.parent.createBranch("below");if(!i.some(e=>"prompt"===e.type)&&e.mathfield.hasEditablePrompts)return n();cx(e,l,i,o,"down")}return!0}(e,r);if(r.extend){let r=cy(e,e.position,i);r<0&&(r=0),r>e.lastOffset&&(r=e.lastOffset);let a=e.setSelection(e.anchor,r);return e.mathfield.stopCoalescingUndo(),a}if(e.selectionIsPlaceholder){e.collapseSelection(i);let r=cb(e,i);return e.mathfield.stopCoalescingUndo(),r}let n=e.position,l=n;if(e.collapseSelection(i)?(n=e.position,cv(e,n)||(n=cy(e,n,i))):n=cy(e,n,i),n<0||n>e.lastOffset){let r=!0;return e.silenceNotifications||(r=null==(o=null==(a=e.mathfield.host)?void 0:a.dispatchEvent(new CustomEvent("move-out",{detail:{direction:i},cancelable:!0,bubbles:!0,composed:!0})))||o),r&&e.announce("plonk"),r}return e.setPositionHandlingPlaceholder(n),e.mathfield.stopCoalescingUndo(),e.announce("move",l),!0}function cy(e,i,r){return(i+="forward"===r?1:-1)<0||i>e.lastOffset||cv(e,i)?i:cy(e,i,r)}function cv(e,i){var r;let a=e.at(i),o=a.parent;for(;o&&!o.inCaptureSelection;)o=o.parent;return!(null!=o&&o.inCaptureSelection||null!=(r=a.parent)&&r.skipBoundary&&(!a.isFirstSibling&&a.isLastSibling||"first"===a.type)||e.mathfield.hasEditablePrompts&&!a.parentPrompt)}function cx(e,i,r,a,o){let n=e.mathfield.hasEditablePrompts,l=n?r.filter(e=>"prompt"===e.type&&!e.captureSelection):r,s=nm(e.mathfield.getHTMLElement(i)).right,c=e.offsetOf(function(e,i,r){let a=1/0,o=0;for(;o<i.length;o++){let n=i[o],l=e.getHTMLElement(n);if(!l)continue;let s=Math.abs(r-nm(l).right);if(s<=a)a=s;else break}return i[o-1]}(e.mathfield,l,s))-!!n;if(a){let[i,r]=e.selection.ranges[0],a;a=c<("up"===o?i:r)?{ranges:[[c,r]],direction:"backward"}:{ranges:[[i,c]],direction:"forward"},e.setSelection(a)}else e.setPositionHandlingPlaceholder(c);e.announce(`move ${o}`)}function c_(e){let i=e.position,r=e.at(i).parent;return null!=r&&r.parent?(e.position=e.offsetOf(r),e.mathfield.stopCoalescingUndo(),e.announce("move",i),!0):(e.announce("plonk"),!1)}function cw(e){if(e.collapseSelection(),function(e){let i=0,r=e.at(e.position),a=!1;for(;r;)r.hasEmptyBranch("superscript")?r.hasEmptyBranch("subscript")||(a=!1):(i+=1,a=!0),r=r.parent;return a?i:0}(e)>=e.mathfield.options.scriptDepth[1])return e.announce("plonk"),!1;let i=e.at(e.position);if(void 0===i.subsupPlacement){let e=i.rightSibling;(null==e?void 0:e.type)!=="subsup"&&(e=new n7({style:i.style}),i.parent.addChildAfter(e,i)),i=e}return i.createBranch("superscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(i.superscript[0]))),!0}function ck(e){if(e.collapseSelection(),function(e){let i=0,r=e.at(e.position),a=!1;for(;r;)r.hasEmptyBranch("subscript")?r.hasEmptyBranch("superscript")||(a=!1):(i+=1,a=!0),r=r.parent;return a?i:0}(e)>=e.mathfield.options.scriptDepth[0])return e.announce("plonk"),!1;let i=e.at(e.position);if(void 0===i.subsupPlacement){let e=i.rightSibling;(null==e?void 0:e.type)!=="subsup"&&(e=new n7({style:i.style}),i.parent.addChildAfter(e,i)),i=e}return i.createBranch("subscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(i.subscript[0]))),!0}function cM(e,i,r="forward"){let a=e.position;if(I(i)){let o=e.offsetOf(i[0]),n=e.offsetOf(i[i.length-1]);return"forward"===r?e.setSelection(o,n):e.setSelection(n,o),e.announce("move",a),e.mathfield.stopCoalescingUndo(),!0}return"forward"===r?cM(e,[i.leftSibling,i]):cM(e,[i,i.leftSibling])}function cS(e,i){let r=e.position;if("number"==typeof i&&(i=e.at(i)),"prompt"===i.type)e.setSelection(e.offsetOf(i.firstChild),e.offsetOf(i.lastChild));else{let r=e.offsetOf(i);"placeholder"===i.type?e.setSelection(r-1,r):e.position=r}return e.announce("move",r),e.mathfield.stopCoalescingUndo(),!0}function cL(e,i){var r,a;let o="forward"===i?1:-1;"placeholder"===e.at(e.anchor).type&&cb(e,i);let n,l=e.at(e.anchor).parentPrompt;n=l?"forward"===i?e.offsetOf(l)+1:e.offsetOf(l.leftSibling):Math.max(e.position+o,0);let s=cC(e,n,i);if(!s||"forward"===i&&e.offsetOf(s)<n||"backward"===i&&e.offsetOf(s)>n){if(!(null==(a=null==(r=e.mathfield.host)?void 0:r.dispatchEvent(new CustomEvent("move-out",{detail:{direction:i},cancelable:!0,bubbles:!0,composed:!0})))||a))return e.announce("plonk"),!1;let n=function(){var e;let i,r;function a(e){var i;let r=Number.parseInt(null!=(i=e.getAttribute("tabindex"))?i:"NaN",10);return Number.isNaN(r)?"true"===e.contentEditable||("AUDIO"===e.nodeName||"VIDEO"===e.nodeName)&&null===e.getAttribute("tabindex")?0:e.tabIndex:r}return v()?(e=document.body,i=[],r=[],[...e.querySelectorAll(`input, select, textarea, a[href], button,
3331
+ `};return a.push("hideVirtualKeyboard"),r+=a.map(e=>o[e]).join("")}(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=sV(e)))return!1;let i,r=[],a=sF(e);return R(e)?("performWithFeedback"===(i=e[0])&&(a=sF(e.slice(1))),r=e.slice(1)):i=e,"virtual-keyboard"===a?sW[i].fn(void 0,...r):(this.sendMessage("execute-command",{command:e}),!1)}dispose(){window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("message",this)}};function cr(){let e=l9(),i=null;for(;e;){if("host"in e&&e.host instanceof uE){i=e.host;break}e=e.parentNode}return i}function ca(){let e=ci.singleton;return window.mathVirtualKeyboard!==e&&Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>e}),e}function co(e){let i={};for(let r of Object.keys(e))switch(r){case"scriptDepth":let a=e.scriptDepth;if(R(a))i.scriptDepth=[a[0],a[1]];else if("number"==typeof a)i.scriptDepth=[a,a];else if("string"==typeof a){let[e,r]=a.split(",").map(e=>parseInt(e.trim()));i.scriptDepth=[e,r]}else throw TypeError("Unexpected value for scriptDepth");break;case"mathVirtualKeyboardPolicy":let o=e.mathVirtualKeyboardPolicy.toLowerCase();if("sandboxed"===o){let e=ca();e&&(e.isSandbox=!0),o="manual"}i.mathVirtualKeyboardPolicy=o;break;case"letterShapeStyle":"auto"===e.letterShapeStyle?I.locale.startsWith("fr")?i.letterShapeStyle="french":i.letterShapeStyle="tex":i.letterShapeStyle=e.letterShapeStyle;break;case"defaultMode":["text","math","inline-math"].includes(e.defaultMode)?i.defaultMode=e.defaultMode:(console.error('MathLive 0.110.8: valid values for defaultMode are "text", "math" or "inline-math"'),i.defaultMode="math");break;case"macros":i.macros=ek(e.macros);break;default:R(e[r])?i[r]=[...e[r]]:"object"!=typeof e[r]||e[r]instanceof Element||"computeEngine"===r?i[r]=e[r]:i[r]=f({},e[r])}return i}function cn(e,i){let r;r="string"==typeof i?[i]:void 0===i?Object.keys(e):i;let a={};for(let i of r)null===e[i]?a[i]=null:R(e[i])?a[i]=[...e[i]]:"object"!=typeof e[i]||e[i]instanceof Element||"computeEngine"===i?a[i]=e[i]:a[i]=f({},e[i]);return"string"==typeof i?a[i]:a}function cl(){return{readOnly:!1,defaultMode:"math",macros:{},registers:{},colorMap:U,backgroundColorMap:J,letterShapeStyle:I.locale.startsWith("fr")?"french":"tex",minFontScale:0,maxMatrixCols:10,smartMode:!1,smartFence:!0,smartSuperscript:!0,scriptDepth:[1/0,1/0],removeExtraneousParentheses:!0,isImplicitFunction:e=>["\\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(e),mathModeSpace:"",placeholderSymbol:"▢",contentPlaceholder:"",popoverPolicy:"auto",environmentPopoverPolicy:"off",keybindings:no,inlineShortcuts:o3,inlineShortcutTimeout:0,mathVirtualKeyboardPolicy:"auto",originValidator:"none",onInsertStyle:sc,onInlineShortcut:()=>"",onScrollIntoView:null,onExport:ni,value:""}}function cs(e){return"inline-math"===e.defaultMode?"math":e.defaultMode}function cc(e,i,r){let a=e.getCell(i,r);return(null==a?void 0:a.length)===2&&"placeholder"===a[1].type}function cd(e,i,r,a){let o,n=(o=i.getCell(r,a))?[e.offsetOf(o[0]),e.offsetOf(o[o.length-1])]:-1;"number"!=typeof n&&e.setSelection(n)}function cu(e,i,r,a,o){let n=i.getCell(r,a);n&&e.setPositionHandlingPlaceholder(e.offsetOf(n["start"===o?0:n.length-1]))}function ch(e,i){let[r,[a,o]]=function(e,i){let r=e.at(e.position);for(;r&&!(r.parent instanceof nQ);)r=r.parent;if((null==r?void 0:r.type)==="array"&&r.environmentName,!r||!(r.parent instanceof nQ)){let a=e.at(e.position);if(!(r=a).parent.parent){let r=e.extractAtoms([e.position,e.lastOffset]),o=e.extractAtoms([0,e.position]),n;return i.endsWith("column")?(0===o.length&&(o=cb()),0===r.length&&(r=cb()),e.root=n=lV("split",[[o,r]]),cc(n,0,0)?cd(e,n,0,0):cc(n,0,1)?cd(e,n,0,1):e.position=e.offsetOf(a)):(e.root=n=lV("lines",[[o],[r]]),cd(e,n,1,0)),[void 0,[0,0]]}if(r.parent instanceof le){let a=r.parent,o=e.extractAtoms([e.position,e.offsetOf(a.lastChild)]),n=e.extractAtoms([e.offsetOf(a.firstChild),e.position]);0===n.length&&(n=cb()),0===o.length&&(o=cb());let l="pmatrix",s=a.leftDelim,c=a.rightDelim;"("===s&&(")"===c||"?"===c)?l="pmatrix":("["===s||"\\lbrack"===s)&&("]"===c||"\\rbrack"===c||"?"===c)?l="bmatrix":"\\vert"===s&&"\\vert"===c?l="vmatrix":"\\Vert"===s&&"\\Vert"===c?l="Vmatrix":("{"===s||"\\lbrace"===s)&&("."===c||"?"===c)&&(l="cases");let d=lV(l,i.endsWith("column")?[[n,o]]:[[n],[o]]);return a.parent.addChildBefore(d,a),a.parent.removeChild(a),cc(d,0,0)?cd(e,d,0,0):i.endsWith("column")?cc(d,0,1)?cd(e,d,0,1):e.position=e.offsetOf(r):cc(d,1,0)?cd(e,d,1,0):e.position=e.offsetOf(r),[void 0,[0,0]]}}return r&&r.parent instanceof nQ?[r.parent,r.parentBranch]:[void 0,[0,0]]}(e,i);if(r)switch(i){case"after row":r.addRowAfter(a),cu(e,r,a+1,0,"end");break;case"after column":if(r.maxColumns<=r.colCount)return void e.announce("plonk");r.addColumnAfter(o),cu(e,r,a,o+1,"end");break;case"before row":r.addRowBefore(a),cu(e,r,a,0,"start");break;case"before column":if(r.maxColumns<=r.colCount)return void e.announce("plonk");r.addColumnBefore(o),cu(e,r,a,o,"start")}}function cp(e){var i;let r=e.at(e.position);if(!oX(r.parentBranch)&&r.parent!==e.root&&"root"!==e.root.type)return e.announce("plonk"),!1;if(!e.contentWillChange({inputType:"insertText"}))return!1;if(null!=(i=e.parentEnvironment)&&i.isMultiline){e.selectionIsCollapsed||e.deleteAtoms(oQ(e.selection));let[i,r]=function(e){let i=e.at(e.position);for(;i&&!oX(i.parentBranch);)i=i.parent;return[i.firstSibling,i.lastSibling]}(e),a=e.extractAtoms([e.position,e.offsetOf(r)]),o=e.extractAtoms([e.offsetOf(i),e.position]),n=i.parent,[l,s]=i.parentBranch;return n.setCell(l,s,o),ch(e,"after row"),n.setCell(l+1,s,a),e.position=e.offsetOf(n.getCell(l+1,s)[0]),e.contentDidChange({inputType:"insertText"}),!0}return ch(e,"after row"),e.contentDidChange({inputType:"insertText"}),!0}function cm(e){return!!e.contentWillChange({inputType:"insertText"})&&(ch(e,"after column"),e.contentDidChange({inputType:"insertText"}),!0)}function cf(e,i){if(!e.contentWillChange({}))return!1;e.mathfield.snapshot();let r=".",a=".";switch(i){case"pmatrix":case"pmatrix*":r="(",a=")";break;case"bmatrix":case"bmatrix*":r="[",a="]";break;case"Bmatrix":case"Bmatrix*":r="\\lbrace",a="\\rbrace";break;case"vmatrix":case"vmatrix*":r="\\vert",a="\\vert";break;case"Vmatrix":case"Vmatrix*":r="\\Vert",a="\\Vert";break;case"matrix":case"matrix*":r=".",a=".";break;case"cases":case"dcases":r="\\lbrace";break;case"rcases":a="\\rbrace"}let o=e.at(e.position),n="array"===o.type?o:e.parentEnvironment;return n.environmentName=i,n.leftDelim=r,n.rightDelim=a,e.contentDidChange({}),!0}function cg(e,i){let r=e.at(e.position);for(;r&&!(Array.isArray(r.parentBranch)&&r.parent instanceof nQ);)r=r.parent;if(Array.isArray(null==r?void 0:r.parentBranch)&&(null==r?void 0:r.parent)instanceof nQ){let a=r.parent,o=r.parentBranch,n;switch(i){case"row":if(a.rowCount>1){a.removeRow(o[0]);let i=a.getCell(Math.max(0,o[0]-1),o[1]);n=e.offsetOf(i[i.length-1])}break;case"column":if(a.colCount>a.minColumns){a.removeColumn(o[1]);let i=a.getCell(o[0],Math.max(0,o[1]-1));n=e.offsetOf(i[i.length-1])}}void 0!==n&&e.setPositionHandlingPlaceholder(n)}}function cb(){return[new nU]}!v()||"mathVirtualKeyboard"in window||(window===window.top?ca():Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>sJ.singleton,configurable:!0})),sN({addRowAfter:cp,addColumnAfter:cm,addRowBefore:function(e){return!!e.contentWillChange({inputType:"insertText"})&&(ch(e,"before row"),e.contentDidChange({inputType:"insertText"}),!0)},addColumnBefore:function(e){return!!e.contentWillChange({inputType:"insertText"})&&(ch(e,"before column"),e.contentDidChange({inputType:"insertText"}),!0)},removeRow:function(e){return!!e.contentWillChange({inputType:"deleteContent"})&&(cg(e,"row"),e.contentDidChange({inputType:"deleteContent"}),!0)},removeColumn:function(e){return!!e.contentWillChange({inputType:"deleteContent"})&&(cg(e,"column"),e.contentDidChange({inputType:"deleteContent"}),!0)},setEnvironment:cf},{target:"model",canUndo:!0,changeContent:!0,changeSelection:!0});var cy=class e{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(i){return!!this.recording&&(i&&i===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>e.maximumDepth&&(this.stack.shift(),this.index-=1),this.lastOp=null!=i?i:"",!0)}};function cv(e,i,r,a){var o,n,l,s,c,d;let u=r.parent;if(oX(a)&&r instanceof nQ&&r.isMultiline&&function(e,i,r,a){if(!(i instanceof nQ)||!i.isMultiline||1===i.rows.length||i.rows[r].length>1)return!1;let o=i.getCell(r,0);if(!o)return!1;if(i.removeRow(r),"backward"===a){let a=i.getCell(r-1,0);if(!a)return e.position=e.offsetOf(i),!0;a.length>0?e.position=e.offsetOf(a[a.length-1]):e.position=e.offsetOf(i),i.setCell(r-1,0,[...a,...o])}else{let a=i.getCell(r,0);if(!a)return e.position=e.offsetOf(i),!0;a.length>0?e.position=e.offsetOf(a[0]):e.position=e.offsetOf(i),i.setCell(r,0,[...o,...a])}return!0}(e,r,a[0],i))return!0;if(u&&r instanceof le){let o=!a&&"forward"===i||"body"===a&&"backward"===i,n=o?e.offsetOf(r.firstChild):e.offsetOf(r.lastChild);return o?"?"!==r.rightDelim&&"."!==r.rightDelim?(r.leftDelim=".",r.isDirty=!0):(u.addChildrenAfter(r.removeBranch("body"),r),u.removeChild(r),n--):"?"!==r.leftDelim&&"."!==r.leftDelim?(r.rightDelim=".",r.isDirty=!0):(u.addChildrenAfter(r.removeBranch("body"),r),u.removeChild(r),n--),e.position=n,!0}if(u&&"surd"===r.type){if(("forward"!==i||a)&&("backward"!==i||"body"!==a))"forward"===i&&"body"===a?e.position=e.offsetOf(r):a||"backward"!==i?"above"===a&&(r.hasEmptyBranch("above")&&r.removeBranch("above"),"backward"===i?e.position=e.offsetOf(r.leftSibling):e.position=e.offsetOf(r.body[0])):r.hasChildren?e.position=e.offsetOf(r.lastChild):(e.position=Math.max(0,e.offsetOf(r)-1),u.removeChild(r));else{let i=r.leftSibling;r.hasChildren&&u.addChildrenAfter(r.removeBranch("body"),r),u.removeChild(r),e.position=e.offsetOf(i)}return!0}if(u&&("box"===r.type||"enclose"===r.type)){let o=a&&"backward"===i||!a&&"forward"===i?r.leftSibling:r.lastChild;return u.addChildrenAfter(r.removeBranch("body"),r),u.removeChild(r),e.position=e.offsetOf(o),!0}if("genfrac"===r.type||"overunder"===r.type){if(!a)return!("overunder"===r.type&&r.hasEmptyBranch("body")||"genfrac"===r.type&&r.hasEmptyBranch("below")&&r.hasEmptyBranch("above"))&&(e.position=e.offsetOf("forward"===i?r.firstChild:r.lastChild),!0);let o="numerator-denominator"===uE.fractionNavigationOrder?"above":"below",n="above"===o?"below":"above";if(u&&("forward"===i&&a===o||"backward"===i&&a===n)){let i=r.removeBranch(o),a=r.removeBranch(n);return u.addChildrenAfter([...i,...a],r),u.removeChild(r),e.position=e.offsetOf(i.length>0?i[i.length-1]:a[0]),!0}return"backward"===i?e.position=e.offsetOf(r.leftSibling):e.position=e.offsetOf(r),!0}if("extensible-symbol"===r.type||"subsup"===r.type||"operator"===r.type){if(!a&&"forward"===i)return!1;if(!a){if(r.subscript||r.superscript){let a="forward"===i?null!=(l=null==(o=r.superscript)?void 0:o[0])?l:null==(n=r.subscript)?void 0:n[0]:null!=(d=null==(s=r.subscript)?void 0:s[0].lastSibling)?d:null==(c=r.superscript)?void 0:c[0].lastSibling;return a&&(e.position=e.offsetOf(a)),!0}return!1}if(!r.hasChildren&&"subsup"===r.type){let a="forward"===i?e.offsetOf(r):Math.max(0,e.offsetOf(r)-1);return r.parent.removeChild(r),e.position=a,!0}if(a&&r.hasEmptyBranch(a)){if(r.removeBranch(a),"subsup"===r.type&&!r.subscript&&!r.superscript){let a="forward"===i?e.offsetOf(r):Math.max(0,e.offsetOf(r)-1);return r.parent.removeChild(r),e.position=a,!0}return"superscript"===a&&"backward"===i?e.position=e.offsetOf(r.firstChild)-1:"subscript"===a&&"backward"===i?r.superscript?e.position=e.offsetOf(r.superscript[0].lastSibling):e.position=e.offsetOf(r.firstChild)-1:e.position=e.offsetOf(r),!0}if("superscript"===a)if("backward"===i){let i=e.offsetOf(r.firstChild)-1;e.position=i}else r.subscript?e.position=e.offsetOf(r.subscript[0]):e.position=e.offsetOf(r);else"subscript"===a&&("backward"===i&&r.superscript?e.position=e.offsetOf(r.superscript[0].lastSibling):"backward"===i?e.position=e.offsetOf(r.firstChild)-1:e.position=e.offsetOf(r));return!0}if((null==u?void 0:u.type)==="genfrac"&&!a&&"first"!==r.type){let i=e.offsetOf(r.leftSibling);return u.removeChild(r),u.hasEmptyBranch("above")&&u.hasEmptyBranch("below")?(i=e.offsetOf(u.leftSibling),u.parent.removeChild(u),e.announce("delete",void 0,[u])):e.announce("delete",void 0,[r]),e.position=i,!0}if("backward"===i&&((null==u?void 0:u.command)==="\\ln"||(null==u?void 0:u.command)==="\\log")&&"body"!==r.parentBranch){let i=e.offsetOf(u.leftSibling);return u.parent.removeChild(u),e.announce("delete",void 0,[u]),e.position=i,!0}return!1}function cx(e,i,r){let a=e.getAtoms(i);if(a.length>0&&a[0].parent){let o=a[0];for(;o&&!(o instanceof nQ);)o=o.parent;let n=a[a.length-1];for(;n&&!(n instanceof nQ);)n=n.parent;if(o&&o instanceof nQ){let i=o;if(i&&n===i&&i.isMultiline){let[a,o]=[Math.min(e.position,e.anchor),Math.max(e.position,e.anchor)],[n,l]=e.at(a).parentBranch,[s,c]=e.at(o).parentBranch;if(s-n+1>=2)return e.deferNotifications({content:!0,selection:!0,type:r},()=>{var r;let d=i.getCell(n,l),u=i.getCell(s,c);if(!d||!u)return;e.extractAtoms([a,o]);let h=i.getCell(n,l);i.getCell(s,c);for(let e=s-1;e>n;e--)i.removeRow(e);if(n!==s){let e=i.getCell(n+1,l);if(h&&e){let r=[...h.filter(e=>"first"!==e.type),...e.filter(e=>"first"!==e.type)];i.setCell(n,l,r),i.removeRow(n+1)}}let p=i.getCell(n,l);if(p){let i=h?h.filter(e=>"first"!==e.type).length:0;e.position=e.offsetOf(null!=(r=p[i])?r:p[0])}else e.position=a;i.isDirty=!0})}}let l=a[0].parent.firstChild;"first"===l.type&&(l=l.rightSibling);let s=a[a.length-1].parent.lastChild,c=a[0];"first"===c.type&&(c=c.rightSibling);let d=a[a.length-1];if(c===l&&d===s){let r=a[0].parent;r.parent&&"prompt"!==r.type&&(i=[e.offsetOf(r.leftSibling),e.offsetOf(r)])}if(1===a.length&&"placeholder"===a[0].type&&"genfrac"===a[0].parent.type){let i=a[0].parent,o="below"===a[0].parentBranch?"above":"below",n=e.offsetOf(i.leftSibling);return e.deferNotifications({content:!0,selection:!0,type:r},()=>{var r,a;let l=i.removeBranch(o);if(1===l.length&&"placeholder"===l[0].type)null==(a=i.parent)||a.removeChild(i),e.position=Math.max(0,n);else{let a=i.parent.addChildrenAfter(l,i);null==(r=i.parent)||r.removeChild(i),e.position=e.offsetOf(a)}})}}return e.deferNotifications({content:!0,selection:!0,type:r},()=>{let r=new Map;if(a.length>0){let e=a[0],i=a[a.length-1],o=new Set,n=e.parent;for(;n;)("surd"===n.type||"box"===n.type||"enclose"===n.type||"leftright"===n.type||"genfrac"===n.type||"overunder"===n.type)&&n.parent&&o.add(n),n=n.parent;let l=new Set;for(n=i.parent;n;)("surd"===n.type||"box"===n.type||"enclose"===n.type||"leftright"===n.type||"genfrac"===n.type||"overunder"===n.type)&&n.parent&&l.add(n),n=n.parent;for(let e of a)for(n=e.parent;n;){if(("surd"===n.type||"box"===n.type||"enclose"===n.type||"leftright"===n.type||"genfrac"===n.type||"overunder"===n.type)&&n.parent){r.has(n)||r.set(n,{containsStart:o.has(n),containsEnd:l.has(n)});break}n=n.parent}}let o=Math.min(...i);for(let[a,o]of(e.deleteAtoms(i),r)){if(!a.parent)continue;let i=o.containsStart!==o.containsEnd;if("surd"===a.type||"box"===a.type||"enclose"===a.type||"leftright"===a.type){let r=a.branch("body");if(r&&0!==r.length&&(1!==r.length||"placeholder"!==r[0].type)){if(i&&!o.containsStart&&o.containsEnd){let i=e.offsetOf(a.leftSibling),r=a.removeBranch("body");r&&r.length>0&&a.parent.addChildrenAfter(r,a),a.parent.removeChild(a),e.position=Math.max(0,i)}}else{let i=e.offsetOf(a.leftSibling);a.parent.removeChild(a),e.position=Math.max(0,i)}}if("genfrac"===a.type){let r=a.branch("above"),n=a.branch("below"),l=!r||0===r.length||1===r.length&&"placeholder"===r[0].type,s=!n||0===n.length||1===n.length&&"placeholder"===n[0].type;if(l&&s){let i=e.offsetOf(a.leftSibling);a.parent.removeChild(a),e.position=Math.max(0,i)}else if(l&&!s){let i=e.offsetOf(a.leftSibling),r=a.removeBranch("below");r&&r.length>0&&a.parent.addChildrenAfter(r,a),a.parent.removeChild(a),e.position=Math.max(0,i)}else if(!l&&s){let i=e.offsetOf(a.leftSibling),r=a.removeBranch("above");r&&r.length>0&&a.parent.addChildrenAfter(r,a),a.parent.removeChild(a),e.position=Math.max(0,i)}else if(i&&!o.containsStart&&o.containsEnd&&!l&&!s){let i=e.offsetOf(a.leftSibling),r=a.removeBranch("above");r&&r.length>0&&a.parent.addChildrenAfter(r,a),a.parent.removeChild(a),e.position=Math.max(0,i)}}}0===r.size&&(e.position=o),e.root.hasEmptyBranch("body")&&e.mathfield.flushInlineShortcutBuffer()})}function c_(e,i,r){var a,o,n,l,s,c,d,u;let h=e.position;null!=(a=null==r?void 0:r.extend)&&a||e.collapseSelection(i);let p=e.at(e.position);if("forward"===i&&("subsup"===p.type&&(p=p.rightSibling)||(p=e.at(e.position+1))),!p)return e.announce("plonk"),!1;let m=e.offsetOf(p);if(p instanceof oY)m=function(e,i,r){var a,o;if("text"!==e.at(i).mode)return i;let n="backward"===r?-1:1,l;if(er.test(e.at(i).value)){let r=i,a;do a="text"===e.at(r).mode&&er.test(e.at(r).value),r+=n;while(e.at(r)&&a)l=e.at(r)?r-2*n:r-n}else if(/\s/.test(e.at(i).value)){let r=i;for(;(null==(a=e.at(r))?void 0:a.mode)==="text"&&/\s/.test(e.at(r).value);)r+=n;if(e.at(r)){let i=!0;do i="text"===e.at(r).mode&&!/\s/.test(e.at(r).value),r+=n;while(e.at(r)&&i)l=e.at(r)?r-2*n:r-n}else l=r-n}else{let r=i;for(;(null==(o=e.at(r))?void 0:o.mode)==="text"&&!/\s/.test(e.at(r).value);)r+=n;l=e.at(r)?r:r-n;let a=!0;for(;e.at(r)&&a;)(a="text"===e.at(r).mode&&/\s/.test(e.at(r).value))&&(l=r),r+=n;l=e.at(r)?r-2*n:r-n}return l-(n>0?0:1)}(e,m,i);else if(p instanceof lx)if(p.isSuggestion)for(;p&&p instanceof lx;)p.isSuggestion=!1,m=e.offsetOf(p),p=p.rightSibling;else if("forward"===i){if(!(p=p.rightSibling)||!(p instanceof lx))return e.announce("plonk"),!1;for(;p&&p instanceof lx&&/[a-zA-Z\*]/.test(p.value);)m=e.offsetOf(p),p=p.rightSibling}else{if(!(p=p.leftSibling)||!(p instanceof lx))return e.announce("plonk"),!1;for(;p&&p instanceof lx&&/[a-zA-Z\*]/.test(p.value);)m=e.offsetOf(p),p=p.leftSibling}else if("forward"===i&&"mopen"===p.type){let i=0;do"mopen"===p.type?i+=1:"mclose"===p.type&&(i-=1),p=p.rightSibling;while(!p.isLastSibling&&0!==i)m=e.offsetOf(p.leftSibling)}else if("backward"===i&&"mclose"===p.type){let i=0;do"mopen"===p.type?i+=1:"mclose"===p.type&&(i-=1),p=p.leftSibling;while(!p.isFirstSibling&&0!==i)m=e.offsetOf(p)}else if("backward"===i)if("first"===p.type)for(;m>0&&"first"===p.type;)m-=1,p=e.at(m);else{let i=p.type;"subsup"===p.type&&(m=e.offsetOf(e.at(m).leftSibling)),m-=1;let r=null==(o=e.at(m))?void 0:o.type;for(;m>=0&&r===i;)(null==(n=e.at(m))?void 0:n.type)==="subsup"?m=e.offsetOf(e.at(m).leftSibling):m-=1,r=e.at(m).type}else{let{type:i}=p,r=null==(l=e.at(m))?void 0:l.type,{lastOffset:a}=e;for(;m<=a&&(r===i||"subsup"===r);){for(;(null==(s=e.at(m).rightSibling)?void 0:s.type)==="subsup";)m=e.offsetOf(e.at(m).rightSibling);m+=1,r=null==(c=e.at(m))?void 0:c.type}m-=1}if(null!=(d=null==r?void 0:r.extend)&&d){if(!e.setSelection(e.anchor,m))return e.announce("plonk"),!1;e.announce("move",h)}else{if(m===e.position)return e.announce("plonk"),!1;null!=(u=null==r?void 0:r.delete)&&u?"forward"===i?cx(e,[h,m],"deleteWordForward"):(cx(e,[h,m],"deleteWordBackward"),e.position=m):(e.position=m,e.announce("move",h))}return e.mathfield.stopCoalescingUndo(),!0}function cw(e,i,r){var a,o;if(r=null!=r?r:{extend:!1},e.mathfield.styleBias="backward"===i?"right":"left","forward"!==i){let[i,r]=sl(e);void 0!==i&&void 0!==r&&e.deleteAtoms([i,r])}if("upward"===i)return function(e,i){var r,a;let o=null!=(r=null==i?void 0:i.extend)&&r;o||e.collapseSelection("backward");let n=()=>{var i,r;let a=!0;return e.silenceNotifications||(a=null==(r=null==(i=e.mathfield.host)?void 0:i.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"upward"},cancelable:!0,bubbles:!0,composed:!0})))||r),e.announce(a?"line":"plonk"),a},l=e.at(e.position),s=l;for(;s&&"below"!==s.parentBranch&&!(Array.isArray(s.parentBranch)&&s.parent instanceof nQ);)s=s.parent;if(Array.isArray(null==s?void 0:s.parentBranch)&&s.parent instanceof nQ){let i=s.parent;if(s.parentBranch[0]<1)return n();let r=s.parentBranch[0]-1,a=i.getCell(r,s.parentBranch[1]);if(!a.some(e=>"prompt"===e.type&&!e.captureSelection)&&e.mathfield.hasEditablePrompts)return n();cS(e,l,a,o,"up")}else{if(!s)return n();let i=null!=(a=s.parent.branch("above"))?a:s.parent.createBranch("above");if(!i.some(e=>"prompt"===e.type&&e.placeholderId)&&e.mathfield.hasEditablePrompts)return n();cS(e,l,i,o,"up")}return e.mathfield.stopCoalescingUndo(),!0}(e,r);if("downward"===i)return function(e,i){var r,a;let o=null!=(r=null==i?void 0:i.extend)&&r;o||e.collapseSelection("forward");let n=()=>{var i,r;let a=!0;return e.silenceNotifications||(a=null==(r=null==(i=e.mathfield.host)?void 0:i.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"downward"},cancelable:!0,bubbles:!0,composed:!0})))||r),e.announce(a?"line":"plonk"),a},l=e.at(e.position),s=l;for(;s&&"above"!==s.parentBranch&&!(oX(s.parentBranch)&&s.parent instanceof nQ);)s=s.parent;if(oX(null==s?void 0:s.parentBranch)&&s.parent instanceof nQ){let i=s.parent;if(s.parentBranch[0]+1>i.rows.length-1)return n();let r=s.parentBranch[0]+1,a=i.getCell(r,s.parentBranch[1]);if(!a.some(e=>"prompt"===e.type&&!e.captureSelection)&&e.mathfield.hasEditablePrompts)return n();cS(e,l,a,o,"down")}else{if(!s)return n();let i=null!=(a=s.parent.branch("below"))?a:s.parent.createBranch("below");if(!i.some(e=>"prompt"===e.type)&&e.mathfield.hasEditablePrompts)return n();cS(e,l,i,o,"down")}return!0}(e,r);if(r.extend){let r=ck(e,e.position,i);r<0&&(r=0),r>e.lastOffset&&(r=e.lastOffset);let a=e.setSelection(e.anchor,r);return e.mathfield.stopCoalescingUndo(),a}if(e.selectionIsPlaceholder){e.collapseSelection(i);let r=cw(e,i);return e.mathfield.stopCoalescingUndo(),r}let n=e.position,l=n;if(e.collapseSelection(i)?(n=e.position,cM(e,n)||(n=ck(e,n,i))):n=ck(e,n,i),n<0||n>e.lastOffset){let r=!0;return e.silenceNotifications||(r=null==(o=null==(a=e.mathfield.host)?void 0:a.dispatchEvent(new CustomEvent("move-out",{detail:{direction:i},cancelable:!0,bubbles:!0,composed:!0})))||o),r&&e.announce("plonk"),r}return e.setPositionHandlingPlaceholder(n),e.mathfield.stopCoalescingUndo(),e.announce("move",l),!0}function ck(e,i,r){return(i+="forward"===r?1:-1)<0||i>e.lastOffset||cM(e,i)?i:ck(e,i,r)}function cM(e,i){var r;let a=e.at(i),o=a.parent;for(;o&&!o.inCaptureSelection;)o=o.parent;return!(null!=o&&o.inCaptureSelection||null!=(r=a.parent)&&r.skipBoundary&&(!a.isFirstSibling&&a.isLastSibling||"first"===a.type)||e.mathfield.hasEditablePrompts&&!a.parentPrompt)}function cS(e,i,r,a,o){let n=e.mathfield.hasEditablePrompts,l=n?r.filter(e=>"prompt"===e.type&&!e.captureSelection):r,s=nm(e.mathfield.getHTMLElement(i)).right,c=e.offsetOf(function(e,i,r){let a=1/0,o=0;for(;o<i.length;o++){let n=i[o],l=e.getHTMLElement(n);if(!l)continue;let s=Math.abs(r-nm(l).right);if(s<=a)a=s;else break}return i[o-1]}(e.mathfield,l,s))-!!n;if(a){let[i,r]=e.selection.ranges[0],a;a=c<("up"===o?i:r)?{ranges:[[c,r]],direction:"backward"}:{ranges:[[i,c]],direction:"forward"},e.setSelection(a)}else e.setPositionHandlingPlaceholder(c);e.announce(`move ${o}`)}function cL(e){let i=e.position,r=e.at(i).parent;return null!=r&&r.parent?(e.position=e.offsetOf(r),e.mathfield.stopCoalescingUndo(),e.announce("move",i),!0):(e.announce("plonk"),!1)}function cC(e){if(e.collapseSelection(),function(e){let i=0,r=e.at(e.position),a=!1;for(;r;)r.hasEmptyBranch("superscript")?r.hasEmptyBranch("subscript")||(a=!1):(i+=1,a=!0),r=r.parent;return a?i:0}(e)>=e.mathfield.options.scriptDepth[1])return e.announce("plonk"),!1;let i=e.at(e.position);if(void 0===i.subsupPlacement){let e=i.rightSibling;(null==e?void 0:e.type)!=="subsup"&&(e=new la({style:i.style}),i.parent.addChildAfter(e,i)),i=e}return i.createBranch("superscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(i.superscript[0]))),!0}function cE(e){if(e.collapseSelection(),function(e){let i=0,r=e.at(e.position),a=!1;for(;r;)r.hasEmptyBranch("subscript")?r.hasEmptyBranch("superscript")||(a=!1):(i+=1,a=!0),r=r.parent;return a?i:0}(e)>=e.mathfield.options.scriptDepth[0])return e.announce("plonk"),!1;let i=e.at(e.position);if(void 0===i.subsupPlacement){let e=i.rightSibling;(null==e?void 0:e.type)!=="subsup"&&(e=new la({style:i.style}),i.parent.addChildAfter(e,i)),i=e}return i.createBranch("subscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(i.subscript[0]))),!0}function cA(e,i,r="forward"){let a=e.position;if(R(i)){let o=e.offsetOf(i[0]),n=e.offsetOf(i[i.length-1]);return"forward"===r?e.setSelection(o,n):e.setSelection(n,o),e.announce("move",a),e.mathfield.stopCoalescingUndo(),!0}return"forward"===r?cA(e,[i.leftSibling,i]):cA(e,[i,i.leftSibling])}function cz(e,i){let r=e.position;if("number"==typeof i&&(i=e.at(i)),"prompt"===i.type)e.setSelection(e.offsetOf(i.firstChild),e.offsetOf(i.lastChild));else{let r=e.offsetOf(i);"placeholder"===i.type?e.setSelection(r-1,r):e.position=r}return e.announce("move",r),e.mathfield.stopCoalescingUndo(),!0}function cT(e,i){var r,a;let o="forward"===i?1:-1;"placeholder"===e.at(e.anchor).type&&cw(e,i);let n,l=e.at(e.anchor).parentPrompt;n=l?"forward"===i?e.offsetOf(l)+1:e.offsetOf(l.leftSibling):Math.max(e.position+o,0);let s=cD(e,n,i);if(!s||"forward"===i&&e.offsetOf(s)<n||"backward"===i&&e.offsetOf(s)>n){if(!(null==(a=null==(r=e.mathfield.host)?void 0:r.dispatchEvent(new CustomEvent("move-out",{detail:{direction:i},cancelable:!0,bubbles:!0,composed:!0})))||a))return e.announce("plonk"),!1;let n=function(){var e;let i,r;function a(e){var i;let r=Number.parseInt(null!=(i=e.getAttribute("tabindex"))?i:"NaN",10);return Number.isNaN(r)?"true"===e.contentEditable||("AUDIO"===e.nodeName||"VIDEO"===e.nodeName)&&null===e.getAttribute("tabindex")?0:e.tabIndex:r}return v()?(e=document.body,i=[],r=[],[...e.querySelectorAll(`input, select, textarea, a[href], button,
3306
3332
  [tabindex], audio[controls], video[controls],
3307
- [contenteditable]:not([contenteditable="false"]), details>summary`)].filter(function(e){var i,r;return!((i=e).disabled||"hidden"===i.type&&"INPUT"===i.tagName.toUpperCase()||function(e){if(!v()||e===document.activeElement||e.contains(document.activeElement))return!1;if("hidden"===getComputedStyle(e).visibility)return!0;let i=e.getBoundingClientRect();if(0===i.width||0===i.height)return!0;for(;e;){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(i)||"INPUT"===(r=e).tagName.toUpperCase()&&"radio"===r.type&&!function(e){var i;if(!e.name)return!0;let r=function(e,i){for(let r of e)if(r.checked&&r.form===i)return r;return null}((null!=(i=e.form)?i:e.ownerDocument).querySelectorAll('input[type="radio"][name="'+e.name+'"]'),e.form);return!r||r===e}(r)||0>a(e))}).forEach((e,o)=>{let n=a(e);0===n?i.push(e):r.push({documentOrder:o,tabIndex:n,node:e})}),r.sort((e,i)=>e.tabIndex===i.tabIndex?e.documentOrder-i.documentOrder:e.tabIndex-i.tabIndex).map(e=>e.node).concat(i)):[]}();if(!document.activeElement||n.length<=1)return e.announce("plonk"),!1;let l=n.indexOf(document.activeElement)+o;return l<0&&(l=n.length-1),l>=n.length&&(l=0),n[l].focus(),e.mathfield.stopCoalescingUndo(),!0}return cS(e,s),!0}function cC(e,i=0,r="forward"){return e.findAtom(i=>"placeholder"===i.type||"prompt"===i.type||!e.mathfield.readOnly&&i.treeDepth>2&&i.isFirstSibling&&i.isLastSibling,i,r)}function cE(e,i,r,a){if("forward"===a){let e=i.rightSibling;for(;e&&!r(e);)e=e.rightSibling;return e}let o=i.leftSibling;for(;o&&!r(o);)o=o.leftSibling;return o}function cA(e,i,r){"function"==typeof i&&(r=i,i=1/0),void 0===i&&(i=1/0);let a=e.position,o=!1,n="";for(;!o;){let l=e.at(a);(o=0===i||void 0===l||"first"===l.type||"math"!==l.mode||!(l.type&&/mord|mpunct|operator/.test(l.type)||"mop"===l.type&&/[a-zA-Z ]+/.test(l.value))||!l.hasEmptyBranch("superscript")||!l.hasEmptyBranch("subscript")||"function"==typeof r&&!r(l))||(l.mode="text",l.command=l.value,l.verbatimLatex=void 0,n+=l.value),a-=1,i-=1}e.contentDidChange({data:n,inputType:"insertText"})}function cz(e,i,r){"function"==typeof i&&(r=i,i=1/0),void 0===i&&(i=1/0);let a=e.position,o=!1,n=[];for(;!o;){let l=e.at(a);(o=0===i||!l||"first"===l.type||l.isFirstSibling||"text"!==l.mode||" "===l.value||"function"==typeof r&&!r(l))||(n.push(oG.serialize([l],{defaultMode:"math"})),l.mode="math"),a-=1,i-=1}cT(e),e.contentDidChange({data:of(n),inputType:"insertText"})}function cT(e){var i;let r=e.position-1;for(;r>=0&&(null==(i=e.at(r))?void 0:i.mode)==="math";)r-=1;if(!(r<0)&&"text"===e.at(r).mode&&" "===e.at(r).value&&"math"===e.at(r-1).mode){e.at(r-1).parent.removeChild(e.at(r-1));let i=e.silenceNotifications;e.silenceNotifications=!0,e.position-=1,e.silenceNotifications=i,e.contentDidChange({inputType:"deleteContent"})}}function cD(){return document.getElementById("mathlive-keystroke-caption-panel")||(nL("keystroke-caption"),nL("core"),sd("mathlive-keystroke-caption-panel"))}function cK(e,i){var r,a,o,n;let{model:l}=e,s=l8(i);if(i.isTrusted){!function(e){var i,r;if(!e||"Unidentified"===e.key||"Dead"===e.key)return;let a=e.shiftKey&&e.altKey?3:e.altKey?2:+!!e.shiftKey;for(let o of T)(null==(i=o.mapping[e.code])?void 0:i[a])===e.key?o.score+=1:null!=(r=o.mapping[e.code])&&r[a]&&(o.score=0);T.sort((e,i)=>i.score-e.score)}(i);let r=$();e.keyboardLayout!==r.id&&(e.keyboardLayout=r.id,e._keybindings=void 0)}if(clearTimeout(e.inlineShortcutBufferFlushTimer),e.inlineShortcutBufferFlushTimer=0,function(e,i){if(!e.isSelectionEditable||!e.keystrokeCaptionVisible)return;let r=cD(),a=e.element.getBoundingClientRect();r.style.left=`${a.left}px`,r.style.top=`${a.top-64}px`,r.innerHTML=globalThis.MathfieldElement.createHTML("<span>"+(lY(i)||i)+"</span>"+r.innerHTML),r.style.visibility="visible",setTimeout(()=>{r.childNodes.length>0&&r.childNodes[r.childNodes.length-1].remove(),0===r.childNodes.length&&(r.style.visibility="hidden")},3e3)}(e,s),i.isTrusted&&i.defaultPrevented)return e.flushInlineShortcutBuffer(),!1;let c,d=0,u="",h=0,p=e.inlineShortcutBuffer,m=!1;if(e.isSelectionEditable&&l.selectionIsPlaceholder&&l4(i)&&(e.flushInlineShortcutBuffer(),l.deleteAtoms(oQ(l.selection)),e.snapshot("delete"),m=!0),e.isSelectionEditable){if("math"===l.mode&&(!l.selectionIsPlaceholder||m))if("[Backspace]"===s)"insert-shortcut"===e.undoManager.lastOp?u="undo":p.pop();else if(l4(i)){let o=l6(i),n=[...null!=(a=null==(r=p[p.length-1])?void 0:r.keystrokes)?a:[],o];p.push({state:l.getState(),keystrokes:n,leftSiblings:function(e){let i=e.model,r=[],a=i.at(Math.min(i.position,i.anchor));for(;"first"!==a.type;)r.push(a),a=a.leftSibling;return r}(e)}),d=0;let s="";for(;!c&&d<n.length;)h=p.length-(n.length-d),s=n.slice(d).join(""),!(c=o2(p[h].leftSiblings,s,e.options.inlineShortcuts))&&/^[a-zA-Z][a-zA-Z0-9]+?([_\^][a-zA-Z0-9\*\+\-]+?)?$/.test(s)&&(c=e.options.onInlineShortcut(e,s)),d+=1;e.flushInlineShortcutBuffer({defer:!0})}else e.flushInlineShortcutBuffer();e.options.smartMode&&(c?e.switchMode("math"):function(e,i,r){var a,o;let{model:n}=e;if("latex"===n.mode||!n.at(n.position).isLastSibling||!r||!l4(r))return!1;let l=l6(r);if(!n.selectionIsCollapsed)return!!("text"===e.model.mode&&/[/_^]/.test(l));let s=function(e){let i="",r=e.position,a=!1;for(;!a;){let o=e.at(r);(a=!(o&&("text"===o.mode||"math"===o.mode&&o.type&&/mord|mpunct/.test(o.type))))||(i=o.value+i),r-=1}return i}(n)+l;if("text"===e.model.mode){if("Esc"===i||/[/\\]/.test(l))return!0;if(/[\^_]/.test(l))return/(^|\s)[a-zA-Z][^_]$/.test(s)&&cz(n,1),!0;let e={")":"(","}":"{","]":"["}[l],{parent:r}=n.at(n.position);if(e&&r instanceof n3&&r.leftDelim===e)return!0;if(/(^|[^a-zA-Z])(a|I) $/.test(s))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(l))return!0;if(/(^|[^a-zA-Z'’])[a-zA-Z] $/.test(s))return cz(n,1),!1;if(/\D\.[^\d\s]$/.test(s)){cz(n,1);let e=n.at(n.position);return e.value="⋅",e.style.variant="normal",e.command="\\cdot",e.verbatimLatex=void 0,n.contentDidChange({data:"\\cdot",inputType:"insertText"}),!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(s)||/\.\d$/.test(s)||/\([\d+\-.]$/.test(s))return cz(n,1),!0;if(/\([a-z][,;]$/.test(s))return cz(n,2),!0;if(/[\d+\-=><*|]$/.test(l))return cT(n),!0}else{if("[Space]"===i)return cA(n,void 0,e=>/[a-z][:,;.]$/.test(e.value)),!0;if(/[a-zA-Z]{3,}$/.test(s)&&!/(dxd|abc|xyz|uvw)$/.test(s)){let i=null!=(o=null==(a=/[a-zA-Z]+$/.exec(s))?void 0:a[0])?o:"",r=e.options.inlineShortcuts;if(!(i&&r&&Object.keys(r).some(e=>e.startsWith(i))))return cA(n,void 0,e=>/[a-zA-Z]/.test(e.value)),!0}if(/(^|\W)(if)$/i.test(s))return cA(n,1),!0;if(/(\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5){3,}$/u.test(s)&&!/(αβγ)$/.test(s))return cA(n,void 0,e=>/(:|,|;|.|\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5)/u.test(e.value)),!0;if("?"===l||"."===l&&!/[\d-+]\.$/.test(s))return!0}return!1}(e,s,i)&&(e.switchMode({math:"text",text:"math"}[l.mode]),u=""))}if(!c){if(u||(u=function(e,i,r){if(0===e.length)return"";let a=E(C(l8(r))),o=E({key:r.key,shift:r.shiftKey,alt:r.altKey,ctrl:r.ctrlKey,meta:r.metaKey||r.ctrlKey&&/macos|ios/.test(w()),cmd:!1,win:!1});for(let r=e.length-1;r>=0;r--)if((e[r].key===a||e[r].key===o)&&(!e[r].ifMode||e[r].ifMode===i))return e[r].command;return""}(e.keybindings,l.mode,i)),!u&&("[Enter]"===s||"[Return]"===s)){if(sg())return!1;let r=!0;return l.contentWillChange({inputType:"insertLineBreak"})&&(e.host&&(r=e.host.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),!r&&i.preventDefault?(i.preventDefault(),i.stopPropagation()):(null!=(o=l.parentEnvironment)&&o.isMultiline&&e.executeCommand("addRowAfter"),l.contentDidChange({inputType:"insertLineBreak"}))),r}if("[Space]"===s&&"latex"===l.mode&&sc(e,"accept-all"))return e.dirty=!0,e.scrollIntoView(),i.preventDefault&&(i.preventDefault(),i.stopPropagation()),!1;if((!u||"[Space]"===s)&&"math"===l.mode){if("[Space]"===s){if(e.styleBias="none",e.flushInlineShortcutBuffer(),e.options.mathModeSpace)return na.insert(l,e.options.mathModeSpace,{format:"latex",mode:"math"}),e.snapshot("insert-space"),u="",e.dirty=!0,e.scrollIntoView(),i.preventDefault&&(i.preventDefault(),i.stopPropagation()),!1;let r=l.at(l.position+1),a=l.at(l.position-1);if((null==r?void 0:r.mode)==="text"||(null==a?void 0:a.mode)==="text")return na.insert(l," ",{mode:"text"}),e.snapshot("insert-space"),e.dirty=!0,e.scrollIntoView(),!1}null!=(n=l.at(l.position))&&n.isDigit()&&","===globalThis.MathfieldElement.decimalSeparator&&","===l6(i)&&(u="insertDecimalSeparator")}}if(!c&&!u){if(l.mathfield.smartFence){if(function e(i,r,a){var o;if(!r||"math"!==i.mode)return!1;let n=i.at(i.position),{parent:l}=n,s={"(":"(",")":")","{":"\\lbrace","}":"\\rbrace","[":"\\lbrack","]":"\\rbrack","|":"|"}[r];if(!s)return!1;let c=nz[s],d=nA[s];if(!i.selectionIsCollapsed){i.mathfield.snapshot();let[e,r]=oQ(i.selection),a=i.extractAtoms([e,r]);a=a.filter(e=>"first"!==e.type);let o=l.addChildrenAfter([new n3("left...right",a,{leftDelim:s,rightDelim:d})],i.at(e));return i.setSelection(i.offsetOf(o.firstChild),i.offsetOf(o.lastChild)),i.mathfield.snapshot("insert-fence"),i.contentDidChange({data:s,inputType:"insertText"}),!0}if("|"===s){let e=l instanceof n3?l.leftDelim+l.rightDelim:"";if("\\lbrace\\rbrace"===e||"\\{\\}"===e||"\\lbrace?"===e)return i.mathfield.snapshot(),na.insert(i,"\\,\\middle\\vert\\,",{format:"latex",style:a}),i.mathfield.snapshot("insert-fence"),i.contentDidChange({data:s,inputType:"insertText"}),!0}if(d){if(l instanceof n3&&l.firstChild===n&&("?"===l.leftDelim||"."===l.leftDelim))return l.leftDelim=s,l.isDirty=!0,i.mathfield.snapshot(),i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0;if(!(l instanceof n3)){let e=n;for(;e&&("mclose"!==e.type||e.value!==d);)e=e.rightSibling;if(e){i.mathfield.snapshot();let r=i.extractAtoms([i.offsetOf(n),i.offsetOf(e)]);r.pop();let a=new n3("left...right",r=r.filter(e=>"first"!==e.type),{leftDelim:s,rightDelim:d});return l.addChildrenAfter([a],n),i.position=i.offsetOf(a.firstChild),i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0}}let e=i.offsetOf(n.lastSibling),r;for(r=i.position;r<=e;r++){let e=i.at(r);if(e instanceof n3&&("?"===e.leftDelim||"."===e.leftDelim)&&cO(s,e.rightDelim))break}let c=i.at(r);if(r<=e&&c instanceof n3){c.leftDelim=s,i.mathfield.snapshot();let e=i.extractAtoms([i.position,r-1]);return e=e.filter(e=>"first"!==e.type),c.addChildren(e,c.parentBranch),i.position+=1,i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0}if(l instanceof n3&&("?"===l.leftDelim||"."===l.leftDelim)&&cO(s,l.rightDelim)){for(let e of(l.isDirty=!0,l.leftDelim=s,i.mathfield.snapshot(),i.extractAtoms([i.offsetOf(n.firstSibling),i.position])))l.parent.addChildBefore(e,l);return i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0}if(!(l instanceof n3&&"|"===l.leftDelim)){if("("===s){let e=i.position-1,r=!1;for(;e>=0;){let a=i.at(e);if("first"===a.type)break;if("mord"===a.type&&a.value&&/^[\d]$/.test(a.value)){e-=1;continue}if("group"===a.type&&(null==(o=a.body)?void 0:o.length)===2&&"first"===a.body[0].type&&","===a.body[1].value){r=!0;break}"mord"===a.type&&(","===a.value||"."===a.value)&&(r=!0);break}if(r)return!1}if(i.mathfield.snapshot(),na.insert(i,`\\left${s}\\right?`,{format:"latex",style:a}),"first"!==n.lastSibling.type){let e=i.offsetOf(n.lastSibling),r=i.extractAtoms([i.position,e]);i.at(i.position).body=r,i.position-=1}return i.mathfield.snapshot("insert-fence"),!0}}if(c){if(")"===s){let e=i.position-1,r=!1;for(;e>=0;){let a=i.at(e);if("first"===a.type)break;if("mord"===a.type&&a.value&&/^[\d]$/.test(a.value)){r=!0,e-=1;continue}break}if(r&&"mopen"===i.at(e).type&&"("===i.at(e).value)return!1}let r=n;for(;r;){if("mopen"===r.type&&r.value===c){i.mathfield.snapshot();let e=r.leftSibling,a=i.extractAtoms([i.offsetOf(r.leftSibling),i.offsetOf(n)]);[,...a]=a;let o=new n3("left...right",a,{leftDelim:c,rightDelim:s});return l.addChildrenAfter([o],e),i.position=i.offsetOf(o),i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0}r=r.leftSibling}if(l instanceof n3&&n.isLastSibling&&cP(l.leftDelim,s))return i.mathfield.snapshot(),l.isDirty=!0,l.rightDelim=s,i.position+=1,i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0;let o=i.offsetOf(n.firstSibling),d;for(d=i.position;d>=o;d--){let e=i.at(d);if(e instanceof n3&&("?"===e.rightDelim||"."===e.rightDelim)&&cP(e.leftDelim,s))break}let u=i.at(d);if(d>=o&&u instanceof n3)return i.mathfield.snapshot(),u.rightDelim=s,u.addChildren(i.extractAtoms([d,i.position]),u.parentBranch),i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0;if(l instanceof n3&&("?"===l.rightDelim||"."===l.rightDelim)&&cP(l.leftDelim,s))return i.mathfield.snapshot(),l.isDirty=!0,l.rightDelim=s,l.parent.addChildren(i.extractAtoms([i.position,i.offsetOf(n.lastSibling)]),l.parentBranch),i.position=i.offsetOf(l),i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0;let h=l.parent;return h instanceof n3&&("?"===h.rightDelim||"."===h.rightDelim)&&!!i.at(i.position).isLastSibling&&(i.position=i.offsetOf(h),e(i,s,a))}return!1}(l,l6(i),sa(e)))return e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}else{let{parent:r}=l.at(l.position);if(r instanceof n3&&"?"===r.rightDelim&&l.at(l.position).isLastSibling&&/^[)}\]|]$/.test(s))return e.snapshot(),r.isDirty=!0,r.rightDelim=s,l.position+=1,l.selectionDidChange(),l.contentDidChange({data:l6(i),inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1;if(!l.selectionIsCollapsed){let r=l6(i);if("("===r||"{"===r||"["===r){let[a,o]=oQ(l.selection);return e.snapshot(),l.position=o,na.insert(l,{"(":")","{":"\\rbrace","[":"\\rbrack"}[r],{format:"latex"}),l.position=a,na.insert(l,{"(":"(","{":"\\lbrace","[":"\\lbrack"}[r],{format:"latex"}),l.setSelection(a+1,o+1),l.contentDidChange({data:r,inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}}}return!0}let f=l.at(Math.max(l.position,l.anchor)),{parent:g}=f;if("moveAfterParent"===u&&g instanceof n3&&f.isLastSibling&&e.options.smartFence&&"?"===g.rightDelim&&(e.snapshot(),g.rightDelim=g.matchingRightDelim(),g.isDirty=!0,l.contentDidChange({inputType:"insertText"}),e.snapshot("insert-fence")),e.keyboardDelegate.cancelComposition(),u)e.executeCommand(u);else if(c){let i=sa(e);l.setState(p[h].state);let r=p[p.length-1].keystrokes;for(let e of r=r.slice(d-1))na.insert(l,e,{silenceNotifications:!0,style:i});e.snapshot("insert-shortcut"),l.setState(p[h].state),l.deferNotifications({content:!0,selection:!0,data:c,type:"insertText"},()=>(na.insert(l,c,{format:"latex",style:i}),cT(e.model),c.endsWith(" ")&&(e.switchMode("text"),na.insert(l," ",{style:i,mode:"text"})),e.snapshot(),l.selectionIsCollapsed||e.flushInlineShortcutBuffer(),!0)),e.dirty=!0,l.announce("replacement")}return e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}function cB(e){var i,r,a;let o,{model:n}=e;if("math"!==n.mode)return!1;let l=function(e){var i,r;let{position:a}=e,o=a,n=[];for(;o>0;){let i=e.at(o),r=i.value;if("mord"===i.type||"mbin"===i.type&&("+"===r||"-"===r||"−"===r))n.unshift(i),o--;else break}if(0===n.length)return null;let l=n.map(e=>e.value).join(""),s=(null!=(r=null==(i=globalThis.MathfieldElement)?void 0:i.decimalSeparator)?r:".")==="."?"\\.":",",c=RegExp(`^(\\d+(?:${s}\\d*)?)[eE]([+\\-\u2212]?)(\\d+)$`),d=l.match(c);return d?{startOffset:o,endOffset:a,significand:d[1],exponent:d[2]+d[3]}:null}(n);if(!l)return!1;let s=(i=l.significand,r=l.exponent,(o=null==(a=globalThis.MathfieldElement)?void 0:a.scientificNotationTemplate)&&""!==o&&o.includes("#1")&&o.includes("#2")?o.replace("#1",i).replace("#2",r):null);return!!s&&(n.deferNotifications({content:!0,selection:!0,type:"insertText"},()=>{n.selection={ranges:[[l.startOffset,l.endOffset]],direction:"forward"},na.insert(n,s,{insertionMode:"replaceSelection",selectionMode:"after"})}),e.snapshot("format-scientific-notation"),e.dirty=!0,e.scrollIntoView(),!0)}function c$(e,i,r){let{model:a}=e;if(!e.isSelectionEditable)return void a.announce("plonk");null!=r||(r={}),r.focus&&e.focus(),r.feedback&&(globalThis.MathfieldElement.keypressVibration&&_()&&navigator.vibrate(3),globalThis.MathfieldElement.playSound("keypress")),"string"==typeof r.mode&&(e.switchMode(r.mode),e.snapshot());let o=oh(i),n=window.mathVirtualKeyboard;if(null!=n&&n.isShifted&&(o="string"==typeof o?o.toUpperCase():o.map(e=>e.toUpperCase())),r.simulateKeystroke){let i=!0;for(let r of o)cK(e,new KeyboardEvent("keypress",{key:r}))&&(i=!1);if(i)return}if("latex"===a.mode){if(a.deferNotifications({content:!0,selection:!0,data:i,type:"insertText"},()=>{for(let i of(sn(e),o))na.insert(a,i,{insertionMode:"replaceSelection"});e.snapshot("insert-latex"),sl(e)}),"}"===i){let i=se(a).map(e=>e.value).join(""),r=i.match(/^\\([a-zA-Z]+)/);if(r){let a=eM("\\"+r[1],"math");if((null==a?void 0:a.definitionType)==="function"){let r=a.params.filter(e=>!e.isOptional).length;if(r>0){let a=0,o=0,n=!0;for(let e=0;e<i.length;e++){let r=i[e];if(n){if("\\"===r||/[a-zA-Z]/.test(r))continue;n=!1}"{"===r?a++:"}"===r&&0==--a&&o++}if(0===a&&o===r&&sc(e,"accept-all")){e.dirty=!0,e.scrollIntoView();return}}}}}}else if("text"===a.mode){let i=f(f({},function(e){var i,r,a,o;if(e.selectionIsCollapsed)return null!=(r=null==(i=e.at(e.position))?void 0:i.style)?r:{};let n=oQ(e.selection)[0];return null!=(o=null==(a=e.at(n+1))?void 0:a.style)?o:{}}(a)),e.defaultStyle);for(let e of o)na.insert(a,e,{style:i,insertionMode:"replaceSelection"});e.snapshot("insert-text")}else if("math"===a.mode)for(let i of o)!function(e,i){let r=e.model;/\d/.test(i)||cB(e);let a={"^":"moveToSuperscript",_:"moveToSubscript"," ":e.options.mathModeSpace?["insert",e.options.mathModeSpace]:"moveAfterParent"}[i];if("moveAfterParent"===a){let i=r.at(Math.max(r.position,r.anchor)),{parent:a}=i;a instanceof n3&&i.isLastSibling&&e.options.smartFence&&"?"===a.rightDelim&&(e.snapshot(),a.rightDelim=a.matchingRightDelim(),a.isDirty=!0,r.contentDidChange({inputType:"insertText"}),e.snapshot("insert-fence"))}if(a)return e.executeCommand(a);let o=f({},sa(e));/[a-zA-Z0-9]/.test(i)||"none"===e.styleBias||(o.variant="normal",o.variantStyle=void 0);let n=r.at(r.position),l=r.selectionIsPlaceholder;if(/\d/.test(i)&&e.options.smartSuperscript&&"superscript"===n.parentBranch&&"mop"!==n.parent.type&&"operator"!==n.parent.type&&"extensible-symbol"!==n.parent.type&&n.hasNoSiblings)return na.insert(r,i,{style:o,insertionMode:"replaceSelection",selectionMode:l?"after":"placeholder"})?(e.snapshot("insert-mord"),c_(r)):e.undoManager.pop();let s=i;if("{"===s?s="\\lbrace":"}"===s?s="\\rbrace":"&"===s?s="\\&":"#"===s?s="\\#":"$"===s?s="\\$":"%"===s?s="\\%":"~"===s?s="\\~":"\\"===s&&(s="\\backslash"),na.insert(r,s,{style:o,insertionMode:"replaceSelection",selectionMode:l?"after":"placeholder"})){if(e.snapshot(`insert-${r.at(r.position).type}`),/\d/.test(i)){let i=e.options.inlineShortcutTimeout>0?e.options.inlineShortcutTimeout:1e3;clearTimeout(e.scientificNotationTimer),e.scientificNotationTimer=setTimeout(()=>{cB(e)},i)}/^[a-zA-Z]$/.test(i)&&sl(e)}}(e,i);e.dirty=!0,e.scrollIntoView()}function cP(e,i){return!e||(["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e)?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i):nA[e]===i)}function cO(e,i){return!i||([")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i)?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e):nz[i]===e)}function cI(e){let[i,r]=oQ(e.selection);if((i=cR(e,i,"backward"))===(r=cR(e,r,"forward"))){let a=e.at(i);if("leftright"===a.type)return e.setSelection(e.offsetOf(a.firstChild)-1,r);if("first"===a.type&&("leftright"===a.parent.type||"surd"===a.parent.type))return e.setSelection(i-1,e.offsetOf(a.parent.lastChild)+1);e.setSelection(i-1,r)}else e.setSelection(i,r);return!0}function cR(e,i,r){var a;let o=e.at(i);if(!o)return i;let n="forward"===r?1:-1;if("text"===o.mode){for(;o&&!("text"!==o.mode||!er.test(o.value));)i+=n,o=e.at(i);return"backward"===r?i-1:i}if("latex"===o.mode){if(/[a-zA-Z\\*]/.test(o.value))if("backward"===r)for(;(null==o?void 0:o.mode)==="latex"&&"\\"!==o.value&&/[a-zA-Z]/.test(o.value);)i+=n,o=e.at(i);else for(;(null==o?void 0:o.mode)==="latex"&&/[a-zA-Z\\*]/.test(o.value);)i+=n,o=e.at(i);else if("{"===o.value){if("forward"===r){for(;(null==o?void 0:o.mode)==="latex"&&"}"!==o.value;)i+=n,o=e.at(i);return i}}else if("}"===o.value){if("backward"===r){for(;(null==o?void 0:o.mode)==="latex"&&"{"!==o.value;)i+=n,o=e.at(i);return i-1}return i}return i-1}if("math"===o.mode){if(o.isDigit()){for(;null!=(a=e.at(i+n))&&a.isDigit();)i+=n;return"backward"===r?i-1:i}if(o.style.variant||o.style.variantStyle){let a=o.style.variant,l=o.style.variantStyle;for(;;){let r=e.at(i+n);if(!r||r.style.variant!==a||r.style.variantStyle!==l)break;i+=n}return"backward"===r?i-1:i}}return i}cp.maximumDepth=1e3,s$({moveToOpposite:e=>{let i=e.at(e.position),{parent:r}=i;if(!r)return e.announce("plonk"),!1;let a=i.parentBranch,o;if("string"==typeof a&&(o=({superscript:"subscript",subscript:"superscript",above:"below",below:"above"})[a]),!o){let r=i.subsupPlacement?ck(e):cw(e);return e.mathfield.stopCoalescingUndo(),r}r.branch(o)||r.createBranch(o);let n=e.setSelection(e.getBranchRange(e.offsetOf(r),o));return e.mathfield.stopCoalescingUndo(),n},moveBeforeParent:e=>{let{parent:i}=e.at(e.position);return i?(e.position=e.offsetOf(i),e.mathfield.stopCoalescingUndo(),!0):(e.announce("plonk"),!1)},moveAfterParent:e=>c_(e),moveToNextChar:e=>cb(e,"forward"),moveToPreviousChar:e=>cb(e,"backward"),moveUp:e=>cb(e,"upward"),moveDown:e=>cb(e,"downward"),moveToNextWord:e=>cg(e,"forward"),moveToPreviousWord:e=>cg(e,"backward"),moveToGroupStart:e=>{let i=e.offsetOf(e.at(e.position).firstSibling);return i===e.position?(e.announce("plonk"),!1):(e.position=i,e.mathfield.stopCoalescingUndo(),!0)},moveToGroupEnd:e=>{let i=e.offsetOf(e.at(e.position).lastSibling);return i===e.position?(e.announce("plonk"),!1):(e.position=i,e.mathfield.stopCoalescingUndo(),!0)},moveToNextGroup:e=>{var i,r,a,o;if(e.position===e.lastOffset&&e.anchor===e.lastOffset)return cL(e,"forward");let n=e.at(e.position);if("text"===n.mode){if(e.selectionIsCollapsed){let r=n;for(;(null==r?void 0:r.mode)==="text";)r=r.leftSibling;let a=n;for(;(null==(i=a.rightSibling)?void 0:i.mode)==="text";)a=a.rightSibling;if(r&&a)return cM(e,[r,a])}if("text"===n.rightSibling.mode){let i=n;for(;(null==i?void 0:i.mode)==="text";)i=i.rightSibling;return i?(cS(e,null!=(r=i.leftSibling)?r:i),e.mathfield.switchMode("math"),!0):cS(e,e.lastOffset)}}let l=e.at(e.anchor).parentPrompt,s=l?e.offsetOf(l)+1:Math.max(e.position+1,0),c=cC(e,s,"forward");if(c&&e.offsetOf(c)<s)return cL(e,"forward");if(c)return cS(e,c);let d=cE(e,n,e=>"leftright"===e.type||"text"===e.type,"forward");if(d){if("text"===d.mode){let i=d;for(;(null==i?void 0:i.mode)==="text";)i=i.rightSibling;return cM(e,[null!=(a=d.leftSibling)?a:d,null!=(o=i.leftSibling)?o:i])}return cM(e,d)}let u=n.parent;if(u){if("leftright"===u.type||"surd"===u.type)return cM(e,u);if("superscript"===n.parentBranch&&u.subscript)return cM(e,u.subscript);if("above"===n.parentBranch&&u.below)return cM(e,u.below);if("superscript"===n.parentBranch||"subscript"===n.parentBranch)return cS(e,u);if("above"===n.parentBranch||"below"===n.parentBranch)return cM(e,u)}return cS(e,e.lastOffset)},moveToPreviousGroup:e=>{var i;if(0===e.position&&0===e.anchor)return cL(e,"backward");let r=e.at(e.position),a=r.mode;if("text"===a){if(e.selectionIsCollapsed){let a=r;for(;(null==a?void 0:a.mode)==="text";)a=a.leftSibling;let o=r;for(;(null==(i=o.rightSibling)?void 0:i.mode)==="text";)o=o.rightSibling;if(a&&o)return cM(e,[a,o])}for(;(null==r?void 0:r.mode)==="text";)r=r.leftSibling;return r?cS(e,r):cS(e,0)}let o=e.at(e.anchor).parentPrompt,n=o?e.offsetOf(o.leftSibling):Math.max(e.position-1,0),l=cC(e,n,"backward");if(l&&e.offsetOf(l)>n)return cL(e,"backward");if(l)return cS(e,l);if("math"===a){let i=cE(e,r,e=>"leftright"===e.type||"text"===e.type,"backward");if(i){if("text"===i.mode){let r=i;for(;(null==r?void 0:r.mode)==="text";)r=r.leftSibling;return cM(e,[i,r])}return cM(e,i)}let a=r.parent;if(a){if("leftright"===a.type||"surd"===a.type)return cM(e,a);if("subscript"===r.parentBranch&&a.superscript)return cM(e,a.superscript);if("below"===r.parentBranch&&a.above)return cM(e,a.above);if("superscript"===r.parentBranch||"subscript"===r.parentBranch)return cS(e,a);if("above"===r.parentBranch||"below"===r.parentBranch)return cM(e,a)}return cS(e,0)}return!1},moveToMathfieldStart:e=>e.selectionIsCollapsed&&0===e.position?(e.announce("plonk"),!1):(e.position=0,e.mathfield.stopCoalescingUndo(),!0),moveToMathfieldEnd:e=>e.selectionIsCollapsed&&e.position===e.lastOffset?(e.announce("plonk"),!1):(e.position=e.lastOffset,e.mathfield.stopCoalescingUndo(),!0),moveToSuperscript:cw,moveToSubscript:ck},{target:"model",changeSelection:!0}),s$({moveToNextPlaceholder:e=>cL(e,"forward"),moveToPreviousPlaceholder:e=>cL(e,"backward")},{target:"model",changeSelection:!0,audioFeedback:"return"}),s$({scrollIntoView:e=>(e.scrollIntoView(),!0),scrollToStart:e=>(e.field.scroll(0,0),!0),scrollToEnd:e=>{let i=e.field.getBoundingClientRect();return e.field.scroll(i.left-window.scrollX,0),!0},toggleKeystrokeCaption:function(e){return(e.keystrokeCaptionVisible=!e.keystrokeCaptionVisible,e.keystrokeCaptionVisible)?cD().innerHTML="":sd("mathlive-keystroke-caption-panel").style.visibility="hidden",!1},toggleContextMenu:e=>{let i=e.toggleContextMenu();return i||e.model.announce("plonk"),i},plonk:e=>(e.model.announce("plonk"),!0),switchMode:(e,i,r,a)=>(e.switchMode(i,r,a),!0)}),s$({undo:e=>(e.undo(),!0),redo:e=>(e.redo(),!0)},{target:"mathfield",changeContent:!0}),s$({insert:(e,i,r)=>e.insert(i,r),typedText:(e,i,r)=>(c$(e,i,r),!0),insertDecimalSeparator:e=>{let i=e.model;return"math"===i.mode&&","===globalThis.MathfieldElement.decimalSeparator&&i.at(Math.max(i.position,i.anchor)).isDigit()?(e.insert("{,}",{format:"latex"}),e.snapshot("insert-mord")):e.insert("."),!0},commit:e=>{var i,r;let a=e.model;return a.contentWillChange({inputType:"insertLineBreak"})&&(null==(i=e.host)||i.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),null!=(r=a.parentEnvironment)&&r.isMultiline&&e.executeCommand("addRowAfter"),a.contentDidChange({inputType:"insertLineBreak"})),!0},insertPrompt:(e,i,r)=>{let a=e.getPrompts(),o="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36),n=0;for(;a.includes(o)&&n<100;){if(99===n)return console.error("could not find a unique ID after 100 tries"),!1;o="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36),n++}return e.insert(`\\placeholder[${null!=i?i:o}]{}`,r),!0}},{target:"mathfield",canUndo:!0,changeContent:!0,changeSelection:!0}),s$({copyToClipboard:e=>(e.focus(),e.model.selectionIsCollapsed&&e.select(),"queryCommandSupported"in document&&document.queryCommandSupported("copy")&&document.execCommand("copy")||e.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("copy",{bubbles:!0,composed:!0})),!1)},{target:"mathfield"}),s$({cutToClipboard:e=>(e.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("cut")&&document.execCommand("cut")||e.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("cut",{bubbles:!0,composed:!0})),!0),pasteFromClipboard:e=>(e.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("paste")?document.execCommand("paste"):navigator.clipboard.readText().then(i=>{i&&e.model.contentWillChange({inputType:"insertFromPaste",data:i})?(e.stopCoalescingUndo(),e.stopRecording(),e.insert(i,{mode:e.model.mode})&&(sl(e),e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),sA(e))):e.model.announce("plonk"),e.startRecording()}).catch(()=>{e.model.announce("plonk"),e.startRecording()}),!0)},{target:"mathfield",canUndo:!0,changeContent:!0,changeSelection:!0}),s$({selectGroup:e=>{let i=cI(e);return i||e.announce("plonk"),i},selectAll:e=>e.setSelection(0,e.lastOffset),extendSelectionForward:e=>cb(e,"forward",{extend:!0}),extendSelectionBackward:e=>cb(e,"backward",{extend:!0}),extendToNextWord:e=>cg(e,"forward",{extend:!0}),extendToPreviousWord:e=>cg(e,"backward",{extend:!0}),extendSelectionUpward:e=>cb(e,"upward",{extend:!0}),extendSelectionDownward:e=>cb(e,"downward",{extend:!0}),extendToNextBoundary:e=>cg(e,"forward",{extend:!0}),extendToPreviousBoundary:e=>cg(e,"backward",{extend:!0}),extendToGroupStart:e=>{let i=e.setSelection(e.anchor,e.offsetOf(e.at(e.position).firstSibling));return i||e.announce("plonk"),i},extendToGroupEnd:e=>{let i=e.setSelection(e.anchor,e.offsetOf(e.at(e.position).lastSibling));return i||e.announce("plonk"),i},extendToMathFieldStart:e=>{let i=e.setSelection(e.anchor,0);return i||e.announce("plonk"),i},extendToMathFieldEnd:e=>{let i=e.setSelection(e.anchor,e.lastOffset);return i||e.announce("plonk"),i}},{target:"model",changeSelection:!0});var cN=null,cq=0,cF=class e{static start(i,r,a,o){var n;e.element=i,null==(n=e.controller)||n.abort(),e.controller=new AbortController;let l={signal:e.controller.signal};"PointerEvent"in window?(i.addEventListener("pointermove",a,l),i.addEventListener("pointerup",o,l),i.addEventListener("pointercancel",o,l),cV(r)&&(e.pointerId=r.pointerId,i.setPointerCapture(r.pointerId))):(window.addEventListener("mousemove",a,l),window.addEventListener("blur",o,l),window.addEventListener("mouseup",o,l))}static stop(){var i;null==(i=e.controller)||i.abort(),e.controller=void 0,"number"==typeof e.pointerId&&(e.element.releasePointerCapture(e.pointerId),e.pointerId=void 0)}};function cV(e){return null!==e&&void 0!==globalThis.PointerEvent&&e instanceof PointerEvent}function cj(e,i,r){return e>=r.left&&e<=r.right&&i>=r.top&&i<=r.bottom}function cH(e,i){var r,a,o,n,l,s,c,d,u,h;if(i.buttons>1)return;e.atomBoundsCache?e.atomBoundsCache.clear():e.atomBoundsCache=new Map;let p,m=!1,f=!1,g="none",b=!1,y=!1,v=i.clientX,x=i.clientY,_=Date.now(),w=e.field,k=setInterval(()=>{b?w.scroll({top:0,left:w.scrollLeft-16}):y&&w.scroll({top:0,left:w.scrollLeft+16})},32);function M(){cF.stop(),m=!1,clearInterval(k),e.element.classList.remove("tracking"),i&&i.preventDefault()}cN&&5>Math.abs(cN.x-v)&&5>Math.abs(cN.y-x)&&Date.now()<cN.time+500?(cq+=1,cN.time=_):(cN={x:v,y:x,time:_},cq=1);let S=w.getBoundingClientRect(),L=null!=(a=null==(r=e.container)?void 0:r.getBoundingClientRect())?a:e.element.getBoundingClientRect(),C=null!=(n=null==(o=e.element)?void 0:o.getBoundingClientRect())?n:L,E=cj(v,x,S),A=!E&&!!L&&cj(v,x,L),z=!E&&!A&&!!C&&cj(v,x,C),T=E?v:A||z?(c=S.left,d=S.right,v<c?c:v>d?d:v):v,D=E?x:A||z?(u=S.top,h=S.bottom,x<u?u:x>h?h:x):x;if(E||A||z){if(e.flushInlineShortcutBuffer(),(p=cW(e,T,D,{bias:0}))!==e.model.anchor){let i=e.defaultStyle.variantStyle;e.defaultStyle=void 0!==i?{variantStyle:i}:{},e.styleBias="left"}if(p>=0){if(e.element.classList.add("tracking"),i.shiftKey){let i=e.model.selectionIsCollapsed;e.model.extendSelectionTo(e.model.anchor,p),g=ss(e.model)||i?"all":"selection"}else if("placeholder"===e.model.at(p).type||"prompt"===e.model.at(p).type){let i=e.model.at(p);i.hasChildren&&i.firstChild?e.model.position=e.model.offsetOf(i.firstChild):e.model.setSelection(p-1,p),g="selection"}else if((null==(l=e.model.at(p).rightSibling)?void 0:l.type)==="placeholder"||(null==(s=e.model.at(p).rightSibling)?void 0:s.type)==="prompt"){let i=e.model.at(p).rightSibling;i.hasChildren&&i.firstChild?e.model.position=e.model.offsetOf(i.firstChild):e.model.setSelection(p,p+1),g="selection"}else{let i=e.model.at(p);if(i.captureSelection&&i.hasChildren&&i.body&&i.body.length>0){let r=i.body.find(e=>"first"!==e.type);r&&("placeholder"===r.type||"prompt"===r.type)&&r.hasChildren&&r.firstChild?(e.model.position=e.model.offsetOf(r.firstChild),g="selection"):(e.model.position=p,g=ss(e.model)?"all":"selection")}else e.model.position=p,g=ss(e.model)?"all":"selection"}3===i.detail||cq>2?(M(),(3===i.detail||3===cq)&&(e.model.selection={ranges:[[0,e.model.lastOffset]]},g="all")):m||(m=!0,cF.start(w,i,function(i){if(!e.hasFocus())return void M();let r=i.clientX,a=i.clientY,o=cV(i)&&"touch"===i.pointerType?20:5;if(Date.now()<_+500&&Math.abs(v-r)<o&&Math.abs(x-a)<o){i.preventDefault(),i.stopPropagation();return}let n=w.getBoundingClientRect();y=r>n.right,b=r<n.left;let l=p;cV(i)&&(i.isPrimary||(l=cW(e,i.clientX,i.clientY,{bias:0})));let s=cW(e,r,a,{bias:r<=v?r===v?0:-1:1});l>=0&&s>=0&&(e.model.extendSelectionTo(l,s),sA(e)),f&&cI(e.model)},M),(2===i.detail||2===cq)&&(f=!0,cI(e.model),g="all"))}e.hasFocus()||(g="none",e.onFocus(),e.model.announce("line"))}else cN=null;e.stopCoalescingUndo(),"none"!==g&&(e.model.selectionIsCollapsed&&(g="all"),sA(e)),i.preventDefault()}function cW(e,i,r,a){var o;let n=e.field.querySelector(".ML__latex").getBoundingClientRect();if(!n)return 0;if(i>n.right||r>n.bottom+8)return e.model.lastOffset;if(i<n.left||r<n.top-8)return 0;(a=null!=a?a:{}).bias=null!=(o=a.bias)?o:0;let l=function(e,i,r){let[,a]=function e(i,r,a,o,n){if(!a.id)return[1/0,null];if(r.has(a.id))return r.get(a.id);let l=nu(i,a);if(!l)return[1/0,null];let s=[1/0,null],c=i.model;if(a instanceof nG){let l=-1,c=1/0;for(let e=0;e<a.rows.length;e++){let r=a.rows[e];if(!r||0===r.length)continue;let o=1/0,s=-1/0;for(let e of r)if(e)for(let r of e){let e=nu(i,r);e&&(o=Math.min(o,e.top),s=Math.max(s,e.bottom))}if(1/0!==o&&-1/0!==s){let i;(i=n<o?o-n:n>s?n-s:0)<c&&(c=i,l=e)}}for(let c of l>=0?[a.rows[l]]:a.rows)for(let a of c)if(a)for(let l of a){let a=e(i,r,l,o,n);a[0]<=s[0]&&(s=a)}if(!a.isMultiline)for(let l of a.children){let a=e(i,r,l,o,n);a[0]<=s[0]&&(s=a)}}else if(a.hasChildren&&!a.captureSelection&&o>=l.left&&o<=l.right){for(let l of a.children){let a=e(i,r,l,o,n);a[0]<=s[0]&&(s=a)}for(let l of a.branches){let d=a.branch(l);if(!d||0===d.length)continue;let u=function(e,i){let[r,a]=i,o=null;for(let i=r;i<=a;i++){let r=nu(e,e.model.at(i));r&&(o?(o.top=Math.min(o.top,r.top),o.bottom=Math.max(o.bottom,r.bottom),o.left=Math.min(o.left,r.left),o.right=Math.max(o.right,r.right)):o=r)}return null!=o?o:{top:0,bottom:0,left:0,right:0}}(i,[c.offsetOf(d[0]),c.offsetOf(d[d.length-1])]);if(n>=u.top&&n<=u.bottom)for(let a of d){let l=e(i,r,a,o,n);l[0]<=s[0]&&(s=l)}}}return s[1]||(s=[function(e,i,r){if(e>=r.left&&e<=r.right&&i>=r.top&&i<=r.bottom)return 0;let a=e-(r.left+r.right)/2,o=i-(r.top+r.bottom)/2;return a*a+o*o}(o,n,l),a]),r.set(a.id,s),s}(e,new Map,e.model.root,i,r);return a}(e,i,r),s=[],c=l;for(;c;)s.unshift(c),c=c.parent;for(let e of s)if(e.captureSelection){l=e;break}let d=e.model.offsetOf(l);if(d<0)return -1;if(l.leftSibling){let r="placeholder"===l.type||"prompt"===l.type;if(0!==a.bias||r)a.bias<0&&(d=e.model.offsetOf(l.leftSibling));else{let r=nu(e,l);r&&i<(r.left+r.right)/2&&(d=e.model.offsetOf(l.leftSibling))}}return d}function cU(e,i,r,a){var o;let n,l=[];if("string"!=typeof i||"math-json"===a.format){let r=globalThis.MathfieldElement.computeEngine;if(!r)return["math-json",[]];[n,i]=["latex",r.box(i).latex],l=lt(i,{context:e.mathfield.context})}else"string"==typeof i&&"ascii-math"===a.format?([n,i]=o6(i,{format:"ascii-math",inlineShortcuts:e.mathfield.options.inlineShortcuts}),l=lt(i,{context:e.mathfield.context}),"latex"!==n&&e.mathfield.options.removeExtraneousParentheses&&(l=l.map(e=>cJ(e)))):("auto"===a.format||null!=(o=a.format)&&o.startsWith("latex"))&&("auto"===a.format&&([n,i]=o6(i,{format:"auto",inlineShortcuts:e.mathfield.options.inlineShortcuts})),"latex"===a.format&&([,i]=nt(i)),l=lt(i,{context:e.mathfield.context,args:r}),"latex"!==a.format&&e.mathfield.options.removeExtraneousParentheses&&(l=l.map(e=>cJ(e))));return lK(l,a.style),[null!=n?n:"latex",l]}function cJ(e){var i;if(e instanceof n3&&"("!==e.leftDelim&&")"===e.rightDelim){let r=null==(i=e.body)?void 0:i.filter(e=>"first"!==e.type);if((null==r?void 0:r.length)===1&&"genfrac"===r[0].type)return r[0]}for(let i of e.branches)e.hasEmptyBranch(i)||e.setChildren(e.branch(i).map(e=>cJ(e)),i);return e instanceof nG&&e.forEachCell((i,r,a)=>{e.setCell(r,a,i.map(e=>cJ(e)))}),e}function cX(e){return!!(e.isDigit()||function(e){if("mord"===e.type&&"e"===e.value){let i=e.leftSibling;if(i&&i.isDigit())return!0}if("mbin"===e.type&&("+"===e.value||"-"===e.value||"−"===e.value)){let i=e.leftSibling,r=e.rightSibling;if((null==i?void 0:i.type)==="mord"&&"e"===i.value&&r&&r.isDigit()){let e=i.leftSibling;if(e&&e.isDigit())return!0}}if("subsup"===e.type){let i=e.leftSibling;if(i&&i.isDigit()&&"0"===i.value){let e=i.leftSibling;if(e&&e.isDigit()&&"1"===e.value){let i=e.leftSibling;if((null==i?void 0:i.type)==="mbin"&&("×"===i.value||"\\times"===i.value)){let e=i.leftSibling;if(e&&e.isDigit())return!0}}}}if(e.isDigit()&&"0"===e.value){let i=e.leftSibling,r=e.rightSibling;if(i&&i.isDigit()&&"1"===i.value&&(null==r?void 0:r.type)==="subsup"){let e=i.leftSibling;if((null==e?void 0:e.type)==="mbin"&&("×"===e.value||"\\times"===e.value)){let i=e.leftSibling;if(i&&i.isDigit())return!0}}}if(e.isDigit()&&"1"===e.value){let i=e.rightSibling;if(i&&i.isDigit()&&"0"===i.value){let r=i.rightSibling;if((null==r?void 0:r.type)==="subsup"){let i=e.leftSibling;if((null==i?void 0:i.type)==="mbin"&&("×"===i.value||"\\times"===i.value)){let e=i.leftSibling;if(e&&e.isDigit())return!0}}}}if("mbin"===e.type&&("×"===e.value||"\\times"===e.value)){let i=e.leftSibling,r=e.rightSibling;if(i&&i.isDigit()&&r&&r.isDigit()&&"1"===r.value){let e=r.rightSibling;if(e&&e.isDigit()&&"0"===e.value){let i=e.rightSibling;if((null==i?void 0:i.type)==="subsup")return!0}}}return!1}(e))||!!(e.type&&/^(mord|surd|subsup|leftright|mop|mclose)$/.test(e.type))&&"extensible-symbol"!==e.type}function cG(e){return(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/\\/g,"\\textbackslash ")).replace(/#/g,"\\#")).replace(/%/g,"\\%")).replace(/&/g,"\\&")).replace(/_/g,"\\_")).replace(/{/g,"\\textbraceleft ")).replace(/}/g,"\\textbraceright ")).replace(/lbrace/g,"\\textbraceleft ")).replace(/rbrace/g,"\\textbraceright ")).replace(/\^/g,"\\textasciicircum ")).replace(/~/g,"\\textasciitilde ")).replace(/£/g,"\\textsterling ")}function cZ(e){return{value:e.model.getValue(),selectionIsCollapsed:e.model.selectionIsCollapsed,canUndo:e.canUndo(),canRedo:e.canRedo(),style:function(e){var i;if(e.selectionIsCollapsed)return null==(i=e.at(e.position))?void 0:i.style;let r=e.getAtoms(e.selection);if(0===r.length)return{};let a=f({},r[0].style);for(let e of r)for(let[i,r]of Object.entries(e.style))a[i]!==r&&delete a[i];return a}(e.model),mode:e.model.mode}}new class extends na{constructor(){super("math")}onPaste(e,i){if(!i||!e.model.contentWillChange({data:"string"==typeof i?i:null,dataTransfer:"string"==typeof i?null:i,inputType:"insertFromPaste"}))return!1;let r="",a="auto",o="string"!=typeof i?i.getData("application/json+mathlive"):"";if(o)try{let i=JSON.parse(o);if(i&&Array.isArray(i)){e.snapshot();let r=lD(i),{model:a}=e;a.selectionIsCollapsed||a.deleteAtoms(oQ(a.selection));let o=a.at(a.position);if(o.parent instanceof nG){o.parentBranch;let e=[],i=[];for(let a of("first"===r[0].type&&r.shift(),"first"===r[r.length-1].type&&r.pop(),r))"first"===a.type&&i.length>0?(e.push(i),i=[a]):i.push(a);i.length>0&&e.push(i);let a=Number(o.parentBranch[0]),n=Number(o.parentBranch[1]),l=o.parent.maxColumns;for(;o.parent.colCount-n<e.length&&o.parent.colCount<l;)o.parent.addColumn();o.parent.addChildrenAfter(e[0],o);for(let i=1;i<e.length;i++)++n>=l&&(n=0,o.parent.addRowAfter(a),a++),o.parent.setCell(a,n,e[i])}else o.parent.addChildrenAfter(r.filter(e=>"first"!==e.type),o);return a.position=a.offsetOf(r[r.length-1]),a.contentDidChange({inputType:"insertFromPaste"}),sA(e),!0}}catch(e){}if((o="string"!=typeof i?i.getData("application/json"):"")&&globalThis.MathfieldElement.computeEngine)try{let e=JSON.parse(o);if("object"==typeof e&&"latex"in e&&e.latex&&(r=e.latex),!r){let i=globalThis.MathfieldElement.computeEngine.box(e);i&&!i.has("Error")&&(r=i.latex)}r||(a="latex")}catch(e){}if(!r&&"string"!=typeof i&&(r=i.getData("application/x-latex"))&&(a="latex"),r||(r="string"==typeof i?i:i.getData("text/plain")),r){let i;return[i,r]=nt(r),"auto"===a&&i&&(a="latex"),e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r,{format:a})&&(e.startRecording(),e.snapshot("paste"),sA(e)),e.startRecording(),!0}return!1}insert(e,i,r){var a,o,n,l;let s="string"==typeof i?i:null!=(o=null==(a=globalThis.MathfieldElement.computeEngine)?void 0:a.box(i).latex)?o:"";if(!r.silenceNotifications&&!e.contentWillChange({data:s,inputType:"insertText"}))return!1;r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder"),r.format||(r.format="auto");let{silenceNotifications:c}=e;r.silenceNotifications&&(e.silenceNotifications=!0);let d=e.silenceNotifications;e.silenceNotifications=!0;let u={"?":"\\placeholder{}","@":"\\placeholder{}"};u[0]="replaceAll"===r.insertionMode?"":e.getValue(e.selection,"latex-unstyled"),"replaceSelection"===r.insertionMode?e.deleteAtoms(oQ(e.selection)):"replaceAll"===r.insertionMode?e.deleteAtoms():"insertBefore"===r.insertionMode?e.collapseSelection("backward"):"insertAfter"===r.insertionMode&&e.collapseSelection("forward");let h=e.at(e.position);h&&!h.isLastSibling&&(null==(n=e.at(e.position+1))?void 0:n.type)==="placeholder"?e.deleteAtoms([e.position,e.position+1]):(null==h?void 0:h.type)==="placeholder"&&e.deleteAtoms([e.position-1,e.position]);let p=-1;u[0]?u["@"]=u[0]:"string"==typeof i&&/(^|[^\\])#@/.test(i)&&(p=function(e){let i=e.at(e.position);if(!i)return -1;if("text"===i.mode){for(;!i.isFirstSibling&&"text"===i.mode;)i=i.leftSibling;return e.offsetOf(i)}let r=i,a=!1;if("mclose"===i.type){let e=nz[i.value];for(;!i.isFirstSibling&&("mopen"!==i.type||i.value!==e);){let e=i.leftSibling;if(!e)break;i=e}if(!i.isFirstSibling){let e=i.leftSibling;e&&(i=e)}a=!0}else if("leftright"===i.type){let e=i.leftSibling;e&&(i=e),a=!0}if(a)for(;!i.isFirstSibling&&(i.isFunction||cX(i));){let e=i.leftSibling;if(!e)break;i=e}else{let e=[];for(;!i.isFirstSibling&&(cX(i)||e.length>0);){"mclose"===i.type&&e.unshift(i.value),"mopen"===i.type&&e.length>0&&i.value===nz[e[0]]&&e.shift();let r=i.leftSibling;if(!r)break;i=r}}return r===i?-1:e.offsetOf(i)}(e))>=0&&(u["@"]=e.getValue(p,e.position,"latex")),u[0]||(u[0]=u["?"]);let m=!1,f=e=>(m=!0,u[e]),[g,b]=cU(e,i,f,r);if(!b)return!1;let y=1===b.length&&"genfrac"===b[0].type,v=e.at(e.position);y&&p>=0&&"function"==typeof e.mathfield.options.isImplicitFunction&&v&&e.mathfield.options.isImplicitFunction(v.command)&&(u["@"]=u["?"],m=!1,[g,b]=cU(e,i,f,r));let x=e.position;if(1===b.length&&b[0].isRoot)e.root=b[0];else{let r=e.at(e.position),a=null!=(l=null==r?void 0:r.parent)?l:e.root,o=a.hasEmptyBranch("body");if(y&&"latex"!==g&&e.mathfield.options.removeExtraneousParentheses&&a instanceof n3&&"("===a.leftDelim&&o){let e=a.parent,i=a.parentBranch;e.removeChild(a),e.setChildren(b,i)}let n=e.at(e.position);if(n)n.parent.addChildrenAfter(b,n);else{let e=a.branch("body"),i=null==e?void 0:e[0];i?a.addChildrenAfter(b,i):a.setChildren(b,"body")}if(p>=0){e.deleteAtoms([p,x]);let i=e.root.branch("body");if(i)for(let r of i)r.parent!==e.root&&(r.parent=e.root,r.parentBranch="body")}"latex"===g&&"string"==typeof i&&(null==a?void 0:a.type)==="root"&&o&&!m&&(a.verbatimLatex=i)}e.silenceNotifications=d;let _=b[b.length-1];if("placeholder"===r.selectionMode){let i;if(1===b.length&&"genfrac"===b[0].type){let e=b[0].branch("above");if(!(i=null==e?void 0:e.find(e=>"placeholder"===e.type))){let e=b[0].branch("below");i=null==e?void 0:e.find(e=>"placeholder"===e.type)}}if(i||(i=b.flatMap(e=>[e,...e.children]).find(e=>"placeholder"===e.type)),i){let r=e.offsetOf(i);e.setSelection(r-1,r),e.announce("move")}else if(_){let i=_.body,r=_.hasEmptyBranch("body");i&&r?e.setSelection(e.offsetOf(i[0]),e.offsetOf(i[i.length-1])+1):e.position=e.offsetOf(_)}}else"before"===r.selectionMode||("after"===r.selectionMode?_&&(e.position=e.offsetOf(_)):"item"===r.selectionMode&&e.setSelection(e.anchor,e.offsetOf(_)));return e.contentDidChange({data:s,inputType:"insertText"}),e.silenceNotifications=c,!0}},new class extends na{constructor(){super("text")}onPaste(e,i){if(!i)return!1;let r="string"==typeof i?i:i.getData("text/plain");return!!(r&&e.model.contentWillChange({inputType:"insertFromPaste",data:r}))&&(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r)&&(e.model.contentDidChange({inputType:"insertFromPaste"}),e.startRecording(),e.snapshot("paste"),sA(e)),e.startRecording(),!0)}insert(e,i,r={}){if(!e.contentWillChange({data:i,inputType:"insertText"}))return!1;r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder"),r.format||(r.format="auto");let{silenceNotifications:a}=e;r.silenceNotifications&&(e.silenceNotifications=!0);let o=e.silenceNotifications;e.silenceNotifications=!0,"replaceSelection"!==r.insertionMode||e.selectionIsCollapsed?"replaceAll"===r.insertionMode?(e.root.setChildren([],"body"),e.position=0):"insertBefore"===r.insertionMode?e.collapseSelection("backward"):"insertAfter"===r.insertionMode&&e.collapseSelection("forward"):e.deleteAtoms(oQ(e.selection));let n=function(e,i){if(e.includes("$")){let r=[],a=0,o=!1,n="";for(;a<e.length;)"$"===e[a]?a+1<e.length&&"$"===e[a+1]?(!o&&n?(r.push(cG(n)),n=""):o&&n&&(r.push(n),n=""),r.push("$$"),o=!o,a+=2):(!o&&n?(r.push(cG(n)),n=""):o&&n&&(r.push(n),n=""),r.push("$"),o=!o,a+=1):(n+=e[a],a+=1);return n&&(o?r.push(n):r.push(cG(n))),lt(r.join(""),{context:i,parseMode:"text"})}return lt(cG(e),{context:i,parseMode:"text"})}(i,e.mathfield.context);if(lK(n,r.style),!n)return!1;let l=e.at(e.position),s=l.parent.addChildrenAfter(n,l);return e.silenceNotifications=o,"before"===r.selectionMode||("item"===r.selectionMode?e.setSelection(e.anchor,e.offsetOf(s)):s&&(e.position=e.offsetOf(s))),e.contentDidChange({data:i,inputType:"insertText"}),e.silenceNotifications=a,!0}};var cY=(e,i)=>`
3333
+ [contenteditable]:not([contenteditable="false"]), details>summary`)].filter(function(e){var i,r;return!((i=e).disabled||"hidden"===i.type&&"INPUT"===i.tagName.toUpperCase()||function(e){if(!v()||e===document.activeElement||e.contains(document.activeElement))return!1;if("hidden"===getComputedStyle(e).visibility)return!0;let i=e.getBoundingClientRect();if(0===i.width||0===i.height)return!0;for(;e;){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(i)||"INPUT"===(r=e).tagName.toUpperCase()&&"radio"===r.type&&!function(e){var i;if(!e.name)return!0;let r=function(e,i){for(let r of e)if(r.checked&&r.form===i)return r;return null}((null!=(i=e.form)?i:e.ownerDocument).querySelectorAll('input[type="radio"][name="'+e.name+'"]'),e.form);return!r||r===e}(r)||0>a(e))}).forEach((e,o)=>{let n=a(e);0===n?i.push(e):r.push({documentOrder:o,tabIndex:n,node:e})}),r.sort((e,i)=>e.tabIndex===i.tabIndex?e.documentOrder-i.documentOrder:e.tabIndex-i.tabIndex).map(e=>e.node).concat(i)):[]}();if(!document.activeElement||n.length<=1)return e.announce("plonk"),!1;let l=n.indexOf(document.activeElement)+o;return l<0&&(l=n.length-1),l>=n.length&&(l=0),n[l].focus(),e.mathfield.stopCoalescingUndo(),!0}return cz(e,s),!0}function cD(e,i=0,r="forward"){return e.findAtom(i=>"placeholder"===i.type||"prompt"===i.type||!e.mathfield.readOnly&&i.treeDepth>2&&i.isFirstSibling&&i.isLastSibling,i,r)}function cK(e,i,r,a){if("forward"===a){let e=i.rightSibling;for(;e&&!r(e);)e=e.rightSibling;return e}let o=i.leftSibling;for(;o&&!r(o);)o=o.leftSibling;return o}function cB(e,i,r){"function"==typeof i&&(r=i,i=1/0),void 0===i&&(i=1/0);let a=e.position,o=!1,n="";for(;!o;){let l=e.at(a);(o=0===i||void 0===l||"first"===l.type||"math"!==l.mode||!(l.type&&/mord|mpunct|operator/.test(l.type)||"mop"===l.type&&/[a-zA-Z ]+/.test(l.value))||!l.hasEmptyBranch("superscript")||!l.hasEmptyBranch("subscript")||"function"==typeof r&&!r(l))||(l.mode="text",l.command=l.value,l.verbatimLatex=void 0,n+=l.value),a-=1,i-=1}e.contentDidChange({data:n,inputType:"insertText"})}function c$(e,i,r){"function"==typeof i&&(r=i,i=1/0),void 0===i&&(i=1/0);let a=e.position,o=!1,n=[];for(;!o;){let l=e.at(a);(o=0===i||!l||"first"===l.type||l.isFirstSibling||"text"!==l.mode||" "===l.value||"function"==typeof r&&!r(l))||(n.push(oG.serialize([l],{defaultMode:"math"})),l.mode="math"),a-=1,i-=1}cP(e),e.contentDidChange({data:of(n),inputType:"insertText"})}function cP(e){var i;let r=e.position-1;for(;r>=0&&(null==(i=e.at(r))?void 0:i.mode)==="math";)r-=1;if(!(r<0)&&"text"===e.at(r).mode&&" "===e.at(r).value&&"math"===e.at(r-1).mode){e.at(r-1).parent.removeChild(e.at(r-1));let i=e.silenceNotifications;e.silenceNotifications=!0,e.position-=1,e.silenceNotifications=i,e.contentDidChange({inputType:"deleteContent"})}}function cO(){return document.getElementById("mathlive-keystroke-caption-panel")||(nA("keystroke-caption"),nA("core"),sg("mathlive-keystroke-caption-panel"))}function cR(e,i){var r,a,o,n;let{model:l}=e,s=si(i);if(i.isTrusted){!function(e){var i,r;if(!e||"Unidentified"===e.key||"Dead"===e.key)return;let a=e.shiftKey&&e.altKey?3:e.altKey?2:+!!e.shiftKey;for(let o of T)(null==(i=o.mapping[e.code])?void 0:i[a])===e.key?o.score+=1:null!=(r=o.mapping[e.code])&&r[a]&&(o.score=0);T.sort((e,i)=>i.score-e.score)}(i);let r=$();e.keyboardLayout!==r.id&&(e.keyboardLayout=r.id,e._keybindings=void 0)}if(clearTimeout(e.inlineShortcutBufferFlushTimer),e.inlineShortcutBufferFlushTimer=0,function(e,i){if(!e.isSelectionEditable||!e.keystrokeCaptionVisible)return;let r=cO(),a=e.element.getBoundingClientRect();r.style.left=`${a.left}px`,r.style.top=`${a.top-64}px`,r.innerHTML=globalThis.MathfieldElement.createHTML("<span>"+(l3(i)||i)+"</span>"+r.innerHTML),r.style.visibility="visible",setTimeout(()=>{r.childNodes.length>0&&r.childNodes[r.childNodes.length-1].remove(),0===r.childNodes.length&&(r.style.visibility="hidden")},3e3)}(e,s),i.isTrusted&&i.defaultPrevented)return e.flushInlineShortcutBuffer(),!1;let c,d=0,u="",h=0,p=e.inlineShortcutBuffer,m=!1;if(e.isSelectionEditable&&l.selectionIsPlaceholder&&l7(i)&&(e.flushInlineShortcutBuffer(),l.deleteAtoms(oQ(l.selection)),e.snapshot("delete"),m=!0),e.isSelectionEditable){if("math"===l.mode&&(!l.selectionIsPlaceholder||m))if("[Backspace]"===s)"insert-shortcut"===e.undoManager.lastOp?u="undo":p.pop();else if(l7(i)){let o=st(i),n=[...null!=(a=null==(r=p[p.length-1])?void 0:r.keystrokes)?a:[],o];p.push({state:l.getState(),keystrokes:n,leftSiblings:function(e){let i=e.model,r=[],a=i.at(Math.min(i.position,i.anchor));for(;"first"!==a.type;)r.push(a),a=a.leftSibling;return r}(e)}),d=0;let s="";for(;!c&&d<n.length;)h=p.length-(n.length-d),s=n.slice(d).join(""),!(c=o2(p[h].leftSiblings,s,e.options.inlineShortcuts))&&/^[a-zA-Z][a-zA-Z0-9]+?([_\^][a-zA-Z0-9\*\+\-]+?)?$/.test(s)&&(c=e.options.onInlineShortcut(e,s)),d+=1;e.flushInlineShortcutBuffer({defer:!0})}else e.flushInlineShortcutBuffer();e.options.smartMode&&(c?e.switchMode("math"):function(e,i,r){var a,o;let{model:n}=e;if("latex"===n.mode||!n.at(n.position).isLastSibling||!r||!l7(r))return!1;let l=st(r);if(!n.selectionIsCollapsed)return!!("text"===e.model.mode&&/[/_^]/.test(l));let s=function(e){let i="",r=e.position,a=!1;for(;!a;){let o=e.at(r);(a=!(o&&("text"===o.mode||"math"===o.mode&&o.type&&/mord|mpunct/.test(o.type))))||(i=o.value+i),r-=1}return i}(n)+l;if("text"===e.model.mode){if("Esc"===i||/[/\\]/.test(l))return!0;if(/[\^_]/.test(l))return/(^|\s)[a-zA-Z][^_]$/.test(s)&&c$(n,1),!0;let e={")":"(","}":"{","]":"["}[l],{parent:r}=n.at(n.position);if(e&&r instanceof le&&r.leftDelim===e)return!0;if(/(^|[^a-zA-Z])(a|I) $/.test(s))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(l))return!0;if(/(^|[^a-zA-Z'’])[a-zA-Z] $/.test(s))return c$(n,1),!1;if(/\D\.[^\d\s]$/.test(s)){c$(n,1);let e=n.at(n.position);return e.value="⋅",e.style.variant="normal",e.command="\\cdot",e.verbatimLatex=void 0,n.contentDidChange({data:"\\cdot",inputType:"insertText"}),!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(s)||/\.\d$/.test(s)||/\([\d+\-.]$/.test(s))return c$(n,1),!0;if(/\([a-z][,;]$/.test(s))return c$(n,2),!0;if(/[\d+\-=><*|]$/.test(l))return cP(n),!0}else{if("[Space]"===i)return cB(n,void 0,e=>/[a-z][:,;.]$/.test(e.value)),!0;if(/[a-zA-Z]{3,}$/.test(s)&&!/(dxd|abc|xyz|uvw)$/.test(s)){let i=null!=(o=null==(a=/[a-zA-Z]+$/.exec(s))?void 0:a[0])?o:"",r=e.options.inlineShortcuts;if(!(i&&r&&Object.keys(r).some(e=>e.startsWith(i))))return cB(n,void 0,e=>/[a-zA-Z]/.test(e.value)),!0}if(/(^|\W)(if)$/i.test(s))return cB(n,1),!0;if(/(\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5){3,}$/u.test(s)&&!/(αβγ)$/.test(s))return cB(n,void 0,e=>/(:|,|;|.|\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5)/u.test(e.value)),!0;if("?"===l||"."===l&&!/[\d-+]\.$/.test(s))return!0}return!1}(e,s,i)&&(e.switchMode({math:"text",text:"math"}[l.mode]),u=""))}if(!c){if(u||(u=function(e,i,r){if(0===e.length)return"";let a=E(C(si(r))),o=E({key:r.key,shift:r.shiftKey,alt:r.altKey,ctrl:r.ctrlKey,meta:r.metaKey||r.ctrlKey&&/macos|ios/.test(w()),cmd:!1,win:!1});for(let r=e.length-1;r>=0;r--)if((e[r].key===a||e[r].key===o)&&(!e[r].ifMode||e[r].ifMode===i))return e[r].command;return""}(e.keybindings,l.mode,i)),!u&&("[Enter]"===s||"[Return]"===s)){if(sw())return!1;let r=!0;return l.contentWillChange({inputType:"insertLineBreak"})&&(e.host&&(r=e.host.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),!r&&i.preventDefault?(i.preventDefault(),i.stopPropagation()):(null!=(o=l.parentEnvironment)&&o.isMultiline&&e.executeCommand("addRowAfter"),l.contentDidChange({inputType:"insertLineBreak"}))),r}if("[Space]"===s&&"latex"===l.mode&&sf(e,"accept-all"))return e.dirty=!0,e.scrollIntoView(),i.preventDefault&&(i.preventDefault(),i.stopPropagation()),!1;if((!u||"[Space]"===s)&&"math"===l.mode){if("[Space]"===s){if(e.styleBias="none",e.flushInlineShortcutBuffer(),e.options.mathModeSpace)return na.insert(l,e.options.mathModeSpace,{format:"latex",mode:"math"}),e.snapshot("insert-space"),u="",e.dirty=!0,e.scrollIntoView(),i.preventDefault&&(i.preventDefault(),i.stopPropagation()),!1;let r=l.at(l.position+1),a=l.at(l.position-1);if((null==r?void 0:r.mode)==="text"||(null==a?void 0:a.mode)==="text")return na.insert(l," ",{mode:"text"}),e.snapshot("insert-space"),e.dirty=!0,e.scrollIntoView(),!1}null!=(n=l.at(l.position))&&n.isDigit()&&","===globalThis.MathfieldElement.decimalSeparator&&","===st(i)&&(u="insertDecimalSeparator")}}if(!c&&!u){if(l.mathfield.smartFence){if(function e(i,r,a){var o;if(!r||"math"!==i.mode)return!1;let n=i.at(i.position),{parent:l}=n,s={"(":"(",")":")","{":"\\lbrace","}":"\\rbrace","[":"\\lbrack","]":"\\rbrack","|":"|"}[r];if(!s)return!1;let c=nK[s],d=nD[s];if(!i.selectionIsCollapsed){i.mathfield.snapshot();let[e,r]=oQ(i.selection),a=i.extractAtoms([e,r]);a=a.filter(e=>"first"!==e.type);let o=l.addChildrenAfter([new le("left...right",a,{leftDelim:s,rightDelim:d})],i.at(e));return i.setSelection(i.offsetOf(o.firstChild),i.offsetOf(o.lastChild)),i.mathfield.snapshot("insert-fence"),i.contentDidChange({data:s,inputType:"insertText"}),!0}if("|"===s){let e=l instanceof le?l.leftDelim+l.rightDelim:"";if("\\lbrace\\rbrace"===e||"\\{\\}"===e||"\\lbrace?"===e)return i.mathfield.snapshot(),na.insert(i,"\\,\\middle\\vert\\,",{format:"latex",style:a}),i.mathfield.snapshot("insert-fence"),i.contentDidChange({data:s,inputType:"insertText"}),!0}if(d){if(l instanceof le&&l.firstChild===n&&("?"===l.leftDelim||"."===l.leftDelim))return l.leftDelim=s,l.isDirty=!0,i.mathfield.snapshot(),i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0;if(!(l instanceof le)){let e=n;for(;e&&("mclose"!==e.type||e.value!==d);)e=e.rightSibling;if(e){i.mathfield.snapshot();let r=i.extractAtoms([i.offsetOf(n),i.offsetOf(e)]);r.pop();let a=new le("left...right",r=r.filter(e=>"first"!==e.type),{leftDelim:s,rightDelim:d});return l.addChildrenAfter([a],n),i.position=i.offsetOf(a.firstChild),i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0}}let e=i.offsetOf(n.lastSibling),r;for(r=i.position;r<=e;r++){let e=i.at(r);if(e instanceof le&&("?"===e.leftDelim||"."===e.leftDelim)&&cF(s,e.rightDelim))break}let c=i.at(r);if(r<=e&&c instanceof le){c.leftDelim=s,i.mathfield.snapshot();let e=i.extractAtoms([i.position,r-1]);return e=e.filter(e=>"first"!==e.type),c.addChildren(e,c.parentBranch),i.position+=1,i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0}if(l instanceof le&&("?"===l.leftDelim||"."===l.leftDelim)&&cF(s,l.rightDelim)){for(let e of(l.isDirty=!0,l.leftDelim=s,i.mathfield.snapshot(),i.extractAtoms([i.offsetOf(n.firstSibling),i.position])))l.parent.addChildBefore(e,l);return i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0}if(!(l instanceof le&&"|"===l.leftDelim)){if("("===s){let e=i.position-1,r=!1;for(;e>=0;){let a=i.at(e);if("first"===a.type)break;if("mord"===a.type&&a.value&&/^[\d]$/.test(a.value)){e-=1;continue}if("group"===a.type&&(null==(o=a.body)?void 0:o.length)===2&&"first"===a.body[0].type&&","===a.body[1].value){r=!0;break}"mord"===a.type&&(","===a.value||"."===a.value)&&(r=!0);break}if(r)return!1}if(i.mathfield.snapshot(),na.insert(i,`\\left${s}\\right?`,{format:"latex",style:a}),"first"!==n.lastSibling.type){let e=i.offsetOf(n.lastSibling),r=i.extractAtoms([i.position,e]);i.at(i.position).body=r,i.position-=1}return i.mathfield.snapshot("insert-fence"),!0}}if(c){if(")"===s){let e=i.position-1,r=!1;for(;e>=0;){let a=i.at(e);if("first"===a.type)break;if("mord"===a.type&&a.value&&/^[\d]$/.test(a.value)){r=!0,e-=1;continue}break}if(r&&"mopen"===i.at(e).type&&"("===i.at(e).value)return!1}let r=n;for(;r;){if("mopen"===r.type&&r.value===c){i.mathfield.snapshot();let e=r.leftSibling,a=i.extractAtoms([i.offsetOf(r.leftSibling),i.offsetOf(n)]);[,...a]=a;let o=new le("left...right",a,{leftDelim:c,rightDelim:s});return l.addChildrenAfter([o],e),i.position=i.offsetOf(o),i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0}r=r.leftSibling}if(l instanceof le&&n.isLastSibling&&cq(l.leftDelim,s))return i.mathfield.snapshot(),l.isDirty=!0,l.rightDelim=s,i.position+=1,i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0;let o=i.offsetOf(n.firstSibling),d;for(d=i.position;d>=o;d--){let e=i.at(d);if(e instanceof le&&("?"===e.rightDelim||"."===e.rightDelim)&&cq(e.leftDelim,s))break}let u=i.at(d);if(d>=o&&u instanceof le)return i.mathfield.snapshot(),u.rightDelim=s,u.addChildren(i.extractAtoms([d,i.position]),u.parentBranch),i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0;if(l instanceof le&&("?"===l.rightDelim||"."===l.rightDelim)&&cq(l.leftDelim,s))return i.mathfield.snapshot(),l.isDirty=!0,l.rightDelim=s,l.parent.addChildren(i.extractAtoms([i.position,i.offsetOf(n.lastSibling)]),l.parentBranch),i.position=i.offsetOf(l),i.contentDidChange({data:s,inputType:"insertText"}),i.mathfield.snapshot("insert-fence"),!0;let h=l.parent;return h instanceof le&&("?"===h.rightDelim||"."===h.rightDelim)&&!!i.at(i.position).isLastSibling&&(i.position=i.offsetOf(h),e(i,s,a))}return!1}(l,st(i),sd(e)))return e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}else{let{parent:r}=l.at(l.position);if(r instanceof le&&"?"===r.rightDelim&&l.at(l.position).isLastSibling&&/^[)}\]|]$/.test(s))return e.snapshot(),r.isDirty=!0,r.rightDelim=s,l.position+=1,l.selectionDidChange(),l.contentDidChange({data:st(i),inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1;if(!l.selectionIsCollapsed){let r=st(i);if("("===r||"{"===r||"["===r){let[a,o]=oQ(l.selection);return e.snapshot(),l.position=o,na.insert(l,{"(":")","{":"\\rbrace","[":"\\rbrack"}[r],{format:"latex"}),l.position=a,na.insert(l,{"(":"(","{":"\\lbrace","[":"\\lbrack"}[r],{format:"latex"}),l.setSelection(a+1,o+1),l.contentDidChange({data:r,inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}}}return!0}let f=l.at(Math.max(l.position,l.anchor)),{parent:g}=f;if("moveAfterParent"===u&&g instanceof le&&f.isLastSibling&&e.options.smartFence&&"?"===g.rightDelim&&(e.snapshot(),g.rightDelim=g.matchingRightDelim(),g.isDirty=!0,l.contentDidChange({inputType:"insertText"}),e.snapshot("insert-fence")),e.keyboardDelegate.cancelComposition(),u)e.executeCommand(u);else if(c){let i=sd(e);l.setState(p[h].state);let r=p[p.length-1].keystrokes;for(let e of r=r.slice(d-1))na.insert(l,e,{silenceNotifications:!0,style:i});e.snapshot("insert-shortcut"),l.setState(p[h].state),l.deferNotifications({content:!0,selection:!0,data:c,type:"insertText"},()=>(na.insert(l,c,{format:"latex",style:i}),cP(e.model),c.endsWith(" ")&&(e.switchMode("text"),na.insert(l," ",{style:i,mode:"text"})),e.snapshot(),l.selectionIsCollapsed||e.flushInlineShortcutBuffer(),!0)),e.dirty=!0,l.announce("replacement")}return e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}function cI(e){var i,r,a;let o,{model:n}=e;if("math"!==n.mode)return!1;let l=function(e){var i,r;let{position:a}=e,o=a,n=[];for(;o>0;){let i=e.at(o),r=i.value;if("mord"===i.type||"mbin"===i.type&&("+"===r||"-"===r||"−"===r))n.unshift(i),o--;else break}if(0===n.length)return null;let l=n.map(e=>e.value).join(""),s=(null!=(r=null==(i=globalThis.MathfieldElement)?void 0:i.decimalSeparator)?r:".")==="."?"\\.":",",c=RegExp(`^(\\d+(?:${s}\\d*)?)[eE]([+\\-\u2212]?)(\\d+)$`),d=l.match(c);return d?{startOffset:o,endOffset:a,significand:d[1],exponent:d[2]+d[3]}:null}(n);if(!l)return!1;let s=(i=l.significand,r=l.exponent,(o=null==(a=globalThis.MathfieldElement)?void 0:a.scientificNotationTemplate)&&""!==o&&o.includes("#1")&&o.includes("#2")?o.replace("#1",i).replace("#2",r):null);return!!s&&(n.deferNotifications({content:!0,selection:!0,type:"insertText"},()=>{n.selection={ranges:[[l.startOffset,l.endOffset]],direction:"forward"},na.insert(n,s,{insertionMode:"replaceSelection",selectionMode:"after"})}),e.snapshot("format-scientific-notation"),e.dirty=!0,e.scrollIntoView(),!0)}function cN(e,i,r){let{model:a}=e;if(!e.isSelectionEditable)return void a.announce("plonk");null!=r||(r={}),r.focus&&e.focus(),r.feedback&&(globalThis.MathfieldElement.keypressVibration&&_()&&navigator.vibrate(3),globalThis.MathfieldElement.playSound("keypress")),"string"==typeof r.mode&&(e.switchMode(r.mode),e.snapshot());let o=oh(i),n=window.mathVirtualKeyboard;if(null!=n&&n.isShifted&&(o="string"==typeof o?o.toUpperCase():o.map(e=>e.toUpperCase())),r.simulateKeystroke){let i=!0;for(let r of o)cR(e,new KeyboardEvent("keypress",{key:r}))&&(i=!1);if(i)return}if("latex"===a.mode){if(a.deferNotifications({content:!0,selection:!0,data:i,type:"insertText"},()=>{for(let i of(sh(e),o))na.insert(a,i,{insertionMode:"replaceSelection"});e.snapshot("insert-latex"),sp(e)}),"}"===i){let i=sn(a).map(e=>e.value).join(""),r=i.match(/^\\([a-zA-Z]+)/);if(r){let a=eM("\\"+r[1],"math");if((null==a?void 0:a.definitionType)==="function"){let r=a.params.filter(e=>!e.isOptional).length;if(r>0){let a=0,o=0,n=!0;for(let e=0;e<i.length;e++){let r=i[e];if(n){if("\\"===r||/[a-zA-Z]/.test(r))continue;n=!1}"{"===r?a++:"}"===r&&0==--a&&o++}if(0===a&&o===r&&sf(e,"accept-all")){e.dirty=!0,e.scrollIntoView();return}}}}}}else if("text"===a.mode){let i=f(f({},function(e){var i,r,a,o;if(e.selectionIsCollapsed)return null!=(r=null==(i=e.at(e.position))?void 0:i.style)?r:{};let n=oQ(e.selection)[0];return null!=(o=null==(a=e.at(n+1))?void 0:a.style)?o:{}}(a)),e.defaultStyle);for(let e of o)na.insert(a,e,{style:i,insertionMode:"replaceSelection"});e.snapshot("insert-text")}else if("math"===a.mode)for(let i of o)!function(e,i){let r=e.model;/\d/.test(i)||cI(e);let a={"^":"moveToSuperscript",_:"moveToSubscript"," ":e.options.mathModeSpace?["insert",e.options.mathModeSpace]:"moveAfterParent"}[i];if("moveAfterParent"===a){let i=r.at(Math.max(r.position,r.anchor)),{parent:a}=i;a instanceof le&&i.isLastSibling&&e.options.smartFence&&"?"===a.rightDelim&&(e.snapshot(),a.rightDelim=a.matchingRightDelim(),a.isDirty=!0,r.contentDidChange({inputType:"insertText"}),e.snapshot("insert-fence"))}if(a)return e.executeCommand(a);let o=f({},sd(e));/[a-zA-Z0-9]/.test(i)||"none"===e.styleBias||(o.variant="normal",o.variantStyle=void 0);let n=r.at(r.position),l=r.selectionIsPlaceholder;if(/\d/.test(i)&&e.options.smartSuperscript&&"superscript"===n.parentBranch&&"mop"!==n.parent.type&&"operator"!==n.parent.type&&"extensible-symbol"!==n.parent.type&&n.hasNoSiblings)return na.insert(r,i,{style:o,insertionMode:"replaceSelection",selectionMode:l?"after":"placeholder"})?(e.snapshot("insert-mord"),cL(r)):e.undoManager.pop();let s=i;if("{"===s?s="\\lbrace":"}"===s?s="\\rbrace":"&"===s?s="\\&":"#"===s?s="\\#":"$"===s?s="\\$":"%"===s?s="\\%":"~"===s?s="\\~":"\\"===s&&(s="\\backslash"),na.insert(r,s,{style:o,insertionMode:"replaceSelection",selectionMode:l?"after":"placeholder"})){if(e.snapshot(`insert-${r.at(r.position).type}`),/\d/.test(i)){let i=e.options.inlineShortcutTimeout>0?e.options.inlineShortcutTimeout:1e3;clearTimeout(e.scientificNotationTimer),e.scientificNotationTimer=setTimeout(()=>{cI(e)},i)}/^[a-zA-Z]$/.test(i)&&sp(e)}}(e,i);e.dirty=!0,e.scrollIntoView()}function cq(e,i){return!e||(["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e)?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i):nD[e]===i)}function cF(e,i){return!i||([")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i)?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e):nK[i]===e)}function cV(e){let[i,r]=oQ(e.selection);if((i=cj(e,i,"backward"))===(r=cj(e,r,"forward"))){let a=e.at(i);if("leftright"===a.type)return e.setSelection(e.offsetOf(a.firstChild)-1,r);if("first"===a.type&&("leftright"===a.parent.type||"surd"===a.parent.type))return e.setSelection(i-1,e.offsetOf(a.parent.lastChild)+1);e.setSelection(i-1,r)}else e.setSelection(i,r);return!0}function cj(e,i,r){var a;let o=e.at(i);if(!o)return i;let n="forward"===r?1:-1;if("text"===o.mode){for(;o&&!("text"!==o.mode||!er.test(o.value));)i+=n,o=e.at(i);return"backward"===r?i-1:i}if("latex"===o.mode){if(/[a-zA-Z\\*]/.test(o.value))if("backward"===r)for(;(null==o?void 0:o.mode)==="latex"&&"\\"!==o.value&&/[a-zA-Z]/.test(o.value);)i+=n,o=e.at(i);else for(;(null==o?void 0:o.mode)==="latex"&&/[a-zA-Z\\*]/.test(o.value);)i+=n,o=e.at(i);else if("{"===o.value){if("forward"===r){for(;(null==o?void 0:o.mode)==="latex"&&"}"!==o.value;)i+=n,o=e.at(i);return i}}else if("}"===o.value){if("backward"===r){for(;(null==o?void 0:o.mode)==="latex"&&"{"!==o.value;)i+=n,o=e.at(i);return i-1}return i}return i-1}if("math"===o.mode){if(o.isDigit()){for(;null!=(a=e.at(i+n))&&a.isDigit();)i+=n;return"backward"===r?i-1:i}if(o.style.variant||o.style.variantStyle){let a=o.style.variant,l=o.style.variantStyle;for(;;){let r=e.at(i+n);if(!r||r.style.variant!==a||r.style.variantStyle!==l)break;i+=n}return"backward"===r?i-1:i}}return i}cy.maximumDepth=1e3,sN({moveToOpposite:e=>{let i=e.at(e.position),{parent:r}=i;if(!r)return e.announce("plonk"),!1;let a=i.parentBranch,o;if("string"==typeof a&&(o=({superscript:"subscript",subscript:"superscript",above:"below",below:"above"})[a]),!o){let r=i.subsupPlacement?cE(e):cC(e);return e.mathfield.stopCoalescingUndo(),r}r.branch(o)||r.createBranch(o);let n=e.setSelection(e.getBranchRange(e.offsetOf(r),o));return e.mathfield.stopCoalescingUndo(),n},moveBeforeParent:e=>{let{parent:i}=e.at(e.position);return i?(e.position=e.offsetOf(i),e.mathfield.stopCoalescingUndo(),!0):(e.announce("plonk"),!1)},moveAfterParent:e=>cL(e),moveToNextChar:e=>cw(e,"forward"),moveToPreviousChar:e=>cw(e,"backward"),moveUp:e=>cw(e,"upward"),moveDown:e=>cw(e,"downward"),moveToNextWord:e=>c_(e,"forward"),moveToPreviousWord:e=>c_(e,"backward"),moveToGroupStart:e=>{let i=e.offsetOf(e.at(e.position).firstSibling);return i===e.position?(e.announce("plonk"),!1):(e.position=i,e.mathfield.stopCoalescingUndo(),!0)},moveToGroupEnd:e=>{let i=e.offsetOf(e.at(e.position).lastSibling);return i===e.position?(e.announce("plonk"),!1):(e.position=i,e.mathfield.stopCoalescingUndo(),!0)},moveToNextGroup:e=>{var i,r,a,o;if(e.position===e.lastOffset&&e.anchor===e.lastOffset)return cT(e,"forward");let n=e.at(e.position);if("text"===n.mode){if(e.selectionIsCollapsed){let r=n;for(;(null==r?void 0:r.mode)==="text";)r=r.leftSibling;let a=n;for(;(null==(i=a.rightSibling)?void 0:i.mode)==="text";)a=a.rightSibling;if(r&&a)return cA(e,[r,a])}if("text"===n.rightSibling.mode){let i=n;for(;(null==i?void 0:i.mode)==="text";)i=i.rightSibling;return i?(cz(e,null!=(r=i.leftSibling)?r:i),e.mathfield.switchMode("math"),!0):cz(e,e.lastOffset)}}let l=e.at(e.anchor).parentPrompt,s=l?e.offsetOf(l)+1:Math.max(e.position+1,0),c=cD(e,s,"forward");if(c&&e.offsetOf(c)<s)return cT(e,"forward");if(c)return cz(e,c);let d=cK(e,n,e=>"leftright"===e.type||"text"===e.type,"forward");if(d){if("text"===d.mode){let i=d;for(;(null==i?void 0:i.mode)==="text";)i=i.rightSibling;return cA(e,[null!=(a=d.leftSibling)?a:d,null!=(o=i.leftSibling)?o:i])}return cA(e,d)}let u=n.parent;if(u){if("leftright"===u.type||"surd"===u.type)return cA(e,u);if("superscript"===n.parentBranch&&u.subscript)return cA(e,u.subscript);if("above"===n.parentBranch&&u.below)return cA(e,u.below);if("superscript"===n.parentBranch||"subscript"===n.parentBranch)return cz(e,u);if("above"===n.parentBranch||"below"===n.parentBranch)return cA(e,u)}return cz(e,e.lastOffset)},moveToPreviousGroup:e=>{var i;if(0===e.position&&0===e.anchor)return cT(e,"backward");let r=e.at(e.position),a=r.mode;if("text"===a){if(e.selectionIsCollapsed){let a=r;for(;(null==a?void 0:a.mode)==="text";)a=a.leftSibling;let o=r;for(;(null==(i=o.rightSibling)?void 0:i.mode)==="text";)o=o.rightSibling;if(a&&o)return cA(e,[a,o])}for(;(null==r?void 0:r.mode)==="text";)r=r.leftSibling;return r?cz(e,r):cz(e,0)}let o=e.at(e.anchor).parentPrompt,n=o?e.offsetOf(o.leftSibling):Math.max(e.position-1,0),l=cD(e,n,"backward");if(l&&e.offsetOf(l)>n)return cT(e,"backward");if(l)return cz(e,l);if("math"===a){let i=cK(e,r,e=>"leftright"===e.type||"text"===e.type,"backward");if(i){if("text"===i.mode){let r=i;for(;(null==r?void 0:r.mode)==="text";)r=r.leftSibling;return cA(e,[i,r])}return cA(e,i)}let a=r.parent;if(a){if("leftright"===a.type||"surd"===a.type)return cA(e,a);if("subscript"===r.parentBranch&&a.superscript)return cA(e,a.superscript);if("below"===r.parentBranch&&a.above)return cA(e,a.above);if("superscript"===r.parentBranch||"subscript"===r.parentBranch)return cz(e,a);if("above"===r.parentBranch||"below"===r.parentBranch)return cA(e,a)}return cz(e,0)}return!1},moveToMathfieldStart:e=>e.selectionIsCollapsed&&0===e.position?(e.announce("plonk"),!1):(e.position=0,e.mathfield.stopCoalescingUndo(),!0),moveToMathfieldEnd:e=>e.selectionIsCollapsed&&e.position===e.lastOffset?(e.announce("plonk"),!1):(e.position=e.lastOffset,e.mathfield.stopCoalescingUndo(),!0),moveToSuperscript:cC,moveToSubscript:cE},{target:"model",changeSelection:!0}),sN({moveToNextPlaceholder:e=>cT(e,"forward"),moveToPreviousPlaceholder:e=>cT(e,"backward")},{target:"model",changeSelection:!0,audioFeedback:"return"}),sN({scrollIntoView:e=>(e.scrollIntoView(),!0),scrollToStart:e=>(e.field.scroll(0,0),!0),scrollToEnd:e=>{let i=e.field.getBoundingClientRect();return e.field.scroll(i.left-window.scrollX,0),!0},toggleKeystrokeCaption:function(e){return(e.keystrokeCaptionVisible=!e.keystrokeCaptionVisible,e.keystrokeCaptionVisible)?cO().innerHTML="":sg("mathlive-keystroke-caption-panel").style.visibility="hidden",!1},toggleContextMenu:e=>{let i=e.toggleContextMenu();return i||e.model.announce("plonk"),i},plonk:e=>(e.model.announce("plonk"),!0),switchMode:(e,i,r,a)=>(e.switchMode(i,r,a),!0)}),sN({undo:e=>(e.undo(),!0),redo:e=>(e.redo(),!0)},{target:"mathfield",changeContent:!0}),sN({insert:(e,i,r)=>e.insert(i,r),typedText:(e,i,r)=>(cN(e,i,r),!0),insertDecimalSeparator:e=>{let i=e.model;return"math"===i.mode&&","===globalThis.MathfieldElement.decimalSeparator&&i.at(Math.max(i.position,i.anchor)).isDigit()?(e.insert("{,}",{format:"latex"}),e.snapshot("insert-mord")):e.insert("."),!0},commit:e=>{var i,r;let a=e.model;return a.contentWillChange({inputType:"insertLineBreak"})&&(null==(i=e.host)||i.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),null!=(r=a.parentEnvironment)&&r.isMultiline&&e.executeCommand("addRowAfter"),a.contentDidChange({inputType:"insertLineBreak"})),!0},insertPrompt:(e,i,r)=>{let a=e.getPrompts(),o="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36),n=0;for(;a.includes(o)&&n<100;){if(99===n)return console.error("could not find a unique ID after 100 tries"),!1;o="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36),n++}return e.insert(`\\placeholder[${null!=i?i:o}]{}`,r),!0}},{target:"mathfield",canUndo:!0,changeContent:!0,changeSelection:!0}),sN({copyToClipboard:e=>(e.focus(),e.model.selectionIsCollapsed&&e.select(),"queryCommandSupported"in document&&document.queryCommandSupported("copy")&&document.execCommand("copy")||e.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("copy",{bubbles:!0,composed:!0})),!1)},{target:"mathfield"}),sN({cutToClipboard:e=>(e.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("cut")&&document.execCommand("cut")||e.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("cut",{bubbles:!0,composed:!0})),!0),pasteFromClipboard:e=>(e.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("paste")?document.execCommand("paste"):navigator.clipboard.readText().then(i=>{i&&e.model.contentWillChange({inputType:"insertFromPaste",data:i})?(e.stopCoalescingUndo(),e.stopRecording(),e.insert(i,{mode:e.model.mode})&&(sp(e),e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),sB(e))):e.model.announce("plonk"),e.startRecording()}).catch(()=>{e.model.announce("plonk"),e.startRecording()}),!0)},{target:"mathfield",canUndo:!0,changeContent:!0,changeSelection:!0}),sN({selectGroup:e=>{let i=cV(e);return i||e.announce("plonk"),i},selectAll:e=>e.setSelection(0,e.lastOffset),extendSelectionForward:e=>cw(e,"forward",{extend:!0}),extendSelectionBackward:e=>cw(e,"backward",{extend:!0}),extendToNextWord:e=>c_(e,"forward",{extend:!0}),extendToPreviousWord:e=>c_(e,"backward",{extend:!0}),extendSelectionUpward:e=>cw(e,"upward",{extend:!0}),extendSelectionDownward:e=>cw(e,"downward",{extend:!0}),extendToNextBoundary:e=>c_(e,"forward",{extend:!0}),extendToPreviousBoundary:e=>c_(e,"backward",{extend:!0}),extendToGroupStart:e=>{let i=e.setSelection(e.anchor,e.offsetOf(e.at(e.position).firstSibling));return i||e.announce("plonk"),i},extendToGroupEnd:e=>{let i=e.setSelection(e.anchor,e.offsetOf(e.at(e.position).lastSibling));return i||e.announce("plonk"),i},extendToMathFieldStart:e=>{let i=e.setSelection(e.anchor,0);return i||e.announce("plonk"),i},extendToMathFieldEnd:e=>{let i=e.setSelection(e.anchor,e.lastOffset);return i||e.announce("plonk"),i}},{target:"model",changeSelection:!0});var cH=null,cW=0,cU=class e{static start(i,r,a,o){var n;e.element=i,null==(n=e.controller)||n.abort(),e.controller=new AbortController;let l={signal:e.controller.signal};"PointerEvent"in window?(i.addEventListener("pointermove",a,l),i.addEventListener("pointerup",o,l),i.addEventListener("pointercancel",o,l),cJ(r)&&(e.pointerId=r.pointerId,i.setPointerCapture(r.pointerId))):(window.addEventListener("mousemove",a,l),window.addEventListener("blur",o,l),window.addEventListener("mouseup",o,l))}static stop(){var i;null==(i=e.controller)||i.abort(),e.controller=void 0,"number"==typeof e.pointerId&&(e.element.releasePointerCapture(e.pointerId),e.pointerId=void 0)}};function cJ(e){return null!==e&&void 0!==globalThis.PointerEvent&&e instanceof PointerEvent}function cX(e,i,r){return e>=r.left&&e<=r.right&&i>=r.top&&i<=r.bottom}function cG(e,i){var r,a,o,n,l,s,c,d,u,h;if(i.buttons>1)return;e.atomBoundsCache?e.atomBoundsCache.clear():e.atomBoundsCache=new Map;let p,m=!1,f=!1,g="none",b=!1,y=!1,v=i.clientX,x=i.clientY,_=Date.now(),w=e.field,k=setInterval(()=>{b?w.scroll({top:0,left:w.scrollLeft-16}):y&&w.scroll({top:0,left:w.scrollLeft+16})},32);function M(){cU.stop(),m=!1,clearInterval(k),e.element.classList.remove("tracking"),i&&i.preventDefault()}cH&&5>Math.abs(cH.x-v)&&5>Math.abs(cH.y-x)&&Date.now()<cH.time+500?(cW+=1,cH.time=_):(cH={x:v,y:x,time:_},cW=1);let S=w.getBoundingClientRect(),L=null!=(a=null==(r=e.container)?void 0:r.getBoundingClientRect())?a:e.element.getBoundingClientRect(),C=null!=(n=null==(o=e.element)?void 0:o.getBoundingClientRect())?n:L,E=cX(v,x,S),A=!E&&!!L&&cX(v,x,L),z=!E&&!A&&!!C&&cX(v,x,C),T=E?v:A||z?(c=S.left,d=S.right,v<c?c:v>d?d:v):v,D=E?x:A||z?(u=S.top,h=S.bottom,x<u?u:x>h?h:x):x;if(E||A||z){if(e.flushInlineShortcutBuffer(),(p=cZ(e,T,D,{bias:0}))!==e.model.anchor){let i=e.defaultStyle.variantStyle;e.defaultStyle=void 0!==i?{variantStyle:i}:{},e.styleBias="left"}if(p>=0){if(e.element.classList.add("tracking"),i.shiftKey){let i=e.model.selectionIsCollapsed;e.model.extendSelectionTo(e.model.anchor,p),g=sm(e.model)||i?"all":"selection"}else if("placeholder"===e.model.at(p).type||"prompt"===e.model.at(p).type){let i=e.model.at(p);i.hasChildren&&i.firstChild?e.model.position=e.model.offsetOf(i.firstChild):e.model.setSelection(p-1,p),g="selection"}else if((null==(l=e.model.at(p).rightSibling)?void 0:l.type)==="placeholder"||(null==(s=e.model.at(p).rightSibling)?void 0:s.type)==="prompt"){let i=e.model.at(p).rightSibling;i.hasChildren&&i.firstChild?e.model.position=e.model.offsetOf(i.firstChild):e.model.setSelection(p,p+1),g="selection"}else{let i=e.model.at(p);if(i.captureSelection&&i.hasChildren&&i.body&&i.body.length>0){let r=i.body.find(e=>"first"!==e.type);r&&("placeholder"===r.type||"prompt"===r.type)&&r.hasChildren&&r.firstChild?(e.model.position=e.model.offsetOf(r.firstChild),g="selection"):(e.model.position=p,g=sm(e.model)?"all":"selection")}else e.model.position=p,g=sm(e.model)?"all":"selection"}3===i.detail||cW>2?(M(),(3===i.detail||3===cW)&&(e.model.selection={ranges:[[0,e.model.lastOffset]]},g="all")):m||(m=!0,cU.start(w,i,function(i){if(!e.hasFocus())return void M();let r=i.clientX,a=i.clientY,o=cJ(i)&&"touch"===i.pointerType?20:5;if(Date.now()<_+500&&Math.abs(v-r)<o&&Math.abs(x-a)<o){i.preventDefault(),i.stopPropagation();return}let n=w.getBoundingClientRect();y=r>n.right,b=r<n.left;let l=p;cJ(i)&&(i.isPrimary||(l=cZ(e,i.clientX,i.clientY,{bias:0})));let s=cZ(e,r,a,{bias:r<=v?r===v?0:-1:1});l>=0&&s>=0&&(e.model.extendSelectionTo(l,s),sB(e)),f&&cV(e.model)},M),(2===i.detail||2===cW)&&(f=!0,cV(e.model),g="all"))}e.hasFocus()||(g="none",e.onFocus(),e.model.announce("line"))}else cH=null;e.stopCoalescingUndo(),"none"!==g&&(e.model.selectionIsCollapsed&&(g="all"),sB(e)),i.preventDefault()}function cZ(e,i,r,a){var o;let n=e.field.querySelector(".ML__latex").getBoundingClientRect();if(!n)return 0;if(i>n.right||r>n.bottom+8)return e.model.lastOffset;if(i<n.left||r<n.top-8)return 0;(a=null!=a?a:{}).bias=null!=(o=a.bias)?o:0;let l=function(e,i,r){let[,a]=function e(i,r,a,o,n){if(!a.id)return[1/0,null];if(r.has(a.id))return r.get(a.id);let l=nu(i,a);if(!l)return[1/0,null];let s=[1/0,null],c=i.model;if(a instanceof nQ){let l=-1,c=1/0;for(let e=0;e<a.rows.length;e++){let r=a.rows[e];if(!r||0===r.length)continue;let o=1/0,s=-1/0;for(let e of r)if(e)for(let r of e){let e=nu(i,r);e&&(o=Math.min(o,e.top),s=Math.max(s,e.bottom))}if(1/0!==o&&-1/0!==s){let i;(i=n<o?o-n:n>s?n-s:0)<c&&(c=i,l=e)}}for(let c of l>=0?[a.rows[l]]:a.rows)for(let a of c)if(a)for(let l of a){let a=e(i,r,l,o,n);a[0]<=s[0]&&(s=a)}if(!a.isMultiline)for(let l of a.children){let a=e(i,r,l,o,n);a[0]<=s[0]&&(s=a)}}else if(a.hasChildren&&!a.captureSelection&&o>=l.left&&o<=l.right){for(let l of a.children){let a=e(i,r,l,o,n);a[0]<=s[0]&&(s=a)}for(let l of a.branches){let d=a.branch(l);if(!d||0===d.length)continue;let u=function(e,i){let[r,a]=i,o=null;for(let i=r;i<=a;i++){let r=nu(e,e.model.at(i));r&&(o?(o.top=Math.min(o.top,r.top),o.bottom=Math.max(o.bottom,r.bottom),o.left=Math.min(o.left,r.left),o.right=Math.max(o.right,r.right)):o=r)}return null!=o?o:{top:0,bottom:0,left:0,right:0}}(i,[c.offsetOf(d[0]),c.offsetOf(d[d.length-1])]);if(n>=u.top&&n<=u.bottom)for(let a of d){let l=e(i,r,a,o,n);l[0]<=s[0]&&(s=l)}}}return s[1]||(s=[function(e,i,r){if(e>=r.left&&e<=r.right&&i>=r.top&&i<=r.bottom)return 0;let a=e-(r.left+r.right)/2,o=i-(r.top+r.bottom)/2;return a*a+o*o}(o,n,l),a]),r.set(a.id,s),s}(e,new Map,e.model.root,i,r);return a}(e,i,r),s=[],c=l;for(;c;)s.unshift(c),c=c.parent;for(let e of s)if(e.captureSelection){l=e;break}let d=e.model.offsetOf(l);if(d<0)return -1;if(l.leftSibling){let r="placeholder"===l.type||"prompt"===l.type;if(0!==a.bias||r)a.bias<0&&(d=e.model.offsetOf(l.leftSibling));else{let r=nu(e,l);r&&i<(r.left+r.right)/2&&(d=e.model.offsetOf(l.leftSibling))}}return d}function cY(e,i,r,a){var o;let n,l=[];if("string"!=typeof i||"math-json"===a.format){let r=globalThis.MathfieldElement.computeEngine;if(!r)return["math-json",[]];[n,i]=["latex",r.box(i).latex],l=ll(i,{context:e.mathfield.context})}else"string"==typeof i&&"ascii-math"===a.format?([n,i]=o6(i,{format:"ascii-math",inlineShortcuts:e.mathfield.options.inlineShortcuts}),l=ll(i,{context:e.mathfield.context}),"latex"!==n&&e.mathfield.options.removeExtraneousParentheses&&(l=l.map(e=>cQ(e)))):("auto"===a.format||null!=(o=a.format)&&o.startsWith("latex"))&&("auto"===a.format&&([n,i]=o6(i,{format:"auto",inlineShortcuts:e.mathfield.options.inlineShortcuts})),"latex"===a.format&&([,i]=nt(i)),l=ll(i,{context:e.mathfield.context,args:r}),"latex"!==a.format&&e.mathfield.options.removeExtraneousParentheses&&(l=l.map(e=>cQ(e))));return lI(l,a.style),[null!=n?n:"latex",l]}function cQ(e){var i;if(e instanceof le&&"("!==e.leftDelim&&")"===e.rightDelim){let r=null==(i=e.body)?void 0:i.filter(e=>"first"!==e.type);if((null==r?void 0:r.length)===1&&"genfrac"===r[0].type)return r[0]}for(let i of e.branches)e.hasEmptyBranch(i)||e.setChildren(e.branch(i).map(e=>cQ(e)),i);return e instanceof nQ&&e.forEachCell((i,r,a)=>{e.setCell(r,a,i.map(e=>cQ(e)))}),e}function c0(e){return!!(e.isDigit()||function(e){if("mord"===e.type&&"e"===e.value){let i=e.leftSibling;if(i&&i.isDigit())return!0}if("mbin"===e.type&&("+"===e.value||"-"===e.value||"−"===e.value)){let i=e.leftSibling,r=e.rightSibling;if((null==i?void 0:i.type)==="mord"&&"e"===i.value&&r&&r.isDigit()){let e=i.leftSibling;if(e&&e.isDigit())return!0}}if("subsup"===e.type){let i=e.leftSibling;if(i&&i.isDigit()&&"0"===i.value){let e=i.leftSibling;if(e&&e.isDigit()&&"1"===e.value){let i=e.leftSibling;if((null==i?void 0:i.type)==="mbin"&&("×"===i.value||"\\times"===i.value)){let e=i.leftSibling;if(e&&e.isDigit())return!0}}}}if(e.isDigit()&&"0"===e.value){let i=e.leftSibling,r=e.rightSibling;if(i&&i.isDigit()&&"1"===i.value&&(null==r?void 0:r.type)==="subsup"){let e=i.leftSibling;if((null==e?void 0:e.type)==="mbin"&&("×"===e.value||"\\times"===e.value)){let i=e.leftSibling;if(i&&i.isDigit())return!0}}}if(e.isDigit()&&"1"===e.value){let i=e.rightSibling;if(i&&i.isDigit()&&"0"===i.value){let r=i.rightSibling;if((null==r?void 0:r.type)==="subsup"){let i=e.leftSibling;if((null==i?void 0:i.type)==="mbin"&&("×"===i.value||"\\times"===i.value)){let e=i.leftSibling;if(e&&e.isDigit())return!0}}}}if("mbin"===e.type&&("×"===e.value||"\\times"===e.value)){let i=e.leftSibling,r=e.rightSibling;if(i&&i.isDigit()&&r&&r.isDigit()&&"1"===r.value){let e=r.rightSibling;if(e&&e.isDigit()&&"0"===e.value){let i=e.rightSibling;if((null==i?void 0:i.type)==="subsup")return!0}}}return!1}(e))||!!(e.type&&/^(mord|surd|subsup|leftright|mop|mclose)$/.test(e.type))&&"extensible-symbol"!==e.type}function c1(e){return(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/\\/g,"\\textbackslash ")).replace(/#/g,"\\#")).replace(/%/g,"\\%")).replace(/&/g,"\\&")).replace(/_/g,"\\_")).replace(/{/g,"\\textbraceleft ")).replace(/}/g,"\\textbraceright ")).replace(/lbrace/g,"\\textbraceleft ")).replace(/rbrace/g,"\\textbraceright ")).replace(/\^/g,"\\textasciicircum ")).replace(/~/g,"\\textasciitilde ")).replace(/£/g,"\\textsterling ")}function c4(e){return{value:e.model.getValue(),selectionIsCollapsed:e.model.selectionIsCollapsed,canUndo:e.canUndo(),canRedo:e.canRedo(),style:function(e){var i;if(e.selectionIsCollapsed)return null==(i=e.at(e.position))?void 0:i.style;let r=e.getAtoms(e.selection);if(0===r.length)return{};let a=f({},r[0].style);for(let e of r)for(let[i,r]of Object.entries(e.style))a[i]!==r&&delete a[i];return a}(e.model),mode:e.model.mode}}new class extends na{constructor(){super("math")}onPaste(e,i){if(!i||!e.model.contentWillChange({data:"string"==typeof i?i:null,dataTransfer:"string"==typeof i?null:i,inputType:"insertFromPaste"}))return!1;let r="",a="auto",o="string"!=typeof i?i.getData("application/json+mathlive"):"";if(o)try{let i=JSON.parse(o);if(i&&Array.isArray(i)){e.snapshot();let r=lR(i),{model:a}=e;a.selectionIsCollapsed||a.deleteAtoms(oQ(a.selection));let o=a.at(a.position);if(o.parent instanceof nQ){o.parentBranch;let e=[],i=[];for(let a of("first"===r[0].type&&r.shift(),"first"===r[r.length-1].type&&r.pop(),r))"first"===a.type&&i.length>0?(e.push(i),i=[a]):i.push(a);i.length>0&&e.push(i);let a=Number(o.parentBranch[0]),n=Number(o.parentBranch[1]),l=o.parent.maxColumns;for(;o.parent.colCount-n<e.length&&o.parent.colCount<l;)o.parent.addColumn();o.parent.addChildrenAfter(e[0],o);for(let i=1;i<e.length;i++)++n>=l&&(n=0,o.parent.addRowAfter(a),a++),o.parent.setCell(a,n,e[i])}else o.parent.addChildrenAfter(r.filter(e=>"first"!==e.type),o);return a.position=a.offsetOf(r[r.length-1]),a.contentDidChange({inputType:"insertFromPaste"}),sB(e),!0}}catch(e){}if((o="string"!=typeof i?i.getData("application/json"):"")&&globalThis.MathfieldElement.computeEngine)try{let e=JSON.parse(o);if("object"==typeof e&&"latex"in e&&e.latex&&(r=e.latex),!r){let i=globalThis.MathfieldElement.computeEngine.box(e);i&&!i.has("Error")&&(r=i.latex)}r||(a="latex")}catch(e){}if(!r&&"string"!=typeof i&&(r=i.getData("application/x-latex"))&&(a="latex"),r||(r="string"==typeof i?i:i.getData("text/plain")),r){let i;return[i,r]=nt(r),"auto"===a&&i&&(a="latex"),e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r,{format:a})&&(e.startRecording(),e.snapshot("paste"),sB(e)),e.startRecording(),!0}return!1}insert(e,i,r){var a,o,n,l;let s="string"==typeof i?i:null!=(o=null==(a=globalThis.MathfieldElement.computeEngine)?void 0:a.box(i).latex)?o:"";if(!r.silenceNotifications&&!e.contentWillChange({data:s,inputType:"insertText"}))return!1;r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder"),r.format||(r.format="auto");let{silenceNotifications:c}=e;r.silenceNotifications&&(e.silenceNotifications=!0);let d=e.silenceNotifications;e.silenceNotifications=!0;let u={"?":"\\placeholder{}","@":"\\placeholder{}"};u[0]="replaceAll"===r.insertionMode?"":e.getValue(e.selection,"latex-unstyled"),"replaceSelection"===r.insertionMode?e.deleteAtoms(oQ(e.selection)):"replaceAll"===r.insertionMode?e.deleteAtoms():"insertBefore"===r.insertionMode?e.collapseSelection("backward"):"insertAfter"===r.insertionMode&&e.collapseSelection("forward");let h=e.at(e.position);h&&!h.isLastSibling&&(null==(n=e.at(e.position+1))?void 0:n.type)==="placeholder"?e.deleteAtoms([e.position,e.position+1]):(null==h?void 0:h.type)==="placeholder"&&e.deleteAtoms([e.position-1,e.position]);let p=-1;u[0]?u["@"]=u[0]:"string"==typeof i&&/(^|[^\\])#@/.test(i)&&(p=function(e){let i=e.at(e.position);if(!i)return -1;if("text"===i.mode){for(;!i.isFirstSibling&&"text"===i.mode;)i=i.leftSibling;return e.offsetOf(i)}let r=i,a=!1;if("mclose"===i.type){let e=nK[i.value];for(;!i.isFirstSibling&&("mopen"!==i.type||i.value!==e);){let e=i.leftSibling;if(!e)break;i=e}if(!i.isFirstSibling){let e=i.leftSibling;e&&(i=e)}a=!0}else if("leftright"===i.type){let e=i.leftSibling;e&&(i=e),a=!0}if(a)for(;!i.isFirstSibling&&(i.isFunction||c0(i));){let e=i.leftSibling;if(!e)break;i=e}else{let e=[];for(;!i.isFirstSibling&&(c0(i)||e.length>0);){"mclose"===i.type&&e.unshift(i.value),"mopen"===i.type&&e.length>0&&i.value===nK[e[0]]&&e.shift();let r=i.leftSibling;if(!r)break;i=r}}return r===i?-1:e.offsetOf(i)}(e))>=0&&(u["@"]=e.getValue(p,e.position,"latex")),u[0]||(u[0]=u["?"]);let m=!1,f=e=>(m=!0,u[e]),[g,b]=cY(e,i,f,r);if(!b)return!1;let y=1===b.length&&"genfrac"===b[0].type,v=e.at(e.position);y&&p>=0&&"function"==typeof e.mathfield.options.isImplicitFunction&&v&&e.mathfield.options.isImplicitFunction(v.command)&&(u["@"]=u["?"],m=!1,[g,b]=cY(e,i,f,r));let x=e.position;if(1===b.length&&b[0].isRoot)e.root=b[0];else{let r=e.at(e.position),a=null!=(l=null==r?void 0:r.parent)?l:e.root,o=a.hasEmptyBranch("body");if(y&&"latex"!==g&&e.mathfield.options.removeExtraneousParentheses&&a instanceof le&&"("===a.leftDelim&&o){let e=a.parent,i=a.parentBranch;e.removeChild(a),e.setChildren(b,i)}let n=e.at(e.position);if(n)n.parent.addChildrenAfter(b,n);else{let e=a.branch("body"),i=null==e?void 0:e[0];i?a.addChildrenAfter(b,i):a.setChildren(b,"body")}if(p>=0){e.deleteAtoms([p,x]);let i=e.root.branch("body");if(i)for(let r of i)r.parent!==e.root&&(r.parent=e.root,r.parentBranch="body")}"latex"===g&&"string"==typeof i&&(null==a?void 0:a.type)==="root"&&o&&!m&&(a.verbatimLatex=i)}e.silenceNotifications=d;let _=b[b.length-1];if("placeholder"===r.selectionMode){let i;if(1===b.length&&"genfrac"===b[0].type){let e=b[0].branch("above");if(!(i=null==e?void 0:e.find(e=>"placeholder"===e.type))){let e=b[0].branch("below");i=null==e?void 0:e.find(e=>"placeholder"===e.type)}}if(i||(i=b.flatMap(e=>[e,...e.children]).find(e=>"placeholder"===e.type)),i){let r=e.offsetOf(i);e.setSelection(r-1,r),e.announce("move")}else if(_){let i=_.body,r=_.hasEmptyBranch("body");i&&r?e.setSelection(e.offsetOf(i[0]),e.offsetOf(i[i.length-1])+1):e.position=e.offsetOf(_)}}else"before"===r.selectionMode||("after"===r.selectionMode?_&&(e.position=e.offsetOf(_)):"item"===r.selectionMode&&e.setSelection(e.anchor,e.offsetOf(_)));return e.contentDidChange({data:s,inputType:"insertText"}),e.silenceNotifications=c,!0}},new class extends na{constructor(){super("text")}onPaste(e,i){if(!i)return!1;let r="string"==typeof i?i:i.getData("text/plain");return!!(r&&e.model.contentWillChange({inputType:"insertFromPaste",data:r}))&&(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r)&&(e.model.contentDidChange({inputType:"insertFromPaste"}),e.startRecording(),e.snapshot("paste"),sB(e)),e.startRecording(),!0)}insert(e,i,r={}){if(!e.contentWillChange({data:i,inputType:"insertText"}))return!1;r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder"),r.format||(r.format="auto");let{silenceNotifications:a}=e;r.silenceNotifications&&(e.silenceNotifications=!0);let o=e.silenceNotifications;e.silenceNotifications=!0,"replaceSelection"!==r.insertionMode||e.selectionIsCollapsed?"replaceAll"===r.insertionMode?(e.root.setChildren([],"body"),e.position=0):"insertBefore"===r.insertionMode?e.collapseSelection("backward"):"insertAfter"===r.insertionMode&&e.collapseSelection("forward"):e.deleteAtoms(oQ(e.selection));let n=function(e,i){if(e.includes("$")){let r=[],a=0,o=!1,n="";for(;a<e.length;)"$"===e[a]?a+1<e.length&&"$"===e[a+1]?(!o&&n?(r.push(c1(n)),n=""):o&&n&&(r.push(n),n=""),r.push("$$"),o=!o,a+=2):(!o&&n?(r.push(c1(n)),n=""):o&&n&&(r.push(n),n=""),r.push("$"),o=!o,a+=1):(n+=e[a],a+=1);return n&&(o?r.push(n):r.push(c1(n))),ll(r.join(""),{context:i,parseMode:"text"})}return ll(c1(e),{context:i,parseMode:"text"})}(i,e.mathfield.context);if(lI(n,r.style),!n)return!1;let l=e.at(e.position),s=l.parent.addChildrenAfter(n,l);return e.silenceNotifications=o,"before"===r.selectionMode||("item"===r.selectionMode?e.setSelection(e.anchor,e.offsetOf(s)):s&&(e.position=e.offsetOf(s))),e.contentDidChange({data:i,inputType:"insertText"}),e.silenceNotifications=a,!0}};var c2=(e,i)=>`
3308
3334
  <line x1="${e+20}" y1="${i+20}"
3309
3335
  x2="${e>i?e+20:180}"
3310
3336
  y2="${e<i?i+20:180}"/>
3311
3337
  <svg id="plus" viewBox="0 0 40 40" x="${e}" y="${i}" width="40" height="40">
3312
3338
  <circle class="cls-2" cx="20" cy="20" r="20"/>
3313
3339
  <path class="font" d="m33.33,20c0,1.84-1.49,3.34-3.33,3.34h-6.67v6.66c0,1.84-1.49,3.34-3.33,3.34s-3.34-1.5-3.34-3.34v-6.66h-6.66c-1.84,0-3.34-1.5-3.34-3.34s1.5-3.33,3.34-3.33h6.66v-6.67c0-1.84,1.5-3.33,3.34-3.33s3.33,1.49,3.33,3.33v6.67h6.67c1.84,0,3.33,1.49,3.33,3.33Z"/>
3314
- </svg>`,cQ=(e,i)=>`
3340
+ </svg>`,c3=(e,i)=>`
3315
3341
  <line x1="${e+20}" y1="${i+20}"
3316
3342
  x2="${e>i?e+20:180}"
3317
3343
  y2="${e<i?i+20:180}"/>
3318
3344
  <svg id="minus" viewBox="0 0 40 40" x="${e}" y="${i}" width="40" height="40">
3319
3345
  <circle class="cls-2" cx="20" cy="20" r="20"/>
3320
3346
  <path class="font" d="m33.33,20c0,1.84-1.49,3.33-3.33,3.33H10c-1.84,0-3.34-1.49-3.34-3.33s1.5-3.34,3.34-3.34h20c1.84,0,3.33,1.5,3.33,3.34Z"/>
3321
- </svg>`,c0=(e,i,r)=>`
3347
+ </svg>`,c6=(e,i,r)=>`
3322
3348
  <svg id="arrow" viewBox="0 0 40 40" x="${e}" y="${i}" width="40" height="40">
3323
3349
  <circle class="cls-2" cx="20" cy="20" r="20"/>
3324
3350
  <g transform="rotate(${r})" transform-origin="20 20">
3325
3351
  <path class="font" d="m17.7,7.23h4.6c.52,0,.94.42.94.94v13.82c0,.52.42.94.94.94h3.39c.83,0,1.25,1.01.66,1.6l-7.56,7.56c-.37.37-.96.37-1.32,0l-7.56-7.56c-.59-.59-.17-1.6.66-1.6h3.39c.52,0,.94-.42.94-.94v-13.82c0-.52.42-.94.94-.94Z"/>
3326
3352
  </g>
3327
- </svg>`,c1=`
3353
+ </svg>`,c8=`
3328
3354
  <svg class="MLEP__array-buttons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
3329
3355
  viewBox=
3330
3356
  "-2 -2 205 205">
@@ -3343,38 +3369,38 @@ viewBox=
3343
3369
  width="${144}"
3344
3370
  rx="${24}"/>
3345
3371
  <g data-command='"moveDown"'>
3346
- ${c0(104,152,0)}
3372
+ ${c6(104,152,0)}
3347
3373
  </g>
3348
3374
  <g data-command='"moveUp"'>
3349
- ${c0(104,56,180)}
3375
+ ${c6(104,56,180)}
3350
3376
  </g>
3351
3377
  <g data-command='"moveToNextWord"'>
3352
- ${c0(152,104,-90)}
3378
+ ${c6(152,104,-90)}
3353
3379
  </g>
3354
3380
  <g data-command='"moveToPreviousWord"'>
3355
- ${c0(56,104,90)}
3381
+ ${c6(56,104,90)}
3356
3382
  </g>
3357
3383
  <g>
3358
3384
 
3359
3385
  <g data-command='"addColumnBefore"'>
3360
- ${cY(56,4)}
3386
+ ${c2(56,4)}
3361
3387
  </g>
3362
3388
  <g data-command='"removeColumn"'>
3363
- ${cQ(104,4)}
3389
+ ${c3(104,4)}
3364
3390
  </g>
3365
3391
  <g data-command='"addColumnAfter"'>
3366
- ${cY(152,4)}
3392
+ ${c2(152,4)}
3367
3393
  </g>
3368
3394
  <g data-command='"addRowBefore"'>
3369
- ${cY(4,56)}
3395
+ ${c2(4,56)}
3370
3396
  </g>
3371
3397
  <g data-command='"removeRow"'>
3372
- ${cQ(4,104)}
3398
+ ${c3(4,104)}
3373
3399
  </g>
3374
3400
  <g data-command='"addRowAfter"'>
3375
- ${cY(4,152)}
3401
+ ${c2(4,152)}
3376
3402
  </g>
3377
- </svg>`,c4=e=>`
3403
+ </svg>`,c5=e=>`
3378
3404
  <svg id="Bmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
3379
3405
  data-command='["setEnvironment","Bmatrix"]'>
3380
3406
  <rect class="cls-1" width="28" height="24"/>
@@ -3383,7 +3409,7 @@ viewBox=
3383
3409
  <circle cx="10" cy="8" r="1"/>
3384
3410
  <circle cx="14" cy="12" r="1"/>
3385
3411
  <circle cx="18" cy="16" r="1"/>
3386
- </svg>`,c2={matrix:e=>`
3412
+ </svg>`,c7={matrix:e=>`
3387
3413
  <svg id="matrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
3388
3414
  data-command='["setEnvironment","matrix"]'>
3389
3415
  <rect class="cls-1" width="28" height="24"/>
@@ -3406,7 +3432,7 @@ data-command='["setEnvironment","pmatrix"]'>
3406
3432
  <circle cx="10" cy="8" r="1"/>
3407
3433
  <circle cx="14" cy="12" r="1"/>
3408
3434
  <circle cx="18" cy="16" r="1"/>
3409
- </svg>`,Bmatrix:c4,vmatrix:e=>`
3435
+ </svg>`,Bmatrix:c5,vmatrix:e=>`
3410
3436
  <svg id="vmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
3411
3437
  data-command='["setEnvironment","vmatrix"]'>
3412
3438
  <rect class="cls-1" width="28" height="24"/>
@@ -3426,7 +3452,7 @@ data-command='["setEnvironment","pmatrix"]'>
3426
3452
  <line class="cls-2" x1="22" y1="4" x2="22" y2="20"/>
3427
3453
  <line class="cls-2" x1="2" y1="4" x2="2" y2="20"/>
3428
3454
  <line class="cls-2" x1="26" y1="4" x2="26" y2="20"/>
3429
- </svg>`},c3={cases:e=>`
3455
+ </svg>`},c9={cases:e=>`
3430
3456
  <svg id="cases" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
3431
3457
  data-command='["setEnvironment","cases"]'>
3432
3458
  <rect class="cls-1" width="28" height="24"/>
@@ -3444,30 +3470,30 @@ data-command='["setEnvironment","pmatrix"]'>
3444
3470
  <circle cx="15" cy="16" r="1"/>
3445
3471
  <circle cx="7" cy="8" r="1"/>
3446
3472
  <circle cx="7" cy="16" r="1"/>
3447
- </svg>`,Bmatrix:c4};function c6(){let e=document.getElementById("mathlive-environment-popover");null==e||e.classList.remove("is-visible")}function c8(e){if(!e.hasFocus())return;let i=!1;if("math"===e.model.mode){var r;let a=e.model.parentEnvironment;if(null!=a&&a.rows&&(r=a.environmentName,nU.includes(r)||nW.includes(r)||nW.includes(r)||nH.includes(r)||nJ.includes(r))){let r=e.options.environmentPopoverPolicy;i="auto"===r||"on"===r}}i?function(e){var i,r,a;let o=null==(i=e.model.parentEnvironment)?void 0:i.rows;if(!o)return;let n=0;o.forEach(e=>{(!n||e.length>n)&&(n=e.length)});let l=document.getElementById("mathlive-environment-popover");l||(l=sd("mathlive-environment-popover"),nL("environment-popover"),nL("core"),l.setAttribute("aria-hidden","true"));let s,c=l.querySelector(".MLEP__environment-controls");c?s=c:(s=document.createElement("div"),l.innerHTML="",l.appendChild(s)),s.className="MLEP__environment-controls",s.style.display="flex",s.style.width="100%",s.style.height="100%",s.style.boxSizing="border-box",s.innerHTML=c1;let d=[],u="",h=e.model.parentEnvironment.environmentName;if(nX(h)){let e=h.replace("*","");u=c2[e]("active");let{[e]:i}=c2;d=Object.values(y(c2,[b(e)])).map(e=>e("inactive"))}else if(nW.includes(h)){let e="dcases"===(a=h)?"cases":a;u=c3[e]("active");let{[e]:i}=c3;d=Object.values(y(c3,[b(e)])).map(e=>e("inactive"))}else nU.includes(h)&&(u=c2.matrix("active"),d=Object.values(c3).map(e=>e("inactive")));let p=document.createElement("div");p.className="MLEP__environment-delimiter-controls",p.style.display="flex",p.style.flexDirection="column",p.innerHTML=`
3473
+ </svg>`,Bmatrix:c5};function de(){let e=document.getElementById("mathlive-environment-popover");null==e||e.classList.remove("is-visible")}function dt(e){if(!e.hasFocus())return;let i=!1;if("math"===e.model.mode){var r;let a=e.model.parentEnvironment;if(null!=a&&a.rows&&(r=a.environmentName,nG.includes(r)||nX.includes(r)||nX.includes(r)||nJ.includes(r)||nZ.includes(r))){let r=e.options.environmentPopoverPolicy;i="auto"===r||"on"===r}}i?function(e){var i,r,a;let o=null==(i=e.model.parentEnvironment)?void 0:i.rows;if(!o)return;let n=0;o.forEach(e=>{(!n||e.length>n)&&(n=e.length)});let l=document.getElementById("mathlive-environment-popover");l||(l=sg("mathlive-environment-popover"),nA("environment-popover"),nA("core"),l.setAttribute("aria-hidden","true"));let s,c=l.querySelector(".MLEP__environment-controls");c?s=c:(s=document.createElement("div"),l.innerHTML="",l.appendChild(s)),s.className="MLEP__environment-controls",s.style.display="flex",s.style.width="100%",s.style.height="100%",s.style.boxSizing="border-box",s.innerHTML=c8;let d=[],u="",h=e.model.parentEnvironment.environmentName;if(nY(h)){let e=h.replace("*","");u=c7[e]("active");let{[e]:i}=c7;d=Object.values(y(c7,[b(e)])).map(e=>e("inactive"))}else if(nX.includes(h)){let e="dcases"===(a=h)?"cases":a;u=c9[e]("active");let{[e]:i}=c9;d=Object.values(y(c9,[b(e)])).map(e=>e("inactive"))}else nG.includes(h)&&(u=c7.matrix("active"),d=Object.values(c9).map(e=>e("inactive")));let p=document.createElement("div");p.className="MLEP__environment-delimiter-controls",p.style.display="flex",p.style.flexDirection="column",p.innerHTML=`
3448
3474
  <div class='MLEP__array-delimiter-options'>
3449
3475
  ${u}
3450
3476
  ${d.join("")}
3451
- </div>`,u&&s.appendChild(p),s.querySelectorAll("[data-command]").forEach(i=>{let r=i.dataset.command,a=r;try{a=JSON.parse(r)}catch(e){}i.addEventListener("mousedown",e=>e.preventDefault()),a&&i.addEventListener("click",()=>e.executeCommand(a))});let m=null==(r=e.field)?void 0:r.getBoundingClientRect();m&&(l.style.top=`${window.scrollY+(m.top-l.clientHeight-15)}px`,l.style.left=`${m.left+20}px`,l.classList.add("is-visible"))}(e):c6()}function c5(e){let i=getComputedStyle(e).direction;return"ltr"===i||"rtl"===i?i:"ltr"}function c7(e,i,r){return"left"===i||"leading"===i&&"ltr"===r||"trailing"===i&&"rtl"===r?e.left:e.right}function c9(e,i,r,a){return"middle"===r?e-i/2:"start"===r&&"rtl"===a||"end"===r&&"ltr"===a||"top"===r||"right"===r?Math.max(0,e-i):e}function de(e){return"submenu"in e}function dt(e){return"type"in e&&"command"===e.type||"onMenuSelect"in e||"id"in e}function di(e){return"type"in e&&"divider"===e.type}function dr(e){return"type"in e&&"heading"===e.type}var da={};function dn(e){let i=da[e];if(!i){let r;switch(e){case"checkmark":r=`<span aria-hidden="true" class="ui-checkmark"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"></path></svg>
3452
- </span>`;break;case"trailing-chevron":r='<span aria-hidden="true" class="ui-trailing-chevron"><svg focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path></svg></span>';break;case"mixedmark":r='<span aria-hidden="true" class="ui-mixedmark"><svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 512 512"><path fill="currentColor" d="M0 256c0-13.3 10.7-24 24-24H488c13.3 0 24 10.7 24 24s-10.7 24-24 24H24c-13.3 0-24-10.7-24-24z"/></svg></span>'}if(r){let a=document.createElement("template");a.innerHTML=r,da[e]=a,i=a}}if(i){if("content"in i)return i.content.cloneNode(!0);let e=document.createElement("svg");return e.innerHTML=i.innerHTML,e}}var dl=class{constructor(e,i){var r;this._className="",this._element=null,this.parentMenu=i,this._declaration=e,Object.freeze(this._declaration),de(e)?(this.type="submenu",this.submenu=new dc(e.submenu,{parentMenu:i,submenuClass:e.submenuClass,columnCount:e.columnCount})):this.type=null!=(r=e.type)?r:"command",this.hasCheck=dt(e)&&void 0!==e.checked}get rootMenu(){return this.parentMenu.rootMenu}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}dispose(){var e,i;null==(e=this._abortController)||e.abort(),this._abortController=void 0,null==(i=this._element)||i.remove(),this._element=null,this.submenu&&this.submenu.dispose(),this.submenu=void 0}get menuItem(){return this._declaration}get label(){var e;return null!=(e=this._label)?e:""}set label(e){void 0===e&&(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,i;return null!=(i=null==(e=this.element)?void 0:e.classList.contains("active"))&&i}set active(e){this.element&&this.element.classList.toggle("active",e)}updateState(e){var i,r,a;let o=this._declaration;if(di(o)){this.enabled=!1,this.checked=!1;return}dr(o)&&(this.enabled=!1,this.checked=!1,this.visible=!0),dt(o)&&(this.checked=null!=(i=ds(o.checked,e))&&i),(dt(o)||de(o))&&(this.enabled=null==(r=ds(o.enabled,e))||r,this.visible=null==(a=ds(o.visible,e))||a,this.visible&&this.enabled&&this.submenu&&(this.submenu.updateState(e),this.submenu.visible||(this.visible=!1))),(dt(o)||dr(o)||de(o))&&(this.label=ds(o.label,e),this._className=ds(o.class,e),this.tooltip=ds(o.tooltip,e),this.ariaLabel=ds(o.ariaLabel,e)),this._element&&this.updateElement()}set dirty(e){e&&this.parentMenu&&(this.parentMenu.dirty=!0)}updateElement(){var e;if(!this.visible||!this.element)return;let i=this.element;i.textContent="",i.className="",i.className=null!=(e=this._className)?e:"",this.enabled?i.removeAttribute("aria-disabled"):i.setAttribute("aria-disabled","true"),!0===this.checked?(i.setAttribute("aria-checked","true"),i.append(dn("checkmark"))):"mixed"===this.checked?(i.setAttribute("aria-checked","mixed"),i.append(dn("mixedmark"))):i.removeAttribute("aria-checked"),this.ariaLabel&&i.setAttribute("aria-label",this.ariaLabel);let r=document.createElement("span");if(r.className=this.parentMenu.hasCheck?"label indent":"label","heading"===this.type&&r.classList.add("heading"),r.innerHTML=this.label,i.append(r),this._tooltip&&i.setAttribute("data-tooltip",this._tooltip),dt(this._declaration)&&this._declaration.keyboardShortcut){let e=document.createElement("kbd");e.innerHTML=lY(this._declaration.keyboardShortcut),i.append(e)}"submenu"===this.type&&i.append(dn("trailing-chevron"))}get element(){if(this._element)return this._element;if(di(this._declaration)){let e=document.createElement("li");return e.setAttribute("part","menu-divider"),e.setAttribute("role","divider"),this._element=e,e}let e=document.createElement("li");this._element=e,(dt(this._declaration)||dr(this._declaration)||de(this._declaration))&&e.setAttribute("part","menu-item"),e.setAttribute("tabindex","-1"),this.hasCheck?e.setAttribute("role","menuitemcheckbox"):e.setAttribute("role","menuitem"),"submenu"===this.type&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"));let i=this.abortController.signal;return e.addEventListener("pointerenter",this,{signal:i}),e.addEventListener("pointerleave",this,{signal:i}),e.addEventListener("pointerup",this,{signal:i}),e.addEventListener("click",this,{signal:i}),this._element}dispatchSelect(){var e;if(!dt(this._declaration))return;let i=new CustomEvent("menu-select",{cancelable:!0,bubbles:!0,detail:{modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data}});this.parentMenu.dispatchEvent(i)&&"function"==typeof this._declaration.onMenuSelect&&this._declaration.onMenuSelect({target:null!=(e=this.parentMenu.host)?e:void 0,modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data})}handleEvent(e){var i;if(!(!this.visible||!this.enabled)){if("click"===e.type){"modal"===this.rootMenu.state&&this.select(),e.stopPropagation(),e.preventDefault();return}if("pointerenter"===e.type){this.rootMenu.cancelDelayedOperation(),this.parentMenu.isSubmenuOpen&&null!=(i=this.parentMenu.activeMenuItem)&&i.movingTowardSubmenu(e)?this.rootMenu.scheduleOperation(()=>{this.parentMenu.activeMenuItem=this,this.openSubmenu()}):(this.parentMenu.activeMenuItem=this,this.openSubmenu({withDelay:!0}));return}if("pointerleave"===e.type){this.rootMenu.activeSubmenu===this.parentMenu&&(this.parentMenu.activeMenuItem=null);return}if("pointerup"===e.type){"modal"!==this.rootMenu.state&&this.select(),e.stopPropagation(),e.preventDefault();return}}}select(){(this.rootMenu.cancelDelayedOperation(),"submenu"===this.type)?this.openSubmenu():(this.active=!1,setTimeout(()=>{this.active=!0,setTimeout(()=>{this.active=!1,this.rootMenu.hide(),this.dispatchSelect()},80)},80))}openSubmenu(e){var i;if("submenu"!==this.type||!this.element)return;if(null!=(i=null==e?void 0:e.withDelay)&&i)return void this.rootMenu.scheduleOperation(()=>this.openSubmenu());let r=this.element.getBoundingClientRect(),a=c5(this.element);this.submenu.show({container:this.rootMenu.element.parentNode,location:{x:c7(r,"trailing",a),y:r.top-4},alternateLocation:{x:c7(r,"leading",a),y:r.top-4}})}movingTowardSubmenu(e){var i,r;if(!this.element||"submenu"!==this.type)return!1;let a=this.rootMenu.lastMoveEvent;if(!a)return!1;let o=e.timeStamp-a.timeStamp;if(o>500)return!1;let n=e.clientX-a.clientX;if(.2>=(i=n,r=a.clientY-e.clientY,Math.hypot(i,r)/o))return!1;let l="right";if(this.submenu.element){let e=this.submenu.element.getBoundingClientRect(),i=this.element.getBoundingClientRect();e.left<i.left+i.width/2&&(l="left")}return"right"===l?n>0:n<0}};function ds(e,i){return void 0===e||"function"!=typeof e?e:(null!=i||(i={alt:!1,control:!1,shift:!1,meta:!1}),e(i))}var dc=class e{constructor(e,i){var r,a;this._element=null,this._activeMenuItem=null,this._dirty=!0,this.parentMenu=null!=(r=null==i?void 0:i.parentMenu)?r:null,this._submenuClass=null==i?void 0:i.submenuClass,this.columnCount=null!=(a=null==i?void 0:i.columnCount)?a:1,this.isSubmenuOpen=!1,this.menuItems=e}get children(){return Object.freeze([...this._menuItems])}set menuItems(e){let i=this.parentMenu;this.dispose(),this.parentMenu=i,e=[...e],this._menuItems=e.map(e=>e.onCreate?e.onCreate(e,this):new dl(e,this)),this.hasCheck=void 0,this.dirty=!0}dispose(){var e;this.hide(),this._element&&this._element.remove(),this._abortController&&this._abortController.abort(),null==(e=this._menuItems)||e.forEach(e=>e.dispose()),this._menuItems=[],this._activeMenuItem=null,this.parentMenu=null}handleEvent(e){"wheel"===e.type&&this._element&&(this._element.scrollBy(0,e.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 i,r,a;this._menuItems.forEach(i=>i.updateState(e));let o=this.hasCheck;this.hasCheck=this._menuItems.some(e=>e.visible&&e.hasCheck),this.hasCheck!==o&&this._menuItems.forEach(i=>i.updateState(e));let n,l=0;for(let e of this._menuItems)"heading"===e.type?(n&&0===l&&(n.visible=!1),n=e,l=0):"divider"===e.type&&n?(n.visible=l>0,n=void 0,l=0):n&&e.visible&&(l+=1);n&&(n.visible=l>0);let s=!0;for(let e of this._menuItems)"divider"===e.type?(e.visible=!s,s=!0):e.visible&&(s=!1);null!=(i=this.activeMenuItem)&&i.visible||(this.activeMenuItem=null),null!=(r=this.activeMenuItem)&&r.enabled||(null==(a=this.activeMenuItem)?void 0:a.type)!=="submenu"||this._activeMenuItem.submenu.hide(),this._dirty=!1}get enabled(){return this.updateIfDirty(),this._menuItems.some(e=>"divider"!==e.type&&e.visible&&e.enabled)}get visible(){return this.updateIfDirty(),this._menuItems.some(e=>"divider"!==e.type&&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){for(let{element:e,visible:i}of(this._element.textContent="",this._menuItems))e&&i&&this._element.append(e);null==(e=this._element.querySelector("li:first-of-type"))||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 i=this._abortController.signal;return e.addEventListener("focus",this,{signal:i}),e.addEventListener("wheel",this,{passive:!0,signal:i}),this._element=e,this.updateElement(),e}get activeMenuItem(){return this._activeMenuItem}set activeMenuItem(e){var i,r,a,o;if(this.rootMenu.cancelDelayedOperation(),e!==this._activeMenuItem){if(this.activeMenuItem){let e=this.activeMenuItem;e.active=!1,null==(i=e.submenu)||i.hide()}if(!(null==(r=null==e?void 0:e.visible)||r)){this._activeMenuItem=null;return}this._activeMenuItem=e,e&&(e.active=!0)}e?null==(a=e.element)||a.focus({preventScroll:!0}):null==(o=this._element)||o.focus({preventScroll:!0})}get firstMenuItem(){this.updateIfDirty();let e=0,i=!1,r=this._menuItems;for(;!i&&e<=r.length-1;){let a=r[e];i="divider"!==a.type&&a.visible&&a.enabled,e+=1}return i?r[e-1]:null}get lastMenuItem(){this.updateIfDirty();let e=this._menuItems,i=e.length-1,r=!1;for(;!r&&i>=0;){let a=e[i];r="divider"!==a.type&&a.visible&&a.enabled,i-=1}return r?e[i+1]:null}nextMenuItem(e){if(0===e)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 i=this._menuItems.indexOf(this.firstMenuItem),r=this._menuItems.indexOf(this.lastMenuItem),a=this._menuItems.indexOf(this._activeMenuItem),o=1;for(;a>=i&&a<=r;){a+=e>0?1:-1;let i=this._menuItems[a];if(!i)break;if(i.visible&&i.enabled){if(o===Math.abs(e))return this._menuItems[a];o+=1}}return e>0?this.lastMenuItem:this.firstMenuItem}getMenuItemColumn(e){this.updateIfDirty();let i=this._menuItems.filter(e=>e.visible&&e.enabled).indexOf(e);return i<0?-1:i%this.columnCount}static get collator(){return e._collator||(e._collator=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),e._collator}findMenuItem(i){var r;this.updateIfDirty();let a=this._menuItems.filter(e=>"divider"!==e.type&&e.visible&&e.enabled);if(0===a.length)return null;let o=Math.max(...a.map(e=>e.label.length))-i.length;if(o<0)return null;let n=null,l=0;for(;l<o&&!n;)n=null!=(r=a.find(r=>0===e.collator.compare(i,r.label.substring(l,i.length))))?r:null,l++;return n}show(e){var i,r,a,o,n,l,s,c;let d,u,h,p,m,f;return!!this.visible&&!!e.container&&(this.updateElement(),e.container.appendChild(this.element),k()&&(this.element.popover="manual",this.element.showPopover()),e.location&&(i=this.element,r={location:e.location,alternateLocation:e.alternateLocation,verticalPos:"bottom",horizontalPos:"start"},d=null!=(a=c5(i))?a:"ltr",i.style.position="fixed",i.style.left="",i.style.top="",i.style.right="",i.style.bottom="",i.style.height="",i.style.width="",u=i.getBoundingClientRect(),h=Math.min(Number.isFinite(r.maxHeight)?Math.min(r.maxHeight,window.innerHeight):window.innerHeight,null!=(o=r.height)?o:u.height),(p=c9(r.location.y,h,r.verticalPos,d))+h>window.innerHeight-8&&(r.alternateLocation?(p=c9(r.alternateLocation.y,h,r.verticalPos,d))+h>window.innerHeight-8&&(p=void 0):p=void 0),Number.isFinite(p)||(p=Math.max(8,window.innerHeight-8-h),8+h>window.innerHeight-8&&(i.style.bottom="8px")),h=Math.min(p+h,window.innerHeight-8)-p,m=Math.min(Number.isFinite(r.maxWidth)?Math.min(r.maxWidth,window.innerWidth):window.innerWidth,null!=(n=r.width)?n:u.width),(f=c9(r.location.x,m,r.horizontalPos,d))+m>window.innerWidth-8&&(r.alternateLocation?(l=r.alternateLocation.x,s=m,c=r.verticalPos,(f="middle"===c?l-s/2:"start"===c&&"ltr"===d||"end"===c&&"rtl"===d||"top"===c||"right"===c?l:l-s)+m>window.innerWidth-8&&(f=void 0)):f=void 0),Number.isFinite(f)||(f=Math.max(8,window.innerWidth-8-m),8+m>window.innerWidth-8&&(i.style.right="8px")),m=Math.min(f+m,window.innerWidth-8)-f,"rtl"===d?i.style.right=`${Math.ceil(window.innerWidth-f-m).toString()}px`:i.style.left=`${Math.ceil(f).toString()}px`,i.style.top=`${Math.ceil(p).toString()}px`,h!==u.height&&(i.style.height=`${Math.ceil(h).toString()}px`),m!==u.width&&(i.style.width=`${Math.ceil(m).toString()}px`)),dd(),this.element.focus({preventScroll:!0}),dh(),this.parentMenu&&(this.parentMenu.openSubmenu=this),!0)}hide(){var e,i,r,a,o,n;this.openSubmenu=null,this.activeMenuItem=null,this.parentMenu&&(this.parentMenu.openSubmenu=null),null!=(e=this._element)&&e.isConnected&&this._element.parentElement&&(k()&&null!=(i=this._element)&&i.popover&&this._element.hidePopover(),dd(),null==(a=null==(r=this.parentMenu)?void 0:r.element)||a.focus(),null==(n=null==(o=this._element)?void 0:o.parentNode)||n.removeChild(this._element),dh())}set openSubmenu(e){var i,r,a,o;let n=null!==e;(null==(i=this.activeMenuItem)?void 0:i.type)==="submenu"&&(null==(r=this.activeMenuItem.element)||r.setAttribute("aria-expanded",n.toString())),null==(o=null==(a=this.activeMenuItem)?void 0:a.element)||o.classList.toggle("is-submenu-open",n),this.isSubmenuOpen=n}};function dd(){document.addEventListener("focusin",du,!0),document.addEventListener("focusout",du,!0),document.addEventListener("focus",du,!0),document.addEventListener("blur",du,!0)}function du(e){e.stopImmediatePropagation(),e.preventDefault()}function dh(){document.removeEventListener("focusin",du,!0),document.removeEventListener("focusout",du,!0),document.removeEventListener("focus",du,!0),document.removeEventListener("blur",du,!0)}var dp=class e extends dc{constructor(e,i){var r;super(e),this.state="closed",this.typingBufferResetTimer=0,this.hysteresisTimer=0,this._updating=!1,this._host=null!=(r=null==i?void 0:i.host)?r:null,this.isDynamic=e.some(dm),this._modifiers={shift:!1,control:!1,alt:!1,meta:!1},this.typingBuffer="",this.state="closed"}get modifiers(){return this._modifiers}set modifiers(e){var i;i=this._modifiers,(!i&&e||i&&!e||i&&e&&(i.alt!==e.alt||i.control!==e.control||i.shift!==e.shift||i.meta!==e.meta))&&(this._modifiers=e,this.dirty=!0)}get activeSubmenu(){let e=this;for(;e.isSubmenuOpen;)e=e.activeMenuItem.submenu;return e}set dirty(e){this._updating||this._dirty!==e&&(this._dirty=!0,e&&setTimeout(()=>{this.updateState(this.modifiers),this.updateElement()}))}updateState(e){this._updating=!0,this.modifiers=null!=e?e:this.modifiers,super.updateState(this.modifiers),this._updating=!1}handleKeyupEvent(e){this.isDynamic&&(this.modifiers=l0(e)),e.stopImmediatePropagation()}handleKeydownEvent(e){var i,r,a;if("Tab"===e.key||"Escape"===e.key)return void this.hide();this.isDynamic&&(this.modifiers=l0(e));let o=!0,n=this.activeSubmenu,l=n.activeMenuItem;switch(e.key){case" ":case"Space":case"Return":case"Enter":null==l||l.select(l0(e));break;case"ArrowRight":if((null==l?void 0:l.type)==="submenu")l.select(l0(e)),this.activeSubmenu.activeMenuItem=this.activeSubmenu.firstMenuItem;else if(l){let e=null!=(i=n.getMenuItemColumn(l))?i:-1;if(e>=0&&e<(null!=(r=n.columnCount)?r:1)-1){let e=n.nextMenuItem(1);e&&(n.activeMenuItem=e)}}else n.activeMenuItem=n.firstMenuItem;break;case"ArrowLeft":if(n===this.rootMenu)l||(n.activeMenuItem=n.firstMenuItem);else if((l&&null!=(a=n.getMenuItemColumn(l))?a:-1)<=0||!l){n.hide();let e=n.parentMenu.activeMenuItem;if(e){let{element:i}=e;null==i||i.focus(),null==i||i.classList.remove("is-submenu-open")}}else{let e=n.nextMenuItem(-1);e&&(n.activeMenuItem=e)}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 e=n.findMenuItem(this.typingBuffer);e&&(n.activeMenuItem=e),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}break;default:if(l4(e)){isFinite(this.typingBufferResetTimer)&&clearTimeout(this.typingBufferResetTimer),this.typingBuffer+=e.key;let i=n.findMenuItem(this.typingBuffer);i&&(n.activeMenuItem=i),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}else o=!1}o&&(e.preventDefault(),e.stopPropagation())}handleEvent(e){if("keydown"===e.type)this.handleKeydownEvent(e);else if("keyup"===e.type)this.handleKeyupEvent(e);else if("pointermove"===e.type)this.lastMoveEvent=e;else if("pointerup"===e.type)Number.isFinite(this.rootMenu._openTimestamp)&&Date.now()-this.rootMenu._openTimestamp<120?this.state="modal":"modal"===this.state&&e.target===this.scrim&&this.hide();else if("contextmenu"===e.type){e.preventDefault(),e.stopPropagation();return}super.handleEvent(e)}dispatchEvent(e){return!this._host||this._host.dispatchEvent(e)}get host(){return this._host}get scrim(){return l3.element}connectScrim(e){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),l3.open({root:e,onDismiss:()=>this.hide()})}disconnectScrim(){let e=this.scrim;e.removeEventListener("pointerup",this,!0),e.removeEventListener("contextmenu",this),e.removeEventListener("keydown",this),e.removeEventListener("keyup",this),e.removeEventListener("pointermove",this),"open"===l3.state&&l3.scrim.close()}get rootMenu(){return this}show(e){return this._onDismiss=null==e?void 0:e.onDismiss,null!=e&&e.modifiers&&(this.modifiers=e.modifiers),this.updateState(),this.connectScrim(null==e?void 0:e.target),super.show(g(f({},e),{container:this.scrim}))?(this._openTimestamp=Date.now(),this.state="open",!0):(this.disconnectScrim(),!1)}hide(){this.cancelDelayedOperation(),void 0!==this.state&&("closed"!==this.state&&(this.activeMenuItem=null,l3.element.parentElement.focus(),super.hide(),this.state="closed",this.disconnectScrim()),this._onDismiss&&(this._onDismiss(),this._onDismiss=void 0))}scheduleOperation(i){this.cancelDelayedOperation();let r=e.SUBMENU_DELAY;r<=0?i():this.hysteresisTimer=setTimeout(()=>{this.hysteresisTimer=0,i()},r)}cancelDelayedOperation(){this.hysteresisTimer&&(clearTimeout(this.hysteresisTimer),this.hysteresisTimer=0)}};function dm(e){return!di(e)&&(!!("function"==typeof e.label||"function"==typeof e.ariaLabel||"function"==typeof e.tooltip||(dt(e)||de(e))&&("function"==typeof e.enabled||"function"==typeof e.visible)||dt(e)&&"function"==typeof e.checked)||!!de(e)&&e.submenu.some(dm))}dp.SUBMENU_DELAY=120;var df=class{};async function dg(e,i,r){if(e.defaultPrevented)return!1;if("contextmenu"===e.type&&(e.preventDefault(),e.stopPropagation(),r.show({target:i,location:lQ(e),modifiers:l0(e)})))return!0;if("keydown"===e.type&&("ContextMenu"===e.code||"F10"===e.code&&e.shiftKey)){let a=null==i?void 0:i.getBoundingClientRect();if(db(i)&&a&&r.show({target:i,location:{x:Math.ceil(a.left+a.width/2),y:Math.ceil(a.top+a.height/2)},modifiers:l0(e)}))return e.preventDefault(),e.stopPropagation(),!0}if("pointerdown"===e.type&&"mouse"!==e.pointerType&&0===e.button){let a=e.target;for(;a&&i!==a;)a=a.parentNode;if(!a||!r.visible)return!1;let o=lQ(e);if(await new Promise((i,r)=>{let a=lQ(e);a||i(!1);let o=a,n=setTimeout(()=>{var e;l.abort(),i((e=o,Math.hypot(a.x-e.x,a.y-e.y)<df.MAX_DISTANCE))},df.DELAY),l=new AbortController,s=l.signal;for(let e of["pointermove","pointerup","pointercancel"])window.addEventListener(e,e=>{if("pointerup"===e.type||"pointercancel"===e.type)clearTimeout(n),l.abort(),i(!1);else if("pointermove"===e.type){let i=lQ(e);i&&(o=i)}},{passive:!0,signal:s})}))return"closed"===r.state&&!!db(i)&&(r.show({target:i,location:o}),!0)}return!1}function db(e){return e.dispatchEvent(new Event("contextmenu",{cancelable:!0}))}df.DELAY=300,df.MAX_DISTANCE=10;var dy="<mo>&#x2061;</mo>",dv="<mo>&#8290;</mo>";function dx(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function d_(e,i){return e&&i.generateID?` extid="${e}"`:""}function dw(e){return e.index<e.atoms.length&&e.atoms[e.index].superscript&&"subsup"===e.atoms[e.index].type}function dk(e){let i=-1,r=e.index,a=!1,o=!1;for(;r<e.atoms.length&&!a&&!o;){let i=e.atoms[r];o=!(a=!i.isDigit())&&void 0!==i.superscript,r++}return o&&(i=r-1),i}function dM(e,i,r){var a;let o=i.atoms[i.index-1];if(!o)return!1;if(!o.superscript&&!o.subscript)if((null==(a=i.atoms[i.index])?void 0:a.type)!=="subsup")return!1;else o=i.atoms[i.index],i.index+=1;let n=i.lastType;i.lastType="";let l=dS(o.superscript,r);i.lastType="";let s=dS(o.subscript,r);if(i.lastType=n,!l&&!s)return!1;let c="";return l&&s?c=`<msubsup>${e}${s}${l}</msubsup>`:l?c=`<msup>${e}${l}</msup>`:s&&(c=`<msub>${e}${s}</msub>`),i.mathML+=c,i.lastType="",!0}function dS(e,i,r,a){null!=i||(i={});let o={atoms:[],index:null!=r?r:0,mathML:"",lastType:""};if("number"==typeof e||"boolean"==typeof e)o.mathML=e.toString();else if("string"==typeof e)o.mathML=e;else if(e instanceof oG)o.mathML=dE(e,i);else if(Array.isArray(e)){o.atoms=e;let r=0;for(a=a||(e?e.length:0);o.index<a;)if(function(e,i,r){i=null!=i?i:e.atoms.length;let a=e.index,o="",n=dk(e);for(n>=0&&n<i&&(i=n);e.index<i&&"text"===e.atoms[e.index].mode;)o+=e.atoms[e.index].value?e.atoms[e.index].value:" ",e.index+=1;return o.length>0&&(o=`<mtext ${d_(e.atoms[a].id,r)}>${dx(o)}</mtext>`,n<0&&dw(e)&&(n=e.index,e.index+=1),dM(o,e,r)||(e.mathML+=o,e.lastType="mtext"),!0)}(o,a,i)||function(e,i,r){i=null!=i?i:e.atoms.length;let a=e.index,o="",n=dk(e);for(n>=0&&n<i&&(i=n);e.index<i&&e.atoms[e.index].isDigit();)o+=e.atoms[e.index].asDigit(),e.index+=1;return!(o.length<=0)&&(o="<mn"+d_(e.atoms[a].id,r)+">"+o+"</mn>",n<0&&dw(e)&&(n=e.index,e.index+=1),dM(o,e,r)||(e.mathML+=o,e.lastType="mn"),!0)}(o,a,i)||function(e,i,r){var a,o,n,l,s,c,d,u;let h=!1;i=null!=i?i:e.atoms.length;let p="",m="",f=e.atoms[e.index],g=null==(a=f.style)?void 0:a.variant,b=null==(o=f.style)?void 0:o.variantStyle,y="";if(f.value&&(g||b)){let i=null!=(n=ee(f.value,g,b))?n:f.value;if(i!==f.value)return e.index+=1,dM(p=`<mi${d_(f.id,r)}>${i}</mi>`,e,r)||(e.mathML+=p,e.lastType="mi"),!0;(y=null!=(l=({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"})[(null!=b?b:"")+(null!=g?g:"")])?l:"")&&(y=` mathvariant="${y}"`)}let v={"\\exponentialE":"&#x02147;","\\imaginaryI":"&#x2148;","\\differentialD":"&#x2146;","\\capitalDifferentialD":"&#x2145;","\\alpha":"&#x03b1;","\\pi":"&#x03c0;","\\infty":"&#x221e;","\\forall":"&#x2200;","\\nexists":"&#x2204;","\\exists":"&#x2203;","\\hbar":"ℏ","\\cdotp":"⋅","\\ldots":"…","\\dots":"…","\\cdots":"⋯","\\ddots":"⋱","\\vdots":"⋮","\\ldotp":"."};if("!"===f.command)return e.index+=1,dM(p="<mo>!</mo>",e,r)||(e.mathML+=p,e.lastType="mo"),!0;if(v[f.command]){e.index+=1;let i=`<mi${d_(f.id,r)}${y}>${v[f.command]}</mi>`;return("mi"===e.lastType||"mn"===e.lastType||"mtext"===e.lastType||"fence"===e.lastType)&&(i=dv+i),dM(i,e,r)||(e.mathML+=i,e.lastType="mi"),!0}if("\\operatorname"===f.command)m=dC(f.body),e.index+=1;else if(g||b)for(;e.index<i&&("mord"===f.type||"macro"===f.type)&&!f.isDigit()&&g===(null!=(c=null==(s=f.style)?void 0:s.variant)?c:"")&&b===(null!=(u=null==(d=f.style)?void 0:d.variantStyle)?u:"");)m+=dC([f]),e.index+=1,f=e.atoms[e.index];else"mord"!==f.type&&"macro"!==f.type||f.isDigit()||(m+=dC([f]),e.index+=1);if(m.length>0){h=!0,p=`<mi${y}>${m}</mi>`;let i=e.lastType;p.endsWith(">f</mi>")||p.endsWith(">g</mi>")?(p+=dy,e.lastType="applyfunction"):e.lastType=/^<mo>(.*)<\/mo>$/.test(p)?"mo":"mi",dM(p,e,r)||(("mi"===i||"mn"===i||"mtext"===i||"fence"===i)&&(p=dv+p),e.mathML+=p)}return h}(o,a,i)||function(e,i,r){let a=!1;i=null!=i?i:e.atoms.length;let o="",n="",l=e.atoms[e.index];if(!l)return!1;let s={"\\ne":"&ne;","\\neq":"&ne;","\\pm":"&#177;","\\times":"&#215;","\\colon":":","\\vert":"|","\\Vert":"∥","\\mid":"∣","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lbrack":"[","\\rbrack":"]","\\lparen":"(","\\rparen":")","\\langle":"⟨","\\rangle":"⟩","\\lfloor":"⌊","\\rfloor":"⌋","\\lceil":"⌈","\\rceil":"⌉"};if(s[l.command]){e.index+=1;let i=`<mo${d_(l.id,r)}>${s[l.command]}</mo>`;return dM(i,e,r)||(e.mathML+=i,e.lastType="mo"),!0}if(e.index<i&&("mbin"===l.type||"mrel"===l.type))o+=dE(e.atoms[e.index],r),e.index+=1,n="mo";else if(e.index<i&&("mop"===l.type||"operator"===l.type||"extensible-symbol"===l.type)){if("over-under"===l.subsupPlacement&&(l.superscript||l.subscript)){let i=dL(l,r);return l.superscript&&l.subscript?(o+="<munderover>"+i,o+=dS(l.subscript,r),o+=dS(l.superscript,r),o+="</munderover>"):l.superscript?(o+="<mover>"+i,o+=dS(l.superscript,r),o+="</mover>"):l.subscript&&(o+="<munder>"+i,o+=dS(l.subscript,r),o+="</munder>"),e.mathML+=o,e.lastType="mo",e.index+=1,!0}{let i=e.atoms[e.index],a="\\operatorname"===i.value,l=a?'<mi class="MathML-Unit"'+d_(i.id,r)+">"+dC(i.value)+"</mi>":dL(i,r);o+=l,a||/^<mo>(.*)<\/mo>$/.test(l)?n=a?"mi":"mo":(o+=dy,n="applyfunction")}"mi"!==e.lastType&&"mn"!==e.lastType||/^<mo>(.*)<\/mo>$/.test(o)||(o=dv+o),e.index+=1}return o.length>0&&(a=!0,dM(o,e,r)||(e.mathML+=o,e.lastType=n)),a}(o,a,i)||function(e,i,r){let a=!1;i=null!=i?i:e.atoms.length;let o="",n="";if(e.index<i&&"mopen"===e.atoms[e.index].type){let l=!1,s=0,c=e.index,d=-1,u=c+1;for(;u<i&&!l;)"mopen"===e.atoms[u].type?s+=1:"mclose"===e.atoms[u].type&&(s-=1),-1===s&&(l=!0,d=u),u+=1;l&&(o="<mrow>"+dL(e.atoms[c],r)+dS(e.atoms,r,c+1,d)+dL(e.atoms[d],r)+"</mrow>",e.index=d+1,("mi"===e.lastType||"mn"===e.lastType||"mfrac"===e.lastType||"fence"===e.lastType)&&(e.mathML+=dv),dM(o,e,r)&&(a=!0,e.lastType="",o=""),n="fence")}return o.length>0&&(a=!0,e.mathML+=o,e.lastType=n),a}(o,a,i))r+=1;else if(o.index<a){let e=dE(o.atoms[o.index],i);"mn"===o.lastType&&e.length>0&&"genfrac"===o.atoms[o.index].type&&(e="<mo>&#x2064;</mo>"+e),"genfrac"===o.atoms[o.index].type?o.lastType="mfrac":o.lastType="",o.index+=1,dM(e,o,i)?r+=1:e.length>0&&(o.mathML+=e,r+=1)}r>1&&(o.mathML="<mrow>"+o.mathML+"</mrow>")}return o.mathML}function dL(e,i){let r="",a=dC(e.value);return a&&(r="<mo"+d_(e.id,i)+">"+a+"</mo>"),r}function dC(e){if(!e)return"";if("string"==typeof e)return dx(e);if(!Array.isArray(e)&&"string"==typeof e.body)return dx(e.body);let i="";for(let r of e)"string"==typeof r.value&&(i+=r.value);return dx(i)}function dE(e,i){var r,a,o,n,l,s,c,d,u,h,p,m,f,g,b,y,v,x,_,w,k,M,S;if("text"===e.mode)return`<mi${d_(e.id,i)}>${dx(e.value)}</mi>`;let L={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",longleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",longrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",longrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xleftrightarrows:"⇄",xRightleftharpoons:"⇌",longRightleftharpoons:"⇌",xLeftrightharpoons:"⇋",longLeftrightharpoons:"⇋"},C="",E="",A,z,T,D,K,B,{command:$}=e;if("\\error"===e.command)return`<merror${d_(e.id,i)}>${dS(e.body,i)}</merror>`;let P={"\\vert":"|","\\Vert":"∥","\\mid":"∣","\\lbrack":"[","\\rbrack":"]","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"⟨","\\rangle":"⟩","\\lfloor":"⌊","\\rfloor":"⌋","\\lceil":"⌈","\\rceil":"⌉"};switch(e.type){case"first":case"line":case"overlap":case"subsup":case"phantom":case"composition":case"rule":case"chem":break;case"error":if("\\\\"===e.command)break;C=`<merror${d_(e.id,i)}>${dS(e.body,i)}</merror>`;break;case"group":case"root":C=dS(e.body,i);break;case"array":if((e.leftDelim&&"."!==e.leftDelim||e.rightDelim&&"."!==e.rightDelim)&&(C+="<mrow>",e.leftDelim&&"."!==e.leftDelim&&(C+=`<mo>${dx(P[e.leftDelim]||e.leftDelim)}</mo>`)),C+="<mtable",e.colFormat){for(C+=' columnalign="',T=0;T<e.colFormat.length;T++){let i=e.colFormat[T];"align"in i&&(C+=({l:"left",c:"center",r:"right"})[i.align]+" ")}C+='"'}for(C+=">",z=0;z<e.rows.length;z++){for(C+="<mtr>",A=0;A<e.rows[z].length;A++)C+="<mtd>"+dS(e.rows[z][A],i)+"</mtd>";C+="</mtr>"}C+="</mtable>",(e.leftDelim&&"."!==e.leftDelim||e.rightDelim&&"."!==e.rightDelim)&&(e.rightDelim&&"."!==e.rightDelim&&(C+=`<mo>${dx(P[e.rightDelim]||e.rightDelim)}</mo>`),C+="</mrow>");break;case"genfrac":(e.leftDelim||e.rightDelim)&&(C+="<mrow>"),e.leftDelim&&"."!==e.leftDelim&&(C+="<mo"+d_(e.id,i)+">"+dx(P[e.leftDelim]||e.leftDelim)+"</mo>"),e.hasBarLine?(C+="<mfrac>",C+=dS(e.above,i)||"<mi>&nbsp;</mi>",C+=dS(e.below,i)||"<mi>&nbsp;</mi>",C+="</mfrac>"):(C+="<mtable"+d_(e.id,i)+">",C+="<mtr>"+dS(e.above,i)+"</mtr>",C+="<mtr>"+dS(e.below,i)+"</mtr>",C+="</mtable>"),e.rightDelim&&"."!==e.rightDelim&&(C+="<mo"+d_(e.id,i)+">"+dx(P[e.rightDelim]||e.rightDelim)+"</mo>"),(e.leftDelim||e.rightDelim)&&(C+="</mrow>");break;case"surd":e.hasEmptyBranch("above")?(C+="<msqrt"+d_(e.id,i)+">",C+=dS(e.body,i),C+="</msqrt>"):(C+="<mroot"+d_(e.id,i)+">",C+=dS(e.body,i),C+=dS(e.above,i),C+="</mroot>");break;case"leftright":let O=e.leftDelim;C="<mrow>",O&&"."!==O&&(C+=`<mo${d_(e.id,i)}>${dx(null!=(r=P[O])?r:O)}</mo>`),e.body&&(C+=dS(e.body,i));let I=e.matchingRightDelim();I&&"."!==I&&(C+=`<mo${d_(e.id,i)}>${dx(null!=(a=P[I])?a:I)}</mo>`),C+="</mrow>";break;case"sizeddelim":case"delim":C+=`<mo${d_(e.id,i)}>${dx(P[e.value]||e.value)}</mo>`;break;case"accent":C+='<mover accent="true"'+d_(e.id,i)+">",C+=dS(e.body,i),C+="<mo>"+(({"\\vec":"&#x20d7;","\\acute":"&#x00b4;","\\grave":"&#x0060;","\\dot":"&#x02d9;","\\ddot":"&#x00a8;","\\tilde":"&#x007e;","\\bar":"&#x00af;","\\breve":"&#x02d8;","\\check":"&#x02c7;","\\hat":"&#x005e;"})[$]||e.accent)+"</mo>",C+="</mover>";break;case"newline":C+='<mspace linebreak="newline"></mspace>';break;case"overunder":K=e.above,D=e.below,(e.svgAbove||K)&&(e.svgBelow||D)?B=e.body:K&&K.length>0?(B=e.body,null!=(n=null==(o=e.body)?void 0:o[0])&&n.below?(D=e.body[0].below,B=e.body[0].body):(null==(s=null==(l=e.body)?void 0:l[0])?void 0:s.type)==="first"&&null!=(d=null==(c=e.body)?void 0:c[1])&&d.below&&(D=e.body[1].below,B=e.body[1].body)):D&&D.length>0&&(B=e.body,null!=(h=null==(u=e.body)?void 0:u[0])&&h.above?(K=e.body[0].above,B=e.body[0].body):(null==(m=null==(p=e.body)?void 0:p[0])?void 0:m.type)==="first"&&null!=(g=null==(f=e.body)?void 0:f[1])&&g.above&&(K=e.body[1].above,B=e.body[1].body)),(e.svgAbove||K)&&(e.svgBelow||D)?(C+=`<munderover ${d_(e.id,i)}>`,C+=null!=(b=L[e.svgBody])?b:dS(B,i),C+=null!=(y=L[e.svgBelow])?y:dS(D,i),C+=null!=(v=L[e.svgAbove])?v:dS(K,i),C+="</munderover>"):e.svgAbove||K?(C+=`<mover ${d_(e.id,i)}>`+(null!=(x=L[e.svgBody])?x:dS(B,i)),C+=null!=(_=L[e.svgAbove])?_:dS(K,i),C+="</mover>"):(e.svgBelow||D)&&(C+=`<munder ${d_(e.id,i)}>`+(null!=(w=L[e.svgBody])?w:dS(B,i)),C+=null!=(k=L[e.svgBelow])?k:dS(D,i),C+="</munder>");break;case"placeholder":C+="?";break;case"mord":{if((C="string"==typeof e.value?e.value:$).length>0&&C.startsWith("\\"))"string"==typeof e.value&&e.value.charCodeAt(0)>255?C=String.fromCodePoint(e.value.codePointAt(0)):"string"==typeof e.value&&(C=e.value.charAt(0));else if("\\char"===e.command){let i=null==(M=e.args)?void 0:M[0];if(void 0!==i&&"number"in i){let e=i.number;"number"==typeof e&&e>=0&&e<=1114111&&(C=String.fromCodePoint(e))}}else"string"==typeof e.value?C=e.value:(console.error("Did not expect this"),C="");let r=/\d/.test(C)?"mn":"mi";C=`<${r}${d_(e.id,i)}>${dx(C)}</${r}>`;break}case"mbin":case"mrel":case"minner":C=dL(e,i);break;case"mpunct":C='<mo separator="true"'+d_(e.id,i)+">"+$+"</mo>";break;case"mop":case"operator":case"extensible-symbol":"​"!==e.value&&(C="<mo"+d_(e.id,i)+">"+("\\operatorname"===$?e.body:$||e.body)+"</mo>");break;case"box":C='<menclose notation="box"',e.backgroundcolor&&(C+=' mathbackground="'+e.backgroundcolor+'"'),C+=d_(e.id,i)+">"+dS(e.body,i)+"</menclose>";break;case"spacing":C+='<mspace width="'+(null!=(S=({"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\>":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5})[$])?S:0)+'em"/>';break;case"enclose":for(let i in C='<menclose notation="',e.notation)Object.prototype.hasOwnProperty.call(e.notation,i)&&e.notation[i]&&(C+=E+i,E=" ");C+=d_(e.id,i)+'">'+dS(e.body,i)+"</menclose>";break;case"prompt":C='<menclose notation="roundexbox""">'+dS(e.body,i)+"</menclose>";break;case"space":C+="&nbsp;";break;case"mopen":case"mclose":C+=dL(e,i);break;case"macro":{let r=e.command+dC(e.macroArgs);r&&(C+=`<mo ${d_(e.id,i)}>${r}</mo>`)}break;case"latexgroup":case"tooltip":C+=dS(e.body,i);break;case"latex":C+="<mtext"+d_(e.id,i)+">"+dx(e.value)+"</mtext>";break;case"text":C+=`<mtext ${d_(e.id,i)}x>${dx(e.value)}</mtext>`;break;default:if("\\displaystyle"===e.command)return`<mrow ${d_(e.id,i)} displaystyle="true">${dS(e.body,i)}</mrow>`;if("\\textstyle"===e.command)return`<mrow ${d_(e.id,i)} displaystyle="false">${dS(e.body,i)}</mrow>`;console.info("Unexpected element in conversion to MathML:",e)}return C}var dA={"\\alpha":"alpha ","\\mu":"mew ","\\sigma":"sigma ","\\pi":"pie ","\\imaginaryI":"imaginary eye ","\\imaginaryJ":"imaginary jay ","\\sum":"Summation ","\\prod":"Product ","+":"plus ","-":"minus ",";":'<break time="150ms"/> semi-colon <break time="150ms"/>',",":'<break time="150ms"/> comma <break time="150ms"/>',"|":'<break time="150ms"/>Vertical bar<break time="150ms"/>',"(":'<break time="150ms"/>Open paren. <break time="150ms"/>',")":'<break time="150ms"/> Close paren. <break time="150ms"/>',"=":"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 ","​":"","−":"minus ",":":'<break time="150ms"/> such that <break time="200ms"/> ',"\\colon":'<break time="150ms"/> such that <break time="200ms"/> ',"\\hbar":"etch bar ","\\iff":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\Longleftrightarrow":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\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 <break time="150ms"/><say-as interpret-as="character">n</say-as>',"\\C":'the set <break time="150ms"/><say-as interpret-as="character">c</say-as>',"\\Z":'the set <break time="150ms"/><say-as interpret-as="character">z</say-as>',"\\Q":'the set <break time="150ms"/><say-as interpret-as="character">q</say-as>',"\\infty":"infinity ","\\nabla":"nabla ","\\partial":"partial derivative of ","\\cdot":"times ","\\cdots":"dot dot dot ","\\ldots":"dot dot dot ","\\dots":"dot dot dot ","\\Rightarrow":"implies ","\\lparen":'<break time="150ms"/>open paren<break time="150ms"/>',"\\rparen":'<break time="150ms"/>close paren<break time="150ms"/>',"\\lbrace":'<break time="150ms"/>open brace<break time="150ms"/>',"\\{":'<break time="150ms"/>open brace<break time="150ms"/>',"\\rbrace":'<break time="150ms"/>close brace<break time="150ms"/>',"\\}":'<break time="150ms"/>close brace<break time="150ms"/>',"\\langle":'<break time="150ms"/>left angle bracket<break time="150ms"/>',"\\rangle":'<break time="150ms"/>right angle bracket<break time="150ms"/>',"\\lfloor":'<break time="150ms"/>open floor<break time="150ms"/>',"\\rfloor":'<break time="150ms"/>close floor<break time="150ms"/>',"\\lceil":'<break time="150ms"/>open ceiling<break time="150ms"/>',"\\rceil":'<break time="150ms"/>close ceiling<break time="150ms"/>',"\\vert":'<break time="150ms"/>vertical bar<break time="150ms"/>',"\\mvert":'<break time="150ms"/>divides<break time="150ms"/>',"\\lvert":'<break time="150ms"/>left vertical bar<break time="150ms"/>',"\\rvert":'<break time="150ms"/>right vertical bar<break time="150ms"/>',"\\lbrack":'<break time="150ms"/> open square bracket <break time="150ms"/>',"\\rbrack":'<break time="150ms"/> close square bracket <break time="150ms"/>',mm:"millimeters",cm:"centimeters",km:"kilometers",kg:"kilograms"},dz={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 dT(e){let i=0;if(I(e))for(let r of e)"first"!==r.type&&(i+=1);return 1===i}function dD(e){let i="";if(I(e))for(let r of e)"first"!==r.type&&"string"==typeof r.value&&(i+=r.value);return i}function dK(e){if(e&&!e.some(e=>"first"!==e.type&&void 0===e.value))return e.map(e=>e.value).join("")}function dB(e){return`<emphasis>${e}</emphasis>`}function d$(e){var i,r;let a=globalThis.MathfieldElement;if("sre"===a.textToSpeechRules&&("sre"in window||"SRE"in window)){let o=dS(e);if(o){a.textToSpeechMarkup&&(a.textToSpeechRulesOptions=null!=(i=a.textToSpeechRulesOptions)?i:{},a.textToSpeechRulesOptions=g(f({},a.textToSpeechRulesOptions),{markup:a.textToSpeechMarkup}),"ssml"===a.textToSpeechRulesOptions.markup&&(a.textToSpeechRulesOptions=g(f({},a.textToSpeechRulesOptions),{markup:"ssml_step"})),a.textToSpeechRulesOptions=g(f({},a.textToSpeechRulesOptions),{rate:a.speechEngineRate}));let e=null!=(r=window.SRE)?r:globalThis.sre.System.getInstance();a.textToSpeechRulesOptions&&e.setupEngine(a.textToSpeechRulesOptions);let n="";try{n=e.toSpeech(o)}catch(e){console.error("MathLive 0.110.6: `SRE.toSpeech()` runtime error",e)}return n}return""}let o=function e(i,r){var a,o,n,l,s,c,d,u,h,p,m;if(!r)return"";if(I(r))return function(i,r){var a;let o="",n=!1,l=!1;for(let s=0;s<r.length;s++)"first"!==r[s].type&&("text"!==r[s].mode&&(l=!1),s<r.length-2&&"mopen"===r[s].type&&"mclose"===r[s+2].type&&"mord"===r[s+1].type?(o+=" of ",o+=dB(e(i,r[s+1])),s+=2):"text"===r[s].mode?l?o+=null!=(a=r[s].value)?a:" ":(l=!0,o+=e("text",r[s])):r[s].isDigit()?n?o+=r[s].asDigit():(n=!0,o+=e(i,r[s])):(n=!1,o+=e(i,r[s])));return o}(i,r);let f="";if(r.id&&"math"===i&&(f+='<mark name="'+r.id.toString()+'"/>'),"text"===r.mode)return f+r.value;let g="",b="",y="",v=!1,{command:x}=r;switch(x){case"\\vec":return"vector "+e(i,r.body);case"\\acute":return e(i,r.body)+" acute";case"\\grave":return e(i,r.body)+" grave";case"\\dot":return"dot over"+e(i,r.body);case"\\ddot":return"double dot over"+e(i,r.body);case"\\mathring":return"ring over"+e(i,r.body);case"\\tilde":case"\\widetilde":return"tilde over"+e(i,r.body);case"\\bar":return e(i,r.body)+" bar";case"\\breve":return e(i,r.body)+" breve";case"\\check":case"\\widecheck":return"check over "+e(i,r.body);case"\\hat":case"\\widehat":return"hat over"+e(i,r.body);case"\\overarc":case"\\overparen":case"\\wideparen":return"arc over "+e(i,r.body);case"\\underarc":case"\\underparen":return"arc under "+e(i,r.body);case"\\mathop":return null!=(a=dK(r.body))?a:e(i,r.body);case"\\mathit":return null!=(o=dK(r.body))?o:e(i,r.body);case"\\mathrm":return null!=(n=dK(r.body))?n:e(i,r.body);case"\\mathbb":return"blackboard"+(null!=(l=dK(r.body))?l:e(i,r.body))}switch(r.type){case"prompt":f+=' <break time="300ms"/> '+(r.body.length>1?'start input . <break time="500ms"/> '+e(i,r.body)+'. <break time="500ms"/> end input':"blank")+'. <break time="700ms"/>'+(null!=(s=r.correctness)?s:"")+' . <break time="700ms"/> ';break;case"array":let _=r.rows,w=r.environmentName;if(Object.keys(dz).includes(w)){f+=` begin ${dz[w]} `;for(let i=0;i<_.length;i++){i>0&&(f+=","),f+=` row ${i+1} `;for(let r=0;r<_[i].length;r++)r>0&&(f+=","),f+=` column ${r+1}: `,f+=e("math",_[i][r])}f+=` end ${dz[w]} `}break;case"group":"\\ne"===x?f+=" not equal ":("\\not"===x&&(f+=" not "),f+=e("math",r.body));break;case"root":f+=e("math",r.body);break;case"genfrac":if(g=e("math",r.above),b=e("math",r.below),dT(r.above)&&dT(r.below)){let e={"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 "}[dD(r.above)+"/"+dD(r.below)];e?f=e:f+=g+" over "+b}else f+=' the fraction <break time="150ms"/>'+g+' over <break time="150ms"/>'+b+'.<break time="150ms"/> End fraction.<break time="150ms"/>';break;case"surd":if(y=e("math",r.body),r.hasEmptyBranch("above"))f+=dT(r.body)?" the square root of "+y+" , ":' the square root of <break time="200ms"/>'+y+'. <break time="200ms"/> End square root';else{let i=e("math",r.above),a=(i=i.trim()).replace(/<mark([^/]*)\/>/g,"");"3"===a?f+=' the cube root of <break time="200ms"/>'+y+'. <break time="200ms"/> End cube root':"n"===a?f+=' the nth root of <break time="200ms"/>'+y+'. <break time="200ms"/> End root':f+=' the root with index: <break time="200ms"/>'+i+', of <break time="200ms"/>'+y+'. <break time="200ms"/> End root'}break;case"leftright":f+=null!=(c=r.leftDelim?dA[r.leftDelim]:void 0)?c:r.leftDelim,f+=e("math",r.body),f+=null!=(d=r.rightDelim?dA[r.rightDelim]:void 0)?d:r.rightDelim;break;case"rule":case"overunder":case"overlap":case"space":case"spacing":break;case"macro":let k=x.replace(/^\\/g,""),M=e_()[k];null!=M&&M.expand?f+=e("math",r.body):f+=`${k} `;break;case"placeholder":f+="placeholder ";break;case"delim":case"sizeddelim":case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":{if("\\mathbin"===x||"\\mathrel"===x||"\\mathopen"===x||"\\mathclose"===x||"\\mathpunct"===x||"\\mathord"===x||"\\mathinner"===x){f=e(i,r.body);break}let a=r.isDigit()?r.asDigit():r.value,o=r.command;if(("delim"===r.type||"sizeddelim"===r.type)&&(a=o=r.value),"text"===i)f+=a;else{if("mbin"===r.type&&(f+='<break time="150ms"/>'),a){let e=dA[a]||(o?dA[o.trim()]:"");if(e)f+=" "+e;else{let e;f+=(o?(h=o.trim(),e="",h.startsWith("\\")&&(e=" "+h.replace("\\","")+" "),e):"")||(p=a,globalThis.MathfieldElement.textToSpeechMarkup?/[a-z]/.test(p)?` <say-as interpret-as="character">${p}</say-as>`:/[A-Z]/.test(p)?`capital <say-as interpret-as="character">${p.toLowerCase()}</say-as>`:p:/[a-z]/.test(p)?" '"+p.toUpperCase()+"'":/[A-Z]/.test(p)?" 'capital "+p.toUpperCase()+"'":p)}}else f+=e("math",r.body);"mbin"===r.type&&(f+='<break time="150ms"/>')}break}case"mop":case"operator":case"extensible-symbol":if("​"!==r.value){let i=r.command;if("\\sum"===i)if(r.hasEmptyBranch("superscript")||r.hasEmptyBranch("subscript"))if(r.hasEmptyBranch("subscript"))f+=" the summation of";else{let i=e("math",r.subscript);f+=' the summation from <break time="200ms"/>'+(i=i.trim())+'<break time="200ms"/> of <break time="150ms"/>',v=!0}else{let i=e("math",r.superscript);i=i.trim();let a=e("math",r.subscript);f+=' the summation from <break time="200ms"/>'+(a=a.trim())+'<break time="200ms"/> to <break time="200ms"/>'+i+'<break time="200ms"/> of <break time="150ms"/>',v=!0}else if("\\prod"===i)if(r.hasEmptyBranch("superscript")||r.hasEmptyBranch("subscript"))if(r.hasEmptyBranch("subscript"))f+=" the product of ";else{let i=e("math",r.subscript);f+=' the product from <break time="200ms"/>'+(i=i.trim())+'<break time="200ms"/> of <break time="150ms"/>',v=!0}else{let i=e("math",r.superscript);i=i.trim();let a=e("math",r.subscript);f+=' the product from <break time="200ms"/>'+(a=a.trim())+'<break time="200ms"/> to <break time="200ms"/>'+i+'<break time="200ms"/> of <break time="150ms"/>',v=!0}else if("\\int"===i)if(r.hasEmptyBranch("superscript")||r.hasEmptyBranch("subscript"))f+=' the integral of <break time="200ms"/> ';else{let i=e("math",r.superscript);i=i.trim();let a=e("math",r.subscript);f+=' the integral from <break time="200ms"/>'+dB(a=a.trim())+'<break time="200ms"/> to <break time="200ms"/>'+dB(i)+' <break time="200ms"/> of ',v=!0}else"\\operatorname"===i||"\\operatorname*"===i?f+=((m=r.body)?m.map(e=>e.value).join(""):"")+" ":"string"==typeof r.value?f+=(null!=(u=dA[r.value])?u:r.command?dA[r.command]:void 0)||" "+r.value:r.command&&("\\mathop"===r.command?f+=e("math",r.body):f+=r.command.startsWith("\\")?" "+r.command.slice(1):" "+r.command)}break;case"enclose":f+=" crossed out "+(y=e("math",r.body))+". End crossed out.";break;case"newline":f+=" newline "}if(!v&&!r.hasEmptyBranch("superscript")){let a=e(i,r.superscript),o=(a=a.trim()).replace(/<[^>]*>/g,"");if(dT(r.superscript)){if("math"===i){let e=function(e){if(I(e)){for(let i of e)if("first"!==i.type&&i.id)return i.id.toString()}return""}(r.superscript);e&&(f+='<mark name="'+e+'"/>')}"′"===o?f+=" prime ":"2"===o?f+=" squared ":"3"===o?f+=" cubed ":Number.isNaN(Number.parseInt(o))?f+=" to the "+a+"; ":f+=' to the <say-as interpret-as="ordinal">'+o+"</say-as> power; "}else Number.isNaN(Number.parseInt(o))?f+=" raised to the "+a+"; ":f+=' raised to the <say-as interpret-as="ordinal">'+o+"</say-as> power; "}if(!v&&!r.hasEmptyBranch("subscript")){let i=e("math",r.subscript);i=i.trim(),f+=dT(r.subscript)?" sub "+i:" subscript "+i+". End subscript. "}return f}("math",e);if("ssml"===a.textToSpeechMarkup){let e="";a.speechEngineRate&&(e='<prosody rate="'+a.speechEngineRate+'">'),o='<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><amazon:auto-breaths>'+e+"<p><s>"+o+"</s></p>"+(e?"</prosody>":"")+"</amazon:auto-breaths></speak>"}else o="mac"===a.textToSpeechMarkup&&"macos"===w()?o.replace(/<mark([^/]*)\/>/g,"").replace(/<emphasis>/g,"[[emph+]]").replace(/<\/emphasis>/g,"").replace(/<break time="(\d*)ms"\/>/g,"[[slc $1]]").replace(/<say-as[^>]*>/g,"").replace(/<\/say-as>/g,""):o.replace(/<[^>]*>/g,"").replace(/\s{2,}/g," ");return o}var dP={"\\ne":"≠","\\neq":"≠","−":"-","-":"-","\\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"},dO={"\\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":"@"},dI={"\\vert":"|","\\Vert":"||","\\mid":"|","\\lbrack":"[","\\rbrack":"]","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"(:","\\rangle":":)"};function dR(e,i){var r,a,o,n,l,s,c,d,u,h,p,m,f,g,b,y,v,x,_;if(!e)return"";if(I(e)){if(0===e.length)return"";if("latex"===e[0].mode)return e.map(e=>dR(e)).join("");if("text"===e[0].mode){let a=0,o="";for(;(null==(r=e[a])?void 0:r.mode)==="text";)o+=e[a].body?dR(e[a].body,i):e[a].value,a++;return null!=i&&i.plain?o+dR(e.slice(a),i):`"${o}" ${dR(e.slice(a))}`}let n=0,l=[];for(;(null==(a=e[n])?void 0:a.mode)==="math";){let r="";for(;(null==(o=e[n])?void 0:o.type)==="mord"&&/\d/.test(e[n].value);)r+=e[n++].value;r?l.push(r):l.push(dR(e[n++],i))}return l.push(dR(e.slice(n),i)),function(e){let i="";for(let r of e){let e=i[i.length-1];void 0!==e&&(/\d$/.test(e)&&/^\d/.test(r)||/[a-zA-Z]$/.test(e)&&/^[a-zA-Z]/.test(r))&&(i+=" "),i+=r}return i}(l)}if("text"===e.mode)return null!=i&&i.plain?e.value:`"${e.value}"`;let w="",{command:k}=e,M;if("\\placeholder"===k||"\\blank"===k)return`(${dR(e.body,i)})`;let S=oG.serialize([e],{expandMacro:!1,defaultMode:"math"});switch(e.type){case"accent":let L={"\\vec":"vec","\\dot":"dot","\\ddot":"ddot","\\bar":"bar","\\hat":"hat","\\acute":"acute;","\\grave":"grave","\\tilde":"tilde","\\breve":"breave","\\check":"check"}[k];w=`${null!=L?L:""} ${dR(e.body,i)} `;break;case"first":return"";case"latexgroup":return e.body.map(e=>e.value).join("");case"group":case"root":w=null!=(n=dP[k])?n:dR(e.body,i);break;case"genfrac":(e.leftDelim||e.rightDelim)&&(w="."!==e.leftDelim&&e.leftDelim?e.leftDelim:"{:"),e.hasBarLine?(w+="(",w+=dR(e.above,i),w+=")/(",w+=dR(e.below,i),w+=")"):(w+="((",w+=dR(e.above,i),w+=") choose (",w+=dR(e.below,i),w+="))"),(e.leftDelim||e.rightDelim)&&(w+="."!==e.rightDelim&&e.rightDelim?e.rightDelim:"{:");break;case"surd":e.hasEmptyBranch("above")?w+=`sqrt(${dR(e.body,i)})`:w+=`root(${dR(e.above,i)})(${dR(e.body,i)})`;break;case"latex":case"sizeddelim":case"delim":case"mopen":case"mclose":w=e.value;break;case"leftright":{let r=e.leftDelim;r&&dI[r]&&(r=dI[r]),w+="."!==r&&r?r:"{:",w+=dR(e.body,i);let a=e.matchingRightDelim();a&&dI[a]&&(a=dI[a]),w+="."!==a&&a?a:":}"}break;case"overlap":case"overunder":case"box":break;case"mord":if(dP[S])return dP[S];(w=null!=(c=null!=(s=null!=(l=dP[k])?l:k)?s:k)?c:"string"==typeof e.value?e.value:"").startsWith("\\")&&(w+=" "),(M=k?k.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null)?w=String.fromCodePoint(Number.parseInt("0x"+M[1])):w.length>0&&w.startsWith("\\")&&(w="string"==typeof e.value?e.value.charAt(0):e.command),w=function(e,i){if(!i)return e;let r=e;return"double-struck"===i.variant&&(r=`bbb "${r}"`),"script"===i.variant&&(r=`cc "${r}"`),"fraktur"===i.variant&&(r=`fr "${r}"`),"sans-serif"===i.variant&&(r=`sf "${r}"`),"monospace"===i.variant&&(r=`tt "${r}"`),"bold"===i.variantStyle&&(r=`bb "${r}"`),i.color?`color({${i.color}})(${r})`:r}(w,e.style);break;case"mbin":case"mrel":case"minner":w=null!=(h=null!=(u=null!=(d=dP[S])?d:dP[k])?u:dO[k])?h:e.value;break;case"mpunct":w=null!=(p=dO[k])?p:k;break;case"mop":case"operator":case"extensible-symbol":"​"!==e.value&&(w=(dO[k]?dO[k]:"\\operatorname"===k?dR(e.body,i):null!=(m=e.value)?m:k)+" ");break;case"array":let C=e.environmentName;if(e.isMultiline)w=e.rows.map(e=>e.map(e=>dR(e,i)).join("")).join(`
3453
- `);else{let r=null!=(f=({bmatrix:["[","]"],"bmatrix*":["[","]"]})[C])?f:["(",")"],a=[];for(let o of e.rows){let e=[];for(let r of o)e.push(dR(r,i));a.push(r[0]+e.join(",")+r[1])}let o=null!=(g=({bmatrix:["[","]"],"bmatrix*":["[","]"],cases:["{",":}"]})[C])?g:["(",")"];w=o[0]+a.join(",")+o[1]}break;case"spacing":w=null!=(y=null!=(b=dP[S])?b:dP[k])?y:" ";break;case"newline":w=`
3454
- `;break;case"enclose":w="("+dR(e.body,i)+")";break;case"space":w=" ";break;case"subsup":w="";break;case"macro":w=null!=(_=null!=(x=null!=(v=dP[S])?v:dP[k])?x:dO[k])?_:dR(e.body,i)}if(!e.hasEmptyBranch("subscript")){w+="_";let r=dR(e.subscript,i);w+=1!==r.length?`(${r})`:r}if(!e.hasEmptyBranch("superscript")){w+="^";let r=dR(e.superscript,i);w+=1!==r.length?`(${r})`:r}return w}function dN(e,i){var r;let a=g(f({},oH()),{renderPlaceholder:()=>new oE(160,{maxFontSize:1})});if(null!=i&&i.letterShapeStyle&&(null==i?void 0:i.letterShapeStyle)!=="auto"&&(a.letterShapeStyle=i.letterShapeStyle),null!=i&&i.macros){let e=ek(null==i?void 0:i.macros);a.getMacro=i=>eS(i,e)}null!=i&&i.registers&&(a.registers=f(f({},a.registers),i.registers));let o=null!=(r=null==i?void 0:i.defaultMode)?r:"math",n="math",l="displaystyle";"inline-math"===o?l="textstyle":"math"===o?l="displaystyle":"text"===o&&(l="textstyle",n="text");let s=new oW({from:a}),c=new oG({type:"root",mode:n,body:lt(e,{context:s,parseMode:n,mathstyle:l})}).render(s);return c?(oA(lL(c,s)),oz(c,{classes:"ML__latex"}).toMarkup()):""}function dq(e,i){let r=f({},oH());if(null!=i&&i.macros){let e=ek(i.macros);r.getMacro=i=>eS(i,e)}return li(e,{context:r})}function dF(e,i={}){return dS(lt(e,{parseMode:"math",args:()=>"",mathstyle:"displaystyle"}),i)}function dV(e){return d$(lt(e,{parseMode:"math",mathstyle:"displaystyle"}))}function dj(e){var i,r;if(!uE){let e=null==(i=globalThis[Symbol.for("io.cortexjs.compute-engine")])?void 0:i.ComputeEngine;e?uE=new e:console.error(`MathLive 0.110.6: The CortexJS Compute Engine library is not available.
3477
+ </div>`,u&&s.appendChild(p),s.querySelectorAll("[data-command]").forEach(i=>{let r=i.dataset.command,a=r;try{a=JSON.parse(r)}catch(e){}i.addEventListener("mousedown",e=>e.preventDefault()),a&&i.addEventListener("click",()=>e.executeCommand(a))});let m=null==(r=e.field)?void 0:r.getBoundingClientRect();m&&(l.style.top=`${window.scrollY+(m.top-l.clientHeight-15)}px`,l.style.left=`${m.left+20}px`,l.classList.add("is-visible"))}(e):de()}function di(e){let i=getComputedStyle(e).direction;return"ltr"===i||"rtl"===i?i:"ltr"}function dr(e,i,r){return"left"===i||"leading"===i&&"ltr"===r||"trailing"===i&&"rtl"===r?e.left:e.right}function da(e,i,r,a){return"middle"===r?e-i/2:"start"===r&&"rtl"===a||"end"===r&&"ltr"===a||"top"===r||"right"===r?Math.max(0,e-i):e}function dn(e){return"submenu"in e}function dl(e){return"type"in e&&"command"===e.type||"onMenuSelect"in e||"id"in e}function ds(e){return"type"in e&&"divider"===e.type}function dc(e){return"type"in e&&"heading"===e.type}var dd={};function du(e){let i=dd[e];if(!i){let r;switch(e){case"checkmark":r=`<span aria-hidden="true" class="ui-checkmark"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"></path></svg>
3478
+ </span>`;break;case"trailing-chevron":r='<span aria-hidden="true" class="ui-trailing-chevron"><svg focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path></svg></span>';break;case"mixedmark":r='<span aria-hidden="true" class="ui-mixedmark"><svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 512 512"><path fill="currentColor" d="M0 256c0-13.3 10.7-24 24-24H488c13.3 0 24 10.7 24 24s-10.7 24-24 24H24c-13.3 0-24-10.7-24-24z"/></svg></span>'}if(r){let a=document.createElement("template");a.innerHTML=r,dd[e]=a,i=a}}if(i){if("content"in i)return i.content.cloneNode(!0);let e=document.createElement("svg");return e.innerHTML=i.innerHTML,e}}var dh=class{constructor(e,i){var r;this._className="",this._element=null,this.parentMenu=i,this._declaration=e,Object.freeze(this._declaration),dn(e)?(this.type="submenu",this.submenu=new dm(e.submenu,{parentMenu:i,submenuClass:e.submenuClass,columnCount:e.columnCount})):this.type=null!=(r=e.type)?r:"command",this.hasCheck=dl(e)&&void 0!==e.checked}get rootMenu(){return this.parentMenu.rootMenu}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}dispose(){var e,i;null==(e=this._abortController)||e.abort(),this._abortController=void 0,null==(i=this._element)||i.remove(),this._element=null,this.submenu&&this.submenu.dispose(),this.submenu=void 0}get menuItem(){return this._declaration}get label(){var e;return null!=(e=this._label)?e:""}set label(e){void 0===e&&(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,i;return null!=(i=null==(e=this.element)?void 0:e.classList.contains("active"))&&i}set active(e){this.element&&this.element.classList.toggle("active",e)}updateState(e){var i,r,a;let o=this._declaration;if(ds(o)){this.enabled=!1,this.checked=!1;return}dc(o)&&(this.enabled=!1,this.checked=!1,this.visible=!0),dl(o)&&(this.checked=null!=(i=dp(o.checked,e))&&i),(dl(o)||dn(o))&&(this.enabled=null==(r=dp(o.enabled,e))||r,this.visible=null==(a=dp(o.visible,e))||a,this.visible&&this.enabled&&this.submenu&&(this.submenu.updateState(e),this.submenu.visible||(this.visible=!1))),(dl(o)||dc(o)||dn(o))&&(this.label=dp(o.label,e),this._className=dp(o.class,e),this.tooltip=dp(o.tooltip,e),this.ariaLabel=dp(o.ariaLabel,e)),this._element&&this.updateElement()}set dirty(e){e&&this.parentMenu&&(this.parentMenu.dirty=!0)}updateElement(){var e;if(!this.visible||!this.element)return;let i=this.element;i.textContent="",i.className="",i.className=null!=(e=this._className)?e:"",this.enabled?i.removeAttribute("aria-disabled"):i.setAttribute("aria-disabled","true"),!0===this.checked?(i.setAttribute("aria-checked","true"),i.append(du("checkmark"))):"mixed"===this.checked?(i.setAttribute("aria-checked","mixed"),i.append(du("mixedmark"))):i.removeAttribute("aria-checked"),this.ariaLabel&&i.setAttribute("aria-label",this.ariaLabel);let r=document.createElement("span");if(r.className=this.parentMenu.hasCheck?"label indent":"label","heading"===this.type&&r.classList.add("heading"),r.innerHTML=this.label,i.append(r),this._tooltip&&i.setAttribute("data-tooltip",this._tooltip),dl(this._declaration)&&this._declaration.keyboardShortcut){let e=document.createElement("kbd");e.innerHTML=l3(this._declaration.keyboardShortcut),i.append(e)}"submenu"===this.type&&i.append(du("trailing-chevron"))}get element(){if(this._element)return this._element;if(ds(this._declaration)){let e=document.createElement("li");return e.setAttribute("part","menu-divider"),e.setAttribute("role","divider"),this._element=e,e}let e=document.createElement("li");this._element=e,(dl(this._declaration)||dc(this._declaration)||dn(this._declaration))&&e.setAttribute("part","menu-item"),e.setAttribute("tabindex","-1"),this.hasCheck?e.setAttribute("role","menuitemcheckbox"):e.setAttribute("role","menuitem"),"submenu"===this.type&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"));let i=this.abortController.signal;return e.addEventListener("pointerenter",this,{signal:i}),e.addEventListener("pointerleave",this,{signal:i}),e.addEventListener("pointerup",this,{signal:i}),e.addEventListener("click",this,{signal:i}),this._element}dispatchSelect(){var e;if(!dl(this._declaration))return;let i=new CustomEvent("menu-select",{cancelable:!0,bubbles:!0,detail:{modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data}});this.parentMenu.dispatchEvent(i)&&"function"==typeof this._declaration.onMenuSelect&&this._declaration.onMenuSelect({target:null!=(e=this.parentMenu.host)?e:void 0,modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data})}handleEvent(e){var i;if(!(!this.visible||!this.enabled)){if("click"===e.type){"modal"===this.rootMenu.state&&this.select(),e.stopPropagation(),e.preventDefault();return}if("pointerenter"===e.type){this.rootMenu.cancelDelayedOperation(),this.parentMenu.isSubmenuOpen&&null!=(i=this.parentMenu.activeMenuItem)&&i.movingTowardSubmenu(e)?this.rootMenu.scheduleOperation(()=>{this.parentMenu.activeMenuItem=this,this.openSubmenu()}):(this.parentMenu.activeMenuItem=this,this.openSubmenu({withDelay:!0}));return}if("pointerleave"===e.type){this.rootMenu.activeSubmenu===this.parentMenu&&(this.parentMenu.activeMenuItem=null);return}if("pointerup"===e.type){"modal"!==this.rootMenu.state&&this.select(),e.stopPropagation(),e.preventDefault();return}}}select(){(this.rootMenu.cancelDelayedOperation(),"submenu"===this.type)?this.openSubmenu():(this.active=!1,setTimeout(()=>{this.active=!0,setTimeout(()=>{this.active=!1,this.rootMenu.hide(),this.dispatchSelect()},80)},80))}openSubmenu(e){var i;if("submenu"!==this.type||!this.element)return;if(null!=(i=null==e?void 0:e.withDelay)&&i)return void this.rootMenu.scheduleOperation(()=>this.openSubmenu());let r=this.element.getBoundingClientRect(),a=di(this.element);this.submenu.show({container:this.rootMenu.element.parentNode,location:{x:dr(r,"trailing",a),y:r.top-4},alternateLocation:{x:dr(r,"leading",a),y:r.top-4}})}movingTowardSubmenu(e){var i,r;if(!this.element||"submenu"!==this.type)return!1;let a=this.rootMenu.lastMoveEvent;if(!a)return!1;let o=e.timeStamp-a.timeStamp;if(o>500)return!1;let n=e.clientX-a.clientX;if(.2>=(i=n,r=a.clientY-e.clientY,Math.hypot(i,r)/o))return!1;let l="right";if(this.submenu.element){let e=this.submenu.element.getBoundingClientRect(),i=this.element.getBoundingClientRect();e.left<i.left+i.width/2&&(l="left")}return"right"===l?n>0:n<0}};function dp(e,i){return void 0===e||"function"!=typeof e?e:(null!=i||(i={alt:!1,control:!1,shift:!1,meta:!1}),e(i))}var dm=class e{constructor(e,i){var r,a;this._element=null,this._activeMenuItem=null,this._dirty=!0,this.parentMenu=null!=(r=null==i?void 0:i.parentMenu)?r:null,this._submenuClass=null==i?void 0:i.submenuClass,this.columnCount=null!=(a=null==i?void 0:i.columnCount)?a:1,this.isSubmenuOpen=!1,this.menuItems=e}get children(){return Object.freeze([...this._menuItems])}set menuItems(e){let i=this.parentMenu;this.dispose(),this.parentMenu=i,e=[...e],this._menuItems=e.map(e=>e.onCreate?e.onCreate(e,this):new dh(e,this)),this.hasCheck=void 0,this.dirty=!0}dispose(){var e;this.hide(),this._element&&this._element.remove(),this._abortController&&this._abortController.abort(),null==(e=this._menuItems)||e.forEach(e=>e.dispose()),this._menuItems=[],this._activeMenuItem=null,this.parentMenu=null}handleEvent(e){"wheel"===e.type&&this._element&&(this._element.scrollBy(0,e.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 i,r,a;this._menuItems.forEach(i=>i.updateState(e));let o=this.hasCheck;this.hasCheck=this._menuItems.some(e=>e.visible&&e.hasCheck),this.hasCheck!==o&&this._menuItems.forEach(i=>i.updateState(e));let n,l=0;for(let e of this._menuItems)"heading"===e.type?(n&&0===l&&(n.visible=!1),n=e,l=0):"divider"===e.type&&n?(n.visible=l>0,n=void 0,l=0):n&&e.visible&&(l+=1);n&&(n.visible=l>0);let s=!0;for(let e of this._menuItems)"divider"===e.type?(e.visible=!s,s=!0):e.visible&&(s=!1);null!=(i=this.activeMenuItem)&&i.visible||(this.activeMenuItem=null),null!=(r=this.activeMenuItem)&&r.enabled||(null==(a=this.activeMenuItem)?void 0:a.type)!=="submenu"||this._activeMenuItem.submenu.hide(),this._dirty=!1}get enabled(){return this.updateIfDirty(),this._menuItems.some(e=>"divider"!==e.type&&e.visible&&e.enabled)}get visible(){return this.updateIfDirty(),this._menuItems.some(e=>"divider"!==e.type&&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){for(let{element:e,visible:i}of(this._element.textContent="",this._menuItems))e&&i&&this._element.append(e);null==(e=this._element.querySelector("li:first-of-type"))||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 i=this._abortController.signal;return e.addEventListener("focus",this,{signal:i}),e.addEventListener("wheel",this,{passive:!0,signal:i}),this._element=e,this.updateElement(),e}get activeMenuItem(){return this._activeMenuItem}set activeMenuItem(e){var i,r,a,o;if(this.rootMenu.cancelDelayedOperation(),e!==this._activeMenuItem){if(this.activeMenuItem){let e=this.activeMenuItem;e.active=!1,null==(i=e.submenu)||i.hide()}if(!(null==(r=null==e?void 0:e.visible)||r)){this._activeMenuItem=null;return}this._activeMenuItem=e,e&&(e.active=!0)}e?null==(a=e.element)||a.focus({preventScroll:!0}):null==(o=this._element)||o.focus({preventScroll:!0})}get firstMenuItem(){this.updateIfDirty();let e=0,i=!1,r=this._menuItems;for(;!i&&e<=r.length-1;){let a=r[e];i="divider"!==a.type&&a.visible&&a.enabled,e+=1}return i?r[e-1]:null}get lastMenuItem(){this.updateIfDirty();let e=this._menuItems,i=e.length-1,r=!1;for(;!r&&i>=0;){let a=e[i];r="divider"!==a.type&&a.visible&&a.enabled,i-=1}return r?e[i+1]:null}nextMenuItem(e){if(0===e)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 i=this._menuItems.indexOf(this.firstMenuItem),r=this._menuItems.indexOf(this.lastMenuItem),a=this._menuItems.indexOf(this._activeMenuItem),o=1;for(;a>=i&&a<=r;){a+=e>0?1:-1;let i=this._menuItems[a];if(!i)break;if(i.visible&&i.enabled){if(o===Math.abs(e))return this._menuItems[a];o+=1}}return e>0?this.lastMenuItem:this.firstMenuItem}getMenuItemColumn(e){this.updateIfDirty();let i=this._menuItems.filter(e=>e.visible&&e.enabled).indexOf(e);return i<0?-1:i%this.columnCount}static get collator(){return e._collator||(e._collator=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),e._collator}findMenuItem(i){var r;this.updateIfDirty();let a=this._menuItems.filter(e=>"divider"!==e.type&&e.visible&&e.enabled);if(0===a.length)return null;let o=Math.max(...a.map(e=>e.label.length))-i.length;if(o<0)return null;let n=null,l=0;for(;l<o&&!n;)n=null!=(r=a.find(r=>0===e.collator.compare(i,r.label.substring(l,i.length))))?r:null,l++;return n}show(e){var i,r,a,o,n,l,s,c;let d,u,h,p,m,f;return!!this.visible&&!!e.container&&(this.updateElement(),e.container.appendChild(this.element),k()&&(this.element.popover="manual",this.element.showPopover()),e.location&&(i=this.element,r={location:e.location,alternateLocation:e.alternateLocation,verticalPos:"bottom",horizontalPos:"start"},d=null!=(a=di(i))?a:"ltr",i.style.position="fixed",i.style.left="",i.style.top="",i.style.right="",i.style.bottom="",i.style.height="",i.style.width="",u=i.getBoundingClientRect(),h=Math.min(Number.isFinite(r.maxHeight)?Math.min(r.maxHeight,window.innerHeight):window.innerHeight,null!=(o=r.height)?o:u.height),(p=da(r.location.y,h,r.verticalPos,d))+h>window.innerHeight-8&&(r.alternateLocation?(p=da(r.alternateLocation.y,h,r.verticalPos,d))+h>window.innerHeight-8&&(p=void 0):p=void 0),Number.isFinite(p)||(p=Math.max(8,window.innerHeight-8-h),8+h>window.innerHeight-8&&(i.style.bottom="8px")),h=Math.min(p+h,window.innerHeight-8)-p,m=Math.min(Number.isFinite(r.maxWidth)?Math.min(r.maxWidth,window.innerWidth):window.innerWidth,null!=(n=r.width)?n:u.width),(f=da(r.location.x,m,r.horizontalPos,d))+m>window.innerWidth-8&&(r.alternateLocation?(l=r.alternateLocation.x,s=m,c=r.verticalPos,(f="middle"===c?l-s/2:"start"===c&&"ltr"===d||"end"===c&&"rtl"===d||"top"===c||"right"===c?l:l-s)+m>window.innerWidth-8&&(f=void 0)):f=void 0),Number.isFinite(f)||(f=Math.max(8,window.innerWidth-8-m),8+m>window.innerWidth-8&&(i.style.right="8px")),m=Math.min(f+m,window.innerWidth-8)-f,"rtl"===d?i.style.right=`${Math.ceil(window.innerWidth-f-m).toString()}px`:i.style.left=`${Math.ceil(f).toString()}px`,i.style.top=`${Math.ceil(p).toString()}px`,h!==u.height&&(i.style.height=`${Math.ceil(h).toString()}px`),m!==u.width&&(i.style.width=`${Math.ceil(m).toString()}px`)),df(),this.element.focus({preventScroll:!0}),db(),this.parentMenu&&(this.parentMenu.openSubmenu=this),!0)}hide(){var e,i,r,a,o,n;this.openSubmenu=null,this.activeMenuItem=null,this.parentMenu&&(this.parentMenu.openSubmenu=null),null!=(e=this._element)&&e.isConnected&&this._element.parentElement&&(k()&&null!=(i=this._element)&&i.popover&&this._element.hidePopover(),df(),null==(a=null==(r=this.parentMenu)?void 0:r.element)||a.focus(),null==(n=null==(o=this._element)?void 0:o.parentNode)||n.removeChild(this._element),db())}set openSubmenu(e){var i,r,a,o;let n=null!==e;(null==(i=this.activeMenuItem)?void 0:i.type)==="submenu"&&(null==(r=this.activeMenuItem.element)||r.setAttribute("aria-expanded",n.toString())),null==(o=null==(a=this.activeMenuItem)?void 0:a.element)||o.classList.toggle("is-submenu-open",n),this.isSubmenuOpen=n}};function df(){document.addEventListener("focusin",dg,!0),document.addEventListener("focusout",dg,!0),document.addEventListener("focus",dg,!0),document.addEventListener("blur",dg,!0)}function dg(e){e.stopImmediatePropagation(),e.preventDefault()}function db(){document.removeEventListener("focusin",dg,!0),document.removeEventListener("focusout",dg,!0),document.removeEventListener("focus",dg,!0),document.removeEventListener("blur",dg,!0)}var dy=class e extends dm{constructor(e,i){var r;super(e),this.state="closed",this.typingBufferResetTimer=0,this.hysteresisTimer=0,this._updating=!1,this._host=null!=(r=null==i?void 0:i.host)?r:null,this.isDynamic=e.some(dv),this._modifiers={shift:!1,control:!1,alt:!1,meta:!1},this.typingBuffer="",this.state="closed"}get modifiers(){return this._modifiers}set modifiers(e){var i;i=this._modifiers,(!i&&e||i&&!e||i&&e&&(i.alt!==e.alt||i.control!==e.control||i.shift!==e.shift||i.meta!==e.meta))&&(this._modifiers=e,this.dirty=!0)}get activeSubmenu(){let e=this;for(;e.isSubmenuOpen;)e=e.activeMenuItem.submenu;return e}set dirty(e){this._updating||this._dirty!==e&&(this._dirty=!0,e&&setTimeout(()=>{this.updateState(this.modifiers),this.updateElement()}))}updateState(e){this._updating=!0,this.modifiers=null!=e?e:this.modifiers,super.updateState(this.modifiers),this._updating=!1}handleKeyupEvent(e){this.isDynamic&&(this.modifiers=l8(e)),e.stopImmediatePropagation()}handleKeydownEvent(e){var i,r,a;if("Tab"===e.key||"Escape"===e.key)return void this.hide();this.isDynamic&&(this.modifiers=l8(e));let o=!0,n=this.activeSubmenu,l=n.activeMenuItem;switch(e.key){case" ":case"Space":case"Return":case"Enter":null==l||l.select(l8(e));break;case"ArrowRight":if((null==l?void 0:l.type)==="submenu")l.select(l8(e)),this.activeSubmenu.activeMenuItem=this.activeSubmenu.firstMenuItem;else if(l){let e=null!=(i=n.getMenuItemColumn(l))?i:-1;if(e>=0&&e<(null!=(r=n.columnCount)?r:1)-1){let e=n.nextMenuItem(1);e&&(n.activeMenuItem=e)}}else n.activeMenuItem=n.firstMenuItem;break;case"ArrowLeft":if(n===this.rootMenu)l||(n.activeMenuItem=n.firstMenuItem);else if((l&&null!=(a=n.getMenuItemColumn(l))?a:-1)<=0||!l){n.hide();let e=n.parentMenu.activeMenuItem;if(e){let{element:i}=e;null==i||i.focus(),null==i||i.classList.remove("is-submenu-open")}}else{let e=n.nextMenuItem(-1);e&&(n.activeMenuItem=e)}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 e=n.findMenuItem(this.typingBuffer);e&&(n.activeMenuItem=e),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}break;default:if(l7(e)){isFinite(this.typingBufferResetTimer)&&clearTimeout(this.typingBufferResetTimer),this.typingBuffer+=e.key;let i=n.findMenuItem(this.typingBuffer);i&&(n.activeMenuItem=i),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}else o=!1}o&&(e.preventDefault(),e.stopPropagation())}handleEvent(e){if("keydown"===e.type)this.handleKeydownEvent(e);else if("keyup"===e.type)this.handleKeyupEvent(e);else if("pointermove"===e.type)this.lastMoveEvent=e;else if("pointerup"===e.type)Number.isFinite(this.rootMenu._openTimestamp)&&Date.now()-this.rootMenu._openTimestamp<120?this.state="modal":"modal"===this.state&&e.target===this.scrim&&this.hide();else if("contextmenu"===e.type){e.preventDefault(),e.stopPropagation();return}super.handleEvent(e)}dispatchEvent(e){return!this._host||this._host.dispatchEvent(e)}get host(){return this._host}get scrim(){return se.element}connectScrim(e){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),se.open({root:e,onDismiss:()=>this.hide()})}disconnectScrim(){let e=this.scrim;e.removeEventListener("pointerup",this,!0),e.removeEventListener("contextmenu",this),e.removeEventListener("keydown",this),e.removeEventListener("keyup",this),e.removeEventListener("pointermove",this),"open"===se.state&&se.scrim.close()}get rootMenu(){return this}show(e){return this._onDismiss=null==e?void 0:e.onDismiss,null!=e&&e.modifiers&&(this.modifiers=e.modifiers),this.updateState(),this.connectScrim(null==e?void 0:e.target),super.show(g(f({},e),{container:this.scrim}))?(this._openTimestamp=Date.now(),this.state="open",!0):(this.disconnectScrim(),!1)}hide(){this.cancelDelayedOperation(),void 0!==this.state&&("closed"!==this.state&&(this.activeMenuItem=null,se.element.parentElement.focus(),super.hide(),this.state="closed",this.disconnectScrim()),this._onDismiss&&(this._onDismiss(),this._onDismiss=void 0))}scheduleOperation(i){this.cancelDelayedOperation();let r=e.SUBMENU_DELAY;r<=0?i():this.hysteresisTimer=setTimeout(()=>{this.hysteresisTimer=0,i()},r)}cancelDelayedOperation(){this.hysteresisTimer&&(clearTimeout(this.hysteresisTimer),this.hysteresisTimer=0)}};function dv(e){return!ds(e)&&(!!("function"==typeof e.label||"function"==typeof e.ariaLabel||"function"==typeof e.tooltip||(dl(e)||dn(e))&&("function"==typeof e.enabled||"function"==typeof e.visible)||dl(e)&&"function"==typeof e.checked)||!!dn(e)&&e.submenu.some(dv))}dy.SUBMENU_DELAY=120;var dx=class{};async function d_(e,i,r){if(e.defaultPrevented)return!1;if("contextmenu"===e.type&&(e.preventDefault(),e.stopPropagation(),r.show({target:i,location:l6(e),modifiers:l8(e)})))return!0;if("keydown"===e.type&&("ContextMenu"===e.code||"F10"===e.code&&e.shiftKey)){let a=null==i?void 0:i.getBoundingClientRect();if(dw(i)&&a&&r.show({target:i,location:{x:Math.ceil(a.left+a.width/2),y:Math.ceil(a.top+a.height/2)},modifiers:l8(e)}))return e.preventDefault(),e.stopPropagation(),!0}if("pointerdown"===e.type&&"mouse"!==e.pointerType&&0===e.button){let a=e.target;for(;a&&i!==a;)a=a.parentNode;if(!a||!r.visible)return!1;let o=l6(e);if(await new Promise((i,r)=>{let a=l6(e);a||i(!1);let o=a,n=setTimeout(()=>{var e;l.abort(),i((e=o,Math.hypot(a.x-e.x,a.y-e.y)<dx.MAX_DISTANCE))},dx.DELAY),l=new AbortController,s=l.signal;for(let e of["pointermove","pointerup","pointercancel"])window.addEventListener(e,e=>{if("pointerup"===e.type||"pointercancel"===e.type)clearTimeout(n),l.abort(),i(!1);else if("pointermove"===e.type){let i=l6(e);i&&(o=i)}},{passive:!0,signal:s})}))return"closed"===r.state&&!!dw(i)&&(r.show({target:i,location:o}),!0)}return!1}function dw(e){return e.dispatchEvent(new Event("contextmenu",{cancelable:!0}))}dx.DELAY=300,dx.MAX_DISTANCE=10;var dk="<mo>&#x2061;</mo>",dM="<mo>&#8290;</mo>";function dS(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function dL(e,i){return e&&i.generateID?` extid="${e}"`:""}function dC(e){return e.index<e.atoms.length&&e.atoms[e.index].superscript&&"subsup"===e.atoms[e.index].type}function dE(e){let i=-1,r=e.index,a=!1,o=!1;for(;r<e.atoms.length&&!a&&!o;){let i=e.atoms[r];o=!(a=!i.isDigit())&&void 0!==i.superscript,r++}return o&&(i=r-1),i}function dA(e,i,r){var a;let o=i.atoms[i.index-1];if(!o)return!1;if(!o.superscript&&!o.subscript)if((null==(a=i.atoms[i.index])?void 0:a.type)!=="subsup")return!1;else o=i.atoms[i.index],i.index+=1;let n=i.lastType;i.lastType="";let l=dz(o.superscript,r);i.lastType="";let s=dz(o.subscript,r);if(i.lastType=n,!l&&!s)return!1;let c="";return l&&s?c=`<msubsup>${e}${s}${l}</msubsup>`:l?c=`<msup>${e}${l}</msup>`:s&&(c=`<msub>${e}${s}</msub>`),i.mathML+=c,i.lastType="",!0}function dz(e,i,r,a){null!=i||(i={});let o={atoms:[],index:null!=r?r:0,mathML:"",lastType:""};if("number"==typeof e||"boolean"==typeof e)o.mathML=e.toString();else if("string"==typeof e)o.mathML=e;else if(e instanceof oG)o.mathML=dK(e,i);else if(Array.isArray(e)){o.atoms=e;let r=0;for(a=a||(e?e.length:0);o.index<a;)if(function(e,i,r){i=null!=i?i:e.atoms.length;let a=e.index,o="",n=dE(e);for(n>=0&&n<i&&(i=n);e.index<i&&"text"===e.atoms[e.index].mode;)o+=e.atoms[e.index].value?e.atoms[e.index].value:" ",e.index+=1;return o.length>0&&(o=`<mtext ${dL(e.atoms[a].id,r)}>${dS(o)}</mtext>`,n<0&&dC(e)&&(n=e.index,e.index+=1),dA(o,e,r)||(e.mathML+=o,e.lastType="mtext"),!0)}(o,a,i)||function(e,i,r){i=null!=i?i:e.atoms.length;let a=e.index,o="",n=dE(e);for(n>=0&&n<i&&(i=n);e.index<i&&e.atoms[e.index].isDigit();)o+=e.atoms[e.index].asDigit(),e.index+=1;return!(o.length<=0)&&(o="<mn"+dL(e.atoms[a].id,r)+">"+o+"</mn>",n<0&&dC(e)&&(n=e.index,e.index+=1),dA(o,e,r)||(e.mathML+=o,e.lastType="mn"),!0)}(o,a,i)||function(e,i,r){var a,o,n,l,s,c,d,u;let h=!1;i=null!=i?i:e.atoms.length;let p="",m="",f=e.atoms[e.index],g=null==(a=f.style)?void 0:a.variant,b=null==(o=f.style)?void 0:o.variantStyle,y="";if(f.value&&(g||b)){let i=null!=(n=ee(f.value,g,b))?n:f.value;if(i!==f.value)return e.index+=1,dA(p=`<mi${dL(f.id,r)}>${i}</mi>`,e,r)||(e.mathML+=p,e.lastType="mi"),!0;(y=null!=(l=({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"})[(null!=b?b:"")+(null!=g?g:"")])?l:"")&&(y=` mathvariant="${y}"`)}let v={"\\exponentialE":"&#x02147;","\\imaginaryI":"&#x2148;","\\differentialD":"&#x2146;","\\capitalDifferentialD":"&#x2145;","\\alpha":"&#x03b1;","\\pi":"&#x03c0;","\\infty":"&#x221e;","\\forall":"&#x2200;","\\nexists":"&#x2204;","\\exists":"&#x2203;","\\hbar":"ℏ","\\cdotp":"⋅","\\ldots":"…","\\dots":"…","\\cdots":"⋯","\\ddots":"⋱","\\vdots":"⋮","\\ldotp":"."};if("!"===f.command)return e.index+=1,dA(p="<mo>!</mo>",e,r)||(e.mathML+=p,e.lastType="mo"),!0;if(v[f.command]){e.index+=1;let i=`<mi${dL(f.id,r)}${y}>${v[f.command]}</mi>`;return("mi"===e.lastType||"mn"===e.lastType||"mtext"===e.lastType||"fence"===e.lastType)&&(i=dM+i),dA(i,e,r)||(e.mathML+=i,e.lastType="mi"),!0}if("\\operatorname"===f.command)m=dD(f.body),e.index+=1;else if(g||b)for(;e.index<i&&("mord"===f.type||"macro"===f.type)&&!f.isDigit()&&g===(null!=(c=null==(s=f.style)?void 0:s.variant)?c:"")&&b===(null!=(u=null==(d=f.style)?void 0:d.variantStyle)?u:"");)m+=dD([f]),e.index+=1,f=e.atoms[e.index];else"mord"!==f.type&&"macro"!==f.type||f.isDigit()||(m+=dD([f]),e.index+=1);if(m.length>0){h=!0,p=`<mi${y}>${m}</mi>`;let i=e.lastType;p.endsWith(">f</mi>")||p.endsWith(">g</mi>")?(p+=dk,e.lastType="applyfunction"):e.lastType=/^<mo>(.*)<\/mo>$/.test(p)?"mo":"mi",dA(p,e,r)||(("mi"===i||"mn"===i||"mtext"===i||"fence"===i)&&(p=dM+p),e.mathML+=p)}return h}(o,a,i)||function(e,i,r){let a=!1;i=null!=i?i:e.atoms.length;let o="",n="",l=e.atoms[e.index];if(!l)return!1;let s={"\\ne":"&ne;","\\neq":"&ne;","\\pm":"&#177;","\\times":"&#215;","\\colon":":","\\vert":"|","\\Vert":"∥","\\mid":"∣","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lbrack":"[","\\rbrack":"]","\\lparen":"(","\\rparen":")","\\langle":"⟨","\\rangle":"⟩","\\lfloor":"⌊","\\rfloor":"⌋","\\lceil":"⌈","\\rceil":"⌉"};if(s[l.command]){e.index+=1;let i=`<mo${dL(l.id,r)}>${s[l.command]}</mo>`;return dA(i,e,r)||(e.mathML+=i,e.lastType="mo"),!0}if(e.index<i&&("mbin"===l.type||"mrel"===l.type))o+=dK(e.atoms[e.index],r),e.index+=1,n="mo";else if(e.index<i&&("mop"===l.type||"operator"===l.type||"extensible-symbol"===l.type)){if("over-under"===l.subsupPlacement&&(l.superscript||l.subscript)){let i=dT(l,r);return l.superscript&&l.subscript?(o+="<munderover>"+i,o+=dz(l.subscript,r),o+=dz(l.superscript,r),o+="</munderover>"):l.superscript?(o+="<mover>"+i,o+=dz(l.superscript,r),o+="</mover>"):l.subscript&&(o+="<munder>"+i,o+=dz(l.subscript,r),o+="</munder>"),e.mathML+=o,e.lastType="mo",e.index+=1,!0}{let i=e.atoms[e.index],a="\\operatorname"===i.value,l=a?'<mi class="MathML-Unit"'+dL(i.id,r)+">"+dD(i.value)+"</mi>":dT(i,r);o+=l,a||/^<mo>(.*)<\/mo>$/.test(l)?n=a?"mi":"mo":(o+=dk,n="applyfunction")}"mi"!==e.lastType&&"mn"!==e.lastType||/^<mo>(.*)<\/mo>$/.test(o)||(o=dM+o),e.index+=1}return o.length>0&&(a=!0,dA(o,e,r)||(e.mathML+=o,e.lastType=n)),a}(o,a,i)||function(e,i,r){let a=!1;i=null!=i?i:e.atoms.length;let o="",n="";if(e.index<i&&"mopen"===e.atoms[e.index].type){let l=!1,s=0,c=e.index,d=-1,u=c+1;for(;u<i&&!l;)"mopen"===e.atoms[u].type?s+=1:"mclose"===e.atoms[u].type&&(s-=1),-1===s&&(l=!0,d=u),u+=1;l&&(o="<mrow>"+dT(e.atoms[c],r)+dz(e.atoms,r,c+1,d)+dT(e.atoms[d],r)+"</mrow>",e.index=d+1,("mi"===e.lastType||"mn"===e.lastType||"mfrac"===e.lastType||"fence"===e.lastType)&&(e.mathML+=dM),dA(o,e,r)&&(a=!0,e.lastType="",o=""),n="fence")}return o.length>0&&(a=!0,e.mathML+=o,e.lastType=n),a}(o,a,i))r+=1;else if(o.index<a){let e=dK(o.atoms[o.index],i);"mn"===o.lastType&&e.length>0&&"genfrac"===o.atoms[o.index].type&&(e="<mo>&#x2064;</mo>"+e),"genfrac"===o.atoms[o.index].type?o.lastType="mfrac":o.lastType="",o.index+=1,dA(e,o,i)?r+=1:e.length>0&&(o.mathML+=e,r+=1)}r>1&&(o.mathML="<mrow>"+o.mathML+"</mrow>")}return o.mathML}function dT(e,i){let r="",a=dD(e.value);return a&&(r="<mo"+dL(e.id,i)+">"+a+"</mo>"),r}function dD(e){if(!e)return"";if("string"==typeof e)return dS(e);if(!Array.isArray(e)&&"string"==typeof e.body)return dS(e.body);let i="";for(let r of e)"string"==typeof r.value&&(i+=r.value);return dS(i)}function dK(e,i){var r,a,o,n,l,s,c,d,u,h,p,m,f,g,b,y,v,x,_,w,k,M,S;if("text"===e.mode)return`<mi${dL(e.id,i)}>${dS(e.value)}</mi>`;let L={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",longleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",longrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",longrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xleftrightarrows:"⇄",xRightleftharpoons:"⇌",longRightleftharpoons:"⇌",xLeftrightharpoons:"⇋",longLeftrightharpoons:"⇋"},C="",E="",A,z,T,D,K,B,{command:$}=e;if("\\error"===e.command)return`<merror${dL(e.id,i)}>${dz(e.body,i)}</merror>`;let P={"\\vert":"|","\\Vert":"∥","\\mid":"∣","\\lbrack":"[","\\rbrack":"]","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"⟨","\\rangle":"⟩","\\lfloor":"⌊","\\rfloor":"⌋","\\lceil":"⌈","\\rceil":"⌉"};switch(e.type){case"first":case"line":case"overlap":case"subsup":case"phantom":case"composition":case"rule":case"chem":break;case"error":if("\\\\"===e.command)break;C=`<merror${dL(e.id,i)}>${dz(e.body,i)}</merror>`;break;case"group":case"root":C=dz(e.body,i);break;case"array":if((e.leftDelim&&"."!==e.leftDelim||e.rightDelim&&"."!==e.rightDelim)&&(C+="<mrow>",e.leftDelim&&"."!==e.leftDelim&&(C+=`<mo>${dS(P[e.leftDelim]||e.leftDelim)}</mo>`)),C+="<mtable",e.colFormat){for(C+=' columnalign="',T=0;T<e.colFormat.length;T++){let i=e.colFormat[T];"align"in i&&(C+=({l:"left",c:"center",r:"right"})[i.align]+" ")}C+='"'}if(e.rows.length>1&&e.hasRowRules){let i=[];for(z=1;z<e.rows.length;z++){let r=e.rowRules[z];0===r.length?i.push("none"):r.some(e=>"solid"===e.style)?i.push("solid"):i.push("dashed")}C+=` rowlines="${i.join(" ")}"`}for(C+=">",z=0;z<e.rows.length;z++){for(C+="<mtr>",A=0;A<e.rows[z].length;A++)C+="<mtd>"+dz(e.rows[z][A],i)+"</mtd>";C+="</mtr>"}C+="</mtable>",(e.leftDelim&&"."!==e.leftDelim||e.rightDelim&&"."!==e.rightDelim)&&(e.rightDelim&&"."!==e.rightDelim&&(C+=`<mo>${dS(P[e.rightDelim]||e.rightDelim)}</mo>`),C+="</mrow>");break;case"genfrac":(e.leftDelim||e.rightDelim)&&(C+="<mrow>"),e.leftDelim&&"."!==e.leftDelim&&(C+="<mo"+dL(e.id,i)+">"+dS(P[e.leftDelim]||e.leftDelim)+"</mo>"),e.hasBarLine?(C+="<mfrac>",C+=dz(e.above,i)||"<mi>&nbsp;</mi>",C+=dz(e.below,i)||"<mi>&nbsp;</mi>",C+="</mfrac>"):(C+="<mtable"+dL(e.id,i)+">",C+="<mtr>"+dz(e.above,i)+"</mtr>",C+="<mtr>"+dz(e.below,i)+"</mtr>",C+="</mtable>"),e.rightDelim&&"."!==e.rightDelim&&(C+="<mo"+dL(e.id,i)+">"+dS(P[e.rightDelim]||e.rightDelim)+"</mo>"),(e.leftDelim||e.rightDelim)&&(C+="</mrow>");break;case"surd":e.hasEmptyBranch("above")?(C+="<msqrt"+dL(e.id,i)+">",C+=dz(e.body,i),C+="</msqrt>"):(C+="<mroot"+dL(e.id,i)+">",C+=dz(e.body,i),C+=dz(e.above,i),C+="</mroot>");break;case"leftright":let O=e.leftDelim;C="<mrow>",O&&"."!==O&&(C+=`<mo${dL(e.id,i)}>${dS(null!=(r=P[O])?r:O)}</mo>`),e.body&&(C+=dz(e.body,i));let R=e.matchingRightDelim();R&&"."!==R&&(C+=`<mo${dL(e.id,i)}>${dS(null!=(a=P[R])?a:R)}</mo>`),C+="</mrow>";break;case"sizeddelim":case"delim":C+=`<mo${dL(e.id,i)}>${dS(P[e.value]||e.value)}</mo>`;break;case"accent":C+='<mover accent="true"'+dL(e.id,i)+">",C+=dz(e.body,i),C+="<mo>"+(({"\\vec":"&#x20d7;","\\acute":"&#x00b4;","\\grave":"&#x0060;","\\dot":"&#x02d9;","\\ddot":"&#x00a8;","\\tilde":"&#x007e;","\\bar":"&#x00af;","\\breve":"&#x02d8;","\\check":"&#x02c7;","\\hat":"&#x005e;"})[$]||e.accent)+"</mo>",C+="</mover>";break;case"newline":C+='<mspace linebreak="newline"></mspace>';break;case"overunder":K=e.above,D=e.below,(e.svgAbove||K)&&(e.svgBelow||D)?B=e.body:K&&K.length>0?(B=e.body,null!=(n=null==(o=e.body)?void 0:o[0])&&n.below?(D=e.body[0].below,B=e.body[0].body):(null==(s=null==(l=e.body)?void 0:l[0])?void 0:s.type)==="first"&&null!=(d=null==(c=e.body)?void 0:c[1])&&d.below&&(D=e.body[1].below,B=e.body[1].body)):D&&D.length>0&&(B=e.body,null!=(h=null==(u=e.body)?void 0:u[0])&&h.above?(K=e.body[0].above,B=e.body[0].body):(null==(m=null==(p=e.body)?void 0:p[0])?void 0:m.type)==="first"&&null!=(g=null==(f=e.body)?void 0:f[1])&&g.above&&(K=e.body[1].above,B=e.body[1].body)),(e.svgAbove||K)&&(e.svgBelow||D)?(C+=`<munderover ${dL(e.id,i)}>`,C+=null!=(b=L[e.svgBody])?b:dz(B,i),C+=null!=(y=L[e.svgBelow])?y:dz(D,i),C+=null!=(v=L[e.svgAbove])?v:dz(K,i),C+="</munderover>"):e.svgAbove||K?(C+=`<mover ${dL(e.id,i)}>`+(null!=(x=L[e.svgBody])?x:dz(B,i)),C+=null!=(_=L[e.svgAbove])?_:dz(K,i),C+="</mover>"):(e.svgBelow||D)&&(C+=`<munder ${dL(e.id,i)}>`+(null!=(w=L[e.svgBody])?w:dz(B,i)),C+=null!=(k=L[e.svgBelow])?k:dz(D,i),C+="</munder>");break;case"placeholder":C+="?";break;case"mord":{if((C="string"==typeof e.value?e.value:$).length>0&&C.startsWith("\\"))"string"==typeof e.value&&e.value.charCodeAt(0)>255?C=String.fromCodePoint(e.value.codePointAt(0)):"string"==typeof e.value&&(C=e.value.charAt(0));else if("\\char"===e.command){let i=null==(M=e.args)?void 0:M[0];if(void 0!==i&&"number"in i){let e=i.number;"number"==typeof e&&e>=0&&e<=1114111&&(C=String.fromCodePoint(e))}}else"string"==typeof e.value?C=e.value:(console.error("Did not expect this"),C="");let r=/\d/.test(C)?"mn":"mi";C=`<${r}${dL(e.id,i)}>${dS(C)}</${r}>`;break}case"mbin":case"mrel":case"minner":C=dT(e,i);break;case"mpunct":C='<mo separator="true"'+dL(e.id,i)+">"+$+"</mo>";break;case"mop":case"operator":case"extensible-symbol":"​"!==e.value&&(C="<mo"+dL(e.id,i)+">"+("\\operatorname"===$?e.body:$||e.body)+"</mo>");break;case"box":C='<menclose notation="box"',e.backgroundcolor&&(C+=' mathbackground="'+e.backgroundcolor+'"'),C+=dL(e.id,i)+">"+dz(e.body,i)+"</menclose>";break;case"spacing":C+='<mspace width="'+(null!=(S=({"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\>":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5})[$])?S:0)+'em"/>';break;case"enclose":for(let i in C='<menclose notation="',e.notation)Object.prototype.hasOwnProperty.call(e.notation,i)&&e.notation[i]&&(C+=E+i,E=" ");C+=dL(e.id,i)+'">'+dz(e.body,i)+"</menclose>";break;case"prompt":C='<menclose notation="roundexbox""">'+dz(e.body,i)+"</menclose>";break;case"space":C+="&nbsp;";break;case"mopen":case"mclose":C+=dT(e,i);break;case"macro":{let r=e.command+dD(e.macroArgs);r&&(C+=`<mo ${dL(e.id,i)}>${r}</mo>`)}break;case"latexgroup":case"tooltip":C+=dz(e.body,i);break;case"latex":C+="<mtext"+dL(e.id,i)+">"+dS(e.value)+"</mtext>";break;case"text":C+=`<mtext ${dL(e.id,i)}x>${dS(e.value)}</mtext>`;break;default:if("\\displaystyle"===e.command)return`<mrow ${dL(e.id,i)} displaystyle="true">${dz(e.body,i)}</mrow>`;if("\\textstyle"===e.command)return`<mrow ${dL(e.id,i)} displaystyle="false">${dz(e.body,i)}</mrow>`;console.info("Unexpected element in conversion to MathML:",e)}return C}var dB={"\\alpha":"alpha ","\\mu":"mew ","\\sigma":"sigma ","\\pi":"pie ","\\imaginaryI":"imaginary eye ","\\imaginaryJ":"imaginary jay ","\\sum":"Summation ","\\prod":"Product ","+":"plus ","-":"minus ",";":'<break time="150ms"/> semi-colon <break time="150ms"/>',",":'<break time="150ms"/> comma <break time="150ms"/>',"|":'<break time="150ms"/>Vertical bar<break time="150ms"/>',"(":'<break time="150ms"/>Open paren. <break time="150ms"/>',")":'<break time="150ms"/> Close paren. <break time="150ms"/>',"=":"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 ","​":"","−":"minus ",":":'<break time="150ms"/> such that <break time="200ms"/> ',"\\colon":'<break time="150ms"/> such that <break time="200ms"/> ',"\\hbar":"etch bar ","\\iff":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\Longleftrightarrow":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\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 <break time="150ms"/><say-as interpret-as="character">n</say-as>',"\\C":'the set <break time="150ms"/><say-as interpret-as="character">c</say-as>',"\\Z":'the set <break time="150ms"/><say-as interpret-as="character">z</say-as>',"\\Q":'the set <break time="150ms"/><say-as interpret-as="character">q</say-as>',"\\infty":"infinity ","\\nabla":"nabla ","\\partial":"partial derivative of ","\\cdot":"times ","\\cdots":"dot dot dot ","\\ldots":"dot dot dot ","\\dots":"dot dot dot ","\\Rightarrow":"implies ","\\lparen":'<break time="150ms"/>open paren<break time="150ms"/>',"\\rparen":'<break time="150ms"/>close paren<break time="150ms"/>',"\\lbrace":'<break time="150ms"/>open brace<break time="150ms"/>',"\\{":'<break time="150ms"/>open brace<break time="150ms"/>',"\\rbrace":'<break time="150ms"/>close brace<break time="150ms"/>',"\\}":'<break time="150ms"/>close brace<break time="150ms"/>',"\\langle":'<break time="150ms"/>left angle bracket<break time="150ms"/>',"\\rangle":'<break time="150ms"/>right angle bracket<break time="150ms"/>',"\\lfloor":'<break time="150ms"/>open floor<break time="150ms"/>',"\\rfloor":'<break time="150ms"/>close floor<break time="150ms"/>',"\\lceil":'<break time="150ms"/>open ceiling<break time="150ms"/>',"\\rceil":'<break time="150ms"/>close ceiling<break time="150ms"/>',"\\vert":'<break time="150ms"/>vertical bar<break time="150ms"/>',"\\mvert":'<break time="150ms"/>divides<break time="150ms"/>',"\\lvert":'<break time="150ms"/>left vertical bar<break time="150ms"/>',"\\rvert":'<break time="150ms"/>right vertical bar<break time="150ms"/>',"\\lbrack":'<break time="150ms"/> open square bracket <break time="150ms"/>',"\\rbrack":'<break time="150ms"/> close square bracket <break time="150ms"/>',mm:"millimeters",cm:"centimeters",km:"kilometers",kg:"kilograms"},d$={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 dP(e){let i=0;if(R(e))for(let r of e)"first"!==r.type&&(i+=1);return 1===i}function dO(e){let i="";if(R(e))for(let r of e)"first"!==r.type&&"string"==typeof r.value&&(i+=r.value);return i}function dR(e){if(e&&!e.some(e=>"first"!==e.type&&void 0===e.value))return e.map(e=>e.value).join("")}function dI(e){return`<emphasis>${e}</emphasis>`}function dN(e){var i,r;let a=globalThis.MathfieldElement;if("sre"===a.textToSpeechRules&&("sre"in window||"SRE"in window)){let o=dz(e);if(o){a.textToSpeechMarkup&&(a.textToSpeechRulesOptions=null!=(i=a.textToSpeechRulesOptions)?i:{},a.textToSpeechRulesOptions=g(f({},a.textToSpeechRulesOptions),{markup:a.textToSpeechMarkup}),"ssml"===a.textToSpeechRulesOptions.markup&&(a.textToSpeechRulesOptions=g(f({},a.textToSpeechRulesOptions),{markup:"ssml_step"})),a.textToSpeechRulesOptions=g(f({},a.textToSpeechRulesOptions),{rate:a.speechEngineRate}));let e=null!=(r=window.SRE)?r:globalThis.sre.System.getInstance();a.textToSpeechRulesOptions&&e.setupEngine(a.textToSpeechRulesOptions);let n="";try{n=e.toSpeech(o)}catch(e){console.error("MathLive 0.110.8: `SRE.toSpeech()` runtime error",e)}return n}return""}let o=function e(i,r){var a,o,n,l,s,c,d,u,h,p,m;if(!r)return"";if(R(r))return function(i,r){var a;let o="",n=!1,l=!1;for(let s=0;s<r.length;s++)"first"!==r[s].type&&("text"!==r[s].mode&&(l=!1),s<r.length-2&&"mopen"===r[s].type&&"mclose"===r[s+2].type&&"mord"===r[s+1].type?(o+=" of ",o+=dI(e(i,r[s+1])),s+=2):"text"===r[s].mode?l?o+=null!=(a=r[s].value)?a:" ":(l=!0,o+=e("text",r[s])):r[s].isDigit()?n?o+=r[s].asDigit():(n=!0,o+=e(i,r[s])):(n=!1,o+=e(i,r[s])));return o}(i,r);let f="";if(r.id&&"math"===i&&(f+='<mark name="'+r.id.toString()+'"/>'),"text"===r.mode)return f+r.value;let g="",b="",y="",v=!1,{command:x}=r;switch(x){case"\\vec":return"vector "+e(i,r.body);case"\\acute":return e(i,r.body)+" acute";case"\\grave":return e(i,r.body)+" grave";case"\\dot":return"dot over"+e(i,r.body);case"\\ddot":return"double dot over"+e(i,r.body);case"\\mathring":return"ring over"+e(i,r.body);case"\\tilde":case"\\widetilde":return"tilde over"+e(i,r.body);case"\\bar":return e(i,r.body)+" bar";case"\\breve":return e(i,r.body)+" breve";case"\\check":case"\\widecheck":return"check over "+e(i,r.body);case"\\hat":case"\\widehat":return"hat over"+e(i,r.body);case"\\overarc":case"\\overparen":case"\\wideparen":return"arc over "+e(i,r.body);case"\\underarc":case"\\underparen":return"arc under "+e(i,r.body);case"\\mathop":return null!=(a=dR(r.body))?a:e(i,r.body);case"\\mathit":return null!=(o=dR(r.body))?o:e(i,r.body);case"\\mathrm":return null!=(n=dR(r.body))?n:e(i,r.body);case"\\mathbb":return"blackboard"+(null!=(l=dR(r.body))?l:e(i,r.body))}switch(r.type){case"prompt":f+=' <break time="300ms"/> '+(r.body.length>1?'start input . <break time="500ms"/> '+e(i,r.body)+'. <break time="500ms"/> end input':"blank")+'. <break time="700ms"/>'+(null!=(s=r.correctness)?s:"")+' . <break time="700ms"/> ';break;case"array":let _=r.rows,w=r.environmentName;if(Object.keys(d$).includes(w)){f+=` begin ${d$[w]} `;for(let i=0;i<_.length;i++){i>0&&(f+=","),f+=` row ${i+1} `;for(let r=0;r<_[i].length;r++)r>0&&(f+=","),f+=` column ${r+1}: `,f+=e("math",_[i][r])}f+=` end ${d$[w]} `}break;case"group":"\\ne"===x?f+=" not equal ":("\\not"===x&&(f+=" not "),f+=e("math",r.body));break;case"root":f+=e("math",r.body);break;case"genfrac":if(g=e("math",r.above),b=e("math",r.below),dP(r.above)&&dP(r.below)){let e={"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 "}[dO(r.above)+"/"+dO(r.below)];e?f=e:f+=g+" over "+b}else f+=' the fraction <break time="150ms"/>'+g+' over <break time="150ms"/>'+b+'.<break time="150ms"/> End fraction.<break time="150ms"/>';break;case"surd":if(y=e("math",r.body),r.hasEmptyBranch("above"))f+=dP(r.body)?" the square root of "+y+" , ":' the square root of <break time="200ms"/>'+y+'. <break time="200ms"/> End square root';else{let i=e("math",r.above),a=(i=i.trim()).replace(/<mark([^/]*)\/>/g,"");"3"===a?f+=' the cube root of <break time="200ms"/>'+y+'. <break time="200ms"/> End cube root':"n"===a?f+=' the nth root of <break time="200ms"/>'+y+'. <break time="200ms"/> End root':f+=' the root with index: <break time="200ms"/>'+i+', of <break time="200ms"/>'+y+'. <break time="200ms"/> End root'}break;case"leftright":f+=null!=(c=r.leftDelim?dB[r.leftDelim]:void 0)?c:r.leftDelim,f+=e("math",r.body),f+=null!=(d=r.rightDelim?dB[r.rightDelim]:void 0)?d:r.rightDelim;break;case"rule":case"overunder":case"overlap":case"space":case"spacing":break;case"macro":let k=x.replace(/^\\/g,""),M=e_()[k];null!=M&&M.expand?f+=e("math",r.body):f+=`${k} `;break;case"placeholder":f+="placeholder ";break;case"delim":case"sizeddelim":case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":{if("\\mathbin"===x||"\\mathrel"===x||"\\mathopen"===x||"\\mathclose"===x||"\\mathpunct"===x||"\\mathord"===x||"\\mathinner"===x){f=e(i,r.body);break}let a=r.isDigit()?r.asDigit():r.value,o=r.command;if(("delim"===r.type||"sizeddelim"===r.type)&&(a=o=r.value),"text"===i)f+=a;else{if("mbin"===r.type&&(f+='<break time="150ms"/>'),a){let e=dB[a]||(o?dB[o.trim()]:"");if(e)f+=" "+e;else{let e;f+=(o?(h=o.trim(),e="",h.startsWith("\\")&&(e=" "+h.replace("\\","")+" "),e):"")||(p=a,globalThis.MathfieldElement.textToSpeechMarkup?/[a-z]/.test(p)?` <say-as interpret-as="character">${p}</say-as>`:/[A-Z]/.test(p)?`capital <say-as interpret-as="character">${p.toLowerCase()}</say-as>`:p:/[a-z]/.test(p)?" '"+p.toUpperCase()+"'":/[A-Z]/.test(p)?" 'capital "+p.toUpperCase()+"'":p)}}else f+=e("math",r.body);"mbin"===r.type&&(f+='<break time="150ms"/>')}break}case"mop":case"operator":case"extensible-symbol":if("​"!==r.value){let i=r.command;if("\\sum"===i)if(r.hasEmptyBranch("superscript")||r.hasEmptyBranch("subscript"))if(r.hasEmptyBranch("subscript"))f+=" the summation of";else{let i=e("math",r.subscript);f+=' the summation from <break time="200ms"/>'+(i=i.trim())+'<break time="200ms"/> of <break time="150ms"/>',v=!0}else{let i=e("math",r.superscript);i=i.trim();let a=e("math",r.subscript);f+=' the summation from <break time="200ms"/>'+(a=a.trim())+'<break time="200ms"/> to <break time="200ms"/>'+i+'<break time="200ms"/> of <break time="150ms"/>',v=!0}else if("\\prod"===i)if(r.hasEmptyBranch("superscript")||r.hasEmptyBranch("subscript"))if(r.hasEmptyBranch("subscript"))f+=" the product of ";else{let i=e("math",r.subscript);f+=' the product from <break time="200ms"/>'+(i=i.trim())+'<break time="200ms"/> of <break time="150ms"/>',v=!0}else{let i=e("math",r.superscript);i=i.trim();let a=e("math",r.subscript);f+=' the product from <break time="200ms"/>'+(a=a.trim())+'<break time="200ms"/> to <break time="200ms"/>'+i+'<break time="200ms"/> of <break time="150ms"/>',v=!0}else if("\\int"===i)if(r.hasEmptyBranch("superscript")||r.hasEmptyBranch("subscript"))f+=' the integral of <break time="200ms"/> ';else{let i=e("math",r.superscript);i=i.trim();let a=e("math",r.subscript);f+=' the integral from <break time="200ms"/>'+dI(a=a.trim())+'<break time="200ms"/> to <break time="200ms"/>'+dI(i)+' <break time="200ms"/> of ',v=!0}else"\\operatorname"===i||"\\operatorname*"===i?f+=((m=r.body)?m.map(e=>e.value).join(""):"")+" ":"string"==typeof r.value?f+=(null!=(u=dB[r.value])?u:r.command?dB[r.command]:void 0)||" "+r.value:r.command&&("\\mathop"===r.command?f+=e("math",r.body):f+=r.command.startsWith("\\")?" "+r.command.slice(1):" "+r.command)}break;case"enclose":f+=" crossed out "+(y=e("math",r.body))+". End crossed out.";break;case"newline":f+=" newline "}if(!v&&!r.hasEmptyBranch("superscript")){let a=e(i,r.superscript),o=(a=a.trim()).replace(/<[^>]*>/g,"");if(dP(r.superscript)){if("math"===i){let e=function(e){if(R(e)){for(let i of e)if("first"!==i.type&&i.id)return i.id.toString()}return""}(r.superscript);e&&(f+='<mark name="'+e+'"/>')}"′"===o?f+=" prime ":"2"===o?f+=" squared ":"3"===o?f+=" cubed ":Number.isNaN(Number.parseInt(o))?f+=" to the "+a+"; ":f+=' to the <say-as interpret-as="ordinal">'+o+"</say-as> power; "}else Number.isNaN(Number.parseInt(o))?f+=" raised to the "+a+"; ":f+=' raised to the <say-as interpret-as="ordinal">'+o+"</say-as> power; "}if(!v&&!r.hasEmptyBranch("subscript")){let i=e("math",r.subscript);i=i.trim(),f+=dP(r.subscript)?" sub "+i:" subscript "+i+". End subscript. "}return f}("math",e);if("ssml"===a.textToSpeechMarkup){let e="";a.speechEngineRate&&(e='<prosody rate="'+a.speechEngineRate+'">'),o='<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><amazon:auto-breaths>'+e+"<p><s>"+o+"</s></p>"+(e?"</prosody>":"")+"</amazon:auto-breaths></speak>"}else o="mac"===a.textToSpeechMarkup&&"macos"===w()?o.replace(/<mark([^/]*)\/>/g,"").replace(/<emphasis>/g,"[[emph+]]").replace(/<\/emphasis>/g,"").replace(/<break time="(\d*)ms"\/>/g,"[[slc $1]]").replace(/<say-as[^>]*>/g,"").replace(/<\/say-as>/g,""):o.replace(/<[^>]*>/g,"").replace(/\s{2,}/g," ");return o}var dq={"\\ne":"≠","\\neq":"≠","−":"-","-":"-","\\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"},dF={"\\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":"@"},dV={"\\vert":"|","\\Vert":"||","\\mid":"|","\\lbrack":"[","\\rbrack":"]","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"(:","\\rangle":":)"};function dj(e,i){var r,a,o,n,l,s,c,d,u,h,p,m,f,g,b,y,v,x,_;if(!e)return"";if(R(e)){if(0===e.length)return"";if("latex"===e[0].mode)return e.map(e=>dj(e)).join("");if("text"===e[0].mode){let a=0,o="";for(;(null==(r=e[a])?void 0:r.mode)==="text";)o+=e[a].body?dj(e[a].body,i):e[a].value,a++;return null!=i&&i.plain?o+dj(e.slice(a),i):`"${o}" ${dj(e.slice(a))}`}let n=0,l=[];for(;(null==(a=e[n])?void 0:a.mode)==="math";){let r="";for(;(null==(o=e[n])?void 0:o.type)==="mord"&&/\d/.test(e[n].value);)r+=e[n++].value;r?l.push(r):l.push(dj(e[n++],i))}return l.push(dj(e.slice(n),i)),function(e){let i="";for(let r of e){let e=i[i.length-1];void 0!==e&&(/\d$/.test(e)&&/^\d/.test(r)||/[a-zA-Z]$/.test(e)&&/^[a-zA-Z]/.test(r))&&(i+=" "),i+=r}return i}(l)}if("text"===e.mode)return null!=i&&i.plain?e.value:`"${e.value}"`;let w="",{command:k}=e,M;if("\\placeholder"===k||"\\blank"===k)return`(${dj(e.body,i)})`;let S=oG.serialize([e],{expandMacro:!1,defaultMode:"math"});switch(e.type){case"accent":let L={"\\vec":"vec","\\dot":"dot","\\ddot":"ddot","\\bar":"bar","\\hat":"hat","\\acute":"acute;","\\grave":"grave","\\tilde":"tilde","\\breve":"breave","\\check":"check"}[k];w=`${null!=L?L:""} ${dj(e.body,i)} `;break;case"first":return"";case"latexgroup":return e.body.map(e=>e.value).join("");case"group":case"root":w=null!=(n=dq[k])?n:dj(e.body,i);break;case"genfrac":(e.leftDelim||e.rightDelim)&&(w="."!==e.leftDelim&&e.leftDelim?e.leftDelim:"{:"),e.hasBarLine?(w+="(",w+=dj(e.above,i),w+=")/(",w+=dj(e.below,i),w+=")"):(w+="((",w+=dj(e.above,i),w+=") choose (",w+=dj(e.below,i),w+="))"),(e.leftDelim||e.rightDelim)&&(w+="."!==e.rightDelim&&e.rightDelim?e.rightDelim:"{:");break;case"surd":e.hasEmptyBranch("above")?w+=`sqrt(${dj(e.body,i)})`:w+=`root(${dj(e.above,i)})(${dj(e.body,i)})`;break;case"latex":case"sizeddelim":case"delim":case"mopen":case"mclose":w=e.value;break;case"leftright":{let r=e.leftDelim;r&&dV[r]&&(r=dV[r]),w+="."!==r&&r?r:"{:",w+=dj(e.body,i);let a=e.matchingRightDelim();a&&dV[a]&&(a=dV[a]),w+="."!==a&&a?a:":}"}break;case"overlap":case"overunder":case"box":break;case"mord":if(dq[S])return dq[S];(w=null!=(c=null!=(s=null!=(l=dq[k])?l:k)?s:k)?c:"string"==typeof e.value?e.value:"").startsWith("\\")&&(w+=" "),(M=k?k.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null)?w=String.fromCodePoint(Number.parseInt("0x"+M[1])):w.length>0&&w.startsWith("\\")&&(w="string"==typeof e.value?e.value.charAt(0):e.command),w=function(e,i){if(!i)return e;let r=e;return"double-struck"===i.variant&&(r=`bbb "${r}"`),"script"===i.variant&&(r=`cc "${r}"`),"fraktur"===i.variant&&(r=`fr "${r}"`),"sans-serif"===i.variant&&(r=`sf "${r}"`),"monospace"===i.variant&&(r=`tt "${r}"`),"bold"===i.variantStyle&&(r=`bb "${r}"`),i.color?`color({${i.color}})(${r})`:r}(w,e.style);break;case"mbin":case"mrel":case"minner":w=null!=(h=null!=(u=null!=(d=dq[S])?d:dq[k])?u:dF[k])?h:e.value;break;case"mpunct":w=null!=(p=dF[k])?p:k;break;case"mop":case"operator":case"extensible-symbol":"​"!==e.value&&(w=(dF[k]?dF[k]:"\\operatorname"===k?dj(e.body,i):null!=(m=e.value)?m:k)+" ");break;case"array":let C=e.environmentName;if(e.isMultiline)w=e.rows.map(e=>e.map(e=>dj(e,i)).join("")).join(`
3479
+ `);else{let r=null!=(f=({bmatrix:["[","]"],"bmatrix*":["[","]"]})[C])?f:["(",")"],a=[];for(let o of e.rows){let e=[];for(let r of o)e.push(dj(r,i));a.push(r[0]+e.join(",")+r[1])}let o=null!=(g=({bmatrix:["[","]"],"bmatrix*":["[","]"],cases:["{",":}"]})[C])?g:["(",")"];w=o[0]+a.join(",")+o[1]}break;case"spacing":w=null!=(y=null!=(b=dq[S])?b:dq[k])?y:" ";break;case"newline":w=`
3480
+ `;break;case"enclose":w="("+dj(e.body,i)+")";break;case"space":w=" ";break;case"subsup":w="";break;case"macro":w=null!=(_=null!=(x=null!=(v=dq[S])?v:dq[k])?x:dF[k])?_:dj(e.body,i)}if(!e.hasEmptyBranch("subscript")){w+="_";let r=dj(e.subscript,i);w+=1!==r.length?`(${r})`:r}if(!e.hasEmptyBranch("superscript")){w+="^";let r=dj(e.superscript,i);w+=1!==r.length?`(${r})`:r}return w}function dH(e,i){var r;let a=g(f({},oH()),{renderPlaceholder:()=>new oE(160,{maxFontSize:1})});if(null!=i&&i.letterShapeStyle&&(null==i?void 0:i.letterShapeStyle)!=="auto"&&(a.letterShapeStyle=i.letterShapeStyle),null!=i&&i.macros){let e=ek(null==i?void 0:i.macros);a.getMacro=i=>eS(i,e)}null!=i&&i.registers&&(a.registers=f(f({},a.registers),i.registers));let o=null!=(r=null==i?void 0:i.defaultMode)?r:"math",n="math",l="displaystyle";"inline-math"===o?l="textstyle":"math"===o?l="displaystyle":"text"===o&&(l="textstyle",n="text");let s=new oW({from:a}),c=new oG({type:"root",mode:n,body:ll(e,{context:s,parseMode:n,mathstyle:l})}).render(s);return c?(oA(lD(c,s)),oz(c,{classes:"ML__latex"}).toMarkup()):""}function dW(e,i){let r=f({},oH());if(null!=i&&i.macros){let e=ek(i.macros);r.getMacro=i=>eS(i,e)}return ls(e,{context:r})}function dU(e,i={}){return dz(ll(e,{parseMode:"math",args:()=>"",mathstyle:"displaystyle"}),i)}function dJ(e){return dN(ll(e,{parseMode:"math",mathstyle:"displaystyle"}))}function dX(e){var i,r;if(!uK){let e=null==(i=globalThis[Symbol.for("io.cortexjs.compute-engine")])?void 0:i.ComputeEngine;e?uK=new e:console.error(`MathLive 0.110.8: The CortexJS Compute Engine library is not available.
3455
3481
 
3456
3482
  Load the library, for example with:
3457
3483
 
3458
- import "https://esm.run/@cortex-js/compute-engine"`)}return null!=(r=null==uE?void 0:uE.box(e).latex)?r:""}function dH(e,i="math"){return dR(new oG({type:"root",body:lt(e,{parseMode:i})}))}function dW(e){return o6(e,{format:"ascii-math"})[1]}function dU(e){if("string"==typeof e){let i=function(e){let i;if(e&&"#"===e[0])return(e=e.slice(1)).length<=4?(i={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},4===e.length&&(i.a=parseInt(e[3]+e[3],16)/255)):(i={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},8===e.length&&(i.a=parseInt(e[6]+e[7],16)/255)),void 0===(null==i?void 0:i.a)&&(i.a=1),i}(e);if(!i)throw Error(`Invalid color: ${e}`);return i}return"C"in e?dQ(dX(e)):"a"in e?dQ(e):e}function dJ(e){return e<0?0:e>255?255:Math.round(e)}function dX(e){let[i,r,a]=[e.L,e.C,e.H],o=a*Math.PI/180,n={L:i,a:r*Math.cos(o),b:r*Math.sin(o)};return void 0!==e.alpha&&(n.alpha=e.alpha),n}function dG(e){let[i,r,a]=[e.L,e.a,e.b],o=Math.pow(.9999999984505198*i+.39633779217376786*r+.2158037580607588*a,3),n=Math.pow(1.00000000888176*i-.10556134232365635*r-.0638541747717059*a,3),l=Math.pow(1.000000054672411*i-.0894841820949657*r-1.2914855378640917*a,3),s=e=>{let i=Math.abs(e);return i<=.0031308?12.92*e:(Math.sign(e)||1)*(1.055*Math.pow(i,1/2.4)-.055)};return[s(4.076741661347994*o-3.307711590408193*n+.230969928729428*l),s(-1.2684380040921763*o+2.6097574006633715*n-.3413193963102197*l),s(-.004196086541837188*o-.7034186144594493*n+1.7076147009309444*l)]}function dZ(e){let[i,r,a]=e;return i>=0&&i<=1&&r>=0&&r<=1&&a>=0&&a<=1}function dY(e,i){let[r,a,o]=e;return r=dJ(255*r),a=dJ(255*a),o=dJ(255*o),void 0!==i?{r,g:a,b:o,alpha:i}:{r,g:a,b:o}}function dQ(e){let[i,r,a]=dG(e);if(dZ([i,r,a]))return dY([i,r,a],e.alpha);let o=function(e){let[i,r,a]=[e.L,e.a,e.b],o={L:i,C:Math.sqrt(r*r+a*a),H:180*Math.atan2(a,r)/Math.PI};return void 0!==e.alpha&&(o.alpha=e.alpha),o}(e);if(o.C=0,[i,r,a]=dG(dX(o)),!dZ([i,r,a]))return dY([i,r,a],e.alpha);let n=0,l=e.L,s=(n+l)/2;o.C=s;let c=.36/4096;for(;l-n>c;)o.C=s=(n+l)/2,[i,r,a]=dG(dX(o)),dZ([i,r,a])?n=s:l=s;return dY([i,r,a],e.alpha)}function d0(e,i){let r=dU(e),a=dU(i);function o(e){return e>=.022?e:e+(.022-e)**1.414}function n(e){return(e<0?-1:1)*Math.pow(Math.abs(e),2.4)}let l=o(.2126729*n(a.r/255)+.7151522*n(a.g/255)+.072175*n(a.b/255)),s=o(.2126729*n(r.r/255)+.7151522*n(r.g/255)+.072175*n(r.b/255)),c;return 100*(.1>Math.abs(c=5e-4>Math.abs(s-l)?0:s>l?1.14*(s**.56-l**.57):1.14*(s**.65-l**.62))?0:c>0?c-.027:c+.027)}function d1(e,i,r){return null!=r||(r="#fff"),null!=i||(i="#000"),Math.abs(d0(e,r))>Math.abs(d0(e,i))?r:i}function d4(e){let i=d2(e),r="";for(let e of i){if("string"!=typeof e.value)return"";r+=e.value}return r}function d2(e){let i=e.model.selection.ranges;if(1!==i.length)return[];let r=e.model.getAtoms(i[0]);return 1===r.length&&r[0].isRoot&&(r=r[0].children),r.filter(e=>"first"!==e.type)}var d3=class extends dl{constructor(e,i,r,a){super(e,i),this.row=r,this.col=a}set active(e){let i=this.parentMenu.children;if(e)for(let e of i)e.element.classList.toggle("active",e.row<=this.row&&e.col<=this.col);else for(let e of i)e.element.classList.remove("active")}};function d6(e){var i,r;return["array","matrix","pmatrix","bmatrix","vmatrix","Bmatrix","cases","dcases","rcases"].includes(null!=(r=null==(i=e.model.parentEnvironment)?void 0:i.environmentName)?r:"")}function d8(e){var i;let r=null==(i=e.model.parentEnvironment)?void 0:i.rows;return r?[r.length,r.reduce((e,i)=>Math.max(e,i.length),0)]:[0,0]}function d5(e){let i=e.model.parentEnvironment;return i?[i.minRows,i.minColumns]:[0,0]}function d7(e){let i=e.model.parentEnvironment;return i?[i.maxRows,i.maxColumns]:[0,0]}function d9(e,i){sn(e),e.flushInlineShortcutBuffer(),cd(e.model,i),sA(e)}function ue(e,i,r,a){return{id:`variant-${i}`,label:()=>{var i;return d4(e).length<12?dN(`\\${r}{${d4(e)}}`):null!=(i=N(a))?i:a},class:"ML__xl",tooltip:()=>{var e;return null!=(e=N(a))?e:a},visible:()=>(function(e,i){let r=d2(e);if(1!==r.length)return!1;let a=lW[i];return!!a&&!!a.test(r[0].value)})(e,i),checked:()=>{var r;return null!=(r=({some:"mixed",all:!0})[e.queryStyle({variant:i})])&&r},onMenuSelect:()=>e.applyStyle({variant:i},{operation:"toggle"})}}function ut(e,i,r,a){return{id:`variant-style-${i}`,label:()=>{var i;let o=d4(e);return o.length>0&&o.length<12?dN(`\\${r}{${d4(e)}}`):null!=(i=N(a))?i:a},class:()=>{let i=d4(e);return i.length>0&&i.length<12?"ML__xl":""},tooltip:()=>{var e;return null!=(e=N(a))?e:a},visible:!0,checked:()=>{var r;return null!=(r=({some:"mixed",all:!0})[e.queryStyle({variantStyle:i})])&&r},onMenuSelect:()=>e.applyStyle({variantStyle:i},{operation:"toggle"})}}function ui(e){return`<span class='ML__insert-template'> ${dN(N(`menu.insert.${e}-template`))}</span><span class="ML__insert-label">${N(`menu.insert.${e}`)}</span>`}var ur={"\\ne":"!=","\\neq":"!=","−":"-","-":"-","\\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 ","/":"\\/","&":"&"},ua={"[":" bracket.l ","]":" bracket.r ","{":" brace.l ","}":" brace.r ","(":" paren.l ",")":" paren.r ","<":" angle.l ",">":" angle.r ",".":""},uo={" bracket.l ":"["," bracket.r ":"]"," brace.l ":"{"," brace.r ":"}"," paren.l ":"("," paren.r ":")"," angle.l ":" angle.l "," angle.r ":" angle.r "},un={"\\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":" ⋈ ","\\circ":" circle.stroked.small "},ul={underarc:"underparen",underparen:"underparen",underbrace:"underbrace",underline:"underline",overarc:"overparen",overparen:"overparen",overbrace:"overbrace",overline:"overline",cancel:"cancel",displaystyle:"display",textstyle:"inline"},us={longrightarrow:e=>`arrow.r.long^(${uc(e.above)})`,longleftarrow:e=>`arrow.l.long^(${uc(e.above)})`};function uc(e){var i,r,a,o,n,l,s,c,d,u,h,p,m,f,g,b,y,v,x,_,w,k,M;if(!e)return"";if(I(e)){if(0===e.length)return"";if("latex"===e[0].mode)return e.map(e=>uc(e)).join("");if("text"===e[0].mode){let r=0,a="";for(;(null==(i=e[r])?void 0:i.mode)==="text";)a+=e[r].body?uc(e[r].body):e[r].value,r++;return` "${a}" ${uc(e.slice(r))}`}let o=0,n=[];for(;(null==(r=e[o])?void 0:r.mode)==="math";){let i="";for(;(null==(a=e[o])?void 0:a.type)==="mord"&&/\d/.test(e[o].value);)i+=e[o++].value;i?n.push(i):n.push(uc(e[o++]))}return n.push(uc(e.slice(o))),function(e){let i="";for(let r of e){let e=i[i.length-1];void 0!==e&&(/\d$/.test(e)&&/^\d/.test(r)||/[a-zA-Z]$/.test(e)&&/^[a-zA-Z]/.test(r))&&(i+=" "),i+=r}return i}(n)}if("text"===e.mode)return`"${e.value}"`;let S="",{command:L}=e,C;if("\\placeholder"===L||"\\blank"===L)return`"${uc(e.body)}"`;let E=oG.serialize([e],{expandMacro:!0,defaultMode:"math"});switch(e.type){case"accent":let A={"\\vec":"arrow","\\dot":"dot","\\ddot":"dot.double","\\bar":"overline","\\hat":"hat","\\acute":"acute","\\grave":"grave","\\tilde":"tilde","\\breve":"breve","\\check":"caron"}[L];S=`${null!=A?A:""}(${uc(e.body)}) `;break;case"first":return"";case"latexgroup":return e.body.map(e=>e.value).join("");case"group":case"root":S=null!=(o=ur[L])?o:uc(e.body);break;case"genfrac":e.hasBarLine?(S+="(",S+=uc(e.above),S+=")/(",S+=uc(e.below),S+=")"):S+=`binom(${uc(e.above)}, ${uc(e.below)})`;break;case"surd":e.hasEmptyBranch("above")?S+=`sqrt(${uc(e.body)})`:S+=`root(${uc(e.above)}, ${uc(e.body)})`;break;case"latex":case"sizeddelim":case"delim":S=e.value;break;case"leftright":{let i=e.leftDelim;i&&ur[i]&&(i=ur[i]);let r=e.matchingRightDelim();r&&ur[r]&&(r=ur[r]),i&&(i=null!=(n=ua[i])?n:i),r&&(r=null!=(l=ua[r])?l:r),S=i&&r?`lr(${null!=(s=uo[i])?s:i}${uc(e.body)}${null!=(c=uo[r])?c:r})`:`lr(${i}${uc(e.body)}${r})`}break;case"overlap":case"box":break;case"mord":if(ur[E])return ur[E];(S=null!=(h=null!=(u=null!=(d=ur[L])?d:L)?u:L)?h:"string"==typeof e.value?e.value:"").startsWith("\\")&&(S+=" "),(C=L?L.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null)?S=String.fromCodePoint(Number.parseInt("0x"+C[1])):S.length>0&&S.startsWith("\\")&&(S="string"==typeof e.value?e.value.charAt(0):e.command),S=function(e,i){if(!i)return e;let r=e;return"double-struck"===i.variant&&(r=`bb(${r})`),"script"===i.variant&&(r=`cal(${r})`),"fraktur"===i.variant&&(r=`frak(${r})`),"sans-serif"===i.variant&&(r=`sans(${r})`),"monospace"===i.variant&&(r=`mono(${r})`),"bold"===i.variantStyle&&(r=`bold(${r})`),r}(S,e.style),S=` ${S} `;break;case"mbin":case"mrel":case"minner":S=null!=(f=null!=(m=null!=(p=ur[E])?p:ur[L])?m:un[L])?f:e.value;break;case"mopen":case"mclose":S=null!=(g=ur[E])?g:e.value;break;case"mpunct":S=null!=(b=un[L])?b:L;break;case"mop":case"operator":case"extensible-symbol":"​"!==e.value&&(S=(un[L]?un[L]:"\\operatorname"===L?uc(e.body):null!=(y=e.value)?y:L)+" ");break;case"array":let z=e.environmentName;if(e.isMultiline)S=e.rows.map(e=>e.map(e=>uc(e)).join("")).join(`
3459
- `);else{let i=e.rows,r=i.map(e=>e.map(uc).join(", ")),a={pmatrix:'"("',bmatrix:'"["',"bmatrix*":'"["',Bmatrix:'"{"',vmatrix:'"|"',matrix:"#none"}[z];S=a?`mat(delim: ${a}, ${r.join(" ; ")})`:"cases"===z||"rcases"===z?`cases(reverse: #${"rcases"===z}, ${r.join(", ")})`:"aligned"===z?i.map(e=>e.map(uc).join(" & ")).join(" \\ "):i.map(e=>e.map(uc).join("")).join("")}break;case"spacing":S=null!=(x=null!=(v=ur[E])?v:ur[L])?x:" ";break;case"newline":S=`\\
3460
- `;break;case"space":S=" ";break;case"subsup":S=null!=(_=e.leftSibling)&&_.value?"":'""';break;case"macro":S=null!=(M=null!=(k=null!=(w=ur[E])?w:ur[L])?k:un[L])?M:uc(e.body)}if(!S){let i=ul[e.command.slice(1)];i&&(S=`${i}(${uc(e.body)})`)}if(!S){let i=us[e.command.slice(1)];i&&(S=i(e))}if(!e.hasEmptyBranch("subscript")){S+="_";let i=uc(e.subscript);S+=1!==i.length?`(${i})`:i}if(!e.hasEmptyBranch("superscript")){S+="^";let i=uc(e.superscript);S+=1!==i.length?`(${i})`:i}return S}function ud(e,i){return"string"==typeof e?e+d$(i):d$(e)}function uu(e){var i;let r;if("prompt"===e.parent.type)"body"===e.parentBranch&&(r="prompt");else if("body"===e.parentBranch){if("first"===e.type&&("root"===e.parent.type?r="mathfield":"surd"===e.parent.type?r="radicand":"genfrac"===e.parent.type?r="fraction":"sizeddelim"===e.parent.type&&(r="delimiter"),r))return r;"subsup"===e.type?e.superscript&&e.subscript?r="superscript and subscript":e.superscript?r="superscript":e.subscript&&(r="subscript"):e.type&&(r=null!=(i=({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"})[e.type])?i:"parent")}else if("genfrac"===e.parent.type){if("above"===e.parentBranch)return"numerator";if("below"===e.parentBranch)return"denominator"}else"surd"===e.parent.type?"above"===e.parentBranch&&(r="index"):"superscript"===e.parentBranch?r="superscript":"subscript"===e.parentBranch&&(r="subscript");return null!=r?r:"parent"}var uh=class{constructor(e,i,r){this.mathfield=e,this.mode=i,this.silenceNotifications=!1,this._selection={ranges:[[0,0]],direction:"none"},this._anchor=0,this._position=0,this.root=r}dispose(){this.mathfield=void 0}getState(){let e={ranges:[...this._selection.ranges]};return this.selection.direction&&"none"!==this.selection.direction&&(e.direction=this.selection.direction),{content:this.root.toJson(),selection:e,mode:this.mode}}setState(e,i){var r;let a=this.silenceNotifications;this.silenceNotifications=null==(r=null==i?void 0:i.silenceNotifications)||r;let o={};if((null==i?void 0:i.type)==="undo"&&(o={inputType:"historyUndo"}),(null==i?void 0:i.type)==="redo"&&(o={inputType:"historyRedo"}),this.contentWillChange(o)){let i=this.silenceNotifications;this.silenceNotifications=!0,this.mode=e.mode,this.root=lD(e.content),this.selection=e.selection,this.silenceNotifications=i,this.contentDidChange(o),this.selectionDidChange()}this.silenceNotifications=a}get atoms(){return this.root.children}get selection(){return this._selection}set selection(e){this.setSelection(e)}setSelection(e,i){return(!!this.mathfield.contentEditable||"none"!==this.mathfield.userSelect)&&this.deferNotifications({selection:!0,content:!0},()=>{var r,a,o,n;let l=this.normalizeSelection(e,i);if(void 0===l)throw TypeError("Invalid selection");if(1===l.ranges.length&&l.ranges[0][0]===l.ranges[0][1]){let e=l.ranges[0][0];if(!this.mathfield.dirty&&!(null!=(r=this.at(e))&&r.parentPrompt)&&this.mathfield.hasEditablePrompts){if(null!=(a=this.at(e-1))&&a.parentPrompt){this._anchor=this.normalizeOffset(e-1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}if(null!=(o=this.at(e+1))&&o.parentPrompt){this._anchor=this.normalizeOffset(e+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=e,this._position=e,this._selection=l;return}let s=oQ(l);s=function(e,i){let[r,a]=i,o=a+1;if(o>e.lastOffset)return i;let n=e.at(o);return function(e,i,r,a){if((null==i?void 0:i.type)!=="subsup"||!um(e,i,[r,a]))return!1;let o=i.leftSibling;if(!o)return!1;let n=e.offsetOf(o);return n>r&&n<=a}(e,n,r,a)&&(a=e.offsetOf(n)),[r,a]}(this,s),"backward"===l.direction?[this._position,this._anchor]=s:[this._anchor,this._position]=s;let c=s[0]+1;for(;c<=this.lastOffset&&(null==(n=this.at(c))?void 0:n.type)==="first"&&c<s[1];)c+=1;let d=c<=this.lastOffset?this.at(c):this.at(s[1]),u=this.at(s[1]),h=oG.commonAncestor(d,u);(null==h?void 0:h.type)==="array"&&d.parent===h&&u.parent,this._selection={ranges:[s],direction:l.direction},this._position>=0&&(this._position,this.lastOffset)})}setPositionHandlingPlaceholder(e){var i;let r=this.at(e);(null==r?void 0:r.type)==="placeholder"?this.setSelection(e-1,e):(null==(i=null==r?void 0:r.rightSibling)?void 0:i.type)==="placeholder"?this.setSelection(e,e+1):this.position=e,r instanceof lm&&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 1===Math.abs(this._anchor-this._position)&&"placeholder"===this.at(Math.max(this._anchor,this._position)).type}collapseSelection(e="forward"){return this._anchor!==this._position&&("backward"===e?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 i=this.at(e),{parent:r}=i;if(!r)return[0,this.lastOffset];let a=i.parent.branch(i.parentBranch);return[this.offsetOf(a[0]),this.offsetOf(a[a.length-1])]}getBranchRange(e,i){let r=this.at(e).branch(i);return[this.offsetOf(r[0]),this.offsetOf(r[r.length-1])]}getCellRange(e){var i,r;this.getParentCell(e);let a=this.at(e);if(a){for(;a&&(null==(i=a.parent)?void 0:i.type)!=="array";)a=a.parent;if((null==(r=null==a?void 0:a.parent)?void 0:r.type)==="array")return[this.offsetOf(a.firstSibling),this.offsetOf(a.lastSibling)]}}getAtoms(e,i,r){let a,o,n=null!=r?r:{};if(o4(e)){if(n=null!=i?i:{},e.ranges.length>1)return e.ranges.reduce((e,i)=>[...e,...this.getAtoms(i,n)],[]);e=e.ranges[0]}if(o0(e)){if(a=e,!o0(i))return[];o=i}else[a,o]=e,0===Object.keys(n).length&&(n=null!=i?i:{});if(!Number.isFinite(a))return[];void 0===n.includeChildren&&(n.includeChildren=!1),a<0&&(a=this.lastOffset-a+1),o<0&&(o=this.lastOffset+o+1);let l=Math.min(a,o),s=Math.max(a,o),c=0===l?0:l+1;if(!n.includeChildren&&1===c&&s===this.lastOffset)return[this.root];let d=[];for(let e=c;e<=s;e++){let i=this.atoms[e];up(this,i,c,s,n.includeFirstAtoms)&&d.push(i)}return n.includeChildren||(d=d.filter(e=>{let i=!1,{parent:r}=e;for(;r&&!i;)i=up(this,r,c,s,n.includeFirstAtoms),r=r.parent;return!i})),d}findAtom(e,i=0,r="forward"){let a,o=this.lastOffset;if("forward"===r){for(let r=i;r<=o;r++)if(e(a=this.atoms[r]))return a;for(let r=0;r<i;r++)if(e(a=this.atoms[r]))return a;return}for(let r=i;r>=0;r--)if(e(a=this.atoms[r]))return a;for(let r=o;r>i;r--)if(e(a=this.atoms[r]))return a}extractAtoms(e){var i;let r=this.getAtoms(e);for(let e of(1===r.length&&!r[0].parent&&r[0].isRoot&&(r=(r=r[0]instanceof nG?r[0].rows.flatMap(e=>e.flatMap(e=>e)):[...null!=(i=r[0].body)?i:r[0].children]).filter(e=>"first"!==e.type)),r))e.parent.removeChild(e);return r}deleteAtoms(e){if(null!=e||(e=[0,-1]),this.extractAtoms(e),0===e[0]&&-1===e[1]&&this.root instanceof nG)for(;this.root.rowCount>1;)this.root.removeRow(1);this.position=e[0]}atomToString(e,i){let r=null!=i?i:"latex";if(r.startsWith("latex"))return oG.serialize([e],{expandMacro:"latex-expanded"===r,skipStyles:"latex-unstyled"===r,skipPlaceholders:"latex-without-placeholders"===r,defaultMode:this.mathfield.options.defaultMode});if("math-ml"===r)return dS(e);if("spoken"===r)return d$(e);if("spoken-text"===r){let i=globalThis.MathfieldElement.textToSpeechMarkup;globalThis.MathfieldElement.textToSpeechMarkup="";let r=d$(e);return globalThis.MathfieldElement.textToSpeechMarkup=i,r}if("spoken-ssml"===r||"spoken-ssml-with-highlighting"===r){let i=globalThis.MathfieldElement.textToSpeechMarkup;globalThis.MathfieldElement.textToSpeechMarkup="ssml";let r=d$(e);return globalThis.MathfieldElement.textToSpeechMarkup=i,r}return"typst"===r?uc(e):"plain-text"===r?dR(e,{plain:!0}):"ascii-math"===r?dR(e):(console.error(`MathLive 0.110.6: Unexpected format "${r}`),"")}getValue(e,i,r){let a,o;if(void 0===e)return this.atomToString(this.root,"latex");if("string"==typeof e&&"math-json"!==e)return this.atomToString(this.root,e);if(o0(e)&&o0(i)?(a=[this.normalizeRange([e,i])],o=r):o1(e)?(a=[this.normalizeRange(e)],o=i):o4(e)?(a=e.ranges,o=i):(a=[this.normalizeRange([0,-1])],o=e),null!=o||(o="latex"),"math-json"===o){if(!globalThis.MathfieldElement.computeEngine)return window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`The CortexJS Compute Engine library is not available.
3484
+ import "https://esm.run/@cortex-js/compute-engine"`)}return null!=(r=null==uK?void 0:uK.box(e).latex)?r:""}function dG(e,i="math"){return dj(new oG({type:"root",body:ll(e,{parseMode:i})}))}function dZ(e){return o6(e,{format:"ascii-math"})[1]}function dY(e){if("string"==typeof e){let i=function(e){let i;if(e&&"#"===e[0])return(e=e.slice(1)).length<=4?(i={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},4===e.length&&(i.a=parseInt(e[3]+e[3],16)/255)):(i={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},8===e.length&&(i.a=parseInt(e[6]+e[7],16)/255)),void 0===(null==i?void 0:i.a)&&(i.a=1),i}(e);if(!i)throw Error(`Invalid color: ${e}`);return i}return"C"in e?d3(d0(e)):"a"in e?d3(e):e}function dQ(e){return e<0?0:e>255?255:Math.round(e)}function d0(e){let[i,r,a]=[e.L,e.C,e.H],o=a*Math.PI/180,n={L:i,a:r*Math.cos(o),b:r*Math.sin(o)};return void 0!==e.alpha&&(n.alpha=e.alpha),n}function d1(e){let[i,r,a]=[e.L,e.a,e.b],o=Math.pow(.9999999984505198*i+.39633779217376786*r+.2158037580607588*a,3),n=Math.pow(1.00000000888176*i-.10556134232365635*r-.0638541747717059*a,3),l=Math.pow(1.000000054672411*i-.0894841820949657*r-1.2914855378640917*a,3),s=e=>{let i=Math.abs(e);return i<=.0031308?12.92*e:(Math.sign(e)||1)*(1.055*Math.pow(i,1/2.4)-.055)};return[s(4.076741661347994*o-3.307711590408193*n+.230969928729428*l),s(-1.2684380040921763*o+2.6097574006633715*n-.3413193963102197*l),s(-.004196086541837188*o-.7034186144594493*n+1.7076147009309444*l)]}function d4(e){let[i,r,a]=e;return i>=0&&i<=1&&r>=0&&r<=1&&a>=0&&a<=1}function d2(e,i){let[r,a,o]=e;return r=dQ(255*r),a=dQ(255*a),o=dQ(255*o),void 0!==i?{r,g:a,b:o,alpha:i}:{r,g:a,b:o}}function d3(e){let[i,r,a]=d1(e);if(d4([i,r,a]))return d2([i,r,a],e.alpha);let o=function(e){let[i,r,a]=[e.L,e.a,e.b],o={L:i,C:Math.sqrt(r*r+a*a),H:180*Math.atan2(a,r)/Math.PI};return void 0!==e.alpha&&(o.alpha=e.alpha),o}(e);if(o.C=0,[i,r,a]=d1(d0(o)),!d4([i,r,a]))return d2([i,r,a],e.alpha);let n=0,l=e.L,s=(n+l)/2;o.C=s;let c=.36/4096;for(;l-n>c;)o.C=s=(n+l)/2,[i,r,a]=d1(d0(o)),d4([i,r,a])?n=s:l=s;return d2([i,r,a],e.alpha)}function d6(e,i){let r=dY(e),a=dY(i);function o(e){return e>=.022?e:e+(.022-e)**1.414}function n(e){return(e<0?-1:1)*Math.pow(Math.abs(e),2.4)}let l=o(.2126729*n(a.r/255)+.7151522*n(a.g/255)+.072175*n(a.b/255)),s=o(.2126729*n(r.r/255)+.7151522*n(r.g/255)+.072175*n(r.b/255)),c;return 100*(.1>Math.abs(c=5e-4>Math.abs(s-l)?0:s>l?1.14*(s**.56-l**.57):1.14*(s**.65-l**.62))?0:c>0?c-.027:c+.027)}function d8(e,i,r){return null!=r||(r="#fff"),null!=i||(i="#000"),Math.abs(d6(e,r))>Math.abs(d6(e,i))?r:i}function d5(e){let i=d7(e),r="";for(let e of i){if("string"!=typeof e.value)return"";r+=e.value}return r}function d7(e){let i=e.model.selection.ranges;if(1!==i.length)return[];let r=e.model.getAtoms(i[0]);return 1===r.length&&r[0].isRoot&&(r=r[0].children),r.filter(e=>"first"!==e.type)}var d9=class extends dh{constructor(e,i,r,a){super(e,i),this.row=r,this.col=a}set active(e){let i=this.parentMenu.children;if(e)for(let e of i)e.element.classList.toggle("active",e.row<=this.row&&e.col<=this.col);else for(let e of i)e.element.classList.remove("active")}};function ue(e){var i,r;return["array","matrix","pmatrix","bmatrix","vmatrix","Bmatrix","cases","dcases","rcases"].includes(null!=(r=null==(i=e.model.parentEnvironment)?void 0:i.environmentName)?r:"")}function ut(e){var i;let r=null==(i=e.model.parentEnvironment)?void 0:i.rows;return r?[r.length,r.reduce((e,i)=>Math.max(e,i.length),0)]:[0,0]}function ui(e){let i=e.model.parentEnvironment;return i?[i.minRows,i.minColumns]:[0,0]}function ur(e){let i=e.model.parentEnvironment;return i?[i.maxRows,i.maxColumns]:[0,0]}function ua(e,i){sh(e),e.flushInlineShortcutBuffer(),cf(e.model,i),sB(e)}function uo(e,i,r,a){return{id:`variant-${i}`,label:()=>{var i;return d5(e).length<12?dH(`\\${r}{${d5(e)}}`):null!=(i=N(a))?i:a},class:"ML__xl",tooltip:()=>{var e;return null!=(e=N(a))?e:a},visible:()=>(function(e,i){let r=d7(e);if(1!==r.length)return!1;let a=lY[i];return!!a&&!!a.test(r[0].value)})(e,i),checked:()=>{var r;return null!=(r=({some:"mixed",all:!0})[e.queryStyle({variant:i})])&&r},onMenuSelect:()=>e.applyStyle({variant:i},{operation:"toggle"})}}function un(e,i,r,a){return{id:`variant-style-${i}`,label:()=>{var i;let o=d5(e);return o.length>0&&o.length<12?dH(`\\${r}{${d5(e)}}`):null!=(i=N(a))?i:a},class:()=>{let i=d5(e);return i.length>0&&i.length<12?"ML__xl":""},tooltip:()=>{var e;return null!=(e=N(a))?e:a},visible:!0,checked:()=>{var r;return null!=(r=({some:"mixed",all:!0})[e.queryStyle({variantStyle:i})])&&r},onMenuSelect:()=>e.applyStyle({variantStyle:i},{operation:"toggle"})}}function ul(e){return`<span class='ML__insert-template'> ${dH(N(`menu.insert.${e}-template`))}</span><span class="ML__insert-label">${N(`menu.insert.${e}`)}</span>`}var us={"\\ne":"!=","\\neq":"!=","−":"-","-":"-","\\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 ","/":"\\/","&":"&"},uc={"[":" bracket.l ","]":" bracket.r ","{":" brace.l ","}":" brace.r ","(":" paren.l ",")":" paren.r ","<":" angle.l ",">":" angle.r ",".":""},ud={" bracket.l ":"["," bracket.r ":"]"," brace.l ":"{"," brace.r ":"}"," paren.l ":"("," paren.r ":")"," angle.l ":" angle.l "," angle.r ":" angle.r "},uu={"\\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":" ⋈ ","\\circ":" circle.stroked.small "},uh={underarc:"underparen",underparen:"underparen",underbrace:"underbrace",underline:"underline",overarc:"overparen",overparen:"overparen",overbrace:"overbrace",overline:"overline",cancel:"cancel",displaystyle:"display",textstyle:"inline"},up={longrightarrow:e=>`arrow.r.long^(${um(e.above)})`,longleftarrow:e=>`arrow.l.long^(${um(e.above)})`};function um(e){var i,r,a,o,n,l,s,c,d,u,h,p,m,f,g,b,y,v,x,_,w,k,M;if(!e)return"";if(R(e)){if(0===e.length)return"";if("latex"===e[0].mode)return e.map(e=>um(e)).join("");if("text"===e[0].mode){let r=0,a="";for(;(null==(i=e[r])?void 0:i.mode)==="text";)a+=e[r].body?um(e[r].body):e[r].value,r++;return` "${a}" ${um(e.slice(r))}`}let o=0,n=[];for(;(null==(r=e[o])?void 0:r.mode)==="math";){let i="";for(;(null==(a=e[o])?void 0:a.type)==="mord"&&/\d/.test(e[o].value);)i+=e[o++].value;i?n.push(i):n.push(um(e[o++]))}return n.push(um(e.slice(o))),function(e){let i="";for(let r of e){let e=i[i.length-1];void 0!==e&&(/\d$/.test(e)&&/^\d/.test(r)||/[a-zA-Z]$/.test(e)&&/^[a-zA-Z]/.test(r))&&(i+=" "),i+=r}return i}(n)}if("text"===e.mode)return`"${e.value}"`;let S="",{command:L}=e,C;if("\\placeholder"===L||"\\blank"===L)return`"${um(e.body)}"`;let E=oG.serialize([e],{expandMacro:!0,defaultMode:"math"});switch(e.type){case"accent":let A={"\\vec":"arrow","\\dot":"dot","\\ddot":"dot.double","\\bar":"overline","\\hat":"hat","\\acute":"acute","\\grave":"grave","\\tilde":"tilde","\\breve":"breve","\\check":"caron"}[L];S=`${null!=A?A:""}(${um(e.body)}) `;break;case"first":return"";case"latexgroup":return e.body.map(e=>e.value).join("");case"group":case"root":S=null!=(o=us[L])?o:um(e.body);break;case"genfrac":e.hasBarLine?(S+="(",S+=um(e.above),S+=")/(",S+=um(e.below),S+=")"):S+=`binom(${um(e.above)}, ${um(e.below)})`;break;case"surd":e.hasEmptyBranch("above")?S+=`sqrt(${um(e.body)})`:S+=`root(${um(e.above)}, ${um(e.body)})`;break;case"latex":case"sizeddelim":case"delim":S=e.value;break;case"leftright":{let i=e.leftDelim;i&&us[i]&&(i=us[i]);let r=e.matchingRightDelim();r&&us[r]&&(r=us[r]),i&&(i=null!=(n=uc[i])?n:i),r&&(r=null!=(l=uc[r])?l:r),S=i&&r?`lr(${null!=(s=ud[i])?s:i}${um(e.body)}${null!=(c=ud[r])?c:r})`:`lr(${i}${um(e.body)}${r})`}break;case"overlap":case"box":break;case"mord":if(us[E])return us[E];(S=null!=(h=null!=(u=null!=(d=us[L])?d:L)?u:L)?h:"string"==typeof e.value?e.value:"").startsWith("\\")&&(S+=" "),(C=L?L.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null)?S=String.fromCodePoint(Number.parseInt("0x"+C[1])):S.length>0&&S.startsWith("\\")&&(S="string"==typeof e.value?e.value.charAt(0):e.command),S=function(e,i){if(!i)return e;let r=e;return"double-struck"===i.variant&&(r=`bb(${r})`),"script"===i.variant&&(r=`cal(${r})`),"fraktur"===i.variant&&(r=`frak(${r})`),"sans-serif"===i.variant&&(r=`sans(${r})`),"monospace"===i.variant&&(r=`mono(${r})`),"bold"===i.variantStyle&&(r=`bold(${r})`),r}(S,e.style),S=` ${S} `;break;case"mbin":case"mrel":case"minner":S=null!=(f=null!=(m=null!=(p=us[E])?p:us[L])?m:uu[L])?f:e.value;break;case"mopen":case"mclose":S=null!=(g=us[E])?g:e.value;break;case"mpunct":S=null!=(b=uu[L])?b:L;break;case"mop":case"operator":case"extensible-symbol":"​"!==e.value&&(S=(uu[L]?uu[L]:"\\operatorname"===L?um(e.body):null!=(y=e.value)?y:L)+" ");break;case"array":let z=e.environmentName;if(e.isMultiline)S=e.rows.map(e=>e.map(e=>um(e)).join("")).join(`
3485
+ `);else{let i=e.rows,r=i.map(e=>e.map(um).join(", ")),a={pmatrix:'"("',bmatrix:'"["',"bmatrix*":'"["',Bmatrix:'"{"',vmatrix:'"|"',matrix:"#none"}[z];S=a?`mat(delim: ${a}, ${r.join(" ; ")})`:"cases"===z||"rcases"===z?`cases(reverse: #${"rcases"===z}, ${r.join(", ")})`:"aligned"===z?i.map(e=>e.map(um).join(" & ")).join(" \\ "):i.map(e=>e.map(um).join("")).join("")}break;case"spacing":S=null!=(x=null!=(v=us[E])?v:us[L])?x:" ";break;case"newline":S=`\\
3486
+ `;break;case"space":S=" ";break;case"subsup":S=null!=(_=e.leftSibling)&&_.value?"":'""';break;case"macro":S=null!=(M=null!=(k=null!=(w=us[E])?w:us[L])?k:uu[L])?M:um(e.body)}if(!S){let i=uh[e.command.slice(1)];i&&(S=`${i}(${um(e.body)})`)}if(!S){let i=up[e.command.slice(1)];i&&(S=i(e))}if(!e.hasEmptyBranch("subscript")){S+="_";let i=um(e.subscript);S+=1!==i.length?`(${i})`:i}if(!e.hasEmptyBranch("superscript")){S+="^";let i=um(e.superscript);S+=1!==i.length?`(${i})`:i}return S}function uf(e,i){return"string"==typeof e?e+dN(i):dN(e)}function ug(e){var i;let r;if("prompt"===e.parent.type)"body"===e.parentBranch&&(r="prompt");else if("body"===e.parentBranch){if("first"===e.type&&("root"===e.parent.type?r="mathfield":"surd"===e.parent.type?r="radicand":"genfrac"===e.parent.type?r="fraction":"sizeddelim"===e.parent.type&&(r="delimiter"),r))return r;"subsup"===e.type?e.superscript&&e.subscript?r="superscript and subscript":e.superscript?r="superscript":e.subscript&&(r="subscript"):e.type&&(r=null!=(i=({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"})[e.type])?i:"parent")}else if("genfrac"===e.parent.type){if("above"===e.parentBranch)return"numerator";if("below"===e.parentBranch)return"denominator"}else"surd"===e.parent.type?"above"===e.parentBranch&&(r="index"):"superscript"===e.parentBranch?r="superscript":"subscript"===e.parentBranch&&(r="subscript");return null!=r?r:"parent"}var ub=class{constructor(e,i,r){this.mathfield=e,this.mode=i,this.silenceNotifications=!1,this._selection={ranges:[[0,0]],direction:"none"},this._anchor=0,this._position=0,this.root=r}dispose(){this.mathfield=void 0}getState(){let e={ranges:[...this._selection.ranges]};return this.selection.direction&&"none"!==this.selection.direction&&(e.direction=this.selection.direction),{content:this.root.toJson(),selection:e,mode:this.mode}}setState(e,i){var r;let a=this.silenceNotifications;this.silenceNotifications=null==(r=null==i?void 0:i.silenceNotifications)||r;let o={};if((null==i?void 0:i.type)==="undo"&&(o={inputType:"historyUndo"}),(null==i?void 0:i.type)==="redo"&&(o={inputType:"historyRedo"}),this.contentWillChange(o)){let i=this.silenceNotifications;this.silenceNotifications=!0,this.mode=e.mode,this.root=lR(e.content),this.selection=e.selection,this.silenceNotifications=i,this.contentDidChange(o),this.selectionDidChange()}this.silenceNotifications=a}get atoms(){return this.root.children}get selection(){return this._selection}set selection(e){this.setSelection(e)}setSelection(e,i){return(!!this.mathfield.contentEditable||"none"!==this.mathfield.userSelect)&&this.deferNotifications({selection:!0,content:!0},()=>{var r,a,o,n;let l=this.normalizeSelection(e,i);if(void 0===l)throw TypeError("Invalid selection");if(1===l.ranges.length&&l.ranges[0][0]===l.ranges[0][1]){let e=l.ranges[0][0];if(!this.mathfield.dirty&&!(null!=(r=this.at(e))&&r.parentPrompt)&&this.mathfield.hasEditablePrompts){if(null!=(a=this.at(e-1))&&a.parentPrompt){this._anchor=this.normalizeOffset(e-1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}if(null!=(o=this.at(e+1))&&o.parentPrompt){this._anchor=this.normalizeOffset(e+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=e,this._position=e,this._selection=l;return}let s=oQ(l);s=function(e,i){let[r,a]=i,o=a+1;if(o>e.lastOffset)return i;let n=e.at(o);return function(e,i,r,a){if((null==i?void 0:i.type)!=="subsup"||!uv(e,i,[r,a]))return!1;let o=i.leftSibling;if(!o)return!1;let n=e.offsetOf(o);return n>r&&n<=a}(e,n,r,a)&&(a=e.offsetOf(n)),[r,a]}(this,s),"backward"===l.direction?[this._position,this._anchor]=s:[this._anchor,this._position]=s;let c=s[0]+1;for(;c<=this.lastOffset&&(null==(n=this.at(c))?void 0:n.type)==="first"&&c<s[1];)c+=1;let d=c<=this.lastOffset?this.at(c):this.at(s[1]),u=this.at(s[1]),h=oG.commonAncestor(d,u);(null==h?void 0:h.type)==="array"&&d.parent===h&&u.parent,this._selection={ranges:[s],direction:l.direction},this._position>=0&&(this._position,this.lastOffset)})}setPositionHandlingPlaceholder(e){var i;let r=this.at(e);(null==r?void 0:r.type)==="placeholder"?this.setSelection(e-1,e):(null==(i=null==r?void 0:r.rightSibling)?void 0:i.type)==="placeholder"?this.setSelection(e,e+1):this.position=e,r instanceof lx&&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 1===Math.abs(this._anchor-this._position)&&"placeholder"===this.at(Math.max(this._anchor,this._position)).type}collapseSelection(e="forward"){return this._anchor!==this._position&&("backward"===e?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 i=this.at(e),{parent:r}=i;if(!r)return[0,this.lastOffset];let a=i.parent.branch(i.parentBranch);return[this.offsetOf(a[0]),this.offsetOf(a[a.length-1])]}getBranchRange(e,i){let r=this.at(e).branch(i);return[this.offsetOf(r[0]),this.offsetOf(r[r.length-1])]}getCellRange(e){var i,r;this.getParentCell(e);let a=this.at(e);if(a){for(;a&&(null==(i=a.parent)?void 0:i.type)!=="array";)a=a.parent;if((null==(r=null==a?void 0:a.parent)?void 0:r.type)==="array")return[this.offsetOf(a.firstSibling),this.offsetOf(a.lastSibling)]}}getAtoms(e,i,r){let a,o,n=null!=r?r:{};if(o4(e)){if(n=null!=i?i:{},e.ranges.length>1)return e.ranges.reduce((e,i)=>[...e,...this.getAtoms(i,n)],[]);e=e.ranges[0]}if(o0(e)){if(a=e,!o0(i))return[];o=i}else[a,o]=e,0===Object.keys(n).length&&(n=null!=i?i:{});if(!Number.isFinite(a))return[];void 0===n.includeChildren&&(n.includeChildren=!1),a<0&&(a=this.lastOffset-a+1),o<0&&(o=this.lastOffset+o+1);let l=Math.min(a,o),s=Math.max(a,o),c=0===l?0:l+1;if(!n.includeChildren&&1===c&&s===this.lastOffset)return[this.root];let d=[];for(let e=c;e<=s;e++){let i=this.atoms[e];uy(this,i,c,s,n.includeFirstAtoms)&&d.push(i)}return n.includeChildren||(d=d.filter(e=>{let i=!1,{parent:r}=e;for(;r&&!i;)i=uy(this,r,c,s,n.includeFirstAtoms),r=r.parent;return!i})),d}findAtom(e,i=0,r="forward"){let a,o=this.lastOffset;if("forward"===r){for(let r=i;r<=o;r++)if(e(a=this.atoms[r]))return a;for(let r=0;r<i;r++)if(e(a=this.atoms[r]))return a;return}for(let r=i;r>=0;r--)if(e(a=this.atoms[r]))return a;for(let r=o;r>i;r--)if(e(a=this.atoms[r]))return a}extractAtoms(e){var i;let r=this.getAtoms(e);for(let e of(1===r.length&&!r[0].parent&&r[0].isRoot&&(r=(r=r[0]instanceof nQ?r[0].rows.flatMap(e=>e.flatMap(e=>e)):[...null!=(i=r[0].body)?i:r[0].children]).filter(e=>"first"!==e.type)),r))e.parent.removeChild(e);return r}deleteAtoms(e){if(null!=e||(e=[0,-1]),this.extractAtoms(e),0===e[0]&&-1===e[1]&&this.root instanceof nQ)for(;this.root.rowCount>1;)this.root.removeRow(1);this.position=e[0]}atomToString(e,i){let r=null!=i?i:"latex";if(r.startsWith("latex"))return oG.serialize([e],{expandMacro:"latex-expanded"===r,skipStyles:"latex-unstyled"===r,skipPlaceholders:"latex-without-placeholders"===r,defaultMode:this.mathfield.options.defaultMode});if("math-ml"===r)return dz(e);if("spoken"===r)return dN(e);if("spoken-text"===r){let i=globalThis.MathfieldElement.textToSpeechMarkup;globalThis.MathfieldElement.textToSpeechMarkup="";let r=dN(e);return globalThis.MathfieldElement.textToSpeechMarkup=i,r}if("spoken-ssml"===r||"spoken-ssml-with-highlighting"===r){let i=globalThis.MathfieldElement.textToSpeechMarkup;globalThis.MathfieldElement.textToSpeechMarkup="ssml";let r=dN(e);return globalThis.MathfieldElement.textToSpeechMarkup=i,r}return"typst"===r?um(e):"plain-text"===r?dj(e,{plain:!0}):"ascii-math"===r?dj(e):(console.error(`MathLive 0.110.8: Unexpected format "${r}`),"")}getValue(e,i,r){let a,o;if(void 0===e)return this.atomToString(this.root,"latex");if("string"==typeof e&&"math-json"!==e)return this.atomToString(this.root,e);if(o0(e)&&o0(i)?(a=[this.normalizeRange([e,i])],o=r):o1(e)?(a=[this.normalizeRange(e)],o=i):o4(e)?(a=e.ranges,o=i):(a=[this.normalizeRange([0,-1])],o=e),null!=o||(o="latex"),"math-json"===o){if(!globalThis.MathfieldElement.computeEngine)return window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`The CortexJS Compute Engine library is not available.
3461
3487
  Load the library, for example with:
3462
- import "https://esm.run/@cortex-js/compute-engine"`),'["Error", "compute-engine-not-available"]';let e=this.getValue({ranges:a},"latex-unstyled");try{let i=globalThis.MathfieldElement.computeEngine.parse(e);return JSON.stringify(i.json)}catch(e){return JSON.stringify(["Error",`'${e.toString()}'`])}}if(o.startsWith("latex")){let e={expandMacro:"latex-expanded"===o,skipStyles:"latex-unstyled"===o,skipPlaceholders:"latex-without-placeholders"===o,defaultMode:this.mathfield.options.defaultMode};return of(a.map(i=>oG.serialize(this.getAtoms(i),e)))}return a.map(e=>this.getAtoms(e).map(e=>this.atomToString(e,o)).join("")).join("")}extendSelectionTo(e,i){return(!!this.mathfield.contentEditable||"none"!==this.mathfield.userSelect)&&this.deferNotifications({selection:!0},()=>{let[r,a]=this.normalizeRange([e,i]),o=new Set(["genfrac","subsup","accent","box","overlap","overunder"]),{parent:n}=this.at(a);if(null!=n&&n.type&&o.has(n.type))for(;null!=n&&n.type&&o.has(n.type)&&um(this,n,[r,a]);)a=this.offsetOf(n),n=n.parent;for(n=this.at(r).parent;null!=n&&n.type&&o.has(n.type)&&um(this,n,[r,a]);)r=this.offsetOf(n.leftSibling),n=n.parent;if(null!=(n=this.at(a).parent)&&n.type&&o.has(n.type))for(;null!=n&&n.type&&o.has(n.type)&&um(this,n,[r,a]);)a=this.offsetOf(n),n=n.parent;this._position=this.normalizeOffset(i),this._selection={ranges:[[r,a]],direction:"none"}})}announce(e,i,r=[]){var a,o;(null==(o=null==(a=this.mathfield.host)?void 0:a.dispatchEvent(new CustomEvent("announce",{detail:{command:e,previousPosition:i,atoms:r},cancelable:!0,bubbles:!0,composed:!0})))||o)&&function(e,i,r,a){let o="";if("plonk"===i){globalThis.MathfieldElement.playSound("plonk"),e.flushInlineShortcutBuffer();return}if("delete"===i)o=ud("deleted: ",a);else if("focus"===i||i.includes("move"))o=function(e,i){if(Number.isNaN(i))return"";let r=e.at(i);if(!r||r.treeDepth<=e.at(e.position).treeDepth)return"";let a="",o=r.parent,n=e.at(e.position).parent;for(;o!==e.root&&o!==n;)a+=`out of ${uu(o)};`,o=o.parent;return a}(e.model,r)+function(e){if(!e.selectionIsCollapsed)return`selected: ${ud(e.getAtoms(e.selection))}`;let i="",r=e.at(e.position);if(r.isFirstSibling&&(i=`start of ${uu(r)}: `),r.isLastSibling){if(!r.isFirstSibling){if(!r.parent.parent)return`${ud(r)}; end of mathfield`;i=`${ud(r)}; end of ${uu(r)}`}}else i+=ud(r);return i}(e.model);else if("replacement"===i)o=ud(e.model.at(e.model.position));else if("line"===i){let i=ud(e.model.root);e.keyboardDelegate.setAriaLabel(i)}else o=a?ud(i+" ",a):i;if(o&&e.ariaLiveText){let i=e.ariaLiveText.textContent.includes(" ")?"   ":"   ";e.ariaLiveText.textContent=o+i}}(this.mathfield,e,i,r)}deferNotifications(e,i){let r=this._selection,a=this._anchor,o=this._position,n=this.silenceNotifications;this.silenceNotifications=!0;let l=this.root.changeCounter;i(),this.silenceNotifications=n;let s=a!==this._anchor||o!==this._position||"different"===function(e,i){if(e.direction===i.direction){let o=e.ranges.length;if(i.ranges.length===o){var r,a;let n=0;for(;n<o&&"equal"==(r=e.ranges[n],a=i.ranges[n],r[0]===a[0]&&r[1]===a[1]?"equal":"different");)n++;return n===o?"equal":"different"}}return"different"}(this._selection,r);e.selection&&s&&this.selectionDidChange();let c=this.root.changeCounter!==l;return e.content&&c&&this.contentDidChange({inputType:e.type}),c||s}normalizeOffset(e){return e>0?e=Math.min(e,this.lastOffset):e<0&&(e=this.lastOffset+e+1),e}normalizeRange(e){let[i,r]=e;return(i=this.normalizeOffset(i))<(r=this.normalizeOffset(r))?[i,r]:[r,i]}normalizeSelection(e,i){var r;let a;if(o0(e)){let r=this.normalizeOffset(e);if(o0(i)){let e=this.normalizeOffset(i);a=r<=e?{ranges:[[r,e]],direction:"none"}:{ranges:[[e,r]],direction:"backward"}}else a={ranges:[[r,r]],direction:"none"}}else if(o1(e)){let i=this.normalizeOffset(e[0]),r=this.normalizeOffset(e[1]);a=i<=r?{ranges:[[i,r]],direction:"none"}:{ranges:[[r,i]],direction:"backward"}}else o4(e)&&(a={ranges:e.ranges.map(e=>this.normalizeRange(e)),direction:null!=(r=e.direction)?r:"none"});return a}get parentEnvironment(){let e=this.at(this.position).parent;if(e){for(;e.parent&&"array"!==e.type;)e=e.parent;if("array"===e.type)return e}}get parentCell(){return this.getParentCell(this.position)}getParentCell(e){var i,r;let a=this.at(e);if(a){for(;a&&(null==(i=a.parent)?void 0:i.type)!=="array";)a=a.parent;if((null==(r=null==a?void 0:a.parent)?void 0:r.type)==="array")return a.parentBranch}}contentWillChange(e={}){if(this.silenceNotifications||!this.mathfield)return!0;let i=this.silenceNotifications;this.silenceNotifications=!0;let r=this.mathfield.onContentWillChange(e);return this.silenceNotifications=i,r}contentDidChange(e){var i;if(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(cZ(this.mathfield)),this.silenceNotifications||!(null!=(i=this.mathfield)&&i.host))return;let r=this.silenceNotifications;this.silenceNotifications=!0,setTimeout(()=>{var i;this.mathfield&&nl(this.mathfield)&&this.mathfield.host&&this.mathfield.host.dispatchEvent(new InputEvent("input",g(f({},e),{data:e.data?e.data:null!=(i=e.inputType)?i:"",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 up(e,i,r,a,o){let n=e.offsetOf(i);if(n<r||n>a)return!1;if(!i.hasChildren)return!0;let l=o?i.firstChild:uf(i);if(!l)return!0;let s=o?i.lastChild:ug(i);if(!s)return!0;let c=e.offsetOf(l);if(c>=r&&c<=a){let i=e.offsetOf(s);if(i>=r&&i<=a)return!0}return!1}function um(e,i,r){if(!(null!=i&&i.hasChildren))return!1;let[a,o]=r,n=uf(i);if(!n)return!1;let l=ug(i);if(!l)return!1;let s=e.offsetOf(n),c=e.offsetOf(l);return s>=a&&s<=o&&c>=s&&c<=o}function uf(e){for(let i of e.children)if("first"!==i.type)return i}function ug(e){let{children:i}=e;for(let e=i.length-1;e>=0;e--)if("first"!==i[e].type)return i[e]}s$({deleteAll:e=>e.contentWillChange({inputType:"deleteContent"})&&cf(e,[0,-1],"deleteContent"),deleteForward:e=>!!e.mathfield.isSelectionEditable&&!!e.contentWillChange({inputType:"deleteContentForward"})&&(e.selectionIsCollapsed?e.deferNotifications({content:!0,selection:!0,type:"deleteContentForward"},()=>{var i,r,a;let o=e.at(e.position).rightSibling;if(o&&cm(e,"forward",o))return;if(o){if(e.at(e.position).isLastSibling&&cm(e,"forward",o.parent,o.parentBranch))return}else{if((o=e.at(e.position)).isLastSibling&&cm(e,"forward",o.parent,o.parentBranch))return;o=void 0}if(e.position===e.lastOffset||!o)return void e.announce("plonk");let n=o.parent;n.removeChild(o);let l=null==(i=e.at(e.position))?void 0:i.rightSibling;for(;(null==l?void 0:l.type)==="subsup";)l.parent.removeChild(l),l=null==(r=e.at(e.position))?void 0:r.rightSibling;if(e.announce("delete",void 0,[o]),"latexgroup"===n.type&&n.hasEmptyBranch("body")){let i=e.offsetOf(n.leftSibling);null==(a=n.parent)||a.removeChild(n),e.position=Math.max(0,i)}e.root.hasEmptyBranch("body")&&e.mathfield.flushInlineShortcutBuffer()}):cf(e,oQ(e.selection),"deleteContentForward")),deleteBackward:e=>!!e.mathfield.isSelectionEditable&&!!e.contentWillChange({inputType:"deleteContentBackward"})&&(e.selectionIsCollapsed?e.deferNotifications({content:!0,selection:!0,type:"deleteContentBackward"},()=>{var i;let r=e.at(e.position);if(r&&cm(e,"backward",r))return;if(null!=r&&r.isFirstSibling){if(cm(e,"backward",r.parent,r.parentBranch))return;r=null}if(!r)return void e.announce("plonk");let a=r.parent;if(e.position=e.offsetOf(r.leftSibling),a.removeChild(r),e.announce("delete",void 0,[r]),"latexgroup"===a.type&&a.hasEmptyBranch("body")){let r=e.offsetOf(a.leftSibling);null==(i=a.parent)||i.removeChild(a),e.position=Math.max(0,r)}e.root.hasEmptyBranch("body")&&e.mathfield.flushInlineShortcutBuffer()}):cf(e,oQ(e.selection),"deleteContentBackward")),deleteNextWord:e=>e.contentWillChange({inputType:"deleteWordForward"})&&cg(e,"forward",{delete:!0}),deletePreviousWord:e=>e.contentWillChange({inputType:"deleteWordBackward"})&&cg(e,"backward",{delete:!0}),deleteToGroupStart:e=>{if(!e.contentWillChange({inputType:"deleteSoftLineBackward"}))return!1;let i=e.offsetOf(e.at(e.position).firstSibling);return i===e.position?(e.announce("plonk"),!1):(e.deferNotifications({content:!0,selection:!0,type:"deleteSoftLineBackward"},()=>e.deleteAtoms([e.anchor,i])),e.position=i,!0)},deleteToGroupEnd:e=>{if(!e.contentWillChange({inputType:"deleteSoftLineForward"}))return!1;let i=e.offsetOf(e.at(e.position).lastSibling);return i===e.position?(e.announce("plonk"),!1):(e.deferNotifications({content:!0,selection:!0,type:"deleteSoftLineForward"},()=>e.deleteAtoms([e.anchor,i])),!0)},deleteToMathFieldStart:e=>e.contentWillChange({inputType:"deleteHardLineBackward"})&&cf(e,[e.anchor,0],"deleteHardLineBackward"),deleteToMathFieldEnd:e=>e.contentWillChange({inputType:"deleteHardLineForward"})&&cf(e,[e.anchor,-1],"deleteHardLineForward")},{target:"model",audioFeedback:"delete",canUndo:!0,changeContent:!0,changeSelection:!0});var ub=`<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox="0 0 576 512" role="img" aria-label="${N("tooltip.toggle virtual keyboard")}"><path d="M528 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h480c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.823-7.177 16-16 16H48c-8.823 0-16-7.177-16-16V112c0-8.823 7.177-16 16-16h480c8.823 0 16 7.177 16 16v288zM168 268v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-336 80v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm384 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zM120 188v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-96 152v-8c0-6.627-5.373-12-12-12H180c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h216c6.627 0 12-5.373 12-12z"/></svg>`,uy=`<svg xmlns="http://www.w3.org/2000/svg" style="height: 18px;" viewBox="0 0 448 512" role="img" aria-label="${N("tooltip.menu")}"><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`,uv=class e{constructor(e,i){var r,a,o,n,l,s;let c,d,u,h,p,m,b;this.focusBlurInProgress=!1,this.programmaticFocusInProgress=!1,this.connectedToVirtualKeyboard=!1,this.options=f(g(f({},ci()),{macros:e_(),registers:f({},oj)}),ce(i)),this.eventController=new AbortController;let y=this.eventController.signal;i.eventSink&&(this.host=i.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","inline-math"===this.options.defaultMode?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline"),this.dirty=!1;let v=null!=(a=null!=(r=i.value)?r:this.element.textContent)?a:"";v=v.trim();let x=cr(this.options),_=lt(v,{context:this.context}),w;w=1===_.length&&_[0].isRoot?_[0]:new oG({type:"root",mode:x,body:_}),this.model=new uh(this,x,w),this.undoManager=new cp(this.model);let k=[];if(k.push("<span contenteditable=true role=textbox aria-autocomplete=none aria-multiline=false part=keyboard-sink class=ML__keyboard-sink autocapitalize=off autocomplete=off autocorrect=off spellcheck=false inputmode=none tabindex=0></span>"),k.push('<span part=container class=ML__container style="visibility:hidden">'),k.push("<span part=content class=ML__content>"),k.push(sz(this)),k.push("</span>"),k.push("<div class=ML__toggles>"),window.mathVirtualKeyboard&&(k.push(`<div part=virtual-keyboard-toggle class=ML__virtual-keyboard-toggle role=button ${this.hasEditableContent?"":'style="display:none;"'} data-l10n-tooltip="tooltip.toggle virtual keyboard">`),k.push(ub),k.push("</div>")),k.push('<div part=menu-toggle class=ML__menu-toggle role=button data-l10n-tooltip="tooltip.menu">'),k.push(uy),k.push("</div>"),k.push("</div>"),k.push("</span>"),k.push("<span class=ML__sr-only>"),k.push("<span role=status aria-live=assertive aria-atomic=true></span>"),k.push("</span>"),this.element.innerHTML=globalThis.MathfieldElement.createHTML(k.join("")),!this.element.children)return void console.error("%cMathLive 0.110.6: 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");this._l10Subscription=R.subscribe(()=>R.update(this.element)),R.update(this.element),this.container=this.element.querySelector("[part=container]"),this.field=this.container.querySelector("[part=content]"),this.field.addEventListener("click",e=>e.stopImmediatePropagation(),{capture:!1,signal:y}),this.field.addEventListener("wheel",this,{passive:!1,signal:y});let M=this.element;if("PointerEvent"in window?M.addEventListener("pointerdown",this,{signal:y}):M.addEventListener("mousedown",this,{signal:y}),this.host){let e=e=>{e.target===this.host&&this.handleEvent(e)};"PointerEvent"in window?this.host.addEventListener("pointerdown",e,{signal:y}):this.host.addEventListener("mousedown",e,{signal:y})}let S=this.element.querySelector("[part=virtual-keyboard-toggle]");null==S||S.addEventListener("pointerdown",e=>{e.currentTarget===S&&(window.mathVirtualKeyboard.visible?window.mathVirtualKeyboard.hide():(window.mathVirtualKeyboard.show({animate:!0}),window.mathVirtualKeyboard.update(cZ(this)),setTimeout(()=>this.scrollIntoView(),300)),e.preventDefault(),e.stopPropagation(),this.hasFocus()||this.focus({preventScroll:!0}))},{signal:y}),this.field.addEventListener("contextmenu",this,{signal:y});let L=this.element.querySelector("[part=menu-toggle]");null==L||L.addEventListener("pointerdown",e=>{if(e.currentTarget!==L)return;let i=this.menu;if("closed"!==i.state)return;this.element.classList.add("tracking");let r=L.getBoundingClientRect();i.modifiers=l0(e),i.show({target:L,location:{x:r.left,y:r.bottom},onDismiss:()=>this.element.classList.remove("tracking")}),e.preventDefault(),e.stopPropagation()},{signal:y}),(this.disabled||this.readOnly&&!this.hasEditableContent||"none"===this.userSelect)&&(L.style.display="none"),this.ariaLiveText=null!=(o=this.element.querySelector("[role=status]"))?o:void 0,this.keyboardDelegate=(n=this.element.querySelector(".ML__keyboard-sink"),l=this.element,s=this,c=null,d=null,u=!1,h=!1,p=!1,b=(m=new AbortController).signal,n.addEventListener("keydown",e=>{if(u||"Process"===e.key||"CapsLock"===e.code||/(Control|Meta|Alt|Shift)(Left|Right)/.test(e.code)){c=null;return}c=e,d=null,s.onKeystroke(e)?n.textContent="":c=null},{capture:!0,signal:b}),n.addEventListener("keypress",e=>{u||(c&&d&&s.onKeystroke(c),d=e)},{capture:!0,signal:b}),n.addEventListener("compositionstart",e=>{n.textContent="",u=!0,s.onCompositionStart(e.data)},{capture:!0,signal:b}),n.addEventListener("compositionupdate",e=>{u&&s.onCompositionUpdate(e.data)},{capture:!0,signal:b}),n.addEventListener("compositionend",e=>{n.textContent="",u&&(u=!1,s.onCompositionEnd(e.data))},{capture:!0,signal:b}),n.addEventListener("beforeinput",e=>e.stopImmediatePropagation(),{signal:b}),n.addEventListener("input",e=>{var i;if(!u&&(n.textContent="","insertCompositionText"!==e.inputType)){if("insertFromPaste"===e.inputType){e.preventDefault(),e.stopPropagation();return}s.onInput(null!=(i=e.data)?i:""),e.preventDefault(),e.stopPropagation()}},{signal:b}),n.addEventListener("paste",e=>{n.focus({preventScroll:!0}),n.textContent="",s.onPaste(e)||e.preventDefault(),e.stopImmediatePropagation()},{signal:b}),n.addEventListener("cut",e=>s.onCut(e),{capture:!0,signal:b}),n.addEventListener("copy",e=>s.onCopy(e),{capture:!0,signal:b}),n.addEventListener("blur",e=>{var i,r;if((null==(r=null==(i=e.relatedTarget)?void 0:i._mathfield)?void 0:r.element)===l){n.focus({preventScroll:!0}),e.preventDefault(),e.stopPropagation();return}let a=!1,o=e.relatedTarget;for(;o;){if(o.classList.contains("ML__keyboard")){a=!0;break}o=o.parentElement}if(a){n.focus({preventScroll:!0}),e.preventDefault(),e.stopPropagation();return}let u=l3.state;if("open"===u||"opening"===u||e.relatedTarget===e.target.getRootNode().host){e.preventDefault(),e.stopPropagation();return}p||h||(p=!0,c=null,d=null,s.onBlur(),p=!1)},{capture:!0,signal:b}),n.addEventListener("focus",e=>{p||h||(h=!0,s.onFocus(),h=!1)},{capture:!0,signal:b}),{dispose:()=>m.abort(),cancelComposition:()=>{u&&("function"==typeof n.blur&&n.blur(),requestAnimationFrame(()=>n.focus({preventScroll:!0})))},blur:()=>{"function"==typeof n.blur&&(p=!0,n.blur(),p=!1)},focus:()=>{h||"function"!=typeof n.focus||(h=!0,n.focus({preventScroll:!0}),h=!1)},hasFocus:()=>l2()===n,setAriaLabel:e=>n.setAttribute("aria-label",e),setValue:e=>{var i;n.textContent!==e&&(n.textContent=e,n.style.left="-1000px",null==(i=window.getSelection())||i.selectAllChildren(n))},moveTo:(e,i)=>{n.style.top=`${i}px`,n.style.left=`${e}px`}}),window.addEventListener("resize",this,{signal:y}),document.addEventListener("scroll",this,{signal:y}),this.resizeObserver=new ResizeObserver(e=>{if(this.resizeObserverStarted){this.resizeObserverStarted=!1;return}this.updateToggleLayout(),sA(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:y}),A&&!R.locale.startsWith(A.locale)&&B(R.locale),"ready"!==sL&&document.fonts.ready.then(()=>sD(this)),e.querySelector("[part=container]").style.removeProperty("visibility"),this.undoManager.startRecording(),this.undoManager.snapshot("set-value"),sA(this)}connectToVirtualKeyboard(){this.connectedToVirtualKeyboard||(this.connectedToVirtualKeyboard=!0,window.addEventListener("message",this,{signal:this.eventController.signal}),window.mathVirtualKeyboard.connect(),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(cZ(this)),c8(this))}disconnectFromVirtualKeyboard(){this.connectedToVirtualKeyboard&&(window.removeEventListener("message",this),window.mathVirtualKeyboard.disconnect(),this.connectedToVirtualKeyboard=!1,c6())}showMenu(e){var i,r;let a=null!=(r=null!=(i=null==e?void 0:e.location)?i:ns(this.field))?r:void 0,o=null==e?void 0:e.modifiers,n=this.element.querySelector("[part=container]");return this._menu.show({target:n,location:a,modifiers:o})}get colorMap(){return e=>{var i,r,a;return null!=(a=null==(r=(i=this.options).colorMap)?void 0:r.call(i,e))?a:U(e)}}get backgroundColorMap(){return e=>{var i,r,a,o,n,l;return null!=(l=null!=(n=null==(r=(i=this.options).backgroundColorMap)?void 0:r.call(i,e))?n:null==(o=(a=this.options).colorMap)?void 0:o.call(a,e))?l:J(e)}}get smartFence(){var e;return null!=(e=this.options.smartFence)&&e}get readOnly(){var e;return null!=(e=this.options.readOnly)&&e}get disabled(){var e,i;return null!=(i=null==(e=this.host)?void 0:e.disabled)&&i}get contentEditable(){return!!this.host&&"false"!==this.host.getAttribute("contenteditable")}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&&(!this.readOnly||this.hasEditablePrompts)}get hasEditablePrompts(){return this.readOnly&&!this.disabled&&this.contentEditable&&void 0!==this.model.findAtom(e=>"prompt"===e.type&&!e.locked)}get isSelectionEditable(){if(this.disabled||!this.contentEditable)return!1;if(!this.readOnly)return!0;let e=this.model.at(this.model.anchor),i=this.model.at(this.model.position),r=oG.commonAncestor(e,i);return!!((null==r?void 0:r.type)==="prompt"||null!=r&&r.parentPrompt)}get letterShapeStyle(){var e;return null!=(e=this.options.letterShapeStyle)?e:"tex"}get minFontScale(){return this.options.minFontScale}get maxMatrixCols(){return this.options.maxMatrixCols}queryStyle(e){let i=si(this,e);"verbatimColor"in i&&delete i.verbatimColor,"verbatimBackgroundColor"in i&&delete i.verbatimBackgroundColor;let r=Object.keys(i).length;if(0===r)return"all";if(r>1){for(let e of Object.keys(i)){let r=this.queryStyle({[e]:i[e]});if("none"===r)return"none";if("some"===r)return"some"}return"all"}let a=Object.keys(i)[0],o=i[a];if(this.model.selectionIsCollapsed)return sa(this)[a]===o?"all":"none";let n=this.model.getAtoms(this.model.selection,{includeChildren:!0}),l=n.length;if(0===l)return"none";let s=0;for(let e of n){if("first"===e.type){l-=1;continue}e.style[a]===o&&(s+=1)}return 0===s?"none":s===l?"all":"some"}get keybindings(){var e,i;if(this._keybindings)return this._keybindings;let[r,a]=function(e,i){let r=[],a=[];for(let o of e)try{let e=function(e,i){if(e.ifPlatform&&!/^!?(macos|windows|android|ios|chromeos|other)$/.test(e.ifPlatform))throw Error(`Unexpected platform "${e.ifPlatform}" for keybinding ${e.key}`);if(void 0!==e.ifLayout&&(0===i.score||!e.ifLayout.includes(i.id)))return;let r=C(e.key),a=e.ifPlatform;if(r.cmd){if(a&&"macos"!==a&&"ios"!==a)throw Error('Unexpected "cmd" modifier with platform "'+a+`"
3488
+ import "https://esm.run/@cortex-js/compute-engine"`),'["Error", "compute-engine-not-available"]';let e=this.getValue({ranges:a},"latex-unstyled");try{let i=globalThis.MathfieldElement.computeEngine.parse(e);return JSON.stringify(i.json)}catch(e){return JSON.stringify(["Error",`'${e.toString()}'`])}}if(o.startsWith("latex")){let e={expandMacro:"latex-expanded"===o,skipStyles:"latex-unstyled"===o,skipPlaceholders:"latex-without-placeholders"===o,defaultMode:this.mathfield.options.defaultMode};return of(a.map(i=>oG.serialize(this.getAtoms(i),e)))}return a.map(e=>this.getAtoms(e).map(e=>this.atomToString(e,o)).join("")).join("")}extendSelectionTo(e,i){return(!!this.mathfield.contentEditable||"none"!==this.mathfield.userSelect)&&this.deferNotifications({selection:!0},()=>{let[r,a]=this.normalizeRange([e,i]),o=new Set(["genfrac","subsup","accent","box","overlap","overunder"]),{parent:n}=this.at(a);if(null!=n&&n.type&&o.has(n.type))for(;null!=n&&n.type&&o.has(n.type)&&uv(this,n,[r,a]);)a=this.offsetOf(n),n=n.parent;for(n=this.at(r).parent;null!=n&&n.type&&o.has(n.type)&&uv(this,n,[r,a]);)r=this.offsetOf(n.leftSibling),n=n.parent;if(null!=(n=this.at(a).parent)&&n.type&&o.has(n.type))for(;null!=n&&n.type&&o.has(n.type)&&uv(this,n,[r,a]);)a=this.offsetOf(n),n=n.parent;this._position=this.normalizeOffset(i),this._selection={ranges:[[r,a]],direction:"none"}})}announce(e,i,r=[]){var a,o;(null==(o=null==(a=this.mathfield.host)?void 0:a.dispatchEvent(new CustomEvent("announce",{detail:{command:e,previousPosition:i,atoms:r},cancelable:!0,bubbles:!0,composed:!0})))||o)&&function(e,i,r,a){let o="";if("plonk"===i){globalThis.MathfieldElement.playSound("plonk"),e.flushInlineShortcutBuffer();return}if("delete"===i)o=uf("deleted: ",a);else if("focus"===i||i.includes("move"))o=function(e,i){if(Number.isNaN(i))return"";let r=e.at(i);if(!r||r.treeDepth<=e.at(e.position).treeDepth)return"";let a="",o=r.parent,n=e.at(e.position).parent;for(;o!==e.root&&o!==n;)a+=`out of ${ug(o)};`,o=o.parent;return a}(e.model,r)+function(e){if(!e.selectionIsCollapsed)return`selected: ${uf(e.getAtoms(e.selection))}`;let i="",r=e.at(e.position);if(r.isFirstSibling&&(i=`start of ${ug(r)}: `),r.isLastSibling){if(!r.isFirstSibling){if(!r.parent.parent)return`${uf(r)}; end of mathfield`;i=`${uf(r)}; end of ${ug(r)}`}}else i+=uf(r);return i}(e.model);else if("replacement"===i)o=uf(e.model.at(e.model.position));else if("line"===i){let i=uf(e.model.root);e.keyboardDelegate.setAriaLabel(i)}else o=a?uf(i+" ",a):i;if(o&&e.ariaLiveText){let i=e.ariaLiveText.textContent.includes(" ")?"   ":"   ";e.ariaLiveText.textContent=o+i}}(this.mathfield,e,i,r)}deferNotifications(e,i){let r=this._selection,a=this._anchor,o=this._position,n=this.silenceNotifications;this.silenceNotifications=!0;let l=this.root.changeCounter;i(),this.silenceNotifications=n;let s=a!==this._anchor||o!==this._position||"different"===function(e,i){if(e.direction===i.direction){let o=e.ranges.length;if(i.ranges.length===o){var r,a;let n=0;for(;n<o&&"equal"==(r=e.ranges[n],a=i.ranges[n],r[0]===a[0]&&r[1]===a[1]?"equal":"different");)n++;return n===o?"equal":"different"}}return"different"}(this._selection,r);e.selection&&s&&this.selectionDidChange();let c=this.root.changeCounter!==l;return e.content&&c&&this.contentDidChange({inputType:e.type}),c||s}normalizeOffset(e){return e>0?e=Math.min(e,this.lastOffset):e<0&&(e=this.lastOffset+e+1),e}normalizeRange(e){let[i,r]=e;return(i=this.normalizeOffset(i))<(r=this.normalizeOffset(r))?[i,r]:[r,i]}normalizeSelection(e,i){var r;let a;if(o0(e)){let r=this.normalizeOffset(e);if(o0(i)){let e=this.normalizeOffset(i);a=r<=e?{ranges:[[r,e]],direction:"none"}:{ranges:[[e,r]],direction:"backward"}}else a={ranges:[[r,r]],direction:"none"}}else if(o1(e)){let i=this.normalizeOffset(e[0]),r=this.normalizeOffset(e[1]);a=i<=r?{ranges:[[i,r]],direction:"none"}:{ranges:[[r,i]],direction:"backward"}}else o4(e)&&(a={ranges:e.ranges.map(e=>this.normalizeRange(e)),direction:null!=(r=e.direction)?r:"none"});return a}get parentEnvironment(){let e=this.at(this.position).parent;if(e){for(;e.parent&&"array"!==e.type;)e=e.parent;if("array"===e.type)return e}}get parentCell(){return this.getParentCell(this.position)}getParentCell(e){var i,r;let a=this.at(e);if(a){for(;a&&(null==(i=a.parent)?void 0:i.type)!=="array";)a=a.parent;if((null==(r=null==a?void 0:a.parent)?void 0:r.type)==="array")return a.parentBranch}}contentWillChange(e={}){if(this.silenceNotifications||!this.mathfield)return!0;let i=this.silenceNotifications;this.silenceNotifications=!0;let r=this.mathfield.onContentWillChange(e);return this.silenceNotifications=i,r}contentDidChange(e){var i;if(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(c4(this.mathfield)),this.silenceNotifications||!(null!=(i=this.mathfield)&&i.host))return;let r=this.silenceNotifications;this.silenceNotifications=!0,setTimeout(()=>{var i;this.mathfield&&nl(this.mathfield)&&this.mathfield.host&&this.mathfield.host.dispatchEvent(new InputEvent("input",g(f({},e),{data:e.data?e.data:null!=(i=e.inputType)?i:"",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 uy(e,i,r,a,o){let n=e.offsetOf(i);if(n<r||n>a)return!1;if(!i.hasChildren)return!0;let l=o?i.firstChild:ux(i);if(!l)return!0;let s=o?i.lastChild:u_(i);if(!s)return!0;let c=e.offsetOf(l);if(c>=r&&c<=a){let i=e.offsetOf(s);if(i>=r&&i<=a)return!0}return!1}function uv(e,i,r){if(!(null!=i&&i.hasChildren))return!1;let[a,o]=r,n=ux(i);if(!n)return!1;let l=u_(i);if(!l)return!1;let s=e.offsetOf(n),c=e.offsetOf(l);return s>=a&&s<=o&&c>=s&&c<=o}function ux(e){for(let i of e.children)if("first"!==i.type)return i}function u_(e){let{children:i}=e;for(let e=i.length-1;e>=0;e--)if("first"!==i[e].type)return i[e]}sN({deleteAll:e=>e.contentWillChange({inputType:"deleteContent"})&&cx(e,[0,-1],"deleteContent"),deleteForward:e=>!!e.mathfield.isSelectionEditable&&!!e.contentWillChange({inputType:"deleteContentForward"})&&(e.selectionIsCollapsed?e.deferNotifications({content:!0,selection:!0,type:"deleteContentForward"},()=>{var i,r,a;let o=e.at(e.position).rightSibling;if(o&&cv(e,"forward",o))return;if(o){if(e.at(e.position).isLastSibling&&cv(e,"forward",o.parent,o.parentBranch))return}else{if((o=e.at(e.position)).isLastSibling&&cv(e,"forward",o.parent,o.parentBranch))return;o=void 0}if(e.position===e.lastOffset||!o)return void e.announce("plonk");let n=o.parent;n.removeChild(o);let l=null==(i=e.at(e.position))?void 0:i.rightSibling;for(;(null==l?void 0:l.type)==="subsup";)l.parent.removeChild(l),l=null==(r=e.at(e.position))?void 0:r.rightSibling;if(e.announce("delete",void 0,[o]),"latexgroup"===n.type&&n.hasEmptyBranch("body")){let i=e.offsetOf(n.leftSibling);null==(a=n.parent)||a.removeChild(n),e.position=Math.max(0,i)}e.root.hasEmptyBranch("body")&&e.mathfield.flushInlineShortcutBuffer()}):cx(e,oQ(e.selection),"deleteContentForward")),deleteBackward:e=>!!e.mathfield.isSelectionEditable&&!!e.contentWillChange({inputType:"deleteContentBackward"})&&(e.selectionIsCollapsed?e.deferNotifications({content:!0,selection:!0,type:"deleteContentBackward"},()=>{var i;let r=e.at(e.position);if(r&&cv(e,"backward",r))return;if(null!=r&&r.isFirstSibling){if(cv(e,"backward",r.parent,r.parentBranch))return;r=null}if(!r)return void e.announce("plonk");let a=r.parent;if(e.position=e.offsetOf(r.leftSibling),a.removeChild(r),e.announce("delete",void 0,[r]),"latexgroup"===a.type&&a.hasEmptyBranch("body")){let r=e.offsetOf(a.leftSibling);null==(i=a.parent)||i.removeChild(a),e.position=Math.max(0,r)}e.root.hasEmptyBranch("body")&&e.mathfield.flushInlineShortcutBuffer()}):cx(e,oQ(e.selection),"deleteContentBackward")),deleteNextWord:e=>e.contentWillChange({inputType:"deleteWordForward"})&&c_(e,"forward",{delete:!0}),deletePreviousWord:e=>e.contentWillChange({inputType:"deleteWordBackward"})&&c_(e,"backward",{delete:!0}),deleteToGroupStart:e=>{if(!e.contentWillChange({inputType:"deleteSoftLineBackward"}))return!1;let i=e.offsetOf(e.at(e.position).firstSibling);return i===e.position?(e.announce("plonk"),!1):(e.deferNotifications({content:!0,selection:!0,type:"deleteSoftLineBackward"},()=>e.deleteAtoms([e.anchor,i])),e.position=i,!0)},deleteToGroupEnd:e=>{if(!e.contentWillChange({inputType:"deleteSoftLineForward"}))return!1;let i=e.offsetOf(e.at(e.position).lastSibling);return i===e.position?(e.announce("plonk"),!1):(e.deferNotifications({content:!0,selection:!0,type:"deleteSoftLineForward"},()=>e.deleteAtoms([e.anchor,i])),!0)},deleteToMathFieldStart:e=>e.contentWillChange({inputType:"deleteHardLineBackward"})&&cx(e,[e.anchor,0],"deleteHardLineBackward"),deleteToMathFieldEnd:e=>e.contentWillChange({inputType:"deleteHardLineForward"})&&cx(e,[e.anchor,-1],"deleteHardLineForward")},{target:"model",audioFeedback:"delete",canUndo:!0,changeContent:!0,changeSelection:!0});var uw=`<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox="0 0 576 512" role="img" aria-label="${N("tooltip.toggle virtual keyboard")}"><path d="M528 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h480c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.823-7.177 16-16 16H48c-8.823 0-16-7.177-16-16V112c0-8.823 7.177-16 16-16h480c8.823 0 16 7.177 16 16v288zM168 268v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-336 80v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm384 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zM120 188v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-96 152v-8c0-6.627-5.373-12-12-12H180c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h216c6.627 0 12-5.373 12-12z"/></svg>`,uk=`<svg xmlns="http://www.w3.org/2000/svg" style="height: 18px;" viewBox="0 0 448 512" role="img" aria-label="${N("tooltip.menu")}"><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`,uM=class e{constructor(e,i){var r,a,o,n,l,s;let c,d,u,h,p,m,b;this.focusBlurInProgress=!1,this.programmaticFocusInProgress=!1,this.connectedToVirtualKeyboard=!1,this.options=f(g(f({},cl()),{macros:e_(),registers:f({},oj)}),co(i)),this.eventController=new AbortController;let y=this.eventController.signal;i.eventSink&&(this.host=i.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","inline-math"===this.options.defaultMode?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline"),this.dirty=!1;let v=null!=(a=null!=(r=i.value)?r:this.element.textContent)?a:"";v=v.trim();let x=cs(this.options),_=ll(v,{context:this.context}),w;w=1===_.length&&_[0].isRoot?_[0]:new oG({type:"root",mode:x,body:_}),this.model=new ub(this,x,w),this.undoManager=new cy(this.model);let k=[];if(k.push("<span contenteditable=true role=textbox aria-autocomplete=none aria-multiline=false part=keyboard-sink class=ML__keyboard-sink autocapitalize=off autocomplete=off autocorrect=off spellcheck=false inputmode=none tabindex=0></span>"),k.push('<span part=container class=ML__container style="visibility:hidden">'),k.push("<span part=content class=ML__content>"),k.push(s$(this)),k.push("</span>"),k.push("<div class=ML__toggles>"),window.mathVirtualKeyboard&&(k.push(`<div part=virtual-keyboard-toggle class=ML__virtual-keyboard-toggle role=button ${this.hasEditableContent?"":'style="display:none;"'} data-l10n-tooltip="tooltip.toggle virtual keyboard">`),k.push(uw),k.push("</div>")),k.push('<div part=menu-toggle class=ML__menu-toggle role=button data-l10n-tooltip="tooltip.menu">'),k.push(uk),k.push("</div>"),k.push("</div>"),k.push("</span>"),k.push("<span class=ML__sr-only>"),k.push("<span role=status aria-live=assertive aria-atomic=true></span>"),k.push("</span>"),this.element.innerHTML=globalThis.MathfieldElement.createHTML(k.join("")),!this.element.children)return void console.error("%cMathLive 0.110.8: 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");this._l10Subscription=I.subscribe(()=>I.update(this.element)),I.update(this.element),this.container=this.element.querySelector("[part=container]"),this.field=this.container.querySelector("[part=content]"),this.field.addEventListener("click",e=>e.stopImmediatePropagation(),{capture:!1,signal:y}),this.field.addEventListener("wheel",this,{passive:!1,signal:y});let M=this.element;if("PointerEvent"in window?M.addEventListener("pointerdown",this,{signal:y}):M.addEventListener("mousedown",this,{signal:y}),this.host){let e=e=>{e.target===this.host&&this.handleEvent(e)};"PointerEvent"in window?this.host.addEventListener("pointerdown",e,{signal:y}):this.host.addEventListener("mousedown",e,{signal:y})}let S=this.element.querySelector("[part=virtual-keyboard-toggle]");null==S||S.addEventListener("pointerdown",e=>{e.currentTarget===S&&(window.mathVirtualKeyboard.visible?window.mathVirtualKeyboard.hide():(window.mathVirtualKeyboard.show({animate:!0}),window.mathVirtualKeyboard.update(c4(this)),setTimeout(()=>this.scrollIntoView(),300)),e.preventDefault(),e.stopPropagation(),this.hasFocus()||this.focus({preventScroll:!0}))},{signal:y}),this.field.addEventListener("contextmenu",this,{signal:y});let L=this.element.querySelector("[part=menu-toggle]");null==L||L.addEventListener("pointerdown",e=>{if(e.currentTarget!==L)return;let i=this.menu;if("closed"!==i.state)return;this.element.classList.add("tracking");let r=L.getBoundingClientRect();i.modifiers=l8(e),i.show({target:L,location:{x:r.left,y:r.bottom},onDismiss:()=>this.element.classList.remove("tracking")}),e.preventDefault(),e.stopPropagation()},{signal:y}),(this.disabled||this.readOnly&&!this.hasEditableContent||"none"===this.userSelect)&&(L.style.display="none"),this.ariaLiveText=null!=(o=this.element.querySelector("[role=status]"))?o:void 0,this.keyboardDelegate=(n=this.element.querySelector(".ML__keyboard-sink"),l=this.element,s=this,c=null,d=null,u=!1,h=!1,p=!1,b=(m=new AbortController).signal,n.addEventListener("keydown",e=>{if(u||"Process"===e.key||"CapsLock"===e.code||/(Control|Meta|Alt|Shift)(Left|Right)/.test(e.code)){c=null;return}c=e,d=null,s.onKeystroke(e)?n.textContent="":c=null},{capture:!0,signal:b}),n.addEventListener("keypress",e=>{u||(c&&d&&s.onKeystroke(c),d=e)},{capture:!0,signal:b}),n.addEventListener("compositionstart",e=>{n.textContent="",u=!0,s.onCompositionStart(e.data)},{capture:!0,signal:b}),n.addEventListener("compositionupdate",e=>{u&&s.onCompositionUpdate(e.data)},{capture:!0,signal:b}),n.addEventListener("compositionend",e=>{n.textContent="",u&&(u=!1,s.onCompositionEnd(e.data))},{capture:!0,signal:b}),n.addEventListener("beforeinput",e=>e.stopImmediatePropagation(),{signal:b}),n.addEventListener("input",e=>{var i;if(!u&&(n.textContent="","insertCompositionText"!==e.inputType)){if("insertFromPaste"===e.inputType){e.preventDefault(),e.stopPropagation();return}s.onInput(null!=(i=e.data)?i:""),e.preventDefault(),e.stopPropagation()}},{signal:b}),n.addEventListener("paste",e=>{n.focus({preventScroll:!0}),n.textContent="",s.onPaste(e)||e.preventDefault(),e.stopImmediatePropagation()},{signal:b}),n.addEventListener("cut",e=>s.onCut(e),{capture:!0,signal:b}),n.addEventListener("copy",e=>s.onCopy(e),{capture:!0,signal:b}),n.addEventListener("blur",e=>{var i,r;if((null==(r=null==(i=e.relatedTarget)?void 0:i._mathfield)?void 0:r.element)===l){n.focus({preventScroll:!0}),e.preventDefault(),e.stopPropagation();return}let a=!1,o=e.relatedTarget;for(;o;){if(o.classList.contains("ML__keyboard")){a=!0;break}o=o.parentElement}if(a){n.focus({preventScroll:!0}),e.preventDefault(),e.stopPropagation();return}let u=se.state;if("open"===u||"opening"===u||e.relatedTarget===e.target.getRootNode().host){e.preventDefault(),e.stopPropagation();return}p||h||(p=!0,c=null,d=null,s.onBlur(),p=!1)},{capture:!0,signal:b}),n.addEventListener("focus",e=>{p||h||(h=!0,s.onFocus(),h=!1)},{capture:!0,signal:b}),{dispose:()=>m.abort(),cancelComposition:()=>{u&&("function"==typeof n.blur&&n.blur(),requestAnimationFrame(()=>n.focus({preventScroll:!0})))},blur:()=>{"function"==typeof n.blur&&(p=!0,n.blur(),p=!1)},focus:()=>{h||"function"!=typeof n.focus||(h=!0,n.focus({preventScroll:!0}),h=!1)},hasFocus:()=>l9()===n,setAriaLabel:e=>n.setAttribute("aria-label",e),setValue:e=>{var i;n.textContent!==e&&(n.textContent=e,n.style.left="-1000px",null==(i=window.getSelection())||i.selectAllChildren(n))},moveTo:(e,i)=>{n.style.top=`${i}px`,n.style.left=`${e}px`}}),window.addEventListener("resize",this,{signal:y}),document.addEventListener("scroll",this,{signal:y}),this.resizeObserver=new ResizeObserver(e=>{if(this.resizeObserverStarted){this.resizeObserverStarted=!1;return}this.updateToggleLayout(),sB(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:y}),A&&!I.locale.startsWith(A.locale)&&B(I.locale),"ready"!==sT&&document.fonts.ready.then(()=>sO(this)),e.querySelector("[part=container]").style.removeProperty("visibility"),this.undoManager.startRecording(),this.undoManager.snapshot("set-value"),sB(this)}connectToVirtualKeyboard(){this.connectedToVirtualKeyboard||(this.connectedToVirtualKeyboard=!0,window.addEventListener("message",this,{signal:this.eventController.signal}),window.mathVirtualKeyboard.connect(),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(c4(this)),dt(this))}disconnectFromVirtualKeyboard(){this.connectedToVirtualKeyboard&&(window.removeEventListener("message",this),window.mathVirtualKeyboard.disconnect(),this.connectedToVirtualKeyboard=!1,de())}showMenu(e){var i,r;let a=null!=(r=null!=(i=null==e?void 0:e.location)?i:ns(this.field))?r:void 0,o=null==e?void 0:e.modifiers,n=this.element.querySelector("[part=container]");return this._menu.show({target:n,location:a,modifiers:o})}get colorMap(){return e=>{var i,r,a;return null!=(a=null==(r=(i=this.options).colorMap)?void 0:r.call(i,e))?a:U(e)}}get backgroundColorMap(){return e=>{var i,r,a,o,n,l;return null!=(l=null!=(n=null==(r=(i=this.options).backgroundColorMap)?void 0:r.call(i,e))?n:null==(o=(a=this.options).colorMap)?void 0:o.call(a,e))?l:J(e)}}get smartFence(){var e;return null!=(e=this.options.smartFence)&&e}get readOnly(){var e;return null!=(e=this.options.readOnly)&&e}get disabled(){var e,i;return null!=(i=null==(e=this.host)?void 0:e.disabled)&&i}get contentEditable(){return!!this.host&&"false"!==this.host.getAttribute("contenteditable")}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&&(!this.readOnly||this.hasEditablePrompts)}get hasEditablePrompts(){return this.readOnly&&!this.disabled&&this.contentEditable&&void 0!==this.model.findAtom(e=>"prompt"===e.type&&!e.locked)}get isSelectionEditable(){if(this.disabled||!this.contentEditable)return!1;if(!this.readOnly)return!0;let e=this.model.at(this.model.anchor),i=this.model.at(this.model.position),r=oG.commonAncestor(e,i);return!!((null==r?void 0:r.type)==="prompt"||null!=r&&r.parentPrompt)}get letterShapeStyle(){var e;return null!=(e=this.options.letterShapeStyle)?e:"tex"}get minFontScale(){return this.options.minFontScale}get maxMatrixCols(){return this.options.maxMatrixCols}queryStyle(e){let i=ss(this,e);"verbatimColor"in i&&delete i.verbatimColor,"verbatimBackgroundColor"in i&&delete i.verbatimBackgroundColor;let r=Object.keys(i).length;if(0===r)return"all";if(r>1){for(let e of Object.keys(i)){let r=this.queryStyle({[e]:i[e]});if("none"===r)return"none";if("some"===r)return"some"}return"all"}let a=Object.keys(i)[0],o=i[a];if(this.model.selectionIsCollapsed)return sd(this)[a]===o?"all":"none";let n=this.model.getAtoms(this.model.selection,{includeChildren:!0}),l=n.length;if(0===l)return"none";let s=0;for(let e of n){if("first"===e.type){l-=1;continue}e.style[a]===o&&(s+=1)}return 0===s?"none":s===l?"all":"some"}get keybindings(){var e,i;if(this._keybindings)return this._keybindings;let[r,a]=function(e,i){let r=[],a=[];for(let o of e)try{let e=function(e,i){if(e.ifPlatform&&!/^!?(macos|windows|android|ios|chromeos|other)$/.test(e.ifPlatform))throw Error(`Unexpected platform "${e.ifPlatform}" for keybinding ${e.key}`);if(void 0!==e.ifLayout&&(0===i.score||!e.ifLayout.includes(i.id)))return;let r=C(e.key),a=e.ifPlatform;if(r.cmd){if(a&&"macos"!==a&&"ios"!==a)throw Error('Unexpected "cmd" modifier with platform "'+a+`"
3463
3489
  "cmd" modifier can only be used with macOS or iOS platform.`);a||(a="ios"===w()?"ios":"macos"),r.win=!1,r.cmd=!1,r.meta=!0}if(r.win){if(a&&"windows"!==a)throw Error('Unexpected "win" modifier with platform "'+a+`"
3464
- "win" modifier can only be used with Windows platform.`);a="windows",r.win=!1,r.cmd=!1,r.meta=!0}if(a&&!function(e){if(v()){let i=w(),r=e.startsWith("!"),a=e.endsWith(i);if(r&&!a||!r&&a)return!0}return"!other"!==e&&"other"===e}(a))return;if(/^\[.+\]$/.test(r.key))return g(f({},e),{key:E(r)});let o=function(e,i){var r;let a={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:""};if(!e)return a;for(let[r,o]of Object.entries(i.mapping)){if(o[0]===e)return a.key=`[${r}]`,a;if(o[1]===e)return a.shift=!0,a.key=`[${r}]`,a;if(o[2]===e)return a.alt=!0,a.key=`[${r}]`,a;if(o[3]===e)return a.shift=!0,a.alt=!0,a.key=`[${r}]`,a}return a.key=null!=(r=z[e])?r:"",a}(r.key,i);if(!o)return g(f({},e),{key:E(r)});if(o.shift&&r.shift||o.alt&&r.alt)throw Error(`The keybinding ${e.key} (${l7(e.command)}) is conflicting with the key combination ${E(o)} using the ${i.displayName} keyboard layout`);return o.shift=o.shift||r.shift,o.alt=o.alt||r.alt,o.meta=r.meta,o.ctrl=r.ctrl,g(f({},e),{key:E(o)})}(o,i);if(!e)continue;let r=a.find(i=>i.key===e.key&&i.ifMode===e.ifMode);if(r)throw Error(`Ambiguous key binding ${o.key} (${l7(o.command)}) matches ${r.key} (${l7(r.command)}) with the ${i.displayName} keyboard layout`);a.push(e)}catch(e){e instanceof Error&&r.push(e.message)}return[a,r]}(this.options.keybindings,null!=(e=$())?e:function(){switch(D()){case"apple":break;case"windows":return S;case"linux":return L}return M}());return(null==(i=$())?void 0:i.score)>0&&(this._keybindings=r,a.length>0&&console.error("MathLive 0.110.6: Invalid keybindings for current keyboard layout",a)),r}get menu(){var e,i;return null!=this._menu||(this._menu=new dp((e=this,[{label:()=>N("menu.array.add row above"),id:"add-row-above",onMenuSelect:()=>e.executeCommand("addRowBefore"),keyboardShortcut:"shift+alt+[Return]",visible:()=>{if(!e.isSelectionEditable||!d6(e))return!1;let[i,r]=d5(e),[a,o]=d7(e);return i!==a}},{label:()=>N("menu.array.add row below"),id:"add-row-below",onMenuSelect:()=>e.executeCommand("addRowAfter"),keyboardShortcut:"alt+[Return]",visible:()=>{if(!e.isSelectionEditable||!d6(e))return!1;let[i,r]=d5(e),[a,o]=d7(e);return i!==a}},{label:()=>N("menu.array.add column before"),id:"add-column-before",onMenuSelect:()=>e.executeCommand("addColumnBefore"),visible:()=>{if(!e.isSelectionEditable||!d6(e))return!1;let[i,r]=d5(e),[a,o]=d7(e);return r!==o},keyboardShortcut:"shift+alt+[Tab]",enabled:()=>{let i=e.model.parentEnvironment;if(!i)return!1;let[r,a]=d8(e);return r<i.maxColumns}},{label:()=>N("menu.array.add column after"),id:"add-column-after",onMenuSelect:()=>e.executeCommand("addColumnAfter"),keyboardShortcut:"alt+[Tab]",visible:()=>{if(!e.isSelectionEditable||!d6(e))return!1;let[i,r]=d5(e),[a,o]=d7(e);return r!==o}},{type:"divider"},{label:()=>N("menu.array.delete row"),id:"delete-row",onMenuSelect:()=>e.executeCommand("removeRow"),enabled:()=>{let[i,r]=d5(e),[a,o]=d8(e);return a>i},visible:()=>{if(!e.isSelectionEditable||!d6(e))return!1;let[i,r]=d5(e),[a,o]=d7(e);return i!==a}},{label:()=>N("menu.array.delete column"),id:"delete-column",onMenuSelect:()=>e.executeCommand("removeColumn"),enabled:()=>{let[i,r]=d5(e),[a,o]=d8(e);return o>r},visible:()=>{if(!e.isSelectionEditable||!d6(e))return!1;let[i,r]=d5(e),[a,o]=d7(e);return r!==o}},{type:"divider"},{label:()=>N("menu.borders"),visible:()=>{var i;let r;return("array"===(r=(i=e).model.at(i.model.position)).type&&["matrix","pmatrix","bmatrix","vmatrix","Bmatrix"].includes(r.environmentName)||d6(e))&&e.isSelectionEditable},submenu:[{label:" ⋱ ",id:"environment-no-border",onMenuSelect:()=>d9(e,"matrix")},{label:"(⋱)",id:"environment-parentheses",onMenuSelect:()=>d9(e,"pmatrix")},{label:"[⋱]",id:"environment-brackets",onMenuSelect:()=>d9(e,"bmatrix")},{label:"|⋱|",id:"environment-bar",onMenuSelect:()=>d9(e,"vmatrix")},{label:"{⋱}",id:"environment-braces",onMenuSelect:()=>d9(e,"Bmatrix")}],submenuClass:"border-submenu"},{type:"divider"},{label:()=>N("menu.insert matrix"),id:"insert-matrix",visible:()=>e.isSelectionEditable,submenu:function(e){let i=[];for(let r=1;r<=5;r++)for(let a=1;a<=5;a++)i.push({id:`insert-matrix-${r}x${a}`,onCreate:(e,i)=>new d3(e,i,r,a),label:"☐",tooltip:()=>N("tooltip.row-by-col",r,a),data:{row:r,col:a},onMenuSelect:()=>{e.insert(`\\begin{pmatrix}${Array(r).fill(Array(a).fill("#?").join(" & ")).join("\\\\")}\\end{pmatrix}`,{selectionMode:"item"})}});return i}(e),submenuClass:"insert-matrix-submenu",columnCount:5},{type:"divider"},{label:()=>N("menu.insert"),id:"insert",submenu:(i=e,[{label:()=>ui("abs"),id:"insert-abs",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("|#?|")},{label:()=>ui("nth-root"),id:"insert-nth-root",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\sqrt[#?]{#?}")},{label:()=>ui("log-base"),id:"insert-log-base",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\log_{#?}{#?}")},{type:"heading",label:()=>N("menu.insert.heading-calculus")},{label:()=>ui("derivative"),id:"insert-derivative",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\dfrac{\\mathrm{d}}{\\mathrm{d}x}#?\\bigm|_{x=#?}")},{label:()=>ui("nth-derivative"),id:"insert-nth-derivative",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\dfrac{\\mathrm{d}^#?}{\\mathrm{d}x^#?}#?\\bigm|_{x=#?}")},{label:()=>ui("integral"),id:"insert-integral",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\int_#?^#?#?\\,\\mathrm{d}#?")},{label:()=>ui("sum"),id:"insert-sum",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\sum_#?^#?#?")},{label:()=>ui("product"),id:"insert-product",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\prod_#?^#?#?")},{type:"heading",label:()=>N("menu.insert.heading-complex-numbers")},{label:()=>ui("modulus"),id:"insert-modulus",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\lvert#?\\rvert")},{label:()=>ui("argument"),id:"insert-argument",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\arg(#?)")},{label:()=>ui("real-part"),id:"insert-real-part",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\Re(#?)")},{label:()=>ui("imaginary-part"),id:"insert-imaginary-part",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\Im(#?)")},{label:()=>ui("conjugate"),id:"insert-conjugate",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\overline{#?}")}])},{type:"divider"},{label:()=>N("menu.mode"),id:"mode",visible:()=>e.isSelectionEditable&&e.model.selectionIsCollapsed,submenu:[{label:()=>N("menu.mode-math"),id:"mode-math",onMenuSelect:()=>{sc(e,"accept-all"),e.executeCommand(["switchMode","math"])},checked:()=>"math"===e.model.mode},{label:()=>N("menu.mode-text"),id:"mode-text",onMenuSelect:()=>{sc(e,"accept-all"),e.executeCommand(["switchMode","text"])},checked:()=>"text"===e.model.mode},{label:()=>N("menu.mode-latex"),id:"mode-latex",onMenuSelect:()=>e.executeCommand(["switchMode","latex"]),checked:()=>"latex"===e.model.mode}]},{type:"divider"},{label:()=>N("menu.font-style"),id:"variant",visible:()=>e.isSelectionEditable,submenu:[ue(e,"double-struck","mathbb","tooltip.blackboard"),ue(e,"fraktur","mathfrak","tooltip.fraktur"),ue(e,"calligraphic","mathcal","tooltip.caligraphic"),ut(e,"up","mathrm","tooltip.roman-upright"),ut(e,"bold","bm","tooltip.bold"),ut(e,"italic","mathit","tooltip.italic")],submenuClass:"variant-submenu"},{label:()=>N("menu.color"),id:"color",visible:()=>e.isSelectionEditable,submenu:function(e){let i=[];for(let r of Object.keys(j))i.push({id:`color-${r}`,class:("#000"===d1(j[r])?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${j[r]} "></span>`,ariaLabel:()=>{var e;return null!=(e=N(r))?e:r},checked:()=>{var i;return null!=(i=({some:"mixed",all:!0})[e.queryStyle({color:r})])&&i},onMenuSelect:()=>e.applyStyle({color:r},{operation:"toggle"})});return i}(e),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>N("menu.background-color"),id:"background-color",visible:()=>e.isSelectionEditable,submenu:function(e){let i=[];for(let r of Object.keys(V))i.push({id:`background-color-${r}`,class:("#000"===function(e){let i=dU(e),r=(0x1000000+(dJ(i.r)<<16)+(dJ(i.g)<<8)+dJ(i.b)).toString(16).slice(1);return void 0!==i.alpha&&i.alpha<1&&(r+=("00"+Math.round(255*i.alpha).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]+(void 0!==i.alpha&&i.alpha<1?r[6]:"")),"#"+r}(d1(V[r]))?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${V[r]} "></span>`,ariaLabel:()=>{var e;return null!=(e=N(r))?e:r},checked:()=>{var i;return null!=(i=({some:"mixed",all:!0})[e.queryStyle({backgroundColor:r})])&&i},onMenuSelect:()=>e.applyStyle({backgroundColor:r},{operation:"toggle"})});return i}(e),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>N("menu.accent"),id:"accent",visible:()=>e.isSelectionEditable,submenu:[{id:"accent-vec",class:"ML__center-menu",label:()=>dN(`\\vec{${d4(e)}}`),visible:()=>1===d4(e).length,onMenuSelect:()=>e.insert("\\vec{#@}",{selectionMode:"item"})},{id:"accent-overrightarrow",class:"ML__center-menu",label:()=>dN(`\\overrightarrow{${d4(e)}}`),visible:()=>d4(e).length>0,onMenuSelect:()=>e.insert("\\overrightarrow{#@}",{selectionMode:"item"})},{id:"accent-overleftarrow",class:"ML__center-menu",label:()=>dN(`\\overleftarrow{${d4(e)}}`),visible:()=>d4(e).length>0,onMenuSelect:()=>e.insert("\\overleftarrow{#@}",{selectionMode:"item"})},{id:"accent-dot",class:"ML__center-menu",label:()=>dN(`\\dot{${d4(e)}}`),visible:()=>1===d4(e).length,onMenuSelect:()=>e.insert("\\dot{#@}",{selectionMode:"item"})},{id:"accent-ddot",class:"ML__center-menu",label:()=>dN(`\\ddot{${d4(e)}}`),visible:()=>1===d4(e).length,onMenuSelect:()=>e.insert("\\ddot{#@}",{selectionMode:"item"})},{id:"accent-bar",class:"ML__center-menu",label:()=>dN(`\\bar{${d4(e)}}`),visible:()=>1===d4(e).length,onMenuSelect:()=>e.insert("\\bar{#@}",{selectionMode:"item"})},{id:"accent-overline",class:"ML__center-menu",label:()=>dN(`\\overline{${d4(e)}}`),visible:()=>d4(e).length>0,onMenuSelect:()=>e.insert("\\overline{#@}",{selectionMode:"item"})},{id:"accent-overgroup",class:"ML__center-menu",label:()=>dN(`\\overgroup{${d4(e)}}`),visible:()=>d4(e).length>0,onMenuSelect:()=>e.insert("\\overgroup{#@}",{selectionMode:"item"})},{id:"accent-overbrace",class:"ML__center-menu",label:()=>dN(`\\overbrace{${d4(e)}}`),visible:()=>d4(e).length>0,onMenuSelect:()=>e.insert("\\overbrace{#@}",{selectionMode:"item"})},{id:"accent-underline",class:"ML__center-menu",label:()=>dN(`\\underline{${d4(e)}}`),visible:()=>d4(e).length>0,onMenuSelect:()=>e.insert("\\underline{#@}",{selectionMode:"item"})},{id:"accent-undergroup",class:"ML__center-menu",label:()=>dN(`\\undergroup{${d4(e)}}`),visible:()=>d4(e).length>0,onMenuSelect:()=>e.insert("\\undergroup{#@}",{selectionMode:"item"})},{id:"accent-underbrace",class:"ML__center-menu",label:()=>dN(`\\underbrace{${d4(e)}}`),visible:()=>d4(e).length>0,onMenuSelect:()=>e.insert("\\underbrace{#@}",{selectionMode:"item"})}],submenuClass:"variant-submenu"},{label:()=>N("menu.decoration"),id:"decoration",visible:()=>e.isSelectionEditable&&d4(e).length>0,submenu:[{id:"decoration-boxed",label:()=>dN(`\\boxed{${e.getValue(e.model.selection)}}}`),onMenuSelect:()=>e.insert("\\boxed{#@}",{selectionMode:"item"})},{id:"decoration-red-box",label:()=>dN(`\\bbox[5px, border: 2px solid red]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px solid red]{#@}",{selectionMode:"item"})},{id:"decoration-dashed-black-box",label:()=>dN(`\\bbox[5px, border: 2px dashed black]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px dashed black]{#@}",{selectionMode:"item"})}],submenuClass:"variant-submenu"},{type:"divider"},{label:()=>N("menu.evaluate"),id:"ce-evaluate",visible:()=>e.isSelectionEditable&&null!==globalThis.MathfieldElement.computeEngine,onMenuSelect:()=>{let i=function(e){var i,r;let a;if(!(a=e.model.selectionIsCollapsed?null==(i=globalThis.MathfieldElement.computeEngine)?void 0:i.parse(e.getValue(),{canonical:!1}):null==(r=globalThis.MathfieldElement.computeEngine)?void 0:r.parse(e.getValue(e.model.selection),{canonical:!1})))return"";let o=a.evaluate();return o.isSame(a)&&(o=a.N()),o.latex}(e);i?e.model.selectionIsCollapsed?(e.model.position=e.model.lastOffset,e.insert(`=${i}`,{insertionMode:"insertAfter",selectionMode:"item"})):e.insert(i,{insertionMode:"replaceSelection",selectionMode:"item"}):e.model.announce("plonk")}},{label:()=>N("menu.simplify"),id:"ce-simplify",visible:()=>e.isSelectionEditable&&null!==globalThis.MathfieldElement.computeEngine,onMenuSelect:()=>{var i,r;if(e.model.selectionIsCollapsed){let r=null==(i=e.expression)?void 0:i.simplify();if(e.model.position=e.model.lastOffset,!r)return void e.model.announce("plonk");e.insert(`=${r.latex}`,{insertionMode:"insertAfter",selectionMode:"item"})}else{let i=null==(r=globalThis.MathfieldElement.computeEngine)?void 0:r.parse(e.getValue(e.model.selection)).simplify();if(!i)return void e.model.announce("plonk");e.insert(i.latex,{insertionMode:"replaceSelection",selectionMode:"item"})}}},{label:()=>{var i;let r=globalThis.MathfieldElement.computeEngine;if(null===r)return"";let a=null==(i=e.expression)?void 0:i.unknowns[0];return a?N("menu.solve-for",dN(r.box(a).latex)):N("menu.solve")},id:"ce-solve",visible:()=>{var i;return e.isSelectionEditable&&null!==globalThis.MathfieldElement.computeEngine&&(null==(i=e.expression)?void 0:i.unknowns.length)===1&&"Nothing"!==e.expression.unknowns[0]},onMenuSelect:()=>{let i=e.expression,r=null==i?void 0:i.unknowns[0],a=i.solve(r),o=Array.isArray(a)?a.map(e=>{var i;return null!=(i=e.simplify().latex)?i:""}):null;o?e.insert(`${r}=${1===o.length?o[0]:"\\left\\lbrace"+(null==o?void 0:o.join(", "))+"\\right\\rbrace"}`,{insertionMode:"replaceAll",selectionMode:"item"}):e.model.announce("plonk")}},{type:"divider"},{label:()=>N("menu.cut"),id:"cut",onMenuSelect:()=>e.executeCommand("cutToClipboard"),visible:()=>!e.options.readOnly&&e.isSelectionEditable,keyboardShortcut:"meta+X"},{label:()=>N("menu.copy"),id:"copy",submenu:[{label:()=>N("menu.copy-as-latex"),id:"copy-latex",onMenuSelect:()=>na.copyToClipboard(e,"latex"),keyboardShortcut:"meta+C"},{label:()=>N("menu.copy-as-typst"),id:"copy-latex",onMenuSelect:()=>na.copyToClipboard(e,"typst")},{label:()=>N("menu.copy-as-ascii-math"),id:"copy-ascii-math",onMenuSelect:()=>na.copyToClipboard(e,"ascii-math")},{label:()=>N("menu.copy-as-mathml"),id:"copy-math-ml",onMenuSelect:()=>na.copyToClipboard(e,"math-ml")}]},{label:()=>N("menu.paste"),id:"paste",onMenuSelect:()=>e.executeCommand("pasteFromClipboard"),visible:()=>e.hasEditableContent,keyboardShortcut:"meta+V"},{label:()=>N("menu.select-all"),id:"select-all",keyboardShortcut:"meta+A",onMenuSelect:()=>e.executeCommand("selectAll")}]),{host:this.host})),this._menu}set menuItems(e){this._menu?this._menu.menuItems=e:this._menu=new dp(e,{host:this.host})}setOptions(e){var i;this.options=f(f({},this.options),ce(e)),this._keybindings=void 0,"inline-math"===this.options.defaultMode?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline");let r=this.options.defaultMode;"inline-math"===r&&(r="math"),(null==(i=this.model.root.firstChild)?void 0:i.mode)!==r&&(this.model.root.firstChild.mode=r),this.options.readOnly&&this.hasFocus()&&window.mathVirtualKeyboard.visible&&this.executeCommand("hideVirtualKeyboard");let a=oG.serialize([this.model.root],{expandMacro:!1,defaultMode:this.options.defaultMode});("macros"in e||this.model.getValue()!==a)&&sK(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)&&sA(this)}getOptions(e){return ct(this.options,e)}getOption(e){return ct(this.options,e)}async handleEvent(e){var i,r,a;if(nl(this)){if(sN(e)){if(!np(e.origin,null!=(i=this.options.originValidator)?i:"none"))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");let{action:r}=e.data;if("execute-command"===r){let i=sI(e.data.command);if(!i||"virtual-keyboard"===sO(i))return;this.executeCommand(i)}else"update-state"===r||("focus"===r?this.focus({preventScroll:!0}):"blur"===r&&this.blur());return}switch(e.type){case"focus":this.programmaticFocusInProgress||this.onFocus({suppressEvents:!0});break;case"blur":this.onBlur({dispatchEvents:!1});break;case"mousedown":"none"===this.userSelect||null!=(r=e.target)&&r.closest("[part=virtual-keyboard-toggle],[part=menu-toggle]")||cH(this,e);break;case"pointerdown":!e.defaultPrevented&&"none"!==this.userSelect&&!(null!=(a=e.target)&&a.closest("[part=virtual-keyboard-toggle],[part=menu-toggle]"))&&(cH(this,e),!1===e.shiftKey&&await dg(e,this.container,this.menu)&&cF.stop());break;case"contextmenu":"none"!==this.userSelect&&!1===e.shiftKey&&await dg(e,this.container,this.menu)&&cF.stop();break;case"virtual-keyboard-toggle":this.hasFocus()&&c8(this),this.hasFocus()&&"manual"!==this.options.mathVirtualKeyboardPolicy&&(this.focusBlurInProgress=!0,this.keyboardDelegate.blur(),this.keyboardDelegate.focus(),this.focusBlurInProgress=!1);break;case"resize":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>nl(this)&&this.onGeometryChange());break;case"scroll":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>nl(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 i=this.host.offsetHeight,r=e.classList.contains("ML__toggles--vertical");i>=100&&!r?e.classList.add("ML__toggles--vertical"):i<100&&r&&e.classList.remove("ML__toggles--vertical")}dispose(){if(!nl(this))return;R.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,document.getElementById("mathlive-keystroke-caption-panel")&&(su("mathlive-keystroke-caption-panel"),nC("core"),nC("keystroke-caption")),document.getElementById("mathlive-suggestion-popover")&&(su("mathlive-suggestion-popover"),nC("suggestion-popover"),nC("core")),document.getElementById("mathlive-environment-popover")&&(su("mathlive-environment-popover"),nC("environment-popover"),nC("core"))}flushInlineShortcutBuffer(e){if(null!=e||(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"virtual-keyboard"===sO(e)?(this.focus({preventScroll:!0}),window.mathVirtualKeyboard.executeCommand(e),requestAnimationFrame(()=>window.mathVirtualKeyboard.update(cZ(this))),!1):function(e,i){var r,a;if(!(i=sI(i)))return!1;let o,n=[],l=!1,s=!1;I(i)?(o=i[0],n=i.slice(1)):o=i;let c=sq[o],d=null==c?void 0:c.target;if("model"===d){if(!e.isSelectionEditable&&null!=c&&c.changeContent)return e.model.announce("plonk"),!1;/^(delete|add)/.test(o)&&("deleteBackward"!==o&&e.flushInlineShortcutBuffer(),e.snapshot(o)),/^complete/.test(o)||sn(e),sq[o].fn(e.model,...n),sl(e),s=!0,l=!0}else if("virtual-keyboard"===d)s=null!=(a=null==(r=window.mathVirtualKeyboard)?void 0:r.executeCommand(i))&&a,l=!0;else if(sq[o]){if(!e.isSelectionEditable&&null!=c&&c.changeContent)return e.model.announce("plonk"),!1;/^(undo|redo)/.test(o)&&e.flushInlineShortcutBuffer(),s=sq[o].fn(e,...n),l=!0}else throw Error(`Unknown command "${o}"`);return"virtual-keyboard"!==d&&(!e.model.selectionIsCollapsed||null!=c&&c.changeSelection&&"deleteBackward"!==o)&&(e.flushInlineShortcutBuffer(),null!=c&&c.changeContent||e.stopCoalescingUndo(),e.defaultStyle={}),s&&(null!=c&&c.changeSelection&&l?(e.dirty=!0,e.scrollIntoView()):sA(e)),l}(this,e)}get errors(){return li(this.model.getValue(),{context:this.context})}getValue(e,i,r){return this.model.getValue(e,i,r)}setValue(e,i){var r;void 0===(i=null!=i?i:{mode:"math"}).insertionMode&&(i.insertionMode="replaceAll"),(void 0===i.format||"auto"===i.format)&&(i.format="latex"),(void 0===i.mode||"auto"===i.mode)&&(i.mode=null!=(r=function(e,i){let r=e.at(i),a;if(r){a=r.mode;let e=r.parent;for(;!a&&e;)e&&(a=e.mode),e=e.parent}return a}(this.model,this.model.position))?r:"math");let a=this.undoManager.canUndo();na.insert(this.model,e,i)&&(sA(this),a||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.110.6: no compute engine available. Make sure the Compute Engine library is loaded."),null)}scrollIntoView(){var e;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 i=window.mathVirtualKeyboard.boundingRect,r=this.host.getBoundingClientRect();r.bottom>i.top&&(null==(e=window.document.scrollingElement)||e.scrollBy(0,r.bottom-i.top+8))}}this.dirty&&sT(this,{interactive:!0});let i=this.field.getBoundingClientRect(),r=null;if(this.model.selectionIsCollapsed)r=ns(this.field);else{let e=nh(this);if(e.length>0){let a=-1/0,o=1/0,n=-1/0;for(let i of e)i.right>a&&(a=i.right),i.top<o&&(o=i.top),i.bottom>n&&(n=i.bottom);let l=n-o;r={x:a+i.left-this.field.scrollLeft,y:o+i.top-this.field.scrollTop,height:l}}}if(this.host&&r){let e=this.host.getBoundingClientRect(),i=r.y,a=r.y+r.height,o=this.host.scrollTop;i<e.top+20?o=i-e.top+this.host.scrollTop-20:a>e.bottom-20&&(o=a-e.bottom+this.host.scrollTop+20),o!==this.host.scrollTop&&this.host.scroll({top:o,behavior:"auto"})}if(r){let e=r.x-window.scrollX,a=this.field.scrollLeft;e<i.left?a=e-i.left+this.field.scrollLeft-20:e>i.right&&(a=e-i.right+this.field.scrollLeft+20),this.field.scroll({top:this.field.scrollTop,left:a})}}insert(e,i){if("string"!=typeof e||0===e.length&&((null==i?void 0:i.insertionMode)==="insertBefore"||(null==i?void 0:i.insertionMode)==="insertAfter")||0===e.length&&this.model.selectionIsCollapsed)return!1;if(this.flushInlineShortcutBuffer(),(i=null!=i?i:{mode:"math"}).focus&&this.focus(),i.feedback&&(globalThis.MathfieldElement.keypressVibration&&_()&&navigator.vibrate(3),globalThis.MathfieldElement.playSound("keypress")),"\\\\"===e&&this.model.parentEnvironment)cs(this.model);else if("&"===e&&this.model.parentEnvironment)cc(this.model);else if(this.model.selectionIsCollapsed){let r=f({},sa(this));/^[a-zA-Z0-9]$/.test(e)||"none"===this.styleBias||(r.variant="normal",r.variantStyle=void 0),na.insert(this.model,e,f({style:r},i))}else na.insert(this.model,e,i);return this.snapshot(`insert-${this.model.at(this.model.position).type}`),sA(this),i.scrollIntoView&&this.scrollIntoView(),!0}switchMode(e,i="",r=""){if(this.model.mode===e||!this.hasEditableContent||!this.contentEditable||this.disabled)return;let{model:a}=this,o=a.mode;if(a.mode=e,this.host&&!this.host.dispatchEvent(new Event("mode-change",{bubbles:!0,composed:!0,cancelable:!0}))){a.mode=o;return}a.mode=o,a.deferNotifications({content:!!r||!!i,selection:!0,type:"insertText"},()=>{let o=a.at(a.position),n=(e,i)=>{if(!e)return;let r="math"===a.mode?lt(o6(e,{format:"ascii-math"})[1],{context:this.context}):[...e].map(e=>new oY(e,e,{}));if(i.select){let e=o.parent.addChildrenAfter(r,o);a.setSelection(a.offsetOf(r[0].leftSibling),a.offsetOf(e))}else a.position=a.offsetOf(o.parent.addChildrenAfter(r,o));c=!0},l=(e,i)=>{let r=new lf(e);o.parent.addChildAfter(r,o),i.select?a.setSelection(a.offsetOf(r.firstChild),a.offsetOf(r.lastChild)):a.position=a.offsetOf(r.lastChild),c=!0},s=()=>{let i="latex"===e?"latex":"math"===e?"plain-text":"ascii-math",n=oQ(a.selection),l=this.model.getValue(n,i),s=this.model.extractAtoms(n);return 1===s.length&&"placeholder"===s[0].type&&(l=r),o=a.at(n[0]),l},c=!1;if(this.flushInlineShortcutBuffer(),this.stopCoalescingUndo(),sc(this,"accept"),a.selectionIsCollapsed)n(i,{select:!1}),a.mode=e,"latex"===e?l(r,{select:!1}):n(r,{select:!1});else{let i=s();a.mode=e,"latex"===e?l(i,{select:!0}):n(i,{select:!0})}return sA(this),this.undoManager.snapshot("latex"===e?"insert-latex":"insert"),c}),a.mode=e,window.mathVirtualKeyboard.update(cZ(this))}hasFocus(){return!this.blurred}focus(e){var i;this.disabled||this.focusBlurInProgress||(this.hasFocus()||(this.programmaticFocusInProgress=!0,this.onFocus(),this.model.announce("line")),null!=(i=null==e?void 0:e.preventScroll)&&i||this.scrollIntoView())}blur(){this.disconnectFromVirtualKeyboard(),this.hasFocus()&&this.keyboardDelegate.blur()}select(){this.model.selection={ranges:[[0,this.model.lastOffset]]},this.focus()}applyStyle(e,i={}){var r;let a,o="set",n=!1;o1(i)?a=i:("toggle"===i.operation&&(o="toggle"),a=i.range,n=null!=(r=i.silenceNotifications)&&r),a&&(a=this.model.normalizeRange(a)),a&&a[0]===a[1]&&(a=void 0);let l=si(this,e);if(void 0===a&&this.model.selectionIsCollapsed){if("set"===o){let e=f({},this.defaultStyle);"color"in l&&delete e.verbatimColor,"backgroundColor"in l&&delete e.verbatimBackgroundColor,this.defaultStyle=f(f({},e),l),this.styleBias="none";return}let e=sa(this),i=f({},this.defaultStyle);for(let r of Object.keys(l))e[r]===l[r]?("color"===r&&delete i.verbatimColor,"backgroundColor"===r&&delete i.verbatimBackgroundColor,delete i[r]):i[r]=l[r];this.defaultStyle=i,this.styleBias="none";return}this.model.deferNotifications({content:!n,type:"insertText"},()=>{if(void 0===a)for(let e of this.model.selection.ranges)lB(this.model,e,l,{operation:o});else lB(this.model,a,l,{operation:o})}),sA(this)}toggleContextMenu(){var e;let i=this.menu;if(!i.visible)return!1;if("open"===i.state)return i.hide(),!0;let r=null==(e=nf(this,this.model.position))?void 0:e.bounds;if(!r)return!1;let a={x:r.right,y:r.bottom};return i.show({target:this.element.querySelector("[part=container]"),location:a,onDismiss:()=>{var e;return null==(e=this.element)?void 0:e.focus()}}),!0}getPrompt(e){return this.model.findAtom(i=>"prompt"===i.type&&i.placeholderId===e)}getPromptValue(e,i){let r=this.getPrompt(e);if(!r)return"";let a=this.model.offsetOf(r.firstChild),o=this.model.offsetOf(r.lastChild);return this.model.getValue(a,o,i)}getPrompts(e){return this.model.atoms.filter(i=>"prompt"===i.type&&(!e||!(e.id&&i.placeholderId!==e.id||e.locked&&i.locked!==e.locked||"undefined"===e.correctness&&i.correctness||e.correctness&&i.correctness!==e.correctness))).map(e=>e.placeholderId)}setPromptValue(e,i,r){if(void 0!==i){let a=this.getPrompt(e);if(!a)return void console.error(`MathLive 0.110.6: unknown prompt ${e}`);let o=this.model.getBranchRange(this.model.offsetOf(a),"body");this.model.setSelection(o),this.insert(i,g(f({},r),{insertionMode:"replaceSelection"}))}null!=r&&r.silenceNotifications&&(this.valueOnFocus=this.getValue()),sA(this)}setPromptState(e,i,r){let a=this.getPrompt(e);a?("undefined"===i?a.correctness=void 0:"string"==typeof i&&(a.correctness=i),"boolean"==typeof r&&(a.locked=r,a.captureSelection=r),sA(this)):console.error(`MathLive 0.110.6: unknown prompt ${e}`)}getPromptState(e){let i=this.getPrompt(e);return i?[i.correctness,i.locked]:(console.error(`MathLive 0.110.6: unknown prompt ${e}`),[void 0,!0])}getPromptRange(e){let i=this.getPrompt(e);return i?this.model.getBranchRange(this.model.offsetOf(i),"body"):(console.error(`MathLive 0.110.6: 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(cZ(this))}snapshot(e){var i;this.undoManager.snapshot(e)&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(cZ(this)),null==(i=this.host)||i.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()&&(null==(e=this.host)||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}redo(){var e;this.undoManager.redo()&&(null==(e=this.host)||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"redo"}})))}resetUndo(){var e;null==(e=this.undoManager)||e.reset()}onSelectionDidChange(){var e,i;let r=this.model;if(r.mathfield.hasFocus()&&this.keyboardDelegate.setValue(r.getValue(r.selection,"latex-expanded")),r.selectionIsCollapsed){let i=l9(r),a=r.position,o=r.at(a),n=null!=(e=o.mode)?e:cr(this.options);if(i&&(a<r.offsetOf(i.firstChild)||a>r.offsetOf(i.lastChild))){sc(this,"accept",{mode:n});let e=r.offsetOf(o);e>=0&&(r.position=e)}else{let e=r.at(a+1);(null==e?void 0:e.type)==="first"&&"latex"===e.mode?r.position=a+1:i&&(null==e?void 0:e.mode)!=="latex"?r.position=a-1:this.switchMode(n)}}null==(i=this.host)||i.dispatchEvent(new Event("selection-change",{bubbles:!0,composed:!0})),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(cZ(this)),c8(this)}onContentWillChange(e){var i,r,a;return null==(a=null==(r=this.host)?void 0:r.dispatchEvent(new InputEvent("beforeinput",g(f({},e),{data:e.data?e.data:null!=(i=e.inputType)?i:"",cancelable:!0,bubbles:!0,composed:!0}))))||a}onFocus(i){if(this.disabled||this.focusBlurInProgress||!this.blurred)return;let r=e._globallyFocusedMathfield;r&&r!==this&&!r.disabled&&r.hasFocus()&&r.onBlur({dispatchEvents:!0}),this.focusBlurInProgress=!0,this.blurred=!1,e._globallyFocusedMathfield=this,this.stopCoalescingUndo(),this.valueOnFocus=this.model.getValue(),this.hasEditablePrompts&&!this.model.at(this.model.anchor).parentPrompt&&this.executeCommand("moveToNextPlaceholder"),sT(this,{interactive:!0}),setTimeout(()=>{var e,r;if(nl(this))if(null!=(e=null==i?void 0:i.suppressEvents)&&e){let e=new AbortController,i=e.signal,a=e=>{e.preventDefault(),e.stopPropagation()};for(let e of["focus","focusin"])null==(r=this.host)||r.addEventListener(e,a,{capture:!0,signal:i});this.focusBlurInProgress=!1,this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),setTimeout(()=>e.abort(),0)}else this.focusBlurInProgress=!1,this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),setTimeout(()=>{this.programmaticFocusInProgress=!1},0)},60)}onBlur(i){var r,a,o,n;if(!this.focusBlurInProgress&&!this.blurred&&(this.focusBlurInProgress=!0,this.stopCoalescingUndo(),this.blurred=!0,e._globallyFocusedMathfield===this&&(e._globallyFocusedMathfield=void 0),this.ariaLiveText&&(this.ariaLiveText.textContent=""),sy(this),this.model.getValue()!==this.valueOnFocus&&(null==(r=this.host)||r.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),this.disconnectFromVirtualKeyboard(),(null==(a=null==i?void 0:i.dispatchEvents)||a)&&(null==(o=this.host)||o.dispatchEvent(new Event("blur",{bubbles:!1,composed:!0})),null==(n=this.host)||n.dispatchEvent(new UIEvent("focusout",{bubbles:!0,composed:!0}))),sA(this),this.focusBlurInProgress=!1,c6(),uD.restoreFocusWhenDocumentFocused)){let e=new AbortController,i=e.signal;window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{nl(this)&&this.focus({preventScroll:!0})},{once:!0,signal:i})},{once:!0,signal:i}),document.addEventListener("focusin",()=>e.abort(),{once:!0}),document.addEventListener("click",()=>e.abort(),{once:!0})}}onInput(e){c$(this,e)}onKeystroke(e){return cK(this,e)}onCompositionStart(e){cf(this.model,oQ(this.model.selection),"insertText");let i=ns(this.field);i&&requestAnimationFrame(()=>{sT(this),this.keyboardDelegate.moveTo(i.x,i.y-i.height)})}onCompositionUpdate(e){(function(e,i){let r=e.at(e.position);if("composition"===r.type)r.value=i;else{let{caret:a}=r;r.caret=void 0;let o=new n1(i,{mode:r.mode});o.caret=a,r.parent.addChildAfter(o,r),e.position+=1}})(this.model,e),sA(this)}onCompositionEnd(e){var i;let r;"composition"===(r=(i=this.model).at(i.position)).type&&(r.parent.removeChild(r),i.position-=1),c$(this,e,{simulateKeystroke:!0})}onCut(e){this.isSelectionEditable?this.model.contentWillChange({inputType:"deleteByCut"})&&(this.stopCoalescingUndo(),e.clipboardData?na.onCopy(this,e):na.copyToClipboard(this,"latex"),cf(this.model,oQ(this.model.selection),"deleteByCut"),this.snapshot("cut"),sA(this)):this.model.announce("plonk")}onCopy(e){e.clipboardData?na.onCopy(this,e):na.copyToClipboard(this,"latex")}onPaste(e){let i=this.isSelectionEditable;return i&&(i=na.onPaste(this.model.at(this.model.position).mode,this,e.clipboardData)),i||this.model.announce("plonk"),e.preventDefault(),e.stopPropagation(),i}onGeometryChange(){var e;null==(e=this._menu)||e.hide(),sb(this),c8(this)}onWheel(e){let i=5*e.deltaX;if(!Number.isFinite(i)||0===i)return;let r=this.field;i<0&&0===r.scrollLeft||i>0&&r.offsetWidth+r.scrollLeft>=r.scrollWidth||(r.scrollBy({top:0,left:i}),e.preventDefault(),e.stopPropagation())}getHTMLElement(e){let i=e;for(;!i.id&&i.hasChildren;)i=e.children[0];return this.field.querySelector(`[data-atom-id="${i.id}"]`)}get context(){var e,i;return{registers:null!=(e=this.options.registers)?e:{},smartFence:this.smartFence,letterShapeStyle:this.letterShapeStyle,minFontScale:this.minFontScale,maxMatrixCols:this.maxMatrixCols,placeholderSymbol:null!=(i=this.options.placeholderSymbol)?i:"▢",colorMap:e=>this.colorMap(e),backgroundColorMap:e=>this.backgroundColorMap(e),getMacro:e=>eS(e,this.options.macros),atomIdsSettings:{seed:"random",groupNumbers:!1}}}};s$({speak:(e,i,r)=>(function(e,i,r){var a;r=null!=r?r:{withHighlighting:!1};let{model:o}=e,n=globalThis.MathfieldElement,l=function(e){let i=null;switch(e){case"all":default:i=o.root;break;case"selection":i=o.getAtoms(o.selection);break;case"left":i=o.getAtoms(o.offsetOf(o.at(o.position).leftSibling),o.position);break;case"right":i=o.getAtoms(o.position,o.offsetOf(o.at(o.position).rightSibling));break;case"group":i=o.getAtoms(o.getSiblingsRange(o.position));break;case"parent":{let{parent:e}=o.at(o.position);i=null!=e&&e.parent?e:o.root}}return i}(i);if(null===l)return null==(a=n.speakHook)||a.call(n,function(e){let i="";switch(e){case"all":console.error("Internal failure: speak all failed");break;case"selection":i="no selection";break;case"left":i="at start";break;case"right":i="at end";break;case"group":console.error("Internal failure: speak group failed");break;case"parent":i="no parent";break;default:console.error('unknown speak_ param value: "'+e+'"')}return i}(i)),!1;(r.withHighlighting||"amazon"===n.speechEngine)&&(n.textToSpeechMarkup=globalThis.sre&&"sre"===n.textToSpeechRules?"ssml_step":"ssml");let s=d$(l);return v()&&r.withHighlighting?(uj().readAloudMathfield=e,sT(e,{forHighlighting:!0}),n.readAloudHook&&n.readAloudHook(e.field,s)):n.speakHook&&n.speakHook(s),!1})(e,i,r)},{target:"mathfield"}),v()||console.error('MathLive 0.110.6: this version of the MathLive library is for use in the browser. A subset of the API is available on the server side in the "mathlive-ssr" library. If using server side rendering (with React for example) you may want to do a dynamic import of the MathLive library inside a `useEffect()` call.');var ux=new WeakMap,u_={letterShapeStyle:"mf.letterShapeStyle = ...",horizontalSpacingScale:'Removed. Use `"thinmuskip"`, `"medmuskip"`, and `"thickmuskip"` registers ',macros:"mf.macros = ...",registers:"mf.registers = ...",backgroundColorMap:"mf.backgroundColorMap = ...",colorMap:"mf.colorMap = ...",enablePopover:"mf.popoverPolicy = ...",mathModeSpace:"mf.mathModeSpace = ...",placeholderSymbol:"mf.placeholderSymbol = ...",readOnly:"mf.readOnly = ...",removeExtraneousParentheses:"mf.removeExtraneousParentheses = ...",scriptDepth:"mf.scriptDepth = ...",smartFence:"mf.smartFence = ...",smartMode:"mf.smartMode = ...",smartSuperscript:"mf.smartSuperscript = ...",inlineShortcutTimeout:"mf.inlineShortcutTimeout = ...",inlineShortcuts:"mf.inlineShortcuts = ...",keybindings:"mf.keybindings = ...",virtualKeyboardMode:"mf.mathVirtualKeyboardPolicy = ...",customVirtualKeyboardLayers:"mathVirtualKeyboard.layers = ...",customVirtualKeyboards:"mathVirtualKeyboard.layouts = ...",keypressSound:"mathVirtualKeyboard.keypressSound = ...",keypressVibration:"mathVirtualKeyboard.keypressVibration = ...",plonkSound:"mathVirtualKeyboard.plonkSound = ...",virtualKeyboardContainer:"mathVirtualKeyboard.container = ...",virtualKeyboardLayout:"mathVirtualKeyboard.alphabeticLayout = ...",virtualKeyboardTheme:"No longer supported",virtualKeyboardToggleGlyph:"No longer supported",virtualKeyboardToolbar:"mathVirtualKeyboard.editToolbar = ...",virtualKeyboards:"Use `mathVirtualKeyboard.layouts`",speechEngine:"`MathfieldElement.speechEngine`",speechEngineRate:"`MathfieldElement.speechEngineRate`",speechEngineVoice:"`MathfieldElement.speechEngineVoice`",textToSpeechMarkup:"`MathfieldElement.textToSpeechMarkup`",textToSpeechRules:"`MathfieldElement.textToSpeechRules`",textToSpeechRulesOptions:"`MathfieldElement.textToSpeechRulesOptions`",readAloudHook:"`MathfieldElement.readAloudHook`",speakHook:"`MathfieldElement.speakHook`",computeEngine:"`MathfieldElement.computeEngine`",fontsDirectory:"`MathfieldElement.fontsDirectory`",soundsDirectory:"`MathfieldElement.soundsDirectory`",createHTML:"`MathfieldElement.createHTML`",onExport:"`mf.onExport`",onInlineShortcut:"`mf.onInlineShortcut`",onScrollIntoView:"`mf.onScrollIntoView`",locale:"MathfieldElement.locale = ...",strings:"MathfieldElement.strings = ...",decimalSeparator:"MathfieldElement.decimalSeparator = ...",fractionNavigationOrder:"MathfieldElement.fractionNavigationOrder = ..."},uw=class e extends HTMLElement{constructor(e){if(super(),this._observer=null,e){let i=[];for(let r of Object.keys(e))if(u_[r])if(u_[r].startsWith("mf."))if(u_[r].startsWith(`mf.${r}`))i.push(`Option \`${r}\` cannot be used as a constructor option. Use ${u_[r]}`);else{let e=u_[r].match(/([a-zA-Z]+) =/);i.push(`Option \`${r}\` has been renamed \`${e[1]}\``)}else i.push(`Option \`${r}\` cannot be used as a constructor option. Use ${u_[r]}`);if(i.length>0){for(let e of(console.group("%cMathLive 0.110.6: %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."),i))console.warn(e);console.groupEnd()}}if(uL()&&(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=[nS("core"),nS("mathfield"),nS("mathfield-element"),nS("ui"),nS("menu")],this.shadowRoot.appendChild(document.createElement("span"));let e=document.createElement("slot");e.style.display="none",this.shadowRoot.appendChild(e)}else this.shadowRoot.innerHTML="<style>"+nM("core")+nM("mathfield")+nM("mathfield-element")+nM("ui")+nM("menu")+'</style><span></span><slot style="display:none"></slot>';e&&this._setOptions(e)}static get formAssociated(){return uL()}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(e){e!==this._fontsDirectory&&(this._fontsDirectory=e,sC())}get fontsDirectory(){throw Error("Use MathfieldElement.fontsDirectory instead")}set fontsDirectory(e){throw Error("Use MathfieldElement.fontsDirectory instead")}static get soundsDirectory(){return this._soundsDirectory}static set soundsDirectory(e){this._soundsDirectory=e,this.audioBuffers={}}get soundsDirectory(){throw Error("Use MathfieldElement.soundsDirectory instead")}set soundsDirectory(e){throw Error("Use MathfieldElement.soundsDirectory instead")}static get keypressSound(){return this._keypressSound}static set keypressSound(e){var i,r,a;this.audioBuffers={},null===e?this._keypressSound={spacebar:null,return:null,delete:null,default:null}:"string"==typeof e?this._keypressSound={spacebar:e,return:e,delete:e,default:e}:"object"==typeof e&&"default"in e&&(this._keypressSound={spacebar:null!=(i=e.spacebar)?i:e.default,return:null!=(r=e.return)?r:e.default,delete:null!=(a=e.delete)?a:e.default,default:e.default})}static get plonkSound(){return this._plonkSound}static set plonkSound(e){this.audioBuffers={},this._plonkSound=e}static get audioContext(){return this._audioContext||(this._audioContext=new AudioContext),this._audioContext}static get speechEngine(){return this._speechEngine}static set speechEngine(e){this._speechEngine=e}static get speechEngineRate(){return this._speechEngineRate}static set speechEngineRate(e){this._speechEngineRate=e}static get speechEngineVoice(){return this._speechEngineVoice}static set speechEngineVoice(e){this._speechEngineVoice=e}static get textToSpeechMarkup(){return this._textToSpeechMarkup}static set textToSpeechMarkup(e){this._textToSpeechMarkup=e}static get textToSpeechRules(){return this._textToSpeechRules}static set textToSpeechRules(e){this._textToSpeechRules=e}static get textToSpeechRulesOptions(){return this._textToSpeechRulesOptions}static set textToSpeechRulesOptions(e){this._textToSpeechRulesOptions=e}static get locale(){return R.locale}static set locale(e){"auto"===e&&(e=navigator.language.slice(0,5)),R.locale=e}get locale(){throw Error("Use MathfieldElement.locale instead")}set locale(e){throw Error("Use MathfieldElement.locale instead")}static get strings(){return R.strings}static set strings(e){R.merge(e)}get strings(){throw Error("Use MathfieldElement.strings instead")}set strings(e){throw Error("Use MathfieldElement.strings instead")}static get decimalSeparator(){return this._decimalSeparator}static set decimalSeparator(e){this._decimalSeparator=e,this._computeEngine&&console.warn("MathLive 0.110.6: setting MathfieldElement.decimalSeparator after the Compute Engine has been created has no effect on the engine. Reassign MathfieldElement.computeEngine with a freshly configured instance to apply the new separator.")}get decimalSeparator(){throw Error("Use MathfieldElement.decimalSeparator instead")}set decimalSeparator(e){throw Error("Use MathfieldElement.decimalSeparator instead")}static set scientificNotationTemplate(e){this._scientificNotationTemplate=e}static get scientificNotationTemplate(){return this._scientificNotationTemplate}static get fractionNavigationOrder(){return o$.fractionNavigationOrder}static set fractionNavigationOrder(e){if("numerator-denominator"!==e&&"denominator-numerator"!==e)throw Error("Invalid value");o$.fractionNavigationOrder!==e&&(o$.fractionNavigationOrder=e,sB())}static get compactSerialization(){return o$.compactSerialization}static set compactSerialization(e){o$.compactSerialization=!!e}static get computeEngine(){var e,i;if(void 0===this._computeEngine){let i=window[Symbol.for("io.cortexjs.compute-engine")],r=null==i?void 0:i.ComputeEngine;if(!r)return null;if(this._computeEngine=new r,this._computeEngine&&","===this.decimalSeparator){let[r,a]=String(null!=(e=null==i?void 0:i.version)?e:"").split(".").map(e=>parseInt(e,10));(r>0||0===r&&a>=58)&&(this._computeEngine.latexOptions=g(f({},this._computeEngine.latexOptions),{decimalSeparator:"{,}"}))}}return null!=(i=this._computeEngine)?i:null}static set computeEngine(e){this._computeEngine=e}get computeEngine(){throw Error("Use MathfieldElement.computeEngine instead")}set computeEngine(e){throw Error("Use MathfieldElement.computeEngine instead")}static get isFunction(){return"function"!=typeof this._isFunction?()=>!1:this._isFunction}static set isFunction(e){this._isFunction=e,sB()}static async loadSound(e){delete this.audioBuffers[e];let i="";switch(e){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}if("string"!=typeof i)return;i=i.trim();let r=this.soundsDirectory;if(null!=r&&"null"!==r&&"none"!==i&&"null"!==i)try{let a=await (await fetch(await sS(`${r}/${i}`))).arrayBuffer(),o=await this.audioContext.decodeAudioData(a);this.audioBuffers[e]=o}catch(e){}}static async playSound(e){if(("suspended"===this.audioContext.state||"interrupted"===this.audioContext.state)&&await this.audioContext.resume(),this.audioBuffers[e]||await this.loadSound(e),!this.audioBuffers[e])return;let i=this.audioContext.createBufferSource();i.buffer=this.audioBuffers[e];let r=this.audioContext.createGain();r.gain.value=.5,i.connect(r).connect(this.audioContext.destination),i.start()}showMenu(e){var i,r;return null!=(r=null==(i=this._mathfield)?void 0:i.showMenu(e))&&r}get mathVirtualKeyboard(){throw Error("The `mathVirtualKeyboard` property is not available on the MathfieldElement. Use `window.mathVirtualKeyboard` instead.")}onPointerDown(){window.addEventListener("pointerup",i=>{let r=this._mathfield;if(r&&i.target===this&&!r.disabled){this.dispatchEvent(new MouseEvent("click",{altKey:i.altKey,button:i.button,buttons:i.buttons,clientX:i.clientX,clientY:i.clientY,ctrlKey:i.ctrlKey,metaKey:i.metaKey,movementX:i.movementX,movementY:i.movementY,relatedTarget:i.relatedTarget,screenX:i.screenX,screenY:i.screenY,shiftKey:i.shiftKey}));let a=this.getOffsetFromPoint(i.clientX,i.clientY);a>=0&&e.openUrl(function(e,i){let r=e.model.at(i);for(;r;){if("\\href"===r.command){let e=r.args[0];if("string"==typeof e)return e}r=r.parent}return""}(r,a)),"touch"===i.pointerType&&this.selectionIsCollapsed&&(this.position=a)}},{once:!0})}getPromptValue(e,i){var r,a;return null!=(a=null==(r=this._mathfield)?void 0:r.getPromptValue(e,i))?a:""}setPromptValue(e,i,r){var a;null==(a=this._mathfield)||a.setPromptValue(e,i,r)}getPromptRange(e){var i,r;return null!=(r=null==(i=this._mathfield)?void 0:i.getPromptRange(e))?r:null}getPrompts(e){var i,r;return null!=(r=null==(i=this._mathfield)?void 0:i.getPrompts(e))?r:[]}get hasEditableContent(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.hasEditableContent)&&i}get form(){var e;return null==(e=this._internals)?void 0:e.form}get name(){var e;return null!=(e=this.getAttribute("name"))?e:""}get type(){return this.localName}get mode(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.model.mode)?i:"text"===this.defaultMode?"text":"math"}set mode(e){var i;null==(i=this._mathfield)||i.switchMode(e)}get expression(){if(this._mathfield)return window[Symbol.for("io.cortexjs.compute-engine")]?this._mathfield.expression:(console.error(`MathLive 0.110.6: The CortexJS Compute Engine library is not available.
3490
+ "win" modifier can only be used with Windows platform.`);a="windows",r.win=!1,r.cmd=!1,r.meta=!0}if(a&&!function(e){if(v()){let i=w(),r=e.startsWith("!"),a=e.endsWith(i);if(r&&!a||!r&&a)return!0}return"!other"!==e&&"other"===e}(a))return;if(/^\[.+\]$/.test(r.key))return g(f({},e),{key:E(r)});let o=function(e,i){var r;let a={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:""};if(!e)return a;for(let[r,o]of Object.entries(i.mapping)){if(o[0]===e)return a.key=`[${r}]`,a;if(o[1]===e)return a.shift=!0,a.key=`[${r}]`,a;if(o[2]===e)return a.alt=!0,a.key=`[${r}]`,a;if(o[3]===e)return a.shift=!0,a.alt=!0,a.key=`[${r}]`,a}return a.key=null!=(r=z[e])?r:"",a}(r.key,i);if(!o)return g(f({},e),{key:E(r)});if(o.shift&&r.shift||o.alt&&r.alt)throw Error(`The keybinding ${e.key} (${sa(e.command)}) is conflicting with the key combination ${E(o)} using the ${i.displayName} keyboard layout`);return o.shift=o.shift||r.shift,o.alt=o.alt||r.alt,o.meta=r.meta,o.ctrl=r.ctrl,g(f({},e),{key:E(o)})}(o,i);if(!e)continue;let r=a.find(i=>i.key===e.key&&i.ifMode===e.ifMode);if(r)throw Error(`Ambiguous key binding ${o.key} (${sa(o.command)}) matches ${r.key} (${sa(r.command)}) with the ${i.displayName} keyboard layout`);a.push(e)}catch(e){e instanceof Error&&r.push(e.message)}return[a,r]}(this.options.keybindings,null!=(e=$())?e:function(){switch(D()){case"apple":break;case"windows":return S;case"linux":return L}return M}());return(null==(i=$())?void 0:i.score)>0&&(this._keybindings=r,a.length>0&&console.error("MathLive 0.110.8: Invalid keybindings for current keyboard layout",a)),r}get menu(){var e,i;return null!=this._menu||(this._menu=new dy((e=this,[{label:()=>N("menu.array.add row above"),id:"add-row-above",onMenuSelect:()=>e.executeCommand("addRowBefore"),keyboardShortcut:"shift+alt+[Return]",visible:()=>{if(!e.isSelectionEditable||!ue(e))return!1;let[i,r]=ui(e),[a,o]=ur(e);return i!==a}},{label:()=>N("menu.array.add row below"),id:"add-row-below",onMenuSelect:()=>e.executeCommand("addRowAfter"),keyboardShortcut:"alt+[Return]",visible:()=>{if(!e.isSelectionEditable||!ue(e))return!1;let[i,r]=ui(e),[a,o]=ur(e);return i!==a}},{label:()=>N("menu.array.add column before"),id:"add-column-before",onMenuSelect:()=>e.executeCommand("addColumnBefore"),visible:()=>{if(!e.isSelectionEditable||!ue(e))return!1;let[i,r]=ui(e),[a,o]=ur(e);return r!==o},keyboardShortcut:"shift+alt+[Tab]",enabled:()=>{let i=e.model.parentEnvironment;if(!i)return!1;let[r,a]=ut(e);return r<i.maxColumns}},{label:()=>N("menu.array.add column after"),id:"add-column-after",onMenuSelect:()=>e.executeCommand("addColumnAfter"),keyboardShortcut:"alt+[Tab]",visible:()=>{if(!e.isSelectionEditable||!ue(e))return!1;let[i,r]=ui(e),[a,o]=ur(e);return r!==o}},{type:"divider"},{label:()=>N("menu.array.delete row"),id:"delete-row",onMenuSelect:()=>e.executeCommand("removeRow"),enabled:()=>{let[i,r]=ui(e),[a,o]=ut(e);return a>i},visible:()=>{if(!e.isSelectionEditable||!ue(e))return!1;let[i,r]=ui(e),[a,o]=ur(e);return i!==a}},{label:()=>N("menu.array.delete column"),id:"delete-column",onMenuSelect:()=>e.executeCommand("removeColumn"),enabled:()=>{let[i,r]=ui(e),[a,o]=ut(e);return o>r},visible:()=>{if(!e.isSelectionEditable||!ue(e))return!1;let[i,r]=ui(e),[a,o]=ur(e);return r!==o}},{type:"divider"},{label:()=>N("menu.borders"),visible:()=>{var i;let r;return("array"===(r=(i=e).model.at(i.model.position)).type&&["matrix","pmatrix","bmatrix","vmatrix","Bmatrix"].includes(r.environmentName)||ue(e))&&e.isSelectionEditable},submenu:[{label:" ⋱ ",id:"environment-no-border",onMenuSelect:()=>ua(e,"matrix")},{label:"(⋱)",id:"environment-parentheses",onMenuSelect:()=>ua(e,"pmatrix")},{label:"[⋱]",id:"environment-brackets",onMenuSelect:()=>ua(e,"bmatrix")},{label:"|⋱|",id:"environment-bar",onMenuSelect:()=>ua(e,"vmatrix")},{label:"{⋱}",id:"environment-braces",onMenuSelect:()=>ua(e,"Bmatrix")}],submenuClass:"border-submenu"},{type:"divider"},{label:()=>N("menu.insert matrix"),id:"insert-matrix",visible:()=>e.isSelectionEditable,submenu:function(e){let i=[];for(let r=1;r<=5;r++)for(let a=1;a<=5;a++)i.push({id:`insert-matrix-${r}x${a}`,onCreate:(e,i)=>new d9(e,i,r,a),label:"☐",tooltip:()=>N("tooltip.row-by-col",r,a),data:{row:r,col:a},onMenuSelect:()=>{e.insert(`\\begin{pmatrix}${Array(r).fill(Array(a).fill("#?").join(" & ")).join("\\\\")}\\end{pmatrix}`,{selectionMode:"item"})}});return i}(e),submenuClass:"insert-matrix-submenu",columnCount:5},{type:"divider"},{label:()=>N("menu.insert"),id:"insert",submenu:(i=e,[{label:()=>ul("abs"),id:"insert-abs",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("|#?|")},{label:()=>ul("nth-root"),id:"insert-nth-root",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\sqrt[#?]{#?}")},{label:()=>ul("log-base"),id:"insert-log-base",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\log_{#?}{#?}")},{type:"heading",label:()=>N("menu.insert.heading-calculus")},{label:()=>ul("derivative"),id:"insert-derivative",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\dfrac{\\mathrm{d}}{\\mathrm{d}x}#?\\bigm|_{x=#?}")},{label:()=>ul("nth-derivative"),id:"insert-nth-derivative",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\dfrac{\\mathrm{d}^#?}{\\mathrm{d}x^#?}#?\\bigm|_{x=#?}")},{label:()=>ul("integral"),id:"insert-integral",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\int_#?^#?#?\\,\\mathrm{d}#?")},{label:()=>ul("sum"),id:"insert-sum",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\sum_#?^#?#?")},{label:()=>ul("product"),id:"insert-product",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\prod_#?^#?#?")},{type:"heading",label:()=>N("menu.insert.heading-complex-numbers")},{label:()=>ul("modulus"),id:"insert-modulus",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\lvert#?\\rvert")},{label:()=>ul("argument"),id:"insert-argument",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\arg(#?)")},{label:()=>ul("real-part"),id:"insert-real-part",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\Re(#?)")},{label:()=>ul("imaginary-part"),id:"insert-imaginary-part",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\Im(#?)")},{label:()=>ul("conjugate"),id:"insert-conjugate",visible:()=>i.isSelectionEditable,onMenuSelect:()=>i.insert("\\overline{#?}")}])},{type:"divider"},{label:()=>N("menu.mode"),id:"mode",visible:()=>e.isSelectionEditable&&e.model.selectionIsCollapsed,submenu:[{label:()=>N("menu.mode-math"),id:"mode-math",onMenuSelect:()=>{sf(e,"accept-all"),e.executeCommand(["switchMode","math"])},checked:()=>"math"===e.model.mode},{label:()=>N("menu.mode-text"),id:"mode-text",onMenuSelect:()=>{sf(e,"accept-all"),e.executeCommand(["switchMode","text"])},checked:()=>"text"===e.model.mode},{label:()=>N("menu.mode-latex"),id:"mode-latex",onMenuSelect:()=>e.executeCommand(["switchMode","latex"]),checked:()=>"latex"===e.model.mode}]},{type:"divider"},{label:()=>N("menu.font-style"),id:"variant",visible:()=>e.isSelectionEditable,submenu:[uo(e,"double-struck","mathbb","tooltip.blackboard"),uo(e,"fraktur","mathfrak","tooltip.fraktur"),uo(e,"calligraphic","mathcal","tooltip.caligraphic"),un(e,"up","mathrm","tooltip.roman-upright"),un(e,"bold","bm","tooltip.bold"),un(e,"italic","mathit","tooltip.italic")],submenuClass:"variant-submenu"},{label:()=>N("menu.color"),id:"color",visible:()=>e.isSelectionEditable,submenu:function(e){let i=[];for(let r of Object.keys(j))i.push({id:`color-${r}`,class:("#000"===d8(j[r])?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${j[r]} "></span>`,ariaLabel:()=>{var e;return null!=(e=N(r))?e:r},checked:()=>{var i;return null!=(i=({some:"mixed",all:!0})[e.queryStyle({color:r})])&&i},onMenuSelect:()=>e.applyStyle({color:r},{operation:"toggle"})});return i}(e),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>N("menu.background-color"),id:"background-color",visible:()=>e.isSelectionEditable,submenu:function(e){let i=[];for(let r of Object.keys(V))i.push({id:`background-color-${r}`,class:("#000"===function(e){let i=dY(e),r=(0x1000000+(dQ(i.r)<<16)+(dQ(i.g)<<8)+dQ(i.b)).toString(16).slice(1);return void 0!==i.alpha&&i.alpha<1&&(r+=("00"+Math.round(255*i.alpha).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]+(void 0!==i.alpha&&i.alpha<1?r[6]:"")),"#"+r}(d8(V[r]))?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${V[r]} "></span>`,ariaLabel:()=>{var e;return null!=(e=N(r))?e:r},checked:()=>{var i;return null!=(i=({some:"mixed",all:!0})[e.queryStyle({backgroundColor:r})])&&i},onMenuSelect:()=>e.applyStyle({backgroundColor:r},{operation:"toggle"})});return i}(e),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>N("menu.accent"),id:"accent",visible:()=>e.isSelectionEditable,submenu:[{id:"accent-vec",class:"ML__center-menu",label:()=>dH(`\\vec{${d5(e)}}`),visible:()=>1===d5(e).length,onMenuSelect:()=>e.insert("\\vec{#@}",{selectionMode:"item"})},{id:"accent-overrightarrow",class:"ML__center-menu",label:()=>dH(`\\overrightarrow{${d5(e)}}`),visible:()=>d5(e).length>0,onMenuSelect:()=>e.insert("\\overrightarrow{#@}",{selectionMode:"item"})},{id:"accent-overleftarrow",class:"ML__center-menu",label:()=>dH(`\\overleftarrow{${d5(e)}}`),visible:()=>d5(e).length>0,onMenuSelect:()=>e.insert("\\overleftarrow{#@}",{selectionMode:"item"})},{id:"accent-dot",class:"ML__center-menu",label:()=>dH(`\\dot{${d5(e)}}`),visible:()=>1===d5(e).length,onMenuSelect:()=>e.insert("\\dot{#@}",{selectionMode:"item"})},{id:"accent-ddot",class:"ML__center-menu",label:()=>dH(`\\ddot{${d5(e)}}`),visible:()=>1===d5(e).length,onMenuSelect:()=>e.insert("\\ddot{#@}",{selectionMode:"item"})},{id:"accent-bar",class:"ML__center-menu",label:()=>dH(`\\bar{${d5(e)}}`),visible:()=>1===d5(e).length,onMenuSelect:()=>e.insert("\\bar{#@}",{selectionMode:"item"})},{id:"accent-overline",class:"ML__center-menu",label:()=>dH(`\\overline{${d5(e)}}`),visible:()=>d5(e).length>0,onMenuSelect:()=>e.insert("\\overline{#@}",{selectionMode:"item"})},{id:"accent-overgroup",class:"ML__center-menu",label:()=>dH(`\\overgroup{${d5(e)}}`),visible:()=>d5(e).length>0,onMenuSelect:()=>e.insert("\\overgroup{#@}",{selectionMode:"item"})},{id:"accent-overbrace",class:"ML__center-menu",label:()=>dH(`\\overbrace{${d5(e)}}`),visible:()=>d5(e).length>0,onMenuSelect:()=>e.insert("\\overbrace{#@}",{selectionMode:"item"})},{id:"accent-underline",class:"ML__center-menu",label:()=>dH(`\\underline{${d5(e)}}`),visible:()=>d5(e).length>0,onMenuSelect:()=>e.insert("\\underline{#@}",{selectionMode:"item"})},{id:"accent-undergroup",class:"ML__center-menu",label:()=>dH(`\\undergroup{${d5(e)}}`),visible:()=>d5(e).length>0,onMenuSelect:()=>e.insert("\\undergroup{#@}",{selectionMode:"item"})},{id:"accent-underbrace",class:"ML__center-menu",label:()=>dH(`\\underbrace{${d5(e)}}`),visible:()=>d5(e).length>0,onMenuSelect:()=>e.insert("\\underbrace{#@}",{selectionMode:"item"})}],submenuClass:"variant-submenu"},{label:()=>N("menu.decoration"),id:"decoration",visible:()=>e.isSelectionEditable&&d5(e).length>0,submenu:[{id:"decoration-boxed",label:()=>dH(`\\boxed{${e.getValue(e.model.selection)}}}`),onMenuSelect:()=>e.insert("\\boxed{#@}",{selectionMode:"item"})},{id:"decoration-red-box",label:()=>dH(`\\bbox[5px, border: 2px solid red]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px solid red]{#@}",{selectionMode:"item"})},{id:"decoration-dashed-black-box",label:()=>dH(`\\bbox[5px, border: 2px dashed black]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px dashed black]{#@}",{selectionMode:"item"})}],submenuClass:"variant-submenu"},{type:"divider"},{label:()=>N("menu.evaluate"),id:"ce-evaluate",visible:()=>e.isSelectionEditable&&null!==globalThis.MathfieldElement.computeEngine,onMenuSelect:()=>{let i=function(e){var i,r;let a;if(!(a=e.model.selectionIsCollapsed?null==(i=globalThis.MathfieldElement.computeEngine)?void 0:i.parse(e.getValue(),{canonical:!1}):null==(r=globalThis.MathfieldElement.computeEngine)?void 0:r.parse(e.getValue(e.model.selection),{canonical:!1})))return"";let o=a.evaluate();return o.isSame(a)&&(o=a.N()),o.latex}(e);i?e.model.selectionIsCollapsed?(e.model.position=e.model.lastOffset,e.insert(`=${i}`,{insertionMode:"insertAfter",selectionMode:"item"})):e.insert(i,{insertionMode:"replaceSelection",selectionMode:"item"}):e.model.announce("plonk")}},{label:()=>N("menu.simplify"),id:"ce-simplify",visible:()=>e.isSelectionEditable&&null!==globalThis.MathfieldElement.computeEngine,onMenuSelect:()=>{var i,r;if(e.model.selectionIsCollapsed){let r=null==(i=e.expression)?void 0:i.simplify();if(e.model.position=e.model.lastOffset,!r)return void e.model.announce("plonk");e.insert(`=${r.latex}`,{insertionMode:"insertAfter",selectionMode:"item"})}else{let i=null==(r=globalThis.MathfieldElement.computeEngine)?void 0:r.parse(e.getValue(e.model.selection)).simplify();if(!i)return void e.model.announce("plonk");e.insert(i.latex,{insertionMode:"replaceSelection",selectionMode:"item"})}}},{label:()=>{var i;let r=globalThis.MathfieldElement.computeEngine;if(null===r)return"";let a=null==(i=e.expression)?void 0:i.unknowns[0];return a?N("menu.solve-for",dH(r.box(a).latex)):N("menu.solve")},id:"ce-solve",visible:()=>{var i;return e.isSelectionEditable&&null!==globalThis.MathfieldElement.computeEngine&&(null==(i=e.expression)?void 0:i.unknowns.length)===1&&"Nothing"!==e.expression.unknowns[0]},onMenuSelect:()=>{let i=e.expression,r=null==i?void 0:i.unknowns[0],a=i.solve(r),o=Array.isArray(a)?a.map(e=>{var i;return null!=(i=e.simplify().latex)?i:""}):null;o?e.insert(`${r}=${1===o.length?o[0]:"\\left\\lbrace"+(null==o?void 0:o.join(", "))+"\\right\\rbrace"}`,{insertionMode:"replaceAll",selectionMode:"item"}):e.model.announce("plonk")}},{type:"divider"},{label:()=>N("menu.cut"),id:"cut",onMenuSelect:()=>e.executeCommand("cutToClipboard"),visible:()=>!e.options.readOnly&&e.isSelectionEditable,keyboardShortcut:"meta+X"},{label:()=>N("menu.copy"),id:"copy",submenu:[{label:()=>N("menu.copy-as-latex"),id:"copy-latex",onMenuSelect:()=>na.copyToClipboard(e,"latex"),keyboardShortcut:"meta+C"},{label:()=>N("menu.copy-as-typst"),id:"copy-latex",onMenuSelect:()=>na.copyToClipboard(e,"typst")},{label:()=>N("menu.copy-as-ascii-math"),id:"copy-ascii-math",onMenuSelect:()=>na.copyToClipboard(e,"ascii-math")},{label:()=>N("menu.copy-as-mathml"),id:"copy-math-ml",onMenuSelect:()=>na.copyToClipboard(e,"math-ml")}]},{label:()=>N("menu.paste"),id:"paste",onMenuSelect:()=>e.executeCommand("pasteFromClipboard"),visible:()=>e.hasEditableContent,keyboardShortcut:"meta+V"},{label:()=>N("menu.select-all"),id:"select-all",keyboardShortcut:"meta+A",onMenuSelect:()=>e.executeCommand("selectAll")}]),{host:this.host})),this._menu}set menuItems(e){this._menu?this._menu.menuItems=e:this._menu=new dy(e,{host:this.host})}setOptions(e){var i;this.options=f(f({},this.options),co(e)),this._keybindings=void 0,"inline-math"===this.options.defaultMode?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline");let r=this.options.defaultMode;"inline-math"===r&&(r="math"),(null==(i=this.model.root.firstChild)?void 0:i.mode)!==r&&(this.model.root.firstChild.mode=r),this.options.readOnly&&this.hasFocus()&&window.mathVirtualKeyboard.visible&&this.executeCommand("hideVirtualKeyboard");let a=oG.serialize([this.model.root],{expandMacro:!1,defaultMode:this.options.defaultMode});("macros"in e||this.model.getValue()!==a)&&sR(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)&&sB(this)}getOptions(e){return cn(this.options,e)}getOption(e){return cn(this.options,e)}async handleEvent(e){var i,r,a;if(nl(this)){if(sH(e)){if(!np(e.origin,null!=(i=this.options.originValidator)?i:"none"))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");let{action:r}=e.data;if("execute-command"===r){let i=sV(e.data.command);if(!i||"virtual-keyboard"===sF(i))return;this.executeCommand(i)}else"update-state"===r||("focus"===r?this.focus({preventScroll:!0}):"blur"===r&&this.blur());return}switch(e.type){case"focus":this.programmaticFocusInProgress||this.onFocus({suppressEvents:!0});break;case"blur":this.onBlur({dispatchEvents:!1});break;case"mousedown":"none"===this.userSelect||null!=(r=e.target)&&r.closest("[part=virtual-keyboard-toggle],[part=menu-toggle]")||cG(this,e);break;case"pointerdown":!e.defaultPrevented&&"none"!==this.userSelect&&!(null!=(a=e.target)&&a.closest("[part=virtual-keyboard-toggle],[part=menu-toggle]"))&&(cG(this,e),!1===e.shiftKey&&await d_(e,this.container,this.menu)&&cU.stop());break;case"contextmenu":"none"!==this.userSelect&&!1===e.shiftKey&&await d_(e,this.container,this.menu)&&cU.stop();break;case"virtual-keyboard-toggle":this.hasFocus()&&dt(this),this.hasFocus()&&"manual"!==this.options.mathVirtualKeyboardPolicy&&(this.focusBlurInProgress=!0,this.keyboardDelegate.blur(),this.keyboardDelegate.focus(),this.focusBlurInProgress=!1);break;case"resize":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>nl(this)&&this.onGeometryChange());break;case"scroll":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>nl(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 i=this.host.offsetHeight,r=e.classList.contains("ML__toggles--vertical");i>=100&&!r?e.classList.add("ML__toggles--vertical"):i<100&&r&&e.classList.remove("ML__toggles--vertical")}dispose(){if(!nl(this))return;I.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,document.getElementById("mathlive-keystroke-caption-panel")&&(sb("mathlive-keystroke-caption-panel"),nz("core"),nz("keystroke-caption")),document.getElementById("mathlive-suggestion-popover")&&(sb("mathlive-suggestion-popover"),nz("suggestion-popover"),nz("core")),document.getElementById("mathlive-environment-popover")&&(sb("mathlive-environment-popover"),nz("environment-popover"),nz("core"))}flushInlineShortcutBuffer(e){if(null!=e||(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"virtual-keyboard"===sF(e)?(this.focus({preventScroll:!0}),window.mathVirtualKeyboard.executeCommand(e),requestAnimationFrame(()=>window.mathVirtualKeyboard.update(c4(this))),!1):function(e,i){var r,a;if(!(i=sV(i)))return!1;let o,n=[],l=!1,s=!1;R(i)?(o=i[0],n=i.slice(1)):o=i;let c=sW[o],d=null==c?void 0:c.target;if("model"===d){if(!e.isSelectionEditable&&null!=c&&c.changeContent)return e.model.announce("plonk"),!1;/^(delete|add)/.test(o)&&("deleteBackward"!==o&&e.flushInlineShortcutBuffer(),e.snapshot(o)),/^complete/.test(o)||sh(e),sW[o].fn(e.model,...n),sp(e),s=!0,l=!0}else if("virtual-keyboard"===d)s=null!=(a=null==(r=window.mathVirtualKeyboard)?void 0:r.executeCommand(i))&&a,l=!0;else if(sW[o]){if(!e.isSelectionEditable&&null!=c&&c.changeContent)return e.model.announce("plonk"),!1;/^(undo|redo)/.test(o)&&e.flushInlineShortcutBuffer(),s=sW[o].fn(e,...n),l=!0}else throw Error(`Unknown command "${o}"`);return"virtual-keyboard"!==d&&(!e.model.selectionIsCollapsed||null!=c&&c.changeSelection&&"deleteBackward"!==o)&&(e.flushInlineShortcutBuffer(),null!=c&&c.changeContent||e.stopCoalescingUndo(),e.defaultStyle={}),s&&(null!=c&&c.changeSelection&&l?(e.dirty=!0,e.scrollIntoView()):sB(e)),l}(this,e)}get errors(){return ls(this.model.getValue(),{context:this.context})}getValue(e,i,r){return this.model.getValue(e,i,r)}setValue(e,i){var r;void 0===(i=null!=i?i:{mode:"math"}).insertionMode&&(i.insertionMode="replaceAll"),(void 0===i.format||"auto"===i.format)&&(i.format="latex"),(void 0===i.mode||"auto"===i.mode)&&(i.mode=null!=(r=function(e,i){let r=e.at(i),a;if(r){a=r.mode;let e=r.parent;for(;!a&&e;)e&&(a=e.mode),e=e.parent}return a}(this.model,this.model.position))?r:"math");let a=this.undoManager.canUndo();na.insert(this.model,e,i)&&(sB(this),a||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.110.8: no compute engine available. Make sure the Compute Engine library is loaded."),null)}scrollIntoView(){var e;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 i=window.mathVirtualKeyboard.boundingRect,r=this.host.getBoundingClientRect();r.bottom>i.top&&(null==(e=window.document.scrollingElement)||e.scrollBy(0,r.bottom-i.top+8))}}this.dirty&&sP(this,{interactive:!0});let i=this.field.getBoundingClientRect(),r=null;if(this.model.selectionIsCollapsed)r=ns(this.field);else{let e=nh(this);if(e.length>0){let a=-1/0,o=1/0,n=-1/0;for(let i of e)i.right>a&&(a=i.right),i.top<o&&(o=i.top),i.bottom>n&&(n=i.bottom);let l=n-o;r={x:a+i.left-this.field.scrollLeft,y:o+i.top-this.field.scrollTop,height:l}}}if(this.host&&r){let e=this.host.getBoundingClientRect(),i=r.y,a=r.y+r.height,o=this.host.scrollTop;i<e.top+20?o=i-e.top+this.host.scrollTop-20:a>e.bottom-20&&(o=a-e.bottom+this.host.scrollTop+20),o!==this.host.scrollTop&&this.host.scroll({top:o,behavior:"auto"})}if(r){let e=r.x-window.scrollX,a=this.field.scrollLeft;e<i.left?a=e-i.left+this.field.scrollLeft-20:e>i.right&&(a=e-i.right+this.field.scrollLeft+20),this.field.scroll({top:this.field.scrollTop,left:a})}}insert(e,i){if("string"!=typeof e||0===e.length&&((null==i?void 0:i.insertionMode)==="insertBefore"||(null==i?void 0:i.insertionMode)==="insertAfter")||0===e.length&&this.model.selectionIsCollapsed)return!1;if(this.flushInlineShortcutBuffer(),(i=null!=i?i:{mode:"math"}).focus&&this.focus(),i.feedback&&(globalThis.MathfieldElement.keypressVibration&&_()&&navigator.vibrate(3),globalThis.MathfieldElement.playSound("keypress")),"\\\\"===e&&this.model.parentEnvironment)cp(this.model);else if("&"===e&&this.model.parentEnvironment)cm(this.model);else if(this.model.selectionIsCollapsed){let r=f({},sd(this));/^[a-zA-Z0-9]$/.test(e)||"none"===this.styleBias||(r.variant="normal",r.variantStyle=void 0),na.insert(this.model,e,f({style:r},i))}else na.insert(this.model,e,i);return this.snapshot(`insert-${this.model.at(this.model.position).type}`),sB(this),i.scrollIntoView&&this.scrollIntoView(),!0}switchMode(e,i="",r=""){if(this.model.mode===e||!this.hasEditableContent||!this.contentEditable||this.disabled)return;let{model:a}=this,o=a.mode;if(a.mode=e,this.host&&!this.host.dispatchEvent(new Event("mode-change",{bubbles:!0,composed:!0,cancelable:!0}))){a.mode=o;return}a.mode=o,a.deferNotifications({content:!!r||!!i,selection:!0,type:"insertText"},()=>{let o=a.at(a.position),n=(e,i)=>{if(!e)return;let r="math"===a.mode?ll(o6(e,{format:"ascii-math"})[1],{context:this.context}):[...e].map(e=>new oY(e,e,{}));if(i.select){let e=o.parent.addChildrenAfter(r,o);a.setSelection(a.offsetOf(r[0].leftSibling),a.offsetOf(e))}else a.position=a.offsetOf(o.parent.addChildrenAfter(r,o));c=!0},l=(e,i)=>{let r=new l_(e);o.parent.addChildAfter(r,o),i.select?a.setSelection(a.offsetOf(r.firstChild),a.offsetOf(r.lastChild)):a.position=a.offsetOf(r.lastChild),c=!0},s=()=>{let i="latex"===e?"latex":"math"===e?"plain-text":"ascii-math",n=oQ(a.selection),l=this.model.getValue(n,i),s=this.model.extractAtoms(n);return 1===s.length&&"placeholder"===s[0].type&&(l=r),o=a.at(n[0]),l},c=!1;if(this.flushInlineShortcutBuffer(),this.stopCoalescingUndo(),sf(this,"accept"),a.selectionIsCollapsed)n(i,{select:!1}),a.mode=e,"latex"===e?l(r,{select:!1}):n(r,{select:!1});else{let i=s();a.mode=e,"latex"===e?l(i,{select:!0}):n(i,{select:!0})}return sB(this),this.undoManager.snapshot("latex"===e?"insert-latex":"insert"),c}),a.mode=e,window.mathVirtualKeyboard.update(c4(this))}hasFocus(){return!this.blurred}focus(e){var i;this.disabled||this.focusBlurInProgress||(this.hasFocus()||(this.programmaticFocusInProgress=!0,this.onFocus(),this.model.announce("line")),null!=(i=null==e?void 0:e.preventScroll)&&i||this.scrollIntoView())}blur(){this.disconnectFromVirtualKeyboard(),this.hasFocus()&&this.keyboardDelegate.blur()}select(){this.model.selection={ranges:[[0,this.model.lastOffset]]},this.focus()}applyStyle(e,i={}){var r;let a,o="set",n=!1;o1(i)?a=i:("toggle"===i.operation&&(o="toggle"),a=i.range,n=null!=(r=i.silenceNotifications)&&r),a&&(a=this.model.normalizeRange(a)),a&&a[0]===a[1]&&(a=void 0);let l=ss(this,e);if(void 0===a&&this.model.selectionIsCollapsed){if("set"===o){let e=f({},this.defaultStyle);"color"in l&&delete e.verbatimColor,"backgroundColor"in l&&delete e.verbatimBackgroundColor,this.defaultStyle=f(f({},e),l),this.styleBias="none";return}let e=sd(this),i=f({},this.defaultStyle);for(let r of Object.keys(l))e[r]===l[r]?("color"===r&&delete i.verbatimColor,"backgroundColor"===r&&delete i.verbatimBackgroundColor,delete i[r]):i[r]=l[r];this.defaultStyle=i,this.styleBias="none";return}this.model.deferNotifications({content:!n,type:"insertText"},()=>{if(void 0===a)for(let e of this.model.selection.ranges)lN(this.model,e,l,{operation:o});else lN(this.model,a,l,{operation:o})}),sB(this)}toggleContextMenu(){var e;let i=this.menu;if(!i.visible)return!1;if("open"===i.state)return i.hide(),!0;let r=null==(e=nf(this,this.model.position))?void 0:e.bounds;if(!r)return!1;let a={x:r.right,y:r.bottom};return i.show({target:this.element.querySelector("[part=container]"),location:a,onDismiss:()=>{var e;return null==(e=this.element)?void 0:e.focus()}}),!0}getPrompt(e){return this.model.findAtom(i=>"prompt"===i.type&&i.placeholderId===e)}getPromptValue(e,i){let r=this.getPrompt(e);if(!r)return"";let a=this.model.offsetOf(r.firstChild),o=this.model.offsetOf(r.lastChild);return this.model.getValue(a,o,i)}getPrompts(e){return this.model.atoms.filter(i=>"prompt"===i.type&&(!e||!(e.id&&i.placeholderId!==e.id||e.locked&&i.locked!==e.locked||"undefined"===e.correctness&&i.correctness||e.correctness&&i.correctness!==e.correctness))).map(e=>e.placeholderId)}setPromptValue(e,i,r){if(void 0!==i){let a=this.getPrompt(e);if(!a)return void console.error(`MathLive 0.110.8: unknown prompt ${e}`);let o=this.model.getBranchRange(this.model.offsetOf(a),"body");this.model.setSelection(o),this.insert(i,g(f({},r),{insertionMode:"replaceSelection"}))}null!=r&&r.silenceNotifications&&(this.valueOnFocus=this.getValue()),sB(this)}setPromptState(e,i,r){let a=this.getPrompt(e);a?("undefined"===i?a.correctness=void 0:"string"==typeof i&&(a.correctness=i),"boolean"==typeof r&&(a.locked=r,a.captureSelection=r),sB(this)):console.error(`MathLive 0.110.8: unknown prompt ${e}`)}getPromptState(e){let i=this.getPrompt(e);return i?[i.correctness,i.locked]:(console.error(`MathLive 0.110.8: unknown prompt ${e}`),[void 0,!0])}getPromptRange(e){let i=this.getPrompt(e);return i?this.model.getBranchRange(this.model.offsetOf(i),"body"):(console.error(`MathLive 0.110.8: 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(c4(this))}snapshot(e){var i;this.undoManager.snapshot(e)&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(c4(this)),null==(i=this.host)||i.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()&&(null==(e=this.host)||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}redo(){var e;this.undoManager.redo()&&(null==(e=this.host)||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"redo"}})))}resetUndo(){var e;null==(e=this.undoManager)||e.reset()}onSelectionDidChange(){var e,i;let r=this.model;if(r.mathfield.hasFocus()&&this.keyboardDelegate.setValue(r.getValue(r.selection,"latex-expanded")),r.selectionIsCollapsed){let i=so(r),a=r.position,o=r.at(a),n=null!=(e=o.mode)?e:cs(this.options);if(i&&(a<r.offsetOf(i.firstChild)||a>r.offsetOf(i.lastChild))){sf(this,"accept",{mode:n});let e=r.offsetOf(o);e>=0&&(r.position=e)}else{let e=r.at(a+1);(null==e?void 0:e.type)==="first"&&"latex"===e.mode?r.position=a+1:i&&(null==e?void 0:e.mode)!=="latex"?r.position=a-1:this.switchMode(n)}}null==(i=this.host)||i.dispatchEvent(new Event("selection-change",{bubbles:!0,composed:!0})),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(c4(this)),dt(this)}onContentWillChange(e){var i,r,a;return null==(a=null==(r=this.host)?void 0:r.dispatchEvent(new InputEvent("beforeinput",g(f({},e),{data:e.data?e.data:null!=(i=e.inputType)?i:"",cancelable:!0,bubbles:!0,composed:!0}))))||a}onFocus(i){if(this.disabled||this.focusBlurInProgress||!this.blurred)return;let r=e._globallyFocusedMathfield;r&&r!==this&&!r.disabled&&r.hasFocus()&&r.onBlur({dispatchEvents:!0}),this.focusBlurInProgress=!0,this.blurred=!1,e._globallyFocusedMathfield=this,this.stopCoalescingUndo(),this.valueOnFocus=this.model.getValue(),this.hasEditablePrompts&&!this.model.at(this.model.anchor).parentPrompt&&this.executeCommand("moveToNextPlaceholder"),sP(this,{interactive:!0}),setTimeout(()=>{var e,r;if(nl(this))if(null!=(e=null==i?void 0:i.suppressEvents)&&e){let e=new AbortController,i=e.signal,a=e=>{e.preventDefault(),e.stopPropagation()};for(let e of["focus","focusin"])null==(r=this.host)||r.addEventListener(e,a,{capture:!0,signal:i});this.focusBlurInProgress=!1,this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),setTimeout(()=>e.abort(),0)}else this.focusBlurInProgress=!1,this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),setTimeout(()=>{this.programmaticFocusInProgress=!1},0)},60)}onBlur(i){var r,a,o,n;if(!this.focusBlurInProgress&&!this.blurred&&(this.focusBlurInProgress=!0,this.stopCoalescingUndo(),this.blurred=!0,e._globallyFocusedMathfield===this&&(e._globallyFocusedMathfield=void 0),this.ariaLiveText&&(this.ariaLiveText.textContent=""),sM(this),this.model.getValue()!==this.valueOnFocus&&(null==(r=this.host)||r.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),this.disconnectFromVirtualKeyboard(),(null==(a=null==i?void 0:i.dispatchEvents)||a)&&(null==(o=this.host)||o.dispatchEvent(new Event("blur",{bubbles:!1,composed:!0})),null==(n=this.host)||n.dispatchEvent(new UIEvent("focusout",{bubbles:!0,composed:!0}))),sB(this),this.focusBlurInProgress=!1,de(),uO.restoreFocusWhenDocumentFocused)){let e=new AbortController,i=e.signal;window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{nl(this)&&this.focus({preventScroll:!0})},{once:!0,signal:i})},{once:!0,signal:i}),document.addEventListener("focusin",()=>e.abort(),{once:!0}),document.addEventListener("click",()=>e.abort(),{once:!0})}}onInput(e){cN(this,e)}onKeystroke(e){return cR(this,e)}onCompositionStart(e){cx(this.model,oQ(this.model.selection),"insertText");let i=ns(this.field);i&&requestAnimationFrame(()=>{sP(this),this.keyboardDelegate.moveTo(i.x,i.y-i.height)})}onCompositionUpdate(e){(function(e,i){let r=e.at(e.position);if("composition"===r.type)r.value=i;else{let{caret:a}=r;r.caret=void 0;let o=new n5(i,{mode:r.mode});o.caret=a,r.parent.addChildAfter(o,r),e.position+=1}})(this.model,e),sB(this)}onCompositionEnd(e){var i;let r;"composition"===(r=(i=this.model).at(i.position)).type&&(r.parent.removeChild(r),i.position-=1),cN(this,e,{simulateKeystroke:!0})}onCut(e){this.isSelectionEditable?this.model.contentWillChange({inputType:"deleteByCut"})&&(this.stopCoalescingUndo(),e.clipboardData?na.onCopy(this,e):na.copyToClipboard(this,"latex"),cx(this.model,oQ(this.model.selection),"deleteByCut"),this.snapshot("cut"),sB(this)):this.model.announce("plonk")}onCopy(e){e.clipboardData?na.onCopy(this,e):na.copyToClipboard(this,"latex")}onPaste(e){let i=this.isSelectionEditable;return i&&(i=na.onPaste(this.model.at(this.model.position).mode,this,e.clipboardData)),i||this.model.announce("plonk"),e.preventDefault(),e.stopPropagation(),i}onGeometryChange(){var e;null==(e=this._menu)||e.hide(),sk(this),dt(this)}onWheel(e){let i=5*e.deltaX;if(!Number.isFinite(i)||0===i)return;let r=this.field;i<0&&0===r.scrollLeft||i>0&&r.offsetWidth+r.scrollLeft>=r.scrollWidth||(r.scrollBy({top:0,left:i}),e.preventDefault(),e.stopPropagation())}getHTMLElement(e){let i=e;for(;!i.id&&i.hasChildren;)i=e.children[0];return this.field.querySelector(`[data-atom-id="${i.id}"]`)}get context(){var e,i;return{registers:null!=(e=this.options.registers)?e:{},smartFence:this.smartFence,letterShapeStyle:this.letterShapeStyle,minFontScale:this.minFontScale,maxMatrixCols:this.maxMatrixCols,placeholderSymbol:null!=(i=this.options.placeholderSymbol)?i:"▢",colorMap:e=>this.colorMap(e),backgroundColorMap:e=>this.backgroundColorMap(e),getMacro:e=>eS(e,this.options.macros),atomIdsSettings:{seed:"random",groupNumbers:!1}}}};sN({speak:(e,i,r)=>(function(e,i,r){var a;r=null!=r?r:{withHighlighting:!1};let{model:o}=e,n=globalThis.MathfieldElement,l=function(e){let i=null;switch(e){case"all":default:i=o.root;break;case"selection":i=o.getAtoms(o.selection);break;case"left":i=o.getAtoms(o.offsetOf(o.at(o.position).leftSibling),o.position);break;case"right":i=o.getAtoms(o.position,o.offsetOf(o.at(o.position).rightSibling));break;case"group":i=o.getAtoms(o.getSiblingsRange(o.position));break;case"parent":{let{parent:e}=o.at(o.position);i=null!=e&&e.parent?e:o.root}}return i}(i);if(null===l)return null==(a=n.speakHook)||a.call(n,function(e){let i="";switch(e){case"all":console.error("Internal failure: speak all failed");break;case"selection":i="no selection";break;case"left":i="at start";break;case"right":i="at end";break;case"group":console.error("Internal failure: speak group failed");break;case"parent":i="no parent";break;default:console.error('unknown speak_ param value: "'+e+'"')}return i}(i)),!1;(r.withHighlighting||"amazon"===n.speechEngine)&&(n.textToSpeechMarkup=globalThis.sre&&"sre"===n.textToSpeechRules?"ssml_step":"ssml");let s=dN(l);return v()&&r.withHighlighting?(uX().readAloudMathfield=e,sP(e,{forHighlighting:!0}),n.readAloudHook&&n.readAloudHook(e.field,s)):n.speakHook&&n.speakHook(s),!1})(e,i,r)},{target:"mathfield"}),v()||console.error('MathLive 0.110.8: this version of the MathLive library is for use in the browser. A subset of the API is available on the server side in the "mathlive-ssr" library. If using server side rendering (with React for example) you may want to do a dynamic import of the MathLive library inside a `useEffect()` call.');var uS=new WeakMap,uL={letterShapeStyle:"mf.letterShapeStyle = ...",horizontalSpacingScale:'Removed. Use `"thinmuskip"`, `"medmuskip"`, and `"thickmuskip"` registers ',macros:"mf.macros = ...",registers:"mf.registers = ...",backgroundColorMap:"mf.backgroundColorMap = ...",colorMap:"mf.colorMap = ...",enablePopover:"mf.popoverPolicy = ...",mathModeSpace:"mf.mathModeSpace = ...",placeholderSymbol:"mf.placeholderSymbol = ...",readOnly:"mf.readOnly = ...",removeExtraneousParentheses:"mf.removeExtraneousParentheses = ...",scriptDepth:"mf.scriptDepth = ...",smartFence:"mf.smartFence = ...",smartMode:"mf.smartMode = ...",smartSuperscript:"mf.smartSuperscript = ...",inlineShortcutTimeout:"mf.inlineShortcutTimeout = ...",inlineShortcuts:"mf.inlineShortcuts = ...",keybindings:"mf.keybindings = ...",virtualKeyboardMode:"mf.mathVirtualKeyboardPolicy = ...",customVirtualKeyboardLayers:"mathVirtualKeyboard.layers = ...",customVirtualKeyboards:"mathVirtualKeyboard.layouts = ...",keypressSound:"mathVirtualKeyboard.keypressSound = ...",keypressVibration:"mathVirtualKeyboard.keypressVibration = ...",plonkSound:"mathVirtualKeyboard.plonkSound = ...",virtualKeyboardContainer:"mathVirtualKeyboard.container = ...",virtualKeyboardLayout:"mathVirtualKeyboard.alphabeticLayout = ...",virtualKeyboardTheme:"No longer supported",virtualKeyboardToggleGlyph:"No longer supported",virtualKeyboardToolbar:"mathVirtualKeyboard.editToolbar = ...",virtualKeyboards:"Use `mathVirtualKeyboard.layouts`",speechEngine:"`MathfieldElement.speechEngine`",speechEngineRate:"`MathfieldElement.speechEngineRate`",speechEngineVoice:"`MathfieldElement.speechEngineVoice`",textToSpeechMarkup:"`MathfieldElement.textToSpeechMarkup`",textToSpeechRules:"`MathfieldElement.textToSpeechRules`",textToSpeechRulesOptions:"`MathfieldElement.textToSpeechRulesOptions`",readAloudHook:"`MathfieldElement.readAloudHook`",speakHook:"`MathfieldElement.speakHook`",computeEngine:"`MathfieldElement.computeEngine`",fontsDirectory:"`MathfieldElement.fontsDirectory`",soundsDirectory:"`MathfieldElement.soundsDirectory`",createHTML:"`MathfieldElement.createHTML`",onExport:"`mf.onExport`",onInlineShortcut:"`mf.onInlineShortcut`",onScrollIntoView:"`mf.onScrollIntoView`",locale:"MathfieldElement.locale = ...",strings:"MathfieldElement.strings = ...",decimalSeparator:"MathfieldElement.decimalSeparator = ...",fractionNavigationOrder:"MathfieldElement.fractionNavigationOrder = ..."},uC=class e extends HTMLElement{constructor(e){if(super(),this._observer=null,e){let i=[];for(let r of Object.keys(e))if(uL[r])if(uL[r].startsWith("mf."))if(uL[r].startsWith(`mf.${r}`))i.push(`Option \`${r}\` cannot be used as a constructor option. Use ${uL[r]}`);else{let e=uL[r].match(/([a-zA-Z]+) =/);i.push(`Option \`${r}\` has been renamed \`${e[1]}\``)}else i.push(`Option \`${r}\` cannot be used as a constructor option. Use ${uL[r]}`);if(i.length>0){for(let e of(console.group("%cMathLive 0.110.8: %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."),i))console.warn(e);console.groupEnd()}}if(uT()&&(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=[nE("core"),nE("mathfield"),nE("mathfield-element"),nE("ui"),nE("menu")],this.shadowRoot.appendChild(document.createElement("span"));let e=document.createElement("slot");e.style.display="none",this.shadowRoot.appendChild(e)}else this.shadowRoot.innerHTML="<style>"+nC("core")+nC("mathfield")+nC("mathfield-element")+nC("ui")+nC("menu")+'</style><span></span><slot style="display:none"></slot>';e&&this._setOptions(e)}static get formAssociated(){return uT()}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(e){e!==this._fontsDirectory&&(this._fontsDirectory=e,sD())}get fontsDirectory(){throw Error("Use MathfieldElement.fontsDirectory instead")}set fontsDirectory(e){throw Error("Use MathfieldElement.fontsDirectory instead")}static get stylesheetScope(){return nS}static set stylesheetScope(e){e!==nS&&(nS=e,ng={})}get stylesheetScope(){throw Error("Use MathfieldElement.stylesheetScope instead")}set stylesheetScope(e){throw Error("Use MathfieldElement.stylesheetScope instead")}static get soundsDirectory(){return this._soundsDirectory}static set soundsDirectory(e){this._soundsDirectory=e,this.audioBuffers={}}get soundsDirectory(){throw Error("Use MathfieldElement.soundsDirectory instead")}set soundsDirectory(e){throw Error("Use MathfieldElement.soundsDirectory instead")}static get keypressSound(){return this._keypressSound}static set keypressSound(e){var i,r,a;this.audioBuffers={},null===e?this._keypressSound={spacebar:null,return:null,delete:null,default:null}:"string"==typeof e?this._keypressSound={spacebar:e,return:e,delete:e,default:e}:"object"==typeof e&&"default"in e&&(this._keypressSound={spacebar:null!=(i=e.spacebar)?i:e.default,return:null!=(r=e.return)?r:e.default,delete:null!=(a=e.delete)?a:e.default,default:e.default})}static get plonkSound(){return this._plonkSound}static set plonkSound(e){this.audioBuffers={},this._plonkSound=e}static get audioContext(){return this._audioContext||(this._audioContext=new AudioContext),this._audioContext}static get speechEngine(){return this._speechEngine}static set speechEngine(e){this._speechEngine=e}static get speechEngineRate(){return this._speechEngineRate}static set speechEngineRate(e){this._speechEngineRate=e}static get speechEngineVoice(){return this._speechEngineVoice}static set speechEngineVoice(e){this._speechEngineVoice=e}static get textToSpeechMarkup(){return this._textToSpeechMarkup}static set textToSpeechMarkup(e){this._textToSpeechMarkup=e}static get textToSpeechRules(){return this._textToSpeechRules}static set textToSpeechRules(e){this._textToSpeechRules=e}static get textToSpeechRulesOptions(){return this._textToSpeechRulesOptions}static set textToSpeechRulesOptions(e){this._textToSpeechRulesOptions=e}static get locale(){return I.locale}static set locale(e){"auto"===e&&(e=navigator.language.slice(0,5)),I.locale=e}get locale(){throw Error("Use MathfieldElement.locale instead")}set locale(e){throw Error("Use MathfieldElement.locale instead")}static get strings(){return I.strings}static set strings(e){I.merge(e)}get strings(){throw Error("Use MathfieldElement.strings instead")}set strings(e){throw Error("Use MathfieldElement.strings instead")}static get decimalSeparator(){return this._decimalSeparator}static set decimalSeparator(e){this._decimalSeparator=e,this._computeEngine&&console.warn("MathLive 0.110.8: setting MathfieldElement.decimalSeparator after the Compute Engine has been created has no effect on the engine. Reassign MathfieldElement.computeEngine with a freshly configured instance to apply the new separator.")}get decimalSeparator(){throw Error("Use MathfieldElement.decimalSeparator instead")}set decimalSeparator(e){throw Error("Use MathfieldElement.decimalSeparator instead")}static set scientificNotationTemplate(e){this._scientificNotationTemplate=e}static get scientificNotationTemplate(){return this._scientificNotationTemplate}static get fractionNavigationOrder(){return o$.fractionNavigationOrder}static set fractionNavigationOrder(e){if("numerator-denominator"!==e&&"denominator-numerator"!==e)throw Error("Invalid value");o$.fractionNavigationOrder!==e&&(o$.fractionNavigationOrder=e,sI())}static get compactSerialization(){return o$.compactSerialization}static set compactSerialization(e){o$.compactSerialization=!!e}static get computeEngine(){var e,i;if(void 0===this._computeEngine){let i=window[Symbol.for("io.cortexjs.compute-engine")],r=null==i?void 0:i.ComputeEngine;if(!r)return null;if(this._computeEngine=new r,this._computeEngine&&","===this.decimalSeparator){let[r,a]=String(null!=(e=null==i?void 0:i.version)?e:"").split(".").map(e=>parseInt(e,10));(r>0||0===r&&a>=58)&&(this._computeEngine.latexOptions=g(f({},this._computeEngine.latexOptions),{decimalSeparator:"{,}"}))}}return null!=(i=this._computeEngine)?i:null}static set computeEngine(e){this._computeEngine=e}get computeEngine(){throw Error("Use MathfieldElement.computeEngine instead")}set computeEngine(e){throw Error("Use MathfieldElement.computeEngine instead")}static get isFunction(){return"function"!=typeof this._isFunction?()=>!1:this._isFunction}static set isFunction(e){this._isFunction=e,sI()}static async loadSound(e){delete this.audioBuffers[e];let i="";switch(e){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}if("string"!=typeof i)return;i=i.trim();let r=this.soundsDirectory;if(null!=r&&"null"!==r&&"none"!==i&&"null"!==i)try{let a=await (await fetch(await sz(`${r}/${i}`))).arrayBuffer(),o=await this.audioContext.decodeAudioData(a);this.audioBuffers[e]=o}catch(e){}}static async playSound(e){if(("suspended"===this.audioContext.state||"interrupted"===this.audioContext.state)&&await this.audioContext.resume(),this.audioBuffers[e]||await this.loadSound(e),!this.audioBuffers[e])return;let i=this.audioContext.createBufferSource();i.buffer=this.audioBuffers[e];let r=this.audioContext.createGain();r.gain.value=.5,i.connect(r).connect(this.audioContext.destination),i.start()}showMenu(e){var i,r;return null!=(r=null==(i=this._mathfield)?void 0:i.showMenu(e))&&r}get mathVirtualKeyboard(){throw Error("The `mathVirtualKeyboard` property is not available on the MathfieldElement. Use `window.mathVirtualKeyboard` instead.")}onPointerDown(){window.addEventListener("pointerup",i=>{let r=this._mathfield;if(r&&i.target===this&&!r.disabled){this.dispatchEvent(new MouseEvent("click",{altKey:i.altKey,button:i.button,buttons:i.buttons,clientX:i.clientX,clientY:i.clientY,ctrlKey:i.ctrlKey,metaKey:i.metaKey,movementX:i.movementX,movementY:i.movementY,relatedTarget:i.relatedTarget,screenX:i.screenX,screenY:i.screenY,shiftKey:i.shiftKey}));let a=this.getOffsetFromPoint(i.clientX,i.clientY);a>=0&&e.openUrl(function(e,i){let r=e.model.at(i);for(;r;){if("\\href"===r.command){let e=r.args[0];if("string"==typeof e)return e}r=r.parent}return""}(r,a)),"touch"===i.pointerType&&this.selectionIsCollapsed&&(this.position=a)}},{once:!0})}getPromptValue(e,i){var r,a;return null!=(a=null==(r=this._mathfield)?void 0:r.getPromptValue(e,i))?a:""}setPromptValue(e,i,r){var a;null==(a=this._mathfield)||a.setPromptValue(e,i,r)}getPromptRange(e){var i,r;return null!=(r=null==(i=this._mathfield)?void 0:i.getPromptRange(e))?r:null}getPrompts(e){var i,r;return null!=(r=null==(i=this._mathfield)?void 0:i.getPrompts(e))?r:[]}get hasEditableContent(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.hasEditableContent)&&i}get form(){var e;return null==(e=this._internals)?void 0:e.form}get name(){var e;return null!=(e=this.getAttribute("name"))?e:""}get type(){return this.localName}get mode(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.model.mode)?i:"text"===this.defaultMode?"text":"math"}set mode(e){var i;null==(i=this._mathfield)||i.switchMode(e)}get expression(){if(this._mathfield)return window[Symbol.for("io.cortexjs.compute-engine")]?this._mathfield.expression:(console.error(`MathLive 0.110.8: The CortexJS Compute Engine library is not available.
3465
3491
 
3466
3492
  Load the library, for example with:
3467
3493
 
3468
- import "https://esm.run/@cortex-js/compute-engine"`),null)}set expression(i){var r,a;if(!this._mathfield)return;let o=null!=(a=null==(r=e.computeEngine)?void 0:r.box(i).latex)?a:null;null!==o&&this._mathfield.setValue(o),window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`MathLive 0.110.6: The Compute Engine library is not available.
3494
+ import "https://esm.run/@cortex-js/compute-engine"`),null)}set expression(i){var r,a;if(!this._mathfield)return;let o=null!=(a=null==(r=e.computeEngine)?void 0:r.box(i).latex)?a:null;null!==o&&this._mathfield.setValue(o),window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`MathLive 0.110.8: The Compute Engine library is not available.
3469
3495
 
3470
3496
  Load the library, for example with:
3471
3497
 
3472
- import "https://esm.run/@cortex-js/compute-engine"`)}get errors(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.errors)?i:[]}_getOptions(e){return this._mathfield?ct(this._mathfield.options,e):ux.has(this)?f({},ct(f(f({},ci()),ce(ux.get(this).options)),e)):null}getOptions(e){return console.warn("%cMathLive 0.110.6: %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?ct(this._mathfield.options,e):ux.has(this)?ct(f(f({},ci()),ce(ux.get(this).options)),e):null}reflectAttributes(){let i=ci(),r=this._getOptions();Object.keys(e.optionsAttributes).forEach(a=>{let o="placeholder"===a?"contentPlaceholder":uM(a);"on/off"===e.optionsAttributes[a]?i[o]!==r[o]?this.setAttribute(a,r[o]?"on":"off"):this.removeAttribute(a):i[o]!==r[o]&&("boolean"===e.optionsAttributes[a]?r[o]?this.setAttribute(a,""):this.removeAttribute(a):("string"==typeof r[o]||"number"==typeof r[o])&&this.setAttribute(a,r[o].toString()))})}getOption(e){return console.warn("%cMathLive 0.110.6: %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([e])[e]}_getOption(e){return this._getOptions([e])[e]}_setOptions(e){if(this._mathfield)this._mathfield.setOptions(e);else if(ux.has(this)){let i=f(f({},ux.get(this).options),e);ux.set(this,g(f({},ux.get(this)),{selection:{ranges:i.readOnly?[[0,0]]:[[0,-1]]},options:i}))}else ux.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:e,menuItems:void 0});this.reflectAttributes()}setOptions(e){for(let i of(console.group("%cMathLive 0.110.6: %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."),Object.keys(e)))u_[i]&&console.warn(`\`mf.setOptions({${i}:...})\` -> ${u_[i]}`);console.groupEnd(),this._setOptions(e)}executeCommand(...e){var i,r;let a;if(a=1===e.length?e[0]:[e[0],...e.slice(1)])return null!=(r=null==(i=this._mathfield)?void 0:i.executeCommand(a))&&r;throw Error("Invalid selector")}getValue(e,i,r){var a,o;if(this._mathfield)return this._mathfield.model.getValue(e,i,r);if(ux.has(this)){let n,l,s;if(o4(e)?([n,l]=e.ranges[0],s=i):o1(e)?([n,l]=e,s=i):o0(e)&&o0(i)?(n=e,l=i,s=r):(n=0,l=-1,s=e),(void 0===s||"latex"===s)&&0===n&&-1===l)return null!=(o=null!=(a=ux.get(this).value)?a:this.textContent)?o:""}return""}setValue(e,i){if(this._mathfield&&void 0!==e){if(this._mathfield.model.getValue()===e)return;null!=i||(i={silenceNotifications:!0,mode:"math"}),this._mathfield.setValue(e,i);return}if(ux.has(this)){let i=ux.get(this).options;ux.set(this,{value:e,selection:{ranges:[[-1,-1]],direction:"forward"},options:i,menuItems:void 0});return}let r=uS(this);ux.set(this,{value:e,selection:{ranges:[[-1,-1]],direction:"forward"},options:r,menuItems:void 0})}hasFocus(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.hasFocus())&&i}focus(){var e;this.disabled||null==(e=this._mathfield)||e.focus()}blur(){var e;null==(e=this._mathfield)||e.blur()}select(){var e;null==(e=this._mathfield)||e.select()}insert(e,i){var r,a;return null!=(a=null==(r=this._mathfield)?void 0:r.insert(e,i))&&a}applyStyle(e,i){var r;return null==(r=this._mathfield)?void 0:r.applyStyle(e,i)}queryStyle(e){var i,r;return null!=(r=null==(i=this._mathfield)?void 0:i.queryStyle(e))?r:"none"}getOffsetFromPoint(e,i,r){return this._mathfield?cW(this._mathfield,e,i,r):-1}getElementInfo(e){return nf(this._mathfield,e)}resetUndo(){var e;null==(e=this._mathfield)||e.resetUndo()}canUndo(){return!!this._mathfield&&this._mathfield.canUndo()}canRedo(){return!!this._mathfield&&this._mathfield.canRedo()}handleEvent(e){var i,r,a,o,n;if("closed"!==l3.state||(null==(r=null==(i=this._mathfield)?void 0:i.menu)?void 0:r.state)!=="closed"||("pointerdown"===e.type&&this.onPointerDown(),"focus"===e.type)||"blur"!==e.type)return;let l=x();l&&null!=(a=null==window?void 0:window.mathVirtualKeyboard)&&a.visible||(null==(o=l3.scrim)?void 0:o.state)!=="closed"||l&&function(){try{return window.self!==window.top}catch(e){return!0}}()||null==(n=this._mathfield)||n.onBlur({dispatchEvents:!1})}connectedCallback(){var i,r,a,o;let n=this.shadowRoot,l=n.host,s="none"!==window.getComputedStyle(this).userSelect;s?l.addEventListener("pointerdown",this,!0):n.querySelector("span").style.pointerEvents="none",l.addEventListener("focus",this,!0),l.addEventListener("blur",this,!0),this._observer=new MutationObserver(()=>{var e;this.value=null!=(e=this.textContent)?e:""}),this._observer.observe(this,{childList:!0,characterData:!0,subtree:!0}),uL()||(this.hasAttribute("role")||this.setAttribute("role","math"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","math input field"),this.setAttribute("aria-multiline","false")),s&&!this.hasAttribute("contenteditable")&&this.setAttribute("contenteditable","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");let c=n.querySelector("slot:not([name])");if(c)try{this._style=c.assignedElements().filter(e=>"style"===e.tagName.toLowerCase()).map(e=>e.textContent).join("")}catch(e){console.error(e)}if(this._style){let e=document.createElement("style");e.textContent=this._style,n.appendChild(e)}let d="";if(d=this.hasAttribute("value")?this.getAttribute("value"):null!=(i=null==c?void 0:c.assignedNodes().map(e=>3===e.nodeType?e.textContent:"").join("").trim())?i:"",this._mathfield=new uv(n.querySelector(":host > span"),g(f({},null!=(a=null==(r=ux.get(this))?void 0:r.options)?a:uS(this)),{eventSink:this,value:d})),!ux.has(this))for(let i of(this.upgradeProperty("disabled"),this.upgradeProperty("readonly"),Object.keys(e.optionsAttributes)))this.upgradeProperty(uM(i));if(!(null!=(o=this._mathfield)&&o.model)){this._mathfield=null;return}if(ux.has(this)){let e=this._mathfield,i=ux.get(this),r=i.menuItems;e.model.deferNotifications({content:!1,selection:!1},()=>{let r=i.value;void 0!==r&&e.setValue(r),e.model.selection=i.selection,ux.delete(this)}),r&&(this.menuItems=r)}window.queueMicrotask(()=>{this.isConnected&&this.dispatchEvent(new Event("mount",{cancelable:!1,bubbles:!0,composed:!0}))}),sE()}disconnectedCallback(){var i,r,a;if(this.shadowRoot.host.removeEventListener("pointerdown",this,!0),!this._mathfield)return;null==(i=this._observer)||i.disconnect(),this._observer=null,window.queueMicrotask(()=>this.dispatchEvent(new Event("unmount",{cancelable:!1,bubbles:!0,composed:!0})));let o=ct(this._mathfield.options,Object.keys(e.optionsAttributes).map(e=>uM(e)));ux.set(this,{value:this._mathfield.getValue(),selection:this._mathfield.model.selection,menuItems:null!=(a=null==(r=this._mathfield.menu)?void 0:r.menuItems)?a:void 0,options:o}),this._mathfield.dispose(),this._mathfield=null}upgradeProperty(e){if(this.hasOwnProperty(e)){let i=this[e];delete this[e],("readonly"===e||"read-only"===e)&&(e="readOnly"),this[e]=i}}attributeChangedCallback(e,i,r){if(i===r)return;let a=null!==r;switch(e){case"contenteditable":sA(this._mathfield);break;case"placeholder":!1===r&&(r=""),this.placeholder=r;break;case"disabled":this.disabled=a;break;case"read-only":case"readonly":this.readOnly=a}}get readonly(){return this.hasAttribute("readonly")||this.hasAttribute("read-only")}set readonly(e){let i=!!e;i?(this.setAttribute("readonly",""),uL()?this._internals.ariaReadOnly="true":this.setAttribute("aria-readonly","true"),this.setAttribute("aria-readonly","true")):(uL()?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(e){var i;let r=!!e;r?this.setAttribute("disabled",""):this.removeAttribute("disabled"),uL()?this._internals.ariaDisabled=r?"true":"false":this.setAttribute("aria-disabled",r?"true":"false"),r&&null!=(i=this._mathfield)&&i.hasFocus&&window.mathVirtualKeyboard.visible&&this._mathfield.executeCommand("hideVirtualKeyboard")}get value(){return this.getValue()}set value(e){this.setValue(e)}get defaultMode(){return this._getOption("defaultMode")}set defaultMode(e){this._setOptions({defaultMode:e})}get macros(){if(!this._mathfield)throw Error("Mathfield not mounted");return this._getOption("macros")}set macros(e){this._setOptions({macros:e})}get registers(){if(!this._mathfield)throw Error("Mathfield not mounted");let e=this;return new Proxy({},{get:(i,r)=>{if("string"==typeof r)return e._getOption("registers")[r]},set:(i,r,a)=>"string"==typeof r&&(e._setOptions({registers:g(f({},e._getOption("registers")),{[r]:a})}),!0),ownKeys:()=>Reflect.ownKeys(e._getOption("registers")),getOwnPropertyDescriptor:(i,r)=>{let a=e._getOption("registers")[r];if(void 0!==a)return{configurable:!0,enumerable:!0,value:a,writable:!0}}})}set registers(e){this._setOptions({registers:e})}get colorMap(){return this._getOption("colorMap")}set colorMap(e){this._setOptions({colorMap:e})}get backgroundColorMap(){return this._getOption("backgroundColorMap")}set backgroundColorMap(e){this._setOptions({backgroundColorMap:e})}get letterShapeStyle(){return this._getOption("letterShapeStyle")}set letterShapeStyle(e){this._setOptions({letterShapeStyle:e})}get minFontScale(){return this._getOption("minFontScale")}set minFontScale(e){this._setOptions({minFontScale:e})}get maxMatrixCols(){return this._getOption("maxMatrixCols")}set maxMatrixCols(e){this._setOptions({maxMatrixCols:e})}get smartMode(){return this._getOption("smartMode")}set smartMode(e){this._setOptions({smartMode:e})}get smartFence(){return this._getOption("smartFence")}set smartFence(e){this._setOptions({smartFence:e})}get smartSuperscript(){return this._getOption("smartSuperscript")}set smartSuperscript(e){this._setOptions({smartSuperscript:e})}get scriptDepth(){return this._getOption("scriptDepth")}set scriptDepth(e){this._setOptions({scriptDepth:e})}get removeExtraneousParentheses(){return this._getOption("removeExtraneousParentheses")}set removeExtraneousParentheses(e){this._setOptions({removeExtraneousParentheses:e})}get mathModeSpace(){return this._getOption("mathModeSpace")}set mathModeSpace(e){this._setOptions({mathModeSpace:e})}get placeholderSymbol(){return this._getOption("placeholderSymbol")}set placeholderSymbol(e){this._setOptions({placeholderSymbol:e})}get placeholder(){return this._getOption("contentPlaceholder")}set placeholder(e){this._setOptions({contentPlaceholder:e})}get popoverPolicy(){return this._getOption("popoverPolicy")}set popoverPolicy(e){this._setOptions({popoverPolicy:e})}get environmentPopoverPolicy(){return this._getOption("environmentPopoverPolicy")}set environmentPopoverPolicy(e){this._setOptions({environmentPopoverPolicy:e})}get menuItems(){var e;if(!this._mathfield)throw Error("Mathfield not mounted");return null!=(e=this._mathfield.menu._menuItems.map(e=>e.menuItem))?e:[]}set menuItems(e){var i;if(!this._mathfield)throw Error("Mathfield not mounted");if(this._mathfield){let r=null==(i=this._mathfield.element)?void 0:i.querySelector("[part=menu-toggle]");r&&(r.style.display=0===e.length?"none":""),this._mathfield.menu.menuItems=e}}get mathVirtualKeyboardPolicy(){return this._getOption("mathVirtualKeyboardPolicy")}set mathVirtualKeyboardPolicy(e){this._setOptions({mathVirtualKeyboardPolicy:e})}get inlineShortcuts(){if(!this._mathfield)throw Error("Mathfield not mounted");return this._getOption("inlineShortcuts")}set inlineShortcuts(e){if(!this._mathfield)throw Error("Mathfield not mounted");this._setOptions({inlineShortcuts:e})}get inlineShortcutTimeout(){return this._getOption("inlineShortcutTimeout")}set inlineShortcutTimeout(e){this._setOptions({inlineShortcutTimeout:e})}get keybindings(){if(!this._mathfield)throw Error("Mathfield not mounted");return this._getOption("keybindings")}set keybindings(e){if(!this._mathfield)throw Error("Mathfield not mounted");this._setOptions({keybindings:e})}get onInsertStyle(){let e=this._getOption("onInsertStyle");return void 0===e?sr:e}set onInsertStyle(e){this._setOptions({onInsertStyle:e})}get onInlineShortcut(){return this._getOption("onInlineShortcut")}set onInlineShortcut(e){this._setOptions({onInlineShortcut:e})}get onScrollIntoView(){return this._getOption("onScrollIntoView")}set onScrollIntoView(e){this._setOptions({onScrollIntoView:e})}get onExport(){return this._getOption("onExport")}set onExport(e){this._setOptions({onExport:e})}get readOnly(){return this._getOption("readOnly")}set readOnly(e){this._setOptions({readOnly:e})}get isSelectionEditable(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.isSelectionEditable)&&i}setPromptState(e,i,r){var a;null==(a=this._mathfield)||a.setPromptState(e,i,r)}getPromptState(e){var i,r;return null!=(r=null==(i=this._mathfield)?void 0:i.getPromptState(e))?r:[void 0,!0]}get selection(){return this._mathfield?this._mathfield.model.selection:ux.has(this)?ux.get(this).selection:{ranges:[[0,0]],direction:"forward"}}set selection(e){if("number"==typeof e&&(e={ranges:[[e,e]]}),this._mathfield){this._mathfield.model.selection=e,sA(this._mathfield);return}ux.has(this)?ux.set(this,g(f({},ux.get(this)),{selection:e})):ux.set(this,{value:void 0,selection:e,options:uS(this),menuItems:void 0})}get selectionIsCollapsed(){let e=this.selection;return 1===e.ranges.length&&e.ranges[0][0]===e.ranges[0][1]}get position(){return this._mathfield?this._mathfield.model.position:ux.has(this)?ux.get(this).selection.ranges[0][0]:0}set position(e){(this._mathfield&&(this._mathfield.model.position=e,sA(this._mathfield)),ux.has(this))?ux.set(this,g(f({},ux.get(this)),{selection:{ranges:[[e,e]]}})):ux.set(this,{value:void 0,selection:{ranges:[[e,e]]},options:uS(this),menuItems:void 0})}get lastOffset(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.model.lastOffset)?i:-1}};uw.version="0.110.6",uw.openUrl=e=>{if(!e)return;let i=new URL(e);["http:","https:","file:"].includes(i.protocol.toLowerCase())?window.open(i,"_blank"):uw.playSound("plonk")},uw._fontsDirectory="./fonts/",uw._soundsDirectory="./sounds",uw.keypressVibration=!0,uw._keypressSound={spacebar:"keypress-spacebar.wav",return:"keypress-return.wav",delete:"keypress-delete.wav",default:"keypress-standard.wav"},uw._plonkSound="plonk.wav",uw.audioBuffers={},uw.createHTML=e=>e,uw._speechEngineRate="100%",uw._speechEngineVoice="Joanna",uw._textToSpeechMarkup="",uw._textToSpeechRules="mathlive",uw._textToSpeechRulesOptions={},uw.speakHook=function(e){var i,r;if(!v())return;let a=globalThis.MathfieldElement;if(a.speechEngine&&"local"!==a.speechEngine)if("amazon"===a.speechEngine)if("AWS"in window){let o=new globalThis.AWS.Polly({apiVersion:"2016-06-10"}),n={OutputFormat:"mp3",VoiceId:null!=(i=a.speechEngineVoice)?i:"Joanna",Engine:["Amy","Emma","Brian","Ivy","Joanna","Kendra","Kimberly","Salli","Joey","Justin","Matthew"].includes(null!=(r=a.speechEngineVoice)?r:"Joanna")?"neural":"standard",Text:e,TextType:"ssml"};o.synthesizeSpeech(n,(e,i)=>{if(e)console.trace(`MathLive 0.110.6: \`polly.synthesizeSpeech()\` error: ${e}`);else if(null!=i&&i.AudioStream){let e=new Blob([new Uint8Array(i.AudioStream).buffer],{type:"audio/mpeg"});new Audio(URL.createObjectURL(e)).play().catch(e=>console.error(e))}})}else console.error("MathLive 0.110.6: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");else"google"===a.speechEngine&&console.error("MathLive 0.110.6: The Google speech engine is not supported yet. Please come again.");else{let i=new SpeechSynthesisUtterance(e);globalThis.speechSynthesis.speak(i)}},uw.readAloudHook=function(e,i){var r;if(!v())return;if("amazon"!==globalThis.MathfieldElement.speechEngine){console.error("MathLive 0.110.6: Use Amazon TTS Engine for synchronized highlighting"),"function"==typeof globalThis.MathfieldElement.speakHook&&globalThis.MathfieldElement.speakHook(i);return}if(!globalThis.AWS)return void console.error("MathLive 0.110.6: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");let a=new globalThis.AWS.Polly({apiVersion:"2016-06-10"}),o={OutputFormat:"json",VoiceId:null!=(r=globalThis.MathfieldElement.speechEngineVoice)?r:"Joanna",Engine:"standard",Text:i,TextType:"ssml",SpeechMarkTypes:["ssml"]};uj().readAloudElement=e,a.synthesizeSpeech(o,(e,r)=>{if(e)return void console.trace(`MathLive 0.110.6: \`polly.synthesizeSpeech()\` error: ${e}`);if(!(null!=r&&r.AudioStream))return;let n=new TextDecoder("utf-8").decode(new Uint8Array(r.AudioStream));for(let e of(uj().readAloudMarks=n.split(`
3473
- `).map(e=>e?JSON.parse(e):{}),uj().readAloudTokens=[],uj().readAloudMarks))e.value&&uj().readAloudTokens.push(e.value);uj().readAloudCurrentMark="",o.OutputFormat="mp3",o.SpeechMarkTypes=[],a.synthesizeSpeech(o,(e,r)=>{if(e)return void console.trace(`MathLive 0.110.6: \`polly.synthesizeSpeech("${i}") error:${e}`);if(!(null!=r&&r.AudioStream))return;let a=new Blob([new Uint8Array(r.AudioStream).buffer],{type:"audio/mpeg"}),o=URL.createObjectURL(a),n=uj();n.readAloudAudio?n.readAloudAudio.pause():(n.readAloudAudio=new Audio,n.readAloudAudio.addEventListener("ended",()=>{let e=n.readAloudMathfield;n.readAloudStatus="ended",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),e?(sT(e),n.readAloudElement=null,n.readAloudMathfield=null,n.readAloudTokens=[],n.readAloudMarks=[],n.readAloudCurrentMark=""):function e(i){if(i&&(i.classList.remove("ML__highlight"),i.children))for(let r of i.children)e(r)}(n.readAloudElement)}),n.readAloudAudio.addEventListener("timeupdate",()=>{let e="",i=1e3*n.readAloudAudio.currentTime+100;for(let r of n.readAloudMarks)r.time<i&&(e=r.value);n.readAloudCurrentMark!==e&&(n.readAloudCurrentToken=e,e&&e===n.readAloudFinalToken?n.readAloudAudio.pause():(n.readAloudCurrentMark=e,function e(i,r){var a;i&&(r&&(null==(a=i.dataset)?void 0:a.atomId)!==r?(i.classList.remove("ML__highlight"),i.children&&i.children.length>0&&[...i.children].forEach(i=>{i instanceof HTMLElement&&e(i,r)})):(i.classList.add("ML__highlight"),i.children&&i.children.length>0&&[...i.children].forEach(i=>{i instanceof HTMLElement&&e(i)})))}(n.readAloudElement,n.readAloudCurrentMark)))})),n.readAloudAudio.src=o,n.readAloudStatus="playing",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),n.readAloudAudio.play()})})},uw.restoreFocusWhenDocumentFocused=!0,uw._decimalSeparator=".",uw._scientificNotationTemplate="#1\\times10^{#2}",uw._isFunction=e=>{var i,r;let a=globalThis.MathfieldElement.computeEngine;return null!=(r=null==(i=null==a?void 0:a.parse(e).domain)?void 0:i.isFunction)&&r};var uk=uw;function uM(e){return e.replace(/[^a-zA-Z\d]+(.)/g,(e,i)=>i.toUpperCase())}function uS(e){let i={readOnly:!1},r=uk.optionsAttributes;return Object.keys(r).forEach(a=>{var o;if(e.hasAttribute(a)){let n=e.getAttribute(a);"placeholder"===a?i.contentPlaceholder=null!=n?n:"":"boolean"===r[a]?i[uM(a)]=!0:"on/off"===r[a]?"on"===(n=null!=(o=null==n?void 0:n.toLowerCase())?o:"")||"true"===n?i[uM(a)]=!0:"off"===n||"false"===n?i[uM(a)]=!1:i[uM(a)]=void 0:"number"===r[a]?i[uM(a)]=Number.parseFloat(null!=n?n:"0"):i[uM(a)]=n}}),i}function uL(){return!(!("ElementInternals"in window)||!HTMLElement.prototype.attachInternals||!("role"in window.ElementInternals.prototype))}var uC,uE,uA,uz,uT,uD=uk;v()&&!(null!=(uA=window.customElements)&&uA.get("math-field"))&&(null!=window[uz=Symbol.for("io.cortexjs.mathlive")]||(window[uz]={}),window[Symbol.for("io.cortexjs.mathlive")].version="0.110.6",globalThis.MathfieldElement=uk,null==(uT=window.customElements)||uT.define("math-field",uk));var uK=!1,uB=null,u$=class extends HTMLElement{constructor(){if(super(),this._hasRendered=!1,this._shadowRoot=this.attachShadow({mode:"open"}),"adoptedStyleSheets"in this._shadowRoot)this._shadowRoot.adoptedStyleSheets=[nS("core")];else{let e=document.createElement("style");e.textContent=nM("core"),this._shadowRoot.appendChild(e)}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(){uK||uB||(uB=sE().then(()=>{uK=!0})),"IntersectionObserver"in window&&!this._hasRendered?(this._observer=new IntersectionObserver(e=>{var i;e[0].isIntersecting&&!this._hasRendered&&(this.render(),null==(i=this._observer)||i.disconnect())},{rootMargin:"50px"}),this._observer.observe(this)):this.render()}disconnectedCallback(){var e;null==(e=this._observer)||e.disconnect()}attributeChangedCallback(e,i,r){i!==r&&this._hasRendered&&this.render()}_handleKeydown(e){if(null!==this.getAttribute("tabindex")&&(" "===e.key||"Enter"===e.key)){e.preventDefault();let i=this.getAttribute("aria-label");if(i&&"speechSynthesis"in window){let e=new SpeechSynthesisUtterance(i);speechSynthesis.speak(e)}}}get mode(){let e=this.getAttribute("mode");return"textstyle"===e||"displaystyle"===e?e:this.getDefaultMathstyle()}set mode(e){this.setAttribute("mode",e)}get format(){let e=this.getAttribute("format");return"latex"===e||"ascii-math"===e||"math-json"===e?e:"latex"}set format(e){this.setAttribute("format",e)}get letterShapeStyle(){let e=this.getAttribute("letter-shape-style");if("auto"===e||"tex"===e||"iso"===e||"french"===e||"upright"===e)return e}set letterShapeStyle(e){void 0===e?this.removeAttribute("letter-shape-style"):this.setAttribute("letter-shape-style",e)}get macros(){var e;return null!=(e=this.getAttribute("macros"))?e:void 0}set macros(e){void 0===e?this.removeAttribute("macros"):this.setAttribute("macros",e)}get minFontScale(){let e=this.getAttribute("min-font-scale");return e?parseFloat(e):void 0}set minFontScale(e){void 0===e?this.removeAttribute("min-font-scale"):this.setAttribute("min-font-scale",String(e))}get maxMatrixCols(){let e=this.getAttribute("max-matrix-cols");return e?parseInt(e,10):void 0}set maxMatrixCols(e){void 0===e?this.removeAttribute("max-matrix-cols"):this.setAttribute("max-matrix-cols",String(e))}render(){var e,i,r;try{let r=null!=(i=null==(e=this.textContent)?void 0:e.trim())?i:"";if(!r){this._renderContainer.innerHTML="",this._errorFallback.style.display="none",this._renderContainer.style.display="none",this._removeMathML();return}this._contentSlot.textContent=r;let a,o=this.format;if("ascii-math"===o)a=dW(r);else if("math-json"===o){let e=JSON.parse(r);a=dj(e)}else a=r;let n={defaultMode:"displaystyle"===this.mode?"math":"inline-math"};if(this.letterShapeStyle&&(n.letterShapeStyle=this.letterShapeStyle),this.macros)try{n.macros=JSON.parse(this.macros)}catch(e){console.warn("Invalid macros JSON:",e)}void 0!==this.minFontScale&&(n.minFontScale=this.minFontScale),void 0!==this.maxMatrixCols&&(n.maxMatrixCols=this.maxMatrixCols);let l=dN(a,n);this._renderContainer.innerHTML=l,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:o,content:a}}))}catch(e){console.error("MathLive static element render error:",e),this._renderContainer.style.display="none",this._errorFallback.textContent=null!=(r=this.textContent)?r:"",this._errorFallback.style.display="block",this._removeMathML(),this.dispatchEvent(new CustomEvent("render-error",{bubbles:!0,composed:!0,detail:{error:e,content:this.textContent}}))}}_updateAccessibility(e){if(!this.hasAttribute("aria-label"))try{let i=dV(e);this.setAttribute("aria-label",i)}catch(e){console.warn("Could not generate speakable text:",e)}this.hasAttribute("role")||this.setAttribute("role","img"),this._addMathML(e)}_addMathML(e){try{let i=dF(e);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(e){console.warn("Could not generate MathML:",e)}}_removeMathML(){this._mathMLContainer&&(this._mathMLContainer.remove(),this._mathMLContainer=void 0)}},uP=class extends u${getDefaultMathstyle(){return"textstyle"}getDefaultDisplay(){return"inline-flex"}},uO=class extends u${getDefaultMathstyle(){return"displaystyle"}getDefaultDisplay(){return"flex"}};function uI(e,i,r,a,o="latex"){let n=[];for(let l of e)if("text"===l.type){let e=l.data,s=!0,c=0,d;-1!==(d=e.indexOf(i))&&((c=d)>0&&n.push({type:"text",data:e.slice(0,c)}),s=!1);let u=!1;for(;!u;){if(s){if(-1===(d=e.indexOf(i,c))){u=!0;break}c!==d&&n.push({type:"text",data:e.slice(c,d)}),c=d}else{if(-1===(d=function(e,i,r){let a=r,o=0,n=e.length;for(;a<i.length;){let r=i[a];if(o<=0&&i.slice(a,a+n)===e)return a;"\\"===r?a++:"{"===r?o++:"}"===r&&o--,a++}return -1}(r,e,c+i.length))){u=!0;break}let l=e.slice(c+i.length,d);"ascii-math"===o&&([,l]=o6(l,{format:"ascii-math"})),n.push({type:"math",data:l,mathstyle:a}),c=d+r.length}s=!s}c<e.length&&n.push({type:"text",data:e.slice(c)})}else n.push(l);return n}function uR(e,i){var r,a,o,n,l,s,c,d;let u=[{type:"text",data:e}];return null!=(a=null==(r=i.TeX)?void 0:r.delimiters)&&a.display&&i.TeX.delimiters.display.forEach(([e,i])=>{u=uI(u,e,i,"displaystyle")}),null!=(n=null==(o=i.TeX)?void 0:o.delimiters)&&n.inline&&i.TeX.delimiters.inline.forEach(([e,i])=>{u=uI(u,e,i,"textstyle")}),null!=(s=null==(l=i.asciiMath)?void 0:l.delimiters)&&s.inline&&i.asciiMath.delimiters.inline.forEach(([e,i])=>{u=uI(u,e,i,"textstyle","ascii-math")}),null!=(d=null==(c=i.asciiMath)?void 0:c.delimiters)&&d.display&&i.asciiMath.delimiters.display.forEach(([e,i])=>{u=uI(u,e,i,"displaystyle","ascii-math")}),u}function uN(e,i,r){var a;let o=function(e,i,r){try{let a=i.renderToMarkup(e,g(f({},i),{defaultMode:"displaystyle"===r?"math":"inline-math"})),o=document.createElement("span");return o.dataset.latex=e,o.style.display="displaystyle"===r?"flex":"inline-flex",o.setAttribute("aria-hidden","true"),o.setAttribute("translate","no"),o.innerHTML=globalThis.MathfieldElement.createHTML(a),o}catch(i){return console.error("Could not parse'"+e+"' with ",i),document.createTextNode(e)}}(e,r,i||"textstyle"),n=null!=(a=r.renderAccessibleContent)?a:"";if(/\b(mathml|speakable-text)\b/i.test(n)){let i=document.createElement("span");if(/\bmathml\b/i.test(n)&&r.renderToMathML&&i.append(function(e,i){let r=document.createElement("span");r.setAttribute("translate","no");try{let a="<math xmlns='http://www.w3.org/1998/Math/MathML'>"+i.renderToMathML(e)+"</math>";r.innerHTML=globalThis.MathfieldElement.createHTML(a)}catch(i){console.error(`MathLive 0.110.6: Could not convert "${e}"' to MathML with ${i}`),r.textContent=e}return r.className="ML__sr-only",r}(e,r)),/\bspeakable-text\b/i.test(n)&&r.renderToSpeakableText){let a=document.createElement("span");a.setAttribute("translate","no");let o=r.renderToSpeakableText(e);a.innerHTML=globalThis.MathfieldElement.createHTML(o),a.className="ML__sr-only",i.append(a)}return i.append(o),i}return o}"u">typeof window&&(null!=(a=window.customElements)&&a.get("math-span")||null==(o=window.customElements)||o.define("math-span",uP),null!=(n=window.customElements)&&n.get("math-div")||null==(l=window.customElements)||l.define("math-div",uO));var uq={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 uF(e,i){var r,a,o,n,l,s,c,d;try{let u=f(f({},uq),i);u.ignoreClassPattern=new RegExp(null!=(r=u.ignoreClass)?r:""),u.processClassPattern=new RegExp(null!=(a=u.processClass)?a:""),u.processScriptTypePattern=new RegExp(null!=(o=u.processScriptType)?o:""),u.processMathJSONScriptTypePattern=new RegExp(null!=(n=u.processMathJSONScriptType)?n:""),null!=(s=null==(l=u.TeX)?void 0:l.className)&&s.display&&(u.texClassDisplayPattern=new RegExp(u.TeX.className.display)),null!=(d=null==(c=u.TeX)?void 0:c.className)&&d.inline&&(u.texClassInlinePattern=new RegExp(u.TeX.className.inline)),sE(),nL("core"),function e(i,r){var a,o,n,l,s,c,d,u,h,p,m,f,g,b,y,v,x,_;if(1===i.childNodes.length&&3===i.childNodes[0].nodeType){let e=null!=(a=i.childNodes[0].textContent)?a:"";if(null!=(o=r.TeX)&&o.processEnvironments&&/^\s*\\begin/.test(e)){i.textContent="",i.append(uN(e,"",r));return}let n=uR(e,r);if(1===n.length){let e=n[0];if("text"===e.type)return;i.textContent="",i.append(uN(e.data,"textstyle"===e.mathstyle?"textstyle":"displaystyle",r));return}}for(let a of[...i.childNodes])if(3===a.nodeType){let e=function(e,i){var r;if(/^\s*$/.test(e))return null;if(null!=(r=i.TeX)&&r.processEnvironments&&/^\s*\\begin/.test(e))return[uN(e,"",i)];let a=uR(e,i);if(1===a.length&&"text"===a[0].type)return null;let o=[];for(let e of a)"text"===e.type?o.push(e.data):o.push(uN(e.data,"textstyle"===e.mathstyle?"textstyle":"displaystyle",i));return o}(null!=(n=a.textContent)?n:"",r);e&&a.replaceWith(...e)}else if(1===a.nodeType){let i=a.nodeName.toLowerCase();if("script"===i){let e,i=a.type.toLowerCase();if("module"===i||"javascript"===i)continue;if(null!=(l=r.processScriptTypePattern)&&l.test(i))e=null!=(s=a.textContent)?s:"";else if(null!=(c=r.processMathJSONScriptTypePattern)&&c.test(i))try{e=null==(u=r.serializeToLatex)?void 0:u.call(r,JSON.parse(null!=(d=a.textContent)?d:""))}catch(e){console.error(e)}if(e){let o="textstyle";for(let e of i.split(";")){let[i,r]=e.split("=");"mode"===i.trim()&&(o="display"===r.trim()?"displaystyle":"textstyle")}uV(a,e,o,r)}}else{if(null!=(h=r.texClassDisplayPattern)&&h.test(a.className)){uV(a,null!=(p=a.textContent)?p:"","displaystyle",r);continue}if(null!=(m=r.texClassInlinePattern)&&m.test(a.className)){uV(a,null!=(f=a.textContent)?f:"","textstyle",r);continue}(null!=(b=null==(g=r.processClassPattern)?void 0:g.test(a.className))&&b||!(null!=(v=null==(y=r.skipTags)?void 0:y.includes(i))&&v||null!=(_=null==(x=r.ignoreClassPattern)?void 0:x.test(a.className))&&_))&&e(a,r)}}}(e,u)}catch(i){i instanceof Error?console.error("renderMathInElement(): "+i.message):console.error("renderMathInElement(): Could not render math for element",e)}}function uV(e,i,r,a){e.parentNode.replaceChild(uN(i,r,a),e)}function uj(){var e;return null!=globalThis[e=Symbol.for("io.cortexjs.mathlive")]||(globalThis[e]={}),globalThis[Symbol.for("io.cortexjs.mathlive")]}function uH(e){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>uW(document.body,e)):uW(document.body,e)}function uW(e,i){if("loading"===document.readyState)return void document.addEventListener("DOMContentLoaded",()=>uW(e,i));let r=function(e){if("string"==typeof e){let i=document.getElementById(e);if(null===i)throw Error(`The element with ID "${e}" could not be found.`);return i}return e}(e);if(!r)return;let a=null!=i?i:{};null!=a.renderToMarkup||(a.renderToMarkup=dN),null!=a.renderToMathML||(a.renderToMathML=dF),null!=a.renderToSpeakableText||(a.renderToSpeakableText=dV),null!=a.serializeToLatex||(a.serializeToLatex=dj),uF(r,a)}s$({switchKeyboardLayer:function(e,i){let r=s5.singleton;return!!r&&(r.show(),sU(),r.currentLayer=i,r.render(),r.focus(),!0)},toggleVirtualKeyboard:function(){let e=window.mathVirtualKeyboard;return e.visible?e.hide({animate:!0}):e.show({animate:!0}),!1},hideVirtualKeyboard:()=>(window.mathVirtualKeyboard.hide({animate:!0}),!1),showVirtualKeyboard:()=>(window.mathVirtualKeyboard.show({animate:!0}),!1)},{target:"virtual-keyboard"});var uU={mathlive:"0.110.6"};r.d(i,{MathDivElement:()=>uO,MathSpanElement:()=>uP,MathfieldElement:()=>uk,_renderMathInElement:()=>uF,convertAsciiMathToLatex:()=>dW,convertLatexToAsciiMath:()=>dH,convertLatexToMarkup:()=>dN,convertLatexToMathMl:()=>dF,convertLatexToSpeakableText:()=>dV,convertMathJsonToLatex:()=>dj,globalMathLive:()=>uj,initVirtualKeyboardInCurrentBrowsingContext:()=>s9,renderMathInDocument:()=>uH,renderMathInElement:()=>uW,setKeyboardLayout:()=>P,setKeyboardLayoutLocale:()=>O,validateLatex:()=>dq,version:()=>uU})}};
3498
+ import "https://esm.run/@cortex-js/compute-engine"`)}get errors(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.errors)?i:[]}_getOptions(e){return this._mathfield?cn(this._mathfield.options,e):uS.has(this)?f({},cn(f(f({},cl()),co(uS.get(this).options)),e)):null}getOptions(e){return console.warn("%cMathLive 0.110.8: %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?cn(this._mathfield.options,e):uS.has(this)?cn(f(f({},cl()),co(uS.get(this).options)),e):null}reflectAttributes(){let i=cl(),r=this._getOptions();Object.keys(e.optionsAttributes).forEach(a=>{let o="placeholder"===a?"contentPlaceholder":uA(a);"on/off"===e.optionsAttributes[a]?i[o]!==r[o]?this.setAttribute(a,r[o]?"on":"off"):this.removeAttribute(a):i[o]!==r[o]&&("boolean"===e.optionsAttributes[a]?r[o]?this.setAttribute(a,""):this.removeAttribute(a):("string"==typeof r[o]||"number"==typeof r[o])&&this.setAttribute(a,r[o].toString()))})}getOption(e){return console.warn("%cMathLive 0.110.8: %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([e])[e]}_getOption(e){return this._getOptions([e])[e]}_setOptions(e){if(this._mathfield)this._mathfield.setOptions(e);else if(uS.has(this)){let i=f(f({},uS.get(this).options),e);uS.set(this,g(f({},uS.get(this)),{selection:{ranges:i.readOnly?[[0,0]]:[[0,-1]]},options:i}))}else uS.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:e,menuItems:void 0});this.reflectAttributes()}setOptions(e){for(let i of(console.group("%cMathLive 0.110.8: %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."),Object.keys(e)))uL[i]&&console.warn(`\`mf.setOptions({${i}:...})\` -> ${uL[i]}`);console.groupEnd(),this._setOptions(e)}executeCommand(...e){var i,r;let a;if(a=1===e.length?e[0]:[e[0],...e.slice(1)])return null!=(r=null==(i=this._mathfield)?void 0:i.executeCommand(a))&&r;throw Error("Invalid selector")}getValue(e,i,r){var a,o;if(this._mathfield)return this._mathfield.model.getValue(e,i,r);if(uS.has(this)){let n,l,s;if(o4(e)?([n,l]=e.ranges[0],s=i):o1(e)?([n,l]=e,s=i):o0(e)&&o0(i)?(n=e,l=i,s=r):(n=0,l=-1,s=e),(void 0===s||"latex"===s)&&0===n&&-1===l)return null!=(o=null!=(a=uS.get(this).value)?a:this.textContent)?o:""}return""}setValue(e,i){if(this._mathfield&&void 0!==e){if(this._mathfield.model.getValue()===e)return;null!=i||(i={silenceNotifications:!0,mode:"math"}),this._mathfield.setValue(e,i);return}if(uS.has(this)){let i=uS.get(this).options;uS.set(this,{value:e,selection:{ranges:[[-1,-1]],direction:"forward"},options:i,menuItems:void 0});return}let r=uz(this);uS.set(this,{value:e,selection:{ranges:[[-1,-1]],direction:"forward"},options:r,menuItems:void 0})}hasFocus(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.hasFocus())&&i}focus(){var e;this.disabled||null==(e=this._mathfield)||e.focus()}blur(){var e;null==(e=this._mathfield)||e.blur()}select(){var e;null==(e=this._mathfield)||e.select()}insert(e,i){var r,a;return null!=(a=null==(r=this._mathfield)?void 0:r.insert(e,i))&&a}applyStyle(e,i){var r;return null==(r=this._mathfield)?void 0:r.applyStyle(e,i)}queryStyle(e){var i,r;return null!=(r=null==(i=this._mathfield)?void 0:i.queryStyle(e))?r:"none"}getOffsetFromPoint(e,i,r){return this._mathfield?cZ(this._mathfield,e,i,r):-1}getElementInfo(e){return nf(this._mathfield,e)}resetUndo(){var e;null==(e=this._mathfield)||e.resetUndo()}canUndo(){return!!this._mathfield&&this._mathfield.canUndo()}canRedo(){return!!this._mathfield&&this._mathfield.canRedo()}handleEvent(e){var i,r,a,o,n;if("closed"!==se.state||(null==(r=null==(i=this._mathfield)?void 0:i.menu)?void 0:r.state)!=="closed"||("pointerdown"===e.type&&this.onPointerDown(),"focus"===e.type)||"blur"!==e.type)return;let l=x();l&&null!=(a=null==window?void 0:window.mathVirtualKeyboard)&&a.visible||(null==(o=se.scrim)?void 0:o.state)!=="closed"||l&&function(){try{return window.self!==window.top}catch(e){return!0}}()||null==(n=this._mathfield)||n.onBlur({dispatchEvents:!1})}connectedCallback(){var i,r,a,o;let n=this.shadowRoot,l=n.host,s="none"!==window.getComputedStyle(this).userSelect;s?l.addEventListener("pointerdown",this,!0):n.querySelector("span").style.pointerEvents="none",l.addEventListener("focus",this,!0),l.addEventListener("blur",this,!0),this._observer=new MutationObserver(()=>{var e;this.value=null!=(e=this.textContent)?e:""}),this._observer.observe(this,{childList:!0,characterData:!0,subtree:!0}),uT()||(this.hasAttribute("role")||this.setAttribute("role","math"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","math input field"),this.setAttribute("aria-multiline","false")),s&&!this.hasAttribute("contenteditable")&&this.setAttribute("contenteditable","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");let c=n.querySelector("slot:not([name])");if(c)try{this._style=c.assignedElements().filter(e=>"style"===e.tagName.toLowerCase()).map(e=>e.textContent).join("")}catch(e){console.error(e)}if(this._style){let e=document.createElement("style");e.textContent=this._style,n.appendChild(e)}let d="";if(d=this.hasAttribute("value")?this.getAttribute("value"):null!=(i=null==c?void 0:c.assignedNodes().map(e=>3===e.nodeType?e.textContent:"").join("").trim())?i:"",this._mathfield=new uM(n.querySelector(":host > span"),g(f({},null!=(a=null==(r=uS.get(this))?void 0:r.options)?a:uz(this)),{eventSink:this,value:d})),!uS.has(this))for(let i of(this.upgradeProperty("disabled"),this.upgradeProperty("readonly"),Object.keys(e.optionsAttributes)))this.upgradeProperty(uA(i));if(!(null!=(o=this._mathfield)&&o.model)){this._mathfield=null;return}if(uS.has(this)){let e=this._mathfield,i=uS.get(this),r=i.menuItems;e.model.deferNotifications({content:!1,selection:!1},()=>{let r=i.value;void 0!==r&&e.setValue(r),e.model.selection=i.selection,uS.delete(this)}),r&&(this.menuItems=r)}window.queueMicrotask(()=>{this.isConnected&&this.dispatchEvent(new Event("mount",{cancelable:!1,bubbles:!0,composed:!0}))}),sK()}disconnectedCallback(){var i,r,a;if(this.shadowRoot.host.removeEventListener("pointerdown",this,!0),!this._mathfield)return;null==(i=this._observer)||i.disconnect(),this._observer=null,window.queueMicrotask(()=>this.dispatchEvent(new Event("unmount",{cancelable:!1,bubbles:!0,composed:!0})));let o=cn(this._mathfield.options,Object.keys(e.optionsAttributes).map(e=>uA(e)));uS.set(this,{value:this._mathfield.getValue(),selection:this._mathfield.model.selection,menuItems:null!=(a=null==(r=this._mathfield.menu)?void 0:r.menuItems)?a:void 0,options:o}),this._mathfield.dispose(),this._mathfield=null}upgradeProperty(e){if(this.hasOwnProperty(e)){let i=this[e];delete this[e],("readonly"===e||"read-only"===e)&&(e="readOnly"),this[e]=i}}attributeChangedCallback(e,i,r){if(i===r)return;let a=null!==r;switch(e){case"contenteditable":sB(this._mathfield);break;case"placeholder":!1===r&&(r=""),this.placeholder=r;break;case"disabled":this.disabled=a;break;case"read-only":case"readonly":this.readOnly=a}}get readonly(){return this.hasAttribute("readonly")||this.hasAttribute("read-only")}set readonly(e){let i=!!e;i?(this.setAttribute("readonly",""),uT()?this._internals.ariaReadOnly="true":this.setAttribute("aria-readonly","true"),this.setAttribute("aria-readonly","true")):(uT()?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(e){var i;let r=!!e;r?this.setAttribute("disabled",""):this.removeAttribute("disabled"),uT()?this._internals.ariaDisabled=r?"true":"false":this.setAttribute("aria-disabled",r?"true":"false"),r&&null!=(i=this._mathfield)&&i.hasFocus&&window.mathVirtualKeyboard.visible&&this._mathfield.executeCommand("hideVirtualKeyboard")}get value(){return this.getValue()}set value(e){this.setValue(e)}get defaultMode(){return this._getOption("defaultMode")}set defaultMode(e){this._setOptions({defaultMode:e})}get macros(){if(!this._mathfield)throw Error("Mathfield not mounted");return this._getOption("macros")}set macros(e){this._setOptions({macros:e})}get registers(){if(!this._mathfield)throw Error("Mathfield not mounted");let e=this;return new Proxy({},{get:(i,r)=>{if("string"==typeof r)return e._getOption("registers")[r]},set:(i,r,a)=>"string"==typeof r&&(e._setOptions({registers:g(f({},e._getOption("registers")),{[r]:a})}),!0),ownKeys:()=>Reflect.ownKeys(e._getOption("registers")),getOwnPropertyDescriptor:(i,r)=>{let a=e._getOption("registers")[r];if(void 0!==a)return{configurable:!0,enumerable:!0,value:a,writable:!0}}})}set registers(e){this._setOptions({registers:e})}get colorMap(){return this._getOption("colorMap")}set colorMap(e){this._setOptions({colorMap:e})}get backgroundColorMap(){return this._getOption("backgroundColorMap")}set backgroundColorMap(e){this._setOptions({backgroundColorMap:e})}get letterShapeStyle(){return this._getOption("letterShapeStyle")}set letterShapeStyle(e){this._setOptions({letterShapeStyle:e})}get minFontScale(){return this._getOption("minFontScale")}set minFontScale(e){this._setOptions({minFontScale:e})}get maxMatrixCols(){return this._getOption("maxMatrixCols")}set maxMatrixCols(e){this._setOptions({maxMatrixCols:e})}get smartMode(){return this._getOption("smartMode")}set smartMode(e){this._setOptions({smartMode:e})}get smartFence(){return this._getOption("smartFence")}set smartFence(e){this._setOptions({smartFence:e})}get smartSuperscript(){return this._getOption("smartSuperscript")}set smartSuperscript(e){this._setOptions({smartSuperscript:e})}get scriptDepth(){return this._getOption("scriptDepth")}set scriptDepth(e){this._setOptions({scriptDepth:e})}get removeExtraneousParentheses(){return this._getOption("removeExtraneousParentheses")}set removeExtraneousParentheses(e){this._setOptions({removeExtraneousParentheses:e})}get mathModeSpace(){return this._getOption("mathModeSpace")}set mathModeSpace(e){this._setOptions({mathModeSpace:e})}get placeholderSymbol(){return this._getOption("placeholderSymbol")}set placeholderSymbol(e){this._setOptions({placeholderSymbol:e})}get placeholder(){return this._getOption("contentPlaceholder")}set placeholder(e){this._setOptions({contentPlaceholder:e})}get popoverPolicy(){return this._getOption("popoverPolicy")}set popoverPolicy(e){this._setOptions({popoverPolicy:e})}get environmentPopoverPolicy(){return this._getOption("environmentPopoverPolicy")}set environmentPopoverPolicy(e){this._setOptions({environmentPopoverPolicy:e})}get menuItems(){var e;if(!this._mathfield)throw Error("Mathfield not mounted");return null!=(e=this._mathfield.menu._menuItems.map(e=>e.menuItem))?e:[]}set menuItems(e){var i;if(!this._mathfield)throw Error("Mathfield not mounted");if(this._mathfield){let r=null==(i=this._mathfield.element)?void 0:i.querySelector("[part=menu-toggle]");r&&(r.style.display=0===e.length?"none":""),this._mathfield.menu.menuItems=e}}get mathVirtualKeyboardPolicy(){return this._getOption("mathVirtualKeyboardPolicy")}set mathVirtualKeyboardPolicy(e){this._setOptions({mathVirtualKeyboardPolicy:e})}get inlineShortcuts(){if(!this._mathfield)throw Error("Mathfield not mounted");return this._getOption("inlineShortcuts")}set inlineShortcuts(e){if(!this._mathfield)throw Error("Mathfield not mounted");this._setOptions({inlineShortcuts:e})}get inlineShortcutTimeout(){return this._getOption("inlineShortcutTimeout")}set inlineShortcutTimeout(e){this._setOptions({inlineShortcutTimeout:e})}get keybindings(){if(!this._mathfield)throw Error("Mathfield not mounted");return this._getOption("keybindings")}set keybindings(e){if(!this._mathfield)throw Error("Mathfield not mounted");this._setOptions({keybindings:e})}get onInsertStyle(){let e=this._getOption("onInsertStyle");return void 0===e?sc:e}set onInsertStyle(e){this._setOptions({onInsertStyle:e})}get onInlineShortcut(){return this._getOption("onInlineShortcut")}set onInlineShortcut(e){this._setOptions({onInlineShortcut:e})}get onScrollIntoView(){return this._getOption("onScrollIntoView")}set onScrollIntoView(e){this._setOptions({onScrollIntoView:e})}get onExport(){return this._getOption("onExport")}set onExport(e){this._setOptions({onExport:e})}get readOnly(){return this._getOption("readOnly")}set readOnly(e){this._setOptions({readOnly:e})}get isSelectionEditable(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.isSelectionEditable)&&i}setPromptState(e,i,r){var a;null==(a=this._mathfield)||a.setPromptState(e,i,r)}getPromptState(e){var i,r;return null!=(r=null==(i=this._mathfield)?void 0:i.getPromptState(e))?r:[void 0,!0]}get selection(){return this._mathfield?this._mathfield.model.selection:uS.has(this)?uS.get(this).selection:{ranges:[[0,0]],direction:"forward"}}set selection(e){if("number"==typeof e&&(e={ranges:[[e,e]]}),this._mathfield){this._mathfield.model.selection=e,sB(this._mathfield);return}uS.has(this)?uS.set(this,g(f({},uS.get(this)),{selection:e})):uS.set(this,{value:void 0,selection:e,options:uz(this),menuItems:void 0})}get selectionIsCollapsed(){let e=this.selection;return 1===e.ranges.length&&e.ranges[0][0]===e.ranges[0][1]}get position(){return this._mathfield?this._mathfield.model.position:uS.has(this)?uS.get(this).selection.ranges[0][0]:0}set position(e){(this._mathfield&&(this._mathfield.model.position=e,sB(this._mathfield)),uS.has(this))?uS.set(this,g(f({},uS.get(this)),{selection:{ranges:[[e,e]]}})):uS.set(this,{value:void 0,selection:{ranges:[[e,e]]},options:uz(this),menuItems:void 0})}get lastOffset(){var e,i;return null!=(i=null==(e=this._mathfield)?void 0:e.model.lastOffset)?i:-1}};uC.version="0.110.8",uC.openUrl=e=>{if(!e)return;let i=new URL(e);["http:","https:","file:"].includes(i.protocol.toLowerCase())?window.open(i,"_blank"):uC.playSound("plonk")},uC._fontsDirectory="./fonts/",uC._soundsDirectory="./sounds",uC.keypressVibration=!0,uC._keypressSound={spacebar:"keypress-spacebar.wav",return:"keypress-return.wav",delete:"keypress-delete.wav",default:"keypress-standard.wav"},uC._plonkSound="plonk.wav",uC.audioBuffers={},uC.createHTML=e=>e,uC._speechEngineRate="100%",uC._speechEngineVoice="Joanna",uC._textToSpeechMarkup="",uC._textToSpeechRules="mathlive",uC._textToSpeechRulesOptions={},uC.speakHook=function(e){var i,r;if(!v())return;let a=globalThis.MathfieldElement;if(a.speechEngine&&"local"!==a.speechEngine)if("amazon"===a.speechEngine)if("AWS"in window){let o=new globalThis.AWS.Polly({apiVersion:"2016-06-10"}),n={OutputFormat:"mp3",VoiceId:null!=(i=a.speechEngineVoice)?i:"Joanna",Engine:["Amy","Emma","Brian","Ivy","Joanna","Kendra","Kimberly","Salli","Joey","Justin","Matthew"].includes(null!=(r=a.speechEngineVoice)?r:"Joanna")?"neural":"standard",Text:e,TextType:"ssml"};o.synthesizeSpeech(n,(e,i)=>{if(e)console.trace(`MathLive 0.110.8: \`polly.synthesizeSpeech()\` error: ${e}`);else if(null!=i&&i.AudioStream){let e=new Blob([new Uint8Array(i.AudioStream).buffer],{type:"audio/mpeg"});new Audio(URL.createObjectURL(e)).play().catch(e=>console.error(e))}})}else console.error("MathLive 0.110.8: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");else"google"===a.speechEngine&&console.error("MathLive 0.110.8: The Google speech engine is not supported yet. Please come again.");else{let i=new SpeechSynthesisUtterance(e);globalThis.speechSynthesis.speak(i)}},uC.readAloudHook=function(e,i){var r;if(!v())return;if("amazon"!==globalThis.MathfieldElement.speechEngine){console.error("MathLive 0.110.8: Use Amazon TTS Engine for synchronized highlighting"),"function"==typeof globalThis.MathfieldElement.speakHook&&globalThis.MathfieldElement.speakHook(i);return}if(!globalThis.AWS)return void console.error("MathLive 0.110.8: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");let a=new globalThis.AWS.Polly({apiVersion:"2016-06-10"}),o={OutputFormat:"json",VoiceId:null!=(r=globalThis.MathfieldElement.speechEngineVoice)?r:"Joanna",Engine:"standard",Text:i,TextType:"ssml",SpeechMarkTypes:["ssml"]};uX().readAloudElement=e,a.synthesizeSpeech(o,(e,r)=>{if(e)return void console.trace(`MathLive 0.110.8: \`polly.synthesizeSpeech()\` error: ${e}`);if(!(null!=r&&r.AudioStream))return;let n=new TextDecoder("utf-8").decode(new Uint8Array(r.AudioStream));for(let e of(uX().readAloudMarks=n.split(`
3499
+ `).map(e=>e?JSON.parse(e):{}),uX().readAloudTokens=[],uX().readAloudMarks))e.value&&uX().readAloudTokens.push(e.value);uX().readAloudCurrentMark="",o.OutputFormat="mp3",o.SpeechMarkTypes=[],a.synthesizeSpeech(o,(e,r)=>{if(e)return void console.trace(`MathLive 0.110.8: \`polly.synthesizeSpeech("${i}") error:${e}`);if(!(null!=r&&r.AudioStream))return;let a=new Blob([new Uint8Array(r.AudioStream).buffer],{type:"audio/mpeg"}),o=URL.createObjectURL(a),n=uX();n.readAloudAudio?n.readAloudAudio.pause():(n.readAloudAudio=new Audio,n.readAloudAudio.addEventListener("ended",()=>{let e=n.readAloudMathfield;n.readAloudStatus="ended",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),e?(sP(e),n.readAloudElement=null,n.readAloudMathfield=null,n.readAloudTokens=[],n.readAloudMarks=[],n.readAloudCurrentMark=""):function e(i){if(i&&(i.classList.remove("ML__highlight"),i.children))for(let r of i.children)e(r)}(n.readAloudElement)}),n.readAloudAudio.addEventListener("timeupdate",()=>{let e="",i=1e3*n.readAloudAudio.currentTime+100;for(let r of n.readAloudMarks)r.time<i&&(e=r.value);n.readAloudCurrentMark!==e&&(n.readAloudCurrentToken=e,e&&e===n.readAloudFinalToken?n.readAloudAudio.pause():(n.readAloudCurrentMark=e,function e(i,r){var a;i&&(r&&(null==(a=i.dataset)?void 0:a.atomId)!==r?(i.classList.remove("ML__highlight"),i.children&&i.children.length>0&&[...i.children].forEach(i=>{i instanceof HTMLElement&&e(i,r)})):(i.classList.add("ML__highlight"),i.children&&i.children.length>0&&[...i.children].forEach(i=>{i instanceof HTMLElement&&e(i)})))}(n.readAloudElement,n.readAloudCurrentMark)))})),n.readAloudAudio.src=o,n.readAloudStatus="playing",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),n.readAloudAudio.play()})})},uC.restoreFocusWhenDocumentFocused=!0,uC._decimalSeparator=".",uC._scientificNotationTemplate="#1\\times10^{#2}",uC._isFunction=e=>{var i,r;let a=globalThis.MathfieldElement.computeEngine;return null!=(r=null==(i=null==a?void 0:a.parse(e).domain)?void 0:i.isFunction)&&r};var uE=uC;function uA(e){return e.replace(/[^a-zA-Z\d]+(.)/g,(e,i)=>i.toUpperCase())}function uz(e){let i={readOnly:!1},r=uE.optionsAttributes;return Object.keys(r).forEach(a=>{var o;if(e.hasAttribute(a)){let n=e.getAttribute(a);"placeholder"===a?i.contentPlaceholder=null!=n?n:"":"boolean"===r[a]?i[uA(a)]=!0:"on/off"===r[a]?"on"===(n=null!=(o=null==n?void 0:n.toLowerCase())?o:"")||"true"===n?i[uA(a)]=!0:"off"===n||"false"===n?i[uA(a)]=!1:i[uA(a)]=void 0:"number"===r[a]?i[uA(a)]=Number.parseFloat(null!=n?n:"0"):i[uA(a)]=n}}),i}function uT(){return!(!("ElementInternals"in window)||!HTMLElement.prototype.attachInternals||!("role"in window.ElementInternals.prototype))}var uD,uK,uB,u$,uP,uO=uE;v()&&!(null!=(uB=window.customElements)&&uB.get("math-field"))&&(null!=window[u$=Symbol.for("io.cortexjs.mathlive")]||(window[u$]={}),window[Symbol.for("io.cortexjs.mathlive")].version="0.110.8",globalThis.MathfieldElement=uE,null==(uP=window.customElements)||uP.define("math-field",uE));var uR=!1,uI=null,uN=class extends HTMLElement{constructor(){if(super(),this._hasRendered=!1,this._shadowRoot=this.attachShadow({mode:"open"}),"adoptedStyleSheets"in this._shadowRoot)this._shadowRoot.adoptedStyleSheets=[nE("core")];else{let e=document.createElement("style");e.textContent=nC("core"),this._shadowRoot.appendChild(e)}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(){uR||uI||(uI=sK().then(()=>{uR=!0})),"IntersectionObserver"in window&&!this._hasRendered?(this._observer=new IntersectionObserver(e=>{var i;e[0].isIntersecting&&!this._hasRendered&&(this.render(),null==(i=this._observer)||i.disconnect())},{rootMargin:"50px"}),this._observer.observe(this)):this.render()}disconnectedCallback(){var e;null==(e=this._observer)||e.disconnect()}attributeChangedCallback(e,i,r){i!==r&&this._hasRendered&&this.render()}_handleKeydown(e){if(null!==this.getAttribute("tabindex")&&(" "===e.key||"Enter"===e.key)){e.preventDefault();let i=this.getAttribute("aria-label");if(i&&"speechSynthesis"in window){let e=new SpeechSynthesisUtterance(i);speechSynthesis.speak(e)}}}get mode(){let e=this.getAttribute("mode");return"textstyle"===e||"displaystyle"===e?e:this.getDefaultMathstyle()}set mode(e){this.setAttribute("mode",e)}get format(){let e=this.getAttribute("format");return"latex"===e||"ascii-math"===e||"math-json"===e?e:"latex"}set format(e){this.setAttribute("format",e)}get letterShapeStyle(){let e=this.getAttribute("letter-shape-style");if("auto"===e||"tex"===e||"iso"===e||"french"===e||"upright"===e)return e}set letterShapeStyle(e){void 0===e?this.removeAttribute("letter-shape-style"):this.setAttribute("letter-shape-style",e)}get macros(){var e;return null!=(e=this.getAttribute("macros"))?e:void 0}set macros(e){void 0===e?this.removeAttribute("macros"):this.setAttribute("macros",e)}get minFontScale(){let e=this.getAttribute("min-font-scale");return e?parseFloat(e):void 0}set minFontScale(e){void 0===e?this.removeAttribute("min-font-scale"):this.setAttribute("min-font-scale",String(e))}get maxMatrixCols(){let e=this.getAttribute("max-matrix-cols");return e?parseInt(e,10):void 0}set maxMatrixCols(e){void 0===e?this.removeAttribute("max-matrix-cols"):this.setAttribute("max-matrix-cols",String(e))}render(){var e,i,r;try{let r=null!=(i=null==(e=this.textContent)?void 0:e.trim())?i:"";if(!r){this._renderContainer.innerHTML="",this._errorFallback.style.display="none",this._renderContainer.style.display="none",this._removeMathML();return}this._contentSlot.textContent=r;let a,o=this.format;if("ascii-math"===o)a=dZ(r);else if("math-json"===o){let e=JSON.parse(r);a=dX(e)}else a=r;let n={defaultMode:"displaystyle"===this.mode?"math":"inline-math"};if(this.letterShapeStyle&&(n.letterShapeStyle=this.letterShapeStyle),this.macros)try{n.macros=JSON.parse(this.macros)}catch(e){console.warn("Invalid macros JSON:",e)}void 0!==this.minFontScale&&(n.minFontScale=this.minFontScale),void 0!==this.maxMatrixCols&&(n.maxMatrixCols=this.maxMatrixCols);let l=dH(a,n);this._renderContainer.innerHTML=l,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:o,content:a}}))}catch(e){console.error("MathLive static element render error:",e),this._renderContainer.style.display="none",this._errorFallback.textContent=null!=(r=this.textContent)?r:"",this._errorFallback.style.display="block",this._removeMathML(),this.dispatchEvent(new CustomEvent("render-error",{bubbles:!0,composed:!0,detail:{error:e,content:this.textContent}}))}}_updateAccessibility(e){if(!this.hasAttribute("aria-label"))try{let i=dJ(e);this.setAttribute("aria-label",i)}catch(e){console.warn("Could not generate speakable text:",e)}this.hasAttribute("role")||this.setAttribute("role","img"),this._addMathML(e)}_addMathML(e){try{let i=dU(e);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(e){console.warn("Could not generate MathML:",e)}}_removeMathML(){this._mathMLContainer&&(this._mathMLContainer.remove(),this._mathMLContainer=void 0)}},uq=class extends uN{getDefaultMathstyle(){return"textstyle"}getDefaultDisplay(){return"inline-flex"}},uF=class extends uN{getDefaultMathstyle(){return"displaystyle"}getDefaultDisplay(){return"flex"}};function uV(e,i,r,a,o="latex"){let n=[];for(let l of e)if("text"===l.type){let e=l.data,s=!0,c=0,d;-1!==(d=e.indexOf(i))&&((c=d)>0&&n.push({type:"text",data:e.slice(0,c)}),s=!1);let u=!1;for(;!u;){if(s){if(-1===(d=e.indexOf(i,c))){u=!0;break}c!==d&&n.push({type:"text",data:e.slice(c,d)}),c=d}else{if(-1===(d=function(e,i,r){let a=r,o=0,n=e.length;for(;a<i.length;){let r=i[a];if(o<=0&&i.slice(a,a+n)===e)return a;"\\"===r?a++:"{"===r?o++:"}"===r&&o--,a++}return -1}(r,e,c+i.length))){u=!0;break}let l=e.slice(c+i.length,d);"ascii-math"===o&&([,l]=o6(l,{format:"ascii-math"})),n.push({type:"math",data:l,mathstyle:a}),c=d+r.length}s=!s}c<e.length&&n.push({type:"text",data:e.slice(c)})}else n.push(l);return n}function uj(e,i){var r,a,o,n,l,s,c,d;let u=[{type:"text",data:e}];return null!=(a=null==(r=i.TeX)?void 0:r.delimiters)&&a.display&&i.TeX.delimiters.display.forEach(([e,i])=>{u=uV(u,e,i,"displaystyle")}),null!=(n=null==(o=i.TeX)?void 0:o.delimiters)&&n.inline&&i.TeX.delimiters.inline.forEach(([e,i])=>{u=uV(u,e,i,"textstyle")}),null!=(s=null==(l=i.asciiMath)?void 0:l.delimiters)&&s.inline&&i.asciiMath.delimiters.inline.forEach(([e,i])=>{u=uV(u,e,i,"textstyle","ascii-math")}),null!=(d=null==(c=i.asciiMath)?void 0:c.delimiters)&&d.display&&i.asciiMath.delimiters.display.forEach(([e,i])=>{u=uV(u,e,i,"displaystyle","ascii-math")}),u}function uH(e,i,r){var a;let o=function(e,i,r){try{let a=i.renderToMarkup(e,g(f({},i),{defaultMode:"displaystyle"===r?"math":"inline-math"})),o=document.createElement("span");return o.dataset.latex=e,o.style.display="displaystyle"===r?"flex":"inline-flex",o.setAttribute("aria-hidden","true"),o.setAttribute("translate","no"),o.innerHTML=globalThis.MathfieldElement.createHTML(a),o}catch(i){return console.error("Could not parse'"+e+"' with ",i),document.createTextNode(e)}}(e,r,i||"textstyle"),n=null!=(a=r.renderAccessibleContent)?a:"";if(/\b(mathml|speakable-text)\b/i.test(n)){let i=document.createElement("span");if(/\bmathml\b/i.test(n)&&r.renderToMathML&&i.append(function(e,i){let r=document.createElement("span");r.setAttribute("translate","no");try{let a="<math xmlns='http://www.w3.org/1998/Math/MathML'>"+i.renderToMathML(e)+"</math>";r.innerHTML=globalThis.MathfieldElement.createHTML(a)}catch(i){console.error(`MathLive 0.110.8: Could not convert "${e}"' to MathML with ${i}`),r.textContent=e}return r.className="ML__sr-only",r}(e,r)),/\bspeakable-text\b/i.test(n)&&r.renderToSpeakableText){let a=document.createElement("span");a.setAttribute("translate","no");let o=r.renderToSpeakableText(e);a.innerHTML=globalThis.MathfieldElement.createHTML(o),a.className="ML__sr-only",i.append(a)}return i.append(o),i}return o}"u">typeof window&&(null!=(a=window.customElements)&&a.get("math-span")||null==(o=window.customElements)||o.define("math-span",uq),null!=(n=window.customElements)&&n.get("math-div")||null==(l=window.customElements)||l.define("math-div",uF));var uW={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 uU(e,i){var r,a,o,n,l,s,c,d;try{let u=f(f({},uW),i);u.ignoreClassPattern=new RegExp(null!=(r=u.ignoreClass)?r:""),u.processClassPattern=new RegExp(null!=(a=u.processClass)?a:""),u.processScriptTypePattern=new RegExp(null!=(o=u.processScriptType)?o:""),u.processMathJSONScriptTypePattern=new RegExp(null!=(n=u.processMathJSONScriptType)?n:""),null!=(s=null==(l=u.TeX)?void 0:l.className)&&s.display&&(u.texClassDisplayPattern=new RegExp(u.TeX.className.display)),null!=(d=null==(c=u.TeX)?void 0:c.className)&&d.inline&&(u.texClassInlinePattern=new RegExp(u.TeX.className.inline)),sK(),nA("core"),function e(i,r){var a,o,n,l,s,c,d,u,h,p,m,f,g,b,y,v,x,_;if(1===i.childNodes.length&&3===i.childNodes[0].nodeType){let e=null!=(a=i.childNodes[0].textContent)?a:"";if(null!=(o=r.TeX)&&o.processEnvironments&&/^\s*\\begin/.test(e)){i.textContent="",i.append(uH(e,"",r));return}let n=uj(e,r);if(1===n.length){let e=n[0];if("text"===e.type)return;i.textContent="",i.append(uH(e.data,"textstyle"===e.mathstyle?"textstyle":"displaystyle",r));return}}for(let a of[...i.childNodes])if(3===a.nodeType){let e=function(e,i){var r;if(/^\s*$/.test(e))return null;if(null!=(r=i.TeX)&&r.processEnvironments&&/^\s*\\begin/.test(e))return[uH(e,"",i)];let a=uj(e,i);if(1===a.length&&"text"===a[0].type)return null;let o=[];for(let e of a)"text"===e.type?o.push(e.data):o.push(uH(e.data,"textstyle"===e.mathstyle?"textstyle":"displaystyle",i));return o}(null!=(n=a.textContent)?n:"",r);e&&a.replaceWith(...e)}else if(1===a.nodeType){let i=a.nodeName.toLowerCase();if("script"===i){let e,i=a.type.toLowerCase();if("module"===i||"javascript"===i)continue;if(null!=(l=r.processScriptTypePattern)&&l.test(i))e=null!=(s=a.textContent)?s:"";else if(null!=(c=r.processMathJSONScriptTypePattern)&&c.test(i))try{e=null==(u=r.serializeToLatex)?void 0:u.call(r,JSON.parse(null!=(d=a.textContent)?d:""))}catch(e){console.error(e)}if(e){let o="textstyle";for(let e of i.split(";")){let[i,r]=e.split("=");"mode"===i.trim()&&(o="display"===r.trim()?"displaystyle":"textstyle")}uJ(a,e,o,r)}}else{if(null!=(h=r.texClassDisplayPattern)&&h.test(a.className)){uJ(a,null!=(p=a.textContent)?p:"","displaystyle",r);continue}if(null!=(m=r.texClassInlinePattern)&&m.test(a.className)){uJ(a,null!=(f=a.textContent)?f:"","textstyle",r);continue}(null!=(b=null==(g=r.processClassPattern)?void 0:g.test(a.className))&&b||!(null!=(v=null==(y=r.skipTags)?void 0:y.includes(i))&&v||null!=(_=null==(x=r.ignoreClassPattern)?void 0:x.test(a.className))&&_))&&e(a,r)}}}(e,u)}catch(i){i instanceof Error?console.error("renderMathInElement(): "+i.message):console.error("renderMathInElement(): Could not render math for element",e)}}function uJ(e,i,r,a){e.parentNode.replaceChild(uH(i,r,a),e)}function uX(){var e;return null!=globalThis[e=Symbol.for("io.cortexjs.mathlive")]||(globalThis[e]={}),globalThis[Symbol.for("io.cortexjs.mathlive")]}function uG(e){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>uZ(document.body,e)):uZ(document.body,e)}function uZ(e,i){if("loading"===document.readyState)return void document.addEventListener("DOMContentLoaded",()=>uZ(e,i));let r=function(e){if("string"==typeof e){let i=document.getElementById(e);if(null===i)throw Error(`The element with ID "${e}" could not be found.`);return i}return e}(e);if(!r)return;let a=null!=i?i:{};null!=a.renderToMarkup||(a.renderToMarkup=dH),null!=a.renderToMathML||(a.renderToMathML=dU),null!=a.renderToSpeakableText||(a.renderToSpeakableText=dJ),null!=a.serializeToLatex||(a.serializeToLatex=dX),uU(r,a)}sN({switchKeyboardLayer:function(e,i){let r=ci.singleton;return!!r&&(r.show(),sY(),r.currentLayer=i,r.render(),r.focus(),!0)},toggleVirtualKeyboard:function(){let e=window.mathVirtualKeyboard;return e.visible?e.hide({animate:!0}):e.show({animate:!0}),!1},hideVirtualKeyboard:()=>(window.mathVirtualKeyboard.hide({animate:!0}),!1),showVirtualKeyboard:()=>(window.mathVirtualKeyboard.show({animate:!0}),!1)},{target:"virtual-keyboard"});var uY={mathlive:"0.110.8"};r.d(i,{MathDivElement:()=>uF,MathSpanElement:()=>uq,MathfieldElement:()=>uE,_renderMathInElement:()=>uU,convertAsciiMathToLatex:()=>dZ,convertLatexToAsciiMath:()=>dG,convertLatexToMarkup:()=>dH,convertLatexToMathMl:()=>dU,convertLatexToSpeakableText:()=>dJ,convertMathJsonToLatex:()=>dX,globalMathLive:()=>uX,initVirtualKeyboardInCurrentBrowsingContext:()=>ca,renderMathInDocument:()=>uG,renderMathInElement:()=>uZ,setKeyboardLayout:()=>P,setKeyboardLayoutLocale:()=>O,validateLatex:()=>dW,version:()=>uY})}};