www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

katex.js (607347B)


      1 (function webpackUniversalModuleDefinition(root, factory) {
      2 	if(typeof exports === 'object' && typeof module === 'object')
      3 		module.exports = factory();
      4 	else if(typeof define === 'function' && define.amd)
      5 		define([], factory);
      6 	else if(typeof exports === 'object')
      7 		exports["katex"] = factory();
      8 	else
      9 		root["katex"] = factory();
     10 })((typeof self !== 'undefined' ? self : this), function() {
     11 return /******/ (function() { // webpackBootstrap
     12 /******/ 	"use strict";
     13 /******/ 	// The require scope
     14 /******/ 	var __webpack_require__ = {};
     15 /******/ 	
     16 /************************************************************************/
     17 /******/ 	/* webpack/runtime/define property getters */
     18 /******/ 	!function() {
     19 /******/ 		// define getter functions for harmony exports
     20 /******/ 		__webpack_require__.d = function(exports, definition) {
     21 /******/ 			for(var key in definition) {
     22 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
     23 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
     24 /******/ 				}
     25 /******/ 			}
     26 /******/ 		};
     27 /******/ 	}();
     28 /******/ 	
     29 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
     30 /******/ 	!function() {
     31 /******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
     32 /******/ 	}();
     33 /******/ 	
     34 /************************************************************************/
     35 var __webpack_exports__ = {};
     36 
     37 // EXPORTS
     38 __webpack_require__.d(__webpack_exports__, {
     39   "default": function() { return /* binding */ katex_webpack; }
     40 });
     41 
     42 ;// CONCATENATED MODULE: ./src/ParseError.js
     43 
     44 
     45 /**
     46  * This is the ParseError class, which is the main error thrown by KaTeX
     47  * functions when something has gone wrong. This is used to distinguish internal
     48  * errors from errors in the expression that the user provided.
     49  *
     50  * If possible, a caller should provide a Token or ParseNode with information
     51  * about where in the source string the problem occurred.
     52  */
     53 var ParseError = // Error position based on passed-in Token or ParseNode.
     54 function ParseError(message, // The error message
     55 token) {
     56   this.position = void 0;
     57   var error = "KaTeX parse error: " + message;
     58   var start;
     59   var loc = token && token.loc;
     60 
     61   if (loc && loc.start <= loc.end) {
     62     // If we have the input and a position, make the error a bit fancier
     63     // Get the input
     64     var input = loc.lexer.input; // Prepend some information
     65 
     66     start = loc.start;
     67     var end = loc.end;
     68 
     69     if (start === input.length) {
     70       error += " at end of input: ";
     71     } else {
     72       error += " at position " + (start + 1) + ": ";
     73     } // Underline token in question using combining underscores
     74 
     75 
     76     var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); // Extract some context from the input and add it to the error
     77 
     78     var left;
     79 
     80     if (start > 15) {
     81       left = "…" + input.slice(start - 15, start);
     82     } else {
     83       left = input.slice(0, start);
     84     }
     85 
     86     var right;
     87 
     88     if (end + 15 < input.length) {
     89       right = input.slice(end, end + 15) + "…";
     90     } else {
     91       right = input.slice(end);
     92     }
     93 
     94     error += left + underlined + right;
     95   } // Some hackery to make ParseError a prototype of Error
     96   // See http://stackoverflow.com/a/8460753
     97 
     98 
     99   var self = new Error(error);
    100   self.name = "ParseError"; // $FlowFixMe
    101 
    102   self.__proto__ = ParseError.prototype; // $FlowFixMe
    103 
    104   self.position = start;
    105   return self;
    106 }; // $FlowFixMe More hackery
    107 
    108 
    109 ParseError.prototype.__proto__ = Error.prototype;
    110 /* harmony default export */ var src_ParseError = (ParseError);
    111 ;// CONCATENATED MODULE: ./src/utils.js
    112 /**
    113  * This file contains a list of utility functions which are useful in other
    114  * files.
    115  */
    116 
    117 /**
    118  * Return whether an element is contained in a list
    119  */
    120 var contains = function contains(list, elem) {
    121   return list.indexOf(elem) !== -1;
    122 };
    123 /**
    124  * Provide a default value if a setting is undefined
    125  * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.
    126  */
    127 
    128 
    129 var deflt = function deflt(setting, defaultIfUndefined) {
    130   return setting === undefined ? defaultIfUndefined : setting;
    131 }; // hyphenate and escape adapted from Facebook's React under Apache 2 license
    132 
    133 
    134 var uppercase = /([A-Z])/g;
    135 
    136 var hyphenate = function hyphenate(str) {
    137   return str.replace(uppercase, "-$1").toLowerCase();
    138 };
    139 
    140 var ESCAPE_LOOKUP = {
    141   "&": "&amp;",
    142   ">": "&gt;",
    143   "<": "&lt;",
    144   "\"": "&quot;",
    145   "'": "&#x27;"
    146 };
    147 var ESCAPE_REGEX = /[&><"']/g;
    148 /**
    149  * Escapes text to prevent scripting attacks.
    150  */
    151 
    152 function utils_escape(text) {
    153   return String(text).replace(ESCAPE_REGEX, function (match) {
    154     return ESCAPE_LOOKUP[match];
    155   });
    156 }
    157 /**
    158  * Sometimes we want to pull out the innermost element of a group. In most
    159  * cases, this will just be the group itself, but when ordgroups and colors have
    160  * a single element, we want to pull that out.
    161  */
    162 
    163 
    164 var getBaseElem = function getBaseElem(group) {
    165   if (group.type === "ordgroup") {
    166     if (group.body.length === 1) {
    167       return getBaseElem(group.body[0]);
    168     } else {
    169       return group;
    170     }
    171   } else if (group.type === "color") {
    172     if (group.body.length === 1) {
    173       return getBaseElem(group.body[0]);
    174     } else {
    175       return group;
    176     }
    177   } else if (group.type === "font") {
    178     return getBaseElem(group.body);
    179   } else {
    180     return group;
    181   }
    182 };
    183 /**
    184  * TeXbook algorithms often reference "character boxes", which are simply groups
    185  * with a single character in them. To decide if something is a character box,
    186  * we find its innermost group, and see if it is a single character.
    187  */
    188 
    189 
    190 var isCharacterBox = function isCharacterBox(group) {
    191   var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters
    192 
    193   return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom";
    194 };
    195 
    196 var assert = function assert(value) {
    197   if (!value) {
    198     throw new Error('Expected non-null, but got ' + String(value));
    199   }
    200 
    201   return value;
    202 };
    203 /**
    204  * Return the protocol of a URL, or "_relative" if the URL does not specify a
    205  * protocol (and thus is relative).
    206  */
    207 
    208 var protocolFromUrl = function protocolFromUrl(url) {
    209   var protocol = /^\s*([^\\/#]*?)(?::|&#0*58|&#x0*3a)/i.exec(url);
    210   return protocol != null ? protocol[1] : "_relative";
    211 };
    212 /* harmony default export */ var utils = ({
    213   contains: contains,
    214   deflt: deflt,
    215   escape: utils_escape,
    216   hyphenate: hyphenate,
    217   getBaseElem: getBaseElem,
    218   isCharacterBox: isCharacterBox,
    219   protocolFromUrl: protocolFromUrl
    220 });
    221 ;// CONCATENATED MODULE: ./src/Settings.js
    222 /* eslint no-console:0 */
    223 
    224 /**
    225  * This is a module for storing settings passed into KaTeX. It correctly handles
    226  * default settings.
    227  */
    228 
    229 
    230 
    231 
    232 /**
    233  * The main Settings object
    234  *
    235  * The current options stored are:
    236  *  - displayMode: Whether the expression should be typeset as inline math
    237  *                 (false, the default), meaning that the math starts in
    238  *                 \textstyle and is placed in an inline-block); or as display
    239  *                 math (true), meaning that the math starts in \displaystyle
    240  *                 and is placed in a block with vertical margin.
    241  */
    242 var Settings = /*#__PURE__*/function () {
    243   function Settings(options) {
    244     this.displayMode = void 0;
    245     this.output = void 0;
    246     this.leqno = void 0;
    247     this.fleqn = void 0;
    248     this.throwOnError = void 0;
    249     this.errorColor = void 0;
    250     this.macros = void 0;
    251     this.minRuleThickness = void 0;
    252     this.colorIsTextColor = void 0;
    253     this.strict = void 0;
    254     this.trust = void 0;
    255     this.maxSize = void 0;
    256     this.maxExpand = void 0;
    257     this.globalGroup = void 0;
    258     // allow null options
    259     options = options || {};
    260     this.displayMode = utils.deflt(options.displayMode, false);
    261     this.output = utils.deflt(options.output, "htmlAndMathml");
    262     this.leqno = utils.deflt(options.leqno, false);
    263     this.fleqn = utils.deflt(options.fleqn, false);
    264     this.throwOnError = utils.deflt(options.throwOnError, true);
    265     this.errorColor = utils.deflt(options.errorColor, "#cc0000");
    266     this.macros = options.macros || {};
    267     this.minRuleThickness = Math.max(0, utils.deflt(options.minRuleThickness, 0));
    268     this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false);
    269     this.strict = utils.deflt(options.strict, "warn");
    270     this.trust = utils.deflt(options.trust, false);
    271     this.maxSize = Math.max(0, utils.deflt(options.maxSize, Infinity));
    272     this.maxExpand = Math.max(0, utils.deflt(options.maxExpand, 1000));
    273     this.globalGroup = utils.deflt(options.globalGroup, false);
    274   }
    275   /**
    276    * Report nonstrict (non-LaTeX-compatible) input.
    277    * Can safely not be called if `this.strict` is false in JavaScript.
    278    */
    279 
    280 
    281   var _proto = Settings.prototype;
    282 
    283   _proto.reportNonstrict = function reportNonstrict(errorCode, errorMsg, token) {
    284     var strict = this.strict;
    285 
    286     if (typeof strict === "function") {
    287       // Allow return value of strict function to be boolean or string
    288       // (or null/undefined, meaning no further processing).
    289       strict = strict(errorCode, errorMsg, token);
    290     }
    291 
    292     if (!strict || strict === "ignore") {
    293       return;
    294     } else if (strict === true || strict === "error") {
    295       throw new src_ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token);
    296     } else if (strict === "warn") {
    297       typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
    298     } else {
    299       // won't happen in type-safe code
    300       typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
    301     }
    302   }
    303   /**
    304    * Check whether to apply strict (LaTeX-adhering) behavior for unusual
    305    * input (like `\\`).  Unlike `nonstrict`, will not throw an error;
    306    * instead, "error" translates to a return value of `true`, while "ignore"
    307    * translates to a return value of `false`.  May still print a warning:
    308    * "warn" prints a warning and returns `false`.
    309    * This is for the second category of `errorCode`s listed in the README.
    310    */
    311   ;
    312 
    313   _proto.useStrictBehavior = function useStrictBehavior(errorCode, errorMsg, token) {
    314     var strict = this.strict;
    315 
    316     if (typeof strict === "function") {
    317       // Allow return value of strict function to be boolean or string
    318       // (or null/undefined, meaning no further processing).
    319       // But catch any exceptions thrown by function, treating them
    320       // like "error".
    321       try {
    322         strict = strict(errorCode, errorMsg, token);
    323       } catch (error) {
    324         strict = "error";
    325       }
    326     }
    327 
    328     if (!strict || strict === "ignore") {
    329       return false;
    330     } else if (strict === true || strict === "error") {
    331       return true;
    332     } else if (strict === "warn") {
    333       typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
    334       return false;
    335     } else {
    336       // won't happen in type-safe code
    337       typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
    338       return false;
    339     }
    340   }
    341   /**
    342    * Check whether to test potentially dangerous input, and return
    343    * `true` (trusted) or `false` (untrusted).  The sole argument `context`
    344    * should be an object with `command` field specifying the relevant LaTeX
    345    * command (as a string starting with `\`), and any other arguments, etc.
    346    * If `context` has a `url` field, a `protocol` field will automatically
    347    * get added by this function (changing the specified object).
    348    */
    349   ;
    350 
    351   _proto.isTrusted = function isTrusted(context) {
    352     if (context.url && !context.protocol) {
    353       context.protocol = utils.protocolFromUrl(context.url);
    354     }
    355 
    356     var trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
    357     return Boolean(trust);
    358   };
    359 
    360   return Settings;
    361 }();
    362 
    363 
    364 ;// CONCATENATED MODULE: ./src/Style.js
    365 /**
    366  * This file contains information and classes for the various kinds of styles
    367  * used in TeX. It provides a generic `Style` class, which holds information
    368  * about a specific style. It then provides instances of all the different kinds
    369  * of styles possible, and provides functions to move between them and get
    370  * information about them.
    371  */
    372 
    373 /**
    374  * The main style class. Contains a unique id for the style, a size (which is
    375  * the same for cramped and uncramped version of a style), and a cramped flag.
    376  */
    377 var Style = /*#__PURE__*/function () {
    378   function Style(id, size, cramped) {
    379     this.id = void 0;
    380     this.size = void 0;
    381     this.cramped = void 0;
    382     this.id = id;
    383     this.size = size;
    384     this.cramped = cramped;
    385   }
    386   /**
    387    * Get the style of a superscript given a base in the current style.
    388    */
    389 
    390 
    391   var _proto = Style.prototype;
    392 
    393   _proto.sup = function sup() {
    394     return styles[_sup[this.id]];
    395   }
    396   /**
    397    * Get the style of a subscript given a base in the current style.
    398    */
    399   ;
    400 
    401   _proto.sub = function sub() {
    402     return styles[_sub[this.id]];
    403   }
    404   /**
    405    * Get the style of a fraction numerator given the fraction in the current
    406    * style.
    407    */
    408   ;
    409 
    410   _proto.fracNum = function fracNum() {
    411     return styles[_fracNum[this.id]];
    412   }
    413   /**
    414    * Get the style of a fraction denominator given the fraction in the current
    415    * style.
    416    */
    417   ;
    418 
    419   _proto.fracDen = function fracDen() {
    420     return styles[_fracDen[this.id]];
    421   }
    422   /**
    423    * Get the cramped version of a style (in particular, cramping a cramped style
    424    * doesn't change the style).
    425    */
    426   ;
    427 
    428   _proto.cramp = function cramp() {
    429     return styles[_cramp[this.id]];
    430   }
    431   /**
    432    * Get a text or display version of this style.
    433    */
    434   ;
    435 
    436   _proto.text = function text() {
    437     return styles[_text[this.id]];
    438   }
    439   /**
    440    * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
    441    */
    442   ;
    443 
    444   _proto.isTight = function isTight() {
    445     return this.size >= 2;
    446   };
    447 
    448   return Style;
    449 }(); // Export an interface for type checking, but don't expose the implementation.
    450 // This way, no more styles can be generated.
    451 
    452 
    453 // IDs of the different styles
    454 var D = 0;
    455 var Dc = 1;
    456 var T = 2;
    457 var Tc = 3;
    458 var S = 4;
    459 var Sc = 5;
    460 var SS = 6;
    461 var SSc = 7; // Instances of the different styles
    462 
    463 var styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; // Lookup tables for switching from one style to another
    464 
    465 var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];
    466 var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];
    467 var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];
    468 var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];
    469 var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];
    470 var _text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles.
    471 
    472 /* harmony default export */ var src_Style = ({
    473   DISPLAY: styles[D],
    474   TEXT: styles[T],
    475   SCRIPT: styles[S],
    476   SCRIPTSCRIPT: styles[SS]
    477 });
    478 ;// CONCATENATED MODULE: ./src/unicodeScripts.js
    479 /*
    480  * This file defines the Unicode scripts and script families that we
    481  * support. To add new scripts or families, just add a new entry to the
    482  * scriptData array below. Adding scripts to the scriptData array allows
    483  * characters from that script to appear in \text{} environments.
    484  */
    485 
    486 /**
    487  * Each script or script family has a name and an array of blocks.
    488  * Each block is an array of two numbers which specify the start and
    489  * end points (inclusive) of a block of Unicode codepoints.
    490  */
    491 
    492 /**
    493  * Unicode block data for the families of scripts we support in \text{}.
    494  * Scripts only need to appear here if they do not have font metrics.
    495  */
    496 var scriptData = [{
    497   // Latin characters beyond the Latin-1 characters we have metrics for.
    498   // Needed for Czech, Hungarian and Turkish text, for example.
    499   name: 'latin',
    500   blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B
    501   [0x0300, 0x036f] // Combining Diacritical marks
    502   ]
    503 }, {
    504   // The Cyrillic script used by Russian and related languages.
    505   // A Cyrillic subset used to be supported as explicitly defined
    506   // symbols in symbols.js
    507   name: 'cyrillic',
    508   blocks: [[0x0400, 0x04ff]]
    509 }, {
    510   // Armenian
    511   name: 'armenian',
    512   blocks: [[0x0530, 0x058F]]
    513 }, {
    514   // The Brahmic scripts of South and Southeast Asia
    515   // Devanagari (0900–097F)
    516   // Bengali (0980–09FF)
    517   // Gurmukhi (0A00–0A7F)
    518   // Gujarati (0A80–0AFF)
    519   // Oriya (0B00–0B7F)
    520   // Tamil (0B80–0BFF)
    521   // Telugu (0C00–0C7F)
    522   // Kannada (0C80–0CFF)
    523   // Malayalam (0D00–0D7F)
    524   // Sinhala (0D80–0DFF)
    525   // Thai (0E00–0E7F)
    526   // Lao (0E80–0EFF)
    527   // Tibetan (0F00–0FFF)
    528   // Myanmar (1000–109F)
    529   name: 'brahmic',
    530   blocks: [[0x0900, 0x109F]]
    531 }, {
    532   name: 'georgian',
    533   blocks: [[0x10A0, 0x10ff]]
    534 }, {
    535   // Chinese and Japanese.
    536   // The "k" in cjk is for Korean, but we've separated Korean out
    537   name: "cjk",
    538   blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana
    539   [0x4E00, 0x9FAF], // CJK ideograms
    540   [0xFF00, 0xFF60] // Fullwidth punctuation
    541   // TODO: add halfwidth Katakana and Romanji glyphs
    542   ]
    543 }, {
    544   // Korean
    545   name: 'hangul',
    546   blocks: [[0xAC00, 0xD7AF]]
    547 }];
    548 /**
    549  * Given a codepoint, return the name of the script or script family
    550  * it is from, or null if it is not part of a known block
    551  */
    552 
    553 function scriptFromCodepoint(codepoint) {
    554   for (var i = 0; i < scriptData.length; i++) {
    555     var script = scriptData[i];
    556 
    557     for (var _i = 0; _i < script.blocks.length; _i++) {
    558       var block = script.blocks[_i];
    559 
    560       if (codepoint >= block[0] && codepoint <= block[1]) {
    561         return script.name;
    562       }
    563     }
    564   }
    565 
    566   return null;
    567 }
    568 /**
    569  * A flattened version of all the supported blocks in a single array.
    570  * This is an optimization to make supportedCodepoint() fast.
    571  */
    572 
    573 var allBlocks = [];
    574 scriptData.forEach(function (s) {
    575   return s.blocks.forEach(function (b) {
    576     return allBlocks.push.apply(allBlocks, b);
    577   });
    578 });
    579 /**
    580  * Given a codepoint, return true if it falls within one of the
    581  * scripts or script families defined above and false otherwise.
    582  *
    583  * Micro benchmarks shows that this is faster than
    584  * /[\u3000-\u30FF\u4E00-\u9FAF\uFF00-\uFF60\uAC00-\uD7AF\u0900-\u109F]/.test()
    585  * in Firefox, Chrome and Node.
    586  */
    587 
    588 function supportedCodepoint(codepoint) {
    589   for (var i = 0; i < allBlocks.length; i += 2) {
    590     if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) {
    591       return true;
    592     }
    593   }
    594 
    595   return false;
    596 }
    597 ;// CONCATENATED MODULE: ./src/svgGeometry.js
    598 /**
    599  * This file provides support to domTree.js and delimiter.js.
    600  * It's a storehouse of path geometry for SVG images.
    601  */
    602 // In all paths below, the viewBox-to-em scale is 1000:1.
    603 var hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping.
    604 // The viniculum of a \sqrt can be made thicker by a KaTeX rendering option.
    605 // Think of variable extraViniculum as two detours in the SVG path.
    606 // The detour begins at the lower left of the area labeled extraViniculum below.
    607 // The detour proceeds one extraViniculum distance up and slightly to the right,
    608 // displacing the radiused corner between surd and viniculum. The radius is
    609 // traversed as usual, then the detour resumes. It goes right, to the end of
    610 // the very long viniculumn, then down one extraViniculum distance,
    611 // after which it resumes regular path geometry for the radical.
    612 
    613 /*                                                  viniculum
    614                                                    /
    615          /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraViniculum
    616         / █████████████████████←0.04em (40 unit) std viniculum thickness
    617        / /
    618       / /
    619      / /\
    620     / / surd
    621 */
    622 
    623 var sqrtMain = function sqrtMain(extraViniculum, hLinePad) {
    624   // sqrtMain path geometry is from glyph U221A in the font KaTeX Main
    625   return "M95," + (622 + extraViniculum + hLinePad) + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + extraViniculum / 2.075 + " -" + extraViniculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraViniculum) + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + (834 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z";
    626 };
    627 
    628 var sqrtSize1 = function sqrtSize1(extraViniculum, hLinePad) {
    629   // size1 is from glyph U221A in the font KaTeX_Size1-Regular
    630   return "M263," + (601 + extraViniculum + hLinePad) + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + extraViniculum / 2.084 + " -" + extraViniculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraViniculum) + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z";
    631 };
    632 
    633 var sqrtSize2 = function sqrtSize2(extraViniculum, hLinePad) {
    634   // size2 is from glyph U221A in the font KaTeX_Size2-Regular
    635   return "M983 " + (10 + extraViniculum + hLinePad) + "\nl" + extraViniculum / 3.13 + " -" + extraViniculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraViniculum) + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z";
    636 };
    637 
    638 var sqrtSize3 = function sqrtSize3(extraViniculum, hLinePad) {
    639   // size3 is from glyph U221A in the font KaTeX_Size3-Regular
    640   return "M424," + (2398 + extraViniculum + hLinePad) + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + extraViniculum / 4.223 + " -" + extraViniculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraViniculum) + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + (1001 + extraViniculum) + " " + hLinePad + "\nh400000v" + (40 + extraViniculum) + "h-400000z";
    641 };
    642 
    643 var sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) {
    644   // size4 is from glyph U221A in the font KaTeX_Size4-Regular
    645   return "M473," + (2713 + extraViniculum + hLinePad) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraViniculum / 5.298 + " -" + extraViniculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraViniculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "H1017.7z";
    646 };
    647 
    648 var phasePath = function phasePath(y) {
    649   var x = y / 2; // x coordinate at top of angle
    650 
    651   return "M400000 " + y + " H0 L" + x + " 0 l65 45 L145 " + (y - 80) + " H400000z";
    652 };
    653 
    654 var sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) {
    655   // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular
    656   // One path edge has a variable length. It runs vertically from the viniculumn
    657   // to a point near (14 units) the bottom of the surd. The viniculum
    658   // is normally 40 units thick. So the length of the line in question is:
    659   var vertSegment = viewBoxHeight - 54 - hLinePad - extraViniculum;
    660   return "M702 " + (extraViniculum + hLinePad) + "H400000" + (40 + extraViniculum) + "\nH742v" + vertSegment + "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + hLinePad + "H400000v" + (40 + extraViniculum) + "H742z";
    661 };
    662 
    663 var sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) {
    664   extraViniculum = 1000 * extraViniculum; // Convert from document ems to viewBox.
    665 
    666   var path = "";
    667 
    668   switch (size) {
    669     case "sqrtMain":
    670       path = sqrtMain(extraViniculum, hLinePad);
    671       break;
    672 
    673     case "sqrtSize1":
    674       path = sqrtSize1(extraViniculum, hLinePad);
    675       break;
    676 
    677     case "sqrtSize2":
    678       path = sqrtSize2(extraViniculum, hLinePad);
    679       break;
    680 
    681     case "sqrtSize3":
    682       path = sqrtSize3(extraViniculum, hLinePad);
    683       break;
    684 
    685     case "sqrtSize4":
    686       path = sqrtSize4(extraViniculum, hLinePad);
    687       break;
    688 
    689     case "sqrtTall":
    690       path = sqrtTall(extraViniculum, hLinePad, viewBoxHeight);
    691   }
    692 
    693   return path;
    694 };
    695 var innerPath = function innerPath(name, height) {
    696   // The inner part of stretchy tall delimiters
    697   switch (name) {
    698     case "\u239C":
    699       return "M291 0 H417 V" + height + " H291z M291 0 H417 V" + height + " H291z";
    700 
    701     case "\u2223":
    702       return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z";
    703 
    704     case "\u2225":
    705       return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z" + ("M367 0 H410 V" + height + " H367z M367 0 H410 V" + height + " H367z");
    706 
    707     case "\u239F":
    708       return "M457 0 H583 V" + height + " H457z M457 0 H583 V" + height + " H457z";
    709 
    710     case "\u23A2":
    711       return "M319 0 H403 V" + height + " H319z M319 0 H403 V" + height + " H319z";
    712 
    713     case "\u23A5":
    714       return "M263 0 H347 V" + height + " H263z M263 0 H347 V" + height + " H263z";
    715 
    716     case "\u23AA":
    717       return "M384 0 H504 V" + height + " H384z M384 0 H504 V" + height + " H384z";
    718 
    719     case "\u23D0":
    720       return "M312 0 H355 V" + height + " H312z M312 0 H355 V" + height + " H312z";
    721 
    722     case "\u2016":
    723       return "M257 0 H300 V" + height + " H257z M257 0 H300 V" + height + " H257z" + ("M478 0 H521 V" + height + " H478z M478 0 H521 V" + height + " H478z");
    724 
    725     default:
    726       return "";
    727   }
    728 };
    729 var path = {
    730   // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
    731   doubleleftarrow: "M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",
    732   // doublerightarrow is from glyph U+21D2 in font KaTeX Main
    733   doublerightarrow: "M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",
    734   // leftarrow is from glyph U+2190 in font KaTeX Main
    735   leftarrow: "M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",
    736   // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular
    737   leftbrace: "M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",
    738   leftbraceunder: "M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",
    739   // overgroup is from the MnSymbol package (public domain)
    740   leftgroup: "M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",
    741   leftgroupunder: "M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",
    742   // Harpoons are from glyph U+21BD in font KaTeX Main
    743   leftharpoon: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",
    744   leftharpoonplus: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",
    745   leftharpoondown: "M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",
    746   leftharpoondownplus: "M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",
    747   // hook is from glyph U+21A9 in font KaTeX Main
    748   lefthook: "M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",
    749   leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",
    750   leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",
    751   // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
    752   leftToFrom: "M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",
    753   longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",
    754   midbrace: "M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",
    755   midbraceunder: "M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",
    756   oiintSize1: "M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",
    757   oiintSize2: "M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",
    758   oiiintSize1: "M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",
    759   oiiintSize2: "M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",
    760   rightarrow: "M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",
    761   rightbrace: "M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",
    762   rightbraceunder: "M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",
    763   rightgroup: "M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",
    764   rightgroupunder: "M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",
    765   rightharpoon: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",
    766   rightharpoonplus: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",
    767   rightharpoondown: "M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",
    768   rightharpoondownplus: "M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",
    769   righthook: "M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",
    770   rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",
    771   rightToFrom: "M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",
    772   // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
    773   twoheadleftarrow: "M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",
    774   twoheadrightarrow: "M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",
    775   // tilde1 is a modified version of a glyph from the MnSymbol package
    776   tilde1: "M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",
    777   // ditto tilde2, tilde3, & tilde4
    778   tilde2: "M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",
    779   tilde3: "M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",
    780   tilde4: "M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",
    781   // vec is from glyph U+20D7 in font KaTeX Main
    782   vec: "M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",
    783   // widehat1 is a modified version of a glyph from the MnSymbol package
    784   widehat1: "M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",
    785   // ditto widehat2, widehat3, & widehat4
    786   widehat2: "M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
    787   widehat3: "M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
    788   widehat4: "M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",
    789   // widecheck paths are all inverted versions of widehat
    790   widecheck1: "M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",
    791   widecheck2: "M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
    792   widecheck3: "M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
    793   widecheck4: "M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
    794   // The next ten paths support reaction arrows from the mhchem package.
    795   // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
    796   // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main
    797   baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",
    798   // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
    799   rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",
    800   // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.
    801   // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em
    802   baraboveshortleftharpoon: "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",
    803   rightharpoonaboveshortbar: "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",
    804   shortbaraboveleftharpoon: "M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",
    805   shortrightharpoonabovebar: "M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"
    806 };
    807 ;// CONCATENATED MODULE: ./src/tree.js
    808 
    809 
    810 /**
    811  * This node represents a document fragment, which contains elements, but when
    812  * placed into the DOM doesn't have any representation itself. It only contains
    813  * children and doesn't have any DOM node properties.
    814  */
    815 var DocumentFragment = /*#__PURE__*/function () {
    816   // HtmlDomNode
    817   // Never used; needed for satisfying interface.
    818   function DocumentFragment(children) {
    819     this.children = void 0;
    820     this.classes = void 0;
    821     this.height = void 0;
    822     this.depth = void 0;
    823     this.maxFontSize = void 0;
    824     this.style = void 0;
    825     this.children = children;
    826     this.classes = [];
    827     this.height = 0;
    828     this.depth = 0;
    829     this.maxFontSize = 0;
    830     this.style = {};
    831   }
    832 
    833   var _proto = DocumentFragment.prototype;
    834 
    835   _proto.hasClass = function hasClass(className) {
    836     return utils.contains(this.classes, className);
    837   }
    838   /** Convert the fragment into a node. */
    839   ;
    840 
    841   _proto.toNode = function toNode() {
    842     var frag = document.createDocumentFragment();
    843 
    844     for (var i = 0; i < this.children.length; i++) {
    845       frag.appendChild(this.children[i].toNode());
    846     }
    847 
    848     return frag;
    849   }
    850   /** Convert the fragment into HTML markup. */
    851   ;
    852 
    853   _proto.toMarkup = function toMarkup() {
    854     var markup = ""; // Simply concatenate the markup for the children together.
    855 
    856     for (var i = 0; i < this.children.length; i++) {
    857       markup += this.children[i].toMarkup();
    858     }
    859 
    860     return markup;
    861   }
    862   /**
    863    * Converts the math node into a string, similar to innerText. Applies to
    864    * MathDomNode's only.
    865    */
    866   ;
    867 
    868   _proto.toText = function toText() {
    869     // To avoid this, we would subclass documentFragment separately for
    870     // MathML, but polyfills for subclassing is expensive per PR 1469.
    871     // $FlowFixMe: Only works for ChildType = MathDomNode.
    872     var toText = function toText(child) {
    873       return child.toText();
    874     };
    875 
    876     return this.children.map(toText).join("");
    877   };
    878 
    879   return DocumentFragment;
    880 }();
    881 ;// CONCATENATED MODULE: ./src/domTree.js
    882 /**
    883  * These objects store the data about the DOM nodes we create, as well as some
    884  * extra data. They can then be transformed into real DOM nodes with the
    885  * `toNode` function or HTML markup using `toMarkup`. They are useful for both
    886  * storing extra properties on the nodes, as well as providing a way to easily
    887  * work with the DOM.
    888  *
    889  * Similar functions for working with MathML nodes exist in mathMLTree.js.
    890  *
    891  * TODO: refactor `span` and `anchor` into common superclass when
    892  * target environments support class inheritance
    893  */
    894 
    895 
    896 
    897 
    898 
    899 /**
    900  * Create an HTML className based on a list of classes. In addition to joining
    901  * with spaces, we also remove empty classes.
    902  */
    903 var createClass = function createClass(classes) {
    904   return classes.filter(function (cls) {
    905     return cls;
    906   }).join(" ");
    907 };
    908 
    909 var initNode = function initNode(classes, options, style) {
    910   this.classes = classes || [];
    911   this.attributes = {};
    912   this.height = 0;
    913   this.depth = 0;
    914   this.maxFontSize = 0;
    915   this.style = style || {};
    916 
    917   if (options) {
    918     if (options.style.isTight()) {
    919       this.classes.push("mtight");
    920     }
    921 
    922     var color = options.getColor();
    923 
    924     if (color) {
    925       this.style.color = color;
    926     }
    927   }
    928 };
    929 /**
    930  * Convert into an HTML node
    931  */
    932 
    933 
    934 var _toNode = function toNode(tagName) {
    935   var node = document.createElement(tagName); // Apply the class
    936 
    937   node.className = createClass(this.classes); // Apply inline styles
    938 
    939   for (var style in this.style) {
    940     if (this.style.hasOwnProperty(style)) {
    941       // $FlowFixMe Flow doesn't seem to understand span.style's type.
    942       node.style[style] = this.style[style];
    943     }
    944   } // Apply attributes
    945 
    946 
    947   for (var attr in this.attributes) {
    948     if (this.attributes.hasOwnProperty(attr)) {
    949       node.setAttribute(attr, this.attributes[attr]);
    950     }
    951   } // Append the children, also as HTML nodes
    952 
    953 
    954   for (var i = 0; i < this.children.length; i++) {
    955     node.appendChild(this.children[i].toNode());
    956   }
    957 
    958   return node;
    959 };
    960 /**
    961  * Convert into an HTML markup string
    962  */
    963 
    964 
    965 var _toMarkup = function toMarkup(tagName) {
    966   var markup = "<" + tagName; // Add the class
    967 
    968   if (this.classes.length) {
    969     markup += " class=\"" + utils.escape(createClass(this.classes)) + "\"";
    970   }
    971 
    972   var styles = ""; // Add the styles, after hyphenation
    973 
    974   for (var style in this.style) {
    975     if (this.style.hasOwnProperty(style)) {
    976       styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
    977     }
    978   }
    979 
    980   if (styles) {
    981     markup += " style=\"" + utils.escape(styles) + "\"";
    982   } // Add the attributes
    983 
    984 
    985   for (var attr in this.attributes) {
    986     if (this.attributes.hasOwnProperty(attr)) {
    987       markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\"";
    988     }
    989   }
    990 
    991   markup += ">"; // Add the markup of the children, also as markup
    992 
    993   for (var i = 0; i < this.children.length; i++) {
    994     markup += this.children[i].toMarkup();
    995   }
    996 
    997   markup += "</" + tagName + ">";
    998   return markup;
    999 }; // Making the type below exact with all optional fields doesn't work due to
   1000 // - https://github.com/facebook/flow/issues/4582
   1001 // - https://github.com/facebook/flow/issues/5688
   1002 // However, since *all* fields are optional, $Shape<> works as suggested in 5688
   1003 // above.
   1004 // This type does not include all CSS properties. Additional properties should
   1005 // be added as needed.
   1006 
   1007 
   1008 /**
   1009  * This node represents a span node, with a className, a list of children, and
   1010  * an inline style. It also contains information about its height, depth, and
   1011  * maxFontSize.
   1012  *
   1013  * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan
   1014  * otherwise. This typesafety is important when HTML builders access a span's
   1015  * children.
   1016  */
   1017 var Span = /*#__PURE__*/function () {
   1018   function Span(classes, children, options, style) {
   1019     this.children = void 0;
   1020     this.attributes = void 0;
   1021     this.classes = void 0;
   1022     this.height = void 0;
   1023     this.depth = void 0;
   1024     this.width = void 0;
   1025     this.maxFontSize = void 0;
   1026     this.style = void 0;
   1027     initNode.call(this, classes, options, style);
   1028     this.children = children || [];
   1029   }
   1030   /**
   1031    * Sets an arbitrary attribute on the span. Warning: use this wisely. Not
   1032    * all browsers support attributes the same, and having too many custom
   1033    * attributes is probably bad.
   1034    */
   1035 
   1036 
   1037   var _proto = Span.prototype;
   1038 
   1039   _proto.setAttribute = function setAttribute(attribute, value) {
   1040     this.attributes[attribute] = value;
   1041   };
   1042 
   1043   _proto.hasClass = function hasClass(className) {
   1044     return utils.contains(this.classes, className);
   1045   };
   1046 
   1047   _proto.toNode = function toNode() {
   1048     return _toNode.call(this, "span");
   1049   };
   1050 
   1051   _proto.toMarkup = function toMarkup() {
   1052     return _toMarkup.call(this, "span");
   1053   };
   1054 
   1055   return Span;
   1056 }();
   1057 /**
   1058  * This node represents an anchor (<a>) element with a hyperlink.  See `span`
   1059  * for further details.
   1060  */
   1061 
   1062 var Anchor = /*#__PURE__*/function () {
   1063   function Anchor(href, classes, children, options) {
   1064     this.children = void 0;
   1065     this.attributes = void 0;
   1066     this.classes = void 0;
   1067     this.height = void 0;
   1068     this.depth = void 0;
   1069     this.maxFontSize = void 0;
   1070     this.style = void 0;
   1071     initNode.call(this, classes, options);
   1072     this.children = children || [];
   1073     this.setAttribute('href', href);
   1074   }
   1075 
   1076   var _proto2 = Anchor.prototype;
   1077 
   1078   _proto2.setAttribute = function setAttribute(attribute, value) {
   1079     this.attributes[attribute] = value;
   1080   };
   1081 
   1082   _proto2.hasClass = function hasClass(className) {
   1083     return utils.contains(this.classes, className);
   1084   };
   1085 
   1086   _proto2.toNode = function toNode() {
   1087     return _toNode.call(this, "a");
   1088   };
   1089 
   1090   _proto2.toMarkup = function toMarkup() {
   1091     return _toMarkup.call(this, "a");
   1092   };
   1093 
   1094   return Anchor;
   1095 }();
   1096 /**
   1097  * This node represents an image embed (<img>) element.
   1098  */
   1099 
   1100 var Img = /*#__PURE__*/function () {
   1101   function Img(src, alt, style) {
   1102     this.src = void 0;
   1103     this.alt = void 0;
   1104     this.classes = void 0;
   1105     this.height = void 0;
   1106     this.depth = void 0;
   1107     this.maxFontSize = void 0;
   1108     this.style = void 0;
   1109     this.alt = alt;
   1110     this.src = src;
   1111     this.classes = ["mord"];
   1112     this.style = style;
   1113   }
   1114 
   1115   var _proto3 = Img.prototype;
   1116 
   1117   _proto3.hasClass = function hasClass(className) {
   1118     return utils.contains(this.classes, className);
   1119   };
   1120 
   1121   _proto3.toNode = function toNode() {
   1122     var node = document.createElement("img");
   1123     node.src = this.src;
   1124     node.alt = this.alt;
   1125     node.className = "mord"; // Apply inline styles
   1126 
   1127     for (var style in this.style) {
   1128       if (this.style.hasOwnProperty(style)) {
   1129         // $FlowFixMe
   1130         node.style[style] = this.style[style];
   1131       }
   1132     }
   1133 
   1134     return node;
   1135   };
   1136 
   1137   _proto3.toMarkup = function toMarkup() {
   1138     var markup = "<img  src='" + this.src + " 'alt='" + this.alt + "' "; // Add the styles, after hyphenation
   1139 
   1140     var styles = "";
   1141 
   1142     for (var style in this.style) {
   1143       if (this.style.hasOwnProperty(style)) {
   1144         styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
   1145       }
   1146     }
   1147 
   1148     if (styles) {
   1149       markup += " style=\"" + utils.escape(styles) + "\"";
   1150     }
   1151 
   1152     markup += "'/>";
   1153     return markup;
   1154   };
   1155 
   1156   return Img;
   1157 }();
   1158 var iCombinations = {
   1159   'î': "\u0131\u0302",
   1160   'ï': "\u0131\u0308",
   1161   'í': "\u0131\u0301",
   1162   // 'ī': '\u0131\u0304', // enable when we add Extended Latin
   1163   'ì': "\u0131\u0300"
   1164 };
   1165 /**
   1166  * A symbol node contains information about a single symbol. It either renders
   1167  * to a single text node, or a span with a single text node in it, depending on
   1168  * whether it has CSS classes, styles, or needs italic correction.
   1169  */
   1170 
   1171 var SymbolNode = /*#__PURE__*/function () {
   1172   function SymbolNode(text, height, depth, italic, skew, width, classes, style) {
   1173     this.text = void 0;
   1174     this.height = void 0;
   1175     this.depth = void 0;
   1176     this.italic = void 0;
   1177     this.skew = void 0;
   1178     this.width = void 0;
   1179     this.maxFontSize = void 0;
   1180     this.classes = void 0;
   1181     this.style = void 0;
   1182     this.text = text;
   1183     this.height = height || 0;
   1184     this.depth = depth || 0;
   1185     this.italic = italic || 0;
   1186     this.skew = skew || 0;
   1187     this.width = width || 0;
   1188     this.classes = classes || [];
   1189     this.style = style || {};
   1190     this.maxFontSize = 0; // Mark text from non-Latin scripts with specific classes so that we
   1191     // can specify which fonts to use.  This allows us to render these
   1192     // characters with a serif font in situations where the browser would
   1193     // either default to a sans serif or render a placeholder character.
   1194     // We use CSS class names like cjk_fallback, hangul_fallback and
   1195     // brahmic_fallback. See ./unicodeScripts.js for the set of possible
   1196     // script names
   1197 
   1198     var script = scriptFromCodepoint(this.text.charCodeAt(0));
   1199 
   1200     if (script) {
   1201       this.classes.push(script + "_fallback");
   1202     }
   1203 
   1204     if (/[îïíì]/.test(this.text)) {
   1205       // add ī when we add Extended Latin
   1206       this.text = iCombinations[this.text];
   1207     }
   1208   }
   1209 
   1210   var _proto4 = SymbolNode.prototype;
   1211 
   1212   _proto4.hasClass = function hasClass(className) {
   1213     return utils.contains(this.classes, className);
   1214   }
   1215   /**
   1216    * Creates a text node or span from a symbol node. Note that a span is only
   1217    * created if it is needed.
   1218    */
   1219   ;
   1220 
   1221   _proto4.toNode = function toNode() {
   1222     var node = document.createTextNode(this.text);
   1223     var span = null;
   1224 
   1225     if (this.italic > 0) {
   1226       span = document.createElement("span");
   1227       span.style.marginRight = this.italic + "em";
   1228     }
   1229 
   1230     if (this.classes.length > 0) {
   1231       span = span || document.createElement("span");
   1232       span.className = createClass(this.classes);
   1233     }
   1234 
   1235     for (var style in this.style) {
   1236       if (this.style.hasOwnProperty(style)) {
   1237         span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type.
   1238 
   1239         span.style[style] = this.style[style];
   1240       }
   1241     }
   1242 
   1243     if (span) {
   1244       span.appendChild(node);
   1245       return span;
   1246     } else {
   1247       return node;
   1248     }
   1249   }
   1250   /**
   1251    * Creates markup for a symbol node.
   1252    */
   1253   ;
   1254 
   1255   _proto4.toMarkup = function toMarkup() {
   1256     // TODO(alpert): More duplication than I'd like from
   1257     // span.prototype.toMarkup and symbolNode.prototype.toNode...
   1258     var needsSpan = false;
   1259     var markup = "<span";
   1260 
   1261     if (this.classes.length) {
   1262       needsSpan = true;
   1263       markup += " class=\"";
   1264       markup += utils.escape(createClass(this.classes));
   1265       markup += "\"";
   1266     }
   1267 
   1268     var styles = "";
   1269 
   1270     if (this.italic > 0) {
   1271       styles += "margin-right:" + this.italic + "em;";
   1272     }
   1273 
   1274     for (var style in this.style) {
   1275       if (this.style.hasOwnProperty(style)) {
   1276         styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
   1277       }
   1278     }
   1279 
   1280     if (styles) {
   1281       needsSpan = true;
   1282       markup += " style=\"" + utils.escape(styles) + "\"";
   1283     }
   1284 
   1285     var escaped = utils.escape(this.text);
   1286 
   1287     if (needsSpan) {
   1288       markup += ">";
   1289       markup += escaped;
   1290       markup += "</span>";
   1291       return markup;
   1292     } else {
   1293       return escaped;
   1294     }
   1295   };
   1296 
   1297   return SymbolNode;
   1298 }();
   1299 /**
   1300  * SVG nodes are used to render stretchy wide elements.
   1301  */
   1302 
   1303 var SvgNode = /*#__PURE__*/function () {
   1304   function SvgNode(children, attributes) {
   1305     this.children = void 0;
   1306     this.attributes = void 0;
   1307     this.children = children || [];
   1308     this.attributes = attributes || {};
   1309   }
   1310 
   1311   var _proto5 = SvgNode.prototype;
   1312 
   1313   _proto5.toNode = function toNode() {
   1314     var svgNS = "http://www.w3.org/2000/svg";
   1315     var node = document.createElementNS(svgNS, "svg"); // Apply attributes
   1316 
   1317     for (var attr in this.attributes) {
   1318       if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
   1319         node.setAttribute(attr, this.attributes[attr]);
   1320       }
   1321     }
   1322 
   1323     for (var i = 0; i < this.children.length; i++) {
   1324       node.appendChild(this.children[i].toNode());
   1325     }
   1326 
   1327     return node;
   1328   };
   1329 
   1330   _proto5.toMarkup = function toMarkup() {
   1331     var markup = "<svg"; // Apply attributes
   1332 
   1333     for (var attr in this.attributes) {
   1334       if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
   1335         markup += " " + attr + "='" + this.attributes[attr] + "'";
   1336       }
   1337     }
   1338 
   1339     markup += ">";
   1340 
   1341     for (var i = 0; i < this.children.length; i++) {
   1342       markup += this.children[i].toMarkup();
   1343     }
   1344 
   1345     markup += "</svg>";
   1346     return markup;
   1347   };
   1348 
   1349   return SvgNode;
   1350 }();
   1351 var PathNode = /*#__PURE__*/function () {
   1352   function PathNode(pathName, alternate) {
   1353     this.pathName = void 0;
   1354     this.alternate = void 0;
   1355     this.pathName = pathName;
   1356     this.alternate = alternate; // Used only for \sqrt, \phase, & tall delims
   1357   }
   1358 
   1359   var _proto6 = PathNode.prototype;
   1360 
   1361   _proto6.toNode = function toNode() {
   1362     var svgNS = "http://www.w3.org/2000/svg";
   1363     var node = document.createElementNS(svgNS, "path");
   1364 
   1365     if (this.alternate) {
   1366       node.setAttribute("d", this.alternate);
   1367     } else {
   1368       node.setAttribute("d", path[this.pathName]);
   1369     }
   1370 
   1371     return node;
   1372   };
   1373 
   1374   _proto6.toMarkup = function toMarkup() {
   1375     if (this.alternate) {
   1376       return "<path d='" + this.alternate + "'/>";
   1377     } else {
   1378       return "<path d='" + path[this.pathName] + "'/>";
   1379     }
   1380   };
   1381 
   1382   return PathNode;
   1383 }();
   1384 var LineNode = /*#__PURE__*/function () {
   1385   function LineNode(attributes) {
   1386     this.attributes = void 0;
   1387     this.attributes = attributes || {};
   1388   }
   1389 
   1390   var _proto7 = LineNode.prototype;
   1391 
   1392   _proto7.toNode = function toNode() {
   1393     var svgNS = "http://www.w3.org/2000/svg";
   1394     var node = document.createElementNS(svgNS, "line"); // Apply attributes
   1395 
   1396     for (var attr in this.attributes) {
   1397       if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
   1398         node.setAttribute(attr, this.attributes[attr]);
   1399       }
   1400     }
   1401 
   1402     return node;
   1403   };
   1404 
   1405   _proto7.toMarkup = function toMarkup() {
   1406     var markup = "<line";
   1407 
   1408     for (var attr in this.attributes) {
   1409       if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
   1410         markup += " " + attr + "='" + this.attributes[attr] + "'";
   1411       }
   1412     }
   1413 
   1414     markup += "/>";
   1415     return markup;
   1416   };
   1417 
   1418   return LineNode;
   1419 }();
   1420 function assertSymbolDomNode(group) {
   1421   if (group instanceof SymbolNode) {
   1422     return group;
   1423   } else {
   1424     throw new Error("Expected symbolNode but got " + String(group) + ".");
   1425   }
   1426 }
   1427 function assertSpan(group) {
   1428   if (group instanceof Span) {
   1429     return group;
   1430   } else {
   1431     throw new Error("Expected span<HtmlDomNode> but got " + String(group) + ".");
   1432   }
   1433 }
   1434 ;// CONCATENATED MODULE: ./submodules/katex-fonts/fontMetricsData.js
   1435 // This file is GENERATED by buildMetrics.sh. DO NOT MODIFY.
   1436 /* harmony default export */ var fontMetricsData = ({
   1437   "AMS-Regular": {
   1438     "32": [0, 0, 0, 0, 0.25],
   1439     "65": [0, 0.68889, 0, 0, 0.72222],
   1440     "66": [0, 0.68889, 0, 0, 0.66667],
   1441     "67": [0, 0.68889, 0, 0, 0.72222],
   1442     "68": [0, 0.68889, 0, 0, 0.72222],
   1443     "69": [0, 0.68889, 0, 0, 0.66667],
   1444     "70": [0, 0.68889, 0, 0, 0.61111],
   1445     "71": [0, 0.68889, 0, 0, 0.77778],
   1446     "72": [0, 0.68889, 0, 0, 0.77778],
   1447     "73": [0, 0.68889, 0, 0, 0.38889],
   1448     "74": [0.16667, 0.68889, 0, 0, 0.5],
   1449     "75": [0, 0.68889, 0, 0, 0.77778],
   1450     "76": [0, 0.68889, 0, 0, 0.66667],
   1451     "77": [0, 0.68889, 0, 0, 0.94445],
   1452     "78": [0, 0.68889, 0, 0, 0.72222],
   1453     "79": [0.16667, 0.68889, 0, 0, 0.77778],
   1454     "80": [0, 0.68889, 0, 0, 0.61111],
   1455     "81": [0.16667, 0.68889, 0, 0, 0.77778],
   1456     "82": [0, 0.68889, 0, 0, 0.72222],
   1457     "83": [0, 0.68889, 0, 0, 0.55556],
   1458     "84": [0, 0.68889, 0, 0, 0.66667],
   1459     "85": [0, 0.68889, 0, 0, 0.72222],
   1460     "86": [0, 0.68889, 0, 0, 0.72222],
   1461     "87": [0, 0.68889, 0, 0, 1.0],
   1462     "88": [0, 0.68889, 0, 0, 0.72222],
   1463     "89": [0, 0.68889, 0, 0, 0.72222],
   1464     "90": [0, 0.68889, 0, 0, 0.66667],
   1465     "107": [0, 0.68889, 0, 0, 0.55556],
   1466     "160": [0, 0, 0, 0, 0.25],
   1467     "165": [0, 0.675, 0.025, 0, 0.75],
   1468     "174": [0.15559, 0.69224, 0, 0, 0.94666],
   1469     "240": [0, 0.68889, 0, 0, 0.55556],
   1470     "295": [0, 0.68889, 0, 0, 0.54028],
   1471     "710": [0, 0.825, 0, 0, 2.33334],
   1472     "732": [0, 0.9, 0, 0, 2.33334],
   1473     "770": [0, 0.825, 0, 0, 2.33334],
   1474     "771": [0, 0.9, 0, 0, 2.33334],
   1475     "989": [0.08167, 0.58167, 0, 0, 0.77778],
   1476     "1008": [0, 0.43056, 0.04028, 0, 0.66667],
   1477     "8245": [0, 0.54986, 0, 0, 0.275],
   1478     "8463": [0, 0.68889, 0, 0, 0.54028],
   1479     "8487": [0, 0.68889, 0, 0, 0.72222],
   1480     "8498": [0, 0.68889, 0, 0, 0.55556],
   1481     "8502": [0, 0.68889, 0, 0, 0.66667],
   1482     "8503": [0, 0.68889, 0, 0, 0.44445],
   1483     "8504": [0, 0.68889, 0, 0, 0.66667],
   1484     "8513": [0, 0.68889, 0, 0, 0.63889],
   1485     "8592": [-0.03598, 0.46402, 0, 0, 0.5],
   1486     "8594": [-0.03598, 0.46402, 0, 0, 0.5],
   1487     "8602": [-0.13313, 0.36687, 0, 0, 1.0],
   1488     "8603": [-0.13313, 0.36687, 0, 0, 1.0],
   1489     "8606": [0.01354, 0.52239, 0, 0, 1.0],
   1490     "8608": [0.01354, 0.52239, 0, 0, 1.0],
   1491     "8610": [0.01354, 0.52239, 0, 0, 1.11111],
   1492     "8611": [0.01354, 0.52239, 0, 0, 1.11111],
   1493     "8619": [0, 0.54986, 0, 0, 1.0],
   1494     "8620": [0, 0.54986, 0, 0, 1.0],
   1495     "8621": [-0.13313, 0.37788, 0, 0, 1.38889],
   1496     "8622": [-0.13313, 0.36687, 0, 0, 1.0],
   1497     "8624": [0, 0.69224, 0, 0, 0.5],
   1498     "8625": [0, 0.69224, 0, 0, 0.5],
   1499     "8630": [0, 0.43056, 0, 0, 1.0],
   1500     "8631": [0, 0.43056, 0, 0, 1.0],
   1501     "8634": [0.08198, 0.58198, 0, 0, 0.77778],
   1502     "8635": [0.08198, 0.58198, 0, 0, 0.77778],
   1503     "8638": [0.19444, 0.69224, 0, 0, 0.41667],
   1504     "8639": [0.19444, 0.69224, 0, 0, 0.41667],
   1505     "8642": [0.19444, 0.69224, 0, 0, 0.41667],
   1506     "8643": [0.19444, 0.69224, 0, 0, 0.41667],
   1507     "8644": [0.1808, 0.675, 0, 0, 1.0],
   1508     "8646": [0.1808, 0.675, 0, 0, 1.0],
   1509     "8647": [0.1808, 0.675, 0, 0, 1.0],
   1510     "8648": [0.19444, 0.69224, 0, 0, 0.83334],
   1511     "8649": [0.1808, 0.675, 0, 0, 1.0],
   1512     "8650": [0.19444, 0.69224, 0, 0, 0.83334],
   1513     "8651": [0.01354, 0.52239, 0, 0, 1.0],
   1514     "8652": [0.01354, 0.52239, 0, 0, 1.0],
   1515     "8653": [-0.13313, 0.36687, 0, 0, 1.0],
   1516     "8654": [-0.13313, 0.36687, 0, 0, 1.0],
   1517     "8655": [-0.13313, 0.36687, 0, 0, 1.0],
   1518     "8666": [0.13667, 0.63667, 0, 0, 1.0],
   1519     "8667": [0.13667, 0.63667, 0, 0, 1.0],
   1520     "8669": [-0.13313, 0.37788, 0, 0, 1.0],
   1521     "8672": [-0.064, 0.437, 0, 0, 1.334],
   1522     "8674": [-0.064, 0.437, 0, 0, 1.334],
   1523     "8705": [0, 0.825, 0, 0, 0.5],
   1524     "8708": [0, 0.68889, 0, 0, 0.55556],
   1525     "8709": [0.08167, 0.58167, 0, 0, 0.77778],
   1526     "8717": [0, 0.43056, 0, 0, 0.42917],
   1527     "8722": [-0.03598, 0.46402, 0, 0, 0.5],
   1528     "8724": [0.08198, 0.69224, 0, 0, 0.77778],
   1529     "8726": [0.08167, 0.58167, 0, 0, 0.77778],
   1530     "8733": [0, 0.69224, 0, 0, 0.77778],
   1531     "8736": [0, 0.69224, 0, 0, 0.72222],
   1532     "8737": [0, 0.69224, 0, 0, 0.72222],
   1533     "8738": [0.03517, 0.52239, 0, 0, 0.72222],
   1534     "8739": [0.08167, 0.58167, 0, 0, 0.22222],
   1535     "8740": [0.25142, 0.74111, 0, 0, 0.27778],
   1536     "8741": [0.08167, 0.58167, 0, 0, 0.38889],
   1537     "8742": [0.25142, 0.74111, 0, 0, 0.5],
   1538     "8756": [0, 0.69224, 0, 0, 0.66667],
   1539     "8757": [0, 0.69224, 0, 0, 0.66667],
   1540     "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
   1541     "8765": [-0.13313, 0.37788, 0, 0, 0.77778],
   1542     "8769": [-0.13313, 0.36687, 0, 0, 0.77778],
   1543     "8770": [-0.03625, 0.46375, 0, 0, 0.77778],
   1544     "8774": [0.30274, 0.79383, 0, 0, 0.77778],
   1545     "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
   1546     "8778": [0.08167, 0.58167, 0, 0, 0.77778],
   1547     "8782": [0.06062, 0.54986, 0, 0, 0.77778],
   1548     "8783": [0.06062, 0.54986, 0, 0, 0.77778],
   1549     "8785": [0.08198, 0.58198, 0, 0, 0.77778],
   1550     "8786": [0.08198, 0.58198, 0, 0, 0.77778],
   1551     "8787": [0.08198, 0.58198, 0, 0, 0.77778],
   1552     "8790": [0, 0.69224, 0, 0, 0.77778],
   1553     "8791": [0.22958, 0.72958, 0, 0, 0.77778],
   1554     "8796": [0.08198, 0.91667, 0, 0, 0.77778],
   1555     "8806": [0.25583, 0.75583, 0, 0, 0.77778],
   1556     "8807": [0.25583, 0.75583, 0, 0, 0.77778],
   1557     "8808": [0.25142, 0.75726, 0, 0, 0.77778],
   1558     "8809": [0.25142, 0.75726, 0, 0, 0.77778],
   1559     "8812": [0.25583, 0.75583, 0, 0, 0.5],
   1560     "8814": [0.20576, 0.70576, 0, 0, 0.77778],
   1561     "8815": [0.20576, 0.70576, 0, 0, 0.77778],
   1562     "8816": [0.30274, 0.79383, 0, 0, 0.77778],
   1563     "8817": [0.30274, 0.79383, 0, 0, 0.77778],
   1564     "8818": [0.22958, 0.72958, 0, 0, 0.77778],
   1565     "8819": [0.22958, 0.72958, 0, 0, 0.77778],
   1566     "8822": [0.1808, 0.675, 0, 0, 0.77778],
   1567     "8823": [0.1808, 0.675, 0, 0, 0.77778],
   1568     "8828": [0.13667, 0.63667, 0, 0, 0.77778],
   1569     "8829": [0.13667, 0.63667, 0, 0, 0.77778],
   1570     "8830": [0.22958, 0.72958, 0, 0, 0.77778],
   1571     "8831": [0.22958, 0.72958, 0, 0, 0.77778],
   1572     "8832": [0.20576, 0.70576, 0, 0, 0.77778],
   1573     "8833": [0.20576, 0.70576, 0, 0, 0.77778],
   1574     "8840": [0.30274, 0.79383, 0, 0, 0.77778],
   1575     "8841": [0.30274, 0.79383, 0, 0, 0.77778],
   1576     "8842": [0.13597, 0.63597, 0, 0, 0.77778],
   1577     "8843": [0.13597, 0.63597, 0, 0, 0.77778],
   1578     "8847": [0.03517, 0.54986, 0, 0, 0.77778],
   1579     "8848": [0.03517, 0.54986, 0, 0, 0.77778],
   1580     "8858": [0.08198, 0.58198, 0, 0, 0.77778],
   1581     "8859": [0.08198, 0.58198, 0, 0, 0.77778],
   1582     "8861": [0.08198, 0.58198, 0, 0, 0.77778],
   1583     "8862": [0, 0.675, 0, 0, 0.77778],
   1584     "8863": [0, 0.675, 0, 0, 0.77778],
   1585     "8864": [0, 0.675, 0, 0, 0.77778],
   1586     "8865": [0, 0.675, 0, 0, 0.77778],
   1587     "8872": [0, 0.69224, 0, 0, 0.61111],
   1588     "8873": [0, 0.69224, 0, 0, 0.72222],
   1589     "8874": [0, 0.69224, 0, 0, 0.88889],
   1590     "8876": [0, 0.68889, 0, 0, 0.61111],
   1591     "8877": [0, 0.68889, 0, 0, 0.61111],
   1592     "8878": [0, 0.68889, 0, 0, 0.72222],
   1593     "8879": [0, 0.68889, 0, 0, 0.72222],
   1594     "8882": [0.03517, 0.54986, 0, 0, 0.77778],
   1595     "8883": [0.03517, 0.54986, 0, 0, 0.77778],
   1596     "8884": [0.13667, 0.63667, 0, 0, 0.77778],
   1597     "8885": [0.13667, 0.63667, 0, 0, 0.77778],
   1598     "8888": [0, 0.54986, 0, 0, 1.11111],
   1599     "8890": [0.19444, 0.43056, 0, 0, 0.55556],
   1600     "8891": [0.19444, 0.69224, 0, 0, 0.61111],
   1601     "8892": [0.19444, 0.69224, 0, 0, 0.61111],
   1602     "8901": [0, 0.54986, 0, 0, 0.27778],
   1603     "8903": [0.08167, 0.58167, 0, 0, 0.77778],
   1604     "8905": [0.08167, 0.58167, 0, 0, 0.77778],
   1605     "8906": [0.08167, 0.58167, 0, 0, 0.77778],
   1606     "8907": [0, 0.69224, 0, 0, 0.77778],
   1607     "8908": [0, 0.69224, 0, 0, 0.77778],
   1608     "8909": [-0.03598, 0.46402, 0, 0, 0.77778],
   1609     "8910": [0, 0.54986, 0, 0, 0.76042],
   1610     "8911": [0, 0.54986, 0, 0, 0.76042],
   1611     "8912": [0.03517, 0.54986, 0, 0, 0.77778],
   1612     "8913": [0.03517, 0.54986, 0, 0, 0.77778],
   1613     "8914": [0, 0.54986, 0, 0, 0.66667],
   1614     "8915": [0, 0.54986, 0, 0, 0.66667],
   1615     "8916": [0, 0.69224, 0, 0, 0.66667],
   1616     "8918": [0.0391, 0.5391, 0, 0, 0.77778],
   1617     "8919": [0.0391, 0.5391, 0, 0, 0.77778],
   1618     "8920": [0.03517, 0.54986, 0, 0, 1.33334],
   1619     "8921": [0.03517, 0.54986, 0, 0, 1.33334],
   1620     "8922": [0.38569, 0.88569, 0, 0, 0.77778],
   1621     "8923": [0.38569, 0.88569, 0, 0, 0.77778],
   1622     "8926": [0.13667, 0.63667, 0, 0, 0.77778],
   1623     "8927": [0.13667, 0.63667, 0, 0, 0.77778],
   1624     "8928": [0.30274, 0.79383, 0, 0, 0.77778],
   1625     "8929": [0.30274, 0.79383, 0, 0, 0.77778],
   1626     "8934": [0.23222, 0.74111, 0, 0, 0.77778],
   1627     "8935": [0.23222, 0.74111, 0, 0, 0.77778],
   1628     "8936": [0.23222, 0.74111, 0, 0, 0.77778],
   1629     "8937": [0.23222, 0.74111, 0, 0, 0.77778],
   1630     "8938": [0.20576, 0.70576, 0, 0, 0.77778],
   1631     "8939": [0.20576, 0.70576, 0, 0, 0.77778],
   1632     "8940": [0.30274, 0.79383, 0, 0, 0.77778],
   1633     "8941": [0.30274, 0.79383, 0, 0, 0.77778],
   1634     "8994": [0.19444, 0.69224, 0, 0, 0.77778],
   1635     "8995": [0.19444, 0.69224, 0, 0, 0.77778],
   1636     "9416": [0.15559, 0.69224, 0, 0, 0.90222],
   1637     "9484": [0, 0.69224, 0, 0, 0.5],
   1638     "9488": [0, 0.69224, 0, 0, 0.5],
   1639     "9492": [0, 0.37788, 0, 0, 0.5],
   1640     "9496": [0, 0.37788, 0, 0, 0.5],
   1641     "9585": [0.19444, 0.68889, 0, 0, 0.88889],
   1642     "9586": [0.19444, 0.74111, 0, 0, 0.88889],
   1643     "9632": [0, 0.675, 0, 0, 0.77778],
   1644     "9633": [0, 0.675, 0, 0, 0.77778],
   1645     "9650": [0, 0.54986, 0, 0, 0.72222],
   1646     "9651": [0, 0.54986, 0, 0, 0.72222],
   1647     "9654": [0.03517, 0.54986, 0, 0, 0.77778],
   1648     "9660": [0, 0.54986, 0, 0, 0.72222],
   1649     "9661": [0, 0.54986, 0, 0, 0.72222],
   1650     "9664": [0.03517, 0.54986, 0, 0, 0.77778],
   1651     "9674": [0.11111, 0.69224, 0, 0, 0.66667],
   1652     "9733": [0.19444, 0.69224, 0, 0, 0.94445],
   1653     "10003": [0, 0.69224, 0, 0, 0.83334],
   1654     "10016": [0, 0.69224, 0, 0, 0.83334],
   1655     "10731": [0.11111, 0.69224, 0, 0, 0.66667],
   1656     "10846": [0.19444, 0.75583, 0, 0, 0.61111],
   1657     "10877": [0.13667, 0.63667, 0, 0, 0.77778],
   1658     "10878": [0.13667, 0.63667, 0, 0, 0.77778],
   1659     "10885": [0.25583, 0.75583, 0, 0, 0.77778],
   1660     "10886": [0.25583, 0.75583, 0, 0, 0.77778],
   1661     "10887": [0.13597, 0.63597, 0, 0, 0.77778],
   1662     "10888": [0.13597, 0.63597, 0, 0, 0.77778],
   1663     "10889": [0.26167, 0.75726, 0, 0, 0.77778],
   1664     "10890": [0.26167, 0.75726, 0, 0, 0.77778],
   1665     "10891": [0.48256, 0.98256, 0, 0, 0.77778],
   1666     "10892": [0.48256, 0.98256, 0, 0, 0.77778],
   1667     "10901": [0.13667, 0.63667, 0, 0, 0.77778],
   1668     "10902": [0.13667, 0.63667, 0, 0, 0.77778],
   1669     "10933": [0.25142, 0.75726, 0, 0, 0.77778],
   1670     "10934": [0.25142, 0.75726, 0, 0, 0.77778],
   1671     "10935": [0.26167, 0.75726, 0, 0, 0.77778],
   1672     "10936": [0.26167, 0.75726, 0, 0, 0.77778],
   1673     "10937": [0.26167, 0.75726, 0, 0, 0.77778],
   1674     "10938": [0.26167, 0.75726, 0, 0, 0.77778],
   1675     "10949": [0.25583, 0.75583, 0, 0, 0.77778],
   1676     "10950": [0.25583, 0.75583, 0, 0, 0.77778],
   1677     "10955": [0.28481, 0.79383, 0, 0, 0.77778],
   1678     "10956": [0.28481, 0.79383, 0, 0, 0.77778],
   1679     "57350": [0.08167, 0.58167, 0, 0, 0.22222],
   1680     "57351": [0.08167, 0.58167, 0, 0, 0.38889],
   1681     "57352": [0.08167, 0.58167, 0, 0, 0.77778],
   1682     "57353": [0, 0.43056, 0.04028, 0, 0.66667],
   1683     "57356": [0.25142, 0.75726, 0, 0, 0.77778],
   1684     "57357": [0.25142, 0.75726, 0, 0, 0.77778],
   1685     "57358": [0.41951, 0.91951, 0, 0, 0.77778],
   1686     "57359": [0.30274, 0.79383, 0, 0, 0.77778],
   1687     "57360": [0.30274, 0.79383, 0, 0, 0.77778],
   1688     "57361": [0.41951, 0.91951, 0, 0, 0.77778],
   1689     "57366": [0.25142, 0.75726, 0, 0, 0.77778],
   1690     "57367": [0.25142, 0.75726, 0, 0, 0.77778],
   1691     "57368": [0.25142, 0.75726, 0, 0, 0.77778],
   1692     "57369": [0.25142, 0.75726, 0, 0, 0.77778],
   1693     "57370": [0.13597, 0.63597, 0, 0, 0.77778],
   1694     "57371": [0.13597, 0.63597, 0, 0, 0.77778]
   1695   },
   1696   "Caligraphic-Regular": {
   1697     "32": [0, 0, 0, 0, 0.25],
   1698     "65": [0, 0.68333, 0, 0.19445, 0.79847],
   1699     "66": [0, 0.68333, 0.03041, 0.13889, 0.65681],
   1700     "67": [0, 0.68333, 0.05834, 0.13889, 0.52653],
   1701     "68": [0, 0.68333, 0.02778, 0.08334, 0.77139],
   1702     "69": [0, 0.68333, 0.08944, 0.11111, 0.52778],
   1703     "70": [0, 0.68333, 0.09931, 0.11111, 0.71875],
   1704     "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487],
   1705     "72": [0, 0.68333, 0.00965, 0.11111, 0.84452],
   1706     "73": [0, 0.68333, 0.07382, 0, 0.54452],
   1707     "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778],
   1708     "75": [0, 0.68333, 0.01445, 0.05556, 0.76195],
   1709     "76": [0, 0.68333, 0, 0.13889, 0.68972],
   1710     "77": [0, 0.68333, 0, 0.13889, 1.2009],
   1711     "78": [0, 0.68333, 0.14736, 0.08334, 0.82049],
   1712     "79": [0, 0.68333, 0.02778, 0.11111, 0.79611],
   1713     "80": [0, 0.68333, 0.08222, 0.08334, 0.69556],
   1714     "81": [0.09722, 0.68333, 0, 0.11111, 0.81667],
   1715     "82": [0, 0.68333, 0, 0.08334, 0.8475],
   1716     "83": [0, 0.68333, 0.075, 0.13889, 0.60556],
   1717     "84": [0, 0.68333, 0.25417, 0, 0.54464],
   1718     "85": [0, 0.68333, 0.09931, 0.08334, 0.62583],
   1719     "86": [0, 0.68333, 0.08222, 0, 0.61278],
   1720     "87": [0, 0.68333, 0.08222, 0.08334, 0.98778],
   1721     "88": [0, 0.68333, 0.14643, 0.13889, 0.7133],
   1722     "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834],
   1723     "90": [0, 0.68333, 0.07944, 0.13889, 0.72473],
   1724     "160": [0, 0, 0, 0, 0.25]
   1725   },
   1726   "Fraktur-Regular": {
   1727     "32": [0, 0, 0, 0, 0.25],
   1728     "33": [0, 0.69141, 0, 0, 0.29574],
   1729     "34": [0, 0.69141, 0, 0, 0.21471],
   1730     "38": [0, 0.69141, 0, 0, 0.73786],
   1731     "39": [0, 0.69141, 0, 0, 0.21201],
   1732     "40": [0.24982, 0.74947, 0, 0, 0.38865],
   1733     "41": [0.24982, 0.74947, 0, 0, 0.38865],
   1734     "42": [0, 0.62119, 0, 0, 0.27764],
   1735     "43": [0.08319, 0.58283, 0, 0, 0.75623],
   1736     "44": [0, 0.10803, 0, 0, 0.27764],
   1737     "45": [0.08319, 0.58283, 0, 0, 0.75623],
   1738     "46": [0, 0.10803, 0, 0, 0.27764],
   1739     "47": [0.24982, 0.74947, 0, 0, 0.50181],
   1740     "48": [0, 0.47534, 0, 0, 0.50181],
   1741     "49": [0, 0.47534, 0, 0, 0.50181],
   1742     "50": [0, 0.47534, 0, 0, 0.50181],
   1743     "51": [0.18906, 0.47534, 0, 0, 0.50181],
   1744     "52": [0.18906, 0.47534, 0, 0, 0.50181],
   1745     "53": [0.18906, 0.47534, 0, 0, 0.50181],
   1746     "54": [0, 0.69141, 0, 0, 0.50181],
   1747     "55": [0.18906, 0.47534, 0, 0, 0.50181],
   1748     "56": [0, 0.69141, 0, 0, 0.50181],
   1749     "57": [0.18906, 0.47534, 0, 0, 0.50181],
   1750     "58": [0, 0.47534, 0, 0, 0.21606],
   1751     "59": [0.12604, 0.47534, 0, 0, 0.21606],
   1752     "61": [-0.13099, 0.36866, 0, 0, 0.75623],
   1753     "63": [0, 0.69141, 0, 0, 0.36245],
   1754     "65": [0, 0.69141, 0, 0, 0.7176],
   1755     "66": [0, 0.69141, 0, 0, 0.88397],
   1756     "67": [0, 0.69141, 0, 0, 0.61254],
   1757     "68": [0, 0.69141, 0, 0, 0.83158],
   1758     "69": [0, 0.69141, 0, 0, 0.66278],
   1759     "70": [0.12604, 0.69141, 0, 0, 0.61119],
   1760     "71": [0, 0.69141, 0, 0, 0.78539],
   1761     "72": [0.06302, 0.69141, 0, 0, 0.7203],
   1762     "73": [0, 0.69141, 0, 0, 0.55448],
   1763     "74": [0.12604, 0.69141, 0, 0, 0.55231],
   1764     "75": [0, 0.69141, 0, 0, 0.66845],
   1765     "76": [0, 0.69141, 0, 0, 0.66602],
   1766     "77": [0, 0.69141, 0, 0, 1.04953],
   1767     "78": [0, 0.69141, 0, 0, 0.83212],
   1768     "79": [0, 0.69141, 0, 0, 0.82699],
   1769     "80": [0.18906, 0.69141, 0, 0, 0.82753],
   1770     "81": [0.03781, 0.69141, 0, 0, 0.82699],
   1771     "82": [0, 0.69141, 0, 0, 0.82807],
   1772     "83": [0, 0.69141, 0, 0, 0.82861],
   1773     "84": [0, 0.69141, 0, 0, 0.66899],
   1774     "85": [0, 0.69141, 0, 0, 0.64576],
   1775     "86": [0, 0.69141, 0, 0, 0.83131],
   1776     "87": [0, 0.69141, 0, 0, 1.04602],
   1777     "88": [0, 0.69141, 0, 0, 0.71922],
   1778     "89": [0.18906, 0.69141, 0, 0, 0.83293],
   1779     "90": [0.12604, 0.69141, 0, 0, 0.60201],
   1780     "91": [0.24982, 0.74947, 0, 0, 0.27764],
   1781     "93": [0.24982, 0.74947, 0, 0, 0.27764],
   1782     "94": [0, 0.69141, 0, 0, 0.49965],
   1783     "97": [0, 0.47534, 0, 0, 0.50046],
   1784     "98": [0, 0.69141, 0, 0, 0.51315],
   1785     "99": [0, 0.47534, 0, 0, 0.38946],
   1786     "100": [0, 0.62119, 0, 0, 0.49857],
   1787     "101": [0, 0.47534, 0, 0, 0.40053],
   1788     "102": [0.18906, 0.69141, 0, 0, 0.32626],
   1789     "103": [0.18906, 0.47534, 0, 0, 0.5037],
   1790     "104": [0.18906, 0.69141, 0, 0, 0.52126],
   1791     "105": [0, 0.69141, 0, 0, 0.27899],
   1792     "106": [0, 0.69141, 0, 0, 0.28088],
   1793     "107": [0, 0.69141, 0, 0, 0.38946],
   1794     "108": [0, 0.69141, 0, 0, 0.27953],
   1795     "109": [0, 0.47534, 0, 0, 0.76676],
   1796     "110": [0, 0.47534, 0, 0, 0.52666],
   1797     "111": [0, 0.47534, 0, 0, 0.48885],
   1798     "112": [0.18906, 0.52396, 0, 0, 0.50046],
   1799     "113": [0.18906, 0.47534, 0, 0, 0.48912],
   1800     "114": [0, 0.47534, 0, 0, 0.38919],
   1801     "115": [0, 0.47534, 0, 0, 0.44266],
   1802     "116": [0, 0.62119, 0, 0, 0.33301],
   1803     "117": [0, 0.47534, 0, 0, 0.5172],
   1804     "118": [0, 0.52396, 0, 0, 0.5118],
   1805     "119": [0, 0.52396, 0, 0, 0.77351],
   1806     "120": [0.18906, 0.47534, 0, 0, 0.38865],
   1807     "121": [0.18906, 0.47534, 0, 0, 0.49884],
   1808     "122": [0.18906, 0.47534, 0, 0, 0.39054],
   1809     "160": [0, 0, 0, 0, 0.25],
   1810     "8216": [0, 0.69141, 0, 0, 0.21471],
   1811     "8217": [0, 0.69141, 0, 0, 0.21471],
   1812     "58112": [0, 0.62119, 0, 0, 0.49749],
   1813     "58113": [0, 0.62119, 0, 0, 0.4983],
   1814     "58114": [0.18906, 0.69141, 0, 0, 0.33328],
   1815     "58115": [0.18906, 0.69141, 0, 0, 0.32923],
   1816     "58116": [0.18906, 0.47534, 0, 0, 0.50343],
   1817     "58117": [0, 0.69141, 0, 0, 0.33301],
   1818     "58118": [0, 0.62119, 0, 0, 0.33409],
   1819     "58119": [0, 0.47534, 0, 0, 0.50073]
   1820   },
   1821   "Main-Bold": {
   1822     "32": [0, 0, 0, 0, 0.25],
   1823     "33": [0, 0.69444, 0, 0, 0.35],
   1824     "34": [0, 0.69444, 0, 0, 0.60278],
   1825     "35": [0.19444, 0.69444, 0, 0, 0.95833],
   1826     "36": [0.05556, 0.75, 0, 0, 0.575],
   1827     "37": [0.05556, 0.75, 0, 0, 0.95833],
   1828     "38": [0, 0.69444, 0, 0, 0.89444],
   1829     "39": [0, 0.69444, 0, 0, 0.31944],
   1830     "40": [0.25, 0.75, 0, 0, 0.44722],
   1831     "41": [0.25, 0.75, 0, 0, 0.44722],
   1832     "42": [0, 0.75, 0, 0, 0.575],
   1833     "43": [0.13333, 0.63333, 0, 0, 0.89444],
   1834     "44": [0.19444, 0.15556, 0, 0, 0.31944],
   1835     "45": [0, 0.44444, 0, 0, 0.38333],
   1836     "46": [0, 0.15556, 0, 0, 0.31944],
   1837     "47": [0.25, 0.75, 0, 0, 0.575],
   1838     "48": [0, 0.64444, 0, 0, 0.575],
   1839     "49": [0, 0.64444, 0, 0, 0.575],
   1840     "50": [0, 0.64444, 0, 0, 0.575],
   1841     "51": [0, 0.64444, 0, 0, 0.575],
   1842     "52": [0, 0.64444, 0, 0, 0.575],
   1843     "53": [0, 0.64444, 0, 0, 0.575],
   1844     "54": [0, 0.64444, 0, 0, 0.575],
   1845     "55": [0, 0.64444, 0, 0, 0.575],
   1846     "56": [0, 0.64444, 0, 0, 0.575],
   1847     "57": [0, 0.64444, 0, 0, 0.575],
   1848     "58": [0, 0.44444, 0, 0, 0.31944],
   1849     "59": [0.19444, 0.44444, 0, 0, 0.31944],
   1850     "60": [0.08556, 0.58556, 0, 0, 0.89444],
   1851     "61": [-0.10889, 0.39111, 0, 0, 0.89444],
   1852     "62": [0.08556, 0.58556, 0, 0, 0.89444],
   1853     "63": [0, 0.69444, 0, 0, 0.54305],
   1854     "64": [0, 0.69444, 0, 0, 0.89444],
   1855     "65": [0, 0.68611, 0, 0, 0.86944],
   1856     "66": [0, 0.68611, 0, 0, 0.81805],
   1857     "67": [0, 0.68611, 0, 0, 0.83055],
   1858     "68": [0, 0.68611, 0, 0, 0.88194],
   1859     "69": [0, 0.68611, 0, 0, 0.75555],
   1860     "70": [0, 0.68611, 0, 0, 0.72361],
   1861     "71": [0, 0.68611, 0, 0, 0.90416],
   1862     "72": [0, 0.68611, 0, 0, 0.9],
   1863     "73": [0, 0.68611, 0, 0, 0.43611],
   1864     "74": [0, 0.68611, 0, 0, 0.59444],
   1865     "75": [0, 0.68611, 0, 0, 0.90138],
   1866     "76": [0, 0.68611, 0, 0, 0.69166],
   1867     "77": [0, 0.68611, 0, 0, 1.09166],
   1868     "78": [0, 0.68611, 0, 0, 0.9],
   1869     "79": [0, 0.68611, 0, 0, 0.86388],
   1870     "80": [0, 0.68611, 0, 0, 0.78611],
   1871     "81": [0.19444, 0.68611, 0, 0, 0.86388],
   1872     "82": [0, 0.68611, 0, 0, 0.8625],
   1873     "83": [0, 0.68611, 0, 0, 0.63889],
   1874     "84": [0, 0.68611, 0, 0, 0.8],
   1875     "85": [0, 0.68611, 0, 0, 0.88472],
   1876     "86": [0, 0.68611, 0.01597, 0, 0.86944],
   1877     "87": [0, 0.68611, 0.01597, 0, 1.18888],
   1878     "88": [0, 0.68611, 0, 0, 0.86944],
   1879     "89": [0, 0.68611, 0.02875, 0, 0.86944],
   1880     "90": [0, 0.68611, 0, 0, 0.70277],
   1881     "91": [0.25, 0.75, 0, 0, 0.31944],
   1882     "92": [0.25, 0.75, 0, 0, 0.575],
   1883     "93": [0.25, 0.75, 0, 0, 0.31944],
   1884     "94": [0, 0.69444, 0, 0, 0.575],
   1885     "95": [0.31, 0.13444, 0.03194, 0, 0.575],
   1886     "97": [0, 0.44444, 0, 0, 0.55902],
   1887     "98": [0, 0.69444, 0, 0, 0.63889],
   1888     "99": [0, 0.44444, 0, 0, 0.51111],
   1889     "100": [0, 0.69444, 0, 0, 0.63889],
   1890     "101": [0, 0.44444, 0, 0, 0.52708],
   1891     "102": [0, 0.69444, 0.10903, 0, 0.35139],
   1892     "103": [0.19444, 0.44444, 0.01597, 0, 0.575],
   1893     "104": [0, 0.69444, 0, 0, 0.63889],
   1894     "105": [0, 0.69444, 0, 0, 0.31944],
   1895     "106": [0.19444, 0.69444, 0, 0, 0.35139],
   1896     "107": [0, 0.69444, 0, 0, 0.60694],
   1897     "108": [0, 0.69444, 0, 0, 0.31944],
   1898     "109": [0, 0.44444, 0, 0, 0.95833],
   1899     "110": [0, 0.44444, 0, 0, 0.63889],
   1900     "111": [0, 0.44444, 0, 0, 0.575],
   1901     "112": [0.19444, 0.44444, 0, 0, 0.63889],
   1902     "113": [0.19444, 0.44444, 0, 0, 0.60694],
   1903     "114": [0, 0.44444, 0, 0, 0.47361],
   1904     "115": [0, 0.44444, 0, 0, 0.45361],
   1905     "116": [0, 0.63492, 0, 0, 0.44722],
   1906     "117": [0, 0.44444, 0, 0, 0.63889],
   1907     "118": [0, 0.44444, 0.01597, 0, 0.60694],
   1908     "119": [0, 0.44444, 0.01597, 0, 0.83055],
   1909     "120": [0, 0.44444, 0, 0, 0.60694],
   1910     "121": [0.19444, 0.44444, 0.01597, 0, 0.60694],
   1911     "122": [0, 0.44444, 0, 0, 0.51111],
   1912     "123": [0.25, 0.75, 0, 0, 0.575],
   1913     "124": [0.25, 0.75, 0, 0, 0.31944],
   1914     "125": [0.25, 0.75, 0, 0, 0.575],
   1915     "126": [0.35, 0.34444, 0, 0, 0.575],
   1916     "160": [0, 0, 0, 0, 0.25],
   1917     "163": [0, 0.69444, 0, 0, 0.86853],
   1918     "168": [0, 0.69444, 0, 0, 0.575],
   1919     "172": [0, 0.44444, 0, 0, 0.76666],
   1920     "176": [0, 0.69444, 0, 0, 0.86944],
   1921     "177": [0.13333, 0.63333, 0, 0, 0.89444],
   1922     "184": [0.17014, 0, 0, 0, 0.51111],
   1923     "198": [0, 0.68611, 0, 0, 1.04166],
   1924     "215": [0.13333, 0.63333, 0, 0, 0.89444],
   1925     "216": [0.04861, 0.73472, 0, 0, 0.89444],
   1926     "223": [0, 0.69444, 0, 0, 0.59722],
   1927     "230": [0, 0.44444, 0, 0, 0.83055],
   1928     "247": [0.13333, 0.63333, 0, 0, 0.89444],
   1929     "248": [0.09722, 0.54167, 0, 0, 0.575],
   1930     "305": [0, 0.44444, 0, 0, 0.31944],
   1931     "338": [0, 0.68611, 0, 0, 1.16944],
   1932     "339": [0, 0.44444, 0, 0, 0.89444],
   1933     "567": [0.19444, 0.44444, 0, 0, 0.35139],
   1934     "710": [0, 0.69444, 0, 0, 0.575],
   1935     "711": [0, 0.63194, 0, 0, 0.575],
   1936     "713": [0, 0.59611, 0, 0, 0.575],
   1937     "714": [0, 0.69444, 0, 0, 0.575],
   1938     "715": [0, 0.69444, 0, 0, 0.575],
   1939     "728": [0, 0.69444, 0, 0, 0.575],
   1940     "729": [0, 0.69444, 0, 0, 0.31944],
   1941     "730": [0, 0.69444, 0, 0, 0.86944],
   1942     "732": [0, 0.69444, 0, 0, 0.575],
   1943     "733": [0, 0.69444, 0, 0, 0.575],
   1944     "915": [0, 0.68611, 0, 0, 0.69166],
   1945     "916": [0, 0.68611, 0, 0, 0.95833],
   1946     "920": [0, 0.68611, 0, 0, 0.89444],
   1947     "923": [0, 0.68611, 0, 0, 0.80555],
   1948     "926": [0, 0.68611, 0, 0, 0.76666],
   1949     "928": [0, 0.68611, 0, 0, 0.9],
   1950     "931": [0, 0.68611, 0, 0, 0.83055],
   1951     "933": [0, 0.68611, 0, 0, 0.89444],
   1952     "934": [0, 0.68611, 0, 0, 0.83055],
   1953     "936": [0, 0.68611, 0, 0, 0.89444],
   1954     "937": [0, 0.68611, 0, 0, 0.83055],
   1955     "8211": [0, 0.44444, 0.03194, 0, 0.575],
   1956     "8212": [0, 0.44444, 0.03194, 0, 1.14999],
   1957     "8216": [0, 0.69444, 0, 0, 0.31944],
   1958     "8217": [0, 0.69444, 0, 0, 0.31944],
   1959     "8220": [0, 0.69444, 0, 0, 0.60278],
   1960     "8221": [0, 0.69444, 0, 0, 0.60278],
   1961     "8224": [0.19444, 0.69444, 0, 0, 0.51111],
   1962     "8225": [0.19444, 0.69444, 0, 0, 0.51111],
   1963     "8242": [0, 0.55556, 0, 0, 0.34444],
   1964     "8407": [0, 0.72444, 0.15486, 0, 0.575],
   1965     "8463": [0, 0.69444, 0, 0, 0.66759],
   1966     "8465": [0, 0.69444, 0, 0, 0.83055],
   1967     "8467": [0, 0.69444, 0, 0, 0.47361],
   1968     "8472": [0.19444, 0.44444, 0, 0, 0.74027],
   1969     "8476": [0, 0.69444, 0, 0, 0.83055],
   1970     "8501": [0, 0.69444, 0, 0, 0.70277],
   1971     "8592": [-0.10889, 0.39111, 0, 0, 1.14999],
   1972     "8593": [0.19444, 0.69444, 0, 0, 0.575],
   1973     "8594": [-0.10889, 0.39111, 0, 0, 1.14999],
   1974     "8595": [0.19444, 0.69444, 0, 0, 0.575],
   1975     "8596": [-0.10889, 0.39111, 0, 0, 1.14999],
   1976     "8597": [0.25, 0.75, 0, 0, 0.575],
   1977     "8598": [0.19444, 0.69444, 0, 0, 1.14999],
   1978     "8599": [0.19444, 0.69444, 0, 0, 1.14999],
   1979     "8600": [0.19444, 0.69444, 0, 0, 1.14999],
   1980     "8601": [0.19444, 0.69444, 0, 0, 1.14999],
   1981     "8636": [-0.10889, 0.39111, 0, 0, 1.14999],
   1982     "8637": [-0.10889, 0.39111, 0, 0, 1.14999],
   1983     "8640": [-0.10889, 0.39111, 0, 0, 1.14999],
   1984     "8641": [-0.10889, 0.39111, 0, 0, 1.14999],
   1985     "8656": [-0.10889, 0.39111, 0, 0, 1.14999],
   1986     "8657": [0.19444, 0.69444, 0, 0, 0.70277],
   1987     "8658": [-0.10889, 0.39111, 0, 0, 1.14999],
   1988     "8659": [0.19444, 0.69444, 0, 0, 0.70277],
   1989     "8660": [-0.10889, 0.39111, 0, 0, 1.14999],
   1990     "8661": [0.25, 0.75, 0, 0, 0.70277],
   1991     "8704": [0, 0.69444, 0, 0, 0.63889],
   1992     "8706": [0, 0.69444, 0.06389, 0, 0.62847],
   1993     "8707": [0, 0.69444, 0, 0, 0.63889],
   1994     "8709": [0.05556, 0.75, 0, 0, 0.575],
   1995     "8711": [0, 0.68611, 0, 0, 0.95833],
   1996     "8712": [0.08556, 0.58556, 0, 0, 0.76666],
   1997     "8715": [0.08556, 0.58556, 0, 0, 0.76666],
   1998     "8722": [0.13333, 0.63333, 0, 0, 0.89444],
   1999     "8723": [0.13333, 0.63333, 0, 0, 0.89444],
   2000     "8725": [0.25, 0.75, 0, 0, 0.575],
   2001     "8726": [0.25, 0.75, 0, 0, 0.575],
   2002     "8727": [-0.02778, 0.47222, 0, 0, 0.575],
   2003     "8728": [-0.02639, 0.47361, 0, 0, 0.575],
   2004     "8729": [-0.02639, 0.47361, 0, 0, 0.575],
   2005     "8730": [0.18, 0.82, 0, 0, 0.95833],
   2006     "8733": [0, 0.44444, 0, 0, 0.89444],
   2007     "8734": [0, 0.44444, 0, 0, 1.14999],
   2008     "8736": [0, 0.69224, 0, 0, 0.72222],
   2009     "8739": [0.25, 0.75, 0, 0, 0.31944],
   2010     "8741": [0.25, 0.75, 0, 0, 0.575],
   2011     "8743": [0, 0.55556, 0, 0, 0.76666],
   2012     "8744": [0, 0.55556, 0, 0, 0.76666],
   2013     "8745": [0, 0.55556, 0, 0, 0.76666],
   2014     "8746": [0, 0.55556, 0, 0, 0.76666],
   2015     "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875],
   2016     "8764": [-0.10889, 0.39111, 0, 0, 0.89444],
   2017     "8768": [0.19444, 0.69444, 0, 0, 0.31944],
   2018     "8771": [0.00222, 0.50222, 0, 0, 0.89444],
   2019     "8776": [0.02444, 0.52444, 0, 0, 0.89444],
   2020     "8781": [0.00222, 0.50222, 0, 0, 0.89444],
   2021     "8801": [0.00222, 0.50222, 0, 0, 0.89444],
   2022     "8804": [0.19667, 0.69667, 0, 0, 0.89444],
   2023     "8805": [0.19667, 0.69667, 0, 0, 0.89444],
   2024     "8810": [0.08556, 0.58556, 0, 0, 1.14999],
   2025     "8811": [0.08556, 0.58556, 0, 0, 1.14999],
   2026     "8826": [0.08556, 0.58556, 0, 0, 0.89444],
   2027     "8827": [0.08556, 0.58556, 0, 0, 0.89444],
   2028     "8834": [0.08556, 0.58556, 0, 0, 0.89444],
   2029     "8835": [0.08556, 0.58556, 0, 0, 0.89444],
   2030     "8838": [0.19667, 0.69667, 0, 0, 0.89444],
   2031     "8839": [0.19667, 0.69667, 0, 0, 0.89444],
   2032     "8846": [0, 0.55556, 0, 0, 0.76666],
   2033     "8849": [0.19667, 0.69667, 0, 0, 0.89444],
   2034     "8850": [0.19667, 0.69667, 0, 0, 0.89444],
   2035     "8851": [0, 0.55556, 0, 0, 0.76666],
   2036     "8852": [0, 0.55556, 0, 0, 0.76666],
   2037     "8853": [0.13333, 0.63333, 0, 0, 0.89444],
   2038     "8854": [0.13333, 0.63333, 0, 0, 0.89444],
   2039     "8855": [0.13333, 0.63333, 0, 0, 0.89444],
   2040     "8856": [0.13333, 0.63333, 0, 0, 0.89444],
   2041     "8857": [0.13333, 0.63333, 0, 0, 0.89444],
   2042     "8866": [0, 0.69444, 0, 0, 0.70277],
   2043     "8867": [0, 0.69444, 0, 0, 0.70277],
   2044     "8868": [0, 0.69444, 0, 0, 0.89444],
   2045     "8869": [0, 0.69444, 0, 0, 0.89444],
   2046     "8900": [-0.02639, 0.47361, 0, 0, 0.575],
   2047     "8901": [-0.02639, 0.47361, 0, 0, 0.31944],
   2048     "8902": [-0.02778, 0.47222, 0, 0, 0.575],
   2049     "8968": [0.25, 0.75, 0, 0, 0.51111],
   2050     "8969": [0.25, 0.75, 0, 0, 0.51111],
   2051     "8970": [0.25, 0.75, 0, 0, 0.51111],
   2052     "8971": [0.25, 0.75, 0, 0, 0.51111],
   2053     "8994": [-0.13889, 0.36111, 0, 0, 1.14999],
   2054     "8995": [-0.13889, 0.36111, 0, 0, 1.14999],
   2055     "9651": [0.19444, 0.69444, 0, 0, 1.02222],
   2056     "9657": [-0.02778, 0.47222, 0, 0, 0.575],
   2057     "9661": [0.19444, 0.69444, 0, 0, 1.02222],
   2058     "9667": [-0.02778, 0.47222, 0, 0, 0.575],
   2059     "9711": [0.19444, 0.69444, 0, 0, 1.14999],
   2060     "9824": [0.12963, 0.69444, 0, 0, 0.89444],
   2061     "9825": [0.12963, 0.69444, 0, 0, 0.89444],
   2062     "9826": [0.12963, 0.69444, 0, 0, 0.89444],
   2063     "9827": [0.12963, 0.69444, 0, 0, 0.89444],
   2064     "9837": [0, 0.75, 0, 0, 0.44722],
   2065     "9838": [0.19444, 0.69444, 0, 0, 0.44722],
   2066     "9839": [0.19444, 0.69444, 0, 0, 0.44722],
   2067     "10216": [0.25, 0.75, 0, 0, 0.44722],
   2068     "10217": [0.25, 0.75, 0, 0, 0.44722],
   2069     "10815": [0, 0.68611, 0, 0, 0.9],
   2070     "10927": [0.19667, 0.69667, 0, 0, 0.89444],
   2071     "10928": [0.19667, 0.69667, 0, 0, 0.89444],
   2072     "57376": [0.19444, 0.69444, 0, 0, 0]
   2073   },
   2074   "Main-BoldItalic": {
   2075     "32": [0, 0, 0, 0, 0.25],
   2076     "33": [0, 0.69444, 0.11417, 0, 0.38611],
   2077     "34": [0, 0.69444, 0.07939, 0, 0.62055],
   2078     "35": [0.19444, 0.69444, 0.06833, 0, 0.94444],
   2079     "37": [0.05556, 0.75, 0.12861, 0, 0.94444],
   2080     "38": [0, 0.69444, 0.08528, 0, 0.88555],
   2081     "39": [0, 0.69444, 0.12945, 0, 0.35555],
   2082     "40": [0.25, 0.75, 0.15806, 0, 0.47333],
   2083     "41": [0.25, 0.75, 0.03306, 0, 0.47333],
   2084     "42": [0, 0.75, 0.14333, 0, 0.59111],
   2085     "43": [0.10333, 0.60333, 0.03306, 0, 0.88555],
   2086     "44": [0.19444, 0.14722, 0, 0, 0.35555],
   2087     "45": [0, 0.44444, 0.02611, 0, 0.41444],
   2088     "46": [0, 0.14722, 0, 0, 0.35555],
   2089     "47": [0.25, 0.75, 0.15806, 0, 0.59111],
   2090     "48": [0, 0.64444, 0.13167, 0, 0.59111],
   2091     "49": [0, 0.64444, 0.13167, 0, 0.59111],
   2092     "50": [0, 0.64444, 0.13167, 0, 0.59111],
   2093     "51": [0, 0.64444, 0.13167, 0, 0.59111],
   2094     "52": [0.19444, 0.64444, 0.13167, 0, 0.59111],
   2095     "53": [0, 0.64444, 0.13167, 0, 0.59111],
   2096     "54": [0, 0.64444, 0.13167, 0, 0.59111],
   2097     "55": [0.19444, 0.64444, 0.13167, 0, 0.59111],
   2098     "56": [0, 0.64444, 0.13167, 0, 0.59111],
   2099     "57": [0, 0.64444, 0.13167, 0, 0.59111],
   2100     "58": [0, 0.44444, 0.06695, 0, 0.35555],
   2101     "59": [0.19444, 0.44444, 0.06695, 0, 0.35555],
   2102     "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555],
   2103     "63": [0, 0.69444, 0.11472, 0, 0.59111],
   2104     "64": [0, 0.69444, 0.09208, 0, 0.88555],
   2105     "65": [0, 0.68611, 0, 0, 0.86555],
   2106     "66": [0, 0.68611, 0.0992, 0, 0.81666],
   2107     "67": [0, 0.68611, 0.14208, 0, 0.82666],
   2108     "68": [0, 0.68611, 0.09062, 0, 0.87555],
   2109     "69": [0, 0.68611, 0.11431, 0, 0.75666],
   2110     "70": [0, 0.68611, 0.12903, 0, 0.72722],
   2111     "71": [0, 0.68611, 0.07347, 0, 0.89527],
   2112     "72": [0, 0.68611, 0.17208, 0, 0.8961],
   2113     "73": [0, 0.68611, 0.15681, 0, 0.47166],
   2114     "74": [0, 0.68611, 0.145, 0, 0.61055],
   2115     "75": [0, 0.68611, 0.14208, 0, 0.89499],
   2116     "76": [0, 0.68611, 0, 0, 0.69777],
   2117     "77": [0, 0.68611, 0.17208, 0, 1.07277],
   2118     "78": [0, 0.68611, 0.17208, 0, 0.8961],
   2119     "79": [0, 0.68611, 0.09062, 0, 0.85499],
   2120     "80": [0, 0.68611, 0.0992, 0, 0.78721],
   2121     "81": [0.19444, 0.68611, 0.09062, 0, 0.85499],
   2122     "82": [0, 0.68611, 0.02559, 0, 0.85944],
   2123     "83": [0, 0.68611, 0.11264, 0, 0.64999],
   2124     "84": [0, 0.68611, 0.12903, 0, 0.7961],
   2125     "85": [0, 0.68611, 0.17208, 0, 0.88083],
   2126     "86": [0, 0.68611, 0.18625, 0, 0.86555],
   2127     "87": [0, 0.68611, 0.18625, 0, 1.15999],
   2128     "88": [0, 0.68611, 0.15681, 0, 0.86555],
   2129     "89": [0, 0.68611, 0.19803, 0, 0.86555],
   2130     "90": [0, 0.68611, 0.14208, 0, 0.70888],
   2131     "91": [0.25, 0.75, 0.1875, 0, 0.35611],
   2132     "93": [0.25, 0.75, 0.09972, 0, 0.35611],
   2133     "94": [0, 0.69444, 0.06709, 0, 0.59111],
   2134     "95": [0.31, 0.13444, 0.09811, 0, 0.59111],
   2135     "97": [0, 0.44444, 0.09426, 0, 0.59111],
   2136     "98": [0, 0.69444, 0.07861, 0, 0.53222],
   2137     "99": [0, 0.44444, 0.05222, 0, 0.53222],
   2138     "100": [0, 0.69444, 0.10861, 0, 0.59111],
   2139     "101": [0, 0.44444, 0.085, 0, 0.53222],
   2140     "102": [0.19444, 0.69444, 0.21778, 0, 0.4],
   2141     "103": [0.19444, 0.44444, 0.105, 0, 0.53222],
   2142     "104": [0, 0.69444, 0.09426, 0, 0.59111],
   2143     "105": [0, 0.69326, 0.11387, 0, 0.35555],
   2144     "106": [0.19444, 0.69326, 0.1672, 0, 0.35555],
   2145     "107": [0, 0.69444, 0.11111, 0, 0.53222],
   2146     "108": [0, 0.69444, 0.10861, 0, 0.29666],
   2147     "109": [0, 0.44444, 0.09426, 0, 0.94444],
   2148     "110": [0, 0.44444, 0.09426, 0, 0.64999],
   2149     "111": [0, 0.44444, 0.07861, 0, 0.59111],
   2150     "112": [0.19444, 0.44444, 0.07861, 0, 0.59111],
   2151     "113": [0.19444, 0.44444, 0.105, 0, 0.53222],
   2152     "114": [0, 0.44444, 0.11111, 0, 0.50167],
   2153     "115": [0, 0.44444, 0.08167, 0, 0.48694],
   2154     "116": [0, 0.63492, 0.09639, 0, 0.385],
   2155     "117": [0, 0.44444, 0.09426, 0, 0.62055],
   2156     "118": [0, 0.44444, 0.11111, 0, 0.53222],
   2157     "119": [0, 0.44444, 0.11111, 0, 0.76777],
   2158     "120": [0, 0.44444, 0.12583, 0, 0.56055],
   2159     "121": [0.19444, 0.44444, 0.105, 0, 0.56166],
   2160     "122": [0, 0.44444, 0.13889, 0, 0.49055],
   2161     "126": [0.35, 0.34444, 0.11472, 0, 0.59111],
   2162     "160": [0, 0, 0, 0, 0.25],
   2163     "168": [0, 0.69444, 0.11473, 0, 0.59111],
   2164     "176": [0, 0.69444, 0, 0, 0.94888],
   2165     "184": [0.17014, 0, 0, 0, 0.53222],
   2166     "198": [0, 0.68611, 0.11431, 0, 1.02277],
   2167     "216": [0.04861, 0.73472, 0.09062, 0, 0.88555],
   2168     "223": [0.19444, 0.69444, 0.09736, 0, 0.665],
   2169     "230": [0, 0.44444, 0.085, 0, 0.82666],
   2170     "248": [0.09722, 0.54167, 0.09458, 0, 0.59111],
   2171     "305": [0, 0.44444, 0.09426, 0, 0.35555],
   2172     "338": [0, 0.68611, 0.11431, 0, 1.14054],
   2173     "339": [0, 0.44444, 0.085, 0, 0.82666],
   2174     "567": [0.19444, 0.44444, 0.04611, 0, 0.385],
   2175     "710": [0, 0.69444, 0.06709, 0, 0.59111],
   2176     "711": [0, 0.63194, 0.08271, 0, 0.59111],
   2177     "713": [0, 0.59444, 0.10444, 0, 0.59111],
   2178     "714": [0, 0.69444, 0.08528, 0, 0.59111],
   2179     "715": [0, 0.69444, 0, 0, 0.59111],
   2180     "728": [0, 0.69444, 0.10333, 0, 0.59111],
   2181     "729": [0, 0.69444, 0.12945, 0, 0.35555],
   2182     "730": [0, 0.69444, 0, 0, 0.94888],
   2183     "732": [0, 0.69444, 0.11472, 0, 0.59111],
   2184     "733": [0, 0.69444, 0.11472, 0, 0.59111],
   2185     "915": [0, 0.68611, 0.12903, 0, 0.69777],
   2186     "916": [0, 0.68611, 0, 0, 0.94444],
   2187     "920": [0, 0.68611, 0.09062, 0, 0.88555],
   2188     "923": [0, 0.68611, 0, 0, 0.80666],
   2189     "926": [0, 0.68611, 0.15092, 0, 0.76777],
   2190     "928": [0, 0.68611, 0.17208, 0, 0.8961],
   2191     "931": [0, 0.68611, 0.11431, 0, 0.82666],
   2192     "933": [0, 0.68611, 0.10778, 0, 0.88555],
   2193     "934": [0, 0.68611, 0.05632, 0, 0.82666],
   2194     "936": [0, 0.68611, 0.10778, 0, 0.88555],
   2195     "937": [0, 0.68611, 0.0992, 0, 0.82666],
   2196     "8211": [0, 0.44444, 0.09811, 0, 0.59111],
   2197     "8212": [0, 0.44444, 0.09811, 0, 1.18221],
   2198     "8216": [0, 0.69444, 0.12945, 0, 0.35555],
   2199     "8217": [0, 0.69444, 0.12945, 0, 0.35555],
   2200     "8220": [0, 0.69444, 0.16772, 0, 0.62055],
   2201     "8221": [0, 0.69444, 0.07939, 0, 0.62055]
   2202   },
   2203   "Main-Italic": {
   2204     "32": [0, 0, 0, 0, 0.25],
   2205     "33": [0, 0.69444, 0.12417, 0, 0.30667],
   2206     "34": [0, 0.69444, 0.06961, 0, 0.51444],
   2207     "35": [0.19444, 0.69444, 0.06616, 0, 0.81777],
   2208     "37": [0.05556, 0.75, 0.13639, 0, 0.81777],
   2209     "38": [0, 0.69444, 0.09694, 0, 0.76666],
   2210     "39": [0, 0.69444, 0.12417, 0, 0.30667],
   2211     "40": [0.25, 0.75, 0.16194, 0, 0.40889],
   2212     "41": [0.25, 0.75, 0.03694, 0, 0.40889],
   2213     "42": [0, 0.75, 0.14917, 0, 0.51111],
   2214     "43": [0.05667, 0.56167, 0.03694, 0, 0.76666],
   2215     "44": [0.19444, 0.10556, 0, 0, 0.30667],
   2216     "45": [0, 0.43056, 0.02826, 0, 0.35778],
   2217     "46": [0, 0.10556, 0, 0, 0.30667],
   2218     "47": [0.25, 0.75, 0.16194, 0, 0.51111],
   2219     "48": [0, 0.64444, 0.13556, 0, 0.51111],
   2220     "49": [0, 0.64444, 0.13556, 0, 0.51111],
   2221     "50": [0, 0.64444, 0.13556, 0, 0.51111],
   2222     "51": [0, 0.64444, 0.13556, 0, 0.51111],
   2223     "52": [0.19444, 0.64444, 0.13556, 0, 0.51111],
   2224     "53": [0, 0.64444, 0.13556, 0, 0.51111],
   2225     "54": [0, 0.64444, 0.13556, 0, 0.51111],
   2226     "55": [0.19444, 0.64444, 0.13556, 0, 0.51111],
   2227     "56": [0, 0.64444, 0.13556, 0, 0.51111],
   2228     "57": [0, 0.64444, 0.13556, 0, 0.51111],
   2229     "58": [0, 0.43056, 0.0582, 0, 0.30667],
   2230     "59": [0.19444, 0.43056, 0.0582, 0, 0.30667],
   2231     "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666],
   2232     "63": [0, 0.69444, 0.1225, 0, 0.51111],
   2233     "64": [0, 0.69444, 0.09597, 0, 0.76666],
   2234     "65": [0, 0.68333, 0, 0, 0.74333],
   2235     "66": [0, 0.68333, 0.10257, 0, 0.70389],
   2236     "67": [0, 0.68333, 0.14528, 0, 0.71555],
   2237     "68": [0, 0.68333, 0.09403, 0, 0.755],
   2238     "69": [0, 0.68333, 0.12028, 0, 0.67833],
   2239     "70": [0, 0.68333, 0.13305, 0, 0.65277],
   2240     "71": [0, 0.68333, 0.08722, 0, 0.77361],
   2241     "72": [0, 0.68333, 0.16389, 0, 0.74333],
   2242     "73": [0, 0.68333, 0.15806, 0, 0.38555],
   2243     "74": [0, 0.68333, 0.14028, 0, 0.525],
   2244     "75": [0, 0.68333, 0.14528, 0, 0.76888],
   2245     "76": [0, 0.68333, 0, 0, 0.62722],
   2246     "77": [0, 0.68333, 0.16389, 0, 0.89666],
   2247     "78": [0, 0.68333, 0.16389, 0, 0.74333],
   2248     "79": [0, 0.68333, 0.09403, 0, 0.76666],
   2249     "80": [0, 0.68333, 0.10257, 0, 0.67833],
   2250     "81": [0.19444, 0.68333, 0.09403, 0, 0.76666],
   2251     "82": [0, 0.68333, 0.03868, 0, 0.72944],
   2252     "83": [0, 0.68333, 0.11972, 0, 0.56222],
   2253     "84": [0, 0.68333, 0.13305, 0, 0.71555],
   2254     "85": [0, 0.68333, 0.16389, 0, 0.74333],
   2255     "86": [0, 0.68333, 0.18361, 0, 0.74333],
   2256     "87": [0, 0.68333, 0.18361, 0, 0.99888],
   2257     "88": [0, 0.68333, 0.15806, 0, 0.74333],
   2258     "89": [0, 0.68333, 0.19383, 0, 0.74333],
   2259     "90": [0, 0.68333, 0.14528, 0, 0.61333],
   2260     "91": [0.25, 0.75, 0.1875, 0, 0.30667],
   2261     "93": [0.25, 0.75, 0.10528, 0, 0.30667],
   2262     "94": [0, 0.69444, 0.06646, 0, 0.51111],
   2263     "95": [0.31, 0.12056, 0.09208, 0, 0.51111],
   2264     "97": [0, 0.43056, 0.07671, 0, 0.51111],
   2265     "98": [0, 0.69444, 0.06312, 0, 0.46],
   2266     "99": [0, 0.43056, 0.05653, 0, 0.46],
   2267     "100": [0, 0.69444, 0.10333, 0, 0.51111],
   2268     "101": [0, 0.43056, 0.07514, 0, 0.46],
   2269     "102": [0.19444, 0.69444, 0.21194, 0, 0.30667],
   2270     "103": [0.19444, 0.43056, 0.08847, 0, 0.46],
   2271     "104": [0, 0.69444, 0.07671, 0, 0.51111],
   2272     "105": [0, 0.65536, 0.1019, 0, 0.30667],
   2273     "106": [0.19444, 0.65536, 0.14467, 0, 0.30667],
   2274     "107": [0, 0.69444, 0.10764, 0, 0.46],
   2275     "108": [0, 0.69444, 0.10333, 0, 0.25555],
   2276     "109": [0, 0.43056, 0.07671, 0, 0.81777],
   2277     "110": [0, 0.43056, 0.07671, 0, 0.56222],
   2278     "111": [0, 0.43056, 0.06312, 0, 0.51111],
   2279     "112": [0.19444, 0.43056, 0.06312, 0, 0.51111],
   2280     "113": [0.19444, 0.43056, 0.08847, 0, 0.46],
   2281     "114": [0, 0.43056, 0.10764, 0, 0.42166],
   2282     "115": [0, 0.43056, 0.08208, 0, 0.40889],
   2283     "116": [0, 0.61508, 0.09486, 0, 0.33222],
   2284     "117": [0, 0.43056, 0.07671, 0, 0.53666],
   2285     "118": [0, 0.43056, 0.10764, 0, 0.46],
   2286     "119": [0, 0.43056, 0.10764, 0, 0.66444],
   2287     "120": [0, 0.43056, 0.12042, 0, 0.46389],
   2288     "121": [0.19444, 0.43056, 0.08847, 0, 0.48555],
   2289     "122": [0, 0.43056, 0.12292, 0, 0.40889],
   2290     "126": [0.35, 0.31786, 0.11585, 0, 0.51111],
   2291     "160": [0, 0, 0, 0, 0.25],
   2292     "168": [0, 0.66786, 0.10474, 0, 0.51111],
   2293     "176": [0, 0.69444, 0, 0, 0.83129],
   2294     "184": [0.17014, 0, 0, 0, 0.46],
   2295     "198": [0, 0.68333, 0.12028, 0, 0.88277],
   2296     "216": [0.04861, 0.73194, 0.09403, 0, 0.76666],
   2297     "223": [0.19444, 0.69444, 0.10514, 0, 0.53666],
   2298     "230": [0, 0.43056, 0.07514, 0, 0.71555],
   2299     "248": [0.09722, 0.52778, 0.09194, 0, 0.51111],
   2300     "338": [0, 0.68333, 0.12028, 0, 0.98499],
   2301     "339": [0, 0.43056, 0.07514, 0, 0.71555],
   2302     "710": [0, 0.69444, 0.06646, 0, 0.51111],
   2303     "711": [0, 0.62847, 0.08295, 0, 0.51111],
   2304     "713": [0, 0.56167, 0.10333, 0, 0.51111],
   2305     "714": [0, 0.69444, 0.09694, 0, 0.51111],
   2306     "715": [0, 0.69444, 0, 0, 0.51111],
   2307     "728": [0, 0.69444, 0.10806, 0, 0.51111],
   2308     "729": [0, 0.66786, 0.11752, 0, 0.30667],
   2309     "730": [0, 0.69444, 0, 0, 0.83129],
   2310     "732": [0, 0.66786, 0.11585, 0, 0.51111],
   2311     "733": [0, 0.69444, 0.1225, 0, 0.51111],
   2312     "915": [0, 0.68333, 0.13305, 0, 0.62722],
   2313     "916": [0, 0.68333, 0, 0, 0.81777],
   2314     "920": [0, 0.68333, 0.09403, 0, 0.76666],
   2315     "923": [0, 0.68333, 0, 0, 0.69222],
   2316     "926": [0, 0.68333, 0.15294, 0, 0.66444],
   2317     "928": [0, 0.68333, 0.16389, 0, 0.74333],
   2318     "931": [0, 0.68333, 0.12028, 0, 0.71555],
   2319     "933": [0, 0.68333, 0.11111, 0, 0.76666],
   2320     "934": [0, 0.68333, 0.05986, 0, 0.71555],
   2321     "936": [0, 0.68333, 0.11111, 0, 0.76666],
   2322     "937": [0, 0.68333, 0.10257, 0, 0.71555],
   2323     "8211": [0, 0.43056, 0.09208, 0, 0.51111],
   2324     "8212": [0, 0.43056, 0.09208, 0, 1.02222],
   2325     "8216": [0, 0.69444, 0.12417, 0, 0.30667],
   2326     "8217": [0, 0.69444, 0.12417, 0, 0.30667],
   2327     "8220": [0, 0.69444, 0.1685, 0, 0.51444],
   2328     "8221": [0, 0.69444, 0.06961, 0, 0.51444],
   2329     "8463": [0, 0.68889, 0, 0, 0.54028]
   2330   },
   2331   "Main-Regular": {
   2332     "32": [0, 0, 0, 0, 0.25],
   2333     "33": [0, 0.69444, 0, 0, 0.27778],
   2334     "34": [0, 0.69444, 0, 0, 0.5],
   2335     "35": [0.19444, 0.69444, 0, 0, 0.83334],
   2336     "36": [0.05556, 0.75, 0, 0, 0.5],
   2337     "37": [0.05556, 0.75, 0, 0, 0.83334],
   2338     "38": [0, 0.69444, 0, 0, 0.77778],
   2339     "39": [0, 0.69444, 0, 0, 0.27778],
   2340     "40": [0.25, 0.75, 0, 0, 0.38889],
   2341     "41": [0.25, 0.75, 0, 0, 0.38889],
   2342     "42": [0, 0.75, 0, 0, 0.5],
   2343     "43": [0.08333, 0.58333, 0, 0, 0.77778],
   2344     "44": [0.19444, 0.10556, 0, 0, 0.27778],
   2345     "45": [0, 0.43056, 0, 0, 0.33333],
   2346     "46": [0, 0.10556, 0, 0, 0.27778],
   2347     "47": [0.25, 0.75, 0, 0, 0.5],
   2348     "48": [0, 0.64444, 0, 0, 0.5],
   2349     "49": [0, 0.64444, 0, 0, 0.5],
   2350     "50": [0, 0.64444, 0, 0, 0.5],
   2351     "51": [0, 0.64444, 0, 0, 0.5],
   2352     "52": [0, 0.64444, 0, 0, 0.5],
   2353     "53": [0, 0.64444, 0, 0, 0.5],
   2354     "54": [0, 0.64444, 0, 0, 0.5],
   2355     "55": [0, 0.64444, 0, 0, 0.5],
   2356     "56": [0, 0.64444, 0, 0, 0.5],
   2357     "57": [0, 0.64444, 0, 0, 0.5],
   2358     "58": [0, 0.43056, 0, 0, 0.27778],
   2359     "59": [0.19444, 0.43056, 0, 0, 0.27778],
   2360     "60": [0.0391, 0.5391, 0, 0, 0.77778],
   2361     "61": [-0.13313, 0.36687, 0, 0, 0.77778],
   2362     "62": [0.0391, 0.5391, 0, 0, 0.77778],
   2363     "63": [0, 0.69444, 0, 0, 0.47222],
   2364     "64": [0, 0.69444, 0, 0, 0.77778],
   2365     "65": [0, 0.68333, 0, 0, 0.75],
   2366     "66": [0, 0.68333, 0, 0, 0.70834],
   2367     "67": [0, 0.68333, 0, 0, 0.72222],
   2368     "68": [0, 0.68333, 0, 0, 0.76389],
   2369     "69": [0, 0.68333, 0, 0, 0.68056],
   2370     "70": [0, 0.68333, 0, 0, 0.65278],
   2371     "71": [0, 0.68333, 0, 0, 0.78472],
   2372     "72": [0, 0.68333, 0, 0, 0.75],
   2373     "73": [0, 0.68333, 0, 0, 0.36111],
   2374     "74": [0, 0.68333, 0, 0, 0.51389],
   2375     "75": [0, 0.68333, 0, 0, 0.77778],
   2376     "76": [0, 0.68333, 0, 0, 0.625],
   2377     "77": [0, 0.68333, 0, 0, 0.91667],
   2378     "78": [0, 0.68333, 0, 0, 0.75],
   2379     "79": [0, 0.68333, 0, 0, 0.77778],
   2380     "80": [0, 0.68333, 0, 0, 0.68056],
   2381     "81": [0.19444, 0.68333, 0, 0, 0.77778],
   2382     "82": [0, 0.68333, 0, 0, 0.73611],
   2383     "83": [0, 0.68333, 0, 0, 0.55556],
   2384     "84": [0, 0.68333, 0, 0, 0.72222],
   2385     "85": [0, 0.68333, 0, 0, 0.75],
   2386     "86": [0, 0.68333, 0.01389, 0, 0.75],
   2387     "87": [0, 0.68333, 0.01389, 0, 1.02778],
   2388     "88": [0, 0.68333, 0, 0, 0.75],
   2389     "89": [0, 0.68333, 0.025, 0, 0.75],
   2390     "90": [0, 0.68333, 0, 0, 0.61111],
   2391     "91": [0.25, 0.75, 0, 0, 0.27778],
   2392     "92": [0.25, 0.75, 0, 0, 0.5],
   2393     "93": [0.25, 0.75, 0, 0, 0.27778],
   2394     "94": [0, 0.69444, 0, 0, 0.5],
   2395     "95": [0.31, 0.12056, 0.02778, 0, 0.5],
   2396     "97": [0, 0.43056, 0, 0, 0.5],
   2397     "98": [0, 0.69444, 0, 0, 0.55556],
   2398     "99": [0, 0.43056, 0, 0, 0.44445],
   2399     "100": [0, 0.69444, 0, 0, 0.55556],
   2400     "101": [0, 0.43056, 0, 0, 0.44445],
   2401     "102": [0, 0.69444, 0.07778, 0, 0.30556],
   2402     "103": [0.19444, 0.43056, 0.01389, 0, 0.5],
   2403     "104": [0, 0.69444, 0, 0, 0.55556],
   2404     "105": [0, 0.66786, 0, 0, 0.27778],
   2405     "106": [0.19444, 0.66786, 0, 0, 0.30556],
   2406     "107": [0, 0.69444, 0, 0, 0.52778],
   2407     "108": [0, 0.69444, 0, 0, 0.27778],
   2408     "109": [0, 0.43056, 0, 0, 0.83334],
   2409     "110": [0, 0.43056, 0, 0, 0.55556],
   2410     "111": [0, 0.43056, 0, 0, 0.5],
   2411     "112": [0.19444, 0.43056, 0, 0, 0.55556],
   2412     "113": [0.19444, 0.43056, 0, 0, 0.52778],
   2413     "114": [0, 0.43056, 0, 0, 0.39167],
   2414     "115": [0, 0.43056, 0, 0, 0.39445],
   2415     "116": [0, 0.61508, 0, 0, 0.38889],
   2416     "117": [0, 0.43056, 0, 0, 0.55556],
   2417     "118": [0, 0.43056, 0.01389, 0, 0.52778],
   2418     "119": [0, 0.43056, 0.01389, 0, 0.72222],
   2419     "120": [0, 0.43056, 0, 0, 0.52778],
   2420     "121": [0.19444, 0.43056, 0.01389, 0, 0.52778],
   2421     "122": [0, 0.43056, 0, 0, 0.44445],
   2422     "123": [0.25, 0.75, 0, 0, 0.5],
   2423     "124": [0.25, 0.75, 0, 0, 0.27778],
   2424     "125": [0.25, 0.75, 0, 0, 0.5],
   2425     "126": [0.35, 0.31786, 0, 0, 0.5],
   2426     "160": [0, 0, 0, 0, 0.25],
   2427     "163": [0, 0.69444, 0, 0, 0.76909],
   2428     "167": [0.19444, 0.69444, 0, 0, 0.44445],
   2429     "168": [0, 0.66786, 0, 0, 0.5],
   2430     "172": [0, 0.43056, 0, 0, 0.66667],
   2431     "176": [0, 0.69444, 0, 0, 0.75],
   2432     "177": [0.08333, 0.58333, 0, 0, 0.77778],
   2433     "182": [0.19444, 0.69444, 0, 0, 0.61111],
   2434     "184": [0.17014, 0, 0, 0, 0.44445],
   2435     "198": [0, 0.68333, 0, 0, 0.90278],
   2436     "215": [0.08333, 0.58333, 0, 0, 0.77778],
   2437     "216": [0.04861, 0.73194, 0, 0, 0.77778],
   2438     "223": [0, 0.69444, 0, 0, 0.5],
   2439     "230": [0, 0.43056, 0, 0, 0.72222],
   2440     "247": [0.08333, 0.58333, 0, 0, 0.77778],
   2441     "248": [0.09722, 0.52778, 0, 0, 0.5],
   2442     "305": [0, 0.43056, 0, 0, 0.27778],
   2443     "338": [0, 0.68333, 0, 0, 1.01389],
   2444     "339": [0, 0.43056, 0, 0, 0.77778],
   2445     "567": [0.19444, 0.43056, 0, 0, 0.30556],
   2446     "710": [0, 0.69444, 0, 0, 0.5],
   2447     "711": [0, 0.62847, 0, 0, 0.5],
   2448     "713": [0, 0.56778, 0, 0, 0.5],
   2449     "714": [0, 0.69444, 0, 0, 0.5],
   2450     "715": [0, 0.69444, 0, 0, 0.5],
   2451     "728": [0, 0.69444, 0, 0, 0.5],
   2452     "729": [0, 0.66786, 0, 0, 0.27778],
   2453     "730": [0, 0.69444, 0, 0, 0.75],
   2454     "732": [0, 0.66786, 0, 0, 0.5],
   2455     "733": [0, 0.69444, 0, 0, 0.5],
   2456     "915": [0, 0.68333, 0, 0, 0.625],
   2457     "916": [0, 0.68333, 0, 0, 0.83334],
   2458     "920": [0, 0.68333, 0, 0, 0.77778],
   2459     "923": [0, 0.68333, 0, 0, 0.69445],
   2460     "926": [0, 0.68333, 0, 0, 0.66667],
   2461     "928": [0, 0.68333, 0, 0, 0.75],
   2462     "931": [0, 0.68333, 0, 0, 0.72222],
   2463     "933": [0, 0.68333, 0, 0, 0.77778],
   2464     "934": [0, 0.68333, 0, 0, 0.72222],
   2465     "936": [0, 0.68333, 0, 0, 0.77778],
   2466     "937": [0, 0.68333, 0, 0, 0.72222],
   2467     "8211": [0, 0.43056, 0.02778, 0, 0.5],
   2468     "8212": [0, 0.43056, 0.02778, 0, 1.0],
   2469     "8216": [0, 0.69444, 0, 0, 0.27778],
   2470     "8217": [0, 0.69444, 0, 0, 0.27778],
   2471     "8220": [0, 0.69444, 0, 0, 0.5],
   2472     "8221": [0, 0.69444, 0, 0, 0.5],
   2473     "8224": [0.19444, 0.69444, 0, 0, 0.44445],
   2474     "8225": [0.19444, 0.69444, 0, 0, 0.44445],
   2475     "8230": [0, 0.12, 0, 0, 1.172],
   2476     "8242": [0, 0.55556, 0, 0, 0.275],
   2477     "8407": [0, 0.71444, 0.15382, 0, 0.5],
   2478     "8463": [0, 0.68889, 0, 0, 0.54028],
   2479     "8465": [0, 0.69444, 0, 0, 0.72222],
   2480     "8467": [0, 0.69444, 0, 0.11111, 0.41667],
   2481     "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646],
   2482     "8476": [0, 0.69444, 0, 0, 0.72222],
   2483     "8501": [0, 0.69444, 0, 0, 0.61111],
   2484     "8592": [-0.13313, 0.36687, 0, 0, 1.0],
   2485     "8593": [0.19444, 0.69444, 0, 0, 0.5],
   2486     "8594": [-0.13313, 0.36687, 0, 0, 1.0],
   2487     "8595": [0.19444, 0.69444, 0, 0, 0.5],
   2488     "8596": [-0.13313, 0.36687, 0, 0, 1.0],
   2489     "8597": [0.25, 0.75, 0, 0, 0.5],
   2490     "8598": [0.19444, 0.69444, 0, 0, 1.0],
   2491     "8599": [0.19444, 0.69444, 0, 0, 1.0],
   2492     "8600": [0.19444, 0.69444, 0, 0, 1.0],
   2493     "8601": [0.19444, 0.69444, 0, 0, 1.0],
   2494     "8614": [0.011, 0.511, 0, 0, 1.0],
   2495     "8617": [0.011, 0.511, 0, 0, 1.126],
   2496     "8618": [0.011, 0.511, 0, 0, 1.126],
   2497     "8636": [-0.13313, 0.36687, 0, 0, 1.0],
   2498     "8637": [-0.13313, 0.36687, 0, 0, 1.0],
   2499     "8640": [-0.13313, 0.36687, 0, 0, 1.0],
   2500     "8641": [-0.13313, 0.36687, 0, 0, 1.0],
   2501     "8652": [0.011, 0.671, 0, 0, 1.0],
   2502     "8656": [-0.13313, 0.36687, 0, 0, 1.0],
   2503     "8657": [0.19444, 0.69444, 0, 0, 0.61111],
   2504     "8658": [-0.13313, 0.36687, 0, 0, 1.0],
   2505     "8659": [0.19444, 0.69444, 0, 0, 0.61111],
   2506     "8660": [-0.13313, 0.36687, 0, 0, 1.0],
   2507     "8661": [0.25, 0.75, 0, 0, 0.61111],
   2508     "8704": [0, 0.69444, 0, 0, 0.55556],
   2509     "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309],
   2510     "8707": [0, 0.69444, 0, 0, 0.55556],
   2511     "8709": [0.05556, 0.75, 0, 0, 0.5],
   2512     "8711": [0, 0.68333, 0, 0, 0.83334],
   2513     "8712": [0.0391, 0.5391, 0, 0, 0.66667],
   2514     "8715": [0.0391, 0.5391, 0, 0, 0.66667],
   2515     "8722": [0.08333, 0.58333, 0, 0, 0.77778],
   2516     "8723": [0.08333, 0.58333, 0, 0, 0.77778],
   2517     "8725": [0.25, 0.75, 0, 0, 0.5],
   2518     "8726": [0.25, 0.75, 0, 0, 0.5],
   2519     "8727": [-0.03472, 0.46528, 0, 0, 0.5],
   2520     "8728": [-0.05555, 0.44445, 0, 0, 0.5],
   2521     "8729": [-0.05555, 0.44445, 0, 0, 0.5],
   2522     "8730": [0.2, 0.8, 0, 0, 0.83334],
   2523     "8733": [0, 0.43056, 0, 0, 0.77778],
   2524     "8734": [0, 0.43056, 0, 0, 1.0],
   2525     "8736": [0, 0.69224, 0, 0, 0.72222],
   2526     "8739": [0.25, 0.75, 0, 0, 0.27778],
   2527     "8741": [0.25, 0.75, 0, 0, 0.5],
   2528     "8743": [0, 0.55556, 0, 0, 0.66667],
   2529     "8744": [0, 0.55556, 0, 0, 0.66667],
   2530     "8745": [0, 0.55556, 0, 0, 0.66667],
   2531     "8746": [0, 0.55556, 0, 0, 0.66667],
   2532     "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667],
   2533     "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
   2534     "8768": [0.19444, 0.69444, 0, 0, 0.27778],
   2535     "8771": [-0.03625, 0.46375, 0, 0, 0.77778],
   2536     "8773": [-0.022, 0.589, 0, 0, 1.0],
   2537     "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
   2538     "8781": [-0.03625, 0.46375, 0, 0, 0.77778],
   2539     "8784": [-0.133, 0.67, 0, 0, 0.778],
   2540     "8801": [-0.03625, 0.46375, 0, 0, 0.77778],
   2541     "8804": [0.13597, 0.63597, 0, 0, 0.77778],
   2542     "8805": [0.13597, 0.63597, 0, 0, 0.77778],
   2543     "8810": [0.0391, 0.5391, 0, 0, 1.0],
   2544     "8811": [0.0391, 0.5391, 0, 0, 1.0],
   2545     "8826": [0.0391, 0.5391, 0, 0, 0.77778],
   2546     "8827": [0.0391, 0.5391, 0, 0, 0.77778],
   2547     "8834": [0.0391, 0.5391, 0, 0, 0.77778],
   2548     "8835": [0.0391, 0.5391, 0, 0, 0.77778],
   2549     "8838": [0.13597, 0.63597, 0, 0, 0.77778],
   2550     "8839": [0.13597, 0.63597, 0, 0, 0.77778],
   2551     "8846": [0, 0.55556, 0, 0, 0.66667],
   2552     "8849": [0.13597, 0.63597, 0, 0, 0.77778],
   2553     "8850": [0.13597, 0.63597, 0, 0, 0.77778],
   2554     "8851": [0, 0.55556, 0, 0, 0.66667],
   2555     "8852": [0, 0.55556, 0, 0, 0.66667],
   2556     "8853": [0.08333, 0.58333, 0, 0, 0.77778],
   2557     "8854": [0.08333, 0.58333, 0, 0, 0.77778],
   2558     "8855": [0.08333, 0.58333, 0, 0, 0.77778],
   2559     "8856": [0.08333, 0.58333, 0, 0, 0.77778],
   2560     "8857": [0.08333, 0.58333, 0, 0, 0.77778],
   2561     "8866": [0, 0.69444, 0, 0, 0.61111],
   2562     "8867": [0, 0.69444, 0, 0, 0.61111],
   2563     "8868": [0, 0.69444, 0, 0, 0.77778],
   2564     "8869": [0, 0.69444, 0, 0, 0.77778],
   2565     "8872": [0.249, 0.75, 0, 0, 0.867],
   2566     "8900": [-0.05555, 0.44445, 0, 0, 0.5],
   2567     "8901": [-0.05555, 0.44445, 0, 0, 0.27778],
   2568     "8902": [-0.03472, 0.46528, 0, 0, 0.5],
   2569     "8904": [0.005, 0.505, 0, 0, 0.9],
   2570     "8942": [0.03, 0.9, 0, 0, 0.278],
   2571     "8943": [-0.19, 0.31, 0, 0, 1.172],
   2572     "8945": [-0.1, 0.82, 0, 0, 1.282],
   2573     "8968": [0.25, 0.75, 0, 0, 0.44445],
   2574     "8969": [0.25, 0.75, 0, 0, 0.44445],
   2575     "8970": [0.25, 0.75, 0, 0, 0.44445],
   2576     "8971": [0.25, 0.75, 0, 0, 0.44445],
   2577     "8994": [-0.14236, 0.35764, 0, 0, 1.0],
   2578     "8995": [-0.14236, 0.35764, 0, 0, 1.0],
   2579     "9136": [0.244, 0.744, 0, 0, 0.412],
   2580     "9137": [0.244, 0.744, 0, 0, 0.412],
   2581     "9651": [0.19444, 0.69444, 0, 0, 0.88889],
   2582     "9657": [-0.03472, 0.46528, 0, 0, 0.5],
   2583     "9661": [0.19444, 0.69444, 0, 0, 0.88889],
   2584     "9667": [-0.03472, 0.46528, 0, 0, 0.5],
   2585     "9711": [0.19444, 0.69444, 0, 0, 1.0],
   2586     "9824": [0.12963, 0.69444, 0, 0, 0.77778],
   2587     "9825": [0.12963, 0.69444, 0, 0, 0.77778],
   2588     "9826": [0.12963, 0.69444, 0, 0, 0.77778],
   2589     "9827": [0.12963, 0.69444, 0, 0, 0.77778],
   2590     "9837": [0, 0.75, 0, 0, 0.38889],
   2591     "9838": [0.19444, 0.69444, 0, 0, 0.38889],
   2592     "9839": [0.19444, 0.69444, 0, 0, 0.38889],
   2593     "10216": [0.25, 0.75, 0, 0, 0.38889],
   2594     "10217": [0.25, 0.75, 0, 0, 0.38889],
   2595     "10222": [0.244, 0.744, 0, 0, 0.412],
   2596     "10223": [0.244, 0.744, 0, 0, 0.412],
   2597     "10229": [0.011, 0.511, 0, 0, 1.609],
   2598     "10230": [0.011, 0.511, 0, 0, 1.638],
   2599     "10231": [0.011, 0.511, 0, 0, 1.859],
   2600     "10232": [0.024, 0.525, 0, 0, 1.609],
   2601     "10233": [0.024, 0.525, 0, 0, 1.638],
   2602     "10234": [0.024, 0.525, 0, 0, 1.858],
   2603     "10236": [0.011, 0.511, 0, 0, 1.638],
   2604     "10815": [0, 0.68333, 0, 0, 0.75],
   2605     "10927": [0.13597, 0.63597, 0, 0, 0.77778],
   2606     "10928": [0.13597, 0.63597, 0, 0, 0.77778],
   2607     "57376": [0.19444, 0.69444, 0, 0, 0]
   2608   },
   2609   "Math-BoldItalic": {
   2610     "32": [0, 0, 0, 0, 0.25],
   2611     "48": [0, 0.44444, 0, 0, 0.575],
   2612     "49": [0, 0.44444, 0, 0, 0.575],
   2613     "50": [0, 0.44444, 0, 0, 0.575],
   2614     "51": [0.19444, 0.44444, 0, 0, 0.575],
   2615     "52": [0.19444, 0.44444, 0, 0, 0.575],
   2616     "53": [0.19444, 0.44444, 0, 0, 0.575],
   2617     "54": [0, 0.64444, 0, 0, 0.575],
   2618     "55": [0.19444, 0.44444, 0, 0, 0.575],
   2619     "56": [0, 0.64444, 0, 0, 0.575],
   2620     "57": [0.19444, 0.44444, 0, 0, 0.575],
   2621     "65": [0, 0.68611, 0, 0, 0.86944],
   2622     "66": [0, 0.68611, 0.04835, 0, 0.8664],
   2623     "67": [0, 0.68611, 0.06979, 0, 0.81694],
   2624     "68": [0, 0.68611, 0.03194, 0, 0.93812],
   2625     "69": [0, 0.68611, 0.05451, 0, 0.81007],
   2626     "70": [0, 0.68611, 0.15972, 0, 0.68889],
   2627     "71": [0, 0.68611, 0, 0, 0.88673],
   2628     "72": [0, 0.68611, 0.08229, 0, 0.98229],
   2629     "73": [0, 0.68611, 0.07778, 0, 0.51111],
   2630     "74": [0, 0.68611, 0.10069, 0, 0.63125],
   2631     "75": [0, 0.68611, 0.06979, 0, 0.97118],
   2632     "76": [0, 0.68611, 0, 0, 0.75555],
   2633     "77": [0, 0.68611, 0.11424, 0, 1.14201],
   2634     "78": [0, 0.68611, 0.11424, 0, 0.95034],
   2635     "79": [0, 0.68611, 0.03194, 0, 0.83666],
   2636     "80": [0, 0.68611, 0.15972, 0, 0.72309],
   2637     "81": [0.19444, 0.68611, 0, 0, 0.86861],
   2638     "82": [0, 0.68611, 0.00421, 0, 0.87235],
   2639     "83": [0, 0.68611, 0.05382, 0, 0.69271],
   2640     "84": [0, 0.68611, 0.15972, 0, 0.63663],
   2641     "85": [0, 0.68611, 0.11424, 0, 0.80027],
   2642     "86": [0, 0.68611, 0.25555, 0, 0.67778],
   2643     "87": [0, 0.68611, 0.15972, 0, 1.09305],
   2644     "88": [0, 0.68611, 0.07778, 0, 0.94722],
   2645     "89": [0, 0.68611, 0.25555, 0, 0.67458],
   2646     "90": [0, 0.68611, 0.06979, 0, 0.77257],
   2647     "97": [0, 0.44444, 0, 0, 0.63287],
   2648     "98": [0, 0.69444, 0, 0, 0.52083],
   2649     "99": [0, 0.44444, 0, 0, 0.51342],
   2650     "100": [0, 0.69444, 0, 0, 0.60972],
   2651     "101": [0, 0.44444, 0, 0, 0.55361],
   2652     "102": [0.19444, 0.69444, 0.11042, 0, 0.56806],
   2653     "103": [0.19444, 0.44444, 0.03704, 0, 0.5449],
   2654     "104": [0, 0.69444, 0, 0, 0.66759],
   2655     "105": [0, 0.69326, 0, 0, 0.4048],
   2656     "106": [0.19444, 0.69326, 0.0622, 0, 0.47083],
   2657     "107": [0, 0.69444, 0.01852, 0, 0.6037],
   2658     "108": [0, 0.69444, 0.0088, 0, 0.34815],
   2659     "109": [0, 0.44444, 0, 0, 1.0324],
   2660     "110": [0, 0.44444, 0, 0, 0.71296],
   2661     "111": [0, 0.44444, 0, 0, 0.58472],
   2662     "112": [0.19444, 0.44444, 0, 0, 0.60092],
   2663     "113": [0.19444, 0.44444, 0.03704, 0, 0.54213],
   2664     "114": [0, 0.44444, 0.03194, 0, 0.5287],
   2665     "115": [0, 0.44444, 0, 0, 0.53125],
   2666     "116": [0, 0.63492, 0, 0, 0.41528],
   2667     "117": [0, 0.44444, 0, 0, 0.68102],
   2668     "118": [0, 0.44444, 0.03704, 0, 0.56666],
   2669     "119": [0, 0.44444, 0.02778, 0, 0.83148],
   2670     "120": [0, 0.44444, 0, 0, 0.65903],
   2671     "121": [0.19444, 0.44444, 0.03704, 0, 0.59028],
   2672     "122": [0, 0.44444, 0.04213, 0, 0.55509],
   2673     "160": [0, 0, 0, 0, 0.25],
   2674     "915": [0, 0.68611, 0.15972, 0, 0.65694],
   2675     "916": [0, 0.68611, 0, 0, 0.95833],
   2676     "920": [0, 0.68611, 0.03194, 0, 0.86722],
   2677     "923": [0, 0.68611, 0, 0, 0.80555],
   2678     "926": [0, 0.68611, 0.07458, 0, 0.84125],
   2679     "928": [0, 0.68611, 0.08229, 0, 0.98229],
   2680     "931": [0, 0.68611, 0.05451, 0, 0.88507],
   2681     "933": [0, 0.68611, 0.15972, 0, 0.67083],
   2682     "934": [0, 0.68611, 0, 0, 0.76666],
   2683     "936": [0, 0.68611, 0.11653, 0, 0.71402],
   2684     "937": [0, 0.68611, 0.04835, 0, 0.8789],
   2685     "945": [0, 0.44444, 0, 0, 0.76064],
   2686     "946": [0.19444, 0.69444, 0.03403, 0, 0.65972],
   2687     "947": [0.19444, 0.44444, 0.06389, 0, 0.59003],
   2688     "948": [0, 0.69444, 0.03819, 0, 0.52222],
   2689     "949": [0, 0.44444, 0, 0, 0.52882],
   2690     "950": [0.19444, 0.69444, 0.06215, 0, 0.50833],
   2691     "951": [0.19444, 0.44444, 0.03704, 0, 0.6],
   2692     "952": [0, 0.69444, 0.03194, 0, 0.5618],
   2693     "953": [0, 0.44444, 0, 0, 0.41204],
   2694     "954": [0, 0.44444, 0, 0, 0.66759],
   2695     "955": [0, 0.69444, 0, 0, 0.67083],
   2696     "956": [0.19444, 0.44444, 0, 0, 0.70787],
   2697     "957": [0, 0.44444, 0.06898, 0, 0.57685],
   2698     "958": [0.19444, 0.69444, 0.03021, 0, 0.50833],
   2699     "959": [0, 0.44444, 0, 0, 0.58472],
   2700     "960": [0, 0.44444, 0.03704, 0, 0.68241],
   2701     "961": [0.19444, 0.44444, 0, 0, 0.6118],
   2702     "962": [0.09722, 0.44444, 0.07917, 0, 0.42361],
   2703     "963": [0, 0.44444, 0.03704, 0, 0.68588],
   2704     "964": [0, 0.44444, 0.13472, 0, 0.52083],
   2705     "965": [0, 0.44444, 0.03704, 0, 0.63055],
   2706     "966": [0.19444, 0.44444, 0, 0, 0.74722],
   2707     "967": [0.19444, 0.44444, 0, 0, 0.71805],
   2708     "968": [0.19444, 0.69444, 0.03704, 0, 0.75833],
   2709     "969": [0, 0.44444, 0.03704, 0, 0.71782],
   2710     "977": [0, 0.69444, 0, 0, 0.69155],
   2711     "981": [0.19444, 0.69444, 0, 0, 0.7125],
   2712     "982": [0, 0.44444, 0.03194, 0, 0.975],
   2713     "1009": [0.19444, 0.44444, 0, 0, 0.6118],
   2714     "1013": [0, 0.44444, 0, 0, 0.48333],
   2715     "57649": [0, 0.44444, 0, 0, 0.39352],
   2716     "57911": [0.19444, 0.44444, 0, 0, 0.43889]
   2717   },
   2718   "Math-Italic": {
   2719     "32": [0, 0, 0, 0, 0.25],
   2720     "48": [0, 0.43056, 0, 0, 0.5],
   2721     "49": [0, 0.43056, 0, 0, 0.5],
   2722     "50": [0, 0.43056, 0, 0, 0.5],
   2723     "51": [0.19444, 0.43056, 0, 0, 0.5],
   2724     "52": [0.19444, 0.43056, 0, 0, 0.5],
   2725     "53": [0.19444, 0.43056, 0, 0, 0.5],
   2726     "54": [0, 0.64444, 0, 0, 0.5],
   2727     "55": [0.19444, 0.43056, 0, 0, 0.5],
   2728     "56": [0, 0.64444, 0, 0, 0.5],
   2729     "57": [0.19444, 0.43056, 0, 0, 0.5],
   2730     "65": [0, 0.68333, 0, 0.13889, 0.75],
   2731     "66": [0, 0.68333, 0.05017, 0.08334, 0.75851],
   2732     "67": [0, 0.68333, 0.07153, 0.08334, 0.71472],
   2733     "68": [0, 0.68333, 0.02778, 0.05556, 0.82792],
   2734     "69": [0, 0.68333, 0.05764, 0.08334, 0.7382],
   2735     "70": [0, 0.68333, 0.13889, 0.08334, 0.64306],
   2736     "71": [0, 0.68333, 0, 0.08334, 0.78625],
   2737     "72": [0, 0.68333, 0.08125, 0.05556, 0.83125],
   2738     "73": [0, 0.68333, 0.07847, 0.11111, 0.43958],
   2739     "74": [0, 0.68333, 0.09618, 0.16667, 0.55451],
   2740     "75": [0, 0.68333, 0.07153, 0.05556, 0.84931],
   2741     "76": [0, 0.68333, 0, 0.02778, 0.68056],
   2742     "77": [0, 0.68333, 0.10903, 0.08334, 0.97014],
   2743     "78": [0, 0.68333, 0.10903, 0.08334, 0.80347],
   2744     "79": [0, 0.68333, 0.02778, 0.08334, 0.76278],
   2745     "80": [0, 0.68333, 0.13889, 0.08334, 0.64201],
   2746     "81": [0.19444, 0.68333, 0, 0.08334, 0.79056],
   2747     "82": [0, 0.68333, 0.00773, 0.08334, 0.75929],
   2748     "83": [0, 0.68333, 0.05764, 0.08334, 0.6132],
   2749     "84": [0, 0.68333, 0.13889, 0.08334, 0.58438],
   2750     "85": [0, 0.68333, 0.10903, 0.02778, 0.68278],
   2751     "86": [0, 0.68333, 0.22222, 0, 0.58333],
   2752     "87": [0, 0.68333, 0.13889, 0, 0.94445],
   2753     "88": [0, 0.68333, 0.07847, 0.08334, 0.82847],
   2754     "89": [0, 0.68333, 0.22222, 0, 0.58056],
   2755     "90": [0, 0.68333, 0.07153, 0.08334, 0.68264],
   2756     "97": [0, 0.43056, 0, 0, 0.52859],
   2757     "98": [0, 0.69444, 0, 0, 0.42917],
   2758     "99": [0, 0.43056, 0, 0.05556, 0.43276],
   2759     "100": [0, 0.69444, 0, 0.16667, 0.52049],
   2760     "101": [0, 0.43056, 0, 0.05556, 0.46563],
   2761     "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],
   2762     "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],
   2763     "104": [0, 0.69444, 0, 0, 0.57616],
   2764     "105": [0, 0.65952, 0, 0, 0.34451],
   2765     "106": [0.19444, 0.65952, 0.05724, 0, 0.41181],
   2766     "107": [0, 0.69444, 0.03148, 0, 0.5206],
   2767     "108": [0, 0.69444, 0.01968, 0.08334, 0.29838],
   2768     "109": [0, 0.43056, 0, 0, 0.87801],
   2769     "110": [0, 0.43056, 0, 0, 0.60023],
   2770     "111": [0, 0.43056, 0, 0.05556, 0.48472],
   2771     "112": [0.19444, 0.43056, 0, 0.08334, 0.50313],
   2772     "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],
   2773     "114": [0, 0.43056, 0.02778, 0.05556, 0.45116],
   2774     "115": [0, 0.43056, 0, 0.05556, 0.46875],
   2775     "116": [0, 0.61508, 0, 0.08334, 0.36111],
   2776     "117": [0, 0.43056, 0, 0.02778, 0.57246],
   2777     "118": [0, 0.43056, 0.03588, 0.02778, 0.48472],
   2778     "119": [0, 0.43056, 0.02691, 0.08334, 0.71592],
   2779     "120": [0, 0.43056, 0, 0.02778, 0.57153],
   2780     "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],
   2781     "122": [0, 0.43056, 0.04398, 0.05556, 0.46505],
   2782     "160": [0, 0, 0, 0, 0.25],
   2783     "915": [0, 0.68333, 0.13889, 0.08334, 0.61528],
   2784     "916": [0, 0.68333, 0, 0.16667, 0.83334],
   2785     "920": [0, 0.68333, 0.02778, 0.08334, 0.76278],
   2786     "923": [0, 0.68333, 0, 0.16667, 0.69445],
   2787     "926": [0, 0.68333, 0.07569, 0.08334, 0.74236],
   2788     "928": [0, 0.68333, 0.08125, 0.05556, 0.83125],
   2789     "931": [0, 0.68333, 0.05764, 0.08334, 0.77986],
   2790     "933": [0, 0.68333, 0.13889, 0.05556, 0.58333],
   2791     "934": [0, 0.68333, 0, 0.08334, 0.66667],
   2792     "936": [0, 0.68333, 0.11, 0.05556, 0.61222],
   2793     "937": [0, 0.68333, 0.05017, 0.08334, 0.7724],
   2794     "945": [0, 0.43056, 0.0037, 0.02778, 0.6397],
   2795     "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],
   2796     "947": [0.19444, 0.43056, 0.05556, 0, 0.51773],
   2797     "948": [0, 0.69444, 0.03785, 0.05556, 0.44444],
   2798     "949": [0, 0.43056, 0, 0.08334, 0.46632],
   2799     "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],
   2800     "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],
   2801     "952": [0, 0.69444, 0.02778, 0.08334, 0.46944],
   2802     "953": [0, 0.43056, 0, 0.05556, 0.35394],
   2803     "954": [0, 0.43056, 0, 0, 0.57616],
   2804     "955": [0, 0.69444, 0, 0, 0.58334],
   2805     "956": [0.19444, 0.43056, 0, 0.02778, 0.60255],
   2806     "957": [0, 0.43056, 0.06366, 0.02778, 0.49398],
   2807     "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],
   2808     "959": [0, 0.43056, 0, 0.05556, 0.48472],
   2809     "960": [0, 0.43056, 0.03588, 0, 0.57003],
   2810     "961": [0.19444, 0.43056, 0, 0.08334, 0.51702],
   2811     "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],
   2812     "963": [0, 0.43056, 0.03588, 0, 0.57141],
   2813     "964": [0, 0.43056, 0.1132, 0.02778, 0.43715],
   2814     "965": [0, 0.43056, 0.03588, 0.02778, 0.54028],
   2815     "966": [0.19444, 0.43056, 0, 0.08334, 0.65417],
   2816     "967": [0.19444, 0.43056, 0, 0.05556, 0.62569],
   2817     "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],
   2818     "969": [0, 0.43056, 0.03588, 0, 0.62245],
   2819     "977": [0, 0.69444, 0, 0.08334, 0.59144],
   2820     "981": [0.19444, 0.69444, 0, 0.08334, 0.59583],
   2821     "982": [0, 0.43056, 0.02778, 0, 0.82813],
   2822     "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702],
   2823     "1013": [0, 0.43056, 0, 0.05556, 0.4059],
   2824     "57649": [0, 0.43056, 0, 0.02778, 0.32246],
   2825     "57911": [0.19444, 0.43056, 0, 0.08334, 0.38403]
   2826   },
   2827   "SansSerif-Bold": {
   2828     "32": [0, 0, 0, 0, 0.25],
   2829     "33": [0, 0.69444, 0, 0, 0.36667],
   2830     "34": [0, 0.69444, 0, 0, 0.55834],
   2831     "35": [0.19444, 0.69444, 0, 0, 0.91667],
   2832     "36": [0.05556, 0.75, 0, 0, 0.55],
   2833     "37": [0.05556, 0.75, 0, 0, 1.02912],
   2834     "38": [0, 0.69444, 0, 0, 0.83056],
   2835     "39": [0, 0.69444, 0, 0, 0.30556],
   2836     "40": [0.25, 0.75, 0, 0, 0.42778],
   2837     "41": [0.25, 0.75, 0, 0, 0.42778],
   2838     "42": [0, 0.75, 0, 0, 0.55],
   2839     "43": [0.11667, 0.61667, 0, 0, 0.85556],
   2840     "44": [0.10556, 0.13056, 0, 0, 0.30556],
   2841     "45": [0, 0.45833, 0, 0, 0.36667],
   2842     "46": [0, 0.13056, 0, 0, 0.30556],
   2843     "47": [0.25, 0.75, 0, 0, 0.55],
   2844     "48": [0, 0.69444, 0, 0, 0.55],
   2845     "49": [0, 0.69444, 0, 0, 0.55],
   2846     "50": [0, 0.69444, 0, 0, 0.55],
   2847     "51": [0, 0.69444, 0, 0, 0.55],
   2848     "52": [0, 0.69444, 0, 0, 0.55],
   2849     "53": [0, 0.69444, 0, 0, 0.55],
   2850     "54": [0, 0.69444, 0, 0, 0.55],
   2851     "55": [0, 0.69444, 0, 0, 0.55],
   2852     "56": [0, 0.69444, 0, 0, 0.55],
   2853     "57": [0, 0.69444, 0, 0, 0.55],
   2854     "58": [0, 0.45833, 0, 0, 0.30556],
   2855     "59": [0.10556, 0.45833, 0, 0, 0.30556],
   2856     "61": [-0.09375, 0.40625, 0, 0, 0.85556],
   2857     "63": [0, 0.69444, 0, 0, 0.51945],
   2858     "64": [0, 0.69444, 0, 0, 0.73334],
   2859     "65": [0, 0.69444, 0, 0, 0.73334],
   2860     "66": [0, 0.69444, 0, 0, 0.73334],
   2861     "67": [0, 0.69444, 0, 0, 0.70278],
   2862     "68": [0, 0.69444, 0, 0, 0.79445],
   2863     "69": [0, 0.69444, 0, 0, 0.64167],
   2864     "70": [0, 0.69444, 0, 0, 0.61111],
   2865     "71": [0, 0.69444, 0, 0, 0.73334],
   2866     "72": [0, 0.69444, 0, 0, 0.79445],
   2867     "73": [0, 0.69444, 0, 0, 0.33056],
   2868     "74": [0, 0.69444, 0, 0, 0.51945],
   2869     "75": [0, 0.69444, 0, 0, 0.76389],
   2870     "76": [0, 0.69444, 0, 0, 0.58056],
   2871     "77": [0, 0.69444, 0, 0, 0.97778],
   2872     "78": [0, 0.69444, 0, 0, 0.79445],
   2873     "79": [0, 0.69444, 0, 0, 0.79445],
   2874     "80": [0, 0.69444, 0, 0, 0.70278],
   2875     "81": [0.10556, 0.69444, 0, 0, 0.79445],
   2876     "82": [0, 0.69444, 0, 0, 0.70278],
   2877     "83": [0, 0.69444, 0, 0, 0.61111],
   2878     "84": [0, 0.69444, 0, 0, 0.73334],
   2879     "85": [0, 0.69444, 0, 0, 0.76389],
   2880     "86": [0, 0.69444, 0.01528, 0, 0.73334],
   2881     "87": [0, 0.69444, 0.01528, 0, 1.03889],
   2882     "88": [0, 0.69444, 0, 0, 0.73334],
   2883     "89": [0, 0.69444, 0.0275, 0, 0.73334],
   2884     "90": [0, 0.69444, 0, 0, 0.67223],
   2885     "91": [0.25, 0.75, 0, 0, 0.34306],
   2886     "93": [0.25, 0.75, 0, 0, 0.34306],
   2887     "94": [0, 0.69444, 0, 0, 0.55],
   2888     "95": [0.35, 0.10833, 0.03056, 0, 0.55],
   2889     "97": [0, 0.45833, 0, 0, 0.525],
   2890     "98": [0, 0.69444, 0, 0, 0.56111],
   2891     "99": [0, 0.45833, 0, 0, 0.48889],
   2892     "100": [0, 0.69444, 0, 0, 0.56111],
   2893     "101": [0, 0.45833, 0, 0, 0.51111],
   2894     "102": [0, 0.69444, 0.07639, 0, 0.33611],
   2895     "103": [0.19444, 0.45833, 0.01528, 0, 0.55],
   2896     "104": [0, 0.69444, 0, 0, 0.56111],
   2897     "105": [0, 0.69444, 0, 0, 0.25556],
   2898     "106": [0.19444, 0.69444, 0, 0, 0.28611],
   2899     "107": [0, 0.69444, 0, 0, 0.53056],
   2900     "108": [0, 0.69444, 0, 0, 0.25556],
   2901     "109": [0, 0.45833, 0, 0, 0.86667],
   2902     "110": [0, 0.45833, 0, 0, 0.56111],
   2903     "111": [0, 0.45833, 0, 0, 0.55],
   2904     "112": [0.19444, 0.45833, 0, 0, 0.56111],
   2905     "113": [0.19444, 0.45833, 0, 0, 0.56111],
   2906     "114": [0, 0.45833, 0.01528, 0, 0.37222],
   2907     "115": [0, 0.45833, 0, 0, 0.42167],
   2908     "116": [0, 0.58929, 0, 0, 0.40417],
   2909     "117": [0, 0.45833, 0, 0, 0.56111],
   2910     "118": [0, 0.45833, 0.01528, 0, 0.5],
   2911     "119": [0, 0.45833, 0.01528, 0, 0.74445],
   2912     "120": [0, 0.45833, 0, 0, 0.5],
   2913     "121": [0.19444, 0.45833, 0.01528, 0, 0.5],
   2914     "122": [0, 0.45833, 0, 0, 0.47639],
   2915     "126": [0.35, 0.34444, 0, 0, 0.55],
   2916     "160": [0, 0, 0, 0, 0.25],
   2917     "168": [0, 0.69444, 0, 0, 0.55],
   2918     "176": [0, 0.69444, 0, 0, 0.73334],
   2919     "180": [0, 0.69444, 0, 0, 0.55],
   2920     "184": [0.17014, 0, 0, 0, 0.48889],
   2921     "305": [0, 0.45833, 0, 0, 0.25556],
   2922     "567": [0.19444, 0.45833, 0, 0, 0.28611],
   2923     "710": [0, 0.69444, 0, 0, 0.55],
   2924     "711": [0, 0.63542, 0, 0, 0.55],
   2925     "713": [0, 0.63778, 0, 0, 0.55],
   2926     "728": [0, 0.69444, 0, 0, 0.55],
   2927     "729": [0, 0.69444, 0, 0, 0.30556],
   2928     "730": [0, 0.69444, 0, 0, 0.73334],
   2929     "732": [0, 0.69444, 0, 0, 0.55],
   2930     "733": [0, 0.69444, 0, 0, 0.55],
   2931     "915": [0, 0.69444, 0, 0, 0.58056],
   2932     "916": [0, 0.69444, 0, 0, 0.91667],
   2933     "920": [0, 0.69444, 0, 0, 0.85556],
   2934     "923": [0, 0.69444, 0, 0, 0.67223],
   2935     "926": [0, 0.69444, 0, 0, 0.73334],
   2936     "928": [0, 0.69444, 0, 0, 0.79445],
   2937     "931": [0, 0.69444, 0, 0, 0.79445],
   2938     "933": [0, 0.69444, 0, 0, 0.85556],
   2939     "934": [0, 0.69444, 0, 0, 0.79445],
   2940     "936": [0, 0.69444, 0, 0, 0.85556],
   2941     "937": [0, 0.69444, 0, 0, 0.79445],
   2942     "8211": [0, 0.45833, 0.03056, 0, 0.55],
   2943     "8212": [0, 0.45833, 0.03056, 0, 1.10001],
   2944     "8216": [0, 0.69444, 0, 0, 0.30556],
   2945     "8217": [0, 0.69444, 0, 0, 0.30556],
   2946     "8220": [0, 0.69444, 0, 0, 0.55834],
   2947     "8221": [0, 0.69444, 0, 0, 0.55834]
   2948   },
   2949   "SansSerif-Italic": {
   2950     "32": [0, 0, 0, 0, 0.25],
   2951     "33": [0, 0.69444, 0.05733, 0, 0.31945],
   2952     "34": [0, 0.69444, 0.00316, 0, 0.5],
   2953     "35": [0.19444, 0.69444, 0.05087, 0, 0.83334],
   2954     "36": [0.05556, 0.75, 0.11156, 0, 0.5],
   2955     "37": [0.05556, 0.75, 0.03126, 0, 0.83334],
   2956     "38": [0, 0.69444, 0.03058, 0, 0.75834],
   2957     "39": [0, 0.69444, 0.07816, 0, 0.27778],
   2958     "40": [0.25, 0.75, 0.13164, 0, 0.38889],
   2959     "41": [0.25, 0.75, 0.02536, 0, 0.38889],
   2960     "42": [0, 0.75, 0.11775, 0, 0.5],
   2961     "43": [0.08333, 0.58333, 0.02536, 0, 0.77778],
   2962     "44": [0.125, 0.08333, 0, 0, 0.27778],
   2963     "45": [0, 0.44444, 0.01946, 0, 0.33333],
   2964     "46": [0, 0.08333, 0, 0, 0.27778],
   2965     "47": [0.25, 0.75, 0.13164, 0, 0.5],
   2966     "48": [0, 0.65556, 0.11156, 0, 0.5],
   2967     "49": [0, 0.65556, 0.11156, 0, 0.5],
   2968     "50": [0, 0.65556, 0.11156, 0, 0.5],
   2969     "51": [0, 0.65556, 0.11156, 0, 0.5],
   2970     "52": [0, 0.65556, 0.11156, 0, 0.5],
   2971     "53": [0, 0.65556, 0.11156, 0, 0.5],
   2972     "54": [0, 0.65556, 0.11156, 0, 0.5],
   2973     "55": [0, 0.65556, 0.11156, 0, 0.5],
   2974     "56": [0, 0.65556, 0.11156, 0, 0.5],
   2975     "57": [0, 0.65556, 0.11156, 0, 0.5],
   2976     "58": [0, 0.44444, 0.02502, 0, 0.27778],
   2977     "59": [0.125, 0.44444, 0.02502, 0, 0.27778],
   2978     "61": [-0.13, 0.37, 0.05087, 0, 0.77778],
   2979     "63": [0, 0.69444, 0.11809, 0, 0.47222],
   2980     "64": [0, 0.69444, 0.07555, 0, 0.66667],
   2981     "65": [0, 0.69444, 0, 0, 0.66667],
   2982     "66": [0, 0.69444, 0.08293, 0, 0.66667],
   2983     "67": [0, 0.69444, 0.11983, 0, 0.63889],
   2984     "68": [0, 0.69444, 0.07555, 0, 0.72223],
   2985     "69": [0, 0.69444, 0.11983, 0, 0.59722],
   2986     "70": [0, 0.69444, 0.13372, 0, 0.56945],
   2987     "71": [0, 0.69444, 0.11983, 0, 0.66667],
   2988     "72": [0, 0.69444, 0.08094, 0, 0.70834],
   2989     "73": [0, 0.69444, 0.13372, 0, 0.27778],
   2990     "74": [0, 0.69444, 0.08094, 0, 0.47222],
   2991     "75": [0, 0.69444, 0.11983, 0, 0.69445],
   2992     "76": [0, 0.69444, 0, 0, 0.54167],
   2993     "77": [0, 0.69444, 0.08094, 0, 0.875],
   2994     "78": [0, 0.69444, 0.08094, 0, 0.70834],
   2995     "79": [0, 0.69444, 0.07555, 0, 0.73611],
   2996     "80": [0, 0.69444, 0.08293, 0, 0.63889],
   2997     "81": [0.125, 0.69444, 0.07555, 0, 0.73611],
   2998     "82": [0, 0.69444, 0.08293, 0, 0.64584],
   2999     "83": [0, 0.69444, 0.09205, 0, 0.55556],
   3000     "84": [0, 0.69444, 0.13372, 0, 0.68056],
   3001     "85": [0, 0.69444, 0.08094, 0, 0.6875],
   3002     "86": [0, 0.69444, 0.1615, 0, 0.66667],
   3003     "87": [0, 0.69444, 0.1615, 0, 0.94445],
   3004     "88": [0, 0.69444, 0.13372, 0, 0.66667],
   3005     "89": [0, 0.69444, 0.17261, 0, 0.66667],
   3006     "90": [0, 0.69444, 0.11983, 0, 0.61111],
   3007     "91": [0.25, 0.75, 0.15942, 0, 0.28889],
   3008     "93": [0.25, 0.75, 0.08719, 0, 0.28889],
   3009     "94": [0, 0.69444, 0.0799, 0, 0.5],
   3010     "95": [0.35, 0.09444, 0.08616, 0, 0.5],
   3011     "97": [0, 0.44444, 0.00981, 0, 0.48056],
   3012     "98": [0, 0.69444, 0.03057, 0, 0.51667],
   3013     "99": [0, 0.44444, 0.08336, 0, 0.44445],
   3014     "100": [0, 0.69444, 0.09483, 0, 0.51667],
   3015     "101": [0, 0.44444, 0.06778, 0, 0.44445],
   3016     "102": [0, 0.69444, 0.21705, 0, 0.30556],
   3017     "103": [0.19444, 0.44444, 0.10836, 0, 0.5],
   3018     "104": [0, 0.69444, 0.01778, 0, 0.51667],
   3019     "105": [0, 0.67937, 0.09718, 0, 0.23889],
   3020     "106": [0.19444, 0.67937, 0.09162, 0, 0.26667],
   3021     "107": [0, 0.69444, 0.08336, 0, 0.48889],
   3022     "108": [0, 0.69444, 0.09483, 0, 0.23889],
   3023     "109": [0, 0.44444, 0.01778, 0, 0.79445],
   3024     "110": [0, 0.44444, 0.01778, 0, 0.51667],
   3025     "111": [0, 0.44444, 0.06613, 0, 0.5],
   3026     "112": [0.19444, 0.44444, 0.0389, 0, 0.51667],
   3027     "113": [0.19444, 0.44444, 0.04169, 0, 0.51667],
   3028     "114": [0, 0.44444, 0.10836, 0, 0.34167],
   3029     "115": [0, 0.44444, 0.0778, 0, 0.38333],
   3030     "116": [0, 0.57143, 0.07225, 0, 0.36111],
   3031     "117": [0, 0.44444, 0.04169, 0, 0.51667],
   3032     "118": [0, 0.44444, 0.10836, 0, 0.46111],
   3033     "119": [0, 0.44444, 0.10836, 0, 0.68334],
   3034     "120": [0, 0.44444, 0.09169, 0, 0.46111],
   3035     "121": [0.19444, 0.44444, 0.10836, 0, 0.46111],
   3036     "122": [0, 0.44444, 0.08752, 0, 0.43472],
   3037     "126": [0.35, 0.32659, 0.08826, 0, 0.5],
   3038     "160": [0, 0, 0, 0, 0.25],
   3039     "168": [0, 0.67937, 0.06385, 0, 0.5],
   3040     "176": [0, 0.69444, 0, 0, 0.73752],
   3041     "184": [0.17014, 0, 0, 0, 0.44445],
   3042     "305": [0, 0.44444, 0.04169, 0, 0.23889],
   3043     "567": [0.19444, 0.44444, 0.04169, 0, 0.26667],
   3044     "710": [0, 0.69444, 0.0799, 0, 0.5],
   3045     "711": [0, 0.63194, 0.08432, 0, 0.5],
   3046     "713": [0, 0.60889, 0.08776, 0, 0.5],
   3047     "714": [0, 0.69444, 0.09205, 0, 0.5],
   3048     "715": [0, 0.69444, 0, 0, 0.5],
   3049     "728": [0, 0.69444, 0.09483, 0, 0.5],
   3050     "729": [0, 0.67937, 0.07774, 0, 0.27778],
   3051     "730": [0, 0.69444, 0, 0, 0.73752],
   3052     "732": [0, 0.67659, 0.08826, 0, 0.5],
   3053     "733": [0, 0.69444, 0.09205, 0, 0.5],
   3054     "915": [0, 0.69444, 0.13372, 0, 0.54167],
   3055     "916": [0, 0.69444, 0, 0, 0.83334],
   3056     "920": [0, 0.69444, 0.07555, 0, 0.77778],
   3057     "923": [0, 0.69444, 0, 0, 0.61111],
   3058     "926": [0, 0.69444, 0.12816, 0, 0.66667],
   3059     "928": [0, 0.69444, 0.08094, 0, 0.70834],
   3060     "931": [0, 0.69444, 0.11983, 0, 0.72222],
   3061     "933": [0, 0.69444, 0.09031, 0, 0.77778],
   3062     "934": [0, 0.69444, 0.04603, 0, 0.72222],
   3063     "936": [0, 0.69444, 0.09031, 0, 0.77778],
   3064     "937": [0, 0.69444, 0.08293, 0, 0.72222],
   3065     "8211": [0, 0.44444, 0.08616, 0, 0.5],
   3066     "8212": [0, 0.44444, 0.08616, 0, 1.0],
   3067     "8216": [0, 0.69444, 0.07816, 0, 0.27778],
   3068     "8217": [0, 0.69444, 0.07816, 0, 0.27778],
   3069     "8220": [0, 0.69444, 0.14205, 0, 0.5],
   3070     "8221": [0, 0.69444, 0.00316, 0, 0.5]
   3071   },
   3072   "SansSerif-Regular": {
   3073     "32": [0, 0, 0, 0, 0.25],
   3074     "33": [0, 0.69444, 0, 0, 0.31945],
   3075     "34": [0, 0.69444, 0, 0, 0.5],
   3076     "35": [0.19444, 0.69444, 0, 0, 0.83334],
   3077     "36": [0.05556, 0.75, 0, 0, 0.5],
   3078     "37": [0.05556, 0.75, 0, 0, 0.83334],
   3079     "38": [0, 0.69444, 0, 0, 0.75834],
   3080     "39": [0, 0.69444, 0, 0, 0.27778],
   3081     "40": [0.25, 0.75, 0, 0, 0.38889],
   3082     "41": [0.25, 0.75, 0, 0, 0.38889],
   3083     "42": [0, 0.75, 0, 0, 0.5],
   3084     "43": [0.08333, 0.58333, 0, 0, 0.77778],
   3085     "44": [0.125, 0.08333, 0, 0, 0.27778],
   3086     "45": [0, 0.44444, 0, 0, 0.33333],
   3087     "46": [0, 0.08333, 0, 0, 0.27778],
   3088     "47": [0.25, 0.75, 0, 0, 0.5],
   3089     "48": [0, 0.65556, 0, 0, 0.5],
   3090     "49": [0, 0.65556, 0, 0, 0.5],
   3091     "50": [0, 0.65556, 0, 0, 0.5],
   3092     "51": [0, 0.65556, 0, 0, 0.5],
   3093     "52": [0, 0.65556, 0, 0, 0.5],
   3094     "53": [0, 0.65556, 0, 0, 0.5],
   3095     "54": [0, 0.65556, 0, 0, 0.5],
   3096     "55": [0, 0.65556, 0, 0, 0.5],
   3097     "56": [0, 0.65556, 0, 0, 0.5],
   3098     "57": [0, 0.65556, 0, 0, 0.5],
   3099     "58": [0, 0.44444, 0, 0, 0.27778],
   3100     "59": [0.125, 0.44444, 0, 0, 0.27778],
   3101     "61": [-0.13, 0.37, 0, 0, 0.77778],
   3102     "63": [0, 0.69444, 0, 0, 0.47222],
   3103     "64": [0, 0.69444, 0, 0, 0.66667],
   3104     "65": [0, 0.69444, 0, 0, 0.66667],
   3105     "66": [0, 0.69444, 0, 0, 0.66667],
   3106     "67": [0, 0.69444, 0, 0, 0.63889],
   3107     "68": [0, 0.69444, 0, 0, 0.72223],
   3108     "69": [0, 0.69444, 0, 0, 0.59722],
   3109     "70": [0, 0.69444, 0, 0, 0.56945],
   3110     "71": [0, 0.69444, 0, 0, 0.66667],
   3111     "72": [0, 0.69444, 0, 0, 0.70834],
   3112     "73": [0, 0.69444, 0, 0, 0.27778],
   3113     "74": [0, 0.69444, 0, 0, 0.47222],
   3114     "75": [0, 0.69444, 0, 0, 0.69445],
   3115     "76": [0, 0.69444, 0, 0, 0.54167],
   3116     "77": [0, 0.69444, 0, 0, 0.875],
   3117     "78": [0, 0.69444, 0, 0, 0.70834],
   3118     "79": [0, 0.69444, 0, 0, 0.73611],
   3119     "80": [0, 0.69444, 0, 0, 0.63889],
   3120     "81": [0.125, 0.69444, 0, 0, 0.73611],
   3121     "82": [0, 0.69444, 0, 0, 0.64584],
   3122     "83": [0, 0.69444, 0, 0, 0.55556],
   3123     "84": [0, 0.69444, 0, 0, 0.68056],
   3124     "85": [0, 0.69444, 0, 0, 0.6875],
   3125     "86": [0, 0.69444, 0.01389, 0, 0.66667],
   3126     "87": [0, 0.69444, 0.01389, 0, 0.94445],
   3127     "88": [0, 0.69444, 0, 0, 0.66667],
   3128     "89": [0, 0.69444, 0.025, 0, 0.66667],
   3129     "90": [0, 0.69444, 0, 0, 0.61111],
   3130     "91": [0.25, 0.75, 0, 0, 0.28889],
   3131     "93": [0.25, 0.75, 0, 0, 0.28889],
   3132     "94": [0, 0.69444, 0, 0, 0.5],
   3133     "95": [0.35, 0.09444, 0.02778, 0, 0.5],
   3134     "97": [0, 0.44444, 0, 0, 0.48056],
   3135     "98": [0, 0.69444, 0, 0, 0.51667],
   3136     "99": [0, 0.44444, 0, 0, 0.44445],
   3137     "100": [0, 0.69444, 0, 0, 0.51667],
   3138     "101": [0, 0.44444, 0, 0, 0.44445],
   3139     "102": [0, 0.69444, 0.06944, 0, 0.30556],
   3140     "103": [0.19444, 0.44444, 0.01389, 0, 0.5],
   3141     "104": [0, 0.69444, 0, 0, 0.51667],
   3142     "105": [0, 0.67937, 0, 0, 0.23889],
   3143     "106": [0.19444, 0.67937, 0, 0, 0.26667],
   3144     "107": [0, 0.69444, 0, 0, 0.48889],
   3145     "108": [0, 0.69444, 0, 0, 0.23889],
   3146     "109": [0, 0.44444, 0, 0, 0.79445],
   3147     "110": [0, 0.44444, 0, 0, 0.51667],
   3148     "111": [0, 0.44444, 0, 0, 0.5],
   3149     "112": [0.19444, 0.44444, 0, 0, 0.51667],
   3150     "113": [0.19444, 0.44444, 0, 0, 0.51667],
   3151     "114": [0, 0.44444, 0.01389, 0, 0.34167],
   3152     "115": [0, 0.44444, 0, 0, 0.38333],
   3153     "116": [0, 0.57143, 0, 0, 0.36111],
   3154     "117": [0, 0.44444, 0, 0, 0.51667],
   3155     "118": [0, 0.44444, 0.01389, 0, 0.46111],
   3156     "119": [0, 0.44444, 0.01389, 0, 0.68334],
   3157     "120": [0, 0.44444, 0, 0, 0.46111],
   3158     "121": [0.19444, 0.44444, 0.01389, 0, 0.46111],
   3159     "122": [0, 0.44444, 0, 0, 0.43472],
   3160     "126": [0.35, 0.32659, 0, 0, 0.5],
   3161     "160": [0, 0, 0, 0, 0.25],
   3162     "168": [0, 0.67937, 0, 0, 0.5],
   3163     "176": [0, 0.69444, 0, 0, 0.66667],
   3164     "184": [0.17014, 0, 0, 0, 0.44445],
   3165     "305": [0, 0.44444, 0, 0, 0.23889],
   3166     "567": [0.19444, 0.44444, 0, 0, 0.26667],
   3167     "710": [0, 0.69444, 0, 0, 0.5],
   3168     "711": [0, 0.63194, 0, 0, 0.5],
   3169     "713": [0, 0.60889, 0, 0, 0.5],
   3170     "714": [0, 0.69444, 0, 0, 0.5],
   3171     "715": [0, 0.69444, 0, 0, 0.5],
   3172     "728": [0, 0.69444, 0, 0, 0.5],
   3173     "729": [0, 0.67937, 0, 0, 0.27778],
   3174     "730": [0, 0.69444, 0, 0, 0.66667],
   3175     "732": [0, 0.67659, 0, 0, 0.5],
   3176     "733": [0, 0.69444, 0, 0, 0.5],
   3177     "915": [0, 0.69444, 0, 0, 0.54167],
   3178     "916": [0, 0.69444, 0, 0, 0.83334],
   3179     "920": [0, 0.69444, 0, 0, 0.77778],
   3180     "923": [0, 0.69444, 0, 0, 0.61111],
   3181     "926": [0, 0.69444, 0, 0, 0.66667],
   3182     "928": [0, 0.69444, 0, 0, 0.70834],
   3183     "931": [0, 0.69444, 0, 0, 0.72222],
   3184     "933": [0, 0.69444, 0, 0, 0.77778],
   3185     "934": [0, 0.69444, 0, 0, 0.72222],
   3186     "936": [0, 0.69444, 0, 0, 0.77778],
   3187     "937": [0, 0.69444, 0, 0, 0.72222],
   3188     "8211": [0, 0.44444, 0.02778, 0, 0.5],
   3189     "8212": [0, 0.44444, 0.02778, 0, 1.0],
   3190     "8216": [0, 0.69444, 0, 0, 0.27778],
   3191     "8217": [0, 0.69444, 0, 0, 0.27778],
   3192     "8220": [0, 0.69444, 0, 0, 0.5],
   3193     "8221": [0, 0.69444, 0, 0, 0.5]
   3194   },
   3195   "Script-Regular": {
   3196     "32": [0, 0, 0, 0, 0.25],
   3197     "65": [0, 0.7, 0.22925, 0, 0.80253],
   3198     "66": [0, 0.7, 0.04087, 0, 0.90757],
   3199     "67": [0, 0.7, 0.1689, 0, 0.66619],
   3200     "68": [0, 0.7, 0.09371, 0, 0.77443],
   3201     "69": [0, 0.7, 0.18583, 0, 0.56162],
   3202     "70": [0, 0.7, 0.13634, 0, 0.89544],
   3203     "71": [0, 0.7, 0.17322, 0, 0.60961],
   3204     "72": [0, 0.7, 0.29694, 0, 0.96919],
   3205     "73": [0, 0.7, 0.19189, 0, 0.80907],
   3206     "74": [0.27778, 0.7, 0.19189, 0, 1.05159],
   3207     "75": [0, 0.7, 0.31259, 0, 0.91364],
   3208     "76": [0, 0.7, 0.19189, 0, 0.87373],
   3209     "77": [0, 0.7, 0.15981, 0, 1.08031],
   3210     "78": [0, 0.7, 0.3525, 0, 0.9015],
   3211     "79": [0, 0.7, 0.08078, 0, 0.73787],
   3212     "80": [0, 0.7, 0.08078, 0, 1.01262],
   3213     "81": [0, 0.7, 0.03305, 0, 0.88282],
   3214     "82": [0, 0.7, 0.06259, 0, 0.85],
   3215     "83": [0, 0.7, 0.19189, 0, 0.86767],
   3216     "84": [0, 0.7, 0.29087, 0, 0.74697],
   3217     "85": [0, 0.7, 0.25815, 0, 0.79996],
   3218     "86": [0, 0.7, 0.27523, 0, 0.62204],
   3219     "87": [0, 0.7, 0.27523, 0, 0.80532],
   3220     "88": [0, 0.7, 0.26006, 0, 0.94445],
   3221     "89": [0, 0.7, 0.2939, 0, 0.70961],
   3222     "90": [0, 0.7, 0.24037, 0, 0.8212],
   3223     "160": [0, 0, 0, 0, 0.25]
   3224   },
   3225   "Size1-Regular": {
   3226     "32": [0, 0, 0, 0, 0.25],
   3227     "40": [0.35001, 0.85, 0, 0, 0.45834],
   3228     "41": [0.35001, 0.85, 0, 0, 0.45834],
   3229     "47": [0.35001, 0.85, 0, 0, 0.57778],
   3230     "91": [0.35001, 0.85, 0, 0, 0.41667],
   3231     "92": [0.35001, 0.85, 0, 0, 0.57778],
   3232     "93": [0.35001, 0.85, 0, 0, 0.41667],
   3233     "123": [0.35001, 0.85, 0, 0, 0.58334],
   3234     "125": [0.35001, 0.85, 0, 0, 0.58334],
   3235     "160": [0, 0, 0, 0, 0.25],
   3236     "710": [0, 0.72222, 0, 0, 0.55556],
   3237     "732": [0, 0.72222, 0, 0, 0.55556],
   3238     "770": [0, 0.72222, 0, 0, 0.55556],
   3239     "771": [0, 0.72222, 0, 0, 0.55556],
   3240     "8214": [-0.00099, 0.601, 0, 0, 0.77778],
   3241     "8593": [1e-05, 0.6, 0, 0, 0.66667],
   3242     "8595": [1e-05, 0.6, 0, 0, 0.66667],
   3243     "8657": [1e-05, 0.6, 0, 0, 0.77778],
   3244     "8659": [1e-05, 0.6, 0, 0, 0.77778],
   3245     "8719": [0.25001, 0.75, 0, 0, 0.94445],
   3246     "8720": [0.25001, 0.75, 0, 0, 0.94445],
   3247     "8721": [0.25001, 0.75, 0, 0, 1.05556],
   3248     "8730": [0.35001, 0.85, 0, 0, 1.0],
   3249     "8739": [-0.00599, 0.606, 0, 0, 0.33333],
   3250     "8741": [-0.00599, 0.606, 0, 0, 0.55556],
   3251     "8747": [0.30612, 0.805, 0.19445, 0, 0.47222],
   3252     "8748": [0.306, 0.805, 0.19445, 0, 0.47222],
   3253     "8749": [0.306, 0.805, 0.19445, 0, 0.47222],
   3254     "8750": [0.30612, 0.805, 0.19445, 0, 0.47222],
   3255     "8896": [0.25001, 0.75, 0, 0, 0.83334],
   3256     "8897": [0.25001, 0.75, 0, 0, 0.83334],
   3257     "8898": [0.25001, 0.75, 0, 0, 0.83334],
   3258     "8899": [0.25001, 0.75, 0, 0, 0.83334],
   3259     "8968": [0.35001, 0.85, 0, 0, 0.47222],
   3260     "8969": [0.35001, 0.85, 0, 0, 0.47222],
   3261     "8970": [0.35001, 0.85, 0, 0, 0.47222],
   3262     "8971": [0.35001, 0.85, 0, 0, 0.47222],
   3263     "9168": [-0.00099, 0.601, 0, 0, 0.66667],
   3264     "10216": [0.35001, 0.85, 0, 0, 0.47222],
   3265     "10217": [0.35001, 0.85, 0, 0, 0.47222],
   3266     "10752": [0.25001, 0.75, 0, 0, 1.11111],
   3267     "10753": [0.25001, 0.75, 0, 0, 1.11111],
   3268     "10754": [0.25001, 0.75, 0, 0, 1.11111],
   3269     "10756": [0.25001, 0.75, 0, 0, 0.83334],
   3270     "10758": [0.25001, 0.75, 0, 0, 0.83334]
   3271   },
   3272   "Size2-Regular": {
   3273     "32": [0, 0, 0, 0, 0.25],
   3274     "40": [0.65002, 1.15, 0, 0, 0.59722],
   3275     "41": [0.65002, 1.15, 0, 0, 0.59722],
   3276     "47": [0.65002, 1.15, 0, 0, 0.81111],
   3277     "91": [0.65002, 1.15, 0, 0, 0.47222],
   3278     "92": [0.65002, 1.15, 0, 0, 0.81111],
   3279     "93": [0.65002, 1.15, 0, 0, 0.47222],
   3280     "123": [0.65002, 1.15, 0, 0, 0.66667],
   3281     "125": [0.65002, 1.15, 0, 0, 0.66667],
   3282     "160": [0, 0, 0, 0, 0.25],
   3283     "710": [0, 0.75, 0, 0, 1.0],
   3284     "732": [0, 0.75, 0, 0, 1.0],
   3285     "770": [0, 0.75, 0, 0, 1.0],
   3286     "771": [0, 0.75, 0, 0, 1.0],
   3287     "8719": [0.55001, 1.05, 0, 0, 1.27778],
   3288     "8720": [0.55001, 1.05, 0, 0, 1.27778],
   3289     "8721": [0.55001, 1.05, 0, 0, 1.44445],
   3290     "8730": [0.65002, 1.15, 0, 0, 1.0],
   3291     "8747": [0.86225, 1.36, 0.44445, 0, 0.55556],
   3292     "8748": [0.862, 1.36, 0.44445, 0, 0.55556],
   3293     "8749": [0.862, 1.36, 0.44445, 0, 0.55556],
   3294     "8750": [0.86225, 1.36, 0.44445, 0, 0.55556],
   3295     "8896": [0.55001, 1.05, 0, 0, 1.11111],
   3296     "8897": [0.55001, 1.05, 0, 0, 1.11111],
   3297     "8898": [0.55001, 1.05, 0, 0, 1.11111],
   3298     "8899": [0.55001, 1.05, 0, 0, 1.11111],
   3299     "8968": [0.65002, 1.15, 0, 0, 0.52778],
   3300     "8969": [0.65002, 1.15, 0, 0, 0.52778],
   3301     "8970": [0.65002, 1.15, 0, 0, 0.52778],
   3302     "8971": [0.65002, 1.15, 0, 0, 0.52778],
   3303     "10216": [0.65002, 1.15, 0, 0, 0.61111],
   3304     "10217": [0.65002, 1.15, 0, 0, 0.61111],
   3305     "10752": [0.55001, 1.05, 0, 0, 1.51112],
   3306     "10753": [0.55001, 1.05, 0, 0, 1.51112],
   3307     "10754": [0.55001, 1.05, 0, 0, 1.51112],
   3308     "10756": [0.55001, 1.05, 0, 0, 1.11111],
   3309     "10758": [0.55001, 1.05, 0, 0, 1.11111]
   3310   },
   3311   "Size3-Regular": {
   3312     "32": [0, 0, 0, 0, 0.25],
   3313     "40": [0.95003, 1.45, 0, 0, 0.73611],
   3314     "41": [0.95003, 1.45, 0, 0, 0.73611],
   3315     "47": [0.95003, 1.45, 0, 0, 1.04445],
   3316     "91": [0.95003, 1.45, 0, 0, 0.52778],
   3317     "92": [0.95003, 1.45, 0, 0, 1.04445],
   3318     "93": [0.95003, 1.45, 0, 0, 0.52778],
   3319     "123": [0.95003, 1.45, 0, 0, 0.75],
   3320     "125": [0.95003, 1.45, 0, 0, 0.75],
   3321     "160": [0, 0, 0, 0, 0.25],
   3322     "710": [0, 0.75, 0, 0, 1.44445],
   3323     "732": [0, 0.75, 0, 0, 1.44445],
   3324     "770": [0, 0.75, 0, 0, 1.44445],
   3325     "771": [0, 0.75, 0, 0, 1.44445],
   3326     "8730": [0.95003, 1.45, 0, 0, 1.0],
   3327     "8968": [0.95003, 1.45, 0, 0, 0.58334],
   3328     "8969": [0.95003, 1.45, 0, 0, 0.58334],
   3329     "8970": [0.95003, 1.45, 0, 0, 0.58334],
   3330     "8971": [0.95003, 1.45, 0, 0, 0.58334],
   3331     "10216": [0.95003, 1.45, 0, 0, 0.75],
   3332     "10217": [0.95003, 1.45, 0, 0, 0.75]
   3333   },
   3334   "Size4-Regular": {
   3335     "32": [0, 0, 0, 0, 0.25],
   3336     "40": [1.25003, 1.75, 0, 0, 0.79167],
   3337     "41": [1.25003, 1.75, 0, 0, 0.79167],
   3338     "47": [1.25003, 1.75, 0, 0, 1.27778],
   3339     "91": [1.25003, 1.75, 0, 0, 0.58334],
   3340     "92": [1.25003, 1.75, 0, 0, 1.27778],
   3341     "93": [1.25003, 1.75, 0, 0, 0.58334],
   3342     "123": [1.25003, 1.75, 0, 0, 0.80556],
   3343     "125": [1.25003, 1.75, 0, 0, 0.80556],
   3344     "160": [0, 0, 0, 0, 0.25],
   3345     "710": [0, 0.825, 0, 0, 1.8889],
   3346     "732": [0, 0.825, 0, 0, 1.8889],
   3347     "770": [0, 0.825, 0, 0, 1.8889],
   3348     "771": [0, 0.825, 0, 0, 1.8889],
   3349     "8730": [1.25003, 1.75, 0, 0, 1.0],
   3350     "8968": [1.25003, 1.75, 0, 0, 0.63889],
   3351     "8969": [1.25003, 1.75, 0, 0, 0.63889],
   3352     "8970": [1.25003, 1.75, 0, 0, 0.63889],
   3353     "8971": [1.25003, 1.75, 0, 0, 0.63889],
   3354     "9115": [0.64502, 1.155, 0, 0, 0.875],
   3355     "9116": [1e-05, 0.6, 0, 0, 0.875],
   3356     "9117": [0.64502, 1.155, 0, 0, 0.875],
   3357     "9118": [0.64502, 1.155, 0, 0, 0.875],
   3358     "9119": [1e-05, 0.6, 0, 0, 0.875],
   3359     "9120": [0.64502, 1.155, 0, 0, 0.875],
   3360     "9121": [0.64502, 1.155, 0, 0, 0.66667],
   3361     "9122": [-0.00099, 0.601, 0, 0, 0.66667],
   3362     "9123": [0.64502, 1.155, 0, 0, 0.66667],
   3363     "9124": [0.64502, 1.155, 0, 0, 0.66667],
   3364     "9125": [-0.00099, 0.601, 0, 0, 0.66667],
   3365     "9126": [0.64502, 1.155, 0, 0, 0.66667],
   3366     "9127": [1e-05, 0.9, 0, 0, 0.88889],
   3367     "9128": [0.65002, 1.15, 0, 0, 0.88889],
   3368     "9129": [0.90001, 0, 0, 0, 0.88889],
   3369     "9130": [0, 0.3, 0, 0, 0.88889],
   3370     "9131": [1e-05, 0.9, 0, 0, 0.88889],
   3371     "9132": [0.65002, 1.15, 0, 0, 0.88889],
   3372     "9133": [0.90001, 0, 0, 0, 0.88889],
   3373     "9143": [0.88502, 0.915, 0, 0, 1.05556],
   3374     "10216": [1.25003, 1.75, 0, 0, 0.80556],
   3375     "10217": [1.25003, 1.75, 0, 0, 0.80556],
   3376     "57344": [-0.00499, 0.605, 0, 0, 1.05556],
   3377     "57345": [-0.00499, 0.605, 0, 0, 1.05556],
   3378     "57680": [0, 0.12, 0, 0, 0.45],
   3379     "57681": [0, 0.12, 0, 0, 0.45],
   3380     "57682": [0, 0.12, 0, 0, 0.45],
   3381     "57683": [0, 0.12, 0, 0, 0.45]
   3382   },
   3383   "Typewriter-Regular": {
   3384     "32": [0, 0, 0, 0, 0.525],
   3385     "33": [0, 0.61111, 0, 0, 0.525],
   3386     "34": [0, 0.61111, 0, 0, 0.525],
   3387     "35": [0, 0.61111, 0, 0, 0.525],
   3388     "36": [0.08333, 0.69444, 0, 0, 0.525],
   3389     "37": [0.08333, 0.69444, 0, 0, 0.525],
   3390     "38": [0, 0.61111, 0, 0, 0.525],
   3391     "39": [0, 0.61111, 0, 0, 0.525],
   3392     "40": [0.08333, 0.69444, 0, 0, 0.525],
   3393     "41": [0.08333, 0.69444, 0, 0, 0.525],
   3394     "42": [0, 0.52083, 0, 0, 0.525],
   3395     "43": [-0.08056, 0.53055, 0, 0, 0.525],
   3396     "44": [0.13889, 0.125, 0, 0, 0.525],
   3397     "45": [-0.08056, 0.53055, 0, 0, 0.525],
   3398     "46": [0, 0.125, 0, 0, 0.525],
   3399     "47": [0.08333, 0.69444, 0, 0, 0.525],
   3400     "48": [0, 0.61111, 0, 0, 0.525],
   3401     "49": [0, 0.61111, 0, 0, 0.525],
   3402     "50": [0, 0.61111, 0, 0, 0.525],
   3403     "51": [0, 0.61111, 0, 0, 0.525],
   3404     "52": [0, 0.61111, 0, 0, 0.525],
   3405     "53": [0, 0.61111, 0, 0, 0.525],
   3406     "54": [0, 0.61111, 0, 0, 0.525],
   3407     "55": [0, 0.61111, 0, 0, 0.525],
   3408     "56": [0, 0.61111, 0, 0, 0.525],
   3409     "57": [0, 0.61111, 0, 0, 0.525],
   3410     "58": [0, 0.43056, 0, 0, 0.525],
   3411     "59": [0.13889, 0.43056, 0, 0, 0.525],
   3412     "60": [-0.05556, 0.55556, 0, 0, 0.525],
   3413     "61": [-0.19549, 0.41562, 0, 0, 0.525],
   3414     "62": [-0.05556, 0.55556, 0, 0, 0.525],
   3415     "63": [0, 0.61111, 0, 0, 0.525],
   3416     "64": [0, 0.61111, 0, 0, 0.525],
   3417     "65": [0, 0.61111, 0, 0, 0.525],
   3418     "66": [0, 0.61111, 0, 0, 0.525],
   3419     "67": [0, 0.61111, 0, 0, 0.525],
   3420     "68": [0, 0.61111, 0, 0, 0.525],
   3421     "69": [0, 0.61111, 0, 0, 0.525],
   3422     "70": [0, 0.61111, 0, 0, 0.525],
   3423     "71": [0, 0.61111, 0, 0, 0.525],
   3424     "72": [0, 0.61111, 0, 0, 0.525],
   3425     "73": [0, 0.61111, 0, 0, 0.525],
   3426     "74": [0, 0.61111, 0, 0, 0.525],
   3427     "75": [0, 0.61111, 0, 0, 0.525],
   3428     "76": [0, 0.61111, 0, 0, 0.525],
   3429     "77": [0, 0.61111, 0, 0, 0.525],
   3430     "78": [0, 0.61111, 0, 0, 0.525],
   3431     "79": [0, 0.61111, 0, 0, 0.525],
   3432     "80": [0, 0.61111, 0, 0, 0.525],
   3433     "81": [0.13889, 0.61111, 0, 0, 0.525],
   3434     "82": [0, 0.61111, 0, 0, 0.525],
   3435     "83": [0, 0.61111, 0, 0, 0.525],
   3436     "84": [0, 0.61111, 0, 0, 0.525],
   3437     "85": [0, 0.61111, 0, 0, 0.525],
   3438     "86": [0, 0.61111, 0, 0, 0.525],
   3439     "87": [0, 0.61111, 0, 0, 0.525],
   3440     "88": [0, 0.61111, 0, 0, 0.525],
   3441     "89": [0, 0.61111, 0, 0, 0.525],
   3442     "90": [0, 0.61111, 0, 0, 0.525],
   3443     "91": [0.08333, 0.69444, 0, 0, 0.525],
   3444     "92": [0.08333, 0.69444, 0, 0, 0.525],
   3445     "93": [0.08333, 0.69444, 0, 0, 0.525],
   3446     "94": [0, 0.61111, 0, 0, 0.525],
   3447     "95": [0.09514, 0, 0, 0, 0.525],
   3448     "96": [0, 0.61111, 0, 0, 0.525],
   3449     "97": [0, 0.43056, 0, 0, 0.525],
   3450     "98": [0, 0.61111, 0, 0, 0.525],
   3451     "99": [0, 0.43056, 0, 0, 0.525],
   3452     "100": [0, 0.61111, 0, 0, 0.525],
   3453     "101": [0, 0.43056, 0, 0, 0.525],
   3454     "102": [0, 0.61111, 0, 0, 0.525],
   3455     "103": [0.22222, 0.43056, 0, 0, 0.525],
   3456     "104": [0, 0.61111, 0, 0, 0.525],
   3457     "105": [0, 0.61111, 0, 0, 0.525],
   3458     "106": [0.22222, 0.61111, 0, 0, 0.525],
   3459     "107": [0, 0.61111, 0, 0, 0.525],
   3460     "108": [0, 0.61111, 0, 0, 0.525],
   3461     "109": [0, 0.43056, 0, 0, 0.525],
   3462     "110": [0, 0.43056, 0, 0, 0.525],
   3463     "111": [0, 0.43056, 0, 0, 0.525],
   3464     "112": [0.22222, 0.43056, 0, 0, 0.525],
   3465     "113": [0.22222, 0.43056, 0, 0, 0.525],
   3466     "114": [0, 0.43056, 0, 0, 0.525],
   3467     "115": [0, 0.43056, 0, 0, 0.525],
   3468     "116": [0, 0.55358, 0, 0, 0.525],
   3469     "117": [0, 0.43056, 0, 0, 0.525],
   3470     "118": [0, 0.43056, 0, 0, 0.525],
   3471     "119": [0, 0.43056, 0, 0, 0.525],
   3472     "120": [0, 0.43056, 0, 0, 0.525],
   3473     "121": [0.22222, 0.43056, 0, 0, 0.525],
   3474     "122": [0, 0.43056, 0, 0, 0.525],
   3475     "123": [0.08333, 0.69444, 0, 0, 0.525],
   3476     "124": [0.08333, 0.69444, 0, 0, 0.525],
   3477     "125": [0.08333, 0.69444, 0, 0, 0.525],
   3478     "126": [0, 0.61111, 0, 0, 0.525],
   3479     "127": [0, 0.61111, 0, 0, 0.525],
   3480     "160": [0, 0, 0, 0, 0.525],
   3481     "176": [0, 0.61111, 0, 0, 0.525],
   3482     "184": [0.19445, 0, 0, 0, 0.525],
   3483     "305": [0, 0.43056, 0, 0, 0.525],
   3484     "567": [0.22222, 0.43056, 0, 0, 0.525],
   3485     "711": [0, 0.56597, 0, 0, 0.525],
   3486     "713": [0, 0.56555, 0, 0, 0.525],
   3487     "714": [0, 0.61111, 0, 0, 0.525],
   3488     "715": [0, 0.61111, 0, 0, 0.525],
   3489     "728": [0, 0.61111, 0, 0, 0.525],
   3490     "730": [0, 0.61111, 0, 0, 0.525],
   3491     "770": [0, 0.61111, 0, 0, 0.525],
   3492     "771": [0, 0.61111, 0, 0, 0.525],
   3493     "776": [0, 0.61111, 0, 0, 0.525],
   3494     "915": [0, 0.61111, 0, 0, 0.525],
   3495     "916": [0, 0.61111, 0, 0, 0.525],
   3496     "920": [0, 0.61111, 0, 0, 0.525],
   3497     "923": [0, 0.61111, 0, 0, 0.525],
   3498     "926": [0, 0.61111, 0, 0, 0.525],
   3499     "928": [0, 0.61111, 0, 0, 0.525],
   3500     "931": [0, 0.61111, 0, 0, 0.525],
   3501     "933": [0, 0.61111, 0, 0, 0.525],
   3502     "934": [0, 0.61111, 0, 0, 0.525],
   3503     "936": [0, 0.61111, 0, 0, 0.525],
   3504     "937": [0, 0.61111, 0, 0, 0.525],
   3505     "8216": [0, 0.61111, 0, 0, 0.525],
   3506     "8217": [0, 0.61111, 0, 0, 0.525],
   3507     "8242": [0, 0.61111, 0, 0, 0.525],
   3508     "9251": [0.11111, 0.21944, 0, 0, 0.525]
   3509   }
   3510 });
   3511 ;// CONCATENATED MODULE: ./src/fontMetrics.js
   3512 
   3513 
   3514 /**
   3515  * This file contains metrics regarding fonts and individual symbols. The sigma
   3516  * and xi variables, as well as the metricMap map contain data extracted from
   3517  * TeX, TeX font metrics, and the TTF files. These data are then exposed via the
   3518  * `metrics` variable and the getCharacterMetrics function.
   3519  */
   3520 // In TeX, there are actually three sets of dimensions, one for each of
   3521 // textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:
   3522 // 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt).  These are
   3523 // provided in the the arrays below, in that order.
   3524 //
   3525 // The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively.
   3526 // This was determined by running the following script:
   3527 //
   3528 //     latex -interaction=nonstopmode \
   3529 //     '\documentclass{article}\usepackage{amsmath}\begin{document}' \
   3530 //     '$a$ \expandafter\show\the\textfont2' \
   3531 //     '\expandafter\show\the\scriptfont2' \
   3532 //     '\expandafter\show\the\scriptscriptfont2' \
   3533 //     '\stop'
   3534 //
   3535 // The metrics themselves were retreived using the following commands:
   3536 //
   3537 //     tftopl cmsy10
   3538 //     tftopl cmsy7
   3539 //     tftopl cmsy5
   3540 //
   3541 // The output of each of these commands is quite lengthy.  The only part we
   3542 // care about is the FONTDIMEN section. Each value is measured in EMs.
   3543 var sigmasAndXis = {
   3544   slant: [0.250, 0.250, 0.250],
   3545   // sigma1
   3546   space: [0.000, 0.000, 0.000],
   3547   // sigma2
   3548   stretch: [0.000, 0.000, 0.000],
   3549   // sigma3
   3550   shrink: [0.000, 0.000, 0.000],
   3551   // sigma4
   3552   xHeight: [0.431, 0.431, 0.431],
   3553   // sigma5
   3554   quad: [1.000, 1.171, 1.472],
   3555   // sigma6
   3556   extraSpace: [0.000, 0.000, 0.000],
   3557   // sigma7
   3558   num1: [0.677, 0.732, 0.925],
   3559   // sigma8
   3560   num2: [0.394, 0.384, 0.387],
   3561   // sigma9
   3562   num3: [0.444, 0.471, 0.504],
   3563   // sigma10
   3564   denom1: [0.686, 0.752, 1.025],
   3565   // sigma11
   3566   denom2: [0.345, 0.344, 0.532],
   3567   // sigma12
   3568   sup1: [0.413, 0.503, 0.504],
   3569   // sigma13
   3570   sup2: [0.363, 0.431, 0.404],
   3571   // sigma14
   3572   sup3: [0.289, 0.286, 0.294],
   3573   // sigma15
   3574   sub1: [0.150, 0.143, 0.200],
   3575   // sigma16
   3576   sub2: [0.247, 0.286, 0.400],
   3577   // sigma17
   3578   supDrop: [0.386, 0.353, 0.494],
   3579   // sigma18
   3580   subDrop: [0.050, 0.071, 0.100],
   3581   // sigma19
   3582   delim1: [2.390, 1.700, 1.980],
   3583   // sigma20
   3584   delim2: [1.010, 1.157, 1.420],
   3585   // sigma21
   3586   axisHeight: [0.250, 0.250, 0.250],
   3587   // sigma22
   3588   // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
   3589   // they correspond to the font parameters of the extension fonts (family 3).
   3590   // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
   3591   // match cmex7, we'd use cmex7.tfm values for script and scriptscript
   3592   // values.
   3593   defaultRuleThickness: [0.04, 0.049, 0.049],
   3594   // xi8; cmex7: 0.049
   3595   bigOpSpacing1: [0.111, 0.111, 0.111],
   3596   // xi9
   3597   bigOpSpacing2: [0.166, 0.166, 0.166],
   3598   // xi10
   3599   bigOpSpacing3: [0.2, 0.2, 0.2],
   3600   // xi11
   3601   bigOpSpacing4: [0.6, 0.611, 0.611],
   3602   // xi12; cmex7: 0.611
   3603   bigOpSpacing5: [0.1, 0.143, 0.143],
   3604   // xi13; cmex7: 0.143
   3605   // The \sqrt rule width is taken from the height of the surd character.
   3606   // Since we use the same font at all sizes, this thickness doesn't scale.
   3607   sqrtRuleThickness: [0.04, 0.04, 0.04],
   3608   // This value determines how large a pt is, for metrics which are defined
   3609   // in terms of pts.
   3610   // This value is also used in katex.less; if you change it make sure the
   3611   // values match.
   3612   ptPerEm: [10.0, 10.0, 10.0],
   3613   // The space between adjacent `|` columns in an array definition. From
   3614   // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
   3615   doubleRuleSep: [0.2, 0.2, 0.2],
   3616   // The width of separator lines in {array} environments. From
   3617   // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
   3618   arrayRuleWidth: [0.04, 0.04, 0.04],
   3619   // Two values from LaTeX source2e:
   3620   fboxsep: [0.3, 0.3, 0.3],
   3621   //        3 pt / ptPerEm
   3622   fboxrule: [0.04, 0.04, 0.04] // 0.4 pt / ptPerEm
   3623 
   3624 }; // This map contains a mapping from font name and character code to character
   3625 // metrics, including height, depth, italic correction, and skew (kern from the
   3626 // character to the corresponding \skewchar)
   3627 // This map is generated via `make metrics`. It should not be changed manually.
   3628 
   3629  // These are very rough approximations.  We default to Times New Roman which
   3630 // should have Latin-1 and Cyrillic characters, but may not depending on the
   3631 // operating system.  The metrics do not account for extra height from the
   3632 // accents.  In the case of Cyrillic characters which have both ascenders and
   3633 // descenders we prefer approximations with ascenders, primarily to prevent
   3634 // the fraction bar or root line from intersecting the glyph.
   3635 // TODO(kevinb) allow union of multiple glyph metrics for better accuracy.
   3636 
   3637 var extraCharacterMap = {
   3638   // Latin-1
   3639   'Å': 'A',
   3640   'Ç': 'C',
   3641   'Ð': 'D',
   3642   'Þ': 'o',
   3643   'å': 'a',
   3644   'ç': 'c',
   3645   'ð': 'd',
   3646   'þ': 'o',
   3647   // Cyrillic
   3648   'А': 'A',
   3649   'Б': 'B',
   3650   'В': 'B',
   3651   'Г': 'F',
   3652   'Д': 'A',
   3653   'Е': 'E',
   3654   'Ж': 'K',
   3655   'З': '3',
   3656   'И': 'N',
   3657   'Й': 'N',
   3658   'К': 'K',
   3659   'Л': 'N',
   3660   'М': 'M',
   3661   'Н': 'H',
   3662   'О': 'O',
   3663   'П': 'N',
   3664   'Р': 'P',
   3665   'С': 'C',
   3666   'Т': 'T',
   3667   'У': 'y',
   3668   'Ф': 'O',
   3669   'Х': 'X',
   3670   'Ц': 'U',
   3671   'Ч': 'h',
   3672   'Ш': 'W',
   3673   'Щ': 'W',
   3674   'Ъ': 'B',
   3675   'Ы': 'X',
   3676   'Ь': 'B',
   3677   'Э': '3',
   3678   'Ю': 'X',
   3679   'Я': 'R',
   3680   'а': 'a',
   3681   'б': 'b',
   3682   'в': 'a',
   3683   'г': 'r',
   3684   'д': 'y',
   3685   'е': 'e',
   3686   'ж': 'm',
   3687   'з': 'e',
   3688   'и': 'n',
   3689   'й': 'n',
   3690   'к': 'n',
   3691   'л': 'n',
   3692   'м': 'm',
   3693   'н': 'n',
   3694   'о': 'o',
   3695   'п': 'n',
   3696   'р': 'p',
   3697   'с': 'c',
   3698   'т': 'o',
   3699   'у': 'y',
   3700   'ф': 'b',
   3701   'х': 'x',
   3702   'ц': 'n',
   3703   'ч': 'n',
   3704   'ш': 'w',
   3705   'щ': 'w',
   3706   'ъ': 'a',
   3707   'ы': 'm',
   3708   'ь': 'a',
   3709   'э': 'e',
   3710   'ю': 'm',
   3711   'я': 'r'
   3712 };
   3713 
   3714 /**
   3715  * This function adds new font metrics to default metricMap
   3716  * It can also override existing metrics
   3717  */
   3718 function setFontMetrics(fontName, metrics) {
   3719   fontMetricsData[fontName] = metrics;
   3720 }
   3721 /**
   3722  * This function is a convenience function for looking up information in the
   3723  * metricMap table. It takes a character as a string, and a font.
   3724  *
   3725  * Note: the `width` property may be undefined if fontMetricsData.js wasn't
   3726  * built using `Make extended_metrics`.
   3727  */
   3728 
   3729 function getCharacterMetrics(character, font, mode) {
   3730   if (!fontMetricsData[font]) {
   3731     throw new Error("Font metrics not found for font: " + font + ".");
   3732   }
   3733 
   3734   var ch = character.charCodeAt(0);
   3735   var metrics = fontMetricsData[font][ch];
   3736 
   3737   if (!metrics && character[0] in extraCharacterMap) {
   3738     ch = extraCharacterMap[character[0]].charCodeAt(0);
   3739     metrics = fontMetricsData[font][ch];
   3740   }
   3741 
   3742   if (!metrics && mode === 'text') {
   3743     // We don't typically have font metrics for Asian scripts.
   3744     // But since we support them in text mode, we need to return
   3745     // some sort of metrics.
   3746     // So if the character is in a script we support but we
   3747     // don't have metrics for it, just use the metrics for
   3748     // the Latin capital letter M. This is close enough because
   3749     // we (currently) only care about the height of the glpyh
   3750     // not its width.
   3751     if (supportedCodepoint(ch)) {
   3752       metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M'
   3753     }
   3754   }
   3755 
   3756   if (metrics) {
   3757     return {
   3758       depth: metrics[0],
   3759       height: metrics[1],
   3760       italic: metrics[2],
   3761       skew: metrics[3],
   3762       width: metrics[4]
   3763     };
   3764   }
   3765 }
   3766 var fontMetricsBySizeIndex = {};
   3767 /**
   3768  * Get the font metrics for a given size.
   3769  */
   3770 
   3771 function getGlobalMetrics(size) {
   3772   var sizeIndex;
   3773 
   3774   if (size >= 5) {
   3775     sizeIndex = 0;
   3776   } else if (size >= 3) {
   3777     sizeIndex = 1;
   3778   } else {
   3779     sizeIndex = 2;
   3780   }
   3781 
   3782   if (!fontMetricsBySizeIndex[sizeIndex]) {
   3783     var metrics = fontMetricsBySizeIndex[sizeIndex] = {
   3784       cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
   3785     };
   3786 
   3787     for (var key in sigmasAndXis) {
   3788       if (sigmasAndXis.hasOwnProperty(key)) {
   3789         metrics[key] = sigmasAndXis[key][sizeIndex];
   3790       }
   3791     }
   3792   }
   3793 
   3794   return fontMetricsBySizeIndex[sizeIndex];
   3795 }
   3796 ;// CONCATENATED MODULE: ./src/symbols.js
   3797 /**
   3798  * This file holds a list of all no-argument functions and single-character
   3799  * symbols (like 'a' or ';').
   3800  *
   3801  * For each of the symbols, there are three properties they can have:
   3802  * - font (required): the font to be used for this symbol. Either "main" (the
   3803      normal font), or "ams" (the ams fonts).
   3804  * - group (required): the ParseNode group type the symbol should have (i.e.
   3805      "textord", "mathord", etc).
   3806      See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types
   3807  * - replace: the character that this symbol or function should be
   3808  *   replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi
   3809  *   character in the main font).
   3810  *
   3811  * The outermost map in the table indicates what mode the symbols should be
   3812  * accepted in (e.g. "math" or "text").
   3813  */
   3814 // Some of these have a "-token" suffix since these are also used as `ParseNode`
   3815 // types for raw text tokens, and we want to avoid conflicts with higher-level
   3816 // `ParseNode` types. These `ParseNode`s are constructed within `Parser` by
   3817 // looking up the `symbols` map.
   3818 var ATOMS = {
   3819   "bin": 1,
   3820   "close": 1,
   3821   "inner": 1,
   3822   "open": 1,
   3823   "punct": 1,
   3824   "rel": 1
   3825 };
   3826 var NON_ATOMS = {
   3827   "accent-token": 1,
   3828   "mathord": 1,
   3829   "op-token": 1,
   3830   "spacing": 1,
   3831   "textord": 1
   3832 };
   3833 var symbols = {
   3834   "math": {},
   3835   "text": {}
   3836 };
   3837 /* harmony default export */ var src_symbols = (symbols);
   3838 /** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
   3839 
   3840 function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) {
   3841   symbols[mode][name] = {
   3842     font: font,
   3843     group: group,
   3844     replace: replace
   3845   };
   3846 
   3847   if (acceptUnicodeChar && replace) {
   3848     symbols[mode][replace] = symbols[mode][name];
   3849   }
   3850 } // Some abbreviations for commonly used strings.
   3851 // This helps minify the code, and also spotting typos using jshint.
   3852 // modes:
   3853 
   3854 var math = "math";
   3855 var symbols_text = "text"; // fonts:
   3856 
   3857 var main = "main";
   3858 var ams = "ams"; // groups:
   3859 
   3860 var accent = "accent-token";
   3861 var bin = "bin";
   3862 var symbols_close = "close";
   3863 var inner = "inner";
   3864 var mathord = "mathord";
   3865 var op = "op-token";
   3866 var symbols_open = "open";
   3867 var punct = "punct";
   3868 var rel = "rel";
   3869 var spacing = "spacing";
   3870 var textord = "textord"; // Now comes the symbol table
   3871 // Relation Symbols
   3872 
   3873 defineSymbol(math, main, rel, "\u2261", "\\equiv", true);
   3874 defineSymbol(math, main, rel, "\u227A", "\\prec", true);
   3875 defineSymbol(math, main, rel, "\u227B", "\\succ", true);
   3876 defineSymbol(math, main, rel, "\u223C", "\\sim", true);
   3877 defineSymbol(math, main, rel, "\u22A5", "\\perp");
   3878 defineSymbol(math, main, rel, "\u2AAF", "\\preceq", true);
   3879 defineSymbol(math, main, rel, "\u2AB0", "\\succeq", true);
   3880 defineSymbol(math, main, rel, "\u2243", "\\simeq", true);
   3881 defineSymbol(math, main, rel, "\u2223", "\\mid", true);
   3882 defineSymbol(math, main, rel, "\u226A", "\\ll", true);
   3883 defineSymbol(math, main, rel, "\u226B", "\\gg", true);
   3884 defineSymbol(math, main, rel, "\u224D", "\\asymp", true);
   3885 defineSymbol(math, main, rel, "\u2225", "\\parallel");
   3886 defineSymbol(math, main, rel, "\u22C8", "\\bowtie", true);
   3887 defineSymbol(math, main, rel, "\u2323", "\\smile", true);
   3888 defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true);
   3889 defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true);
   3890 defineSymbol(math, main, rel, "\u2250", "\\doteq", true);
   3891 defineSymbol(math, main, rel, "\u2322", "\\frown", true);
   3892 defineSymbol(math, main, rel, "\u220B", "\\ni", true);
   3893 defineSymbol(math, main, rel, "\u221D", "\\propto", true);
   3894 defineSymbol(math, main, rel, "\u22A2", "\\vdash", true);
   3895 defineSymbol(math, main, rel, "\u22A3", "\\dashv", true);
   3896 defineSymbol(math, main, rel, "\u220B", "\\owns"); // Punctuation
   3897 
   3898 defineSymbol(math, main, punct, ".", "\\ldotp");
   3899 defineSymbol(math, main, punct, "\u22C5", "\\cdotp"); // Misc Symbols
   3900 
   3901 defineSymbol(math, main, textord, "#", "\\#");
   3902 defineSymbol(symbols_text, main, textord, "#", "\\#");
   3903 defineSymbol(math, main, textord, "&", "\\&");
   3904 defineSymbol(symbols_text, main, textord, "&", "\\&");
   3905 defineSymbol(math, main, textord, "\u2135", "\\aleph", true);
   3906 defineSymbol(math, main, textord, "\u2200", "\\forall", true);
   3907 defineSymbol(math, main, textord, "\u210F", "\\hbar", true);
   3908 defineSymbol(math, main, textord, "\u2203", "\\exists", true);
   3909 defineSymbol(math, main, textord, "\u2207", "\\nabla", true);
   3910 defineSymbol(math, main, textord, "\u266D", "\\flat", true);
   3911 defineSymbol(math, main, textord, "\u2113", "\\ell", true);
   3912 defineSymbol(math, main, textord, "\u266E", "\\natural", true);
   3913 defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true);
   3914 defineSymbol(math, main, textord, "\u2118", "\\wp", true);
   3915 defineSymbol(math, main, textord, "\u266F", "\\sharp", true);
   3916 defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true);
   3917 defineSymbol(math, main, textord, "\u211C", "\\Re", true);
   3918 defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true);
   3919 defineSymbol(math, main, textord, "\u2111", "\\Im", true);
   3920 defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true);
   3921 defineSymbol(symbols_text, main, textord, "\xA7", "\\S", true);
   3922 defineSymbol(symbols_text, main, textord, "\xB6", "\\P", true); // Math and Text
   3923 
   3924 defineSymbol(math, main, textord, "\u2020", "\\dag");
   3925 defineSymbol(symbols_text, main, textord, "\u2020", "\\dag");
   3926 defineSymbol(symbols_text, main, textord, "\u2020", "\\textdagger");
   3927 defineSymbol(math, main, textord, "\u2021", "\\ddag");
   3928 defineSymbol(symbols_text, main, textord, "\u2021", "\\ddag");
   3929 defineSymbol(symbols_text, main, textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters
   3930 
   3931 defineSymbol(math, main, symbols_close, "\u23B1", "\\rmoustache", true);
   3932 defineSymbol(math, main, symbols_open, "\u23B0", "\\lmoustache", true);
   3933 defineSymbol(math, main, symbols_close, "\u27EF", "\\rgroup", true);
   3934 defineSymbol(math, main, symbols_open, "\u27EE", "\\lgroup", true); // Binary Operators
   3935 
   3936 defineSymbol(math, main, bin, "\u2213", "\\mp", true);
   3937 defineSymbol(math, main, bin, "\u2296", "\\ominus", true);
   3938 defineSymbol(math, main, bin, "\u228E", "\\uplus", true);
   3939 defineSymbol(math, main, bin, "\u2293", "\\sqcap", true);
   3940 defineSymbol(math, main, bin, "\u2217", "\\ast");
   3941 defineSymbol(math, main, bin, "\u2294", "\\sqcup", true);
   3942 defineSymbol(math, main, bin, "\u25EF", "\\bigcirc", true);
   3943 defineSymbol(math, main, bin, "\u2219", "\\bullet");
   3944 defineSymbol(math, main, bin, "\u2021", "\\ddagger");
   3945 defineSymbol(math, main, bin, "\u2240", "\\wr", true);
   3946 defineSymbol(math, main, bin, "\u2A3F", "\\amalg");
   3947 defineSymbol(math, main, bin, "&", "\\And"); // from amsmath
   3948 // Arrow Symbols
   3949 
   3950 defineSymbol(math, main, rel, "\u27F5", "\\longleftarrow", true);
   3951 defineSymbol(math, main, rel, "\u21D0", "\\Leftarrow", true);
   3952 defineSymbol(math, main, rel, "\u27F8", "\\Longleftarrow", true);
   3953 defineSymbol(math, main, rel, "\u27F6", "\\longrightarrow", true);
   3954 defineSymbol(math, main, rel, "\u21D2", "\\Rightarrow", true);
   3955 defineSymbol(math, main, rel, "\u27F9", "\\Longrightarrow", true);
   3956 defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true);
   3957 defineSymbol(math, main, rel, "\u27F7", "\\longleftrightarrow", true);
   3958 defineSymbol(math, main, rel, "\u21D4", "\\Leftrightarrow", true);
   3959 defineSymbol(math, main, rel, "\u27FA", "\\Longleftrightarrow", true);
   3960 defineSymbol(math, main, rel, "\u21A6", "\\mapsto", true);
   3961 defineSymbol(math, main, rel, "\u27FC", "\\longmapsto", true);
   3962 defineSymbol(math, main, rel, "\u2197", "\\nearrow", true);
   3963 defineSymbol(math, main, rel, "\u21A9", "\\hookleftarrow", true);
   3964 defineSymbol(math, main, rel, "\u21AA", "\\hookrightarrow", true);
   3965 defineSymbol(math, main, rel, "\u2198", "\\searrow", true);
   3966 defineSymbol(math, main, rel, "\u21BC", "\\leftharpoonup", true);
   3967 defineSymbol(math, main, rel, "\u21C0", "\\rightharpoonup", true);
   3968 defineSymbol(math, main, rel, "\u2199", "\\swarrow", true);
   3969 defineSymbol(math, main, rel, "\u21BD", "\\leftharpoondown", true);
   3970 defineSymbol(math, main, rel, "\u21C1", "\\rightharpoondown", true);
   3971 defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true);
   3972 defineSymbol(math, main, rel, "\u21CC", "\\rightleftharpoons", true); // AMS Negated Binary Relations
   3973 
   3974 defineSymbol(math, ams, rel, "\u226E", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro.
   3975 
   3976 defineSymbol(math, ams, rel, "\uE010", "\\@nleqslant");
   3977 defineSymbol(math, ams, rel, "\uE011", "\\@nleqq");
   3978 defineSymbol(math, ams, rel, "\u2A87", "\\lneq", true);
   3979 defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true);
   3980 defineSymbol(math, ams, rel, "\uE00C", "\\@lvertneqq");
   3981 defineSymbol(math, ams, rel, "\u22E6", "\\lnsim", true);
   3982 defineSymbol(math, ams, rel, "\u2A89", "\\lnapprox", true);
   3983 defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym.
   3984 
   3985 defineSymbol(math, ams, rel, "\u22E0", "\\npreceq", true);
   3986 defineSymbol(math, ams, rel, "\u22E8", "\\precnsim", true);
   3987 defineSymbol(math, ams, rel, "\u2AB9", "\\precnapprox", true);
   3988 defineSymbol(math, ams, rel, "\u2241", "\\nsim", true);
   3989 defineSymbol(math, ams, rel, "\uE006", "\\@nshortmid");
   3990 defineSymbol(math, ams, rel, "\u2224", "\\nmid", true);
   3991 defineSymbol(math, ams, rel, "\u22AC", "\\nvdash", true);
   3992 defineSymbol(math, ams, rel, "\u22AD", "\\nvDash", true);
   3993 defineSymbol(math, ams, rel, "\u22EA", "\\ntriangleleft");
   3994 defineSymbol(math, ams, rel, "\u22EC", "\\ntrianglelefteq", true);
   3995 defineSymbol(math, ams, rel, "\u228A", "\\subsetneq", true);
   3996 defineSymbol(math, ams, rel, "\uE01A", "\\@varsubsetneq");
   3997 defineSymbol(math, ams, rel, "\u2ACB", "\\subsetneqq", true);
   3998 defineSymbol(math, ams, rel, "\uE017", "\\@varsubsetneqq");
   3999 defineSymbol(math, ams, rel, "\u226F", "\\ngtr", true);
   4000 defineSymbol(math, ams, rel, "\uE00F", "\\@ngeqslant");
   4001 defineSymbol(math, ams, rel, "\uE00E", "\\@ngeqq");
   4002 defineSymbol(math, ams, rel, "\u2A88", "\\gneq", true);
   4003 defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true);
   4004 defineSymbol(math, ams, rel, "\uE00D", "\\@gvertneqq");
   4005 defineSymbol(math, ams, rel, "\u22E7", "\\gnsim", true);
   4006 defineSymbol(math, ams, rel, "\u2A8A", "\\gnapprox", true);
   4007 defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym.
   4008 
   4009 defineSymbol(math, ams, rel, "\u22E1", "\\nsucceq", true);
   4010 defineSymbol(math, ams, rel, "\u22E9", "\\succnsim", true);
   4011 defineSymbol(math, ams, rel, "\u2ABA", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym.
   4012 
   4013 defineSymbol(math, ams, rel, "\u2246", "\\ncong", true);
   4014 defineSymbol(math, ams, rel, "\uE007", "\\@nshortparallel");
   4015 defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true);
   4016 defineSymbol(math, ams, rel, "\u22AF", "\\nVDash", true);
   4017 defineSymbol(math, ams, rel, "\u22EB", "\\ntriangleright");
   4018 defineSymbol(math, ams, rel, "\u22ED", "\\ntrianglerighteq", true);
   4019 defineSymbol(math, ams, rel, "\uE018", "\\@nsupseteqq");
   4020 defineSymbol(math, ams, rel, "\u228B", "\\supsetneq", true);
   4021 defineSymbol(math, ams, rel, "\uE01B", "\\@varsupsetneq");
   4022 defineSymbol(math, ams, rel, "\u2ACC", "\\supsetneqq", true);
   4023 defineSymbol(math, ams, rel, "\uE019", "\\@varsupsetneqq");
   4024 defineSymbol(math, ams, rel, "\u22AE", "\\nVdash", true);
   4025 defineSymbol(math, ams, rel, "\u2AB5", "\\precneqq", true);
   4026 defineSymbol(math, ams, rel, "\u2AB6", "\\succneqq", true);
   4027 defineSymbol(math, ams, rel, "\uE016", "\\@nsubseteqq");
   4028 defineSymbol(math, ams, bin, "\u22B4", "\\unlhd");
   4029 defineSymbol(math, ams, bin, "\u22B5", "\\unrhd"); // AMS Negated Arrows
   4030 
   4031 defineSymbol(math, ams, rel, "\u219A", "\\nleftarrow", true);
   4032 defineSymbol(math, ams, rel, "\u219B", "\\nrightarrow", true);
   4033 defineSymbol(math, ams, rel, "\u21CD", "\\nLeftarrow", true);
   4034 defineSymbol(math, ams, rel, "\u21CF", "\\nRightarrow", true);
   4035 defineSymbol(math, ams, rel, "\u21AE", "\\nleftrightarrow", true);
   4036 defineSymbol(math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); // AMS Misc
   4037 
   4038 defineSymbol(math, ams, rel, "\u25B3", "\\vartriangle");
   4039 defineSymbol(math, ams, textord, "\u210F", "\\hslash");
   4040 defineSymbol(math, ams, textord, "\u25BD", "\\triangledown");
   4041 defineSymbol(math, ams, textord, "\u25CA", "\\lozenge");
   4042 defineSymbol(math, ams, textord, "\u24C8", "\\circledS");
   4043 defineSymbol(math, ams, textord, "\xAE", "\\circledR");
   4044 defineSymbol(symbols_text, ams, textord, "\xAE", "\\circledR");
   4045 defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true);
   4046 defineSymbol(math, ams, textord, "\u2204", "\\nexists");
   4047 defineSymbol(math, ams, textord, "\u2127", "\\mho");
   4048 defineSymbol(math, ams, textord, "\u2132", "\\Finv", true);
   4049 defineSymbol(math, ams, textord, "\u2141", "\\Game", true);
   4050 defineSymbol(math, ams, textord, "\u2035", "\\backprime");
   4051 defineSymbol(math, ams, textord, "\u25B2", "\\blacktriangle");
   4052 defineSymbol(math, ams, textord, "\u25BC", "\\blacktriangledown");
   4053 defineSymbol(math, ams, textord, "\u25A0", "\\blacksquare");
   4054 defineSymbol(math, ams, textord, "\u29EB", "\\blacklozenge");
   4055 defineSymbol(math, ams, textord, "\u2605", "\\bigstar");
   4056 defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true);
   4057 defineSymbol(math, ams, textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 to \matheth. We map to AMS function \eth
   4058 
   4059 defineSymbol(math, ams, textord, "\xF0", "\\eth", true);
   4060 defineSymbol(symbols_text, main, textord, "\xF0", "\xF0");
   4061 defineSymbol(math, ams, textord, "\u2571", "\\diagup");
   4062 defineSymbol(math, ams, textord, "\u2572", "\\diagdown");
   4063 defineSymbol(math, ams, textord, "\u25A1", "\\square");
   4064 defineSymbol(math, ams, textord, "\u25A1", "\\Box");
   4065 defineSymbol(math, ams, textord, "\u25CA", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen
   4066 
   4067 defineSymbol(math, ams, textord, "\xA5", "\\yen", true);
   4068 defineSymbol(symbols_text, ams, textord, "\xA5", "\\yen", true);
   4069 defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true);
   4070 defineSymbol(symbols_text, ams, textord, "\u2713", "\\checkmark"); // AMS Hebrew
   4071 
   4072 defineSymbol(math, ams, textord, "\u2136", "\\beth", true);
   4073 defineSymbol(math, ams, textord, "\u2138", "\\daleth", true);
   4074 defineSymbol(math, ams, textord, "\u2137", "\\gimel", true); // AMS Greek
   4075 
   4076 defineSymbol(math, ams, textord, "\u03DD", "\\digamma", true);
   4077 defineSymbol(math, ams, textord, "\u03F0", "\\varkappa"); // AMS Delimiters
   4078 
   4079 defineSymbol(math, ams, symbols_open, "\u250C", "\\@ulcorner", true);
   4080 defineSymbol(math, ams, symbols_close, "\u2510", "\\@urcorner", true);
   4081 defineSymbol(math, ams, symbols_open, "\u2514", "\\@llcorner", true);
   4082 defineSymbol(math, ams, symbols_close, "\u2518", "\\@lrcorner", true); // AMS Binary Relations
   4083 
   4084 defineSymbol(math, ams, rel, "\u2266", "\\leqq", true);
   4085 defineSymbol(math, ams, rel, "\u2A7D", "\\leqslant", true);
   4086 defineSymbol(math, ams, rel, "\u2A95", "\\eqslantless", true);
   4087 defineSymbol(math, ams, rel, "\u2272", "\\lesssim", true);
   4088 defineSymbol(math, ams, rel, "\u2A85", "\\lessapprox", true);
   4089 defineSymbol(math, ams, rel, "\u224A", "\\approxeq", true);
   4090 defineSymbol(math, ams, bin, "\u22D6", "\\lessdot");
   4091 defineSymbol(math, ams, rel, "\u22D8", "\\lll", true);
   4092 defineSymbol(math, ams, rel, "\u2276", "\\lessgtr", true);
   4093 defineSymbol(math, ams, rel, "\u22DA", "\\lesseqgtr", true);
   4094 defineSymbol(math, ams, rel, "\u2A8B", "\\lesseqqgtr", true);
   4095 defineSymbol(math, ams, rel, "\u2251", "\\doteqdot");
   4096 defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true);
   4097 defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true);
   4098 defineSymbol(math, ams, rel, "\u223D", "\\backsim", true);
   4099 defineSymbol(math, ams, rel, "\u22CD", "\\backsimeq", true);
   4100 defineSymbol(math, ams, rel, "\u2AC5", "\\subseteqq", true);
   4101 defineSymbol(math, ams, rel, "\u22D0", "\\Subset", true);
   4102 defineSymbol(math, ams, rel, "\u228F", "\\sqsubset", true);
   4103 defineSymbol(math, ams, rel, "\u227C", "\\preccurlyeq", true);
   4104 defineSymbol(math, ams, rel, "\u22DE", "\\curlyeqprec", true);
   4105 defineSymbol(math, ams, rel, "\u227E", "\\precsim", true);
   4106 defineSymbol(math, ams, rel, "\u2AB7", "\\precapprox", true);
   4107 defineSymbol(math, ams, rel, "\u22B2", "\\vartriangleleft");
   4108 defineSymbol(math, ams, rel, "\u22B4", "\\trianglelefteq");
   4109 defineSymbol(math, ams, rel, "\u22A8", "\\vDash", true);
   4110 defineSymbol(math, ams, rel, "\u22AA", "\\Vvdash", true);
   4111 defineSymbol(math, ams, rel, "\u2323", "\\smallsmile");
   4112 defineSymbol(math, ams, rel, "\u2322", "\\smallfrown");
   4113 defineSymbol(math, ams, rel, "\u224F", "\\bumpeq", true);
   4114 defineSymbol(math, ams, rel, "\u224E", "\\Bumpeq", true);
   4115 defineSymbol(math, ams, rel, "\u2267", "\\geqq", true);
   4116 defineSymbol(math, ams, rel, "\u2A7E", "\\geqslant", true);
   4117 defineSymbol(math, ams, rel, "\u2A96", "\\eqslantgtr", true);
   4118 defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true);
   4119 defineSymbol(math, ams, rel, "\u2A86", "\\gtrapprox", true);
   4120 defineSymbol(math, ams, bin, "\u22D7", "\\gtrdot");
   4121 defineSymbol(math, ams, rel, "\u22D9", "\\ggg", true);
   4122 defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true);
   4123 defineSymbol(math, ams, rel, "\u22DB", "\\gtreqless", true);
   4124 defineSymbol(math, ams, rel, "\u2A8C", "\\gtreqqless", true);
   4125 defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true);
   4126 defineSymbol(math, ams, rel, "\u2257", "\\circeq", true);
   4127 defineSymbol(math, ams, rel, "\u225C", "\\triangleq", true);
   4128 defineSymbol(math, ams, rel, "\u223C", "\\thicksim");
   4129 defineSymbol(math, ams, rel, "\u2248", "\\thickapprox");
   4130 defineSymbol(math, ams, rel, "\u2AC6", "\\supseteqq", true);
   4131 defineSymbol(math, ams, rel, "\u22D1", "\\Supset", true);
   4132 defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true);
   4133 defineSymbol(math, ams, rel, "\u227D", "\\succcurlyeq", true);
   4134 defineSymbol(math, ams, rel, "\u22DF", "\\curlyeqsucc", true);
   4135 defineSymbol(math, ams, rel, "\u227F", "\\succsim", true);
   4136 defineSymbol(math, ams, rel, "\u2AB8", "\\succapprox", true);
   4137 defineSymbol(math, ams, rel, "\u22B3", "\\vartriangleright");
   4138 defineSymbol(math, ams, rel, "\u22B5", "\\trianglerighteq");
   4139 defineSymbol(math, ams, rel, "\u22A9", "\\Vdash", true);
   4140 defineSymbol(math, ams, rel, "\u2223", "\\shortmid");
   4141 defineSymbol(math, ams, rel, "\u2225", "\\shortparallel");
   4142 defineSymbol(math, ams, rel, "\u226C", "\\between", true);
   4143 defineSymbol(math, ams, rel, "\u22D4", "\\pitchfork", true);
   4144 defineSymbol(math, ams, rel, "\u221D", "\\varpropto");
   4145 defineSymbol(math, ams, rel, "\u25C0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom.
   4146 // We kept the amssymb atom type, which is rel.
   4147 
   4148 defineSymbol(math, ams, rel, "\u2234", "\\therefore", true);
   4149 defineSymbol(math, ams, rel, "\u220D", "\\backepsilon");
   4150 defineSymbol(math, ams, rel, "\u25B6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom.
   4151 // We kept the amssymb atom type, which is rel.
   4152 
   4153 defineSymbol(math, ams, rel, "\u2235", "\\because", true);
   4154 defineSymbol(math, ams, rel, "\u22D8", "\\llless");
   4155 defineSymbol(math, ams, rel, "\u22D9", "\\gggtr");
   4156 defineSymbol(math, ams, bin, "\u22B2", "\\lhd");
   4157 defineSymbol(math, ams, bin, "\u22B3", "\\rhd");
   4158 defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true);
   4159 defineSymbol(math, main, rel, "\u22C8", "\\Join");
   4160 defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators
   4161 
   4162 defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true);
   4163 defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus");
   4164 defineSymbol(math, ams, bin, "\u22D2", "\\Cap", true);
   4165 defineSymbol(math, ams, bin, "\u22D3", "\\Cup", true);
   4166 defineSymbol(math, ams, bin, "\u2A5E", "\\doublebarwedge", true);
   4167 defineSymbol(math, ams, bin, "\u229F", "\\boxminus", true);
   4168 defineSymbol(math, ams, bin, "\u229E", "\\boxplus", true);
   4169 defineSymbol(math, ams, bin, "\u22C7", "\\divideontimes", true);
   4170 defineSymbol(math, ams, bin, "\u22C9", "\\ltimes", true);
   4171 defineSymbol(math, ams, bin, "\u22CA", "\\rtimes", true);
   4172 defineSymbol(math, ams, bin, "\u22CB", "\\leftthreetimes", true);
   4173 defineSymbol(math, ams, bin, "\u22CC", "\\rightthreetimes", true);
   4174 defineSymbol(math, ams, bin, "\u22CF", "\\curlywedge", true);
   4175 defineSymbol(math, ams, bin, "\u22CE", "\\curlyvee", true);
   4176 defineSymbol(math, ams, bin, "\u229D", "\\circleddash", true);
   4177 defineSymbol(math, ams, bin, "\u229B", "\\circledast", true);
   4178 defineSymbol(math, ams, bin, "\u22C5", "\\centerdot");
   4179 defineSymbol(math, ams, bin, "\u22BA", "\\intercal", true);
   4180 defineSymbol(math, ams, bin, "\u22D2", "\\doublecap");
   4181 defineSymbol(math, ams, bin, "\u22D3", "\\doublecup");
   4182 defineSymbol(math, ams, bin, "\u22A0", "\\boxtimes", true); // AMS Arrows
   4183 // Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
   4184 // We'll map it to AMS function \dashrightarrow. It produces the same atom.
   4185 
   4186 defineSymbol(math, ams, rel, "\u21E2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym.
   4187 
   4188 defineSymbol(math, ams, rel, "\u21E0", "\\dashleftarrow", true);
   4189 defineSymbol(math, ams, rel, "\u21C7", "\\leftleftarrows", true);
   4190 defineSymbol(math, ams, rel, "\u21C6", "\\leftrightarrows", true);
   4191 defineSymbol(math, ams, rel, "\u21DA", "\\Lleftarrow", true);
   4192 defineSymbol(math, ams, rel, "\u219E", "\\twoheadleftarrow", true);
   4193 defineSymbol(math, ams, rel, "\u21A2", "\\leftarrowtail", true);
   4194 defineSymbol(math, ams, rel, "\u21AB", "\\looparrowleft", true);
   4195 defineSymbol(math, ams, rel, "\u21CB", "\\leftrightharpoons", true);
   4196 defineSymbol(math, ams, rel, "\u21B6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym.
   4197 
   4198 defineSymbol(math, ams, rel, "\u21BA", "\\circlearrowleft", true);
   4199 defineSymbol(math, ams, rel, "\u21B0", "\\Lsh", true);
   4200 defineSymbol(math, ams, rel, "\u21C8", "\\upuparrows", true);
   4201 defineSymbol(math, ams, rel, "\u21BF", "\\upharpoonleft", true);
   4202 defineSymbol(math, ams, rel, "\u21C3", "\\downharpoonleft", true);
   4203 defineSymbol(math, main, rel, "\u22B6", "\\origof", true); // not in font
   4204 
   4205 defineSymbol(math, main, rel, "\u22B7", "\\imageof", true); // not in font
   4206 
   4207 defineSymbol(math, ams, rel, "\u22B8", "\\multimap", true);
   4208 defineSymbol(math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true);
   4209 defineSymbol(math, ams, rel, "\u21C9", "\\rightrightarrows", true);
   4210 defineSymbol(math, ams, rel, "\u21C4", "\\rightleftarrows", true);
   4211 defineSymbol(math, ams, rel, "\u21A0", "\\twoheadrightarrow", true);
   4212 defineSymbol(math, ams, rel, "\u21A3", "\\rightarrowtail", true);
   4213 defineSymbol(math, ams, rel, "\u21AC", "\\looparrowright", true);
   4214 defineSymbol(math, ams, rel, "\u21B7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym.
   4215 
   4216 defineSymbol(math, ams, rel, "\u21BB", "\\circlearrowright", true);
   4217 defineSymbol(math, ams, rel, "\u21B1", "\\Rsh", true);
   4218 defineSymbol(math, ams, rel, "\u21CA", "\\downdownarrows", true);
   4219 defineSymbol(math, ams, rel, "\u21BE", "\\upharpoonright", true);
   4220 defineSymbol(math, ams, rel, "\u21C2", "\\downharpoonright", true);
   4221 defineSymbol(math, ams, rel, "\u21DD", "\\rightsquigarrow", true);
   4222 defineSymbol(math, ams, rel, "\u21DD", "\\leadsto");
   4223 defineSymbol(math, ams, rel, "\u21DB", "\\Rrightarrow", true);
   4224 defineSymbol(math, ams, rel, "\u21BE", "\\restriction");
   4225 defineSymbol(math, main, textord, "\u2018", "`");
   4226 defineSymbol(math, main, textord, "$", "\\$");
   4227 defineSymbol(symbols_text, main, textord, "$", "\\$");
   4228 defineSymbol(symbols_text, main, textord, "$", "\\textdollar");
   4229 defineSymbol(math, main, textord, "%", "\\%");
   4230 defineSymbol(symbols_text, main, textord, "%", "\\%");
   4231 defineSymbol(math, main, textord, "_", "\\_");
   4232 defineSymbol(symbols_text, main, textord, "_", "\\_");
   4233 defineSymbol(symbols_text, main, textord, "_", "\\textunderscore");
   4234 defineSymbol(math, main, textord, "\u2220", "\\angle", true);
   4235 defineSymbol(math, main, textord, "\u221E", "\\infty", true);
   4236 defineSymbol(math, main, textord, "\u2032", "\\prime");
   4237 defineSymbol(math, main, textord, "\u25B3", "\\triangle");
   4238 defineSymbol(math, main, textord, "\u0393", "\\Gamma", true);
   4239 defineSymbol(math, main, textord, "\u0394", "\\Delta", true);
   4240 defineSymbol(math, main, textord, "\u0398", "\\Theta", true);
   4241 defineSymbol(math, main, textord, "\u039B", "\\Lambda", true);
   4242 defineSymbol(math, main, textord, "\u039E", "\\Xi", true);
   4243 defineSymbol(math, main, textord, "\u03A0", "\\Pi", true);
   4244 defineSymbol(math, main, textord, "\u03A3", "\\Sigma", true);
   4245 defineSymbol(math, main, textord, "\u03A5", "\\Upsilon", true);
   4246 defineSymbol(math, main, textord, "\u03A6", "\\Phi", true);
   4247 defineSymbol(math, main, textord, "\u03A8", "\\Psi", true);
   4248 defineSymbol(math, main, textord, "\u03A9", "\\Omega", true);
   4249 defineSymbol(math, main, textord, "A", "\u0391");
   4250 defineSymbol(math, main, textord, "B", "\u0392");
   4251 defineSymbol(math, main, textord, "E", "\u0395");
   4252 defineSymbol(math, main, textord, "Z", "\u0396");
   4253 defineSymbol(math, main, textord, "H", "\u0397");
   4254 defineSymbol(math, main, textord, "I", "\u0399");
   4255 defineSymbol(math, main, textord, "K", "\u039A");
   4256 defineSymbol(math, main, textord, "M", "\u039C");
   4257 defineSymbol(math, main, textord, "N", "\u039D");
   4258 defineSymbol(math, main, textord, "O", "\u039F");
   4259 defineSymbol(math, main, textord, "P", "\u03A1");
   4260 defineSymbol(math, main, textord, "T", "\u03A4");
   4261 defineSymbol(math, main, textord, "X", "\u03A7");
   4262 defineSymbol(math, main, textord, "\xAC", "\\neg", true);
   4263 defineSymbol(math, main, textord, "\xAC", "\\lnot");
   4264 defineSymbol(math, main, textord, "\u22A4", "\\top");
   4265 defineSymbol(math, main, textord, "\u22A5", "\\bot");
   4266 defineSymbol(math, main, textord, "\u2205", "\\emptyset");
   4267 defineSymbol(math, ams, textord, "\u2205", "\\varnothing");
   4268 defineSymbol(math, main, mathord, "\u03B1", "\\alpha", true);
   4269 defineSymbol(math, main, mathord, "\u03B2", "\\beta", true);
   4270 defineSymbol(math, main, mathord, "\u03B3", "\\gamma", true);
   4271 defineSymbol(math, main, mathord, "\u03B4", "\\delta", true);
   4272 defineSymbol(math, main, mathord, "\u03F5", "\\epsilon", true);
   4273 defineSymbol(math, main, mathord, "\u03B6", "\\zeta", true);
   4274 defineSymbol(math, main, mathord, "\u03B7", "\\eta", true);
   4275 defineSymbol(math, main, mathord, "\u03B8", "\\theta", true);
   4276 defineSymbol(math, main, mathord, "\u03B9", "\\iota", true);
   4277 defineSymbol(math, main, mathord, "\u03BA", "\\kappa", true);
   4278 defineSymbol(math, main, mathord, "\u03BB", "\\lambda", true);
   4279 defineSymbol(math, main, mathord, "\u03BC", "\\mu", true);
   4280 defineSymbol(math, main, mathord, "\u03BD", "\\nu", true);
   4281 defineSymbol(math, main, mathord, "\u03BE", "\\xi", true);
   4282 defineSymbol(math, main, mathord, "\u03BF", "\\omicron", true);
   4283 defineSymbol(math, main, mathord, "\u03C0", "\\pi", true);
   4284 defineSymbol(math, main, mathord, "\u03C1", "\\rho", true);
   4285 defineSymbol(math, main, mathord, "\u03C3", "\\sigma", true);
   4286 defineSymbol(math, main, mathord, "\u03C4", "\\tau", true);
   4287 defineSymbol(math, main, mathord, "\u03C5", "\\upsilon", true);
   4288 defineSymbol(math, main, mathord, "\u03D5", "\\phi", true);
   4289 defineSymbol(math, main, mathord, "\u03C7", "\\chi", true);
   4290 defineSymbol(math, main, mathord, "\u03C8", "\\psi", true);
   4291 defineSymbol(math, main, mathord, "\u03C9", "\\omega", true);
   4292 defineSymbol(math, main, mathord, "\u03B5", "\\varepsilon", true);
   4293 defineSymbol(math, main, mathord, "\u03D1", "\\vartheta", true);
   4294 defineSymbol(math, main, mathord, "\u03D6", "\\varpi", true);
   4295 defineSymbol(math, main, mathord, "\u03F1", "\\varrho", true);
   4296 defineSymbol(math, main, mathord, "\u03C2", "\\varsigma", true);
   4297 defineSymbol(math, main, mathord, "\u03C6", "\\varphi", true);
   4298 defineSymbol(math, main, bin, "\u2217", "*");
   4299 defineSymbol(math, main, bin, "+", "+");
   4300 defineSymbol(math, main, bin, "\u2212", "-");
   4301 defineSymbol(math, main, bin, "\u22C5", "\\cdot", true);
   4302 defineSymbol(math, main, bin, "\u2218", "\\circ");
   4303 defineSymbol(math, main, bin, "\xF7", "\\div", true);
   4304 defineSymbol(math, main, bin, "\xB1", "\\pm", true);
   4305 defineSymbol(math, main, bin, "\xD7", "\\times", true);
   4306 defineSymbol(math, main, bin, "\u2229", "\\cap", true);
   4307 defineSymbol(math, main, bin, "\u222A", "\\cup", true);
   4308 defineSymbol(math, main, bin, "\u2216", "\\setminus");
   4309 defineSymbol(math, main, bin, "\u2227", "\\land");
   4310 defineSymbol(math, main, bin, "\u2228", "\\lor");
   4311 defineSymbol(math, main, bin, "\u2227", "\\wedge", true);
   4312 defineSymbol(math, main, bin, "\u2228", "\\vee", true);
   4313 defineSymbol(math, main, textord, "\u221A", "\\surd");
   4314 defineSymbol(math, main, symbols_open, "\u27E8", "\\langle", true);
   4315 defineSymbol(math, main, symbols_open, "\u2223", "\\lvert");
   4316 defineSymbol(math, main, symbols_open, "\u2225", "\\lVert");
   4317 defineSymbol(math, main, symbols_close, "?", "?");
   4318 defineSymbol(math, main, symbols_close, "!", "!");
   4319 defineSymbol(math, main, symbols_close, "\u27E9", "\\rangle", true);
   4320 defineSymbol(math, main, symbols_close, "\u2223", "\\rvert");
   4321 defineSymbol(math, main, symbols_close, "\u2225", "\\rVert");
   4322 defineSymbol(math, main, rel, "=", "=");
   4323 defineSymbol(math, main, rel, ":", ":");
   4324 defineSymbol(math, main, rel, "\u2248", "\\approx", true);
   4325 defineSymbol(math, main, rel, "\u2245", "\\cong", true);
   4326 defineSymbol(math, main, rel, "\u2265", "\\ge");
   4327 defineSymbol(math, main, rel, "\u2265", "\\geq", true);
   4328 defineSymbol(math, main, rel, "\u2190", "\\gets");
   4329 defineSymbol(math, main, rel, ">", "\\gt", true);
   4330 defineSymbol(math, main, rel, "\u2208", "\\in", true);
   4331 defineSymbol(math, main, rel, "\uE020", "\\@not");
   4332 defineSymbol(math, main, rel, "\u2282", "\\subset", true);
   4333 defineSymbol(math, main, rel, "\u2283", "\\supset", true);
   4334 defineSymbol(math, main, rel, "\u2286", "\\subseteq", true);
   4335 defineSymbol(math, main, rel, "\u2287", "\\supseteq", true);
   4336 defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true);
   4337 defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true);
   4338 defineSymbol(math, main, rel, "\u22A8", "\\models");
   4339 defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true);
   4340 defineSymbol(math, main, rel, "\u2264", "\\le");
   4341 defineSymbol(math, main, rel, "\u2264", "\\leq", true);
   4342 defineSymbol(math, main, rel, "<", "\\lt", true);
   4343 defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true);
   4344 defineSymbol(math, main, rel, "\u2192", "\\to");
   4345 defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true);
   4346 defineSymbol(math, ams, rel, "\u2270", "\\nleq", true);
   4347 defineSymbol(math, main, spacing, "\xA0", "\\ ");
   4348 defineSymbol(math, main, spacing, "\xA0", "~");
   4349 defineSymbol(math, main, spacing, "\xA0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{%
   4350 
   4351 defineSymbol(math, main, spacing, "\xA0", "\\nobreakspace");
   4352 defineSymbol(symbols_text, main, spacing, "\xA0", "\\ ");
   4353 defineSymbol(symbols_text, main, spacing, "\xA0", " ");
   4354 defineSymbol(symbols_text, main, spacing, "\xA0", "~");
   4355 defineSymbol(symbols_text, main, spacing, "\xA0", "\\space");
   4356 defineSymbol(symbols_text, main, spacing, "\xA0", "\\nobreakspace");
   4357 defineSymbol(math, main, spacing, null, "\\nobreak");
   4358 defineSymbol(math, main, spacing, null, "\\allowbreak");
   4359 defineSymbol(math, main, punct, ",", ",");
   4360 defineSymbol(math, main, punct, ";", ";");
   4361 defineSymbol(math, ams, bin, "\u22BC", "\\barwedge", true);
   4362 defineSymbol(math, ams, bin, "\u22BB", "\\veebar", true);
   4363 defineSymbol(math, main, bin, "\u2299", "\\odot", true);
   4364 defineSymbol(math, main, bin, "\u2295", "\\oplus", true);
   4365 defineSymbol(math, main, bin, "\u2297", "\\otimes", true);
   4366 defineSymbol(math, main, textord, "\u2202", "\\partial", true);
   4367 defineSymbol(math, main, bin, "\u2298", "\\oslash", true);
   4368 defineSymbol(math, ams, bin, "\u229A", "\\circledcirc", true);
   4369 defineSymbol(math, ams, bin, "\u22A1", "\\boxdot", true);
   4370 defineSymbol(math, main, bin, "\u25B3", "\\bigtriangleup");
   4371 defineSymbol(math, main, bin, "\u25BD", "\\bigtriangledown");
   4372 defineSymbol(math, main, bin, "\u2020", "\\dagger");
   4373 defineSymbol(math, main, bin, "\u22C4", "\\diamond");
   4374 defineSymbol(math, main, bin, "\u22C6", "\\star");
   4375 defineSymbol(math, main, bin, "\u25C3", "\\triangleleft");
   4376 defineSymbol(math, main, bin, "\u25B9", "\\triangleright");
   4377 defineSymbol(math, main, symbols_open, "{", "\\{");
   4378 defineSymbol(symbols_text, main, textord, "{", "\\{");
   4379 defineSymbol(symbols_text, main, textord, "{", "\\textbraceleft");
   4380 defineSymbol(math, main, symbols_close, "}", "\\}");
   4381 defineSymbol(symbols_text, main, textord, "}", "\\}");
   4382 defineSymbol(symbols_text, main, textord, "}", "\\textbraceright");
   4383 defineSymbol(math, main, symbols_open, "{", "\\lbrace");
   4384 defineSymbol(math, main, symbols_close, "}", "\\rbrace");
   4385 defineSymbol(math, main, symbols_open, "[", "\\lbrack", true);
   4386 defineSymbol(symbols_text, main, textord, "[", "\\lbrack", true);
   4387 defineSymbol(math, main, symbols_close, "]", "\\rbrack", true);
   4388 defineSymbol(symbols_text, main, textord, "]", "\\rbrack", true);
   4389 defineSymbol(math, main, symbols_open, "(", "\\lparen", true);
   4390 defineSymbol(math, main, symbols_close, ")", "\\rparen", true);
   4391 defineSymbol(symbols_text, main, textord, "<", "\\textless", true); // in T1 fontenc
   4392 
   4393 defineSymbol(symbols_text, main, textord, ">", "\\textgreater", true); // in T1 fontenc
   4394 
   4395 defineSymbol(math, main, symbols_open, "\u230A", "\\lfloor", true);
   4396 defineSymbol(math, main, symbols_close, "\u230B", "\\rfloor", true);
   4397 defineSymbol(math, main, symbols_open, "\u2308", "\\lceil", true);
   4398 defineSymbol(math, main, symbols_close, "\u2309", "\\rceil", true);
   4399 defineSymbol(math, main, textord, "\\", "\\backslash");
   4400 defineSymbol(math, main, textord, "\u2223", "|");
   4401 defineSymbol(math, main, textord, "\u2223", "\\vert");
   4402 defineSymbol(symbols_text, main, textord, "|", "\\textbar", true); // in T1 fontenc
   4403 
   4404 defineSymbol(math, main, textord, "\u2225", "\\|");
   4405 defineSymbol(math, main, textord, "\u2225", "\\Vert");
   4406 defineSymbol(symbols_text, main, textord, "\u2225", "\\textbardbl");
   4407 defineSymbol(symbols_text, main, textord, "~", "\\textasciitilde");
   4408 defineSymbol(symbols_text, main, textord, "\\", "\\textbackslash");
   4409 defineSymbol(symbols_text, main, textord, "^", "\\textasciicircum");
   4410 defineSymbol(math, main, rel, "\u2191", "\\uparrow", true);
   4411 defineSymbol(math, main, rel, "\u21D1", "\\Uparrow", true);
   4412 defineSymbol(math, main, rel, "\u2193", "\\downarrow", true);
   4413 defineSymbol(math, main, rel, "\u21D3", "\\Downarrow", true);
   4414 defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true);
   4415 defineSymbol(math, main, rel, "\u21D5", "\\Updownarrow", true);
   4416 defineSymbol(math, main, op, "\u2210", "\\coprod");
   4417 defineSymbol(math, main, op, "\u22C1", "\\bigvee");
   4418 defineSymbol(math, main, op, "\u22C0", "\\bigwedge");
   4419 defineSymbol(math, main, op, "\u2A04", "\\biguplus");
   4420 defineSymbol(math, main, op, "\u22C2", "\\bigcap");
   4421 defineSymbol(math, main, op, "\u22C3", "\\bigcup");
   4422 defineSymbol(math, main, op, "\u222B", "\\int");
   4423 defineSymbol(math, main, op, "\u222B", "\\intop");
   4424 defineSymbol(math, main, op, "\u222C", "\\iint");
   4425 defineSymbol(math, main, op, "\u222D", "\\iiint");
   4426 defineSymbol(math, main, op, "\u220F", "\\prod");
   4427 defineSymbol(math, main, op, "\u2211", "\\sum");
   4428 defineSymbol(math, main, op, "\u2A02", "\\bigotimes");
   4429 defineSymbol(math, main, op, "\u2A01", "\\bigoplus");
   4430 defineSymbol(math, main, op, "\u2A00", "\\bigodot");
   4431 defineSymbol(math, main, op, "\u222E", "\\oint");
   4432 defineSymbol(math, main, op, "\u222F", "\\oiint");
   4433 defineSymbol(math, main, op, "\u2230", "\\oiiint");
   4434 defineSymbol(math, main, op, "\u2A06", "\\bigsqcup");
   4435 defineSymbol(math, main, op, "\u222B", "\\smallint");
   4436 defineSymbol(symbols_text, main, inner, "\u2026", "\\textellipsis");
   4437 defineSymbol(math, main, inner, "\u2026", "\\mathellipsis");
   4438 defineSymbol(symbols_text, main, inner, "\u2026", "\\ldots", true);
   4439 defineSymbol(math, main, inner, "\u2026", "\\ldots", true);
   4440 defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true);
   4441 defineSymbol(math, main, inner, "\u22F1", "\\ddots", true);
   4442 defineSymbol(math, main, textord, "\u22EE", "\\varvdots"); // \vdots is a macro
   4443 
   4444 defineSymbol(math, main, accent, "\u02CA", "\\acute");
   4445 defineSymbol(math, main, accent, "\u02CB", "\\grave");
   4446 defineSymbol(math, main, accent, "\xA8", "\\ddot");
   4447 defineSymbol(math, main, accent, "~", "\\tilde");
   4448 defineSymbol(math, main, accent, "\u02C9", "\\bar");
   4449 defineSymbol(math, main, accent, "\u02D8", "\\breve");
   4450 defineSymbol(math, main, accent, "\u02C7", "\\check");
   4451 defineSymbol(math, main, accent, "^", "\\hat");
   4452 defineSymbol(math, main, accent, "\u20D7", "\\vec");
   4453 defineSymbol(math, main, accent, "\u02D9", "\\dot");
   4454 defineSymbol(math, main, accent, "\u02DA", "\\mathring"); // \imath and \jmath should be invariant to \mathrm, \mathbf, etc., so use PUA
   4455 
   4456 defineSymbol(math, main, mathord, "\uE131", "\\@imath");
   4457 defineSymbol(math, main, mathord, "\uE237", "\\@jmath");
   4458 defineSymbol(math, main, textord, "\u0131", "\u0131");
   4459 defineSymbol(math, main, textord, "\u0237", "\u0237");
   4460 defineSymbol(symbols_text, main, textord, "\u0131", "\\i", true);
   4461 defineSymbol(symbols_text, main, textord, "\u0237", "\\j", true);
   4462 defineSymbol(symbols_text, main, textord, "\xDF", "\\ss", true);
   4463 defineSymbol(symbols_text, main, textord, "\xE6", "\\ae", true);
   4464 defineSymbol(symbols_text, main, textord, "\u0153", "\\oe", true);
   4465 defineSymbol(symbols_text, main, textord, "\xF8", "\\o", true);
   4466 defineSymbol(symbols_text, main, textord, "\xC6", "\\AE", true);
   4467 defineSymbol(symbols_text, main, textord, "\u0152", "\\OE", true);
   4468 defineSymbol(symbols_text, main, textord, "\xD8", "\\O", true);
   4469 defineSymbol(symbols_text, main, accent, "\u02CA", "\\'"); // acute
   4470 
   4471 defineSymbol(symbols_text, main, accent, "\u02CB", "\\`"); // grave
   4472 
   4473 defineSymbol(symbols_text, main, accent, "\u02C6", "\\^"); // circumflex
   4474 
   4475 defineSymbol(symbols_text, main, accent, "\u02DC", "\\~"); // tilde
   4476 
   4477 defineSymbol(symbols_text, main, accent, "\u02C9", "\\="); // macron
   4478 
   4479 defineSymbol(symbols_text, main, accent, "\u02D8", "\\u"); // breve
   4480 
   4481 defineSymbol(symbols_text, main, accent, "\u02D9", "\\."); // dot above
   4482 
   4483 defineSymbol(symbols_text, main, accent, "\u02DA", "\\r"); // ring above
   4484 
   4485 defineSymbol(symbols_text, main, accent, "\u02C7", "\\v"); // caron
   4486 
   4487 defineSymbol(symbols_text, main, accent, "\xA8", '\\"'); // diaresis
   4488 
   4489 defineSymbol(symbols_text, main, accent, "\u02DD", "\\H"); // double acute
   4490 
   4491 defineSymbol(symbols_text, main, accent, "\u25EF", "\\textcircled"); // \bigcirc glyph
   4492 // These ligatures are detected and created in Parser.js's `formLigatures`.
   4493 
   4494 var ligatures = {
   4495   "--": true,
   4496   "---": true,
   4497   "``": true,
   4498   "''": true
   4499 };
   4500 defineSymbol(symbols_text, main, textord, "\u2013", "--", true);
   4501 defineSymbol(symbols_text, main, textord, "\u2013", "\\textendash");
   4502 defineSymbol(symbols_text, main, textord, "\u2014", "---", true);
   4503 defineSymbol(symbols_text, main, textord, "\u2014", "\\textemdash");
   4504 defineSymbol(symbols_text, main, textord, "\u2018", "`", true);
   4505 defineSymbol(symbols_text, main, textord, "\u2018", "\\textquoteleft");
   4506 defineSymbol(symbols_text, main, textord, "\u2019", "'", true);
   4507 defineSymbol(symbols_text, main, textord, "\u2019", "\\textquoteright");
   4508 defineSymbol(symbols_text, main, textord, "\u201C", "``", true);
   4509 defineSymbol(symbols_text, main, textord, "\u201C", "\\textquotedblleft");
   4510 defineSymbol(symbols_text, main, textord, "\u201D", "''", true);
   4511 defineSymbol(symbols_text, main, textord, "\u201D", "\\textquotedblright"); //  \degree from gensymb package
   4512 
   4513 defineSymbol(math, main, textord, "\xB0", "\\degree", true);
   4514 defineSymbol(symbols_text, main, textord, "\xB0", "\\degree"); // \textdegree from inputenc package
   4515 
   4516 defineSymbol(symbols_text, main, textord, "\xB0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math
   4517 // mode, but among our fonts, only Main-Regular defines this character "163".
   4518 
   4519 defineSymbol(math, main, textord, "\xA3", "\\pounds");
   4520 defineSymbol(math, main, textord, "\xA3", "\\mathsterling", true);
   4521 defineSymbol(symbols_text, main, textord, "\xA3", "\\pounds");
   4522 defineSymbol(symbols_text, main, textord, "\xA3", "\\textsterling", true);
   4523 defineSymbol(math, ams, textord, "\u2720", "\\maltese");
   4524 defineSymbol(symbols_text, ams, textord, "\u2720", "\\maltese"); // There are lots of symbols which are the same, so we add them in afterwards.
   4525 // All of these are textords in math mode
   4526 
   4527 var mathTextSymbols = "0123456789/@.\"";
   4528 
   4529 for (var i = 0; i < mathTextSymbols.length; i++) {
   4530   var ch = mathTextSymbols.charAt(i);
   4531   defineSymbol(math, main, textord, ch, ch);
   4532 } // All of these are textords in text mode
   4533 
   4534 
   4535 var textSymbols = "0123456789!@*()-=+\";:?/.,";
   4536 
   4537 for (var _i = 0; _i < textSymbols.length; _i++) {
   4538   var _ch = textSymbols.charAt(_i);
   4539 
   4540   defineSymbol(symbols_text, main, textord, _ch, _ch);
   4541 } // All of these are textords in text mode, and mathords in math mode
   4542 
   4543 
   4544 var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
   4545 
   4546 for (var _i2 = 0; _i2 < letters.length; _i2++) {
   4547   var _ch2 = letters.charAt(_i2);
   4548 
   4549   defineSymbol(math, main, mathord, _ch2, _ch2);
   4550   defineSymbol(symbols_text, main, textord, _ch2, _ch2);
   4551 } // Blackboard bold and script letters in Unicode range
   4552 
   4553 
   4554 defineSymbol(math, ams, textord, "C", "\u2102"); // blackboard bold
   4555 
   4556 defineSymbol(symbols_text, ams, textord, "C", "\u2102");
   4557 defineSymbol(math, ams, textord, "H", "\u210D");
   4558 defineSymbol(symbols_text, ams, textord, "H", "\u210D");
   4559 defineSymbol(math, ams, textord, "N", "\u2115");
   4560 defineSymbol(symbols_text, ams, textord, "N", "\u2115");
   4561 defineSymbol(math, ams, textord, "P", "\u2119");
   4562 defineSymbol(symbols_text, ams, textord, "P", "\u2119");
   4563 defineSymbol(math, ams, textord, "Q", "\u211A");
   4564 defineSymbol(symbols_text, ams, textord, "Q", "\u211A");
   4565 defineSymbol(math, ams, textord, "R", "\u211D");
   4566 defineSymbol(symbols_text, ams, textord, "R", "\u211D");
   4567 defineSymbol(math, ams, textord, "Z", "\u2124");
   4568 defineSymbol(symbols_text, ams, textord, "Z", "\u2124");
   4569 defineSymbol(math, main, mathord, "h", "\u210E"); // italic h, Planck constant
   4570 
   4571 defineSymbol(symbols_text, main, mathord, "h", "\u210E"); // The next loop loads wide (surrogate pair) characters.
   4572 // We support some letters in the Unicode range U+1D400 to U+1D7FF,
   4573 // Mathematical Alphanumeric Symbols.
   4574 // Some editors do not deal well with wide characters. So don't write the
   4575 // string into this file. Instead, create the string from the surrogate pair.
   4576 
   4577 var wideChar = "";
   4578 
   4579 for (var _i3 = 0; _i3 < letters.length; _i3++) {
   4580   var _ch3 = letters.charAt(_i3); // The hex numbers in the next line are a surrogate pair.
   4581   // 0xD835 is the high surrogate for all letters in the range we support.
   4582   // 0xDC00 is the low surrogate for bold A.
   4583 
   4584 
   4585   wideChar = String.fromCharCode(0xD835, 0xDC00 + _i3); // A-Z a-z bold
   4586 
   4587   defineSymbol(math, main, mathord, _ch3, wideChar);
   4588   defineSymbol(symbols_text, main, textord, _ch3, wideChar);
   4589   wideChar = String.fromCharCode(0xD835, 0xDC34 + _i3); // A-Z a-z italic
   4590 
   4591   defineSymbol(math, main, mathord, _ch3, wideChar);
   4592   defineSymbol(symbols_text, main, textord, _ch3, wideChar);
   4593   wideChar = String.fromCharCode(0xD835, 0xDC68 + _i3); // A-Z a-z bold italic
   4594 
   4595   defineSymbol(math, main, mathord, _ch3, wideChar);
   4596   defineSymbol(symbols_text, main, textord, _ch3, wideChar);
   4597   wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fractur
   4598 
   4599   defineSymbol(math, main, mathord, _ch3, wideChar);
   4600   defineSymbol(symbols_text, main, textord, _ch3, wideChar);
   4601   wideChar = String.fromCharCode(0xD835, 0xDDA0 + _i3); // A-Z a-z sans-serif
   4602 
   4603   defineSymbol(math, main, mathord, _ch3, wideChar);
   4604   defineSymbol(symbols_text, main, textord, _ch3, wideChar);
   4605   wideChar = String.fromCharCode(0xD835, 0xDDD4 + _i3); // A-Z a-z sans bold
   4606 
   4607   defineSymbol(math, main, mathord, _ch3, wideChar);
   4608   defineSymbol(symbols_text, main, textord, _ch3, wideChar);
   4609   wideChar = String.fromCharCode(0xD835, 0xDE08 + _i3); // A-Z a-z sans italic
   4610 
   4611   defineSymbol(math, main, mathord, _ch3, wideChar);
   4612   defineSymbol(symbols_text, main, textord, _ch3, wideChar);
   4613   wideChar = String.fromCharCode(0xD835, 0xDE70 + _i3); // A-Z a-z monospace
   4614 
   4615   defineSymbol(math, main, mathord, _ch3, wideChar);
   4616   defineSymbol(symbols_text, main, textord, _ch3, wideChar);
   4617 
   4618   if (_i3 < 26) {
   4619     // KaTeX fonts have only capital letters for blackboard bold and script.
   4620     // See exception for k below.
   4621     wideChar = String.fromCharCode(0xD835, 0xDD38 + _i3); // A-Z double struck
   4622 
   4623     defineSymbol(math, main, mathord, _ch3, wideChar);
   4624     defineSymbol(symbols_text, main, textord, _ch3, wideChar);
   4625     wideChar = String.fromCharCode(0xD835, 0xDC9C + _i3); // A-Z script
   4626 
   4627     defineSymbol(math, main, mathord, _ch3, wideChar);
   4628     defineSymbol(symbols_text, main, textord, _ch3, wideChar);
   4629   } // TODO: Add bold script when it is supported by a KaTeX font.
   4630 
   4631 } // "k" is the only double struck lower case letter in the KaTeX fonts.
   4632 
   4633 
   4634 wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck
   4635 
   4636 defineSymbol(math, main, mathord, "k", wideChar);
   4637 defineSymbol(symbols_text, main, textord, "k", wideChar); // Next, some wide character numerals
   4638 
   4639 for (var _i4 = 0; _i4 < 10; _i4++) {
   4640   var _ch4 = _i4.toString();
   4641 
   4642   wideChar = String.fromCharCode(0xD835, 0xDFCE + _i4); // 0-9 bold
   4643 
   4644   defineSymbol(math, main, mathord, _ch4, wideChar);
   4645   defineSymbol(symbols_text, main, textord, _ch4, wideChar);
   4646   wideChar = String.fromCharCode(0xD835, 0xDFE2 + _i4); // 0-9 sans serif
   4647 
   4648   defineSymbol(math, main, mathord, _ch4, wideChar);
   4649   defineSymbol(symbols_text, main, textord, _ch4, wideChar);
   4650   wideChar = String.fromCharCode(0xD835, 0xDFEC + _i4); // 0-9 bold sans
   4651 
   4652   defineSymbol(math, main, mathord, _ch4, wideChar);
   4653   defineSymbol(symbols_text, main, textord, _ch4, wideChar);
   4654   wideChar = String.fromCharCode(0xD835, 0xDFF6 + _i4); // 0-9 monospace
   4655 
   4656   defineSymbol(math, main, mathord, _ch4, wideChar);
   4657   defineSymbol(symbols_text, main, textord, _ch4, wideChar);
   4658 } // We add these Latin-1 letters as symbols for backwards-compatibility,
   4659 // but they are not actually in the font, nor are they supported by the
   4660 // Unicode accent mechanism, so they fall back to Times font and look ugly.
   4661 // TODO(edemaine): Fix this.
   4662 
   4663 
   4664 var extraLatin = "\xC7\xD0\xDE\xE7\xFE";
   4665 
   4666 for (var _i5 = 0; _i5 < extraLatin.length; _i5++) {
   4667   var _ch5 = extraLatin.charAt(_i5);
   4668 
   4669   defineSymbol(math, main, mathord, _ch5, _ch5);
   4670   defineSymbol(symbols_text, main, textord, _ch5, _ch5);
   4671 }
   4672 ;// CONCATENATED MODULE: ./src/wide-character.js
   4673 /**
   4674  * This file provides support for Unicode range U+1D400 to U+1D7FF,
   4675  * Mathematical Alphanumeric Symbols.
   4676  *
   4677  * Function wideCharacterFont takes a wide character as input and returns
   4678  * the font information necessary to render it properly.
   4679  */
   4680 
   4681 /**
   4682  * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf
   4683  * That document sorts characters into groups by font type, say bold or italic.
   4684  *
   4685  * In the arrays below, each subarray consists three elements:
   4686  *      * The CSS class of that group when in math mode.
   4687  *      * The CSS class of that group when in text mode.
   4688  *      * The font name, so that KaTeX can get font metrics.
   4689  */
   4690 
   4691 var wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright
   4692 ["mathbf", "textbf", "Main-Bold"], // a-z bold upright
   4693 ["mathnormal", "textit", "Math-Italic"], // A-Z italic
   4694 ["mathnormal", "textit", "Math-Italic"], // a-z italic
   4695 ["boldsymbol", "boldsymbol", "Main-BoldItalic"], // A-Z bold italic
   4696 ["boldsymbol", "boldsymbol", "Main-BoldItalic"], // a-z bold italic
   4697 // Map fancy A-Z letters to script, not calligraphic.
   4698 // This aligns with unicode-math and math fonts (except Cambria Math).
   4699 ["mathscr", "textscr", "Script-Regular"], // A-Z script
   4700 ["", "", ""], // a-z script.  No font
   4701 ["", "", ""], // A-Z bold script. No font
   4702 ["", "", ""], // a-z bold script. No font
   4703 ["mathfrak", "textfrak", "Fraktur-Regular"], // A-Z Fraktur
   4704 ["mathfrak", "textfrak", "Fraktur-Regular"], // a-z Fraktur
   4705 ["mathbb", "textbb", "AMS-Regular"], // A-Z double-struck
   4706 ["mathbb", "textbb", "AMS-Regular"], // k double-struck
   4707 ["", "", ""], // A-Z bold Fraktur No font metrics
   4708 ["", "", ""], // a-z bold Fraktur.   No font.
   4709 ["mathsf", "textsf", "SansSerif-Regular"], // A-Z sans-serif
   4710 ["mathsf", "textsf", "SansSerif-Regular"], // a-z sans-serif
   4711 ["mathboldsf", "textboldsf", "SansSerif-Bold"], // A-Z bold sans-serif
   4712 ["mathboldsf", "textboldsf", "SansSerif-Bold"], // a-z bold sans-serif
   4713 ["mathitsf", "textitsf", "SansSerif-Italic"], // A-Z italic sans-serif
   4714 ["mathitsf", "textitsf", "SansSerif-Italic"], // a-z italic sans-serif
   4715 ["", "", ""], // A-Z bold italic sans. No font
   4716 ["", "", ""], // a-z bold italic sans. No font
   4717 ["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace
   4718 ["mathtt", "texttt", "Typewriter-Regular"] // a-z monospace
   4719 ];
   4720 var wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold
   4721 ["", "", ""], // 0-9 double-struck. No KaTeX font.
   4722 ["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif
   4723 ["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif
   4724 ["mathtt", "texttt", "Typewriter-Regular"] // 0-9 monospace
   4725 ];
   4726 var wideCharacterFont = function wideCharacterFont(wideChar, mode) {
   4727   // IE doesn't support codePointAt(). So work with the surrogate pair.
   4728   var H = wideChar.charCodeAt(0); // high surrogate
   4729 
   4730   var L = wideChar.charCodeAt(1); // low surrogate
   4731 
   4732   var codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000;
   4733   var j = mode === "math" ? 0 : 1; // column index for CSS class.
   4734 
   4735   if (0x1D400 <= codePoint && codePoint < 0x1D6A4) {
   4736     // wideLatinLetterData contains exactly 26 chars on each row.
   4737     // So we can calculate the relevant row. No traverse necessary.
   4738     var i = Math.floor((codePoint - 0x1D400) / 26);
   4739     return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]];
   4740   } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) {
   4741     // Numerals, ten per row.
   4742     var _i = Math.floor((codePoint - 0x1D7CE) / 10);
   4743 
   4744     return [wideNumeralData[_i][2], wideNumeralData[_i][j]];
   4745   } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) {
   4746     // dotless i or j
   4747     return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];
   4748   } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) {
   4749     // Greek letters. Not supported, yet.
   4750     return ["", ""];
   4751   } else {
   4752     // We don't support any wide characters outside 1D400–1D7FF.
   4753     throw new src_ParseError("Unsupported character: " + wideChar);
   4754   }
   4755 };
   4756 ;// CONCATENATED MODULE: ./src/Options.js
   4757 /**
   4758  * This file contains information about the options that the Parser carries
   4759  * around with it while parsing. Data is held in an `Options` object, and when
   4760  * recursing, a new `Options` object can be created with the `.with*` and
   4761  * `.reset` functions.
   4762  */
   4763 
   4764 var sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize].
   4765 // The size mappings are taken from TeX with \normalsize=10pt.
   4766 [1, 1, 1], // size1: [5, 5, 5]              \tiny
   4767 [2, 1, 1], // size2: [6, 5, 5]
   4768 [3, 1, 1], // size3: [7, 5, 5]              \scriptsize
   4769 [4, 2, 1], // size4: [8, 6, 5]              \footnotesize
   4770 [5, 2, 1], // size5: [9, 6, 5]              \small
   4771 [6, 3, 1], // size6: [10, 7, 5]             \normalsize
   4772 [7, 4, 2], // size7: [12, 8, 6]             \large
   4773 [8, 6, 3], // size8: [14.4, 10, 7]          \Large
   4774 [9, 7, 6], // size9: [17.28, 12, 10]        \LARGE
   4775 [10, 8, 7], // size10: [20.74, 14.4, 12]     \huge
   4776 [11, 10, 9] // size11: [24.88, 20.74, 17.28] \HUGE
   4777 ];
   4778 var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if
   4779 // you change size indexes, change that function.
   4780 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488];
   4781 
   4782 var sizeAtStyle = function sizeAtStyle(size, style) {
   4783   return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];
   4784 }; // In these types, "" (empty string) means "no change".
   4785 
   4786 
   4787 /**
   4788  * This is the main options class. It contains the current style, size, color,
   4789  * and font.
   4790  *
   4791  * Options objects should not be modified. To create a new Options with
   4792  * different properties, call a `.having*` method.
   4793  */
   4794 var Options = /*#__PURE__*/function () {
   4795   // A font family applies to a group of fonts (i.e. SansSerif), while a font
   4796   // represents a specific font (i.e. SansSerif Bold).
   4797   // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm
   4798 
   4799   /**
   4800    * The base size index.
   4801    */
   4802   function Options(data) {
   4803     this.style = void 0;
   4804     this.color = void 0;
   4805     this.size = void 0;
   4806     this.textSize = void 0;
   4807     this.phantom = void 0;
   4808     this.font = void 0;
   4809     this.fontFamily = void 0;
   4810     this.fontWeight = void 0;
   4811     this.fontShape = void 0;
   4812     this.sizeMultiplier = void 0;
   4813     this.maxSize = void 0;
   4814     this.minRuleThickness = void 0;
   4815     this._fontMetrics = void 0;
   4816     this.style = data.style;
   4817     this.color = data.color;
   4818     this.size = data.size || Options.BASESIZE;
   4819     this.textSize = data.textSize || this.size;
   4820     this.phantom = !!data.phantom;
   4821     this.font = data.font || "";
   4822     this.fontFamily = data.fontFamily || "";
   4823     this.fontWeight = data.fontWeight || '';
   4824     this.fontShape = data.fontShape || '';
   4825     this.sizeMultiplier = sizeMultipliers[this.size - 1];
   4826     this.maxSize = data.maxSize;
   4827     this.minRuleThickness = data.minRuleThickness;
   4828     this._fontMetrics = undefined;
   4829   }
   4830   /**
   4831    * Returns a new options object with the same properties as "this".  Properties
   4832    * from "extension" will be copied to the new options object.
   4833    */
   4834 
   4835 
   4836   var _proto = Options.prototype;
   4837 
   4838   _proto.extend = function extend(extension) {
   4839     var data = {
   4840       style: this.style,
   4841       size: this.size,
   4842       textSize: this.textSize,
   4843       color: this.color,
   4844       phantom: this.phantom,
   4845       font: this.font,
   4846       fontFamily: this.fontFamily,
   4847       fontWeight: this.fontWeight,
   4848       fontShape: this.fontShape,
   4849       maxSize: this.maxSize,
   4850       minRuleThickness: this.minRuleThickness
   4851     };
   4852 
   4853     for (var key in extension) {
   4854       if (extension.hasOwnProperty(key)) {
   4855         data[key] = extension[key];
   4856       }
   4857     }
   4858 
   4859     return new Options(data);
   4860   }
   4861   /**
   4862    * Return an options object with the given style. If `this.style === style`,
   4863    * returns `this`.
   4864    */
   4865   ;
   4866 
   4867   _proto.havingStyle = function havingStyle(style) {
   4868     if (this.style === style) {
   4869       return this;
   4870     } else {
   4871       return this.extend({
   4872         style: style,
   4873         size: sizeAtStyle(this.textSize, style)
   4874       });
   4875     }
   4876   }
   4877   /**
   4878    * Return an options object with a cramped version of the current style. If
   4879    * the current style is cramped, returns `this`.
   4880    */
   4881   ;
   4882 
   4883   _proto.havingCrampedStyle = function havingCrampedStyle() {
   4884     return this.havingStyle(this.style.cramp());
   4885   }
   4886   /**
   4887    * Return an options object with the given size and in at least `\textstyle`.
   4888    * Returns `this` if appropriate.
   4889    */
   4890   ;
   4891 
   4892   _proto.havingSize = function havingSize(size) {
   4893     if (this.size === size && this.textSize === size) {
   4894       return this;
   4895     } else {
   4896       return this.extend({
   4897         style: this.style.text(),
   4898         size: size,
   4899         textSize: size,
   4900         sizeMultiplier: sizeMultipliers[size - 1]
   4901       });
   4902     }
   4903   }
   4904   /**
   4905    * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
   4906    * changes to at least `\textstyle`.
   4907    */
   4908   ;
   4909 
   4910   _proto.havingBaseStyle = function havingBaseStyle(style) {
   4911     style = style || this.style.text();
   4912     var wantSize = sizeAtStyle(Options.BASESIZE, style);
   4913 
   4914     if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) {
   4915       return this;
   4916     } else {
   4917       return this.extend({
   4918         style: style,
   4919         size: wantSize
   4920       });
   4921     }
   4922   }
   4923   /**
   4924    * Remove the effect of sizing changes such as \Huge.
   4925    * Keep the effect of the current style, such as \scriptstyle.
   4926    */
   4927   ;
   4928 
   4929   _proto.havingBaseSizing = function havingBaseSizing() {
   4930     var size;
   4931 
   4932     switch (this.style.id) {
   4933       case 4:
   4934       case 5:
   4935         size = 3; // normalsize in scriptstyle
   4936 
   4937         break;
   4938 
   4939       case 6:
   4940       case 7:
   4941         size = 1; // normalsize in scriptscriptstyle
   4942 
   4943         break;
   4944 
   4945       default:
   4946         size = 6;
   4947       // normalsize in textstyle or displaystyle
   4948     }
   4949 
   4950     return this.extend({
   4951       style: this.style.text(),
   4952       size: size
   4953     });
   4954   }
   4955   /**
   4956    * Create a new options object with the given color.
   4957    */
   4958   ;
   4959 
   4960   _proto.withColor = function withColor(color) {
   4961     return this.extend({
   4962       color: color
   4963     });
   4964   }
   4965   /**
   4966    * Create a new options object with "phantom" set to true.
   4967    */
   4968   ;
   4969 
   4970   _proto.withPhantom = function withPhantom() {
   4971     return this.extend({
   4972       phantom: true
   4973     });
   4974   }
   4975   /**
   4976    * Creates a new options object with the given math font or old text font.
   4977    * @type {[type]}
   4978    */
   4979   ;
   4980 
   4981   _proto.withFont = function withFont(font) {
   4982     return this.extend({
   4983       font: font
   4984     });
   4985   }
   4986   /**
   4987    * Create a new options objects with the given fontFamily.
   4988    */
   4989   ;
   4990 
   4991   _proto.withTextFontFamily = function withTextFontFamily(fontFamily) {
   4992     return this.extend({
   4993       fontFamily: fontFamily,
   4994       font: ""
   4995     });
   4996   }
   4997   /**
   4998    * Creates a new options object with the given font weight
   4999    */
   5000   ;
   5001 
   5002   _proto.withTextFontWeight = function withTextFontWeight(fontWeight) {
   5003     return this.extend({
   5004       fontWeight: fontWeight,
   5005       font: ""
   5006     });
   5007   }
   5008   /**
   5009    * Creates a new options object with the given font weight
   5010    */
   5011   ;
   5012 
   5013   _proto.withTextFontShape = function withTextFontShape(fontShape) {
   5014     return this.extend({
   5015       fontShape: fontShape,
   5016       font: ""
   5017     });
   5018   }
   5019   /**
   5020    * Return the CSS sizing classes required to switch from enclosing options
   5021    * `oldOptions` to `this`. Returns an array of classes.
   5022    */
   5023   ;
   5024 
   5025   _proto.sizingClasses = function sizingClasses(oldOptions) {
   5026     if (oldOptions.size !== this.size) {
   5027       return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
   5028     } else {
   5029       return [];
   5030     }
   5031   }
   5032   /**
   5033    * Return the CSS sizing classes required to switch to the base size. Like
   5034    * `this.havingSize(BASESIZE).sizingClasses(this)`.
   5035    */
   5036   ;
   5037 
   5038   _proto.baseSizingClasses = function baseSizingClasses() {
   5039     if (this.size !== Options.BASESIZE) {
   5040       return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
   5041     } else {
   5042       return [];
   5043     }
   5044   }
   5045   /**
   5046    * Return the font metrics for this size.
   5047    */
   5048   ;
   5049 
   5050   _proto.fontMetrics = function fontMetrics() {
   5051     if (!this._fontMetrics) {
   5052       this._fontMetrics = getGlobalMetrics(this.size);
   5053     }
   5054 
   5055     return this._fontMetrics;
   5056   }
   5057   /**
   5058    * Gets the CSS color of the current options object
   5059    */
   5060   ;
   5061 
   5062   _proto.getColor = function getColor() {
   5063     if (this.phantom) {
   5064       return "transparent";
   5065     } else {
   5066       return this.color;
   5067     }
   5068   };
   5069 
   5070   return Options;
   5071 }();
   5072 
   5073 Options.BASESIZE = 6;
   5074 /* harmony default export */ var src_Options = (Options);
   5075 ;// CONCATENATED MODULE: ./src/units.js
   5076 /**
   5077  * This file does conversion between units.  In particular, it provides
   5078  * calculateSize to convert other units into ems.
   5079  */
   5080 
   5081  // This table gives the number of TeX pts in one of each *absolute* TeX unit.
   5082 // Thus, multiplying a length by this number converts the length from units
   5083 // into pts.  Dividing the result by ptPerEm gives the number of ems
   5084 // *assuming* a font size of ptPerEm (normal size, normal style).
   5085 
   5086 var ptPerUnit = {
   5087   // https://en.wikibooks.org/wiki/LaTeX/Lengths and
   5088   // https://tex.stackexchange.com/a/8263
   5089   "pt": 1,
   5090   // TeX point
   5091   "mm": 7227 / 2540,
   5092   // millimeter
   5093   "cm": 7227 / 254,
   5094   // centimeter
   5095   "in": 72.27,
   5096   // inch
   5097   "bp": 803 / 800,
   5098   // big (PostScript) points
   5099   "pc": 12,
   5100   // pica
   5101   "dd": 1238 / 1157,
   5102   // didot
   5103   "cc": 14856 / 1157,
   5104   // cicero (12 didot)
   5105   "nd": 685 / 642,
   5106   // new didot
   5107   "nc": 1370 / 107,
   5108   // new cicero (12 new didot)
   5109   "sp": 1 / 65536,
   5110   // scaled point (TeX's internal smallest unit)
   5111   // https://tex.stackexchange.com/a/41371
   5112   "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
   5113 
   5114 }; // Dictionary of relative units, for fast validity testing.
   5115 
   5116 var relativeUnit = {
   5117   "ex": true,
   5118   "em": true,
   5119   "mu": true
   5120 };
   5121 
   5122 /**
   5123  * Determine whether the specified unit (either a string defining the unit
   5124  * or a "size" parse node containing a unit field) is valid.
   5125  */
   5126 var validUnit = function validUnit(unit) {
   5127   if (typeof unit !== "string") {
   5128     unit = unit.unit;
   5129   }
   5130 
   5131   return unit in ptPerUnit || unit in relativeUnit || unit === "ex";
   5132 };
   5133 /*
   5134  * Convert a "size" parse node (with numeric "number" and string "unit" fields,
   5135  * as parsed by functions.js argType "size") into a CSS em value for the
   5136  * current style/scale.  `options` gives the current options.
   5137  */
   5138 
   5139 var calculateSize = function calculateSize(sizeValue, options) {
   5140   var scale;
   5141 
   5142   if (sizeValue.unit in ptPerUnit) {
   5143     // Absolute units
   5144     scale = ptPerUnit[sizeValue.unit] // Convert unit to pt
   5145     / options.fontMetrics().ptPerEm // Convert pt to CSS em
   5146     / options.sizeMultiplier; // Unscale to make absolute units
   5147   } else if (sizeValue.unit === "mu") {
   5148     // `mu` units scale with scriptstyle/scriptscriptstyle.
   5149     scale = options.fontMetrics().cssEmPerMu;
   5150   } else {
   5151     // Other relative units always refer to the *textstyle* font
   5152     // in the current size.
   5153     var unitOptions;
   5154 
   5155     if (options.style.isTight()) {
   5156       // isTight() means current style is script/scriptscript.
   5157       unitOptions = options.havingStyle(options.style.text());
   5158     } else {
   5159       unitOptions = options;
   5160     } // TODO: In TeX these units are relative to the quad of the current
   5161     // *text* font, e.g. cmr10. KaTeX instead uses values from the
   5162     // comparably-sized *Computer Modern symbol* font. At 10pt, these
   5163     // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641;
   5164     // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$.
   5165     // TeX \showlists shows a kern of 1.13889 * fontsize;
   5166     // KaTeX shows a kern of 1.171 * fontsize.
   5167 
   5168 
   5169     if (sizeValue.unit === "ex") {
   5170       scale = unitOptions.fontMetrics().xHeight;
   5171     } else if (sizeValue.unit === "em") {
   5172       scale = unitOptions.fontMetrics().quad;
   5173     } else {
   5174       throw new src_ParseError("Invalid unit: '" + sizeValue.unit + "'");
   5175     }
   5176 
   5177     if (unitOptions !== options) {
   5178       scale *= unitOptions.sizeMultiplier / options.sizeMultiplier;
   5179     }
   5180   }
   5181 
   5182   return Math.min(sizeValue.number * scale, options.maxSize);
   5183 };
   5184 ;// CONCATENATED MODULE: ./src/buildCommon.js
   5185 /* eslint no-console:0 */
   5186 
   5187 /**
   5188  * This module contains general functions that can be used for building
   5189  * different kinds of domTree nodes in a consistent manner.
   5190  */
   5191 
   5192 
   5193 
   5194 
   5195 
   5196 
   5197 
   5198 /**
   5199  * Looks up the given symbol in fontMetrics, after applying any symbol
   5200  * replacements defined in symbol.js
   5201  */
   5202 var lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this.
   5203 fontName, mode) {
   5204   // Replace the value with its replaced value from symbol.js
   5205   if (src_symbols[mode][value] && src_symbols[mode][value].replace) {
   5206     value = src_symbols[mode][value].replace;
   5207   }
   5208 
   5209   return {
   5210     value: value,
   5211     metrics: getCharacterMetrics(value, fontName, mode)
   5212   };
   5213 };
   5214 /**
   5215  * Makes a symbolNode after translation via the list of symbols in symbols.js.
   5216  * Correctly pulls out metrics for the character, and optionally takes a list of
   5217  * classes to be attached to the node.
   5218  *
   5219  * TODO: make argument order closer to makeSpan
   5220  * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
   5221  * should if present come first in `classes`.
   5222  * TODO(#953): Make `options` mandatory and always pass it in.
   5223  */
   5224 
   5225 
   5226 var makeSymbol = function makeSymbol(value, fontName, mode, options, classes) {
   5227   var lookup = lookupSymbol(value, fontName, mode);
   5228   var metrics = lookup.metrics;
   5229   value = lookup.value;
   5230   var symbolNode;
   5231 
   5232   if (metrics) {
   5233     var italic = metrics.italic;
   5234 
   5235     if (mode === "text" || options && options.font === "mathit") {
   5236       italic = 0;
   5237     }
   5238 
   5239     symbolNode = new SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes);
   5240   } else {
   5241     // TODO(emily): Figure out a good way to only print this in development
   5242     typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'"));
   5243     symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes);
   5244   }
   5245 
   5246   if (options) {
   5247     symbolNode.maxFontSize = options.sizeMultiplier;
   5248 
   5249     if (options.style.isTight()) {
   5250       symbolNode.classes.push("mtight");
   5251     }
   5252 
   5253     var color = options.getColor();
   5254 
   5255     if (color) {
   5256       symbolNode.style.color = color;
   5257     }
   5258   }
   5259 
   5260   return symbolNode;
   5261 };
   5262 /**
   5263  * Makes a symbol in Main-Regular or AMS-Regular.
   5264  * Used for rel, bin, open, close, inner, and punct.
   5265  */
   5266 
   5267 
   5268 var mathsym = function mathsym(value, mode, options, classes) {
   5269   if (classes === void 0) {
   5270     classes = [];
   5271   }
   5272 
   5273   // Decide what font to render the symbol in by its entry in the symbols
   5274   // table.
   5275   // Have a special case for when the value = \ because the \ is used as a
   5276   // textord in unsupported command errors but cannot be parsed as a regular
   5277   // text ordinal and is therefore not present as a symbol in the symbols
   5278   // table for text, as well as a special case for boldsymbol because it
   5279   // can be used for bold + and -
   5280   if (options.font === "boldsymbol" && lookupSymbol(value, "Main-Bold", mode).metrics) {
   5281     return makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"]));
   5282   } else if (value === "\\" || src_symbols[mode][value].font === "main") {
   5283     return makeSymbol(value, "Main-Regular", mode, options, classes);
   5284   } else {
   5285     return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"]));
   5286   }
   5287 };
   5288 /**
   5289  * Determines which of the two font names (Main-Bold and Math-BoldItalic) and
   5290  * corresponding style tags (mathbf or boldsymbol) to use for font "boldsymbol",
   5291  * depending on the symbol.  Use this function instead of fontMap for font
   5292  * "boldsymbol".
   5293  */
   5294 
   5295 
   5296 var boldsymbol = function boldsymbol(value, mode, options, classes, type) {
   5297   if (type !== "textord" && lookupSymbol(value, "Math-BoldItalic", mode).metrics) {
   5298     return {
   5299       fontName: "Math-BoldItalic",
   5300       fontClass: "boldsymbol"
   5301     };
   5302   } else {
   5303     // Some glyphs do not exist in Math-BoldItalic so we need to use
   5304     // Main-Bold instead.
   5305     return {
   5306       fontName: "Main-Bold",
   5307       fontClass: "mathbf"
   5308     };
   5309   }
   5310 };
   5311 /**
   5312  * Makes either a mathord or textord in the correct font and color.
   5313  */
   5314 
   5315 
   5316 var makeOrd = function makeOrd(group, options, type) {
   5317   var mode = group.mode;
   5318   var text = group.text;
   5319   var classes = ["mord"]; // Math mode or Old font (i.e. \rm)
   5320 
   5321   var isFont = mode === "math" || mode === "text" && options.font;
   5322   var fontOrFamily = isFont ? options.font : options.fontFamily;
   5323 
   5324   if (text.charCodeAt(0) === 0xD835) {
   5325     // surrogate pairs get special treatment
   5326     var _wideCharacterFont = wideCharacterFont(text, mode),
   5327         wideFontName = _wideCharacterFont[0],
   5328         wideFontClass = _wideCharacterFont[1];
   5329 
   5330     return makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass));
   5331   } else if (fontOrFamily) {
   5332     var fontName;
   5333     var fontClasses;
   5334 
   5335     if (fontOrFamily === "boldsymbol") {
   5336       var fontData = boldsymbol(text, mode, options, classes, type);
   5337       fontName = fontData.fontName;
   5338       fontClasses = [fontData.fontClass];
   5339     } else if (isFont) {
   5340       fontName = fontMap[fontOrFamily].fontName;
   5341       fontClasses = [fontOrFamily];
   5342     } else {
   5343       fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape);
   5344       fontClasses = [fontOrFamily, options.fontWeight, options.fontShape];
   5345     }
   5346 
   5347     if (lookupSymbol(text, fontName, mode).metrics) {
   5348       return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses));
   5349     } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") {
   5350       // Deconstruct ligatures in monospace fonts (\texttt, \tt).
   5351       var parts = [];
   5352 
   5353       for (var i = 0; i < text.length; i++) {
   5354         parts.push(makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses)));
   5355       }
   5356 
   5357       return makeFragment(parts);
   5358     }
   5359   } // Makes a symbol in the default font for mathords and textords.
   5360 
   5361 
   5362   if (type === "mathord") {
   5363     return makeSymbol(text, "Math-Italic", mode, options, classes.concat(["mathnormal"]));
   5364   } else if (type === "textord") {
   5365     var font = src_symbols[mode][text] && src_symbols[mode][text].font;
   5366 
   5367     if (font === "ams") {
   5368       var _fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape);
   5369 
   5370       return makeSymbol(text, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape));
   5371     } else if (font === "main" || !font) {
   5372       var _fontName2 = retrieveTextFontName("textrm", options.fontWeight, options.fontShape);
   5373 
   5374       return makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape));
   5375     } else {
   5376       // fonts added by plugins
   5377       var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class
   5378 
   5379 
   5380       return makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape));
   5381     }
   5382   } else {
   5383     throw new Error("unexpected type: " + type + " in makeOrd");
   5384   }
   5385 };
   5386 /**
   5387  * Returns true if subsequent symbolNodes have the same classes, skew, maxFont,
   5388  * and styles.
   5389  */
   5390 
   5391 
   5392 var canCombine = function canCombine(prev, next) {
   5393   if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) {
   5394     return false;
   5395   } // If prev and next both are just "mbin"s or "mord"s we don't combine them
   5396   // so that the proper spacing can be preserved.
   5397 
   5398 
   5399   if (prev.classes.length === 1) {
   5400     var cls = prev.classes[0];
   5401 
   5402     if (cls === "mbin" || cls === "mord") {
   5403       return false;
   5404     }
   5405   }
   5406 
   5407   for (var style in prev.style) {
   5408     if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) {
   5409       return false;
   5410     }
   5411   }
   5412 
   5413   for (var _style in next.style) {
   5414     if (next.style.hasOwnProperty(_style) && prev.style[_style] !== next.style[_style]) {
   5415       return false;
   5416     }
   5417   }
   5418 
   5419   return true;
   5420 };
   5421 /**
   5422  * Combine consecutive domTree.symbolNodes into a single symbolNode.
   5423  * Note: this function mutates the argument.
   5424  */
   5425 
   5426 
   5427 var tryCombineChars = function tryCombineChars(chars) {
   5428   for (var i = 0; i < chars.length - 1; i++) {
   5429     var prev = chars[i];
   5430     var next = chars[i + 1];
   5431 
   5432     if (prev instanceof SymbolNode && next instanceof SymbolNode && canCombine(prev, next)) {
   5433       prev.text += next.text;
   5434       prev.height = Math.max(prev.height, next.height);
   5435       prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use
   5436       // it to add padding to the right of the span created from
   5437       // the combined characters.
   5438 
   5439       prev.italic = next.italic;
   5440       chars.splice(i + 1, 1);
   5441       i--;
   5442     }
   5443   }
   5444 
   5445   return chars;
   5446 };
   5447 /**
   5448  * Calculate the height, depth, and maxFontSize of an element based on its
   5449  * children.
   5450  */
   5451 
   5452 
   5453 var sizeElementFromChildren = function sizeElementFromChildren(elem) {
   5454   var height = 0;
   5455   var depth = 0;
   5456   var maxFontSize = 0;
   5457 
   5458   for (var i = 0; i < elem.children.length; i++) {
   5459     var child = elem.children[i];
   5460 
   5461     if (child.height > height) {
   5462       height = child.height;
   5463     }
   5464 
   5465     if (child.depth > depth) {
   5466       depth = child.depth;
   5467     }
   5468 
   5469     if (child.maxFontSize > maxFontSize) {
   5470       maxFontSize = child.maxFontSize;
   5471     }
   5472   }
   5473 
   5474   elem.height = height;
   5475   elem.depth = depth;
   5476   elem.maxFontSize = maxFontSize;
   5477 };
   5478 /**
   5479  * Makes a span with the given list of classes, list of children, and options.
   5480  *
   5481  * TODO(#953): Ensure that `options` is always provided (currently some call
   5482  * sites don't pass it) and make the type below mandatory.
   5483  * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
   5484  * should if present come first in `classes`.
   5485  */
   5486 
   5487 
   5488 var makeSpan = function makeSpan(classes, children, options, style) {
   5489   var span = new Span(classes, children, options, style);
   5490   sizeElementFromChildren(span);
   5491   return span;
   5492 }; // SVG one is simpler -- doesn't require height, depth, max-font setting.
   5493 // This is also a separate method for typesafety.
   5494 
   5495 
   5496 var makeSvgSpan = function makeSvgSpan(classes, children, options, style) {
   5497   return new Span(classes, children, options, style);
   5498 };
   5499 
   5500 var makeLineSpan = function makeLineSpan(className, options, thickness) {
   5501   var line = makeSpan([className], [], options);
   5502   line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
   5503   line.style.borderBottomWidth = line.height + "em";
   5504   line.maxFontSize = 1.0;
   5505   return line;
   5506 };
   5507 /**
   5508  * Makes an anchor with the given href, list of classes, list of children,
   5509  * and options.
   5510  */
   5511 
   5512 
   5513 var makeAnchor = function makeAnchor(href, classes, children, options) {
   5514   var anchor = new Anchor(href, classes, children, options);
   5515   sizeElementFromChildren(anchor);
   5516   return anchor;
   5517 };
   5518 /**
   5519  * Makes a document fragment with the given list of children.
   5520  */
   5521 
   5522 
   5523 var makeFragment = function makeFragment(children) {
   5524   var fragment = new DocumentFragment(children);
   5525   sizeElementFromChildren(fragment);
   5526   return fragment;
   5527 };
   5528 /**
   5529  * Wraps group in a span if it's a document fragment, allowing to apply classes
   5530  * and styles
   5531  */
   5532 
   5533 
   5534 var wrapFragment = function wrapFragment(group, options) {
   5535   if (group instanceof DocumentFragment) {
   5536     return makeSpan([], [group], options);
   5537   }
   5538 
   5539   return group;
   5540 }; // These are exact object types to catch typos in the names of the optional fields.
   5541 
   5542 
   5543 // Computes the updated `children` list and the overall depth.
   5544 //
   5545 // This helper function for makeVList makes it easier to enforce type safety by
   5546 // allowing early exits (returns) in the logic.
   5547 var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) {
   5548   if (params.positionType === "individualShift") {
   5549     var oldChildren = params.children;
   5550     var children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be
   5551     // shifted to the correct specified shift
   5552 
   5553     var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth;
   5554 
   5555     var currPos = _depth;
   5556 
   5557     for (var i = 1; i < oldChildren.length; i++) {
   5558       var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth;
   5559       var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth);
   5560       currPos = currPos + diff;
   5561       children.push({
   5562         type: "kern",
   5563         size: size
   5564       });
   5565       children.push(oldChildren[i]);
   5566     }
   5567 
   5568     return {
   5569       children: children,
   5570       depth: _depth
   5571     };
   5572   }
   5573 
   5574   var depth;
   5575 
   5576   if (params.positionType === "top") {
   5577     // We always start at the bottom, so calculate the bottom by adding up
   5578     // all the sizes
   5579     var bottom = params.positionData;
   5580 
   5581     for (var _i = 0; _i < params.children.length; _i++) {
   5582       var child = params.children[_i];
   5583       bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth;
   5584     }
   5585 
   5586     depth = bottom;
   5587   } else if (params.positionType === "bottom") {
   5588     depth = -params.positionData;
   5589   } else {
   5590     var firstChild = params.children[0];
   5591 
   5592     if (firstChild.type !== "elem") {
   5593       throw new Error('First child must have type "elem".');
   5594     }
   5595 
   5596     if (params.positionType === "shift") {
   5597       depth = -firstChild.elem.depth - params.positionData;
   5598     } else if (params.positionType === "firstBaseline") {
   5599       depth = -firstChild.elem.depth;
   5600     } else {
   5601       throw new Error("Invalid positionType " + params.positionType + ".");
   5602     }
   5603   }
   5604 
   5605   return {
   5606     children: params.children,
   5607     depth: depth
   5608   };
   5609 };
   5610 /**
   5611  * Makes a vertical list by stacking elements and kerns on top of each other.
   5612  * Allows for many different ways of specifying the positioning method.
   5613  *
   5614  * See VListParam documentation above.
   5615  */
   5616 
   5617 
   5618 var makeVList = function makeVList(params, options) {
   5619   var _getVListChildrenAndD = getVListChildrenAndDepth(params),
   5620       children = _getVListChildrenAndD.children,
   5621       depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to
   5622   // each item, where it will determine the item's baseline. Since it has
   5623   // `overflow:hidden`, the strut's top edge will sit on the item's line box's
   5624   // top edge and the strut's bottom edge will sit on the item's baseline,
   5625   // with no additional line-height spacing. This allows the item baseline to
   5626   // be positioned precisely without worrying about font ascent and
   5627   // line-height.
   5628 
   5629 
   5630   var pstrutSize = 0;
   5631 
   5632   for (var i = 0; i < children.length; i++) {
   5633     var child = children[i];
   5634 
   5635     if (child.type === "elem") {
   5636       var elem = child.elem;
   5637       pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height);
   5638     }
   5639   }
   5640 
   5641   pstrutSize += 2;
   5642   var pstrut = makeSpan(["pstrut"], []);
   5643   pstrut.style.height = pstrutSize + "em"; // Create a new list of actual children at the correct offsets
   5644 
   5645   var realChildren = [];
   5646   var minPos = depth;
   5647   var maxPos = depth;
   5648   var currPos = depth;
   5649 
   5650   for (var _i2 = 0; _i2 < children.length; _i2++) {
   5651     var _child = children[_i2];
   5652 
   5653     if (_child.type === "kern") {
   5654       currPos += _child.size;
   5655     } else {
   5656       var _elem = _child.elem;
   5657       var classes = _child.wrapperClasses || [];
   5658       var style = _child.wrapperStyle || {};
   5659       var childWrap = makeSpan(classes, [pstrut, _elem], undefined, style);
   5660       childWrap.style.top = -pstrutSize - currPos - _elem.depth + "em";
   5661 
   5662       if (_child.marginLeft) {
   5663         childWrap.style.marginLeft = _child.marginLeft;
   5664       }
   5665 
   5666       if (_child.marginRight) {
   5667         childWrap.style.marginRight = _child.marginRight;
   5668       }
   5669 
   5670       realChildren.push(childWrap);
   5671       currPos += _elem.height + _elem.depth;
   5672     }
   5673 
   5674     minPos = Math.min(minPos, currPos);
   5675     maxPos = Math.max(maxPos, currPos);
   5676   } // The vlist contents go in a table-cell with `vertical-align:bottom`.
   5677   // This cell's bottom edge will determine the containing table's baseline
   5678   // without overly expanding the containing line-box.
   5679 
   5680 
   5681   var vlist = makeSpan(["vlist"], realChildren);
   5682   vlist.style.height = maxPos + "em"; // A second row is used if necessary to represent the vlist's depth.
   5683 
   5684   var rows;
   5685 
   5686   if (minPos < 0) {
   5687     // We will define depth in an empty span with display: table-cell.
   5688     // It should render with the height that we define. But Chrome, in
   5689     // contenteditable mode only, treats that span as if it contains some
   5690     // text content. And that min-height over-rides our desired height.
   5691     // So we put another empty span inside the depth strut span.
   5692     var emptySpan = makeSpan([], []);
   5693     var depthStrut = makeSpan(["vlist"], [emptySpan]);
   5694     depthStrut.style.height = -minPos + "em"; // Safari wants the first row to have inline content; otherwise it
   5695     // puts the bottom of the *second* row on the baseline.
   5696 
   5697     var topStrut = makeSpan(["vlist-s"], [new SymbolNode("\u200B")]);
   5698     rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])];
   5699   } else {
   5700     rows = [makeSpan(["vlist-r"], [vlist])];
   5701   }
   5702 
   5703   var vtable = makeSpan(["vlist-t"], rows);
   5704 
   5705   if (rows.length === 2) {
   5706     vtable.classes.push("vlist-t2");
   5707   }
   5708 
   5709   vtable.height = maxPos;
   5710   vtable.depth = -minPos;
   5711   return vtable;
   5712 }; // Glue is a concept from TeX which is a flexible space between elements in
   5713 // either a vertical or horizontal list. In KaTeX, at least for now, it's
   5714 // static space between elements in a horizontal layout.
   5715 
   5716 
   5717 var makeGlue = function makeGlue(measurement, options) {
   5718   // Make an empty span for the space
   5719   var rule = makeSpan(["mspace"], [], options);
   5720   var size = calculateSize(measurement, options);
   5721   rule.style.marginRight = size + "em";
   5722   return rule;
   5723 }; // Takes font options, and returns the appropriate fontLookup name
   5724 
   5725 
   5726 var retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) {
   5727   var baseFontName = "";
   5728 
   5729   switch (fontFamily) {
   5730     case "amsrm":
   5731       baseFontName = "AMS";
   5732       break;
   5733 
   5734     case "textrm":
   5735       baseFontName = "Main";
   5736       break;
   5737 
   5738     case "textsf":
   5739       baseFontName = "SansSerif";
   5740       break;
   5741 
   5742     case "texttt":
   5743       baseFontName = "Typewriter";
   5744       break;
   5745 
   5746     default:
   5747       baseFontName = fontFamily;
   5748     // use fonts added by a plugin
   5749   }
   5750 
   5751   var fontStylesName;
   5752 
   5753   if (fontWeight === "textbf" && fontShape === "textit") {
   5754     fontStylesName = "BoldItalic";
   5755   } else if (fontWeight === "textbf") {
   5756     fontStylesName = "Bold";
   5757   } else if (fontWeight === "textit") {
   5758     fontStylesName = "Italic";
   5759   } else {
   5760     fontStylesName = "Regular";
   5761   }
   5762 
   5763   return baseFontName + "-" + fontStylesName;
   5764 };
   5765 /**
   5766  * Maps TeX font commands to objects containing:
   5767  * - variant: string used for "mathvariant" attribute in buildMathML.js
   5768  * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics
   5769  */
   5770 // A map between tex font commands an MathML mathvariant attribute values
   5771 
   5772 
   5773 var fontMap = {
   5774   // styles
   5775   "mathbf": {
   5776     variant: "bold",
   5777     fontName: "Main-Bold"
   5778   },
   5779   "mathrm": {
   5780     variant: "normal",
   5781     fontName: "Main-Regular"
   5782   },
   5783   "textit": {
   5784     variant: "italic",
   5785     fontName: "Main-Italic"
   5786   },
   5787   "mathit": {
   5788     variant: "italic",
   5789     fontName: "Main-Italic"
   5790   },
   5791   "mathnormal": {
   5792     variant: "italic",
   5793     fontName: "Math-Italic"
   5794   },
   5795   // "boldsymbol" is missing because they require the use of multiple fonts:
   5796   // Math-BoldItalic and Main-Bold.  This is handled by a special case in
   5797   // makeOrd which ends up calling boldsymbol.
   5798   // families
   5799   "mathbb": {
   5800     variant: "double-struck",
   5801     fontName: "AMS-Regular"
   5802   },
   5803   "mathcal": {
   5804     variant: "script",
   5805     fontName: "Caligraphic-Regular"
   5806   },
   5807   "mathfrak": {
   5808     variant: "fraktur",
   5809     fontName: "Fraktur-Regular"
   5810   },
   5811   "mathscr": {
   5812     variant: "script",
   5813     fontName: "Script-Regular"
   5814   },
   5815   "mathsf": {
   5816     variant: "sans-serif",
   5817     fontName: "SansSerif-Regular"
   5818   },
   5819   "mathtt": {
   5820     variant: "monospace",
   5821     fontName: "Typewriter-Regular"
   5822   }
   5823 };
   5824 var svgData = {
   5825   //   path, width, height
   5826   vec: ["vec", 0.471, 0.714],
   5827   // values from the font glyph
   5828   oiintSize1: ["oiintSize1", 0.957, 0.499],
   5829   // oval to overlay the integrand
   5830   oiintSize2: ["oiintSize2", 1.472, 0.659],
   5831   oiiintSize1: ["oiiintSize1", 1.304, 0.499],
   5832   oiiintSize2: ["oiiintSize2", 1.98, 0.659]
   5833 };
   5834 
   5835 var staticSvg = function staticSvg(value, options) {
   5836   // Create a span with inline SVG for the element.
   5837   var _svgData$value = svgData[value],
   5838       pathName = _svgData$value[0],
   5839       width = _svgData$value[1],
   5840       height = _svgData$value[2];
   5841   var path = new PathNode(pathName);
   5842   var svgNode = new SvgNode([path], {
   5843     "width": width + "em",
   5844     "height": height + "em",
   5845     // Override CSS rule `.katex svg { width: 100% }`
   5846     "style": "width:" + width + "em",
   5847     "viewBox": "0 0 " + 1000 * width + " " + 1000 * height,
   5848     "preserveAspectRatio": "xMinYMin"
   5849   });
   5850   var span = makeSvgSpan(["overlay"], [svgNode], options);
   5851   span.height = height;
   5852   span.style.height = height + "em";
   5853   span.style.width = width + "em";
   5854   return span;
   5855 };
   5856 
   5857 /* harmony default export */ var buildCommon = ({
   5858   fontMap: fontMap,
   5859   makeSymbol: makeSymbol,
   5860   mathsym: mathsym,
   5861   makeSpan: makeSpan,
   5862   makeSvgSpan: makeSvgSpan,
   5863   makeLineSpan: makeLineSpan,
   5864   makeAnchor: makeAnchor,
   5865   makeFragment: makeFragment,
   5866   wrapFragment: wrapFragment,
   5867   makeVList: makeVList,
   5868   makeOrd: makeOrd,
   5869   makeGlue: makeGlue,
   5870   staticSvg: staticSvg,
   5871   svgData: svgData,
   5872   tryCombineChars: tryCombineChars
   5873 });
   5874 ;// CONCATENATED MODULE: ./src/spacingData.js
   5875 /**
   5876  * Describes spaces between different classes of atoms.
   5877  */
   5878 var thinspace = {
   5879   number: 3,
   5880   unit: "mu"
   5881 };
   5882 var mediumspace = {
   5883   number: 4,
   5884   unit: "mu"
   5885 };
   5886 var thickspace = {
   5887   number: 5,
   5888   unit: "mu"
   5889 }; // Making the type below exact with all optional fields doesn't work due to
   5890 // - https://github.com/facebook/flow/issues/4582
   5891 // - https://github.com/facebook/flow/issues/5688
   5892 // However, since *all* fields are optional, $Shape<> works as suggested in 5688
   5893 // above.
   5894 
   5895 // Spacing relationships for display and text styles
   5896 var spacings = {
   5897   mord: {
   5898     mop: thinspace,
   5899     mbin: mediumspace,
   5900     mrel: thickspace,
   5901     minner: thinspace
   5902   },
   5903   mop: {
   5904     mord: thinspace,
   5905     mop: thinspace,
   5906     mrel: thickspace,
   5907     minner: thinspace
   5908   },
   5909   mbin: {
   5910     mord: mediumspace,
   5911     mop: mediumspace,
   5912     mopen: mediumspace,
   5913     minner: mediumspace
   5914   },
   5915   mrel: {
   5916     mord: thickspace,
   5917     mop: thickspace,
   5918     mopen: thickspace,
   5919     minner: thickspace
   5920   },
   5921   mopen: {},
   5922   mclose: {
   5923     mop: thinspace,
   5924     mbin: mediumspace,
   5925     mrel: thickspace,
   5926     minner: thinspace
   5927   },
   5928   mpunct: {
   5929     mord: thinspace,
   5930     mop: thinspace,
   5931     mrel: thickspace,
   5932     mopen: thinspace,
   5933     mclose: thinspace,
   5934     mpunct: thinspace,
   5935     minner: thinspace
   5936   },
   5937   minner: {
   5938     mord: thinspace,
   5939     mop: thinspace,
   5940     mbin: mediumspace,
   5941     mrel: thickspace,
   5942     mopen: thinspace,
   5943     mpunct: thinspace,
   5944     minner: thinspace
   5945   }
   5946 }; // Spacing relationships for script and scriptscript styles
   5947 
   5948 var tightSpacings = {
   5949   mord: {
   5950     mop: thinspace
   5951   },
   5952   mop: {
   5953     mord: thinspace,
   5954     mop: thinspace
   5955   },
   5956   mbin: {},
   5957   mrel: {},
   5958   mopen: {},
   5959   mclose: {
   5960     mop: thinspace
   5961   },
   5962   mpunct: {},
   5963   minner: {
   5964     mop: thinspace
   5965   }
   5966 };
   5967 ;// CONCATENATED MODULE: ./src/defineFunction.js
   5968 /** Context provided to function handlers for error messages. */
   5969 // Note: reverse the order of the return type union will cause a flow error.
   5970 // See https://github.com/facebook/flow/issues/3663.
   5971 // More general version of `HtmlBuilder` for nodes (e.g. \sum, accent types)
   5972 // whose presence impacts super/subscripting. In this case, ParseNode<"supsub">
   5973 // delegates its HTML building to the HtmlBuilder corresponding to these nodes.
   5974 
   5975 /**
   5976  * Final function spec for use at parse time.
   5977  * This is almost identical to `FunctionPropSpec`, except it
   5978  * 1. includes the function handler, and
   5979  * 2. requires all arguments except argTypes.
   5980  * It is generated by `defineFunction()` below.
   5981  */
   5982 
   5983 /**
   5984  * All registered functions.
   5985  * `functions.js` just exports this same dictionary again and makes it public.
   5986  * `Parser.js` requires this dictionary.
   5987  */
   5988 var _functions = {};
   5989 /**
   5990  * All HTML builders. Should be only used in the `define*` and the `build*ML`
   5991  * functions.
   5992  */
   5993 
   5994 var _htmlGroupBuilders = {};
   5995 /**
   5996  * All MathML builders. Should be only used in the `define*` and the `build*ML`
   5997  * functions.
   5998  */
   5999 
   6000 var _mathmlGroupBuilders = {};
   6001 function defineFunction(_ref) {
   6002   var type = _ref.type,
   6003       names = _ref.names,
   6004       props = _ref.props,
   6005       handler = _ref.handler,
   6006       htmlBuilder = _ref.htmlBuilder,
   6007       mathmlBuilder = _ref.mathmlBuilder;
   6008   // Set default values of functions
   6009   var data = {
   6010     type: type,
   6011     numArgs: props.numArgs,
   6012     argTypes: props.argTypes,
   6013     allowedInArgument: !!props.allowedInArgument,
   6014     allowedInText: !!props.allowedInText,
   6015     allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath,
   6016     numOptionalArgs: props.numOptionalArgs || 0,
   6017     infix: !!props.infix,
   6018     primitive: !!props.primitive,
   6019     handler: handler
   6020   };
   6021 
   6022   for (var i = 0; i < names.length; ++i) {
   6023     _functions[names[i]] = data;
   6024   }
   6025 
   6026   if (type) {
   6027     if (htmlBuilder) {
   6028       _htmlGroupBuilders[type] = htmlBuilder;
   6029     }
   6030 
   6031     if (mathmlBuilder) {
   6032       _mathmlGroupBuilders[type] = mathmlBuilder;
   6033     }
   6034   }
   6035 }
   6036 /**
   6037  * Use this to register only the HTML and MathML builders for a function (e.g.
   6038  * if the function's ParseNode is generated in Parser.js rather than via a
   6039  * stand-alone handler provided to `defineFunction`).
   6040  */
   6041 
   6042 function defineFunctionBuilders(_ref2) {
   6043   var type = _ref2.type,
   6044       htmlBuilder = _ref2.htmlBuilder,
   6045       mathmlBuilder = _ref2.mathmlBuilder;
   6046   defineFunction({
   6047     type: type,
   6048     names: [],
   6049     props: {
   6050       numArgs: 0
   6051     },
   6052     handler: function handler() {
   6053       throw new Error('Should never be called.');
   6054     },
   6055     htmlBuilder: htmlBuilder,
   6056     mathmlBuilder: mathmlBuilder
   6057   });
   6058 }
   6059 var normalizeArgument = function normalizeArgument(arg) {
   6060   return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg;
   6061 }; // Since the corresponding buildHTML/buildMathML function expects a
   6062 // list of elements, we normalize for different kinds of arguments
   6063 
   6064 var ordargument = function ordargument(arg) {
   6065   return arg.type === "ordgroup" ? arg.body : [arg];
   6066 };
   6067 ;// CONCATENATED MODULE: ./src/buildHTML.js
   6068 /**
   6069  * This file does the main work of building a domTree structure from a parse
   6070  * tree. The entry point is the `buildHTML` function, which takes a parse tree.
   6071  * Then, the buildExpression, buildGroup, and various groupBuilders functions
   6072  * are called, to produce a final HTML tree.
   6073  */
   6074 
   6075 
   6076 
   6077 
   6078 
   6079 
   6080 
   6081 
   6082 var buildHTML_makeSpan = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`)
   6083 // depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,
   6084 // and the text before Rule 19.
   6085 
   6086 var binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"];
   6087 var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"];
   6088 var styleMap = {
   6089   "display": src_Style.DISPLAY,
   6090   "text": src_Style.TEXT,
   6091   "script": src_Style.SCRIPT,
   6092   "scriptscript": src_Style.SCRIPTSCRIPT
   6093 };
   6094 var DomEnum = {
   6095   mord: "mord",
   6096   mop: "mop",
   6097   mbin: "mbin",
   6098   mrel: "mrel",
   6099   mopen: "mopen",
   6100   mclose: "mclose",
   6101   mpunct: "mpunct",
   6102   minner: "minner"
   6103 };
   6104 
   6105 /**
   6106  * Take a list of nodes, build them in order, and return a list of the built
   6107  * nodes. documentFragments are flattened into their contents, so the
   6108  * returned list contains no fragments. `isRealGroup` is true if `expression`
   6109  * is a real group (no atoms will be added on either side), as opposed to
   6110  * a partial group (e.g. one created by \color). `surrounding` is an array
   6111  * consisting type of nodes that will be added to the left and right.
   6112  */
   6113 var buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) {
   6114   if (surrounding === void 0) {
   6115     surrounding = [null, null];
   6116   }
   6117 
   6118   // Parse expressions into `groups`.
   6119   var groups = [];
   6120 
   6121   for (var i = 0; i < expression.length; i++) {
   6122     var output = buildGroup(expression[i], options);
   6123 
   6124     if (output instanceof DocumentFragment) {
   6125       var children = output.children;
   6126       groups.push.apply(groups, children);
   6127     } else {
   6128       groups.push(output);
   6129     }
   6130   } // Combine consecutive domTree.symbolNodes into a single symbolNode.
   6131 
   6132 
   6133   buildCommon.tryCombineChars(groups); // If `expression` is a partial group, let the parent handle spacings
   6134   // to avoid processing groups multiple times.
   6135 
   6136   if (!isRealGroup) {
   6137     return groups;
   6138   }
   6139 
   6140   var glueOptions = options;
   6141 
   6142   if (expression.length === 1) {
   6143     var node = expression[0];
   6144 
   6145     if (node.type === "sizing") {
   6146       glueOptions = options.havingSize(node.size);
   6147     } else if (node.type === "styling") {
   6148       glueOptions = options.havingStyle(styleMap[node.style]);
   6149     }
   6150   } // Dummy spans for determining spacings between surrounding atoms.
   6151   // If `expression` has no atoms on the left or right, class "leftmost"
   6152   // or "rightmost", respectively, is used to indicate it.
   6153 
   6154 
   6155   var dummyPrev = buildHTML_makeSpan([surrounding[0] || "leftmost"], [], options);
   6156   var dummyNext = buildHTML_makeSpan([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element
   6157   // of its `classes` array. A later cleanup should ensure this, for
   6158   // instance by changing the signature of `makeSpan`.
   6159   // Before determining what spaces to insert, perform bin cancellation.
   6160   // Binary operators change to ordinary symbols in some contexts.
   6161 
   6162   var isRoot = isRealGroup === "root";
   6163   traverseNonSpaceNodes(groups, function (node, prev) {
   6164     var prevType = prev.classes[0];
   6165     var type = node.classes[0];
   6166 
   6167     if (prevType === "mbin" && utils.contains(binRightCanceller, type)) {
   6168       prev.classes[0] = "mord";
   6169     } else if (type === "mbin" && utils.contains(binLeftCanceller, prevType)) {
   6170       node.classes[0] = "mord";
   6171     }
   6172   }, {
   6173     node: dummyPrev
   6174   }, dummyNext, isRoot);
   6175   traverseNonSpaceNodes(groups, function (node, prev) {
   6176     var prevType = getTypeOfDomTree(prev);
   6177     var type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style.
   6178 
   6179     var space = prevType && type ? node.hasClass("mtight") ? tightSpacings[prevType][type] : spacings[prevType][type] : null;
   6180 
   6181     if (space) {
   6182       // Insert glue (spacing) after the `prev`.
   6183       return buildCommon.makeGlue(space, glueOptions);
   6184     }
   6185   }, {
   6186     node: dummyPrev
   6187   }, dummyNext, isRoot);
   6188   return groups;
   6189 }; // Depth-first traverse non-space `nodes`, calling `callback` with the current and
   6190 // previous node as arguments, optionally returning a node to insert after the
   6191 // previous node. `prev` is an object with the previous node and `insertAfter`
   6192 // function to insert after it. `next` is a node that will be added to the right.
   6193 // Used for bin cancellation and inserting spacings.
   6194 
   6195 var traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next, isRoot) {
   6196   if (next) {
   6197     // temporarily append the right node, if exists
   6198     nodes.push(next);
   6199   }
   6200 
   6201   var i = 0;
   6202 
   6203   for (; i < nodes.length; i++) {
   6204     var node = nodes[i];
   6205     var partialGroup = checkPartialGroup(node);
   6206 
   6207     if (partialGroup) {
   6208       // Recursive DFS
   6209       // $FlowFixMe: make nodes a $ReadOnlyArray by returning a new array
   6210       traverseNonSpaceNodes(partialGroup.children, callback, prev, null, isRoot);
   6211       continue;
   6212     } // Ignore explicit spaces (e.g., \;, \,) when determining what implicit
   6213     // spacing should go between atoms of different classes
   6214 
   6215 
   6216     var nonspace = !node.hasClass("mspace");
   6217 
   6218     if (nonspace) {
   6219       var result = callback(node, prev.node);
   6220 
   6221       if (result) {
   6222         if (prev.insertAfter) {
   6223           prev.insertAfter(result);
   6224         } else {
   6225           // insert at front
   6226           nodes.unshift(result);
   6227           i++;
   6228         }
   6229       }
   6230     }
   6231 
   6232     if (nonspace) {
   6233       prev.node = node;
   6234     } else if (isRoot && node.hasClass("newline")) {
   6235       prev.node = buildHTML_makeSpan(["leftmost"]); // treat like beginning of line
   6236     }
   6237 
   6238     prev.insertAfter = function (index) {
   6239       return function (n) {
   6240         nodes.splice(index + 1, 0, n);
   6241         i++;
   6242       };
   6243     }(i);
   6244   }
   6245 
   6246   if (next) {
   6247     nodes.pop();
   6248   }
   6249 }; // Check if given node is a partial group, i.e., does not affect spacing around.
   6250 
   6251 
   6252 var checkPartialGroup = function checkPartialGroup(node) {
   6253   if (node instanceof DocumentFragment || node instanceof Anchor || node instanceof Span && node.hasClass("enclosing")) {
   6254     return node;
   6255   }
   6256 
   6257   return null;
   6258 }; // Return the outermost node of a domTree.
   6259 
   6260 
   6261 var getOutermostNode = function getOutermostNode(node, side) {
   6262   var partialGroup = checkPartialGroup(node);
   6263 
   6264   if (partialGroup) {
   6265     var children = partialGroup.children;
   6266 
   6267     if (children.length) {
   6268       if (side === "right") {
   6269         return getOutermostNode(children[children.length - 1], "right");
   6270       } else if (side === "left") {
   6271         return getOutermostNode(children[0], "left");
   6272       }
   6273     }
   6274   }
   6275 
   6276   return node;
   6277 }; // Return math atom class (mclass) of a domTree.
   6278 // If `side` is given, it will get the type of the outermost node at given side.
   6279 
   6280 
   6281 var getTypeOfDomTree = function getTypeOfDomTree(node, side) {
   6282   if (!node) {
   6283     return null;
   6284   }
   6285 
   6286   if (side) {
   6287     node = getOutermostNode(node, side);
   6288   } // This makes a lot of assumptions as to where the type of atom
   6289   // appears.  We should do a better job of enforcing this.
   6290 
   6291 
   6292   return DomEnum[node.classes[0]] || null;
   6293 };
   6294 var makeNullDelimiter = function makeNullDelimiter(options, classes) {
   6295   var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses());
   6296   return buildHTML_makeSpan(classes.concat(moreClasses));
   6297 };
   6298 /**
   6299  * buildGroup is the function that takes a group and calls the correct groupType
   6300  * function for it. It also handles the interaction of size and style changes
   6301  * between parents and children.
   6302  */
   6303 
   6304 var buildGroup = function buildGroup(group, options, baseOptions) {
   6305   if (!group) {
   6306     return buildHTML_makeSpan();
   6307   }
   6308 
   6309   if (_htmlGroupBuilders[group.type]) {
   6310     // Call the groupBuilders function
   6311     // $FlowFixMe
   6312     var groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account
   6313     // for that size difference.
   6314 
   6315     if (baseOptions && options.size !== baseOptions.size) {
   6316       groupNode = buildHTML_makeSpan(options.sizingClasses(baseOptions), [groupNode], options);
   6317       var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
   6318       groupNode.height *= multiplier;
   6319       groupNode.depth *= multiplier;
   6320     }
   6321 
   6322     return groupNode;
   6323   } else {
   6324     throw new src_ParseError("Got group of unknown type: '" + group.type + "'");
   6325   }
   6326 };
   6327 /**
   6328  * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`)
   6329  * into an unbreakable HTML node of class .base, with proper struts to
   6330  * guarantee correct vertical extent.  `buildHTML` calls this repeatedly to
   6331  * make up the entire expression as a sequence of unbreakable units.
   6332  */
   6333 
   6334 function buildHTMLUnbreakable(children, options) {
   6335   // Compute height and depth of this chunk.
   6336   var body = buildHTML_makeSpan(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at
   6337   // the height of the expression, and the bottom of the HTML element
   6338   // falls at the depth of the expression.
   6339 
   6340   var strut = buildHTML_makeSpan(["strut"]);
   6341   strut.style.height = body.height + body.depth + "em";
   6342   strut.style.verticalAlign = -body.depth + "em";
   6343   body.children.unshift(strut);
   6344   return body;
   6345 }
   6346 /**
   6347  * Take an entire parse tree, and build it into an appropriate set of HTML
   6348  * nodes.
   6349  */
   6350 
   6351 
   6352 function buildHTML(tree, options) {
   6353   // Strip off outer tag wrapper for processing below.
   6354   var tag = null;
   6355 
   6356   if (tree.length === 1 && tree[0].type === "tag") {
   6357     tag = tree[0].tag;
   6358     tree = tree[0].body;
   6359   } // Build the expression contained in the tree
   6360 
   6361 
   6362   var expression = buildExpression(tree, options, "root");
   6363   var eqnNum;
   6364 
   6365   if (expression.length === 2 && expression[1].hasClass("tag")) {
   6366     // An environment with automatic equation numbers, e.g. {gather}.
   6367     eqnNum = expression.pop();
   6368   }
   6369 
   6370   var children = []; // Create one base node for each chunk between potential line breaks.
   6371   // The TeXBook [p.173] says "A formula will be broken only after a
   6372   // relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary
   6373   // operation symbol like $+$ or $-$ or $\times$, where the relation or
   6374   // binary operation is on the ``outer level'' of the formula (i.e., not
   6375   // enclosed in {...} and not part of an \over construction)."
   6376 
   6377   var parts = [];
   6378 
   6379   for (var i = 0; i < expression.length; i++) {
   6380     parts.push(expression[i]);
   6381 
   6382     if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) {
   6383       // Put any post-operator glue on same line as operator.
   6384       // Watch for \nobreak along the way, and stop at \newline.
   6385       var nobreak = false;
   6386 
   6387       while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) {
   6388         i++;
   6389         parts.push(expression[i]);
   6390 
   6391         if (expression[i].hasClass("nobreak")) {
   6392           nobreak = true;
   6393         }
   6394       } // Don't allow break if \nobreak among the post-operator glue.
   6395 
   6396 
   6397       if (!nobreak) {
   6398         children.push(buildHTMLUnbreakable(parts, options));
   6399         parts = [];
   6400       }
   6401     } else if (expression[i].hasClass("newline")) {
   6402       // Write the line except the newline
   6403       parts.pop();
   6404 
   6405       if (parts.length > 0) {
   6406         children.push(buildHTMLUnbreakable(parts, options));
   6407         parts = [];
   6408       } // Put the newline at the top level
   6409 
   6410 
   6411       children.push(expression[i]);
   6412     }
   6413   }
   6414 
   6415   if (parts.length > 0) {
   6416     children.push(buildHTMLUnbreakable(parts, options));
   6417   } // Now, if there was a tag, build it too and append it as a final child.
   6418 
   6419 
   6420   var tagChild;
   6421 
   6422   if (tag) {
   6423     tagChild = buildHTMLUnbreakable(buildExpression(tag, options, true));
   6424     tagChild.classes = ["tag"];
   6425     children.push(tagChild);
   6426   } else if (eqnNum) {
   6427     children.push(eqnNum);
   6428   }
   6429 
   6430   var htmlNode = buildHTML_makeSpan(["katex-html"], children);
   6431   htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children
   6432   // (the height of the enclosing htmlNode) for proper vertical alignment.
   6433 
   6434   if (tagChild) {
   6435     var strut = tagChild.children[0];
   6436     strut.style.height = htmlNode.height + htmlNode.depth + "em";
   6437     strut.style.verticalAlign = -htmlNode.depth + "em";
   6438   }
   6439 
   6440   return htmlNode;
   6441 }
   6442 ;// CONCATENATED MODULE: ./src/mathMLTree.js
   6443 /**
   6444  * These objects store data about MathML nodes. This is the MathML equivalent
   6445  * of the types in domTree.js. Since MathML handles its own rendering, and
   6446  * since we're mainly using MathML to improve accessibility, we don't manage
   6447  * any of the styling state that the plain DOM nodes do.
   6448  *
   6449  * The `toNode` and `toMarkup` functions work simlarly to how they do in
   6450  * domTree.js, creating namespaced DOM nodes and HTML text markup respectively.
   6451  */
   6452 
   6453 
   6454 
   6455 function newDocumentFragment(children) {
   6456   return new DocumentFragment(children);
   6457 }
   6458 /**
   6459  * This node represents a general purpose MathML node of any type. The
   6460  * constructor requires the type of node to create (for example, `"mo"` or
   6461  * `"mspace"`, corresponding to `<mo>` and `<mspace>` tags).
   6462  */
   6463 
   6464 var MathNode = /*#__PURE__*/function () {
   6465   function MathNode(type, children, classes) {
   6466     this.type = void 0;
   6467     this.attributes = void 0;
   6468     this.children = void 0;
   6469     this.classes = void 0;
   6470     this.type = type;
   6471     this.attributes = {};
   6472     this.children = children || [];
   6473     this.classes = classes || [];
   6474   }
   6475   /**
   6476    * Sets an attribute on a MathML node. MathML depends on attributes to convey a
   6477    * semantic content, so this is used heavily.
   6478    */
   6479 
   6480 
   6481   var _proto = MathNode.prototype;
   6482 
   6483   _proto.setAttribute = function setAttribute(name, value) {
   6484     this.attributes[name] = value;
   6485   }
   6486   /**
   6487    * Gets an attribute on a MathML node.
   6488    */
   6489   ;
   6490 
   6491   _proto.getAttribute = function getAttribute(name) {
   6492     return this.attributes[name];
   6493   }
   6494   /**
   6495    * Converts the math node into a MathML-namespaced DOM element.
   6496    */
   6497   ;
   6498 
   6499   _proto.toNode = function toNode() {
   6500     var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
   6501 
   6502     for (var attr in this.attributes) {
   6503       if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
   6504         node.setAttribute(attr, this.attributes[attr]);
   6505       }
   6506     }
   6507 
   6508     if (this.classes.length > 0) {
   6509       node.className = createClass(this.classes);
   6510     }
   6511 
   6512     for (var i = 0; i < this.children.length; i++) {
   6513       node.appendChild(this.children[i].toNode());
   6514     }
   6515 
   6516     return node;
   6517   }
   6518   /**
   6519    * Converts the math node into an HTML markup string.
   6520    */
   6521   ;
   6522 
   6523   _proto.toMarkup = function toMarkup() {
   6524     var markup = "<" + this.type; // Add the attributes
   6525 
   6526     for (var attr in this.attributes) {
   6527       if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
   6528         markup += " " + attr + "=\"";
   6529         markup += utils.escape(this.attributes[attr]);
   6530         markup += "\"";
   6531       }
   6532     }
   6533 
   6534     if (this.classes.length > 0) {
   6535       markup += " class =\"" + utils.escape(createClass(this.classes)) + "\"";
   6536     }
   6537 
   6538     markup += ">";
   6539 
   6540     for (var i = 0; i < this.children.length; i++) {
   6541       markup += this.children[i].toMarkup();
   6542     }
   6543 
   6544     markup += "</" + this.type + ">";
   6545     return markup;
   6546   }
   6547   /**
   6548    * Converts the math node into a string, similar to innerText, but escaped.
   6549    */
   6550   ;
   6551 
   6552   _proto.toText = function toText() {
   6553     return this.children.map(function (child) {
   6554       return child.toText();
   6555     }).join("");
   6556   };
   6557 
   6558   return MathNode;
   6559 }();
   6560 /**
   6561  * This node represents a piece of text.
   6562  */
   6563 
   6564 var TextNode = /*#__PURE__*/function () {
   6565   function TextNode(text) {
   6566     this.text = void 0;
   6567     this.text = text;
   6568   }
   6569   /**
   6570    * Converts the text node into a DOM text node.
   6571    */
   6572 
   6573 
   6574   var _proto2 = TextNode.prototype;
   6575 
   6576   _proto2.toNode = function toNode() {
   6577     return document.createTextNode(this.text);
   6578   }
   6579   /**
   6580    * Converts the text node into escaped HTML markup
   6581    * (representing the text itself).
   6582    */
   6583   ;
   6584 
   6585   _proto2.toMarkup = function toMarkup() {
   6586     return utils.escape(this.toText());
   6587   }
   6588   /**
   6589    * Converts the text node into a string
   6590    * (representing the text iteself).
   6591    */
   6592   ;
   6593 
   6594   _proto2.toText = function toText() {
   6595     return this.text;
   6596   };
   6597 
   6598   return TextNode;
   6599 }();
   6600 /**
   6601  * This node represents a space, but may render as <mspace.../> or as text,
   6602  * depending on the width.
   6603  */
   6604 
   6605 var SpaceNode = /*#__PURE__*/function () {
   6606   /**
   6607    * Create a Space node with width given in CSS ems.
   6608    */
   6609   function SpaceNode(width) {
   6610     this.width = void 0;
   6611     this.character = void 0;
   6612     this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html
   6613     // for a table of space-like characters.  We use Unicode
   6614     // representations instead of &LongNames; as it's not clear how to
   6615     // make the latter via document.createTextNode.
   6616 
   6617     if (width >= 0.05555 && width <= 0.05556) {
   6618       this.character = "\u200A"; // &VeryThinSpace;
   6619     } else if (width >= 0.1666 && width <= 0.1667) {
   6620       this.character = "\u2009"; // &ThinSpace;
   6621     } else if (width >= 0.2222 && width <= 0.2223) {
   6622       this.character = "\u2005"; // &MediumSpace;
   6623     } else if (width >= 0.2777 && width <= 0.2778) {
   6624       this.character = "\u2005\u200A"; // &ThickSpace;
   6625     } else if (width >= -0.05556 && width <= -0.05555) {
   6626       this.character = "\u200A\u2063"; // &NegativeVeryThinSpace;
   6627     } else if (width >= -0.1667 && width <= -0.1666) {
   6628       this.character = "\u2009\u2063"; // &NegativeThinSpace;
   6629     } else if (width >= -0.2223 && width <= -0.2222) {
   6630       this.character = "\u205F\u2063"; // &NegativeMediumSpace;
   6631     } else if (width >= -0.2778 && width <= -0.2777) {
   6632       this.character = "\u2005\u2063"; // &NegativeThickSpace;
   6633     } else {
   6634       this.character = null;
   6635     }
   6636   }
   6637   /**
   6638    * Converts the math node into a MathML-namespaced DOM element.
   6639    */
   6640 
   6641 
   6642   var _proto3 = SpaceNode.prototype;
   6643 
   6644   _proto3.toNode = function toNode() {
   6645     if (this.character) {
   6646       return document.createTextNode(this.character);
   6647     } else {
   6648       var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace");
   6649       node.setAttribute("width", this.width + "em");
   6650       return node;
   6651     }
   6652   }
   6653   /**
   6654    * Converts the math node into an HTML markup string.
   6655    */
   6656   ;
   6657 
   6658   _proto3.toMarkup = function toMarkup() {
   6659     if (this.character) {
   6660       return "<mtext>" + this.character + "</mtext>";
   6661     } else {
   6662       return "<mspace width=\"" + this.width + "em\"/>";
   6663     }
   6664   }
   6665   /**
   6666    * Converts the math node into a string, similar to innerText.
   6667    */
   6668   ;
   6669 
   6670   _proto3.toText = function toText() {
   6671     if (this.character) {
   6672       return this.character;
   6673     } else {
   6674       return " ";
   6675     }
   6676   };
   6677 
   6678   return SpaceNode;
   6679 }();
   6680 
   6681 /* harmony default export */ var mathMLTree = ({
   6682   MathNode: MathNode,
   6683   TextNode: TextNode,
   6684   SpaceNode: SpaceNode,
   6685   newDocumentFragment: newDocumentFragment
   6686 });
   6687 ;// CONCATENATED MODULE: ./src/buildMathML.js
   6688 /**
   6689  * This file converts a parse tree into a cooresponding MathML tree. The main
   6690  * entry point is the `buildMathML` function, which takes a parse tree from the
   6691  * parser.
   6692  */
   6693 
   6694 
   6695 
   6696 
   6697 
   6698 
   6699 
   6700 
   6701 
   6702 /**
   6703  * Takes a symbol and converts it into a MathML text node after performing
   6704  * optional replacement from symbols.js.
   6705  */
   6706 var makeText = function makeText(text, mode, options) {
   6707   if (src_symbols[mode][text] && src_symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === "tt" || options.font && options.font.substr(4, 2) === "tt"))) {
   6708     text = src_symbols[mode][text].replace;
   6709   }
   6710 
   6711   return new mathMLTree.TextNode(text);
   6712 };
   6713 /**
   6714  * Wrap the given array of nodes in an <mrow> node if needed, i.e.,
   6715  * unless the array has length 1.  Always returns a single node.
   6716  */
   6717 
   6718 var makeRow = function makeRow(body) {
   6719   if (body.length === 1) {
   6720     return body[0];
   6721   } else {
   6722     return new mathMLTree.MathNode("mrow", body);
   6723   }
   6724 };
   6725 /**
   6726  * Returns the math variant as a string or null if none is required.
   6727  */
   6728 
   6729 var getVariant = function getVariant(group, options) {
   6730   // Handle \text... font specifiers as best we can.
   6731   // MathML has a limited list of allowable mathvariant specifiers; see
   6732   // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt
   6733   if (options.fontFamily === "texttt") {
   6734     return "monospace";
   6735   } else if (options.fontFamily === "textsf") {
   6736     if (options.fontShape === "textit" && options.fontWeight === "textbf") {
   6737       return "sans-serif-bold-italic";
   6738     } else if (options.fontShape === "textit") {
   6739       return "sans-serif-italic";
   6740     } else if (options.fontWeight === "textbf") {
   6741       return "bold-sans-serif";
   6742     } else {
   6743       return "sans-serif";
   6744     }
   6745   } else if (options.fontShape === "textit" && options.fontWeight === "textbf") {
   6746     return "bold-italic";
   6747   } else if (options.fontShape === "textit") {
   6748     return "italic";
   6749   } else if (options.fontWeight === "textbf") {
   6750     return "bold";
   6751   }
   6752 
   6753   var font = options.font;
   6754 
   6755   if (!font || font === "mathnormal") {
   6756     return null;
   6757   }
   6758 
   6759   var mode = group.mode;
   6760 
   6761   if (font === "mathit") {
   6762     return "italic";
   6763   } else if (font === "boldsymbol") {
   6764     return group.type === "textord" ? "bold" : "bold-italic";
   6765   } else if (font === "mathbf") {
   6766     return "bold";
   6767   } else if (font === "mathbb") {
   6768     return "double-struck";
   6769   } else if (font === "mathfrak") {
   6770     return "fraktur";
   6771   } else if (font === "mathscr" || font === "mathcal") {
   6772     // MathML makes no distinction between script and caligrahpic
   6773     return "script";
   6774   } else if (font === "mathsf") {
   6775     return "sans-serif";
   6776   } else if (font === "mathtt") {
   6777     return "monospace";
   6778   }
   6779 
   6780   var text = group.text;
   6781 
   6782   if (utils.contains(["\\imath", "\\jmath"], text)) {
   6783     return null;
   6784   }
   6785 
   6786   if (src_symbols[mode][text] && src_symbols[mode][text].replace) {
   6787     text = src_symbols[mode][text].replace;
   6788   }
   6789 
   6790   var fontName = buildCommon.fontMap[font].fontName;
   6791 
   6792   if (getCharacterMetrics(text, fontName, mode)) {
   6793     return buildCommon.fontMap[font].variant;
   6794   }
   6795 
   6796   return null;
   6797 };
   6798 /**
   6799  * Takes a list of nodes, builds them, and returns a list of the generated
   6800  * MathML nodes.  Also combine consecutive <mtext> outputs into a single
   6801  * <mtext> tag.
   6802  */
   6803 
   6804 var buildMathML_buildExpression = function buildExpression(expression, options, isOrdgroup) {
   6805   if (expression.length === 1) {
   6806     var group = buildMathML_buildGroup(expression[0], options);
   6807 
   6808     if (isOrdgroup && group instanceof MathNode && group.type === "mo") {
   6809       // When TeX writers want to suppress spacing on an operator,
   6810       // they often put the operator by itself inside braces.
   6811       group.setAttribute("lspace", "0em");
   6812       group.setAttribute("rspace", "0em");
   6813     }
   6814 
   6815     return [group];
   6816   }
   6817 
   6818   var groups = [];
   6819   var lastGroup;
   6820 
   6821   for (var i = 0; i < expression.length; i++) {
   6822     var _group = buildMathML_buildGroup(expression[i], options);
   6823 
   6824     if (_group instanceof MathNode && lastGroup instanceof MathNode) {
   6825       // Concatenate adjacent <mtext>s
   6826       if (_group.type === 'mtext' && lastGroup.type === 'mtext' && _group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) {
   6827         var _lastGroup$children;
   6828 
   6829         (_lastGroup$children = lastGroup.children).push.apply(_lastGroup$children, _group.children);
   6830 
   6831         continue; // Concatenate adjacent <mn>s
   6832       } else if (_group.type === 'mn' && lastGroup.type === 'mn') {
   6833         var _lastGroup$children2;
   6834 
   6835         (_lastGroup$children2 = lastGroup.children).push.apply(_lastGroup$children2, _group.children);
   6836 
   6837         continue; // Concatenate <mn>...</mn> followed by <mi>.</mi>
   6838       } else if (_group.type === 'mi' && _group.children.length === 1 && lastGroup.type === 'mn') {
   6839         var child = _group.children[0];
   6840 
   6841         if (child instanceof TextNode && child.text === '.') {
   6842           var _lastGroup$children3;
   6843 
   6844           (_lastGroup$children3 = lastGroup.children).push.apply(_lastGroup$children3, _group.children);
   6845 
   6846           continue;
   6847         }
   6848       } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) {
   6849         var lastChild = lastGroup.children[0];
   6850 
   6851         if (lastChild instanceof TextNode && lastChild.text === "\u0338" && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) {
   6852           var _child = _group.children[0];
   6853 
   6854           if (_child instanceof TextNode && _child.text.length > 0) {
   6855             // Overlay with combining character long solidus
   6856             _child.text = _child.text.slice(0, 1) + "\u0338" + _child.text.slice(1);
   6857             groups.pop();
   6858           }
   6859         }
   6860       }
   6861     }
   6862 
   6863     groups.push(_group);
   6864     lastGroup = _group;
   6865   }
   6866 
   6867   return groups;
   6868 };
   6869 /**
   6870  * Equivalent to buildExpression, but wraps the elements in an <mrow>
   6871  * if there's more than one.  Returns a single node instead of an array.
   6872  */
   6873 
   6874 var buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) {
   6875   return makeRow(buildMathML_buildExpression(expression, options, isOrdgroup));
   6876 };
   6877 /**
   6878  * Takes a group from the parser and calls the appropriate groupBuilders function
   6879  * on it to produce a MathML node.
   6880  */
   6881 
   6882 var buildMathML_buildGroup = function buildGroup(group, options) {
   6883   if (!group) {
   6884     return new mathMLTree.MathNode("mrow");
   6885   }
   6886 
   6887   if (_mathmlGroupBuilders[group.type]) {
   6888     // Call the groupBuilders function
   6889     // $FlowFixMe
   6890     var result = _mathmlGroupBuilders[group.type](group, options); // $FlowFixMe
   6891 
   6892     return result;
   6893   } else {
   6894     throw new src_ParseError("Got group of unknown type: '" + group.type + "'");
   6895   }
   6896 };
   6897 /**
   6898  * Takes a full parse tree and settings and builds a MathML representation of
   6899  * it. In particular, we put the elements from building the parse tree into a
   6900  * <semantics> tag so we can also include that TeX source as an annotation.
   6901  *
   6902  * Note that we actually return a domTree element with a `<math>` inside it so
   6903  * we can do appropriate styling.
   6904  */
   6905 
   6906 function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) {
   6907   var expression = buildMathML_buildExpression(tree, options); // TODO: Make a pass thru the MathML similar to buildHTML.traverseNonSpaceNodes
   6908   // and add spacing nodes. This is necessary only adjacent to math operators
   6909   // like \sin or \lim or to subsup elements that contain math operators.
   6910   // MathML takes care of the other spacing issues.
   6911   // Wrap up the expression in an mrow so it is presented in the semantics
   6912   // tag correctly, unless it's a single <mrow> or <mtable>.
   6913 
   6914   var wrapper;
   6915 
   6916   if (expression.length === 1 && expression[0] instanceof MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) {
   6917     wrapper = expression[0];
   6918   } else {
   6919     wrapper = new mathMLTree.MathNode("mrow", expression);
   6920   } // Build a TeX annotation of the source
   6921 
   6922 
   6923   var annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]);
   6924   annotation.setAttribute("encoding", "application/x-tex");
   6925   var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
   6926   var math = new mathMLTree.MathNode("math", [semantics]);
   6927   math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
   6928 
   6929   if (isDisplayMode) {
   6930     math.setAttribute("display", "block");
   6931   } // You can't style <math> nodes, so we wrap the node in a span.
   6932   // NOTE: The span class is not typed to have <math> nodes as children, and
   6933   // we don't want to make the children type more generic since the children
   6934   // of span are expected to have more fields in `buildHtml` contexts.
   6935 
   6936 
   6937   var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; // $FlowFixMe
   6938 
   6939   return buildCommon.makeSpan([wrapperClass], [math]);
   6940 }
   6941 ;// CONCATENATED MODULE: ./src/buildTree.js
   6942 
   6943 
   6944 
   6945 
   6946 
   6947 
   6948 
   6949 var optionsFromSettings = function optionsFromSettings(settings) {
   6950   return new src_Options({
   6951     style: settings.displayMode ? src_Style.DISPLAY : src_Style.TEXT,
   6952     maxSize: settings.maxSize,
   6953     minRuleThickness: settings.minRuleThickness
   6954   });
   6955 };
   6956 
   6957 var displayWrap = function displayWrap(node, settings) {
   6958   if (settings.displayMode) {
   6959     var classes = ["katex-display"];
   6960 
   6961     if (settings.leqno) {
   6962       classes.push("leqno");
   6963     }
   6964 
   6965     if (settings.fleqn) {
   6966       classes.push("fleqn");
   6967     }
   6968 
   6969     node = buildCommon.makeSpan(classes, [node]);
   6970   }
   6971 
   6972   return node;
   6973 };
   6974 
   6975 var buildTree = function buildTree(tree, expression, settings) {
   6976   var options = optionsFromSettings(settings);
   6977   var katexNode;
   6978 
   6979   if (settings.output === "mathml") {
   6980     return buildMathML(tree, expression, options, settings.displayMode, true);
   6981   } else if (settings.output === "html") {
   6982     var htmlNode = buildHTML(tree, options);
   6983     katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
   6984   } else {
   6985     var mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false);
   6986 
   6987     var _htmlNode = buildHTML(tree, options);
   6988 
   6989     katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]);
   6990   }
   6991 
   6992   return displayWrap(katexNode, settings);
   6993 };
   6994 var buildHTMLTree = function buildHTMLTree(tree, expression, settings) {
   6995   var options = optionsFromSettings(settings);
   6996   var htmlNode = buildHTML(tree, options);
   6997   var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
   6998   return displayWrap(katexNode, settings);
   6999 };
   7000 /* harmony default export */ var src_buildTree = ((/* unused pure expression or super */ null && (buildTree)));
   7001 ;// CONCATENATED MODULE: ./src/stretchy.js
   7002 /**
   7003  * This file provides support to buildMathML.js and buildHTML.js
   7004  * for stretchy wide elements rendered from SVG files
   7005  * and other CSS trickery.
   7006  */
   7007 
   7008 
   7009 
   7010 
   7011 var stretchyCodePoint = {
   7012   widehat: "^",
   7013   widecheck: "ˇ",
   7014   widetilde: "~",
   7015   utilde: "~",
   7016   overleftarrow: "\u2190",
   7017   underleftarrow: "\u2190",
   7018   xleftarrow: "\u2190",
   7019   overrightarrow: "\u2192",
   7020   underrightarrow: "\u2192",
   7021   xrightarrow: "\u2192",
   7022   underbrace: "\u23DF",
   7023   overbrace: "\u23DE",
   7024   overgroup: "\u23E0",
   7025   undergroup: "\u23E1",
   7026   overleftrightarrow: "\u2194",
   7027   underleftrightarrow: "\u2194",
   7028   xleftrightarrow: "\u2194",
   7029   Overrightarrow: "\u21D2",
   7030   xRightarrow: "\u21D2",
   7031   overleftharpoon: "\u21BC",
   7032   xleftharpoonup: "\u21BC",
   7033   overrightharpoon: "\u21C0",
   7034   xrightharpoonup: "\u21C0",
   7035   xLeftarrow: "\u21D0",
   7036   xLeftrightarrow: "\u21D4",
   7037   xhookleftarrow: "\u21A9",
   7038   xhookrightarrow: "\u21AA",
   7039   xmapsto: "\u21A6",
   7040   xrightharpoondown: "\u21C1",
   7041   xleftharpoondown: "\u21BD",
   7042   xrightleftharpoons: "\u21CC",
   7043   xleftrightharpoons: "\u21CB",
   7044   xtwoheadleftarrow: "\u219E",
   7045   xtwoheadrightarrow: "\u21A0",
   7046   xlongequal: "=",
   7047   xtofrom: "\u21C4",
   7048   xrightleftarrows: "\u21C4",
   7049   xrightequilibrium: "\u21CC",
   7050   // Not a perfect match.
   7051   xleftequilibrium: "\u21CB",
   7052   // None better available.
   7053   "\\\\cdrightarrow": "\u2192",
   7054   "\\\\cdleftarrow": "\u2190",
   7055   "\\\\cdlongequal": "="
   7056 };
   7057 
   7058 var mathMLnode = function mathMLnode(label) {
   7059   var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label])]);
   7060   node.setAttribute("stretchy", "true");
   7061   return node;
   7062 }; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts.
   7063 // Copyright (c) 2009-2010, Design Science, Inc. (<www.mathjax.org>)
   7064 // Copyright (c) 2014-2017 Khan Academy (<www.khanacademy.org>)
   7065 // Licensed under the SIL Open Font License, Version 1.1.
   7066 // See \nhttp://scripts.sil.org/OFL
   7067 // Very Long SVGs
   7068 //    Many of the KaTeX stretchy wide elements use a long SVG image and an
   7069 //    overflow: hidden tactic to achieve a stretchy image while avoiding
   7070 //    distortion of arrowheads or brace corners.
   7071 //    The SVG typically contains a very long (400 em) arrow.
   7072 //    The SVG is in a container span that has overflow: hidden, so the span
   7073 //    acts like a window that exposes only part of the  SVG.
   7074 //    The SVG always has a longer, thinner aspect ratio than the container span.
   7075 //    After the SVG fills 100% of the height of the container span,
   7076 //    there is a long arrow shaft left over. That left-over shaft is not shown.
   7077 //    Instead, it is sliced off because the span's CSS has overflow: hidden.
   7078 //    Thus, the reader sees an arrow that matches the subject matter width
   7079 //    without distortion.
   7080 //    Some functions, such as \cancel, need to vary their aspect ratio. These
   7081 //    functions do not get the overflow SVG treatment.
   7082 // Second Brush Stroke
   7083 //    Low resolution monitors struggle to display images in fine detail.
   7084 //    So browsers apply anti-aliasing. A long straight arrow shaft therefore
   7085 //    will sometimes appear as if it has a blurred edge.
   7086 //    To mitigate this, these SVG files contain a second "brush-stroke" on the
   7087 //    arrow shafts. That is, a second long thin rectangular SVG path has been
   7088 //    written directly on top of each arrow shaft. This reinforcement causes
   7089 //    some of the screen pixels to display as black instead of the anti-aliased
   7090 //    gray pixel that a  single path would generate. So we get arrow shafts
   7091 //    whose edges appear to be sharper.
   7092 // In the katexImagesData object just below, the dimensions all
   7093 // correspond to path geometry inside the relevant SVG.
   7094 // For example, \overrightarrow uses the same arrowhead as glyph U+2192
   7095 // from the KaTeX Main font. The scaling factor is 1000.
   7096 // That is, inside the font, that arrowhead is 522 units tall, which
   7097 // corresponds to 0.522 em inside the document.
   7098 
   7099 
   7100 var katexImagesData = {
   7101   //   path(s), minWidth, height, align
   7102   overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
   7103   overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
   7104   underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
   7105   underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
   7106   xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"],
   7107   "\\cdrightarrow": [["rightarrow"], 3.0, 522, "xMaxYMin"],
   7108   // CD minwwidth2.5pc
   7109   xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"],
   7110   "\\cdleftarrow": [["leftarrow"], 3.0, 522, "xMinYMin"],
   7111   Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"],
   7112   xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"],
   7113   xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"],
   7114   overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"],
   7115   xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"],
   7116   xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"],
   7117   overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
   7118   xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
   7119   xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"],
   7120   xlongequal: [["longequal"], 0.888, 334, "xMinYMin"],
   7121   "\\cdlongequal": [["longequal"], 3.0, 334, "xMinYMin"],
   7122   xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"],
   7123   xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"],
   7124   overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
   7125   overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548],
   7126   underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548],
   7127   underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
   7128   xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522],
   7129   xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560],
   7130   xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716],
   7131   xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716],
   7132   xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522],
   7133   xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522],
   7134   overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
   7135   underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
   7136   overgroup: [["leftgroup", "rightgroup"], 0.888, 342],
   7137   undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342],
   7138   xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522],
   7139   xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528],
   7140   // The next three arrows are from the mhchem package.
   7141   // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the
   7142   // document as \xrightarrow or \xrightleftharpoons. Those have
   7143   // min-length = 1.75em, so we set min-length on these next three to match.
   7144   xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901],
   7145   xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716],
   7146   xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716]
   7147 };
   7148 
   7149 var groupLength = function groupLength(arg) {
   7150   if (arg.type === "ordgroup") {
   7151     return arg.body.length;
   7152   } else {
   7153     return 1;
   7154   }
   7155 };
   7156 
   7157 var svgSpan = function svgSpan(group, options) {
   7158   // Create a span with inline SVG for the element.
   7159   function buildSvgSpan_() {
   7160     var viewBoxWidth = 400000; // default
   7161 
   7162     var label = group.label.substr(1);
   7163 
   7164     if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) {
   7165       // Each type in the `if` statement corresponds to one of the ParseNode
   7166       // types below. This narrowing is required to access `grp.base`.
   7167       // $FlowFixMe
   7168       var grp = group; // There are four SVG images available for each function.
   7169       // Choose a taller image when there are more characters.
   7170 
   7171       var numChars = groupLength(grp.base);
   7172       var viewBoxHeight;
   7173       var pathName;
   7174 
   7175       var _height;
   7176 
   7177       if (numChars > 5) {
   7178         if (label === "widehat" || label === "widecheck") {
   7179           viewBoxHeight = 420;
   7180           viewBoxWidth = 2364;
   7181           _height = 0.42;
   7182           pathName = label + "4";
   7183         } else {
   7184           viewBoxHeight = 312;
   7185           viewBoxWidth = 2340;
   7186           _height = 0.34;
   7187           pathName = "tilde4";
   7188         }
   7189       } else {
   7190         var imgIndex = [1, 1, 2, 2, 3, 3][numChars];
   7191 
   7192         if (label === "widehat" || label === "widecheck") {
   7193           viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex];
   7194           viewBoxHeight = [0, 239, 300, 360, 420][imgIndex];
   7195           _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex];
   7196           pathName = label + imgIndex;
   7197         } else {
   7198           viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex];
   7199           viewBoxHeight = [0, 260, 286, 306, 312][imgIndex];
   7200           _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex];
   7201           pathName = "tilde" + imgIndex;
   7202         }
   7203       }
   7204 
   7205       var path = new PathNode(pathName);
   7206       var svgNode = new SvgNode([path], {
   7207         "width": "100%",
   7208         "height": _height + "em",
   7209         "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight,
   7210         "preserveAspectRatio": "none"
   7211       });
   7212       return {
   7213         span: buildCommon.makeSvgSpan([], [svgNode], options),
   7214         minWidth: 0,
   7215         height: _height
   7216       };
   7217     } else {
   7218       var spans = [];
   7219       var data = katexImagesData[label];
   7220       var paths = data[0],
   7221           _minWidth = data[1],
   7222           _viewBoxHeight = data[2];
   7223 
   7224       var _height2 = _viewBoxHeight / 1000;
   7225 
   7226       var numSvgChildren = paths.length;
   7227       var widthClasses;
   7228       var aligns;
   7229 
   7230       if (numSvgChildren === 1) {
   7231         // $FlowFixMe: All these cases must be of the 4-tuple type.
   7232         var align1 = data[3];
   7233         widthClasses = ["hide-tail"];
   7234         aligns = [align1];
   7235       } else if (numSvgChildren === 2) {
   7236         widthClasses = ["halfarrow-left", "halfarrow-right"];
   7237         aligns = ["xMinYMin", "xMaxYMin"];
   7238       } else if (numSvgChildren === 3) {
   7239         widthClasses = ["brace-left", "brace-center", "brace-right"];
   7240         aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"];
   7241       } else {
   7242         throw new Error("Correct katexImagesData or update code here to support\n                    " + numSvgChildren + " children.");
   7243       }
   7244 
   7245       for (var i = 0; i < numSvgChildren; i++) {
   7246         var _path = new PathNode(paths[i]);
   7247 
   7248         var _svgNode = new SvgNode([_path], {
   7249           "width": "400em",
   7250           "height": _height2 + "em",
   7251           "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight,
   7252           "preserveAspectRatio": aligns[i] + " slice"
   7253         });
   7254 
   7255         var _span = buildCommon.makeSvgSpan([widthClasses[i]], [_svgNode], options);
   7256 
   7257         if (numSvgChildren === 1) {
   7258           return {
   7259             span: _span,
   7260             minWidth: _minWidth,
   7261             height: _height2
   7262           };
   7263         } else {
   7264           _span.style.height = _height2 + "em";
   7265           spans.push(_span);
   7266         }
   7267       }
   7268 
   7269       return {
   7270         span: buildCommon.makeSpan(["stretchy"], spans, options),
   7271         minWidth: _minWidth,
   7272         height: _height2
   7273       };
   7274     }
   7275   } // buildSvgSpan_()
   7276 
   7277 
   7278   var _buildSvgSpan_ = buildSvgSpan_(),
   7279       span = _buildSvgSpan_.span,
   7280       minWidth = _buildSvgSpan_.minWidth,
   7281       height = _buildSvgSpan_.height; // Note that we are returning span.depth = 0.
   7282   // Any adjustments relative to the baseline must be done in buildHTML.
   7283 
   7284 
   7285   span.height = height;
   7286   span.style.height = height + "em";
   7287 
   7288   if (minWidth > 0) {
   7289     span.style.minWidth = minWidth + "em";
   7290   }
   7291 
   7292   return span;
   7293 };
   7294 
   7295 var encloseSpan = function encloseSpan(inner, label, topPad, bottomPad, options) {
   7296   // Return an image span for \cancel, \bcancel, \xcancel, \fbox, or \angl
   7297   var img;
   7298   var totalHeight = inner.height + inner.depth + topPad + bottomPad;
   7299 
   7300   if (/fbox|color|angl/.test(label)) {
   7301     img = buildCommon.makeSpan(["stretchy", label], [], options);
   7302 
   7303     if (label === "fbox") {
   7304       var color = options.color && options.getColor();
   7305 
   7306       if (color) {
   7307         img.style.borderColor = color;
   7308       }
   7309     }
   7310   } else {
   7311     // \cancel, \bcancel, or \xcancel
   7312     // Since \cancel's SVG is inline and it omits the viewBox attribute,
   7313     // its stroke-width will not vary with span area.
   7314     var lines = [];
   7315 
   7316     if (/^[bx]cancel$/.test(label)) {
   7317       lines.push(new LineNode({
   7318         "x1": "0",
   7319         "y1": "0",
   7320         "x2": "100%",
   7321         "y2": "100%",
   7322         "stroke-width": "0.046em"
   7323       }));
   7324     }
   7325 
   7326     if (/^x?cancel$/.test(label)) {
   7327       lines.push(new LineNode({
   7328         "x1": "0",
   7329         "y1": "100%",
   7330         "x2": "100%",
   7331         "y2": "0",
   7332         "stroke-width": "0.046em"
   7333       }));
   7334     }
   7335 
   7336     var svgNode = new SvgNode(lines, {
   7337       "width": "100%",
   7338       "height": totalHeight + "em"
   7339     });
   7340     img = buildCommon.makeSvgSpan([], [svgNode], options);
   7341   }
   7342 
   7343   img.height = totalHeight;
   7344   img.style.height = totalHeight + "em";
   7345   return img;
   7346 };
   7347 
   7348 /* harmony default export */ var stretchy = ({
   7349   encloseSpan: encloseSpan,
   7350   mathMLnode: mathMLnode,
   7351   svgSpan: svgSpan
   7352 });
   7353 ;// CONCATENATED MODULE: ./src/parseNode.js
   7354 
   7355 
   7356 /**
   7357  * Asserts that the node is of the given type and returns it with stricter
   7358  * typing. Throws if the node's type does not match.
   7359  */
   7360 function assertNodeType(node, type) {
   7361   if (!node || node.type !== type) {
   7362     throw new Error("Expected node of type " + type + ", but got " + (node ? "node of type " + node.type : String(node)));
   7363   } // $FlowFixMe, >=0.125
   7364 
   7365 
   7366   return node;
   7367 }
   7368 /**
   7369  * Returns the node more strictly typed iff it is of the given type. Otherwise,
   7370  * returns null.
   7371  */
   7372 
   7373 function assertSymbolNodeType(node) {
   7374   var typedNode = checkSymbolNodeType(node);
   7375 
   7376   if (!typedNode) {
   7377     throw new Error("Expected node of symbol group type, but got " + (node ? "node of type " + node.type : String(node)));
   7378   }
   7379 
   7380   return typedNode;
   7381 }
   7382 /**
   7383  * Returns the node more strictly typed iff it is of the given type. Otherwise,
   7384  * returns null.
   7385  */
   7386 
   7387 function checkSymbolNodeType(node) {
   7388   if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) {
   7389     // $FlowFixMe
   7390     return node;
   7391   }
   7392 
   7393   return null;
   7394 }
   7395 ;// CONCATENATED MODULE: ./src/functions/accent.js
   7396 
   7397 
   7398 
   7399 
   7400 
   7401 
   7402 
   7403 
   7404 
   7405 // NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but
   7406 // also "supsub" since an accent can affect super/subscripting.
   7407 var htmlBuilder = function htmlBuilder(grp, options) {
   7408   // Accents are handled in the TeXbook pg. 443, rule 12.
   7409   var base;
   7410   var group;
   7411   var supSubGroup;
   7412 
   7413   if (grp && grp.type === "supsub") {
   7414     // If our base is a character box, and we have superscripts and
   7415     // subscripts, the supsub will defer to us. In particular, we want
   7416     // to attach the superscripts and subscripts to the inner body (so
   7417     // that the position of the superscripts and subscripts won't be
   7418     // affected by the height of the accent). We accomplish this by
   7419     // sticking the base of the accent into the base of the supsub, and
   7420     // rendering that, while keeping track of where the accent is.
   7421     // The real accent group is the base of the supsub group
   7422     group = assertNodeType(grp.base, "accent"); // The character box is the base of the accent group
   7423 
   7424     base = group.base; // Stick the character box into the base of the supsub group
   7425 
   7426     grp.base = base; // Rerender the supsub group with its new base, and store that
   7427     // result.
   7428 
   7429     supSubGroup = assertSpan(buildGroup(grp, options)); // reset original base
   7430 
   7431     grp.base = group;
   7432   } else {
   7433     group = assertNodeType(grp, "accent");
   7434     base = group.base;
   7435   } // Build the base group
   7436 
   7437 
   7438   var body = buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character?
   7439 
   7440   var mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the
   7441   // nucleus is not a single character, let s = 0; otherwise set s to the
   7442   // kern amount for the nucleus followed by the \skewchar of its font."
   7443   // Note that our skew metrics are just the kern between each character
   7444   // and the skewchar.
   7445 
   7446   var skew = 0;
   7447 
   7448   if (mustShift) {
   7449     // If the base is a character box, then we want the skew of the
   7450     // innermost character. To do that, we find the innermost character:
   7451     var baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it
   7452 
   7453     var baseGroup = buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol.
   7454 
   7455     skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we
   7456     // removed with getBaseElem might contain things like \color which
   7457     // we can't get rid of.
   7458     // TODO(emily): Find a better way to get the skew
   7459   } // calculate the amount of space between the body and the accent
   7460 
   7461 
   7462   var clearance = Math.min(body.height, options.fontMetrics().xHeight); // Build the accent
   7463 
   7464   var accentBody;
   7465 
   7466   if (!group.isStretchy) {
   7467     var accent;
   7468     var width;
   7469 
   7470     if (group.label === "\\vec") {
   7471       // Before version 0.9, \vec used the combining font glyph U+20D7.
   7472       // But browsers, especially Safari, are not consistent in how they
   7473       // render combining characters when not preceded by a character.
   7474       // So now we use an SVG.
   7475       // If Safari reforms, we should consider reverting to the glyph.
   7476       accent = buildCommon.staticSvg("vec", options);
   7477       width = buildCommon.svgData.vec[1];
   7478     } else {
   7479       accent = buildCommon.makeOrd({
   7480         mode: group.mode,
   7481         text: group.label
   7482       }, options, "textord");
   7483       accent = assertSymbolDomNode(accent); // Remove the italic correction of the accent, because it only serves to
   7484       // shift the accent over to a place we don't want.
   7485 
   7486       accent.italic = 0;
   7487       width = accent.width;
   7488     }
   7489 
   7490     accentBody = buildCommon.makeSpan(["accent-body"], [accent]); // "Full" accents expand the width of the resulting symbol to be
   7491     // at least the width of the accent, and overlap directly onto the
   7492     // character without any vertical offset.
   7493 
   7494     var accentFull = group.label === "\\textcircled";
   7495 
   7496     if (accentFull) {
   7497       accentBody.classes.push('accent-full');
   7498       clearance = body.height;
   7499     } // Shift the accent over by the skew.
   7500 
   7501 
   7502     var left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }`
   7503     // so that the accent doesn't contribute to the bounding box.
   7504     // We need to shift the character by its width (effectively half
   7505     // its width) to compensate.
   7506 
   7507     if (!accentFull) {
   7508       left -= width / 2;
   7509     }
   7510 
   7511     accentBody.style.left = left + "em"; // \textcircled uses the \bigcirc glyph, so it needs some
   7512     // vertical adjustment to match LaTeX.
   7513 
   7514     if (group.label === "\\textcircled") {
   7515       accentBody.style.top = ".2em";
   7516     }
   7517 
   7518     accentBody = buildCommon.makeVList({
   7519       positionType: "firstBaseline",
   7520       children: [{
   7521         type: "elem",
   7522         elem: body
   7523       }, {
   7524         type: "kern",
   7525         size: -clearance
   7526       }, {
   7527         type: "elem",
   7528         elem: accentBody
   7529       }]
   7530     }, options);
   7531   } else {
   7532     accentBody = stretchy.svgSpan(group, options);
   7533     accentBody = buildCommon.makeVList({
   7534       positionType: "firstBaseline",
   7535       children: [{
   7536         type: "elem",
   7537         elem: body
   7538       }, {
   7539         type: "elem",
   7540         elem: accentBody,
   7541         wrapperClasses: ["svg-align"],
   7542         wrapperStyle: skew > 0 ? {
   7543           width: "calc(100% - " + 2 * skew + "em)",
   7544           marginLeft: 2 * skew + "em"
   7545         } : undefined
   7546       }]
   7547     }, options);
   7548   }
   7549 
   7550   var accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options);
   7551 
   7552   if (supSubGroup) {
   7553     // Here, we replace the "base" child of the supsub with our newly
   7554     // generated accent.
   7555     supSubGroup.children[0] = accentWrap; // Since we don't rerun the height calculation after replacing the
   7556     // accent, we manually recalculate height.
   7557 
   7558     supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); // Accents should always be ords, even when their innards are not.
   7559 
   7560     supSubGroup.classes[0] = "mord";
   7561     return supSubGroup;
   7562   } else {
   7563     return accentWrap;
   7564   }
   7565 };
   7566 
   7567 var mathmlBuilder = function mathmlBuilder(group, options) {
   7568   var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]);
   7569   var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.base, options), accentNode]);
   7570   node.setAttribute("accent", "true");
   7571   return node;
   7572 };
   7573 
   7574 var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map(function (accent) {
   7575   return "\\" + accent;
   7576 }).join("|")); // Accents
   7577 
   7578 defineFunction({
   7579   type: "accent",
   7580   names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"],
   7581   props: {
   7582     numArgs: 1
   7583   },
   7584   handler: function handler(context, args) {
   7585     var base = normalizeArgument(args[0]);
   7586     var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);
   7587     var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck";
   7588     return {
   7589       type: "accent",
   7590       mode: context.parser.mode,
   7591       label: context.funcName,
   7592       isStretchy: isStretchy,
   7593       isShifty: isShifty,
   7594       base: base
   7595     };
   7596   },
   7597   htmlBuilder: htmlBuilder,
   7598   mathmlBuilder: mathmlBuilder
   7599 }); // Text-mode accents
   7600 
   7601 defineFunction({
   7602   type: "accent",
   7603   names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v", "\\textcircled"],
   7604   props: {
   7605     numArgs: 1,
   7606     allowedInText: true,
   7607     allowedInMath: false,
   7608     argTypes: ["primitive"]
   7609   },
   7610   handler: function handler(context, args) {
   7611     var base = args[0];
   7612     return {
   7613       type: "accent",
   7614       mode: context.parser.mode,
   7615       label: context.funcName,
   7616       isStretchy: false,
   7617       isShifty: true,
   7618       base: base
   7619     };
   7620   },
   7621   htmlBuilder: htmlBuilder,
   7622   mathmlBuilder: mathmlBuilder
   7623 });
   7624 ;// CONCATENATED MODULE: ./src/functions/accentunder.js
   7625 // Horizontal overlap functions
   7626 
   7627 
   7628 
   7629 
   7630 
   7631 
   7632 defineFunction({
   7633   type: "accentUnder",
   7634   names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
   7635   props: {
   7636     numArgs: 1
   7637   },
   7638   handler: function handler(_ref, args) {
   7639     var parser = _ref.parser,
   7640         funcName = _ref.funcName;
   7641     var base = args[0];
   7642     return {
   7643       type: "accentUnder",
   7644       mode: parser.mode,
   7645       label: funcName,
   7646       base: base
   7647     };
   7648   },
   7649   htmlBuilder: function htmlBuilder(group, options) {
   7650     // Treat under accents much like underlines.
   7651     var innerGroup = buildGroup(group.base, options);
   7652     var accentBody = stretchy.svgSpan(group, options);
   7653     var kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns
   7654 
   7655     var vlist = buildCommon.makeVList({
   7656       positionType: "top",
   7657       positionData: innerGroup.height,
   7658       children: [{
   7659         type: "elem",
   7660         elem: accentBody,
   7661         wrapperClasses: ["svg-align"]
   7662       }, {
   7663         type: "kern",
   7664         size: kern
   7665       }, {
   7666         type: "elem",
   7667         elem: innerGroup
   7668       }]
   7669     }, options);
   7670     return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options);
   7671   },
   7672   mathmlBuilder: function mathmlBuilder(group, options) {
   7673     var accentNode = stretchy.mathMLnode(group.label);
   7674     var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.base, options), accentNode]);
   7675     node.setAttribute("accentunder", "true");
   7676     return node;
   7677   }
   7678 });
   7679 ;// CONCATENATED MODULE: ./src/functions/arrow.js
   7680 
   7681 
   7682 
   7683 
   7684 
   7685 
   7686 
   7687 // Helper function
   7688 var paddedNode = function paddedNode(group) {
   7689   var node = new mathMLTree.MathNode("mpadded", group ? [group] : []);
   7690   node.setAttribute("width", "+0.6em");
   7691   node.setAttribute("lspace", "0.3em");
   7692   return node;
   7693 }; // Stretchy arrows with an optional argument
   7694 
   7695 
   7696 defineFunction({
   7697   type: "xArrow",
   7698   names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension.
   7699   // Direct use of these functions is discouraged and may break someday.
   7700   "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium", // The next 3 functions are here only to support the {CD} environment.
   7701   "\\\\cdrightarrow", "\\\\cdleftarrow", "\\\\cdlongequal"],
   7702   props: {
   7703     numArgs: 1,
   7704     numOptionalArgs: 1
   7705   },
   7706   handler: function handler(_ref, args, optArgs) {
   7707     var parser = _ref.parser,
   7708         funcName = _ref.funcName;
   7709     return {
   7710       type: "xArrow",
   7711       mode: parser.mode,
   7712       label: funcName,
   7713       body: args[0],
   7714       below: optArgs[0]
   7715     };
   7716   },
   7717   // Flow is unable to correctly infer the type of `group`, even though it's
   7718   // unamibiguously determined from the passed-in `type` above.
   7719   htmlBuilder: function htmlBuilder(group, options) {
   7720     var style = options.style; // Build the argument groups in the appropriate style.
   7721     // Ref: amsmath.dtx:   \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%
   7722     // Some groups can return document fragments.  Handle those by wrapping
   7723     // them in a span.
   7724 
   7725     var newOptions = options.havingStyle(style.sup());
   7726     var upperGroup = buildCommon.wrapFragment(buildGroup(group.body, newOptions, options), options);
   7727     var arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd";
   7728     upperGroup.classes.push(arrowPrefix + "-arrow-pad");
   7729     var lowerGroup;
   7730 
   7731     if (group.below) {
   7732       // Build the lower group
   7733       newOptions = options.havingStyle(style.sub());
   7734       lowerGroup = buildCommon.wrapFragment(buildGroup(group.below, newOptions, options), options);
   7735       lowerGroup.classes.push(arrowPrefix + "-arrow-pad");
   7736     }
   7737 
   7738     var arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0.
   7739     // The point we want on the math axis is at 0.5 * arrowBody.height.
   7740 
   7741     var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi
   7742 
   7743     var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu
   7744 
   7745     if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") {
   7746       upperShift -= upperGroup.depth; // shift up if depth encroaches
   7747     } // Generate the vlist
   7748 
   7749 
   7750     var vlist;
   7751 
   7752     if (lowerGroup) {
   7753       var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;
   7754       vlist = buildCommon.makeVList({
   7755         positionType: "individualShift",
   7756         children: [{
   7757           type: "elem",
   7758           elem: upperGroup,
   7759           shift: upperShift
   7760         }, {
   7761           type: "elem",
   7762           elem: arrowBody,
   7763           shift: arrowShift
   7764         }, {
   7765           type: "elem",
   7766           elem: lowerGroup,
   7767           shift: lowerShift
   7768         }]
   7769       }, options);
   7770     } else {
   7771       vlist = buildCommon.makeVList({
   7772         positionType: "individualShift",
   7773         children: [{
   7774           type: "elem",
   7775           elem: upperGroup,
   7776           shift: upperShift
   7777         }, {
   7778           type: "elem",
   7779           elem: arrowBody,
   7780           shift: arrowShift
   7781         }]
   7782       }, options);
   7783     } // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
   7784 
   7785 
   7786     vlist.children[0].children[0].children[1].classes.push("svg-align");
   7787     return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options);
   7788   },
   7789   mathmlBuilder: function mathmlBuilder(group, options) {
   7790     var arrowNode = stretchy.mathMLnode(group.label);
   7791     arrowNode.setAttribute("minsize", group.label.charAt(0) === "x" ? "1.75em" : "3.0em");
   7792     var node;
   7793 
   7794     if (group.body) {
   7795       var upperNode = paddedNode(buildMathML_buildGroup(group.body, options));
   7796 
   7797       if (group.below) {
   7798         var lowerNode = paddedNode(buildMathML_buildGroup(group.below, options));
   7799         node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]);
   7800       } else {
   7801         node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]);
   7802       }
   7803     } else if (group.below) {
   7804       var _lowerNode = paddedNode(buildMathML_buildGroup(group.below, options));
   7805 
   7806       node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]);
   7807     } else {
   7808       // This should never happen.
   7809       // Parser.js throws an error if there is no argument.
   7810       node = paddedNode();
   7811       node = new mathMLTree.MathNode("mover", [arrowNode, node]);
   7812     }
   7813 
   7814     return node;
   7815   }
   7816 });
   7817 ;// CONCATENATED MODULE: ./src/environments/cd.js
   7818 
   7819 
   7820 
   7821 
   7822 
   7823 
   7824 
   7825 var cdArrowFunctionName = {
   7826   ">": "\\\\cdrightarrow",
   7827   "<": "\\\\cdleftarrow",
   7828   "=": "\\\\cdlongequal",
   7829   "A": "\\uparrow",
   7830   "V": "\\downarrow",
   7831   "|": "\\Vert",
   7832   ".": "no arrow"
   7833 };
   7834 
   7835 var newCell = function newCell() {
   7836   // Create an empty cell, to be filled below with parse nodes.
   7837   // The parseTree from this module must be constructed like the
   7838   // one created by parseArray(), so an empty CD cell must
   7839   // be a ParseNode<"styling">. And CD is always displaystyle.
   7840   // So these values are fixed and flow can do implicit typing.
   7841   return {
   7842     type: "styling",
   7843     body: [],
   7844     mode: "math",
   7845     style: "display"
   7846   };
   7847 };
   7848 
   7849 var isStartOfArrow = function isStartOfArrow(node) {
   7850   return node.type === "textord" && node.text === "@";
   7851 };
   7852 
   7853 var isLabelEnd = function isLabelEnd(node, endChar) {
   7854   return (node.type === "mathord" || node.type === "atom") && node.text === endChar;
   7855 };
   7856 
   7857 function cdArrow(arrowChar, labels, parser) {
   7858   // Return a parse tree of an arrow and its labels.
   7859   // This acts in a way similar to a macro expansion.
   7860   var funcName = cdArrowFunctionName[arrowChar];
   7861 
   7862   switch (funcName) {
   7863     case "\\\\cdrightarrow":
   7864     case "\\\\cdleftarrow":
   7865       return parser.callFunction(funcName, [labels[0]], [labels[1]]);
   7866 
   7867     case "\\uparrow":
   7868     case "\\downarrow":
   7869       {
   7870         var leftLabel = parser.callFunction("\\\\cdleft", [labels[0]], []);
   7871         var bareArrow = {
   7872           type: "atom",
   7873           text: funcName,
   7874           mode: "math",
   7875           family: "rel"
   7876         };
   7877         var sizedArrow = parser.callFunction("\\Big", [bareArrow], []);
   7878         var rightLabel = parser.callFunction("\\\\cdright", [labels[1]], []);
   7879         var arrowGroup = {
   7880           type: "ordgroup",
   7881           mode: "math",
   7882           body: [leftLabel, sizedArrow, rightLabel]
   7883         };
   7884         return parser.callFunction("\\\\cdparent", [arrowGroup], []);
   7885       }
   7886 
   7887     case "\\\\cdlongequal":
   7888       return parser.callFunction("\\\\cdlongequal", [], []);
   7889 
   7890     case "\\Vert":
   7891       {
   7892         var arrow = {
   7893           type: "textord",
   7894           text: "\\Vert",
   7895           mode: "math"
   7896         };
   7897         return parser.callFunction("\\Big", [arrow], []);
   7898       }
   7899 
   7900     default:
   7901       return {
   7902         type: "textord",
   7903         text: " ",
   7904         mode: "math"
   7905       };
   7906   }
   7907 }
   7908 
   7909 function parseCD(parser) {
   7910   // Get the array's parse nodes with \\ temporarily mapped to \cr.
   7911   var parsedRows = [];
   7912   parser.gullet.beginGroup();
   7913   parser.gullet.macros.set("\\cr", "\\\\\\relax");
   7914   parser.gullet.beginGroup();
   7915 
   7916   while (true) {
   7917     // eslint-disable-line no-constant-condition
   7918     // Get the parse nodes for the next row.
   7919     parsedRows.push(parser.parseExpression(false, "\\\\"));
   7920     parser.gullet.endGroup();
   7921     parser.gullet.beginGroup();
   7922     var next = parser.fetch().text;
   7923 
   7924     if (next === "&" || next === "\\\\") {
   7925       parser.consume();
   7926     } else if (next === "\\end") {
   7927       if (parsedRows[parsedRows.length - 1].length === 0) {
   7928         parsedRows.pop(); // final row ended in \\
   7929       }
   7930 
   7931       break;
   7932     } else {
   7933       throw new src_ParseError("Expected \\\\ or \\cr or \\end", parser.nextToken);
   7934     }
   7935   }
   7936 
   7937   var row = [];
   7938   var body = [row]; // Loop thru the parse nodes. Collect them into cells and arrows.
   7939 
   7940   for (var i = 0; i < parsedRows.length; i++) {
   7941     // Start a new row.
   7942     var rowNodes = parsedRows[i]; // Create the first cell.
   7943 
   7944     var cell = newCell();
   7945 
   7946     for (var j = 0; j < rowNodes.length; j++) {
   7947       if (!isStartOfArrow(rowNodes[j])) {
   7948         // If a parseNode is not an arrow, it goes into a cell.
   7949         cell.body.push(rowNodes[j]);
   7950       } else {
   7951         // Parse node j is an "@", the start of an arrow.
   7952         // Before starting on the arrow, push the cell into `row`.
   7953         row.push(cell); // Now collect parseNodes into an arrow.
   7954         // The character after "@" defines the arrow type.
   7955 
   7956         j += 1;
   7957         var arrowChar = assertSymbolNodeType(rowNodes[j]).text; // Create two empty label nodes. We may or may not use them.
   7958 
   7959         var labels = new Array(2);
   7960         labels[0] = {
   7961           type: "ordgroup",
   7962           mode: "math",
   7963           body: []
   7964         };
   7965         labels[1] = {
   7966           type: "ordgroup",
   7967           mode: "math",
   7968           body: []
   7969         }; // Process the arrow.
   7970 
   7971         if ("=|.".indexOf(arrowChar) > -1) {// Three "arrows", ``@=`, `@|`, and `@.`, do not take labels.
   7972           // Do nothing here.
   7973         } else if ("<>AV".indexOf(arrowChar) > -1) {
   7974           // Four arrows, `@>>>`, `@<<<`, `@AAA`, and `@VVV`, each take
   7975           // two optional labels. E.g. the right-point arrow syntax is
   7976           // really:  @>{optional label}>{optional label}>
   7977           // Collect parseNodes into labels.
   7978           for (var labelNum = 0; labelNum < 2; labelNum++) {
   7979             var inLabel = true;
   7980 
   7981             for (var k = j + 1; k < rowNodes.length; k++) {
   7982               if (isLabelEnd(rowNodes[k], arrowChar)) {
   7983                 inLabel = false;
   7984                 j = k;
   7985                 break;
   7986               }
   7987 
   7988               if (isStartOfArrow(rowNodes[k])) {
   7989                 throw new src_ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[k]);
   7990               }
   7991 
   7992               labels[labelNum].body.push(rowNodes[k]);
   7993             }
   7994 
   7995             if (inLabel) {
   7996               // isLabelEnd never returned a true.
   7997               throw new src_ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[j]);
   7998             }
   7999           }
   8000         } else {
   8001           throw new src_ParseError("Expected one of \"<>AV=|.\" after @", rowNodes[j]);
   8002         } // Now join the arrow to its labels.
   8003 
   8004 
   8005         var arrow = cdArrow(arrowChar, labels, parser); // Wrap the arrow in  ParseNode<"styling">.
   8006         // This is done to match parseArray() behavior.
   8007 
   8008         var wrappedArrow = {
   8009           type: "styling",
   8010           body: [arrow],
   8011           mode: "math",
   8012           style: "display" // CD is always displaystyle.
   8013 
   8014         };
   8015         row.push(wrappedArrow); // In CD's syntax, cells are implicit. That is, everything that
   8016         // is not an arrow gets collected into a cell. So create an empty
   8017         // cell now. It will collect upcoming parseNodes.
   8018 
   8019         cell = newCell();
   8020       }
   8021     }
   8022 
   8023     if (i % 2 === 0) {
   8024       // Even-numbered rows consist of: cell, arrow, cell, arrow, ... cell
   8025       // The last cell is not yet pushed into `row`, so:
   8026       row.push(cell);
   8027     } else {
   8028       // Odd-numbered rows consist of: vert arrow, empty cell, ... vert arrow
   8029       // Remove the empty cell that was placed at the beginning of `row`.
   8030       row.shift();
   8031     }
   8032 
   8033     row = [];
   8034     body.push(row);
   8035   } // End row group
   8036 
   8037 
   8038   parser.gullet.endGroup(); // End array group defining \\
   8039 
   8040   parser.gullet.endGroup(); // define column separation.
   8041 
   8042   var cols = new Array(body[0].length).fill({
   8043     type: "align",
   8044     align: "c",
   8045     pregap: 0.25,
   8046     // CD package sets \enskip between columns.
   8047     postgap: 0.25 // So pre and post each get half an \enskip, i.e. 0.25em.
   8048 
   8049   });
   8050   return {
   8051     type: "array",
   8052     mode: "math",
   8053     body: body,
   8054     arraystretch: 1,
   8055     addJot: true,
   8056     rowGaps: [null],
   8057     cols: cols,
   8058     colSeparationType: "CD",
   8059     hLinesBeforeRow: new Array(body.length + 1).fill([])
   8060   };
   8061 } // The functions below are not available for general use.
   8062 // They are here only for internal use by the {CD} environment in placing labels
   8063 // next to vertical arrows.
   8064 // We don't need any such functions for horizontal arrows because we can reuse
   8065 // the functionality that already exists for extensible arrows.
   8066 
   8067 defineFunction({
   8068   type: "cdlabel",
   8069   names: ["\\\\cdleft", "\\\\cdright"],
   8070   props: {
   8071     numArgs: 1
   8072   },
   8073   handler: function handler(_ref, args) {
   8074     var parser = _ref.parser,
   8075         funcName = _ref.funcName;
   8076     return {
   8077       type: "cdlabel",
   8078       mode: parser.mode,
   8079       side: funcName.slice(4),
   8080       label: args[0]
   8081     };
   8082   },
   8083   htmlBuilder: function htmlBuilder(group, options) {
   8084     var newOptions = options.havingStyle(options.style.sup());
   8085     var label = buildCommon.wrapFragment(buildGroup(group.label, newOptions, options), options);
   8086     label.classes.push("cd-label-" + group.side);
   8087     label.style.bottom = 0.8 - label.depth + "em"; // Zero out label height & depth, so vertical align of arrow is set
   8088     // by the arrow height, not by the label.
   8089 
   8090     label.height = 0;
   8091     label.depth = 0;
   8092     return label;
   8093   },
   8094   mathmlBuilder: function mathmlBuilder(group, options) {
   8095     var label = new mathMLTree.MathNode("mrow", [buildMathML_buildGroup(group.label, options)]);
   8096     label = new mathMLTree.MathNode("mpadded", [label]);
   8097     label.setAttribute("width", "0");
   8098 
   8099     if (group.side === "left") {
   8100       label.setAttribute("lspace", "-1width");
   8101     } // We have to guess at vertical alignment. We know the arrow is 1.8em tall,
   8102     // But we don't know the height or depth of the label.
   8103 
   8104 
   8105     label.setAttribute("voffset", "0.7em");
   8106     label = new mathMLTree.MathNode("mstyle", [label]);
   8107     label.setAttribute("displaystyle", "false");
   8108     label.setAttribute("scriptlevel", "1");
   8109     return label;
   8110   }
   8111 });
   8112 defineFunction({
   8113   type: "cdlabelparent",
   8114   names: ["\\\\cdparent"],
   8115   props: {
   8116     numArgs: 1
   8117   },
   8118   handler: function handler(_ref2, args) {
   8119     var parser = _ref2.parser;
   8120     return {
   8121       type: "cdlabelparent",
   8122       mode: parser.mode,
   8123       fragment: args[0]
   8124     };
   8125   },
   8126   htmlBuilder: function htmlBuilder(group, options) {
   8127     // Wrap the vertical arrow and its labels.
   8128     // The parent gets position: relative. The child gets position: absolute.
   8129     // So CSS can locate the label correctly.
   8130     var parent = buildCommon.wrapFragment(buildGroup(group.fragment, options), options);
   8131     parent.classes.push("cd-vert-arrow");
   8132     return parent;
   8133   },
   8134   mathmlBuilder: function mathmlBuilder(group, options) {
   8135     return new mathMLTree.MathNode("mrow", [buildMathML_buildGroup(group.fragment, options)]);
   8136   }
   8137 });
   8138 ;// CONCATENATED MODULE: ./src/functions/char.js
   8139 
   8140 
   8141  // \@char is an internal function that takes a grouped decimal argument like
   8142 // {123} and converts into symbol with code 123.  It is used by the *macro*
   8143 // \char defined in macros.js.
   8144 
   8145 defineFunction({
   8146   type: "textord",
   8147   names: ["\\@char"],
   8148   props: {
   8149     numArgs: 1,
   8150     allowedInText: true
   8151   },
   8152   handler: function handler(_ref, args) {
   8153     var parser = _ref.parser;
   8154     var arg = assertNodeType(args[0], "ordgroup");
   8155     var group = arg.body;
   8156     var number = "";
   8157 
   8158     for (var i = 0; i < group.length; i++) {
   8159       var node = assertNodeType(group[i], "textord");
   8160       number += node.text;
   8161     }
   8162 
   8163     var code = parseInt(number);
   8164 
   8165     if (isNaN(code)) {
   8166       throw new src_ParseError("\\@char has non-numeric argument " + number);
   8167     }
   8168 
   8169     return {
   8170       type: "textord",
   8171       mode: parser.mode,
   8172       text: String.fromCharCode(code)
   8173     };
   8174   }
   8175 });
   8176 ;// CONCATENATED MODULE: ./src/functions/color.js
   8177 
   8178 
   8179 
   8180 
   8181 
   8182 
   8183 
   8184 var color_htmlBuilder = function htmlBuilder(group, options) {
   8185   var elements = buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains.
   8186   // To accomplish this, we wrap the results in a fragment, so the inner
   8187   // elements will be able to directly interact with their neighbors. For
   8188   // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3`
   8189 
   8190   return buildCommon.makeFragment(elements);
   8191 };
   8192 
   8193 var color_mathmlBuilder = function mathmlBuilder(group, options) {
   8194   var inner = buildMathML_buildExpression(group.body, options.withColor(group.color));
   8195   var node = new mathMLTree.MathNode("mstyle", inner);
   8196   node.setAttribute("mathcolor", group.color);
   8197   return node;
   8198 };
   8199 
   8200 defineFunction({
   8201   type: "color",
   8202   names: ["\\textcolor"],
   8203   props: {
   8204     numArgs: 2,
   8205     allowedInText: true,
   8206     argTypes: ["color", "original"]
   8207   },
   8208   handler: function handler(_ref, args) {
   8209     var parser = _ref.parser;
   8210     var color = assertNodeType(args[0], "color-token").color;
   8211     var body = args[1];
   8212     return {
   8213       type: "color",
   8214       mode: parser.mode,
   8215       color: color,
   8216       body: ordargument(body)
   8217     };
   8218   },
   8219   htmlBuilder: color_htmlBuilder,
   8220   mathmlBuilder: color_mathmlBuilder
   8221 });
   8222 defineFunction({
   8223   type: "color",
   8224   names: ["\\color"],
   8225   props: {
   8226     numArgs: 1,
   8227     allowedInText: true,
   8228     argTypes: ["color"]
   8229   },
   8230   handler: function handler(_ref2, args) {
   8231     var parser = _ref2.parser,
   8232         breakOnTokenText = _ref2.breakOnTokenText;
   8233     var color = assertNodeType(args[0], "color-token").color; // Set macro \current@color in current namespace to store the current
   8234     // color, mimicking the behavior of color.sty.
   8235     // This is currently used just to correctly color a \right
   8236     // that follows a \color command.
   8237 
   8238     parser.gullet.macros.set("\\current@color", color); // Parse out the implicit body that should be colored.
   8239 
   8240     var body = parser.parseExpression(true, breakOnTokenText);
   8241     return {
   8242       type: "color",
   8243       mode: parser.mode,
   8244       color: color,
   8245       body: body
   8246     };
   8247   },
   8248   htmlBuilder: color_htmlBuilder,
   8249   mathmlBuilder: color_mathmlBuilder
   8250 });
   8251 ;// CONCATENATED MODULE: ./src/functions/cr.js
   8252 // Row breaks within tabular environments, and line breaks at top level
   8253 
   8254 
   8255 
   8256 
   8257  // \DeclareRobustCommand\\{...\@xnewline}
   8258 
   8259 defineFunction({
   8260   type: "cr",
   8261   names: ["\\\\"],
   8262   props: {
   8263     numArgs: 0,
   8264     numOptionalArgs: 1,
   8265     argTypes: ["size"],
   8266     allowedInText: true
   8267   },
   8268   handler: function handler(_ref, args, optArgs) {
   8269     var parser = _ref.parser;
   8270     var size = optArgs[0];
   8271     var newLine = !parser.settings.displayMode || !parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode");
   8272     return {
   8273       type: "cr",
   8274       mode: parser.mode,
   8275       newLine: newLine,
   8276       size: size && assertNodeType(size, "size").value
   8277     };
   8278   },
   8279   // The following builders are called only at the top level,
   8280   // not within tabular/array environments.
   8281   htmlBuilder: function htmlBuilder(group, options) {
   8282     var span = buildCommon.makeSpan(["mspace"], [], options);
   8283 
   8284     if (group.newLine) {
   8285       span.classes.push("newline");
   8286 
   8287       if (group.size) {
   8288         span.style.marginTop = calculateSize(group.size, options) + "em";
   8289       }
   8290     }
   8291 
   8292     return span;
   8293   },
   8294   mathmlBuilder: function mathmlBuilder(group, options) {
   8295     var node = new mathMLTree.MathNode("mspace");
   8296 
   8297     if (group.newLine) {
   8298       node.setAttribute("linebreak", "newline");
   8299 
   8300       if (group.size) {
   8301         node.setAttribute("height", calculateSize(group.size, options) + "em");
   8302       }
   8303     }
   8304 
   8305     return node;
   8306   }
   8307 });
   8308 ;// CONCATENATED MODULE: ./src/functions/def.js
   8309 
   8310 
   8311 
   8312 var globalMap = {
   8313   "\\global": "\\global",
   8314   "\\long": "\\\\globallong",
   8315   "\\\\globallong": "\\\\globallong",
   8316   "\\def": "\\gdef",
   8317   "\\gdef": "\\gdef",
   8318   "\\edef": "\\xdef",
   8319   "\\xdef": "\\xdef",
   8320   "\\let": "\\\\globallet",
   8321   "\\futurelet": "\\\\globalfuture"
   8322 };
   8323 
   8324 var checkControlSequence = function checkControlSequence(tok) {
   8325   var name = tok.text;
   8326 
   8327   if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
   8328     throw new src_ParseError("Expected a control sequence", tok);
   8329   }
   8330 
   8331   return name;
   8332 };
   8333 
   8334 var getRHS = function getRHS(parser) {
   8335   var tok = parser.gullet.popToken();
   8336 
   8337   if (tok.text === "=") {
   8338     // consume optional equals
   8339     tok = parser.gullet.popToken();
   8340 
   8341     if (tok.text === " ") {
   8342       // consume one optional space
   8343       tok = parser.gullet.popToken();
   8344     }
   8345   }
   8346 
   8347   return tok;
   8348 };
   8349 
   8350 var letCommand = function letCommand(parser, name, tok, global) {
   8351   var macro = parser.gullet.macros.get(tok.text);
   8352 
   8353   if (macro == null) {
   8354     // don't expand it later even if a macro with the same name is defined
   8355     // e.g., \let\foo=\frac \def\frac{\relax} \frac12
   8356     tok.noexpand = true;
   8357     macro = {
   8358       tokens: [tok],
   8359       numArgs: 0,
   8360       // reproduce the same behavior in expansion
   8361       unexpandable: !parser.gullet.isExpandable(tok.text)
   8362     };
   8363   }
   8364 
   8365   parser.gullet.macros.set(name, macro, global);
   8366 }; // <assignment> -> <non-macro assignment>|<macro assignment>
   8367 // <non-macro assignment> -> <simple assignment>|\global<non-macro assignment>
   8368 // <macro assignment> -> <definition>|<prefix><macro assignment>
   8369 // <prefix> -> \global|\long|\outer
   8370 
   8371 
   8372 defineFunction({
   8373   type: "internal",
   8374   names: ["\\global", "\\long", "\\\\globallong" // can’t be entered directly
   8375   ],
   8376   props: {
   8377     numArgs: 0,
   8378     allowedInText: true
   8379   },
   8380   handler: function handler(_ref) {
   8381     var parser = _ref.parser,
   8382         funcName = _ref.funcName;
   8383     parser.consumeSpaces();
   8384     var token = parser.fetch();
   8385 
   8386     if (globalMap[token.text]) {
   8387       // KaTeX doesn't have \par, so ignore \long
   8388       if (funcName === "\\global" || funcName === "\\\\globallong") {
   8389         token.text = globalMap[token.text];
   8390       }
   8391 
   8392       return assertNodeType(parser.parseFunction(), "internal");
   8393     }
   8394 
   8395     throw new src_ParseError("Invalid token after macro prefix", token);
   8396   }
   8397 }); // Basic support for macro definitions: \def, \gdef, \edef, \xdef
   8398 // <definition> -> <def><control sequence><definition text>
   8399 // <def> -> \def|\gdef|\edef|\xdef
   8400 // <definition text> -> <parameter text><left brace><balanced text><right brace>
   8401 
   8402 defineFunction({
   8403   type: "internal",
   8404   names: ["\\def", "\\gdef", "\\edef", "\\xdef"],
   8405   props: {
   8406     numArgs: 0,
   8407     allowedInText: true,
   8408     primitive: true
   8409   },
   8410   handler: function handler(_ref2) {
   8411     var parser = _ref2.parser,
   8412         funcName = _ref2.funcName;
   8413     var tok = parser.gullet.popToken();
   8414     var name = tok.text;
   8415 
   8416     if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
   8417       throw new src_ParseError("Expected a control sequence", tok);
   8418     }
   8419 
   8420     var numArgs = 0;
   8421     var insert;
   8422     var delimiters = [[]]; // <parameter text> contains no braces
   8423 
   8424     while (parser.gullet.future().text !== "{") {
   8425       tok = parser.gullet.popToken();
   8426 
   8427       if (tok.text === "#") {
   8428         // If the very last character of the <parameter text> is #, so that
   8429         // this # is immediately followed by {, TeX will behave as if the {
   8430         // had been inserted at the right end of both the parameter text
   8431         // and the replacement text.
   8432         if (parser.gullet.future().text === "{") {
   8433           insert = parser.gullet.future();
   8434           delimiters[numArgs].push("{");
   8435           break;
   8436         } // A parameter, the first appearance of # must be followed by 1,
   8437         // the next by 2, and so on; up to nine #’s are allowed
   8438 
   8439 
   8440         tok = parser.gullet.popToken();
   8441 
   8442         if (!/^[1-9]$/.test(tok.text)) {
   8443           throw new src_ParseError("Invalid argument number \"" + tok.text + "\"");
   8444         }
   8445 
   8446         if (parseInt(tok.text) !== numArgs + 1) {
   8447           throw new src_ParseError("Argument number \"" + tok.text + "\" out of order");
   8448         }
   8449 
   8450         numArgs++;
   8451         delimiters.push([]);
   8452       } else if (tok.text === "EOF") {
   8453         throw new src_ParseError("Expected a macro definition");
   8454       } else {
   8455         delimiters[numArgs].push(tok.text);
   8456       }
   8457     } // replacement text, enclosed in '{' and '}' and properly nested
   8458 
   8459 
   8460     var _parser$gullet$consum = parser.gullet.consumeArg(),
   8461         tokens = _parser$gullet$consum.tokens;
   8462 
   8463     if (insert) {
   8464       tokens.unshift(insert);
   8465     }
   8466 
   8467     if (funcName === "\\edef" || funcName === "\\xdef") {
   8468       tokens = parser.gullet.expandTokens(tokens);
   8469       tokens.reverse(); // to fit in with stack order
   8470     } // Final arg is the expansion of the macro
   8471 
   8472 
   8473     parser.gullet.macros.set(name, {
   8474       tokens: tokens,
   8475       numArgs: numArgs,
   8476       delimiters: delimiters
   8477     }, funcName === globalMap[funcName]);
   8478     return {
   8479       type: "internal",
   8480       mode: parser.mode
   8481     };
   8482   }
   8483 }); // <simple assignment> -> <let assignment>
   8484 // <let assignment> -> \futurelet<control sequence><token><token>
   8485 //     | \let<control sequence><equals><one optional space><token>
   8486 // <equals> -> <optional spaces>|<optional spaces>=
   8487 
   8488 defineFunction({
   8489   type: "internal",
   8490   names: ["\\let", "\\\\globallet" // can’t be entered directly
   8491   ],
   8492   props: {
   8493     numArgs: 0,
   8494     allowedInText: true,
   8495     primitive: true
   8496   },
   8497   handler: function handler(_ref3) {
   8498     var parser = _ref3.parser,
   8499         funcName = _ref3.funcName;
   8500     var name = checkControlSequence(parser.gullet.popToken());
   8501     parser.gullet.consumeSpaces();
   8502     var tok = getRHS(parser);
   8503     letCommand(parser, name, tok, funcName === "\\\\globallet");
   8504     return {
   8505       type: "internal",
   8506       mode: parser.mode
   8507     };
   8508   }
   8509 }); // ref: https://www.tug.org/TUGboat/tb09-3/tb22bechtolsheim.pdf
   8510 
   8511 defineFunction({
   8512   type: "internal",
   8513   names: ["\\futurelet", "\\\\globalfuture" // can’t be entered directly
   8514   ],
   8515   props: {
   8516     numArgs: 0,
   8517     allowedInText: true,
   8518     primitive: true
   8519   },
   8520   handler: function handler(_ref4) {
   8521     var parser = _ref4.parser,
   8522         funcName = _ref4.funcName;
   8523     var name = checkControlSequence(parser.gullet.popToken());
   8524     var middle = parser.gullet.popToken();
   8525     var tok = parser.gullet.popToken();
   8526     letCommand(parser, name, tok, funcName === "\\\\globalfuture");
   8527     parser.gullet.pushToken(tok);
   8528     parser.gullet.pushToken(middle);
   8529     return {
   8530       type: "internal",
   8531       mode: parser.mode
   8532     };
   8533   }
   8534 });
   8535 ;// CONCATENATED MODULE: ./src/delimiter.js
   8536 /**
   8537  * This file deals with creating delimiters of various sizes. The TeXbook
   8538  * discusses these routines on page 441-442, in the "Another subroutine sets box
   8539  * x to a specified variable delimiter" paragraph.
   8540  *
   8541  * There are three main routines here. `makeSmallDelim` makes a delimiter in the
   8542  * normal font, but in either text, script, or scriptscript style.
   8543  * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1,
   8544  * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of
   8545  * smaller pieces that are stacked on top of one another.
   8546  *
   8547  * The functions take a parameter `center`, which determines if the delimiter
   8548  * should be centered around the axis.
   8549  *
   8550  * Then, there are three exposed functions. `sizedDelim` makes a delimiter in
   8551  * one of the given sizes. This is used for things like `\bigl`.
   8552  * `customSizedDelim` makes a delimiter with a given total height+depth. It is
   8553  * called in places like `\sqrt`. `leftRightDelim` makes an appropriate
   8554  * delimiter which surrounds an expression of a given height an depth. It is
   8555  * used in `\left` and `\right`.
   8556  */
   8557 
   8558 
   8559 
   8560 
   8561 
   8562 
   8563 
   8564 
   8565 
   8566 
   8567 /**
   8568  * Get the metrics for a given symbol and font, after transformation (i.e.
   8569  * after following replacement from symbols.js)
   8570  */
   8571 var getMetrics = function getMetrics(symbol, font, mode) {
   8572   var replace = src_symbols.math[symbol] && src_symbols.math[symbol].replace;
   8573   var metrics = getCharacterMetrics(replace || symbol, font, mode);
   8574 
   8575   if (!metrics) {
   8576     throw new Error("Unsupported symbol " + symbol + " and font size " + font + ".");
   8577   }
   8578 
   8579   return metrics;
   8580 };
   8581 /**
   8582  * Puts a delimiter span in a given style, and adds appropriate height, depth,
   8583  * and maxFontSizes.
   8584  */
   8585 
   8586 
   8587 var styleWrap = function styleWrap(delim, toStyle, options, classes) {
   8588   var newOptions = options.havingBaseStyle(toStyle);
   8589   var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options);
   8590   var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;
   8591   span.height *= delimSizeMultiplier;
   8592   span.depth *= delimSizeMultiplier;
   8593   span.maxFontSize = newOptions.sizeMultiplier;
   8594   return span;
   8595 };
   8596 
   8597 var centerSpan = function centerSpan(span, options, style) {
   8598   var newOptions = options.havingBaseStyle(style);
   8599   var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight;
   8600   span.classes.push("delimcenter");
   8601   span.style.top = shift + "em";
   8602   span.height -= shift;
   8603   span.depth += shift;
   8604 };
   8605 /**
   8606  * Makes a small delimiter. This is a delimiter that comes in the Main-Regular
   8607  * font, but is restyled to either be in textstyle, scriptstyle, or
   8608  * scriptscriptstyle.
   8609  */
   8610 
   8611 
   8612 var makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) {
   8613   var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options);
   8614   var span = styleWrap(text, style, options, classes);
   8615 
   8616   if (center) {
   8617     centerSpan(span, options, style);
   8618   }
   8619 
   8620   return span;
   8621 };
   8622 /**
   8623  * Builds a symbol in the given font size (note size is an integer)
   8624  */
   8625 
   8626 
   8627 var mathrmSize = function mathrmSize(value, size, mode, options) {
   8628   return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options);
   8629 };
   8630 /**
   8631  * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2,
   8632  * Size3, or Size4 fonts. It is always rendered in textstyle.
   8633  */
   8634 
   8635 
   8636 var makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) {
   8637   var inner = mathrmSize(delim, size, mode, options);
   8638   var span = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), src_Style.TEXT, options, classes);
   8639 
   8640   if (center) {
   8641     centerSpan(span, options, src_Style.TEXT);
   8642   }
   8643 
   8644   return span;
   8645 };
   8646 /**
   8647  * Make a span from a font glyph with the given offset and in the given font.
   8648  * This is used in makeStackedDelim to make the stacking pieces for the delimiter.
   8649  */
   8650 
   8651 
   8652 var makeGlyphSpan = function makeGlyphSpan(symbol, font, mode) {
   8653   var sizeClass; // Apply the correct CSS class to choose the right font.
   8654 
   8655   if (font === "Size1-Regular") {
   8656     sizeClass = "delim-size1";
   8657   } else
   8658     /* if (font === "Size4-Regular") */
   8659     {
   8660       sizeClass = "delim-size4";
   8661     }
   8662 
   8663   var corner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element
   8664   // in the appropriate tag that VList uses.
   8665 
   8666   return {
   8667     type: "elem",
   8668     elem: corner
   8669   };
   8670 };
   8671 
   8672 var makeInner = function makeInner(ch, height, options) {
   8673   // Create a span with inline SVG for the inner part of a tall stacked delimiter.
   8674   var width = fontMetricsData["Size4-Regular"][ch.charCodeAt(0)] ? fontMetricsData["Size4-Regular"][ch.charCodeAt(0)][4].toFixed(3) : fontMetricsData["Size1-Regular"][ch.charCodeAt(0)][4].toFixed(3);
   8675   var path = new PathNode("inner", innerPath(ch, Math.round(1000 * height)));
   8676   var svgNode = new SvgNode([path], {
   8677     "width": width + "em",
   8678     "height": height + "em",
   8679     // Override CSS rule `.katex svg { width: 100% }`
   8680     "style": "width:" + width + "em",
   8681     "viewBox": "0 0 " + 1000 * width + " " + Math.round(1000 * height),
   8682     "preserveAspectRatio": "xMinYMin"
   8683   });
   8684   var span = buildCommon.makeSvgSpan([], [svgNode], options);
   8685   span.height = height;
   8686   span.style.height = height + "em";
   8687   span.style.width = width + "em";
   8688   return {
   8689     type: "elem",
   8690     elem: span
   8691   };
   8692 }; // Helpers for makeStackedDelim
   8693 
   8694 
   8695 var lapInEms = 0.008;
   8696 var lap = {
   8697   type: "kern",
   8698   size: -1 * lapInEms
   8699 };
   8700 var verts = ["|", "\\lvert", "\\rvert", "\\vert"];
   8701 var doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"];
   8702 /**
   8703  * Make a stacked delimiter out of a given delimiter, with the total height at
   8704  * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook.
   8705  */
   8706 
   8707 var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) {
   8708   // There are four parts, the top, an optional middle, a repeated part, and a
   8709   // bottom.
   8710   var top;
   8711   var middle;
   8712   var repeat;
   8713   var bottom;
   8714   top = repeat = bottom = delim;
   8715   middle = null; // Also keep track of what font the delimiters are in
   8716 
   8717   var font = "Size1-Regular"; // We set the parts and font based on the symbol. Note that we use
   8718   // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the
   8719   // repeats of the arrows
   8720 
   8721   if (delim === "\\uparrow") {
   8722     repeat = bottom = "\u23D0";
   8723   } else if (delim === "\\Uparrow") {
   8724     repeat = bottom = "\u2016";
   8725   } else if (delim === "\\downarrow") {
   8726     top = repeat = "\u23D0";
   8727   } else if (delim === "\\Downarrow") {
   8728     top = repeat = "\u2016";
   8729   } else if (delim === "\\updownarrow") {
   8730     top = "\\uparrow";
   8731     repeat = "\u23D0";
   8732     bottom = "\\downarrow";
   8733   } else if (delim === "\\Updownarrow") {
   8734     top = "\\Uparrow";
   8735     repeat = "\u2016";
   8736     bottom = "\\Downarrow";
   8737   } else if (utils.contains(verts, delim)) {
   8738     repeat = "\u2223";
   8739   } else if (utils.contains(doubleVerts, delim)) {
   8740     repeat = "\u2225";
   8741   } else if (delim === "[" || delim === "\\lbrack") {
   8742     top = "\u23A1";
   8743     repeat = "\u23A2";
   8744     bottom = "\u23A3";
   8745     font = "Size4-Regular";
   8746   } else if (delim === "]" || delim === "\\rbrack") {
   8747     top = "\u23A4";
   8748     repeat = "\u23A5";
   8749     bottom = "\u23A6";
   8750     font = "Size4-Regular";
   8751   } else if (delim === "\\lfloor" || delim === "\u230A") {
   8752     repeat = top = "\u23A2";
   8753     bottom = "\u23A3";
   8754     font = "Size4-Regular";
   8755   } else if (delim === "\\lceil" || delim === "\u2308") {
   8756     top = "\u23A1";
   8757     repeat = bottom = "\u23A2";
   8758     font = "Size4-Regular";
   8759   } else if (delim === "\\rfloor" || delim === "\u230B") {
   8760     repeat = top = "\u23A5";
   8761     bottom = "\u23A6";
   8762     font = "Size4-Regular";
   8763   } else if (delim === "\\rceil" || delim === "\u2309") {
   8764     top = "\u23A4";
   8765     repeat = bottom = "\u23A5";
   8766     font = "Size4-Regular";
   8767   } else if (delim === "(" || delim === "\\lparen") {
   8768     top = "\u239B";
   8769     repeat = "\u239C";
   8770     bottom = "\u239D";
   8771     font = "Size4-Regular";
   8772   } else if (delim === ")" || delim === "\\rparen") {
   8773     top = "\u239E";
   8774     repeat = "\u239F";
   8775     bottom = "\u23A0";
   8776     font = "Size4-Regular";
   8777   } else if (delim === "\\{" || delim === "\\lbrace") {
   8778     top = "\u23A7";
   8779     middle = "\u23A8";
   8780     bottom = "\u23A9";
   8781     repeat = "\u23AA";
   8782     font = "Size4-Regular";
   8783   } else if (delim === "\\}" || delim === "\\rbrace") {
   8784     top = "\u23AB";
   8785     middle = "\u23AC";
   8786     bottom = "\u23AD";
   8787     repeat = "\u23AA";
   8788     font = "Size4-Regular";
   8789   } else if (delim === "\\lgroup" || delim === "\u27EE") {
   8790     top = "\u23A7";
   8791     bottom = "\u23A9";
   8792     repeat = "\u23AA";
   8793     font = "Size4-Regular";
   8794   } else if (delim === "\\rgroup" || delim === "\u27EF") {
   8795     top = "\u23AB";
   8796     bottom = "\u23AD";
   8797     repeat = "\u23AA";
   8798     font = "Size4-Regular";
   8799   } else if (delim === "\\lmoustache" || delim === "\u23B0") {
   8800     top = "\u23A7";
   8801     bottom = "\u23AD";
   8802     repeat = "\u23AA";
   8803     font = "Size4-Regular";
   8804   } else if (delim === "\\rmoustache" || delim === "\u23B1") {
   8805     top = "\u23AB";
   8806     bottom = "\u23A9";
   8807     repeat = "\u23AA";
   8808     font = "Size4-Regular";
   8809   } // Get the metrics of the four sections
   8810 
   8811 
   8812   var topMetrics = getMetrics(top, font, mode);
   8813   var topHeightTotal = topMetrics.height + topMetrics.depth;
   8814   var repeatMetrics = getMetrics(repeat, font, mode);
   8815   var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth;
   8816   var bottomMetrics = getMetrics(bottom, font, mode);
   8817   var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth;
   8818   var middleHeightTotal = 0;
   8819   var middleFactor = 1;
   8820 
   8821   if (middle !== null) {
   8822     var middleMetrics = getMetrics(middle, font, mode);
   8823     middleHeightTotal = middleMetrics.height + middleMetrics.depth;
   8824     middleFactor = 2; // repeat symmetrically above and below middle
   8825   } // Calcuate the minimal height that the delimiter can have.
   8826   // It is at least the size of the top, bottom, and optional middle combined.
   8827 
   8828 
   8829   var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need
   8830 
   8831   var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); // Compute the total height of the delimiter including all the symbols
   8832 
   8833   var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note
   8834   // that in this context, "center" means that the delimiter should be
   8835   // centered around the axis in the current style, while normally it is
   8836   // centered around the axis in textstyle.
   8837 
   8838   var axisHeight = options.fontMetrics().axisHeight;
   8839 
   8840   if (center) {
   8841     axisHeight *= options.sizeMultiplier;
   8842   } // Calculate the depth
   8843 
   8844 
   8845   var depth = realHeightTotal / 2 - axisHeight; // Now, we start building the pieces that will go into the vlist
   8846   // Keep a list of the pieces of the stacked delimiter
   8847 
   8848   var stack = []; // Add the bottom symbol
   8849 
   8850   stack.push(makeGlyphSpan(bottom, font, mode));
   8851   stack.push(lap); // overlap
   8852 
   8853   if (middle === null) {
   8854     // The middle section will be an SVG. Make it an extra 0.016em tall.
   8855     // We'll overlap by 0.008em at top and bottom.
   8856     var innerHeight = realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms;
   8857     stack.push(makeInner(repeat, innerHeight, options));
   8858   } else {
   8859     // When there is a middle bit, we need the middle part and two repeated
   8860     // sections
   8861     var _innerHeight = (realHeightTotal - topHeightTotal - bottomHeightTotal - middleHeightTotal) / 2 + 2 * lapInEms;
   8862 
   8863     stack.push(makeInner(repeat, _innerHeight, options)); // Now insert the middle of the brace.
   8864 
   8865     stack.push(lap);
   8866     stack.push(makeGlyphSpan(middle, font, mode));
   8867     stack.push(lap);
   8868     stack.push(makeInner(repeat, _innerHeight, options));
   8869   } // Add the top symbol
   8870 
   8871 
   8872   stack.push(lap);
   8873   stack.push(makeGlyphSpan(top, font, mode)); // Finally, build the vlist
   8874 
   8875   var newOptions = options.havingBaseStyle(src_Style.TEXT);
   8876   var inner = buildCommon.makeVList({
   8877     positionType: "bottom",
   8878     positionData: depth,
   8879     children: stack
   8880   }, newOptions);
   8881   return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), src_Style.TEXT, options, classes);
   8882 }; // All surds have 0.08em padding above the viniculum inside the SVG.
   8883 // That keeps browser span height rounding error from pinching the line.
   8884 
   8885 
   8886 var vbPad = 80; // padding above the surd, measured inside the viewBox.
   8887 
   8888 var emPad = 0.08; // padding, in ems, measured in the document.
   8889 
   8890 var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) {
   8891   var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight);
   8892   var pathNode = new PathNode(sqrtName, path);
   8893   var svg = new SvgNode([pathNode], {
   8894     // Note: 1000:1 ratio of viewBox to document em width.
   8895     "width": "400em",
   8896     "height": height + "em",
   8897     "viewBox": "0 0 400000 " + viewBoxHeight,
   8898     "preserveAspectRatio": "xMinYMin slice"
   8899   });
   8900   return buildCommon.makeSvgSpan(["hide-tail"], [svg], options);
   8901 };
   8902 /**
   8903  * Make a sqrt image of the given height,
   8904  */
   8905 
   8906 
   8907 var makeSqrtImage = function makeSqrtImage(height, options) {
   8908   // Define a newOptions that removes the effect of size changes such as \Huge.
   8909   // We don't pick different a height surd for \Huge. For it, we scale up.
   8910   var newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds.
   8911 
   8912   var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions);
   8913   var sizeMultiplier = newOptions.sizeMultiplier; // default
   8914   // The standard sqrt SVGs each have a 0.04em thick viniculum.
   8915   // If Settings.minRuleThickness is larger than that, we add extraViniculum.
   8916 
   8917   var extraViniculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol.
   8918 
   8919   var span;
   8920   var spanHeight = 0;
   8921   var texHeight = 0;
   8922   var viewBoxHeight = 0;
   8923   var advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd.
   8924   // Then browser rounding error on the parent span height will not
   8925   // encroach on the ink of the viniculum. But that padding is not
   8926   // included in the TeX-like `height` used for calculation of
   8927   // vertical alignment. So texHeight = span.height < span.style.height.
   8928 
   8929   if (delim.type === "small") {
   8930     // Get an SVG that is derived from glyph U+221A in font KaTeX-Main.
   8931     // 1000 unit normal glyph height.
   8932     viewBoxHeight = 1000 + 1000 * extraViniculum + vbPad;
   8933 
   8934     if (height < 1.0) {
   8935       sizeMultiplier = 1.0; // mimic a \textfont radical
   8936     } else if (height < 1.4) {
   8937       sizeMultiplier = 0.7; // mimic a \scriptfont radical
   8938     }
   8939 
   8940     spanHeight = (1.0 + extraViniculum + emPad) / sizeMultiplier;
   8941     texHeight = (1.00 + extraViniculum) / sizeMultiplier;
   8942     span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraViniculum, options);
   8943     span.style.minWidth = "0.853em";
   8944     advanceWidth = 0.833 / sizeMultiplier; // from the font.
   8945   } else if (delim.type === "large") {
   8946     // These SVGs come from fonts: KaTeX_Size1, _Size2, etc.
   8947     viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size];
   8948     texHeight = (sizeToMaxHeight[delim.size] + extraViniculum) / sizeMultiplier;
   8949     spanHeight = (sizeToMaxHeight[delim.size] + extraViniculum + emPad) / sizeMultiplier;
   8950     span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraViniculum, options);
   8951     span.style.minWidth = "1.02em";
   8952     advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font.
   8953   } else {
   8954     // Tall sqrt. In TeX, this would be stacked using multiple glyphs.
   8955     // We'll use a single SVG to accomplish the same thing.
   8956     spanHeight = height + extraViniculum + emPad;
   8957     texHeight = height + extraViniculum;
   8958     viewBoxHeight = Math.floor(1000 * height + extraViniculum) + vbPad;
   8959     span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraViniculum, options);
   8960     span.style.minWidth = "0.742em";
   8961     advanceWidth = 1.056;
   8962   }
   8963 
   8964   span.height = texHeight;
   8965   span.style.height = spanHeight + "em";
   8966   return {
   8967     span: span,
   8968     advanceWidth: advanceWidth,
   8969     // Calculate the actual line width.
   8970     // This actually should depend on the chosen font -- e.g. \boldmath
   8971     // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
   8972     // have thicker rules.
   8973     ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraViniculum) * sizeMultiplier
   8974   };
   8975 }; // There are three kinds of delimiters, delimiters that stack when they become
   8976 // too large
   8977 
   8978 
   8979 var stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; // delimiters that always stack
   8980 
   8981 var stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1"]; // and delimiters that never stack
   8982 
   8983 var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of
   8984 // $\bigl| // \Bigl| \biggl| \Biggl| \showlists$
   8985 // Used to create stacked delimiters of appropriate sizes in makeSizedDelim.
   8986 
   8987 var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0];
   8988 /**
   8989  * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4.
   8990  */
   8991 
   8992 var makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) {
   8993   // < and > turn into \langle and \rangle in delimiters
   8994   if (delim === "<" || delim === "\\lt" || delim === "\u27E8") {
   8995     delim = "\\langle";
   8996   } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") {
   8997     delim = "\\rangle";
   8998   } // Sized delimiters are never centered.
   8999 
   9000 
   9001   if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) {
   9002     return makeLargeDelim(delim, size, false, options, mode, classes);
   9003   } else if (utils.contains(stackAlwaysDelimiters, delim)) {
   9004     return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);
   9005   } else {
   9006     throw new src_ParseError("Illegal delimiter: '" + delim + "'");
   9007   }
   9008 };
   9009 /**
   9010  * There are three different sequences of delimiter sizes that the delimiters
   9011  * follow depending on the kind of delimiter. This is used when creating custom
   9012  * sized delimiters to decide whether to create a small, large, or stacked
   9013  * delimiter.
   9014  *
   9015  * In real TeX, these sequences aren't explicitly defined, but are instead
   9016  * defined inside the font metrics. Since there are only three sequences that
   9017  * are possible for the delimiters that TeX defines, it is easier to just encode
   9018  * them explicitly here.
   9019  */
   9020 
   9021 
   9022 // Delimiters that never stack try small delimiters and large delimiters only
   9023 var stackNeverDelimiterSequence = [{
   9024   type: "small",
   9025   style: src_Style.SCRIPTSCRIPT
   9026 }, {
   9027   type: "small",
   9028   style: src_Style.SCRIPT
   9029 }, {
   9030   type: "small",
   9031   style: src_Style.TEXT
   9032 }, {
   9033   type: "large",
   9034   size: 1
   9035 }, {
   9036   type: "large",
   9037   size: 2
   9038 }, {
   9039   type: "large",
   9040   size: 3
   9041 }, {
   9042   type: "large",
   9043   size: 4
   9044 }]; // Delimiters that always stack try the small delimiters first, then stack
   9045 
   9046 var stackAlwaysDelimiterSequence = [{
   9047   type: "small",
   9048   style: src_Style.SCRIPTSCRIPT
   9049 }, {
   9050   type: "small",
   9051   style: src_Style.SCRIPT
   9052 }, {
   9053   type: "small",
   9054   style: src_Style.TEXT
   9055 }, {
   9056   type: "stack"
   9057 }]; // Delimiters that stack when large try the small and then large delimiters, and
   9058 // stack afterwards
   9059 
   9060 var stackLargeDelimiterSequence = [{
   9061   type: "small",
   9062   style: src_Style.SCRIPTSCRIPT
   9063 }, {
   9064   type: "small",
   9065   style: src_Style.SCRIPT
   9066 }, {
   9067   type: "small",
   9068   style: src_Style.TEXT
   9069 }, {
   9070   type: "large",
   9071   size: 1
   9072 }, {
   9073   type: "large",
   9074   size: 2
   9075 }, {
   9076   type: "large",
   9077   size: 3
   9078 }, {
   9079   type: "large",
   9080   size: 4
   9081 }, {
   9082   type: "stack"
   9083 }];
   9084 /**
   9085  * Get the font used in a delimiter based on what kind of delimiter it is.
   9086  * TODO(#963) Use more specific font family return type once that is introduced.
   9087  */
   9088 
   9089 var delimTypeToFont = function delimTypeToFont(type) {
   9090   if (type.type === "small") {
   9091     return "Main-Regular";
   9092   } else if (type.type === "large") {
   9093     return "Size" + type.size + "-Regular";
   9094   } else if (type.type === "stack") {
   9095     return "Size4-Regular";
   9096   } else {
   9097     throw new Error("Add support for delim type '" + type.type + "' here.");
   9098   }
   9099 };
   9100 /**
   9101  * Traverse a sequence of types of delimiters to decide what kind of delimiter
   9102  * should be used to create a delimiter of the given height+depth.
   9103  */
   9104 
   9105 
   9106 var traverseSequence = function traverseSequence(delim, height, sequence, options) {
   9107   // Here, we choose the index we should start at in the sequences. In smaller
   9108   // sizes (which correspond to larger numbers in style.size) we start earlier
   9109   // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts
   9110   // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2
   9111   var start = Math.min(2, 3 - options.style.size);
   9112 
   9113   for (var i = start; i < sequence.length; i++) {
   9114     if (sequence[i].type === "stack") {
   9115       // This is always the last delimiter, so we just break the loop now.
   9116       break;
   9117     }
   9118 
   9119     var metrics = getMetrics(delim, delimTypeToFont(sequence[i]), "math");
   9120     var heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we
   9121     // account for the style change size.
   9122 
   9123     if (sequence[i].type === "small") {
   9124       var newOptions = options.havingBaseStyle(sequence[i].style);
   9125       heightDepth *= newOptions.sizeMultiplier;
   9126     } // Check if the delimiter at this size works for the given height.
   9127 
   9128 
   9129     if (heightDepth > height) {
   9130       return sequence[i];
   9131     }
   9132   } // If we reached the end of the sequence, return the last sequence element.
   9133 
   9134 
   9135   return sequence[sequence.length - 1];
   9136 };
   9137 /**
   9138  * Make a delimiter of a given height+depth, with optional centering. Here, we
   9139  * traverse the sequences, and create a delimiter that the sequence tells us to.
   9140  */
   9141 
   9142 
   9143 var makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) {
   9144   if (delim === "<" || delim === "\\lt" || delim === "\u27E8") {
   9145     delim = "\\langle";
   9146   } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") {
   9147     delim = "\\rangle";
   9148   } // Decide what sequence to use
   9149 
   9150 
   9151   var sequence;
   9152 
   9153   if (utils.contains(stackNeverDelimiters, delim)) {
   9154     sequence = stackNeverDelimiterSequence;
   9155   } else if (utils.contains(stackLargeDelimiters, delim)) {
   9156     sequence = stackLargeDelimiterSequence;
   9157   } else {
   9158     sequence = stackAlwaysDelimiterSequence;
   9159   } // Look through the sequence
   9160 
   9161 
   9162   var delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs.
   9163   // Depending on the sequence element we decided on, call the
   9164   // appropriate function.
   9165 
   9166   if (delimType.type === "small") {
   9167     return makeSmallDelim(delim, delimType.style, center, options, mode, classes);
   9168   } else if (delimType.type === "large") {
   9169     return makeLargeDelim(delim, delimType.size, center, options, mode, classes);
   9170   } else
   9171     /* if (delimType.type === "stack") */
   9172     {
   9173       return makeStackedDelim(delim, height, center, options, mode, classes);
   9174     }
   9175 };
   9176 /**
   9177  * Make a delimiter for use with `\left` and `\right`, given a height and depth
   9178  * of an expression that the delimiters surround.
   9179  */
   9180 
   9181 
   9182 var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) {
   9183   // We always center \left/\right delimiters, so the axis is always shifted
   9184   var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right
   9185 
   9186   var delimiterFactor = 901;
   9187   var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm;
   9188   var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight);
   9189   var totalHeight = Math.max( // In real TeX, calculations are done using integral values which are
   9190   // 65536 per pt, or 655360 per em. So, the division here truncates in
   9191   // TeX but doesn't here, producing different results. If we wanted to
   9192   // exactly match TeX's calculation, we could do
   9193   //   Math.floor(655360 * maxDistFromAxis / 500) *
   9194   //    delimiterFactor / 655360
   9195   // (To see the difference, compare
   9196   //    x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
   9197   // in TeX and KaTeX)
   9198   maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total
   9199   // height
   9200 
   9201   return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);
   9202 };
   9203 
   9204 /* harmony default export */ var delimiter = ({
   9205   sqrtImage: makeSqrtImage,
   9206   sizedDelim: makeSizedDelim,
   9207   sizeToMaxHeight: sizeToMaxHeight,
   9208   customSizedDelim: makeCustomSizedDelim,
   9209   leftRightDelim: makeLeftRightDelim
   9210 });
   9211 ;// CONCATENATED MODULE: ./src/functions/delimsizing.js
   9212 
   9213 
   9214 
   9215 
   9216 
   9217 
   9218 
   9219 
   9220 
   9221 // Extra data needed for the delimiter handler down below
   9222 var delimiterSizes = {
   9223   "\\bigl": {
   9224     mclass: "mopen",
   9225     size: 1
   9226   },
   9227   "\\Bigl": {
   9228     mclass: "mopen",
   9229     size: 2
   9230   },
   9231   "\\biggl": {
   9232     mclass: "mopen",
   9233     size: 3
   9234   },
   9235   "\\Biggl": {
   9236     mclass: "mopen",
   9237     size: 4
   9238   },
   9239   "\\bigr": {
   9240     mclass: "mclose",
   9241     size: 1
   9242   },
   9243   "\\Bigr": {
   9244     mclass: "mclose",
   9245     size: 2
   9246   },
   9247   "\\biggr": {
   9248     mclass: "mclose",
   9249     size: 3
   9250   },
   9251   "\\Biggr": {
   9252     mclass: "mclose",
   9253     size: 4
   9254   },
   9255   "\\bigm": {
   9256     mclass: "mrel",
   9257     size: 1
   9258   },
   9259   "\\Bigm": {
   9260     mclass: "mrel",
   9261     size: 2
   9262   },
   9263   "\\biggm": {
   9264     mclass: "mrel",
   9265     size: 3
   9266   },
   9267   "\\Biggm": {
   9268     mclass: "mrel",
   9269     size: 4
   9270   },
   9271   "\\big": {
   9272     mclass: "mord",
   9273     size: 1
   9274   },
   9275   "\\Big": {
   9276     mclass: "mord",
   9277     size: 2
   9278   },
   9279   "\\bigg": {
   9280     mclass: "mord",
   9281     size: 3
   9282   },
   9283   "\\Bigg": {
   9284     mclass: "mord",
   9285     size: 4
   9286   }
   9287 };
   9288 var delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27E8", "\\rangle", "\u27E9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."];
   9289 
   9290 // Delimiter functions
   9291 function checkDelimiter(delim, context) {
   9292   var symDelim = checkSymbolNodeType(delim);
   9293 
   9294   if (symDelim && utils.contains(delimiters, symDelim.text)) {
   9295     return symDelim;
   9296   } else if (symDelim) {
   9297     throw new src_ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim);
   9298   } else {
   9299     throw new src_ParseError("Invalid delimiter type '" + delim.type + "'", delim);
   9300   }
   9301 }
   9302 
   9303 defineFunction({
   9304   type: "delimsizing",
   9305   names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
   9306   props: {
   9307     numArgs: 1,
   9308     argTypes: ["primitive"]
   9309   },
   9310   handler: function handler(context, args) {
   9311     var delim = checkDelimiter(args[0], context);
   9312     return {
   9313       type: "delimsizing",
   9314       mode: context.parser.mode,
   9315       size: delimiterSizes[context.funcName].size,
   9316       mclass: delimiterSizes[context.funcName].mclass,
   9317       delim: delim.text
   9318     };
   9319   },
   9320   htmlBuilder: function htmlBuilder(group, options) {
   9321     if (group.delim === ".") {
   9322       // Empty delimiters still count as elements, even though they don't
   9323       // show anything.
   9324       return buildCommon.makeSpan([group.mclass]);
   9325     } // Use delimiter.sizedDelim to generate the delimiter.
   9326 
   9327 
   9328     return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]);
   9329   },
   9330   mathmlBuilder: function mathmlBuilder(group) {
   9331     var children = [];
   9332 
   9333     if (group.delim !== ".") {
   9334       children.push(makeText(group.delim, group.mode));
   9335     }
   9336 
   9337     var node = new mathMLTree.MathNode("mo", children);
   9338 
   9339     if (group.mclass === "mopen" || group.mclass === "mclose") {
   9340       // Only some of the delimsizing functions act as fences, and they
   9341       // return "mopen" or "mclose" mclass.
   9342       node.setAttribute("fence", "true");
   9343     } else {
   9344       // Explicitly disable fencing if it's not a fence, to override the
   9345       // defaults.
   9346       node.setAttribute("fence", "false");
   9347     }
   9348 
   9349     node.setAttribute("stretchy", "true");
   9350     node.setAttribute("minsize", delimiter.sizeToMaxHeight[group.size] + "em");
   9351     node.setAttribute("maxsize", delimiter.sizeToMaxHeight[group.size] + "em");
   9352     return node;
   9353   }
   9354 });
   9355 
   9356 function assertParsed(group) {
   9357   if (!group.body) {
   9358     throw new Error("Bug: The leftright ParseNode wasn't fully parsed.");
   9359   }
   9360 }
   9361 
   9362 defineFunction({
   9363   type: "leftright-right",
   9364   names: ["\\right"],
   9365   props: {
   9366     numArgs: 1,
   9367     primitive: true
   9368   },
   9369   handler: function handler(context, args) {
   9370     // \left case below triggers parsing of \right in
   9371     //   `const right = parser.parseFunction();`
   9372     // uses this return value.
   9373     var color = context.parser.gullet.macros.get("\\current@color");
   9374 
   9375     if (color && typeof color !== "string") {
   9376       throw new src_ParseError("\\current@color set to non-string in \\right");
   9377     }
   9378 
   9379     return {
   9380       type: "leftright-right",
   9381       mode: context.parser.mode,
   9382       delim: checkDelimiter(args[0], context).text,
   9383       color: color // undefined if not set via \color
   9384 
   9385     };
   9386   }
   9387 });
   9388 defineFunction({
   9389   type: "leftright",
   9390   names: ["\\left"],
   9391   props: {
   9392     numArgs: 1,
   9393     primitive: true
   9394   },
   9395   handler: function handler(context, args) {
   9396     var delim = checkDelimiter(args[0], context);
   9397     var parser = context.parser; // Parse out the implicit body
   9398 
   9399     ++parser.leftrightDepth; // parseExpression stops before '\\right'
   9400 
   9401     var body = parser.parseExpression(false);
   9402     --parser.leftrightDepth; // Check the next token
   9403 
   9404     parser.expect("\\right", false);
   9405     var right = assertNodeType(parser.parseFunction(), "leftright-right");
   9406     return {
   9407       type: "leftright",
   9408       mode: parser.mode,
   9409       body: body,
   9410       left: delim.text,
   9411       right: right.delim,
   9412       rightColor: right.color
   9413     };
   9414   },
   9415   htmlBuilder: function htmlBuilder(group, options) {
   9416     assertParsed(group); // Build the inner expression
   9417 
   9418     var inner = buildExpression(group.body, options, true, ["mopen", "mclose"]);
   9419     var innerHeight = 0;
   9420     var innerDepth = 0;
   9421     var hadMiddle = false; // Calculate its height and depth
   9422 
   9423     for (var i = 0; i < inner.length; i++) {
   9424       // Property `isMiddle` not defined on `span`. See comment in
   9425       // "middle"'s htmlBuilder.
   9426       // $FlowFixMe
   9427       if (inner[i].isMiddle) {
   9428         hadMiddle = true;
   9429       } else {
   9430         innerHeight = Math.max(inner[i].height, innerHeight);
   9431         innerDepth = Math.max(inner[i].depth, innerDepth);
   9432       }
   9433     } // The size of delimiters is the same, regardless of what style we are
   9434     // in. Thus, to correctly calculate the size of delimiter we need around
   9435     // a group, we scale down the inner size based on the size.
   9436 
   9437 
   9438     innerHeight *= options.sizeMultiplier;
   9439     innerDepth *= options.sizeMultiplier;
   9440     var leftDelim;
   9441 
   9442     if (group.left === ".") {
   9443       // Empty delimiters in \left and \right make null delimiter spaces.
   9444       leftDelim = makeNullDelimiter(options, ["mopen"]);
   9445     } else {
   9446       // Otherwise, use leftRightDelim to generate the correct sized
   9447       // delimiter.
   9448       leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]);
   9449     } // Add it to the beginning of the expression
   9450 
   9451 
   9452     inner.unshift(leftDelim); // Handle middle delimiters
   9453 
   9454     if (hadMiddle) {
   9455       for (var _i = 1; _i < inner.length; _i++) {
   9456         var middleDelim = inner[_i]; // Property `isMiddle` not defined on `span`. See comment in
   9457         // "middle"'s htmlBuilder.
   9458         // $FlowFixMe
   9459 
   9460         var isMiddle = middleDelim.isMiddle;
   9461 
   9462         if (isMiddle) {
   9463           // Apply the options that were active when \middle was called
   9464           inner[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []);
   9465         }
   9466       }
   9467     }
   9468 
   9469     var rightDelim; // Same for the right delimiter, but using color specified by \color
   9470 
   9471     if (group.right === ".") {
   9472       rightDelim = makeNullDelimiter(options, ["mclose"]);
   9473     } else {
   9474       var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options;
   9475       rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]);
   9476     } // Add it to the end of the expression.
   9477 
   9478 
   9479     inner.push(rightDelim);
   9480     return buildCommon.makeSpan(["minner"], inner, options);
   9481   },
   9482   mathmlBuilder: function mathmlBuilder(group, options) {
   9483     assertParsed(group);
   9484     var inner = buildMathML_buildExpression(group.body, options);
   9485 
   9486     if (group.left !== ".") {
   9487       var leftNode = new mathMLTree.MathNode("mo", [makeText(group.left, group.mode)]);
   9488       leftNode.setAttribute("fence", "true");
   9489       inner.unshift(leftNode);
   9490     }
   9491 
   9492     if (group.right !== ".") {
   9493       var rightNode = new mathMLTree.MathNode("mo", [makeText(group.right, group.mode)]);
   9494       rightNode.setAttribute("fence", "true");
   9495 
   9496       if (group.rightColor) {
   9497         rightNode.setAttribute("mathcolor", group.rightColor);
   9498       }
   9499 
   9500       inner.push(rightNode);
   9501     }
   9502 
   9503     return makeRow(inner);
   9504   }
   9505 });
   9506 defineFunction({
   9507   type: "middle",
   9508   names: ["\\middle"],
   9509   props: {
   9510     numArgs: 1,
   9511     primitive: true
   9512   },
   9513   handler: function handler(context, args) {
   9514     var delim = checkDelimiter(args[0], context);
   9515 
   9516     if (!context.parser.leftrightDepth) {
   9517       throw new src_ParseError("\\middle without preceding \\left", delim);
   9518     }
   9519 
   9520     return {
   9521       type: "middle",
   9522       mode: context.parser.mode,
   9523       delim: delim.text
   9524     };
   9525   },
   9526   htmlBuilder: function htmlBuilder(group, options) {
   9527     var middleDelim;
   9528 
   9529     if (group.delim === ".") {
   9530       middleDelim = makeNullDelimiter(options, []);
   9531     } else {
   9532       middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []);
   9533       var isMiddle = {
   9534         delim: group.delim,
   9535         options: options
   9536       }; // Property `isMiddle` not defined on `span`. It is only used in
   9537       // this file above.
   9538       // TODO: Fix this violation of the `span` type and possibly rename
   9539       // things since `isMiddle` sounds like a boolean, but is a struct.
   9540       // $FlowFixMe
   9541 
   9542       middleDelim.isMiddle = isMiddle;
   9543     }
   9544 
   9545     return middleDelim;
   9546   },
   9547   mathmlBuilder: function mathmlBuilder(group, options) {
   9548     // A Firefox \middle will strech a character vertically only if it
   9549     // is in the fence part of the operator dictionary at:
   9550     // https://www.w3.org/TR/MathML3/appendixc.html.
   9551     // So we need to avoid U+2223 and use plain "|" instead.
   9552     var textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode);
   9553     var middleNode = new mathMLTree.MathNode("mo", [textNode]);
   9554     middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each <mo> element.
   9555     // \middle should get delimiter spacing instead.
   9556 
   9557     middleNode.setAttribute("lspace", "0.05em");
   9558     middleNode.setAttribute("rspace", "0.05em");
   9559     return middleNode;
   9560   }
   9561 });
   9562 ;// CONCATENATED MODULE: ./src/functions/enclose.js
   9563 
   9564 
   9565 
   9566 
   9567 
   9568 
   9569 
   9570 
   9571 
   9572 
   9573 
   9574 
   9575 var enclose_htmlBuilder = function htmlBuilder(group, options) {
   9576   // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox, \phase
   9577   // Some groups can return document fragments.  Handle those by wrapping
   9578   // them in a span.
   9579   var inner = buildCommon.wrapFragment(buildGroup(group.body, options), options);
   9580   var label = group.label.substr(1);
   9581   var scale = options.sizeMultiplier;
   9582   var img;
   9583   var imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different
   9584   // depending on whether the subject is wider than it is tall, or vice versa.
   9585   // We don't know the width of a group, so as a proxy, we test if
   9586   // the subject is a single character. This captures most of the
   9587   // subjects that should get the "tall" treatment.
   9588 
   9589   var isSingleChar = utils.isCharacterBox(group.body);
   9590 
   9591   if (label === "sout") {
   9592     img = buildCommon.makeSpan(["stretchy", "sout"]);
   9593     img.height = options.fontMetrics().defaultRuleThickness / scale;
   9594     imgShift = -0.5 * options.fontMetrics().xHeight;
   9595   } else if (label === "phase") {
   9596     // Set a couple of dimensions from the steinmetz package.
   9597     var lineWeight = calculateSize({
   9598       number: 0.6,
   9599       unit: "pt"
   9600     }, options);
   9601     var clearance = calculateSize({
   9602       number: 0.35,
   9603       unit: "ex"
   9604     }, options); // Prevent size changes like \Huge from affecting line thickness
   9605 
   9606     var newOptions = options.havingBaseSizing();
   9607     scale = scale / newOptions.sizeMultiplier;
   9608     var angleHeight = inner.height + inner.depth + lineWeight + clearance; // Reserve a left pad for the angle.
   9609 
   9610     inner.style.paddingLeft = angleHeight / 2 + lineWeight + "em"; // Create an SVG
   9611 
   9612     var viewBoxHeight = Math.floor(1000 * angleHeight * scale);
   9613     var path = phasePath(viewBoxHeight);
   9614     var svgNode = new SvgNode([new PathNode("phase", path)], {
   9615       "width": "400em",
   9616       "height": viewBoxHeight / 1000 + "em",
   9617       "viewBox": "0 0 400000 " + viewBoxHeight,
   9618       "preserveAspectRatio": "xMinYMin slice"
   9619     }); // Wrap it in a span with overflow: hidden.
   9620 
   9621     img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode], options);
   9622     img.style.height = angleHeight + "em";
   9623     imgShift = inner.depth + lineWeight + clearance;
   9624   } else {
   9625     // Add horizontal padding
   9626     if (/cancel/.test(label)) {
   9627       if (!isSingleChar) {
   9628         inner.classes.push("cancel-pad");
   9629       }
   9630     } else if (label === "angl") {
   9631       inner.classes.push("anglpad");
   9632     } else {
   9633       inner.classes.push("boxpad");
   9634     } // Add vertical padding
   9635 
   9636 
   9637     var topPad = 0;
   9638     var bottomPad = 0;
   9639     var ruleThickness = 0; // ref: cancel package: \advance\totalheight2\p@ % "+2"
   9640 
   9641     if (/box/.test(label)) {
   9642       ruleThickness = Math.max(options.fontMetrics().fboxrule, // default
   9643       options.minRuleThickness // User override.
   9644       );
   9645       topPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness);
   9646       bottomPad = topPad;
   9647     } else if (label === "angl") {
   9648       ruleThickness = Math.max(options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
   9649       topPad = 4 * ruleThickness; // gap = 3 × line, plus the line itself.
   9650 
   9651       bottomPad = Math.max(0, 0.25 - inner.depth);
   9652     } else {
   9653       topPad = isSingleChar ? 0.2 : 0;
   9654       bottomPad = topPad;
   9655     }
   9656 
   9657     img = stretchy.encloseSpan(inner, label, topPad, bottomPad, options);
   9658 
   9659     if (/fbox|boxed|fcolorbox/.test(label)) {
   9660       img.style.borderStyle = "solid";
   9661       img.style.borderWidth = ruleThickness + "em";
   9662     } else if (label === "angl" && ruleThickness !== 0.049) {
   9663       img.style.borderTopWidth = ruleThickness + "em";
   9664       img.style.borderRightWidth = ruleThickness + "em";
   9665     }
   9666 
   9667     imgShift = inner.depth + bottomPad;
   9668 
   9669     if (group.backgroundColor) {
   9670       img.style.backgroundColor = group.backgroundColor;
   9671 
   9672       if (group.borderColor) {
   9673         img.style.borderColor = group.borderColor;
   9674       }
   9675     }
   9676   }
   9677 
   9678   var vlist;
   9679 
   9680   if (group.backgroundColor) {
   9681     vlist = buildCommon.makeVList({
   9682       positionType: "individualShift",
   9683       children: [// Put the color background behind inner;
   9684       {
   9685         type: "elem",
   9686         elem: img,
   9687         shift: imgShift
   9688       }, {
   9689         type: "elem",
   9690         elem: inner,
   9691         shift: 0
   9692       }]
   9693     }, options);
   9694   } else {
   9695     var classes = /cancel|phase/.test(label) ? ["svg-align"] : [];
   9696     vlist = buildCommon.makeVList({
   9697       positionType: "individualShift",
   9698       children: [// Write the \cancel stroke on top of inner.
   9699       {
   9700         type: "elem",
   9701         elem: inner,
   9702         shift: 0
   9703       }, {
   9704         type: "elem",
   9705         elem: img,
   9706         shift: imgShift,
   9707         wrapperClasses: classes
   9708       }]
   9709     }, options);
   9710   }
   9711 
   9712   if (/cancel/.test(label)) {
   9713     // The cancel package documentation says that cancel lines add their height
   9714     // to the expression, but tests show that isn't how it actually works.
   9715     vlist.height = inner.height;
   9716     vlist.depth = inner.depth;
   9717   }
   9718 
   9719   if (/cancel/.test(label) && !isSingleChar) {
   9720     // cancel does not create horiz space for its line extension.
   9721     return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options);
   9722   } else {
   9723     return buildCommon.makeSpan(["mord"], [vlist], options);
   9724   }
   9725 };
   9726 
   9727 var enclose_mathmlBuilder = function mathmlBuilder(group, options) {
   9728   var fboxsep = 0;
   9729   var node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildMathML_buildGroup(group.body, options)]);
   9730 
   9731   switch (group.label) {
   9732     case "\\cancel":
   9733       node.setAttribute("notation", "updiagonalstrike");
   9734       break;
   9735 
   9736     case "\\bcancel":
   9737       node.setAttribute("notation", "downdiagonalstrike");
   9738       break;
   9739 
   9740     case "\\phase":
   9741       node.setAttribute("notation", "phasorangle");
   9742       break;
   9743 
   9744     case "\\sout":
   9745       node.setAttribute("notation", "horizontalstrike");
   9746       break;
   9747 
   9748     case "\\fbox":
   9749       node.setAttribute("notation", "box");
   9750       break;
   9751 
   9752     case "\\angl":
   9753       node.setAttribute("notation", "actuarial");
   9754       break;
   9755 
   9756     case "\\fcolorbox":
   9757     case "\\colorbox":
   9758       // <menclose> doesn't have a good notation option. So use <mpadded>
   9759       // instead. Set some attributes that come included with <menclose>.
   9760       fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm;
   9761       node.setAttribute("width", "+" + 2 * fboxsep + "pt");
   9762       node.setAttribute("height", "+" + 2 * fboxsep + "pt");
   9763       node.setAttribute("lspace", fboxsep + "pt"); //
   9764 
   9765       node.setAttribute("voffset", fboxsep + "pt");
   9766 
   9767       if (group.label === "\\fcolorbox") {
   9768         var thk = Math.max(options.fontMetrics().fboxrule, // default
   9769         options.minRuleThickness // user override
   9770         );
   9771         node.setAttribute("style", "border: " + thk + "em solid " + String(group.borderColor));
   9772       }
   9773 
   9774       break;
   9775 
   9776     case "\\xcancel":
   9777       node.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
   9778       break;
   9779   }
   9780 
   9781   if (group.backgroundColor) {
   9782     node.setAttribute("mathbackground", group.backgroundColor);
   9783   }
   9784 
   9785   return node;
   9786 };
   9787 
   9788 defineFunction({
   9789   type: "enclose",
   9790   names: ["\\colorbox"],
   9791   props: {
   9792     numArgs: 2,
   9793     allowedInText: true,
   9794     argTypes: ["color", "text"]
   9795   },
   9796   handler: function handler(_ref, args, optArgs) {
   9797     var parser = _ref.parser,
   9798         funcName = _ref.funcName;
   9799     var color = assertNodeType(args[0], "color-token").color;
   9800     var body = args[1];
   9801     return {
   9802       type: "enclose",
   9803       mode: parser.mode,
   9804       label: funcName,
   9805       backgroundColor: color,
   9806       body: body
   9807     };
   9808   },
   9809   htmlBuilder: enclose_htmlBuilder,
   9810   mathmlBuilder: enclose_mathmlBuilder
   9811 });
   9812 defineFunction({
   9813   type: "enclose",
   9814   names: ["\\fcolorbox"],
   9815   props: {
   9816     numArgs: 3,
   9817     allowedInText: true,
   9818     argTypes: ["color", "color", "text"]
   9819   },
   9820   handler: function handler(_ref2, args, optArgs) {
   9821     var parser = _ref2.parser,
   9822         funcName = _ref2.funcName;
   9823     var borderColor = assertNodeType(args[0], "color-token").color;
   9824     var backgroundColor = assertNodeType(args[1], "color-token").color;
   9825     var body = args[2];
   9826     return {
   9827       type: "enclose",
   9828       mode: parser.mode,
   9829       label: funcName,
   9830       backgroundColor: backgroundColor,
   9831       borderColor: borderColor,
   9832       body: body
   9833     };
   9834   },
   9835   htmlBuilder: enclose_htmlBuilder,
   9836   mathmlBuilder: enclose_mathmlBuilder
   9837 });
   9838 defineFunction({
   9839   type: "enclose",
   9840   names: ["\\fbox"],
   9841   props: {
   9842     numArgs: 1,
   9843     argTypes: ["hbox"],
   9844     allowedInText: true
   9845   },
   9846   handler: function handler(_ref3, args) {
   9847     var parser = _ref3.parser;
   9848     return {
   9849       type: "enclose",
   9850       mode: parser.mode,
   9851       label: "\\fbox",
   9852       body: args[0]
   9853     };
   9854   }
   9855 });
   9856 defineFunction({
   9857   type: "enclose",
   9858   names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"],
   9859   props: {
   9860     numArgs: 1
   9861   },
   9862   handler: function handler(_ref4, args) {
   9863     var parser = _ref4.parser,
   9864         funcName = _ref4.funcName;
   9865     var body = args[0];
   9866     return {
   9867       type: "enclose",
   9868       mode: parser.mode,
   9869       label: funcName,
   9870       body: body
   9871     };
   9872   },
   9873   htmlBuilder: enclose_htmlBuilder,
   9874   mathmlBuilder: enclose_mathmlBuilder
   9875 });
   9876 defineFunction({
   9877   type: "enclose",
   9878   names: ["\\angl"],
   9879   props: {
   9880     numArgs: 1,
   9881     argTypes: ["hbox"],
   9882     allowedInText: false
   9883   },
   9884   handler: function handler(_ref5, args) {
   9885     var parser = _ref5.parser;
   9886     return {
   9887       type: "enclose",
   9888       mode: parser.mode,
   9889       label: "\\angl",
   9890       body: args[0]
   9891     };
   9892   }
   9893 });
   9894 ;// CONCATENATED MODULE: ./src/defineEnvironment.js
   9895 
   9896 
   9897 /**
   9898  * All registered environments.
   9899  * `environments.js` exports this same dictionary again and makes it public.
   9900  * `Parser.js` requires this dictionary via `environments.js`.
   9901  */
   9902 var _environments = {};
   9903 function defineEnvironment(_ref) {
   9904   var type = _ref.type,
   9905       names = _ref.names,
   9906       props = _ref.props,
   9907       handler = _ref.handler,
   9908       htmlBuilder = _ref.htmlBuilder,
   9909       mathmlBuilder = _ref.mathmlBuilder;
   9910   // Set default values of environments.
   9911   var data = {
   9912     type: type,
   9913     numArgs: props.numArgs || 0,
   9914     allowedInText: false,
   9915     numOptionalArgs: 0,
   9916     handler: handler
   9917   };
   9918 
   9919   for (var i = 0; i < names.length; ++i) {
   9920     // TODO: The value type of _environments should be a type union of all
   9921     // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is
   9922     // an existential type.
   9923     _environments[names[i]] = data;
   9924   }
   9925 
   9926   if (htmlBuilder) {
   9927     _htmlGroupBuilders[type] = htmlBuilder;
   9928   }
   9929 
   9930   if (mathmlBuilder) {
   9931     _mathmlGroupBuilders[type] = mathmlBuilder;
   9932   }
   9933 }
   9934 ;// CONCATENATED MODULE: ./src/environments/array.js
   9935 
   9936 
   9937 
   9938 
   9939 
   9940 
   9941 
   9942 
   9943 
   9944 
   9945 
   9946 
   9947 
   9948 
   9949 // Helper functions
   9950 function getHLines(parser) {
   9951   // Return an array. The array length = number of hlines.
   9952   // Each element in the array tells if the line is dashed.
   9953   var hlineInfo = [];
   9954   parser.consumeSpaces();
   9955   var nxt = parser.fetch().text;
   9956 
   9957   while (nxt === "\\hline" || nxt === "\\hdashline") {
   9958     parser.consume();
   9959     hlineInfo.push(nxt === "\\hdashline");
   9960     parser.consumeSpaces();
   9961     nxt = parser.fetch().text;
   9962   }
   9963 
   9964   return hlineInfo;
   9965 }
   9966 
   9967 var validateAmsEnvironmentContext = function validateAmsEnvironmentContext(context) {
   9968   var settings = context.parser.settings;
   9969 
   9970   if (!settings.displayMode) {
   9971     throw new src_ParseError("{" + context.envName + "} can be used only in" + " display mode.");
   9972   }
   9973 };
   9974 /**
   9975  * Parse the body of the environment, with rows delimited by \\ and
   9976  * columns delimited by &, and create a nested list in row-major order
   9977  * with one group per cell.  If given an optional argument style
   9978  * ("text", "display", etc.), then each cell is cast into that style.
   9979  */
   9980 
   9981 
   9982 function parseArray(parser, _ref, style) {
   9983   var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter,
   9984       addJot = _ref.addJot,
   9985       cols = _ref.cols,
   9986       arraystretch = _ref.arraystretch,
   9987       colSeparationType = _ref.colSeparationType,
   9988       addEqnNum = _ref.addEqnNum,
   9989       singleRow = _ref.singleRow,
   9990       maxNumCols = _ref.maxNumCols,
   9991       leqno = _ref.leqno;
   9992   parser.gullet.beginGroup();
   9993 
   9994   if (!singleRow) {
   9995     // \cr is equivalent to \\ without the optional size argument (see below)
   9996     // TODO: provide helpful error when \cr is used outside array environment
   9997     parser.gullet.macros.set("\\cr", "\\\\\\relax");
   9998   } // Get current arraystretch if it's not set by the environment
   9999 
  10000 
  10001   if (!arraystretch) {
  10002     var stretch = parser.gullet.expandMacroAsText("\\arraystretch");
  10003 
  10004     if (stretch == null) {
  10005       // Default \arraystretch from lttab.dtx
  10006       arraystretch = 1;
  10007     } else {
  10008       arraystretch = parseFloat(stretch);
  10009 
  10010       if (!arraystretch || arraystretch < 0) {
  10011         throw new src_ParseError("Invalid \\arraystretch: " + stretch);
  10012       }
  10013     }
  10014   } // Start group for first cell
  10015 
  10016 
  10017   parser.gullet.beginGroup();
  10018   var row = [];
  10019   var body = [row];
  10020   var rowGaps = [];
  10021   var hLinesBeforeRow = []; // Test for \hline at the top of the array.
  10022 
  10023   hLinesBeforeRow.push(getHLines(parser));
  10024 
  10025   while (true) {
  10026     // eslint-disable-line no-constant-condition
  10027     // Parse each cell in its own group (namespace)
  10028     var cell = parser.parseExpression(false, singleRow ? "\\end" : "\\\\");
  10029     parser.gullet.endGroup();
  10030     parser.gullet.beginGroup();
  10031     cell = {
  10032       type: "ordgroup",
  10033       mode: parser.mode,
  10034       body: cell
  10035     };
  10036 
  10037     if (style) {
  10038       cell = {
  10039         type: "styling",
  10040         mode: parser.mode,
  10041         style: style,
  10042         body: [cell]
  10043       };
  10044     }
  10045 
  10046     row.push(cell);
  10047     var next = parser.fetch().text;
  10048 
  10049     if (next === "&") {
  10050       if (maxNumCols && row.length === maxNumCols) {
  10051         if (singleRow || colSeparationType) {
  10052           // {equation} or {split}
  10053           throw new src_ParseError("Too many tab characters: &", parser.nextToken);
  10054         } else {
  10055           // {array} environment
  10056           parser.settings.reportNonstrict("textEnv", "Too few columns " + "specified in the {array} column argument.");
  10057         }
  10058       }
  10059 
  10060       parser.consume();
  10061     } else if (next === "\\end") {
  10062       // Arrays terminate newlines with `\crcr` which consumes a `\cr` if
  10063       // the last line is empty.
  10064       // NOTE: Currently, `cell` is the last item added into `row`.
  10065       if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0) {
  10066         body.pop();
  10067       }
  10068 
  10069       if (hLinesBeforeRow.length < body.length + 1) {
  10070         hLinesBeforeRow.push([]);
  10071       }
  10072 
  10073       break;
  10074     } else if (next === "\\\\") {
  10075       parser.consume();
  10076       var size = void 0; // \def\Let@{\let\\\math@cr}
  10077       // \def\math@cr{...\math@cr@}
  10078       // \def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}}
  10079       // \def\math@cr@@[#1]{...\math@cr@@@...}
  10080       // \def\math@cr@@@{\cr}
  10081 
  10082       if (parser.gullet.future().text !== " ") {
  10083         size = parser.parseSizeGroup(true);
  10084       }
  10085 
  10086       rowGaps.push(size ? size.value : null); // check for \hline(s) following the row separator
  10087 
  10088       hLinesBeforeRow.push(getHLines(parser));
  10089       row = [];
  10090       body.push(row);
  10091     } else {
  10092       throw new src_ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken);
  10093     }
  10094   } // End cell group
  10095 
  10096 
  10097   parser.gullet.endGroup(); // End array group defining \cr
  10098 
  10099   parser.gullet.endGroup();
  10100   return {
  10101     type: "array",
  10102     mode: parser.mode,
  10103     addJot: addJot,
  10104     arraystretch: arraystretch,
  10105     body: body,
  10106     cols: cols,
  10107     rowGaps: rowGaps,
  10108     hskipBeforeAndAfter: hskipBeforeAndAfter,
  10109     hLinesBeforeRow: hLinesBeforeRow,
  10110     colSeparationType: colSeparationType,
  10111     addEqnNum: addEqnNum,
  10112     leqno: leqno
  10113   };
  10114 } // Decides on a style for cells in an array according to whether the given
  10115 // environment name starts with the letter 'd'.
  10116 
  10117 
  10118 function dCellStyle(envName) {
  10119   if (envName.substr(0, 1) === "d") {
  10120     return "display";
  10121   } else {
  10122     return "text";
  10123   }
  10124 }
  10125 
  10126 var array_htmlBuilder = function htmlBuilder(group, options) {
  10127   var r;
  10128   var c;
  10129   var nr = group.body.length;
  10130   var hLinesBeforeRow = group.hLinesBeforeRow;
  10131   var nc = 0;
  10132   var body = new Array(nr);
  10133   var hlines = [];
  10134   var ruleThickness = Math.max( // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
  10135   options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override.
  10136   ); // Horizontal spacing
  10137 
  10138   var pt = 1 / options.fontMetrics().ptPerEm;
  10139   var arraycolsep = 5 * pt; // default value, i.e. \arraycolsep in article.cls
  10140 
  10141   if (group.colSeparationType && group.colSeparationType === "small") {
  10142     // We're in a {smallmatrix}. Default column space is \thickspace,
  10143     // i.e. 5/18em = 0.2778em, per amsmath.dtx for {smallmatrix}.
  10144     // But that needs adjustment because LaTeX applies \scriptstyle to the
  10145     // entire array, including the colspace, but this function applies
  10146     // \scriptstyle only inside each element.
  10147     var localMultiplier = options.havingStyle(src_Style.SCRIPT).sizeMultiplier;
  10148     arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier);
  10149   } // Vertical spacing
  10150 
  10151 
  10152   var baselineskip = group.colSeparationType === "CD" ? calculateSize({
  10153     number: 3,
  10154     unit: "ex"
  10155   }, options) : 12 * pt; // see size10.clo
  10156   // Default \jot from ltmath.dtx
  10157   // TODO(edemaine): allow overriding \jot via \setlength (#687)
  10158 
  10159   var jot = 3 * pt;
  10160   var arrayskip = group.arraystretch * baselineskip;
  10161   var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and
  10162 
  10163   var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx
  10164 
  10165   var totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any.
  10166 
  10167   function setHLinePos(hlinesInGap) {
  10168     for (var i = 0; i < hlinesInGap.length; ++i) {
  10169       if (i > 0) {
  10170         totalHeight += 0.25;
  10171       }
  10172 
  10173       hlines.push({
  10174         pos: totalHeight,
  10175         isDashed: hlinesInGap[i]
  10176       });
  10177     }
  10178   }
  10179 
  10180   setHLinePos(hLinesBeforeRow[0]);
  10181 
  10182   for (r = 0; r < group.body.length; ++r) {
  10183     var inrow = group.body[r];
  10184     var height = arstrutHeight; // \@array adds an \@arstrut
  10185 
  10186     var depth = arstrutDepth; // to each tow (via the template)
  10187 
  10188     if (nc < inrow.length) {
  10189       nc = inrow.length;
  10190     }
  10191 
  10192     var outrow = new Array(inrow.length);
  10193 
  10194     for (c = 0; c < inrow.length; ++c) {
  10195       var elt = buildGroup(inrow[c], options);
  10196 
  10197       if (depth < elt.depth) {
  10198         depth = elt.depth;
  10199       }
  10200 
  10201       if (height < elt.height) {
  10202         height = elt.height;
  10203       }
  10204 
  10205       outrow[c] = elt;
  10206     }
  10207 
  10208     var rowGap = group.rowGaps[r];
  10209     var gap = 0;
  10210 
  10211     if (rowGap) {
  10212       gap = calculateSize(rowGap, options);
  10213 
  10214       if (gap > 0) {
  10215         // \@argarraycr
  10216         gap += arstrutDepth;
  10217 
  10218         if (depth < gap) {
  10219           depth = gap; // \@xargarraycr
  10220         }
  10221 
  10222         gap = 0;
  10223       }
  10224     } // In AMS multiline environments such as aligned and gathered, rows
  10225     // correspond to lines that have additional \jot added to the
  10226     // \baselineskip via \openup.
  10227 
  10228 
  10229     if (group.addJot) {
  10230       depth += jot;
  10231     }
  10232 
  10233     outrow.height = height;
  10234     outrow.depth = depth;
  10235     totalHeight += height;
  10236     outrow.pos = totalHeight;
  10237     totalHeight += depth + gap; // \@yargarraycr
  10238 
  10239     body[r] = outrow; // Set a position for \hline(s), if any.
  10240 
  10241     setHLinePos(hLinesBeforeRow[r + 1]);
  10242   }
  10243 
  10244   var offset = totalHeight / 2 + options.fontMetrics().axisHeight;
  10245   var colDescriptions = group.cols || [];
  10246   var cols = [];
  10247   var colSep;
  10248   var colDescrNum;
  10249   var eqnNumSpans = [];
  10250 
  10251   if (group.addEqnNum) {
  10252     // An environment with automatic equation numbers.
  10253     // Create node(s) that will trigger CSS counter increment.
  10254     for (r = 0; r < nr; ++r) {
  10255       var rw = body[r];
  10256       var shift = rw.pos - offset;
  10257       var eqnTag = buildCommon.makeSpan(["eqn-num"], [], options);
  10258       eqnTag.depth = rw.depth;
  10259       eqnTag.height = rw.height;
  10260       eqnNumSpans.push({
  10261         type: "elem",
  10262         elem: eqnTag,
  10263         shift: shift
  10264       });
  10265     }
  10266   }
  10267 
  10268   for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column
  10269   // descriptions, so trailing separators don't get lost.
  10270   c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) {
  10271     var colDescr = colDescriptions[colDescrNum] || {};
  10272     var firstSeparator = true;
  10273 
  10274     while (colDescr.type === "separator") {
  10275       // If there is more than one separator in a row, add a space
  10276       // between them.
  10277       if (!firstSeparator) {
  10278         colSep = buildCommon.makeSpan(["arraycolsep"], []);
  10279         colSep.style.width = options.fontMetrics().doubleRuleSep + "em";
  10280         cols.push(colSep);
  10281       }
  10282 
  10283       if (colDescr.separator === "|" || colDescr.separator === ":") {
  10284         var lineType = colDescr.separator === "|" ? "solid" : "dashed";
  10285         var separator = buildCommon.makeSpan(["vertical-separator"], [], options);
  10286         separator.style.height = totalHeight + "em";
  10287         separator.style.borderRightWidth = ruleThickness + "em";
  10288         separator.style.borderRightStyle = lineType;
  10289         separator.style.margin = "0 -" + ruleThickness / 2 + "em";
  10290         separator.style.verticalAlign = -(totalHeight - offset) + "em";
  10291         cols.push(separator);
  10292       } else {
  10293         throw new src_ParseError("Invalid separator type: " + colDescr.separator);
  10294       }
  10295 
  10296       colDescrNum++;
  10297       colDescr = colDescriptions[colDescrNum] || {};
  10298       firstSeparator = false;
  10299     }
  10300 
  10301     if (c >= nc) {
  10302       continue;
  10303     }
  10304 
  10305     var sepwidth = void 0;
  10306 
  10307     if (c > 0 || group.hskipBeforeAndAfter) {
  10308       sepwidth = utils.deflt(colDescr.pregap, arraycolsep);
  10309 
  10310       if (sepwidth !== 0) {
  10311         colSep = buildCommon.makeSpan(["arraycolsep"], []);
  10312         colSep.style.width = sepwidth + "em";
  10313         cols.push(colSep);
  10314       }
  10315     }
  10316 
  10317     var col = [];
  10318 
  10319     for (r = 0; r < nr; ++r) {
  10320       var row = body[r];
  10321       var elem = row[c];
  10322 
  10323       if (!elem) {
  10324         continue;
  10325       }
  10326 
  10327       var _shift = row.pos - offset;
  10328 
  10329       elem.depth = row.depth;
  10330       elem.height = row.height;
  10331       col.push({
  10332         type: "elem",
  10333         elem: elem,
  10334         shift: _shift
  10335       });
  10336     }
  10337 
  10338     col = buildCommon.makeVList({
  10339       positionType: "individualShift",
  10340       children: col
  10341     }, options);
  10342     col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]);
  10343     cols.push(col);
  10344 
  10345     if (c < nc - 1 || group.hskipBeforeAndAfter) {
  10346       sepwidth = utils.deflt(colDescr.postgap, arraycolsep);
  10347 
  10348       if (sepwidth !== 0) {
  10349         colSep = buildCommon.makeSpan(["arraycolsep"], []);
  10350         colSep.style.width = sepwidth + "em";
  10351         cols.push(colSep);
  10352       }
  10353     }
  10354   }
  10355 
  10356   body = buildCommon.makeSpan(["mtable"], cols); // Add \hline(s), if any.
  10357 
  10358   if (hlines.length > 0) {
  10359     var line = buildCommon.makeLineSpan("hline", options, ruleThickness);
  10360     var dashes = buildCommon.makeLineSpan("hdashline", options, ruleThickness);
  10361     var vListElems = [{
  10362       type: "elem",
  10363       elem: body,
  10364       shift: 0
  10365     }];
  10366 
  10367     while (hlines.length > 0) {
  10368       var hline = hlines.pop();
  10369       var lineShift = hline.pos - offset;
  10370 
  10371       if (hline.isDashed) {
  10372         vListElems.push({
  10373           type: "elem",
  10374           elem: dashes,
  10375           shift: lineShift
  10376         });
  10377       } else {
  10378         vListElems.push({
  10379           type: "elem",
  10380           elem: line,
  10381           shift: lineShift
  10382         });
  10383       }
  10384     }
  10385 
  10386     body = buildCommon.makeVList({
  10387       positionType: "individualShift",
  10388       children: vListElems
  10389     }, options);
  10390   }
  10391 
  10392   if (!group.addEqnNum) {
  10393     return buildCommon.makeSpan(["mord"], [body], options);
  10394   } else {
  10395     var eqnNumCol = buildCommon.makeVList({
  10396       positionType: "individualShift",
  10397       children: eqnNumSpans
  10398     }, options);
  10399     eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options);
  10400     return buildCommon.makeFragment([body, eqnNumCol]);
  10401   }
  10402 };
  10403 
  10404 var alignMap = {
  10405   c: "center ",
  10406   l: "left ",
  10407   r: "right "
  10408 };
  10409 
  10410 var array_mathmlBuilder = function mathmlBuilder(group, options) {
  10411   var tbl = [];
  10412   var glue = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]);
  10413   var tag = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]);
  10414 
  10415   for (var i = 0; i < group.body.length; i++) {
  10416     var rw = group.body[i];
  10417     var row = [];
  10418 
  10419     for (var j = 0; j < rw.length; j++) {
  10420       row.push(new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(rw[j], options)]));
  10421     }
  10422 
  10423     if (group.addEqnNum) {
  10424       row.unshift(glue);
  10425       row.push(glue);
  10426 
  10427       if (group.leqno) {
  10428         row.unshift(tag);
  10429       } else {
  10430         row.push(tag);
  10431       }
  10432     }
  10433 
  10434     tbl.push(new mathMLTree.MathNode("mtr", row));
  10435   }
  10436 
  10437   var table = new mathMLTree.MathNode("mtable", tbl); // Set column alignment, row spacing, column spacing, and
  10438   // array lines by setting attributes on the table element.
  10439   // Set the row spacing. In MathML, we specify a gap distance.
  10440   // We do not use rowGap[] because MathML automatically increases
  10441   // cell height with the height/depth of the element content.
  10442   // LaTeX \arraystretch multiplies the row baseline-to-baseline distance.
  10443   // We simulate this by adding (arraystretch - 1)em to the gap. This
  10444   // does a reasonable job of adjusting arrays containing 1 em tall content.
  10445   // The 0.16 and 0.09 values are found emprically. They produce an array
  10446   // similar to LaTeX and in which content does not interfere with \hines.
  10447 
  10448   var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray}
  10449   : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
  10450   table.setAttribute("rowspacing", gap.toFixed(4) + "em"); // MathML table lines go only between cells.
  10451   // To place a line on an edge we'll use <menclose>, if necessary.
  10452 
  10453   var menclose = "";
  10454   var align = "";
  10455 
  10456   if (group.cols && group.cols.length > 0) {
  10457     // Find column alignment, column spacing, and  vertical lines.
  10458     var cols = group.cols;
  10459     var columnLines = "";
  10460     var prevTypeWasAlign = false;
  10461     var iStart = 0;
  10462     var iEnd = cols.length;
  10463 
  10464     if (cols[0].type === "separator") {
  10465       menclose += "top ";
  10466       iStart = 1;
  10467     }
  10468 
  10469     if (cols[cols.length - 1].type === "separator") {
  10470       menclose += "bottom ";
  10471       iEnd -= 1;
  10472     }
  10473 
  10474     for (var _i = iStart; _i < iEnd; _i++) {
  10475       if (cols[_i].type === "align") {
  10476         align += alignMap[cols[_i].align];
  10477 
  10478         if (prevTypeWasAlign) {
  10479           columnLines += "none ";
  10480         }
  10481 
  10482         prevTypeWasAlign = true;
  10483       } else if (cols[_i].type === "separator") {
  10484         // MathML accepts only single lines between cells.
  10485         // So we read only the first of consecutive separators.
  10486         if (prevTypeWasAlign) {
  10487           columnLines += cols[_i].separator === "|" ? "solid " : "dashed ";
  10488           prevTypeWasAlign = false;
  10489         }
  10490       }
  10491     }
  10492 
  10493     table.setAttribute("columnalign", align.trim());
  10494 
  10495     if (/[sd]/.test(columnLines)) {
  10496       table.setAttribute("columnlines", columnLines.trim());
  10497     }
  10498   } // Set column spacing.
  10499 
  10500 
  10501   if (group.colSeparationType === "align") {
  10502     var _cols = group.cols || [];
  10503 
  10504     var spacing = "";
  10505 
  10506     for (var _i2 = 1; _i2 < _cols.length; _i2++) {
  10507       spacing += _i2 % 2 ? "0em " : "1em ";
  10508     }
  10509 
  10510     table.setAttribute("columnspacing", spacing.trim());
  10511   } else if (group.colSeparationType === "alignat" || group.colSeparationType === "gather") {
  10512     table.setAttribute("columnspacing", "0em");
  10513   } else if (group.colSeparationType === "small") {
  10514     table.setAttribute("columnspacing", "0.2778em");
  10515   } else if (group.colSeparationType === "CD") {
  10516     table.setAttribute("columnspacing", "0.5em");
  10517   } else {
  10518     table.setAttribute("columnspacing", "1em");
  10519   } // Address \hline and \hdashline
  10520 
  10521 
  10522   var rowLines = "";
  10523   var hlines = group.hLinesBeforeRow;
  10524   menclose += hlines[0].length > 0 ? "left " : "";
  10525   menclose += hlines[hlines.length - 1].length > 0 ? "right " : "";
  10526 
  10527   for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) {
  10528     rowLines += hlines[_i3].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element.
  10529     : hlines[_i3][0] ? "dashed " : "solid ";
  10530   }
  10531 
  10532   if (/[sd]/.test(rowLines)) {
  10533     table.setAttribute("rowlines", rowLines.trim());
  10534   }
  10535 
  10536   if (menclose !== "") {
  10537     table = new mathMLTree.MathNode("menclose", [table]);
  10538     table.setAttribute("notation", menclose.trim());
  10539   }
  10540 
  10541   if (group.arraystretch && group.arraystretch < 1) {
  10542     // A small array. Wrap in scriptstyle so row gap is not too large.
  10543     table = new mathMLTree.MathNode("mstyle", [table]);
  10544     table.setAttribute("scriptlevel", "1");
  10545   }
  10546 
  10547   return table;
  10548 }; // Convenience function for align, align*, aligned, alignat, alignat*, alignedat.
  10549 
  10550 
  10551 var alignedHandler = function alignedHandler(context, args) {
  10552   if (context.envName.indexOf("ed") === -1) {
  10553     validateAmsEnvironmentContext(context);
  10554   }
  10555 
  10556   var cols = [];
  10557   var separationType = context.envName.indexOf("at") > -1 ? "alignat" : "align";
  10558   var res = parseArray(context.parser, {
  10559     cols: cols,
  10560     addJot: true,
  10561     addEqnNum: context.envName === "align" || context.envName === "alignat",
  10562     colSeparationType: separationType,
  10563     maxNumCols: context.envName === "split" ? 2 : undefined,
  10564     leqno: context.parser.settings.leqno
  10565   }, "display"); // Determining number of columns.
  10566   // 1. If the first argument is given, we use it as a number of columns,
  10567   //    and makes sure that each row doesn't exceed that number.
  10568   // 2. Otherwise, just count number of columns = maximum number
  10569   //    of cells in each row ("aligned" mode -- isAligned will be true).
  10570   //
  10571   // At the same time, prepend empty group {} at beginning of every second
  10572   // cell in each row (starting with second cell) so that operators become
  10573   // binary.  This behavior is implemented in amsmath's \start@aligned.
  10574 
  10575   var numMaths;
  10576   var numCols = 0;
  10577   var emptyGroup = {
  10578     type: "ordgroup",
  10579     mode: context.mode,
  10580     body: []
  10581   };
  10582 
  10583   if (args[0] && args[0].type === "ordgroup") {
  10584     var arg0 = "";
  10585 
  10586     for (var i = 0; i < args[0].body.length; i++) {
  10587       var textord = assertNodeType(args[0].body[i], "textord");
  10588       arg0 += textord.text;
  10589     }
  10590 
  10591     numMaths = Number(arg0);
  10592     numCols = numMaths * 2;
  10593   }
  10594 
  10595   var isAligned = !numCols;
  10596   res.body.forEach(function (row) {
  10597     for (var _i4 = 1; _i4 < row.length; _i4 += 2) {
  10598       // Modify ordgroup node within styling node
  10599       var styling = assertNodeType(row[_i4], "styling");
  10600       var ordgroup = assertNodeType(styling.body[0], "ordgroup");
  10601       ordgroup.body.unshift(emptyGroup);
  10602     }
  10603 
  10604     if (!isAligned) {
  10605       // Case 1
  10606       var curMaths = row.length / 2;
  10607 
  10608       if (numMaths < curMaths) {
  10609         throw new src_ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]);
  10610       }
  10611     } else if (numCols < row.length) {
  10612       // Case 2
  10613       numCols = row.length;
  10614     }
  10615   }); // Adjusting alignment.
  10616   // In aligned mode, we add one \qquad between columns;
  10617   // otherwise we add nothing.
  10618 
  10619   for (var _i5 = 0; _i5 < numCols; ++_i5) {
  10620     var align = "r";
  10621     var pregap = 0;
  10622 
  10623     if (_i5 % 2 === 1) {
  10624       align = "l";
  10625     } else if (_i5 > 0 && isAligned) {
  10626       // "aligned" mode.
  10627       pregap = 1; // add one \quad
  10628     }
  10629 
  10630     cols[_i5] = {
  10631       type: "align",
  10632       align: align,
  10633       pregap: pregap,
  10634       postgap: 0
  10635     };
  10636   }
  10637 
  10638   res.colSeparationType = isAligned ? "align" : "alignat";
  10639   return res;
  10640 }; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation
  10641 // is part of the source2e.pdf file of LaTeX2e source documentation.
  10642 // {darray} is an {array} environment where cells are set in \displaystyle,
  10643 // as defined in nccmath.sty.
  10644 
  10645 
  10646 defineEnvironment({
  10647   type: "array",
  10648   names: ["array", "darray"],
  10649   props: {
  10650     numArgs: 1
  10651   },
  10652   handler: function handler(context, args) {
  10653     // Since no types are specified above, the two possibilities are
  10654     // - The argument is wrapped in {} or [], in which case Parser's
  10655     //   parseGroup() returns an "ordgroup" wrapping some symbol node.
  10656     // - The argument is a bare symbol node.
  10657     var symNode = checkSymbolNodeType(args[0]);
  10658     var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
  10659     var cols = colalign.map(function (nde) {
  10660       var node = assertSymbolNodeType(nde);
  10661       var ca = node.text;
  10662 
  10663       if ("lcr".indexOf(ca) !== -1) {
  10664         return {
  10665           type: "align",
  10666           align: ca
  10667         };
  10668       } else if (ca === "|") {
  10669         return {
  10670           type: "separator",
  10671           separator: "|"
  10672         };
  10673       } else if (ca === ":") {
  10674         return {
  10675           type: "separator",
  10676           separator: ":"
  10677         };
  10678       }
  10679 
  10680       throw new src_ParseError("Unknown column alignment: " + ca, nde);
  10681     });
  10682     var res = {
  10683       cols: cols,
  10684       hskipBeforeAndAfter: true,
  10685       // \@preamble in lttab.dtx
  10686       maxNumCols: cols.length
  10687     };
  10688     return parseArray(context.parser, res, dCellStyle(context.envName));
  10689   },
  10690   htmlBuilder: array_htmlBuilder,
  10691   mathmlBuilder: array_mathmlBuilder
  10692 }); // The matrix environments of amsmath builds on the array environment
  10693 // of LaTeX, which is discussed above.
  10694 // The mathtools package adds starred versions of the same environments.
  10695 // These have an optional argument to choose left|center|right justification.
  10696 
  10697 defineEnvironment({
  10698   type: "array",
  10699   names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"],
  10700   props: {
  10701     numArgs: 0
  10702   },
  10703   handler: function handler(context) {
  10704     var delimiters = {
  10705       "matrix": null,
  10706       "pmatrix": ["(", ")"],
  10707       "bmatrix": ["[", "]"],
  10708       "Bmatrix": ["\\{", "\\}"],
  10709       "vmatrix": ["|", "|"],
  10710       "Vmatrix": ["\\Vert", "\\Vert"]
  10711     }[context.envName.replace("*", "")]; // \hskip -\arraycolsep in amsmath
  10712 
  10713     var colAlign = "c";
  10714     var payload = {
  10715       hskipBeforeAndAfter: false,
  10716       cols: [{
  10717         type: "align",
  10718         align: colAlign
  10719       }]
  10720     };
  10721 
  10722     if (context.envName.charAt(context.envName.length - 1) === "*") {
  10723       // It's one of the mathtools starred functions.
  10724       // Parse the optional alignment argument.
  10725       var parser = context.parser;
  10726       parser.consumeSpaces();
  10727 
  10728       if (parser.fetch().text === "[") {
  10729         parser.consume();
  10730         parser.consumeSpaces();
  10731         colAlign = parser.fetch().text;
  10732 
  10733         if ("lcr".indexOf(colAlign) === -1) {
  10734           throw new src_ParseError("Expected l or c or r", parser.nextToken);
  10735         }
  10736 
  10737         parser.consume();
  10738         parser.consumeSpaces();
  10739         parser.expect("]");
  10740         parser.consume();
  10741         payload.cols = [{
  10742           type: "align",
  10743           align: colAlign
  10744         }];
  10745       }
  10746     }
  10747 
  10748     var res = parseArray(context.parser, payload, dCellStyle(context.envName)); // Populate cols with the correct number of column alignment specs.
  10749 
  10750     res.cols = new Array(res.body[0].length).fill({
  10751       type: "align",
  10752       align: colAlign
  10753     });
  10754     return delimiters ? {
  10755       type: "leftright",
  10756       mode: context.mode,
  10757       body: [res],
  10758       left: delimiters[0],
  10759       right: delimiters[1],
  10760       rightColor: undefined // \right uninfluenced by \color in array
  10761 
  10762     } : res;
  10763   },
  10764   htmlBuilder: array_htmlBuilder,
  10765   mathmlBuilder: array_mathmlBuilder
  10766 });
  10767 defineEnvironment({
  10768   type: "array",
  10769   names: ["smallmatrix"],
  10770   props: {
  10771     numArgs: 0
  10772   },
  10773   handler: function handler(context) {
  10774     var payload = {
  10775       arraystretch: 0.5
  10776     };
  10777     var res = parseArray(context.parser, payload, "script");
  10778     res.colSeparationType = "small";
  10779     return res;
  10780   },
  10781   htmlBuilder: array_htmlBuilder,
  10782   mathmlBuilder: array_mathmlBuilder
  10783 });
  10784 defineEnvironment({
  10785   type: "array",
  10786   names: ["subarray"],
  10787   props: {
  10788     numArgs: 1
  10789   },
  10790   handler: function handler(context, args) {
  10791     // Parsing of {subarray} is similar to {array}
  10792     var symNode = checkSymbolNodeType(args[0]);
  10793     var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
  10794     var cols = colalign.map(function (nde) {
  10795       var node = assertSymbolNodeType(nde);
  10796       var ca = node.text; // {subarray} only recognizes "l" & "c"
  10797 
  10798       if ("lc".indexOf(ca) !== -1) {
  10799         return {
  10800           type: "align",
  10801           align: ca
  10802         };
  10803       }
  10804 
  10805       throw new src_ParseError("Unknown column alignment: " + ca, nde);
  10806     });
  10807 
  10808     if (cols.length > 1) {
  10809       throw new src_ParseError("{subarray} can contain only one column");
  10810     }
  10811 
  10812     var res = {
  10813       cols: cols,
  10814       hskipBeforeAndAfter: false,
  10815       arraystretch: 0.5
  10816     };
  10817     res = parseArray(context.parser, res, "script");
  10818 
  10819     if (res.body.length > 0 && res.body[0].length > 1) {
  10820       throw new src_ParseError("{subarray} can contain only one column");
  10821     }
  10822 
  10823     return res;
  10824   },
  10825   htmlBuilder: array_htmlBuilder,
  10826   mathmlBuilder: array_mathmlBuilder
  10827 }); // A cases environment (in amsmath.sty) is almost equivalent to
  10828 // \def\arraystretch{1.2}%
  10829 // \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right.
  10830 // {dcases} is a {cases} environment where cells are set in \displaystyle,
  10831 // as defined in mathtools.sty.
  10832 // {rcases} is another mathtools environment. It's brace is on the right side.
  10833 
  10834 defineEnvironment({
  10835   type: "array",
  10836   names: ["cases", "dcases", "rcases", "drcases"],
  10837   props: {
  10838     numArgs: 0
  10839   },
  10840   handler: function handler(context) {
  10841     var payload = {
  10842       arraystretch: 1.2,
  10843       cols: [{
  10844         type: "align",
  10845         align: "l",
  10846         pregap: 0,
  10847         // TODO(kevinb) get the current style.
  10848         // For now we use the metrics for TEXT style which is what we were
  10849         // doing before.  Before attempting to get the current style we
  10850         // should look at TeX's behavior especially for \over and matrices.
  10851         postgap: 1.0
  10852         /* 1em quad */
  10853 
  10854       }, {
  10855         type: "align",
  10856         align: "l",
  10857         pregap: 0,
  10858         postgap: 0
  10859       }]
  10860     };
  10861     var res = parseArray(context.parser, payload, dCellStyle(context.envName));
  10862     return {
  10863       type: "leftright",
  10864       mode: context.mode,
  10865       body: [res],
  10866       left: context.envName.indexOf("r") > -1 ? "." : "\\{",
  10867       right: context.envName.indexOf("r") > -1 ? "\\}" : ".",
  10868       rightColor: undefined
  10869     };
  10870   },
  10871   htmlBuilder: array_htmlBuilder,
  10872   mathmlBuilder: array_mathmlBuilder
  10873 }); // In the align environment, one uses ampersands, &, to specify number of
  10874 // columns in each row, and to locate spacing between each column.
  10875 // align gets automatic numbering. align* and aligned do not.
  10876 // The alignedat environment can be used in math mode.
  10877 // Note that we assume \nomallineskiplimit to be zero,
  10878 // so that \strut@ is the same as \strut.
  10879 
  10880 defineEnvironment({
  10881   type: "array",
  10882   names: ["align", "align*", "aligned", "split"],
  10883   props: {
  10884     numArgs: 0
  10885   },
  10886   handler: alignedHandler,
  10887   htmlBuilder: array_htmlBuilder,
  10888   mathmlBuilder: array_mathmlBuilder
  10889 }); // A gathered environment is like an array environment with one centered
  10890 // column, but where rows are considered lines so get \jot line spacing
  10891 // and contents are set in \displaystyle.
  10892 
  10893 defineEnvironment({
  10894   type: "array",
  10895   names: ["gathered", "gather", "gather*"],
  10896   props: {
  10897     numArgs: 0
  10898   },
  10899   handler: function handler(context) {
  10900     if (utils.contains(["gather", "gather*"], context.envName)) {
  10901       validateAmsEnvironmentContext(context);
  10902     }
  10903 
  10904     var res = {
  10905       cols: [{
  10906         type: "align",
  10907         align: "c"
  10908       }],
  10909       addJot: true,
  10910       colSeparationType: "gather",
  10911       addEqnNum: context.envName === "gather",
  10912       leqno: context.parser.settings.leqno
  10913     };
  10914     return parseArray(context.parser, res, "display");
  10915   },
  10916   htmlBuilder: array_htmlBuilder,
  10917   mathmlBuilder: array_mathmlBuilder
  10918 }); // alignat environment is like an align environment, but one must explicitly
  10919 // specify maximum number of columns in each row, and can adjust spacing between
  10920 // each columns.
  10921 
  10922 defineEnvironment({
  10923   type: "array",
  10924   names: ["alignat", "alignat*", "alignedat"],
  10925   props: {
  10926     numArgs: 1
  10927   },
  10928   handler: alignedHandler,
  10929   htmlBuilder: array_htmlBuilder,
  10930   mathmlBuilder: array_mathmlBuilder
  10931 });
  10932 defineEnvironment({
  10933   type: "array",
  10934   names: ["equation", "equation*"],
  10935   props: {
  10936     numArgs: 0
  10937   },
  10938   handler: function handler(context) {
  10939     validateAmsEnvironmentContext(context);
  10940     var res = {
  10941       addEqnNum: context.envName === "equation",
  10942       singleRow: true,
  10943       maxNumCols: 1,
  10944       leqno: context.parser.settings.leqno
  10945     };
  10946     return parseArray(context.parser, res, "display");
  10947   },
  10948   htmlBuilder: array_htmlBuilder,
  10949   mathmlBuilder: array_mathmlBuilder
  10950 });
  10951 defineEnvironment({
  10952   type: "array",
  10953   names: ["CD"],
  10954   props: {
  10955     numArgs: 0
  10956   },
  10957   handler: function handler(context) {
  10958     validateAmsEnvironmentContext(context);
  10959     return parseCD(context.parser);
  10960   },
  10961   htmlBuilder: array_htmlBuilder,
  10962   mathmlBuilder: array_mathmlBuilder
  10963 }); // Catch \hline outside array environment
  10964 
  10965 defineFunction({
  10966   type: "text",
  10967   // Doesn't matter what this is.
  10968   names: ["\\hline", "\\hdashline"],
  10969   props: {
  10970     numArgs: 0,
  10971     allowedInText: true,
  10972     allowedInMath: true
  10973   },
  10974   handler: function handler(context, args) {
  10975     throw new src_ParseError(context.funcName + " valid only within array environment");
  10976   }
  10977 });
  10978 ;// CONCATENATED MODULE: ./src/environments.js
  10979 
  10980 var environments = _environments;
  10981 /* harmony default export */ var src_environments = (environments); // All environment definitions should be imported below
  10982 
  10983 
  10984 ;// CONCATENATED MODULE: ./src/functions/environment.js
  10985 
  10986 
  10987 
  10988  // Environment delimiters. HTML/MathML rendering is defined in the corresponding
  10989 // defineEnvironment definitions.
  10990 
  10991 defineFunction({
  10992   type: "environment",
  10993   names: ["\\begin", "\\end"],
  10994   props: {
  10995     numArgs: 1,
  10996     argTypes: ["text"]
  10997   },
  10998   handler: function handler(_ref, args) {
  10999     var parser = _ref.parser,
  11000         funcName = _ref.funcName;
  11001     var nameGroup = args[0];
  11002 
  11003     if (nameGroup.type !== "ordgroup") {
  11004       throw new src_ParseError("Invalid environment name", nameGroup);
  11005     }
  11006 
  11007     var envName = "";
  11008 
  11009     for (var i = 0; i < nameGroup.body.length; ++i) {
  11010       envName += assertNodeType(nameGroup.body[i], "textord").text;
  11011     }
  11012 
  11013     if (funcName === "\\begin") {
  11014       // begin...end is similar to left...right
  11015       if (!src_environments.hasOwnProperty(envName)) {
  11016         throw new src_ParseError("No such environment: " + envName, nameGroup);
  11017       } // Build the environment object. Arguments and other information will
  11018       // be made available to the begin and end methods using properties.
  11019 
  11020 
  11021       var env = src_environments[envName];
  11022 
  11023       var _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env),
  11024           _args = _parser$parseArgument.args,
  11025           optArgs = _parser$parseArgument.optArgs;
  11026 
  11027       var context = {
  11028         mode: parser.mode,
  11029         envName: envName,
  11030         parser: parser
  11031       };
  11032       var result = env.handler(context, _args, optArgs);
  11033       parser.expect("\\end", false);
  11034       var endNameToken = parser.nextToken;
  11035       var end = assertNodeType(parser.parseFunction(), "environment");
  11036 
  11037       if (end.name !== envName) {
  11038         throw new src_ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end.name + "}", endNameToken);
  11039       } // $FlowFixMe, "environment" handler returns an environment ParseNode
  11040 
  11041 
  11042       return result;
  11043     }
  11044 
  11045     return {
  11046       type: "environment",
  11047       mode: parser.mode,
  11048       name: envName,
  11049       nameGroup: nameGroup
  11050     };
  11051   }
  11052 });
  11053 ;// CONCATENATED MODULE: ./src/functions/mclass.js
  11054 
  11055 
  11056 
  11057 
  11058 
  11059 
  11060 var mclass_makeSpan = buildCommon.makeSpan;
  11061 
  11062 function mclass_htmlBuilder(group, options) {
  11063   var elements = buildExpression(group.body, options, true);
  11064   return mclass_makeSpan([group.mclass], elements, options);
  11065 }
  11066 
  11067 function mclass_mathmlBuilder(group, options) {
  11068   var node;
  11069   var inner = buildMathML_buildExpression(group.body, options);
  11070 
  11071   if (group.mclass === "minner") {
  11072     return mathMLTree.newDocumentFragment(inner);
  11073   } else if (group.mclass === "mord") {
  11074     if (group.isCharacterBox) {
  11075       node = inner[0];
  11076       node.type = "mi";
  11077     } else {
  11078       node = new mathMLTree.MathNode("mi", inner);
  11079     }
  11080   } else {
  11081     if (group.isCharacterBox) {
  11082       node = inner[0];
  11083       node.type = "mo";
  11084     } else {
  11085       node = new mathMLTree.MathNode("mo", inner);
  11086     } // Set spacing based on what is the most likely adjacent atom type.
  11087     // See TeXbook p170.
  11088 
  11089 
  11090     if (group.mclass === "mbin") {
  11091       node.attributes.lspace = "0.22em"; // medium space
  11092 
  11093       node.attributes.rspace = "0.22em";
  11094     } else if (group.mclass === "mpunct") {
  11095       node.attributes.lspace = "0em";
  11096       node.attributes.rspace = "0.17em"; // thinspace
  11097     } else if (group.mclass === "mopen" || group.mclass === "mclose") {
  11098       node.attributes.lspace = "0em";
  11099       node.attributes.rspace = "0em";
  11100     } // MathML <mo> default space is 5/18 em, so <mrel> needs no action.
  11101     // Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo
  11102 
  11103   }
  11104 
  11105   return node;
  11106 } // Math class commands except \mathop
  11107 
  11108 
  11109 defineFunction({
  11110   type: "mclass",
  11111   names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
  11112   props: {
  11113     numArgs: 1,
  11114     primitive: true
  11115   },
  11116   handler: function handler(_ref, args) {
  11117     var parser = _ref.parser,
  11118         funcName = _ref.funcName;
  11119     var body = args[0];
  11120     return {
  11121       type: "mclass",
  11122       mode: parser.mode,
  11123       mclass: "m" + funcName.substr(5),
  11124       // TODO(kevinb): don't prefix with 'm'
  11125       body: ordargument(body),
  11126       isCharacterBox: utils.isCharacterBox(body)
  11127     };
  11128   },
  11129   htmlBuilder: mclass_htmlBuilder,
  11130   mathmlBuilder: mclass_mathmlBuilder
  11131 });
  11132 var binrelClass = function binrelClass(arg) {
  11133   // \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument.
  11134   // (by rendering separately and with {}s before and after, and measuring
  11135   // the change in spacing).  We'll do roughly the same by detecting the
  11136   // atom type directly.
  11137   var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg;
  11138 
  11139   if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) {
  11140     return "m" + atom.family;
  11141   } else {
  11142     return "mord";
  11143   }
  11144 }; // \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord.
  11145 // This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX.
  11146 
  11147 defineFunction({
  11148   type: "mclass",
  11149   names: ["\\@binrel"],
  11150   props: {
  11151     numArgs: 2
  11152   },
  11153   handler: function handler(_ref2, args) {
  11154     var parser = _ref2.parser;
  11155     return {
  11156       type: "mclass",
  11157       mode: parser.mode,
  11158       mclass: binrelClass(args[0]),
  11159       body: ordargument(args[1]),
  11160       isCharacterBox: utils.isCharacterBox(args[1])
  11161     };
  11162   }
  11163 }); // Build a relation or stacked op by placing one symbol on top of another
  11164 
  11165 defineFunction({
  11166   type: "mclass",
  11167   names: ["\\stackrel", "\\overset", "\\underset"],
  11168   props: {
  11169     numArgs: 2
  11170   },
  11171   handler: function handler(_ref3, args) {
  11172     var parser = _ref3.parser,
  11173         funcName = _ref3.funcName;
  11174     var baseArg = args[1];
  11175     var shiftedArg = args[0];
  11176     var mclass;
  11177 
  11178     if (funcName !== "\\stackrel") {
  11179       // LaTeX applies \binrel spacing to \overset and \underset.
  11180       mclass = binrelClass(baseArg);
  11181     } else {
  11182       mclass = "mrel"; // for \stackrel
  11183     }
  11184 
  11185     var baseOp = {
  11186       type: "op",
  11187       mode: baseArg.mode,
  11188       limits: true,
  11189       alwaysHandleSupSub: true,
  11190       parentIsSupSub: false,
  11191       symbol: false,
  11192       suppressBaseShift: funcName !== "\\stackrel",
  11193       body: ordargument(baseArg)
  11194     };
  11195     var supsub = {
  11196       type: "supsub",
  11197       mode: shiftedArg.mode,
  11198       base: baseOp,
  11199       sup: funcName === "\\underset" ? null : shiftedArg,
  11200       sub: funcName === "\\underset" ? shiftedArg : null
  11201     };
  11202     return {
  11203       type: "mclass",
  11204       mode: parser.mode,
  11205       mclass: mclass,
  11206       body: [supsub],
  11207       isCharacterBox: utils.isCharacterBox(supsub)
  11208     };
  11209   },
  11210   htmlBuilder: mclass_htmlBuilder,
  11211   mathmlBuilder: mclass_mathmlBuilder
  11212 });
  11213 ;// CONCATENATED MODULE: ./src/functions/font.js
  11214 // TODO(kevinb): implement \\sl and \\sc
  11215 
  11216 
  11217 
  11218 
  11219 
  11220 
  11221 var font_htmlBuilder = function htmlBuilder(group, options) {
  11222   var font = group.font;
  11223   var newOptions = options.withFont(font);
  11224   return buildGroup(group.body, newOptions);
  11225 };
  11226 
  11227 var font_mathmlBuilder = function mathmlBuilder(group, options) {
  11228   var font = group.font;
  11229   var newOptions = options.withFont(font);
  11230   return buildMathML_buildGroup(group.body, newOptions);
  11231 };
  11232 
  11233 var fontAliases = {
  11234   "\\Bbb": "\\mathbb",
  11235   "\\bold": "\\mathbf",
  11236   "\\frak": "\\mathfrak",
  11237   "\\bm": "\\boldsymbol"
  11238 };
  11239 defineFunction({
  11240   type: "font",
  11241   names: [// styles, except \boldsymbol defined below
  11242   "\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", // families
  11243   "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", // aliases, except \bm defined below
  11244   "\\Bbb", "\\bold", "\\frak"],
  11245   props: {
  11246     numArgs: 1,
  11247     allowedInArgument: true
  11248   },
  11249   handler: function handler(_ref, args) {
  11250     var parser = _ref.parser,
  11251         funcName = _ref.funcName;
  11252     var body = normalizeArgument(args[0]);
  11253     var func = funcName;
  11254 
  11255     if (func in fontAliases) {
  11256       func = fontAliases[func];
  11257     }
  11258 
  11259     return {
  11260       type: "font",
  11261       mode: parser.mode,
  11262       font: func.slice(1),
  11263       body: body
  11264     };
  11265   },
  11266   htmlBuilder: font_htmlBuilder,
  11267   mathmlBuilder: font_mathmlBuilder
  11268 });
  11269 defineFunction({
  11270   type: "mclass",
  11271   names: ["\\boldsymbol", "\\bm"],
  11272   props: {
  11273     numArgs: 1
  11274   },
  11275   handler: function handler(_ref2, args) {
  11276     var parser = _ref2.parser;
  11277     var body = args[0];
  11278     var isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the
  11279     // argument's bin|rel|ord status
  11280 
  11281     return {
  11282       type: "mclass",
  11283       mode: parser.mode,
  11284       mclass: binrelClass(body),
  11285       body: [{
  11286         type: "font",
  11287         mode: parser.mode,
  11288         font: "boldsymbol",
  11289         body: body
  11290       }],
  11291       isCharacterBox: isCharacterBox
  11292     };
  11293   }
  11294 }); // Old font changing functions
  11295 
  11296 defineFunction({
  11297   type: "font",
  11298   names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"],
  11299   props: {
  11300     numArgs: 0,
  11301     allowedInText: true
  11302   },
  11303   handler: function handler(_ref3, args) {
  11304     var parser = _ref3.parser,
  11305         funcName = _ref3.funcName,
  11306         breakOnTokenText = _ref3.breakOnTokenText;
  11307     var mode = parser.mode;
  11308     var body = parser.parseExpression(true, breakOnTokenText);
  11309     var style = "math" + funcName.slice(1);
  11310     return {
  11311       type: "font",
  11312       mode: mode,
  11313       font: style,
  11314       body: {
  11315         type: "ordgroup",
  11316         mode: parser.mode,
  11317         body: body
  11318       }
  11319     };
  11320   },
  11321   htmlBuilder: font_htmlBuilder,
  11322   mathmlBuilder: font_mathmlBuilder
  11323 });
  11324 ;// CONCATENATED MODULE: ./src/functions/genfrac.js
  11325 
  11326 
  11327 
  11328 
  11329 
  11330 
  11331 
  11332 
  11333 
  11334 
  11335 
  11336 var adjustStyle = function adjustStyle(size, originalStyle) {
  11337   // Figure out what style this fraction should be in based on the
  11338   // function used
  11339   var style = originalStyle;
  11340 
  11341   if (size === "display") {
  11342     // Get display style as a default.
  11343     // If incoming style is sub/sup, use style.text() to get correct size.
  11344     style = style.id >= src_Style.SCRIPT.id ? style.text() : src_Style.DISPLAY;
  11345   } else if (size === "text" && style.size === src_Style.DISPLAY.size) {
  11346     // We're in a \tfrac but incoming style is displaystyle, so:
  11347     style = src_Style.TEXT;
  11348   } else if (size === "script") {
  11349     style = src_Style.SCRIPT;
  11350   } else if (size === "scriptscript") {
  11351     style = src_Style.SCRIPTSCRIPT;
  11352   }
  11353 
  11354   return style;
  11355 };
  11356 
  11357 var genfrac_htmlBuilder = function htmlBuilder(group, options) {
  11358   // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).
  11359   var style = adjustStyle(group.size, options.style);
  11360   var nstyle = style.fracNum();
  11361   var dstyle = style.fracDen();
  11362   var newOptions;
  11363   newOptions = options.havingStyle(nstyle);
  11364   var numerm = buildGroup(group.numer, newOptions, options);
  11365 
  11366   if (group.continued) {
  11367     // \cfrac inserts a \strut into the numerator.
  11368     // Get \strut dimensions from TeXbook page 353.
  11369     var hStrut = 8.5 / options.fontMetrics().ptPerEm;
  11370     var dStrut = 3.5 / options.fontMetrics().ptPerEm;
  11371     numerm.height = numerm.height < hStrut ? hStrut : numerm.height;
  11372     numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth;
  11373   }
  11374 
  11375   newOptions = options.havingStyle(dstyle);
  11376   var denomm = buildGroup(group.denom, newOptions, options);
  11377   var rule;
  11378   var ruleWidth;
  11379   var ruleSpacing;
  11380 
  11381   if (group.hasBarLine) {
  11382     if (group.barSize) {
  11383       ruleWidth = calculateSize(group.barSize, options);
  11384       rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth);
  11385     } else {
  11386       rule = buildCommon.makeLineSpan("frac-line", options);
  11387     }
  11388 
  11389     ruleWidth = rule.height;
  11390     ruleSpacing = rule.height;
  11391   } else {
  11392     rule = null;
  11393     ruleWidth = 0;
  11394     ruleSpacing = options.fontMetrics().defaultRuleThickness;
  11395   } // Rule 15b
  11396 
  11397 
  11398   var numShift;
  11399   var clearance;
  11400   var denomShift;
  11401 
  11402   if (style.size === src_Style.DISPLAY.size || group.size === "display") {
  11403     numShift = options.fontMetrics().num1;
  11404 
  11405     if (ruleWidth > 0) {
  11406       clearance = 3 * ruleSpacing;
  11407     } else {
  11408       clearance = 7 * ruleSpacing;
  11409     }
  11410 
  11411     denomShift = options.fontMetrics().denom1;
  11412   } else {
  11413     if (ruleWidth > 0) {
  11414       numShift = options.fontMetrics().num2;
  11415       clearance = ruleSpacing;
  11416     } else {
  11417       numShift = options.fontMetrics().num3;
  11418       clearance = 3 * ruleSpacing;
  11419     }
  11420 
  11421     denomShift = options.fontMetrics().denom2;
  11422   }
  11423 
  11424   var frac;
  11425 
  11426   if (!rule) {
  11427     // Rule 15c
  11428     var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift);
  11429 
  11430     if (candidateClearance < clearance) {
  11431       numShift += 0.5 * (clearance - candidateClearance);
  11432       denomShift += 0.5 * (clearance - candidateClearance);
  11433     }
  11434 
  11435     frac = buildCommon.makeVList({
  11436       positionType: "individualShift",
  11437       children: [{
  11438         type: "elem",
  11439         elem: denomm,
  11440         shift: denomShift
  11441       }, {
  11442         type: "elem",
  11443         elem: numerm,
  11444         shift: -numShift
  11445       }]
  11446     }, options);
  11447   } else {
  11448     // Rule 15d
  11449     var axisHeight = options.fontMetrics().axisHeight;
  11450 
  11451     if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) {
  11452       numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth));
  11453     }
  11454 
  11455     if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) {
  11456       denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift));
  11457     }
  11458 
  11459     var midShift = -(axisHeight - 0.5 * ruleWidth);
  11460     frac = buildCommon.makeVList({
  11461       positionType: "individualShift",
  11462       children: [{
  11463         type: "elem",
  11464         elem: denomm,
  11465         shift: denomShift
  11466       }, {
  11467         type: "elem",
  11468         elem: rule,
  11469         shift: midShift
  11470       }, {
  11471         type: "elem",
  11472         elem: numerm,
  11473         shift: -numShift
  11474       }]
  11475     }, options);
  11476   } // Since we manually change the style sometimes (with \dfrac or \tfrac),
  11477   // account for the possible size change here.
  11478 
  11479 
  11480   newOptions = options.havingStyle(style);
  11481   frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier;
  11482   frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e
  11483 
  11484   var delimSize;
  11485 
  11486   if (style.size === src_Style.DISPLAY.size) {
  11487     delimSize = options.fontMetrics().delim1;
  11488   } else {
  11489     delimSize = options.fontMetrics().delim2;
  11490   }
  11491 
  11492   var leftDelim;
  11493   var rightDelim;
  11494 
  11495   if (group.leftDelim == null) {
  11496     leftDelim = makeNullDelimiter(options, ["mopen"]);
  11497   } else {
  11498     leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]);
  11499   }
  11500 
  11501   if (group.continued) {
  11502     rightDelim = buildCommon.makeSpan([]); // zero width for \cfrac
  11503   } else if (group.rightDelim == null) {
  11504     rightDelim = makeNullDelimiter(options, ["mclose"]);
  11505   } else {
  11506     rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]);
  11507   }
  11508 
  11509   return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options);
  11510 };
  11511 
  11512 var genfrac_mathmlBuilder = function mathmlBuilder(group, options) {
  11513   var node = new mathMLTree.MathNode("mfrac", [buildMathML_buildGroup(group.numer, options), buildMathML_buildGroup(group.denom, options)]);
  11514 
  11515   if (!group.hasBarLine) {
  11516     node.setAttribute("linethickness", "0px");
  11517   } else if (group.barSize) {
  11518     var ruleWidth = calculateSize(group.barSize, options);
  11519     node.setAttribute("linethickness", ruleWidth + "em");
  11520   }
  11521 
  11522   var style = adjustStyle(group.size, options.style);
  11523 
  11524   if (style.size !== options.style.size) {
  11525     node = new mathMLTree.MathNode("mstyle", [node]);
  11526     var isDisplay = style.size === src_Style.DISPLAY.size ? "true" : "false";
  11527     node.setAttribute("displaystyle", isDisplay);
  11528     node.setAttribute("scriptlevel", "0");
  11529   }
  11530 
  11531   if (group.leftDelim != null || group.rightDelim != null) {
  11532     var withDelims = [];
  11533 
  11534     if (group.leftDelim != null) {
  11535       var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]);
  11536       leftOp.setAttribute("fence", "true");
  11537       withDelims.push(leftOp);
  11538     }
  11539 
  11540     withDelims.push(node);
  11541 
  11542     if (group.rightDelim != null) {
  11543       var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]);
  11544       rightOp.setAttribute("fence", "true");
  11545       withDelims.push(rightOp);
  11546     }
  11547 
  11548     return makeRow(withDelims);
  11549   }
  11550 
  11551   return node;
  11552 };
  11553 
  11554 defineFunction({
  11555   type: "genfrac",
  11556   names: ["\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly
  11557   "\\\\bracefrac", "\\\\brackfrac" // ditto
  11558   ],
  11559   props: {
  11560     numArgs: 2,
  11561     allowedInArgument: true
  11562   },
  11563   handler: function handler(_ref, args) {
  11564     var parser = _ref.parser,
  11565         funcName = _ref.funcName;
  11566     var numer = args[0];
  11567     var denom = args[1];
  11568     var hasBarLine;
  11569     var leftDelim = null;
  11570     var rightDelim = null;
  11571     var size = "auto";
  11572 
  11573     switch (funcName) {
  11574       case "\\dfrac":
  11575       case "\\frac":
  11576       case "\\tfrac":
  11577         hasBarLine = true;
  11578         break;
  11579 
  11580       case "\\\\atopfrac":
  11581         hasBarLine = false;
  11582         break;
  11583 
  11584       case "\\dbinom":
  11585       case "\\binom":
  11586       case "\\tbinom":
  11587         hasBarLine = false;
  11588         leftDelim = "(";
  11589         rightDelim = ")";
  11590         break;
  11591 
  11592       case "\\\\bracefrac":
  11593         hasBarLine = false;
  11594         leftDelim = "\\{";
  11595         rightDelim = "\\}";
  11596         break;
  11597 
  11598       case "\\\\brackfrac":
  11599         hasBarLine = false;
  11600         leftDelim = "[";
  11601         rightDelim = "]";
  11602         break;
  11603 
  11604       default:
  11605         throw new Error("Unrecognized genfrac command");
  11606     }
  11607 
  11608     switch (funcName) {
  11609       case "\\dfrac":
  11610       case "\\dbinom":
  11611         size = "display";
  11612         break;
  11613 
  11614       case "\\tfrac":
  11615       case "\\tbinom":
  11616         size = "text";
  11617         break;
  11618     }
  11619 
  11620     return {
  11621       type: "genfrac",
  11622       mode: parser.mode,
  11623       continued: false,
  11624       numer: numer,
  11625       denom: denom,
  11626       hasBarLine: hasBarLine,
  11627       leftDelim: leftDelim,
  11628       rightDelim: rightDelim,
  11629       size: size,
  11630       barSize: null
  11631     };
  11632   },
  11633   htmlBuilder: genfrac_htmlBuilder,
  11634   mathmlBuilder: genfrac_mathmlBuilder
  11635 });
  11636 defineFunction({
  11637   type: "genfrac",
  11638   names: ["\\cfrac"],
  11639   props: {
  11640     numArgs: 2
  11641   },
  11642   handler: function handler(_ref2, args) {
  11643     var parser = _ref2.parser,
  11644         funcName = _ref2.funcName;
  11645     var numer = args[0];
  11646     var denom = args[1];
  11647     return {
  11648       type: "genfrac",
  11649       mode: parser.mode,
  11650       continued: true,
  11651       numer: numer,
  11652       denom: denom,
  11653       hasBarLine: true,
  11654       leftDelim: null,
  11655       rightDelim: null,
  11656       size: "display",
  11657       barSize: null
  11658     };
  11659   }
  11660 }); // Infix generalized fractions -- these are not rendered directly, but replaced
  11661 // immediately by one of the variants above.
  11662 
  11663 defineFunction({
  11664   type: "infix",
  11665   names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
  11666   props: {
  11667     numArgs: 0,
  11668     infix: true
  11669   },
  11670   handler: function handler(_ref3) {
  11671     var parser = _ref3.parser,
  11672         funcName = _ref3.funcName,
  11673         token = _ref3.token;
  11674     var replaceWith;
  11675 
  11676     switch (funcName) {
  11677       case "\\over":
  11678         replaceWith = "\\frac";
  11679         break;
  11680 
  11681       case "\\choose":
  11682         replaceWith = "\\binom";
  11683         break;
  11684 
  11685       case "\\atop":
  11686         replaceWith = "\\\\atopfrac";
  11687         break;
  11688 
  11689       case "\\brace":
  11690         replaceWith = "\\\\bracefrac";
  11691         break;
  11692 
  11693       case "\\brack":
  11694         replaceWith = "\\\\brackfrac";
  11695         break;
  11696 
  11697       default:
  11698         throw new Error("Unrecognized infix genfrac command");
  11699     }
  11700 
  11701     return {
  11702       type: "infix",
  11703       mode: parser.mode,
  11704       replaceWith: replaceWith,
  11705       token: token
  11706     };
  11707   }
  11708 });
  11709 var stylArray = ["display", "text", "script", "scriptscript"];
  11710 
  11711 var delimFromValue = function delimFromValue(delimString) {
  11712   var delim = null;
  11713 
  11714   if (delimString.length > 0) {
  11715     delim = delimString;
  11716     delim = delim === "." ? null : delim;
  11717   }
  11718 
  11719   return delim;
  11720 };
  11721 
  11722 defineFunction({
  11723   type: "genfrac",
  11724   names: ["\\genfrac"],
  11725   props: {
  11726     numArgs: 6,
  11727     allowedInArgument: true,
  11728     argTypes: ["math", "math", "size", "text", "math", "math"]
  11729   },
  11730   handler: function handler(_ref4, args) {
  11731     var parser = _ref4.parser;
  11732     var numer = args[4];
  11733     var denom = args[5]; // Look into the parse nodes to get the desired delimiters.
  11734 
  11735     var leftNode = normalizeArgument(args[0]);
  11736     var leftDelim = leftNode.type === "atom" && leftNode.family === "open" ? delimFromValue(leftNode.text) : null;
  11737     var rightNode = normalizeArgument(args[1]);
  11738     var rightDelim = rightNode.type === "atom" && rightNode.family === "close" ? delimFromValue(rightNode.text) : null;
  11739     var barNode = assertNodeType(args[2], "size");
  11740     var hasBarLine;
  11741     var barSize = null;
  11742 
  11743     if (barNode.isBlank) {
  11744       // \genfrac acts differently than \above.
  11745       // \genfrac treats an empty size group as a signal to use a
  11746       // standard bar size. \above would see size = 0 and omit the bar.
  11747       hasBarLine = true;
  11748     } else {
  11749       barSize = barNode.value;
  11750       hasBarLine = barSize.number > 0;
  11751     } // Find out if we want displaystyle, textstyle, etc.
  11752 
  11753 
  11754     var size = "auto";
  11755     var styl = args[3];
  11756 
  11757     if (styl.type === "ordgroup") {
  11758       if (styl.body.length > 0) {
  11759         var textOrd = assertNodeType(styl.body[0], "textord");
  11760         size = stylArray[Number(textOrd.text)];
  11761       }
  11762     } else {
  11763       styl = assertNodeType(styl, "textord");
  11764       size = stylArray[Number(styl.text)];
  11765     }
  11766 
  11767     return {
  11768       type: "genfrac",
  11769       mode: parser.mode,
  11770       numer: numer,
  11771       denom: denom,
  11772       continued: false,
  11773       hasBarLine: hasBarLine,
  11774       barSize: barSize,
  11775       leftDelim: leftDelim,
  11776       rightDelim: rightDelim,
  11777       size: size
  11778     };
  11779   },
  11780   htmlBuilder: genfrac_htmlBuilder,
  11781   mathmlBuilder: genfrac_mathmlBuilder
  11782 }); // \above is an infix fraction that also defines a fraction bar size.
  11783 
  11784 defineFunction({
  11785   type: "infix",
  11786   names: ["\\above"],
  11787   props: {
  11788     numArgs: 1,
  11789     argTypes: ["size"],
  11790     infix: true
  11791   },
  11792   handler: function handler(_ref5, args) {
  11793     var parser = _ref5.parser,
  11794         funcName = _ref5.funcName,
  11795         token = _ref5.token;
  11796     return {
  11797       type: "infix",
  11798       mode: parser.mode,
  11799       replaceWith: "\\\\abovefrac",
  11800       size: assertNodeType(args[0], "size").value,
  11801       token: token
  11802     };
  11803   }
  11804 });
  11805 defineFunction({
  11806   type: "genfrac",
  11807   names: ["\\\\abovefrac"],
  11808   props: {
  11809     numArgs: 3,
  11810     argTypes: ["math", "size", "math"]
  11811   },
  11812   handler: function handler(_ref6, args) {
  11813     var parser = _ref6.parser,
  11814         funcName = _ref6.funcName;
  11815     var numer = args[0];
  11816     var barSize = assert(assertNodeType(args[1], "infix").size);
  11817     var denom = args[2];
  11818     var hasBarLine = barSize.number > 0;
  11819     return {
  11820       type: "genfrac",
  11821       mode: parser.mode,
  11822       numer: numer,
  11823       denom: denom,
  11824       continued: false,
  11825       hasBarLine: hasBarLine,
  11826       barSize: barSize,
  11827       leftDelim: null,
  11828       rightDelim: null,
  11829       size: "auto"
  11830     };
  11831   },
  11832   htmlBuilder: genfrac_htmlBuilder,
  11833   mathmlBuilder: genfrac_mathmlBuilder
  11834 });
  11835 ;// CONCATENATED MODULE: ./src/functions/horizBrace.js
  11836 
  11837 
  11838 
  11839 
  11840 
  11841 
  11842 
  11843 
  11844 // NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but
  11845 // also "supsub" since an over/underbrace can affect super/subscripting.
  11846 var horizBrace_htmlBuilder = function htmlBuilder(grp, options) {
  11847   var style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node.
  11848 
  11849   var supSubGroup;
  11850   var group;
  11851 
  11852   if (grp.type === "supsub") {
  11853     // Ref: LaTeX source2e: }}}}\limits}
  11854     // i.e. LaTeX treats the brace similar to an op and passes it
  11855     // with \limits, so we need to assign supsub style.
  11856     supSubGroup = grp.sup ? buildGroup(grp.sup, options.havingStyle(style.sup()), options) : buildGroup(grp.sub, options.havingStyle(style.sub()), options);
  11857     group = assertNodeType(grp.base, "horizBrace");
  11858   } else {
  11859     group = assertNodeType(grp, "horizBrace");
  11860   } // Build the base group
  11861 
  11862 
  11863   var body = buildGroup(group.base, options.havingBaseStyle(src_Style.DISPLAY)); // Create the stretchy element
  11864 
  11865   var braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns        ┏━━━━━━━━┓
  11866   // This first vlist contains the content and the brace:   equation
  11867 
  11868   var vlist;
  11869 
  11870   if (group.isOver) {
  11871     vlist = buildCommon.makeVList({
  11872       positionType: "firstBaseline",
  11873       children: [{
  11874         type: "elem",
  11875         elem: body
  11876       }, {
  11877         type: "kern",
  11878         size: 0.1
  11879       }, {
  11880         type: "elem",
  11881         elem: braceBody
  11882       }]
  11883     }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
  11884 
  11885     vlist.children[0].children[0].children[1].classes.push("svg-align");
  11886   } else {
  11887     vlist = buildCommon.makeVList({
  11888       positionType: "bottom",
  11889       positionData: body.depth + 0.1 + braceBody.height,
  11890       children: [{
  11891         type: "elem",
  11892         elem: braceBody
  11893       }, {
  11894         type: "kern",
  11895         size: 0.1
  11896       }, {
  11897         type: "elem",
  11898         elem: body
  11899       }]
  11900     }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
  11901 
  11902     vlist.children[0].children[0].children[0].classes.push("svg-align");
  11903   }
  11904 
  11905   if (supSubGroup) {
  11906     // To write the supsub, wrap the first vlist in another vlist:
  11907     // They can't all go in the same vlist, because the note might be
  11908     // wider than the equation. We want the equation to control the
  11909     // brace width.
  11910     //      note          long note           long note
  11911     //   ┏━━━━━━━━┓   or    ┏━━━┓     not    ┏━━━━━━━━━┓
  11912     //    equation           eqn                 eqn
  11913     var vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
  11914 
  11915     if (group.isOver) {
  11916       vlist = buildCommon.makeVList({
  11917         positionType: "firstBaseline",
  11918         children: [{
  11919           type: "elem",
  11920           elem: vSpan
  11921         }, {
  11922           type: "kern",
  11923           size: 0.2
  11924         }, {
  11925           type: "elem",
  11926           elem: supSubGroup
  11927         }]
  11928       }, options);
  11929     } else {
  11930       vlist = buildCommon.makeVList({
  11931         positionType: "bottom",
  11932         positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth,
  11933         children: [{
  11934           type: "elem",
  11935           elem: supSubGroup
  11936         }, {
  11937           type: "kern",
  11938           size: 0.2
  11939         }, {
  11940           type: "elem",
  11941           elem: vSpan
  11942         }]
  11943       }, options);
  11944     }
  11945   }
  11946 
  11947   return buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
  11948 };
  11949 
  11950 var horizBrace_mathmlBuilder = function mathmlBuilder(group, options) {
  11951   var accentNode = stretchy.mathMLnode(group.label);
  11952   return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [buildMathML_buildGroup(group.base, options), accentNode]);
  11953 }; // Horizontal stretchy braces
  11954 
  11955 
  11956 defineFunction({
  11957   type: "horizBrace",
  11958   names: ["\\overbrace", "\\underbrace"],
  11959   props: {
  11960     numArgs: 1
  11961   },
  11962   handler: function handler(_ref, args) {
  11963     var parser = _ref.parser,
  11964         funcName = _ref.funcName;
  11965     return {
  11966       type: "horizBrace",
  11967       mode: parser.mode,
  11968       label: funcName,
  11969       isOver: /^\\over/.test(funcName),
  11970       base: args[0]
  11971     };
  11972   },
  11973   htmlBuilder: horizBrace_htmlBuilder,
  11974   mathmlBuilder: horizBrace_mathmlBuilder
  11975 });
  11976 ;// CONCATENATED MODULE: ./src/functions/href.js
  11977 
  11978 
  11979 
  11980 
  11981 
  11982 
  11983 defineFunction({
  11984   type: "href",
  11985   names: ["\\href"],
  11986   props: {
  11987     numArgs: 2,
  11988     argTypes: ["url", "original"],
  11989     allowedInText: true
  11990   },
  11991   handler: function handler(_ref, args) {
  11992     var parser = _ref.parser;
  11993     var body = args[1];
  11994     var href = assertNodeType(args[0], "url").url;
  11995 
  11996     if (!parser.settings.isTrusted({
  11997       command: "\\href",
  11998       url: href
  11999     })) {
  12000       return parser.formatUnsupportedCmd("\\href");
  12001     }
  12002 
  12003     return {
  12004       type: "href",
  12005       mode: parser.mode,
  12006       href: href,
  12007       body: ordargument(body)
  12008     };
  12009   },
  12010   htmlBuilder: function htmlBuilder(group, options) {
  12011     var elements = buildExpression(group.body, options, false);
  12012     return buildCommon.makeAnchor(group.href, [], elements, options);
  12013   },
  12014   mathmlBuilder: function mathmlBuilder(group, options) {
  12015     var math = buildExpressionRow(group.body, options);
  12016 
  12017     if (!(math instanceof MathNode)) {
  12018       math = new MathNode("mrow", [math]);
  12019     }
  12020 
  12021     math.setAttribute("href", group.href);
  12022     return math;
  12023   }
  12024 });
  12025 defineFunction({
  12026   type: "href",
  12027   names: ["\\url"],
  12028   props: {
  12029     numArgs: 1,
  12030     argTypes: ["url"],
  12031     allowedInText: true
  12032   },
  12033   handler: function handler(_ref2, args) {
  12034     var parser = _ref2.parser;
  12035     var href = assertNodeType(args[0], "url").url;
  12036 
  12037     if (!parser.settings.isTrusted({
  12038       command: "\\url",
  12039       url: href
  12040     })) {
  12041       return parser.formatUnsupportedCmd("\\url");
  12042     }
  12043 
  12044     var chars = [];
  12045 
  12046     for (var i = 0; i < href.length; i++) {
  12047       var c = href[i];
  12048 
  12049       if (c === "~") {
  12050         c = "\\textasciitilde";
  12051       }
  12052 
  12053       chars.push({
  12054         type: "textord",
  12055         mode: "text",
  12056         text: c
  12057       });
  12058     }
  12059 
  12060     var body = {
  12061       type: "text",
  12062       mode: parser.mode,
  12063       font: "\\texttt",
  12064       body: chars
  12065     };
  12066     return {
  12067       type: "href",
  12068       mode: parser.mode,
  12069       href: href,
  12070       body: ordargument(body)
  12071     };
  12072   }
  12073 });
  12074 ;// CONCATENATED MODULE: ./src/functions/hbox.js
  12075 
  12076 
  12077 
  12078 
  12079  // \hbox is provided for compatibility with LaTeX \vcenter.
  12080 // In LaTeX, \vcenter can act only on a box, as in
  12081 // \vcenter{\hbox{$\frac{a+b}{\dfrac{c}{d}}$}}
  12082 // This function by itself doesn't do anything but prevent a soft line break.
  12083 
  12084 defineFunction({
  12085   type: "hbox",
  12086   names: ["\\hbox"],
  12087   props: {
  12088     numArgs: 1,
  12089     argTypes: ["text"],
  12090     allowedInText: true,
  12091     primitive: true
  12092   },
  12093   handler: function handler(_ref, args) {
  12094     var parser = _ref.parser;
  12095     return {
  12096       type: "hbox",
  12097       mode: parser.mode,
  12098       body: ordargument(args[0])
  12099     };
  12100   },
  12101   htmlBuilder: function htmlBuilder(group, options) {
  12102     var elements = buildExpression(group.body, options, false);
  12103     return buildCommon.makeFragment(elements);
  12104   },
  12105   mathmlBuilder: function mathmlBuilder(group, options) {
  12106     return new mathMLTree.MathNode("mrow", buildMathML_buildExpression(group.body, options));
  12107   }
  12108 });
  12109 ;// CONCATENATED MODULE: ./src/functions/html.js
  12110 
  12111 
  12112 
  12113 
  12114 
  12115 
  12116 defineFunction({
  12117   type: "html",
  12118   names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"],
  12119   props: {
  12120     numArgs: 2,
  12121     argTypes: ["raw", "original"],
  12122     allowedInText: true
  12123   },
  12124   handler: function handler(_ref, args) {
  12125     var parser = _ref.parser,
  12126         funcName = _ref.funcName,
  12127         token = _ref.token;
  12128     var value = assertNodeType(args[0], "raw").string;
  12129     var body = args[1];
  12130 
  12131     if (parser.settings.strict) {
  12132       parser.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode");
  12133     }
  12134 
  12135     var trustContext;
  12136     var attributes = {};
  12137 
  12138     switch (funcName) {
  12139       case "\\htmlClass":
  12140         attributes.class = value;
  12141         trustContext = {
  12142           command: "\\htmlClass",
  12143           class: value
  12144         };
  12145         break;
  12146 
  12147       case "\\htmlId":
  12148         attributes.id = value;
  12149         trustContext = {
  12150           command: "\\htmlId",
  12151           id: value
  12152         };
  12153         break;
  12154 
  12155       case "\\htmlStyle":
  12156         attributes.style = value;
  12157         trustContext = {
  12158           command: "\\htmlStyle",
  12159           style: value
  12160         };
  12161         break;
  12162 
  12163       case "\\htmlData":
  12164         {
  12165           var data = value.split(",");
  12166 
  12167           for (var i = 0; i < data.length; i++) {
  12168             var keyVal = data[i].split("=");
  12169 
  12170             if (keyVal.length !== 2) {
  12171               throw new src_ParseError("Error parsing key-value for \\htmlData");
  12172             }
  12173 
  12174             attributes["data-" + keyVal[0].trim()] = keyVal[1].trim();
  12175           }
  12176 
  12177           trustContext = {
  12178             command: "\\htmlData",
  12179             attributes: attributes
  12180           };
  12181           break;
  12182         }
  12183 
  12184       default:
  12185         throw new Error("Unrecognized html command");
  12186     }
  12187 
  12188     if (!parser.settings.isTrusted(trustContext)) {
  12189       return parser.formatUnsupportedCmd(funcName);
  12190     }
  12191 
  12192     return {
  12193       type: "html",
  12194       mode: parser.mode,
  12195       attributes: attributes,
  12196       body: ordargument(body)
  12197     };
  12198   },
  12199   htmlBuilder: function htmlBuilder(group, options) {
  12200     var elements = buildExpression(group.body, options, false);
  12201     var classes = ["enclosing"];
  12202 
  12203     if (group.attributes.class) {
  12204       classes.push.apply(classes, group.attributes.class.trim().split(/\s+/));
  12205     }
  12206 
  12207     var span = buildCommon.makeSpan(classes, elements, options);
  12208 
  12209     for (var attr in group.attributes) {
  12210       if (attr !== "class" && group.attributes.hasOwnProperty(attr)) {
  12211         span.setAttribute(attr, group.attributes[attr]);
  12212       }
  12213     }
  12214 
  12215     return span;
  12216   },
  12217   mathmlBuilder: function mathmlBuilder(group, options) {
  12218     return buildExpressionRow(group.body, options);
  12219   }
  12220 });
  12221 ;// CONCATENATED MODULE: ./src/functions/htmlmathml.js
  12222 
  12223 
  12224 
  12225 
  12226 defineFunction({
  12227   type: "htmlmathml",
  12228   names: ["\\html@mathml"],
  12229   props: {
  12230     numArgs: 2,
  12231     allowedInText: true
  12232   },
  12233   handler: function handler(_ref, args) {
  12234     var parser = _ref.parser;
  12235     return {
  12236       type: "htmlmathml",
  12237       mode: parser.mode,
  12238       html: ordargument(args[0]),
  12239       mathml: ordargument(args[1])
  12240     };
  12241   },
  12242   htmlBuilder: function htmlBuilder(group, options) {
  12243     var elements = buildExpression(group.html, options, false);
  12244     return buildCommon.makeFragment(elements);
  12245   },
  12246   mathmlBuilder: function mathmlBuilder(group, options) {
  12247     return buildExpressionRow(group.mathml, options);
  12248   }
  12249 });
  12250 ;// CONCATENATED MODULE: ./src/functions/includegraphics.js
  12251 
  12252 
  12253 
  12254 
  12255 
  12256 
  12257 
  12258 var sizeData = function sizeData(str) {
  12259   if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) {
  12260     // str is a number with no unit specified.
  12261     // default unit is bp, per graphix package.
  12262     return {
  12263       number: +str,
  12264       unit: "bp"
  12265     };
  12266   } else {
  12267     var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str);
  12268 
  12269     if (!match) {
  12270       throw new src_ParseError("Invalid size: '" + str + "' in \\includegraphics");
  12271     }
  12272 
  12273     var data = {
  12274       number: +(match[1] + match[2]),
  12275       // sign + magnitude, cast to number
  12276       unit: match[3]
  12277     };
  12278 
  12279     if (!validUnit(data)) {
  12280       throw new src_ParseError("Invalid unit: '" + data.unit + "' in \\includegraphics.");
  12281     }
  12282 
  12283     return data;
  12284   }
  12285 };
  12286 
  12287 defineFunction({
  12288   type: "includegraphics",
  12289   names: ["\\includegraphics"],
  12290   props: {
  12291     numArgs: 1,
  12292     numOptionalArgs: 1,
  12293     argTypes: ["raw", "url"],
  12294     allowedInText: false
  12295   },
  12296   handler: function handler(_ref, args, optArgs) {
  12297     var parser = _ref.parser;
  12298     var width = {
  12299       number: 0,
  12300       unit: "em"
  12301     };
  12302     var height = {
  12303       number: 0.9,
  12304       unit: "em"
  12305     }; // sorta character sized.
  12306 
  12307     var totalheight = {
  12308       number: 0,
  12309       unit: "em"
  12310     };
  12311     var alt = "";
  12312 
  12313     if (optArgs[0]) {
  12314       var attributeStr = assertNodeType(optArgs[0], "raw").string; // Parser.js does not parse key/value pairs. We get a string.
  12315 
  12316       var attributes = attributeStr.split(",");
  12317 
  12318       for (var i = 0; i < attributes.length; i++) {
  12319         var keyVal = attributes[i].split("=");
  12320 
  12321         if (keyVal.length === 2) {
  12322           var str = keyVal[1].trim();
  12323 
  12324           switch (keyVal[0].trim()) {
  12325             case "alt":
  12326               alt = str;
  12327               break;
  12328 
  12329             case "width":
  12330               width = sizeData(str);
  12331               break;
  12332 
  12333             case "height":
  12334               height = sizeData(str);
  12335               break;
  12336 
  12337             case "totalheight":
  12338               totalheight = sizeData(str);
  12339               break;
  12340 
  12341             default:
  12342               throw new src_ParseError("Invalid key: '" + keyVal[0] + "' in \\includegraphics.");
  12343           }
  12344         }
  12345       }
  12346     }
  12347 
  12348     var src = assertNodeType(args[0], "url").url;
  12349 
  12350     if (alt === "") {
  12351       // No alt given. Use the file name. Strip away the path.
  12352       alt = src;
  12353       alt = alt.replace(/^.*[\\/]/, '');
  12354       alt = alt.substring(0, alt.lastIndexOf('.'));
  12355     }
  12356 
  12357     if (!parser.settings.isTrusted({
  12358       command: "\\includegraphics",
  12359       url: src
  12360     })) {
  12361       return parser.formatUnsupportedCmd("\\includegraphics");
  12362     }
  12363 
  12364     return {
  12365       type: "includegraphics",
  12366       mode: parser.mode,
  12367       alt: alt,
  12368       width: width,
  12369       height: height,
  12370       totalheight: totalheight,
  12371       src: src
  12372     };
  12373   },
  12374   htmlBuilder: function htmlBuilder(group, options) {
  12375     var height = calculateSize(group.height, options);
  12376     var depth = 0;
  12377 
  12378     if (group.totalheight.number > 0) {
  12379       depth = calculateSize(group.totalheight, options) - height;
  12380       depth = Number(depth.toFixed(2));
  12381     }
  12382 
  12383     var width = 0;
  12384 
  12385     if (group.width.number > 0) {
  12386       width = calculateSize(group.width, options);
  12387     }
  12388 
  12389     var style = {
  12390       height: height + depth + "em"
  12391     };
  12392 
  12393     if (width > 0) {
  12394       style.width = width + "em";
  12395     }
  12396 
  12397     if (depth > 0) {
  12398       style.verticalAlign = -depth + "em";
  12399     }
  12400 
  12401     var node = new Img(group.src, group.alt, style);
  12402     node.height = height;
  12403     node.depth = depth;
  12404     return node;
  12405   },
  12406   mathmlBuilder: function mathmlBuilder(group, options) {
  12407     var node = new mathMLTree.MathNode("mglyph", []);
  12408     node.setAttribute("alt", group.alt);
  12409     var height = calculateSize(group.height, options);
  12410     var depth = 0;
  12411 
  12412     if (group.totalheight.number > 0) {
  12413       depth = calculateSize(group.totalheight, options) - height;
  12414       depth = depth.toFixed(2);
  12415       node.setAttribute("valign", "-" + depth + "em");
  12416     }
  12417 
  12418     node.setAttribute("height", height + depth + "em");
  12419 
  12420     if (group.width.number > 0) {
  12421       var width = calculateSize(group.width, options);
  12422       node.setAttribute("width", width + "em");
  12423     }
  12424 
  12425     node.setAttribute("src", group.src);
  12426     return node;
  12427   }
  12428 });
  12429 ;// CONCATENATED MODULE: ./src/functions/kern.js
  12430 // Horizontal spacing commands
  12431 
  12432 
  12433 
  12434 
  12435  // TODO: \hskip and \mskip should support plus and minus in lengths
  12436 
  12437 defineFunction({
  12438   type: "kern",
  12439   names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
  12440   props: {
  12441     numArgs: 1,
  12442     argTypes: ["size"],
  12443     primitive: true,
  12444     allowedInText: true
  12445   },
  12446   handler: function handler(_ref, args) {
  12447     var parser = _ref.parser,
  12448         funcName = _ref.funcName;
  12449     var size = assertNodeType(args[0], "size");
  12450 
  12451     if (parser.settings.strict) {
  12452       var mathFunction = funcName[1] === 'm'; // \mkern, \mskip
  12453 
  12454       var muUnit = size.value.unit === 'mu';
  12455 
  12456       if (mathFunction) {
  12457         if (!muUnit) {
  12458           parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units"));
  12459         }
  12460 
  12461         if (parser.mode !== "math") {
  12462           parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode");
  12463         }
  12464       } else {
  12465         // !mathFunction
  12466         if (muUnit) {
  12467           parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units");
  12468         }
  12469       }
  12470     }
  12471 
  12472     return {
  12473       type: "kern",
  12474       mode: parser.mode,
  12475       dimension: size.value
  12476     };
  12477   },
  12478   htmlBuilder: function htmlBuilder(group, options) {
  12479     return buildCommon.makeGlue(group.dimension, options);
  12480   },
  12481   mathmlBuilder: function mathmlBuilder(group, options) {
  12482     var dimension = calculateSize(group.dimension, options);
  12483     return new mathMLTree.SpaceNode(dimension);
  12484   }
  12485 });
  12486 ;// CONCATENATED MODULE: ./src/functions/lap.js
  12487 // Horizontal overlap functions
  12488 
  12489 
  12490 
  12491 
  12492 
  12493 defineFunction({
  12494   type: "lap",
  12495   names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
  12496   props: {
  12497     numArgs: 1,
  12498     allowedInText: true
  12499   },
  12500   handler: function handler(_ref, args) {
  12501     var parser = _ref.parser,
  12502         funcName = _ref.funcName;
  12503     var body = args[0];
  12504     return {
  12505       type: "lap",
  12506       mode: parser.mode,
  12507       alignment: funcName.slice(5),
  12508       body: body
  12509     };
  12510   },
  12511   htmlBuilder: function htmlBuilder(group, options) {
  12512     // mathllap, mathrlap, mathclap
  12513     var inner;
  12514 
  12515     if (group.alignment === "clap") {
  12516       // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/
  12517       inner = buildCommon.makeSpan([], [buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span
  12518 
  12519       inner = buildCommon.makeSpan(["inner"], [inner], options);
  12520     } else {
  12521       inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options)]);
  12522     }
  12523 
  12524     var fix = buildCommon.makeSpan(["fix"], []);
  12525     var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the
  12526     // two items involved in the lap.
  12527     // Next, use a strut to set the height of the HTML bounding box.
  12528     // Otherwise, a tall argument may be misplaced.
  12529     // This code resolved issue #1153
  12530 
  12531     var strut = buildCommon.makeSpan(["strut"]);
  12532     strut.style.height = node.height + node.depth + "em";
  12533     strut.style.verticalAlign = -node.depth + "em";
  12534     node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall.
  12535     // This code resolves issue #1234
  12536 
  12537     node = buildCommon.makeSpan(["thinbox"], [node], options);
  12538     return buildCommon.makeSpan(["mord", "vbox"], [node], options);
  12539   },
  12540   mathmlBuilder: function mathmlBuilder(group, options) {
  12541     // mathllap, mathrlap, mathclap
  12542     var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
  12543 
  12544     if (group.alignment !== "rlap") {
  12545       var offset = group.alignment === "llap" ? "-1" : "-0.5";
  12546       node.setAttribute("lspace", offset + "width");
  12547     }
  12548 
  12549     node.setAttribute("width", "0px");
  12550     return node;
  12551   }
  12552 });
  12553 ;// CONCATENATED MODULE: ./src/functions/math.js
  12554 
  12555  // Switching from text mode back to math mode
  12556 
  12557 defineFunction({
  12558   type: "styling",
  12559   names: ["\\(", "$"],
  12560   props: {
  12561     numArgs: 0,
  12562     allowedInText: true,
  12563     allowedInMath: false
  12564   },
  12565   handler: function handler(_ref, args) {
  12566     var funcName = _ref.funcName,
  12567         parser = _ref.parser;
  12568     var outerMode = parser.mode;
  12569     parser.switchMode("math");
  12570     var close = funcName === "\\(" ? "\\)" : "$";
  12571     var body = parser.parseExpression(false, close);
  12572     parser.expect(close);
  12573     parser.switchMode(outerMode);
  12574     return {
  12575       type: "styling",
  12576       mode: parser.mode,
  12577       style: "text",
  12578       body: body
  12579     };
  12580   }
  12581 }); // Check for extra closing math delimiters
  12582 
  12583 defineFunction({
  12584   type: "text",
  12585   // Doesn't matter what this is.
  12586   names: ["\\)", "\\]"],
  12587   props: {
  12588     numArgs: 0,
  12589     allowedInText: true,
  12590     allowedInMath: false
  12591   },
  12592   handler: function handler(context, args) {
  12593     throw new src_ParseError("Mismatched " + context.funcName);
  12594   }
  12595 });
  12596 ;// CONCATENATED MODULE: ./src/functions/mathchoice.js
  12597 
  12598 
  12599 
  12600 
  12601 
  12602 
  12603 var chooseMathStyle = function chooseMathStyle(group, options) {
  12604   switch (options.style.size) {
  12605     case src_Style.DISPLAY.size:
  12606       return group.display;
  12607 
  12608     case src_Style.TEXT.size:
  12609       return group.text;
  12610 
  12611     case src_Style.SCRIPT.size:
  12612       return group.script;
  12613 
  12614     case src_Style.SCRIPTSCRIPT.size:
  12615       return group.scriptscript;
  12616 
  12617     default:
  12618       return group.text;
  12619   }
  12620 };
  12621 
  12622 defineFunction({
  12623   type: "mathchoice",
  12624   names: ["\\mathchoice"],
  12625   props: {
  12626     numArgs: 4,
  12627     primitive: true
  12628   },
  12629   handler: function handler(_ref, args) {
  12630     var parser = _ref.parser;
  12631     return {
  12632       type: "mathchoice",
  12633       mode: parser.mode,
  12634       display: ordargument(args[0]),
  12635       text: ordargument(args[1]),
  12636       script: ordargument(args[2]),
  12637       scriptscript: ordargument(args[3])
  12638     };
  12639   },
  12640   htmlBuilder: function htmlBuilder(group, options) {
  12641     var body = chooseMathStyle(group, options);
  12642     var elements = buildExpression(body, options, false);
  12643     return buildCommon.makeFragment(elements);
  12644   },
  12645   mathmlBuilder: function mathmlBuilder(group, options) {
  12646     var body = chooseMathStyle(group, options);
  12647     return buildExpressionRow(body, options);
  12648   }
  12649 });
  12650 ;// CONCATENATED MODULE: ./src/functions/utils/assembleSupSub.js
  12651 
  12652 
  12653 // For an operator with limits, assemble the base, sup, and sub into a span.
  12654 var assembleSupSub = function assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift) {
  12655   base = buildCommon.makeSpan([], [base]);
  12656   var sub;
  12657   var sup; // We manually have to handle the superscripts and subscripts. This,
  12658   // aside from the kern calculations, is copied from supsub.
  12659 
  12660   if (supGroup) {
  12661     var elem = buildGroup(supGroup, options.havingStyle(style.sup()), options);
  12662     sup = {
  12663       elem: elem,
  12664       kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth)
  12665     };
  12666   }
  12667 
  12668   if (subGroup) {
  12669     var _elem = buildGroup(subGroup, options.havingStyle(style.sub()), options);
  12670 
  12671     sub = {
  12672       elem: _elem,
  12673       kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height)
  12674     };
  12675   } // Build the final group as a vlist of the possible subscript, base,
  12676   // and possible superscript.
  12677 
  12678 
  12679   var finalGroup;
  12680 
  12681   if (sup && sub) {
  12682     var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift;
  12683     finalGroup = buildCommon.makeVList({
  12684       positionType: "bottom",
  12685       positionData: bottom,
  12686       children: [{
  12687         type: "kern",
  12688         size: options.fontMetrics().bigOpSpacing5
  12689       }, {
  12690         type: "elem",
  12691         elem: sub.elem,
  12692         marginLeft: -slant + "em"
  12693       }, {
  12694         type: "kern",
  12695         size: sub.kern
  12696       }, {
  12697         type: "elem",
  12698         elem: base
  12699       }, {
  12700         type: "kern",
  12701         size: sup.kern
  12702       }, {
  12703         type: "elem",
  12704         elem: sup.elem,
  12705         marginLeft: slant + "em"
  12706       }, {
  12707         type: "kern",
  12708         size: options.fontMetrics().bigOpSpacing5
  12709       }]
  12710     }, options);
  12711   } else if (sub) {
  12712     var top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note
  12713     // that we are supposed to shift the limits by 1/2 of the slant,
  12714     // but since we are centering the limits adding a full slant of
  12715     // margin will shift by 1/2 that.
  12716 
  12717     finalGroup = buildCommon.makeVList({
  12718       positionType: "top",
  12719       positionData: top,
  12720       children: [{
  12721         type: "kern",
  12722         size: options.fontMetrics().bigOpSpacing5
  12723       }, {
  12724         type: "elem",
  12725         elem: sub.elem,
  12726         marginLeft: -slant + "em"
  12727       }, {
  12728         type: "kern",
  12729         size: sub.kern
  12730       }, {
  12731         type: "elem",
  12732         elem: base
  12733       }]
  12734     }, options);
  12735   } else if (sup) {
  12736     var _bottom = base.depth + baseShift;
  12737 
  12738     finalGroup = buildCommon.makeVList({
  12739       positionType: "bottom",
  12740       positionData: _bottom,
  12741       children: [{
  12742         type: "elem",
  12743         elem: base
  12744       }, {
  12745         type: "kern",
  12746         size: sup.kern
  12747       }, {
  12748         type: "elem",
  12749         elem: sup.elem,
  12750         marginLeft: slant + "em"
  12751       }, {
  12752         type: "kern",
  12753         size: options.fontMetrics().bigOpSpacing5
  12754       }]
  12755     }, options);
  12756   } else {
  12757     // This case probably shouldn't occur (this would mean the
  12758     // supsub was sending us a group with no superscript or
  12759     // subscript) but be safe.
  12760     return base;
  12761   }
  12762 
  12763   return buildCommon.makeSpan(["mop", "op-limits"], [finalGroup], options);
  12764 };
  12765 ;// CONCATENATED MODULE: ./src/functions/op.js
  12766 // Limits, symbols
  12767 
  12768 
  12769 
  12770 
  12771 
  12772 
  12773 
  12774 
  12775 
  12776 
  12777 // Most operators have a large successor symbol, but these don't.
  12778 var noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
  12779 // "supsub" since some of them (like \int) can affect super/subscripting.
  12780 
  12781 var op_htmlBuilder = function htmlBuilder(grp, options) {
  12782   // Operators are handled in the TeXbook pg. 443-444, rule 13(a).
  12783   var supGroup;
  12784   var subGroup;
  12785   var hasLimits = false;
  12786   var group;
  12787 
  12788   if (grp.type === "supsub") {
  12789     // If we have limits, supsub will pass us its group to handle. Pull
  12790     // out the superscript and subscript and set the group to the op in
  12791     // its base.
  12792     supGroup = grp.sup;
  12793     subGroup = grp.sub;
  12794     group = assertNodeType(grp.base, "op");
  12795     hasLimits = true;
  12796   } else {
  12797     group = assertNodeType(grp, "op");
  12798   }
  12799 
  12800   var style = options.style;
  12801   var large = false;
  12802 
  12803   if (style.size === src_Style.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) {
  12804     // Most symbol operators get larger in displaystyle (rule 13)
  12805     large = true;
  12806   }
  12807 
  12808   var base;
  12809 
  12810   if (group.symbol) {
  12811     // If this is a symbol, create the symbol.
  12812     var fontName = large ? "Size2-Regular" : "Size1-Regular";
  12813     var stash = "";
  12814 
  12815     if (group.name === "\\oiint" || group.name === "\\oiiint") {
  12816       // No font glyphs yet, so use a glyph w/o the oval.
  12817       // TODO: When font glyphs are available, delete this code.
  12818       stash = group.name.substr(1);
  12819       group.name = stash === "oiint" ? "\\iint" : "\\iiint";
  12820     }
  12821 
  12822     base = buildCommon.makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]);
  12823 
  12824     if (stash.length > 0) {
  12825       // We're in \oiint or \oiiint. Overlay the oval.
  12826       // TODO: When font glyphs are available, delete this code.
  12827       var italic = base.italic;
  12828       var oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options);
  12829       base = buildCommon.makeVList({
  12830         positionType: "individualShift",
  12831         children: [{
  12832           type: "elem",
  12833           elem: base,
  12834           shift: 0
  12835         }, {
  12836           type: "elem",
  12837           elem: oval,
  12838           shift: large ? 0.08 : 0
  12839         }]
  12840       }, options);
  12841       group.name = "\\" + stash;
  12842       base.classes.unshift("mop"); // $FlowFixMe
  12843 
  12844       base.italic = italic;
  12845     }
  12846   } else if (group.body) {
  12847     // If this is a list, compose that list.
  12848     var inner = buildExpression(group.body, options, true);
  12849 
  12850     if (inner.length === 1 && inner[0] instanceof SymbolNode) {
  12851       base = inner[0];
  12852       base.classes[0] = "mop"; // replace old mclass
  12853     } else {
  12854       base = buildCommon.makeSpan(["mop"], inner, options);
  12855     }
  12856   } else {
  12857     // Otherwise, this is a text operator. Build the text from the
  12858     // operator's name.
  12859     var output = [];
  12860 
  12861     for (var i = 1; i < group.name.length; i++) {
  12862       output.push(buildCommon.mathsym(group.name[i], group.mode, options));
  12863     }
  12864 
  12865     base = buildCommon.makeSpan(["mop"], output, options);
  12866   } // If content of op is a single symbol, shift it vertically.
  12867 
  12868 
  12869   var baseShift = 0;
  12870   var slant = 0;
  12871 
  12872   if ((base instanceof SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) {
  12873     // We suppress the shift of the base of \overset and \underset. Otherwise,
  12874     // shift the symbol so its center lies on the axis (rule 13). It
  12875     // appears that our fonts have the centers of the symbols already
  12876     // almost on the axis, so these numbers are very small. Note we
  12877     // don't actually apply this here, but instead it is used either in
  12878     // the vlist creation or separately when there are no limits.
  12879     baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; // The slant of the symbol is just its italic correction.
  12880     // $FlowFixMe
  12881 
  12882     slant = base.italic;
  12883   }
  12884 
  12885   if (hasLimits) {
  12886     return assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift);
  12887   } else {
  12888     if (baseShift) {
  12889       base.style.position = "relative";
  12890       base.style.top = baseShift + "em";
  12891     }
  12892 
  12893     return base;
  12894   }
  12895 };
  12896 
  12897 var op_mathmlBuilder = function mathmlBuilder(group, options) {
  12898   var node;
  12899 
  12900   if (group.symbol) {
  12901     // This is a symbol. Just add the symbol.
  12902     node = new MathNode("mo", [makeText(group.name, group.mode)]);
  12903 
  12904     if (utils.contains(noSuccessor, group.name)) {
  12905       node.setAttribute("largeop", "false");
  12906     }
  12907   } else if (group.body) {
  12908     // This is an operator with children. Add them.
  12909     node = new MathNode("mo", buildMathML_buildExpression(group.body, options));
  12910   } else {
  12911     // This is a text operator. Add all of the characters from the
  12912     // operator's name.
  12913     node = new MathNode("mi", [new TextNode(group.name.slice(1))]); // Append an <mo>&ApplyFunction;</mo>.
  12914     // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
  12915 
  12916     var operator = new MathNode("mo", [makeText("\u2061", "text")]);
  12917 
  12918     if (group.parentIsSupSub) {
  12919       node = new MathNode("mrow", [node, operator]);
  12920     } else {
  12921       node = newDocumentFragment([node, operator]);
  12922     }
  12923   }
  12924 
  12925   return node;
  12926 };
  12927 
  12928 var singleCharBigOps = {
  12929   "\u220F": "\\prod",
  12930   "\u2210": "\\coprod",
  12931   "\u2211": "\\sum",
  12932   "\u22C0": "\\bigwedge",
  12933   "\u22C1": "\\bigvee",
  12934   "\u22C2": "\\bigcap",
  12935   "\u22C3": "\\bigcup",
  12936   "\u2A00": "\\bigodot",
  12937   "\u2A01": "\\bigoplus",
  12938   "\u2A02": "\\bigotimes",
  12939   "\u2A04": "\\biguplus",
  12940   "\u2A06": "\\bigsqcup"
  12941 };
  12942 defineFunction({
  12943   type: "op",
  12944   names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22C0", "\u22C1", "\u22C2", "\u22C3", "\u2A00", "\u2A01", "\u2A02", "\u2A04", "\u2A06"],
  12945   props: {
  12946     numArgs: 0
  12947   },
  12948   handler: function handler(_ref, args) {
  12949     var parser = _ref.parser,
  12950         funcName = _ref.funcName;
  12951     var fName = funcName;
  12952 
  12953     if (fName.length === 1) {
  12954       fName = singleCharBigOps[fName];
  12955     }
  12956 
  12957     return {
  12958       type: "op",
  12959       mode: parser.mode,
  12960       limits: true,
  12961       parentIsSupSub: false,
  12962       symbol: true,
  12963       name: fName
  12964     };
  12965   },
  12966   htmlBuilder: op_htmlBuilder,
  12967   mathmlBuilder: op_mathmlBuilder
  12968 }); // Note: calling defineFunction with a type that's already been defined only
  12969 // works because the same htmlBuilder and mathmlBuilder are being used.
  12970 
  12971 defineFunction({
  12972   type: "op",
  12973   names: ["\\mathop"],
  12974   props: {
  12975     numArgs: 1,
  12976     primitive: true
  12977   },
  12978   handler: function handler(_ref2, args) {
  12979     var parser = _ref2.parser;
  12980     var body = args[0];
  12981     return {
  12982       type: "op",
  12983       mode: parser.mode,
  12984       limits: false,
  12985       parentIsSupSub: false,
  12986       symbol: false,
  12987       body: ordargument(body)
  12988     };
  12989   },
  12990   htmlBuilder: op_htmlBuilder,
  12991   mathmlBuilder: op_mathmlBuilder
  12992 }); // There are 2 flags for operators; whether they produce limits in
  12993 // displaystyle, and whether they are symbols and should grow in
  12994 // displaystyle. These four groups cover the four possible choices.
  12995 
  12996 var singleCharIntegrals = {
  12997   "\u222B": "\\int",
  12998   "\u222C": "\\iint",
  12999   "\u222D": "\\iiint",
  13000   "\u222E": "\\oint",
  13001   "\u222F": "\\oiint",
  13002   "\u2230": "\\oiiint"
  13003 }; // No limits, not symbols
  13004 
  13005 defineFunction({
  13006   type: "op",
  13007   names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"],
  13008   props: {
  13009     numArgs: 0
  13010   },
  13011   handler: function handler(_ref3) {
  13012     var parser = _ref3.parser,
  13013         funcName = _ref3.funcName;
  13014     return {
  13015       type: "op",
  13016       mode: parser.mode,
  13017       limits: false,
  13018       parentIsSupSub: false,
  13019       symbol: false,
  13020       name: funcName
  13021     };
  13022   },
  13023   htmlBuilder: op_htmlBuilder,
  13024   mathmlBuilder: op_mathmlBuilder
  13025 }); // Limits, not symbols
  13026 
  13027 defineFunction({
  13028   type: "op",
  13029   names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
  13030   props: {
  13031     numArgs: 0
  13032   },
  13033   handler: function handler(_ref4) {
  13034     var parser = _ref4.parser,
  13035         funcName = _ref4.funcName;
  13036     return {
  13037       type: "op",
  13038       mode: parser.mode,
  13039       limits: true,
  13040       parentIsSupSub: false,
  13041       symbol: false,
  13042       name: funcName
  13043     };
  13044   },
  13045   htmlBuilder: op_htmlBuilder,
  13046   mathmlBuilder: op_mathmlBuilder
  13047 }); // No limits, symbols
  13048 
  13049 defineFunction({
  13050   type: "op",
  13051   names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222B", "\u222C", "\u222D", "\u222E", "\u222F", "\u2230"],
  13052   props: {
  13053     numArgs: 0
  13054   },
  13055   handler: function handler(_ref5) {
  13056     var parser = _ref5.parser,
  13057         funcName = _ref5.funcName;
  13058     var fName = funcName;
  13059 
  13060     if (fName.length === 1) {
  13061       fName = singleCharIntegrals[fName];
  13062     }
  13063 
  13064     return {
  13065       type: "op",
  13066       mode: parser.mode,
  13067       limits: false,
  13068       parentIsSupSub: false,
  13069       symbol: true,
  13070       name: fName
  13071     };
  13072   },
  13073   htmlBuilder: op_htmlBuilder,
  13074   mathmlBuilder: op_mathmlBuilder
  13075 });
  13076 ;// CONCATENATED MODULE: ./src/functions/operatorname.js
  13077 
  13078 
  13079 
  13080 
  13081 
  13082 
  13083 
  13084 
  13085 // NOTE: Unlike most `htmlBuilder`s, this one handles not only
  13086 // "operatorname", but also  "supsub" since \operatorname* can
  13087 // affect super/subscripting.
  13088 var operatorname_htmlBuilder = function htmlBuilder(grp, options) {
  13089   // Operators are handled in the TeXbook pg. 443-444, rule 13(a).
  13090   var supGroup;
  13091   var subGroup;
  13092   var hasLimits = false;
  13093   var group;
  13094 
  13095   if (grp.type === "supsub") {
  13096     // If we have limits, supsub will pass us its group to handle. Pull
  13097     // out the superscript and subscript and set the group to the op in
  13098     // its base.
  13099     supGroup = grp.sup;
  13100     subGroup = grp.sub;
  13101     group = assertNodeType(grp.base, "operatorname");
  13102     hasLimits = true;
  13103   } else {
  13104     group = assertNodeType(grp, "operatorname");
  13105   }
  13106 
  13107   var base;
  13108 
  13109   if (group.body.length > 0) {
  13110     var body = group.body.map(function (child) {
  13111       // $FlowFixMe: Check if the node has a string `text` property.
  13112       var childText = child.text;
  13113 
  13114       if (typeof childText === "string") {
  13115         return {
  13116           type: "textord",
  13117           mode: child.mode,
  13118           text: childText
  13119         };
  13120       } else {
  13121         return child;
  13122       }
  13123     }); // Consolidate function names into symbol characters.
  13124 
  13125     var expression = buildExpression(body, options.withFont("mathrm"), true);
  13126 
  13127     for (var i = 0; i < expression.length; i++) {
  13128       var child = expression[i];
  13129 
  13130       if (child instanceof SymbolNode) {
  13131         // Per amsopn package,
  13132         // change minus to hyphen and \ast to asterisk
  13133         child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
  13134       }
  13135     }
  13136 
  13137     base = buildCommon.makeSpan(["mop"], expression, options);
  13138   } else {
  13139     base = buildCommon.makeSpan(["mop"], [], options);
  13140   }
  13141 
  13142   if (hasLimits) {
  13143     return assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0);
  13144   } else {
  13145     return base;
  13146   }
  13147 };
  13148 
  13149 var operatorname_mathmlBuilder = function mathmlBuilder(group, options) {
  13150   // The steps taken here are similar to the html version.
  13151   var expression = buildMathML_buildExpression(group.body, options.withFont("mathrm")); // Is expression a string or has it something like a fraction?
  13152 
  13153   var isAllString = true; // default
  13154 
  13155   for (var i = 0; i < expression.length; i++) {
  13156     var node = expression[i];
  13157 
  13158     if (node instanceof mathMLTree.SpaceNode) {// Do nothing
  13159     } else if (node instanceof mathMLTree.MathNode) {
  13160       switch (node.type) {
  13161         case "mi":
  13162         case "mn":
  13163         case "ms":
  13164         case "mspace":
  13165         case "mtext":
  13166           break;
  13167         // Do nothing yet.
  13168 
  13169         case "mo":
  13170           {
  13171             var child = node.children[0];
  13172 
  13173             if (node.children.length === 1 && child instanceof mathMLTree.TextNode) {
  13174               child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
  13175             } else {
  13176               isAllString = false;
  13177             }
  13178 
  13179             break;
  13180           }
  13181 
  13182         default:
  13183           isAllString = false;
  13184       }
  13185     } else {
  13186       isAllString = false;
  13187     }
  13188   }
  13189 
  13190   if (isAllString) {
  13191     // Write a single TextNode instead of multiple nested tags.
  13192     var word = expression.map(function (node) {
  13193       return node.toText();
  13194     }).join("");
  13195     expression = [new mathMLTree.TextNode(word)];
  13196   }
  13197 
  13198   var identifier = new mathMLTree.MathNode("mi", expression);
  13199   identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as &ApplyFunction;
  13200   // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp
  13201 
  13202   var operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]);
  13203 
  13204   if (group.parentIsSupSub) {
  13205     return new mathMLTree.MathNode("mrow", [identifier, operator]);
  13206   } else {
  13207     return mathMLTree.newDocumentFragment([identifier, operator]);
  13208   }
  13209 }; // \operatorname
  13210 // amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@
  13211 
  13212 
  13213 defineFunction({
  13214   type: "operatorname",
  13215   names: ["\\operatorname", "\\operatorname*"],
  13216   props: {
  13217     numArgs: 1
  13218   },
  13219   handler: function handler(_ref, args) {
  13220     var parser = _ref.parser,
  13221         funcName = _ref.funcName;
  13222     var body = args[0];
  13223     return {
  13224       type: "operatorname",
  13225       mode: parser.mode,
  13226       body: ordargument(body),
  13227       alwaysHandleSupSub: funcName === "\\operatorname*",
  13228       limits: false,
  13229       parentIsSupSub: false
  13230     };
  13231   },
  13232   htmlBuilder: operatorname_htmlBuilder,
  13233   mathmlBuilder: operatorname_mathmlBuilder
  13234 });
  13235 ;// CONCATENATED MODULE: ./src/functions/ordgroup.js
  13236 
  13237 
  13238 
  13239 
  13240 defineFunctionBuilders({
  13241   type: "ordgroup",
  13242   htmlBuilder: function htmlBuilder(group, options) {
  13243     if (group.semisimple) {
  13244       return buildCommon.makeFragment(buildExpression(group.body, options, false));
  13245     }
  13246 
  13247     return buildCommon.makeSpan(["mord"], buildExpression(group.body, options, true), options);
  13248   },
  13249   mathmlBuilder: function mathmlBuilder(group, options) {
  13250     return buildExpressionRow(group.body, options, true);
  13251   }
  13252 });
  13253 ;// CONCATENATED MODULE: ./src/functions/overline.js
  13254 
  13255 
  13256 
  13257 
  13258 
  13259 defineFunction({
  13260   type: "overline",
  13261   names: ["\\overline"],
  13262   props: {
  13263     numArgs: 1
  13264   },
  13265   handler: function handler(_ref, args) {
  13266     var parser = _ref.parser;
  13267     var body = args[0];
  13268     return {
  13269       type: "overline",
  13270       mode: parser.mode,
  13271       body: body
  13272     };
  13273   },
  13274   htmlBuilder: function htmlBuilder(group, options) {
  13275     // Overlines are handled in the TeXbook pg 443, Rule 9.
  13276     // Build the inner group in the cramped style.
  13277     var innerGroup = buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body
  13278 
  13279     var line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns
  13280 
  13281     var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
  13282     var vlist = buildCommon.makeVList({
  13283       positionType: "firstBaseline",
  13284       children: [{
  13285         type: "elem",
  13286         elem: innerGroup
  13287       }, {
  13288         type: "kern",
  13289         size: 3 * defaultRuleThickness
  13290       }, {
  13291         type: "elem",
  13292         elem: line
  13293       }, {
  13294         type: "kern",
  13295         size: defaultRuleThickness
  13296       }]
  13297     }, options);
  13298     return buildCommon.makeSpan(["mord", "overline"], [vlist], options);
  13299   },
  13300   mathmlBuilder: function mathmlBuilder(group, options) {
  13301     var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]);
  13302     operator.setAttribute("stretchy", "true");
  13303     var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.body, options), operator]);
  13304     node.setAttribute("accent", "true");
  13305     return node;
  13306   }
  13307 });
  13308 ;// CONCATENATED MODULE: ./src/functions/phantom.js
  13309 
  13310 
  13311 
  13312 
  13313 
  13314 defineFunction({
  13315   type: "phantom",
  13316   names: ["\\phantom"],
  13317   props: {
  13318     numArgs: 1,
  13319     allowedInText: true
  13320   },
  13321   handler: function handler(_ref, args) {
  13322     var parser = _ref.parser;
  13323     var body = args[0];
  13324     return {
  13325       type: "phantom",
  13326       mode: parser.mode,
  13327       body: ordargument(body)
  13328     };
  13329   },
  13330   htmlBuilder: function htmlBuilder(group, options) {
  13331     var elements = buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains.
  13332     // See "color" for more details.
  13333 
  13334     return buildCommon.makeFragment(elements);
  13335   },
  13336   mathmlBuilder: function mathmlBuilder(group, options) {
  13337     var inner = buildMathML_buildExpression(group.body, options);
  13338     return new mathMLTree.MathNode("mphantom", inner);
  13339   }
  13340 });
  13341 defineFunction({
  13342   type: "hphantom",
  13343   names: ["\\hphantom"],
  13344   props: {
  13345     numArgs: 1,
  13346     allowedInText: true
  13347   },
  13348   handler: function handler(_ref2, args) {
  13349     var parser = _ref2.parser;
  13350     var body = args[0];
  13351     return {
  13352       type: "hphantom",
  13353       mode: parser.mode,
  13354       body: body
  13355     };
  13356   },
  13357   htmlBuilder: function htmlBuilder(group, options) {
  13358     var node = buildCommon.makeSpan([], [buildGroup(group.body, options.withPhantom())]);
  13359     node.height = 0;
  13360     node.depth = 0;
  13361 
  13362     if (node.children) {
  13363       for (var i = 0; i < node.children.length; i++) {
  13364         node.children[i].height = 0;
  13365         node.children[i].depth = 0;
  13366       }
  13367     } // See smash for comment re: use of makeVList
  13368 
  13369 
  13370     node = buildCommon.makeVList({
  13371       positionType: "firstBaseline",
  13372       children: [{
  13373         type: "elem",
  13374         elem: node
  13375       }]
  13376     }, options); // For spacing, TeX treats \smash as a math group (same spacing as ord).
  13377 
  13378     return buildCommon.makeSpan(["mord"], [node], options);
  13379   },
  13380   mathmlBuilder: function mathmlBuilder(group, options) {
  13381     var inner = buildMathML_buildExpression(ordargument(group.body), options);
  13382     var phantom = new mathMLTree.MathNode("mphantom", inner);
  13383     var node = new mathMLTree.MathNode("mpadded", [phantom]);
  13384     node.setAttribute("height", "0px");
  13385     node.setAttribute("depth", "0px");
  13386     return node;
  13387   }
  13388 });
  13389 defineFunction({
  13390   type: "vphantom",
  13391   names: ["\\vphantom"],
  13392   props: {
  13393     numArgs: 1,
  13394     allowedInText: true
  13395   },
  13396   handler: function handler(_ref3, args) {
  13397     var parser = _ref3.parser;
  13398     var body = args[0];
  13399     return {
  13400       type: "vphantom",
  13401       mode: parser.mode,
  13402       body: body
  13403     };
  13404   },
  13405   htmlBuilder: function htmlBuilder(group, options) {
  13406     var inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options.withPhantom())]);
  13407     var fix = buildCommon.makeSpan(["fix"], []);
  13408     return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options);
  13409   },
  13410   mathmlBuilder: function mathmlBuilder(group, options) {
  13411     var inner = buildMathML_buildExpression(ordargument(group.body), options);
  13412     var phantom = new mathMLTree.MathNode("mphantom", inner);
  13413     var node = new mathMLTree.MathNode("mpadded", [phantom]);
  13414     node.setAttribute("width", "0px");
  13415     return node;
  13416   }
  13417 });
  13418 ;// CONCATENATED MODULE: ./src/functions/raisebox.js
  13419 
  13420 
  13421 
  13422 
  13423 
  13424 
  13425  // Box manipulation
  13426 
  13427 defineFunction({
  13428   type: "raisebox",
  13429   names: ["\\raisebox"],
  13430   props: {
  13431     numArgs: 2,
  13432     argTypes: ["size", "hbox"],
  13433     allowedInText: true
  13434   },
  13435   handler: function handler(_ref, args) {
  13436     var parser = _ref.parser;
  13437     var amount = assertNodeType(args[0], "size").value;
  13438     var body = args[1];
  13439     return {
  13440       type: "raisebox",
  13441       mode: parser.mode,
  13442       dy: amount,
  13443       body: body
  13444     };
  13445   },
  13446   htmlBuilder: function htmlBuilder(group, options) {
  13447     var body = buildGroup(group.body, options);
  13448     var dy = calculateSize(group.dy, options);
  13449     return buildCommon.makeVList({
  13450       positionType: "shift",
  13451       positionData: -dy,
  13452       children: [{
  13453         type: "elem",
  13454         elem: body
  13455       }]
  13456     }, options);
  13457   },
  13458   mathmlBuilder: function mathmlBuilder(group, options) {
  13459     var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
  13460     var dy = group.dy.number + group.dy.unit;
  13461     node.setAttribute("voffset", dy);
  13462     return node;
  13463   }
  13464 });
  13465 ;// CONCATENATED MODULE: ./src/functions/rule.js
  13466 
  13467 
  13468 
  13469 
  13470 
  13471 defineFunction({
  13472   type: "rule",
  13473   names: ["\\rule"],
  13474   props: {
  13475     numArgs: 2,
  13476     numOptionalArgs: 1,
  13477     argTypes: ["size", "size", "size"]
  13478   },
  13479   handler: function handler(_ref, args, optArgs) {
  13480     var parser = _ref.parser;
  13481     var shift = optArgs[0];
  13482     var width = assertNodeType(args[0], "size");
  13483     var height = assertNodeType(args[1], "size");
  13484     return {
  13485       type: "rule",
  13486       mode: parser.mode,
  13487       shift: shift && assertNodeType(shift, "size").value,
  13488       width: width.value,
  13489       height: height.value
  13490     };
  13491   },
  13492   htmlBuilder: function htmlBuilder(group, options) {
  13493     // Make an empty span for the rule
  13494     var rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units
  13495 
  13496     var width = calculateSize(group.width, options);
  13497     var height = calculateSize(group.height, options);
  13498     var shift = group.shift ? calculateSize(group.shift, options) : 0; // Style the rule to the right size
  13499 
  13500     rule.style.borderRightWidth = width + "em";
  13501     rule.style.borderTopWidth = height + "em";
  13502     rule.style.bottom = shift + "em"; // Record the height and width
  13503 
  13504     rule.width = width;
  13505     rule.height = height + shift;
  13506     rule.depth = -shift; // Font size is the number large enough that the browser will
  13507     // reserve at least `absHeight` space above the baseline.
  13508     // The 1.125 factor was empirically determined
  13509 
  13510     rule.maxFontSize = height * 1.125 * options.sizeMultiplier;
  13511     return rule;
  13512   },
  13513   mathmlBuilder: function mathmlBuilder(group, options) {
  13514     var width = calculateSize(group.width, options);
  13515     var height = calculateSize(group.height, options);
  13516     var shift = group.shift ? calculateSize(group.shift, options) : 0;
  13517     var color = options.color && options.getColor() || "black";
  13518     var rule = new mathMLTree.MathNode("mspace");
  13519     rule.setAttribute("mathbackground", color);
  13520     rule.setAttribute("width", width + "em");
  13521     rule.setAttribute("height", height + "em");
  13522     var wrapper = new mathMLTree.MathNode("mpadded", [rule]);
  13523 
  13524     if (shift >= 0) {
  13525       wrapper.setAttribute("height", "+" + shift + "em");
  13526     } else {
  13527       wrapper.setAttribute("height", shift + "em");
  13528       wrapper.setAttribute("depth", "+" + -shift + "em");
  13529     }
  13530 
  13531     wrapper.setAttribute("voffset", shift + "em");
  13532     return wrapper;
  13533   }
  13534 });
  13535 ;// CONCATENATED MODULE: ./src/functions/sizing.js
  13536 
  13537 
  13538 
  13539 
  13540 
  13541 function sizingGroup(value, options, baseOptions) {
  13542   var inner = buildExpression(value, options, false);
  13543   var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize
  13544   // manually. Handle nested size changes.
  13545 
  13546   for (var i = 0; i < inner.length; i++) {
  13547     var pos = inner[i].classes.indexOf("sizing");
  13548 
  13549     if (pos < 0) {
  13550       Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions));
  13551     } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) {
  13552       // This is a nested size change: e.g., inner[i] is the "b" in
  13553       // `\Huge a \small b`. Override the old size (the `reset-` class)
  13554       // but not the new size.
  13555       inner[i].classes[pos + 1] = "reset-size" + baseOptions.size;
  13556     }
  13557 
  13558     inner[i].height *= multiplier;
  13559     inner[i].depth *= multiplier;
  13560   }
  13561 
  13562   return buildCommon.makeFragment(inner);
  13563 }
  13564 var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"];
  13565 var sizing_htmlBuilder = function htmlBuilder(group, options) {
  13566   // Handle sizing operators like \Huge. Real TeX doesn't actually allow
  13567   // these functions inside of math expressions, so we do some special
  13568   // handling.
  13569   var newOptions = options.havingSize(group.size);
  13570   return sizingGroup(group.body, newOptions, options);
  13571 };
  13572 defineFunction({
  13573   type: "sizing",
  13574   names: sizeFuncs,
  13575   props: {
  13576     numArgs: 0,
  13577     allowedInText: true
  13578   },
  13579   handler: function handler(_ref, args) {
  13580     var breakOnTokenText = _ref.breakOnTokenText,
  13581         funcName = _ref.funcName,
  13582         parser = _ref.parser;
  13583     var body = parser.parseExpression(false, breakOnTokenText);
  13584     return {
  13585       type: "sizing",
  13586       mode: parser.mode,
  13587       // Figure out what size to use based on the list of functions above
  13588       size: sizeFuncs.indexOf(funcName) + 1,
  13589       body: body
  13590     };
  13591   },
  13592   htmlBuilder: sizing_htmlBuilder,
  13593   mathmlBuilder: function mathmlBuilder(group, options) {
  13594     var newOptions = options.havingSize(group.size);
  13595     var inner = buildMathML_buildExpression(group.body, newOptions);
  13596     var node = new mathMLTree.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size
  13597     // changes, because we don't keep state of what style we're currently
  13598     // in, so we can't reset the size to normal before changing it.  Now
  13599     // that we're passing an options parameter we should be able to fix
  13600     // this.
  13601 
  13602     node.setAttribute("mathsize", newOptions.sizeMultiplier + "em");
  13603     return node;
  13604   }
  13605 });
  13606 ;// CONCATENATED MODULE: ./src/functions/smash.js
  13607 // smash, with optional [tb], as in AMS
  13608 
  13609 
  13610 
  13611 
  13612 
  13613 
  13614 defineFunction({
  13615   type: "smash",
  13616   names: ["\\smash"],
  13617   props: {
  13618     numArgs: 1,
  13619     numOptionalArgs: 1,
  13620     allowedInText: true
  13621   },
  13622   handler: function handler(_ref, args, optArgs) {
  13623     var parser = _ref.parser;
  13624     var smashHeight = false;
  13625     var smashDepth = false;
  13626     var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
  13627 
  13628     if (tbArg) {
  13629       // Optional [tb] argument is engaged.
  13630       // ref: amsmath: \renewcommand{\smash}[1][tb]{%
  13631       //               def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}%
  13632       var letter = "";
  13633 
  13634       for (var i = 0; i < tbArg.body.length; ++i) {
  13635         var node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property.
  13636 
  13637         letter = node.text;
  13638 
  13639         if (letter === "t") {
  13640           smashHeight = true;
  13641         } else if (letter === "b") {
  13642           smashDepth = true;
  13643         } else {
  13644           smashHeight = false;
  13645           smashDepth = false;
  13646           break;
  13647         }
  13648       }
  13649     } else {
  13650       smashHeight = true;
  13651       smashDepth = true;
  13652     }
  13653 
  13654     var body = args[0];
  13655     return {
  13656       type: "smash",
  13657       mode: parser.mode,
  13658       body: body,
  13659       smashHeight: smashHeight,
  13660       smashDepth: smashDepth
  13661     };
  13662   },
  13663   htmlBuilder: function htmlBuilder(group, options) {
  13664     var node = buildCommon.makeSpan([], [buildGroup(group.body, options)]);
  13665 
  13666     if (!group.smashHeight && !group.smashDepth) {
  13667       return node;
  13668     }
  13669 
  13670     if (group.smashHeight) {
  13671       node.height = 0; // In order to influence makeVList, we have to reset the children.
  13672 
  13673       if (node.children) {
  13674         for (var i = 0; i < node.children.length; i++) {
  13675           node.children[i].height = 0;
  13676         }
  13677       }
  13678     }
  13679 
  13680     if (group.smashDepth) {
  13681       node.depth = 0;
  13682 
  13683       if (node.children) {
  13684         for (var _i = 0; _i < node.children.length; _i++) {
  13685           node.children[_i].depth = 0;
  13686         }
  13687       }
  13688     } // At this point, we've reset the TeX-like height and depth values.
  13689     // But the span still has an HTML line height.
  13690     // makeVList applies "display: table-cell", which prevents the browser
  13691     // from acting on that line height. So we'll call makeVList now.
  13692 
  13693 
  13694     var smashedNode = buildCommon.makeVList({
  13695       positionType: "firstBaseline",
  13696       children: [{
  13697         type: "elem",
  13698         elem: node
  13699       }]
  13700     }, options); // For spacing, TeX treats \hphantom as a math group (same spacing as ord).
  13701 
  13702     return buildCommon.makeSpan(["mord"], [smashedNode], options);
  13703   },
  13704   mathmlBuilder: function mathmlBuilder(group, options) {
  13705     var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
  13706 
  13707     if (group.smashHeight) {
  13708       node.setAttribute("height", "0px");
  13709     }
  13710 
  13711     if (group.smashDepth) {
  13712       node.setAttribute("depth", "0px");
  13713     }
  13714 
  13715     return node;
  13716   }
  13717 });
  13718 ;// CONCATENATED MODULE: ./src/functions/sqrt.js
  13719 
  13720 
  13721 
  13722 
  13723 
  13724 
  13725 
  13726 defineFunction({
  13727   type: "sqrt",
  13728   names: ["\\sqrt"],
  13729   props: {
  13730     numArgs: 1,
  13731     numOptionalArgs: 1
  13732   },
  13733   handler: function handler(_ref, args, optArgs) {
  13734     var parser = _ref.parser;
  13735     var index = optArgs[0];
  13736     var body = args[0];
  13737     return {
  13738       type: "sqrt",
  13739       mode: parser.mode,
  13740       body: body,
  13741       index: index
  13742     };
  13743   },
  13744   htmlBuilder: function htmlBuilder(group, options) {
  13745     // Square roots are handled in the TeXbook pg. 443, Rule 11.
  13746     // First, we do the same steps as in overline to build the inner group
  13747     // and line
  13748     var inner = buildGroup(group.body, options.havingCrampedStyle());
  13749 
  13750     if (inner.height === 0) {
  13751       // Render a small surd.
  13752       inner.height = options.fontMetrics().xHeight;
  13753     } // Some groups can return document fragments.  Handle those by wrapping
  13754     // them in a span.
  13755 
  13756 
  13757     inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter
  13758 
  13759     var metrics = options.fontMetrics();
  13760     var theta = metrics.defaultRuleThickness;
  13761     var phi = theta;
  13762 
  13763     if (options.style.id < src_Style.TEXT.id) {
  13764       phi = options.fontMetrics().xHeight;
  13765     } // Calculate the clearance between the body and line
  13766 
  13767 
  13768     var lineClearance = theta + phi / 4;
  13769     var minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size
  13770 
  13771     var _delimiter$sqrtImage = delimiter.sqrtImage(minDelimiterHeight, options),
  13772         img = _delimiter$sqrtImage.span,
  13773         ruleWidth = _delimiter$sqrtImage.ruleWidth,
  13774         advanceWidth = _delimiter$sqrtImage.advanceWidth;
  13775 
  13776     var delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size
  13777 
  13778     if (delimDepth > inner.height + inner.depth + lineClearance) {
  13779       lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2;
  13780     } // Shift the sqrt image
  13781 
  13782 
  13783     var imgShift = img.height - inner.height - lineClearance - ruleWidth;
  13784     inner.style.paddingLeft = advanceWidth + "em"; // Overlay the image and the argument.
  13785 
  13786     var body = buildCommon.makeVList({
  13787       positionType: "firstBaseline",
  13788       children: [{
  13789         type: "elem",
  13790         elem: inner,
  13791         wrapperClasses: ["svg-align"]
  13792       }, {
  13793         type: "kern",
  13794         size: -(inner.height + imgShift)
  13795       }, {
  13796         type: "elem",
  13797         elem: img
  13798       }, {
  13799         type: "kern",
  13800         size: ruleWidth
  13801       }]
  13802     }, options);
  13803 
  13804     if (!group.index) {
  13805       return buildCommon.makeSpan(["mord", "sqrt"], [body], options);
  13806     } else {
  13807       // Handle the optional root index
  13808       // The index is always in scriptscript style
  13809       var newOptions = options.havingStyle(src_Style.SCRIPTSCRIPT);
  13810       var rootm = buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX
  13811       // source, in the definition of `\r@@t`.
  13812 
  13813       var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly
  13814 
  13815       var rootVList = buildCommon.makeVList({
  13816         positionType: "shift",
  13817         positionData: -toShift,
  13818         children: [{
  13819           type: "elem",
  13820           elem: rootm
  13821         }]
  13822       }, options); // Add a class surrounding it so we can add on the appropriate
  13823       // kerning
  13824 
  13825       var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]);
  13826       return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options);
  13827     }
  13828   },
  13829   mathmlBuilder: function mathmlBuilder(group, options) {
  13830     var body = group.body,
  13831         index = group.index;
  13832     return index ? new mathMLTree.MathNode("mroot", [buildMathML_buildGroup(body, options), buildMathML_buildGroup(index, options)]) : new mathMLTree.MathNode("msqrt", [buildMathML_buildGroup(body, options)]);
  13833   }
  13834 });
  13835 ;// CONCATENATED MODULE: ./src/functions/styling.js
  13836 
  13837 
  13838 
  13839 
  13840 
  13841 var styling_styleMap = {
  13842   "display": src_Style.DISPLAY,
  13843   "text": src_Style.TEXT,
  13844   "script": src_Style.SCRIPT,
  13845   "scriptscript": src_Style.SCRIPTSCRIPT
  13846 };
  13847 defineFunction({
  13848   type: "styling",
  13849   names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
  13850   props: {
  13851     numArgs: 0,
  13852     allowedInText: true,
  13853     primitive: true
  13854   },
  13855   handler: function handler(_ref, args) {
  13856     var breakOnTokenText = _ref.breakOnTokenText,
  13857         funcName = _ref.funcName,
  13858         parser = _ref.parser;
  13859     // parse out the implicit body
  13860     var body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g.
  13861     // here and in buildHTML and de-dupe the enumeration of all the styles).
  13862     // $FlowFixMe: The names above exactly match the styles.
  13863 
  13864     var style = funcName.slice(1, funcName.length - 5);
  13865     return {
  13866       type: "styling",
  13867       mode: parser.mode,
  13868       // Figure out what style to use by pulling out the style from
  13869       // the function name
  13870       style: style,
  13871       body: body
  13872     };
  13873   },
  13874   htmlBuilder: function htmlBuilder(group, options) {
  13875     // Style changes are handled in the TeXbook on pg. 442, Rule 3.
  13876     var newStyle = styling_styleMap[group.style];
  13877     var newOptions = options.havingStyle(newStyle).withFont('');
  13878     return sizingGroup(group.body, newOptions, options);
  13879   },
  13880   mathmlBuilder: function mathmlBuilder(group, options) {
  13881     // Figure out what style we're changing to.
  13882     var newStyle = styling_styleMap[group.style];
  13883     var newOptions = options.havingStyle(newStyle);
  13884     var inner = buildMathML_buildExpression(group.body, newOptions);
  13885     var node = new mathMLTree.MathNode("mstyle", inner);
  13886     var styleAttributes = {
  13887       "display": ["0", "true"],
  13888       "text": ["0", "false"],
  13889       "script": ["1", "false"],
  13890       "scriptscript": ["2", "false"]
  13891     };
  13892     var attr = styleAttributes[group.style];
  13893     node.setAttribute("scriptlevel", attr[0]);
  13894     node.setAttribute("displaystyle", attr[1]);
  13895     return node;
  13896   }
  13897 });
  13898 ;// CONCATENATED MODULE: ./src/functions/supsub.js
  13899 
  13900 
  13901 
  13902 
  13903 
  13904 
  13905 
  13906 
  13907 
  13908 
  13909 
  13910 
  13911 
  13912 /**
  13913  * Sometimes, groups perform special rules when they have superscripts or
  13914  * subscripts attached to them. This function lets the `supsub` group know that
  13915  * Sometimes, groups perform special rules when they have superscripts or
  13916  * its inner element should handle the superscripts and subscripts instead of
  13917  * handling them itself.
  13918  */
  13919 var htmlBuilderDelegate = function htmlBuilderDelegate(group, options) {
  13920   var base = group.base;
  13921 
  13922   if (!base) {
  13923     return null;
  13924   } else if (base.type === "op") {
  13925     // Operators handle supsubs differently when they have limits
  13926     // (e.g. `\displaystyle\sum_2^3`)
  13927     var delegate = base.limits && (options.style.size === src_Style.DISPLAY.size || base.alwaysHandleSupSub);
  13928     return delegate ? op_htmlBuilder : null;
  13929   } else if (base.type === "operatorname") {
  13930     var _delegate = base.alwaysHandleSupSub && (options.style.size === src_Style.DISPLAY.size || base.limits);
  13931 
  13932     return _delegate ? operatorname_htmlBuilder : null;
  13933   } else if (base.type === "accent") {
  13934     return utils.isCharacterBox(base.base) ? htmlBuilder : null;
  13935   } else if (base.type === "horizBrace") {
  13936     var isSup = !group.sub;
  13937     return isSup === base.isOver ? horizBrace_htmlBuilder : null;
  13938   } else {
  13939     return null;
  13940   }
  13941 }; // Super scripts and subscripts, whose precise placement can depend on other
  13942 // functions that precede them.
  13943 
  13944 
  13945 defineFunctionBuilders({
  13946   type: "supsub",
  13947   htmlBuilder: function htmlBuilder(group, options) {
  13948     // Superscript and subscripts are handled in the TeXbook on page
  13949     // 445-446, rules 18(a-f).
  13950     // Here is where we defer to the inner group if it should handle
  13951     // superscripts and subscripts itself.
  13952     var builderDelegate = htmlBuilderDelegate(group, options);
  13953 
  13954     if (builderDelegate) {
  13955       return builderDelegate(group, options);
  13956     }
  13957 
  13958     var valueBase = group.base,
  13959         valueSup = group.sup,
  13960         valueSub = group.sub;
  13961     var base = buildGroup(valueBase, options);
  13962     var supm;
  13963     var subm;
  13964     var metrics = options.fontMetrics(); // Rule 18a
  13965 
  13966     var supShift = 0;
  13967     var subShift = 0;
  13968     var isCharacterBox = valueBase && utils.isCharacterBox(valueBase);
  13969 
  13970     if (valueSup) {
  13971       var newOptions = options.havingStyle(options.style.sup());
  13972       supm = buildGroup(valueSup, newOptions, options);
  13973 
  13974       if (!isCharacterBox) {
  13975         supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier;
  13976       }
  13977     }
  13978 
  13979     if (valueSub) {
  13980       var _newOptions = options.havingStyle(options.style.sub());
  13981 
  13982       subm = buildGroup(valueSub, _newOptions, options);
  13983 
  13984       if (!isCharacterBox) {
  13985         subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier;
  13986       }
  13987     } // Rule 18c
  13988 
  13989 
  13990     var minSupShift;
  13991 
  13992     if (options.style === src_Style.DISPLAY) {
  13993       minSupShift = metrics.sup1;
  13994     } else if (options.style.cramped) {
  13995       minSupShift = metrics.sup3;
  13996     } else {
  13997       minSupShift = metrics.sup2;
  13998     } // scriptspace is a font-size-independent size, so scale it
  13999     // appropriately for use as the marginRight.
  14000 
  14001 
  14002     var multiplier = options.sizeMultiplier;
  14003     var marginRight = 0.5 / metrics.ptPerEm / multiplier + "em";
  14004     var marginLeft = null;
  14005 
  14006     if (subm) {
  14007       // Subscripts shouldn't be shifted by the base's italic correction.
  14008       // Account for that by shifting the subscript back the appropriate
  14009       // amount. Note we only do this when the base is a single symbol.
  14010       var isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint");
  14011 
  14012       if (base instanceof SymbolNode || isOiint) {
  14013         // $FlowFixMe
  14014         marginLeft = -base.italic + "em";
  14015       }
  14016     }
  14017 
  14018     var supsub;
  14019 
  14020     if (supm && subm) {
  14021       supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
  14022       subShift = Math.max(subShift, metrics.sub2);
  14023       var ruleWidth = metrics.defaultRuleThickness; // Rule 18e
  14024 
  14025       var maxWidth = 4 * ruleWidth;
  14026 
  14027       if (supShift - supm.depth - (subm.height - subShift) < maxWidth) {
  14028         subShift = maxWidth - (supShift - supm.depth) + subm.height;
  14029         var psi = 0.8 * metrics.xHeight - (supShift - supm.depth);
  14030 
  14031         if (psi > 0) {
  14032           supShift += psi;
  14033           subShift -= psi;
  14034         }
  14035       }
  14036 
  14037       var vlistElem = [{
  14038         type: "elem",
  14039         elem: subm,
  14040         shift: subShift,
  14041         marginRight: marginRight,
  14042         marginLeft: marginLeft
  14043       }, {
  14044         type: "elem",
  14045         elem: supm,
  14046         shift: -supShift,
  14047         marginRight: marginRight
  14048       }];
  14049       supsub = buildCommon.makeVList({
  14050         positionType: "individualShift",
  14051         children: vlistElem
  14052       }, options);
  14053     } else if (subm) {
  14054       // Rule 18b
  14055       subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight);
  14056       var _vlistElem = [{
  14057         type: "elem",
  14058         elem: subm,
  14059         marginLeft: marginLeft,
  14060         marginRight: marginRight
  14061       }];
  14062       supsub = buildCommon.makeVList({
  14063         positionType: "shift",
  14064         positionData: subShift,
  14065         children: _vlistElem
  14066       }, options);
  14067     } else if (supm) {
  14068       // Rule 18c, d
  14069       supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
  14070       supsub = buildCommon.makeVList({
  14071         positionType: "shift",
  14072         positionData: -supShift,
  14073         children: [{
  14074           type: "elem",
  14075           elem: supm,
  14076           marginRight: marginRight
  14077         }]
  14078       }, options);
  14079     } else {
  14080       throw new Error("supsub must have either sup or sub.");
  14081     } // Wrap the supsub vlist in a span.msupsub to reset text-align.
  14082 
  14083 
  14084     var mclass = getTypeOfDomTree(base, "right") || "mord";
  14085     return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options);
  14086   },
  14087   mathmlBuilder: function mathmlBuilder(group, options) {
  14088     // Is the inner group a relevant horizonal brace?
  14089     var isBrace = false;
  14090     var isOver;
  14091     var isSup;
  14092 
  14093     if (group.base && group.base.type === "horizBrace") {
  14094       isSup = !!group.sup;
  14095 
  14096       if (isSup === group.base.isOver) {
  14097         isBrace = true;
  14098         isOver = group.base.isOver;
  14099       }
  14100     }
  14101 
  14102     if (group.base && (group.base.type === "op" || group.base.type === "operatorname")) {
  14103       group.base.parentIsSupSub = true;
  14104     }
  14105 
  14106     var children = [buildMathML_buildGroup(group.base, options)];
  14107 
  14108     if (group.sub) {
  14109       children.push(buildMathML_buildGroup(group.sub, options));
  14110     }
  14111 
  14112     if (group.sup) {
  14113       children.push(buildMathML_buildGroup(group.sup, options));
  14114     }
  14115 
  14116     var nodeType;
  14117 
  14118     if (isBrace) {
  14119       nodeType = isOver ? "mover" : "munder";
  14120     } else if (!group.sub) {
  14121       var base = group.base;
  14122 
  14123       if (base && base.type === "op" && base.limits && (options.style === src_Style.DISPLAY || base.alwaysHandleSupSub)) {
  14124         nodeType = "mover";
  14125       } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options.style === src_Style.DISPLAY)) {
  14126         nodeType = "mover";
  14127       } else {
  14128         nodeType = "msup";
  14129       }
  14130     } else if (!group.sup) {
  14131       var _base = group.base;
  14132 
  14133       if (_base && _base.type === "op" && _base.limits && (options.style === src_Style.DISPLAY || _base.alwaysHandleSupSub)) {
  14134         nodeType = "munder";
  14135       } else if (_base && _base.type === "operatorname" && _base.alwaysHandleSupSub && (_base.limits || options.style === src_Style.DISPLAY)) {
  14136         nodeType = "munder";
  14137       } else {
  14138         nodeType = "msub";
  14139       }
  14140     } else {
  14141       var _base2 = group.base;
  14142 
  14143       if (_base2 && _base2.type === "op" && _base2.limits && options.style === src_Style.DISPLAY) {
  14144         nodeType = "munderover";
  14145       } else if (_base2 && _base2.type === "operatorname" && _base2.alwaysHandleSupSub && (options.style === src_Style.DISPLAY || _base2.limits)) {
  14146         nodeType = "munderover";
  14147       } else {
  14148         nodeType = "msubsup";
  14149       }
  14150     }
  14151 
  14152     return new mathMLTree.MathNode(nodeType, children);
  14153   }
  14154 });
  14155 ;// CONCATENATED MODULE: ./src/functions/symbolsOp.js
  14156 
  14157 
  14158 
  14159  // Operator ParseNodes created in Parser.js from symbol Groups in src/symbols.js.
  14160 
  14161 defineFunctionBuilders({
  14162   type: "atom",
  14163   htmlBuilder: function htmlBuilder(group, options) {
  14164     return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]);
  14165   },
  14166   mathmlBuilder: function mathmlBuilder(group, options) {
  14167     var node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]);
  14168 
  14169     if (group.family === "bin") {
  14170       var variant = getVariant(group, options);
  14171 
  14172       if (variant === "bold-italic") {
  14173         node.setAttribute("mathvariant", variant);
  14174       }
  14175     } else if (group.family === "punct") {
  14176       node.setAttribute("separator", "true");
  14177     } else if (group.family === "open" || group.family === "close") {
  14178       // Delims built here should not stretch vertically.
  14179       // See delimsizing.js for stretchy delims.
  14180       node.setAttribute("stretchy", "false");
  14181     }
  14182 
  14183     return node;
  14184   }
  14185 });
  14186 ;// CONCATENATED MODULE: ./src/functions/symbolsOrd.js
  14187 
  14188 
  14189 
  14190 
  14191 // "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in
  14192 // src/symbols.js.
  14193 var defaultVariant = {
  14194   "mi": "italic",
  14195   "mn": "normal",
  14196   "mtext": "normal"
  14197 };
  14198 defineFunctionBuilders({
  14199   type: "mathord",
  14200   htmlBuilder: function htmlBuilder(group, options) {
  14201     return buildCommon.makeOrd(group, options, "mathord");
  14202   },
  14203   mathmlBuilder: function mathmlBuilder(group, options) {
  14204     var node = new mathMLTree.MathNode("mi", [makeText(group.text, group.mode, options)]);
  14205     var variant = getVariant(group, options) || "italic";
  14206 
  14207     if (variant !== defaultVariant[node.type]) {
  14208       node.setAttribute("mathvariant", variant);
  14209     }
  14210 
  14211     return node;
  14212   }
  14213 });
  14214 defineFunctionBuilders({
  14215   type: "textord",
  14216   htmlBuilder: function htmlBuilder(group, options) {
  14217     return buildCommon.makeOrd(group, options, "textord");
  14218   },
  14219   mathmlBuilder: function mathmlBuilder(group, options) {
  14220     var text = makeText(group.text, group.mode, options);
  14221     var variant = getVariant(group, options) || "normal";
  14222     var node;
  14223 
  14224     if (group.mode === 'text') {
  14225       node = new mathMLTree.MathNode("mtext", [text]);
  14226     } else if (/[0-9]/.test(group.text)) {
  14227       node = new mathMLTree.MathNode("mn", [text]);
  14228     } else if (group.text === "\\prime") {
  14229       node = new mathMLTree.MathNode("mo", [text]);
  14230     } else {
  14231       node = new mathMLTree.MathNode("mi", [text]);
  14232     }
  14233 
  14234     if (variant !== defaultVariant[node.type]) {
  14235       node.setAttribute("mathvariant", variant);
  14236     }
  14237 
  14238     return node;
  14239   }
  14240 });
  14241 ;// CONCATENATED MODULE: ./src/functions/symbolsSpacing.js
  14242 
  14243 
  14244 
  14245  // A map of CSS-based spacing functions to their CSS class.
  14246 
  14247 var cssSpace = {
  14248   "\\nobreak": "nobreak",
  14249   "\\allowbreak": "allowbreak"
  14250 }; // A lookup table to determine whether a spacing function/symbol should be
  14251 // treated like a regular space character.  If a symbol or command is a key
  14252 // in this table, then it should be a regular space character.  Furthermore,
  14253 // the associated value may have a `className` specifying an extra CSS class
  14254 // to add to the created `span`.
  14255 
  14256 var regularSpace = {
  14257   " ": {},
  14258   "\\ ": {},
  14259   "~": {
  14260     className: "nobreak"
  14261   },
  14262   "\\space": {},
  14263   "\\nobreakspace": {
  14264     className: "nobreak"
  14265   }
  14266 }; // ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in
  14267 // src/symbols.js.
  14268 
  14269 defineFunctionBuilders({
  14270   type: "spacing",
  14271   htmlBuilder: function htmlBuilder(group, options) {
  14272     if (regularSpace.hasOwnProperty(group.text)) {
  14273       var className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these
  14274       // things has an entry in the symbols table, so these will be turned
  14275       // into appropriate outputs.
  14276 
  14277       if (group.mode === "text") {
  14278         var ord = buildCommon.makeOrd(group, options, "textord");
  14279         ord.classes.push(className);
  14280         return ord;
  14281       } else {
  14282         return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group.text, group.mode, options)], options);
  14283       }
  14284     } else if (cssSpace.hasOwnProperty(group.text)) {
  14285       // Spaces based on just a CSS class.
  14286       return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options);
  14287     } else {
  14288       throw new src_ParseError("Unknown type of space \"" + group.text + "\"");
  14289     }
  14290   },
  14291   mathmlBuilder: function mathmlBuilder(group, options) {
  14292     var node;
  14293 
  14294     if (regularSpace.hasOwnProperty(group.text)) {
  14295       node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\xA0")]);
  14296     } else if (cssSpace.hasOwnProperty(group.text)) {
  14297       // CSS-based MathML spaces (\nobreak, \allowbreak) are ignored
  14298       return new mathMLTree.MathNode("mspace");
  14299     } else {
  14300       throw new src_ParseError("Unknown type of space \"" + group.text + "\"");
  14301     }
  14302 
  14303     return node;
  14304   }
  14305 });
  14306 ;// CONCATENATED MODULE: ./src/functions/tag.js
  14307 
  14308 
  14309 
  14310 
  14311 var pad = function pad() {
  14312   var padNode = new mathMLTree.MathNode("mtd", []);
  14313   padNode.setAttribute("width", "50%");
  14314   return padNode;
  14315 };
  14316 
  14317 defineFunctionBuilders({
  14318   type: "tag",
  14319   mathmlBuilder: function mathmlBuilder(group, options) {
  14320     var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]);
  14321     table.setAttribute("width", "100%");
  14322     return table; // TODO: Left-aligned tags.
  14323     // Currently, the group and options passed here do not contain
  14324     // enough info to set tag alignment. `leqno` is in Settings but it is
  14325     // not passed to Options. On the HTML side, leqno is
  14326     // set by a CSS class applied in buildTree.js. That would have worked
  14327     // in MathML if browsers supported <mlabeledtr>. Since they don't, we
  14328     // need to rewrite the way this function is called.
  14329   }
  14330 });
  14331 ;// CONCATENATED MODULE: ./src/functions/text.js
  14332 
  14333 
  14334 
  14335  // Non-mathy text, possibly in a font
  14336 
  14337 var textFontFamilies = {
  14338   "\\text": undefined,
  14339   "\\textrm": "textrm",
  14340   "\\textsf": "textsf",
  14341   "\\texttt": "texttt",
  14342   "\\textnormal": "textrm"
  14343 };
  14344 var textFontWeights = {
  14345   "\\textbf": "textbf",
  14346   "\\textmd": "textmd"
  14347 };
  14348 var textFontShapes = {
  14349   "\\textit": "textit",
  14350   "\\textup": "textup"
  14351 };
  14352 
  14353 var optionsWithFont = function optionsWithFont(group, options) {
  14354   var font = group.font; // Checks if the argument is a font family or a font style.
  14355 
  14356   if (!font) {
  14357     return options;
  14358   } else if (textFontFamilies[font]) {
  14359     return options.withTextFontFamily(textFontFamilies[font]);
  14360   } else if (textFontWeights[font]) {
  14361     return options.withTextFontWeight(textFontWeights[font]);
  14362   } else {
  14363     return options.withTextFontShape(textFontShapes[font]);
  14364   }
  14365 };
  14366 
  14367 defineFunction({
  14368   type: "text",
  14369   names: [// Font families
  14370   "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights
  14371   "\\textbf", "\\textmd", // Font Shapes
  14372   "\\textit", "\\textup"],
  14373   props: {
  14374     numArgs: 1,
  14375     argTypes: ["text"],
  14376     allowedInArgument: true,
  14377     allowedInText: true
  14378   },
  14379   handler: function handler(_ref, args) {
  14380     var parser = _ref.parser,
  14381         funcName = _ref.funcName;
  14382     var body = args[0];
  14383     return {
  14384       type: "text",
  14385       mode: parser.mode,
  14386       body: ordargument(body),
  14387       font: funcName
  14388     };
  14389   },
  14390   htmlBuilder: function htmlBuilder(group, options) {
  14391     var newOptions = optionsWithFont(group, options);
  14392     var inner = buildExpression(group.body, newOptions, true);
  14393     return buildCommon.makeSpan(["mord", "text"], inner, newOptions);
  14394   },
  14395   mathmlBuilder: function mathmlBuilder(group, options) {
  14396     var newOptions = optionsWithFont(group, options);
  14397     return buildExpressionRow(group.body, newOptions);
  14398   }
  14399 });
  14400 ;// CONCATENATED MODULE: ./src/functions/underline.js
  14401 
  14402 
  14403 
  14404 
  14405 
  14406 defineFunction({
  14407   type: "underline",
  14408   names: ["\\underline"],
  14409   props: {
  14410     numArgs: 1,
  14411     allowedInText: true
  14412   },
  14413   handler: function handler(_ref, args) {
  14414     var parser = _ref.parser;
  14415     return {
  14416       type: "underline",
  14417       mode: parser.mode,
  14418       body: args[0]
  14419     };
  14420   },
  14421   htmlBuilder: function htmlBuilder(group, options) {
  14422     // Underlines are handled in the TeXbook pg 443, Rule 10.
  14423     // Build the inner group.
  14424     var innerGroup = buildGroup(group.body, options); // Create the line to go below the body
  14425 
  14426     var line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns
  14427 
  14428     var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
  14429     var vlist = buildCommon.makeVList({
  14430       positionType: "top",
  14431       positionData: innerGroup.height,
  14432       children: [{
  14433         type: "kern",
  14434         size: defaultRuleThickness
  14435       }, {
  14436         type: "elem",
  14437         elem: line
  14438       }, {
  14439         type: "kern",
  14440         size: 3 * defaultRuleThickness
  14441       }, {
  14442         type: "elem",
  14443         elem: innerGroup
  14444       }]
  14445     }, options);
  14446     return buildCommon.makeSpan(["mord", "underline"], [vlist], options);
  14447   },
  14448   mathmlBuilder: function mathmlBuilder(group, options) {
  14449     var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]);
  14450     operator.setAttribute("stretchy", "true");
  14451     var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.body, options), operator]);
  14452     node.setAttribute("accentunder", "true");
  14453     return node;
  14454   }
  14455 });
  14456 ;// CONCATENATED MODULE: ./src/functions/vcenter.js
  14457 
  14458 
  14459 
  14460 
  14461  // \vcenter:  Vertically center the argument group on the math axis.
  14462 
  14463 defineFunction({
  14464   type: "vcenter",
  14465   names: ["\\vcenter"],
  14466   props: {
  14467     numArgs: 1,
  14468     argTypes: ["original"],
  14469     // In LaTeX, \vcenter can act only on a box.
  14470     allowedInText: false
  14471   },
  14472   handler: function handler(_ref, args) {
  14473     var parser = _ref.parser;
  14474     return {
  14475       type: "vcenter",
  14476       mode: parser.mode,
  14477       body: args[0]
  14478     };
  14479   },
  14480   htmlBuilder: function htmlBuilder(group, options) {
  14481     var body = buildGroup(group.body, options);
  14482     var axisHeight = options.fontMetrics().axisHeight;
  14483     var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight));
  14484     return buildCommon.makeVList({
  14485       positionType: "shift",
  14486       positionData: dy,
  14487       children: [{
  14488         type: "elem",
  14489         elem: body
  14490       }]
  14491     }, options);
  14492   },
  14493   mathmlBuilder: function mathmlBuilder(group, options) {
  14494     // There is no way to do this in MathML.
  14495     // Write a class as a breadcrumb in case some post-processor wants
  14496     // to perform a vcenter adjustment.
  14497     return new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)], ["vcenter"]);
  14498   }
  14499 });
  14500 ;// CONCATENATED MODULE: ./src/functions/verb.js
  14501 
  14502 
  14503 
  14504 
  14505 defineFunction({
  14506   type: "verb",
  14507   names: ["\\verb"],
  14508   props: {
  14509     numArgs: 0,
  14510     allowedInText: true
  14511   },
  14512   handler: function handler(context, args, optArgs) {
  14513     // \verb and \verb* are dealt with directly in Parser.js.
  14514     // If we end up here, it's because of a failure to match the two delimiters
  14515     // in the regex in Lexer.js.  LaTeX raises the following error when \verb is
  14516     // terminated by end of line (or file).
  14517     throw new src_ParseError("\\verb ended by end of line instead of matching delimiter");
  14518   },
  14519   htmlBuilder: function htmlBuilder(group, options) {
  14520     var text = makeVerb(group);
  14521     var body = []; // \verb enters text mode and therefore is sized like \textstyle
  14522 
  14523     var newOptions = options.havingStyle(options.style.text());
  14524 
  14525     for (var i = 0; i < text.length; i++) {
  14526       var c = text[i];
  14527 
  14528       if (c === '~') {
  14529         c = '\\textasciitilde';
  14530       }
  14531 
  14532       body.push(buildCommon.makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"]));
  14533     }
  14534 
  14535     return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions);
  14536   },
  14537   mathmlBuilder: function mathmlBuilder(group, options) {
  14538     var text = new mathMLTree.TextNode(makeVerb(group));
  14539     var node = new mathMLTree.MathNode("mtext", [text]);
  14540     node.setAttribute("mathvariant", "monospace");
  14541     return node;
  14542   }
  14543 });
  14544 /**
  14545  * Converts verb group into body string.
  14546  *
  14547  * \verb* replaces each space with an open box \u2423
  14548  * \verb replaces each space with a no-break space \xA0
  14549  */
  14550 
  14551 var makeVerb = function makeVerb(group) {
  14552   return group.body.replace(/ /g, group.star ? "\u2423" : '\xA0');
  14553 };
  14554 ;// CONCATENATED MODULE: ./src/functions.js
  14555 /** Include this to ensure that all functions are defined. */
  14556 
  14557 var functions = _functions;
  14558 /* harmony default export */ var src_functions = (functions); // TODO(kevinb): have functions return an object and call defineFunction with
  14559 // that object in this file instead of relying on side-effects.
  14560 
  14561 
  14562 
  14563 
  14564 
  14565 
  14566 
  14567 
  14568 
  14569 
  14570 
  14571 
  14572 
  14573 
  14574 
  14575 
  14576 
  14577 
  14578 
  14579 
  14580 
  14581 
  14582 
  14583 
  14584 
  14585 
  14586 
  14587 
  14588 
  14589 
  14590 
  14591 
  14592 
  14593 
  14594 
  14595 
  14596 
  14597 
  14598 
  14599 
  14600 
  14601 
  14602 
  14603 
  14604 
  14605 ;// CONCATENATED MODULE: ./src/SourceLocation.js
  14606 /**
  14607  * Lexing or parsing positional information for error reporting.
  14608  * This object is immutable.
  14609  */
  14610 var SourceLocation = /*#__PURE__*/function () {
  14611   // The + prefix indicates that these fields aren't writeable
  14612   // Lexer holding the input string.
  14613   // Start offset, zero-based inclusive.
  14614   // End offset, zero-based exclusive.
  14615   function SourceLocation(lexer, start, end) {
  14616     this.lexer = void 0;
  14617     this.start = void 0;
  14618     this.end = void 0;
  14619     this.lexer = lexer;
  14620     this.start = start;
  14621     this.end = end;
  14622   }
  14623   /**
  14624    * Merges two `SourceLocation`s from location providers, given they are
  14625    * provided in order of appearance.
  14626    * - Returns the first one's location if only the first is provided.
  14627    * - Returns a merged range of the first and the last if both are provided
  14628    *   and their lexers match.
  14629    * - Otherwise, returns null.
  14630    */
  14631 
  14632 
  14633   SourceLocation.range = function range(first, second) {
  14634     if (!second) {
  14635       return first && first.loc;
  14636     } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) {
  14637       return null;
  14638     } else {
  14639       return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end);
  14640     }
  14641   };
  14642 
  14643   return SourceLocation;
  14644 }();
  14645 
  14646 
  14647 ;// CONCATENATED MODULE: ./src/Token.js
  14648 
  14649 /**
  14650  * Interface required to break circular dependency between Token, Lexer, and
  14651  * ParseError.
  14652  */
  14653 
  14654 /**
  14655  * The resulting token returned from `lex`.
  14656  *
  14657  * It consists of the token text plus some position information.
  14658  * The position information is essentially a range in an input string,
  14659  * but instead of referencing the bare input string, we refer to the lexer.
  14660  * That way it is possible to attach extra metadata to the input string,
  14661  * like for example a file name or similar.
  14662  *
  14663  * The position information is optional, so it is OK to construct synthetic
  14664  * tokens if appropriate. Not providing available position information may
  14665  * lead to degraded error reporting, though.
  14666  */
  14667 var Token = /*#__PURE__*/function () {
  14668   // don't expand the token
  14669   // used in \noexpand
  14670   function Token(text, // the text of this token
  14671   loc) {
  14672     this.text = void 0;
  14673     this.loc = void 0;
  14674     this.noexpand = void 0;
  14675     this.treatAsRelax = void 0;
  14676     this.text = text;
  14677     this.loc = loc;
  14678   }
  14679   /**
  14680    * Given a pair of tokens (this and endToken), compute a `Token` encompassing
  14681    * the whole input range enclosed by these two.
  14682    */
  14683 
  14684 
  14685   var _proto = Token.prototype;
  14686 
  14687   _proto.range = function range(endToken, // last token of the range, inclusive
  14688   text) {
  14689     return new Token(text, SourceLocation.range(this, endToken));
  14690   };
  14691 
  14692   return Token;
  14693 }();
  14694 ;// CONCATENATED MODULE: ./src/Lexer.js
  14695 /**
  14696  * The Lexer class handles tokenizing the input in various ways. Since our
  14697  * parser expects us to be able to backtrack, the lexer allows lexing from any
  14698  * given starting point.
  14699  *
  14700  * Its main exposed function is the `lex` function, which takes a position to
  14701  * lex from and a type of token to lex. It defers to the appropriate `_innerLex`
  14702  * function.
  14703  *
  14704  * The various `_innerLex` functions perform the actual lexing of different
  14705  * kinds.
  14706  */
  14707 
  14708 
  14709 
  14710 
  14711 /* The following tokenRegex
  14712  * - matches typical whitespace (but not NBSP etc.) using its first group
  14713  * - does not match any control character \x00-\x1f except whitespace
  14714  * - does not match a bare backslash
  14715  * - matches any ASCII character except those just mentioned
  14716  * - does not match the BMP private use area \uE000-\uF8FF
  14717  * - does not match bare surrogate code units
  14718  * - matches any BMP character except for those just described
  14719  * - matches any valid Unicode surrogate pair
  14720  * - matches a backslash followed by one or more letters
  14721  * - matches a backslash followed by any BMP character, including newline
  14722  * Just because the Lexer matches something doesn't mean it's valid input:
  14723  * If there is no matching function or symbol definition, the Parser will
  14724  * still reject the input.
  14725  */
  14726 var spaceRegexString = "[ \r\n\t]";
  14727 var controlWordRegexString = "\\\\[a-zA-Z@]+";
  14728 var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]";
  14729 var controlWordWhitespaceRegexString = "" + controlWordRegexString + spaceRegexString + "*";
  14730 var controlWordWhitespaceRegex = new RegExp("^(" + controlWordRegexString + ")" + spaceRegexString + "*$");
  14731 var combiningDiacriticalMarkString = "[\u0300-\u036F]";
  14732 var combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$");
  14733 var tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace
  14734 "([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + ( // single codepoint
  14735 combiningDiacriticalMarkString + "*") + // ...plus accents
  14736 "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + ( // surrogate pair
  14737 combiningDiacriticalMarkString + "*") + // ...plus accents
  14738 "|\\\\verb\\*([^]).*?\\3" + // \verb*
  14739 "|\\\\verb([^*a-zA-Z]).*?\\4" + // \verb unstarred
  14740 "|\\\\operatorname\\*" + ( // \operatorname*
  14741 "|" + controlWordWhitespaceRegexString) + ( // \macroName + spaces
  14742 "|" + controlSymbolRegexString + ")"); // \\, \', etc.
  14743 
  14744 /** Main Lexer class */
  14745 
  14746 var Lexer = /*#__PURE__*/function () {
  14747   // category codes, only supports comment characters (14) for now
  14748   function Lexer(input, settings) {
  14749     this.input = void 0;
  14750     this.settings = void 0;
  14751     this.tokenRegex = void 0;
  14752     this.catcodes = void 0;
  14753     // Separate accents from characters
  14754     this.input = input;
  14755     this.settings = settings;
  14756     this.tokenRegex = new RegExp(tokenRegexString, 'g');
  14757     this.catcodes = {
  14758       "%": 14 // comment character
  14759 
  14760     };
  14761   }
  14762 
  14763   var _proto = Lexer.prototype;
  14764 
  14765   _proto.setCatcode = function setCatcode(char, code) {
  14766     this.catcodes[char] = code;
  14767   }
  14768   /**
  14769    * This function lexes a single token.
  14770    */
  14771   ;
  14772 
  14773   _proto.lex = function lex() {
  14774     var input = this.input;
  14775     var pos = this.tokenRegex.lastIndex;
  14776 
  14777     if (pos === input.length) {
  14778       return new Token("EOF", new SourceLocation(this, pos, pos));
  14779     }
  14780 
  14781     var match = this.tokenRegex.exec(input);
  14782 
  14783     if (match === null || match.index !== pos) {
  14784       throw new src_ParseError("Unexpected character: '" + input[pos] + "'", new Token(input[pos], new SourceLocation(this, pos, pos + 1)));
  14785     }
  14786 
  14787     var text = match[2] || " ";
  14788 
  14789     if (this.catcodes[text] === 14) {
  14790       // comment character
  14791       var nlIndex = input.indexOf('\n', this.tokenRegex.lastIndex);
  14792 
  14793       if (nlIndex === -1) {
  14794         this.tokenRegex.lastIndex = input.length; // EOF
  14795 
  14796         this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would " + "fail because of commenting the end of math mode (e.g. $)");
  14797       } else {
  14798         this.tokenRegex.lastIndex = nlIndex + 1;
  14799       }
  14800 
  14801       return this.lex();
  14802     } // Trim any trailing whitespace from control word match
  14803 
  14804 
  14805     var controlMatch = text.match(controlWordWhitespaceRegex);
  14806 
  14807     if (controlMatch) {
  14808       text = controlMatch[1];
  14809     }
  14810 
  14811     return new Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex));
  14812   };
  14813 
  14814   return Lexer;
  14815 }();
  14816 
  14817 
  14818 ;// CONCATENATED MODULE: ./src/Namespace.js
  14819 /**
  14820  * A `Namespace` refers to a space of nameable things like macros or lengths,
  14821  * which can be `set` either globally or local to a nested group, using an
  14822  * undo stack similar to how TeX implements this functionality.
  14823  * Performance-wise, `get` and local `set` take constant time, while global
  14824  * `set` takes time proportional to the depth of group nesting.
  14825  */
  14826 
  14827 
  14828 var Namespace = /*#__PURE__*/function () {
  14829   /**
  14830    * Both arguments are optional.  The first argument is an object of
  14831    * built-in mappings which never change.  The second argument is an object
  14832    * of initial (global-level) mappings, which will constantly change
  14833    * according to any global/top-level `set`s done.
  14834    */
  14835   function Namespace(builtins, globalMacros) {
  14836     if (builtins === void 0) {
  14837       builtins = {};
  14838     }
  14839 
  14840     if (globalMacros === void 0) {
  14841       globalMacros = {};
  14842     }
  14843 
  14844     this.current = void 0;
  14845     this.builtins = void 0;
  14846     this.undefStack = void 0;
  14847     this.current = globalMacros;
  14848     this.builtins = builtins;
  14849     this.undefStack = [];
  14850   }
  14851   /**
  14852    * Start a new nested group, affecting future local `set`s.
  14853    */
  14854 
  14855 
  14856   var _proto = Namespace.prototype;
  14857 
  14858   _proto.beginGroup = function beginGroup() {
  14859     this.undefStack.push({});
  14860   }
  14861   /**
  14862    * End current nested group, restoring values before the group began.
  14863    */
  14864   ;
  14865 
  14866   _proto.endGroup = function endGroup() {
  14867     if (this.undefStack.length === 0) {
  14868       throw new src_ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug");
  14869     }
  14870 
  14871     var undefs = this.undefStack.pop();
  14872 
  14873     for (var undef in undefs) {
  14874       if (undefs.hasOwnProperty(undef)) {
  14875         if (undefs[undef] === undefined) {
  14876           delete this.current[undef];
  14877         } else {
  14878           this.current[undef] = undefs[undef];
  14879         }
  14880       }
  14881     }
  14882   }
  14883   /**
  14884    * Detect whether `name` has a definition.  Equivalent to
  14885    * `get(name) != null`.
  14886    */
  14887   ;
  14888 
  14889   _proto.has = function has(name) {
  14890     return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name);
  14891   }
  14892   /**
  14893    * Get the current value of a name, or `undefined` if there is no value.
  14894    *
  14895    * Note: Do not use `if (namespace.get(...))` to detect whether a macro
  14896    * is defined, as the definition may be the empty string which evaluates
  14897    * to `false` in JavaScript.  Use `if (namespace.get(...) != null)` or
  14898    * `if (namespace.has(...))`.
  14899    */
  14900   ;
  14901 
  14902   _proto.get = function get(name) {
  14903     if (this.current.hasOwnProperty(name)) {
  14904       return this.current[name];
  14905     } else {
  14906       return this.builtins[name];
  14907     }
  14908   }
  14909   /**
  14910    * Set the current value of a name, and optionally set it globally too.
  14911    * Local set() sets the current value and (when appropriate) adds an undo
  14912    * operation to the undo stack.  Global set() may change the undo
  14913    * operation at every level, so takes time linear in their number.
  14914    */
  14915   ;
  14916 
  14917   _proto.set = function set(name, value, global) {
  14918     if (global === void 0) {
  14919       global = false;
  14920     }
  14921 
  14922     if (global) {
  14923       // Global set is equivalent to setting in all groups.  Simulate this
  14924       // by destroying any undos currently scheduled for this name,
  14925       // and adding an undo with the *new* value (in case it later gets
  14926       // locally reset within this environment).
  14927       for (var i = 0; i < this.undefStack.length; i++) {
  14928         delete this.undefStack[i][name];
  14929       }
  14930 
  14931       if (this.undefStack.length > 0) {
  14932         this.undefStack[this.undefStack.length - 1][name] = value;
  14933       }
  14934     } else {
  14935       // Undo this set at end of this group (possibly to `undefined`),
  14936       // unless an undo is already in place, in which case that older
  14937       // value is the correct one.
  14938       var top = this.undefStack[this.undefStack.length - 1];
  14939 
  14940       if (top && !top.hasOwnProperty(name)) {
  14941         top[name] = this.current[name];
  14942       }
  14943     }
  14944 
  14945     this.current[name] = value;
  14946   };
  14947 
  14948   return Namespace;
  14949 }();
  14950 
  14951 
  14952 ;// CONCATENATED MODULE: ./src/macros.js
  14953 /**
  14954  * Predefined macros for KaTeX.
  14955  * This can be used to define some commands in terms of others.
  14956  */
  14957 
  14958 
  14959 
  14960 
  14961 
  14962 
  14963 var builtinMacros = {};
  14964 /* harmony default export */ var macros = (builtinMacros); // This function might one day accept an additional argument and do more things.
  14965 
  14966 function defineMacro(name, body) {
  14967   builtinMacros[name] = body;
  14968 } //////////////////////////////////////////////////////////////////////
  14969 // macro tools
  14970 
  14971 defineMacro("\\noexpand", function (context) {
  14972   // The expansion is the token itself; but that token is interpreted
  14973   // as if its meaning were ‘\relax’ if it is a control sequence that
  14974   // would ordinarily be expanded by TeX’s expansion rules.
  14975   var t = context.popToken();
  14976 
  14977   if (context.isExpandable(t.text)) {
  14978     t.noexpand = true;
  14979     t.treatAsRelax = true;
  14980   }
  14981 
  14982   return {
  14983     tokens: [t],
  14984     numArgs: 0
  14985   };
  14986 });
  14987 defineMacro("\\expandafter", function (context) {
  14988   // TeX first reads the token that comes immediately after \expandafter,
  14989   // without expanding it; let’s call this token t. Then TeX reads the
  14990   // token that comes after t (and possibly more tokens, if that token
  14991   // has an argument), replacing it by its expansion. Finally TeX puts
  14992   // t back in front of that expansion.
  14993   var t = context.popToken();
  14994   context.expandOnce(true); // expand only an expandable token
  14995 
  14996   return {
  14997     tokens: [t],
  14998     numArgs: 0
  14999   };
  15000 }); // LaTeX's \@firstoftwo{#1}{#2} expands to #1, skipping #2
  15001 // TeX source: \long\def\@firstoftwo#1#2{#1}
  15002 
  15003 defineMacro("\\@firstoftwo", function (context) {
  15004   var args = context.consumeArgs(2);
  15005   return {
  15006     tokens: args[0],
  15007     numArgs: 0
  15008   };
  15009 }); // LaTeX's \@secondoftwo{#1}{#2} expands to #2, skipping #1
  15010 // TeX source: \long\def\@secondoftwo#1#2{#2}
  15011 
  15012 defineMacro("\\@secondoftwo", function (context) {
  15013   var args = context.consumeArgs(2);
  15014   return {
  15015     tokens: args[1],
  15016     numArgs: 0
  15017   };
  15018 }); // LaTeX's \@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded)
  15019 // symbol that isn't a space, consuming any spaces but not consuming the
  15020 // first nonspace character.  If that nonspace character matches #1, then
  15021 // the macro expands to #2; otherwise, it expands to #3.
  15022 
  15023 defineMacro("\\@ifnextchar", function (context) {
  15024   var args = context.consumeArgs(3); // symbol, if, else
  15025 
  15026   context.consumeSpaces();
  15027   var nextToken = context.future();
  15028 
  15029   if (args[0].length === 1 && args[0][0].text === nextToken.text) {
  15030     return {
  15031       tokens: args[1],
  15032       numArgs: 0
  15033     };
  15034   } else {
  15035     return {
  15036       tokens: args[2],
  15037       numArgs: 0
  15038     };
  15039   }
  15040 }); // LaTeX's \@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol.
  15041 // If it is `*`, then it consumes the symbol, and the macro expands to #1;
  15042 // otherwise, the macro expands to #2 (without consuming the symbol).
  15043 // TeX source: \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}}
  15044 
  15045 defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); // LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode
  15046 
  15047 defineMacro("\\TextOrMath", function (context) {
  15048   var args = context.consumeArgs(2);
  15049 
  15050   if (context.mode === 'text') {
  15051     return {
  15052       tokens: args[0],
  15053       numArgs: 0
  15054     };
  15055   } else {
  15056     return {
  15057       tokens: args[1],
  15058       numArgs: 0
  15059     };
  15060   }
  15061 }); // Lookup table for parsing numbers in base 8 through 16
  15062 
  15063 var digitToNumber = {
  15064   "0": 0,
  15065   "1": 1,
  15066   "2": 2,
  15067   "3": 3,
  15068   "4": 4,
  15069   "5": 5,
  15070   "6": 6,
  15071   "7": 7,
  15072   "8": 8,
  15073   "9": 9,
  15074   "a": 10,
  15075   "A": 10,
  15076   "b": 11,
  15077   "B": 11,
  15078   "c": 12,
  15079   "C": 12,
  15080   "d": 13,
  15081   "D": 13,
  15082   "e": 14,
  15083   "E": 14,
  15084   "f": 15,
  15085   "F": 15
  15086 }; // TeX \char makes a literal character (catcode 12) using the following forms:
  15087 // (see The TeXBook, p. 43)
  15088 //   \char123  -- decimal
  15089 //   \char'123 -- octal
  15090 //   \char"123 -- hex
  15091 //   \char`x   -- character that can be written (i.e. isn't active)
  15092 //   \char`\x  -- character that cannot be written (e.g. %)
  15093 // These all refer to characters from the font, so we turn them into special
  15094 // calls to a function \@char dealt with in the Parser.
  15095 
  15096 defineMacro("\\char", function (context) {
  15097   var token = context.popToken();
  15098   var base;
  15099   var number = '';
  15100 
  15101   if (token.text === "'") {
  15102     base = 8;
  15103     token = context.popToken();
  15104   } else if (token.text === '"') {
  15105     base = 16;
  15106     token = context.popToken();
  15107   } else if (token.text === "`") {
  15108     token = context.popToken();
  15109 
  15110     if (token.text[0] === "\\") {
  15111       number = token.text.charCodeAt(1);
  15112     } else if (token.text === "EOF") {
  15113       throw new src_ParseError("\\char` missing argument");
  15114     } else {
  15115       number = token.text.charCodeAt(0);
  15116     }
  15117   } else {
  15118     base = 10;
  15119   }
  15120 
  15121   if (base) {
  15122     // Parse a number in the given base, starting with first `token`.
  15123     number = digitToNumber[token.text];
  15124 
  15125     if (number == null || number >= base) {
  15126       throw new src_ParseError("Invalid base-" + base + " digit " + token.text);
  15127     }
  15128 
  15129     var digit;
  15130 
  15131     while ((digit = digitToNumber[context.future().text]) != null && digit < base) {
  15132       number *= base;
  15133       number += digit;
  15134       context.popToken();
  15135     }
  15136   }
  15137 
  15138   return "\\@char{" + number + "}";
  15139 }); // \newcommand{\macro}[args]{definition}
  15140 // \renewcommand{\macro}[args]{definition}
  15141 // TODO: Optional arguments: \newcommand{\macro}[args][default]{definition}
  15142 
  15143 var newcommand = function newcommand(context, existsOK, nonexistsOK) {
  15144   var arg = context.consumeArg().tokens;
  15145 
  15146   if (arg.length !== 1) {
  15147     throw new src_ParseError("\\newcommand's first argument must be a macro name");
  15148   }
  15149 
  15150   var name = arg[0].text;
  15151   var exists = context.isDefined(name);
  15152 
  15153   if (exists && !existsOK) {
  15154     throw new src_ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand"));
  15155   }
  15156 
  15157   if (!exists && !nonexistsOK) {
  15158     throw new src_ParseError("\\renewcommand{" + name + "} when command " + name + " " + "does not yet exist; use \\newcommand");
  15159   }
  15160 
  15161   var numArgs = 0;
  15162   arg = context.consumeArg().tokens;
  15163 
  15164   if (arg.length === 1 && arg[0].text === "[") {
  15165     var argText = '';
  15166     var token = context.expandNextToken();
  15167 
  15168     while (token.text !== "]" && token.text !== "EOF") {
  15169       // TODO: Should properly expand arg, e.g., ignore {}s
  15170       argText += token.text;
  15171       token = context.expandNextToken();
  15172     }
  15173 
  15174     if (!argText.match(/^\s*[0-9]+\s*$/)) {
  15175       throw new src_ParseError("Invalid number of arguments: " + argText);
  15176     }
  15177 
  15178     numArgs = parseInt(argText);
  15179     arg = context.consumeArg().tokens;
  15180   } // Final arg is the expansion of the macro
  15181 
  15182 
  15183   context.macros.set(name, {
  15184     tokens: arg,
  15185     numArgs: numArgs
  15186   });
  15187   return '';
  15188 };
  15189 
  15190 defineMacro("\\newcommand", function (context) {
  15191   return newcommand(context, false, true);
  15192 });
  15193 defineMacro("\\renewcommand", function (context) {
  15194   return newcommand(context, true, false);
  15195 });
  15196 defineMacro("\\providecommand", function (context) {
  15197   return newcommand(context, true, true);
  15198 }); // terminal (console) tools
  15199 
  15200 defineMacro("\\message", function (context) {
  15201   var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console
  15202 
  15203   console.log(arg.reverse().map(function (token) {
  15204     return token.text;
  15205   }).join(""));
  15206   return '';
  15207 });
  15208 defineMacro("\\errmessage", function (context) {
  15209   var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console
  15210 
  15211   console.error(arg.reverse().map(function (token) {
  15212     return token.text;
  15213   }).join(""));
  15214   return '';
  15215 });
  15216 defineMacro("\\show", function (context) {
  15217   var tok = context.popToken();
  15218   var name = tok.text; // eslint-disable-next-line no-console
  15219 
  15220   console.log(tok, context.macros.get(name), src_functions[name], src_symbols.math[name], src_symbols.text[name]);
  15221   return '';
  15222 }); //////////////////////////////////////////////////////////////////////
  15223 // Grouping
  15224 // \let\bgroup={ \let\egroup=}
  15225 
  15226 defineMacro("\\bgroup", "{");
  15227 defineMacro("\\egroup", "}"); // Symbols from latex.ltx:
  15228 // \def\lq{`}
  15229 // \def\rq{'}
  15230 // \def \aa {\r a}
  15231 // \def \AA {\r A}
  15232 
  15233 defineMacro("\\lq", "`");
  15234 defineMacro("\\rq", "'");
  15235 defineMacro("\\aa", "\\r a");
  15236 defineMacro("\\AA", "\\r A"); // Copyright (C) and registered (R) symbols. Use raw symbol in MathML.
  15237 // \DeclareTextCommandDefault{\textcopyright}{\textcircled{c}}
  15238 // \DeclareTextCommandDefault{\textregistered}{\textcircled{%
  15239 //      \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}
  15240 // \DeclareRobustCommand{\copyright}{%
  15241 //    \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi}
  15242 
  15243 defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}");
  15244 defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
  15245 defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); // Characters omitted from Unicode range 1D400–1D7FF
  15246 
  15247 defineMacro("\u212C", "\\mathscr{B}"); // script
  15248 
  15249 defineMacro("\u2130", "\\mathscr{E}");
  15250 defineMacro("\u2131", "\\mathscr{F}");
  15251 defineMacro("\u210B", "\\mathscr{H}");
  15252 defineMacro("\u2110", "\\mathscr{I}");
  15253 defineMacro("\u2112", "\\mathscr{L}");
  15254 defineMacro("\u2133", "\\mathscr{M}");
  15255 defineMacro("\u211B", "\\mathscr{R}");
  15256 defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur
  15257 
  15258 defineMacro("\u210C", "\\mathfrak{H}");
  15259 defineMacro("\u2128", "\\mathfrak{Z}"); // Define \Bbbk with a macro that works in both HTML and MathML.
  15260 
  15261 defineMacro("\\Bbbk", "\\Bbb{k}"); // Unicode middle dot
  15262 // The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays
  15263 // the dot at U+22C5 and gives it punct spacing.
  15264 
  15265 defineMacro("\xB7", "\\cdotp"); // \llap and \rlap render their contents in text mode
  15266 
  15267 defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
  15268 defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
  15269 defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \mathstrut from the TeXbook, p 360
  15270 
  15271 defineMacro("\\mathstrut", "\\vphantom{(}"); // \underbar from TeXbook p 353
  15272 
  15273 defineMacro("\\underbar", "\\underline{\\text{#1}}"); // \not is defined by base/fontmath.ltx via
  15274 // \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36}
  15275 // It's thus treated like a \mathrel, but defined by a symbol that has zero
  15276 // width but extends to the right.  We use \rlap to get that spacing.
  15277 // For MathML we write U+0338 here. buildMathML.js will then do the overlay.
  15278 
  15279 defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); // Negated symbols from base/fontmath.ltx:
  15280 // \def\neq{\not=} \let\ne=\neq
  15281 // \DeclareRobustCommand
  15282 //   \notin{\mathrel{\m@th\mathpalette\c@ncel\in}}
  15283 // \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}}
  15284 
  15285 defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");
  15286 defineMacro("\\ne", "\\neq");
  15287 defineMacro("\u2260", "\\neq");
  15288 defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}" + "{\\mathrel{\\char`∉}}");
  15289 defineMacro("\u2209", "\\notin"); // Unicode stacked relations
  15290 
  15291 defineMacro("\u2258", "\\html@mathml{" + "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}" + "}{\\mathrel{\\char`\u2258}}");
  15292 defineMacro("\u2259", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");
  15293 defineMacro("\u225A", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");
  15294 defineMacro("\u225B", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}" + "{\\mathrel{\\char`\u225B}}");
  15295 defineMacro("\u225D", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}" + "{\\mathrel{\\char`\u225D}}");
  15296 defineMacro("\u225E", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}" + "{\\mathrel{\\char`\u225E}}");
  15297 defineMacro("\u225F", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}"); // Misc Unicode
  15298 
  15299 defineMacro("\u27C2", "\\perp");
  15300 defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}");
  15301 defineMacro("\u220C", "\\notni");
  15302 defineMacro("\u231C", "\\ulcorner");
  15303 defineMacro("\u231D", "\\urcorner");
  15304 defineMacro("\u231E", "\\llcorner");
  15305 defineMacro("\u231F", "\\lrcorner");
  15306 defineMacro("\xA9", "\\copyright");
  15307 defineMacro("\xAE", "\\textregistered");
  15308 defineMacro("\uFE0F", "\\textregistered"); // The KaTeX fonts have corners at codepoints that don't match Unicode.
  15309 // For MathML purposes, use the Unicode code point.
  15310 
  15311 defineMacro("\\ulcorner", "\\html@mathml{\\@ulcorner}{\\mathop{\\char\"231c}}");
  15312 defineMacro("\\urcorner", "\\html@mathml{\\@urcorner}{\\mathop{\\char\"231d}}");
  15313 defineMacro("\\llcorner", "\\html@mathml{\\@llcorner}{\\mathop{\\char\"231e}}");
  15314 defineMacro("\\lrcorner", "\\html@mathml{\\@lrcorner}{\\mathop{\\char\"231f}}"); //////////////////////////////////////////////////////////////////////
  15315 // LaTeX_2ε
  15316 // \vdots{\vbox{\baselineskip4\p@  \lineskiplimit\z@
  15317 // \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
  15318 // We'll call \varvdots, which gets a glyph from symbols.js.
  15319 // The zero-width rule gets us an equivalent to the vertical 6pt kern.
  15320 
  15321 defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}");
  15322 defineMacro("\u22EE", "\\vdots"); //////////////////////////////////////////////////////////////////////
  15323 // amsmath.sty
  15324 // http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf
  15325 // Italic Greek capital letters.  AMS defines these with \DeclareMathSymbol,
  15326 // but they are equivalent to \mathit{\Letter}.
  15327 
  15328 defineMacro("\\varGamma", "\\mathit{\\Gamma}");
  15329 defineMacro("\\varDelta", "\\mathit{\\Delta}");
  15330 defineMacro("\\varTheta", "\\mathit{\\Theta}");
  15331 defineMacro("\\varLambda", "\\mathit{\\Lambda}");
  15332 defineMacro("\\varXi", "\\mathit{\\Xi}");
  15333 defineMacro("\\varPi", "\\mathit{\\Pi}");
  15334 defineMacro("\\varSigma", "\\mathit{\\Sigma}");
  15335 defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}");
  15336 defineMacro("\\varPhi", "\\mathit{\\Phi}");
  15337 defineMacro("\\varPsi", "\\mathit{\\Psi}");
  15338 defineMacro("\\varOmega", "\\mathit{\\Omega}"); //\newcommand{\substack}[1]{\subarray{c}#1\endsubarray}
  15339 
  15340 defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); // \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript
  15341 // \mkern-\thinmuskip{:}\mskip6muplus1mu\relax}
  15342 
  15343 defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" + "\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu"); // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}}
  15344 
  15345 defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); // \def\iff{\DOTSB\;\Longleftrightarrow\;}
  15346 // \def\implies{\DOTSB\;\Longrightarrow\;}
  15347 // \def\impliedby{\DOTSB\;\Longleftarrow\;}
  15348 
  15349 defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
  15350 defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
  15351 defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // AMSMath's automatic \dots, based on \mdots@@ macro.
  15352 
  15353 var dotsByToken = {
  15354   ',': '\\dotsc',
  15355   '\\not': '\\dotsb',
  15356   // \keybin@ checks for the following:
  15357   '+': '\\dotsb',
  15358   '=': '\\dotsb',
  15359   '<': '\\dotsb',
  15360   '>': '\\dotsb',
  15361   '-': '\\dotsb',
  15362   '*': '\\dotsb',
  15363   ':': '\\dotsb',
  15364   // Symbols whose definition starts with \DOTSB:
  15365   '\\DOTSB': '\\dotsb',
  15366   '\\coprod': '\\dotsb',
  15367   '\\bigvee': '\\dotsb',
  15368   '\\bigwedge': '\\dotsb',
  15369   '\\biguplus': '\\dotsb',
  15370   '\\bigcap': '\\dotsb',
  15371   '\\bigcup': '\\dotsb',
  15372   '\\prod': '\\dotsb',
  15373   '\\sum': '\\dotsb',
  15374   '\\bigotimes': '\\dotsb',
  15375   '\\bigoplus': '\\dotsb',
  15376   '\\bigodot': '\\dotsb',
  15377   '\\bigsqcup': '\\dotsb',
  15378   '\\And': '\\dotsb',
  15379   '\\longrightarrow': '\\dotsb',
  15380   '\\Longrightarrow': '\\dotsb',
  15381   '\\longleftarrow': '\\dotsb',
  15382   '\\Longleftarrow': '\\dotsb',
  15383   '\\longleftrightarrow': '\\dotsb',
  15384   '\\Longleftrightarrow': '\\dotsb',
  15385   '\\mapsto': '\\dotsb',
  15386   '\\longmapsto': '\\dotsb',
  15387   '\\hookrightarrow': '\\dotsb',
  15388   '\\doteq': '\\dotsb',
  15389   // Symbols whose definition starts with \mathbin:
  15390   '\\mathbin': '\\dotsb',
  15391   // Symbols whose definition starts with \mathrel:
  15392   '\\mathrel': '\\dotsb',
  15393   '\\relbar': '\\dotsb',
  15394   '\\Relbar': '\\dotsb',
  15395   '\\xrightarrow': '\\dotsb',
  15396   '\\xleftarrow': '\\dotsb',
  15397   // Symbols whose definition starts with \DOTSI:
  15398   '\\DOTSI': '\\dotsi',
  15399   '\\int': '\\dotsi',
  15400   '\\oint': '\\dotsi',
  15401   '\\iint': '\\dotsi',
  15402   '\\iiint': '\\dotsi',
  15403   '\\iiiint': '\\dotsi',
  15404   '\\idotsint': '\\dotsi',
  15405   // Symbols whose definition starts with \DOTSX:
  15406   '\\DOTSX': '\\dotsx'
  15407 };
  15408 defineMacro("\\dots", function (context) {
  15409   // TODO: If used in text mode, should expand to \textellipsis.
  15410   // However, in KaTeX, \textellipsis and \ldots behave the same
  15411   // (in text mode), and it's unlikely we'd see any of the math commands
  15412   // that affect the behavior of \dots when in text mode.  So fine for now
  15413   // (until we support \ifmmode ... \else ... \fi).
  15414   var thedots = '\\dotso';
  15415   var next = context.expandAfterFuture().text;
  15416 
  15417   if (next in dotsByToken) {
  15418     thedots = dotsByToken[next];
  15419   } else if (next.substr(0, 4) === '\\not') {
  15420     thedots = '\\dotsb';
  15421   } else if (next in src_symbols.math) {
  15422     if (utils.contains(['bin', 'rel'], src_symbols.math[next].group)) {
  15423       thedots = '\\dotsb';
  15424     }
  15425   }
  15426 
  15427   return thedots;
  15428 });
  15429 var spaceAfterDots = {
  15430   // \rightdelim@ checks for the following:
  15431   ')': true,
  15432   ']': true,
  15433   '\\rbrack': true,
  15434   '\\}': true,
  15435   '\\rbrace': true,
  15436   '\\rangle': true,
  15437   '\\rceil': true,
  15438   '\\rfloor': true,
  15439   '\\rgroup': true,
  15440   '\\rmoustache': true,
  15441   '\\right': true,
  15442   '\\bigr': true,
  15443   '\\biggr': true,
  15444   '\\Bigr': true,
  15445   '\\Biggr': true,
  15446   // \extra@ also tests for the following:
  15447   '$': true,
  15448   // \extrap@ checks for the following:
  15449   ';': true,
  15450   '.': true,
  15451   ',': true
  15452 };
  15453 defineMacro("\\dotso", function (context) {
  15454   var next = context.future().text;
  15455 
  15456   if (next in spaceAfterDots) {
  15457     return "\\ldots\\,";
  15458   } else {
  15459     return "\\ldots";
  15460   }
  15461 });
  15462 defineMacro("\\dotsc", function (context) {
  15463   var next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for
  15464   // ';' and '.', but doesn't check for ','.
  15465 
  15466   if (next in spaceAfterDots && next !== ',') {
  15467     return "\\ldots\\,";
  15468   } else {
  15469     return "\\ldots";
  15470   }
  15471 });
  15472 defineMacro("\\cdots", function (context) {
  15473   var next = context.future().text;
  15474 
  15475   if (next in spaceAfterDots) {
  15476     return "\\@cdots\\,";
  15477   } else {
  15478     return "\\@cdots";
  15479   }
  15480 });
  15481 defineMacro("\\dotsb", "\\cdots");
  15482 defineMacro("\\dotsm", "\\cdots");
  15483 defineMacro("\\dotsi", "\\!\\cdots"); // amsmath doesn't actually define \dotsx, but \dots followed by a macro
  15484 // starting with \DOTSX implies \dotso, and then \extra@ detects this case
  15485 // and forces the added `\,`.
  15486 
  15487 defineMacro("\\dotsx", "\\ldots\\,"); // \let\DOTSI\relax
  15488 // \let\DOTSB\relax
  15489 // \let\DOTSX\relax
  15490 
  15491 defineMacro("\\DOTSI", "\\relax");
  15492 defineMacro("\\DOTSB", "\\relax");
  15493 defineMacro("\\DOTSX", "\\relax"); // Spacing, based on amsmath.sty's override of LaTeX defaults
  15494 // \DeclareRobustCommand{\tmspace}[3]{%
  15495 //   \ifmmode\mskip#1#2\else\kern#1#3\fi\relax}
  15496 
  15497 defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); // \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}
  15498 // TODO: math mode should use \thinmuskip
  15499 
  15500 defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); // \let\thinspace\,
  15501 
  15502 defineMacro("\\thinspace", "\\,"); // \def\>{\mskip\medmuskip}
  15503 // \renewcommand{\:}{\tmspace+\medmuskip{.2222em}}
  15504 // TODO: \> and math mode of \: should use \medmuskip = 4mu plus 2mu minus 4mu
  15505 
  15506 defineMacro("\\>", "\\mskip{4mu}");
  15507 defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); // \let\medspace\:
  15508 
  15509 defineMacro("\\medspace", "\\:"); // \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}}
  15510 // TODO: math mode should use \thickmuskip = 5mu plus 5mu
  15511 
  15512 defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); // \let\thickspace\;
  15513 
  15514 defineMacro("\\thickspace", "\\;"); // \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}}
  15515 // TODO: math mode should use \thinmuskip
  15516 
  15517 defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); // \let\negthinspace\!
  15518 
  15519 defineMacro("\\negthinspace", "\\!"); // \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}}
  15520 // TODO: math mode should use \medmuskip
  15521 
  15522 defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); // \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}}
  15523 // TODO: math mode should use \thickmuskip
  15524 
  15525 defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); // \def\enspace{\kern.5em }
  15526 
  15527 defineMacro("\\enspace", "\\kern.5em "); // \def\enskip{\hskip.5em\relax}
  15528 
  15529 defineMacro("\\enskip", "\\hskip.5em\\relax"); // \def\quad{\hskip1em\relax}
  15530 
  15531 defineMacro("\\quad", "\\hskip1em\\relax"); // \def\qquad{\hskip2em\relax}
  15532 
  15533 defineMacro("\\qquad", "\\hskip2em\\relax"); // \tag@in@display form of \tag
  15534 
  15535 defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren");
  15536 defineMacro("\\tag@paren", "\\tag@literal{({#1})}");
  15537 defineMacro("\\tag@literal", function (context) {
  15538   if (context.macros.get("\\df@tag")) {
  15539     throw new src_ParseError("Multiple \\tag");
  15540   }
  15541 
  15542   return "\\gdef\\df@tag{\\text{#1}}";
  15543 }); // \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin
  15544 //   {\operator@font mod}\penalty900
  15545 //   \mkern5mu\nonscript\mskip-\medmuskip}
  15546 // \newcommand{\pod}[1]{\allowbreak
  15547 //   \if@display\mkern18mu\else\mkern8mu\fi(#1)}
  15548 // \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}}
  15549 // \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu
  15550 //   \else\mkern12mu\fi{\operator@font mod}\,\,#1}
  15551 // TODO: math mode should use \medmuskip = 4mu plus 2mu minus 4mu
  15552 
  15553 defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + "\\mathbin{\\rm mod}" + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");
  15554 defineMacro("\\pod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");
  15555 defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}");
  15556 defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\rm mod}\\,\\,#1"); // \pmb    --   A simulation of bold.
  15557 // The version in ambsy.sty works by typesetting three copies of the argument
  15558 // with small offsets. We use two copies. We omit the vertical offset because
  15559 // of rendering problems that makeVList encounters in Safari.
  15560 
  15561 defineMacro("\\pmb", "\\html@mathml{" + "\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}" + "{\\mathbf{#1}}"); //////////////////////////////////////////////////////////////////////
  15562 // LaTeX source2e
  15563 // \expandafter\let\expandafter\@normalcr
  15564 //     \csname\expandafter\@gobble\string\\ \endcsname
  15565 // \DeclareRobustCommand\newline{\@normalcr\relax}
  15566 
  15567 defineMacro("\\newline", "\\\\\\relax"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@}
  15568 // TODO: Doesn't normally work in math mode because \@ fails.  KaTeX doesn't
  15569 // support \@ yet, so that's omitted, and we add \text so that the result
  15570 // doesn't look funny in math mode.
  15571 
  15572 defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX" + "}{TeX}}"); // \DeclareRobustCommand{\LaTeX}{L\kern-.36em%
  15573 //         {\sbox\z@ T%
  15574 //          \vbox to\ht\z@{\hbox{\check@mathfonts
  15575 //                               \fontsize\sf@size\z@
  15576 //                               \math@fontsfalse\selectfont
  15577 //                               A}%
  15578 //                         \vss}%
  15579 //         }%
  15580 //         \kern-.15em%
  15581 //         \TeX}
  15582 // This code aligns the top of the A with the T (from the perspective of TeX's
  15583 // boxes, though visually the A appears to extend above slightly).
  15584 // We compute the corresponding \raisebox when A is rendered in \normalsize
  15585 // \scriptstyle, which has a scale factor of 0.7 (see Options.js).
  15586 
  15587 var latexRaiseA = fontMetricsData["Main-Regular"]["T".charCodeAt(0)][1] - 0.7 * fontMetricsData["Main-Regular"]["A".charCodeAt(0)][1] + "em";
  15588 defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo
  15589 
  15590 defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace}
  15591 // \def\@hspace#1{\hskip  #1\relax}
  15592 // \def\@hspacer#1{\vrule \@width\z@\nobreak
  15593 //                 \hskip #1\hskip \z@skip}
  15594 
  15595 defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace");
  15596 defineMacro("\\@hspace", "\\hskip #1\\relax");
  15597 defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); //////////////////////////////////////////////////////////////////////
  15598 // mathtools.sty
  15599 //\providecommand\ordinarycolon{:}
  15600 
  15601 defineMacro("\\ordinarycolon", ":"); //\def\vcentcolon{\mathrel{\mathop\ordinarycolon}}
  15602 //TODO(edemaine): Not yet centered. Fix via \raisebox or #726
  15603 
  15604 defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon}
  15605 
  15606 defineMacro("\\dblcolon", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" + "{\\mathop{\\char\"2237}}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
  15607 
  15608 defineMacro("\\coloneqq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2254}}"); // ≔
  15609 // \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=}
  15610 
  15611 defineMacro("\\Coloneqq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2237\\char\"3d}}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
  15612 
  15613 defineMacro("\\coloneq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"3a\\char\"2212}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
  15614 
  15615 defineMacro("\\Coloneq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"2237\\char\"2212}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
  15616 
  15617 defineMacro("\\eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2255}}"); // ≕
  15618 // \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
  15619 
  15620 defineMacro("\\Eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"3d\\char\"2237}}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
  15621 
  15622 defineMacro("\\eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2239}}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
  15623 
  15624 defineMacro("\\Eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"2212\\char\"2237}}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
  15625 
  15626 defineMacro("\\colonapprox", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"3a\\char\"2248}}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
  15627 
  15628 defineMacro("\\Colonapprox", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"2237\\char\"2248}}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
  15629 
  15630 defineMacro("\\colonsim", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"3a\\char\"223c}}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}
  15631 
  15632 defineMacro("\\Colonsim", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"2237\\char\"223c}}"); // Some Unicode characters are implemented with macros to mathtools functions.
  15633 
  15634 defineMacro("\u2237", "\\dblcolon"); // ::
  15635 
  15636 defineMacro("\u2239", "\\eqcolon"); // -:
  15637 
  15638 defineMacro("\u2254", "\\coloneqq"); // :=
  15639 
  15640 defineMacro("\u2255", "\\eqqcolon"); // =:
  15641 
  15642 defineMacro("\u2A74", "\\Coloneqq"); // ::=
  15643 //////////////////////////////////////////////////////////////////////
  15644 // colonequals.sty
  15645 // Alternate names for mathtools's macros:
  15646 
  15647 defineMacro("\\ratio", "\\vcentcolon");
  15648 defineMacro("\\coloncolon", "\\dblcolon");
  15649 defineMacro("\\colonequals", "\\coloneqq");
  15650 defineMacro("\\coloncolonequals", "\\Coloneqq");
  15651 defineMacro("\\equalscolon", "\\eqqcolon");
  15652 defineMacro("\\equalscoloncolon", "\\Eqqcolon");
  15653 defineMacro("\\colonminus", "\\coloneq");
  15654 defineMacro("\\coloncolonminus", "\\Coloneq");
  15655 defineMacro("\\minuscolon", "\\eqcolon");
  15656 defineMacro("\\minuscoloncolon", "\\Eqcolon"); // \colonapprox name is same in mathtools and colonequals.
  15657 
  15658 defineMacro("\\coloncolonapprox", "\\Colonapprox"); // \colonsim name is same in mathtools and colonequals.
  15659 
  15660 defineMacro("\\coloncolonsim", "\\Colonsim"); // Additional macros, implemented by analogy with mathtools definitions:
  15661 
  15662 defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
  15663 defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");
  15664 defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
  15665 defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // Present in newtxmath, pxfonts and txfonts
  15666 
  15667 defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");
  15668 defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}");
  15669 defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); //////////////////////////////////////////////////////////////////////
  15670 // From amsopn.sty
  15671 
  15672 defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}");
  15673 defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}");
  15674 defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}");
  15675 defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}");
  15676 defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}");
  15677 defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}"); //////////////////////////////////////////////////////////////////////
  15678 // MathML alternates for KaTeX glyphs in the Unicode private area
  15679 
  15680 defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}");
  15681 defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}");
  15682 defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}");
  15683 defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}");
  15684 defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}");
  15685 defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}");
  15686 defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
  15687 defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
  15688 defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}");
  15689 defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}");
  15690 defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
  15691 defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
  15692 defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
  15693 defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}");
  15694 defineMacro("\\imath", "\\html@mathml{\\@imath}{\u0131}");
  15695 defineMacro("\\jmath", "\\html@mathml{\\@jmath}{\u0237}"); //////////////////////////////////////////////////////////////////////
  15696 // stmaryrd and semantic
  15697 // The stmaryrd and semantic packages render the next four items by calling a
  15698 // glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros.
  15699 
  15700 defineMacro("\\llbracket", "\\html@mathml{" + "\\mathopen{[\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u27E6}}");
  15701 defineMacro("\\rrbracket", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu]}}" + "{\\mathclose{\\char`\u27E7}}");
  15702 defineMacro("\u27E6", "\\llbracket"); // blackboard bold [
  15703 
  15704 defineMacro("\u27E7", "\\rrbracket"); // blackboard bold ]
  15705 
  15706 defineMacro("\\lBrace", "\\html@mathml{" + "\\mathopen{\\{\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u2983}}");
  15707 defineMacro("\\rBrace", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu\\}}}" + "{\\mathclose{\\char`\u2984}}");
  15708 defineMacro("\u2983", "\\lBrace"); // blackboard bold {
  15709 
  15710 defineMacro("\u2984", "\\rBrace"); // blackboard bold }
  15711 // TODO: Create variable sized versions of the last two items. I believe that
  15712 // will require new font glyphs.
  15713 // The stmaryrd function `\minuso` provides a "Plimsoll" symbol that
  15714 // superimposes the characters \circ and \mathminus. Used in chemistry.
  15715 
  15716 defineMacro("\\minuso", "\\mathbin{\\html@mathml{" + "{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}" + "{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}" + "{\\char`⦵}}");
  15717 defineMacro("⦵", "\\minuso"); //////////////////////////////////////////////////////////////////////
  15718 // texvc.sty
  15719 // The texvc package contains macros available in mediawiki pages.
  15720 // We omit the functions deprecated at
  15721 // https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax
  15722 // We also omit texvc's \O, which conflicts with \text{\O}
  15723 
  15724 defineMacro("\\darr", "\\downarrow");
  15725 defineMacro("\\dArr", "\\Downarrow");
  15726 defineMacro("\\Darr", "\\Downarrow");
  15727 defineMacro("\\lang", "\\langle");
  15728 defineMacro("\\rang", "\\rangle");
  15729 defineMacro("\\uarr", "\\uparrow");
  15730 defineMacro("\\uArr", "\\Uparrow");
  15731 defineMacro("\\Uarr", "\\Uparrow");
  15732 defineMacro("\\N", "\\mathbb{N}");
  15733 defineMacro("\\R", "\\mathbb{R}");
  15734 defineMacro("\\Z", "\\mathbb{Z}");
  15735 defineMacro("\\alef", "\\aleph");
  15736 defineMacro("\\alefsym", "\\aleph");
  15737 defineMacro("\\Alpha", "\\mathrm{A}");
  15738 defineMacro("\\Beta", "\\mathrm{B}");
  15739 defineMacro("\\bull", "\\bullet");
  15740 defineMacro("\\Chi", "\\mathrm{X}");
  15741 defineMacro("\\clubs", "\\clubsuit");
  15742 defineMacro("\\cnums", "\\mathbb{C}");
  15743 defineMacro("\\Complex", "\\mathbb{C}");
  15744 defineMacro("\\Dagger", "\\ddagger");
  15745 defineMacro("\\diamonds", "\\diamondsuit");
  15746 defineMacro("\\empty", "\\emptyset");
  15747 defineMacro("\\Epsilon", "\\mathrm{E}");
  15748 defineMacro("\\Eta", "\\mathrm{H}");
  15749 defineMacro("\\exist", "\\exists");
  15750 defineMacro("\\harr", "\\leftrightarrow");
  15751 defineMacro("\\hArr", "\\Leftrightarrow");
  15752 defineMacro("\\Harr", "\\Leftrightarrow");
  15753 defineMacro("\\hearts", "\\heartsuit");
  15754 defineMacro("\\image", "\\Im");
  15755 defineMacro("\\infin", "\\infty");
  15756 defineMacro("\\Iota", "\\mathrm{I}");
  15757 defineMacro("\\isin", "\\in");
  15758 defineMacro("\\Kappa", "\\mathrm{K}");
  15759 defineMacro("\\larr", "\\leftarrow");
  15760 defineMacro("\\lArr", "\\Leftarrow");
  15761 defineMacro("\\Larr", "\\Leftarrow");
  15762 defineMacro("\\lrarr", "\\leftrightarrow");
  15763 defineMacro("\\lrArr", "\\Leftrightarrow");
  15764 defineMacro("\\Lrarr", "\\Leftrightarrow");
  15765 defineMacro("\\Mu", "\\mathrm{M}");
  15766 defineMacro("\\natnums", "\\mathbb{N}");
  15767 defineMacro("\\Nu", "\\mathrm{N}");
  15768 defineMacro("\\Omicron", "\\mathrm{O}");
  15769 defineMacro("\\plusmn", "\\pm");
  15770 defineMacro("\\rarr", "\\rightarrow");
  15771 defineMacro("\\rArr", "\\Rightarrow");
  15772 defineMacro("\\Rarr", "\\Rightarrow");
  15773 defineMacro("\\real", "\\Re");
  15774 defineMacro("\\reals", "\\mathbb{R}");
  15775 defineMacro("\\Reals", "\\mathbb{R}");
  15776 defineMacro("\\Rho", "\\mathrm{P}");
  15777 defineMacro("\\sdot", "\\cdot");
  15778 defineMacro("\\sect", "\\S");
  15779 defineMacro("\\spades", "\\spadesuit");
  15780 defineMacro("\\sub", "\\subset");
  15781 defineMacro("\\sube", "\\subseteq");
  15782 defineMacro("\\supe", "\\supseteq");
  15783 defineMacro("\\Tau", "\\mathrm{T}");
  15784 defineMacro("\\thetasym", "\\vartheta"); // TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}");
  15785 
  15786 defineMacro("\\weierp", "\\wp");
  15787 defineMacro("\\Zeta", "\\mathrm{Z}"); //////////////////////////////////////////////////////////////////////
  15788 // statmath.sty
  15789 // https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf
  15790 
  15791 defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
  15792 defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
  15793 defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); //////////////////////////////////////////////////////////////////////
  15794 // braket.sty
  15795 // http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/braket/braket.pdf
  15796 
  15797 defineMacro("\\bra", "\\mathinner{\\langle{#1}|}");
  15798 defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}");
  15799 defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}");
  15800 defineMacro("\\Bra", "\\left\\langle#1\\right|");
  15801 defineMacro("\\Ket", "\\left|#1\\right\\rangle"); //////////////////////////////////////////////////////////////////////
  15802 // actuarialangle.dtx
  15803 
  15804 defineMacro("\\angln", "{\\angl n}"); // Custom Khan Academy colors, should be moved to an optional package
  15805 
  15806 defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
  15807 defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
  15808 defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
  15809 defineMacro("\\red", "\\textcolor{##df0030}{#1}");
  15810 defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
  15811 defineMacro("\\gray", "\\textcolor{gray}{#1}");
  15812 defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
  15813 defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
  15814 defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
  15815 defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
  15816 defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
  15817 defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
  15818 defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
  15819 defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
  15820 defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
  15821 defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
  15822 defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
  15823 defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
  15824 defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
  15825 defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
  15826 defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
  15827 defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
  15828 defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
  15829 defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
  15830 defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
  15831 defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
  15832 defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
  15833 defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
  15834 defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
  15835 defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
  15836 defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
  15837 defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
  15838 defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
  15839 defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
  15840 defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
  15841 defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
  15842 defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
  15843 defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
  15844 defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
  15845 defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
  15846 defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
  15847 defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
  15848 defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
  15849 defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
  15850 defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
  15851 defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
  15852 defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
  15853 defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
  15854 defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
  15855 defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
  15856 defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
  15857 defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
  15858 defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
  15859 defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
  15860 defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
  15861 defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
  15862 ;// CONCATENATED MODULE: ./src/MacroExpander.js
  15863 /**
  15864  * This file contains the “gullet” where macros are expanded
  15865  * until only non-macro tokens remain.
  15866  */
  15867 
  15868 
  15869 
  15870 
  15871 
  15872 
  15873 
  15874 // List of commands that act like macros but aren't defined as a macro,
  15875 // function, or symbol.  Used in `isDefined`.
  15876 var implicitCommands = {
  15877   "\\relax": true,
  15878   // MacroExpander.js
  15879   "^": true,
  15880   // Parser.js
  15881   "_": true,
  15882   // Parser.js
  15883   "\\limits": true,
  15884   // Parser.js
  15885   "\\nolimits": true // Parser.js
  15886 
  15887 };
  15888 
  15889 var MacroExpander = /*#__PURE__*/function () {
  15890   function MacroExpander(input, settings, mode) {
  15891     this.settings = void 0;
  15892     this.expansionCount = void 0;
  15893     this.lexer = void 0;
  15894     this.macros = void 0;
  15895     this.stack = void 0;
  15896     this.mode = void 0;
  15897     this.settings = settings;
  15898     this.expansionCount = 0;
  15899     this.feed(input); // Make new global namespace
  15900 
  15901     this.macros = new Namespace(macros, settings.macros);
  15902     this.mode = mode;
  15903     this.stack = []; // contains tokens in REVERSE order
  15904   }
  15905   /**
  15906    * Feed a new input string to the same MacroExpander
  15907    * (with existing macros etc.).
  15908    */
  15909 
  15910 
  15911   var _proto = MacroExpander.prototype;
  15912 
  15913   _proto.feed = function feed(input) {
  15914     this.lexer = new Lexer(input, this.settings);
  15915   }
  15916   /**
  15917    * Switches between "text" and "math" modes.
  15918    */
  15919   ;
  15920 
  15921   _proto.switchMode = function switchMode(newMode) {
  15922     this.mode = newMode;
  15923   }
  15924   /**
  15925    * Start a new group nesting within all namespaces.
  15926    */
  15927   ;
  15928 
  15929   _proto.beginGroup = function beginGroup() {
  15930     this.macros.beginGroup();
  15931   }
  15932   /**
  15933    * End current group nesting within all namespaces.
  15934    */
  15935   ;
  15936 
  15937   _proto.endGroup = function endGroup() {
  15938     this.macros.endGroup();
  15939   }
  15940   /**
  15941    * Returns the topmost token on the stack, without expanding it.
  15942    * Similar in behavior to TeX's `\futurelet`.
  15943    */
  15944   ;
  15945 
  15946   _proto.future = function future() {
  15947     if (this.stack.length === 0) {
  15948       this.pushToken(this.lexer.lex());
  15949     }
  15950 
  15951     return this.stack[this.stack.length - 1];
  15952   }
  15953   /**
  15954    * Remove and return the next unexpanded token.
  15955    */
  15956   ;
  15957 
  15958   _proto.popToken = function popToken() {
  15959     this.future(); // ensure non-empty stack
  15960 
  15961     return this.stack.pop();
  15962   }
  15963   /**
  15964    * Add a given token to the token stack.  In particular, this get be used
  15965    * to put back a token returned from one of the other methods.
  15966    */
  15967   ;
  15968 
  15969   _proto.pushToken = function pushToken(token) {
  15970     this.stack.push(token);
  15971   }
  15972   /**
  15973    * Append an array of tokens to the token stack.
  15974    */
  15975   ;
  15976 
  15977   _proto.pushTokens = function pushTokens(tokens) {
  15978     var _this$stack;
  15979 
  15980     (_this$stack = this.stack).push.apply(_this$stack, tokens);
  15981   }
  15982   /**
  15983    * Find an macro argument without expanding tokens and append the array of
  15984    * tokens to the token stack. Uses Token as a container for the result.
  15985    */
  15986   ;
  15987 
  15988   _proto.scanArgument = function scanArgument(isOptional) {
  15989     var start;
  15990     var end;
  15991     var tokens;
  15992 
  15993     if (isOptional) {
  15994       this.consumeSpaces(); // \@ifnextchar gobbles any space following it
  15995 
  15996       if (this.future().text !== "[") {
  15997         return null;
  15998       }
  15999 
  16000       start = this.popToken(); // don't include [ in tokens
  16001 
  16002       var _this$consumeArg = this.consumeArg(["]"]);
  16003 
  16004       tokens = _this$consumeArg.tokens;
  16005       end = _this$consumeArg.end;
  16006     } else {
  16007       var _this$consumeArg2 = this.consumeArg();
  16008 
  16009       tokens = _this$consumeArg2.tokens;
  16010       start = _this$consumeArg2.start;
  16011       end = _this$consumeArg2.end;
  16012     } // indicate the end of an argument
  16013 
  16014 
  16015     this.pushToken(new Token("EOF", end.loc));
  16016     this.pushTokens(tokens);
  16017     return start.range(end, "");
  16018   }
  16019   /**
  16020    * Consume all following space tokens, without expansion.
  16021    */
  16022   ;
  16023 
  16024   _proto.consumeSpaces = function consumeSpaces() {
  16025     for (;;) {
  16026       var token = this.future();
  16027 
  16028       if (token.text === " ") {
  16029         this.stack.pop();
  16030       } else {
  16031         break;
  16032       }
  16033     }
  16034   }
  16035   /**
  16036    * Consume an argument from the token stream, and return the resulting array
  16037    * of tokens and start/end token.
  16038    */
  16039   ;
  16040 
  16041   _proto.consumeArg = function consumeArg(delims) {
  16042     // The argument for a delimited parameter is the shortest (possibly
  16043     // empty) sequence of tokens with properly nested {...} groups that is
  16044     // followed ... by this particular list of non-parameter tokens.
  16045     // The argument for an undelimited parameter is the next nonblank
  16046     // token, unless that token is ‘{’, when the argument will be the
  16047     // entire {...} group that follows.
  16048     var tokens = [];
  16049     var isDelimited = delims && delims.length > 0;
  16050 
  16051     if (!isDelimited) {
  16052       // Ignore spaces between arguments.  As the TeXbook says:
  16053       // "After you have said ‘\def\row#1#2{...}’, you are allowed to
  16054       //  put spaces between the arguments (e.g., ‘\row x n’), because
  16055       //  TeX doesn’t use single spaces as undelimited arguments."
  16056       this.consumeSpaces();
  16057     }
  16058 
  16059     var start = this.future();
  16060     var tok;
  16061     var depth = 0;
  16062     var match = 0;
  16063 
  16064     do {
  16065       tok = this.popToken();
  16066       tokens.push(tok);
  16067 
  16068       if (tok.text === "{") {
  16069         ++depth;
  16070       } else if (tok.text === "}") {
  16071         --depth;
  16072 
  16073         if (depth === -1) {
  16074           throw new src_ParseError("Extra }", tok);
  16075         }
  16076       } else if (tok.text === "EOF") {
  16077         throw new src_ParseError("Unexpected end of input in a macro argument" + ", expected '" + (delims && isDelimited ? delims[match] : "}") + "'", tok);
  16078       }
  16079 
  16080       if (delims && isDelimited) {
  16081         if ((depth === 0 || depth === 1 && delims[match] === "{") && tok.text === delims[match]) {
  16082           ++match;
  16083 
  16084           if (match === delims.length) {
  16085             // don't include delims in tokens
  16086             tokens.splice(-match, match);
  16087             break;
  16088           }
  16089         } else {
  16090           match = 0;
  16091         }
  16092       }
  16093     } while (depth !== 0 || isDelimited); // If the argument found ... has the form ‘{<nested tokens>}’,
  16094     // ... the outermost braces enclosing the argument are removed
  16095 
  16096 
  16097     if (start.text === "{" && tokens[tokens.length - 1].text === "}") {
  16098       tokens.pop();
  16099       tokens.shift();
  16100     }
  16101 
  16102     tokens.reverse(); // to fit in with stack order
  16103 
  16104     return {
  16105       tokens: tokens,
  16106       start: start,
  16107       end: tok
  16108     };
  16109   }
  16110   /**
  16111    * Consume the specified number of (delimited) arguments from the token
  16112    * stream and return the resulting array of arguments.
  16113    */
  16114   ;
  16115 
  16116   _proto.consumeArgs = function consumeArgs(numArgs, delimiters) {
  16117     if (delimiters) {
  16118       if (delimiters.length !== numArgs + 1) {
  16119         throw new src_ParseError("The length of delimiters doesn't match the number of args!");
  16120       }
  16121 
  16122       var delims = delimiters[0];
  16123 
  16124       for (var i = 0; i < delims.length; i++) {
  16125         var tok = this.popToken();
  16126 
  16127         if (delims[i] !== tok.text) {
  16128           throw new src_ParseError("Use of the macro doesn't match its definition", tok);
  16129         }
  16130       }
  16131     }
  16132 
  16133     var args = [];
  16134 
  16135     for (var _i = 0; _i < numArgs; _i++) {
  16136       args.push(this.consumeArg(delimiters && delimiters[_i + 1]).tokens);
  16137     }
  16138 
  16139     return args;
  16140   }
  16141   /**
  16142    * Expand the next token only once if possible.
  16143    *
  16144    * If the token is expanded, the resulting tokens will be pushed onto
  16145    * the stack in reverse order and will be returned as an array,
  16146    * also in reverse order.
  16147    *
  16148    * If not, the next token will be returned without removing it
  16149    * from the stack.  This case can be detected by a `Token` return value
  16150    * instead of an `Array` return value.
  16151    *
  16152    * In either case, the next token will be on the top of the stack,
  16153    * or the stack will be empty.
  16154    *
  16155    * Used to implement `expandAfterFuture` and `expandNextToken`.
  16156    *
  16157    * If expandableOnly, only expandable tokens are expanded and
  16158    * an undefined control sequence results in an error.
  16159    */
  16160   ;
  16161 
  16162   _proto.expandOnce = function expandOnce(expandableOnly) {
  16163     var topToken = this.popToken();
  16164     var name = topToken.text;
  16165     var expansion = !topToken.noexpand ? this._getExpansion(name) : null;
  16166 
  16167     if (expansion == null || expandableOnly && expansion.unexpandable) {
  16168       if (expandableOnly && expansion == null && name[0] === "\\" && !this.isDefined(name)) {
  16169         throw new src_ParseError("Undefined control sequence: " + name);
  16170       }
  16171 
  16172       this.pushToken(topToken);
  16173       return topToken;
  16174     }
  16175 
  16176     this.expansionCount++;
  16177 
  16178     if (this.expansionCount > this.settings.maxExpand) {
  16179       throw new src_ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting");
  16180     }
  16181 
  16182     var tokens = expansion.tokens;
  16183     var args = this.consumeArgs(expansion.numArgs, expansion.delimiters);
  16184 
  16185     if (expansion.numArgs) {
  16186       // paste arguments in place of the placeholders
  16187       tokens = tokens.slice(); // make a shallow copy
  16188 
  16189       for (var i = tokens.length - 1; i >= 0; --i) {
  16190         var tok = tokens[i];
  16191 
  16192         if (tok.text === "#") {
  16193           if (i === 0) {
  16194             throw new src_ParseError("Incomplete placeholder at end of macro body", tok);
  16195           }
  16196 
  16197           tok = tokens[--i]; // next token on stack
  16198 
  16199           if (tok.text === "#") {
  16200             // ## → #
  16201             tokens.splice(i + 1, 1); // drop first #
  16202           } else if (/^[1-9]$/.test(tok.text)) {
  16203             var _tokens;
  16204 
  16205             // replace the placeholder with the indicated argument
  16206             (_tokens = tokens).splice.apply(_tokens, [i, 2].concat(args[+tok.text - 1]));
  16207           } else {
  16208             throw new src_ParseError("Not a valid argument number", tok);
  16209           }
  16210         }
  16211       }
  16212     } // Concatenate expansion onto top of stack.
  16213 
  16214 
  16215     this.pushTokens(tokens);
  16216     return tokens;
  16217   }
  16218   /**
  16219    * Expand the next token only once (if possible), and return the resulting
  16220    * top token on the stack (without removing anything from the stack).
  16221    * Similar in behavior to TeX's `\expandafter\futurelet`.
  16222    * Equivalent to expandOnce() followed by future().
  16223    */
  16224   ;
  16225 
  16226   _proto.expandAfterFuture = function expandAfterFuture() {
  16227     this.expandOnce();
  16228     return this.future();
  16229   }
  16230   /**
  16231    * Recursively expand first token, then return first non-expandable token.
  16232    */
  16233   ;
  16234 
  16235   _proto.expandNextToken = function expandNextToken() {
  16236     for (;;) {
  16237       var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded.
  16238 
  16239       if (expanded instanceof Token) {
  16240         // \relax stops the expansion, but shouldn't get returned (a
  16241         // null return value couldn't get implemented as a function).
  16242         // the token after \noexpand is interpreted as if its meaning
  16243         // were ‘\relax’
  16244         if (expanded.text === "\\relax" || expanded.treatAsRelax) {
  16245           this.stack.pop();
  16246         } else {
  16247           return this.stack.pop(); // === expanded
  16248         }
  16249       }
  16250     } // Flow unable to figure out that this pathway is impossible.
  16251     // https://github.com/facebook/flow/issues/4808
  16252 
  16253 
  16254     throw new Error(); // eslint-disable-line no-unreachable
  16255   }
  16256   /**
  16257    * Fully expand the given macro name and return the resulting list of
  16258    * tokens, or return `undefined` if no such macro is defined.
  16259    */
  16260   ;
  16261 
  16262   _proto.expandMacro = function expandMacro(name) {
  16263     return this.macros.has(name) ? this.expandTokens([new Token(name)]) : undefined;
  16264   }
  16265   /**
  16266    * Fully expand the given token stream and return the resulting list of tokens
  16267    */
  16268   ;
  16269 
  16270   _proto.expandTokens = function expandTokens(tokens) {
  16271     var output = [];
  16272     var oldStackLength = this.stack.length;
  16273     this.pushTokens(tokens);
  16274 
  16275     while (this.stack.length > oldStackLength) {
  16276       var expanded = this.expandOnce(true); // expand only expandable tokens
  16277       // expandOnce returns Token if and only if it's fully expanded.
  16278 
  16279       if (expanded instanceof Token) {
  16280         if (expanded.treatAsRelax) {
  16281           // the expansion of \noexpand is the token itself
  16282           expanded.noexpand = false;
  16283           expanded.treatAsRelax = false;
  16284         }
  16285 
  16286         output.push(this.stack.pop());
  16287       }
  16288     }
  16289 
  16290     return output;
  16291   }
  16292   /**
  16293    * Fully expand the given macro name and return the result as a string,
  16294    * or return `undefined` if no such macro is defined.
  16295    */
  16296   ;
  16297 
  16298   _proto.expandMacroAsText = function expandMacroAsText(name) {
  16299     var tokens = this.expandMacro(name);
  16300 
  16301     if (tokens) {
  16302       return tokens.map(function (token) {
  16303         return token.text;
  16304       }).join("");
  16305     } else {
  16306       return tokens;
  16307     }
  16308   }
  16309   /**
  16310    * Returns the expanded macro as a reversed array of tokens and a macro
  16311    * argument count.  Or returns `null` if no such macro.
  16312    */
  16313   ;
  16314 
  16315   _proto._getExpansion = function _getExpansion(name) {
  16316     var definition = this.macros.get(name);
  16317 
  16318     if (definition == null) {
  16319       // mainly checking for undefined here
  16320       return definition;
  16321     }
  16322 
  16323     var expansion = typeof definition === "function" ? definition(this) : definition;
  16324 
  16325     if (typeof expansion === "string") {
  16326       var numArgs = 0;
  16327 
  16328       if (expansion.indexOf("#") !== -1) {
  16329         var stripped = expansion.replace(/##/g, "");
  16330 
  16331         while (stripped.indexOf("#" + (numArgs + 1)) !== -1) {
  16332           ++numArgs;
  16333         }
  16334       }
  16335 
  16336       var bodyLexer = new Lexer(expansion, this.settings);
  16337       var tokens = [];
  16338       var tok = bodyLexer.lex();
  16339 
  16340       while (tok.text !== "EOF") {
  16341         tokens.push(tok);
  16342         tok = bodyLexer.lex();
  16343       }
  16344 
  16345       tokens.reverse(); // to fit in with stack using push and pop
  16346 
  16347       var expanded = {
  16348         tokens: tokens,
  16349         numArgs: numArgs
  16350       };
  16351       return expanded;
  16352     }
  16353 
  16354     return expansion;
  16355   }
  16356   /**
  16357    * Determine whether a command is currently "defined" (has some
  16358    * functionality), meaning that it's a macro (in the current group),
  16359    * a function, a symbol, or one of the special commands listed in
  16360    * `implicitCommands`.
  16361    */
  16362   ;
  16363 
  16364   _proto.isDefined = function isDefined(name) {
  16365     return this.macros.has(name) || src_functions.hasOwnProperty(name) || src_symbols.math.hasOwnProperty(name) || src_symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);
  16366   }
  16367   /**
  16368    * Determine whether a command is expandable.
  16369    */
  16370   ;
  16371 
  16372   _proto.isExpandable = function isExpandable(name) {
  16373     var macro = this.macros.get(name);
  16374     return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable : src_functions.hasOwnProperty(name) && !src_functions[name].primitive;
  16375   };
  16376 
  16377   return MacroExpander;
  16378 }();
  16379 
  16380 
  16381 ;// CONCATENATED MODULE: ./src/Parser.js
  16382 /* eslint no-constant-condition:0 */
  16383 
  16384 
  16385 
  16386 
  16387 
  16388 
  16389 
  16390 
  16391 
  16392  // Pre-evaluate both modules as unicodeSymbols require String.normalize()
  16393 
  16394 var unicodeAccents = {
  16395   "́": {
  16396     "text": "\\'",
  16397     "math": "\\acute"
  16398   },
  16399   "̀": {
  16400     "text": "\\`",
  16401     "math": "\\grave"
  16402   },
  16403   "̈": {
  16404     "text": "\\\"",
  16405     "math": "\\ddot"
  16406   },
  16407   "̃": {
  16408     "text": "\\~",
  16409     "math": "\\tilde"
  16410   },
  16411   "̄": {
  16412     "text": "\\=",
  16413     "math": "\\bar"
  16414   },
  16415   "̆": {
  16416     "text": "\\u",
  16417     "math": "\\breve"
  16418   },
  16419   "̌": {
  16420     "text": "\\v",
  16421     "math": "\\check"
  16422   },
  16423   "̂": {
  16424     "text": "\\^",
  16425     "math": "\\hat"
  16426   },
  16427   "̇": {
  16428     "text": "\\.",
  16429     "math": "\\dot"
  16430   },
  16431   "̊": {
  16432     "text": "\\r",
  16433     "math": "\\mathring"
  16434   },
  16435   "̋": {
  16436     "text": "\\H"
  16437   }
  16438 };
  16439 var unicodeSymbols = {
  16440   "á": "á",
  16441   "à": "à",
  16442   "ä": "ä",
  16443   "ǟ": "ǟ",
  16444   "ã": "ã",
  16445   "ā": "ā",
  16446   "ă": "ă",
  16447   "ắ": "ắ",
  16448   "ằ": "ằ",
  16449   "ẵ": "ẵ",
  16450   "ǎ": "ǎ",
  16451   "â": "â",
  16452   "ấ": "ấ",
  16453   "ầ": "ầ",
  16454   "ẫ": "ẫ",
  16455   "ȧ": "ȧ",
  16456   "ǡ": "ǡ",
  16457   "å": "å",
  16458   "ǻ": "ǻ",
  16459   "ḃ": "ḃ",
  16460   "ć": "ć",
  16461   "č": "č",
  16462   "ĉ": "ĉ",
  16463   "ċ": "ċ",
  16464   "ď": "ď",
  16465   "ḋ": "ḋ",
  16466   "é": "é",
  16467   "è": "è",
  16468   "ë": "ë",
  16469   "ẽ": "ẽ",
  16470   "ē": "ē",
  16471   "ḗ": "ḗ",
  16472   "ḕ": "ḕ",
  16473   "ĕ": "ĕ",
  16474   "ě": "ě",
  16475   "ê": "ê",
  16476   "ế": "ế",
  16477   "ề": "ề",
  16478   "ễ": "ễ",
  16479   "ė": "ė",
  16480   "ḟ": "ḟ",
  16481   "ǵ": "ǵ",
  16482   "ḡ": "ḡ",
  16483   "ğ": "ğ",
  16484   "ǧ": "ǧ",
  16485   "ĝ": "ĝ",
  16486   "ġ": "ġ",
  16487   "ḧ": "ḧ",
  16488   "ȟ": "ȟ",
  16489   "ĥ": "ĥ",
  16490   "ḣ": "ḣ",
  16491   "í": "í",
  16492   "ì": "ì",
  16493   "ï": "ï",
  16494   "ḯ": "ḯ",
  16495   "ĩ": "ĩ",
  16496   "ī": "ī",
  16497   "ĭ": "ĭ",
  16498   "ǐ": "ǐ",
  16499   "î": "î",
  16500   "ǰ": "ǰ",
  16501   "ĵ": "ĵ",
  16502   "ḱ": "ḱ",
  16503   "ǩ": "ǩ",
  16504   "ĺ": "ĺ",
  16505   "ľ": "ľ",
  16506   "ḿ": "ḿ",
  16507   "ṁ": "ṁ",
  16508   "ń": "ń",
  16509   "ǹ": "ǹ",
  16510   "ñ": "ñ",
  16511   "ň": "ň",
  16512   "ṅ": "ṅ",
  16513   "ó": "ó",
  16514   "ò": "ò",
  16515   "ö": "ö",
  16516   "ȫ": "ȫ",
  16517   "õ": "õ",
  16518   "ṍ": "ṍ",
  16519   "ṏ": "ṏ",
  16520   "ȭ": "ȭ",
  16521   "ō": "ō",
  16522   "ṓ": "ṓ",
  16523   "ṑ": "ṑ",
  16524   "ŏ": "ŏ",
  16525   "ǒ": "ǒ",
  16526   "ô": "ô",
  16527   "ố": "ố",
  16528   "ồ": "ồ",
  16529   "ỗ": "ỗ",
  16530   "ȯ": "ȯ",
  16531   "ȱ": "ȱ",
  16532   "ő": "ő",
  16533   "ṕ": "ṕ",
  16534   "ṗ": "ṗ",
  16535   "ŕ": "ŕ",
  16536   "ř": "ř",
  16537   "ṙ": "ṙ",
  16538   "ś": "ś",
  16539   "ṥ": "ṥ",
  16540   "š": "š",
  16541   "ṧ": "ṧ",
  16542   "ŝ": "ŝ",
  16543   "ṡ": "ṡ",
  16544   "ẗ": "ẗ",
  16545   "ť": "ť",
  16546   "ṫ": "ṫ",
  16547   "ú": "ú",
  16548   "ù": "ù",
  16549   "ü": "ü",
  16550   "ǘ": "ǘ",
  16551   "ǜ": "ǜ",
  16552   "ǖ": "ǖ",
  16553   "ǚ": "ǚ",
  16554   "ũ": "ũ",
  16555   "ṹ": "ṹ",
  16556   "ū": "ū",
  16557   "ṻ": "ṻ",
  16558   "ŭ": "ŭ",
  16559   "ǔ": "ǔ",
  16560   "û": "û",
  16561   "ů": "ů",
  16562   "ű": "ű",
  16563   "ṽ": "ṽ",
  16564   "ẃ": "ẃ",
  16565   "ẁ": "ẁ",
  16566   "ẅ": "ẅ",
  16567   "ŵ": "ŵ",
  16568   "ẇ": "ẇ",
  16569   "ẘ": "ẘ",
  16570   "ẍ": "ẍ",
  16571   "ẋ": "ẋ",
  16572   "ý": "ý",
  16573   "ỳ": "ỳ",
  16574   "ÿ": "ÿ",
  16575   "ỹ": "ỹ",
  16576   "ȳ": "ȳ",
  16577   "ŷ": "ŷ",
  16578   "ẏ": "ẏ",
  16579   "ẙ": "ẙ",
  16580   "ź": "ź",
  16581   "ž": "ž",
  16582   "ẑ": "ẑ",
  16583   "ż": "ż",
  16584   "Á": "Á",
  16585   "À": "À",
  16586   "Ä": "Ä",
  16587   "Ǟ": "Ǟ",
  16588   "Ã": "Ã",
  16589   "Ā": "Ā",
  16590   "Ă": "Ă",
  16591   "Ắ": "Ắ",
  16592   "Ằ": "Ằ",
  16593   "Ẵ": "Ẵ",
  16594   "Ǎ": "Ǎ",
  16595   "Â": "Â",
  16596   "Ấ": "Ấ",
  16597   "Ầ": "Ầ",
  16598   "Ẫ": "Ẫ",
  16599   "Ȧ": "Ȧ",
  16600   "Ǡ": "Ǡ",
  16601   "Å": "Å",
  16602   "Ǻ": "Ǻ",
  16603   "Ḃ": "Ḃ",
  16604   "Ć": "Ć",
  16605   "Č": "Č",
  16606   "Ĉ": "Ĉ",
  16607   "Ċ": "Ċ",
  16608   "Ď": "Ď",
  16609   "Ḋ": "Ḋ",
  16610   "É": "É",
  16611   "È": "È",
  16612   "Ë": "Ë",
  16613   "Ẽ": "Ẽ",
  16614   "Ē": "Ē",
  16615   "Ḗ": "Ḗ",
  16616   "Ḕ": "Ḕ",
  16617   "Ĕ": "Ĕ",
  16618   "Ě": "Ě",
  16619   "Ê": "Ê",
  16620   "Ế": "Ế",
  16621   "Ề": "Ề",
  16622   "Ễ": "Ễ",
  16623   "Ė": "Ė",
  16624   "Ḟ": "Ḟ",
  16625   "Ǵ": "Ǵ",
  16626   "Ḡ": "Ḡ",
  16627   "Ğ": "Ğ",
  16628   "Ǧ": "Ǧ",
  16629   "Ĝ": "Ĝ",
  16630   "Ġ": "Ġ",
  16631   "Ḧ": "Ḧ",
  16632   "Ȟ": "Ȟ",
  16633   "Ĥ": "Ĥ",
  16634   "Ḣ": "Ḣ",
  16635   "Í": "Í",
  16636   "Ì": "Ì",
  16637   "Ï": "Ï",
  16638   "Ḯ": "Ḯ",
  16639   "Ĩ": "Ĩ",
  16640   "Ī": "Ī",
  16641   "Ĭ": "Ĭ",
  16642   "Ǐ": "Ǐ",
  16643   "Î": "Î",
  16644   "İ": "İ",
  16645   "Ĵ": "Ĵ",
  16646   "Ḱ": "Ḱ",
  16647   "Ǩ": "Ǩ",
  16648   "Ĺ": "Ĺ",
  16649   "Ľ": "Ľ",
  16650   "Ḿ": "Ḿ",
  16651   "Ṁ": "Ṁ",
  16652   "Ń": "Ń",
  16653   "Ǹ": "Ǹ",
  16654   "Ñ": "Ñ",
  16655   "Ň": "Ň",
  16656   "Ṅ": "Ṅ",
  16657   "Ó": "Ó",
  16658   "Ò": "Ò",
  16659   "Ö": "Ö",
  16660   "Ȫ": "Ȫ",
  16661   "Õ": "Õ",
  16662   "Ṍ": "Ṍ",
  16663   "Ṏ": "Ṏ",
  16664   "Ȭ": "Ȭ",
  16665   "Ō": "Ō",
  16666   "Ṓ": "Ṓ",
  16667   "Ṑ": "Ṑ",
  16668   "Ŏ": "Ŏ",
  16669   "Ǒ": "Ǒ",
  16670   "Ô": "Ô",
  16671   "Ố": "Ố",
  16672   "Ồ": "Ồ",
  16673   "Ỗ": "Ỗ",
  16674   "Ȯ": "Ȯ",
  16675   "Ȱ": "Ȱ",
  16676   "Ő": "Ő",
  16677   "Ṕ": "Ṕ",
  16678   "Ṗ": "Ṗ",
  16679   "Ŕ": "Ŕ",
  16680   "Ř": "Ř",
  16681   "Ṙ": "Ṙ",
  16682   "Ś": "Ś",
  16683   "Ṥ": "Ṥ",
  16684   "Š": "Š",
  16685   "Ṧ": "Ṧ",
  16686   "Ŝ": "Ŝ",
  16687   "Ṡ": "Ṡ",
  16688   "Ť": "Ť",
  16689   "Ṫ": "Ṫ",
  16690   "Ú": "Ú",
  16691   "Ù": "Ù",
  16692   "Ü": "Ü",
  16693   "Ǘ": "Ǘ",
  16694   "Ǜ": "Ǜ",
  16695   "Ǖ": "Ǖ",
  16696   "Ǚ": "Ǚ",
  16697   "Ũ": "Ũ",
  16698   "Ṹ": "Ṹ",
  16699   "Ū": "Ū",
  16700   "Ṻ": "Ṻ",
  16701   "Ŭ": "Ŭ",
  16702   "Ǔ": "Ǔ",
  16703   "Û": "Û",
  16704   "Ů": "Ů",
  16705   "Ű": "Ű",
  16706   "Ṽ": "Ṽ",
  16707   "Ẃ": "Ẃ",
  16708   "Ẁ": "Ẁ",
  16709   "Ẅ": "Ẅ",
  16710   "Ŵ": "Ŵ",
  16711   "Ẇ": "Ẇ",
  16712   "Ẍ": "Ẍ",
  16713   "Ẋ": "Ẋ",
  16714   "Ý": "Ý",
  16715   "Ỳ": "Ỳ",
  16716   "Ÿ": "Ÿ",
  16717   "Ỹ": "Ỹ",
  16718   "Ȳ": "Ȳ",
  16719   "Ŷ": "Ŷ",
  16720   "Ẏ": "Ẏ",
  16721   "Ź": "Ź",
  16722   "Ž": "Ž",
  16723   "Ẑ": "Ẑ",
  16724   "Ż": "Ż",
  16725   "ά": "ά",
  16726   "ὰ": "ὰ",
  16727   "ᾱ": "ᾱ",
  16728   "ᾰ": "ᾰ",
  16729   "έ": "έ",
  16730   "ὲ": "ὲ",
  16731   "ή": "ή",
  16732   "ὴ": "ὴ",
  16733   "ί": "ί",
  16734   "ὶ": "ὶ",
  16735   "ϊ": "ϊ",
  16736   "ΐ": "ΐ",
  16737   "ῒ": "ῒ",
  16738   "ῑ": "ῑ",
  16739   "ῐ": "ῐ",
  16740   "ό": "ό",
  16741   "ὸ": "ὸ",
  16742   "ύ": "ύ",
  16743   "ὺ": "ὺ",
  16744   "ϋ": "ϋ",
  16745   "ΰ": "ΰ",
  16746   "ῢ": "ῢ",
  16747   "ῡ": "ῡ",
  16748   "ῠ": "ῠ",
  16749   "ώ": "ώ",
  16750   "ὼ": "ὼ",
  16751   "Ύ": "Ύ",
  16752   "Ὺ": "Ὺ",
  16753   "Ϋ": "Ϋ",
  16754   "Ῡ": "Ῡ",
  16755   "Ῠ": "Ῠ",
  16756   "Ώ": "Ώ",
  16757   "Ὼ": "Ὼ"
  16758 };
  16759 
  16760 /**
  16761  * This file contains the parser used to parse out a TeX expression from the
  16762  * input. Since TeX isn't context-free, standard parsers don't work particularly
  16763  * well.
  16764  *
  16765  * The strategy of this parser is as such:
  16766  *
  16767  * The main functions (the `.parse...` ones) take a position in the current
  16768  * parse string to parse tokens from. The lexer (found in Lexer.js, stored at
  16769  * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When
  16770  * individual tokens are needed at a position, the lexer is called to pull out a
  16771  * token, which is then used.
  16772  *
  16773  * The parser has a property called "mode" indicating the mode that
  16774  * the parser is currently in. Currently it has to be one of "math" or
  16775  * "text", which denotes whether the current environment is a math-y
  16776  * one or a text-y one (e.g. inside \text). Currently, this serves to
  16777  * limit the functions which can be used in text mode.
  16778  *
  16779  * The main functions then return an object which contains the useful data that
  16780  * was parsed at its given point, and a new position at the end of the parsed
  16781  * data. The main functions can call each other and continue the parsing by
  16782  * using the returned position as a new starting point.
  16783  *
  16784  * There are also extra `.handle...` functions, which pull out some reused
  16785  * functionality into self-contained functions.
  16786  *
  16787  * The functions return ParseNodes.
  16788  */
  16789 var Parser = /*#__PURE__*/function () {
  16790   function Parser(input, settings) {
  16791     this.mode = void 0;
  16792     this.gullet = void 0;
  16793     this.settings = void 0;
  16794     this.leftrightDepth = void 0;
  16795     this.nextToken = void 0;
  16796     // Start in math mode
  16797     this.mode = "math"; // Create a new macro expander (gullet) and (indirectly via that) also a
  16798     // new lexer (mouth) for this parser (stomach, in the language of TeX)
  16799 
  16800     this.gullet = new MacroExpander(input, settings, this.mode); // Store the settings for use in parsing
  16801 
  16802     this.settings = settings; // Count leftright depth (for \middle errors)
  16803 
  16804     this.leftrightDepth = 0;
  16805   }
  16806   /**
  16807    * Checks a result to make sure it has the right type, and throws an
  16808    * appropriate error otherwise.
  16809    */
  16810 
  16811 
  16812   var _proto = Parser.prototype;
  16813 
  16814   _proto.expect = function expect(text, consume) {
  16815     if (consume === void 0) {
  16816       consume = true;
  16817     }
  16818 
  16819     if (this.fetch().text !== text) {
  16820       throw new src_ParseError("Expected '" + text + "', got '" + this.fetch().text + "'", this.fetch());
  16821     }
  16822 
  16823     if (consume) {
  16824       this.consume();
  16825     }
  16826   }
  16827   /**
  16828    * Discards the current lookahead token, considering it consumed.
  16829    */
  16830   ;
  16831 
  16832   _proto.consume = function consume() {
  16833     this.nextToken = null;
  16834   }
  16835   /**
  16836    * Return the current lookahead token, or if there isn't one (at the
  16837    * beginning, or if the previous lookahead token was consume()d),
  16838    * fetch the next token as the new lookahead token and return it.
  16839    */
  16840   ;
  16841 
  16842   _proto.fetch = function fetch() {
  16843     if (this.nextToken == null) {
  16844       this.nextToken = this.gullet.expandNextToken();
  16845     }
  16846 
  16847     return this.nextToken;
  16848   }
  16849   /**
  16850    * Switches between "text" and "math" modes.
  16851    */
  16852   ;
  16853 
  16854   _proto.switchMode = function switchMode(newMode) {
  16855     this.mode = newMode;
  16856     this.gullet.switchMode(newMode);
  16857   }
  16858   /**
  16859    * Main parsing function, which parses an entire input.
  16860    */
  16861   ;
  16862 
  16863   _proto.parse = function parse() {
  16864     if (!this.settings.globalGroup) {
  16865       // Create a group namespace for the math expression.
  16866       // (LaTeX creates a new group for every $...$, $$...$$, \[...\].)
  16867       this.gullet.beginGroup();
  16868     } // Use old \color behavior (same as LaTeX's \textcolor) if requested.
  16869     // We do this within the group for the math expression, so it doesn't
  16870     // pollute settings.macros.
  16871 
  16872 
  16873     if (this.settings.colorIsTextColor) {
  16874       this.gullet.macros.set("\\color", "\\textcolor");
  16875     } // Try to parse the input
  16876 
  16877 
  16878     var parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end
  16879 
  16880     this.expect("EOF"); // End the group namespace for the expression
  16881 
  16882     if (!this.settings.globalGroup) {
  16883       this.gullet.endGroup();
  16884     }
  16885 
  16886     return parse;
  16887   };
  16888 
  16889   /**
  16890    * Parses an "expression", which is a list of atoms.
  16891    *
  16892    * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
  16893    *                 happens when functions have higher precendence han infix
  16894    *                 nodes in implicit parses.
  16895    *
  16896    * `breakOnTokenText`: The text of the token that the expression should end
  16897    *                     with, or `null` if something else should end the
  16898    *                     expression.
  16899    */
  16900   _proto.parseExpression = function parseExpression(breakOnInfix, breakOnTokenText) {
  16901     var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either
  16902     // we reached the end, a }, or a \right)
  16903 
  16904     while (true) {
  16905       // Ignore spaces in math mode
  16906       if (this.mode === "math") {
  16907         this.consumeSpaces();
  16908       }
  16909 
  16910       var lex = this.fetch();
  16911 
  16912       if (Parser.endOfExpression.indexOf(lex.text) !== -1) {
  16913         break;
  16914       }
  16915 
  16916       if (breakOnTokenText && lex.text === breakOnTokenText) {
  16917         break;
  16918       }
  16919 
  16920       if (breakOnInfix && src_functions[lex.text] && src_functions[lex.text].infix) {
  16921         break;
  16922       }
  16923 
  16924       var atom = this.parseAtom(breakOnTokenText);
  16925 
  16926       if (!atom) {
  16927         break;
  16928       } else if (atom.type === "internal") {
  16929         continue;
  16930       }
  16931 
  16932       body.push(atom);
  16933     }
  16934 
  16935     if (this.mode === "text") {
  16936       this.formLigatures(body);
  16937     }
  16938 
  16939     return this.handleInfixNodes(body);
  16940   }
  16941   /**
  16942    * Rewrites infix operators such as \over with corresponding commands such
  16943    * as \frac.
  16944    *
  16945    * There can only be one infix operator per group.  If there's more than one
  16946    * then the expression is ambiguous.  This can be resolved by adding {}.
  16947    */
  16948   ;
  16949 
  16950   _proto.handleInfixNodes = function handleInfixNodes(body) {
  16951     var overIndex = -1;
  16952     var funcName;
  16953 
  16954     for (var i = 0; i < body.length; i++) {
  16955       if (body[i].type === "infix") {
  16956         if (overIndex !== -1) {
  16957           throw new src_ParseError("only one infix operator per group", body[i].token);
  16958         }
  16959 
  16960         overIndex = i;
  16961         funcName = body[i].replaceWith;
  16962       }
  16963     }
  16964 
  16965     if (overIndex !== -1 && funcName) {
  16966       var numerNode;
  16967       var denomNode;
  16968       var numerBody = body.slice(0, overIndex);
  16969       var denomBody = body.slice(overIndex + 1);
  16970 
  16971       if (numerBody.length === 1 && numerBody[0].type === "ordgroup") {
  16972         numerNode = numerBody[0];
  16973       } else {
  16974         numerNode = {
  16975           type: "ordgroup",
  16976           mode: this.mode,
  16977           body: numerBody
  16978         };
  16979       }
  16980 
  16981       if (denomBody.length === 1 && denomBody[0].type === "ordgroup") {
  16982         denomNode = denomBody[0];
  16983       } else {
  16984         denomNode = {
  16985           type: "ordgroup",
  16986           mode: this.mode,
  16987           body: denomBody
  16988         };
  16989       }
  16990 
  16991       var node;
  16992 
  16993       if (funcName === "\\\\abovefrac") {
  16994         node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []);
  16995       } else {
  16996         node = this.callFunction(funcName, [numerNode, denomNode], []);
  16997       }
  16998 
  16999       return [node];
  17000     } else {
  17001       return body;
  17002     }
  17003   }
  17004   /**
  17005    * Handle a subscript or superscript with nice errors.
  17006    */
  17007   ;
  17008 
  17009   _proto.handleSupSubscript = function handleSupSubscript(name) {
  17010     var symbolToken = this.fetch();
  17011     var symbol = symbolToken.text;
  17012     this.consume();
  17013     this.consumeSpaces(); // ignore spaces before sup/subscript argument
  17014 
  17015     var group = this.parseGroup(name);
  17016 
  17017     if (!group) {
  17018       throw new src_ParseError("Expected group after '" + symbol + "'", symbolToken);
  17019     }
  17020 
  17021     return group;
  17022   }
  17023   /**
  17024    * Converts the textual input of an unsupported command into a text node
  17025    * contained within a color node whose color is determined by errorColor
  17026    */
  17027   ;
  17028 
  17029   _proto.formatUnsupportedCmd = function formatUnsupportedCmd(text) {
  17030     var textordArray = [];
  17031 
  17032     for (var i = 0; i < text.length; i++) {
  17033       textordArray.push({
  17034         type: "textord",
  17035         mode: "text",
  17036         text: text[i]
  17037       });
  17038     }
  17039 
  17040     var textNode = {
  17041       type: "text",
  17042       mode: this.mode,
  17043       body: textordArray
  17044     };
  17045     var colorNode = {
  17046       type: "color",
  17047       mode: this.mode,
  17048       color: this.settings.errorColor,
  17049       body: [textNode]
  17050     };
  17051     return colorNode;
  17052   }
  17053   /**
  17054    * Parses a group with optional super/subscripts.
  17055    */
  17056   ;
  17057 
  17058   _proto.parseAtom = function parseAtom(breakOnTokenText) {
  17059     // The body of an atom is an implicit group, so that things like
  17060     // \left(x\right)^2 work correctly.
  17061     var base = this.parseGroup("atom", breakOnTokenText); // In text mode, we don't have superscripts or subscripts
  17062 
  17063     if (this.mode === "text") {
  17064       return base;
  17065     } // Note that base may be empty (i.e. null) at this point.
  17066 
  17067 
  17068     var superscript;
  17069     var subscript;
  17070 
  17071     while (true) {
  17072       // Guaranteed in math mode, so eat any spaces first.
  17073       this.consumeSpaces(); // Lex the first token
  17074 
  17075       var lex = this.fetch();
  17076 
  17077       if (lex.text === "\\limits" || lex.text === "\\nolimits") {
  17078         // We got a limit control
  17079         if (base && base.type === "op") {
  17080           var limits = lex.text === "\\limits";
  17081           base.limits = limits;
  17082           base.alwaysHandleSupSub = true;
  17083         } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub) {
  17084           var _limits = lex.text === "\\limits";
  17085 
  17086           base.limits = _limits;
  17087         } else {
  17088           throw new src_ParseError("Limit controls must follow a math operator", lex);
  17089         }
  17090 
  17091         this.consume();
  17092       } else if (lex.text === "^") {
  17093         // We got a superscript start
  17094         if (superscript) {
  17095           throw new src_ParseError("Double superscript", lex);
  17096         }
  17097 
  17098         superscript = this.handleSupSubscript("superscript");
  17099       } else if (lex.text === "_") {
  17100         // We got a subscript start
  17101         if (subscript) {
  17102           throw new src_ParseError("Double subscript", lex);
  17103         }
  17104 
  17105         subscript = this.handleSupSubscript("subscript");
  17106       } else if (lex.text === "'") {
  17107         // We got a prime
  17108         if (superscript) {
  17109           throw new src_ParseError("Double superscript", lex);
  17110         }
  17111 
  17112         var prime = {
  17113           type: "textord",
  17114           mode: this.mode,
  17115           text: "\\prime"
  17116         }; // Many primes can be grouped together, so we handle this here
  17117 
  17118         var primes = [prime];
  17119         this.consume(); // Keep lexing tokens until we get something that's not a prime
  17120 
  17121         while (this.fetch().text === "'") {
  17122           // For each one, add another prime to the list
  17123           primes.push(prime);
  17124           this.consume();
  17125         } // If there's a superscript following the primes, combine that
  17126         // superscript in with the primes.
  17127 
  17128 
  17129         if (this.fetch().text === "^") {
  17130           primes.push(this.handleSupSubscript("superscript"));
  17131         } // Put everything into an ordgroup as the superscript
  17132 
  17133 
  17134         superscript = {
  17135           type: "ordgroup",
  17136           mode: this.mode,
  17137           body: primes
  17138         };
  17139       } else {
  17140         // If it wasn't ^, _, or ', stop parsing super/subscripts
  17141         break;
  17142       }
  17143     } // Base must be set if superscript or subscript are set per logic above,
  17144     // but need to check here for type check to pass.
  17145 
  17146 
  17147     if (superscript || subscript) {
  17148       // If we got either a superscript or subscript, create a supsub
  17149       return {
  17150         type: "supsub",
  17151         mode: this.mode,
  17152         base: base,
  17153         sup: superscript,
  17154         sub: subscript
  17155       };
  17156     } else {
  17157       // Otherwise return the original body
  17158       return base;
  17159     }
  17160   }
  17161   /**
  17162    * Parses an entire function, including its base and all of its arguments.
  17163    */
  17164   ;
  17165 
  17166   _proto.parseFunction = function parseFunction(breakOnTokenText, name) {
  17167     var token = this.fetch();
  17168     var func = token.text;
  17169     var funcData = src_functions[func];
  17170 
  17171     if (!funcData) {
  17172       return null;
  17173     }
  17174 
  17175     this.consume(); // consume command token
  17176 
  17177     if (name && name !== "atom" && !funcData.allowedInArgument) {
  17178       throw new src_ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token);
  17179     } else if (this.mode === "text" && !funcData.allowedInText) {
  17180       throw new src_ParseError("Can't use function '" + func + "' in text mode", token);
  17181     } else if (this.mode === "math" && funcData.allowedInMath === false) {
  17182       throw new src_ParseError("Can't use function '" + func + "' in math mode", token);
  17183     }
  17184 
  17185     var _this$parseArguments = this.parseArguments(func, funcData),
  17186         args = _this$parseArguments.args,
  17187         optArgs = _this$parseArguments.optArgs;
  17188 
  17189     return this.callFunction(func, args, optArgs, token, breakOnTokenText);
  17190   }
  17191   /**
  17192    * Call a function handler with a suitable context and arguments.
  17193    */
  17194   ;
  17195 
  17196   _proto.callFunction = function callFunction(name, args, optArgs, token, breakOnTokenText) {
  17197     var context = {
  17198       funcName: name,
  17199       parser: this,
  17200       token: token,
  17201       breakOnTokenText: breakOnTokenText
  17202     };
  17203     var func = src_functions[name];
  17204 
  17205     if (func && func.handler) {
  17206       return func.handler(context, args, optArgs);
  17207     } else {
  17208       throw new src_ParseError("No function handler for " + name);
  17209     }
  17210   }
  17211   /**
  17212    * Parses the arguments of a function or environment
  17213    */
  17214   ;
  17215 
  17216   _proto.parseArguments = function parseArguments(func, // Should look like "\name" or "\begin{name}".
  17217   funcData) {
  17218     var totalArgs = funcData.numArgs + funcData.numOptionalArgs;
  17219 
  17220     if (totalArgs === 0) {
  17221       return {
  17222         args: [],
  17223         optArgs: []
  17224       };
  17225     }
  17226 
  17227     var args = [];
  17228     var optArgs = [];
  17229 
  17230     for (var i = 0; i < totalArgs; i++) {
  17231       var argType = funcData.argTypes && funcData.argTypes[i];
  17232       var isOptional = i < funcData.numOptionalArgs;
  17233 
  17234       if (funcData.primitive && argType == null || // \sqrt expands into primitive if optional argument doesn't exist
  17235       funcData.type === "sqrt" && i === 1 && optArgs[0] == null) {
  17236         argType = "primitive";
  17237       }
  17238 
  17239       var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional);
  17240 
  17241       if (isOptional) {
  17242         optArgs.push(arg);
  17243       } else if (arg != null) {
  17244         args.push(arg);
  17245       } else {
  17246         // should be unreachable
  17247         throw new src_ParseError("Null argument, please report this as a bug");
  17248       }
  17249     }
  17250 
  17251     return {
  17252       args: args,
  17253       optArgs: optArgs
  17254     };
  17255   }
  17256   /**
  17257    * Parses a group when the mode is changing.
  17258    */
  17259   ;
  17260 
  17261   _proto.parseGroupOfType = function parseGroupOfType(name, type, optional) {
  17262     switch (type) {
  17263       case "color":
  17264         return this.parseColorGroup(optional);
  17265 
  17266       case "size":
  17267         return this.parseSizeGroup(optional);
  17268 
  17269       case "url":
  17270         return this.parseUrlGroup(optional);
  17271 
  17272       case "math":
  17273       case "text":
  17274         return this.parseArgumentGroup(optional, type);
  17275 
  17276       case "hbox":
  17277         {
  17278           // hbox argument type wraps the argument in the equivalent of
  17279           // \hbox, which is like \text but switching to \textstyle size.
  17280           var group = this.parseArgumentGroup(optional, "text");
  17281           return group != null ? {
  17282             type: "styling",
  17283             mode: group.mode,
  17284             body: [group],
  17285             style: "text" // simulate \textstyle
  17286 
  17287           } : null;
  17288         }
  17289 
  17290       case "raw":
  17291         {
  17292           var token = this.parseStringGroup("raw", optional);
  17293           return token != null ? {
  17294             type: "raw",
  17295             mode: "text",
  17296             string: token.text
  17297           } : null;
  17298         }
  17299 
  17300       case "primitive":
  17301         {
  17302           if (optional) {
  17303             throw new src_ParseError("A primitive argument cannot be optional");
  17304           }
  17305 
  17306           var _group = this.parseGroup(name);
  17307 
  17308           if (_group == null) {
  17309             throw new src_ParseError("Expected group as " + name, this.fetch());
  17310           }
  17311 
  17312           return _group;
  17313         }
  17314 
  17315       case "original":
  17316       case null:
  17317       case undefined:
  17318         return this.parseArgumentGroup(optional);
  17319 
  17320       default:
  17321         throw new src_ParseError("Unknown group type as " + name, this.fetch());
  17322     }
  17323   }
  17324   /**
  17325    * Discard any space tokens, fetching the next non-space token.
  17326    */
  17327   ;
  17328 
  17329   _proto.consumeSpaces = function consumeSpaces() {
  17330     while (this.fetch().text === " ") {
  17331       this.consume();
  17332     }
  17333   }
  17334   /**
  17335    * Parses a group, essentially returning the string formed by the
  17336    * brace-enclosed tokens plus some position information.
  17337    */
  17338   ;
  17339 
  17340   _proto.parseStringGroup = function parseStringGroup(modeName, // Used to describe the mode in error messages.
  17341   optional) {
  17342     var argToken = this.gullet.scanArgument(optional);
  17343 
  17344     if (argToken == null) {
  17345       return null;
  17346     }
  17347 
  17348     var str = "";
  17349     var nextToken;
  17350 
  17351     while ((nextToken = this.fetch()).text !== "EOF") {
  17352       str += nextToken.text;
  17353       this.consume();
  17354     }
  17355 
  17356     this.consume(); // consume the end of the argument
  17357 
  17358     argToken.text = str;
  17359     return argToken;
  17360   }
  17361   /**
  17362    * Parses a regex-delimited group: the largest sequence of tokens
  17363    * whose concatenated strings match `regex`. Returns the string
  17364    * formed by the tokens plus some position information.
  17365    */
  17366   ;
  17367 
  17368   _proto.parseRegexGroup = function parseRegexGroup(regex, modeName) {
  17369     var firstToken = this.fetch();
  17370     var lastToken = firstToken;
  17371     var str = "";
  17372     var nextToken;
  17373 
  17374     while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) {
  17375       lastToken = nextToken;
  17376       str += lastToken.text;
  17377       this.consume();
  17378     }
  17379 
  17380     if (str === "") {
  17381       throw new src_ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken);
  17382     }
  17383 
  17384     return firstToken.range(lastToken, str);
  17385   }
  17386   /**
  17387    * Parses a color description.
  17388    */
  17389   ;
  17390 
  17391   _proto.parseColorGroup = function parseColorGroup(optional) {
  17392     var res = this.parseStringGroup("color", optional);
  17393 
  17394     if (res == null) {
  17395       return null;
  17396     }
  17397 
  17398     var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);
  17399 
  17400     if (!match) {
  17401       throw new src_ParseError("Invalid color: '" + res.text + "'", res);
  17402     }
  17403 
  17404     var color = match[0];
  17405 
  17406     if (/^[0-9a-f]{6}$/i.test(color)) {
  17407       // We allow a 6-digit HTML color spec without a leading "#".
  17408       // This follows the xcolor package's HTML color model.
  17409       // Predefined color names are all missed by this RegEx pattern.
  17410       color = "#" + color;
  17411     }
  17412 
  17413     return {
  17414       type: "color-token",
  17415       mode: this.mode,
  17416       color: color
  17417     };
  17418   }
  17419   /**
  17420    * Parses a size specification, consisting of magnitude and unit.
  17421    */
  17422   ;
  17423 
  17424   _proto.parseSizeGroup = function parseSizeGroup(optional) {
  17425     var res;
  17426     var isBlank = false; // don't expand before parseStringGroup
  17427 
  17428     this.gullet.consumeSpaces();
  17429 
  17430     if (!optional && this.gullet.future().text !== "{") {
  17431       res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size");
  17432     } else {
  17433       res = this.parseStringGroup("size", optional);
  17434     }
  17435 
  17436     if (!res) {
  17437       return null;
  17438     }
  17439 
  17440     if (!optional && res.text.length === 0) {
  17441       // Because we've tested for what is !optional, this block won't
  17442       // affect \kern, \hspace, etc. It will capture the mandatory arguments
  17443       // to \genfrac and \above.
  17444       res.text = "0pt"; // Enable \above{}
  17445 
  17446       isBlank = true; // This is here specifically for \genfrac
  17447     }
  17448 
  17449     var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text);
  17450 
  17451     if (!match) {
  17452       throw new src_ParseError("Invalid size: '" + res.text + "'", res);
  17453     }
  17454 
  17455     var data = {
  17456       number: +(match[1] + match[2]),
  17457       // sign + magnitude, cast to number
  17458       unit: match[3]
  17459     };
  17460 
  17461     if (!validUnit(data)) {
  17462       throw new src_ParseError("Invalid unit: '" + data.unit + "'", res);
  17463     }
  17464 
  17465     return {
  17466       type: "size",
  17467       mode: this.mode,
  17468       value: data,
  17469       isBlank: isBlank
  17470     };
  17471   }
  17472   /**
  17473    * Parses an URL, checking escaped letters and allowed protocols,
  17474    * and setting the catcode of % as an active character (as in \hyperref).
  17475    */
  17476   ;
  17477 
  17478   _proto.parseUrlGroup = function parseUrlGroup(optional) {
  17479     this.gullet.lexer.setCatcode("%", 13); // active character
  17480 
  17481     var res = this.parseStringGroup("url", optional);
  17482     this.gullet.lexer.setCatcode("%", 14); // comment character
  17483 
  17484     if (res == null) {
  17485       return null;
  17486     } // hyperref package allows backslashes alone in href, but doesn't
  17487     // generate valid links in such cases; we interpret this as
  17488     // "undefined" behaviour, and keep them as-is. Some browser will
  17489     // replace backslashes with forward slashes.
  17490 
  17491 
  17492     var url = res.text.replace(/\\([#$%&~_^{}])/g, '$1');
  17493     return {
  17494       type: "url",
  17495       mode: this.mode,
  17496       url: url
  17497     };
  17498   }
  17499   /**
  17500    * Parses an argument with the mode specified.
  17501    */
  17502   ;
  17503 
  17504   _proto.parseArgumentGroup = function parseArgumentGroup(optional, mode) {
  17505     var argToken = this.gullet.scanArgument(optional);
  17506 
  17507     if (argToken == null) {
  17508       return null;
  17509     }
  17510 
  17511     var outerMode = this.mode;
  17512 
  17513     if (mode) {
  17514       // Switch to specified mode
  17515       this.switchMode(mode);
  17516     }
  17517 
  17518     this.gullet.beginGroup();
  17519     var expression = this.parseExpression(false, "EOF"); // TODO: find an alternative way to denote the end
  17520 
  17521     this.expect("EOF"); // expect the end of the argument
  17522 
  17523     this.gullet.endGroup();
  17524     var result = {
  17525       type: "ordgroup",
  17526       mode: this.mode,
  17527       loc: argToken.loc,
  17528       body: expression
  17529     };
  17530 
  17531     if (mode) {
  17532       // Switch mode back
  17533       this.switchMode(outerMode);
  17534     }
  17535 
  17536     return result;
  17537   }
  17538   /**
  17539    * Parses an ordinary group, which is either a single nucleus (like "x")
  17540    * or an expression in braces (like "{x+y}") or an implicit group, a group
  17541    * that starts at the current position, and ends right before a higher explicit
  17542    * group ends, or at EOF.
  17543    */
  17544   ;
  17545 
  17546   _proto.parseGroup = function parseGroup(name, // For error reporting.
  17547   breakOnTokenText) {
  17548     var firstToken = this.fetch();
  17549     var text = firstToken.text;
  17550     var result; // Try to parse an open brace or \begingroup
  17551 
  17552     if (text === "{" || text === "\\begingroup") {
  17553       this.consume();
  17554       var groupEnd = text === "{" ? "}" : "\\endgroup";
  17555       this.gullet.beginGroup(); // If we get a brace, parse an expression
  17556 
  17557       var expression = this.parseExpression(false, groupEnd);
  17558       var lastToken = this.fetch();
  17559       this.expect(groupEnd); // Check that we got a matching closing brace
  17560 
  17561       this.gullet.endGroup();
  17562       result = {
  17563         type: "ordgroup",
  17564         mode: this.mode,
  17565         loc: SourceLocation.range(firstToken, lastToken),
  17566         body: expression,
  17567         // A group formed by \begingroup...\endgroup is a semi-simple group
  17568         // which doesn't affect spacing in math mode, i.e., is transparent.
  17569         // https://tex.stackexchange.com/questions/1930/when-should-one-
  17570         // use-begingroup-instead-of-bgroup
  17571         semisimple: text === "\\begingroup" || undefined
  17572       };
  17573     } else {
  17574       // If there exists a function with this name, parse the function.
  17575       // Otherwise, just return a nucleus
  17576       result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol();
  17577 
  17578       if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) {
  17579         if (this.settings.throwOnError) {
  17580           throw new src_ParseError("Undefined control sequence: " + text, firstToken);
  17581         }
  17582 
  17583         result = this.formatUnsupportedCmd(text);
  17584         this.consume();
  17585       }
  17586     }
  17587 
  17588     return result;
  17589   }
  17590   /**
  17591    * Form ligature-like combinations of characters for text mode.
  17592    * This includes inputs like "--", "---", "``" and "''".
  17593    * The result will simply replace multiple textord nodes with a single
  17594    * character in each value by a single textord node having multiple
  17595    * characters in its value.  The representation is still ASCII source.
  17596    * The group will be modified in place.
  17597    */
  17598   ;
  17599 
  17600   _proto.formLigatures = function formLigatures(group) {
  17601     var n = group.length - 1;
  17602 
  17603     for (var i = 0; i < n; ++i) {
  17604       var a = group[i]; // $FlowFixMe: Not every node type has a `text` property.
  17605 
  17606       var v = a.text;
  17607 
  17608       if (v === "-" && group[i + 1].text === "-") {
  17609         if (i + 1 < n && group[i + 2].text === "-") {
  17610           group.splice(i, 3, {
  17611             type: "textord",
  17612             mode: "text",
  17613             loc: SourceLocation.range(a, group[i + 2]),
  17614             text: "---"
  17615           });
  17616           n -= 2;
  17617         } else {
  17618           group.splice(i, 2, {
  17619             type: "textord",
  17620             mode: "text",
  17621             loc: SourceLocation.range(a, group[i + 1]),
  17622             text: "--"
  17623           });
  17624           n -= 1;
  17625         }
  17626       }
  17627 
  17628       if ((v === "'" || v === "`") && group[i + 1].text === v) {
  17629         group.splice(i, 2, {
  17630           type: "textord",
  17631           mode: "text",
  17632           loc: SourceLocation.range(a, group[i + 1]),
  17633           text: v + v
  17634         });
  17635         n -= 1;
  17636       }
  17637     }
  17638   }
  17639   /**
  17640    * Parse a single symbol out of the string. Here, we handle single character
  17641    * symbols and special functions like \verb.
  17642    */
  17643   ;
  17644 
  17645   _proto.parseSymbol = function parseSymbol() {
  17646     var nucleus = this.fetch();
  17647     var text = nucleus.text;
  17648 
  17649     if (/^\\verb[^a-zA-Z]/.test(text)) {
  17650       this.consume();
  17651       var arg = text.slice(5);
  17652       var star = arg.charAt(0) === "*";
  17653 
  17654       if (star) {
  17655         arg = arg.slice(1);
  17656       } // Lexer's tokenRegex is constructed to always have matching
  17657       // first/last characters.
  17658 
  17659 
  17660       if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) {
  17661         throw new src_ParseError("\\verb assertion failed --\n                    please report what input caused this bug");
  17662       }
  17663 
  17664       arg = arg.slice(1, -1); // remove first and last char
  17665 
  17666       return {
  17667         type: "verb",
  17668         mode: "text",
  17669         body: arg,
  17670         star: star
  17671       };
  17672     } // At this point, we should have a symbol, possibly with accents.
  17673     // First expand any accented base symbol according to unicodeSymbols.
  17674 
  17675 
  17676     if (unicodeSymbols.hasOwnProperty(text[0]) && !src_symbols[this.mode][text[0]]) {
  17677       // This behavior is not strict (XeTeX-compatible) in math mode.
  17678       if (this.settings.strict && this.mode === "math") {
  17679         this.settings.reportNonstrict("unicodeTextInMathMode", "Accented Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
  17680       }
  17681 
  17682       text = unicodeSymbols[text[0]] + text.substr(1);
  17683     } // Strip off any combining characters
  17684 
  17685 
  17686     var match = combiningDiacriticalMarksEndRegex.exec(text);
  17687 
  17688     if (match) {
  17689       text = text.substring(0, match.index);
  17690 
  17691       if (text === 'i') {
  17692         text = "\u0131"; // dotless i, in math and text mode
  17693       } else if (text === 'j') {
  17694         text = "\u0237"; // dotless j, in math and text mode
  17695       }
  17696     } // Recognize base symbol
  17697 
  17698 
  17699     var symbol;
  17700 
  17701     if (src_symbols[this.mode][text]) {
  17702       if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) {
  17703         this.settings.reportNonstrict("unicodeTextInMathMode", "Latin-1/Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
  17704       }
  17705 
  17706       var group = src_symbols[this.mode][text].group;
  17707       var loc = SourceLocation.range(nucleus);
  17708       var s;
  17709 
  17710       if (ATOMS.hasOwnProperty(group)) {
  17711         // $FlowFixMe
  17712         var family = group;
  17713         s = {
  17714           type: "atom",
  17715           mode: this.mode,
  17716           family: family,
  17717           loc: loc,
  17718           text: text
  17719         };
  17720       } else {
  17721         // $FlowFixMe
  17722         s = {
  17723           type: group,
  17724           mode: this.mode,
  17725           loc: loc,
  17726           text: text
  17727         };
  17728       } // $FlowFixMe
  17729 
  17730 
  17731       symbol = s;
  17732     } else if (text.charCodeAt(0) >= 0x80) {
  17733       // no symbol for e.g. ^
  17734       if (this.settings.strict) {
  17735         if (!supportedCodepoint(text.charCodeAt(0))) {
  17736           this.settings.reportNonstrict("unknownSymbol", "Unrecognized Unicode character \"" + text[0] + "\"" + (" (" + text.charCodeAt(0) + ")"), nucleus);
  17737         } else if (this.mode === "math") {
  17738           this.settings.reportNonstrict("unicodeTextInMathMode", "Unicode text character \"" + text[0] + "\" used in math mode", nucleus);
  17739         }
  17740       } // All nonmathematical Unicode characters are rendered as if they
  17741       // are in text mode (wrapped in \text) because that's what it
  17742       // takes to render them in LaTeX.  Setting `mode: this.mode` is
  17743       // another natural choice (the user requested math mode), but
  17744       // this makes it more difficult for getCharacterMetrics() to
  17745       // distinguish Unicode characters without metrics and those for
  17746       // which we want to simulate the letter M.
  17747 
  17748 
  17749       symbol = {
  17750         type: "textord",
  17751         mode: "text",
  17752         loc: SourceLocation.range(nucleus),
  17753         text: text
  17754       };
  17755     } else {
  17756       return null; // EOF, ^, _, {, }, etc.
  17757     }
  17758 
  17759     this.consume(); // Transform combining characters into accents
  17760 
  17761     if (match) {
  17762       for (var i = 0; i < match[0].length; i++) {
  17763         var accent = match[0][i];
  17764 
  17765         if (!unicodeAccents[accent]) {
  17766           throw new src_ParseError("Unknown accent ' " + accent + "'", nucleus);
  17767         }
  17768 
  17769         var command = unicodeAccents[accent][this.mode];
  17770 
  17771         if (!command) {
  17772           throw new src_ParseError("Accent " + accent + " unsupported in " + this.mode + " mode", nucleus);
  17773         }
  17774 
  17775         symbol = {
  17776           type: "accent",
  17777           mode: this.mode,
  17778           loc: SourceLocation.range(nucleus),
  17779           label: command,
  17780           isStretchy: false,
  17781           isShifty: true,
  17782           // $FlowFixMe
  17783           base: symbol
  17784         };
  17785       }
  17786     } // $FlowFixMe
  17787 
  17788 
  17789     return symbol;
  17790   };
  17791 
  17792   return Parser;
  17793 }();
  17794 
  17795 Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
  17796 
  17797 ;// CONCATENATED MODULE: ./src/parseTree.js
  17798 /**
  17799  * Provides a single function for parsing an expression using a Parser
  17800  * TODO(emily): Remove this
  17801  */
  17802 
  17803 
  17804 
  17805 /**
  17806  * Parses an expression using a Parser, then returns the parsed result.
  17807  */
  17808 var parseTree = function parseTree(toParse, settings) {
  17809   if (!(typeof toParse === 'string' || toParse instanceof String)) {
  17810     throw new TypeError('KaTeX can only parse string typed expression');
  17811   }
  17812 
  17813   var parser = new Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors
  17814 
  17815   delete parser.gullet.macros.current["\\df@tag"];
  17816   var tree = parser.parse(); // Prevent a color definition from persisting between calls to katex.render().
  17817 
  17818   delete parser.gullet.macros.current["\\current@color"];
  17819   delete parser.gullet.macros.current["\\color"]; // If the input used \tag, it will set the \df@tag macro to the tag.
  17820   // In this case, we separately parse the tag and wrap the tree.
  17821 
  17822   if (parser.gullet.macros.get("\\df@tag")) {
  17823     if (!settings.displayMode) {
  17824       throw new src_ParseError("\\tag works only in display equations");
  17825     }
  17826 
  17827     parser.gullet.feed("\\df@tag");
  17828     tree = [{
  17829       type: "tag",
  17830       mode: "text",
  17831       body: tree,
  17832       tag: parser.parse()
  17833     }];
  17834   }
  17835 
  17836   return tree;
  17837 };
  17838 
  17839 /* harmony default export */ var src_parseTree = (parseTree);
  17840 ;// CONCATENATED MODULE: ./katex.js
  17841 /* eslint no-console:0 */
  17842 
  17843 /**
  17844  * This is the main entry point for KaTeX. Here, we expose functions for
  17845  * rendering expressions either to DOM nodes or to markup strings.
  17846  *
  17847  * We also expose the ParseError class to check if errors thrown from KaTeX are
  17848  * errors in the expression, or errors in javascript handling.
  17849  */
  17850 
  17851 
  17852 
  17853 
  17854 
  17855 
  17856 
  17857 
  17858 
  17859 
  17860 /**
  17861  * Parse and build an expression, and place that expression in the DOM node
  17862  * given.
  17863  */
  17864 var render = function render(expression, baseNode, options) {
  17865   baseNode.textContent = "";
  17866   var node = renderToDomTree(expression, options).toNode();
  17867   baseNode.appendChild(node);
  17868 }; // KaTeX's styles don't work properly in quirks mode. Print out an error, and
  17869 // disable rendering.
  17870 
  17871 
  17872 if (typeof document !== "undefined") {
  17873   if (document.compatMode !== "CSS1Compat") {
  17874     typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your " + "website has a suitable doctype.");
  17875 
  17876     render = function render() {
  17877       throw new src_ParseError("KaTeX doesn't work in quirks mode.");
  17878     };
  17879   }
  17880 }
  17881 /**
  17882  * Parse and build an expression, and return the markup for that.
  17883  */
  17884 
  17885 
  17886 var renderToString = function renderToString(expression, options) {
  17887   var markup = renderToDomTree(expression, options).toMarkup();
  17888   return markup;
  17889 };
  17890 /**
  17891  * Parse an expression and return the parse tree.
  17892  */
  17893 
  17894 
  17895 var generateParseTree = function generateParseTree(expression, options) {
  17896   var settings = new Settings(options);
  17897   return src_parseTree(expression, settings);
  17898 };
  17899 /**
  17900  * If the given error is a KaTeX ParseError and options.throwOnError is false,
  17901  * renders the invalid LaTeX as a span with hover title giving the KaTeX
  17902  * error message.  Otherwise, simply throws the error.
  17903  */
  17904 
  17905 
  17906 var renderError = function renderError(error, expression, options) {
  17907   if (options.throwOnError || !(error instanceof src_ParseError)) {
  17908     throw error;
  17909   }
  17910 
  17911   var node = buildCommon.makeSpan(["katex-error"], [new SymbolNode(expression)]);
  17912   node.setAttribute("title", error.toString());
  17913   node.setAttribute("style", "color:" + options.errorColor);
  17914   return node;
  17915 };
  17916 /**
  17917  * Generates and returns the katex build tree. This is used for advanced
  17918  * use cases (like rendering to custom output).
  17919  */
  17920 
  17921 
  17922 var renderToDomTree = function renderToDomTree(expression, options) {
  17923   var settings = new Settings(options);
  17924 
  17925   try {
  17926     var tree = src_parseTree(expression, settings);
  17927     return buildTree(tree, expression, settings);
  17928   } catch (error) {
  17929     return renderError(error, expression, settings);
  17930   }
  17931 };
  17932 /**
  17933  * Generates and returns the katex build tree, with just HTML (no MathML).
  17934  * This is used for advanced use cases (like rendering to custom output).
  17935  */
  17936 
  17937 
  17938 var renderToHTMLTree = function renderToHTMLTree(expression, options) {
  17939   var settings = new Settings(options);
  17940 
  17941   try {
  17942     var tree = src_parseTree(expression, settings);
  17943     return buildHTMLTree(tree, expression, settings);
  17944   } catch (error) {
  17945     return renderError(error, expression, settings);
  17946   }
  17947 };
  17948 
  17949 /* harmony default export */ var katex = ({
  17950   /**
  17951    * Current KaTeX version
  17952    */
  17953   version: "0.13.0",
  17954 
  17955   /**
  17956    * Renders the given LaTeX into an HTML+MathML combination, and adds
  17957    * it as a child to the specified DOM node.
  17958    */
  17959   render: render,
  17960 
  17961   /**
  17962    * Renders the given LaTeX into an HTML+MathML combination string,
  17963    * for sending to the client.
  17964    */
  17965   renderToString: renderToString,
  17966 
  17967   /**
  17968    * KaTeX error, usually during parsing.
  17969    */
  17970   ParseError: src_ParseError,
  17971 
  17972   /**
  17973    * Parses the given LaTeX into KaTeX's internal parse tree structure,
  17974    * without rendering to HTML or MathML.
  17975    *
  17976    * NOTE: This method is not currently recommended for public use.
  17977    * The internal tree representation is unstable and is very likely
  17978    * to change. Use at your own risk.
  17979    */
  17980   __parse: generateParseTree,
  17981 
  17982   /**
  17983    * Renders the given LaTeX into an HTML+MathML internal DOM tree
  17984    * representation, without flattening that representation to a string.
  17985    *
  17986    * NOTE: This method is not currently recommended for public use.
  17987    * The internal tree representation is unstable and is very likely
  17988    * to change. Use at your own risk.
  17989    */
  17990   __renderToDomTree: renderToDomTree,
  17991 
  17992   /**
  17993    * Renders the given LaTeX into an HTML internal DOM tree representation,
  17994    * without MathML and without flattening that representation to a string.
  17995    *
  17996    * NOTE: This method is not currently recommended for public use.
  17997    * The internal tree representation is unstable and is very likely
  17998    * to change. Use at your own risk.
  17999    */
  18000   __renderToHTMLTree: renderToHTMLTree,
  18001 
  18002   /**
  18003    * extends internal font metrics object with a new object
  18004    * each key in the new object represents a font name
  18005   */
  18006   __setFontMetrics: setFontMetrics,
  18007 
  18008   /**
  18009    * adds a new symbol to builtin symbols table
  18010    */
  18011   __defineSymbol: defineSymbol,
  18012 
  18013   /**
  18014    * adds a new macro to builtin macro list
  18015    */
  18016   __defineMacro: defineMacro,
  18017 
  18018   /**
  18019    * Expose the dom tree node types, which can be useful for type checking nodes.
  18020    *
  18021    * NOTE: This method is not currently recommended for public use.
  18022    * The internal tree representation is unstable and is very likely
  18023    * to change. Use at your own risk.
  18024    */
  18025   __domTree: {
  18026     Span: Span,
  18027     Anchor: Anchor,
  18028     SymbolNode: SymbolNode,
  18029     SvgNode: SvgNode,
  18030     PathNode: PathNode,
  18031     LineNode: LineNode
  18032   }
  18033 });
  18034 ;// CONCATENATED MODULE: ./katex.webpack.js
  18035 /**
  18036  * This is the webpack entry point for KaTeX. As ECMAScript, flow[1] and jest[2]
  18037  * doesn't support CSS modules natively, a separate entry point is used and
  18038  * it is not flowtyped.
  18039  *
  18040  * [1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef
  18041  * [2] https://facebook.github.io/jest/docs/en/webpack.html
  18042  */
  18043 
  18044 
  18045 /* harmony default export */ var katex_webpack = (katex);
  18046 __webpack_exports__ = __webpack_exports__.default;
  18047 /******/ 	return __webpack_exports__;
  18048 /******/ })()
  18049 ;
  18050 });