Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1/**2 * This is the ParseError class, which is the main error thrown by KaTeX3 * functions when something has gone wrong. This is used to distinguish internal4 * errors from errors in the expression that the user provided.5 *6 * If possible, a caller should provide a Token or ParseNode with information7 * about where in the source string the problem occurred.8 */9class ParseError extends Error {10 // The underlying error message without any context added.11 constructor(message,12 // The error message13 token) {14 var error = "KaTeX parse error: " + message;15 var start;16 var end;17 var loc = token && token.loc;18 if (loc && loc.start <= loc.end) {19 // If we have the input and a position, make the error a bit fancier20 // Get the input21 var input = loc.lexer.input;22 // Prepend some information23 start = loc.start;24 end = loc.end;25 if (start === input.length) {26 error += " at end of input: ";27 } else {28 error += " at position " + (start + 1) + ": ";29 }30 // Underline token in question using combining underscores31 var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332");32 // Extract some context from the input and add it to the error33 var left;34 if (start > 15) {35 left = "…" + input.slice(start - 15, start);36 } else {37 left = input.slice(0, start);38 }39 var right;40 if (end + 15 < input.length) {41 right = input.slice(end, end + 15) + "…";42 } else {43 right = input.slice(end);44 }45 error += left + underlined + right;46 }47 super(error);48 this.name = "ParseError";49 this.position = void 0;50 // Error start position based on passed-in Token or ParseNode.51 this.length = void 0;52 // Length of affected text based on passed-in Token or ParseNode.53 this.rawMessage = void 0;54 Object.setPrototypeOf(this, ParseError.prototype);55 this.position = start;56 if (start != null && end != null) {57 this.length = end - start;58 }59 this.rawMessage = message;60 }61}62 63/**64 * This file contains a list of utility functions which are useful in other65 * files.66 */67// hyphenate and escape adapted from Facebook's React under Apache 2 license68var uppercase = /([A-Z])/g;69var hyphenate = str => str.replace(uppercase, "-$1").toLowerCase();70var ESCAPE_LOOKUP = {71 "&": "&",72 ">": ">",73 "<": "<",74 "\"": """,75 "'": "'"76};77var ESCAPE_REGEX = /[&><"']/g;78/**79 * Escapes text to prevent scripting attacks.80 */81var escape = text => String(text).replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);82/**83 * Sometimes we want to pull out the innermost element of a group. In most84 * cases, this will just be the group itself, but when ordgroups and colors have85 * a single element, we want to pull that out.86 */87var getBaseElem = group => {88 if (group.type === "ordgroup") {89 if (group.body.length === 1) {90 return getBaseElem(group.body[0]);91 } else {92 return group;93 }94 } else if (group.type === "color") {95 if (group.body.length === 1) {96 return getBaseElem(group.body[0]);97 } else {98 return group;99 }100 } else if (group.type === "font") {101 return getBaseElem(group.body);102 } else {103 return group;104 }105};106var characterNodesTypes = new Set(["mathord", "textord", "atom"]);107/**108 * TeXbook algorithms often reference "character boxes", which are simply groups109 * with a single character in them. To decide if something is a character box,110 * we find its innermost group, and see if it is a single character.111 */112var isCharacterBox = group => characterNodesTypes.has(getBaseElem(group).type);113/**114 * Return the protocol of a URL, or "_relative" if the URL does not specify a115 * protocol (and thus is relative), or `null` if URL has invalid protocol116 * (so should be outright rejected).117 */118var protocolFromUrl = url => {119 // Check for possible leading protocol.120 // https://url.spec.whatwg.org/#url-parsing strips leading whitespace121 // (U+20) or C0 control (U+00-U+1F) characters.122 var protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(url);123 if (!protocol) {124 return "_relative";125 }126 // Reject weird colons127 if (protocol[2] !== ":") {128 return null;129 }130 // Reject invalid characters in scheme according to131 // https://datatracker.ietf.org/doc/html/rfc3986#section-3.1132 if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) {133 return null;134 }135 // Lowercase the protocol136 return protocol[1].toLowerCase();137};138 139/* eslint no-console:0 */140// TODO: automatically generate documentation141// TODO: check all properties on Settings exist142// TODO: check the type of a property on Settings matches143var SETTINGS_SCHEMA = {144 displayMode: {145 type: "boolean",146 description: "Render math in display mode, which puts the math in " + "display style (so \\int and \\sum are large, for example), and " + "centers the math on the page on its own line.",147 cli: "-d, --display-mode"148 },149 output: {150 type: {151 enum: ["htmlAndMathml", "html", "mathml"]152 },153 description: "Determines the markup language of the output.",154 cli: "-F, --format <type>"155 },156 leqno: {157 type: "boolean",158 description: "Render display math in leqno style (left-justified tags)."159 },160 fleqn: {161 type: "boolean",162 description: "Render display math flush left."163 },164 throwOnError: {165 type: "boolean",166 default: true,167 cli: "-t, --no-throw-on-error",168 cliDescription: "Render errors (in the color given by --error-color) ins" + "tead of throwing a ParseError exception when encountering an error."169 },170 errorColor: {171 type: "string",172 default: "#cc0000",173 cli: "-c, --error-color <color>",174 cliDescription: "A color string given in the format 'rgb' or 'rrggbb' " + "(no #). This option determines the color of errors rendered by the " + "-t option.",175 cliProcessor: color => "#" + color176 },177 macros: {178 type: "object",179 cli: "-m, --macro <def>",180 cliDescription: "Define custom macro of the form '\\foo:expansion' (use " + "multiple -m arguments for multiple macros).",181 cliDefault: [],182 cliProcessor: (def, defs) => {183 defs.push(def);184 return defs;185 }186 },187 minRuleThickness: {188 type: "number",189 description: "Specifies a minimum thickness, in ems, for fraction lines," + " `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, " + "`\\hdashline`, `\\underline`, `\\overline`, and the borders of " + "`\\fbox`, `\\boxed`, and `\\fcolorbox`.",190 processor: t => Math.max(0, t),191 cli: "--min-rule-thickness <size>",192 cliProcessor: parseFloat193 },194 colorIsTextColor: {195 type: "boolean",196 description: "Makes \\color behave like LaTeX's 2-argument \\textcolor, " + "instead of LaTeX's one-argument \\color mode change.",197 cli: "-b, --color-is-text-color"198 },199 strict: {200 type: [{201 enum: ["warn", "ignore", "error"]202 }, "boolean", "function"],203 description: "Turn on strict / LaTeX faithfulness mode, which throws an " + "error if the input uses features that are not supported by LaTeX.",204 cli: "-S, --strict",205 cliDefault: false206 },207 trust: {208 type: ["boolean", "function"],209 description: "Trust the input, enabling all HTML features such as \\url.",210 cli: "-T, --trust"211 },212 maxSize: {213 type: "number",214 default: Infinity,215 description: "If non-zero, all user-specified sizes, e.g. in " + "\\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, " + "elements and spaces can be arbitrarily large",216 processor: s => Math.max(0, s),217 cli: "-s, --max-size <n>",218 cliProcessor: parseInt219 },220 maxExpand: {221 type: "number",222 default: 1000,223 description: "Limit the number of macro expansions to the specified " + "number, to prevent e.g. infinite macro loops. If set to Infinity, " + "the macro expander will try to fully expand as in LaTeX.",224 processor: n => Math.max(0, n),225 cli: "-e, --max-expand <n>",226 cliProcessor: n => n === "Infinity" ? Infinity : parseInt(n)227 },228 globalGroup: {229 type: "boolean",230 cli: false231 }232};233function getImplicitDefault(type) {234 if (typeof type !== 'string') {235 return type.enum[0];236 }237 switch (type) {238 case 'boolean':239 return false;240 case 'string':241 return '';242 case 'number':243 return 0;244 case 'object':245 return {};246 default:247 throw new Error("Unexpected schema type; settings must declare an explicit default.");248 }249}250function getDefaultValue(schema) {251 if (schema.default !== undefined) {252 return schema.default;253 }254 var type = Array.isArray(schema.type) ? schema.type[0] : schema.type;255 return getImplicitDefault(type);256}257function applySetting(target, prop, options, schema) {258 var optionValue = options[prop];259 target[prop] = optionValue !== undefined ? schema.processor ? schema.processor(optionValue) : optionValue : getDefaultValue(schema);260}261/**262 * The main Settings object263 *264 * The current options stored are:265 * - displayMode: Whether the expression should be typeset as inline math266 * (false, the default), meaning that the math starts in267 * \textstyle and is placed in an inline-block); or as display268 * math (true), meaning that the math starts in \displaystyle269 * and is placed in a block with vertical margin.270 */271class Settings {272 constructor(options) {273 if (options === void 0) {274 options = {};275 }276 this.displayMode = void 0;277 this.output = void 0;278 this.leqno = void 0;279 this.fleqn = void 0;280 this.throwOnError = void 0;281 this.errorColor = void 0;282 this.macros = void 0;283 this.minRuleThickness = void 0;284 this.colorIsTextColor = void 0;285 this.strict = void 0;286 this.trust = void 0;287 this.maxSize = void 0;288 this.maxExpand = void 0;289 this.globalGroup = void 0;290 // allow null options291 options = options || {};292 for (var prop of Object.keys(SETTINGS_SCHEMA)) {293 var schema = SETTINGS_SCHEMA[prop];294 if (schema) {295 // TODO: validate options296 applySetting(this, prop, options, schema);297 }298 }299 }300 /**301 * Report nonstrict (non-LaTeX-compatible) input.302 * Can safely not be called if `this.strict` is false in JavaScript.303 */304 reportNonstrict(errorCode, errorMsg, token) {305 var strict = this.strict;306 if (typeof strict === "function") {307 // Allow return value of strict function to be boolean or string308 // (or null/undefined, meaning no further processing).309 strict = strict(errorCode, errorMsg, token);310 }311 if (!strict || strict === "ignore") {312 return;313 } else if (strict === true || strict === "error") {314 throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token);315 } else if (strict === "warn") {316 typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));317 } else {318 // won't happen in type-safe code319 typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));320 }321 }322 /**323 * Check whether to apply strict (LaTeX-adhering) behavior for unusual324 * input (like `\\`). Unlike `nonstrict`, will not throw an error;325 * instead, "error" translates to a return value of `true`, while "ignore"326 * translates to a return value of `false`. May still print a warning:327 * "warn" prints a warning and returns `false`.328 * This is for the second category of `errorCode`s listed in the README.329 */330 useStrictBehavior(errorCode, errorMsg, token) {331 var strict = this.strict;332 if (typeof strict === "function") {333 // Allow return value of strict function to be boolean or string334 // (or null/undefined, meaning no further processing).335 // But catch any exceptions thrown by function, treating them336 // like "error".337 try {338 strict = strict(errorCode, errorMsg, token);339 } catch (error) {340 strict = "error";341 }342 }343 if (!strict || strict === "ignore") {344 return false;345 } else if (strict === true || strict === "error") {346 return true;347 } else if (strict === "warn") {348 typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));349 return false;350 } else {351 // won't happen in type-safe code352 typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));353 return false;354 }355 }356 /**357 * Check whether to test potentially dangerous input, and return358 * `true` (trusted) or `false` (untrusted). The sole argument `context`359 * should be an object with `command` field specifying the relevant LaTeX360 * command (as a string starting with `\`), and any other arguments, etc.361 * If `context` has a `url` field, a `protocol` field will automatically362 * get added by this function (changing the specified object).363 */364 isTrusted(context) {365 if ("url" in context && context.url && !context.protocol) {366 var protocol = protocolFromUrl(context.url);367 if (protocol == null) {368 return false;369 }370 context.protocol = protocol;371 }372 var trust = typeof this.trust === "function" ? this.trust(context) : this.trust;373 return Boolean(trust);374 }375}376 377/**378 * This file contains information and classes for the various kinds of styles379 * used in TeX. It provides a generic `Style` class, which holds information380 * about a specific style. It then provides instances of all the different kinds381 * of styles possible, and provides functions to move between them and get382 * information about them.383 */384/**385 * The main style class. Contains a unique id for the style, a size (which is386 * the same for cramped and uncramped version of a style), and a cramped flag.387 */388class Style {389 constructor(id, size, cramped) {390 this.id = void 0;391 this.size = void 0;392 this.cramped = void 0;393 this.id = id;394 this.size = size;395 this.cramped = cramped;396 }397 /**398 * Get the style of a superscript given a base in the current style.399 */400 sup() {401 return styles[sup[this.id]];402 }403 /**404 * Get the style of a subscript given a base in the current style.405 */406 sub() {407 return styles[sub[this.id]];408 }409 /**410 * Get the style of a fraction numerator given the fraction in the current411 * style.412 */413 fracNum() {414 return styles[fracNum[this.id]];415 }416 /**417 * Get the style of a fraction denominator given the fraction in the current418 * style.419 */420 fracDen() {421 return styles[fracDen[this.id]];422 }423 /**424 * Get the cramped version of a style (in particular, cramping a cramped style425 * doesn't change the style).426 */427 cramp() {428 return styles[cramp[this.id]];429 }430 /**431 * Get a text or display version of this style.432 */433 text() {434 return styles[text$1[this.id]];435 }436 /**437 * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)438 */439 isTight() {440 return this.size >= 2;441 }442}443// IDs of the different styles444var D = 0;445var Dc = 1;446var T = 2;447var Tc = 3;448var S = 4;449var Sc = 5;450var SS = 6;451var SSc = 7;452// Instances of the different styles453var 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)];454// Lookup tables for switching from one style to another455var sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];456var sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];457var fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];458var fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];459var cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];460var text$1 = [D, Dc, T, Tc, T, Tc, T, Tc];461// We only export some of the styles.462var Style$1 = {463 DISPLAY: styles[D],464 TEXT: styles[T],465 SCRIPT: styles[S],466 SCRIPTSCRIPT: styles[SS]467};468 469/*470 * This file defines the Unicode scripts and script families that we471 * support. To add new scripts or families, just add a new entry to the472 * scriptData array below. Adding scripts to the scriptData array allows473 * characters from that script to appear in \text{} environments.474 */475/**476 * Unicode block data for the families of scripts we support in \text{}.477 * Scripts only need to appear here if they do not have font metrics.478 */479var scriptData = [{480 // Latin characters beyond the Latin-1 characters we have metrics for.481 // Needed for Czech, Hungarian and Turkish text, for example.482 name: 'latin',483 blocks: [[0x0100, 0x024f],484 // Latin Extended-A and Latin Extended-B485 [0x0300, 0x036f] // Combining Diacritical marks486 ]487}, {488 // The Cyrillic script used by Russian and related languages.489 // A Cyrillic subset used to be supported as explicitly defined490 // symbols in symbols.js491 name: 'cyrillic',492 blocks: [[0x0400, 0x04ff]]493}, {494 // Armenian495 name: 'armenian',496 blocks: [[0x0530, 0x058F]]497}, {498 // The Brahmic scripts of South and Southeast Asia499 // Devanagari (0900–097F)500 // Bengali (0980–09FF)501 // Gurmukhi (0A00–0A7F)502 // Gujarati (0A80–0AFF)503 // Oriya (0B00–0B7F)504 // Tamil (0B80–0BFF)505 // Telugu (0C00–0C7F)506 // Kannada (0C80–0CFF)507 // Malayalam (0D00–0D7F)508 // Sinhala (0D80–0DFF)509 // Thai (0E00–0E7F)510 // Lao (0E80–0EFF)511 // Tibetan (0F00–0FFF)512 // Myanmar (1000–109F)513 name: 'brahmic',514 blocks: [[0x0900, 0x109F]]515}, {516 name: 'georgian',517 blocks: [[0x10A0, 0x10ff]]518}, {519 // Chinese and Japanese.520 // The "k" in cjk is for Korean, but we've separated Korean out521 name: "cjk",522 blocks: [[0x3000, 0x30FF],523 // CJK symbols and punctuation, Hiragana, Katakana524 [0x4E00, 0x9FAF],525 // CJK ideograms526 [0xFF00, 0xFF60] // Fullwidth punctuation527 // TODO: add halfwidth Katakana and Romanji glyphs528 ]529}, {530 // Korean531 name: 'hangul',532 blocks: [[0xAC00, 0xD7AF]]533}];534/**535 * Given a codepoint, return the name of the script or script family536 * it is from, or null if it is not part of a known block537 */538function scriptFromCodepoint(codepoint) {539 for (var i = 0; i < scriptData.length; i++) {540 var script = scriptData[i];541 for (var _i = 0; _i < script.blocks.length; _i++) {542 var block = script.blocks[_i];543 if (codepoint >= block[0] && codepoint <= block[1]) {544 return script.name;545 }546 }547 }548 return null;549}550/**551 * A flattened version of all the supported blocks in a single array.552 * This is an optimization to make supportedCodepoint() fast.553 */554var allBlocks = [];555scriptData.forEach(s => s.blocks.forEach(b => allBlocks.push(...b)));556/**557 * Given a codepoint, return true if it falls within one of the558 * scripts or script families defined above and false otherwise.559 *560 * Micro benchmarks shows that this is faster than561 * /[\u3000-\u30FF\u4E00-\u9FAF\uFF00-\uFF60\uAC00-\uD7AF\u0900-\u109F]/.test()562 * in Firefox, Chrome and Node.563 */564function supportedCodepoint(codepoint) {565 for (var i = 0; i < allBlocks.length; i += 2) {566 if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) {567 return true;568 }569 }570 return false;571}572 573/**574 * This file provides support to domTree.js and delimiter.js.575 * It's a storehouse of path geometry for SVG images.576 */577// In all paths below, the viewBox-to-em scale is 1000:1.578// Second Brush Stroke579// Low resolution monitors struggle to display images in fine detail.580// So browsers apply anti-aliasing. A long straight arrow shaft therefore581// will sometimes appear as if it has a blurred edge.582// To mitigate this, these SVG files contain a second "brush-stroke" on the583// arrow shafts. That is, a second long thin rectangular SVG path has been584// written directly on top of each arrow shaft. This reinforcement causes585// some of the screen pixels to display as black instead of the anti-aliased586// gray pixel that a single path would generate. So we get arrow shafts587// whose edges appear to be sharper.588var doubleBrushStroke = svgPath => svgPath + " " + svgPath;589var hLinePad = 80; // padding above a sqrt vinculum. Prevents image cropping.590// The vinculum of a \sqrt can be made thicker by a KaTeX rendering option.591// Think of variable extraVinculum as two detours in the SVG path.592// The detour begins at the lower left of the area labeled extraVinculum below.593// The detour proceeds one extraVinculum distance up and slightly to the right,594// displacing the radiused corner between surd and vinculum. The radius is595// traversed as usual, then the detour resumes. It goes right, to the end of596// the very long vinculum, then down one extraVinculum distance,597// after which it resumes regular path geometry for the radical.598/* vinculum599 /600 /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraVinculum601 / █████████████████████←0.04em (40 unit) std vinculum thickness602 / /603 / /604 / /\605 / / surd606*/607var sqrtMain = function sqrtMain(extraVinculum, hLinePad) {608 // sqrtMain path geometry is from glyph U221A in the font KaTeX Main609 return "M95," + (622 + extraVinculum + 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" + extraVinculum / 2.075 + " -" + extraVinculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraVinculum) + "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 + extraVinculum) + " " + hLinePad + "h400000v" + (40 + extraVinculum) + "h-400000z";610};611var sqrtSize1 = function sqrtSize1(extraVinculum, hLinePad) {612 // size1 is from glyph U221A in the font KaTeX_Size1-Regular613 return "M263," + (601 + extraVinculum + 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" + extraVinculum / 2.084 + " -" + extraVinculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraVinculum) + "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 + extraVinculum) + " " + hLinePad + "h400000v" + (40 + extraVinculum) + "h-400000z";614};615var sqrtSize2 = function sqrtSize2(extraVinculum, hLinePad) {616 // size2 is from glyph U221A in the font KaTeX_Size2-Regular617 return "M983 " + (10 + extraVinculum + hLinePad) + "\nl" + extraVinculum / 3.13 + " -" + extraVinculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraVinculum) + "\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 + extraVinculum) + " " + hLinePad + "h400000v" + (40 + extraVinculum) + "h-400000z";618};619var sqrtSize3 = function sqrtSize3(extraVinculum, hLinePad) {620 // size3 is from glyph U221A in the font KaTeX_Size3-Regular621 return "M424," + (2398 + extraVinculum + 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" + extraVinculum / 4.223 + " -" + extraVinculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraVinculum) + "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 + extraVinculum) + " " + hLinePad + "\nh400000v" + (40 + extraVinculum) + "h-400000z";622};623var sqrtSize4 = function sqrtSize4(extraVinculum, hLinePad) {624 // size4 is from glyph U221A in the font KaTeX_Size4-Regular625 return "M473," + (2713 + extraVinculum + hLinePad) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraVinculum / 5.298 + " -" + extraVinculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraVinculum) + "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 + extraVinculum) + " " + hLinePad + "h400000v" + (40 + extraVinculum) + "H1017.7z";626};627var phasePath = function phasePath(y) {628 var x = y / 2; // x coordinate at top of angle629 return "M400000 " + y + " H0 L" + x + " 0 l65 45 L145 " + (y - 80) + " H400000z";630};631var sqrtTall = function sqrtTall(extraVinculum, hLinePad, viewBoxHeight) {632 // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular633 // One path edge has a variable length. It runs vertically from the vinculum634 // to a point near (14 units) the bottom of the surd. The vinculum635 // is normally 40 units thick. So the length of the line in question is:636 var vertSegment = viewBoxHeight - 54 - hLinePad - extraVinculum;637 return "M702 " + (extraVinculum + hLinePad) + "H400000" + (40 + extraVinculum) + "\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 + extraVinculum) + "H742z";638};639var sqrtPath = function sqrtPath(size, extraVinculum, viewBoxHeight) {640 extraVinculum = 1000 * extraVinculum; // Convert from document ems to viewBox.641 var path = "";642 switch (size) {643 case "sqrtMain":644 path = sqrtMain(extraVinculum, hLinePad);645 break;646 case "sqrtSize1":647 path = sqrtSize1(extraVinculum, hLinePad);648 break;649 case "sqrtSize2":650 path = sqrtSize2(extraVinculum, hLinePad);651 break;652 case "sqrtSize3":653 path = sqrtSize3(extraVinculum, hLinePad);654 break;655 case "sqrtSize4":656 path = sqrtSize4(extraVinculum, hLinePad);657 break;658 case "sqrtTall":659 path = sqrtTall(extraVinculum, hLinePad, viewBoxHeight);660 }661 return path;662};663var innerPath = function innerPath(name, height) {664 // The inner part of stretchy tall delimiters665 switch (name) {666 case "\u239c":667 return doubleBrushStroke("M291 0 H417 V" + height + " H291z");668 case "\u2223":669 return doubleBrushStroke("M145 0 H188 V" + height + " H145z");670 case "\u2225":671 return doubleBrushStroke("M145 0 H188 V" + height + " H145z") + doubleBrushStroke("M367 0 H410 V" + height + " H367z");672 case "\u239f":673 return doubleBrushStroke("M457 0 H583 V" + height + " H457z");674 case "\u23a2":675 return doubleBrushStroke("M319 0 H403 V" + height + " H319z");676 case "\u23a5":677 return doubleBrushStroke("M263 0 H347 V" + height + " H263z");678 case "\u23aa":679 return doubleBrushStroke("M384 0 H504 V" + height + " H384z");680 case "\u23d0":681 return doubleBrushStroke("M312 0 H355 V" + height + " H312z");682 case "\u2016":683 return doubleBrushStroke("M257 0 H300 V" + height + " H257z") + doubleBrushStroke("M478 0 H521 V" + height + " H478z");684 default:685 return "";686 }687};688var path = {689 // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main690 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",691 // doublerightarrow is from glyph U+21D2 in font KaTeX Main692 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",693 // leftarrow is from glyph U+2190 in font KaTeX Main694 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",695 // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular696 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",697 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",698 // overgroup is from the MnSymbol package (public domain)699 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",700 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",701 // Harpoons are from glyph U+21BD in font KaTeX Main702 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",703 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",704 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",705 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",706 // hook is from glyph U+21A9 in font KaTeX Main707 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",708 leftlinesegment: doubleBrushStroke("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),709 leftbracketunder: doubleBrushStroke("M0 0 h120 V290 H399995 v120 H0z"),710 leftbracketover: doubleBrushStroke("M0 440 h120 V150 H399995 v-120 H0z"),711 leftmapsto: doubleBrushStroke("M40 281 V448H0V74H40V241H400000v40z"),712 // tofrom is from glyph U+21C4 in font KaTeX AMS Regular713 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",714 longequal: doubleBrushStroke("M0 50 h400000 v40H0z m0 194h40000v40H0z"),715 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",716 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",717 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",718 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",719 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",720 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",721 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",722 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",723 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",724 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",725 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",726 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",727 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",728 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",729 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",730 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",731 rightlinesegment: doubleBrushStroke("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),732 rightbracketunder: doubleBrushStroke("M399995 0 h-120 V290 H0 v120 H400000z"),733 rightbracketover: doubleBrushStroke("M399995 440 h-120 V150 H0 v-120 H399995z"),734 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",735 // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular736 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",737 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",738 // tilde1 is a modified version of a glyph from the MnSymbol package739 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",740 // ditto tilde2, tilde3, & tilde4741 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",742 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",743 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",744 // vec is from glyph U+20D7 in font KaTeX Main745 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",746 // widehat1 is a modified version of a glyph from the MnSymbol package747 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",748 // ditto widehat2, widehat3, & widehat4749 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",750 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",751 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",752 // widecheck paths are all inverted versions of widehat753 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",754 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",755 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",756 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",757 // The next ten paths support reaction arrows from the mhchem package.758 // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX759 // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main760 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",761 // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main762 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",763 // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.764 // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em765 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",766 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",767 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",768 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"769};770var tallDelim = function tallDelim(label, midHeight) {771 switch (label) {772 case "lbrack":773 return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v1759 v84 h347 v-84\nH403z M403 1759 V0 H319 V1759 v" + midHeight + " v1759 v84 h84z";774 case "rbrack":775 return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v" + midHeight + " v1759 h84z";776 case "vert":777 return "M145 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + midHeight + " v585 h43z";778 case "doublevert":779 return "M145 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + midHeight + " v585 h43z\nM367 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v" + midHeight + " v585 h43z";780 case "lfloor":781 return "M319 602 V0 H403 V602 v" + midHeight + " v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v" + midHeight + " v1715 H319z";782 case "rfloor":783 return "M319 602 V0 H403 V602 v" + midHeight + " v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v" + midHeight + " v1715 H319z";784 case "lceil":785 return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v602 h84z\nM403 1759 V0 H319 V1759 v" + midHeight + " v602 h84z";786 case "rceil":787 return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v602 h84z\nM347 1759 V0 h-84 V1759 v" + midHeight + " v602 h84z";788 case "lparen":789 return "M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0," + (midHeight + 84) + "c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-" + (midHeight + 92) + "c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";790 case "rparen":791 return "M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0," + (midHeight + 9) + "\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-" + (midHeight + 144) + "c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";792 default:793 // We should not ever get here.794 throw new Error("Unknown stretchy delimiter.");795 }796};797 798function isMathDomNode(node) {799 return 'toText' in node;800}801/**802 * This node represents a document fragment, which contains elements, but when803 * placed into the DOM doesn't have any representation itself. It only contains804 * children and doesn't have any DOM node properties.805 */806class DocumentFragment {807 // Never used; needed for satisfying interface.808 constructor(children) {809 this.children = void 0;810 this.classes = void 0;811 this.height = void 0;812 this.depth = void 0;813 this.maxFontSize = void 0;814 this.style = void 0;815 this.children = children;816 this.classes = [];817 this.height = 0;818 this.depth = 0;819 this.maxFontSize = 0;820 this.style = {};821 }822 hasClass(className) {823 return this.classes.includes(className);824 }825 /** Convert the fragment into a node. */826 toNode() {827 var frag = document.createDocumentFragment();828 for (var i = 0; i < this.children.length; i++) {829 frag.appendChild(this.children[i].toNode());830 }831 return frag;832 }833 /** Convert the fragment into HTML markup. */834 toMarkup() {835 var markup = "";836 // Simply concatenate the markup for the children together.837 for (var i = 0; i < this.children.length; i++) {838 markup += this.children[i].toMarkup();839 }840 return markup;841 }842 /**843 * Converts the math node into a string, similar to innerText. Applies to844 * MathDomNode's only.845 */846 toText() {847 return this.children.map(child => {848 if (isMathDomNode(child)) {849 return child.toText();850 }851 throw new Error("Expected MathDomNode with toText, got " + child.constructor.name);852 }).join("");853 }854}855 856/**857 * This file does conversion between units. In particular, it provides858 * calculateSize to convert other units into ems.859 */860// This table gives the number of TeX pts in one of each *absolute* TeX unit.861// Thus, multiplying a length by this number converts the length from units862// into pts. Dividing the result by ptPerEm gives the number of ems863// *assuming* a font size of ptPerEm (normal size, normal style).864var ptPerUnit = {865 // https://en.wikibooks.org/wiki/LaTeX/Lengths and866 // https://tex.stackexchange.com/a/8263867 "pt": 1,868 // TeX point869 "mm": 7227 / 2540,870 // millimeter871 "cm": 7227 / 254,872 // centimeter873 "in": 72.27,874 // inch875 "bp": 803 / 800,876 // big (PostScript) points877 "pc": 12,878 // pica879 "dd": 1238 / 1157,880 // didot881 "cc": 14856 / 1157,882 // cicero (12 didot)883 "nd": 685 / 642,884 // new didot885 "nc": 1370 / 107,886 // new cicero (12 new didot)887 "sp": 1 / 65536,888 // scaled point (TeX's internal smallest unit)889 // https://tex.stackexchange.com/a/41371890 "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX891};892// Dictionary of relative units, for fast validity testing.893var relativeUnit = {894 "ex": true,895 "em": true,896 "mu": true897};898/**899 * Determine whether the specified unit (either a string defining the unit900 * or a "size" parse node containing a unit field) is valid.901 */902var validUnit = function validUnit(unit) {903 if (typeof unit !== "string") {904 unit = unit.unit;905 }906 return unit in ptPerUnit || unit in relativeUnit || unit === "ex";907};908/*909 * Convert a "size" parse node (with numeric "number" and string "unit" fields,910 * as parsed by functions.js argType "size") into a CSS em value for the911 * current style/scale. `options` gives the current options.912 */913var calculateSize = function calculateSize(sizeValue, options) {914 var scale;915 if (sizeValue.unit in ptPerUnit) {916 // Absolute units917 scale = ptPerUnit[sizeValue.unit] // Convert unit to pt918 / options.fontMetrics().ptPerEm // Convert pt to CSS em919 / options.sizeMultiplier; // Unscale to make absolute units920 } else if (sizeValue.unit === "mu") {921 // `mu` units scale with scriptstyle/scriptscriptstyle.922 scale = options.fontMetrics().cssEmPerMu;923 } else {924 // Other relative units always refer to the *textstyle* font925 // in the current size.926 var unitOptions;927 if (options.style.isTight()) {928 // isTight() means current style is script/scriptscript.929 unitOptions = options.havingStyle(options.style.text());930 } else {931 unitOptions = options;932 }933 // TODO: In TeX these units are relative to the quad of the current934 // *text* font, e.g. cmr10. KaTeX instead uses values from the935 // comparably-sized *Computer Modern symbol* font. At 10pt, these936 // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641;937 // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$.938 // TeX \showlists shows a kern of 1.13889 * fontsize;939 // KaTeX shows a kern of 1.171 * fontsize.940 if (sizeValue.unit === "ex") {941 scale = unitOptions.fontMetrics().xHeight;942 } else if (sizeValue.unit === "em") {943 scale = unitOptions.fontMetrics().quad;944 } else {945 throw new ParseError("Invalid unit: '" + sizeValue.unit + "'");946 }947 if (unitOptions !== options) {948 scale *= unitOptions.sizeMultiplier / options.sizeMultiplier;949 }950 }951 return Math.min(sizeValue.number * scale, options.maxSize);952};953/**954 * Round `n` to 4 decimal places, or to the nearest 1/10,000th em. See955 * https://github.com/KaTeX/KaTeX/pull/2460.956 */957var makeEm = function makeEm(n) {958 return +n.toFixed(4) + "em";959};960 961/**962 * These objects store the data about the DOM nodes we create, as well as some963 * extra data. They can then be transformed into real DOM nodes with the964 * `toNode` function or HTML markup using `toMarkup`. They are useful for both965 * storing extra properties on the nodes, as well as providing a way to easily966 * work with the DOM.967 *968 * Similar functions for working with MathML nodes exist in mathMLTree.js.969 *970 * TODO: refactor `span` and `anchor` into common superclass when971 * target environments support class inheritance972 */973/**974 * Create an HTML className based on a list of classes. In addition to joining975 * with spaces, we also remove empty classes.976 */977var createClass = function createClass(classes) {978 return classes.filter(cls => cls).join(" ");979};980/**981 * Serialize a CssStyle object into a semicolon-delimited inline-style string982 * (hyphenating camelCase property names). Returns "" when no property is set.983 */984var cssStyleToString = function cssStyleToString(style) {985 var styles = "";986 for (var key of Object.keys(style)) {987 var value = style[key];988 if (value !== undefined) {989 styles += hyphenate(key) + ":" + value + ";";990 }991 }992 return styles;993};994var initNode = function initNode(classes, options, style) {995 this.classes = classes || [];996 this.attributes = {};997 this.height = 0;998 this.depth = 0;999 this.maxFontSize = 0;1000 this.style = style || {};1001 if (options) {1002 if (options.style.isTight()) {1003 this.classes.push("mtight");1004 }1005 var color = options.getColor();1006 if (color) {1007 this.style.color = color;1008 }1009 }1010};1011/**1012 * Convert into an HTML node1013 */1014var toNode = function toNode(tagName) {1015 var node = document.createElement(tagName);1016 // Apply the class1017 node.className = createClass(this.classes);1018 // Apply inline styles1019 Object.assign(node.style, this.style);1020 // Apply attributes1021 for (var attr of Object.keys(this.attributes)) {1022 node.setAttribute(attr, this.attributes[attr]);1023 }1024 // Append the children, also as HTML nodes1025 for (var i = 0; i < this.children.length; i++) {1026 node.appendChild(this.children[i].toNode());1027 }1028 return node;1029};1030/**1031 * https://w3c.github.io/html-reference/syntax.html#syntax-attributes1032 *1033 * > Attribute Names must consist of one or more characters1034 * other than the space characters, U+0000 NULL,1035 * '"', "'", ">", "/", "=", the control characters,1036 * and any characters that are not defined by Unicode.1037 */1038var invalidAttributeNameRegex = /[\s"'>/=\x00-\x1f]/;1039/**1040 * Convert into an HTML markup string1041 */1042var toMarkup = function toMarkup(tagName) {1043 var markup = "<" + tagName;1044 // Add the class1045 if (this.classes.length) {1046 markup += " class=\"" + escape(createClass(this.classes)) + "\"";1047 }1048 var styles = cssStyleToString(this.style);1049 if (styles) {1050 markup += " style=\"" + escape(styles) + "\"";1051 }1052 // Add the attributes1053 for (var attr of Object.keys(this.attributes)) {1054 if (invalidAttributeNameRegex.test(attr)) {1055 throw new ParseError("Invalid attribute name '" + attr + "'");1056 }1057 markup += " " + attr + "=\"" + escape(this.attributes[attr]) + "\"";1058 }1059 markup += ">";1060 // Add the markup of the children, also as markup1061 for (var i = 0; i < this.children.length; i++) {1062 markup += this.children[i].toMarkup();1063 }1064 markup += "</" + tagName + ">";1065 return markup;1066};1067/**1068 * This node represents a span node, with a className, a list of children, and1069 * an inline style. It also contains information about its height, depth, and1070 * maxFontSize.1071 *1072 * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan1073 * otherwise. This typesafety is important when HTML builders access a span's1074 * children.1075 */1076class Span {1077 constructor(classes, children, options, style) {1078 this.children = void 0;1079 this.attributes = void 0;1080 this.classes = void 0;1081 this.height = void 0;1082 this.depth = void 0;1083 this.width = void 0;1084 this.maxFontSize = void 0;1085 this.style = void 0;1086 /**1087 * Italic correction carried over from a SymbolNode when the symbol is1088 * wrapped in a vlist (e.g. \oiint / \oiiint). Read by supsub to adjust1089 * subscript positioning. Only set when nonzero; use `?? 0` at read sites.1090 */1091 this.italic = void 0;1092 initNode.call(this, classes, options, style);1093 this.children = children || [];1094 }1095 /**1096 * Sets an arbitrary attribute on the span. Warning: use this wisely. Not1097 * all browsers support attributes the same, and having too many custom1098 * attributes is probably bad.1099 */1100 setAttribute(attribute, value) {1101 this.attributes[attribute] = value;1102 }1103 hasClass(className) {1104 return this.classes.includes(className);1105 }1106 toNode() {1107 return toNode.call(this, "span");1108 }1109 toMarkup() {1110 return toMarkup.call(this, "span");1111 }1112}1113/**1114 * This node represents an anchor (<a>) element with a hyperlink. See `span`1115 * for further details.1116 */1117class Anchor {1118 constructor(href, classes, children, options) {1119 this.children = void 0;1120 this.attributes = void 0;1121 this.classes = void 0;1122 this.height = void 0;1123 this.depth = void 0;1124 this.maxFontSize = void 0;1125 this.style = void 0;1126 initNode.call(this, classes, options);1127 this.children = children || [];1128 this.setAttribute('href', href);1129 }1130 setAttribute(attribute, value) {1131 this.attributes[attribute] = value;1132 }1133 hasClass(className) {1134 return this.classes.includes(className);1135 }1136 toNode() {1137 return toNode.call(this, "a");1138 }1139 toMarkup() {1140 return toMarkup.call(this, "a");1141 }1142}1143/**1144 * This node represents an image embed (<img>) element.1145 */1146class Img {1147 constructor(src, alt, style) {1148 this.src = void 0;1149 this.alt = void 0;1150 this.classes = void 0;1151 this.height = void 0;1152 this.depth = void 0;1153 this.maxFontSize = void 0;1154 this.style = void 0;1155 this.alt = alt;1156 this.src = src;1157 this.classes = ["mord"];1158 this.height = 0;1159 this.depth = 0;1160 this.maxFontSize = 0;1161 this.style = style;1162 }1163 hasClass(className) {1164 return this.classes.includes(className);1165 }1166 toNode() {1167 var node = document.createElement("img");1168 node.src = this.src;1169 node.alt = this.alt;1170 node.className = "mord";1171 // Apply inline styles1172 Object.assign(node.style, this.style);1173 return node;1174 }1175 toMarkup() {1176 var markup = "<img src=\"" + escape(this.src) + "\"" + (" alt=\"" + escape(this.alt) + "\"");1177 var styles = cssStyleToString(this.style);1178 if (styles) {1179 markup += " style=\"" + escape(styles) + "\"";1180 }1181 markup += "'/>";1182 return markup;1183 }1184}1185var iCombinations = {1186 'î': '\u0131\u0302',1187 'ï': '\u0131\u0308',1188 'í': '\u0131\u0301',1189 // 'ī': '\u0131\u0304', // enable when we add Extended Latin1190 'ì': '\u0131\u0300'1191};1192/**1193 * A symbol node contains information about a single symbol. It either renders1194 * to a single text node, or a span with a single text node in it, depending on1195 * whether it has CSS classes, styles, or needs italic correction.1196 */1197class SymbolNode {1198 constructor(text, height, depth, italic, skew, width, classes, style) {1199 this.text = void 0;1200 this.height = void 0;