arnaucube
arnaucube/arnaucube.comPublic Self-hosted repository
arnaucube.com/blogo-input/js/katex/contrib/render-a11y-string.js
blogo-input/js/katex/contrib/render-a11y-string.jsRaw
  1(function webpackUniversalModuleDefinition(root, factory) {
  2	if(typeof exports === 'object' && typeof module === 'object')
  3		module.exports = factory(require("katex"));
  4	else if(typeof define === 'function' && define.amd)
  5		define(["katex"], factory);
  6	else {
  7		var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
  8		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
  9	}
 10})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__771__) {
 11return /******/ (function() { // webpackBootstrap
 12/******/ 	"use strict";
 13/******/ 	var __webpack_modules__ = ({
 14
 15/***/ 771:
 16/***/ (function(module) {
 17
 18module.exports = __WEBPACK_EXTERNAL_MODULE__771__;
 19
 20/***/ })
 21
 22/******/ 	});
 23/************************************************************************/
 24/******/ 	// The module cache
 25/******/ 	var __webpack_module_cache__ = {};
 26/******/ 	
 27/******/ 	// The require function
 28/******/ 	function __webpack_require__(moduleId) {
 29/******/ 		// Check if module is in cache
 30/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
 31/******/ 		if (cachedModule !== undefined) {
 32/******/ 			return cachedModule.exports;
 33/******/ 		}
 34/******/ 		// Create a new module (and put it into the cache)
 35/******/ 		var module = __webpack_module_cache__[moduleId] = {
 36/******/ 			// no module.id needed
 37/******/ 			// no module.loaded needed
 38/******/ 			exports: {}
 39/******/ 		};
 40/******/ 	
 41/******/ 		// Execute the module function
 42/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
 43/******/ 	
 44/******/ 		// Return the exports of the module
 45/******/ 		return module.exports;
 46/******/ 	}
 47/******/ 	
 48/************************************************************************/
 49/******/ 	/* webpack/runtime/compat get default export */
 50/******/ 	!function() {
 51/******/ 		// getDefaultExport function for compatibility with non-harmony modules
 52/******/ 		__webpack_require__.n = function(module) {
 53/******/ 			var getter = module && module.__esModule ?
 54/******/ 				function() { return module['default']; } :
 55/******/ 				function() { return module; };
 56/******/ 			__webpack_require__.d(getter, { a: getter });
 57/******/ 			return getter;
 58/******/ 		};
 59/******/ 	}();
 60/******/ 	
 61/******/ 	/* webpack/runtime/define property getters */
 62/******/ 	!function() {
 63/******/ 		// define getter functions for harmony exports
 64/******/ 		__webpack_require__.d = function(exports, definition) {
 65/******/ 			for(var key in definition) {
 66/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
 67/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
 68/******/ 				}
 69/******/ 			}
 70/******/ 		};
 71/******/ 	}();
 72/******/ 	
 73/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
 74/******/ 	!function() {
 75/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
 76/******/ 	}();
 77/******/ 	
 78/************************************************************************/
 79var __webpack_exports__ = {};
 80// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
 81!function() {
 82/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(771);
 83/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
 84/**
 85 * renderA11yString returns a readable string.
 86 *
 87 * In some cases the string will have the proper semantic math
 88 * meaning,:
 89 *   renderA11yString("\\frac{1}{2}"")
 90 *   -> "start fraction, 1, divided by, 2, end fraction"
 91 *
 92 * However, other cases do not:
 93 *   renderA11yString("f(x) = x^2")
 94 *   -> "f, left parenthesis, x, right parenthesis, equals, x, squared"
 95 *
 96 * The commas in the string aim to increase ease of understanding
 97 * when read by a screenreader.
 98 */
 99// NOTE: since we're importing types here these files won't actually be
100// included in the build.
101// $FlowIgnore: we import the types directly anyways
102
103var stringMap = {
104  "(": "left parenthesis",
105  ")": "right parenthesis",
106  "[": "open bracket",
107  "]": "close bracket",
108  "\\{": "left brace",
109  "\\}": "right brace",
110  "\\lvert": "open vertical bar",
111  "\\rvert": "close vertical bar",
112  "|": "vertical bar",
113  "\\uparrow": "up arrow",
114  "\\Uparrow": "up arrow",
115  "\\downarrow": "down arrow",
116  "\\Downarrow": "down arrow",
117  "\\updownarrow": "up down arrow",
118  "\\leftarrow": "left arrow",
119  "\\Leftarrow": "left arrow",
120  "\\rightarrow": "right arrow",
121  "\\Rightarrow": "right arrow",
122  "\\langle": "open angle",
123  "\\rangle": "close angle",
124  "\\lfloor": "open floor",
125  "\\rfloor": "close floor",
126  "\\int": "integral",
127  "\\intop": "integral",
128  "\\lim": "limit",
129  "\\ln": "natural log",
130  "\\log": "log",
131  "\\sin": "sine",
132  "\\cos": "cosine",
133  "\\tan": "tangent",
134  "\\cot": "cotangent",
135  "\\sum": "sum",
136  "/": "slash",
137  ",": "comma",
138  ".": "point",
139  "-": "negative",
140  "+": "plus",
141  "~": "tilde",
142  ":": "colon",
143  "?": "question mark",
144  "'": "apostrophe",
145  "\\%": "percent",
146  " ": "space",
147  "\\ ": "space",
148  "\\$": "dollar sign",
149  "\\angle": "angle",
150  "\\degree": "degree",
151  "\\circ": "circle",
152  "\\vec": "vector",
153  "\\triangle": "triangle",
154  "\\pi": "pi",
155  "\\prime": "prime",
156  "\\infty": "infinity",
157  "\\alpha": "alpha",
158  "\\beta": "beta",
159  "\\gamma": "gamma",
160  "\\omega": "omega",
161  "\\theta": "theta",
162  "\\sigma": "sigma",
163  "\\lambda": "lambda",
164  "\\tau": "tau",
165  "\\Delta": "delta",
166  "\\delta": "delta",
167  "\\mu": "mu",
168  "\\rho": "rho",
169  "\\nabla": "del",
170  "\\ell": "ell",
171  "\\ldots": "dots",
172  // TODO: add entries for all accents
173  "\\hat": "hat",
174  "\\acute": "acute"
175};
176var powerMap = {
177  "prime": "prime",
178  "degree": "degrees",
179  "circle": "degrees",
180  "2": "squared",
181  "3": "cubed"
182};
183var openMap = {
184  "|": "open vertical bar",
185  ".": ""
186};
187var closeMap = {
188  "|": "close vertical bar",
189  ".": ""
190};
191var binMap = {
192  "+": "plus",
193  "-": "minus",
194  "\\pm": "plus minus",
195  "\\cdot": "dot",
196  "*": "times",
197  "/": "divided by",
198  "\\times": "times",
199  "\\div": "divided by",
200  "\\circ": "circle",
201  "\\bullet": "bullet"
202};
203var relMap = {
204  "=": "equals",
205  "\\approx": "approximately equals",
206  "≠": "does not equal",
207  "\\geq": "is greater than or equal to",
208  "\\ge": "is greater than or equal to",
209  "\\leq": "is less than or equal to",
210  "\\le": "is less than or equal to",
211  ">": "is greater than",
212  "<": "is less than",
213  "\\leftarrow": "left arrow",
214  "\\Leftarrow": "left arrow",
215  "\\rightarrow": "right arrow",
216  "\\Rightarrow": "right arrow",
217  ":": "colon"
218};
219var accentUnderMap = {
220  "\\underleftarrow": "left arrow",
221  "\\underrightarrow": "right arrow",
222  "\\underleftrightarrow": "left-right arrow",
223  "\\undergroup": "group",
224  "\\underlinesegment": "line segment",
225  "\\utilde": "tilde"
226};
227
228var buildString = function buildString(str, type, a11yStrings) {
229  if (!str) {
230    return;
231  }
232
233  var ret;
234
235  if (type === "open") {
236    ret = str in openMap ? openMap[str] : stringMap[str] || str;
237  } else if (type === "close") {
238    ret = str in closeMap ? closeMap[str] : stringMap[str] || str;
239  } else if (type === "bin") {
240    ret = binMap[str] || str;
241  } else if (type === "rel") {
242    ret = relMap[str] || str;
243  } else {
244    ret = stringMap[str] || str;
245  } // If the text to add is a number and there is already a string
246  // in the list and the last string is a number then we should
247  // combine them into a single number
248
249
250  if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string
251  // I think we might be able to drop the nested arrays, which would make
252  // this easier to type
253  // $FlowFixMe
254  /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) {
255    a11yStrings[a11yStrings.length - 1] += ret;
256  } else if (ret) {
257    a11yStrings.push(ret);
258  }
259};
260
261var buildRegion = function buildRegion(a11yStrings, callback) {
262  var regionStrings = [];
263  a11yStrings.push(regionStrings);
264  callback(regionStrings);
265};
266
267var handleObject = function handleObject(tree, a11yStrings, atomType) {
268  // Everything else is assumed to be an object...
269  switch (tree.type) {
270    case "accent":
271      {
272        buildRegion(a11yStrings, function (a11yStrings) {
273          buildA11yStrings(tree.base, a11yStrings, atomType);
274          a11yStrings.push("with");
275          buildString(tree.label, "normal", a11yStrings);
276          a11yStrings.push("on top");
277        });
278        break;
279      }
280
281    case "accentUnder":
282      {
283        buildRegion(a11yStrings, function (a11yStrings) {
284          buildA11yStrings(tree.base, a11yStrings, atomType);
285          a11yStrings.push("with");
286          buildString(accentUnderMap[tree.label], "normal", a11yStrings);
287          a11yStrings.push("underneath");
288        });
289        break;
290      }
291
292    case "accent-token":
293      {
294        // Used internally by accent symbols.
295        break;
296      }
297
298    case "atom":
299      {
300        var text = tree.text;
301
302        switch (tree.family) {
303          case "bin":
304            {
305              buildString(text, "bin", a11yStrings);
306              break;
307            }
308
309          case "close":
310            {
311              buildString(text, "close", a11yStrings);
312              break;
313            }
314          // TODO(kevinb): figure out what should be done for inner
315
316          case "inner":
317            {
318              buildString(tree.text, "inner", a11yStrings);
319              break;
320            }
321
322          case "open":
323            {
324              buildString(text, "open", a11yStrings);
325              break;
326            }
327
328          case "punct":
329            {
330              buildString(text, "punct", a11yStrings);
331              break;
332            }
333
334          case "rel":
335            {
336              buildString(text, "rel", a11yStrings);
337              break;
338            }
339
340          default:
341            {
342              tree.family;
343              throw new Error("\"" + tree.family + "\" is not a valid atom type");
344            }
345        }
346
347        break;
348      }
349
350    case "color":
351      {
352        var color = tree.color.replace(/katex-/, "");
353        buildRegion(a11yStrings, function (regionStrings) {
354          regionStrings.push("start color " + color);
355          buildA11yStrings(tree.body, regionStrings, atomType);
356          regionStrings.push("end color " + color);
357        });
358        break;
359      }
360
361    case "color-token":
362      {
363        // Used by \color, \colorbox, and \fcolorbox but not directly rendered.
364        // It's a leaf node and has no children so just break.
365        break;
366      }
367
368    case "delimsizing":
369      {
370        if (tree.delim && tree.delim !== ".") {
371          buildString(tree.delim, "normal", a11yStrings);
372        }
373
374        break;
375      }
376
377    case "genfrac":
378      {
379        buildRegion(a11yStrings, function (regionStrings) {
380          // genfrac can have unbalanced delimiters
381          var leftDelim = tree.leftDelim,
382              rightDelim = tree.rightDelim; // NOTE: Not sure if this is a safe assumption
383          // hasBarLine true -> fraction, false -> binomial
384
385          if (tree.hasBarLine) {
386            regionStrings.push("start fraction");
387            leftDelim && buildString(leftDelim, "open", regionStrings);
388            buildA11yStrings(tree.numer, regionStrings, atomType);
389            regionStrings.push("divided by");
390            buildA11yStrings(tree.denom, regionStrings, atomType);
391            rightDelim && buildString(rightDelim, "close", regionStrings);
392            regionStrings.push("end fraction");
393          } else {
394            regionStrings.push("start binomial");
395            leftDelim && buildString(leftDelim, "open", regionStrings);
396            buildA11yStrings(tree.numer, regionStrings, atomType);
397            regionStrings.push("over");
398            buildA11yStrings(tree.denom, regionStrings, atomType);
399            rightDelim && buildString(rightDelim, "close", regionStrings);
400            regionStrings.push("end binomial");
401          }
402        });
403        break;
404      }
405
406    case "hbox":
407      {
408        buildA11yStrings(tree.body, a11yStrings, atomType);
409        break;
410      }
411
412    case "kern":
413      {
414        // No op: we don't attempt to present kerning information
415        // to the screen reader.
416        break;
417      }
418
419    case "leftright":
420      {
421        buildRegion(a11yStrings, function (regionStrings) {
422          buildString(tree.left, "open", regionStrings);
423          buildA11yStrings(tree.body, regionStrings, atomType);
424          buildString(tree.right, "close", regionStrings);
425        });
426        break;
427      }
428
429    case "leftright-right":
430      {
431        // TODO: double check that this is a no-op
432        break;
433      }
434
435    case "lap":
436      {
437        buildA11yStrings(tree.body, a11yStrings, atomType);
438        break;
439      }
440
441    case "mathord":
442      {
443        buildString(tree.text, "normal", a11yStrings);
444        break;
445      }
446
447    case "op":
448      {
449        var body = tree.body,
450            name = tree.name;
451
452        if (body) {
453          buildA11yStrings(body, a11yStrings, atomType);
454        } else if (name) {
455          buildString(name, "normal", a11yStrings);
456        }
457
458        break;
459      }
460
461    case "op-token":
462      {
463        // Used internally by operator symbols.
464        buildString(tree.text, atomType, a11yStrings);
465        break;
466      }
467
468    case "ordgroup":
469      {
470        buildA11yStrings(tree.body, a11yStrings, atomType);
471        break;
472      }
473
474    case "overline":
475      {
476        buildRegion(a11yStrings, function (a11yStrings) {
477          a11yStrings.push("start overline");
478          buildA11yStrings(tree.body, a11yStrings, atomType);
479          a11yStrings.push("end overline");
480        });
481        break;
482      }
483
484    case "phantom":
485      {
486        a11yStrings.push("empty space");
487        break;
488      }
489
490    case "raisebox":
491      {
492        buildA11yStrings(tree.body, a11yStrings, atomType);
493        break;
494      }
495
496    case "rule":
497      {
498        a11yStrings.push("rectangle");
499        break;
500      }
501
502    case "sizing":
503      {
504        buildA11yStrings(tree.body, a11yStrings, atomType);
505        break;
506      }
507
508    case "spacing":
509      {
510        a11yStrings.push("space");
511        break;
512      }
513
514    case "styling":
515      {
516        // We ignore the styling and just pass through the contents
517        buildA11yStrings(tree.body, a11yStrings, atomType);
518        break;
519      }
520
521    case "sqrt":
522      {
523        buildRegion(a11yStrings, function (regionStrings) {
524          var body = tree.body,
525              index = tree.index;
526
527          if (index) {
528            var indexString = flatten(buildA11yStrings(index, [], atomType)).join(",");
529
530            if (indexString === "3") {
531              regionStrings.push("cube root of");
532              buildA11yStrings(body, regionStrings, atomType);
533              regionStrings.push("end cube root");
534              return;
535            }
536
537            regionStrings.push("root");
538            regionStrings.push("start index");
539            buildA11yStrings(index, regionStrings, atomType);
540            regionStrings.push("end index");
541            return;
542          }
543
544          regionStrings.push("square root of");
545          buildA11yStrings(body, regionStrings, atomType);
546          regionStrings.push("end square root");
547        });
548        break;
549      }
550
551    case "supsub":
552      {
553        var base = tree.base,
554            sub = tree.sub,
555            sup = tree.sup;
556        var isLog = false;
557
558        if (base) {
559          buildA11yStrings(base, a11yStrings, atomType);
560          isLog = base.type === "op" && base.name === "\\log";
561        }
562
563        if (sub) {
564          var regionName = isLog ? "base" : "subscript";
565          buildRegion(a11yStrings, function (regionStrings) {
566            regionStrings.push("start " + regionName);
567            buildA11yStrings(sub, regionStrings, atomType);
568            regionStrings.push("end " + regionName);
569          });
570        }
571
572        if (sup) {
573          buildRegion(a11yStrings, function (regionStrings) {
574            var supString = flatten(buildA11yStrings(sup, [], atomType)).join(",");
575
576            if (supString in powerMap) {
577              regionStrings.push(powerMap[supString]);
578              return;
579            }
580
581            regionStrings.push("start superscript");
582            buildA11yStrings(sup, regionStrings, atomType);
583            regionStrings.push("end superscript");
584          });
585        }
586
587        break;
588      }
589
590    case "text":
591      {
592        // TODO: handle other fonts
593        if (tree.font === "\\textbf") {
594          buildRegion(a11yStrings, function (regionStrings) {
595            regionStrings.push("start bold text");
596            buildA11yStrings(tree.body, regionStrings, atomType);
597            regionStrings.push("end bold text");
598          });
599          break;
600        }
601
602        buildRegion(a11yStrings, function (regionStrings) {
603          regionStrings.push("start text");
604          buildA11yStrings(tree.body, regionStrings, atomType);
605          regionStrings.push("end text");
606        });
607        break;
608      }
609
610    case "textord":
611      {
612        buildString(tree.text, atomType, a11yStrings);
613        break;
614      }
615
616    case "smash":
617      {
618        buildA11yStrings(tree.body, a11yStrings, atomType);
619        break;
620      }
621
622    case "enclose":
623      {
624        // TODO: create a map for these.
625        // TODO: differentiate between a body with a single atom, e.g.
626        // "cancel a" instead of "start cancel, a, end cancel"
627        if (/cancel/.test(tree.label)) {
628          buildRegion(a11yStrings, function (regionStrings) {
629            regionStrings.push("start cancel");
630            buildA11yStrings(tree.body, regionStrings, atomType);
631            regionStrings.push("end cancel");
632          });
633          break;
634        } else if (/box/.test(tree.label)) {
635          buildRegion(a11yStrings, function (regionStrings) {
636            regionStrings.push("start box");
637            buildA11yStrings(tree.body, regionStrings, atomType);
638            regionStrings.push("end box");
639          });
640          break;
641        } else if (/sout/.test(tree.label)) {
642          buildRegion(a11yStrings, function (regionStrings) {
643            regionStrings.push("start strikeout");
644            buildA11yStrings(tree.body, regionStrings, atomType);
645            regionStrings.push("end strikeout");
646          });
647          break;
648        } else if (/phase/.test(tree.label)) {
649          buildRegion(a11yStrings, function (regionStrings) {
650            regionStrings.push("start phase angle");
651            buildA11yStrings(tree.body, regionStrings, atomType);
652            regionStrings.push("end phase angle");
653          });
654          break;
655        }
656
657        throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet");
658      }
659
660    case "vcenter":
661      {
662        buildA11yStrings(tree.body, a11yStrings, atomType);
663        break;
664      }
665
666    case "vphantom":
667      {
668        throw new Error("KaTeX-a11y: vphantom not implemented yet");
669      }
670
671    case "hphantom":
672      {
673        throw new Error("KaTeX-a11y: hphantom not implemented yet");
674      }
675
676    case "operatorname":
677      {
678        buildA11yStrings(tree.body, a11yStrings, atomType);
679        break;
680      }
681
682    case "array":
683      {
684        throw new Error("KaTeX-a11y: array not implemented yet");
685      }
686
687    case "raw":
688      {
689        throw new Error("KaTeX-a11y: raw not implemented yet");
690      }
691
692    case "size":
693      {
694        // Although there are nodes of type "size" in the parse tree, they have
695        // no semantic meaning and should be ignored.
696        break;
697      }
698
699    case "url":
700      {
701        throw new Error("KaTeX-a11y: url not implemented yet");
702      }
703
704    case "tag":
705      {
706        throw new Error("KaTeX-a11y: tag not implemented yet");
707      }
708
709    case "verb":
710      {
711        buildString("start verbatim", "normal", a11yStrings);
712        buildString(tree.body, "normal", a11yStrings);
713        buildString("end verbatim", "normal", a11yStrings);
714        break;
715      }
716
717    case "environment":
718      {
719        throw new Error("KaTeX-a11y: environment not implemented yet");
720      }
721
722    case "horizBrace":
723      {
724        buildString("start " + tree.label.slice(1), "normal", a11yStrings);
725        buildA11yStrings(tree.base, a11yStrings, atomType);
726        buildString("end " + tree.label.slice(1), "normal", a11yStrings);
727        break;
728      }
729
730    case "infix":
731      {
732        // All infix nodes are replace with other nodes.
733        break;
734      }
735
736    case "includegraphics":
737      {
738        throw new Error("KaTeX-a11y: includegraphics not implemented yet");
739      }
740
741    case "font":
742      {
743        // TODO: callout the start/end of specific fonts
744        // TODO: map \BBb{N} to "the naturals" or something like that
745        buildA11yStrings(tree.body, a11yStrings, atomType);
746        break;
747      }
748
749    case "href":
750      {
751        throw new Error("KaTeX-a11y: href not implemented yet");
752      }
753
754    case "cr":
755      {
756        // This is used by environments.
757        throw new Error("KaTeX-a11y: cr not implemented yet");
758      }
759
760    case "underline":
761      {
762        buildRegion(a11yStrings, function (a11yStrings) {
763          a11yStrings.push("start underline");
764          buildA11yStrings(tree.body, a11yStrings, atomType);
765          a11yStrings.push("end underline");
766        });
767        break;
768      }
769
770    case "xArrow":
771      {
772        throw new Error("KaTeX-a11y: xArrow not implemented yet");
773      }
774
775    case "cdlabel":
776      {
777        throw new Error("KaTeX-a11y: cdlabel not implemented yet");
778      }
779
780    case "cdlabelparent":
781      {
782        throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");
783      }
784
785    case "mclass":
786      {
787        // \neq and \ne are macros so we let "htmlmathml" render the mathmal
788        // side of things and extract the text from that.
789        var _atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass
790
791
792        buildA11yStrings(tree.body, a11yStrings, _atomType);
793        break;
794      }
795
796    case "mathchoice":
797      {
798        // TODO: track which which style we're using, e.g. dispaly, text, etc.
799        // default to text style if even that may not be the correct style
800        buildA11yStrings(tree.text, a11yStrings, atomType);
801        break;
802      }
803
804    case "htmlmathml":
805      {
806        buildA11yStrings(tree.mathml, a11yStrings, atomType);
807        break;
808      }
809
810    case "middle":
811      {
812        buildString(tree.delim, atomType, a11yStrings);
813        break;
814      }
815
816    case "internal":
817      {
818        // internal nodes are never included in the parse tree
819        break;
820      }
821
822    case "html":
823      {
824        buildA11yStrings(tree.body, a11yStrings, atomType);
825        break;
826      }
827
828    default:
829      tree.type;
830      throw new Error("KaTeX a11y un-recognized type: " + tree.type);
831  }
832};
833
834var buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) {
835  if (a11yStrings === void 0) {
836    a11yStrings = [];
837  }
838
839  if (tree instanceof Array) {
840    for (var i = 0; i < tree.length; i++) {
841      buildA11yStrings(tree[i], a11yStrings, atomType);
842    }
843  } else {
844    handleObject(tree, a11yStrings, atomType);
845  }
846
847  return a11yStrings;
848};
849
850var flatten = function flatten(array) {
851  var result = [];
852  array.forEach(function (item) {
853    if (item instanceof Array) {
854      result = result.concat(flatten(item));
855    } else {
856      result.push(item);
857    }
858  });
859  return result;
860};
861
862var renderA11yString = function renderA11yString(text, settings) {
863  var tree = katex__WEBPACK_IMPORTED_MODULE_0___default().__parse(text, settings);
864
865  var a11yStrings = buildA11yStrings(tree, [], "normal");
866  return flatten(a11yStrings).join(", ");
867};
868
869/* harmony default export */ __webpack_exports__["default"] = (renderA11yString);
870}();
871__webpack_exports__ = __webpack_exports__["default"];
872/******/ 	return __webpack_exports__;
873/******/ })()
874;
875});