Uploaded Test files

This commit is contained in:
Batuhan Berk Başoğlu 2020-11-12 11:05:57 -05:00
parent f584ad9d97
commit 2e81cb7d99
16627 changed files with 2065359 additions and 102444 deletions

View file

@ -0,0 +1,61 @@
//This is file created for overwriting some of bootstrap element color in order to satisfiy the color contrast greater than 4.5:1.
.btn-danger{
color: #ffffff;
background-color: #df0404;
border-color: #df0404;
}
.btn-warning{
color: #ffffff;
background-color:#b46102;
border-color: #b46102;
}
@link-color: #296eaa;
.close {
float: right;
font-size: (@font-size-base * 1.5);
font-weight: @close-font-weight;
line-height: 1;
color: @close-color;
text-shadow: @close-text-shadow;
.opacity(.6);
&:hover,
&:focus {
color: @close-color;
text-decoration: none;
cursor: pointer;
.opacity(1.0);
} button& {
padding: 0;
cursor: pointer;
background: transparent;
border: 0;
-webkit-appearance: none;
appearance: none;
}
}
.navbar-nav {
> li > a {
color: @navbar-default-link-color;
// To make keyboard focus clearly visible on the Controls(File,Edit,View,Insert,Cell...etc)present on the menubar.
//&:hover, //To use browser's hover default value
&:focus {
/* -webkit-focus-ring-color = '#5B9DD9' */
outline: -webkit-focus-ring-color auto 5px;
// color: @navbar-default-link-hover-color;
// background-color: @navbar-default-link-hover-bg;
}
}
}
.menu_focus_highlight{
a:focus {
outline: -webkit-focus-ring-color auto 5px;
}
}

View file

@ -0,0 +1,8 @@
/*This file contains any manual css for this page that needs to override the global styles.
This is only required when different pages style the same element differently. This is just
a hack to deal with our current css styles and no new styling should be added in this file.*/
#ipython-main-app {
padding-top: 50px;
text-align: center;
}

View file

@ -0,0 +1,12 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['jquery', 'base/js/namespace', 'base/js/page'], function($, IPython, page) {
function login_main() {
var page_instance = new page.Page('div#header', 'div#site');
page_instance.show();
$('input#password_input').focus();
IPython.page = page_instance;
}
return login_main;
});

View file

@ -0,0 +1,38 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/utils',
], function($, utils){
"use strict";
var LoginWidget = function (selector, options) {
options = options || {};
this.base_url = options.base_url || utils.get_body_data("baseUrl");
this.selector = selector;
if (this.selector !== undefined) {
this.element = $(selector);
this.bind_events();
}
};
LoginWidget.prototype.bind_events = function () {
var that = this;
this.element.find("button#logout").click(function () {
window.location = utils.url_path_join(
that.base_url,
"logout"
);
});
this.element.find("button#login").click(function () {
window.location = utils.url_path_join(
that.base_url,
"login"
);
});
};
return {'LoginWidget': LoginWidget};
});

View file

@ -0,0 +1,12 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['base/js/namespace', 'base/js/page'], function(IPython, page) {
function logout_main() {
var page_instance = new page.Page('div#header', 'div#site');
page_instance.show();
IPython.page = page_instance;
}
return logout_main;
});

View file

@ -0,0 +1,12 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['./loginmain', './logoutmain', 'bidi/bidi'], function (login_main, logout_main, bidi) {
if(bidi.isMirroringEnabled()){
$("body").attr("dir","rtl");
}
return {
login_main: login_main,
logout_main: logout_main
};
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

@ -0,0 +1,433 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['jquery',
'codemirror/lib/codemirror',
'bootstrap',
'base/js/i18n'],
function($, CodeMirror, bs, i18n) {
"use strict";
/**
* A wrapper around bootstrap modal for easier use
* Pass it an option dictionary with the following properties:
*
* - body : <string> or <DOM node>, main content of the dialog
* if pass a <string> it will be wrapped in a p tag and
* html element escaped, unless you specify sanitize=false
* option.
* - title : Dialog title, default to empty string.
* - buttons : dict of btn_options who keys are button label.
* see btn_options below for description
* - open : callback to trigger on dialog open.
* - destroy:
* - notebook : notebook instance
* - keyboard_manager: keyboard manager instance.
*
* Unlike bootstrap modals, the backdrop options is set by default
* to 'static'.
*
* The rest of the options are passed as is to bootstrap modals.
*
* btn_options: dict with the following property:
*
* - click : callback to trigger on click
* - class : css classes to add to button.
*
*
*
**/
var modal = function (options) {
var modal = $("<div/>")
.addClass("modal")
.addClass("fade")
.attr("role", "dialog");
var dialog = $("<div/>")
.addClass("modal-dialog")
.appendTo(modal);
var dialog_content = $("<div/>")
.addClass("modal-content")
.appendTo(dialog);
if(typeof(options.body) === 'string' && options.sanitize !== false){
options.body = $("<p/>").text(options.body);
}
dialog_content.append(
$("<div/>")
.addClass("modal-header")
.mousedown(function() {
$(".modal").draggable({handle: '.modal-header'});
})
.append($("<button>")
.attr("type", "button")
.attr("aria-label", i18n.msg._("close"))
.addClass("close")
.attr("data-dismiss", "modal")
.attr("aria-hidden", "true")
.html("&times;")
).append(
$("<h4/>")
.addClass('modal-title')
.text(options.title || "")
)
).append(
$("<div/>")
.addClass("modal-body")
.append(
options.body || $("<p/>")
)
);
var footer = $("<div/>").addClass("modal-footer");
var default_button;
for (var label in options.buttons) {
var btn_opts = options.buttons[label];
var button = $("<button/>")
.addClass("btn btn-default btn-sm")
.attr("data-dismiss", "modal")
.text(i18n.msg.translate(label).fetch());
if (btn_opts.id) {
button.attr('id', btn_opts.id);
}
if (btn_opts.click) {
button.click($.proxy(btn_opts.click, dialog_content));
}
if (btn_opts.class) {
button.addClass(btn_opts.class);
}
footer.append(button);
if (options.default_button && label === options.default_button) {
default_button = button;
}
}
if (!options.default_button) {
default_button = footer.find("button").last();
}
dialog_content.append(footer);
// hook up on-open event
modal.on("shown.bs.modal", function () {
setTimeout(function () {
default_button.focus();
if (options.open) {
$.proxy(options.open, modal)();
}
}, 0);
});
// destroy modal on hide, unless explicitly asked not to
if (options.destroy === undefined || options.destroy) {
modal.on("hidden.bs.modal", function () {
modal.remove();
});
}
modal.on("hidden.bs.modal", function () {
if (options.notebook) {
var cell = options.notebook.get_selected_cell();
if (cell) cell.select();
}
if (options.keyboard_manager) {
options.keyboard_manager.enable();
options.keyboard_manager.command_mode();
}
if (options.focus_button) {
$(options.focus_button).focus();
}
});
if (options.keyboard_manager) {
options.keyboard_manager.disable();
}
if(options.backdrop === undefined){
options.backdrop = 'static';
}
return modal.modal(options);
};
var kernel_modal = function (options) {
/**
* only one kernel dialog should be open at a time -- but
* other modal dialogs can still be open
*/
$('.kernel-modal').modal('hide');
var dialog = modal(options);
dialog.addClass('kernel-modal');
return dialog;
};
var edit_metadata = function (options) {
options.name = options.name || "Cell";
var error_div = $('<div/>').css('color', 'red');
var message_cell =
i18n.msg._("Manually edit the JSON below to manipulate the metadata for this cell.");
var message_notebook =
i18n.msg._("Manually edit the JSON below to manipulate the metadata for this notebook.");
var message_end =
i18n.msg._(" We recommend putting custom metadata attributes in an appropriately named substructure," +
" so they don't conflict with those of others.");
var message;
if (options.name === 'Notebook') {
message = message_notebook + message_end;
} else {
message = message_cell + message_end;
}
var textarea = $('<textarea/>')
.attr('rows', '13')
.attr('cols', '80')
.attr('name', 'metadata')
.text(JSON.stringify(options.md || {}, null, 2));
var dialogform = $('<div/>').attr('title', i18n.msg._('Edit the metadata'))
.append(
$('<form/>').append(
$('<fieldset/>').append(
$('<label/>')
.attr('for','metadata')
.text(message)
)
.append(error_div)
.append($('<br/>'))
.append(textarea)
)
);
var editor = CodeMirror.fromTextArea(textarea[0], {
lineNumbers: true,
matchBrackets: true,
indentUnit: 2,
autoIndent: true,
mode: 'application/json',
});
var title_msg;
if (options.name === "Notebook") {
title_msg = i18n.msg._("Edit Notebook Metadata");
} else {
title_msg = i18n.msg._("Edit Cell Metadata");
}
// This statement is used simply so that message extraction
// will pick up the strings.
var button_labels = [ i18n.msg._("Cancel"), i18n.msg._("Edit"), i18n.msg._("OK"), i18n.msg._("Apply")];
var modal_obj = modal({
title: title_msg,
body: dialogform,
default_button: "Cancel",
buttons: {
Cancel: {},
Edit: { class : "btn-primary",
click: function() {
/**
* validate json and set it
*/
var new_md;
try {
new_md = JSON.parse(editor.getValue());
} catch(e) {
console.log(e);
error_div.text(i18n.msg._('WARNING: Could not save invalid JSON.'));
return false;
}
options.callback(new_md);
options.notebook.apply_directionality();
}
}
},
notebook: options.notebook,
keyboard_manager: options.keyboard_manager,
});
modal_obj.on('shown.bs.modal', function(){ editor.refresh(); });
modal_obj.on('hide.bs.modal', function(){
options.edit_metadata_button ? options.edit_metadata_button.focus() : "";});
};
var edit_attachments = function (options) {
// This shows the Edit Attachments dialog. This dialog allows the
// user to delete attachments. We show a list of attachments to
// the user and he can mark some of them for deletion. The deletion
// is applied when the 'Apply' button of this dialog is pressed.
var message;
var attachments_list;
if (Object.keys(options.attachments).length == 0) {
message = i18n.msg._("There are no attachments for this cell.");
attachments_list = $('<div>');
} else {
message = i18n.msg._("Current cell attachments");
attachments_list = $('<div>')
.addClass('list_container')
.append(
$('<div>')
.addClass('row list_header')
.append(
$('<div>')
.text(i18n.msg._('Attachments'))
)
);
// This is a set containing keys of attachments to be deleted when
// the Apply button is clicked
var to_delete = {};
var refresh_attachments_list = function() {
$(attachments_list).find('.row').remove();
for (var key in options.attachments) {
var mime = Object.keys(options.attachments[key])[0];
var deleted = key in to_delete;
// This ensures the current value of key is captured since
// javascript only has function scope
var btn;
// Trash/restore button
(function(){
var _key = key;
btn = $('<button>')
.addClass('btn btn-default btn-xs')
.css('display', 'inline-block');
if (deleted) {
btn.attr('title', i18n.msg._('Restore'))
.append(
$('<i>')
.addClass('fa fa-plus')
);
btn.click(function() {
delete to_delete[_key];
refresh_attachments_list();
});
} else {
btn.attr('title', i18n.msg._('Delete'))
.addClass('btn-danger')
.append(
$('<i>')
.addClass('fa fa-trash')
);
btn.click(function() {
to_delete[_key] = true;
refresh_attachments_list();
});
}
return btn;
})();
var row = $('<div>')
.addClass('col-md-12 att_row')
.append(
$('<div>')
.addClass('row')
.append(
$('<div>')
.addClass('att-name col-xs-4')
.text(key)
)
.append(
$('<div>')
.addClass('col-xs-4 text-muted')
.text(mime)
)
.append(
$('<div>')
.addClass('item-buttons pull-right')
.append(btn)
)
);
if (deleted) {
row.find('.att-name')
.css('text-decoration', 'line-through');
}
attachments_list.append($('<div>')
.addClass('list_item row')
.append(row)
);
}
};
refresh_attachments_list();
}
var dialogform = $('<div/>')
.attr('title', i18n.msg._('Edit attachments'))
.append(message)
.append('<br />')
.append(attachments_list);
var title_msg;
if ( options.name === "Notebook" ) {
title_msg = i18n.msg._("Edit Notebook Attachments");
} else {
title_msg = i18n.msg._("Edit Cell Attachments");
}
var modal_obj = modal({
title: title_msg,
body: dialogform,
buttons: {
Apply: { class : "btn-primary",
click: function() {
for (var key in to_delete) {
delete options.attachments[key];
}
options.callback(options.attachments);
}
},
Cancel: {}
},
notebook: options.notebook,
keyboard_manager: options.keyboard_manager,
});
};
var insert_image = function (options) {
var message =
i18n.msg._("Select a file to insert.");
var file_input = $('<input/>')
.attr('type', 'file')
.attr('accept', 'image/*')
.attr('name', 'file')
.on('change', function(file) {
var $btn = $(modal_obj).find('#btn_ok');
if (this.files.length > 0) {
$btn.removeClass('disabled');
} else {
$btn.addClass('disabled');
}
});
var dialogform = $('<div/>').attr('title', i18n.msg._('Edit attachments'))
.append(
$('<form id="insert-image-form" />').append(
$('<fieldset/>').append(
$('<label/>')
.attr('for','file')
.text(message)
)
.append($('<br/>'))
.append(file_input)
)
);
var modal_obj = modal({
title: i18n.msg._("Select a file"),
body: dialogform,
buttons: {
OK: {
id : 'btn_ok',
class : "btn-primary disabled",
click: function() {
options.callback(file_input[0].files[0]);
}
},
Cancel: {}
},
notebook: options.notebook,
keyboard_manager: options.keyboard_manager,
});
};
var dialog = {
modal : modal,
kernel_modal : kernel_modal,
edit_metadata : edit_metadata,
edit_attachments : edit_attachments,
insert_image : insert_image
};
return dialog;
});

View file

@ -0,0 +1,37 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
// Give us an object to bind all events to. This object should be created
// before all other objects so it exists when others register event handlers.
// To register an event handler:
//
// requirejs(['base/js/events'], function (events) {
// events.on("event.Namespace", function () { do_stuff(); });
// });
define(['jquery', 'base/js/namespace'], function($, Jupyter) {
"use strict";
// Events singleton
if (!window._Events) {
window._Events = function () {};
window._events = new window._Events();
}
// Backwards compatibility.
Jupyter.Events = window._Events;
Jupyter.events = window._events;
var events = $([window._events]);
// catch and log errors in triggered events
events._original_trigger = events.trigger;
events.trigger = function (name, data) {
try {
this._original_trigger.apply(this, arguments);
} catch (e) {
console.error("Exception in event handler for " + name, e, arguments);
}
}
return events;
});

View file

@ -0,0 +1,16 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
// Module to handle i18n ( Internationalization ) and translated UI
define([
'jed'
], function(Jed) {
"use strict";
var i18n = new Jed(document.nbjs_translations);
i18n._ = i18n.gettext;
i18n.msg = i18n; // Just a place holder until the init promise resolves.
return i18n;
});

View file

@ -0,0 +1,576 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
/**
*
*
* @module keyboard
* @namespace keyboard
* @class ShortcutManager
*/
define([
'jquery',
'base/js/utils',
'underscore',
], function($, utils, _) {
"use strict";
/**
* Setup global keycodes and inverse keycodes.
*
* See http://unixpapa.com/js/key.html for a complete description. The short of
* it is that there are different keycode sets. Firefox uses the "Mozilla keycodes"
* and Webkit/IE use the "IE keycodes". These keycode sets are mostly the same
* but have minor differences.
**/
// These apply to Firefox, (Webkit and IE)
// This does work **only** on US keyboard.
var _keycodes = {
'a': 65, 'b': 66, 'c': 67, 'd': 68, 'e': 69, 'f': 70, 'g': 71, 'h': 72, 'i': 73,
'j': 74, 'k': 75, 'l': 76, 'm': 77, 'n': 78, 'o': 79, 'p': 80, 'q': 81, 'r': 82,
's': 83, 't': 84, 'u': 85, 'v': 86, 'w': 87, 'x': 88, 'y': 89, 'z': 90,
'1 !': 49, '2 @': 50, '3 #': 51, '4 $': 52, '5 %': 53, '6 ^': 54,
'7 &': 55, '8 *': 56, '9 (': 57, '0 )': 48,
'[ {': 219, '] }': 221, '` ~': 192, ', <': 188, '. >': 190, '/ ?': 191,
'\\ |': 220, '\' "': 222,
'numpad0': 96, 'numpad1': 97, 'numpad2': 98, 'numpad3': 99, 'numpad4': 100,
'numpad5': 101, 'numpad6': 102, 'numpad7': 103, 'numpad8': 104, 'numpad9': 105,
'multiply': 106, 'add': 107, 'subtract': 109, 'decimal': 110, 'divide': 111,
'f1': 112, 'f2': 113, 'f3': 114, 'f4': 115, 'f5': 116, 'f6': 117, 'f7': 118,
'f8': 119, 'f9': 120, 'f10': 121, 'f11': 122, 'f12': 123, 'f13': 124, 'f14': 125, 'f15': 126,
'backspace': 8, 'tab': 9, 'enter': 13, 'shift': 16, 'ctrl': 17, 'alt': 18,
'meta': 91, 'capslock': 20, 'esc': 27, 'space': 32, 'pageup': 33, 'pagedown': 34,
'end': 35, 'home': 36, 'left': 37, 'up': 38, 'right': 39, 'down': 40,
'insert': 45, 'delete': 46, 'numlock': 144,
};
// These apply to Firefox and Opera
var _mozilla_keycodes = {
'; :': 59, '= +': 61, '- _': 173, 'meta': 224, 'minus':173
};
// This apply to Webkit and IE
var _ie_keycodes = {
'; :': 186, '= +': 187, '- _': 189, 'minus':189
};
var browser = utils.browser[0];
var platform = utils.platform;
if (browser === 'Firefox' || browser === 'Opera' || browser === 'Netscape') {
$.extend(_keycodes, _mozilla_keycodes);
} else if (browser === 'Safari' || browser === 'Chrome' || browser === 'MSIE') {
$.extend(_keycodes, _ie_keycodes);
}
var keycodes = {};
var inv_keycodes = {};
for (var name in _keycodes) {
var names = name.split(' ');
if (names.length === 1) {
var n = names[0];
keycodes[n] = _keycodes[n];
inv_keycodes[_keycodes[n]] = n;
} else {
var primary = names[0];
var secondary = names[1];
keycodes[primary] = _keycodes[name];
keycodes[secondary] = _keycodes[name];
inv_keycodes[_keycodes[name]] = primary;
}
}
var normalize_key = function (key) {
return inv_keycodes[keycodes[key]];
};
var normalize_shortcut = function (shortcut) {
/**
* @function _normalize_shortcut
* @private
* return a dict containing the normalized shortcut and the number of time it should be pressed:
*
* Put a shortcut into normalized form:
* 1. Make lowercase
* 2. Replace cmd by meta
* 3. Sort '-' separated modifiers into the order alt-ctrl-meta-shift
* 4. Normalize keys
**/
if (platform === 'MacOS') {
shortcut = shortcut.toLowerCase().replace('cmdtrl-', 'cmd-');
} else {
shortcut = shortcut.toLowerCase().replace('cmdtrl-', 'ctrl-');
}
shortcut = shortcut.toLowerCase().replace('cmd', 'meta');
shortcut = shortcut.replace(/-$/, 'minus'); // catch shortcuts using '-' key
shortcut = shortcut.replace(/,$/, 'comma'); // catch shortcuts using '-' key
if(shortcut.indexOf(',') !== -1){
var sht = shortcut.split(',');
sht = _.map(sht, normalize_shortcut);
return shortcut;
}
shortcut = shortcut.replace(/comma/g, ','); // catch shortcuts using '-' key
var values = shortcut.split("-");
if (values.length === 1) {
return normalize_key(values[0]);
} else {
var modifiers = values.slice(0,-1);
var key = normalize_key(values[values.length-1]);
modifiers.sort();
return modifiers.join('-') + '-' + key;
}
};
var shortcut_to_event = function (shortcut, type) {
/**
* Convert a shortcut (shift-r) to a jQuery Event object
**/
type = type || 'keydown';
shortcut = normalize_shortcut(shortcut);
shortcut = shortcut.replace(/-$/, 'minus'); // catch shortcuts using '-' key
var values = shortcut.split("-");
var modifiers = values.slice(0,-1);
var key = values[values.length-1];
var opts = {which: keycodes[key]};
if (modifiers.indexOf('alt') !== -1) {opts.altKey = true;}
if (modifiers.indexOf('ctrl') !== -1) {opts.ctrlKey = true;}
if (modifiers.indexOf('meta') !== -1) {opts.metaKey = true;}
if (modifiers.indexOf('shift') !== -1) {opts.shiftKey = true;}
return $.Event(type, opts);
};
var only_modifier_event = function(event){
/**
* Return `true` if the event only contains modifiers keys.
* false otherwise
**/
var key = inv_keycodes[event.which];
return ((event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) &&
(key === 'alt'|| key === 'ctrl'|| key === 'meta'|| key === 'shift'));
};
var event_to_shortcut = function (event) {
/**
* Convert a jQuery Event object to a normalized shortcut string (shift-r)
**/
var shortcut = '';
var key = inv_keycodes[event.which];
if (event.altKey && key !== 'alt') {shortcut += 'alt-';}
if (event.ctrlKey && key !== 'ctrl') {shortcut += 'ctrl-';}
if (event.metaKey && key !== 'meta') {shortcut += 'meta-';}
if (event.shiftKey && key !== 'shift') {shortcut += 'shift-';}
shortcut += key;
return shortcut;
};
// Shortcut manager class
var ShortcutManager = function (delay, events, actions, env, config, mode) {
/**
* A class to deal with keyboard event and shortcut
*
* @class ShortcutManager
* @constructor
*
* :config: configobjet on which to call `update(....)` to persist the config.
* :mode: mode of this shortcut manager where to persist config.
*/
mode = mode || 'command';
this._shortcuts = {};
this._defaults_bindings = [];
this.delay = delay || 800; // delay in milliseconds
this.events = events;
this.actions = actions;
this.actions.extend_env(env);
this._queue = [];
this._cleartimeout = null;
this._config = config;
this._mode = mode;
Object.seal(this);
};
ShortcutManager.prototype.clearsoon = function(){
/**
* Clear the pending shortcut soon, and cancel previous clearing
* that might be registered.
**/
var that = this;
clearTimeout(this._cleartimeout);
this._cleartimeout = setTimeout(function(){that.clearqueue();}, this.delay);
};
ShortcutManager.prototype.clearqueue = function(){
/**
* clear the pending shortcut sequence now.
**/
this._queue = [];
clearTimeout(this._cleartimeout);
};
var flatten_shorttree = function(tree){
/**
* Flatten a tree of shortcut sequences.
* use full to iterate over all the key/values of available shortcuts.
**/
var dct = {};
_.forEach(tree, function(value, key) {
if(typeof(value) === 'string'){
dct[key] = value;
} else {
var ftree=flatten_shorttree(value);
_.forEach(ftree, function(v2, subkey) {
dct[key+','+subkey] = ftree[subkey];
});
}
});
return dct;
};
ShortcutManager.prototype.get_action_shortcuts = function(name){
var ftree = flatten_shorttree(this._shortcuts);
var res = [];
_.forEach(ftree, function(value, key) {
if(value === name){
res.push(key);
}
});
return res;
};
ShortcutManager.prototype.get_action_shortcut = function(name){
var matches = this.get_action_shortcuts(name);
if (matches.length > 0) {
return matches[0];
}
return undefined;
};
ShortcutManager.prototype.help = function () {
var that = this;
var help = [];
var ftree = flatten_shorttree(this._shortcuts);
_.forEach(ftree, function(value, key) {
var action = that.actions.get(value);
var help_string = action.help||'== no help ==';
var help_index = action.help_index;
if (help_string) {
var shortstring = (action.shortstring||key);
help.push({
shortcut: shortstring,
help: help_string,
help_index: help_index}
);
}
});
help.sort(function (a, b) {
if (a.help_index === b.help_index) {
if (a.shortcut === b.shortcut) {
return 0;
}
if (a.shortcut > b.shortcut) {
return 1;
}
return -1;
}
if (a.help_index === undefined || a.help_index > b.help_index){
return 1;
}
return -1;
});
return help;
};
ShortcutManager.prototype.clear_shortcuts = function () {
this._shortcuts = {};
};
ShortcutManager.prototype.get_shortcut = function (shortcut){
/**
* return a node of the shortcut tree which an action name (string) if leaf,
* and an object with `object.subtree===true`
**/
if(typeof(shortcut) === 'string'){
shortcut = shortcut.split(',');
}
return this._get_leaf(shortcut, this._shortcuts);
};
ShortcutManager.prototype._get_leaf = function(shortcut_array, tree){
/**
* @private
* find a leaf/node in a subtree of the keyboard shortcut
*
**/
if(shortcut_array.length === 1){
return tree[shortcut_array[0]];
} else if( typeof(tree[shortcut_array[0]]) !== 'string'){
return this._get_leaf(shortcut_array.slice(1), tree[shortcut_array[0]]);
}
return null;
};
ShortcutManager.prototype.set_shortcut = function( shortcut, action_name){
if( typeof(action_name) !== 'string'){throw new Error('action is not a string', action_name);}
if( typeof(shortcut) === 'string'){
shortcut = shortcut.split(',');
}
return this._set_leaf(shortcut, action_name, this._shortcuts);
};
ShortcutManager.prototype._is_leaf = function(shortcut_array, tree){
if(shortcut_array.length === 1){
return(typeof(tree[shortcut_array[0]]) === 'string');
} else {
var subtree = tree[shortcut_array[0]];
return this._is_leaf(shortcut_array.slice(1), subtree );
}
};
ShortcutManager.prototype._remove_leaf = function(shortcut_array, tree, allow_node){
if(shortcut_array.length === 1){
var current_node = tree[shortcut_array[0]];
if(typeof(current_node) === 'string'){
delete tree[shortcut_array[0]];
} else {
throw new Error('try to delete non-leaf');
}
} else {
this._remove_leaf(shortcut_array.slice(1), tree[shortcut_array[0]], allow_node);
if(_.keys(tree[shortcut_array[0]]).length === 0){
delete tree[shortcut_array[0]];
}
}
};
ShortcutManager.prototype.is_available_shortcut = function(shortcut){
var shortcut_array = shortcut.split(',');
return this._is_available_shortcut(shortcut_array, this._shortcuts);
};
ShortcutManager.prototype._is_available_shortcut = function(shortcut_array, tree){
var current_node = tree[shortcut_array[0]];
if(!shortcut_array[0]){
return false;
}
if(current_node === undefined){
return true;
} else {
if (typeof(current_node) === 'string'){
return false;
} else { // assume is a sub-shortcut tree
return this._is_available_shortcut(shortcut_array.slice(1), current_node);
}
}
};
ShortcutManager.prototype._set_leaf = function(shortcut_array, action_name, tree){
var current_node = tree[shortcut_array[0]];
if(shortcut_array.length === 1){
if(current_node !== undefined && typeof(current_node) !== 'string'){
console.warn('[warning], you are overriting a long shortcut with a shorter one');
}
tree[shortcut_array[0]] = action_name;
return true;
} else {
if(typeof(current_node) === 'string'){
console.warn('you are trying to set a shortcut that will be shadowed'+
'by a more specific one. Aborting for :', action_name, 'the following '+
'will take precedence', current_node);
return false;
} else {
tree[shortcut_array[0]] = tree[shortcut_array[0]]||{};
}
this._set_leaf(shortcut_array.slice(1), action_name, tree[shortcut_array[0]]);
return true;
}
};
ShortcutManager.prototype._persist_shortcut = function(shortcut, data) {
/**
* add a shortcut to this manager and persist it to the config file.
**/
shortcut = shortcut.toLowerCase();
this.add_shortcut(shortcut, data);
var patch = {keys:{}};
patch.keys[this._mode] = {bind:{}};
patch.keys[this._mode].bind[shortcut] = data;
this._config.update(patch);
};
ShortcutManager.prototype._persist_remove_shortcut = function(shortcut){
/**
* Remove a shortcut from this manager and persist its removal.
*/
shortcut = shortcut.toLowerCase();
this.remove_shortcut(shortcut);
var patch = {keys: {}};
patch.keys[this._mode] = {bind:{}};
patch.keys[this._mode].bind[shortcut] = null;
this._config.update(patch);
// if the shortcut we unbind is a default one, we add it to the list of
// things to unbind at startup
if( this._defaults_bindings.indexOf(shortcut) !== -1 ){
var cnf = (this._config.data.keys || {})[this._mode];
var unbind_array = cnf.unbind || [];
// unless it's already there (like if we have remapped a default
// shortcut to another command): unbind it)
if(unbind_array.indexOf(shortcut) === -1){
var _parray = unbind_array.concat(shortcut);
var unbind_patch = {keys:{}};
unbind_patch.keys[this._mode] = {unbind:_parray};
console.warn('up:', unbind_patch);
this._config.update(unbind_patch);
}
}
};
ShortcutManager.prototype.add_shortcut = function (shortcut, data, suppress_help_update) {
/**
* Add an action to be handled by shortcut manager.
*
* - `shortcut` should be a `Shortcut Sequence` of the for `Ctrl-Alt-C,Meta-X`...
* - `data` could be an `action name`, an `action` or a `function`.
* if a `function` is passed it will be converted to an anonymous `action`.
*
**/
var action_name = this.actions.get_name(data);
if (! action_name){
if (typeof data === 'string') {
// If we have an action name, allow it to be bound anyway.
console.log("Unknown action '" + data + "' for shortcut " + shortcut
+ "; it may be defined by an extension which is not yet loaded.");
action_name = data;
} else {
throw new Error('does not know how to deal with : ' + data);
}
}
var _shortcut = normalize_shortcut(shortcut);
this.set_shortcut(_shortcut, action_name);
if (!suppress_help_update) {
// update the keyboard shortcuts notebook help
this.events.trigger('rebuild.QuickHelp');
}
};
ShortcutManager.prototype.add_shortcuts = function (data) {
/**
* Convenient methods to call `add_shortcut(key, value)` on several items
*
* data : Dict of the form {key:value, ...}
**/
var that = this;
_.forEach(data, function(value, key) {
that.add_shortcut(key, value, true);
});
// update the keyboard shortcuts notebook help
this.events.trigger('rebuild.QuickHelp');
};
ShortcutManager.prototype._add_default_shortcuts = function (data) {
/**
* same as add_shortcuts, but register them as "default" that if persistently unbound, with
* persist_remove_shortcut, need to be on the "unbind" list.
**/
this._defaults_bindings = this._defaults_bindings.concat(Object.keys(data));
this.add_shortcuts(data);
};
ShortcutManager.prototype.remove_shortcut = function (shortcut, suppress_help_update) {
/**
* Remove the binding of shortcut `shortcut` with its action.
* throw an error if trying to remove a non-exiting shortcut
**/
if(!shortcut){
console.warn('trying to remove empty shortcut');
return;
}
shortcut = normalize_shortcut(shortcut);
if( typeof(shortcut) === 'string'){
shortcut = shortcut.split(',');
}
/*
* The shortcut error should be explicit here, because it will be
* seen by users.
*/
try {
this._remove_leaf(shortcut, this._shortcuts);
if (!suppress_help_update) {
// update the keyboard shortcuts notebook help
this.events.trigger('rebuild.QuickHelp');
}
} catch (ex) {
throw new Error('trying to remove a non-existent shortcut', shortcut, typeof shortcut);
}
};
ShortcutManager.prototype.call_handler = function (event) {
/**
* Call the corresponding shortcut handler for a keyboard event
* @method call_handler
* @return {Boolean} `true|false`, `false` if no handler was found, otherwise the value return by the handler.
* @param event {event}
*
* given an event, call the corresponding shortcut.
* return false is event wan handled, true otherwise
* in any case returning false stop event propagation
**/
this.clearsoon();
if(only_modifier_event(event)){
return true;
}
var shortcut = event_to_shortcut(event);
this._queue.push(shortcut);
var action_name = this.get_shortcut(this._queue);
if (typeof(action_name) === 'undefined'|| action_name === null){
this.clearqueue();
return true;
}
if (this.actions.exists(action_name)) {
event.preventDefault();
this.clearqueue();
return this.actions.call(action_name, event);
}
return false;
};
ShortcutManager.prototype.handles = function (event) {
var shortcut = event_to_shortcut(event);
var action_name = this.get_shortcut(this._queue.concat(shortcut));
return (typeof(action_name) !== 'undefined');
};
return {
keycodes : keycodes,
inv_keycodes : inv_keycodes,
ShortcutManager : ShortcutManager,
normalize_key : normalize_key,
normalize_shortcut : normalize_shortcut,
shortcut_to_event : shortcut_to_event,
event_to_shortcut : event_to_shortcut,
};
});

View file

@ -0,0 +1,83 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var Jupyter = Jupyter || {};
var jprop = function(name, module_path){
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `requirejs("'+module_path+'")`');
return requirejs(module_path);
},
enumerable: true,
configurable: false
});
}
var jglobal = function(name, module_path){
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `requirejs("'+module_path+'").'+name+'`');
return requirejs(module_path)[name];
},
enumerable: true,
configurable: false
});
}
define(function(){
"use strict";
// expose modules
jprop('utils','base/js/utils')
//Jupyter.load_extensions = Jupyter.utils.load_extensions;
//
jprop('security','base/js/security');
jprop('keyboard','base/js/keyboard');
jprop('dialog','base/js/dialog');
jprop('mathjaxutils','notebook/js/mathjaxutils');
//// exposed constructors
jglobal('CommManager','services/kernels/comm')
jglobal('Comm','services/kernels/comm')
jglobal('NotificationWidget','base/js/notificationwidget');
jglobal('Kernel','services/kernels/kernel');
jglobal('Session','services/sessions/session');
jglobal('LoginWidget','auth/js/loginwidget');
jglobal('Page','base/js/page');
// notebook
jglobal('TextCell','notebook/js/textcell');
jglobal('OutputArea','notebook/js/outputarea');
jglobal('KeyboardManager','notebook/js/keyboardmanager');
jglobal('Completer','notebook/js/completer');
jglobal('Notebook','notebook/js/notebook');
jglobal('Tooltip','notebook/js/tooltip');
jglobal('Toolbar','notebook/js/toolbar');
jglobal('SaveWidget','notebook/js/savewidget');
jglobal('Pager','notebook/js/pager');
jglobal('QuickHelp','notebook/js/quickhelp');
jglobal('MarkdownCell','notebook/js/textcell');
jglobal('RawCell','notebook/js/textcell');
jglobal('Cell','notebook/js/cell');
jglobal('MainToolBar','notebook/js/maintoolbar');
jglobal('NotebookNotificationArea','notebook/js/notificationarea');
jglobal('NotebookTour', 'notebook/js/tour');
jglobal('MenuBar', 'notebook/js/menubar');
// tree
jglobal('SessionList','tree/js/sessionlist');
Jupyter.version = "6.1.5";
Jupyter._target = '_blank';
return Jupyter;
});
// deprecated since 4.0, remove in 5+
var IPython = Jupyter;

View file

@ -0,0 +1,83 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/notificationwidget',
], function($, notificationwidget) {
"use strict";
// store reference to the NotificationWidget class
var NotificationWidget = notificationwidget.NotificationWidget;
/**
* Construct the NotificationArea object. Options are:
* events: $(Events) instance
* save_widget: SaveWidget instance
* notebook: Notebook instance
* keyboard_manager: KeyboardManager instance
*
* @constructor
* @param {string} selector - a jQuery selector string for the
* notification area element
* @param {Object} [options] - a dictionary of keyword arguments.
*/
var NotificationArea = function (selector, options) {
this.selector = selector;
this.events = options.events;
if (this.selector !== undefined) {
this.element = $(selector);
}
this.widget_dict = {};
};
/**
* Get a widget by name, creating it if it doesn't exist.
*
* @method widget
* @param {string} name - the widget name
*/
NotificationArea.prototype.widget = function (name) {
if (this.widget_dict[name] === undefined) {
return this.new_notification_widget(name);
}
return this.get_widget(name);
};
/**
* Get a widget by name, throwing an error if it doesn't exist.
*
* @method get_widget
* @param {string} name - the widget name
*/
NotificationArea.prototype.get_widget = function (name) {
if(this.widget_dict[name] === undefined) {
throw new Error('no widgets with this name');
}
return this.widget_dict[name];
};
/**
* Create a new notification widget with the given name. The
* widget must not already exist.
*
* @method new_notification_widget
* @param {string} name - the widget name
*/
NotificationArea.prototype.new_notification_widget = function (name) {
if (this.widget_dict[name] !== undefined) {
throw new Error('widget with that name already exists!');
}
// create the element for the notification widget and add it
// to the notification aread element
var div = $('<div/>').attr('id', 'notification_' + name);
$(this.selector).append(div);
// create the widget object and return it
this.widget_dict[name] = new NotificationWidget('#notification_' + name);
return this.widget_dict[name];
};
return {'NotificationArea': NotificationArea};
});

View file

@ -0,0 +1,168 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['jquery'], function($) {
"use strict";
/**
* Construct a NotificationWidget object.
*
* @constructor
* @param {string} selector - a jQuery selector string for the
* notification widget element
*/
var NotificationWidget = function (selector) {
this.selector = selector;
this.timeout = null;
this.busy = false;
if (this.selector !== undefined) {
this.element = $(selector);
this.style();
}
this.element.hide();
this.inner = $('<span/>');
this.element.append(this.inner);
};
/**
* Add the 'notification_widget' CSS class to the widget element.
*
* @method style
*/
NotificationWidget.prototype.style = function () {
// use explicit bootstrap classes here,
// because multiple inheritance in LESS doesn't work
// for this particular combination
this.element.addClass('notification_widget btn btn-xs navbar-btn');
};
/**
* hide the widget and empty the text
**/
NotificationWidget.prototype.hide = function () {
var that = this;
this.element.fadeOut(100, function(){that.inner.text('');});
};
/**
* Set the notification widget message to display for a certain
* amount of time (timeout). The widget will be shown forever if
* timeout is <= 0 or undefined. If the widget is clicked while it
* is still displayed, execute an optional callback
* (click_callback). If the callback returns false, it will
* prevent the notification from being dismissed.
*
* Options:
* class - CSS class name for styling
* icon - CSS class name for the widget icon
* title - HTML title attribute for the widget
*
* @method set_message
* @param {string} msg - The notification to display
* @param {integer} [timeout] - The amount of time in milliseconds to display the widget
* @param {function} [click_callback] - The function to run when the widget is clicked
* @param {Object} [options] - Additional options
*/
NotificationWidget.prototype.set_message = function (msg, timeout, click_callback, options) {
options = options || {};
// unbind potential previous callback
this.element.unbind('click');
this.inner.attr('class', options.icon);
this.inner.attr('title', options.title);
this.inner.text(msg);
this.element.fadeIn(100);
// reset previous set style
this.element.removeClass();
this.style();
if (options.class) {
this.element.addClass(options.class);
}
// clear previous timer
if (this.timeout !== null) {
clearTimeout(this.timeout);
this.timeout = null;
}
// set the timer if a timeout is given
var that = this;
if (timeout !== undefined && timeout >= 0) {
this.timeout = setTimeout(function () {
that.element.fadeOut(100, function () {that.inner.text('');});
that.element.unbind('click');
that.timeout = null;
}, timeout);
}
// if no click callback assume we will just dismiss the notification
if (click_callback === undefined) {
click_callback = function(){return true};
}
// on click, remove widget if click callback say so
// and unbind click event.
this.element.click(function () {
if (click_callback() !== false) {
that.element.fadeOut(100, function () {that.inner.text('');});
that.element.unbind('click');
}
if (that.timeout !== null) {
clearTimeout(that.timeout);
that.timeout = null;
}
});
};
/**
* Display an information message (styled with the 'info'
* class). Arguments are the same as in set_message. Default
* timeout is 3500 milliseconds.
*
* @method info
*/
NotificationWidget.prototype.info = function (msg, timeout, click_callback, options) {
options = options || {};
options.class = options.class + ' info';
timeout = timeout || 3500;
this.set_message(msg, timeout, click_callback, options);
};
/**
* Display a warning message (styled with the 'warning'
* class). Arguments are the same as in set_message. Messages are
* sticky by default.
*
* @method warning
*/
NotificationWidget.prototype.warning = function (msg, timeout, click_callback, options) {
options = options || {};
options.class = options.class + ' warning';
this.set_message(msg, timeout, click_callback, options);
};
/**
* Display a danger message (styled with the 'danger'
* class). Arguments are the same as in set_message. Messages are
* sticky by default.
*
* @method danger
*/
NotificationWidget.prototype.danger = function (msg, timeout, click_callback, options) {
options = options || {};
options.class = options.class + ' danger';
this.set_message(msg, timeout, click_callback, options);
};
/**
* Get the text of the widget message.
*
* @method get_message
* @return {string} - the message text
*/
NotificationWidget.prototype.get_message = function () {
return this.inner.html();
};
return {'NotificationWidget': NotificationWidget};
});

View file

@ -0,0 +1,78 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'base/js/events',
], function($, events){
"use strict";
var Page = function (header_div_selector, site_div_selector) {
/**
* Constructor
*
* Parameters
* header_div_selector: string
* site_div_selector: string
*/
this.header_div_element = $(header_div_selector || 'div#header');
this.site_div_element = $(site_div_selector || 'div#site');
this.bind_events();
};
Page.prototype.bind_events = function () {
// resize site on:
// - window resize
// - header change
// - page load
var _handle_resize = $.proxy(this._resize_site, this);
$(window).resize(_handle_resize);
// On document ready, resize codemirror.
$(document).ready(_handle_resize);
events.on('resize-header.Page', _handle_resize);
};
Page.prototype.show = function () {
/**
* The header and site divs start out hidden to prevent FLOUC.
* Main scripts should call this method after styling everything.
*/
this.show_header();
this.show_site();
};
Page.prototype.show_header = function () {
/**
* The header and site divs start out hidden to prevent FLOUC.
* Main scripts should call this method after styling everything.
*/
this.header_div_element.css('display','block');
};
Page.prototype.show_site = function () {
/**
* The header and site divs start out hidden to prevent FLOUC.
* Main scripts should call this method after styling everything.
*/
this.site_div_element.css('display', 'block');
this._resize_site();
};
Page.prototype._resize_site = function(e) {
/**
* Update the site's size.
*/
// In the case an event is passed in, only trigger if the event does
// *not* have a target DOM node (i.e., it is not bubbling up). See
// https://bugs.jquery.com/ticket/9841#comment:8
if (!(e && e.target && e.target.tagName)) {
$('div#site').height($(window).height() - $('#header').height());
}
};
return {'Page': Page};
});

View file

@ -0,0 +1,26 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
// Define an object to attach promises to for one-time events.
define(['base/js/events', 'base/js/namespace'], function(events, Jupyter) {
"use strict";
// Promise to be resolved when the application is initialized.
// The value is the name of the app on the current page.
var app_initialized = new Promise(function(resolve, reject) {
events.on('app_initialized.NotebookApp', function() {
resolve('NotebookApp');
});
events.on('app_initialized.DashboardApp', function() {
resolve('DashboardApp');
});
});
var promises = {
app_initialized: app_initialized
};
Jupyter.promises = promises;
return promises;
});

View file

@ -0,0 +1,152 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([
'jquery',
'components/google-caja/html-css-sanitizer-minified',
], function($, sanitize) {
"use strict";
var noop = function (x) { return x; };
var caja;
if (window && window.html) {
caja = window.html;
caja.html4 = window.html4;
caja.sanitizeStylesheet = window.sanitizeStylesheet;
}
var sanitizeAttribs = function (tagName, attribs, opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger) {
/**
* add trusting data-attributes to the default sanitizeAttribs from caja
* this function is mostly copied from the caja source
*/
var ATTRIBS = caja.html4.ATTRIBS;
for (var i = 0; i < attribs.length; i += 2) {
var attribName = attribs[i];
if (attribName.substr(0,5) == 'data-') {
var attribKey = '*::' + attribName;
if (!ATTRIBS.hasOwnProperty(attribKey)) {
ATTRIBS[attribKey] = 0;
}
}
}
// Caja doesn't allow data uri for img::src, see
// https://github.com/google/caja/issues/1558
// This is not a security issue for browser post ie6 though, so we
// disable the check
// https://www.owasp.org/index.php/Script_in_IMG_tags
ATTRIBS['img::src'] = 0;
return caja.sanitizeAttribs(tagName, attribs, opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger);
};
var sanitize_css = function (css, tagPolicy) {
/**
* sanitize CSS
* like sanitize_html, but for CSS
* called by sanitize_stylesheets
*/
return caja.sanitizeStylesheet(
window.location.pathname,
css,
{
containerClass: null,
idSuffix: '',
tagPolicy: tagPolicy,
virtualizeAttrName: noop
},
noop
);
};
var sanitize_stylesheets = function (html, tagPolicy) {
/**
* sanitize just the css in style tags in a block of html
* called by sanitize_html, if allow_css is true
*/
var h = $("<div/>").append(html);
var style_tags = h.find("style");
if (!style_tags.length) {
// no style tags to sanitize
return html;
}
style_tags.each(function(i, style) {
style.innerHTML = sanitize_css(style.innerHTML, tagPolicy);
});
return h.html();
};
var sanitize_html = function (html, allow_css) {
/**
* sanitize HTML
* if allow_css is true (default: false), CSS is sanitized as well.
* otherwise, CSS elements and attributes are simply removed.
*/
var html4 = caja.html4;
if (allow_css) {
// allow sanitization of style tags,
// not just scrubbing
html4.ELEMENTS.style &= ~html4.eflags.UNSAFE;
html4.ATTRIBS.style = html4.atype.STYLE;
} else {
// scrub all CSS
html4.ELEMENTS.style |= html4.eflags.UNSAFE;
html4.ATTRIBS.style = html4.atype.SCRIPT;
}
var record_messages = function (msg, opts) {
console.log("HTML Sanitizer", msg, opts);
};
var policy = function (tagName, attribs) {
if (!(html4.ELEMENTS[tagName] & html4.eflags.UNSAFE)) {
return {
'attribs': sanitizeAttribs(tagName, attribs,
noop, noop, record_messages)
};
} else {
record_messages(tagName + " removed", {
change: "removed",
tagName: tagName
});
}
};
var sanitized = caja.sanitizeWithPolicy(html, policy);
if (allow_css) {
// sanitize style tags as stylesheets
sanitized = sanitize_stylesheets(sanitized, policy);
}
return sanitized;
};
var sanitize_html_and_parse = function (html, allow_css) {
/**
* Sanitize HTML and parse it safely using jQuery.
*
* This disable's jQuery's html 'prefilter', which can make invalid
* HTML valid after the sanitizer has checked it.
*
* Returns an array of DOM nodes.
*/
var sanitized_html = sanitize_html(html, allow_css);
var prev_htmlPrefilter = $.htmlPrefilter;
$.htmlPrefilter = function(html) {return html;}; // Don't modify HTML
try {
return $.parseHTML(sanitized_html);
} finally {
$.htmlPrefilter = prev_htmlPrefilter; // Set it back again
}
};
var security = {
caja: caja,
sanitize_html_and_parse: sanitize_html_and_parse,
sanitize_html: sanitize_html
};
return security;
});

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,45 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['bidi/numericshaping'], function(numericshaping) {
'use strict';
var shaperType = '';
var _uiLang = function() {
return navigator.language.toLowerCase();
};
var _loadLocale = function() {
if (_isMirroringEnabled()) {
document.body.dir = 'rtl';
}
requirejs(['moment'], function (moment) {
console.log('Loaded moment locale', moment.locale(_uiLang()));
});
shaperType = _uiLang().split('-')[0] == 'ar' ? 'national' : 'defaultNumeral';
};
var _isMirroringEnabled = function() {
return new RegExp('^(ar|ara|arc|ae|ave|egy|he|heb|nqo|pal|phn|sam|syc|syr|fa|per|fas|ckb|ur|urd)').test(_uiLang());
};
/**
* @param value : the string to apply the bidi-support on it.
* @param flag :indicates the type of bidi-support (Numeric-shaping ,Base-text-dir ).
*/
var _applyBidi = function(value /*, flag*/) {
value = numericshaping.shapeNumerals(value, shaperType);
return value;
};
var bidi = {
applyBidi: _applyBidi,
isMirroringEnabled: _isMirroringEnabled,
loadLocale: _loadLocale,
};
return bidi;
});

View file

@ -0,0 +1,42 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define([],
function(bidi) {
"use strict";
var regex = /([0-9])|([\u0660-\u0669])|([\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08E3\u200F\u202B\u202E\u2067\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFC\uFDFE-\uFDFF\uFE70-\uFEFE]+)|([^0-9\u0660-\u0669\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08E3\u200F\u202B\u202E\u2067\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFC\uFDFE-\uFDFF\uFE70-\uFEFE\u0600-\u0607\u0609-\u060A\u060C\u060E-\u061A\u064B-\u066C\u0670\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u08E4-\u08FF\uFD3E-\uFD3F\uFDD0-\uFDEF\uFDFD\uFEFF\u0000-\u0040\u005B-\u0060\u007B-\u007F\u0080-\u00A9\u00AB-\u00B4\u00B6-\u00B9\u00BB-\u00BF\u00D7\u00F7\u02B9-\u02BA\u02C2-\u02CF\u02D2-\u02DF\u02E5-\u02ED\u02EF-\u02FF\u2070\u2074-\u207E\u2080-\u208E\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A-\u213B\u2140-\u2144\u214A-\u214D\u2150-\u215F\u2189\uA720-\uA721\uA788\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE]+)/g;
var shape = function(text, shaperType) {
text = text.toString();
if (!text) {
return text;
}
switch (shaperType) {
case "defaultNumeral":
return _shapeEuropean(text);
case "national":
return _shapeArabic(text);
default:
return text;
}
};
var _shapeEuropean = function(text) {
return text.replace(/[\u0660-\u0669]/g, function(c) {
return c.charCodeAt(0) - 1632;
});
};
var _shapeArabic = function(text) {
return text.replace(/[0-9]/g, function(c) {
return String.fromCharCode(parseInt(c) + 1632);
});
};
var numericshaping = {
shapeNumerals : shape
};
return numericshaping;
});

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/config/Safe.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.
*/
MathJax.Hub.Register.StartupHook("End Config",function(){if(!MathJax.Hub.config.extensions){MathJax.Hub.config.extensions=[]}MathJax.Hub.config.extensions.push("Safe.js")});MathJax.Ajax.loadComplete("[MathJax]/config/Safe.js");

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/AssistiveMML.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(a,e,b,f){var c=b.config.menuSettings;var d=MathJax.Extension.AssistiveMML={version:"2.7.9",config:b.CombineConfig("AssistiveMML",{disabled:false,styles:{".MJX_Assistive_MathML":{position:"absolute!important",top:0,left:0,clip:(b.Browser.isMSIE&&(document.documentMode||0)<8?"rect(1px 1px 1px 1px)":"rect(1px, 1px, 1px, 1px)"),padding:"1px 0 0 0!important",border:"0!important",height:"1px!important",width:"1px!important",overflow:"hidden!important",display:"block!important","-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},".MJX_Assistive_MathML.MJX_Assistive_MathML_Block":{width:"100%!important"}}}),Config:function(){if(!this.config.disabled&&c.assistiveMML==null){b.Config({menuSettings:{assistiveMML:true}})}a.Styles(this.config.styles);b.Register.MessageHook("End Math",function(g){if(c.assistiveMML){return d.AddAssistiveMathML(g[1])}})},AddAssistiveMathML:function(g){var h={jax:b.getAllJax(g),i:0,callback:MathJax.Callback({})};this.HandleMML(h);return h.callback},RemoveAssistiveMathML:function(k){var h=b.getAllJax(k),l;for(var j=0,g=h.length;j<g;j++){l=document.getElementById(h[j].inputID+"-Frame");if(l&&l.getAttribute("data-mathml")){l.removeAttribute("data-mathml");if(l.lastChild&&l.lastChild.className.match(/MJX_Assistive_MathML/)){l.removeChild(l.lastChild)}}}},HandleMML:function(n){var h=n.jax.length,i,j,o,k;var g=MathJax.ElementJax.mml;g.copyAttributes.id=1;while(n.i<h){i=n.jax[n.i];o=document.getElementById(i.inputID+"-Frame");if(i.outputJax!=="NativeMML"&&i.outputJax!=="PlainSource"&&o&&!o.getAttribute("data-mathml")){try{j=i.root.toMathML("").replace(/\n */g,"").replace(/<!--.*?-->/g,"")}catch(l){g.copyAttributes.id=true;if(!l.restart){throw l}return MathJax.Callback.After(["HandleMML",this,n],l.restart)}o.setAttribute("data-mathml",j);k=f.addElement(o,"span",{isMathJax:true,unselectable:"on",className:"MJX_Assistive_MathML"+(i.root.Get("display")==="block"?" MJX_Assistive_MathML_Block":"")});try{k.innerHTML=j}catch(l){}o.style.position="relative";o.setAttribute("role","presentation");o.firstChild.setAttribute("aria-hidden","true");k.setAttribute("role","presentation")}n.i++}g.copyAttributes.id=true;n.callback()}};b.Startup.signal.Post("AssistiveMML Ready")})(MathJax.Ajax,MathJax.Callback,MathJax.Hub,MathJax.HTML);MathJax.Callback.Queue(["Require",MathJax.Ajax,"[MathJax]/extensions/toMathML.js"],["loadComplete",MathJax.Ajax,"[MathJax]/extensions/AssistiveMML.js"],function(){MathJax.Hub.Register.StartupHook("End Config",["Config",MathJax.Extension.AssistiveMML])});

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/CHTML-preview.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.
*/
MathJax.Callback.Queue(["Require",MathJax.Ajax,"[MathJax]/extensions/fast-preview.js"],["loadComplete",MathJax.Ajax,"[MathJax]/extensions/CHTML-preview.js"]);

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/FontWarnings.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(b,d){var i="2.7.9";var a="http://www.stixfonts.org/";var f="https://github.com/mathjax/MathJax/tree/master/fonts/HTML-CSS/TeX/otf";var h=b.CombineConfig("FontWarnings",{messageStyle:{position:"fixed",bottom:"4em",left:"3em",width:"40em",border:"3px solid #880000","background-color":"#E0E0E0",color:"black",padding:"1em","font-size":"small","white-space":"normal","border-radius":".75em","-webkit-border-radius":".75em","-moz-border-radius":".75em","-khtml-border-radius":".75em","box-shadow":"4px 4px 10px #AAAAAA","-webkit-box-shadow":"4px 4px 10px #AAAAAA","-moz-box-shadow":"4px 4px 10px #AAAAAA","-khtml-box-shadow":"4px 4px 10px #AAAAAA",filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=3, OffY=3, Color='gray', Positive='true')"},Message:{webFont:[["closeBox"],["webFont","MathJax is using web-based fonts to display the mathematics on this page. These take time to download, so the page would render faster if you installed math fonts directly in your system's font folder."],["fonts"]],imageFonts:[["closeBox"],["imageFonts","MathJax is using its image fonts rather than local or web-based fonts. This will render slower than usual, and the mathematics may not print at the full resolution of your printer."],["fonts"],["webFonts"]],noFonts:[["closeBox"],["noFonts","MathJax is unable to locate a font to use to display its mathematics, and image fonts are not available, so it is falling back on generic unicode characters in hopes that your browser will be able to display them. Some characters may not show up properly, or possibly not at all."],["fonts"],["webFonts"]]},HTML:{closeBox:[["div",{style:{position:"absolute",overflow:"hidden",top:".1em",right:".1em",border:"1px outset",width:"1em",height:"1em","text-align":"center",cursor:"pointer","background-color":"#EEEEEE",color:"#606060","border-radius":".5em","-webkit-border-radius":".5em","-moz-border-radius":".5em","-khtml-border-radius":".5em"},onclick:function(){if(c.div&&c.fade===0){if(c.timer){clearTimeout(c.timer)}c.div.style.display="none"}}},[["span",{style:{position:"relative",bottom:".2em"}},["x"]]]]],webFonts:[["p"],["webFonts","Most modern browsers allow for fonts to be downloaded over the web. Updating to a more recent version of your browser (or changing browsers) could improve the quality of the mathematics on this page."]],fonts:[["p"],["fonts","MathJax can use either the [STIX fonts](%1) or the [MathJax TeX fonts](%2). Download and install one of those fonts to improve your MathJax experience.",a,f]],STIXfonts:[["p"],["STIXPage","This page is designed to use the [STIX fonts](%1). Download and install those fonts to improve your MathJax experience.",a]],TeXfonts:[["p"],["TeXPage","This page is designed to use the [MathJax TeX fonts](%1). Download and install those fonts to improve your MathJax experience.",f]]},removeAfter:12*1000,fadeoutSteps:10,fadeoutTime:1.5*1000});if(MathJax.Hub.Browser.isIE9&&document.documentMode>=9){delete h.messageStyle.filter}var c={div:null,fade:0};var e=function(m){if(c.div){return}var j=MathJax.OutputJax["HTML-CSS"],n=document.body;if(b.Browser.isMSIE){if(h.messageStyle.position==="fixed"){MathJax.Message.Init();n=document.getElementById("MathJax_MSIE_Frame")||n;if(n!==document.body){h.messageStyle.position="absolute"}}}else{delete h.messageStyle.filter}h.messageStyle.maxWidth=(document.body.clientWidth-75)+"px";var k=0;while(k<m.length){if(MathJax.Object.isArray(m[k])){if(m[k].length===1&&h.HTML[m[k][0]]){m.splice.apply(m,[k,1].concat(h.HTML[m[k][0]]))}else{if(typeof m[k][1]==="string"){var l=MathJax.Localization.lookupPhrase(["FontWarnings",m[k][0]],m[k][1]);l=MathJax.Localization.processMarkdown(l,m[k].slice(2),"FontWarnings");m.splice.apply(m,[k,1].concat(l));k+=l.length}else{k++}}}else{k++}}c.div=j.addElement(n,"div",{id:"MathJax_FontWarning",style:h.messageStyle},m);MathJax.Localization.setCSS(c.div);if(h.removeAfter){b.Register.StartupHook("End",function(){c.timer=setTimeout(g,h.removeAfter)})}d.Cookie.Set("fontWarn",{warned:true})};var g=function(){c.fade++;if(c.timer){delete c.timer}if(c.fade<h.fadeoutSteps){var j=1-c.fade/h.fadeoutSteps;c.div.style.opacity=j;c.div.style.filter="alpha(opacity="+Math.floor(100*j)+")";setTimeout(g,h.fadeoutTime/h.fadeoutSteps)}else{c.div.style.display="none"}};if(!d.Cookie.Get("fontWarn").warned){b.Startup.signal.Interest(function(m){if(m.match(/HTML-CSS Jax - /)&&!c.div){var j=MathJax.OutputJax["HTML-CSS"],n=j.config.availableFonts,l;var k=(n&&n.length);if(!k){h.HTML.fonts=[""]}else{if(n.length===1){h.HTML.fonts=h.HTML[n[0]+"fonts"]}}if(j.allowWebFonts){h.HTML.webfonts=[""]}if(m.match(/- Web-Font/)){if(k){l="webFont"}}else{if(m.match(/- using image fonts/)){l="imageFonts"}else{if(m.match(/- no valid font/)){l="noFonts"}}}if(l&&h.Message[l]){MathJax.Localization.loadDomain("FontWarnings",[e,h.Message[l]])}}})}})(MathJax.Hub,MathJax.HTML);MathJax.Ajax.loadComplete("[MathJax]/extensions/FontWarnings.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/HTML-CSS/handle-floats.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.
*/
MathJax.Extension["HTML-CSS/handle-floats"]={version:"2.7.9"};MathJax.Hub.Startup.signal.Post("HTML-CSS handle-floats Ready");MathJax.Ajax.loadComplete("[MathJax]/extensions/HTML-CSS/handle-floats.js");

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/MatchWebFonts.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,b){var d="2.7.9";var a=MathJax.Hub.CombineConfig("MatchWebFonts",{matchFor:{"HTML-CSS":true,NativeMML:true,SVG:true},fontCheckDelay:500,fontCheckTimeout:15*1000,});MathJax.Extension.MatchWebFonts={version:d,config:a};c.Register.StartupHook("HTML-CSS Jax Ready",function(){var e=MathJax.OutputJax["HTML-CSS"];var f=e.postTranslate;e.Augment({postTranslate:function(h,g){if(!g&&a.matchFor["HTML-CSS"]&&this.config.matchFontHeight){b.timer.start(b,["checkFonts",this,h.jax[this.id]],a.fontCheckDelay,a.fontCheckTimeout)}return f.apply(this,arguments)},checkFonts:function(k,o){if(k.time(function(){})){return}var s=[],p,l,g=false;for(p=0,l=o.length;p<l;p++){script=o[p];if(script.parentNode&&script.MathJax.elementJax){script.parentNode.insertBefore(this.EmExSpan.cloneNode(true),script)}}for(p=0,l=o.length;p<l;p++){script=o[p];if(!script.parentNode){continue}g=true;var h=script.MathJax.elementJax;if(!h){continue}var r=script.previousSibling;var q=r.firstChild.offsetHeight/60;var j=r.lastChild.lastChild.offsetHeight/60;if(q===0||q==="NaN"){q=this.defaultEx;j=this.defaultEm}if(q!==h.HTMLCSS.ex||j!==h.HTMLCSS.em){var n=q/this.TeX.x_height/j;n=Math.floor(Math.max(this.config.minScaleAdjust/100,n)*this.config.scale);if(n/100!==h.scale){s.push(script);o[p]={}}}}o=o.concat(s);for(p=0,l=o.length;p<l;p++){script=o[p];if(script&&script.parentNode&&script.MathJax.elementJax){script.parentNode.removeChild(script.previousSibling)}}if(s.length){c.Queue(["Rerender",c,[s],{}])}if(g){setTimeout(k,k.delay)}}})});c.Register.StartupHook("SVG Jax Ready",function(){var f=MathJax.OutputJax.SVG;var e=f.postTranslate;f.Augment({postTranslate:function(h,g){if(!g&&a.matchFor.SVG){b.timer.start(b,["checkFonts",this,h.jax[this.id]],a.fontCheckDelay,a.fontCheckTimeout)}return e.apply(this,arguments)},checkFonts:function(j,l){if(j.time(function(){})){return}var q=[],n,k,g=false;for(n=0,k=l.length;n<k;n++){script=l[n];if(script.parentNode&&script.MathJax.elementJax){script.parentNode.insertBefore(this.ExSpan.cloneNode(true),script)}}for(n=0,k=l.length;n<k;n++){script=l[n];if(!script.parentNode){continue}g=true;var h=script.MathJax.elementJax;if(!h){continue}var p=script.previousSibling;var o=p.firstChild.offsetHeight/60;if(o===0||o==="NaN"){o=this.defaultEx}if(o!==h.SVG.ex){q.push(script);l[n]={}}}l=l.concat(q);for(n=0,k=l.length;n<k;n++){script=l[n];if(script.parentNode&&script.MathJax.elementJax){script.parentNode.removeChild(script.previousSibling)}}if(q.length){c.Queue(["Rerender",c,[q],{}])}if(g){setTimeout(j,j.delay)}}})});c.Register.StartupHook("NativeMML Jax Ready",function(){var e=MathJax.OutputJax.NativeMML;var f=e.postTranslate;e.Augment({postTranslate:function(g){if(!c.Browser.isMSIE&&a.matchFor.NativeMML){b.timer.start(b,["checkFonts",this,g.jax[this.id]],a.fontCheckDelay,a.fontCheckTimeout)}f.apply(this,arguments)},checkFonts:function(A,l){if(A.time(function(){})){return}var t=[],q=[],o=[],w,s,B;for(w=0,s=l.length;w<s;w++){B=l[w];if(B.parentNode&&B.MathJax.elementJax){B.parentNode.insertBefore(this.EmExSpan.cloneNode(true),B)}}for(w=0,s=l.length;w<s;w++){B=l[w];if(!B.parentNode){continue}var g=B.MathJax.elementJax;if(!g){continue}var v=document.getElementById(g.inputID+"-Frame");var k=v.getElementsByTagName("math")[0];if(!k){continue}g=g.NativeMML;var y=B.previousSibling;var z=y.firstChild.offsetWidth/60;var h=y.lastChild.offsetWidth/60;if(z===0||z==="NaN"){z=this.defaultEx;h=this.defaultMEx}var r=(z!==g.ex);if(r||h!=g.mex){var C=(this.config.matchFontHeight&&h>1?z/h:1);C=Math.floor(Math.max(this.config.minScaleAdjust/100,C)*this.config.scale);if(C/100!==g.scale){o.push([v.style,C])}g.scale=C/100;g.fontScale=C+"%";g.ex=z;g.mex=h}if("scrollWidth" in g&&(r||g.scrollWidth!==k.firstChild.scrollWidth)){g.scrollWidth=k.firstChild.scrollWidth;t.push([k.parentNode.style,g.scrollWidth/g.ex/g.scale])}if(k.MathJaxMtds){for(var u=0,p=k.MathJaxMtds.length;u<p;u++){if(!k.MathJaxMtds[u].parentNode){continue}if(r||k.MathJaxMtds[u].firstChild.scrollWidth!==g.mtds[u]){g.mtds[u]=k.MathJaxMtds[u].firstChild.scrollWidth;q.push([k.MathJaxMtds[u],g.mtds[u]/g.ex])}}}}for(w=0,s=l.length;w<s;w++){B=l[w];if(B.parentNode&&B.MathJax.elementJax){B.parentNode.removeChild(B.previousSibling)}}for(w=0,s=o.length;w<s;w++){o[w][0].fontSize=o[w][1]+"%"}for(w=0,s=t.length;w<s;w++){t[w][0].width=t[w][1].toFixed(3)+"ex"}for(w=0,s=q.length;w<s;w++){var x=q[w][0].getAttribute("style");x=x.replace(/(($|;)\s*min-width:).*?ex/,"$1 "+q[w][1].toFixed(3)+"ex");q[w][0].setAttribute("style",x)}setTimeout(A,A.delay)}})});c.Startup.signal.Post("MatchWebFonts Extension Ready");b.loadComplete("[MathJax]/extensions/MatchWebFonts.js")})(MathJax.Hub,MathJax.Ajax);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/AMScd.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.
*/
MathJax.Extension["TeX/AMScd"]={version:"2.7.9",config:MathJax.Hub.CombineConfig("TeX.CD",{colspace:"5pt",rowspace:"5pt",harrowsize:"2.75em",varrowsize:"1.75em",hideHorizontalLabels:false})};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.ElementJax.mml,e=MathJax.InputJax.TeX,d=e.Stack.Item,c=e.Definitions,a=MathJax.Extension["TeX/AMScd"].config;c.environment.CD="CD_env";c.special["@"]="CD_arrow";c.macros.minCDarrowwidth="CD_minwidth";c.macros.minCDarrowheight="CD_minheight";e.Parse.Augment({CD_env:function(f){this.Push(f);return d.array().With({arraydef:{columnalign:"center",columnspacing:a.colspace,rowspacing:a.rowspace,displaystyle:true},minw:this.stack.env.CD_minw||a.harrowsize,minh:this.stack.env.CD_minh||a.varrowsize})},CD_arrow:function(g){var l=this.string.charAt(this.i);if(!l.match(/[><VA.|=]/)){return this.Other(g)}else{this.i++}var o=this.stack.Top();if(!o.isa(d.array)||o.data.length){this.CD_cell(g);o=this.stack.Top()}var q=((o.table.length%2)===1);var i=(o.row.length+(q?0:1))%2;while(i){this.CD_cell(g);i--}var h;var f={minsize:o.minw,stretchy:true},k={minsize:o.minh,stretchy:true,symmetric:true,lspace:0,rspace:0};if(l==="."){}else{if(l==="|"){h=this.mmlToken(b.mo("\u2225").With(k))}else{if(l==="="){h=this.mmlToken(b.mo("=").With(f))}else{var r={">":"\u2192","<":"\u2190",V:"\u2193",A:"\u2191"}[l];var p=this.GetUpTo(g+l,l),m=this.GetUpTo(g+l,l);if(l===">"||l==="<"){h=b.mo(r).With(f);if(!p){p="\\kern "+o.minw}if(p||m){var j={width:"+11mu",lspace:"6mu"};h=b.munderover(this.mmlToken(h));if(p){p=e.Parse(p,this.stack.env).mml();h.SetData(h.over,b.mpadded(p).With(j).With({voffset:".1em"}))}if(m){m=e.Parse(m,this.stack.env).mml();h.SetData(h.under,b.mpadded(m).With(j))}if(a.hideHorizontalLabels){h=b.mpadded(h).With({depth:0,height:".67em"})}}}else{h=r=this.mmlToken(b.mo(r).With(k));if(p||m){h=b.mrow();if(p){h.Append(e.Parse("\\scriptstyle\\llap{"+p+"}",this.stack.env).mml())}h.Append(r.With({texClass:b.TEXCLASS.ORD}));if(m){h.Append(e.Parse("\\scriptstyle\\rlap{"+m+"}",this.stack.env).mml())}}}}}}if(h){this.Push(h)}this.CD_cell(g)},CD_cell:function(f){var g=this.stack.Top();if((g.table||[]).length%2===0&&(g.row||[]).length===0){this.Push(b.mpadded().With({height:"8.5pt",depth:"2pt"}))}this.Push(d.cell().With({isEntry:true,name:f}))},CD_minwidth:function(f){this.stack.env.CD_minw=this.GetDimen(f)},CD_minheight:function(f){this.stack.env.CD_minh=this.GetDimen(f)}})});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/AMScd.js");

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/HTML.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.
*/
MathJax.Extension["TeX/HTML"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.InputJax.TeX;var a=b.Definitions;a.Add({macros:{href:"HREF_attribute","class":"CLASS_attribute",style:"STYLE_attribute",cssId:"ID_attribute"}},null,true);b.Parse.Augment({HREF_attribute:function(e){var d=this.GetArgument(e),c=this.GetArgumentMML(e);this.Push(c.With({href:d}))},CLASS_attribute:function(d){var e=this.GetArgument(d),c=this.GetArgumentMML(d);if(c["class"]!=null){e=c["class"]+" "+e}this.Push(c.With({"class":e}))},STYLE_attribute:function(d){var e=this.GetArgument(d),c=this.GetArgumentMML(d);if(c.style!=null){if(e.charAt(e.length-1)!==";"){e+=";"}e=c.style+" "+e}this.Push(c.With({style:e}))},ID_attribute:function(e){var d=this.GetArgument(e),c=this.GetArgumentMML(e);this.Push(c.With({id:d}))},GetArgumentMML:function(d){var c=this.ParseArg(d);if(c.inferred&&c.data.length==1){c=c.data[0]}else{delete c.inferred}return c}});MathJax.Hub.Startup.signal.Post("TeX HTML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/HTML.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/action.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.
*/
MathJax.Extension["TeX/action"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.InputJax.TeX,a=MathJax.ElementJax.mml;b.Definitions.Add({macros:{toggle:"Toggle",mathtip:"Mathtip",texttip:["Macro","\\mathtip{#1}{\\text{#2}}",2]}},null,true);b.Parse.Augment({Toggle:function(d){var e=[],c;while((c=this.GetArgument(d))!=="\\endtoggle"){e.push(b.Parse(c,this.stack.env).mml())}this.Push(a.maction.apply(a,e).With({actiontype:a.ACTIONTYPE.TOGGLE}))},Mathtip:function(d){var c=this.ParseArg(d),e=this.ParseArg(d);this.Push(a.maction(c,e).With({actiontype:a.ACTIONTYPE.TOOLTIP}))}});MathJax.Hub.Startup.signal.Post("TeX action Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/action.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/autobold.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.
*/
MathJax.Extension["TeX/autobold"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var a=MathJax.InputJax.TeX;a.prefilterHooks.Add(function(d){var c=d.script.parentNode.insertBefore(document.createElement("span"),d.script);c.visibility="hidden";c.style.fontFamily="Times, serif";c.appendChild(document.createTextNode("ABCXYZabcxyz"));var b=c.offsetWidth;c.style.fontWeight="bold";if(b&&c.offsetWidth===b){d.math="\\boldsymbol{"+d.math+"}"}c.parentNode.removeChild(c)});MathJax.Hub.Startup.signal.Post("TeX autobold Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/autobold.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/autoload-all.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.
*/
MathJax.Extension["TeX/autoload-all"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var h={action:["mathtip","texttip","toggle"],AMSmath:["mathring","nobreakspace","negmedspace","negthickspace","intI","iiiint","idotsint","dddot","ddddot","sideset","boxed","substack","injlim","projlim","varliminf","varlimsup","varinjlim","varprojlim","DeclareMathOperator","operatorname","genfrac","tfrac","dfrac","binom","tbinom","dbinom","cfrac","shoveleft","shoveright","xrightarrow","xleftarrow"],begingroup:["begingroup","endgroup","gdef","global"],cancel:["cancel","bcancel","xcancel","cancelto"],color:["color","textcolor","colorbox","fcolorbox","definecolor"],enclose:["enclose"],extpfeil:["Newextarrow","xlongequal","xmapsto","xtofrom","xtwoheadleftarrow","xtwoheadrightarrow"],mhchem:["ce","cee","cf"]};var c={AMSmath:["subarray","smallmatrix","equation","equation*"],AMScd:["CD"]};var d,g,b,a={macros:{},environment:{}};for(d in h){if(h.hasOwnProperty(d)){if(!MathJax.Extension["TeX/"+d]){var f=h[d];for(g=0,b=f.length;g<b;g++){a.macros[f[g]]=["Extension",d]}}}}for(d in c){if(c.hasOwnProperty(d)){if(!MathJax.Extension["TeX/"+d]){var e=c[d];for(g=0,b=e.length;g<b;g++){a.environment[e[g]]=["ExtensionEnv",null,d]}}}}MathJax.InputJax.TeX.Definitions.Add(a);MathJax.Hub.Startup.signal.Post("TeX autoload-all Ready")});MathJax.Callback.Queue(["Require",MathJax.Ajax,"[MathJax]/extensions/TeX/AMSsymbols.js"],["loadComplete",MathJax.Ajax,"[MathJax]/extensions/TeX/autoload-all.js"]);

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/bbox.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.
*/
MathJax.Extension["TeX/bbox"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.InputJax.TeX,a=MathJax.ElementJax.mml;b.Definitions.Add({macros:{bbox:"BBox"}},null,true);b.Parse.Augment({BBox:function(e){var p=this.GetBrackets(e,""),o=this.ParseArg(e);var k=p.split(/,/),g,d,c;for(var l=0,j=k.length;l<j;l++){var f=k[l].replace(/^\s+/,"").replace(/\s+$/,"");var n=f.match(/^(\.\d+|\d+(\.\d*)?)(pt|em|ex|mu|px|in|cm|mm)$/);if(n){if(g){b.Error(["MultipleBBoxProperty","%1 specified twice in %2","Padding",e])}var h=this.BBoxPadding(n[1]+n[3]);if(h){g={height:"+"+h,depth:"+"+h,lspace:h,width:"+"+(2*n[1])+n[3]}}}else{if(f.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)){if(d){b.Error(["MultipleBBoxProperty","%1 specified twice in %2","Background",e])}d=f}else{if(f.match(/^[-a-z]+:/i)){if(c){b.Error(["MultipleBBoxProperty","%1 specified twice in %2","Style",e])}c=this.BBoxStyle(f)}else{if(f!==""){b.Error(["InvalidBBoxProperty","'%1' doesn't look like a color, a padding dimension, or a style",f])}}}}}if(g){o=a.mpadded(o).With(g)}if(d||c){o=a.mstyle(o).With({mathbackground:d,style:c})}this.Push(o)},BBoxStyle:function(c){return c},BBoxPadding:function(c){return c}});MathJax.Hub.Startup.signal.Post("TeX bbox Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/bbox.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/begingroup.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.
*/
MathJax.Extension["TeX/begingroup"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var d=MathJax.InputJax.TeX,b=d.Definitions;var a=MathJax.Object.Subclass({macros:null,environments:null,Init:function(e,f){this.macros=(e||{});this.environments=(f||{})},Find:function(e,f){if(this[f].hasOwnProperty(e)){return this[f][e]}},Def:function(e,g,f){this[f][e]=g},Undef:function(e,f){delete this[f][e]},Merge:function(e){MathJax.Hub.Insert(this.macros,e.macros);MathJax.Hub.Insert(this.environments,e.environments)},MergeGlobals:function(e){var f=this.macros;for(var g in f){if(f.hasOwnProperty(g)&&f[g].global){e.Def(g,f[g],"macros",true);delete f[g].global;delete f[g]}}},Clear:function(g){this.environments={};if(g){this.macros={}}else{var e=this.macros;for(var f in e){if(e.hasOwnProperty(f)&&!e[f].global){delete e[f]}}}return this}});var c=d.nsStack=MathJax.Object.Subclass({stack:null,top:0,isEqn:false,Init:function(e){this.isEqn=e;this.stack=[];if(!e){this.Push(a(b.macros,b.environment))}else{this.Push(a())}},Def:function(e,h,f,g){var i=this.top-1;if(g){while(i>0){this.stack[i].Undef(e,f);i--}if(!MathJax.Object.isArray(h)){h=[h]}if(this.isEqn){h.global=true}}this.stack[i].Def(e,h,f)},Push:function(e){this.stack.push(e);this.top=this.stack.length},Pop:function(){var e;if(this.top>1){e=this.stack[--this.top];if(this.isEqn){this.stack.pop()}}else{if(this.isEqn){this.Clear()}}return e},Find:function(e,g){for(var f=this.top-1;f>=0;f--){var h=this.stack[f].Find(e,g);if(h){return h}}return null},Merge:function(e){e.stack[0].MergeGlobals(this);this.stack[this.top-1].Merge(e.stack[0]);var f=[this.top,this.stack.length-this.top].concat(e.stack.slice(1));this.stack.splice.apply(this.stack,f);this.top=this.stack.length},Reset:function(){this.top=this.stack.length},Clear:function(e){this.stack=[this.stack[0].Clear()];this.top=this.stack.length}},{nsFrame:a});b.Add({macros:{begingroup:"BeginGroup",endgroup:"EndGroup",global:"Global",gdef:["Macro","\\global\\def"]}},null,true);d.Parse.Augment({BeginGroup:function(e){d.eqnStack.Push(a())},EndGroup:function(e){if(d.eqnStack.top>1){d.eqnStack.Pop()}else{if(d.rootStack.top===1){d.Error(["ExtraEndMissingBegin","Extra %1 or missing \\begingroup",e])}else{d.eqnStack.Clear();d.rootStack.Pop()}}},csFindMacro:function(e){return(d.eqnStack.Find(e,"macros")||d.rootStack.Find(e,"macros"))},envFindName:function(e){return(d.eqnStack.Find(e,"environments")||d.rootStack.Find(e,"environments"))},setDef:function(e,f){f.isUser=true;d.eqnStack.Def(e,f,"macros",this.stack.env.isGlobal);delete this.stack.env.isGlobal},setEnv:function(e,f){f.isUser=true;d.eqnStack.Def(e,f,"environments")},Global:function(e){var f=this.i;var g=this.GetCSname(e);this.i=f;if(g!=="let"&&g!=="def"&&g!=="newcommand"&&g!=="DeclareMathOperator"&&g!=="Newextarrow"){d.Error(["GlobalNotFollowedBy","%1 not followed by \\let, \\def, or \\newcommand",e])}this.stack.env.isGlobal=true}});d.rootStack=c();d.eqnStack=c(true);d.prefilterHooks.Add(function(){d.rootStack.Reset();d.eqnStack.Clear(true)});d.postfilterHooks.Add(function(){d.rootStack.Merge(d.eqnStack)});MathJax.Hub.Startup.signal.Post("TeX begingroup Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/begingroup.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/boldsymbol.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.
*/
MathJax.Extension["TeX/boldsymbol"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var a=MathJax.ElementJax.mml;var d=MathJax.InputJax.TeX;var b=d.Definitions;var c={};c[a.VARIANT.NORMAL]=a.VARIANT.BOLD;c[a.VARIANT.ITALIC]=a.VARIANT.BOLDITALIC;c[a.VARIANT.FRAKTUR]=a.VARIANT.BOLDFRAKTUR;c[a.VARIANT.SCRIPT]=a.VARIANT.BOLDSCRIPT;c[a.VARIANT.SANSSERIF]=a.VARIANT.BOLDSANSSERIF;c["-tex-caligraphic"]="-tex-caligraphic-bold";c["-tex-oldstyle"]="-tex-oldstyle-bold";b.Add({macros:{boldsymbol:"Boldsymbol"}},null,true);d.Parse.Augment({mmlToken:function(f){if(this.stack.env.boldsymbol){var e=f.Get("mathvariant");if(e==null){f.mathvariant=a.VARIANT.BOLD}else{f.mathvariant=(c[e]||e)}}return f},Boldsymbol:function(h){var e=this.stack.env.boldsymbol,f=this.stack.env.font;this.stack.env.boldsymbol=true;this.stack.env.font=null;var g=this.ParseArg(h);this.stack.env.font=f;this.stack.env.boldsymbol=e;this.Push(g)}});MathJax.Hub.Startup.signal.Post("TeX boldsymbol Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/boldsymbol.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/cancel.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.
*/
MathJax.Extension["TeX/cancel"]={version:"2.7.9",ALLOWED:{color:1,mathcolor:1,background:1,mathbackground:1,padding:1,thickness:1}};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var c=MathJax.InputJax.TeX,a=MathJax.ElementJax.mml,b=MathJax.Extension["TeX/cancel"];b.setAttributes=function(h,e){if(e!==""){e=e.replace(/ /g,"").split(/,/);for(var g=0,d=e.length;g<d;g++){var f=e[g].split(/[:=]/);if(b.ALLOWED[f[0]]){if(f[1]==="true"){f[1]=true}if(f[1]==="false"){f[1]=false}h[f[0]]=f[1]}}}return h};c.Definitions.Add({macros:{cancel:["Cancel",a.NOTATION.UPDIAGONALSTRIKE],bcancel:["Cancel",a.NOTATION.DOWNDIAGONALSTRIKE],xcancel:["Cancel",a.NOTATION.UPDIAGONALSTRIKE+" "+a.NOTATION.DOWNDIAGONALSTRIKE],cancelto:"CancelTo"}},null,true);c.Parse.Augment({Cancel:function(e,g){var d=this.GetBrackets(e,""),f=this.ParseArg(e);var h=b.setAttributes({notation:g},d);this.Push(a.menclose(f).With(h))},CancelTo:function(e,g){var i=this.ParseArg(e),d=this.GetBrackets(e,""),f=this.ParseArg(e);var h=b.setAttributes({notation:a.NOTATION.UPDIAGONALSTRIKE+" "+a.NOTATION.UPDIAGONALARROW},d);i=a.mpadded(i).With({depth:"-.1em",height:"+.1em",voffset:".1em"});this.Push(a.msup(a.menclose(f).With(h),i))}});MathJax.Hub.Startup.signal.Post("TeX cancel Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/cancel.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/color.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.
*/
MathJax.Extension["TeX/color"]={version:"2.7.9",config:MathJax.Hub.CombineConfig("TeX.color",{padding:"5px",border:"2px"}),colors:{Apricot:"#FBB982",Aquamarine:"#00B5BE",Bittersweet:"#C04F17",Black:"#221E1F",Blue:"#2D2F92",BlueGreen:"#00B3B8",BlueViolet:"#473992",BrickRed:"#B6321C",Brown:"#792500",BurntOrange:"#F7921D",CadetBlue:"#74729A",CarnationPink:"#F282B4",Cerulean:"#00A2E3",CornflowerBlue:"#41B0E4",Cyan:"#00AEEF",Dandelion:"#FDBC42",DarkOrchid:"#A4538A",Emerald:"#00A99D",ForestGreen:"#009B55",Fuchsia:"#8C368C",Goldenrod:"#FFDF42",Gray:"#949698",Green:"#00A64F",GreenYellow:"#DFE674",JungleGreen:"#00A99A",Lavender:"#F49EC4",LimeGreen:"#8DC73E",Magenta:"#EC008C",Mahogany:"#A9341F",Maroon:"#AF3235",Melon:"#F89E7B",MidnightBlue:"#006795",Mulberry:"#A93C93",NavyBlue:"#006EB8",OliveGreen:"#3C8031",Orange:"#F58137",OrangeRed:"#ED135A",Orchid:"#AF72B0",Peach:"#F7965A",Periwinkle:"#7977B8",PineGreen:"#008B72",Plum:"#92268F",ProcessBlue:"#00B0F0",Purple:"#99479B",RawSienna:"#974006",Red:"#ED1B23",RedOrange:"#F26035",RedViolet:"#A1246B",Rhodamine:"#EF559F",RoyalBlue:"#0071BC",RoyalPurple:"#613F99",RubineRed:"#ED017D",Salmon:"#F69289",SeaGreen:"#3FBC9D",Sepia:"#671800",SkyBlue:"#46C5DD",SpringGreen:"#C6DC67",Tan:"#DA9D76",TealBlue:"#00AEB3",Thistle:"#D883B7",Turquoise:"#00B4CE",Violet:"#58429B",VioletRed:"#EF58A0",White:"#FFFFFF",WildStrawberry:"#EE2967",Yellow:"#FFF200",YellowGreen:"#98CC70",YellowOrange:"#FAA21A"},getColor:function(a,c){if(!a){a="named"}var b=this["get_"+a];if(!b){this.TEX.Error(["UndefinedColorModel","Color model '%1' not defined",a])}return b.call(this,c)},get_rgb:function(b){b=b.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s*,\s*/);var a="#";if(b.length!==3){this.TEX.Error(["ModelArg1","Color values for the %1 model require 3 numbers","rgb"])}for(var c=0;c<3;c++){if(!b[c].match(/^(\d+(\.\d*)?|\.\d+)$/)){this.TEX.Error(["InvalidDecimalNumber","Invalid decimal number"])}var d=parseFloat(b[c]);if(d<0||d>1){this.TEX.Error(["ModelArg2","Color values for the %1 model must be between %2 and %3","rgb",0,1])}d=Math.floor(d*255).toString(16);if(d.length<2){d="0"+d}a+=d}return a},get_RGB:function(b){b=b.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s*,\s*/);var a="#";if(b.length!==3){this.TEX.Error(["ModelArg1","Color values for the %1 model require 3 numbers","RGB"])}for(var c=0;c<3;c++){if(!b[c].match(/^\d+$/)){this.TEX.Error(["InvalidNumber","Invalid number"])}var d=parseInt(b[c]);if(d>255){this.TEX.Error(["ModelArg2","Color values for the %1 model must be between %2 and %3","RGB",0,255])}d=d.toString(16);if(d.length<2){d="0"+d}a+=d}return a},get_gray:function(a){if(!a.match(/^\s*(\d+(\.\d*)?|\.\d+)\s*$/)){this.TEX.Error(["InvalidDecimalNumber","Invalid decimal number"])}var b=parseFloat(a);if(b<0||b>1){this.TEX.Error(["ModelArg2","Color values for the %1 model must be between %2 and %3","gray",0,1])}b=Math.floor(b*255).toString(16);if(b.length<2){b="0"+b}return"#"+b+b+b},get_named:function(a){if(this.colors.hasOwnProperty(a)){return this.colors[a]}return a},padding:function(){var c="+"+this.config.padding;var a=this.config.padding.replace(/^.*?([a-z]*)$/,"$1");var b="+"+(2*parseFloat(c))+a;return{width:b,height:c,depth:c,lspace:this.config.padding}}};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var d=MathJax.InputJax.TeX,a=MathJax.ElementJax.mml;var c=d.Stack.Item;var b=MathJax.Extension["TeX/color"];b.TEX=d;d.Definitions.Add({macros:{color:"Color",textcolor:"TextColor",definecolor:"DefineColor",colorbox:"ColorBox",fcolorbox:"fColorBox"}},null,true);d.Parse.Augment({Color:function(h){var g=this.GetBrackets(h),e=this.GetArgument(h);e=b.getColor(g,e);var f=c.style().With({styles:{mathcolor:e}});this.stack.env.color=e;this.Push(f)},TextColor:function(h){var g=this.GetBrackets(h),f=this.GetArgument(h);f=b.getColor(g,f);var e=this.stack.env.color;this.stack.env.color=f;var i=this.ParseArg(h);if(e){this.stack.env.color}else{delete this.stack.env.color}this.Push(a.mstyle(i).With({mathcolor:f}))},DefineColor:function(g){var f=this.GetArgument(g),e=this.GetArgument(g),h=this.GetArgument(g);b.colors[f]=b.getColor(e,h)},ColorBox:function(g){var f=this.GetArgument(g),e=this.InternalMath(this.GetArgument(g));this.Push(a.mpadded.apply(a,e).With({mathbackground:b.getColor("named",f)}).With(b.padding()))},fColorBox:function(g){var h=this.GetArgument(g),f=this.GetArgument(g),e=this.InternalMath(this.GetArgument(g));this.Push(a.mpadded.apply(a,e).With({mathbackground:b.getColor("named",f),style:"border: "+b.config.border+" solid "+b.getColor("named",h)}).With(b.padding()))}});MathJax.Hub.Startup.signal.Post("TeX color Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/color.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/enclose.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.
*/
MathJax.Extension["TeX/enclose"]={version:"2.7.9",ALLOWED:{arrow:1,color:1,mathcolor:1,background:1,mathbackground:1,padding:1,thickness:1}};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var c=MathJax.InputJax.TeX,a=MathJax.ElementJax.mml,b=MathJax.Extension["TeX/enclose"].ALLOWED;c.Definitions.Add({macros:{enclose:"Enclose"}},null,true);c.Parse.Augment({Enclose:function(g){var k=this.GetArgument(g),e=this.GetBrackets(g),j=this.ParseArg(g);var l={notation:k.replace(/,/g," ")};if(e){e=e.replace(/ /g,"").split(/,/);for(var h=0,d=e.length;h<d;h++){var f=e[h].split(/[:=]/);if(b[f[0]]){f[1]=f[1].replace(/^"(.*)"$/,"$1");if(f[1]==="true"){f[1]=true}if(f[1]==="false"){f[1]=false}if(f[0]==="arrow"&&f[1]){l.notation=l.notation+" updiagonalarrow"}else{l[f[0]]=f[1]}}}}this.Push(a.menclose(j).With(l))}});MathJax.Hub.Startup.signal.Post("TeX enclose Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/enclose.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/extpfeil.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.
*/
MathJax.Extension["TeX/extpfeil"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.InputJax.TeX,a=b.Definitions;a.Add({macros:{xtwoheadrightarrow:["Extension","AMSmath"],xtwoheadleftarrow:["Extension","AMSmath"],xmapsto:["Extension","AMSmath"],xlongequal:["Extension","AMSmath"],xtofrom:["Extension","AMSmath"],Newextarrow:["Extension","AMSmath"]}},null,true);MathJax.Hub.Register.StartupHook("TeX AMSmath Ready",function(){MathJax.Hub.Insert(a,{macros:{xtwoheadrightarrow:["xArrow",8608,12,16],xtwoheadleftarrow:["xArrow",8606,17,13],xmapsto:["xArrow",8614,6,7],xlongequal:["xArrow",61,7,7],xtofrom:["xArrow",8644,12,12],Newextarrow:"NewExtArrow"}})});b.Parse.Augment({NewExtArrow:function(c){var e=this.GetArgument(c),f=this.GetArgument(c),d=this.GetArgument(c);if(!e.match(/^\\([a-z]+|.)$/i)){b.Error(["NewextarrowArg1","First argument to %1 must be a control sequence name",c])}if(!f.match(/^(\d+),(\d+)$/)){b.Error(["NewextarrowArg2","Second argument to %1 must be two integers separated by a comma",c])}if(!d.match(/^(\d+|0x[0-9A-F]+)$/i)){b.Error(["NewextarrowArg3","Third argument to %1 must be a unicode character number",c])}e=e.substr(1);f=f.split(",");d=parseInt(d);this.setDef(e,["xArrow",d,parseInt(f[0]),parseInt(f[1])])}});MathJax.Hub.Startup.signal.Post("TeX extpfeil Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/extpfeil.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/mathchoice.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.
*/
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var c="2.7.9";var a=MathJax.ElementJax.mml;var d=MathJax.InputJax.TeX;var b=d.Definitions;b.Add({macros:{mathchoice:"MathChoice"}},null,true);d.Parse.Augment({MathChoice:function(f){var i=this.ParseArg(f),e=this.ParseArg(f),g=this.ParseArg(f),h=this.ParseArg(f);this.Push(a.TeXmathchoice(i,e,g,h))}});a.TeXmathchoice=a.mbase.Subclass({type:"TeXmathchoice",notParent:true,choice:function(){if(this.selection!=null){return this.selection}if(this.choosing){return 2}this.choosing=true;var f=0,e=this.getValues("displaystyle","scriptlevel");if(e.scriptlevel>0){f=Math.min(3,e.scriptlevel+1)}else{f=(e.displaystyle?0:1)}var g=this.inherit;while(g&&g.type!=="math"){g=g.inherit}if(g){this.selection=f}this.choosing=false;return f},selected:function(){return this.data[this.choice()]},setTeXclass:function(e){return this.selected().setTeXclass(e)},isSpacelike:function(){return this.selected().isSpacelike()},isEmbellished:function(){return this.selected().isEmbellished()},Core:function(){return this.selected()},CoreMO:function(){return this.selected().CoreMO()},toHTML:function(e){e=this.HTMLcreateSpan(e);e.bbox=this.Core().toHTML(e).bbox;if(e.firstChild&&e.firstChild.style.marginLeft){e.style.marginLeft=e.firstChild.style.marginLeft;e.firstChild.style.marginLeft=""}return e},toSVG:function(){var e=this.Core().toSVG();this.SVGsaveData(e);return e},toCommonHTML:function(e){e=this.CHTMLcreateNode(e);this.CHTMLhandleStyle(e);this.CHTMLhandleColor(e);this.CHTMLaddChild(e,this.choice(),{});return e},toPreviewHTML:function(e){e=this.PHTMLcreateSpan(e);this.PHTMLhandleStyle(e);this.PHTMLhandleColor(e);this.PHTMLaddChild(e,this.choice(),{});return e}});MathJax.Hub.Startup.signal.Post("TeX mathchoice Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mathchoice.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/mediawiki-texvc.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.
*/
MathJax.Extension["TeX/mediawiki-texvc"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){MathJax.InputJax.TeX.Definitions.Add({macros:{AA:["Macro","\u00c5"],alef:["Macro","\\aleph"],alefsym:["Macro","\\aleph"],Alpha:["Macro","\\mathrm{A}"],and:["Macro","\\land"],ang:["Macro","\\angle"],Bbb:["Macro","\\mathbb"],Beta:["Macro","\\mathrm{B}"],bold:["Macro","\\mathbf"],bull:["Macro","\\bullet"],C:["Macro","\\mathbb{C}"],Chi:["Macro","\\mathrm{X}"],clubs:["Macro","\\clubsuit"],cnums:["Macro","\\mathbb{C}"],Complex:["Macro","\\mathbb{C}"],coppa:["Macro","\u03D9"],Coppa:["Macro","\u03D8"],Dagger:["Macro","\\ddagger"],Digamma:["Macro","\u03DC"],darr:["Macro","\\downarrow"],dArr:["Macro","\\Downarrow"],Darr:["Macro","\\Downarrow"],dashint:["Macro","\\unicodeInt{x2A0D}"],ddashint:["Macro","\\unicodeInt{x2A0E}"],diamonds:["Macro","\\diamondsuit"],empty:["Macro","\\emptyset"],Epsilon:["Macro","\\mathrm{E}"],Eta:["Macro","\\mathrm{H}"],euro:["Macro","\u20AC"],exist:["Macro","\\exists"],geneuro:["Macro","\u20AC"],geneuronarrow:["Macro","\u20AC"],geneurowide:["Macro","\u20AC"],H:["Macro","\\mathbb{H}"],hAar:["Macro","\\Leftrightarrow"],harr:["Macro","\\leftrightarrow"],Harr:["Macro","\\Leftrightarrow"],hearts:["Macro","\\heartsuit"],image:["Macro","\\Im"],infin:["Macro","\\infty"],Iota:["Macro","\\mathrm{I}"],isin:["Macro","\\in"],Kappa:["Macro","\\mathrm{K}"],koppa:["Macro","\u03DF"],Koppa:["Macro","\u03DE"],lang:["Macro","\\langle"],larr:["Macro","\\leftarrow"],Larr:["Macro","\\Leftarrow"],lArr:["Macro","\\Leftarrow"],lrarr:["Macro","\\leftrightarrow"],Lrarr:["Macro","\\Leftrightarrow"],lrArr:["Macro","\\Leftrightarrow"],Mu:["Macro","\\mathrm{M}"],N:["Macro","\\mathbb{N}"],natnums:["Macro","\\mathbb{N}"],Nu:["Macro","\\mathrm{N}"],O:["Macro","\\emptyset"],oiint:["Macro","\\unicodeInt{x222F}"],oiiint:["Macro","\\unicodeInt{x2230}"],ointctrclockwise:["Macro","\\unicodeInt{x2233}"],officialeuro:["Macro","\u20AC"],Omicron:["Macro","\\mathrm{O}"],or:["Macro","\\lor"],P:["Macro","\u00B6"],pagecolor:["Macro","",1],part:["Macro","\\partial"],plusmn:["Macro","\\pm"],Q:["Macro","\\mathbb{Q}"],R:["Macro","\\mathbb{R}"],rang:["Macro","\\rangle"],rarr:["Macro","\\rightarrow"],Rarr:["Macro","\\Rightarrow"],rArr:["Macro","\\Rightarrow"],real:["Macro","\\Re"],reals:["Macro","\\mathbb{R}"],Reals:["Macro","\\mathbb{R}"],Rho:["Macro","\\mathrm{P}"],sdot:["Macro","\\cdot"],sampi:["Macro","\u03E1"],Sampi:["Macro","\u03E0"],sect:["Macro","\\S"],spades:["Macro","\\spadesuit"],stigma:["Macro","\u03DB"],Stigma:["Macro","\u03DA"],sub:["Macro","\\subset"],sube:["Macro","\\subseteq"],supe:["Macro","\\supseteq"],Tau:["Macro","\\mathrm{T}"],textvisiblespace:["Macro","\u2423"],thetasym:["Macro","\\vartheta"],uarr:["Macro","\\uparrow"],uArr:["Macro","\\Uparrow"],Uarr:["Macro","\\Uparrow"],unicodeInt:["Macro","\\mathop{\\vcenter{\\mathchoice{\\huge\\unicode{#1}\\,}{\\unicode{#1}}{\\unicode{#1}}{\\unicode{#1}}}\\,}\\nolimits",1],varcoppa:["Macro","\u03D9"],varstigma:["Macro","\u03DB"],varointclockwise:["Macro","\\unicodeInt{x2232}"],vline:["Macro","\\smash{\\large\\lvert}",0],weierp:["Macro","\\wp"],Z:["Macro","\\mathbb{Z}"],Zeta:["Macro","\\mathrm{Z}"]}})});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mediawiki-texvc.js");

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,291 @@
/*************************************************************
*
* MathJax/extensions/TeX/mhchem.js
*
* Implements the \ce command for handling chemical formulas
* from the mhchem LaTeX package.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2011-2015 The MathJax Consortium
* Copyright (c) 2015-2019 Martin Hensel
*
* 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.
*/
MathJax.Extension["TeX/mhchem"]={version:"3.3.2"},MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var n=MathJax.InputJax.TeX,a=MathJax.Object.Subclass({string:"",
Init:function(t){this.string=t},
Parse:function(t){try{return u.go(x.go(this.string,t))}catch(t){n.Error(t)}}}),x={
go:function(t,n){if(!t)return[];void 0===n&&(n="ce");var e,a="0",o={};o["@@"]=0,t=(t=(t=t.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var r=10,i=[];;){e!==t?(r=10,e=t):r--;var c=x.t[n],u=c.u[a]||c.u["*"];t:for(var s=0;s<u.length;s++){var p=x._.s(u[s].pattern,t);if(p){for(var _=u[s].task,f=0;f<_.h.length;f++){var h;if(c.m[_.h[f].l])h=c.m[_.h[f].l](o,p.s,_.h[f].S);else{if(!x.m[_.h[f].l])throw["MhchemBugA","mhchem bug A. Please report. ("+_.h[f].l+")"];h=x.m[_.h[f].l](o,p.s,_.h[f].S)}x.v(i,h)}if(a=_.g||a,!(0<t.length))return i;if(_.k||(t=p.$),!_.A)break t}}if(r<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},
v:function(t,n){if(n)if("[object Array]"===Object.prototype.toString.call(n))for(var e=0;e<n.length;e++)t.push(n[e]);else t.push(n)},_:{_:{"~z":/^$/,"~x":/^./,"~y":/^./,"%j":/^\s/,"%i":/^\s(?=[A-Z\\$])/,"`e":/^\s$/,"@X":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,"~J":/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"@A":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"~M":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"@a":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"~L":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,"~r":/^[0-9]+/,"@i":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"@h":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,
"%Q":function(t){var n=t.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return n&&n[0]?{s:n.slice(1),$:t.substr(n[0].length)}:null},
"`a":function(t){var n=t.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return n&&n[0]?{s:n.slice(1),$:t.substr(n[0].length)}:null},
"%k":function(t){var n=x._.M(t,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(n&&n.$.match(/^($|[\s,;\)\]\}])/))return n;var e=t.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return e?{s:e[0],$:t.substr(e[0].length)}:null},"`~":/^_\{(\([a-z]{1,3}\))\}/,"@L":/^(?:\\\{|\[|\()/,"@d":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"@j":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,
"@Q":function(t){return x._.M(t,"^{","","","}")},
"@M":function(t){return x._.M(t,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,
"@P":function(t){return x._.M(t,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},
"@O":function(t){return x._.M(t,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"%R":/^\^(-?\d+)/,"'":/^'/,
"@V":function(t){return x._.M(t,"_{","","","}")},
"@R":function(t){return x._.M(t,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,
"@U":function(t){return x._.M(t,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},
"@T":function(t){return x._.M(t,"_",/^\\[a-zA-Z]+\{/,"}","")},"@S":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,
"%y":function(t){return x._.M(t,"","{","}","")},
"%x":function(t){return x._.M(t,"{","","","}")},
"@`":function(t){return x._.M(t,"","$","$","")},
"@b":function(t){return x._.M(t,"${","","","}$")},
"@%":function(t){return x._.M(t,"$","","","$")},"%A":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"@g":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"``":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,"~N":/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,"~`":/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,
"@s":function(t){return x._.M(t,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,"@n":/^[CMT](?=\[)/,
"@p":function(t){return x._.M(t,"[","","","]")},"`c":/^(&|@r|\\hline)\s*/,"@q":/^(?:\\[,\ ;:])/,
"@H":function(t){return x._.M(t,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},
"@G":function(t){return x._.M(t,"",/^\\[a-zA-Z]+\{/,"}","")},"@u":/^\\ca(?:\s+|(?![a-zA-Z]))/,"@F":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,"~O":/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,"~P":/^[\/~|]/,
"@z":function(t){return x._.M(t,"\\frac{","","","}","{","","","}")},
"@B":function(t){return x._.M(t,"\\overset{","","","}","{","","","}")},
"@D":function(t){return x._.M(t,"\\underset{","","","}","{","","","}")},
"@C":function(t){return x._.M(t,"\\underbrace{","","","}_","{","","","}")},
"@x":function(t){return x._.M(t,"\\color{","","","}")},
"@y":function(t){return x._.M(t,"\\color{","","","}","{","","","}")},
"@w":function(t){return x._.M(t,"\\color","\\","",/^(?=\{)/,"{","","","}")},
"@v":function(t){return x._.M(t,"\\ce{","","","}")},"~W":/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"%Y":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"%a":/^[IVX]+/,"@k":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,
"~@":function(t){var n;if(n=t.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/))return{s:n[0],$:t.substr(n[0].length)};var e=x._.M(t,"","$","$","");return e&&(n=e.s.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/))?{s:n[0],$:t.substr(n[0].length)}:null},
"~~":function(t){return this["~@"](t)},"@c":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,
"~B":function(t){if(t.match(/^\([a-z]+\)$/))return null;var n=t.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return n?{s:n[0],$:t.substr(n[0].length)}:null},"%w":/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},
M:function(t,n,e,a,o,r,i,c,u,s){var p=function(t,n){if("string"==typeof n)return 0!==t.indexOf(n)?null:n;var e=t.match(n);return e?e[0]:null},_=p(t,n);if(null===_)return null;if(t=t.substr(_.length),null===(_=p(t,e)))return null;var f=function(t,n,e){for(var a=0;n<t.length;){var o=t.charAt(n),r=p(t.substr(n),e);if(null!==r&&0===a)return{P:n,T:n+r.length};if("{"===o)a++;else if("}"===o){if(0===a)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];a--}n++}return null}(t,_.length,a||o);if(null===f)return null;var h=t.substring(0,a?f.T:f.P);if(r||i){var x=this.M(t.substr(f.T),r,i,c,u);if(null===x)return null;var m=[h,x.s];return{s:s?m.join(""):m,$:x.$}}return{s:h,$:t.substr(f.T)}},
s:function(t,n){var e=x._._[t];if(void 0===e)throw["MhchemBugP","mhchem bug P. Please report. ("+t+")"];if("function"==typeof e)return x._._[t](n);var a=n.match(e);return a?{s:a[2]?[a[1],a[2]]:a[1]?a[1]:a[0],$:n.substr(a[0].length)}:null}},
m:{
"a=":function(t,n){t.a=(t.a||"")+n},
"b=":function(t,n){t.b=(t.b||"")+n},
"p=":function(t,n){t.p=(t.p||"")+n},
"o=":function(t,n){t.o=(t.o||"")+n},
"q=":function(t,n){t.q=(t.q||"")+n},
"d=":function(t,n){t.d=(t.d||"")+n},
"%`":function(t,n){t.rm=(t.rm||"")+n},
"%q":function(t,n){t.F=(t.F||"")+n},
"~G":function(t,n,e){return{l:e}},
"~H":function(t,n,e){return{l:e,p1:n}},
"~I":function(t,n,e){return{l:e,p1:n[0],p2:n[1]}},
"~p":function(t,n){return n},
rm:function(t,n){return{l:"rm",p1:n||""}},
"%p":function(t,n){return x.go(n,"%p")},
"%z":function(t,n){var e=["{"];return x.v(e,x.go(n,"%p")),e.push("}"),e},
"%o":function(t,n){return x.go(n,"%o")},
"%n":function(t,n){return x.go(n,"%n")},
"~c":function(t,n,e){return{l:"~c",B:e||n}},
"~j":function(t,n){return{l:"~i",color:n[0]}},
ce:function(t,n){return x.go(n)},
"@l":function(t,n){var e=[];n.match(/^[+\-]/)&&(e.push(n.substr(0,1)),n=n.substr(1));var a=n.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return a[1]=a[1].replace(/\$/g,""),e.push({l:"~C",p1:a[1],p2:a[2]}),a[3]&&(a[3]=a[3].replace(/\$/g,""),e.push({l:"%o",p1:a[3]})),e},
"@m":function(t,n){return x.go(n,"@m")}},
C:function(t){var n,e,a,o,r={};for(n in t)for(e in t[n])for(a=e.split("|"),t[n][e].stateArray=a,o=0;o<a.length;o++)r[a[o]]=[];for(n in t)for(e in t[n])for(a=t[n][e].stateArray||[],o=0;o<a.length;o++){var i=t[n][e];if(i.h){i.h=[].concat(i.h);for(var c=0;c<i.h.length;c++)"string"==typeof i.h[c]&&(i.h[c]={l:i.h[c]})}else i.h=[];for(var u=n.split("|"),s=0;s<u.length;s++)if("*"===a[o])for(var p in r)r[p].push({pattern:u[s],task:i});else r[a[o]].push({pattern:u[s],task:i})}return r},t:{}};x.t={ce:{u:x.C({"~z":{"*":{h:"~Q"}},
"~x":{"0|1|2":{h:"~a",k:!0,A:!0}},
"~W":{0:{h:"`@"}},
"@n":{r:{h:"%%",g:"rt"},rd:{h:"%d",g:"%f"}},
"~`":{"0|1|2|as":{h:["%g","~Q","~N"],g:"1"}},
"%w":{"0|1|2":{h:["o=","~Q"],g:"1"}},
"~O":{"0|1|2|3":{h:"o=",g:"o"}},
"->":{"0|1|2|3":{h:"r=",g:"r"},"a|as":{h:["~Q","r="],g:"r"},"*":{h:["~Q","r="],g:"r"}},
"+":{o:{h:"~q",g:"d"},"d|D":{h:"d=",g:"d"},q:{h:"d=",g:"qd"},"qd|qD":{h:"d=",g:"qd"},dq:{h:["~Q","d="],g:"d"},3:{h:["%g","~Q","~N"],g:"0"}},
"~@":{"0|2":{h:"a=",g:"a"}},
"``":{"0|1|2|a|as":{h:["%g","~Q",{l:"~N",S:"\\pm"}],g:"0"}},
"~N":{"0|1|2|a|as":{h:["%g","~Q","~N"],g:"0"}},
"-$":{"o|q":{h:["~d","~Q"],g:"qd"},d:{h:"d=",g:"d"},D:{h:["~Q",{l:"~c",S:"-"}],g:"3"},q:{h:"d=",g:"qd"},qd:{h:"d=",g:"qd"},"qD|dq":{h:["~Q",{l:"~c",S:"-"}],g:"3"}},
"-9":{"3|o":{h:["~Q",{l:"~G",S:"~F"}],g:"3"}},
"@g":{o:{h:["~Q",{l:"~G",S:"~F"}],g:"2"},d:{h:["~Q",{l:"~G",S:"~F"}],g:"2"}},
"-":{"0|1|2":{h:[{l:"~Q",S:1},"~b",{l:"~c",S:"-"}],g:"3"},3:{h:{l:"~c",S:"-"}},
a:{h:["~Q",{l:"~G",S:"~F"}],g:"2"},as:{h:[{l:"~Q",S:2},{l:"~c",S:"-"}],g:"3"},b:{h:"b="},o:{h:{l:"`d",S:!1},g:"2"},q:{h:{l:"`d",S:!1},g:"2"},"d|qd|dq":{h:{l:"`d",S:!0},g:"2"},"D|qD|p":{h:["~Q",{l:"~c",S:"-"}],g:"3"}},
"~~":{"1|3":{h:"a=",g:"a"}},
"~J":{"0|1|2|3|a|as|b|p|bp|o":{h:"o=",g:"o"},"q|dq":{h:["~Q","o="],g:"o"},"d|D|qd|qD":{h:"~K",g:"o"}},
"~r":{o:{h:"q=",g:"q"},"d|D":{h:"q=",g:"dq"},q:{h:["~Q","o="],g:"o"},a:{h:"o=",g:"o"}},
"%i":{"b|p|bp":{}},
"%j":{a:{g:"as"},0:{h:"%g"},"1|2":{h:"%h"},"r|rt|rd|%f|%e":{h:"~Q",g:"0"},"*":{h:["~Q","%h"],g:"1"}},
"`c":{"1|2":{h:["~Q",{l:"~H",S:"`c"}]},
"*":{h:["~Q",{l:"~H",S:"`c"}],g:"0"}},
"@p":{"r|rt":{h:"%~",g:"rd"},"rd|%f":{h:"%c",g:"%e"}},
"@j":{"o|d|D|dq|qd|qD":{h:["~Q",{l:"~c",S:"..."}],g:"3"},"*":{h:[{l:"~Q",S:1},{l:"~G",S:"~w"}],g:"1"}},
". |* ":{"*":{h:["~Q",{l:"~G",S:"@Y"}],g:"1"}},
"%k":{"*":{h:["~Q","%m"],g:"1"}},
"@L":{"a|as|o":{h:["o=","~Q","~X"],g:"2"},"0|1|2|3":{h:["o=","~Q","~X"],g:"2"},"*":{h:["~Q","o=","~Q","~X"],g:"2"}},
"@d":{"0|1|2|3|b|p|bp|o":{h:["o=","~Y"],g:"o"},"a|as|d|D|q|qd|qD|dq":{h:["~Q","o=","~Y"],g:"o"}},
", ":{"*":{h:["~Q","~n"],g:"0"}},
"^_":{"*":{}},
"@Q|@M":{"0|1|2|as":{h:"b=",g:"b"},p:{h:"b=",g:"bp"},"3|o":{h:"~q",g:"D"},q:{h:"d=",g:"qD"},"d|D|qd|qD|dq":{h:["~Q","d="],g:"D"}},
"^a|@P|@O|^\\x|'":{"0|1|2|as":{h:"b=",g:"b"},p:{h:"b=",g:"bp"},"3|o":{h:"~q",g:"d"},q:{h:"d=",g:"qd"},"d|qd|D|qD":{h:"d="},dq:{h:["~Q","d="],g:"d"}},
"`~":{"d|D|q|qd|qD|dq":{h:["~Q","q="],g:"q"}},
"@V|@R|_9|@U|@T|@S":{"0|1|2|as":{h:"p=",g:"p"},b:{h:"p=",g:"bp"},"3|o":{h:"q=",g:"q"},"d|D":{h:"q=",g:"dq"},"q|qd|qD|dq":{h:["~Q","q="],g:"q"}},
"%A":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{h:[{l:"~Q",S:2},"~c"],g:"3"}},
"#":{"0|1|2|3|a|as|o":{h:[{l:"~Q",S:2},{l:"~c",S:"#"}],g:"3"}},
"{}":{"*":{h:{l:"~Q",S:1},g:"1"}},
"%y":{"0|1|2|3|a|as|b|p|bp":{h:"o=",g:"o"},"o|d|D|q|qd|qD|dq":{h:["~Q","o="],g:"o"}},
"@`":{a:{h:"a="},"0|1|2|3|as|b|p|bp|o":{h:"o=",g:"o"},"as|o":{h:"o="},"q|d|D|qd|qD|dq":{h:["~Q","o="],g:"o"}},
"@s":{"*":{h:[{l:"~Q",S:2},"~c"],g:"3"}},
"@z":{"*":{h:[{l:"~Q",S:1},"~E"],g:"3"}},
"@B":{"*":{h:[{l:"~Q",S:2},"~U"],g:"3"}},
"@D":{"*":{h:[{l:"~Q",S:2},"%v"],g:"3"}},
"@C":{"*":{h:[{l:"~Q",S:2},"%t"],g:"3"}},
"@y|@w":{"*":{h:[{l:"~Q",S:2},"~h"],g:"3"}},
"@x":{"*":{h:[{l:"~Q",S:2},"~j"]}},
"@v":{"*":{h:[{l:"~Q",S:2},"ce"],g:"3"}},
"@q":{"*":{h:[{l:"~Q",S:1},"~p"],g:"1"}},
"@H|@G|@F":{"0|1|2|3|a|as|b|p|bp|o|c0":{h:["o=","~Q"],g:"3"},"*":{h:["~Q","o=","~Q"],g:"3"}},
"~P":{"*":{h:[{l:"~Q",S:1},"~p"],g:"3"}},
"~y":{a:{h:"@W",g:"o",k:!0},as:{h:["~Q","%h"],g:"1",k:!0},"r|rt|rd|%f|%e":{h:["~Q"],g:"0",k:!0},"*":{h:["~Q","~p"],g:"3"}}}),m:{
"~K":function(t,n){var e;if((t.d||"").match(/^[0-9]+$/)){var a=t.d;t.d=void 0,e=this["~Q"](t),t.b=a}else e=this["~Q"](t);return x.m["o="](t,n),e},
"~q":function(t,n){t.d=n,t.dType="kv"},
"~d":function(t,n){if(t["@~"]){var e=[];return x.v(e,this["~Q"](t)),x.v(e,x.m["~c"](t,n,"-")),e}t.d=n},
"`d":function(t,n,e){var a=x._.s("~O",t.o||""),o=x._.s("~L",t.o||""),r=x._.s("~M",t.o||""),i=x._.s("@a",t.o||""),c="-"===n&&(a&&""===a.$||o||r||i);!c||t.a||t.b||t.p||t.d||t.q||a||!r||(t.o="$"+t.o+"$");var u=[];return c?(x.v(u,this["~Q"](t)),u.push({l:"~F"})):(a=x._.s("~r",t.d||""),e&&a&&""===a.$?(x.v(u,x.m["d="](t,n)),x.v(u,this["~Q"](t))):(x.v(u,this["~Q"](t)),x.v(u,x.m["~c"](t,n,"-")))),u},
"@W":function(t){t.o=t.a,t.a=void 0},
"%h":function(t){t.sb=!0},
"%g":function(t){t.sb=!1},
"~b":function(t){t["@~"]=!0},
"~a":function(t){t["@~"]=!1},
"~X":function(t){t["@@"]++},
"~Y":function(t){t["@@"]--},
"%m":function(t,n){return{l:"%m",p1:x.go(n,"o")}},
"~n":function(t,n){var e=n.replace(/\s*$/,"");return e!==n&&0===t["@@"]?{l:"~k",p1:e}:{l:"~l",p1:e}},
"~Q":function(t,n,e){var a,o,r;t.r?(o="M"===t.rdt?x.go(t.rd,"%o"):"T"===t.rdt?[{l:"%p",p1:t.rd||""}]:x.go(t.rd),r="M"===t.rqt?x.go(t.rq,"%o"):"T"===t.rqt?[{l:"%p",p1:t.rq||""}]:x.go(t.rq),a={l:"~%",r:t.r,rd:o,rq:r}):(a=[],(t.a||t.b||t.p||t.o||t.q||t.d||e)&&(t.sb&&a.push({l:"~A"}),t.o||t.q||t.d||t.b||t.p||2===e?t.o||t.q||t.d||!t.b&&!t.p?t.o&&"kv"===t.dType&&x._.s("%Y",t.d||"")?t.dType="~V":t.o&&"kv"===t.dType&&!t.q&&(t.dType=void 0):(t.o=t.a,t.d=t.b,t.q=t.p,t.a=t.b=t.p=void 0):(t.o=t.a,t.a=void 0),a.push({l:"~e",a:x.go(t.a,"a"),b:x.go(t.b,"bd"),p:x.go(t.p,"pq"),o:x.go(t.o,"o"),q:x.go(t.q,"pq"),d:x.go(t.d,"~V"===t.dType?"~V":"bd"),dType:t.dType})));for(var i in t)"@@"!==i&&"@~"!==i&&delete t[i];return a},
"`@":function(t,n){var e=["{"];return x.v(e,x.go(n,"~V")),e.push("}"),e},
"~E":function(t,n){return{l:"~D",p1:x.go(n[0]),p2:x.go(n[1])}},
"~U":function(t,n){return{l:"~T",p1:x.go(n[0]),p2:x.go(n[1])}},
"%v":function(t,n){return{l:"%u",p1:x.go(n[0]),p2:x.go(n[1])}},
"%t":function(t,n){return{l:"%s",p1:x.go(n[0]),p2:x.go(n[1])}},
"~h":function(t,n){return{l:"~g",G:n[0],X:x.go(n[1])}},
"r=":function(t,n){t.r=n},
"%%":function(t,n){t.rdt=n},
"%~":function(t,n){t.rd=n},
"%d":function(t,n){t.rqt=n},
"%c":function(t,n){t.rq=n},
"~N":function(t,n,e){return{l:"~N",B:e||n}}}},
a:{u:x.C({"~z":{"*":{}},
"@k":{0:{h:"@l"}},
"~x":{0:{g:"1",k:!0}},
"@%":{"*":{h:"%n",g:"1"}},
",":{"*":{h:{l:"~G",S:"~o"}}},
"~y":{"*":{h:"~p"}}}),m:{}},
o:{u:x.C({"~z":{"*":{}},
"@k":{0:{h:"@l"}},
"~x":{0:{g:"1",k:!0}},
"~J":{"*":{h:"rm"}},
"@u":{"*":{h:{l:"~G",S:"~f"}}},
"@H|@G|@F":{"*":{h:"~p"}},
"@b|@%":{"*":{h:"%o"}},
"%x":{"*":{h:"%z"}},
"~y":{"*":{h:"~p"}}}),m:{}},
"%p":{u:x.C({"~z":{"*":{h:"~Q"}},
"%y":{"*":{h:"%q"}},
"@b|@%":{"*":{h:"%o"}},
"@A":{"*":{h:["~Q","rm"]}},
"@q|@H|@G|@F":{"*":{h:["~Q","~p"]}},
"~x":{"*":{h:"%q"}}}),m:{
"~Q":function(t){if(t.F){var n={l:"%p",p1:t.F};for(var e in t)delete t[e];return n}}}},
pq:{u:x.C({"~z":{"*":{}},
"%k":{"*":{h:"%m"}},
i$:{0:{g:"!f",k:!0}},
"@c":{0:{h:"rm",g:"0"}},
"~B":{0:{g:"f",k:!0}},
"@k":{0:{h:"@l"}},
"~x":{0:{g:"!f",k:!0}},
"@b|@%":{"*":{h:"%o"}},
"%x":{"*":{h:"%p"}},
"@X":{f:{h:"%o"}},
"~J":{"*":{h:"rm"}},
"@i":{"*":{h:"@m"}},
",":{"*":{h:{l:"~H",S:"~m"}}},
"@y|@w":{"*":{h:"~h"}},
"@x":{"*":{h:"~j"}},
"@v":{"*":{h:"ce"}},
"@q|@H|@G|@F":{"*":{h:"~p"}},
"~y":{"*":{h:"~p"}}}),m:{
"%m":function(t,n){return{l:"%H",p1:x.go(n,"o")}},
"~h":function(t,n){return{l:"~g",G:n[0],X:x.go(n[1],"pq")}}}},
bd:{u:x.C({"~z":{"*":{}},
x$:{0:{g:"!f",k:!0}},
"~B":{0:{g:"f",k:!0}},
"~x":{0:{g:"!f",k:!0}},
"@h":{"*":{h:"@m"}},
".":{"*":{h:{l:"~G",S:"~v"}}},
"@X":{f:{h:"%o"}},
x:{"*":{h:{l:"~G",S:"@o"}}},
"~J":{"*":{h:"rm"}},
"'":{"*":{h:{l:"~G",S:"%@"}}},
"@b|@%":{"*":{h:"%o"}},
"%x":{"*":{h:"%p"}},
"@y|@w":{"*":{h:"~h"}},
"@x":{"*":{h:"~j"}},
"@v":{"*":{h:"ce"}},
"@q|@H|@G|@F":{"*":{h:"~p"}},
"~y":{"*":{h:"~p"}}}),m:{
"~h":function(t,n){return{l:"~g",G:n[0],X:x.go(n[1],"bd")}}}},
"~V":{u:x.C({"~z":{"*":{}},
"%a":{"*":{h:"%b"}},
"@b|@%":{"*":{h:"%o"}},
"~x":{"*":{h:"~p"}}}),m:{
"%b":function(t,n){return{l:"%a",p1:n||""}}}},
"%o":{u:x.C({"~z":{"*":{h:"~Q"}},
"@v":{"*":{h:["~Q","ce"]}},
"%y|@q|@H|@G|@F":{"*":{h:"o="}},
"~x":{"*":{h:"o="}}}),m:{
"~Q":function(t){if(t.o){var n={l:"%o",p1:t.o};for(var e in t)delete t[e];return n}}}},
"%n":{u:x.C({"~z":{"*":{h:"~Q"}},
"@v":{"*":{h:["~Q","ce"]}},
"%y|@q|@H|@G|@F":{"*":{h:"o="}},
"-|+":{"*":{h:"%r"}},
"~x":{"*":{h:"o="}}}),m:{
"%r":function(t,n){t.o=(t.o||"")+"{"+n+"}"},
"~Q":function(t){if(t.o){var n={l:"%o",p1:t.o};for(var e in t)delete t[e];return n}}}},
"@m":{u:x.C({"~z":{"*":{}},
",":{"*":{h:"~n"}},
"~x":{"*":{h:"~p"}}}),m:{
"~n":function(){return{l:"~o"}}}},
pu:{u:x.C({"~z":{"*":{h:"~Q"}},
"`e":{"*":{h:["~Q","%j"]}},
"@L|@d":{"0|a":{h:"~p"}},
"`a":{0:{h:"`b",g:"a"}},
"%Q":{0:{h:"%W",g:"a"}},
"%j":{"0|a":{}},
"``":{"0|a":{h:{l:"~N",S:"\\pm"},g:"0"}},
"~N":{"0|a":{h:"~p",g:"0"}},
"//":{d:{h:"o=",g:"/"}},
"/":{d:{h:"o=",g:"/"}},
"%y|~x":{"0|d":{h:"d=",g:"d"},a:{h:["%j","d="],g:"d"},"/|q":{h:"q=",g:"q"}}}),m:{
"%W":function(t,n){var e=[];return"+-"===n[0]||"+/-"===n[0]?e.push("\\pm "):n[0]&&e.push(n[0]),n[1]&&(x.v(e,x.go(n[1],"%U")),n[2]&&(n[2].match(/[,.]/)?x.v(e,x.go(n[2],"%U")):e.push(n[2])),(n[3]||n[4])&&("e"===n[3]||"*"===n[4]?e.push({l:"%K"}):e.push({l:"%M"}))),n[5]&&e.push("10^{"+n[5]+"}"),e},
"`b":function(t,n){var e=[];return"+-"===n[0]||"+/-"===n[0]?e.push("\\pm "):n[0]&&e.push(n[0]),x.v(e,x.go(n[1],"%U")),e.push("^{"+n[2]+"}"),e},
"~N":function(t,n,e){return{l:"~N",B:e||n}},
"%j":function(){return{l:"%N"}},
"~Q":function(t){var n,e=x._.s("%x",t.d||"");e&&""===e.$&&(t.d=e.s);var a=x._.s("%x",t.q||"");if(a&&""===a.$&&(t.q=a.s),t.d&&(t.d=t.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),t.d=t.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),t.q){t.q=t.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),t.q=t.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var o={d:x.go(t.d,"pu"),q:x.go(t.q,"pu")};"//"===t.o?n={l:"%P",p1:o.d,p2:o.q}:(1<(n=o.d).length||1<o.q.length?n.push({l:"%S"}):n.push({l:"/"}),x.v(n,o.q))}else n=x.go(t.d,"%O");for(var r in t)delete t[r];return n}}},
"%O":{u:x.C({"~z":{"*":{h:"~Q"}},
"*":{"*":{h:["~Q","%K"],g:"0"}},
"@F":{"*":{h:"%`"}},
"%j":{"*":{h:["~Q","%j"],g:"0"}},
"@Q|%R":{1:{h:"%R"}},
"@i":{0:{h:"%`",g:"0"},1:{h:"%R",g:"0"}},
"%y|~x":{"*":{h:"%`",g:"1"}}}),m:{
"%K":function(){return{l:"%L"}},
"%R":function(t,n){t.rm+="^{"+n+"}"},
"%j":function(){return{l:"`%"}},
"~Q":function(t){var n=[];if(t.rm){var e=x._.s("%x",t.rm||"");n=e&&""===e.$?x.go(e.s,"pu"):{l:"rm",p1:t.rm}}for(var a in t)delete t[a];return n}}},
"%U":{u:x.C({"~z":{0:{h:"~R"},o:{h:"~S"}},
",":{0:{h:["~R","~n"],g:"o"}},
".":{0:{h:["~R","~p"],g:"o"}},
"~x":{"*":{h:"%q"}}}),m:{
"~n":function(){return{l:"~o"}},
"~R":function(t){var n=[];if(t.F=t.F||"",4<t.F.length){var e=t.F.length%3;0===e&&(e=3);for(var a=t.F.length-3;0<a;a-=3)n.push(t.F.substr(a,3)),n.push({l:"%T"});n.push(t.F.substr(0,e)),n.reverse()}else n.push(t.F);for(var o in t)delete t[o];return n},
"~S":function(t){var n=[];if(t.F=t.F||"",4<t.F.length){for(var e=t.F.length-3,a=0;a<e;a+=3)n.push(t.F.substr(a,3)),n.push({l:"%T"});n.push(t.F.substr(a))}else n.push(t.F);for(var o in t)delete t[o];return n}}}};var u={
go:function(t,n){if(!t)return"";for(var e="",a=!1,o=0;o<t.length;o++){var r=t[o];"string"==typeof r?e+=r:(e+=u.Z(r),"`c"===r.l&&(a=!0))}return n||a||!e||(e="{"+e+"}"),e},
j:function(t){return t?u.go(t,!0):t},
Z:function(t){var n;switch(t.l){case"~e":n="";var e={a:u.j(t.a),b:u.j(t.b),p:u.j(t.p),o:u.j(t.o),q:u.j(t.q),d:u.j(t.d)};e.a&&(e.a.match(/^[+\-]/)&&(e.a="{"+e.a+"}"),n+=e.a+"\\,"),(e.b||e.p)&&(n+="{\\vphantom{X}}",n+="^{\\hphantom{"+(e.b||"")+"}}_{\\hphantom{"+(e.p||"")+"}}",n+="{\\vphantom{X}}",n+="^{\\smash[t]{\\vphantom{2}}\\llap{"+(e.b||"")+"}}",n+="_{\\vphantom{2}\\llap{\\smash[t]{"+(e.p||"")+"}}}"),e.o&&(e.o.match(/^[+\-]/)&&(e.o="{"+e.o+"}"),n+=e.o),"kv"===t.dType?((e.d||e.q)&&(n+="{\\vphantom{X}}"),e.d&&(n+="^{"+e.d+"}"),e.q&&(n+="_{\\smash[t]{"+e.q+"}}")):"~V"===t.dType?(e.d&&(n+="{\\vphantom{X}}",n+="^{"+e.d+"}"),e.q&&(n+="{\\vphantom{X}}",n+="_{\\smash[t]{"+e.q+"}}")):(e.q&&(n+="{\\vphantom{X}}",n+="_{\\smash[t]{"+e.q+"}}"),e.d&&(n+="{\\vphantom{X}}",n+="^{"+e.d+"}"));break;case"rm":n="\\mathrm{"+t.p1+"}";break;case"%p":n=t.p1.match(/[\^_]/)?(t.p1=t.p1.replace(" ","~").replace("-","\\text{-}"),"\\mathrm{"+t.p1+"}"):"\\text{"+t.p1+"}";break;case"%a":n="\\mathrm{"+t.p1+"}";break;case"%m":n="\\mskip2mu "+u.j(t.p1);break;case"%H":n="\\mskip1mu "+u.j(t.p1);break;case"~c":if(!(n=u.R(t.B)))throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+t.B+")"];break;case"~C":var a="\\frac{"+t.p1+"}{"+t.p2+"}";n="\\mathchoice{\\textstyle"+a+"}{"+a+"}{"+a+"}{"+a+"}";break;case"%P":var o="\\frac{"+u.j(t.p1)+"}{"+u.j(t.p2)+"}";n="\\mathchoice{\\textstyle"+o+"}{"+o+"}{"+o+"}{"+o+"}";break;case"%o":n=t.p1+" ";break;case"~D":n="\\frac{"+u.j(t.p1)+"}{"+u.j(t.p2)+"}";break;case"~T":n="\\overset{"+u.j(t.p1)+"}{"+u.j(t.p2)+"}";break;case"%u":n="\\underset{"+u.j(t.p1)+"}{"+u.j(t.p2)+"}";break;case"%s":n="\\underbrace{"+u.j(t.p1)+"}_{"+u.j(t.p2)+"}";break;case"~g":n="{\\color{"+t.G+"}{"+u.j(t.X)+"}}";break;case"~i":n="\\color{"+t.color+"}";break;case"~%":var r=u.j(t.rd),i=u.j(t.rq),c=u.H(t.r);n=c=r||i?"<=>"===t.r||"<=>>"===t.r||"<<=>"===t.r||"<--\x3e"===t.r?(c="\\long"+c,r&&(c="\\overset{"+r+"}{"+c+"}"),i&&(c="<--\x3e"===t.r?"\\underset{\\lower2mu{"+i+"}}{"+c+"}":"\\underset{\\lower6mu{"+i+"}}{"+c+"}")," {}\\mathrel{"+c+"}{} "):(i&&(c+="[{"+i+"}]")," {}\\mathrel{\\x"+(c+="{"+r+"}")+"}{} "):" {}\\mathrel{\\long"+c+"}{} ";break;case"~N":n=u.J(t.B);break;case"`c":n=t.p1+" ";break;case"%j":n=" ";break;case"~A":case"%N":n="~";break;case"`%":n="\\mkern3mu ";break;case"%T":n="\\mkern2mu ";break;case"~o":n="{,}";break;case"~k":n="{"+t.p1+"}\\mkern6mu ";break;case"~l":n="{"+t.p1+"}\\mkern3mu ";break;case"~m":n="{"+t.p1+"}\\mkern1mu ";break;case"~F":n="\\text{-}";break;case"@Y":n="\\,{\\cdot}\\,";break;case"~v":n="\\mkern1mu \\bullet\\mkern1mu ";break;case"@o":n="{\\times}";break;case"%@":n="\\prime ";break;case"%K":n="\\cdot ";break;case"%L":n="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"%M":n="\\times ";break;case"~f":n="{\\sim}";break;case"^":n="uparrow";break;case"v":n="downarrow";break;case"~w":n="\\ldots ";break;case"/":n="/";break;case"%S":n="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return n},
H:function(t){switch(t){case"->":case"\u2192":case"\u27f6":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<--\x3e":return"leftrightarrows";case"<=>":case"\u21cc":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},
R:function(t){switch(t){case"-":case"1":return"{-}";case"=":case"2":return"{=}";case"#":case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":case"~--":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"-~-":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},
J:function(t){switch(t){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":case"$\\approx$":return" {}\\approx{} ";case"v":case"(v)":return" \\downarrow{} ";case"^":case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};MathJax.Extension["TeX/mhchem"].CE=a,n.Definitions.Add({macros:{ce:"CE",pu:"PU",xleftrightarrow:["Extension","AMSmath"],xrightleftharpoons:["Extension","AMSmath"],xRightleftharpoons:["Extension","AMSmath"],xLeftrightharpoons:["Extension","AMSmath"],longrightleftharpoons:["Macro","\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],longRightleftharpoons:["Macro","\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{\\leftharpoondown}}"],longLeftrightharpoons:["Macro","\\stackrel{\\textstyle\\vphantom{{-}}{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],longleftrightarrows:["Macro","\\raise-3mu{\\stackrel{\\longrightarrow}{\\raise2mu{\\smash{\\longleftarrow}}}}"],tripledash:["Macro","\\vphantom{-}\\raise2mu{\\kern2mu\\tiny\\text{-}\\kern1mu\\text{-}\\kern1mu\\text{-}\\kern2mu}"]}},
null,!0),MathJax.Extension["TeX/AMSmath"]||n.Definitions.Add({macros:{xrightarrow:["Extension","AMSmath"],xleftarrow:["Extension","AMSmath"]}},
null,!0),MathJax.Hub.Register.StartupHook("TeX AMSmath Ready",function(){n.Definitions.Add({macros:{xleftrightarrow:["xArrow",8596,6,6],xrightleftharpoons:["xArrow",8652,5,7],xRightleftharpoons:["xArrow",8652,5,7],xLeftrightharpoons:["xArrow",8652,5,7]}},
null,!0)}),n.Parse.Augment({
CE:function(t){var n=this.GetArgument(t),e=a(n).Parse();this.string=e+this.string.substr(this.i),this.i=0},
PU:function(t){var n=this.GetArgument(t),e=a(n).Parse("pu");this.string=e+this.string.substr(this.i),this.i=0}}),MathJax.Hub.Startup.signal.Post("TeX mhchem Ready")}),MathJax.Ajax.loadComplete("[mhchem]/mhchem.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/newcommand.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.
*/
MathJax.Extension["TeX/newcommand"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.InputJax.TeX;var a=b.Definitions;a.Add({macros:{newcommand:"NewCommand",renewcommand:"NewCommand",newenvironment:"NewEnvironment",renewenvironment:"NewEnvironment",def:"MacroDef",let:"Let"}},null,true);b.Parse.Augment({NewCommand:function(c){var e=this.trimSpaces(this.GetArgument(c)),g=this.GetBrackets(c),d=this.GetBrackets(c),f=this.GetArgument(c);if(e.charAt(0)==="\\"){e=e.substr(1)}if(!e.match(/^(.|[a-z]+)$/i)){b.Error(["IllegalControlSequenceName","Illegal control sequence name for %1",c])}if(g){g=this.trimSpaces(g);if(!g.match(/^[0-9]+$/)){b.Error(["IllegalParamNumber","Illegal number of parameters specified in %1",c])}}this.setDef(e,["Macro",f,g,d])},NewEnvironment:function(d){var f=this.trimSpaces(this.GetArgument(d)),h=this.GetBrackets(d),e=this.GetBrackets(d),g=this.GetArgument(d),c=this.GetArgument(d);if(h){h=this.trimSpaces(h);if(!h.match(/^[0-9]+$/)){b.Error(["IllegalParamNumber","Illegal number of parameters specified in %1",d])}}this.setEnv(f,["BeginEnv",[null,"EndEnv"],g,c,h,e])},MacroDef:function(c){var d=this.GetCSname(c),f=this.GetTemplate(c,"\\"+d),e=this.GetArgument(c);if(!(f instanceof Array)){this.setDef(d,["Macro",e,f])}else{this.setDef(d,["MacroWithTemplate",e].concat(f))}},Let:function(d){var e=this.GetCSname(d),f;var g=this.GetNext();if(g==="="){this.i++;g=this.GetNext()}if(g==="\\"){d=this.GetCSname(d);f=this.csFindMacro(d);if(!f){if(a.mathchar0mi.hasOwnProperty(d)){f=["csMathchar0mi",a.mathchar0mi[d]]}else{if(a.mathchar0mo.hasOwnProperty(d)){f=["csMathchar0mo",a.mathchar0mo[d]]}else{if(a.mathchar7.hasOwnProperty(d)){f=["csMathchar7",a.mathchar7[d]]}else{if(a.delimiter.hasOwnProperty("\\"+d)){f=["csDelimiter",a.delimiter["\\"+d]]}else{return}}}}}}else{f=["Macro",g];this.i++}this.setDef(e,f)},GetCSname:function(e){var f=this.GetNext();if(f!=="\\"){b.Error(["MissingCS","%1 must be followed by a control sequence",e])}var d=this.trimSpaces(this.GetArgument(e));return d.substr(1)},GetTemplate:function(f,e){var j,g=[],h=0;j=this.GetNext();var d=this.i;while(this.i<this.string.length){j=this.GetNext();if(j==="#"){if(d!==this.i){g[h]=this.string.substr(d,this.i-d)}j=this.string.charAt(++this.i);if(!j.match(/^[1-9]$/)){b.Error(["CantUseHash2","Illegal use of # in template for %1",e])}if(parseInt(j)!=++h){b.Error(["SequentialParam","Parameters for %1 must be numbered sequentially",e])}d=this.i+1}else{if(j==="{"){if(d!==this.i){g[h]=this.string.substr(d,this.i-d)}if(g.length>0){return[h,g]}else{return h}}}this.i++}b.Error(["MissingReplacementString","Missing replacement string for definition of %1",f])},MacroWithTemplate:function(d,g,h,f){if(h){var c=[];this.GetNext();if(f[0]&&!this.MatchParam(f[0])){b.Error(["MismatchUseDef","Use of %1 doesn't match its definition",d])}for(var e=0;e<h;e++){c.push(this.GetParameter(d,f[e+1]))}g=this.SubstituteArgs(c,g)}this.string=this.AddArgs(g,this.string.slice(this.i));this.i=0;if(++this.macroCount>b.config.MAXMACROS){b.Error(["MaxMacroSub1","MathJax maximum macro substitution count exceeded; is there a recursive macro call?"])}},BeginEnv:function(g,k,c,j,h){if(j){var e=[];if(h!=null){var d=this.GetBrackets("\\begin{"+name+"}");e.push(d==null?h:d)}for(var f=e.length;f<j;f++){e.push(this.GetArgument("\\begin{"+name+"}"))}k=this.SubstituteArgs(e,k);c=this.SubstituteArgs([],c)}this.string=this.AddArgs(k,this.string.slice(this.i));this.i=0;return g},EndEnv:function(e,g,d,f){var c="\\end{\\end\\"+e.name+"}";this.string=this.AddArgs(d,c+this.string.slice(this.i));this.i=0;return null},GetParameter:function(f,k){if(k==null){return this.GetArgument(f)}var h=this.i,e=0,g=0;while(this.i<this.string.length){var l=this.string.charAt(this.i);if(l==="{"){if(this.i===h){g=1}this.GetArgument(f);e=this.i-h}else{if(this.MatchParam(k)){if(g){h++;e-=2}return this.string.substr(h,e)}else{if(l==="\\"){this.i++;e++;g=0;var d=this.string.substr(this.i).match(/[a-z]+|./i);if(d){this.i+=d[0].length;e=this.i-h}}else{this.i++;e++;g=0}}}}b.Error(["RunawayArgument","Runaway argument for %1?",f])},MatchParam:function(c){if(this.string.substr(this.i,c.length)!==c){return 0}if(c.match(/\\[a-z]+$/i)&&this.string.charAt(this.i+c.length).match(/[a-z]/i)){return 0}this.i+=c.length;return 1}});b.Environment=function(c){a.environment[c]=["BeginEnv",[null,"EndEnv"]].concat([].slice.call(arguments,1));a.environment[c].isUser=true};MathJax.Hub.Startup.signal.Post("TeX newcommand Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/newcommand.js");

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/noUndefined.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.
*/
MathJax.Extension["TeX/noUndefined"]={version:"2.7.9",config:MathJax.Hub.CombineConfig("TeX.noUndefined",{disabled:false,attributes:{mathcolor:"red"}})};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.Extension["TeX/noUndefined"].config;var a=MathJax.ElementJax.mml;var c=MathJax.InputJax.TeX.Parse.prototype.csUndefined;MathJax.InputJax.TeX.Parse.Augment({csUndefined:function(d){if(b.disabled){return c.apply(this,arguments)}MathJax.Hub.signal.Post(["TeX Jax - undefined control sequence",d]);this.Push(a.mtext(d).With(b.attributes))}});MathJax.Hub.Startup.signal.Post("TeX noUndefined Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noUndefined.js");

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/unicode.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.
*/
MathJax.Extension["TeX/unicode"]={version:"2.7.9",unicode:{},config:MathJax.Hub.CombineConfig("TeX.unicode",{fonts:"STIXGeneral,'Arial Unicode MS'"})};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var c=MathJax.InputJax.TeX;var a=MathJax.ElementJax.mml;var b=MathJax.Extension["TeX/unicode"].unicode;c.Definitions.Add({macros:{unicode:"Unicode"}},null,true);c.Parse.Augment({Unicode:function(e){var i=this.GetBrackets(e),d;if(i){if(i.replace(/ /g,"").match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)){i=i.replace(/ /g,"").split(/,/);d=this.GetBrackets(e)}else{d=i;i=null}}var j=this.trimSpaces(this.GetArgument(e)).replace(/^0x/,"x");if(!j.match(/^(x[0-9A-Fa-f]+|[0-9]+)$/)){c.Error(["BadUnicode","Argument to \\unicode must be a number"])}var h=parseInt(j.match(/^x/)?"0"+j:j);if(!b[h]){b[h]=[800,200,d,h]}else{if(!d){d=b[h][2]}}if(i){b[h][0]=Math.floor(i[0]*1000);b[h][1]=Math.floor(i[1]*1000)}var f=this.stack.env.font,g={};if(d){b[h][2]=g.fontfamily=d.replace(/"/g,"'");if(f){if(f.match(/bold/)){g.fontweight="bold"}if(f.match(/italic|-mathit/)){g.fontstyle="italic"}}}else{if(f){g.mathvariant=f}}g.unicode=[].concat(b[h]);this.Push(a.mtext(a.entity("#"+j)).With(g))}});MathJax.Hub.Startup.signal.Post("TeX unicode Ready")});MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.ElementJax.mml;var c=MathJax.Extension["TeX/unicode"].config.fonts;var b=a.mbase.prototype.HTMLgetVariant;a.mbase.Augment({HTMLgetVariant:function(){var d=b.apply(this,arguments);if(d.unicode){delete d.unicode;delete d.FONTS}if(!this.unicode){return d}d.unicode=true;if(!d.defaultFont){d=MathJax.Hub.Insert({},d);d.defaultFont={family:c}}var e=this.unicode[2];if(e){e+=","+c}else{e=c}d.defaultFont[this.unicode[3]]=[this.unicode[0],this.unicode[1],500,0,500,{isUnknown:true,isUnicode:true,font:e}];return d}})});MathJax.Hub.Register.StartupHook("SVG Jax Ready",function(){var a=MathJax.ElementJax.mml;var c=MathJax.Extension["TeX/unicode"].config.fonts;var b=a.mbase.prototype.SVGgetVariant;a.mbase.Augment({SVGgetVariant:function(){var d=b.call(this);if(d.unicode){delete d.unicode;delete d.FONTS}if(!this.unicode){return d}d.unicode=true;if(!d.forceFamily){d=MathJax.Hub.Insert({},d)}d.defaultFamily=c;d.noRemap=true;d.h=this.unicode[0];d.d=this.unicode[1];return d}})});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/unicode.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/TeX/verb.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.
*/
MathJax.Extension["TeX/verb"]={version:"2.7.9"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var a=MathJax.ElementJax.mml;var c=MathJax.InputJax.TeX;var b=c.Definitions;b.Add({macros:{verb:"Verb"}},null,true);c.Parse.Augment({Verb:function(d){var g=this.GetNext();var f=++this.i;if(g==""){c.Error(["MissingArgFor","Missing argument for %1",d])}while(this.i<this.string.length&&this.string.charAt(this.i)!=g){this.i++}if(this.i==this.string.length){c.Error(["NoClosingDelim","Can't find closing delimiter for %1",d])}var e=this.string.slice(f,this.i).replace(/ /g,"\u00A0");this.i++;this.Push(a.mtext(e).With({mathvariant:a.VARIANT.MONOSPACE}))}});MathJax.Hub.Startup.signal.Post("TeX verb Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/verb.js");

View file

@ -0,0 +1,89 @@
!function(i, e) {
var s, u, a = i.config.menuSettings, t = Function.prototype.bind ? function(e, t) {
return e.bind(t);
} : function(e, t) {
return function() {
e.apply(t, arguments);
};
}, o = Object.keys || function(e) {
var t = [];
for (var n in e) e.hasOwnProperty(n) && t.push(n);
return t;
}, n = MathJax.Ajax.config.path;
n.a11y || (n.a11y = i.config.root + "/extensions/a11y");
var l = e["accessibility-menu"] = {
version: "1.6.0",
prefix: "",
defaults: {},
modules: [],
MakeOption: function(e) {
return l.prefix + e;
},
GetOption: function(e) {
return a[l.MakeOption(e)];
},
AddDefaults: function() {
for (var e, t = o(l.defaults), n = 0; e = t[n]; n++) {
var i = l.MakeOption(e);
void 0 === a[i] && (a[i] = l.defaults[e]);
}
},
AddMenu: function() {
for (var e, t = Array(this.modules.length), n = 0; e = this.modules[n]; n++) t[n] = e.placeHolder;
var i, a, o = u.FindId("Accessibility");
o ? (t.unshift(s.RULE()), o.submenu.items.push.apply(o.submenu.items, t)) : ((i = (u.FindId("Settings", "Renderer") || {}).submenu) && (t.unshift(s.RULE()),
t.unshift(i.items.pop()), t.unshift(i.items.pop())), t.unshift("Accessibility"),
o = s.SUBMENU.apply(s.SUBMENU, t), (a = u.IndexOfId("Locale")) ? u.items.splice(a, 0, o) : u.items.push(s.RULE(), o));
},
Register: function(e) {
l.defaults[e.option] = !1, l.modules.push(e);
},
Startup: function() {
s = MathJax.Menu.ITEM, u = MathJax.Menu.menu;
for (var e, t = 0; e = this.modules[t]; t++) e.CreateMenu();
this.AddMenu();
},
LoadExtensions: function() {
for (var e, t = [], n = 0; e = this.modules[n]; n++) a[e.option] && t.push(e.module);
return t.length ? i.Startup.loadArray(t) : null;
}
}, r = MathJax.Extension.ModuleLoader = MathJax.Object.Subclass({
option: "",
name: [ "", "" ],
module: "",
placeHolder: null,
submenu: !1,
extension: null,
Init: function(e, t, n, i, a) {
this.option = e, this.name = [ t.replace(/ /g, ""), t ], this.module = n, this.extension = i,
this.submenu = a || !1;
},
CreateMenu: function() {
var e = t(this.Load, this);
this.submenu ? this.placeHolder = s.SUBMENU(this.name, s.CHECKBOX([ "Activate", "Activate" ], l.MakeOption(this.option), {
action: e
}), s.RULE(), s.COMMAND([ "OptionsWhenActive", "(Options when Active)" ], null, {
disabled: !0
})) : this.placeHolder = s.CHECKBOX(this.name, l.MakeOption(this.option), {
action: e
});
},
Load: function() {
i.Queue([ "Require", MathJax.Ajax, this.module, [ "Enable", this ] ]);
},
Enable: function(e) {
var t = MathJax.Extension[this.extension];
t && (t.Enable(!0, !0), MathJax.Menu.saveCookie());
}
});
l.Register(r("collapsible", "Collapsible Math", "[a11y]/collapsible.js", "collapsible")),
l.Register(r("autocollapse", "Auto Collapse", "[a11y]/auto-collapse.js", "auto-collapse")),
l.Register(r("explorer", "Explorer", "[a11y]/explorer.js", "explorer", !0)), l.AddDefaults(),
i.Register.StartupHook("End Extensions", function() {
i.Register.StartupHook("MathMenu Ready", function() {
l.Startup(), i.Startup.signal.Post("Accessibility Menu Ready");
}, 5);
}, 5), MathJax.Hub.Register.StartupHook("End Cookie", function() {
MathJax.Callback.Queue([ "LoadExtensions", l ], [ "loadComplete", MathJax.Ajax, "[a11y]/accessibility-menu.js" ]);
});
}(MathJax.Hub, MathJax.Extension);

View file

@ -0,0 +1,251 @@
!function(c) {
var s = c.config.menuSettings, r = {}, t = MathJax.Ajax.config.path;
t.a11y || (t.a11y = c.config.root + "/extensions/a11y");
var l = MathJax.Extension["auto-collapse"] = {
version: "1.6.0",
config: c.CombineConfig("auto-collapse", {
disabled: !1
}),
dependents: [],
Enable: function(t, e) {
s.autocollapse = !0, e && (r.autocollapse = !0), this.config.disabled = !1, MathJax.Extension.collapsible.Enable(!1, e),
t && c.Queue([ "Reprocess", c ], [ "CollapseWideMath", this ]);
},
Disable: function(t, e) {
s.autocollapse = !1, e && (r.autocollapse = !1), this.config.disabled = !0;
for (var n = this.dependents.length - 1; 0 <= n; n--) {
var o = this.dependents[n];
o.Disable && o.Disable(!1, e);
}
t && c.Queue([ "Rerender", c ]);
},
Dependent: function(t) {
this.dependents.push(t);
},
Startup: function() {
var t = MathJax.Extension.collapsible;
t && t.Dependent(this), c.postInputHooks.Add([ "Filter", l ], 150), c.Queue(function() {
return l.CollapseWideMath();
}), window.addEventListener ? window.addEventListener("resize", l.resizeHandler, !1) : window.attachEvent ? window.attachEvent("onresize", l.resizeHandler) : window.onresize = l.resizeHandler;
},
Filter: function(t, e, n) {
t.enriched && !this.config.disabled && ("block" === t.root.Get("display") || n.parentNode.childNodes.length <= 3) && (t.root.SRE = {
action: this.Actions(t.root)
});
},
Actions: function(t) {
var e = [];
return this.getActions(t, 0, e), this.sortActions(e);
},
getActions: function(t, e, n) {
if (!t.isToken && t.data) {
e++;
for (var o, i = 0, a = t.data.length; i < a; i++) {
t.data[i] && ((o = t.data[i]).collapsible ? (n[e] || (n[e] = []), n[e].push(o),
this.getActions(o.data[1], e, n)) : this.getActions(o, e, n));
}
}
},
sortActions: function(t) {
for (var e = [], n = 0, o = t.length; n < o; n++) t[n] && (e = e.concat(t[n].sort(this.sortActionsBy)));
return e;
},
sortActionsBy: function(t, e) {
return (t = t.data[1].complexity) < (e = e.data[1].complexity) ? -1 : e < t ? 1 : 0;
},
CollapseWideMath: function(t) {
if (!this.config.disabled) {
this.GetContainerWidths(t);
var e = c.getAllJax(t), n = {
collapse: [],
jax: e,
m: e.length,
i: 0,
changed: !1
};
return this.collapseState(n);
}
},
collapseState: function(t) {
for (var e = t.collapse; t.i < t.m; ) {
var n = t.jax[t.i], o = n.root.SRE;
if (t.changed = !1, o && o.action.length && (o.cwidth < o.m || o.cwidth > o.M)) {
var i = this.getActionWidths(n, t);
if (i) return i;
this.collapseActions(o, t), t.changed && e.push(n.SourceElement());
}
t.i++;
}
if (0 !== e.length) return 1 === e.length && (e = e[0]), c.Rerender(e);
},
collapseActions: function(t, e) {
for (var n = t.width, o = n, i = 1e6, a = t.action.length - 1; 0 <= a; a--) {
var s = t.action[a], r = s.selection;
n > t.cwidth ? (s.selection = 1, o = s.SREwidth, i = n) : s.selection = 2, n = s.SREwidth,
t.DOMupdate ? document.getElementById(s.id).setAttribute("selection", s.selection) : s.selection !== r && (e.changed = !0);
}
t.m = o, t.M = i;
},
getActionWidths: function(t, e) {
if (!t.root.SRE.actionWidths) {
MathJax.OutputJax[t.outputJax].getMetrics(t);
try {
this.computeActionWidths(t);
} catch (t) {
if (!t.restart) throw t;
return MathJax.Callback.After([ "collapseState", this, e ], t.restart);
}
e.changed = !0;
}
return null;
},
computeActionWidths: function(t) {
var e, n = t.root.SRE, o = n.action, i = {};
for (n.width = t.sreGetRootWidth(i), e = o.length - 1; 0 <= e; e--) o[e].selection = 2;
for (e = o.length - 1; 0 <= e; e--) {
var a = o[e];
null == a.SREwidth && (a.selection = 1, a.SREwidth = t.sreGetActionWidth(i, a));
}
n.actionWidths = !0;
},
GetContainerWidths: function(t) {
for (var e, n, o, i = c.getAllJax(t), a = MathJax.HTML.Element("span", {
style: {
display: "block"
}
}), s = [], r = 0, l = i.length; r < l; r++) o = (n = i[r]).root, SRE = o.SRE, SRE && SRE.action.length && (null == SRE.width && (n.sreGetMetrics(),
SRE.m = SRE.width, SRE.M = 1e6), (e = n.SourceElement()).previousSibling.style.display = "none",
e.parentNode.insertBefore(a.cloneNode(!1), e), s.push([ n, e ]));
for (r = 0, l = s.length; r < l; r++) n = s[r][0], (e = s[r][1]).previousSibling.offsetWidth && (n.root.SRE.cwidth = e.previousSibling.offsetWidth * n.root.SRE.em);
for (r = 0, l = s.length; r < l; r++) n = s[r][0], (e = s[r][1]).parentNode.removeChild(e.previousSibling),
e.previousSibling.style.display = "";
},
timer: null,
running: !1,
retry: !1,
saved_delay: 0,
resizeHandler: function(t) {
l.config.disabled || (l.running ? l.retry = !0 : (l.timer && clearTimeout(l.timer),
l.timer = setTimeout(l.resizeAction, 100)));
},
resizeAction: function() {
l.timer = null, l.running = !0, c.Queue(function() {
l.saved_delay = c.processSectionDelay, c.processSectionDelay = 0;
}, [ "CollapseWideMath", l ], [ "resizeCheck", l ]);
},
resizeCheck: function() {
l.running = !1, c.processSectionDelay = l.saved_delay, l.retry && (l.retry = !1,
setTimeout(l.resizeHandler, 0));
}
};
c.Register.StartupHook("End Extensions", function() {
null == s.autocollapse ? s.autocollapse = !l.config.disabled : l.config.disabled = !s.autocollapse,
c.Register.StartupHook("MathMenu Ready", function() {
r = MathJax.Menu.cookie;
var t, e = MathJax.Menu.ITEM, n = MathJax.Menu.menu, o = e.CHECKBOX([ "AutoCollapse", "Auto Collapse" ], "autocollapse", {
action: function(t) {
l[s.autocollapse ? "Enable" : "Disable"](!0, !0), MathJax.Menu.saveCookie();
}
}), i = (n.FindId("Accessibility") || {}).submenu;
i ? null !== (t = i.IndexOfId("AutoCollapse")) ? i.items[t] = o : (t = i.IndexOfId("CollapsibleMath"),
i.items.splice(t + 1, 0, o)) : (t = n.IndexOfId("CollapsibleMath"), n.items.splice(t + 1, 0, o));
function a() {
l[s.autocollapse ? "Enable" : "Disable"]();
}
MathJax.Extension.collapse ? a() : MathJax.Hub.Register.StartupHook("Auto Collapse Ready", a);
}, 25);
}, 25);
}(MathJax.Hub), MathJax.ElementJax.Augment({
sreGetMetrics: function() {
MathJax.OutputJax[this.outputJax].sreGetMetrics(this, this.root.SRE);
},
sreGetRootWidth: function(t) {
return MathJax.OutputJax[this.outputJax].sreGetRootWidth(this, t);
},
sreGetActionWidth: function(t, e) {
return MathJax.OutputJax[this.outputJax].sreGetActionWidth(this, t, e);
}
}), MathJax.OutputJax.Augment({
getMetrics: function() {},
sreGetMetrics: function(t, e) {
e.cwidth = 1e6, e.width = 0, e.em = 12;
},
sreGetRootWidth: function(t, e) {
return 0;
},
sreGetActionWidth: function(t, e, n) {
return 0;
}
}), MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready", function() {
MathJax.OutputJax["HTML-CSS"].Augment({
sreGetMetrics: function(t, e) {
e.width = t.root.data[0].HTMLspanElement().parentNode.bbox.w, e.em = 1 / t.HTMLCSS.em / t.HTMLCSS.scale;
},
sreGetRootWidth: function(t, e) {
var n = t.root.data[0].HTMLspanElement();
return e.box = n.parentNode, e.box.bbox.w;
},
sreGetActionWidth: function(t, e, n) {
return t.root.data[0].toHTML(e.box).bbox.w;
}
});
}), MathJax.Hub.Register.StartupHook("SVG Jax Ready", function() {
MathJax.OutputJax.SVG.Augment({
getMetrics: function(t) {
this.em = MathJax.ElementJax.mml.mbase.prototype.em = t.SVG.em, this.ex = t.SVG.ex,
this.linebreakWidth = t.SVG.lineWidth, this.cwidth = t.SVG.cwidth;
},
sreGetMetrics: function(t, e) {
e.width = t.root.SVGdata.w / 1e3, e.em = 1 / t.SVG.em;
},
sreGetRootWidth: function(t, e) {
return e.span = document.getElementById(t.inputID + "-Frame"), t.root.SVGdata.w / 1e3;
},
sreGetActionWidth: function(t, e, n) {
this.mathDiv = e.span, e.span.appendChild(this.textSVG);
try {
t.root.data[0].toSVG();
} catch (t) {
var o = t;
}
if (e.span.removeChild(this.textSVG), o) throw o;
return t.root.data[0].SVGdata.w / 1e3;
}
});
}), MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready", function() {
MathJax.OutputJax.CommonHTML.Augment({
sreGetMetrics: function(t, e) {
e.width = t.root.CHTML.w, e.em = 1 / t.CHTML.em / t.CHTML.scale;
},
sreGetRootWidth: function(t, e) {
return e.span = document.getElementById(t.inputID + "-Frame").firstChild, e.tmp = document.createElement("span"),
e.tmp.className = e.span.className, t.root.CHTML.w / t.CHTML.scale;
},
sreGetActionWidth: function(t, e, n) {
e.span.parentNode.replaceChild(e.tmp, e.span), MathJax.OutputJax.CommonHTML.CHTMLnode = e.tmp;
try {
t.root.data[0].toCommonHTML(e.tmp);
} catch (t) {
var o = t;
}
if (e.tmp.parentNode.replaceChild(e.span, e.tmp), o) throw o;
return t.root.data[0].CHTML.w / t.CHTML.scale;
}
});
}), MathJax.Hub.Register.StartupHook("NativeMML Jax Ready", function() {
MathJax.OutputJax.NativeMML.Augment({
sreGetMetrics: function(t, e) {
var n = document.getElementById(t.inputID + "-Frame");
e.width = n.offsetWidth, e.em = 1, e.DOMupdate = !0;
},
sreGetRootWidth: function(t, e) {
return e.span = document.getElementById(t.inputID + "-Frame").firstChild, e.span.offsetWidth;
},
sreGetActionWidth: function(t, e, n) {
return document.getElementById(n.id).setAttribute("selection", 1), e.span.offsetWidth;
}
});
}), MathJax.Ajax.Require("[a11y]/collapsible.js"), MathJax.Hub.Register.StartupHook("Collapsible Ready", function() {
MathJax.Extension["auto-collapse"].Startup(), MathJax.Hub.Startup.signal.Post("Auto Collapse Ready"),
MathJax.Ajax.loadComplete("[a11y]/auto-collapse.js");
});

View file

@ -0,0 +1,344 @@
!function(s) {
var n, l = s.config.menuSettings, o = {}, r = "data-semantic-complexity", t = MathJax.Ajax.config.path;
t.a11y || (t.a11y = s.config.root + "/extensions/a11y");
var h = MathJax.Extension.collapsible = {
version: "1.6.0",
config: s.CombineConfig("collapsible", {
disabled: !1
}),
dependents: [],
COMPLEXATTR: r,
COMPLEXITY: {
TEXT: .5,
TOKEN: .5,
CHILD: 1,
SCRIPT: .8,
SQRT: 2,
SUBSUP: 2,
UNDEROVER: 2,
FRACTION: 2,
ACTION: 2,
PHANTOM: 0,
XML: 2,
GLYPH: 2
},
COLLAPSE: {
identifier: 3,
number: 3,
text: 10,
infixop: 15,
relseq: 15,
multirel: 15,
fenced: 18,
bigop: 20,
integral: 20,
fraction: 12,
sqrt: 9,
root: 12,
vector: 15,
matrix: 15,
cases: 15,
superscript: 9,
subscript: 9,
subsup: 9,
punctuated: {
endpunct: 1e7,
startpunct: 1e7,
value: 12
}
},
MARKER: {
identifier: "x",
number: "#",
text: "...",
appl: {
"limit function": "lim",
value: "f()"
},
fraction: "/",
sqrt: "\u221a",
root: "\u221a",
superscript: "\u25fd\u02d9",
subscript: "\u25fd.",
subsup: "\u25fd:",
vector: {
binomial: "(:)",
determinant: "|:|",
value: "\u27e8:\u27e9"
},
matrix: {
squarematrix: "[::]",
rowvector: "\u27e8\u22ef\u27e9",
columnvector: "\u27e8\u22ee\u27e9",
determinant: "|::|",
value: "(::)"
},
cases: "{:",
infixop: {
addition: "+",
subtraction: "\u2212",
multiplication: "\u22c5",
implicit: "\u22c5",
value: "+"
},
punctuated: {
text: "...",
value: ","
}
},
Enable: function(t, i) {
l.collapsible = !0, i && (o.collapsible = !0), this.config.disabled = !1, MathJax.Extension["semantic-enrich"].Enable(!1, i),
t && s.Queue([ "Reprocess", s ]);
},
Disable: function(t, i) {
l.collapsible = !1, i && (o.collapsible = !1), this.config.disabled = !0;
for (var e = this.dependents.length - 1; 0 <= e; e--) {
var a = this.dependents[e];
a.Disable && a.Disable(!1, i);
}
t && s.Queue([ "Reprocess", s ]);
},
Dependent: function(t) {
this.dependents.push(t);
},
Startup: function() {
n = MathJax.ElementJax.mml;
var t = MathJax.Extension["semantic-enrich"];
t && t.Dependent(this), s.postInputHooks.Add([ "Filter", h ], 100);
},
Filter: function(t, i, e) {
t.enriched && !this.config.disabled && (t.root = t.root.Collapse(), t.root.inputID = e.id);
},
Marker: function(t) {
return n.mtext("\u25c2" + t + "\u25b8").With({
mathcolor: "blue",
attr: {},
attrNames: []
});
},
MakeAction: function(t, i) {
var e = n.maction(t).With({
id: this.getActionID(),
actiontype: "toggle",
complexity: t.getComplexity(),
collapsible: !0,
attrNames: [ "id", "actiontype", "selection", r ],
attr: {},
selection: 2
});
if (e.attr[r] = e.complexity, "math" === i.type) {
var a = n.mrow().With({
complexity: i.complexity,
attrNames: [],
attr: {}
});
a.Append.apply(a, i.data[0].data), i.data[0].data = [];
for (var s, l = i.attrNames.length - 1; s = i.attrNames[l]; l--) "data-semantic-" === s.substr(0, 14) && (a.attr[s] = i.attr[s],
a.attrNames.push(s), delete i.attr[s], i.attrNames.splice(l, 1));
a.complexity = i.complexity, e.Append(a), i.Append(e), i.complexity = e.complexity,
e = i;
} else e.Append(i);
return e;
},
actionID: 1,
getActionID: function() {
return "MJX-Collapse-" + this.actionID++;
},
Collapse: function(t) {
t.getComplexity();
var i, e, a, s = (t.attr || {})["data-semantic-type"];
return s && (this["Collapse_" + s] ? t = this["Collapse_" + s](t) : this.COLLAPSE[s] && this.MARKER[s] && (i = t.attr["data-semantic-role"],
"number" != typeof (e = this.COLLAPSE[s]) && (e = e[i] || e.value), t.complexity > e && ("string" != typeof (a = this.MARKER[s]) && (a = a[i] || a.value),
t = this.MakeAction(this.Marker(a), t)))), t;
},
UncollapseChild: function(t, i, e) {
if (null == e && (e = 1), this.SplitAttribute(t, "children").length === e) {
var a = 1 === t.data.length && t.data[0].inferred ? t.data[0] : t;
if (a && a.data[i] && a.data[i].collapsible) return a.SetData(i, a.data[i].data[1]),
t.complexity = a.complexity = null, t.getComplexity(), 1;
}
return 0;
},
FindChildText: function(t, i) {
var e = this.FindChild(t, i);
return e ? (e.CoreMO() || e).data.join("") : "?";
},
FindChild: function(t, i) {
if (t) {
if (t.attr && t.attr["data-semantic-id"] === i) return t;
if (!t.isToken) for (var e = 0, a = t.data.length; e < a; e++) {
var s = this.FindChild(t.data[e], i);
if (s) return s;
}
}
return null;
},
SplitAttribute: function(t, i) {
return (t.attr["data-semantic-" + i] || "").split(/,/);
},
Collapse_fenced: function(t) {
var i;
return this.UncollapseChild(t, 1), t.complexity > this.COLLAPSE.fenced && "leftright" === t.attr["data-semantic-role"] && (i = t.data[0].data.join("") + t.data[t.data.length - 1].data.join(""),
t = this.MakeAction(this.Marker(i), t)), t;
},
Collapse_appl: function(t) {
var i;
return this.UncollapseChild(t, 2, 2) && (i = (i = this.MARKER.appl)[t.attr["data-semantic-role"]] || i.value,
t = this.MakeAction(this.Marker(i), t)), t;
},
Collapse_sqrt: function(t) {
return this.UncollapseChild(t, 0), t.complexity > this.COLLAPSE.sqrt && (t = this.MakeAction(this.Marker(this.MARKER.sqrt), t)),
t;
},
Collapse_root: function(t) {
return this.UncollapseChild(t, 0), t.complexity > this.COLLAPSE.sqrt && (t = this.MakeAction(this.Marker(this.MARKER.sqrt), t)),
t;
},
Collapse_enclose: function(t) {
var i, e;
return 1 !== this.SplitAttribute(t, "children").length || (i = 1 === t.data.length && t.data[0].inferred ? t.data[0] : t).data[0] && i.data[0].collapsible && (e = i.data[0],
i.SetData(0, e.data[1]), e.SetData(1, t), t = e), t;
},
Collapse_bigop: function(t) {
var i, e;
return (t.complexity > this.COLLAPSE.bigop || "mo" !== t.data[0].type) && (i = this.SplitAttribute(t, "content").pop(),
e = h.FindChildText(t, i), t = this.MakeAction(this.Marker(e), t)), t;
},
Collapse_integral: function(t) {
var i, e;
return (t.complexity > this.COLLAPSE.integral || "mo" !== t.data[0].type) && (i = this.SplitAttribute(t, "content")[0],
e = h.FindChildText(t, i), t = this.MakeAction(this.Marker(e), t)), t;
},
Collapse_relseq: function(t) {
var i, e;
return t.complexity > this.COLLAPSE.relseq && (i = this.SplitAttribute(t, "content"),
e = h.FindChildText(t, i[0]), 1 < i.length && (e += "\u22ef"), t = this.MakeAction(this.Marker(e), t)),
t;
},
Collapse_multirel: function(t) {
var i, e;
return t.complexity > this.COLLAPSE.multirel && (i = this.SplitAttribute(t, "content"),
e = h.FindChildText(t, i[0]) + "\u22ef", t = this.MakeAction(this.Marker(e), t)),
t;
},
Collapse_superscript: function(t) {
return this.UncollapseChild(t, 0, 2), t.complexity > this.COLLAPSE.superscript && (t = this.MakeAction(this.Marker(this.MARKER.superscript), t)),
t;
},
Collapse_subscript: function(t) {
return this.UncollapseChild(t, 0, 2), t.complexity > this.COLLAPSE.subscript && (t = this.MakeAction(this.Marker(this.MARKER.subscript), t)),
t;
},
Collapse_subsup: function(t) {
return this.UncollapseChild(t, 0, 3), t.complexity > this.COLLAPSE.subsup && (t = this.MakeAction(this.Marker(this.MARKER.subsup), t)),
t;
}
};
s.Register.StartupHook("End Extensions", function() {
null == l.collapsible ? l.collapsible = !h.config.disabled : h.config.disabled = !l.collapsible,
s.Register.StartupHook("MathMenu Ready", function() {
o = MathJax.Menu.cookie;
var t, i = MathJax.Menu.ITEM, e = MathJax.Menu.menu, a = i.CHECKBOX([ "CollapsibleMath", "Collapsible Math" ], "collapsible", {
action: function(t) {
h[l.collapsible ? "Enable" : "Disable"](!0, !0), MathJax.Menu.saveCookie();
}
}), s = (e.FindId("Accessibility") || {}).submenu;
s ? null !== (t = s.IndexOfId("CollapsibleMath")) ? s.items[t] = a : s.items.push(i.RULE(), a) : (t = e.IndexOfId("About"),
e.items.splice(t, 0, a, i.RULE()));
}, 15);
}, 15);
}(MathJax.Hub), MathJax.Ajax.Require("[a11y]/semantic-enrich.js"), MathJax.Hub.Register.StartupHook("Semantic Enrich Ready", function() {
var t = MathJax.ElementJax.mml, i = MathJax.Extension.collapsible, a = i.COMPLEXITY, s = i.COMPLEXATTR;
i.Startup(), t.mbase.Augment({
Collapse: function() {
return i.Collapse(this);
},
getComplexity: function() {
if (null == this.complexity) {
var t = 0;
if (this.isToken) t = a.TEXT * this.data.join("").length + a.TOKEN; else {
for (var i = 0, e = this.data.length; i < e; i++) this.data[i] && (this.SetData(i, this.data[i].Collapse()),
t += this.data[i].complexity);
1 < e && (t += e * a.CHILD);
}
!this.attrNames || "complexity" in this || this.attrNames.push(s), this.attr && (this.attr[s] = t),
this.complexity = t;
}
return this.complexity;
},
reportComplexity: function() {
!this.attr || !this.attrNames || s in this.attr || (this.attrNames.push(s), this.attr[s] = this.complexity);
}
}), t.mfrac.Augment({
getComplexity: function() {
return null == this.complexity && (this.SUPER(arguments).getComplexity.call(this),
this.complexity *= a.SCRIPT, this.complexity += a.FRACTION, this.attr[s] = this.complexity),
this.complexity;
}
}), t.msqrt.Augment({
getComplexity: function() {
return null == this.complexity && (this.SUPER(arguments).getComplexity.call(this),
this.complexity += a.SQRT, this.attr[s] = this.complexity), this.complexity;
}
}), t.mroot.Augment({
getComplexity: function() {
return null == this.complexity && (this.SUPER(arguments).getComplexity.call(this),
this.complexity -= (1 - a.SCRIPT) * this.data[1].getComplexity(), this.complexity += a.SQRT,
this.attr[s] = this.complexity), this.complexity;
}
}), t.msubsup.Augment({
getComplexity: function() {
var t;
return null == this.complexity && (t = 0, this.data[this.sub] && (t = this.data[this.sub].getComplexity() + a.CHILD),
this.data[this.sup] && (t = Math.max(this.data[this.sup].getComplexity(), t)), t *= a.SCRIPT,
this.data[this.sub] && (t += a.CHILD), this.data[this.sup] && (t += a.CHILD), this.data[this.base] && (t += this.data[this.base].getComplexity() + a.CHILD),
this.complexity = t + a.SUBSUP, this.reportComplexity()), this.complexity;
}
}), t.munderover.Augment({
getComplexity: function() {
var t;
return null == this.complexity && (t = 0, this.data[this.sub] && (t = this.data[this.sub].getComplexity() + a.CHILD),
this.data[this.sup] && (t = Math.max(this.data[this.sup].getComplexity(), t)), t *= a.SCRIPT,
this.data[this.base] && (t = Math.max(this.data[this.base].getComplexity(), t)),
this.data[this.sub] && (t += a.CHILD), this.data[this.sup] && (t += a.CHILD), this.data[this.base] && (t += a.CHILD),
this.complexity = t + a.UNDEROVER, this.reportComplexity()), this.complexity;
}
}), t.mphantom.Augment({
getComplexity: function() {
return this.complexity = a.PHANTOM, this.reportComplexity(), this.complexity;
}
}), t.ms.Augment({
getComplexity: function() {
return this.SUPER(arguments).getComplexity.call(this), this.complexity += this.Get("lquote").length * a.TEXT,
this.complexity += this.Get("rquote").length * a.TEXT, this.attr[s] = this.complexity,
this.complexity;
}
}), t.menclose.Augment({
getComplexity: function() {
return null == this.complexity && (this.SUPER(arguments).getComplexity.call(this),
this.complexity += a.ACTION, this.attr[s] = this.complexity), this.complexity;
}
}), t.maction.Augment({
getComplexity: function() {
return this.complexity = (this.collapsible ? this.data[0] : this.selected()).getComplexity(),
this.reportComplexity(), this.complexity;
}
}), t.semantics.Augment({
getComplexity: function() {
return null == this.complexity && (this.complexity = this.data[0] ? this.data[0].getComplexity() : 0,
this.reportComplexity()), this.complexity;
}
}), t["annotation-xml"].Augment({
getComplexity: function() {
return this.complexity = a.XML, this.reportComplexity(), this.complexity;
}
}), t.annotation.Augment({
getComplexity: function() {
return this.complexity = a.XML, this.reportComplexity(), this.complexity;
}
}), t.mglyph.Augment({
getComplexity: function() {
return this.complexity = a.GLYPH, this.reportComplexity(), this.complexity;
}
}), MathJax.Hub.Startup.signal.Post("Collapsible Ready"), MathJax.Ajax.loadComplete("[a11y]/collapsible.js");
});

View file

@ -0,0 +1,417 @@
MathJax.Hub.Register.StartupHook("Sre Ready", function() {
var o, r, s = MathJax.Hub.config.menuSettings, l = {};
MathJax.Hub.Register.StartupHook("MathEvents Ready", function() {
o = MathJax.Extension.MathEvents.Event.False, r = MathJax.Extension.MathEvents.Event.KEY;
});
var h = MathJax.Extension.explorer = {
version: "1.6.0",
dependents: [],
defaults: {
walker: "table",
highlight: "none",
background: "blue",
foreground: "black",
speech: !0,
generation: "lazy",
subtitle: !1,
ruleset: "mathspeak-default"
},
eagerComplexity: 80,
prefix: "Assistive-",
hook: null,
locHook: null,
oldrules: null,
addMenuOption: function(e, t) {
s[h.prefix + e] = t;
},
addDefaults: function() {
for (var e, t = MathJax.Hub.CombineConfig("explorer", h.defaults), a = Object.keys(t), i = 0; e = a[i]; i++) void 0 === s[h.prefix + e] && h.addMenuOption(e, t[e]);
h.setSpeechOption(), u.Reset();
},
setOption: function(e, t) {
s[h.prefix + e] !== t && (h.addMenuOption(e, t), u.Reset());
},
getOption: function(e) {
return s[h.prefix + e];
},
speechOption: function(e) {
h.oldrules !== e.value && (h.setSpeechOption(), u.Regenerate());
},
setSpeechOption: function() {
var e = s[h.prefix + "ruleset"], t = e.split("-");
sre.System.getInstance().setupEngine({
locale: MathJax.Localization.locale,
domain: h.Domain(t[0]),
style: t[1]
}), h.oldrules = e;
},
Domain: function(e) {
switch (e) {
case "chromevox":
return "default";
case "clearspeak":
return "clearspeak";
case "mathspeak":
default:
return "mathspeak";
}
},
Enable: function(e, t) {
s.explorer = !0, t && (l.explorer = !0), MathJax.Extension.collapsible.Enable(!1, t),
MathJax.Extension.AssistiveMML && (MathJax.Extension.AssistiveMML.config.disabled = !0,
s.assistiveMML = !1, t && (l.assistiveMML = !1)), this.DisableMenus(!1), this.hook || (this.hook = MathJax.Hub.Register.MessageHook("New Math", [ "Register", this.Explorer ])),
this.locHook || (this.locHook = MathJax.Hub.Register.MessageHook("Locale Reset", [ "RemoveSpeech", this.Explorer ])),
e && MathJax.Hub.Queue([ "Reprocess", MathJax.Hub ]);
},
Disable: function(e, t) {
s.explorer = !1, t && (l.explorer = !1), this.DisableMenus(!0), this.hook && (MathJax.Hub.UnRegister.MessageHook(this.hook),
this.hook = null);
for (var a = this.dependents.length - 1; 0 <= a; a--) {
var i = this.dependents[a];
i.Disable && i.Disable(!1, t);
}
},
DisableMenus: function(e) {
if (MathJax.Menu) {
var t = MathJax.Menu.menu.FindId("Accessibility", "Explorer");
if (t) {
for (var a, i = (t = t.submenu).items, n = 2; a = i[n]; n++) a.disabled = e;
e || !t.FindId("SpeechOutput") || s[h.prefix + "speech"] || (t.FindId("Subtitles").disabled = !0);
}
}
},
Dependent: function(e) {
this.dependents.push(e);
}
}, n = MathJax.Object.Subclass({
div: null,
inner: null,
Init: function() {
this.div = n.Create("assertive"), this.inner = MathJax.HTML.addElement(this.div, "div");
},
Add: function() {
n.added || (document.body.appendChild(this.div), n.added = !0);
},
Show: function(e, t) {
this.div.classList.add("MJX_LiveRegion_Show");
var a = e.getBoundingClientRect(), i = a.bottom + 10 + window.pageYOffset, n = a.left + window.pageXOffset;
this.div.style.top = i + "px", this.div.style.left = n + "px";
var o = t.colorString();
this.inner.style.backgroundColor = o.background, this.inner.style.color = o.foreground;
},
Hide: function(e) {
this.div.classList.remove("MJX_LiveRegion_Show");
},
Clear: function() {
this.Update(""), this.inner.style.top = "", this.inner.style.backgroundColor = "";
},
Update: function(e) {
h.getOption("speech") && n.Update(this.inner, e);
}
}, {
ANNOUNCE: "Navigatable Math in page. Explore with enter or shift space and arrow keys. Expand or collapse elements hitting enter.",
announced: !1,
added: !1,
styles: {
".MJX_LiveRegion": {
position: "absolute",
top: "0",
height: "1px",
width: "1px",
padding: "1px",
overflow: "hidden"
},
".MJX_LiveRegion_Show": {
top: "0",
position: "absolute",
width: "auto",
height: "auto",
padding: "0px 0px",
opacity: 1,
"z-index": "202",
left: 0,
right: 0,
margin: "0 auto",
"background-color": "white",
"box-shadow": "0px 10px 20px #888",
border: "2px solid #CCCCCC"
}
},
Create: function(e) {
var t = MathJax.HTML.Element("div", {
className: "MJX_LiveRegion"
});
return t.setAttribute("aria-live", e), t;
},
Update: MathJax.Hub.Browser.isPC ? function(e, t) {
e.textContent = "", setTimeout(function() {
e.textContent = t;
}, 100);
} : function(e, t) {
e.textContent = "", e.textContent = t;
},
Announce: function() {
var e;
h.getOption("speech") && (n.announced = !0, MathJax.Ajax.Styles(n.styles), e = n.Create("polite"),
document.body.appendChild(e), n.Update(e, n.ANNOUNCE), setTimeout(function() {
document.body.removeChild(e);
}, 1e3));
}
});
MathJax.Extension.explorer.LiveRegion = n;
var e = MathJax.Ajax.fileURL(MathJax.Ajax.config.path.a11y), u = MathJax.Extension.explorer.Explorer = {
liveRegion: n(),
walker: null,
highlighter: null,
hoverer: null,
flamer: null,
speechDiv: null,
earconFile: e + "/invalid_keypress" + (-1 !== [ "Firefox", "Chrome", "Opera" ].indexOf(MathJax.Hub.Browser.name) ? ".ogg" : ".mp3"),
expanded: !1,
focusoutEvent: MathJax.Hub.Browser.isFirefox ? "blur" : "focusout",
focusinEvent: "focus",
ignoreFocusOut: !1,
jaxCache: {},
messageID: null,
Reset: function() {
u.FlameEnriched();
},
Register: function(e) {
var t, a;
!h.hook || (t = document.getElementById(e[1])) && t.id && ((a = MathJax.Hub.getJaxFor(t.id)) && a.enriched && (u.StateChange(t.id, a),
u.liveRegion.Add(), u.AddEvent(t)));
},
StateChange: function(e, t) {
u.GetHighlighter(.2);
var a = u.jaxCache[e];
a && a === t.root || (a && sre.Walker.resetState(e + "-Frame"), u.jaxCache[e] = t.root);
},
AddAria: function(e) {
e.setAttribute("role", "application"), e.setAttribute("aria-label", "Math");
},
AddHook: function(i) {
u.RemoveHook(), u.hook = MathJax.Hub.Register.MessageHook("End Math", function(e) {
var t = e[1].id + "-Frame", a = document.getElementById(t);
i && t === u.expanded && (u.ActivateWalker(a, i), a.focus(), u.expanded = !1);
});
},
RemoveHook: function() {
u.hook && (MathJax.Hub.UnRegister.MessageHook(u.hook), u.hook = null);
},
AddMessage: function() {
return MathJax.Message.Set("Generating Speech Output");
},
RemoveMessage: function(e) {
e && MathJax.Message.Clear(e);
},
AddEvent: function(e) {
var t, a = e.id + "-Frame", i = e.previousSibling;
i && (t = i.id !== a ? i.firstElementChild : i, u.AddAria(t), u.AddMouseEvents(t),
"MathJax_MathML" === t.className && (t = t.firstElementChild), t && (t.onkeydown = u.Keydown,
u.Flame(t), t.addEventListener(u.focusinEvent, function(e) {
h.hook && (n.announced || n.Announce());
}), t.addEventListener(u.focusoutEvent, function(e) {
h.hook && (u.ignoreFocusOut && (u.ignoreFocusOut = !1, "enter" === u.walker.moved) ? e.target.focus() : u.walker && u.DeactivateWalker());
}), h.getOption("speech") && u.AddSpeech(t)));
},
AddSpeech: function(e) {
var t = e.id, a = MathJax.Hub.getJaxFor(t).root.toMathML();
if (e.getAttribute("haslabel") || u.AddMathLabel(a, t), !e.getAttribute("hasspeech")) switch (MathJax.Hub.config.explorer.generation) {
case "eager":
u.AddSpeechEager(a, t);
break;
case "mixed":
e.querySelectorAll("[data-semantic-complexity]").length >= h.eagerComplexity && u.AddSpeechEager(a, t);
}
},
AddSpeechLazy: function(e) {
var t = new sre.TreeSpeechGenerator();
t.setRebuilt(u.walker.getRebuilt()), t.getSpeech(u.walker.rootNode, u.walker.getXml()),
e.setAttribute("hasspeech", "true");
},
AddSpeechEager: function(e, t) {
u.MakeSpeechTask(e, t, sre.TreeSpeechGenerator, function(e, t) {
e.setAttribute("hasspeech", "true");
}, 5);
},
AddMathLabel: function(e, t) {
u.MakeSpeechTask(e, t, sre.SummarySpeechGenerator, function(e, t) {
e.setAttribute("haslabel", "true"), e.setAttribute("aria-label", t);
}, 5);
},
MakeSpeechTask: function(i, n, o, r, e) {
var s = u.AddMessage();
setTimeout(function() {
var e = new o(), t = document.getElementById(n), a = new sre.DummyWalker(t, e, u.highlighter, i).speech();
a && r(t, a), u.RemoveMessage(s);
}, e);
},
Keydown: function(e) {
var t = e.keyCode;
if (t === r.ESCAPE) {
if (!u.walker) return;
return u.RemoveHook(), u.DeactivateWalker(), void o(e);
}
if (u.walker && u.walker.isActive()) {
t = t === r.RETURN ? r.DASH : t, void 0 !== u.walker.modifier && (u.walker.modifier = e.shiftKey);
var a = u.walker.move(t);
if (null === a) return;
if (a) {
if ("expand" === u.walker.moved) {
if (u.expanded = u.walker.node.id, MathJax.Hub.Browser.isEdge) return u.ignoreFocusOut = !0,
void u.DeactivateWalker();
if (MathJax.Hub.Browser.isFirefox || MathJax.Hub.Browser.isMSIE) return void u.DeactivateWalker();
}
u.liveRegion.Update(u.walker.speech()), u.Highlight();
} else u.PlayEarcon();
o(e);
} else {
var i = e.target;
if (t === r.SPACE && !e.shiftKey) return MathJax.Extension.MathEvents.Event.ContextMenu(e, i),
void o(e);
if (h.hook && (t === r.RETURN || t === r.SPACE && e.shiftKey)) {
var n = MathJax.Hub.getJaxFor(i);
return u.ActivateWalker(i, n), u.AddHook(n), void o(e);
}
}
},
GetHighlighter: function(e) {
u.highlighter = sre.HighlighterFactory.highlighter({
color: h.getOption("background"),
alpha: e
}, {
color: h.getOption("foreground"),
alpha: 1
}, {
renderer: MathJax.Hub.outputJax["jax/mml"][0].id,
browser: MathJax.Hub.Browser.name
});
},
AddMouseEvents: function(e) {
sre.HighlighterFactory.addEvents(e, {
mouseover: u.MouseOver,
mouseout: u.MouseOut
}, {
renderer: MathJax.Hub.outputJax["jax/mml"][0].id,
browser: MathJax.Hub.Browser.name
});
},
MouseOver: function(e) {
var t;
"none" !== h.getOption("highlight") && ("hover" === h.getOption("highlight") && (t = e.currentTarget,
u.GetHighlighter(.1), u.highlighter.highlight([ t ]), u.hoverer = !0), o(e));
},
MouseOut: function(e) {
return u.hoverer && (u.highlighter.unhighlight(), u.hoverer = !1), o(e);
},
Flame: function(e) {
if ("flame" === h.getOption("highlight")) return u.GetHighlighter(.05), u.highlighter.highlightAll(e),
void (u.flamer = !0);
},
UnFlame: function() {
u.flamer && (u.highlighter.unhighlightAll(), u.flamer = null);
},
FlameEnriched: function() {
u.UnFlame();
for (var e, t = 0, a = MathJax.Hub.getAllJax(); e = a[t]; t++) u.Flame(e.SourceElement().previousSibling);
},
Walkers: {
syntactic: sre.SyntaxWalker,
table: sre.TableWalker,
semantic: sre.SemanticWalker,
none: sre.DummyWalker
},
ActivateWalker: function(e, t) {
var a = h.getOption("speech"), i = h.getOption("walker") ? u.Walkers[MathJax.Hub.config.explorer.walker] : u.Walkers.none, n = a ? new sre.DirectSpeechGenerator() : new sre.DummySpeechGenerator(), o = sre.System.getInstance().engineSetup();
n.setOptions({
locale: o.locale,
domain: o.domain,
style: o.style,
modality: "speech"
}), u.GetHighlighter(.2), u.walker = new i(e, n, u.highlighter, t.root.toMathML()),
a && !e.getAttribute("hasspeech") && u.AddSpeechLazy(e), u.walker.activate(), a && (h.getOption("subtitle") && u.liveRegion.Show(e, u.highlighter),
u.liveRegion.Update(u.walker.speech())), u.Highlight(), u.ignoreFocusOut && setTimeout(function() {
u.ignoreFocusOut = !1;
}, 500);
},
DeactivateWalker: function() {
var e = sre.System.getInstance().engineSetup(), t = "clearspeak" === e.domain ? "default" : e.style;
h.setOption("ruleset", e.domain + "-" + t), u.liveRegion.Clear(), u.liveRegion.Hide(),
u.Unhighlight(), u.currentHighlight = null, u.walker.deactivate(), u.walker = null;
},
Highlight: function() {
u.Unhighlight(), u.highlighter.highlight(u.walker.getFocus().getNodes());
},
Unhighlight: function() {
u.highlighter.unhighlight();
},
PlayEarcon: function() {
new Audio(u.earconFile).play();
},
SpeechOutput: function() {
u.Reset();
[ "Subtitles" ].forEach(function(e) {
var t = MathJax.Menu.menu.FindId("Accessibility", "Explorer", e);
t && (t.disabled = !t.disabled);
}), u.Regenerate();
},
RemoveSpeech: function() {
h.setSpeechOption();
for (var e, t = 0, a = MathJax.Hub.getAllJax(); e = a[t]; t++) {
var i = document.getElementById(e.inputID + "-Frame");
i && (i.removeAttribute("hasspeech"), i.removeAttribute("haslabel"));
}
},
Regenerate: function() {
for (var e, t = 0, a = MathJax.Hub.getAllJax(); e = a[t]; t++) {
var i = document.getElementById(e.inputID + "-Frame");
i && (i.removeAttribute("hasspeech"), u.AddSpeech(i));
}
},
Startup: function() {
var e = MathJax.Extension.collapsible;
e && e.Dependent(h), h.addDefaults();
}
};
MathJax.Hub.Register.StartupHook("End Extensions", function() {
h[!1 === s.explorer ? "Disable" : "Enable"](), MathJax.Hub.Startup.signal.Post("Explorer Ready"),
MathJax.Hub.Register.StartupHook("MathMenu Ready", function() {
l = MathJax.Menu.cookie;
var e, t = MathJax.Menu.ITEM, a = MathJax.Menu.menu, i = {
action: u.Reset
}, n = {
action: h.speechOption
}, o = t.SUBMENU([ "Explorer", "Explorer" ], t.CHECKBOX([ "Active", "Active" ], "explorer", {
action: function(e) {
h[s.explorer ? "Enable" : "Disable"](!0, !0), MathJax.Menu.saveCookie();
}
}), t.RULE(), t.CHECKBOX([ "Walker", "Walker" ], "Assistive-walker"), t.SUBMENU([ "Highlight", "Highlight" ], t.RADIO([ "none", "None" ], "Assistive-highlight", i), t.RADIO([ "hover", "Hover" ], "Assistive-highlight", i), t.RADIO([ "flame", "Flame" ], "Assistive-highlight", i)), t.SUBMENU([ "Background", "Background" ], t.RADIO([ "blue", "Blue" ], "Assistive-background", i), t.RADIO([ "red", "Red" ], "Assistive-background", i), t.RADIO([ "green", "Green" ], "Assistive-background", i), t.RADIO([ "yellow", "Yellow" ], "Assistive-background", i), t.RADIO([ "cyan", "Cyan" ], "Assistive-background", i), t.RADIO([ "magenta", "Magenta" ], "Assistive-background", i), t.RADIO([ "white", "White" ], "Assistive-background", i), t.RADIO([ "black", "Black" ], "Assistive-background", i)), t.SUBMENU([ "Foreground", "Foreground" ], t.RADIO([ "black", "Black" ], "Assistive-foreground", i), t.RADIO([ "white", "White" ], "Assistive-foreground", i), t.RADIO([ "magenta", "Magenta" ], "Assistive-foreground", i), t.RADIO([ "cyan", "Cyan" ], "Assistive-foreground", i), t.RADIO([ "yellow", "Yellow" ], "Assistive-foreground", i), t.RADIO([ "green", "Green" ], "Assistive-foreground", i), t.RADIO([ "red", "Red" ], "Assistive-foreground", i), t.RADIO([ "blue", "Blue" ], "Assistive-foreground", i)), t.RULE(), t.CHECKBOX([ "SpeechOutput", "Speech Output" ], "Assistive-speech", {
action: u.SpeechOutput
}), t.CHECKBOX([ "Subtitles", "Subtitles" ], "Assistive-subtitle", {
disabled: !s["Assistive-speech"]
}), t.RULE(), t.SUBMENU([ "Mathspeak", "Mathspeak Rules" ], t.RADIO([ "mathspeak-default", "Verbose" ], "Assistive-ruleset", n), t.RADIO([ "mathspeak-brief", "Brief" ], "Assistive-ruleset", n), t.RADIO([ "mathspeak-sbrief", "Superbrief" ], "Assistive-ruleset", n)), t.RADIO([ "clearspeak-default", "Clearspeak Rules" ], "Assistive-ruleset", n), t.SUBMENU([ "Chromevox", "ChromeVox Rules" ], t.RADIO([ "chromevox-default", "Verbose" ], "Assistive-ruleset", n), t.RADIO([ "chromevox-alternative", "Alternative" ], "Assistive-ruleset", n))), r = (a.FindId("Accessibility") || {}).submenu;
r ? null !== (e = r.IndexOfId("Explorer")) ? r.items[e] = o : (e = r.IndexOfId("CollapsibleMath"),
r.items.splice(e + 1, 0, o)) : (e = a.IndexOfId("CollapsibleMath"), a.items.splice(e + 1, 0, o)),
s.explorer || h.DisableMenus(!0);
}, 20);
}, 20);
}), MathJax.Hub.Register.StartupHook("SVG Jax Ready", function() {
MathJax.Hub.Config({
SVG: {
addMMLclasses: !0
}
});
var t, e = MathJax.OutputJax.SVG;
parseFloat(e.version) < 2.7 && (t = e.getJaxFromMath, e.Augment({
getJaxFromMath: function(e) {
return e.parentNode.className.match(/MathJax_SVG_Display/) && (e = e.parentNode),
t.call(this, e);
}
}));
}), MathJax.Ajax.config.path.a11y || (MathJax.Ajax.config.path.a11y = MathJax.Hub.config.root + "/extensions/a11y"),
MathJax.Ajax.Require("[a11y]/collapsible.js"), MathJax.Hub.Register.StartupHook("Collapsible Ready", function() {
MathJax.Extension.explorer.Explorer.Startup(), MathJax.Ajax.loadComplete("[a11y]/explorer.js");
});

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,77 @@
MathJax.Extension["semantic-enrich"] = {
version: "1.6.0",
config: MathJax.Hub.CombineConfig("semantic-enrich", {
disabled: !1
}),
dependents: [],
running: !1,
mstyleLookup: {
mi: [ "mathvariant" ],
mo: [ "mathvariant", "accent", "largeop", "form", "fence", "separator", "movablelimits" ],
mn: [ "mathvariant" ],
mtext: [ "mathvariant" ],
ms: [ "mathvariant" ],
mfrac: [ "linethickness" ],
mfenced: [ "open", "close", "separators" ],
menclose: [ "notation" ],
munder: [ "accentunder" ],
mover: [ "accent" ],
munderover: [ "accent", "accentunder" ]
},
Filter: function(t, a, e) {
if (delete t.enriched, !this.config.disabled) try {
this.running = !0;
var n = sre.Enrich.semanticMathmlSync(t.root.toMathML());
t.root = MathJax.InputJax.MathML.Parse.prototype.MakeMML(n), t.root.inputID = e.id,
t.enriched = !0, this.running = !1;
} catch (t) {
throw this.running = !1, t;
}
},
Enable: function(t, a) {
this.config.disabled = !1, t && MathJax.Hub.Queue([ "Reprocess", MathJax.Hub ]);
},
Disable: function(t, a) {
this.config.disabled = !0;
for (var e = this.dependents.length - 1; 0 <= e; e--) {
var n = this.dependents[e];
n.Disable && n.Disable(!1, a);
}
t && MathJax.Hub.Queue([ "Reprocess", MathJax.Hub ]);
},
Dependent: function(t) {
this.dependents.push(t);
}
}, function() {
var t = MathJax.Ajax.config.path;
t.a11y || (t.a11y = HUB.config.root + "/extensions/a11y"), t.SRE || (t.SRE = MathJax.Ajax.fileURL(t.a11y)),
MathJax.Ajax.Load("[SRE]/mathjax-sre.js"), MathJax.Hub.Register.StartupHook("Sre Ready", [ "loadComplete", MathJax.Ajax, "[SRE]/mathjax-sre.js" ]);
}(), MathJax.Callback.Queue([ "Require", MathJax.Ajax, "[MathJax]/jax/element/mml/jax.js" ], [ "Require", MathJax.Ajax, "[MathJax]/jax/input/MathML/config.js" ], [ "Require", MathJax.Ajax, "[MathJax]/jax/input/MathML/jax.js" ], [ "Require", MathJax.Ajax, "[MathJax]/extensions/toMathML.js" ], MathJax.Hub.Register.StartupHook("Sre Ready", function() {
var l = MathJax.ElementJax.mml, c = MathJax.Extension["semantic-enrich"];
l.mbase.Augment({
toMathMLattributes: function() {
var t = "mstyle" === this.type ? l.math.prototype.defaults : this.defaults, a = this.attrNames || l.copyAttributeNames, e = l.skipAttributes, n = l.copyAttributes, s = c.running && c.mstyleLookup[this.type] || [], i = [], h = this.attr || {};
if ("math" !== this.type || this.attr && "xmlns" in this.attr || i.push('xmlns="http://www.w3.org/1998/Math/MathML"'),
!this.attrNames) for (var r in t) e[r] || n[r] || !t.hasOwnProperty(r) || null != this[r] && this[r] !== t[r] && this.Get(r, null, 1) !== this[r] && this.toMathMLaddAttr(i, r, this[r]);
for (var o = 0, u = a.length; o < u; o++) 1 === n[a[o]] && !t.hasOwnProperty(a[o]) || (value = h[a[o]],
null == value && (value = this[a[o]]), null != value && this.toMathMLaddAttr(i, a[o], value));
for (o = 0, u = s.length; o < u; o++) r = s[o], t.hasOwnProperty(r) && !i["_" + r] && (value = this.Get(r, 1),
null != value && this.toMathMLaddAttr(i, r, value));
return this.toMathMLclass(i), i.length ? " " + i.join(" ") : "";
},
toMathMLaddAttr: function(t, a, e) {
t.push(a + '="' + this.toMathMLquote(e) + '"'), t["_" + a] = 1;
}
});
var a = l.mo.prototype.setTeXclass;
l.mo.Augment({
setTeXclass: function(t) {
this.getValues("form", "lspace", "rspace");
return this.useMMLspacing ? (this.texClass = l.TEXCLASS.NONE, this) : this.attr && this.attr["data-semantic-added"] ? (this.texClass = this.prevClass = l.TEXCLASS.NONE,
t) : a.apply(this, arguments);
}
});
}), function() {
MathJax.Hub.postInputHooks.Add([ "Filter", MathJax.Extension["semantic-enrich"] ], 50),
MathJax.Hub.Startup.signal.Post("Semantic Enrich Ready"), MathJax.Ajax.loadComplete("[a11y]/semantic-enrich.js");
});

View file

@ -0,0 +1,77 @@
(function(){'use strict';var k=this;
function aa(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==
b&&"undefined"==typeof a.call)return"object";return b}function l(a){return"string"==typeof a}function ba(a,b,c){return a.call.apply(a.bind,arguments)}function ca(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}
function da(a,b,c){da=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ba:ca;return da.apply(null,arguments)}function ea(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}}
function m(a){var b=n;function c(){}c.prototype=b.prototype;a.G=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.F=function(a,c,f){for(var g=Array(arguments.length-2),h=2;h<arguments.length;h++)g[h-2]=arguments[h];return b.prototype[c].apply(a,g)}};/*
The MIT License
Copyright (c) 2007 Cybozu Labs, Inc.
Copyright (c) 2012 Google Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
var fa=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};function q(a,b){return-1!=a.indexOf(b)}function ga(a,b){return a<b?-1:a>b?1:0};var ha=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(l(a))return l(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},r=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=l(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},ia=Array.prototype.filter?function(a,b,c){return Array.prototype.filter.call(a,
b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,g=l(a)?a.split(""):a,h=0;h<d;h++)if(h in g){var p=g[h];b.call(c,p,h,a)&&(e[f++]=p)}return e},t=Array.prototype.reduce?function(a,b,c,d){d&&(b=da(b,d));return Array.prototype.reduce.call(a,b,c)}:function(a,b,c,d){var e=c;r(a,function(c,g){e=b.call(d,e,c,g,a)});return e},ja=Array.prototype.some?function(a,b,c){return Array.prototype.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=l(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return!0;
return!1};function ka(a,b){var c;a:{c=a.length;for(var d=l(a)?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(void 0,d[e],e,a)){c=e;break a}c=-1}return 0>c?null:l(a)?a.charAt(c):a[c]}function la(a){return Array.prototype.concat.apply(Array.prototype,arguments)}function ma(a,b,c){return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)};var u;a:{var na=k.navigator;if(na){var oa=na.userAgent;if(oa){u=oa;break a}}u=""};var pa=q(u,"Opera")||q(u,"OPR"),v=q(u,"Trident")||q(u,"MSIE"),qa=q(u,"Edge"),ra=q(u,"Gecko")&&!(q(u.toLowerCase(),"webkit")&&!q(u,"Edge"))&&!(q(u,"Trident")||q(u,"MSIE"))&&!q(u,"Edge"),sa=q(u.toLowerCase(),"webkit")&&!q(u,"Edge");function ta(){var a=k.document;return a?a.documentMode:void 0}var ua;
a:{var va="",wa=function(){var a=u;if(ra)return/rv\:([^\);]+)(\)|;)/.exec(a);if(qa)return/Edge\/([\d\.]+)/.exec(a);if(v)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(sa)return/WebKit\/(\S+)/.exec(a);if(pa)return/(?:Version)[ \/]?(\S+)/.exec(a)}();wa&&(va=wa?wa[1]:"");if(v){var xa=ta();if(null!=xa&&xa>parseFloat(va)){ua=String(xa);break a}}ua=va}var ya={};
function za(a){if(!ya[a]){for(var b=0,c=fa(String(ua)).split("."),d=fa(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||"",h=d[f]||"",p=/(\d*)(\D*)/g,y=/(\d*)(\D*)/g;do{var D=p.exec(g)||["","",""],X=y.exec(h)||["","",""];if(0==D[0].length&&0==X[0].length)break;b=ga(0==D[1].length?0:parseInt(D[1],10),0==X[1].length?0:parseInt(X[1],10))||ga(0==D[2].length,0==X[2].length)||ga(D[2],X[2])}while(0==b)}ya[a]=0<=b}}
var Aa=k.document,Ba=Aa&&v?ta()||("CSS1Compat"==Aa.compatMode?parseInt(ua,10):5):void 0;var w=v&&!(9<=Number(Ba)),Ca=v&&!(8<=Number(Ba));function x(a,b,c,d){this.a=a;this.nodeName=c;this.nodeValue=d;this.nodeType=2;this.parentNode=this.ownerElement=b}function Da(a,b){var c=Ca&&"href"==b.nodeName?a.getAttribute(b.nodeName,2):b.nodeValue;return new x(b,a,b.nodeName,c)};function z(a){var b=null,c=a.nodeType;1==c&&(b=a.textContent,b=void 0==b||null==b?a.innerText:b,b=void 0==b||null==b?"":b);if("string"!=typeof b)if(w&&"title"==a.nodeName.toLowerCase()&&1==c)b=a.text;else if(9==c||1==c){a=9==c?a.documentElement:a.firstChild;for(var c=0,d=[],b="";a;){do 1!=a.nodeType&&(b+=a.nodeValue),w&&"title"==a.nodeName.toLowerCase()&&(b+=a.text),d[c++]=a;while(a=a.firstChild);for(;c&&!(a=d[--c].nextSibling););}}else b=a.nodeValue;return""+b}
function A(a,b,c){if(null===b)return!0;try{if(!a.getAttribute)return!1}catch(d){return!1}Ca&&"class"==b&&(b="className");return null==c?!!a.getAttribute(b):a.getAttribute(b,2)==c}function B(a,b,c,d,e){return(w?Ea:Fa).call(null,a,b,l(c)?c:null,l(d)?d:null,e||new C)}
function Ea(a,b,c,d,e){if(a instanceof E||8==a.b||c&&null===a.b){var f=b.all;if(!f)return e;a=Ga(a);if("*"!=a&&(f=b.getElementsByTagName(a),!f))return e;if(c){for(var g=[],h=0;b=f[h++];)A(b,c,d)&&g.push(b);f=g}for(h=0;b=f[h++];)"*"==a&&"!"==b.tagName||F(e,b);return e}Ha(a,b,c,d,e);return e}
function Fa(a,b,c,d,e){b.getElementsByName&&d&&"name"==c&&!v?(b=b.getElementsByName(d),r(b,function(b){a.a(b)&&F(e,b)})):b.getElementsByClassName&&d&&"class"==c?(b=b.getElementsByClassName(d),r(b,function(b){b.className==d&&a.a(b)&&F(e,b)})):a instanceof G?Ha(a,b,c,d,e):b.getElementsByTagName&&(b=b.getElementsByTagName(a.f()),r(b,function(a){A(a,c,d)&&F(e,a)}));return e}
function Ia(a,b,c,d,e){var f;if((a instanceof E||8==a.b||c&&null===a.b)&&(f=b.childNodes)){var g=Ga(a);if("*"!=g&&(f=ia(f,function(a){return a.tagName&&a.tagName.toLowerCase()==g}),!f))return e;c&&(f=ia(f,function(a){return A(a,c,d)}));r(f,function(a){"*"==g&&("!"==a.tagName||"*"==g&&1!=a.nodeType)||F(e,a)});return e}return Ja(a,b,c,d,e)}function Ja(a,b,c,d,e){for(b=b.firstChild;b;b=b.nextSibling)A(b,c,d)&&a.a(b)&&F(e,b);return e}
function Ha(a,b,c,d,e){for(b=b.firstChild;b;b=b.nextSibling)A(b,c,d)&&a.a(b)&&F(e,b),Ha(a,b,c,d,e)}function Ga(a){if(a instanceof G){if(8==a.b)return"!";if(null===a.b)return"*"}return a.f()};!ra&&!v||v&&9<=Number(Ba)||ra&&za("1.9.1");v&&za("9");function Ka(a,b){if(!a||!b)return!1;if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||!!(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a}
function La(a,b){if(a==b)return 0;if(a.compareDocumentPosition)return a.compareDocumentPosition(b)&2?1:-1;if(v&&!(9<=Number(Ba))){if(9==a.nodeType)return-1;if(9==b.nodeType)return 1}if("sourceIndex"in a||a.parentNode&&"sourceIndex"in a.parentNode){var c=1==a.nodeType,d=1==b.nodeType;if(c&&d)return a.sourceIndex-b.sourceIndex;var e=a.parentNode,f=b.parentNode;return e==f?Ma(a,b):!c&&Ka(e,b)?-1*Na(a,b):!d&&Ka(f,a)?Na(b,a):(c?a.sourceIndex:e.sourceIndex)-(d?b.sourceIndex:f.sourceIndex)}d=9==a.nodeType?
a:a.ownerDocument||a.document;c=d.createRange();c.selectNode(a);c.collapse(!0);d=d.createRange();d.selectNode(b);d.collapse(!0);return c.compareBoundaryPoints(k.Range.START_TO_END,d)}function Na(a,b){var c=a.parentNode;if(c==b)return-1;for(var d=b;d.parentNode!=c;)d=d.parentNode;return Ma(d,a)}function Ma(a,b){for(var c=b;c=c.previousSibling;)if(c==a)return-1;return 1};function C(){this.b=this.a=null;this.l=0}function Oa(a){this.node=a;this.a=this.b=null}function Pa(a,b){if(!a.a)return b;if(!b.a)return a;for(var c=a.a,d=b.a,e=null,f=null,g=0;c&&d;){var f=c.node,h=d.node;f==h||f instanceof x&&h instanceof x&&f.a==h.a?(f=c,c=c.a,d=d.a):0<La(c.node,d.node)?(f=d,d=d.a):(f=c,c=c.a);(f.b=e)?e.a=f:a.a=f;e=f;g++}for(f=c||d;f;)f.b=e,e=e.a=f,g++,f=f.a;a.b=e;a.l=g;return a}function Qa(a,b){var c=new Oa(b);c.a=a.a;a.b?a.a.b=c:a.a=a.b=c;a.a=c;a.l++}
function F(a,b){var c=new Oa(b);c.b=a.b;a.a?a.b.a=c:a.a=a.b=c;a.b=c;a.l++}function Ra(a){return(a=a.a)?a.node:null}function Sa(a){return(a=Ra(a))?z(a):""}function H(a,b){return new Ta(a,!!b)}function Ta(a,b){this.f=a;this.b=(this.c=b)?a.b:a.a;this.a=null}function I(a){var b=a.b;if(null==b)return null;var c=a.a=b;a.b=a.c?b.b:b.a;return c.node};function n(a){this.i=a;this.b=this.g=!1;this.f=null}function J(a){return"\n "+a.toString().split("\n").join("\n ")}function Ua(a,b){a.g=b}function Va(a,b){a.b=b}function K(a,b){var c=a.a(b);return c instanceof C?+Sa(c):+c}function L(a,b){var c=a.a(b);return c instanceof C?Sa(c):""+c}function M(a,b){var c=a.a(b);return c instanceof C?!!c.l:!!c};function N(a,b,c){n.call(this,a.i);this.c=a;this.h=b;this.o=c;this.g=b.g||c.g;this.b=b.b||c.b;this.c==Wa&&(c.b||c.g||4==c.i||0==c.i||!b.f?b.b||b.g||4==b.i||0==b.i||!c.f||(this.f={name:c.f.name,s:b}):this.f={name:b.f.name,s:c})}m(N);
function O(a,b,c,d,e){b=b.a(d);c=c.a(d);var f;if(b instanceof C&&c instanceof C){b=H(b);for(d=I(b);d;d=I(b))for(e=H(c),f=I(e);f;f=I(e))if(a(z(d),z(f)))return!0;return!1}if(b instanceof C||c instanceof C){b instanceof C?(e=b,d=c):(e=c,d=b);f=H(e);for(var g=typeof d,h=I(f);h;h=I(f)){switch(g){case "number":h=+z(h);break;case "boolean":h=!!z(h);break;case "string":h=z(h);break;default:throw Error("Illegal primitive type for comparison.");}if(e==b&&a(h,d)||e==c&&a(d,h))return!0}return!1}return e?"boolean"==
typeof b||"boolean"==typeof c?a(!!b,!!c):"number"==typeof b||"number"==typeof c?a(+b,+c):a(b,c):a(+b,+c)}N.prototype.a=function(a){return this.c.m(this.h,this.o,a)};N.prototype.toString=function(){var a="Binary Expression: "+this.c,a=a+J(this.h);return a+=J(this.o)};function Xa(a,b,c,d){this.a=a;this.w=b;this.i=c;this.m=d}Xa.prototype.toString=function(){return this.a};var Ya={};
function P(a,b,c,d){if(Ya.hasOwnProperty(a))throw Error("Binary operator already created: "+a);a=new Xa(a,b,c,d);return Ya[a.toString()]=a}P("div",6,1,function(a,b,c){return K(a,c)/K(b,c)});P("mod",6,1,function(a,b,c){return K(a,c)%K(b,c)});P("*",6,1,function(a,b,c){return K(a,c)*K(b,c)});P("+",5,1,function(a,b,c){return K(a,c)+K(b,c)});P("-",5,1,function(a,b,c){return K(a,c)-K(b,c)});P("<",4,2,function(a,b,c){return O(function(a,b){return a<b},a,b,c)});
P(">",4,2,function(a,b,c){return O(function(a,b){return a>b},a,b,c)});P("<=",4,2,function(a,b,c){return O(function(a,b){return a<=b},a,b,c)});P(">=",4,2,function(a,b,c){return O(function(a,b){return a>=b},a,b,c)});var Wa=P("=",3,2,function(a,b,c){return O(function(a,b){return a==b},a,b,c,!0)});P("!=",3,2,function(a,b,c){return O(function(a,b){return a!=b},a,b,c,!0)});P("and",2,2,function(a,b,c){return M(a,c)&&M(b,c)});P("or",1,2,function(a,b,c){return M(a,c)||M(b,c)});function Q(a,b,c){this.a=a;this.b=b||1;this.f=c||1};function Za(a,b){if(b.a.length&&4!=a.i)throw Error("Primary expression must evaluate to nodeset if filter has predicate(s).");n.call(this,a.i);this.c=a;this.h=b;this.g=a.g;this.b=a.b}m(Za);Za.prototype.a=function(a){a=this.c.a(a);return $a(this.h,a)};Za.prototype.toString=function(){var a;a="Filter:"+J(this.c);return a+=J(this.h)};function ab(a,b){if(b.length<a.A)throw Error("Function "+a.j+" expects at least"+a.A+" arguments, "+b.length+" given");if(null!==a.v&&b.length>a.v)throw Error("Function "+a.j+" expects at most "+a.v+" arguments, "+b.length+" given");a.B&&r(b,function(b,d){if(4!=b.i)throw Error("Argument "+d+" to function "+a.j+" is not of type Nodeset: "+b);});n.call(this,a.i);this.h=a;this.c=b;Ua(this,a.g||ja(b,function(a){return a.g}));Va(this,a.D&&!b.length||a.C&&!!b.length||ja(b,function(a){return a.b}))}m(ab);
ab.prototype.a=function(a){return this.h.m.apply(null,la(a,this.c))};ab.prototype.toString=function(){var a="Function: "+this.h;if(this.c.length)var b=t(this.c,function(a,b){return a+J(b)},"Arguments:"),a=a+J(b);return a};function bb(a,b,c,d,e,f,g,h,p){this.j=a;this.i=b;this.g=c;this.D=d;this.C=e;this.m=f;this.A=g;this.v=void 0!==h?h:g;this.B=!!p}bb.prototype.toString=function(){return this.j};var cb={};
function R(a,b,c,d,e,f,g,h){if(cb.hasOwnProperty(a))throw Error("Function already created: "+a+".");cb[a]=new bb(a,b,c,d,!1,e,f,g,h)}R("boolean",2,!1,!1,function(a,b){return M(b,a)},1);R("ceiling",1,!1,!1,function(a,b){return Math.ceil(K(b,a))},1);R("concat",3,!1,!1,function(a,b){return t(ma(arguments,1),function(b,d){return b+L(d,a)},"")},2,null);R("contains",2,!1,!1,function(a,b,c){return q(L(b,a),L(c,a))},2);R("count",1,!1,!1,function(a,b){return b.a(a).l},1,1,!0);
R("false",2,!1,!1,function(){return!1},0);R("floor",1,!1,!1,function(a,b){return Math.floor(K(b,a))},1);R("id",4,!1,!1,function(a,b){function c(a){if(w){var b=e.all[a];if(b){if(b.nodeType&&a==b.id)return b;if(b.length)return ka(b,function(b){return a==b.id})}return null}return e.getElementById(a)}var d=a.a,e=9==d.nodeType?d:d.ownerDocument,d=L(b,a).split(/\s+/),f=[];r(d,function(a){a=c(a);!a||0<=ha(f,a)||f.push(a)});f.sort(La);var g=new C;r(f,function(a){F(g,a)});return g},1);
R("lang",2,!1,!1,function(){return!1},1);R("last",1,!0,!1,function(a){if(1!=arguments.length)throw Error("Function last expects ()");return a.f},0);R("local-name",3,!1,!0,function(a,b){var c=b?Ra(b.a(a)):a.a;return c?c.localName||c.nodeName.toLowerCase():""},0,1,!0);R("name",3,!1,!0,function(a,b){var c=b?Ra(b.a(a)):a.a;return c?c.nodeName.toLowerCase():""},0,1,!0);R("namespace-uri",3,!0,!1,function(){return""},0,1,!0);
R("normalize-space",3,!1,!0,function(a,b){return(b?L(b,a):z(a.a)).replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},0,1);R("not",2,!1,!1,function(a,b){return!M(b,a)},1);R("number",1,!1,!0,function(a,b){return b?K(b,a):+z(a.a)},0,1);R("position",1,!0,!1,function(a){return a.b},0);R("round",1,!1,!1,function(a,b){return Math.round(K(b,a))},1);R("starts-with",2,!1,!1,function(a,b,c){b=L(b,a);a=L(c,a);return 0==b.lastIndexOf(a,0)},2);R("string",3,!1,!0,function(a,b){return b?L(b,a):z(a.a)},0,1);
R("string-length",1,!1,!0,function(a,b){return(b?L(b,a):z(a.a)).length},0,1);R("substring",3,!1,!1,function(a,b,c,d){c=K(c,a);if(isNaN(c)||Infinity==c||-Infinity==c)return"";d=d?K(d,a):Infinity;if(isNaN(d)||-Infinity===d)return"";c=Math.round(c)-1;var e=Math.max(c,0);a=L(b,a);return Infinity==d?a.substring(e):a.substring(e,c+Math.round(d))},2,3);R("substring-after",3,!1,!1,function(a,b,c){b=L(b,a);a=L(c,a);c=b.indexOf(a);return-1==c?"":b.substring(c+a.length)},2);
R("substring-before",3,!1,!1,function(a,b,c){b=L(b,a);a=L(c,a);a=b.indexOf(a);return-1==a?"":b.substring(0,a)},2);R("sum",1,!1,!1,function(a,b){for(var c=H(b.a(a)),d=0,e=I(c);e;e=I(c))d+=+z(e);return d},1,1,!0);R("translate",3,!1,!1,function(a,b,c,d){b=L(b,a);c=L(c,a);var e=L(d,a);a={};for(d=0;d<c.length;d++){var f=c.charAt(d);f in a||(a[f]=e.charAt(d))}c="";for(d=0;d<b.length;d++)f=b.charAt(d),c+=f in a?a[f]:f;return c},3);R("true",2,!1,!1,function(){return!0},0);function G(a,b){this.h=a;this.c=void 0!==b?b:null;this.b=null;switch(a){case "comment":this.b=8;break;case "text":this.b=3;break;case "processing-instruction":this.b=7;break;case "node":break;default:throw Error("Unexpected argument");}}function db(a){return"comment"==a||"text"==a||"processing-instruction"==a||"node"==a}G.prototype.a=function(a){return null===this.b||this.b==a.nodeType};G.prototype.f=function(){return this.h};
G.prototype.toString=function(){var a="Kind Test: "+this.h;null===this.c||(a+=J(this.c));return a};function eb(a){this.b=a;this.a=0}function fb(a){a=a.match(gb);for(var b=0;b<a.length;b++)hb.test(a[b])&&a.splice(b,1);return new eb(a)}var gb=/\$?(?:(?![0-9-\.])(?:\*|[\w-\.]+):)?(?![0-9-\.])(?:\*|[\w-\.]+)|\/\/|\.\.|::|\d+(?:\.\d*)?|\.\d+|"[^"]*"|'[^']*'|[!<>]=|\s+|./g,hb=/^\s/;function S(a,b){return a.b[a.a+(b||0)]}function T(a){return a.b[a.a++]}function ib(a){return a.b.length<=a.a};function jb(a){n.call(this,3);this.c=a.substring(1,a.length-1)}m(jb);jb.prototype.a=function(){return this.c};jb.prototype.toString=function(){return"Literal: "+this.c};function E(a,b){this.j=a.toLowerCase();var c;c="*"==this.j?"*":"http://www.w3.org/1999/xhtml";this.c=b?b.toLowerCase():c}E.prototype.a=function(a){var b=a.nodeType;if(1!=b&&2!=b)return!1;b=void 0!==a.localName?a.localName:a.nodeName;return"*"!=this.j&&this.j!=b.toLowerCase()?!1:"*"==this.c?!0:this.c==(a.namespaceURI?a.namespaceURI.toLowerCase():"http://www.w3.org/1999/xhtml")};E.prototype.f=function(){return this.j};
E.prototype.toString=function(){return"Name Test: "+("http://www.w3.org/1999/xhtml"==this.c?"":this.c+":")+this.j};function kb(a,b){n.call(this,a.i);this.h=a;this.c=b;this.g=a.g;this.b=a.b;if(1==this.c.length){var c=this.c[0];c.u||c.c!=lb||(c=c.o,"*"!=c.f()&&(this.f={name:c.f(),s:null}))}}m(kb);function mb(){n.call(this,4)}m(mb);mb.prototype.a=function(a){var b=new C;a=a.a;9==a.nodeType?F(b,a):F(b,a.ownerDocument);return b};mb.prototype.toString=function(){return"Root Helper Expression"};function nb(){n.call(this,4)}m(nb);nb.prototype.a=function(a){var b=new C;F(b,a.a);return b};nb.prototype.toString=function(){return"Context Helper Expression"};
function ob(a){return"/"==a||"//"==a}kb.prototype.a=function(a){var b=this.h.a(a);if(!(b instanceof C))throw Error("Filter expression must evaluate to nodeset.");a=this.c;for(var c=0,d=a.length;c<d&&b.l;c++){var e=a[c],f=H(b,e.c.a),g;if(e.g||e.c!=pb)if(e.g||e.c!=qb)for(g=I(f),b=e.a(new Q(g));null!=(g=I(f));)g=e.a(new Q(g)),b=Pa(b,g);else g=I(f),b=e.a(new Q(g));else{for(g=I(f);(b=I(f))&&(!g.contains||g.contains(b))&&b.compareDocumentPosition(g)&8;g=b);b=e.a(new Q(g))}}return b};
kb.prototype.toString=function(){var a;a="Path Expression:"+J(this.h);if(this.c.length){var b=t(this.c,function(a,b){return a+J(b)},"Steps:");a+=J(b)}return a};function rb(a){n.call(this,4);this.c=a;Ua(this,ja(this.c,function(a){return a.g}));Va(this,ja(this.c,function(a){return a.b}))}m(rb);rb.prototype.a=function(a){var b=new C;r(this.c,function(c){c=c.a(a);if(!(c instanceof C))throw Error("Path expression must evaluate to NodeSet.");b=Pa(b,c)});return b};rb.prototype.toString=function(){return t(this.c,function(a,b){return a+J(b)},"Union Expression:")};function sb(a,b){this.a=a;this.b=!!b}
function $a(a,b,c){for(c=c||0;c<a.a.length;c++)for(var d=a.a[c],e=H(b),f=b.l,g,h=0;g=I(e);h++){var p=a.b?f-h:h+1;g=d.a(new Q(g,p,f));if("number"==typeof g)p=p==g;else if("string"==typeof g||"boolean"==typeof g)p=!!g;else if(g instanceof C)p=0<g.l;else throw Error("Predicate.evaluate returned an unexpected type.");if(!p){p=e;g=p.f;var y=p.a;if(!y)throw Error("Next must be called at least once before remove.");var D=y.b,y=y.a;D?D.a=y:g.a=y;y?y.b=D:g.b=D;g.l--;p.a=null}}return b}
sb.prototype.toString=function(){return t(this.a,function(a,b){return a+J(b)},"Predicates:")};function U(a,b,c,d){n.call(this,4);this.c=a;this.o=b;this.h=c||new sb([]);this.u=!!d;b=this.h;b=0<b.a.length?b.a[0].f:null;a.b&&b&&(a=b.name,a=w?a.toLowerCase():a,this.f={name:a,s:b.s});a:{a=this.h;for(b=0;b<a.a.length;b++)if(c=a.a[b],c.g||1==c.i||0==c.i){a=!0;break a}a=!1}this.g=a}m(U);
U.prototype.a=function(a){var b=a.a,c=null,c=this.f,d=null,e=null,f=0;c&&(d=c.name,e=c.s?L(c.s,a):null,f=1);if(this.u)if(this.g||this.c!=tb)if(a=H((new U(ub,new G("node"))).a(a)),b=I(a))for(c=this.m(b,d,e,f);null!=(b=I(a));)c=Pa(c,this.m(b,d,e,f));else c=new C;else c=B(this.o,b,d,e),c=$a(this.h,c,f);else c=this.m(a.a,d,e,f);return c};U.prototype.m=function(a,b,c,d){a=this.c.f(this.o,a,b,c);return a=$a(this.h,a,d)};
U.prototype.toString=function(){var a;a="Step:"+J("Operator: "+(this.u?"//":"/"));this.c.j&&(a+=J("Axis: "+this.c));a+=J(this.o);if(this.h.a.length){var b=t(this.h.a,function(a,b){return a+J(b)},"Predicates:");a+=J(b)}return a};function vb(a,b,c,d){this.j=a;this.f=b;this.a=c;this.b=d}vb.prototype.toString=function(){return this.j};var wb={};function V(a,b,c,d){if(wb.hasOwnProperty(a))throw Error("Axis already created: "+a);b=new vb(a,b,c,!!d);return wb[a]=b}
V("ancestor",function(a,b){for(var c=new C,d=b;d=d.parentNode;)a.a(d)&&Qa(c,d);return c},!0);V("ancestor-or-self",function(a,b){var c=new C,d=b;do a.a(d)&&Qa(c,d);while(d=d.parentNode);return c},!0);
var lb=V("attribute",function(a,b){var c=new C,d=a.f();if("style"==d&&w&&b.style)return F(c,new x(b.style,b,"style",b.style.cssText)),c;var e=b.attributes;if(e)if(a instanceof G&&null===a.b||"*"==d)for(var d=0,f;f=e[d];d++)w?f.nodeValue&&F(c,Da(b,f)):F(c,f);else(f=e.getNamedItem(d))&&(w?f.nodeValue&&F(c,Da(b,f)):F(c,f));return c},!1),tb=V("child",function(a,b,c,d,e){return(w?Ia:Ja).call(null,a,b,l(c)?c:null,l(d)?d:null,e||new C)},!1,!0);V("descendant",B,!1,!0);
var ub=V("descendant-or-self",function(a,b,c,d){var e=new C;A(b,c,d)&&a.a(b)&&F(e,b);return B(a,b,c,d,e)},!1,!0),pb=V("following",function(a,b,c,d){var e=new C;do for(var f=b;f=f.nextSibling;)A(f,c,d)&&a.a(f)&&F(e,f),e=B(a,f,c,d,e);while(b=b.parentNode);return e},!1,!0);V("following-sibling",function(a,b){for(var c=new C,d=b;d=d.nextSibling;)a.a(d)&&F(c,d);return c},!1);V("namespace",function(){return new C},!1);
var xb=V("parent",function(a,b){var c=new C;if(9==b.nodeType)return c;if(2==b.nodeType)return F(c,b.ownerElement),c;var d=b.parentNode;a.a(d)&&F(c,d);return c},!1),qb=V("preceding",function(a,b,c,d){var e=new C,f=[];do f.unshift(b);while(b=b.parentNode);for(var g=1,h=f.length;g<h;g++){var p=[];for(b=f[g];b=b.previousSibling;)p.unshift(b);for(var y=0,D=p.length;y<D;y++)b=p[y],A(b,c,d)&&a.a(b)&&F(e,b),e=B(a,b,c,d,e)}return e},!0,!0);
V("preceding-sibling",function(a,b){for(var c=new C,d=b;d=d.previousSibling;)a.a(d)&&Qa(c,d);return c},!0);var yb=V("self",function(a,b){var c=new C;a.a(b)&&F(c,b);return c},!1);function zb(a){n.call(this,1);this.c=a;this.g=a.g;this.b=a.b}m(zb);zb.prototype.a=function(a){return-K(this.c,a)};zb.prototype.toString=function(){return"Unary Expression: -"+J(this.c)};function Ab(a){n.call(this,1);this.c=a}m(Ab);Ab.prototype.a=function(){return this.c};Ab.prototype.toString=function(){return"Number: "+this.c};function Bb(a,b){this.a=a;this.b=b}function Cb(a){for(var b,c=[];;){W(a,"Missing right hand side of binary expression.");b=Db(a);var d=T(a.a);if(!d)break;var e=(d=Ya[d]||null)&&d.w;if(!e){a.a.a--;break}for(;c.length&&e<=c[c.length-1].w;)b=new N(c.pop(),c.pop(),b);c.push(b,d)}for(;c.length;)b=new N(c.pop(),c.pop(),b);return b}function W(a,b){if(ib(a.a))throw Error(b);}function Eb(a,b){var c=T(a.a);if(c!=b)throw Error("Bad token, expected: "+b+" got: "+c);}
function Fb(a){a=T(a.a);if(")"!=a)throw Error("Bad token: "+a);}function Gb(a){a=T(a.a);if(2>a.length)throw Error("Unclosed literal string");return new jb(a)}
function Hb(a){var b,c=[],d;if(ob(S(a.a))){b=T(a.a);d=S(a.a);if("/"==b&&(ib(a.a)||"."!=d&&".."!=d&&"@"!=d&&"*"!=d&&!/(?![0-9])[\w]/.test(d)))return new mb;d=new mb;W(a,"Missing next location step.");b=Ib(a,b);c.push(b)}else{a:{b=S(a.a);d=b.charAt(0);switch(d){case "$":throw Error("Variable reference not allowed in HTML XPath");case "(":T(a.a);b=Cb(a);W(a,'unclosed "("');Eb(a,")");break;case '"':case "'":b=Gb(a);break;default:if(isNaN(+b))if(!db(b)&&/(?![0-9])[\w]/.test(d)&&"("==S(a.a,1)){b=T(a.a);
b=cb[b]||null;T(a.a);for(d=[];")"!=S(a.a);){W(a,"Missing function argument list.");d.push(Cb(a));if(","!=S(a.a))break;T(a.a)}W(a,"Unclosed function argument list.");Fb(a);b=new ab(b,d)}else{b=null;break a}else b=new Ab(+T(a.a))}"["==S(a.a)&&(d=new sb(Jb(a)),b=new Za(b,d))}if(b)if(ob(S(a.a)))d=b;else return b;else b=Ib(a,"/"),d=new nb,c.push(b)}for(;ob(S(a.a));)b=T(a.a),W(a,"Missing next location step."),b=Ib(a,b),c.push(b);return new kb(d,c)}
function Ib(a,b){var c,d,e;if("/"!=b&&"//"!=b)throw Error('Step op should be "/" or "//"');if("."==S(a.a))return d=new U(yb,new G("node")),T(a.a),d;if(".."==S(a.a))return d=new U(xb,new G("node")),T(a.a),d;var f;if("@"==S(a.a))f=lb,T(a.a),W(a,"Missing attribute name");else if("::"==S(a.a,1)){if(!/(?![0-9])[\w]/.test(S(a.a).charAt(0)))throw Error("Bad token: "+T(a.a));c=T(a.a);f=wb[c]||null;if(!f)throw Error("No axis with name: "+c);T(a.a);W(a,"Missing node name")}else f=tb;c=S(a.a);if(/(?![0-9])[\w\*]/.test(c.charAt(0)))if("("==
S(a.a,1)){if(!db(c))throw Error("Invalid node type: "+c);c=T(a.a);if(!db(c))throw Error("Invalid type name: "+c);Eb(a,"(");W(a,"Bad nodetype");e=S(a.a).charAt(0);var g=null;if('"'==e||"'"==e)g=Gb(a);W(a,"Bad nodetype");Fb(a);c=new G(c,g)}else if(c=T(a.a),e=c.indexOf(":"),-1==e)c=new E(c);else{var g=c.substring(0,e),h;if("*"==g)h="*";else if(h=a.b(g),!h)throw Error("Namespace prefix not declared: "+g);c=c.substr(e+1);c=new E(c,h)}else throw Error("Bad token: "+T(a.a));e=new sb(Jb(a),f.a);return d||
new U(f,c,e,"//"==b)}function Jb(a){for(var b=[];"["==S(a.a);){T(a.a);W(a,"Missing predicate expression.");var c=Cb(a);b.push(c);W(a,"Unclosed predicate expression.");Eb(a,"]")}return b}function Db(a){if("-"==S(a.a))return T(a.a),new zb(Db(a));var b=Hb(a);if("|"!=S(a.a))a=b;else{for(b=[b];"|"==T(a.a);)W(a,"Missing next union location path."),b.push(Hb(a));a.a.a--;a=new rb(b)}return a};function Kb(a){switch(a.nodeType){case 1:return ea(Lb,a);case 9:return Kb(a.documentElement);case 11:case 10:case 6:case 12:return Mb;default:return a.parentNode?Kb(a.parentNode):Mb}}function Mb(){return null}function Lb(a,b){if(a.prefix==b)return a.namespaceURI||"http://www.w3.org/1999/xhtml";var c=a.getAttributeNode("xmlns:"+b);return c&&c.specified?c.value||null:a.parentNode&&9!=a.parentNode.nodeType?Lb(a.parentNode,b):null};function Nb(a,b){if(!a.length)throw Error("Empty XPath expression.");var c=fb(a);if(ib(c))throw Error("Invalid XPath expression.");b?"function"==aa(b)||(b=da(b.lookupNamespaceURI,b)):b=function(){return null};var d=Cb(new Bb(c,b));if(!ib(c))throw Error("Bad token: "+T(c));this.evaluate=function(a,b){var c=d.a(new Q(a));return new Y(c,b)}}
function Y(a,b){if(0==b)if(a instanceof C)b=4;else if("string"==typeof a)b=2;else if("number"==typeof a)b=1;else if("boolean"==typeof a)b=3;else throw Error("Unexpected evaluation result.");if(2!=b&&1!=b&&3!=b&&!(a instanceof C))throw Error("value could not be converted to the specified type");this.resultType=b;var c;switch(b){case 2:this.stringValue=a instanceof C?Sa(a):""+a;break;case 1:this.numberValue=a instanceof C?+Sa(a):+a;break;case 3:this.booleanValue=a instanceof C?0<a.l:!!a;break;case 4:case 5:case 6:case 7:var d=
H(a);c=[];for(var e=I(d);e;e=I(d))c.push(e instanceof x?e.a:e);this.snapshotLength=a.l;this.invalidIteratorState=!1;break;case 8:case 9:d=Ra(a);this.singleNodeValue=d instanceof x?d.a:d;break;default:throw Error("Unknown XPathResult type.");}var f=0;this.iterateNext=function(){if(4!=b&&5!=b)throw Error("iterateNext called with wrong result type");return f>=c.length?null:c[f++]};this.snapshotItem=function(a){if(6!=b&&7!=b)throw Error("snapshotItem called with wrong result type");return a>=c.length||
0>a?null:c[a]}}Y.ANY_TYPE=0;Y.NUMBER_TYPE=1;Y.STRING_TYPE=2;Y.BOOLEAN_TYPE=3;Y.UNORDERED_NODE_ITERATOR_TYPE=4;Y.ORDERED_NODE_ITERATOR_TYPE=5;Y.UNORDERED_NODE_SNAPSHOT_TYPE=6;Y.ORDERED_NODE_SNAPSHOT_TYPE=7;Y.ANY_UNORDERED_NODE_TYPE=8;Y.FIRST_ORDERED_NODE_TYPE=9;function Ob(a){this.lookupNamespaceURI=Kb(a)}
function Pb(a,b){var c=a||k,d=c.Document&&c.Document.prototype||c.document;if(!d.evaluate||b)c.XPathResult=Y,d.evaluate=function(a,b,c,d){return(new Nb(a,c)).evaluate(b,d)},d.createExpression=function(a,b){return new Nb(a,b)},d.createNSResolver=function(a){return new Ob(a)}}var Qb=["wgxpath","install"],Z=k;Qb[0]in Z||!Z.execScript||Z.execScript("var "+Qb[0]);for(var Rb;Qb.length&&(Rb=Qb.shift());)Qb.length||void 0===Pb?Z[Rb]?Z=Z[Rb]:Z=Z[Rb]={}:Z[Rb]=Pb;}).call(this)

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/asciimath2jax.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.
*/
MathJax.Extension.asciimath2jax={version:"2.7.9",config:{delimiters:[["`","`"]],skipTags:["script","noscript","style","textarea","pre","code","annotation","annotation-xml"],ignoreClass:"asciimath2jax_ignore",processClass:"asciimath2jax_process",preview:"AsciiMath"},ignoreTags:{br:(MathJax.Hub.Browser.isMSIE&&document.documentMode<9?"\n":" "),wbr:"","#comment":""},PreProcess:function(a){if(!this.configured){this.config=MathJax.Hub.CombineConfig("asciimath2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}this.configured=true}if(typeof(a)==="string"){a=document.getElementById(a)}if(!a){a=document.body}if(this.createPatterns()){this.scanElement(a,a.nextSibling)}},createPatterns:function(){var d=[],c,a,b=this.config;this.match={};if(b.delimiters.length===0){return false}for(c=0,a=b.delimiters.length;c<a;c++){d.push(this.patternQuote(b.delimiters[c][0]));this.match[b.delimiters[c][0]]={mode:"",end:b.delimiters[c][1],pattern:this.endPattern(b.delimiters[c][1])}}this.start=new RegExp(d.sort(this.sortLength).join("|"),"g");this.skipTags=new RegExp("^("+b.skipTags.join("|")+")$","i");var e=[];if(MathJax.Hub.config.preRemoveClass){e.push(MathJax.Hub.config.preRemoveClass)}if(b.ignoreClass){e.push(b.ignoreClass)}this.ignoreClass=(e.length?new RegExp("(^| )("+e.join("|")+")( |$)"):/^$/);this.processClass=new RegExp("(^| )("+b.processClass+")( |$)");return true},patternQuote:function(a){return a.replace(/([\^$(){}+*?\-|\[\]\:\\])/g,"\\$1")},endPattern:function(a){return new RegExp(this.patternQuote(a)+"|\\\\.","g")},sortLength:function(d,c){if(d.length!==c.length){return c.length-d.length}return(d==c?0:(d<c?-1:1))},scanElement:function(c,b,g){var a,e,d,f;while(c&&c!=b){if(c.nodeName.toLowerCase()==="#text"){if(!g){c=this.scanText(c)}}else{a=(typeof(c.className)==="undefined"?"":c.className);e=(typeof(c.tagName)==="undefined"?"":c.tagName);if(typeof(a)!=="string"){a=String(a)}f=this.processClass.exec(a);if(c.firstChild&&!a.match(/(^| )MathJax/)&&(f||!this.skipTags.exec(e))){d=(g||this.ignoreClass.exec(a))&&!f;this.scanElement(c.firstChild,b,d)}}if(c){c=c.nextSibling}}},scanText:function(c){if(c.nodeValue.replace(/\s+/,"")==""){return c}var b,d,e=0,a;this.search={start:true};this.pattern=this.start;while(c){a=null;this.pattern.lastIndex=e||0;e=0;while(c&&c.nodeName.toLowerCase()==="#text"&&(b=this.pattern.exec(c.nodeValue))){if(this.search.start){c=this.startMatch(b,c)}else{c=this.endMatch(b,c)}}if(this.search.matched){c=this.encloseMath(c)}else{if(!this.search.start){a=this.search}}if(c){do{d=c;c=c.nextSibling}while(c&&this.ignoreTags[c.nodeName.toLowerCase()]!=null);if(!c||c.nodeName!=="#text"){if(!a){return d}c=a.open;e=a.opos+a.olen;this.search={start:true};this.pattern=this.start}}}return c},startMatch:function(a,b){var c=this.match[a[0]];if(c!=null){this.search={end:c.end,mode:c.mode,open:b,olen:a[0].length,opos:this.pattern.lastIndex-a[0].length};this.switchPattern(c.pattern)}return b},endMatch:function(a,b){if(a[0]==this.search.end){this.search.close=b;this.search.cpos=this.pattern.lastIndex;this.search.clen=(this.search.isBeginEnd?0:a[0].length);this.search.matched=true;b=this.encloseMath(b);this.switchPattern(this.start)}return b},switchPattern:function(a){a.lastIndex=this.pattern.lastIndex;this.pattern=a;this.search.start=(a===this.start)},encloseMath:function(b){var a=this.search,g=a.close,f,d,c;if(a.cpos===g.length){g=g.nextSibling}else{g=g.splitText(a.cpos)}if(!g){f=g=MathJax.HTML.addText(a.close.parentNode,"")}a.close=g;d=(a.opos?a.open.splitText(a.opos):a.open);while((c=d.nextSibling)&&c!==g){if(c.nodeValue!==null){if(c.nodeName==="#comment"){d.nodeValue+=c.nodeValue.replace(/^\[CDATA\[((.|\n|\r)*)\]\]$/,"$1")}else{d.nodeValue+=d.nextSibling.nodeValue}}else{var h=this.ignoreTags[c.nodeName.toLowerCase()];d.nodeValue+=(h==null?" ":h)}d.parentNode.removeChild(c)}var e=d.nodeValue.substr(a.olen,d.nodeValue.length-a.olen-a.clen);d.parentNode.removeChild(d);if(this.config.preview!=="none"){this.createPreview(a.mode,e)}d=this.createMathTag(a.mode,e);this.search={};this.pattern.lastIndex=0;if(f){f.parentNode.removeChild(f)}return d},insertNode:function(b){var a=this.search;a.close.parentNode.insertBefore(b,a.close)},createPreview:function(d,a){var b=MathJax.Hub.config.preRemoveClass;var c=this.config.preview;if(c==="none"){return}if((this.search.close.previousSibling||{}).className===b){return}if(c==="AsciiMath"){c=[this.filterPreview(a)]}if(c){c=MathJax.HTML.Element("span",{className:b},c);this.insertNode(c)}},createMathTag:function(c,a){var b=document.createElement("script");b.type="math/asciimath"+c;MathJax.HTML.setScript(b,a);this.insertNode(b);return b},filterPreview:function(a){return a}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.asciimath2jax]);MathJax.Ajax.loadComplete("[MathJax]/extensions/asciimath2jax.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/fast-preview.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(b,g,f){var c=b.config.menuSettings;var e=MathJax.OutputJax;var a=f.isMSIE&&(document.documentMode||0)<8;var d=MathJax.Extension["fast-preview"]={version:"2.7.9",enabled:true,config:b.CombineConfig("fast-preview",{Chunks:{EqnChunk:10000,EqnChunkFactor:1,EqnChunkDelay:0},color:"inherit!important",updateTime:30,updateDelay:6,messageStyle:"none",disabled:f.isMSIE&&!f.versionAtLeast("8.0")}),Config:function(){if(b.config["CHTML-preview"]){MathJax.Hub.Config({"fast-preview":b.config["CHTML-preview"]})}var m,j,k,h,l;var i=this.config;if(!i.disabled&&c.FastPreview==null){b.Config({menuSettings:{FastPreview:true}})}if(c.FastPreview){MathJax.Ajax.Styles({".MathJax_Preview .MJXf-math":{color:i.color}});b.Config({"HTML-CSS":i.Chunks,CommonHTML:i.Chunks,SVG:i.Chunks})}b.Register.MessageHook("Begin Math Output",function(){if(!h&&d.Active()){m=b.processUpdateTime;j=b.processUpdateDelay;k=b.config.messageStyle;b.processUpdateTime=i.updateTime;b.processUpdateDelay=i.updateDelay;b.Config({messageStyle:i.messageStyle});MathJax.Message.Clear(0,0);l=true}});b.Register.MessageHook("End Math Output",function(){if(!h&&l){b.processUpdateTime=m;b.processUpdateDelay=j;b.Config({messageStyle:k});h=true}})},Disable:function(){this.enabled=false},Enable:function(){this.enabled=true},Active:function(){return c.FastPreview&&this.enabled&&!(e[c.renderer]||{}).noFastPreview},Preview:function(h){if(!this.Active()||!h.script.parentNode){return}var i=h.script.MathJax.preview||h.script.previousSibling;if(!i||i.className!==MathJax.Hub.config.preRemoveClass){i=g.Element("span",{className:MathJax.Hub.config.preRemoveClass});h.script.parentNode.insertBefore(i,h.script);h.script.MathJax.preview=i}i.innerHTML="";i.style.color=(a?"black":"inherit");return this.postFilter(i,h)},postFilter:function(j,i){if(!i.math.root.toPreviewHTML){var h=MathJax.Callback.Queue();h.Push(["Require",MathJax.Ajax,"[MathJax]/jax/output/PreviewHTML/config.js"],["Require",MathJax.Ajax,"[MathJax]/jax/output/PreviewHTML/jax.js"]);b.RestartAfter(h.Push({}))}i.math.root.toPreviewHTML(j)},Register:function(h){b.Register.StartupHook(h+" Jax Require",function(){var i=MathJax.InputJax[h];i.postfilterHooks.Add(["Preview",MathJax.Extension["fast-preview"]],50)})}};d.Register("TeX");d.Register("MathML");d.Register("AsciiMath");b.Register.StartupHook("End Config",["Config",d]);b.Startup.signal.Post("fast-preview Ready")})(MathJax.Hub,MathJax.HTML,MathJax.Hub.Browser);MathJax.Ajax.loadComplete("[MathJax]/extensions/fast-preview.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/jsMath2jax.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.
*/
MathJax.Extension.jsMath2jax={version:"2.7.9",config:{preview:"TeX"},PreProcess:function(b){if(!this.configured){this.config=MathJax.Hub.CombineConfig("jsMath2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}if(typeof(this.config.previewTeX)!=="undefined"&&!this.config.previewTeX){this.config.preview="none"}this.previewClass=MathJax.Hub.config.preRemoveClass;this.configured=true}if(typeof(b)==="string"){b=document.getElementById(b)}if(!b){b=document.body}var c=b.getElementsByTagName("span"),a;for(a=c.length-1;a>=0;a--){if(String(c[a].className).match(/(^| )math( |$)/)){this.ConvertMath(c[a],"")}}var d=b.getElementsByTagName("div");for(a=d.length-1;a>=0;a--){if(String(d[a].className).match(/(^| )math( |$)/)){this.ConvertMath(d[a],"; mode=display")}}},ConvertMath:function(c,d){if(c.getElementsByTagName("script").length===0){var b=c.parentNode,a=this.createMathTag(d,c.innerHTML);if(c.nextSibling){b.insertBefore(a,c.nextSibling)}else{b.appendChild(a)}if(this.config.preview!=="none"){this.createPreview(c)}b.removeChild(c)}},createPreview:function(b){var a=MathJax.Hub.config.preRemoveClass;var c=this.config.preview;if(c==="none"){return}if((b.previousSibling||{}).className===a){return}if(c==="TeX"){c=[this.filterPreview(b.innerHTML)]}if(c){c=MathJax.HTML.Element("span",{className:a},c);b.parentNode.insertBefore(c,b)}},createMathTag:function(c,b){b=b.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");var a=document.createElement("script");a.type="math/tex"+c;MathJax.HTML.setScript(a,b);return a},filterPreview:function(a){return a}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.jsMath2jax],8);MathJax.Ajax.loadComplete("[MathJax]/extensions/jsMath2jax.js");

View file

@ -0,0 +1,19 @@
/*
* /MathJax-v2/extensions/mml2jax.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.
*/
MathJax.Extension.mml2jax={version:"2.7.9",config:{preview:"mathml"},MMLnamespace:"http://www.w3.org/1998/Math/MathML",PreProcess:function(e){if(!this.configured){this.config=MathJax.Hub.CombineConfig("mml2jax",this.config);if(this.config.Augment){MathJax.Hub.Insert(this,this.config.Augment)}this.InitBrowser();this.configured=true}if(typeof(e)==="string"){e=document.getElementById(e)}if(!e){e=document.body}var h=[];this.PushMathElements(h,e,"math");this.PushMathElements(h,e,"math",this.MMLnamespace);var d,b;if(typeof(document.namespaces)!=="undefined"){try{for(d=0,b=document.namespaces.length;d<b;d++){var f=document.namespaces[d];if(f.urn===this.MMLnamespace){this.PushMathElements(h,e,f.name+":math")}}}catch(g){}}else{var c=document.getElementsByTagName("html")[0];if(c){for(d=0,b=c.attributes.length;d<b;d++){var a=c.attributes[d];if(a.nodeName.substr(0,6)==="xmlns:"&&a.nodeValue===this.MMLnamespace){this.PushMathElements(h,e,a.nodeName.substr(6)+":math")}}}}this.ProcessMathArray(h)},PushMathElements:function(f,d,a,c){var h,g=MathJax.Hub.config.preRemoveClass;if(c){if(!d.getElementsByTagNameNS){return}h=d.getElementsByTagNameNS(c,a)}else{h=d.getElementsByTagName(a)}for(var e=0,b=h.length;e<b;e++){var j=h[e].parentNode;if(j&&j.className!==g&&!j.isMathJax&&!h[e].prefix===!c){f.push(h[e])}}},ProcessMathArray:function(c){var b,a=c.length;if(a){if(this.MathTagBug){for(b=0;b<a;b++){if(c[b].nodeName==="MATH"){this.ProcessMathFlattened(c[b])}else{this.ProcessMath(c[b])}}}else{for(b=0;b<a;b++){this.ProcessMath(c[b])}}}},ProcessMath:function(e){var d=e.parentNode;if(!d||d.className===MathJax.Hub.config.preRemoveClass){return}var a=document.createElement("script");a.type="math/mml";d.insertBefore(a,e);if(this.AttributeBug){var b=this.OuterHTML(e);if(this.CleanupHTML){b=b.replace(/<\?import .*?>/i,"").replace(/<\?xml:namespace .*?\/>/i,"");b=b.replace(/&nbsp;/g,"&#xA0;")}MathJax.HTML.setScript(a,b);d.removeChild(e)}else{var c=MathJax.HTML.Element("span");c.appendChild(e);MathJax.HTML.setScript(a,c.innerHTML)}if(this.config.preview!=="none"){this.createPreview(e,a)}},ProcessMathFlattened:function(f){var d=f.parentNode;if(!d||d.className===MathJax.Hub.config.preRemoveClass){return}var b=document.createElement("script");b.type="math/mml";d.insertBefore(b,f);var c="",e,a=f;while(f&&f.nodeName!=="/MATH"){e=f;f=f.nextSibling;c+=this.NodeHTML(e);e.parentNode.removeChild(e)}if(f&&f.nodeName==="/MATH"){f.parentNode.removeChild(f)}b.text=c+"</math>";if(this.config.preview!=="none"){this.createPreview(a,b)}},NodeHTML:function(e){var c,b,a;if(e.nodeName==="#text"){c=this.quoteHTML(e.nodeValue)}else{if(e.nodeName==="#comment"){c="<!--"+e.nodeValue+"-->"}else{c="<"+e.nodeName.toLowerCase();for(b=0,a=e.attributes.length;b<a;b++){var d=e.attributes[b];if(d.specified&&d.nodeName.substr(0,10)!=="_moz-math-"){c+=" "+d.nodeName.toLowerCase().replace(/xmlns:xmlns/,"xmlns")+"=";var f=d.nodeValue;if(f==null&&d.nodeName==="style"&&e.style){f=e.style.cssText}c+='"'+this.quoteHTML(f)+'"'}}c+=">";if(e.outerHTML!=null&&e.outerHTML.match(/(.<\/[A-Z]+>|\/>)$/)){for(b=0,a=e.childNodes.length;b<a;b++){c+=this.OuterHTML(e.childNodes[b])}c+="</"+e.nodeName.toLowerCase()+">"}}}return c},OuterHTML:function(d){if(d.nodeName.charAt(0)==="#"){return this.NodeHTML(d)}if(!this.AttributeBug){return d.outerHTML}var c=this.NodeHTML(d);for(var b=0,a=d.childNodes.length;b<a;b++){c+=this.OuterHTML(d.childNodes[b])}c+="</"+d.nodeName.toLowerCase()+">";return c},quoteHTML:function(a){if(a==null){a=""}return a.replace(/&/g,"&#x26;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;")},createPreview:function(g,f){var e=this.config.preview;if(e==="none"){return}var i=false;var c=MathJax.Hub.config.preRemoveClass;if((f.previousSibling||{}).className===c){return}if(e==="mathml"){i=true;if(this.MathTagBug){e="alttext"}else{e=g.cloneNode(true)}}if(e==="alttext"||e==="altimg"){i=true;var d=this.filterPreview(g.getAttribute("alttext"));if(e==="alttext"){if(d!=null){e=MathJax.HTML.TextNode(d)}else{e=null}}else{var a=g.getAttribute("altimg");if(a!=null){var b={width:g.getAttribute("altimg-width"),height:g.getAttribute("altimg-height")};e=MathJax.HTML.Element("img",{src:a,alt:d,style:b})}else{e=null}}}if(e){var h;if(i){h=MathJax.HTML.Element("span",{className:c});h.appendChild(e)}else{h=MathJax.HTML.Element("span",{className:c},e)}f.parentNode.insertBefore(h,f)}},filterPreview:function(a){return a},InitBrowser:function(){var b=MathJax.HTML.Element("span",{id:"<",className:"mathjax",innerHTML:"<math><mi>x</mi><mspace /></math>"});var a=b.outerHTML||"";this.AttributeBug=a!==""&&!(a.match(/id="&lt;"/)&&a.match(/class="mathjax"/)&&a.match(/<\/math>/));this.MathTagBug=b.childNodes.length>1;this.CleanupHTML=MathJax.Hub.Browser.isMSIE}};MathJax.Hub.Register.PreProcessor(["PreProcess",MathJax.Extension.mml2jax],5);MathJax.Ajax.loadComplete("[MathJax]/extensions/mml2jax.js");

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show more