mediawiki-extensions-Math/modules/mathjax/es5/output/chtml.js

1 line
217 KiB
JavaScript
Raw Normal View History

!function(){"use strict";var t,e,r,o,n,i,a,s,l,c,h,u,p,d,f,m,y,v,b,g,x,M,_,w,j,C,O,S,T,B,L,P,A,H,k,N,D,E,W,R,I,F,J,V,z,U,X,q,K,Q,G,Y,Z,$,tt,et,rt,ot,nt,it,at,st,lt,ct,ht,ut,pt={7306:function(t,e){e.q=void 0,e.q="3.2.2"},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])},o(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},i.apply(this,arguments)},a=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,o,n)}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),s=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&a(e,t,r);return s(e,t),e},c=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 h=r(716),u=r(5888),p=r(4477),d=r(7427),f=r(4142),m=l(r(6914)),y=r(6720),v=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this,e,p.CHTMLWrapperFactory,f.TeXFont)||this;return r.chtmlStyles=null,r.font.adaptiveCSS(r.options.adaptiveCSS),r.wrapperUsage=new d.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 u.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=c(this.wrapperUsage.update()),i=n.next();!i.done;i=n.next()){var a=i.value,s=this.factory.getNodeClass(a);s&&this.addClassStyles(s,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=m.em(75/n)+" 0 "+m.em(20/n)+" 0"),"-explicitFont"!==e){var i=(0,y.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.e