/*
* /MathJax/jax/input/MathML/jax.js * * Copyright (c) 2009-2018 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
(function(c,d){var a;var b=function(e){return MathJax.Localization._.apply(MathJax.Localization,[].concat([].slice.call(arguments,1)))};c.Parse=MathJax.Object.Subclass({Init:function(f,e){this.Parse(f,e)},Parse:function(h,e){var j;if(typeof h!==“string”){j=h.parentNode}else{j=c.ParseXML(this.preProcessMath.call(this,h));if(j==null){c.Error([“ErrorParsingMathML”,“Error parsing MathML”])}}var g=j.getElementsByTagName(“parsererror”);if(g){c.Error([“ParsingError”,“Error parsing MathML: %1”,g.textContent.replace(/This page.*?errors:|XML Parsing Error: |Below is a rendering of the page.*/g,“”)])}if(j.childNodes.length!==1){c.Error([“MathMLSingleElement”,“MathML must be formed by a single element”])}if(j.firstChild.nodeName.toLowerCase()===“html”){var f=j.getElementsByTagName(“h1”);if(f&&f.textContent===“XML parsing error”&&f.nextSibling){c.Error([“ParsingError”,“Error parsing MathML: %1”,String(f.nextSibling.nodeValue).replace(/fatal parsing error: /,“”)])}}if(j.firstChild.nodeName.toLowerCase().replace(/^+:/,“”)!==“math”){c.Error([“MathMLRootElement”,“MathML must be formed by a <math> element, not %1”,“<”j.firstChild.nodeName
“>”])}var i={math:j.firstChild,script:e};c.DOMfilterHooks.Execute(i);this.mml=this.MakeMML(i.math)},MakeMML:function(h){var i=String(h.getAttribute(“class”)||“”);var f,g=h.nodeName.toLowerCase().replace(/^+:/,“”);var e=(i.match(/(^| )MJX-TeXAtom-([^ ]*)/));if(e){f=this.TeXAtom(e,e===“OP”&&!i.match(/MJX-fixedlimits/))}else{if(!(a&&a.isa&&a.isa(a.mbase))){MathJax.Hub.signal.Post([“MathML Jax - unknown node type”,g]);return a.Error(b(“UnknownNodeType”,“Unknown node type: %1”,g))}else{f=a()}}this.AddAttributes(f,h);this.CheckClass(f,f);this.AddChildren(f,h);if(c.config.useMathMLspacing){f.useMMLspacing=8}return f},TeXAtom:function(g,f){var e=a.TeXAtom().With({texClass:a.TEXCLASS});if(f){e.movesupsub=e.movablelimits=true}return e},CheckClass:function(f,h){h=(h||“”).split(/ /);var j=[];for(var g=0,e=h.length;g<e;g++){if(h.substr(0,4)===“MJX-”){if(h===“MJX-arrow”){if(!f.notation.match(“/”a.NOTATION.UPDIAGONALARROW
“/”)){f.notation+=“ ”+a.NOTATION.UPDIAGONALARROW}}else{if(h===“MJX-variant”){f.variantForm=true;if(!MathJax.Extension){MathJax.Hub.RestartAfter(MathJax.Ajax.Require(“/extensions/TeX/AMSsymbols.js”))}}else{if(h.substr(0,11)!==“MJX-TeXAtom”){f.mathvariant=h.substr(3);if(f.mathvariant===“-tex-caligraphic-bold”||f.mathvariant===“-tex-oldstyle-bold”){if(!MathJax.Extension){MathJax.Hub.RestartAfter(MathJax.Ajax.Require(“/extensions/TeX/boldsymbol.js”))}}}}}}else{j.push(h)}}if(j.length){f=j.join(“ ”)}else{delete f}},AddAttributes:function(g,j){g.attr={};g.attrNames=[];for(var h=0,e=j.attributes.length;h<e;h++){var f=j.attributes.name;if(f==“xhref”){f=“href”}if(f.match(/:/)){continue}if(f.match(/^_moz-math-((column|row)(align|line)|font-style)$/)){continue}var k=j.attributes.value;k=this.filterAttribute(f,k);var l=(g.type===“mstyle”?a.math.prototype.defaults:g.defaults);if(k!=null){var n=k.toLowerCase();if(n===“true”||n===“false”){if(typeof(l)===“boolean”||l===a.INHERIT||g.type===“math”||g.type===“mstyle”||(l===a.AUTO&&(g.defaultDef==null||typeof(g.defaultDef)===“boolean”))){k=(n===“true”)}}if(l!=null||a.copyAttributes){g=k}else{g.attr=k}g.attrNames.push(f)}}},filterAttribute:function(e,f){return f},AddChildren:function(e,g){for(var k=0,j=g.childNodes.length;k<j;k++){var f=g.childNodes;if(f.nodeName===“#comment”){continue}if(f.nodeName===“#text”){if((e.isToken||e.isChars)&&!e.mmlSelfClosing){var o=f.nodeValue;if(e.isToken){o=o.replace(/&([a-z0-9]*);/ig,this.replaceEntity);o=this.trimSpace(o)}e.Append(a.chars(o))}else{if(f.nodeValue.match(/S/)){c.Error([“UnexpectedTextNode”,“Unexpected text node: %1”,“'”f.nodeValue
“'”])}}}else{if(e.type===“annotation-xml”){e.Append(a.xml(f))}else{var h=this.MakeMML(f);e.Append(h);if(h.mmlSelfClosing&&h.data.length){e.Append.apply(e,h.data);h.data=[]}}}}if(e.type===“mrow”&&e.data.length>=2){var l=e.data,n=e.data;if(l.type===“mo”&&l.Get(“fence”)&&n.type===“mo”&&n.Get(“fence”)){if(l.data){e.open=l.data.join(“”)}if(n.data){e.close=n.data.join(“”)}}}},preProcessMath:function(f){if(f.match(/^<+:/f=f.replace(/^<(+)(:math)/i,'<$1$2 xmlns:$1=”www.w3.org/1998/Math/MathML“‘)}var e=f.match(/^(<math( ('.*?'|”.*?“|[^>])+)>)/i);if(e&&e.match(/ (?!xmlns=)+="i)){f=e[1].replace(/ (?!xmlns=)(+=(['”]).*?2)/ig,“ xmlns:$1 $1”)+f.substr(e.length)}if(f.match(/^<math[ >]/s*$/,“$2”);return“>www.w3.org/1998/Math/MathML”’)}f=f.replace(/^s*(?://)?s*$/,“$2”);return f.replace(/&([a-z0-9]*);/ig,this.replaceEntity)},trimSpace:function(e){return e.replace(//g,“ ”).replace(/^ +/,“”).replace(/ +$/,“”).replace(/ +/g,“ ”)},replaceEntity:function(g,f){if(f.match(/^(lt|amp|quot)$/)){return g}if(c.Parse.Entity){return c.Parse.Entity}var h=f.charAt(0).toLowerCase();var e=f.match(/^(fr|scr|opf)$/);if(e){h=e}if(!c.Parse.loaded){c.Parse.loaded=true;MathJax.Hub.RestartAfter(MathJax.Ajax.Require(c.entityDir+“/”h
“.js”))}return g}},{loaded:[]});c.Augment({sourceMenuTitle:[“OriginalMathML”,“Original MathML”],prefilterHooks:MathJax.Callback.Hooks(true),DOMfilterHooks:MathJax.Callback.Hooks(true),postfilterHooks:MathJax.Callback.Hooks(true),Translate:function(e){if(!this.ParseXML){this.ParseXML=this.createParser()}var f,h,i={script:e};if(e.firstChild&&e.firstChild.nodeName.toLowerCase().replace(/^+:/,“”)===“math”){i.math=e.firstChild}else{h=MathJax.HTML.getScript(e);if(d.isMSIE){h=h.replace(/( )+$/,“”)}i.math=h}var j=this.prefilterHooks.Execute(i);if(j){return j}h=i.math;try{f=c.Parse(h,e).mml}catch(g){if(!g.mathmlError){throw g}f=this.formatError(g,h,e)}i.math=a(f);return this.postfilterHooks.Execute(i)||i.math},prefilterMath:function(f,e){return f},prefilterMathML:function(f,e){return f},formatError:function(h,g,e){var f=h.message.replace(/n.*/,“”);MathJax.Hub.signal.Post([“MathML Jax - parse error”,f,g,e]);return a.Error(f)},Error:function(e){if(MathJax.Object.isArray(e)){e=b.apply(b,e)}throw MathJax.Hub.Insert(Error(e),{mathmlError:true})},parseDOM:function(e){return this.parser.parseFromString(e,“text/xml”)},parseMS:function(e){return(this.parser.loadXML(e)?this.parser:null)},parseDIV:function(e){this.div.innerHTML=“