/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax.js * * The main support code for the MathJax Hub, including the * Ajax, Callback, Messaging, and Object-Oriented Programming * libraries, as well as the base Jax classes, and startup * processing code. * * --------------------------------------------------------------------- * * Copyright (c) 2009-2013 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. */document.getElementById&&document.childNodes&&document.createElement&&(window.MathJax||(window.MathJax={}),MathJax.Hub||(MathJax.version="2.2",MathJax.fileversion="2.2",function(a){var b=window[a];b||(b=window[a]={});var c=[];a=function(a){var b=a.constructor;b||(b=new Function(""));for(var c in a)"constructor"!==c&&a.hasOwnProperty(c)&&(b[c]=a[c]);return b};var d=function(){return new Function("return arguments.callee.Init.call(this,arguments)")},e=d();e.prototype={bug_test:1};e.prototype.bug_test||(d=function(){return function(){return arguments.callee.Init.call(this,arguments)}});b.Object=a({constructor:d(),Subclass:function(a,b){var h=d();h.SUPER=this;h.Init=this.Init;h.Subclass=this.Subclass;h.Augment=this.Augment;h.protoFunction=this.protoFunction;h.can=this.can;h.has=this.has;h.isa=this.isa;h.prototype=new this(c);h.prototype.constructor=h;h.Augment(a,b);return h},Init:function(a){var b=this;if(1===a.length&&a[0]===c)return b;b instanceof a.callee||(b=new a.callee(c));return b.Init.apply(b,a)||b},Augment:function(a,b){var c;if(null!=a){for(c in a)a.hasOwnProperty(c)&&this.protoFunction(c,a[c]);a.toString!==this.prototype.toString&&a.toString!=={}.toString&&this.protoFunction("toString",a.toString)}if(null!=b)for(c in b)b.hasOwnProperty(c)&&(this[c]=b[c]);return this},protoFunction:function(a,b){this.prototype[a]=b;"function"===typeof b&&(b.SUPER=this.SUPER.prototype)},prototype:{Init:function(){},SUPER:function(a){return a.callee.SUPER},can:function(a){return"function"===typeof this[a]},has:function(a){return"undefined"!==typeof this[a]},isa:function(a){return a instanceof Object&&this instanceof a}},can:function(a){return this.prototype.can.call(this,a)},has:function(a){return this.prototype.has.call(this,a)},isa:function(a){for(var b=this;b;){if(b===a)return!0;b=b.SUPER}return!1},SimpleSUPER:a({constructor:function(a){return this.SimpleSUPER.define(a)},define:function(a){var b={};if(null!=a){for(var c in a)a.hasOwnProperty(c)&&(b[c]=this.wrap(c,a[c]));a.toString!==this.prototype.toString&&a.toString!=={}.toString&&(b.toString=this.wrap("toString",a.toString))}return b},wrap:function(a,b){if("function"===typeof b&&b.toString().match(/\.\s*SUPER\s*\(/)){var c=new Function(this.wrapper);c.label=a;c.original=b;b=c;c.toString=this.stringify}return b},wrapper:function(){var a=arguments.callee;this.SUPER=a.SUPER[a.label];try{var b=a.original.apply(this,arguments)}catch(c){throw delete this.SUPER,c;}delete this.SUPER;return b}.toString().replace(/^\s*function\s*\(\)\s*\{\s*/i,"").replace(/\s*\}\s*$/i,""),toString:function(){return this.original.toString.apply(this.original,arguments)}})})}("MathJax"),function(a){var b=window[a];b||(b=window[a]={});var c=function(a){var b=new Function("return arguments.callee.execute.apply(arguments.callee,arguments)"),d;for(d in c.prototype)c.prototype.hasOwnProperty(d)&&(b[d]="undefined"!==typeof a[d]?a[d]:c.prototype[d]);b.toString=c.prototype.toString;return b};c.prototype={isCallback:!0,hook:function(){},data:[],object:window,execute:function(){if(!this.called||this.autoReset)return this.called=!this.autoReset,this.hook.apply(this.object,this.data.concat([].slice.call(arguments,0)))},reset:function(){delete this.called},toString:function(){return this.hook.toString.apply(this.hook,arguments)}};var d=function(a){return"function"===typeof a&&a.isCallback},e=function(a){return eval.call(window,a)};e("var __TeSt_VaR__ \x3d 1");if(window.__TeSt_VaR__)try{delete window.__TeSt_VaR__}catch(q){window.__TeSt_VaR__=null}else e=window.execScript?function(c){b.__code=c;c="try {"+a+".__result \x3d eval("+a+".__code)} catch(err) {"+a+".__result \x3d err}";window.execScript(c);c=b.__result;delete b.__result;delete b.__code;if(c instanceof Error)throw c;return c}:function(c){b.__code=c;c="try {"+a+".__result \x3d eval("+a+".__code)} catch(err) {"+a+".__result \x3d err}";var d=document.getElementsByTagName("head")[0];d||(d=document.body);var h=document.createElement("script");h.appendChild(document.createTextNode(c));d.appendChild(h);d.removeChild(h);c=b.__result;delete b.__result;delete b.__code;if(c instanceof Error)throw c;return c};var f=function(a,b){1=a[b].pending&&a[b].call()},l=function(a,b){b instanceof Array||(b=[b]);a.signal?1===b.length?a.signal.push(b[0]):a.signal=a.signal.concat(b):(a.oldExecute=a.execute,a.execute=h,a.signal=b)},m=function(a){a=f(a);a.pending=0;for(var b=1,c=arguments.length;bd&&(d=document.styleSheets.length);a||(a=document.getElementsByTagName("head")[0],a||(a=document.body));return a},f=[],g=function(){for(var a=0,c=f.length;a=this.timeout?(a(this.STATUS.ERROR),1):0},file:function(a,c){0>c?b.Ajax.loadTimeout(a):b.Ajax.loadComplete(a)},execute:function(){this.hook.call(this.object,this,this.data[0],this.data[1])},checkSafari2:function(a,b,c){a.time(c)||(document.styleSheets.length>b&&document.styleSheets[b].cssRules&&document.styleSheets[b].cssRules.length?c(a.STATUS.OK):setTimeout(a,a.delay))},checkLength:function(a,c,d){if(!a.time(d)){var e=0;c=c.sheet||c.styleSheet;try{0<(c.cssRules||c.rules||[]).length&&(e=1)}catch(g){g.message.match(/protected variable|restricted URI/)?e=1:g.message.match(/Security error/)&&(e=1)}e?setTimeout(b.Callback([d,a.STATUS.OK]),0):setTimeout(a,a.delay)}}},loadComplete:function(a){a=this.fileURL(a);var c=this.loading[a];c&&!c.preloaded?(b.Message.Clear(c.message),clearTimeout(c.timeout),c.script&&(0===f.length&&setTimeout(g,0),f.push(c.script)),this.loaded[a]=c.status,delete this.loading[a],this.addHook(a,c.callback)):(c&&delete this.loading[a],this.loaded[a]=this.STATUS.OK,c={status:this.STATUS.OK});return this.loadHooks[a]?this.loadHooks[a].Execute(c.status):null},loadTimeout:function(a){this.loading[a].timeout&&clearTimeout(this.loading[a].timeout);this.loading[a].status=this.STATUS.ERROR;this.loadError(a);this.loadComplete(a)},loadError:function(a){b.Message.Set(["LoadFailed","File failed to load: %1",a],null,2E3);b.Hub.signal.Post(["file load error",a])},Styles:function(a,c){var d=this.StyleString(a);if(""===d)c=b.Callback(c),c();else{var g=document.createElement("style");g.type="text/css";this.head=e(this.head);this.head.appendChild(g);g.styleSheet&&"undefined"!==typeof g.styleSheet.cssText?g.styleSheet.cssText=d:g.appendChild(document.createTextNode(d));c=this.timer.create.call(this,c,g)}return c},StyleString:function(a){if("string"===typeof a)return a;var b="",c,d;for(c in a)if(a.hasOwnProperty(c))if("string"===typeof a[c])b+=c+" {"+a[c]+"}\n";else if(a[c]instanceof Array)for(var e=0;e=f)a[d]=b[a[d]-1],"number"===typeof a[d]&&(a[d]=this.number(a[d]));else if("{"===f)if(f=a[d].substr(1),"0"<=f&&"9">=f)a[d]=b[a[d].substr(1,a[d].length-2)-1],"number"===typeof a[d]&&(a[d]=this.number(a[d]));else{var g=a[d].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/);g&&("plural"===g[1]?(f=b[g[2]-1],"undefined"===typeof f?a[d]="???":(f=this.plural(f)-1,g=g[3].replace(/(^|[^%])(%%)*%\|/g,"$1$2%\uefef").split(/\|/),a[d]=0<=f&&fthis.processUpdateTime&&a.ithis.processUpdateTime&&a.i=parseInt(a[c]);return!0},Select:function(a){return(a=a[c.Browser])?a(c.Browser):null}};f=navigator.userAgent.replace(/^Mozilla\/(\d+\.)+\d+ /,"").replace(/[a-z][-a-z0-9._: ]+\/\d+[^ ]*-[^ ]*\.([a-z][a-z])?\d+ /i,"").replace(/Gentoo |Ubuntu\/(\d+\.)*\d+ (\([^)]*\) )?/,"");c.Browser=c.Insert(c.Insert(new String("Unknown"),{version:"0.0"}),e);for(var k in e)if(e.hasOwnProperty(k)&&e[k]&&"is"===k.substr(0,2)&&(k=k.slice(2),"Mac"!==k&&"PC"!==k)){c.Browser=c.Insert(new String(k),e);e=(new RegExp(".*(Version)/((?:\\d+\\.)+\\d+)|.*("+k+")"+("MSIE"==k?" ":"/")+"((?:\\d+\\.)*\\d+)|(?:^|\\(| )([a-z][-a-z0-9._: ]+|(?:Apple)?WebKit)/((?:\\d+\\.)+\\d+)")).exec(f)||["","","","unknown","0.0"];c.Browser.name="Version"==e[1]?k:e[3]||e[5];c.Browser.version=e[2]||e[4]||e[6];break}c.Browser.Select({Safari:function(a){var b=parseInt(String(a.version).split(".")[0]);85document.documentMode;var b=!1;try{new ActiveXObject("MathPlayer.Factory.1"),a.hasMathPlayer=b=!0}catch(c){}try{if(b&&!d.params.NoMathPlayer){var e=document.createElement("object");e.id="mathplayer";e.classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987";document.getElementsByTagName("head")[0].appendChild(e);document.namespaces.add("m","http://www.w3.org/1998/Math/MathML");a.mpNamespace=!0;!document.readyState||"loading"!==document.readyState&&"interactive"!==document.readyState||(document.write('\x3c?import namespace\x3d"m" implementation\x3d"#MathPlayer"\x3e'),a.mpImported=!0)}else document.namespaces.add("mjx_IE_fix","http://www.w3.org/1999/xlink")}catch(c){}}});c.Browser.Select(MathJax.Message.browsers);c.queue=b.Callback.Queue();c.queue.Push(["Post",d.signal,"Begin"],["Config",d],["Cookie",d],["Styles",d],["Message",d],function(){return b.Callback.Queue(d.Jax(),d.Extensions()).Push({})},["Menu",d],d.onLoad(),function(){MathJax.isReady=!0},["Typeset",d],["Hash",d],["MenuZoom",d],["Post",d.signal,"End"])}("MathJax")));