diff --git a/dist/mathlive.d.ts b/dist/mathlive.d.ts index 0a3397f5f..499bc3641 100644 --- a/dist/mathlive.d.ts +++ b/dist/mathlive.d.ts @@ -38,6 +38,7 @@ declare type MathFieldCallback = (mathfield: MathField) => void; @property {boolean} keypressVibration? @property {string} keypressSound? @property {string} plonkSound? + @property {boolean} readOnly? @property {"mathlive" | "sre"} textToSpeechRules? @property {"ssml" | "mac"} textToSpeechMarkup? @property {object} textToSpeechRulesOptions? @@ -99,6 +100,7 @@ declare type MathFieldConfig = { keypressVibration?: boolean; keypressSound?: string; plonkSound?: string; + readOnly?: boolean; textToSpeechRules?: "mathlive" | "sre"; textToSpeechMarkup?: "ssml" | "mac"; textToSpeechRulesOptions?: any; diff --git a/dist/mathlive.js b/dist/mathlive.js index 2ad64bfd2..9bbdf1a78 100644 --- a/dist/mathlive.js +++ b/dist/mathlive.js @@ -6449,62 +6449,52 @@ var global, factory; }; }); const vt = { - '\\#': '#', - '\\&': '&', - '\\$': '$', - '\\%': '%', - '\\_': '_', - '\\euro': '€', - '\\maltese': '✠', - '\\{': '{', - '\\}': '}', - '\\nobreakspace': ' ', - '\\ldots': '…', - '\\textellipsis': '…', - '\\backslash': '\\', - '`': '‘', - "'": '’', - '``': '“', - "''": '”', - '\\degree': '°', - '\\textasciicircum': '^', - '\\textasciitilde': '~', - '\\textasteriskcentered': '*', - '\\textbackslash': '\\', - '\\textbraceleft': '{', - '\\textbraceright': '}', - '\\textbullet': '•', - '\\textdollar': '$', - '\\textsterling': '£', - '–': '–', - '—': '—', - '‘': '‘', - '’': '’', - '“': '“', - '”': '”', - '"': '”', - '\\ss': 'ß', - '\\ae': 'æ', - '\\oe': 'œ', - '\\AE': 'Æ', - '\\OE': 'Œ', - '\\O': 'Ø', - '\\i': 'ı', - '\\j': 'ȷ', - '\\aa': 'å', - '\\AA': 'Å', - }, - wt = - 'undefined' != typeof navigator && - /firefox|edge/i.test(navigator.userAgent) - ? /[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓ󌜏źŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒäöüßÄÖÜẞàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚáéíñóúüÁÉÍÑÓÚÜ]/ - : new RegExp('\\p{Letter}', 'u'), - St = - 'undefined' != typeof navigator && - /firefox|edge/i.test(navigator.userAgent) - ? /[0-9a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓ󌜏źŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒäöüßÄÖÜẞàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚáéíñóúüÁÉÍÑÓÚÜ]/ - : new RegExp('[0-9\\p{Letter}]', 'u'); - var At = { + '\\#': '#', + '\\&': '&', + '\\$': '$', + '\\%': '%', + '\\_': '_', + '\\euro': '€', + '\\maltese': '✠', + '\\{': '{', + '\\}': '}', + '\\nobreakspace': ' ', + '\\ldots': '…', + '\\textellipsis': '…', + '\\backslash': '\\', + '`': '‘', + "'": '’', + '``': '“', + "''": '”', + '\\degree': '°', + '\\textasciicircum': '^', + '\\textasciitilde': '~', + '\\textasteriskcentered': '*', + '\\textbackslash': '\\', + '\\textbraceleft': '{', + '\\textbraceright': '}', + '\\textbullet': '•', + '\\textdollar': '$', + '\\textsterling': '£', + '–': '–', + '—': '—', + '‘': '‘', + '’': '’', + '“': '“', + '”': '”', + '"': '”', + '\\ss': 'ß', + '\\ae': 'æ', + '\\oe': 'œ', + '\\AE': 'Æ', + '\\OE': 'Œ', + '\\O': 'Ø', + '\\i': 'ı', + '\\j': 'ȷ', + '\\aa': 'å', + '\\AA': 'Å', + }; + var wt = { matchCodepoint: et, commandAllowed: function(t, e) { return ( @@ -6676,17 +6666,17 @@ var global, factory; Set: '\\left\\lbrace #1 \\right\\rbrace', }, COMMAND_MODE_CHARACTERS: /[a-zA-Z0-9!@*()-=+{}[\]\\';:?/.,~<>`|'$%#&^_" ]/, - LETTER: wt, - LETTER_AND_DIGITS: St, + LETTER: /[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓ󌜏źŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒäöüßÄÖÜẞàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚáéíñóúüÁÉÍÑÓÚÜ]/, + LETTER_AND_DIGITS: /[0-9a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓ󌜏źŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒäöüßÄÖÜẞàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚáéíñóúüÁÉÍÑÓÚÜ]/, }; - const Mt = $.makeSymbol, - Ct = $.makeSpan, - _t = $.makeVlist; - function Tt(t, e, i, s, a, o) { - const n = Mt('Size' + i + '-Regular', At.getValue('math', e)), + const St = $.makeSymbol, + At = $.makeSpan, + Mt = $.makeVlist; + function Ct(t, e, i, s, a, o) { + const n = St('Size' + i + '-Regular', wt.getValue('math', e)), r = $.makeStyleWrap( t, - Ct(n, 'delimsizing size' + i), + At(n, 'delimsizing size' + i), a.mathstyle, M.TEXT, o @@ -6703,18 +6693,18 @@ var global, factory; r ); } - function Lt(t, e) { + function _t(t, e) { let i = ''; return ( 'Size1-Regular' === e ? (i = ' delim-size1') : 'Size4-Regular' === e && (i = ' delim-size4'), - Ct(Mt(e, At.getValue('math', t)), 'delimsizinginner' + i) + At(St(e, wt.getValue('math', t)), 'delimsizinginner' + i) ); } - function Ft(t, e, i, s, a, o) { + function Tt(t, e, i, s, a, o) { let n, r, l, c; - (n = l = c = At.getValue('math', e)), (r = null); + (n = l = c = wt.getValue('math', e)), (r = null); let h = 'Size1-Regular'; '\\vert' === e || '\\lvert' === e || @@ -6785,16 +6775,16 @@ var global, factory; : '\\llcorner' === e ? ((c = '└'), (l = n = ' ')) : '\\lrcorner' === e && ((n = '┘'), (l = n = ' ')); - const d = m.getCharacterMetrics(At.getValue('math', n), h), + const d = m.getCharacterMetrics(wt.getValue('math', n), h), p = d.height + d.depth, - u = m.getCharacterMetrics(At.getValue('math', l), h), + u = m.getCharacterMetrics(wt.getValue('math', l), h), f = u.height + u.depth, - g = m.getCharacterMetrics(At.getValue('math', c), h), + g = m.getCharacterMetrics(wt.getValue('math', c), h), y = g.height + g.depth; let b = 0, x = 1; if (null !== r) { - const t = m.getCharacterMetrics(At.getValue('math', r), h); + const t = m.getCharacterMetrics(wt.getValue('math', r), h); (b = t.height + t.depth), (x = 2); } const k = p + y + b, @@ -6804,29 +6794,29 @@ var global, factory; s && (S *= a.mathstyle.sizeMultiplier); const A = w / 2 - S, C = []; - if ((C.push(Lt(c, h)), null === r)) - for (let t = 0; t < v; t++) C.push(Lt(l, h)); + if ((C.push(_t(c, h)), null === r)) + for (let t = 0; t < v; t++) C.push(_t(l, h)); else { - for (let t = 0; t < v; t++) C.push(Lt(l, h)); - C.push(Lt(r, h)); - for (let t = 0; t < v; t++) C.push(Lt(l, h)); + for (let t = 0; t < v; t++) C.push(_t(l, h)); + C.push(_t(r, h)); + for (let t = 0; t < v; t++) C.push(_t(l, h)); } - C.push(Lt(n, h)); - const _ = _t(a, C, 'bottom', A); + C.push(_t(n, h)); + const _ = Mt(a, C, 'bottom', A); return ( _.setStyle('color', a.color), 'number' == typeof a.opacity && _.setStyle('opacity', a.opacity), $.makeStyleWrap( t, - Ct(_, 'delimsizing mult'), + At(_, 'delimsizing mult'), a.mathstyle, M.TEXT, o ) ); } - const Dt = [ + const Lt = [ '(', ')', '[', @@ -6843,7 +6833,7 @@ var global, factory; '\\rceil', '\\surd', ], - zt = [ + Ft = [ '\\uparrow', '\\downarrow', '\\updownarrow', @@ -6865,7 +6855,7 @@ var global, factory; '\\lmoustache', '\\rmoustache', ], - Et = [ + Dt = [ '<', '>', '\\langle', @@ -6875,8 +6865,8 @@ var global, factory; '\\lt', '\\gt', ], - qt = [0, 1.2, 1.8, 2.4, 3], - Pt = [ + zt = [0, 1.2, 1.8, 2.4, 3], + Et = [ { type: 'small', mathstyle: M.SCRIPTSCRIPT }, { type: 'small', mathstyle: M.SCRIPT }, { type: 'small', mathstyle: M.TEXT }, @@ -6885,13 +6875,13 @@ var global, factory; { type: 'large', size: 3 }, { type: 'large', size: 4 }, ], - It = [ + qt = [ { type: 'small', mathstyle: M.SCRIPTSCRIPT }, { type: 'small', mathstyle: M.SCRIPT }, { type: 'small', mathstyle: M.TEXT }, { type: 'stack' }, ], - Bt = [ + Pt = [ { type: 'small', mathstyle: M.SCRIPTSCRIPT }, { type: 'small', mathstyle: M.SCRIPT }, { type: 'small', mathstyle: M.TEXT }, @@ -6901,13 +6891,13 @@ var global, factory; { type: 'large', size: 4 }, { type: 'stack' }, ]; - function Ot(t, e, i, s, a, o) { - if (!e || 0 === e.length || '.' === e) return Rt(t, a, t); + function It(t, e, i, s, a, o) { + if (!e || 0 === e.length || '.' === e) return Bt(t, a, t); let n; '<' === e || '\\lt' === e ? (e = '\\langle') : ('>' !== e && '\\gt' !== e) || (e = '\\rangle'), - (n = Et.includes(e) ? Pt : Dt.includes(e) ? Bt : It); + (n = Dt.includes(e) ? Et : Lt.includes(e) ? Pt : qt); const r = (function(t, e, i, s) { for ( let o = Math.min(2, 3 - s.mathstyle.size); @@ -6934,10 +6924,10 @@ var global, factory; } var a; return i[i.length - 1]; - })(At.getValue('math', e), i, n, a); + })(wt.getValue('math', e), i, n, a); return 'small' === r.type ? (function(t, e, i, s, a, o) { - const n = Mt('AMS-Regular', At.getValue('math', e)), + const n = St('AMS-Regular', wt.getValue('math', e)), r = $.makeStyleWrap(t, n, a.mathstyle, i, o); return ( s && @@ -6954,10 +6944,10 @@ var global, factory; ); })(t, e, r.mathstyle, s, a, o) : 'large' === r.type - ? Tt(t, e, r.size, s, a, o) - : Ft(t, e, i, s, a, o); + ? Ct(t, e, r.size, s, a, o) + : Tt(t, e, i, s, a, o); } - function Rt(t, e, i) { + function Bt(t, e, i) { return $.makeSpanOfType( t, '', @@ -6967,22 +6957,22 @@ var global, factory; (i || '') ); } - var Kt = { + var Ot = { makeSizedDelim: function(t, e, i, s, a) { return '.' === e - ? Rt(t, s, a) + ? Bt(t, s, a) : ('<' === e || '\\lt' === e ? (e = '\\langle') : ('>' !== e && '\\gt' !== e) || (e = '\\rangle'), - Dt.includes(e) || Et.includes(e) - ? Tt(t, e, i, !1, s, a) - : zt.includes(e) - ? Ft(t, e, qt[i], !1, s, a) + Lt.includes(e) || Dt.includes(e) + ? Ct(t, e, i, !1, s, a) + : Ft.includes(e) + ? Tt(t, e, zt[i], !1, s, a) : null); }, - makeCustomSizedDelim: Ot, + makeCustomSizedDelim: It, makeLeftRightDelim: function(t, e, i, s, a, o) { - if ('.' === e) return Rt(t, a, o); + if ('.' === e) return Bt(t, a, o); const n = a.mathstyle.metrics.axisHeight * a.mathstyle.sizeMultiplier, @@ -6992,18 +6982,18 @@ var global, factory; c = Math.max(l, c); let h = (901 * c) / 500; return ( - (l = 2 * c - r), (h = Math.max(h, l)), Ot(t, e, h, !0, a, o) + (l = 2 * c - r), (h = Math.max(h, l)), It(t, e, h, !0, a, o) ); }, }; - const Nt = $.makeSpan, - $t = $.makeOrd, - Wt = $.makeInner, - Ht = $.makeHlist, - Vt = $.makeVlist, - Ut = /\u0393|\u0394|\u0398|\u039b|\u039E|\u03A0|\u03A3|\u03a5|\u03a6|\u03a8|\u03a9|[\u03b1-\u03c9]|\u03d1|\u03d5|\u03d6|\u03f1|\u03f5/, - jt = /^([A-Za-z]|[\u03b1-\u03c9]|\u03d1|\u03d5|\u03d6|\u03f1|\u03f5)$/, - Gt = { + const Rt = $.makeSpan, + Kt = $.makeOrd, + Nt = $.makeInner, + $t = $.makeHlist, + Wt = $.makeVlist, + Ht = /\u0393|\u0394|\u0398|\u039b|\u039E|\u03A0|\u03A3|\u03a5|\u03a6|\u03a8|\u03a9|[\u03b1-\u03c9]|\u03d1|\u03d5|\u03d6|\u03f1|\u03f5/, + Vt = /^([A-Za-z]|[\u03b1-\u03c9]|\u03d1|\u03d5|\u03d6|\u03f1|\u03f5)$/, + Ut = { size1: 0.5, size2: 0.7, size3: 0.8, @@ -7015,7 +7005,7 @@ var global, factory; size9: 2.07, size10: 2.49, }; - class Zt { + class jt { constructor(t, e, i, s) { (this.mode = t), (this.type = e), @@ -7049,16 +7039,16 @@ var global, factory; 'none' === this.backgroundColor && (this.backgroundColor = ''), 'auto' === this.fontSize && (this.fontSize = ''), - this.fontSize && (this.maxFontSize = Gt[this.fontSize]), + this.fontSize && (this.maxFontSize = Ut[this.fontSize]), 'math' === this.mode) ) { const t = 'string' == typeof this.body ? this.body : ''; (this.autoFontFamily = 'cmr'), - jt.test(t) + Vt.test(t) ? (this.autoFontFamily = 'math') : /\\imath|\\jmath|\\pounds/.test(t) ? (this.autoFontFamily = 'mainit') - : Ut.test(t) || + : Ht.test(t) || 'math' !== this.baseFontFamily || (this.autoFontFamily = 'cmr'); } else @@ -7132,7 +7122,7 @@ var global, factory; } decomposeGroup(t) { const e = t.clone({ mathstyle: this.mathstyle }), - i = $t(Qt(e, this.body)); + i = Kt(Jt(e, this.body)); return ( this.cssId && (i.cssId = this.cssId), i.applyStyle({ @@ -7189,11 +7179,11 @@ var global, factory; const h = []; for (let e = 0; e < s.length; ++e) { const i = - Qt( + Jt( t.clone({ mathstyle: this.mathstyle }), s[e] ) || [], - n = [$t(null)].concat(i); + n = [Kt(null)].concat(i); (o = Math.max(o, $.depth(n))), (a = Math.max(a, $.height(n))), h.push(n); @@ -7222,7 +7212,7 @@ var global, factory; i.push(s), i.push(t.pos - m)); } - i.length > 0 && u.push(Vt(t, i, 'individualShift')); + i.length > 0 && u.push(Wt(t, i, 'individualShift')); } const f = []; let g = !1, @@ -7233,22 +7223,22 @@ var global, factory; if (i.align && b >= u.length) break; if (i.align && b < u.length) g - ? f.push(Xt(2 * h.arraycolsep)) - : (y || x) && f.push(Xt(h.arraycolsep)), - f.push(Nt(u[b], 'col-align-' + i.align)), + ? f.push(Gt(2 * h.arraycolsep)) + : (y || x) && f.push(Gt(h.arraycolsep)), + f.push(Rt(u[b], 'col-align-' + i.align)), b++, (g = !0), (y = !1), (x = !1); else if (void 0 !== i.gap) 'number' == typeof i.gap - ? f.push(Xt(i.gap)) - : f.push(Jt(t, d, m, i.gap)), + ? f.push(Gt(i.gap)) + : f.push(Zt(t, d, m, i.gap)), (g = !1), (y = !1), (x = !1); else if (i.rule) { - const e = Nt(null, 'vertical-separator'); + const e = Rt(null, 'vertical-separator'); e.setStyle('height', l, 'em'), e.setStyle( 'margin-top', @@ -7268,25 +7258,25 @@ var global, factory; } } if ( - (g && !this.rFence && f.push(Xt(h.arraycolsep)), + (g && !this.rFence && f.push(Gt(h.arraycolsep)), !( (this.lFence && '.' !== this.lFence) || (this.rFence && '.' !== this.rFence) )) ) - return $t(f, 'mtable'); - const k = Nt(f, 'mtable'), + return Kt(f, 'mtable'); + const k = Rt(f, 'mtable'), v = $.height(k), w = $.depth(k); - return $t([ + return Kt([ this.bind( t, - Kt.makeLeftRightDelim('mopen', this.lFence, v, w, t) + Ot.makeLeftRightDelim('mopen', this.lFence, v, w, t) ), k, this.bind( t, - Kt.makeLeftRightDelim('mclose', this.rFence, v, w, t) + Ot.makeLeftRightDelim('mclose', this.rFence, v, w, t) ), ]); } @@ -7297,15 +7287,15 @@ var global, factory; : M.toMathstyle(this.mathstyle), i = t.clone({ mathstyle: e }); let s = []; - this.numerPrefix && s.push($t(this.numerPrefix)); + this.numerPrefix && s.push(Kt(this.numerPrefix)); const a = this.continuousFraction ? e : e.fracNum(); - s = s.concat(Qt(i.clone({ mathstyle: a }), this.numer)); - const o = Ht(s, t.mathstyle.adjustTo(a)); + s = s.concat(Jt(i.clone({ mathstyle: a }), this.numer)); + const o = $t(s, t.mathstyle.adjustTo(a)); let n = []; - this.denomPrefix && n.push($t(this.denomPrefix)); + this.denomPrefix && n.push(Kt(this.denomPrefix)); const r = this.continuousFraction ? e : e.fracDen(); - n = n.concat(Qt(i.clone({ mathstyle: r }), this.denom)); - const l = Ht(n, t.mathstyle.adjustTo(r)), + n = n.concat(Jt(i.clone({ mathstyle: r }), this.denom)); + const l = $t(n, t.mathstyle.adjustTo(r)), c = this.hasBarLine ? h.defaultRuleThickness / e.sizeMultiplier : 0; @@ -7325,21 +7315,21 @@ var global, factory; if (0 === c) { const t = d - u - (f - m); t < p && ((d += 0.5 * (p - t)), (m += 0.5 * (p - t))), - (g = Vt(i, [o, -d, l, m], 'individualShift')); + (g = Wt(i, [o, -d, l, m], 'individualShift')); } else { const t = e.metrics.axisHeight; d - u - (t + 0.5 * c) < p && (d += p - (d - u - (t + 0.5 * c))), t - 0.5 * c - (f - m) < p && (m += p - (t - 0.5 * c - (f - m))); - const s = Nt(null, ' frac-line'); + const s = Rt(null, ' frac-line'); s.applyStyle(this.getStyle()), (s.height = c); const a = []; o && (a.push(o), a.push(-d)), a.push(s), a.push(c / 2 - t), l && (a.push(l), a.push(m)), - (g = Vt(i, a, 'individualShift')); + (g = Wt(i, a, 'individualShift')); } (g.classes += ' mfrac'), (g.height *= e.sizeMultiplier / t.mathstyle.sizeMultiplier), @@ -7350,7 +7340,7 @@ var global, factory; : e.metrics.delim2, b = this.bind( t, - Kt.makeCustomSizedDelim( + Ot.makeCustomSizedDelim( 'mopen', this.leftDelim, y, @@ -7360,7 +7350,7 @@ var global, factory; ), x = this.bind( t, - Kt.makeCustomSizedDelim( + Ot.makeCustomSizedDelim( 'mclose', this.rightDelim, y, @@ -7369,7 +7359,7 @@ var global, factory; ) ); b.applyStyle(this.getStyle()), x.applyStyle(this.getStyle()); - const k = $t( + const k = Kt( [b, g, x], t.parentSize !== t.size ? 'sizing reset-' + t.parentSize + ' ' + t.size @@ -7380,12 +7370,12 @@ var global, factory; decomposeLeftright(t) { if (!this.body) return this.leftDelim - ? new Zt('math', 'mopen', this.leftDelim).decompose(t) + ? new jt('math', 'mopen', this.leftDelim).decompose(t) : this.rightDelim - ? new Zt('math', 'mclose', this.rightDelim).decompose(t) + ? new jt('math', 'mclose', this.rightDelim).decompose(t) : null; const e = t.clone(), - i = Qt(e, this.body), + i = Jt(e, this.body), s = e.mathstyle; let a = 0, o = 0, @@ -7397,7 +7387,7 @@ var global, factory; (n.push( this.bind( t, - Kt.makeLeftRightDelim( + Ot.makeLeftRightDelim( 'mopen', this.leftDelim, a, @@ -7415,7 +7405,7 @@ var global, factory; r = /ML__selected/.test(i[s].classes); (i[s] = this.bind( t, - Kt.makeLeftRightDelim( + Ot.makeLeftRightDelim( 'minner', i[s].delim, a, @@ -7455,16 +7445,16 @@ var global, factory; n.push( this.bind( t, - Kt.makeLeftRightDelim('mclose', s, a, o, e, i) + Ot.makeLeftRightDelim('mclose', s, a, o, e, i) ) ), n[n.length - 1].applyStyle(this.getStyle()); } - return this.inner ? Wt(n, s.cls()) : n; + return this.inner ? Nt(n, s.cls()) : n; } decomposeSurd(t) { const e = t.mathstyle, - i = Qt(t.cramp(), this.body), + i = Jt(t.cramp(), this.body), s = h.defaultRuleThickness / e.sizeMultiplier; let a = s; e.id < M.TEXT.id && (a = e.metrics.xHeight); @@ -7475,8 +7465,8 @@ var global, factory; ($.height(i) + $.depth(i)) * e.sizeMultiplier ) + (o + s), - r = Nt( - Kt.makeCustomSizedDelim('', '\\surd', n, !1, t), + r = Rt( + Ot.makeCustomSizedDelim('', '\\surd', n, !1, t), 'sqrt-sign' ); r.applyStyle(this.getStyle()); @@ -7484,22 +7474,22 @@ var global, factory; l > $.height(i) + $.depth(i) + o && (o = (o + l - ($.height(i) + $.depth(i))) / 2), r.setTop(r.height - $.height(i) - (o + s)); - const c = Nt(null, t.mathstyle.adjustTo(M.TEXT) + ' sqrt-line'); + const c = Rt(null, t.mathstyle.adjustTo(M.TEXT) + ' sqrt-line'); c.applyStyle(this.getStyle()), (c.height = s); - const d = Vt(t, [i, o, c, s]); - if (!this.index) return this.bind(t, $t([r, d], 'sqrt')); + const d = Wt(t, [i, o, c, s]); + if (!this.index) return this.bind(t, Kt([r, d], 'sqrt')); const p = t.clone({ mathstyle: M.SCRIPTSCRIPT }), - m = Nt(Qt(p, this.index), e.adjustTo(M.SCRIPTSCRIPT)), + m = Rt(Jt(p, this.index), e.adjustTo(M.SCRIPTSCRIPT)), u = Math.max(r.height, d.height), f = Math.max(r.depth, d.depth), - g = Vt(t, [m], 'shift', -0.6 * (u - f)); - return this.bind(t, $t([Nt(g, 'root'), r, d], 'sqrt')); + g = Wt(t, [m], 'shift', -0.6 * (u - f)); + return this.bind(t, Kt([Rt(g, 'root'), r, d], 'sqrt')); } decomposeAccent(t) { const e = t.mathstyle; - let i = Qt(t.cramp(), this.body); + let i = Jt(t.cramp(), this.body); (this.superscript || this.subscript) && - (i = this.attachSupsub(t, $t(i), 'mord')); + (i = this.attachSupsub(t, Kt(i), 'mord')); let s = 0; Array.isArray(this.body) && 1 === this.body.length && @@ -7509,18 +7499,18 @@ var global, factory; o = $.makeSymbol('Main-Regular', this.accent, 'math'); o.italic = 0; const n = '⃗' === this.accent ? ' accent-vec' : ''; - let r = Nt(Nt(o), 'accent-body' + n); + let r = Rt(Rt(o), 'accent-body' + n); return ( - (r = Vt(t, [i, -a, r])), + (r = Wt(t, [i, -a, r])), r.children[1].setLeft(2 * s), - $t(r, 'accent') + Kt(r, 'accent') ); } decomposeLine(t) { const e = t.mathstyle, - i = Qt(t.cramp(), this.body), + i = Jt(t.cramp(), this.body), s = h.defaultRuleThickness / e.sizeMultiplier, - a = Nt( + a = Rt( null, t.mathstyle.adjustTo(M.TEXT) + ' ' + @@ -7533,40 +7523,40 @@ var global, factory; (a.maxFontSize = 1), 'overline' === this.position) ) - o = Vt(t, [i, 3 * s, a, s]); + o = Wt(t, [i, 3 * s, a, s]); else { - const e = Nt(i); - o = Vt(t, [s, a, 3 * s, e], 'top', $.height(e)); + const e = Rt(i); + o = Wt(t, [s, a, 3 * s, e], 'top', $.height(e)); } - return $t(o, this.position); + return Kt(o, this.position); } decomposeOverunder(t) { - const e = Qt(t, this.body), + const e = Jt(t, this.body), i = t.clone({ mathstyle: 'scriptstyle' }), s = this.overscript - ? Nt( - Qt(i, this.overscript), + ? Rt( + Jt(i, this.overscript), t.mathstyle.adjustTo(i.mathstyle) ) : null, a = this.underscript - ? Nt( - Qt(i, this.underscript), + ? Rt( + Jt(i, this.underscript), t.mathstyle.adjustTo(i.mathstyle) ) : null; - return Yt(t, e, 0, 0, s, a, this.mathtype || 'mrel'); + return Xt(t, e, 0, 0, s, a, this.mathtype || 'mrel'); } decomposeOverlap(t) { - const e = Nt(Qt(t, this.body), 'inner'); - return $t( - [e, Nt(null, 'fix')], + const e = Rt(Jt(t, this.body), 'inner'); + return Kt( + [e, Rt(null, 'fix')], 'left' === this.align ? 'llap' : 'rlap' ); } decomposeRule(t) { const e = t.mathstyle, - i = $t('', 'rule'); + i = Kt('', 'rule'); let s = this.shift && !isNaN(this.shift) ? this.shift : 0; s /= e.sizeMultiplier; const a = this.width / e.sizeMultiplier, @@ -7607,7 +7597,7 @@ var global, factory; this.bind(t, i); } else Array.isArray(this.body) - ? ((i = $.makeOp(Qt(t, this.body))), this.bind(t, i)) + ? ((i = $.makeOp(Jt(t, this.body))), this.bind(t, i)) : (i = this.makeSpan(t, this.body)); if (this.superscript || this.subscript) { const s = this.limits || 'auto'; @@ -7620,8 +7610,8 @@ var global, factory; return this.symbol && i.setTop(a), i; } decomposeBox(t) { - const e = $t(Qt(t, this.body)), - i = Nt(); + const e = Kt(Jt(t, this.body)), + i = Rt(); i.setStyle('position', 'absolute'); const s = 'number' == typeof this.padding ? this.padding : h.fboxsep; @@ -7643,7 +7633,7 @@ var global, factory; e.setStyle('display', 'inline-block'), e.setStyle('height', e.height + e.depth, 'em'), e.setStyle('vertical-align', -e.depth + s, 'em'); - const a = Nt([i, e]); + const a = Rt([i, e]); return ( a.setStyle('position', 'relative'), a.setStyle('vertical-align', -s + e.depth, 'em'), @@ -7655,7 +7645,7 @@ var global, factory; ); } decomposeEnclose(t) { - const e = $t(Qt(t, this.body)), + const e = Kt(Jt(t, this.body)), i = 'auto' === this.padding ? 0.2 : this.padding; e.setStyle('padding', i, 'em'), e.setStyle('display', 'inline-block'), @@ -7747,7 +7737,7 @@ var global, factory; (i = 'string' == typeof this.body ? this.makeSpan(t, this.body) - : this.makeSpan(t, Qt(t, this.body))), + : this.makeSpan(t, Jt(t, this.body))), (i.type = this.type); else if ('group' === this.type || 'root' === this.type) i = this.decomposeGroup(t); @@ -7758,11 +7748,11 @@ var global, factory; else if ('leftright' === this.type) i = this.decomposeLeftright(t); else if ('delim' === this.type) - (i = Nt(null, '')), (i.delim = this.delim); + (i = Rt(null, '')), (i.delim = this.delim); else if ('sizeddelim' === this.type) i = this.bind( t, - Kt.makeSizedDelim(this.cls, this.delim, this.size, t) + Ot.makeSizedDelim(this.cls, this.delim, this.size, t) ); else if ('line' === this.type) i = this.decomposeLine(t); else if ('overunder' === this.type) @@ -7771,7 +7761,7 @@ var global, factory; else if ('rule' === this.type) i = this.decomposeRule(t); else if ('styling' === this.type); else if ('msubsup' === this.type) - (i = $t('​')), + (i = Kt('​')), e && ((i.height = e[0].height), (i.depth = e[0].depth)); else if ('mop' === this.type) i = this.decomposeOp(t); else if ('space' === this.type) i = this.makeSpan(t, ' '); @@ -7783,7 +7773,7 @@ var global, factory; ? this.makeSpan(t, ' ') : this.makeSpan(t, ' '); else if (this.width) - (i = Nt('​', 'mspace ')), + (i = Rt('​', 'mspace ')), this.width > 0 ? i.setWidth(this.width) : i.setStyle('margin-left', this.width, 'em'); @@ -7798,7 +7788,7 @@ var global, factory; ',': 'thinspace', '!': 'negativethinspace', }[this.body] || 'quad'; - i = Nt('​', 'mspace ' + t); + i = Rt('​', 'mspace ' + t); } else 'mathstyle' === this.type @@ -7840,12 +7830,12 @@ var global, factory; let a = null, o = null; if (this.superscript) { - const e = Qt(t.sup(), this.superscript); - a = Nt(e, s.adjustTo(s.sup())); + const e = Jt(t.sup(), this.superscript); + a = Rt(e, s.adjustTo(s.sup())); } if (this.subscript) { - const e = Qt(t.sub(), this.subscript); - o = Nt(e, s.adjustTo(s.sub())); + const e = Jt(t.sub(), this.subscript); + o = Rt(e, s.adjustTo(s.sub())); } let n, r = 0, @@ -7871,7 +7861,7 @@ var global, factory; const t = 0.8 * s.metrics.xHeight - (r - $.depth(a)); t > 0 && ((r += t), (l -= t)); } - (p = Vt(t, [o, l, a, -r], 'individualShift')), + (p = Wt(t, [o, l, a, -r], 'individualShift')), this.symbol && p.children[0].setLeft(-$.italic(e)); } else o && !a @@ -7880,7 +7870,7 @@ var global, factory; s.metrics.sub1, $.height(o) - 0.8 * s.metrics.xHeight )), - (p = Vt(t, [o], 'shift', l)), + (p = Wt(t, [o], 'shift', l)), p.children[0].setRight(d), this.isCharacterBox() && p.children[0].setLeft(-$.italic(e))) @@ -7891,9 +7881,9 @@ var global, factory; n, a.depth + 0.25 * s.metrics.xHeight )), - (p = Vt(t, [a], 'shift', -r)), + (p = Wt(t, [a], 'shift', -r)), p.children[0].setRight(d)); - const m = Nt(p, 'msubsup'); + const m = Rt(p, 'msubsup'); return ( this.caret && (m.caret = this.caret), $.makeSpanOfType(i, [e, m]) @@ -7901,18 +7891,18 @@ var global, factory; } attachLimits(t, e, i, s) { const a = this.superscript - ? Nt( - Qt(t.sup(), this.superscript), + ? Rt( + Jt(t.sup(), this.superscript), t.mathstyle.adjustTo(t.mathstyle.sup()) ) : null, o = this.subscript - ? Nt( - Qt(t.sub(), this.subscript), + ? Rt( + Jt(t.sub(), this.subscript), t.mathstyle.adjustTo(t.mathstyle.sub()) ) : null; - return Yt(t, e, i, s, a, o, 'mop'); + return Xt(t, e, i, s, a, o, 'mop'); } bind(t, e) { return ( @@ -7976,24 +7966,24 @@ var global, factory; ); } } - function Xt(t) { - const e = Nt('​', 'arraycolsep'); + function Gt(t) { + const e = Rt('​', 'arraycolsep'); return e.setWidth(t, 'em'), e; } - function Jt(t, e, i, s) { + function Zt(t, e, i, s) { const a = []; for (const o of e) { - const e = Nt(Qt(t, s)); + const e = Rt(Jt(t, s)); (e.depth = o.depth), (e.height = o.height), a.push(e), a.push(o.pos - i); } - return Vt(t, a, 'individualShift'); + return Wt(t, a, 'individualShift'); } - function Yt(t, e, i, s, a, o, n) { + function Xt(t, e, i, s, a, o, n) { if (!a && !o) return e; - e = Nt(e); + e = Rt(e); let r = 0, l = 0; a && (r = Math.max(h.bigOpSpacing1, h.bigOpSpacing3 - a.depth)), @@ -8008,7 +7998,7 @@ var global, factory; l + $.depth(e) + i; - (c = Vt( + (c = Wt( t, [h.bigOpSpacing5, o, l, e, r, a, h.bigOpSpacing5], 'bottom', @@ -8018,16 +8008,16 @@ var global, factory; c.children[2].setLeft(s); } else if (o && !a) { const a = $.height(e) - i; - (c = Vt(t, [h.bigOpSpacing5, o, l, e], 'top', a)), + (c = Wt(t, [h.bigOpSpacing5, o, l, e], 'top', a)), c.children[0].setLeft(-s); } else if (!o && a) { const o = $.depth(e) + i; - (c = Vt(t, [e, r, a, h.bigOpSpacing5], 'bottom', o)), + (c = Wt(t, [e, r, a, h.bigOpSpacing5], 'bottom', o)), c.children[1].setLeft(s); } return $.makeSpanOfType(n, c, 'op-limits'); } - function Qt(t, e) { + function Jt(t, e) { function i(t) { return 'mord' === t.type && /[0-9,.]/.test(t.latex); } @@ -8107,25 +8097,25 @@ var global, factory; for (const t of o) (t.height *= e), (t.depth *= e); } if (t.size !== t.parentSize) { - const e = Gt[t.size] / Gt[t.parentSize]; + const e = Ut[t.size] / Ut[t.parentSize]; for (const t of o) (t.height *= e), (t.depth *= e); } return o; } - var te = { - MathAtom: Zt, - decompose: Qt, + var Yt = { + MathAtom: jt, + decompose: Jt, makeRoot: function(t, e) { - const i = new Zt((t = t || 'math'), 'root', e || []); + const i = new jt((t = t || 'math'), 'root', e || []); return ( (0 !== i.body.length && 'first' === i.body[0].type) || - i.body.unshift(new Zt('', 'first')), + i.body.unshift(new jt('', 'first')), i ); }, - GREEK_REGEX: Ut, + GREEK_REGEX: Ht, }; - const ee = { + const Qt = { m0: '#3f3d99', m1: '#993d71', m2: '#998b3d', @@ -8137,7 +8127,7 @@ var global, factory; m8: '#3d7999', m9: '#843d99', }, - ie = { + te = { apricot: '#FBB982', aquamarine: '#00B5BE', bittersweet: '#C04F17', @@ -8207,7 +8197,7 @@ var global, factory; yellowgreen: '#98CC70', yelloworange: '#FAA21A', }; - var se = function(t) { + var ee = function(t) { const e = t.toLowerCase().split('!'); let i, s, @@ -8222,7 +8212,7 @@ var global, factory; (i = o), (s = n), (a = r); let c = e[t].match(/([a-z0-9]*)/); c && (c = c[1]); - let h = ie[c] || ee[c]; + let h = te[c] || Qt[c]; h || (h = e[t]); let d = h.match( /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i @@ -8278,21 +8268,21 @@ var global, factory; ('00' + Math.round(r).toString(16)).slice(-2) ); }, - ae = function(t) { + ie = function(t) { let e = t.toUpperCase(); - for (const t in ie) - if (ie[t] === e) { + for (const t in te) + if (te[t] === e) { e = t; break; } - for (const t in ee) - if (ee[t] === e) { + for (const t in Qt) + if (Qt[t] === e) { e = t; break; } return e; }, - oe = [ + se = [ '#d35d60', '#7293cb', '#e1974d', @@ -8306,7 +8296,7 @@ var global, factory; '#d4d5d2', '#ffffff', ], - ne = [ + ae = [ '#cc2428', '#3769b1', '#da7e30', @@ -8320,8 +8310,8 @@ var global, factory; '#adafaa', '#ffffff', ]; - const re = te.MathAtom; - class le { + const oe = Yt.MathAtom; + class ne { constructor(t, e, i) { (this.tokens = t), (this.index = 0), @@ -8365,7 +8355,7 @@ var global, factory; ? 'none' : this.mathList[this.mathList.length - 1].type; if ('mop' !== t && 'msubsup' !== t) { - const t = new re(this.parseMode, 'msubsup', '​'); + const t = new oe(this.parseMode, 'msubsup', '​'); (t.attributes = { 'aria-hidden': !0 }), this.mathList.push(t); } @@ -8403,7 +8393,7 @@ var global, factory; t < this.tokens.length && 'command' === this.tokens[t].type ) { - const e = At.getInfo( + const e = wt.getInfo( '\\' + this.tokens[t].value, this.parseMode, this.macros @@ -8434,13 +8424,13 @@ var global, factory; } placeholder() { if (this.args && 'string' == typeof this.args['?']) - return ce( + return re( n(this.args['?']), this.parseMode, null, this.macros ); - const t = new re( + const t = new oe( this.parseMode, 'placeholder', '?', @@ -8516,7 +8506,7 @@ var global, factory; return t; } scanColor() { - return se(this.scanString()); + return ee(this.scanString()); } scanNumber(t) { const e = this.parseLiteral('-'); @@ -8612,7 +8602,7 @@ var global, factory; ) return null; const e = this.swapParseMode('math'), - i = new re('math', 'group'); + i = new oe('math', 'group'); return ( (i.mathstyle = ')' === t ? 'textstyle' : 'displaystyle'), (i.body = this.scanImplicitGroup( @@ -8626,7 +8616,7 @@ var global, factory; scanModeShift() { if (!this.hasToken('$') && !this.hasToken('$$')) return null; const t = this.get().type, - e = new re('math', 'group'); + e = new oe('math', 'group'); (e.mathstyle = '$' === t ? 'textstyle' : 'displaystyle'), (e.latexOpen = 'textstyle' === e.mathstyle ? '$' : '$$'), (e.latexClose = e.latexOpen); @@ -8641,7 +8631,7 @@ var global, factory; scanEnvironment() { if (!this.parseCommand('begin')) return null; const t = this.scanArg('string'), - e = At.getEnvironmentInfo(t), + e = wt.getEnvironmentInfo(t), i = []; if (e && e.params) for (const t of e.params) @@ -8692,7 +8682,7 @@ var global, factory; ) return null; if (e.tabular && 0 === n.length) return null; - const d = new re( + const d = new oe( this.parseMode, 'array', h, @@ -8727,7 +8717,7 @@ var global, factory; ]) ) { this.parseMode = 'math'; - const t = new re('math', 'mathstyle'); + const t = new oe('math', 'mathstyle'); (t.mathstyle = this.get().value), this.mathList.push(t); } else this.hasInfixCommand() && !i @@ -8736,10 +8726,10 @@ var global, factory; let o; if (i) { const t = this.swapMathList(a), - e = At.getInfo('\\' + i.value, 'math', this.macros); + e = wt.getInfo('\\' + i.value, 'math', this.macros); o = e ? [ - new re( + new oe( this.parseMode, e.type, e.value || i.value, @@ -8748,13 +8738,13 @@ var global, factory; : null ), ] - : [new re(this.parseMode, 'mop', i.value)]; + : [new oe(this.parseMode, 'mop', i.value)]; } else o = this.swapMathList(a); return (this.style = e), o; } scanGroup() { if (!this.parseToken('{')) return null; - const t = new re(this.parseMode, 'group'); + const t = new oe(this.parseMode, 'group'); return ( (t.body = this.scanImplicitGroup(t => '}' === t.type)), this.parseToken('}'), @@ -8766,7 +8756,7 @@ var global, factory; scanSmartFence() { if ((this.skipWhitespace(), !this.parseLiteral('('))) return null; - const t = new re(this.parseMode, 'leftright'); + const t = new oe(this.parseMode, 'leftright'); (t.leftDelim = '('), (t.inner = !1); const e = this.swapMathList([]); let i = 1; @@ -8789,7 +8779,7 @@ var global, factory; 'command' === t.type ? (e = '\\' + t.value) : 'literal' === t.type && (e = t.value); - const i = At.getInfo(e, 'math', this.macros); + const i = wt.getInfo(e, 'math', this.macros); return i ? 'mopen' === i.type || 'mclose' === i.type ? e @@ -8815,7 +8805,7 @@ var global, factory; for (; !this.end() && !this.parseCommand(e); ) this.parseAtom(); this.style = t; const a = this.scanDelim(), - o = new re(this.parseMode, 'leftright'); + o = new oe(this.parseMode, 'leftright'); return ( (o.leftDelim = i), (o.rightDelim = a), @@ -8852,7 +8842,7 @@ var global, factory; const e = this.lastMathAtom(); (e.superscript = e.superscript || []), e.superscript.push( - new re(e.parseMode, 'mord', '′') + new oe(e.parseMode, 'mord', '′') ), (t = !0); } @@ -8894,7 +8884,7 @@ var global, factory; .trim() .split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/); for (const e of t) { - const t = se(e); + const t = ee(e); if (t) (s = s || {}), (s.backgroundcolor = t); else { const t = e.match( @@ -8985,13 +8975,13 @@ var global, factory; let e = null; if ('space' === t.type) 'text' === this.parseMode && - (e = new re('text', '', ' ', this.style)); + (e = new oe('text', '', ' ', this.style)); else if ('placeholder' === t.type) - (e = new re(this.parseMode, 'placeholder', t.value)), + (e = new oe(this.parseMode, 'placeholder', t.value)), (e.captureSelection = !0); else if ('command' === t.type) { if ('placeholder' === t.value) - (e = new re( + (e = new oe( this.parseMode, 'placeholder', this.scanArg('string'), @@ -9001,7 +8991,7 @@ var global, factory; else if ('char' === t.value) { let t = Math.floor(this.scanNumber(!0)); (!isFinite(t) || t < 0 || t > 1114111) && (t = 10067), - (e = new re( + (e = new oe( this.parseMode, 'math' === this.parseMode ? 'mord' : '', String.fromCodePoint(t) @@ -9015,7 +9005,7 @@ var global, factory; } else if ('hskip' === t.value || 'kern' === t.value) { const i = this.scanSkip(); isFinite(i) && - ((e = new re( + ((e = new oe( this.parseMode, 'spacing', null, @@ -9024,7 +9014,7 @@ var global, factory; (e.width = i)), (e.latex = '\\' + t.value); } else if (((e = this.scanMacro(t.value)), !e)) { - const i = At.getInfo( + const i = wt.getInfo( '\\' + t.value, this.parseMode, this.macros @@ -9051,7 +9041,7 @@ var global, factory; ) s.push(e); else if (t.placeholder) { - const e = new re( + const e = new oe( this.parseMode, 'placeholder', t.placeholder @@ -9066,7 +9056,7 @@ var global, factory; if (i.parse) { const a = i.parse('\\' + t.value, s); if (a.type) - e = new re( + e = new oe( this.parseMode, i.type, o ? this.scanArg(o) : null, @@ -9091,7 +9081,7 @@ var global, factory; const s = { ...this.style }; i.baseFontFamily && (s.baseFontFamily = i.baseFontFamily), - (e = new re( + (e = new oe( this.parseMode, i.type || 'mop', i.value || t.value, @@ -9111,7 +9101,7 @@ var global, factory; } } i || - ((e = new re( + ((e = new oe( this.parseMode, 'error', '\\' + t.value @@ -9119,12 +9109,12 @@ var global, factory; (e.latex = '\\' + t.value)); } } else if ('literal' === t.type) { - const i = At.getInfo(t.value, this.parseMode, this.macros); + const i = wt.getInfo(t.value, this.parseMode, this.macros); if (i) { const s = { ...this.style }; i.baseFontFamily && (s.baseFontFamily = i.baseFontFamily), - (e = new re( + (e = new oe( this.parseMode, i.type, i.value || t.value, @@ -9132,14 +9122,14 @@ var global, factory; )), i.isFunction && (e.isFunction = !0); } else - e = new re( + e = new oe( this.parseMode, 'math' === this.parseMode ? 'mord' : '', t.value, this.style ); if ( - ((e.latex = At.matchCodepoint( + ((e.latex = wt.matchCodepoint( this.parseMode, t.value.codePointAt(0) )), @@ -9157,7 +9147,7 @@ var global, factory; ) e = e[0]; else if (Array.isArray(e)) { - const t = new re(this.parseMode, 'group'); + const t = new oe(this.parseMode, 'group'); (t.body = e), (e = t); } else e = this.placeholder(); return e; @@ -9184,10 +9174,10 @@ var global, factory; this.args && 'string' == typeof this.args['?'] && (e['?'] = this.args['?']); - const a = new re( + const a = new oe( this.parseMode, 'group', - ce(n(i), this.parseMode, e, this.macros) + re(n(i), this.parseMode, e, this.macros) ); (a.captureSelection = !0), (a.latex = '\\' + t); let o = ''; @@ -9216,9 +9206,9 @@ var global, factory; ); } } - function ce(t, e, i, s, a) { + function re(t, e, i, s, a) { let o = []; - const n = new le(t, i, s); + const n = new ne(t, i, s); for ( n.parseMode = e || 'math', a && (n.smartFence = !0); !n.end(); @@ -9227,13 +9217,13 @@ var global, factory; o = o.concat(n.scanImplicitGroup()); return o; } - var he = { Parser: le, parseTokens: ce }; - function de(t, e) { + var le = { Parser: ne, parseTokens: re }; + function ce(t, e) { let i = ''; for (const e of t) i += e.relation + ':' + e.offset + '/'; return e && (i += '#' + e), i; } - function pe(t) { + function he(t) { const e = { path: [], extent: 0 }, i = t.split('#'); i.length > 1 && (e.extent = parseInt(i[1])); @@ -9244,9 +9234,9 @@ var global, factory; } return e; } - var me = { - pathFromString: pe, - pathToString: de, + var de = { + pathFromString: he, + pathToString: ce, pathDistance: function(t, e) { let i = 0, s = -1, @@ -9287,10 +9277,10 @@ var global, factory; return i; }, clone: function(t) { - return pe(de(t)).path; + return he(ce(t)).path; }, }; - const ue = { + const pe = { Left: 'moveToPreviousChar', Right: 'moveToNextChar', Up: 'moveUp', @@ -9528,7 +9518,7 @@ var global, factory; { withHighlighting: !0 }, ], }, - fe = { + me = { '\\theta': 'Alt-KeyQ', '\\sqrt': ['Alt-KeyV', 'Ctrl-Digit2'], '\\pi': 'Alt-KeyP', @@ -9551,7 +9541,7 @@ var global, factory; '\\varnothing': 'Alt-Shift-KeyO', '\\~': '~', }, - ge = { + ue = { "''": { mode: 'math', value: '^{\\doubleprime}' }, alpha: '\\alpha', delta: '\\delta', @@ -9803,7 +9793,7 @@ var global, factory; '}': '\\}', '*': '\\cdot', }; - function ye(t, e, i) { + function fe(t, e, i) { if (!i) return i; if ('string' == typeof i) return i; if ('string' == typeof i.mode && i.mode !== t) return null; @@ -9830,7 +9820,7 @@ var global, factory; (s = !y || 'first' === y.type), y && ((f = 'text' === y.mode), - (a = !f && 'mord' === y.type && At.LETTER.test(y.body)), + (a = !f && 'mord' === y.type && wt.LETTER.test(y.body)), (o = !f && 'mord' === y.type && /[0-9]+$/.test(y.body)), (n = !f && y.isFunction), (r = 'genfrac' === y.type), @@ -9862,7 +9852,7 @@ var global, factory; : i.value ); } - function be(t) { + function ge(t) { let e = 'other'; return ( navigator && @@ -9883,7 +9873,7 @@ var global, factory; e === t ? t : '!' + t ); } - function xe(t) { + function ye(t) { let e = t; return ( Array.isArray(e) && @@ -9892,7 +9882,7 @@ var global, factory; e ); } - function ke(t, e) { + function be(t, e) { let i = ''; Array.isArray(t) || (t = [t]); for (const s of t) { @@ -9900,12 +9890,12 @@ var global, factory; const a = s.match(/(^[^:]*):/), o = a ? a[1] : ''; if ( - o === be('mac') || - o === be('win') || - o === be('ios') || - o === be('android') || - o === be('chromeos') || - o === be('other') + o === ge('mac') || + o === ge('win') || + o === ge('ios') || + o === ge('android') || + o === ge('chromeos') || + o === ge('other') ) { const e = s.match(/:([^:]*)$/); t = e ? e[1] : s; @@ -9929,7 +9919,7 @@ var global, factory; t = e ? e[1] : s; } if (t) { - const s = 'mac' === be('mac') || 'ios' === be('ios'), + const s = 'mac' === ge('mac') || 'ios' === ge('ios'), a = t.length > 1 ? t.split('-') : [t]; let o = ''; for (const t of a) @@ -9987,16 +9977,16 @@ var global, factory; } return i; } - var ve = { - KEYBOARD_SHORTCUTS: ue, - INLINE_SHORTCUTS: ge, - stringify: ke, + var xe = { + KEYBOARD_SHORTCUTS: pe, + INLINE_SHORTCUTS: ue, + stringify: be, startsWithString: function(t, e) { const i = []; for (let s = 0; s <= t.length - 1; s++) { const a = t.substring(s); (e && e.overrideDefaultInlineShortcuts) || - Object.keys(ge).forEach(t => { + Object.keys(ue).forEach(t => { t.startsWith(a) && !i.includes(t) && i.push(t); }); const o = e && e.inlineShortcuts ? e.inlineShortcuts : null; @@ -10010,37 +10000,37 @@ var global, factory; forString: function(t, e, i, s) { let a = ''; (s && s.overrideDefaultInlineShortcuts) || - (a = ye(t, e, ge[i])); + (a = fe(t, e, ue[i])); const o = s && s.inlineShortcuts ? s.inlineShortcuts : null; let n; - return o && (n = ye(t, e, o[i])), n || a; + return o && (n = fe(t, e, o[i])), n || a; }, selectorForKeystroke: function(t, e) { for (const i of [ - be('mac') + ':' + t + ':' + e, - be('win') + ':' + t + ':' + e, - be('ios') + ':' + t + ':' + e, - be('android') + ':' + t + ':' + e, - be('chromeos') + ':' + t + ':' + e, - be('other') + ':' + t + ':' + e, - be('mac') + ':' + e, - be('win') + ':' + e, - be('ios') + ':' + e, - be('android') + ':' + e, - be('chromeos') + ':' + e, + ge('mac') + ':' + t + ':' + e, + ge('win') + ':' + t + ':' + e, + ge('ios') + ':' + t + ':' + e, + ge('android') + ':' + t + ':' + e, + ge('chromeos') + ':' + t + ':' + e, + ge('other') + ':' + t + ':' + e, + ge('mac') + ':' + e, + ge('win') + ':' + e, + ge('ios') + ':' + e, + ge('android') + ':' + e, + ge('chromeos') + ':' + e, t + ':' + e, e, ]) - if (ue[i]) return ue[i]; + if (pe[i]) return pe[i]; return ''; }, forCommand: function(t) { let e = []; if ('string' == typeof t) { - const i = fe[t]; + const i = me[t]; Array.isArray(i) ? (e = i.slice()) : i && e.push(i); } - t = xe(t); + t = ye(t); const i = new RegExp( '^' + t @@ -10052,35 +10042,35 @@ var global, factory; '([^*a-zA-Z]|$)' ); return ( - Object.keys(ue).forEach(t => { - if (i.test(xe(ue[t]))) { + Object.keys(pe).forEach(t => { + if (i.test(ye(pe[t]))) { const i = t.match(/:([^:]*)$/); i && e.push(i[1]); } }), - ke(e) + be(e) ); }, }; - function we(t, e) { - (this.root = te.makeRoot()), + function ke(t, e) { + (this.root = Yt.makeRoot()), (this.path = [{ relation: 'body', offset: 0 }]), (this.extent = 0), (this.config = t ? { ...t } : {}), (this.target = e), (this.suppressChangeNotifications = !1); } - function Se(t) { - const e = Object.assign(new we(t.config, t.target), t); - return (e.path = me.clone(t.path)), e; + function ve(t) { + const e = Object.assign(new ke(t.config, t.target), t); + return (e.path = de.clone(t.path)), e; } - function Ae(t, e) { + function we(t, e) { let i = 0; for (let s = 0; s < e.row; s++) for (let e = 0; e < t[s].length; e++) i += 1; return (i += e.col), i; } - function Me(t, e) { + function Se(t, e) { if ('string' == typeof e) { const t = e.match(/cell([0-9]*)$/); t && (e = parseInt(t[1])); @@ -10093,25 +10083,25 @@ var global, factory; (e -= 1); return i; } - function Ce(t, e) { + function Ae(t, e) { let i; return ( - 'object' != typeof e && (e = Me(t, e)), + 'object' != typeof e && (e = Se(t, e)), Array.isArray(t[e.row]) && (i = t[e.row][e.col] || null), !i || (0 !== i.length && 'first' === i[0].type) || - i.unshift(Be()), + i.unshift(Pe()), i ); } - function _e(t) { + function Me(t) { let e = 0, i = 0, s = 1; for (const e of t) (i += 1), e.length > s && (s = e.length); return (e = i * s), e; } - function Te(t, e, i) { + function Ce(t, e, i) { if (!t) return []; e || (e = ','); let s, @@ -10122,35 +10112,35 @@ var global, factory; o.length > 0 && (s ? a.push(s) - : (s = new te.MathAtom('math', 'mpunct', e, i)), + : (s = new Yt.MathAtom('math', 'mpunct', e, i)), (a = a.concat(o))); return a; } - function Le(t, e, i) { + function _e(t, e, i) { const s = { ...e }; if (((s.row += i), s.row < 0)) { if (((s.col += i), (s.row = t.length - 1), s.col < 0)) return null; - for (; s.row >= 0 && !Ce(t, s); ) s.row -= 1; + for (; s.row >= 0 && !Ae(t, s); ) s.row -= 1; if (s.row < 0) return null; } else if (s.row >= t.length) { - for (s.col += i, s.row = 0; s.row < t.length && !Ce(t, s); ) + for (s.col += i, s.row = 0; s.row < t.length && !Ae(t, s); ) s.row += 1; if (s.row > t.length - 1) return null; } return s; } - function Fe(t) { + function Te(t) { return ( !!t && (('mord' === t.type && /[0-9.]/.test(t.body)) || ('mpunct' === t.type && ',' === t.body)) ); } - function De(t, e) { + function Le(t, e) { if (!t) return !1; if (Array.isArray(t)) { - for (const i of t) if (De(i, e)) return !0; + for (const i of t) if (Le(i, e)) return !0; } else { if (t === e) return !0; if ( @@ -10164,17 +10154,17 @@ var global, factory; 'underscript', 'overscript', ].some(function(i) { - return i === e || De(t[i], e); + return i === e || Le(t[i], e); }) ) return !0; if (t.array) - for (let i = _e(t.array); i >= 0; i--) - if (De(Ce(t.array, i), e)) return !0; + for (let i = Me(t.array); i >= 0; i--) + if (Le(Ae(t.array, i), e)) return !0; } return !1; } - function ze(t) { + function Fe(t) { if (t) return ( 1 === t.length && @@ -10184,7 +10174,7 @@ var global, factory; t ); } - function Ee(t, e) { + function De(t, e) { if (!t) return ''; if (t.length <= 1) return t; if (!e || 'ASCIIMath' !== e.format) { @@ -10195,7 +10185,7 @@ var global, factory; if (((t = t.replace(/\\\\([^\s\n])/g, '\\$1')), /\\/.test(t))) return t; } - return qe( + return ze( (t = (t = (t = (t = (t = (t = t.replace( /\u2061/gu, '' @@ -10209,66 +10199,66 @@ var global, factory; e ); } - function qe(t, e) { + function ze(t, e) { if (!t) return ''; let i, s = !1; if ( (s || ('^' !== t[0] && '_' !== t[0]) || - ((i = Pe(t.substr(1), { ...e, noWrap: !0 })), + ((i = Ee(t.substr(1), { ...e, noWrap: !0 })), (t = t[0] + '{' + i.match + '}'), - (t += qe(i.rest, e)), + (t += ze(i.rest, e)), (s = !0)), s || ((i = t.match(/^(sqrt|\u221a)(.*)/)), i && - ((i = Pe(i[2], { ...e, noWrap: !0 })), + ((i = Ee(i[2], { ...e, noWrap: !0 })), (t = '\\sqrt{' + i.match + '}'), - (t += qe(i.rest, e)), + (t += ze(i.rest, e)), (s = !0))), s || ((i = t.match(/^(\\cbrt|\u221b)(.*)/)), i && - ((i = Pe(i[2], { ...e, noWrap: !0 })), + ((i = Ee(i[2], { ...e, noWrap: !0 })), (t = '\\sqrt[3]{' + i.match + '}'), - (t += qe(i.rest, e)), + (t += ze(i.rest, e)), (s = !0))), s || ((i = t.match(/^abs(.*)/)), i && - ((i = Pe(i[1], { ...e, noWrap: !0 })), + ((i = Ee(i[1], { ...e, noWrap: !0 })), (t = '\\left|' + i.match + '\\right|'), - (t += qe(i.rest, e)), + (t += ze(i.rest, e)), (s = !0))), s || ((i = t.match(/^["”“](.*?)["”“](.*)/)), i && ((t = '\\text{' + i[1] + '}'), - (t += qe(i[2], e)), + (t += ze(i[2], e)), (s = !0))), s || ((i = t.match(/^([^a-zA-Z({[_^\\\s"]+)(.*)/)), - i && ((t = Ie(i[1], e)), (t += qe(i[2], e)), (s = !0))), + i && ((t = qe(i[1], e)), (t += ze(i[2], e)), (s = !0))), !s && /^(f|g|h)[^a-zA-Z]/.test(t) && - ((i = Pe(t.substring(1), { ...e, noWrap: !0 })), + ((i = Ee(t.substring(1), { ...e, noWrap: !0 })), (t = '(' === t[1] ? t[0] + '\\mleft(' + i.match + '\\mright)' : t[0] + i.match), - (t += qe(i.rest, e)), + (t += ze(i.rest, e)), (s = !0)), s || ((i = t.match(/^([a-zA-Z]+)(.*)/)), - i && ((t = Ie(i[1], e)), (t += qe(i[2], e)), (s = !0))), + i && ((t = qe(i[1], e)), (t += ze(i[2], e)), (s = !0))), !s) ) if ( - ((i = Pe(t, { ...e, noWrap: !0 })), + ((i = Ee(t, { ...e, noWrap: !0 })), i.match && '/' === i.rest[0]) ) { - const a = Pe(i.rest.substr(1), { ...e, noWrap: !0 }); + const a = Ee(i.rest.substr(1), { ...e, noWrap: !0 }); a.match && (t = '\\frac{' + @@ -10276,7 +10266,7 @@ var global, factory; '}{' + a.match + '}' + - qe(a.rest, e)), + ze(a.rest, e)), (s = !0); } else i.match && @@ -10285,17 +10275,17 @@ var global, factory; ? '\\left(' + i.match + '\\right)' + - qe(i.rest, e) - : i.match + qe(i.rest, e)), + ze(i.rest, e) + : i.match + ze(i.rest, e)), (s = !0)); return ( s || ((i = t.match(/^(\s+)(.*)$/)), - i && ((t = ' ' + qe(i[2], e)), (s = !0))), + i && ((t = ' ' + ze(i[2], e)), (s = !0))), t ); } - function Pe(t, e) { + function Ee(t, e) { let i = '', s = (t = t.trim()), a = t.charAt(0), @@ -10307,14 +10297,14 @@ var global, factory; t[r] === a && n++, t[r] === o && n--, r++; 0 === n ? (e.noWrap && '(' === a - ? (i = qe(t.substring(1, r - 1), e)) + ? (i = ze(t.substring(1, r - 1), e)) : ('{' === a && '}' === o && ((a = '\\{'), (o = '\\}')), (i = '\\left' + a + - qe(t.substring(1, r - 1), e) + + ze(t.substring(1, r - 1), e) + '\\right' + o)), (s = t.substring(r))) @@ -10322,7 +10312,7 @@ var global, factory; } else { let a = t.match(/^([a-zA-Z]+)/); if (a) { - let i = ve.forString('math', null, t, e); + let i = xe.forString('math', null, t, e); if (i) return ( (i = i.replace('_{#?}', '')), @@ -10340,8 +10330,8 @@ var global, factory; } return { match: i, rest: s }; } - function Ie(t, e) { - let i = ve.forString('math', null, t, e); + function qe(t, e) { + let i = xe.forString('math', null, t, e); return ( i ? ((i = i.replace('_{#?}', '')), @@ -10351,18 +10341,18 @@ var global, factory; i ); } - function Be() { - return new te.MathAtom('', 'first'); + function Pe() { + return new Yt.MathAtom('', 'first'); } - (we.prototype._announce = function(t, e, i) { + (ke.prototype._announce = function(t, e, i) { 'function' == typeof this.config.onAnnounce && this.config.onAnnounce(this.target, t, e, i); }), - (we.prototype.filter = function(t, e) { + (ke.prototype.filter = function(t, e) { e = e < 0 ? -1 : 1; const i = [], - s = new we(); - (s.path = me.clone(this.path)), + s = new ke(); + (s.path = de.clone(this.path)), (s.extent = this.extent), (s.root = this.root), e >= 0 @@ -10377,10 +10367,10 @@ var global, factory; } while (a !== s.anchor()); return i; }), - (we.prototype.forEach = function(t) { + (ke.prototype.forEach = function(t) { this.root.forEach(t); }), - (we.prototype.forEachSelected = function(t, e) { + (ke.prototype.forEachSelected = function(t, e) { (e = e || {}).recursive = void 0 !== e.recursive && e.recursive; const i = this.siblings(), s = this.startOffset() + 1, @@ -10392,10 +10382,10 @@ var global, factory; for (let e = s; e < a; e++) i[e] && 'first' !== i[e].type && t(i[e]); }), - (we.prototype.toString = function() { - return me.pathToString(this.path, this.extent); + (ke.prototype.toString = function() { + return de.pathToString(this.path, this.extent); }), - (we.prototype.adjustPlaceholder = function() { + (ke.prototype.adjustPlaceholder = function() { const t = this.siblings(); if (t && t.length <= 1) { let e; @@ -10414,7 +10404,7 @@ var global, factory; e) ) { const e = [ - new te.MathAtom( + new Yt.MathAtom( 'math', 'placeholder', '⬚', @@ -10425,30 +10415,30 @@ var global, factory; } } }), - (we.prototype.selectionWillChange = function() { + (ke.prototype.selectionWillChange = function() { 'function' != typeof this.config.onSelectionWillChange || this.suppressChangeNotifications || this.config.onSelectionWillChange(this.target); }), - (we.prototype.selectionDidChange = function() { + (ke.prototype.selectionDidChange = function() { 'function' != typeof this.config.onSelectionDidChange || this.suppressChangeNotifications || this.config.onSelectionDidChange(this.target); }), - (we.prototype.contentWillChange = function() { + (ke.prototype.contentWillChange = function() { 'function' != typeof this.config.onContentWillChange || this.suppressChangeNotifications || this.config.onContentWillChange(this.target); }), - (we.prototype.contentDidChange = function() { + (ke.prototype.contentDidChange = function() { 'function' != typeof this.config.onContentDidChange || this.suppressChangeNotifications || this.config.onContentDidChange(this.target); }), - (we.prototype.setPath = function(t, e) { - if ('string' == typeof t) t = me.pathFromString(t); + (ke.prototype.setPath = function(t, e) { + if ('string' == typeof t) t = de.pathFromString(t); else if (Array.isArray(t)) { - const i = me.clone(t), + const i = de.clone(t), s = this.path; (this.path = i), 0 === e && @@ -10457,13 +10447,13 @@ var global, factory; (t = { path: i, extent: e || 0 }), (this.path = s); } - const i = 0 !== me.pathDistance(this.path, t.path), + const i = 0 !== de.pathDistance(this.path, t.path), s = t.extent !== this.extent; return ( (i || s) && (i && this.adjustPlaceholder(), this.selectionWillChange(), - (this.path = me.clone(t.path)), + (this.path = de.clone(t.path)), this.siblings().length < this.anchorOffset() ? ((this.path = [{ relation: 'body', offset: 0 }]), (this.extent = 0)) @@ -10472,16 +10462,16 @@ var global, factory; i || s ); }), - (we.prototype.wordBoundary = function(t, e) { + (ke.prototype.wordBoundary = function(t, e) { e = e < 0 ? -1 : 1; - const i = new we(); - (i.path = me.clone(t)), (i.root = this.root); + const i = new ke(); + (i.path = de.clone(t)), (i.root = this.root); let s = 0; for ( ; i.sibling(s) && 'text' === i.sibling(s).mode && - At.LETTER_AND_DIGITS.test(i.sibling(s).body); + wt.LETTER_AND_DIGITS.test(i.sibling(s).body); ) s += e; @@ -10491,19 +10481,19 @@ var global, factory; i.path ); }), - (we.prototype.wordBoundaryOffset = function(t, e) { + (ke.prototype.wordBoundaryOffset = function(t, e) { e = e < 0 ? -1 : 1; const i = this.siblings(); if (!i[t]) return t; if ('text' !== i[t].mode) return t; let s; - if (At.LETTER_AND_DIGITS.test(i[t].body)) { + if (wt.LETTER_AND_DIGITS.test(i[t].body)) { let a, o = t; do { (a = 'text' === i[o].mode && - At.LETTER_AND_DIGITS.test(i[o].body)), + wt.LETTER_AND_DIGITS.test(i[o].body)), (o += e); } while (i[o] && a); s = i[o] ? o - 2 * e : o - e; @@ -10541,24 +10531,24 @@ var global, factory; } return s - (e > 0 ? 0 : 1); }), - (we.prototype.setRange = function(t, e, i) { + (ke.prototype.setRange = function(t, e, i) { i = i || {}; - const s = me.pathDistance(t, e); + const s = de.pathDistance(t, e); if (0 === s) return i.extendToWordBoundary ? ((t = this.wordBoundary(t, -1)), (e = this.wordBoundary(e, 1)), this.setRange(t, e)) - : this.setPath(me.clone(t), 0); + : this.setPath(de.clone(t), 0); if (1 === s) { const s = e[e.length - 1].offset - t[t.length - 1].offset; return i.extendToWordBoundary ? ((t = this.wordBoundary(t, s < 0 ? 1 : -1)), (e = this.wordBoundary(e, s < 0 ? -1 : 1)), this.setRange(t, e)) - : this.setPath(me.clone(t), s); + : this.setPath(de.clone(t), s); } - let a = me.pathCommonAncestor(t, e); + let a = de.pathCommonAncestor(t, e); const o = a.length; if ( t.length === o || @@ -10566,7 +10556,7 @@ var global, factory; t[o].relation !== e[o].relation ) return this.setPath(a, -1); - a.push(t[o]), (a = me.clone(a)); + a.push(t[o]), (a = de.clone(a)); let n = e[o].offset - t[o].offset + 1; return ( n <= 0 @@ -10584,18 +10574,18 @@ var global, factory; this.setPath(a, n) ); }), - (we.prototype.ancestor = function(t) { + (ke.prototype.ancestor = function(t) { if (t > this.path.length) return null; let e = this.root; for (let i = 0; i < this.path.length - t; i++) { const t = this.path[i]; - if (e.array) e = Ce(e.array, t.relation)[t.offset]; + if (e.array) e = Ae(e.array, t.relation)[t.offset]; else { if (!e[t.relation]) return null; { (0 !== e[t.relation].length && 'first' === e[t.relation][0].type) || - e[t.relation].unshift(Be()); + e[t.relation].unshift(Pe()); const i = Math.min( t.offset, e[t.relation].length - 1 @@ -10606,76 +10596,76 @@ var global, factory; } return e; }), - (we.prototype.anchor = function() { + (ke.prototype.anchor = function() { if (this.parent().array) - return Ce(this.parent().array, this.relation())[ + return Ae(this.parent().array, this.relation())[ this.anchorOffset() ]; const t = this.siblings(); return t[Math.min(t.length - 1, this.anchorOffset())]; }), - (we.prototype.parent = function() { + (ke.prototype.parent = function() { return this.ancestor(1); }), - (we.prototype.relation = function() { + (ke.prototype.relation = function() { return this.path.length > 0 ? this.path[this.path.length - 1].relation : ''; }), - (we.prototype.anchorOffset = function() { + (ke.prototype.anchorOffset = function() { return this.path.length > 0 ? this.path[this.path.length - 1].offset : 0; }), - (we.prototype.focusOffset = function() { + (ke.prototype.focusOffset = function() { return this.path.length > 0 ? this.path[this.path.length - 1].offset + this.extent : 0; }), - (we.prototype.startOffset = function() { + (ke.prototype.startOffset = function() { return Math.min(this.focusOffset(), this.anchorOffset()); }), - (we.prototype.endOffset = function() { + (ke.prototype.endOffset = function() { return Math.max(this.focusOffset(), this.anchorOffset()); }), - (we.prototype.insertFirstAtom = function() { + (ke.prototype.insertFirstAtom = function() { this.siblings(); }), - (we.prototype.siblings = function() { + (ke.prototype.siblings = function() { if (0 === this.path.length) return []; let t; return ( this.parent().array - ? (t = Ce(this.parent().array, this.relation())) + ? (t = Ae(this.parent().array, this.relation())) : ((t = this.parent()[this.relation()] || []), 'string' == typeof t && (t = [])), (0 !== t.length && 'first' === t[0].type) || - t.unshift(Be()), + t.unshift(Pe()), t ); }), - (we.prototype.sibling = function(t) { + (ke.prototype.sibling = function(t) { return this.siblings()[this.startOffset() + t]; }), - (we.prototype.isCollapsed = function() { + (ke.prototype.isCollapsed = function() { return 0 === this.extent; }), - (we.prototype.setExtent = function(t) { + (ke.prototype.setExtent = function(t) { this.extent = t; }), - (we.prototype.collapseForward = function() { + (ke.prototype.collapseForward = function() { return ( 0 !== this.extent && (this.setSelection(this.endOffset()), !0) ); }), - (we.prototype.collapseBackward = function() { + (ke.prototype.collapseBackward = function() { return ( 0 !== this.extent && (this.setSelection(this.startOffset()), !0) ); }), - (we.prototype.selectGroup_ = function() { + (ke.prototype.selectGroup_ = function() { const t = this.siblings(); if ('text' === this.anchorMode()) { let e = this.startOffset(), @@ -10684,7 +10674,7 @@ var global, factory; ; t[e] && 'text' === t[e].mode && - At.LETTER_AND_DIGITS.test(t[e].body); + wt.LETTER_AND_DIGITS.test(t[e].body); ) e -= 1; @@ -10692,7 +10682,7 @@ var global, factory; ; t[i] && 'text' === t[i].mode && - At.LETTER_AND_DIGITS.test(t[i].body); + wt.LETTER_AND_DIGITS.test(t[i].body); ) i += 1; @@ -10705,27 +10695,27 @@ var global, factory; ) { let e = this.startOffset(), i = this.endOffset(); - for (; Fe(t[e]); ) e -= 1; - for (; Fe(t[i]); ) i += 1; + for (; Te(t[e]); ) e -= 1; + for (; Te(t[i]); ) i += 1; (i -= 1), this.setSelection(e, i - e); } else this.setSelection(0, 'end'); }), - (we.prototype.selectAll_ = function() { + (ke.prototype.selectAll_ = function() { (this.path = [{ relation: 'body', offset: 0 }]), this.setSelection(0, 'end'); }), - (we.prototype.deleteAll_ = function() { + (ke.prototype.deleteAll_ = function() { this.selectAll_(), this.delete_(); }), - (we.prototype.contains = function(t) { + (ke.prototype.contains = function(t) { if (this.isCollapsed()) return !1; const e = this.siblings(), i = this.startOffset(), s = this.endOffset(); - for (let a = i; a < s; a++) if (De(e[a], t)) return !0; + for (let a = i; a < s; a++) if (Le(e[a], t)) return !0; return !1; }), - (we.prototype.getSelectedAtoms = function() { + (ke.prototype.getSelectedAtoms = function() { if (this.isCollapsed()) return null; const t = [], e = this.siblings(), @@ -10735,7 +10725,7 @@ var global, factory; e[a] && 'first' !== e[a].type && t.push(e[a]); return t; }), - (we.prototype.commandOffsets = function() { + (ke.prototype.commandOffsets = function() { const t = this.siblings(); if (t.length <= 1) return null; let e = Math.min(this.endOffset(), t.length - 1); @@ -10745,7 +10735,7 @@ var global, factory; for (; i <= t.length - 1 && 'command' === t[i].type; ) i += 1; return i > e ? { start: e + 1, end: i } : null; }), - (we.prototype.extractCommandStringAroundInsertionPoint = function( + (ke.prototype.extractCommandStringAroundInsertionPoint = function( t ) { let e = ''; @@ -10757,7 +10747,7 @@ var global, factory; } return e; }), - (we.prototype.decorateCommandStringAroundInsertionPoint = function( + (ke.prototype.decorateCommandStringAroundInsertionPoint = function( t ) { const e = this.commandOffsets(); @@ -10766,7 +10756,7 @@ var global, factory; for (let s = e.start; s < e.end; s++) i[s].error = t; } }), - (we.prototype.commitCommandStringBeforeInsertionPoint = function() { + (ke.prototype.commitCommandStringBeforeInsertionPoint = function() { const t = this.commandOffsets(); if (t) { const e = this.siblings(), @@ -10775,7 +10765,7 @@ var global, factory; e[s] && (e[s].suggestion = !1); } }), - (we.prototype.spliceCommandStringAroundInsertionPoint = function( + (ke.prototype.spliceCommandStringAroundInsertionPoint = function( t ) { const e = this.commandOffsets(); @@ -10801,7 +10791,7 @@ var global, factory; this.contentDidChange(); } }), - (we.prototype.removeCommandString = function() { + (ke.prototype.removeCommandString = function() { this.contentWillChange(); const t = this.suppressChangeNotifications; (this.suppressChangeNotifications = !0), @@ -10823,13 +10813,13 @@ var global, factory; t(e.index), e.array) ) - for (let i = _e(e.array); i >= 0; i--) - t(Ce(e.array, i)); + for (let i = Me(e.array); i >= 0; i--) + t(Ae(e.array, i)); })(this.root.body), (this.suppressChangeNotifications = t), this.contentDidChange(); }), - (we.prototype.extractArgBeforeInsertionPoint = function() { + (ke.prototype.extractArgBeforeInsertionPoint = function() { const t = this.siblings(); if (t.length <= 1) return []; const e = []; @@ -10847,7 +10837,7 @@ var global, factory; e.unshift(t[i]), i--; return e; }), - (we.prototype.setSelection = function(t, e, i) { + (ke.prototype.setSelection = function(t, e, i) { (t = t || 0), (e = e || 0); const s = this.path[this.path.length - 1].relation; i || (i = s); @@ -10878,7 +10868,7 @@ var global, factory; !0 ); }), - (we.prototype.next = function(t) { + (ke.prototype.next = function(t) { t = t || {}; const e = { body: 'numer', @@ -10896,14 +10886,14 @@ var global, factory; for (; i && !s[i]; ) i = e[i]; if (i) return void this.setSelection(0, 0, i); if (this.parent().array) { - const t = _e(this.parent().array); + const t = Me(this.parent().array); let e = parseInt( this.relation().match(/cell([0-9]*)$/)[1] ) + 1; for (; e < t; ) { if ( - Ce(this.parent().array, e) && + Ae(this.parent().array, e) && this.setSelection(0, 0, 'cell' + e) ) return void this.selectionDidChange(); @@ -10928,9 +10918,9 @@ var global, factory; if (i.array) { let t = 0; s = ''; - const e = _e(i.array); + const e = Me(i.array); for (; !s && t < e; ) - Ce(i.array, t) && (s = 'cell' + t.toString()), + Ae(i.array, t) && (s = 'cell' + t.toString()), (t += 1); return ( this.path.push({ relation: s, offset: 0 }), @@ -10952,7 +10942,7 @@ var global, factory; } } }), - (we.prototype.previous = function(t) { + (ke.prototype.previous = function(t) { const e = { numer: 'body', denom: 'numer', @@ -10991,7 +10981,7 @@ var global, factory; ) - 1; for (; t >= 0; ) { if ( - Ce(this.parent().array, t) && + Ae(this.parent().array, t) && this.setSelection(-1, 0, 'cell' + t) ) return void this.selectionDidChange(); @@ -11014,16 +11004,16 @@ var global, factory; let t; if (i.array) { t = ''; - const e = _e(i.array); + const e = Me(i.array); let s = e - 1; for (; !t && s < e; ) - Ce(i.array, s) && (t = 'cell' + s.toString()), + Ae(i.array, s) && (t = 'cell' + s.toString()), (s -= 1); return ( (s += 1), this.path.push({ relation: t, - offset: Ce(i.array, s).length - 1, + offset: Ae(i.array, s).length - 1, }), void this.setSelection(-1, 0, t) ); @@ -11046,11 +11036,11 @@ var global, factory; this.sibling(0).skipBoundary && this.previous(t); }), - (we.prototype.move = function(t, e) { + (ke.prototype.move = function(t, e) { const i = (e = e || { extend: !1 }).extend || !1; if ((this.removeSuggestion(), i)) this.extend(t, e); else { - const e = Se(this); + const e = ve(this); if (t > 0) for (this.collapseForward() && t--; t > 0; ) this.next(), t--; @@ -11060,7 +11050,7 @@ var global, factory; this._announce('move', e); } }), - (we.prototype.up = function(t) { + (ke.prototype.up = function(t) { const e = (t = t || { extend: !1 }).extend || !1; this.collapseBackward(); const i = this.relation(); @@ -11074,17 +11064,17 @@ var global, factory; : this.setSelection(this.anchorOffset(), 0, 'numer'), this._announce('moveUp'); else if (this.parent().array) { - let e = Me(this.parent().array, i); - (e = Le(this.parent().array, e, -1)), - e && Ce(e) + let e = Se(this.parent().array, i); + (e = _e(this.parent().array, e, -1)), + e && Ae(e) ? ((this.path[this.path.length - 1].relation = - 'cell' + Ae(this.parent().array, e)), + 'cell' + we(this.parent().array, e)), this.setSelection(this.anchorOffset()), this._announce('moveUp')) : this.move(-1, t); } else this._announce('line'); }), - (we.prototype.down = function(t) { + (ke.prototype.down = function(t) { const e = (t = t || { extend: !1 }).extend || !1; this.collapseForward(); const i = this.relation(); @@ -11098,20 +11088,20 @@ var global, factory; : this.setSelection(this.anchorOffset(), 0, 'denom'), this._announce('moveDown'); else if (this.parent().array) { - let e = Me(this.parent().array, i); - (e = Le(this.parent().array, e, 1)), - e && Ce(e) + let e = Se(this.parent().array, i); + (e = _e(this.parent().array, e, 1)), + e && Ae(e) ? ((this.path[this.path.length - 1].relation = - 'cell' + Ae(this.parent().array, e)), + 'cell' + we(this.parent().array, e)), this.setSelection(this.anchorOffset()), this._announce('moveDown')) : this.move(1, t); } else this._announce('line'); }), - (we.prototype.extend = function(t) { + (ke.prototype.extend = function(t) { let e = this.path[this.path.length - 1].offset, i = 0; - const s = Se(this); + const s = ve(this); i = this.extent + t; const a = e + i; if (a < 0 && 0 !== i) { @@ -11139,10 +11129,10 @@ var global, factory; } this.setSelection(e, i), this._announce('move', s); }), - (we.prototype.skip = function(t, e) { + (ke.prototype.skip = function(t, e) { const i = (e = e || { extend: !1 }).extend || !1; t = t < 0 ? -1 : 1; - const s = Se(this), + const s = ve(this), a = this.siblings(), o = this.focusOffset(); let n = o + t; @@ -11194,7 +11184,7 @@ var global, factory; this._announce('move', s); } }), - (we.prototype.jump = function(t, e) { + (ke.prototype.jump = function(t, e) { const i = (e = e || { extend: !1 }).extend || !1; t = t < 0 ? -1 : 1; const s = this.siblings(); @@ -11203,10 +11193,10 @@ var global, factory; const o = t < 0 ? 0 : s.length - 1; i ? this.extend(o - a) : this.move(o - a); }), - (we.prototype.jumpToMathFieldBoundary = function(t, e) { + (ke.prototype.jumpToMathFieldBoundary = function(t, e) { const i = (e = e || { extend: !1 }).extend || !1; t = (t = t || 1) < 0 ? -1 : 1; - const s = Se(this), + const s = ve(this), a = [{ relation: 'body', offset: this.path[0].offset }]; let o; i @@ -11219,11 +11209,11 @@ var global, factory; this.setPath(a, o), this._announce('move', s); }), - (we.prototype.leap = function(t, e) { + (ke.prototype.leap = function(t, e) { (t = (t = t || 1) < 0 ? -1 : 1), (e = e || !0); const i = this.suppressChangeNotifications; this.suppressChangeNotifications = !0; - const s = Se(this), + const s = ve(this), a = this.extent; this.move(t), 'placeholder' === this.anchor().type && this.move(t); @@ -11270,7 +11260,7 @@ var global, factory; !0 ); }), - (we.prototype.anchorMode = function() { + (ke.prototype.anchorMode = function() { const t = this.isCollapsed() ? this.anchor() : this.sibling(1); let e; if (t) { @@ -11284,7 +11274,7 @@ var global, factory; s && (e = s.mode), (i += 1), (s = this.ancestor(i)); return e; }), - (we.prototype.anchorStyle = function() { + (ke.prototype.anchorStyle = function() { const t = this.isCollapsed() ? this.anchor() : this.sibling(1); let e; if (t && 'first' !== t.type) { @@ -11315,7 +11305,7 @@ var global, factory; (s = this.ancestor(i)); return e; }), - (we.prototype.simplifyParen = function(t) { + (ke.prototype.simplifyParen = function(t) { if (t && this.config.removeExtraneousParentheses) { for (let e = 0; t[e]; e++) if ( @@ -11337,37 +11327,37 @@ var global, factory; ('genfrac' === t.type && (this.simplifyParen(t.numer), this.simplifyParen(t.denom), - (t.numer = ze(t.numer)), - (t.denom = ze(t.denom))), + (t.numer = Fe(t.numer)), + (t.denom = Fe(t.denom))), t.superscript && (this.simplifyParen(t.superscript), - (t.superscript = ze(t.superscript))), + (t.superscript = Fe(t.superscript))), t.subscript && (this.simplifyParen(t.subscript), - (t.subscript = ze(t.subscript))), + (t.subscript = Fe(t.subscript))), t.underscript && (this.simplifyParen(t.underscript), - (t.underscript = ze(t.underscript))), + (t.underscript = Fe(t.underscript))), t.overscript && (this.simplifyParen(t.overscript), - (t.overscript = ze(t.overscript))), + (t.overscript = Fe(t.overscript))), t.index && (this.simplifyParen(t.index), - (t.index = ze(t.index))), + (t.index = Fe(t.index))), 'surd' === t.type ? (this.simplifyParen(t.body), - (t.body = ze(t.body))) + (t.body = Fe(t.body))) : t.body && Array.isArray(t.body) && this.simplifyParen(t.body), t.array) ) - for (let e = _e(t.array); e >= 0; e--) - this.simplifyParen(Ce(t.array, e)); + for (let e = Me(t.array); e >= 0; e--) + this.simplifyParen(Ae(t.array, e)); }); } }), - (we.prototype.insert = function(t, e) { + (ke.prototype.insert = function(t, e) { if ( (e = e || {}).smartFence && this._insertSmartFence(t, e.style) @@ -11410,23 +11400,23 @@ var global, factory; this.delete_(-1), 'math' === a && 'ASCIIMath' === e.format) ) - (t = Ee(t, { ...this.config, format: 'ASCIIMath' })), - (o = he.parseTokens(n(t), 'math', null, e.macros, !1)), + (t = De(t, { ...this.config, format: 'ASCIIMath' })), + (o = le.parseTokens(n(t), 'math', null, e.macros, !1)), this.simplifyParen(o); else if ('text' !== a && 'auto' === e.format) if ('command' === a) { o = []; for (const e of t) - At.COMMAND_MODE_CHARACTERS.test(e) && + wt.COMMAND_MODE_CHARACTERS.test(e) && o.push( - new te.MathAtom('command', 'command', e) + new Yt.MathAtom('command', 'command', e) ); } else '' === t ? (o = [ - new te.MathAtom('command', 'command', '\\'), + new Yt.MathAtom('command', 'command', '\\'), ]) - : ((t = Ee(t, this.config)), + : ((t = De(t, this.config)), r[0] ? (t = t.replace(/(^|[^\\])#@/g, '$1#0')) : /(^|[^\\])#@/.test(t) @@ -11437,7 +11427,7 @@ var global, factory; 0 === r[0].length && (r[0] = void 0)) : (t = t.replace(/(^|[^\\])#@/g, '$1#?')), - (o = he.parseTokens( + (o = le.parseTokens( n(t), a, r, @@ -11447,7 +11437,7 @@ var global, factory; this.simplifyParen(o)); else 'latex' === e.format - ? (o = he.parseTokens( + ? (o = le.parseTokens( n(t), a, r, @@ -11474,7 +11464,7 @@ var global, factory; /£/g, '\\textsterling ' )), - (o = he.parseTokens(n(t), 'text', r, e.macros, !1))); + (o = le.parseTokens(n(t), 'text', r, e.macros, !1))); !(function t(e, i) { e && i && @@ -11536,7 +11526,7 @@ var global, factory; this.setSelection(this.anchorOffset(), o.length)); this.contentDidChange(), (this.suppressChangeNotifications = i); }), - (we.prototype._insertSmartFence = function(t, e) { + (ke.prototype._insertSmartFence = function(t, e) { const i = this.parent(); if ( 'leftright' === i.type && @@ -11555,7 +11545,7 @@ var global, factory; ('}' !== t && '\\}' !== t) || (t = '\\rbrace'), ('[' !== t && '\\[' !== t) || (t = '\\lbrack'), (']' !== t && '\\]' !== t) || (t = '\\rbrack'); - const s = At.RIGHT_DELIM[t]; + const s = wt.RIGHT_DELIM[t]; if (s && ('leftright' !== i.type || '|' !== i.leftDelim)) { let i = ''; const a = @@ -11583,8 +11573,8 @@ var global, factory; } let a; if ( - (Object.keys(At.RIGHT_DELIM).forEach(e => { - t === At.RIGHT_DELIM[e] && (a = e); + (Object.keys(wt.RIGHT_DELIM).forEach(e => { + t === wt.RIGHT_DELIM[e] && (a = e); }), a) ) { @@ -11649,24 +11639,24 @@ var global, factory; } return !1; }), - (we.prototype.positionInsertionPointAfterCommitedCommand = function() { + (ke.prototype.positionInsertionPointAfterCommitedCommand = function() { const t = this.siblings(), e = this.commandOffsets(); let i = e.start; for (; i < e.end && !t[i].suggestion; ) i++; this.setSelection(i - 1); }), - (we.prototype.removeSuggestion = function() { + (ke.prototype.removeSuggestion = function() { const t = this.siblings(); for (let e = t.length - 1; e >= 0; e--) t[e].suggestion && t.splice(e, 1); }), - (we.prototype.insertSuggestion = function(t, e) { + (ke.prototype.insertSuggestion = function(t, e) { this.removeSuggestion(); const i = [], s = t.substr(e); for (const t of s) { - const e = new te.MathAtom('command', 'command', t); + const e = new Yt.MathAtom('command', 'command', t); (e.suggestion = !0), i.push(e); } Array.prototype.splice.apply( @@ -11674,18 +11664,18 @@ var global, factory; [this.anchorOffset() + 1, 0].concat(i) ); }), - (we.prototype._deleteAtoms = function(t) { + (ke.prototype._deleteAtoms = function(t) { t > 0 ? this.siblings().splice(this.anchorOffset() + 1, t) : (this.siblings().splice(this.anchorOffset() + t + 1, -t), this.setSelection(this.anchorOffset() + t)); }), - (we.prototype.delete = function(t) { + (ke.prototype.delete = function(t) { if (0 === (t = t || 0)) this.delete_(0); else if (t > 0) for (; t > 0; ) this.delete_(1), t--; else for (; t < 0; ) this.delete_(-1), t++; }), - (we.prototype.delete_ = function(t) { + (ke.prototype.delete_ = function(t) { this.contentWillChange(), this.selectionWillChange(); const e = this.suppressChangeNotifications; if ( @@ -11698,8 +11688,8 @@ var global, factory; if ( (function(t) { const e = { col: 0, row: 0 }; - for (; e.row < t.length && !Ce(t, e); ) e.row += 1; - return Ce(t, e) ? 'cell' + Ae(t, e) : ''; + for (; e.row < t.length && !Ae(t, e); ) e.row += 1; + return Ae(t, e) ? 'cell' + we(t, e) : ''; })(t) === this.relation() ) { const e = (function(t, e, i) { @@ -11709,13 +11699,13 @@ var global, factory; for (const i of t) s ? a.push(s) - : (s = new te.MathAtom( + : (s = new Yt.MathAtom( 'math', 'mpunct', e[0], void 0 )), - (a = a.concat(Te(i, e[1]))); + (a = a.concat(Ce(i, e[1]))); return a; })(t); this.path.pop(), @@ -11729,14 +11719,14 @@ var global, factory; e.length ); } else { - const e = Me(t, this.relation()); + const e = Se(t, this.relation()); if (0 === e.col) { - const i = Le(t, e, -1); + const i = _e(t, e, -1); (i.col = t[i.row].length - 1), (this.path[this.path.length - 1].relation = - 'cell' + Ae(t, i)); + 'cell' + we(t, i)); const s = t[i.row][i.col].length, - a = Te(t[e.row]); + a = Ce(t[e.row]); (t[i.row][i.col] = t[i.row][i.col].concat(a)), this.setSelection(s - 1, a.length), (function(t, e) { @@ -11748,7 +11738,7 @@ var global, factory; let i = 0; const s = { col: e, row: 0 }; for (; s.row < t.length; ) { - const e = Ce(t, s); + const e = Ae(t, s); if (e && e.length > 0) { let t = e.length; 'first' === e[0].type && (t -= 1), @@ -11766,7 +11756,7 @@ var global, factory; })(t, e.col), (e.col -= 1), (this.path[this.path.length - 1].relation = - 'cell' + Ae(t, e)); + 'cell' + we(t, e)); const i = t[e.row][e.col]; this.setSelection(i.length - 1, 0); } @@ -11900,116 +11890,116 @@ var global, factory; this.selectionDidChange(), this.contentDidChange(); }), - (we.prototype.moveToNextPlaceholder_ = function() { + (ke.prototype.moveToNextPlaceholder_ = function() { this.leap(1); }), - (we.prototype.moveToPreviousPlaceholder_ = function() { + (ke.prototype.moveToPreviousPlaceholder_ = function() { this.leap(-1); }), - (we.prototype.moveToNextChar_ = function() { + (ke.prototype.moveToNextChar_ = function() { this.move(1); }), - (we.prototype.moveToPreviousChar_ = function() { + (ke.prototype.moveToPreviousChar_ = function() { this.move(-1); }), - (we.prototype.moveUp_ = function() { + (ke.prototype.moveUp_ = function() { this.up(); }), - (we.prototype.moveDown_ = function() { + (ke.prototype.moveDown_ = function() { this.down(); }), - (we.prototype.moveToNextWord_ = function() { + (ke.prototype.moveToNextWord_ = function() { this.skip(1); }), - (we.prototype.moveToPreviousWord_ = function() { + (ke.prototype.moveToPreviousWord_ = function() { this.skip(-1); }), - (we.prototype.moveToGroupStart_ = function() { + (ke.prototype.moveToGroupStart_ = function() { this.setSelection(0); }), - (we.prototype.moveToGroupEnd_ = function() { + (ke.prototype.moveToGroupEnd_ = function() { this.setSelection(-1); }), - (we.prototype.moveToMathFieldStart_ = function() { + (ke.prototype.moveToMathFieldStart_ = function() { this.jumpToMathFieldBoundary(-1); }), - (we.prototype.moveToMathFieldEnd_ = function() { + (ke.prototype.moveToMathFieldEnd_ = function() { this.jumpToMathFieldBoundary(1); }), - (we.prototype.deleteNextChar_ = function() { + (ke.prototype.deleteNextChar_ = function() { this.delete_(1); }), - (we.prototype.deletePreviousChar_ = function() { + (ke.prototype.deletePreviousChar_ = function() { this.delete_(-1); }), - (we.prototype.deleteNextWord_ = function() { + (ke.prototype.deleteNextWord_ = function() { this.extendToNextBoundary(), this.delete_(); }), - (we.prototype.deletePreviousWord_ = function() { + (ke.prototype.deletePreviousWord_ = function() { this.extendToPreviousBoundary(), this.delete_(); }), - (we.prototype.deleteToGroupStart_ = function() { + (ke.prototype.deleteToGroupStart_ = function() { this.extendToGroupStart(), this.delete_(); }), - (we.prototype.deleteToGroupEnd_ = function() { + (ke.prototype.deleteToGroupEnd_ = function() { this.extendToMathFieldStart(), this.delete_(); }), - (we.prototype.deleteToMathFieldEnd_ = function() { + (ke.prototype.deleteToMathFieldEnd_ = function() { this.extendToMathFieldEnd(), this.delete_(); }), - (we.prototype.transpose_ = function() {}), - (we.prototype.extendToNextChar_ = function() { + (ke.prototype.transpose_ = function() {}), + (ke.prototype.extendToNextChar_ = function() { this.extend(1); }), - (we.prototype.extendToPreviousChar_ = function() { + (ke.prototype.extendToPreviousChar_ = function() { this.extend(-1); }), - (we.prototype.extendToNextWord_ = function() { + (ke.prototype.extendToNextWord_ = function() { this.skip(1, { extend: !0 }); }), - (we.prototype.extendToPreviousWord_ = function() { + (ke.prototype.extendToPreviousWord_ = function() { this.skip(-1, { extend: !0 }); }), - (we.prototype.extendUp_ = function() { + (ke.prototype.extendUp_ = function() { this.up({ extend: !0 }); }), - (we.prototype.extendDown_ = function() { + (ke.prototype.extendDown_ = function() { this.down({ extend: !0 }); }), - (we.prototype.extendToNextBoundary_ = function() { + (ke.prototype.extendToNextBoundary_ = function() { this.skip(1, { extend: !0 }); }), - (we.prototype.extendToPreviousBoundary_ = function() { + (ke.prototype.extendToPreviousBoundary_ = function() { this.skip(-1, { extend: !0 }); }), - (we.prototype.extendToGroupStart_ = function() { + (ke.prototype.extendToGroupStart_ = function() { this.setExtent(-this.anchorOffset()); }), - (we.prototype.extendToGroupEnd_ = function() { + (ke.prototype.extendToGroupEnd_ = function() { this.setExtent(this.siblings().length - this.anchorOffset()); }), - (we.prototype.extendToMathFieldStart_ = function() { + (ke.prototype.extendToMathFieldStart_ = function() { this.jumpToMathFieldBoundary(-1, { extend: !0 }); }), - (we.prototype.extendToMathFieldEnd_ = function() { + (ke.prototype.extendToMathFieldEnd_ = function() { this.jumpToMathFieldBoundary(1, { extend: !0 }); }), - (we.prototype.moveToSuperscript_ = function() { + (ke.prototype.moveToSuperscript_ = function() { if ((this.collapseForward(), !this.anchor().superscript)) if (this.anchor().subscript) - this.anchor().superscript = [Be()]; + this.anchor().superscript = [Pe()]; else { const t = this.sibling(1); t && t.superscript ? (this.path[this.path.length - 1].offset += 1) : t && t.subscript ? ((this.path[this.path.length - 1].offset += 1), - (this.anchor().superscript = [Be()])) + (this.anchor().superscript = [Pe()])) : ('limits' !== this.anchor().limits && (this.siblings().splice( this.anchorOffset() + 1, 0, - new te.MathAtom( + new Yt.MathAtom( this.parent().anchorMode, 'msubsup', '​', @@ -12019,27 +12009,27 @@ var global, factory; (this.path[ this.path.length - 1 ].offset += 1)), - (this.anchor().superscript = [Be()])); + (this.anchor().superscript = [Pe()])); } this.path.push({ relation: 'superscript', offset: 0 }), this.selectGroup_(); }), - (we.prototype.moveToSubscript_ = function() { + (ke.prototype.moveToSubscript_ = function() { if ((this.collapseForward(), !this.anchor().subscript)) if (this.anchor().superscript) - this.anchor().subscript = [Be()]; + this.anchor().subscript = [Pe()]; else { const t = this.sibling(1); t && t.subscript ? (this.path[this.path.length - 1].offset += 1) : t && t.superscript ? ((this.path[this.path.length - 1].offset += 1), - (this.anchor().subscript = [Be()])) + (this.anchor().subscript = [Pe()])) : ('limits' !== this.anchor().limits && (this.siblings().splice( this.anchorOffset() + 1, 0, - new te.MathAtom( + new Yt.MathAtom( this.parent().anchorMode, 'msubsup', '​', @@ -12049,12 +12039,12 @@ var global, factory; (this.path[ this.path.length - 1 ].offset += 1)), - (this.anchor().subscript = [Be()])); + (this.anchor().subscript = [Pe()])); } this.path.push({ relation: 'subscript', offset: 0 }), this.selectGroup_(); }), - (we.prototype.moveToOpposite_ = function() { + (ke.prototype.moveToOpposite_ = function() { const t = { superscript: 'subscript', subscript: 'superscript', @@ -12062,36 +12052,36 @@ var global, factory; numer: 'denom', }[this.relation()]; t || this.moveToSuperscript_(), - this.parent()[t] || (this.parent()[t] = [Be()]), + this.parent()[t] || (this.parent()[t] = [Pe()]), this.setSelection(0, 'end', t); }), - (we.prototype.moveBeforeParent_ = function() { + (ke.prototype.moveBeforeParent_ = function() { this.path.length > 1 ? (this.path.pop(), this.setSelection(this.anchorOffset() - 1)) : this._announce('plonk'); }), - (we.prototype.moveAfterParent_ = function() { + (ke.prototype.moveAfterParent_ = function() { if (this.path.length > 1) { - const t = Se(this); + const t = ve(this); this.path.pop(), this.setExtent(0), this._announce('move', t); } else this._announce('plonk'); }), - (we.prototype._addCell = function(t) { + (ke.prototype._addCell = function(t) { const e = this.parent(); if (e && 'array' === e.type && Array.isArray(e.array)) { const i = this.relation(); if (e.array) { - const s = Me(e.array, i); + const s = Se(e.array, i); 'after row' === t || 'before row' === t ? ((s.col = 0), (s.row = s.row + ('after row' === t ? 1 : 0)), e.array.splice(s.row, 0, [[]])) : ((s.col += 'after column' === t ? 1 : 0), e.array[s.row].splice(s.col, 0, [])); - const a = Ae(e.array, s); + const a = we(e.array, s); this.path.pop(), this.path.push({ relation: 'cell' + a.toString(), @@ -12101,7 +12091,7 @@ var global, factory; } } }), - (we.prototype.convertParentToArray = function() { + (ke.prototype.convertParentToArray = function() { const t = this.parent(); if ('leftright' === t.type) { t.type = 'array'; @@ -12111,7 +12101,7 @@ var global, factory; '\\lbrack': 'bmatrix', '\\lbrace': 'cases', }[t.leftDelim] || 'matrix', - i = At.getEnvironmentInfo(e), + i = wt.getEnvironmentInfo(e), s = [[t.body]]; i.parser && Object.assign(t, i.parser(e, [], s)), (t.tabularMode = i.tabular), @@ -12124,31 +12114,31 @@ var global, factory; (this.path[this.path.length - 1].relation = 'cell0'); } }), - (we.prototype.addRowAfter_ = function() { + (ke.prototype.addRowAfter_ = function() { this.contentWillChange(), this.convertParentToArray(), this._addCell('after row'), this.contentDidChange(); }), - (we.prototype.addRowBefore_ = function() { + (ke.prototype.addRowBefore_ = function() { this.contentWillChange(), this.convertParentToArray(), this._addCell('before row'), this.contentDidChange(); }), - (we.prototype.addColumnAfter_ = function() { + (ke.prototype.addColumnAfter_ = function() { this.contentWillChange(), this.convertParentToArray(), this._addCell('after column'), this.contentDidChange(); }), - (we.prototype.addColumnBefore_ = function() { + (ke.prototype.addColumnBefore_ = function() { this.contentWillChange(), this.convertParentToArray(), this._addCell('before column'), this.contentDidChange(); }), - (we.prototype._applyStyle = function(t) { + (ke.prototype._applyStyle = function(t) { if (this.isCollapsed()) return; const e = this; function i(t, i) { @@ -12188,8 +12178,8 @@ var global, factory; }), this.contentDidChange(); }); - var Oe = { EditableMathlist: we, parseMathString: Ee }; - const Re = { + var Ie = { EditableMathlist: ke, parseMathString: De }; + const Be = { '#': '#', '|': '|', '[': 'BracketLeft', @@ -12200,7 +12190,7 @@ var global, factory; '/': 'Slash', '\\': 'Backslash', }, - Ke = { + Oe = { Space: 'Spacebar', ' ': 'Spacebar', Escape: 'Esc', @@ -12210,7 +12200,7 @@ var global, factory; ArrowDown: 'Down', Delete: 'Del', }, - Ne = { + Re = { q: 'KeyQ', w: 'KeyW', e: 'KeyE', @@ -12265,16 +12255,16 @@ var global, factory; '?': 'Shift-Slash', ' ': 'Spacebar', }; - function $e(t) { + function Ke(t) { let e, i = !0; 'Unidentified' === t.key && t.target && - (e = Ne[t.target.value] || t.target.value), + (e = Re[t.target.value] || t.target.value), e || - (Re[t.key] ? ((e = Re[t.key]), (i = !1)) : (e = Ke[t.key]), - e || (e = Ne[t.key.toLowerCase()])), - !e && t.code && (e = Ke[t.code] || t.code); + (Be[t.key] ? ((e = Be[t.key]), (i = !1)) : (e = Oe[t.key]), + e || (e = Re[t.key.toLowerCase()])), + !e && t.code && (e = Oe[t.code] || t.code); const s = []; return ( t.ctrlKey && s.push('Ctrl'), @@ -12284,7 +12274,7 @@ var global, factory; 0 === s.length ? e : (s.push(e), s.join('-')) ); } - function We(t, e) { + function Ne(t, e) { let i, s = null, a = null, @@ -12334,7 +12324,7 @@ var global, factory; !o && 'CapsLock' !== i.code && !/(Control|Meta|Alt|Shift)(Right|Left)/.test(i.code) - ) || ((s = i), (a = null), e.keystroke($e(i), i)) + ) || ((s = i), (a = null), e.keystroke(Ke(i), i)) ); }, !0 @@ -12342,7 +12332,7 @@ var global, factory; c.addEventListener( 'keypress', function(t) { - o || (s && a && e.keystroke($e(s), s), (a = t), r(l)); + o || (s && a && e.keystroke(Ke(s), s), (a = t), r(l)); }, !0 ), @@ -12420,10 +12410,10 @@ var global, factory; } else o || r(l); }); } - var He = { - delegateKeyboardEvents: We, - select: We.select, - keyboardEventToString: $e, + var $e = { + delegateKeyboardEvents: Ne, + select: Ne.select, + keyboardEventToString: Ke, eventToChar: function(t) { if (!t) return ''; let e; @@ -12448,7 +12438,7 @@ var global, factory; }; }, }; - const Ve = { + const We = { '\\mathrm': '\\mathrm{x=+3.14, x\\in A}', '\\mathbf': '\\mathbf{x=+3.14, x\\in A}', '\\bf': '\\bf{x=+3.14, x\\in A}', @@ -12549,7 +12539,7 @@ var global, factory; '\\rlap': '\\rlap{x}o', '\\llap': 'o\\llap{/}', }, - Ue = { + He = { '\\text': 'roman text', '\\textrm': 'roman text', '\\textnormal': 'roman text', @@ -12784,16 +12774,16 @@ var global, factory; '\\bullet': 'bullet', '\\lim': 'limit', }; - function je(t) { - let e = Ue[t] || ''; + function Ve(t) { + let e = He[t] || ''; return Array.isArray(e) && (e = e.join('
')), e; } - function Ge(t, e) { + function Ue(t, e) { t.popover.innerHTML = e; const i = t._getCaretPosition(); - i && Ze(t, i), t.popover.classList.add('is-visible'); + i && je(t, i), t.popover.classList.add('is-visible'); } - function Ze(t, e) { + function je(t, e) { const i = window.innerHeight || document.documentElement.clientHeight || @@ -12820,24 +12810,24 @@ var global, factory; : (t.popover.classList.remove('reverse-direction'), (t.popover.style.top = e.y + 5 + 'px')); } - function Xe(t) { + function Ge(t) { t.popover.classList.remove('is-visible'); } - var Je = { - getNote: je, - SAMPLES: Ve, - NOTES: Ue, + var Ze = { + getNote: Ve, + SAMPLES: We, + NOTES: He, showPopoverWithLatex: function(t, e, i) { - if (!e || 0 === e.length) return void Xe(t); + if (!e || 0 === e.length) return void Ge(t); const s = e, a = (function(t, e) { - const i = he.parseTokens( + const i = le.parseTokens( n(t), 'math', null, e.config.macros ), - s = te.decompose( + s = Yt.decompose( { mathstyle: 'displaystyle', macros: e.config.macros, @@ -12853,9 +12843,9 @@ var global, factory; r.setStyle('vertical-align', -a.depth, 'em'), $.makeSpan([o, r, a], 'ML__mathlive').toMarkup() ); - })(Ve[s] || e, t), - o = je(s), - r = ve.forCommand(s); + })(We[s] || e, t), + o = Ve(s), + r = xe.forCommand(s); let l = i ? '
' : ''; @@ -12872,7 +12862,7 @@ var global, factory; (l += i ? '
' : ''), - Ge(t, l); + Ue(t, l); let c = t.popover.getElementsByClassName( 'ML__popover__content' ); @@ -12895,8 +12885,8 @@ var global, factory; c.length > 0 && t._attachButtonHandlers(c[0], 'nextSuggestion'); }, - showPopover: Ge, - hidePopover: Xe, + showPopover: Ue, + hidePopover: Ge, updatePopoverPosition: function t(e, i) { if ( e.element && @@ -12910,11 +12900,11 @@ var global, factory; 'command' === e.mathlist.anchor().type ) { const t = e._getCaretPosition(); - t && Ze(e, t); - } else Xe(e); + t && je(e, t); + } else Ge(e); }, }; - function Ye(t, e, i) { + function Xe(t, e, i) { let s = ''; if (Array.isArray(e) && e.length > 0) { if ('first' === e[0].type && 0 === (e = e.slice(1)).length) @@ -13111,7 +13101,7 @@ var global, factory; !s[0].color || 'none' === s[0].color || (e && e.color === s[0].color) || - ((n = '\\textcolor{' + ae(s[0].color) + '}{'), + ((n = '\\textcolor{' + ie(s[0].color) + '}{'), (r = '}')), 'backgroundColor' !== l || !s[0].backgroundColor || @@ -13119,7 +13109,7 @@ var global, factory; (e && e.backgroundColor === s[0].backgroundColor) || ((n = '\\colorbox{' + - ae(s[0].backgroundColor) + + ie(s[0].backgroundColor) + '}{'), (r = '}')), (o += n), @@ -13150,18 +13140,18 @@ var global, factory; : e && 'function' == typeof e.toLatex && (s = e.toLatex(i)); return s; } - function Qe(t) { - const e = Qe.locale.substring(0, 2); + function Je(t) { + const e = Je.locale.substring(0, 2); let i = ''; return ( - Qe.strings[Qe.locale] && (i = Qe.strings[Qe.locale][t]), - !i && Qe.strings[e] && (i = Qe.strings[e][t]), - i || (i = Qe.strings.en[t]), + Je.strings[Je.locale] && (i = Je.strings[Je.locale][t]), + !i && Je.strings[e] && (i = Je.strings[e][t]), + i || (i = Je.strings.en[t]), i || (i = t), i ); } - (te.MathAtom.prototype.toLatex = function(t) { + (Yt.MathAtom.prototype.toLatex = function(t) { t = void 0 !== t && t; let e, i = '', @@ -13176,12 +13166,12 @@ var global, factory; (this.cssId || this.cssClass ? '' : '{')), this.cssId && (i += '\\cssId{' + this.cssId + '}{'), 'ML__emph' === this.cssClass - ? (i += '\\emph{' + Ye(this, this.body, t) + '}') + ? (i += '\\emph{' + Xe(this, this.body, t) + '}') : (this.cssClass && (i += '\\class{' + this.cssClass + '}{'), (i += t - ? Ye(this, this.body, !0) - : this.latex || Ye(this, this.body, !1)), + ? Xe(this, this.body, !0) + : this.latex || Xe(this, this.body, !1)), this.cssClass && (i += '}')), this.cssId && (i += '}'), (i += @@ -13203,23 +13193,23 @@ var global, factory; for (s = 0; s < this.array.length; s++) { for (e = 0; e < this.array[s].length; e++) e > 0 && (i += ' & '), - (i += Ye(this, this.array[s][e], t)); + (i += Xe(this, this.array[s][e], t)); s < this.array.length - 1 && (i += ' \\\\ '); } i += '\\end{' + this.env.name + '}'; break; case 'root': - i = Ye(this, this.body, t); + i = Xe(this, this.body, t); break; case 'genfrac': /^(choose|atop|over)$/.test(this.body) ? ((i += '{'), - (i += Ye(this, this.numer, t)), + (i += Xe(this, this.numer, t)), (i += '\\' + this.body + ' '), - (i += Ye(this, this.denom, t)), + (i += Xe(this, this.denom, t)), (i += '}')) : ((i += n), - (i += `{${Ye(this, this.numer, t)}}{${Ye( + (i += `{${Xe(this, this.numer, t)}}{${Xe( this, this.denom, t @@ -13229,9 +13219,9 @@ var global, factory; (i += '\\sqrt'), this.index && ((i += '['), - (i += Ye(this, this.index, t)), + (i += Xe(this, this.index, t)), (i += ']')), - (i += `{${Ye(this, this.body, t)}}`); + (i += `{${Xe(this, this.body, t)}}`); break; case 'leftright': this.inner @@ -13239,18 +13229,18 @@ var global, factory; this.leftDelim && this.leftDelim.length > 1 && (i += ' '), - (i += Ye(this, this.body, t)), + (i += Xe(this, this.body, t)), (i += '\\right' + (this.rightDelim || '.')), this.rightDelim && this.rightDelim.length > 1 && (i += ' ')) : t && '(' === this.leftDelim && ')' === this.rightDelim - ? (i += '(' + Ye(this, this.body, t) + ')') + ? (i += '(' + Xe(this, this.body, t) + ')') : ((i += '\\mleft' + (this.leftDelim || '.')), this.leftDelim && this.leftDelim.length > 1 && (i += ' '), - (i += Ye(this, this.body, t)), + (i += Xe(this, this.body, t)), (i += '\\mright' + (this.rightDelim || '.')), this.rightDelim && this.rightDelim.length > 1 && @@ -13262,8 +13252,8 @@ var global, factory; break; case 'rule': (i += n), - this.shift && (i += `[${Ye(this, this.shift, t)}em]`), - (i += `{${Ye(this, this.width, t)}em}{${Ye( + this.shift && (i += `[${Xe(this, this.shift, t)}em]`), + (i += `{${Xe(this, this.width, t)}em}{${Xe( this, this.height, t @@ -13272,14 +13262,14 @@ var global, factory; case 'line': case 'overlap': case 'accent': - i += `${n}{${Ye(this, this.body, t)}}`; + i += `${n}{${Xe(this, this.body, t)}}`; break; case 'overunder': - i += `${n}{${Ye( + i += `${n}{${Xe( this, this.overscript || this.underscript, t - )}}{${Ye(parent, this.body, t)}}`; + )}}{${Xe(parent, this.body, t)}}`; break; case 'mord': case 'minner': @@ -13293,7 +13283,7 @@ var global, factory; /^\\(mathbin|mathrel|mathopen|mathclose|mathpunct|mathord|mathinner)/.test( n ) - ? (i += n + '{' + Ye(this, this.body, t) + '}') + ? (i += n + '{' + Xe(this, this.body, t) + '}') : '\\char"' === n ? (i += this.latex + ' ') : '\\unicode' === n @@ -13317,9 +13307,9 @@ var global, factory; case 'mop': '​' !== this.body && ('\\mathop' === n - ? (i += n + '{' + Ye(this, this.body, t) + '}') + ? (i += n + '{' + Xe(this, this.body, t) + '}') : '\\operatorname' === n - ? (i += n + '{' + Ye(this, this.body, t) + '}') + ? (i += n + '{' + Xe(this, this.body, t) + '}') : this.latex && '\\' === this.latex[0] ? ((i += this.latex), /[a-zA-Z0-9]$/.test(this.latex) && (i += ' ')) @@ -13347,19 +13337,19 @@ var global, factory; ), this.border && t.push('border:' + this.border), this.backgroundcolor && - t.push(ae(this.backgroundcolor)), + t.push(ie(this.backgroundcolor)), (i += `[${t.join(',')}]`); } - i += `{${Ye(this, this.body, t)}}`; + i += `{${Xe(this, this.body, t)}}`; } else '\\boxed' === n - ? (i += `\\boxed{${Ye(this, this.body, t)}}`) + ? (i += `\\boxed{${Xe(this, this.body, t)}}`) : ((i += n), this.framecolor && - (i += `{${ae(this.framecolor)}}`), + (i += `{${ie(this.framecolor)}}`), this.backgroundcolor && - (i += `{${ae(this.backgroundcolor)}}`), - (i += `{${Ye(this, this.body, t)}}`)); + (i += `{${ie(this.backgroundcolor)}}`), + (i += `{${Xe(this, this.body, t)}}`)); break; case 'spacing': (i += n), @@ -13391,7 +13381,7 @@ var global, factory; ((e += t + 'mathbackground="' + - ae(this.backgroundcolor) + + ie(this.backgroundcolor) + '"'), (t = ',')), this.shadow && @@ -13406,12 +13396,12 @@ var global, factory; ((e += t + 'mathcolor="' + - ae(this.strokeColor) + + ie(this.strokeColor) + '"'), (t = ',')), e && (i += `[${e}]`); } - i += `{${Ye(this, this.body, t)}}`; + i += `{${Xe(this, this.body, t)}}`; break; case 'mathstyle': i += '\\' + this.mathstyle + ' '; @@ -13430,7 +13420,7 @@ var global, factory; i += this.latex; } if (this.superscript) { - let e = Ye(this, this.superscript, t); + let e = Xe(this, this.superscript, t); 1 === e.length ? ('′' === e ? (e = '\\prime ') @@ -13439,93 +13429,93 @@ var global, factory; : (i += '^{' + e + '}'); } if (this.subscript) { - const e = Ye(this, this.subscript, t); + const e = Xe(this, this.subscript, t); 1 === e.length ? (i += '_' + e) : (i += '_{' + e + '}'); } return i; }), - (Qe.plural = function(t, e, i) { + (Je.plural = function(t, e, i) { (i = i || {}).type = i.type || 'cardinal'; - const s = Qe.locale.substring(0, 2), - a = 'ordinal' === i.type ? Qe.ordinal : Qe.cardinal; + const s = Je.locale.substring(0, 2), + a = 'ordinal' === i.type ? Je.ordinal : Je.cardinal; let o, n = 'ordinal' === i.type - ? Qe._ordinalPluralCategories.indexOf(a.select(t)) - : Qe._cardinalPluralCategories.indexOf(a.select(t)); + ? Je._ordinalPluralCategories.indexOf(a.select(t)) + : Je._cardinalPluralCategories.indexOf(a.select(t)); return ( - Qe.strings[Qe.locale] && (o = Qe.strings[Qe.locale][e]), - !o && Qe.strings[s] && (o = Qe.strings[s][e]), + Je.strings[Je.locale] && (o = Je.strings[Je.locale][e]), + !o && Je.strings[s] && (o = Je.strings[s][e]), o || - ((o = Qe.strings.en[e]), + ((o = Je.strings.en[e]), o || (o = e), (n = 'ordinal' === i.type - ? Qe._ordinalPluralCategories.indexOf( - Qe._ordinalEnglish.select(t) + ? Je._ordinalPluralCategories.indexOf( + Je._ordinalEnglish.select(t) ) - : Qe._cardinalPluralCategories.indexOf( - Qe._cardinalEnglish.select(t) + : Je._cardinalPluralCategories.indexOf( + Je._cardinalEnglish.select(t) ))), o.split(';')[n] || o.split(';')[0] ); }), - (Qe.merge = function(t, e) { + (Je.merge = function(t, e) { if (t && e) { - const i = Qe._locale; - (Qe.locale = t), - (Qe.strings[t] = { ...Qe.strings[t], ...e }), - (Qe.locale = i); + const i = Je._locale; + (Je.locale = t), + (Je.strings[t] = { ...Je.strings[t], ...e }), + (Je.locale = i); } else t && !e && ((e = t), - Object.keys(e).forEach(t => Qe.merge(t, e[t]))); + Object.keys(e).forEach(t => Je.merge(t, e[t]))); }), - Object.defineProperty(Qe, 'locale', { + Object.defineProperty(Je, 'locale', { set(t) { - (Qe._locale = t), - (Qe._ordinal = null), - (Qe._cardinal = null); + (Je._locale = t), + (Je._ordinal = null), + (Je._cardinal = null); }, get: () => ( - Qe._locale || - (Qe._locale = + Je._locale || + (Je._locale = 'undefined' == typeof navigator ? 'en' : navigator.language.slice(0, 5)), - Qe._locale + Je._locale ), }), - Object.defineProperty(Qe, 'ordinal', { + Object.defineProperty(Je, 'ordinal', { get: () => ( - Qe._ordinal || - ((Qe._ordinalEnglish = new Intl.PluralRules('en', { + Je._ordinal || + ((Je._ordinalEnglish = new Intl.PluralRules('en', { type: 'ordinal', })), - (Qe._ordinalEnglishPluralCategories = Qe._ordinalEnglish.resolvedOptions().pluralCategories), - (Qe._ordinal = new Intl.PluralRules(Qe.locale, { + (Je._ordinalEnglishPluralCategories = Je._ordinalEnglish.resolvedOptions().pluralCategories), + (Je._ordinal = new Intl.PluralRules(Je.locale, { type: 'ordinal', })), - (Qe._ordinalPluralCategories = Qe._ordinal.resolvedOptions().pluralCategories)), - Qe._ordinal + (Je._ordinalPluralCategories = Je._ordinal.resolvedOptions().pluralCategories)), + Je._ordinal ), }), - Object.defineProperty(Qe, 'cardinal', { + Object.defineProperty(Je, 'cardinal', { get: () => ( - Qe._cardinal || - ((Qe._cardinalEnglish = new Intl.PluralRules('en', { + Je._cardinal || + ((Je._cardinalEnglish = new Intl.PluralRules('en', { type: 'cardinal', })), - (Qe._cardinalEnglishPluralCategories = Qe._cardinalEnglish.resolvedOptions().pluralCategories), - (Qe._cardinal = new Intl.PluralRules(Qe.locale, { + (Je._cardinalEnglishPluralCategories = Je._cardinalEnglish.resolvedOptions().pluralCategories), + (Je._cardinal = new Intl.PluralRules(Je.locale, { type: 'cardinal', })), - (Qe._cardinaPluralCategories = Qe._ordinal.resolvedOptions().pluralCategories)), - Qe._cardinal + (Je._cardinaPluralCategories = Je._ordinal.resolvedOptions().pluralCategories)), + Je._cardinal ), }), - (Qe.strings = { + (Je.strings = { en: { 'keyboard.tooltip.functions': 'Functions', 'keyboard.tooltip.greek': 'Greek Letters', @@ -13661,7 +13651,7 @@ var global, factory; 'tooltip.undo': 'расстегивать', }, }); - const ti = { + const Ye = { numeric: { tooltip: 'keyboard.tooltip.numeric', layer: 'math', @@ -13704,7 +13694,7 @@ var global, factory; label: 'bi𝔹', }, }, - ei = { + Qe = { '\\varphi ': { label: 'Φ', insert: '\\Phi ' }, '\\varsigma ': { label: 'Σ', insert: '\\Sigma ' }, '\\epsilon ': { label: 'Ɛ', insert: '{\\char"0190}' }, @@ -13732,7 +13722,7 @@ var global, factory; '\\nu ': { label: 'Ν', insert: '{\\char"39D}' }, '\\mu ': { label: 'Μ', insert: '{\\char"39C}' }, }, - ii = { + ti = { 0: [ '\\emptyset', '\\varnothing', @@ -14089,8 +14079,8 @@ var global, factory; ], '->|': [], }; - let si = {}; - const ai = { + let ei = {}; + const ii = { math: "\n
\n \n \n \n \n \n
\n ", 'lower-roman': @@ -14114,10 +14104,10 @@ var global, factory; style: "\n
\n \n \n \n \n
", }; - function oi(t, e, i) { + function si(t, e, i) { t = t.replace(/(^|[^\\])#@/g, '$1#?'); - const s = he.parseTokens(n(t), 'math', e, i.config.macros), - a = te.decompose( + const s = le.parseTokens(n(t), 'math', e, i.config.macros), + a = Yt.decompose( { mathstyle: 'displaystyle', macros: i.config.macros }, s ), @@ -14131,13 +14121,13 @@ var global, factory; $.makeSpan([r, l, o], 'ML__mathlive').toMarkup() ); } - function ni(t, e, i) { + function ai(t, e, i) { let s = "
"; const a = e.replace(/\s+/g, ' ').split(' '); if (a.length > 1) { const e = Object.assign( {}, - ti, + Ye, t.config.customVirtualKeyboards || {} ); for (const t of a) { @@ -14150,7 +14140,7 @@ var global, factory; : (s += 'layer-switch '), (s += (e[t].classes || '') + "'"), e[t].tooltip && - ((s += "data-tooltip='" + Qe(e[t].tooltip) + "' "), + ((s += "data-tooltip='" + Je(e[t].tooltip) + "' "), (s += "data-placement='top' data-delay='1s'")), t !== i && (e[t].command && @@ -14163,27 +14153,27 @@ var global, factory; } return ( (s += '
'), - (s += `\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n `), "' ); } - function ri(t, e, i) { + function oi(t, e, i) { for (let s = 0; s < e.length; ++s) { const a = e[s]; a.getAttribute('data-latex') - ? (a.innerHTML = oi( + ? (a.innerHTML = si( a.getAttribute('data-latex').replace(/"/g, '"'), { '?': '{\\color{#555}{\\tiny \\char"2B1A}}' }, t )) : '' === a.innerHTML && a.getAttribute('data-insert') - ? (a.innerHTML = oi( + ? (a.innerHTML = si( a.getAttribute('data-insert').replace(/"/g, '"'), { '?': '{\\color{#555}{\\tiny \\char"2B1A}}' }, t @@ -14206,13 +14196,13 @@ var global, factory; if ( (n && (n = n.replace(/"/g, '"')), n && - ei[n] && - (a.setAttribute('data-shifted', ei[n].label), + Qe[n] && + (a.setAttribute('data-shifted', Qe[n].label), a.setAttribute( 'data-shifted-command', JSON.stringify([ 'insertAndUnshiftKeyboardLayer', - ei[n].insert, + Qe[n].insert, ]) )), (o = a.getAttribute('data-command') @@ -14253,7 +14243,7 @@ var global, factory; i && (o = [i, o]), a.getAttribute('data-alt-keys')) ) { - const t = si[a.getAttribute('data-alt-keys')]; + const t = ei[a.getAttribute('data-alt-keys')]; t && (o = { default: o, @@ -14268,7 +14258,7 @@ var global, factory; t._attachButtonHandlers(a, o); } } - function li(t, e) { + function ni(t, e) { const i = { qwerty: { 'lower-1': 'qwertyuiop', @@ -14396,13 +14386,13 @@ var global, factory; } return o; } - var ci = { + var ri = { make: function(t, e) { let i = '\n\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n '; - ii['foreground-color'] = []; - for (const t of ne) - ii['foreground-color'].push({ + ti['foreground-color'] = []; + for (const t of ae) + ti['foreground-color'].push({ classes: 'small-button', content: '', command: '["applyStyle",{"color":"' + t + '"}]', }); - ii['background-color'] = []; - for (const t of oe) - ii['background-color'].push({ + ti['background-color'] = []; + for (const t of se) + ti['background-color'].push({ classes: 'small-button', content: ' { - si[t] = si[t].slice(); + (ei = { ...ti }), + Object.keys(ei).forEach(t => { + ei[t] = ei[t].slice(); }); const s = 'abcdefghijklmnopqrstuvwxyz'; for (let t = 0; t < 26; t++) { const e = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[t]; - si[e] || (si[e] = []), - si[e].unshift({ + ei[e] || (ei[e] = []), + ei[e].unshift({ latex: '\\mathbb{' + e + '}', aside: 'blackboard', insert: '\\mathbb{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathbf{' + e + '}', aside: 'bold', insert: '\\mathbf{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathsf{' + e + '}', aside: 'sans', insert: '\\mathsf{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathtt{' + e + '}', aside: 'monospace', insert: '\\mathtt{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathcal{' + e + '}', aside: 'script', insert: '\\mathcal{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathfrak{' + e + '}', aside: 'fraktur', insert: '\\mathfrak{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathbb{' + s[t] + '}', aside: 'blackboard', insert: '\\mathbb{' + s[t] + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathbf{' + s[t] + '}', aside: 'bold', insert: '\\mathbf{' + s[t] + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathsf{' + s[t] + '}', aside: 'sans', insert: '\\mathsf{' + s[t] + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathcal{' + s[t] + '}', aside: 'script', insert: '\\mathcal{' + s[t] + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathfrak{' + s[t] + '}', aside: 'fraktur', insert: '\\mathfrak{' + s[t] + '}', @@ -14487,23 +14477,23 @@ var global, factory; } for (let t = 0; t <= 26; t++) { const e = s[t]; - si[e] || (si[e] = []), - si[e].unshift({ + ei[e] || (ei[e] = []), + ei[e].unshift({ latex: '\\mathsf{' + e + '}', aside: 'sans', insert: '\\mathbb{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathbf{' + e + '}', aside: 'bold', insert: '\\mathbf{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathtt{' + e + '}', aside: 'monospace', insert: '\\mathtt{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathfrak{' + e + '}', aside: 'fraktur', insert: '\\mathfrak{' + e + '}', @@ -14511,28 +14501,28 @@ var global, factory; } for (let t = 0; t < 10; t++) { const e = '0123456789'[t]; - si[e] || (si[e] = []), - si[e].unshift({ + ei[e] || (ei[e] = []), + ei[e].unshift({ latex: '\\mathbf{' + e + '}', aside: 'bold', insert: '\\mathbf{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathsf{' + e + '}', aside: 'sans', insert: '\\mathsf{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathtt{' + e + '}', aside: 'monospace', insert: '\\mathtt{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathcal{' + e + '}', aside: 'script', insert: '\\mathcal{' + e + '}', }), - si[e].unshift({ + ei[e].unshift({ latex: '\\mathfrak{' + e + '}', aside: 'fraktur', insert: '\\mathfrak{' + e + '}', @@ -14546,12 +14536,12 @@ var global, factory; )); const o = Object.assign( {}, - ai, + ii, t.config.customVirtualKeyboardLayers || {} ), n = Object.assign( {}, - ti, + Ye, t.config.customVirtualKeyboards || {} ), r = a.replace(/\s+/g, ' ').split(' '); @@ -14617,9 +14607,9 @@ var global, factory; "
"), - (i += ni(t, a, e)); + (i += ai(t, a, e)); const s = 'function' == typeof o[n] ? o[n]() : o[n]; - (i += li(t, s)), (i += '
'); + (i += ni(t, s)), (i += '
'); } } const l = document.createElement('div'); @@ -14631,7 +14621,7 @@ var global, factory; : /android|cros/i.test(navigator.userAgent) && l.classList.add('material'), (l.innerHTML = i), - ri( + oi( t, l.querySelectorAll( '.keycap, .action, .fnbutton, .bigfnbutton' @@ -14680,9 +14670,9 @@ var global, factory; l ); }, - makeKeycap: ri, + makeKeycap: oi, }; - const hi = { + const li = { '−': '-', '-': '-', '\\alpha': 'alpha', @@ -14722,7 +14712,7 @@ var global, factory; '\\Psi': 'Psi', '\\Omega': 'Omega', }, - di = { + ci = { '\\pm': '+-', '\\times': 'xx', '\\colon': ':', @@ -14734,7 +14724,7 @@ var global, factory; '\\langle': '(:', '\\rangle': ':)', }, - pi = { + hi = { '\\pm': '±', '\\times': '×', '\\colon': ':', @@ -14760,17 +14750,17 @@ var global, factory; '\\check': 'ˇ', '\\hat': '^', }; - function mi(t) { + function di(t) { return t .replace(/"/g, '"') .replace(/'/g, ''') .replace(//g, '>'); } - function ui(t, e) { + function pi(t, e) { return t && e.generateID ? ' extid="' + t + '"' : ''; } - function fi(t, e, i) { + function mi(t, e, i) { let s = !1; e = e || t.atoms.length; let a = '', @@ -14790,18 +14780,18 @@ var global, factory; ) { if ( ((s = !0), - gi(t) && ((n = t.index), (t.index += 1)), - yi(t) && ((r = t.index), (t.index += 1)), + ui(t) && ((n = t.index), (t.index += 1)), + fi(t) && ((r = t.index), (t.index += 1)), n >= 0 && r >= 0) ) (a = '' + o), - (a += Si(t.atoms[r].subscript, 0, 0, i).mathML), - (a += Si(t.atoms[n].superscript, 0, 0, i).mathML), + (a += vi(t.atoms[r].subscript, 0, 0, i).mathML), + (a += vi(t.atoms[n].superscript, 0, 0, i).mathML), (a += ''); else if (n >= 0) { - if (((a = '' + o), gi(t))) { - const e = Si(t.atoms[n].superscript, 0, 0, i).mathML, - s = Si(t.atoms[n + 1].superscript, 0, 0, i).mathML; + if (((a = '' + o), ui(t))) { + const e = vi(t.atoms[n].superscript, 0, 0, i).mathML, + s = vi(t.atoms[n + 1].superscript, 0, 0, i).mathML; a += ('' !== e && '' !== e) || ('' !== s && '' !== s) @@ -14810,12 +14800,12 @@ var global, factory; ? '' : e : ''; - } else a += Si(t.atoms[n].superscript, 0, 0, i).mathML; + } else a += vi(t.atoms[n].superscript, 0, 0, i).mathML; a += ''; } else r >= 0 ? ((a = '' + o), - (a += Si(t.atoms[r].subscript, 0, 0, i).mathML), + (a += vi(t.atoms[r].subscript, 0, 0, i).mathML), (a += '')) : (a = o); ('mi' !== t.lastType && @@ -14834,21 +14824,21 @@ var global, factory; } return s; } - function gi(t) { + function ui(t) { return ( t.index < t.atoms.length && t.atoms[t.index].superscript && 'msubsup' === t.atoms[t.index].type ); } - function yi(t) { + function fi(t) { return ( t.index < t.atoms.length && t.atoms[t.index].subscript && 'msubsup' === t.atoms[t.index].type ); } - function bi(t, e, i) { + function gi(t, e, i) { let s = !1, a = '', o = e.atoms[e.index - 1]; @@ -14856,28 +14846,28 @@ var global, factory; !!o && (o.superscript || o.subscript || - ((gi(e) || yi(e)) && + ((ui(e) || fi(e)) && ((o = e.atoms[e.index]), (e.index += 1))), !!o && (o.superscript && o.subscript ? ((a = '' + t), - (a += Si(o.subscript, 0, 0, i).mathML), - (a += Si(o.superscript, 0, 0, i).mathML), + (a += vi(o.subscript, 0, 0, i).mathML), + (a += vi(o.superscript, 0, 0, i).mathML), (a += '')) : o.superscript ? ((a = '' + t), - (a += Si(o.superscript, 0, 0, i).mathML), + (a += vi(o.superscript, 0, 0, i).mathML), (a += '')) : o.subscript && ((a = '' + t), - (a += Si(o.subscript, 0, 0, i).mathML), + (a += vi(o.subscript, 0, 0, i).mathML), (a += '')), a.length > 0 && ((s = !0), (e.mathML += a), (e.lastType = '')), s)) ); } - function xi(t, e, i) { + function yi(t, e, i) { let s = !1; e = e || t.atoms.length; const a = t.index; @@ -14889,13 +14879,13 @@ var global, factory; o.length > 0 && ((s = !0), (o = - '' + o + ''), + '' + o + ''), (t.mathML += o), (t.lastType = 'mtext')), s ); } - function ki(t, e, i) { + function bi(t, e, i) { let s = !1; e = e || t.atoms.length; const a = t.index; @@ -14924,18 +14914,18 @@ var global, factory; return ( o.length > 0 && ((s = !0), - (o = '' + o + ''), - n < 0 && gi(t) && ((n = t.index), (t.index += 1)), + (o = '' + o + ''), + n < 0 && ui(t) && ((n = t.index), (t.index += 1)), n >= 0 && ((o = '' + o), - (o += Si(t.atoms[n].superscript, 0, 0, i).mathML), + (o += vi(t.atoms[n].superscript, 0, 0, i).mathML), (o += '')), (t.mathML += o), (t.lastType = 'mn')), s ); } - function vi(t, e, i) { + function xi(t, e, i) { let s = !1; e = e || t.atoms.length; let a = '', @@ -14954,9 +14944,9 @@ var global, factory; (h += 1); n && ((a = ''), - (a += Ai(t.atoms[l], i)), - (a += Si(t.atoms, l + 1, c, i).mathML), - (a += Ai(t.atoms[c], i)), + (a += wi(t.atoms[l], i)), + (a += vi(t.atoms, l + 1, c, i).mathML), + (a += wi(t.atoms[c], i)), (a += ''), ('mi' !== t.lastType && 'mn' !== t.lastType && @@ -14964,14 +14954,14 @@ var global, factory; 'fence' !== t.lastType) || (a = '' + a), (t.index = c + 1), - bi(a, t, i) && ((s = !0), (t.lastType = ''), (a = '')), + gi(a, t, i) && ((s = !0), (t.lastType = ''), (a = '')), (o = 'fence')); } return ( a.length > 0 && ((s = !0), (t.mathML += a), (t.lastType = o)), s ); } - function wi(t, e, i) { + function ki(t, e, i) { let s = !1; e = e || t.atoms.length; let a = '', @@ -14981,14 +14971,14 @@ var global, factory; (a += t.atoms[t.index].toMathML(i)), (t.index += 1), (o = 'mo'); else if (t.index < e && 'mop' === n.type) { if ('limits' === n.limits && (n.superscript || n.subscript)) { - const t = Ai(n, i); + const t = wi(n, i); n.superscript && n.subscript ? ((a += ('nolimits' !== n.limits ? '' : '') + t), - (a += Si(n.subscript, 0, 0, i).mathML), - (a += Si(n.superscript, 0, 0, i).mathML), + (a += vi(n.subscript, 0, 0, i).mathML), + (a += vi(n.superscript, 0, 0, i).mathML), (a += 'nolimits' !== n.limits ? '' @@ -14997,14 +14987,14 @@ var global, factory; ? ((a += ('nolimits' !== n.limits ? '' : '') + t), - (a += Si(n.superscript, 0, 0, i).mathML), + (a += vi(n.superscript, 0, 0, i).mathML), (a += 'nolimits' !== n.limits ? '' : '')) : ((a += ('nolimits' !== n.limits ? '' : '') + t), - (a += Si(n.subscript, 0, 0, i).mathML), + (a += vi(n.subscript, 0, 0, i).mathML), (a += 'nolimits' !== n.limits ? '' @@ -15015,14 +15005,14 @@ var global, factory; n = 0 === e.latex.indexOf('\\operatorname'), r = n ? '' + - Mi(e.body) + + Si(e.body) + '' - : Ai(e, i); + : wi(e, i); (a += r), (t.index += 1), - bi(a, t, i) && ((s = !0), (t.lastType = ''), (a = '')), + gi(a, t, i) && ((s = !0), (t.lastType = ''), (a = '')), (t.index -= 1), n || /^(.*)<\/mo>$/.test(r) ? (o = n ? 'mi' : 'mo') @@ -15038,7 +15028,7 @@ var global, factory; a.length > 0 && ((s = !0), (t.mathML += a), (t.lastType = o)), s ); } - function Si(t, e, i, s) { + function vi(t, e, i, s) { const a = { atoms: t, index: e || 0, mathML: '', lastType: '' }; if ( ((i = i || (t ? t.length : 0)), @@ -15052,11 +15042,11 @@ var global, factory; let t = 0; for (; a.index < i; ) if ( - xi(a, i, s) || + yi(a, i, s) || + bi(a, i, s) || + mi(a, i, s) || ki(a, i, s) || - fi(a, i, s) || - wi(a, i, s) || - vi(a, i, s) + xi(a, i, s) ) t += 1; else if (a.index < i) { @@ -15075,21 +15065,21 @@ var global, factory; } return a; } - function Ai(t, e) { + function wi(t, e) { let i = ''; - const s = Mi(t.body); - return s && (i = '' + s + ''), i; + const s = Si(t.body); + return s && (i = '' + s + ''), i; } - function Mi(t) { + function Si(t) { if (!t) return ''; - if ('string' == typeof t) return mi(t); + if ('string' == typeof t) return di(t); if (!Array.isArray(t) && 'string' == typeof t.body) - return mi(t.body); + return di(t.body); let e = ''; for (const i of t) 'string' == typeof i.body && (e += i.body); - return mi(e); + return di(e); } - (te.MathAtom.prototype.toMathML = function(t) { + (Yt.MathAtom.prototype.toMathML = function(t) { const e = { '\\exponentialE': 'ⅇ', '\\imaginaryI': 'ⅈ', @@ -15140,14 +15130,14 @@ var global, factory; d && (d = ' mathvariant="' + d + '"'); const p = this.latex ? this.latex.trim() : null; if ('text' === this.mode) - c = '' + this.body + ''; + c = '' + this.body + ''; else switch (this.type) { case 'first': break; case 'group': case 'root': - c = Si(this.body, 0, 0, t).mathML; + c = vi(this.body, 0, 0, t).mathML; break; case 'array': if ( @@ -15158,7 +15148,7 @@ var global, factory; '.' !== this.lFence && (c += '' + - (pi[this.lFence] || this.lFence) + + (hi[this.lFence] || this.lFence) + '')), (c += ''; c += ''; } @@ -15194,7 +15184,7 @@ var global, factory; '.' !== this.rFence && (c += '' + - (pi[this.lFence] || this.rFence) + + (hi[this.lFence] || this.rFence) + ''), (c += '')); break; @@ -15204,48 +15194,48 @@ var global, factory; '.' !== this.leftDelim && (c += '' + - (pi[this.leftDelim] || this.leftDelim) + + (hi[this.leftDelim] || this.leftDelim) + ''), this.hasBarLine ? ((c += ''), (c += - Si(this.numer, 0, 0, t).mathML || + vi(this.numer, 0, 0, t).mathML || ' '), (c += - Si(this.denom, 0, 0, t).mathML || + vi(this.denom, 0, 0, t).mathML || ' '), (c += '')) - : ((c += ''), + : ((c += ''), (c += '' + - Si(this.numer, 0, 0, t).mathML + + vi(this.numer, 0, 0, t).mathML + ''), (c += '' + - Si(this.denom, 0, 0, t).mathML + + vi(this.denom, 0, 0, t).mathML + ''), (c += '')), this.rightDelim && '.' !== this.rightDelim && (c += '' + - (pi[this.rightDelim] || this.rightDelim) + + (hi[this.rightDelim] || this.rightDelim) + ''), (this.leftDelim || this.rightDelim) && (c += ''); break; case 'surd': this.index - ? ((c += ''), - (c += Si(this.body, 0, 0, t).mathML), - (c += Si(this.index, 0, 0, t).mathML), + ? ((c += ''), + (c += vi(this.body, 0, 0, t).mathML), + (c += vi(this.index, 0, 0, t).mathML), (c += '')) - : ((c += ''), - (c += Si(this.body, 0, 0, t).mathML), + : ((c += ''), + (c += vi(this.body, 0, 0, t).mathML), (c += '')); break; case 'leftright': @@ -15254,18 +15244,18 @@ var global, factory; '.' !== this.leftDelim && (c += '' + - (pi[this.leftDelim] || this.leftDelim) + + (hi[this.leftDelim] || this.leftDelim) + ''), - this.body && (c += Si(this.body, 0, 0, t).mathML), + this.body && (c += vi(this.body, 0, 0, t).mathML), this.rightDelim && '.' !== this.rightDelim && (c += '' + - (pi[this.rightDelim] || this.rightDelim) + + (hi[this.rightDelim] || this.rightDelim) + ''), (c += ''); break; @@ -15273,15 +15263,15 @@ var global, factory; case 'delim': c += '' + - (pi[this.delim] || this.delim) + + (hi[this.delim] || this.delim) + ''; break; case 'accent': - (c += ''), - (c += Si(this.body, 0, 0, t).mathML), - (c += '' + (pi[p] || this.accent) + ''), + (c += ''), + (c += vi(this.body, 0, 0, t).mathML), + (c += '' + (hi[p] || this.accent) + ''), (c += ''); break; case 'line': @@ -15318,29 +15308,29 @@ var global, factory; ? ((c += '' + - Si(l, 0, 0, t).mathML), - (c += Si(n, 0, 0, t).mathML), - (c += Si(r, 0, 0, t).mathML), + vi(l, 0, 0, t).mathML), + (c += vi(n, 0, 0, t).mathML), + (c += vi(r, 0, 0, t).mathML), (c += '')) : r ? ((c += '' + - Si(l, 0, 0, t).mathML), - (c += Si(r, 0, 0, t).mathML), + vi(l, 0, 0, t).mathML), + (c += vi(r, 0, 0, t).mathML), (c += '')) : n && ((c += '' + - Si(l, 0, 0, t).mathML), - (c += Si(n, 0, 0, t).mathML), + vi(l, 0, 0, t).mathML), + (c += vi(n, 0, 0, t).mathML), (c += '')); break; case 'placeholder': @@ -15373,9 +15363,9 @@ var global, factory; '<' + s + d + - ui(this.id, t) + + pi(this.id, t) + '>' + - mi(c) + + di(c) + ''; @@ -15387,22 +15377,22 @@ var global, factory; case 'minner': c = p && e[p] - ? '' + e[p] + '' - : p && pi[p] - ? '' + pi[p] + '' - : Ai(this, t); + ? '' + e[p] + '' + : p && hi[p] + ? '' + hi[p] + '' + : wi(this, t); break; case 'mpunct': c = '' + - (pi[p] || p) + + (hi[p] || p) + ''; break; case 'mop': '​' !== this.body && - ((c = ''), + ((c = ''), (c += '\\operatorname' === p ? this.body @@ -15416,12 +15406,12 @@ var global, factory; this.backgroundcolor && (c += ' mathbackground="' + - se(this.backgroundcolor) + + ee(this.backgroundcolor) + '"'), (c += - ui(this.id, t) + + pi(this.id, t) + '>' + - Si(this.body, 0, 0, t).mathML + + vi(this.body, 0, 0, t).mathML + ''); break; case 'spacing': @@ -15437,9 +15427,9 @@ var global, factory; this.notation[t] && ((c += h + t), (h = ' ')); c += - ui(this.id, t) + + pi(this.id, t) + '">' + - Si(this.body, 0, 0, t).mathML + + vi(this.body, 0, 0, t).mathML + ''; break; case 'space': @@ -15447,10 +15437,10 @@ var global, factory; } return c; }), - (te.toMathML = function(t, e) { - return Si(t, 0, 0, e).mathML; + (Yt.toMathML = function(t, e) { + return vi(t, 0, 0, e).mathML; }); - const Ci = { + const Ai = { '\\imaginaryI': 'ⅈ', '\\imaginaryJ': 'ⅉ', '\\pi': 'π', @@ -15549,7 +15539,7 @@ var global, factory; '\\iff': 'equivalent', '\\Longleftrightarrow': 'equivalent', }, - _i = { + Mi = { '+': 'add', '*': 'multiply', '-': 'subtract', @@ -15574,7 +15564,7 @@ var global, factory; '++': 'increment', '--': 'decrement', }, - Ti = { + Ci = { equal: '%0 = %1', ne: '%0 \\ne %1', questeq: '%0 \\questeq %1', @@ -15659,7 +15649,7 @@ var global, factory; factorial: '%0!', factorial2: '%0!!', }, - Li = { + _i = { degree: 880, nabla: 740, curl: 740, @@ -15738,40 +15728,40 @@ var global, factory; ',': 40, ';': 30, }; - function Fi(t, e) { + function Ti(t, e) { return Array.isArray(t.arg) ? t.arg[e] : void 0; } - function Di(t) { - return (t && Li[t]) || -1; + function Li(t) { + return (t && _i[t]) || -1; } - function zi(t) { + function Fi(t) { return /=|=>/.test(t) ? 'right' : 'left'; } - function Ei(t) { + function Di(t) { if ('f' === t || 'g' === t) return !0; - const e = Ti[t]; + const e = Ci[t]; return !!e && !!/%[^01_^]?/.test(e); } - function qi(t) { + function zi(t) { t = (t || '').trim(); - let e = Ci[t]; + let e = Ai[t]; if (!e) if (/^\\[^{}]+$/.test(t)) { - const i = At.getInfo(t, 'math', {}); + const i = wt.getInfo(t, 'math', {}); e = (i && i.value) || t.slice(1); } else e = t; return e; } - function Pi(t) { + function Ei(t) { if (!t) return null; - const e = qi(Ni(t)), - i = [Di(e), zi(e)]; + const e = zi(Ri(t)), + i = [Li(e), Fi(e)]; return i[0] <= 0 ? null : i; } - function Ii(t) { - return null !== Pi(t); + function qi(t) { + return null !== Ei(t); } - const Bi = { + const Pi = { '\\lfloor\\rfloor': 'floor', '\\lceil\\rceil': 'ceil', '\\vert\\vert': 'abs', @@ -15786,7 +15776,7 @@ var global, factory; '\\lmoustache\\rmoustache': 'moustache', '\\lbrace\\rbrace': 'brace', }, - Oi = { + Ii = { '!': 'factorial', '\\dag': 'dagger', '\\dagger': 'dagger', @@ -15801,7 +15791,7 @@ var global, factory; '\\_': '_', '\\degree': 'degree', }, - Ri = { + Bi = { '+': 'add', '-': 'add', '*': 'multiply', @@ -15817,11 +15807,11 @@ var global, factory; shortEquivalent: 'equivalent', equivalent: 'equivalent', }, - Ki = { ',': 'list', ';': 'list2' }; - function Ni(t) { + Oi = { ',': 'list', ';': 'list2' }; + function Ri(t) { if (Array.isArray(t)) { let e = ''; - for (const i of t) e += Ni(i); + for (const i of t) e += Ri(i); return e; } if ( @@ -15833,72 +15823,72 @@ var global, factory; if ('string' == typeof t.body) return t.body; if (Array.isArray(t.body)) { let e = ''; - for (const i of t.body) e += Ni(i); + for (const i of t.body) e += Ri(i); return e; } return ''; } - function $i(t) { + function Ki(t) { return 'string' == typeof t.sym ? (function(t) { - let e = Ti[t]; + let e = Ci[t]; if (e) return e .replace('%1', '') .replace('%0', '') .replace('%', ''); if (t.length > 1) { - const i = At.getInfo('\\' + t, 'math'); + const i = wt.getInfo('\\' + t, 'math'); !i || (i.fontFamily && 'cmr' !== i.fontFamily && 'ams' !== i.fontFamily) || (e = '\\' + t); } - return e || (e = At.unicodeStringToLatex('math', t)), e; + return e || (e = wt.unicodeStringToLatex('math', t)), e; })(t.sym) || t.sym : ''; } - function Wi(t) { + function Ni(t) { return parseFloat(t.num); } - function Hi(t) { + function $i(t) { return 'object' == typeof t && void 0 !== t.num; } - function Vi(t) { + function Wi(t) { let e = 0; return ( - Hi(t) && + $i(t) && (e = 'object' == typeof t.num ? void 0 !== t.num.re - ? hs(t.num.re) + ? ls(t.num.re) : 0 : parseFloat(t.num)), e ); } - function Ui(t) { + function Hi(t) { let e = 0; return ( - Hi(t) && + $i(t) && 'object' == typeof t.num && - (e = void 0 !== t.num.im ? hs(t.num.im) : 0), + (e = void 0 !== t.num.im ? ls(t.num.im) : 0), e ); } - function ji(t) { + function Vi(t) { return t && void 0 !== t.sup; } - function Gi(t) { + function Ui(t) { return t && void 0 !== t.sub; } - function Zi(t, e, i) { + function ji(t, e, i) { let s = !1; const a = t.atoms[t.index]; - return a && a.type === e && (s = void 0 === i || Ni(a) === i), s; + return a && a.type === e && (s = void 0 === i || Ri(a) === i), s; } - function Xi(t, ...e) { + function Gi(t, ...e) { const i = { fn: t }; if (e) { const t = []; @@ -15907,7 +15897,7 @@ var global, factory; } return i; } - function Ji(t) { + function Zi(t) { return 'number' == typeof t ? { num: t.toString() } : 'string' == typeof t @@ -15916,10 +15906,10 @@ var global, factory; ? { num: t } : void 0; } - function Yi(t) { - if (Hi(t)) { - const e = Vi(t), - i = Ui(t); + function Xi(t) { + if ($i(t)) { + const e = Wi(t), + i = Hi(t); return ( 0 !== i ? (0 !== e && (t.num.re = (-e).toString()), @@ -15928,13 +15918,13 @@ var global, factory; t ); } - return Xi('negate', t); + return Gi('negate', t); } - function Qi(t) { + function Ji(t) { const e = t.atoms[t.index + 1]; return e && 'msubsup' === e.type; } - function ts(t, e) { + function Yi(t, e) { let i = t.atoms[t.index]; return ( !i || (void 0 === i.superscript && void 0 === i.subscript) @@ -15947,59 +15937,59 @@ var global, factory; : (i = null)), i ? (void 0 !== i.subscript && - (t.ast.sub = rs(i.subscript, e)), + (t.ast.sub = os(i.subscript, e)), void 0 !== i.superscript && ('msubsup' === i.type - ? /['\u2032]|\\prime/.test(Ni(i.superscript)) + ? /['\u2032]|\\prime/.test(Ri(i.superscript)) ? ((t.index += 1), (i = t.atoms[t.index + 1]), i && 'msubsup' === i.type && - /['\u2032]|\\prime/.test(Ni(i.superscript)) + /['\u2032]|\\prime/.test(Ri(i.superscript)) ? (t.ast.sup = { sym: '″' }) : ((t.ast.sup = { sym: '′' }), (t.index -= 1))) : /['\u2033]|\\doubleprime/.test( - Ni(i.superscript) + Ri(i.superscript) ) ? (t.ast.sup = { sym: '″' }) - : t.ast && (t.ast.sup = rs(i.superscript, e)) - : (t.ast.sup = rs(i.superscript, e)))) + : t.ast && (t.ast.sup = os(i.superscript, e)) + : (t.ast.sup = os(i.superscript, e)))) : (t.index += 1), t ); } - function es(t, e) { + function Qi(t, e) { const i = t.ast; - if (ss(t, '!!')) + if (es(t, '!!')) return ( (t.index += 1), - (t.ast = Xi('factorial2', i)), - es((t = ts(t, e)), e) + (t.ast = Gi('factorial2', i)), + Qi((t = Yi(t, e)), e) ); - if (ss(t, '++')) + if (es(t, '++')) return ( (t.index += 1), - (t.ast = Xi('increment', i)), - es((t = ts(t, e)), e) + (t.ast = Gi('increment', i)), + Qi((t = Yi(t, e)), e) ); - if (ss(t, '--')) + if (es(t, '--')) return ( (t.index += 1), - (t.ast = Xi('decrement', i)), - es((t = ts(t, e)), e) + (t.ast = Gi('decrement', i)), + Qi((t = Yi(t, e)), e) ); const s = t.atoms[t.index]; return ( s && s.latex && - Oi[s.latex.trim()] && - ((t.ast = Xi(Oi[s.latex.trim()], i)), - (t = es((t = ts(t, e)), e))), + Ii[s.latex.trim()] && + ((t.ast = Gi(Ii[s.latex.trim()], i)), + (t = Qi((t = Yi(t, e)), e))), t ); } - function is(t, e, i, s) { + function ts(t, e, i, s) { if ( ((t.index = t.index || 0), 0 === t.atoms.length || t.index >= t.atoms.length) @@ -16009,21 +15999,21 @@ var global, factory; t.minPrec = 0; let o = t.atoms[t.index]; if (e) { - if ('mopen' === o.type && Ni(o) === e) + if ('mopen' === o.type && Ri(o) === e) (t.index += 1), - (o = (t = os(t, s)).atoms[t.index]), + (o = (t = ss(t, s)).atoms[t.index]), o && 'mclose' === o.type && - Ni(o) === i && - (Qi(t) && (t.ast = { group: t.ast }), - (t = es((t = ts(t, s)), s))); - else if ('textord' === o.type && Ni(o) === e) + Ri(o) === i && + (Ji(t) && (t.ast = { group: t.ast }), + (t = Qi((t = Yi(t, s)), s))); + else if ('textord' === o.type && Ri(o) === e) (t.index += 1), - (o = (t = os(t, s)).atoms[t.index]), + (o = (t = ss(t, s)).atoms[t.index]), o && 'textord' === o.type && - Ni(o) === i && - ((t.index += 1), (t = es((t = ts(t, s)), s))); + Ri(o) === i && + ((t.index += 1), (t = Qi((t = Yi(t, s)), s))); else if ( '\\lVert' === e && 'textord' === o.type && @@ -16033,7 +16023,7 @@ var global, factory; ((o = t.atoms[t.index + 1]), o && 'textord' === o.type && '|' === o.latex) ) { - (t.index += 2), (o = (t = os(t, s)).atoms[t.index]); + (t.index += 2), (o = (t = ss(t, s)).atoms[t.index]); const e = t.atoms[t.index + 1]; o && 'textord' === o.type && @@ -16041,15 +16031,15 @@ var global, factory; e && 'textord' === e.type && '|' === e.latex && - ((t.index += 2), (t = es((t = ts(t, s)), s))); + ((t.index += 2), (t = Qi((t = Yi(t, s)), s))); } } else if ('sizeddelim' === o.type && o.delim === e) (t.index += 1), - (o = (t = os(t, s)).atoms[t.index]), + (o = (t = ss(t, s)).atoms[t.index]), o && 'sizeddelim' === o.type && o.delim === i && - ((t.index += 1), (t = es((t = ts(t, s)), s))); + ((t.index += 1), (t = Qi((t = Yi(t, s)), s))); else { if ( 'leftright' !== o.type || @@ -16057,9 +16047,9 @@ var global, factory; ('?' !== o.rightDelim && o.rightDelim !== i) ) return; - (t.ast = rs(o.body, s)), - Qi(t) && (t.ast = { group: t.ast }), - (t = es((t = ts(t, s)), s)); + (t.ast = os(o.body, s)), + Ji(t) && (t.ast = { group: t.ast }), + (t = Qi((t = Yi(t, s)), s)); } return (t.minPrec = a), t; } @@ -16067,15 +16057,15 @@ var global, factory; let s = !0; if ( ('mopen' === o.type - ? ((e = o.latex.trim()), (i = At.RIGHT_DELIM[e])) + ? ((e = o.latex.trim()), (i = wt.RIGHT_DELIM[e])) : 'sizeddelim' === o.type - ? ((e = o.delim), (i = At.RIGHT_DELIM[e])) + ? ((e = o.delim), (i = wt.RIGHT_DELIM[e])) : 'leftright' === o.type ? ((s = !1), (e = o.leftDelim), - '?' === (i = o.rightDelim) && (i = At.RIGHT_DELIM[e])) + '?' === (i = o.rightDelim) && (i = wt.RIGHT_DELIM[e])) : 'textord' === o.type && - ((e = o.latex.trim()), (i = At.RIGHT_DELIM[e])), + ((e = o.latex.trim()), (i = wt.RIGHT_DELIM[e])), e && i) ) { if ('|' === e && '|' === i) { @@ -16085,29 +16075,29 @@ var global, factory; '|' === s.latex && ((e = '\\lVert'), (i = '\\rVert')); } - if ((t = is(t, e, i))) + if ((t = ts(t, e, i))) return ( s && (t.index += 1), - (t.ast = { fn: Bi[e + i] || e + i, arg: [t.ast] }), + (t.ast = { fn: Pi[e + i] || e + i, arg: [t.ast] }), (t.minPrec = a), t ); } } } - function ss(t, e) { + function es(t, e) { return ( (t.index = t.index || 0), !(t.atoms.length <= 1 || t.index >= t.atoms.length - 1) && - e === Ni(t.atoms[t.index]) + Ni(t.atoms[t.index + 1]) + e === Ri(t.atoms[t.index]) + Ri(t.atoms[t.index + 1]) ); } - function as(t) { + function is(t) { if ( ((t.index = t.index || 0), !(t.atoms.length <= 1 || t.index >= t.atoms.length - 1)) ) { - if (!Zi(t, 'textord', '\\nabla')) { + if (!ji(t, 'textord', '\\nabla')) { const e = t.atoms[t.index].latex + t.atoms[t.index + 1].latex, i = /^(>=|<=|>>|<<|:=|!=|\*\*|\+\+|--)$/.test(e) @@ -16117,15 +16107,15 @@ var global, factory; } return ( (t.index += 1), - Zi(t, 'mbin', '\\times') + ji(t, 'mbin', '\\times') ? ((t.index += 1), (t.ast = 'curl'), t) - : Zi(t, 'mbin', '\\cdot') + : ji(t, 'mbin', '\\cdot') ? ((t.index += 1), (t.ast = 'div'), t) : void (t.index -= 1) ); } } - function os(t, e) { + function ss(t, e) { if ( ((t.index = t.index || 0), (t.ast = void 0), @@ -16152,16 +16142,16 @@ var global, factory; (t += e.atoms[e.index].body), (e.index += 1); return (e.ast = { text: t }), e; } - const a = qi(Ni(s)); - if (as(e)) e.ast = Xi(e.ast, t(e, i).ast); + const a = zi(Ri(s)); + if (is(e)) e.ast = Gi(e.ast, t(e, i).ast); else { if ('root' === s.type) return (e.index = 0), (e.atoms = s.body), t(e, i); if ('mbin' === s.type && '-' === a) - (e.index += 1), ((e = t(e, i)).ast = Yi(e.ast)); + (e.index += 1), ((e = t(e, i)).ast = Xi(e.ast)); else if ('mbin' === s.type && '+' === a) (e.index += 1), - ((e = t(e, i)).ast = Xi('add', e.ast)); + ((e = t(e, i)).ast = Gi('add', e.ast)); else if ( 'mord' === s.type && /^[0-9.]$/.test(s.latex) @@ -16173,10 +16163,10 @@ var global, factory; ; e.index < e.atoms.length && !o && - (Zi(e, 'spacing') || - ((Zi(e, 'mord') || - Zi(e, 'mpunct', ',') || - Zi(e, 'mbin')) && + (ji(e, 'spacing') || + ((ji(e, 'mord') || + ji(e, 'mpunct', ',') || + ji(e, 'mbin')) && n.test(e.atoms[e.index].latex))); ) @@ -16192,7 +16182,7 @@ var global, factory; 'd' === t || 'D' === t ? ((t = 'e'), (n = /^[0-9+-.]$/)) : 'e' === t || 'E' === t - ? Qi(e) + ? Ji(e) ? ((t = ''), (e.index -= 1), (o = !0)) @@ -16202,12 +16192,12 @@ var global, factory; (e.index += 1); } if ( - ((e.ast = a ? Ji(a) : void 0), + ((e.ast = a ? Zi(a) : void 0), (s = e.atoms[e.index]), s && 'genfrac' === s.type && !isNaN(e.ast.num)) ) { const s = e.ast; - (e = t(e, i)).ast = Xi('add', s, e.ast); + (e = t(e, i)).ast = Gi('add', s, e.ast); } if ( s && @@ -16216,16 +16206,16 @@ var global, factory; s.latex.startsWith('\\nicefrac') ) { const s = e.ast; - (e = t(e, i)).ast = Xi('add', s, e.ast); + (e = t(e, i)).ast = Gi('add', s, e.ast); } - s && 'msubsup' === s.type && (e = ts(e, i)), - (e = es(e, i)); + s && 'msubsup' === s.type && (e = Yi(e, i)), + (e = Qi(e, i)); } else if ('genfrac' === s.type || 'surd' === s.type) - (e.ast = s.toAST(i)), (e = es((e = ts(e, i)), i)); + (e.ast = s.toAST(i)), (e = Qi((e = Yi(e, i)), i)); else if ('mord' === s.type || 'mbin' === s.type) { - if (Ei(a) && !Ii(s)) { + if (Di(a) && !qi(s)) { e.ast = { fn: a }; - const s = (e = ts(e, i)).ast, + const s = (e = Yi(e, i)).ast, o = t(e, i).ast; o && /^(list0|list|list2)$/.test(o.fn) ? (s.arg = o.arg) @@ -16234,45 +16224,45 @@ var global, factory; } else (e.ast = s.toAST(i)), 'ⅈ' === e.ast.sym && - (e.ast = Ji({ im: '1' })), - (e = ts(e)); - e = es(e, i); + (e.ast = Zi({ im: '1' })), + (e = Yi(e)); + e = Qi(e, i); } else if ('textord' === s.type) { if ( - !Ii(s) && - !At.RIGHT_DELIM[ + !qi(s) && + !wt.RIGHT_DELIM[ s.latex ? s.latex.trim() : s.body ] ) - if (Ei(a)) { + if (Di(a)) { e.ast = { fn: a }; - const s = (e = ts(e, i)).ast; + const s = (e = Yi(e, i)).ast; (e.index += 1), (s.arg = [t(e, i).ast]), (e.ast = s), - (e = es(e, i)); + (e = Qi(e, i)); } else (e.ast = s.toAST(i)), void 0 === s.superscript && (e.index += 1), - (e = es((e = ts(e, i)), i)); + (e = Qi((e = Yi(e, i)), i)); } else if ('mop' === s.type) { if ( (/^\\(mathop|operatorname|operatorname\*)/.test( s.latex ) || - Ei(a)) && - !Ii(s) + Di(a)) && + !qi(s) ) if ( ((e.ast = { fn: /^\\(mathop|operatorname|operatorname\*)/.test( s.latex ) - ? Ni(s.body) + ? Ri(s.body) : a, }), - ji((e = ts(e, i)).ast)) + Vi((e = Yi(e, i)).ast)) ) { const s = { sin: 'arcsin', @@ -16288,8 +16278,8 @@ var global, factory; sech: 'arsech', coth: 'arcoth', }; - if (-1 === Wi(e.ast.sup) && s[a]) - e.ast = Xi(s[a], t(e, i).ast); + if (-1 === Ni(e.ast.sup) && s[a]) + e.ast = Gi(s[a], t(e, i).ast); else { const s = e.ast; (s.arg = [t(e, i).ast]), (e.ast = s); @@ -16317,12 +16307,12 @@ var global, factory; } } if (void 0 === e.ast) { - const t = is(e, '(', ')', i) || is(e, null, null, i); + const t = ts(e, '(', ')', i) || ts(e, null, null, i); t ? (e = t) - : Ii(s) || + : qi(s) || ('placeholder' === s.type - ? (e.ast = Ji(0)) + ? (e.ast = Zi(0)) : ((e.ast = { text: '?' }), (e.ast.error = "Unexpected token '" + s.type + "'"), @@ -16344,33 +16334,33 @@ var global, factory; 'leftright' === s.type)) ) { if ('sizeddelim' === s.type) - for (const t in At.RIGHT_DELIM) - if (s.delim === At.RIGHT_DELIM[t]) + for (const t in wt.RIGHT_DELIM) + if (s.delim === wt.RIGHT_DELIM[t]) return (e.index += 1), e; if ( ('mord' === s.type || 'textord' === s.type || 'mop' === s.type) && - Ii(s) + qi(s) ) return e; const a = e.ast; (e.ast = {}), (e = t(e, i)) && e.ast && a - ? (Ei(a.fn) && void 0 === a.arg) || + ? (Di(a.fn) && void 0 === a.arg) || (Array.isArray(a.arg) && 0 === a.arg.length) ? 'list2' === e.ast.fn || 'list' === e.ast.fn - ? (e.ast = Xi(a.fn, e.ast.arg)) - : (e.ast = Xi('multiply', a, e.ast)) + ? (e.ast = Gi(a.fn, e.ast.arg)) + : (e.ast = Gi('multiply', a, e.ast)) : 'multiply' === e.ast.fn ? e.ast.arg.unshift(a) - : 0 === Ui(a) && - 0 !== Vi(a) && - 1 === Ui(e.ast) && - 0 === Vi(e.ast) - ? (e.ast = Ji({ im: Vi(a).toString() })) - : (e.ast = Xi('multiply', a, e.ast)) + : 0 === Hi(a) && + 0 !== Wi(a) && + 1 === Hi(e.ast) && + 0 === Wi(e.ast) + ? (e.ast = Zi({ im: Wi(a).toString() })) + : (e.ast = Gi('multiply', a, e.ast)) : (e.ast = a); } return e; @@ -16379,14 +16369,14 @@ var global, factory; const a = t.minPrec; for (; !s; ) { const o = t.atoms[t.index], - n = as(t); + n = is(t); let r, l; if ( - ((s = !o || 'text' === o.mode || (!n && !Ii(o))), - s || (([r, l] = n ? [Di(n), zi(n)] : Pi(o)), (s = r < a)), + ((s = !o || 'text' === o.mode || (!n && !qi(o))), + s || (([r, l] = n ? [Li(n), Fi(n)] : Ei(o)), (s = r < a)), !s) ) { - const a = n || qi(Ni(o)); + const a = n || zi(Ri(o)); if ( ((t.minPrec = 'left' === l ? r + 1 : r), (t.index += 1), @@ -16399,12 +16389,12 @@ var global, factory; 'msubsup' === t.atoms[t.index].type) ) { t.ast = {}; - const s = ts(t, e).ast.sub; + const s = Yi(t, e).ast.sub; if ( - ((i = Xi('bind', i)), + ((i = Gi('bind', i)), s && 'equal' === s.fn && i.arg) ) - i.arg.push(Fi(s, 0)), i.arg.push(Fi(s, 1)); + i.arg.push(Ti(s, 0)), i.arg.push(Ti(s, 1)); else if ( s && i.arg && @@ -16413,36 +16403,36 @@ var global, factory; let t = { sym: 'x' }; for (let e = 0; e < s.arg.length; e++) 'equal' === s.arg[e].fn - ? ((t = Fi(s.arg[e], 0)), + ? ((t = Ti(s.arg[e], 0)), i.arg.push(t), - i.arg.push(Fi(s.arg[e], 1))) + i.arg.push(Ti(s.arg[e], 1))) : (i.arg.push(t), i.arg.push(s.arg[e])); } else s && (i.arg.push({ sym: 'x' }), i.arg.push(s)); } else s = !0; else { - const s = os(t, e).ast; - let o = Ki[a]; - o && i && i.fn !== o && (i = Xi(o, i)), + const s = ss(t, e).ast; + let o = Oi[a]; + o && i && i.fn !== o && (i = Gi(o, i)), '-' === a ? i && i.arg && 'add' === i.fn - ? void 0 !== s && i.arg.push(Yi(s)) + ? void 0 !== s && i.arg.push(Xi(s)) : (i = i && 'subtract' === i.fn - ? Xi( + ? Gi( 'add', - Fi(i, 0), - Yi(Fi(i, 1)), - Yi(s) + Ti(i, 0), + Xi(Ti(i, 1)), + Xi(s) ) - : !Hi(i) || - ji(i) || - !Hi(s) || - ji(s) || + : !$i(i) || + Vi(i) || + !$i(s) || + Vi(s) || (void 0 !== s.num.re && '0' !== s.num.re) || void 0 === s.num.im - ? Xi('subtract', i, s) + ? Gi('subtract', i, s) : { num: { re: i.num, @@ -16451,90 +16441,90 @@ var global, factory; )).toString(), }, }) - : ((o = Ri[a]), + : ((o = Bi[a]), 'add' === o && i && 'subtract' === i.fn - ? (i = Xi( + ? (i = Gi( 'add', - Fi(i, 0), - Yi(Fi(i, 1)), + Ti(i, 0), + Xi(Ti(i, 1)), s )) - : o && i && i.fn === o && !ji(i) + : o && i && i.fn === o && !Vi(i) ? void 0 !== s && - (s.fn === o && !ji(s) && s.arg + (s.fn === o && !Vi(s) && s.arg ? (i.arg = [...i.arg, ...s.arg]) : i.arg && i.arg.push(s)) : o && s && s.arg && s.fn === o ? (s.arg.unshift(i), (i = s)) : (i = 'multiply' === o && - Hi(i) && - !ji(i) && + $i(i) && + !Vi(i) && s && - 10 === Wi(s) && - Hi(s.sup) - ? Ji( - Wi(i) * + 10 === Ni(s) && + $i(s.sup) + ? Zi( + Ni(i) * Math.pow( 10, - Wi(s.sup) + Ni(s.sup) ) ) : 'add' === o && - Hi(i) && - !ji(i) && + $i(i) && + !Vi(i) && s && - 0 !== Ui(s) && - !ji(s) + 0 !== Hi(s) && + !Vi(s) ? { num: { re: i.num, im: s.num.im, }, } - : Xi(o || _i[a] || a, i, s))); + : Gi(o || Mi[a] || a, i, s))); } } } return (t.ast = i), t; } - function ns(t) { + function as(t) { if (!t) return []; let e; if (Array.isArray(t)) { e = []; for (const i of t) { - const t = ns(i); + const t = as(i); e = e.concat(t); } } else { if ('spacing' === t.type) return []; 'first' === t.type || 'box' === t.type - ? (e = ns(t.body)) - : (t.body && Array.isArray(t.body) && (t.body = ns(t.body)), + ? (e = as(t.body)) + : (t.body && Array.isArray(t.body) && (t.body = as(t.body)), t.superscript && Array.isArray(t.superscript) && - (t.superscript = ns(t.superscript)), + (t.superscript = as(t.superscript)), t.subscript && Array.isArray(t.subscript) && - (t.subscript = ns(t.subscript)), + (t.subscript = as(t.subscript)), t.index && Array.isArray(t.index) && - (t.index = ns(t.index)), + (t.index = as(t.index)), t.denom && Array.isArray(t.denom) && - (t.denom = ns(t.denom)), + (t.denom = as(t.denom)), t.numer && Array.isArray(t.numer) && - (t.numer = ns(t.numer)), + (t.numer = as(t.numer)), t.array && Array.isArray(t.array) && - (t.array = t.array.map(t => t.map(t => ns(t)))), + (t.array = t.array.map(t => t.map(t => as(t)))), (e = [t])); } return e; } - function rs(t, e) { + function os(t, e) { return (function(t, e) { (t.index = t.index || 0), (t.ast = void 0); const i = []; @@ -16550,14 +16540,14 @@ var global, factory; (e += t.atoms[t.index].body), (t.index += 1); i.push(e); } else { - const s = os(t, e).ast; + const s = ss(t, e).ast; if (!s) return; i.push(s); } - return i.length > 1 ? Xi('text', ...i) : i[0] || void 0; - })({ atoms: ns(t) }, e); + return i.length > 1 ? Gi('text', ...i) : i[0] || void 0; + })({ atoms: as(t) }, e); } - function ls(t) { + function ns(t) { const e = Array.prototype.slice.call(arguments); e.shift(), (t = t || '.. '); let i = ''; @@ -16569,7 +16559,7 @@ var global, factory; } return i; } - function cs(t, e) { + function rs(t, e) { const i = t.length; t = t.substr(0, e.precision - 2); for (let i = 0; i < t.length - 16; i++) { @@ -16594,10 +16584,10 @@ var global, factory; t.replace(/(\d{3})/g, '$1' + e.groupSeparator) ); } - function hs(t) { + function ls(t) { return parseFloat(parseFloat(t).toPrecision(15)); } - function ds(t, e) { + function cs(t, e) { let i = ''; if ('number' == typeof e.precision) { if ('number' != typeof t) { @@ -16622,11 +16612,11 @@ var global, factory; if (s <= 4) (a = '0' + e.decimalMarker), (a += n.substr(0, s)), - (a += cs(t.substr(a.length), e)); + (a += rs(t.substr(a.length), e)); else if (s + 1 >= e.precision) (a = '0'), (i = ''); else { a = t[s]; - const i = cs(t.substr(s + 1), e); + const i = rs(t.substr(s + 1), e); i && (a += e.decimalMarker + i); } '0' !== a && @@ -16650,13 +16640,13 @@ var global, factory; /\B(?=(\d{3})+(?!\d))/g, e.groupSeparator ); - const i = cs(n, e); + const i = rs(n, e); i && (t += e.decimalMarker + i); } } else if (t.length > e.precision) { const i = t.length; let s = t[0]; - const a = cs(t.substr(2), e); + const a = rs(t.substr(2), e); a && ((s += e.decimalMarker + a), '}' !== s[s.length - 1] && (s += '\\ldots')), @@ -16678,7 +16668,7 @@ var global, factory; i + t + s ); } - t = hs(t); + t = ls(t); } if ('engineering' === e.scientificNotation) if (0 === t) i = '0'; @@ -16689,7 +16679,7 @@ var global, factory; let o = s / Math.pow(10, a); const n = o.toString().match(/^(.*)\.(.*)$/); n && n[1] && n[2] && (o = n[1] + e.decimalMarker + n[2]), - e.groupSeparator && (o = cs(o.toExponential(), e)), + e.groupSeparator && (o = rs(o.toExponential(), e)), (a = 0 === a ? '' @@ -16720,13 +16710,13 @@ var global, factory; /\B(?=(\d{3})+(?!\d))/g, e.groupSeparator )), - (n = cs(n, e))), + (n = rs(n, e))), n && (n = e.decimalMarker + n), (i = a + n + (o || '')); } return i; } - (te.MathAtom.prototype.toAST = function(t) { + (Yt.MathAtom.prototype.toAST = function(t) { let e, i, s, @@ -16757,7 +16747,7 @@ var global, factory; 1 === e[1].length ? e[1] : e[1].substr(1, e[1].length - 2)), - (i = he.parseTokens( + (i = le.parseTokens( n(i), 'math', null, @@ -16767,35 +16757,35 @@ var global, factory; 1 === e[2].length ? e[2] : e[2].substr(1, e[2].length - 2)), - (s = he.parseTokens( + (s = le.parseTokens( n(s), 'math', null, t.macros )), - (o = Xi('divide', rs(i, t), rs(s, t)))) + (o = Gi('divide', os(i, t), os(s, t)))) : (o.fn = 'divide')) - : (o.group = rs(this.body, t)); + : (o.group = os(this.body, t)); break; case 'genfrac': - o = Xi( + o = Gi( 'divide', - rs(this.numer, t), + os(this.numer, t), this.denom && this.denom[0] && 'placeholder' === this.denom[0].type - ? Ji(1) - : rs(this.denom, t) + ? Zi(1) + : os(this.denom, t) ); break; case 'surd': o = this.index - ? Xi( + ? Gi( 'pow', - rs(this.body, t), - Xi('divide', 1, rs(this.index, t)) + os(this.body, t), + Gi('divide', 1, os(this.index, t)) ) - : Xi('sqrt', rs(this.body, t)); + : Gi('sqrt', os(this.body, t)); break; case 'rule': break; @@ -16812,12 +16802,13 @@ var global, factory; : void 0), e ? (r = String.fromCodePoint(parseInt(e[1], 16))) - : ((r = qi(Ni(this))), + : ((r = zi(Ri(this))), r.length > 0 && '\\' === r.charAt(0) && 'string' == typeof this.body && (r = this.body)), - (a = At.mathVariantToUnicode(r, l, c) + (a = wt + .mathVariantToUnicode(r, l, c) .replace(/[\\]/g, '\\\\') .replace(/["]/g, '\\"') .replace(/[\b]/g, '\\b') @@ -16833,26 +16824,26 @@ var global, factory; case 'mop': break; case 'box': - o = rs(this.body, t); + o = os(this.body, t); break; case 'enclose': break; case 'array': if ('cardinality' === this.env.name) - o = Xi('card', rs(this.array, t)); + o = Gi('card', os(this.array, t)); else if ( /array|matrix|pmatrix|bmatrix/.test(this.env.name) ) { o = { fn: 'array', args: [] }; for (const e of this.array) - o.args.push(e.map(e => rs(e, t))); + o.args.push(e.map(e => os(e, t))); } else if ('cases' === this.env.name) { o = { fn: 'cases', args: [] }; for (const e of this.array) if (e[0]) { const i = []; - i.push(rs(e[0], t)); - let s = rs(e[1], t); + i.push(os(e[0], t)); + let s = os(e[1], t); s && 'text' === s.fn && s.arg && @@ -16881,10 +16872,10 @@ var global, factory; o ); }), - (te.toAST = function(t, e) { - return rs(t, e); + (Yt.toAST = function(t, e) { + return os(t, e); }); - var ps = function t(e, i) { + var hs = function t(e, i) { const s = Object.assign( { precision: 14, @@ -16904,64 +16895,64 @@ var global, factory; if (void 0 === e) return ''; if (('string' == typeof e && (e = JSON.parse(e)), e.latex)) a = e.latex; - else if (Hi(e)) { - const i = Wi(e); + else if ($i(e)) { + const i = Ni(e); if (i === -1 / 0) a = '-\\infty '; else if (i === 1 / 0) a = '\\infty '; else if ( 'object' != typeof e.num || ('string' != typeof e.num.re && 'string' != typeof e.num.im) ) - a = isNaN(i) ? '\\text{NaN}' : ds(e.num, s); + a = isNaN(i) ? '\\text{NaN}' : cs(e.num, s); else { - const t = Vi(e), - i = Ui(e); + const t = Wi(e), + i = Hi(e); isNaN(t) || isNaN(i) ? (a = '\\text{NaN}') : Math.abs(i) <= Number.EPSILON && Math.abs(t) <= Number.EPSILON ? (a = '0') - : (Math.abs(t) > Number.EPSILON && (a = ds(t, s)), + : (Math.abs(t) > Number.EPSILON && (a = cs(t, s)), Math.abs(i) > Number.EPSILON && (Math.abs(t) > Number.EPSILON && (a += i > 0 ? '+' : ''), (a += - (1 !== Math.abs(i) ? ds(i, s) : '') + + (1 !== Math.abs(i) ? cs(i, s) : '') + '\\imaginaryI '))); } - ji(e) && (a += '^{' + t(e.sup, s) + '}'), - Gi(e) && (a += '_{' + t(e.sub, s) + '}'); + Vi(e) && (a += '^{' + t(e.sup, s) + '}'), + Ui(e) && (a += '_{' + t(e.sub, s) + '}'); } else if (e.group) (a = t(e.group, s)), - Hi(e.group) || $i(e.group) - ? 0 !== Ui(e.group) && (a = ls(e.fence || '(),', a)) - : (a = ls(e.fence || '(),', a)), - ji(e) && (a += '^{' + t(e.sup, s) + '}'), - Gi(e) && (a += '_{' + t(e.sub, s) + '}'); + $i(e.group) || Ki(e.group) + ? 0 !== Hi(e.group) && (a = ns(e.fence || '(),', a)) + : (a = ns(e.fence || '(),', a)), + Vi(e) && (a += '^{' + t(e.sup, s) + '}'), + Ui(e) && (a += '_{' + t(e.sub, s) + '}'); else if (e.fn) if ('bind' === e.fn) { if ( - ((a = t(Fi(e, 0), s) + '|_{'), + ((a = t(Ti(e, 0), s) + '|_{'), e.arg && 2 === e.arg.length) ) - a += t(Fi(e, 1)); + a += t(Ti(e, 1)); else { let i = ''; for (let s = 1; s < e.arg.length; s += 2) - (a += i + t(Fi(e, s)) + ' = ' + t(Fi(e, s + 1))), + (a += i + t(Ti(e, s)) + ' = ' + t(Ti(e, s + 1))), (i = ', '); } a += '}'; } else if ('divide' === e.fn) a = '\\frac{' + - t(Fi(e, 0), s) + + t(Ti(e, 0), s) + '}{' + - t(Fi(e, 1), s) + + t(Ti(e, 1), s) + '}'; - else if ('negate' === e.fn) a = '-' + t(Fi(e, 0), s); + else if ('negate' === e.fn) a = '-' + t(Ti(e, 0), s); else if ('subtract' === e.fn) - a = t(Fi(e, 0), s) + ' - ' + t(Fi(e, 1), s); + a = t(Ti(e, 0), s) + ' - ' + t(Ti(e, 1), s); else if ( ('add' !== e.fn && 'multiply' !== e.fn) || !Array.isArray(e.arg) @@ -16975,16 +16966,16 @@ var global, factory; Array.isArray(e.arg) && e.arg.length >= 2 ) - (a = t(Fi(e, 0), s)), - Hi(Fi(e, 0)) || - $i(Fi(e, 0)) || - (a = ls(e.fence || '(),', a)), - (a += '^{' + t(Fi(e, 1), s) + '}'); + (a = t(Ti(e, 0), s)), + $i(Ti(e, 0)) || + Ki(Ti(e, 0)) || + (a = ns(e.fence || '(),', a)), + (a += '^{' + t(Ti(e, 1), s) + '}'); else if ('equal' === e.fn && e.arg && e.arg.length > 2) a = e.arg.map(e => t(e, s)).join(' = '); else { const i = (function(t) { - let e = Ti[t]; + let e = Ci[t]; return ( e || (e = @@ -17001,28 +16992,28 @@ var global, factory; Array.isArray(e.arg) && e.arg.length > 1 ) - a += ls( + a += ns( e.fence || '(),', ...e.arg.map(e => t(e, s)) ); else if (Array.isArray(e.arg) && e.arg.length > 0) { - const n = t(Fi(e, 0), s), - r = t(Fi(e, 1), s), + const n = t(Ti(e, 0), s), + r = t(Ti(e, 1), s), l = [...e.arg]; /%0/.test(i) && ((a = a.replace('%0', n)), l.shift()), /%1/.test(i) && ((a = a.replace('%1', r)), l.shift()), l.length > 0 && - (o = ls( + (o = ns( e.fence || '(),', ...l.map(e => t(e, s)) )); - } else o = ls(e.fence || '(),', ''); - (a = ji(e) + } else o = ns(e.fence || '(),', ''); + (a = Vi(e) ? a.replace('%^', '^{' + t(e.sup, s) + '}') : a.replace('%^', '')), - (a = Gi(e) + (a = Ui(e) ? a.replace('%_', '_{' + t(e.sub, s) + '}') : a.replace('%_', '')), (a = a.replace(/%(?![01_^])/, o)), @@ -17032,38 +17023,38 @@ var global, factory; const i = []; for (const a of e.arg) 'add' === a.fn || 'subtract' === a.fn - ? i.push(ls('() ', t(a, s))) - : 0 !== Vi((o = a)) && 0 !== Ui(o) - ? i.push(ls('() ', t(a, s))) - : ji(e) && 0 !== Ui(a) && 1 !== Ui(a) - ? i.push(ls('() ', t(a, s))) + ? i.push(ns('() ', t(a, s))) + : 0 !== Wi((o = a)) && 0 !== Hi(o) + ? i.push(ns('() ', t(a, s))) + : Vi(e) && 0 !== Hi(a) && 1 !== Hi(a) + ? i.push(ns('() ', t(a, s))) : i.push(t(a, s)); if ('multiply' === e.fn) a = !e.arg || 2 !== e.arg.length || - (!Hi(e.arg[0]) && 'divide' !== e.arg[0].fn) || - (Hi(e.arg[1]) && - (0 !== Vi(e.arg[1]) || 1 !== Ui(e.arg[1]))) + (!$i(e.arg[0]) && 'divide' !== e.arg[0].fn) || + ($i(e.arg[1]) && + (0 !== Wi(e.arg[1]) || 1 !== Hi(e.arg[1]))) ? i.join(' \\times ') : i[0] + i[1]; else if (e.arg && 1 === e.arg.length) a = 'negate' === e.arg[0].fn || - (Hi(e.arg[0]) && Wi(e.arg[0]) < 0) + ($i(e.arg[0]) && Ni(e.arg[0]) < 0) ? i[0] : '+' + i[0]; else { a = i[0]; for (let t = 1; t < e.arg.length; t++) 'negate' === e.arg[t].fn || - (Hi(e.arg[t]) && Wi(e.arg[t]) < 0) + ($i(e.arg[t]) && Ni(e.arg[t]) < 0) ? (a += i[t]) : (a += ' + ' + i[t]); } } else if ('string' == typeof e.sym) { - a = $i(e); + a = Ki(e); let i = a.match(/^&#x([0-9a-f]+);$/i); i && i[1] ? (a = String.fromCodePoint(parseInt(i[1], 16))) @@ -17084,8 +17075,8 @@ var global, factory; '{' + a + '}'), - ji(e) && (a += '^{' + t(e.sup, s) + '}'), - Gi(e) && (a += '_{' + t(e.sub, s) + '}'); + Vi(e) && (a += '^{' + t(e.sup, s) + '}'), + Ui(e) && (a += '_{' + t(e.sub, s) + '}'); } else 'string' == typeof e.text && (a = '\\text{' + e.text + '}'); var o; return ( @@ -17094,7 +17085,7 @@ var global, factory; a ); }; - const ms = { + const ds = { '\\alpha': 'alpha ', '\\mu': 'mew ', '\\sigma': 'sigma ', @@ -17182,13 +17173,13 @@ var global, factory; km: 'kilometers', kg: 'kilograms', }; - function us(t) { + function ps(t) { let e = 0; if (t && Array.isArray(t)) for (const i of t) 'first' !== i.type && (e += 1); return 1 === e; } - function fs(t) { + function ms(t) { let e = ''; if (t && Array.isArray(t)) for (const i of t) @@ -17197,7 +17188,7 @@ var global, factory; (e += i.body); return e; } - function gs(t, e, i, s) { + function us(t, e, i, s) { e = e.split(' '); for (const a of e) { const e = a.match(/(.*):(.*)/); @@ -17208,7 +17199,7 @@ var global, factory; } else t.addEventListener(a, i, s); } } - function ys(t, e, i, s) { + function fs(t, e, i, s) { e = e.split(' '); for (const a of e) { const e = a.match(/(.*):(.*)/); @@ -17219,7 +17210,7 @@ var global, factory; } else t.removeEventListener(a, i, s); } } - function bs(t, e) { + function gs(t, e) { let i = document.getElementById(t); return ( i @@ -17236,7 +17227,7 @@ var global, factory; i ); } - function xs(t) { + function ys(t) { if (!t) return null; const e = parseInt(t.getAttribute('data-refcount')); return ( @@ -17246,10 +17237,10 @@ var global, factory; t ); } - function ks(t) { + function bs(t) { return t.element && t.element.mathfield === t; } - (te.toSpeakableFragment = function(t, e) { + (Yt.toSpeakableFragment = function(t, e) { function i(t) { return '' + t + ''; } @@ -17270,21 +17261,21 @@ var global, factory; 'mclose' === t[n + 2].type && 'mord' === t[n + 1].type ? ((s += ' of '), - (s += i(te.toSpeakableFragment(t[n + 1], e))), + (s += i(Yt.toSpeakableFragment(t[n + 1], e))), (n += 2)) : 'text' === t[n].mode ? o ? (s += t[n].body ? t[n].body : ' ') : ((o = !0), - (s += te.toSpeakableFragment(t[n], e))) + (s += Yt.toSpeakableFragment(t[n], e))) : 'mord' === t[n].type && /[0123456789,.]/.test(t[n].body) ? a ? (s += t[n].body) : ((a = !0), - (s += te.toSpeakableFragment(t[n], e))) + (s += Yt.toSpeakableFragment(t[n], e))) : ((a = !1), - (s += te.toSpeakableFragment(t[n], e))); + (s += Yt.toSpeakableFragment(t[n], e))); } else if ('text' === t.mode) s += t.body; else { let a = '', @@ -17294,13 +17285,13 @@ var global, factory; switch (t.type) { case 'group': case 'root': - s += te.toSpeakableFragment(t.body, e); + s += Yt.toSpeakableFragment(t.body, e); break; case 'genfrac': if ( - ((a = te.toSpeakableFragment(t.numer, e)), - (o = te.toSpeakableFragment(t.denom, e)), - us(t.numer) && us(t.denom)) + ((a = Yt.toSpeakableFragment(t.numer, e)), + (o = Yt.toSpeakableFragment(t.denom, e)), + ps(t.numer) && ps(t.denom)) ) { const e = { '1/2': ' half ', @@ -17324,7 +17315,7 @@ var global, factory; '5/9': ' five ninths ', '7/9': ' seven ninths ', '8/9': ' eight ninths ', - }[fs(t.numer) + '/' + fs(t.denom)]; + }[ms(t.numer) + '/' + ms(t.denom)]; e ? (s = e) : (s += a + ' over ' + o); } else s += @@ -17336,9 +17327,9 @@ var global, factory; break; case 'surd': if ( - ((n = te.toSpeakableFragment(t.body, e)), t.index) + ((n = Yt.toSpeakableFragment(t.body, e)), t.index) ) { - let i = te.toSpeakableFragment(t.index, e); + let i = Yt.toSpeakableFragment(t.index, e); i = i.trim(); const a = i.replace(//g, ''); s += @@ -17356,7 +17347,7 @@ var global, factory; n + '. End root'; } else - us(t.body) + ps(t.body) ? (s += ' the square root of ' + n + ' , ') : (s += ' the square root of ' + @@ -17366,9 +17357,9 @@ var global, factory; case 'accent': break; case 'leftright': - (s += ms[t.leftDelim] || t.leftDelim), - (s += te.toSpeakableFragment(t.body, e)), - (s += ms[t.rightDelim] || t.rightDelim); + (s += ds[t.leftDelim] || t.leftDelim), + (s += Yt.toSpeakableFragment(t.body, e)), + (s += ds[t.rightDelim] || t.rightDelim); break; case 'line': case 'rule': @@ -17398,7 +17389,7 @@ var global, factory; '\\mathord' === i || '\\mathinner' === i ) { - s = te.toSpeakableFragment(t.body, e); + s = Yt.toSpeakableFragment(t.body, e); break; } let a = t.body, @@ -17415,12 +17406,12 @@ var global, factory; (s += ''), a) ) { - const t = ms[a] || (o ? ms[o.trim()] : ''); + const t = ds[a] || (o ? ds[o.trim()] : ''); if (t) s += ' ' + t; else { const t = o ? (function(t) { - let e = Je.NOTES[t]; + let e = Ze.NOTES[t]; return ( e || '\\' !== t.charAt(0) || @@ -17465,7 +17456,7 @@ var global, factory; ); })(a); } - } else s += te.toSpeakableFragment(t.body, e); + } else s += Yt.toSpeakableFragment(t.body, e); 'mbin' === t.type && (s += ''); } break; @@ -17475,12 +17466,12 @@ var global, factory; const a = t.latex ? t.latex.trim() : ''; if ('\\sum' === a) if (t.superscript && t.subscript) { - let i = te.toSpeakableFragment( + let i = Yt.toSpeakableFragment( t.superscript, e ); i = i.trim(); - let a = te.toSpeakableFragment( + let a = Yt.toSpeakableFragment( t.subscript, e ); @@ -17493,7 +17484,7 @@ var global, factory; ' of '), (r = !0); } else if (t.subscript) { - let i = te.toSpeakableFragment( + let i = Yt.toSpeakableFragment( t.subscript, e ); @@ -17506,12 +17497,12 @@ var global, factory; } else s += ' the summation of'; else if ('\\prod' === a) if (t.superscript && t.subscript) { - let i = te.toSpeakableFragment( + let i = Yt.toSpeakableFragment( t.superscript, e ); i = i.trim(); - let a = te.toSpeakableFragment( + let a = Yt.toSpeakableFragment( t.subscript, e ); @@ -17524,7 +17515,7 @@ var global, factory; ' of '), (r = !0); } else if (t.subscript) { - let i = te.toSpeakableFragment( + let i = Yt.toSpeakableFragment( t.subscript, e ); @@ -17537,12 +17528,12 @@ var global, factory; } else s += ' the product of '; else if ('\\int' === a) if (t.superscript && t.subscript) { - let a = te.toSpeakableFragment( + let a = Yt.toSpeakableFragment( t.superscript, e ); a = a.trim(); - let o = te.toSpeakableFragment( + let o = Yt.toSpeakableFragment( t.subscript, e ); @@ -17559,8 +17550,8 @@ var global, factory; ' the integral of '; else if ('string' == typeof t.body) { s += - ms[t.body] || - ms[t.latex.trim()] || + ds[t.body] || + ds[t.latex.trim()] || ' ' + t.body; } else t.latex && @@ -17571,17 +17562,17 @@ var global, factory; } break; case 'enclose': - (n = te.toSpeakableFragment(t.body, e)), - us(t.body) + (n = Yt.toSpeakableFragment(t.body, e)), + ps(t.body) ? (s += ' crossed out ' + n + ' , ') : (s += ' crossed out ' + n + '. End cross out'); } if (!r && t.superscript) { - let i = te.toSpeakableFragment(t.superscript, e); + let i = Yt.toSpeakableFragment(t.superscript, e); i = i.trim(); const a = i.replace(/<[^>]*>/g, ''); - if (us(t.superscript)) { + if (ps(t.superscript)) { if ('math' === e.speechMode) { const e = (function(t) { if (t && Array.isArray(t)) @@ -17613,16 +17604,16 @@ var global, factory; ' power; '); } if (!r && t.subscript) { - let i = te.toSpeakableFragment(t.subscript, e); + let i = Yt.toSpeakableFragment(t.subscript, e); (i = i.trim()), - us(t.subscript) + ps(t.subscript) ? (s += ' sub ' + i) : (s += ' subscript ' + i + '. End subscript. '); } } return s; }), - (te.toSpeakableText = function(t, e) { + (Yt.toSpeakableText = function(t, e) { const i = e ? JSON.parse(JSON.stringify(e)) : { textToSpeechMarkup: '', textToSpeechRules: 'mathlive' }; @@ -17631,7 +17622,7 @@ var global, factory; window.sre && 'sre' === i.textToSpeechRules) ) { i.generateID = !0; - const e = te.toMathML(t, i); + const e = Yt.toMathML(t, i); return e ? (i.textToSpeechMarkup && ((i.textToSpeechRulesOptions = @@ -17650,7 +17641,7 @@ var global, factory; window.sre.System.getInstance().toSpeech(e)) : ''; } - let s = te.toSpeakableFragment(t, i); + let s = Yt.toSpeakableFragment(t, i); if ('ssml' === i.textToSpeechMarkup) { let t = ''; i.speechEngineRate && @@ -17710,7 +17701,7 @@ var global, factory; : s.replace(/<[^>]*>/g, '').replace(/\s{2,}/g, ' '); return s; }); - class vs { + class xs { constructor(t, e) { this.$setConfig(e || {}), (this.element = t), @@ -17737,7 +17728,7 @@ var global, factory; ? 'onfocus' : 'off'), 'manual' === this.config.virtualKeyboardMode - ? ((s += `"):s+="",s+="",s+='\n
\n \n \n
\n ',this.element.innerHTML=s;let a=0;"function"==typeof this.config.substituteTextArea?this.textarea=this.config.substituteTextArea():this.textarea=this.element.children[a++].firstElementChild,this.field=this.element.children[a].children[0],this.field.addEventListener("wheel",t=>{t.preventDefault(),t.stopPropagation();let e=void 0===t.deltaX?t.detail:-t.deltaX;isFinite(e)||(e=t.wheelDelta/10),this.field.scroll({top:0,left:this.field.scrollLeft-5*e})},{passive:!1}),this.virtualKeyboardToggleDOMNode=this.element.children[a++].children[1],this._attachButtonHandlers(this.virtualKeyboardToggleDOMNode,{default:"toggleVirtualKeyboard",alt:"toggleVirtualKeyboardAlt",shift:"toggleVirtualKeyboardShift"}),this.ariaLiveText=this.element.children[a].children[0],this.accessibleNode=this.element.children[a++].children[1],this.popover=gs("mathlive-popover-panel","ML__popover"),this.keystrokeCaption=gs("mathlive-keystroke-caption-panel","ML__keystroke-caption"),this.keystrokeCaptionVisible=!1,this.virtualKeyboardVisible=!1,this.keystrokeBuffer="",this.keystrokeBufferStates=[],this.keystrokeBufferResetTimer=null,this.suggestionIndex=0,this.mode=e.defaultMode||"math",this.smartModeSuppressed=!1,this.style={},this.blurred=!0,us(this.element,"focus",this),us(this.element,"blur",this),us(this.textarea,"cut",this),us(this.textarea,"copy",this),us(this.textarea,"paste",this),$e.delegateKeyboardEvents(this.textarea,{container:this.element,allowDeadKey:()=>"text"===this.mode,typedText:this._onTypedText.bind(this),paste:this._onPaste.bind(this),keystroke:this._onKeystroke.bind(this),focus:this._onFocus.bind(this),blur:this._onBlur.bind(this)}),window.PointerEvent?us(this.field,"pointerdown",this):us(this.field,"touchstart:active mousedown",this),us(window,"resize",this);const o={...e};o.onSelectionDidChange=xs.prototype._onSelectionDidChange.bind(this),o.onContentDidChange=xs.prototype._onContentDidChange.bind(this),o.onAnnounce=this.config.onAnnounce,o.macros=this.config.macros,o.removeExtraneousParentheses=this.config.removeExtraneousParentheses,this.mathlist=new Pe.EditableMathlist(o,this),this.undoManager=new class{constructor(t){this.mathlist=t,this.maximumDepth=1e3,this.record=!1,this.canCoalesce=!1,this.reset()}reset(){this.stack=[],this.index=-1}startRecording(){this.record=!0}canUndo(){return this.index>0}canRedo(){return this.index!==this.stack.length-1}undo(t){this.canUndo()&&(t&&"function"==typeof t.onUndoStateWillChange&&t.onUndoStateWillChange(this.mathlist.target,"undo"),this.restore(this.stack[this.index-1],t),this.index-=1,t&&"function"==typeof t.onUndoStateDidChange&&t.onUndoStateDidChange(this.mathlist.target,"undo"),this.canCoalesce=!1)}redo(t){this.canRedo()&&(t&&"function"===t.onUndoStateWillChange&&t.onUndoStateWillChange(this.mathlist.target,"redo"),this.index+=1,this.restore(this.stack[this.index],t),t&&"function"==typeof t.onUndoStateDidChange&&t.onUndoStateDidChange(this.mathlist.target,"redo"),this.canCoalesce=!1)}pop(){this.canUndo()&&(this.index-=1,this.stack.pop())}snapshot(t){this.record&&(t&&"function"===t.onUndoStateWillChange&&t.onUndoStateWillChange(this.mathlist.target,"snapshot"),this.stack.splice(this.index+1,this.stack.length-this.index-1),this.stack.push({latex:this.mathlist.root.toLatex(),selection:this.mathlist.toString()}),this.index++,this.stack.length>this.maximumDepth&&this.stack.shift(),t&&"function"==typeof t.onUndoStateDidChange&&t.onUndoStateDidChange(this.mathlist.target,"snapshot"),this.canCoalesce=!1)}snapshotAndCoalesce(t){this.canCoalesce&&this.pop(),this.snapshot(t),this.canCoalesce=!0}save(){return{latex:this.mathlist.root.toLatex(),selection:this.mathlist.toString()}}restore(t,e){const i=this.mathlist.suppressChangeNotifications;void 0!==e.suppressChangeNotifications&&(this.mathlist.suppressChangeNotifications=e.suppressChangeNotifications),this.mathlist.insert(t?t.latex:"",{mode:"math",insertionMode:"replaceAll",selectionMode:"after",format:"latex",...e}),this.mathlist.setPath(t?t.selection:[{relation:"body",offset:0}]),this.mathlist.suppressChangeNotifications=i}}(this.mathlist),i.length>0&&this.$latex(i),this.undoManager.startRecording(),this.undoManager.snapshot(this.config)}handleEvent(t){switch(t.type){case"focus":this._onFocus(t);break;case"blur":this._onBlur(t);break;case"touchstart":case"mousedown":case"pointerdown":this._onPointerDown(t);break;case"resize":this._resizeTimer&&window.cancelAnimationFrame(this._resizeTimer),this._resizeTimer=window.requestAnimationFrame(()=>bs(this)&&this._onResize());break;case"cut":this._onCut(t);break;case"copy":this._onCopy(t);break;case"paste":this._onPaste(t)}}$revertToOriginalContent(){this.element.innerHTML=this.originalContent,this.element.mathfield=null,delete this.accessibleNode,delete this.ariaLiveText,delete this.field,fs(this.textarea,"cut",this),fs(this.textarea,"copy",this),fs(this.textarea,"paste",this),this.textarea.remove(),delete this.textarea,this.virtualKeyboardToggleDOMNode.remove(),delete this.virtualKeyboardToggleDOMNode,ys(this.popover),ys(this.keystrokeCaption),ys(this.virtualKeyboard),ys(document.getElementById("mathlive-alternate-keys-panel")),fs(this.element,"pointerdown",this),fs(this.element,"touchstart:active mousedown",this),fs(this.element,"focus",this),fs(this.element,"blur",this),fs(window,"resize",this),delete this.element}_resetKeystrokeBuffer(){this.keystrokeBuffer="",this.keystrokeBufferStates=[],clearTimeout(this.keystrokeBufferResetTimer)}_getCaretPosition(){const t=function t(e){if(e.classList.contains("ML__caret")||e.classList.contains("ML__text-caret")||e.classList.contains("ML__command-caret"))return e;let i;return Array.from(e.children).forEach((function(e){i=i||t(e)})),i}(this.field);if(t){const e=t.getBoundingClientRect();return{x:e.right,y:e.bottom,height:e.height}}return null}_getSelectionBounds(){const t=this.field.querySelectorAll(".ML__selected");if(t&&t.length>0){const e={top:1/0,bottom:-1/0,left:1/0,right:-1/0};t.forEach(t=>{const i=t.getBoundingClientRect();i.lefte.right&&(e.right=i.right),i.bottom>e.bottom&&(e.bottom=i.bottom),i.top=t.left&&i<=t.right}return o&&e.children&&Array.from(e.children).forEach((function(e){const o=t(e,i,s);o.element&&o.distance<=a.distance&&(a=o)})),a}(this.field,t,e).element,o=a?a.getAttribute("data-atom-id"):null;if(o){const e=this.mathlist.filter((function(t,e){return e.captureSelection?e.filter(t=>t.id===o).length>0:e.id===o}));if(e&&e.length>0)if(s=de.pathFromString(e[0]).path,0===i.bias){const e=a.getBoundingClientRect();tt.parentNode.removeChild(t)),t.preventDefault(),t.stopPropagation()}let r=!1,l=!1;const c=setInterval(()=>{r?e.field.scroll({top:0,left:e.field.scrollLeft-16}):l&&e.field.scroll({top:0,left:e.field.scrollLeft+16})},32);function h(t){const s=t.touches?t.touches[0].clientX:t.clientX,o=t.touches?t.touches[0].clientY:t.clientY,n="touch"===t.pointerType?20:5;if(Date.now()c.right,r=s=u.left&&d<=u.right&&p>=u.top&&p<=u.bottom){if(this.$hasFocus()||(o=!0,this.textarea.focus&&this.textarea.focus()),this._resetKeystrokeBuffer(),this.smartModeSuppressed=!1,i=this._pathFromPoint(d,p,{bias:0}),i){let r=document.createElement("div");r.className="ML__scroller",this.element.appendChild(r),r.style.left=u.left-200+"px",r=document.createElement("div"),r.className="ML__scroller",this.element.appendChild(r),r.style.left=u.right+"px",t.shiftKey?(this.mathlist.setRange(this.mathlist.path,i),i=de.clone(this.mathlist.path),i[i.length-1].offset-=1):this.mathlist.setPath(i,0),o=!0,this.style={},3===t.detail||vs>2?(n(t),3!==t.detail&&3!==vs||this.mathlist.selectAll_()):s||(s=!0,window.PointerEvent?(us(e.field,"pointermove",h),us(e.field,"pointerend pointercancel pointerup",n),e.field.setPointerCapture(t.pointerId)):(us(window,"blur",n),t.touches?(us(t.target,"touchmove",h),us(t.target,"touchend",n)):(us(window,"mousemove",h),us(window,"mouseup",n))),2!==t.detail&&2!==vs||(a=!0,this.mathlist.selectGroup_()))}}else ks=null;o&&this._requestUpdate(),t.preventDefault()}_onSelectionDidChange(){this.mathlist.commitCommandStringBeforeInsertionPoint();let t="";this.mathlist.forEachSelected(e=>{t+=e.toLatex()}),t?(this.textarea.value=t,this.$hasFocus()&&this.textarea.select&&this.textarea.select()):(this.textarea.value="",this.textarea.setAttribute("aria-label",""));{const t=this.mode;this.mode=this.mathlist.anchorMode()||this.config.defaultMode,this.mode!==t&&"function"==typeof this.config.onModeChange&&this.config.onModeChange(this,this.mode),"command"===t&&"command"!==this.mode&&(Ze.hidePopover(this),this.mathlist.removeCommandString())}Ze.updatePopoverPosition(this,{deferred:!0}),"function"==typeof this.config.onSelectionDidChange&&this.config.onSelectionDidChange(this),this.removeIsolatedSpace_(),this.mathlist.contentDidChange()}_onContentDidChange(){this.undoManager.canRedo()?this.element.classList.add("can-redo"):this.element.classList.remove("can-redo"),this.undoManager.canUndo()?this.element.classList.add("can-undo"):this.element.classList.remove("can-undo"),"function"==typeof this.config.onContentDidChange&&this.config.onContentDidChange(this)}_nextAtomSpeechText(t){function e(t,e){return"body"===e.relation?{enclose:"cross out",leftright:"fence",surd:"square root",root:"math field"}[t.type]:{numer:"numerator",denom:"denominator",index:"index",body:"parent",subscript:"subscript",superscript:"superscript"}[e.relation]}const i=t?t.path:[],s=this.mathlist.path,a=s[s.length-1];let o="";for(;i.length>s.length;)o+="out of "+e(t.parent(),i[i.length-1])+"; ",i.pop();if(!this.mathlist.isCollapsed())return ws(this,"",this.mathlist.getSelectedAtoms());const n=e(this.mathlist.parent(),a);0===a.offset&&(o+=(n?"start of "+n:"unknown")+": ");const r=this.mathlist.sibling(Math.max(1,this.mathlist.extent));return r?o+=ws(this,"",r):0!==a.offset&&(o+=n?"end of "+n:"unknown"),o}_announce(t,e,i){"function"==typeof this.config.onAnnounce&&this.config.onAnnounce(this,t,e,i)}_onFocus(){this.blurred&&(this.blurred=!1,this.textarea.focus&&this.textarea.focus(),"onfocus"===this.config.virtualKeyboardMode&&this.showVirtualKeyboard_(),Ze.updatePopoverPosition(this),this.config.onFocus&&this.config.onFocus(this),this._requestUpdate())}_onBlur(){this.blurred||(this.blurred=!0,this.ariaLiveText.textContent="","onfocus"===this.config.virtualKeyboardMode&&this.hideVirtualKeyboard_(),this.complete_({discard:!0}),this._requestUpdate(),this.config.onBlur&&this.config.onBlur(this))}_onResize(){this.element.classList.remove("ML__isNarrowWidth","ML__isWideWidth","ML__isExtendedWidth"),window.innerWidth>=1024?this.element.classList.add("ML__isExtendedWidth"):window.innerWidth>=768?this.element.classList.add("ML__isWideWidth"):this.element.classList.add("ML__isNarrowWidth"),Ze.updatePopoverPosition(this)}toggleKeystrokeCaption_(){this.keystrokeCaptionVisible=!this.keystrokeCaptionVisible,this.keystrokeCaption.innerHTML="",this.keystrokeCaptionVisible||(this.keystrokeCaption.style.visibility="hidden")}_showKeystroke(t){const e=this.keystrokeCaption;if(e&&this.keystrokeCaptionVisible){const i=this.element.getBoundingClientRect();e.style.left=i.left+"px",e.style.top=i.top-64+"px",e.innerHTML=""+(xe.stringify(t)||t)+""+e.innerHTML,e.style.visibility="visible",setTimeout((function(){e.childNodes.length>0&&e.removeChild(e.childNodes[e.childNodes.length-1]),0===e.childNodes.length&&(e.style.visibility="hidden")}),3e3)}}$perform(t){if(!t)return!1;let e,i=!1,s=[],a=!1;if(Array.isArray(t)?(e=t[0],s=t.slice(1)):e=t,e=e.replace(/-\w/g,t=>t[1].toUpperCase()),e+="_","function"==typeof this.mathlist[e]){if(/^(delete|transpose|add)/.test(e)&&this._resetKeystrokeBuffer(),/^(delete|transpose|add)/.test(e)&&"command"!==this.mode&&(this.undoManager.pop(),this.undoManager.snapshot(this.config)),this.mathlist[e](...s),/^(delete|transpose|add)/.test(e)&&"command"!==this.mode&&this.undoManager.snapshot(this.config),/^(delete)/.test(e)&&"command"===this.mode){const t=this.mathlist.extractCommandStringAroundInsertionPoint(),e=wt.suggest(t);0===e.length?Ze.hidePopover(this):Ze.showPopoverWithLatex(this,e[0].match,e.length>1)}a=!0,i=!0}else"function"==typeof this[e]&&(a=this[e](...s),i=!0);return this.mathlist.isCollapsed()&&!/^(transpose|paste|complete|((moveToNextChar|moveToPreviousChar|extend).*))_$/.test(e)||(this._resetKeystrokeBuffer(),this.style={}),a&&this._requestUpdate(),i}performWithFeedback_(t){return this.$focus(),this.config.keypressVibration&&navigator.vibrate&&navigator.vibrate(3),"moveToNextPlaceholder"===(t=t.replace(/-\w/g,t=>t[1].toUpperCase()))||"moveToPreviousPlaceholder"===t||"complete"===t?this.returnKeypressSound?(this.returnKeypressSound.load(),this.returnKeypressSound.play().catch(t=>{})):this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play().catch(t=>{})):"deletePreviousChar"!==t&&"deleteNextChar"!==t&&"deletePreviousWord"!==t&&"deleteNextWord"!==t&&"deleteToGroupStart"!==t&&"deleteToGroupEnd"!==t&&"deleteToMathFieldStart"!==t&&"deleteToMathFieldEnd"!==t||!this.deleteKeypressSound?this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play().catch(t=>{})):(this.deleteKeypressSound.load(),this.deleteKeypressSound.play().catch(t=>{})),this.$perform(t)}convertLastAtomsToText_(t,e){"function"==typeof t&&(e=t,t=1/0),void 0===t&&(t=1/0);let i=0,s=!1;for(this.mathlist.contentWillChange();!s;){const a=this.mathlist.sibling(i);s=0===t||!a||"math"!==a.mode||!(/mord|textord|mpunct/.test(a.type)||"mop"===a.type&&/[a-zA-Z]+/.test(a.body))||a.superscript||a.subscript||e&&!e(a),s||(a.applyStyle({mode:"text"}),a.latex=a.body),i-=1,t-=1}this.mathlist.contentDidChange()}convertLastAtomsToMath_(t,e){"function"==typeof t&&(e=t,t=1/0),void 0===t&&(t=1/0),this.mathlist.contentWillChange();let i=0,s=!1;for(;!s;){const a=this.mathlist.sibling(i);s=0===t||!a||"text"!==a.mode||" "===a.body||e&&!e(a),s||a.applyStyle({mode:"math",type:"mord"}),i-=1,t-=1}this.removeIsolatedSpace_(),this.mathlist.contentDidChange()}removeIsolatedSpace_(){let t=0;for(;this.mathlist.sibling(t)&&"math"===this.mathlist.sibling(t).mode;)t-=1;if(this.mathlist.sibling(t)&&"text"===this.mathlist.sibling(t).mode&&" "===this.mathlist.sibling(t).body&&(!this.mathlist.sibling(t-1)||"math"===this.mathlist.sibling(t-1).mode)){this.mathlist.contentWillChange(),this.mathlist.siblings().splice(t-1,1),this.mathlist.contentDidChange();const e=this.mathlist.suppressChangeNotifications;this.mathlist.suppressChangeNotifications=!0,this.mathlist.setSelection(this.mathlist.anchorOffset()-1),this.mathlist.suppressChangeNotifications=e}}getTextBeforeAnchor_(){let t="",e=0,i=!1;for(;!i;){const s=this.mathlist.sibling(e);i=!(s&&("text"===s.mode&&!s.type||"math"===s.mode&&/mord|textord|mpunct/.test(s.type))),i||(t=s.body+t),e-=1}return t}smartMode_(t,e){if(this.smartModeSuppressed)return!1;if(this.mathlist.endOffset()1)return!1;if(!this.mathlist.isCollapsed())return!("text"!==this.mode||!/[/_^]/.test(i));const s=this.getTextBeforeAnchor_()+i;if("text"===this.mode){if("Esc"===t||/[/\\]/.test(i))return!0;if(/[\^_]/.test(i))return/(^|\s)[a-zA-Z][^_]$/.test(s)&&this.convertLastAtomsToMath_(1),!0;const e={")":"(","}":"{","]":"["}[i];if(e&&this.mathlist.parent()&&"leftright"===this.mathlist.parent().type&&this.mathlist.parent().leftDelim===e)return!0;if(/(^|[^a-zA-Z])(a|I)[ ]$/.test(s))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(i))return!0;if(/(^|[^a-zA-Z'’])[a-zA-Z][ ]$/.test(s))return this.convertLastAtomsToMath_(1),!1;if(/[^0-9]\.[^0-9\s]$/.test(s)){this.convertLastAtomsToMath_(1);const t=this.mathlist.sibling(0);return t.body="⋅",t.autoFontFamily="cmr",t.latex="\\cdot",!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(s))return this.convertLastAtomsToMath_(1),!0;if(/\.[0-9]$/.test(s))return this.convertLastAtomsToMath_(1),!0;if(/[(][0-9+\-.]$/.test(s))return this.convertLastAtomsToMath_(1),!0;if(/[(][a-z][,;]$/.test(s))return this.convertLastAtomsToMath_(2),!0;if(/[0-9+\-=><*|]$/.test(i))return this.removeIsolatedSpace_(),!0}else{if("Spacebar"===t)return this.convertLastAtomsToText_(t=>/[a-z][:,;.]$/.test(t.body)),!0;if(/[a-zA-Z]{3,}$/.test(s)&&!/(dxd|abc|xyz|uvw)$/.test(s))return this.convertLastAtomsToText_(t=>/[a-zA-Z:,;.]/.test(t.body)),!0;if(/(^|\W)(if|If)$/i.test(s))return this.convertLastAtomsToText_(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 this.convertLastAtomsToText_(t=>/(:|,|;|.|\u0393|\u0394|\u0398|\u039b|\u039E|\u03A0|\u03A3|\u03a5|\u03a6|\u03a8|\u03a9|[\u03b1-\u03c9]|\u03d1|\u03d5|\u03d6|\u03f1|\u03f5)/u.test(t.body)),!0;if(/\?|\./.test(i))return!0}return!1}_onKeystroke(t,e){if(this._showKeystroke(t),clearTimeout(this.keystrokeBufferResetTimer),this.config.onKeystroke&&!this.config.onKeystroke(this,t,e))return e&&e.preventDefault&&(e.preventDefault(),e.stopPropagation()),!1;let i,s,a,o=!1;if("command"!==this.mode&&(!e||!e.ctrlKey&&!e.metaKey)){const t=$e.eventToChar(e);if("Backspace"!==t)if(!t||t.length>1)this._resetKeystrokeBuffer();else{const e=this.keystrokeBuffer+t;let a=0;for(;!i&&a{this._resetKeystrokeBuffer()},this.config.inlineShortcutTimeout))}}if(this.config.smartMode){const s=this.mode;i?this.mode="math":this.smartMode_(t,e)&&(this.mode={math:"text",text:"math"}[this.mode],a=""),this.mode!==s&&"function"==typeof this.config.onModeChange&&this.config.onModeChange(this,this.mode)}if(i||a||(a=xe.selectorForKeystroke(this.mode,t)),!i&&!a)return!0;this.mathlist.decorateCommandStringAroundInsertionPoint(!1);const r=this.mathlist.parent();if("moveAfterParent"===a&&r&&"leftright"===r.type&&this.mathlist.endOffset()===this.mathlist.siblings().length-1&&this.config.smartFence&&this.mathlist._insertSmartFence(".")&&(a="",this._requestUpdate()),"math"===this.mode&&"Spacebar"===t&&!i){const t=this.mathlist.sibling(1),e=this.mathlist.sibling(-1);(t&&"text"===t.mode||e&&"text"===e.mode)&&this.mathlist.insert(" ",{mode:"text"})}if((a&&!this.$perform(a)||i)&&i){if(!/^(\\{|\\}|\\[|\\]|\\@|\\#|\\$|\\%|\\^|\\_|\\backslash)$/.test(i)){const t={...this.mathlist.anchorStyle(),...this.style};this.mathlist.insert($e.eventToChar(e),{suppressChangeNotifications:!0,mode:this.mode,style:t});const i=this.mode;this.undoManager.snapshotAndCoalesce(this.config),this.undoManager.restore(this.keystrokeBufferStates[s],{...this.config,suppressChangeNotifications:!0}),this.mode=i}this.mathlist.contentWillChange();const t=this.mathlist.suppressChangeNotifications;this.mathlist.suppressChangeNotifications=!0;const a={...this.mathlist.anchorStyle(),...this.style};this.mathlist.insert(i,{format:"latex",mode:this.mode,style:a,smartFence:!0}),this.removeIsolatedSpace_(),i.endsWith(" ")&&(this.mode="text",this.mathlist.insert(" ",{mode:"text",style:a})),this.mathlist.suppressChangeNotifications=t,this.mathlist.contentDidChange(),this.undoManager.snapshot(this.config),this._requestUpdate(),this._announce("replacement"),o&&this._resetKeystrokeBuffer()}return this.scrollIntoView(),e&&e.preventDefault&&(e.preventDefault(),e.stopPropagation()),!1}_onTypedText(t,e){if((e=e||{}).focus&&this.$focus(),e.feedback&&(this.config.keypressVibration&&navigator.vibrate&&navigator.vibrate(3),this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play().catch(t=>{}))),e.commandMode&&"command"!==this.mode&&this.switchMode_("command"),this.mathlist.decorateCommandStringAroundInsertionPoint(!1),e.simulateKeystroke){const e=t.charAt(0),i=$e.charToEvent(e);if(!this.$keystroke($e.keyboardEventToString(i),i))return}let i="",a=!1;if(this.pasteInProgress)this.pasteInProgress=!1,this.mathlist.insert(t,{smartFence:this.config.smartFence,mode:"math"});else{const e={...this.mathlist.anchorStyle(),...this.style},o=s(t);for(const t of o)if("command"===this.mode){this.mathlist.removeSuggestion(),this.suggestionIndex=0;const e=this.mathlist.extractCommandStringAroundInsertionPoint(),s=wt.suggest(e+t);a=s.length>1,0===s.length?(this.mathlist.insert(t,{mode:"command"}),/^\\[a-zA-Z\\*]+$/.test(e+t)&&this.mathlist.decorateCommandStringAroundInsertionPoint(!0),Ze.hidePopover(this)):(this.mathlist.insert(t,{mode:"command"}),s[0].match!==e+t&&this.mathlist.insertSuggestion(s[0].match,-s[0].match.length+e.length+1),i=s[0].match)}else if("math"===this.mode){const i={"^":"moveToSuperscript",_:"moveToSubscript"," ":"moveAfterParent"}[t];if(i){if("moveToSuperscript"===i){if(this._superscriptDepth()>=this.config.scriptDepth[1])return void this._announce("plonk")}else if("moveToSubscript"===i&&this._subscriptDepth()>=this.config.scriptDepth[0])return void this._announce("plonk");this.$perform(i)}else this.config.smartSuperscript&&"superscript"===this.mathlist.relation()&&/[0-9]/.test(t)&&0===this.mathlist.siblings().filter(t=>"first"!==t.type).length?(this.mathlist.insert(t,{mode:"math",style:e}),this.mathlist.moveAfterParent_()):this.mathlist.insert(t,{mode:"math",style:e,smartFence:this.config.smartFence})}else"text"===this.mode&&this.mathlist.insert(t,{mode:"text",style:e})}"command"!==this.mode&&this.undoManager.snapshotAndCoalesce(this.config),this._requestUpdate(),this.scrollIntoView(),Ze.showPopoverWithLatex(this,i,a)}_hash(){let t=0;const e=this.mathlist.root.toLatex(!1);for(let i=0;ibs(this)&&this._render()))}_render(t){t=t||{},this.dirty=!1,window.mathlive||(window.mathlive={}),this.mathlist.anchor()||(this.mathlist.path=[{relation:"body",offset:0}]),this.mathlist.forEach(t=>{t.caret="",t.isSelected=!1});const e=this.$hasFocus();this.mathlist.isCollapsed()?this.mathlist.anchor().caret=e?this.mode:"":this.mathlist.forEachSelected(t=>{t.isSelected=!0});const i=Yt.decompose({mathstyle:"displaystyle",generateID:{seed:this._hash(),groupNumbers:t.forHighlighting},macros:this.config.macros},this.mathlist.root),s=$.makeSpan(i,"ML__base");s.attributes={translate:"no","aria-hidden":"true"};const a=$.makeSpan("","ML__strut");a.setStyle("height",s.height,"em");const o=[a];if(0!==s.depth){const t=$.makeSpan("","ML__strut--bottom");t.setStyle("height",s.height+s.depth,"em"),t.setStyle("vertical-align",-s.depth,"em"),o.push(t)}o.push(s);const n=$.makeSpan(o,"ML__mathlive");this.field.innerHTML=n.toMarkup(0,this.config.horizontalSpacingScale),this.field.classList.toggle("ML__focused",e),this.accessibleNode.innerHTML=""+Yt.toMathML(this.mathlist.root,this.config)+"";const r=this._getSelectionBounds();if(r){const t=document.createElement("div");t.classList.add("ML__selection"),t.style.position="absolute",t.style.left=r.left+"px",t.style.top=r.top+"px",t.style.width=Math.ceil(r.right-r.left)+"px",t.style.height=Math.ceil(r.bottom-r.top-1)+"px",this.field.insertBefore(t,this.field.childNodes[0])}}_onPaste(){return this.pasteInProgress=!0,!0}_onCut(){return setTimeout(function(){this.$clearSelection(),this._requestUpdate()}.bind(this),0),!0}_onCopy(t){this.mathlist.isCollapsed()?(t.clipboardData.setData("text/plain","$$"+this.$text("latex-expanded")+"$$"),t.clipboardData.setData("application/json",this.$text("json")),t.clipboardData.setData("application/xml",this.$text("mathML"))):(t.clipboardData.setData("text/plain","$$"+this.$selectedText("latex-expanded")+"$$"),t.clipboardData.setData("application/json",this.$selectedText("json")),t.clipboardData.setData("application/xml",this.$selectedText("mathML"))),t.preventDefault()}formatMathlist(t,e){let i="";if("latex"===(e=e||"latex")||"latex-expanded"===e)i=t.toLatex("latex-expanded"===e);else if("mathML"===e)i=t.toMathML(this.config);else if("spoken"===e)i=Yt.toSpeakableText(t,this.config);else if("spoken-text"===e){const e=this.config.textToSpeechMarkup;this.config.textToSpeechMarkup="",i=Yt.toSpeakableText(t,this.config),this.config.textToSpeechMarkup=e}else if("spoken-ssml"===e||"spoken-ssml-withHighlighting"===e){const s=this.config.textToSpeechMarkup,a=this.config.generateID;this.config.textToSpeechMarkup="ssml","spoken-ssml-withHighlighting"===e&&(this.config.generateID=!0),i=Yt.toSpeakableText(t,this.config),this.config.textToSpeechMarkup=s,this.config.generateID=a}else if("json"===e){const e=Yt.toAST(t,this.config);i=JSON.stringify(e)}else"ASCIIMath"===e&&(i=function t(e,i){if(!e)return"";if(Array.isArray(e)){let i="";if(0===e.length)return"";if("first"===e[0].type&&e.shift(),"text"===e[0].mode){let s=0;for(i='"';e[s]&&"text"===e[s].mode;)i+=e[s].body,s++;i+='"'+t(e.slice(s))}else{let s=0;for(;e[s]&&"math"===e[s].mode;)i+=t(e[s]),s++;i+=t(e.slice(s))}return i.trim()}if("text"===e.mode)return'"'+e.body+'"';let s="";const a=e.latex?e.latex.trim():null;let o;switch(e.type){case"group":case"root":s=t(e.body);break;case"array":break;case"genfrac":(e.leftDelim||e.rightDelim)&&(s+="."!==e.leftDelim&&e.leftDelim?e.leftDelim:"{:"),e.hasBarLine?(s+="(",s+=t(e.numer),s+=")/(",s+=t(e.denom),s+=")"):(s+="("+t(e.numer)+"),",s+="("+t(e.denom)+")"),(e.leftDelim||e.rightDelim)&&(s+="."!==e.rightDelim&&e.rightDelim?e.rightDelim:"{:");break;case"surd":e.index?s+="root("+t(e.index)+")("+t(e.body)+")":s+="sqrt("+t(e.body)+")";break;case"leftright":s+="."!==e.leftDelim&&e.leftDelim?e.leftDelim:"{:",s+=t(e.body),s+="."!==e.rightDelim&&e.rightDelim?e.rightDelim:"{:";break;case"sizeddelim":case"delim":case"accent":break;case"line":case"overlap":case"overunder":break;case"mord":s=li[a]||a||("string"==typeof e.body?e.body:""),"\\"===s[0]&&(s+=""),o=a?a.match(/[{]?\\char"([0-9abcdefABCDEF]*)[}]?/):null,o?s=String.fromCharCode(parseInt("0x"+o[1])):s.length>0&&"\\"===s.charAt(0)&&(s="string"==typeof e.body?e.body.charAt(0):e.latex);break;case"mbin":case"mrel":case"textord":case"minner":s=a&&li[a]?li[a]:a&&ci[a]?ci[a]:e.body;break;case"mopen":case"mclose":s+=e.body;break;case"mpunct":s=ci[a]||a;break;case"mop":"​"!==e.body&&(s="",s+="\\operatorname"===a?t(e.body):e.body||a,s+=" ");break;case"mathstyle":case"box":case"spacing":case"enclose":break;case"space":s=" "}if(e.subscript){s+="_";const i=t(e.subscript);i.length>1&&!/^(-)?\d+(\.\d*)?$/.test(i)?s+="("+i+")":s+=i}if(e.superscript){s+="^";const i=t(e.superscript);i.length>1&&!/^(-)?\d+(\.\d*)?$/.test(i)?s+="("+i+")":s+=i}return s}(t,this.config));return i}$text(t){return this.formatMathlist(this.mathlist.root,t)}$selectedText(t){const e=this.mathlist.getSelectedAtoms();if(!e)return"";const i=Yt.makeRoot("math",e);return this.formatMathlist(i,t)}$selectionIsCollapsed(){return this.mathlist.isCollapsed()}$selectionDepth(){return this.mathlist.path.length}_superscriptDepth(){let t=0,e=0,i=this.mathlist.ancestor(e),s=!1;for(;i;)(i.superscript||i.subscript)&&(t+=1),i.superscript?s=!0:i.subscript&&(s=!1),e+=1,i=this.mathlist.ancestor(e);return s?t:0}_subscriptDepth(){let t=0,e=0,i=this.mathlist.ancestor(e),s=!1;for(;i;)(i.superscript||i.subscript)&&(t+=1),i.superscript?s=!1:i.subscript&&(s=!0),e+=1,i=this.mathlist.ancestor(e);return s?t:0}$selectionAtStart(){return 0===this.mathlist.startOffset()}$selectionAtEnd(){return this.mathlist.endOffset()>=this.mathlist.siblings().length-1}groupIsSelected(){return 0===this.mathlist.startOffset()&&this.mathlist.endOffset()>=this.mathlist.siblings().length-1}$latex(t,e){return t?(t!==this.mathlist.root.toLatex()&&(e=e||{},this.mathlist.insert(t,Object.assign({},this.config,{insertionMode:"replaceAll",selectionMode:"after",format:"latex",mode:"math",suppressChangeNotifications:e.suppressChangeNotifications})),this.undoManager.snapshot(this.config),this._requestUpdate()),t):this.mathlist.root.toLatex()}$el(){return this.element}undo(){return this.complete_(),this.undoManager.undo(this.config),!0}redo(){return this.complete_(),this.undoManager.redo(this.config),!0}scrollIntoView(){this.dirty&&this._render();let t=this._getCaretPosition();const e=this.field.getBoundingClientRect();if(!t){const i=this._getSelectionBounds();i&&(t={x:i.right+e.left-this.field.scrollLeft,y:i.top+e.top-this.field.scrollTop})}if(t){const i=t.x-window.scrollX;ie.right&&this.field.scroll({top:0,left:i-e.right+this.field.scrollLeft+20,behavior:"smooth"})}}scrollToStart(){this.field.scroll(0,0)}scrollToEnd(){const t=this.field.getBoundingClientRect();this.field.scroll(t.left-window.scrollX,0)}enterCommandMode_(){this.switchMode_("command")}copyToClipboard_(){return this.$focus(),this.mathlist.isCollapsed()&&this.$select(),document.execCommand("copy"),!1}cutToClipboard_(){return this.$focus(),document.execCommand("cut"),!0}pasteFromClipboard_(){return this.$focus(),document.execCommand("paste"),!0}$insert(t,e){if("string"==typeof t&&t.length>0){if((e=e||{}).focus&&this.$focus(),e.feedback&&(this.config.keypressVibration&&navigator.vibrate&&navigator.vibrate(3),this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play())),"\\\\"===t)this.mathlist.addRowAfter_();else if("&"===t)this.mathlist.addColumnAfter_();else{const i=this.style;this.mathlist.insert(t,{mode:this.mode,style:this.mathlist.anchorStyle(),...e}),e.resetStyle&&(this.style=i)}return this.undoManager.snapshot(this.config),this._requestUpdate(),!0}return!1}switchMode_(t,e,i){this._resetKeystrokeBuffer(),this.smartModeSuppressed=/text|math/.test(this.mode)&&/text|math/.test(t),e&&this.$insert(e,{format:"latex",mode:{math:"text",text:"math"}[t]}),this.mathlist.decorateCommandStringAroundInsertionPoint(!1),"command"===t?(this.mathlist.removeSuggestion(),Ze.hidePopover(this),this.suggestionIndex=0,this.virtualKeyboardVisible&&this.switchKeyboardLayer_("lower-command"),this.mathlist.insert("",{mode:"math"})):this.mode=t,i&&this.$insert(i,{format:"latex",mode:t}),"function"==typeof this.config.onModeChange&&this.config.onModeChange(this,this.mode),this._requestUpdate()}complete_(t){if(t=t||{},Ze.hidePopover(this),t.discard)return this.mathlist.spliceCommandStringAroundInsertionPoint(null),this.switchMode_("math"),!0;const e=this.mathlist.extractCommandStringAroundInsertionPoint(!t.acceptSuggestion);if(e){if("\\("===e||"\\)"===e)this.mathlist.spliceCommandStringAroundInsertionPoint([]),this.mathlist.insert(e.slice(1),{mode:this.mode});else{const t="math";if(wt.commandAllowed(t,e)){const i=le.parseTokens(n(e),t,null,this.config.macros);this.mathlist.spliceCommandStringAroundInsertionPoint(i)}else{const i=le.parseTokens(n(e),t,null,this.config.macros);i?this.mathlist.spliceCommandStringAroundInsertionPoint(i):this.mathlist.decorateCommandStringAroundInsertionPoint(!0)}}return this.undoManager.snapshot(this.config),this._announce("replacement"),!0}return!1}_updateSuggestion(){this.mathlist.positionInsertionPointAfterCommitedCommand(),this.mathlist.removeSuggestion();const t=this.mathlist.extractCommandStringAroundInsertionPoint(),e=wt.suggest(t);if(0===e.length)Ze.hidePopover(this),this.mathlist.decorateCommandStringAroundInsertionPoint(!0);else{const i=this.suggestionIndex%e.length,s=t.length-e[i].match.length;0!==s&&this.mathlist.insertSuggestion(e[i].match,s),Ze.showPopoverWithLatex(this,e[i].match,e.length>1)}this._requestUpdate()}nextSuggestion_(){return this.suggestionIndex+=1,this._updateSuggestion(),!1}previousSuggestion_(){if(this.suggestionIndex-=1,this.suggestionIndex<0){this.mathlist.removeSuggestion();const t=this.mathlist.extractCommandStringAroundInsertionPoint(),e=wt.suggest(t);this.suggestionIndex=e.length-1}return this._updateSuggestion(),!1}_attachButtonHandlers(t,e){const i=this;let s,a,o,n,r;"object"==typeof e&&(e.default||e.pressed)?(e.default&&t.setAttribute("data-"+this.config.namespace+"command",JSON.stringify(e.default)),e.alt&&t.setAttribute("data-"+this.config.namespace+"command-alt",JSON.stringify(e.alt)),e.altshift&&t.setAttribute("data-"+this.config.namespace+"command-altshift",JSON.stringify(e.altshift)),e.shift&&t.setAttribute("data-"+this.config.namespace+"command-shift",JSON.stringify(e.shift)),e.pressed&&t.setAttribute("data-"+this.config.namespace+"command-pressed",JSON.stringify(e.pressed)),e.pressAndHoldStart&&t.setAttribute("data-"+this.config.namespace+"command-pressAndHoldStart",JSON.stringify(e.pressAndHoldStart)),e.pressAndHoldEnd&&t.setAttribute("data-"+this.config.namespace+"command-pressAndHoldEnd",JSON.stringify(e.pressAndHoldEnd))):t.setAttribute("data-"+this.config.namespace+"command",JSON.stringify(e)),us(t,"mousedown touchstart:passive",(function(e){if("mousedown"!==e.type||1===e.buttons){e.stopPropagation(),e.preventDefault(),t.classList.add("pressed"),s=Date.now(),"touchstart"===e.type&&(o=e.changedTouches[0].identifier);const n=t.getAttribute("data-"+i.config.namespace+"command-pressed");n&&i.$perform(JSON.parse(n));const l=t.getAttribute("data-"+i.config.namespace+"command-pressAndHoldStart");l&&(a=t,r&&clearTimeout(r),r=window.setTimeout((function(){t.classList.contains("pressed")&&i.$perform(JSON.parse(l))}),300))}})),us(t,"mouseleave touchcancel",(function(){t.classList.remove("pressed")})),us(t,"touchmove:passive",(function(t){t.preventDefault();for(let e=0;e=7?i.style.width="286px":4===e.length||2===e.length?i.style.width="146px":1===e.length?i.style.width="86px":i.style.width="146px",i.style.height="auto";let s="";for(const t of e)s+="";s="
    "+s+"
",i.innerHTML=s,ri.makeKeycap(this,i.getElementsByTagName("li"),"performAlternateKeys");const a=this.virtualKeyboard.querySelector('div.keyboard-layer.is-visible div.rows ul li[data-alt-keys="'+t+'"]').getBoundingClientRect();if(a){a.top-i.clientHeight<0&&(i.style.width="auto",e.length<=6?i.style.height="56px":e.length<=12?i.style.height="108px":i.style.height="205px");const t=(a.top-i.clientHeight+5).toString()+"px",s=Math.max(0,Math.min(window.innerWidth-i.offsetWidth,(a.left+a.right-i.offsetWidth)/2))+"px";i.style.transform="translate("+s+","+t+")",i.classList.add("is-visible")}return!1}hideAlternateKeys_(){const t=document.getElementById("mathlive-alternate-keys-panel");return t&&(t.classList.remove("is-visible"),t.innerHTML="",ys(t)),!1}performAlternateKeys_(t){return this.hideAlternateKeys_(),this.$perform(t)}switchKeyboardLayer_(t){if("off"!==this.config.virtualKeyboardMode){"lower-command"!==t&&"upper-command"!==t&&"symbols-command"!==t&&this.complete_(),this.showVirtualKeyboard_(),this.hideAlternateKeys_(),this.unshiftKeyboardLayer_();const e=this.virtualKeyboard.getElementsByClassName("keyboard-layer");let i=!1;for(let s=0;s=1){i=[];for(let t=1;t<=s;t++)i.push(e[t])}break}case"right":{const e=t.mathlist.siblings(),s=t.mathlist.endOffset()+1;if(s<=e.length-1){i=[];for(let t=s;t<=e.length-1;t++)i.push(e[t])}break}case"start":case"end":break;case"group":i=t.mathlist.siblings();break;case"parent":{const e=t.mathlist.parent();e&&"root"!==e.type&&(i=t.mathlist.parent());break}}return i}(this,t);if(null===i)return this.config.handleSpeak(function(t){let e="";switch(t){case"all":break;case"selection":e="no selection";break;case"left":e="at start";break;case"right":e="at end";break;case"group":break;case"parent":e="no parent"}return e}(t)),!1;const s={...this.config};(e.withHighlighting||"amazon"===s.speechEngine)&&(s.textToSpeechMarkup=window.sre&&"sre"===s.textToSpeechRules?"ssml_step":"ssml",e.withHighlighting&&(s.generateID=!0));const a=Yt.toSpeakableText(i,s);return e.withHighlighting?(window.mathlive.readAloudMathField=this,this._render({forHighlighting:!0}),this.config.handleReadAloud&&this.config.handleReadAloud(this.field,a,this.config)):this.config.handleSpeak&&this.config.handleSpeak(a,s),!1}}let ks,vs=0;function ws(t,e,i){const s=Object.assign({},t.config);return s.textToSpeechMarkup="",s.textToSpeechRulesOptions=s.textToSpeechRulesOptions||{},s.textToSpeechRulesOptions.markup="none",e+Yt.toSpeakableText(i,s)}function Ss(t,e,i,s){let a="";"plonk"===e?(t.plonkSound&&(t.plonkSound.load(),t.plonkSound.play().catch(t=>{})),t._resetKeystrokeBuffer()):"delete"===e?a=ws(t,"deleted: ",s):"focus"===e||/move/.test(e)?a=(t.mathlist.isCollapsed()?"":"selected: ")+t._nextAtomSpeechText(i):"replacement"===e?a=ws(t,"",t.mathlist.sibling(0)):"line"===e?(a=ws(t,"",t.mathlist.root),t.accessibleNode.innerHTML=''+Yt.toMathML(t.mathlist.root,t.config)+"",t.textarea.setAttribute("aria-label","after: "+a)):a=s?ws(t,e+" ",s):e;const o=/\u00a0/.test(t.ariaLiveText.textContent)?"   ":"   ";t.ariaLiveText.textContent=a+o}xs.prototype.undo_=xs.prototype.undo,xs.prototype.redo_=xs.prototype.redo,xs.prototype.scrollIntoView_=xs.prototype.scrollIntoView,xs.prototype.scrollToStart_=xs.prototype.scrollToStart,xs.prototype.scrollToEnd_=xs.prototype.scrollToEnd,xs.prototype.insert_=xs.prototype.$insert;var As={isValidMathfield:bs,MathField:xs};function Ms(t,e,i){let s=i,a=0;const o=t.length;for(;s0&&a.push({type:"text",data:n.slice(0,c)}),l=!1);let h=!1;for(;!h;){if(l){if(r=n.indexOf(e,c),-1===r){h=!0;break}c!==r&&a.push({type:"text",data:n.slice(c,r)}),c=r}else{if(r=Ms(i,n,c+e.length),-1===r){h=!0;break}a.push({type:"math",data:n.slice(c+e.length,r),rawData:n.slice(c,r+i.length),mathstyle:s}),c=r+i.length}l=!l}c"+e.renderToMathML(t,e)+""}catch(e){i.textContent=t}return i.className="sr-only",i}(t,i)),/\bspeakable-text\b/i.test(i.renderAccessibleContent)&&i.renderToSpeakableText){const s=document.createElement("span");s.innerHTML=i.renderToSpeakableText(t,i),s.className="sr-only",e.appendChild(s)}return e.appendChild(a),e}return a}function Ls(t,e){let i=null;if(e.TeX.processEnvironments&&/^\s*\\begin/.test(t))i=document.createDocumentFragment(),i.appendChild(Ts(t,void 0,e,!0));else{const s=_s(t,e.TeX.delimiters);if(1===s.length&&"text"===s[0].type)return null;i=document.createDocumentFragment();for(let t=0;t{})}}))}}else e.speechEngine;else{const e=new SpeechSynthesisUtterance(t);window&&window.speechSynthesis.speak(e)}}function Ps(t,e,i){if(!window)return;if(!i&&window.mathlive&&(i=window.mathlive.config),"amazon"!==(i=i||{}).speechEngine)return void(i.handleSpeak&&i.handleSpeak(e));if(!window.AWS)return;const s=new window.AWS.Polly({apiVersion:"2016-06-10"}),a={OutputFormat:"json",VoiceId:i.speechEngineVoice||"Joanna",Text:e,TextType:"ssml",SpeechMarkTypes:["ssml"]};window.mathlive=window.mathlive||{},window.mathlive.readAloudElement=t;const o=i.onReadAloudStatus||window.mathlive.onReadAloudStatus;s.synthesizeSpeech(a,(function(t,e){if(t);else if(e&&e.AudioStream){const t=new TextDecoder("utf-8").decode(new Uint8Array(e.AudioStream));window.mathlive.readAloudMarks=t.split("\n").map(t=>t?JSON.parse(t):{}),window.mathlive.readAloudTokens=[];for(const t of window.mathlive.readAloudMarks)t.value&&window.mathlive.readAloudTokens.push(t.value);window.mathlive.readAloudCurrentMark="",a.OutputFormat="mp3",a.SpeechMarkTypes=[],s.synthesizeSpeech(a,(function(t,e){if(t);else if(e&&e.AudioStream){const t=new Uint8Array(e.AudioStream),i=new Blob([t.buffer],{type:"audio/mpeg"}),s=URL.createObjectURL(i);window.mathlive.readAloudAudio?window.mathlive.readAloudAudio.pause():(window.mathlive.readAloudAudio=new Audio,window.mathlive.readAloudAudio.addEventListener("ended",()=>{o&&o(window.mathlive.readAloudMathField,"ended"),window.mathlive.readAloudMathField?(window.mathlive.readAloudMathField._render(),window.mathlive.readAloudElement=null,window.mathlive.readAloudMathField=null,window.mathlive.readAloudTokens=[],window.mathlive.readAloudMarks=[],window.mathlive.readAloudCurrentMark=""):function t(e){e.classList.remove("highlight"),e.children&&Array.from(e.children).forEach(e=>{t(e)})}(window.mathlive.readAloudElement)}),window.mathlive.readAloudAudio.addEventListener("timeupdate",()=>{let t="";const e=1e3*window.mathlive.readAloudAudio.currentTime+100;for(const i of window.mathlive.readAloudMarks)i.time0&&Array.from(e.children).forEach(e=>{t(e,i)})):(e.classList.add("highlight"),e.children&&e.children.length>0&&Array.from(e.children).forEach(e=>{t(e)}))}(window.mathlive.readAloudElement,window.mathlive.readAloudCurrentMark)))})),window.mathlive.readAloudAudio.src=s,o&&o(window.mathlive.readAloudMathField,"playing"),window.mathlive.readAloudAudio.play()}}))}}))}function Bs(t){let e=t;if("string"==typeof t&&(e=document.getElementById(t),!e))throw Error(`The element with ID "${t}" could not be found.`);return e}function Os(t,e){Ds&&((e=e||{}).renderToMarkup=e.renderToMarkup||zs,e.renderToMathML=e.renderToMathML||Es,e.renderToSpeakableText=e.renderToSpeakableText||qs,e.macros=e.macros||wt.MACROS,Ds.renderMathInElement(Bs(t),e))}function Rs(t){if(t.namespace){if(!/^[a-z]+[-]?$/.test(t.namespace))throw Error("options.namespace must be a string of lowercase characters only");/-$/.test(t.namespace)||(t.namespace+="-")}}const Ks={latexToMarkup:zs,latexToMathML:Es,latexToSpeakableText:qs,latexToAST:function(t,e){if(!Yt.toAST)return{};(e=e||{}).macros=e.macros||{},Object.assign(e.macros,wt.MACROS);const i=le.parseTokens(n(t),"math",null,e.macros);return Yt.toAST(i,e)},astToLatex:function(t,e){return hs(t,e)},makeMathField:function(t,e){if(!As)throw Error("The MathField module is not loaded.");return(e=e||{}).handleSpeak=e.handleSpeak||Is,e.handleReadAloud=e.handleReadAloud||Ps,new As.MathField(Bs(t),e)},renderMathInDocument:function(t){Os(document.body,t)},renderMathInElement:Os,revertToOriginalContent:function(t,e){(t=(t=Bs(t)).children[1])instanceof As.MathField?t.revertToOriginalContent():(Rs(e=e||{}),t.innerHTML=t.getAttribute("data-"+(e.namespace||"")+"original-content"))},getOriginalContent:function(t,e){return(t=(t=Bs(t)).children[1])instanceof As.MathField?t.originalContent:(Rs(e=e||{}),t.getAttribute("data-"+(e.namespace||"")+"original-content"))},readAloud:Ps,readAloudStatus:function(){return window?(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio?window.mathlive.readAloudAudio.paused?"paused":window.mathlive.readAloudAudio.ended?"ready":"playing":"ready"):"unavailable"},pauseReadAloud:function(){window&&(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio&&(window.mathlive.onReadAloudStatus&&window.mathlive.onReadAloudStatus(window.mathlive.readAloudMathField,"paused"),window.mathlive.readAloudAudio.pause()))},resumeReadAloud:function(){window&&(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio&&(window.mathlive.onReadAloudStatus&&window.mathlive.onReadAloudStatus(window.mathlive.readAloudMathField,"playing"),window.mathlive.readAloudAudio.play()))},playReadAloud:function(t,e){if(window&&(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio)){let i=0;if(window.mathlive.readAloudFinalToken=null,t){window.mathlive.readAloudMarks=window.mathlive.readAloudMarks||[];for(const e of window.mathlive.readAloudMarks)e.value===t&&(i=e.time/1e3);let s=window.mathlive.readAloudTokens.indexOf(t);s>=0&&(s+=e,s=1){const s=t.charCodeAt(e-1),a=i;return 55296<=s&&s<=56319?1024*(s-55296)+(a-56320)+65536:a}return i}function e(e,s){if((s=s||0)<0)return 0;if(s>=e.length-1)return e.length;let a=i(t(e,s));for(let r=s+1;r=this.s.length}get(){return this.pos="0"&&i<="9"?parseInt(i):"?"):t=new a("literal","#")}}else"~"===this.peek()?(this.get(),t=new a("command","space")):"$"===this.peek()?(this.get(),"$"===this.peek()?(this.get(),t=new a("$$")):t=new a("$")):t=new a("literal",this.get());return t}}var n=function(t){const e=[],i=t.toString().split(/\r?\n/);let s="",a="";for(const t of i){s+=a,a=" ";const e=t.match(/((?:\\%)|[^%])*/);e&&(s+=e[0])}const n=new o(s);for(;!n.end();){const t=n.makeToken();t&&e.push(t)}return e},r={"AMS-Regular":{65:[0,.68889,0,0],66:[0,.68889,0,0],67:[0,.68889,0,0],68:[0,.68889,0,0],69:[0,.68889,0,0],70:[0,.68889,0,0],71:[0,.68889,0,0],72:[0,.68889,0,0],73:[0,.68889,0,0],74:[.16667,.68889,0,0],75:[0,.68889,0,0],76:[0,.68889,0,0],77:[0,.68889,0,0],78:[0,.68889,0,0],79:[.16667,.68889,0,0],80:[0,.68889,0,0],81:[.16667,.68889,0,0],82:[0,.68889,0,0],83:[0,.68889,0,0],84:[0,.68889,0,0],85:[0,.68889,0,0],86:[0,.68889,0,0],87:[0,.68889,0,0],88:[0,.68889,0,0],89:[0,.68889,0,0],90:[0,.68889,0,0],107:[0,.68889,0,0],165:[0,.675,.025,0],174:[.15559,.69224,0,0],240:[0,.68889,0,0],295:[0,.68889,0,0],710:[0,.825,0,0],732:[0,.9,0,0],770:[0,.825,0,0],771:[0,.9,0,0],989:[.08167,.58167,0,0],1008:[0,.43056,.04028,0],8245:[0,.54986,0,0],8463:[0,.68889,0,0],8487:[0,.68889,0,0],8498:[0,.68889,0,0],8502:[0,.68889,0,0],8503:[0,.68889,0,0],8504:[0,.68889,0,0],8513:[0,.68889,0,0],8592:[-.03598,.46402,0,0],8594:[-.03598,.46402,0,0],8602:[-.13313,.36687,0,0],8603:[-.13313,.36687,0,0],8606:[.01354,.52239,0,0],8608:[.01354,.52239,0,0],8610:[.01354,.52239,0,0],8611:[.01354,.52239,0,0],8619:[0,.54986,0,0],8620:[0,.54986,0,0],8621:[-.13313,.37788,0,0],8622:[-.13313,.36687,0,0],8624:[0,.69224,0,0],8625:[0,.69224,0,0],8630:[0,.43056,0,0],8631:[0,.43056,0,0],8634:[.08198,.58198,0,0],8635:[.08198,.58198,0,0],8638:[.19444,.69224,0,0],8639:[.19444,.69224,0,0],8642:[.19444,.69224,0,0],8643:[.19444,.69224,0,0],8644:[.1808,.675,0,0],8646:[.1808,.675,0,0],8647:[.1808,.675,0,0],8648:[.19444,.69224,0,0],8649:[.1808,.675,0,0],8650:[.19444,.69224,0,0],8651:[.01354,.52239,0,0],8652:[.01354,.52239,0,0],8653:[-.13313,.36687,0,0],8654:[-.13313,.36687,0,0],8655:[-.13313,.36687,0,0],8666:[.13667,.63667,0,0],8667:[.13667,.63667,0,0],8669:[-.13313,.37788,0,0],8672:[-.064,.437,0,0],8674:[-.064,.437,0,0],8705:[0,.825,0,0],8708:[0,.68889,0,0],8709:[.08167,.58167,0,0],8717:[0,.43056,0,0],8722:[-.03598,.46402,0,0],8724:[.08198,.69224,0,0],8726:[.08167,.58167,0,0],8733:[0,.69224,0,0],8736:[0,.69224,0,0],8737:[0,.69224,0,0],8738:[.03517,.52239,0,0],8739:[.08167,.58167,0,0],8740:[.25142,.74111,0,0],8741:[.08167,.58167,0,0],8742:[.25142,.74111,0,0],8756:[0,.69224,0,0],8757:[0,.69224,0,0],8764:[-.13313,.36687,0,0],8765:[-.13313,.37788,0,0],8769:[-.13313,.36687,0,0],8770:[-.03625,.46375,0,0],8774:[.30274,.79383,0,0],8776:[-.01688,.48312,0,0],8778:[.08167,.58167,0,0],8782:[.06062,.54986,0,0],8783:[.06062,.54986,0,0],8785:[.08198,.58198,0,0],8786:[.08198,.58198,0,0],8787:[.08198,.58198,0,0],8790:[0,.69224,0,0],8791:[.22958,.72958,0,0],8796:[.08198,.91667,0,0],8806:[.25583,.75583,0,0],8807:[.25583,.75583,0,0],8808:[.25142,.75726,0,0],8809:[.25142,.75726,0,0],8812:[.25583,.75583,0,0],8814:[.20576,.70576,0,0],8815:[.20576,.70576,0,0],8816:[.30274,.79383,0,0],8817:[.30274,.79383,0,0],8818:[.22958,.72958,0,0],8819:[.22958,.72958,0,0],8822:[.1808,.675,0,0],8823:[.1808,.675,0,0],8828:[.13667,.63667,0,0],8829:[.13667,.63667,0,0],8830:[.22958,.72958,0,0],8831:[.22958,.72958,0,0],8832:[.20576,.70576,0,0],8833:[.20576,.70576,0,0],8840:[.30274,.79383,0,0],8841:[.30274,.79383,0,0],8842:[.13597,.63597,0,0],8843:[.13597,.63597,0,0],8847:[.03517,.54986,0,0],8848:[.03517,.54986,0,0],8858:[.08198,.58198,0,0],8859:[.08198,.58198,0,0],8861:[.08198,.58198,0,0],8862:[0,.675,0,0],8863:[0,.675,0,0],8864:[0,.675,0,0],8865:[0,.675,0,0],8872:[0,.69224,0,0],8873:[0,.69224,0,0],8874:[0,.69224,0,0],8876:[0,.68889,0,0],8877:[0,.68889,0,0],8878:[0,.68889,0,0],8879:[0,.68889,0,0],8882:[.03517,.54986,0,0],8883:[.03517,.54986,0,0],8884:[.13667,.63667,0,0],8885:[.13667,.63667,0,0],8888:[0,.54986,0,0],8890:[.19444,.43056,0,0],8891:[.19444,.69224,0,0],8892:[.19444,.69224,0,0],8901:[0,.54986,0,0],8903:[.08167,.58167,0,0],8905:[.08167,.58167,0,0],8906:[.08167,.58167,0,0],8907:[0,.69224,0,0],8908:[0,.69224,0,0],8909:[-.03598,.46402,0,0],8910:[0,.54986,0,0],8911:[0,.54986,0,0],8912:[.03517,.54986,0,0],8913:[.03517,.54986,0,0],8914:[0,.54986,0,0],8915:[0,.54986,0,0],8916:[0,.69224,0,0],8918:[.0391,.5391,0,0],8919:[.0391,.5391,0,0],8920:[.03517,.54986,0,0],8921:[.03517,.54986,0,0],8922:[.38569,.88569,0,0],8923:[.38569,.88569,0,0],8926:[.13667,.63667,0,0],8927:[.13667,.63667,0,0],8928:[.30274,.79383,0,0],8929:[.30274,.79383,0,0],8934:[.23222,.74111,0,0],8935:[.23222,.74111,0,0],8936:[.23222,.74111,0,0],8937:[.23222,.74111,0,0],8938:[.20576,.70576,0,0],8939:[.20576,.70576,0,0],8940:[.30274,.79383,0,0],8941:[.30274,.79383,0,0],8994:[.19444,.69224,0,0],8995:[.19444,.69224,0,0],9416:[.15559,.69224,0,0],9484:[0,.69224,0,0],9488:[0,.69224,0,0],9492:[0,.37788,0,0],9496:[0,.37788,0,0],9585:[.19444,.68889,0,0],9586:[.19444,.74111,0,0],9632:[0,.675,0,0],9633:[0,.675,0,0],9650:[0,.54986,0,0],9651:[0,.54986,0,0],9654:[.03517,.54986,0,0],9660:[0,.54986,0,0],9661:[0,.54986,0,0],9664:[.03517,.54986,0,0],9674:[.11111,.69224,0,0],9733:[.19444,.69224,0,0],10003:[0,.69224,0,0],10016:[0,.69224,0,0],10731:[.11111,.69224,0,0],10846:[.19444,.75583,0,0],10877:[.13667,.63667,0,0],10878:[.13667,.63667,0,0],10885:[.25583,.75583,0,0],10886:[.25583,.75583,0,0],10887:[.13597,.63597,0,0],10888:[.13597,.63597,0,0],10889:[.26167,.75726,0,0],10890:[.26167,.75726,0,0],10891:[.48256,.98256,0,0],10892:[.48256,.98256,0,0],10901:[.13667,.63667,0,0],10902:[.13667,.63667,0,0],10933:[.25142,.75726,0,0],10934:[.25142,.75726,0,0],10935:[.26167,.75726,0,0],10936:[.26167,.75726,0,0],10937:[.26167,.75726,0,0],10938:[.26167,.75726,0,0],10949:[.25583,.75583,0,0],10950:[.25583,.75583,0,0],10955:[.28481,.79383,0,0],10956:[.28481,.79383,0,0],57350:[.08167,.58167,0,0],57351:[.08167,.58167,0,0],57352:[.08167,.58167,0,0],57353:[0,.43056,.04028,0],57356:[.25142,.75726,0,0],57357:[.25142,.75726,0,0],57358:[.41951,.91951,0,0],57359:[.30274,.79383,0,0],57360:[.30274,.79383,0,0],57361:[.41951,.91951,0,0],57366:[.25142,.75726,0,0],57367:[.25142,.75726,0,0],57368:[.25142,.75726,0,0],57369:[.25142,.75726,0,0],57370:[.13597,.63597,0,0],57371:[.13597,.63597,0,0]},"Caligraphic-Regular":{48:[0,.43056,0,0],49:[0,.43056,0,0],50:[0,.43056,0,0],51:[.19444,.43056,0,0],52:[.19444,.43056,0,0],53:[.19444,.43056,0,0],54:[0,.64444,0,0],55:[.19444,.43056,0,0],56:[0,.64444,0,0],57:[.19444,.43056,0,0],65:[0,.68333,0,.19445],66:[0,.68333,.03041,.13889],67:[0,.68333,.05834,.13889],68:[0,.68333,.02778,.08334],69:[0,.68333,.08944,.11111],70:[0,.68333,.09931,.11111],71:[.09722,.68333,.0593,.11111],72:[0,.68333,.00965,.11111],73:[0,.68333,.07382,0],74:[.09722,.68333,.18472,.16667],75:[0,.68333,.01445,.05556],76:[0,.68333,0,.13889],77:[0,.68333,0,.13889],78:[0,.68333,.14736,.08334],79:[0,.68333,.02778,.11111],80:[0,.68333,.08222,.08334],81:[.09722,.68333,0,.11111],82:[0,.68333,0,.08334],83:[0,.68333,.075,.13889],84:[0,.68333,.25417,0],85:[0,.68333,.09931,.08334],86:[0,.68333,.08222,0],87:[0,.68333,.08222,.08334],88:[0,.68333,.14643,.13889],89:[.09722,.68333,.08222,.08334],90:[0,.68333,.07944,.13889]},"Fraktur-Regular":{33:[0,.69141,0,0],34:[0,.69141,0,0],38:[0,.69141,0,0],39:[0,.69141,0,0],40:[.24982,.74947,0,0],41:[.24982,.74947,0,0],42:[0,.62119,0,0],43:[.08319,.58283,0,0],44:[0,.10803,0,0],45:[.08319,.58283,0,0],46:[0,.10803,0,0],47:[.24982,.74947,0,0],48:[0,.47534,0,0],49:[0,.47534,0,0],50:[0,.47534,0,0],51:[.18906,.47534,0,0],52:[.18906,.47534,0,0],53:[.18906,.47534,0,0],54:[0,.69141,0,0],55:[.18906,.47534,0,0],56:[0,.69141,0,0],57:[.18906,.47534,0,0],58:[0,.47534,0,0],59:[.12604,.47534,0,0],61:[-.13099,.36866,0,0],63:[0,.69141,0,0],65:[0,.69141,0,0],66:[0,.69141,0,0],67:[0,.69141,0,0],68:[0,.69141,0,0],69:[0,.69141,0,0],70:[.12604,.69141,0,0],71:[0,.69141,0,0],72:[.06302,.69141,0,0],73:[0,.69141,0,0],74:[.12604,.69141,0,0],75:[0,.69141,0,0],76:[0,.69141,0,0],77:[0,.69141,0,0],78:[0,.69141,0,0],79:[0,.69141,0,0],80:[.18906,.69141,0,0],81:[.03781,.69141,0,0],82:[0,.69141,0,0],83:[0,.69141,0,0],84:[0,.69141,0,0],85:[0,.69141,0,0],86:[0,.69141,0,0],87:[0,.69141,0,0],88:[0,.69141,0,0],89:[.18906,.69141,0,0],90:[.12604,.69141,0,0],91:[.24982,.74947,0,0],93:[.24982,.74947,0,0],94:[0,.69141,0,0],97:[0,.47534,0,0],98:[0,.69141,0,0],99:[0,.47534,0,0],100:[0,.62119,0,0],101:[0,.47534,0,0],102:[.18906,.69141,0,0],103:[.18906,.47534,0,0],104:[.18906,.69141,0,0],105:[0,.69141,0,0],106:[0,.69141,0,0],107:[0,.69141,0,0],108:[0,.69141,0,0],109:[0,.47534,0,0],110:[0,.47534,0,0],111:[0,.47534,0,0],112:[.18906,.52396,0,0],113:[.18906,.47534,0,0],114:[0,.47534,0,0],115:[0,.47534,0,0],116:[0,.62119,0,0],117:[0,.47534,0,0],118:[0,.52396,0,0],119:[0,.52396,0,0],120:[.18906,.47534,0,0],121:[.18906,.47534,0,0],122:[.18906,.47534,0,0],8216:[0,.69141,0,0],8217:[0,.69141,0,0],58112:[0,.62119,0,0],58113:[0,.62119,0,0],58114:[.18906,.69141,0,0],58115:[.18906,.69141,0,0],58116:[.18906,.47534,0,0],58117:[0,.69141,0,0],58118:[0,.62119,0,0],58119:[0,.47534,0,0]},"Main-Bold":{33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.13333,.63333,0,0],44:[.19444,.15556,0,0],45:[0,.44444,0,0],46:[0,.15556,0,0],47:[.25,.75,0,0],48:[0,.64444,0,0],49:[0,.64444,0,0],50:[0,.64444,0,0],51:[0,.64444,0,0],52:[0,.64444,0,0],53:[0,.64444,0,0],54:[0,.64444,0,0],55:[0,.64444,0,0],56:[0,.64444,0,0],57:[0,.64444,0,0],58:[0,.44444,0,0],59:[.19444,.44444,0,0],60:[.08556,.58556,0,0],61:[-.10889,.39111,0,0],62:[.08556,.58556,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.68611,0,0],66:[0,.68611,0,0],67:[0,.68611,0,0],68:[0,.68611,0,0],69:[0,.68611,0,0],70:[0,.68611,0,0],71:[0,.68611,0,0],72:[0,.68611,0,0],73:[0,.68611,0,0],74:[0,.68611,0,0],75:[0,.68611,0,0],76:[0,.68611,0,0],77:[0,.68611,0,0],78:[0,.68611,0,0],79:[0,.68611,0,0],80:[0,.68611,0,0],81:[.19444,.68611,0,0],82:[0,.68611,0,0],83:[0,.68611,0,0],84:[0,.68611,0,0],85:[0,.68611,0,0],86:[0,.68611,.01597,0],87:[0,.68611,.01597,0],88:[0,.68611,0,0],89:[0,.68611,.02875,0],90:[0,.68611,0,0],91:[.25,.75,0,0],92:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.31,.13444,.03194,0],96:[0,.69444,0,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[0,.69444,.10903,0],103:[.19444,.44444,.01597,0],104:[0,.69444,0,0],105:[0,.69444,0,0],106:[.19444,.69444,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,0,0],114:[0,.44444,0,0],115:[0,.44444,0,0],116:[0,.63492,0,0],117:[0,.44444,0,0],118:[0,.44444,.01597,0],119:[0,.44444,.01597,0],120:[0,.44444,0,0],121:[.19444,.44444,.01597,0],122:[0,.44444,0,0],123:[.25,.75,0,0],124:[.25,.75,0,0],125:[.25,.75,0,0],126:[.35,.34444,0,0],168:[0,.69444,0,0],172:[0,.44444,0,0],175:[0,.59611,0,0],176:[0,.69444,0,0],177:[.13333,.63333,0,0],180:[0,.69444,0,0],215:[.13333,.63333,0,0],247:[.13333,.63333,0,0],305:[0,.44444,0,0],567:[.19444,.44444,0,0],710:[0,.69444,0,0],711:[0,.63194,0,0],713:[0,.59611,0,0],714:[0,.69444,0,0],715:[0,.69444,0,0],728:[0,.69444,0,0],729:[0,.69444,0,0],730:[0,.69444,0,0],732:[0,.69444,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.69444,0,0],772:[0,.59611,0,0],774:[0,.69444,0,0],775:[0,.69444,0,0],776:[0,.69444,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.63194,0,0],824:[.19444,.69444,0,0],915:[0,.68611,0,0],916:[0,.68611,0,0],920:[0,.68611,0,0],923:[0,.68611,0,0],926:[0,.68611,0,0],928:[0,.68611,0,0],931:[0,.68611,0,0],933:[0,.68611,0,0],934:[0,.68611,0,0],936:[0,.68611,0,0],937:[0,.68611,0,0],8211:[0,.44444,.03194,0],8212:[0,.44444,.03194,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0],8224:[.19444,.69444,0,0],8225:[.19444,.69444,0,0],8242:[0,.55556,0,0],8407:[0,.72444,.15486,0],8463:[0,.69444,0,0],8465:[0,.69444,0,0],8467:[0,.69444,0,0],8472:[.19444,.44444,0,0],8476:[0,.69444,0,0],8501:[0,.69444,0,0],8592:[-.10889,.39111,0,0],8593:[.19444,.69444,0,0],8594:[-.10889,.39111,0,0],8595:[.19444,.69444,0,0],8596:[-.10889,.39111,0,0],8597:[.25,.75,0,0],8598:[.19444,.69444,0,0],8599:[.19444,.69444,0,0],8600:[.19444,.69444,0,0],8601:[.19444,.69444,0,0],8636:[-.10889,.39111,0,0],8637:[-.10889,.39111,0,0],8640:[-.10889,.39111,0,0],8641:[-.10889,.39111,0,0],8656:[-.10889,.39111,0,0],8657:[.19444,.69444,0,0],8658:[-.10889,.39111,0,0],8659:[.19444,.69444,0,0],8660:[-.10889,.39111,0,0],8661:[.25,.75,0,0],8704:[0,.69444,0,0],8706:[0,.69444,.06389,0],8707:[0,.69444,0,0],8709:[.05556,.75,0,0],8711:[0,.68611,0,0],8712:[.08556,.58556,0,0],8715:[.08556,.58556,0,0],8722:[.13333,.63333,0,0],8723:[.13333,.63333,0,0],8725:[.25,.75,0,0],8726:[.25,.75,0,0],8727:[-.02778,.47222,0,0],8728:[-.02639,.47361,0,0],8729:[-.02639,.47361,0,0],8730:[.18,.82,0,0],8733:[0,.44444,0,0],8734:[0,.44444,0,0],8736:[0,.69224,0,0],8739:[.25,.75,0,0],8741:[.25,.75,0,0],8743:[0,.55556,0,0],8744:[0,.55556,0,0],8745:[0,.55556,0,0],8746:[0,.55556,0,0],8747:[.19444,.69444,.12778,0],8764:[-.10889,.39111,0,0],8768:[.19444,.69444,0,0],8771:[.00222,.50222,0,0],8776:[.02444,.52444,0,0],8781:[.00222,.50222,0,0],8801:[.00222,.50222,0,0],8804:[.19667,.69667,0,0],8805:[.19667,.69667,0,0],8810:[.08556,.58556,0,0],8811:[.08556,.58556,0,0],8826:[.08556,.58556,0,0],8827:[.08556,.58556,0,0],8834:[.08556,.58556,0,0],8835:[.08556,.58556,0,0],8838:[.19667,.69667,0,0],8839:[.19667,.69667,0,0],8846:[0,.55556,0,0],8849:[.19667,.69667,0,0],8850:[.19667,.69667,0,0],8851:[0,.55556,0,0],8852:[0,.55556,0,0],8853:[.13333,.63333,0,0],8854:[.13333,.63333,0,0],8855:[.13333,.63333,0,0],8856:[.13333,.63333,0,0],8857:[.13333,.63333,0,0],8866:[0,.69444,0,0],8867:[0,.69444,0,0],8868:[0,.69444,0,0],8869:[0,.69444,0,0],8900:[-.02639,.47361,0,0],8901:[-.02639,.47361,0,0],8902:[-.02778,.47222,0,0],8968:[.25,.75,0,0],8969:[.25,.75,0,0],8970:[.25,.75,0,0],8971:[.25,.75,0,0],8994:[-.13889,.36111,0,0],8995:[-.13889,.36111,0,0],9651:[.19444,.69444,0,0],9657:[-.02778,.47222,0,0],9661:[.19444,.69444,0,0],9667:[-.02778,.47222,0,0],9711:[.19444,.69444,0,0],9824:[.12963,.69444,0,0],9825:[.12963,.69444,0,0],9826:[.12963,.69444,0,0],9827:[.12963,.69444,0,0],9837:[0,.75,0,0],9838:[.19444,.69444,0,0],9839:[.19444,.69444,0,0],10216:[.25,.75,0,0],10217:[.25,.75,0,0],10815:[0,.68611,0,0],10927:[.19667,.69667,0,0],10928:[.19667,.69667,0,0]},"Main-Italic":{33:[0,.69444,.12417,0],34:[0,.69444,.06961,0],35:[.19444,.69444,.06616,0],37:[.05556,.75,.13639,0],38:[0,.69444,.09694,0],39:[0,.69444,.12417,0],40:[.25,.75,.16194,0],41:[.25,.75,.03694,0],42:[0,.75,.14917,0],43:[.05667,.56167,.03694,0],44:[.19444,.10556,0,0],45:[0,.43056,.02826,0],46:[0,.10556,0,0],47:[.25,.75,.16194,0],48:[0,.64444,.13556,0],49:[0,.64444,.13556,0],50:[0,.64444,.13556,0],51:[0,.64444,.13556,0],52:[.19444,.64444,.13556,0],53:[0,.64444,.13556,0],54:[0,.64444,.13556,0],55:[.19444,.64444,.13556,0],56:[0,.64444,.13556,0],57:[0,.64444,.13556,0],58:[0,.43056,.0582,0],59:[.19444,.43056,.0582,0],61:[-.13313,.36687,.06616,0],63:[0,.69444,.1225,0],64:[0,.69444,.09597,0],65:[0,.68333,0,0],66:[0,.68333,.10257,0],67:[0,.68333,.14528,0],68:[0,.68333,.09403,0],69:[0,.68333,.12028,0],70:[0,.68333,.13305,0],71:[0,.68333,.08722,0],72:[0,.68333,.16389,0],73:[0,.68333,.15806,0],74:[0,.68333,.14028,0],75:[0,.68333,.14528,0],76:[0,.68333,0,0],77:[0,.68333,.16389,0],78:[0,.68333,.16389,0],79:[0,.68333,.09403,0],80:[0,.68333,.10257,0],81:[.19444,.68333,.09403,0],82:[0,.68333,.03868,0],83:[0,.68333,.11972,0],84:[0,.68333,.13305,0],85:[0,.68333,.16389,0],86:[0,.68333,.18361,0],87:[0,.68333,.18361,0],88:[0,.68333,.15806,0],89:[0,.68333,.19383,0],90:[0,.68333,.14528,0],91:[.25,.75,.1875,0],93:[.25,.75,.10528,0],94:[0,.69444,.06646,0],95:[.31,.12056,.09208,0],97:[0,.43056,.07671,0],98:[0,.69444,.06312,0],99:[0,.43056,.05653,0],100:[0,.69444,.10333,0],101:[0,.43056,.07514,0],102:[.19444,.69444,.21194,0],103:[.19444,.43056,.08847,0],104:[0,.69444,.07671,0],105:[0,.65536,.1019,0],106:[.19444,.65536,.14467,0],107:[0,.69444,.10764,0],108:[0,.69444,.10333,0],109:[0,.43056,.07671,0],110:[0,.43056,.07671,0],111:[0,.43056,.06312,0],112:[.19444,.43056,.06312,0],113:[.19444,.43056,.08847,0],114:[0,.43056,.10764,0],115:[0,.43056,.08208,0],116:[0,.61508,.09486,0],117:[0,.43056,.07671,0],118:[0,.43056,.10764,0],119:[0,.43056,.10764,0],120:[0,.43056,.12042,0],121:[.19444,.43056,.08847,0],122:[0,.43056,.12292,0],126:[.35,.31786,.11585,0],163:[0,.69444,0,0],305:[0,.43056,0,.02778],567:[.19444,.43056,0,.08334],768:[0,.69444,0,0],769:[0,.69444,.09694,0],770:[0,.69444,.06646,0],771:[0,.66786,.11585,0],772:[0,.56167,.10333,0],774:[0,.69444,.10806,0],775:[0,.66786,.11752,0],776:[0,.66786,.10474,0],778:[0,.69444,0,0],779:[0,.69444,.1225,0],780:[0,.62847,.08295,0],915:[0,.68333,.13305,0],916:[0,.68333,0,0],920:[0,.68333,.09403,0],923:[0,.68333,0,0],926:[0,.68333,.15294,0],928:[0,.68333,.16389,0],931:[0,.68333,.12028,0],933:[0,.68333,.11111,0],934:[0,.68333,.05986,0],936:[0,.68333,.11111,0],937:[0,.68333,.10257,0],8211:[0,.43056,.09208,0],8212:[0,.43056,.09208,0],8216:[0,.69444,.12417,0],8217:[0,.69444,.12417,0],8220:[0,.69444,.1685,0],8221:[0,.69444,.06961,0],8463:[0,.68889,0,0]},"Main-Regular":{32:[0,0,0,0],33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.08333,.58333,0,0],44:[.19444,.10556,0,0],45:[0,.43056,0,0],46:[0,.10556,0,0],47:[.25,.75,0,0],48:[0,.64444,0,0],49:[0,.64444,0,0],50:[0,.64444,0,0],51:[0,.64444,0,0],52:[0,.64444,0,0],53:[0,.64444,0,0],54:[0,.64444,0,0],55:[0,.64444,0,0],56:[0,.64444,0,0],57:[0,.64444,0,0],58:[0,.43056,0,0],59:[.19444,.43056,0,0],60:[.0391,.5391,0,0],61:[-.13313,.36687,0,0],62:[.0391,.5391,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.68333,0,0],66:[0,.68333,0,0],67:[0,.68333,0,0],68:[0,.68333,0,0],69:[0,.68333,0,0],70:[0,.68333,0,0],71:[0,.68333,0,0],72:[0,.68333,0,0],73:[0,.68333,0,0],74:[0,.68333,0,0],75:[0,.68333,0,0],76:[0,.68333,0,0],77:[0,.68333,0,0],78:[0,.68333,0,0],79:[0,.68333,0,0],80:[0,.68333,0,0],81:[.19444,.68333,0,0],82:[0,.68333,0,0],83:[0,.68333,0,0],84:[0,.68333,0,0],85:[0,.68333,0,0],86:[0,.68333,.01389,0],87:[0,.68333,.01389,0],88:[0,.68333,0,0],89:[0,.68333,.025,0],90:[0,.68333,0,0],91:[.25,.75,0,0],92:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.31,.12056,.02778,0],96:[0,.69444,0,0],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,0],100:[0,.69444,0,0],101:[0,.43056,0,0],102:[0,.69444,.07778,0],103:[.19444,.43056,.01389,0],104:[0,.69444,0,0],105:[0,.66786,0,0],106:[.19444,.66786,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,0],112:[.19444,.43056,0,0],113:[.19444,.43056,0,0],114:[0,.43056,0,0],115:[0,.43056,0,0],116:[0,.61508,0,0],117:[0,.43056,0,0],118:[0,.43056,.01389,0],119:[0,.43056,.01389,0],120:[0,.43056,0,0],121:[.19444,.43056,.01389,0],122:[0,.43056,0,0],123:[.25,.75,0,0],124:[.25,.75,0,0],125:[.25,.75,0,0],126:[.35,.31786,0,0],160:[0,0,0,0],168:[0,.66786,0,0],172:[0,.43056,0,0],175:[0,.56778,0,0],176:[0,.69444,0,0],177:[.08333,.58333,0,0],180:[0,.69444,0,0],215:[.08333,.58333,0,0],247:[.08333,.58333,0,0],305:[0,.43056,0,0],567:[.19444,.43056,0,0],710:[0,.69444,0,0],711:[0,.62847,0,0],713:[0,.56778,0,0],714:[0,.69444,0,0],715:[0,.69444,0,0],728:[0,.69444,0,0],729:[0,.66786,0,0],730:[0,.69444,0,0],732:[0,.66786,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.66786,0,0],772:[0,.56778,0,0],774:[0,.69444,0,0],775:[0,.66786,0,0],776:[0,.66786,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.62847,0,0],824:[.19444,.69444,0,0],915:[0,.68333,0,0],916:[0,.68333,0,0],920:[0,.68333,0,0],923:[0,.68333,0,0],926:[0,.68333,0,0],928:[0,.68333,0,0],931:[0,.68333,0,0],933:[0,.68333,0,0],934:[0,.68333,0,0],936:[0,.68333,0,0],937:[0,.68333,0,0],8211:[0,.43056,.02778,0],8212:[0,.43056,.02778,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0],8224:[.19444,.69444,0,0],8225:[.19444,.69444,0,0],8230:[0,.12,0,0],8242:[0,.55556,0,0],8407:[0,.71444,.15382,0],8463:[0,.68889,0,0],8465:[0,.69444,0,0],8467:[0,.69444,0,.11111],8472:[.19444,.43056,0,.11111],8476:[0,.69444,0,0],8501:[0,.69444,0,0],8592:[-.13313,.36687,0,0],8593:[.19444,.69444,0,0],8594:[-.13313,.36687,0,0],8595:[.19444,.69444,0,0],8596:[-.13313,.36687,0,0],8597:[.25,.75,0,0],8598:[.19444,.69444,0,0],8599:[.19444,.69444,0,0],8600:[.19444,.69444,0,0],8601:[.19444,.69444,0,0],8614:[.011,.511,0,0],8617:[.011,.511,0,0],8618:[.011,.511,0,0],8636:[-.13313,.36687,0,0],8637:[-.13313,.36687,0,0],8640:[-.13313,.36687,0,0],8641:[-.13313,.36687,0,0],8652:[.011,.671,0,0],8656:[-.13313,.36687,0,0],8657:[.19444,.69444,0,0],8658:[-.13313,.36687,0,0],8659:[.19444,.69444,0,0],8660:[-.13313,.36687,0,0],8661:[.25,.75,0,0],8704:[0,.69444,0,0],8706:[0,.69444,.05556,.08334],8707:[0,.69444,0,0],8709:[.05556,.75,0,0],8711:[0,.68333,0,0],8712:[.0391,.5391,0,0],8715:[.0391,.5391,0,0],8722:[.08333,.58333,0,0],8723:[.08333,.58333,0,0],8725:[.25,.75,0,0],8726:[.25,.75,0,0],8727:[-.03472,.46528,0,0],8728:[-.05555,.44445,0,0],8729:[-.05555,.44445,0,0],8730:[.2,.8,0,0],8733:[0,.43056,0,0],8734:[0,.43056,0,0],8736:[0,.69224,0,0],8739:[.25,.75,0,0],8741:[.25,.75,0,0],8743:[0,.55556,0,0],8744:[0,.55556,0,0],8745:[0,.55556,0,0],8746:[0,.55556,0,0],8747:[.19444,.69444,.11111,0],8764:[-.13313,.36687,0,0],8768:[.19444,.69444,0,0],8771:[-.03625,.46375,0,0],8773:[-.022,.589,0,0],8776:[-.01688,.48312,0,0],8781:[-.03625,.46375,0,0],8784:[-.133,.67,0,0],8800:[.215,.716,0,0],8801:[-.03625,.46375,0,0],8804:[.13597,.63597,0,0],8805:[.13597,.63597,0,0],8810:[.0391,.5391,0,0],8811:[.0391,.5391,0,0],8826:[.0391,.5391,0,0],8827:[.0391,.5391,0,0],8834:[.0391,.5391,0,0],8835:[.0391,.5391,0,0],8838:[.13597,.63597,0,0],8839:[.13597,.63597,0,0],8846:[0,.55556,0,0],8849:[.13597,.63597,0,0],8850:[.13597,.63597,0,0],8851:[0,.55556,0,0],8852:[0,.55556,0,0],8853:[.08333,.58333,0,0],8854:[.08333,.58333,0,0],8855:[.08333,.58333,0,0],8856:[.08333,.58333,0,0],8857:[.08333,.58333,0,0],8866:[0,.69444,0,0],8867:[0,.69444,0,0],8868:[0,.69444,0,0],8869:[0,.69444,0,0],8872:[.249,.75,0,0],8900:[-.05555,.44445,0,0],8901:[-.05555,.44445,0,0],8902:[-.03472,.46528,0,0],8904:[.005,.505,0,0],8942:[.03,.9,0,0],8943:[-.19,.31,0,0],8945:[-.1,.82,0,0],8968:[.25,.75,0,0],8969:[.25,.75,0,0],8970:[.25,.75,0,0],8971:[.25,.75,0,0],8994:[-.14236,.35764,0,0],8995:[-.14236,.35764,0,0],9136:[.244,.744,0,0],9137:[.244,.744,0,0],9651:[.19444,.69444,0,0],9657:[-.03472,.46528,0,0],9661:[.19444,.69444,0,0],9667:[-.03472,.46528,0,0],9711:[.19444,.69444,0,0],9824:[.12963,.69444,0,0],9825:[.12963,.69444,0,0],9826:[.12963,.69444,0,0],9827:[.12963,.69444,0,0],9837:[0,.75,0,0],9838:[.19444,.69444,0,0],9839:[.19444,.69444,0,0],10216:[.25,.75,0,0],10217:[.25,.75,0,0],10222:[.244,.744,0,0],10223:[.244,.744,0,0],10229:[.011,.511,0,0],10230:[.011,.511,0,0],10231:[.011,.511,0,0],10232:[.024,.525,0,0],10233:[.024,.525,0,0],10234:[.024,.525,0,0],10236:[.011,.511,0,0],10815:[0,.68333,0,0],10927:[.13597,.63597,0,0],10928:[.13597,.63597,0,0]},"Math-BoldItalic":{47:[.19444,.69444,0,0],65:[0,.68611,0,0],66:[0,.68611,.04835,0],67:[0,.68611,.06979,0],68:[0,.68611,.03194,0],69:[0,.68611,.05451,0],70:[0,.68611,.15972,0],71:[0,.68611,0,0],72:[0,.68611,.08229,0],73:[0,.68611,.07778,0],74:[0,.68611,.10069,0],75:[0,.68611,.06979,0],76:[0,.68611,0,0],77:[0,.68611,.11424,0],78:[0,.68611,.11424,0],79:[0,.68611,.03194,0],80:[0,.68611,.15972,0],81:[.19444,.68611,0,0],82:[0,.68611,.00421,0],83:[0,.68611,.05382,0],84:[0,.68611,.15972,0],85:[0,.68611,.11424,0],86:[0,.68611,.25555,0],87:[0,.68611,.15972,0],88:[0,.68611,.07778,0],89:[0,.68611,.25555,0],90:[0,.68611,.06979,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[.19444,.69444,.11042,0],103:[.19444,.44444,.03704,0],104:[0,.69444,0,0],105:[0,.69326,0,0],106:[.19444,.69326,.0622,0],107:[0,.69444,.01852,0],108:[0,.69444,.0088,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,.03704,0],114:[0,.44444,.03194,0],115:[0,.44444,0,0],116:[0,.63492,0,0],117:[0,.44444,0,0],118:[0,.44444,.03704,0],119:[0,.44444,.02778,0],120:[0,.44444,0,0],121:[.19444,.44444,.03704,0],122:[0,.44444,.04213,0],915:[0,.68611,.15972,0],916:[0,.68611,0,0],920:[0,.68611,.03194,0],923:[0,.68611,0,0],926:[0,.68611,.07458,0],928:[0,.68611,.08229,0],931:[0,.68611,.05451,0],933:[0,.68611,.15972,0],934:[0,.68611,0,0],936:[0,.68611,.11653,0],937:[0,.68611,.04835,0],945:[0,.44444,0,0],946:[.19444,.69444,.03403,0],947:[.19444,.44444,.06389,0],948:[0,.69444,.03819,0],949:[0,.44444,0,0],950:[.19444,.69444,.06215,0],951:[.19444,.44444,.03704,0],952:[0,.69444,.03194,0],953:[0,.44444,0,0],954:[0,.44444,0,0],955:[0,.69444,0,0],956:[.19444,.44444,0,0],957:[0,.44444,.06898,0],958:[.19444,.69444,.03021,0],959:[0,.44444,0,0],960:[0,.44444,.03704,0],961:[.19444,.44444,0,0],962:[.09722,.44444,.07917,0],963:[0,.44444,.03704,0],964:[0,.44444,.13472,0],965:[0,.44444,.03704,0],966:[.19444,.44444,0,0],967:[.19444,.44444,0,0],968:[.19444,.69444,.03704,0],969:[0,.44444,.03704,0],977:[0,.69444,0,0],981:[.19444,.69444,0,0],982:[0,.44444,.03194,0],1009:[.19444,.44444,0,0],1013:[0,.44444,0,0]},"Math-Italic":{47:[.19444,.69444,0,0],65:[0,.68333,0,.13889],66:[0,.68333,.05017,.08334],67:[0,.68333,.07153,.08334],68:[0,.68333,.02778,.05556],69:[0,.68333,.05764,.08334],70:[0,.68333,.13889,.08334],71:[0,.68333,0,.08334],72:[0,.68333,.08125,.05556],73:[0,.68333,.07847,.11111],74:[0,.68333,.09618,.16667],75:[0,.68333,.07153,.05556],76:[0,.68333,0,.02778],77:[0,.68333,.10903,.08334],78:[0,.68333,.10903,.08334],79:[0,.68333,.02778,.08334],80:[0,.68333,.13889,.08334],81:[.19444,.68333,0,.08334],82:[0,.68333,.00773,.08334],83:[0,.68333,.05764,.08334],84:[0,.68333,.13889,.08334],85:[0,.68333,.10903,.02778],86:[0,.68333,.22222,0],87:[0,.68333,.13889,0],88:[0,.68333,.07847,.08334],89:[0,.68333,.22222,0],90:[0,.68333,.07153,.08334],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,.05556],100:[0,.69444,0,.16667],101:[0,.43056,0,.05556],102:[.19444,.69444,.10764,.16667],103:[.19444,.43056,.03588,.02778],104:[0,.69444,0,0],105:[0,.65952,0,0],106:[.19444,.65952,.05724,0],107:[0,.69444,.03148,0],108:[0,.69444,.01968,.08334],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,.05556],112:[.19444,.43056,0,.08334],113:[.19444,.43056,.03588,.08334],114:[0,.43056,.02778,.05556],115:[0,.43056,0,.05556],116:[0,.61508,0,.08334],117:[0,.43056,0,.02778],118:[0,.43056,.03588,.02778],119:[0,.43056,.02691,.08334],120:[0,.43056,0,.02778],121:[.19444,.43056,.03588,.05556],122:[0,.43056,.04398,.05556],915:[0,.68333,.13889,.08334],916:[0,.68333,0,.16667],920:[0,.68333,.02778,.08334],923:[0,.68333,0,.16667],926:[0,.68333,.07569,.08334],928:[0,.68333,.08125,.05556],931:[0,.68333,.05764,.08334],933:[0,.68333,.13889,.05556],934:[0,.68333,0,.08334],936:[0,.68333,.11,.05556],937:[0,.68333,.05017,.08334],945:[0,.43056,.0037,.02778],946:[.19444,.69444,.05278,.08334],947:[.19444,.43056,.05556,0],948:[0,.69444,.03785,.05556],949:[0,.43056,0,.08334],950:[.19444,.69444,.07378,.08334],951:[.19444,.43056,.03588,.05556],952:[0,.69444,.02778,.08334],953:[0,.43056,0,.05556],954:[0,.43056,0,0],955:[0,.69444,0,0],956:[.19444,.43056,0,.02778],957:[0,.43056,.06366,.02778],958:[.19444,.69444,.04601,.11111],959:[0,.43056,0,.05556],960:[0,.43056,.03588,0],961:[.19444,.43056,0,.08334],962:[.09722,.43056,.07986,.08334],963:[0,.43056,.03588,0],964:[0,.43056,.1132,.02778],965:[0,.43056,.03588,.02778],966:[.19444,.43056,0,.08334],967:[.19444,.43056,0,.05556],968:[.19444,.69444,.03588,.11111],969:[0,.43056,.03588,0],977:[0,.69444,0,.08334],981:[.19444,.69444,0,.08334],982:[0,.43056,.02778,0],1009:[.19444,.43056,0,.08334],1013:[0,.43056,0,.05556]},"Math-Regular":{65:[0,.68333,0,.13889],66:[0,.68333,.05017,.08334],67:[0,.68333,.07153,.08334],68:[0,.68333,.02778,.05556],69:[0,.68333,.05764,.08334],70:[0,.68333,.13889,.08334],71:[0,.68333,0,.08334],72:[0,.68333,.08125,.05556],73:[0,.68333,.07847,.11111],74:[0,.68333,.09618,.16667],75:[0,.68333,.07153,.05556],76:[0,.68333,0,.02778],77:[0,.68333,.10903,.08334],78:[0,.68333,.10903,.08334],79:[0,.68333,.02778,.08334],80:[0,.68333,.13889,.08334],81:[.19444,.68333,0,.08334],82:[0,.68333,.00773,.08334],83:[0,.68333,.05764,.08334],84:[0,.68333,.13889,.08334],85:[0,.68333,.10903,.02778],86:[0,.68333,.22222,0],87:[0,.68333,.13889,0],88:[0,.68333,.07847,.08334],89:[0,.68333,.22222,0],90:[0,.68333,.07153,.08334],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,.05556],100:[0,.69444,0,.16667],101:[0,.43056,0,.05556],102:[.19444,.69444,.10764,.16667],103:[.19444,.43056,.03588,.02778],104:[0,.69444,0,0],105:[0,.65952,0,0],106:[.19444,.65952,.05724,0],107:[0,.69444,.03148,0],108:[0,.69444,.01968,.08334],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,.05556],112:[.19444,.43056,0,.08334],113:[.19444,.43056,.03588,.08334],114:[0,.43056,.02778,.05556],115:[0,.43056,0,.05556],116:[0,.61508,0,.08334],117:[0,.43056,0,.02778],118:[0,.43056,.03588,.02778],119:[0,.43056,.02691,.08334],120:[0,.43056,0,.02778],121:[.19444,.43056,.03588,.05556],122:[0,.43056,.04398,.05556],915:[0,.68333,.13889,.08334],916:[0,.68333,0,.16667],920:[0,.68333,.02778,.08334],923:[0,.68333,0,.16667],926:[0,.68333,.07569,.08334],928:[0,.68333,.08125,.05556],931:[0,.68333,.05764,.08334],933:[0,.68333,.13889,.05556],934:[0,.68333,0,.08334],936:[0,.68333,.11,.05556],937:[0,.68333,.05017,.08334],945:[0,.43056,.0037,.02778],946:[.19444,.69444,.05278,.08334],947:[.19444,.43056,.05556,0],948:[0,.69444,.03785,.05556],949:[0,.43056,0,.08334],950:[.19444,.69444,.07378,.08334],951:[.19444,.43056,.03588,.05556],952:[0,.69444,.02778,.08334],953:[0,.43056,0,.05556],954:[0,.43056,0,0],955:[0,.69444,0,0],956:[.19444,.43056,0,.02778],957:[0,.43056,.06366,.02778],958:[.19444,.69444,.04601,.11111],959:[0,.43056,0,.05556],960:[0,.43056,.03588,0],961:[.19444,.43056,0,.08334],962:[.09722,.43056,.07986,.08334],963:[0,.43056,.03588,0],964:[0,.43056,.1132,.02778],965:[0,.43056,.03588,.02778],966:[.19444,.43056,0,.08334],967:[.19444,.43056,0,.05556],968:[.19444,.69444,.03588,.11111],969:[0,.43056,.03588,0],977:[0,.69444,0,.08334],981:[.19444,.69444,0,.08334],982:[0,.43056,.02778,0],1009:[.19444,.43056,0,.08334],1013:[0,.43056,0,.05556]},"SansSerif-Regular":{33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.08333,.58333,0,0],44:[.125,.08333,0,0],45:[0,.44444,0,0],46:[0,.08333,0,0],47:[.25,.75,0,0],48:[0,.65556,0,0],49:[0,.65556,0,0],50:[0,.65556,0,0],51:[0,.65556,0,0],52:[0,.65556,0,0],53:[0,.65556,0,0],54:[0,.65556,0,0],55:[0,.65556,0,0],56:[0,.65556,0,0],57:[0,.65556,0,0],58:[0,.44444,0,0],59:[.125,.44444,0,0],61:[-.13,.37,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.69444,0,0],66:[0,.69444,0,0],67:[0,.69444,0,0],68:[0,.69444,0,0],69:[0,.69444,0,0],70:[0,.69444,0,0],71:[0,.69444,0,0],72:[0,.69444,0,0],73:[0,.69444,0,0],74:[0,.69444,0,0],75:[0,.69444,0,0],76:[0,.69444,0,0],77:[0,.69444,0,0],78:[0,.69444,0,0],79:[0,.69444,0,0],80:[0,.69444,0,0],81:[.125,.69444,0,0],82:[0,.69444,0,0],83:[0,.69444,0,0],84:[0,.69444,0,0],85:[0,.69444,0,0],86:[0,.69444,.01389,0],87:[0,.69444,.01389,0],88:[0,.69444,0,0],89:[0,.69444,.025,0],90:[0,.69444,0,0],91:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.35,.09444,.02778,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[0,.69444,.06944,0],103:[.19444,.44444,.01389,0],104:[0,.69444,0,0],105:[0,.67937,0,0],106:[.19444,.67937,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,0,0],114:[0,.44444,.01389,0],115:[0,.44444,0,0],116:[0,.57143,0,0],117:[0,.44444,0,0],118:[0,.44444,.01389,0],119:[0,.44444,.01389,0],120:[0,.44444,0,0],121:[.19444,.44444,.01389,0],122:[0,.44444,0,0],126:[.35,.32659,0,0],305:[0,.44444,0,0],567:[.19444,.44444,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.67659,0,0],772:[0,.60889,0,0],774:[0,.69444,0,0],775:[0,.67937,0,0],776:[0,.67937,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.63194,0,0],915:[0,.69444,0,0],916:[0,.69444,0,0],920:[0,.69444,0,0],923:[0,.69444,0,0],926:[0,.69444,0,0],928:[0,.69444,0,0],931:[0,.69444,0,0],933:[0,.69444,0,0],934:[0,.69444,0,0],936:[0,.69444,0,0],937:[0,.69444,0,0],8211:[0,.44444,.02778,0],8212:[0,.44444,.02778,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0]},"Script-Regular":{65:[0,.7,.22925,0],66:[0,.7,.04087,0],67:[0,.7,.1689,0],68:[0,.7,.09371,0],69:[0,.7,.18583,0],70:[0,.7,.13634,0],71:[0,.7,.17322,0],72:[0,.7,.29694,0],73:[0,.7,.19189,0],74:[.27778,.7,.19189,0],75:[0,.7,.31259,0],76:[0,.7,.19189,0],77:[0,.7,.15981,0],78:[0,.7,.3525,0],79:[0,.7,.08078,0],80:[0,.7,.08078,0],81:[0,.7,.03305,0],82:[0,.7,.06259,0],83:[0,.7,.19189,0],84:[0,.7,.29087,0],85:[0,.7,.25815,0],86:[0,.7,.27523,0],87:[0,.7,.27523,0],88:[0,.7,.26006,0],89:[0,.7,.2939,0],90:[0,.7,.24037,0]},"Size1-Regular":{40:[.35001,.85,0,0],41:[.35001,.85,0,0],47:[.35001,.85,0,0],91:[.35001,.85,0,0],92:[.35001,.85,0,0],93:[.35001,.85,0,0],123:[.35001,.85,0,0],125:[.35001,.85,0,0],710:[0,.72222,0,0],732:[0,.72222,0,0],770:[0,.72222,0,0],771:[0,.72222,0,0],8214:[-99e-5,.601,0,0],8593:[1e-5,.6,0,0],8595:[1e-5,.6,0,0],8657:[1e-5,.6,0,0],8659:[1e-5,.6,0,0],8719:[.25001,.75,0,0],8720:[.25001,.75,0,0],8721:[.25001,.75,0,0],8730:[.35001,.85,0,0],8739:[-.00599,.606,0,0],8741:[-.00599,.606,0,0],8747:[.30612,.805,.19445,0],8748:[.306,.805,.19445,0],8749:[.306,.805,.19445,0],8750:[.30612,.805,.19445,0],8896:[.25001,.75,0,0],8897:[.25001,.75,0,0],8898:[.25001,.75,0,0],8899:[.25001,.75,0,0],8968:[.35001,.85,0,0],8969:[.35001,.85,0,0],8970:[.35001,.85,0,0],8971:[.35001,.85,0,0],9168:[-99e-5,.601,0,0],10216:[.35001,.85,0,0],10217:[.35001,.85,0,0],10752:[.25001,.75,0,0],10753:[.25001,.75,0,0],10754:[.25001,.75,0,0],10756:[.25001,.75,0,0],10758:[.25001,.75,0,0]},"Size2-Regular":{40:[.65002,1.15,0,0],41:[.65002,1.15,0,0],47:[.65002,1.15,0,0],91:[.65002,1.15,0,0],92:[.65002,1.15,0,0],93:[.65002,1.15,0,0],123:[.65002,1.15,0,0],125:[.65002,1.15,0,0],710:[0,.75,0,0],732:[0,.75,0,0],770:[0,.75,0,0],771:[0,.75,0,0],8719:[.55001,1.05,0,0],8720:[.55001,1.05,0,0],8721:[.55001,1.05,0,0],8730:[.65002,1.15,0,0],8747:[.86225,1.36,.44445,0],8748:[.862,1.36,.44445,0],8749:[.862,1.36,.44445,0],8750:[.86225,1.36,.44445,0],8896:[.55001,1.05,0,0],8897:[.55001,1.05,0,0],8898:[.55001,1.05,0,0],8899:[.55001,1.05,0,0],8968:[.65002,1.15,0,0],8969:[.65002,1.15,0,0],8970:[.65002,1.15,0,0],8971:[.65002,1.15,0,0],10216:[.65002,1.15,0,0],10217:[.65002,1.15,0,0],10752:[.55001,1.05,0,0],10753:[.55001,1.05,0,0],10754:[.55001,1.05,0,0],10756:[.55001,1.05,0,0],10758:[.55001,1.05,0,0]},"Size3-Regular":{40:[.95003,1.45,0,0],41:[.95003,1.45,0,0],47:[.95003,1.45,0,0],91:[.95003,1.45,0,0],92:[.95003,1.45,0,0],93:[.95003,1.45,0,0],123:[.95003,1.45,0,0],125:[.95003,1.45,0,0],710:[0,.75,0,0],732:[0,.75,0,0],770:[0,.75,0,0],771:[0,.75,0,0],8730:[.95003,1.45,0,0],8968:[.95003,1.45,0,0],8969:[.95003,1.45,0,0],8970:[.95003,1.45,0,0],8971:[.95003,1.45,0,0],10216:[.95003,1.45,0,0],10217:[.95003,1.45,0,0]},"Size4-Regular":{40:[1.25003,1.75,0,0],41:[1.25003,1.75,0,0],47:[1.25003,1.75,0,0],91:[1.25003,1.75,0,0],92:[1.25003,1.75,0,0],93:[1.25003,1.75,0,0],123:[1.25003,1.75,0,0],125:[1.25003,1.75,0,0],710:[0,.825,0,0],732:[0,.825,0,0],770:[0,.825,0,0],771:[0,.825,0,0],8730:[1.25003,1.75,0,0],8968:[1.25003,1.75,0,0],8969:[1.25003,1.75,0,0],8970:[1.25003,1.75,0,0],8971:[1.25003,1.75,0,0],9115:[.64502,1.155,0,0],9116:[1e-5,.6,0,0],9117:[.64502,1.155,0,0],9118:[.64502,1.155,0,0],9119:[1e-5,.6,0,0],9120:[.64502,1.155,0,0],9121:[.64502,1.155,0,0],9122:[-99e-5,.601,0,0],9123:[.64502,1.155,0,0],9124:[.64502,1.155,0,0],9125:[-99e-5,.601,0,0],9126:[.64502,1.155,0,0],9127:[1e-5,.9,0,0],9128:[.65002,1.15,0,0],9129:[.90001,0,0,0],9130:[0,.3,0,0],9131:[1e-5,.9,0,0],9132:[.65002,1.15,0,0],9133:[.90001,0,0,0],9143:[.88502,.915,0,0],10216:[1.25003,1.75,0,0],10217:[1.25003,1.75,0,0],57344:[-.00499,.605,0,0],57345:[-.00499,.605,0,0],57680:[0,.12,0,0],57681:[0,.12,0,0],57682:[0,.12,0,0],57683:[0,.12,0,0]},"Typewriter-Regular":{33:[0,.61111,0,0],34:[0,.61111,0,0],35:[0,.61111,0,0],36:[.08333,.69444,0,0],37:[.08333,.69444,0,0],38:[0,.61111,0,0],39:[0,.61111,0,0],40:[.08333,.69444,0,0],41:[.08333,.69444,0,0],42:[0,.52083,0,0],43:[-.08056,.53055,0,0],44:[.13889,.125,0,0],45:[-.08056,.53055,0,0],46:[0,.125,0,0],47:[.08333,.69444,0,0],48:[0,.61111,0,0],49:[0,.61111,0,0],50:[0,.61111,0,0],51:[0,.61111,0,0],52:[0,.61111,0,0],53:[0,.61111,0,0],54:[0,.61111,0,0],55:[0,.61111,0,0],56:[0,.61111,0,0],57:[0,.61111,0,0],58:[0,.43056,0,0],59:[.13889,.43056,0,0],60:[-.05556,.55556,0,0],61:[-.19549,.41562,0,0],62:[-.05556,.55556,0,0],63:[0,.61111,0,0],64:[0,.61111,0,0],65:[0,.61111,0,0],66:[0,.61111,0,0],67:[0,.61111,0,0],68:[0,.61111,0,0],69:[0,.61111,0,0],70:[0,.61111,0,0],71:[0,.61111,0,0],72:[0,.61111,0,0],73:[0,.61111,0,0],74:[0,.61111,0,0],75:[0,.61111,0,0],76:[0,.61111,0,0],77:[0,.61111,0,0],78:[0,.61111,0,0],79:[0,.61111,0,0],80:[0,.61111,0,0],81:[.13889,.61111,0,0],82:[0,.61111,0,0],83:[0,.61111,0,0],84:[0,.61111,0,0],85:[0,.61111,0,0],86:[0,.61111,0,0],87:[0,.61111,0,0],88:[0,.61111,0,0],89:[0,.61111,0,0],90:[0,.61111,0,0],91:[.08333,.69444,0,0],92:[.08333,.69444,0,0],93:[.08333,.69444,0,0],94:[0,.61111,0,0],95:[.09514,0,0,0],96:[0,.61111,0,0],97:[0,.43056,0,0],98:[0,.61111,0,0],99:[0,.43056,0,0],100:[0,.61111,0,0],101:[0,.43056,0,0],102:[0,.61111,0,0],103:[.22222,.43056,0,0],104:[0,.61111,0,0],105:[0,.61111,0,0],106:[.22222,.61111,0,0],107:[0,.61111,0,0],108:[0,.61111,0,0],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,0],112:[.22222,.43056,0,0],113:[.22222,.43056,0,0],114:[0,.43056,0,0],115:[0,.43056,0,0],116:[0,.55358,0,0],117:[0,.43056,0,0],118:[0,.43056,0,0],119:[0,.43056,0,0],120:[0,.43056,0,0],121:[.22222,.43056,0,0],122:[0,.43056,0,0],123:[.08333,.69444,0,0],124:[.08333,.69444,0,0],125:[.08333,.69444,0,0],126:[0,.61111,0,0],127:[0,.61111,0,0],305:[0,.43056,0,0],567:[.22222,.43056,0,0],768:[0,.61111,0,0],769:[0,.61111,0,0],770:[0,.61111,0,0],771:[0,.61111,0,0],772:[0,.56555,0,0],774:[0,.61111,0,0],776:[0,.61111,0,0],778:[0,.61111,0,0],780:[0,.56597,0,0],915:[0,.61111,0,0],916:[0,.61111,0,0],920:[0,.61111,0,0],923:[0,.61111,0,0],926:[0,.61111,0,0],928:[0,.61111,0,0],931:[0,.61111,0,0],933:[0,.61111,0,0],934:[0,.61111,0,0],936:[0,.61111,0,0],937:[0,.61111,0,0],2018:[0,.61111,0,0],2019:[0,.61111,0,0],8242:[0,.61111,0,0]}};const l=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,c={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:[.677,.732,.925],num2:[.394,.384,.387],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]},h={defaultRuleThickness:.04,bigOpSpacing1:.111,bigOpSpacing2:.166,bigOpSpacing3:.2,bigOpSpacing4:.6,bigOpSpacing5:.1,ptPerEm:10,pxPerEm:40/3,doubleRuleSep:.2,arraycolsep:.5,baselineskip:1.2,arrayrulewidth:.04,fboxsep:.3,fboxrule:.04},d={" ":" ","​":" ","Å":"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 p(t,e,i){if("string"==typeof t){const i=t.match(/([-+]?[0-9.]*)\s*([a-zA-Z]+)/);i?(t=parseFloat(i[1]),e=i[2].toLowerCase()):t=parseFloat(t)}const s={pt:1,mm:7227/2540,cm:7227/254,ex:35271/8192,px:.75,em:h.ptPerEm,bp:1.00375,dd:1238/1157,pc:12,in:72.27,mu:10/18}[e]||1;if(isFinite(i)){const e=Math.pow(10,i);return Math.round(t/h.ptPerEm*s*e)/e}return t/h.ptPerEm*s}var m={toEm:p,toPx:function(t,e){return p(t,e)*(4/3)*h.ptPerEm},METRICS:h,SIGMAS:c,getCharacterMetrics:function(t,e){const i={cal:"Caligraphic-Regular",ams:"AMS-Regular",frak:"Fraktur-Regular",bb:"AMS-Regular",scr:"Script-Regular",cmr:"Main-Regular",cmtt:"Typewriter-Regular",cmss:"SansSerif-Regular"}[e]||e;let s=t.charCodeAt(0);t[0]in d?s=d[t[0]].charCodeAt(0):l.test(t[0])&&(s=77);const a=r[i][s];return a?a?{depth:a[0],height:a[1],italic:a[2],skew:a[3]}:null:{defaultMetrics:!0,depth:.2,height:.7,italic:0,skew:0}}};const u=[{},{},{}];let f;for(const t in c)if(Object.prototype.hasOwnProperty.call(c,t))for(f=0;f<3;f++)u[f][t]=c[t][f];for(f=0;f<3;f++)u[f].emPerEx=c.xHeight[f]/c.quad[f];class g{constructor(t,e,i,s){this.id=t,this.size=e,this.cramped=s,this.sizeMultiplier=i,this.metrics=u[e>0?e-1:0]}sup(){return y[k[this.id]]}sub(){return y[v[this.id]]}fracNum(){return y[w[this.id]]}fracDen(){return y[S[this.id]]}cramp(){return y[A[this.id]]}cls(){return b[this.size]}adjustTo(t){let e=x[this.size][t.size];return e.length>0&&(e=" "+e),e}isTight(){return this.size>=2}}const y=[new g(0,0,1,!1),new g(1,0,1,!0),new g(2,1,1,!1),new g(3,1,1,!0),new g(4,2,.7,!1),new g(5,2,.7,!0),new g(6,3,.5,!1),new g(7,3,.5,!0)],b=["displaystyle textstyle","textstyle","scriptstyle","scriptscriptstyle"],x=[["","","reset-textstyle scriptstyle","reset-textstyle scriptscriptstyle"],["reset-textstyle displaystyle textstyle","","reset-textstyle scriptstyle","reset-textstyle scriptscriptstyle"],["reset-scriptstyle textstyle displaystyle","reset-scriptstyle textstyle","","reset-scriptstyle scriptscriptstyle"],["reset-scriptscriptstyle textstyle displaystyle","reset-scriptscriptstyle textstyle","reset-scriptscriptstyle scriptstyle",""]],k=[4,5,4,5,6,7,6,7],v=[5,5,5,5,7,7,7,7],w=[2,3,4,5,6,7,6,7],S=[3,3,5,5,7,7,7,7],A=[1,1,3,3,5,5,7,7];var M={DISPLAY:y[0],TEXT:y[2],SCRIPT:y[4],SCRIPTSCRIPT:y[6],toMathstyle:function(t){return t?"object"==typeof t?t:{displaystyle:y[0],textstyle:y[2],scriptstyle:y[4],scriptscriptstyle:y[6]}[t]:t}};class C{constructor(t){this.macros=t.macros||{},this.generateID=!!t.generateID&&t.generateID,this.mathstyle=M.toMathstyle(t.mathstyle||"displaystyle"),this.size=t.size||"size5",this.parentMathstyle=t.parentMathstyle||this.mathstyle,this.parentSize=t.parentSize||this.size,this.opacity=t.opacity}clone(t){const e=new C(this);return e.parentMathstyle=this.mathstyle,e.parentSize=this.size,e.macros=this.macros,t&&("auto"!==t.mathstyle&&t.mathstyle||delete t.mathstyle,Object.assign(e,t),"string"==typeof t.mathstyle&&(e.mathstyle=M.toMathstyle(t.mathstyle))),e}setMathstyle(t){t&&"auto"!==t&&(this.mathstyle=M.toMathstyle(t))}cramp(){return this.clone({mathstyle:this.mathstyle.cramp()})}sup(){return this.clone({mathstyle:this.mathstyle.sup()})}sub(){return this.clone({mathstyle:this.mathstyle.sup()})}}var _=C;function T(t){let e="";if("number"==typeof t)e+=Math.floor(100*t)/100;else if("string"==typeof t)e+=t;else if(Array.isArray(t))for(const i of t)e+=T(i);else t&&(e+=t.toString());return e}class L{constructor(t,e){this.classes=e||"",Array.isArray(t)?this.children=[].concat.apply([],t):"string"==typeof t?this.body=t:t&&"object"==typeof t&&(this.children=[t]),this.style=null,this.updateDimensions()}updateDimensions(){let t=0,e=0,i=1;this.children&&this.children.forEach(s=>{s.height>t&&(t=s.height),s.depth>e&&(e=s.depth),s.maxFontSize>i&&(i=s.maxFontSize)}),this.height=t,this.depth=e,this.maxFontSize=i}selected(t){t&&!/ML__selected/.test(this.classes)&&(this.classes.length>0&&(this.classes+=" "),this.classes+="ML__selected"),!t&&/ML__selected/.test(this.classes)&&(this.classes=this.classes.replace("ML__selected","")),this.children&&this.children.forEach(e=>e.selected(t))}applyStyle(t){if(!t)return;if(t.color&&("none"!==t.color?this.setStyle("color",t.color):this.setStyle("color","")),t.backgroundColor&&("none"!==t.backgroundColor?this.setStyle("background-color",t.backgroundColor):this.setStyle("background-color","")),t.cssClass&&(this.classes+=" "+t.cssClass),!this.body)return;let e=t.fontFamily;"math"===e&&"n"===t.fontShape&&(e="cmr");let i="Main-Regular";if(e&&(i=function(t,e){if("string"!=typeof t||t.length>1||"​"===t)return K[e];if("bb"===e||"scr"===e){if(!/^[A-Z ]$/.test(t))return null}else if("cal"===e){if(!/^[0-9A-Z ]$/.test(t))return null}else if("frak"===e){if(!/^[0-9A-Za-z ]$|^[!"#$%&'()*+,\-./:;=?[]^’‘]$/.test(t))return null}else if(("cmtt"===e||"cmss"===e)&&!/^[0-9A-Za-z ]$|^[!"&'()*+,\-./:;=?@[]^_~\u0131\u0237\u0393\u0394\u0398\u039b\u039e\u03A0\u03A3\u03A5\u03A8\u03a9’‘]$/.test(t))return null;return K[e]}(this.body,e)),t.fontShape&&(this.classes+=" "+({it:"ML__it",sl:"ML__shape_sl",sc:"ML__shape_sc",ol:"ML__shape_ol"}[t.fontShape]||"")),t.fontSeries){const e=t.fontSeries.match(/(.?[lbm])?(.?[cx])?/);e&&(this.classes+=" "+({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"}[e[1]||""]||""),this.classes+=" "+({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"}[e[2]||""]||""))}if(N[e]?this.classes+=" "+N[e]:e&&this.setStyle("font-family",e),this.body&&this.body.length>0&&i){this.height=0,this.depth=0,this.maxFontSize={size1:.5,size2:.7,size3:.8,size4:.9,size5:1,size6:1.2,size7:1.44,size8:1.73,size9:2.07,size10:2.49}[t.fontSize]||1,this.skew=0,this.italic=0;for(let t=0;t0&&(this.style||(this.style={}),this.style[t]=i)}setTop(t){t&&0!==t&&(this.style||(this.style={}),this.style.top=T(t)+"em",this.height-=t,this.depth+=t)}setLeft(t){t&&0!==t&&(this.style||(this.style={}),this.style["margin-left"]=T(t)+"em")}setRight(t){t&&0!==t&&(this.style||(this.style={}),this.style["margin-right"]=T(t)+"em")}setWidth(t){t&&0!==t&&(this.style||(this.style={}),this.style.width=T(t)+"em")}addMarginRight(t){if(t&&0!==t){if(!this.style&&!/qquad|quad|enspace|thickspace|mediumspace|thinspace|negativethinspace/.test(this.classes)){const e={2:"qquad",1:"quad",".5":"enspace",.277778:"thickspace",.222222:"mediumspace",.166667:"thinspace","-0.166667":"negativethinspace"}[t.toString()];if(e)return void(this.classes+=" rspace "+e)}this.style||(this.style={});const e=parseFloat(this.style["margin-right"]||"0");this.style["margin-right"]=T(e+t)+"em"}}toMarkup(t,e){t=t||0,e=e||1;let i="",s=this.body||"";if(this.children){let t="none";for(const i of this.children){let a=0;if(t){let s=i.type;s&&("textord"===s&&(s="mord"),"first"===s&&(s="none"),a=i.isTight?E[t+"+"+s]||0:F[t+"+"+s]||0,a=Math.floor(e*a))}s+=i.toMarkup(a,e),t=q(i)}}if("​"!==s&&s||this.classes&&"ML__selected"!==this.classes){if(i="1?e.filter((function(t,e,i){return t.length>0&&i.indexOf(t)===e})).join(" "):e[0],a.length>0&&(i+=' class="'+a+'"'),t&&(this.style&&this.style["margin-left"]?this.style["margin-left"]=T(parseFloat(this.style["margin-left"])+t/18)+"em":t<0&&z[-t]?s=z[-t]+s:D[t]?s=D[t]+s:(this.style||(this.style={}),this.style["margin-left"]=T(t/18)+"em")),this.style){let t="";const e=/ML__selected/.test(this.classes);for(const i in this.style)Object.prototype.hasOwnProperty.call(this.style,i)&&("background-color"===i&&e||(t+=i+":"+this.style[i]+";"));t.length>0&&(i+=' style="'+t+'"')}i+=">",this.svgOverlay?(i+='",i+=""):i+=s,i+=""}else i="";return this.caret&&"command"!==this.type&&("text"===this.caret?i+='':i+=''),i}tryCoalesceWith(t){if(this.tag!==t.tag)return!1;if(this.type!==t.type)return!1;if("error"===this.type||"placeholder"===this.type||"command"===this.type)return!1;const e=this.children&&this.children.length>0,i=t.children&&t.children.length>0;if(e||i)return!1;if((this.style?this.style.length:0)!==(t.style?t.style.length:0))return!1;const s=this.classes.trim().replace(/\s+/g," ").split(" "),a=t.classes.trim().replace(/\s+/g," ").split(" ");if(s.length!==a.length)return!1;s.sort(),a.sort();for(let t=0;tMath.max(t,e.height),0):t.height:0}function I(t){return t?Array.isArray(t)?t.reduce((t,e)=>Math.max(t,e.depth),0):t.depth:0}function B(t,e){if(Array.isArray(t)){const i=[];for(const e of t)e&&i.push(e);if(1===i.length)return B(i[0],e)}return new L(t,e)}function O(t,e,i){const s=B(e,i);return s.type=t,s}function R(t,e){if(!e||0===e.length){if(t instanceof L)return t;if(Array.isArray(t)&&1===t.length)return t[0]}const i=new L(t,e);let s=1;return s=t instanceof L?t.maxFontSize:t.reduce((t,e)=>Math.max(t,e.maxFontSize),0),i.height*=s,i.depth*=s,i}const K={ams:"AMS-Regular",bb:"AMS-Regular",cal:"Caligraphic-Regular",frak:"Fraktur-Regular",scr:"Script-Regular",cmr:"Main-Regular",cmss:"SansSerif-Regular",cmtt:"Typewriter-Regular",math:"Math-Regular",mainit:"Main-Italic"},N={ams:"ML__ams",bb:"ML__bb",cal:"ML__cal",frak:"ML__frak",scr:"ML__script",cmr:"ML__mathrm",cmss:"ML__sans",cmtt:"ML__tt",math:"ML__mathit",mainit:"ML__mainit"};var $={coalesce:function t(e){if(!e||0===e.length)return[];e[0].children=t(e[0].children);const i=[e[0]];for(let s=1;s0?"em":""),s.attributes={"aria-hidden":!0}),"size5"!==t.size?new L(s,"fontsize-ensurer reset-"+t.size+" size5"):0!==i?s:null}(t,n),l=[];o=a;for(const t of e)if("number"==typeof t)o+=t;else{const e=B([r,t]);e.setTop(-t.depth-o),l.push(e),o+=t.height+t.depth}const c=B(l,"vlist");return c.depth=Math.max(a,I(c)||0),c.height=Math.max(-o,P(c)||0),c},makeHlist:R,makeStyleWrap:function(t,e,i,s,a){a=a||"";const o=R(e,(a+=" style-wrap ")+i.adjustTo(s));o.type=t;const n=s.sizeMultiplier/i.sizeMultiplier;return o.height*=n,o.depth*=n,o.maxFontSize=s.sizeMultiplier,o},makeSVG:function(t,e,i){return t.svgOverlay=e,t.svgStyle=i,t},height:P,depth:I,skew:function(t){if(!t)return 0;if(Array.isArray(t)){let e=0;for(const i of t)e+=i.skew||0;return e}return t.skew},italic:function(t){return t?Array.isArray(t)?t[t.length-1].italic:t.italic:0}};let W="";const H={},V={},U={},j="CRYPTIC",G="COMMON",Z="SUPERCOMMON",X={CRYPTIC:0,ARCANE:200,VERY_RARE:600,RARE:1200,UNCOMMON:2e3,COMMON:3e3,SUPERCOMMON:4e3};function J(t,...e){const i="string"==typeof t?X[t]:t;for(const t of e)H[t]&&(H[t].frequency=i),V[t]&&(V[t]=Object.assign({},V[t]),V[t].frequency=i)}function Y(t,e,i,s,a){e&&/^(ams|cmr|bb|cal|frak|scr)$/.test(e),"string"==typeof a&&(a=X[a]),H[t]={type:i===rt?lt:i,baseFontFamily:e,value:s,category:W,frequency:a}}function Q(t,e){for(let i=t;i<=e;i++){const t=String.fromCodePoint(i);Y(t,"","mord",t)}}const tt={8739:"|",183:"\\cdot",188:"\\frac{1}{4}",189:"\\frac{1}{2}",190:"\\frac{3}{4}",8304:"^{0}",8305:"^{i}",185:"^{1}",178:"^{2}",179:"^{3}",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",8243:"\\doubleprime",8736:"\\angle",8450:"\\C",8469:"\\N",8473:"\\P",8474:"\\Q",8477:"\\R",8484:"\\Z"};function et(t,e){const i=String.fromCodePoint(e);if("math"===t&&tt[i])return tt[i];if(e>32&&e<127)return i;let s="";if("math"===t){for(const t in H)if(Object.prototype.hasOwnProperty.call(H,t)&&H[t].value===i){s=t;break}}else for(const t in vt)if(Object.prototype.hasOwnProperty.call(vt,t)&&vt[t]===i){s=t;break}return s||i}const it={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},st=[{start:119808,len:26,offset:65,style:"bold"},{start:119834,len:26,offset:97,style:"bold"},{start:119860,len:26,offset:65,style:"italic"},{start:119886,len:26,offset:97,style:"italic"},{start:119912,len:26,offset:65,style:"bolditalic"},{start:119938,len:26,offset:97,style:"bolditalic"},{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: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:120432,len:26,offset:65,variant:"monospace"},{start:120458,len:26,offset:97,variant:"monospace"},{start:120488,len:25,offset:913,style:"bold"},{start:120514,len:25,offset:945,style:"bold"},{start:120546,len:25,offset:913,style:"italic"},{start:120572,len:25,offset:945,style:"italic"},{start:120604,len:25,offset:913,style:"bolditalic"},{start:120630,len:25,offset:945,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:120782,len:10,offset:48,variant:"",style:"bold"},{start:120792,len:10,offset:48,variant:"double-struck"},{start:120803,len:10,offset:48,variant:"sans-serif"},{start:120812,len:10,offset:48,variant:"sans-serif",style:"bold"},{start:120822,len:10,offset:48,variant:"monospace"}];function at(t){let e=t;if("string"==typeof t&&(e=t.codePointAt(0)),(e<119808||e>120831)&&(e<8448||e>8527))return{char:t};for(const t in it)if(Object.prototype.hasOwnProperty.call(it,t)&&it[t]===e){e=t;break}for(let t=0;t=st[t].start&&et.body).join("")}function yt(t,e,i,s){"string"==typeof t&&(t=[t]),i||(i={});const a=ft(e),o={category:W,params:a,parser:s,mathstyle:"displaystyle",tabular:i.tabular||!0,colFormat:i.colFormat||[]};for(const e of t)U[e]=o}function bt(t,e,i,s){"string"==typeof t&&(t=[t]),i||(i={});const a={category:W,baseFontFamily:i.fontFamily,params:ft(e),allowedInText:!!i.allowedInText,infix:!!i.infix,parse:s};for(const e of t)V[e]=a}W="Environments",yt("math","",{frequency:0},(function(){return{mathstyle:"textstyle"}})),yt("displaymath","",{frequency:8},(function(){return{mathstyle:"displaystyle"}})),yt("array","{columns:colspec}",{frequency:G},(function(t,e){return{colFormat:e[0],mathstyle:"textstyle"}})),yt("eqnarray","",{},(function(){return{}})),yt("equation","",{},(function(){return{colFormat:[{align:"c"}]}})),yt("subequations","",{},(function(){return{colFormat:[{align:"c"}]}})),yt("multline","",{},(function(){return{firstRowFormat:[{align:"l"}],colFormat:[{align:"c"}],lastRowFormat:[{align:"r"}]}})),yt(["align","aligned"],"",{},(function(t,e,i){let s=0;for(const t of i)s=Math.max(s,t.length);const a=[{gap:0},{align:"r"},{gap:0},{align:"l"}];let o=2;for(;o({color:e[0]})),bt("\\textcolor","{:color}{content:auto*}",{allowedInText:!0},(t,e)=>({color:e[0]})),J(3,"\\textcolor"),bt("\\overline","{:auto}",null,(function(t,e){return{type:"line",position:"overline",skipBoundary:!0,body:e[0]}})),J(G,"\\overline"),bt("\\underline","{:auto}",null,(function(t,e){return{type:"line",position:"underline",skipBoundary:!0,body:e[0]}})),J(G,"\\underline"),bt("\\overset","{annotation:auto}{symbol:auto}",null,(function(t,e){return{type:"overunder",overscript:e[0],skipBoundary:!0,body:e[1]}})),J(G,"\\overset"),bt("\\underset","{annotation:auto}{symbol:auto}",null,(function(t,e){return{type:"overunder",underscript:e[0],skipBoundary:!0,body:e[1]}})),J(G,"\\underset"),bt(["\\stackrel","\\stackbin"],"{annotation:auto}{symbol:auto}",null,(function(t,e){return{type:"overunder",overscript:e[0],skipBoundary:!0,body:e[1],mathtype:"\\stackrel"===t?"mrel":"mbin"}})),J(G,"\\stackrel"),J(0,"\\stackbin"),bt("\\rlap","{:auto}",null,(function(t,e){return{type:"overlap",align:"right",skipBoundary:!0,body:e[0]}})),J(270,"\\rlap"),bt("\\llap","{:auto}",null,(function(t,e){return{type:"overlap",align:"left",skipBoundary:!0,body:e[0]}})),J(18,"\\llap"),bt("\\mathrlap","{:auto}",null,(function(t,e){return{type:"overlap",mode:"math",align:"right",skipBoundary:!0,body:e[0]}})),J(j,"\\mathrlap"),bt("\\mathllap","{:auto}",null,(function(t,e){return{type:"overlap",mode:"math",align:"left",skipBoundary:!0,body:e[0]}})),J(j,"\\mathllap"),bt("\\boxed","{content:math}",null,(function(t,e){return{type:"box",framecolor:"black",skipBoundary:!0,body:e[0]}})),J(1236,"\\boxed"),bt("\\colorbox","{background-color:color}{content:auto}",{allowedInText:!0},(function(t,e){return{type:"box",backgroundcolor:e[0],skipBoundary:!0,body:e[1]}})),J(j,"\\colorbox"),bt("\\fcolorbox","{frame-color:color}{background-color:color}{content:auto}",{allowedInText:!0},(function(t,e){return{type:"box",framecolor:e[0],backgroundcolor:e[1],skipBoundary:!0,body:e[2]}})),J(j,"\\fcolorbox"),bt("\\bbox","[:bbox]{body:auto}",{allowedInText:!0},(function(t,e){return e[0]?{type:"box",padding:e[0].padding,border:e[0].border,backgroundcolor:e[0].backgroundcolor,skipBoundary:!0,body:e[1]}:{type:"box",skipBoundary:!0,body:e[1]}})),J(j,"\\bbox"),bt("\\enclose","{notation:string}[style:string]{body:auto}",null,(function(t,e){let i=e[0]||[];const s={type:"enclose",strokeColor:"currentColor",strokeWidth:1,strokeStyle:"solid",backgroundcolor:"transparent",padding:"auto",shadow:"auto",captureSelection:!0,body:e[2]};if(e[1]){const t=e[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const e of t){const t=e.match(/\s*(\S+)\s+(\S+)\s+(.*)/);if(t)s.strokeWidth=m.toPx(t[1],"px"),isFinite(s.strokeWidth)||(s.strokeWidth=1),s.strokeStyle=t[2],s.strokeColor=t[3];else{const t=e.match(/\s*([a-z]*)\s*=\s*"(.*)"/);t&&("mathbackground"===t[1]?s.backgroundcolor=t[2]:"mathcolor"===t[1]?s.strokeColor=t[2]:"padding"===t[1]?s.padding=m.toPx(t[2],"px"):"shadow"===t[1]&&(s.shadow=t[2]))}}"dashed"===s.strokeStyle?s.svgStrokeStyle="5,5":"dotted"===s.strokeStyle&&(s.svgStrokeStyle="1,5")}s.borderStyle=s.strokeWidth+"px "+s.strokeStyle+" "+s.strokeColor,i=i.toString().split(/[, ]/).filter(t=>t.length>0).map(t=>t.toLowerCase()),s.notation={};for(const t of i)s.notation[t]=!0;return s.notation.updiagonalarrow&&(s.notation.updiagonalstrike=!1),s.notation.box&&(s.notation.left=!1,s.notation.right=!1,s.notation.bottom=!1,s.notation.top=!1),s})),J(j,"\\enclose"),bt("\\cancel","{body:auto}",null,(function(t,e){return{type:"enclose",strokeColor:"currentColor",strokeWidth:1,strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"auto",notation:{updiagonalstrike:!0},body:e[0]}})),bt("\\bcancel","{body:auto}",null,(function(t,e){return{type:"enclose",strokeColor:"currentColor",strokeWidth:1,strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"auto",notation:{downdiagonalstrike:!0},body:e[0]}})),bt("\\xcancel","{body:auto}",null,(function(t,e){return{type:"enclose",strokeColor:"currentColor",strokeWidth:1,strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"auto",notation:{updiagonalstrike:!0,downdiagonalstrike:!0},body:e[0]}})),J(j,"\\cancel","\\bcancel","\\xcancel"),W="Styling",bt(["\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],"",{allowedInText:!0},(function(t,e){return{fontSize:{tiny:"size1",scriptsize:"size2",footnotesize:"size3",small:"size4",normalsize:"size5",large:"size6",Large:"size7",LARGE:"size8",huge:"size9",Huge:"size10"}[t.slice(1)]}})),bt("\\fontseries","{:text}",{allowedInText:!0},(t,e)=>({fontSeries:gt(e[0])})),bt("\\bf","",{allowedInText:!0},(t,e)=>({fontSeries:"b"})),bt("\\bm","{:math*}",{allowedInText:!0},(t,e)=>({fontSeries:"b"})),bt("\\bold","",{allowedInText:!0},(t,e)=>({mode:"math",fontSeries:"b"})),bt(["\\mathbf","\\boldsymbol"],"{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",fontSeries:"b",fontShape:"n"})),bt("\\bfseries","",{allowedInText:!0},(t,e)=>({fontSeries:"b"})),bt("\\textbf","{:text*}",{allowedInText:!0},(t,e)=>({fontSeries:"b"})),bt("\\mathmd","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",fontSeries:"m",fontShape:"n"})),bt("\\mdseries","",{allowedInText:!0},(t,e)=>({fontSeries:"m"})),bt("\\textmd","{:math*}",{allowedInText:!0},(t,e)=>({fontSeries:"m"})),bt("\\fontshape","{:text}",{allowedInText:!0},(t,e)=>({fontShape:gt(e[0])})),bt("\\it","",{allowedInText:!0},(t,e)=>({fontShape:"it"})),bt("\\mathit","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",fontSeries:"m",fontShape:"it"})),bt("\\upshape","",{allowedInText:!0},(t,e)=>({fontShape:"n"})),bt("\\textup","{:text*}",{allowedInText:!0},(t,e)=>({fontShape:"n"})),bt("\\textit","{:text*}",{allowedInText:!0},(t,e)=>({fontShape:"it"})),bt("\\slshape","",{allowedInText:!0},(t,e)=>({fontShape:"sl"})),bt("\\textsl","{:text*}",{allowedInText:!0},(t,e)=>({fontShape:"sl"})),bt("\\scshape","",{allowedInText:!0},(t,e)=>({mode:"text",fontShape:"sc"})),bt("\\textsc","{:text*}",{allowedInText:!0},(t,e)=>({fontShape:"sc"})),bt("\\fontfamily","{:text}",{allowedInText:!0},(t,e)=>({fontFamily:gt(e[0])})),bt("\\mathrm","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",fontFamily:"cmr",fontSeries:"m",fontShape:"n"})),bt("\\rmfamily","",{allowedInText:!0},(t,e)=>({fontFamily:"cmr"})),bt("\\textrm","{:text*}",{allowedInText:!0},(t,e)=>({fontFamily:"cmr"})),bt("\\mathsf","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",baseFontFamily:"cmss",fontSeries:"m",fontShape:"n"})),bt("\\sffamily","",{allowedInText:!0},(t,e)=>({fontFamily:"cmss"})),bt("\\textsf","{:text*}",{allowedInText:!0},(t,e)=>({fontFamily:"cmss"})),bt("\\mathtt","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",baseFontFamily:"cmtt",fontSeries:"m",fontShape:"n"})),bt("\\ttfamily","",{allowedInText:!0},(t,e)=>({fontFamily:"cmtt"})),bt("\\texttt","{:text*}",{allowedInText:!0},(t,e)=>({fontFamily:"cmtt"})),bt(["\\Bbb","\\mathbb"],"{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",baseFontFamily:"bb"})),bt(["\\frak","\\mathfrak"],"{:math*}",{allowedInText:!0},(t,e)=>({baseFontFamily:"frak"})),bt("\\mathcal","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",baseFontFamily:"cal",fontSeries:"m",fontShape:"n"})),bt("\\mathscr","{:math*}",{allowedInText:!0},(t,e)=>({mode:"math",baseFontFamily:"scr",fontSeries:"m",fontShape:"n"})),J(Z,"\\mathbb"),J(1081,"\\Bbb"),J(0,"\\mathcal"),J(G,"\\mathfrak"),J(271,"\\frak"),J(G,"\\mathscr"),J("UNCOMMON","\\mathsf"),J(G,"\\mathtt"),J(G,"\\boldsymbol"),bt("\\textnormal","{:text*}",{allowedInText:!0},(t,e)=>({fontFamily:"cmr",fontShape:"n",fontSeries:"n"})),bt("\\mbox","{:text*}",null,(t,e)=>({fontFamily:"cmr"})),bt("\\text","{:text*}",{allowedInText:!0},(t,e)=>({})),bt("\\class","{name:text}{content:auto*}",{allowedInText:!0},(t,e)=>({cssClass:gt(e[0])})),bt("\\cssId","{id:text}{content:auto}",{allowedInText:!0},(t,e)=>({cssId:gt(e[0]),body:e[1],type:"group"})),bt("\\em","",{allowedInText:!0},(t,e)=>({cssClass:"ML__emph",type:"group"})),bt("\\emph","{:auto}",{allowedInText:!0},(t,e)=>({cssClass:"ML__emph",body:e[0],type:"group",skipBoundary:!0})),J(G,"\\textrm"),J(G,"\\textit"),J(G,"\\textsf"),J(G,"\\texttt"),J(433,"\\textnormal"),J(G,"\\textbf"),J(421,"\\textup"),J(819,"\\emph"),J(49,"\\em"),W="Operators",bt("\\sqrt","[index:auto]{radicand:auto}",null,(function(t,e){return{type:"surd",body:e[1],index:e[0]}})),J(Z,"\\sqrt"),W="Fractions",bt(["\\frac","\\dfrac","\\tfrac","\\cfrac","\\binom","\\dbinom","\\tbinom"],"{numerator}{denominator}",null,(function(t,e){const i={type:"genfrac",numer:e[0],denom:e[1],mathstyle:"auto"};switch(t){case"\\dfrac":case"\\frac":case"\\tfrac":case"\\cfrac":i.hasBarLine=!0;break;case"\\\\atopfrac":i.hasBarLine=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":i.hasBarLine=!1,i.leftDelim="(",i.rightDelim=")"}switch(t){case"\\dfrac":case"\\dbinom":i.mathstyle="displaystyle";break;case"\\tfrac":case"\\tbinom":i.mathstyle="textstyle"}return"\\cfrac"===t&&(i.continuousFraction=!0),i})),bt(["\\over","\\atop","\\choose"],"",{infix:!0},(function(t,e){const i=e[0],s=e[1];let a=!1,o=null,n=null;switch(t){case"\\atop":break;case"\\over":a=!0;break;case"\\choose":a=!1,o="(",n=")";break;default:throw new Error("Unrecognized genfrac command")}return{type:"genfrac",numer:i,denom:s,hasBarLine:a,leftDelim:o,rightDelim:n,mathstyle:"auto"}})),J(21,"\\over"),J(12,"\\atop"),J(1968,"\\choose"),bt(["\\overwithdelims","\\atopwithdelims"],"{left-delim:delim}{right-delim:delim}",{infix:!0},(function(t,e){return{type:"genfrac",numer:e[0],denom:e[1],hasBarLine:!1,leftDelim:e[2],rightDelim:e[3],mathstyle:"auto"}})),J(15,"\\overwithdelims"),J(G,"\\atopwithdelims"),W="Fractions",bt("\\pdiff","{numerator}{denominator}",null,(function(t,e){return{type:"genfrac",numer:e[0],denom:e[1],numerPrefix:"∂",denomPrefix:"∂",hasBarLine:!0,leftDelim:null,rightDelim:null,mathstyle:"auto"}})),W="Quantifiers",Y("\\forall","",lt,"∀",Z),Y("\\exists","",lt,"∃",Z),Y("\\nexists",nt,lt,"∄",Z),Y("\\mid","",ht,"∣",G),Y("\\top","",lt,"⊤","RARE"),Y("\\bot","",lt,"⊥","RARE"),W="Variable Sized Symbols",bt(["\\sum","\\prod","\\bigcup","\\bigcap","\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\\intop"],"",null,(function(t){return{type:"mop",limits:"auto",symbol:!0,baseFontFamily:"cmr",body:{coprod:"∐",bigvee:"⋁",bigwedge:"⋀",biguplus:"⨄",bigcap:"⋂",bigcup:"⋃",intop:"∫",prod:"∏",sum:"∑",bigotimes:"⨂",bigoplus:"⨁",bigodot:"⨀",bigsqcup:"⨆",smallint:"∫"}[t.slice(1)]}})),bt(["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\ointctrclockwise","\\intctrclockwise"],"",null,(function(t){return{type:"mop",limits:"nolimits",symbol:!0,body:{int:"∫",iint:"∬",iiint:"∭",oint:"∮",oiint:"∯",oiiint:"∰",intclockwise:"∱",varointclockwise:"∲",ointctrclockwise:"∳",intctrclockwise:"⨑"}[t.slice(1)]}})),J(Z,"\\sum","\\prod","\\bigcap","\\bigcup","\\int"),J(G,"\\bigoplus","\\smallint","\\iint","\\oint"),J("RARE","\\bigwedge","\\bigvee"),J(756,"\\coprod"),J(723,"\\bigsqcup"),J(1241,"\\bigotimes"),J(150,"\\bigodot"),J(174,"\\biguplus"),J(878,"\\iiint"),J(97,"\\intop"),W="Various",Y("\\sharp","",lt,"♯",G),Y("\\flat","",lt,"♭",590),Y("\\natural","",lt,"♮",278),Y("\\#","",lt,"#","RARE"),Y("\\&","",lt,"&","RARE"),Y("\\clubsuit","",lt,"♣",172),Y("\\heartsuit","",lt,"♡","ARCANE"),Y("\\spadesuit","",lt,"♠","ARCANE"),Y("\\diamondsuit","",lt,"♢",j),Y("\\differencedelta","",ht,"∆",G),W="Letters and Letter Like Forms",bt("\\unicode","{charcode:number}",null,(function(t,e){let i=parseInt(e[0]);return isFinite(i)||(i=10067),{type:"mord",body:String.fromCodePoint(i)}})),Y("\\backslash","",lt,"\\"),Y("?","",lt,"?"),Y("!","",lt,"!"),Y("\\nabla","",lt,"∇",Z),Y("\\partial","",lt,"∂",Z),Y("\\ell","",lt,"ℓ",G),Y("\\imaginaryI","",lt,"i"),Y("\\imaginaryJ","",lt,"j"),bt(["\\Re","\\Im"],"",null,(function(t){return{type:"mop",limits:"nolimits",symbol:!1,isFunction:!0,body:{"\\Re":"ℜ","\\Im":"ℑ"}[t],baseFontFamily:"frak"}})),Y("\\hbar","",lt,"ℏ",G),Y("\\hslash",nt,lt,"ℏ",G),Y("\\differentialD","cmr",lt,"d"),Y("\\rd","cmr",lt,"d"),Y("\\capitalDifferentialD","cmr",lt,"D"),Y("\\rD","cmr",lt,"D"),Y("\\exponentialE","cmr",lt,"e"),Y("\\Finv",nt,lt,"Ⅎ",3),Y("\\Game",nt,lt,"⅁",1),Y("\\wp","",lt,"℘",1306),Y("\\eth",nt,lt,"ð",77),Y("\\mho",nt,lt,"℧",138),Y("\\Bbbk",nt,lt,"k"),Y("\\doubleStruckCapitalN","bb",lt,"N"),Y("\\N","bb",lt,"N"),Y("\\doubleStruckCapitalR","bb",lt,"R"),Y("\\R","bb",lt,"R"),Y("\\doubleStruckCapitalQ","bb",lt,"Q"),Y("\\Q","bb",lt,"Q"),Y("\\doubleStruckCapitalC","bb",lt,"C"),Y("\\C","bb",lt,"C"),Y("\\doubleStruckCapitalZ","bb",lt,"Z"),Y("\\Z","bb",lt,"Z"),Y("\\doubleStruckCapitalP","bb",lt,"P"),Y("\\P","bb",lt,"P"),Y("\\scriptCapitalE","scr",lt,"E"),Y("\\scriptCapitalH","scr",lt,"H"),Y("\\scriptCapitalL","scr",lt,"L"),Y("\\gothicCapitalC","frak",lt,"C"),Y("\\gothicCapitalH","frak",lt,"H"),Y("\\gothicCapitalI","frak",lt,"I"),Y("\\gothicCapitalR","frak",lt,"R"),Y("\\pounds","",lt,"£",509),Y("\\yen",nt,lt,"¥",57),Y("\\euro","",lt,"€",4),W="Crosses",Y("\\textdagger","",ct,"†"),Y("\\dagger","",ct,"†",G),Y("\\dag","",ct,"†",G),Y("\\ddag","",ct,"‡",500),Y("\\textdaggerdbl","",ct,"‡"),Y("\\ddagger","",ct,"‡",353),Y("\\maltese",nt,lt,"✠",24),W="Arrows",Y("\\longrightarrow","",ht,"⟶",Z),Y("\\rightarrow","",ht,"→",Z),Y("\\Longrightarrow","",ht,"⟹",Z),Y("\\Rightarrow","",ht,"⇒",Z),Y("\\longmapsto","",ht,"⟼",G),Y("\\mapsto","",ht,"↦",G),Y("\\Longleftrightarrow","",ht,"⟺",G),Y("\\rightleftarrows",nt,ht,"⇄",G),Y("\\leftarrow","",ht,"←",G),Y("\\curvearrowleft",nt,ht,"↶",G),Y("\\uparrow","",ht,"↑",G),Y("\\downarrow","",ht,"↓",G),Y("\\hookrightarrow","",ht,"↪",G),Y("\\rightharpoonup","",ht,"⇀",G),Y("\\rightleftharpoons","",ht,"⇌",G),Y("\\Leftarrow","",ht,"⇐",1695),Y("\\longleftrightarrow","",ht,"⟷",1599),Y("\\longleftarrow","",ht,"⟵",878),Y("\\Longleftarrow","",ht,"⟸",296),Y("\\searrow","",ht,"↘",1609),Y("\\nearrow","",ht,"↗",1301),Y("\\swarrow","",ht,"↙",167),Y("\\nwarrow","",ht,"↖",108),Y("\\Uparrow","",ht,"⇑",257),Y("\\Downarrow","",ht,"⇓",556),Y("\\updownarrow","",ht,"↕",192),Y("\\Updownarrow","",ht,"⇕",161),Y("\\hookleftarrow","",ht,"↩",115),Y("\\leftharpoonup","",ht,"↼",93),Y("\\leftharpoondown","",ht,"↽",42),Y("\\rightharpoondown","",ht,"⇁",80),Y("\\leftrightarrows",nt,ht,"⇆",765),Y("\\dashrightarrow",nt,ht,"⇢",311),Y("\\dashleftarrow",nt,ht,"⇠",5),Y("\\leftleftarrows",nt,ht,"⇇",8),Y("\\Lleftarrow",nt,ht,"⇚",7),Y("\\twoheadleftarrow",nt,ht,"↞",32),Y("\\leftarrowtail",nt,ht,"↢",25),Y("\\looparrowleft",nt,ht,"↫",6),Y("\\leftrightharpoons",nt,ht,"⇋",205),Y("\\circlearrowleft",nt,ht,"↺",105),Y("\\Lsh",nt,ht,"↰",11),Y("\\upuparrows",nt,ht,"⇈",15),Y("\\downharpoonleft",nt,ht,"⇃",21),Y("\\multimap",nt,ht,"⊸",108),Y("\\leftrightsquigarrow",nt,ht,"↭",31),Y("\\twoheadrightarrow",nt,ht,"↠",835),Y("\\rightarrowtail",nt,ht,"↣",195),Y("\\looparrowright",nt,ht,"↬",37),Y("\\curvearrowright",nt,ht,"↷",209),Y("\\circlearrowright",nt,ht,"↻",63),Y("\\Rsh",nt,ht,"↱",18),Y("\\downdownarrows",nt,ht,"⇊",6),Y("\\upharpoonright",nt,ht,"↾",579),Y("\\downharpoonright",nt,ht,"⇂",39),Y("\\rightsquigarrow",nt,ht,"⇝",674),Y("\\leadsto",nt,ht,"⇝",709),Y("\\Rrightarrow",nt,ht,"⇛",62),Y("\\restriction",nt,ht,"↾",29),Y("\\upharpoonleft",nt,ht,"↿",j),Y("\\rightrightarrows",nt,ht,"⇉",j),W="Negated Arrows",Y("\\nrightarrow",nt,ht,"↛",324),Y("\\nRightarrow",nt,ht,"⇏",107),Y("\\nleftrightarrow",nt,ht,"↮",36),Y("\\nLeftrightarrow",nt,ht,"⇎",20),Y("\\nleftarrow",nt,ht,"↚",7),Y("\\nLeftarrow",nt,ht,"⇍",5),W="Negated Relations",Y("\\nless",nt,ht,"≮",146),Y("\\nleqslant",nt,ht,"",58),Y("\\lneq",nt,ht,"⪇",54),Y("\\lneqq",nt,ht,"≨",36),Y("\\nleqq",nt,ht,"",18),Y("\\unlhd",nt,ct,"⊴",253),Y("\\unrhd",nt,ct,"⊵",66),Y("\\lvertneqq",nt,ht,"",6),Y("\\lnsim",nt,ht,"⋦",4),Y("\\lnapprox",nt,ht,"⪉",j),Y("\\nprec",nt,ht,"⊀",71),Y("\\npreceq",nt,ht,"⋠",57),Y("\\precnsim",nt,ht,"⋨",4),Y("\\precnapprox",nt,ht,"⪹",2),Y("\\nsim",nt,ht,"≁",40),Y("\\nshortmid",nt,ht,"",1),Y("\\nmid",nt,ht,"∤",417),Y("\\nvdash",nt,ht,"⊬",266),Y("\\nvDash",nt,ht,"⊭",405),Y("\\ngtr",nt,ht,"≯",90),Y("\\ngeqslant",nt,ht,"",23),Y("\\ngeqq",nt,ht,"",12),Y("\\gneq",nt,ht,"⪈",29),Y("\\gneqq",nt,ht,"≩",35),Y("\\gvertneqq",nt,ht,"",6),Y("\\gnsim",nt,ht,"⋧",3),Y("\\gnapprox",nt,ht,"⪊",j),Y("\\nsucc",nt,ht,"⊁",44),Y("\\nsucceq",nt,ht,"⋡",j),Y("\\succnsim",nt,ht,"⋩",4),Y("\\succnapprox",nt,ht,"⪺",j),Y("\\ncong",nt,ht,"≆",128),Y("\\nshortparallel",nt,ht,"",6),Y("\\nparallel",nt,ht,"∦",54),Y("\\nVDash",nt,ht,"⊯",5),Y("\\nsupseteqq",nt,ht,"",1),Y("\\supsetneq",nt,ht,"⊋",286),Y("\\varsupsetneq",nt,ht,"",2),Y("\\supsetneqq",nt,ht,"⫌",49),Y("\\varsupsetneqq",nt,ht,"",3),Y("\\nVdash",nt,ht,"⊮",179),Y("\\precneqq",nt,ht,"⪵",11),Y("\\succneqq",nt,ht,"⪶",3),Y("\\nsubseteqq",nt,ht,"",16),W="Various",Y("\\checkmark",nt,lt,"✓",1025),Y("\\diagup",nt,lt,"╱",440),Y("\\diagdown",nt,lt,"╲",175),Y("\\measuredangle",nt,lt,"∡",271),Y("\\sphericalangle",nt,lt,"∢",156),Y("\\backprime",nt,lt,"‵",104),Y("\\backdoubleprime",nt,lt,"‶",j),W="Shapes",Y("\\ast","",ct,"∗",Z),Y("\\star","",ct,"⋆",G),Y("\\diamond","",ct,"⋄",1356),Y("\\Diamond",nt,lt,"◊",695),Y("\\lozenge",nt,lt,"◊",422),Y("\\blacklozenge",nt,lt,"⧫",344),Y("\\bigstar",nt,lt,"★",168),W="Hebrew",Y("\\aleph","",lt,"ℵ",1381),Y("\\beth",nt,lt,"ℶ",54),Y("\\daleth",nt,lt,"ℸ",43),Y("\\gimel",nt,lt,"ℷ",36),W="Fences",Y("\\lbrace","",dt,"{",Z),Y("\\rbrace","",pt,"}",Z),Y("\\langle","",dt,"⟨",G),Y("\\rangle","",pt,"⟩",G),Y("\\lfloor","",dt,"⌊",G),Y("\\rfloor","",pt,"⌋",G),Y("\\lceil","",dt,"⌈",G),Y("\\rceil","",pt,"⌉",G),Y("\\vert","",lt,"∣",Z),Y("\\mvert","",ht,"∣"),Y("\\lvert","",dt,"∣",496),Y("\\rvert","",pt,"∣",496),Y("\\|","",lt,"∥"),Y("\\Vert","",lt,"∥",Z),Y("\\mVert","",lt,"∥"),Y("\\lVert","",dt,"∥",287),Y("\\rVert","",pt,"∥",j),Y("\\lbrack","",dt,"[",574),Y("\\rbrack","",pt,"]",213),Y("\\{","",dt,"{"),Y("\\}","",pt,"}"),Y("(","",dt,"("),Y(")","",pt,")"),Y("[","",dt,"["),Y("]","",pt,"]"),Y("\\ulcorner",nt,dt,"┌",296),Y("\\urcorner",nt,pt,"┐",310),Y("\\llcorner",nt,dt,"└",137),Y("\\lrcorner",nt,pt,"┘",199),Y("\\lgroup","",dt,"⟮",24),Y("\\rgroup","",pt,"⟯",24),Y("\\lmoustache","",dt,"⎰",j),Y("\\rmoustache","",pt,"⎱",j),bt(["\\middle"],"{:delim}",null,(function(t,e){return{type:"delim",delim:e[0]}})),W="Sizing";const xt={"\\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}};function kt(t){let e="",i=!0;for(const s of t)"string"==typeof s.body?e+=s.body:i=!1;return i?e:""}bt(["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],"{:delim}",null,(function(t,e){return{type:"sizeddelim",size:xt[t].size,cls:xt[t].mclass,delim:e[0]}})),W="Relations",Y("=","",ht,"=",Z),Y("\\ne","",ht,"≠",Z),Y("\\neq","",ht,"≠",G),Y("<","",ht,"<",Z),Y("\\lt","",ht,"<",G),Y(">","",ht,">",Z),Y("\\gt","",ht,">",G),Y("\\le","",ht,"≤",G),Y("\\ge","",ht,"≥",G),Y("\\leqslant",nt,ht,"⩽",Z),Y("\\geqslant",nt,ht,"⩾",Z),Y("\\leq","",ht,"≤",G),Y("\\geq","",ht,"≥",G),Y("\\ll","",ht,"≪"),Y("\\gg","",ht,"≫",G),Y("\\coloneq","",ht,"≔",5),Y("\\measeq","",ht,"≝"),Y("\\eqdef","",ht,"≞"),Y("\\questeq","",ht,"≟"),Y(":","",ht,":"),Y("\\cong","",ht,"≅",G),Y("\\equiv","",ht,"≡",G),Y("\\prec","",ht,"≺",G),Y("\\preceq","",ht,"⪯",G),Y("\\succ","",ht,"≻",G),Y("\\succeq","",ht,"⪰",1916),Y("\\perp","",ht,"⊥",G),Y("\\parallel","",ht,"∥",G),Y("\\propto","",ht,"∝",G),Y("\\Colon","",ht,"∷"),Y("\\smile","",ht,"⌣",G),Y("\\frown","",ht,"⌢",G),Y("\\sim","",ht,"∼",G),Y("\\gtrsim",nt,ht,"≳",G),Y("\\approx","",ht,"≈",Z),Y("\\approxeq",nt,ht,"≊",147),Y("\\thickapprox",nt,ht,"≈",377),Y("\\lessapprox",nt,ht,"⪅",146),Y("\\gtrapprox",nt,ht,"⪆",95),Y("\\precapprox",nt,ht,"⪷",50),Y("\\succapprox",nt,ht,"⪸",j),Y("\\thicksim",nt,ht,"∼",779),Y("\\succsim",nt,ht,"≿",251),Y("\\precsim",nt,ht,"≾",104),Y("\\backsim",nt,ht,"∽",251),Y("\\eqsim",nt,ht,"≂",62),Y("\\backsimeq",nt,ht,"⋍",91),Y("\\simeq","",ht,"≃",j),Y("\\lesssim",nt,ht,"≲",j),Y("\\nleq",nt,ht,"≰",369),Y("\\ngeq",nt,ht,"≱",164),Y("\\smallsmile",nt,ht,"⌣",31),Y("\\smallfrown",nt,ht,"⌢",71),Y("\\bowtie","",ht,"⋈",558),Y("\\asymp","",ht,"≍",755),Y("\\sqsubseteq","",ht,"⊑",1255),Y("\\sqsupseteq","",ht,"⊒",183),Y("\\leqq",nt,ht,"≦",1356),Y("\\eqslantless",nt,ht,"⪕",15),Y("\\lll",nt,ht,"⋘",157),Y("\\lessgtr",nt,ht,"≶",281),Y("\\lesseqgtr",nt,ht,"⋚",134),Y("\\lesseqqgtr",nt,ht,"⪋",j),Y("\\risingdotseq",nt,ht,"≓",8),Y("\\fallingdotseq",nt,ht,"≒",99),Y("\\subseteqq",nt,ht,"⫅",82),Y("\\Subset",nt,ht,"⋐"),Y("\\sqsubset",nt,ht,"⊏",309),Y("\\preccurlyeq",nt,ht,"≼",549),Y("\\curlyeqprec",nt,ht,"⋞",14),Y("\\vDash",nt,ht,"⊨",646),Y("\\Vvdash",nt,ht,"⊪",20),Y("\\bumpeq",nt,ht,"≏",13),Y("\\Bumpeq",nt,ht,"≎",12),Y("\\geqq",nt,ht,"≧",972),Y("\\eqslantgtr",nt,ht,"⪖",13),Y("\\ggg",nt,ht,"⋙",127),Y("\\gtrless",nt,ht,"≷",417),Y("\\gtreqless",nt,ht,"⋛",190),Y("\\gtreqqless",nt,ht,"⪌",91),Y("\\supseteqq",nt,ht,"⫆",6),Y("\\Supset",nt,ht,"⋑",34),Y("\\sqsupset",nt,ht,"⊐",71),Y("\\succcurlyeq",nt,ht,"≽",442),Y("\\curlyeqsucc",nt,ht,"⋟",10),Y("\\Vdash",nt,ht,"⊩",276),Y("\\shortmid",nt,ht,"∣",67),Y("\\shortparallel",nt,ht,"∥",17),Y("\\between",nt,ht,"≬",110),Y("\\pitchfork",nt,ht,"⋔",66),Y("\\varpropto",nt,ht,"∝",203),Y("\\backepsilon",nt,ht,"∍",176),Y("\\llless",nt,ht,"⋘",j),Y("\\gggtr",nt,ht,"⋙",j),Y("\\lhd",nt,ct,"⊲",447),Y("\\rhd",nt,ct,"⊳",338),Y("\\Join","",ht,"⋈",35),Y("\\doteq","",ht,"≐",1450),Y("\\doteqdot",nt,ht,"≑",60),Y("\\Doteq",nt,ht,"≑",j),Y("\\eqcirc",nt,ht,"≖",6),Y("\\circeq",nt,ht,"≗",31),Y("\\lessdot",nt,ct,"⋖",88),Y("\\gtrdot",nt,ct,"⋗",45),Y("\\~","",ht,"~"),W="Logic",Y("\\leftrightarrow","",ht,"↔",Z),Y("\\Leftrightarrow","",ht,"⇔",Z),Y("\\to","",ht,"→",Z),Y("\\models","",ht,"⊨",G),Y("\\vdash","",ht,"⊢",G),Y("\\therefore",nt,ht,"∴",1129),Y("\\because",nt,ht,"∵",388),Y("\\implies","",ht,"⟹",1858),Y("\\gets","",ht,"←",150),Y("\\dashv","",ht,"⊣",299),Y("\\impliedby","",ht,"⟸",j),Y("\\biconditional","",ht,"⟷",j),Y("\\roundimplies","",ht,"⥰",j),W="Operators",Y("+","",ct,"+",Z),Y("-","",ct,"−",Z),Y("−","",ct,"−",Z),Y("\\pm","",ct,"±",G),Y("\\mp","",ct,"∓",G),Y("*","",ct,"∗",G),Y("\\times","",ct,"×",G),Y("\\div","",ct,"÷",G),Y("\\surd","",lt,"√",G),Y("\\divides","",ct,"∣",j),Y("\\ltimes",nt,ct,"⋉",576),Y("\\rtimes",nt,ct,"⋊",946),Y("\\leftthreetimes",nt,ct,"⋋",34),Y("\\rightthreetimes",nt,ct,"⋌",14),Y("\\intercal",nt,ct,"⊺",478),Y("\\dotplus",nt,ct,"∔",81),Y("\\centerdot",nt,ct,"⋅",271),Y("\\doublebarwedge",nt,ct,"⩞",5),Y("\\divideontimes",nt,ct,"⋇",51),Y("\\cdot","",ct,"⋅",j),W="Others",Y("\\infty","",lt,"∞",Z),Y("\\prime","",rt,"′",Z),Y("\\doubleprime","",lt,"″"),Y("\\angle","",lt,"∠",G),Y("`","",lt,"‘"),Y("\\$","",lt,"$"),Y("\\%","",lt,"%"),Y("\\_","",lt,"_"),W="Greek",Y("\\alpha","",rt,"α",G),Y("\\beta","",rt,"β",G),Y("\\gamma","",rt,"γ",G),Y("\\delta","",rt,"δ",G),Y("\\epsilon","",rt,"ϵ",G),Y("\\varepsilon","",rt,"ε"),Y("\\zeta","",rt,"ζ",G),Y("\\eta","",rt,"η",G),Y("\\theta","",rt,"θ",G),Y("\\vartheta","",rt,"ϑ",G),Y("\\iota","",rt,"ι",G),Y("\\kappa","",rt,"κ",G),Y("\\varkappa",nt,rt,"ϰ",G),Y("\\lambda","",rt,"λ",G),Y("\\mu","",rt,"μ",G),Y("\\nu","",rt,"ν",G),Y("\\xi","",rt,"ξ",G),Y("\\omicron","",rt,"o"),Y("\\pi","",rt,"π",G),Y("\\varpi","",rt,"ϖ",G),Y("\\rho","",rt,"ρ",G),Y("\\varrho","",rt,"ϱ",G),Y("\\sigma","",rt,"σ",G),Y("\\varsigma","",rt,"ς",G),Y("\\tau","",rt,"τ",G),Y("\\phi","",rt,"ϕ",G),Y("\\varphi","",rt,"φ",G),Y("\\upsilon","",rt,"υ",G),Y("\\chi","",rt,"χ",G),Y("\\psi","",rt,"ψ",G),Y("\\omega","",rt,"ω",G),Y("\\Gamma","",rt,"Γ",G),Y("\\Delta","",rt,"Δ",G),Y("\\Theta","",rt,"Θ",G),Y("\\Lambda","",rt,"Λ",G),Y("\\Xi","",rt,"Ξ",G),Y("\\Pi","",rt,"Π",G),Y("\\Sigma","",rt,"Σ",G),Y("\\Upsilon","",rt,"Υ",G),Y("\\Phi","",rt,"Φ",G),Y("\\Psi","",rt,"Ψ",G),Y("\\Omega","",rt,"Ω",G),Y("\\digamma",nt,rt,"ϝ",248),W="Others",Y("\\emptyset","",lt,"∅",Z),Y("\\varnothing",nt,lt,"∅",Z),W="Set Operators",Y("\\cap","",ct,"∩",Z),Y("\\cup","",ct,"∪",Z),Y("\\setminus","",ct,"∖",G),Y("\\smallsetminus",nt,ct,"∖",254),Y("\\complement",nt,lt,"∁",200),W="Set Relations",Y("\\in","",ht,"∈",Z),Y("\\notin","",ht,"∉",Z),Y("\\not","",ht,"̸",G),Y("\\ni","",ht,"∋",G),Y("\\owns","",ht,"∋",18),Y("\\subset","",ht,"⊂",Z),Y("\\supset","",ht,"⊃",Z),Y("\\subseteq","",ht,"⊆",Z),Y("\\supseteq","",ht,"⊇",Z),Y("\\subsetneq",nt,ht,"⊊",1945),Y("\\varsubsetneq",nt,ht,"",198),Y("\\subsetneqq",nt,ht,"⫋",314),Y("\\varsubsetneqq",nt,ht,"",55),Y("\\nsubset",nt,ht,"⊄",j),Y("\\nsupset",nt,ht,"⊅",j),Y("\\nsubseteq",nt,ht,"⊈",950),Y("\\nsupseteq",nt,ht,"⊉",49),W="Spacing",Y("\\ ","",mt," "),Y("~","",mt," "),Y("\\space","",mt," "),Y("\\!","",mt,null),Y("\\,","",mt,null),Y("\\:","",mt,null),Y("\\;","",mt,null),Y("\\enskip","",mt,null),Y("\\enspace","",mt,null,672),Y("\\quad","",mt,null,G),Y("\\qquad","",mt,null,G),bt(["\\hspace","\\hspace*"],"{width:skip}",{allowedInText:!0},(function(t,e){return{type:"spacing",width:e[0]||0}})),bt(["\\mathop","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathord","\\mathinner"],"{:auto}",null,(function(t,e){const i={type:{"\\mathop":"mop","\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[t],body:kt(e[0])||e[0],captureSelection:!0,baseFontFamily:"\\mathop"===t?"math":""};return"\\mathop"===t&&(i.limits="nolimits",i.isFunction=!0),i})),bt(["\\operatorname","\\operatorname*"],"{operator:math}",null,(function(t,e){const i={type:"mop",skipBoundary:!0,body:e[0],isFunction:!0};return i.body.forEach(t=>{t.isFunction=!1,t.autoFontFamily="cmr"}),"\\operatorname"===t?i.limits="nolimits":"\\operatorname*"===t&&(i.limits="limits"),i})),W="Punctuation",Y("\\colon","","mpunct",":",G),Y("\\cdotp","","mpunct","⋅",G),Y("\\ldots","","minner","…",G),Y("\\cdots","","minner","⋯",G),Y("\\ddots","","minner","⋱",G),Y("\\mathellipsis","","minner","…",91),Y("\\vdots","",lt,"⋮",G),Y("\\ldotp","","mpunct",".",18),Y(",","","mpunct",","),Y(";","","mpunct",";"),W="Logical Operators",Y("\\wedge","",ct,"∧",Z),Y("\\vee","",ct,"∨",Z),Y("\\lnot","",lt,"¬",G),Y("\\neg","",lt,"¬",Z),Y("\\land","",ct,"∧",659),Y("\\lor","",ct,"∨",364),Y("\\barwedge",nt,ct,"⊼",21),Y("\\veebar",nt,ct,"⊻",43),Y("\\nor",nt,ct,"⊻",7),Y("\\curlywedge",nt,ct,"⋏",58),Y("\\curlyvee",nt,ct,"⋎",57),W="Boxes",Y("\\square",nt,lt,"□",G),Y("\\Box",nt,lt,"□",G),Y("\\blacksquare",nt,lt,"■",1679),Y("\\boxminus",nt,ct,"⊟",79),Y("\\boxplus",nt,ct,"⊞",276),Y("\\boxtimes",nt,ct,"⊠",457),Y("\\boxdot",nt,ct,"⊡",120),W="Circles",Y("\\circ","",ct,"∘",Z),Y("\\bigcirc","",ct,"◯",903),Y("\\bullet","",ct,"∙",G),Y("\\circleddash",nt,ct,"⊝",G),Y("\\circledast",nt,ct,"⊛",339),Y("\\oplus","",ct,"⊕",G),Y("\\ominus","",ct,"⊖",1568),Y("\\otimes","",ct,"⊗",G),Y("\\odot","",ct,"⊙",G),Y("\\circledcirc",nt,ct,"⊚",93),Y("\\oslash","",ct,"⊘",497),Y("\\circledS",nt,lt,"Ⓢ",31),Y("\\circledR",nt,lt,"®",1329),W="Triangles",Y("\\triangle","",lt,"△",G),Y("\\triangleq",nt,ht,"≜",G),Y("\\bigtriangleup","",ct,"△",1773),Y("\\vartriangle",nt,ht,"△",762),Y("\\triangledown",nt,lt,"▽",520),Y("\\bigtriangledown","",ct,"▽",661),Y("\\triangleleft","",ct,"◃",534),Y("\\vartriangleleft",nt,ht,"⊲",281),Y("\\trianglelefteq",nt,ht,"⊴",176),Y("\\ntriangleleft",nt,ht,"⋪",13),Y("\\ntrianglelefteq",nt,ht,"⋬",22),Y("\\triangleright","",ct,"▹",516),Y("\\vartriangleright",nt,ht,"⊳",209),Y("\\trianglerighteq",nt,ht,"⊵",45),Y("\\ntriangleright",nt,ht,"⋫",15),Y("\\ntrianglerighteq",nt,ht,"⋭",6),Y("\\blacktriangle",nt,lt,"▲",360),Y("\\blacktriangledown",nt,lt,"▼",159),Y("\\blacktriangleleft",nt,ht,"◀",101),Y("\\blacktriangleright",nt,ht,"▶",271),W="Others",Y("\\/","",rt,"/"),Y("|","","textord","∣"),W="Big Operators",Y("\\sqcup","",ct,"⊔",1717),Y("\\sqcap","",ct,"⊓",735),Y("\\uplus","",ct,"⊎",597),Y("\\wr","",ct,"≀",286),Y("\\Cap",nt,ct,"⋒",2),Y("\\Cup",nt,ct,"⋓",2),Y("\\doublecap",nt,ct,"⋒",1),Y("\\doublecup",nt,ct,"⋓",1),Y("\\amalg","",ct,"⨿",j),Y("\\And","",ct,"&"),W="Accents",bt(["\\acute","\\grave","\\dot","\\ddot","\\mathring","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec"],"{body:auto}",null,(function(t,e){return{type:"accent",accent:{"\\acute":"ˊ","\\grave":"ˋ","\\dot":"˙","\\ddot":"¨","\\mathring":"˚","\\tilde":"~","\\bar":"ˉ","\\breve":"˘","\\check":"ˇ","\\hat":"^","\\vec":"⃗"}[t],limits:"accent",skipBoundary:!0,body:e[0]}})),J(G,"\\bar","\\ddot","\\acute","\\tilde","\\check"),J(1548,"\\breve"),J(735,"\\grave"),J(Z,"\\vec"),W="Letters and Letter Like Forms",Y("\\imath","",lt,"ı"),Y("\\jmath","",lt,"ȷ"),W="Others",Y("\\degree","",lt,"°",46),W="Others",Y("'","",lt,"′"),Y('"',"",lt,"”"),W="Others",bt("\\^","{:string}",{allowedInText:!0},(function(t,e){return{type:"mord",limits:"nolimits",symbol:!0,isFunction:!1,body:e[0]&&{a:"â",e:"ê",i:"î",o:"ô",u:"û",A:"Â",E:"Ê",I:"Î",O:"Ô",U:"Û"}[e[0]]||"^",baseFontFamily:"cmr"}})),bt("\\`","{:string}",{allowedInText:!0},(function(t,e){return{type:"mord",limits:"nolimits",symbol:!0,isFunction:!1,body:e[0]&&{a:"à",e:"è",i:"ì",o:"ò",u:"ù",A:"À",E:"È",I:"Ì",O:"Ò",U:"Ù"}[e[0]]||"`",baseFontFamily:"cmr"}})),bt("\\'","{:string}",{allowedInText:!0},(function(t,e){return{type:"mord",limits:"nolimits",symbol:!0,isFunction:!1,body:e[0]&&{a:"á",e:"é",i:"í",o:"ó",u:"ú",A:"Á",E:"É",I:"Í",O:"Ó",U:"Ú"}[e[0]]||"^",baseFontFamily:"cmr"}})),bt("\\~","{:string}",{allowedInText:!0},(function(t,e){return{type:"mord",limits:"nolimits",symbol:!0,isFunction:!1,body:e[0]&&{n:"ñ",N:"Ñ",a:"ã",o:"õ",A:"Ã",O:"Õ"}[e[0]]||"´",baseFontFamily:"cmr"}})),bt("\\c","{:string}",{allowedInText:!0},(function(t,e){return{type:"mord",limits:"nolimits",symbol:!0,isFunction:!1,body:e[0]&&{c:"ç",C:"Ç"}[e[0]]||"",baseFontFamily:"cmr"}}));const vt={"\\#":"#","\\&":"&","\\$":"$","\\%":"%","\\_":"_","\\euro":"€","\\maltese":"✠","\\{":"{","\\}":"}","\\nobreakspace":" ","\\ldots":"…","\\textellipsis":"…","\\backslash":"\\","`":"‘","'":"’","``":"“","''":"”","\\degree":"°","\\textasciicircum":"^","\\textasciitilde":"~","\\textasteriskcentered":"*","\\textbackslash":"\\","\\textbraceleft":"{","\\textbraceright":"}","\\textbullet":"•","\\textdollar":"$","\\textsterling":"£","–":"–","—":"—","‘":"‘","’":"’","“":"“","”":"”",'"':"”","\\ss":"ß","\\ae":"æ","\\oe":"œ","\\AE":"Æ","\\OE":"Œ","\\O":"Ø","\\i":"ı","\\j":"ȷ","\\aa":"å","\\AA":"Å"};var wt={matchCodepoint:et,commandAllowed:function(t,e){return!(!V[e]||"text"===t&&!V[e].allowedInText)||!!{text:vt,math:H}[t][e]},unicodeToMathVariant:at,mathVariantToUnicode:function(t,e,i){if(!/[A-Za-z0-9]/.test(t))return t;if(!e&&!i)return t;const s=t.codePointAt(0);for(let t=0;t=st[t].offset&&s=1;)s.params.push({optional:!1,type:"math",defaultValue:null,placeholder:null}),a-=1}}}else"math"===e?s=H[t]:vt[t]&&(s={value:vt[t]});return!s||"mord"!==s.type||"f"!==s.value&&"g"!==s.value&&"h"!==s.value||(s.isFunction=!0),s},getValue:function(t,e){return"math"===t?H[e]&&H[e].value?H[e].value:e:vt[e]?vt[e]:e},getEnvironmentInfo:function(t){let e=U[t];return e||(e={params:"",parser:null,mathstyle:"displaystyle",tabular:!0,colFormat:[],lFence:".",rFence:"."}),e},suggest:function(t){if(t.length<=1)return[];const e=[];for(const i in V)Object.prototype.hasOwnProperty.call(V,i)&&i.startsWith(t)&&!V[i].infix&&e.push({match:i,frequency:V[i].frequency});for(const i in H)Object.prototype.hasOwnProperty.call(H,i)&&i.startsWith(t)&&e.push({match:i,frequency:H[i].frequency});return e.sort((t,e)=>t.frequency===e.frequency?t.match.length-e.match.length:(e.frequency||0)-(t.frequency||0)),e},FREQUENCY_VALUE:X,TEXT_SYMBOLS:vt,MATH_SYMBOLS:H,ENVIRONMENTS:U,RIGHT_DELIM:{"(":")","{":"}","[":"]","|":"|","\\lbrace":"\\rbrace","\\{":"\\}","\\langle":"\\rangle","\\lfloor":"\\rfloor","\\lceil":"\\rceil","\\vert":"\\vert","\\lvert":"\\rvert","\\Vert":"\\Vert","\\lVert":"\\rVert","\\lbrack":"\\rbrack","\\ulcorner":"\\urcorner","\\llcorner":"\\lrcorner","\\lgroup":"\\rgroup","\\lmoustache":"\\rmoustache"},FUNCTIONS:V,MACROS:{iff:"\\;⟺\\;",nicefrac:"^{#1}\\!\\!/\\!_{#2}",bra:"\\mathinner{\\langle{#1}|}",ket:"\\mathinner{|{#1}\\rangle}",braket:"\\mathinner{\\langle{#1}\\rangle}",set:"\\mathinner{\\lbrace #1 \\rbrace}",Bra:"\\left\\langle #1\\right|",Ket:"\\left|#1\\right\\rangle",Braket:"\\left\\langle{#1}\\right\\rangle",Set:"\\left\\lbrace #1 \\right\\rbrace"},COMMAND_MODE_CHARACTERS:/[a-zA-Z0-9!@*()-=+{}[\]\\';:?/.,~<>`|'$%#&^_" ]/,LETTER:/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓ󌜏źŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒäöüßÄÖÜẞàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚáéíñóúüÁÉÍÑÓÚÜ]/,LETTER_AND_DIGITS:/[0-9a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓ󌜏źŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒäöüßÄÖÜẞàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚáéíñóúüÁÉÍÑÓÚÜ]/};const St=$.makeSymbol,At=$.makeSpan,Mt=$.makeVlist;function Ct(t,e,i,s,a,o){const n=St("Size"+i+"-Regular",wt.getValue("math",e)),r=$.makeStyleWrap(t,At(n,"delimsizing size"+i),a.mathstyle,M.TEXT,o);return s&&r.setTop((1-a.mathstyle.sizeMultiplier)*a.mathstyle.metrics.axisHeight),r.setStyle("color",a.color),"number"==typeof a.opacity&&r.setStyle("opacity",a.opacity),r}function _t(t,e){let i="";return"Size1-Regular"===e?i=" delim-size1":"Size4-Regular"===e&&(i=" delim-size4"),At(St(e,wt.getValue("math",t)),"delimsizinginner"+i)}function Tt(t,e,i,s,a,o){let n,r,l,c;n=l=c=wt.getValue("math",e),r=null;let h="Size1-Regular";"\\vert"===e||"\\lvert"===e||"\\rvert"===e||"\\mvert"===e||"\\mid"===e?l=n=c="∣":"\\Vert"===e||"\\lVert"===e||"\\rVert"===e||"\\mVert"===e||"\\|"===e?l=n=c="∥":"\\uparrow"===e?l=c="⏐":"\\Uparrow"===e?l=c="‖":"\\downarrow"===e?n=l="⏐":"\\Downarrow"===e?n=l="‖":"\\updownarrow"===e?(n="↑",l="⏐",c="↓"):"\\Updownarrow"===e?(n="⇑",l="‖",c="⇓"):"["===e||"\\lbrack"===e?(n="⎡",l="⎢",c="⎣",h="Size4-Regular"):"]"===e||"\\rbrack"===e?(n="⎤",l="⎥",c="⎦",h="Size4-Regular"):"\\lfloor"===e?(l=n="⎢",c="⎣",h="Size4-Regular"):"\\lceil"===e?(n="⎡",l=c="⎢",h="Size4-Regular"):"\\rfloor"===e?(l=n="⎥",c="⎦",h="Size4-Regular"):"\\rceil"===e?(n="⎤",l=c="⎥",h="Size4-Regular"):"("===e?(n="⎛",l="⎜",c="⎝",h="Size4-Regular"):")"===e?(n="⎞",l="⎟",c="⎠",h="Size4-Regular"):"\\{"===e||"\\lbrace"===e?(n="⎧",r="⎨",c="⎩",l="⎪",h="Size4-Regular"):"\\}"===e||"\\rbrace"===e?(n="⎫",r="⎬",c="⎭",l="⎪",h="Size4-Regular"):"\\lgroup"===e?(n="⎧",c="⎩",l="⎪",h="Size4-Regular"):"\\rgroup"===e?(n="⎫",c="⎭",l="⎪",h="Size4-Regular"):"\\lmoustache"===e?(n="⎧",c="⎭",l="⎪",h="Size4-Regular"):"\\rmoustache"===e?(n="⎫",c="⎩",l="⎪",h="Size4-Regular"):"\\surd"===e?(n="",c="⎷",l="",h="Size4-Regular"):"\\ulcorner"===e?(n="┌",l=c=" "):"\\urcorner"===e?(n="┐",l=c=" "):"\\llcorner"===e?(c="└",l=n=" "):"\\lrcorner"===e&&(n="┘",l=n=" ");const d=m.getCharacterMetrics(wt.getValue("math",n),h),p=d.height+d.depth,u=m.getCharacterMetrics(wt.getValue("math",l),h),f=u.height+u.depth,g=m.getCharacterMetrics(wt.getValue("math",c),h),y=g.height+g.depth;let b=0,x=1;if(null!==r){const t=m.getCharacterMetrics(wt.getValue("math",r),h);b=t.height+t.depth,x=2}const k=p+y+b,v=Math.ceil((i-k)/(x*f)),w=k+v*x*f;let S=a.mathstyle.metrics.axisHeight;s&&(S*=a.mathstyle.sizeMultiplier);const A=w/2-S,C=[];if(C.push(_t(c,h)),null===r)for(let t=0;t","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],zt=[0,1.2,1.8,2.4,3],Et=[{type:"small",mathstyle:M.SCRIPTSCRIPT},{type:"small",mathstyle:M.SCRIPT},{type:"small",mathstyle:M.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],qt=[{type:"small",mathstyle:M.SCRIPTSCRIPT},{type:"small",mathstyle:M.SCRIPT},{type:"small",mathstyle:M.TEXT},{type:"stack"}],Pt=[{type:"small",mathstyle:M.SCRIPTSCRIPT},{type:"small",mathstyle:M.SCRIPT},{type:"small",mathstyle:M.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];function It(t,e,i,s,a,o){if(!e||0===e.length||"."===e)return Bt(t,a,t);let n;"<"===e||"\\lt"===e?e="\\langle":">"!==e&&"\\gt"!==e||(e="\\rangle"),n=Dt.includes(e)?Et:Lt.includes(e)?Pt:qt;const r=function(t,e,i,s){for(let o=Math.min(2,3-s.mathstyle.size);oe)return i[o]}var a;return i[i.length-1]}(wt.getValue("math",e),i,n,a);return"small"===r.type?function(t,e,i,s,a,o){const n=St("AMS-Regular",wt.getValue("math",e)),r=$.makeStyleWrap(t,n,a.mathstyle,i,o);return s&&r.setTop((1-a.mathstyle.sizeMultiplier/i.sizeMultiplier)*a.mathstyle.metrics.axisHeight),r.setStyle("color",a.color),"number"==typeof a.opacity&&r.setStyle("opacity",a.opacity),r}(t,e,r.mathstyle,s,a,o):"large"===r.type?Ct(t,e,r.size,s,a,o):Tt(t,e,i,s,a,o)}function Bt(t,e,i){return $.makeSpanOfType(t,"","sizing"+e.mathstyle.adjustTo(M.TEXT)+" nulldelimiter "+(i||""))}var Ot={makeSizedDelim:function(t,e,i,s,a){return"."===e?Bt(t,s,a):("<"===e||"\\lt"===e?e="\\langle":">"!==e&&"\\gt"!==e||(e="\\rangle"),Lt.includes(e)||Dt.includes(e)?Ct(t,e,i,!1,s,a):Ft.includes(e)?Tt(t,e,zt[i],!1,s,a):null)},makeCustomSizedDelim:It,makeLeftRightDelim:function(t,e,i,s,a,o){if("."===e)return Bt(t,a,o);const n=a.mathstyle.metrics.axisHeight*a.mathstyle.sizeMultiplier,r=5/m.METRICS.ptPerEm;let l=s+n,c=i-n;c=Math.max(l,c);let h=901*c/500;return l=2*c-r,h=Math.max(h,l),It(t,e,h,!0,a,o)}};const Rt=$.makeSpan,Kt=$.makeOrd,Nt=$.makeInner,$t=$.makeHlist,Wt=$.makeVlist,Ht=/\u0393|\u0394|\u0398|\u039b|\u039E|\u03A0|\u03A3|\u03a5|\u03a6|\u03a8|\u03a9|[\u03b1-\u03c9]|\u03d1|\u03d5|\u03d6|\u03f1|\u03f5/,Vt=/^([A-Za-z]|[\u03b1-\u03c9]|\u03d1|\u03d5|\u03d6|\u03f1|\u03f5)$/,Ut={size1:.5,size2:.7,size3:.8,size4:.9,size5:1,size6:1.2,size7:1.44,size8:1.73,size9:2.07,size10:2.49};class jt{constructor(t,e,i,s){this.mode=t,this.type=e,this.body=i,this.applyStyle(s)}getStyle(){return{color:this.phantom?"transparent":this.color,backgroundColor:this.phantom?"transparent":this.backgroundColor,fontFamily:this.baseFontFamily||this.fontFamily||this.autoFontFamily,fontShape:this.fontShape,fontSeries:this.fontSeries,fontSize:this.fontSize,cssId:this.cssId,cssClass:this.cssClass}}applyStyle(t){if(Object.assign(this,t),"none"===this.fontFamily&&(this.fontFamily=""),"auto"===this.fontShape&&(this.fontShape=""),"auto"===this.fontSeries&&(this.fontSeries=""),"none"===this.color&&(this.color=""),"none"===this.backgroundColor&&(this.backgroundColor=""),"auto"===this.fontSize&&(this.fontSize=""),this.fontSize&&(this.maxFontSize=Ut[this.fontSize]),"math"===this.mode){const t="string"==typeof this.body?this.body:"";this.autoFontFamily="cmr",Vt.test(t)?this.autoFontFamily="math":/\\imath|\\jmath|\\pounds/.test(t)?this.autoFontFamily="mainit":Ht.test(t)||"math"!==this.baseFontFamily||(this.autoFontFamily="cmr")}else"text"===this.mode&&("root"!==this.type&&(this.type=""),delete this.baseFontFamily,delete this.autoFontFamily)}getInitialBaseElement(){let t=this;return Array.isArray(this.body)&&this.body.length>0&&("first"!==this.body[0].type?t=this.body[0].getInitialBaseElement():this.body[1]&&(t=this.body[1].getInitialBaseElement())),t}getFinalBaseElement(){return Array.isArray(this.body)&&this.body.length>0?this.body[this.body.length-1].getFinalBaseElement():this}isCharacterBox(){const t=this.getInitialBaseElement();return/minner|mbin|mrel|mpunct|mopen|mclose|textord/.test(t.type)}forEach(t){if(t(this),Array.isArray(this.body))for(const e of this.body)e&&e.forEach(t);else this.body&&"object"==typeof this.body&&t(this.body);if(this.superscript)for(const e of this.superscript)e&&e.forEach(t);if(this.subscript)for(const e of this.subscript)e&&e.forEach(t);if(this.overscript)for(const e of this.overscript)e&&e.forEach(t);if(this.underscript)for(const e of this.underscript)e&&e.forEach(t);if(this.numer)for(const e of this.numer)e&&e.forEach(t);if(this.denom)for(const e of this.denom)e&&e.forEach(t);if(this.index)for(const e of this.index)e&&e.forEach(t);if(this.array)for(const e of this.array)for(const i of e)for(const e of i)e.forEach(t)}filter(t){let e=[];t(this)&&e.push(this);for(const i of["body","superscript","subscript","overscript","underscript","numer","denom","index"])if(Array.isArray(this[i]))for(const s of this[i])s&&(e=e.concat(s.filter(t)));if(Array.isArray(this.array))for(const i of this.array)for(const s of i)s&&(e=e.concat(s.filter(t)));return e}decomposeGroup(t){const e=t.clone({mathstyle:this.mathstyle}),i=Kt(Jt(e,this.body));return this.cssId&&(i.cssId=this.cssId),i.applyStyle({backgroundColor:this.backgroundColor,cssClass:this.cssClass}),i}decomposeArray(t){let e=this.colFormat;e&&0===e.length&&(e=[{align:"l"}]),e||(e=[{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"}]);const i=[];let s=0;for(const t of e)t.align&&s++;for(const t of this.array){let e=0;for(;e0&&(m+=r,o0&&u.push(Wt(t,i,"individualShift"))}const f=[];let g=!1,y=!1,b=0,x=!this.lFence;for(const i of e){if(i.align&&b>=u.length)break;if(i.align&&b0?3*c:7*h.defaultRuleThickness,m=e.metrics.denom1):(c>0?(d=e.metrics.num2,p=c):(d=e.metrics.num3,p=3*h.defaultRuleThickness),m=e.metrics.denom2);const u=o?o.depth:0,f=l?l.height:0;let g;if(0===c){const t=d-u-(f-m);t$.height(i)+$.depth(i)+o&&(o=(o+l-($.height(i)+$.depth(i)))/2),r.setTop(r.height-$.height(i)-(o+s));const c=Rt(null,t.mathstyle.adjustTo(M.TEXT)+" sqrt-line");c.applyStyle(this.getStyle()),c.height=s;const d=Wt(t,[i,o,c,s]);if(!this.index)return this.bind(t,Kt([r,d],"sqrt"));const p=t.clone({mathstyle:M.SCRIPTSCRIPT}),m=Rt(Jt(p,this.index),e.adjustTo(M.SCRIPTSCRIPT)),u=Math.max(r.height,d.height),f=Math.max(r.depth,d.depth),g=Wt(t,[m],"shift",-.6*(u-f));return this.bind(t,Kt([Rt(g,"root"),r,d],"sqrt"))}decomposeAccent(t){const e=t.mathstyle;let i=Jt(t.cramp(),this.body);(this.superscript||this.subscript)&&(i=this.attachSupsub(t,Kt(i),"mord"));let s=0;Array.isArray(this.body)&&1===this.body.length&&this.body[0].isCharacterBox()&&(s=$.skew(i));const a=Math.min($.height(i),e.metrics.xHeight),o=$.makeSymbol("Main-Regular",this.accent,"math");o.italic=0;const n="⃗"===this.accent?" accent-vec":"";let r=Rt(Rt(o),"accent-body"+n);return r=Wt(t,[i,-a,r]),r.children[1].setLeft(2*s),Kt(r,"accent")}decomposeLine(t){const e=t.mathstyle,i=Jt(t.cramp(),this.body),s=h.defaultRuleThickness/e.sizeMultiplier,a=Rt(null,t.mathstyle.adjustTo(M.TEXT)+" "+this.position+"-line");let o;if(a.height=s,a.maxFontSize=1,"overline"===this.position)o=Wt(t,[i,3*s,a,s]);else{const e=Rt(i);o=Wt(t,[s,a,3*s,e],"top",$.height(e))}return Kt(o,this.position)}decomposeOverunder(t){const e=Jt(t,this.body),i=t.clone({mathstyle:"scriptstyle"}),s=this.overscript?Rt(Jt(i,this.overscript),t.mathstyle.adjustTo(i.mathstyle)):null,a=this.underscript?Rt(Jt(i,this.underscript),t.mathstyle.adjustTo(i.mathstyle)):null;return Xt(t,e,0,0,s,a,this.mathtype||"mrel")}decomposeOverlap(t){const e=Rt(Jt(t,this.body),"inner");return Kt([e,Rt(null,"fix")],"left"===this.align?"llap":"rlap")}decomposeRule(t){const e=t.mathstyle,i=Kt("","rule");let s=this.shift&&!isNaN(this.shift)?this.shift:0;s/=e.sizeMultiplier;const a=this.width/e.sizeMultiplier,o=this.height/e.sizeMultiplier;return i.setStyle("border-right-width",a,"em"),i.setStyle("border-top-width",o,"em"),i.setStyle("margin-top",-(o-s),"em"),i.setStyle("border-color",t.color),i.width=a,i.height=o+s,i.depth=-s,i}decomposeOp(t){const e=t.mathstyle;let i,s=!1;e.size===M.DISPLAY.size&&"string"==typeof this.body&&"\\smallint"!==this.body&&(s=!0);let a=0,o=0;if(this.symbol){const n=s?"Size2-Regular":"Size1-Regular";i=$.makeSymbol(n,this.body,"op-symbol "+(s?"large-op":"small-op")),i.type="mop",a=(i.height-i.depth)/2-e.metrics.axisHeight*e.sizeMultiplier,o=i.italic,this.bind(t,i)}else Array.isArray(this.body)?(i=$.makeOp(Jt(t,this.body)),this.bind(t,i)):i=this.makeSpan(t,this.body);if(this.superscript||this.subscript){const s=this.limits||"auto";return this.alwaysHandleSupSub||"limits"===s||"auto"===s&&e.size===M.DISPLAY.size?this.attachLimits(t,i,a,o):this.attachSupsub(t,i,"mop")}return this.symbol&&i.setTop(a),i}decomposeBox(t){const e=Kt(Jt(t,this.body)),i=Rt();i.setStyle("position","absolute");const s="number"==typeof this.padding?this.padding:h.fboxsep;i.setStyle("height",e.height+e.depth+2*s,"em"),0!==s?i.setStyle("width","calc(100% + "+2*s+"em)"):i.setStyle("width","100%"),i.setStyle("top",-s,"em"),i.setStyle("left",-s,"em"),i.setStyle("z-index","-1"),this.backgroundcolor&&i.setStyle("background-color",this.backgroundcolor),this.framecolor&&i.setStyle("border",h.fboxrule+"em solid "+this.framecolor),this.border&&i.setStyle("border",this.border),e.setStyle("display","inline-block"),e.setStyle("height",e.height+e.depth,"em"),e.setStyle("vertical-align",-e.depth+s,"em");const a=Rt([i,e]);return a.setStyle("position","relative"),a.setStyle("vertical-align",-s+e.depth,"em"),a.height=e.height+s,a.depth=e.depth+s,a.setLeft(s),a.setRight(s),a}decomposeEnclose(t){const e=Kt(Jt(t,this.body)),i="auto"===this.padding?.2:this.padding;e.setStyle("padding",i,"em"),e.setStyle("display","inline-block"),e.setStyle("height",e.height+e.depth,"em"),e.setStyle("left",-i,"em"),this.backgroundcolor&&"transparent"!==this.backgroundcolor&&e.setStyle("background-color",this.backgroundcolor);let s="";if(this.notation.box&&e.setStyle("border",this.borderStyle),this.notation.actuarial&&(e.setStyle("border-top",this.borderStyle),e.setStyle("border-right",this.borderStyle)),this.notation.madruwb&&(e.setStyle("border-bottom",this.borderStyle),e.setStyle("border-right",this.borderStyle)),this.notation.roundedbox&&(e.setStyle("border-radius",($.height(e)+$.depth(e))/2,"em"),e.setStyle("border",this.borderStyle)),this.notation.circle&&(e.setStyle("border-radius","50%"),e.setStyle("border",this.borderStyle)),this.notation.top&&e.setStyle("border-top",this.borderStyle),this.notation.left&&e.setStyle("border-left",this.borderStyle),this.notation.right&&e.setStyle("border-right",this.borderStyle),this.notation.bottom&&e.setStyle("border-bottom",this.borderStyle),this.notation.horizontalstrike&&(s+='0?i.setWidth(this.width):i.setStyle("margin-left",this.width,"em");else{const t={qquad:"qquad",quad:"quad",enspace:"enspace",";":"thickspace",":":"mediumspace",",":"thinspace","!":"negativethinspace"}[this.body]||"quad";i=Rt("​","mspace "+t)}else"mathstyle"===this.type?t.setMathstyle(this.mathstyle):"box"===this.type?i=this.decomposeBox(t):"enclose"===this.type?i=this.decomposeEnclose(t):"command"===this.type||"error"===this.type?(i=this.makeSpan(t,this.body),i.classes="",this.error&&(i.classes+=" ML__error"),this.suggestion&&(i.classes+=" ML__suggestion")):"placeholder"===this.type?i=this.makeSpan(t,"⬚"):"first"===this.type&&(i=this.makeSpan(t,"​"));if(!i)return i;if(this.caret&&"styling"!==this.type&&"msubsup"!==this.type&&"command"!==this.type&&"placeholder"!==this.type&&"first"!==this.type&&(Array.isArray(i)?i[i.length-1].caret=this.caret:i.caret=this.caret),!this.limits&&(this.superscript||this.subscript))if(Array.isArray(i)){const e=i[i.length-1];i[i.length-1]=this.attachSupsub(t,e,e.type)}else i=[this.attachSupsub(t,i,i.type)];return Array.isArray(i)?i:[i]}attachSupsub(t,e,i){if(!this.superscript&&!this.subscript)return e;const s=t.mathstyle;let a=null,o=null;if(this.superscript){const e=Jt(t.sup(),this.superscript);a=Rt(e,s.adjustTo(s.sup()))}if(this.subscript){const e=Jt(t.sub(),this.subscript);o=Rt(e,s.adjustTo(s.sub()))}let n,r=0,l=0;this.isCharacterBox()||(r=$.height(e)-s.metrics.supDrop,l=$.depth(e)+s.metrics.subDrop),n=s===M.DISPLAY?s.metrics.sup1:s.cramped?s.metrics.sup3:s.metrics.sup2;const c=M.TEXT.sizeMultiplier*s.sizeMultiplier,d=.5/h.ptPerEm/c;let p=null;if(o&&a){r=Math.max(r,n,a.depth+.25*s.metrics.xHeight),l=Math.max(l,s.metrics.sub2);const i=h.defaultRuleThickness;if(r-$.depth(a)-($.height(o)-l)<4*i){l=4*i-(r-a.depth)+$.height(o);const t=.8*s.metrics.xHeight-(r-$.depth(a));t>0&&(r+=t,l-=t)}p=Wt(t,[o,l,a,-r],"individualShift"),this.symbol&&p.children[0].setLeft(-$.italic(e))}else o&&!a?(l=Math.max(l,s.metrics.sub1,$.height(o)-.8*s.metrics.xHeight),p=Wt(t,[o],"shift",l),p.children[0].setRight(d),this.isCharacterBox()&&p.children[0].setLeft(-$.italic(e))):!o&&a&&(r=Math.max(r,n,a.depth+.25*s.metrics.xHeight),p=Wt(t,[a],"shift",-r),p.children[0].setRight(d));const m=Rt(p,"msubsup");return this.caret&&(m.caret=this.caret),$.makeSpanOfType(i,[e,m])}attachLimits(t,e,i,s){const a=this.superscript?Rt(Jt(t.sup(),this.superscript),t.mathstyle.adjustTo(t.mathstyle.sup())):null,o=this.subscript?Rt(Jt(t.sub(),this.subscript),t.mathstyle.adjustTo(t.mathstyle.sub())):null;return Xt(t,e,i,s,a,o,"mop")}bind(t,e){return"first"!==this.type&&"​"!==this.body&&(this.id=function(t){let e;return"boolean"==typeof t.generateID&&t.generateID?e=Date.now().toString(36).slice(-2)+Math.floor(1e5*Math.random()).toString(36):"object"==typeof t.generateID&&(e=t.generateID.overrideID?t.generateID.overrideID:t.generateID.seed.toString(36),t.generateID.seed+=1),e}(t),this.id&&(e.attributes||(e.attributes={}),e.attributes["data-atom-id"]=this.id)),e}makeSpan(t,e){const i="textord"===this.type?"mord":this.type,s=$.makeSpanOfType(i,e),a=this.getStyle();s.applyStyle(a);const o=a&&a.fontSize?a.fontSize:"size5";return o!==t.parentSize?(s.classes+=" sizing reset-"+t.parentSize,s.classes+=" "+o):t.parentSize!==t.size&&(s.classes+=" sizing reset-"+t.parentSize,s.classes+=" "+t.size),s.maxFontSize=Math.max(s.maxFontSize,t.sizeMultiplier||1),"text"===this.mode&&(s.classes+=" ML__text"),t.mathstyle.isTight()&&(s.isTight=!0),"math"!==this.mode&&(s.italic=0),s.setRight(s.italic),"number"==typeof t.opacity&&s.setStyle("opacity",t.opacity),this.bind(t,s),this.caret&&(this.superscript||this.subscript||(s.caret=this.caret,t.mathstyle.isTight()&&(s.isTight=!0))),s}}function Gt(t){const e=Rt("​","arraycolsep");return e.setWidth(t,"em"),e}function Zt(t,e,i,s){const a=[];for(const o of e){const e=Rt(Jt(t,s));e.depth=o.depth,e.height=o.height,a.push(e),a.push(o.pos-i)}return Wt(t,a,"individualShift")}function Xt(t,e,i,s,a,o,n){if(!a&&!o)return e;e=Rt(e);let r=0,l=0;a&&(r=Math.max(h.bigOpSpacing1,h.bigOpSpacing3-a.depth)),o&&(l=Math.max(h.bigOpSpacing2,h.bigOpSpacing4-o.height));let c=null;if(o&&a){const n=h.bigOpSpacing5+$.height(o)+$.depth(o)+l+$.depth(e)+i;c=Wt(t,[h.bigOpSpacing5,o,l,e,r,a,h.bigOpSpacing5],"bottom",n),c.children[0].setLeft(-s),c.children[2].setLeft(s)}else if(o&&!a){const a=$.height(e)-i;c=Wt(t,[h.bigOpSpacing5,o,l,e],"top",a),c.children[0].setLeft(-s)}else if(!o&&a){const o=$.depth(e)+i;c=Wt(t,[e,r,a,h.bigOpSpacing5],"bottom",o),c.children[1].setLeft(s)}return $.makeSpanOfType(n,c,"op-limits")}function Jt(t,e){function i(t){return"mord"===t.type&&/[0-9,.]/.test(t.latex)}function s(t){return"text"===t.mode}t instanceof _||(t=new _(t));const a=!t.generateID||!t.generateID.groupNumbers;let o=[];if(Array.isArray(e)){if(0===e.length)return o;if(1===e.length)o=e[0].decompose(t),o&&a&&e[0].isSelected&&o.forEach(t=>t.selected(!0));else{let n="none",r=e[1].type,l=[],c=null,h=!0,d=null;for(let p=0;pt.selected(!0))):(l.length>0&&(o=[...o,...l],l=[]),o=o.concat(n))}n=e[p].getFinalBaseElement().type,r=e[p+1]?e[p+1].getInitialBaseElement().type:"none"}l.length>0&&(o=[...o,...l],l=[])}}else e&&(o=e.decompose(t),o&&a&&e.isSelected&&o.forEach(t=>t.selected(!0)));if(!o||0===o.length)return null;if(t.mathstyle!==t.parentMathstyle){const e=t.mathstyle.sizeMultiplier/t.parentMathstyle.sizeMultiplier;for(const t of o)t.height*=e,t.depth*=e}if(t.size!==t.parentSize){const e=Ut[t.size]/Ut[t.parentSize];for(const t of o)t.height*=e,t.depth*=e}return o}var Yt={MathAtom:jt,decompose:Jt,makeRoot:function(t,e){const i=new jt(t=t||"math","root",e||[]);return 0!==i.body.length&&"first"===i.body[0].type||i.body.unshift(new jt("","first")),i},GREEK_REGEX:Ht};const Qt={m0:"#3f3d99",m1:"#993d71",m2:"#998b3d",m3:"#3d9956",m4:"#3d5a99",m5:"#993d90",m6:"#996d3d",m7:"#43993d",m8:"#3d7999",m9:"#843d99"},te={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"};var ee=function(t){const e=t.toLowerCase().split("!");let i,s,a,o=255,n=255,r=255,l=-1;const c=e.length>0&&"-"===e[0].charAt(0);c&&(e[0]=e[0].slice(1));for(let t=0;t=0&&(o=(1-l)*o+l*i,n=(1-l)*n+l*s,r=(1-l)*r+l*a,l=-1),t+1=0&&(o=l*o+(1-l)*i,n=l*n+(1-l)*s,r=l*r+(1-l)*a),c&&(o=255-o,n=255-n,r=255-r),"#"+("00"+Math.round(o).toString(16)).slice(-2)+("00"+Math.round(n).toString(16)).slice(-2)+("00"+Math.round(r).toString(16)).slice(-2)},ie=function(t){let e=t.toUpperCase();for(const t in te)if(te[t]===e){e=t;break}for(const t in Qt)if(Qt[t]===e){e=t;break}return e},se=["#d35d60","#7293cb","#e1974d","#84bb5d","#9066a7","#aD6a58","#f5a4ce","#fff590","#212121","#818787","#d4d5d2","#ffffff"],ae=["#cc2428","#3769b1","#da7e30","#409852","#6b4c9a","#922426","#e7298a","#ffe907","#000000","#525055","#adafaa","#ffffff"];const oe=Yt.MathAtom;class ne{constructor(t,e,i){this.tokens=t,this.index=0,this.args=e,this.macros=i,this.mathList=[],this.style={},this.parseMode="math",this.tabularMode=!1,this.endCount=0}swapMathList(t){const e=this.mathList;return this.mathList=t||[],e}swapParseMode(t){const e=this.parseMode;return this.parseMode=t,e}end(){return this.endCount++,this.index>=this.tokens.length||this.endCount>1e3}get(){return this.endCount=0,this.index=t.length}const a=t.toUpperCase()===s.toUpperCase();return a||(this.index=e),a}scanString(){let t="",e=this.end();for(;!e;){if(this.hasLiteral("]"))e=!0;else if(this.hasToken("literal"))t+=this.get().value;else if(this.skipWhitespace())t+=" ";else if(this.hasToken("command")){const e=this.get();"space"===e.value?t+=" ":t+=e.value}else e=!0;e=e||this.end()}return t}scanColor(){return ee(this.scanString())}scanNumber(t){const e=this.parseLiteral("-");e||this.parseLiteral("+"),this.skipWhitespace(),t=!!t;let i=10,s=/[0-9]/;this.parseLiteral("'")?(i=8,s=/[0-7]/,t=!0):(this.parseLiteral('"')||this.parseLiteral("x"))&&(i=16,s=/[0-9A-F]/,t=!0);let a="";for(;this.hasLiteralPattern(s);)a+=this.get().value;if(!t&&(this.parseLiteral(".")||this.parseLiteral(",")))for(a+=".";this.hasLiteralPattern(s);)a+=this.get().value;const o=t?parseInt(a,i):parseFloat(a);return e?-o:o}scanDimen(){const t=this.scanNumber(!1);let e;return this.skipWhitespace(),e=this.parseKeyword("pt")?m.toEm(t,"pt"):this.parseKeyword("mm")?m.toEm(t,"mm"):this.parseKeyword("cm")?m.toEm(t,"cm"):this.parseKeyword("ex")?m.toEm(t,"ex"):this.parseKeyword("px")?m.toEm(t,"px"):this.parseKeyword("em")?m.toEm(t,"em"):this.parseKeyword("bp")?m.toEm(t,"bp"):this.parseKeyword("dd")?m.toEm(t,"dd"):this.parseKeyword("pc")?m.toEm(t,"pc"):this.parseKeyword("in")?m.toEm(t,"in"):this.parseKeyword("mu")?m.toEm(t,"mu"):m.toEm(t,"pt"),e}scanSkip(){const t=this.scanDimen();return this.skipWhitespace(),this.parseKeyword("plus")&&this.scanDimen(),this.skipWhitespace(),this.parseKeyword("minus")&&this.scanDimen(),t}scanColspec(){this.skipWhitespace();const t=[];for(;!this.end()&&!this.hasToken("}")&&!this.hasLiteral("]");)if(this.hasLiteral()){const e=this.get().value;if("lcr".includes(e))t.push({align:e});else if("|"===e)t.push({rule:!0});else if("@"===e){if(this.parseToken("{")){const e=this.swapParseMode("math");t.push({gap:this.scanImplicitGroup(t=>"}"===t.type)}),this.swapParseMode(e)}this.parseToken("}")}}return t}scanModeSet(){let t;if(this.parseCommand("(")&&(t=")"),!t&&this.parseCommand("[")&&(t="]"),!t)return null;const e=this.swapParseMode("math"),i=new oe("math","group");return i.mathstyle=")"===t?"textstyle":"displaystyle",i.body=this.scanImplicitGroup(e=>"command"===e.type&&e.value===t),this.parseCommand(t),this.swapParseMode(e),i.body&&0!==i.body.length?i:null}scanModeShift(){if(!this.hasToken("$")&&!this.hasToken("$$"))return null;const t=this.get().type,e=new oe("math","group");e.mathstyle="$"===t?"textstyle":"displaystyle",e.latexOpen="textstyle"===e.mathstyle?"$":"$$",e.latexClose=e.latexOpen;const i=this.swapParseMode("math");return e.body=this.scanImplicitGroup(e=>e.type===t),this.parseToken(t),this.swapParseMode(i),e.body&&0!==e.body.length?e:null}scanEnvironment(){if(!this.parseCommand("begin"))return null;const t=this.scanArg("string"),e=wt.getEnvironmentInfo(t),i=[];if(e&&e.params)for(const t of e.params)if(t.optional){const e=this.scanOptionalArg(t.type);i.push(e)}else i.push(this.scanArg(t.type));const s=this.parseMode,a=this.tabularMode,o=this.swapMathList([]);this.tabularMode=e.tabular;const n=[],r=[];let l=[],c=!1;do{if(c=this.end(),!c&&this.parseCommand("end")&&(c=this.scanArg("string")===t),!c)if(this.parseColumnSeparator())l.push(this.swapMathList([]));else if(this.parseRowSeparator()){l.push(this.swapMathList([]));let t=0;this.skipWhitespace(),this.parseLiteral("[")&&(t=this.scanDimen(),this.skipWhitespace(),this.parseLiteral("]")),r.push(t||0),n.push(l),l=[]}else this.mathList=this.mathList.concat(this.scanImplicitGroup())}while(!c);l.push(this.swapMathList([])),l.length>0&&n.push(l);const h=this.swapMathList(o);if(this.parseMode=s,this.tabularMode=a,!e.tabular&&0===h.length)return null;if(e.tabular&&0===n.length)return null;const d=new oe(this.parseMode,"array",h,e.parser?e.parser(t,i,n):{});return d.array=n,d.rowGaps=r,d.env={...e},d.env.name=t,d}scanImplicitGroup(t){const e=this.style;t||(t=t=>"}"===t.type||"literal"===t.type&&"&"===t.value||"command"===t.type&&/^(end|cr|\\)$/.test(t.value));let i=null,s=null;const a=this.swapMathList([]);for(;!this.end()&&!t(this.peek());)if(this.hasImplicitCommand(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"])){this.parseMode="math";const t=new oe("math","mathstyle");t.mathstyle=this.get().value,this.mathList.push(t)}else this.hasInfixCommand()&&!i?(i=this.get(),s=this.swapMathList([])):this.parseAtom();let o;if(i){const t=this.swapMathList(a),e=wt.getInfo("\\"+i.value,"math",this.macros);o=e?[new oe(this.parseMode,e.type,e.value||i.value,e.parse?e.parse("\\"+i.value,[s,t]):null)]:[new oe(this.parseMode,"mop",i.value)]}else o=this.swapMathList(a);return this.style=e,o}scanGroup(){if(!this.parseToken("{"))return null;const t=new oe(this.parseMode,"group");return t.body=this.scanImplicitGroup(t=>"}"===t.type),this.parseToken("}"),t.latexOpen="{",t.latexClose="}",t}scanSmartFence(){if(this.skipWhitespace(),!this.parseLiteral("("))return null;const t=new oe(this.parseMode,"leftright");t.leftDelim="(",t.inner=!1;const e=this.swapMathList([]);let i=1;for(;!this.end()&&0!==i;)this.hasLiteral("(")&&(i+=1),this.hasLiteral(")")&&(i-=1),0!==i&&this.parseAtom();return 0===i&&this.parseLiteral(")"),t.rightDelim=0===i?")":"?",t.body=this.swapMathList(e),t}scanDelim(){this.skipWhitespace();const t=this.get();if(!t)return null;let e=".";"command"===t.type?e="\\"+t.value:"literal"===t.type&&(e=t.value);const i=wt.getInfo(e,"math",this.macros);return i?"mopen"===i.type||"mclose"===i.type?e:/^(\?|\||<|>|\\vert|\\Vert|\\\||\\surd|\\uparrow|\\downarrow|\\Uparrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\mid|\\mvert|\\mVert)$/.test(e)?e:null:null}scanLeftRight(){if(this.parseCommand("right")||this.parseCommand("mright"))return null;const t=this.style;let e="right";if(!this.parseCommand("left")){if(!this.parseCommand("mleft"))return null;e="mright"}const i=this.scanDelim();if(!i)return null;const s=this.swapMathList([]);for(;!this.end()&&!this.parseCommand(e);)this.parseAtom();this.style=t;const a=this.scanDelim(),o=new oe(this.parseMode,"leftright");return o.leftDelim=i,o.rightDelim=a,o.inner="right"===e,o.body=this.swapMathList(s),o}parseSupSub(){if("math"!==this.parseMode)return!1;let t=!1;for(;this.hasLiteral("^")||this.hasLiteral("_")||this.hasLiteral("'");){let e;if(this.hasLiteral("^")?e="superscript":this.hasLiteral("_")&&(e="subscript"),this.parseLiteral("^")||this.parseLiteral("_")){const i=this.scanArg();if(i){const s=this.lastMathAtom();s[e]=s[e]||[],s[e]=s[e].concat(i),t=!0}}else if(this.parseLiteral("'")){const e=this.lastMathAtom();e.superscript=e.superscript||[],e.superscript.push(new oe(e.parseMode,"mord","′")),t=!0}}return t}parseLimits(){if(this.parseCommand("limits")){const t=this.lastMathAtom();return t.limits="limits",t.explicitLimits=!0,!0}if(this.parseCommand("nolimits")){const t=this.lastMathAtom();return t.limits="nolimits",t.explicitLimits=!0,!0}return!1}scanOptionalArg(t){if(t=t&&"auto"!==t?t:this.parseMode,this.skipWhitespace(),!this.parseLiteral("["))return null;const e=this.parseMode;this.parseMode=t;const i=this.swapMathList();let s;for(;!this.end()&&!this.parseLiteral("]");)if("string"===t)s=this.scanString();else if("number"===t)s=this.scanNumber();else if("dimen"===t)s=this.scanDimen();else if("skip"===t)s=this.scanSkip();else if("colspec"===t)s=this.scanColspec();else if("color"===t)s=this.scanColor()||"#ffffff";else if("bbox"===t){const t=this.scanString().toLowerCase().trim().split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const e of t){const t=ee(e);if(t)s=s||{},s.backgroundcolor=t;else{const t=e.match(/^\s*([0-9.]+)\s*([a-z][a-z])/);if(t)s=s||{},s.padding=m.toEm(t[1],t[2]);else{const t=e.match(/^\s*border\s*:\s*(.*)/);t&&(s=s||{},s.border=t[1])}}}}else this.mathList=this.mathList.concat(this.scanImplicitGroup(t=>"literal"===t.type&&"]"===t.value));this.parseMode=e;const a=this.swapMathList(i);return s||a}scanArg(t){let e;if(t=t&&"auto"!==t?t:this.parseMode,this.parseFiller(),!this.parseToken("{")){if("delim"===t)return this.scanDelim()||".";if(/^(math|text)$/.test(t)){const e=this.parseMode;this.parseMode=t;const i=this.scanToken();return this.parseMode=e,Array.isArray(i)?i:i?[i]:null}}if(this.hasToken("#")){const t=this.get();return this.skipUntilToken("}"),"?"===t.value?this.placeholder():this.args?void 0===this.args[t.value]&&void 0!==this.args["?"]?this.placeholder():this.args[t.value]||null:null}const i=this.parseMode;this.parseMode=t;const s=this.swapMathList([]);if("string"===t)e=this.scanString(),this.skipUntilToken("}");else if("number"===t)e=this.scanNumber(),this.skipUntilToken("}");else if("dimen"===t)e=this.scanDimen(),this.skipUntilToken("}");else if("skip"===t)e=this.scanSkip(),this.skipUntilToken("}");else if("colspec"===t)e=this.scanColspec(),this.skipUntilToken("}");else if("color"===t)e=this.scanColor()||"#ffffff",this.skipUntilToken("}");else if("delim"===t)e=this.scanDelim()||".",this.skipUntilToken("}");else do{this.mathList=this.mathList.concat(this.scanImplicitGroup())}while(!this.parseToken("}")&&!this.end());this.parseMode=i;const a=this.swapMathList(s);return e||a}scanToken(){const t=this.get();if(!t)return null;let e=null;if("space"===t.type)"text"===this.parseMode&&(e=new oe("text",""," ",this.style));else if("placeholder"===t.type)e=new oe(this.parseMode,"placeholder",t.value),e.captureSelection=!0;else if("command"===t.type){if("placeholder"===t.value)e=new oe(this.parseMode,"placeholder",this.scanArg("string"),this.style),e.captureSelection=!0;else if("char"===t.value){let t=Math.floor(this.scanNumber(!0));(!isFinite(t)||t<0||t>1114111)&&(t=10067),e=new oe(this.parseMode,"math"===this.parseMode?"mord":"",String.fromCodePoint(t)),e.latex='{\\char"'+("000000"+t.toString(16)).toUpperCase().substr(-6)+"}"}else if("hskip"===t.value||"kern"===t.value){const i=this.scanSkip();isFinite(i)&&(e=new oe(this.parseMode,"spacing",null,this.style),e.width=i),e.latex="\\"+t.value}else if(e=this.scanMacro(t.value),!e){const i=wt.getInfo("\\"+t.value,this.parseMode,this.macros),s=[];let a="",o="";if(i&&i.params)for(const t of i.params)if(t.optional){const e=this.scanOptionalArg(t.type);s.push(e)}else if(t.type.endsWith("*"))o=t.type.slice(0,-1);else{const e=this.scanArg(t.type);if(e&&1===e.length&&"placeholder"===e[0].type&&t.placeholder&&(e[0].value=t.placeholder),e)s.push(e);else if(t.placeholder){const e=new oe(this.parseMode,"placeholder",t.placeholder);e.captureSelection=!0,s.push([e])}else s.push(this.placeholder());"math"!==t.type&&"string"==typeof e&&(a+=e)}if(i&&!i.infix){if(i.parse){const a=i.parse("\\"+t.value,s);if(a.type)e=new oe(this.parseMode,i.type,o?this.scanArg(o):null,{...this.style,...a});else{const t=this.parseMode;if(a.mode&&(this.parseMode=a.mode,delete a.mode),o){const t=this.style;this.style={...this.style,...a},e=this.scanArg(o),this.style=t}else this.style={...this.style,...a};this.parseMode=t}}else{const s={...this.style};i.baseFontFamily&&(s.baseFontFamily=i.baseFontFamily),e=new oe(this.parseMode,i.type||"mop",i.value||t.value,s),i.skipBoundary&&(e.skipBoundary=!0)}if(e&&!/^(llap|rlap|class|cssId)$/.test(t.value)&&(e.latex="\\"+t.value,a&&(e.latex+="{"+a+"}"),e.isFunction&&this.smartFence)){const t=this.scanSmartFence();t&&(e=[e,t])}}i||(e=new oe(this.parseMode,"error","\\"+t.value),e.latex="\\"+t.value)}}else if("literal"===t.type){const i=wt.getInfo(t.value,this.parseMode,this.macros);if(i){const s={...this.style};i.baseFontFamily&&(s.baseFontFamily=i.baseFontFamily),e=new oe(this.parseMode,i.type,i.value||t.value,s),i.isFunction&&(e.isFunction=!0)}else e=new oe(this.parseMode,"math"===this.parseMode?"mord":"",t.value,this.style);if(e.latex=wt.matchCodepoint(this.parseMode,t.value.codePointAt(0)),i&&i.isFunction&&this.smartFence){const t=this.scanSmartFence();t&&(e=[e,t])}}else if("#"===t.type)if("?"===t.value)e=this.placeholder();else if(this.args)if(e=this.args[t.value]||null,Array.isArray(e)&&1===e.length)e=e[0];else if(Array.isArray(e)){const t=new oe(this.parseMode,"group");t.body=e,e=t}else e=this.placeholder();return e}scanMacro(t){if(!this.macros||!this.macros[t])return null;const e={};let i,s=0;"string"==typeof this.macros[t]?(i=this.macros[t],/(^|[^\\])#1/.test(i)&&(s=1),/(^|[^\\])#2/.test(i)&&(s=2),/(^|[^\\])#3/.test(i)&&(s=3),/(^|[^\\])#4/.test(i)&&(s=4),/(^|[^\\])#5/.test(i)&&(s=5),/(^|[^\\])#6/.test(i)&&(s=6),/(^|[^\\])#7/.test(i)&&(s=7),/(^|[^\\])#8/.test(i)&&(s=8),/(^|[^\\])#9/.test(i)&&(s=9)):(i=this.macros[t].def,s=this.macros[t].args||0);for(let t=1;t<=s;t++)e[t]=this.scanArg();this.args&&"string"==typeof this.args["?"]&&(e["?"]=this.args["?"]);const a=new oe(this.parseMode,"group",re(n(i),this.parseMode,e,this.macros));a.captureSelection=!0,a.latex="\\"+t;let o="";for(let t=1;t<=s;t++){if(o+="{",Array.isArray(e[t]))for(let i=0;i1&&(e.extent=parseInt(i[1]));const s=i[0].split("/");for(const t of s){const i=t.match(/([^:]*):(.*)/);i&&e.path.push({relation:i[1],offset:parseInt(i[2])})}return e}var de={pathFromString:he,pathToString:ce,pathDistance:function(t,e){let i=0,s=-1,a=!1;for(;!a;)s+=1,a=s>=t.length||s>=e.length,a=a||!(t[s].relation===e[s].relation&&t[s].offset===e[s].offset);return i=s===t.length&&s===e.length?0:s+1===t.length&&s+1===e.length&&t[s].relation===e[s].relation?1:2,i},pathCommonAncestor:function(t,e){const i=[],s=Math.min(t.length-1,e.length-1);let a=0;for(;a<=s&&t[a].relation===e[a].relation&&t[a].offset===e[a].offset;)i.push(t[a]),a+=1;return i},clone:function(t){return he(ce(t)).path}};const pe={Left:"moveToPreviousChar",Right:"moveToNextChar",Up:"moveUp",Down:"moveDown","Shift-Left":"extendToPreviousChar","Shift-Right":"extendToNextChar","Shift-Up":"extendUp","Shift-Down":"extendDown",Backspace:"deletePreviousChar","Alt-Del":"deletePreviousChar",Del:"deleteNextChar","Alt-Backspace":"deleteNextChar","Alt-Left":"moveToPreviousWord","Alt-Right":"moveToNextWord","Alt-Shift-Left":"extendToPreviousWord","Alt-Shift-Right":"extendToNextWord","Ctrl-Left":"moveToGroupStart","Ctrl-Right":"moveToGroupEnd","Ctrl-Shift-Left":"extendToGroupStart","Ctrl-Shift-Right":"extendToGroupEnd","math:Spacebar":"moveAfterParent","math:Shift-Spacebar":"moveBeforeParent",Home:"moveToMathFieldStart","mac:Meta-Left":"moveToMathFieldStart","Shift-Home":"extendToMathFieldStart","mac:Meta-Shift-Left":"extendToMathFieldStart",End:"moveToMathFieldEnd","mac:Meta-Right":"moveToMathFieldEnd","Shift-End":"extendToMathFieldEnd","mac:Meta-Shift-Right":"extendToMathFieldEnd",PageUp:"moveToGroupStart",PageDown:"moveToGroupEnd","math:Tab":"moveToNextPlaceholder","math:F8":"moveToNextPlaceholder","math:Shift-Tab":"moveToPreviousPlaceholder","math:Shift-F8":"moveToPreviousPlaceholder","text:Tab":"moveToNextPlaceholder","text:F8":"moveToNextPlaceholder","text:Shift-Tab":"moveToPreviousPlaceholder","text:Shift-F8":"moveToPreviousPlaceholder","math:Esc":["switch-mode","command"],"math:Backslash":["switch-mode","command"],"math:IntlBackslash":["switch-mode","command"],"math:Alt-Equal":["apply-style",{mode:"text"}],"text:Alt-Equal":["apply-style",{mode:"math"}],"command:Esc":["complete",{discard:!0}],"command:Tab":["complete",{acceptSuggestion:!0}],"command:Return":"complete","command:Enter":"complete","command:Shift-Esc":["complete",{discard:!0}],"command:Down":"nextSuggestion","ios:command:Tab":"nextSuggestion","command:Up":"previousSuggestion","!mac:Ctrl-KeyA":"selectAll","mac:Meta-KeyA":"selectAll",Cut:"cut",Copy:"copy",Paste:"paste",Clear:"delete","!mac:Ctrl-KeyZ":"undo","mac:Meta-KeyZ":"undo",Undo:"undo","!mac:Ctrl-KeyY":"redo","mac:Meta-Shift-KeyY":"redo","!mac:Ctrl-Shift-KeyZ":"redo","mac:Meta-Shift-KeyZ":"redo",Redo:"redo",EraseEof:"deleteToGroupEnd","mac:Ctrl-KeyB":"moveToPreviousChar","mac:Ctrl-KeyF":"moveToNextChar","mac:Ctrl-KeyP":"moveUp","mac:Ctrl-KeyN":"moveDown","mac:Ctrl-KeyA":"moveToMathFieldStart","mac:Ctrl-KeyE":"moveToMathFieldEnd","mac:Ctrl-Shift-KeyB":"extendToPreviousChar","mac:Ctrl-Shift-KeyF":"extendToNextChar","mac:Ctrl-Shift-KeyP":"extendUp","mac:Ctrl-Shift-KeyN":"extendDown","mac:Ctrl-Shift-KeyA":"extendToMathFieldStart","mac:Ctrl-Shift-KeyE":"extendToMathFieldEnd","mac:Ctrl-Alt-KeyB":"moveToPreviousWord","mac:Ctrl-Alt-KeyF":"moveToNextWord","mac:Ctrl-Shift-Alt-KeyB":"extendToPreviousWord","mac:Ctrl-Shift-Alt-KeyF":"extendToNextWord","mac:Ctrl-KeyH":"deletePreviousChar","mac:Ctrl-KeyD":"deleteNextChar","mac:Ctrl-KeyL":"scrollIntoView","mac:Ctrl-KeyT":"transpose","math:Shift-Quote":["switch-mode","text","","“"],"text:Shift-Quote":["switch-mode","math","”",""],"math:Ctrl-Digit2":["insert","\\sqrt{#0}"],"math:Ctrl-Digit5":"moveToOpposite","math:Ctrl-Digit6":"moveToSuperscript","math:Ctrl-Minus":"moveToSubscript","math:Alt-BracketLeft":["insert","\\left\\lbrack #0 \\right\\rbrack"],"math:Alt-Shift-BracketLeft":["insert","\\left\\lbrace #0 \\right\\rbrace"],"math:Return":"addRowAfter","math:Enter":"addRowAfter","math:Ctrl-Comma":"addColumnAfter","math:Alt-KeyQ":["insert","\\theta"],"math:Alt-KeyP":["insert","\\pi"],"math:Alt-KeyV":["insert","\\sqrt{#0}"],"math:Alt-KeyW":["insert","\\sum_{i=#?}^{#?}"],"math:Alt-KeyB":["insert","\\int_{#?}^{#?}"],"math:Alt-KeyU":["insert","\\cup"],"math:Alt-KeyN":["insert","\\cap"],"math:Alt-KeyO":["insert","\\emptyset"],"math:Alt-KeyD":["insert","\\differentialD"],"math:Alt-Shift-KeyO":["insert","\\varnothing"],"math:Alt-Shift-KeyD":["insert","\\partial"],"math:Alt-Shift-KeyP":["insert","\\prod_{i=#?}^{#?}"],"math:Alt-Shift-KeyU":["insert","\\bigcup"],"math:Alt-Shift-KeyN":["insert","\\bigcap"],"math:Alt-Shift-KeyA":["insert","\\forall"],"math:Alt-Shift-KeyE":["insert","\\exists"],"math:Alt-Digit5":["insert","\\infty"],"math:Alt-Digit6":["insert","\\wedge"],"math:Alt-Shift-Digit6":["insert","\\vee"],"math:Alt-Digit9":["insert","("],"math:Alt-Digit0":["insert",")"],"math:Alt-Shift-Backslash":["insert","|"],"math:Alt-Backslash":["insert","\\backslash"],"math:Slash":["insert","\\frac{#@}{#?}"],"math:Alt-Slash":["insert","\\frac{#?}{#@}"],"math:NumpadDivide":["insert","\\frac{#@}{#?}"],"math:Alt-NumpadDivide":["insert","\\frac{#?}{#@}"],"math:Shift-Backquote":["insert","\\~"],"math:Alt-Shift-Slash":["insert","\\/"],"Alt-Shift-KeyK":"toggleKeystrokeCaption","Alt-Space":"toggleVirtualKeyboard","mac:Ctrl-Meta-Up":["speak","parent",{withHighlighting:!1}],"!mac:Ctrl-Alt-Up":["speak","parent",{withHighlighting:!1}],"mac:Ctrl-Meta-Down":["speak","all",{withHighlighting:!1}],"!mac:Ctrl-Alt-Down":["speak","all",{withHighlighting:!1}],"mac:Ctrl-Meta-Left":["speak","left",{withHighlighting:!1}],"!mac:Ctrl-Alt-Left":["speak","left",{withHighlighting:!1}],"mac:Ctrl-Meta-Right":["speak","right",{withHighlighting:!1}],"!mac:Ctrl-Alt-Right":["speak","right",{withHighlighting:!1}],"!mac:Ctrl-Alt-Period":["speak","selection",{withHighlighting:!1}],"mac:Ctrl-Meta-Period":["speak","selection",{withHighlighting:!1}],"mac:Ctrl-Meta-Shift-Up":["speak","parent",{withHighlighting:!0}],"!mac:Ctrl-Alt-Shift-Up":["speak","parent",{withHighlighting:!0}],"mac:Ctrl-Meta-Shift-Down":["speak","all",{withHighlighting:!0}],"!mac:Ctrl-Alt-Shift-Down":["speak","all",{withHighlighting:!0}],"mac:Ctrl-Meta-Shift-Left":["speak","left",{withHighlighting:!0}],"!mac:Ctrl-Alt-Shift-Left":["speak","left",{withHighlighting:!0}],"mac:Ctrl-Meta-Shift-Right":["speak","right",{withHighlighting:!0}],"!mac:Ctrl-Alt-Shift-Right":["speak","right",{withHighlighting:!0}],"!mac:Ctrl-Alt-Shift-Period":["speak","selection",{withHighlighting:!0}],"mac:Ctrl-Meta-Shift-Period":["speak","selection",{withHighlighting:!0}]},me={"\\theta":"Alt-KeyQ","\\sqrt":["Alt-KeyV","Ctrl-Digit2"],"\\pi":"Alt-KeyP","\\prod":"Alt-Shift-KeyP","\\sum":"Alt-KeyW","\\int":"Alt-KeyB","\\cup":"Alt-KeyU","\\cap":"Alt-KeyN","\\bigcup":"Alt-Shift-KeyU","\\bigcap":"Alt-Shift-KeyN","\\forall":"Alt-Shift-KeyA","\\exists":"Alt-Shift-KeyE","\\infty":"Alt-Digit5","\\wedge":"Alt-Digit5","\\vee":"Alt-Shift-Digit6","\\differentialD":"Alt-keyD","\\partial":"Alt-Shift-KeyD","\\frac":"Slash","\\emptyset":"Alt-KeyO","\\varnothing":"Alt-Shift-KeyO","\\~":"~"},ue={"''":{mode:"math",value:"^{\\doubleprime}"},alpha:"\\alpha",delta:"\\delta",Delta:"\\Delta",pi:{mode:"math",value:"\\pi"},"pi ":{mode:"text",value:"\\pi "},Pi:{mode:"math",value:"\\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:{mode:"math",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\exponentialE"},nabla:{mode:"math",value:"\\nabla"},grad:{mode:"math",value:"\\nabla"},del:{mode:"math",value:"\\partial"},"∞":"\\infty",oo:{mode:"math",after:"nothing+digit+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\infty"},"∑":{mode:"math",value:"\\sum"},sum:{mode:"math",value:"\\sum_{#?}^{#?}"},prod:{mode:"math",value:"\\prod_{#?}^{#?}"},sqrt:{mode:"math",value:"\\sqrt"},"∆":{mode:"math",value:"\\differentialD"},"∂":{mode:"math",value:"\\differentialD"},sin:{mode:"math",value:"\\sin"},cos:{mode:"math",value:"\\cos"},tan:{mode:"math",value:"\\tan"},tanh:{mode:"math",value:"\\tanh"},log:{mode:"math",value:"\\log"},ln:{mode:"math",value:"\\ln"},exp:{mode:"math",value:"\\exp"},lim:{mode:"math",value:"\\lim_{#?}"},dx:"\\differentialD x",dy:"\\differentialD y",dt:"\\differentialD t",AA:{mode:"math",value:"\\forall"},EE:{mode:"math",value:"\\exists"},"!EE":{mode:"math",value:"\\nexists"},"&&":{mode:"math",value:"\\land"},xin:{mode:"math",after:"nothing+text+relop+punct+openfence+space",value:"x \\in"},in:{mode:"math",after:"nothing+letter+closefence",value:"\\in"},"!in":{mode:"math",value:"\\notin"},NN:"\\N",ZZ:"\\Z",QQ:"\\Q",RR:"\\R",CC:"\\C",PP:"\\P",xx:"\\times","+-":"\\pm","!=":"\\ne",">=":"\\ge","<=":"\\le","<<":"\\ll",">>":"\\gg","~~":"\\approx","≈":"\\approx","?=":"\\questeq","÷":"\\div","¬":"\\neg",":=":"\\coloneq","::":"\\Colon","(:":"\\langle",":)":"\\rangle",beta:"\\beta",chi:"\\chi",epsilon:"\\epsilon",varepsilon:"\\varepsilon",eta:{mode:"math",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\eta"},"eta ":{mode:"text",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:{mode:"math",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\mu"},"mu ":{mode:"text",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\mu "},nu:{mode:"math",after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\nu"},"nu ":{mode:"text",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+text",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:{mode:"math",value:"\\exists"},"!exists":{mode:"math",value:"\\nexists"},":.":{mode:"math",value:"\\therefore"},liminf:"\\operatorname*{lim~inf}_{#?}",limsup:"\\operatorname*{lim~sup}_{#?}",argmin:"\\operatorname*{arg~min}_{#?}",argmax:"\\operatorname*{arg~max}_{#?}",det:"\\det",mod:{mode:"math",value:"\\mod"},max:{mode:"math",value:"\\max"},min:{mode:"math",value:"\\min"},erf:"\\operatorname{erf}",erfc:"\\operatorname{erfc}",bessel:{mode:"math",value:"\\operatorname{bessel}"},mean:{mode:"math",value:"\\operatorname{mean}"},median:{mode:"math",value:"\\operatorname{median}"},fft:{mode:"math",value:"\\operatorname{fft}"},lcm:{mode:"math",value:"\\operatorname{lcm}"},gcd:{mode:"math",value:"\\operatorname{gcd}"},randomReal:"\\operatorname{randomReal}",randomInteger:"\\operatorname{randomInteger}",Re:{mode:"math",value:"\\operatorname{Re}"},Im:{mode:"math",value:"\\operatorname{Im}"},mm:{mode:"math",after:"nothing+digit",value:"\\operatorname{mm}"},cm:{mode:"math",after:"nothing+digit",value:"\\operatorname{cm}"},km:{mode:"math",after:"nothing+digit",value:"\\operatorname{km}"},kg:{mode:"math",after:"nothing+digit",value:"\\operatorname{kg}"},"...":"\\ldots","+...":"+\\cdots","-...":"-\\cdots","->...":"\\to\\cdots","->":"\\to","|->":"\\mapsto","--\x3e":"\\longrightarrow","<--":"\\longleftarrow","=>":"\\Rightarrow","==>":"\\Longrightarrow","<=>":"\\Leftrightarrow","<->":"\\leftrightarrow","(.)":"\\odot","(+)":"\\oplus","(/)":"\\oslash","(*)":"\\otimes","(-)":"\\ominus","||":"\\Vert","{":"\\{","}":"\\}","*":"\\cdot"};function fe(t,e,i){if(!i)return i;if("string"==typeof i)return i;if("string"==typeof i.mode&&i.mode!==t)return null;if(!e)return i?i.value:void 0;let s=!1,a=!1,o=!1,n=!1,r=!1,l=!1,c=!1,h=!1,d=!1,p=!1,m=!1,u=!1,f=!1,g=!1,y=e[e.length-1],b=e.length-1;for(;y&&/msubsup|placeholder/.test(y.type);)b-=1,y=e[b];return s=!y||"first"===y.type,y&&(f="text"===y.mode,a=!f&&"mord"===y.type&&wt.LETTER.test(y.body),o=!f&&"mord"===y.type&&/[0-9]+$/.test(y.body),n=!f&&y.isFunction,r="genfrac"===y.type,l="surd"===y.type,c="mbin"===y.type,h="mrel"===y.type,d="mpunct"===y.type||"minner"===y.type,p=y.array,m="mopen"===y.type,u="mclose"===y.type||"leftright"===y.type,g="space"===y.type),void 0!==i.after?/nothing/.test(i.after)&&s||/letter/.test(i.after)&&a||/digit/.test(i.after)&&o||/function/.test(i.after)&&n||/frac/.test(i.after)&&r||/surd/.test(i.after)&&l||/binop/.test(i.after)&&c||/relop/.test(i.after)&&h||/punct/.test(i.after)&&d||/array/.test(i.after)&&p||/openfence/.test(i.after)&&m||/closefence/.test(i.after)&&u||/text/.test(i.after)&&f||/space/.test(i.after)&&g?i.value:null:i.value}function ge(t){let e="other";return navigator&&navigator.platform&&navigator.userAgent&&(/^(mac)/i.test(navigator.platform)?e="mac":/^(win)/i.test(navigator.platform)?e="win":/(android)/i.test(navigator.userAgent)?e="android":/(iphone)/i.test(navigator.userAgent)||/(ipod)/i.test(navigator.userAgent)||/(ipad)/i.test(navigator.userAgent)?e="ios":/\bCrOS\b/i.test(navigator.userAgent)&&(e="chromeos")),e===t?t:"!"+t}function ye(t){let e=t;return Array.isArray(e)&&e.length>0&&(e=e[0]+"("+e.slice(1).join("")+")"),e}function be(t,e){let i="";Array.isArray(t)||(t=[t]);for(const s of t){let t;const a=s.match(/(^[^:]*):/),o=a?a[1]:"";if(o===ge("mac")||o===ge("win")||o===ge("ios")||o===ge("android")||o===ge("chromeos")||o===ge("other")){const e=s.match(/:([^:]*)$/);t=e?e[1]:s}else if(!["mac","!mac","win","!win","ios","!ios","android","!android","chromeos","!chromeos","other","!other"].includes(o)){const e=s.match(/:([^:]*)$/);t=e?e[1]:s}if(t){const s="mac"===ge("mac")||"ios"===ge("ios"),a=t.length>1?t.split("-"):[t];let o="";for(const t of a)!s&&o.length>0&&(o+='+'),"Key"===t.substr(0,3)?o+=t.substr(3,1):"Digit"===t.substr(0,5)?o+=t.substr(5,1):o+={Meta:s?"⌘":"command",Shift:s?"⇧":"shift",Alt:s?"⌥":"alt",Ctrl:s?"⌃":"control","\n":s?"⏎":"return",Return:s?"⏎":"return",Enter:s?"⌤":"enter",Tab:s?"⇥":"tab",Esc:"esc",Backspace:s?"⌫":"backspace",Del:s?"⌦":"del",PageUp:s?"⇞":"page up",PageDown:s?"⇟":"page down",Home:s?"⤒":"home",End:s?"⤓":"end",Spacebar:"space",Semicolon:";",Period:".",Comma:",",Minus:"-",Equal:"=",Quote:"'",BracketLeft:"[",BracketRight:"]",Backslash:"\\",IntlBackslash:"\\",Backquote:"`",Slash:"/",NumpadMultiply:"* 🔢",NumpadDivide:"/ 🔢",NumpadSubtract:"- 🔢",NumpadAdd:"+ 🔢",NumpadDecimal:". 🔢",NumpadComma:", 🔢",Help:"help",Left:"⇠",Up:"⇡",Right:"⇢",Down:"⇣"}[t]||t;i.length>0&&(i+=e||" or "),i+=o}}return i}var xe={KEYBOARD_SHORTCUTS:pe,INLINE_SHORTCUTS:ue,stringify:be,startsWithString:function(t,e){const i=[];for(let s=0;s<=t.length-1;s++){const a=t.substring(s);e&&e.overrideDefaultInlineShortcuts||Object.keys(ue).forEach(t=>{t.startsWith(a)&&!i.includes(t)&&i.push(t)});const o=e&&e.inlineShortcuts?e.inlineShortcuts:null;o&&Object.keys(o).forEach(t=>{t.startsWith(a)&&i.push(t)})}return i},forString:function(t,e,i,s){let a="";s&&s.overrideDefaultInlineShortcuts||(a=fe(t,e,ue[i]));const o=s&&s.inlineShortcuts?s.inlineShortcuts:null;let n;return o&&(n=fe(t,e,o[i])),n||a},selectorForKeystroke:function(t,e){for(const i of[ge("mac")+":"+t+":"+e,ge("win")+":"+t+":"+e,ge("ios")+":"+t+":"+e,ge("android")+":"+t+":"+e,ge("chromeos")+":"+t+":"+e,ge("other")+":"+t+":"+e,ge("mac")+":"+e,ge("win")+":"+e,ge("ios")+":"+e,ge("android")+":"+e,ge("chromeos")+":"+e,t+":"+e,e])if(pe[i])return pe[i];return""},forCommand:function(t){let e=[];if("string"==typeof t){const i=me[t];Array.isArray(i)?e=i.slice():i&&e.push(i)}t=ye(t);const i=new RegExp("^"+t.replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");return Object.keys(pe).forEach(t=>{if(i.test(ye(pe[t]))){const i=t.match(/:([^:]*)$/);i&&e.push(i[1])}}),be(e)}};function ke(t,e){this.root=Yt.makeRoot(),this.path=[{relation:"body",offset:0}],this.extent=0,this.config=t?{...t}:{},this.target=e,this.suppressChangeNotifications=!1}function ve(t){const e=Object.assign(new ke(t.config,t.target),t);return e.path=de.clone(t.path),e}function we(t,e){let i=0;for(let s=0;s0;)i.col+=1,(!t[i.row]||i.col>=t[i.row].length)&&(i.col=0,i.row+=1),e-=1;return i}function Ae(t,e){let i;return"object"!=typeof e&&(e=Se(t,e)),Array.isArray(t[e.row])&&(i=t[e.row][e.col]||null),!i||0!==i.length&&"first"===i[0].type||i.unshift(Pe()),i}function Me(t){let e=0,i=0,s=1;for(const e of t)i+=1,e.length>s&&(s=e.length);return e=i*s,e}function Ce(t,e,i){if(!t)return[];e||(e=",");let s,a=[];for(let o of t)o&&o.length>0&&"first"===o[0].type&&(o=o.slice(1)),o&&o.length>0&&(s?a.push(s):s=new Yt.MathAtom("math","mpunct",e,i),a=a.concat(o));return a}function _e(t,e,i){const s={...e};if(s.row+=i,s.row<0){if(s.col+=i,s.row=t.length-1,s.col<0)return null;for(;s.row>=0&&!Ae(t,s);)s.row-=1;if(s.row<0)return null}else if(s.row>=t.length){for(s.col+=i,s.row=0;s.rowt.length-1)return null}return s}function Te(t){return!!t&&("mord"===t.type&&/[0-9.]/.test(t.body)||"mpunct"===t.type&&","===t.body)}function Le(t,e){if(!t)return!1;if(Array.isArray(t)){for(const i of t)if(Le(i,e))return!0}else{if(t===e)return!0;if(["body","numer","denom","index","subscript","superscript","underscript","overscript"].some((function(i){return i===e||Le(t[i],e)})))return!0;if(t.array)for(let i=Me(t.array);i>=0;i--)if(Le(Ae(t.array,i),e))return!0}return!1}function Fe(t){if(t)return 1===t.length&&"leftright"===t[0].type&&"("===t[0].leftDelim&&(t=t[0].body),t}function De(t,e){if(!t)return"";if(t.length<=1)return t;if(!e||"ASCIIMath"!==e.format){if(t.startsWith("$$")&&t.endsWith("$$"))return t.substring(2,t.length-2);if(t.startsWith("$")&&t.endsWith("$"))return t.substring(1,t.length-1);if(t=t.replace(/\\\\([^\s\n])/g,"\\$1"),/\\/.test(t))return t}return ze(t=(t=(t=(t=(t=(t=t.replace(/\u2061/gu,"")).replace(/\u3016/gu,"{")).replace(/\u3017/gu,"}")).replace(/([^\\])sinx/g,"$1\\sin x")).replace(/([^\\])cosx/g,"$1\\cos x ")).replace(/\u2013/g,"-"),e)}function ze(t,e){if(!t)return"";let i,s=!1;if(s||"^"!==t[0]&&"_"!==t[0]||(i=Ee(t.substr(1),{...e,noWrap:!0}),t=t[0]+"{"+i.match+"}",t+=ze(i.rest,e),s=!0),s||(i=t.match(/^(sqrt|\u221a)(.*)/),i&&(i=Ee(i[2],{...e,noWrap:!0}),t="\\sqrt{"+i.match+"}",t+=ze(i.rest,e),s=!0)),s||(i=t.match(/^(\\cbrt|\u221b)(.*)/),i&&(i=Ee(i[2],{...e,noWrap:!0}),t="\\sqrt[3]{"+i.match+"}",t+=ze(i.rest,e),s=!0)),s||(i=t.match(/^abs(.*)/),i&&(i=Ee(i[1],{...e,noWrap:!0}),t="\\left|"+i.match+"\\right|",t+=ze(i.rest,e),s=!0)),s||(i=t.match(/^["”“](.*?)["”“](.*)/),i&&(t="\\text{"+i[1]+"}",t+=ze(i[2],e),s=!0)),s||(i=t.match(/^([^a-zA-Z({[_^\\\s"]+)(.*)/),i&&(t=qe(i[1],e),t+=ze(i[2],e),s=!0)),!s&&/^(f|g|h)[^a-zA-Z]/.test(t)&&(i=Ee(t.substring(1),{...e,noWrap:!0}),t="("===t[1]?t[0]+"\\mleft("+i.match+"\\mright)":t[0]+i.match,t+=ze(i.rest,e),s=!0),s||(i=t.match(/^([a-zA-Z]+)(.*)/),i&&(t=qe(i[1],e),t+=ze(i[2],e),s=!0)),!s)if(i=Ee(t,{...e,noWrap:!0}),i.match&&"/"===i.rest[0]){const a=Ee(i.rest.substr(1),{...e,noWrap:!0});a.match&&(t="\\frac{"+i.match+"}{"+a.match+"}"+ze(a.rest,e)),s=!0}else i.match&&(t="("===t[0]?"\\left("+i.match+"\\right)"+ze(i.rest,e):i.match+ze(i.rest,e),s=!0);return s||(i=t.match(/^(\s+)(.*)$/),i&&(t=" "+ze(i[2],e),s=!0)),t}function Ee(t,e){let i="",s=t=t.trim(),a=t.charAt(0),o={"(":")","{":"}","[":"]"}[a];if(o){let n=1,r=1;for(;r0;)t[r]===a&&n++,t[r]===o&&n--,r++;0===n?(e.noWrap&&"("===a?i=ze(t.substring(1,r-1),e):("{"===a&&"}"===o&&(a="\\{",o="\\}"),i="\\left"+a+ze(t.substring(1,r-1),e)+"\\right"+o),s=t.substring(r)):(i=t.substring(1,r),s="")}else{let a=t.match(/^([a-zA-Z]+)/);if(a){let i=xe.forString("math",null,t,e);if(i)return i=i.replace("_{#?}",""),i=i.replace("^{#?}",""),{match:i,rest:t.substring(i.length)}}if(a=t.match(/^([a-zA-Z])/),a)return{match:a[1],rest:t.substring(1)};if(a=t.match(/^(-)?\d+(\.\d*)?/),a)return{match:a[0],rest:t.substring(a[0].length)};/^\\(left|right)/.test(t)||(a=t.match(/^(\\[a-zA-Z]+)/),a&&(s=t.substring(a[1].length),i=a[1]))}return{match:i,rest:s}}function qe(t,e){let i=xe.forString("math",null,t,e);return i?(i=i.replace("_{#?}",""),i=i.replace("^{#?}",""),i+=" "):i=t,i}function Pe(){return new Yt.MathAtom("","first")}ke.prototype._announce=function(t,e,i){"function"==typeof this.config.onAnnounce&&this.config.onAnnounce(this.target,t,e,i)},ke.prototype.filter=function(t,e){e=e<0?-1:1;const i=[],s=new ke;s.path=de.clone(this.path),s.extent=this.extent,s.root=this.root,e>=0?s.collapseForward():(s.collapseBackward(),s.move(1));const a=s.anchor();do{t.bind(s)(s.path,s.anchor())&&i.push(s.toString()),e>=0?s.next({iterateAll:!0}):s.previous({iterateAll:!0})}while(a!==s.anchor());return i},ke.prototype.forEach=function(t){this.root.forEach(t)},ke.prototype.forEachSelected=function(t,e){(e=e||{}).recursive=void 0!==e.recursive&&e.recursive;const i=this.siblings(),s=this.startOffset()+1,a=this.endOffset()+1;if(e.recursive)for(let e=s;e0?0:1)},ke.prototype.setRange=function(t,e,i){i=i||{};const s=de.pathDistance(t,e);if(0===s)return i.extendToWordBoundary?(t=this.wordBoundary(t,-1),e=this.wordBoundary(e,1),this.setRange(t,e)):this.setPath(de.clone(t),0);if(1===s){const s=e[e.length-1].offset-t[t.length-1].offset;return i.extendToWordBoundary?(t=this.wordBoundary(t,s<0?1:-1),e=this.wordBoundary(e,s<0?-1:1),this.setRange(t,e)):this.setPath(de.clone(t),s)}let a=de.pathCommonAncestor(t,e);const o=a.length;if(t.length===o||e.length===o||t[o].relation!==e[o].relation)return this.setPath(a,-1);a.push(t[o]),a=de.clone(a);let n=e[o].offset-t[o].offset+1;return n<=0?e.length>o+1?(a[o].relation=e[o].relation,a[o].offset=e[o].offset,a[a.length-1].offset-=1,n=2-n):(a[o].relation=e[o].relation,a[o].offset=e[o].offset,n=1-n):e.length<=t.length?a[a.length-1].offset-=1:e.length>t.length&&(a[o].offset-=1),this.setPath(a,n)},ke.prototype.ancestor=function(t){if(t>this.path.length)return null;let e=this.root;for(let i=0;i0?this.path[this.path.length-1].relation:""},ke.prototype.anchorOffset=function(){return this.path.length>0?this.path[this.path.length-1].offset:0},ke.prototype.focusOffset=function(){return this.path.length>0?this.path[this.path.length-1].offset+this.extent:0},ke.prototype.startOffset=function(){return Math.min(this.focusOffset(),this.anchorOffset())},ke.prototype.endOffset=function(){return Math.max(this.focusOffset(),this.anchorOffset())},ke.prototype.insertFirstAtom=function(){this.siblings()},ke.prototype.siblings=function(){if(0===this.path.length)return[];let t;return this.parent().array?t=Ae(this.parent().array,this.relation()):(t=this.parent()[this.relation()]||[],"string"==typeof t&&(t=[])),0!==t.length&&"first"===t[0].type||t.unshift(Pe()),t},ke.prototype.sibling=function(t){return this.siblings()[this.startOffset()+t]},ke.prototype.isCollapsed=function(){return 0===this.extent},ke.prototype.setExtent=function(t){this.extent=t},ke.prototype.collapseForward=function(){return 0!==this.extent&&(this.setSelection(this.endOffset()),!0)},ke.prototype.collapseBackward=function(){return 0!==this.extent&&(this.setSelection(this.startOffset()),!0)},ke.prototype.selectGroup_=function(){const t=this.siblings();if("text"===this.anchorMode()){let e=this.startOffset(),i=this.endOffset();for(;t[e]&&"text"===t[e].mode&&wt.LETTER_AND_DIGITS.test(t[e].body);)e-=1;for(;t[i]&&"text"===t[i].mode&&wt.LETTER_AND_DIGITS.test(t[i].body);)i+=1;if(i-=1,e>=i)return void this.setSelection(this.endOffset()-1,1);this.setSelection(e,i-e)}else if("mord"===this.sibling(0).type&&/[0-9,.]/.test(this.sibling(0).body)){let e=this.startOffset(),i=this.endOffset();for(;Te(t[e]);)e-=1;for(;Te(t[i]);)i+=1;i-=1,this.setSelection(e,i-e)}else this.setSelection(0,"end")},ke.prototype.selectAll_=function(){this.path=[{relation:"body",offset:0}],this.setSelection(0,"end")},ke.prototype.deleteAll_=function(){this.selectAll_(),this.delete_()},ke.prototype.contains=function(t){if(this.isCollapsed())return!1;const e=this.siblings(),i=this.startOffset(),s=this.endOffset();for(let a=i;a0&&"command"===t[e].type;)e-=1;let i=this.startOffset()+1;for(;i<=t.length-1&&"command"===t[i].type;)i+=1;return i>e?{start:e+1,end:i}:null},ke.prototype.extractCommandStringAroundInsertionPoint=function(t){let e="";const i=this.commandOffsets();if(i){const s=t?this.anchorOffset()+1:i.end,a=this.siblings();for(let t=i.start;t"placeholder"===t.type));this.setExtent(0),this.path[this.path.length-1].offset=e.start-1,0!==i.length&&this.leap(1,!1)||this.setSelection(e.start+t.length-1)}else this.siblings().splice(e.start,e.end-e.start),this.setSelection(e.start-1,0);this.contentDidChange()}},ke.prototype.removeCommandString=function(){this.contentWillChange();const t=this.suppressChangeNotifications;this.suppressChangeNotifications=!0,function t(e){if(e)if(Array.isArray(e))for(let i=e.length-1;i>=0;i--)"command"===e[i].type?e.splice(i,1):t(e[i]);else if(t(e.body),t(e.superscript),t(e.subscript),t(e.underscript),t(e.overscript),t(e.numer),t(e.denom),t(e.index),e.array)for(let i=Me(e.array);i>=0;i--)t(Ae(e.array,i))}(this.root.body),this.suppressChangeNotifications=t,this.contentDidChange()},ke.prototype.extractArgBeforeInsertionPoint=function(){const t=this.siblings();if(t.length<=1)return[];const e=[];let i=this.startOffset();if("text"===t[i].mode)for(;i>=1&&"text"===t[i].mode;)e.unshift(t[i]),i--;else for(;i>=1&&/^(mord|surd|msubsup|leftright|mop)$/.test(t[i].type);)e.unshift(t[i]),i--;return e},ke.prototype.setSelection=function(t,e,i){t=t||0,e=e||0;const s=this.path[this.path.length-1].relation;i||(i=s);const a=this.parent();if(!a&&"body"!==i)return!1;const o=i.startsWith("cell");if(!o&&!a[i]||o&&!a.array)return!1;const n=i!==s;this.path[this.path.length-1].relation=i;const r=this.siblings().length;this.path[this.path.length-1].relation=s;const l=this.extent;"end"===e?e=r-t-1:"start"===e&&(e=-t),this.setExtent(e);const c=this.extent!==l;this.setExtent(l),t<0&&(t=r+t),t=Math.max(0,Math.min(t,r-1));const h=this.path[this.path.length-1].offset;return(n||h!==t||c)&&(n&&this.adjustPlaceholder(),this.selectionWillChange(),this.path[this.path.length-1].relation=i,this.path[this.path.length-1].offset=t,this.setExtent(e),this.selectionDidChange()),!0},ke.prototype.next=function(t){t=t||{};const e={body:"numer",numer:"denom",denom:"index",index:"overscript",overscript:"underscript",underscript:"subscript",subscript:"superscript"};if(this.anchorOffset()===this.siblings().length-1){this.adjustPlaceholder();let i=e[this.relation()];const s=this.parent();for(;i&&!s[i];)i=e[i];if(i)return void this.setSelection(0,0,i);if(this.parent().array){const t=Me(this.parent().array);let e=parseInt(this.relation().match(/cell([0-9]*)$/)[1])+1;for(;e=0;){if(Ae(this.parent().array,t)&&this.setSelection(-1,0,"cell"+t))return void this.selectionDidChange();t-=1}}return 1===this.path.length?(this.suppressChangeNotifications||!this.config.onMoveOutOf||this.config.onMoveOutOf.bind(this)(-1))&&(this.path[0].offset=this.root.body.length-1):(this.path.pop(),this.setSelection(this.anchorOffset()-1)),void this.selectionDidChange()}const i=this.anchor();if(!i.captureSelection){let t;if(i.array){t="";const e=Me(i.array);let s=e-1;for(;!t&&s0)for(this.collapseForward()&&t--;t>0;)this.next(),t--;else if(t<0)for(this.collapseBackward()&&t++;0!==t;)this.previous(),t++;this._announce("move",e)}},ke.prototype.up=function(t){const e=(t=t||{extend:!1}).extend||!1;this.collapseBackward();const i=this.relation();if("denom"===i)e?(this.selectionWillChange(),this.path.pop(),this.path[this.path.length-1].offset-=1,this.setExtent(1),this.selectionDidChange()):this.setSelection(this.anchorOffset(),0,"numer"),this._announce("moveUp");else if(this.parent().array){let e=Se(this.parent().array,i);e=_e(this.parent().array,e,-1),e&&Ae(e)?(this.path[this.path.length-1].relation="cell"+we(this.parent().array,e),this.setSelection(this.anchorOffset()),this._announce("moveUp")):this.move(-1,t)}else this._announce("line")},ke.prototype.down=function(t){const e=(t=t||{extend:!1}).extend||!1;this.collapseForward();const i=this.relation();if("numer"===i)e?(this.selectionWillChange(),this.path.pop(),this.path[this.path.length-1].offset-=1,this.setExtent(1),this.selectionDidChange()):this.setSelection(this.anchorOffset(),0,"denom"),this._announce("moveDown");else if(this.parent().array){let e=Se(this.parent().array,i);e=_e(this.parent().array,e,1),e&&Ae(e)?(this.path[this.path.length-1].relation="cell"+we(this.parent().array,e),this.setSelection(this.anchorOffset()),this._announce("moveDown")):this.move(1,t)}else this._announce("line")},ke.prototype.extend=function(t){let e=this.path[this.path.length-1].offset,i=0;const s=ve(this);i=this.extent+t;const a=e+i;if(a<0&&0!==i){if(this.path.length>1)return this.selectionWillChange(),this.path.pop(),this.setExtent(-1),this.selectionDidChange(),void this._announce("move",s);e=this.path[this.path.length-1].offset,i=this.extent}else if(a>=this.siblings().length){if(this.path.length>1)return this.selectionWillChange(),this.path.pop(),this.path[this.path.length-1].offset-=1,this.setExtent(1),this.selectionDidChange(),void this._announce("move",s);this.isCollapsed()&&(e-=1),i-=1}this.setSelection(e,i),this._announce("move",s)},ke.prototype.skip=function(t,e){const i=(e=e||{extend:!1}).extend||!1;t=t<0?-1:1;const s=ve(this),a=this.siblings(),o=this.focusOffset();let n=o+t;if(i&&(n=Math.min(Math.max(0,n),a.length-1)),n<0||n>=a.length)this.move(t,e);else{if(a[n]&&"text"===a[n].mode){if(n=this.wordBoundaryOffset(n,t),n<0&&!i)return void this.setSelection(0);if(n>a.length)return this.setSelection(a.length-1),void this.move(t,e)}else{const e=a[n]?a[n].type:"";if("mopen"===e&&t>0||"mclose"===e&&t<0){let i="mopen"===e?1:-1;for(n+=t>0?1:-1;n>=0&&n0&&(n-=1)}else{for(;a[n]&&"math"===a[n].mode&&a[n].type===e;)n+=t;n-=t>0?1:0}}if(i){const t=this.anchorOffset();this.setSelection(t,n-t)}else this.setSelection(n);this._announce("move",s)}},ke.prototype.jump=function(t,e){const i=(e=e||{extend:!1}).extend||!1;t=t<0?-1:1;const s=this.siblings();let a=this.focusOffset();t>0&&(a=Math.min(a+1,s.length-1));const o=t<0?0:s.length-1;i?this.extend(o-a):this.move(o-a)},ke.prototype.jumpToMathFieldBoundary=function(t,e){const i=(e=e||{extend:!1}).extend||!1;t=(t=t||1)<0?-1:1;const s=ve(this),a=[{relation:"body",offset:this.path[0].offset}];let o;i?t<0?a[0].offset>0&&(o=-a[0].offset):a[0].offset"placeholder"===e.type||t.length>1&&1===this.siblings().length,t);if(0===o.length){if(this.setPath(s,a),e)if(this.config.onTabOutOf)this.config.onTabOutOf(this.target,t>0?"forward":"backward");else if(document.activeElement){const e='a[href]:not([disabled]),\n button:not([disabled]),\n textarea:not([disabled]),\n input[type=text]:not([disabled]),\n select:not([disabled]),\n [contentEditable="true"],\n [tabindex]:not([disabled]):not([tabindex="-1"])',i=Array.prototype.filter.call(document.querySelectorAll(e),t=>(t.offsetWidth>0||t.offsetHeight>0)&&!t.contains(document.activeElement)||t===document.activeElement);let s=i.indexOf(document.activeElement)+t;s<0&&(s=i.length-1),s>=i.length&&(s=0),i[s].focus()}return this.suppressChangeNotifications=i,!1}return this.selectionWillChange(),this.setPath(o[0]),"placeholder"===this.anchor().type&&this.setExtent(-1),this._announce("move",s),this.selectionDidChange(),this.suppressChangeNotifications=i,!0},ke.prototype.anchorMode=function(){const t=this.isCollapsed()?this.anchor():this.sibling(1);let e;if(t){if("commandliteral"===t.type||"command"===t.type)return"command";e=t.mode}let i=1,s=this.ancestor(i);for(;!e&&s;)s&&(e=s.mode),i+=1,s=this.ancestor(i);return e},ke.prototype.anchorStyle=function(){const t=this.isCollapsed()?this.anchor():this.sibling(1);let e;if(t&&"first"!==t.type){if("commandliteral"===t.type||"command"===t.type)return{};e={color:t.color,backgroundColor:t.backgroundColor,fontFamily:t.fontFamily,fontShape:t.fontShape,fontSeries:t.fontSeries,fontSize:t.fontSize}}let i=1,s=this.ancestor(i);for(;!e&&s;)s&&(e={color:s.color,backgroundColor:s.backgroundColor,fontFamily:s.fontFamily,fontShape:s.fontShape,fontSeries:s.fontSeries,fontSize:s.fontSize}),i+=1,s=this.ancestor(i);return e},ke.prototype.simplifyParen=function(t){if(t&&this.config.removeExtraneousParentheses){for(let e=0;t[e];e++)if("leftright"===t[e].type&&"("===t[e].leftDelim&&Array.isArray(t[e].body)){let i=0,s=0,a=0;for(let o=0;t[e].body[o];o++)"genfrac"===t[e].body[o].type&&(i++,s=o),"first"!==t[e].body[o].type&&a++;0===a&&1===i&&(t[e]=t[e].body[s])}t.forEach(t=>{if("genfrac"===t.type&&(this.simplifyParen(t.numer),this.simplifyParen(t.denom),t.numer=Fe(t.numer),t.denom=Fe(t.denom)),t.superscript&&(this.simplifyParen(t.superscript),t.superscript=Fe(t.superscript)),t.subscript&&(this.simplifyParen(t.subscript),t.subscript=Fe(t.subscript)),t.underscript&&(this.simplifyParen(t.underscript),t.underscript=Fe(t.underscript)),t.overscript&&(this.simplifyParen(t.overscript),t.overscript=Fe(t.overscript)),t.index&&(this.simplifyParen(t.index),t.index=Fe(t.index)),"surd"===t.type?(this.simplifyParen(t.body),t.body=Fe(t.body)):t.body&&Array.isArray(t.body)&&this.simplifyParen(t.body),t.array)for(let e=Me(t.array);e>=0;e--)this.simplifyParen(Ae(t.array,e))})}},ke.prototype.insert=function(t,e){if((e=e||{}).smartFence&&this._insertSmartFence(t,e.style))return;const i=this.suppressChangeNotifications;e.suppressChangeNotifications&&(this.suppressChangeNotifications=!0),this.contentWillChange();const s=this.suppressChangeNotifications;this.suppressChangeNotifications=!0,e.insertionMode||(e.insertionMode="replaceSelection"),e.selectionMode||(e.selectionMode="placeholder"),e.format||(e.format="auto"),e.macros=e.macros||this.config.macros;const a=e.mode||this.anchorMode();let o;const r=[this.getSelectedAtoms()];void 0!==e.placeholder&&(r["?"]=e.placeholder),"replaceSelection"!==e.insertionMode||this.isCollapsed()?"replaceAll"===e.insertionMode?(this.root.body.splice(1),this.path=[{relation:"body",offset:0}],this.extent=0):"insertBefore"===e.insertionMode?this.collapseBackward():"insertAfter"===e.insertionMode&&this.collapseForward():this.delete_();const l=this.siblings(),c=this.startOffset();if(c+10&&l[c]&&"placeholder"===l[c].type&&this.delete_(-1),"math"===a&&"ASCIIMath"===e.format)t=De(t,{...this.config,format:"ASCIIMath"}),o=le.parseTokens(n(t),"math",null,e.macros,!1),this.simplifyParen(o);else if("text"!==a&&"auto"===e.format)if("command"===a){o=[];for(const e of t)wt.COMMAND_MODE_CHARACTERS.test(e)&&o.push(new Yt.MathAtom("command","command",e))}else""===t?o=[new Yt.MathAtom("command","command","\\")]:(t=De(t,this.config),r[0]?t=t.replace(/(^|[^\\])#@/g,"$1#0"):/(^|[^\\])#@/.test(t)?(t=t.replace(/(^|[^\\])#@/g,"$1#0"),r[0]=this.extractArgBeforeInsertionPoint(),this._deleteAtoms(-r[0].length),Array.isArray(r[0])&&0===r[0].length&&(r[0]=void 0)):t=t.replace(/(^|[^\\])#@/g,"$1#?"),o=le.parseTokens(n(t),a,r,e.macros,e.smartFence),this.simplifyParen(o));else"latex"===e.format?o=le.parseTokens(n(t),a,r,e.macros,e.smartFence):"text"!==a&&"text"!==e.format||(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"\\textbackslash ")).replace(/#/g,"\\#")).replace(/\$/g,"\\$")).replace(/%/g,"\\%")).replace(/&/g,"\\&")).replace(/_/g,"\\_")).replace(/{/g,"\\textbraceleft ")).replace(/}/g,"\\textbraceright ")).replace(/\^/g,"\\textasciicircum ")).replace(/~/g,"\\textasciitilde ")).replace(/£/g,"\\textsterling "),o=le.parseTokens(n(t),"text",r,e.macros,!1));!function t(e,i){e&&i&&(Array.isArray(e)?e.forEach(e=>t(e,i)):"object"==typeof e&&(e.color||e.backgroundColor||e.fontFamily||e.fontShape||e.fontSeries||e.fontSize||(e.applyStyle(i),t(e.body,i),t(e.numer,i),t(e.denom,i),t(e.index,i),t(e.overscript,i),t(e.underscript,i),t(e.subscript,i),t(e.superscript,i))))}(o,e.style);const h=this.parent();if(this.config.removeExtraneousParentheses&&h&&"leftright"===h.type&&"("===h.leftDelim&&function(t){return 0===t.length||1===t.length&&"first"===t[0].type}(h.body)&&o&&1===o.length&&"genfrac"===o[0].type?(this.path.pop(),this.siblings()[this.anchorOffset()]=o[0]):Array.prototype.splice.apply(this.siblings(),[this.anchorOffset()+1,0].concat(o)),this.insertFirstAtom(),this.suppressChangeNotifications=s,"placeholder"===e.selectionMode){let t=[];for(const e of o)t=t.concat(e.filter(t=>"placeholder"===t.type));0!==t.length&&this.leap(1,!1)?this._announce("move"):this.setSelection(this.anchorOffset()+o.length)}else"before"===e.selectionMode||("after"===e.selectionMode?this.setSelection(this.anchorOffset()+o.length):"item"===e.selectionMode&&this.setSelection(this.anchorOffset(),o.length));this.contentDidChange(),this.suppressChangeNotifications=i},ke.prototype._insertSmartFence=function(t,e){const i=this.parent();if("leftright"===i.type&&"|"!==i.leftDelim&&/\||\\vert|\\Vert|\\mvert|\\mid/.test(t))return this.insert("\\,\\middle"+t+"\\, ",{mode:"math",format:"latex",style:e}),!0;"{"!==t&&"\\{"!==t||(t="\\lbrace"),"}"!==t&&"\\}"!==t||(t="\\rbrace"),"["!==t&&"\\["!==t||(t="\\lbrack"),"]"!==t&&"\\]"!==t||(t="\\rbrack");const s=wt.RIGHT_DELIM[t];if(s&&("leftright"!==i.type||"|"!==i.leftDelim)){let i="";const a=this.isCollapsed()||"placeholder"===this.anchor().type;i=this.sibling(0).isFunction?"\\mleft"+t+"\\mright":"\\left"+t+"\\right",i+=a?"?":s;let o=[];return a&&(o=this.siblings().splice(this.anchorOffset()+1,this.siblings().length)),this.insert(i,{mode:"math",format:"latex",style:e}),a&&(this.sibling(0).body=o,this.move(-1)),!0}let a;if(Object.keys(wt.RIGHT_DELIM).forEach(e=>{t===wt.RIGHT_DELIM[e]&&(a=e)}),a){if(i&&"leftright"===i.type&&this.endOffset()===this.siblings().length-1)return this.contentWillChange(),i.rightDelim=t,this.move(1),this.contentDidChange(),!0;const s=this.siblings();let a;for(a=this.endOffset();a>=0&&("leftright"!==s[a].type||"?"!==s[a].rightDelim);a--);if(a>=0)return this.contentWillChange(),s[a].rightDelim=t,s[a].body=s[a].body.concat(s.slice(a+1,this.endOffset()+1)),s.splice(a+1,this.endOffset()-a),this.setSelection(a),this.contentDidChange(),!0;if(i&&"leftright"===i.type&&"?"===i.rightDelim){this.contentWillChange(),i.rightDelim=t;const e=s.slice(this.endOffset()+1);return s.splice(this.endOffset()+1),this.path.pop(),Array.prototype.splice.apply(this.siblings(),[this.endOffset()+1,0].concat(e)),this.contentDidChange(),!0}const o=this.ancestor(2);return o&&"leftright"===o.type&&"?"===o.rightDelim&&this.endOffset()===s.length-1?(this.move(1),this._insertSmartFence(t,e)):(this.insert(t,{mode:"math",format:"latex",style:e}),!0)}return!1},ke.prototype.positionInsertionPointAfterCommitedCommand=function(){const t=this.siblings(),e=this.commandOffsets();let i=e.start;for(;i=0;e--)t[e].suggestion&&t.splice(e,1)},ke.prototype.insertSuggestion=function(t,e){this.removeSuggestion();const i=[],s=t.substr(e);for(const t of s){const e=new Yt.MathAtom("command","command",t);e.suggestion=!0,i.push(e)}Array.prototype.splice.apply(this.siblings(),[this.anchorOffset()+1,0].concat(i))},ke.prototype._deleteAtoms=function(t){t>0?this.siblings().splice(this.anchorOffset()+1,t):(this.siblings().splice(this.anchorOffset()+t+1,-t),this.setSelection(this.anchorOffset()+t))},ke.prototype.delete=function(t){if(0===(t=t||0))this.delete_(0);else if(t>0)for(;t>0;)this.delete_(1),t--;else for(;t<0;)this.delete_(-1),t++},ke.prototype.delete_=function(t){this.contentWillChange(),this.selectionWillChange();const e=this.suppressChangeNotifications;if(this.suppressChangeNotifications=!0,t=(t=t||0)<0?-1:t>0?1:t,this.removeSuggestion(),this.parent().array&&t<0&&0===this.startOffset()){const t=this.parent().array;if(function(t){const e={col:0,row:0};for(;e.row0){let t=e.length;"first"===e[0].type&&(t-=1),t>0&&(i+=1)}s.row+=1}return i}(t,e.col)){!function(t,e){let i=0;for(;i"placeholder"!==t.type&&"first"!==t.type);this.parent()[t]=null,this.path.pop(),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),0].concat(e)),this.setSelection(this.anchorOffset()-1),this._announce("deleted: "+t)}else if("denom"===t){const t=this.parent().numer.filter(t=>"placeholder"!==t.type&&"first"!==t.type),e=this.parent().denom.filter(t=>"placeholder"!==t.type&&"first"!==t.type);this.path.pop(),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),1].concat(e)),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),0].concat(t)),this.setSelection(this.anchorOffset()+t.length-1),this._announce("deleted: denominator")}else if("body"===t){const t=this.siblings().filter(t=>"placeholder"!==t.type);this.path.length>1&&(t.shift(),this.path.pop(),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),1].concat(t)),this.setSelection(this.anchorOffset()-1),this._announce("deleted: root"))}else this.move(-1),this.delete(-1)}else if(t>0)if(e!==i.length-1)/^(group|array|genfrac|surd|leftright|overlap|overunder|box|mathstyle|sizing)$/.test(this.sibling(1).type)?this.move(1):(this._announce("delete",null,i.slice(e+1,e+2)),i.splice(e+1,1));else if("numer"===this.relation()){const t=this.parent().numer.filter(t=>"placeholder"!==t.type&&"first"!==t.type),e=this.parent().denom.filter(t=>"placeholder"!==t.type&&"first"!==t.type);this.path.pop(),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),1].concat(e)),Array.prototype.splice.apply(this.siblings(),[this.anchorOffset(),0].concat(t)),this.setSelection(this.anchorOffset()+t.length-1),this._announce("deleted: numerator")}else this.move(1),this.delete(-1)}else{const t=this.startOffset()+1,e=this.endOffset()+1;this._announce("deleted",null,i.slice(t,e)),i.splice(t,e-t),this.setSelection(t-1)}this.suppressChangeNotifications=e,this.selectionDidChange(),this.contentDidChange()},ke.prototype.moveToNextPlaceholder_=function(){this.leap(1)},ke.prototype.moveToPreviousPlaceholder_=function(){this.leap(-1)},ke.prototype.moveToNextChar_=function(){this.move(1)},ke.prototype.moveToPreviousChar_=function(){this.move(-1)},ke.prototype.moveUp_=function(){this.up()},ke.prototype.moveDown_=function(){this.down()},ke.prototype.moveToNextWord_=function(){this.skip(1)},ke.prototype.moveToPreviousWord_=function(){this.skip(-1)},ke.prototype.moveToGroupStart_=function(){this.setSelection(0)},ke.prototype.moveToGroupEnd_=function(){this.setSelection(-1)},ke.prototype.moveToMathFieldStart_=function(){this.jumpToMathFieldBoundary(-1)},ke.prototype.moveToMathFieldEnd_=function(){this.jumpToMathFieldBoundary(1)},ke.prototype.deleteNextChar_=function(){this.delete_(1)},ke.prototype.deletePreviousChar_=function(){this.delete_(-1)},ke.prototype.deleteNextWord_=function(){this.extendToNextBoundary(),this.delete_()},ke.prototype.deletePreviousWord_=function(){this.extendToPreviousBoundary(),this.delete_()},ke.prototype.deleteToGroupStart_=function(){this.extendToGroupStart(),this.delete_()},ke.prototype.deleteToGroupEnd_=function(){this.extendToMathFieldStart(),this.delete_()},ke.prototype.deleteToMathFieldEnd_=function(){this.extendToMathFieldEnd(),this.delete_()},ke.prototype.transpose_=function(){},ke.prototype.extendToNextChar_=function(){this.extend(1)},ke.prototype.extendToPreviousChar_=function(){this.extend(-1)},ke.prototype.extendToNextWord_=function(){this.skip(1,{extend:!0})},ke.prototype.extendToPreviousWord_=function(){this.skip(-1,{extend:!0})},ke.prototype.extendUp_=function(){this.up({extend:!0})},ke.prototype.extendDown_=function(){this.down({extend:!0})},ke.prototype.extendToNextBoundary_=function(){this.skip(1,{extend:!0})},ke.prototype.extendToPreviousBoundary_=function(){this.skip(-1,{extend:!0})},ke.prototype.extendToGroupStart_=function(){this.setExtent(-this.anchorOffset())},ke.prototype.extendToGroupEnd_=function(){this.setExtent(this.siblings().length-this.anchorOffset())},ke.prototype.extendToMathFieldStart_=function(){this.jumpToMathFieldBoundary(-1,{extend:!0})},ke.prototype.extendToMathFieldEnd_=function(){this.jumpToMathFieldBoundary(1,{extend:!0})},ke.prototype.moveToSuperscript_=function(){if(this.collapseForward(),!this.anchor().superscript)if(this.anchor().subscript)this.anchor().superscript=[Pe()];else{const t=this.sibling(1);t&&t.superscript?this.path[this.path.length-1].offset+=1:t&&t.subscript?(this.path[this.path.length-1].offset+=1,this.anchor().superscript=[Pe()]):("limits"!==this.anchor().limits&&(this.siblings().splice(this.anchorOffset()+1,0,new Yt.MathAtom(this.parent().anchorMode,"msubsup","​",this.anchorStyle())),this.path[this.path.length-1].offset+=1),this.anchor().superscript=[Pe()])}this.path.push({relation:"superscript",offset:0}),this.selectGroup_()},ke.prototype.moveToSubscript_=function(){if(this.collapseForward(),!this.anchor().subscript)if(this.anchor().superscript)this.anchor().subscript=[Pe()];else{const t=this.sibling(1);t&&t.subscript?this.path[this.path.length-1].offset+=1:t&&t.superscript?(this.path[this.path.length-1].offset+=1,this.anchor().subscript=[Pe()]):("limits"!==this.anchor().limits&&(this.siblings().splice(this.anchorOffset()+1,0,new Yt.MathAtom(this.parent().anchorMode,"msubsup","​",this.anchorStyle())),this.path[this.path.length-1].offset+=1),this.anchor().subscript=[Pe()])}this.path.push({relation:"subscript",offset:0}),this.selectGroup_()},ke.prototype.moveToOpposite_=function(){const t={superscript:"subscript",subscript:"superscript",denom:"numer",numer:"denom"}[this.relation()];t||this.moveToSuperscript_(),this.parent()[t]||(this.parent()[t]=[Pe()]),this.setSelection(0,"end",t)},ke.prototype.moveBeforeParent_=function(){this.path.length>1?(this.path.pop(),this.setSelection(this.anchorOffset()-1)):this._announce("plonk")},ke.prototype.moveAfterParent_=function(){if(this.path.length>1){const t=ve(this);this.path.pop(),this.setExtent(0),this._announce("move",t)}else this._announce("plonk")},ke.prototype._addCell=function(t){const e=this.parent();if(e&&"array"===e.type&&Array.isArray(e.array)){const i=this.relation();if(e.array){const s=Se(e.array,i);"after row"===t||"before row"===t?(s.col=0,s.row=s.row+("after row"===t?1:0),e.array.splice(s.row,0,[[]])):(s.col+="after column"===t?1:0,e.array[s.row].splice(s.col,0,[]));const a=we(e.array,s);this.path.pop(),this.path.push({relation:"cell"+a.toString(),offset:0}),this.insertFirstAtom()}}},ke.prototype.convertParentToArray=function(){const t=this.parent();if("leftright"===t.type){t.type="array";const e={"(":"pmatrix","\\lbrack":"bmatrix","\\lbrace":"cases"}[t.leftDelim]||"matrix",i=wt.getEnvironmentInfo(e),s=[[t.body]];i.parser&&Object.assign(t,i.parser(e,[],s)),t.tabularMode=i.tabular,t.parseMode=this.anchorMode(),t.env={...i},t.env.name=e,t.array=s,t.rowGaps=[0],delete t.body,this.path[this.path.length-1].relation="cell0"}},ke.prototype.addRowAfter_=function(){this.contentWillChange(),this.convertParentToArray(),this._addCell("after row"),this.contentDidChange()},ke.prototype.addRowBefore_=function(){this.contentWillChange(),this.convertParentToArray(),this._addCell("before row"),this.contentDidChange()},ke.prototype.addColumnAfter_=function(){this.contentWillChange(),this.convertParentToArray(),this._addCell("after column"),this.contentDidChange()},ke.prototype.addColumnBefore_=function(){this.contentWillChange(),this.convertParentToArray(),this._addCell("before column"),this.contentDidChange()},ke.prototype._applyStyle=function(t){if(this.isCollapsed())return;const e=this;function i(t,i){let s=!0;return e.forEachSelected(e=>{s=s&&e[t]===i},{recursive:!0}),s}t.color&&i("color",t.color)&&(t.color="none"),t.backgroundColor&&i("backgroundColor",t.backgroundColor)&&(t.backgroundColor="none"),t.fontFamily&&i("fontFamily",t.fontFamily)&&(t.fontFamily="none"),t.series&&(t.fontSeries=t.series),t.fontSeries&&i("fontSeries",t.fontSeries)&&(t.fontSeries="auto"),t.shape&&(t.fontShape=t.shape),t.fontShape&&i("fontShape",t.fontShape)&&(t.fontShape="auto"),t.size&&(t.fontSize=t.size),t.fontSize&&i("fontSize",t.fontSize)&&(t.fontSize="size5"),this.contentWillChange(),this.forEachSelected(e=>e.applyStyle(t),{recursive:!0}),this.contentDidChange()};var Ie={EditableMathlist:ke,parseMathString:De};const Be={"#":"#","|":"|","[":"BracketLeft","]":"BracketRight","-":"Minus","+":"Plus","=":"Equal","/":"Slash","\\":"Backslash"},Oe={Space:"Spacebar"," ":"Spacebar",Escape:"Esc",ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",Delete:"Del"},Re={q:"KeyQ",w:"KeyW",e:"KeyE",r:"KeyR",t:"KeyT",y:"KeyY",u:"KeyU",i:"KeyI",o:"KeyO",p:"KeyP",a:"KeyA",s:"KeyS",d:"KeyD",f:"KeyF",g:"KeyG",h:"KeyH",j:"KeyJ",k:"KeyK",l:"KeyL",z:"KeyZ",x:"KeyX",c:"KeyC",v:"KeyV",b:"KeyB",n:"KeyN",m:"KeyM",1:"Digit1",2:"Digit2",3:"Digit3",4:"Digit4",5:"Digit5",6:"Digit6",7:"Digit7",8:"Digit8",9:"Digit9",0:"Digit0","!":"Shift-Digit1","@":"Shift-Digit2","#":"Shift-Digit3",$:"Shift-Digit4","%":"Shift-Digit5","^":"Shift-Digit6","&":"Shift-Digit7","*":"Shift-Digit8","(":"Shift-Digit9",")":"Shift-Digit0","-":"Minus",_:"Shift-Minus","/":"Slash","\\":"Backslash","|":"Shift-Backslash","?":"Shift-Slash"," ":"Spacebar"};function Ke(t){let e,i=!0;"Unidentified"===t.key&&t.target&&(e=Re[t.target.value]||t.target.value),e||(Be[t.key]?(e=Be[t.key],i=!1):e=Oe[t.key],e||(e=Re[t.key.toLowerCase()])),!e&&t.code&&(e=Oe[t.code]||t.code);const s=[];return t.ctrlKey&&s.push("Ctrl"),t.metaKey&&s.push("Meta"),i&&t.altKey&&s.push("Alt"),i&&t.shiftKey&&s.push("Shift"),0===s.length?e:(s.push(e),s.join("-"))}function Ne(t,e){let i,s=null,a=null,o=!1,n=!1;function r(t){clearTimeout(i),i=setTimeout((function(){clearTimeout(i),t()}))}function l(){if(function(t){return t.selectionStart!==t.selectionEnd}(t))return;const i=t.value;t.value="",i.length>0&&e.typedText(i)}const c=t||e.container;c.addEventListener("keydown",(function(i){if("function"==typeof e.allowDeadKey&&e.allowDeadKey()||"Dead"!==i.key&&"Unidentified"!==i.key&&229!==i.keyCode)n=!1;else{n=!0,o=!1;const i=e.blur,s=e.focus;e.blur=null,e.focus=null,t.blur(),t.focus(),e.blur=i,e.focus=s}return!(!o&&"CapsLock"!==i.code&&!/(Control|Meta|Alt|Shift)(Right|Left)/.test(i.code))||(s=i,a=null,e.keystroke(Ke(i),i))}),!0),c.addEventListener("keypress",(function(t){o||(s&&a&&e.keystroke(Ke(s),s),a=t,r(l))}),!0),c.addEventListener("keyup",(function(){o||!s||a||l()}),!0),c.addEventListener("paste",(function(){t.focus();const i=t.value;t.value="",i.length>0&&e.paste(i)}),!0),c.addEventListener("copy",(function(t){e.copy&&e.copy(t)}),!0),c.addEventListener("cut",(function(t){e.cut&&e.cut(t)}),!0),c.addEventListener("blur",(function(){s=null,a=null,e.blur&&e.blur()}),!0),c.addEventListener("focus",(function(){e.focus&&e.focus()}),!0),c.addEventListener("compositionstart",()=>{o=!0},!0),c.addEventListener("compositionend",()=>{o=!1,r(l)},!0),c.addEventListener("input",()=>{if(n){const i=e.blur,s=e.focus;e.blur=null,e.focus=null,t.blur(),t.focus(),e.blur=i,e.focus=s,n=!1,o=!1,r(l)}else o||r(l)})}var $e={delegateKeyboardEvents:Ne,select:Ne.select,keyboardEventToString:Ke,eventToChar:function(t){if(!t)return"";let e;return"Unidentified"===t.key&&t.target&&(e=t.target.value),e=e||t.key||t.code,/^(Return|Enter|Tab|Escape|Delete|PageUp|PageDown|Home|End|Help|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)$/.test(e)&&(e=""),e},charToEvent:function(t){return{key:t,metaKey:!1,ctrlKey:!1,altKey:!1,shiftKey:!1}}};const We={"\\mathrm":"\\mathrm{x=+3.14, x\\in A}","\\mathbf":"\\mathbf{x=+3.14, x\\in A}","\\bf":"\\bf{x=+3.14, x\\in A}","\\bm":"\\bm{x=+3.14, x\\in A}","\\bold":"\\bold{x=+3.14, x\\in A}","\\mathit":"\\mathbb{x=+3.14}","\\mathbb":"\\mathbb{ABCD}","\\Bbb":"\\mathbb{ABCD}","\\frak":"\\frak{ABCD}","\\mathfrak":"\\mathfrak{ABCD}","\\mathscr":"\\mathscr{ABCD}","\\mathsf":"\\mathsf{ABab01}","\\mathtt":"\\mathtt{x=+3.14, x\\in A}","\\mathcal":"\\mathcal{ABCD}","\\boldsymbol":"\\boldsymbol{ABab01+=}","\\text":"\\text{ABC abc}","\\textrm":"\\textrm{ABC abc}","\\textnormal":"\\textnormal{ABC abc}","\\textit":"\\textit{ABC abc}","\\textbf":"\\textbf{ABC abc}","\\texttt":"\\texttt{ABC abc}","\\textsf":"\\textsf{ABC abc}","\\textcolor":"{\\textcolor{m0}A}{\\textcolor{m1}B}{\\textcolor{m2}C }{\\textcolor{m3}a}{\\textcolor{m4}b}{\\textcolor{m5}c}{\\textcolor{m6}8}","\\color":"{\\color{m0}A}{\\color{m1}B}{\\color{m2}C}{\\color{m3}a}{\\color{m4}b}{\\color{m5}c}{\\color{m6}8}","\\underline":'\\underline{\\unicode{"2B1A}}',"\\overline":'\\overline{\\unicode{"2B1A}}',"\\vec":'\\vec{\\unicode{"25CC}}',"\\check":'\\check{\\unicode{"25CC}}',"\\acute":'\\acute{\\unicode{"25CC}}',"\\breve":'\\breve{\\unicode{"25CC}}',"\\tilde":'\\tilde{\\unicode{"25CC}}',"\\hat":'\\hat{\\unicode{"25CC}}',"\\ddot":'\\ddot{\\unicode{"25CC}}',"\\dot":'\\dot{\\unicode{"25CC}}',"\\bar":'\\bar{\\unicode{"25CC}}',"\\!":'\\unicode{"203A}\\!\\unicode{"2039}',"\\,":'\\unicode{"203A}\\,\\unicode{"2039}',"\\:":'\\unicode{"203A}\\:\\unicode{"2039}',"\\;":'\\unicode{"203A}\\;\\unicode{"2039}',"\\quad":'\\unicode{"203A}\\quad\\unicode{"2039}',"\\qquad":'\\unicode{"203A}\\qquad\\unicode{"2039}',"\\enskip":'\\unicode{"203A}\\enskip\\unicode{"2039}',"\\space":'\\unicode{"203A}\\space\\unicode{"2039}',"\\frac":'\\frac{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\dfrac":'\\dfrac{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\cfrac":'\\cfrac{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\tfrac":'\\tfrac{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\dbinom":'\\dbinom{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\tbinom":'\\tbinom{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\binom":'\\binom{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\pdiff":'\\pdiff{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\in":"n\\in\\N","\\notin":"n\\notin\\N","\\not":"B \\not A","\\ni":"N\\in n","\\owns":"N\\owns n","\\subset":"A\\subset B","\\supset":"B\\supset A","\\subseteq":"A\\subseteq B","\\supseteq":"B\\supseteq A","\\nsubseteq":"A\\nsubseteq B","\\nsupseteq":"B\\nsupseteq A","\\subsetneq":"A\\subsetneq B","\\supsetneq":"B\\supsetneq A","\\varsubsetneq":"A\\varsubsetneq B","\\varsupsetneq":"B\\varsupsetneq A","\\nsubseteqq":"A\\varsupsetneq B","\\subsetneqq":"A\\subsetneqq B","\\varsubsetneqq":"A\\varsubsetneqq B","\\nsubset":"A\\nsubset B","\\nsupset":"B\\nsupset A","\\complement":"A^\\complement","\\bigcup":'\\bigcup_{\\unicode{"2B1A}}',"\\bigcap":'\\bigcap_{\\unicode{"2B1A}}',"\\sqrt":'\\sqrt{\\unicode{"2B1A}}',"\\prod":'\\prod_{\\unicode{"2B1A}}^{\\unicode{"2B1A}}',"\\sum":'\\sum_{\\unicode{"2B1A}}^{\\unicode{"2B1A}}',"\\int":'\\int_{\\unicode{"2B1A}}^{\\unicode{"2B1A}}',"\\stackrel":'\\stackrel{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\stackbin":'\\stackbin{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\underset":'\\underset{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\overset":'\\overset{\\unicode{"2B1A}}{\\unicode{"2B1A}}',"\\prime":'\\unicode{"2B1A}^{\\prime}',"\\boxed":'\\boxed{\\unicode{"2B1A}}',"\\colorbox":'\\colorbox{#fbc0bd}{\\unicode{"2B1A}}',"\\bbox":'\\bbox[#ffd400, solid 2px #ffd400]{\\unicode{"2B1A}}',"\\enclose":'\\enclose{updiagonalstrike,roundedbox}[1px solid red, mathbackground="#fbc0bd"]{23+45}',"\\fcolorbox":'\\fcolorbox{#cd0030}{#ffd400}{\\unicode{"2B1A}}',"\\ ":'\\char"2423',"\\top":"{\\color{red}P}\\top","\\bot":"{\\color{#0F0}P}\\bot","\\mid":"P(p\\mid q)","\\rlap":"\\rlap{x}o","\\llap":"o\\llap{/}"},He={"\\text":"roman text","\\textrm":"roman text","\\textnormal":"roman text","\\textit":"italic text","\\textbf":"bold text","\\texttt":"monospaced text","\\textsf":"sans-serif text","\\mathrm":["roman","(upright)"],"\\mathbf":"bold","\\bf":"bold","\\bold":"bold","\\mathit":"italic","\\mathbb":"blackboard","\\Bbb":"blackboard","\\mathscr":"script","\\mathtt":["typewriter","(monospaced)"],"\\mathsf":"sans-serif","\\mathcal":"caligraphic","\\frak":["fraktur","(gothic)"],"\\mathfrak":["fraktur","(gothic)"],"\\textcolor":"text color","\\color":"color","\\forall":"for all","\\exists":"there exists","\\nexists":"there does not exist","\\frac":"fraction","\\dfrac":"display fraction","\\cfrac":"continuous fraction","\\tfrac":"text fraction","\\binom":"binomial coefficient","\\dbinom":"display binomial coefficient","\\tbinom":"text binomial coefficient","\\pdiff":"partial differential","\\vec":"vector","\\check":"caron","\\acute":"acute","\\breve":"breve","\\tilde":"tilde","\\dot":"dot","\\hat":["hat","circumflex"],"\\ddot":"double dot","\\bar":"bar","\\prime":"prime","\\doubleprime":"double prime","\\varnothing":"empty set","\\emptyset":"empty set","\\subseteq":"subset of or
equal to","\\supseteq":"superset of or
equal to","\\supset":"superset of","\\subset":"subset of","\\partial":"partial derivative","\\bigcup":"union","\\bigcap":"intersection","\\approx":"approximately equal to","\\notin":"not an element of","\\in":["element of","included in"],"\\infty":"infinity","\\land":"logical and","\\sqrt":"square root","\\prod":"product","\\sum":"summation","\\amalg":["amalgamation","coproduct","free product","disjoint union"],"\\cup":"union with","\\cap":"intersection with","\\int":"integral","\\iint":"surface integral","\\oint":"curve integral","\\iiint":"volume integral","\\iff":"if and only if","\\ln":"natural logarithm","\\boldsymbol":"bold","\\setminus":"set subtraction","\\stackrel":"relation with symbol above","\\stackbin":"operator with symbol above","\\underset":"symbol with annotation below","\\overset":"symbol with annotation above","\\hslash":["h-bar","Planck constant"],"\\gtrsim":"greater than or
similar to","\\propto":"proportional to","\\equiv":"equivalent to","\\!":["negative thin space","(-3 mu)"],"\\ ":["space","(6 mu)"],"\\,":["thin space","(3 mu)"],"\\:":["medium space","(4 mu)"],"\\;":["thick space","(5 mu)"],"\\quad":["1 em space","(18 mu)"],"\\qquad":["2 em space","(36 mu)"],"\\enskip":["½ em space","(9 mu)"],"\\mp":"minus or plus","\\pm":"plus or minus","\\Im":"Imaginary part of","\\Re":"Real part of","\\gothicCapitalR":"Real part of","\\gothicCapitalI":"Imaginary part part of","\\differentialD":"differential d","\\aleph":["aleph","infinite cardinal",'Wikipedia '],"\\beth":["beth","beth number",'Wikipedia '],"\\gimel":["gimel","gimel function",'Wikipedia '],"\\O":"empty set","\\N":"set of
natural numbers","\\Z":"set of
integers","\\Q":"set of
rational numbers","\\C":"set of
complex numbers","\\R":"set of
real numbers","\\P":"set of
prime numbers","\\lesseqqgtr":"less than, equal to or
greater than","\\gnapprox":"greater than and
not approximately","\\lnapprox":"lesser than and
not approximately","\\j":"dotless j","\\i":"dotless i","\\cdot":"centered dot","\\lmoustache":"left moustache","\\rmoustache":"right moustache","\\nabla":["nabla","del","differential vector operator"],"\\square":["square","d’Alembert operator",'Wikipedia '],"\\blacksquare":["black square","end of proof","tombstone","Halmos symbol"],"\\Box":"end of proof","\\colon":["such that","ratio"],"\\coloneq":["is defined by","is assigned"],"\\Colon":["is defined by","as"],"\\_":["underbar","underscore"],"\\ll":"much less than","\\gg":"much greater than","\\doteq":"approximately equal to","\\Doteq":"approximately equal to","\\doteqdot":"approximately equal to","\\cong":["isomorphism of","(for algebras, modules...)"],"\\det":["determinant of","(of a matrix)"],"\\dotplus":"Cartesian product algebra","\\otimes":["tensor product","(of algebras)","Kronecker product","(of matrices)"],"\\oplus":["direct sum","(of modules)"],"\\lb":"base-2 logarithm","\\lg":"base-10 logarithm","\\wp":["Weierstrass P",'Wikipedia '],"\\wr":["wreath product",'Wikipedia '],"\\top":["tautology","Proposition P is universally true"],"\\bot":["contradiction","Proposition P is contradictory"],"\\mid":["probability","of event A given B"],"\\mho":["Siemens","electrical conductance in SI unit",'Wikipedia '],"\\Longrightarrow":"implies","\\Longleftrightarrow":"if, and only if,","\\prec":"precedes","\\preceq":"precedes or is equal to","\\succ":"succeedes","\\succeq":"succeedes or is equal to","\\perp":["is perpendicular to","is independent of"],"\\models":["entails","double-turnstyle, models","is a semantic consequence of",'Wikipedia '],"\\vdash":["satisfies","turnstyle, assertion sign","syntactic inference",'Wikipedia '],"\\implies":["implies","logical consequence"],"\\impliedby":["implied by","logical consequence"],"\\surd":["surd","root of","checkmark"],"\\ltimes":["semi direct product",'Wikipedia '],"\\rtimes":["semi direct product",'Wikipedia '],"\\leftthreetimes":["semi direct product",'Wikipedia '],"\\rightthreetimes":["semi direct product",'Wikipedia '],"\\divideontimes":["divide on times"],"\\curlywedge":"nor","\\curlyvee":"nand","\\simeq":"is group isomorphic with","\\vartriangleleft":["is a normal subgroup of","is an ideal ring of"],"\\circ":["circle","ring","function composition"],"\\rlap":["overlap right","\\rlap{x}o"],"\\llap":["overlap left","o\\llap{/}"],"\\colorbox":["color box","\\colorbox{#fbc0bd}{...}"],"\\ast":["asterisk","reflexive closure (as a superscript)"],"\\bullet":"bullet","\\lim":"limit"};function Ve(t){let e=He[t]||"";return Array.isArray(e)&&(e=e.join("
")),e}function Ue(t,e){t.popover.innerHTML=e;const i=t._getCaretPosition();i&&je(t,i),t.popover.classList.add("is-visible")}function je(t,e){const i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a=window.innerWidth-document.documentElement.clientWidth,o=window.innerHeight-document.documentElement.clientHeight,n=t.virtualKeyboardVisible?t.virtualKeyboard.offsetHeight:0;e.x+t.popover.offsetWidth/2>s-a?t.popover.style.left=s-t.popover.offsetWidth-a+"px":e.x-t.popover.offsetWidth/2<0?t.popover.style.left=0:t.popover.style.left=e.x-t.popover.offsetWidth/2+"px",e.y+t.popover.offsetHeight+5>i-o-n?(t.popover.classList.add("reverse-direction"),t.popover.style.top=e.y-e.height-t.popover.offsetHeight-5+"px"):(t.popover.classList.remove("reverse-direction"),t.popover.style.top=e.y+5+"px")}function Ge(t){t.popover.classList.remove("is-visible")}var Ze={getNote:Ve,SAMPLES:We,NOTES:He,showPopoverWithLatex:function(t,e,i){if(!e||0===e.length)return void Ge(t);const s=e,a=function(t,e){const i=le.parseTokens(n(t),"math",null,e.config.macros),s=Yt.decompose({mathstyle:"displaystyle",macros:e.config.macros},i),a=$.makeSpan(s,"ML__base"),o=$.makeSpan("","ML__strut");o.setStyle("height",a.height,"em");const r=$.makeSpan("","ML__strut--bottom");return r.setStyle("height",a.height+a.depth,"em"),r.setStyle("vertical-align",-a.depth,"em"),$.makeSpan([o,r,a],"ML__mathlive").toMarkup()}(We[s]||e,t),o=Ve(s),r=xe.forCommand(s);let l=i?'
':"";l+='',l+='
'+a+"
",o&&(l+='
'+o+"
"),r&&(l+='
'+r+"
"),l+="
",l+=i?'
':"",Ue(t,l);let c=t.popover.getElementsByClassName("ML__popover__content");c&&c.length>0&&t._attachButtonHandlers(c[0],["complete",{acceptSuggestion:!0}]),c=t.popover.getElementsByClassName("ML__popover__prev-shortcut"),c&&c.length>0&&t._attachButtonHandlers(c[0],"previousSuggestion"),c=t.popover.getElementsByClassName("ML__popover__next-shortcut"),c&&c.length>0&&t._attachButtonHandlers(c[0],"nextSuggestion")},showPopover:Ue,hidePopover:Ge,updatePopoverPosition:function t(e,i){if(e.element&&e.element.mathfield===e&&e.popover.classList.contains("is-visible"))if(i&&i.deferred)window.requestAnimationFrame(()=>t(e));else if(e.mathlist.anchor()&&"command"===e.mathlist.anchor().type){const t=e._getCaretPosition();t&&je(e,t)}else Ge(e)}};function Xe(t,e,i){let s="";if(Array.isArray(e)&&e.length>0){if("first"===e[0].type&&0===(e=e.slice(1)).length)return"";s=function t(e,i,s,a){if(0===s.length)return"";if(0===i.length)return s.map(t=>t.toLatex(a)).join("");let o="",n="",r="";const l=i[0];let c=s[0][l];"fontFamily"===l&&(c=s[0].fontFamily||s[0].baseFontFamily);const h=function(t,e,i){let s=0;if("fontFamily"===e)for(;t[s]&&("mop"===t[s].type||(t[s].fontFamily||t[s].baseFontFamily)===i);)s++;else for(;t[s]&&("mop"===t[s].type||t[s][e]===i);)s++;return s}(s,l,c);if("text"===s[0].mode){if("fontShape"===l&&s[0].fontShape)"it"===s[0].fontShape?(n="\\textit{",r="}"):"sl"===s[0].fontShape?(n="\\textsl{",r="}"):"sc"===s[0].fontShape?(n="\\textsc{",r="}"):"n"===s[0].fontShape?(n="\\textup{",r="}"):(n="\\text{\\fontshape{"+s[0].fontShape+"}",r="}");else if("fontSeries"===l&&s[0].fontSeries)"b"===s[0].fontSeries?(n="\\textbf{",r="}"):"l"===s[0].fontSeries?(n="\\textlf{",r="}"):"m"===s[0].fontSeries?(n="\\textmd{",r="}"):(n="\\text{\\fontseries{"+s[0].fontSeries+"}",r="}");else if("mode"===l){let t=!0;for(let e=0;e0&&(i+=" & "),i+=Xe(this,this.array[s][e],t);s1&&(i+=" "),i+=Xe(this,this.body,t),i+="\\right"+(this.rightDelim||"."),this.rightDelim&&this.rightDelim.length>1&&(i+=" ")):t&&"("===this.leftDelim&&")"===this.rightDelim?i+="("+Xe(this,this.body,t)+")":(i+="\\mleft"+(this.leftDelim||"."),this.leftDelim&&this.leftDelim.length>1&&(i+=" "),i+=Xe(this,this.body,t),i+="\\mright"+(this.rightDelim||"."),this.rightDelim&&this.rightDelim.length>1&&(i+=" "));break;case"delim":case"sizeddelim":i+=n+"{"+this.delim+"}";break;case"rule":i+=n,this.shift&&(i+=`[${Xe(this,this.shift,t)}em]`),i+=`{${Xe(this,this.width,t)}em}{${Xe(this,this.height,t)}em}`;break;case"line":case"overlap":case"accent":i+=`${n}{${Xe(this,this.body,t)}}`;break;case"overunder":i+=`${n}{${Xe(this,this.overscript||this.underscript,t)}}{${Xe(parent,this.body,t)}}`;break;case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":case"textord":case"":/^\\(mathbin|mathrel|mathopen|mathclose|mathpunct|mathord|mathinner)/.test(n)?i+=n+"{"+Xe(this,this.body,t)+"}":'\\char"'===n?i+=this.latex+" ":"\\unicode"===n?(i+='\\unicode{"',i+=("000000"+this.body.charCodeAt(0).toString(16)).toUpperCase().substr(-6),i+="}"):(this.latex||"string"==typeof this.body)&&(this.latex&&"\\"===this.latex[0]?(i+=this.latex,/[a-zA-Z0-9]$/.test(this.latex)&&(i+=" ")):i+=n||("​"!==this.body?this.latex||this.body:""));break;case"mop":"​"!==this.body&&("\\mathop"===n?i+=n+"{"+Xe(this,this.body,t)+"}":"\\operatorname"===n?i+=n+"{"+Xe(this,this.body,t)+"}":this.latex&&"\\"===this.latex[0]?(i+=this.latex,/[a-zA-Z0-9]$/.test(this.latex)&&(i+=" ")):i+=n||("​"!==this.body?this.latex||this.body:"")),this.explicitLimits&&("limits"===this.limits&&(i+="\\limits "),"nolimits"===this.limits&&(i+="\\nolimits "));break;case"box":if("\\bbox"===n){if(i+=n,isFinite(this.padding)||void 0!==this.border||void 0!==this.backgroundcolor){const t=[];isFinite(this.padding)&&t.push(Math.floor(100*this.padding)/100+"em"),this.border&&t.push("border:"+this.border),this.backgroundcolor&&t.push(ie(this.backgroundcolor)),i+=`[${t.join(",")}]`}i+=`{${Xe(this,this.body,t)}}`}else"\\boxed"===n?i+=`\\boxed{${Xe(this,this.body,t)}}`:(i+=n,this.framecolor&&(i+=`{${ie(this.framecolor)}}`),this.backgroundcolor&&(i+=`{${ie(this.backgroundcolor)}}`),i+=`{${Xe(this,this.body,t)}}`);break;case"spacing":i+=n,"\\hspace"===n||"\\hspace*"===n?(i+="{",this.width?i+=this.width+"em":i+="0em",i+="}"):(i+=" ",this.width&&(i+=this.width+"em "));break;case"enclose":if(i+=n,"\\enclose"===n){i+="{";let t="";for(const e in this.notation)Object.prototype.hasOwnProperty.call(this.notation,e)&&this.notation[e]&&(i+=t+e,t=" ");i+="}";let e="";t="",this.backgroundcolor&&"transparent"!==this.backgroundcolor&&(e+=t+'mathbackground="'+ie(this.backgroundcolor)+'"',t=","),this.shadow&&"auto"!==this.shadow&&(e+=t+'shadow="'+this.shadow+'"',t=","),1!==this.strokeWidth||"solid"!==this.strokeStyle?(e+=t+this.borderStyle,t=","):this.strokeColor&&"currentColor"!==this.strokeColor&&(e+=t+'mathcolor="'+ie(this.strokeColor)+'"',t=","),e&&(i+=`[${e}]`)}i+=`{${Xe(this,this.body,t)}}`;break;case"mathstyle":i+="\\"+this.mathstyle+" ";break;case"space":i+=this.latex;break;case"placeholder":i+="\\placeholder{"+(this.value||"")+"}";break;case"first":case"command":case"msubsup":break;case"error":i+=this.latex}if(this.superscript){let e=Xe(this,this.superscript,t);1===e.length?("′"===e?e="\\prime ":"″"===e&&(e="\\doubleprime "),i+="^"+e):i+="^{"+e+"}"}if(this.subscript){const e=Xe(this,this.subscript,t);1===e.length?i+="_"+e:i+="_{"+e+"}"}return i},Je.plural=function(t,e,i){(i=i||{}).type=i.type||"cardinal";const s=Je.locale.substring(0,2),a="ordinal"===i.type?Je.ordinal:Je.cardinal;let o,n="ordinal"===i.type?Je._ordinalPluralCategories.indexOf(a.select(t)):Je._cardinalPluralCategories.indexOf(a.select(t));return Je.strings[Je.locale]&&(o=Je.strings[Je.locale][e]),!o&&Je.strings[s]&&(o=Je.strings[s][e]),o||(o=Je.strings.en[e],o||(o=e),n="ordinal"===i.type?Je._ordinalPluralCategories.indexOf(Je._ordinalEnglish.select(t)):Je._cardinalPluralCategories.indexOf(Je._cardinalEnglish.select(t))),o.split(";")[n]||o.split(";")[0]},Je.merge=function(t,e){if(t&&e){const i=Je._locale;Je.locale=t,Je.strings[t]={...Je.strings[t],...e},Je.locale=i}else t&&!e&&(e=t,Object.keys(e).forEach(t=>Je.merge(t,e[t])))},Object.defineProperty(Je,"locale",{set(t){Je._locale=t,Je._ordinal=null,Je._cardinal=null},get:()=>(Je._locale||(Je._locale="undefined"==typeof navigator?"en":navigator.language.slice(0,5)),Je._locale)}),Object.defineProperty(Je,"ordinal",{get:()=>(Je._ordinal||(Je._ordinalEnglish=new Intl.PluralRules("en",{type:"ordinal"}),Je._ordinalEnglishPluralCategories=Je._ordinalEnglish.resolvedOptions().pluralCategories,Je._ordinal=new Intl.PluralRules(Je.locale,{type:"ordinal"}),Je._ordinalPluralCategories=Je._ordinal.resolvedOptions().pluralCategories),Je._ordinal)}),Object.defineProperty(Je,"cardinal",{get:()=>(Je._cardinal||(Je._cardinalEnglish=new Intl.PluralRules("en",{type:"cardinal"}),Je._cardinalEnglishPluralCategories=Je._cardinalEnglish.resolvedOptions().pluralCategories,Je._cardinal=new Intl.PluralRules(Je.locale,{type:"cardinal"}),Je._cardinaPluralCategories=Je._ordinal.resolvedOptions().pluralCategories),Je._cardinal)}),Je.strings={en:{"keyboard.tooltip.functions":"Functions","keyboard.tooltip.greek":"Greek Letters","keyboard.tooltip.command":"LaTeX Command Mode","keyboard.tooltip.numeric":"Numeric","keyboard.tooltip.roman":"Symbols and Roman Letters","tooltip.copy to clipboard":"Copy to Clipboard","tooltip.redo":"Redo","tooltip.toggle virtual keyboard":"Toggle Virtual Keyboard","tooltip.undo":"Undo"},ar:{"keyboard.tooltip.functions":"مهام","keyboard.tooltip.greek":"حروف يونانية","keyboard.tooltip.command":"حالة تلقي الأوامر اللاتك","keyboard.tooltip.numeric":"الرقمية","keyboard.tooltip.roman":"رموز الاحرف الرومانية","tooltip.copy to clipboard":"نسخ إلى الحافظة","tooltip.redo":"الإعادة","tooltip.toggle virtual keyboard":"تبديل لوحة المفاتيح الإفتراضية","tooltip.undo":"إلغاء"},de:{"keyboard.tooltip.functions":"Funktionen","keyboard.tooltip.greek":"Griechische Buchstaben","keyboard.tooltip.command":"LaTeX-Befehlsmodus","keyboard.tooltip.numeric":"Numerisch","keyboard.tooltip.roman":"Symbole und römische Buchstaben","tooltip.copy to clipboard":"In die Zwischenablage kopieren","tooltip.redo":"Wiederholen","tooltip.toggle virtual keyboard":"Virtuelle Tastatur umschalten","tooltip.undo":"Widerrufen"},el:{"keyboard.tooltip.functions":"συναρτήσεις","keyboard.tooltip.greek":"ελληνικά γράμματα","keyboard.tooltip.command":"Λειτουργία εντολών LaTeX","keyboard.tooltip.numeric":"Αριθμητικός","keyboard.tooltip.roman":"Σύμβολα και ρωμαϊκά γράμματα","tooltip.copy to clipboard":"Αντιγραφή στο πρόχειρο","tooltip.redo":"Ξανακάνω","tooltip.toggle virtual keyboard":"Εναλλαγή εικονικού πληκτρολογίου","tooltip.undo":"Ξεκάνω"},es:{"keyboard.tooltip.functions":"Funciones","keyboard.tooltip.greek":"Letras griegas","keyboard.tooltip.command":"Modo Comando LaTeX","keyboard.tooltip.numeric":"Numérico","keyboard.tooltip.roman":"Símbolos y letras romanas","tooltip.copy to clipboard":"Copiar al portapapeles","tooltip.redo":"Rehacer","tooltip.toggle virtual keyboard":"Alternar teclado virtual","tooltip.undo":"Deshacer"},fa:{"keyboard.tooltip.functions":"توابع","keyboard.tooltip.greek":"حروف یونانی","keyboard.tooltip.command":"حالت دستور لاتک","keyboard.tooltip.numeric":"عددی","keyboard.tooltip.roman":"علائم و حروف لاتین","tooltip.copy to clipboard":"کپی به کلیپبورد","tooltip.redo":"بازگشت به بعد","tooltip.toggle virtual keyboard":"نمایش/نهفتن کیبورد مجازی","tooltip.undo":"بازگشت به قبل"},fr:{"keyboard.tooltip.functions":"Fonctions","keyboard.tooltip.greek":"Lettres grecques","keyboard.tooltip.command":"Mode de commandes LaTeX","keyboard.tooltip.numeric":"Numérique","keyboard.tooltip.roman":"Lettres et symboles romains","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"},it:{"keyboard.tooltip.functions":"Funzioni","keyboard.tooltip.greek":"Lettere greche","keyboard.tooltip.command":"Modalità di comando LaTeX","keyboard.tooltip.numeric":"Numerico","keyboard.tooltip.roman":"Simboli e lettere romane","tooltip.copy to clipboard":"Copia negli appunti","tooltip.redo":"Rifare","tooltip.toggle virtual keyboard":"Attiva / disattiva la tastiera virtuale","tooltip.undo":"Disfare"},ja:{"keyboard.tooltip.functions":"関数","keyboard.tooltip.greek":"ギリシャ文字","keyboard.tooltip.command":"LaTeXコマンドモード","keyboard.tooltip.numeric":"数値","keyboard.tooltip.roman":"記号とローマ字","tooltip.copy to clipboard":"クリップボードにコピー","tooltip.redo":"やり直し","tooltip.toggle virtual keyboard":"仮想キーボードの切り替え","tooltip.undo":"元に戻す"},pl:{"keyboard.tooltip.functions":"Funkcje","keyboard.tooltip.greek":"Litery greckie","keyboard.tooltip.command":"Tryb poleceń LaTeX","keyboard.tooltip.numeric":"Numeryczne","keyboard.tooltip.roman":"Symbole i litery rzymskie","tooltip.copy to clipboard":"Kopiuj do Schowka","tooltip.redo":"Przywróć","tooltip.toggle virtual keyboard":"Przełącz wirtualną klawiaturę","tooltip.undo":"Cofnij"},ru:{"keyboard.tooltip.functions":"Функции","keyboard.tooltip.greek":"Греческие буквы","keyboard.tooltip.command":"Режим командной строки LaTeX","keyboard.tooltip.numeric":"числовой","keyboard.tooltip.roman":"Символы и римские буквы","tooltip.copy to clipboard":"Скопировать в буфер обмена","tooltip.redo":"переделывать","tooltip.toggle virtual keyboard":"Переключить виртуальную клавиатуру","tooltip.undo":"расстегивать"}};const Ye={numeric:{tooltip:"keyboard.tooltip.numeric",layer:"math",label:"123",layers:["math"]},roman:{tooltip:"keyboard.tooltip.roman",layer:"lower-roman",label:"ABC",layers:["lower-roman","upper-roman","symbols"]},greek:{tooltip:"keyboard.tooltip.greek",layer:"lower-greek",label:"αβγ",classes:"tex-math",layers:["lower-greek","upper-greek"]},functions:{tooltip:"keyboard.tooltip.functions",layer:"functions",label:"f ()",classes:"tex",layers:["functions"]},command:{tooltip:"keyboard.tooltip.command",command:"enterCommandMode",label:"",layers:["lower-command","upper-command","symbols-command"]},style:{tooltip:"keyboard.tooltip.style",layer:"style",label:"bi𝔹"}},Qe={"\\varphi ":{label:"Φ",insert:"\\Phi "},"\\varsigma ":{label:"Σ",insert:"\\Sigma "},"\\epsilon ":{label:"Ɛ",insert:'{\\char"0190}'},"\\rho ":{label:"Ρ",insert:'{\\char"3A1}'},"\\tau ":{label:"Τ",insert:'{\\char"3A4}'},"\\upsilon ":{label:"Υ",insert:"\\Upsilon "},"\\theta ":{label:"Θ",insert:"\\Theta "},"\\iota ":{label:"Ι",insert:'{\\char"399}'},"\\omicron ":{label:"Ο",insert:'{\\char"39F}'},"\\pi ":{label:"Π",insert:"\\Pi "},"\\alpha ":{label:"Α",insert:'{\\char"391}'},"\\sigma ":{label:"Σ",insert:"\\Sigma "},"\\delta ":{label:"Δ",insert:"\\Delta "},"\\phi ":{label:"Φ",insert:"\\Phi "},"\\gamma ":{label:"Γ",insert:"\\Gamma "},"\\eta ":{label:"Η",insert:'{\\char"397}'},"\\xi ":{label:"Ξ",insert:"\\Xi "},"\\kappa ":{label:"Κ",insert:'{\\char"39A}'},"\\lambda ":{label:"Λ",insert:"\\Lambda "},"\\zeta ":{label:"Ζ",insert:'{\\char"396}'},"\\chi ":{label:"Χ",insert:'{\\char"3A7}'},"\\psi ":{label:"Ψ",insert:"\\Psi "},"\\omega ":{label:"Ω",insert:"\\Omega "},"\\beta ":{label:"Β",insert:'{\\char"392}'},"\\nu ":{label:"Ν",insert:'{\\char"39D}'},"\\mu ":{label:"Μ",insert:'{\\char"39C}'}},ti={0:["\\emptyset","\\varnothing","\\infty",{latex:"#?_0",insert:"#@_0"},"\\circ","\\bigcirc","\\bullet"],2:["\\frac{1}{2}",{latex:"#?^2",insert:"#@^2"}],3:["\\frac{1}{3}",{latex:"#?^3",insert:"#@^3"}],".":[",",";","\\colon",{latex:":",aside:"ratio"},{latex:"\\cdotp",aside:"center dot",classes:"box"},{latex:"\\cdots",aside:"center ellipsis",classes:"box"},{latex:"\\ldotp",aside:"low dot",classes:"box"},{latex:"\\ldots",aside:"low ellipsis",classes:"box"},{latex:"\\vdots",aside:"",classes:"box"},{latex:"\\ddots",aside:"",classes:"box"},"\\odot","\\oslash","\\circledcirc"],"*":["\\cdot","\\ast","\\star","\\bigstar","\\ltimes","\\rtimes","\\rightthreetimes","\\leftthreetimes","\\intercal","\\prod",{latex:"\\prod_{n\\mathop=0}^{\\infty}",classes:"small"}],"+":["\\pm","\\mp","\\sum",{latex:"\\sum_{n\\mathop=0}^{\\infty}",classes:"small"},"\\dotplus","\\oplus"],"-":["\\pm","\\mp","\\ominus","\\vert #0 \\vert"],"/":["\\divideontimes","/","\\div"],"(":["\\left( #0\\right)","\\left[ #0\\right]","\\left\\{ #0\\right\\}","\\left\\langle #0\\right\\rangle","\\lfloor","\\llcorner","(","\\lbrack","\\lvert","\\lVert","\\lgroup","\\langle","\\lceil","\\ulcorner","\\lmoustache","\\lbrace"],")":["\\rfloor","\\lrcorner",")","\\rbrack","\\rvert","\\rVert","\\rgroup","\\rangle","\\rceil","\\urcorner","\\rmoustache","\\rbrace"],"=":["\\cong","\\asymp","\\equiv","\\differencedelta","\\varpropto","\\thickapprox","\\approxeq","\\thicksim","\\backsim","\\eqsim","\\simeq","\\Bumpeq","\\bumpeq","\\doteq","\\Doteq","\\fallingdotseq","\\risingdotseq","\\coloneq","\\eqcirc","\\circeq","\\triangleq","\\between"],"!=":["\\neq","\\ncong","","\\nsim"],"<":["\\leq","\\leqq","\\lneqq","\\ll","\\nless","\\nleq","\\precsim","\\lesssim","\\lessgtr","\\prec","\\preccurlyeq","\\lessdot","\\nprec"],">":["\\geq","\\geqq","\\gneqq","\\gg","\\ngtr","\\ngeq","\\succsim","\\gtrsim","\\gtrless","\\succ","\\succcurlyeq","\\gtrdot","\\nsucc"],set:["\\in","\\owns","\\subset","\\nsubset","\\supset","\\nsupset"],"!set":["\\notin","\\backepsilon"],subset:[],supset:[],infinity:["\\aleph_0","\\aleph_1","\\omega","\\mathfrak{m}"],"numeric-pi":["\\prod","\\theta","\\rho","\\sin","\\cos","\\tan"],ee:["\\times 10^{#?}","\\ln","\\ln_{10}","\\log"],"^":["_{#?}"],int:[{latex:"\\int_{#?}^{#?}",classes:"small"},{latex:"\\int",classes:"small"},{latex:"\\smallint",classes:"small"},{latex:"\\iint",classes:"small"},{latex:"\\iiint",classes:"small"},{latex:"\\oint",classes:"small"},{latex:"\\dfrac{\\rd}{\\rd x}",classes:"small"},{latex:"\\frac{\\partial}{\\partial x}",classes:"small"},"\\capitalDifferentialD","\\rd","\\partial"],nabla:["\\nabla\\times","\\nabla\\cdot","\\nabla^{2}"],"!":["!!","\\Gamma","\\Pi"],accents:["\\bar{#@}","\\vec{#@}","\\hat{#@}","\\check{#@}","\\dot{#@}","\\ddot{#@}","\\mathring{#@}","\\breve{#@}","\\acute{#@}","\\tilde{#@}","\\grave{#@}"],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"}],B:[{latex:"\\beth",aside:"beth"}],c:[{latex:"\\C",aside:"set of complex numbers"}],d:[{latex:"\\daleth",aside:"daleth"}],D:[{latex:"\\daleth",aside:"daleth"}],e:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn’t"}],g:[{latex:"\\gimel",aside:"gimel"}],G:[{latex:"\\gimel",aside:"gimel"}],h:[{latex:"\\hbar",aside:"h bar"},{latex:"\\hslash",aside:"h slash"}],i:[{latex:"\\imaginaryI",aside:"imaginary i"}],j:[{latex:"\\imaginaryJ",aside:"imaginary j"}],l:[{latex:"\\ell",aside:"ell"}],n:[{latex:"\\N",aside:"set of natural numbers"}],p:[{latex:"\\P",aside:"set of primes"}],q:[{latex:"\\Q",aside:"set of rational numbers"}],r:[{latex:"\\R",aside:"set of real numbers"}],z:[{latex:"\\Z",aside:"set of integers"}],"x-var":["y","z","t","r",{latex:"f(#?)",classes:"small"},{latex:"g(#?)",classes:"small"},"x^2","x^n","x_n","x_{n+1}","x_i","x_{i+1}"],"n-var":["i","j","p","k","a","u"],ii:["\\Re","\\Im","\\imaginaryJ","\\Vert #0 \\Vert"],logic:[{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn’t"},{latex:"\\ni",aside:"such that"},{latex:"\\Colon",aside:"such that"},{latex:"\\implies",aside:"implies"},{latex:"\\impliedby",aside:"implied by"},{latex:"\\iff",aside:"if and only if"},{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:"\\therefore",aside:"therefore"},{latex:"\\because",aside:"because"},{latex:"^\\biconditional",aside:"biconditional"},"\\leftrightarrow","\\Leftrightarrow","\\to","\\models","\\vdash","\\gets","\\dashv","\\roundimplies"],"set-operators":["\\cap","\\cup","\\setminus","\\smallsetminus","\\complement"],"set-relations":["\\in","\\notin","\\ni","\\owns","\\subset","\\supset","\\subseteq","\\supseteq","\\subsetneq","\\supsetneq","\\varsubsetneq","\\subsetneqq","\\nsubset","\\nsupset","\\nsubseteq","\\nsupseteq"],space:[{latex:'\\char"203A\\!\\char"2039',insert:"\\!",aside:"negative thin space
⁻³⧸₁₈ em"},{latex:'\\unicode{"203A}\\,\\unicode{"2039}',insert:"\\,",aside:"thin space
³⧸₁₈ em"},{latex:'\\unicode{"203A}\\:\\unicode{"2039}',insert:"\\:",aside:"medium space
⁴⧸₁₈ em"},{latex:'\\unicode{"203A}\\;\\unicode{"2039}',insert:"\\;",aside:"thick space
⁵⧸₁₈ em"},{latex:'\\unicode{"203A}\\ \\unicode{"2039}',insert:"\\ ",aside:"⅓ em"},{latex:'\\unicode{"203A}\\enspace\\unicode{"2039}',insert:"\\enspace",aside:"½ em"},{latex:'\\unicode{"203A}\\quad\\unicode{"2039}',insert:"\\quad",aside:"1 em"},{latex:'\\unicode{"203A}\\qquad\\unicode{"2039}',insert:"\\qquad",aside:"2 em"}],delete:[{label:'',command:'"deleteAll"'}],"->|":[]};let ei={};const ii={math:"\n
\n
    \n
  • x
  • \n
  • n
  • \n
  • \n \n
  • \n
  • e
  • \n
  • i
  • \n
  • \n
\n
    \n
  • <
  • \n
  • >
  • \n
  • \n \n
  • \n
  • x ²
  • \n
  • x
  • \n
  • \n
\n
    \n
  • (
  • \n
  • )
  • \n
  • \n \n
  • \n
  • \n
  • \n
\n \n
    \n
  • \n
  • \n
  • \n \n
  • \n \n
\n
\n ","lower-roman":"\n
\n
    \n \n \n
\n
    \n \n \n
\n
    \n \n \n
\n
    \n \n
  • ∞≠
  • \n
  • ,
  • \n
  •  
  • \n \n
\n
","upper-roman":"\n
\n
    \n \n \n
\n
    \n \n \n
\n
    \n \n \n
\n
    \n \n
  • ∞≠
  • \n
  • ;
  • \n
  •  
  • \n \n
\n
",symbols:"\n
\n
    \n \n
  • {
  • \n
  • }
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • o
  • \n
  • \n
  • \n\n
\n
    \n \n
  • [
  • \n
  • ]
  • \n
  • \n
  • \n
  • \n
  • !
  • \n
  • o
  • \n
  • o
  • \n
  • \n
  • \n\n
\n
    \n \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n\n
  • \n
\n
    \n \n
  • abc
  • \n
  • \n
  • :
  • \n
  • \n
  • \n
  • \n
  • ±
  • \n \n
\n
","lower-greek":"\n
\n
  • φ
  • \n
  • ς
  • \n
  • ϵ
  • \n
  • ρ
  • \n
  • τ
  • \n
  • υ
  • \n
  • θ
  • \n
  • ι
  • \n
  • ο
  • \n
  • π
  • \n
\n
  • α
  • \n
  • σ
  • \n
  • δ
  • \n
  • ϕ
  • \n
  • γ
  • \n
  • η
  • \n
  • ξ
  • \n
  • κ
  • \n
  • λ
  • \n
\n
  • \n
  • ζ
  • \n
  • χ
  • \n
  • ψ
  • \n
  • ω
  • \n
  • β
  • \n
  • ν
  • \n
  • μ
  • \n
  • \n
\n
    \n
  •  
  • \n
  • ,
  • \n
  • ε
  • \n
  • ϑ
  • \n
  • ϰ
  • \n
  • ϖ
  • \n
  • ϱ
  • \n \n
\n
","upper-greek":"\n
\n
  • Φ
  • \n
  • Σ
  • \n
  • Ɛ
  • \n
  • Ρ
  • \n
  • Τ
  • \n
  • Υ
  • \n
  • Θ
  • \n
  • Ι
  • \n
  • Ο
  • \n
  • Π
\n
  • Α
  • \n
  • Σ
  • \n
  • Δ
  • \n
  • Φ
  • \n
  • Γ
  • \n
  • Η
  • \n
  • Ξ
  • \n
  • Κ
  • \n
  • Λ
\n
  • \n
  • Ζ
  • \n
  • Χ
  • \n
  • Ψ
  • \n
  • Ω
  • \n
  • Β
  • \n
  • Ν
  • \n
  • Μ
  • \n
\n
    \n
  •  
  • \n
  • .
  • \n
  •  
  • \n \n
\n
","lower-command":"\n
\n
\n
\n
\n
    \n
  • 01#
  • \n
  • {
  • \n
  • }
  • \n
  • ^
  • \n
  • _
  • \n
  •  
  • \n \n
\n
","upper-command":"\n
\n
\n
\n
\n
    \n
  • \n
  • [
  • \n
  • ]
  • \n
  • (
  • \n
  • )
  • \n
  •  
  • \n \n
\n
","symbols-command":"\n
\n
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 0
\n
  • !
  • @
  • #
  • $
  • %
  • ^
  • &
  • *
  • +
  • =
\n
    \n
  • \\
  • \n
  • |
  • \n
  • /
  • \n
  • `
  • \n
  • ;
  • \n
  • :
  • \n
  • ?
  • \n
  • '
  • \n
  • \"
  • \n
  • \n
\n
    \n
  • abc
  • \n
  • <
  • \n
  • >
  • \n
  • ~
  • \n
  • ,
  • \n
  • .
  • \n
  •  
  • \n \n
\n
",functions:"\n
\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
  • \n
  • (
  • \n
  • )
  • \n
  • \n
  • \n
  •  
  • \n \n
\n
",style:"\n
\n
    \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
    \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
    \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
\n
    \n
  • \n
  • \n
  • \n\n
  • \n
  • \n
  • \n
  • \n
\n
"};function si(t,e,i){t=t.replace(/(^|[^\\])#@/g,"$1#?");const s=le.parseTokens(n(t),"math",e,i.config.macros),a=Yt.decompose({mathstyle:"displaystyle",macros:i.config.macros},s),o=$.makeSpan(a,"ML__base"),r=$.makeSpan("","ML__strut");r.setStyle("height",o.height,"em");const l=$.makeSpan("","ML__strut--bottom");return l.setStyle("height",o.height+o.depth,"em"),l.setStyle("vertical-align",-o.depth,"em"),$.makeSpan([r,l,o],"ML__mathlive").toMarkup()}function ai(t,e,i){let s="
";const a=e.replace(/\s+/g," ").split(" ");if(a.length>1){const e=Object.assign({},Ye,t.config.customVirtualKeyboards||{});for(const t of a){if(!e[t])break;s+="
"+e[t].label+"
"}}return s+="
",s+=`\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n `,""}function oi(t,e,i){for(let s=0;s"+a.getAttribute("data-aside").replace(/"/g,'"')+""),a.getAttribute("data-classes")&&a.classList.add(a.getAttribute("data-classes"));let o,n=a.getAttribute("data-insert");if(n&&(n=n.replace(/"/g,'"')),n&&Qe[n]&&(a.setAttribute("data-shifted",Qe[n].label),a.setAttribute("data-shifted-command",JSON.stringify(["insertAndUnshiftKeyboardLayer",Qe[n].insert]))),o=a.getAttribute("data-command")?JSON.parse(a.getAttribute("data-command")):a.getAttribute("data-insert")?["insert",a.getAttribute("data-insert"),{focus:!0,feedback:!0,mode:"math",format:"auto",resetStyle:!0}]:a.getAttribute("data-latex")?["insert",a.getAttribute("data-latex"),{focus:!0,feedback:!0,mode:"math",format:"auto",resetStyle:!0}]:["typedText",a.getAttribute("data-key")||a.textContent,{focus:!0,feedback:!0,simulateKeystroke:!0}],i&&(o=[i,o]),a.getAttribute("data-alt-keys")){const t=ei[a.getAttribute("data-alt-keys")];t&&(o={default:o,pressAndHoldStart:["showAlternateKeys",a.getAttribute("data-alt-keys"),t],pressAndHoldEnd:"hideAlternateKeys"})}t._attachButtonHandlers(a,o)}}function ni(t,e){const i={qwerty:{"lower-1":"qwertyuiop","lower-2":" asdfghjkl ","lower-3":"^zxcvbnm~","upper-1":"QWERTYUIOP","upper-2":" ASDFGHJKL ","upper-3":"^ZXCVBNM~","numpad-1":"789/","numpad-2":"456*","numpad-3":"123-","numpad-4":"0.=+"},azerty:{"lower-1":"azertyuiop","lower-2":"qsdfghjklm","lower-3":"^ wxcvbn ~","upper-1":"AZERTYUIOP","upper-2":"QSDFGHJKLM","upper-3":"^ WXCVBN ~"},qwertz:{"lower-1":"qwertzuiop","lower-2":" asdfghjkl ","lower-3":"^yxcvbnm~","upper-1":"QWERTZUIOP","upper-2":" ASDFGHJKL","upper-3":"^YXCVBNM~"},dvorak:{"lower-1":"^ pyfgcrl ","lower-2":"aoeuidhtns","lower-3":"qjkxbmwvz~","upper-1":"^ PYFGCRL ","upper-2":"AOEUIDHTNS","upper-3":"QJKXBMWVZ~"},colemak:{"lower-1":" qwfpgjluy ","lower-2":"arstdhneio","lower-3":"^zxcvbkm~","upper-1":" QWFPGNLUY ","upper-2":"ARSTDHNEIO","upper-3":"^ZXCVBKM~"}},s=i[t.config.virtualKeyboardLayout]?i[t.config.virtualKeyboardLayout]:i.qwerty;let a,o=e;o=o.replace(//g,"\n
  • \n \n
  • \n
  • \n \n
  • \n
  • \n
  • ");let n=o.match(/()/);for(;n;){a="";const t=n[2].match(/[a-zA-Z][a-zA-Z0-9-]*=(['"])(.*?)\1/g),e={};for(const i of t){const t=i.match(/([a-zA-Z][a-zA-Z0-9-]*)=(['"])(.*?)\2/);e[t[1]]=t[3]}let r=s[e.name];if(r||(r=i.qwerty[e.name]),r)for(const t of r){let i=e.class||"";i&&(i=" "+i),"~"===t?(a+="
  • \'\n data-shifted-command=\'"deleteAll"\'\n data-alt-keys=\'delete\' data-command=\'["performWithFeedback","deletePreviousChar"]\'\n >⌫
  • '):" "===t?a+="
  • ":"^"===t?a+="
  • ":"/"===t?a+="
  • ÷
  • ":"*"===t?a+="
  • ×
  • ":"-"===t?a+="
  • ":/tt/.test(i)?a+="
  • '+t+"
  • ":a+="
  • "+t+"
  • "}o=o.replace(new RegExp(n[1]+n[2]+n[3]),a),n=o.match(/()/)}return o}var ri={make:function(t,e){let i='\n\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ';ti["foreground-color"]=[];for(const t of ae)ti["foreground-color"].push({classes:"small-button",content:'',command:'["applyStyle",{"color":"'+t+'"}]'});ti["background-color"]=[];for(const t of se)ti["background-color"].push({classes:"small-button",content:'',command:'["applyStyle",{"backgroundColor":"'+t+'"}]'});ei={...ti},Object.keys(ei).forEach(t=>{ei[t]=ei[t].slice()});const s="abcdefghijklmnopqrstuvwxyz";for(let t=0;t<26;t++){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t];ei[e]||(ei[e]=[]),ei[e].unshift({latex:"\\mathbb{"+e+"}",aside:"blackboard",insert:"\\mathbb{"+e+"}"}),ei[e].unshift({latex:"\\mathbf{"+e+"}",aside:"bold",insert:"\\mathbf{"+e+"}"}),ei[e].unshift({latex:"\\mathsf{"+e+"}",aside:"sans",insert:"\\mathsf{"+e+"}"}),ei[e].unshift({latex:"\\mathtt{"+e+"}",aside:"monospace",insert:"\\mathtt{"+e+"}"}),ei[e].unshift({latex:"\\mathcal{"+e+"}",aside:"script",insert:"\\mathcal{"+e+"}"}),ei[e].unshift({latex:"\\mathfrak{"+e+"}",aside:"fraktur",insert:"\\mathfrak{"+e+"}"}),ei[e].unshift({latex:"\\mathbb{"+s[t]+"}",aside:"blackboard",insert:"\\mathbb{"+s[t]+"}"}),ei[e].unshift({latex:"\\mathbf{"+s[t]+"}",aside:"bold",insert:"\\mathbf{"+s[t]+"}"}),ei[e].unshift({latex:"\\mathsf{"+s[t]+"}",aside:"sans",insert:"\\mathsf{"+s[t]+"}"}),ei[e].unshift({latex:"\\mathcal{"+s[t]+"}",aside:"script",insert:"\\mathcal{"+s[t]+"}"}),ei[e].unshift({latex:"\\mathfrak{"+s[t]+"}",aside:"fraktur",insert:"\\mathfrak{"+s[t]+"}"})}for(let t=0;t<=26;t++){const e=s[t];ei[e]||(ei[e]=[]),ei[e].unshift({latex:"\\mathsf{"+e+"}",aside:"sans",insert:"\\mathbb{"+e+"}"}),ei[e].unshift({latex:"\\mathbf{"+e+"}",aside:"bold",insert:"\\mathbf{"+e+"}"}),ei[e].unshift({latex:"\\mathtt{"+e+"}",aside:"monospace",insert:"\\mathtt{"+e+"}"}),ei[e].unshift({latex:"\\mathfrak{"+e+"}",aside:"fraktur",insert:"\\mathfrak{"+e+"}"})}for(let t=0;t<10;t++){const e="0123456789"[t];ei[e]||(ei[e]=[]),ei[e].unshift({latex:"\\mathbf{"+e+"}",aside:"bold",insert:"\\mathbf{"+e+"}"}),ei[e].unshift({latex:"\\mathsf{"+e+"}",aside:"sans",insert:"\\mathsf{"+e+"}"}),ei[e].unshift({latex:"\\mathtt{"+e+"}",aside:"monospace",insert:"\\mathtt{"+e+"}"}),ei[e].unshift({latex:"\\mathcal{"+e+"}",aside:"script",insert:"\\mathcal{"+e+"}"}),ei[e].unshift({latex:"\\mathfrak{"+e+"}",aside:"fraktur",insert:"\\mathfrak{"+e+"}"})}let a=t.config.virtualKeyboards;a||(a="all"),a=a.replace(/\ball\b/i,"numeric roman greek functions command");const o=Object.assign({},ii,t.config.customVirtualKeyboardLayers||{}),n=Object.assign({},Ye,t.config.customVirtualKeyboards||{}),r=a.replace(/\s+/g," ").split(" ");for(const e of r){if(!n[e])break;let s=n[e].layers||[];n[e].layer&&s.push(n[e].layer),s=Array.from(new Set(s));for(const n of s){if(!o[n])break;if("object"==typeof o[n]){let t="";if(o[n].styles&&(t+=``),o[n].backdrop&&(t+=`
    `),o[n].container&&(t+=`
    `),o[n].rows){t+="
    ";for(const e of o[n].rows){t+="
      ";for(const i of e)t+="${i.label?i.label:""}`;t+="
    "}t+="
    ",o[n].container&&(t+=""),o[n].backdrop&&(t+="")}o[n]=t}i+="
    ",i+=ai(t,a,e);const s="function"==typeof o[n]?o[n]():o[n];i+=ni(t,s),i+="
    "}}const l=document.createElement("div");l.className="ML__keyboard",e?l.classList.add(e):t.config.virtualKeyboardTheme?l.classList.add(t.config.virtualKeyboardTheme):/android|cros/i.test(navigator.userAgent)&&l.classList.add("material"),l.innerHTML=i,oi(t,l.querySelectorAll(".keycap, .action, .fnbutton, .bigfnbutton"));const c=l.getElementsByClassName("layer-switch");for(let e=0;e{t.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),t.addEventListener("touchstart",t=>{t.preventDefault(),t.stopPropagation()})}),h[0].classList.add("is-visible"),window.addEventListener("mouseup",(function(){t.hideAlternateKeys_(),t.unshiftKeyboardLayer_()})),window.addEventListener("blur",(function(){t.hideAlternateKeys_(),t.unshiftKeyboardLayer_()})),window.addEventListener("touchend",(function(){t.hideAlternateKeys_(),t.unshiftKeyboardLayer_()})),window.addEventListener("touchcancel",(function(){t.hideAlternateKeys_(),t.unshiftKeyboardLayer_()})),l},makeKeycap:oi};const li={"−":"-","-":"-","\\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"},ci={"\\pm":"+-","\\times":"xx","\\colon":":","\\vert":"|","\\Vert":"||","\\mid":"|","\\lbrace":"{","\\rbrace":"}","\\langle":"(:","\\rangle":":)"},hi={"\\pm":"±","\\times":"×","\\colon":":","\\vert":"|","\\Vert":"∥","\\mid":"∣","\\lbrace":"{","\\rbrace":"}","\\langle":"⟨","\\rangle":"⟩","\\lfloor":"⌊","\\rfloor":"⌋","\\lceil":"⌈","\\rceil":"⌉","\\vec":"⃗","\\acute":"´","\\grave":"`","\\dot":"˙","\\ddot":"¨","\\tilde":"~","\\bar":"¯","\\breve":"˘","\\check":"ˇ","\\hat":"^"};function di(t){return t.replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function pi(t,e){return t&&e.generateID?' extid="'+t+'"':""}function mi(t,e,i){let s=!1;e=e||t.atoms.length;let a="",o="",n=-1,r=-1;const l=t.atoms[t.index];if(t.index0){if(s=!0,ui(t)&&(n=t.index,t.index+=1),fi(t)&&(r=t.index,t.index+=1),n>=0&&r>=0)a=""+o,a+=vi(t.atoms[r].subscript,0,0,i).mathML,a+=vi(t.atoms[n].superscript,0,0,i).mathML,a+="";else if(n>=0){if(a=""+o,ui(t)){const e=vi(t.atoms[n].superscript,0,0,i).mathML,s=vi(t.atoms[n+1].superscript,0,0,i).mathML;a+=""!==e&&""!==e||""!==s&&""!==s?""===e||""===e?"":e:""}else a+=vi(t.atoms[n].superscript,0,0,i).mathML;a+=""}else r>=0?(a=""+o,a+=vi(t.atoms[r].subscript,0,0,i).mathML,a+=""):a=o;"mi"!==t.lastType&&"mn"!==t.lastType&&"mtext"!==t.lastType&&"fence"!==t.lastType||/^(.*)<\/mo>$/.test(a)||(a=""+a),o.endsWith(">f")||o.endsWith(">g")?(a+="",t.lastType="applyfunction"):t.lastType=/^(.*)<\/mo>$/.test(a)?"mo":"mi",t.mathML+=a}return s}function ui(t){return t.index"+t,a+=vi(o.subscript,0,0,i).mathML,a+=vi(o.superscript,0,0,i).mathML,a+=""):o.superscript?(a=""+t,a+=vi(o.superscript,0,0,i).mathML,a+=""):o.subscript&&(a=""+t,a+=vi(o.subscript,0,0,i).mathML,a+=""),a.length>0&&(s=!0,e.mathML+=a,e.lastType=""),s))}function yi(t,e,i){let s=!1;e=e||t.atoms.length;const a=t.index;let o="";for(;t.index0&&(s=!0,o=""+o+"",t.mathML+=o,t.lastType="mtext"),s}function bi(t,e,i){let s=!1;e=e||t.atoms.length;const a=t.index;let o="",n=function(t){let e=-1,i=t.index,s=!1,a=!1;for(;i=0&&n=0;)o+=t.atoms[t.index].body,t.index+=1;return o.length>0&&(s=!0,o=""+o+"",n<0&&ui(t)&&(n=t.index,t.index+=1),n>=0&&(o=""+o,o+=vi(t.atoms[n].superscript,0,0,i).mathML,o+=""),t.mathML+=o,t.lastType="mn"),s}function xi(t,e,i){let s=!1;e=e||t.atoms.length;let a="",o="";if(t.index",a+=wi(t.atoms[l],i),a+=vi(t.atoms,l+1,c,i).mathML,a+=wi(t.atoms[c],i),a+="","mi"!==t.lastType&&"mn"!==t.lastType&&"mfrac"!==t.lastType&&"fence"!==t.lastType||(a=""+a),t.index=c+1,gi(a,t,i)&&(s=!0,t.lastType="",a=""),o="fence")}return a.length>0&&(s=!0,t.mathML+=a,t.lastType=o),s}function ki(t,e,i){let s=!1;e=e||t.atoms.length;let a="",o="";const n=t.atoms[t.index];if(t.index":"")+t,a+=vi(n.subscript,0,0,i).mathML,a+=vi(n.superscript,0,0,i).mathML,a+="nolimits"!==n.limits?"":""):n.superscript?(a+=("nolimits"!==n.limits?"":"")+t,a+=vi(n.superscript,0,0,i).mathML,a+="nolimits"!==n.limits?"":""):(a+=("nolimits"!==n.limits?"":"")+t,a+=vi(n.subscript,0,0,i).mathML,a+="nolimits"!==n.limits?"":""),o="mo"}else{const e=t.atoms[t.index],n=0===e.latex.indexOf("\\operatorname"),r=n?'"+Si(e.body)+"":wi(e,i);a+=r,t.index+=1,gi(a,t,i)&&(s=!0,t.lastType="",a=""),t.index-=1,n||/^(.*)<\/mo>$/.test(r)?o=n?"mi":"mo":(a+="",o="applyfunction")}"mi"!==t.lastType&&"mn"!==t.lastType||/^(.*)<\/mo>$/.test(a)||(a=""+a),t.index+=1}return a.length>0&&(s=!0,t.mathML+=a,t.lastType=o),s}function vi(t,e,i,s){const a={atoms:t,index:e||0,mathML:"",lastType:""};if(i=i||(t?t.length:0),"number"==typeof t||"boolean"==typeof t)a.mathML=t.toString();else if("string"==typeof t)a.mathML=t;else if(t&&"function"==typeof t.toMathML)a.mathML=t.toMathML(s);else if(Array.isArray(t)){let t=0;for(;a.index0&&"genfrac"===a.atoms[a.index].type&&(e=""+e),"genfrac"===a.atoms[a.index].type?a.lastType="mfrac":a.lastType="",e.length>0&&(a.mathML+=e,t+=1),a.index+=1}t>1&&(a.mathML=""+a.mathML+"")}return a}function wi(t,e){let i="";const s=Si(t.body);return s&&(i=""+s+""),i}function Si(t){if(!t)return"";if("string"==typeof t)return di(t);if(!Array.isArray(t)&&"string"==typeof t.body)return di(t.body);let e="";for(const i of t)"string"==typeof i.body&&(e+=i.body);return di(e)}Yt.MathAtom.prototype.toMathML=function(t){const e={"\\exponentialE":"ⅇ","\\imaginaryI":"ⅈ","\\differentialD":"ⅆ","\\capitalDifferentialD":"ⅅ","\\alpha":"α","\\pi":"π","\\infty":"∞","\\forall":"∀","\\nexists":"∄","\\exists":"∃","\\hbar":"ℏ","\\cdotp":"⋅","\\ldots":"…","\\cdots":"⋯","\\ddots":"⋱","\\vdots":"⋮","\\ldotp":"."},i={"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5};let s,a,o,n,r,l,c="",h="",d={cal:"script",frak:"fraktur",bb:"double-struck",scr:"script",cmtt:"monospace",cmss:"sans-serif"}[this.fontFamily||this.font]||"";d&&(d=' mathvariant="'+d+'"');const p=this.latex?this.latex.trim():null;if("text"===this.mode)c=""+this.body+"";else switch(this.type){case"first":break;case"group":case"root":c=vi(this.body,0,0,t).mathML;break;case"array":if((this.lFence&&"."!==this.lFence||this.rFence&&"."!==this.rFence)&&(c+="",this.lFence&&"."!==this.lFence&&(c+=""+(hi[this.lFence]||this.lFence)+"")),c+="",s=0;s"+vi(this.array[a][s],0,0,t).mathML+"";c+=""}c+="",(this.lFence&&"."!==this.lFence||this.rFence&&"."!==this.rFence)&&(this.rFence&&"."!==this.rFence&&(c+=""+(hi[this.lFence]||this.rFence)+""),c+="");break;case"genfrac":(this.leftDelim||this.rightDelim)&&(c+=""),this.leftDelim&&"."!==this.leftDelim&&(c+=""+(hi[this.leftDelim]||this.leftDelim)+""),this.hasBarLine?(c+="",c+=vi(this.numer,0,0,t).mathML||" ",c+=vi(this.denom,0,0,t).mathML||" ",c+=""):(c+="",c+=""+vi(this.numer,0,0,t).mathML+"",c+=""+vi(this.denom,0,0,t).mathML+"",c+=""),this.rightDelim&&"."!==this.rightDelim&&(c+=""+(hi[this.rightDelim]||this.rightDelim)+""),(this.leftDelim||this.rightDelim)&&(c+="");break;case"surd":this.index?(c+="",c+=vi(this.body,0,0,t).mathML,c+=vi(this.index,0,0,t).mathML,c+=""):(c+="",c+=vi(this.body,0,0,t).mathML,c+="");break;case"leftright":c="",this.leftDelim&&"."!==this.leftDelim&&(c+=""+(hi[this.leftDelim]||this.leftDelim)+""),this.body&&(c+=vi(this.body,0,0,t).mathML),this.rightDelim&&"."!==this.rightDelim&&(c+=""+(hi[this.rightDelim]||this.rightDelim)+""),c+="";break;case"sizeddelim":case"delim":c+='"+(hi[this.delim]||this.delim)+"";break;case"accent":c+='",c+=vi(this.body,0,0,t).mathML,c+=""+(hi[p]||this.accent)+"",c+="";break;case"line":case"overlap":break;case"overunder":r=this.overscript,n=this.underscript,r&&n?l=this.body:r?(l=this.body,this.body[0]&&this.body[0].underscript?(n=this.body[0].underscript,l=this.body[0].body):this.body[0]&&"first"===this.body[0].type&&this.body[1]&&this.body[1].underscript&&(n=this.body[1].underscript,l=this.body[1].body)):n&&(l=this.body,this.body[0]&&this.body[0].overscript?(r=this.body[0].overscript,l=this.body[0].body):this.body[0]&&"first"===this.body[0].type&&this.body[1]&&this.body[1].overscript&&(r=this.body[1].overscript,l=this.body[1].body)),r&&n?(c+=""+vi(l,0,0,t).mathML,c+=vi(n,0,0,t).mathML,c+=vi(r,0,0,t).mathML,c+=""):r?(c+=""+vi(l,0,0,t).mathML,c+=vi(r,0,0,t).mathML,c+=""):n&&(c+=""+vi(l,0,0,t).mathML,c+=vi(n,0,0,t).mathML,c+="");break;case"placeholder":case"mord":{c=e[p]||p||("string"==typeof this.body?this.body:"");const i=p?p.match(/[{]?\\char"([0-9abcdefABCDEF]*)[}]?/):null;i?c="&#x"+i[1]+";":c.length>0&&"\\"===c.charAt(0)&&(c="string"==typeof this.body&&this.body.charCodeAt(0)>255?"&#x"+("000000"+this.body.charCodeAt(0).toString(16)).substr(-4)+";":"string"==typeof this.body?this.body.charAt(0):this.body);const s=/\d/.test(c)?"mn":"mi";c="<"+s+d+pi(this.id,t)+">"+di(c)+"";break}case"mbin":case"mrel":case"textord":case"minner":c=p&&e[p]?""+e[p]+"":p&&hi[p]?""+hi[p]+"":wi(this,t);break;case"mpunct":c='"+(hi[p]||p)+"";break;case"mop":"​"!==this.body&&(c="",c+="\\operatorname"===p?this.body:p||this.body,c+="");break;case"mathstyle":break;case"box":c='"+vi(this.body,0,0,t).mathML+"";break;case"spacing":c+='';break;case"enclose":c=''+vi(this.body,0,0,t).mathML+"";break;case"space":c+=" "}return c},Yt.toMathML=function(t,e){return vi(t,0,0,e).mathML};const Ai={"\\imaginaryI":"ⅈ","\\imaginaryJ":"ⅉ","\\pi":"π","\\exponentialE":"ℯ","﹢":"+","+":"+","−":"-","-":"-","﹣":"-","-":"-","\\times":"*","\\cdot":"*","⨉":"*","️✖":"*","️×":"*",".":"*","÷":"/","⁄":"/","/":"/","!":"factorial","\\mp":"minusplus","\\ne":"!=","\\coloneq":":=","\\questeq":"?=","\\approx":"approx","\\cong":"congruent","\\sim":"similar","\\equiv":"equiv","\\pm":"plusminus","\\land":"and","\\wedge":"and","\\lor":"or","\\vee":"or","\\oplus":"xor","\\veebar":"xor","\\lnot":"not","\\neg":"not","\\exists":"exists","\\nexists":"!exists","\\forall":"forAll","\\backepsilon":"suchThat","\\therefore":"therefore","\\because":"because","\\nabla":"nabla","\\circ":"circle","\\ominus":"ominus","\\odot":"odot","\\otimes":"otimes","\\zeta":"Zeta","\\Gamma":"Gamma","\\min":"min","\\max":"max","\\mod":"mod","\\lim":"lim","\\sum":"sum","\\prod":"prod","\\int":"integral","\\iint":"integral2","\\iiint":"integral3","\\Re":"Re","\\gothicCapitalR":"Re","\\Im":"Im","\\gothicCapitalI":"Im","\\binom":"nCr","\\partial":"partial","\\differentialD":"differentialD","\\capitalDifferentialD":"capitalDifferentialD","\\Finv":"Finv","\\Game":"Game","\\wp":"wp","\\ast":"ast","\\star":"star","\\asymp":"asymp","\\to":"to","\\gets":"gets","\\in":"elementof","\\notin":"!elementof","\\ni":"ownedby","\\owns":"ownedby","\\subset":"subset","\\supset":"superset","\\complement":"complement","\\rightarrow":"shortLogicalImplies","\\leftarrow":"shortLogicalImpliedBy","\\leftrightarrow":"shortLogicalEquivalent","\\longrightarrow":"logicalImplies","\\longleftarrow":"logicalImpliedBy","\\longleftrightarrow":"logicalEquivalent","\\Rightarrow":"shortImplies","\\Leftarrow":"shortImpliedBy","\\Leftrightarrow":"shortEquivalent","\\implies":"implies","\\Longrightarrow":"implies","\\impliedby":"impliedBy","\\Longleftarrow":"impliedBy","\\iff":"equivalent","\\Longleftrightarrow":"equivalent"},Mi={"+":"add","*":"multiply","-":"subtract","/":"divide","=":"equal",":=":"assign","!=":"ne","?=":"questeq",approx:"approx",congruent:"congruent",similar:"similar",equiv:"equiv","<":"lt",">":"gt","<=":"le",">=":"ge","≤":"le","≥":"ge",">>":"gg","<<":"ll","**":"pow","++":"increment","--":"decrement"},Ci={equal:"%0 = %1",ne:"%0 \\ne %1",questeq:"%0 \\questeq %1",approx:"%0 \\approx %1",congruent:"%0 \\cong %1",similar:"%0 \\sim %1",equiv:"%0 \\equiv %1",assign:"%0 := %1",lt:"%0 < %1",gt:"%0 > %1",le:"%0 \\le %1",ge:"%0 \\ge %1",sin:"\\sin%_%^ %0",cos:"\\cos%_%^ %0",tan:"\\tan%_%^ %0",cot:"\\cot%_%^ %0",sec:"\\sec%_%^ %0",csc:"\\csc%_%^ %0",sinh:"\\sinh %0",cosh:"\\cosh %0",tanh:"\\tanh %0",csch:"\\csch %0",sech:"\\sech %0",coth:"\\coth %0",arcsin:"\\arcsin %0",arccos:"\\arccos %0",arctan:"\\arctan %0",arccot:"\\arcctg %0",arcsec:"\\arcsec %0",arccsc:"\\arccsc %0",arsinh:"\\arsinh %0",arcosh:"\\arcosh %0",artanh:"\\artanh %0",arcsch:"\\arcsch %0",arsech:"\\arsech %0",arcoth:"\\arcoth %0",ln:"\\ln%_%^ %",log:"\\log%_%^ %",lg:"\\lg %",lb:"\\lb %",sum:"\\sum%_%^ %0",prod:"\\prod%_%^ %0",Zeta:"\\zeta%_%^ %",Gamma:"\\Gamma %",min:"\\min%_%^ %",max:"\\max%_%^ %",mod:"\\mod%_%^ %",lim:"\\lim%_%^ %",binom:"\\binom %",nabla:"\\nabla %",curl:"\\nabla\\times %0",div:"\\nabla\\cdot %0",floor:"\\lfloor %0 \\rfloor%_%^",ceil:"\\lceil %0 \\rceil%_%^",abs:"\\left| %0 \\right|%_%^",norm:"\\lVert %0 \\rVert%_%^",ucorner:"\\ulcorner %0 \\urcorner%_%^",lcorner:"\\llcorner %0 \\lrcorner%_%^",angle:"\\langle %0 \\rangle%_%^",group:"\\lgroup %0 \\rgroup%_%^",moustache:"\\lmoustache %0 \\rmoustache%_%^",brace:"\\lbrace %0 \\rbrace%_%^","sqrt[]":"\\sqrt[%^]{%0}",sqrt:"\\sqrt{%0}",lcm:"\\operatorname{lcm}%",gcd:"\\operatorname{gcd}%",erf:"\\operatorname{erf}%",erfc:"\\operatorname{erfc}%",randomReal:"\\operatorname{randomReal}%",randomInteger:"\\operatorname{randomInteger}%",and:"%0 \\land %1",or:"%0 \\lor %1",xor:"%0 \\oplus %1",not:"%0 \\lnot %1",circle:"%0 \\circ %1",ast:"%0 \\ast %1",star:"%0 \\star %1",asymp:"%0 \\asymp %1","/":"\\frac{%0}{%1}",Re:"\\Re{%0}",Im:"\\Im{%0}",factorial:"%0!",factorial2:"%0!!"},_i={degree:880,nabla:740,curl:740,partial:740,differentialD:740,capitalDifferentialD:740,"**":720,odot:710,not:680,div:660,solidus:660,"/":660,setminus:650,"%":640,otimes:410,union:350,intersection:350,"*":390,ast:390,".":390,oplus:300,ominus:300,"+":275,"-":275,"+-":275,"-+":275,circle:265,circledast:265,circledcirc:265,star:265,"..":263,to:262,in:262,"|":261,congruent:265,equiv:260,"=":260,"!=":255,"?=":255,similar:250,approx:247,"<":245,">":243,">=":242,"≥":242,"<=":241,complement:240,subset:240,superset:240,elementof:240,"!elementof":240,exists:230,"!exists":230,forall:230,and:200,xor:195,or:190,suchThat:110,":":100,assign:80,":=":80,therefore:70,because:70,shortLogicalImplies:52,shortImplies:51,logicalImplies:50,implies:49,shortLogicalImpliedBy:48,shortImpliedBy:47,logicalImpliedBy:46,impliedBy:45,shortLogicalEquivalent:44,shortEquivalent:43,logicalEquivalent:42,equivalent:41,",":40,";":30};function Ti(t,e){return Array.isArray(t.arg)?t.arg[e]:void 0}function Li(t){return t&&_i[t]||-1}function Fi(t){return/=|=>/.test(t)?"right":"left"}function Di(t){if("f"===t||"g"===t)return!0;const e=Ci[t];return!!e&&!!/%[^01_^]?/.test(e)}function zi(t){t=(t||"").trim();let e=Ai[t];if(!e)if(/^\\[^{}]+$/.test(t)){const i=wt.getInfo(t,"math",{});e=i&&i.value||t.slice(1)}else e=t;return e}function Ei(t){if(!t)return null;const e=zi(Ri(t)),i=[Li(e),Fi(e)];return i[0]<=0?null:i}function qi(t){return null!==Ei(t)}const Pi={"\\lfloor\\rfloor":"floor","\\lceil\\rceil":"ceil","\\vert\\vert":"abs","\\lvert\\rvert":"abs","||":"abs","\\Vert\\Vert":"norm","\\lVert\\rVert":"norm","\\ulcorner\\urcorner":"ucorner","\\llcorner\\lrcorner":"lcorner","\\langle\\rangle":"angle","\\lgroup\\rgroup":"group","\\lmoustache\\rmoustache":"moustache","\\lbrace\\rbrace":"brace"},Ii={"!":"factorial","\\dag":"dagger","\\dagger":"dagger","\\ddagger":"dagger2","\\maltese":"maltese","\\backprime":"backprime","\\backdoubleprime":"backprime2","\\prime":"prime","\\doubleprime":"prime2","\\$":"$","\\%":"%","\\_":"_","\\degree":"degree"},Bi={"+":"add","-":"add","*":"multiply","=":"equal",",":"list",";":"list2",and:"and",or:"or",xor:"xor",union:"union",shortLogicalEquivalent:"logicalEquivalent",logicalEquivalent:"logicalEquivalent",shortEquivalent:"equivalent",equivalent:"equivalent"},Oi={",":"list",";":"list2"};function Ri(t){if(Array.isArray(t)){let e="";for(const i of t)e+=Ri(i);return e}if(t.latex&&!/^\\math(op|bin|rel|open|punct|ord|inner)/.test(t.latex))return t.latex.trim();if("leftright"===t.type)return"";if("string"==typeof t.body)return t.body;if(Array.isArray(t.body)){let e="";for(const i of t.body)e+=Ri(i);return e}return""}function Ki(t){return"string"==typeof t.sym?function(t){let e=Ci[t];if(e)return e.replace("%1","").replace("%0","").replace("%","");if(t.length>1){const i=wt.getInfo("\\"+t,"math");!i||i.fontFamily&&"cmr"!==i.fontFamily&&"ams"!==i.fontFamily||(e="\\"+t)}return e||(e=wt.unicodeStringToLatex("math",t)),e}(t.sym)||t.sym:""}function Ni(t){return parseFloat(t.num)}function $i(t){return"object"==typeof t&&void 0!==t.num}function Wi(t){let e=0;return $i(t)&&(e="object"==typeof t.num?void 0!==t.num.re?ls(t.num.re):0:parseFloat(t.num)),e}function Hi(t){let e=0;return $i(t)&&"object"==typeof t.num&&(e=void 0!==t.num.im?ls(t.num.im):0),e}function Vi(t){return t&&void 0!==t.sup}function Ui(t){return t&&void 0!==t.sub}function ji(t,e,i){let s=!1;const a=t.atoms[t.index];return a&&a.type===e&&(s=void 0===i||Ri(a)===i),s}function Gi(t,...e){const i={fn:t};if(e){const t=[];for(const i of e)i&&t.push(i);t.length>0&&(i.arg=t)}return i}function Zi(t){return"number"==typeof t?{num:t.toString()}:"string"==typeof t?{num:t}:"object"==typeof t?{num:t}:void 0}function Xi(t){if($i(t)){const e=Wi(t),i=Hi(t);return 0!==i?(0!==e&&(t.num.re=(-e).toString()),t.num.im=(-i).toString()):t.num=(-e).toString(),t}return Gi("negate",t)}function Ji(t){const e=t.atoms[t.index+1];return e&&"msubsup"===e.type}function Yi(t,e){let i=t.atoms[t.index];return!i||void 0===i.superscript&&void 0===i.subscript?i=null:t.index+=1,i||(i=t.atoms[t.index+1],i&&"msubsup"===i.type&&(i.superscript||i.subscript)?t.index+=2:i=null),i?(void 0!==i.subscript&&(t.ast.sub=os(i.subscript,e)),void 0!==i.superscript&&("msubsup"===i.type?/['\u2032]|\\prime/.test(Ri(i.superscript))?(t.index+=1,i=t.atoms[t.index+1],i&&"msubsup"===i.type&&/['\u2032]|\\prime/.test(Ri(i.superscript))?t.ast.sup={sym:"″"}:(t.ast.sup={sym:"′"},t.index-=1)):/['\u2033]|\\doubleprime/.test(Ri(i.superscript))?t.ast.sup={sym:"″"}:t.ast&&(t.ast.sup=os(i.superscript,e)):t.ast.sup=os(i.superscript,e))):t.index+=1,t}function Qi(t,e){const i=t.ast;if(es(t,"!!"))return t.index+=1,t.ast=Gi("factorial2",i),Qi(t=Yi(t,e),e);if(es(t,"++"))return t.index+=1,t.ast=Gi("increment",i),Qi(t=Yi(t,e),e);if(es(t,"--"))return t.index+=1,t.ast=Gi("decrement",i),Qi(t=Yi(t,e),e);const s=t.atoms[t.index];return s&&s.latex&&Ii[s.latex.trim()]&&(t.ast=Gi(Ii[s.latex.trim()],i),t=Qi(t=Yi(t,e),e)),t}function ts(t,e,i,s){if(t.index=t.index||0,0===t.atoms.length||t.index>=t.atoms.length)return t.ast=void 0,t;const a=t.minPrec;t.minPrec=0;let o=t.atoms[t.index];if(e){if("mopen"===o.type&&Ri(o)===e)t.index+=1,o=(t=ss(t,s)).atoms[t.index],o&&"mclose"===o.type&&Ri(o)===i&&(Ji(t)&&(t.ast={group:t.ast}),t=Qi(t=Yi(t,s),s));else if("textord"===o.type&&Ri(o)===e)t.index+=1,o=(t=ss(t,s)).atoms[t.index],o&&"textord"===o.type&&Ri(o)===i&&(t.index+=1,t=Qi(t=Yi(t,s),s));else if("\\lVert"===e&&"textord"===o.type&&"|"===o.latex){if(o=t.atoms[t.index+1],o&&"textord"===o.type&&"|"===o.latex){t.index+=2,o=(t=ss(t,s)).atoms[t.index];const e=t.atoms[t.index+1];o&&"textord"===o.type&&"|"===o.latex&&e&&"textord"===e.type&&"|"===e.latex&&(t.index+=2,t=Qi(t=Yi(t,s),s))}}else if("sizeddelim"===o.type&&o.delim===e)t.index+=1,o=(t=ss(t,s)).atoms[t.index],o&&"sizeddelim"===o.type&&o.delim===i&&(t.index+=1,t=Qi(t=Yi(t,s),s));else{if("leftright"!==o.type||o.leftDelim!==e||"?"!==o.rightDelim&&o.rightDelim!==i)return;t.ast=os(o.body,s),Ji(t)&&(t.ast={group:t.ast}),t=Qi(t=Yi(t,s),s)}return t.minPrec=a,t}{let s=!0;if("mopen"===o.type?(e=o.latex.trim(),i=wt.RIGHT_DELIM[e]):"sizeddelim"===o.type?(e=o.delim,i=wt.RIGHT_DELIM[e]):"leftright"===o.type?(s=!1,e=o.leftDelim,"?"===(i=o.rightDelim)&&(i=wt.RIGHT_DELIM[e])):"textord"===o.type&&(e=o.latex.trim(),i=wt.RIGHT_DELIM[e]),e&&i){if("|"===e&&"|"===i){const s=t.atoms[t.index+1];s&&"textord"===s.type&&"|"===s.latex&&(e="\\lVert",i="\\rVert")}if(t=ts(t,e,i))return s&&(t.index+=1),t.ast={fn:Pi[e+i]||e+i,arg:[t.ast]},t.minPrec=a,t}}}function es(t,e){return t.index=t.index||0,!(t.atoms.length<=1||t.index>=t.atoms.length-1)&&e===Ri(t.atoms[t.index])+Ri(t.atoms[t.index+1])}function is(t){if(t.index=t.index||0,!(t.atoms.length<=1||t.index>=t.atoms.length-1)){if(!ji(t,"textord","\\nabla")){const e=t.atoms[t.index].latex+t.atoms[t.index+1].latex,i=/^(>=|<=|>>|<<|:=|!=|\*\*|\+\+|--)$/.test(e)?e:"";return i&&(t.index+=1),i}return t.index+=1,ji(t,"mbin","\\times")?(t.index+=1,t.ast="curl",t):ji(t,"mbin","\\cdot")?(t.index+=1,t.ast="div",t):void(t.index-=1)}}function ss(t,e){if(t.index=t.index||0,t.ast=void 0,0===t.atoms.length||t.index>=t.atoms.length)return t;t.minPrec=t.minPrec||0;let i=function t(e,i){if(e.index=e.index||0,e.ast=void 0,0===e.atoms.length||e.index>=e.atoms.length)return e;let s=e.atoms[e.index];if("text"===s.mode){let t="";for(;e.atoms[e.index]&&"text"===e.atoms[e.index].mode;)t+=e.atoms[e.index].body,e.index+=1;return e.ast={text:t},e}const a=zi(Ri(s));if(is(e))e.ast=Gi(e.ast,t(e,i).ast);else{if("root"===s.type)return e.index=0,e.atoms=s.body,t(e,i);if("mbin"===s.type&&"-"===a)e.index+=1,(e=t(e,i)).ast=Xi(e.ast);else if("mbin"===s.type&&"+"===a)e.index+=1,(e=t(e,i)).ast=Gi("add",e.ast);else if("mord"===s.type&&/^[0-9.]$/.test(s.latex)){let a="",o=!1,n=/^[0-9.eEdD]$/;for(;e.indext.map(t=>as(t)))),e=[t])}return e}function os(t,e){return function(t,e){t.index=t.index||0,t.ast=void 0;const i=[];for(;t.atoms[t.index];)if("text"===t.atoms[t.index].mode){let e="";for(;t.atoms[t.index]&&"text"===t.atoms[t.index].mode;)e+=t.atoms[t.index].body,t.index+=1;i.push(e)}else{const s=ss(t,e).ast;if(!s)return;i.push(s)}return i.length>1?Gi("text",...i):i[0]||void 0}({atoms:as(t)},e)}function ns(t){const e=Array.prototype.slice.call(arguments);e.shift(),t=t||".. ";let i="";if(e.length>0){"."!==t[0]&&(i+=t[0]);let s="";for(const a of e)i+=s+a,s=t[2];"."!==t[1]&&(i+=t[1])}return i}function rs(t,e){const i=t.length;t=t.substr(0,e.precision-2);for(let i=0;i1&&(s+o.repeat(n+1)).startsWith(t))return"0"===o?s.replace(/(\d{3})/g,"$1"+e.groupSeparator):s.replace(/(\d{3})/g,"$1"+e.groupSeparator)+e.beginRepeatingDigits+o.replace(/(\d{3})/g,"$1"+e.groupSeparator)+e.endRepeatingDigits}}return i!==t.length&&(t+="\\ldots"),t.replace(/(\d{3})/g,"$1"+e.groupSeparator)}function ls(t){return parseFloat(parseFloat(t).toPrecision(15))}function cs(t,e){let i="";if("number"==typeof e.precision){if("number"!=typeof t){let i="",s="";if("-"===t[0]?(i="-",t=t.substr(1)):"+"===t[0]&&(t=t.substr(1)),t.indexOf(".")>=0){const a=t.match(/(\d*).(\d*)([e|E]([-+]?[0-9]*))?/),o=a[1],n=a[2].substring(0,Math.min(e.precision-o.length,a[2].length));if(s=a[4]||"","0"===o){let s=0;for(;"0"===n[s]&&s=e.precision)a="0",i="";else{a=t[s];const i=rs(t.substr(s+1),e);i&&(a+=e.decimalMarker+i)}"0"!==a&&(t.length-1>e.precision&&!a.endsWith("}")&&!a.endsWith("\\ldots")&&(a+="\\ldots"),s>4&&(a+=e.exponentProduct,e.exponentMarker?a+=e.exponentMarker+(1-s).toString():a+="10^{"+(1-s).toString()+"}")),t=a}else{t=o.replace(/\B(?=(\d{3})+(?!\d))/g,e.groupSeparator);const i=rs(n,e);i&&(t+=e.decimalMarker+i)}}else if(t.length>e.precision){const i=t.length;let s=t[0];const a=rs(t.substr(2),e);a&&(s+=e.decimalMarker+a,"}"!==s[s.length-1]&&(s+="\\ldots")),"1"!==s?s+=e.exponentProduct:s="",e.exponentMarker?s+=e.exponentMarker+(i-2).toString():s+="10^{"+(i-2).toString()+"}",t=s}else t=t.replace(/\B(?=(\d{3})+(?!\d))/g,e.groupSeparator);return s&&(s=e.exponentMarker?e.exponentMarker+s:e.exponentProduct+" 10^{"+s+"}"),i+t+s}t=ls(t)}if("engineering"===e.scientificNotation)if(0===t)i="0";else{const s=Math.abs(t);let a=Math.round(Math.log10(s));a-=a%3,s<1e3&&(a=0);let o=s/Math.pow(10,a);const n=o.toString().match(/^(.*)\.(.*)$/);n&&n[1]&&n[2]&&(o=n[1]+e.decimalMarker+n[2]),e.groupSeparator&&(o=rs(o.toExponential(),e)),a=0===a?"":e.exponentMarker?e.exponentMarker+a:e.exponentProduct+" 10^{"+a+"}",i=(t<0?"-":"")+o+a}else{const s="string"==typeof t?t:t.toString();let a,o,n,r=s.match(/^(.*)[e|E]([-+]?[0-9]*)$/i);a=s,n="",r&&r[1]&&r[2]&&(a=r[1],o=e.exponentMarker?e.exponentMarker+r[2]:e.exponentProduct+" 10^{"+r[2]+"}"),r=a.match(/^(.*)\.(.*)$/),r&&r[1]&&r[2]&&(a=r[1],n=r[2]),e.groupSeparator&&(a=a.replace(/\B(?=(\d{3})+(?!\d))/g,e.groupSeparator),n=rs(n,e)),n&&(n=e.decimalMarker+n),i=a+n+(o||"")}return i}Yt.MathAtom.prototype.toAST=function(t){let e,i,s,a,o={},r="",l={bb:"double-struck",cal:"script",scr:"script",frak:"fraktur",cmrss:"sans-serif",cmrtt:"monospace"}[this.baseFontFamily||this.fontFamily],c="";"b"===this.fontSeries&&(c+="bold"),"it"===this.fontShape&&(c+="italic");const h=this.latex?this.latex.trim():null;switch(this.type){case"root":case"group":this.latex&&this.latex.startsWith("\\nicefrac")?(e=this.latex.slice(9).match(/({.*}|[^}])({.*}|[^}])/),e?(i=1===e[1].length?e[1]:e[1].substr(1,e[1].length-2),i=le.parseTokens(n(i),"math",null,t.macros),s=1===e[2].length?e[2]:e[2].substr(1,e[2].length-2),s=le.parseTokens(n(s),"math",null,t.macros),o=Gi("divide",os(i,t),os(s,t))):o.fn="divide"):o.group=os(this.body,t);break;case"genfrac":o=Gi("divide",os(this.numer,t),this.denom&&this.denom[0]&&"placeholder"===this.denom[0].type?Zi(1):os(this.denom,t));break;case"surd":o=this.index?Gi("pow",os(this.body,t),Gi("divide",1,os(this.index,t))):Gi("sqrt",os(this.body,t));break;case"rule":break;case"line":case"overlap":case"accent":case"overunder":break;case"mord":case"textord":case"mbin":e=h?h.match(/[{]?\\char"([0-9abcdefABCDEF]*)[}]?/):void 0,e?r=String.fromCodePoint(parseInt(e[1],16)):(r=zi(Ri(this)),r.length>0&&"\\"===r.charAt(0)&&"string"==typeof this.body&&(r=this.body)),a=wt.mathVariantToUnicode(r,l,c).replace(/[\\]/g,"\\\\").replace(/["]/g,'\\"').replace(/[\b]/g,"\\b").replace(/[\f]/g,"\\f").replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r").replace(/[\t]/g,"\\t"),a!==r?(o={sym:a},l="normal"):o={sym:r};break;case"minner":case"mop":break;case"box":o=os(this.body,t);break;case"enclose":break;case"array":if("cardinality"===this.env.name)o=Gi("card",os(this.array,t));else if(/array|matrix|pmatrix|bmatrix/.test(this.env.name)){o={fn:"array",args:[]};for(const e of this.array)o.args.push(e.map(e=>os(e,t)))}else if("cases"===this.env.name){o={fn:"cases",args:[]};for(const e of this.array)if(e[0]){const i=[];i.push(os(e[0],t));let s=os(e[1],t);s&&"text"===s.fn&&s.arg&&/^(if|when|for)$/i.test(s.arg[0].trim())&&(s=s.arg.filter(t=>"string"!=typeof t)),i.push(s||{}),o.args.push(i)}}break;case"spacing":case"space":case"mathstyle":break;default:o=void 0}return o&&l&&"normal"!==l&&(o.variant=l),o&&"string"==typeof this.cssClass&&(o.class=this.cssClass),o&&"string"==typeof this.cssId&&(o.id=this.cssId),o},Yt.toAST=function(t,e){return os(t,e)};var hs=function t(e,i){const s=Object.assign({precision:14,decimalMarker:".",groupSeparator:"\\, ",product:"\\cdot ",exponentProduct:"\\cdot ",exponentMarker:"",arcSeparator:"\\,",scientificNotation:"auto",beginRepeatingDigits:"\\overline{",endRepeatingDigits:"}"},i);let a="";if(void 0===e)return"";if("string"==typeof e&&(e=JSON.parse(e)),e.latex)a=e.latex;else if($i(e)){const i=Ni(e);if(i===-1/0)a="-\\infty ";else if(i===1/0)a="\\infty ";else if("object"!=typeof e.num||"string"!=typeof e.num.re&&"string"!=typeof e.num.im)a=isNaN(i)?"\\text{NaN}":cs(e.num,s);else{const t=Wi(e),i=Hi(e);isNaN(t)||isNaN(i)?a="\\text{NaN}":Math.abs(i)<=Number.EPSILON&&Math.abs(t)<=Number.EPSILON?a="0":(Math.abs(t)>Number.EPSILON&&(a=cs(t,s)),Math.abs(i)>Number.EPSILON&&(Math.abs(t)>Number.EPSILON&&(a+=i>0?"+":""),a+=(1!==Math.abs(i)?cs(i,s):"")+"\\imaginaryI "))}Vi(e)&&(a+="^{"+t(e.sup,s)+"}"),Ui(e)&&(a+="_{"+t(e.sub,s)+"}")}else if(e.group)a=t(e.group,s),$i(e.group)||Ki(e.group)?0!==Hi(e.group)&&(a=ns(e.fence||"(),",a)):a=ns(e.fence||"(),",a),Vi(e)&&(a+="^{"+t(e.sup,s)+"}"),Ui(e)&&(a+="_{"+t(e.sub,s)+"}");else if(e.fn)if("bind"===e.fn){if(a=t(Ti(e,0),s)+"|_{",e.arg&&2===e.arg.length)a+=t(Ti(e,1));else{let i="";for(let s=1;s=2)a=t(Ti(e,0),s),$i(Ti(e,0))||Ki(Ti(e,0))||(a=ns(e.fence||"(),",a)),a+="^{"+t(Ti(e,1),s)+"}";else if("equal"===e.fn&&e.arg&&e.arg.length>2)a=e.arg.map(e=>t(e,s)).join(" = ");else{const i=function(t){let e=Ci[t];return e||(e=t.length>1?"\\operatorname{"+t+"}%^%_ %":t+"%^%_ %"),e}(e.fn);a=i;let o="";if(/%(?![01_^])/.test(i)&&Array.isArray(e.arg)&&e.arg.length>1)a+=ns(e.fence||"(),",...e.arg.map(e=>t(e,s)));else if(Array.isArray(e.arg)&&e.arg.length>0){const n=t(Ti(e,0),s),r=t(Ti(e,1),s),l=[...e.arg];/%0/.test(i)&&(a=a.replace("%0",n),l.shift()),/%1/.test(i)&&(a=a.replace("%1",r),l.shift()),l.length>0&&(o=ns(e.fence||"(),",...l.map(e=>t(e,s))))}else o=ns(e.fence||"(),","");a=Vi(e)?a.replace("%^","^{"+t(e.sup,s)+"}"):a.replace("%^",""),a=Ui(e)?a.replace("%_","_{"+t(e.sub,s)+"}"):a.replace("%_",""),a=a.replace(/%(?![01_^])/,o),a=a.replace("%0","").replace("%1","")}else{const i=[];for(const a of e.arg)"add"===a.fn||"subtract"===a.fn?i.push(ns("() ",t(a,s))):0!==Wi(o=a)&&0!==Hi(o)?i.push(ns("() ",t(a,s))):Vi(e)&&0!==Hi(a)&&1!==Hi(a)?i.push(ns("() ",t(a,s))):i.push(t(a,s));if("multiply"===e.fn)a=!e.arg||2!==e.arg.length||!$i(e.arg[0])&&"divide"!==e.arg[0].fn||$i(e.arg[1])&&(0!==Wi(e.arg[1])||1!==Hi(e.arg[1]))?i.join(" \\times "):i[0]+i[1];else if(e.arg&&1===e.arg.length)a="negate"===e.arg[0].fn||$i(e.arg[0])&&Ni(e.arg[0])<0?i[0]:"+"+i[0];else{a=i[0];for(let t=1;ta',A:'capital A',"+":"plus ","-":"minus ",";":' semi-colon ',",":' comma ',"|":'Vertical bar',"(":'Open paren. ',")":' Close paren. ',"=":"equals ","<":"is less than ","\\lt":"is less than ","<=":"is less than or equal to ","\\le":"is less than or equal to ","\\gt":"is greater than ",">":"is greater than ","\\ge":"is greater than or equal to ","\\geq":"is greater than or equal to ","\\leq":"is less than or equal to ","!":"factorial ","\\sin":"sine ","\\cos":"cosine ","​":"","−":"minus ",":":' such that ',"\\colon":' such that ',"\\hbar":"etch bar ","\\iff":'if, and only if, ',"\\Longleftrightarrow":'if, and only if, ',"\\land":"and ","\\lor":"or ","\\neg":"not ","\\div":"divided by ","\\forall":"for all ","\\exists":"there exists ","\\nexists":"there does not exists ","\\in":"element of ","\\N":'the set n',"\\C":'the set c',"\\Z":'the set z',"\\Q":'the set q',"\\infty":"infinity ","\\nabla":"nabla ","\\partial":"partial derivative of ","\\cdots":"dot dot dot ","\\Rightarrow":"implies ","\\lbrace":'open brace',"\\{":'open brace',"\\rbrace":'close brace',"\\}":'close brace',"\\langle":'left angle bracket',"\\rangle":'right angle bracket',"\\lfloor":'open floor',"\\rfloor":'close floor',"\\lceil":'open ceiling',"\\rceil":'close ceiling',"\\vert":'vertical bar',"\\mvert":'divides',"\\lvert":'left vertical bar',"\\rvert":'right vertical bar',"\\lbrack":' open square bracket ',"\\rbrack":' close square bracket ',mm:"millimeters",cm:"centimeters",km:"kilometers",kg:"kilograms"};function ps(t){let e=0;if(t&&Array.isArray(t))for(const i of t)"first"!==i.type&&(e+=1);return 1===e}function ms(t){let e="";if(t&&Array.isArray(t))for(const i of t)"first"!==i.type&&"string"==typeof i.body&&(e+=i.body);return e}function us(t,e,i,s){e=e.split(" ");for(const a of e){const e=a.match(/(.*):(.*)/);if(e){const a=s||{};"active"===e[2]?a.passive=!1:a[e[2]]=!0,t.addEventListener(e[1],i,a)}else t.addEventListener(a,i,s)}}function fs(t,e,i,s){e=e.split(" ");for(const a of e){const e=a.match(/(.*):(.*)/);if(e){const a=s||{};"active"===e[2]?a.passive=!1:a[e[2]]=!0,t.removeEventListener(e[1],i,a)}else t.removeEventListener(a,i,s)}}function gs(t,e){let i=document.getElementById(t);return i?i.setAttribute("data-refcount",parseInt(i.getAttribute("data-refcount"))+1):(i=document.createElement("div"),i.setAttribute("aria-hidden","true"),i.setAttribute("data-refcount","1"),i.className=e,i.id=t,document.body.appendChild(i)),i}function ys(t){if(!t)return null;const e=parseInt(t.getAttribute("data-refcount"));return e&&1!==e?t.setAttribute("data-refcount",e-1):t.remove(),t}function bs(t){return t.element&&t.element.mathfield===t}Yt.toSpeakableFragment=function(t,e){function i(t){return""+t+""}if(!t)return"";let s="";if(t.id&&"math"===e.speechMode&&(s+=''),Array.isArray(t)){let a=!1,o=!1;for(let n=0;n'+o+'. End fraction.';break;case"surd":if(n=Yt.toSpeakableFragment(t.body,e),t.index){let i=Yt.toSpeakableFragment(t.index,e);i=i.trim();const a=i.replace(//g,"");s+="3"===a?' the cube root of '+n+'. End cube root':"n"===a?' the nth root of '+n+'. End root':' the root with index: '+i+', of '+n+'. End root'}else ps(t.body)?s+=" the square root of "+n+" , ":s+=' the square root of '+n+'. End square root';break;case"accent":break;case"leftright":s+=ds[t.leftDelim]||t.leftDelim,s+=Yt.toSpeakableFragment(t.body,e),s+=ds[t.rightDelim]||t.rightDelim;break;case"line":case"rule":case"overunder":case"overlap":break;case"placeholder":s+="placeholder "+t.body;break;case"delim":case"sizeddelim":case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":case"textord":{const i=t.latex?t.latex.trim():"";if("\\mathbin"===i||"\\mathrel"===i||"\\mathopen"===i||"\\mathclose"===i||"\\mathpunct"===i||"\\mathord"===i||"\\mathinner"===i){s=Yt.toSpeakableFragment(t.body,e);break}let a=t.body,o=t.latex;if("delim"!==t.type&&"sizeddelim"!==t.type||(a=o=t.delim),"text"===e.speechMode)s+=a;else{if("mbin"===t.type&&(s+=''),a){const t=ds[a]||(o?ds[o.trim()]:"");if(t)s+=" "+t;else{const t=o?function(t){let e=Ze.NOTES[t];return e||"\\"!==t.charAt(0)||(e=" "+t.replace("\\","")+" "),Array.isArray(e)&&(e=e[0]),e}(o.trim()):"";s+=t||function(t){let i="";return e.textToSpeechMarkup?/[a-z]/.test(t)?i+=' '+t+"":/[A-Z]/.test(t)?i+="capital "+t.toLowerCase():i+=t:/[a-z]/.test(t)?i+=" '"+t.toUpperCase()+"'":/[A-Z]/.test(t)?i+=" 'capital "+t.toUpperCase()+"'":i+=t,i}(a)}}else s+=Yt.toSpeakableFragment(t.body,e);"mbin"===t.type&&(s+='')}break}case"mop":if("​"!==t.body){const a=t.latex?t.latex.trim():"";if("\\sum"===a)if(t.superscript&&t.subscript){let i=Yt.toSpeakableFragment(t.superscript,e);i=i.trim();let a=Yt.toSpeakableFragment(t.subscript,e);a=a.trim(),s+=' the summation from '+a+' to '+i+' of ',r=!0}else if(t.subscript){let i=Yt.toSpeakableFragment(t.subscript,e);i=i.trim(),s+=' the summation from '+i+' of ',r=!0}else s+=" the summation of";else if("\\prod"===a)if(t.superscript&&t.subscript){let i=Yt.toSpeakableFragment(t.superscript,e);i=i.trim();let a=Yt.toSpeakableFragment(t.subscript,e);a=a.trim(),s+=' the product from '+a+' to '+i+' of ',r=!0}else if(t.subscript){let i=Yt.toSpeakableFragment(t.subscript,e);i=i.trim(),s+=' the product from '+i+' of ',r=!0}else s+=" the product of ";else if("\\int"===a)if(t.superscript&&t.subscript){let a=Yt.toSpeakableFragment(t.superscript,e);a=a.trim();let o=Yt.toSpeakableFragment(t.subscript,e);o=o.trim(),s+=' the integral from '+i(o)+' to '+i(a)+' of ',r=!0}else s+=' the integral of ';else if("string"==typeof t.body){s+=ds[t.body]||ds[t.latex.trim()]||" "+t.body}else t.latex&&t.latex.length>0&&("\\"===t.latex[0]?s+=" "+t.latex.substr(1):s+=" "+t.latex)}break;case"enclose":n=Yt.toSpeakableFragment(t.body,e),ps(t.body)?s+=" crossed out "+n+" , ":s+=" crossed out "+n+". End cross out"}if(!r&&t.superscript){let i=Yt.toSpeakableFragment(t.superscript,e);i=i.trim();const a=i.replace(/<[^>]*>/g,"");if(ps(t.superscript)){if("math"===e.speechMode){const e=function(t){if(t&&Array.isArray(t))for(const e of t)if("first"!==e.type&&e.id)return e.id.toString();return""}(t.superscript);e&&(s+='')}"′"===a?s+=" prime ":"2"===a?s+=" squared ":"3"===a?s+=" cubed ":isNaN(parseInt(a))?s+=" to the "+i+"; ":s+=' to the '+a+" power; "}else isNaN(parseInt(a))?s+=" raised to the "+i+"; ":s+=' raised to the '+a+" power; "}if(!r&&t.subscript){let i=Yt.toSpeakableFragment(t.subscript,e);i=i.trim(),ps(t.subscript)?s+=" sub "+i:s+=" subscript "+i+". End subscript. "}}return s},Yt.toSpeakableText=function(t,e){const i=e?JSON.parse(JSON.stringify(e)):{textToSpeechMarkup:"",textToSpeechRules:"mathlive"};if(i.speechMode="math",window.sre&&"sre"===i.textToSpeechRules){i.generateID=!0;const e=Yt.toMathML(t,i);return e?(i.textToSpeechMarkup&&(i.textToSpeechRulesOptions=i.textToSpeechRulesOptions||{},i.textToSpeechRulesOptions.markup=i.textToSpeechMarkup,"ssml"===i.textToSpeechRulesOptions.markup&&(i.textToSpeechRulesOptions.markup="ssml_step"),i.textToSpeechRulesOptions.rate=i.speechEngineRate),i.textToSpeechRulesOptions&&window.sre.System.getInstance().setupEngine(i.textToSpeechRulesOptions),window.sre.System.getInstance().toSpeech(e)):""}let s=Yt.toSpeakableFragment(t,i);if("ssml"===i.textToSpeechMarkup){let t="";i.speechEngineRate&&(t=''),s=''+t+"

    "+s+"

    "+(t?"
    ":"")+""}else s="mac"===i.textToSpeechMarkup&&"mac"===function(t){let e="other";return navigator&&navigator.platform&&navigator.userAgent&&(/^(mac)/i.test(navigator.platform)?e="mac":/^(win)/i.test(navigator.platform)?e="win":/(android)/i.test(navigator.userAgent)?e="android":/(iphone)/i.test(navigator.userAgent)||/(ipod)/i.test(navigator.userAgent)||/(ipad)/i.test(navigator.userAgent)?e="ios":/\bCrOS\b/i.test(navigator.userAgent)&&(e="chromeos")),e===t?t:"!"+t}("mac")?s.replace(//g,"").replace(//g,"[[emph+]]").replace(/<\/emphasis>/g,"").replace(//g,"[[slc $1]]").replace(/]*>/g,"").replace(/<\/say-as>/g,""):s.replace(/<[^>]*>/g,"").replace(/\s{2,}/g," ");return s};class xs{constructor(t,e){this.$setConfig(e||{}),this.element=t,t.mathfield=this,this.originalContent=t.innerHTML;let i=this.element.textContent;i&&(i=i.trim());let s="";this.config.substituteTextArea?"string"==typeof this.config.substituteTextArea?s+=this.config.substituteTextArea:s+="":/android|ipad|ipod|iphone/i.test(navigator.userAgent)?s+="\n \n \n ":s+='',s+='',this.config.virtualKeyboardMode||(this.config.virtualKeyboardMode=window.matchMedia&&window.matchMedia("(any-pointer: coarse)").matches?"onfocus":"off"),"manual"===this.config.virtualKeyboardMode?(s+=`"):s+="",s+="",s+='\n
    \n \n \n
    \n ',this.element.innerHTML=s;let a=0;"function"==typeof this.config.substituteTextArea?this.textarea=this.config.substituteTextArea():this.textarea=this.element.children[a++].firstElementChild,this.field=this.element.children[a].children[0],this.field.addEventListener("wheel",t=>{t.preventDefault(),t.stopPropagation();let e=void 0===t.deltaX?t.detail:-t.deltaX;isFinite(e)||(e=t.wheelDelta/10),this.field.scroll({top:0,left:this.field.scrollLeft-5*e})},{passive:!1}),this.virtualKeyboardToggleDOMNode=this.element.children[a++].children[1],this._attachButtonHandlers(this.virtualKeyboardToggleDOMNode,{default:"toggleVirtualKeyboard",alt:"toggleVirtualKeyboardAlt",shift:"toggleVirtualKeyboardShift"}),this.ariaLiveText=this.element.children[a].children[0],this.accessibleNode=this.element.children[a++].children[1],this.popover=gs("mathlive-popover-panel","ML__popover"),this.keystrokeCaption=gs("mathlive-keystroke-caption-panel","ML__keystroke-caption"),this.keystrokeCaptionVisible=!1,this.virtualKeyboardVisible=!1,this.keystrokeBuffer="",this.keystrokeBufferStates=[],this.keystrokeBufferResetTimer=null,this.suggestionIndex=0,this.mode=e.defaultMode||"math",this.smartModeSuppressed=!1,this.style={},this.blurred=!0,us(this.element,"focus",this),us(this.element,"blur",this),us(this.textarea,"cut",this),us(this.textarea,"copy",this),us(this.textarea,"paste",this),$e.delegateKeyboardEvents(this.textarea,{container:this.element,allowDeadKey:()=>"text"===this.mode,typedText:this._onTypedText.bind(this),paste:this._onPaste.bind(this),keystroke:this._onKeystroke.bind(this),focus:this._onFocus.bind(this),blur:this._onBlur.bind(this)}),window.PointerEvent?us(this.field,"pointerdown",this):us(this.field,"touchstart:active mousedown",this),us(window,"resize",this);const o={...e};o.onSelectionDidChange=xs.prototype._onSelectionDidChange.bind(this),o.onContentDidChange=xs.prototype._onContentDidChange.bind(this),o.onAnnounce=this.config.onAnnounce,o.macros=this.config.macros,o.removeExtraneousParentheses=this.config.removeExtraneousParentheses,this.mathlist=new Ie.EditableMathlist(o,this),this.undoManager=new class{constructor(t){this.mathlist=t,this.maximumDepth=1e3,this.record=!1,this.canCoalesce=!1,this.reset()}reset(){this.stack=[],this.index=-1}startRecording(){this.record=!0}canUndo(){return this.index>0}canRedo(){return this.index!==this.stack.length-1}undo(t){this.canUndo()&&(t&&"function"==typeof t.onUndoStateWillChange&&t.onUndoStateWillChange(this.mathlist.target,"undo"),this.restore(this.stack[this.index-1],t),this.index-=1,t&&"function"==typeof t.onUndoStateDidChange&&t.onUndoStateDidChange(this.mathlist.target,"undo"),this.canCoalesce=!1)}redo(t){this.canRedo()&&(t&&"function"===t.onUndoStateWillChange&&t.onUndoStateWillChange(this.mathlist.target,"redo"),this.index+=1,this.restore(this.stack[this.index],t),t&&"function"==typeof t.onUndoStateDidChange&&t.onUndoStateDidChange(this.mathlist.target,"redo"),this.canCoalesce=!1)}pop(){this.canUndo()&&(this.index-=1,this.stack.pop())}snapshot(t){this.record&&(t&&"function"===t.onUndoStateWillChange&&t.onUndoStateWillChange(this.mathlist.target,"snapshot"),this.stack.splice(this.index+1,this.stack.length-this.index-1),this.stack.push({latex:this.mathlist.root.toLatex(),selection:this.mathlist.toString()}),this.index++,this.stack.length>this.maximumDepth&&this.stack.shift(),t&&"function"==typeof t.onUndoStateDidChange&&t.onUndoStateDidChange(this.mathlist.target,"snapshot"),this.canCoalesce=!1)}snapshotAndCoalesce(t){this.canCoalesce&&this.pop(),this.snapshot(t),this.canCoalesce=!0}save(){return{latex:this.mathlist.root.toLatex(),selection:this.mathlist.toString()}}restore(t,e){const i=this.mathlist.suppressChangeNotifications;void 0!==e.suppressChangeNotifications&&(this.mathlist.suppressChangeNotifications=e.suppressChangeNotifications),this.mathlist.insert(t?t.latex:"",{mode:"math",insertionMode:"replaceAll",selectionMode:"after",format:"latex",...e}),this.mathlist.setPath(t?t.selection:[{relation:"body",offset:0}]),this.mathlist.suppressChangeNotifications=i}}(this.mathlist),i.length>0&&this.$latex(i),this.undoManager.startRecording(),this.undoManager.snapshot(this.config)}handleEvent(t){switch(t.type){case"focus":this._onFocus(t);break;case"blur":this._onBlur(t);break;case"touchstart":case"mousedown":case"pointerdown":this._onPointerDown(t);break;case"resize":this._resizeTimer&&window.cancelAnimationFrame(this._resizeTimer),this._resizeTimer=window.requestAnimationFrame(()=>bs(this)&&this._onResize());break;case"cut":this._onCut(t);break;case"copy":this._onCopy(t);break;case"paste":this._onPaste(t)}}$revertToOriginalContent(){this.element.innerHTML=this.originalContent,this.element.mathfield=null,delete this.accessibleNode,delete this.ariaLiveText,delete this.field,fs(this.textarea,"cut",this),fs(this.textarea,"copy",this),fs(this.textarea,"paste",this),this.textarea.remove(),delete this.textarea,this.virtualKeyboardToggleDOMNode.remove(),delete this.virtualKeyboardToggleDOMNode,ys(this.popover),ys(this.keystrokeCaption),ys(this.virtualKeyboard),ys(document.getElementById("mathlive-alternate-keys-panel")),fs(this.element,"pointerdown",this),fs(this.element,"touchstart:active mousedown",this),fs(this.element,"focus",this),fs(this.element,"blur",this),fs(window,"resize",this),delete this.element}_resetKeystrokeBuffer(){this.keystrokeBuffer="",this.keystrokeBufferStates=[],clearTimeout(this.keystrokeBufferResetTimer)}_getCaretPosition(){const t=function t(e){if(e.classList.contains("ML__caret")||e.classList.contains("ML__text-caret")||e.classList.contains("ML__command-caret"))return e;let i;return Array.from(e.children).forEach((function(e){i=i||t(e)})),i}(this.field);if(t){const e=t.getBoundingClientRect();return{x:e.right,y:e.bottom,height:e.height}}return null}_getSelectionBounds(){const t=this.field.querySelectorAll(".ML__selected");if(t&&t.length>0){const e={top:1/0,bottom:-1/0,left:1/0,right:-1/0};t.forEach(t=>{const i=t.getBoundingClientRect();i.lefte.right&&(e.right=i.right),i.bottom>e.bottom&&(e.bottom=i.bottom),i.top=t.left&&i<=t.right}return o&&e.children&&Array.from(e.children).forEach((function(e){const o=t(e,i,s);o.element&&o.distance<=a.distance&&(a=o)})),a}(this.field,t,e).element,o=a?a.getAttribute("data-atom-id"):null;if(o){const e=this.mathlist.filter((function(t,e){return e.captureSelection?e.filter(t=>t.id===o).length>0:e.id===o}));if(e&&e.length>0)if(s=de.pathFromString(e[0]).path,0===i.bias){const e=a.getBoundingClientRect();tt.parentNode.removeChild(t)),t.preventDefault(),t.stopPropagation()}let r=!1,l=!1;const c=setInterval(()=>{r?e.field.scroll({top:0,left:e.field.scrollLeft-16}):l&&e.field.scroll({top:0,left:e.field.scrollLeft+16})},32);function h(t){const s=t.touches?t.touches[0].clientX:t.clientX,o=t.touches?t.touches[0].clientY:t.clientY,n="touch"===t.pointerType?20:5;if(Date.now()c.right,r=s=u.left&&d<=u.right&&p>=u.top&&p<=u.bottom){if(this.$hasFocus()||(o=!0,this.textarea.focus&&this.textarea.focus()),this._resetKeystrokeBuffer(),this.smartModeSuppressed=!1,i=this._pathFromPoint(d,p,{bias:0}),i){let r=document.createElement("div");r.className="ML__scroller",this.element.appendChild(r),r.style.left=u.left-200+"px",r=document.createElement("div"),r.className="ML__scroller",this.element.appendChild(r),r.style.left=u.right+"px",t.shiftKey?(this.mathlist.setRange(this.mathlist.path,i),i=de.clone(this.mathlist.path),i[i.length-1].offset-=1):this.mathlist.setPath(i,0),o=!0,this.style={},3===t.detail||vs>2?(n(t),3!==t.detail&&3!==vs||this.mathlist.selectAll_()):s||(s=!0,window.PointerEvent?(us(e.field,"pointermove",h),us(e.field,"pointerend pointercancel pointerup",n),e.field.setPointerCapture(t.pointerId)):(us(window,"blur",n),t.touches?(us(t.target,"touchmove",h),us(t.target,"touchend",n)):(us(window,"mousemove",h),us(window,"mouseup",n))),2!==t.detail&&2!==vs||(a=!0,this.mathlist.selectGroup_()))}}else ks=null;o&&this._requestUpdate(),t.preventDefault()}_onSelectionDidChange(){this.mathlist.commitCommandStringBeforeInsertionPoint();let t="";this.mathlist.forEachSelected(e=>{t+=e.toLatex()}),t?(this.textarea.value=t,this.$hasFocus()&&this.textarea.select&&this.textarea.select()):(this.textarea.value="",this.textarea.setAttribute("aria-label",""));{const t=this.mode;this.mode=this.mathlist.anchorMode()||this.config.defaultMode,this.mode!==t&&"function"==typeof this.config.onModeChange&&this.config.onModeChange(this,this.mode),"command"===t&&"command"!==this.mode&&(Ze.hidePopover(this),this.mathlist.removeCommandString())}Ze.updatePopoverPosition(this,{deferred:!0}),"function"==typeof this.config.onSelectionDidChange&&this.config.onSelectionDidChange(this)}_onContentDidChange(){this.undoManager.canRedo()?this.element.classList.add("can-redo"):this.element.classList.remove("can-redo"),this.undoManager.canUndo()?this.element.classList.add("can-undo"):this.element.classList.remove("can-undo"),"function"==typeof this.config.onContentDidChange&&this.config.onContentDidChange(this)}_nextAtomSpeechText(t){function e(t,e){return"body"===e.relation?{enclose:"cross out",leftright:"fence",surd:"square root",root:"math field"}[t.type]:{numer:"numerator",denom:"denominator",index:"index",body:"parent",subscript:"subscript",superscript:"superscript"}[e.relation]}const i=t?t.path:[],s=this.mathlist.path,a=s[s.length-1];let o="";for(;i.length>s.length;)o+="out of "+e(t.parent(),i[i.length-1])+"; ",i.pop();if(!this.mathlist.isCollapsed())return ws(this,"",this.mathlist.getSelectedAtoms());const n=e(this.mathlist.parent(),a);0===a.offset&&(o+=(n?"start of "+n:"unknown")+": ");const r=this.mathlist.sibling(Math.max(1,this.mathlist.extent));return r?o+=ws(this,"",r):0!==a.offset&&(o+=n?"end of "+n:"unknown"),o}_announce(t,e,i){"function"==typeof this.config.onAnnounce&&this.config.onAnnounce(this,t,e,i)}_onFocus(){this.blurred&&(this.blurred=!1,this.textarea.focus&&this.textarea.focus(),"onfocus"===this.config.virtualKeyboardMode&&this.showVirtualKeyboard_(),Ze.updatePopoverPosition(this),this.config.onFocus&&this.config.onFocus(this),this._requestUpdate())}_onBlur(){this.blurred||(this.blurred=!0,this.ariaLiveText.textContent="","onfocus"===this.config.virtualKeyboardMode&&this.hideVirtualKeyboard_(),this.complete_({discard:!0}),this._requestUpdate(),this.config.onBlur&&this.config.onBlur(this))}_onResize(){this.element.classList.remove("ML__isNarrowWidth","ML__isWideWidth","ML__isExtendedWidth"),window.innerWidth>=1024?this.element.classList.add("ML__isExtendedWidth"):window.innerWidth>=768?this.element.classList.add("ML__isWideWidth"):this.element.classList.add("ML__isNarrowWidth"),Ze.updatePopoverPosition(this)}toggleKeystrokeCaption_(){this.keystrokeCaptionVisible=!this.keystrokeCaptionVisible,this.keystrokeCaption.innerHTML="",this.keystrokeCaptionVisible||(this.keystrokeCaption.style.visibility="hidden")}_showKeystroke(t){const e=this.keystrokeCaption;if(e&&this.keystrokeCaptionVisible){const i=this.element.getBoundingClientRect();e.style.left=i.left+"px",e.style.top=i.top-64+"px",e.innerHTML=""+(xe.stringify(t)||t)+""+e.innerHTML,e.style.visibility="visible",setTimeout((function(){e.childNodes.length>0&&e.removeChild(e.childNodes[e.childNodes.length-1]),0===e.childNodes.length&&(e.style.visibility="hidden")}),3e3)}}$perform(t){if(!t)return!1;let e,i=!1,s=[],a=!1;if(Array.isArray(t)?(e=t[0],s=t.slice(1)):e=t,e=e.replace(/-\w/g,t=>t[1].toUpperCase()),e+="_","function"==typeof this.mathlist[e]){if(/^(delete|transpose|add)/.test(e)&&this._resetKeystrokeBuffer(),/^(delete|transpose|add)/.test(e)&&"command"!==this.mode&&(this.undoManager.pop(),this.undoManager.snapshot(this.config)),this.mathlist[e](...s),/^(delete|transpose|add)/.test(e)&&"command"!==this.mode&&this.undoManager.snapshot(this.config),/^(delete)/.test(e)&&"command"===this.mode){const t=this.mathlist.extractCommandStringAroundInsertionPoint(),e=wt.suggest(t);0===e.length?Ze.hidePopover(this):Ze.showPopoverWithLatex(this,e[0].match,e.length>1)}a=!0,i=!0}else"function"==typeof this[e]&&(a=this[e](...s),i=!0);return this.mathlist.isCollapsed()&&!/^(transpose|paste|complete|((moveToNextChar|moveToPreviousChar|extend).*))_$/.test(e)||(this._resetKeystrokeBuffer(),this.style={}),a&&this._requestUpdate(),i}performWithFeedback_(t){return this.$focus(),this.config.keypressVibration&&navigator.vibrate&&navigator.vibrate(3),"moveToNextPlaceholder"===(t=t.replace(/-\w/g,t=>t[1].toUpperCase()))||"moveToPreviousPlaceholder"===t||"complete"===t?this.returnKeypressSound?(this.returnKeypressSound.load(),this.returnKeypressSound.play().catch(t=>{})):this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play().catch(t=>{})):"deletePreviousChar"!==t&&"deleteNextChar"!==t&&"deletePreviousWord"!==t&&"deleteNextWord"!==t&&"deleteToGroupStart"!==t&&"deleteToGroupEnd"!==t&&"deleteToMathFieldStart"!==t&&"deleteToMathFieldEnd"!==t||!this.deleteKeypressSound?this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play().catch(t=>{})):(this.deleteKeypressSound.load(),this.deleteKeypressSound.play().catch(t=>{})),this.$perform(t)}convertLastAtomsToText_(t,e){"function"==typeof t&&(e=t,t=1/0),void 0===t&&(t=1/0);let i=0,s=!1;for(this.mathlist.contentWillChange();!s;){const a=this.mathlist.sibling(i);s=0===t||!a||"math"!==a.mode||!(/mord|textord|mpunct/.test(a.type)||"mop"===a.type&&/[a-zA-Z]+/.test(a.body))||a.superscript||a.subscript||e&&!e(a),s||(a.applyStyle({mode:"text"}),a.latex=a.body),i-=1,t-=1}this.mathlist.contentDidChange()}convertLastAtomsToMath_(t,e){"function"==typeof t&&(e=t,t=1/0),void 0===t&&(t=1/0),this.mathlist.contentWillChange();let i=0,s=!1;for(;!s;){const a=this.mathlist.sibling(i);s=0===t||!a||"text"!==a.mode||" "===a.body||e&&!e(a),s||a.applyStyle({mode:"math",type:"mord"}),i-=1,t-=1}this.removeIsolatedSpace_(),this.mathlist.contentDidChange()}removeIsolatedSpace_(){let t=0;for(;this.mathlist.sibling(t)&&"math"===this.mathlist.sibling(t).mode;)t-=1;if(this.mathlist.sibling(t)&&"text"===this.mathlist.sibling(t).mode&&" "===this.mathlist.sibling(t).body&&(!this.mathlist.sibling(t-1)||"math"===this.mathlist.sibling(t-1).mode)){this.mathlist.contentWillChange(),this.mathlist.siblings().splice(t-1,1),this.mathlist.contentDidChange();const e=this.mathlist.suppressChangeNotifications;this.mathlist.suppressChangeNotifications=!0,this.mathlist.setSelection(this.mathlist.anchorOffset()-1),this.mathlist.suppressChangeNotifications=e}}getTextBeforeAnchor_(){let t="",e=0,i=!1;for(;!i;){const s=this.mathlist.sibling(e);i=!(s&&("text"===s.mode&&!s.type||"math"===s.mode&&/mord|textord|mpunct/.test(s.type))),i||(t=s.body+t),e-=1}return t}smartMode_(t,e){if(this.smartModeSuppressed)return!1;if(this.mathlist.endOffset()1)return!1;if(!this.mathlist.isCollapsed())return!("text"!==this.mode||!/[/_^]/.test(i));const s=this.getTextBeforeAnchor_()+i;if("text"===this.mode){if("Esc"===t||/[/\\]/.test(i))return!0;if(/[\^_]/.test(i))return/(^|\s)[a-zA-Z][^_]$/.test(s)&&this.convertLastAtomsToMath_(1),!0;const e={")":"(","}":"{","]":"["}[i];if(e&&this.mathlist.parent()&&"leftright"===this.mathlist.parent().type&&this.mathlist.parent().leftDelim===e)return!0;if(/(^|[^a-zA-Z])(a|I)[ ]$/.test(s))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(i))return!0;if(/(^|[^a-zA-Z'’])[a-zA-Z][ ]$/.test(s))return this.convertLastAtomsToMath_(1),!1;if(/[^0-9]\.[^0-9\s]$/.test(s)){this.convertLastAtomsToMath_(1);const t=this.mathlist.sibling(0);return t.body="⋅",t.autoFontFamily="cmr",t.latex="\\cdot",!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(s))return this.convertLastAtomsToMath_(1),!0;if(/\.[0-9]$/.test(s))return this.convertLastAtomsToMath_(1),!0;if(/[(][0-9+\-.]$/.test(s))return this.convertLastAtomsToMath_(1),!0;if(/[(][a-z][,;]$/.test(s))return this.convertLastAtomsToMath_(2),!0;if(/[0-9+\-=><*|]$/.test(i))return this.removeIsolatedSpace_(),!0}else{if("Spacebar"===t)return this.convertLastAtomsToText_(t=>/[a-z][:,;.]$/.test(t.body)),!0;if(/[a-zA-Z]{3,}$/.test(s)&&!/(dxd|abc|xyz|uvw)$/.test(s))return this.convertLastAtomsToText_(t=>/[a-zA-Z:,;.]/.test(t.body)),!0;if(/(^|\W)(if|If)$/i.test(s))return this.convertLastAtomsToText_(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 this.convertLastAtomsToText_(t=>/(:|,|;|.|\u0393|\u0394|\u0398|\u039b|\u039E|\u03A0|\u03A3|\u03a5|\u03a6|\u03a8|\u03a9|[\u03b1-\u03c9]|\u03d1|\u03d5|\u03d6|\u03f1|\u03f5)/u.test(t.body)),!0;if(/\?|\./.test(i))return!0}return!1}_onKeystroke(t,e){if(this._showKeystroke(t),clearTimeout(this.keystrokeBufferResetTimer),this.config.onKeystroke&&!this.config.onKeystroke(this,t,e))return e&&e.preventDefault&&(e.preventDefault(),e.stopPropagation()),!1;let i,s,a,o=!1;if("command"!==this.mode&&(!e||!e.ctrlKey&&!e.metaKey)){const t=$e.eventToChar(e);if("Backspace"!==t)if(!t||t.length>1)this._resetKeystrokeBuffer();else{const e=this.keystrokeBuffer+t;let a=0;for(;!i&&a{this._resetKeystrokeBuffer()},this.config.inlineShortcutTimeout))}}if(this.config.smartMode){const s=this.mode;i?this.mode="math":this.smartMode_(t,e)&&(this.mode={math:"text",text:"math"}[this.mode],a=""),this.mode!==s&&"function"==typeof this.config.onModeChange&&this.config.onModeChange(this,this.mode)}if(i||a||(a=xe.selectorForKeystroke(this.mode,t)),!i&&!a)return!0;this.mathlist.decorateCommandStringAroundInsertionPoint(!1);const r=this.mathlist.parent();if("moveAfterParent"===a&&r&&"leftright"===r.type&&this.mathlist.endOffset()===this.mathlist.siblings().length-1&&this.config.smartFence&&this.mathlist._insertSmartFence(".")&&(a="",this._requestUpdate()),"math"===this.mode&&"Spacebar"===t&&!i){const t=this.mathlist.sibling(1),e=this.mathlist.sibling(-1);(t&&"text"===t.mode||e&&"text"===e.mode)&&this.mathlist.insert(" ",{mode:"text"})}if((a&&!this.$perform(a)||i)&&i){if(!/^(\\{|\\}|\\[|\\]|\\@|\\#|\\$|\\%|\\^|\\_|\\backslash)$/.test(i)){const t={...this.mathlist.anchorStyle(),...this.style};this.mathlist.insert($e.eventToChar(e),{suppressChangeNotifications:!0,mode:this.mode,style:t});const i=this.mode;this.undoManager.snapshotAndCoalesce(this.config),this.undoManager.restore(this.keystrokeBufferStates[s],{...this.config,suppressChangeNotifications:!0}),this.mode=i}this.mathlist.contentWillChange();const t=this.mathlist.suppressChangeNotifications;this.mathlist.suppressChangeNotifications=!0;const a={...this.mathlist.anchorStyle(),...this.style};this.mathlist.insert(i,{format:"latex",mode:this.mode,style:a,smartFence:!0}),this.removeIsolatedSpace_(),i.endsWith(" ")&&(this.mode="text",this.mathlist.insert(" ",{mode:"text",style:a})),this.mathlist.suppressChangeNotifications=t,this.mathlist.contentDidChange(),this.undoManager.snapshot(this.config),this._requestUpdate(),this._announce("replacement"),o&&this._resetKeystrokeBuffer()}return this.scrollIntoView(),e&&e.preventDefault&&(e.preventDefault(),e.stopPropagation()),!1}_onTypedText(t,e){if((e=e||{}).focus&&this.$focus(),e.feedback&&(this.config.keypressVibration&&navigator.vibrate&&navigator.vibrate(3),this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play().catch(t=>{}))),e.commandMode&&"command"!==this.mode&&this.switchMode_("command"),this.mathlist.decorateCommandStringAroundInsertionPoint(!1),e.simulateKeystroke){const e=t.charAt(0),i=$e.charToEvent(e);if(!this.$keystroke($e.keyboardEventToString(i),i))return}let i="",a=!1;if(this.pasteInProgress)this.pasteInProgress=!1,this.mathlist.insert(t,{smartFence:this.config.smartFence,mode:"math"});else{const e={...this.mathlist.anchorStyle(),...this.style},o=s(t);for(const t of o)if("command"===this.mode){this.mathlist.removeSuggestion(),this.suggestionIndex=0;const e=this.mathlist.extractCommandStringAroundInsertionPoint(),s=wt.suggest(e+t);a=s.length>1,0===s.length?(this.mathlist.insert(t,{mode:"command"}),/^\\[a-zA-Z\\*]+$/.test(e+t)&&this.mathlist.decorateCommandStringAroundInsertionPoint(!0),Ze.hidePopover(this)):(this.mathlist.insert(t,{mode:"command"}),s[0].match!==e+t&&this.mathlist.insertSuggestion(s[0].match,-s[0].match.length+e.length+1),i=s[0].match)}else if("math"===this.mode){const i={"^":"moveToSuperscript",_:"moveToSubscript"," ":"moveAfterParent"}[t];if(i){if("moveToSuperscript"===i){if(this._superscriptDepth()>=this.config.scriptDepth[1])return void this._announce("plonk")}else if("moveToSubscript"===i&&this._subscriptDepth()>=this.config.scriptDepth[0])return void this._announce("plonk");this.$perform(i)}else this.config.smartSuperscript&&"superscript"===this.mathlist.relation()&&/[0-9]/.test(t)&&0===this.mathlist.siblings().filter(t=>"first"!==t.type).length?(this.mathlist.insert(t,{mode:"math",style:e}),this.mathlist.moveAfterParent_()):this.mathlist.insert(t,{mode:"math",style:e,smartFence:this.config.smartFence})}else"text"===this.mode&&this.mathlist.insert(t,{mode:"text",style:e})}"command"!==this.mode&&this.undoManager.snapshotAndCoalesce(this.config),this._requestUpdate(),this.scrollIntoView(),Ze.showPopoverWithLatex(this,i,a)}_hash(){let t=0;const e=this.mathlist.root.toLatex(!1);for(let i=0;ibs(this)&&this._render()))}_render(t){t=t||{},this.dirty=!1,window.mathlive||(window.mathlive={}),this.mathlist.anchor()||(this.mathlist.path=[{relation:"body",offset:0}]),this.mathlist.forEach(t=>{t.caret="",t.isSelected=!1});const e=this.$hasFocus();this.mathlist.isCollapsed()?this.mathlist.anchor().caret=e?this.mode:"":this.mathlist.forEachSelected(t=>{t.isSelected=!0});const i=Yt.decompose({mathstyle:"displaystyle",generateID:{seed:this._hash(),groupNumbers:t.forHighlighting},macros:this.config.macros},this.mathlist.root),s=$.makeSpan(i,"ML__base");s.attributes={translate:"no","aria-hidden":"true"};const a=$.makeSpan("","ML__strut");a.setStyle("height",s.height,"em");const o=[a];if(0!==s.depth){const t=$.makeSpan("","ML__strut--bottom");t.setStyle("height",s.height+s.depth,"em"),t.setStyle("vertical-align",-s.depth,"em"),o.push(t)}o.push(s);const n=$.makeSpan(o,"ML__mathlive");this.field.innerHTML=n.toMarkup(0,this.config.horizontalSpacingScale),this.field.classList.toggle("ML__focused",e),this.accessibleNode.innerHTML=""+Yt.toMathML(this.mathlist.root,this.config)+"";const r=this._getSelectionBounds();if(r){const t=document.createElement("div");t.classList.add("ML__selection"),t.style.position="absolute",t.style.left=r.left+"px",t.style.top=r.top+"px",t.style.width=Math.ceil(r.right-r.left)+"px",t.style.height=Math.ceil(r.bottom-r.top-1)+"px",this.field.insertBefore(t,this.field.childNodes[0])}}_onPaste(){return this.pasteInProgress=!0,!0}_onCut(){return setTimeout(function(){this.$clearSelection(),this._requestUpdate()}.bind(this),0),!0}_onCopy(t){this.mathlist.isCollapsed()?(t.clipboardData.setData("text/plain","$$"+this.$text("latex-expanded")+"$$"),t.clipboardData.setData("application/json",this.$text("json")),t.clipboardData.setData("application/xml",this.$text("mathML"))):(t.clipboardData.setData("text/plain","$$"+this.$selectedText("latex-expanded")+"$$"),t.clipboardData.setData("application/json",this.$selectedText("json")),t.clipboardData.setData("application/xml",this.$selectedText("mathML"))),t.preventDefault()}formatMathlist(t,e){let i="";if("latex"===(e=e||"latex")||"latex-expanded"===e)i=t.toLatex("latex-expanded"===e);else if("mathML"===e)i=t.toMathML(this.config);else if("spoken"===e)i=Yt.toSpeakableText(t,this.config);else if("spoken-text"===e){const e=this.config.textToSpeechMarkup;this.config.textToSpeechMarkup="",i=Yt.toSpeakableText(t,this.config),this.config.textToSpeechMarkup=e}else if("spoken-ssml"===e||"spoken-ssml-withHighlighting"===e){const s=this.config.textToSpeechMarkup,a=this.config.generateID;this.config.textToSpeechMarkup="ssml","spoken-ssml-withHighlighting"===e&&(this.config.generateID=!0),i=Yt.toSpeakableText(t,this.config),this.config.textToSpeechMarkup=s,this.config.generateID=a}else if("json"===e){const e=Yt.toAST(t,this.config);i=JSON.stringify(e)}else"ASCIIMath"===e&&(i=function t(e,i){if(!e)return"";if(Array.isArray(e)){let i="";if(0===e.length)return"";if("first"===e[0].type&&e.shift(),"text"===e[0].mode){let s=0;for(i='"';e[s]&&"text"===e[s].mode;)i+=e[s].body,s++;i+='"'+t(e.slice(s))}else{let s=0;for(;e[s]&&"math"===e[s].mode;)i+=t(e[s]),s++;i+=t(e.slice(s))}return i.trim()}if("text"===e.mode)return'"'+e.body+'"';let s="";const a=e.latex?e.latex.trim():null;let o;switch(e.type){case"group":case"root":s=t(e.body);break;case"array":break;case"genfrac":(e.leftDelim||e.rightDelim)&&(s+="."!==e.leftDelim&&e.leftDelim?e.leftDelim:"{:"),e.hasBarLine?(s+="(",s+=t(e.numer),s+=")/(",s+=t(e.denom),s+=")"):(s+="("+t(e.numer)+"),",s+="("+t(e.denom)+")"),(e.leftDelim||e.rightDelim)&&(s+="."!==e.rightDelim&&e.rightDelim?e.rightDelim:"{:");break;case"surd":e.index?s+="root("+t(e.index)+")("+t(e.body)+")":s+="sqrt("+t(e.body)+")";break;case"leftright":s+="."!==e.leftDelim&&e.leftDelim?e.leftDelim:"{:",s+=t(e.body),s+="."!==e.rightDelim&&e.rightDelim?e.rightDelim:"{:";break;case"sizeddelim":case"delim":case"accent":break;case"line":case"overlap":case"overunder":break;case"mord":s=li[a]||a||("string"==typeof e.body?e.body:""),"\\"===s[0]&&(s+=""),o=a?a.match(/[{]?\\char"([0-9abcdefABCDEF]*)[}]?/):null,o?s=String.fromCharCode(parseInt("0x"+o[1])):s.length>0&&"\\"===s.charAt(0)&&(s="string"==typeof e.body?e.body.charAt(0):e.latex);break;case"mbin":case"mrel":case"textord":case"minner":s=a&&li[a]?li[a]:a&&ci[a]?ci[a]:e.body;break;case"mopen":case"mclose":s+=e.body;break;case"mpunct":s=ci[a]||a;break;case"mop":"​"!==e.body&&(s="",s+="\\operatorname"===a?t(e.body):e.body||a,s+=" ");break;case"mathstyle":case"box":case"spacing":case"enclose":break;case"space":s=" "}if(e.subscript){s+="_";const i=t(e.subscript);i.length>1&&!/^(-)?\d+(\.\d*)?$/.test(i)?s+="("+i+")":s+=i}if(e.superscript){s+="^";const i=t(e.superscript);i.length>1&&!/^(-)?\d+(\.\d*)?$/.test(i)?s+="("+i+")":s+=i}return s}(t,this.config));return i}$text(t){return this.formatMathlist(this.mathlist.root,t)}$selectedText(t){const e=this.mathlist.getSelectedAtoms();if(!e)return"";const i=Yt.makeRoot("math",e);return this.formatMathlist(i,t)}$selectionIsCollapsed(){return this.mathlist.isCollapsed()}$selectionDepth(){return this.mathlist.path.length}_superscriptDepth(){let t=0,e=0,i=this.mathlist.ancestor(e),s=!1;for(;i;)(i.superscript||i.subscript)&&(t+=1),i.superscript?s=!0:i.subscript&&(s=!1),e+=1,i=this.mathlist.ancestor(e);return s?t:0}_subscriptDepth(){let t=0,e=0,i=this.mathlist.ancestor(e),s=!1;for(;i;)(i.superscript||i.subscript)&&(t+=1),i.superscript?s=!1:i.subscript&&(s=!0),e+=1,i=this.mathlist.ancestor(e);return s?t:0}$selectionAtStart(){return 0===this.mathlist.startOffset()}$selectionAtEnd(){return this.mathlist.endOffset()>=this.mathlist.siblings().length-1}groupIsSelected(){return 0===this.mathlist.startOffset()&&this.mathlist.endOffset()>=this.mathlist.siblings().length-1}$latex(t,e){return t?(t!==this.mathlist.root.toLatex()&&(e=e||{},this.mathlist.insert(t,Object.assign({},this.config,{insertionMode:"replaceAll",selectionMode:"after",format:"latex",mode:"math",suppressChangeNotifications:e.suppressChangeNotifications})),this.undoManager.snapshot(this.config),this._requestUpdate()),t):this.mathlist.root.toLatex()}$el(){return this.element}undo(){return this.complete_(),this.undoManager.undo(this.config),!0}redo(){return this.complete_(),this.undoManager.redo(this.config),!0}scrollIntoView(){this.dirty&&this._render();let t=this._getCaretPosition();const e=this.field.getBoundingClientRect();if(!t){const i=this._getSelectionBounds();i&&(t={x:i.right+e.left-this.field.scrollLeft,y:i.top+e.top-this.field.scrollTop})}if(t){const i=t.x-window.scrollX;ie.right&&this.field.scroll({top:0,left:i-e.right+this.field.scrollLeft+20,behavior:"smooth"})}}scrollToStart(){this.field.scroll(0,0)}scrollToEnd(){const t=this.field.getBoundingClientRect();this.field.scroll(t.left-window.scrollX,0)}enterCommandMode_(){this.switchMode_("command")}copyToClipboard_(){return this.$focus(),this.mathlist.isCollapsed()&&this.$select(),document.execCommand("copy"),!1}cutToClipboard_(){return this.$focus(),document.execCommand("cut"),!0}pasteFromClipboard_(){return this.$focus(),document.execCommand("paste"),!0}$insert(t,e){if("string"==typeof t&&t.length>0){if((e=e||{}).focus&&this.$focus(),e.feedback&&(this.config.keypressVibration&&navigator.vibrate&&navigator.vibrate(3),this.keypressSound&&(this.keypressSound.load(),this.keypressSound.play())),"\\\\"===t)this.mathlist.addRowAfter_();else if("&"===t)this.mathlist.addColumnAfter_();else{const i=this.style;this.mathlist.insert(t,{mode:this.mode,style:this.mathlist.anchorStyle(),...e}),e.resetStyle&&(this.style=i)}return this.undoManager.snapshot(this.config),this._requestUpdate(),!0}return!1}switchMode_(t,e,i){this._resetKeystrokeBuffer(),this.smartModeSuppressed=/text|math/.test(this.mode)&&/text|math/.test(t),e&&this.$insert(e,{format:"latex",mode:{math:"text",text:"math"}[t]}),this.mathlist.decorateCommandStringAroundInsertionPoint(!1),"command"===t?(this.mathlist.removeSuggestion(),Ze.hidePopover(this),this.suggestionIndex=0,this.virtualKeyboardVisible&&this.switchKeyboardLayer_("lower-command"),this.mathlist.insert("",{mode:"math"})):this.mode=t,i&&this.$insert(i,{format:"latex",mode:t}),"function"==typeof this.config.onModeChange&&this.config.onModeChange(this,this.mode),this._requestUpdate()}complete_(t){if(t=t||{},Ze.hidePopover(this),t.discard)return this.mathlist.spliceCommandStringAroundInsertionPoint(null),this.switchMode_("math"),!0;const e=this.mathlist.extractCommandStringAroundInsertionPoint(!t.acceptSuggestion);if(e){if("\\("===e||"\\)"===e)this.mathlist.spliceCommandStringAroundInsertionPoint([]),this.mathlist.insert(e.slice(1),{mode:this.mode});else{const t="math";if(wt.commandAllowed(t,e)){const i=le.parseTokens(n(e),t,null,this.config.macros);this.mathlist.spliceCommandStringAroundInsertionPoint(i)}else{const i=le.parseTokens(n(e),t,null,this.config.macros);i?this.mathlist.spliceCommandStringAroundInsertionPoint(i):this.mathlist.decorateCommandStringAroundInsertionPoint(!0)}}return this.undoManager.snapshot(this.config),this._announce("replacement"),!0}return!1}_updateSuggestion(){this.mathlist.positionInsertionPointAfterCommitedCommand(),this.mathlist.removeSuggestion();const t=this.mathlist.extractCommandStringAroundInsertionPoint(),e=wt.suggest(t);if(0===e.length)Ze.hidePopover(this),this.mathlist.decorateCommandStringAroundInsertionPoint(!0);else{const i=this.suggestionIndex%e.length,s=t.length-e[i].match.length;0!==s&&this.mathlist.insertSuggestion(e[i].match,s),Ze.showPopoverWithLatex(this,e[i].match,e.length>1)}this._requestUpdate()}nextSuggestion_(){return this.suggestionIndex+=1,this._updateSuggestion(),!1}previousSuggestion_(){if(this.suggestionIndex-=1,this.suggestionIndex<0){this.mathlist.removeSuggestion();const t=this.mathlist.extractCommandStringAroundInsertionPoint(),e=wt.suggest(t);this.suggestionIndex=e.length-1}return this._updateSuggestion(),!1}_attachButtonHandlers(t,e){const i=this;let s,a,o,n,r;"object"==typeof e&&(e.default||e.pressed)?(e.default&&t.setAttribute("data-"+this.config.namespace+"command",JSON.stringify(e.default)),e.alt&&t.setAttribute("data-"+this.config.namespace+"command-alt",JSON.stringify(e.alt)),e.altshift&&t.setAttribute("data-"+this.config.namespace+"command-altshift",JSON.stringify(e.altshift)),e.shift&&t.setAttribute("data-"+this.config.namespace+"command-shift",JSON.stringify(e.shift)),e.pressed&&t.setAttribute("data-"+this.config.namespace+"command-pressed",JSON.stringify(e.pressed)),e.pressAndHoldStart&&t.setAttribute("data-"+this.config.namespace+"command-pressAndHoldStart",JSON.stringify(e.pressAndHoldStart)),e.pressAndHoldEnd&&t.setAttribute("data-"+this.config.namespace+"command-pressAndHoldEnd",JSON.stringify(e.pressAndHoldEnd))):t.setAttribute("data-"+this.config.namespace+"command",JSON.stringify(e)),us(t,"mousedown touchstart:passive",(function(e){if("mousedown"!==e.type||1===e.buttons){e.stopPropagation(),e.preventDefault(),t.classList.add("pressed"),s=Date.now(),"touchstart"===e.type&&(o=e.changedTouches[0].identifier);const n=t.getAttribute("data-"+i.config.namespace+"command-pressed");n&&i.$perform(JSON.parse(n));const l=t.getAttribute("data-"+i.config.namespace+"command-pressAndHoldStart");l&&(a=t,r&&clearTimeout(r),r=window.setTimeout((function(){t.classList.contains("pressed")&&i.$perform(JSON.parse(l))}),300))}})),us(t,"mouseleave touchcancel",(function(){t.classList.remove("pressed")})),us(t,"touchmove:passive",(function(t){t.preventDefault();for(let e=0;e=7?i.style.width="286px":4===e.length||2===e.length?i.style.width="146px":1===e.length?i.style.width="86px":i.style.width="146px",i.style.height="auto";let s="";for(const t of e)s+="";s="
      "+s+"
    ",i.innerHTML=s,ri.makeKeycap(this,i.getElementsByTagName("li"),"performAlternateKeys");const a=this.virtualKeyboard.querySelector('div.keyboard-layer.is-visible div.rows ul li[data-alt-keys="'+t+'"]').getBoundingClientRect();if(a){a.top-i.clientHeight<0&&(i.style.width="auto",e.length<=6?i.style.height="56px":e.length<=12?i.style.height="108px":i.style.height="205px");const t=(a.top-i.clientHeight+5).toString()+"px",s=Math.max(0,Math.min(window.innerWidth-i.offsetWidth,(a.left+a.right-i.offsetWidth)/2))+"px";i.style.transform="translate("+s+","+t+")",i.classList.add("is-visible")}return!1}hideAlternateKeys_(){const t=document.getElementById("mathlive-alternate-keys-panel");return t&&(t.classList.remove("is-visible"),t.innerHTML="",ys(t)),!1}performAlternateKeys_(t){return this.hideAlternateKeys_(),this.$perform(t)}switchKeyboardLayer_(t){if("off"!==this.config.virtualKeyboardMode){"lower-command"!==t&&"upper-command"!==t&&"symbols-command"!==t&&this.complete_(),this.showVirtualKeyboard_(),this.hideAlternateKeys_(),this.unshiftKeyboardLayer_();const e=this.virtualKeyboard.getElementsByClassName("keyboard-layer");let i=!1;for(let s=0;s=1){i=[];for(let t=1;t<=s;t++)i.push(e[t])}break}case"right":{const e=t.mathlist.siblings(),s=t.mathlist.endOffset()+1;if(s<=e.length-1){i=[];for(let t=s;t<=e.length-1;t++)i.push(e[t])}break}case"start":case"end":break;case"group":i=t.mathlist.siblings();break;case"parent":{const e=t.mathlist.parent();e&&"root"!==e.type&&(i=t.mathlist.parent());break}}return i}(this,t);if(null===i)return this.config.handleSpeak(function(t){let e="";switch(t){case"all":break;case"selection":e="no selection";break;case"left":e="at start";break;case"right":e="at end";break;case"group":break;case"parent":e="no parent"}return e}(t)),!1;const s={...this.config};(e.withHighlighting||"amazon"===s.speechEngine)&&(s.textToSpeechMarkup=window.sre&&"sre"===s.textToSpeechRules?"ssml_step":"ssml",e.withHighlighting&&(s.generateID=!0));const a=Yt.toSpeakableText(i,s);return e.withHighlighting?(window.mathlive.readAloudMathField=this,this._render({forHighlighting:!0}),this.config.handleReadAloud&&this.config.handleReadAloud(this.field,a,this.config)):this.config.handleSpeak&&this.config.handleSpeak(a,s),!1}}let ks,vs=0;function ws(t,e,i){const s=Object.assign({},t.config);return s.textToSpeechMarkup="",s.textToSpeechRulesOptions=s.textToSpeechRulesOptions||{},s.textToSpeechRulesOptions.markup="none",e+Yt.toSpeakableText(i,s)}function Ss(t,e,i,s){let a="";"plonk"===e?(t.plonkSound&&(t.plonkSound.load(),t.plonkSound.play().catch(t=>{})),t._resetKeystrokeBuffer()):"delete"===e?a=ws(t,"deleted: ",s):"focus"===e||/move/.test(e)?a=(t.mathlist.isCollapsed()?"":"selected: ")+t._nextAtomSpeechText(i):"replacement"===e?a=ws(t,"",t.mathlist.sibling(0)):"line"===e?(a=ws(t,"",t.mathlist.root),t.accessibleNode.innerHTML=''+Yt.toMathML(t.mathlist.root,t.config)+"",t.textarea.setAttribute("aria-label","after: "+a)):a=s?ws(t,e+" ",s):e;const o=/\u00a0/.test(t.ariaLiveText.textContent)?"   ":"   ";t.ariaLiveText.textContent=a+o}xs.prototype.undo_=xs.prototype.undo,xs.prototype.redo_=xs.prototype.redo,xs.prototype.scrollIntoView_=xs.prototype.scrollIntoView,xs.prototype.scrollToStart_=xs.prototype.scrollToStart,xs.prototype.scrollToEnd_=xs.prototype.scrollToEnd,xs.prototype.insert_=xs.prototype.$insert;var As={isValidMathfield:bs,MathField:xs};function Ms(t,e,i){let s=i,a=0;const o=t.length;for(;s0&&a.push({type:"text",data:n.slice(0,c)}),l=!1);let h=!1;for(;!h;){if(l){if(r=n.indexOf(e,c),-1===r){h=!0;break}c!==r&&a.push({type:"text",data:n.slice(c,r)}),c=r}else{if(r=Ms(i,n,c+e.length),-1===r){h=!0;break}a.push({type:"math",data:n.slice(c+e.length,r),rawData:n.slice(c,r+i.length),mathstyle:s}),c=r+i.length}l=!l}c"+e.renderToMathML(t,e)+""}catch(e){i.textContent=t}return i.className="sr-only",i}(t,i)),/\bspeakable-text\b/i.test(i.renderAccessibleContent)&&i.renderToSpeakableText){const s=document.createElement("span");s.innerHTML=i.renderToSpeakableText(t,i),s.className="sr-only",e.appendChild(s)}return e.appendChild(a),e}return a}function Ls(t,e){let i=null;if(e.TeX.processEnvironments&&/^\s*\\begin/.test(t))i=document.createDocumentFragment(),i.appendChild(Ts(t,void 0,e,!0));else{const s=_s(t,e.TeX.delimiters);if(1===s.length&&"text"===s[0].type)return null;i=document.createDocumentFragment();for(let t=0;t{})}}))}}else e.speechEngine;else{const e=new SpeechSynthesisUtterance(t);window&&window.speechSynthesis.speak(e)}}function Is(t,e,i){if(!window)return;if(!i&&window.mathlive&&(i=window.mathlive.config),"amazon"!==(i=i||{}).speechEngine)return void(i.handleSpeak&&i.handleSpeak(e));if(!window.AWS)return;const s=new window.AWS.Polly({apiVersion:"2016-06-10"}),a={OutputFormat:"json",VoiceId:i.speechEngineVoice||"Joanna",Text:e,TextType:"ssml",SpeechMarkTypes:["ssml"]};window.mathlive=window.mathlive||{},window.mathlive.readAloudElement=t;const o=i.onReadAloudStatus||window.mathlive.onReadAloudStatus;s.synthesizeSpeech(a,(function(t,e){if(t);else if(e&&e.AudioStream){const t=new TextDecoder("utf-8").decode(new Uint8Array(e.AudioStream));window.mathlive.readAloudMarks=t.split("\n").map(t=>t?JSON.parse(t):{}),window.mathlive.readAloudTokens=[];for(const t of window.mathlive.readAloudMarks)t.value&&window.mathlive.readAloudTokens.push(t.value);window.mathlive.readAloudCurrentMark="",a.OutputFormat="mp3",a.SpeechMarkTypes=[],s.synthesizeSpeech(a,(function(t,e){if(t);else if(e&&e.AudioStream){const t=new Uint8Array(e.AudioStream),i=new Blob([t.buffer],{type:"audio/mpeg"}),s=URL.createObjectURL(i);window.mathlive.readAloudAudio?window.mathlive.readAloudAudio.pause():(window.mathlive.readAloudAudio=new Audio,window.mathlive.readAloudAudio.addEventListener("ended",()=>{o&&o(window.mathlive.readAloudMathField,"ended"),window.mathlive.readAloudMathField?(window.mathlive.readAloudMathField._render(),window.mathlive.readAloudElement=null,window.mathlive.readAloudMathField=null,window.mathlive.readAloudTokens=[],window.mathlive.readAloudMarks=[],window.mathlive.readAloudCurrentMark=""):function t(e){e.classList.remove("highlight"),e.children&&Array.from(e.children).forEach(e=>{t(e)})}(window.mathlive.readAloudElement)}),window.mathlive.readAloudAudio.addEventListener("timeupdate",()=>{let t="";const e=1e3*window.mathlive.readAloudAudio.currentTime+100;for(const i of window.mathlive.readAloudMarks)i.time0&&Array.from(e.children).forEach(e=>{t(e,i)})):(e.classList.add("highlight"),e.children&&e.children.length>0&&Array.from(e.children).forEach(e=>{t(e)}))}(window.mathlive.readAloudElement,window.mathlive.readAloudCurrentMark)))})),window.mathlive.readAloudAudio.src=s,o&&o(window.mathlive.readAloudMathField,"playing"),window.mathlive.readAloudAudio.play()}}))}}))}function Bs(t){let e=t;if("string"==typeof t&&(e=document.getElementById(t),!e))throw Error(`The element with ID "${t}" could not be found.`);return e}function Os(t,e){Ds&&((e=e||{}).renderToMarkup=e.renderToMarkup||zs,e.renderToMathML=e.renderToMathML||Es,e.renderToSpeakableText=e.renderToSpeakableText||qs,e.macros=e.macros||wt.MACROS,Ds.renderMathInElement(Bs(t),e))}function Rs(t){if(t.namespace){if(!/^[a-z]+[-]?$/.test(t.namespace))throw Error("options.namespace must be a string of lowercase characters only");/-$/.test(t.namespace)||(t.namespace+="-")}}const Ks={latexToMarkup:zs,latexToMathML:Es,latexToSpeakableText:qs,latexToAST:function(t,e){if(!Yt.toAST)return{};(e=e||{}).macros=e.macros||{},Object.assign(e.macros,wt.MACROS);const i=le.parseTokens(n(t),"math",null,e.macros);return Yt.toAST(i,e)},astToLatex:function(t,e){return hs(t,e)},makeMathField:function(t,e){if(!As)throw Error("The MathField module is not loaded.");return(e=e||{}).handleSpeak=e.handleSpeak||Ps,e.handleReadAloud=e.handleReadAloud||Is,new As.MathField(Bs(t),e)},renderMathInDocument:function(t){Os(document.body,t)},renderMathInElement:Os,revertToOriginalContent:function(t,e){(t=(t=Bs(t)).children[1])instanceof As.MathField?t.revertToOriginalContent():(Rs(e=e||{}),t.innerHTML=t.getAttribute("data-"+(e.namespace||"")+"original-content"))},getOriginalContent:function(t,e){return(t=(t=Bs(t)).children[1])instanceof As.MathField?t.originalContent:(Rs(e=e||{}),t.getAttribute("data-"+(e.namespace||"")+"original-content"))},readAloud:Is,readAloudStatus:function(){return window?(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio?window.mathlive.readAloudAudio.paused?"paused":window.mathlive.readAloudAudio.ended?"ready":"playing":"ready"):"unavailable"},pauseReadAloud:function(){window&&(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio&&(window.mathlive.onReadAloudStatus&&window.mathlive.onReadAloudStatus(window.mathlive.readAloudMathField,"paused"),window.mathlive.readAloudAudio.pause()))},resumeReadAloud:function(){window&&(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio&&(window.mathlive.onReadAloudStatus&&window.mathlive.onReadAloudStatus(window.mathlive.readAloudMathField,"playing"),window.mathlive.readAloudAudio.play()))},playReadAloud:function(t,e){if(window&&(window.mathlive=window.mathlive||{},window.mathlive.readAloudAudio)){let i=0;if(window.mathlive.readAloudFinalToken=null,t){window.mathlive.readAloudMarks=window.mathlive.readAloudMarks||[];for(const e of window.mathlive.readAloudMarks)e.value===t&&(i=e.time/1e3);let s=window.mathlive.readAloudTokens.indexOf(t);s>=0&&(s+=e,sMathLive Basic Example Return to the homepage  -