UNPKG

mathjax

Version:

Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers. This package includes the packaged components (install mathjax-full to get the source

1 lines 20.5 kB
(()=>{"use strict";var e={d:(t,s)=>{for(var a in s)e.o(s,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:s[a]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};e.r(t),e.d(t,{InPlace:()=>E,SemAttr:()=>M,buildLabel:()=>x,buildSpeech:()=>L,honk:()=>O,ssmlParsing:()=>y});var s={};e.r(s),e.d(s,{GeneratorPool:()=>j});var a={};e.r(a),e.d(a,{WorkerHandler:()=>R});var i={};e.r(i),e.d(i,{SpeechHandler:()=>H,SpeechMathDocumentMixin:()=>D,SpeechMathItemMixin:()=>I});const o=("undefined"!=typeof window?window:e.g).MathJax._.components.global,n=(o.GLOBAL,o.isObject,o.combineConfig,o.combineDefaults),r=o.combineWithMathJax,c=o.MathJax,h=MathJax._.a11y["semantic-enrich"],d=(h.enrichVisitor,h.EnrichedMathItemMixin,h.EnrichedMathDocumentMixin,h.EnrichHandler),l=MathJax._.core.MathItem,p=(l.protoItem,l.AbstractMathItem,l.STATE),u=l.newState,m=MathJax._.util.Options,f=(m.isObject,m.APPEND,m.REMOVE,m.OPTIONS,m.Expandable,m.expandable),b=(m.makeArray,m.keys,m.copy,m.insert,m.defaultOptions,m.userOptions,m.selectOptions,m.selectOptionsFromKeys,m.separateOptions,m.lookup,MathJax._.a11y.sre_ts),g=(b.locales,b.setupEngine,b.engineSetup,b.toEnriched,b.parseDOM),v=(b.addPreference,b.fromPreference,b.toPreference,["pitch","rate","volume"]);function y(e){const t=g(e),s=[],a=[];return w(Array.from(t.childNodes),s,a),[a.join(" "),s]}function w(e,t,s,a={}){for(const i of e)if(3!==i.nodeType){if(1===i.nodeType){const e=i,o=e.tagName;if("speak"===o)continue;if("prosody"===o){w(Array.from(i.childNodes),t,s,k(e,a));continue}switch(o){case"break":t.push({pause:e.getAttribute("time")});break;case"mark":t.push({mark:e.getAttribute("name")});break;case"say-as":{const i=e.textContent;t.push(Object.assign({text:i,character:!0},a)),s.push(i);break}}}}else{const e=i.textContent.trim();e&&(s.push(e),t.push(Object.assign({text:e},a)))}}const S={pitch:(e,t)=>e/100*1,volume:(e,t)=>e/100*.5,rate:(e,t)=>e/100*1};function k(e,t){const s={};for(const a of v)if(e.hasAttribute(a)){const[i,o]=A(e.getAttribute(a));if(!i){s[a]="volume"===a?.5:1;continue}let n=t[a];n=n||("volume"===a?.5:1);const r=S[a](parseInt(o,10),i);s[a]="-"===i?n-r:n+r}return s}const P=/([+-]?)([0-9]+)%/;function A(e){const t=e.match(P);return t?[t[1],t[2]]:(console.warn("Something went wrong with the prosody matching."),["","100"])}function x(e,t,s,a=" "){if(!e)return"";const i=[e];return t&&i.unshift(t),s&&i.push(s),i.join(a)}function L(e,t="en",s="100"){return y(`<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="${t}"><prosody rate="${s}%">${e}</prosody></speak>`)}function O(){const e=new AudioContext,t=e.createOscillator();t.frequency.value=300,t.connect(e.destination),t.start(e.currentTime),t.stop(e.currentTime+.05)}var E,M;!function(e){e[e.NONE=0]="NONE",e[e.DEPTH=1]="DEPTH",e[e.SUMMARY=2]="SUMMARY"}(E||(E={})),function(e){e.SPEECH="data-semantic-speech-none",e.SPEECH_SSML="data-semantic-speech",e.SUMMARY="data-semantic-summary-none",e.SUMMARY_SSML="data-semantic-summary",e.PREFIX="data-semantic-prefix-none",e.PREFIX_SSML="data-semantic-prefix",e.POSTFIX="data-semantic-postfix-none",e.POSTFIX_SSML="data-semantic-postfix",e.BRAILLE="data-semantic-braille"}(M||(M={}));class j{constructor(){this.promise=Promise.resolve(),this.adaptor=null,this._options={},this._init=!1}set element(e){this._element=e}get element(){return this._element}set options(e){this._options=Object.assign({},(null==e?void 0:e.sre)||{},{enableSpeech:e.enableSpeech,enableBraille:e.enableBraille}),delete this._options.custom}get options(){return this._options}init(e,t,s){this.options=e,this._init||(this.adaptor=t,this.webworker=s,this._init=!0)}update(e){Object.assign(this.options,e)}Speech(e){const t=e.outputData.mml,s=Object.assign({},this.options,{modality:"speech"});return this.promise=this.webworker.Speech(t,s,e)}SpeechFor(e,t){const s=Object.assign({},this.options,{modality:"speech"});return this.webworker.speechFor(t,s,e)}cancel(e){var t;null===(t=this.webworker)||void 0===t||t.Cancel(e)}updateRegions(e,t,s){t.Update(this.getLabel(e)),s.Update(this.getBraille(e))}getOptions(e){var t,s,a,i;return{locale:null!==(t=this.adaptor.getAttribute(e,"data-semantic-locale"))&&void 0!==t?t:"",domain:null!==(s=this.adaptor.getAttribute(e,"data-semantic-domain"))&&void 0!==s?s:"",style:null!==(a=this.adaptor.getAttribute(e,"data-semantic-style"))&&void 0!==a?a:"",domain2style:null!==(i=this.adaptor.getAttribute(e,"data-semantic-domain2style"))&&void 0!==i?i:""}}nextRules(e){const t=this.getOptions(e.typesetRoot);return this.update(t),this.promise=this.webworker.nextRules(e.outputData.mml,Object.assign({},this.options,{modality:"speech"}),e)}nextStyle(e,t){const s=this.getOptions(t.typesetRoot);return this.update(s),this.promise=this.webworker.nextStyle(t.outputData.mml,Object.assign({},this.options,{modality:"speech"}),this.adaptor.getAttribute(e,"data-semantic-id"),t)}getLabel(e,t="",s=" "){const a=this.adaptor;return x(a.getAttribute(e,M.SPEECH_SSML),a.getAttribute(e,M.PREFIX_SSML),a.getAttribute(e,M.POSTFIX_SSML),s)||a.getAttribute(e,"aria-label")}getBraille(e){const t=this.adaptor;return t.getAttribute(e,"aria-braillelabel")||t.getAttribute(e,M.BRAILLE)}getLocalePreferences(e){return this.promise=this.webworker.clearspeakLocalePreferences(this.options,e)}getRelevantPreferences(e,t,s,a){const i=e.outputData.mml;return this.promise=this.webworker.clearspeakRelevantPreferences(i,t,s,a)}}var C=function(e,t,s,a){return new(s||(s=Promise))((function(i,o){function n(e){try{c(a.next(e))}catch(e){o(e)}}function r(e){try{c(a.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,r)}c((a=a.apply(e,t||[])).next())}))};class T{constructor(e,t,s,a){this.cmd=e,this.item=t,this.resolve=s,this.reject=a}}class R{constructor(e,t){this.adaptor=e,this.options=t,this.ready=!1,this.tasks=[],this.Commands={Ready(e,t){e.ready=!0,e.postNext()},Finished(e,t){const s=e.tasks.shift();t.success?s.resolve(t.result):s.reject(t.error),e.postNext()},Log(e,t){e.options.debug&&console.log("Log:",t)}}}Start(){return C(this,void 0,void 0,(function*(){if(this.ready)throw Error("Worker already started");this.worker=yield this.adaptor.createWorker(this.Listener.bind(this),this.options)}))}debug(e,...t){this.options.debug&&console.info(e,...t)}Listener(e){this.debug("Worker >>> Client:",e.data),Object.hasOwn(this.Commands,e.data.cmd)?this.Commands[e.data.cmd](this,e.data.data):this.debug("Invalid command from worker: "+e.data.cmd)}Post(e,t){const s=new Promise(((s,a)=>{this.tasks.push(new T(e,t,s,a))}));return this.ready&&1===this.tasks.length&&this.postNext(),s}postNext(){if(this.tasks.length){const e=Object.assign({},this.tasks[0].cmd,{debug:this.options.debug});this.worker.postMessage(e)}}Cancel(e){const t=this.tasks.findIndex((t=>t.item===e));t>0&&(this.tasks[t].reject(`Task ${this.tasks[t].cmd.cmd} cancelled`),this.tasks.splice(t,1))}Setup(e){return this.Post({cmd:"setup",data:{domain:e.domain,style:e.style,locale:e.locale,modality:e.modality}})}Speech(e,t,s){return C(this,void 0,void 0,(function*(){this.Attach(s,t.enableSpeech,t.enableBraille,yield this.Post({cmd:"speech",data:{mml:e,options:t}},s))}))}nextRules(e,t,s){return C(this,void 0,void 0,(function*(){this.Attach(s,t.enableSpeech,t.enableBraille,yield this.Post({cmd:"nextRules",data:{mml:e,options:t}},s))}))}nextStyle(e,t,s,a){return C(this,void 0,void 0,(function*(){this.Attach(a,t.enableSpeech,t.enableBraille,yield this.Post({cmd:"nextStyle",data:{mml:e,options:t,nodeId:s}},a))}))}speechFor(e,t,s){return C(this,void 0,void 0,(function*(){const a=yield this.Post({cmd:"speech",data:{mml:e,options:t}},s);return JSON.parse(a)}))}Attach(e,t,s,a){const i=JSON.parse(a),o=e.typesetRoot;if(!o)return;this.setSpecialAttributes(o,i.options,"data-semantic-",["locale","domain","style","domain2style"]);const n=this.adaptor;this.setSpecialAttributes(o,i.translations,"data-semantic-");for(const[e,t]of Object.entries(i.mactions)){let s=n.getElement("#"+e,o);s&&n.childNodes(s)[0]&&(s=n.childNodes(s)[0],"rect"===n.kind(s)&&(s=n.next(s)),n.setAttribute(s,"data-semantic-type","dummy"),this.setSpecialAttributes(s,t,""))}this.setSpeechAttributes(n.childNodes(o)[0],"",i,t,s),t&&(i.label&&(n.setAttribute(o,M.SPEECH,i.label),n.setAttribute(o,M.SPEECH_SSML,i.ssml),e.outputData.speech=i.label),n.setAttribute(o,"data-speech-attached","true")),s&&(i.braillelabel&&(n.setAttribute(o,M.BRAILLE,i.braillelabel),e.outputData.braille=i.braillelabel),i.braille&&n.setAttribute(o,"data-braille-attached","true"))}setSpeechAttribute(e,t,s,a){var i,o;const n=this.adaptor,r=n.getAttribute(e,"data-semantic-id");if(n.removeAttribute(e,"data-speech-node"),s&&t.speech[r]["speech-none"]){n.setAttribute(e,"data-speech-node","true");for(let[s,a]of Object.entries(t.speech[r]))s=s.replace(/-ssml$/,""),a&&n.setAttribute(e,`data-semantic-${s}`,a)}if(a&&(null===(o=null===(i=t.braille)||void 0===i?void 0:i[r])||void 0===o?void 0:o["braille-none"])){n.setAttribute(e,"data-speech-node","true");const s=t.braille[r]["braille-none"];n.setAttribute(e,M.BRAILLE,s)}}setSpeechAttributes(e,t,s,a,i){const o=this.adaptor;if(!e||"#text"===o.kind(e)||"#comment"===o.kind(e))return t;o.hasAttribute(e,"data-semantic-id")&&(this.setSpeechAttribute(e,s,a,i),t||o.hasAttribute(e,"data-semantic-parent")||(t=o.getAttribute(e,"data-semantic-id")));for(const n of Array.from(o.childNodes(e)))t=this.setSpeechAttributes(n,t,s,a,i);return t}setSpecialAttributes(e,t,s,a){if(t){a=a||Object.keys(t);for(const i of a){const a=t[i];a&&this.adaptor.setAttribute(e,`${s}${i.toLowerCase()}`,a)}}}Detach(e){const t=e.typesetRoot;this.adaptor.removeAttribute(t,"data-speech-attached"),this.adaptor.removeAttribute(t,"data-braille-attached"),this.detachSpeech(t)}detachSpeech(e){const t=this.adaptor,s=t.childNodes(e);if(s){if("#text"!==t.kind(e))for(const s of["none","summary-none","speech","speech-none","summary","braille"])t.removeAttribute(e,`data-semantic-${s}`);for(const e of s)this.detachSpeech(e)}}Terminate(){this.debug("Terminating pending tasks");for(const e of this.tasks)e.reject(`${e.cmd.data.cmd} cancelled by WorkerHandler termination`);return this.tasks=[],this.debug("Terminating worker"),this.worker.terminate()}Stop(){return C(this,void 0,void 0,(function*(){if(!this.worker)throw Error("Worker has not been started");yield this.Terminate(),this.worker=null,this.ready=!1}))}clearspeakLocalePreferences(e,t){return C(this,void 0,void 0,(function*(){yield this.Post({cmd:"localePreferences",data:{options:e}}).then((s=>{t.set(e.locale,JSON.parse(s))}))}))}clearspeakRelevantPreferences(e,t,s,a){return C(this,void 0,void 0,(function*(){yield this.Post({cmd:"relevantPreferences",data:{mml:e,id:t}}).then((e=>{s.set(a,e)}))}))}}const _=c.config||{},F=()=>(_?.loader?.paths?.mathjax||_?.__dirname||"/")+"/sre";var N=function(e,t,s,a){return new(s||(s=Promise))((function(i,o){function n(e){try{c(a.next(e))}catch(e){o(e)}}function r(e){try{c(a.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,r)}c((a=a.apply(e,t||[])).next())}))};function I(e){return class extends e{constructor(){super(...arguments),this.generatorPool=new j}attachSpeech(e){if(this.outputData.speechPromise=null,this.state()>=p.ATTACHSPEECH)return;if(this.state(p.ATTACHSPEECH),this.isEscaped||!e.options.enableSpeech&&!e.options.enableBraille||!e.options.enableEnrichment)return;e.getWebworker(),this.generatorPool.init(e.options,e.adaptor,e.webworker),this.outputData.mml=this.toMathML(this.root,this);const t=this.generatorPool.Speech(this).catch((t=>e.options.speechError(e,this,t)));e.savePromise(t),this.outputData.speechPromise=t}detachSpeech(e){e.webworker.Detach(this)}speechFor(e){return N(this,void 0,void 0,(function*(){e=this.toEnriched(e);const t=yield this.generatorPool.SpeechFor(this,e);return[t.label,t.braillelabel]}))}clear(){this.generatorPool.cancel(this)}}}function D(e){var t;return(t=class extends e{constructor(...e){super(...e),this.webworker=null;const t=this.constructor.ProcessBits;t.has("attach-speech")||t.allocate("attach-speech"),this.options.MathItem=I(this.options.MathItem)}getWebworker(){this.webworker||(this.webworker=new R(this.adaptor,this.options.worker),this.webworker.Start())}attachSpeech(){if(!this.processed.isSet("attach-speech")){const e=this.options;if(e.enableEnrichment&&(e.enableSpeech||e.enableBraille)){this.getWebworker();for(const e of this.math)e.attachSpeech(this)}this.processed.set("attach-speech")}return this}speechError(e,t,s){console.warn("Speech generation error:",s)}state(e,t=!1){if(super.state(e,t),e<p.ATTACHSPEECH&&(this.processed.clear("attach-speech"),e>=p.TYPESET))for(const e of this.math)e.detachSpeech(this);return this}done(){const e=Object.create(null,{done:{get:()=>super.done}});return N(this,void 0,void 0,(function*(){var t;return yield null===(t=this.webworker)||void 0===t?void 0:t.Stop(),e.done.call(this)}))}}).OPTIONS=Object.assign(Object.assign({},e.OPTIONS),{enableSpeech:!0,enableBraille:!0,speechError:(e,t,s)=>e.speechError(e,t,s),renderActions:f(Object.assign(Object.assign({},e.OPTIONS.renderActions),{attachSpeech:[p.ATTACHSPEECH]})),worker:{path:F(),maps:F().replace(/[cm]js\/a11y\/sre$/,"bundle/sre/mathmaps"),worker:"speech-worker.js",debug:!1},a11y:f({speech:!0,braille:!0})}),t}function H(e,t){return!e.documentClass.prototype.enrich&&t&&(e=d(e,t)),e.documentClass=D(e.documentClass),e}u("ATTACHSPEECH",p.INSERTED+10),MathJax.loader&&MathJax.loader.checkVersion("a11y/speech","4.1.0","a11y"),r({_:{a11y:{speech_ts:i,speech:{GeneratorPool:s,SpeechUtil:t,WebWorker:a}}}});const $=MathJax._.util.FunctionList.FunctionList,J=c.config||{},B=MathJax._.util.context,W=(B.hasWindow,B.context);var q=function(e,t,s,a){return new(s||(s=Promise))((function(i,o){function n(e){try{c(a.next(e))}catch(e){o(e)}}function r(e){try{c(a.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(n,r)}c((a=a.apply(e,t||[])).next())}))};const U=e=>(Object.hasOwn(Q.source,e.name)&&(e.name=Q.source[e.name]),!0),V=e=>{const t=e.name;return t.match(/^(?:[a-z]+:\/)?\/|[a-z]:[/\\]|\[/i)||(e.name="[mathjax]/"+t.replace(/^\.\//,"")),!0},X=e=>{let t;for(;(t=e.name.match(/^\[([^\]]*)\]/))&&Object.hasOwn(Q.paths,t[1]);)e.name=Q.paths[t[1]]+e.name.substring(t[0].length);return!0},Y=e=>(e.addExtension&&!e.name.match(/\.[^/]+$/)&&(e.name+=".js"),!0),G=c.version,z={versions:new Map,nestedLoads:[],ready(...e){0===e.length&&(e=Array.from(ee.packages.keys()));const t=[];for(const s of e){const e=ee.packages.get(s)||new ee(s,!0);t.push(e.promise)}return Promise.all(t)},load(...e){if(0===e.length)return Promise.resolve([]);let t=[];this.nestedLoads.unshift(t);const s=Promise.resolve().then((()=>q(this,void 0,void 0,(function*(){const s=[];for(const t of e){let e=ee.packages.get(t);e||(e=new ee(t),e.provides(Q.provides[t])),e.checkNoLoad(),s.push(e.promise.then((()=>(Q.versionWarnings&&e.isLoaded&&!z.versions.has(ee.resolvePath(t))&&console.warn(`No version information available for component ${t}`),e.result))))}ee.loadAll();const a=yield Promise.all(s);for(;t.length;){const e=Promise.all(t);t=this.nestedLoads[this.nestedLoads.indexOf(t)]=[],yield e}return this.nestedLoads.splice(this.nestedLoads.indexOf(t),1),a}))));return this.nestedLoads.slice(1).forEach((e=>e.push(s))),s},preLoaded(...e){for(const t of e){let e=ee.packages.get(t);e||(e=new ee(t,!0),e.provides(Q.provides[t])),e.loaded()}},addPackageData(e,t){let s=Q[e];s||(s=Q[e]={});for(const[e,a]of Object.entries(t))if(Array.isArray(a)){s[e]||(s[e]=[]);const t=new Set([...s[e],...a]);s[e]=[...t]}else s[e]=a},defaultReady(){void 0!==K.startup&&K.config.startup.ready()},getRoot(){if(W.document){const e=W.document.currentScript||W.document.getElementById("MathJax-script");if(e&&e instanceof HTMLScriptElement)return e.src.replace(/\/[^/]*$/,"")}return J?.loader?.paths?.mathjax||J?.__dirname||"/"},checkVersion(e,t,s){return this.saveVersion(e),!(!Q.versionWarnings||t===G)&&(console.warn(`Component ${e} uses ${t} of MathJax; version in use is ${G}`),!0)},saveVersion(e){z.versions.set(ee.resolvePath(e),G)},pathFilters:new $};z.pathFilters.add(U,0),z.pathFilters.add(V,10),z.pathFilters.add(X,20),z.pathFilters.add(Y,30);const K=c;if(void 0===K.loader){n(K.config,"loader",{paths:{mathjax:z.getRoot(),fonts:W.window?"https://cdn.jsdelivr.net/npm/@mathjax":"@mathjax"},source:{},dependencies:{},provides:{},load:[],ready:z.defaultReady.bind(z),failed:e=>console.log(`MathJax(${e.package||"?"}): ${e.message}`),require:null,pathFilters:[],versionWarnings:!0}),r({loader:z});for(const e of K.config.loader.pathFilters)Array.isArray(e)?z.pathFilters.add(e[0],e[1]):z.pathFilters.add(e)}const Q=K.config.loader;class Z extends Error{constructor(e,t){super(e),this.package=t}}class ee{get canLoad(){return 0===this.dependencyCount&&!this.noLoad&&!this.isLoading&&!this.hasFailed}static loadPromise(e){const t=Q[e]||{},s=t.extraLoads?z.load(...t.extraLoads):Promise.resolve(),a=t.checkReady||(()=>Promise.resolve());return s.then((()=>a()))}static resolvePath(e,t=!0){const s={name:e,original:e,addExtension:t};return z.pathFilters.execute(s),s.name}static loadAll(){for(const e of this.packages.values())e.canLoad&&e.load()}constructor(e,t=!1){this.isLoaded=!1,this.result={},this.isLoading=!1,this.hasFailed=!1,this.dependents=[],this.dependencies=[],this.dependencyCount=0,this.provided=[],this.name=e,this.noLoad=t,ee.packages.set(e,this),this.promise=this.makePromise(this.makeDependencies())}makeDependencies(){const e=[],t=ee.packages,s=this.noLoad,a=this.name,i=[];Object.hasOwn(Q.dependencies,a)?i.push(...Q.dependencies[a]):"core"!==a&&i.push("core");for(const a of i){const i=t.get(a)||new ee(a,s);this.dependencies.includes(i)||(i.addDependent(this,s),this.dependencies.push(i),i.isLoaded||(this.dependencyCount++,e.push(i.promise)))}return e}makePromise(e){let t=new Promise(((e,t)=>{this.resolve=e,this.reject=t}));const s=Q[this.name]||{};return s.ready&&(t=t.then((e=>s.ready(this.name)))),e.length&&(e.push(t),t=Promise.all(e).then((e=>e.join(", ")))),s.failed&&t.catch((e=>s.failed(new Z(e,this.name)))),t}load(){if(!this.isLoaded&&!this.isLoading&&!this.noLoad){this.isLoading=!0;const e=ee.resolvePath(this.name);Q.require?this.loadCustom(e):this.loadScript(e)}}loadCustom(e){try{const t=Q.require(e);t instanceof Promise?t.then((e=>this.result=e)).then((()=>this.checkLoad())).catch((t=>this.failed("Can't load \""+e+'"\n'+t.message.trim()))):(this.result=t,this.checkLoad())}catch(e){this.failed(e.message)}}loadScript(e){const t=W.document.createElement("script");t.src=e,t.charset="UTF-8",t.onload=e=>this.checkLoad(),t.onerror=t=>this.failed("Can't load \""+e+'"'),W.document.head.appendChild(t)}loaded(){this.isLoaded=!0,this.isLoading=!1;for(const e of this.dependents)e.requirementSatisfied();for(const e of this.provided)e.loaded();this.resolve(this.name)}failed(e){this.hasFailed=!0,this.isLoading=!1,this.reject(new Z(e,this.name))}checkLoad(){ee.loadPromise(this.name).then((()=>this.loaded())).catch((e=>this.failed(e)))}requirementSatisfied(){this.dependencyCount&&(this.dependencyCount--,this.canLoad&&this.load())}provides(e=[]){for(const t of e){let e=ee.packages.get(t);e||(Q.dependencies[t]||(Q.dependencies[t]=[]),Q.dependencies[t].push(t),e=new ee(t,!0),e.isLoading=!0),this.provided.push(e)}}addDependent(e,t){this.dependents.push(e),t||this.checkNoLoad()}checkNoLoad(){if(this.noLoad){this.noLoad=!1;for(const e of this.dependencies)e.checkNoLoad()}}}if(ee.packages=new Map,MathJax.loader){let e=ee.resolvePath("[sre]",!1),t=ee.resolvePath("[mathmaps]",!1);if(W.window)e=new URL(e,location).href,t=new URL(t,location).href;else{const s="undefined"!=typeof require?require:MathJax.config.loader.require;s?.resolve?(e=W.path(s.resolve(`${e}/require.mjs`)).replace(/\/[^\/]*$/,""),t=W.path(s.resolve(`${t}/base.json`)).replace(/\/[^\/]*$/,"")):e=t=""}e&&n(MathJax.config,"options",{worker:{path:e,maps:t}})}MathJax.startup&&MathJax.startup.extendHandler((e=>H(e)))})();