1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-15 22:34:51 +00:00
TiddlyWiki5/plugins/tiddlywiki/katex/files/katex.min.js

1 line
229 KiB
JavaScript
Raw Normal View History

2018-02-20 21:24:11 +00:00
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.katex=t():e.katex=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=63)}([function(e,t,r){"use strict";var n=r(57),a=r.n(n),i=r(18),o=r.n(i),s=r(12),l=r(30),u=r(28),c=r(5),h=r(13),p=r(19),m=["\\imath","\u0131","\\jmath","\u0237","\\pounds","\\mathsterling","\\textsterling","\xa3"],d=function(e,t,r){return u.a[r][e]&&u.a[r][e].replace&&(e=u.a[r][e].replace),{value:e,metrics:l.a.getCharacterMetrics(e,t,r)}},f=function(e,t,r,n,a){var i=d(e,t,r),o=i.metrics;e=i.value;var l=void 0;if(o){var u=o.italic;"text"===r&&(u=0),l=new s.a.symbolNode(e,o.height,o.depth,u,o.skew,o.width,a)}else"undefined"!=typeof console&&console.warn("No character metrics for '"+e+"' in style '"+t+"'"),l=new s.a.symbolNode(e,0,0,0,0,0,a);if(n){l.maxFontSize=n.sizeMultiplier,n.style.isTight()&&l.classes.push("mtight");var c=n.getColor();c&&(l.style.color=c)}return l},v=function(e,t,r,n,a){if("mathord"===a){var i=g(e,t,r,n);return f(e,i.fontName,t,r,n.concat([i.fontClass]))}if("textord"===a){if("ams"===(u.a[t][e]&&u.a[t][e].font)){var o=x("amsrm",r.fontWeight,r.fontShape);return f(e,o,t,r,n.concat("amsrm",r.fontWeight,r.fontShape))}var s=x("textrm",r.fontWeight,r.fontShape);return f(e,s,t,r,n.concat(r.fontWeight,r.fontShape))}throw new Error("unexpected type: "+a+" in mathDefault")},g=function(e,t,r,n){return/[0-9]/.test(e.charAt(0))||c.a.contains(m,e)?{fontName:"Main-Italic",fontClass:"mainit"}:{fontName:"Math-Italic",fontClass:"mathit"}},y=function(e){var t=0,r=0,n=0,a=!0,i=!1,s=void 0;try{for(var l,u=o()(e.children);!(a=(l=u.next()).done);a=!0){var c=l.value;c.height>t&&(t=c.height),c.depth>r&&(r=c.depth),c.maxFontSize>n&&(n=c.maxFontSize)}}catch(e){i=!0,s=e}finally{try{!a&&u.return&&u.return()}finally{if(i)throw s}}e.height=t,e.depth=r,e.maxFontSize=n},b=function(e,t,r,n){var a=new s.a.span(e,t,r,n);return y(a),a},x=function(e,t,r){return w(e)+"-"+k(t,r)},w=function(e){var t="";switch(e){case"amsrm":t="AMS";break;case"textrm":t="Main";break;case"textsf":t="SansSerif";break;case"texttt":t="Typewriter";break;default:throw new Error("Invalid font provided: "+e)}return t},k=function(e,t){var r="";return"textbf"===e&&(r+="Bold"),"textit"===t&&(r+="Italic"),r||"Regular"},M={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},S={vec:["vec",.471,.714]};t.a={fontMap:M,makeSymbol:f,mathsym:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return r&&r.fontFamily&&"boldsymbol"===r.fontFamily&&d(e,"Main-Bold",t).metrics?f(e,"Main-Bold",t,r,n.concat(["mathbf"])):"\\"===e||"main"===u.a[t][e].font?f(e,"Main-Regular",t,r,n):f(e,"AMS-Regular",t,r,n.concat(["amsrm"]))},makeSpan:b,makeLineSpan:function(e,t){var r=t.fontMetrics().defaultRuleThickness,n=h.a.ruleSpan(e,r,t);return n.height=r,n.style.height=5*n.height+"em",n.maxFontSize=1,n},makeAnchor:function(e,t,r,n){var a=new s.a.anchor(e,t,r,n);return y(a),a},makeFragment:function(e){var t=new s.a.documentFragment(e);return y(t),t},makeVList:function(e,t){var r=function(e){if("individualShift"===e.positionType){for(var t=e.children,r=[t[0]],n=-t[0].shift-t[0].elem.dep