S2OJ/web/lib/MathJax/input/tex.js

1 line
176 KiB
JavaScript
Raw Normal View History

2022-09-20 02:24:04 +00:00
!function(){"use strict";var t={7306:function(t,e){e.q=void 0,e.q="3.2.2"},7205:function(t,e,r){var n,a=this&&this.__extends||(n=function(t,e){return n=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])},n(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}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},o.apply(this,arguments)},i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,a,o=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(t){a={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TeX=void 0;var l=r(3309),u=r(9077),c=r(2982),f=s(r(199)),d=s(r(8321)),h=s(r(810)),p=s(r(3466)),m=s(r(6394)),g=r(7251),y=r(6552);r(3606);var v=function(t){function e(r){void 0===r&&(r={});var n=this,a=i((0,u.separateOptions)(r,e.OPTIONS,c.FindTeX.OPTIONS),3),o=a[0],s=a[1],l=a[2];(n=t.call(this,s)||this).findTeX=n.options.FindTeX||new c.FindTeX(l);var d=n.options.packages,h=n.configuration=e.configure(d),p=n._parseOptions=new m.default(h,[n.options,g.TagsFactory.OPTIONS]);return(0,u.userOptions)(p.options,o),h.config(n),e.tags(p,h),n.postFilters.add(f.default.cleanSubSup,-6),n.postFilters.add(f.default.setInherited,-5),n.postFilters.add(f.default.moveLimits,-4),n.postFilters.add(f.default.cleanStretchy,-3),n.postFilters.add(f.default.cleanAttributes,-2),n.postFilters.add(f.default.combineRelations,-1),n}return a(e,t),e.configure=function(t){var e=new y.ParserConfiguration(t,["tex"]);return e.init(),e},e.tags=function(t,e){g.TagsFactory.addTags(e.tags),g.TagsFactory.setDefault(t.options.tags),t.tags=g.TagsFactory.getDefault(),t.tags.configuration=t},e.prototype.setMmlFactory=function(e){t.prototype.setMmlFactory.call(this,e),this._parseOptions.nodeFactory.setMmlFactory(e)},Object.defineProperty(e.prototype,"parseOptions",{get:function(){return this._parseOptions},enumerable:!1,configurable:!0}),e.prototype.reset=function(t){void 0===t&&(t=0),this.parseOptions.tags.reset(t)},e.prototype.compile=function(t,e){this.parseOptions.clear(),this.executeFilters(this.preFilters,t,e,this.parseOptions);var r,n,a=t.display;this.latex=t.math,this.parseOptions.tags.startEquation(t);try{var o=new h.default(this.latex,{display:a,isInner:!1},this.parseOptions);r=o.mml(),n=o.stack.global}catch(t){if(!(t instanceof p.default))throw t;this.parseOptions.error=!0,r=this.options.formatError(this,t)}return r=this.parseOptions.nodeFactory.create("node","math",[r]),(null==n?void 0:n.indentalign)&&d.default.setAttribute(r,"indentalign",n.indentalign),a&&d.default.setAttribute(r,"display","block"),this.parseOptions.tags.finishEquation(t),this.parseOptions.root=r,this.executeFilters(this.postFilters,t,e,this.parseOptions),this.mathNode=this.parseOptions.root,this.mathNode},e.prototype.findMath=function(t){return this.findTeX.findMath(t)},e.prototype.formatError=function(t){var e=t.message.replace(/\n.*/,"");return this.parseOptions.nodeFactory.create("error",e,t.id,this.latex)},e.NAME="TeX",e.OPTIONS=o(o({},l.AbstractInputJax.OPTIONS),{FindTeX:null,packages:["base"],digits:/^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/,maxBuffer:5120,formatError:function(t,e){return t.formatError(e)}}),e}(l.AbstractInputJax);e.TeX=v},6552:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.lengt