hugo-theme-relearn/js/mathjax/output/chtml.js

1 line
208 KiB
JavaScript
Raw Normal View History

!function(){"use strict";var t,e,r,o,n,i,a,s,l,h,c,u,p,d,f,m,y,v,b,x,g,M,_,w,C,j,S,O,T,L,B,P,H,A,k,N,E,D,W,R,I,F,J,V,z,U,X,K,q,Q,G,Y,Z,$,tt,et,rt,ot,nt,it,at,st,lt,ht,ct,ut={7016:function(t,e,r){var o,n=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],o=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTML=void 0;var s=r(716),l=r(5888),h=r(4477),c=r(7427),u=r(4142),p=r(6914),d=r(6720),f=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this,e,h.CHTMLWrapperFactory,u.TeXFont)||this;return r.chtmlStyles=null,r.font.adaptiveCSS(r.options.adaptiveCSS),r.wrapperUsage=new c.Usage,r}return n(e,t),e.prototype.escaped=function(t,e){return this.setDocument(e),this.html("span",{},[this.text(t.math)])},e.prototype.styleSheet=function(r){if(this.chtmlStyles){if(this.options.adaptiveCSS){var o=new l.CssStyles;this.addWrapperStyles(o),this.updateFontStyles(o),this.adaptor.insertRules(this.chtmlStyles,o.getStyleRules())}return this.chtmlStyles}var n=this.chtmlStyles=t.prototype.styleSheet.call(this,r);return this.adaptor.setAttribute(n,"id",e.STYLESHEETID),this.wrapperUsage.update(),n},e.prototype.updateFontStyles=function(t){t.addStyles(this.font.updateStyles({}))},e.prototype.addWrapperStyles=function(e){var r,o;if(this.options.adaptiveCSS)try{for(var n=a(this.wrapperUsage.update()),i=n.next();!i.done;i=n.next()){var s=i.value,l=this.factory.getNodeClass(s);l&&this.addClassStyles(l,e)}}catch(t){r={error:t}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(r)throw r.error}}else t.prototype.addWrapperStyles.call(this,e)},e.prototype.addClassStyles=function(e,r){var o,n=e;n.autoStyle&&"unknown"!==n.kind&&r.addStyles(((o={})["mjx-"+n.kind]={display:"inline-block","text-align":"left"},o)),this.wrapperUsage.add(n.kind),t.prototype.addClassStyles.call(this,e,r)},e.prototype.processMath=function(t,e){this.factory.wrap(t).toCHTML(e)},e.prototype.clearCache=function(){this.cssStyles.clear(),this.font.clearCache(),this.wrapperUsage.clear(),this.chtmlStyles=null},e.prototype.reset=function(){this.clearCache()},e.prototype.unknownText=function(t,e,r){void 0===r&&(r=null);var o={},n=100/this.math.metrics.scale;if(100!==n&&(o["font-size"]=this.fixed(n,1)+"%",o.padding=p.em(75/n)+" 0 "+p.em(20/n)+" 0"),"-explicitFont"!==e){var i=d.unicodeChars(t);(1!==i.length||i[0]<119808||i[0]>120831)&&this.cssFontStyles(this.font.getCssFont(e),o)}if(null!==r){var a=this.math.metrics;o.width=Math.round(r*a.em*a.scale)+"px"}return this.html("mjx-utext",{variant:e,style:o},[this.text(t)])},e.prototype.measureTextNode=function(t){var e=this.adaptor,r=e.clone(t);e.setStyle(r,"font-family",e.getStyle(r,"font-family").replace(/MJXZERO, /g,""));var o=this.html("mjx-measure-text",{style:{position:"absolute","white-space":"nowrap"}},[r]);e.append(e.parent(this.math.start.node),this.container),e.append(this.container,o);var n=e.nodeSize(r,this.math.metrics.em)[0]/this.math.metrics.scale;return e.remove(this.container),e.remove(o),{w:n,h:.75,d:.2}},e.NAME="CHTML",e.OPTIONS=i(i({},s.CommonOutputJax.OPTIONS),{adaptiveCSS:!0,matchFontHeight:!0}),e.commonStyles={'mjx-container[jax="CHTML"]':{"line-height":0}