1 line
5.6 KiB
JavaScript
1 line
5.6 KiB
JavaScript
(()=>{"use strict";var e={d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{EmpheqUtil:()=>b});var a={};e.r(a),e.d(a,{EmpheqConfiguration:()=>f,EmpheqMethods:()=>E});const n=("undefined"!=typeof window?window:global).MathJax._.components.global,i=(n.GLOBAL,n.isObject,n.combineConfig,n.combineDefaults,n.combineWithMathJax),r=(n.MathJax,MathJax._.input.tex.HandlerTypes),p=r.ConfigurationType,o=r.HandlerType,h=MathJax._.input.tex.Configuration,l=h.Configuration,m=(h.ConfigurationHandler,h.ParserConfiguration,MathJax._.input.tex.TokenMap),s=(m.parseResult,m.AbstractTokenMap,m.RegExpMap,m.AbstractParseMap,m.CharacterMap,m.DelimiterMap,m.MacroMap,m.CommandMap),c=m.EnvironmentMap,d=MathJax._.input.tex.ParseUtil,q=(d.KeyValueDef,d.KeyValueTypes,d.ParseUtil),g=MathJax._.input.tex.TexError.default,u=MathJax._.input.tex.TexParser.default,b={splitOptions:(e,t=null)=>q.keyvalOptions(e,t,!0),columnCount(e){let t=0;for(const a of e.childNodes){const e=a.childNodes.length-(a.isKind("mlabeledtr")?1:0);e>t&&(t=e)}return t},cellBlock(e,t,a,n){const i=a.create("node","mpadded",[],{height:0,depth:0,voffset:"-1height"}),r=new u(e,a.stack.env,a.configuration),p=r.mml();n&&r.configuration.tags.label&&(r.configuration.tags.currentTag.env=n,r.configuration.tags.getTag(!0));for(const e of p.isInferred?p.childNodes:[p])i.appendChild(e);return i.appendChild(a.create("node","mphantom",[a.create("node","mpadded",[t],{width:0})])),i},topRowTable(e,t){const a=q.copyNode(e,t);return a.setChildren(a.childNodes.slice(0,1)),a.attributes.set("align","baseline 1"),e.factory.create("mphantom",{},[t.create("node","mpadded",[a],{width:0})])},rowspanCell(e,t,a,n,i){e.appendChild(n.create("node","mpadded",[this.cellBlock(t,q.copyNode(a,n),n,i),this.topRowTable(a,n)],{height:0,depth:0,voffset:"height"}))},left(e,t,a,n,i=""){let r;e.attributes.set("columnalign","right "+e.attributes.get("columnalign")),e.attributes.set("columnspacing","0em "+e.attributes.get("columnspacing")),0===e.childNodes.length&&e.appendChild(n.create("node","mtr"));for(const t of e.childNodes.slice(0).reverse())r=n.create("node","mtd"),t.childNodes.unshift(r),r.parent=t,t.isKind("mlabeledtr")&&(t.childNodes[0]=t.childNodes[1],t.childNodes[1]=r);this.rowspanCell(r,a,t,n,i)},right(e,t,a,n,i=""){0===e.childNodes.length&&e.appendChild(n.create("node","mtr"));const r=e.childNodes[0],p=b.columnCount(e)+(r.isKind("mlabeledtr")?1:0);for(;r.childNodes.length<p;)r.appendChild(n.create("node","mtd"));const o=r.appendChild(n.create("node","mtd"));b.rowspanCell(o,a,t,n,i),e.attributes.set("columnalign",(e.attributes.get("columnalign")||"").split(/ /).slice(0,p).join(" ")+" left"),e.attributes.set("columnspacing",e.attributes.get("columnspacing").split(/ /).slice(0,p-1).join(" ")+" 0em")},adjustTable(e,t){const a=e.getProperty("left"),n=e.getProperty("right");if(a||n){const i=e.Last,r=q.copyNode(i,t);a&&this.left(i,r,a,t),n&&this.right(i,r,n,t)}},allowEnv:{equation:!0,align:!0,gather:!0,flalign:!0,alignat:!0,multline:!0},checkEnv(e){return Object.hasOwn(this.allowEnv,e.replace(/\*$/,""))||!1}},M=MathJax._.input.tex.ParseMethods.default,E={Empheq(e,t){if(e.stack.env.closing===t.getName()){delete e.stack.env.closing,e.Push(e.itemFactory.create("end").setProperty("name",e.stack.global.empheq)),e.stack.global.empheq="";const t=e.stack.Top();b.adjustTable(t,e),e.Push(e.itemFactory.create("end").setProperty("name","empheq"))}else{q.checkEqnEnv(e);const a=e.GetBrackets("\\begin{"+t.getName()+"}")||"",[n,i]=e.GetArgument("\\begin{"+t.getName()+"}").split(/=/);if(!b.checkEnv(n))throw new g("EmpheqInvalidEnv",'Invalid environment "%1" for %2',n,t.getName());t.setProperty("nestStart",!0),a&&t.setProperties(b.splitOptions(a,{left:1,right:1})),e.stack.global.empheq=n,e.string="\\begin{"+n+"}"+(i?"{"+i+"}":"")+e.string.slice(e.i),e.i=0,e.Push(t)}},EmpheqMO(e,t,a){e.Push(e.create("token","mo",{},a))},EmpheqDelim(e,t){const a=e.GetDelimiter(t);e.Push(e.create("token","mo",{stretchy:!0,symmetric:!0},a))}};new c("empheq-env",M.environment,{empheq:[E.Empheq,"empheq"]}),new s("empheq-macros",{empheqlbrace:[E.EmpheqMO,"{"],empheqrbrace:[E.EmpheqMO,"}"],empheqlbrack:[E.EmpheqMO,"["],empheqrbrack:[E.EmpheqMO,"]"],empheqlangle:[E.EmpheqMO,"\u27e8"],empheqrangle:[E.EmpheqMO,"\u27e9"],empheqlparen:[E.EmpheqMO,"("],empheqrparen:[E.EmpheqMO,")"],empheqlvert:[E.EmpheqMO,"|"],empheqrvert:[E.EmpheqMO,"|"],empheqlVert:[E.EmpheqMO,"\u2016"],empheqrVert:[E.EmpheqMO,"\u2016"],empheqlfloor:[E.EmpheqMO,"\u230a"],empheqrfloor:[E.EmpheqMO,"\u230b"],empheqlceil:[E.EmpheqMO,"\u2308"],empheqrceil:[E.EmpheqMO,"\u2309"],empheqbiglbrace:[E.EmpheqMO,"{"],empheqbigrbrace:[E.EmpheqMO,"}"],empheqbiglbrack:[E.EmpheqMO,"["],empheqbigrbrack:[E.EmpheqMO,"]"],empheqbiglangle:[E.EmpheqMO,"\u27e8"],empheqbigrangle:[E.EmpheqMO,"\u27e9"],empheqbiglparen:[E.EmpheqMO,"("],empheqbigrparen:[E.EmpheqMO,")"],empheqbiglvert:[E.EmpheqMO,"|"],empheqbigrvert:[E.EmpheqMO,"|"],empheqbiglVert:[E.EmpheqMO,"\u2016"],empheqbigrVert:[E.EmpheqMO,"\u2016"],empheqbiglfloor:[E.EmpheqMO,"\u230a"],empheqbigrfloor:[E.EmpheqMO,"\u230b"],empheqbiglceil:[E.EmpheqMO,"\u2308"],empheqbigrceil:[E.EmpheqMO,"\u2309"],empheql:E.EmpheqDelim,empheqr:E.EmpheqDelim,empheqbigl:E.EmpheqDelim,empheqbigr:E.EmpheqDelim});const f=l.create("empheq",{[p.HANDLER]:{[o.MACRO]:["empheq-macros"],[o.ENVIRONMENT]:["empheq-env"]}});MathJax.loader&&MathJax.loader.checkVersion("[tex]/empheq","4.0.0","tex-extension"),i({_:{input:{tex:{empheq:{EmpheqConfiguration:a,EmpheqUtil:t}}}}})})(); |